reifyui 0.15.1 → 0.16.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/dist/agent-chat.cjs +607 -5
- package/dist/agent-chat.cjs.map +1 -1
- package/dist/agent-chat.d.ts +34 -0
- package/dist/agent-chat.js +93 -2
- package/dist/agent-chat.js.map +1 -1
- package/dist/{chunk-S46J7CLH.js → chunk-4SVQGVJH.js} +415 -4
- package/dist/chunk-4SVQGVJH.js.map +1 -0
- package/dist/{chunk-WAND7AYD.js → chunk-QCISEB67.js} +103 -2
- package/dist/chunk-QCISEB67.js.map +1 -0
- package/dist/chunk-SPLQ7T6F.js +76 -0
- package/dist/chunk-SPLQ7T6F.js.map +1 -0
- package/dist/graph.js +4 -3
- package/dist/graph.js.map +1 -1
- package/dist/index.cjs +144 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +176 -512
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-chat/artifacts.jsx +55 -0
- package/src/agent-chat/components.jsx +6 -1
- package/src/agent-chat/index.d.ts +34 -0
- package/src/agent-chat/index.js +5 -0
- package/src/components/FileCard.jsx +17 -2
- package/src/components/FilePreview.jsx +15 -1
- package/styles/agent-chat.css +18 -0
- package/styles/file.css +2 -0
- package/dist/chunk-AGSX5YKH.js +0 -177
- package/dist/chunk-AGSX5YKH.js.map +0 -1
- package/dist/chunk-S46J7CLH.js.map +0 -1
- package/dist/chunk-WAND7AYD.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -2435,7 +2435,9 @@ function TurnOutcome(props) {
|
|
|
2435
2435
|
if (!turn || turn.status === "running") return null;
|
|
2436
2436
|
const ms = turn.startedAt != null && turn.endedAt != null ? turn.endedAt - turn.startedAt : turn.elapsedMs;
|
|
2437
2437
|
const time = ms != null && ms >= 0 ? formatElapsed(ms) : "";
|
|
2438
|
-
const
|
|
2438
|
+
const u = turn.usage || null;
|
|
2439
|
+
const parts = u ? ["input_tokens", "output_tokens", "cache_read_tokens", "cache_write_tokens"].map((k) => Number(u[k]) || 0) : [];
|
|
2440
|
+
const tok = u ? parts.some(Boolean) ? parts.reduce((a, b) => a + b, 0) : Number(u.total_tokens) || 0 : 0;
|
|
2439
2441
|
const tokens = tok ? labels.tokens(formatTokens(tok)) : "";
|
|
2440
2442
|
if (turn.status === "done") {
|
|
2441
2443
|
if (!time && !tokens) return null;
|
|
@@ -6008,7 +6010,13 @@ function FileTypeIcon({ name, size = 36 }) {
|
|
|
6008
6010
|
}
|
|
6009
6011
|
|
|
6010
6012
|
// src/components/FileCard.jsx
|
|
6013
|
+
var import_react22 = require("react");
|
|
6011
6014
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6015
|
+
var IcCopy = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
6016
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
|
|
6017
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M5 15V6a2 2 0 0 1 2-2h9" })
|
|
6018
|
+
] });
|
|
6019
|
+
var IcCheckMark = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M5 12l5 5L20 7" }) });
|
|
6012
6020
|
function subtitle(name, origin, bytes) {
|
|
6013
6021
|
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
6014
6022
|
if (origin) parts.push(origin);
|
|
@@ -6021,7 +6029,13 @@ function bytesLabel2(n) {
|
|
|
6021
6029
|
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
6022
6030
|
return `${(n / 1048576).toFixed(1)} MB`;
|
|
6023
6031
|
}
|
|
6024
|
-
function FileCard({ name, origin = "output", bytes, onPreview, onDownload, className = "" }) {
|
|
6032
|
+
function FileCard({ name, origin = "output", bytes, onPreview, onDownload, onCopy, active = false, className = "" }) {
|
|
6033
|
+
const [copied, setCopied] = (0, import_react22.useState)("");
|
|
6034
|
+
(0, import_react22.useEffect)(() => {
|
|
6035
|
+
if (!copied) return void 0;
|
|
6036
|
+
const t = setTimeout(() => setCopied(""), 1600);
|
|
6037
|
+
return () => clearTimeout(t);
|
|
6038
|
+
}, [copied]);
|
|
6025
6039
|
const open = onPreview ? (e) => {
|
|
6026
6040
|
e.stopPropagation();
|
|
6027
6041
|
onPreview();
|
|
@@ -6029,7 +6043,8 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
|
|
|
6029
6043
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6030
6044
|
"div",
|
|
6031
6045
|
{
|
|
6032
|
-
className: "uic-filecard" + (open ? " is-clickable" : "") + (className ? " " + className : ""),
|
|
6046
|
+
className: "uic-filecard" + (open ? " is-clickable" : "") + (active ? " is-active" : "") + (className ? " " + className : ""),
|
|
6047
|
+
"aria-current": active ? "true" : void 0,
|
|
6033
6048
|
onClick: open,
|
|
6034
6049
|
role: open ? "button" : void 0,
|
|
6035
6050
|
tabIndex: open ? 0 : void 0,
|
|
@@ -6046,6 +6061,25 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
|
|
|
6046
6061
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-filecard-name", children: name }),
|
|
6047
6062
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
|
|
6048
6063
|
] }),
|
|
6064
|
+
onCopy && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6065
|
+
"button",
|
|
6066
|
+
{
|
|
6067
|
+
type: "button",
|
|
6068
|
+
className: "uic-filecard-dl uic-filecard-copy",
|
|
6069
|
+
"aria-label": copied === "ok" ? "Copied" : `Copy ${name}`,
|
|
6070
|
+
title: copied === "ok" ? "Copied" : copied === "no" ? "Could not copy" : "Copy",
|
|
6071
|
+
onClick: async (e) => {
|
|
6072
|
+
e.stopPropagation();
|
|
6073
|
+
try {
|
|
6074
|
+
await onCopy();
|
|
6075
|
+
setCopied("ok");
|
|
6076
|
+
} catch {
|
|
6077
|
+
setCopied("no");
|
|
6078
|
+
}
|
|
6079
|
+
},
|
|
6080
|
+
children: copied === "ok" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IcCheckMark, {}) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IcCopy, {})
|
|
6081
|
+
}
|
|
6082
|
+
),
|
|
6049
6083
|
onDownload && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6050
6084
|
"button",
|
|
6051
6085
|
{
|
|
@@ -6067,7 +6101,7 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
|
|
|
6067
6101
|
}
|
|
6068
6102
|
|
|
6069
6103
|
// src/components/FilePreview.jsx
|
|
6070
|
-
var
|
|
6104
|
+
var import_react23 = require("react");
|
|
6071
6105
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6072
6106
|
var LANG = {
|
|
6073
6107
|
js: "javascript",
|
|
@@ -6173,13 +6207,14 @@ function FilePreview({
|
|
|
6173
6207
|
renderMarkdown,
|
|
6174
6208
|
parseWorkbook,
|
|
6175
6209
|
onDownload,
|
|
6176
|
-
title
|
|
6210
|
+
title,
|
|
6211
|
+
before
|
|
6177
6212
|
}) {
|
|
6178
6213
|
const { url, name } = file || {};
|
|
6179
|
-
const [st, setSt] = (0,
|
|
6180
|
-
const [tab, setTab] = (0,
|
|
6181
|
-
const [view, setView] = (0,
|
|
6182
|
-
(0,
|
|
6214
|
+
const [st, setSt] = (0, import_react23.useState)({ kind: "loading" });
|
|
6215
|
+
const [tab, setTab] = (0, import_react23.useState)(0);
|
|
6216
|
+
const [view, setView] = (0, import_react23.useState)("preview");
|
|
6217
|
+
(0, import_react23.useEffect)(() => {
|
|
6183
6218
|
if (!url) return void 0;
|
|
6184
6219
|
let alive = true;
|
|
6185
6220
|
let obj;
|
|
@@ -6242,7 +6277,23 @@ function FilePreview({
|
|
|
6242
6277
|
};
|
|
6243
6278
|
}, [url, name, fetchFile, officePdfUrl, parseWorkbook]);
|
|
6244
6279
|
const download = () => onDownload ? onDownload(url, name) : defaultDownload(url, name);
|
|
6280
|
+
const [copied, setCopied] = (0, import_react23.useState)("");
|
|
6281
|
+
(0, import_react23.useEffect)(() => {
|
|
6282
|
+
if (!copied) return void 0;
|
|
6283
|
+
const t = setTimeout(() => setCopied(""), 1600);
|
|
6284
|
+
return () => clearTimeout(t);
|
|
6285
|
+
}, [copied]);
|
|
6286
|
+
const copyText = typeof st.text === "string" ? st.text : null;
|
|
6287
|
+
const copy = async () => {
|
|
6288
|
+
try {
|
|
6289
|
+
await navigator.clipboard.writeText(copyText || "");
|
|
6290
|
+
setCopied("ok");
|
|
6291
|
+
} catch {
|
|
6292
|
+
setCopied("no");
|
|
6293
|
+
}
|
|
6294
|
+
};
|
|
6245
6295
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("aside", { className: "uic-fp", "aria-label": title || `Preview of ${name}`, children: [
|
|
6296
|
+
before,
|
|
6246
6297
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { className: "uic-fp-head", children: [
|
|
6247
6298
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "uic-fp-ic", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FileTypeIcon, { name, size: 20 }) }),
|
|
6248
6299
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "uic-fp-name", title: name, children: name }),
|
|
@@ -6258,6 +6309,20 @@ function FilePreview({
|
|
|
6258
6309
|
},
|
|
6259
6310
|
id
|
|
6260
6311
|
)) }),
|
|
6312
|
+
copyText != null && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6313
|
+
"button",
|
|
6314
|
+
{
|
|
6315
|
+
type: "button",
|
|
6316
|
+
className: "uic-fp-btn uic-fp-copy",
|
|
6317
|
+
"aria-label": copied === "ok" ? "Copied" : `Copy ${name}`,
|
|
6318
|
+
title: copied === "ok" ? "Copied" : copied === "no" ? "Could not copy" : "Copy",
|
|
6319
|
+
onClick: copy,
|
|
6320
|
+
children: copied === "ok" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M5 12l5 5L20 7" }) }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
6321
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
|
|
6322
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M5 15V6a2 2 0 0 1 2-2h9" })
|
|
6323
|
+
] })
|
|
6324
|
+
}
|
|
6325
|
+
),
|
|
6261
6326
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6262
6327
|
"button",
|
|
6263
6328
|
{
|
|
@@ -6318,7 +6383,7 @@ function FilePreview({
|
|
|
6318
6383
|
}
|
|
6319
6384
|
|
|
6320
6385
|
// src/components/form.jsx
|
|
6321
|
-
var
|
|
6386
|
+
var import_react24 = require("react");
|
|
6322
6387
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6323
6388
|
function Field({ label, hint, error, htmlFor, required, children, className = "" }) {
|
|
6324
6389
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
|
|
@@ -6332,7 +6397,7 @@ function Field({ label, hint, error, htmlFor, required, children, className = ""
|
|
|
6332
6397
|
}
|
|
6333
6398
|
function withField(Control) {
|
|
6334
6399
|
return function Fielded({ label, hint, error, required, id, className, ...rest }) {
|
|
6335
|
-
const auto = (0,
|
|
6400
|
+
const auto = (0, import_react24.useId)();
|
|
6336
6401
|
const inputId = id || auto;
|
|
6337
6402
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Field, { label, hint, error, required, htmlFor: inputId, className, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Control, { id: inputId, invalid: !!error, required, ...rest }) });
|
|
6338
6403
|
};
|
|
@@ -6382,14 +6447,14 @@ function Button({ variant = "default", size = "md", type = "button", className =
|
|
|
6382
6447
|
}
|
|
6383
6448
|
|
|
6384
6449
|
// src/components/Carousel.jsx
|
|
6385
|
-
var
|
|
6450
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
6386
6451
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6387
6452
|
var EDGE = 2;
|
|
6388
6453
|
function Carousel(props) {
|
|
6389
6454
|
const { label, step, children, classNames = {} } = props;
|
|
6390
|
-
const ref = (0,
|
|
6391
|
-
const [edges, setEdges] = (0,
|
|
6392
|
-
const measure = (0,
|
|
6455
|
+
const ref = (0, import_react25.useRef)(null);
|
|
6456
|
+
const [edges, setEdges] = (0, import_react25.useState)({ start: true, end: true, overflow: false });
|
|
6457
|
+
const measure = (0, import_react25.useCallback)(() => {
|
|
6393
6458
|
const el = ref.current;
|
|
6394
6459
|
if (!el) return;
|
|
6395
6460
|
const overflow = el.scrollWidth - el.clientWidth > EDGE;
|
|
@@ -6399,7 +6464,7 @@ function Carousel(props) {
|
|
|
6399
6464
|
end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
|
|
6400
6465
|
});
|
|
6401
6466
|
}, []);
|
|
6402
|
-
(0,
|
|
6467
|
+
(0, import_react25.useEffect)(() => {
|
|
6403
6468
|
const el = ref.current;
|
|
6404
6469
|
if (!el) return void 0;
|
|
6405
6470
|
measure();
|
|
@@ -6451,7 +6516,7 @@ function Carousel(props) {
|
|
|
6451
6516
|
}
|
|
6452
6517
|
|
|
6453
6518
|
// src/components/Card.jsx
|
|
6454
|
-
var
|
|
6519
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
6455
6520
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
6456
6521
|
function Card(props) {
|
|
6457
6522
|
const { art, title, subtitle: subtitle2, onClick, selected = false, overlay, actions, classNames = {} } = props;
|
|
@@ -6473,7 +6538,7 @@ function Card(props) {
|
|
|
6473
6538
|
}
|
|
6474
6539
|
|
|
6475
6540
|
// src/components/SearchField.jsx
|
|
6476
|
-
var
|
|
6541
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
6477
6542
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
6478
6543
|
function SearchField(props) {
|
|
6479
6544
|
const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
|
|
@@ -6494,7 +6559,7 @@ function SearchField(props) {
|
|
|
6494
6559
|
}
|
|
6495
6560
|
|
|
6496
6561
|
// src/components/CascadeMenu.jsx
|
|
6497
|
-
var
|
|
6562
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
6498
6563
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6499
6564
|
var Tick = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Svg, { s: 14, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
6500
6565
|
var FILTER_PAST = 8;
|
|
@@ -6520,21 +6585,21 @@ function CascadeMenu(props) {
|
|
|
6520
6585
|
className,
|
|
6521
6586
|
value
|
|
6522
6587
|
} = props;
|
|
6523
|
-
const rootRef = (0,
|
|
6524
|
-
const [q, setQ] = (0,
|
|
6525
|
-
const [activeId, setActiveId] = (0,
|
|
6526
|
-
const [stage, setStage] = (0,
|
|
6527
|
-
const [stacked, setStacked] = (0,
|
|
6528
|
-
const visible = (0,
|
|
6588
|
+
const rootRef = (0, import_react28.useRef)(null);
|
|
6589
|
+
const [q, setQ] = (0, import_react28.useState)("");
|
|
6590
|
+
const [activeId, setActiveId] = (0, import_react28.useState)(null);
|
|
6591
|
+
const [stage, setStage] = (0, import_react28.useState)("items");
|
|
6592
|
+
const [stacked, setStacked] = (0, import_react28.useState)(false);
|
|
6593
|
+
const visible = (0, import_react28.useMemo)(() => {
|
|
6529
6594
|
const needle = q.trim().toLowerCase();
|
|
6530
6595
|
if (!needle) return groups.filter((g) => g.items.length > 0);
|
|
6531
6596
|
return groups.map((g) => ({ ...g, items: g.items.filter((it) => String(it.label).toLowerCase().includes(needle)) })).filter((g) => g.items.length > 0);
|
|
6532
6597
|
}, [groups, q]);
|
|
6533
|
-
const flat = (0,
|
|
6598
|
+
const flat = (0, import_react28.useMemo)(() => itemsOf(visible), [visible]);
|
|
6534
6599
|
const active = flat.find((it) => it.id === activeId) || flat[0] || null;
|
|
6535
|
-
const options = (0,
|
|
6600
|
+
const options = (0, import_react28.useMemo)(() => active && optionsOf ? optionsOf(active) : [], [active, optionsOf]);
|
|
6536
6601
|
const showFilter = filter === true || filter === "auto" && itemsOf(groups).length > FILTER_PAST;
|
|
6537
|
-
(0,
|
|
6602
|
+
(0, import_react28.useEffect)(() => {
|
|
6538
6603
|
if (!open) return void 0;
|
|
6539
6604
|
setQ("");
|
|
6540
6605
|
setActiveId(value?.item ?? null);
|
|
@@ -6553,14 +6618,14 @@ function CascadeMenu(props) {
|
|
|
6553
6618
|
anchor?.focus?.({ preventScroll: true });
|
|
6554
6619
|
};
|
|
6555
6620
|
}, [open, stackBelow]);
|
|
6556
|
-
const focusIn = (0,
|
|
6621
|
+
const focusIn = (0, import_react28.useCallback)((col, index = 0) => {
|
|
6557
6622
|
const list = rootRef.current?.querySelectorAll(`.uic-cascade-${col} .uic-pop-item:not(:disabled)`);
|
|
6558
6623
|
if (!list || !list.length) return false;
|
|
6559
6624
|
const i = Math.max(0, Math.min(index, list.length - 1));
|
|
6560
6625
|
list[i].focus({ preventScroll: true });
|
|
6561
6626
|
return true;
|
|
6562
6627
|
}, []);
|
|
6563
|
-
const enterOptions = (0,
|
|
6628
|
+
const enterOptions = (0, import_react28.useCallback)(() => {
|
|
6564
6629
|
if (stacked) {
|
|
6565
6630
|
setStage("options");
|
|
6566
6631
|
requestAnimationFrame(() => focusIn("options"));
|
|
@@ -6614,7 +6679,7 @@ function CascadeMenu(props) {
|
|
|
6614
6679
|
showItems && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "uic-cascade-col uic-cascade-items", children: [
|
|
6615
6680
|
showFilter ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SearchField, { className: "uic-cascade-filter", value: q, onChange: setQ, placeholder: filterPlaceholder }) : null,
|
|
6616
6681
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "uic-pop-list", children: [
|
|
6617
|
-
visible.map((g, gi) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
6682
|
+
visible.map((g, gi) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react28.Fragment, { children: [
|
|
6618
6683
|
g.label ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "uic-cascade-group", children: g.label }) : null,
|
|
6619
6684
|
g.items.map((it) => {
|
|
6620
6685
|
const on = active?.id === it.id;
|
|
@@ -6693,7 +6758,7 @@ function CascadeMenu(props) {
|
|
|
6693
6758
|
}
|
|
6694
6759
|
|
|
6695
6760
|
// src/components/Modal.jsx
|
|
6696
|
-
var
|
|
6761
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
6697
6762
|
var import_react_dom4 = require("react-dom");
|
|
6698
6763
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
6699
6764
|
function Modal(props) {
|
|
@@ -6709,10 +6774,10 @@ function Modal(props) {
|
|
|
6709
6774
|
children,
|
|
6710
6775
|
classNames = {}
|
|
6711
6776
|
} = props;
|
|
6712
|
-
const titleId = (0,
|
|
6713
|
-
const escape = (0,
|
|
6777
|
+
const titleId = (0, import_react29.useId)();
|
|
6778
|
+
const escape = (0, import_react29.useCallback)(() => onClose?.(), [onClose]);
|
|
6714
6779
|
useOverlayEscape(open, escape);
|
|
6715
|
-
(0,
|
|
6780
|
+
(0, import_react29.useEffect)(() => {
|
|
6716
6781
|
if (!open || typeof document === "undefined") return void 0;
|
|
6717
6782
|
const prev = document.body.style.overflow;
|
|
6718
6783
|
document.body.style.overflow = "hidden";
|
|
@@ -6758,15 +6823,15 @@ function Modal(props) {
|
|
|
6758
6823
|
}
|
|
6759
6824
|
|
|
6760
6825
|
// src/hooks/useTypewriter.js
|
|
6761
|
-
var
|
|
6826
|
+
var import_react30 = require("react");
|
|
6762
6827
|
var CHAR_MS = 26;
|
|
6763
6828
|
var HOLD_MS = 2600;
|
|
6764
6829
|
function useTypewriter(phrases, { active = true } = {}) {
|
|
6765
6830
|
const list = phrases && phrases.length ? phrases : [""];
|
|
6766
|
-
const [text, setText] = (0,
|
|
6767
|
-
const listRef = (0,
|
|
6831
|
+
const [text, setText] = (0, import_react30.useState)(list[0]);
|
|
6832
|
+
const listRef = (0, import_react30.useRef)(list);
|
|
6768
6833
|
listRef.current = list;
|
|
6769
|
-
(0,
|
|
6834
|
+
(0, import_react30.useEffect)(() => {
|
|
6770
6835
|
if (!active) return void 0;
|
|
6771
6836
|
if (typeof window === "undefined") return void 0;
|
|
6772
6837
|
if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
|
|
@@ -6855,7 +6920,7 @@ function Panel(props) {
|
|
|
6855
6920
|
}
|
|
6856
6921
|
|
|
6857
6922
|
// src/grid/PanelGrid.jsx
|
|
6858
|
-
var
|
|
6923
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
6859
6924
|
|
|
6860
6925
|
// src/grid/layout.js
|
|
6861
6926
|
function sortLayout(layout2) {
|
|
@@ -6930,9 +6995,9 @@ function sameLayout(a, b) {
|
|
|
6930
6995
|
// src/grid/PanelGrid.jsx
|
|
6931
6996
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
6932
6997
|
function useMeasuredWidth() {
|
|
6933
|
-
const ref = (0,
|
|
6934
|
-
const [width, setWidth] = (0,
|
|
6935
|
-
(0,
|
|
6998
|
+
const ref = (0, import_react31.useRef)(null);
|
|
6999
|
+
const [width, setWidth] = (0, import_react31.useState)(0);
|
|
7000
|
+
(0, import_react31.useLayoutEffect)(() => {
|
|
6936
7001
|
const el = ref.current;
|
|
6937
7002
|
if (!el) return void 0;
|
|
6938
7003
|
const measure = () => setWidth(el.clientWidth);
|
|
@@ -6959,9 +7024,9 @@ function PanelGrid(props) {
|
|
|
6959
7024
|
className = ""
|
|
6960
7025
|
} = props;
|
|
6961
7026
|
const [wrapRef, width] = useMeasuredWidth();
|
|
6962
|
-
const [drag, setDrag] = (0,
|
|
6963
|
-
const dragRef = (0,
|
|
6964
|
-
const swallowClick = (0,
|
|
7027
|
+
const [drag, setDrag] = (0, import_react31.useState)(null);
|
|
7028
|
+
const dragRef = (0, import_react31.useRef)(null);
|
|
7029
|
+
const swallowClick = (0, import_react31.useRef)(false);
|
|
6965
7030
|
const stacked = width > 0 && width < stackAt;
|
|
6966
7031
|
const arrangeable = editable && !stacked;
|
|
6967
7032
|
const live = drag ? drag.preview : layout2;
|
|
@@ -6969,7 +7034,7 @@ function PanelGrid(props) {
|
|
|
6969
7034
|
const cellW = colW + gap;
|
|
6970
7035
|
const cellH = rowHeight + gap;
|
|
6971
7036
|
const rowsToPx = (h) => h * rowHeight + (h - 1) * gap;
|
|
6972
|
-
const stack2 = (0,
|
|
7037
|
+
const stack2 = (0, import_react31.useMemo)(() => {
|
|
6973
7038
|
if (!stacked) return null;
|
|
6974
7039
|
const tops = /* @__PURE__ */ new Map();
|
|
6975
7040
|
let y = 0;
|
|
@@ -6981,11 +7046,11 @@ function PanelGrid(props) {
|
|
|
6981
7046
|
}, [stacked, live, rowHeight, gap]);
|
|
6982
7047
|
const rows = layoutRows(live);
|
|
6983
7048
|
const height = stacked ? stack2.height : rows ? rowsToPx(rows) : 0;
|
|
6984
|
-
const commit = (0,
|
|
7049
|
+
const commit = (0, import_react31.useCallback)((next) => {
|
|
6985
7050
|
if (onLayoutChange && !sameLayout(next, layout2)) onLayoutChange(next);
|
|
6986
7051
|
}, [onLayoutChange, layout2]);
|
|
6987
|
-
const detach = (0,
|
|
6988
|
-
(0,
|
|
7052
|
+
const detach = (0, import_react31.useRef)(null);
|
|
7053
|
+
(0, import_react31.useEffect)(() => () => detach.current?.(), []);
|
|
6989
7054
|
const start = (id, mode) => (e) => {
|
|
6990
7055
|
if (!arrangeable || e.button !== 0) return;
|
|
6991
7056
|
const item = layout2.find((it) => it.i === id);
|
|
@@ -7062,8 +7127,8 @@ function PanelGrid(props) {
|
|
|
7062
7127
|
},
|
|
7063
7128
|
children: [
|
|
7064
7129
|
ghost ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uic-pg-ghost", "aria-hidden": "true", style: ghost }) : null,
|
|
7065
|
-
width > 0 &&
|
|
7066
|
-
if (!
|
|
7130
|
+
width > 0 && import_react31.default.Children.map(children, (child) => {
|
|
7131
|
+
if (!import_react31.default.isValidElement(child) || child.key == null) return null;
|
|
7067
7132
|
const id = String(child.key).replace(/^\.\$/, "");
|
|
7068
7133
|
const it = byId.get(id);
|
|
7069
7134
|
if (!it) return null;
|
|
@@ -7102,7 +7167,7 @@ function packLayout(layout2, cols = 12) {
|
|
|
7102
7167
|
}
|
|
7103
7168
|
|
|
7104
7169
|
// src/timeline/Timeline.jsx
|
|
7105
|
-
var
|
|
7170
|
+
var import_react32 = require("react");
|
|
7106
7171
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
7107
7172
|
var TL_MIN_PPS = 4;
|
|
7108
7173
|
var TL_MAX_PPS = 400;
|
|
@@ -7192,21 +7257,21 @@ function Timeline({
|
|
|
7192
7257
|
emptyLabel = "Nothing here yet.",
|
|
7193
7258
|
className = ""
|
|
7194
7259
|
}) {
|
|
7195
|
-
const scroller = (0,
|
|
7196
|
-
const innerRef = (0,
|
|
7197
|
-
const [pps, setPps] = (0,
|
|
7260
|
+
const scroller = (0, import_react32.useRef)(null);
|
|
7261
|
+
const innerRef = (0, import_react32.useRef)(null);
|
|
7262
|
+
const [pps, setPps] = (0, import_react32.useState)(() => {
|
|
7198
7263
|
if (zoomStorageKey && typeof window !== "undefined") {
|
|
7199
7264
|
const n = parseFloat(window.localStorage.getItem(zoomStorageKey) || "");
|
|
7200
7265
|
if (Number.isFinite(n)) return clamp(n, TL_MIN_PPS, TL_MAX_PPS);
|
|
7201
7266
|
}
|
|
7202
7267
|
return TL_DEFAULT_PPS;
|
|
7203
7268
|
});
|
|
7204
|
-
const [snapping, setSnapping] = (0,
|
|
7205
|
-
const gesture = (0,
|
|
7206
|
-
const [drag, setDrag] = (0,
|
|
7207
|
-
const anchor = (0,
|
|
7208
|
-
const [dropAt, setDropAt] = (0,
|
|
7209
|
-
const rows = (0,
|
|
7269
|
+
const [snapping, setSnapping] = (0, import_react32.useState)(() => snapStorageKey && typeof window !== "undefined" ? window.localStorage.getItem(snapStorageKey) !== "0" : true);
|
|
7270
|
+
const gesture = (0, import_react32.useRef)(null);
|
|
7271
|
+
const [drag, setDrag] = (0, import_react32.useState)(null);
|
|
7272
|
+
const anchor = (0, import_react32.useRef)(null);
|
|
7273
|
+
const [dropAt, setDropAt] = (0, import_react32.useState)(null);
|
|
7274
|
+
const rows = (0, import_react32.useMemo)(
|
|
7210
7275
|
() => tracks.map((t) => ({
|
|
7211
7276
|
...t,
|
|
7212
7277
|
sequential: t.sequential !== false,
|
|
@@ -7214,12 +7279,12 @@ function Timeline({
|
|
|
7214
7279
|
})),
|
|
7215
7280
|
[tracks, pps]
|
|
7216
7281
|
);
|
|
7217
|
-
const contentSeconds = (0,
|
|
7282
|
+
const contentSeconds = (0, import_react32.useMemo)(() => {
|
|
7218
7283
|
let end = 0;
|
|
7219
7284
|
for (const t of rows) for (const l of t.laid) end = Math.max(end, l.t0 + l.w / pps);
|
|
7220
7285
|
return end;
|
|
7221
7286
|
}, [rows, pps]);
|
|
7222
|
-
const snapTimes = (0,
|
|
7287
|
+
const snapTimes = (0, import_react32.useMemo)(() => {
|
|
7223
7288
|
const out = [0, currentTime];
|
|
7224
7289
|
for (const t of rows) for (const l of t.laid) {
|
|
7225
7290
|
out.push(l.t0);
|
|
@@ -7227,7 +7292,7 @@ function Timeline({
|
|
|
7227
7292
|
}
|
|
7228
7293
|
return out;
|
|
7229
7294
|
}, [rows, pps, currentTime]);
|
|
7230
|
-
const setZoom = (0,
|
|
7295
|
+
const setZoom = (0, import_react32.useCallback)((next, clientX) => {
|
|
7231
7296
|
const v = clamp(next, TL_MIN_PPS, TL_MAX_PPS);
|
|
7232
7297
|
const el = scroller.current;
|
|
7233
7298
|
if (el) {
|
|
@@ -7243,21 +7308,21 @@ function Timeline({
|
|
|
7243
7308
|
}
|
|
7244
7309
|
}
|
|
7245
7310
|
}, [pps, zoomStorageKey]);
|
|
7246
|
-
const fitPps = (0,
|
|
7311
|
+
const fitPps = (0, import_react32.useCallback)((seconds) => {
|
|
7247
7312
|
const el = scroller.current;
|
|
7248
7313
|
if (!el || !(seconds > 0)) return null;
|
|
7249
7314
|
const room = el.clientWidth - TL_HEAD_W - 56;
|
|
7250
7315
|
return room > 0 ? clamp(room / seconds, TL_MIN_PPS, TL_MAX_PPS) : null;
|
|
7251
7316
|
}, []);
|
|
7252
|
-
const fit = (0,
|
|
7317
|
+
const fit = (0, import_react32.useCallback)(() => {
|
|
7253
7318
|
const v = fitPps(contentSeconds);
|
|
7254
7319
|
if (v !== null) {
|
|
7255
7320
|
setPps(v);
|
|
7256
7321
|
if (scroller.current) scroller.current.scrollLeft = 0;
|
|
7257
7322
|
}
|
|
7258
7323
|
}, [fitPps, contentSeconds]);
|
|
7259
|
-
const fitted = (0,
|
|
7260
|
-
(0,
|
|
7324
|
+
const fitted = (0, import_react32.useRef)(false);
|
|
7325
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
7261
7326
|
if (fitted.current || !(contentSeconds > 0)) return;
|
|
7262
7327
|
if (zoomStorageKey && typeof window !== "undefined" && window.localStorage.getItem(zoomStorageKey)) {
|
|
7263
7328
|
fitted.current = true;
|
|
@@ -7269,13 +7334,13 @@ function Timeline({
|
|
|
7269
7334
|
setPps(v);
|
|
7270
7335
|
}
|
|
7271
7336
|
}, [contentSeconds, fitPps, zoomStorageKey]);
|
|
7272
|
-
(0,
|
|
7337
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
7273
7338
|
const a = anchor.current;
|
|
7274
7339
|
if (!a || !scroller.current) return;
|
|
7275
7340
|
anchor.current = null;
|
|
7276
7341
|
scroller.current.scrollLeft = Math.max(0, TL_HEAD_W + a.t * pps - a.vx);
|
|
7277
7342
|
}, [pps]);
|
|
7278
|
-
(0,
|
|
7343
|
+
(0, import_react32.useEffect)(() => {
|
|
7279
7344
|
const el = scroller.current;
|
|
7280
7345
|
if (!el) return void 0;
|
|
7281
7346
|
const onWheel = (e) => {
|
|
@@ -7286,12 +7351,12 @@ function Timeline({
|
|
|
7286
7351
|
el.addEventListener("wheel", onWheel, { passive: false });
|
|
7287
7352
|
return () => el.removeEventListener("wheel", onWheel);
|
|
7288
7353
|
}, [pps, setZoom]);
|
|
7289
|
-
const timeAt = (0,
|
|
7354
|
+
const timeAt = (0, import_react32.useCallback)((clientX) => {
|
|
7290
7355
|
const el = innerRef.current;
|
|
7291
7356
|
if (!el) return 0;
|
|
7292
7357
|
return Math.max(0, (clientX - el.getBoundingClientRect().left - TL_HEAD_W) / pps);
|
|
7293
7358
|
}, [pps]);
|
|
7294
|
-
const beginGesture = (0,
|
|
7359
|
+
const beginGesture = (0, import_react32.useCallback)((e, spec) => {
|
|
7295
7360
|
e.preventDefault();
|
|
7296
7361
|
e.stopPropagation();
|
|
7297
7362
|
gesture.current = { ...spec, startX: e.clientX, active: false, value: null };
|
|
@@ -7325,12 +7390,12 @@ function Timeline({
|
|
|
7325
7390
|
window.addEventListener("pointermove", move);
|
|
7326
7391
|
window.addEventListener("pointerup", up);
|
|
7327
7392
|
}, [timeAt, snapping, snapTimes, pps, onSeek]);
|
|
7328
|
-
const onScrub = (0,
|
|
7393
|
+
const onScrub = (0, import_react32.useCallback)((e) => {
|
|
7329
7394
|
if (!onSeek) return;
|
|
7330
7395
|
onSeek(timeAt(e.clientX));
|
|
7331
7396
|
beginGesture(e, { kind: "scrub" });
|
|
7332
7397
|
}, [onSeek, timeAt, beginGesture]);
|
|
7333
|
-
const splitTarget = (0,
|
|
7398
|
+
const splitTarget = (0, import_react32.useMemo)(() => {
|
|
7334
7399
|
if (!onSplit) return null;
|
|
7335
7400
|
for (const track of rows) {
|
|
7336
7401
|
for (const l of track.laid) {
|
|
@@ -7342,17 +7407,17 @@ function Timeline({
|
|
|
7342
7407
|
}
|
|
7343
7408
|
return null;
|
|
7344
7409
|
}, [rows, currentTime, onSplit]);
|
|
7345
|
-
const doSplit = (0,
|
|
7410
|
+
const doSplit = (0, import_react32.useCallback)(() => {
|
|
7346
7411
|
if (!splitTarget) return;
|
|
7347
7412
|
onSplit(splitTarget.l.clip, currentTime - splitTarget.l.t0, splitTarget.track);
|
|
7348
7413
|
}, [splitTarget, currentTime, onSplit]);
|
|
7349
|
-
const selected = (0,
|
|
7414
|
+
const selected = (0, import_react32.useMemo)(() => {
|
|
7350
7415
|
for (const track of rows) for (const l of track.laid) {
|
|
7351
7416
|
if (l.clip.id === selectedClipId) return { track, l };
|
|
7352
7417
|
}
|
|
7353
7418
|
return null;
|
|
7354
7419
|
}, [rows, selectedClipId]);
|
|
7355
|
-
const onKeyDown = (0,
|
|
7420
|
+
const onKeyDown = (0, import_react32.useCallback)((e) => {
|
|
7356
7421
|
const tag = e.target?.tagName;
|
|
7357
7422
|
if (tag === "INPUT" || tag === "TEXTAREA" || e.target?.isContentEditable) return;
|
|
7358
7423
|
if (e.key === "+" || e.key === "=") {
|
|
@@ -7369,7 +7434,7 @@ function Timeline({
|
|
|
7369
7434
|
onDeleteClip(selected.l.clip, selected.track);
|
|
7370
7435
|
}
|
|
7371
7436
|
}, [pps, setZoom, doSplit, selected, onDeleteClip]);
|
|
7372
|
-
const toggleSnap = (0,
|
|
7437
|
+
const toggleSnap = (0, import_react32.useCallback)(() => {
|
|
7373
7438
|
setSnapping((v) => {
|
|
7374
7439
|
const next = !v;
|
|
7375
7440
|
if (snapStorageKey && typeof window !== "undefined") {
|