@vertz/ui-primitives 0.2.22 → 0.2.23
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/shared/chunk-3h1mxp95.js +148 -0
- package/dist/shared/chunk-3kwh27dv.js +135 -0
- package/dist/shared/chunk-4894pmy6.js +184 -0
- package/dist/shared/chunk-67sn29eh.js +125 -0
- package/dist/shared/chunk-7cb3z0s8.js +287 -0
- package/dist/shared/chunk-8c01c8mb.js +217 -0
- package/dist/shared/chunk-99tk72t3.js +69 -0
- package/dist/shared/chunk-9gfp3ffv.js +204 -0
- package/dist/shared/chunk-b25npqer.js +149 -0
- package/dist/shared/chunk-cgb2j94g.js +141 -0
- package/dist/shared/chunk-e1jcf22s.js +79 -0
- package/dist/shared/chunk-e3h0ddmx.js +168 -0
- package/dist/shared/chunk-f2vx4tpw.js +168 -0
- package/dist/shared/chunk-h3v10x04.js +271 -0
- package/dist/shared/chunk-hdvdfd1c.js +96 -0
- package/dist/shared/{chunk-dhyr0s9n.js → chunk-j902w020.js} +1 -1
- package/dist/shared/chunk-jdygp28a.js +260 -0
- package/dist/shared/chunk-jqre4qtw.js +180 -0
- package/dist/shared/{chunk-k8nabsxm.js → chunk-mgr904ap.js} +74 -34
- package/dist/shared/chunk-mr1tb0dp.js +167 -0
- package/dist/shared/chunk-nj420k31.js +54 -0
- package/dist/shared/chunk-p0x7hgv6.js +181 -0
- package/dist/shared/{chunk-w9dag6ce.js → chunk-pn6shbcs.js} +132 -80
- package/dist/shared/chunk-pzx0vpq1.js +223 -0
- package/dist/shared/chunk-tn0m98j8.js +42 -0
- package/dist/shared/{chunk-myq79qew.js → chunk-ttb2tt03.js} +47 -27
- package/dist/shared/chunk-vy874zxe.js +68 -0
- package/dist/shared/chunk-ww7k2azn.js +297 -0
- package/dist/shared/{chunk-jda3v59q.js → chunk-xa1b96mb.js} +2 -2
- package/dist/shared/chunk-xs6gp369.js +245 -0
- package/dist/shared/chunk-y4mmmayp.js +206 -0
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/alert-dialog/alert-dialog.js +1 -1
- package/dist/src/badge/badge.js +1 -1
- package/dist/src/button/button.js +1 -1
- package/dist/src/calendar/calendar.js +1 -1
- package/dist/src/carousel/carousel.js +1 -1
- package/dist/src/checkbox/checkbox.js +1 -1
- package/dist/src/collapsible/collapsible.js +1 -1
- package/dist/src/combobox/combobox.js +1 -1
- package/dist/src/command/command.js +1 -1
- package/dist/src/context-menu/context-menu.js +1 -1
- package/dist/src/date-picker/date-picker.js +1 -1
- package/dist/src/dialog/dialog.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/src/hover-card/hover-card.js +1 -1
- package/dist/src/index.d.ts +14 -1
- package/dist/src/index.js +5595 -4310
- package/dist/src/menu/menu.js +1 -1
- package/dist/src/menubar/menubar.js +1 -1
- package/dist/src/navigation-menu/navigation-menu.js +1 -1
- package/dist/src/popover/popover.js +1 -1
- package/dist/src/progress/progress.js +1 -1
- package/dist/src/radio/radio.js +1 -1
- package/dist/src/resizable-panel/resizable-panel.js +1 -1
- package/dist/src/scroll-area/scroll-area.js +1 -1
- package/dist/src/select/select.js +1 -1
- package/dist/src/sheet/sheet.js +1 -1
- package/dist/src/slider/slider.js +1 -1
- package/dist/src/switch/switch.js +1 -1
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/toggle/toggle.js +1 -1
- package/dist/src/toggle-group/toggle-group.js +1 -1
- package/dist/src/tooltip/tooltip.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-07yzsaaw.js +0 -165
- package/dist/shared/chunk-279bzynx.js +0 -132
- package/dist/shared/chunk-27xs9apd.js +0 -288
- package/dist/shared/chunk-2k8gxzdf.js +0 -151
- package/dist/shared/chunk-3rp73gkd.js +0 -175
- package/dist/shared/chunk-4rf1m34c.js +0 -267
- package/dist/shared/chunk-7bxsf80c.js +0 -60
- package/dist/shared/chunk-8qtexw5s.js +0 -199
- package/dist/shared/chunk-9ezgd78r.js +0 -142
- package/dist/shared/chunk-ajpj10z0.js +0 -282
- package/dist/shared/chunk-c46v0fsw.js +0 -117
- package/dist/shared/chunk-e4mm5e59.js +0 -178
- package/dist/shared/chunk-fqa5bwn1.js +0 -128
- package/dist/shared/chunk-g8hnc95b.js +0 -219
- package/dist/shared/chunk-j2tdpxgc.js +0 -185
- package/dist/shared/chunk-kcnq15je.js +0 -175
- package/dist/shared/chunk-mqs4qq0b.js +0 -46
- package/dist/shared/chunk-pg2yjn8f.js +0 -88
- package/dist/shared/chunk-rb53v045.js +0 -71
- package/dist/shared/chunk-s6a2yph8.js +0 -239
- package/dist/shared/chunk-vhx3sqw6.js +0 -196
- package/dist/shared/chunk-w318par6.js +0 -204
- package/dist/shared/chunk-wcdq7bew.js +0 -133
- package/dist/shared/chunk-z0gwkzgp.js +0 -34
- package/dist/shared/chunk-z850et33.js +0 -161
- package/dist/shared/chunk-zyfc6cx3.js +0 -61
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFloatingPosition
|
|
3
|
+
} from "./chunk-0mcr52hc.js";
|
|
4
|
+
import {
|
|
5
|
+
Keys,
|
|
6
|
+
isKey
|
|
7
|
+
} from "./chunk-7867pr13.js";
|
|
8
|
+
import {
|
|
9
|
+
setDataState,
|
|
10
|
+
setExpanded,
|
|
11
|
+
setHidden,
|
|
12
|
+
setHiddenAnimated
|
|
13
|
+
} from "./chunk-vevfhpc9.js";
|
|
14
|
+
import {
|
|
15
|
+
uniqueId
|
|
16
|
+
} from "./chunk-8y1jf6xr.js";
|
|
17
|
+
import {
|
|
18
|
+
applyAttrs
|
|
19
|
+
} from "./chunk-2db2dnp3.js";
|
|
20
|
+
|
|
21
|
+
// src/hover-card/hover-card.tsx
|
|
22
|
+
import { __discardMountFrame, __element, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
23
|
+
import { signal } from "@vertz/ui";
|
|
24
|
+
function HoverCardRoot(options = {}) {
|
|
25
|
+
const __mfDepth = __pushMountFrame();
|
|
26
|
+
try {
|
|
27
|
+
let cancelTimers = function() {
|
|
28
|
+
if (openTimeout) {
|
|
29
|
+
clearTimeout(openTimeout);
|
|
30
|
+
openTimeout = null;
|
|
31
|
+
}
|
|
32
|
+
if (closeTimeout) {
|
|
33
|
+
clearTimeout(closeTimeout);
|
|
34
|
+
closeTimeout = null;
|
|
35
|
+
}
|
|
36
|
+
}, cancelCloseTimer = function() {
|
|
37
|
+
if (closeTimeout) {
|
|
38
|
+
clearTimeout(closeTimeout);
|
|
39
|
+
closeTimeout = null;
|
|
40
|
+
}
|
|
41
|
+
}, positionContent = function() {
|
|
42
|
+
if (positioning) {
|
|
43
|
+
floatingCleanup?.();
|
|
44
|
+
const effectivePlacement = positioning.placement ?? "bottom";
|
|
45
|
+
const result = createFloatingPosition(trigger, content, {
|
|
46
|
+
...positioning,
|
|
47
|
+
placement: effectivePlacement
|
|
48
|
+
});
|
|
49
|
+
floatingCleanup = result.cleanup;
|
|
50
|
+
}
|
|
51
|
+
}, show = function() {
|
|
52
|
+
cancelTimers();
|
|
53
|
+
if (state.open.peek())
|
|
54
|
+
return;
|
|
55
|
+
openTimeout = setTimeout(() => {
|
|
56
|
+
state.open.value = true;
|
|
57
|
+
setExpanded(trigger, true);
|
|
58
|
+
setHidden(content, false);
|
|
59
|
+
setDataState(content, "open");
|
|
60
|
+
positionContent();
|
|
61
|
+
onOpenChange?.(true);
|
|
62
|
+
openTimeout = null;
|
|
63
|
+
}, openDelay);
|
|
64
|
+
}, showImmediate = function() {
|
|
65
|
+
cancelTimers();
|
|
66
|
+
state.open.value = true;
|
|
67
|
+
setExpanded(trigger, true);
|
|
68
|
+
setHidden(content, false);
|
|
69
|
+
setDataState(content, "open");
|
|
70
|
+
positionContent();
|
|
71
|
+
onOpenChange?.(true);
|
|
72
|
+
}, hide = function() {
|
|
73
|
+
cancelTimers();
|
|
74
|
+
if (!state.open.peek())
|
|
75
|
+
return;
|
|
76
|
+
closeTimeout = setTimeout(() => {
|
|
77
|
+
state.open.value = false;
|
|
78
|
+
setExpanded(trigger, false);
|
|
79
|
+
setDataState(content, "closed");
|
|
80
|
+
setHiddenAnimated(content, true);
|
|
81
|
+
floatingCleanup?.();
|
|
82
|
+
floatingCleanup = null;
|
|
83
|
+
onOpenChange?.(false);
|
|
84
|
+
closeTimeout = null;
|
|
85
|
+
}, closeDelay);
|
|
86
|
+
}, hideImmediate = function() {
|
|
87
|
+
cancelTimers();
|
|
88
|
+
state.open.value = false;
|
|
89
|
+
setExpanded(trigger, false);
|
|
90
|
+
setDataState(content, "closed");
|
|
91
|
+
setHiddenAnimated(content, true);
|
|
92
|
+
floatingCleanup?.();
|
|
93
|
+
floatingCleanup = null;
|
|
94
|
+
onOpenChange?.(false);
|
|
95
|
+
}, handleTriggerBlur = function(event) {
|
|
96
|
+
const related = event.relatedTarget;
|
|
97
|
+
if (related && (trigger.contains(related) || content.contains(related)))
|
|
98
|
+
return;
|
|
99
|
+
hide();
|
|
100
|
+
}, handleTriggerKeydown = function(event) {
|
|
101
|
+
if (isKey(event, Keys.Escape) && state.open.peek()) {
|
|
102
|
+
hideImmediate();
|
|
103
|
+
}
|
|
104
|
+
}, handleContentFocusout = function(event) {
|
|
105
|
+
const related = event.relatedTarget;
|
|
106
|
+
if (related && (trigger.contains(related) || content.contains(related)))
|
|
107
|
+
return;
|
|
108
|
+
hide();
|
|
109
|
+
}, handleContentKeydown = function(event) {
|
|
110
|
+
if (isKey(event, Keys.Escape)) {
|
|
111
|
+
hideImmediate();
|
|
112
|
+
trigger.focus();
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const { openDelay = 700, closeDelay = 300, onOpenChange, positioning, ...attrs } = options;
|
|
116
|
+
const contentId = uniqueId("hovercard");
|
|
117
|
+
const state = { open: signal(false) };
|
|
118
|
+
let openTimeout = null;
|
|
119
|
+
let closeTimeout = null;
|
|
120
|
+
let floatingCleanup = null;
|
|
121
|
+
const trigger = (() => {
|
|
122
|
+
const __el0 = __element("span");
|
|
123
|
+
__el0.setAttribute("aria-haspopup", "dialog");
|
|
124
|
+
__el0.setAttribute("aria-expanded", "false");
|
|
125
|
+
__on(__el0, "mouseenter", show);
|
|
126
|
+
__on(__el0, "mouseleave", hide);
|
|
127
|
+
__on(__el0, "focus", showImmediate);
|
|
128
|
+
__on(__el0, "blur", handleTriggerBlur);
|
|
129
|
+
__on(__el0, "keydown", handleTriggerKeydown);
|
|
130
|
+
return __el0;
|
|
131
|
+
})();
|
|
132
|
+
const content = (() => {
|
|
133
|
+
const __el1 = __element("div");
|
|
134
|
+
__el1.setAttribute("role", "dialog");
|
|
135
|
+
{
|
|
136
|
+
const __v = contentId;
|
|
137
|
+
if (__v != null && __v !== false)
|
|
138
|
+
__el1.setAttribute("id", __v === true ? "" : __v);
|
|
139
|
+
}
|
|
140
|
+
__el1.setAttribute("aria-hidden", "true");
|
|
141
|
+
__el1.setAttribute("data-state", "closed");
|
|
142
|
+
{
|
|
143
|
+
const __v = { display: "none" };
|
|
144
|
+
if (__v != null && __v !== false)
|
|
145
|
+
__el1.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
146
|
+
}
|
|
147
|
+
__on(__el1, "mouseenter", cancelCloseTimer);
|
|
148
|
+
__on(__el1, "mouseleave", hide);
|
|
149
|
+
__on(__el1, "focusin", cancelCloseTimer);
|
|
150
|
+
__on(__el1, "focusout", handleContentFocusout);
|
|
151
|
+
__on(__el1, "keydown", handleContentKeydown);
|
|
152
|
+
return __el1;
|
|
153
|
+
})();
|
|
154
|
+
applyAttrs(trigger, attrs);
|
|
155
|
+
const __mfResult0 = { trigger, content, state };
|
|
156
|
+
__flushMountFrame();
|
|
157
|
+
return __mfResult0;
|
|
158
|
+
} catch (__mfErr) {
|
|
159
|
+
__discardMountFrame(__mfDepth);
|
|
160
|
+
throw __mfErr;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
var HoverCard = {
|
|
164
|
+
Root: HoverCardRoot
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export { HoverCard };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleActivation
|
|
3
|
+
} from "./chunk-7867pr13.js";
|
|
4
|
+
import {
|
|
5
|
+
applyAttrs
|
|
6
|
+
} from "./chunk-2db2dnp3.js";
|
|
7
|
+
|
|
8
|
+
// src/button/button.tsx
|
|
9
|
+
import { __discardMountFrame, __element, __flushMountFrame, __on, __pushMountFrame } from "@vertz/ui/internals";
|
|
10
|
+
function ButtonRoot(options = {}) {
|
|
11
|
+
const __mfDepth = __pushMountFrame();
|
|
12
|
+
try {
|
|
13
|
+
const { disabled = false, onClick, ...attrs } = options;
|
|
14
|
+
const el = (() => {
|
|
15
|
+
const __el0 = __element("button");
|
|
16
|
+
__el0.setAttribute("type", "button");
|
|
17
|
+
{
|
|
18
|
+
const __v = disabled;
|
|
19
|
+
if (__v != null && __v !== false)
|
|
20
|
+
__el0.setAttribute("disabled", __v === true ? "" : __v);
|
|
21
|
+
}
|
|
22
|
+
{
|
|
23
|
+
const __v = disabled ? "true" : undefined;
|
|
24
|
+
if (__v != null && __v !== false)
|
|
25
|
+
__el0.setAttribute("aria-disabled", __v === true ? "" : __v);
|
|
26
|
+
}
|
|
27
|
+
__on(__el0, "click", () => {
|
|
28
|
+
if (disabled)
|
|
29
|
+
return;
|
|
30
|
+
onClick?.();
|
|
31
|
+
});
|
|
32
|
+
__on(__el0, "keydown", (event) => {
|
|
33
|
+
if (disabled)
|
|
34
|
+
return;
|
|
35
|
+
handleActivation(event, () => {
|
|
36
|
+
event.target.click();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return __el0;
|
|
40
|
+
})();
|
|
41
|
+
applyAttrs(el, attrs);
|
|
42
|
+
const __mfResult0 = el;
|
|
43
|
+
__flushMountFrame();
|
|
44
|
+
return __mfResult0;
|
|
45
|
+
} catch (__mfErr) {
|
|
46
|
+
__discardMountFrame(__mfDepth);
|
|
47
|
+
throw __mfErr;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var Button = {
|
|
51
|
+
Root: ButtonRoot
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { Button };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Keys,
|
|
3
|
+
isKey
|
|
4
|
+
} from "./chunk-7867pr13.js";
|
|
5
|
+
import {
|
|
6
|
+
setDataState,
|
|
7
|
+
setValueRange
|
|
8
|
+
} from "./chunk-vevfhpc9.js";
|
|
9
|
+
import {
|
|
10
|
+
applyAttrs
|
|
11
|
+
} from "./chunk-2db2dnp3.js";
|
|
12
|
+
|
|
13
|
+
// src/resizable-panel/resizable-panel.tsx
|
|
14
|
+
import { __discardMountFrame, __element, __flushMountFrame, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
15
|
+
import { signal } from "@vertz/ui";
|
|
16
|
+
function ResizablePanelRoot(options = {}) {
|
|
17
|
+
const __mfDepth = __pushMountFrame();
|
|
18
|
+
try {
|
|
19
|
+
let updateSizes = function(newSizes) {
|
|
20
|
+
state.sizes.value = [...newSizes];
|
|
21
|
+
for (let i = 0;i < panels.length; i++) {
|
|
22
|
+
const panel = panels[i];
|
|
23
|
+
if (!panel)
|
|
24
|
+
continue;
|
|
25
|
+
const size = newSizes[i] ?? 0;
|
|
26
|
+
panel.el.style.flex = `0 0 ${size}%`;
|
|
27
|
+
}
|
|
28
|
+
for (let i = 0;i < handles.length; i++) {
|
|
29
|
+
const handle = handles[i];
|
|
30
|
+
const leftPanel = panels[i];
|
|
31
|
+
if (handle && leftPanel) {
|
|
32
|
+
const size = newSizes[i] ?? 0;
|
|
33
|
+
setValueRange(handle, Math.round(size), Math.round(leftPanel.minSize), Math.round(leftPanel.maxSize));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
onResize?.(newSizes);
|
|
37
|
+
}, Panel = function(panelOptions = {}) {
|
|
38
|
+
const { defaultSize, minSize = 0, maxSize = 100 } = panelOptions;
|
|
39
|
+
const el = (() => {
|
|
40
|
+
const __el1 = __element("div");
|
|
41
|
+
__el1.setAttribute("data-panel", "");
|
|
42
|
+
return __el1;
|
|
43
|
+
})();
|
|
44
|
+
panels.push({ el, minSize, maxSize });
|
|
45
|
+
const sizes = state.sizes.peek();
|
|
46
|
+
if (defaultSize != null) {
|
|
47
|
+
sizes.push(defaultSize);
|
|
48
|
+
} else {
|
|
49
|
+
const equalSize = 100 / panels.length;
|
|
50
|
+
sizes.length = 0;
|
|
51
|
+
for (let i = 0;i < panels.length; i++) {
|
|
52
|
+
sizes.push(equalSize);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
updateSizes(sizes);
|
|
56
|
+
root.appendChild(el);
|
|
57
|
+
return el;
|
|
58
|
+
}, Handle = function() {
|
|
59
|
+
const handleIndex = handles.length;
|
|
60
|
+
const handle = (() => {
|
|
61
|
+
const __el2 = __element("div");
|
|
62
|
+
__el2.setAttribute("role", "separator");
|
|
63
|
+
__el2.setAttribute("tabindex", "0");
|
|
64
|
+
{
|
|
65
|
+
const __v = orientation;
|
|
66
|
+
if (__v != null && __v !== false)
|
|
67
|
+
__el2.setAttribute("data-orientation", __v === true ? "" : __v);
|
|
68
|
+
}
|
|
69
|
+
__el2.setAttribute("data-state", "idle");
|
|
70
|
+
__on(__el2, "keydown", (event) => {
|
|
71
|
+
const sizes = [...state.sizes.peek()];
|
|
72
|
+
const leftIdx = handleIndex;
|
|
73
|
+
const rightIdx = handleIndex + 1;
|
|
74
|
+
const leftPanel = panels[leftIdx];
|
|
75
|
+
const rightPanel = panels[rightIdx];
|
|
76
|
+
if (!leftPanel || !rightPanel)
|
|
77
|
+
return;
|
|
78
|
+
let leftSize = sizes[leftIdx] ?? 0;
|
|
79
|
+
let rightSize = sizes[rightIdx] ?? 0;
|
|
80
|
+
const STEP = 5;
|
|
81
|
+
const growKey = orientation === "horizontal" ? Keys.ArrowRight : Keys.ArrowDown;
|
|
82
|
+
const shrinkKey = orientation === "horizontal" ? Keys.ArrowLeft : Keys.ArrowUp;
|
|
83
|
+
if (isKey(event, growKey)) {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
const delta = Math.min(STEP, rightSize - rightPanel.minSize, leftPanel.maxSize - leftSize);
|
|
86
|
+
leftSize += delta;
|
|
87
|
+
rightSize -= delta;
|
|
88
|
+
} else if (isKey(event, shrinkKey)) {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
const delta = Math.min(STEP, leftSize - leftPanel.minSize, rightPanel.maxSize - rightSize);
|
|
91
|
+
leftSize -= delta;
|
|
92
|
+
rightSize += delta;
|
|
93
|
+
} else if (isKey(event, Keys.Home)) {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
const delta = leftSize - leftPanel.minSize;
|
|
96
|
+
leftSize -= delta;
|
|
97
|
+
rightSize += delta;
|
|
98
|
+
} else if (isKey(event, Keys.End)) {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
const delta = rightSize - rightPanel.minSize;
|
|
101
|
+
leftSize += delta;
|
|
102
|
+
rightSize -= delta;
|
|
103
|
+
} else {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
sizes[leftIdx] = leftSize;
|
|
107
|
+
sizes[rightIdx] = rightSize;
|
|
108
|
+
updateSizes(sizes);
|
|
109
|
+
});
|
|
110
|
+
__on(__el2, "pointerdown", (event) => {
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
handle.setPointerCapture(event.pointerId);
|
|
113
|
+
setDataState(handle, "dragging");
|
|
114
|
+
const startPos = orientation === "horizontal" ? event.clientX : event.clientY;
|
|
115
|
+
const rootSize = orientation === "horizontal" ? root.offsetWidth : root.offsetHeight;
|
|
116
|
+
const startSizes = [...state.sizes.peek()];
|
|
117
|
+
function onMove(e) {
|
|
118
|
+
const currentPos = orientation === "horizontal" ? e.clientX : e.clientY;
|
|
119
|
+
const delta = (currentPos - startPos) / rootSize * 100;
|
|
120
|
+
const sizes = [...startSizes];
|
|
121
|
+
const leftIdx = handleIndex;
|
|
122
|
+
const rightIdx = handleIndex + 1;
|
|
123
|
+
const leftPanel = panels[leftIdx];
|
|
124
|
+
const rightPanel = panels[rightIdx];
|
|
125
|
+
if (!leftPanel || !rightPanel)
|
|
126
|
+
return;
|
|
127
|
+
let newLeft = (startSizes[leftIdx] ?? 0) + delta;
|
|
128
|
+
let newRight = (startSizes[rightIdx] ?? 0) - delta;
|
|
129
|
+
newLeft = Math.max(leftPanel.minSize, Math.min(leftPanel.maxSize, newLeft));
|
|
130
|
+
newRight = Math.max(rightPanel.minSize, Math.min(rightPanel.maxSize, newRight));
|
|
131
|
+
sizes[leftIdx] = newLeft;
|
|
132
|
+
sizes[rightIdx] = newRight;
|
|
133
|
+
updateSizes(sizes);
|
|
134
|
+
}
|
|
135
|
+
function onUp(e) {
|
|
136
|
+
handle.releasePointerCapture(e.pointerId);
|
|
137
|
+
setDataState(handle, "idle");
|
|
138
|
+
handle.removeEventListener("pointermove", onMove);
|
|
139
|
+
handle.removeEventListener("pointerup", onUp);
|
|
140
|
+
}
|
|
141
|
+
handle.addEventListener("pointermove", onMove);
|
|
142
|
+
handle.addEventListener("pointerup", onUp);
|
|
143
|
+
});
|
|
144
|
+
return __el2;
|
|
145
|
+
})();
|
|
146
|
+
handles.push(handle);
|
|
147
|
+
root.appendChild(handle);
|
|
148
|
+
return handle;
|
|
149
|
+
};
|
|
150
|
+
const { orientation = "horizontal", onResize, ...attrs } = options;
|
|
151
|
+
const state = { sizes: signal([]) };
|
|
152
|
+
const panels = [];
|
|
153
|
+
const handles = [];
|
|
154
|
+
const root = (() => {
|
|
155
|
+
const __el0 = __element("div");
|
|
156
|
+
{
|
|
157
|
+
const __v = { display: "flex", flexDirection: orientation === "horizontal" ? "row" : "column" };
|
|
158
|
+
if (__v != null && __v !== false)
|
|
159
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
160
|
+
}
|
|
161
|
+
{
|
|
162
|
+
const __v = orientation;
|
|
163
|
+
if (__v != null && __v !== false)
|
|
164
|
+
__el0.setAttribute("data-orientation", __v === true ? "" : __v);
|
|
165
|
+
}
|
|
166
|
+
return __el0;
|
|
167
|
+
})();
|
|
168
|
+
applyAttrs(root, attrs);
|
|
169
|
+
const __mfResult0 = { root, state, Panel, Handle };
|
|
170
|
+
__flushMountFrame();
|
|
171
|
+
return __mfResult0;
|
|
172
|
+
} catch (__mfErr) {
|
|
173
|
+
__discardMountFrame(__mfDepth);
|
|
174
|
+
throw __mfErr;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
var ResizablePanel = {
|
|
178
|
+
Root: ResizablePanelRoot
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export { ResizablePanel };
|
|
@@ -21,98 +21,150 @@ import {
|
|
|
21
21
|
} from "./chunk-2db2dnp3.js";
|
|
22
22
|
|
|
23
23
|
// src/navigation-menu/navigation-menu.tsx
|
|
24
|
-
import { __element, __enterChildren, __exitChildren, __insert, __on } from "@vertz/ui/internals";
|
|
24
|
+
import { __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __on, __pushMountFrame, __styleStr } from "@vertz/ui/internals";
|
|
25
25
|
import { signal } from "@vertz/ui";
|
|
26
26
|
function NavMenuList(triggers, orientation) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
const __mfDepth = __pushMountFrame();
|
|
28
|
+
try {
|
|
29
|
+
const __mfResult0 = (() => {
|
|
30
|
+
const __el0 = __element("div");
|
|
31
|
+
__on(__el0, "keydown", (event) => {
|
|
32
|
+
if (isKey(event, Keys.ArrowLeft, Keys.ArrowRight, Keys.Home, Keys.End)) {
|
|
33
|
+
handleListNavigation(event, triggers, {
|
|
34
|
+
orientation: orientation === "horizontal" ? "horizontal" : "vertical"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return __el0;
|
|
39
|
+
})();
|
|
40
|
+
__flushMountFrame();
|
|
41
|
+
return __mfResult0;
|
|
42
|
+
} catch (__mfErr) {
|
|
43
|
+
__discardMountFrame(__mfDepth);
|
|
44
|
+
throw __mfErr;
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
function NavMenuViewport() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
const __mfDepth = __pushMountFrame();
|
|
49
|
+
try {
|
|
50
|
+
const __mfResult0 = (() => {
|
|
51
|
+
const __el0 = __element("div");
|
|
52
|
+
return __el0;
|
|
53
|
+
})();
|
|
54
|
+
__flushMountFrame();
|
|
55
|
+
return __mfResult0;
|
|
56
|
+
} catch (__mfErr) {
|
|
57
|
+
__discardMountFrame(__mfDepth);
|
|
58
|
+
throw __mfErr;
|
|
59
|
+
}
|
|
44
60
|
}
|
|
45
61
|
function NavMenuNav(list, viewport) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
const __mfDepth = __pushMountFrame();
|
|
63
|
+
try {
|
|
64
|
+
const __mfResult0 = (() => {
|
|
65
|
+
const __el0 = __element("nav");
|
|
66
|
+
__enterChildren(__el0);
|
|
67
|
+
__insert(__el0, list);
|
|
68
|
+
__insert(__el0, viewport);
|
|
69
|
+
__exitChildren();
|
|
70
|
+
return __el0;
|
|
71
|
+
})();
|
|
72
|
+
__flushMountFrame();
|
|
73
|
+
return __mfResult0;
|
|
74
|
+
} catch (__mfErr) {
|
|
75
|
+
__discardMountFrame(__mfDepth);
|
|
76
|
+
throw __mfErr;
|
|
77
|
+
}
|
|
54
78
|
}
|
|
55
79
|
function NavMenuItemTrigger(triggerId, contentId, value, label, onClick, onMouseenter, onMouseleave, onKeydown) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
const __mfDepth = __pushMountFrame();
|
|
81
|
+
try {
|
|
82
|
+
const __mfResult0 = (() => {
|
|
83
|
+
const __el0 = __element("button");
|
|
84
|
+
__el0.setAttribute("type", "button");
|
|
85
|
+
{
|
|
86
|
+
const __v = triggerId;
|
|
87
|
+
if (__v != null && __v !== false)
|
|
88
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
89
|
+
}
|
|
90
|
+
{
|
|
91
|
+
const __v = contentId;
|
|
92
|
+
if (__v != null && __v !== false)
|
|
93
|
+
__el0.setAttribute("aria-controls", __v === true ? "" : __v);
|
|
94
|
+
}
|
|
95
|
+
{
|
|
96
|
+
const __v = value;
|
|
97
|
+
if (__v != null && __v !== false)
|
|
98
|
+
__el0.setAttribute("data-value", __v === true ? "" : __v);
|
|
99
|
+
}
|
|
100
|
+
__el0.setAttribute("aria-expanded", "false");
|
|
101
|
+
__el0.setAttribute("data-state", "closed");
|
|
102
|
+
__on(__el0, "click", onClick);
|
|
103
|
+
__on(__el0, "mouseenter", onMouseenter);
|
|
104
|
+
__on(__el0, "mouseleave", onMouseleave);
|
|
105
|
+
__on(__el0, "keydown", onKeydown);
|
|
106
|
+
__enterChildren(__el0);
|
|
107
|
+
__insert(__el0, label ?? value);
|
|
108
|
+
__exitChildren();
|
|
109
|
+
return __el0;
|
|
110
|
+
})();
|
|
111
|
+
__flushMountFrame();
|
|
112
|
+
return __mfResult0;
|
|
113
|
+
} catch (__mfErr) {
|
|
114
|
+
__discardMountFrame(__mfDepth);
|
|
115
|
+
throw __mfErr;
|
|
116
|
+
}
|
|
85
117
|
}
|
|
86
118
|
function NavMenuItemContent(contentId, onMouseenter, onMouseleave, onKeydown) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
119
|
+
const __mfDepth = __pushMountFrame();
|
|
120
|
+
try {
|
|
121
|
+
const __mfResult0 = (() => {
|
|
122
|
+
const __el0 = __element("div");
|
|
123
|
+
{
|
|
124
|
+
const __v = contentId;
|
|
125
|
+
if (__v != null && __v !== false)
|
|
126
|
+
__el0.setAttribute("id", __v === true ? "" : __v);
|
|
127
|
+
}
|
|
128
|
+
__el0.setAttribute("aria-hidden", "true");
|
|
129
|
+
__el0.setAttribute("data-state", "closed");
|
|
130
|
+
{
|
|
131
|
+
const __v = { display: "none" };
|
|
132
|
+
if (__v != null && __v !== false)
|
|
133
|
+
__el0.setAttribute("style", typeof __v === "object" ? __styleStr(__v) : __v === true ? "" : String(__v));
|
|
134
|
+
}
|
|
135
|
+
__on(__el0, "mouseenter", onMouseenter);
|
|
136
|
+
__on(__el0, "mouseleave", onMouseleave);
|
|
137
|
+
__on(__el0, "keydown", onKeydown);
|
|
138
|
+
return __el0;
|
|
139
|
+
})();
|
|
140
|
+
__flushMountFrame();
|
|
141
|
+
return __mfResult0;
|
|
142
|
+
} catch (__mfErr) {
|
|
143
|
+
__discardMountFrame(__mfDepth);
|
|
144
|
+
throw __mfErr;
|
|
145
|
+
}
|
|
102
146
|
}
|
|
103
147
|
function NavMenuLink(href, label) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
148
|
+
const __mfDepth = __pushMountFrame();
|
|
149
|
+
try {
|
|
150
|
+
const __mfResult0 = (() => {
|
|
151
|
+
const __el0 = __element("a");
|
|
152
|
+
{
|
|
153
|
+
const __v = href;
|
|
154
|
+
if (__v != null && __v !== false)
|
|
155
|
+
__el0.setAttribute("href", __v === true ? "" : __v);
|
|
156
|
+
}
|
|
157
|
+
__enterChildren(__el0);
|
|
158
|
+
__insert(__el0, label);
|
|
159
|
+
__exitChildren();
|
|
160
|
+
return __el0;
|
|
161
|
+
})();
|
|
162
|
+
__flushMountFrame();
|
|
163
|
+
return __mfResult0;
|
|
164
|
+
} catch (__mfErr) {
|
|
165
|
+
__discardMountFrame(__mfDepth);
|
|
166
|
+
throw __mfErr;
|
|
167
|
+
}
|
|
116
168
|
}
|
|
117
169
|
function NavigationMenuRoot(options = {}) {
|
|
118
170
|
const { orientation = "horizontal", delayOpen = 200, delayClose = 300, ...attrs } = options;
|