react-sync-board 0.5.6 → 0.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.
- package/dist/cjs/index.js +472 -241
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +613 -402
- package/dist/esm/index.js.map +1 -1
- package/dist/react-sync-board.min.js +3 -3
- package/dist/react-sync-board.min.js.map +1 -1
- package/package.json +18 -18
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { forwardRef, useContext, createContext, createElement, Fragment, useRef, useLayoutEffect, useEffect, useMemo, memo } from 'react';
|
|
2
3
|
import { atom, selector, useRecoilValue, useRecoilCallback, useRecoilState, useSetRecoilState, RecoilRoot } from 'recoil';
|
|
3
4
|
|
|
4
5
|
function ownKeys(object, enumerableOnly) {
|
|
@@ -460,26 +461,17 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
460
461
|
};
|
|
461
462
|
}
|
|
462
463
|
|
|
463
|
-
// This file replaces `index.js` in bundlers like webpack or Rollup,
|
|
464
|
-
|
|
465
464
|
var nanoid = function nanoid() {
|
|
466
465
|
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 21;
|
|
467
466
|
var id = '';
|
|
468
|
-
var bytes = crypto.getRandomValues(new Uint8Array(size));
|
|
467
|
+
var bytes = crypto.getRandomValues(new Uint8Array(size));
|
|
469
468
|
|
|
470
469
|
while (size--) {
|
|
471
|
-
// It is incorrect to use bytes exceeding the alphabet size.
|
|
472
|
-
// The following mask reduces the random byte in the 0-255 value
|
|
473
|
-
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
474
|
-
// as empty string fallback or magic numbers, is unneccessary because
|
|
475
|
-
// the bitmask trims bytes down to the alphabet size.
|
|
476
470
|
var _byte = bytes[size] & 63;
|
|
477
471
|
|
|
478
472
|
if (_byte < 36) {
|
|
479
|
-
// `0-9a-z`
|
|
480
473
|
id += _byte.toString(36);
|
|
481
474
|
} else if (_byte < 62) {
|
|
482
|
-
// `A-Z`
|
|
483
475
|
id += (_byte - 26).toString(36).toUpperCase();
|
|
484
476
|
} else if (_byte < 63) {
|
|
485
477
|
id += '_';
|
|
@@ -771,7 +763,7 @@ function memoize(fn) {
|
|
|
771
763
|
};
|
|
772
764
|
}
|
|
773
765
|
|
|
774
|
-
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
766
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
775
767
|
|
|
776
768
|
var isPropValid = /* #__PURE__ */memoize(function (prop) {
|
|
777
769
|
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
|
@@ -844,7 +836,13 @@ var StyleSheet = /*#__PURE__*/function () {
|
|
|
844
836
|
var before;
|
|
845
837
|
|
|
846
838
|
if (_this.tags.length === 0) {
|
|
847
|
-
|
|
839
|
+
if (_this.insertionPoint) {
|
|
840
|
+
before = _this.insertionPoint.nextSibling;
|
|
841
|
+
} else if (_this.prepend) {
|
|
842
|
+
before = _this.container.firstChild;
|
|
843
|
+
} else {
|
|
844
|
+
before = _this.before;
|
|
845
|
+
}
|
|
848
846
|
} else {
|
|
849
847
|
before = _this.tags[_this.tags.length - 1].nextSibling;
|
|
850
848
|
}
|
|
@@ -862,6 +860,7 @@ var StyleSheet = /*#__PURE__*/function () {
|
|
|
862
860
|
this.key = options.key;
|
|
863
861
|
this.container = options.container;
|
|
864
862
|
this.prepend = options.prepend;
|
|
863
|
+
this.insertionPoint = options.insertionPoint;
|
|
865
864
|
this.before = null;
|
|
866
865
|
}
|
|
867
866
|
|
|
@@ -902,7 +901,7 @@ var StyleSheet = /*#__PURE__*/function () {
|
|
|
902
901
|
// the big drawback is that the css won't be editable in devtools
|
|
903
902
|
sheet.insertRule(rule, sheet.cssRules.length);
|
|
904
903
|
} catch (e) {
|
|
905
|
-
if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-ms-input-placeholder|-moz-read-write|-moz-read-only){/.test(rule)) {
|
|
904
|
+
if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear){/.test(rule)) {
|
|
906
905
|
console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
|
|
907
906
|
}
|
|
908
907
|
}
|
|
@@ -916,7 +915,7 @@ var StyleSheet = /*#__PURE__*/function () {
|
|
|
916
915
|
_proto.flush = function flush() {
|
|
917
916
|
// $FlowFixMe
|
|
918
917
|
this.tags.forEach(function (tag) {
|
|
919
|
-
return tag.parentNode.removeChild(tag);
|
|
918
|
+
return tag.parentNode && tag.parentNode.removeChild(tag);
|
|
920
919
|
});
|
|
921
920
|
this.tags = [];
|
|
922
921
|
this.ctr = 0;
|
|
@@ -949,13 +948,19 @@ var abs = Math.abs;
|
|
|
949
948
|
*/
|
|
950
949
|
|
|
951
950
|
var from = String.fromCharCode;
|
|
951
|
+
/**
|
|
952
|
+
* @param {object}
|
|
953
|
+
* @return {object}
|
|
954
|
+
*/
|
|
955
|
+
|
|
956
|
+
var assign = Object.assign;
|
|
952
957
|
/**
|
|
953
958
|
* @param {string} value
|
|
954
959
|
* @param {number} length
|
|
955
960
|
* @return {number}
|
|
956
961
|
*/
|
|
957
962
|
|
|
958
|
-
function hash(value, length) {
|
|
963
|
+
function hash$1(value, length) {
|
|
959
964
|
return (((length << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3);
|
|
960
965
|
}
|
|
961
966
|
/**
|
|
@@ -987,7 +992,7 @@ function replace(value, pattern, replacement) {
|
|
|
987
992
|
}
|
|
988
993
|
/**
|
|
989
994
|
* @param {string} value
|
|
990
|
-
* @param {string}
|
|
995
|
+
* @param {string} search
|
|
991
996
|
* @return {number}
|
|
992
997
|
*/
|
|
993
998
|
|
|
@@ -1056,11 +1061,11 @@ var character = 0;
|
|
|
1056
1061
|
var characters = '';
|
|
1057
1062
|
/**
|
|
1058
1063
|
* @param {string} value
|
|
1059
|
-
* @param {object} root
|
|
1060
|
-
* @param {object
|
|
1064
|
+
* @param {object | null} root
|
|
1065
|
+
* @param {object | null} parent
|
|
1061
1066
|
* @param {string} type
|
|
1062
|
-
* @param {string[]} props
|
|
1063
|
-
* @param {object[]} children
|
|
1067
|
+
* @param {string[] | string} props
|
|
1068
|
+
* @param {object[] | string} children
|
|
1064
1069
|
* @param {number} length
|
|
1065
1070
|
*/
|
|
1066
1071
|
|
|
@@ -1079,13 +1084,15 @@ function node(value, root, parent, type, props, children, length) {
|
|
|
1079
1084
|
};
|
|
1080
1085
|
}
|
|
1081
1086
|
/**
|
|
1082
|
-
* @param {string} value
|
|
1083
1087
|
* @param {object} root
|
|
1084
|
-
* @param {
|
|
1088
|
+
* @param {object} props
|
|
1089
|
+
* @return {object}
|
|
1085
1090
|
*/
|
|
1086
1091
|
|
|
1087
|
-
function copy(
|
|
1088
|
-
return node(
|
|
1092
|
+
function copy(root, props) {
|
|
1093
|
+
return assign(node('', null, null, '', null, null, 0), root, {
|
|
1094
|
+
length: -root.length
|
|
1095
|
+
}, props);
|
|
1089
1096
|
}
|
|
1090
1097
|
/**
|
|
1091
1098
|
* @return {number}
|
|
@@ -1244,7 +1251,8 @@ function delimiter(type) {
|
|
|
1244
1251
|
|
|
1245
1252
|
case 34:
|
|
1246
1253
|
case 39:
|
|
1247
|
-
|
|
1254
|
+
if (type !== 34 && type !== 39) delimiter(character);
|
|
1255
|
+
break;
|
|
1248
1256
|
// (
|
|
1249
1257
|
|
|
1250
1258
|
case 40:
|
|
@@ -1328,11 +1336,18 @@ function parse(value, root, parent, rule, rules, rulesets, pseudo, points, decla
|
|
|
1328
1336
|
|
|
1329
1337
|
while (scanning) {
|
|
1330
1338
|
switch (previous = character, character = next()) {
|
|
1331
|
-
//
|
|
1339
|
+
// (
|
|
1340
|
+
case 40:
|
|
1341
|
+
if (previous != 108 && characters.charCodeAt(length - 1) == 58) {
|
|
1342
|
+
if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1) ampersand = -1;
|
|
1343
|
+
break;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
// " ' [
|
|
1347
|
+
|
|
1332
1348
|
case 34:
|
|
1333
1349
|
case 39:
|
|
1334
1350
|
case 91:
|
|
1335
|
-
case 40:
|
|
1336
1351
|
characters += delimit(character);
|
|
1337
1352
|
break;
|
|
1338
1353
|
// \t \n \r \s
|
|
@@ -1398,7 +1413,7 @@ function parse(value, root, parent, rule, rules, rulesets, pseudo, points, decla
|
|
|
1398
1413
|
break;
|
|
1399
1414
|
|
|
1400
1415
|
default:
|
|
1401
|
-
parse(characters, reference, reference, reference, [''], children,
|
|
1416
|
+
parse(characters, reference, reference, reference, [''], children, 0, points, children);
|
|
1402
1417
|
}
|
|
1403
1418
|
}
|
|
1404
1419
|
|
|
@@ -1427,7 +1442,7 @@ function parse(value, root, parent, rule, rules, rulesets, pseudo, points, decla
|
|
|
1427
1442
|
case 64:
|
|
1428
1443
|
// -
|
|
1429
1444
|
if (peek() === 45) characters += delimit(next());
|
|
1430
|
-
atrule = peek(), offset = strlen(type = characters += identifier(caret())), character++;
|
|
1445
|
+
atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
|
|
1431
1446
|
break;
|
|
1432
1447
|
// -
|
|
1433
1448
|
|
|
@@ -1497,7 +1512,7 @@ function declaration(value, root, parent, length) {
|
|
|
1497
1512
|
*/
|
|
1498
1513
|
|
|
1499
1514
|
function prefix(value, length) {
|
|
1500
|
-
switch (hash(value, length)) {
|
|
1515
|
+
switch (hash$1(value, length)) {
|
|
1501
1516
|
// color-adjust
|
|
1502
1517
|
case 5103:
|
|
1503
1518
|
return WEBKIT + 'print-' + value + value;
|
|
@@ -1702,6 +1717,9 @@ function stringify(element, index, children, callback) {
|
|
|
1702
1717
|
case COMMENT:
|
|
1703
1718
|
return '';
|
|
1704
1719
|
|
|
1720
|
+
case KEYFRAMES:
|
|
1721
|
+
return element["return"] = element.value + '{' + serialize(element.children, callback) + '}';
|
|
1722
|
+
|
|
1705
1723
|
case RULESET:
|
|
1706
1724
|
element.value = element.props.join(',');
|
|
1707
1725
|
}
|
|
@@ -1744,13 +1762,15 @@ function rulesheet(callback) {
|
|
|
1744
1762
|
*/
|
|
1745
1763
|
|
|
1746
1764
|
function prefixer(element, index, children, callback) {
|
|
1747
|
-
if (!element["return"]) switch (element.type) {
|
|
1765
|
+
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
|
1748
1766
|
case DECLARATION:
|
|
1749
1767
|
element["return"] = prefix(element.value, element.length);
|
|
1750
1768
|
break;
|
|
1751
1769
|
|
|
1752
1770
|
case KEYFRAMES:
|
|
1753
|
-
return serialize([copy(
|
|
1771
|
+
return serialize([copy(element, {
|
|
1772
|
+
value: replace(element.value, '@', '@' + WEBKIT)
|
|
1773
|
+
})], callback);
|
|
1754
1774
|
|
|
1755
1775
|
case RULESET:
|
|
1756
1776
|
if (element.length) return combine(element.props, function (value) {
|
|
@@ -1758,11 +1778,19 @@ function prefixer(element, index, children, callback) {
|
|
|
1758
1778
|
// :read-(only|write)
|
|
1759
1779
|
case ':read-only':
|
|
1760
1780
|
case ':read-write':
|
|
1761
|
-
return serialize([copy(
|
|
1781
|
+
return serialize([copy(element, {
|
|
1782
|
+
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
|
1783
|
+
})], callback);
|
|
1762
1784
|
// :placeholder
|
|
1763
1785
|
|
|
1764
1786
|
case '::placeholder':
|
|
1765
|
-
return serialize([copy(
|
|
1787
|
+
return serialize([copy(element, {
|
|
1788
|
+
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
|
1789
|
+
}), copy(element, {
|
|
1790
|
+
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
|
1791
|
+
}), copy(element, {
|
|
1792
|
+
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
|
1793
|
+
})], callback);
|
|
1766
1794
|
}
|
|
1767
1795
|
|
|
1768
1796
|
return '';
|
|
@@ -1772,6 +1800,29 @@ function prefixer(element, index, children, callback) {
|
|
|
1772
1800
|
|
|
1773
1801
|
var last = function last(arr) {
|
|
1774
1802
|
return arr.length ? arr[arr.length - 1] : null;
|
|
1803
|
+
}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244
|
|
1804
|
+
|
|
1805
|
+
|
|
1806
|
+
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
|
1807
|
+
var previous = 0;
|
|
1808
|
+
var character = 0;
|
|
1809
|
+
|
|
1810
|
+
while (true) {
|
|
1811
|
+
previous = character;
|
|
1812
|
+
character = peek(); // &\f
|
|
1813
|
+
|
|
1814
|
+
if (previous === 38 && character === 12) {
|
|
1815
|
+
points[index] = 1;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
if (token(character)) {
|
|
1819
|
+
break;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
next();
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
return slice(begin, position);
|
|
1775
1826
|
};
|
|
1776
1827
|
|
|
1777
1828
|
var toRules = function toRules(parsed, points) {
|
|
@@ -1791,7 +1842,7 @@ var toRules = function toRules(parsed, points) {
|
|
|
1791
1842
|
points[index] = 1;
|
|
1792
1843
|
}
|
|
1793
1844
|
|
|
1794
|
-
parsed[index] +=
|
|
1845
|
+
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
|
1795
1846
|
break;
|
|
1796
1847
|
|
|
1797
1848
|
case 2:
|
|
@@ -1825,8 +1876,9 @@ var getRules = function getRules(value, points) {
|
|
|
1825
1876
|
var fixedElements = /* #__PURE__ */new WeakMap();
|
|
1826
1877
|
|
|
1827
1878
|
var compat = function compat(element) {
|
|
1828
|
-
if (element.type !== 'rule' || !element.parent || // .length indicates
|
|
1829
|
-
|
|
1879
|
+
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
|
1880
|
+
// negative .length indicates that this rule has been already prefixed
|
|
1881
|
+
element.length < 1) {
|
|
1830
1882
|
return;
|
|
1831
1883
|
}
|
|
1832
1884
|
|
|
@@ -2062,7 +2114,8 @@ var createCache = function createCache(options) {
|
|
|
2062
2114
|
container: container,
|
|
2063
2115
|
nonce: options.nonce,
|
|
2064
2116
|
speedy: options.speedy,
|
|
2065
|
-
prepend: options.prepend
|
|
2117
|
+
prepend: options.prepend,
|
|
2118
|
+
insertionPoint: options.insertionPoint
|
|
2066
2119
|
}),
|
|
2067
2120
|
nonce: options.nonce,
|
|
2068
2121
|
inserted: inserted,
|
|
@@ -2080,22 +2133,22 @@ var reactIs$1 = {exports: {}};
|
|
|
2080
2133
|
var reactIs_production_min = {};
|
|
2081
2134
|
|
|
2082
2135
|
var b = "function" === typeof Symbol && Symbol["for"],
|
|
2083
|
-
c
|
|
2136
|
+
c = b ? Symbol["for"]("react.element") : 60103,
|
|
2084
2137
|
d = b ? Symbol["for"]("react.portal") : 60106,
|
|
2085
|
-
e
|
|
2086
|
-
f
|
|
2138
|
+
e = b ? Symbol["for"]("react.fragment") : 60107,
|
|
2139
|
+
f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
|
2087
2140
|
g = b ? Symbol["for"]("react.profiler") : 60114,
|
|
2088
2141
|
h = b ? Symbol["for"]("react.provider") : 60109,
|
|
2089
2142
|
k = b ? Symbol["for"]("react.context") : 60110,
|
|
2090
|
-
l
|
|
2143
|
+
l = b ? Symbol["for"]("react.async_mode") : 60111,
|
|
2091
2144
|
m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
|
2092
|
-
n
|
|
2145
|
+
n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
|
2093
2146
|
p = b ? Symbol["for"]("react.suspense") : 60113,
|
|
2094
2147
|
q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
|
2095
2148
|
r$1 = b ? Symbol["for"]("react.memo") : 60115,
|
|
2096
|
-
t
|
|
2149
|
+
t = b ? Symbol["for"]("react.lazy") : 60116,
|
|
2097
2150
|
v = b ? Symbol["for"]("react.block") : 60121,
|
|
2098
|
-
w
|
|
2151
|
+
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
2099
2152
|
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
2100
2153
|
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
2101
2154
|
|
|
@@ -2104,21 +2157,21 @@ function z(a) {
|
|
|
2104
2157
|
var u = a.$$typeof;
|
|
2105
2158
|
|
|
2106
2159
|
switch (u) {
|
|
2107
|
-
case c
|
|
2160
|
+
case c:
|
|
2108
2161
|
switch (a = a.type, a) {
|
|
2109
|
-
case l
|
|
2162
|
+
case l:
|
|
2110
2163
|
case m:
|
|
2111
|
-
case e
|
|
2164
|
+
case e:
|
|
2112
2165
|
case g:
|
|
2113
|
-
case f
|
|
2166
|
+
case f:
|
|
2114
2167
|
case p:
|
|
2115
2168
|
return a;
|
|
2116
2169
|
|
|
2117
2170
|
default:
|
|
2118
2171
|
switch (a = a && a.$$typeof, a) {
|
|
2119
2172
|
case k:
|
|
2120
|
-
case n
|
|
2121
|
-
case t
|
|
2173
|
+
case n:
|
|
2174
|
+
case t:
|
|
2122
2175
|
case r$1:
|
|
2123
2176
|
case h:
|
|
2124
2177
|
return a;
|
|
@@ -2139,22 +2192,22 @@ function A(a) {
|
|
|
2139
2192
|
return z(a) === m;
|
|
2140
2193
|
}
|
|
2141
2194
|
|
|
2142
|
-
reactIs_production_min.AsyncMode = l
|
|
2195
|
+
reactIs_production_min.AsyncMode = l;
|
|
2143
2196
|
reactIs_production_min.ConcurrentMode = m;
|
|
2144
2197
|
reactIs_production_min.ContextConsumer = k;
|
|
2145
2198
|
reactIs_production_min.ContextProvider = h;
|
|
2146
|
-
reactIs_production_min.Element = c
|
|
2147
|
-
reactIs_production_min.ForwardRef = n
|
|
2148
|
-
reactIs_production_min.Fragment = e
|
|
2149
|
-
reactIs_production_min.Lazy = t
|
|
2199
|
+
reactIs_production_min.Element = c;
|
|
2200
|
+
reactIs_production_min.ForwardRef = n;
|
|
2201
|
+
reactIs_production_min.Fragment = e;
|
|
2202
|
+
reactIs_production_min.Lazy = t;
|
|
2150
2203
|
reactIs_production_min.Memo = r$1;
|
|
2151
2204
|
reactIs_production_min.Portal = d;
|
|
2152
2205
|
reactIs_production_min.Profiler = g;
|
|
2153
|
-
reactIs_production_min.StrictMode = f
|
|
2206
|
+
reactIs_production_min.StrictMode = f;
|
|
2154
2207
|
reactIs_production_min.Suspense = p;
|
|
2155
2208
|
|
|
2156
2209
|
reactIs_production_min.isAsyncMode = function (a) {
|
|
2157
|
-
return A(a) || z(a) === l
|
|
2210
|
+
return A(a) || z(a) === l;
|
|
2158
2211
|
};
|
|
2159
2212
|
|
|
2160
2213
|
reactIs_production_min.isConcurrentMode = A;
|
|
@@ -2168,19 +2221,19 @@ reactIs_production_min.isContextProvider = function (a) {
|
|
|
2168
2221
|
};
|
|
2169
2222
|
|
|
2170
2223
|
reactIs_production_min.isElement = function (a) {
|
|
2171
|
-
return "object" === _typeof(a) && null !== a && a.$$typeof === c
|
|
2224
|
+
return "object" === _typeof(a) && null !== a && a.$$typeof === c;
|
|
2172
2225
|
};
|
|
2173
2226
|
|
|
2174
2227
|
reactIs_production_min.isForwardRef = function (a) {
|
|
2175
|
-
return z(a) === n
|
|
2228
|
+
return z(a) === n;
|
|
2176
2229
|
};
|
|
2177
2230
|
|
|
2178
2231
|
reactIs_production_min.isFragment = function (a) {
|
|
2179
|
-
return z(a) === e
|
|
2232
|
+
return z(a) === e;
|
|
2180
2233
|
};
|
|
2181
2234
|
|
|
2182
2235
|
reactIs_production_min.isLazy = function (a) {
|
|
2183
|
-
return z(a) === t
|
|
2236
|
+
return z(a) === t;
|
|
2184
2237
|
};
|
|
2185
2238
|
|
|
2186
2239
|
reactIs_production_min.isMemo = function (a) {
|
|
@@ -2196,7 +2249,7 @@ reactIs_production_min.isProfiler = function (a) {
|
|
|
2196
2249
|
};
|
|
2197
2250
|
|
|
2198
2251
|
reactIs_production_min.isStrictMode = function (a) {
|
|
2199
|
-
return z(a) === f
|
|
2252
|
+
return z(a) === f;
|
|
2200
2253
|
};
|
|
2201
2254
|
|
|
2202
2255
|
reactIs_production_min.isSuspense = function (a) {
|
|
@@ -2204,7 +2257,7 @@ reactIs_production_min.isSuspense = function (a) {
|
|
|
2204
2257
|
};
|
|
2205
2258
|
|
|
2206
2259
|
reactIs_production_min.isValidElementType = function (a) {
|
|
2207
|
-
return "string" === typeof a || "function" === typeof a || a === e
|
|
2260
|
+
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof(a) && null !== a && (a.$$typeof === t || a.$$typeof === r$1 || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
2208
2261
|
};
|
|
2209
2262
|
|
|
2210
2263
|
reactIs_production_min.typeOf = z;
|
|
@@ -2430,7 +2483,7 @@ function getRegisteredStyles$1(registered, registeredStyles, classNames) {
|
|
|
2430
2483
|
return rawClassName;
|
|
2431
2484
|
}
|
|
2432
2485
|
|
|
2433
|
-
var
|
|
2486
|
+
var registerStyles$1 = function registerStyles(cache, serialized, isStringTag) {
|
|
2434
2487
|
var className = cache.key + "-" + serialized.name;
|
|
2435
2488
|
|
|
2436
2489
|
if ( // we only need to add the styles to the registered cache if the
|
|
@@ -2445,6 +2498,11 @@ var insertStyles$1 = function insertStyles(cache, serialized, isStringTag) {
|
|
|
2445
2498
|
isBrowser$3 === false) && cache.registered[className] === undefined) {
|
|
2446
2499
|
cache.registered[className] = serialized.styles;
|
|
2447
2500
|
}
|
|
2501
|
+
};
|
|
2502
|
+
|
|
2503
|
+
var insertStyles$1 = function insertStyles(cache, serialized, isStringTag) {
|
|
2504
|
+
registerStyles$1(cache, serialized, isStringTag);
|
|
2505
|
+
var className = cache.key + "-" + serialized.name;
|
|
2448
2506
|
|
|
2449
2507
|
if (cache.inserted[serialized.name] === undefined) {
|
|
2450
2508
|
var current = serialized;
|
|
@@ -2602,7 +2660,7 @@ var processStyleValue$1 = function processStyleValue(key, value) {
|
|
|
2602
2660
|
};
|
|
2603
2661
|
|
|
2604
2662
|
if (process.env.NODE_ENV !== 'production') {
|
|
2605
|
-
var contentValuePattern$1 = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
|
|
2663
|
+
var contentValuePattern$1 = /(var|attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
|
|
2606
2664
|
var contentValues$1 = ['normal', 'none', 'initial', 'inherit', 'unset'];
|
|
2607
2665
|
var oldProcessStyleValue$1 = processStyleValue$1;
|
|
2608
2666
|
var msPattern$1 = /^-ms-/;
|
|
@@ -2869,7 +2927,7 @@ var serializeStyles$1 = function serializeStyles(args, registered, mergedProps)
|
|
|
2869
2927
|
};
|
|
2870
2928
|
};
|
|
2871
2929
|
|
|
2872
|
-
var hasOwnProperty =
|
|
2930
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
|
2873
2931
|
var EmotionCacheContext = /* #__PURE__ */createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
2874
2932
|
// because this module is primarily intended for the browser and node
|
|
2875
2933
|
// but it's also required in react native and similar environments sometimes
|
|
@@ -2879,6 +2937,11 @@ var EmotionCacheContext = /* #__PURE__ */createContext( // we're doing this to a
|
|
|
2879
2937
|
typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
|
|
2880
2938
|
key: 'css'
|
|
2881
2939
|
}) : null);
|
|
2940
|
+
|
|
2941
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2942
|
+
EmotionCacheContext.displayName = 'EmotionCacheContext';
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2882
2945
|
EmotionCacheContext.Provider;
|
|
2883
2946
|
|
|
2884
2947
|
var withEmotionCache = function withEmotionCache(func) {
|
|
@@ -2892,9 +2955,32 @@ var withEmotionCache = function withEmotionCache(func) {
|
|
|
2892
2955
|
|
|
2893
2956
|
var ThemeContext = /* #__PURE__ */createContext({});
|
|
2894
2957
|
|
|
2958
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2959
|
+
ThemeContext.displayName = 'EmotionThemeContext';
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
var useInsertionEffect$2 = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
|
|
2963
|
+
create();
|
|
2964
|
+
};
|
|
2965
|
+
|
|
2966
|
+
function useInsertionEffectMaybe$1(create) {
|
|
2967
|
+
useInsertionEffect$2(create);
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2895
2970
|
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
|
|
2896
2971
|
var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
|
|
2897
2972
|
|
|
2973
|
+
var Insertion$2 = function Insertion(_ref) {
|
|
2974
|
+
var cache = _ref.cache,
|
|
2975
|
+
serialized = _ref.serialized,
|
|
2976
|
+
isStringTag = _ref.isStringTag;
|
|
2977
|
+
registerStyles$1(cache, serialized, isStringTag);
|
|
2978
|
+
useInsertionEffectMaybe$1(function () {
|
|
2979
|
+
return insertStyles$1(cache, serialized, isStringTag);
|
|
2980
|
+
});
|
|
2981
|
+
return null;
|
|
2982
|
+
};
|
|
2983
|
+
|
|
2898
2984
|
var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
2899
2985
|
var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
|
|
2900
2986
|
// not passing the registered cache to serializeStyles because it would
|
|
@@ -2904,7 +2990,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
2904
2990
|
cssProp = cache.registered[cssProp];
|
|
2905
2991
|
}
|
|
2906
2992
|
|
|
2907
|
-
var
|
|
2993
|
+
var WrappedComponent = props[typePropName];
|
|
2908
2994
|
var registeredStyles = [cssProp];
|
|
2909
2995
|
var className = '';
|
|
2910
2996
|
|
|
@@ -2914,7 +3000,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
2914
3000
|
className = props.className + " ";
|
|
2915
3001
|
}
|
|
2916
3002
|
|
|
2917
|
-
var serialized = serializeStyles$1(registeredStyles, undefined,
|
|
3003
|
+
var serialized = serializeStyles$1(registeredStyles, undefined, useContext(ThemeContext));
|
|
2918
3004
|
|
|
2919
3005
|
if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
|
|
2920
3006
|
var labelFromStack = props[labelPropName];
|
|
@@ -2924,7 +3010,6 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
2924
3010
|
}
|
|
2925
3011
|
}
|
|
2926
3012
|
|
|
2927
|
-
insertStyles$1(cache, serialized, typeof type === 'string');
|
|
2928
3013
|
className += cache.key + "-" + serialized.name;
|
|
2929
3014
|
var newProps = {};
|
|
2930
3015
|
|
|
@@ -2936,8 +3021,11 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
2936
3021
|
|
|
2937
3022
|
newProps.ref = ref;
|
|
2938
3023
|
newProps.className = className;
|
|
2939
|
-
|
|
2940
|
-
|
|
3024
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion$2, {
|
|
3025
|
+
cache: cache,
|
|
3026
|
+
serialized: serialized,
|
|
3027
|
+
isStringTag: typeof WrappedComponent === 'string'
|
|
3028
|
+
}), /*#__PURE__*/createElement(WrappedComponent, newProps));
|
|
2941
3029
|
});
|
|
2942
3030
|
|
|
2943
3031
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2946,7 +3034,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2946
3034
|
|
|
2947
3035
|
var pkg = {
|
|
2948
3036
|
name: "@emotion/react",
|
|
2949
|
-
version: "11.
|
|
3037
|
+
version: "11.9.0",
|
|
2950
3038
|
main: "dist/emotion-react.cjs.js",
|
|
2951
3039
|
module: "dist/emotion-react.esm.js",
|
|
2952
3040
|
browser: {
|
|
@@ -2954,19 +3042,19 @@ var pkg = {
|
|
|
2954
3042
|
"./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
|
|
2955
3043
|
},
|
|
2956
3044
|
types: "types/index.d.ts",
|
|
2957
|
-
files: ["src", "dist", "jsx-runtime", "jsx-dev-runtime", "
|
|
3045
|
+
files: ["src", "dist", "jsx-runtime", "jsx-dev-runtime", "_isolated-hnrs", "types/*.d.ts", "macro.js", "macro.d.ts", "macro.js.flow"],
|
|
2958
3046
|
sideEffects: false,
|
|
2959
|
-
author: "
|
|
3047
|
+
author: "Emotion Contributors",
|
|
2960
3048
|
license: "MIT",
|
|
2961
3049
|
scripts: {
|
|
2962
3050
|
"test:typescript": "dtslint types"
|
|
2963
3051
|
},
|
|
2964
3052
|
dependencies: {
|
|
2965
3053
|
"@babel/runtime": "^7.13.10",
|
|
2966
|
-
"@emotion/
|
|
2967
|
-
"@emotion/
|
|
2968
|
-
"@emotion/
|
|
2969
|
-
"@emotion/utils": "^1.
|
|
3054
|
+
"@emotion/babel-plugin": "^11.7.1",
|
|
3055
|
+
"@emotion/cache": "^11.7.1",
|
|
3056
|
+
"@emotion/serialize": "^1.0.3",
|
|
3057
|
+
"@emotion/utils": "^1.1.0",
|
|
2970
3058
|
"@emotion/weak-memoize": "^0.2.5",
|
|
2971
3059
|
"hoist-non-react-statics": "^3.3.1"
|
|
2972
3060
|
},
|
|
@@ -2984,15 +3072,16 @@ var pkg = {
|
|
|
2984
3072
|
},
|
|
2985
3073
|
devDependencies: {
|
|
2986
3074
|
"@babel/core": "^7.13.10",
|
|
2987
|
-
"@emotion/css": "11.
|
|
2988
|
-
"@emotion/css-prettifier": "1.0.
|
|
3075
|
+
"@emotion/css": "11.9.0",
|
|
3076
|
+
"@emotion/css-prettifier": "1.0.1",
|
|
2989
3077
|
"@emotion/server": "11.4.0",
|
|
2990
|
-
"@emotion/styled": "11.
|
|
3078
|
+
"@emotion/styled": "11.8.1",
|
|
2991
3079
|
"@types/react": "^16.9.11",
|
|
2992
|
-
dtslint: "^
|
|
3080
|
+
dtslint: "^4.2.1",
|
|
2993
3081
|
"html-tag-names": "^1.1.2",
|
|
2994
3082
|
react: "16.14.0",
|
|
2995
|
-
"svg-tag-names": "^1.1.1"
|
|
3083
|
+
"svg-tag-names": "^1.1.1",
|
|
3084
|
+
typescript: "^4.5.5"
|
|
2996
3085
|
},
|
|
2997
3086
|
repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
|
|
2998
3087
|
publishConfig: {
|
|
@@ -3000,11 +3089,12 @@ var pkg = {
|
|
|
3000
3089
|
},
|
|
3001
3090
|
"umd:main": "dist/emotion-react.umd.min.js",
|
|
3002
3091
|
preconstruct: {
|
|
3003
|
-
entrypoints: ["./index.js", "./jsx-runtime.js", "./jsx-dev-runtime.js", "./
|
|
3092
|
+
entrypoints: ["./index.js", "./jsx-runtime.js", "./jsx-dev-runtime.js", "./_isolated-hnrs.js"],
|
|
3004
3093
|
umdName: "emotionReact"
|
|
3005
3094
|
}
|
|
3006
3095
|
};
|
|
3007
3096
|
|
|
3097
|
+
var useInsertionEffect$1 = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : useLayoutEffect;
|
|
3008
3098
|
var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
|
|
3009
3099
|
// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
|
|
3010
3100
|
// initial client-side render from SSR, use place of hydrating tag
|
|
@@ -3020,14 +3110,15 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
3020
3110
|
}
|
|
3021
3111
|
|
|
3022
3112
|
var styles = props.styles;
|
|
3023
|
-
var serialized = serializeStyles$1([styles], undefined,
|
|
3113
|
+
var serialized = serializeStyles$1([styles], undefined, useContext(ThemeContext)); // but it is based on a constant that will never change at runtime
|
|
3024
3114
|
// it's effectively like having two implementations and switching them out
|
|
3025
3115
|
// so it's not actually breaking anything
|
|
3026
3116
|
|
|
3027
3117
|
var sheetRef = useRef();
|
|
3028
|
-
|
|
3029
|
-
var key = cache.key + "-global";
|
|
3030
|
-
|
|
3118
|
+
useInsertionEffect$1(function () {
|
|
3119
|
+
var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
|
|
3120
|
+
|
|
3121
|
+
var sheet = new cache.sheet.constructor({
|
|
3031
3122
|
key: key,
|
|
3032
3123
|
nonce: cache.sheet.nonce,
|
|
3033
3124
|
container: cache.sheet.container,
|
|
@@ -3053,7 +3144,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
3053
3144
|
sheet.flush();
|
|
3054
3145
|
};
|
|
3055
3146
|
}, [cache]);
|
|
3056
|
-
|
|
3147
|
+
useInsertionEffect$1(function () {
|
|
3057
3148
|
var sheetRefCurrent = sheetRef.current;
|
|
3058
3149
|
var sheet = sheetRefCurrent[0],
|
|
3059
3150
|
rehydrating = sheetRefCurrent[1];
|
|
@@ -3168,8 +3259,20 @@ function merge(registered, css, className) {
|
|
|
3168
3259
|
return rawClassName + css(registeredStyles);
|
|
3169
3260
|
}
|
|
3170
3261
|
|
|
3262
|
+
var Insertion$1 = function Insertion(_ref) {
|
|
3263
|
+
var cache = _ref.cache,
|
|
3264
|
+
serializedArr = _ref.serializedArr;
|
|
3265
|
+
useInsertionEffectMaybe$1(function () {
|
|
3266
|
+
for (var i = 0; i < serializedArr.length; i++) {
|
|
3267
|
+
insertStyles$1(cache, serializedArr[i], false);
|
|
3268
|
+
}
|
|
3269
|
+
});
|
|
3270
|
+
return null;
|
|
3271
|
+
};
|
|
3272
|
+
|
|
3171
3273
|
var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
3172
3274
|
var hasRendered = false;
|
|
3275
|
+
var serializedArr = [];
|
|
3173
3276
|
|
|
3174
3277
|
var css = function css() {
|
|
3175
3278
|
if (hasRendered && process.env.NODE_ENV !== 'production') {
|
|
@@ -3181,9 +3284,9 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
3181
3284
|
}
|
|
3182
3285
|
|
|
3183
3286
|
var serialized = serializeStyles$1(args, cache.registered);
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3287
|
+
serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
|
|
3288
|
+
|
|
3289
|
+
registerStyles$1(cache, serialized, false);
|
|
3187
3290
|
return cache.key + "-" + serialized.name;
|
|
3188
3291
|
};
|
|
3189
3292
|
|
|
@@ -3206,7 +3309,10 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
3206
3309
|
};
|
|
3207
3310
|
var ele = props.children(content);
|
|
3208
3311
|
hasRendered = true;
|
|
3209
|
-
return
|
|
3312
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion$1, {
|
|
3313
|
+
cache: cache,
|
|
3314
|
+
serializedArr: serializedArr
|
|
3315
|
+
}), ele);
|
|
3210
3316
|
});
|
|
3211
3317
|
|
|
3212
3318
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -3219,7 +3325,10 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
3219
3325
|
var isJest = typeof jest !== 'undefined';
|
|
3220
3326
|
|
|
3221
3327
|
if (isBrowser$2 && !isJest) {
|
|
3222
|
-
|
|
3328
|
+
// globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
|
|
3329
|
+
var globalContext = // $FlowIgnore
|
|
3330
|
+
typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef
|
|
3331
|
+
: isBrowser$2 ? window : global;
|
|
3223
3332
|
var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__";
|
|
3224
3333
|
|
|
3225
3334
|
if (globalContext[globalKey]) {
|
|
@@ -3244,7 +3353,7 @@ function getRegisteredStyles(registered, registeredStyles, classNames) {
|
|
|
3244
3353
|
return rawClassName;
|
|
3245
3354
|
}
|
|
3246
3355
|
|
|
3247
|
-
var
|
|
3356
|
+
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
|
|
3248
3357
|
var className = cache.key + "-" + serialized.name;
|
|
3249
3358
|
|
|
3250
3359
|
if ( // we only need to add the styles to the registered cache if the
|
|
@@ -3259,6 +3368,11 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
|
|
|
3259
3368
|
isBrowser$1 === false) && cache.registered[className] === undefined) {
|
|
3260
3369
|
cache.registered[className] = serialized.styles;
|
|
3261
3370
|
}
|
|
3371
|
+
};
|
|
3372
|
+
|
|
3373
|
+
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
|
|
3374
|
+
registerStyles(cache, serialized, isStringTag);
|
|
3375
|
+
var className = cache.key + "-" + serialized.name;
|
|
3262
3376
|
|
|
3263
3377
|
if (cache.inserted[serialized.name] === undefined) {
|
|
3264
3378
|
var current = serialized;
|
|
@@ -3610,8 +3724,27 @@ var composeShouldForwardProps = function composeShouldForwardProps(tag, options,
|
|
|
3610
3724
|
return shouldForwardProp;
|
|
3611
3725
|
};
|
|
3612
3726
|
|
|
3727
|
+
var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
|
|
3728
|
+
create();
|
|
3729
|
+
};
|
|
3730
|
+
|
|
3731
|
+
function useInsertionEffectMaybe(create) {
|
|
3732
|
+
useInsertionEffect(create);
|
|
3733
|
+
}
|
|
3734
|
+
|
|
3613
3735
|
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
|
|
3614
3736
|
|
|
3737
|
+
var Insertion = function Insertion(_ref) {
|
|
3738
|
+
var cache = _ref.cache,
|
|
3739
|
+
serialized = _ref.serialized,
|
|
3740
|
+
isStringTag = _ref.isStringTag;
|
|
3741
|
+
registerStyles(cache, serialized, isStringTag);
|
|
3742
|
+
useInsertionEffectMaybe(function () {
|
|
3743
|
+
return insertStyles(cache, serialized, isStringTag);
|
|
3744
|
+
});
|
|
3745
|
+
return null;
|
|
3746
|
+
};
|
|
3747
|
+
|
|
3615
3748
|
var createStyled = function createStyled(tag, options) {
|
|
3616
3749
|
if (process.env.NODE_ENV !== 'production') {
|
|
3617
3750
|
if (tag === undefined) {
|
|
@@ -3662,7 +3795,7 @@ var createStyled = function createStyled(tag, options) {
|
|
|
3662
3795
|
|
|
3663
3796
|
|
|
3664
3797
|
var Styled = withEmotionCache(function (props, cache, ref) {
|
|
3665
|
-
var
|
|
3798
|
+
var FinalTag = shouldUseAs && props.as || baseTag;
|
|
3666
3799
|
var className = '';
|
|
3667
3800
|
var classInterpolations = [];
|
|
3668
3801
|
var mergedProps = props;
|
|
@@ -3684,14 +3817,13 @@ var createStyled = function createStyled(tag, options) {
|
|
|
3684
3817
|
}
|
|
3685
3818
|
|
|
3686
3819
|
var serialized = serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
|
|
3687
|
-
insertStyles(cache, serialized, typeof finalTag === 'string');
|
|
3688
3820
|
className += cache.key + "-" + serialized.name;
|
|
3689
3821
|
|
|
3690
3822
|
if (targetClassName !== undefined) {
|
|
3691
3823
|
className += " " + targetClassName;
|
|
3692
3824
|
}
|
|
3693
3825
|
|
|
3694
|
-
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(
|
|
3826
|
+
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
|
|
3695
3827
|
var newProps = {};
|
|
3696
3828
|
|
|
3697
3829
|
for (var _key in props) {
|
|
@@ -3705,8 +3837,11 @@ var createStyled = function createStyled(tag, options) {
|
|
|
3705
3837
|
|
|
3706
3838
|
newProps.className = className;
|
|
3707
3839
|
newProps.ref = ref;
|
|
3708
|
-
|
|
3709
|
-
|
|
3840
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
|
|
3841
|
+
cache: cache,
|
|
3842
|
+
serialized: serialized,
|
|
3843
|
+
isStringTag: typeof FinalTag === 'string'
|
|
3844
|
+
}), /*#__PURE__*/createElement(FinalTag, newProps));
|
|
3710
3845
|
});
|
|
3711
3846
|
Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
|
|
3712
3847
|
Styled.defaultProps = tag.defaultProps;
|
|
@@ -3783,12 +3918,12 @@ var StyledSpinner = newStyled.div(_templateObject2$1 || (_templateObject2$1 = _t
|
|
|
3783
3918
|
var Spinner = function Spinner(_ref12) {
|
|
3784
3919
|
var _ref12$size = _ref12.size,
|
|
3785
3920
|
size = _ref12$size === void 0 ? 100 : _ref12$size;
|
|
3786
|
-
return /*#__PURE__*/
|
|
3921
|
+
return /*#__PURE__*/React__default.createElement(StyledSpinner, {
|
|
3787
3922
|
size: size
|
|
3788
3923
|
});
|
|
3789
3924
|
};
|
|
3790
3925
|
|
|
3791
|
-
var Context = /*#__PURE__*/
|
|
3926
|
+
var Context = /*#__PURE__*/React__default.createContext();
|
|
3792
3927
|
var WireProvider = function WireProvider(_ref) {
|
|
3793
3928
|
var socket = _ref.socket,
|
|
3794
3929
|
room = _ref.room,
|
|
@@ -3796,31 +3931,31 @@ var WireProvider = function WireProvider(_ref) {
|
|
|
3796
3931
|
channel = _ref$channel === void 0 ? "default" : _ref$channel,
|
|
3797
3932
|
children = _ref.children;
|
|
3798
3933
|
|
|
3799
|
-
var _React$useState =
|
|
3934
|
+
var _React$useState = React__default.useState(false),
|
|
3800
3935
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3801
3936
|
joined = _React$useState2[0],
|
|
3802
3937
|
setJoined = _React$useState2[1];
|
|
3803
3938
|
|
|
3804
|
-
var _React$useState3 =
|
|
3939
|
+
var _React$useState3 = React__default.useState(false),
|
|
3805
3940
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3806
3941
|
isMaster = _React$useState4[0],
|
|
3807
3942
|
setIsMaster = _React$useState4[1];
|
|
3808
3943
|
|
|
3809
|
-
var _React$useState5 =
|
|
3944
|
+
var _React$useState5 = React__default.useState(null),
|
|
3810
3945
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3811
3946
|
wire = _React$useState6[0],
|
|
3812
3947
|
setWire = _React$useState6[1];
|
|
3813
3948
|
|
|
3814
|
-
var roomRef =
|
|
3815
|
-
var mountedRef =
|
|
3949
|
+
var roomRef = React__default.useRef(null);
|
|
3950
|
+
var mountedRef = React__default.useRef(false);
|
|
3816
3951
|
var existingC2C = useContext(Context);
|
|
3817
|
-
|
|
3952
|
+
React__default.useEffect(function () {
|
|
3818
3953
|
mountedRef.current = true;
|
|
3819
3954
|
return function () {
|
|
3820
3955
|
mountedRef.current = false;
|
|
3821
3956
|
};
|
|
3822
3957
|
}, []);
|
|
3823
|
-
|
|
3958
|
+
React__default.useEffect(function () {
|
|
3824
3959
|
if (!socket) {
|
|
3825
3960
|
return null;
|
|
3826
3961
|
}
|
|
@@ -3837,7 +3972,7 @@ var WireProvider = function WireProvider(_ref) {
|
|
|
3837
3972
|
socket.off("disconnect", disconnect);
|
|
3838
3973
|
};
|
|
3839
3974
|
}, [channel, socket]);
|
|
3840
|
-
|
|
3975
|
+
React__default.useEffect(function () {
|
|
3841
3976
|
// Connect
|
|
3842
3977
|
if (!socket) {
|
|
3843
3978
|
return null;
|
|
@@ -3872,7 +4007,7 @@ var WireProvider = function WireProvider(_ref) {
|
|
|
3872
4007
|
}, [channel, room, socket]);
|
|
3873
4008
|
|
|
3874
4009
|
if (!joined || !wire) {
|
|
3875
|
-
return /*#__PURE__*/
|
|
4010
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
3876
4011
|
style: {
|
|
3877
4012
|
position: "absolute",
|
|
3878
4013
|
top: "0",
|
|
@@ -3882,10 +4017,10 @@ var WireProvider = function WireProvider(_ref) {
|
|
|
3882
4017
|
justifyContent: "center",
|
|
3883
4018
|
alignItems: "center"
|
|
3884
4019
|
}
|
|
3885
|
-
}, /*#__PURE__*/
|
|
4020
|
+
}, /*#__PURE__*/React__default.createElement(Spinner, null));
|
|
3886
4021
|
}
|
|
3887
4022
|
|
|
3888
|
-
return /*#__PURE__*/
|
|
4023
|
+
return /*#__PURE__*/React__default.createElement(Context.Provider, {
|
|
3889
4024
|
value: _objectSpread2(_objectSpread2({}, existingC2C), {}, _defineProperty({}, channel, {
|
|
3890
4025
|
wire: wire,
|
|
3891
4026
|
joined: joined,
|
|
@@ -4405,15 +4540,15 @@ var Gesture = function Gesture(_ref6) {
|
|
|
4405
4540
|
_ref6$onDoubleTap = _ref6.onDoubleTap,
|
|
4406
4541
|
onDoubleTap = _ref6$onDoubleTap === void 0 ? empty : _ref6$onDoubleTap,
|
|
4407
4542
|
onZoom = _ref6.onZoom;
|
|
4408
|
-
var wrapperRef =
|
|
4409
|
-
var stateRef =
|
|
4543
|
+
var wrapperRef = React__default.useRef(null);
|
|
4544
|
+
var stateRef = React__default.useRef({
|
|
4410
4545
|
moving: false,
|
|
4411
4546
|
pointers: {},
|
|
4412
4547
|
mainPointer: undefined
|
|
4413
4548
|
});
|
|
4414
|
-
var queueRef =
|
|
4549
|
+
var queueRef = React__default.useRef([]); // Queue event to avoid async mess
|
|
4415
4550
|
|
|
4416
|
-
var queue =
|
|
4551
|
+
var queue = React__default.useCallback(function (callback, args) {
|
|
4417
4552
|
queueRef.current.push( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
4418
4553
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
4419
4554
|
while (1) {
|
|
@@ -4445,7 +4580,7 @@ var Gesture = function Gesture(_ref6) {
|
|
|
4445
4580
|
protect(queueRef.current[0])();
|
|
4446
4581
|
}
|
|
4447
4582
|
}, []);
|
|
4448
|
-
var onWheel =
|
|
4583
|
+
var onWheel = React__default.useCallback(function (e) {
|
|
4449
4584
|
var deltaX = e.deltaX,
|
|
4450
4585
|
deltaY = e.deltaY,
|
|
4451
4586
|
clientX = e.clientX,
|
|
@@ -4504,7 +4639,7 @@ var Gesture = function Gesture(_ref6) {
|
|
|
4504
4639
|
});
|
|
4505
4640
|
}
|
|
4506
4641
|
}, [onPan, onZoom, queue]);
|
|
4507
|
-
var onPointerDown =
|
|
4642
|
+
var onPointerDown = React__default.useCallback(function (_ref8) {
|
|
4508
4643
|
var target = _ref8.target,
|
|
4509
4644
|
button = _ref8.button,
|
|
4510
4645
|
clientX = _ref8.clientX,
|
|
@@ -4604,7 +4739,7 @@ var Gesture = function Gesture(_ref6) {
|
|
|
4604
4739
|
console.log("Fail to capture pointer", e);
|
|
4605
4740
|
}
|
|
4606
4741
|
}, [onLongTap, queue]);
|
|
4607
|
-
var onPointerMove =
|
|
4742
|
+
var onPointerMove = React__default.useCallback(function (e) {
|
|
4608
4743
|
if (stateRef.current.pressed) {
|
|
4609
4744
|
var pointerId = e.pointerId,
|
|
4610
4745
|
eventClientX = e.clientX,
|
|
@@ -4745,7 +4880,7 @@ var Gesture = function Gesture(_ref6) {
|
|
|
4745
4880
|
stateRef.current.prevY = clientY;
|
|
4746
4881
|
}
|
|
4747
4882
|
}, [onDrag, onDragStart, onPan, onZoom, queue]);
|
|
4748
|
-
var onPointerUp =
|
|
4883
|
+
var onPointerUp = React__default.useCallback(function (e) {
|
|
4749
4884
|
var clientX = e.clientX,
|
|
4750
4885
|
clientY = e.clientY,
|
|
4751
4886
|
altKey = e.altKey,
|
|
@@ -4814,21 +4949,21 @@ var Gesture = function Gesture(_ref6) {
|
|
|
4814
4949
|
stateRef.current.noTap = false;
|
|
4815
4950
|
} // Send tap event only if time less than 300ms
|
|
4816
4951
|
else if (stateRef.current.timeStart - now < 300) {
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4952
|
+
queue(onTap, {
|
|
4953
|
+
clientX: clientX,
|
|
4954
|
+
clientY: clientY,
|
|
4955
|
+
altKey: altKey,
|
|
4956
|
+
ctrlKey: ctrlKey,
|
|
4957
|
+
metaKey: metaKey,
|
|
4958
|
+
target: target
|
|
4959
|
+
});
|
|
4960
|
+
}
|
|
4826
4961
|
}
|
|
4827
4962
|
}, [onDragEnd, onTap, queue]);
|
|
4828
|
-
var onDoubleTapHandler =
|
|
4963
|
+
var onDoubleTapHandler = React__default.useCallback(function (event) {
|
|
4829
4964
|
queue(onDoubleTap, event);
|
|
4830
4965
|
}, [onDoubleTap, queue]);
|
|
4831
|
-
return /*#__PURE__*/
|
|
4966
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
4832
4967
|
onWheel: onWheel,
|
|
4833
4968
|
onPointerDown: onPointerDown,
|
|
4834
4969
|
onPointerMove: onPointerMove,
|
|
@@ -4886,9 +5021,9 @@ var ResizeHandler = function ResizeHandler(_ref) {
|
|
|
4886
5021
|
};
|
|
4887
5022
|
}();
|
|
4888
5023
|
}, [onResize]);
|
|
4889
|
-
return /*#__PURE__*/
|
|
5024
|
+
return /*#__PURE__*/React__default.createElement(Gesture, {
|
|
4890
5025
|
onDrag: onDrag
|
|
4891
|
-
}, /*#__PURE__*/
|
|
5026
|
+
}, /*#__PURE__*/React__default.createElement("div", rest));
|
|
4892
5027
|
};
|
|
4893
5028
|
|
|
4894
5029
|
var img = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:cc='http://creativecommons.org/ns%23' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' version='1.1' x='0px' y='0px' viewBox='0 0 75.601318 94.9' xml:space='preserve' id='svg26' sodipodi:docname='lock.svg' width='75.601318' height='94.900002' inkscape:version='0.92.5 (2060ec1f9f%2c 2020-04-08)'%3e%3cmetadata id='metadata32'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3cdc:title%3e%3c/dc:title%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs30' /%3e%3csodipodi:namedview pagecolor='black' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='1848' inkscape:window-height='1016' id='namedview28' showgrid='false' fit-margin-top='0' fit-margin-left='0' fit-margin-right='0' fit-margin-bottom='0' inkscape:zoom='5.3400704' inkscape:cx='3.2640013' inkscape:cy='45.072152' inkscape:window-x='1512' inkscape:window-y='27' inkscape:window-maximized='1' inkscape:current-layer='g16' /%3e%3cg id='g16' transform='translate(-12.2%2c-2.5)'%3e%3cpath d='M 75.4%2c36.8 H 34.1 V 24.6 c 0%2c-8.8 7.1%2c-15.9 15.9%2c-15.9 8.8%2c0 15.9%2c7.1 15.9%2c15.9 0%2c1.7 1.4%2c3.1 3.1%2c3.1 1.7%2c0 3.1%2c-1.4 3.1%2c-3.1 C 72.1%2c12.4 62.2%2c2.5 50%2c2.5 37.8%2c2.5 27.9%2c12.4 27.9%2c24.6 v 12.2 h -3.3 c -6.9%2c0 -12.4%2c5.6 -12.4%2c12.4 V 85 c 0%2c6.9 5.6%2c12.4 12.4%2c12.4 h 50.8 c 6.9%2c0 12.4%2c-5.6 12.4%2c-12.4 V 49.2 C 87.9%2c42.3 82.3%2c36.8 75.4%2c36.8 Z m 6.2%2c48.3 c 0%2c3.4 -2.8%2c6.2 -6.2%2c6.2 H 24.6 c -3.4%2c0 -6.2%2c-2.8 -6.2%2c-6.2 V 49.2 c 0%2c-3.4 2.8%2c-6.2 6.2%2c-6.2 h 50.8 c 3.4%2c0 6.2%2c2.8 6.2%2c6.2 z' id='path12' inkscape:connector-curvature='0' style='fill:white%3bfill-opacity:1' /%3e%3cpath d='m 59.8%2c57.6 -12.5%2c12.5 -7%2c-7 c -1.2%2c-1.2 -3.2%2c-1.2 -4.4%2c0 -1.2%2c1.2 -1.2%2c3.2 0%2c4.4 l 9.2%2c9.2 c 0.6%2c0.6 1.4%2c0.9 2.2%2c0.9 0.8%2c0 1.6%2c-0.3 2.2%2c-0.9 L 64.2%2c62 c 1.2%2c-1.2 1.2%2c-3.2 0%2c-4.4 -1.2%2c-1.2 -3.2%2c-1.2 -4.4%2c0 z' id='path14' inkscape:connector-curvature='0' style='fill:white%3bfill-opacity:1' /%3e%3c/g%3e%3c/svg%3e";
|
|
@@ -4909,7 +5044,7 @@ var identity = function identity(x) {
|
|
|
4909
5044
|
|
|
4910
5045
|
var DefaultErrorComponent = function DefaultErrorComponent(_ref2) {
|
|
4911
5046
|
var onReload = _ref2.onReload;
|
|
4912
|
-
return /*#__PURE__*/
|
|
5047
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
4913
5048
|
style: {
|
|
4914
5049
|
width: "100px",
|
|
4915
5050
|
display: "flex",
|
|
@@ -4919,7 +5054,7 @@ var DefaultErrorComponent = function DefaultErrorComponent(_ref2) {
|
|
|
4919
5054
|
color: "red"
|
|
4920
5055
|
},
|
|
4921
5056
|
className: "syncboard-error-item"
|
|
4922
|
-
}, "Sorry, this item seems broken.", /*#__PURE__*/
|
|
5057
|
+
}, "Sorry, this item seems broken.", /*#__PURE__*/React__default.createElement("button", {
|
|
4923
5058
|
onClick: onReload
|
|
4924
5059
|
}, "Reload it"));
|
|
4925
5060
|
};
|
|
@@ -4964,7 +5099,7 @@ var ItemErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
4964
5099
|
var ErrorComponent = this.props.ErrorComponent;
|
|
4965
5100
|
|
|
4966
5101
|
if (this.state.hasError) {
|
|
4967
|
-
return /*#__PURE__*/
|
|
5102
|
+
return /*#__PURE__*/React__default.createElement(ErrorComponent, {
|
|
4968
5103
|
onReload: this.onReload
|
|
4969
5104
|
});
|
|
4970
5105
|
}
|
|
@@ -4981,7 +5116,7 @@ var ItemErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
|
4981
5116
|
}]);
|
|
4982
5117
|
|
|
4983
5118
|
return ItemErrorBoundary;
|
|
4984
|
-
}(
|
|
5119
|
+
}(React__default.Component);
|
|
4985
5120
|
|
|
4986
5121
|
var removeClass = function removeClass(e) {
|
|
4987
5122
|
e.target.className = "";
|
|
@@ -5050,7 +5185,7 @@ var Item = function Item(_ref5) {
|
|
|
5050
5185
|
_ref5$showResizeHandl = _ref5.showResizeHandle,
|
|
5051
5186
|
showResizeHandle = _ref5$showResizeHandl === void 0 ? false : _ref5$showResizeHandl;
|
|
5052
5187
|
|
|
5053
|
-
var itemWrapperRef =
|
|
5188
|
+
var itemWrapperRef = React__default.useRef(null);
|
|
5054
5189
|
var _itemMap$type = itemMap[type],
|
|
5055
5190
|
_itemMap$type$compone = _itemMap$type.component,
|
|
5056
5191
|
Component = _itemMap$type$compone === void 0 ? function () {
|
|
@@ -5060,11 +5195,11 @@ var Item = function Item(_ref5) {
|
|
|
5060
5195
|
resizeDirections = _itemMap$type$resizeD === void 0 ? defaultResizeDirection : _itemMap$type$resizeD,
|
|
5061
5196
|
_itemMap$type$resize = _itemMap$type.resize,
|
|
5062
5197
|
resize = _itemMap$type$resize === void 0 ? defaultResize : _itemMap$type$resize;
|
|
5063
|
-
var updateState =
|
|
5198
|
+
var updateState = React__default.useCallback(function (callbackOrItem) {
|
|
5064
5199
|
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
5065
5200
|
return setState(id, callbackOrItem, sync);
|
|
5066
5201
|
}, [setState, id]);
|
|
5067
|
-
|
|
5202
|
+
React__default.useEffect(function () {
|
|
5068
5203
|
itemWrapperRef.current.className = animate;
|
|
5069
5204
|
}, [animate]);
|
|
5070
5205
|
var className = "item ".concat(id);
|
|
@@ -5077,7 +5212,7 @@ var Item = function Item(_ref5) {
|
|
|
5077
5212
|
className += " selected";
|
|
5078
5213
|
}
|
|
5079
5214
|
|
|
5080
|
-
var onResize =
|
|
5215
|
+
var onResize = React__default.useCallback(function (_ref6) {
|
|
5081
5216
|
var _ref6$width = _ref6.width,
|
|
5082
5217
|
width = _ref6$width === void 0 ? 0 : _ref6$width,
|
|
5083
5218
|
_ref6$height = _ref6.height,
|
|
@@ -5097,19 +5232,19 @@ var Item = function Item(_ref5) {
|
|
|
5097
5232
|
});
|
|
5098
5233
|
});
|
|
5099
5234
|
}, [resize, updateState]);
|
|
5100
|
-
var onResizeWidth =
|
|
5235
|
+
var onResizeWidth = React__default.useCallback(function (_ref7) {
|
|
5101
5236
|
var width = _ref7.width;
|
|
5102
5237
|
onResize({
|
|
5103
5238
|
width: width
|
|
5104
5239
|
});
|
|
5105
5240
|
}, [onResize]);
|
|
5106
|
-
var onResizeHeight =
|
|
5241
|
+
var onResizeHeight = React__default.useCallback(function (_ref8) {
|
|
5107
5242
|
var height = _ref8.height;
|
|
5108
5243
|
onResize({
|
|
5109
5244
|
height: height
|
|
5110
5245
|
});
|
|
5111
5246
|
}, [onResize]);
|
|
5112
|
-
var onResizeRatio =
|
|
5247
|
+
var onResizeRatio = React__default.useCallback(function (_ref9) {
|
|
5113
5248
|
var width = _ref9.width;
|
|
5114
5249
|
onResize({
|
|
5115
5250
|
height: width,
|
|
@@ -5117,14 +5252,14 @@ var Item = function Item(_ref5) {
|
|
|
5117
5252
|
keepRatio: true
|
|
5118
5253
|
});
|
|
5119
5254
|
}, [onResize]);
|
|
5120
|
-
return /*#__PURE__*/
|
|
5255
|
+
return /*#__PURE__*/React__default.createElement(ItemWrapper, {
|
|
5121
5256
|
rotation: rotation,
|
|
5122
5257
|
locked: locked,
|
|
5123
5258
|
selected: isSelected,
|
|
5124
5259
|
layer: layer,
|
|
5125
5260
|
"data-id": id,
|
|
5126
5261
|
className: className
|
|
5127
|
-
}, /*#__PURE__*/
|
|
5262
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
5128
5263
|
style: {
|
|
5129
5264
|
display: "flex"
|
|
5130
5265
|
},
|
|
@@ -5136,29 +5271,29 @@ var Item = function Item(_ref5) {
|
|
|
5136
5271
|
onKeyUp: function onKeyUp(e) {
|
|
5137
5272
|
return e.stopPropagation();
|
|
5138
5273
|
}
|
|
5139
|
-
}, /*#__PURE__*/
|
|
5274
|
+
}, /*#__PURE__*/React__default.createElement(ItemErrorBoundary, {
|
|
5140
5275
|
itemId: id,
|
|
5141
5276
|
state: rest,
|
|
5142
5277
|
setState: updateState,
|
|
5143
5278
|
ErrorComponent: (itemMap === null || itemMap === void 0 ? void 0 : (_itemMap$error = itemMap.error) === null || _itemMap$error === void 0 ? void 0 : _itemMap$error.component) || DefaultErrorComponent
|
|
5144
|
-
}, /*#__PURE__*/
|
|
5279
|
+
}, /*#__PURE__*/React__default.createElement(Component, _extends$1({}, rest, {
|
|
5145
5280
|
id: id,
|
|
5146
5281
|
setState: updateState
|
|
5147
|
-
}))), /*#__PURE__*/
|
|
5282
|
+
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
5148
5283
|
className: "corner top-left"
|
|
5149
|
-
}), /*#__PURE__*/
|
|
5284
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
5150
5285
|
className: "corner top-right"
|
|
5151
|
-
}), /*#__PURE__*/
|
|
5152
|
-
className: "corner bottom-left"
|
|
5153
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
5286
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
5154
5287
|
className: "corner bottom-right"
|
|
5155
|
-
}),
|
|
5288
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
5289
|
+
className: "corner bottom-left"
|
|
5290
|
+
}), isSelected && showResizeHandle && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, resizeDirections.b && /*#__PURE__*/React__default.createElement(ResizeHandler, {
|
|
5156
5291
|
className: "resize resize-ratio",
|
|
5157
5292
|
onResize: onResizeRatio
|
|
5158
|
-
}), resizeDirections.h && /*#__PURE__*/
|
|
5293
|
+
}), resizeDirections.h && /*#__PURE__*/React__default.createElement(ResizeHandler, {
|
|
5159
5294
|
className: "resize resize-height",
|
|
5160
5295
|
onResize: onResizeHeight
|
|
5161
|
-
}), resizeDirections.w && /*#__PURE__*/
|
|
5296
|
+
}), resizeDirections.w && /*#__PURE__*/React__default.createElement(ResizeHandler, {
|
|
5162
5297
|
className: "resize resize-width",
|
|
5163
5298
|
onResize: onResizeWidth
|
|
5164
5299
|
}))));
|
|
@@ -5204,7 +5339,7 @@ var PositionedItem = function PositionedItem(_ref12) {
|
|
|
5204
5339
|
moving = _stateHook.moving,
|
|
5205
5340
|
stateRest = _objectWithoutProperties(_stateHook, _excluded3);
|
|
5206
5341
|
|
|
5207
|
-
return /*#__PURE__*/
|
|
5342
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
5208
5343
|
style: {
|
|
5209
5344
|
position: "absolute",
|
|
5210
5345
|
top: "".concat(boardSize / 2, "px"),
|
|
@@ -5214,7 +5349,7 @@ var PositionedItem = function PositionedItem(_ref12) {
|
|
|
5214
5349
|
zIndex: (layer + 4) * 10 + 100 + (moving ? 5 : 0) // Items z-index between 100 and 200
|
|
5215
5350
|
|
|
5216
5351
|
}
|
|
5217
|
-
}, /*#__PURE__*/
|
|
5352
|
+
}, /*#__PURE__*/React__default.createElement(MemoizedItem, _extends$1({}, rest, {
|
|
5218
5353
|
// Helps to prevent render
|
|
5219
5354
|
showResizeHandle: rest.isSelected && rest.showResizeHandle,
|
|
5220
5355
|
state: stateRest
|
|
@@ -5288,7 +5423,7 @@ var useUsers = function useUsers() {
|
|
|
5288
5423
|
|
|
5289
5424
|
var users = useRecoilValue(usersAtom);
|
|
5290
5425
|
var localUsers = useRecoilValue(localUsersAtom);
|
|
5291
|
-
var setCurrentUser =
|
|
5426
|
+
var setCurrentUser = React__default.useCallback(function (callbackOrUser) {
|
|
5292
5427
|
var callback = callbackOrUser;
|
|
5293
5428
|
|
|
5294
5429
|
if (_typeof(callbackOrUser) === "object") {
|
|
@@ -5316,7 +5451,7 @@ var useUsers = function useUsers() {
|
|
|
5316
5451
|
};
|
|
5317
5452
|
|
|
5318
5453
|
var SubscribeUserEvents = function SubscribeUserEvents() {
|
|
5319
|
-
var usersRef =
|
|
5454
|
+
var usersRef = React__default.useRef([]);
|
|
5320
5455
|
var setUsers = useSetRecoilState(usersAtom);
|
|
5321
5456
|
|
|
5322
5457
|
var _useRecoilState = useRecoilState(userAtom),
|
|
@@ -5329,7 +5464,7 @@ var SubscribeUserEvents = function SubscribeUserEvents() {
|
|
|
5329
5464
|
isMaster = _useWire.isMaster,
|
|
5330
5465
|
roomSpace = _useWire.room;
|
|
5331
5466
|
|
|
5332
|
-
|
|
5467
|
+
React__default.useEffect(function () {
|
|
5333
5468
|
setCurrentUserState(function (prevUser) {
|
|
5334
5469
|
return _objectSpread2(_objectSpread2({}, prevUser), {}, {
|
|
5335
5470
|
id: wire.userId,
|
|
@@ -5345,7 +5480,7 @@ var SubscribeUserEvents = function SubscribeUserEvents() {
|
|
|
5345
5480
|
});
|
|
5346
5481
|
};
|
|
5347
5482
|
}, [wire.userId, roomSpace, setCurrentUserState]);
|
|
5348
|
-
|
|
5483
|
+
React__default.useEffect(function () {
|
|
5349
5484
|
if (!isMaster) {
|
|
5350
5485
|
var onGetUserList = function onGetUserList(userList) {
|
|
5351
5486
|
usersRef.current = userList;
|
|
@@ -5367,12 +5502,12 @@ var SubscribeUserEvents = function SubscribeUserEvents() {
|
|
|
5367
5502
|
var debouncedEmitUpdateUser = useDebouncedCallback(function (newUser) {
|
|
5368
5503
|
wire.publish("userUpdate", newUser, true);
|
|
5369
5504
|
}, [wire], 500);
|
|
5370
|
-
|
|
5505
|
+
React__default.useEffect(function () {
|
|
5371
5506
|
if (currentUser && currentUser.id) {
|
|
5372
5507
|
debouncedEmitUpdateUser(currentUser);
|
|
5373
5508
|
}
|
|
5374
5509
|
}, [currentUser, debouncedEmitUpdateUser]);
|
|
5375
|
-
|
|
5510
|
+
React__default.useEffect(function () {
|
|
5376
5511
|
var unsub = [];
|
|
5377
5512
|
|
|
5378
5513
|
if (isMaster) {
|
|
@@ -5441,7 +5576,7 @@ var ItemList = function ItemList() {
|
|
|
5441
5576
|
currentUser = _useUsers.currentUser;
|
|
5442
5577
|
|
|
5443
5578
|
return itemList.map(function (itemId) {
|
|
5444
|
-
return /*#__PURE__*/
|
|
5579
|
+
return /*#__PURE__*/React__default.createElement(MemoizedPositionedItem, {
|
|
5445
5580
|
key: itemId,
|
|
5446
5581
|
state: itemMap[itemId],
|
|
5447
5582
|
setState: updateItem,
|
|
@@ -5466,18 +5601,18 @@ var SubcribeItemEvents = function SubcribeItemEvents() {
|
|
|
5466
5601
|
removeItems = _useItemActions.removeItems,
|
|
5467
5602
|
pushItem = _useItemActions.pushItem;
|
|
5468
5603
|
|
|
5469
|
-
var batchUpdate =
|
|
5604
|
+
var batchUpdate = React__default.useCallback(function (updatedItems) {
|
|
5470
5605
|
setItemMap(function (prevItemMap) {
|
|
5471
5606
|
return _objectSpread2(_objectSpread2({}, prevItemMap), updatedItems);
|
|
5472
5607
|
});
|
|
5473
5608
|
}, [setItemMap]);
|
|
5474
|
-
|
|
5609
|
+
React__default.useEffect(function () {
|
|
5475
5610
|
var unsub = wire.subscribe("batchItemsUpdate", function (updatedItems) {
|
|
5476
5611
|
batchUpdate(updatedItems);
|
|
5477
5612
|
});
|
|
5478
5613
|
return unsub;
|
|
5479
5614
|
}, [wire, batchUpdate]);
|
|
5480
|
-
|
|
5615
|
+
React__default.useEffect(function () {
|
|
5481
5616
|
var unsub = wire.subscribe("selectedItemsMove", function (_ref) {
|
|
5482
5617
|
var itemIds = _ref.itemIds,
|
|
5483
5618
|
posDelta = _ref.posDelta;
|
|
@@ -5485,19 +5620,19 @@ var SubcribeItemEvents = function SubcribeItemEvents() {
|
|
|
5485
5620
|
});
|
|
5486
5621
|
return unsub;
|
|
5487
5622
|
}, [wire, moveItems]);
|
|
5488
|
-
|
|
5623
|
+
React__default.useEffect(function () {
|
|
5489
5624
|
var unsub = wire.subscribe("updateItemListOrder", function (itemIds) {
|
|
5490
5625
|
updateItemOrder(itemIds, false);
|
|
5491
5626
|
});
|
|
5492
5627
|
return unsub;
|
|
5493
5628
|
}, [wire, updateItemOrder]);
|
|
5494
|
-
|
|
5629
|
+
React__default.useEffect(function () {
|
|
5495
5630
|
var unsub = wire.subscribe("pushItem", function (newItem) {
|
|
5496
5631
|
pushItem(newItem, null, false);
|
|
5497
5632
|
});
|
|
5498
5633
|
return unsub;
|
|
5499
5634
|
}, [wire, pushItem]);
|
|
5500
|
-
|
|
5635
|
+
React__default.useEffect(function () {
|
|
5501
5636
|
var unsub = wire.subscribe("insertItemBefore", function (_ref2) {
|
|
5502
5637
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
5503
5638
|
newItem = _ref3[0],
|
|
@@ -5507,7 +5642,7 @@ var SubcribeItemEvents = function SubcribeItemEvents() {
|
|
|
5507
5642
|
});
|
|
5508
5643
|
return unsub;
|
|
5509
5644
|
}, [wire, pushItem]);
|
|
5510
|
-
|
|
5645
|
+
React__default.useEffect(function () {
|
|
5511
5646
|
var unsub = wire.subscribe("removeItems", function (itemIds) {
|
|
5512
5647
|
removeItems(itemIds, false);
|
|
5513
5648
|
});
|
|
@@ -5656,17 +5791,17 @@ var Selector = function Selector(_ref) {
|
|
|
5656
5791
|
var _useItemActions = useItemActions(),
|
|
5657
5792
|
findElementUnderPointer = _useItemActions.findElementUnderPointer;
|
|
5658
5793
|
|
|
5659
|
-
var _React$useState =
|
|
5794
|
+
var _React$useState = React__default.useState({}),
|
|
5660
5795
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5661
5796
|
selector = _React$useState2[0],
|
|
5662
5797
|
setSelector = _React$useState2[1];
|
|
5663
5798
|
|
|
5664
|
-
var wrapperRef =
|
|
5665
|
-
var stateRef =
|
|
5799
|
+
var wrapperRef = React__default.useRef(null);
|
|
5800
|
+
var stateRef = React__default.useRef({
|
|
5666
5801
|
moving: false
|
|
5667
5802
|
}); // Reset selection on board loading
|
|
5668
5803
|
|
|
5669
|
-
|
|
5804
|
+
React__default.useEffect(function () {
|
|
5670
5805
|
setSelected(function (prev) {
|
|
5671
5806
|
return prev.length === 0 ? prev : [];
|
|
5672
5807
|
});
|
|
@@ -5837,7 +5972,7 @@ var Selector = function Selector(_ref) {
|
|
|
5837
5972
|
}
|
|
5838
5973
|
};
|
|
5839
5974
|
|
|
5840
|
-
var onLongTap =
|
|
5975
|
+
var onLongTap = React__default.useCallback(function (_ref8) {
|
|
5841
5976
|
var target = _ref8.target;
|
|
5842
5977
|
var foundElement = insideClass(target, "item");
|
|
5843
5978
|
|
|
@@ -5912,15 +6047,15 @@ var Selector = function Selector(_ref) {
|
|
|
5912
6047
|
};
|
|
5913
6048
|
}();
|
|
5914
6049
|
}, [findElementUnderPointer, setSelected]);
|
|
5915
|
-
return /*#__PURE__*/
|
|
6050
|
+
return /*#__PURE__*/React__default.createElement(Gesture, {
|
|
5916
6051
|
onDragStart: onDragStart,
|
|
5917
6052
|
onDrag: onDrag,
|
|
5918
6053
|
onDragEnd: onDragEnd,
|
|
5919
6054
|
onTap: onTap,
|
|
5920
6055
|
onLongTap: onLongTap
|
|
5921
|
-
}, /*#__PURE__*/
|
|
6056
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
5922
6057
|
ref: wrapperRef
|
|
5923
|
-
}, selector.moving && /*#__PURE__*/
|
|
6058
|
+
}, selector.moving && /*#__PURE__*/React__default.createElement("div", {
|
|
5924
6059
|
style: _objectSpread2(_objectSpread2({}, defaultSelectorStyle), {}, {
|
|
5925
6060
|
transform: "translate(".concat(selector.left, "px, ").concat(selector.top, "px)"),
|
|
5926
6061
|
height: "".concat(selector.height, "px"),
|
|
@@ -5940,9 +6075,9 @@ var ActionPane = function ActionPane(_ref) {
|
|
|
5940
6075
|
|
|
5941
6076
|
var setSelectedItems = useSetRecoilState(SelectedItemsAtom);
|
|
5942
6077
|
var setBoardState = useSetRecoilState(BoardStateAtom);
|
|
5943
|
-
var actionRef =
|
|
6078
|
+
var actionRef = React__default.useRef({}); // Use ref because pointer events are faster than react state management
|
|
5944
6079
|
|
|
5945
|
-
var selectedItemRef =
|
|
6080
|
+
var selectedItemRef = React__default.useRef({
|
|
5946
6081
|
items: []
|
|
5947
6082
|
});
|
|
5948
6083
|
var onDragStart = useRecoilCallback(function (_ref2) {
|
|
@@ -6198,167 +6333,236 @@ var ActionPane = function ActionPane(_ref) {
|
|
|
6198
6333
|
};
|
|
6199
6334
|
}();
|
|
6200
6335
|
}, [moveItems, placeItems]);
|
|
6201
|
-
|
|
6336
|
+
React__default.useEffect(function () {
|
|
6202
6337
|
document.addEventListener("keydown", onKeyDown);
|
|
6203
6338
|
return function () {
|
|
6204
6339
|
document.removeEventListener("keydown", onKeyDown);
|
|
6205
6340
|
};
|
|
6206
6341
|
}, [onKeyDown]);
|
|
6207
|
-
return /*#__PURE__*/
|
|
6342
|
+
return /*#__PURE__*/React__default.createElement(Gesture, {
|
|
6208
6343
|
onDragStart: onDragStart,
|
|
6209
6344
|
onDrag: onDrag,
|
|
6210
6345
|
onDragEnd: onDragEnd
|
|
6211
6346
|
}, children);
|
|
6212
6347
|
};
|
|
6213
6348
|
|
|
6214
|
-
|
|
6215
|
-
|
|
6349
|
+
/**
|
|
6350
|
+
* A simple guard function:
|
|
6351
|
+
*
|
|
6352
|
+
* ```js
|
|
6353
|
+
* Math.min(Math.max(low, value), high)
|
|
6354
|
+
* ```
|
|
6355
|
+
*/
|
|
6356
|
+
function guard(low, high, value) {
|
|
6357
|
+
return Math.min(Math.max(low, value), high);
|
|
6216
6358
|
}
|
|
6217
6359
|
|
|
6218
|
-
var
|
|
6219
|
-
_inherits(
|
|
6360
|
+
var ColorError = /*#__PURE__*/function (_Error) {
|
|
6361
|
+
_inherits(ColorError, _Error);
|
|
6220
6362
|
|
|
6221
|
-
var _super = _createSuper(
|
|
6363
|
+
var _super = _createSuper(ColorError);
|
|
6222
6364
|
|
|
6223
|
-
function
|
|
6224
|
-
_classCallCheck(this,
|
|
6365
|
+
function ColorError(color) {
|
|
6366
|
+
_classCallCheck(this, ColorError);
|
|
6225
6367
|
|
|
6226
|
-
return _super.call(this, "Failed to parse color: \"".concat(
|
|
6368
|
+
return _super.call(this, "Failed to parse color: \"".concat(color, "\""));
|
|
6227
6369
|
}
|
|
6228
6370
|
|
|
6229
|
-
return
|
|
6371
|
+
return ColorError;
|
|
6230
6372
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
6231
6373
|
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
e = o[function (t) {
|
|
6239
|
-
var n = 5381,
|
|
6240
|
-
r = t.length;
|
|
6241
|
-
|
|
6242
|
-
for (; r;) {
|
|
6243
|
-
n = 33 * n ^ t.charCodeAt(--r);
|
|
6244
|
-
}
|
|
6245
|
-
|
|
6246
|
-
return (n >>> 0) % 2341;
|
|
6247
|
-
}(r)];
|
|
6248
|
-
|
|
6249
|
-
if (!e) throw new n(t);
|
|
6250
|
-
return "#".concat(e);
|
|
6251
|
-
}(r) : r;
|
|
6252
|
-
var f = s.exec(e);
|
|
6253
|
-
|
|
6254
|
-
if (f) {
|
|
6255
|
-
var _t = Array.from(f).slice(1);
|
|
6374
|
+
var ColorError$1 = ColorError;
|
|
6375
|
+
/**
|
|
6376
|
+
* Parses a color into red, gree, blue, alpha parts
|
|
6377
|
+
*
|
|
6378
|
+
* @param color the input color. Can be a RGB, RBGA, HSL, HSLA, or named color
|
|
6379
|
+
*/
|
|
6256
6380
|
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6381
|
+
function parseToRgba(color) {
|
|
6382
|
+
if (typeof color !== 'string') throw new ColorError$1(color);
|
|
6383
|
+
if (color.trim().toLowerCase() === 'transparent') return [0, 0, 0, 0];
|
|
6384
|
+
var normalizedColor = color.trim();
|
|
6385
|
+
normalizedColor = namedColorRegex.test(color) ? nameToHex(color) : color;
|
|
6386
|
+
var reducedHexMatch = reducedHexRegex.exec(normalizedColor);
|
|
6387
|
+
|
|
6388
|
+
if (reducedHexMatch) {
|
|
6389
|
+
var arr = Array.from(reducedHexMatch).slice(1);
|
|
6390
|
+
return [].concat(_toConsumableArray(arr.slice(0, 3).map(function (x) {
|
|
6391
|
+
return parseInt(r(x, 2), 16);
|
|
6392
|
+
})), [parseInt(r(arr[3] || 'f', 2), 16) / 255]);
|
|
6260
6393
|
}
|
|
6261
6394
|
|
|
6262
|
-
var
|
|
6395
|
+
var hexMatch = hexRegex.exec(normalizedColor);
|
|
6263
6396
|
|
|
6264
|
-
if (
|
|
6265
|
-
var
|
|
6397
|
+
if (hexMatch) {
|
|
6398
|
+
var _arr = Array.from(hexMatch).slice(1);
|
|
6266
6399
|
|
|
6267
|
-
return [].concat(_toConsumableArray(
|
|
6268
|
-
return parseInt(
|
|
6269
|
-
})), [parseInt(
|
|
6400
|
+
return [].concat(_toConsumableArray(_arr.slice(0, 3).map(function (x) {
|
|
6401
|
+
return parseInt(x, 16);
|
|
6402
|
+
})), [parseInt(_arr[3] || 'ff', 16) / 255]);
|
|
6270
6403
|
}
|
|
6271
6404
|
|
|
6272
|
-
var
|
|
6405
|
+
var rgbaMatch = rgbaRegex.exec(normalizedColor);
|
|
6273
6406
|
|
|
6274
|
-
if (
|
|
6275
|
-
var
|
|
6407
|
+
if (rgbaMatch) {
|
|
6408
|
+
var _arr2 = Array.from(rgbaMatch).slice(1);
|
|
6276
6409
|
|
|
6277
|
-
return [].concat(_toConsumableArray(
|
|
6278
|
-
return parseInt(
|
|
6279
|
-
})), [parseFloat(
|
|
6410
|
+
return [].concat(_toConsumableArray(_arr2.slice(0, 3).map(function (x) {
|
|
6411
|
+
return parseInt(x, 10);
|
|
6412
|
+
})), [parseFloat(_arr2[3] || '1')]);
|
|
6280
6413
|
}
|
|
6281
6414
|
|
|
6282
|
-
var
|
|
6415
|
+
var hslaMatch = hslaRegex.exec(normalizedColor);
|
|
6283
6416
|
|
|
6284
|
-
if (
|
|
6285
|
-
var _Array$from$slice$map = Array.from(
|
|
6417
|
+
if (hslaMatch) {
|
|
6418
|
+
var _Array$from$slice$map = Array.from(hslaMatch).slice(1).map(parseFloat),
|
|
6286
6419
|
_Array$from$slice$map2 = _slicedToArray(_Array$from$slice$map, 4),
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
if (
|
|
6293
|
-
if (
|
|
6294
|
-
return [].concat(_toConsumableArray(
|
|
6420
|
+
h = _Array$from$slice$map2[0],
|
|
6421
|
+
s = _Array$from$slice$map2[1],
|
|
6422
|
+
l = _Array$from$slice$map2[2],
|
|
6423
|
+
a = _Array$from$slice$map2[3];
|
|
6424
|
+
|
|
6425
|
+
if (guard(0, 100, s) !== s) throw new ColorError$1(color);
|
|
6426
|
+
if (guard(0, 100, l) !== l) throw new ColorError$1(color);
|
|
6427
|
+
return [].concat(_toConsumableArray(hslToRgb(h, s, l)), [a || 1]);
|
|
6295
6428
|
}
|
|
6296
6429
|
|
|
6297
|
-
throw new
|
|
6430
|
+
throw new ColorError$1(color);
|
|
6298
6431
|
}
|
|
6299
6432
|
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
o = "1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce(function (t, n) {
|
|
6304
|
-
var r = e(n.substring(0, 3)),
|
|
6305
|
-
o = e(n.substring(3)).toString(16);
|
|
6306
|
-
var _ = "";
|
|
6433
|
+
function hash(str) {
|
|
6434
|
+
var hash = 5381;
|
|
6435
|
+
var i = str.length;
|
|
6307
6436
|
|
|
6308
|
-
|
|
6309
|
-
|
|
6437
|
+
while (i) {
|
|
6438
|
+
hash = hash * 33 ^ str.charCodeAt(--i);
|
|
6310
6439
|
}
|
|
6440
|
+
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
|
|
6441
|
+
* integers. Since we want the results to be always positive, convert the
|
|
6442
|
+
* signed int to an unsigned by doing an unsigned bitshift. */
|
|
6311
6443
|
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
},
|
|
6319
|
-
s = new RegExp("^#".concat(_("([a-f0-9])", 3), "([a-f0-9])?$"), "i"),
|
|
6320
|
-
i = new RegExp("^#".concat(_("([a-f0-9]{2})", 3), "([a-f0-9]{2})?$"), "i"),
|
|
6321
|
-
a = new RegExp("^rgba?\\(\\s*(\\d+)\\s*".concat(_(",\\s*(\\d+)\\s*", 2), "(?:,\\s*([\\d.]+))?\\s*\\)$"), "i"),
|
|
6322
|
-
c = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,
|
|
6323
|
-
u = /^[a-z]+$/i,
|
|
6324
|
-
f = function f(t) {
|
|
6325
|
-
return Math.round(255 * t);
|
|
6326
|
-
},
|
|
6327
|
-
l = function l(t, n, r) {
|
|
6328
|
-
var e = r / 100;
|
|
6329
|
-
if (0 === n) return [e, e, e].map(f);
|
|
6330
|
-
|
|
6331
|
-
var o = (t % 360 + 360) % 360 / 60,
|
|
6332
|
-
_ = (1 - Math.abs(2 * e - 1)) * (n / 100),
|
|
6333
|
-
s = _ * (1 - Math.abs(o % 2 - 1));
|
|
6334
|
-
|
|
6335
|
-
var i = 0,
|
|
6336
|
-
a = 0,
|
|
6337
|
-
c = 0;
|
|
6338
|
-
o >= 0 && o < 1 ? (i = _, a = s) : o >= 1 && o < 2 ? (i = s, a = _) : o >= 2 && o < 3 ? (a = _, c = s) : o >= 3 && o < 4 ? (a = s, c = _) : o >= 4 && o < 5 ? (i = s, c = _) : o >= 5 && o < 6 && (i = _, c = s);
|
|
6339
|
-
var u = e - _ / 2;
|
|
6340
|
-
return [i + u, a + u, c + u].map(f);
|
|
6444
|
+
|
|
6445
|
+
return (hash >>> 0) % 2341;
|
|
6446
|
+
}
|
|
6447
|
+
|
|
6448
|
+
var colorToInt = function colorToInt(x) {
|
|
6449
|
+
return parseInt(x.replace(/_/g, ''), 36);
|
|
6341
6450
|
};
|
|
6342
6451
|
|
|
6343
|
-
function
|
|
6344
|
-
|
|
6452
|
+
var compressedColorMap = '1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm'.split(' ').reduce(function (acc, next) {
|
|
6453
|
+
var key = colorToInt(next.substring(0, 3));
|
|
6454
|
+
var hex = colorToInt(next.substring(3)).toString(16); // NOTE: padStart could be used here but it breaks Node 6 compat
|
|
6455
|
+
// https://github.com/ricokahler/color2k/issues/351
|
|
6456
|
+
|
|
6457
|
+
var prefix = '';
|
|
6345
6458
|
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
return n <= .03928 ? n / 12.92 : Math.pow((n + .055) / 1.055, 2.4);
|
|
6459
|
+
for (var i = 0; i < 6 - hex.length; i++) {
|
|
6460
|
+
prefix += '0';
|
|
6349
6461
|
}
|
|
6350
6462
|
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6463
|
+
acc[key] = "".concat(prefix).concat(hex);
|
|
6464
|
+
return acc;
|
|
6465
|
+
}, {});
|
|
6466
|
+
/**
|
|
6467
|
+
* Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
|
|
6468
|
+
*/
|
|
6356
6469
|
|
|
6357
|
-
|
|
6470
|
+
function nameToHex(color) {
|
|
6471
|
+
var normalizedColorName = color.toLowerCase().trim();
|
|
6472
|
+
var result = compressedColorMap[hash(normalizedColorName)];
|
|
6473
|
+
if (!result) throw new ColorError$1(color);
|
|
6474
|
+
return "#".concat(result);
|
|
6358
6475
|
}
|
|
6359
6476
|
|
|
6360
|
-
function
|
|
6361
|
-
return
|
|
6477
|
+
var r = function r(str, amount) {
|
|
6478
|
+
return Array.from(Array(amount)).map(function () {
|
|
6479
|
+
return str;
|
|
6480
|
+
}).join('');
|
|
6481
|
+
};
|
|
6482
|
+
|
|
6483
|
+
var reducedHexRegex = new RegExp("^#".concat(r('([a-f0-9])', 3), "([a-f0-9])?$"), 'i');
|
|
6484
|
+
var hexRegex = new RegExp("^#".concat(r('([a-f0-9]{2})', 3), "([a-f0-9]{2})?$"), 'i');
|
|
6485
|
+
var rgbaRegex = new RegExp("^rgba?\\(\\s*(\\d+)\\s*".concat(r(',\\s*(\\d+)\\s*', 2), "(?:,\\s*([\\d.]+))?\\s*\\)$"), 'i');
|
|
6486
|
+
var hslaRegex = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i;
|
|
6487
|
+
var namedColorRegex = /^[a-z]+$/i;
|
|
6488
|
+
|
|
6489
|
+
var roundColor = function roundColor(color) {
|
|
6490
|
+
return Math.round(color * 255);
|
|
6491
|
+
};
|
|
6492
|
+
|
|
6493
|
+
var hslToRgb = function hslToRgb(hue, saturation, lightness) {
|
|
6494
|
+
var l = lightness / 100;
|
|
6495
|
+
|
|
6496
|
+
if (saturation === 0) {
|
|
6497
|
+
// achromatic
|
|
6498
|
+
return [l, l, l].map(roundColor);
|
|
6499
|
+
} // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
|
|
6500
|
+
|
|
6501
|
+
|
|
6502
|
+
var huePrime = (hue % 360 + 360) % 360 / 60;
|
|
6503
|
+
var chroma = (1 - Math.abs(2 * l - 1)) * (saturation / 100);
|
|
6504
|
+
var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
6505
|
+
var red = 0;
|
|
6506
|
+
var green = 0;
|
|
6507
|
+
var blue = 0;
|
|
6508
|
+
|
|
6509
|
+
if (huePrime >= 0 && huePrime < 1) {
|
|
6510
|
+
red = chroma;
|
|
6511
|
+
green = secondComponent;
|
|
6512
|
+
} else if (huePrime >= 1 && huePrime < 2) {
|
|
6513
|
+
red = secondComponent;
|
|
6514
|
+
green = chroma;
|
|
6515
|
+
} else if (huePrime >= 2 && huePrime < 3) {
|
|
6516
|
+
green = chroma;
|
|
6517
|
+
blue = secondComponent;
|
|
6518
|
+
} else if (huePrime >= 3 && huePrime < 4) {
|
|
6519
|
+
green = secondComponent;
|
|
6520
|
+
blue = chroma;
|
|
6521
|
+
} else if (huePrime >= 4 && huePrime < 5) {
|
|
6522
|
+
red = secondComponent;
|
|
6523
|
+
blue = chroma;
|
|
6524
|
+
} else if (huePrime >= 5 && huePrime < 6) {
|
|
6525
|
+
red = chroma;
|
|
6526
|
+
blue = secondComponent;
|
|
6527
|
+
}
|
|
6528
|
+
|
|
6529
|
+
var lightnessModification = l - chroma / 2;
|
|
6530
|
+
var finalRed = red + lightnessModification;
|
|
6531
|
+
var finalGreen = green + lightnessModification;
|
|
6532
|
+
var finalBlue = blue + lightnessModification;
|
|
6533
|
+
return [finalRed, finalGreen, finalBlue].map(roundColor);
|
|
6534
|
+
}; // taken from:
|
|
6535
|
+
|
|
6536
|
+
/**
|
|
6537
|
+
* Returns a number (float) representing the luminance of a color.
|
|
6538
|
+
*/
|
|
6539
|
+
|
|
6540
|
+
|
|
6541
|
+
function getLuminance(color) {
|
|
6542
|
+
if (color === 'transparent') return 0;
|
|
6543
|
+
|
|
6544
|
+
function f(x) {
|
|
6545
|
+
var channel = x / 255;
|
|
6546
|
+
return channel <= 0.03928 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);
|
|
6547
|
+
}
|
|
6548
|
+
|
|
6549
|
+
var _parseToRgba = parseToRgba(color),
|
|
6550
|
+
_parseToRgba2 = _slicedToArray(_parseToRgba, 3),
|
|
6551
|
+
r = _parseToRgba2[0],
|
|
6552
|
+
g = _parseToRgba2[1],
|
|
6553
|
+
b = _parseToRgba2[2];
|
|
6554
|
+
|
|
6555
|
+
return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b);
|
|
6556
|
+
} // taken from:
|
|
6557
|
+
/**
|
|
6558
|
+
* An alternative function to `readableColor`. Returns whether or not the
|
|
6559
|
+
* readable color (i.e. the color to be place on top the input color) should be
|
|
6560
|
+
* black.
|
|
6561
|
+
*/
|
|
6562
|
+
|
|
6563
|
+
|
|
6564
|
+
function readableColorIsBlack(color) {
|
|
6565
|
+
return getLuminance(color) > 0.179;
|
|
6362
6566
|
}
|
|
6363
6567
|
|
|
6364
6568
|
var _excluded$1 = ["pos"];
|
|
@@ -6379,39 +6583,39 @@ var Cursor = function Cursor(_ref3) {
|
|
|
6379
6583
|
_ref3$size = _ref3.size,
|
|
6380
6584
|
size = _ref3$size === void 0 ? 40 : _ref3$size,
|
|
6381
6585
|
text = _ref3.text;
|
|
6382
|
-
var textColor =
|
|
6383
|
-
return /*#__PURE__*/
|
|
6586
|
+
var textColor = readableColorIsBlack(color) ? "#222" : "#EEE";
|
|
6587
|
+
return /*#__PURE__*/React__default.createElement(StyledCursor, null, /*#__PURE__*/React__default.createElement("svg", {
|
|
6384
6588
|
version: "1.1",
|
|
6385
6589
|
id: "Layer_1",
|
|
6386
6590
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6387
6591
|
viewBox: "1064.7701 445.5539 419.8101 717.0565",
|
|
6388
6592
|
width: size,
|
|
6389
6593
|
height: size
|
|
6390
|
-
}, /*#__PURE__*/
|
|
6594
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
6391
6595
|
d: "m 1197.1015,869.718 -62.2719,-154.49286 133.3276,-9.05842 -257.6915,-253.12748 1.2392,356.98609 88.2465,-79.47087 61.702,152.78366 z",
|
|
6392
6596
|
style: {
|
|
6393
6597
|
fill: textColor
|
|
6394
6598
|
}
|
|
6395
|
-
}), /*#__PURE__*/
|
|
6599
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
6396
6600
|
d: "m 1193.0939,861.12419 -62.2719,-154.49286 133.3276,-9.05842 -257.6915,-253.12748 1.2392,356.98609 88.2465,-79.47087 61.702,152.78366 z",
|
|
6397
6601
|
style: {
|
|
6398
6602
|
fill: "white",
|
|
6399
6603
|
stroke: "#111",
|
|
6400
6604
|
strokeWidth: 20
|
|
6401
6605
|
}
|
|
6402
|
-
})), /*#__PURE__*/
|
|
6606
|
+
})), /*#__PURE__*/React__default.createElement(CursorName, {
|
|
6403
6607
|
color: color,
|
|
6404
6608
|
textColor: textColor
|
|
6405
6609
|
}, text));
|
|
6406
6610
|
};
|
|
6407
6611
|
|
|
6408
|
-
var MemoizedCursor = /*#__PURE__*/
|
|
6612
|
+
var MemoizedCursor = /*#__PURE__*/React__default.memo(Cursor);
|
|
6409
6613
|
|
|
6410
6614
|
var PositionnedCursor = function PositionnedCursor(_ref4) {
|
|
6411
6615
|
var pos = _ref4.pos,
|
|
6412
6616
|
rest = _objectWithoutProperties(_ref4, _excluded$1);
|
|
6413
6617
|
|
|
6414
|
-
return /*#__PURE__*/
|
|
6618
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
6415
6619
|
style: {
|
|
6416
6620
|
transform: "translate(".concat(pos.x - 5, "px, ").concat(pos.y - 3, "px)"),
|
|
6417
6621
|
top: 0,
|
|
@@ -6420,7 +6624,7 @@ var PositionnedCursor = function PositionnedCursor(_ref4) {
|
|
|
6420
6624
|
position: "fixed",
|
|
6421
6625
|
pointerEvents: "none"
|
|
6422
6626
|
}
|
|
6423
|
-
}, /*#__PURE__*/
|
|
6627
|
+
}, /*#__PURE__*/React__default.createElement(MemoizedCursor, rest));
|
|
6424
6628
|
};
|
|
6425
6629
|
|
|
6426
6630
|
var Cursors = function Cursors(_ref) {
|
|
@@ -6429,20 +6633,20 @@ var Cursors = function Cursors(_ref) {
|
|
|
6429
6633
|
var _useWire = useWire("board"),
|
|
6430
6634
|
wire = _useWire.wire;
|
|
6431
6635
|
|
|
6432
|
-
var _React$useState =
|
|
6636
|
+
var _React$useState = React__default.useState({}),
|
|
6433
6637
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6434
6638
|
cursors = _React$useState2[0],
|
|
6435
6639
|
setCursors = _React$useState2[1];
|
|
6436
6640
|
|
|
6437
|
-
var preventRef =
|
|
6438
|
-
var usersById =
|
|
6641
|
+
var preventRef = React__default.useRef(false);
|
|
6642
|
+
var usersById = React__default.useMemo(function () {
|
|
6439
6643
|
return users.reduce(function (acc, user) {
|
|
6440
6644
|
acc[user.id] = user;
|
|
6441
6645
|
return acc;
|
|
6442
6646
|
}, {});
|
|
6443
6647
|
}, [users]); // Prevent race condition when removing user
|
|
6444
6648
|
|
|
6445
|
-
var currentCursor =
|
|
6649
|
+
var currentCursor = React__default.useMemo(function () {
|
|
6446
6650
|
return users.reduce(function (acc, user) {
|
|
6447
6651
|
if (cursors[user.id]) {
|
|
6448
6652
|
acc[user.id] = cursors[user.id];
|
|
@@ -6451,7 +6655,7 @@ var Cursors = function Cursors(_ref) {
|
|
|
6451
6655
|
return acc;
|
|
6452
6656
|
}, {});
|
|
6453
6657
|
}, [users, cursors]);
|
|
6454
|
-
|
|
6658
|
+
React__default.useEffect(function () {
|
|
6455
6659
|
setCursors(function (prevCursors) {
|
|
6456
6660
|
return users.reduce(function (acc, user) {
|
|
6457
6661
|
if (prevCursors[user.id]) {
|
|
@@ -6462,7 +6666,7 @@ var Cursors = function Cursors(_ref) {
|
|
|
6462
6666
|
}, {});
|
|
6463
6667
|
});
|
|
6464
6668
|
}, [users]);
|
|
6465
|
-
|
|
6669
|
+
React__default.useEffect(function () {
|
|
6466
6670
|
var unsub = [];
|
|
6467
6671
|
unsub.push(wire.subscribe("cursorMove", function (_ref2) {
|
|
6468
6672
|
var userId = _ref2.userId,
|
|
@@ -6493,12 +6697,12 @@ var Cursors = function Cursors(_ref) {
|
|
|
6493
6697
|
});
|
|
6494
6698
|
};
|
|
6495
6699
|
}, [wire]);
|
|
6496
|
-
return /*#__PURE__*/
|
|
6700
|
+
return /*#__PURE__*/React__default.createElement("div", null, Object.entries(currentCursor).map(function (_ref4) {
|
|
6497
6701
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
6498
6702
|
userId = _ref5[0],
|
|
6499
6703
|
pos = _ref5[1];
|
|
6500
6704
|
|
|
6501
|
-
return /*#__PURE__*/
|
|
6705
|
+
return /*#__PURE__*/React__default.createElement(PositionnedCursor, {
|
|
6502
6706
|
key: userId,
|
|
6503
6707
|
pos: pos,
|
|
6504
6708
|
text: usersById[userId].name,
|
|
@@ -6517,7 +6721,7 @@ var CursorPane = function CursorPane(_ref) {
|
|
|
6517
6721
|
user = _useUsers.currentUser,
|
|
6518
6722
|
users = _useUsers.users;
|
|
6519
6723
|
|
|
6520
|
-
var publish =
|
|
6724
|
+
var publish = React__default.useCallback(function (newPos) {
|
|
6521
6725
|
wire.publish("cursorMove", {
|
|
6522
6726
|
userId: user.id,
|
|
6523
6727
|
pos: newPos
|
|
@@ -6575,33 +6779,33 @@ var CursorPane = function CursorPane(_ref) {
|
|
|
6575
6779
|
});
|
|
6576
6780
|
};
|
|
6577
6781
|
|
|
6578
|
-
return /*#__PURE__*/
|
|
6782
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
6579
6783
|
onPointerMove: onMouseMove,
|
|
6580
6784
|
onPointerLeave: onLeave
|
|
6581
|
-
}, children, /*#__PURE__*/
|
|
6785
|
+
}, children, /*#__PURE__*/React__default.createElement(Cursors, {
|
|
6582
6786
|
users: users
|
|
6583
6787
|
}));
|
|
6584
6788
|
};
|
|
6585
6789
|
|
|
6586
6790
|
var useMousePosition = function useMousePosition(ref) {
|
|
6587
|
-
var mouseRef =
|
|
6791
|
+
var mouseRef = React__default.useRef({
|
|
6588
6792
|
hover: false,
|
|
6589
6793
|
x: 0,
|
|
6590
6794
|
y: 0
|
|
6591
6795
|
});
|
|
6592
|
-
var onMouseMove =
|
|
6796
|
+
var onMouseMove = React__default.useCallback(function (e) {
|
|
6593
6797
|
var clientX = e.clientX,
|
|
6594
6798
|
clientY = e.clientY;
|
|
6595
6799
|
mouseRef.current.x = clientX;
|
|
6596
6800
|
mouseRef.current.y = clientY;
|
|
6597
6801
|
}, []);
|
|
6598
|
-
var onMouseEnter =
|
|
6802
|
+
var onMouseEnter = React__default.useCallback(function () {
|
|
6599
6803
|
mouseRef.current.hover = true;
|
|
6600
6804
|
}, []);
|
|
6601
|
-
var onMouseLeave =
|
|
6805
|
+
var onMouseLeave = React__default.useCallback(function () {
|
|
6602
6806
|
mouseRef.current.hover = false;
|
|
6603
6807
|
}, []);
|
|
6604
|
-
|
|
6808
|
+
React__default.useEffect(function () {
|
|
6605
6809
|
var current = ref.current;
|
|
6606
6810
|
|
|
6607
6811
|
if (current) {
|
|
@@ -6617,7 +6821,7 @@ var useMousePosition = function useMousePosition(ref) {
|
|
|
6617
6821
|
|
|
6618
6822
|
return null; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6619
6823
|
}, [ref, ref.current, onMouseMove, onMouseEnter, onMouseLeave]);
|
|
6620
|
-
var getMouseInfo =
|
|
6824
|
+
var getMouseInfo = React__default.useCallback(function () {
|
|
6621
6825
|
return mouseRef.current;
|
|
6622
6826
|
}, []);
|
|
6623
6827
|
return getMouseInfo;
|
|
@@ -6628,7 +6832,7 @@ var digitCodes = _toConsumableArray(Array(5).keys()).map(function (id) {
|
|
|
6628
6832
|
});
|
|
6629
6833
|
|
|
6630
6834
|
var usePositionNavigator = function usePositionNavigator() {
|
|
6631
|
-
var _React$useState =
|
|
6835
|
+
var _React$useState = React__default.useState({}),
|
|
6632
6836
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6633
6837
|
positions = _React$useState2[0],
|
|
6634
6838
|
setPositions = _React$useState2[1];
|
|
@@ -6688,7 +6892,7 @@ var usePositionNavigator = function usePositionNavigator() {
|
|
|
6688
6892
|
};
|
|
6689
6893
|
}();
|
|
6690
6894
|
}, [positions]);
|
|
6691
|
-
|
|
6895
|
+
React__default.useEffect(function () {
|
|
6692
6896
|
document.addEventListener("keydown", onKeyDown);
|
|
6693
6897
|
return function () {
|
|
6694
6898
|
document.removeEventListener("keydown", onKeyDown);
|
|
@@ -6703,7 +6907,7 @@ var PanZoom = function PanZoom(_ref) {
|
|
|
6703
6907
|
var children = _ref.children,
|
|
6704
6908
|
_ref$moveFirst = _ref.moveFirst,
|
|
6705
6909
|
moveFirst = _ref$moveFirst === void 0 ? false : _ref$moveFirst;
|
|
6706
|
-
var wrappedRef =
|
|
6910
|
+
var wrappedRef = React__default.useRef(null);
|
|
6707
6911
|
var dim = useRecoilValue(BoardTransformAtom);
|
|
6708
6912
|
|
|
6709
6913
|
var _useDim = useDim(),
|
|
@@ -6713,13 +6917,13 @@ var PanZoom = function PanZoom(_ref) {
|
|
|
6713
6917
|
var _useRecoilValue = useRecoilValue(ConfigurationAtom),
|
|
6714
6918
|
itemExtentGlobal = _useRecoilValue.itemExtent;
|
|
6715
6919
|
|
|
6716
|
-
var _React$useState =
|
|
6920
|
+
var _React$useState = React__default.useState(false),
|
|
6717
6921
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6718
6922
|
centered = _React$useState2[0],
|
|
6719
6923
|
setCentered = _React$useState2[1];
|
|
6720
6924
|
|
|
6721
6925
|
var setBoardState = useSetRecoilState(BoardStateAtom);
|
|
6722
|
-
var timeoutRef =
|
|
6926
|
+
var timeoutRef = React__default.useRef({}); // Get mouse position and hover status
|
|
6723
6927
|
|
|
6724
6928
|
var getMouseInfo = useMousePosition(wrappedRef); // Hooks to save/restore position
|
|
6725
6929
|
|
|
@@ -6766,14 +6970,14 @@ var PanZoom = function PanZoom(_ref) {
|
|
|
6766
6970
|
}, _callee);
|
|
6767
6971
|
}));
|
|
6768
6972
|
}, [setDim]);
|
|
6769
|
-
|
|
6973
|
+
React__default.useEffect(function () {
|
|
6770
6974
|
if (!centered && itemExtentGlobal.left) {
|
|
6771
6975
|
// Center board on first valid extent
|
|
6772
6976
|
centerBoard();
|
|
6773
6977
|
setCentered(true);
|
|
6774
6978
|
}
|
|
6775
6979
|
}, [centerBoard, centered, itemExtentGlobal]);
|
|
6776
|
-
var onZoom =
|
|
6980
|
+
var onZoom = React__default.useCallback(function (_ref4) {
|
|
6777
6981
|
var clientX = _ref4.clientX,
|
|
6778
6982
|
clientY = _ref4.clientY,
|
|
6779
6983
|
scale = _ref4.scale;
|
|
@@ -6796,7 +7000,7 @@ var PanZoom = function PanZoom(_ref) {
|
|
|
6796
7000
|
}) : prev;
|
|
6797
7001
|
});
|
|
6798
7002
|
}, [setBoardState, zoomTo]);
|
|
6799
|
-
var onPan =
|
|
7003
|
+
var onPan = React__default.useCallback( /*#__PURE__*/function () {
|
|
6800
7004
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref5) {
|
|
6801
7005
|
var deltaX, deltaY;
|
|
6802
7006
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -6837,7 +7041,7 @@ var PanZoom = function PanZoom(_ref) {
|
|
|
6837
7041
|
return _ref6.apply(this, arguments);
|
|
6838
7042
|
};
|
|
6839
7043
|
}(), [setBoardState, setDim]);
|
|
6840
|
-
var onDrag =
|
|
7044
|
+
var onDrag = React__default.useCallback(function (state) {
|
|
6841
7045
|
var target = state.target;
|
|
6842
7046
|
var outsideItem = !insideClass(target, "item") || insideClass(target, "locked");
|
|
6843
7047
|
|
|
@@ -6953,7 +7157,7 @@ var PanZoom = function PanZoom(_ref) {
|
|
|
6953
7157
|
};
|
|
6954
7158
|
}();
|
|
6955
7159
|
}, [setDim, zoomTo, getMouseInfo]);
|
|
6956
|
-
var onKeyUp =
|
|
7160
|
+
var onKeyUp = React__default.useCallback(function (e) {
|
|
6957
7161
|
// Ignore text in Input or Textarea
|
|
6958
7162
|
if (["INPUT", "TEXTAREA"].includes(e.target.tagName)) return; // Zoom out on release
|
|
6959
7163
|
|
|
@@ -6961,7 +7165,7 @@ var PanZoom = function PanZoom(_ref) {
|
|
|
6961
7165
|
zoomTo(1 / 3, getMouseInfo());
|
|
6962
7166
|
}
|
|
6963
7167
|
}, [getMouseInfo, zoomTo]);
|
|
6964
|
-
|
|
7168
|
+
React__default.useEffect(function () {
|
|
6965
7169
|
document.addEventListener("keydown", onKeyDown);
|
|
6966
7170
|
document.addEventListener("keyup", onKeyUp);
|
|
6967
7171
|
return function () {
|
|
@@ -6969,11 +7173,11 @@ var PanZoom = function PanZoom(_ref) {
|
|
|
6969
7173
|
document.removeEventListener("keyup", onKeyUp);
|
|
6970
7174
|
};
|
|
6971
7175
|
}, [onKeyDown, onKeyUp]);
|
|
6972
|
-
return /*#__PURE__*/
|
|
7176
|
+
return /*#__PURE__*/React__default.createElement(Gesture, {
|
|
6973
7177
|
onPan: onPan,
|
|
6974
7178
|
onZoom: onZoom,
|
|
6975
7179
|
onDrag: onDrag
|
|
6976
|
-
}, /*#__PURE__*/
|
|
7180
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
6977
7181
|
style: {
|
|
6978
7182
|
display: "inline-block",
|
|
6979
7183
|
transformOrigin: "top left",
|
|
@@ -7073,13 +7277,13 @@ var BoundingBox = function BoundingBox() {
|
|
|
7073
7277
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7074
7278
|
|
|
7075
7279
|
var updateBoxDelay = useDebouncedCallback(updateBox, [updateBox], 300);
|
|
7076
|
-
|
|
7280
|
+
React__default.useEffect(function () {
|
|
7077
7281
|
// Update selected elements bounding box
|
|
7078
7282
|
updateBox();
|
|
7079
7283
|
updateBoxDelay(); // Delay to update after board item animation like tap/untap.
|
|
7080
7284
|
}, [selectedItems, itemMap, boardTransform, updateBox, updateBoxDelay]);
|
|
7081
7285
|
if (!boundingBoxLast || selectedItems.length < 2) return null;
|
|
7082
|
-
return /*#__PURE__*/
|
|
7286
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
7083
7287
|
style: _objectSpread2(_objectSpread2({}, defaultZoneStyle), {}, {
|
|
7084
7288
|
transform: "translate(".concat(boundingBoxLast.left, "px, ").concat(boundingBoxLast.top, "px)"),
|
|
7085
7289
|
height: "".concat(boundingBoxLast.height, "px"),
|
|
@@ -7096,7 +7300,7 @@ var Selection = function Selection() {
|
|
|
7096
7300
|
return null;
|
|
7097
7301
|
}
|
|
7098
7302
|
|
|
7099
|
-
return /*#__PURE__*/
|
|
7303
|
+
return /*#__PURE__*/React__default.createElement(BoundingBox, null);
|
|
7100
7304
|
};
|
|
7101
7305
|
|
|
7102
7306
|
var Board = function Board(_ref) {
|
|
@@ -7115,7 +7319,7 @@ var Board = function Board(_ref) {
|
|
|
7115
7319
|
var _useDim = useDim(),
|
|
7116
7320
|
updateItemExtent = _useDim.updateItemExtent;
|
|
7117
7321
|
|
|
7118
|
-
var boardStyle =
|
|
7322
|
+
var boardStyle = React__default.useMemo(function () {
|
|
7119
7323
|
return _objectSpread2({
|
|
7120
7324
|
userSelect: "none",
|
|
7121
7325
|
width: "".concat(boardSize, "px"),
|
|
@@ -7123,7 +7327,7 @@ var Board = function Board(_ref) {
|
|
|
7123
7327
|
backgroundColor: "#333"
|
|
7124
7328
|
}, style);
|
|
7125
7329
|
}, [boardSize, style]);
|
|
7126
|
-
|
|
7330
|
+
React__default.useEffect(function () {
|
|
7127
7331
|
setConfiguration(function (prev) {
|
|
7128
7332
|
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
7129
7333
|
itemTemplates: itemTemplates,
|
|
@@ -7132,21 +7336,21 @@ var Board = function Board(_ref) {
|
|
|
7132
7336
|
});
|
|
7133
7337
|
});
|
|
7134
7338
|
}, [itemTemplates, setConfiguration, boardSize, showResizeHandle]);
|
|
7135
|
-
|
|
7339
|
+
React__default.useEffect(function () {
|
|
7136
7340
|
updateItemExtent();
|
|
7137
7341
|
setTimeout(updateItemExtent, 2000);
|
|
7138
7342
|
}, [updateItemExtent]);
|
|
7139
|
-
return /*#__PURE__*/
|
|
7343
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SubcribeItemEvents, null), /*#__PURE__*/React__default.createElement(PanZoom, {
|
|
7140
7344
|
moveFirst: moveFirst
|
|
7141
|
-
}, /*#__PURE__*/
|
|
7345
|
+
}, /*#__PURE__*/React__default.createElement(Selector, {
|
|
7142
7346
|
moveFirst: moveFirst
|
|
7143
|
-
}, /*#__PURE__*/
|
|
7347
|
+
}, /*#__PURE__*/React__default.createElement(ActionPane, null, /*#__PURE__*/React__default.createElement(CursorPane, null, /*#__PURE__*/React__default.createElement("div", {
|
|
7144
7348
|
onContextMenu: function onContextMenu(e) {
|
|
7145
7349
|
e.preventDefault();
|
|
7146
7350
|
},
|
|
7147
7351
|
style: boardStyle,
|
|
7148
7352
|
className: "board"
|
|
7149
|
-
}, /*#__PURE__*/
|
|
7353
|
+
}, /*#__PURE__*/React__default.createElement(ItemList, null), children))))), /*#__PURE__*/React__default.createElement(Selection, null));
|
|
7150
7354
|
};
|
|
7151
7355
|
|
|
7152
7356
|
var TOLERANCE = 100;
|
|
@@ -7178,7 +7382,7 @@ var translateBoundaries = function translateBoundaries(_ref) {
|
|
|
7178
7382
|
|
|
7179
7383
|
var useDim = function useDim() {
|
|
7180
7384
|
var setDim = useSetRecoilState(BoardTransformAtom);
|
|
7181
|
-
var scaleBoundariesRef =
|
|
7385
|
+
var scaleBoundariesRef = React__default.useRef([0.1, 8]);
|
|
7182
7386
|
|
|
7183
7387
|
var _useRecoilValue = useRecoilValue(ConfigurationAtom),
|
|
7184
7388
|
itemExtentGlobal = _useRecoilValue.itemExtent;
|
|
@@ -7490,7 +7694,7 @@ var useDim = function useDim() {
|
|
|
7490
7694
|
}));
|
|
7491
7695
|
}, []);
|
|
7492
7696
|
var debouncedUpdateItemExtent = useDebouncedCallback(updateItemExtent, [], 300);
|
|
7493
|
-
|
|
7697
|
+
React__default.useEffect(function () {
|
|
7494
7698
|
if (itemExtentGlobal.left) {
|
|
7495
7699
|
updateScaleBoundaries();
|
|
7496
7700
|
}
|
|
@@ -7506,7 +7710,7 @@ var useDim = function useDim() {
|
|
|
7506
7710
|
|
|
7507
7711
|
var useItemInteraction = function useItemInteraction(interaction) {
|
|
7508
7712
|
var setInteractions = useSetRecoilState(ItemInteractionsAtom);
|
|
7509
|
-
var register =
|
|
7713
|
+
var register = React__default.useCallback(function (callback) {
|
|
7510
7714
|
setInteractions(function (prev) {
|
|
7511
7715
|
var newInter = Array.isArray(prev[interaction]) ? [].concat(_toConsumableArray(prev[interaction]), [callback]) : [callback];
|
|
7512
7716
|
return _objectSpread2(_objectSpread2({}, prev), {}, _defineProperty({}, interaction, newInter));
|
|
@@ -7641,7 +7845,7 @@ var useItemActions = function useItemActions() {
|
|
|
7641
7845
|
};
|
|
7642
7846
|
}();
|
|
7643
7847
|
}, [setItemMap, updateItemExtent, wire]);
|
|
7644
|
-
var setItemListFull =
|
|
7848
|
+
var setItemListFull = React__default.useCallback(function (items) {
|
|
7645
7849
|
setItemMap(items.reduce(function (acc, item) {
|
|
7646
7850
|
if (item && item.id) {
|
|
7647
7851
|
acc[item.id] = item;
|
|
@@ -7657,11 +7861,11 @@ var useItemActions = function useItemActions() {
|
|
|
7657
7861
|
setSelectItems([]);
|
|
7658
7862
|
updateItemExtent();
|
|
7659
7863
|
}, [setItemList, setItemMap, setSelectItems, updateItemExtent]);
|
|
7660
|
-
var updateItem =
|
|
7864
|
+
var updateItem = React__default.useCallback(function (id, callbackOrItem) {
|
|
7661
7865
|
var sync = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
7662
7866
|
batchUpdateItems([id], callbackOrItem, sync);
|
|
7663
7867
|
}, [batchUpdateItems]);
|
|
7664
|
-
var moveItems =
|
|
7868
|
+
var moveItems = React__default.useCallback(function (itemIds, posDelta) {
|
|
7665
7869
|
var sync = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
7666
7870
|
setItemMap(function (prevItemMap) {
|
|
7667
7871
|
var result = _objectSpread2({}, prevItemMap);
|
|
@@ -7691,7 +7895,7 @@ var useItemActions = function useItemActions() {
|
|
|
7691
7895
|
|
|
7692
7896
|
updateItemExtent();
|
|
7693
7897
|
}, [setItemMap, updateItemExtent, wire]);
|
|
7694
|
-
var putItemsOnTop =
|
|
7898
|
+
var putItemsOnTop = React__default.useCallback(function (itemIdsToMove) {
|
|
7695
7899
|
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
7696
7900
|
setItemList(function (prevItemList) {
|
|
7697
7901
|
var filtered = prevItemList.filter(function (id) {
|
|
@@ -7855,7 +8059,7 @@ var useItemActions = function useItemActions() {
|
|
|
7855
8059
|
};
|
|
7856
8060
|
}();
|
|
7857
8061
|
}, [wire, setItemMap]);
|
|
7858
|
-
var placeItems =
|
|
8062
|
+
var placeItems = React__default.useCallback( /*#__PURE__*/function () {
|
|
7859
8063
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(itemIds, gridConfig) {
|
|
7860
8064
|
var sync,
|
|
7861
8065
|
_args3 = arguments;
|
|
@@ -7889,7 +8093,7 @@ var useItemActions = function useItemActions() {
|
|
|
7889
8093
|
return _ref8.apply(this, arguments);
|
|
7890
8094
|
};
|
|
7891
8095
|
}(), [batchUpdateItems, callPlaceInteractions, putItemsOnTop, stickOnGrid, updateItemExtent]);
|
|
7892
|
-
var updateItemOrder =
|
|
8096
|
+
var updateItemOrder = React__default.useCallback(function (newOrder) {
|
|
7893
8097
|
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
7894
8098
|
setItemList(newOrder);
|
|
7895
8099
|
|
|
@@ -7897,7 +8101,7 @@ var useItemActions = function useItemActions() {
|
|
|
7897
8101
|
wire.publish("updateItemListOrder", newOrder);
|
|
7898
8102
|
}
|
|
7899
8103
|
}, [wire, setItemList]);
|
|
7900
|
-
var reverseItemsOrder =
|
|
8104
|
+
var reverseItemsOrder = React__default.useCallback(function (itemIdsToReverse) {
|
|
7901
8105
|
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
7902
8106
|
setItemList(function (prevItemList) {
|
|
7903
8107
|
var toBeReversed = prevItemList.filter(function (id) {
|
|
@@ -8011,7 +8215,7 @@ var useItemActions = function useItemActions() {
|
|
|
8011
8215
|
};
|
|
8012
8216
|
}();
|
|
8013
8217
|
}, [wire, setItemList, setItemMap]);
|
|
8014
|
-
var pushItems =
|
|
8218
|
+
var pushItems = React__default.useCallback( /*#__PURE__*/function () {
|
|
8015
8219
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(itemsToInsert, beforeId) {
|
|
8016
8220
|
var sync,
|
|
8017
8221
|
_args6 = arguments;
|
|
@@ -8087,11 +8291,11 @@ var useItemActions = function useItemActions() {
|
|
|
8087
8291
|
return _ref11.apply(this, arguments);
|
|
8088
8292
|
};
|
|
8089
8293
|
}(), [updateItemExtent, getCenter, setItemMap, setItemList, wire]);
|
|
8090
|
-
var pushItem =
|
|
8294
|
+
var pushItem = React__default.useCallback(function (itemToInsert, beforeId) {
|
|
8091
8295
|
var sync = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
8092
8296
|
pushItems([itemToInsert], beforeId, sync);
|
|
8093
8297
|
}, [pushItems]);
|
|
8094
|
-
var removeItems =
|
|
8298
|
+
var removeItems = React__default.useCallback(function (itemsIdToRemove) {
|
|
8095
8299
|
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
8096
8300
|
// Remove from selected items first
|
|
8097
8301
|
setSelectItems(function (prevList) {
|
|
@@ -8459,12 +8663,12 @@ var useAvailableActions = function useAvailableActions() {
|
|
|
8459
8663
|
|
|
8460
8664
|
var selected = useRecoilValue(SelectedItemsAtom);
|
|
8461
8665
|
|
|
8462
|
-
var _React$useState =
|
|
8666
|
+
var _React$useState = React__default.useState([]),
|
|
8463
8667
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
8464
8668
|
availableActions = _React$useState2[0],
|
|
8465
8669
|
setAvailableActions = _React$useState2[1];
|
|
8466
8670
|
|
|
8467
|
-
var isMountedRef =
|
|
8671
|
+
var isMountedRef = React__default.useRef(false);
|
|
8468
8672
|
var getItemListOrSelected = useRecoilCallback(function (_ref) {
|
|
8469
8673
|
var snapshot = _ref.snapshot;
|
|
8470
8674
|
return /*#__PURE__*/function () {
|
|
@@ -8512,7 +8716,7 @@ var useAvailableActions = function useAvailableActions() {
|
|
|
8512
8716
|
};
|
|
8513
8717
|
}();
|
|
8514
8718
|
}, []);
|
|
8515
|
-
|
|
8719
|
+
React__default.useEffect(function () {
|
|
8516
8720
|
// Mounted guard
|
|
8517
8721
|
isMountedRef.current = true;
|
|
8518
8722
|
return function () {
|
|
@@ -8524,7 +8728,7 @@ var useAvailableActions = function useAvailableActions() {
|
|
|
8524
8728
|
* items have this exact same action with same parameters.
|
|
8525
8729
|
*/
|
|
8526
8730
|
|
|
8527
|
-
var updateAvailableActions =
|
|
8731
|
+
var updateAvailableActions = React__default.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
8528
8732
|
var _yield$getItemListOrS, _yield$getItemListOrS2, selectedItemIds, selectedItemList, allActions;
|
|
8529
8733
|
|
|
8530
8734
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
@@ -8576,7 +8780,7 @@ var useAvailableActions = function useAvailableActions() {
|
|
|
8576
8780
|
}, _callee2);
|
|
8577
8781
|
})), [getItemListOrSelected, itemMap]); // Update available actions when selection change
|
|
8578
8782
|
|
|
8579
|
-
|
|
8783
|
+
React__default.useEffect(function () {
|
|
8580
8784
|
updateAvailableActions();
|
|
8581
8785
|
}, [updateAvailableActions, selected]);
|
|
8582
8786
|
return {
|
|
@@ -8600,7 +8804,7 @@ var useBoardConfig = function useBoardConfig() {
|
|
|
8600
8804
|
var debouncedPublishUpdate = useDebouncedCallback(function (newConfig) {
|
|
8601
8805
|
wire.publish("updateBoardConfig", newConfig);
|
|
8602
8806
|
}, [wire], 1000);
|
|
8603
|
-
var setSyncBoardConfig =
|
|
8807
|
+
var setSyncBoardConfig = React__default.useCallback(function (callbackOrConfig) {
|
|
8604
8808
|
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
8605
8809
|
var callback = callbackOrConfig;
|
|
8606
8810
|
|
|
@@ -8697,22 +8901,29 @@ var dayjs_min = {exports: {}};
|
|
|
8697
8901
|
return void 0 === t;
|
|
8698
8902
|
}
|
|
8699
8903
|
},
|
|
8700
|
-
|
|
8701
|
-
|
|
8904
|
+
v = "en",
|
|
8905
|
+
D = {};
|
|
8702
8906
|
|
|
8703
|
-
v
|
|
8907
|
+
D[v] = M;
|
|
8704
8908
|
|
|
8705
8909
|
var p = function p(t) {
|
|
8706
8910
|
return t instanceof _;
|
|
8707
8911
|
},
|
|
8708
|
-
S = function
|
|
8709
|
-
var
|
|
8710
|
-
if (!
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8912
|
+
S = function t(e, n, r) {
|
|
8913
|
+
var i;
|
|
8914
|
+
if (!e) return v;
|
|
8915
|
+
|
|
8916
|
+
if ("string" == typeof e) {
|
|
8917
|
+
var s = e.toLowerCase();
|
|
8918
|
+
D[s] && (i = s), n && (D[s] = n, i = s);
|
|
8919
|
+
var u = e.split("-");
|
|
8920
|
+
if (!i && u.length > 1) return t(u[0]);
|
|
8921
|
+
} else {
|
|
8922
|
+
var a = e.name;
|
|
8923
|
+
D[a] = e, i = a;
|
|
8714
8924
|
}
|
|
8715
|
-
|
|
8925
|
+
|
|
8926
|
+
return !r && i && (v = i), i || !r && v;
|
|
8716
8927
|
},
|
|
8717
8928
|
w = function w(t, e) {
|
|
8718
8929
|
if (p(t)) return t.clone();
|
|
@@ -8800,9 +9011,9 @@ var dayjs_min = {exports: {}};
|
|
|
8800
9011
|
return r ? $(1, M) : $(0, M + 1);
|
|
8801
9012
|
|
|
8802
9013
|
case o:
|
|
8803
|
-
var
|
|
8804
|
-
|
|
8805
|
-
return $(r ? m -
|
|
9014
|
+
var v = this.$locale().weekStart || 0,
|
|
9015
|
+
D = (y < v ? y + 7 : y) - v;
|
|
9016
|
+
return $(r ? m - D : m + (6 - D), M);
|
|
8806
9017
|
|
|
8807
9018
|
case a:
|
|
8808
9019
|
case d:
|
|
@@ -8919,12 +9130,12 @@ var dayjs_min = {exports: {}};
|
|
|
8919
9130
|
M = w(r),
|
|
8920
9131
|
m = (M.utcOffset() - this.utcOffset()) * e,
|
|
8921
9132
|
g = this - M,
|
|
8922
|
-
|
|
8923
|
-
return
|
|
9133
|
+
v = O.m(this, M);
|
|
9134
|
+
return v = (l = {}, l[c] = v / 12, l[f] = v, l[h] = v / 3, l[o] = (g - m) / 6048e5, l[a] = (g - m) / 864e5, l[u] = g / n, l[s] = g / e, l[i] = g / t, l)[y] || g, $ ? v : O.a(v);
|
|
8924
9135
|
}, m.daysInMonth = function () {
|
|
8925
9136
|
return this.endOf(f).$D;
|
|
8926
9137
|
}, m.$locale = function () {
|
|
8927
|
-
return
|
|
9138
|
+
return D[this.$L];
|
|
8928
9139
|
}, m.locale = function (t, e) {
|
|
8929
9140
|
if (!t) return this.$L;
|
|
8930
9141
|
var n = this.clone(),
|
|
@@ -8952,7 +9163,7 @@ var dayjs_min = {exports: {}};
|
|
|
8952
9163
|
return t.$i || (t(e, _, w), t.$i = !0), w;
|
|
8953
9164
|
}, w.locale = S, w.isDayjs = p, w.unix = function (t) {
|
|
8954
9165
|
return w(1e3 * t);
|
|
8955
|
-
}, w.en = v
|
|
9166
|
+
}, w.en = D[v], w.Ls = D, w.p = {}, w;
|
|
8956
9167
|
});
|
|
8957
9168
|
})(dayjs_min);
|
|
8958
9169
|
|
|
@@ -9037,12 +9248,12 @@ var useMessage = function useMessage() {
|
|
|
9037
9248
|
}, _callee);
|
|
9038
9249
|
}));
|
|
9039
9250
|
}, []);
|
|
9040
|
-
var setMessages =
|
|
9251
|
+
var setMessages = React__default.useCallback(function (newMessages) {
|
|
9041
9252
|
setMessagesState(newMessages.map(function (m) {
|
|
9042
9253
|
return parseMessage(m);
|
|
9043
9254
|
}));
|
|
9044
9255
|
}, [setMessagesState]);
|
|
9045
|
-
var initEvents =
|
|
9256
|
+
var initEvents = React__default.useCallback(function (unsub) {
|
|
9046
9257
|
unsub.push(wire.subscribe("newMessage", function (newMessage) {
|
|
9047
9258
|
setMessagesState(function (prevMessages) {
|
|
9048
9259
|
return [].concat(_toConsumableArray(prevMessages), [parseMessage(newMessage)]);
|
|
@@ -9062,7 +9273,7 @@ var useMessage = function useMessage() {
|
|
|
9062
9273
|
|
|
9063
9274
|
return unsub;
|
|
9064
9275
|
}, [wire, getMessage, isMaster, onMessage, setMessages, setMessagesState]);
|
|
9065
|
-
|
|
9276
|
+
React__default.useEffect(function () {
|
|
9066
9277
|
var unsub = [];
|
|
9067
9278
|
|
|
9068
9279
|
if (subscribeEvents) {
|
|
@@ -9075,7 +9286,7 @@ var useMessage = function useMessage() {
|
|
|
9075
9286
|
});
|
|
9076
9287
|
};
|
|
9077
9288
|
}, [initEvents, subscribeEvents]);
|
|
9078
|
-
var sendMessage =
|
|
9289
|
+
var sendMessage = React__default.useCallback(function (messageContent) {
|
|
9079
9290
|
var newMessage = generateMsg({
|
|
9080
9291
|
user: currentUser,
|
|
9081
9292
|
content: messageContent
|
|
@@ -9097,7 +9308,7 @@ var StyledBoardView = newStyled.div(_templateObject || (_templateObject = _tagge
|
|
|
9097
9308
|
var SyncBoard = function SyncBoard(_ref) {
|
|
9098
9309
|
var children = _ref.children,
|
|
9099
9310
|
style = _ref.style;
|
|
9100
|
-
var boardWrapperRef =
|
|
9311
|
+
var boardWrapperRef = React__default.useRef(null);
|
|
9101
9312
|
var setCurrentUserState = useSetRecoilState(userAtom);
|
|
9102
9313
|
|
|
9103
9314
|
var _useWire = useWire("board"),
|
|
@@ -9108,7 +9319,7 @@ var SyncBoard = function SyncBoard(_ref) {
|
|
|
9108
9319
|
uid = _useRecoilState2[0].uid,
|
|
9109
9320
|
setConfiguration = _useRecoilState2[1];
|
|
9110
9321
|
|
|
9111
|
-
|
|
9322
|
+
React__default.useEffect(function () {
|
|
9112
9323
|
// Chrome-related issue.
|
|
9113
9324
|
// Making the wheel event non-passive, which allows to use preventDefault() to prevent
|
|
9114
9325
|
// the browser original zoom and therefore allowing our custom one.
|
|
@@ -9125,7 +9336,7 @@ var SyncBoard = function SyncBoard(_ref) {
|
|
|
9125
9336
|
};
|
|
9126
9337
|
}, []); // Set user space
|
|
9127
9338
|
|
|
9128
|
-
|
|
9339
|
+
React__default.useEffect(function () {
|
|
9129
9340
|
setCurrentUserState(function (prevUser) {
|
|
9130
9341
|
return _objectSpread2(_objectSpread2({}, prevUser), {}, {
|
|
9131
9342
|
space: session
|
|
@@ -9139,7 +9350,7 @@ var SyncBoard = function SyncBoard(_ref) {
|
|
|
9139
9350
|
});
|
|
9140
9351
|
};
|
|
9141
9352
|
}, [session, setCurrentUserState]);
|
|
9142
|
-
|
|
9353
|
+
React__default.useEffect(function () {
|
|
9143
9354
|
if (!uid) {
|
|
9144
9355
|
setConfiguration(function (prev) {
|
|
9145
9356
|
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
@@ -9148,7 +9359,7 @@ var SyncBoard = function SyncBoard(_ref) {
|
|
|
9148
9359
|
});
|
|
9149
9360
|
}
|
|
9150
9361
|
}, [setConfiguration, uid]);
|
|
9151
|
-
|
|
9362
|
+
React__default.useEffect(function () {
|
|
9152
9363
|
setConfiguration(function (prev) {
|
|
9153
9364
|
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
9154
9365
|
boardWrapper: boardWrapperRef.current
|
|
@@ -9162,7 +9373,7 @@ var SyncBoard = function SyncBoard(_ref) {
|
|
|
9162
9373
|
});
|
|
9163
9374
|
});
|
|
9164
9375
|
});
|
|
9165
|
-
return /*#__PURE__*/
|
|
9376
|
+
return /*#__PURE__*/React__default.createElement(StyledBoardView, {
|
|
9166
9377
|
ref: boardWrapperRef,
|
|
9167
9378
|
id: uid,
|
|
9168
9379
|
className: "sync-board",
|
|
@@ -9176,11 +9387,11 @@ var ConnectedSyncBoard = function ConnectedSyncBoard(_ref2) {
|
|
|
9176
9387
|
session = _ref2.session,
|
|
9177
9388
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
9178
9389
|
|
|
9179
|
-
var _React$useState =
|
|
9390
|
+
var _React$useState = React__default.useState(room || nanoid()),
|
|
9180
9391
|
_React$useState2 = _slicedToArray(_React$useState, 1),
|
|
9181
9392
|
stableRoom = _React$useState2[0];
|
|
9182
9393
|
|
|
9183
|
-
var _React$useState3 =
|
|
9394
|
+
var _React$useState3 = React__default.useState(session || nanoid()),
|
|
9184
9395
|
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
9185
9396
|
stableSession = _React$useState4[0];
|
|
9186
9397
|
|
|
@@ -9188,22 +9399,22 @@ var ConnectedSyncBoard = function ConnectedSyncBoard(_ref2) {
|
|
|
9188
9399
|
|
|
9189
9400
|
if (!roomChannel) {
|
|
9190
9401
|
// No room declared so we create one
|
|
9191
|
-
return /*#__PURE__*/
|
|
9402
|
+
return /*#__PURE__*/React__default.createElement(RecoilRoot, null, /*#__PURE__*/React__default.createElement(WireProvider, {
|
|
9192
9403
|
room: stableRoom,
|
|
9193
9404
|
channel: "room",
|
|
9194
9405
|
socket: socket
|
|
9195
|
-
}, /*#__PURE__*/
|
|
9406
|
+
}, /*#__PURE__*/React__default.createElement(SubscribeUserEvents, null), /*#__PURE__*/React__default.createElement(WireProvider, {
|
|
9196
9407
|
room: stableSession,
|
|
9197
9408
|
channel: "board",
|
|
9198
9409
|
socket: socket
|
|
9199
|
-
}, /*#__PURE__*/
|
|
9410
|
+
}, /*#__PURE__*/React__default.createElement(SyncBoard, props))));
|
|
9200
9411
|
}
|
|
9201
9412
|
|
|
9202
|
-
return /*#__PURE__*/
|
|
9413
|
+
return /*#__PURE__*/React__default.createElement(WireProvider, {
|
|
9203
9414
|
room: stableSession,
|
|
9204
9415
|
channel: "board",
|
|
9205
9416
|
socket: socket
|
|
9206
|
-
}, /*#__PURE__*/
|
|
9417
|
+
}, /*#__PURE__*/React__default.createElement(SyncBoard, props));
|
|
9207
9418
|
};
|
|
9208
9419
|
|
|
9209
9420
|
var ConnectedSyncRoom = function ConnectedSyncRoom(_ref) {
|
|
@@ -9211,17 +9422,17 @@ var ConnectedSyncRoom = function ConnectedSyncRoom(_ref) {
|
|
|
9211
9422
|
givenRoom = _ref.room,
|
|
9212
9423
|
children = _ref.children;
|
|
9213
9424
|
|
|
9214
|
-
var _React$useState =
|
|
9425
|
+
var _React$useState = React__default.useState(function () {
|
|
9215
9426
|
return givenRoom || nanoid();
|
|
9216
9427
|
}),
|
|
9217
9428
|
_React$useState2 = _slicedToArray(_React$useState, 1),
|
|
9218
9429
|
room = _React$useState2[0];
|
|
9219
9430
|
|
|
9220
|
-
return /*#__PURE__*/
|
|
9431
|
+
return /*#__PURE__*/React__default.createElement(RecoilRoot, null, /*#__PURE__*/React__default.createElement(WireProvider, {
|
|
9221
9432
|
room: room,
|
|
9222
9433
|
channel: "room",
|
|
9223
9434
|
socket: socket
|
|
9224
|
-
}, /*#__PURE__*/
|
|
9435
|
+
}, /*#__PURE__*/React__default.createElement(SubscribeUserEvents, null), children));
|
|
9225
9436
|
};
|
|
9226
9437
|
|
|
9227
9438
|
export { Board, ConnectedSyncBoard as BoardWrapper, ConnectedSyncRoom as RoomWrapper, useAvailableActions, useBoardConfig, useDim as useBoardPosition, useBoardState, useItemActions, useItemInteraction, useItemList as useItems, useMessage, useSelectedItems, useSelectionBox, useUsers, useWire };
|