@teselagen/ove 0.8.26 → 0.8.27

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.
@@ -1,2 +1,57 @@
1
- declare const _default: (props: any) => import("react/jsx-runtime").JSX.Element;
1
+ import { default as React } from '../../../../../node_modules/react';
2
+ declare const _default: {
3
+ new (props: any): {
4
+ handleMouseOver: (e: any) => void;
5
+ handleMouseLeave: (e: any) => void;
6
+ render(): import("react/jsx-runtime").JSX.Element;
7
+ context: unknown;
8
+ setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
9
+ forceUpdate(callback?: (() => void) | undefined): void;
10
+ readonly props: Readonly<any>;
11
+ state: Readonly<any>;
12
+ refs: {
13
+ [key: string]: React.ReactInstance;
14
+ };
15
+ componentDidMount?(): void;
16
+ shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
17
+ componentWillUnmount?(): void;
18
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
19
+ getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
20
+ componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
21
+ componentWillMount?(): void;
22
+ UNSAFE_componentWillMount?(): void;
23
+ componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
24
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
25
+ componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
26
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
27
+ };
28
+ new (props: any, context: any): {
29
+ handleMouseOver: (e: any) => void;
30
+ handleMouseLeave: (e: any) => void;
31
+ render(): import("react/jsx-runtime").JSX.Element;
32
+ context: unknown;
33
+ setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
34
+ forceUpdate(callback?: (() => void) | undefined): void;
35
+ readonly props: Readonly<any>;
36
+ state: Readonly<any>;
37
+ refs: {
38
+ [key: string]: React.ReactInstance;
39
+ };
40
+ componentDidMount?(): void;
41
+ shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
42
+ componentWillUnmount?(): void;
43
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
44
+ getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
45
+ componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
46
+ componentWillMount?(): void;
47
+ UNSAFE_componentWillMount?(): void;
48
+ componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
49
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
50
+ componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
51
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
52
+ };
53
+ contextType: React.Context<{
54
+ hoveredId: string;
55
+ }>;
56
+ };
2
57
  export default _default;
@@ -1,11 +1,71 @@
1
1
  import { default as React } from '../../../../node_modules/react';
2
2
  export function withHoveredIdFromContext(Component: any): (props: any) => import("react/jsx-runtime").JSX.Element;
3
+ export function hoveredAnnotationUpdate(id: any, { editorName }?: {
4
+ editorName?: string | undefined;
5
+ }): void;
6
+ export function hoveredAnnotationClear(clear: any, { editorName }?: {
7
+ editorName?: string | undefined;
8
+ }): void;
9
+ export default function withHover(WrappedComponent: any): {
10
+ new (props: any): {
11
+ handleMouseOver: (e: any) => void;
12
+ handleMouseLeave: (e: any) => void;
13
+ render(): import("react/jsx-runtime").JSX.Element;
14
+ context: unknown;
15
+ setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
16
+ forceUpdate(callback?: (() => void) | undefined): void;
17
+ readonly props: Readonly<any>;
18
+ state: Readonly<any>;
19
+ refs: {
20
+ [key: string]: React.ReactInstance;
21
+ };
22
+ componentDidMount?(): void;
23
+ shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
24
+ componentWillUnmount?(): void;
25
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
26
+ getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
27
+ componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
28
+ componentWillMount?(): void;
29
+ UNSAFE_componentWillMount?(): void;
30
+ componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
31
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
32
+ componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
33
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
34
+ };
35
+ new (props: any, context: any): {
36
+ handleMouseOver: (e: any) => void;
37
+ handleMouseLeave: (e: any) => void;
38
+ render(): import("react/jsx-runtime").JSX.Element;
39
+ context: unknown;
40
+ setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
41
+ forceUpdate(callback?: (() => void) | undefined): void;
42
+ readonly props: Readonly<any>;
43
+ state: Readonly<any>;
44
+ refs: {
45
+ [key: string]: React.ReactInstance;
46
+ };
47
+ componentDidMount?(): void;
48
+ shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
49
+ componentWillUnmount?(): void;
50
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
51
+ getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
52
+ componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
53
+ componentWillMount?(): void;
54
+ UNSAFE_componentWillMount?(): void;
55
+ componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
56
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
57
+ componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
58
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
59
+ };
60
+ contextType: React.Context<{
61
+ hoveredId: string;
62
+ }>;
63
+ };
3
64
  export const HoveredIdContext: React.Context<{
4
65
  hoveredId: string;
5
66
  }>;
6
67
  export namespace hoveredAnnEasyStore {
7
68
  let hoveredAnn: undefined;
8
69
  let selectedAnn: undefined;
70
+ let hoveredIds: {};
9
71
  }
10
- declare const _default: import('../../../../node_modules/redux').Func0<(props: any) => import("react/jsx-runtime").JSX.Element>;
11
- export default _default;
package/index.cjs.js CHANGED
@@ -72564,25 +72564,6 @@ const frameTranslations$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object
72564
72564
  frameTranslationToggleOn,
72565
72565
  getMinimumOrfSize: getMinimumOrfSize$1
72566
72566
  }, Symbol.toStringTag, { value: "Module" }));
72567
- const hoveredAnnotationUpdate = createMetaAction("HOVEREDANNOTATIONUPDATE");
72568
- const hoveredAnnotationClear = createMetaAction("HOVEREDANNOTATIONCLEAR");
72569
- const hoveredAnnotation = createReducer(
72570
- {
72571
- [hoveredAnnotationUpdate]: (state2, payload) => {
72572
- return payload || null;
72573
- },
72574
- [hoveredAnnotationClear]: () => {
72575
- return "";
72576
- }
72577
- },
72578
- ""
72579
- );
72580
- const hoveredAnnotationActions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
72581
- __proto__: null,
72582
- default: hoveredAnnotation,
72583
- hoveredAnnotationClear,
72584
- hoveredAnnotationUpdate
72585
- }, Symbol.toStringTag, { value: "Module" }));
72586
72567
  const minimumOrfSizeUpdate = createMetaAction("minimumOrfSizeUpdate");
