@jbrowse/core 3.5.1 → 3.6.0

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.
@@ -59,7 +59,7 @@ function u(e) {
59
59
  const t = (0, react_1.useRef)(e), o = (0, react_1.useRef)(e => {
60
60
  t.current && t.current(e);
61
61
  });
62
- return (t.current = e), o.current;
62
+ return ((t.current = e), o.current);
63
63
  }
64
64
  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) => {
65
65
  const o = e.getBoundingClientRect(), a = d(r)
@@ -80,14 +80,16 @@ const i = (e, r = 0, t = 1) => (e > t ? t : e < r ? r : e), d = e => 'touches' i
80
80
  let { onMove: l, onKey: n } = a, i = c(a, ['onMove', 'onKey']);
81
81
  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)(() => {
82
82
  const e = e => {
83
- v(e),
83
+ ;
84
+ (v(e),
84
85
  (d(e) ? e.touches.length > 0 : e.buttons > 0) && m.current
85
86
  ? g(h(m.current, e, b.current))
86
- : t(!1);
87
+ : t(!1));
87
88
  }, r = () => t(!1);
88
89
  function t(t) {
89
90
  const o = _.current, a = f(m.current), l = t ? a.addEventListener : a.removeEventListener;
90
- l(o ? 'touchmove' : 'mousemove', e), l(o ? 'touchend' : 'mouseup', r);
91
+ (l(o ? 'touchmove' : 'mousemove', e),
92
+ l(o ? 'touchend' : 'mouseup', r));
91
93
  }
92
94
  return [
93
95
  ({ nativeEvent: e }) => {
@@ -98,7 +100,8 @@ const i = (e, r = 0, t = 1) => (e > t ? t : e < r ? r : e), d = e => 'touches' i
98
100
  const r = e.changedTouches || [];
99
101
  r.length && (b.current = r[0].identifier);
100
102
  }
101
- r.focus(), g(h(r, e, b.current)), t(!0);
103
+ ;
104
+ (r.focus(), g(h(r, e, b.current)), t(!0));
102
105
  }
103
106
  },
104
107
  e => {
@@ -174,7 +177,7 @@ const i = (e, r = 0, t = 1) => (e > t ? t : e < r ? r : e), d = e => 'touches' i
174
177
  return `hsla(${r}, ${t}%, ${o}%, ${a})`;
175
178
  }, y = ({ h: e, s: r, v: t, a: o }) => {
176
179
  ;
177
- (e = (e / 360) * 6), (r /= 100), (t /= 100);
180
+ ((e = (e / 360) * 6), (r /= 100), (t /= 100));
178
181
  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;
179
182
  return {
180
183
  r: b(255 * [t, n, l, l, s, t][c]),
@@ -265,10 +268,10 @@ const i = (e, r = 0, t = 1) => (e > t ? t : e < r ? r : e), d = e => 'touches' i
265
268
  }, A = (e, r) => e.replace(/\s/g, '') === r.replace(/\s/g, '');
266
269
  function S(e, t, n) {
267
270
  const s = u(n), [c, i] = (0, react_1.useState)(() => e.toHsva(t)), d = (0, react_1.useRef)({ color: t, hsva: c });
268
- (0, react_1.useEffect)(() => {
271
+ ((0, react_1.useEffect)(() => {
269
272
  if (!e.equal(t, d.current.color)) {
270
273
  const r = e.toHsva(t);
271
- (d.current = { hsva: r, color: t }), i(r);
274
+ ((d.current = { hsva: r, color: t }), i(r));
272
275
  }
273
276
  }, [t, e]),
274
277
  (0, react_1.useEffect)(() => {
@@ -276,7 +279,7 @@ function S(e, t, n) {
276
279
  L(c, d.current.hsva) ||
277
280
  e.equal((r = e.fromHsva(c)), d.current.color) ||
278
281
  ((d.current = { hsva: c, color: r }), s(r));
279
- }, [c, e, s]);
282
+ }, [c, e, s]));
280
283
  const f = (0, react_1.useCallback)(e => {
281
284
  i(r => Object.assign({}, r, e));
282
285
  }, []);
@@ -291,11 +294,11 @@ const P = () => F || ('undefined' != typeof __webpack_nonce__ ? __webpack_nonce_
291
294
  const r = e.current ? e.current.ownerDocument : document;
292
295
  if (void 0 !== r && !Y.has(r)) {
293
296
  const e = r.createElement('style');
294
- (e.innerHTML =
297
+ ((e.innerHTML =
295
298
  '.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}'),
296
- Y.set(r, e);
299
+ Y.set(r, e));
297
300
  const t = P();
298
- t && e.setAttribute('nonce', t), r.head.appendChild(e);
301
+ (t && e.setAttribute('nonce', t), r.head.appendChild(e));
299
302
  }
300
303
  }, []);
301
304
  }, V = t => {
@@ -420,9 +423,10 @@ const P = () => F || ('undefined' != typeof __webpack_nonce__ ? __webpack_nonce_
420
423
  'process',
421
424
  ]), [g, p] = (0, react_1.useState)(() => d(t)), b = u(n), _ = u(i), x = (0, react_1.useCallback)(e => {
422
425
  const r = d(e.target.value);
423
- p(r), f(r) && b(v ? v(r) : r);
426
+ (p(r), f(r) && b(v ? v(r) : r));
424
427
  }, [d, v, f, b]), C = (0, react_1.useCallback)(e => {
425
- f(e.target.value) || p(d(t)), _(e);
428
+ ;
429
+ (f(e.target.value) || p(d(t)), _(e));
426
430
  }, [t, d, f, _]);
427
431
  return ((0, react_1.useEffect)(() => {
428
432
  p(d(t));
package/util/index.d.ts CHANGED
@@ -247,10 +247,16 @@ export declare function stripAlpha(str: string): string;
247
247
  export declare function getStrokeProps(str: string): {
248
248
  strokeOpacity: number;
249
249
  stroke: string;
250
+ } | {
251
+ strokeOpacity?: undefined;
252
+ stroke?: undefined;
250
253
  };
251
254
  export declare function getFillProps(str: string): {
252
255
  fillOpacity: number;
253
256
  fill: string;
257
+ } | {
258
+ fillOpacity?: undefined;
259
+ fill?: undefined;
254
260
  };
255
261
  export declare function renderToStaticMarkup(node: React.ReactElement): string;
256
262
  export declare function isGzip(buf: Uint8Array): boolean;
package/util/index.js CHANGED
@@ -962,18 +962,28 @@ function stripAlpha(str) {
962
962
  return (0, colord_1.colord)(str).alpha(1).toHex();
963
963
  }
964
964
  function getStrokeProps(str) {
965
- const c = (0, colord_1.colord)(str);
966
- return {
967
- strokeOpacity: c.alpha(),
968
- stroke: c.alpha(1).toHex(),
969
- };
965
+ if (str) {
966
+ const c = (0, colord_1.colord)(str);
967
+ return {
968
+ strokeOpacity: c.alpha(),
969
+ stroke: c.alpha(1).toHex(),
970
+ };
971
+ }
972
+ else {
973
+ return {};
974
+ }
970
975
  }
971
976
  function getFillProps(str) {
972
- const c = (0, colord_1.colord)(str);
973
- return {
974
- fillOpacity: c.alpha(),
975
- fill: c.alpha(1).toHex(),
976
- };
977
+ if (str) {
978
+ const c = (0, colord_1.colord)(str);
979
+ return {
980
+ fillOpacity: c.alpha(),
981
+ fill: c.alpha(1).toHex(),
982
+ };
983
+ }
984
+ else {
985
+ return {};
986
+ }
977
987
  }
978
988
  function renderToStaticMarkup(node) {
979
989
  const div = document.createElement('div');