@jbrowse/core 1.7.8 → 1.7.11
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/BaseFeatureWidget/BaseFeatureDetail.d.ts +3 -6
- package/BaseFeatureWidget/BaseFeatureDetail.js +158 -103
- package/BaseFeatureWidget/index.d.ts +23 -2
- package/BaseFeatureWidget/index.js +98 -3
- package/assemblyManager/assembly.d.ts +6 -7
- package/assemblyManager/assembly.js +26 -16
- package/assemblyManager/assemblyManager.d.ts +71 -15
- package/assemblyManager/assemblyManager.js +30 -36
- package/package.json +6 -3
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +2 -2
- package/pluggableElementTypes/models/baseTrackConfig.js +20 -13
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +6 -14
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +6 -0
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +44 -2
- package/pluggableElementTypes/renderers/declare.d.js +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.d.ts +1 -1
- package/ui/AboutDialog.js +24 -7
- package/ui/CascadingMenu.d.ts +9 -0
- package/ui/CascadingMenu.js +211 -0
- package/ui/Menu.d.ts +10 -0
- package/ui/Menu.js +9 -14
- package/ui/SanitizedHTML.js +26 -4
- package/ui/SnackbarModel.d.ts +2 -2
- package/ui/index.d.ts +1 -0
- package/ui/index.js +9 -0
- package/util/declare.d.js +1 -0
- package/util/index.d.ts +3 -1
- package/util/index.js +21 -1
- package/util/jexl.js +42 -43
- package/util/offscreenCanvasPonyfill.d.ts +8 -1
- package/util/offscreenCanvasPonyfill.js +138 -12
- package/util/offscreenCanvasUtils.d.ts +19 -1
- package/util/offscreenCanvasUtils.js +146 -12
- package/util/types/index.d.ts +12 -2
- package/util/types/index.js +6 -0
- package/util/types/mst.d.ts +9 -9
- package/util/offscreenCanvas/Canvas2DContextShim/Canvas2DContextShim.test.js +0 -15
- package/util/offscreenCanvas/Canvas2DContextShim/context.d.ts +0 -56
- package/util/offscreenCanvas/Canvas2DContextShim/context.js +0 -356
- package/util/offscreenCanvas/Canvas2DContextShim/index.d.ts +0 -2
- package/util/offscreenCanvas/Canvas2DContextShim/index.js +0 -13
- package/util/offscreenCanvas/Canvas2DContextShim/svg.d.ts +0 -3
- package/util/offscreenCanvas/Canvas2DContextShim/svg.js +0 -210
- package/util/offscreenCanvas/Canvas2DContextShim/types.d.ts +0 -50
- package/util/offscreenCanvas/Canvas2DContextShim/types.js +0 -59
- package/util/offscreenCanvas/Canvas2DContextShim/util.d.ts +0 -12
- package/util/offscreenCanvas/Canvas2DContextShim/util.js +0 -91
- package/util/offscreenCanvas/CanvasShim.d.ts +0 -11
- package/util/offscreenCanvas/CanvasShim.js +0 -54
- package/util/offscreenCanvas/index.d.ts +0 -14
- package/util/offscreenCanvas/index.js +0 -170
- package/util/offscreenCanvas/ponyfill.d.ts +0 -6
- package/util/offscreenCanvas/ponyfill.js +0 -145
- package/util/offscreenCanvas/types.d.ts +0 -16
- package/util/offscreenCanvas/types.js +0 -14
package/util/jexl.js
CHANGED
|
@@ -25,15 +25,14 @@ _default() {
|
|
|
25
25
|
j.addFunction('id', function (feature) {
|
|
26
26
|
return feature.id();
|
|
27
27
|
}); // let user cast a jexl type into a javascript type
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
28
|
|
|
30
29
|
j.addFunction('cast', function (arg) {
|
|
31
30
|
return arg;
|
|
32
31
|
}); // logging
|
|
33
32
|
|
|
34
33
|
j.addFunction('log', function (thing) {
|
|
35
|
-
// eslint-disable-
|
|
36
|
-
|
|
34
|
+
console.log(thing); // eslint-disable-line no-console
|
|
35
|
+
|
|
37
36
|
return thing;
|
|
38
37
|
}); // math
|
|
39
38
|
// addfunction added in jexl 2.3 but types/jexl still on 2.2
|
|
@@ -49,66 +48,66 @@ _default() {
|
|
|
49
48
|
j.addFunction('parseInt', Number.parseInt);
|
|
50
49
|
j.addFunction('parseFloat', Number.parseFloat); // string
|
|
51
50
|
|
|
52
|
-
j.addFunction('split', function (
|
|
53
|
-
return
|
|
51
|
+
j.addFunction('split', function (s, char) {
|
|
52
|
+
return s.split(char);
|
|
54
53
|
});
|
|
55
|
-
j.addFunction('charAt', function (
|
|
56
|
-
return
|
|
54
|
+
j.addFunction('charAt', function (s, index) {
|
|
55
|
+
return s.charAt(index);
|
|
57
56
|
});
|
|
58
|
-
j.addFunction('charCodeAt', function (
|
|
59
|
-
return
|
|
57
|
+
j.addFunction('charCodeAt', function (s, index) {
|
|
58
|
+
return s.charCodeAt(index);
|
|
60
59
|
});
|
|
61
|
-
j.addFunction('codePointAt', function (
|
|
62
|
-
return
|
|
60
|
+
j.addFunction('codePointAt', function (s, pos) {
|
|
61
|
+
return s.codePointAt(pos);
|
|
63
62
|
});
|
|
64
|
-
j.addFunction('startsWith', function (
|
|
65
|
-
return
|
|
63
|
+
j.addFunction('startsWith', function (s, search, len) {
|
|
64
|
+
return s.startsWith(search, len);
|
|
66
65
|
});
|
|
67
|
-
j.addFunction('endsWith', function (
|
|
68
|
-
return
|
|
66
|
+
j.addFunction('endsWith', function (s, search, len) {
|
|
67
|
+
return s.endsWith(search, len);
|
|
69
68
|
});
|
|
70
|
-
j.addFunction('padEnd', function (
|
|
71
|
-
return
|
|
69
|
+
j.addFunction('padEnd', function (s, len, pad) {
|
|
70
|
+
return s.padEnd(len, pad);
|
|
72
71
|
});
|
|
73
|
-
j.addFunction('padStart', function (
|
|
74
|
-
return
|
|
72
|
+
j.addFunction('padStart', function (s, len, fill) {
|
|
73
|
+
return s.padStart(len, fill);
|
|
75
74
|
});
|
|
76
|
-
j.addFunction('repeat', function (
|
|
77
|
-
return
|
|
75
|
+
j.addFunction('repeat', function (s, count) {
|
|
76
|
+
return s.repeat(count);
|
|
78
77
|
});
|
|
79
|
-
j.addFunction('replace', function (
|
|
80
|
-
return
|
|
78
|
+
j.addFunction('replace', function (s, match, sub) {
|
|
79
|
+
return s.replace(match, sub);
|
|
81
80
|
});
|
|
82
|
-
j.addFunction('replaceAll', function (
|
|
83
|
-
return
|
|
81
|
+
j.addFunction('replaceAll', function (s, match, sub) {
|
|
82
|
+
return s.replaceAll(match, sub);
|
|
84
83
|
});
|
|
85
|
-
j.addFunction('slice', function (
|
|
86
|
-
return
|
|
84
|
+
j.addFunction('slice', function (s, start, end) {
|
|
85
|
+
return s.slice(start, end);
|
|
87
86
|
});
|
|
88
|
-
j.addFunction('startsWith', function (
|
|
89
|
-
return
|
|
87
|
+
j.addFunction('startsWith', function (s, search, pos) {
|
|
88
|
+
return s.startsWith(search, pos);
|
|
90
89
|
});
|
|
91
|
-
j.addFunction('substring', function (
|
|
92
|
-
return
|
|
90
|
+
j.addFunction('substring', function (s, start, end) {
|
|
91
|
+
return s.substring(start, end);
|
|
93
92
|
});
|
|
94
|
-
j.addFunction('toLowerCase', function (
|
|
95
|
-
return
|
|
93
|
+
j.addFunction('toLowerCase', function (s) {
|
|
94
|
+
return s.toLowerCase();
|
|
96
95
|
});
|
|
97
|
-
j.addFunction('toUpperCase', function (
|
|
98
|
-
return
|
|
96
|
+
j.addFunction('toUpperCase', function (s) {
|
|
97
|
+
return s.toUpperCase();
|
|
99
98
|
});
|
|
100
|
-
j.addFunction('trim', function (
|
|
101
|
-
|
|
99
|
+
j.addFunction('trim', function (s) {
|
|
100
|
+
return s.trim();
|
|
102
101
|
});
|
|
103
|
-
j.addFunction('trimEnd', function (
|
|
104
|
-
return
|
|
102
|
+
j.addFunction('trimEnd', function (s) {
|
|
103
|
+
return s.trimEnd();
|
|
105
104
|
});
|
|
106
|
-
j.addFunction('trimStart', function (
|
|
107
|
-
return
|
|
105
|
+
j.addFunction('trimStart', function (s) {
|
|
106
|
+
return s.trimStart();
|
|
108
107
|
});
|
|
109
|
-
j.addFunction('getTag', function (feature,
|
|
108
|
+
j.addFunction('getTag', function (feature, s) {
|
|
110
109
|
var tags = feature.get('tags');
|
|
111
|
-
return tags ? tags[
|
|
110
|
+
return tags ? tags[s] : feature.get(s);
|
|
112
111
|
});
|
|
113
112
|
j.addBinaryOp('&', 15, function (a, b) {
|
|
114
113
|
return a & b;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
declare type AbstractCanvas = any;
|
|
2
|
+
declare type AbstractImageBitmap = any;
|
|
3
|
+
export declare let createCanvas: (width: number, height: number) => AbstractCanvas;
|
|
4
|
+
export declare let createImageBitmap: (canvas: AbstractCanvas) => Promise<AbstractImageBitmap>;
|
|
5
|
+
/** the JS class (constructor) for offscreen-generated image bitmap data */
|
|
6
|
+
export declare let ImageBitmapType: Function;
|
|
7
|
+
export declare function drawImageOntoCanvasContext(imageData: any, context: CanvasRenderingContext2D): void;
|
|
8
|
+
export {};
|
|
@@ -1,18 +1,144 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
8
|
+
exports.createImageBitmap = exports.createCanvas = exports.ImageBitmapType = void 0;
|
|
9
|
+
exports.drawImageOntoCanvasContext = drawImageOntoCanvasContext;
|
|
10
|
+
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
|
|
15
|
+
var _detectNode = _interopRequireDefault(require("detect-node"));
|
|
16
|
+
|
|
17
|
+
var _canvasSequencer = require("canvas-sequencer");
|
|
18
|
+
|
|
19
|
+
// This file is a ponyfill for the HTML5 OffscreenCanvas API.
|
|
20
|
+
var createCanvas;
|
|
21
|
+
exports.createCanvas = createCanvas;
|
|
22
|
+
var createImageBitmap;
|
|
23
|
+
/** the JS class (constructor) for offscreen-generated image bitmap data */
|
|
24
|
+
|
|
25
|
+
exports.createImageBitmap = createImageBitmap;
|
|
26
|
+
var ImageBitmapType;
|
|
27
|
+
exports.ImageBitmapType = ImageBitmapType;
|
|
28
|
+
|
|
29
|
+
function drawImageOntoCanvasContext( // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
imageData, context) {
|
|
31
|
+
if (imageData.serializedCommands) {
|
|
32
|
+
var seq = new _canvasSequencer.CanvasSequence(imageData.serializedCommands);
|
|
33
|
+
seq.execute(context);
|
|
34
|
+
} else {
|
|
35
|
+
context.drawImage(imageData, 0, 0);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var weHave = {
|
|
40
|
+
realOffscreenCanvas: typeof OffscreenCanvas === 'function',
|
|
41
|
+
node: _detectNode.default
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if (weHave.realOffscreenCanvas) {
|
|
45
|
+
exports.createCanvas = createCanvas = function createCanvas(width, height) {
|
|
46
|
+
return new OffscreenCanvas(width, height);
|
|
47
|
+
}; // eslint-disable-next-line no-restricted-globals
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
exports.createImageBitmap = createImageBitmap = window.createImageBitmap || self.createImageBitmap; // eslint-disable-next-line no-restricted-globals
|
|
51
|
+
|
|
52
|
+
exports.ImageBitmapType = ImageBitmapType = window.ImageBitmap || self.ImageBitmap;
|
|
53
|
+
} else if (weHave.node) {
|
|
54
|
+
// use node-canvas if we are running in node (i.e. automated tests)
|
|
55
|
+
exports.createCanvas = createCanvas = function createCanvas() {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
// eslint-disable-next-line no-undef
|
|
58
|
+
return nodeCreateCanvas.apply(void 0, arguments);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.createImageBitmap = createImageBitmap = /*#__PURE__*/function () {
|
|
62
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(canvas) {
|
|
63
|
+
var dataUri,
|
|
64
|
+
img,
|
|
65
|
+
_args = arguments;
|
|
66
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
67
|
+
while (1) {
|
|
68
|
+
switch (_context.prev = _context.next) {
|
|
69
|
+
case 0:
|
|
70
|
+
if (!(_args.length <= 1 ? 0 : _args.length - 1)) {
|
|
71
|
+
_context.next = 2;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
throw new Error('only one-argument uses of createImageBitmap are supported by the node offscreencanvas ponyfill');
|
|
76
|
+
|
|
77
|
+
case 2:
|
|
78
|
+
dataUri = canvas.toDataURL(); // @ts-ignore
|
|
79
|
+
// eslint-disable-next-line no-undef
|
|
80
|
+
|
|
81
|
+
img = new nodeImage();
|
|
82
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
83
|
+
img.onload = function () {
|
|
84
|
+
return resolve(img);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
img.onerror = reject;
|
|
88
|
+
img.src = dataUri;
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
case 5:
|
|
92
|
+
case "end":
|
|
93
|
+
return _context.stop();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, _callee);
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
return function createImageBitmap(_x) {
|
|
100
|
+
return _ref.apply(this, arguments);
|
|
101
|
+
};
|
|
102
|
+
}();
|
|
103
|
+
} else {
|
|
104
|
+
exports.createCanvas = createCanvas = function createCanvas(width, height) {
|
|
105
|
+
var context = new _canvasSequencer.CanvasSequence();
|
|
106
|
+
return {
|
|
107
|
+
width: width,
|
|
108
|
+
height: height,
|
|
109
|
+
getContext: function getContext() {
|
|
110
|
+
return context;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
exports.createImageBitmap = createImageBitmap = /*#__PURE__*/function () {
|
|
116
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(canvas) {
|
|
117
|
+
var ctx;
|
|
118
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
119
|
+
while (1) {
|
|
120
|
+
switch (_context2.prev = _context2.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
ctx = canvas.getContext('2d');
|
|
123
|
+
return _context2.abrupt("return", {
|
|
124
|
+
height: canvas.height,
|
|
125
|
+
width: canvas.width,
|
|
126
|
+
serializedCommands: ctx.toJSON(),
|
|
127
|
+
containsNoTransferables: true
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
case 2:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context2.stop();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, _callee2);
|
|
136
|
+
}));
|
|
137
|
+
|
|
138
|
+
return function createImageBitmap(_x2) {
|
|
139
|
+
return _ref2.apply(this, arguments);
|
|
140
|
+
};
|
|
141
|
+
}();
|
|
6
142
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.keys(_ponyfill).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] === _ponyfill[key]) return;
|
|
12
|
-
Object.defineProperty(exports, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _ponyfill[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
143
|
+
exports.ImageBitmapType = ImageBitmapType = String;
|
|
144
|
+
}
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function renderToAbstractCanvas(width: number, height: number, opts: {
|
|
3
|
+
exportSVG?: {
|
|
4
|
+
rasterizeLayers?: boolean;
|
|
5
|
+
};
|
|
6
|
+
highResolutionScaling: number;
|
|
7
|
+
}, cb: Function): Promise<{
|
|
8
|
+
canvasRecordedData: any;
|
|
9
|
+
reactElement?: undefined;
|
|
10
|
+
imageData?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
reactElement: JSX.Element;
|
|
13
|
+
canvasRecordedData?: undefined;
|
|
14
|
+
imageData?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
imageData: any;
|
|
17
|
+
canvasRecordedData?: undefined;
|
|
18
|
+
reactElement?: undefined;
|
|
19
|
+
}>;
|
|
@@ -1,18 +1,152 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
8
|
+
exports.renderToAbstractCanvas = renderToAbstractCanvas;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _offscreenCanvasPonyfill = require("./offscreenCanvasPonyfill");
|
|
17
|
+
|
|
18
|
+
var _canvasSequencer = require("canvas-sequencer");
|
|
19
|
+
|
|
20
|
+
var _index = require("./index");
|
|
21
|
+
|
|
22
|
+
function renderToAbstractCanvas(_x, _x2, _x3, _x4) {
|
|
23
|
+
return _renderToAbstractCanvas.apply(this, arguments);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function _renderToAbstractCanvas() {
|
|
27
|
+
_renderToAbstractCanvas = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(width, height, opts, cb) {
|
|
28
|
+
var exportSVG, _opts$highResolutionS, highResolutionScaling, fakeCtx, scale, canvas, ctx, _canvas, _ctx;
|
|
29
|
+
|
|
30
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
31
|
+
while (1) {
|
|
32
|
+
switch (_context.prev = _context.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
exportSVG = opts.exportSVG, _opts$highResolutionS = opts.highResolutionScaling, highResolutionScaling = _opts$highResolutionS === void 0 ? 1 : _opts$highResolutionS;
|
|
35
|
+
|
|
36
|
+
if (!exportSVG) {
|
|
37
|
+
_context.next = 37;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (exportSVG.rasterizeLayers) {
|
|
42
|
+
_context.next = 9;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
fakeCtx = new _canvasSequencer.CanvasSequence();
|
|
47
|
+
_context.next = 6;
|
|
48
|
+
return cb(fakeCtx);
|
|
49
|
+
|
|
50
|
+
case 6:
|
|
51
|
+
return _context.abrupt("return", {
|
|
52
|
+
canvasRecordedData: fakeCtx.toJSON()
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
case 9:
|
|
56
|
+
scale = 4;
|
|
57
|
+
canvas = (0, _offscreenCanvasPonyfill.createCanvas)(Math.ceil(width * scale), height * scale);
|
|
58
|
+
ctx = canvas.getContext('2d');
|
|
59
|
+
|
|
60
|
+
if (ctx) {
|
|
61
|
+
_context.next = 14;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
throw new Error('2d canvas rendering not supported on this platform');
|
|
66
|
+
|
|
67
|
+
case 14:
|
|
68
|
+
ctx.scale(scale, scale);
|
|
69
|
+
_context.next = 17;
|
|
70
|
+
return cb(ctx);
|
|
71
|
+
|
|
72
|
+
case 17:
|
|
73
|
+
_context.t0 = _react.default;
|
|
74
|
+
_context.t1 = width;
|
|
75
|
+
_context.t2 = height;
|
|
76
|
+
|
|
77
|
+
if (!('convertToBlob' in canvas)) {
|
|
78
|
+
_context.next = 30;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_context.t4 = _index.blobToDataURL;
|
|
83
|
+
_context.next = 24;
|
|
84
|
+
return canvas.convertToBlob({
|
|
85
|
+
type: 'image/png'
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
case 24:
|
|
89
|
+
_context.t5 = _context.sent;
|
|
90
|
+
_context.next = 27;
|
|
91
|
+
return (0, _context.t4)(_context.t5);
|
|
92
|
+
|
|
93
|
+
case 27:
|
|
94
|
+
_context.t3 = _context.sent;
|
|
95
|
+
_context.next = 31;
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case 30:
|
|
99
|
+
_context.t3 = canvas.toDataURL();
|
|
100
|
+
|
|
101
|
+
case 31:
|
|
102
|
+
_context.t6 = _context.t3;
|
|
103
|
+
_context.t7 = {
|
|
104
|
+
width: _context.t1,
|
|
105
|
+
height: _context.t2,
|
|
106
|
+
xlinkHref: _context.t6
|
|
107
|
+
};
|
|
108
|
+
_context.t8 = _context.t0.createElement.call(_context.t0, "image", _context.t7);
|
|
109
|
+
return _context.abrupt("return", {
|
|
110
|
+
reactElement: _context.t8
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
case 35:
|
|
114
|
+
_context.next = 48;
|
|
115
|
+
break;
|
|
116
|
+
|
|
117
|
+
case 37:
|
|
118
|
+
_canvas = (0, _offscreenCanvasPonyfill.createCanvas)(Math.ceil(width * highResolutionScaling), height * highResolutionScaling);
|
|
119
|
+
_ctx = _canvas.getContext('2d');
|
|
120
|
+
|
|
121
|
+
if (_ctx) {
|
|
122
|
+
_context.next = 41;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
throw new Error('2d canvas rendering not supported on this platform');
|
|
127
|
+
|
|
128
|
+
case 41:
|
|
129
|
+
_ctx.scale(highResolutionScaling, highResolutionScaling);
|
|
130
|
+
|
|
131
|
+
_context.next = 44;
|
|
132
|
+
return cb(_ctx);
|
|
133
|
+
|
|
134
|
+
case 44:
|
|
135
|
+
_context.next = 46;
|
|
136
|
+
return (0, _offscreenCanvasPonyfill.createImageBitmap)(_canvas);
|
|
137
|
+
|
|
138
|
+
case 46:
|
|
139
|
+
_context.t9 = _context.sent;
|
|
140
|
+
return _context.abrupt("return", {
|
|
141
|
+
imageData: _context.t9
|
|
142
|
+
});
|
|
6
143
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
144
|
+
case 48:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context.stop();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, _callee);
|
|
150
|
+
}));
|
|
151
|
+
return _renderToAbstractCanvas.apply(this, arguments);
|
|
152
|
+
}
|
package/util/types/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export * from './util';
|
|
|
13
13
|
export interface AbstractViewContainer extends IAnyStateTreeNode {
|
|
14
14
|
views: AbstractViewModel[];
|
|
15
15
|
removeView(view: AbstractViewModel): void;
|
|
16
|
-
addView(typeName: string, initialState
|
|
16
|
+
addView(typeName: string, initialState?: Record<string, unknown>): void | AbstractViewModel;
|
|
17
17
|
}
|
|
18
18
|
export declare function isViewContainer(thing: unknown): thing is AbstractViewContainer;
|
|
19
19
|
export declare type NotificationLevel = 'error' | 'info' | 'warning' | 'success';
|
|
@@ -43,6 +43,7 @@ export interface JBrowsePlugin {
|
|
|
43
43
|
export declare type DialogComponentType = React.LazyExoticComponent<React.FC<any>> | React.FC<any>;
|
|
44
44
|
/** minimum interface that all session state models must implement */
|
|
45
45
|
export interface AbstractSessionModel extends AbstractViewContainer {
|
|
46
|
+
drawerPosition?: string;
|
|
46
47
|
setSelection(feature: Feature): void;
|
|
47
48
|
clearSelection(): void;
|
|
48
49
|
configuration: AnyConfigurationModel;
|
|
@@ -63,6 +64,8 @@ export interface AbstractSessionModel extends AbstractViewContainer {
|
|
|
63
64
|
sessionConnections?: AnyConfigurationModel[];
|
|
64
65
|
connectionInstances?: {
|
|
65
66
|
name: string;
|
|
67
|
+
connectionId: string;
|
|
68
|
+
tracks: AnyConfigurationModel[];
|
|
66
69
|
}[];
|
|
67
70
|
makeConnection?: Function;
|
|
68
71
|
adminMode?: boolean;
|
|
@@ -73,6 +76,7 @@ export interface AbstractSessionModel extends AbstractViewContainer {
|
|
|
73
76
|
queueDialog: (callback: (doneCallback: Function) => [DialogComponentType, any]) => void;
|
|
74
77
|
name: string;
|
|
75
78
|
id?: string;
|
|
79
|
+
tracks: AnyConfigurationModel[];
|
|
76
80
|
}
|
|
77
81
|
export declare function isSessionModel(thing: unknown): thing is AbstractSessionModel;
|
|
78
82
|
/** abstract interface for a session allows editing configurations */
|
|
@@ -110,6 +114,10 @@ export interface SessionWithDrawerWidgets extends SessionWithWidgets {
|
|
|
110
114
|
setDrawerPosition(arg: string): void;
|
|
111
115
|
}
|
|
112
116
|
export declare function isSessionModelWithWidgets(thing: unknown): thing is SessionWithWidgets;
|
|
117
|
+
interface SessionWithConnections {
|
|
118
|
+
addConnectionConf: (arg: AnyConfigurationModel) => void;
|
|
119
|
+
}
|
|
120
|
+
export declare function isSessionModelWithConnections(thing: unknown): thing is SessionWithConnections;
|
|
113
121
|
export interface SessionWithSessionPlugins extends AbstractSessionModel {
|
|
114
122
|
sessionPlugins: JBrowsePlugin[];
|
|
115
123
|
addSessionPlugin: Function;
|
|
@@ -133,7 +141,9 @@ export interface AbstractViewModel {
|
|
|
133
141
|
menuItems: () => MenuItem[];
|
|
134
142
|
}
|
|
135
143
|
export declare function isViewModel(thing: unknown): thing is AbstractViewModel;
|
|
136
|
-
|
|
144
|
+
export interface AbstractTrackModel {
|
|
145
|
+
displays: AbstractDisplayModel[];
|
|
146
|
+
}
|
|
137
147
|
export declare function isTrackModel(thing: unknown): thing is AbstractTrackModel;
|
|
138
148
|
export interface AbstractDisplayModel {
|
|
139
149
|
id: string;
|
package/util/types/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var _exportNames = {
|
|
|
11
11
|
isSessionModelWithConfigEditing: true,
|
|
12
12
|
isSessionWithAddTracks: true,
|
|
13
13
|
isSessionModelWithWidgets: true,
|
|
14
|
+
isSessionModelWithConnections: true,
|
|
14
15
|
isSessionWithSessionPlugins: true,
|
|
15
16
|
isSelectionContainer: true,
|
|
16
17
|
isViewModel: true,
|
|
@@ -34,6 +35,7 @@ exports.isRetryException = isRetryException;
|
|
|
34
35
|
exports.isSelectionContainer = isSelectionContainer;
|
|
35
36
|
exports.isSessionModel = isSessionModel;
|
|
36
37
|
exports.isSessionModelWithConfigEditing = isSessionModelWithConfigEditing;
|
|
38
|
+
exports.isSessionModelWithConnections = isSessionModelWithConnections;
|
|
37
39
|
exports.isSessionModelWithWidgets = isSessionModelWithWidgets;
|
|
38
40
|
exports.isSessionWithAddTracks = isSessionWithAddTracks;
|
|
39
41
|
exports.isSessionWithSessionPlugins = isSessionWithSessionPlugins;
|
|
@@ -103,6 +105,10 @@ function isSessionModelWithWidgets(thing) {
|
|
|
103
105
|
return isSessionModel(thing) && 'widgets' in thing;
|
|
104
106
|
}
|
|
105
107
|
|
|
108
|
+
function isSessionModelWithConnections(thing) {
|
|
109
|
+
return isSessionModel(thing) && 'addConnectionConf' in thing;
|
|
110
|
+
}
|
|
111
|
+
|
|
106
112
|
function isSessionWithSessionPlugins(thing) {
|
|
107
113
|
return isSessionModel(thing) && 'sessionPlugins' in thing;
|
|
108
114
|
}
|
package/util/types/mst.d.ts
CHANGED
|
@@ -77,13 +77,13 @@ export declare const FileLocation: import("mobx-state-tree").ISnapshotProcessor<
|
|
|
77
77
|
internetAccountType: import("mobx-state-tree").ISimpleType<string>;
|
|
78
78
|
authInfo: import("mobx-state-tree").IType<any, any, any>;
|
|
79
79
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
80
|
-
}>> | import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
81
|
-
locationType: import("mobx-state-tree").ISimpleType<"LocalPathLocation">;
|
|
82
|
-
localPath: import("mobx-state-tree").ISimpleType<string>;
|
|
83
80
|
}>> | import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
84
81
|
locationType: import("mobx-state-tree").ISimpleType<"BlobLocation">;
|
|
85
82
|
name: import("mobx-state-tree").ISimpleType<string>;
|
|
86
83
|
blobId: import("mobx-state-tree").ISimpleType<string>;
|
|
84
|
+
}>> | import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
85
|
+
locationType: import("mobx-state-tree").ISimpleType<"LocalPathLocation">;
|
|
86
|
+
localPath: import("mobx-state-tree").ISimpleType<string>;
|
|
87
87
|
}>>, {
|
|
88
88
|
locationType: "UriLocation";
|
|
89
89
|
uri: string;
|
|
@@ -93,12 +93,12 @@ export declare const FileLocation: import("mobx-state-tree").ISnapshotProcessor<
|
|
|
93
93
|
authInfo: import("mobx-state-tree").IType<any, any, any>;
|
|
94
94
|
}> | undefined;
|
|
95
95
|
} | import("mobx-state-tree").ModelSnapshotType<{
|
|
96
|
-
locationType: import("mobx-state-tree").ISimpleType<"LocalPathLocation">;
|
|
97
|
-
localPath: import("mobx-state-tree").ISimpleType<string>;
|
|
98
|
-
}> | import("mobx-state-tree").ModelSnapshotType<{
|
|
99
96
|
locationType: import("mobx-state-tree").ISimpleType<"BlobLocation">;
|
|
100
97
|
name: import("mobx-state-tree").ISimpleType<string>;
|
|
101
98
|
blobId: import("mobx-state-tree").ISimpleType<string>;
|
|
99
|
+
}> | import("mobx-state-tree").ModelSnapshotType<{
|
|
100
|
+
locationType: import("mobx-state-tree").ISimpleType<"LocalPathLocation">;
|
|
101
|
+
localPath: import("mobx-state-tree").ISimpleType<string>;
|
|
102
102
|
}>, import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
103
103
|
locationType: import("mobx-state-tree").ISimpleType<"UriLocation">;
|
|
104
104
|
uri: import("mobx-state-tree").ISimpleType<string>;
|
|
@@ -109,10 +109,10 @@ export declare const FileLocation: import("mobx-state-tree").ISnapshotProcessor<
|
|
|
109
109
|
authInfo: import("mobx-state-tree").IType<any, any, any>;
|
|
110
110
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
111
111
|
}>> | import("mobx-state-tree").ModelInstanceTypeProps<{
|
|
112
|
-
locationType: import("mobx-state-tree").ISimpleType<"LocalPathLocation">;
|
|
113
|
-
localPath: import("mobx-state-tree").ISimpleType<string>;
|
|
114
|
-
}> | import("mobx-state-tree").ModelInstanceTypeProps<{
|
|
115
112
|
locationType: import("mobx-state-tree").ISimpleType<"BlobLocation">;
|
|
116
113
|
name: import("mobx-state-tree").ISimpleType<string>;
|
|
117
114
|
blobId: import("mobx-state-tree").ISimpleType<string>;
|
|
115
|
+
}> | import("mobx-state-tree").ModelInstanceTypeProps<{
|
|
116
|
+
locationType: import("mobx-state-tree").ISimpleType<"LocalPathLocation">;
|
|
117
|
+
localPath: import("mobx-state-tree").ISimpleType<string>;
|
|
118
118
|
}>>, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _ = _interopRequireDefault(require("."));
|
|
6
|
-
|
|
7
|
-
test('serialize a single command and read back out', function () {
|
|
8
|
-
var ctx = new _.default(100, 100);
|
|
9
|
-
ctx.arc(20, 21, 22, 23, 24);
|
|
10
|
-
var cmds = Array.from(ctx.getCommands());
|
|
11
|
-
expect(cmds).toEqual([{
|
|
12
|
-
name: 'arc',
|
|
13
|
-
args: [20, 21, 22, 23, 24]
|
|
14
|
-
}]);
|
|
15
|
-
});
|