@jbrowse/core 2.0.0 → 2.1.2
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 +9 -3
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -581
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -478
- package/BaseFeatureWidget/index.js +88 -126
- package/BaseFeatureWidget/types.d.ts +1 -0
- package/BaseFeatureWidget/types.js +1 -4
- package/BaseFeatureWidget/util.js +40 -75
- package/CorePlugin.js +55 -94
- package/Plugin.js +9 -34
- package/PluginLoader.js +153 -422
- package/PluginManager.d.ts +28 -33
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.js +3 -10
- package/ReExports/BaseCard.js +3 -10
- package/ReExports/DataGrid.js +5 -12
- package/ReExports/FeatureDetails.js +3 -10
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.js +15 -16
- package/ReExports/modules.d.ts +11 -20
- package/ReExports/modules.js +453 -798
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -555
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.js +126 -272
- package/assemblyManager/index.js +9 -22
- package/configuration/configurationSchema.js +167 -203
- package/configuration/configurationSlot.js +248 -326
- package/configuration/index.js +19 -35
- package/configuration/util.js +131 -173
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/BaseAdapter.js +132 -521
- package/data_adapters/CytobandAdapter.js +40 -126
- package/data_adapters/dataAdapterCache.js +77 -158
- package/package.json +4 -5
- package/pluggableElementTypes/AdapterType.js +24 -79
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +17 -0
- package/pluggableElementTypes/AddTrackWorkflowType.js +20 -0
- package/pluggableElementTypes/ConnectionType.js +22 -65
- package/pluggableElementTypes/DisplayType.js +35 -82
- package/pluggableElementTypes/InternetAccountType.js +23 -64
- package/pluggableElementTypes/PluggableElementBase.js +8 -20
- package/pluggableElementTypes/RpcMethodType.js +85 -427
- package/pluggableElementTypes/TextSearchAdapterType.js +16 -55
- package/pluggableElementTypes/TrackType.js +26 -70
- package/pluggableElementTypes/ViewType.js +21 -63
- package/pluggableElementTypes/WidgetType.js +21 -64
- package/pluggableElementTypes/index.d.ts +4 -3
- package/pluggableElementTypes/index.js +42 -125
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +28 -43
- package/pluggableElementTypes/models/BaseDisplayModel.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -199
- package/pluggableElementTypes/models/BaseViewModel.js +24 -40
- package/pluggableElementTypes/models/InternetAccountModel.js +116 -263
- package/pluggableElementTypes/models/baseConnectionConfig.js +14 -25
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +29 -38
- package/pluggableElementTypes/models/baseTrackConfig.js +106 -133
- package/pluggableElementTypes/models/index.js +21 -70
- package/pluggableElementTypes/renderers/BoxRendererType.js +132 -291
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +8 -38
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +60 -192
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +0 -2
- package/pluggableElementTypes/renderers/FeatureRendererType.js +89 -255
- package/pluggableElementTypes/renderers/RendererType.js +31 -105
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +61 -72
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +112 -265
- package/pluggableElementTypes/renderers/index.js +19 -62
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +27 -65
- package/rpc/BaseRpcDriver.js +169 -405
- package/rpc/MainThreadRpcDriver.js +27 -150
- package/rpc/RpcManager.js +58 -159
- package/rpc/WebWorkerRpcDriver.js +54 -171
- package/rpc/configSchema.js +25 -49
- package/rpc/coreRpcMethods.d.ts +1 -3
- package/rpc/coreRpcMethods.js +221 -959
- package/rpc/remoteAbortSignals.js +46 -70
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +106 -162
- package/ui/App.js +157 -242
- package/ui/AssemblySelector.js +59 -120
- package/ui/CascadingMenu.js +101 -196
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -61
- package/ui/DrawerWidget.js +108 -202
- package/ui/DropDownMenu.js +60 -91
- package/ui/EditableTypography.js +87 -149
- package/ui/ErrorMessage.js +41 -56
- package/ui/FactoryResetDialog.js +24 -57
- package/ui/FatalErrorDialog.js +59 -91
- package/ui/FileSelector/FileSelector.js +123 -189
- package/ui/FileSelector/LocalFileChooser.js +44 -75
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.js +232 -354
- package/ui/PrerenderedCanvas.js +63 -87
- package/ui/ResizeHandle.js +87 -116
- package/ui/ReturnToImportFormDialog.js +32 -63
- package/ui/SanitizedHTML.js +64 -47
- package/ui/Snackbar.js +74 -101
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.js +49 -76
- package/ui/ViewContainer.js +113 -196
- package/ui/colors.d.ts +10 -0
- package/ui/colors.js +78 -0
- package/ui/index.js +51 -181
- package/ui/react-colorful.d.ts +17 -0
- package/ui/react-colorful.js +455 -0
- package/ui/theme.d.ts +23 -1
- package/ui/theme.js +199 -247
- package/util/Base1DUtils.d.ts +32 -0
- package/util/Base1DUtils.js +174 -0
- package/util/Base1DViewModel.d.ts +16 -30
- package/util/Base1DViewModel.js +116 -293
- package/util/QuickLRU.js +84 -332
- package/util/TimeTraveller.d.ts +19 -0
- package/util/TimeTraveller.js +86 -0
- package/util/aborting.js +49 -127
- package/util/analytics.js +91 -154
- package/util/blockTypes.js +106 -240
- package/util/calculateDynamicBlocks.js +98 -128
- package/util/calculateStaticBlocks.js +105 -125
- package/util/color/cssColorsLevel4.js +156 -160
- package/util/color/index.js +33 -55
- package/util/compositeMap.js +49 -333
- package/util/formatFastaStrings.js +9 -14
- package/util/idMaker.js +18 -31
- package/util/index.d.ts +18 -32
- package/util/index.js +747 -1226
- package/util/io/RemoteFileWithRangeCache.js +88 -257
- package/util/io/index.js +95 -169
- package/util/jexl.js +60 -115
- package/util/jexlStrings.js +24 -29
- package/util/layouts/BaseLayout.js +1 -4
- package/util/layouts/GranularRectLayout.js +388 -555
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -112
- package/util/layouts/PrecomputedMultiLayout.js +22 -59
- package/util/layouts/SceneGraph.js +127 -197
- package/util/layouts/index.js +29 -66
- package/util/mst-reflection.js +55 -71
- package/util/offscreenCanvasPonyfill.js +66 -134
- package/util/offscreenCanvasUtils.d.ts +2 -7
- package/util/offscreenCanvasUtils.js +49 -146
- package/util/range.js +29 -40
- package/util/rxjs.js +20 -27
- package/util/simpleFeature.js +88 -152
- package/util/stats.js +91 -151
- package/util/tracks.js +130 -173
- package/util/types/index.js +110 -179
- package/util/types/mst.js +91 -146
- package/util/types/util.js +1 -4
- package/util/when.js +54 -101
- package/BaseFeatureWidget/SequenceFeatureDetails.test.js +0 -122
- package/BaseFeatureWidget/index.test.js +0 -69
- package/TextSearch/BaseResults.test.js +0 -42
- package/configuration/configurationSchema.test.js +0 -266
- package/configuration/configurationSlot.test.js +0 -69
- package/configuration/util.test.js +0 -39
- package/data_adapters/BaseAdapter.test.js +0 -200
- package/declare.d.js +0 -1
- package/pluggableElementTypes/RpcMethodType.test.js +0 -118
- package/pluggableElementTypes/renderers/declare.d.js +0 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.test.js +0 -20
- package/rpc/BaseRpcDriver.test.js +0 -540
- package/rpc/declaration.d.js +0 -1
- package/ui/FatalErrorDialog.test.js +0 -82
- package/ui/SanitizedHTML.test.js +0 -36
- package/ui/theme.test.js +0 -92
- package/util/Base1DViewModel.test.js +0 -130
- package/util/calculateDynamicBlocks.test.js +0 -74
- package/util/calculateStaticBlocks.test.js +0 -297
- package/util/declare.d.js +0 -1
- package/util/formatFastaStrings.test.js +0 -40
- package/util/index.test.js +0 -213
- package/util/jexlStrings.test.js +0 -48
- package/util/layouts/GranularRectLayout.test.js +0 -99
- package/util/range.test.js +0 -64
- package/util/simpleFeature.test.js +0 -34
- package/util/stats.test.js +0 -172
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare function Ne(r: any): e.FunctionComponentElement<any>;
|
|
2
|
+
declare function J(r: any): e.FunctionComponentElement<any>;
|
|
3
|
+
declare function oe(r: any): e.FunctionComponentElement<any>;
|
|
4
|
+
declare function le(r: any): e.FunctionComponentElement<any>;
|
|
5
|
+
declare function Z(r: any): e.FunctionComponentElement<any>;
|
|
6
|
+
declare function re(r: any): e.FunctionComponentElement<any>;
|
|
7
|
+
declare function de(r: any): e.FunctionComponentElement<any>;
|
|
8
|
+
declare function he(r: any): e.FunctionComponentElement<any>;
|
|
9
|
+
declare function se(r: any): e.FunctionComponentElement<any>;
|
|
10
|
+
declare function ue(r: any): e.FunctionComponentElement<any>;
|
|
11
|
+
declare function _e(r: any): e.FunctionComponentElement<any>;
|
|
12
|
+
declare function Ce(r: any): e.FunctionComponentElement<any>;
|
|
13
|
+
declare function me(r: any): e.FunctionComponentElement<any>;
|
|
14
|
+
declare function pe(r: any): e.FunctionComponentElement<any>;
|
|
15
|
+
declare function X(e: any): void;
|
|
16
|
+
import e from "react";
|
|
17
|
+
export { Ne as HexColorInput, J as HexColorPicker, oe as HslColorPicker, le as HslStringColorPicker, Z as HslaColorPicker, re as HslaStringColorPicker, de as HsvColorPicker, he as HsvStringColorPicker, se as HsvaColorPicker, ue as HsvaStringColorPicker, _e as RgbColorPicker, Ce as RgbStringColorPicker, me as RgbaColorPicker, pe as RgbaStringColorPicker, X as setNonce };
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// vendored (e.g. copied into our source tree) because the tooling picks up "import" statements that confuse jest, could confuse other consumers of our modules
|
|
4
|
+
// copy of react-colorful/dist/index.esmodule.js
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.setNonce = exports.RgbaStringColorPicker = exports.RgbaColorPicker = exports.RgbStringColorPicker = exports.RgbColorPicker = exports.HsvaStringColorPicker = exports.HsvaColorPicker = exports.HsvStringColorPicker = exports.HsvColorPicker = exports.HslaStringColorPicker = exports.HslaColorPicker = exports.HslStringColorPicker = exports.HslColorPicker = exports.HexColorPicker = exports.HexColorInput = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
function s() {
|
|
32
|
+
return (s =
|
|
33
|
+
Object.assign ||
|
|
34
|
+
function (e) {
|
|
35
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
36
|
+
var t = arguments[r];
|
|
37
|
+
for (var o in t)
|
|
38
|
+
Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
|
|
39
|
+
}
|
|
40
|
+
return e;
|
|
41
|
+
}).apply(this, arguments);
|
|
42
|
+
}
|
|
43
|
+
function c(e, r) {
|
|
44
|
+
if (null == e)
|
|
45
|
+
return {};
|
|
46
|
+
var t, o, a = {}, l = Object.keys(e);
|
|
47
|
+
for (o = 0; o < l.length; o++)
|
|
48
|
+
r.indexOf((t = l[o])) >= 0 || (a[t] = e[t]);
|
|
49
|
+
return a;
|
|
50
|
+
}
|
|
51
|
+
function u(e) {
|
|
52
|
+
const t = (0, react_1.useRef)(e), o = (0, react_1.useRef)(e => {
|
|
53
|
+
t.current && t.current(e);
|
|
54
|
+
});
|
|
55
|
+
return (t.current = e), o.current;
|
|
56
|
+
}
|
|
57
|
+
const i = (e, r = 0, t = 1) => (e > t ? t : e < r ? r : e), d = e => 'touches' in e, f = e => (e && e.ownerDocument.defaultView) || self, h = (e, r, t) => {
|
|
58
|
+
const o = e.getBoundingClientRect(), a = d(r)
|
|
59
|
+
? ((e, r) => {
|
|
60
|
+
for (let t = 0; t < e.length; t++)
|
|
61
|
+
if (e[t].identifier === r)
|
|
62
|
+
return e[t];
|
|
63
|
+
return e[0];
|
|
64
|
+
})(r.touches, t)
|
|
65
|
+
: r;
|
|
66
|
+
return {
|
|
67
|
+
left: i((a.pageX - (o.left + f(e).pageXOffset)) / o.width),
|
|
68
|
+
top: i((a.pageY - (o.top + f(e).pageYOffset)) / o.height),
|
|
69
|
+
};
|
|
70
|
+
}, v = e => {
|
|
71
|
+
!d(e) && e.preventDefault();
|
|
72
|
+
}, m = react_1.default.memo(a => {
|
|
73
|
+
let { onMove: l, onKey: n } = a, i = c(a, ['onMove', 'onKey']);
|
|
74
|
+
const m = (0, react_1.useRef)(null), g = u(l), p = u(n), b = (0, react_1.useRef)(null), _ = (0, react_1.useRef)(!1), [x, C, E] = (0, react_1.useMemo)(() => {
|
|
75
|
+
const e = e => {
|
|
76
|
+
v(e),
|
|
77
|
+
(d(e) ? e.touches.length > 0 : e.buttons > 0) && m.current
|
|
78
|
+
? g(h(m.current, e, b.current))
|
|
79
|
+
: t(!1);
|
|
80
|
+
}, r = () => t(!1);
|
|
81
|
+
function t(t) {
|
|
82
|
+
const o = _.current, a = f(m.current), l = t ? a.addEventListener : a.removeEventListener;
|
|
83
|
+
l(o ? 'touchmove' : 'mousemove', e), l(o ? 'touchend' : 'mouseup', r);
|
|
84
|
+
}
|
|
85
|
+
return [
|
|
86
|
+
({ nativeEvent: e }) => {
|
|
87
|
+
const r = m.current;
|
|
88
|
+
if (r && (v(e), !((e, r) => r && !d(e))(e, _.current) && r)) {
|
|
89
|
+
if (d(e)) {
|
|
90
|
+
_.current = !0;
|
|
91
|
+
const r = e.changedTouches || [];
|
|
92
|
+
r.length && (b.current = r[0].identifier);
|
|
93
|
+
}
|
|
94
|
+
r.focus(), g(h(r, e, b.current)), t(!0);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
e => {
|
|
98
|
+
const r = e.which || e.keyCode;
|
|
99
|
+
r < 37 ||
|
|
100
|
+
r > 40 ||
|
|
101
|
+
(e.preventDefault(),
|
|
102
|
+
p({
|
|
103
|
+
left: 39 === r ? 0.05 : 37 === r ? -0.05 : 0,
|
|
104
|
+
top: 40 === r ? 0.05 : 38 === r ? -0.05 : 0,
|
|
105
|
+
}));
|
|
106
|
+
},
|
|
107
|
+
t,
|
|
108
|
+
];
|
|
109
|
+
}, [p, g]);
|
|
110
|
+
return ((0, react_1.useEffect)(() => E, [E]),
|
|
111
|
+
react_1.default.createElement('div', s({}, i, {
|
|
112
|
+
onTouchStart: x,
|
|
113
|
+
onMouseDown: x,
|
|
114
|
+
className: 'react-colorful__interactive',
|
|
115
|
+
ref: m,
|
|
116
|
+
onKeyDown: C,
|
|
117
|
+
tabIndex: 0,
|
|
118
|
+
role: 'slider',
|
|
119
|
+
})));
|
|
120
|
+
}), g = e => e.filter(Boolean).join(' '), p = ({ className: r, color: t, left: o, top: a = 0.5 }) => {
|
|
121
|
+
const l = g(['react-colorful__pointer', r]);
|
|
122
|
+
return react_1.default.createElement('div', { className: l, style: { top: 100 * a + '%', left: 100 * o + '%' } }, react_1.default.createElement('div', {
|
|
123
|
+
className: 'react-colorful__pointer-fill',
|
|
124
|
+
style: { backgroundColor: t },
|
|
125
|
+
}));
|
|
126
|
+
}, b = (e, r = 0, t = Math.pow(10, r)) => Math.round(t * e) / t, _ = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, x = e => ('#' === e[0] && (e = e.substr(1)),
|
|
127
|
+
e.length < 6
|
|
128
|
+
? {
|
|
129
|
+
r: parseInt(e[0] + e[0], 16),
|
|
130
|
+
g: parseInt(e[1] + e[1], 16),
|
|
131
|
+
b: parseInt(e[2] + e[2], 16),
|
|
132
|
+
a: 1,
|
|
133
|
+
}
|
|
134
|
+
: {
|
|
135
|
+
r: parseInt(e.substr(0, 2), 16),
|
|
136
|
+
g: parseInt(e.substr(2, 2), 16),
|
|
137
|
+
b: parseInt(e.substr(4, 2), 16),
|
|
138
|
+
a: 1,
|
|
139
|
+
}), C = (e, r = 'deg') => Number(e) * (_[r] || 1), E = e => {
|
|
140
|
+
const r = /hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);
|
|
141
|
+
return r
|
|
142
|
+
? M({
|
|
143
|
+
h: C(r[1], r[2]),
|
|
144
|
+
s: Number(r[3]),
|
|
145
|
+
l: Number(r[4]),
|
|
146
|
+
a: void 0 === r[5] ? 1 : Number(r[5]) / (r[6] ? 100 : 1),
|
|
147
|
+
})
|
|
148
|
+
: { h: 0, s: 0, v: 0, a: 1 };
|
|
149
|
+
}, H = E, M = ({ h: e, s: r, l: t, a: o }) => ({
|
|
150
|
+
h: e,
|
|
151
|
+
s: (r *= (t < 50 ? t : 100 - t) / 100) > 0 ? ((2 * r) / (t + r)) * 100 : 0,
|
|
152
|
+
v: t + r,
|
|
153
|
+
a: o,
|
|
154
|
+
}), N = ({ h: e, s: r, v: t, a: o }) => {
|
|
155
|
+
const a = ((200 - r) * t) / 100;
|
|
156
|
+
return {
|
|
157
|
+
h: b(e),
|
|
158
|
+
s: b(a > 0 && a < 200 ? ((r * t) / 100 / (a <= 100 ? a : 200 - a)) * 100 : 0),
|
|
159
|
+
l: b(a / 2),
|
|
160
|
+
a: b(o, 2),
|
|
161
|
+
};
|
|
162
|
+
}, w = e => {
|
|
163
|
+
const { h: r, s: t, l: o } = N(e);
|
|
164
|
+
return `hsl(${r}, ${t}%, ${o}%)`;
|
|
165
|
+
}, $ = e => {
|
|
166
|
+
const { h: r, s: t, l: o, a } = N(e);
|
|
167
|
+
return `hsla(${r}, ${t}%, ${o}%, ${a})`;
|
|
168
|
+
}, y = ({ h: e, s: r, v: t, a: o }) => {
|
|
169
|
+
;
|
|
170
|
+
(e = (e / 360) * 6), (r /= 100), (t /= 100);
|
|
171
|
+
const a = Math.floor(e), l = t * (1 - r), n = t * (1 - (e - a) * r), s = t * (1 - (1 - e + a) * r), c = a % 6;
|
|
172
|
+
return {
|
|
173
|
+
r: b(255 * [t, n, l, l, s, t][c]),
|
|
174
|
+
g: b(255 * [s, t, t, n, l, l][c]),
|
|
175
|
+
b: b(255 * [l, l, s, t, t, n][c]),
|
|
176
|
+
a: b(o, 2),
|
|
177
|
+
};
|
|
178
|
+
}, q = e => {
|
|
179
|
+
const r = /hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);
|
|
180
|
+
return r
|
|
181
|
+
? B({
|
|
182
|
+
h: C(r[1], r[2]),
|
|
183
|
+
s: Number(r[3]),
|
|
184
|
+
v: Number(r[4]),
|
|
185
|
+
a: void 0 === r[5] ? 1 : Number(r[5]) / (r[6] ? 100 : 1),
|
|
186
|
+
})
|
|
187
|
+
: { h: 0, s: 0, v: 0, a: 1 };
|
|
188
|
+
}, k = q, O = e => {
|
|
189
|
+
const r = /rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);
|
|
190
|
+
return r
|
|
191
|
+
? z({
|
|
192
|
+
r: Number(r[1]) / (r[2] ? 100 / 255 : 1),
|
|
193
|
+
g: Number(r[3]) / (r[4] ? 100 / 255 : 1),
|
|
194
|
+
b: Number(r[5]) / (r[6] ? 100 / 255 : 1),
|
|
195
|
+
a: void 0 === r[7] ? 1 : Number(r[7]) / (r[8] ? 100 : 1),
|
|
196
|
+
})
|
|
197
|
+
: { h: 0, s: 0, v: 0, a: 1 };
|
|
198
|
+
}, I = O, j = e => {
|
|
199
|
+
const r = e.toString(16);
|
|
200
|
+
return r.length < 2 ? '0' + r : r;
|
|
201
|
+
}, z = ({ r: e, g: r, b: t, a: o }) => {
|
|
202
|
+
const a = Math.max(e, r, t), l = a - Math.min(e, r, t), n = l
|
|
203
|
+
? a === e
|
|
204
|
+
? (r - t) / l
|
|
205
|
+
: a === r
|
|
206
|
+
? 2 + (t - e) / l
|
|
207
|
+
: 4 + (e - r) / l
|
|
208
|
+
: 0;
|
|
209
|
+
return {
|
|
210
|
+
h: b(60 * (n < 0 ? n + 6 : n)),
|
|
211
|
+
s: b(a ? (l / a) * 100 : 0),
|
|
212
|
+
v: b((a / 255) * 100),
|
|
213
|
+
a: o,
|
|
214
|
+
};
|
|
215
|
+
}, B = e => ({ h: b(e.h), s: b(e.s), v: b(e.v), a: b(e.a, 2) }), D = react_1.default.memo(({ className: r, hue: t, onChange: o }) => {
|
|
216
|
+
const a = g(['react-colorful__hue', r]);
|
|
217
|
+
return react_1.default.createElement('div', { className: a }, react_1.default.createElement(m, {
|
|
218
|
+
onMove: e => {
|
|
219
|
+
o({ h: 360 * e.left });
|
|
220
|
+
},
|
|
221
|
+
onKey: e => {
|
|
222
|
+
o({ h: i(t + 360 * e.left, 0, 360) });
|
|
223
|
+
},
|
|
224
|
+
'aria-label': 'Hue',
|
|
225
|
+
'aria-valuetext': b(t),
|
|
226
|
+
}, react_1.default.createElement(p, {
|
|
227
|
+
className: 'react-colorful__hue-pointer',
|
|
228
|
+
left: t / 360,
|
|
229
|
+
color: w({ h: t, s: 100, v: 100, a: 1 }),
|
|
230
|
+
})));
|
|
231
|
+
}), K = react_1.default.memo(({ hsva: r, onChange: t }) => {
|
|
232
|
+
const o = { backgroundColor: w({ h: r.h, s: 100, v: 100, a: 1 }) };
|
|
233
|
+
return react_1.default.createElement('div', { className: 'react-colorful__saturation', style: o }, react_1.default.createElement(m, {
|
|
234
|
+
onMove: e => {
|
|
235
|
+
t({ s: 100 * e.left, v: 100 - 100 * e.top });
|
|
236
|
+
},
|
|
237
|
+
onKey: e => {
|
|
238
|
+
t({
|
|
239
|
+
s: i(r.s + 100 * e.left, 0, 100),
|
|
240
|
+
v: i(r.v - 100 * e.top, 0, 100),
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
'aria-label': 'Color',
|
|
244
|
+
'aria-valuetext': `Saturation ${b(r.s)}%, Brightness ${b(r.v)}%`,
|
|
245
|
+
}, react_1.default.createElement(p, {
|
|
246
|
+
className: 'react-colorful__saturation-pointer',
|
|
247
|
+
top: 1 - r.v / 100,
|
|
248
|
+
left: r.s / 100,
|
|
249
|
+
color: w(r),
|
|
250
|
+
})));
|
|
251
|
+
}), L = (e, r) => {
|
|
252
|
+
if (e === r)
|
|
253
|
+
return !0;
|
|
254
|
+
for (const t in e)
|
|
255
|
+
if (e[t] !== r[t])
|
|
256
|
+
return !1;
|
|
257
|
+
return !0;
|
|
258
|
+
}, A = (e, r) => e.replace(/\s/g, '') === r.replace(/\s/g, '');
|
|
259
|
+
function S(e, t, n) {
|
|
260
|
+
const s = u(n), [c, i] = (0, react_1.useState)(() => e.toHsva(t)), d = (0, react_1.useRef)({ color: t, hsva: c });
|
|
261
|
+
(0, react_1.useEffect)(() => {
|
|
262
|
+
if (!e.equal(t, d.current.color)) {
|
|
263
|
+
const r = e.toHsva(t);
|
|
264
|
+
(d.current = { hsva: r, color: t }), i(r);
|
|
265
|
+
}
|
|
266
|
+
}, [t, e]),
|
|
267
|
+
(0, react_1.useEffect)(() => {
|
|
268
|
+
let r;
|
|
269
|
+
L(c, d.current.hsva) ||
|
|
270
|
+
e.equal((r = e.fromHsva(c)), d.current.color) ||
|
|
271
|
+
((d.current = { hsva: c, color: r }), s(r));
|
|
272
|
+
}, [c, e, s]);
|
|
273
|
+
const f = (0, react_1.useCallback)(e => {
|
|
274
|
+
i(r => Object.assign({}, r, e));
|
|
275
|
+
}, []);
|
|
276
|
+
return [c, f];
|
|
277
|
+
}
|
|
278
|
+
const T = 'undefined' != typeof window ? react_1.useLayoutEffect : react_1.useEffect;
|
|
279
|
+
let F;
|
|
280
|
+
const P = () => F || ('undefined' != typeof __webpack_nonce__ ? __webpack_nonce__ : void 0), X = e => {
|
|
281
|
+
F = e;
|
|
282
|
+
}, Y = new Map(), R = e => {
|
|
283
|
+
T(() => {
|
|
284
|
+
const r = e.current ? e.current.ownerDocument : document;
|
|
285
|
+
if (void 0 !== r && !Y.has(r)) {
|
|
286
|
+
const e = r.createElement('style');
|
|
287
|
+
(e.innerHTML =
|
|
288
|
+
'.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}'),
|
|
289
|
+
Y.set(r, e);
|
|
290
|
+
const t = P();
|
|
291
|
+
t && e.setAttribute('nonce', t), r.head.appendChild(e);
|
|
292
|
+
}
|
|
293
|
+
}, []);
|
|
294
|
+
}, V = t => {
|
|
295
|
+
let { className: o, colorModel: a, color: l = a.defaultColor, onChange: n, } = t, u = c(t, ['className', 'colorModel', 'color', 'onChange']);
|
|
296
|
+
const i = (0, react_1.useRef)(null);
|
|
297
|
+
R(i);
|
|
298
|
+
const [d, f] = S(a, l, n), h = g(['react-colorful', o]);
|
|
299
|
+
return react_1.default.createElement('div', s({}, u, { ref: i, className: h }), react_1.default.createElement(K, { hsva: d, onChange: f }), react_1.default.createElement(D, {
|
|
300
|
+
hue: d.h,
|
|
301
|
+
onChange: f,
|
|
302
|
+
className: 'react-colorful__last-control',
|
|
303
|
+
}));
|
|
304
|
+
}, G = {
|
|
305
|
+
defaultColor: '000',
|
|
306
|
+
toHsva: e => z(x(e)),
|
|
307
|
+
fromHsva: e => (({ r: e, g: r, b: t }) => '#' + j(e) + j(r) + j(t))(y(e)),
|
|
308
|
+
equal: (e, r) => e.toLowerCase() === r.toLowerCase() || L(x(e), x(r)),
|
|
309
|
+
}, J = r => react_1.default.createElement(V, s({}, r, { colorModel: G })), Q = ({ className: r, hsva: t, onChange: o }) => {
|
|
310
|
+
const a = {
|
|
311
|
+
backgroundImage: `linear-gradient(90deg, ${$(Object.assign({}, t, { a: 0 }))}, ${$(Object.assign({}, t, { a: 1 }))})`,
|
|
312
|
+
}, l = g(['react-colorful__alpha', r]);
|
|
313
|
+
return react_1.default.createElement('div', { className: l }, react_1.default.createElement('div', {
|
|
314
|
+
className: 'react-colorful__alpha-gradient',
|
|
315
|
+
style: a,
|
|
316
|
+
}), react_1.default.createElement(m, {
|
|
317
|
+
onMove: e => {
|
|
318
|
+
o({ a: e.left });
|
|
319
|
+
},
|
|
320
|
+
onKey: e => {
|
|
321
|
+
o({ a: i(t.a + e.left) });
|
|
322
|
+
},
|
|
323
|
+
'aria-label': 'Alpha',
|
|
324
|
+
'aria-valuetext': `${b(100 * t.a)}%`,
|
|
325
|
+
}, react_1.default.createElement(p, {
|
|
326
|
+
className: 'react-colorful__alpha-pointer',
|
|
327
|
+
left: t.a,
|
|
328
|
+
color: $(t),
|
|
329
|
+
})));
|
|
330
|
+
}, U = t => {
|
|
331
|
+
let { className: o, colorModel: a, color: l = a.defaultColor, onChange: n, } = t, u = c(t, ['className', 'colorModel', 'color', 'onChange']);
|
|
332
|
+
const i = (0, react_1.useRef)(null);
|
|
333
|
+
R(i);
|
|
334
|
+
const [d, f] = S(a, l, n), h = g(['react-colorful', o]);
|
|
335
|
+
return react_1.default.createElement('div', s({}, u, { ref: i, className: h }), react_1.default.createElement(K, { hsva: d, onChange: f }), react_1.default.createElement(D, { hue: d.h, onChange: f }), react_1.default.createElement(Q, {
|
|
336
|
+
hsva: d,
|
|
337
|
+
onChange: f,
|
|
338
|
+
className: 'react-colorful__last-control',
|
|
339
|
+
}));
|
|
340
|
+
}, W = {
|
|
341
|
+
defaultColor: { h: 0, s: 0, l: 0, a: 1 },
|
|
342
|
+
toHsva: M,
|
|
343
|
+
fromHsva: N,
|
|
344
|
+
equal: L,
|
|
345
|
+
}, Z = r => react_1.default.createElement(U, s({}, r, { colorModel: W })), ee = { defaultColor: 'hsla(0, 0%, 0%, 1)', toHsva: E, fromHsva: $, equal: A }, re = r => react_1.default.createElement(U, s({}, r, { colorModel: ee })), te = {
|
|
346
|
+
defaultColor: { h: 0, s: 0, l: 0 },
|
|
347
|
+
toHsva: ({ h: e, s: r, l: t }) => M({ h: e, s: r, l: t, a: 1 }),
|
|
348
|
+
fromHsva: e => (({ h: e, s: r, l: t }) => ({ h: e, s: r, l: t }))(N(e)),
|
|
349
|
+
equal: L,
|
|
350
|
+
}, oe = r => react_1.default.createElement(V, s({}, r, { colorModel: te })), ae = { defaultColor: 'hsl(0, 0%, 0%)', toHsva: H, fromHsva: w, equal: A }, le = r => react_1.default.createElement(V, s({}, r, { colorModel: ae })), ne = {
|
|
351
|
+
defaultColor: { h: 0, s: 0, v: 0, a: 1 },
|
|
352
|
+
toHsva: e => e,
|
|
353
|
+
fromHsva: B,
|
|
354
|
+
equal: L,
|
|
355
|
+
}, se = r => react_1.default.createElement(U, s({}, r, { colorModel: ne })), ce = {
|
|
356
|
+
defaultColor: 'hsva(0, 0%, 0%, 1)',
|
|
357
|
+
toHsva: q,
|
|
358
|
+
fromHsva: e => {
|
|
359
|
+
const { h: r, s: t, v: o, a } = B(e);
|
|
360
|
+
return `hsva(${r}, ${t}%, ${o}%, ${a})`;
|
|
361
|
+
},
|
|
362
|
+
equal: A,
|
|
363
|
+
}, ue = r => react_1.default.createElement(U, s({}, r, { colorModel: ce })), ie = {
|
|
364
|
+
defaultColor: { h: 0, s: 0, v: 0 },
|
|
365
|
+
toHsva: ({ h: e, s: r, v: t }) => ({ h: e, s: r, v: t, a: 1 }),
|
|
366
|
+
fromHsva: e => {
|
|
367
|
+
const { h: r, s: t, v: o } = B(e);
|
|
368
|
+
return { h: r, s: t, v: o };
|
|
369
|
+
},
|
|
370
|
+
equal: L,
|
|
371
|
+
}, de = r => react_1.default.createElement(V, s({}, r, { colorModel: ie })), fe = {
|
|
372
|
+
defaultColor: 'hsv(0, 0%, 0%)',
|
|
373
|
+
toHsva: k,
|
|
374
|
+
fromHsva: e => {
|
|
375
|
+
const { h: r, s: t, v: o } = B(e);
|
|
376
|
+
return `hsv(${r}, ${t}%, ${o}%)`;
|
|
377
|
+
},
|
|
378
|
+
equal: A,
|
|
379
|
+
}, he = r => react_1.default.createElement(V, s({}, r, { colorModel: fe })), ve = {
|
|
380
|
+
defaultColor: { r: 0, g: 0, b: 0, a: 1 },
|
|
381
|
+
toHsva: z,
|
|
382
|
+
fromHsva: y,
|
|
383
|
+
equal: L,
|
|
384
|
+
}, me = r => react_1.default.createElement(U, s({}, r, { colorModel: ve })), ge = {
|
|
385
|
+
defaultColor: 'rgba(0, 0, 0, 1)',
|
|
386
|
+
toHsva: O,
|
|
387
|
+
fromHsva: e => {
|
|
388
|
+
const { r, g: t, b: o, a } = y(e);
|
|
389
|
+
return `rgba(${r}, ${t}, ${o}, ${a})`;
|
|
390
|
+
},
|
|
391
|
+
equal: A,
|
|
392
|
+
}, pe = r => react_1.default.createElement(U, s({}, r, { colorModel: ge })), be = {
|
|
393
|
+
defaultColor: { r: 0, g: 0, b: 0 },
|
|
394
|
+
toHsva: ({ r: e, g: r, b: t }) => z({ r: e, g: r, b: t, a: 1 }),
|
|
395
|
+
fromHsva: e => (({ r: e, g: r, b: t }) => ({ r: e, g: r, b: t }))(y(e)),
|
|
396
|
+
equal: L,
|
|
397
|
+
}, _e = r => react_1.default.createElement(V, s({}, r, { colorModel: be })), xe = {
|
|
398
|
+
defaultColor: 'rgb(0, 0, 0)',
|
|
399
|
+
toHsva: I,
|
|
400
|
+
fromHsva: e => {
|
|
401
|
+
const { r, g: t, b: o } = y(e);
|
|
402
|
+
return `rgb(${r}, ${t}, ${o})`;
|
|
403
|
+
},
|
|
404
|
+
equal: A,
|
|
405
|
+
}, Ce = r => react_1.default.createElement(V, s({}, r, { colorModel: xe })), Ee = /^#?([0-9A-F]{3,8})$/i, He = r => {
|
|
406
|
+
const { color: t = '', onChange: n, onBlur: i, escape: d, validate: f, format: h, process: v, } = r, m = c(r, [
|
|
407
|
+
'color',
|
|
408
|
+
'onChange',
|
|
409
|
+
'onBlur',
|
|
410
|
+
'escape',
|
|
411
|
+
'validate',
|
|
412
|
+
'format',
|
|
413
|
+
'process',
|
|
414
|
+
]), [g, p] = (0, react_1.useState)(() => d(t)), b = u(n), _ = u(i), x = (0, react_1.useCallback)(e => {
|
|
415
|
+
const r = d(e.target.value);
|
|
416
|
+
p(r), f(r) && b(v ? v(r) : r);
|
|
417
|
+
}, [d, v, f, b]), C = (0, react_1.useCallback)(e => {
|
|
418
|
+
f(e.target.value) || p(d(t)), _(e);
|
|
419
|
+
}, [t, d, f, _]);
|
|
420
|
+
return ((0, react_1.useEffect)(() => {
|
|
421
|
+
p(d(t));
|
|
422
|
+
}, [t, d]),
|
|
423
|
+
react_1.default.createElement('input', s({}, m, {
|
|
424
|
+
value: h ? h(g) : g,
|
|
425
|
+
spellCheck: 'false',
|
|
426
|
+
onChange: x,
|
|
427
|
+
onBlur: C,
|
|
428
|
+
})));
|
|
429
|
+
}, Me = e => '#' + e, Ne = r => {
|
|
430
|
+
const { prefixed: t, alpha: o } = r, a = c(r, ['prefixed', 'alpha']), n = (0, react_1.useCallback)(e => e.replace(/([^0-9A-F]+)/gi, '').substr(0, o ? 8 : 6), [o]), u = (0, react_1.useCallback)(e => ((e, r) => {
|
|
431
|
+
const t = Ee.exec(e), o = t ? t[1].length : 0;
|
|
432
|
+
return 3 === o || 6 === o || (!!r && 4 === o) || (!!r && 8 === o);
|
|
433
|
+
})(e, o), [o]);
|
|
434
|
+
return react_1.default.createElement(He, s({}, a, {
|
|
435
|
+
escape: n,
|
|
436
|
+
format: t ? Me : void 0,
|
|
437
|
+
process: Me,
|
|
438
|
+
validate: u,
|
|
439
|
+
}));
|
|
440
|
+
};
|
|
441
|
+
exports.setNonce = X;
|
|
442
|
+
exports.HexColorPicker = J;
|
|
443
|
+
exports.HslaColorPicker = Z;
|
|
444
|
+
exports.HslaStringColorPicker = re;
|
|
445
|
+
exports.HslColorPicker = oe;
|
|
446
|
+
exports.HslStringColorPicker = le;
|
|
447
|
+
exports.HsvaColorPicker = se;
|
|
448
|
+
exports.HsvaStringColorPicker = ue;
|
|
449
|
+
exports.HsvColorPicker = de;
|
|
450
|
+
exports.HsvStringColorPicker = he;
|
|
451
|
+
exports.RgbaColorPicker = me;
|
|
452
|
+
exports.RgbaStringColorPicker = pe;
|
|
453
|
+
exports.RgbColorPicker = _e;
|
|
454
|
+
exports.RgbStringColorPicker = Ce;
|
|
455
|
+
exports.HexColorInput = Ne;
|
package/ui/theme.d.ts
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
import { PaletteOptions } from '@mui/material/styles/createPalette';
|
|
1
|
+
import type { PaletteOptions } from '@mui/material/styles/createPalette';
|
|
2
|
+
declare module '@mui/material/styles/createPalette' {
|
|
3
|
+
interface Palette {
|
|
4
|
+
tertiary: Palette['primary'];
|
|
5
|
+
quaternary: Palette['primary'];
|
|
6
|
+
bases: {
|
|
7
|
+
A: Palette['primary'];
|
|
8
|
+
C: Palette['primary'];
|
|
9
|
+
G: Palette['primary'];
|
|
10
|
+
T: Palette['primary'];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface PaletteOptions {
|
|
14
|
+
tertiary?: PaletteOptions['primary'];
|
|
15
|
+
quaternary?: PaletteOptions['primary'];
|
|
16
|
+
bases?: {
|
|
17
|
+
A?: PaletteOptions['primary'];
|
|
18
|
+
C?: PaletteOptions['primary'];
|
|
19
|
+
G?: PaletteOptions['primary'];
|
|
20
|
+
T?: PaletteOptions['primary'];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
2
24
|
export declare const jbrowseDefaultPalette: {
|
|
3
25
|
primary: {
|
|
4
26
|
main: string;
|