72587
72568
  const minimumOrfSize = createReducer(
72588
72569
  {
@@ -97430,7 +97411,6 @@ const subReducers = {
97430
97411
  toolBar: toolBar$1,
97431
97412
  findTool: findTool$1,
97432
97413
  frameTranslations: frameTranslations$1,
97433
- hoveredAnnotation: hoveredAnnotationActions,
97434
97414
  minimumOrfSize: minimumOrfSize$1,
97435
97415
  panelsShown: panelsShown$1,
97436
97416
  propertiesTool: propertiesTool$1,
@@ -97554,7 +97534,7 @@ const makeStore = /* @__PURE__ */ __name(() => {
97554
97534
  // replacer: (key, value) => {
97555
97535
  // }
97556
97536
  // },
97557
- actionsDenylist: ["HOVEREDANNOTATIONUPDATE", "HOVEREDANNOTATIONCLEAR"]
97537
+ actionsDenylist: []
97558
97538
  }) || redux.compose;
97559
97539
  const store2 = redux.createStore(
97560
97540
  redux.combineReducers({
@@ -109518,85 +109498,105 @@ const HoveredIdContext = React.createContext({
109518
109498
  hoveredId: ""
109519
109499
  // default value
109520
109500
  });
109521
- function withHoveredIdFromContext(Component) {
109522
- return /* @__PURE__ */ __name(function HoveredIdComponent(props) {
109523
- return /* @__PURE__ */ React.createElement(HoveredIdContext.Consumer, null, (contexts) => /* @__PURE__ */ React.createElement(Component, __spreadValues(__spreadValues({}, props), contexts)));
109524
- }, "HoveredIdComponent");
109525
- }
109526
- __name(withHoveredIdFromContext, "withHoveredIdFromContext");
109527
109501
  const hoveredAnnEasyStore = store$1({
109528
109502
  hoveredAnn: void 0,
109529
- selectedAnn: void 0
109503
+ selectedAnn: void 0,
109504
+ // Per-editor hovered annotation IDs
109505
+ hoveredIds: {}
109530
109506
  });
109531
- const withHover = redux.compose(
109532
- withHoveredIdFromContext,
109533
- branch(
109534
- ({ noRedux }) => !noRedux,
109535
- reactRedux.connect(function(state2, {
109536
- id: id2,
109537
- editorName = "StandaloneEditor",
109538
- className,
109539
- hoveredId: hoveredIdFromContext,
109540
- passHoveredId
109541
- }) {
109542
- if (!editorName) {
109543
- console.warn(
109544
- "please pass an editorName to the withHover() wrapped component"
109545
- );
109546
- }
109547
- const editorState = state2.VectorEditor[editorName] || {};
109548
- const hoveredId = editorState.hoveredAnnotation || hoveredIdFromContext;
109549
- const isIdHashmap = typeof id2 === "object";
109550
- const hovered = !!(isIdHashmap ? id2[hoveredId] : hoveredId === id2);
109551
- const newClassName = classNames(className, "hoverHelper", {
109552
- veAnnotationHovered: hovered
109553
- });
109554
- const toReturn = {
109555
- hovered,
109556
- className: newClassName
109557
- };
109558
- if (hovered && passHoveredId) {
109559
- toReturn.hoveredId = hoveredId;
109507
+ function hoveredAnnotationUpdate(id2, { editorName = "StandaloneEditor" } = {}) {
109508
+ hoveredAnnEasyStore.hoveredIds[editorName] = id2;
109509
+ }
109510
+ __name(hoveredAnnotationUpdate, "hoveredAnnotationUpdate");
109511
+ function hoveredAnnotationClear(clear3, { editorName = "StandaloneEditor" } = {}) {
109512
+ hoveredAnnEasyStore.hoveredIds[editorName] = "";
109513
+ }
109514
+ __name(hoveredAnnotationClear, "hoveredAnnotationClear");
109515
+ function withHover(WrappedComponent) {
109516
+ var _a2;
109517
+ const HoverComponent = view(
109518
+ (_a2 = class extends React.Component {
109519
+ constructor() {
109520
+ super(...arguments);
109521
+ __publicField(this, "handleMouseOver", /* @__PURE__ */ __name((e) => {
109522
+ const target = e.target;
109523
+ let alreadyHandled = false;
109524
+ let currentElement = target;
109525
+ while (currentElement) {
109526
+ if (currentElement === e.currentTarget) {
109527
+ break;
109528
+ }
109529
+ if (currentElement.classList.contains("hoverHelper")) {
109530
+ alreadyHandled = true;
109531
+ break;
109532
+ }
109533
+ currentElement = currentElement.parentElement;
109534
+ }
109535
+ if (alreadyHandled) return;
109536
+ const {
109537
+ editorName = "StandaloneEditor",
109538
+ id: id2,
109539
+ annotation,
109540
+ label
109541
+ } = this.props;
109542
+ const isIdHashmap = typeof id2 === "object";
109543
+ const idToPass = isIdHashmap ? Object.keys(id2)[0] : id2;
109544
+ const annot = annotation || (label == null ? void 0 : label.annotation);
109545
+ if (modifiableTypes.includes(annot == null ? void 0 : annot.annotationTypePlural)) {
109546
+ hoveredAnnEasyStore.hoveredAnn = annot;
109547
+ }
109548
+ if (window.__veDragging || window.__veScrolling) return;
109549
+ hoveredAnnotationUpdate(idToPass, { editorName });
109550
+ }, "handleMouseOver"));
109551
+ __publicField(this, "handleMouseLeave", /* @__PURE__ */ __name((e) => {
109552
+ hoveredAnnEasyStore.hoveredAnn = void 0;
109553
+ const { editorName = "StandaloneEditor" } = this.props;
109554
+ e.stopPropagation();
109555
+ if (window.__veDragging || window.__veScrolling) return;
109556
+ hoveredAnnotationClear(true, { editorName });
109557
+ }, "handleMouseLeave"));
109560
109558
  }
109561
- return toReturn;
109562
- }, hoveredAnnotationActions)
109563
- ),
109564
- withHandlers({
109565
- onMouseOver: /* @__PURE__ */ __name((props) => function(e) {
109566
- var _a2;
109567
- const target = e.target;
109568
- let alreadyHandled = false;
109569
- let currentElement = target;
109570
- while (currentElement) {
109571
- if (currentElement === e.currentTarget) {
109572
- break;
109573
- }
109574
- if (currentElement.classList.contains("hoverHelper")) {
109575
- alreadyHandled = true;
109576
- break;
109559
+ render() {
109560
+ var _b2;
109561
+ const _a3 = this.props, {
109562
+ id: id2,
109563
+ editorName = "StandaloneEditor",
109564
+ className,
109565
+ passHoveredId,
109566
+ noRedux
109567
+ } = _a3, restProps = __objRest(_a3, [
109568
+ "id",
109569
+ "editorName",
109570
+ "className",
109571
+ "passHoveredId",
109572
+ "noRedux"
109573
+ ]);
109574
+ const hoveredIdFromContext = (_b2 = this.context) == null ? void 0 : _b2.hoveredId;
109575
+ const hoveredId = hoveredAnnEasyStore.hoveredIds[editorName] || hoveredIdFromContext || "";
109576
+ const isIdHashmap = typeof id2 === "object";
109577
+ const hovered = !!(isIdHashmap ? id2[hoveredId] : hoveredId === id2);
109578
+ const newClassName = classNames(className, "hoverHelper", {
109579
+ veAnnotationHovered: hovered
109580
+ });
109581
+ const passedProps = __spreadProps(__spreadValues({}, restProps), {
109582
+ id: id2,
109583
+ editorName,
109584
+ hovered,
109585
+ className: newClassName,
109586
+ onMouseOver: this.handleMouseOver,
109587
+ onMouseLeave: this.handleMouseLeave
109588
+ });
109589
+ if (hovered && passHoveredId) {
109590
+ passedProps.hoveredId = hoveredId;
109577
109591
  }
109578
- currentElement = currentElement.parentElement;
109579
- }
109580
- if (alreadyHandled) return;
109581
- const { editorName, id: id2, hoveredAnnotationUpdate: hoveredAnnotationUpdate2 } = props;
109582
- const isIdHashmap = typeof id2 === "object";
109583
- const idToPass = isIdHashmap ? Object.keys(id2)[0] : id2;
109584
- const annot = (props == null ? void 0 : props.annotation) || ((_a2 = props == null ? void 0 : props.label) == null ? void 0 : _a2.annotation);
109585
- if (modifiableTypes.includes(annot == null ? void 0 : annot.annotationTypePlural)) {
109586
- hoveredAnnEasyStore.hoveredAnn = annot;
109587
- }
109588
- if (window.__veDragging || window.__veScrolling) return;
109589
- hoveredAnnotationUpdate2 && hoveredAnnotationUpdate2(idToPass, { editorName });
109590
- }, "onMouseOver"),
109591
- onMouseLeave: /* @__PURE__ */ __name((props) => (e) => {
109592
- hoveredAnnEasyStore.hoveredAnn = void 0;
109593
- const { editorName, hoveredAnnotationClear: hoveredAnnotationClear2 } = props;
109594
- e.stopPropagation();
109595
- if (window.__veDragging || window.__veScrolling) return;
109596
- hoveredAnnotationClear2 && hoveredAnnotationClear2(true, { editorName });
109597
- }, "onMouseLeave")
109598
- })
109599
- );
109592
+ return /* @__PURE__ */ React.createElement(WrappedComponent, __spreadValues({}, passedProps));
109593
+ }
109594
+ }, __publicField(_a2, "contextType", HoveredIdContext), _a2)
109595
+ );
109596
+ HoverComponent.displayName = `withHover(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
109597
+ return HoverComponent;
109598
+ }
109599
+ __name(withHover, "withHover");
109600
109600
  const partOverhangs = [
109601
109601
  "fivePrimeOverhang",
109602
109602
  "fivePrimeUnderhang",
@@ -114327,12 +114327,12 @@ function Cutsites(props) {
114327
114327
  row,
114328
114328
  sequenceLength,
114329
114329
  topStrand,
114330
- hoveredAnnotation: hoveredAnnotation2
114330
+ hoveredAnnotation
114331
114331
  } = props;
114332
114332
  const snips = [];
114333
114333
  const snipConnectors = [];
114334
114334
  Object.keys(annotationRanges).sort(
114335
- (a2) => annotationRanges[a2].annotation.id === hoveredAnnotation2 ? 1 : -1
114335
+ (a2) => annotationRanges[a2].annotation.id === hoveredAnnotation ? 1 : -1
114336
114336
  ).forEach(function(key) {
114337
114337
  const annotationRange = annotationRanges[key];
114338
114338
  let { annotation } = annotationRange;
@@ -114351,7 +114351,7 @@ function Cutsites(props) {
114351
114351
  bottomSnipPosition = bottomSnipPosition && Number(bottomSnipPosition);
114352
114352
  upstreamTopSnip = upstreamTopSnip && Number(upstreamTopSnip);
114353
114353
  upstreamBottomSnip = upstreamBottomSnip && Number(upstreamBottomSnip);
114354
- const isHovered = annotation.id === hoveredAnnotation2;
114354
+ const isHovered = annotation.id === hoveredAnnotation;
114355
114355
  snipStyle = __spreadProps(__spreadValues({}, snipStyle), {
114356
114356
  background: annotation.restrictionEnzyme.color
114357
114357
  });
@@ -114468,8 +114468,8 @@ function Cutsites(props) {
114468
114468
  }
114469
114469
  __name(Cutsites, "Cutsites");
114470
114470
  const Cutsites$1 = pure(
114471
- connectToEditor(({ hoveredAnnotation: hoveredAnnotation2 }) => ({
114472
- hoveredAnnotation: hoveredAnnotation2
114471
+ connectToEditor(({ hoveredAnnotation }) => ({
114472
+ hoveredAnnotation
114473
114473
  }))(Cutsites)
114474
114474
  );
114475
114475
  const useShowChromQualScores = /* @__PURE__ */ __name(() => {
@@ -114868,11 +114868,11 @@ const defaultCharWidth = 9;
114868
114868
  const defaultContainerWidth = 400;
114869
114869
  const defaultMarginWidth$1 = 50;
114870
114870
  const CutsiteSelectionLayers = connectToEditor(
114871
- ({ hoveredAnnotation: hoveredAnnotation2 }) => ({
114872
- hoveredAnnotation: hoveredAnnotation2
114871
+ ({ hoveredAnnotation }) => ({
114872
+ hoveredAnnotation
114873
114873
  })
114874
114874
  )(/* @__PURE__ */ __name(function CutsiteSelectionLayersInner({
114875
- hoveredAnnotation: hoveredAnnotation2,
114875
+ hoveredAnnotation,
114876
114876
  cutsites,
114877
114877
  annotationCommonProps,
114878
114878
  showReverseSequence,
@@ -114880,9 +114880,9 @@ const CutsiteSelectionLayers = connectToEditor(
114880
114880
  alignmentData,
114881
114881
  row
114882
114882
  }) {
114883
- return Object.keys(cutsites).sort((a2) => cutsites[a2].id === hoveredAnnotation2 ? 1 : -1).map(function(id2, index2) {
114883
+ return Object.keys(cutsites).sort((a2) => cutsites[a2].id === hoveredAnnotation ? 1 : -1).map(function(id2, index2) {
114884
114884
  const cutsite = cutsites[id2];
114885
- const isHovered = hoveredAnnotation2 === cutsite.id;
114885
+ const isHovered = hoveredAnnotation === cutsite.id;
114886
114886
  const layer = cutsite.annotation.recognitionSiteRange;
114887
114887
  return layer.start > -1 && /* @__PURE__ */ React.createElement(
114888
114888
  SelectionLayer$3,
@@ -116986,7 +116986,7 @@ function showFileDialog({ multiple = false, onSelect }) {
116986
116986
  input.click();
116987
116987
  }
116988
116988
  __name(showFileDialog, "showFileDialog");
116989
- const version = "0.8.26";
116989
+ const version = "0.8.27";
116990
116990
  const packageJson = {
116991
116991
  version
116992
116992
  };
package/index.es.js CHANGED
@@ -72546,25 +72546,6 @@ const frameTranslations$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object
72546
72546
  frameTranslationToggleOn,
72547
72547
  getMinimumOrfSize: getMinimumOrfSize$1
72548
72548
  }, Symbol.toStringTag, { value: "Module" }));
72549
- const hoveredAnnotationUpdate = createMetaAction("HOVEREDANNOTATIONUPDATE");
72550
- const hoveredAnnotationClear = createMetaAction("HOVEREDANNOTATIONCLEAR");
72551
- const hoveredAnnotation = createReducer(
72552
- {
72553
- [hoveredAnnotationUpdate]: (state2, payload) => {
72554
- return payload || null;
72555
- },
72556
- [hoveredAnnotationClear]: () => {
72557
- return "";
72558
- }
72559
- },
72560
- ""
72561
- );
72562
- const hoveredAnnotationActions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
72563
- __proto__: null,
72564
- default: hoveredAnnotation,
72565
- hoveredAnnotationClear,
72566
- hoveredAnnotationUpdate
72567
- }, Symbol.toStringTag, { value: "Module" }));
72568
72549
  const minimumOrfSizeUpdate = createMetaAction("minimumOrfSizeUpdate");
72569
72550
  const minimumOrfSize = createReducer(
72570
72551
  {
@@ -97412,7 +97393,6 @@ const subReducers = {
97412
97393
  toolBar: toolBar$1,
97413
97394
  findTool: findTool$1,
97414
97395
  frameTranslations: frameTranslations$1,
97415
- hoveredAnnotation: hoveredAnnotationActions,
97416
97396
  minimumOrfSize: minimumOrfSize$1,
97417
97397
  panelsShown: panelsShown$1,
97418
97398
  propertiesTool: propertiesTool$1,
@@ -97536,7 +97516,7 @@ const makeStore = /* @__PURE__ */ __name(() => {
97536
97516
  // replacer: (key, value) => {
97537
97517
  // }
97538
97518
  // },
97539
- actionsDenylist: ["HOVEREDANNOTATIONUPDATE", "HOVEREDANNOTATIONCLEAR"]
97519
+ actionsDenylist: []
97540
97520
  }) || compose$1;
97541
97521
  const store2 = createStore$2(
97542
97522
  combineReducers({
@@ -109500,85 +109480,105 @@ const HoveredIdContext = React__default.createContext({
109500
109480
  hoveredId: ""
109501
109481
  // default value
109502
109482
  });
109503
- function withHoveredIdFromContext(Component2) {
109504
- return /* @__PURE__ */ __name(function HoveredIdComponent(props) {
109505
- return /* @__PURE__ */ React__default.createElement(HoveredIdContext.Consumer, null, (contexts) => /* @__PURE__ */ React__default.createElement(Component2, __spreadValues(__spreadValues({}, props), contexts)));
109506
- }, "HoveredIdComponent");
109507
- }
109508
- __name(withHoveredIdFromContext, "withHoveredIdFromContext");
109509
109483
  const hoveredAnnEasyStore = store$1({
109510
109484
  hoveredAnn: void 0,
109511
- selectedAnn: void 0
109485
+ selectedAnn: void 0,
109486
+ // Per-editor hovered annotation IDs
109487
+ hoveredIds: {}
109512
109488
  });
109513
- const withHover = compose$1(
109514
- withHoveredIdFromContext,
109515
- branch(
109516
- ({ noRedux }) => !noRedux,
109517
- connect(function(state2, {
109518
- id: id2,
109519
- editorName = "StandaloneEditor",
109520
- className,
109521
- hoveredId: hoveredIdFromContext,
109522
- passHoveredId
109523
- }) {
109524
- if (!editorName) {
109525
- console.warn(
109526
- "please pass an editorName to the withHover() wrapped component"
109527
- );
109528
- }
109529
- const editorState = state2.VectorEditor[editorName] || {};
109530
- const hoveredId = editorState.hoveredAnnotation || hoveredIdFromContext;
109531
- const isIdHashmap = typeof id2 === "object";
109532
- const hovered = !!(isIdHashmap ? id2[hoveredId] : hoveredId === id2);
109533
- const newClassName = classNames(className, "hoverHelper", {
109534
- veAnnotationHovered: hovered
109535
- });
109536
- const toReturn = {
109537
- hovered,
109538
- className: newClassName
109539
- };
109540
- if (hovered && passHoveredId) {
109541
- toReturn.hoveredId = hoveredId;
109489
+ function hoveredAnnotationUpdate(id2, { editorName = "StandaloneEditor" } = {}) {
109490
+ hoveredAnnEasyStore.hoveredIds[editorName] = id2;
109491
+ }
109492
+ __name(hoveredAnnotationUpdate, "hoveredAnnotationUpdate");
109493
+ function hoveredAnnotationClear(clear3, { editorName = "StandaloneEditor" } = {}) {
109494
+ hoveredAnnEasyStore.hoveredIds[editorName] = "";
109495
+ }
109496
+ __name(hoveredAnnotationClear, "hoveredAnnotationClear");
109497
+ function withHover(WrappedComponent) {
109498
+ var _a2;
109499
+ const HoverComponent = view(
109500
+ (_a2 = class extends React__default.Component {
109501
+ constructor() {
109502
+ super(...arguments);
109503
+ __publicField(this, "handleMouseOver", /* @__PURE__ */ __name((e) => {
109504
+ const target = e.target;
109505
+ let alreadyHandled = false;
109506
+ let currentElement = target;
109507
+ while (currentElement) {
109508
+ if (currentElement === e.currentTarget) {
109509
+ break;
109510
+ }
109511
+ if (currentElement.classList.contains("hoverHelper")) {
109512
+ alreadyHandled = true;
109513
+ break;
109514
+ }
109515
+ currentElement = currentElement.parentElement;
109516
+ }
109517
+ if (alreadyHandled) return;
109518
+ const {
109519
+ editorName = "StandaloneEditor",
109520
+ id: id2,
109521
+ annotation,
109522
+ label
109523
+ } = this.props;
109524
+ const isIdHashmap = typeof id2 === "object";
109525
+ const idToPass = isIdHashmap ? Object.keys(id2)[0] : id2;
109526
+ const annot = annotation || (label == null ? void 0 : label.annotation);
109527
+ if (modifiableTypes.includes(annot == null ? void 0 : annot.annotationTypePlural)) {
109528
+ hoveredAnnEasyStore.hoveredAnn = annot;
109529
+ }
109530
+ if (window.__veDragging || window.__veScrolling) return;
109531
+ hoveredAnnotationUpdate(idToPass, { editorName });
109532
+ }, "handleMouseOver"));
109533
+ __publicField(this, "handleMouseLeave", /* @__PURE__ */ __name((e) => {
109534
+ hoveredAnnEasyStore.hoveredAnn = void 0;
109535
+ const { editorName = "StandaloneEditor" } = this.props;
109536
+ e.stopPropagation();
109537
+ if (window.__veDragging || window.__veScrolling) return;
109538
+ hoveredAnnotationClear(true, { editorName });
109539
+ }, "handleMouseLeave"));
109542
109540
  }
109543
- return toReturn;
109544
- }, hoveredAnnotationActions)
109545
- ),
109546
- withHandlers({
109547
- onMouseOver: /* @__PURE__ */ __name((props) => function(e) {
109548
- var _a2;
109549
- const target = e.target;
109550
- let alreadyHandled = false;
109551
- let currentElement = target;
109552
- while (currentElement) {
109553
- if (currentElement === e.currentTarget) {
109554
- break;
109555
- }
109556
- if (currentElement.classList.contains("hoverHelper")) {
109557
- alreadyHandled = true;
109558
- break;
109541
+ render() {
109542
+ var _b2;
109543
+ const _a3 = this.props, {
109544
+ id: id2,
109545
+ editorName = "StandaloneEditor",
109546
+ className,
109547
+ passHoveredId,
109548
+ noRedux
109549
+ } = _a3, restProps = __objRest(_a3, [
109550
+ "id",
109551
+ "editorName",
109552
+ "className",
109553
+ "passHoveredId",
109554
+ "noRedux"
109555
+ ]);
109556
+ const hoveredIdFromContext = (_b2 = this.context) == null ? void 0 : _b2.hoveredId;
109557
+ const hoveredId = hoveredAnnEasyStore.hoveredIds[editorName] || hoveredIdFromContext || "";
109558
+ const isIdHashmap = typeof id2 === "object";
109559
+ const hovered = !!(isIdHashmap ? id2[hoveredId] : hoveredId === id2);
109560
+ const newClassName = classNames(className, "hoverHelper", {
109561
+ veAnnotationHovered: hovered
109562
+ });
109563
+ const passedProps = __spreadProps(__spreadValues({}, restProps), {
109564
+ id: id2,
109565
+ editorName,
109566
+ hovered,
109567
+ className: newClassName,
109568
+ onMouseOver: this.handleMouseOver,
109569
+ onMouseLeave: this.handleMouseLeave
109570
+ });
109571
+ if (hovered && passHoveredId) {
109572
+ passedProps.hoveredId = hoveredId;
109559
109573
  }
109560
- currentElement = currentElement.parentElement;
109561
- }
109562
- if (alreadyHandled) return;
109563
- const { editorName, id: id2, hoveredAnnotationUpdate: hoveredAnnotationUpdate2 } = props;
109564
- const isIdHashmap = typeof id2 === "object";
109565
- const idToPass = isIdHashmap ? Object.keys(id2)[0] : id2;
109566
- const annot = (props == null ? void 0 : props.annotation) || ((_a2 = props == null ? void 0 : props.label) == null ? void 0 : _a2.annotation);
109567
- if (modifiableTypes.includes(annot == null ? void 0 : annot.annotationTypePlural)) {
109568
- hoveredAnnEasyStore.hoveredAnn = annot;
109569
- }
109570
- if (window.__veDragging || window.__veScrolling) return;
109571
- hoveredAnnotationUpdate2 && hoveredAnnotationUpdate2(idToPass, { editorName });
109572
- }, "onMouseOver"),
109573
- onMouseLeave: /* @__PURE__ */ __name((props) => (e) => {
109574
- hoveredAnnEasyStore.hoveredAnn = void 0;
109575
- const { editorName, hoveredAnnotationClear: hoveredAnnotationClear2 } = props;
109576
- e.stopPropagation();
109577
- if (window.__veDragging || window.__veScrolling) return;
109578
- hoveredAnnotationClear2 && hoveredAnnotationClear2(true, { editorName });
109579
- }, "onMouseLeave")
109580
- })
109581
- );
109574
+ return /* @__PURE__ */ React__default.createElement(WrappedComponent, __spreadValues({}, passedProps));
109575
+ }
109576
+ }, __publicField(_a2, "contextType", HoveredIdContext), _a2)
109577
+ );
109578
+ HoverComponent.displayName = `withHover(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
109579
+ return HoverComponent;
109580
+ }
109581
+ __name(withHover, "withHover");
109582
109582
  const partOverhangs = [
109583
109583
  "fivePrimeOverhang",
109584
109584
  "fivePrimeUnderhang",
@@ -114309,12 +114309,12 @@ function Cutsites(props) {
114309
114309
  row,
114310
114310
  sequenceLength,
114311
114311
  topStrand,
114312
- hoveredAnnotation: hoveredAnnotation2
114312
+ hoveredAnnotation
114313
114313
  } = props;
114314
114314
  const snips = [];
114315
114315
  const snipConnectors = [];
114316
114316
  Object.keys(annotationRanges).sort(
114317
- (a2) => annotationRanges[a2].annotation.id === hoveredAnnotation2 ? 1 : -1
114317
+ (a2) => annotationRanges[a2].annotation.id === hoveredAnnotation ? 1 : -1
114318
114318
  ).forEach(function(key) {
114319
114319
  const annotationRange = annotationRanges[key];
114320
114320
  let { annotation } = annotationRange;
@@ -114333,7 +114333,7 @@ function Cutsites(props) {
114333
114333
  bottomSnipPosition = bottomSnipPosition && Number(bottomSnipPosition);
114334
114334
  upstreamTopSnip = upstreamTopSnip && Number(upstreamTopSnip);
114335
114335
  upstreamBottomSnip = upstreamBottomSnip && Number(upstreamBottomSnip);
114336
- const isHovered = annotation.id === hoveredAnnotation2;
114336
+ const isHovered = annotation.id === hoveredAnnotation;
114337
114337
  snipStyle = __spreadProps(__spreadValues({}, snipStyle), {
114338
114338
  background: annotation.restrictionEnzyme.color
114339
114339
  });
@@ -114450,8 +114450,8 @@ function Cutsites(props) {
114450
114450
  }
114451
114451
  __name(Cutsites, "Cutsites");
114452
114452
  const Cutsites$1 = pure(
114453
- connectToEditor(({ hoveredAnnotation: hoveredAnnotation2 }) => ({
114454
- hoveredAnnotation: hoveredAnnotation2
114453
+ connectToEditor(({ hoveredAnnotation }) => ({
114454
+ hoveredAnnotation
114455
114455
  }))(Cutsites)
114456
114456
  );
114457
114457
  const useShowChromQualScores = /* @__PURE__ */ __name(() => {
@@ -114850,11 +114850,11 @@ const defaultCharWidth = 9;
114850
114850
  const defaultContainerWidth = 400;
114851
114851
  const defaultMarginWidth$1 = 50;
114852
114852
  const CutsiteSelectionLayers = connectToEditor(
114853
- ({ hoveredAnnotation: hoveredAnnotation2 }) => ({
114854
- hoveredAnnotation: hoveredAnnotation2
114853
+ ({ hoveredAnnotation }) => ({
114854
+ hoveredAnnotation
114855
114855
  })
114856
114856
  )(/* @__PURE__ */ __name(function CutsiteSelectionLayersInner({
114857
- hoveredAnnotation: hoveredAnnotation2,
114857
+ hoveredAnnotation,
114858
114858
  cutsites,
114859
114859
  annotationCommonProps,
114860
114860
  showReverseSequence,
@@ -114862,9 +114862,9 @@ const CutsiteSelectionLayers = connectToEditor(
114862
114862
  alignmentData,
114863
114863
  row
114864
114864
  }) {
114865
- return Object.keys(cutsites).sort((a2) => cutsites[a2].id === hoveredAnnotation2 ? 1 : -1).map(function(id2, index2) {
114865
+ return Object.keys(cutsites).sort((a2) => cutsites[a2].id === hoveredAnnotation ? 1 : -1).map(function(id2, index2) {
114866
114866
  const cutsite = cutsites[id2];
114867
- const isHovered = hoveredAnnotation2 === cutsite.id;
114867
+ const isHovered = hoveredAnnotation === cutsite.id;
114868
114868
  const layer = cutsite.annotation.recognitionSiteRange;
114869
114869
  return layer.start > -1 && /* @__PURE__ */ React__default.createElement(
114870
114870
  SelectionLayer$3,
@@ -116968,7 +116968,7 @@ function showFileDialog({ multiple = false, onSelect }) {
116968
116968
  input.click();
116969
116969
  }
116970
116970
  __name(showFileDialog, "showFileDialog");
116971
- const version = "0.8.26";
116971
+ const version = "0.8.27";
116972
116972
  const packageJson = {
116973
116973
  version
116974
116974
  };
package/index.umd.js CHANGED
@@ -101467,25 +101467,6 @@ ${latestSubscriptionCallbackError.current.stack}
101467
101467
  frameTranslationToggleOn,
101468
101468
  getMinimumOrfSize: getMinimumOrfSize$1
101469
101469
  }, Symbol.toStringTag, { value: "Module" }));
101470
- const hoveredAnnotationUpdate = createMetaAction("HOVEREDANNOTATIONUPDATE");
101471
- const hoveredAnnotationClear = createMetaAction("HOVEREDANNOTATIONCLEAR");
101472
- const hoveredAnnotation = createReducer(
101473
- {
101474
- [hoveredAnnotationUpdate]: (state2, payload) => {
101475
- return payload || null;
101476
- },
101477
- [hoveredAnnotationClear]: () => {
101478
- return "";
101479
- }
101480
- },
101481
- ""
101482
- );
101483
- const hoveredAnnotationActions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
101484
- __proto__: null,
101485
- default: hoveredAnnotation,
101486
- hoveredAnnotationClear,
101487
- hoveredAnnotationUpdate
101488
- }, Symbol.toStringTag, { value: "Module" }));
101489
101470
  const minimumOrfSizeUpdate = createMetaAction("minimumOrfSizeUpdate");
101490
101471
  const minimumOrfSize = createReducer(
101491
101472
  {
@@ -125578,7 +125559,6 @@ ${seq.sequence}
125578
125559
  toolBar: toolBar$1,
125579
125560
  findTool: findTool$1,
125580
125561
  frameTranslations: frameTranslations$1,
125581
- hoveredAnnotation: hoveredAnnotationActions,
125582
125562
  minimumOrfSize: minimumOrfSize$1,
125583
125563
  panelsShown: panelsShown$1,
125584
125564
  propertiesTool: propertiesTool$1,
@@ -125702,7 +125682,7 @@ ${seq.sequence}
125702
125682
  // replacer: (key, value) => {
125703
125683
  // }
125704
125684
  // },
125705
- actionsDenylist: ["HOVEREDANNOTATIONUPDATE", "HOVEREDANNOTATIONCLEAR"]
125685
+ actionsDenylist: []
125706
125686
  }) || compose$1;
125707
125687
  const store2 = createStore$2(
125708
125688
  combineReducers({
@@ -137666,85 +137646,105 @@ ${seq.sequence}
137666
137646
  hoveredId: ""
137667
137647
  // default value
137668
137648
  });
137669
- function withHoveredIdFromContext(Component) {
137670
- return /* @__PURE__ */ __name(function HoveredIdComponent(props) {
137671
- return /* @__PURE__ */ React.createElement(HoveredIdContext.Consumer, null, (contexts) => /* @__PURE__ */ React.createElement(Component, __spreadValues(__spreadValues({}, props), contexts)));
137672
- }, "HoveredIdComponent");
137673
- }
137674
- __name(withHoveredIdFromContext, "withHoveredIdFromContext");
137675
137649
  const hoveredAnnEasyStore = store$1({
137676
137650
  hoveredAnn: void 0,
137677
- selectedAnn: void 0
137651
+ selectedAnn: void 0,
137652
+ // Per-editor hovered annotation IDs
137653
+ hoveredIds: {}
137678
137654
  });
137679
- const withHover = compose$1(
137680
- withHoveredIdFromContext,
137681
- branch(
137682
- ({ noRedux }) => !noRedux,
137683
- connect(function(state2, {
137684
- id: id2,
137685
- editorName = "StandaloneEditor",
137686
- className,
137687
- hoveredId: hoveredIdFromContext,
137688
- passHoveredId
137689
- }) {
137690
- if (!editorName) {
137691
- console.warn(
137692
- "please pass an editorName to the withHover() wrapped component"
137693
- );
137694
- }
137695
- const editorState = state2.VectorEditor[editorName] || {};
137696
- const hoveredId = editorState.hoveredAnnotation || hoveredIdFromContext;
137697
- const isIdHashmap = typeof id2 === "object";
137698
- const hovered = !!(isIdHashmap ? id2[hoveredId] : hoveredId === id2);
137699
- const newClassName = classNames$1(className, "hoverHelper", {
137700
- veAnnotationHovered: hovered
137701
- });
137702
- const toReturn = {
137703
- hovered,
137704
- className: newClassName
137705
- };
137706
- if (hovered && passHoveredId) {
137707
- toReturn.hoveredId = hoveredId;
137655
+ function hoveredAnnotationUpdate(id2, { editorName = "StandaloneEditor" } = {}) {
137656
+ hoveredAnnEasyStore.hoveredIds[editorName] = id2;
137657
+ }
137658
+ __name(hoveredAnnotationUpdate, "hoveredAnnotationUpdate");
137659
+ function hoveredAnnotationClear(clear, { editorName = "StandaloneEditor" } = {}) {
137660
+ hoveredAnnEasyStore.hoveredIds[editorName] = "";
137661
+ }
137662
+ __name(hoveredAnnotationClear, "hoveredAnnotationClear");
137663
+ function withHover(WrappedComponent) {
137664
+ var _a2;
137665
+ const HoverComponent = view(
137666
+ (_a2 = class extends React.Component {
137667
+ constructor() {
137668
+ super(...arguments);
137669
+ __publicField(this, "handleMouseOver", /* @__PURE__ */ __name((e2) => {
137670
+ const target = e2.target;
137671
+ let alreadyHandled = false;
137672
+ let currentElement = target;
137673
+ while (currentElement) {
137674
+ if (currentElement === e2.currentTarget) {
137675
+ break;
137676
+ }
137677
+ if (currentElement.classList.contains("hoverHelper")) {
137678
+ alreadyHandled = true;
137679
+ break;
137680
+ }
137681
+ currentElement = currentElement.parentElement;
137682
+ }
137683
+ if (alreadyHandled) return;
137684
+ const {
137685
+ editorName = "StandaloneEditor",
137686
+ id: id2,
137687
+ annotation,
137688
+ label
137689
+ } = this.props;
137690
+ const isIdHashmap = typeof id2 === "object";
137691
+ const idToPass = isIdHashmap ? Object.keys(id2)[0] : id2;
137692
+ const annot = annotation || (label == null ? void 0 : label.annotation);
137693
+ if (modifiableTypes.includes(annot == null ? void 0 : annot.annotationTypePlural)) {
137694
+ hoveredAnnEasyStore.hoveredAnn = annot;
137695
+ }
137696
+ if (window.__veDragging || window.__veScrolling) return;
137697
+ hoveredAnnotationUpdate(idToPass, { editorName });
137698
+ }, "handleMouseOver"));
137699
+ __publicField(this, "handleMouseLeave", /* @__PURE__ */ __name((e2) => {
137700
+ hoveredAnnEasyStore.hoveredAnn = void 0;
137701
+ const { editorName = "StandaloneEditor" } = this.props;
137702
+ e2.stopPropagation();
137703
+ if (window.__veDragging || window.__veScrolling) return;
137704
+ hoveredAnnotationClear(true, { editorName });
137705
+ }, "handleMouseLeave"));
137708
137706
  }
137709
- return toReturn;
137710
- }, hoveredAnnotationActions)
137711
- ),
137712
- withHandlers({
137713
- onMouseOver: /* @__PURE__ */ __name((props) => function(e2) {
137714
- var _a2;
137715
- const target = e2.target;
137716
- let alreadyHandled = false;
137717
- let currentElement = target;
137718
- while (currentElement) {
137719
- if (currentElement === e2.currentTarget) {
137720
- break;
137721
- }
137722
- if (currentElement.classList.contains("hoverHelper")) {
137723
- alreadyHandled = true;
137724
- break;
137707
+ render() {
137708
+ var _b2;
137709
+ const _a3 = this.props, {
137710
+ id: id2,
137711
+ editorName = "StandaloneEditor",
137712
+ className,
137713
+ passHoveredId,
137714
+ noRedux
137715
+ } = _a3, restProps = __objRest(_a3, [
137716
+ "id",
137717
+ "editorName",
137718
+ "className",
137719
+ "passHoveredId",
137720
+ "noRedux"
137721
+ ]);
137722
+ const hoveredIdFromContext = (_b2 = this.context) == null ? void 0 : _b2.hoveredId;
137723
+ const hoveredId = hoveredAnnEasyStore.hoveredIds[editorName] || hoveredIdFromContext || "";
137724
+ const isIdHashmap = typeof id2 === "object";
137725
+ const hovered = !!(isIdHashmap ? id2[hoveredId] : hoveredId === id2);
137726
+ const newClassName = classNames$1(className, "hoverHelper", {
137727
+ veAnnotationHovered: hovered
137728
+ });
137729
+ const passedProps = __spreadProps(__spreadValues({}, restProps), {
137730
+ id: id2,
137731
+ editorName,
137732
+ hovered,
137733
+ className: newClassName,
137734
+ onMouseOver: this.handleMouseOver,
137735
+ onMouseLeave: this.handleMouseLeave
137736
+ });
137737
+ if (hovered && passHoveredId) {
137738
+ passedProps.hoveredId = hoveredId;
137725
137739
  }
137726
- currentElement = currentElement.parentElement;
137727
- }
137728
- if (alreadyHandled) return;
137729
- const { editorName, id: id2, hoveredAnnotationUpdate: hoveredAnnotationUpdate2 } = props;
137730
- const isIdHashmap = typeof id2 === "object";
137731
- const idToPass = isIdHashmap ? Object.keys(id2)[0] : id2;
137732
- const annot = (props == null ? void 0 : props.annotation) || ((_a2 = props == null ? void 0 : props.label) == null ? void 0 : _a2.annotation);
137733
- if (modifiableTypes.includes(annot == null ? void 0 : annot.annotationTypePlural)) {
137734
- hoveredAnnEasyStore.hoveredAnn = annot;
137735
- }
137736
- if (window.__veDragging || window.__veScrolling) return;
137737
- hoveredAnnotationUpdate2 && hoveredAnnotationUpdate2(idToPass, { editorName });
137738
- }, "onMouseOver"),
137739
- onMouseLeave: /* @__PURE__ */ __name((props) => (e2) => {
137740
- hoveredAnnEasyStore.hoveredAnn = void 0;
137741
- const { editorName, hoveredAnnotationClear: hoveredAnnotationClear2 } = props;
137742
- e2.stopPropagation();
137743
- if (window.__veDragging || window.__veScrolling) return;
137744
- hoveredAnnotationClear2 && hoveredAnnotationClear2(true, { editorName });
137745
- }, "onMouseLeave")
137746
- })
137747
- );
137740
+ return /* @__PURE__ */ React.createElement(WrappedComponent, __spreadValues({}, passedProps));
137741
+ }
137742
+ }, __publicField(_a2, "contextType", HoveredIdContext), _a2)
137743
+ );
137744
+ HoverComponent.displayName = `withHover(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
137745
+ return HoverComponent;
137746
+ }
137747
+ __name(withHover, "withHover");
137748
137748
  const partOverhangs = [
137749
137749
  "fivePrimeOverhang",
137750
137750
  "fivePrimeUnderhang",
@@ -142425,12 +142425,12 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
142425
142425
  row,
142426
142426
  sequenceLength,
142427
142427
  topStrand,
142428
- hoveredAnnotation: hoveredAnnotation2
142428
+ hoveredAnnotation
142429
142429
  } = props;
142430
142430
  const snips = [];
142431
142431
  const snipConnectors = [];
142432
142432
  Object.keys(annotationRanges).sort(
142433
- (a2) => annotationRanges[a2].annotation.id === hoveredAnnotation2 ? 1 : -1
142433
+ (a2) => annotationRanges[a2].annotation.id === hoveredAnnotation ? 1 : -1
142434
142434
  ).forEach(function(key) {
142435
142435
  const annotationRange = annotationRanges[key];
142436
142436
  let { annotation } = annotationRange;
@@ -142449,7 +142449,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
142449
142449
  bottomSnipPosition = bottomSnipPosition && Number(bottomSnipPosition);
142450
142450
  upstreamTopSnip = upstreamTopSnip && Number(upstreamTopSnip);
142451
142451
  upstreamBottomSnip = upstreamBottomSnip && Number(upstreamBottomSnip);
142452
- const isHovered = annotation.id === hoveredAnnotation2;
142452
+ const isHovered = annotation.id === hoveredAnnotation;
142453
142453
  snipStyle = __spreadProps(__spreadValues({}, snipStyle), {
142454
142454
  background: annotation.restrictionEnzyme.color
142455
142455
  });
@@ -142566,8 +142566,8 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
142566
142566
  }
142567
142567
  __name(Cutsites, "Cutsites");
142568
142568
  const Cutsites$1 = pure(
142569
- connectToEditor(({ hoveredAnnotation: hoveredAnnotation2 }) => ({
142570
- hoveredAnnotation: hoveredAnnotation2
142569
+ connectToEditor(({ hoveredAnnotation }) => ({
142570
+ hoveredAnnotation
142571
142571
  }))(Cutsites)
142572
142572
  );
142573
142573
  const useShowChromQualScores = /* @__PURE__ */ __name(() => {
@@ -142966,11 +142966,11 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
142966
142966
  const defaultContainerWidth = 400;
142967
142967
  const defaultMarginWidth$1 = 50;
142968
142968
  const CutsiteSelectionLayers = connectToEditor(
142969
- ({ hoveredAnnotation: hoveredAnnotation2 }) => ({
142970
- hoveredAnnotation: hoveredAnnotation2
142969
+ ({ hoveredAnnotation }) => ({
142970
+ hoveredAnnotation
142971
142971
  })
142972
142972
  )(/* @__PURE__ */ __name(function CutsiteSelectionLayersInner({
142973
- hoveredAnnotation: hoveredAnnotation2,
142973
+ hoveredAnnotation,
142974
142974
  cutsites,
142975
142975
  annotationCommonProps,
142976
142976
  showReverseSequence,
@@ -142978,9 +142978,9 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
142978
142978
  alignmentData,
142979
142979
  row
142980
142980
  }) {
142981
- return Object.keys(cutsites).sort((a2) => cutsites[a2].id === hoveredAnnotation2 ? 1 : -1).map(function(id2, index2) {
142981
+ return Object.keys(cutsites).sort((a2) => cutsites[a2].id === hoveredAnnotation ? 1 : -1).map(function(id2, index2) {
142982
142982
  const cutsite = cutsites[id2];
142983
- const isHovered = hoveredAnnotation2 === cutsite.id;
142983
+ const isHovered = hoveredAnnotation === cutsite.id;
142984
142984
  const layer = cutsite.annotation.recognitionSiteRange;
142985
142985
  return layer.start > -1 && /* @__PURE__ */ React.createElement(
142986
142986
  SelectionLayer$3,
@@ -145084,7 +145084,7 @@ Part of ${annotation.translationType} Translation from BPs ${annotation.start +
145084
145084
  input.click();
145085
145085
  }
145086
145086
  __name(showFileDialog, "showFileDialog");
145087
- const version = "0.8.26";
145087
+ const version = "0.8.27";
145088
145088
  const packageJson = {
145089
145089
  version
145090
145090
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ove",
3
- "version": "0.8.26",
3
+ "version": "0.8.27",
4
4
  "main": "./src/index.js",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/TeselaGen/tg-oss",
@@ -14,7 +14,7 @@ const makeStore = () => {
14
14
  // replacer: (key, value) => {
15
15
  // }
16
16
  // },
17
- actionsDenylist: ["HOVEREDANNOTATIONUPDATE", "HOVEREDANNOTATIONCLEAR"]
17
+ actionsDenylist: []
18
18
  })) ||
19
19
  compose;
20
20
 
@@ -1,10 +1,6 @@
1
1
  import classnames from "classnames";
2
- import { compose } from "redux";
3
- import { connect } from "react-redux";
4
2
  import React from "react";
5
- import { store } from "@risingstack/react-easy-state";
6
- import * as hoveredAnnotationActions from "../redux/hoveredAnnotation";
7
- import { withHandlers, branch } from "recompose";
3
+ import { store, view } from "@risingstack/react-easy-state";
8
4
  import { modifiableTypes } from "@teselagen/sequence-utils";
9
5
 
10
6
  export const HoveredIdContext = React.createContext({
@@ -20,57 +16,37 @@ export function withHoveredIdFromContext(Component) {
20
16
  );
21
17
  };
22
18
  }
19
+
20
+ // Easy state store for hover state management (replaces Redux)
23
21
  export const hoveredAnnEasyStore = store({
24
22
  hoveredAnn: undefined,
25
- selectedAnn: undefined
23
+ selectedAnn: undefined,
24
+ // Per-editor hovered annotation IDs
25
+ hoveredIds: {}
26
26
  });
27
27
 
28
- export default compose(
29
- withHoveredIdFromContext,
30
- branch(
31
- ({ noRedux }) => !noRedux,
32
- connect(function (
33
- state,
34
- {
35
- id,
36
- editorName = "StandaloneEditor",
37
- className,
38
- hoveredId: hoveredIdFromContext,
39
- passHoveredId
40
- }
41
- ) {
42
- if (!editorName) {
43
- console.warn(
44
- "please pass an editorName to the withHover() wrapped component"
45
- );
46
- }
47
- const editorState = state.VectorEditor[editorName] || {};
48
- const hoveredId = editorState.hoveredAnnotation || hoveredIdFromContext; //we can pass a hoveredId from context in order to still use the hover functionality without being connected to redux! see http://localhost:3344/#/SimpleCircularOrLinearView for an example
49
- const isIdHashmap = typeof id === "object";
50
-
51
- const hovered = !!(isIdHashmap ? id[hoveredId] : hoveredId === id);
52
- const newClassName = classnames(className, "hoverHelper", {
53
- veAnnotationHovered: hovered
54
- });
55
- const toReturn = {
56
- hovered,
57
- className: newClassName
58
- };
59
- if (hovered && passHoveredId) {
60
- //only pass hoveredId if it is hovered
61
- toReturn.hoveredId = hoveredId;
62
- }
63
- return toReturn;
64
- }, hoveredAnnotationActions)
65
- ),
66
- withHandlers({
67
- onMouseOver: props =>
68
- function (e) {
69
- // loop through the target element and the parents and see if any of them have the hoverHelper class
70
- // if they do, then we don't want to trigger the hover event
71
- // if they don't, then we do want to trigger the hover event
72
- // we should stop the loop if the target element is implementing this onMouseOver event
73
- // e.stopPropagation(); //this is important otherwise hovering labels inside circular view label groups won't work
28
+ // Helper functions to update/clear hovered annotation (replaces Redux actions)
29
+ export function hoveredAnnotationUpdate(
30
+ id,
31
+ { editorName = "StandaloneEditor" } = {}
32
+ ) {
33
+ hoveredAnnEasyStore.hoveredIds[editorName] = id;
34
+ }
35
+
36
+ export function hoveredAnnotationClear(
37
+ clear,
38
+ { editorName = "StandaloneEditor" } = {}
39
+ ) {
40
+ hoveredAnnEasyStore.hoveredIds[editorName] = "";
41
+ }
42
+
43
+ // HOC that provides hover functionality using react-easy-state
44
+ export default function withHover(WrappedComponent) {
45
+ const HoverComponent = view(
46
+ class extends React.Component {
47
+ static contextType = HoveredIdContext;
48
+
49
+ handleMouseOver = e => {
74
50
  const target = e.target;
75
51
  let alreadyHandled = false;
76
52
  let currentElement = target;
@@ -78,8 +54,6 @@ export default compose(
78
54
  if (currentElement === e.currentTarget) {
79
55
  break;
80
56
  }
81
- // console.log(`currentElement:`, currentElement)
82
-
83
57
  if (currentElement.classList.contains("hoverHelper")) {
84
58
  alreadyHandled = true;
85
59
  break;
@@ -88,26 +62,76 @@ export default compose(
88
62
  }
89
63
  if (alreadyHandled) return;
90
64
 
91
- // const alreadyHandled = e.target.classList.contains("hoverHelper");
92
- const { editorName, id, hoveredAnnotationUpdate } = props;
65
+ const {
66
+ editorName = "StandaloneEditor",
67
+ id,
68
+ annotation,
69
+ label
70
+ } = this.props;
93
71
  const isIdHashmap = typeof id === "object";
94
72
  const idToPass = isIdHashmap ? Object.keys(id)[0] : id;
95
- const annot = props?.annotation || props?.label?.annotation;
73
+ const annot = annotation || label?.annotation;
96
74
  if (modifiableTypes.includes(annot?.annotationTypePlural)) {
97
75
  hoveredAnnEasyStore.hoveredAnn = annot;
98
76
  }
99
- //because the calling onHover can slow things down, we disable it if dragging or scrolling
77
+ // Disable hover during dragging or scrolling
100
78
  if (window.__veDragging || window.__veScrolling) return;
101
79
 
102
- hoveredAnnotationUpdate &&
103
- hoveredAnnotationUpdate(idToPass, { editorName });
104
- },
105
- onMouseLeave: props => e => {
106
- hoveredAnnEasyStore.hoveredAnn = undefined;
107
- const { editorName, hoveredAnnotationClear } = props;
108
- e.stopPropagation();
109
- if (window.__veDragging || window.__veScrolling) return;
110
- hoveredAnnotationClear && hoveredAnnotationClear(true, { editorName });
80
+ hoveredAnnotationUpdate(idToPass, { editorName });
81
+ };
82
+
83
+ handleMouseLeave = e => {
84
+ hoveredAnnEasyStore.hoveredAnn = undefined;
85
+ const { editorName = "StandaloneEditor" } = this.props;
86
+ e.stopPropagation();
87
+ if (window.__veDragging || window.__veScrolling) return;
88
+ hoveredAnnotationClear(true, { editorName });
89
+ };
90
+
91
+ render() {
92
+ const {
93
+ id,
94
+ editorName = "StandaloneEditor",
95
+ className,
96
+ passHoveredId,
97
+ noRedux, // eslint-disable-line no-unused-vars
98
+ ...restProps
99
+ } = this.props;
100
+
101
+ const hoveredIdFromContext = this.context?.hoveredId;
102
+ const hoveredId =
103
+ hoveredAnnEasyStore.hoveredIds[editorName] ||
104
+ hoveredIdFromContext ||
105
+ "";
106
+ const isIdHashmap = typeof id === "object";
107
+ const hovered = !!(isIdHashmap ? id[hoveredId] : hoveredId === id);
108
+
109
+ const newClassName = classnames(className, "hoverHelper", {
110
+ veAnnotationHovered: hovered
111
+ });
112
+
113
+ const passedProps = {
114
+ ...restProps,
115
+ id,
116
+ editorName,
117
+ hovered,
118
+ className: newClassName,
119
+ onMouseOver: this.handleMouseOver,
120
+ onMouseLeave: this.handleMouseLeave
121
+ };
122
+
123
+ if (hovered && passHoveredId) {
124
+ passedProps.hoveredId = hoveredId;
125
+ }
126
+
127
+ return <WrappedComponent {...passedProps} />;
128
+ }
111
129
  }
112
- })
113
- );
130
+ );
131
+
132
+ HoverComponent.displayName = `withHover(${
133
+ WrappedComponent.displayName || WrappedComponent.name || "Component"
134
+ })`;
135
+
136
+ return HoverComponent;
137
+ }
@@ -11,7 +11,6 @@ import * as digestTool from "./digestTool";
11
11
  import * as findTool from "./findTool";
12
12
  import * as toolBar from "./toolBar";
13
13
  import * as frameTranslations from "./frameTranslations";
14
- import * as hoveredAnnotation from "./hoveredAnnotation";
15
14
  import * as minimumOrfSize from "./minimumOrfSize";
16
15
  import * as alignments from "./alignments";
17
16
  import * as panelsShown from "./panelsShown";
@@ -51,7 +50,6 @@ const subReducers = {
51
50
  toolBar,
52
51
  findTool,
53
52
  frameTranslations,
54
- hoveredAnnotation,
55
53
  minimumOrfSize,
56
54
  panelsShown,
57
55
  propertiesTool,
@@ -1,4 +0,0 @@
1
- export const hoveredAnnotationUpdate: import('redux-act').ComplexActionCreator1<any, any, any>;
2
- export const hoveredAnnotationClear: import('redux-act').ComplexActionCreator1<any, any, any>;
3
- declare const _default: import('redux-act').Reducer<string, import('../../../../node_modules/redux').AnyAction>;
4
- export default _default;
@@ -1,24 +0,0 @@
1
- //./caretPosition.js
2
- import { createReducer } from "redux-act";
3
- import createAction from "./utils/createMetaAction";
4
-
5
- // ------------------------------------
6
- // Actions
7
- // ------------------------------------
8
- export const hoveredAnnotationUpdate = createAction("HOVEREDANNOTATIONUPDATE");
9
- export const hoveredAnnotationClear = createAction("HOVEREDANNOTATIONCLEAR");
10
-
11
- // ------------------------------------
12
- // Reducer
13
- // ------------------------------------
14
- export default createReducer(
15
- {
16
- [hoveredAnnotationUpdate]: (state, payload) => {
17
- return payload || null;
18
- },
19
- [hoveredAnnotationClear]: () => {
20
- return "";
21
- }
22
- },
23
- ""
24
- );