reifyui 0.11.0 → 0.12.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/README.md +2 -2
- package/dist/index.cjs +453 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.js +454 -159
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CascadeMenu.jsx +210 -0
- package/src/components/ChatMessages.jsx +30 -9
- package/src/components/Chip.jsx +37 -10
- package/src/components/Composer.jsx +44 -0
- package/src/index.d.ts +17 -2
- package/src/index.js +2 -0
- package/src/sheet/SheetGrid.jsx +72 -6
- package/src/timeline/Timeline.jsx +3 -1
- package/styles/chat.css +45 -5
- package/styles/chip.css +36 -0
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(src_exports, {
|
|
|
34
34
|
Button: () => Button,
|
|
35
35
|
Card: () => Card,
|
|
36
36
|
Carousel: () => Carousel,
|
|
37
|
+
CascadeMenu: () => CascadeMenu,
|
|
37
38
|
ChatMessages: () => ChatMessages,
|
|
38
39
|
ChatMessagesSkeleton: () => ChatMessagesSkeleton,
|
|
39
40
|
ChatPanel: () => ChatPanel,
|
|
@@ -658,15 +659,22 @@ function ToolRow(props) {
|
|
|
658
659
|
var import_react4 = __toESM(require("react"), 1);
|
|
659
660
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
660
661
|
var DEFAULT_STATUS_LABELS = {
|
|
661
|
-
failed: "\u2715 Failed
|
|
662
|
+
failed: "\u2715 Failed. See the output above for the reason",
|
|
662
663
|
cancelled: "\u25FC Stopped by you",
|
|
663
|
-
|
|
664
|
+
// Claims only what is true of every cause: an incomplete turn may have hit its step or time
|
|
665
|
+
// budget, or been cut mid-flight (a replica restart under a live turn settles as incomplete).
|
|
666
|
+
// Asserting "step or time limit" for all of them sent an operator debugging a limit that was
|
|
667
|
+
// never reached. A host that knows the actual cause says so in its own chrome (statusLabels /
|
|
668
|
+
// assistantFooter).
|
|
669
|
+
incomplete: "\u25D4 Stopped before finishing. Continue to resume"
|
|
664
670
|
};
|
|
665
671
|
var defaultMarkdown = (text) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { whiteSpace: "pre-wrap" }, children: text });
|
|
672
|
+
var REDUCED_MOTION = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
666
673
|
var REVEAL_SEC = 3;
|
|
667
674
|
var MIN_CPS = 10;
|
|
668
675
|
function TypewriterText(props) {
|
|
669
|
-
const { text,
|
|
676
|
+
const { text, render } = props;
|
|
677
|
+
const active = props.active && !REDUCED_MOTION;
|
|
670
678
|
const [n, setN] = import_react4.default.useState(() => text ? text.length : 0);
|
|
671
679
|
const textRef = import_react4.default.useRef(text);
|
|
672
680
|
textRef.current = text;
|
|
@@ -698,11 +706,15 @@ function TypewriterText(props) {
|
|
|
698
706
|
return render(shown);
|
|
699
707
|
}
|
|
700
708
|
function UserTurn(props) {
|
|
701
|
-
const { msg, children } = props;
|
|
702
|
-
|
|
709
|
+
const { msg, children, label } = props;
|
|
710
|
+
const bubble = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wbx-bubble-user", children: [
|
|
703
711
|
children,
|
|
704
712
|
msg.text && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "wbx-bubble-text", children: msg.text })
|
|
705
|
-
] })
|
|
713
|
+
] });
|
|
714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "wbx-turn user", children: label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wbx-turn-body", children: [
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "wbx-role", children: label }),
|
|
716
|
+
bubble
|
|
717
|
+
] }) : bubble });
|
|
706
718
|
}
|
|
707
719
|
function AssistantTurn(props) {
|
|
708
720
|
const {
|
|
@@ -713,9 +725,11 @@ function AssistantTurn(props) {
|
|
|
713
725
|
statusLabels = DEFAULT_STATUS_LABELS,
|
|
714
726
|
renderStep,
|
|
715
727
|
toolLabels,
|
|
716
|
-
footer
|
|
728
|
+
footer,
|
|
729
|
+
label
|
|
717
730
|
} = props;
|
|
718
731
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wbx-turn asst", children: [
|
|
732
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "wbx-role", children: label }) : null,
|
|
719
733
|
msg.blocks.map((b, bi) => b.kind === "tools" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
720
734
|
ToolGroup,
|
|
721
735
|
{
|
|
@@ -768,14 +782,15 @@ function ChatMessages(props) {
|
|
|
768
782
|
statusLabels,
|
|
769
783
|
renderStep,
|
|
770
784
|
workingLabel,
|
|
771
|
-
toolLabels
|
|
785
|
+
toolLabels,
|
|
786
|
+
roleLabel
|
|
772
787
|
} = props;
|
|
773
788
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: messages.map((m, i) => {
|
|
774
789
|
if (renderMessage) {
|
|
775
790
|
const el = renderMessage(m, i);
|
|
776
791
|
if (el !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.default.Fragment, { children: el }, i);
|
|
777
792
|
}
|
|
778
|
-
return m.role === "user" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(UserTurn, { msg: m, children: userExtras?.(m, i) }, i) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
793
|
+
return m.role === "user" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(UserTurn, { msg: m, label: roleLabel?.(m, i), children: userExtras?.(m, i) }, i) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
779
794
|
AssistantTurn,
|
|
780
795
|
{
|
|
781
796
|
msg: m,
|
|
@@ -785,6 +800,7 @@ function ChatMessages(props) {
|
|
|
785
800
|
statusLabels,
|
|
786
801
|
renderStep,
|
|
787
802
|
toolLabels,
|
|
803
|
+
label: roleLabel?.(m, i),
|
|
788
804
|
footer: assistantFooter?.(m, i)
|
|
789
805
|
},
|
|
790
806
|
i
|
|
@@ -805,6 +821,7 @@ function Composer(props) {
|
|
|
805
821
|
placeholder,
|
|
806
822
|
rows = 1,
|
|
807
823
|
autoGrow = true,
|
|
824
|
+
inline = false,
|
|
808
825
|
maxRows = 15,
|
|
809
826
|
autoFocus,
|
|
810
827
|
// The composer on a landing page often has an ANIMATING placeholder (a typewriter cycling
|
|
@@ -812,6 +829,7 @@ function Composer(props) {
|
|
|
812
829
|
// one is given — so the field announces a different name every few seconds.
|
|
813
830
|
inputAriaLabel,
|
|
814
831
|
attachments,
|
|
832
|
+
tray,
|
|
815
833
|
accessoriesLeft,
|
|
816
834
|
accessoriesRight,
|
|
817
835
|
renderSend,
|
|
@@ -831,6 +849,38 @@ function Composer(props) {
|
|
|
831
849
|
el.style.height = Math.min(el.scrollHeight, max) + "px";
|
|
832
850
|
el.style.overflowY = el.scrollHeight > max ? "auto" : "hidden";
|
|
833
851
|
}, [value, autoGrow, maxRows, taRef]);
|
|
852
|
+
const sendEl = renderSend ? renderSend() : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "uic-send", disabled: sendDisabled, onClick: () => onSend(), "aria-label": "Send message", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IcSend, {}) });
|
|
853
|
+
if (inline) {
|
|
854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: classNames.root ?? "wbx-composer", children: [
|
|
855
|
+
attachments,
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "uic-composer-line", children: [
|
|
857
|
+
accessoriesLeft,
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
859
|
+
"textarea",
|
|
860
|
+
{
|
|
861
|
+
ref: taRef,
|
|
862
|
+
className: classNames.input ?? "wbx-composer-input",
|
|
863
|
+
rows,
|
|
864
|
+
value,
|
|
865
|
+
placeholder,
|
|
866
|
+
"aria-label": inputAriaLabel || placeholder,
|
|
867
|
+
disabled,
|
|
868
|
+
autoFocus,
|
|
869
|
+
onChange: (e) => onChange(e.target.value),
|
|
870
|
+
onKeyDown: (e) => {
|
|
871
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
872
|
+
e.preventDefault();
|
|
873
|
+
onSend();
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
),
|
|
878
|
+
accessoriesRight,
|
|
879
|
+
sendEl
|
|
880
|
+
] }),
|
|
881
|
+
tray ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "uic-composer-tray", children: tray }) : null
|
|
882
|
+
] });
|
|
883
|
+
}
|
|
834
884
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: classNames.root ?? "wbx-composer", children: [
|
|
835
885
|
attachments,
|
|
836
886
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -857,7 +907,8 @@ function Composer(props) {
|
|
|
857
907
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1 } }),
|
|
858
908
|
accessoriesRight,
|
|
859
909
|
renderSend ? renderSend() : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "uic-send", disabled: sendDisabled, onClick: () => onSend(), "aria-label": "Send message", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IcSend, {}) })
|
|
860
|
-
] })
|
|
910
|
+
] }),
|
|
911
|
+
tray ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "uic-composer-tray", children: tray }) : null
|
|
861
912
|
] });
|
|
862
913
|
}
|
|
863
914
|
|
|
@@ -867,32 +918,54 @@ var import_react7 = __toESM(require("react"), 1);
|
|
|
867
918
|
// src/components/Chip.jsx
|
|
868
919
|
var import_react6 = __toESM(require("react"), 1);
|
|
869
920
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
870
|
-
|
|
871
|
-
const {
|
|
921
|
+
var Chip = (0, import_react6.forwardRef)(function Chip2(props, ref) {
|
|
922
|
+
const {
|
|
923
|
+
label,
|
|
924
|
+
icon,
|
|
925
|
+
title,
|
|
926
|
+
selected = false,
|
|
927
|
+
onClick,
|
|
928
|
+
onRemove,
|
|
929
|
+
removeLabel,
|
|
930
|
+
trailing,
|
|
931
|
+
className,
|
|
932
|
+
slot,
|
|
933
|
+
...rest
|
|
934
|
+
} = props;
|
|
935
|
+
const isSlot = slot ?? (Boolean(onClick) && !selected);
|
|
872
936
|
const cls = [
|
|
873
937
|
"uic-chip",
|
|
874
938
|
selected ? "is-selected" : "",
|
|
875
|
-
|
|
939
|
+
isSlot ? "is-open" : "",
|
|
876
940
|
className || ""
|
|
877
941
|
].filter(Boolean).join(" ");
|
|
878
942
|
const body = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
879
943
|
icon ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "uic-chip-ic", "aria-hidden": "true", children: icon }) : null,
|
|
880
944
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "uic-chip-l", children: label })
|
|
881
945
|
] });
|
|
946
|
+
const trail = trailing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "uic-chip-tr", children: trailing }) : null;
|
|
882
947
|
if (onClick && onRemove) {
|
|
883
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: cls, title, children: [
|
|
884
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "uic-chip-press", onClick, children: body }),
|
|
948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { ref, className: cls, title, children: [
|
|
949
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "uic-chip-press", onClick, ...rest, children: body }),
|
|
950
|
+
trail,
|
|
885
951
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IcX, { size: 12 }) })
|
|
886
952
|
] });
|
|
887
953
|
}
|
|
888
954
|
if (onClick) {
|
|
889
|
-
|
|
955
|
+
if (trailing) {
|
|
956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { ref, className: cls, title, children: [
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "uic-chip-press", onClick, ...rest, children: body }),
|
|
958
|
+
trail
|
|
959
|
+
] });
|
|
960
|
+
}
|
|
961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { ref, type: "button", className: cls, title, onClick, ...rest, children: body });
|
|
890
962
|
}
|
|
891
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: cls, title, children: [
|
|
963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { ref, className: cls, title, ...rest, children: [
|
|
892
964
|
body,
|
|
965
|
+
trail,
|
|
893
966
|
onRemove ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IcX, { size: 12 }) }) : null
|
|
894
967
|
] });
|
|
895
|
-
}
|
|
968
|
+
});
|
|
896
969
|
|
|
897
970
|
// src/format.js
|
|
898
971
|
function bytesLabel(n) {
|
|
@@ -2310,6 +2383,9 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
2310
2383
|
var import_react15 = require("react");
|
|
2311
2384
|
var import_react_dom2 = require("react-dom");
|
|
2312
2385
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2386
|
+
var CLAMP_LINE = 18;
|
|
2387
|
+
var CLAMP_PAD = 10;
|
|
2388
|
+
var CLAMP_TEXT_SEL = "[data-shg-clamp-text]";
|
|
2313
2389
|
var cellKey = (rowId, colId) => `${rowId}:${colId}`;
|
|
2314
2390
|
var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
|
|
2315
2391
|
var DEFAULT_COLUMN_TYPES = [
|
|
@@ -2478,6 +2554,7 @@ function SheetGrid({
|
|
|
2478
2554
|
const [dropAt, setDropAt] = (0, import_react15.useState)(null);
|
|
2479
2555
|
const inputRef = (0, import_react15.useRef)(null);
|
|
2480
2556
|
const dragRef = (0, import_react15.useRef)(null);
|
|
2557
|
+
const gridRef = (0, import_react15.useRef)(null);
|
|
2481
2558
|
const descOf = (type) => columnTypes.find((t) => t.type === type) || { type, label: type };
|
|
2482
2559
|
const isComputed = (col) => !!descOf(col?.type).computed;
|
|
2483
2560
|
const isEditable = (col) => {
|
|
@@ -2581,6 +2658,31 @@ function SheetGrid({
|
|
|
2581
2658
|
(0, import_react15.useEffect)(() => {
|
|
2582
2659
|
if (editing && inputRef.current) inputRef.current.focus();
|
|
2583
2660
|
}, [editing]);
|
|
2661
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
2662
|
+
const rowsEl = gridRef.current?.querySelectorAll("tbody tr[data-row-id]");
|
|
2663
|
+
if (!rowsEl || !rowsEl.length) return;
|
|
2664
|
+
const trs = Array.from(rowsEl);
|
|
2665
|
+
for (const tr of trs) {
|
|
2666
|
+
tr.style.removeProperty("--shg-clamp");
|
|
2667
|
+
for (const td of tr.children) td.style.setProperty("--shg-clamp", "1");
|
|
2668
|
+
}
|
|
2669
|
+
const plan = trs.map((tr) => ({
|
|
2670
|
+
base: tr.offsetHeight,
|
|
2671
|
+
cells: Array.from(tr.children).map((td) => {
|
|
2672
|
+
const txt = td.querySelector(CLAMP_TEXT_SEL);
|
|
2673
|
+
const box = txt && txt.parentElement;
|
|
2674
|
+
return { td, extra: box ? Math.max(0, box.scrollHeight - txt.offsetHeight) : 0 };
|
|
2675
|
+
})
|
|
2676
|
+
}));
|
|
2677
|
+
for (const { base, cells: cells2 } of plan) {
|
|
2678
|
+
const floorLines = Math.max(1, Math.floor((base - CLAMP_PAD) / CLAMP_LINE));
|
|
2679
|
+
const need = Math.max(...cells2.map((c) => c.extra)) + floorLines * CLAMP_LINE + CLAMP_PAD;
|
|
2680
|
+
for (const { td, extra } of cells2) {
|
|
2681
|
+
const lines = Math.max(floorLines, Math.floor((need - extra - CLAMP_PAD) / CLAMP_LINE));
|
|
2682
|
+
td.style.setProperty("--shg-clamp", String(lines));
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
});
|
|
2584
2686
|
const mutate = (fn) => {
|
|
2585
2687
|
if (readOnly || !onChange) return;
|
|
2586
2688
|
const next = JSON.parse(JSON.stringify(sheet));
|
|
@@ -2737,7 +2839,7 @@ function SheetGrid({
|
|
|
2737
2839
|
}
|
|
2738
2840
|
);
|
|
2739
2841
|
};
|
|
2740
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "shg", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "shg-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "shg-table", children: [
|
|
2842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "shg", ref: gridRef, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "shg-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "shg-table", children: [
|
|
2741
2843
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { children: [
|
|
2742
2844
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "shg-corner", style: numStyle }),
|
|
2743
2845
|
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
@@ -2781,10 +2883,7 @@ function SheetGrid({
|
|
|
2781
2883
|
"tr",
|
|
2782
2884
|
{
|
|
2783
2885
|
"data-row-id": row.id,
|
|
2784
|
-
style: {
|
|
2785
|
-
...rowHeight(row) ? { height: rowHeight(row) } : null,
|
|
2786
|
-
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
2787
|
-
},
|
|
2886
|
+
style: rowHeight(row) ? { height: rowHeight(row) } : void 0,
|
|
2788
2887
|
children: [
|
|
2789
2888
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2790
2889
|
"td",
|
|
@@ -3703,10 +3802,206 @@ function Popover(props) {
|
|
|
3703
3802
|
);
|
|
3704
3803
|
}
|
|
3705
3804
|
|
|
3706
|
-
// src/components/
|
|
3805
|
+
// src/components/CascadeMenu.jsx
|
|
3707
3806
|
var import_react23 = __toESM(require("react"), 1);
|
|
3708
|
-
var import_react_dom4 = require("react-dom");
|
|
3709
3807
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3808
|
+
var Tick = () => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Svg, { s: 14, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
3809
|
+
var FILTER_PAST = 8;
|
|
3810
|
+
var itemsOf = (groups) => groups.flatMap((g) => g.items);
|
|
3811
|
+
function CascadeMenu(props) {
|
|
3812
|
+
const {
|
|
3813
|
+
open,
|
|
3814
|
+
anchorRef,
|
|
3815
|
+
onClose,
|
|
3816
|
+
label,
|
|
3817
|
+
groups = [],
|
|
3818
|
+
optionsOf,
|
|
3819
|
+
onPick,
|
|
3820
|
+
filter = "auto",
|
|
3821
|
+
filterPlaceholder = "Filter",
|
|
3822
|
+
emptyText = "Nothing matches.",
|
|
3823
|
+
noOptionsText = "Nothing to choose here.",
|
|
3824
|
+
optionsLabel = "Options",
|
|
3825
|
+
backLabel = "Back",
|
|
3826
|
+
width = 520,
|
|
3827
|
+
stackBelow = 560,
|
|
3828
|
+
className,
|
|
3829
|
+
value
|
|
3830
|
+
} = props;
|
|
3831
|
+
const rootRef = (0, import_react23.useRef)(null);
|
|
3832
|
+
const [q, setQ] = (0, import_react23.useState)("");
|
|
3833
|
+
const [activeId, setActiveId] = (0, import_react23.useState)(null);
|
|
3834
|
+
const [stage, setStage] = (0, import_react23.useState)("items");
|
|
3835
|
+
const [stacked, setStacked] = (0, import_react23.useState)(false);
|
|
3836
|
+
const visible = (0, import_react23.useMemo)(() => {
|
|
3837
|
+
const needle = q.trim().toLowerCase();
|
|
3838
|
+
if (!needle) return groups.filter((g) => g.items.length > 0);
|
|
3839
|
+
return groups.map((g) => ({ ...g, items: g.items.filter((it) => String(it.label).toLowerCase().includes(needle)) })).filter((g) => g.items.length > 0);
|
|
3840
|
+
}, [groups, q]);
|
|
3841
|
+
const flat = (0, import_react23.useMemo)(() => itemsOf(visible), [visible]);
|
|
3842
|
+
const active = flat.find((it) => it.id === activeId) || flat[0] || null;
|
|
3843
|
+
const options = (0, import_react23.useMemo)(() => active && optionsOf ? optionsOf(active) : [], [active, optionsOf]);
|
|
3844
|
+
const showFilter = filter === true || filter === "auto" && itemsOf(groups).length > FILTER_PAST;
|
|
3845
|
+
(0, import_react23.useEffect)(() => {
|
|
3846
|
+
if (!open) return void 0;
|
|
3847
|
+
setQ("");
|
|
3848
|
+
setActiveId(value?.item ?? null);
|
|
3849
|
+
setStage("items");
|
|
3850
|
+
const measure = () => setStacked(window.innerWidth < stackBelow);
|
|
3851
|
+
measure();
|
|
3852
|
+
window.addEventListener("resize", measure);
|
|
3853
|
+
const raf = requestAnimationFrame(() => {
|
|
3854
|
+
const first = rootRef.current?.querySelector("input, button:not(:disabled)");
|
|
3855
|
+
first?.focus({ preventScroll: true });
|
|
3856
|
+
});
|
|
3857
|
+
const anchor = anchorRef?.current;
|
|
3858
|
+
return () => {
|
|
3859
|
+
window.removeEventListener("resize", measure);
|
|
3860
|
+
cancelAnimationFrame(raf);
|
|
3861
|
+
anchor?.focus?.({ preventScroll: true });
|
|
3862
|
+
};
|
|
3863
|
+
}, [open, stackBelow]);
|
|
3864
|
+
const focusIn = (0, import_react23.useCallback)((col, index = 0) => {
|
|
3865
|
+
const list = rootRef.current?.querySelectorAll(`.uic-cascade-${col} .uic-pop-item:not(:disabled)`);
|
|
3866
|
+
if (!list || !list.length) return false;
|
|
3867
|
+
const i = Math.max(0, Math.min(index, list.length - 1));
|
|
3868
|
+
list[i].focus({ preventScroll: true });
|
|
3869
|
+
return true;
|
|
3870
|
+
}, []);
|
|
3871
|
+
const enterOptions = (0, import_react23.useCallback)(() => {
|
|
3872
|
+
if (stacked) {
|
|
3873
|
+
setStage("options");
|
|
3874
|
+
requestAnimationFrame(() => focusIn("options"));
|
|
3875
|
+
} else focusIn("options");
|
|
3876
|
+
}, [stacked, focusIn]);
|
|
3877
|
+
const onKey2 = (e) => {
|
|
3878
|
+
const el = document.activeElement;
|
|
3879
|
+
const col = el?.closest?.(".uic-cascade-col");
|
|
3880
|
+
const inItems = col?.classList.contains("uic-cascade-items");
|
|
3881
|
+
const inOptions = col?.classList.contains("uic-cascade-options");
|
|
3882
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
3883
|
+
if (!col) return;
|
|
3884
|
+
const list = Array.from(col.querySelectorAll(".uic-pop-item:not(:disabled)"));
|
|
3885
|
+
const i = list.indexOf(el);
|
|
3886
|
+
const next = i < 0 ? 0 : i + (e.key === "ArrowDown" ? 1 : -1);
|
|
3887
|
+
if (next < 0) {
|
|
3888
|
+
col.querySelector("input")?.focus();
|
|
3889
|
+
e.preventDefault();
|
|
3890
|
+
return;
|
|
3891
|
+
}
|
|
3892
|
+
if (next >= list.length) return;
|
|
3893
|
+
e.preventDefault();
|
|
3894
|
+
list[next].focus({ preventScroll: true });
|
|
3895
|
+
} else if (e.key === "ArrowRight" && inItems) {
|
|
3896
|
+
e.preventDefault();
|
|
3897
|
+
enterOptions();
|
|
3898
|
+
} else if (e.key === "ArrowLeft" && inOptions) {
|
|
3899
|
+
e.preventDefault();
|
|
3900
|
+
if (stacked) {
|
|
3901
|
+
setStage("items");
|
|
3902
|
+
requestAnimationFrame(() => focusIn("items", flat.indexOf(active)));
|
|
3903
|
+
} else focusIn("items", flat.indexOf(active));
|
|
3904
|
+
} else if (e.key === "Enter" && el?.tagName === "INPUT") {
|
|
3905
|
+
e.preventDefault();
|
|
3906
|
+
enterOptions();
|
|
3907
|
+
}
|
|
3908
|
+
};
|
|
3909
|
+
const showItems = !stacked || stage === "items";
|
|
3910
|
+
const showOptions = !stacked || stage === "options";
|
|
3911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3912
|
+
Popover,
|
|
3913
|
+
{
|
|
3914
|
+
open,
|
|
3915
|
+
anchorRef,
|
|
3916
|
+
onClose,
|
|
3917
|
+
label,
|
|
3918
|
+
width: stacked ? 320 : width,
|
|
3919
|
+
minHeight: 260,
|
|
3920
|
+
className: ["uic-cascade-pop", className || ""].filter(Boolean).join(" "),
|
|
3921
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { ref: rootRef, className: "uic-cascade" + (stacked ? " is-stacked" : ""), onKeyDown: onKey2, children: [
|
|
3922
|
+
showItems && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "uic-cascade-col uic-cascade-items", children: [
|
|
3923
|
+
showFilter ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SearchField, { className: "uic-cascade-filter", value: q, onChange: setQ, placeholder: filterPlaceholder }) : null,
|
|
3924
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "uic-pop-list", children: [
|
|
3925
|
+
visible.map((g, gi) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react23.Fragment, { children: [
|
|
3926
|
+
g.label ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uic-cascade-group", children: g.label }) : null,
|
|
3927
|
+
g.items.map((it) => {
|
|
3928
|
+
const on = active?.id === it.id;
|
|
3929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3930
|
+
"button",
|
|
3931
|
+
{
|
|
3932
|
+
type: "button",
|
|
3933
|
+
className: "uic-pop-item uic-cascade-item" + (on ? " is-active" : ""),
|
|
3934
|
+
"aria-expanded": on,
|
|
3935
|
+
"aria-haspopup": "true",
|
|
3936
|
+
onFocus: () => setActiveId(it.id),
|
|
3937
|
+
onClick: () => {
|
|
3938
|
+
setActiveId(it.id);
|
|
3939
|
+
enterOptions();
|
|
3940
|
+
},
|
|
3941
|
+
children: [
|
|
3942
|
+
it.icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: it.icon }) : null,
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-chip-t", children: it.label }),
|
|
3944
|
+
it.note ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-cascade-note", children: it.note }) : null,
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-cascade-chev", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Chevron, { dir: "right", size: 14 }) })
|
|
3946
|
+
]
|
|
3947
|
+
},
|
|
3948
|
+
it.id
|
|
3949
|
+
);
|
|
3950
|
+
})
|
|
3951
|
+
] }, g.label || gi)),
|
|
3952
|
+
flat.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uic-pop-note", children: emptyText }) : null
|
|
3953
|
+
] })
|
|
3954
|
+
] }),
|
|
3955
|
+
showOptions && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "uic-cascade-col uic-cascade-options", role: "group", "aria-label": optionsLabel, children: [
|
|
3956
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "uic-cascade-head", children: [
|
|
3957
|
+
stacked ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3958
|
+
"button",
|
|
3959
|
+
{
|
|
3960
|
+
type: "button",
|
|
3961
|
+
className: "uic-cascade-back",
|
|
3962
|
+
"aria-label": backLabel,
|
|
3963
|
+
onClick: () => {
|
|
3964
|
+
setStage("items");
|
|
3965
|
+
requestAnimationFrame(() => focusIn("items", flat.indexOf(active)));
|
|
3966
|
+
},
|
|
3967
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Chevron, { dir: "left", size: 14 })
|
|
3968
|
+
}
|
|
3969
|
+
) : null,
|
|
3970
|
+
active?.icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: active.icon }) : null,
|
|
3971
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-chip-t", children: active ? active.label : "" })
|
|
3972
|
+
] }),
|
|
3973
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "uic-pop-list", children: [
|
|
3974
|
+
options.map((o) => {
|
|
3975
|
+
const on = !!value && active?.id === value.item && o.id === value.option;
|
|
3976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3977
|
+
"button",
|
|
3978
|
+
{
|
|
3979
|
+
type: "button",
|
|
3980
|
+
className: "uic-pop-item uic-cascade-opt" + (on ? " is-on" : ""),
|
|
3981
|
+
"aria-current": on ? "true" : void 0,
|
|
3982
|
+
disabled: !!o.disabled,
|
|
3983
|
+
onClick: () => onPick?.(active, o),
|
|
3984
|
+
children: [
|
|
3985
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-pop-check", "aria-hidden": "true", children: on ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Tick, {}) : null }) : null,
|
|
3986
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-chip-t", children: o.label }),
|
|
3987
|
+
o.note ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-cascade-note", children: o.note }) : null
|
|
3988
|
+
]
|
|
3989
|
+
},
|
|
3990
|
+
o.id
|
|
3991
|
+
);
|
|
3992
|
+
}),
|
|
3993
|
+
active && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uic-pop-note", children: noOptionsText }) : null
|
|
3994
|
+
] })
|
|
3995
|
+
] })
|
|
3996
|
+
] })
|
|
3997
|
+
}
|
|
3998
|
+
);
|
|
3999
|
+
}
|
|
4000
|
+
|
|
4001
|
+
// src/components/Modal.jsx
|
|
4002
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
4003
|
+
var import_react_dom4 = require("react-dom");
|
|
4004
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3710
4005
|
function Modal(props) {
|
|
3711
4006
|
const {
|
|
3712
4007
|
open,
|
|
@@ -3720,10 +4015,10 @@ function Modal(props) {
|
|
|
3720
4015
|
children,
|
|
3721
4016
|
classNames = {}
|
|
3722
4017
|
} = props;
|
|
3723
|
-
const titleId = (0,
|
|
3724
|
-
const escape = (0,
|
|
4018
|
+
const titleId = (0, import_react24.useId)();
|
|
4019
|
+
const escape = (0, import_react24.useCallback)(() => onClose?.(), [onClose]);
|
|
3725
4020
|
useOverlayEscape(open, escape);
|
|
3726
|
-
(0,
|
|
4021
|
+
(0, import_react24.useEffect)(() => {
|
|
3727
4022
|
if (!open || typeof document === "undefined") return void 0;
|
|
3728
4023
|
const prev = document.body.style.overflow;
|
|
3729
4024
|
document.body.style.overflow = "hidden";
|
|
@@ -3736,12 +4031,12 @@ function Modal(props) {
|
|
|
3736
4031
|
if (e.target === e.currentTarget) onClose?.();
|
|
3737
4032
|
};
|
|
3738
4033
|
return (0, import_react_dom4.createPortal)(
|
|
3739
|
-
/* @__PURE__ */ (0,
|
|
4034
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3740
4035
|
"div",
|
|
3741
4036
|
{
|
|
3742
4037
|
className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
|
|
3743
4038
|
onMouseDown: onBackdrop,
|
|
3744
|
-
children: /* @__PURE__ */ (0,
|
|
4039
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3745
4040
|
"div",
|
|
3746
4041
|
{
|
|
3747
4042
|
className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
|
|
@@ -3750,15 +4045,15 @@ function Modal(props) {
|
|
|
3750
4045
|
"aria-modal": "true",
|
|
3751
4046
|
"aria-labelledby": labelledBy || (title ? titleId : void 0),
|
|
3752
4047
|
children: [
|
|
3753
|
-
title || actions ? /* @__PURE__ */ (0,
|
|
3754
|
-
/* @__PURE__ */ (0,
|
|
3755
|
-
title ? /* @__PURE__ */ (0,
|
|
3756
|
-
description ? /* @__PURE__ */ (0,
|
|
4048
|
+
title || actions ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "uic-modal-h", children: [
|
|
4049
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "uic-modal-title", children: [
|
|
4050
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { id: titleId, children: title }) : null,
|
|
4051
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: description }) : null
|
|
3757
4052
|
] }),
|
|
3758
4053
|
actions,
|
|
3759
|
-
/* @__PURE__ */ (0,
|
|
4054
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IcX, { size: 18 }) })
|
|
3760
4055
|
] }) : null,
|
|
3761
|
-
/* @__PURE__ */ (0,
|
|
4056
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
|
|
3762
4057
|
]
|
|
3763
4058
|
}
|
|
3764
4059
|
)
|
|
@@ -3769,15 +4064,15 @@ function Modal(props) {
|
|
|
3769
4064
|
}
|
|
3770
4065
|
|
|
3771
4066
|
// src/hooks/useTypewriter.js
|
|
3772
|
-
var
|
|
4067
|
+
var import_react25 = require("react");
|
|
3773
4068
|
var CHAR_MS = 26;
|
|
3774
4069
|
var HOLD_MS = 2600;
|
|
3775
4070
|
function useTypewriter(phrases, { active = true } = {}) {
|
|
3776
4071
|
const list = phrases && phrases.length ? phrases : [""];
|
|
3777
|
-
const [text, setText] = (0,
|
|
3778
|
-
const listRef = (0,
|
|
4072
|
+
const [text, setText] = (0, import_react25.useState)(list[0]);
|
|
4073
|
+
const listRef = (0, import_react25.useRef)(list);
|
|
3779
4074
|
listRef.current = list;
|
|
3780
|
-
(0,
|
|
4075
|
+
(0, import_react25.useEffect)(() => {
|
|
3781
4076
|
if (!active) return void 0;
|
|
3782
4077
|
if (typeof window === "undefined") return void 0;
|
|
3783
4078
|
if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
|
|
@@ -3808,7 +4103,7 @@ function useTypewriter(phrases, { active = true } = {}) {
|
|
|
3808
4103
|
}
|
|
3809
4104
|
|
|
3810
4105
|
// src/components/Panel.jsx
|
|
3811
|
-
var
|
|
4106
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3812
4107
|
function Panel(props) {
|
|
3813
4108
|
const {
|
|
3814
4109
|
title,
|
|
@@ -3830,43 +4125,43 @@ function Panel(props) {
|
|
|
3830
4125
|
classNames = {},
|
|
3831
4126
|
children
|
|
3832
4127
|
} = props;
|
|
3833
|
-
const body = loading ? /* @__PURE__ */ (0,
|
|
3834
|
-
/* @__PURE__ */ (0,
|
|
3835
|
-
/* @__PURE__ */ (0,
|
|
3836
|
-
/* @__PURE__ */ (0,
|
|
3837
|
-
/* @__PURE__ */ (0,
|
|
3838
|
-
] }) : error ? /* @__PURE__ */ (0,
|
|
3839
|
-
/* @__PURE__ */ (0,
|
|
3840
|
-
/* @__PURE__ */ (0,
|
|
3841
|
-
errorDetail ? /* @__PURE__ */ (0,
|
|
3842
|
-
/* @__PURE__ */ (0,
|
|
3843
|
-
/* @__PURE__ */ (0,
|
|
4128
|
+
const body = loading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uic-panel-load", children: [
|
|
4129
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-panel-load-bar" }),
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-panel-load-bar" }),
|
|
4131
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-panel-load-bar" }),
|
|
4132
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-sr", children: loadingLabel })
|
|
4133
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uic-panel-fail", children: [
|
|
4134
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "uic-panel-fail-t", children: errorTitle }),
|
|
4135
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("pre", { className: "uic-panel-fail-m", children: error }),
|
|
4136
|
+
errorDetail ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("details", { className: "uic-panel-fail-d", children: [
|
|
4137
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("summary", { children: detailLabel }),
|
|
4138
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uic-panel-fail-dd", children: errorDetail })
|
|
3844
4139
|
] }) : null,
|
|
3845
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
4140
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uic-panel-fail-act", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { size: "sm", onClick: onRetry, children: retryLabel }) }) : null
|
|
3846
4141
|
] }) : children;
|
|
3847
|
-
return /* @__PURE__ */ (0,
|
|
4142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3848
4143
|
"section",
|
|
3849
4144
|
{
|
|
3850
4145
|
className: ["uic-panel", className, classNames.root || ""].filter(Boolean).join(" "),
|
|
3851
4146
|
"aria-busy": loading || busy || void 0,
|
|
3852
4147
|
children: [
|
|
3853
|
-
/* @__PURE__ */ (0,
|
|
3854
|
-
/* @__PURE__ */ (0,
|
|
3855
|
-
title ? /* @__PURE__ */ (0,
|
|
3856
|
-
meta ? /* @__PURE__ */ (0,
|
|
4148
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("header", { className: ["uic-panel-head", classNames.head || ""].filter(Boolean).join(" "), children: [
|
|
4149
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uic-panel-titles", children: [
|
|
4150
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Heading, { className: "uic-panel-title", children: title }) : null,
|
|
4151
|
+
meta ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "uic-panel-meta", children: meta }) : null
|
|
3857
4152
|
] }),
|
|
3858
|
-
actions ? /* @__PURE__ */ (0,
|
|
4153
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uic-panel-acts", children: actions }) : null
|
|
3859
4154
|
] }),
|
|
3860
|
-
busy ? /* @__PURE__ */ (0,
|
|
3861
|
-
/* @__PURE__ */ (0,
|
|
3862
|
-
footer ? /* @__PURE__ */ (0,
|
|
4155
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uic-panel-busy", role: "status", "aria-label": busyLabel }) : null,
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: ["uic-panel-body", classNames.body || ""].filter(Boolean).join(" "), children: body }),
|
|
4157
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("footer", { className: "uic-panel-foot", children: footer }) : null
|
|
3863
4158
|
]
|
|
3864
4159
|
}
|
|
3865
4160
|
);
|
|
3866
4161
|
}
|
|
3867
4162
|
|
|
3868
4163
|
// src/grid/PanelGrid.jsx
|
|
3869
|
-
var
|
|
4164
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
3870
4165
|
|
|
3871
4166
|
// src/grid/layout.js
|
|
3872
4167
|
function sortLayout(layout2) {
|
|
@@ -3939,11 +4234,11 @@ function sameLayout(a, b) {
|
|
|
3939
4234
|
}
|
|
3940
4235
|
|
|
3941
4236
|
// src/grid/PanelGrid.jsx
|
|
3942
|
-
var
|
|
4237
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3943
4238
|
function useMeasuredWidth() {
|
|
3944
|
-
const ref = (0,
|
|
3945
|
-
const [width, setWidth] = (0,
|
|
3946
|
-
(0,
|
|
4239
|
+
const ref = (0, import_react26.useRef)(null);
|
|
4240
|
+
const [width, setWidth] = (0, import_react26.useState)(0);
|
|
4241
|
+
(0, import_react26.useLayoutEffect)(() => {
|
|
3947
4242
|
const el = ref.current;
|
|
3948
4243
|
if (!el) return void 0;
|
|
3949
4244
|
const measure = () => setWidth(el.clientWidth);
|
|
@@ -3970,9 +4265,9 @@ function PanelGrid(props) {
|
|
|
3970
4265
|
className = ""
|
|
3971
4266
|
} = props;
|
|
3972
4267
|
const [wrapRef, width] = useMeasuredWidth();
|
|
3973
|
-
const [drag, setDrag] = (0,
|
|
3974
|
-
const dragRef = (0,
|
|
3975
|
-
const swallowClick = (0,
|
|
4268
|
+
const [drag, setDrag] = (0, import_react26.useState)(null);
|
|
4269
|
+
const dragRef = (0, import_react26.useRef)(null);
|
|
4270
|
+
const swallowClick = (0, import_react26.useRef)(false);
|
|
3976
4271
|
const stacked = width > 0 && width < stackAt;
|
|
3977
4272
|
const arrangeable = editable && !stacked;
|
|
3978
4273
|
const live = drag ? drag.preview : layout2;
|
|
@@ -3980,7 +4275,7 @@ function PanelGrid(props) {
|
|
|
3980
4275
|
const cellW = colW + gap;
|
|
3981
4276
|
const cellH = rowHeight + gap;
|
|
3982
4277
|
const rowsToPx = (h) => h * rowHeight + (h - 1) * gap;
|
|
3983
|
-
const stack2 = (0,
|
|
4278
|
+
const stack2 = (0, import_react26.useMemo)(() => {
|
|
3984
4279
|
if (!stacked) return null;
|
|
3985
4280
|
const tops = /* @__PURE__ */ new Map();
|
|
3986
4281
|
let y = 0;
|
|
@@ -3992,11 +4287,11 @@ function PanelGrid(props) {
|
|
|
3992
4287
|
}, [stacked, live, rowHeight, gap]);
|
|
3993
4288
|
const rows = layoutRows(live);
|
|
3994
4289
|
const height = stacked ? stack2.height : rows ? rowsToPx(rows) : 0;
|
|
3995
|
-
const commit = (0,
|
|
4290
|
+
const commit = (0, import_react26.useCallback)((next) => {
|
|
3996
4291
|
if (onLayoutChange && !sameLayout(next, layout2)) onLayoutChange(next);
|
|
3997
4292
|
}, [onLayoutChange, layout2]);
|
|
3998
|
-
const detach = (0,
|
|
3999
|
-
(0,
|
|
4293
|
+
const detach = (0, import_react26.useRef)(null);
|
|
4294
|
+
(0, import_react26.useEffect)(() => () => detach.current?.(), []);
|
|
4000
4295
|
const start = (id, mode) => (e) => {
|
|
4001
4296
|
if (!arrangeable || e.button !== 0) return;
|
|
4002
4297
|
const item = layout2.find((it) => it.i === id);
|
|
@@ -4061,7 +4356,7 @@ function PanelGrid(props) {
|
|
|
4061
4356
|
const byId = new Map(live.map((it) => [it.i, it]));
|
|
4062
4357
|
const ghost = drag && drag.mode === "move" && byId.has(drag.id) ? boxOf(byId.get(drag.id)) : null;
|
|
4063
4358
|
const cls = ["uic-pg", arrangeable ? "is-editable" : "", stacked ? "is-stacked" : "", className].filter(Boolean).join(" ");
|
|
4064
|
-
return /* @__PURE__ */ (0,
|
|
4359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4065
4360
|
"div",
|
|
4066
4361
|
{
|
|
4067
4362
|
ref: wrapRef,
|
|
@@ -4072,15 +4367,15 @@ function PanelGrid(props) {
|
|
|
4072
4367
|
swallowClick.current = false;
|
|
4073
4368
|
},
|
|
4074
4369
|
children: [
|
|
4075
|
-
ghost ? /* @__PURE__ */ (0,
|
|
4076
|
-
width > 0 &&
|
|
4077
|
-
if (!
|
|
4370
|
+
ghost ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "uic-pg-ghost", "aria-hidden": "true", style: ghost }) : null,
|
|
4371
|
+
width > 0 && import_react26.default.Children.map(children, (child) => {
|
|
4372
|
+
if (!import_react26.default.isValidElement(child) || child.key == null) return null;
|
|
4078
4373
|
const id = String(child.key).replace(/^\.\$/, "");
|
|
4079
4374
|
const it = byId.get(id);
|
|
4080
4375
|
if (!it) return null;
|
|
4081
4376
|
const moving = drag && drag.id === id;
|
|
4082
4377
|
const offset = moving && drag.mode === "move" ? { transform: `translate(${drag.dx}px, ${drag.dy}px)` } : null;
|
|
4083
|
-
return /* @__PURE__ */ (0,
|
|
4378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4084
4379
|
"div",
|
|
4085
4380
|
{
|
|
4086
4381
|
className: "uic-pg-item" + (moving ? " is-moving" : ""),
|
|
@@ -4088,7 +4383,7 @@ function PanelGrid(props) {
|
|
|
4088
4383
|
onPointerDown: arrangeable ? start(id, "move") : void 0,
|
|
4089
4384
|
children: [
|
|
4090
4385
|
child,
|
|
4091
|
-
arrangeable && !it.static ? /* @__PURE__ */ (0,
|
|
4386
|
+
arrangeable && !it.static ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4092
4387
|
"button",
|
|
4093
4388
|
{
|
|
4094
4389
|
type: "button",
|
|
@@ -4096,7 +4391,7 @@ function PanelGrid(props) {
|
|
|
4096
4391
|
"aria-label": resizeLabel ? resizeLabel(id) : "Resize panel. Arrow keys resize it; shift with arrow keys moves it past its neighbours.",
|
|
4097
4392
|
onPointerDown: start(id, "resize"),
|
|
4098
4393
|
onKeyDown: onHandleKey(id),
|
|
4099
|
-
children: /* @__PURE__ */ (0,
|
|
4394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M9 1v8H1", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) })
|
|
4100
4395
|
}
|
|
4101
4396
|
) : null
|
|
4102
4397
|
]
|
|
@@ -4113,8 +4408,8 @@ function packLayout(layout2, cols = 12) {
|
|
|
4113
4408
|
}
|
|
4114
4409
|
|
|
4115
4410
|
// src/timeline/Timeline.jsx
|
|
4116
|
-
var
|
|
4117
|
-
var
|
|
4411
|
+
var import_react27 = require("react");
|
|
4412
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4118
4413
|
var TL_MIN_PPS = 4;
|
|
4119
4414
|
var TL_MAX_PPS = 400;
|
|
4120
4415
|
var TL_DEFAULT_PPS = 26;
|
|
@@ -4203,21 +4498,21 @@ function Timeline({
|
|
|
4203
4498
|
emptyLabel = "Nothing here yet.",
|
|
4204
4499
|
className = ""
|
|
4205
4500
|
}) {
|
|
4206
|
-
const scroller = (0,
|
|
4207
|
-
const innerRef = (0,
|
|
4208
|
-
const [pps, setPps] = (0,
|
|
4501
|
+
const scroller = (0, import_react27.useRef)(null);
|
|
4502
|
+
const innerRef = (0, import_react27.useRef)(null);
|
|
4503
|
+
const [pps, setPps] = (0, import_react27.useState)(() => {
|
|
4209
4504
|
if (zoomStorageKey && typeof window !== "undefined") {
|
|
4210
4505
|
const n = parseFloat(window.localStorage.getItem(zoomStorageKey) || "");
|
|
4211
4506
|
if (Number.isFinite(n)) return clamp(n, TL_MIN_PPS, TL_MAX_PPS);
|
|
4212
4507
|
}
|
|
4213
4508
|
return TL_DEFAULT_PPS;
|
|
4214
4509
|
});
|
|
4215
|
-
const [snapping, setSnapping] = (0,
|
|
4216
|
-
const gesture = (0,
|
|
4217
|
-
const [drag, setDrag] = (0,
|
|
4218
|
-
const anchor = (0,
|
|
4219
|
-
const [dropAt, setDropAt] = (0,
|
|
4220
|
-
const rows = (0,
|
|
4510
|
+
const [snapping, setSnapping] = (0, import_react27.useState)(() => snapStorageKey && typeof window !== "undefined" ? window.localStorage.getItem(snapStorageKey) !== "0" : true);
|
|
4511
|
+
const gesture = (0, import_react27.useRef)(null);
|
|
4512
|
+
const [drag, setDrag] = (0, import_react27.useState)(null);
|
|
4513
|
+
const anchor = (0, import_react27.useRef)(null);
|
|
4514
|
+
const [dropAt, setDropAt] = (0, import_react27.useState)(null);
|
|
4515
|
+
const rows = (0, import_react27.useMemo)(
|
|
4221
4516
|
() => tracks.map((t) => ({
|
|
4222
4517
|
...t,
|
|
4223
4518
|
sequential: t.sequential !== false,
|
|
@@ -4225,12 +4520,12 @@ function Timeline({
|
|
|
4225
4520
|
})),
|
|
4226
4521
|
[tracks, pps]
|
|
4227
4522
|
);
|
|
4228
|
-
const contentSeconds = (0,
|
|
4523
|
+
const contentSeconds = (0, import_react27.useMemo)(() => {
|
|
4229
4524
|
let end = 0;
|
|
4230
4525
|
for (const t of rows) for (const l of t.laid) end = Math.max(end, l.t0 + l.w / pps);
|
|
4231
4526
|
return end;
|
|
4232
4527
|
}, [rows, pps]);
|
|
4233
|
-
const snapTimes = (0,
|
|
4528
|
+
const snapTimes = (0, import_react27.useMemo)(() => {
|
|
4234
4529
|
const out = [0, currentTime];
|
|
4235
4530
|
for (const t of rows) for (const l of t.laid) {
|
|
4236
4531
|
out.push(l.t0);
|
|
@@ -4238,7 +4533,7 @@ function Timeline({
|
|
|
4238
4533
|
}
|
|
4239
4534
|
return out;
|
|
4240
4535
|
}, [rows, pps, currentTime]);
|
|
4241
|
-
const setZoom = (0,
|
|
4536
|
+
const setZoom = (0, import_react27.useCallback)((next, clientX) => {
|
|
4242
4537
|
const v = clamp(next, TL_MIN_PPS, TL_MAX_PPS);
|
|
4243
4538
|
const el = scroller.current;
|
|
4244
4539
|
if (el) {
|
|
@@ -4254,21 +4549,21 @@ function Timeline({
|
|
|
4254
4549
|
}
|
|
4255
4550
|
}
|
|
4256
4551
|
}, [pps, zoomStorageKey]);
|
|
4257
|
-
const fitPps = (0,
|
|
4552
|
+
const fitPps = (0, import_react27.useCallback)((seconds) => {
|
|
4258
4553
|
const el = scroller.current;
|
|
4259
4554
|
if (!el || !(seconds > 0)) return null;
|
|
4260
4555
|
const room = el.clientWidth - TL_HEAD_W - 56;
|
|
4261
4556
|
return room > 0 ? clamp(room / seconds, TL_MIN_PPS, TL_MAX_PPS) : null;
|
|
4262
4557
|
}, []);
|
|
4263
|
-
const fit = (0,
|
|
4558
|
+
const fit = (0, import_react27.useCallback)(() => {
|
|
4264
4559
|
const v = fitPps(contentSeconds);
|
|
4265
4560
|
if (v !== null) {
|
|
4266
4561
|
setPps(v);
|
|
4267
4562
|
if (scroller.current) scroller.current.scrollLeft = 0;
|
|
4268
4563
|
}
|
|
4269
4564
|
}, [fitPps, contentSeconds]);
|
|
4270
|
-
const fitted = (0,
|
|
4271
|
-
(0,
|
|
4565
|
+
const fitted = (0, import_react27.useRef)(false);
|
|
4566
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
4272
4567
|
if (fitted.current || !(contentSeconds > 0)) return;
|
|
4273
4568
|
if (zoomStorageKey && typeof window !== "undefined" && window.localStorage.getItem(zoomStorageKey)) {
|
|
4274
4569
|
fitted.current = true;
|
|
@@ -4280,13 +4575,13 @@ function Timeline({
|
|
|
4280
4575
|
setPps(v);
|
|
4281
4576
|
}
|
|
4282
4577
|
}, [contentSeconds, fitPps, zoomStorageKey]);
|
|
4283
|
-
(0,
|
|
4578
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
4284
4579
|
const a = anchor.current;
|
|
4285
4580
|
if (!a || !scroller.current) return;
|
|
4286
4581
|
anchor.current = null;
|
|
4287
4582
|
scroller.current.scrollLeft = Math.max(0, TL_HEAD_W + a.t * pps - a.vx);
|
|
4288
4583
|
}, [pps]);
|
|
4289
|
-
(0,
|
|
4584
|
+
(0, import_react27.useEffect)(() => {
|
|
4290
4585
|
const el = scroller.current;
|
|
4291
4586
|
if (!el) return void 0;
|
|
4292
4587
|
const onWheel = (e) => {
|
|
@@ -4297,12 +4592,12 @@ function Timeline({
|
|
|
4297
4592
|
el.addEventListener("wheel", onWheel, { passive: false });
|
|
4298
4593
|
return () => el.removeEventListener("wheel", onWheel);
|
|
4299
4594
|
}, [pps, setZoom]);
|
|
4300
|
-
const timeAt = (0,
|
|
4595
|
+
const timeAt = (0, import_react27.useCallback)((clientX) => {
|
|
4301
4596
|
const el = innerRef.current;
|
|
4302
4597
|
if (!el) return 0;
|
|
4303
4598
|
return Math.max(0, (clientX - el.getBoundingClientRect().left - TL_HEAD_W) / pps);
|
|
4304
4599
|
}, [pps]);
|
|
4305
|
-
const beginGesture = (0,
|
|
4600
|
+
const beginGesture = (0, import_react27.useCallback)((e, spec) => {
|
|
4306
4601
|
e.preventDefault();
|
|
4307
4602
|
e.stopPropagation();
|
|
4308
4603
|
gesture.current = { ...spec, startX: e.clientX, active: false, value: null };
|
|
@@ -4336,12 +4631,12 @@ function Timeline({
|
|
|
4336
4631
|
window.addEventListener("pointermove", move);
|
|
4337
4632
|
window.addEventListener("pointerup", up);
|
|
4338
4633
|
}, [timeAt, snapping, snapTimes, pps, onSeek]);
|
|
4339
|
-
const onScrub = (0,
|
|
4634
|
+
const onScrub = (0, import_react27.useCallback)((e) => {
|
|
4340
4635
|
if (!onSeek) return;
|
|
4341
4636
|
onSeek(timeAt(e.clientX));
|
|
4342
4637
|
beginGesture(e, { kind: "scrub" });
|
|
4343
4638
|
}, [onSeek, timeAt, beginGesture]);
|
|
4344
|
-
const splitTarget = (0,
|
|
4639
|
+
const splitTarget = (0, import_react27.useMemo)(() => {
|
|
4345
4640
|
if (!onSplit) return null;
|
|
4346
4641
|
for (const track of rows) {
|
|
4347
4642
|
for (const l of track.laid) {
|
|
@@ -4353,17 +4648,17 @@ function Timeline({
|
|
|
4353
4648
|
}
|
|
4354
4649
|
return null;
|
|
4355
4650
|
}, [rows, currentTime, onSplit]);
|
|
4356
|
-
const doSplit = (0,
|
|
4651
|
+
const doSplit = (0, import_react27.useCallback)(() => {
|
|
4357
4652
|
if (!splitTarget) return;
|
|
4358
4653
|
onSplit(splitTarget.l.clip, currentTime - splitTarget.l.t0, splitTarget.track);
|
|
4359
4654
|
}, [splitTarget, currentTime, onSplit]);
|
|
4360
|
-
const selected = (0,
|
|
4655
|
+
const selected = (0, import_react27.useMemo)(() => {
|
|
4361
4656
|
for (const track of rows) for (const l of track.laid) {
|
|
4362
4657
|
if (l.clip.id === selectedClipId) return { track, l };
|
|
4363
4658
|
}
|
|
4364
4659
|
return null;
|
|
4365
4660
|
}, [rows, selectedClipId]);
|
|
4366
|
-
const onKeyDown = (0,
|
|
4661
|
+
const onKeyDown = (0, import_react27.useCallback)((e) => {
|
|
4367
4662
|
const tag = e.target?.tagName;
|
|
4368
4663
|
if (tag === "INPUT" || tag === "TEXTAREA" || e.target?.isContentEditable) return;
|
|
4369
4664
|
if (e.key === "+" || e.key === "=") {
|
|
@@ -4380,7 +4675,7 @@ function Timeline({
|
|
|
4380
4675
|
onDeleteClip(selected.l.clip, selected.track);
|
|
4381
4676
|
}
|
|
4382
4677
|
}, [pps, setZoom, doSplit, selected, onDeleteClip]);
|
|
4383
|
-
const toggleSnap = (0,
|
|
4678
|
+
const toggleSnap = (0, import_react27.useCallback)(() => {
|
|
4384
4679
|
setSnapping((v) => {
|
|
4385
4680
|
const next = !v;
|
|
4386
4681
|
if (snapStorageKey && typeof window !== "undefined") {
|
|
@@ -4397,9 +4692,9 @@ function Timeline({
|
|
|
4397
4692
|
const laneW = Math.max(contentSeconds * pps + 140, 320);
|
|
4398
4693
|
const ticks = [];
|
|
4399
4694
|
for (let t = 0; t <= contentSeconds + major; t += major) ticks.push(t);
|
|
4400
|
-
return /* @__PURE__ */ (0,
|
|
4401
|
-
/* @__PURE__ */ (0,
|
|
4402
|
-
onSplit && /* @__PURE__ */ (0,
|
|
4695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `rui-tl ${className}`, onKeyDown, tabIndex: 0, children: [
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rui-tl-bar", children: [
|
|
4697
|
+
onSplit && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4403
4698
|
"button",
|
|
4404
4699
|
{
|
|
4405
4700
|
type: "button",
|
|
@@ -4408,7 +4703,7 @@ function Timeline({
|
|
|
4408
4703
|
disabled: !splitTarget,
|
|
4409
4704
|
title: splitTarget ? "Split at the playhead (B)" : "Move the playhead inside a clip to split it",
|
|
4410
4705
|
children: [
|
|
4411
|
-
/* @__PURE__ */ (0,
|
|
4706
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4412
4707
|
"svg",
|
|
4413
4708
|
{
|
|
4414
4709
|
width: "13",
|
|
@@ -4420,19 +4715,19 @@ function Timeline({
|
|
|
4420
4715
|
strokeLinecap: "round",
|
|
4421
4716
|
"aria-hidden": "true",
|
|
4422
4717
|
children: [
|
|
4423
|
-
/* @__PURE__ */ (0,
|
|
4424
|
-
/* @__PURE__ */ (0,
|
|
4425
|
-
/* @__PURE__ */ (0,
|
|
4426
|
-
/* @__PURE__ */ (0,
|
|
4427
|
-
/* @__PURE__ */ (0,
|
|
4718
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("circle", { cx: "6", cy: "6", r: "3" }),
|
|
4719
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("circle", { cx: "6", cy: "18", r: "3" }),
|
|
4720
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("line", { x1: "20", y1: "4", x2: "8.12", y2: "15.88" }),
|
|
4721
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("line", { x1: "14.47", y1: "14.48", x2: "20", y2: "20" }),
|
|
4722
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("line", { x1: "8.12", y1: "8.12", x2: "12", y2: "12" })
|
|
4428
4723
|
]
|
|
4429
4724
|
}
|
|
4430
4725
|
),
|
|
4431
|
-
/* @__PURE__ */ (0,
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Split" })
|
|
4432
4727
|
]
|
|
4433
4728
|
}
|
|
4434
4729
|
),
|
|
4435
|
-
onDeleteClip && /* @__PURE__ */ (0,
|
|
4730
|
+
onDeleteClip && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4436
4731
|
"button",
|
|
4437
4732
|
{
|
|
4438
4733
|
type: "button",
|
|
@@ -4443,7 +4738,7 @@ function Timeline({
|
|
|
4443
4738
|
children: "Remove"
|
|
4444
4739
|
}
|
|
4445
4740
|
),
|
|
4446
|
-
/* @__PURE__ */ (0,
|
|
4741
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4447
4742
|
"button",
|
|
4448
4743
|
{
|
|
4449
4744
|
type: "button",
|
|
@@ -4454,9 +4749,9 @@ function Timeline({
|
|
|
4454
4749
|
children: "Snap"
|
|
4455
4750
|
}
|
|
4456
4751
|
),
|
|
4457
|
-
/* @__PURE__ */ (0,
|
|
4458
|
-
/* @__PURE__ */ (0,
|
|
4459
|
-
/* @__PURE__ */ (0,
|
|
4752
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-time", "aria-label": "Playhead position", children: exactLabel(currentTime) }),
|
|
4753
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-spacer" }),
|
|
4754
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4460
4755
|
"button",
|
|
4461
4756
|
{
|
|
4462
4757
|
type: "button",
|
|
@@ -4468,7 +4763,7 @@ function Timeline({
|
|
|
4468
4763
|
children: "\u2212"
|
|
4469
4764
|
}
|
|
4470
4765
|
),
|
|
4471
|
-
/* @__PURE__ */ (0,
|
|
4766
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4472
4767
|
"button",
|
|
4473
4768
|
{
|
|
4474
4769
|
type: "button",
|
|
@@ -4480,7 +4775,7 @@ function Timeline({
|
|
|
4480
4775
|
children: "+"
|
|
4481
4776
|
}
|
|
4482
4777
|
),
|
|
4483
|
-
/* @__PURE__ */ (0,
|
|
4778
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4484
4779
|
"button",
|
|
4485
4780
|
{
|
|
4486
4781
|
type: "button",
|
|
@@ -4492,10 +4787,10 @@ function Timeline({
|
|
|
4492
4787
|
}
|
|
4493
4788
|
)
|
|
4494
4789
|
] }),
|
|
4495
|
-
/* @__PURE__ */ (0,
|
|
4496
|
-
/* @__PURE__ */ (0,
|
|
4497
|
-
/* @__PURE__ */ (0,
|
|
4498
|
-
/* @__PURE__ */ (0,
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rui-tl-scroll", ref: scroller, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rui-tl-inner", ref: innerRef, style: { width: TL_HEAD_W + laneW }, children: [
|
|
4791
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rui-tl-row rui-tl-rulerrow", children: [
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rui-tl-head rui-tl-rulerhead", "aria-hidden": "true" }),
|
|
4793
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4499
4794
|
"div",
|
|
4500
4795
|
{
|
|
4501
4796
|
className: "rui-tl-ruler",
|
|
@@ -4524,17 +4819,17 @@ function Timeline({
|
|
|
4524
4819
|
onSeek(currentTime + step);
|
|
4525
4820
|
}
|
|
4526
4821
|
} : void 0,
|
|
4527
|
-
children: ticks.map((t) => /* @__PURE__ */ (0,
|
|
4822
|
+
children: ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-ticklbl", style: { left: t * pps }, children: tickLabel(t, major) }, t))
|
|
4528
4823
|
}
|
|
4529
4824
|
)
|
|
4530
4825
|
] }),
|
|
4531
|
-
rows.length === 0 && /* @__PURE__ */ (0,
|
|
4532
|
-
rows.map((track) => /* @__PURE__ */ (0,
|
|
4533
|
-
/* @__PURE__ */ (0,
|
|
4826
|
+
rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "rui-tl-empty", children: emptyLabel }),
|
|
4827
|
+
rows.map((track) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rui-tl-row", children: [
|
|
4828
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rui-tl-head", title: track.title || track.label, children: [
|
|
4534
4829
|
track.icon,
|
|
4535
|
-
/* @__PURE__ */ (0,
|
|
4830
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-headlbl", children: track.label })
|
|
4536
4831
|
] }),
|
|
4537
|
-
/* @__PURE__ */ (0,
|
|
4832
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4538
4833
|
"div",
|
|
4539
4834
|
{
|
|
4540
4835
|
className: "rui-tl-lane" + (dropAt?.trackId === track.id ? " is-dropping" : ""),
|
|
@@ -4565,8 +4860,8 @@ function Timeline({
|
|
|
4565
4860
|
onDropClip(payload, { trackId: track.id, seconds: t, index });
|
|
4566
4861
|
} : void 0,
|
|
4567
4862
|
children: [
|
|
4568
|
-
track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ (0,
|
|
4569
|
-
track.laid.map((l) => /* @__PURE__ */ (0,
|
|
4863
|
+
track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "rui-tl-laneempty", children: track.emptyLabel }),
|
|
4864
|
+
track.laid.map((l) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4570
4865
|
Clip,
|
|
4571
4866
|
{
|
|
4572
4867
|
l,
|
|
@@ -4582,7 +4877,7 @@ function Timeline({
|
|
|
4582
4877
|
},
|
|
4583
4878
|
l.clip.id ?? l.i
|
|
4584
4879
|
)),
|
|
4585
|
-
dropAt?.trackId === track.id && /* @__PURE__ */ (0,
|
|
4880
|
+
dropAt?.trackId === track.id && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4586
4881
|
"span",
|
|
4587
4882
|
{
|
|
4588
4883
|
className: "rui-tl-dropmark",
|
|
@@ -4590,7 +4885,7 @@ function Timeline({
|
|
|
4590
4885
|
"aria-hidden": "true"
|
|
4591
4886
|
}
|
|
4592
4887
|
),
|
|
4593
|
-
laneAppend && /* @__PURE__ */ (0,
|
|
4888
|
+
laneAppend && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4594
4889
|
"span",
|
|
4595
4890
|
{
|
|
4596
4891
|
className: "rui-tl-append",
|
|
@@ -4602,9 +4897,9 @@ function Timeline({
|
|
|
4602
4897
|
}
|
|
4603
4898
|
)
|
|
4604
4899
|
] }, track.id)),
|
|
4605
|
-
onDropClip && newLaneLabel && /* @__PURE__ */ (0,
|
|
4606
|
-
/* @__PURE__ */ (0,
|
|
4607
|
-
/* @__PURE__ */ (0,
|
|
4900
|
+
onDropClip && newLaneLabel && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rui-tl-row", children: [
|
|
4901
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rui-tl-head rui-tl-newhead", "aria-hidden": "true" }),
|
|
4902
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4608
4903
|
"div",
|
|
4609
4904
|
{
|
|
4610
4905
|
className: "rui-tl-newlane" + (dropAt?.trackId === null ? " is-dropping" : ""),
|
|
@@ -4626,11 +4921,11 @@ function Timeline({
|
|
|
4626
4921
|
e.preventDefault();
|
|
4627
4922
|
onDropClip(payload, { trackId: null, seconds: timeAt(e.clientX), index: 0 });
|
|
4628
4923
|
},
|
|
4629
|
-
children: /* @__PURE__ */ (0,
|
|
4924
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-newlbl", children: newLaneLabel })
|
|
4630
4925
|
}
|
|
4631
4926
|
)
|
|
4632
4927
|
] }),
|
|
4633
|
-
drag?.guide != null && /* @__PURE__ */ (0,
|
|
4928
|
+
drag?.guide != null && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4634
4929
|
"div",
|
|
4635
4930
|
{
|
|
4636
4931
|
className: "rui-tl-guide",
|
|
@@ -4638,16 +4933,16 @@ function Timeline({
|
|
|
4638
4933
|
"aria-hidden": "true"
|
|
4639
4934
|
}
|
|
4640
4935
|
),
|
|
4641
|
-
Number.isFinite(currentTime) && /* @__PURE__ */ (0,
|
|
4936
|
+
Number.isFinite(currentTime) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4642
4937
|
"div",
|
|
4643
4938
|
{
|
|
4644
4939
|
className: "rui-tl-playhead",
|
|
4645
4940
|
style: { left: TL_HEAD_W + currentTime * pps },
|
|
4646
4941
|
"aria-hidden": "true",
|
|
4647
|
-
children: /* @__PURE__ */ (0,
|
|
4942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-playhead-grip" })
|
|
4648
4943
|
}
|
|
4649
4944
|
),
|
|
4650
|
-
drag?.annotation && /* @__PURE__ */ (0,
|
|
4945
|
+
drag?.annotation && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rui-tl-annot", style: { left: TL_HEAD_W + (drag.annotAt || 0) * pps }, children: drag.annotation })
|
|
4651
4946
|
] }) })
|
|
4652
4947
|
] });
|
|
4653
4948
|
}
|
|
@@ -4723,7 +5018,7 @@ function Clip({
|
|
|
4723
5018
|
click: onSelect
|
|
4724
5019
|
});
|
|
4725
5020
|
};
|
|
4726
|
-
return /* @__PURE__ */ (0,
|
|
5021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4727
5022
|
"article",
|
|
4728
5023
|
{
|
|
4729
5024
|
className: "rui-tl-clip" + (clip.state ? ` is-${clip.state}` : "") + (known ? "" : " is-unmeasured") + (selected ? " is-selected" : "") + (live ? " is-live" : ""),
|
|
@@ -4738,10 +5033,10 @@ function Clip({
|
|
|
4738
5033
|
}
|
|
4739
5034
|
},
|
|
4740
5035
|
children: [
|
|
4741
|
-
clip.poster ? /* @__PURE__ */ (0,
|
|
5036
|
+
clip.poster ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-strip", style: {
|
|
4742
5037
|
backgroundImage: `url("${String(clip.poster).replace(/"/g, '\\"')}")`,
|
|
4743
5038
|
backgroundSize: `${tileW}px 100%`
|
|
4744
|
-
} }) : clip.video ? /* @__PURE__ */ (0,
|
|
5039
|
+
} }) : clip.video ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4745
5040
|
"video",
|
|
4746
5041
|
{
|
|
4747
5042
|
className: "rui-tl-frame",
|
|
@@ -4752,12 +5047,12 @@ function Clip({
|
|
|
4752
5047
|
tabIndex: -1,
|
|
4753
5048
|
"aria-hidden": "true"
|
|
4754
5049
|
}
|
|
4755
|
-
) : /* @__PURE__ */ (0,
|
|
4756
|
-
clip.badge && /* @__PURE__ */ (0,
|
|
4757
|
-
known && width > 46 && /* @__PURE__ */ (0,
|
|
4758
|
-
clip.label && width > 104 && /* @__PURE__ */ (0,
|
|
4759
|
-
onTrim && known && /* @__PURE__ */ (0,
|
|
4760
|
-
/* @__PURE__ */ (0,
|
|
5050
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-blank", "aria-hidden": "true", children: clip.glyph }),
|
|
5051
|
+
clip.badge && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-badge", children: clip.badge }),
|
|
5052
|
+
known && width > 46 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-dur", children: durationLabel(clip.duration) }),
|
|
5053
|
+
clip.label && width > 104 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "rui-tl-name", children: clip.label }),
|
|
5054
|
+
onTrim && known && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
5055
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4761
5056
|
"span",
|
|
4762
5057
|
{
|
|
4763
5058
|
className: "rui-tl-trim l",
|
|
@@ -4766,7 +5061,7 @@ function Clip({
|
|
|
4766
5061
|
"aria-label": `Trim the start of ${clip.label || "this clip"}`
|
|
4767
5062
|
}
|
|
4768
5063
|
),
|
|
4769
|
-
/* @__PURE__ */ (0,
|
|
5064
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4770
5065
|
"span",
|
|
4771
5066
|
{
|
|
4772
5067
|
className: "rui-tl-trim r",
|