@teselagen/ove 0.8.25 → 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.
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.25";
116971
+ const version = "0.8.27";
116972
116972
  const packageJson = {
116973
116973
  version
116974
116974
  };