react-material-design 0.0.0-stage → 0.5.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/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/components/Button/context.cjs +1 -0
- package/dist/components/Button/context.d.ts +29 -0
- package/dist/components/Button/context.js +41 -0
- package/dist/components/Button/default/index.cjs +1 -0
- package/dist/components/Button/default/index.d.ts +26 -0
- package/dist/components/Button/default/index.js +22 -0
- package/dist/components/Button/default/render.cjs +1 -0
- package/dist/components/Button/default/render.d.ts +3 -0
- package/dist/components/Button/default/render.js +203 -0
- package/dist/components/Button/default/style.css +1 -0
- package/dist/components/Button/group/index.cjs +1 -0
- package/dist/components/Button/group/index.d.ts +2 -0
- package/dist/components/Button/group/index.js +1 -0
- package/dist/components/Button/group/render.cjs +1 -0
- package/dist/components/Button/group/render.d.ts +49 -0
- package/dist/components/Button/group/render.js +100 -0
- package/dist/components/Button/group/style.css +1 -0
- package/dist/components/Button/icon/index.cjs +1 -0
- package/dist/components/Button/icon/index.d.ts +22 -0
- package/dist/components/Button/icon/index.js +23 -0
- package/dist/components/Button/icon/render.cjs +1 -0
- package/dist/components/Button/icon/render.d.ts +4 -0
- package/dist/components/Button/icon/render.js +178 -0
- package/dist/components/Button/icon/style.css +1 -0
- package/dist/components/Button/index.cjs +1 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +55 -0
- package/dist/components/Button/split/index.cjs +1 -0
- package/dist/components/Button/split/index.d.ts +6 -0
- package/dist/components/Button/split/index.js +33 -0
- package/dist/components/Button/split/style.css +1 -0
- package/dist/components/Button/types.d.ts +19 -0
- package/dist/components/Card/index.d.ts +1 -0
- package/dist/components/Chip/index.cjs +1 -0
- package/dist/components/Chip/index.d.ts +50 -0
- package/dist/components/Chip/index.js +156 -0
- package/dist/components/Chip/style.css +1 -0
- package/dist/components/ContextMenu/index.cjs +1 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/index.js +19 -0
- package/dist/components/ContextMenu/render.cjs +1 -0
- package/dist/components/ContextMenu/render.d.ts +4 -0
- package/dist/components/ContextMenu/render.js +59 -0
- package/dist/components/Dialog/Dialog.cjs +1 -0
- package/dist/components/Dialog/Dialog.d.ts +23 -0
- package/dist/components/Dialog/Dialog.js +182 -0
- package/dist/components/Dialog/DialogActions.cjs +1 -0
- package/dist/components/Dialog/DialogActions.d.ts +3 -0
- package/dist/components/Dialog/DialogActions.js +17 -0
- package/dist/components/Dialog/index.cjs +1 -0
- package/dist/components/Dialog/index.d.ts +4 -0
- package/dist/components/Dialog/index.js +3 -0
- package/dist/components/Dialog/style.css +1 -0
- package/dist/components/Divider/index.cjs +1 -0
- package/dist/components/Divider/index.d.ts +6 -0
- package/dist/components/Divider/index.js +29 -0
- package/dist/components/Divider/style.css +1 -0
- package/dist/components/Font/index.d.ts +9 -0
- package/dist/components/Icon/Icon.cjs +1 -0
- package/dist/components/Icon/Icon.d.ts +18 -0
- package/dist/components/Icon/Icon.js +47 -0
- package/dist/components/Icon/index.cjs +1 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Icon/index.js +1 -0
- package/dist/components/Icon/style.css +1 -0
- package/dist/components/Menu/Menu.cjs +1 -0
- package/dist/components/Menu/Menu.d.ts +4 -0
- package/dist/components/Menu/Menu.js +10 -0
- package/dist/components/Menu/Menu.render.cjs +1 -0
- package/dist/components/Menu/Menu.render.d.ts +15 -0
- package/dist/components/Menu/Menu.render.js +55 -0
- package/dist/components/Menu/MenuContainer.cjs +1 -0
- package/dist/components/Menu/MenuContainer.d.ts +7 -0
- package/dist/components/Menu/MenuContainer.js +46 -0
- package/dist/components/Menu/MenuGroup.cjs +1 -0
- package/dist/components/Menu/MenuGroup.d.ts +11 -0
- package/dist/components/Menu/MenuGroup.js +34 -0
- package/dist/components/Menu/MenuGroup.render.cjs +1 -0
- package/dist/components/Menu/MenuGroup.render.d.ts +6 -0
- package/dist/components/Menu/MenuGroup.render.js +31 -0
- package/dist/components/Menu/MenuItem.cjs +1 -0
- package/dist/components/Menu/MenuItem.d.ts +19 -0
- package/dist/components/Menu/MenuItem.js +30 -0
- package/dist/components/Menu/MenuItem.render.cjs +1 -0
- package/dist/components/Menu/MenuItem.render.d.ts +7 -0
- package/dist/components/Menu/MenuItem.render.js +75 -0
- package/dist/components/Menu/index.cjs +1 -0
- package/dist/components/Menu/index.d.ts +3 -0
- package/dist/components/Menu/index.js +4 -0
- package/dist/components/Menu/style.css +1 -0
- package/dist/components/Menubar/MenuSection.d.ts +8 -0
- package/dist/components/Menubar/index.cjs +1 -0
- package/dist/components/Menubar/index.d.ts +2 -0
- package/dist/components/Menubar/index.js +19 -0
- package/dist/components/Menubar/render.cjs +1 -0
- package/dist/components/Menubar/render.d.ts +3 -0
- package/dist/components/Menubar/render.js +58 -0
- package/dist/components/Menubar/style.css +1 -0
- package/dist/components/NumberField/NumberField.cjs +1 -0
- package/dist/components/NumberField/NumberField.d.ts +2 -0
- package/dist/components/NumberField/NumberField.js +19 -0
- package/dist/components/NumberField/NumberField.render.cjs +1 -0
- package/dist/components/NumberField/NumberField.render.d.ts +10 -0
- package/dist/components/NumberField/NumberField.render.js +268 -0
- package/dist/components/NumberField/index.cjs +1 -0
- package/dist/components/NumberField/index.d.ts +2 -0
- package/dist/components/NumberField/index.js +1 -0
- package/dist/components/NumberField/style.css +1 -0
- package/dist/components/ProgressIndicator/index.d.ts +9 -0
- package/dist/components/Select/Option.cjs +1 -0
- package/dist/components/Select/Option.d.ts +10 -0
- package/dist/components/Select/Option.js +24 -0
- package/dist/components/Select/Select.cjs +1 -0
- package/dist/components/Select/Select.d.ts +32 -0
- package/dist/components/Select/Select.js +265 -0
- package/dist/components/Select/index.cjs +1 -0
- package/dist/components/Select/index.d.ts +4 -0
- package/dist/components/Select/index.js +3 -0
- package/dist/components/Select/style.css +1 -0
- package/dist/components/Slider/Slider.cjs +1 -0
- package/dist/components/Slider/Slider.d.ts +26 -0
- package/dist/components/Slider/Slider.js +342 -0
- package/dist/components/Slider/index.cjs +1 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +1 -0
- package/dist/components/Slider/style.css +1 -0
- package/dist/components/TextField/TextField.cjs +1 -0
- package/dist/components/TextField/TextField.d.ts +2 -0
- package/dist/components/TextField/TextField.js +19 -0
- package/dist/components/TextField/TextField.render.cjs +1 -0
- package/dist/components/TextField/TextField.render.d.ts +19 -0
- package/dist/components/TextField/TextField.render.js +159 -0
- package/dist/components/TextField/index.cjs +1 -0
- package/dist/components/TextField/index.d.ts +2 -0
- package/dist/components/TextField/index.js +1 -0
- package/dist/components/TextField/style.css +1 -0
- package/dist/components/Theme/Theme.cjs +4 -0
- package/dist/components/Theme/Theme.d.ts +14 -0
- package/dist/components/Theme/Theme.js +183 -0
- package/dist/components/Theme/index.cjs +1 -0
- package/dist/components/Theme/index.d.ts +1 -0
- package/dist/components/Theme/index.js +1 -0
- package/dist/components/Theme/style.css +1 -0
- package/dist/components/Theme/types.d.ts +29 -0
- package/dist/components/Toolbar/Toolbar.cjs +1 -0
- package/dist/components/Toolbar/Toolbar.d.ts +3 -0
- package/dist/components/Toolbar/Toolbar.js +19 -0
- package/dist/components/Toolbar/Toolbar.render.cjs +1 -0
- package/dist/components/Toolbar/Toolbar.render.d.ts +14 -0
- package/dist/components/Toolbar/Toolbar.render.js +64 -0
- package/dist/components/Toolbar/index.cjs +1 -0
- package/dist/components/Toolbar/index.d.ts +2 -0
- package/dist/components/Toolbar/index.js +1 -0
- package/dist/components/Toolbar/style.css +1 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +12 -0
- package/dist/components/Tooltip/Tooltip.js +52 -0
- package/dist/components/Tooltip/index.cjs +1 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/components/Tooltip/style.css +1 -0
- package/dist/components/containers/FilledField/index.cjs +1 -0
- package/dist/components/containers/FilledField/index.d.ts +9 -0
- package/dist/components/containers/FilledField/index.js +40 -0
- package/dist/components/containers/FilledField/style.css +1 -0
- package/dist/components/containers/OutlinedField/index.cjs +1 -0
- package/dist/components/containers/OutlinedField/index.d.ts +9 -0
- package/dist/components/containers/OutlinedField/index.js +59 -0
- package/dist/components/containers/OutlinedField/style.css +1 -0
- package/dist/components/misc/FloatingElement/index.cjs +1 -0
- package/dist/components/misc/FloatingElement/index.d.ts +17 -0
- package/dist/components/misc/FloatingElement/index.js +106 -0
- package/dist/components/misc/FloatingElement/style.css +1 -0
- package/dist/components/misc/OrderedCollection/index.cjs +1 -0
- package/dist/components/misc/OrderedCollection/index.d.ts +27 -0
- package/dist/components/misc/OrderedCollection/index.js +98 -0
- package/dist/components/misc/OrderedCollection/style.css +1 -0
- package/dist/components/misc/Polymorphic.cjs +1 -0
- package/dist/components/misc/Polymorphic.d.ts +15 -0
- package/dist/components/misc/Polymorphic.js +51 -0
- package/dist/components/misc/StateLayer/index.cjs +1 -0
- package/dist/components/misc/StateLayer/index.d.ts +7 -0
- package/dist/components/misc/StateLayer/index.js +67 -0
- package/dist/components/misc/StateLayer/style.css +1 -0
- package/dist/components/misc/Transitionable/index.cjs +1 -0
- package/dist/components/misc/Transitionable/index.d.ts +6 -0
- package/dist/components/misc/Transitionable/index.js +54 -0
- package/dist/components/misc/Transitionable/style.css +1 -0
- package/dist/components/types.cjs +1 -0
- package/dist/components/types.d.ts +20 -0
- package/dist/components/types.js +13 -0
- package/dist/hooks/useFloating/autoUpdate.cjs +1 -0
- package/dist/hooks/useFloating/autoUpdate.d.ts +9 -0
- package/dist/hooks/useFloating/autoUpdate.js +64 -0
- package/dist/hooks/useFloating/index.cjs +1 -0
- package/dist/hooks/useFloating/index.d.ts +30 -0
- package/dist/hooks/useFloating/index.js +97 -0
- package/dist/hooks/useFloating/middleware/flip.cjs +1 -0
- package/dist/hooks/useFloating/middleware/flip.d.ts +2 -0
- package/dist/hooks/useFloating/middleware/flip.js +88 -0
- package/dist/hooks/useFloating/middleware/offset.cjs +1 -0
- package/dist/hooks/useFloating/middleware/offset.d.ts +2 -0
- package/dist/hooks/useFloating/middleware/offset.js +42 -0
- package/dist/hooks/useFloating/middleware/shift.cjs +1 -0
- package/dist/hooks/useFloating/middleware/shift.d.ts +2 -0
- package/dist/hooks/useFloating/middleware/shift.js +11 -0
- package/dist/hooks/useFloating/middleware/size.cjs +1 -0
- package/dist/hooks/useFloating/middleware/size.d.ts +6 -0
- package/dist/hooks/useFloating/middleware/size.js +7 -0
- package/dist/hooks/useFloating/utils.cjs +1 -0
- package/dist/hooks/useFloating/utils.d.ts +22 -0
- package/dist/hooks/useFloating/utils.js +145 -0
- package/dist/layouts/Content.cjs +1 -0
- package/dist/layouts/Content.d.ts +3 -0
- package/dist/layouts/Content.js +17 -0
- package/dist/layouts/Page/index.cjs +1 -0
- package/dist/layouts/Page/index.d.ts +7 -0
- package/dist/layouts/Page/index.js +135 -0
- package/dist/layouts/Page/style.css +1 -0
- package/dist/layouts/Panes/Pane.cjs +1 -0
- package/dist/layouts/Panes/Pane.d.ts +11 -0
- package/dist/layouts/Panes/Pane.js +27 -0
- package/dist/layouts/Panes/Pane.render.cjs +1 -0
- package/dist/layouts/Panes/Pane.render.d.ts +6 -0
- package/dist/layouts/Panes/Pane.render.js +36 -0
- package/dist/layouts/Panes/Panes.cjs +1 -0
- package/dist/layouts/Panes/Panes.d.ts +28 -0
- package/dist/layouts/Panes/Panes.js +182 -0
- package/dist/layouts/Panes/index.cjs +1 -0
- package/dist/layouts/Panes/index.d.ts +2 -0
- package/dist/layouts/Panes/index.js +3 -0
- package/dist/layouts/Panes/style.css +1 -0
- package/dist/layouts/Tabs/Tab.d.ts +13 -0
- package/dist/layouts/Tabs/Tabs.d.ts +9 -0
- package/dist/layouts/Tabs/index.cjs +1 -0
- package/dist/layouts/Tabs/index.d.ts +1 -0
- package/dist/layouts/Tabs/index.js +0 -0
- package/dist/layouts/Toolbox/index.cjs +1 -0
- package/dist/layouts/Toolbox/index.d.ts +5 -0
- package/dist/layouts/Toolbox/index.js +129 -0
- package/dist/layouts/Toolbox/style.css +1 -0
- package/dist/style/motions.d.ts +37 -0
- package/dist/style/shapes/12_sided_cookie.d.ts +3 -0
- package/dist/style/shapes/4_leaf_clover.d.ts +3 -0
- package/dist/style/shapes/4_sided_cookie.d.ts +3 -0
- package/dist/style/shapes/6_sided_cookie.d.ts +3 -0
- package/dist/style/shapes/7_sided_cookie.d.ts +3 -0
- package/dist/style/shapes/8_leaf_clover.d.ts +3 -0
- package/dist/style/shapes/9_sided_cookie.d.ts +3 -0
- package/dist/style/shapes/arch.d.ts +3 -0
- package/dist/style/shapes/arrow.d.ts +3 -0
- package/dist/style/shapes/boom.d.ts +3 -0
- package/dist/style/shapes/bun.d.ts +3 -0
- package/dist/style/shapes/burst.d.ts +3 -0
- package/dist/style/shapes/circle.d.ts +3 -0
- package/dist/style/shapes/clamshell.d.ts +3 -0
- package/dist/style/shapes/diamond.d.ts +3 -0
- package/dist/style/shapes/fan.d.ts +3 -0
- package/dist/style/shapes/flower.d.ts +3 -0
- package/dist/style/shapes/gem.d.ts +3 -0
- package/dist/style/shapes/ghost_ish.d.ts +3 -0
- package/dist/style/shapes/heart.d.ts +3 -0
- package/dist/style/shapes/index.d.ts +109 -0
- package/dist/style/shapes/oval.d.ts +3 -0
- package/dist/style/shapes/pentagon.d.ts +3 -0
- package/dist/style/shapes/pill.d.ts +3 -0
- package/dist/style/shapes/pixel_circle.d.ts +3 -0
- package/dist/style/shapes/pixel_triangle.d.ts +3 -0
- package/dist/style/shapes/puffy.d.ts +3 -0
- package/dist/style/shapes/puffy_diamond.d.ts +3 -0
- package/dist/style/shapes/semicircle.d.ts +3 -0
- package/dist/style/shapes/slanted.d.ts +3 -0
- package/dist/style/shapes/soft_boom.d.ts +3 -0
- package/dist/style/shapes/soft_burst.d.ts +3 -0
- package/dist/style/shapes/square.d.ts +3 -0
- package/dist/style/shapes/sunny.d.ts +3 -0
- package/dist/style/shapes/triangle.d.ts +3 -0
- package/dist/style/shapes/very_sunny.d.ts +3 -0
- package/dist/style/symbols.d.ts +2 -0
- package/dist/utils/dom.cjs +1 -0
- package/dist/utils/dom.d.ts +2 -0
- package/dist/utils/dom.js +53 -0
- package/dist/utils/hooks.cjs +1 -0
- package/dist/utils/hooks.d.ts +17 -0
- package/dist/utils/hooks.js +9 -0
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.d.ts +44 -0
- package/dist/utils/index.js +74 -0
- package/package.json +169 -4
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { computeBaseCoords as e, getOppositeAlignment as t, getOppositeSide as n, parsePlacement as r } from "../utils.js";
|
|
2
|
+
//#region lib/hooks/useFloating/middleware/flip.ts
|
|
3
|
+
function i(e, t, n) {
|
|
4
|
+
let { flipX: r, flipY: i, flipBoth: a } = {
|
|
5
|
+
"top-left": {
|
|
6
|
+
flipX: "top-right",
|
|
7
|
+
flipY: "bottom-left",
|
|
8
|
+
flipBoth: "bottom-right"
|
|
9
|
+
},
|
|
10
|
+
"top-right": {
|
|
11
|
+
flipX: "top-left",
|
|
12
|
+
flipY: "bottom-right",
|
|
13
|
+
flipBoth: "bottom-left"
|
|
14
|
+
},
|
|
15
|
+
"bottom-left": {
|
|
16
|
+
flipX: "bottom-right",
|
|
17
|
+
flipY: "top-left",
|
|
18
|
+
flipBoth: "top-right"
|
|
19
|
+
},
|
|
20
|
+
"bottom-right": {
|
|
21
|
+
flipX: "bottom-left",
|
|
22
|
+
flipY: "top-right",
|
|
23
|
+
flipBoth: "top-left"
|
|
24
|
+
}
|
|
25
|
+
}[e];
|
|
26
|
+
return t && n ? [
|
|
27
|
+
e,
|
|
28
|
+
a,
|
|
29
|
+
r,
|
|
30
|
+
i
|
|
31
|
+
] : t ? [
|
|
32
|
+
e,
|
|
33
|
+
r,
|
|
34
|
+
a,
|
|
35
|
+
i
|
|
36
|
+
] : [
|
|
37
|
+
e,
|
|
38
|
+
i,
|
|
39
|
+
a,
|
|
40
|
+
r
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
function a(e, r, i) {
|
|
44
|
+
let [a, o] = e.split("-"), s = n(a), c = t(o), l = a === "top" || a === "bottom", u = l ? i : r, d = l ? r : i, f = [e, s], p = `${s}-${o}`, m = `${a}-${c}`, h = `${s}-${c}`;
|
|
45
|
+
return s ? o ? c ? u && d ? [
|
|
46
|
+
e,
|
|
47
|
+
h,
|
|
48
|
+
p,
|
|
49
|
+
m
|
|
50
|
+
] : u ? [
|
|
51
|
+
e,
|
|
52
|
+
p,
|
|
53
|
+
h,
|
|
54
|
+
m
|
|
55
|
+
] : d ? [
|
|
56
|
+
e,
|
|
57
|
+
m,
|
|
58
|
+
h,
|
|
59
|
+
p
|
|
60
|
+
] : [
|
|
61
|
+
e,
|
|
62
|
+
p,
|
|
63
|
+
m,
|
|
64
|
+
h
|
|
65
|
+
] : [e, `${s}-${o}`] : (l ? f.push("left", "right") : f.push("top", "bottom"), f) : [e];
|
|
66
|
+
}
|
|
67
|
+
var o = (t = {}) => (n) => {
|
|
68
|
+
let { padding: o = 0, offset: s = 0, fallbackPlacements: c = [] } = t, { x: l, y: u, placement: d, refRect: f, floatRect: p, hasFlipped: m, viewport: h } = n, g = h.left > l || l + p.width > h.right, _ = h.top > u || u + p.height > h.bottom, { isDiagonal: v } = r(d), y, b = c, x, S = d, C = l, w = u, T, E, D = Infinity, O, k, A, j, M;
|
|
69
|
+
if (m) return {};
|
|
70
|
+
b.length === 0 && (b = v ? i(d, g, _) : a(d, g, _)), t.allowedPlacements && t.allowedPlacements.length > 0 && (b = b.filter((e) => t.allowedPlacements?.includes(e)));
|
|
71
|
+
for (let t of b) {
|
|
72
|
+
if (T = n.x, E = n.y, t !== d && (x = e(f, p, t), T = x.x, E = x.y, s > 0 && (y = t.split("-").at(0), y === "top" && (E -= s), y === "bottom" && (E += s), y === "left" && (T -= s), y === "right" && (T += s))), k = Math.max(0, h.top + o - E), A = Math.max(0, E + p.height - (h.bottom - o)), j = Math.max(0, h.left + o - T), M = Math.max(0, T + p.width - (h.right - o)), O = k + A + j + M, O === 0) return t === d ? {} : {
|
|
73
|
+
hasFlipped: !0,
|
|
74
|
+
reset: { placement: t },
|
|
75
|
+
x: T,
|
|
76
|
+
y: E
|
|
77
|
+
};
|
|
78
|
+
O < D && (D = O, S = t, C = T, w = E);
|
|
79
|
+
}
|
|
80
|
+
return S === d ? {} : {
|
|
81
|
+
x: C,
|
|
82
|
+
y: w,
|
|
83
|
+
hasFlipped: !0,
|
|
84
|
+
reset: { placement: S }
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
export { o as flip };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(e={})=>t=>{let{mainAxis:n=0,crossAxis:r=0}=typeof e==`number`?{mainAxis:e}:e,{x:i,y:a,placement:o}=t;switch(o){case`top`:case`top-start`:case`top-end`:a-=n,i+=r;break;case`bottom`:case`bottom-start`:case`bottom-end`:a+=n,i+=r;break;case`left`:case`left-start`:case`left-end`:i-=n,a+=r;break;case`right`:case`right-start`:case`right-end`:i+=n,a+=r;break;case`top-left`:i-=r===0?n:r,a-=n;break;case`top-right`:i+=r===0?n:r,a-=n;break;case`bottom-left`:i-=r===0?n:r,a+=n;break;case`bottom-right`:i+=r===0?n:r,a+=n}return{x:i,y:a}};exports.offset=e;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region lib/hooks/useFloating/middleware/offset.ts
|
|
2
|
+
var e = (e = {}) => (t) => {
|
|
3
|
+
let { mainAxis: n = 0, crossAxis: r = 0 } = typeof e == "number" ? { mainAxis: e } : e, { x: i, y: a, placement: o } = t;
|
|
4
|
+
switch (o) {
|
|
5
|
+
case "top":
|
|
6
|
+
case "top-start":
|
|
7
|
+
case "top-end":
|
|
8
|
+
a -= n, i += r;
|
|
9
|
+
break;
|
|
10
|
+
case "bottom":
|
|
11
|
+
case "bottom-start":
|
|
12
|
+
case "bottom-end":
|
|
13
|
+
a += n, i += r;
|
|
14
|
+
break;
|
|
15
|
+
case "left":
|
|
16
|
+
case "left-start":
|
|
17
|
+
case "left-end":
|
|
18
|
+
i -= n, a += r;
|
|
19
|
+
break;
|
|
20
|
+
case "right":
|
|
21
|
+
case "right-start":
|
|
22
|
+
case "right-end":
|
|
23
|
+
i += n, a += r;
|
|
24
|
+
break;
|
|
25
|
+
case "top-left":
|
|
26
|
+
i -= r === 0 ? n : r, a -= n;
|
|
27
|
+
break;
|
|
28
|
+
case "top-right":
|
|
29
|
+
i += r === 0 ? n : r, a -= n;
|
|
30
|
+
break;
|
|
31
|
+
case "bottom-left":
|
|
32
|
+
i -= r === 0 ? n : r, a += n;
|
|
33
|
+
break;
|
|
34
|
+
case "bottom-right": i += r === 0 ? n : r, a += n;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
x: i,
|
|
38
|
+
y: a
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { e as offset };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../utils.cjs");var t=(t={})=>n=>{let{x:r,y:i,placement:a,viewport:o,refRect:s,floatRect:c}=n,{side:l,isDiagonal:u}=e.parsePlacement(a),d=l===`top`||l===`bottom`,f=typeof t==`number`?{padding:t}:t,p=f.padding??8,m=f.crossAxis??!0,h=f.mainAxis??!1,g=typeof f.limitShift==`number`?f.limitShift:f.limitShift?0:null,_=o.left+p,v=o.right-c.width-p,y=o.top+p,b=o.bottom-c.height-p,x=r,S=i,C,w,T,E;return g!==null&&(C=s.left-c.width+g,w=s.right+g,T=s.top-c.height+g,E=s.bottom+g,C<=w&&(_=Math.max(_,C),v=Math.min(v,w)),T<=E&&(y=Math.max(y,T),b=Math.min(b,E))),_=Math.min(_,v),y=Math.min(y,b),u?(h||m)&&(x=Math.max(_,Math.min(x,v)),S=Math.max(y,Math.min(S,b))):((d&&m||!d&&h)&&(x=Math.max(_,Math.min(x,v))),(d&&h||!d&&m)&&(S=Math.max(y,Math.min(S,b)))),{x,y:S}};exports.shift=t;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { parsePlacement as e } from "../utils.js";
|
|
2
|
+
//#region lib/hooks/useFloating/middleware/shift.ts
|
|
3
|
+
var t = (t = {}) => (n) => {
|
|
4
|
+
let { x: r, y: i, placement: a, viewport: o, refRect: s, floatRect: c } = n, { side: l, isDiagonal: u } = e(a), d = l === "top" || l === "bottom", f = typeof t == "number" ? { padding: t } : t, p = f.padding ?? 8, m = f.crossAxis ?? !0, h = f.mainAxis ?? !1, g = typeof f.limitShift == "number" ? f.limitShift : f.limitShift ? 0 : null, _ = o.left + p, v = o.right - c.width - p, y = o.top + p, b = o.bottom - c.height - p, x = r, S = i, C, w, T, E;
|
|
5
|
+
return g !== null && (C = s.left - c.width + g, w = s.right + g, T = s.top - c.height + g, E = s.bottom + g, C <= w && (_ = Math.max(_, C), v = Math.min(v, w)), T <= E && (y = Math.max(y, T), b = Math.min(b, E))), _ = Math.min(_, v), y = Math.min(y, b), u ? (h || m) && (x = Math.max(_, Math.min(x, v)), S = Math.max(y, Math.min(S, b))) : ((d && m || !d && h) && (x = Math.max(_, Math.min(x, v))), (d && h || !d && m) && (S = Math.max(y, Math.min(S, b)))), {
|
|
6
|
+
x,
|
|
7
|
+
y: S
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as shift };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>t=>{let{placement:n,x:r,y:i,floatRect:a,viewport:o}=t,s=e.padding??0,[c]=n.split(`-`),l=o.width-s*2,u=o.height-s*2;return c===`top`?u=Math.max(0,i+a.height-o.top-s):c===`bottom`?u=Math.max(0,o.bottom-i-s):c===`left`?l=Math.max(0,r+a.width-o.left-s):c===`right`&&(l=Math.max(0,o.right-r-s)),e.apply(l,u,t),{}};exports.size=e;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Middleware, MiddlewareState } from '../types';
|
|
2
|
+
export interface SizeOptions {
|
|
3
|
+
padding?: number;
|
|
4
|
+
apply: (availableWidth: number, availableHeight: number, state: MiddlewareState) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const size: (options: SizeOptions) => Middleware;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region lib/hooks/useFloating/middleware/size.ts
|
|
2
|
+
var e = (e) => (t) => {
|
|
3
|
+
let { placement: n, x: r, y: i, floatRect: a, viewport: o } = t, s = e.padding ?? 0, [c] = n.split("-"), l = o.width - s * 2, u = o.height - s * 2;
|
|
4
|
+
return c === "top" ? u = Math.max(0, i + a.height - o.top - s) : c === "bottom" ? u = Math.max(0, o.bottom - i - s) : c === "left" ? l = Math.max(0, r + a.width - o.left - s) : c === "right" && (l = Math.max(0, o.right - r - s)), e.apply(l, u, t), {};
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { e as size };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let t=[`top-left`,`top-right`,`bottom-left`,`bottom-right`].includes(e),[n,r]=e.split(`-`);return t?{side:e,isDiagonal:!0}:{side:n,alignment:r,isDiagonal:!1}}function t(e){return{top:`bottom`,bottom:`top`,left:`right`,right:`left`}[e]}function n(e){return{start:`end`,end:`start`}[e]}function r(e,t,n){let r;switch(n){case`top`:r={x:e.left+(e.width-t.width)/2,y:e.top-t.height};break;case`top-start`:r={x:e.left,y:e.top-t.height};break;case`top-end`:r={x:e.right-t.width,y:e.top-t.height};break;case`bottom`:r={x:e.left+(e.width-t.width)/2,y:e.bottom};break;case`bottom-start`:r={x:e.left,y:e.bottom};break;case`bottom-end`:r={x:e.right-t.width,y:e.bottom};break;case`left`:r={x:e.left-t.width,y:e.top+(e.height-t.height)/2};break;case`left-start`:r={x:e.left-t.width,y:e.top};break;case`left-end`:r={x:e.left-t.width,y:e.bottom-t.height};break;case`right`:r={x:e.right,y:e.top+(e.height-t.height)/2};break;case`right-start`:r={x:e.right,y:e.top};break;case`right-end`:r={x:e.right,y:e.bottom-t.height};break;case`top-left`:r={x:e.left-t.width,y:e.top-t.height};break;case`top-right`:r={x:e.right,y:e.top-t.height};break;case`bottom-left`:r={x:e.left-t.width,y:e.bottom};break;case`bottom-right`:r={x:e.right,y:e.bottom};break;default:r={x:e.left,y:e.top}}return new DOMRect(r.x,r.y,t.width,t.height)}function i(e,t){return{getBoundingClientRect:()=>new DOMRect(e.clientX,e.clientY,0,0),contextElement:t}}exports.computeBaseCoords=r,exports.createCursorVirtualElement=i,exports.getOppositeAlignment=n,exports.getOppositeSide=t,exports.parsePlacement=e;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VirtualElement } from '.';
|
|
2
|
+
import { Alignment, DiagonalPlacement, Placement, Side } from './types';
|
|
3
|
+
export declare function parsePlacement(placement: Placement): {
|
|
4
|
+
side: DiagonalPlacement;
|
|
5
|
+
isDiagonal: boolean;
|
|
6
|
+
alignment?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
side: Side;
|
|
9
|
+
alignment: Alignment | undefined;
|
|
10
|
+
isDiagonal: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function getOppositeSide(side: Side): Side;
|
|
13
|
+
export declare function getOppositeAlignment(alignment: Alignment): Alignment;
|
|
14
|
+
export declare function getDiagonalCandidates(placement: DiagonalPlacement, overflowX: boolean, overflowY: boolean): Placement[];
|
|
15
|
+
export declare function computeBaseCoords(refRect: DOMRect, floatRect: {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}, placement: Placement): DOMRect;
|
|
19
|
+
export declare function createCursorVirtualElement(client: {
|
|
20
|
+
clientX: number;
|
|
21
|
+
clientY: number;
|
|
22
|
+
}, contextElement?: HTMLElement): VirtualElement;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
//#region lib/hooks/useFloating/utils.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = [
|
|
4
|
+
"top-left",
|
|
5
|
+
"top-right",
|
|
6
|
+
"bottom-left",
|
|
7
|
+
"bottom-right"
|
|
8
|
+
].includes(e), [n, r] = e.split("-");
|
|
9
|
+
return t ? {
|
|
10
|
+
side: e,
|
|
11
|
+
isDiagonal: !0
|
|
12
|
+
} : {
|
|
13
|
+
side: n,
|
|
14
|
+
alignment: r,
|
|
15
|
+
isDiagonal: !1
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function t(e) {
|
|
19
|
+
return {
|
|
20
|
+
top: "bottom",
|
|
21
|
+
bottom: "top",
|
|
22
|
+
left: "right",
|
|
23
|
+
right: "left"
|
|
24
|
+
}[e];
|
|
25
|
+
}
|
|
26
|
+
function n(e) {
|
|
27
|
+
return {
|
|
28
|
+
start: "end",
|
|
29
|
+
end: "start"
|
|
30
|
+
}[e];
|
|
31
|
+
}
|
|
32
|
+
function r(e, t, n) {
|
|
33
|
+
let r;
|
|
34
|
+
switch (n) {
|
|
35
|
+
case "top":
|
|
36
|
+
r = {
|
|
37
|
+
x: e.left + (e.width - t.width) / 2,
|
|
38
|
+
y: e.top - t.height
|
|
39
|
+
};
|
|
40
|
+
break;
|
|
41
|
+
case "top-start":
|
|
42
|
+
r = {
|
|
43
|
+
x: e.left,
|
|
44
|
+
y: e.top - t.height
|
|
45
|
+
};
|
|
46
|
+
break;
|
|
47
|
+
case "top-end":
|
|
48
|
+
r = {
|
|
49
|
+
x: e.right - t.width,
|
|
50
|
+
y: e.top - t.height
|
|
51
|
+
};
|
|
52
|
+
break;
|
|
53
|
+
case "bottom":
|
|
54
|
+
r = {
|
|
55
|
+
x: e.left + (e.width - t.width) / 2,
|
|
56
|
+
y: e.bottom
|
|
57
|
+
};
|
|
58
|
+
break;
|
|
59
|
+
case "bottom-start":
|
|
60
|
+
r = {
|
|
61
|
+
x: e.left,
|
|
62
|
+
y: e.bottom
|
|
63
|
+
};
|
|
64
|
+
break;
|
|
65
|
+
case "bottom-end":
|
|
66
|
+
r = {
|
|
67
|
+
x: e.right - t.width,
|
|
68
|
+
y: e.bottom
|
|
69
|
+
};
|
|
70
|
+
break;
|
|
71
|
+
case "left":
|
|
72
|
+
r = {
|
|
73
|
+
x: e.left - t.width,
|
|
74
|
+
y: e.top + (e.height - t.height) / 2
|
|
75
|
+
};
|
|
76
|
+
break;
|
|
77
|
+
case "left-start":
|
|
78
|
+
r = {
|
|
79
|
+
x: e.left - t.width,
|
|
80
|
+
y: e.top
|
|
81
|
+
};
|
|
82
|
+
break;
|
|
83
|
+
case "left-end":
|
|
84
|
+
r = {
|
|
85
|
+
x: e.left - t.width,
|
|
86
|
+
y: e.bottom - t.height
|
|
87
|
+
};
|
|
88
|
+
break;
|
|
89
|
+
case "right":
|
|
90
|
+
r = {
|
|
91
|
+
x: e.right,
|
|
92
|
+
y: e.top + (e.height - t.height) / 2
|
|
93
|
+
};
|
|
94
|
+
break;
|
|
95
|
+
case "right-start":
|
|
96
|
+
r = {
|
|
97
|
+
x: e.right,
|
|
98
|
+
y: e.top
|
|
99
|
+
};
|
|
100
|
+
break;
|
|
101
|
+
case "right-end":
|
|
102
|
+
r = {
|
|
103
|
+
x: e.right,
|
|
104
|
+
y: e.bottom - t.height
|
|
105
|
+
};
|
|
106
|
+
break;
|
|
107
|
+
case "top-left":
|
|
108
|
+
r = {
|
|
109
|
+
x: e.left - t.width,
|
|
110
|
+
y: e.top - t.height
|
|
111
|
+
};
|
|
112
|
+
break;
|
|
113
|
+
case "top-right":
|
|
114
|
+
r = {
|
|
115
|
+
x: e.right,
|
|
116
|
+
y: e.top - t.height
|
|
117
|
+
};
|
|
118
|
+
break;
|
|
119
|
+
case "bottom-left":
|
|
120
|
+
r = {
|
|
121
|
+
x: e.left - t.width,
|
|
122
|
+
y: e.bottom
|
|
123
|
+
};
|
|
124
|
+
break;
|
|
125
|
+
case "bottom-right":
|
|
126
|
+
r = {
|
|
127
|
+
x: e.right,
|
|
128
|
+
y: e.bottom
|
|
129
|
+
};
|
|
130
|
+
break;
|
|
131
|
+
default: r = {
|
|
132
|
+
x: e.left,
|
|
133
|
+
y: e.top
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return new DOMRect(r.x, r.y, t.width, t.height);
|
|
137
|
+
}
|
|
138
|
+
function i(e, t) {
|
|
139
|
+
return {
|
|
140
|
+
getBoundingClientRect: () => new DOMRect(e.clientX, e.clientY, 0, 0),
|
|
141
|
+
contextElement: t
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { r as computeBaseCoords, i as createCursorVirtualElement, n as getOppositeAlignment, t as getOppositeSide, e as parsePlacement };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../components/misc/OrderedCollection/index.cjs");let t=require("react/compiler-runtime"),n=require("react"),r=require("react/jsx-runtime");function i(i){let a=(0,t.c)(5),o=(0,n.useId)(),s;a[0]===i.children?s=a[1]:(s={children:i.children},a[0]=i.children,a[1]=s);let c=s,l;return a[2]!==c||a[3]!==o?(l=(0,r.jsx)(e.OrderedCollectionChild,{name:`Content`,id:o,content:c}),a[2]=c,a[3]=o,a[4]=l):l=a[4],l}exports.default=i;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OrderedCollectionChild as e } from "../components/misc/OrderedCollection/index.js";
|
|
2
|
+
import { c as t } from "react/compiler-runtime";
|
|
3
|
+
import { useId as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region lib/layouts/Content.tsx
|
|
6
|
+
function i(i) {
|
|
7
|
+
let a = t(5), o = n(), s;
|
|
8
|
+
a[0] === i.children ? s = a[1] : (s = { children: i.children }, a[0] = i.children, a[1] = s);
|
|
9
|
+
let c = s, l;
|
|
10
|
+
return a[2] !== c || a[3] !== o ? (l = /* @__PURE__ */ r(e, {
|
|
11
|
+
name: "Content",
|
|
12
|
+
id: o,
|
|
13
|
+
content: c
|
|
14
|
+
}), a[2] = c, a[3] = o, a[4] = l) : l = a[4], l;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { i as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});require('./style.css');const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utils/index.cjs"),n=require("../../components/misc/OrderedCollection/index.cjs"),r=require("../../components/ContextMenu/render.cjs"),i=require("../../components/Menubar/render.cjs"),a=require("../../components/Toolbar/Toolbar.render.cjs");;/* empty css */let o=require("react/compiler-runtime"),s=require("classnames");s=e.__toESM(s,1);let c=require("react"),l=require("react/jsx-runtime");function u(e){let r=(0,o.c)(48),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],r[0]=i):i=r[0];let[a,u]=(0,c.useState)(i),v;r[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[`Content`,`Menubar`,`Toolbar`,`ContextMenu`],r[1]=v):v=r[1];let y=v,b;r[2]===a?b=r[3]:(b=a.filter(_),r[2]=a,r[3]=b);let x=b,S;r[4]===a?S=r[5]:(S=a.filter(g),r[4]=a,r[5]=S);let ie=S,C;r[6]===a?C=r[7]:(C=a.filter(h),r[6]=a,r[7]=C);let w=C,T;r[8]===a?T=r[9]:(T=a.filter(m),r[8]=a,r[9]=T);let E=T,D;r[10]===w?D=r[11]:(D=w.filter(p),r[10]=w,r[11]=D);let O=D,k;r[12]===w?k=r[13]:(k=w.filter(f),r[12]=w,r[13]=k);let A=k,j;r[14]===A?j=r[15]:(j=A.filter(d),r[14]=A,r[15]=j);let M=j,N;r[16]===A?N=r[17]:(N=A.filter(re),r[16]=A,r[17]=N);let P=N,F=ie,I;r[18]!==O||r[19]!==P?(I=[...O,...P],r[18]=O,r[19]=P,r[20]=I):I=r[20];let L=I,R=M,z;r[21]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],r[21]=z):z=r[21];let B=z,V=e.inlineContentPadding??e.contentPadding??!1,H=e.blockContentPadding??e.contentPadding??!1,U=ne,W;r[22]!==H||r[23]!==V?(W=(0,s.default)(`Page`,{"inline-padding":V,"block-padding":H}),r[22]=H,r[23]=V,r[24]=W):W=r[24];let G;r[25]===F?G=r[26]:(G=!!F.length&&(0,l.jsx)(`div`,{className:`tools top`,children:F.map(U)}),r[25]=F,r[26]=G);let K;r[27]===L?K=r[28]:(K=!!L.length&&(0,l.jsx)(`div`,{className:`tools bottom`,children:L.map(U)}),r[27]=L,r[28]=K);let q;r[29]===R?q=r[30]:(q=!!R.length&&(0,l.jsx)(`div`,{className:`tools left`,children:R.map(U)}),r[29]=R,r[30]=q);let J;r[31]===Symbol.for(`react.memo_cache_sentinel`)?(J=!!B.length&&(0,l.jsx)(`div`,{className:`tools right`,children:B.map(U)}),r[31]=J):J=r[31];let Y;r[32]===E?Y=r[33]:(Y=E.map(te),r[32]=E,r[33]=Y);let X;r[34]===x?X=r[35]:(X=x.map(ee),r[34]=x,r[35]=X);let Z;r[36]!==Y||r[37]!==X?(Z=(0,l.jsxs)(`div`,{className:`content`,children:[Y,X]}),r[36]=Y,r[37]=X,r[38]=Z):Z=r[38];let Q;r[39]===e.children?Q=r[40]:(Q=(0,l.jsx)(n.default,{name:`Page`,childName:y,onChildrenChange:u,compareChild:t.shallowEqual,children:e.children}),r[39]=e.children,r[40]=Q);let $;return r[41]!==W||r[42]!==G||r[43]!==K||r[44]!==q||r[45]!==Z||r[46]!==Q?($=(0,l.jsxs)(`div`,{className:W,children:[G,K,q,J,Z,Q]}),r[41]=W,r[42]=G,r[43]=K,r[44]=q,r[45]=Z,r[46]=Q,r[47]=$):$=r[47],$}function ee(e){return(0,l.jsx)(c.Fragment,{children:e.children},e.id)}function te(e){return(0,l.jsx)(r.default,{...e},e.id)}function ne(e){switch(e.orderedCollectionName){case`Menubar`:return(0,l.jsx)(i.default,{...e},e.id);case`Toolbar`:return(0,l.jsx)(a.default,{...e},e.id);default:return null}}function re(e){return!e.orientation||e.orientation===`horizontal`}function d(e){return e.orientation===`vertical`}function f(e){return e.variant===`floating`}function p(e){return e.variant===`docked`}function m(e){return e.orderedCollectionName===`ContextMenu`}function h(e){return e.orderedCollectionName===`Toolbar`}function g(e){return e.orderedCollectionName===`Menubar`}function _(e){return e.orderedCollectionName===`Content`}exports.default=u;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export interface PageProps extends PropsWithChildren {
|
|
3
|
+
contentPadding?: boolean;
|
|
4
|
+
inlineContentPadding?: boolean;
|
|
5
|
+
blockContentPadding?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function Page(props: PageProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { shallowEqual as e } from "../../utils/index.js";
|
|
2
|
+
import t from "../../components/misc/OrderedCollection/index.js";
|
|
3
|
+
import n from "../../components/ContextMenu/render.js";
|
|
4
|
+
import r from "../../components/Menubar/render.js";
|
|
5
|
+
import i from "../../components/Toolbar/Toolbar.render.js";
|
|
6
|
+
import './style.css';/* empty css */
|
|
7
|
+
import { c as a } from "react/compiler-runtime";
|
|
8
|
+
import o from "classnames";
|
|
9
|
+
import { Fragment as s, useState as c } from "react";
|
|
10
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
|
+
//#region lib/layouts/Page/index.tsx
|
|
12
|
+
function d(n) {
|
|
13
|
+
let r = a(48), i;
|
|
14
|
+
r[0] === Symbol.for("react.memo_cache_sentinel") ? (i = [], r[0] = i) : i = r[0];
|
|
15
|
+
let [s, d] = c(i), _;
|
|
16
|
+
r[1] === Symbol.for("react.memo_cache_sentinel") ? (_ = [
|
|
17
|
+
"Content",
|
|
18
|
+
"Menubar",
|
|
19
|
+
"Toolbar",
|
|
20
|
+
"ContextMenu"
|
|
21
|
+
], r[1] = _) : _ = r[1];
|
|
22
|
+
let v = _, y;
|
|
23
|
+
r[2] === s ? y = r[3] : (y = s.filter(ae), r[2] = s, r[3] = y);
|
|
24
|
+
let b = y, x;
|
|
25
|
+
r[4] === s ? x = r[5] : (x = s.filter(ie), r[4] = s, r[5] = x);
|
|
26
|
+
let S = x, C;
|
|
27
|
+
r[6] === s ? C = r[7] : (C = s.filter(g), r[6] = s, r[7] = C);
|
|
28
|
+
let w = C, T;
|
|
29
|
+
r[8] === s ? T = r[9] : (T = s.filter(h), r[8] = s, r[9] = T);
|
|
30
|
+
let E = T, D;
|
|
31
|
+
r[10] === w ? D = r[11] : (D = w.filter(m), r[10] = w, r[11] = D);
|
|
32
|
+
let O = D, k;
|
|
33
|
+
r[12] === w ? k = r[13] : (k = w.filter(re), r[12] = w, r[13] = k);
|
|
34
|
+
let A = k, j;
|
|
35
|
+
r[14] === A ? j = r[15] : (j = A.filter(ne), r[14] = A, r[15] = j);
|
|
36
|
+
let M = j, N;
|
|
37
|
+
r[16] === A ? N = r[17] : (N = A.filter(te), r[16] = A, r[17] = N);
|
|
38
|
+
let P = N, F = S, I;
|
|
39
|
+
r[18] !== O || r[19] !== P ? (I = [...O, ...P], r[18] = O, r[19] = P, r[20] = I) : I = r[20];
|
|
40
|
+
let L = I, R = M, z;
|
|
41
|
+
r[21] === Symbol.for("react.memo_cache_sentinel") ? (z = [], r[21] = z) : z = r[21];
|
|
42
|
+
let B = z, V = n.inlineContentPadding ?? n.contentPadding ?? !1, H = n.blockContentPadding ?? n.contentPadding ?? !1, U = ee, W;
|
|
43
|
+
r[22] !== H || r[23] !== V ? (W = o("Page", {
|
|
44
|
+
"inline-padding": V,
|
|
45
|
+
"block-padding": H
|
|
46
|
+
}), r[22] = H, r[23] = V, r[24] = W) : W = r[24];
|
|
47
|
+
let G;
|
|
48
|
+
r[25] === F ? G = r[26] : (G = !!F.length && /* @__PURE__ */ l("div", {
|
|
49
|
+
className: "tools top",
|
|
50
|
+
children: F.map(U)
|
|
51
|
+
}), r[25] = F, r[26] = G);
|
|
52
|
+
let K;
|
|
53
|
+
r[27] === L ? K = r[28] : (K = !!L.length && /* @__PURE__ */ l("div", {
|
|
54
|
+
className: "tools bottom",
|
|
55
|
+
children: L.map(U)
|
|
56
|
+
}), r[27] = L, r[28] = K);
|
|
57
|
+
let q;
|
|
58
|
+
r[29] === R ? q = r[30] : (q = !!R.length && /* @__PURE__ */ l("div", {
|
|
59
|
+
className: "tools left",
|
|
60
|
+
children: R.map(U)
|
|
61
|
+
}), r[29] = R, r[30] = q);
|
|
62
|
+
let J;
|
|
63
|
+
r[31] === Symbol.for("react.memo_cache_sentinel") ? (J = !!B.length && /* @__PURE__ */ l("div", {
|
|
64
|
+
className: "tools right",
|
|
65
|
+
children: B.map(U)
|
|
66
|
+
}), r[31] = J) : J = r[31];
|
|
67
|
+
let Y;
|
|
68
|
+
r[32] === E ? Y = r[33] : (Y = E.map(p), r[32] = E, r[33] = Y);
|
|
69
|
+
let X;
|
|
70
|
+
r[34] === b ? X = r[35] : (X = b.map(f), r[34] = b, r[35] = X);
|
|
71
|
+
let Z;
|
|
72
|
+
r[36] !== Y || r[37] !== X ? (Z = /* @__PURE__ */ u("div", {
|
|
73
|
+
className: "content",
|
|
74
|
+
children: [Y, X]
|
|
75
|
+
}), r[36] = Y, r[37] = X, r[38] = Z) : Z = r[38];
|
|
76
|
+
let Q;
|
|
77
|
+
r[39] === n.children ? Q = r[40] : (Q = /* @__PURE__ */ l(t, {
|
|
78
|
+
name: "Page",
|
|
79
|
+
childName: v,
|
|
80
|
+
onChildrenChange: d,
|
|
81
|
+
compareChild: e,
|
|
82
|
+
children: n.children
|
|
83
|
+
}), r[39] = n.children, r[40] = Q);
|
|
84
|
+
let $;
|
|
85
|
+
return r[41] !== W || r[42] !== G || r[43] !== K || r[44] !== q || r[45] !== Z || r[46] !== Q ? ($ = /* @__PURE__ */ u("div", {
|
|
86
|
+
className: W,
|
|
87
|
+
children: [
|
|
88
|
+
G,
|
|
89
|
+
K,
|
|
90
|
+
q,
|
|
91
|
+
J,
|
|
92
|
+
Z,
|
|
93
|
+
Q
|
|
94
|
+
]
|
|
95
|
+
}), r[41] = W, r[42] = G, r[43] = K, r[44] = q, r[45] = Z, r[46] = Q, r[47] = $) : $ = r[47], $;
|
|
96
|
+
}
|
|
97
|
+
function f(e) {
|
|
98
|
+
return /* @__PURE__ */ l(s, { children: e.children }, e.id);
|
|
99
|
+
}
|
|
100
|
+
function p(e) {
|
|
101
|
+
return /* @__PURE__ */ l(n, { ...e }, e.id);
|
|
102
|
+
}
|
|
103
|
+
function ee(e) {
|
|
104
|
+
switch (e.orderedCollectionName) {
|
|
105
|
+
case "Menubar": return /* @__PURE__ */ l(r, { ...e }, e.id);
|
|
106
|
+
case "Toolbar": return /* @__PURE__ */ l(i, { ...e }, e.id);
|
|
107
|
+
default: return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function te(e) {
|
|
111
|
+
return !e.orientation || e.orientation === "horizontal";
|
|
112
|
+
}
|
|
113
|
+
function ne(e) {
|
|
114
|
+
return e.orientation === "vertical";
|
|
115
|
+
}
|
|
116
|
+
function re(e) {
|
|
117
|
+
return e.variant === "floating";
|
|
118
|
+
}
|
|
119
|
+
function m(e) {
|
|
120
|
+
return e.variant === "docked";
|
|
121
|
+
}
|
|
122
|
+
function h(e) {
|
|
123
|
+
return e.orderedCollectionName === "ContextMenu";
|
|
124
|
+
}
|
|
125
|
+
function g(e) {
|
|
126
|
+
return e.orderedCollectionName === "Toolbar";
|
|
127
|
+
}
|
|
128
|
+
function ie(e) {
|
|
129
|
+
return e.orderedCollectionName === "Menubar";
|
|
130
|
+
}
|
|
131
|
+
function ae(e) {
|
|
132
|
+
return e.orderedCollectionName === "Content";
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { d as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Page{box-sizing:border-box;--page-content-default-spacing:var(--md-sys-measurement-space300);--page-tools-top-size:max(var(--page-tools-top-menubar-size,var(--page-content-default-spacing,0px)), var(--page-tools-top-toolbar-size,var(--page-content-default-spacing,0px)));--page-tools-bottom-size:max(var(--page-tools-bottom-toolbar-size,var(--page-content-default-spacing,0px)));--page-tools-left-size:max(var(--page-tools-left-toolbar-size,var(--page-content-default-spacing,0px)));--page-tools-right-size:max(var(--page-tools-right-toolbar-size,var(--page-content-default-spacing,0px)));justify-content:stretch;align-items:stretch;min-width:100dvw;min-height:100dvh;display:flex}.Page:has(>.tools.top>.Menubar){--page-tools-top-menubar-size:calc(48px + var(--md-sys-measurement-space200))}.Page:has(>.tools.top>.Toolbar.floating){--page-tools-top-toolbar-size:calc(var(--md-comp-toolbar-floating-horizontal-container-height) + var(--md-comp-toolbar-floating-horizontal-container-external-space) * 2)}.Page:has(>.tools.bottom>.Toolbar.docked){--page-tools-bottom-toolbar-size:calc(var(--md-comp-toolbar-docked-container-height) + var(--md-sys-measurement-space200))}.Page:has(>.tools.bottom>.Toolbar.floating){--page-tools-bottom-toolbar-size:calc(var(--md-comp-toolbar-floating-horizontal-container-height) + var(--md-comp-toolbar-floating-horizontal-container-external-space) * 2)}.Page:has(>.tools.left>.Toolbar.floating){--page-tools-left-toolbar-size:calc(var(--md-comp-toolbar-floating-vertical-container-width) + var(--md-comp-toolbar-floating-vertical-container-external-space) * 2)}.Page:has(>.tools.right>.Toolbar.floating){--page-tools-right-toolbar-size:calc(var(--md-comp-toolbar-floating-vertical-container-width) + var(--md-comp-toolbar-floating-vertical-container-external-space) * 2)}.Page>.tools{z-index:5;pointer-events:none;justify-content:center;align-items:center;display:flex;position:fixed}.Page>.tools>*{pointer-events:initial}.Page>.tools.top{top:0;left:0;right:0}.Page>.tools.top:not(:has(>.Menubar)){padding-inline:var(--md-sys-measurement-space200)}.Page>.tools.top>.Menubar{flex:1}.Page>.tools.top>.Toolbar.floating{margin-top:var(--md-comp-toolbar-floating-horizontal-container-external-space)}.Page>.tools.bottom{bottom:0;left:0;right:0}.Page>.tools.bottom:not(:has(>.Toolbar.docked)){padding-inline:var(--md-sys-measurement-space200)}.Page>.tools.bottom>.Toolbar.docked{flex:1}.Page>.tools.bottom>.Toolbar.floating{margin-bottom:var(--md-comp-toolbar-floating-horizontal-container-external-space)}.Page>.tools.left{padding-block:var(--md-sys-measurement-space300);top:0;bottom:0;left:0}.Page>.tools.left>.Toolbar.floating{margin-left:var(--md-comp-toolbar-floating-vertical-container-external-space)}.Page>.tools.right{padding-block:var(--md-sys-measurement-space300);top:0;bottom:0;right:0}.Page>.tools.right>.Toolbar.floating{margin-right:var(--md-comp-toolbar-floating-vertical-container-external-space)}.Page>.content{padding:var(--page-tools-top-size) var(--page-tools-right-size) var(--page-tools-bottom-size) var(--page-tools-left-size);box-sizing:border-box;flex:1;width:100%;height:100%}.Page>.content>*{--page-tools-top-size:initial;--page-tools-bottom-size:initial;--page-tools-left-size:initial;--page-tools-right-size:initial;--page-tools-top-menubar-size:initial;--page-tools-top-toolbar-size:initial;--page-tools-bottom-toolbar-size:initial;--page-tools-left-toolbar-size:initial;--page-tools-right-toolbar-size:initial}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../components/misc/OrderedCollection/index.cjs");let t=require("react/compiler-runtime"),n=require("react"),r=require("react/jsx-runtime");function i(i){let a=(0,t.c)(12),o=(0,n.useId)(),s=i.id??o,c=i.minSize??`10%`,l;a[0]!==i.blockContentPadding||a[1]!==i.children||a[2]!==i.className||a[3]!==i.contentPadding||a[4]!==i.defaultSize||a[5]!==i.inlineContentPadding||a[6]!==i.snapPoints||a[7]!==s||a[8]!==c?(l={id:s,defaultSize:i.defaultSize,minSize:c,snapPoints:i.snapPoints,inlineContentPadding:i.inlineContentPadding,blockContentPadding:i.blockContentPadding,contentPadding:i.contentPadding,className:i.className,children:i.children},a[0]=i.blockContentPadding,a[1]=i.children,a[2]=i.className,a[3]=i.contentPadding,a[4]=i.defaultSize,a[5]=i.inlineContentPadding,a[6]=i.snapPoints,a[7]=s,a[8]=c,a[9]=l):l=a[9];let u=l,d;return a[10]===u?d=a[11]:(d=(0,r.jsx)(e.OrderedCollectionChild,{name:`Pane`,parentName:`Panes`,content:u}),a[10]=u,a[11]=d),d}exports.default=i;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SizeUnit } from '../../utils/index';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { LayoutPadding } from '../types';
|
|
4
|
+
export interface PaneProps extends PropsWithChildren, LayoutPadding {
|
|
5
|
+
id?: string;
|
|
6
|
+
defaultSize?: SizeUnit | "auto";
|
|
7
|
+
minSize?: SizeUnit;
|
|
8
|
+
snapPoints?: SizeUnit[];
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export default function Pane(props: PaneProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OrderedCollectionChild as e } from "../../components/misc/OrderedCollection/index.js";
|
|
2
|
+
import { c as t } from "react/compiler-runtime";
|
|
3
|
+
import { useId as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region lib/layouts/Panes/Pane.tsx
|
|
6
|
+
function i(i) {
|
|
7
|
+
let a = t(12), o = n(), s = i.id ?? o, c = i.minSize ?? "10%", l;
|
|
8
|
+
a[0] !== i.blockContentPadding || a[1] !== i.children || a[2] !== i.className || a[3] !== i.contentPadding || a[4] !== i.defaultSize || a[5] !== i.inlineContentPadding || a[6] !== i.snapPoints || a[7] !== s || a[8] !== c ? (l = {
|
|
9
|
+
id: s,
|
|
10
|
+
defaultSize: i.defaultSize,
|
|
11
|
+
minSize: c,
|
|
12
|
+
snapPoints: i.snapPoints,
|
|
13
|
+
inlineContentPadding: i.inlineContentPadding,
|
|
14
|
+
blockContentPadding: i.blockContentPadding,
|
|
15
|
+
contentPadding: i.contentPadding,
|
|
16
|
+
className: i.className,
|
|
17
|
+
children: i.children
|
|
18
|
+
}, a[0] = i.blockContentPadding, a[1] = i.children, a[2] = i.className, a[3] = i.contentPadding, a[4] = i.defaultSize, a[5] = i.inlineContentPadding, a[6] = i.snapPoints, a[7] = s, a[8] = c, a[9] = l) : l = a[9];
|
|
19
|
+
let u = l, d;
|
|
20
|
+
return a[10] === u ? d = a[11] : (d = /* @__PURE__ */ r(e, {
|
|
21
|
+
name: "Pane",
|
|
22
|
+
parentName: "Panes",
|
|
23
|
+
content: u
|
|
24
|
+
}), a[10] = u, a[11] = d), d;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { i as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs");let t=require("react/compiler-runtime"),n=require("classnames");n=e.__toESM(n,1);let r=require("react/jsx-runtime");function i(e){let i=(0,t.c)(19),a=e.inlineContentPadding??e.contentPadding??!1,o=e.blockContentPadding??e.contentPadding??!1,s,c=`100%`;if(e.size!==`auto`){if(typeof e.size==`string`&&e.size.endsWith(`%`)){s=parseFloat(e.size);let t;i[0]!==s||i[1]!==e.totalHandlesSize?(t=e.totalHandlesSize>0?`calc(${s.toFixed(3)}% - ${Math.round(s/100*e.totalHandlesSize)}px)`:`${s.toFixed(3)}%`,i[0]=s,i[1]=e.totalHandlesSize,i[2]=t):t=i[2],c=t}else if(typeof e.size==`number`){let t;i[3]===e.size?t=i[4]:(t=Math.round(e.size),i[3]=e.size,i[4]=t),c=`calc(0% + ${t}px)`}else c=e.size}let l=!e.activeDrag||e.isAnimating,u;i[5]!==o||i[6]!==a||i[7]!==e.className||i[8]!==e.collapsed||i[9]!==e.snapped||i[10]!==l?(u=(0,n.default)(`Pane`,{snapped:e.snapped,collapsed:e.collapsed,"inline-padding":a,"block-padding":o,animating:l},e.className),i[5]=o,i[6]=a,i[7]=e.className,i[8]=e.collapsed,i[9]=e.snapped,i[10]=l,i[11]=u):u=i[11];let d;i[12]===c?d=i[13]:(d={"--pane-size":c},i[12]=c,i[13]=d);let f;return i[14]!==e.children||i[15]!==e.id||i[16]!==u||i[17]!==d?(f=(0,r.jsx)(`section`,{className:u,"data-key":e.id,style:d,children:e.children}),i[14]=e.children,i[15]=e.id,i[16]=u,i[17]=d,i[18]=f):f=i[18],f}exports.default=i;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { c as e } from "react/compiler-runtime";
|
|
2
|
+
import t from "classnames";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region lib/layouts/Panes/Pane.render.tsx
|
|
5
|
+
function r(r) {
|
|
6
|
+
let i = e(19), a = r.inlineContentPadding ?? r.contentPadding ?? !1, o = r.blockContentPadding ?? r.contentPadding ?? !1, s, c = "100%";
|
|
7
|
+
if (r.size !== "auto") {
|
|
8
|
+
if (typeof r.size == "string" && r.size.endsWith("%")) {
|
|
9
|
+
s = parseFloat(r.size);
|
|
10
|
+
let e;
|
|
11
|
+
i[0] !== s || i[1] !== r.totalHandlesSize ? (e = r.totalHandlesSize > 0 ? `calc(${s.toFixed(3)}% - ${Math.round(s / 100 * r.totalHandlesSize)}px)` : `${s.toFixed(3)}%`, i[0] = s, i[1] = r.totalHandlesSize, i[2] = e) : e = i[2], c = e;
|
|
12
|
+
} else if (typeof r.size == "number") {
|
|
13
|
+
let e;
|
|
14
|
+
i[3] === r.size ? e = i[4] : (e = Math.round(r.size), i[3] = r.size, i[4] = e), c = `calc(0% + ${e}px)`;
|
|
15
|
+
} else c = r.size;
|
|
16
|
+
}
|
|
17
|
+
let l = !r.activeDrag || r.isAnimating, u;
|
|
18
|
+
i[5] !== o || i[6] !== a || i[7] !== r.className || i[8] !== r.collapsed || i[9] !== r.snapped || i[10] !== l ? (u = t("Pane", {
|
|
19
|
+
snapped: r.snapped,
|
|
20
|
+
collapsed: r.collapsed,
|
|
21
|
+
"inline-padding": a,
|
|
22
|
+
"block-padding": o,
|
|
23
|
+
animating: l
|
|
24
|
+
}, r.className), i[5] = o, i[6] = a, i[7] = r.className, i[8] = r.collapsed, i[9] = r.snapped, i[10] = l, i[11] = u) : u = i[11];
|
|
25
|
+
let d;
|
|
26
|
+
i[12] === c ? d = i[13] : (d = { "--pane-size": c }, i[12] = c, i[13] = d);
|
|
27
|
+
let f;
|
|
28
|
+
return i[14] !== r.children || i[15] !== r.id || i[16] !== u || i[17] !== d ? (f = /* @__PURE__ */ n("section", {
|
|
29
|
+
className: u,
|
|
30
|
+
"data-key": r.id,
|
|
31
|
+
style: d,
|
|
32
|
+
children: r.children
|
|
33
|
+
}), i[14] = r.children, i[15] = r.id, i[16] = u, i[17] = d, i[18] = f) : f = i[18], f;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { r as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./style.css');const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utils/index.cjs"),n=require("../../utils/hooks.cjs"),r=require("../../components/misc/OrderedCollection/index.cjs"),i=require("./Pane.render.cjs");;/* empty css */let a=require("react/compiler-runtime"),o=require("classnames");o=e.__toESM(o,1);let s=require("react"),c=require("react/jsx-runtime"),l=require("react-dom-event-hooks");var u=(0,s.createContext)(null),d=()=>{let e=(0,s.useContext)(u);if(!e)throw Error(`MenuPane or MenuGroup must be used in Menu component`);return e};function f(e){let t=(0,a.c)(10),{startDrag:n,activeDrag:r}=d(),i=r===e.leftId,s;t[0]!==e.leftId||t[1]!==e.rightId||t[2]!==n?(s=t=>n(e.leftId,e.rightId,t),t[0]=e.leftId,t[1]=e.rightId,t[2]=n,t[3]=s):s=t[3];let l=s,u;t[4]===i?u=t[5]:(u=(0,o.default)(`ResizeHandle`,{dragging:i}),t[4]=i,t[5]=u);let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,c.jsx)(`div`,{className:`handle`}),t[6]=f):f=t[6];let p;return t[7]!==l||t[8]!==u?(p=(0,c.jsx)(`div`,{className:u,role:`separator`,onPointerDown:l,children:f}),t[7]=l,t[8]=u,t[9]=p):p=t[9],p}function p(e){let{orientation:a=`horizontal`,autoSaveId:d,onLayoutChange:p}=e,[m,h]=(0,s.useState)(0),[g,_]=(0,s.useState)(0),{saveRef:v}=(0,l.useElementRef)((0,s.useCallback)(e=>{let n=e.getBoundingClientRect();_(a===`horizontal`?n.width:n.height),h(t.getComponentTokenValue(e,`panes-handle-size`))},[a])),[y,b]=(0,s.useState)([]),[x,S]=(0,s.useState)({}),C=(0,s.useMemo)(()=>Math.max(0,y.length-1)*m,[m,y.length]),w=(0,s.useMemo)(()=>Math.max(0,g-C),[g,C]),[T,E]=(0,s.useState)(null),D=(0,s.useRef)(null),O=(0,s.useRef)(null),k=(0,s.useRef)({}),A=(0,s.useCallback)((e,t)=>!(e.id!==t.id||e.defaultSize!==t.defaultSize||e.minSize!==t.minSize||e.snapPoints?.length!==t.snapPoints?.length||t.snapPoints?.every((t,n)=>t!==e.snapPoints?.at(n))||e.className!==t.className||e.children!==t.children),[]),j=(0,s.useCallback)(e=>{b(e),S(e.reduce((e,t)=>{let n=x[t.id];return e[t.id]={id:t.id,size:n?n.size:D.current?.[t.id]?.size??t.defaultSize??`auto`,snapped:n?n.snapped:!1,collapsed:n?n.collapsed:D.current?.[t.id]?.collapsed??!1,isRecovering:n?n.isRecovering:!1,isAnimating:n?n.isAnimating:!1},e},{}))},[x]),M=(0,s.useEffectEvent)(()=>{S(e=>{let n=y.filter(t=>e[t.id]?.size===`auto`),r={...e},i,a=0,o=0,s,c;return n.length===0?e:(y.forEach(n=>{i=e[n.id]?.size,i&&i!==`auto`&&(typeof i==`string`&&i.endsWith(`%`)&&(o+=parseFloat(i)),a+=t.parseSizeToPx(i,w,0))}),w>0?(s=Math.max(0,w-a),c=s/w*100/n.length,n.forEach(e=>r[e.id]={...r[e.id],size:`${c}%`})):(s=Math.max(0,100-o),c=s/n.length,n.forEach(e=>r[e.id]={...r[e.id],size:`${c}%`})),r)})}),N=(0,s.useCallback)(e=>{let t={};for(let n in e)t[n]={size:e[n].size,collapsed:e[n].collapsed};d&&typeof window<`u`&&localStorage.setItem(`material-panes-${d}`,JSON.stringify(t)),p?.(t)},[d,p]),P=(0,s.useMemo)(()=>({activeDrag:T,startDrag(e,n,r){let i=x[e],a=x[n];i&&a&&w&&(r.preventDefault(),r.currentTarget.setPointerCapture(r.pointerId),O.current={leftId:e,rightId:n,startX:r.clientX,startY:r.clientY,startLeftPx:t.parseSizeToPx(i.size,w),startRightPx:t.parseSizeToPx(a.size,w)},E(e))}}),[T,w,x]),F=(0,s.useMemo)(()=>y.map((e,t)=>{let n=x[e.id];return n?(0,c.jsxs)(s.Fragment,{children:[!!t&&(0,c.jsx)(f,{leftId:y[t-1]?.id,rightId:e.id}),(0,c.jsx)(i.default,{...n,...e,totalHandlesSize:C,activeDrag:T,children:e.children})]},n.id):null}),[T,x,y,C]);return(0,l.useWindowEventListener)(`pointermove`,e=>{if(!O.current)return;let{leftId:n,rightId:r,startX:i,startY:o,startLeftPx:s,startRightPx:c}=O.current,l=a===`horizontal`?e.clientX-i:e.clientY-o,u=s+c,d=y.find(e=>e.id===n),f=y.find(e=>e.id===r),p=x[n],m=x[r],h=t.parseSizeToPx(d?.minSize,w,0),g=t.parseSizeToPx(f?.minSize,w,0),_=s+l,v=c-l,b,C=!1,T=!1,E=!1,D=!1,A=!1,j,M,N;if(d?.snapPoints){for(let e of d.snapPoints)if(b=t.parseSizeToPx(e,w),Math.abs(_-b)<20){_=b,v=u-_,C=!0,D=!0;break}}if(!C&&f?.snapPoints){for(let e of f.snapPoints)if(b=t.parseSizeToPx(e,w),Math.abs(v-b)<20){v=b,_=u-v,A=!0;break}}_<h/2?(T=!0,_=0,v=u):_<h&&(_=h,v=u-h),v<g/2?(E=!0,v=0,_=u):v<g&&(v=g,_=u-g),_<0&&(_=0,v=u),v<0&&(_=u,v=0),j=!T&&p.collapsed||!D&&p.snapped,M=!E&&m.collapsed||!A&&m.snapped,N=p.isRecovering||m.isRecovering||!1,j||M?(N=!0,k.current[n]&&clearTimeout(k.current[n]),k.current[n]=setTimeout(()=>{S(e=>{let t={...e};return t[n]&&(t[n]={...t[n],isRecovering:!1,isAnimating:!1}),t[r]&&(t[r]={...t[r],isRecovering:!1,isAnimating:!1}),t})},200)):(T||D||E||A)&&(N=!1,k.current[n]&&clearTimeout(k.current[n])),S(e=>{let i=t.formatSizeFromPx(_,e[n].size,w),a=t.formatSizeFromPx(v,e[r].size,w),o=T||D||E||A||N;return{...e,[n]:{...e[n],snapped:D,collapsed:T,isRecovering:N,isAnimating:o,size:i},[r]:{...e[r],snapped:A,collapsed:E,isRecovering:N,isAnimating:o,size:a}}})}),(0,l.useWindowEventListener)(`pointerup`,()=>{O.current&&(N(x),O.current=null,E(null))}),n.useIsomorphicLayoutEffect(()=>{let n;if(D.current===null){if(e.defaultLayout)D.current=e.defaultLayout;else if(e.autoSaveId&&t.isBrowser())try{n=localStorage.getItem(`material-panes-${e.autoSaveId}`),n&&(D.current=JSON.parse(n))}catch(e){console.error(`localStorage error:`,e)}D.current||={}}M()}),(0,c.jsx)(`div`,{ref:v,className:(0,o.default)(`Panes`,a,e.className),children:(0,c.jsxs)(u,{value:P,children:[F,(0,c.jsx)(r.default,{childName:`Pane`,onChildrenChange:j,compareChild:A,children:e.children})]})})}exports.PanesContext=u,exports.default=p,exports.usePanes=d;
|