@adam-milo/ui 1.0.28 → 1.0.29
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/index.cjs +1 -1
- package/dist/index.js +3 -1
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +1 -1
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +1 -1
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +1 -1
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +2 -2
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +1 -1
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +43 -12
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +1 -1
- package/dist/index20.cjs +1 -0
- package/dist/index20.js +14 -0
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +20 -299
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +298 -13
- package/dist/index24.cjs +1 -0
- package/dist/index24.js +16 -0
- package/dist/{index26.cjs → index27.cjs} +1 -1
- package/dist/{index26.js → index27.js} +21 -21
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +2 -2
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +1 -1
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +18 -3
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +3 -8
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +7 -66
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +66 -35
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +31 -56
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +60 -6
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +6 -208
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +203 -20
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +23 -202
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +204 -10
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +1 -1
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +10 -289
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +288 -13
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +14 -39
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +36 -82
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +84 -9
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +8 -65
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +68 -3
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +3 -11
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +11 -31
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +30 -118
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +2 -2
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +120 -9
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +8 -14
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +14 -22
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +291 -33
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +22 -622
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +35 -35
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +620 -33
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +37 -5
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +36 -8
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +1 -1
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +5 -3
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +8 -33
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +3 -178
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +31 -17
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +165 -706
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +16 -149
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +697 -149
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +150 -43
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +170 -10
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +83 -14
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +1 -1
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +41 -96
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +10 -85
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +15 -7
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +99 -26
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +8 -34
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +27 -14
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +30 -41
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +13 -6
- package/dist/index88.cjs +1 -0
- package/dist/index88.js +48 -0
- package/dist/index89.cjs +1 -0
- package/dist/index89.js +9 -0
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +2 -2
- package/dist/src/components/typography/text/Text.component.d.ts +93 -0
- package/dist/src/components/typography/text/Text.component.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/index21.cjs +0 -1
- package/dist/index21.js +0 -22
- package/dist/index38.cjs +0 -1
- package/dist/index38.js +0 -21
- package/dist/index62.cjs +0 -1
- package/dist/index62.js +0 -297
- /package/dist/{index34.cjs → index35.cjs} +0 -0
- /package/dist/{index34.js → index35.js} +0 -0
package/dist/index80.js
CHANGED
|
@@ -1,102 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { styleSingleton } from "./index81.js";
|
|
3
|
+
import { noScrollbarsClassName, zeroRightClassName, fullWidthClassName, removedBarSizeVariable } from "./index71.js";
|
|
4
|
+
import { getGapWidth } from "./index86.js";
|
|
5
|
+
var Style = styleSingleton();
|
|
6
|
+
var lockAttribute = "data-scroll-locked";
|
|
7
|
+
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
8
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
9
|
+
if (gapMode === void 0) {
|
|
10
|
+
gapMode = "margin";
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
return
|
|
17
|
-
};
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
29
|
-
if (isScrollable) {
|
|
30
|
-
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
31
|
-
if (scrollHeight > clientHeight) {
|
|
32
|
-
return true;
|
|
12
|
+
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
13
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
14
|
+
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
15
|
+
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
16
|
+
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
17
|
+
};
|
|
18
|
+
var getCurrentUseCounter = function() {
|
|
19
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
20
|
+
return isFinite(counter) ? counter : 0;
|
|
21
|
+
};
|
|
22
|
+
var useLockAttribute = function() {
|
|
23
|
+
React.useEffect(function() {
|
|
24
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
25
|
+
return function() {
|
|
26
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
27
|
+
if (newCounter <= 0) {
|
|
28
|
+
document.body.removeAttribute(lockAttribute);
|
|
29
|
+
} else {
|
|
30
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
33
31
|
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
} while (current && current !== ownerDocument.body);
|
|
37
|
-
return false;
|
|
38
|
-
};
|
|
39
|
-
var getVScrollVariables = function(_a) {
|
|
40
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
41
|
-
return [
|
|
42
|
-
scrollTop,
|
|
43
|
-
scrollHeight,
|
|
44
|
-
clientHeight
|
|
45
|
-
];
|
|
46
|
-
};
|
|
47
|
-
var getHScrollVariables = function(_a) {
|
|
48
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
49
|
-
return [
|
|
50
|
-
scrollLeft,
|
|
51
|
-
scrollWidth,
|
|
52
|
-
clientWidth
|
|
53
|
-
];
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
54
34
|
};
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
63
|
-
};
|
|
64
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
65
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
66
|
-
var delta = directionFactor * sourceDelta;
|
|
67
|
-
var target = event.target;
|
|
68
|
-
var targetInLock = endTarget.contains(target);
|
|
69
|
-
var shouldCancelScroll = false;
|
|
70
|
-
var isDeltaPositive = delta > 0;
|
|
71
|
-
var availableScroll = 0;
|
|
72
|
-
var availableScrollTop = 0;
|
|
73
|
-
do {
|
|
74
|
-
if (!target) {
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
78
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
79
|
-
if (position || elementScroll) {
|
|
80
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
81
|
-
availableScroll += elementScroll;
|
|
82
|
-
availableScrollTop += position;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
var parent_1 = target.parentNode;
|
|
86
|
-
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
87
|
-
} while (
|
|
88
|
-
// portaled content
|
|
89
|
-
!targetInLock && target !== document.body || // self content
|
|
90
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
91
|
-
);
|
|
92
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
93
|
-
shouldCancelScroll = true;
|
|
94
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
95
|
-
shouldCancelScroll = true;
|
|
96
|
-
}
|
|
97
|
-
return shouldCancelScroll;
|
|
35
|
+
var RemoveScrollBar = function(_a) {
|
|
36
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
37
|
+
useLockAttribute();
|
|
38
|
+
var gap = React.useMemo(function() {
|
|
39
|
+
return getGapWidth(gapMode);
|
|
40
|
+
}, [gapMode]);
|
|
41
|
+
return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
98
42
|
};
|
|
99
43
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
44
|
+
RemoveScrollBar,
|
|
45
|
+
lockAttribute,
|
|
46
|
+
useLockAttribute
|
|
102
47
|
};
|
package/dist/index81.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index87.cjs");exports.styleSingleton=function(){var t=e.styleHookSingleton();return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}};
|
package/dist/index81.js
CHANGED
|
@@ -1,88 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
var buffer = [];
|
|
10
|
-
var assigned = false;
|
|
11
|
-
var medium = {
|
|
12
|
-
read: function() {
|
|
13
|
-
if (assigned) {
|
|
14
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
15
|
-
}
|
|
16
|
-
if (buffer.length) {
|
|
17
|
-
return buffer[buffer.length - 1];
|
|
18
|
-
}
|
|
19
|
-
return defaults;
|
|
20
|
-
},
|
|
21
|
-
useMedium: function(data) {
|
|
22
|
-
var item = middleware(data, assigned);
|
|
23
|
-
buffer.push(item);
|
|
24
|
-
return function() {
|
|
25
|
-
buffer = buffer.filter(function(x) {
|
|
26
|
-
return x !== item;
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
assignSyncMedium: function(cb) {
|
|
31
|
-
assigned = true;
|
|
32
|
-
while (buffer.length) {
|
|
33
|
-
var cbs = buffer;
|
|
34
|
-
buffer = [];
|
|
35
|
-
cbs.forEach(cb);
|
|
36
|
-
}
|
|
37
|
-
buffer = {
|
|
38
|
-
push: function(x) {
|
|
39
|
-
return cb(x);
|
|
40
|
-
},
|
|
41
|
-
filter: function() {
|
|
42
|
-
return buffer;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
assignMedium: function(cb) {
|
|
47
|
-
assigned = true;
|
|
48
|
-
var pendingQueue = [];
|
|
49
|
-
if (buffer.length) {
|
|
50
|
-
var cbs = buffer;
|
|
51
|
-
buffer = [];
|
|
52
|
-
cbs.forEach(cb);
|
|
53
|
-
pendingQueue = buffer;
|
|
54
|
-
}
|
|
55
|
-
var executeQueue = function() {
|
|
56
|
-
var cbs2 = pendingQueue;
|
|
57
|
-
pendingQueue = [];
|
|
58
|
-
cbs2.forEach(cb);
|
|
59
|
-
};
|
|
60
|
-
var cycle = function() {
|
|
61
|
-
return Promise.resolve().then(executeQueue);
|
|
62
|
-
};
|
|
63
|
-
cycle();
|
|
64
|
-
buffer = {
|
|
65
|
-
push: function(x) {
|
|
66
|
-
pendingQueue.push(x);
|
|
67
|
-
cycle();
|
|
68
|
-
},
|
|
69
|
-
filter: function(filter) {
|
|
70
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
71
|
-
return buffer;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
}
|
|
1
|
+
import { styleHookSingleton } from "./index87.js";
|
|
2
|
+
var styleSingleton = function() {
|
|
3
|
+
var useStyle = styleHookSingleton();
|
|
4
|
+
var Sheet = function(_a) {
|
|
5
|
+
var styles = _a.styles, dynamic = _a.dynamic;
|
|
6
|
+
useStyle(styles, dynamic);
|
|
7
|
+
return null;
|
|
75
8
|
};
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
function createSidecarMedium(options) {
|
|
79
|
-
if (options === void 0) {
|
|
80
|
-
options = {};
|
|
81
|
-
}
|
|
82
|
-
var medium = innerCreateMedium(null);
|
|
83
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
84
|
-
return medium;
|
|
85
|
-
}
|
|
9
|
+
return Sheet;
|
|
10
|
+
};
|
|
86
11
|
export {
|
|
87
|
-
|
|
12
|
+
styleSingleton
|
|
88
13
|
};
|
package/dist/index82.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=!1;if("undefined"!=typeof window)try{var t=Object.defineProperty({},"passive",{get:function(){return e=!0,!0}});window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(r){e=!1}var n=!!e&&{passive:!1};exports.nonPassive=n;
|
package/dist/index82.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var passiveSupported = false;
|
|
2
|
+
if (typeof window !== "undefined") {
|
|
3
|
+
try {
|
|
4
|
+
var options = Object.defineProperty({}, "passive", {
|
|
5
|
+
get: function() {
|
|
6
|
+
passiveSupported = true;
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
window.addEventListener("test", options, options);
|
|
11
|
+
window.removeEventListener("test", options, options);
|
|
12
|
+
} catch (err) {
|
|
13
|
+
passiveSupported = false;
|
|
6
14
|
}
|
|
7
|
-
return ref;
|
|
8
15
|
}
|
|
16
|
+
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
9
17
|
export {
|
|
10
|
-
|
|
18
|
+
nonPassive
|
|
11
19
|
};
|
package/dist/index83.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t=function(t,e){if(!(t instanceof Element))return!1;var o=window.getComputedStyle(t);return"hidden"!==o[e]&&!(o.overflowY===o.overflowX&&!function(t){return"TEXTAREA"===t.tagName}(t)&&"visible"===o[e])},e=function(e,o){return"v"===e?function(e){return t(e,"overflowY")}(o):function(e){return t(e,"overflowX")}(o)},o=function(t,e){return"v"===t?[(o=e).scrollTop,o.scrollHeight,o.clientHeight]:function(t){return[t.scrollLeft,t.scrollWidth,t.clientWidth]}(e);var o};exports.handleScroll=function(t,n,r,i,l){var u=function(t,e){return"h"===t&&"rtl"===e?-1:1}(t,window.getComputedStyle(n).direction),a=u*i,c=r.target,d=n.contains(c),f=!1,s=a>0,v=0,h=0;do{if(!c)break;var w=o(t,c),p=w[0],b=w[1]-w[2]-u*p;(p||b)&&e(t,c)&&(v+=b,h+=p);var g=c.parentNode;c=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!d&&c!==document.body||d&&(n.contains(c)||n===c));return(s&&Math.abs(v)<1||!s&&Math.abs(h)<1)&&(f=!0),f},exports.locationCouldBeScrolled=function(t,n){var r=n.ownerDocument,i=n;do{if("undefined"!=typeof ShadowRoot&&i instanceof ShadowRoot&&(i=i.host),e(t,i)){var l=o(t,i);if(l[1]>l[2])return!0}i=i.parentNode}while(i&&i!==r.body);return!1};
|
package/dist/index83.js
CHANGED
|
@@ -1,29 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
var alwaysContainsScroll = function(node) {
|
|
2
|
+
return node.tagName === "TEXTAREA";
|
|
3
|
+
};
|
|
4
|
+
var elementCanBeScrolled = function(node, overflow) {
|
|
5
|
+
if (!(node instanceof Element)) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
var styles = window.getComputedStyle(node);
|
|
9
|
+
return (
|
|
10
|
+
// not-not-scrollable
|
|
11
|
+
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
12
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
var elementCouldBeVScrolled = function(node) {
|
|
16
|
+
return elementCanBeScrolled(node, "overflowY");
|
|
17
|
+
};
|
|
18
|
+
var elementCouldBeHScrolled = function(node) {
|
|
19
|
+
return elementCanBeScrolled(node, "overflowX");
|
|
20
|
+
};
|
|
21
|
+
var locationCouldBeScrolled = function(axis, node) {
|
|
22
|
+
var ownerDocument = node.ownerDocument;
|
|
23
|
+
var current = node;
|
|
24
|
+
do {
|
|
25
|
+
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
26
|
+
current = current.host;
|
|
27
|
+
}
|
|
28
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
29
|
+
if (isScrollable) {
|
|
30
|
+
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
31
|
+
if (scrollHeight > clientHeight) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
current = current.parentNode;
|
|
36
|
+
} while (current && current !== ownerDocument.body);
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
var getVScrollVariables = function(_a) {
|
|
40
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
41
|
+
return [
|
|
42
|
+
scrollTop,
|
|
43
|
+
scrollHeight,
|
|
44
|
+
clientHeight
|
|
45
|
+
];
|
|
46
|
+
};
|
|
47
|
+
var getHScrollVariables = function(_a) {
|
|
48
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
49
|
+
return [
|
|
50
|
+
scrollLeft,
|
|
51
|
+
scrollWidth,
|
|
52
|
+
clientWidth
|
|
53
|
+
];
|
|
54
|
+
};
|
|
55
|
+
var elementCouldBeScrolled = function(axis, node) {
|
|
56
|
+
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
57
|
+
};
|
|
58
|
+
var getScrollVariables = function(axis, node) {
|
|
59
|
+
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
60
|
+
};
|
|
61
|
+
var getDirectionFactor = function(axis, direction) {
|
|
62
|
+
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
63
|
+
};
|
|
64
|
+
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
65
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
66
|
+
var delta = directionFactor * sourceDelta;
|
|
67
|
+
var target = event.target;
|
|
68
|
+
var targetInLock = endTarget.contains(target);
|
|
69
|
+
var shouldCancelScroll = false;
|
|
70
|
+
var isDeltaPositive = delta > 0;
|
|
71
|
+
var availableScroll = 0;
|
|
72
|
+
var availableScrollTop = 0;
|
|
73
|
+
do {
|
|
74
|
+
if (!target) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
78
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
79
|
+
if (position || elementScroll) {
|
|
80
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
81
|
+
availableScroll += elementScroll;
|
|
82
|
+
availableScrollTop += position;
|
|
21
83
|
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
84
|
+
}
|
|
85
|
+
var parent_1 = target.parentNode;
|
|
86
|
+
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
87
|
+
} while (
|
|
88
|
+
// portaled content
|
|
89
|
+
!targetInLock && target !== document.body || // self content
|
|
90
|
+
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
91
|
+
);
|
|
92
|
+
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
93
|
+
shouldCancelScroll = true;
|
|
94
|
+
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
95
|
+
shouldCancelScroll = true;
|
|
96
|
+
}
|
|
97
|
+
return shouldCancelScroll;
|
|
98
|
+
};
|
|
27
99
|
export {
|
|
28
|
-
|
|
100
|
+
handleScroll,
|
|
101
|
+
locationCouldBeScrolled
|
|
29
102
|
};
|
package/dist/index84.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.assignRef=function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e};
|
package/dist/index84.js
CHANGED
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
var parse = function(x) {
|
|
8
|
-
return parseInt(x || "", 10) || 0;
|
|
9
|
-
};
|
|
10
|
-
var getOffset = function(gapMode) {
|
|
11
|
-
var cs = window.getComputedStyle(document.body);
|
|
12
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
13
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
14
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
15
|
-
return [parse(left), parse(top), parse(right)];
|
|
16
|
-
};
|
|
17
|
-
var getGapWidth = function(gapMode) {
|
|
18
|
-
if (gapMode === void 0) {
|
|
19
|
-
gapMode = "margin";
|
|
1
|
+
function assignRef(ref, value) {
|
|
2
|
+
if (typeof ref === "function") {
|
|
3
|
+
ref(value);
|
|
4
|
+
} else if (ref) {
|
|
5
|
+
ref.current = value;
|
|
20
6
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
var offsets = getOffset(gapMode);
|
|
25
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
26
|
-
var windowWidth = window.innerWidth;
|
|
27
|
-
return {
|
|
28
|
-
left: offsets[0],
|
|
29
|
-
top: offsets[1],
|
|
30
|
-
right: offsets[2],
|
|
31
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
32
|
-
};
|
|
33
|
-
};
|
|
7
|
+
return ref;
|
|
8
|
+
}
|
|
34
9
|
export {
|
|
35
|
-
|
|
36
|
-
zeroGap
|
|
10
|
+
assignRef
|
|
37
11
|
};
|
package/dist/index85.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.useCallbackRef=function(a,r){var t=e.useState(function(){return{value:a,callback:r,facade:{get current(){return t.value},set current(e){var a=t.value;a!==e&&(t.value=e,t.callback(e,a))}}}})[0];return t.callback=r,t.facade};
|
package/dist/index85.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
function useCallbackRef(initialValue, callback) {
|
|
3
|
+
var ref = useState(function() {
|
|
4
|
+
return {
|
|
5
|
+
// value
|
|
6
|
+
value: initialValue,
|
|
7
|
+
// last callback
|
|
8
|
+
callback,
|
|
9
|
+
// "memoized" public interface
|
|
10
|
+
facade: {
|
|
11
|
+
get current() {
|
|
12
|
+
return ref.value;
|
|
13
|
+
},
|
|
14
|
+
set current(value) {
|
|
15
|
+
var last = ref.value;
|
|
16
|
+
if (last !== value) {
|
|
17
|
+
ref.value = value;
|
|
18
|
+
ref.callback(value, last);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
})[0];
|
|
24
|
+
ref.callback = callback;
|
|
25
|
+
return ref.facade;
|
|
26
|
+
}
|
|
14
27
|
export {
|
|
15
|
-
|
|
28
|
+
useCallbackRef
|
|
16
29
|
};
|
package/dist/index86.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t={left:0,top:0,right:0,gap:0},n=function(t){return parseInt(t||"",10)||0};exports.getGapWidth=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return t;var i=function(t){var e=window.getComputedStyle(document.body),i=e["padding"===t?"paddingLeft":"marginLeft"],d=e["padding"===t?"paddingTop":"marginTop"],r=e["padding"===t?"paddingRight":"marginRight"];return[n(i),n(d),n(r)]}(e),d=document.documentElement.clientWidth,r=window.innerWidth;return{left:i[0],top:i[1],right:i[2],gap:Math.max(0,r-d+i[2]-i[0])}},exports.zeroGap=t;
|
package/dist/index86.js
CHANGED
|
@@ -1,48 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var zeroGap = {
|
|
2
|
+
left: 0,
|
|
3
|
+
top: 0,
|
|
4
|
+
right: 0,
|
|
5
|
+
gap: 0
|
|
6
|
+
};
|
|
7
|
+
var parse = function(x) {
|
|
8
|
+
return parseInt(x || "", 10) || 0;
|
|
9
|
+
};
|
|
10
|
+
var getOffset = function(gapMode) {
|
|
11
|
+
var cs = window.getComputedStyle(document.body);
|
|
12
|
+
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
13
|
+
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
14
|
+
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
15
|
+
return [parse(left), parse(top), parse(right)];
|
|
16
|
+
};
|
|
17
|
+
var getGapWidth = function(gapMode) {
|
|
18
|
+
if (gapMode === void 0) {
|
|
19
|
+
gapMode = "margin";
|
|
10
20
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function injectStyles(tag, css) {
|
|
14
|
-
if (tag.styleSheet) {
|
|
15
|
-
tag.styleSheet.cssText = css;
|
|
16
|
-
} else {
|
|
17
|
-
tag.appendChild(document.createTextNode(css));
|
|
21
|
+
if (typeof window === "undefined") {
|
|
22
|
+
return zeroGap;
|
|
18
23
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
head.appendChild(tag);
|
|
23
|
-
}
|
|
24
|
-
var stylesheetSingleton = function() {
|
|
25
|
-
var counter = 0;
|
|
26
|
-
var stylesheet = null;
|
|
24
|
+
var offsets = getOffset(gapMode);
|
|
25
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
26
|
+
var windowWidth = window.innerWidth;
|
|
27
27
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
insertStyleTag(stylesheet);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
counter++;
|
|
36
|
-
},
|
|
37
|
-
remove: function() {
|
|
38
|
-
counter--;
|
|
39
|
-
if (!counter && stylesheet) {
|
|
40
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
41
|
-
stylesheet = null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
28
|
+
left: offsets[0],
|
|
29
|
+
top: offsets[1],
|
|
30
|
+
right: offsets[2],
|
|
31
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
44
32
|
};
|
|
45
33
|
};
|
|
46
34
|
export {
|
|
47
|
-
|
|
35
|
+
getGapWidth,
|
|
36
|
+
zeroGap
|
|
48
37
|
};
|
package/dist/index87.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./index88.cjs");function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const r=n(e);exports.styleHookSingleton=function(){var e=t.stylesheetSingleton();return function(t,n){r.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}};
|
package/dist/index87.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { stylesheetSingleton } from "./index88.js";
|
|
3
|
+
var styleHookSingleton = function() {
|
|
4
|
+
var sheet = stylesheetSingleton();
|
|
5
|
+
return function(styles, isDynamic) {
|
|
6
|
+
React.useEffect(function() {
|
|
7
|
+
sheet.add(styles);
|
|
8
|
+
return function() {
|
|
9
|
+
sheet.remove();
|
|
10
|
+
};
|
|
11
|
+
}, [styles && isDynamic]);
|
|
12
|
+
};
|
|
6
13
|
};
|
|
7
14
|
export {
|
|
8
|
-
|
|
15
|
+
styleHookSingleton
|
|
9
16
|
};
|
package/dist/index88.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index89.cjs");exports.stylesheetSingleton=function(){var t=0,n=null;return{add:function(o){var r,u;0==t&&(n=function(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var n=e.getNonce();return n&&t.setAttribute("nonce",n),t}())&&(u=o,(r=n).styleSheet?r.styleSheet.cssText=u:r.appendChild(document.createTextNode(u)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(n)),t++},remove:function(){! --t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}};
|