@macrostrat/feedback-components 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/esm/{feedback-components.95dbe7d7.js → feedback-components.00434ff7.js} +10 -1
- package/dist/esm/feedback-components.00434ff7.js.map +1 -0
- package/dist/esm/{feedback-components.46a7a347.js → feedback-components.1c15f37f.js} +101 -12
- package/dist/esm/feedback-components.1c15f37f.js.map +1 -0
- package/dist/esm/{feedback-components.586103e8.js → feedback-components.204f7d2b.js} +27 -276
- package/dist/esm/feedback-components.204f7d2b.js.map +1 -0
- package/dist/esm/{feedback-components.3b3a5357.js → feedback-components.28ba71be.js} +19 -8
- package/dist/esm/feedback-components.28ba71be.js.map +1 -0
- package/dist/esm/{feedback-components.5df2a926.js → feedback-components.707e3490.js} +5 -7
- package/dist/esm/feedback-components.707e3490.js.map +1 -0
- package/dist/esm/feedback-components.7e879290.js +286 -0
- package/dist/esm/feedback-components.7e879290.js.map +1 -0
- package/dist/esm/{feedback-components.5509fab3.js → feedback-components.d55a1d18.js} +6 -6
- package/dist/esm/{feedback-components.5509fab3.js.map → feedback-components.d55a1d18.js.map} +1 -1
- package/dist/esm/{feedback-components.fb60c70d.css → feedback-components.d591ffec.css} +20 -1
- package/dist/esm/feedback-components.d591ffec.css.map +1 -0
- package/dist/esm/{feedback-components.fa1d3641.js → feedback-components.f6605b83.js} +49 -7
- package/dist/esm/feedback-components.f6605b83.js.map +1 -0
- package/dist/esm/feedback-components.fd8ac9ca.js +230 -0
- package/dist/esm/feedback-components.fd8ac9ca.js.map +1 -0
- package/dist/esm/index.d.ts +5 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/node/feedback-components.0eef8d0c.js +2 -0
- package/dist/node/feedback-components.0eef8d0c.js.map +1 -0
- package/dist/node/{feedback-components.a39f7653.js → feedback-components.2f740fc7.js} +2 -2
- package/dist/node/{feedback-components.a39f7653.js.map → feedback-components.2f740fc7.js.map} +1 -1
- package/dist/node/feedback-components.41db283a.js +2 -0
- package/dist/node/feedback-components.41db283a.js.map +1 -0
- package/dist/node/feedback-components.69d0ccd0.js +2 -0
- package/dist/node/feedback-components.69d0ccd0.js.map +1 -0
- package/dist/node/feedback-components.a7b43cfa.js +2 -0
- package/dist/node/feedback-components.a7b43cfa.js.map +1 -0
- package/dist/node/feedback-components.b22d37d1.js +2 -0
- package/dist/node/feedback-components.b22d37d1.js.map +1 -0
- package/dist/node/feedback-components.b9317f9c.js +2 -0
- package/dist/node/feedback-components.b9317f9c.js.map +1 -0
- package/dist/node/{feedback-components.c88cb37f.css → feedback-components.e096504e.css} +2 -2
- package/dist/node/feedback-components.e096504e.css.map +1 -0
- package/dist/node/feedback-components.e140ac86.js +2 -0
- package/dist/node/feedback-components.e140ac86.js.map +1 -0
- package/dist/node/feedback-components.f8373b58.js +2 -0
- package/dist/node/feedback-components.f8373b58.js.map +1 -0
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +3 -2
- package/src/extractions/index.ts +7 -2
- package/src/extractions/types.ts +1 -0
- package/src/feedback/edit-state.ts +52 -3
- package/src/feedback/feedback.module.sass +17 -1
- package/src/feedback/graph.ts +17 -4
- package/src/feedback/index.ts +14 -309
- package/src/feedback/matches.ts +241 -0
- package/src/feedback/text-visualizer.ts +114 -4
- package/src/feedback/typelist.ts +312 -0
- package/dist/esm/feedback-components.3b3a5357.js.map +0 -1
- package/dist/esm/feedback-components.46a7a347.js.map +0 -1
- package/dist/esm/feedback-components.586103e8.js.map +0 -1
- package/dist/esm/feedback-components.5df2a926.js.map +0 -1
- package/dist/esm/feedback-components.95dbe7d7.js.map +0 -1
- package/dist/esm/feedback-components.fa1d3641.js.map +0 -1
- package/dist/esm/feedback-components.fb60c70d.css.map +0 -1
- package/dist/node/feedback-components.561466ac.js +0 -2
- package/dist/node/feedback-components.561466ac.js.map +0 -1
- package/dist/node/feedback-components.571ee23c.js +0 -2
- package/dist/node/feedback-components.571ee23c.js.map +0 -1
- package/dist/node/feedback-components.8b03e8be.js +0 -2
- package/dist/node/feedback-components.8b03e8be.js.map +0 -1
- package/dist/node/feedback-components.b7946db4.js +0 -2
- package/dist/node/feedback-components.b7946db4.js.map +0 -1
- package/dist/node/feedback-components.c459cc27.js +0 -2
- package/dist/node/feedback-components.c459cc27.js.map +0 -1
- package/dist/node/feedback-components.c88cb37f.css.map +0 -1
- package/dist/node/feedback-components.ec54a1e7.js +0 -2
- package/dist/node/feedback-components.ec54a1e7.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format
|
|
|
4
4
|
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.1.4] - 2025-07-16
|
|
8
|
+
|
|
9
|
+
- Add and remove match feature added
|
|
10
|
+
- Match now featured on sidebox
|
|
11
|
+
|
|
12
|
+
## [1.1.3] - 2025-07-16
|
|
13
|
+
|
|
14
|
+
- Graph node clicking logic same as graph and tree
|
|
15
|
+
- "Show matches" switch to displayed matchs on tag hover
|
|
16
|
+
|
|
7
17
|
## [1.1.2] - 2025-07-10
|
|
8
18
|
|
|
9
19
|
- Increased the default line spacing in the paragraph text (made it configurable
|
|
@@ -6,6 +6,7 @@ var $49c87ee97f392268$exports = {};
|
|
|
6
6
|
|
|
7
7
|
$parcel$export($49c87ee97f392268$exports, "add-type", () => $49c87ee97f392268$export$cb889aaddfa2926c, (v) => $49c87ee97f392268$export$cb889aaddfa2926c = v);
|
|
8
8
|
$parcel$export($49c87ee97f392268$exports, "add-type-overlay", () => $49c87ee97f392268$export$5f8f750fd71deeed, (v) => $49c87ee97f392268$export$5f8f750fd71deeed = v);
|
|
9
|
+
$parcel$export($49c87ee97f392268$exports, "close-btn", () => $49c87ee97f392268$export$f5032a039312e50b, (v) => $49c87ee97f392268$export$f5032a039312e50b = v);
|
|
9
10
|
$parcel$export($49c87ee97f392268$exports, "control-content", () => $49c87ee97f392268$export$42e8b5293e69631e, (v) => $49c87ee97f392268$export$42e8b5293e69631e = v);
|
|
10
11
|
$parcel$export($49c87ee97f392268$exports, "control-panel", () => $49c87ee97f392268$export$a0a23f31d5562853, (v) => $49c87ee97f392268$export$a0a23f31d5562853 = v);
|
|
11
12
|
$parcel$export($49c87ee97f392268$exports, "description", () => $49c87ee97f392268$export$6d59db4903f20f7d, (v) => $49c87ee97f392268$export$6d59db4903f20f7d = v);
|
|
@@ -17,6 +18,8 @@ $parcel$export($49c87ee97f392268$exports, "feedback-text-wrapper", () => $49c87e
|
|
|
17
18
|
$parcel$export($49c87ee97f392268$exports, "form-group", () => $49c87ee97f392268$export$55a1f87a143fb302, (v) => $49c87ee97f392268$export$55a1f87a143fb302 = v);
|
|
18
19
|
$parcel$export($49c87ee97f392268$exports, "highlight", () => $49c87ee97f392268$export$e4043f67d36cbb26, (v) => $49c87ee97f392268$export$e4043f67d36cbb26 = v);
|
|
19
20
|
$parcel$export($49c87ee97f392268$exports, "icons", () => $49c87ee97f392268$export$df03f54e09e486fa, (v) => $49c87ee97f392268$export$df03f54e09e486fa = v);
|
|
21
|
+
$parcel$export($49c87ee97f392268$exports, "match-container", () => $49c87ee97f392268$export$864d1dadc1dd3f57, (v) => $49c87ee97f392268$export$864d1dadc1dd3f57 = v);
|
|
22
|
+
$parcel$export($49c87ee97f392268$exports, "match-item", () => $49c87ee97f392268$export$a7bcc8ced81f8d07, (v) => $49c87ee97f392268$export$a7bcc8ced81f8d07 = v);
|
|
20
23
|
$parcel$export($49c87ee97f392268$exports, "node", () => $49c87ee97f392268$export$35059013cd4a06db, (v) => $49c87ee97f392268$export$35059013cd4a06db = v);
|
|
21
24
|
$parcel$export($49c87ee97f392268$exports, "node-label", () => $49c87ee97f392268$export$75d14899fb692bb6, (v) => $49c87ee97f392268$export$75d14899fb692bb6 = v);
|
|
22
25
|
$parcel$export($49c87ee97f392268$exports, "overlay-container", () => $49c87ee97f392268$export$6a1093e41947f68e, (v) => $49c87ee97f392268$export$6a1093e41947f68e = v);
|
|
@@ -30,6 +33,7 @@ $parcel$export($49c87ee97f392268$exports, "type-list", () => $49c87ee97f392268$e
|
|
|
30
33
|
$parcel$export($49c87ee97f392268$exports, "type-tag", () => $49c87ee97f392268$export$5e5acbc770fb0e4, (v) => $49c87ee97f392268$export$5e5acbc770fb0e4 = v);
|
|
31
34
|
var $49c87ee97f392268$export$cb889aaddfa2926c;
|
|
32
35
|
var $49c87ee97f392268$export$5f8f750fd71deeed;
|
|
36
|
+
var $49c87ee97f392268$export$f5032a039312e50b;
|
|
33
37
|
var $49c87ee97f392268$export$42e8b5293e69631e;
|
|
34
38
|
var $49c87ee97f392268$export$a0a23f31d5562853;
|
|
35
39
|
var $49c87ee97f392268$export$6d59db4903f20f7d;
|
|
@@ -41,6 +45,8 @@ var $49c87ee97f392268$export$6bd0fd0a746c88f;
|
|
|
41
45
|
var $49c87ee97f392268$export$55a1f87a143fb302;
|
|
42
46
|
var $49c87ee97f392268$export$e4043f67d36cbb26;
|
|
43
47
|
var $49c87ee97f392268$export$df03f54e09e486fa;
|
|
48
|
+
var $49c87ee97f392268$export$864d1dadc1dd3f57;
|
|
49
|
+
var $49c87ee97f392268$export$a7bcc8ced81f8d07;
|
|
44
50
|
var $49c87ee97f392268$export$35059013cd4a06db;
|
|
45
51
|
var $49c87ee97f392268$export$75d14899fb692bb6;
|
|
46
52
|
var $49c87ee97f392268$export$6a1093e41947f68e;
|
|
@@ -54,6 +60,7 @@ var $49c87ee97f392268$export$915fe2ca68846e4c;
|
|
|
54
60
|
var $49c87ee97f392268$export$5e5acbc770fb0e4;
|
|
55
61
|
$49c87ee97f392268$export$cb889aaddfa2926c = `QoX8-W_add-type`;
|
|
56
62
|
$49c87ee97f392268$export$5f8f750fd71deeed = `QoX8-W_add-type-overlay`;
|
|
63
|
+
$49c87ee97f392268$export$f5032a039312e50b = `QoX8-W_close-btn`;
|
|
57
64
|
$49c87ee97f392268$export$42e8b5293e69631e = `QoX8-W_control-content`;
|
|
58
65
|
$49c87ee97f392268$export$a0a23f31d5562853 = `QoX8-W_control-panel`;
|
|
59
66
|
$49c87ee97f392268$export$6d59db4903f20f7d = `QoX8-W_description`;
|
|
@@ -65,6 +72,8 @@ $49c87ee97f392268$export$6bd0fd0a746c88f = `QoX8-W_feedback-text-wrapper`;
|
|
|
65
72
|
$49c87ee97f392268$export$55a1f87a143fb302 = `QoX8-W_form-group`;
|
|
66
73
|
$49c87ee97f392268$export$e4043f67d36cbb26 = `QoX8-W_highlight`;
|
|
67
74
|
$49c87ee97f392268$export$df03f54e09e486fa = `QoX8-W_icons`;
|
|
75
|
+
$49c87ee97f392268$export$864d1dadc1dd3f57 = `QoX8-W_match-container`;
|
|
76
|
+
$49c87ee97f392268$export$a7bcc8ced81f8d07 = `QoX8-W_match-item`;
|
|
68
77
|
$49c87ee97f392268$export$35059013cd4a06db = `QoX8-W_node`;
|
|
69
78
|
$49c87ee97f392268$export$75d14899fb692bb6 = `QoX8-W_node-label`;
|
|
70
79
|
$49c87ee97f392268$export$6a1093e41947f68e = `QoX8-W_overlay-container`;
|
|
@@ -79,4 +88,4 @@ $49c87ee97f392268$export$5e5acbc770fb0e4 = `QoX8-W_type-tag`;
|
|
|
79
88
|
|
|
80
89
|
|
|
81
90
|
export {$49c87ee97f392268$exports as default};
|
|
82
|
-
//# sourceMappingURL=feedback-components.
|
|
91
|
+
//# sourceMappingURL=feedback-components.00434ff7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AA1BA,4CAA6B,CAAC,eAAe,CAAC;AAC9C,4CAAqC,CAAC,uBAAuB,CAAC;AAC9D,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,4CAAoC,CAAC,sBAAsB,CAAC;AAC5D,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,2CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,2CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,4CAA0B,CAAC,YAAY,CAAC;AACxC,4CAAoC,CAAC,sBAAsB,CAAC;AAC5D,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAyB,CAAC,WAAW,CAAC;AACtC,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAsC,CAAC,wBAAwB,CAAC;AAChE,4CAAiC,CAAC,mBAAmB,CAAC;AACtD,4CAA6B,CAAC,eAAe,CAAC;AAC9C,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,2CAAgC,CAAC,kBAAkB,CAAC;AACpD,4CAA0B,CAAC,YAAY,CAAC;AACxC,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA8B,CAAC,gBAAgB,CAAC;AAChD,2CAA6B,CAAC,eAAe,CAAC","sources":["packages/feedback-components/src/feedback/feedback.module.sass"],"sourcesContent":[":root\n --text-line-height: 3em\n --main-extra-width: 200px\n\n.page-wrapper\n display: flex\n flex-direction: row\n position: relative\n gap: 2em\n align-items: flex-start // makes control-content lose stick\n\n.feedback-container\n flex: 4\n\n.control-panel\n flex: 1\n height: auto\n\n.control-content\n position: sticky\n top: 0\n\n.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 width: calc(100% - 2em)\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 \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 line-height: var(--text-line-height)\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\n\n.node-label\n fill: var(--text-emphasized-color)\n fontSize: 10px\n pointerEvents: none\n\n.match-item\n background-color: var(--background-color)\n color: var(--text-emphasized-color)\n padding: .1em .2em\n border-radius: .2em\n margin-bottom: 4px\n cursor: pointer\n\n.match-container\n display: flex\n justify-content: space-between\n align-items: center\n\n .close-btn\n cursor: pointer"],"names":[],"version":3,"file":"feedback-components.00434ff7.js.map"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import "./feedback-components.
|
|
2
|
-
import $aogpP$
|
|
3
|
-
import {buildHighlights as $03d8811e9c9b360d$export$c4b91360064ad200, getTagStyle as $03d8811e9c9b360d$export$35baa338324d8550} from "./feedback-components.
|
|
1
|
+
import "./feedback-components.d591ffec.css";
|
|
2
|
+
import $aogpP$feedbackcomponents00434ff7js from "./feedback-components.00434ff7.js";
|
|
3
|
+
import {buildHighlights as $03d8811e9c9b360d$export$c4b91360064ad200, getTagStyle as $03d8811e9c9b360d$export$35baa338324d8550} from "./feedback-components.707e3490.js";
|
|
4
4
|
import $aogpP$macrostrathyper from "@macrostrat/hyper";
|
|
5
5
|
import {useRef as $aogpP$useRef, useEffect as $aogpP$useEffect} from "react";
|
|
6
|
+
import {Icon as $aogpP$Icon} from "@blueprintjs/core";
|
|
7
|
+
import {JSONView as $aogpP$JSONView, DataField as $aogpP$DataField} from "@macrostrat/ui-components";
|
|
8
|
+
import {LithologyTag as $aogpP$LithologyTag} from "@macrostrat/data-components";
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
function $parcel$interopDefault(a) {
|
|
@@ -12,7 +15,10 @@ function $parcel$interopDefault(a) {
|
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const $156a3efbc315814c$var$h = (0, $aogpP$macrostrathyper).styled((0, ($parcel$interopDefault($aogpP$feedbackcomponents00434ff7js))));
|
|
16
22
|
function $156a3efbc315814c$var$buildTags(highlights, selectedNodes) {
|
|
17
23
|
let tags = [];
|
|
18
24
|
// If entity ID has already been seen, don't add it again
|
|
@@ -51,7 +57,7 @@ function $156a3efbc315814c$var$isHighlighted(tag, selectedNodes) {
|
|
|
51
57
|
}
|
|
52
58
|
function $156a3efbc315814c$export$6e107db9091b8219(props) {
|
|
53
59
|
// Convert input to tags
|
|
54
|
-
const { text: text, selectedNodes: selectedNodes, nodes: nodes, dispatch: dispatch, allowOverlap: allowOverlap } = props;
|
|
60
|
+
const { text: text, selectedNodes: selectedNodes, nodes: nodes, dispatch: dispatch, allowOverlap: allowOverlap, matchLinks: matchLinks } = props;
|
|
55
61
|
const allTags = $156a3efbc315814c$var$buildTags((0, $03d8811e9c9b360d$export$c4b91360064ad200)(nodes, null), selectedNodes);
|
|
56
62
|
return $156a3efbc315814c$var$h("div.feedback-text-wrapper", {
|
|
57
63
|
tabIndex: 0,
|
|
@@ -68,7 +74,8 @@ function $156a3efbc315814c$export$6e107db9091b8219(props) {
|
|
|
68
74
|
allTags: allTags,
|
|
69
75
|
allowOverlap: allowOverlap,
|
|
70
76
|
dispatch: dispatch,
|
|
71
|
-
selectedNodes: selectedNodes
|
|
77
|
+
selectedNodes: selectedNodes,
|
|
78
|
+
matchLinks: matchLinks
|
|
72
79
|
}));
|
|
73
80
|
}
|
|
74
81
|
function $156a3efbc315814c$var$createTagFromSelection({ container: container }) {
|
|
@@ -173,7 +180,7 @@ function $156a3efbc315814c$var$nestHighlights(text, tags) {
|
|
|
173
180
|
if (lastPos < text.length) stack[stack.length - 1].children.push(text.slice(lastPos));
|
|
174
181
|
return root;
|
|
175
182
|
}
|
|
176
|
-
function $156a3efbc315814c$var$renderNode(node, dispatch, selectedNodes, parentSelected) {
|
|
183
|
+
function $156a3efbc315814c$var$renderNode(node, dispatch, selectedNodes, parentSelected, matchLinks) {
|
|
177
184
|
if (typeof node === "string") return node;
|
|
178
185
|
const { tag: tag, children: children } = node;
|
|
179
186
|
const isSelected = selectedNodes?.includes(tag.id);
|
|
@@ -193,6 +200,9 @@ function $156a3efbc315814c$var$renderNode(node, dispatch, selectedNodes, parentS
|
|
|
193
200
|
}
|
|
194
201
|
}
|
|
195
202
|
return $156a3efbc315814c$var$h("span", {
|
|
203
|
+
onMouseEnter: (e)=>{
|
|
204
|
+
e.stopPropagation();
|
|
205
|
+
},
|
|
196
206
|
className: "highlight",
|
|
197
207
|
style: style,
|
|
198
208
|
onClick: (e)=>{
|
|
@@ -229,10 +239,10 @@ function $156a3efbc315814c$var$renderNode(node, dispatch, selectedNodes, parentS
|
|
|
229
239
|
}
|
|
230
240
|
});
|
|
231
241
|
}
|
|
232
|
-
}, isSelected ? moveText.flat() : children.map((child, i)=>$156a3efbc315814c$var$renderNode(child, dispatch, selectedNodes, isSelected)));
|
|
242
|
+
}, isSelected ? moveText.flat() : children.map((child, i)=>$156a3efbc315814c$var$renderNode(child, dispatch, selectedNodes, isSelected, matchLinks)));
|
|
233
243
|
}
|
|
234
244
|
function $156a3efbc315814c$export$190465bec6b893be(props) {
|
|
235
|
-
const { text: text, allTags: allTags = [], dispatch: dispatch, selectedNodes: selectedNodes, allowOverlap: allowOverlap } = props;
|
|
245
|
+
const { text: text, allTags: allTags = [], dispatch: dispatch, selectedNodes: selectedNodes, allowOverlap: allowOverlap, matchLinks: matchLinks } = props;
|
|
236
246
|
const tree = $156a3efbc315814c$var$nestHighlights(text, allTags);
|
|
237
247
|
const spanRef = (0, $aogpP$useRef)(null);
|
|
238
248
|
(0, $aogpP$useEffect)(()=>{
|
|
@@ -261,9 +271,88 @@ function $156a3efbc315814c$export$190465bec6b893be(props) {
|
|
|
261
271
|
]);
|
|
262
272
|
return $156a3efbc315814c$var$h("span", {
|
|
263
273
|
ref: spanRef
|
|
264
|
-
}, tree.children.map((child, i)=>$156a3efbc315814c$var$renderNode(child, dispatch, selectedNodes, false)));
|
|
274
|
+
}, tree.children.map((child, i)=>$156a3efbc315814c$var$renderNode(child, dispatch, selectedNodes, false, matchLinks)));
|
|
275
|
+
}
|
|
276
|
+
function $156a3efbc315814c$export$f421feb8fad20413({ data: data, matchLinks: matchLinks, dispatch: dispatch, nodeId: nodeId }) {
|
|
277
|
+
if (!data || Object.keys(data).length === 0) return;
|
|
278
|
+
let tag = $156a3efbc315814c$var$h((0, $aogpP$JSONView), {
|
|
279
|
+
data: data
|
|
280
|
+
});
|
|
281
|
+
if (data.lith_id) tag = $156a3efbc315814c$var$h((0, $aogpP$DataField), {
|
|
282
|
+
label: "Lithology",
|
|
283
|
+
value: $156a3efbc315814c$var$h((0, $aogpP$LithologyTag), {
|
|
284
|
+
data: {
|
|
285
|
+
name: data.name,
|
|
286
|
+
id: data.lith_id,
|
|
287
|
+
color: data.color
|
|
288
|
+
},
|
|
289
|
+
onClick: (e)=>{
|
|
290
|
+
e.stopPropagation();
|
|
291
|
+
if (matchLinks.lithology) window.open(matchLinks.lithology + "/" + data.lith_id, "_blank");
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
if (data.strat_name_id) tag = $156a3efbc315814c$var$h("div", [
|
|
296
|
+
$156a3efbc315814c$var$h((0, $aogpP$DataField), {
|
|
297
|
+
label: "Stratigraphic name",
|
|
298
|
+
value: $156a3efbc315814c$var$h((0, $aogpP$LithologyTag), {
|
|
299
|
+
data: {
|
|
300
|
+
name: data.name,
|
|
301
|
+
id: data.strat_name_id,
|
|
302
|
+
color: data.color
|
|
303
|
+
},
|
|
304
|
+
onClick: (e)=>{
|
|
305
|
+
e.stopPropagation();
|
|
306
|
+
if (matchLinks.strat_name) window.open(matchLinks.strat_name + "/" + data.strat_name_id, "_blank");
|
|
307
|
+
}
|
|
308
|
+
})
|
|
309
|
+
}),
|
|
310
|
+
$156a3efbc315814c$var$h.if(data.concept_id)((0, $aogpP$DataField), {
|
|
311
|
+
label: "Stratigraphic concept",
|
|
312
|
+
value: $156a3efbc315814c$var$h((0, $aogpP$LithologyTag), {
|
|
313
|
+
data: {
|
|
314
|
+
name: data.name,
|
|
315
|
+
id: data.concept_id,
|
|
316
|
+
color: data.color
|
|
317
|
+
},
|
|
318
|
+
onClick: (e)=>{
|
|
319
|
+
e.stopPropagation();
|
|
320
|
+
if (matchLinks.concept) window.open(matchLinks.concept + "/" + data.concept_id, "_blank");
|
|
321
|
+
}
|
|
322
|
+
})
|
|
323
|
+
})
|
|
324
|
+
]);
|
|
325
|
+
if (data.lith_att_id) tag = $156a3efbc315814c$var$h((0, $aogpP$DataField), {
|
|
326
|
+
label: "Lithology attribute",
|
|
327
|
+
value: $156a3efbc315814c$var$h((0, $aogpP$LithologyTag), {
|
|
328
|
+
data: {
|
|
329
|
+
name: data.name,
|
|
330
|
+
id: data.lith_att_id
|
|
331
|
+
},
|
|
332
|
+
onClick: (e)=>{
|
|
333
|
+
e.stopPropagation();
|
|
334
|
+
if (matchLinks.lith_att) window.open(matchLinks.lith_att + "/" + data.lith_att_id, "_blank");
|
|
335
|
+
}
|
|
336
|
+
})
|
|
337
|
+
});
|
|
338
|
+
return $156a3efbc315814c$var$h("div.match-container", [
|
|
339
|
+
tag,
|
|
340
|
+
$156a3efbc315814c$var$h((0, $aogpP$Icon), {
|
|
341
|
+
icon: "cross",
|
|
342
|
+
color: "red",
|
|
343
|
+
className: "close-btn",
|
|
344
|
+
onClick: ()=>{
|
|
345
|
+
dispatch({
|
|
346
|
+
type: "remove-match",
|
|
347
|
+
payload: {
|
|
348
|
+
id: nodeId
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
]);
|
|
265
354
|
}
|
|
266
355
|
|
|
267
356
|
|
|
268
|
-
export {$156a3efbc315814c$export$6e107db9091b8219 as FeedbackText, $156a3efbc315814c$export$190465bec6b893be as HighlightedText};
|
|
269
|
-
//# sourceMappingURL=feedback-components.
|
|
357
|
+
export {$156a3efbc315814c$export$6e107db9091b8219 as FeedbackText, $156a3efbc315814c$export$190465bec6b893be as HighlightedText, $156a3efbc315814c$export$f421feb8fad20413 as Match};
|
|
358
|
+
//# sourceMappingURL=feedback-components.1c15f37f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;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BACjB,IAAI,WAAW,UAAU,EACvB,OAAO,IAAI,CACT,WAAW,UAAU,GAAG,MAAM,KAAK,aAAa,EAChD;gBAGN;YACF;QACF;QACA,wBAAE,EAAE,CAAC,KAAK,UAAU,EAAE,CAAA,GAAA,gBAAQ,GAAG;YAC/B,OAAO;YACP,OAAO,wBAAE,CAAA,GAAA,mBAAW,GAAG;gBACrB,MAAM;oBAAE,MAAM,KAAK,IAAI;oBAAE,IAAI,KAAK,UAAU;oBAAE,OAAO,KAAK,KAAK;gBAAC;gBAChE,SAAS,CAAC;oBACR,EAAE,eAAe;oBACjB,IAAI,WAAW,OAAO,EACpB,OAAO,IAAI,CAAC,WAAW,OAAO,GAAG,MAAM,KAAK,UAAU,EAAE;gBAE5D;YACF;QACF;KACD;IAGH,IAAI,KAAK,WAAW,EAClB,MAAM,wBAAE,CAAA,GAAA,gBAAQ,GAAG;QACjB,OAAO;QACP,OAAO,wBAAE,CAAA,GAAA,mBAAW,GAAG;YACrB,MAAM;gBAAE,MAAM,KAAK,IAAI;gBAAE,IAAI,KAAK,WAAW;YAAC;YAC9C,SAAS,CAAC;gBACR,EAAE,eAAe;gBACjB,IAAI,WAAW,QAAQ,EACrB,OAAO,IAAI,CAAC,WAAW,QAAQ,GAAG,MAAM,KAAK,WAAW,EAAE;YAE9D;QACF;IACF;IAGF,OAAO,wBAAE,uBAAuB;QAC9B;QACA,wBAAE,CAAA,GAAA,WAAG,GAAG;YACN,MAAM;YACN,OAAO;YACP,WAAW;YACX,SAAS;gBACP,SAAS;oBAAE,MAAM;oBAAgB,SAAS;wBAAE,IAAI;oBAAO;gBAAE;YAC3D;QACF;KACD;AACH","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\";\nimport { Icon } from \"@blueprintjs/core\";\nimport { DataField, JSONView } from \"@macrostrat/ui-components\";\nimport { LithologyList, LithologyTag } from \"@macrostrat/data-components\";\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 matchLinks?: {\n lithology: string;\n strat_name: string;\n lith_att: string;\n };\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, allowOverlap, matchLinks } =\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 allowOverlap,\n dispatch,\n selectedNodes,\n matchLinks,\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 let { start, end } = tag;\n // snap to text\n if (text[end - 1] != \" \") {\n // double clicking word overselects by one, shouldn't increase to next word\n while (start > 0 && /\\w/.test(text[start - 1])) {\n start--;\n }\n while (end < text.length && /\\w/.test(text[end])) {\n end++;\n }\n }\n\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 matchLinks?: {\n lithology: string;\n strat_name: string;\n lith_att: string;\n },\n): any {\n if (typeof node === \"string\") return node;\n\n const { tag, children } = node;\n const isSelected = selectedNodes?.includes(tag.id);\n const showBorder = selectedNodes.length === 0 || isSelected;\n\n const style = {\n ...tag,\n zIndex: parentSelected ? -1 : 1,\n border: \"1px solid \" + (showBorder ? tag.color : \"transparent\"),\n margin: \"-1px\",\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 onMouseEnter: (e: MouseEvent) => {\n e.stopPropagation();\n },\n className: \"highlight\",\n style,\n onClick: (e: MouseEvent) => {\n e.stopPropagation();\n if (\n e.ctrlKey ||\n e.metaKey ||\n (selectedNodes[0] === tag.id && selectedNodes.length === 1)\n ) {\n // Toggle selection on ctrl/cmd click or when node is only selected node\n e.stopPropagation();\n dispatch({\n type: \"toggle-node-selected\",\n payload: { ids: [tag.id] },\n });\n } else if (e.shiftKey && selectedNodes.length > 0) {\n // Select range from last selected node to this one\n const lastSelected = selectedNodes[selectedNodes.length - 1];\n\n dispatch({\n type: \"select-range\",\n payload: { ids: [lastSelected, tag.id] },\n });\n } else {\n dispatch({\n type: \"select-node\",\n payload: { ids: [tag.id] },\n });\n }\n },\n },\n isSelected\n ? moveText.flat()\n : children.map((child: any, i: number) =>\n renderNode(child, dispatch, selectedNodes, isSelected, matchLinks),\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 matchLinks?: {\n lithology: string;\n strat_name: string;\n lith_att: string;\n };\n}) {\n const {\n text,\n allTags = [],\n dispatch,\n selectedNodes,\n allowOverlap,\n matchLinks,\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 { ref: spanRef },\n tree.children.map((child: any, i: number) =>\n renderNode(child, dispatch, selectedNodes, false, matchLinks),\n ),\n );\n}\n\nexport function Match({ data, matchLinks, dispatch, nodeId }) {\n if (!data || Object.keys(data).length === 0) return;\n\n let tag = h(JSONView, { data });\n\n if (data.lith_id) {\n tag = h(DataField, {\n label: \"Lithology\",\n value: h(LithologyTag, {\n data: { name: data.name, id: data.lith_id, color: data.color },\n onClick: (e) => {\n e.stopPropagation();\n if (matchLinks.lithology) {\n window.open(matchLinks.lithology + \"/\" + data.lith_id, \"_blank\");\n }\n },\n }),\n });\n }\n\n if (data.strat_name_id) {\n tag = h(\"div\", [\n h(DataField, {\n label: \"Stratigraphic name\",\n value: h(LithologyTag, {\n data: { name: data.name, id: data.strat_name_id, color: data.color },\n onClick: (e) => {\n e.stopPropagation();\n if (matchLinks.strat_name) {\n window.open(\n matchLinks.strat_name + \"/\" + data.strat_name_id,\n \"_blank\",\n );\n }\n },\n }),\n }),\n h.if(data.concept_id)(DataField, {\n label: \"Stratigraphic concept\",\n value: h(LithologyTag, {\n data: { name: data.name, id: data.concept_id, color: data.color },\n onClick: (e) => {\n e.stopPropagation();\n if (matchLinks.concept) {\n window.open(matchLinks.concept + \"/\" + data.concept_id, \"_blank\");\n }\n },\n }),\n }),\n ]);\n }\n\n if (data.lith_att_id) {\n tag = h(DataField, {\n label: \"Lithology attribute\",\n value: h(LithologyTag, {\n data: { name: data.name, id: data.lith_att_id },\n onClick: (e) => {\n e.stopPropagation();\n if (matchLinks.lith_att) {\n window.open(matchLinks.lith_att + \"/\" + data.lith_att_id, \"_blank\");\n }\n },\n }),\n });\n }\n\n return h(\"div.match-container\", [\n tag,\n h(Icon, {\n icon: \"cross\",\n color: \"red\",\n className: \"close-btn\",\n onClick: () => {\n dispatch({ type: \"remove-match\", payload: { id: nodeId } });\n },\n }),\n ]);\n}\n"],"names":[],"version":3,"file":"feedback-components.1c15f37f.js.map"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import "./feedback-components.
|
|
2
|
-
import $bvJLP$
|
|
3
|
-
import $b6b9741bf83336eb$export$2e2bcd8739ae039 from "./feedback-components.
|
|
4
|
-
import {FeedbackText as $156a3efbc315814c$export$6e107db9091b8219} from "./feedback-components.
|
|
5
|
-
import {
|
|
6
|
-
import {TreeDispatchContext as $b79bf29960412ca7$export$e5ce04c5b3f58533, treeToGraph as $b79bf29960412ca7$export$8d9dbb7a64bf2a5e, useUpdatableTree as $b79bf29960412ca7$export$911bb4b9c8065d3d} from "./feedback-components.
|
|
1
|
+
import "./feedback-components.d591ffec.css";
|
|
2
|
+
import $bvJLP$feedbackcomponents00434ff7js from "./feedback-components.00434ff7.js";
|
|
3
|
+
import $b6b9741bf83336eb$export$2e2bcd8739ae039 from "./feedback-components.d55a1d18.js";
|
|
4
|
+
import {FeedbackText as $156a3efbc315814c$export$6e107db9091b8219} from "./feedback-components.1c15f37f.js";
|
|
5
|
+
import {ModelInfo as $03d8811e9c9b360d$export$4eb2a0ce903ce967} from "./feedback-components.707e3490.js";
|
|
6
|
+
import {TreeDispatchContext as $b79bf29960412ca7$export$e5ce04c5b3f58533, treeToGraph as $b79bf29960412ca7$export$8d9dbb7a64bf2a5e, useUpdatableTree as $b79bf29960412ca7$export$911bb4b9c8065d3d} from "./feedback-components.f6605b83.js";
|
|
7
7
|
import {OmniboxSelector as $fda9ef5406c1cfb4$export$d8660660a589068c} from "./feedback-components.ad9f284e.js";
|
|
8
|
-
import {GraphView as $ff8c3e7f2bc22925$export$6a7fe3ef90e8d566} from "./feedback-components.
|
|
8
|
+
import {GraphView as $ff8c3e7f2bc22925$export$6a7fe3ef90e8d566} from "./feedback-components.28ba71be.js";
|
|
9
|
+
import {Matches as $a878a21b0c10bfdc$export$6479cfcac2b87c0} from "./feedback-components.fd8ac9ca.js";
|
|
10
|
+
import {TypeList as $18030469a9425911$export$9ebd91d75ddb6a8b} from "./feedback-components.7e879290.js";
|
|
9
11
|
import $bvJLP$macrostrathyper from "@macrostrat/hyper";
|
|
10
12
|
import {Tree as $bvJLP$Tree} from "react-arborist";
|
|
11
13
|
import {useState as $bvJLP$useState, useRef as $bvJLP$useRef, useCallback as $bvJLP$useCallback, useEffect as $bvJLP$useEffect} from "react";
|
|
12
|
-
import {SegmentedControl as $bvJLP$SegmentedControl, Card as $bvJLP$Card, ButtonGroup as $bvJLP$ButtonGroup, Divider as $bvJLP$Divider
|
|
13
|
-
import {ErrorBoundary as $bvJLP$ErrorBoundary, FlexRow as $bvJLP$FlexRow, CancelButton as $bvJLP$CancelButton, SaveButton as $bvJLP$SaveButton
|
|
14
|
+
import {SegmentedControl as $bvJLP$SegmentedControl, Card as $bvJLP$Card, ButtonGroup as $bvJLP$ButtonGroup, Divider as $bvJLP$Divider} from "@blueprintjs/core";
|
|
15
|
+
import {ErrorBoundary as $bvJLP$ErrorBoundary, FlexRow as $bvJLP$FlexRow, CancelButton as $bvJLP$CancelButton, SaveButton as $bvJLP$SaveButton} from "@macrostrat/ui-components";
|
|
14
16
|
import $bvJLP$useelementdimensions from "use-element-dimensions";
|
|
15
|
-
import {ColorPicker as $bvJLP$ColorPicker} from "@macrostrat/data-sheet";
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
function $parcel$interopDefault(a) {
|
|
@@ -32,7 +33,8 @@ function $parcel$interopDefault(a) {
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
|
|
37
|
+
const $71d20dff35996763$var$h = (0, $bvJLP$macrostrathyper).styled((0, ($parcel$interopDefault($bvJLP$feedbackcomponents00434ff7js))));
|
|
36
38
|
function $71d20dff35996763$var$setsAreTheSame(a, b) {
|
|
37
39
|
if (a.size !== b.size) return false;
|
|
38
40
|
for (const item of a){
|
|
@@ -40,9 +42,10 @@ function $71d20dff35996763$var$setsAreTheSame(a, b) {
|
|
|
40
42
|
}
|
|
41
43
|
return true;
|
|
42
44
|
}
|
|
43
|
-
function $71d20dff35996763$export$a90600c9da52b40c({ entities: entities = [], text: text, model: model, entityTypes: entityTypes, matchComponent: matchComponent, onSave: onSave, allowOverlap: allowOverlap }) {
|
|
45
|
+
function $71d20dff35996763$export$a90600c9da52b40c({ entities: entities = [], text: text, model: model, entityTypes: entityTypes, matchComponent: matchComponent, onSave: onSave, allowOverlap: allowOverlap, matchLinks: matchLinks }) {
|
|
44
46
|
// Get the input arguments
|
|
45
47
|
const [state, dispatch] = (0, $b79bf29960412ca7$export$911bb4b9c8065d3d)(entities.map($71d20dff35996763$var$processEntity), entityTypes);
|
|
48
|
+
const [match, setMatchLinks] = (0, $bvJLP$useState)(matchLinks || {});
|
|
46
49
|
const { selectedNodes: selectedNodes, tree: tree, selectedEntityType: selectedEntityType, isSelectingEntityType: isSelectingEntityType, entityTypesMap: entityTypesMap } = state;
|
|
47
50
|
const [{ width: width, height: height }, ref] = (0, $bvJLP$useelementdimensions)();
|
|
48
51
|
return $71d20dff35996763$var$h("div.page-wrapper", [
|
|
@@ -57,7 +60,8 @@ function $71d20dff35996763$export$a90600c9da52b40c({ entities: entities = [], te
|
|
|
57
60
|
// @ts-ignore
|
|
58
61
|
nodes: tree,
|
|
59
62
|
selectedNodes: selectedNodes,
|
|
60
|
-
allowOverlap: allowOverlap
|
|
63
|
+
allowOverlap: allowOverlap,
|
|
64
|
+
matchLinks: match
|
|
61
65
|
})),
|
|
62
66
|
$71d20dff35996763$var$h((0, $bvJLP$FlexRow), {
|
|
63
67
|
alignItems: "baseline",
|
|
@@ -134,6 +138,14 @@ function $71d20dff35996763$export$a90600c9da52b40c({ entities: entities = [], te
|
|
|
134
138
|
disabled: state.initialTree == state.tree
|
|
135
139
|
}, "Save")
|
|
136
140
|
]),
|
|
141
|
+
$71d20dff35996763$var$h((0, $a878a21b0c10bfdc$export$6479cfcac2b87c0), {
|
|
142
|
+
match: match,
|
|
143
|
+
setMatchLinks: setMatchLinks,
|
|
144
|
+
matchLinks: matchLinks,
|
|
145
|
+
selectedNodes: selectedNodes,
|
|
146
|
+
tree: tree,
|
|
147
|
+
dispatch: dispatch
|
|
148
|
+
}),
|
|
137
149
|
$71d20dff35996763$var$h((0, $bvJLP$Divider)),
|
|
138
150
|
$71d20dff35996763$var$h($71d20dff35996763$var$EntityTypeSelector, {
|
|
139
151
|
entityTypes: entityTypesMap,
|
|
@@ -176,7 +188,7 @@ function $71d20dff35996763$var$EntityTypeSelector({ entityTypes: entityTypes, se
|
|
|
176
188
|
const types = Array.from(entityTypes.values());
|
|
177
189
|
const items = inputValue !== "" ? types.filter((d)=>d.name.toLowerCase().includes(inputValue.toLowerCase())) : types;
|
|
178
190
|
return $71d20dff35996763$var$h("div.entity-type-selector", [
|
|
179
|
-
$71d20dff35996763$var$h($
|
|
191
|
+
$71d20dff35996763$var$h((0, $18030469a9425911$export$9ebd91d75ddb6a8b), {
|
|
180
192
|
types: entityTypes,
|
|
181
193
|
selected: _selected,
|
|
182
194
|
dispatch: dispatch,
|
|
@@ -311,268 +323,7 @@ function $71d20dff35996763$var$ManagedSelectionTree(props) {
|
|
|
311
323
|
}
|
|
312
324
|
}));
|
|
313
325
|
}
|
|
314
|
-
function $71d20dff35996763$var$TypeList({ types: types, selected: selected, dispatch: dispatch, selectedNodes: selectedNodes, tree: tree }) {
|
|
315
|
-
const [selectedType, setSelectedType] = (0, $bvJLP$useState)(null);
|
|
316
|
-
const isSelectedNodes = selectedNodes.length > 0;
|
|
317
|
-
const darkMode = (0, $bvJLP$useInDarkMode)();
|
|
318
|
-
const luminance = darkMode ? 0.9 : 0.4;
|
|
319
|
-
return $71d20dff35996763$var$h("div.type-list-container", [
|
|
320
|
-
$71d20dff35996763$var$h("div.type-list-header", isSelectedNodes && !selectedType ? "Change selected nodes to:" : "Entity Types"),
|
|
321
|
-
$71d20dff35996763$var$h("div.type-list", Array.from(types.values()).map((type)=>$71d20dff35996763$var$h($71d20dff35996763$var$TypeTag, {
|
|
322
|
-
type: type,
|
|
323
|
-
luminance: luminance,
|
|
324
|
-
selectedType: selectedType,
|
|
325
|
-
setSelectedType: setSelectedType,
|
|
326
|
-
dispatch: dispatch,
|
|
327
|
-
tree: tree,
|
|
328
|
-
selectedNodes: selectedNodes,
|
|
329
|
-
selected: selected,
|
|
330
|
-
isSelectedNodes: isSelectedNodes
|
|
331
|
-
}))),
|
|
332
|
-
$71d20dff35996763$var$h($71d20dff35996763$var$AddType, {
|
|
333
|
-
dispatch: dispatch
|
|
334
|
-
})
|
|
335
|
-
]);
|
|
336
|
-
}
|
|
337
|
-
function $71d20dff35996763$var$collectMatchingIds(tree, id) {
|
|
338
|
-
const ids = [];
|
|
339
|
-
function traverse(node) {
|
|
340
|
-
if (node.type.id === id) ids.push(node.id);
|
|
341
|
-
if (Array.isArray(node.children)) node.children.forEach(traverse);
|
|
342
|
-
}
|
|
343
|
-
tree.forEach(traverse);
|
|
344
|
-
return ids;
|
|
345
|
-
}
|
|
346
|
-
function $71d20dff35996763$var$AddType({ dispatch: dispatch }) {
|
|
347
|
-
const [overlayOpen, setOverlayOpen] = (0, $bvJLP$useState)(false);
|
|
348
|
-
const saveHandler = (payload)=>{
|
|
349
|
-
dispatch({
|
|
350
|
-
type: "add-entity-type",
|
|
351
|
-
payload: payload
|
|
352
|
-
});
|
|
353
|
-
setOverlayOpen(false);
|
|
354
|
-
};
|
|
355
|
-
return $71d20dff35996763$var$h("div.add-type-container", [
|
|
356
|
-
$71d20dff35996763$var$h("div.add-type", {
|
|
357
|
-
onClick: ()=>setOverlayOpen(true)
|
|
358
|
-
}, [
|
|
359
|
-
$71d20dff35996763$var$h("p.add-type-text", "Add new type"),
|
|
360
|
-
$71d20dff35996763$var$h((0, $bvJLP$Icon), {
|
|
361
|
-
icon: "plus"
|
|
362
|
-
})
|
|
363
|
-
]),
|
|
364
|
-
$71d20dff35996763$var$h($71d20dff35996763$var$TypeOverlay, {
|
|
365
|
-
setOverlayOpen: setOverlayOpen,
|
|
366
|
-
overlayOpen: overlayOpen,
|
|
367
|
-
title: "Add New Type",
|
|
368
|
-
saveHandler: saveHandler
|
|
369
|
-
})
|
|
370
|
-
]);
|
|
371
|
-
}
|
|
372
|
-
function $71d20dff35996763$var$EditType({ dispatch: dispatch, type: type }) {
|
|
373
|
-
const [editorOpen, setEditorOpen] = (0, $bvJLP$useState)(false);
|
|
374
|
-
const saveHandler = (payload)=>{
|
|
375
|
-
dispatch({
|
|
376
|
-
type: "update-entity-type",
|
|
377
|
-
payload: payload
|
|
378
|
-
});
|
|
379
|
-
setEditorOpen(false);
|
|
380
|
-
};
|
|
381
|
-
return $71d20dff35996763$var$h("div.edit-type", [
|
|
382
|
-
$71d20dff35996763$var$h((0, $bvJLP$Icon), {
|
|
383
|
-
icon: "edit",
|
|
384
|
-
className: "edit-icon",
|
|
385
|
-
onClick: (e)=>{
|
|
386
|
-
e.stopPropagation();
|
|
387
|
-
setEditorOpen(true);
|
|
388
|
-
}
|
|
389
|
-
}),
|
|
390
|
-
$71d20dff35996763$var$h($71d20dff35996763$var$TypeOverlay, {
|
|
391
|
-
setOverlayOpen: setEditorOpen,
|
|
392
|
-
overlayOpen: editorOpen,
|
|
393
|
-
originalType: type,
|
|
394
|
-
title: "Edit Type",
|
|
395
|
-
saveHandler: saveHandler
|
|
396
|
-
})
|
|
397
|
-
]);
|
|
398
|
-
}
|
|
399
|
-
function $71d20dff35996763$var$TypeOverlay({ setOverlayOpen: setOverlayOpen, overlayOpen: overlayOpen, originalType: originalType, title: title, saveHandler: saveHandler }) {
|
|
400
|
-
const { name: name, description: description, color: color, id: id } = originalType || {};
|
|
401
|
-
const [nameInput, setNameInput] = (0, $bvJLP$useState)(name || "");
|
|
402
|
-
const [descriptionInput, setDescriptionInput] = (0, $bvJLP$useState)(description || "");
|
|
403
|
-
const [colorInput, setColorInput] = (0, $bvJLP$useState)(color || "#fff");
|
|
404
|
-
return $71d20dff35996763$var$h((0, $bvJLP$Overlay2), {
|
|
405
|
-
isOpen: overlayOpen
|
|
406
|
-
}, $71d20dff35996763$var$h("div.overlay-container", $71d20dff35996763$var$h("div.add-type-overlay", [
|
|
407
|
-
$71d20dff35996763$var$h("h2.title", [
|
|
408
|
-
title,
|
|
409
|
-
$71d20dff35996763$var$h((0, $bvJLP$Icon), {
|
|
410
|
-
icon: "cross",
|
|
411
|
-
className: "close-icon",
|
|
412
|
-
onClick: ()=>{
|
|
413
|
-
setOverlayOpen(false);
|
|
414
|
-
},
|
|
415
|
-
style: {
|
|
416
|
-
cursor: "pointer",
|
|
417
|
-
color: "red"
|
|
418
|
-
}
|
|
419
|
-
})
|
|
420
|
-
]),
|
|
421
|
-
$71d20dff35996763$var$h("div.form-group", [
|
|
422
|
-
$71d20dff35996763$var$h("div.text-inputs", [
|
|
423
|
-
$71d20dff35996763$var$h("div.form-field.name", [
|
|
424
|
-
$71d20dff35996763$var$h("p.label", "Name"),
|
|
425
|
-
$71d20dff35996763$var$h("input", {
|
|
426
|
-
type: "text",
|
|
427
|
-
placeholder: "Enter type name",
|
|
428
|
-
onChange: (e)=>setNameInput(e.target.value),
|
|
429
|
-
value: nameInput
|
|
430
|
-
})
|
|
431
|
-
]),
|
|
432
|
-
$71d20dff35996763$var$h("div.form-field.form-description", [
|
|
433
|
-
$71d20dff35996763$var$h("p.label", "Description"),
|
|
434
|
-
$71d20dff35996763$var$h("input", {
|
|
435
|
-
type: "text",
|
|
436
|
-
placeholder: "Enter type description",
|
|
437
|
-
onChange: (e)=>setDescriptionInput(e.target.value),
|
|
438
|
-
value: descriptionInput
|
|
439
|
-
})
|
|
440
|
-
])
|
|
441
|
-
]),
|
|
442
|
-
$71d20dff35996763$var$h("div.form-field.color", [
|
|
443
|
-
$71d20dff35996763$var$h("p.label", "Color"),
|
|
444
|
-
$71d20dff35996763$var$h((0, $bvJLP$ColorPicker), {
|
|
445
|
-
value: colorInput,
|
|
446
|
-
onChange: (color)=>setColorInput(color),
|
|
447
|
-
style: {
|
|
448
|
-
width: "100%"
|
|
449
|
-
}
|
|
450
|
-
})
|
|
451
|
-
])
|
|
452
|
-
]),
|
|
453
|
-
$71d20dff35996763$var$h((0, $bvJLP$SaveButton), {
|
|
454
|
-
className: "save-btn",
|
|
455
|
-
small: true,
|
|
456
|
-
onClick: ()=>saveHandler({
|
|
457
|
-
name: nameInput,
|
|
458
|
-
description: descriptionInput,
|
|
459
|
-
color: colorInput,
|
|
460
|
-
id: id
|
|
461
|
-
})
|
|
462
|
-
}, "Save changes")
|
|
463
|
-
])));
|
|
464
|
-
}
|
|
465
|
-
function $71d20dff35996763$var$TypeTag({ type: type, luminance: luminance, selectedType: selectedType, setSelectedType: setSelectedType, dispatch: dispatch, tree: tree, selectedNodes: selectedNodes, selected: selected, isSelectedNodes: isSelectedNodes }) {
|
|
466
|
-
const { color: color, name: name, id: id, description: description } = type;
|
|
467
|
-
const darkMode = (0, $bvJLP$useInDarkMode)();
|
|
468
|
-
const isSelected = id === selected?.id && selectedNodes.length > 0;
|
|
469
|
-
const style = (0, $03d8811e9c9b360d$export$35baa338324d8550)(color, {
|
|
470
|
-
active: isSelected,
|
|
471
|
-
highlighted: selectedNodes.length === 0
|
|
472
|
-
});
|
|
473
|
-
const payload = {
|
|
474
|
-
id: id,
|
|
475
|
-
name: name,
|
|
476
|
-
color: color,
|
|
477
|
-
description: description
|
|
478
|
-
};
|
|
479
|
-
const ids = $71d20dff35996763$var$collectMatchingIds(tree, id);
|
|
480
|
-
const handleTagClick = ()=>{
|
|
481
|
-
if (!isSelectedNodes && selectedType === null) {
|
|
482
|
-
if (ids.length > 0) {
|
|
483
|
-
setSelectedType(type);
|
|
484
|
-
dispatch({
|
|
485
|
-
type: "toggle-node-selected",
|
|
486
|
-
payload: {
|
|
487
|
-
ids: ids
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
} else if (isSelectedNodes && selectedType === null) {
|
|
492
|
-
if (id === selected?.id && selectedNodes.length > 0) dispatch({
|
|
493
|
-
type: "toggle-node-selected",
|
|
494
|
-
payload: {
|
|
495
|
-
ids: selectedNodes
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
else dispatch({
|
|
499
|
-
type: "select-entity-type",
|
|
500
|
-
payload: payload
|
|
501
|
-
});
|
|
502
|
-
} else if (isSelectedNodes && selectedType.id === id) {
|
|
503
|
-
setSelectedType(null);
|
|
504
|
-
dispatch({
|
|
505
|
-
type: "toggle-node-selected",
|
|
506
|
-
payload: {
|
|
507
|
-
ids: ids
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
} else if (isSelectedNodes && selectedType.id !== id) {
|
|
511
|
-
if (ids.length > 0) {
|
|
512
|
-
setSelectedType(type);
|
|
513
|
-
const oldIds = $71d20dff35996763$var$collectMatchingIds(tree, selectedType.id);
|
|
514
|
-
dispatch({
|
|
515
|
-
type: "toggle-node-selected",
|
|
516
|
-
payload: {
|
|
517
|
-
ids: oldIds
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
dispatch({
|
|
521
|
-
type: "toggle-node-selected",
|
|
522
|
-
payload: {
|
|
523
|
-
ids: ids
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
} else console.warn("Unexpected state in TypeTag click handler", {
|
|
528
|
-
isSelectedNodes: isSelectedNodes,
|
|
529
|
-
selectedType: selectedType,
|
|
530
|
-
selectedNodes: selectedNodes,
|
|
531
|
-
ids: ids,
|
|
532
|
-
id: id,
|
|
533
|
-
selected: selected
|
|
534
|
-
});
|
|
535
|
-
};
|
|
536
|
-
return $71d20dff35996763$var$h((0, $bvJLP$Popover), {
|
|
537
|
-
autoFocus: false,
|
|
538
|
-
content: $71d20dff35996763$var$h("div.description", description || "No description available"),
|
|
539
|
-
interactionKind: "hover"
|
|
540
|
-
}, $71d20dff35996763$var$h("div.type-tag", {
|
|
541
|
-
onClick: handleTagClick,
|
|
542
|
-
style: {
|
|
543
|
-
cursor: ids.length > 0 || isSelectedNodes && !selectedType ? "pointer" : "",
|
|
544
|
-
color: "black",
|
|
545
|
-
backgroundColor: style.backgroundColor,
|
|
546
|
-
border: isSelected ? `1px solid var(--text-emphasized-color)` : `1px solid var(--background-color)`
|
|
547
|
-
}
|
|
548
|
-
}, $71d20dff35996763$var$h("div.type-container", [
|
|
549
|
-
$71d20dff35996763$var$h("div.type-name", name),
|
|
550
|
-
$71d20dff35996763$var$h("div.icons", [
|
|
551
|
-
$71d20dff35996763$var$h($71d20dff35996763$var$EditType, {
|
|
552
|
-
dispatch: dispatch,
|
|
553
|
-
type: type
|
|
554
|
-
}),
|
|
555
|
-
$71d20dff35996763$var$h((0, $bvJLP$Icon), {
|
|
556
|
-
icon: "cross",
|
|
557
|
-
className: "delete-type-icon",
|
|
558
|
-
style: {
|
|
559
|
-
color: "red",
|
|
560
|
-
cursor: "pointer"
|
|
561
|
-
},
|
|
562
|
-
onClick: (e)=>{
|
|
563
|
-
e.stopPropagation();
|
|
564
|
-
dispatch({
|
|
565
|
-
type: "delete-entity-type",
|
|
566
|
-
payload: {
|
|
567
|
-
id: id
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
})
|
|
572
|
-
])
|
|
573
|
-
])));
|
|
574
|
-
}
|
|
575
326
|
|
|
576
327
|
|
|
577
328
|
export {$71d20dff35996763$export$a90600c9da52b40c as FeedbackComponent, $b79bf29960412ca7$export$8d9dbb7a64bf2a5e as treeToGraph};
|
|
578
|
-
//# sourceMappingURL=feedback-components.
|
|
329
|
+
//# sourceMappingURL=feedback-components.204f7d2b.js.map
|