reifyui 0.1.0 → 0.2.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 +5 -3
- package/dist/index.cjs +344 -170
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +344 -170
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/styles/tasks.css +59 -0
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(src_exports, {
|
|
|
56
56
|
SESSION_EVENT: () => SESSION_EVENT,
|
|
57
57
|
SheetGrid: () => SheetGrid,
|
|
58
58
|
Svg: () => Svg,
|
|
59
|
+
TaskList: () => TaskList,
|
|
59
60
|
ToolGroup: () => ToolGroup,
|
|
60
61
|
ToolRow: () => ToolRow,
|
|
61
62
|
UserTurn: () => UserTurn,
|
|
@@ -87,6 +88,7 @@ __export(src_exports, {
|
|
|
87
88
|
sheetToDelimited: () => sheetToDelimited,
|
|
88
89
|
summarizeSteps: () => summarizeSteps,
|
|
89
90
|
switchOrg: () => switchOrg,
|
|
91
|
+
taskStatusGroup: () => taskStatusGroup,
|
|
90
92
|
toolMeta: () => toolMeta,
|
|
91
93
|
useResizablePane: () => useResizablePane,
|
|
92
94
|
withReasoning: () => withReasoning,
|
|
@@ -952,6 +954,178 @@ function PaneResizer(props) {
|
|
|
952
954
|
);
|
|
953
955
|
}
|
|
954
956
|
|
|
957
|
+
// src/components/TaskList.jsx
|
|
958
|
+
var import_react8 = require("react");
|
|
959
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
960
|
+
var STATUS_GROUPS = {
|
|
961
|
+
all: () => true,
|
|
962
|
+
working: (s) => ["running", "starting", "queued", "in_progress"].includes(s),
|
|
963
|
+
done: (s) => ["done", "completed"].includes(s),
|
|
964
|
+
failed: (s) => ["failed", "cancelled", "incomplete", "error"].includes(s)
|
|
965
|
+
};
|
|
966
|
+
function taskStatusGroup(status) {
|
|
967
|
+
const s = String(status || "").toLowerCase();
|
|
968
|
+
for (const k of ["working", "done", "failed"]) if (STATUS_GROUPS[k](s)) return k;
|
|
969
|
+
return "idle";
|
|
970
|
+
}
|
|
971
|
+
function relTime(ts) {
|
|
972
|
+
const n = Number(ts) || 0;
|
|
973
|
+
if (!n) return "";
|
|
974
|
+
const ms = n > 1e12 ? n : n * 1e3;
|
|
975
|
+
const d = Math.max(0, Date.now() - ms) / 1e3;
|
|
976
|
+
if (d < 60) return "just now";
|
|
977
|
+
if (d < 3600) return `${Math.floor(d / 60)}m ago`;
|
|
978
|
+
if (d < 86400) return `${Math.floor(d / 3600)}h ago`;
|
|
979
|
+
return `${Math.floor(d / 86400)}d ago`;
|
|
980
|
+
}
|
|
981
|
+
function TaskList({
|
|
982
|
+
fetchPage,
|
|
983
|
+
selected,
|
|
984
|
+
onSelect,
|
|
985
|
+
onNew,
|
|
986
|
+
onDelete,
|
|
987
|
+
header,
|
|
988
|
+
renderMeta,
|
|
989
|
+
refreshNonce = 0,
|
|
990
|
+
emptyLabel = "No tasks yet",
|
|
991
|
+
newLabel = "New task",
|
|
992
|
+
idKey = "id",
|
|
993
|
+
titleKey = "title",
|
|
994
|
+
statusKey = "status",
|
|
995
|
+
timeKey = "updated_at"
|
|
996
|
+
}) {
|
|
997
|
+
const [head, setHead] = (0, import_react8.useState)(null);
|
|
998
|
+
const [tail, setTail] = (0, import_react8.useState)([]);
|
|
999
|
+
const [cursor, setCursor] = (0, import_react8.useState)("");
|
|
1000
|
+
const [loadingMore, setLoadingMore] = (0, import_react8.useState)(false);
|
|
1001
|
+
const [q, setQ] = (0, import_react8.useState)("");
|
|
1002
|
+
const [statusFilter, setStatusFilter] = (0, import_react8.useState)("all");
|
|
1003
|
+
const alive = (0, import_react8.useRef)(true);
|
|
1004
|
+
(0, import_react8.useEffect)(() => () => {
|
|
1005
|
+
alive.current = false;
|
|
1006
|
+
}, []);
|
|
1007
|
+
(0, import_react8.useEffect)(() => {
|
|
1008
|
+
let ok = true;
|
|
1009
|
+
Promise.resolve(fetchPage("")).then((r) => {
|
|
1010
|
+
if (!ok) return;
|
|
1011
|
+
setHead(Array.isArray(r?.items) ? r.items : []);
|
|
1012
|
+
setCursor(r?.cursor || "");
|
|
1013
|
+
}).catch(() => {
|
|
1014
|
+
if (ok) setHead((p) => p ?? []);
|
|
1015
|
+
});
|
|
1016
|
+
return () => {
|
|
1017
|
+
ok = false;
|
|
1018
|
+
};
|
|
1019
|
+
}, [fetchPage, refreshNonce]);
|
|
1020
|
+
const loadMore = (0, import_react8.useCallback)(() => {
|
|
1021
|
+
if (!cursor || loadingMore) return;
|
|
1022
|
+
setLoadingMore(true);
|
|
1023
|
+
Promise.resolve(fetchPage(cursor)).then((r) => {
|
|
1024
|
+
if (!alive.current) return;
|
|
1025
|
+
if (Array.isArray(r?.items)) setTail((t) => [...t, ...r.items]);
|
|
1026
|
+
setCursor(r?.cursor || "");
|
|
1027
|
+
}).catch(() => {
|
|
1028
|
+
}).finally(() => {
|
|
1029
|
+
if (alive.current) setLoadingMore(false);
|
|
1030
|
+
});
|
|
1031
|
+
}, [cursor, loadingMore, fetchPage]);
|
|
1032
|
+
const items = (0, import_react8.useMemo)(() => {
|
|
1033
|
+
const h = head || [];
|
|
1034
|
+
const seen = new Set(h.map((x) => x?.[idKey]));
|
|
1035
|
+
return [...h, ...tail.filter((t) => !seen.has(t?.[idKey]))];
|
|
1036
|
+
}, [head, tail, idKey]);
|
|
1037
|
+
const shown = (0, import_react8.useMemo)(() => {
|
|
1038
|
+
const needle = q.trim().toLowerCase();
|
|
1039
|
+
const pass = STATUS_GROUPS[statusFilter] || STATUS_GROUPS.all;
|
|
1040
|
+
return items.filter((it) => {
|
|
1041
|
+
if (!pass(String(it?.[statusKey] || "").toLowerCase())) return false;
|
|
1042
|
+
if (!needle) return true;
|
|
1043
|
+
return String(it?.[titleKey] || "").toLowerCase().includes(needle);
|
|
1044
|
+
});
|
|
1045
|
+
}, [items, q, statusFilter, statusKey, titleKey]);
|
|
1046
|
+
const onScroll = (e) => {
|
|
1047
|
+
const el = e.currentTarget;
|
|
1048
|
+
if (el.scrollTop + el.clientHeight > el.scrollHeight - 140) loadMore();
|
|
1049
|
+
};
|
|
1050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "rui-tasks", children: [
|
|
1051
|
+
header ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "rui-tasks-header", children: header }) : null,
|
|
1052
|
+
onNew ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "rui-tasks-new", onClick: onNew, children: [
|
|
1053
|
+
"+ ",
|
|
1054
|
+
newLabel
|
|
1055
|
+
] }) : null,
|
|
1056
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "rui-tasks-filters", children: [
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1058
|
+
"input",
|
|
1059
|
+
{
|
|
1060
|
+
className: "rui-tasks-search",
|
|
1061
|
+
value: q,
|
|
1062
|
+
placeholder: "Filter tasks\u2026",
|
|
1063
|
+
onChange: (e) => setQ(e.target.value),
|
|
1064
|
+
"aria-label": "Filter tasks"
|
|
1065
|
+
}
|
|
1066
|
+
),
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1068
|
+
"select",
|
|
1069
|
+
{
|
|
1070
|
+
className: "rui-tasks-status",
|
|
1071
|
+
value: statusFilter,
|
|
1072
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
1073
|
+
"aria-label": "Filter by status",
|
|
1074
|
+
children: [
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "all", children: "All" }),
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "working", children: "Working" }),
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "done", children: "Done" }),
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "failed", children: "Failed" })
|
|
1079
|
+
]
|
|
1080
|
+
}
|
|
1081
|
+
)
|
|
1082
|
+
] }),
|
|
1083
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "rui-tasks-list", onScroll, children: [
|
|
1084
|
+
head === null ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "rui-tasks-empty", children: "Loading\u2026" }) : shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "rui-tasks-empty", children: items.length ? "No matching tasks" : emptyLabel }) : shown.map((it) => {
|
|
1085
|
+
const id = it?.[idKey];
|
|
1086
|
+
const group = taskStatusGroup(it?.[statusKey]);
|
|
1087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1088
|
+
"div",
|
|
1089
|
+
{
|
|
1090
|
+
className: `rui-task${id === selected ? " is-selected" : ""}`,
|
|
1091
|
+
onClick: () => onSelect?.(id),
|
|
1092
|
+
role: "button",
|
|
1093
|
+
tabIndex: 0,
|
|
1094
|
+
onKeyDown: (e) => {
|
|
1095
|
+
if (e.key === "Enter" || e.key === " ") onSelect?.(id);
|
|
1096
|
+
},
|
|
1097
|
+
children: [
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "rui-task-main", children: [
|
|
1099
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "rui-task-title", children: it?.[titleKey] || "Untitled task" }),
|
|
1100
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "rui-task-meta", children: renderMeta ? renderMeta(it) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: `rui-task-dot is-${group}` }),
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "rui-task-status", children: it?.[statusKey] || "" }),
|
|
1103
|
+
it?.[timeKey] ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "rui-task-time", children: relTime(it[timeKey]) }) : null
|
|
1104
|
+
] }) })
|
|
1105
|
+
] }),
|
|
1106
|
+
onDelete ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1107
|
+
"button",
|
|
1108
|
+
{
|
|
1109
|
+
type: "button",
|
|
1110
|
+
className: "rui-task-del",
|
|
1111
|
+
"aria-label": "Delete task",
|
|
1112
|
+
onClick: (e) => {
|
|
1113
|
+
e.stopPropagation();
|
|
1114
|
+
onDelete(it);
|
|
1115
|
+
},
|
|
1116
|
+
children: "\xD7"
|
|
1117
|
+
}
|
|
1118
|
+
) : null
|
|
1119
|
+
]
|
|
1120
|
+
},
|
|
1121
|
+
id
|
|
1122
|
+
);
|
|
1123
|
+
}),
|
|
1124
|
+
loadingMore ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "rui-tasks-empty", children: "Loading more\u2026" }) : null
|
|
1125
|
+
] })
|
|
1126
|
+
] });
|
|
1127
|
+
}
|
|
1128
|
+
|
|
955
1129
|
// src/auth/client.js
|
|
956
1130
|
var _cfg = {
|
|
957
1131
|
engine: "",
|
|
@@ -1101,18 +1275,18 @@ async function fetchBalance() {
|
|
|
1101
1275
|
}
|
|
1102
1276
|
|
|
1103
1277
|
// src/auth/AuthForm.jsx
|
|
1104
|
-
var
|
|
1278
|
+
var import_react10 = require("react");
|
|
1105
1279
|
|
|
1106
1280
|
// src/auth/GoogleButton.jsx
|
|
1107
|
-
var
|
|
1108
|
-
var
|
|
1281
|
+
var import_react9 = require("react");
|
|
1282
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1109
1283
|
var CLIENT_ID = "247853836408-ojk91u8901hdlbkevid4fohmrfdot17l.apps.googleusercontent.com";
|
|
1110
1284
|
function GoogleButton({ onCredential, onError }) {
|
|
1111
|
-
const ref = (0,
|
|
1112
|
-
const [failed, setFailed] = (0,
|
|
1113
|
-
const cb = (0,
|
|
1285
|
+
const ref = (0, import_react9.useRef)(null);
|
|
1286
|
+
const [failed, setFailed] = (0, import_react9.useState)(false);
|
|
1287
|
+
const cb = (0, import_react9.useRef)({ onCredential, onError });
|
|
1114
1288
|
cb.current = { onCredential, onError };
|
|
1115
|
-
(0,
|
|
1289
|
+
(0, import_react9.useEffect)(() => {
|
|
1116
1290
|
if (!CLIENT_ID || !ref.current) return void 0;
|
|
1117
1291
|
const SRC = "https://accounts.google.com/gsi/client";
|
|
1118
1292
|
let done = false;
|
|
@@ -1163,24 +1337,24 @@ function GoogleButton({ onCredential, onError }) {
|
|
|
1163
1337
|
};
|
|
1164
1338
|
}, []);
|
|
1165
1339
|
if (!CLIENT_ID || failed) return null;
|
|
1166
|
-
return /* @__PURE__ */ (0,
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1168
|
-
/* @__PURE__ */ (0,
|
|
1340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1341
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "auth-or", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "or" }) }),
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref, className: "auth-gwrap" })
|
|
1169
1343
|
] });
|
|
1170
1344
|
}
|
|
1171
1345
|
var GOOGLE_ENABLED = !!CLIENT_ID;
|
|
1172
1346
|
|
|
1173
1347
|
// src/auth/AuthForm.jsx
|
|
1174
|
-
var
|
|
1348
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1175
1349
|
function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
1176
|
-
const [mode, setMode] = (0,
|
|
1177
|
-
const [email, setEmail] = (0,
|
|
1178
|
-
const [password, setPassword] = (0,
|
|
1179
|
-
const [name, setName] = (0,
|
|
1180
|
-
const [err, setErr] = (0,
|
|
1181
|
-
const [busy, setBusy] = (0,
|
|
1182
|
-
const [choices, setChoices] = (0,
|
|
1183
|
-
const [resetSent, setResetSent] = (0,
|
|
1350
|
+
const [mode, setMode] = (0, import_react10.useState)("signin");
|
|
1351
|
+
const [email, setEmail] = (0, import_react10.useState)("");
|
|
1352
|
+
const [password, setPassword] = (0, import_react10.useState)("");
|
|
1353
|
+
const [name, setName] = (0, import_react10.useState)("");
|
|
1354
|
+
const [err, setErr] = (0, import_react10.useState)("");
|
|
1355
|
+
const [busy, setBusy] = (0, import_react10.useState)(false);
|
|
1356
|
+
const [choices, setChoices] = (0, import_react10.useState)(null);
|
|
1357
|
+
const [resetSent, setResetSent] = (0, import_react10.useState)(false);
|
|
1184
1358
|
async function enter(orgId) {
|
|
1185
1359
|
const session = await switchOrg(orgId);
|
|
1186
1360
|
onDone(session);
|
|
@@ -1221,10 +1395,10 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1221
1395
|
}
|
|
1222
1396
|
}
|
|
1223
1397
|
if (choices) {
|
|
1224
|
-
return /* @__PURE__ */ (0,
|
|
1225
|
-
/* @__PURE__ */ (0,
|
|
1226
|
-
/* @__PURE__ */ (0,
|
|
1227
|
-
/* @__PURE__ */ (0,
|
|
1398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "logo", children: brand }),
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { children: "Choose workspace" }),
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1228
1402
|
"button",
|
|
1229
1403
|
{
|
|
1230
1404
|
type: "button",
|
|
@@ -1242,20 +1416,20 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1242
1416
|
},
|
|
1243
1417
|
o.id
|
|
1244
1418
|
)) }),
|
|
1245
|
-
err && /* @__PURE__ */ (0,
|
|
1419
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "auth-err", children: err })
|
|
1246
1420
|
] });
|
|
1247
1421
|
}
|
|
1248
|
-
return /* @__PURE__ */ (0,
|
|
1249
|
-
/* @__PURE__ */ (0,
|
|
1250
|
-
/* @__PURE__ */ (0,
|
|
1251
|
-
/* @__PURE__ */ (0,
|
|
1252
|
-
mode === "forgot" ? resetSent ? /* @__PURE__ */ (0,
|
|
1253
|
-
/* @__PURE__ */ (0,
|
|
1422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("form", { onSubmit: submit, children: [
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "logo", children: brand }),
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
|
|
1425
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle || "Welcome back." }),
|
|
1426
|
+
mode === "forgot" ? resetSent ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "auth-note", children: [
|
|
1254
1428
|
"If an account exists for ",
|
|
1255
|
-
/* @__PURE__ */ (0,
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: email.trim() }),
|
|
1256
1430
|
", a password reset link is on its way. It is valid for 1 hour."
|
|
1257
1431
|
] }),
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1259
1433
|
"button",
|
|
1260
1434
|
{
|
|
1261
1435
|
type: "button",
|
|
@@ -1269,36 +1443,36 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1269
1443
|
children: "Back to sign in"
|
|
1270
1444
|
}
|
|
1271
1445
|
)
|
|
1272
|
-
] }) : /* @__PURE__ */ (0,
|
|
1273
|
-
/* @__PURE__ */ (0,
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1275
|
-
/* @__PURE__ */ (0,
|
|
1446
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1447
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "field", children: [
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { children: "Email" }),
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
1276
1450
|
] }),
|
|
1277
|
-
err && /* @__PURE__ */ (0,
|
|
1278
|
-
/* @__PURE__ */ (0,
|
|
1279
|
-
/* @__PURE__ */ (0,
|
|
1451
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "auth-err", children: err }),
|
|
1452
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "auth-switch", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", onClick: () => {
|
|
1280
1454
|
setErr("");
|
|
1281
1455
|
setMode("signin");
|
|
1282
1456
|
}, children: "Back to sign in" }) })
|
|
1283
|
-
] }) : /* @__PURE__ */ (0,
|
|
1284
|
-
mode === "register" && /* @__PURE__ */ (0,
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1457
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1458
|
+
mode === "register" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "field", children: [
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { children: "Name" }),
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
|
|
1287
1461
|
] }),
|
|
1288
|
-
/* @__PURE__ */ (0,
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1290
|
-
/* @__PURE__ */ (0,
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "field", children: [
|
|
1463
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { children: "Email" }),
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
1291
1465
|
] }),
|
|
1292
|
-
/* @__PURE__ */ (0,
|
|
1293
|
-
/* @__PURE__ */ (0,
|
|
1294
|
-
/* @__PURE__ */ (0,
|
|
1295
|
-
mode === "signin" && /* @__PURE__ */ (0,
|
|
1466
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "field", children: [
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "field-row", children: [
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { children: "Password" }),
|
|
1469
|
+
mode === "signin" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "link-sm", onClick: () => {
|
|
1296
1470
|
setErr("");
|
|
1297
1471
|
setResetSent(false);
|
|
1298
1472
|
setMode("forgot");
|
|
1299
1473
|
}, children: "Forgot password?" })
|
|
1300
1474
|
] }),
|
|
1301
|
-
/* @__PURE__ */ (0,
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1302
1476
|
"input",
|
|
1303
1477
|
{
|
|
1304
1478
|
className: "input",
|
|
@@ -1311,13 +1485,13 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1311
1485
|
}
|
|
1312
1486
|
)
|
|
1313
1487
|
] }),
|
|
1314
|
-
err && /* @__PURE__ */ (0,
|
|
1315
|
-
/* @__PURE__ */ (0,
|
|
1316
|
-
GOOGLE_ENABLED && /* @__PURE__ */ (0,
|
|
1317
|
-
/* @__PURE__ */ (0,
|
|
1488
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "auth-err", children: err }),
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
|
|
1490
|
+
GOOGLE_ENABLED && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GoogleButton, { onCredential: onGoogle, onError: setErr }),
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "auth-switch", children: [
|
|
1318
1492
|
mode === "register" ? "Already have an account?" : `New to ${productName || "the product"}?`,
|
|
1319
1493
|
" ",
|
|
1320
|
-
/* @__PURE__ */ (0,
|
|
1494
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", onClick: () => {
|
|
1321
1495
|
setErr("");
|
|
1322
1496
|
setMode(mode === "register" ? "signin" : "register");
|
|
1323
1497
|
}, children: mode === "register" ? "Sign in" : "Create one" })
|
|
@@ -1327,9 +1501,9 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1327
1501
|
}
|
|
1328
1502
|
|
|
1329
1503
|
// src/sheet/SheetGrid.jsx
|
|
1330
|
-
var
|
|
1504
|
+
var import_react11 = require("react");
|
|
1331
1505
|
var import_react_dom = require("react-dom");
|
|
1332
|
-
var
|
|
1506
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1333
1507
|
var cellKey = (rowId, colId) => `${rowId}:${colId}`;
|
|
1334
1508
|
var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1335
1509
|
var TYPE_LABEL = {
|
|
@@ -1353,7 +1527,7 @@ var COMPUTE_KINDS = [
|
|
|
1353
1527
|
var RESOURCE_KINDS = ["image", "sheet", "slides", "workflow", "graph"];
|
|
1354
1528
|
var RESOURCE_ICON = { image: "\u{1F5BC}", sheet: "\u25A6", slides: "\u25A4", workflow: "\u2699", graph: "\u25C9" };
|
|
1355
1529
|
function PopPortal({ anchor, width = 250, estHeight = 300, className, children, onClose }) {
|
|
1356
|
-
(0,
|
|
1530
|
+
(0, import_react11.useEffect)(() => {
|
|
1357
1531
|
if (!onClose) return void 0;
|
|
1358
1532
|
const close = () => onClose();
|
|
1359
1533
|
window.addEventListener("scroll", close, true);
|
|
@@ -1368,7 +1542,7 @@ function PopPortal({ anchor, width = 250, estHeight = 300, className, children,
|
|
|
1368
1542
|
let top = anchor.bottom + 6;
|
|
1369
1543
|
if (top + estHeight > window.innerHeight - 8) top = Math.max(8, anchor.top - estHeight - 6);
|
|
1370
1544
|
return (0, import_react_dom.createPortal)(
|
|
1371
|
-
/* @__PURE__ */ (0,
|
|
1545
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, style: { position: "fixed", top, left, width, zIndex: 1e3 }, children }),
|
|
1372
1546
|
document.body
|
|
1373
1547
|
);
|
|
1374
1548
|
}
|
|
@@ -1388,8 +1562,8 @@ function pillColor(label, options) {
|
|
|
1388
1562
|
return PILL_FALLBACKS[h % PILL_FALLBACKS.length];
|
|
1389
1563
|
}
|
|
1390
1564
|
function RefImage({ refVal, fetchBlobUrl }) {
|
|
1391
|
-
const [src, setSrc] = (0,
|
|
1392
|
-
(0,
|
|
1565
|
+
const [src, setSrc] = (0, import_react11.useState)(/^https?:\/\//i.test(refVal.url || "") ? refVal.url : null);
|
|
1566
|
+
(0, import_react11.useEffect)(() => {
|
|
1393
1567
|
let dead = false;
|
|
1394
1568
|
let obj = null;
|
|
1395
1569
|
if (!src && refVal.url && fetchBlobUrl) {
|
|
@@ -1405,16 +1579,16 @@ function RefImage({ refVal, fetchBlobUrl }) {
|
|
|
1405
1579
|
if (obj) URL.revokeObjectURL(obj);
|
|
1406
1580
|
};
|
|
1407
1581
|
}, [refVal.url]);
|
|
1408
|
-
if (!src) return /* @__PURE__ */ (0,
|
|
1582
|
+
if (!src) return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "shg-refchip", children: [
|
|
1409
1583
|
RESOURCE_ICON.image,
|
|
1410
1584
|
" ",
|
|
1411
1585
|
refVal.name || "image"
|
|
1412
1586
|
] });
|
|
1413
|
-
return /* @__PURE__ */ (0,
|
|
1587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { className: "shg-refimg", src, alt: refVal.name || "", title: refVal.name || "" });
|
|
1414
1588
|
}
|
|
1415
1589
|
function ResourceChip({ refVal, onOpen }) {
|
|
1416
1590
|
const icon = RESOURCE_ICON[refVal.kind] || "\u25C7";
|
|
1417
|
-
return /* @__PURE__ */ (0,
|
|
1591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1418
1592
|
"button",
|
|
1419
1593
|
{
|
|
1420
1594
|
className: "shg-refchip shg-refchip-btn",
|
|
@@ -1424,54 +1598,54 @@ function ResourceChip({ refVal, onOpen }) {
|
|
|
1424
1598
|
onOpen && onOpen(refVal);
|
|
1425
1599
|
},
|
|
1426
1600
|
children: [
|
|
1427
|
-
/* @__PURE__ */ (0,
|
|
1428
|
-
/* @__PURE__ */ (0,
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-refchip-ic", children: icon }),
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-refchip-name", children: refVal.name || refVal.id || refVal.kind })
|
|
1429
1603
|
]
|
|
1430
1604
|
}
|
|
1431
1605
|
);
|
|
1432
1606
|
}
|
|
1433
1607
|
function StatusDot({ status }) {
|
|
1434
1608
|
if (!status || status === "empty") return null;
|
|
1435
|
-
return /* @__PURE__ */ (0,
|
|
1609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `shg-dot shg-dot-${status}`, title: status });
|
|
1436
1610
|
}
|
|
1437
1611
|
function CellValue({ cell, col, fetchBlobUrl, onOpenResource }) {
|
|
1438
1612
|
const v = cell?.value;
|
|
1439
|
-
if (v === void 0 || v === null || v === "") return /* @__PURE__ */ (0,
|
|
1613
|
+
if (v === void 0 || v === null || v === "") return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-val-txt" });
|
|
1440
1614
|
if (v && typeof v === "object" && !Array.isArray(v) && v.kind) {
|
|
1441
|
-
if (v.kind === "image") return /* @__PURE__ */ (0,
|
|
1442
|
-
return /* @__PURE__ */ (0,
|
|
1615
|
+
if (v.kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RefImage, { refVal: v, fetchBlobUrl });
|
|
1616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ResourceChip, { refVal: v, onOpen: onOpenResource });
|
|
1443
1617
|
}
|
|
1444
1618
|
switch (col.type) {
|
|
1445
1619
|
case "select":
|
|
1446
|
-
return /* @__PURE__ */ (0,
|
|
1620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-pill", style: { background: pillColor(String(v), col.options) }, children: String(v) });
|
|
1447
1621
|
case "tags": {
|
|
1448
1622
|
const tags = Array.isArray(v) ? v : String(v).split(",").map((s) => s.trim()).filter(Boolean);
|
|
1449
|
-
return /* @__PURE__ */ (0,
|
|
1623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-pills", children: tags.map((t) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-pill", style: { background: pillColor(t, col.options) }, children: t }, t)) });
|
|
1450
1624
|
}
|
|
1451
1625
|
case "checkbox":
|
|
1452
|
-
return /* @__PURE__ */ (0,
|
|
1626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-check" + (v ? " on" : ""), children: v ? "\u2713" : "" });
|
|
1453
1627
|
case "url": {
|
|
1454
1628
|
const href = /^https?:\/\//i.test(String(v)) ? String(v) : `https://${v}`;
|
|
1455
|
-
return /* @__PURE__ */ (0,
|
|
1629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("a", { className: "shg-link", href, target: "_blank", rel: "noreferrer", onClick: (e) => e.stopPropagation(), children: String(v) });
|
|
1456
1630
|
}
|
|
1457
1631
|
case "number":
|
|
1458
|
-
return /* @__PURE__ */ (0,
|
|
1632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-val-txt shg-num", children: String(v) });
|
|
1459
1633
|
default:
|
|
1460
|
-
return /* @__PURE__ */ (0,
|
|
1634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-val-txt", children: typeof v === "object" ? JSON.stringify(v) : String(v) });
|
|
1461
1635
|
}
|
|
1462
1636
|
}
|
|
1463
1637
|
function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false, fetchBlobUrl, onOpenResource, peerMarks, onActiveCell }) {
|
|
1464
1638
|
const columns = sheet?.columns || [];
|
|
1465
1639
|
const rows = sheet?.rows || [];
|
|
1466
1640
|
const cells = sheet?.cells || {};
|
|
1467
|
-
const [editing, setEditing] = (0,
|
|
1468
|
-
const [draft, setDraft] = (0,
|
|
1469
|
-
const [menuCol, setMenuCol] = (0,
|
|
1470
|
-
const [sizeDraft, setSizeDraft] = (0,
|
|
1471
|
-
const [dnd, setDnd] = (0,
|
|
1472
|
-
const [dropAt, setDropAt] = (0,
|
|
1473
|
-
const inputRef = (0,
|
|
1474
|
-
const dragRef = (0,
|
|
1641
|
+
const [editing, setEditing] = (0, import_react11.useState)(null);
|
|
1642
|
+
const [draft, setDraft] = (0, import_react11.useState)("");
|
|
1643
|
+
const [menuCol, setMenuCol] = (0, import_react11.useState)(null);
|
|
1644
|
+
const [sizeDraft, setSizeDraft] = (0, import_react11.useState)({});
|
|
1645
|
+
const [dnd, setDnd] = (0, import_react11.useState)(null);
|
|
1646
|
+
const [dropAt, setDropAt] = (0, import_react11.useState)(null);
|
|
1647
|
+
const inputRef = (0, import_react11.useRef)(null);
|
|
1648
|
+
const dragRef = (0, import_react11.useRef)(null);
|
|
1475
1649
|
const startResize = (e, kind, id, start) => {
|
|
1476
1650
|
if (readOnly) return;
|
|
1477
1651
|
e.preventDefault();
|
|
@@ -1566,7 +1740,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1566
1740
|
const numW = Math.max(40, 24 + String(rows.length || 1).length * 9);
|
|
1567
1741
|
const numStyle = { width: numW, minWidth: numW, maxWidth: numW };
|
|
1568
1742
|
const rowHeight = (row) => sizeDraft.row && sizeDraft.row[row.id] || row.height || void 0;
|
|
1569
|
-
(0,
|
|
1743
|
+
(0, import_react11.useEffect)(() => {
|
|
1570
1744
|
if (editing && inputRef.current) inputRef.current.focus();
|
|
1571
1745
|
}, [editing]);
|
|
1572
1746
|
const mutate = (fn) => {
|
|
@@ -1633,7 +1807,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1633
1807
|
if (col.type === "resource") {
|
|
1634
1808
|
const d = typeof draft === "object" && draft ? draft : { kind: "sheet" };
|
|
1635
1809
|
const set = (k, v) => setDraft({ ...d, [k]: v });
|
|
1636
|
-
return /* @__PURE__ */ (0,
|
|
1810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1637
1811
|
PopPortal,
|
|
1638
1812
|
{
|
|
1639
1813
|
anchor: editing.rect,
|
|
@@ -1641,17 +1815,17 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1641
1815
|
estHeight: 230,
|
|
1642
1816
|
className: "shg-select-pop shg-ref-pop",
|
|
1643
1817
|
onClose: () => setEditing(null),
|
|
1644
|
-
children: /* @__PURE__ */ (0,
|
|
1645
|
-
/* @__PURE__ */ (0,
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
1649
|
-
/* @__PURE__ */ (0,
|
|
1650
|
-
/* @__PURE__ */ (0,
|
|
1818
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { className: "shg-menu-input", value: d.kind || "sheet", onChange: (e) => set("kind", e.target.value), children: RESOURCE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: k, children: k }, k)) }),
|
|
1820
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "shg-menu-input", placeholder: "Name", value: d.name || "", onChange: (e) => set("name", e.target.value) }),
|
|
1821
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "shg-menu-input", placeholder: "Resource id (e.g. sheet.\u2026)", value: d.id || "", onChange: (e) => set("id", e.target.value) }),
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "shg-menu-input", placeholder: "or URL", value: d.url || "", onChange: (e) => set("url", e.target.value) }),
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "shg-menu-actions", children: [
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "shg-pop-clear", onClick: () => {
|
|
1651
1825
|
setCell(editing.rowId, editing.colId, null);
|
|
1652
1826
|
setEditing(null);
|
|
1653
1827
|
}, children: "Clear" }),
|
|
1654
|
-
/* @__PURE__ */ (0,
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "shg-menu-apply", onClick: () => {
|
|
1655
1829
|
setCell(editing.rowId, editing.colId, d);
|
|
1656
1830
|
setEditing(null);
|
|
1657
1831
|
}, children: "Set" })
|
|
@@ -1662,7 +1836,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1662
1836
|
}
|
|
1663
1837
|
if (col.type === "select") {
|
|
1664
1838
|
const opts = normOptions(col.options);
|
|
1665
|
-
return /* @__PURE__ */ (0,
|
|
1839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1666
1840
|
PopPortal,
|
|
1667
1841
|
{
|
|
1668
1842
|
anchor: editing.rect,
|
|
@@ -1671,8 +1845,8 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1671
1845
|
className: "shg-select-pop",
|
|
1672
1846
|
onClose: () => setEditing(null),
|
|
1673
1847
|
children: [
|
|
1674
|
-
opts.length === 0 && /* @__PURE__ */ (0,
|
|
1675
|
-
opts.map((o) => /* @__PURE__ */ (0,
|
|
1848
|
+
opts.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "shg-pop-note", children: "No options yet \u2014 add them in the column menu." }),
|
|
1849
|
+
opts.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1676
1850
|
"button",
|
|
1677
1851
|
{
|
|
1678
1852
|
className: "shg-pill shg-pill-btn",
|
|
@@ -1686,7 +1860,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1686
1860
|
},
|
|
1687
1861
|
o.label
|
|
1688
1862
|
)),
|
|
1689
|
-
/* @__PURE__ */ (0,
|
|
1863
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1690
1864
|
"button",
|
|
1691
1865
|
{
|
|
1692
1866
|
className: "shg-pop-clear",
|
|
@@ -1703,7 +1877,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1703
1877
|
);
|
|
1704
1878
|
}
|
|
1705
1879
|
const inputType = col.type === "date" ? "date" : col.type === "number" ? "number" : "text";
|
|
1706
|
-
return /* @__PURE__ */ (0,
|
|
1880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1707
1881
|
"input",
|
|
1708
1882
|
{
|
|
1709
1883
|
ref: inputRef,
|
|
@@ -1720,18 +1894,18 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1720
1894
|
}
|
|
1721
1895
|
);
|
|
1722
1896
|
};
|
|
1723
|
-
return /* @__PURE__ */ (0,
|
|
1724
|
-
/* @__PURE__ */ (0,
|
|
1725
|
-
/* @__PURE__ */ (0,
|
|
1726
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
1897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "shg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "shg-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("table", { className: "shg-table", children: [
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("tr", { children: [
|
|
1899
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("th", { className: "shg-corner", style: numStyle }),
|
|
1900
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1727
1901
|
"th",
|
|
1728
1902
|
{
|
|
1729
1903
|
className: "shg-col" + (col.type === "compute" ? " shg-col-compute" : "") + dndClass("col", col.id),
|
|
1730
1904
|
style: colWidth(col) ? { width: colWidth(col), minWidth: colWidth(col), maxWidth: colWidth(col) } : void 0,
|
|
1731
1905
|
...dndProps("col", col.id),
|
|
1732
1906
|
children: [
|
|
1733
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1734
|
-
/* @__PURE__ */ (0,
|
|
1907
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-resize-col", onMouseDown: (e) => startResize(e, "col", col.id, colWidth(col) || e.currentTarget.closest("th").offsetWidth) }),
|
|
1908
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "shg-col-h", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1735
1909
|
ColumnHeader,
|
|
1736
1910
|
{
|
|
1737
1911
|
col,
|
|
@@ -1754,10 +1928,10 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1754
1928
|
},
|
|
1755
1929
|
col.id
|
|
1756
1930
|
)),
|
|
1757
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1931
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("th", { className: "shg-add-col", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "shg-add", onClick: addColumn, title: "Add column", children: "+" }) })
|
|
1758
1932
|
] }) }),
|
|
1759
|
-
/* @__PURE__ */ (0,
|
|
1760
|
-
rows.map((row, ri) => /* @__PURE__ */ (0,
|
|
1933
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("tbody", { children: [
|
|
1934
|
+
rows.map((row, ri) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1761
1935
|
"tr",
|
|
1762
1936
|
{
|
|
1763
1937
|
style: {
|
|
@@ -1765,7 +1939,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1765
1939
|
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
1766
1940
|
},
|
|
1767
1941
|
children: [
|
|
1768
|
-
/* @__PURE__ */ (0,
|
|
1942
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1769
1943
|
"td",
|
|
1770
1944
|
{
|
|
1771
1945
|
className: "shg-rownum" + dndClass("row", row.id),
|
|
@@ -1773,9 +1947,9 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1773
1947
|
title: "Drag to reorder",
|
|
1774
1948
|
...dndProps("row", row.id),
|
|
1775
1949
|
children: [
|
|
1776
|
-
/* @__PURE__ */ (0,
|
|
1777
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1778
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: ri + 1 }),
|
|
1951
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "shg-rowdel", onClick: () => deleteRow(row.id), title: "Delete row", children: "\xD7" }),
|
|
1952
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-resize-row", onMouseDown: (e) => startResize(e, "row", row.id, rowHeight(row) || e.currentTarget.closest("tr").offsetHeight) })
|
|
1779
1953
|
]
|
|
1780
1954
|
}
|
|
1781
1955
|
),
|
|
@@ -1783,7 +1957,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1783
1957
|
const c = cells[cellKey(row.id, col.id)] || {};
|
|
1784
1958
|
const isEditing = editing && editing.rowId === row.id && editing.colId === col.id;
|
|
1785
1959
|
const peer = peerMarks && peerMarks[cellKey(row.id, col.id)];
|
|
1786
|
-
return /* @__PURE__ */ (0,
|
|
1960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1787
1961
|
"td",
|
|
1788
1962
|
{
|
|
1789
1963
|
className: "shg-cell" + (col.type === "compute" ? " shg-cell-compute" : "") + (c.status && col.type === "compute" ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
|
|
@@ -1793,16 +1967,16 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1793
1967
|
},
|
|
1794
1968
|
title: c.error || "",
|
|
1795
1969
|
children: [
|
|
1796
|
-
peer && /* @__PURE__ */ (0,
|
|
1797
|
-
isEditing ? renderEditor(col) : /* @__PURE__ */ (0,
|
|
1970
|
+
peer && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
|
|
1971
|
+
isEditing ? renderEditor(col) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1798
1972
|
"div",
|
|
1799
1973
|
{
|
|
1800
1974
|
className: "shg-val",
|
|
1801
1975
|
style: { maxWidth: colWidth(col) ? colWidth(col) - 20 : 400 },
|
|
1802
1976
|
children: [
|
|
1803
|
-
col.type === "compute" && /* @__PURE__ */ (0,
|
|
1804
|
-
/* @__PURE__ */ (0,
|
|
1805
|
-
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */ (0,
|
|
1977
|
+
col.type === "compute" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StatusDot, { status: c.status }),
|
|
1978
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
|
|
1979
|
+
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1806
1980
|
"button",
|
|
1807
1981
|
{
|
|
1808
1982
|
className: "shg-runcell",
|
|
@@ -1822,25 +1996,25 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1822
1996
|
col.id
|
|
1823
1997
|
);
|
|
1824
1998
|
}),
|
|
1825
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1999
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { className: "shg-pad" })
|
|
1826
2000
|
]
|
|
1827
2001
|
},
|
|
1828
2002
|
row.id
|
|
1829
2003
|
)),
|
|
1830
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1831
|
-
/* @__PURE__ */ (0,
|
|
1832
|
-
/* @__PURE__ */ (0,
|
|
2004
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("tr", { className: "shg-ghost-row", onClick: addRow, children: [
|
|
2005
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { className: "shg-rownum shg-ghost-num", style: numStyle, children: "+" }),
|
|
2006
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { className: "shg-ghost-cell", colSpan: columns.length + 1, children: "New row" })
|
|
1833
2007
|
] })
|
|
1834
2008
|
] })
|
|
1835
2009
|
] }) }) });
|
|
1836
2010
|
}
|
|
1837
2011
|
function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, onCloseMenu, onRename, onConfigure, onDelete, onRun }) {
|
|
1838
|
-
const [editing, setEditing] = (0,
|
|
1839
|
-
const [name, setName] = (0,
|
|
1840
|
-
(0,
|
|
1841
|
-
return /* @__PURE__ */ (0,
|
|
1842
|
-
/* @__PURE__ */ (0,
|
|
1843
|
-
editing && !readOnly ? /* @__PURE__ */ (0,
|
|
2012
|
+
const [editing, setEditing] = (0, import_react11.useState)(false);
|
|
2013
|
+
const [name, setName] = (0, import_react11.useState)(col.name);
|
|
2014
|
+
(0, import_react11.useEffect)(() => setName(col.name), [col.name]);
|
|
2015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "shg-colhdr", children: [
|
|
2016
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "shg-colhdr-main", children: [
|
|
2017
|
+
editing && !readOnly ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1844
2018
|
"input",
|
|
1845
2019
|
{
|
|
1846
2020
|
className: "shg-colname-input",
|
|
@@ -1855,17 +2029,17 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
1855
2029
|
if (e.key === "Enter") e.target.blur();
|
|
1856
2030
|
}
|
|
1857
2031
|
}
|
|
1858
|
-
) : /* @__PURE__ */ (0,
|
|
1859
|
-
/* @__PURE__ */ (0,
|
|
2032
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "shg-colname", onDoubleClick: () => !readOnly && setEditing(true), title: col.name, children: col.name }),
|
|
2033
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "shg-coltype" + (col.type === "compute" ? " compute" : ""), children: [
|
|
1860
2034
|
TYPE_LABEL[col.type] || col.type,
|
|
1861
2035
|
col.type === "compute" && col.compute?.kind ? ` \xB7 ${col.compute.kind}` : ""
|
|
1862
2036
|
] })
|
|
1863
2037
|
] }),
|
|
1864
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1865
|
-
onRun && /* @__PURE__ */ (0,
|
|
1866
|
-
/* @__PURE__ */ (0,
|
|
2038
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "shg-colhdr-tools", children: [
|
|
2039
|
+
onRun && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "shg-colrun", onClick: onRun, title: "Run this column", children: "\u25B6 Run" }),
|
|
2040
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "shg-colmenu-btn", onClick: (e) => onMenu(e), title: "Column settings", children: "\u22EF" })
|
|
1867
2041
|
] }),
|
|
1868
|
-
menuOpen && !readOnly && /* @__PURE__ */ (0,
|
|
2042
|
+
menuOpen && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1869
2043
|
ColumnMenu,
|
|
1870
2044
|
{
|
|
1871
2045
|
col,
|
|
@@ -1882,19 +2056,19 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
1882
2056
|
] });
|
|
1883
2057
|
}
|
|
1884
2058
|
function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
1885
|
-
const [type, setType] = (0,
|
|
1886
|
-
const [optText, setOptText] = (0,
|
|
2059
|
+
const [type, setType] = (0, import_react11.useState)(col.type || "text");
|
|
2060
|
+
const [optText, setOptText] = (0, import_react11.useState)(
|
|
1887
2061
|
normOptions(col.options).map((o) => o.label).join("\n")
|
|
1888
2062
|
);
|
|
1889
2063
|
const comp = col.compute || {};
|
|
1890
|
-
const [kind, setKind] = (0,
|
|
1891
|
-
const [prompt, setPrompt] = (0,
|
|
1892
|
-
const [harnessId, setHarnessId] = (0,
|
|
1893
|
-
const [wfSlug, setWfSlug] = (0,
|
|
1894
|
-
const [outKey, setOutKey] = (0,
|
|
1895
|
-
const [deps, setDeps] = (0,
|
|
1896
|
-
const ref = (0,
|
|
1897
|
-
(0,
|
|
2064
|
+
const [kind, setKind] = (0, import_react11.useState)(comp.kind || "prompt");
|
|
2065
|
+
const [prompt, setPrompt] = (0, import_react11.useState)(comp.prompt || "");
|
|
2066
|
+
const [harnessId, setHarnessId] = (0, import_react11.useState)(comp.harness_id || "");
|
|
2067
|
+
const [wfSlug, setWfSlug] = (0, import_react11.useState)(comp.workflow_slug || "");
|
|
2068
|
+
const [outKey, setOutKey] = (0, import_react11.useState)(comp.output_key || "");
|
|
2069
|
+
const [deps, setDeps] = (0, import_react11.useState)(new Set(comp.deps || []));
|
|
2070
|
+
const ref = (0, import_react11.useRef)(null);
|
|
2071
|
+
(0, import_react11.useEffect)(() => {
|
|
1898
2072
|
const onDown = (e) => {
|
|
1899
2073
|
if (ref.current && !ref.current.contains(e.target)) onClose();
|
|
1900
2074
|
};
|
|
@@ -1928,17 +2102,17 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
1928
2102
|
}
|
|
1929
2103
|
onApply(patch);
|
|
1930
2104
|
};
|
|
1931
|
-
return /* @__PURE__ */ (0,
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopPortal, { anchor, width: 250, estHeight: 340, className: "shg-menu", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref, onClick: (e) => e.stopPropagation(), children: [
|
|
2106
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
1933
2107
|
"Type",
|
|
1934
|
-
/* @__PURE__ */ (0,
|
|
1935
|
-
MANUAL_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
1936
|
-
/* @__PURE__ */ (0,
|
|
2108
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { className: "shg-menu-input", value: type, onChange: (e) => setType(e.target.value), children: [
|
|
2109
|
+
MANUAL_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: t, children: TYPE_LABEL[t] }, t)),
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "compute", children: "Computed" })
|
|
1937
2111
|
] })
|
|
1938
2112
|
] }),
|
|
1939
|
-
(type === "select" || type === "tags") && /* @__PURE__ */ (0,
|
|
2113
|
+
(type === "select" || type === "tags") && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
1940
2114
|
"Options (one per line)",
|
|
1941
|
-
/* @__PURE__ */ (0,
|
|
2115
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1942
2116
|
"textarea",
|
|
1943
2117
|
{
|
|
1944
2118
|
className: "shg-menu-input",
|
|
@@ -1949,15 +2123,15 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
1949
2123
|
}
|
|
1950
2124
|
)
|
|
1951
2125
|
] }),
|
|
1952
|
-
type === "compute" && /* @__PURE__ */ (0,
|
|
1953
|
-
/* @__PURE__ */ (0,
|
|
2126
|
+
type === "compute" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
1954
2128
|
"Runs",
|
|
1955
|
-
/* @__PURE__ */ (0,
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { className: "shg-menu-input", value: kind, onChange: (e) => setKind(e.target.value), children: COMPUTE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: k.kind, children: k.label }, k.kind)) })
|
|
1956
2130
|
] }),
|
|
1957
|
-
(kind === "prompt" || kind === "harness") && /* @__PURE__ */ (0,
|
|
2131
|
+
(kind === "prompt" || kind === "harness") && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
1958
2132
|
"Prompt \u2014 reference columns as ",
|
|
1959
2133
|
"{{Name}}",
|
|
1960
|
-
/* @__PURE__ */ (0,
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1961
2135
|
"textarea",
|
|
1962
2136
|
{
|
|
1963
2137
|
className: "shg-menu-input",
|
|
@@ -1968,32 +2142,32 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
1968
2142
|
}
|
|
1969
2143
|
)
|
|
1970
2144
|
] }),
|
|
1971
|
-
kind === "harness" && /* @__PURE__ */ (0,
|
|
2145
|
+
kind === "harness" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
1972
2146
|
"Agent id",
|
|
1973
|
-
/* @__PURE__ */ (0,
|
|
2147
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "shg-menu-input", value: harnessId, onChange: (e) => setHarnessId(e.target.value), placeholder: "chrn_\u2026" })
|
|
1974
2148
|
] }),
|
|
1975
|
-
kind === "workflow" && /* @__PURE__ */ (0,
|
|
1976
|
-
/* @__PURE__ */ (0,
|
|
2149
|
+
kind === "workflow" && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2150
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
1977
2151
|
"Workflow id",
|
|
1978
|
-
/* @__PURE__ */ (0,
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "shg-menu-input", value: wfSlug, onChange: (e) => setWfSlug(e.target.value), placeholder: "my-workflow" })
|
|
1979
2153
|
] }),
|
|
1980
|
-
/* @__PURE__ */ (0,
|
|
2154
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
1981
2155
|
"Output key (optional)",
|
|
1982
|
-
/* @__PURE__ */ (0,
|
|
2156
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "shg-menu-input", value: outKey, onChange: (e) => setOutKey(e.target.value), placeholder: "summary" })
|
|
1983
2157
|
] })
|
|
1984
2158
|
] }),
|
|
1985
|
-
others.length > 0 && /* @__PURE__ */ (0,
|
|
2159
|
+
others.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "shg-menu-lbl", children: [
|
|
1986
2160
|
"Reads columns",
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
1988
|
-
/* @__PURE__ */ (0,
|
|
2161
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "shg-menu-deps", children: others.map((c) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "shg-menu-dep", children: [
|
|
2162
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: deps.has(c.id), onChange: () => toggleDep(c.id) }),
|
|
1989
2163
|
" ",
|
|
1990
2164
|
c.name
|
|
1991
2165
|
] }, c.id)) })
|
|
1992
2166
|
] })
|
|
1993
2167
|
] }),
|
|
1994
|
-
/* @__PURE__ */ (0,
|
|
1995
|
-
/* @__PURE__ */ (0,
|
|
1996
|
-
/* @__PURE__ */ (0,
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "shg-menu-actions", children: [
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "shg-menu-del", onClick: onDelete, children: "Delete column" }),
|
|
2170
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className: "shg-menu-apply", onClick: apply, children: "Apply" })
|
|
1997
2171
|
] })
|
|
1998
2172
|
] }) });
|
|
1999
2173
|
}
|