@teselagen/ove 0.8.26 → 0.8.28

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",
@@ -111927,9 +111927,9 @@ function AASliver(props) {
111927
111927
  "text",
111928
111928
  {
111929
111929
  fontSize: 25,
111930
- stroke: "black",
111930
+ className: "aminoAcidNumber",
111931
111931
  strokeWidth: 2,
111932
- transform: `scale(${3 / width * 10},3) translate(${(forward ? 45 : 55) * width / 10},51)`,
111932
+ transform: `scale(${3 / width * 10},${37.5 / height}) translate(${(forward ? 45 : 55) * width / 10},${4.4 * height - 4})`,
111933
111933
  x: "0",
111934
111934
  y: "4",
111935
111935
  style: { textAnchor: "middle" }
@@ -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.28";
116990
116990
  const packageJson = {
116991
116991
  version
116992
116992
  };