@jbrowse/plugin-lollipop 3.7.0 → 4.0.1

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.
Files changed (44) hide show
  1. package/esm/LinearLollipopDisplay/configSchema.d.ts +4 -4
  2. package/esm/LinearLollipopDisplay/index.js +2 -2
  3. package/esm/LinearLollipopDisplay/model.d.ts +953 -91
  4. package/esm/LinearLollipopDisplay/model.js +1 -2
  5. package/esm/LollipopRenderer/Layout.d.ts +8 -32
  6. package/esm/LollipopRenderer/Layout.js +4 -43
  7. package/esm/LollipopRenderer/LollipopRenderer.d.ts +2 -7
  8. package/esm/LollipopRenderer/LollipopRenderer.js +2 -10
  9. package/esm/LollipopRenderer/components/Lollipop.d.ts +17 -1
  10. package/esm/LollipopRenderer/components/Lollipop.js +27 -75
  11. package/esm/LollipopRenderer/components/LollipopRendering.js +29 -33
  12. package/esm/LollipopRenderer/components/Stick.d.ts +2 -7
  13. package/esm/LollipopRenderer/configSchema.d.ts +2 -2
  14. package/esm/LollipopRenderer/index.js +4 -4
  15. package/esm/index.js +3 -6
  16. package/package.json +23 -29
  17. package/dist/LinearLollipopDisplay/configSchema.d.ts +0 -31
  18. package/dist/LinearLollipopDisplay/configSchema.js +0 -13
  19. package/dist/LinearLollipopDisplay/index.d.ts +0 -2
  20. package/dist/LinearLollipopDisplay/index.js +0 -20
  21. package/dist/LinearLollipopDisplay/model.d.ts +0 -314
  22. package/dist/LinearLollipopDisplay/model.js +0 -34
  23. package/dist/LollipopRenderer/FloatingLayoutSession.d.ts +0 -6
  24. package/dist/LollipopRenderer/FloatingLayoutSession.js +0 -17
  25. package/dist/LollipopRenderer/Layout.d.ts +0 -54
  26. package/dist/LollipopRenderer/Layout.js +0 -113
  27. package/dist/LollipopRenderer/LollipopRenderer.d.ts +0 -8
  28. package/dist/LollipopRenderer/LollipopRenderer.js +0 -17
  29. package/dist/LollipopRenderer/components/Lollipop.d.ts +0 -2
  30. package/dist/LollipopRenderer/components/Lollipop.js +0 -87
  31. package/dist/LollipopRenderer/components/LollipopRendering.d.ts +0 -2
  32. package/dist/LollipopRenderer/components/LollipopRendering.js +0 -81
  33. package/dist/LollipopRenderer/components/ScoreText.d.ts +0 -14
  34. package/dist/LollipopRenderer/components/ScoreText.js +0 -20
  35. package/dist/LollipopRenderer/components/Stick.d.ts +0 -14
  36. package/dist/LollipopRenderer/components/Stick.js +0 -9
  37. package/dist/LollipopRenderer/configSchema.d.ts +0 -56
  38. package/dist/LollipopRenderer/configSchema.js +0 -58
  39. package/dist/LollipopRenderer/index.d.ts +0 -2
  40. package/dist/LollipopRenderer/index.js +0 -17
  41. package/dist/index.d.ts +0 -6
  42. package/dist/index.js +0 -19
  43. package/esm/LollipopRenderer/FloatingLayoutSession.d.ts +0 -6
  44. package/esm/LollipopRenderer/FloatingLayoutSession.js +0 -13
