@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
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
All notable changes to this project will be documented in this file. The format
|
|
4
|
+
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
|
|
5
|
+
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.1.0] - 2025-06-25
|
|
8
|
+
|
|
9
|
+
Major updates by David Sklar to improve usability
|
|
10
|
+
|
|
11
|
+
## [1.0.1] - 2025-02-15
|
|
12
|
+
|
|
13
|
+
Added a `node` target to bundle without imported CSS.
|
|
6
14
|
|
|
7
15
|
## [1.0.0] - 2025-02-14
|
|
8
16
|
|
|
9
|
-
First public release of the `@macrostrat/feedback-components` library,
|
|
10
|
-
|
|
17
|
+
First public release of the `@macrostrat/feedback-components` library, focused
|
|
18
|
+
on text feedback for Macrostrat unit information.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
var $49c87ee97f392268$exports = {};
|
|
6
|
+
|
|
7
|
+
$parcel$export($49c87ee97f392268$exports, "add-type", () => $49c87ee97f392268$export$cb889aaddfa2926c, (v) => $49c87ee97f392268$export$cb889aaddfa2926c = v);
|
|
8
|
+
$parcel$export($49c87ee97f392268$exports, "add-type-overlay", () => $49c87ee97f392268$export$5f8f750fd71deeed, (v) => $49c87ee97f392268$export$5f8f750fd71deeed = v);
|
|
9
|
+
$parcel$export($49c87ee97f392268$exports, "control-panel", () => $49c87ee97f392268$export$a0a23f31d5562853, (v) => $49c87ee97f392268$export$a0a23f31d5562853 = v);
|
|
10
|
+
$parcel$export($49c87ee97f392268$exports, "description", () => $49c87ee97f392268$export$6d59db4903f20f7d, (v) => $49c87ee97f392268$export$6d59db4903f20f7d = v);
|
|
11
|
+
$parcel$export($49c87ee97f392268$exports, "entity-panel", () => $49c87ee97f392268$export$38f2cd12e45697e, (v) => $49c87ee97f392268$export$38f2cd12e45697e = v);
|
|
12
|
+
$parcel$export($49c87ee97f392268$exports, "feedback-component", () => $49c87ee97f392268$export$579bd45c78bf5510, (v) => $49c87ee97f392268$export$579bd45c78bf5510 = v);
|
|
13
|
+
$parcel$export($49c87ee97f392268$exports, "feedback-text", () => $49c87ee97f392268$export$890489be1870bed5, (v) => $49c87ee97f392268$export$890489be1870bed5 = v);
|
|
14
|
+
$parcel$export($49c87ee97f392268$exports, "feedback-text-wrapper", () => $49c87ee97f392268$export$6bd0fd0a746c88f, (v) => $49c87ee97f392268$export$6bd0fd0a746c88f = v);
|
|
15
|
+
$parcel$export($49c87ee97f392268$exports, "form-group", () => $49c87ee97f392268$export$55a1f87a143fb302, (v) => $49c87ee97f392268$export$55a1f87a143fb302 = v);
|
|
16
|
+
$parcel$export($49c87ee97f392268$exports, "highlight", () => $49c87ee97f392268$export$e4043f67d36cbb26, (v) => $49c87ee97f392268$export$e4043f67d36cbb26 = v);
|
|
17
|
+
$parcel$export($49c87ee97f392268$exports, "icons", () => $49c87ee97f392268$export$df03f54e09e486fa, (v) => $49c87ee97f392268$export$df03f54e09e486fa = v);
|
|
18
|
+
$parcel$export($49c87ee97f392268$exports, "node", () => $49c87ee97f392268$export$35059013cd4a06db, (v) => $49c87ee97f392268$export$35059013cd4a06db = v);
|
|
19
|
+
$parcel$export($49c87ee97f392268$exports, "overlay-container", () => $49c87ee97f392268$export$6a1093e41947f68e, (v) => $49c87ee97f392268$export$6a1093e41947f68e = v);
|
|
20
|
+
$parcel$export($49c87ee97f392268$exports, "selected", () => $49c87ee97f392268$export$d90250155de6d7e7, (v) => $49c87ee97f392268$export$d90250155de6d7e7 = v);
|
|
21
|
+
$parcel$export($49c87ee97f392268$exports, "selection-tree", () => $49c87ee97f392268$export$3ae1b51693c80a9c, (v) => $49c87ee97f392268$export$3ae1b51693c80a9c = v);
|
|
22
|
+
$parcel$export($49c87ee97f392268$exports, "text-inputs", () => $49c87ee97f392268$export$bc7581b048bdc9d, (v) => $49c87ee97f392268$export$bc7581b048bdc9d = v);
|
|
23
|
+
$parcel$export($49c87ee97f392268$exports, "title", () => $49c87ee97f392268$export$fb184b623420d9be, (v) => $49c87ee97f392268$export$fb184b623420d9be = v);
|
|
24
|
+
$parcel$export($49c87ee97f392268$exports, "type-container", () => $49c87ee97f392268$export$b2d17fca990bb66c, (v) => $49c87ee97f392268$export$b2d17fca990bb66c = v);
|
|
25
|
+
$parcel$export($49c87ee97f392268$exports, "type-list", () => $49c87ee97f392268$export$915fe2ca68846e4c, (v) => $49c87ee97f392268$export$915fe2ca68846e4c = v);
|
|
26
|
+
$parcel$export($49c87ee97f392268$exports, "type-tag", () => $49c87ee97f392268$export$5e5acbc770fb0e4, (v) => $49c87ee97f392268$export$5e5acbc770fb0e4 = v);
|
|
27
|
+
var $49c87ee97f392268$export$cb889aaddfa2926c;
|
|
28
|
+
var $49c87ee97f392268$export$5f8f750fd71deeed;
|
|
29
|
+
var $49c87ee97f392268$export$a0a23f31d5562853;
|
|
30
|
+
var $49c87ee97f392268$export$6d59db4903f20f7d;
|
|
31
|
+
var $49c87ee97f392268$export$38f2cd12e45697e;
|
|
32
|
+
var $49c87ee97f392268$export$579bd45c78bf5510;
|
|
33
|
+
var $49c87ee97f392268$export$890489be1870bed5;
|
|
34
|
+
var $49c87ee97f392268$export$6bd0fd0a746c88f;
|
|
35
|
+
var $49c87ee97f392268$export$55a1f87a143fb302;
|
|
36
|
+
var $49c87ee97f392268$export$e4043f67d36cbb26;
|
|
37
|
+
var $49c87ee97f392268$export$df03f54e09e486fa;
|
|
38
|
+
var $49c87ee97f392268$export$35059013cd4a06db;
|
|
39
|
+
var $49c87ee97f392268$export$6a1093e41947f68e;
|
|
40
|
+
var $49c87ee97f392268$export$d90250155de6d7e7;
|
|
41
|
+
var $49c87ee97f392268$export$3ae1b51693c80a9c;
|
|
42
|
+
var $49c87ee97f392268$export$bc7581b048bdc9d;
|
|
43
|
+
var $49c87ee97f392268$export$fb184b623420d9be;
|
|
44
|
+
var $49c87ee97f392268$export$b2d17fca990bb66c;
|
|
45
|
+
var $49c87ee97f392268$export$915fe2ca68846e4c;
|
|
46
|
+
var $49c87ee97f392268$export$5e5acbc770fb0e4;
|
|
47
|
+
$49c87ee97f392268$export$cb889aaddfa2926c = `QoX8-W_add-type`;
|
|
48
|
+
$49c87ee97f392268$export$5f8f750fd71deeed = `QoX8-W_add-type-overlay`;
|
|
49
|
+
$49c87ee97f392268$export$a0a23f31d5562853 = `QoX8-W_control-panel`;
|
|
50
|
+
$49c87ee97f392268$export$6d59db4903f20f7d = `QoX8-W_description`;
|
|
51
|
+
$49c87ee97f392268$export$38f2cd12e45697e = `QoX8-W_entity-panel`;
|
|
52
|
+
$49c87ee97f392268$export$579bd45c78bf5510 = `QoX8-W_feedback-component`;
|
|
53
|
+
$49c87ee97f392268$export$890489be1870bed5 = `QoX8-W_feedback-text`;
|
|
54
|
+
$49c87ee97f392268$export$6bd0fd0a746c88f = `QoX8-W_feedback-text-wrapper`;
|
|
55
|
+
$49c87ee97f392268$export$55a1f87a143fb302 = `QoX8-W_form-group`;
|
|
56
|
+
$49c87ee97f392268$export$e4043f67d36cbb26 = `QoX8-W_highlight`;
|
|
57
|
+
$49c87ee97f392268$export$df03f54e09e486fa = `QoX8-W_icons`;
|
|
58
|
+
$49c87ee97f392268$export$35059013cd4a06db = `QoX8-W_node`;
|
|
59
|
+
$49c87ee97f392268$export$6a1093e41947f68e = `QoX8-W_overlay-container`;
|
|
60
|
+
$49c87ee97f392268$export$d90250155de6d7e7 = `QoX8-W_selected`;
|
|
61
|
+
$49c87ee97f392268$export$3ae1b51693c80a9c = `QoX8-W_selection-tree`;
|
|
62
|
+
$49c87ee97f392268$export$bc7581b048bdc9d = `QoX8-W_text-inputs`;
|
|
63
|
+
$49c87ee97f392268$export$fb184b623420d9be = `QoX8-W_title`;
|
|
64
|
+
$49c87ee97f392268$export$b2d17fca990bb66c = `QoX8-W_type-container`;
|
|
65
|
+
$49c87ee97f392268$export$915fe2ca68846e4c = `QoX8-W_type-list`;
|
|
66
|
+
$49c87ee97f392268$export$5e5acbc770fb0e4 = `QoX8-W_type-tag`;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
export {$49c87ee97f392268$exports as default};
|
|
70
|
+
//# sourceMappingURL=feedback-components.4359bc80.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;AAnBA,4CAA6B,CAAC,eAAe,CAAC;AAC9C,4CAAqC,CAAC,uBAAuB,CAAC;AAC9D,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,2CAAiC,CAAC,mBAAmB,CAAC;AACtD,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,4CAAyB,CAAC,WAAW,CAAC;AACtC,4CAAsC,CAAC,wBAAwB,CAAC;AAChE,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":[".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.4359bc80.js.map"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import $
|
|
3
|
-
import $
|
|
4
|
-
import {Tag as $
|
|
5
|
-
import {asChromaColor as $
|
|
6
|
-
import $
|
|
1
|
+
import "./feedback-components.e273ed5b.css";
|
|
2
|
+
import $9y0hV$feedbackcomponents6d32ee91js from "./feedback-components.6d32ee91.js";
|
|
3
|
+
import $9y0hV$classnames from "classnames";
|
|
4
|
+
import {Tag as $9y0hV$Tag} from "@blueprintjs/core";
|
|
5
|
+
import {asChromaColor as $9y0hV$asChromaColor} from "@macrostrat/color-utils";
|
|
6
|
+
import $9y0hV$macrostrathyper from "@macrostrat/hyper";
|
|
7
|
+
import {useDarkMode as $9y0hV$useDarkMode} from "@macrostrat/ui-components";
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
function $parcel$interopDefault(a) {
|
|
@@ -14,7 +15,8 @@ function $parcel$interopDefault(a) {
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
const $03d8811e9c9b360d$var$h = (0, $9y0hV$macrostrathyper).styled((0, ($parcel$interopDefault($9y0hV$feedbackcomponents6d32ee91js))));
|
|
18
20
|
function $03d8811e9c9b360d$export$c4b91360064ad200(entities, parent) {
|
|
19
21
|
let highlights = [];
|
|
20
22
|
let parents = [];
|
|
@@ -27,8 +29,8 @@ function $03d8811e9c9b360d$export$c4b91360064ad200(entities, parent) {
|
|
|
27
29
|
start: entity.indices[0],
|
|
28
30
|
end: entity.indices[1],
|
|
29
31
|
text: entity.name,
|
|
30
|
-
backgroundColor: entity.type
|
|
31
|
-
tag: entity.type
|
|
32
|
+
backgroundColor: entity.type?.color,
|
|
33
|
+
tag: entity.type?.name ?? "lith",
|
|
32
34
|
id: entity.id,
|
|
33
35
|
parents: parents
|
|
34
36
|
});
|
|
@@ -44,25 +46,32 @@ function $03d8811e9c9b360d$export$d60b563f571177d(extractionData, models, entity
|
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
48
|
function $03d8811e9c9b360d$export$35baa338324d8550(baseColor, options) {
|
|
47
|
-
const _baseColor = (0, $
|
|
48
|
-
const { highlighted: highlighted = true, inDarkMode: inDarkMode =
|
|
49
|
+
const _baseColor = (0, $9y0hV$asChromaColor)(baseColor ?? "#fff");
|
|
50
|
+
const { highlighted: highlighted = true, inDarkMode: inDarkMode = (0, $9y0hV$useDarkMode)().isEnabled, active: active = false } = options;
|
|
49
51
|
let mixAmount = highlighted ? 0.8 : 0.5;
|
|
50
52
|
let backgroundAlpha = highlighted ? 0.8 : 0.2;
|
|
51
53
|
if (active) {
|
|
52
54
|
mixAmount = 1;
|
|
53
55
|
backgroundAlpha = 1;
|
|
54
56
|
}
|
|
55
|
-
const mixTarget =
|
|
56
|
-
const color = _baseColor.mix(mixTarget, mixAmount).
|
|
57
|
-
const borderColor = highlighted ? _baseColor.mix(mixTarget, mixAmount /
|
|
57
|
+
const mixTarget = "black";
|
|
58
|
+
const color = active ? "#000" : _baseColor.mix(mixTarget, mixAmount).hex();
|
|
59
|
+
const borderColor = highlighted ? _baseColor.mix(mixTarget, mixAmount / 1.1).hex() : "transparent";
|
|
60
|
+
let backgroundColor = active ? _baseColor.alpha(backgroundAlpha).hex() : $03d8811e9c9b360d$var$normalizeColor(_baseColor.alpha(backgroundAlpha).hex());
|
|
61
|
+
// handle white backgrounds in light mode
|
|
62
|
+
if (!inDarkMode && backgroundColor === "#ffffff") {
|
|
63
|
+
console.log("Adjusting background color for light mode:", backgroundColor);
|
|
64
|
+
backgroundColor = "#f0f0f0";
|
|
65
|
+
}
|
|
58
66
|
return {
|
|
59
67
|
color: color,
|
|
60
|
-
backgroundColor:
|
|
68
|
+
backgroundColor: backgroundColor,
|
|
61
69
|
boxSizing: "border-box",
|
|
62
70
|
borderStyle: "solid",
|
|
63
71
|
borderColor: borderColor,
|
|
64
|
-
borderWidth: "
|
|
65
|
-
fontWeight: active ? "bold" : "normal"
|
|
72
|
+
borderWidth: "1.5px",
|
|
73
|
+
fontWeight: active ? "bold" : "normal",
|
|
74
|
+
fontSize: "0.9em"
|
|
66
75
|
};
|
|
67
76
|
}
|
|
68
77
|
function $03d8811e9c9b360d$var$enhanceEntity(entity, entityTypes) {
|
|
@@ -73,7 +82,7 @@ function $03d8811e9c9b360d$var$enhanceEntity(entity, entityTypes) {
|
|
|
73
82
|
};
|
|
74
83
|
}
|
|
75
84
|
function $03d8811e9c9b360d$var$addColor(entityType, match = false) {
|
|
76
|
-
const color = (0, $
|
|
85
|
+
const color = (0, $9y0hV$asChromaColor)(entityType.color ?? "#fff").brighten(match ? 1 : 2);
|
|
77
86
|
return {
|
|
78
87
|
...entityType,
|
|
79
88
|
color: color.css()
|
|
@@ -103,11 +112,11 @@ function $03d8811e9c9b360d$export$4eb2a0ce903ce967({ data: data }) {
|
|
|
103
112
|
}
|
|
104
113
|
function $03d8811e9c9b360d$export$117e56c71b172cde({ data: data, highlighted: highlighted = true, active: active = false, onClickType: onClickType, matchComponent: matchComponent = null }) {
|
|
105
114
|
const { name: name, type: type, match: match } = data;
|
|
106
|
-
const className = (0, $
|
|
115
|
+
const className = (0, $9y0hV$classnames)({
|
|
107
116
|
matched: match != null,
|
|
108
|
-
type: data.type
|
|
117
|
+
type: data.type?.name ?? "lith"
|
|
109
118
|
}, "entity");
|
|
110
|
-
const style = $03d8811e9c9b360d$export$35baa338324d8550(type
|
|
119
|
+
const style = $03d8811e9c9b360d$export$35baa338324d8550(type?.color, {
|
|
111
120
|
highlighted: highlighted,
|
|
112
121
|
active: active
|
|
113
122
|
});
|
|
@@ -115,7 +124,7 @@ function $03d8811e9c9b360d$export$117e56c71b172cde({ data: data, highlighted: hi
|
|
|
115
124
|
if (match != null && matchComponent != null) _matchLink = $03d8811e9c9b360d$var$h(matchComponent, {
|
|
116
125
|
data: match
|
|
117
126
|
});
|
|
118
|
-
return $03d8811e9c9b360d$var$h((0, $
|
|
127
|
+
return $03d8811e9c9b360d$var$h((0, $9y0hV$Tag), {
|
|
119
128
|
style: style,
|
|
120
129
|
className: className
|
|
121
130
|
}, [
|
|
@@ -129,7 +138,7 @@ function $03d8811e9c9b360d$export$117e56c71b172cde({ data: data, highlighted: hi
|
|
|
129
138
|
}
|
|
130
139
|
}
|
|
131
140
|
}, [
|
|
132
|
-
type
|
|
141
|
+
type?.name,
|
|
133
142
|
_matchLink
|
|
134
143
|
])
|
|
135
144
|
]);
|
|
@@ -171,7 +180,26 @@ function $03d8811e9c9b360d$var$HighlightedText(props) {
|
|
|
171
180
|
parts.push(text.slice(start));
|
|
172
181
|
return $03d8811e9c9b360d$var$h("span", parts);
|
|
173
182
|
}
|
|
183
|
+
function $03d8811e9c9b360d$var$normalizeColor(hex8) {
|
|
184
|
+
const background = (0, $9y0hV$useDarkMode)().isEnabled ? "#000000" : "#ffffff";
|
|
185
|
+
const r = parseInt(hex8.slice(1, 3), 16);
|
|
186
|
+
const g = parseInt(hex8.slice(3, 5), 16);
|
|
187
|
+
const b = parseInt(hex8.slice(5, 7), 16);
|
|
188
|
+
const a = parseInt(hex8.slice(7, 9), 16) / 255;
|
|
189
|
+
const bgR = parseInt(background.slice(1, 3), 16);
|
|
190
|
+
const bgG = parseInt(background.slice(3, 5), 16);
|
|
191
|
+
const bgB = parseInt(background.slice(5, 7), 16);
|
|
192
|
+
const blend = (fg, bg)=>Math.round((1 - a) * bg + a * fg);
|
|
193
|
+
const blendedR = blend(r, bgR);
|
|
194
|
+
const blendedG = blend(g, bgG);
|
|
195
|
+
const blendedB = blend(b, bgB);
|
|
196
|
+
return "#" + blendedR.toString(16).padStart(2, "0") + blendedG.toString(16).padStart(2, "0") + blendedB.toString(16).padStart(2, "0");
|
|
197
|
+
}
|
|
198
|
+
function $03d8811e9c9b360d$var$isHighlighted(id, selectedNodes, nodes) {
|
|
199
|
+
if (selectedNodes?.length === 0) return true;
|
|
200
|
+
return selectedNodes?.includes(id) || nodes?.some((node)=>selectedNodes?.includes(node.id) && node.children.some((child)=>child.id === id));
|
|
201
|
+
}
|
|
174
202
|
|
|
175
203
|
|
|
176
204
|
export {$03d8811e9c9b360d$export$c4b91360064ad200 as buildHighlights, $03d8811e9c9b360d$export$d60b563f571177d as enhanceData, $03d8811e9c9b360d$export$35baa338324d8550 as getTagStyle, $03d8811e9c9b360d$export$2b07158757c249e0 as ExtractionContext, $03d8811e9c9b360d$export$4eb2a0ce903ce967 as ModelInfo, $03d8811e9c9b360d$export$117e56c71b172cde as EntityTag};
|
|
177
|
-
//# sourceMappingURL=
|
|
205
|
+
//# sourceMappingURL=feedback-components.5df2a926.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAWA,MAAM,0BAAI,CAAA,GAAA,sBAAI,EAAE,MAAM,CAAC,CAAA,GAAA,8EAAK;AAErB,SAAS,0CACd,QAAqB,EACrB,MAAwB;IAExB,IAAI,a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AAG;AAEtC;AAEA,SAAS,oCAAc,EAAU,EAAE,aAAuB,EAAE,KAAY;IACtE,IAAI,eAAe,WAAW,GAAG,OAAO;IACxC,OACE,eAAe,SAAS,OACxB,OAAO,KACL,CAAC,OACC,eAAe,SAAS,KAAK,EAAE,KAC/B,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAU,MAAM,EAAE,KAAK;AAGnD","sources":["packages/feedback-components/src/extractions/index.ts"],"sourcesContent":["import styles from \"./main.module.sass\";\nimport classNames from \"classnames\";\nimport { Tag } from \"@blueprintjs/core\";\nimport type { Entity, EntityExt, Highlight, EntityType } from \"./types\";\nimport { CSSProperties } from \"react\";\nimport { asChromaColor } from \"@macrostrat/color-utils\";\nimport hyper from \"@macrostrat/hyper\";\nimport { useDarkMode } from \"@macrostrat/ui-components\";\n\nexport type { Entity, EntityExt };\n\nconst h = hyper.styled(styles);\n\nexport function buildHighlights(\n entities: EntityExt[],\n parent: EntityExt | null,\n): Highlight[] {\n let highlights = [];\n let parents = [];\n if (parent != null) {\n parents = [parent.id, ...(parent.parents ?? [])];\n }\n\n for (const entity of entities) {\n highlights.push({\n start: entity.indices[0],\n end: entity.indices[1],\n text: entity.name,\n backgroundColor: entity.type?.color,\n tag: entity.type?.name ?? \"lith\",\n id: entity.id,\n parents,\n });\n highlights.push(...buildHighlights(entity.children ?? [], entity));\n }\n return highlights;\n}\n\nexport function enhanceData(extractionData, models, entityTypes) {\n return {\n ...extractionData,\n model: models.get(extractionData.model_id),\n entities: extractionData.entities?.map((d) =>\n enhanceEntity(d, entityTypes),\n ),\n };\n}\n\nexport function getTagStyle(\n baseColor: string,\n options: { highlighted?: boolean; inDarkMode?: boolean; active?: boolean },\n): CSSProperties {\n const _baseColor = asChromaColor(baseColor ?? \"#fff\");\n const {\n highlighted = true,\n inDarkMode = useDarkMode().isEnabled,\n active = false,\n } = options;\n\n let mixAmount = highlighted ? 0.8 : 0.5;\n let backgroundAlpha = highlighted ? 0.8 : 0.2;\n\n if (active) {\n mixAmount = 1;\n backgroundAlpha = 1;\n }\n\n const mixTarget = \"black\";\n\n const color = active ? \"#000\" : _baseColor.mix(mixTarget, mixAmount).hex();\n const borderColor = highlighted\n ? _baseColor.mix(mixTarget, mixAmount / 1.1).hex()\n : \"transparent\";\n\n let backgroundColor = active\n ? _baseColor.alpha(backgroundAlpha).hex()\n : normalizeColor(_baseColor.alpha(backgroundAlpha).hex());\n\n // handle white backgrounds in light mode\n if (!inDarkMode && backgroundColor === \"#ffffff\") {\n console.log(\"Adjusting background color for light mode:\", backgroundColor);\n backgroundColor = \"#f0f0f0\";\n }\n\n return {\n color,\n backgroundColor,\n boxSizing: \"border-box\",\n borderStyle: \"solid\",\n borderColor,\n borderWidth: \"1.5px\",\n fontWeight: active ? \"bold\" : \"normal\",\n fontSize: \"0.9em\",\n };\n}\n\nfunction enhanceEntity(\n entity: Entity,\n entityTypes: Map<number, EntityType>,\n): EntityExt {\n return {\n ...entity,\n type: addColor(entityTypes.get(entity.type), entity.match != null),\n children: entity.children?.map((d) => enhanceEntity(d, entityTypes)),\n };\n}\n\nfunction addColor(entityType: EntityType, match = false) {\n const color = asChromaColor(entityType.color ?? \"#fff\").brighten(\n match ? 1 : 2,\n );\n\n return { ...entityType, color: color.css() };\n}\n\nexport function ExtractionContext({\n data,\n entityTypes,\n matchComponent,\n}: {\n data: any;\n entityTypes: Map<number, EntityType>;\n matchComponent: MatchComponent;\n}) {\n const highlights = buildHighlights(data.entities, null);\n\n return h(\"div\", [\n h(\"p\", h(HighlightedText, { text: data.paragraph_text, highlights })),\n h(ModelInfo, { data: data.model }),\n h(\n \"ul.entities\",\n data.entities.map((d) => h(ExtractionInfo, { data: d, matchComponent })),\n ),\n ]);\n}\n\nexport function ModelInfo({ data }) {\n return h(\"p.model-name\", [\"Model: \", h(\"code.bp5-code\", data.name)]);\n}\n\nexport type MatchComponent = (props: { data: any }) => any;\n\ntype EntityTagProps = {\n data: EntityExt;\n highlighted?: boolean;\n active?: boolean;\n onClickType?: (type: EntityType) => void;\n matchComponent?: MatchComponent;\n};\n\nexport function EntityTag({\n data,\n highlighted = true,\n active = false,\n onClickType,\n matchComponent = null,\n}: EntityTagProps) {\n const { name, type, match } = data;\n\n const className = classNames(\n {\n matched: match != null,\n type: data.type?.name ?? \"lith\",\n },\n \"entity\",\n );\n\n const style = getTagStyle(type?.color, { highlighted, active });\n\n let _matchLink = null;\n if (match != null && matchComponent != null) {\n _matchLink = h(matchComponent, { data: match });\n }\n\n return h(Tag, { style, className }, [\n h(\"span.entity-name\", name),\n \" \",\n h(\n \"code.entity-type.bp5-code\",\n {\n onClick(evt) {\n if (active && onClickType != null) {\n onClickType(type);\n evt.stopPropagation();\n }\n },\n },\n [type?.name, _matchLink],\n ),\n ]);\n}\n\nfunction ExtractionInfo({\n data,\n matchComponent = null,\n}: {\n data: EntityExt;\n matchComponent: MatchComponent;\n}) {\n const children = data.children ?? [];\n\n return h(\"li.entity-row\", [\n h(EntityTag, { data, matchComponent }),\n h.if(children.length > 0)([\n h(\n \"ul.children\",\n children.map((d) => h(ExtractionInfo, { data: d, matchComponent })),\n ),\n ]),\n ]);\n}\n\nfunction HighlightedText(props: { text: string; highlights: Highlight[] }) {\n const { text, highlights = [] } = props;\n const parts = [];\n let start = 0;\n\n const sortedHighlights = highlights.sort((a, b) => a.start - b.start);\n const deconflictedHighlights = sortedHighlights.map((highlight, i) => {\n if (i === 0) return highlight;\n const prev = sortedHighlights[i - 1];\n if (highlight.start < prev.end) {\n highlight.start = prev.end;\n }\n return highlight;\n });\n\n for (const highlight of deconflictedHighlights) {\n const { start: s, end, ...rest } = highlight;\n parts.push(text.slice(start, s));\n parts.push(h(\"span.highlight\", { style: rest }, text.slice(s, end)));\n start = end;\n }\n parts.push(text.slice(start));\n return h(\"span\", parts);\n}\n\nfunction normalizeColor(hex8) {\n const background = useDarkMode().isEnabled ? \"#000000\" : \"#ffffff\";\n\n const r = parseInt(hex8.slice(1, 3), 16);\n const g = parseInt(hex8.slice(3, 5), 16);\n const b = parseInt(hex8.slice(5, 7), 16);\n const a = parseInt(hex8.slice(7, 9), 16) / 255;\n\n const bgR = parseInt(background.slice(1, 3), 16);\n const bgG = parseInt(background.slice(3, 5), 16);\n const bgB = parseInt(background.slice(5, 7), 16);\n\n const blend = (fg, bg) => Math.round((1 - a) * bg + a * fg);\n\n const blendedR = blend(r, bgR);\n const blendedG = blend(g, bgG);\n const blendedB = blend(b, bgB);\n\n return (\n \"#\" +\n blendedR.toString(16).padStart(2, \"0\") +\n blendedG.toString(16).padStart(2, \"0\") +\n blendedB.toString(16).padStart(2, \"0\")\n );\n}\n\nfunction isHighlighted(id: number, selectedNodes: number[], nodes: any[]) {\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.5df2a926.js.map"}
|