oolib 2.230.0 → 2.230.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/icons/index.d.ts
CHANGED
|
@@ -162,6 +162,7 @@ export namespace icons {
|
|
|
162
162
|
export { Cursor };
|
|
163
163
|
export { LockSimple };
|
|
164
164
|
export { FlowArrow };
|
|
165
|
+
export { PresentationChart };
|
|
165
166
|
export { ArrowCounterClockwise };
|
|
166
167
|
export { Selection };
|
|
167
168
|
export { Flask };
|
|
@@ -397,6 +398,7 @@ import { TextboxIcon as Textbox } from "@phosphor-icons/react";
|
|
|
397
398
|
import { CursorIcon as Cursor } from "@phosphor-icons/react";
|
|
398
399
|
import { LockSimpleIcon as LockSimple } from "@phosphor-icons/react";
|
|
399
400
|
import { FlowArrowIcon as FlowArrow } from "@phosphor-icons/react";
|
|
401
|
+
import { PresentationChartIcon as PresentationChart } from "@phosphor-icons/react";
|
|
400
402
|
import { ArrowCounterClockwiseIcon as ArrowCounterClockwise } from "@phosphor-icons/react";
|
|
401
403
|
import { SelectionIcon as Selection } from "@phosphor-icons/react";
|
|
402
404
|
import { FlaskIcon as Flask } from "@phosphor-icons/react";
|
package/dist/icons/index.js
CHANGED
|
@@ -167,6 +167,7 @@ exports.icons = {
|
|
|
167
167
|
Cursor: react_1.CursorIcon,
|
|
168
168
|
LockSimple: react_1.LockSimpleIcon,
|
|
169
169
|
FlowArrow: react_1.FlowArrowIcon,
|
|
170
|
+
PresentationChart: react_1.PresentationChartIcon,
|
|
170
171
|
ArrowCounterClockwise: react_1.ArrowCounterClockwiseIcon,
|
|
171
172
|
Selection: react_1.SelectionIcon,
|
|
172
173
|
Flask: react_1.FlaskIcon,
|
|
@@ -3,7 +3,7 @@ export interface useContainerQueryOptions {
|
|
|
3
3
|
enabled?: boolean;
|
|
4
4
|
}
|
|
5
5
|
export interface useContainerQueryReturn {
|
|
6
|
-
ref?:
|
|
6
|
+
ref?: (node: HTMLDivElement | null) => void;
|
|
7
7
|
containerQuery?: (point: breakpoint) => (styles: string | TemplateStringsArray) => string;
|
|
8
8
|
containerWidth: number;
|
|
9
9
|
containerHeight: number;
|
|
@@ -3,38 +3,57 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useContainerQuery = void 0;
|
|
4
4
|
var mixins_1 = require("../../themes/mixins");
|
|
5
5
|
var react_1 = require("react");
|
|
6
|
+
var RESIZE_DEBOUNCE_MS = 200;
|
|
6
7
|
var useContainerQuery = function (options) {
|
|
7
8
|
if (options === void 0) { options = {}; }
|
|
8
9
|
var enabled = options.enabled;
|
|
9
|
-
var
|
|
10
|
-
var
|
|
10
|
+
var _a = (0, react_1.useState)(null), node = _a[0], setNode = _a[1];
|
|
11
|
+
var _b = (0, react_1.useState)({ width: 0, height: 0 }), containerSize = _b[0], setContainerSize = _b[1];
|
|
12
|
+
var debounceTimerRef = (0, react_1.useRef)(null);
|
|
11
13
|
(0, react_1.useEffect)(function () {
|
|
14
|
+
if (!node)
|
|
15
|
+
return;
|
|
16
|
+
// Synchronous initial measurement to avoid flash of incorrect layout
|
|
17
|
+
var rect = node.getBoundingClientRect();
|
|
18
|
+
setContainerSize({ width: rect.width, height: rect.height });
|
|
12
19
|
var resizeObserver = new ResizeObserver(function (entries) {
|
|
20
|
+
var _loop_1 = function (entry) {
|
|
21
|
+
var _a = entry.contentBoxSize[0], inlineSize = _a.inlineSize, blockSize = _a.blockSize;
|
|
22
|
+
if (debounceTimerRef.current) {
|
|
23
|
+
clearTimeout(debounceTimerRef.current);
|
|
24
|
+
}
|
|
25
|
+
debounceTimerRef.current = setTimeout(function () {
|
|
26
|
+
setContainerSize(function (prev) {
|
|
27
|
+
if (Math.abs(prev.width - inlineSize) > 2 || Math.abs(prev.height - blockSize) > 2) {
|
|
28
|
+
return { width: inlineSize, height: blockSize };
|
|
29
|
+
}
|
|
30
|
+
return prev;
|
|
31
|
+
});
|
|
32
|
+
}, RESIZE_DEBOUNCE_MS);
|
|
33
|
+
};
|
|
13
34
|
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
14
35
|
var entry = entries_1[_i];
|
|
15
|
-
|
|
16
|
-
setContainerSize({ width: inlineSize, height: blockSize });
|
|
36
|
+
_loop_1(entry);
|
|
17
37
|
}
|
|
18
38
|
});
|
|
19
|
-
|
|
20
|
-
resizeObserver.observe(ref.current);
|
|
21
|
-
}
|
|
39
|
+
resizeObserver.observe(node);
|
|
22
40
|
return function () {
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
resizeObserver.disconnect();
|
|
42
|
+
if (debounceTimerRef.current) {
|
|
43
|
+
clearTimeout(debounceTimerRef.current);
|
|
25
44
|
}
|
|
26
45
|
};
|
|
27
|
-
}, [
|
|
46
|
+
}, [node]);
|
|
28
47
|
//if container queries are written for multiple breakpoints
|
|
29
|
-
//then they must be written in the order of small to big.
|
|
30
|
-
//so for example, the 'sm' query should be written before the 'md'
|
|
48
|
+
//then they must be written in the order of small to big.
|
|
49
|
+
//so for example, the 'sm' query should be written before the 'md'
|
|
31
50
|
//query and so on. Else bugs will happen.
|
|
32
51
|
var containerQuery = function (point) { return function (styles) {
|
|
33
52
|
var breakpointWidth = (0, mixins_1.getBreakPoint)(point);
|
|
34
53
|
return containerSize.width >= breakpointWidth ? styles : "";
|
|
35
54
|
}; };
|
|
36
55
|
return {
|
|
37
|
-
ref: enabled ?
|
|
56
|
+
ref: enabled ? setNode : undefined,
|
|
38
57
|
containerQuery: enabled ? containerQuery : undefined,
|
|
39
58
|
containerWidth: containerSize.width,
|
|
40
59
|
containerHeight: containerSize.height,
|