@@ -1,314 +0,0 @@
1
- import type { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
2
- export declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): import("mobx-state-tree").IModelType<{
3
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
4
- type: import("mobx-state-tree").ISimpleType<string>;
5
- rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
6
- } & {
7
- heightPreConfig: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
8
- } & {
9
- userBpPerPxLimit: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
10
- userByteSizeLimit: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
11
- } & {
12
- blockState: import("mobx-state-tree").IMapType<import("mobx-state-tree").IModelType<{
13
- key: import("mobx-state-tree").ISimpleType<string>;
14
- region: import("mobx-state-tree").IType<import("@jbrowse/core/util").Region, import("@jbrowse/core/util").Region, import("@jbrowse/core/util").Region>;
15
- reloadFlag: import("mobx-state-tree").IType<number | undefined, number, number>;
16
- isLeftEndOfDisplayedRegion: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
17
- isRightEndOfDisplayedRegion: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
18
- }, {
19
- stopToken: string | undefined;
20
- filled: boolean;
21
- reactElement: React.ReactElement | undefined;
22
- features: Map<string, import("@jbrowse/core/util").Feature> | undefined;
23
- layout: any;
24
- status: string;
25
- error: unknown;
26
- message: string | undefined;
27
- maxHeightReached: boolean;
28
- ReactComponent: ({ model, }: {
29
- model: {
30
- error?: unknown;
31
- reload: () => void;
32
- message: React.ReactNode;
33
- filled?: boolean;
34
- status?: string;
35
- reactElement?: React.ReactElement;
36
- };
37
- }) => import("react/jsx-runtime").JSX.Element | undefined;
38
- renderProps: any;
39
- } & {
40
- doReload(): void;
41
- afterAttach(): void;
42
- setStatus(message: string): void;
43
- setLoading(newStopToken: string): void;
44
- setMessage(messageText: string): void;
45
- setRendered(props: import("@jbrowse/plugin-linear-genome-view/src/BaseLinearDisplay/models/serverSideRenderedBlock").RenderedProps | undefined): void;
46
- setError(error: unknown): void;
47
- reload(): void;
48
- beforeDestroy(): void;
49
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
50
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
51
- maxFeatureScreenDensity: {
52
- type: string;
53
- description: string;
54
- defaultValue: number;
55
- };
56
- fetchSizeLimit: {
57
- type: string;
58
- defaultValue: number;
59
- description: string;
60
- };
61
- height: {
62
- type: string;
63
- defaultValue: number;
64
- description: string;
65
- };
66
- mouseover: {
67
- type: string;
68
- description: string;
69
- defaultValue: string;
70
- contextVariable: string[];
71
- };
72
- jexlFilters: {
73
- type: string;
74
- description: string;
75
- defaultValue: never[];
76
- };
77
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
78
- } & {
79
- type: import("mobx-state-tree").ISimpleType<"LinearLollipopDisplay">;
80
- configuration: AnyConfigurationSchemaType;
81
- }, {
82
- rendererTypeName: string;
83
- error: unknown;
84
- message: string | undefined;
85
- } & {
86
- readonly RenderingComponent: React.FC<{
87
- model: {
88
- id: string;
89
- type: string;
90
- rpcDriverName: string | undefined;
91
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
92
- rendererTypeName: string;
93
- error: unknown;
94
- message: string | undefined;
95
- } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
96
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
97
- type: import("mobx-state-tree").ISimpleType<string>;
98
- rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
99
- }, {
100
- rendererTypeName: string;
101
- error: unknown;
102
- message: string | undefined;
103
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
104
- onHorizontalScroll?: () => void;
105
- blockState?: Record<string, any>;
106
- }>;
107
- readonly DisplayBlurb: React.FC<{
108
- model: {
109
- id: string;
110
- type: string;
111
- rpcDriverName: string | undefined;
112
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
113
- rendererTypeName: string;
114
- error: unknown;
115
- message: string | undefined;
116
- } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
117
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
118
- type: import("mobx-state-tree").ISimpleType<string>;
119
- rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
120
- }, {
121
- rendererTypeName: string;
122
- error: unknown;
123
- message: string | undefined;
124
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
125
- }> | null;
126
- readonly adapterConfig: any;
127
- readonly parentTrack: any;
128
- renderProps(): any;
129
- readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
130
- readonly DisplayMessageComponent: undefined | React.FC<any>;
131
- trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
132
- readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
133
- regionCannotBeRendered(): null;
134
- } & {
135
- setMessage(arg?: string): void;
136
- setError(error?: unknown): void;
137
- setRpcDriverName(rpcDriverName: string): void;
138
- reload(): void;
139
- } & {
140
- scrollTop: number;
141
- } & {
142
- readonly height: number;
143
- } & {
144
- setScrollTop(scrollTop: number): void;
145
- setHeight(displayHeight: number): number;
146
- resizeHeight(distance: number): number;
147
- } & {
148
- featureDensityStatsP: undefined | Promise<import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats>;
149
- featureDensityStats: undefined | import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats;
150
- currStatsBpPerPx: number;
151
- } & {
152
- readonly currentBytesRequested: number;
153
- readonly currentFeatureScreenDensity: number;
154
- readonly maxFeatureScreenDensity: any;
155
- readonly featureDensityStatsReady: boolean;
156
- readonly maxAllowableBytes: number;
157
- } & {
158
- afterAttach(): void;
159
- } & {
160
- setCurrStatsBpPerPx(n: number): void;
161
- setFeatureDensityStatsLimit(stats?: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats): void;
162
- getFeatureDensityStats(): Promise<import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats>;
163
- setFeatureDensityStatsP(arg: any): void;
164
- setFeatureDensityStats(featureDensityStats?: import("@jbrowse/core/data_adapters/BaseAdapter").FeatureDensityStats): void;
165
- clearFeatureDensityStats(): void;
166
- } & {
167
- readonly regionTooLarge: boolean;
168
- readonly regionTooLargeReason: string;
169
- } & {
170
- readonly statsReadyAndRegionNotTooLarge: boolean;
171
- regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
172
- regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
173
- } & {
174
- mouseoverExtraInformation: string | undefined;
175
- featureIdUnderMouse: undefined | string;
176
- contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
177
- } & {
178
- readonly DisplayMessageComponent: undefined | React.FC<any>;
179
- readonly blockType: "staticBlocks" | "dynamicBlocks";
180
- readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
181
- } & {
182
- readonly renderDelay: number;
183
- readonly TooltipComponent: import("@jbrowse/core/util").AnyReactComponentType;
184
- readonly selectedFeatureId: string | undefined;
185
- copyInfoToClipboard(feature: import("@jbrowse/core/util").Feature): void;
186
- } & {
187
- readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
188
- readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
189
- readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
190
- label?: string;
191
- description?: string;
192
- refName: string;
193
- }]>;
194
- getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
195
- getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
196
- label?: string;
197
- description?: string;
198
- refName: string;
199
- }]) | undefined;
200
- searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
201
- label?: string;
202
- description?: string;
203
- refName: string;
204
- }]) | undefined;
205
- } & {
206
- addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
207
- deleteBlock(key: string): void;
208
- selectFeature(feature: import("@jbrowse/core/util").Feature): void;
209
- navToFeature(feature: import("@jbrowse/core/util").Feature): void;
210
- clearFeatureSelection(): void;
211
- setFeatureIdUnderMouse(feature?: string): void;
212
- setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature): void;
213
- setMouseoverExtraInformation(extra?: string): void;
214
- } & {
215
- reload(): Promise<void>;
216
- } & {
217
- trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
218
- contextMenuItems(): import("@jbrowse/core/ui").MenuItem[];
219
- renderProps(): any;
220
- } & {
221
- renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react/jsx-runtime").JSX.Element>;
222
- afterAttach(): void;
223
- } & {
224
- readonly blockType: string;
225
- readonly renderDelay: number;
226
- renderProps(): any;
227
- readonly rendererTypeName: any;
228
- }, {
229
- type: string;
230
- } & Partial<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
231
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
232
- type: import("mobx-state-tree").ISimpleType<string>;
233
- rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
234
- } & {
235
- heightPreConfig: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
236
- } & {
237
- userBpPerPxLimit: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
238
- userByteSizeLimit: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
239
- } & {
240
- blockState: import("mobx-state-tree").IMapType<import("mobx-state-tree").IModelType<{
241
- key: import("mobx-state-tree").ISimpleType<string>;
242
- region: import("mobx-state-tree").IType<import("@jbrowse/core/util").Region, import("@jbrowse/core/util").Region, import("@jbrowse/core/util").Region>;
243
- reloadFlag: import("mobx-state-tree").IType<number | undefined, number, number>;
244
- isLeftEndOfDisplayedRegion: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
245
- isRightEndOfDisplayedRegion: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
246
- }, {
247
- stopToken: string | undefined;
248
- filled: boolean;
249
- reactElement: React.ReactElement | undefined;
250
- features: Map<string, import("@jbrowse/core/util").Feature> | undefined;
251
- layout: any;
252
- status: string;
253
- error: unknown;
254
- message: string | undefined;
255
- maxHeightReached: boolean;
256
- ReactComponent: ({ model, }: {
257
- model: {
258
- error?: unknown;
259
- reload: () => void;
260
- message: React.ReactNode;
261
- filled?: boolean;
262
- status?: string;
263
- reactElement?: React.ReactElement;
264
- };
265
- }) => import("react/jsx-runtime").JSX.Element | undefined;
266
- renderProps: any;
267
- } & {
268
- doReload(): void;
269
- afterAttach(): void;
270
- setStatus(message: string): void;
271
- setLoading(newStopToken: string): void;
272
- setMessage(messageText: string): void;
273
- setRendered(props: import("@jbrowse/plugin-linear-genome-view/src/BaseLinearDisplay/models/serverSideRenderedBlock").RenderedProps | undefined): void;
274
- setError(error: unknown): void;
275
- reload(): void;
276
- beforeDestroy(): void;
277
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
278
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
279
- maxFeatureScreenDensity: {
280
- type: string;
281
- description: string;
282
- defaultValue: number;
283
- };
284
- fetchSizeLimit: {
285
- type: string;
286
- defaultValue: number;
287
- description: string;
288
- };
289
- height: {
290
- type: string;
291
- defaultValue: number;
292
- description: string;
293
- };
294
- mouseover: {
295
- type: string;
296
- description: string;
297
- defaultValue: string;
298
- contextVariable: string[];
299
- };
300
- jexlFilters: {
301
- type: string;
302
- description: string;
303
- defaultValue: never[];
304
- };
305
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
306
- }>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
307
- type: string;
308
- id: string;
309
- configuration: import("mobx-state-tree").ModelSnapshotType<Record<string, any>>;
310
- rpcDriverName: string | undefined;
311
- heightPreConfig: number | undefined;
312
- userBpPerPxLimit: number | undefined;
313
- userByteSizeLimit: number | undefined;
314
- } & import("mobx-state-tree")._NotCustomized>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stateModelFactory = stateModelFactory;
4
- const configuration_1 = require("@jbrowse/core/configuration");
5
- const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
6
- const mobx_state_tree_1 = require("mobx-state-tree");
7
- function stateModelFactory(configSchema) {
8
- return mobx_state_tree_1.types
9
- .compose('LinearLollipopDisplay', plugin_linear_genome_view_1.BaseLinearDisplay, mobx_state_tree_1.types.model({
10
- type: mobx_state_tree_1.types.literal('LinearLollipopDisplay'),
11
- configuration: (0, configuration_1.ConfigurationReference)(configSchema),
12
- }))
13
- .views(self => {
14
- const { renderProps: superRenderProps } = self;
15
- return {
16
- get blockType() {
17
- return 'dynamicBlocks';
18
- },
19
- get renderDelay() {
20
- return 500;
21
- },
22
- renderProps() {
23
- return {
24
- ...superRenderProps(),
25
- rpcDriverName: self.rpcDriverName,
26
- config: self.configuration.renderer,
27
- };
28
- },
29
- get rendererTypeName() {
30
- return self.configuration.renderer.type;
31
- },
32
- };
33
- });
34
- }
@@ -1,6 +0,0 @@
1
- import { LayoutSession } from '@jbrowse/core/pluggableElementTypes/renderers/LayoutSession';
2
- import { MultiLayout } from '@jbrowse/core/util/layouts';
3
- export declare class FloatingLayoutSession extends LayoutSession {
4
- makeLayout(): MultiLayout<import("@jbrowse/core/util/layouts").BaseLayout<unknown>, unknown>;
5
- layoutIsValid(): boolean;
6
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FloatingLayoutSession = void 0;
4
- const LayoutSession_1 = require("@jbrowse/core/pluggableElementTypes/renderers/LayoutSession");
5
- const layouts_1 = require("@jbrowse/core/util/layouts");
6
- const Layout_1 = require("./Layout");
7
- class FloatingLayoutSession extends LayoutSession_1.LayoutSession {
8
- makeLayout() {
9
- const { end, start } = this.props.regions[0];
10
- const widthPx = (end - start) / this.props.bpPerPx;
11
- return new layouts_1.MultiLayout(Layout_1.FloatingLayout, { width: widthPx });
12
- }
13
- layoutIsValid() {
14
- return false;
15
- }
16
- }
17
- exports.FloatingLayoutSession = FloatingLayoutSession;
@@ -1,54 +0,0 @@
1
- import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
- interface LayoutItem {
3
- uniqueId: string;
4
- anchorLocation: number;
5
- width: number;
6
- height: number;
7
- data: {
8
- score: number;
9
- };
10
- }
11
- type LayoutEntry = LayoutItem & {
12
- x: number;
13
- y: number;
14
- };
15
- type LayoutMap = Map<string, LayoutEntry>;
16
- export declare class FloatingLayout {
17
- width: number;
18
- totalHeight: number;
19
- rectangles: Map<any, any>;
20
- constructor({ width }: {
21
- width: number;
22
- });
23
- discardRange(): void;
24
- items: LayoutItem[];
25
- layout: LayoutMap;
26
- add(uniqueId: string, anchorLocation: number, width: number, height: number, data: {
27
- score: number;
28
- }): void;
29
- getLayout(configuration?: AnyConfigurationModel): LayoutMap;
30
- getTotalHeight(): number;
31
- serializeRegion(): {
32
- pairs: [string, LayoutEntry][];
33
- totalHeight: number;
34
- };
35
- toJSON(): {
36
- pairs: [string, LayoutEntry][];
37
- totalHeight: number;
38
- };
39
- static fromJSON(): void;
40
- }
41
- export declare class PrecomputedFloatingLayout {
42
- layout: LayoutMap;
43
- totalHeight: number;
44
- constructor({ pairs, totalHeight, }: {
45
- pairs: [string, LayoutEntry][];
46
- totalHeight: number;
47
- });
48
- add(uniqueId: string): void;
49
- getLayout(): LayoutMap;
50
- getTotalHeight(): number;
51
- discardRange(): void;
52
- static fromJSON(json: ConstructorParameters<typeof PrecomputedFloatingLayout>[0]): PrecomputedFloatingLayout;
53
- }
54
- export {};
@@ -1,113 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PrecomputedFloatingLayout = exports.FloatingLayout = void 0;
4
- const configuration_1 = require("@jbrowse/core/configuration");
5
- const range_1 = require("@jbrowse/core/util/range");
6
- class FloatingLayout {
7
- constructor({ width }) {
8
- this.totalHeight = 0;
9
- this.rectangles = new Map();
10
- this.items = [];
11
- this.layout = new Map();
12
- if (!width) {
13
- throw new Error('width required to make a new FloatingLayout');
14
- }
15
- this.width = width;
16
- }
17
- discardRange() {
18
- this.items = [];
19
- this.layout = new Map();
20
- this.totalHeight = 0;
21
- }
22
- add(uniqueId, anchorLocation, width, height, data) {
23
- this.items.push({
24
- uniqueId,
25
- anchorLocation,
26
- width,
27
- height,
28
- data,
29
- });
30
- }
31
- getLayout(configuration) {
32
- if (!configuration) {
33
- return this.layout;
34
- }
35
- const minY = (0, configuration_1.readConfObject)(configuration, 'minStickLength');
36
- const sorted = this.items.sort((a, b) => a.data.score - b.data.score);
37
- let maxBottom = 0;
38
- const layoutEntries = new Array(sorted.length);
39
- for (const [i, element] of sorted.entries()) {
40
- const currentItem = element;
41
- const { anchorLocation, width, height } = currentItem;
42
- const start = anchorLocation - width / 2;
43
- const end = start + width;
44
- let top = minY;
45
- let bottom = top + height;
46
- for (let j = 0; j < i; j += 1) {
47
- const [, previouslyLaidOutItem] = layoutEntries[j];
48
- const { x: prevStart, y: prevTop, width: prevWidth, height: prevHeight, } = previouslyLaidOutItem;
49
- const prevEnd = prevStart + prevWidth;
50
- const prevBottom = prevTop + prevHeight;
51
- if ((0, range_1.doesIntersect2)(prevStart, prevEnd, start, end) &&
52
- (0, range_1.doesIntersect2)(prevTop, prevBottom, top, bottom)) {
53
- top = prevBottom;
54
- bottom = top + height;
55
- j = -1;
56
- }
57
- }
58
- layoutEntries[i] = [
59
- currentItem.uniqueId,
60
- {
61
- ...currentItem,
62
- x: start,
63
- y: top,
64
- },
65
- ];
66
- if (bottom > maxBottom) {
67
- maxBottom = bottom;
68
- }
69
- }
70
- this.totalHeight = maxBottom;
71
- this.layout = new Map(layoutEntries);
72
- return this.layout;
73
- }
74
- getTotalHeight() {
75
- return this.totalHeight;
76
- }
77
- serializeRegion() {
78
- return this.toJSON();
79
- }
80
- toJSON() {
81
- return {
82
- pairs: [...this.getLayout()],
83
- totalHeight: this.getTotalHeight(),
84
- };
85
- }
86
- static fromJSON() {
87
- throw new Error('not supported');
88
- }
89
- }
90
- exports.FloatingLayout = FloatingLayout;
91
- class PrecomputedFloatingLayout {
92
- constructor({ pairs, totalHeight, }) {
93
- this.layout = new Map(pairs);
94
- this.totalHeight = totalHeight;
95
- }
96
- add(uniqueId) {
97
- if (!this.layout.has(uniqueId)) {
98
- throw new Error(`layout error, precomputed layout is missing ${uniqueId}`);
99
- }
100
- }
101
- getLayout() {
102
- return this.layout;
103
- }
104
- getTotalHeight() {
105
- return this.totalHeight;
106
- }
107
- discardRange() {
108
- }
109
- static fromJSON(json) {
110
- return new PrecomputedFloatingLayout(json);
111
- }
112
- }
113
- exports.PrecomputedFloatingLayout = PrecomputedFloatingLayout;
@@ -1,8 +0,0 @@
1
- import BoxRendererType from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType';
2
- import { FloatingLayoutSession } from './FloatingLayoutSession';
3
- import { PrecomputedFloatingLayout } from './Layout';
4
- import type { LayoutSessionProps } from '@jbrowse/core/pluggableElementTypes/renderers/LayoutSession';
5
- export default class LollipopRenderer extends BoxRendererType {
6
- createLayoutSession(props: LayoutSessionProps): FloatingLayoutSession;
7
- deserializeLayoutInClient(json: any): PrecomputedFloatingLayout;
8
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const BoxRendererType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType"));
7
- const FloatingLayoutSession_1 = require("./FloatingLayoutSession");
8
- const Layout_1 = require("./Layout");
9
- class LollipopRenderer extends BoxRendererType_1.default {
10
- createLayoutSession(props) {
11
- return new FloatingLayoutSession_1.FloatingLayoutSession(props);
12
- }
13
- deserializeLayoutInClient(json) {
14
- return new Layout_1.PrecomputedFloatingLayout(json);
15
- }
16
- }
17
- exports.default = LollipopRenderer;
@@ -1,2 +0,0 @@
1
- declare const Lollipop: (props: Record<string, any>) => import("react/jsx-runtime").JSX.Element;
2
- export default Lollipop;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const configuration_1 = require("@jbrowse/core/configuration");
8
- const mobx_react_1 = require("mobx-react");
9
- const ScoreText_1 = __importDefault(require("./ScoreText"));
10
- const Lollipop = (0, mobx_react_1.observer)(function Lollipop(props) {
11
- const { feature, config, layoutRecord, selectedFeatureId } = props;
12
- const { anchorLocation, y, data: { radiusPx }, } = layoutRecord;
13
- const styleOuter = {
14
- fill: (0, configuration_1.readConfObject)(config, 'strokeColor', { feature }),
15
- };
16
- if (String(selectedFeatureId) === String(feature.id())) {
17
- styleOuter.fill = 'red';
18
- }
19
- const styleInner = {
20
- fill: (0, configuration_1.readConfObject)(config, 'innerColor', { feature }),
21
- };
22
- const strokeWidth = (0, configuration_1.readConfObject)(config, 'strokeWidth', { feature });
23
- return ((0, jsx_runtime_1.jsxs)("g", { "data-testid": feature.id(), children: [(0, jsx_runtime_1.jsx)("title", { children: (0, configuration_1.readConfObject)(config, 'caption', { feature }) }), (0, jsx_runtime_1.jsx)("circle", { cx: anchorLocation, cy: y + radiusPx, r: radiusPx, style: styleOuter, onMouseDown: (event) => {
24
- const { onFeatureMouseDown: handler, feature } = props;
25
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
26
- }, onMouseEnter: (event) => {
27
- const { onFeatureMouseEnter: handler, feature } = props;
28
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
29
- }, onMouseOut: (event) => {
30
- const { onFeatureMouseOut: handler, feature } = props;
31
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
32
- }, onMouseOver: (event) => {
33
- const { onFeatureMouseOver: handler, feature } = props;
34
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
35
- }, onMouseUp: (event) => {
36
- const { onFeatureMouseUp: handler, feature } = props;
37
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
38
- }, onMouseLeave: (event) => {
39
- const { onFeatureMouseLeave: handler, feature } = props;
40
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
41
- }, onMouseMove: (event) => {
42
- const { onFeatureMouseMove: handler, feature } = props;
43
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
44
- }, onClick: (event) => {
45
- const { onFeatureClick: handler, feature } = props;
46
- event.stopPropagation();
47
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
48
- }, onFocus: (event) => {
49
- const { onFeatureMouseOver: handler, feature } = props;
50
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
51
- }, onBlur: (event) => {
52
- const { onFeatureMouseOut: handler, feature } = props;
53
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
54
- } }), radiusPx - strokeWidth <= 2 ? null : ((0, jsx_runtime_1.jsx)("circle", { cx: anchorLocation, cy: y + radiusPx, r: radiusPx - strokeWidth, style: styleInner, onMouseDown: (event) => {
55
- const { onFeatureMouseDown: handler, feature } = props;
56
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
57
- }, onMouseEnter: (event) => {
58
- const { onFeatureMouseEnter: handler, feature } = props;
59
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
60
- }, onMouseOut: (event) => {
61
- const { onFeatureMouseOut: handler, feature } = props;
62
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
63
- }, onMouseOver: (event) => {
64
- const { onFeatureMouseOver: handler, feature } = props;
65
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
66
- }, onMouseUp: (event) => {
67
- const { onFeatureMouseUp: handler, feature } = props;
68
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
69
- }, onMouseLeave: (event) => {
70
- const { onFeatureMouseLeave: handler, feature } = props;
71
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
72
- }, onMouseMove: (event) => {
73
- const { onFeatureMouseMove: handler, feature } = props;
74
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
75
- }, onClick: (event) => {
76
- const { onFeatureClick: handler, feature } = props;
77
- event.stopPropagation();
78
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
79
- }, onFocus: (event) => {
80
- const { onFeatureMouseOver: handler, feature } = props;
81
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
82
- }, onBlur: (event) => {
83
- const { onFeatureMouseOut: handler, feature } = props;
84
- return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
85
- } })), (0, jsx_runtime_1.jsx)(ScoreText_1.default, { feature: feature, config: config, layoutRecord: layoutRecord })] }));
86
- });
87
- exports.default = Lollipop;
@@ -1,2 +0,0 @@
1
- declare const LollipopRendering: (props: Record<string, any>) => import("react/jsx-runtime").JSX.Element;
2
- export default LollipopRendering;