reifyui 0.2.0 → 0.4.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 +61 -10
- package/dist/index.cjs +407 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +128 -22
- package/dist/index.js +416 -172
- package/dist/index.js.map +1 -1
- package/dist/slides.cjs +737 -0
- package/dist/slides.cjs.map +1 -0
- package/dist/slides.d.ts +125 -0
- package/dist/slides.js +705 -0
- package/dist/slides.js.map +1 -0
- package/package.json +9 -2
- package/src/auth/AuthForm.jsx +187 -0
- package/src/auth/GoogleButton.jsx +80 -0
- package/src/auth/client.js +177 -0
- package/src/components/ChatMessages.jsx +194 -0
- package/src/components/CodeBlock.jsx +120 -0
- package/src/components/Composer.jsx +75 -0
- package/src/components/Dialog.jsx +312 -0
- package/src/components/TaskList.jsx +193 -0
- package/src/components/ToolSteps.jsx +84 -0
- package/src/components/icons.jsx +33 -0
- package/src/components/resizable.jsx +84 -0
- package/src/components/toolMeta.js +91 -0
- package/src/index.d.ts +234 -0
- package/src/index.js +35 -0
- package/src/sheet/SheetGrid.jsx +633 -0
- package/src/slides/Editor.jsx +246 -0
- package/src/slides/Presentation.jsx +79 -0
- package/src/slides/SlideView.jsx +97 -0
- package/src/slides/elements.jsx +178 -0
- package/src/slides/index.d.ts +125 -0
- package/src/slides/index.js +10 -0
- package/src/state/blocks.js +37 -0
- package/src/state/conversationStore.js +55 -0
- package/src/stream/responses.js +122 -0
- package/styles/dialog.css +145 -0
- package/styles/slides.css +38 -0
package/dist/index.js
CHANGED
|
@@ -1026,6 +1026,248 @@ function TaskList({
|
|
|
1026
1026
|
] });
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
|
+
// src/components/Dialog.jsx
|
|
1030
|
+
import {
|
|
1031
|
+
createContext,
|
|
1032
|
+
useCallback as useCallback3,
|
|
1033
|
+
useContext,
|
|
1034
|
+
useEffect as useEffect4,
|
|
1035
|
+
useId,
|
|
1036
|
+
useMemo as useMemo2,
|
|
1037
|
+
useRef as useRef4,
|
|
1038
|
+
useState as useState4
|
|
1039
|
+
} from "react";
|
|
1040
|
+
import { createPortal } from "react-dom";
|
|
1041
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1042
|
+
var DialogCtx = createContext(null);
|
|
1043
|
+
var LABELS = {
|
|
1044
|
+
en: { confirm: "Confirm", cancel: "Cancel", ok: "OK", create: "Create", required: "Please enter a value" },
|
|
1045
|
+
zh: { confirm: "\u786E\u8BA4", cancel: "\u53D6\u6D88", ok: "\u597D\u7684", create: "\u521B\u5EFA", required: "\u8BF7\u8F93\u5165\u5185\u5BB9" }
|
|
1046
|
+
};
|
|
1047
|
+
var _idSeq = 0;
|
|
1048
|
+
function DialogHost({ children, locale = "en", labels }) {
|
|
1049
|
+
const [stack, setStack] = useState4([]);
|
|
1050
|
+
const t = useMemo2(
|
|
1051
|
+
() => ({ ...LABELS[locale] || LABELS.en, ...labels || {} }),
|
|
1052
|
+
[locale, labels]
|
|
1053
|
+
);
|
|
1054
|
+
const open = useCallback3((spec) => new Promise((resolve) => {
|
|
1055
|
+
setStack((s) => [...s, { id: `dlg_${++_idSeq}`, spec, resolve }]);
|
|
1056
|
+
}), []);
|
|
1057
|
+
const close = useCallback3((id, value) => {
|
|
1058
|
+
setStack((s) => {
|
|
1059
|
+
const target = s.find((d) => d.id === id);
|
|
1060
|
+
if (target) target.resolve(value);
|
|
1061
|
+
return s.filter((d) => d.id !== id);
|
|
1062
|
+
});
|
|
1063
|
+
}, []);
|
|
1064
|
+
const ctx = useMemo2(() => ({
|
|
1065
|
+
confirm: (opts) => open({ kind: "confirm", ...opts }),
|
|
1066
|
+
prompt: (opts) => open({ kind: "prompt", ...opts }),
|
|
1067
|
+
alert: (opts) => open({ kind: "alert", ...opts }),
|
|
1068
|
+
create: (opts) => open({ kind: "create", ...opts }),
|
|
1069
|
+
labels: t
|
|
1070
|
+
}), [open, t]);
|
|
1071
|
+
return /* @__PURE__ */ jsxs7(DialogCtx.Provider, { value: ctx, children: [
|
|
1072
|
+
children,
|
|
1073
|
+
stack.length > 0 && typeof document !== "undefined" && createPortal(
|
|
1074
|
+
/* @__PURE__ */ jsx8("div", { className: "rui-dlg-root", role: "presentation", children: stack.map((d, i) => /* @__PURE__ */ jsx8(DialogShell, { dialog: d, isTop: i === stack.length - 1, onClose: close, t }, d.id)) }),
|
|
1075
|
+
document.body
|
|
1076
|
+
)
|
|
1077
|
+
] });
|
|
1078
|
+
}
|
|
1079
|
+
function useDialog() {
|
|
1080
|
+
const ctx = useContext(DialogCtx);
|
|
1081
|
+
if (!ctx) throw new Error("useDialog() called outside <DialogHost>");
|
|
1082
|
+
return ctx;
|
|
1083
|
+
}
|
|
1084
|
+
var cancelValue = (kind) => kind === "prompt" || kind === "create" ? null : false;
|
|
1085
|
+
function DialogShell({ dialog, isTop, onClose, t }) {
|
|
1086
|
+
const { id, spec } = dialog;
|
|
1087
|
+
const ref = useRef4(null);
|
|
1088
|
+
const titleId = useId();
|
|
1089
|
+
useEffect4(() => {
|
|
1090
|
+
if (!isTop) return void 0;
|
|
1091
|
+
const onKey = (e) => {
|
|
1092
|
+
if (e.key !== "Escape") return;
|
|
1093
|
+
e.preventDefault();
|
|
1094
|
+
onClose(id, cancelValue(spec.kind));
|
|
1095
|
+
};
|
|
1096
|
+
document.addEventListener("keydown", onKey);
|
|
1097
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
1098
|
+
}, [id, isTop, onClose, spec.kind]);
|
|
1099
|
+
useEffect4(() => {
|
|
1100
|
+
if (!isTop || !ref.current) return;
|
|
1101
|
+
const el = ref.current.querySelector("input, textarea") || ref.current.querySelector(".rui-dlg-primary") || ref.current.querySelector("button");
|
|
1102
|
+
el?.focus();
|
|
1103
|
+
}, [isTop]);
|
|
1104
|
+
const onBackdrop = (e) => {
|
|
1105
|
+
if (e.target === e.currentTarget && isTop) onClose(id, cancelValue(spec.kind));
|
|
1106
|
+
};
|
|
1107
|
+
const done = (v) => onClose(id, v);
|
|
1108
|
+
return /* @__PURE__ */ jsx8("div", { className: "rui-dlg-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ jsxs7(
|
|
1109
|
+
"div",
|
|
1110
|
+
{
|
|
1111
|
+
ref,
|
|
1112
|
+
role: "dialog",
|
|
1113
|
+
"aria-modal": "true",
|
|
1114
|
+
"aria-labelledby": spec.title ? titleId : void 0,
|
|
1115
|
+
className: `rui-dlg-card${spec.kind === "create" ? " is-wide" : ""}`,
|
|
1116
|
+
children: [
|
|
1117
|
+
spec.kind === "alert" && /* @__PURE__ */ jsx8(AlertBody, { spec, onClose: done, t, titleId }),
|
|
1118
|
+
spec.kind === "confirm" && /* @__PURE__ */ jsx8(ConfirmBody, { spec, onClose: done, t, titleId }),
|
|
1119
|
+
spec.kind === "prompt" && /* @__PURE__ */ jsx8(PromptBody, { spec, onClose: done, t, titleId }),
|
|
1120
|
+
spec.kind === "create" && /* @__PURE__ */ jsx8(CreateBody, { spec, onClose: done, t, titleId })
|
|
1121
|
+
]
|
|
1122
|
+
}
|
|
1123
|
+
) });
|
|
1124
|
+
}
|
|
1125
|
+
function Header({ title, variant, titleId }) {
|
|
1126
|
+
if (!title) return null;
|
|
1127
|
+
return /* @__PURE__ */ jsx8("div", { className: `rui-dlg-h${variant ? ` is-${variant}` : ""}`, children: /* @__PURE__ */ jsx8("div", { className: "rui-dlg-title", id: titleId, children: title }) });
|
|
1128
|
+
}
|
|
1129
|
+
var Footer = ({ children }) => /* @__PURE__ */ jsx8("div", { className: "rui-dlg-f", children });
|
|
1130
|
+
function AlertBody({ spec, onClose, t, titleId }) {
|
|
1131
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1132
|
+
/* @__PURE__ */ jsx8(Header, { title: spec.title, variant: spec.variant, titleId }),
|
|
1133
|
+
/* @__PURE__ */ jsx8("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
|
|
1134
|
+
/* @__PURE__ */ jsx8(Footer, { children: /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: () => onClose(true), children: spec.confirmLabel || t.ok }) })
|
|
1135
|
+
] });
|
|
1136
|
+
}
|
|
1137
|
+
function ConfirmBody({ spec, onClose, t, titleId }) {
|
|
1138
|
+
const destructive = !!spec.destructive;
|
|
1139
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1140
|
+
/* @__PURE__ */ jsx8(Header, { title: spec.title, variant: destructive ? "destructive" : spec.variant, titleId }),
|
|
1141
|
+
/* @__PURE__ */ jsx8("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
|
|
1142
|
+
/* @__PURE__ */ jsxs7(Footer, { children: [
|
|
1143
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(false), children: spec.cancelLabel || t.cancel }),
|
|
1144
|
+
/* @__PURE__ */ jsx8(
|
|
1145
|
+
"button",
|
|
1146
|
+
{
|
|
1147
|
+
type: "button",
|
|
1148
|
+
className: `rui-dlg-btn rui-dlg-primary${destructive ? " is-destructive" : ""}`,
|
|
1149
|
+
onClick: () => onClose(true),
|
|
1150
|
+
children: spec.confirmLabel || t.confirm
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] })
|
|
1154
|
+
] });
|
|
1155
|
+
}
|
|
1156
|
+
function PromptBody({ spec, onClose, t, titleId }) {
|
|
1157
|
+
const [value, setValue] = useState4(spec.defaultValue ?? "");
|
|
1158
|
+
const [err, setErr] = useState4(null);
|
|
1159
|
+
const inputId = useId();
|
|
1160
|
+
const Field = spec.multiline ? "textarea" : "input";
|
|
1161
|
+
const submit = () => {
|
|
1162
|
+
const invalid = spec.validate?.(value);
|
|
1163
|
+
if (invalid) {
|
|
1164
|
+
setErr(String(invalid));
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
if (spec.required !== false && !String(value).trim()) {
|
|
1168
|
+
setErr(t.required);
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
onClose(String(value));
|
|
1172
|
+
};
|
|
1173
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1174
|
+
/* @__PURE__ */ jsx8(Header, { title: spec.title, variant: spec.variant, titleId }),
|
|
1175
|
+
/* @__PURE__ */ jsxs7("div", { className: "rui-dlg-b", children: [
|
|
1176
|
+
spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null,
|
|
1177
|
+
spec.label ? /* @__PURE__ */ jsx8("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
|
|
1178
|
+
/* @__PURE__ */ jsx8(
|
|
1179
|
+
Field,
|
|
1180
|
+
{
|
|
1181
|
+
id: inputId,
|
|
1182
|
+
className: `rui-dlg-input${err ? " is-err" : ""}`,
|
|
1183
|
+
type: spec.multiline ? void 0 : spec.inputType || "text",
|
|
1184
|
+
rows: spec.multiline ? spec.rows || 4 : void 0,
|
|
1185
|
+
value,
|
|
1186
|
+
placeholder: spec.placeholder || "",
|
|
1187
|
+
onChange: (e) => {
|
|
1188
|
+
setValue(e.target.value);
|
|
1189
|
+
if (err) setErr(null);
|
|
1190
|
+
},
|
|
1191
|
+
onKeyDown: (e) => {
|
|
1192
|
+
if (e.key === "Enter" && !e.shiftKey && !spec.multiline) {
|
|
1193
|
+
e.preventDefault();
|
|
1194
|
+
submit();
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
autoComplete: "off",
|
|
1198
|
+
spellCheck: "false"
|
|
1199
|
+
}
|
|
1200
|
+
),
|
|
1201
|
+
err ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-err", children: err }) : null,
|
|
1202
|
+
!err && spec.help ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-help", children: spec.help }) : null
|
|
1203
|
+
] }),
|
|
1204
|
+
/* @__PURE__ */ jsxs7(Footer, { children: [
|
|
1205
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
|
|
1206
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.confirm })
|
|
1207
|
+
] })
|
|
1208
|
+
] });
|
|
1209
|
+
}
|
|
1210
|
+
function CreateBody({ spec, onClose, t, titleId }) {
|
|
1211
|
+
const types = spec.types || [];
|
|
1212
|
+
const [kind, setKind] = useState4(spec.defaultKind || types[0]?.kind || "");
|
|
1213
|
+
const [value, setValue] = useState4(spec.defaultValue ?? "");
|
|
1214
|
+
const [err, setErr] = useState4(null);
|
|
1215
|
+
const inputId = useId();
|
|
1216
|
+
const sel = types.find((x) => x.kind === kind) || types[0] || {};
|
|
1217
|
+
const submit = () => {
|
|
1218
|
+
if (spec.required !== false && !String(value).trim()) {
|
|
1219
|
+
setErr(t.required);
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
onClose({ kind, name: String(value).trim() });
|
|
1223
|
+
};
|
|
1224
|
+
return /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1225
|
+
/* @__PURE__ */ jsx8(Header, { title: spec.title, titleId }),
|
|
1226
|
+
/* @__PURE__ */ jsxs7("div", { className: "rui-dlg-b", children: [
|
|
1227
|
+
types.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-typegrid", children: types.map((ty) => /* @__PURE__ */ jsxs7(
|
|
1228
|
+
"button",
|
|
1229
|
+
{
|
|
1230
|
+
type: "button",
|
|
1231
|
+
className: `rui-dlg-type${ty.kind === kind ? " is-on" : ""}`,
|
|
1232
|
+
onClick: () => setKind(ty.kind),
|
|
1233
|
+
children: [
|
|
1234
|
+
ty.icon ? /* @__PURE__ */ jsx8("span", { className: "rui-dlg-type-ic", style: ty.color ? { color: ty.color, background: `${ty.color}1f` } : void 0, children: ty.icon }) : null,
|
|
1235
|
+
/* @__PURE__ */ jsx8("span", { className: "rui-dlg-type-lbl", children: ty.label })
|
|
1236
|
+
]
|
|
1237
|
+
},
|
|
1238
|
+
ty.kind
|
|
1239
|
+
)) }) : null,
|
|
1240
|
+
/* @__PURE__ */ jsx8("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label || `${sel.label || "Item"} name` }),
|
|
1241
|
+
/* @__PURE__ */ jsx8(
|
|
1242
|
+
"input",
|
|
1243
|
+
{
|
|
1244
|
+
id: inputId,
|
|
1245
|
+
className: `rui-dlg-input${err ? " is-err" : ""}`,
|
|
1246
|
+
value,
|
|
1247
|
+
placeholder: spec.placeholder || "Untitled",
|
|
1248
|
+
onChange: (e) => {
|
|
1249
|
+
setValue(e.target.value);
|
|
1250
|
+
if (err) setErr(null);
|
|
1251
|
+
},
|
|
1252
|
+
onKeyDown: (e) => {
|
|
1253
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
1254
|
+
e.preventDefault();
|
|
1255
|
+
submit();
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1258
|
+
autoComplete: "off",
|
|
1259
|
+
spellCheck: "false"
|
|
1260
|
+
}
|
|
1261
|
+
),
|
|
1262
|
+
err ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-err", children: err }) : null
|
|
1263
|
+
] }),
|
|
1264
|
+
/* @__PURE__ */ jsxs7(Footer, { children: [
|
|
1265
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
|
|
1266
|
+
/* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.create })
|
|
1267
|
+
] })
|
|
1268
|
+
] });
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1029
1271
|
// src/auth/client.js
|
|
1030
1272
|
var _cfg = {
|
|
1031
1273
|
engine: "",
|
|
@@ -1175,18 +1417,18 @@ async function fetchBalance() {
|
|
|
1175
1417
|
}
|
|
1176
1418
|
|
|
1177
1419
|
// src/auth/AuthForm.jsx
|
|
1178
|
-
import { useState as
|
|
1420
|
+
import { useState as useState6 } from "react";
|
|
1179
1421
|
|
|
1180
1422
|
// src/auth/GoogleButton.jsx
|
|
1181
|
-
import { useEffect as
|
|
1182
|
-
import { Fragment as
|
|
1423
|
+
import { useEffect as useEffect5, useRef as useRef5, useState as useState5 } from "react";
|
|
1424
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1183
1425
|
var CLIENT_ID = "247853836408-ojk91u8901hdlbkevid4fohmrfdot17l.apps.googleusercontent.com";
|
|
1184
1426
|
function GoogleButton({ onCredential, onError }) {
|
|
1185
|
-
const ref =
|
|
1186
|
-
const [failed, setFailed] =
|
|
1187
|
-
const cb =
|
|
1427
|
+
const ref = useRef5(null);
|
|
1428
|
+
const [failed, setFailed] = useState5(false);
|
|
1429
|
+
const cb = useRef5({ onCredential, onError });
|
|
1188
1430
|
cb.current = { onCredential, onError };
|
|
1189
|
-
|
|
1431
|
+
useEffect5(() => {
|
|
1190
1432
|
if (!CLIENT_ID || !ref.current) return void 0;
|
|
1191
1433
|
const SRC = "https://accounts.google.com/gsi/client";
|
|
1192
1434
|
let done = false;
|
|
@@ -1237,24 +1479,24 @@ function GoogleButton({ onCredential, onError }) {
|
|
|
1237
1479
|
};
|
|
1238
1480
|
}, []);
|
|
1239
1481
|
if (!CLIENT_ID || failed) return null;
|
|
1240
|
-
return /* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */
|
|
1242
|
-
/* @__PURE__ */
|
|
1482
|
+
return /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
1483
|
+
/* @__PURE__ */ jsx9("div", { className: "auth-or", children: /* @__PURE__ */ jsx9("span", { children: "or" }) }),
|
|
1484
|
+
/* @__PURE__ */ jsx9("div", { ref, className: "auth-gwrap" })
|
|
1243
1485
|
] });
|
|
1244
1486
|
}
|
|
1245
1487
|
var GOOGLE_ENABLED = !!CLIENT_ID;
|
|
1246
1488
|
|
|
1247
1489
|
// src/auth/AuthForm.jsx
|
|
1248
|
-
import { Fragment as
|
|
1490
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1249
1491
|
function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
1250
|
-
const [mode, setMode] =
|
|
1251
|
-
const [email, setEmail] =
|
|
1252
|
-
const [password, setPassword] =
|
|
1253
|
-
const [name, setName] =
|
|
1254
|
-
const [err, setErr] =
|
|
1255
|
-
const [busy, setBusy] =
|
|
1256
|
-
const [choices, setChoices] =
|
|
1257
|
-
const [resetSent, setResetSent] =
|
|
1492
|
+
const [mode, setMode] = useState6("signin");
|
|
1493
|
+
const [email, setEmail] = useState6("");
|
|
1494
|
+
const [password, setPassword] = useState6("");
|
|
1495
|
+
const [name, setName] = useState6("");
|
|
1496
|
+
const [err, setErr] = useState6("");
|
|
1497
|
+
const [busy, setBusy] = useState6(false);
|
|
1498
|
+
const [choices, setChoices] = useState6(null);
|
|
1499
|
+
const [resetSent, setResetSent] = useState6(false);
|
|
1258
1500
|
async function enter(orgId) {
|
|
1259
1501
|
const session = await switchOrg(orgId);
|
|
1260
1502
|
onDone(session);
|
|
@@ -1295,10 +1537,10 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1295
1537
|
}
|
|
1296
1538
|
}
|
|
1297
1539
|
if (choices) {
|
|
1298
|
-
return /* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1300
|
-
/* @__PURE__ */
|
|
1301
|
-
/* @__PURE__ */
|
|
1540
|
+
return /* @__PURE__ */ jsxs9("div", { children: [
|
|
1541
|
+
/* @__PURE__ */ jsx10("div", { className: "logo", children: brand }),
|
|
1542
|
+
/* @__PURE__ */ jsx10("h1", { children: "Choose workspace" }),
|
|
1543
|
+
/* @__PURE__ */ jsx10("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ jsx10(
|
|
1302
1544
|
"button",
|
|
1303
1545
|
{
|
|
1304
1546
|
type: "button",
|
|
@@ -1316,20 +1558,20 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1316
1558
|
},
|
|
1317
1559
|
o.id
|
|
1318
1560
|
)) }),
|
|
1319
|
-
err && /* @__PURE__ */
|
|
1561
|
+
err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err })
|
|
1320
1562
|
] });
|
|
1321
1563
|
}
|
|
1322
|
-
return /* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
mode === "forgot" ? resetSent ? /* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1564
|
+
return /* @__PURE__ */ jsxs9("form", { onSubmit: submit, children: [
|
|
1565
|
+
/* @__PURE__ */ jsx10("div", { className: "logo", children: brand }),
|
|
1566
|
+
/* @__PURE__ */ jsx10("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
|
|
1567
|
+
/* @__PURE__ */ jsx10("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle || "Welcome back." }),
|
|
1568
|
+
mode === "forgot" ? resetSent ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
1569
|
+
/* @__PURE__ */ jsxs9("div", { className: "auth-note", children: [
|
|
1328
1570
|
"If an account exists for ",
|
|
1329
|
-
/* @__PURE__ */
|
|
1571
|
+
/* @__PURE__ */ jsx10("b", { children: email.trim() }),
|
|
1330
1572
|
", a password reset link is on its way. It is valid for 1 hour."
|
|
1331
1573
|
] }),
|
|
1332
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ jsx10(
|
|
1333
1575
|
"button",
|
|
1334
1576
|
{
|
|
1335
1577
|
type: "button",
|
|
@@ -1343,36 +1585,36 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1343
1585
|
children: "Back to sign in"
|
|
1344
1586
|
}
|
|
1345
1587
|
)
|
|
1346
|
-
] }) : /* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1588
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
1589
|
+
/* @__PURE__ */ jsxs9("div", { className: "field", children: [
|
|
1590
|
+
/* @__PURE__ */ jsx10("label", { children: "Email" }),
|
|
1591
|
+
/* @__PURE__ */ jsx10("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
1350
1592
|
] }),
|
|
1351
|
-
err && /* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1593
|
+
err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err }),
|
|
1594
|
+
/* @__PURE__ */ jsx10("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
|
|
1595
|
+
/* @__PURE__ */ jsx10("p", { className: "auth-switch", children: /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => {
|
|
1354
1596
|
setErr("");
|
|
1355
1597
|
setMode("signin");
|
|
1356
1598
|
}, children: "Back to sign in" }) })
|
|
1357
|
-
] }) : /* @__PURE__ */
|
|
1358
|
-
mode === "register" && /* @__PURE__ */
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
/* @__PURE__ */
|
|
1599
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
1600
|
+
mode === "register" && /* @__PURE__ */ jsxs9("div", { className: "field", children: [
|
|
1601
|
+
/* @__PURE__ */ jsx10("label", { children: "Name" }),
|
|
1602
|
+
/* @__PURE__ */ jsx10("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
|
|
1361
1603
|
] }),
|
|
1362
|
-
/* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1604
|
+
/* @__PURE__ */ jsxs9("div", { className: "field", children: [
|
|
1605
|
+
/* @__PURE__ */ jsx10("label", { children: "Email" }),
|
|
1606
|
+
/* @__PURE__ */ jsx10("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
1365
1607
|
] }),
|
|
1366
|
-
/* @__PURE__ */
|
|
1367
|
-
/* @__PURE__ */
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
mode === "signin" && /* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ jsxs9("div", { className: "field", children: [
|
|
1609
|
+
/* @__PURE__ */ jsxs9("div", { className: "field-row", children: [
|
|
1610
|
+
/* @__PURE__ */ jsx10("label", { children: "Password" }),
|
|
1611
|
+
mode === "signin" && /* @__PURE__ */ jsx10("button", { type: "button", className: "link-sm", onClick: () => {
|
|
1370
1612
|
setErr("");
|
|
1371
1613
|
setResetSent(false);
|
|
1372
1614
|
setMode("forgot");
|
|
1373
1615
|
}, children: "Forgot password?" })
|
|
1374
1616
|
] }),
|
|
1375
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ jsx10(
|
|
1376
1618
|
"input",
|
|
1377
1619
|
{
|
|
1378
1620
|
className: "input",
|
|
@@ -1385,13 +1627,13 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1385
1627
|
}
|
|
1386
1628
|
)
|
|
1387
1629
|
] }),
|
|
1388
|
-
err && /* @__PURE__ */
|
|
1389
|
-
/* @__PURE__ */
|
|
1390
|
-
GOOGLE_ENABLED && /* @__PURE__ */
|
|
1391
|
-
/* @__PURE__ */
|
|
1630
|
+
err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err }),
|
|
1631
|
+
/* @__PURE__ */ jsx10("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
|
|
1632
|
+
GOOGLE_ENABLED && /* @__PURE__ */ jsx10(GoogleButton, { onCredential: onGoogle, onError: setErr }),
|
|
1633
|
+
/* @__PURE__ */ jsxs9("p", { className: "auth-switch", children: [
|
|
1392
1634
|
mode === "register" ? "Already have an account?" : `New to ${productName || "the product"}?`,
|
|
1393
1635
|
" ",
|
|
1394
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsx10("button", { type: "button", onClick: () => {
|
|
1395
1637
|
setErr("");
|
|
1396
1638
|
setMode(mode === "register" ? "signin" : "register");
|
|
1397
1639
|
}, children: mode === "register" ? "Sign in" : "Create one" })
|
|
@@ -1401,9 +1643,9 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1401
1643
|
}
|
|
1402
1644
|
|
|
1403
1645
|
// src/sheet/SheetGrid.jsx
|
|
1404
|
-
import { useEffect as
|
|
1405
|
-
import { createPortal } from "react-dom";
|
|
1406
|
-
import { Fragment as
|
|
1646
|
+
import { useEffect as useEffect6, useRef as useRef6, useState as useState7 } from "react";
|
|
1647
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
1648
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1407
1649
|
var cellKey = (rowId, colId) => `${rowId}:${colId}`;
|
|
1408
1650
|
var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1409
1651
|
var TYPE_LABEL = {
|
|
@@ -1427,7 +1669,7 @@ var COMPUTE_KINDS = [
|
|
|
1427
1669
|
var RESOURCE_KINDS = ["image", "sheet", "slides", "workflow", "graph"];
|
|
1428
1670
|
var RESOURCE_ICON = { image: "\u{1F5BC}", sheet: "\u25A6", slides: "\u25A4", workflow: "\u2699", graph: "\u25C9" };
|
|
1429
1671
|
function PopPortal({ anchor, width = 250, estHeight = 300, className, children, onClose }) {
|
|
1430
|
-
|
|
1672
|
+
useEffect6(() => {
|
|
1431
1673
|
if (!onClose) return void 0;
|
|
1432
1674
|
const close = () => onClose();
|
|
1433
1675
|
window.addEventListener("scroll", close, true);
|
|
@@ -1441,8 +1683,8 @@ function PopPortal({ anchor, width = 250, estHeight = 300, className, children,
|
|
|
1441
1683
|
const left = Math.max(8, Math.min(anchor.right - width, window.innerWidth - width - 8));
|
|
1442
1684
|
let top = anchor.bottom + 6;
|
|
1443
1685
|
if (top + estHeight > window.innerHeight - 8) top = Math.max(8, anchor.top - estHeight - 6);
|
|
1444
|
-
return
|
|
1445
|
-
/* @__PURE__ */
|
|
1686
|
+
return createPortal2(
|
|
1687
|
+
/* @__PURE__ */ jsx11("div", { className, style: { position: "fixed", top, left, width, zIndex: 1e3 }, children }),
|
|
1446
1688
|
document.body
|
|
1447
1689
|
);
|
|
1448
1690
|
}
|
|
@@ -1462,8 +1704,8 @@ function pillColor(label, options) {
|
|
|
1462
1704
|
return PILL_FALLBACKS[h % PILL_FALLBACKS.length];
|
|
1463
1705
|
}
|
|
1464
1706
|
function RefImage({ refVal, fetchBlobUrl }) {
|
|
1465
|
-
const [src, setSrc] =
|
|
1466
|
-
|
|
1707
|
+
const [src, setSrc] = useState7(/^https?:\/\//i.test(refVal.url || "") ? refVal.url : null);
|
|
1708
|
+
useEffect6(() => {
|
|
1467
1709
|
let dead = false;
|
|
1468
1710
|
let obj = null;
|
|
1469
1711
|
if (!src && refVal.url && fetchBlobUrl) {
|
|
@@ -1479,16 +1721,16 @@ function RefImage({ refVal, fetchBlobUrl }) {
|
|
|
1479
1721
|
if (obj) URL.revokeObjectURL(obj);
|
|
1480
1722
|
};
|
|
1481
1723
|
}, [refVal.url]);
|
|
1482
|
-
if (!src) return /* @__PURE__ */
|
|
1724
|
+
if (!src) return /* @__PURE__ */ jsxs10("span", { className: "shg-refchip", children: [
|
|
1483
1725
|
RESOURCE_ICON.image,
|
|
1484
1726
|
" ",
|
|
1485
1727
|
refVal.name || "image"
|
|
1486
1728
|
] });
|
|
1487
|
-
return /* @__PURE__ */
|
|
1729
|
+
return /* @__PURE__ */ jsx11("img", { className: "shg-refimg", src, alt: refVal.name || "", title: refVal.name || "" });
|
|
1488
1730
|
}
|
|
1489
1731
|
function ResourceChip({ refVal, onOpen }) {
|
|
1490
1732
|
const icon = RESOURCE_ICON[refVal.kind] || "\u25C7";
|
|
1491
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ jsxs10(
|
|
1492
1734
|
"button",
|
|
1493
1735
|
{
|
|
1494
1736
|
className: "shg-refchip shg-refchip-btn",
|
|
@@ -1498,54 +1740,54 @@ function ResourceChip({ refVal, onOpen }) {
|
|
|
1498
1740
|
onOpen && onOpen(refVal);
|
|
1499
1741
|
},
|
|
1500
1742
|
children: [
|
|
1501
|
-
/* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
1743
|
+
/* @__PURE__ */ jsx11("span", { className: "shg-refchip-ic", children: icon }),
|
|
1744
|
+
/* @__PURE__ */ jsx11("span", { className: "shg-refchip-name", children: refVal.name || refVal.id || refVal.kind })
|
|
1503
1745
|
]
|
|
1504
1746
|
}
|
|
1505
1747
|
);
|
|
1506
1748
|
}
|
|
1507
1749
|
function StatusDot({ status }) {
|
|
1508
1750
|
if (!status || status === "empty") return null;
|
|
1509
|
-
return /* @__PURE__ */
|
|
1751
|
+
return /* @__PURE__ */ jsx11("span", { className: `shg-dot shg-dot-${status}`, title: status });
|
|
1510
1752
|
}
|
|
1511
1753
|
function CellValue({ cell, col, fetchBlobUrl, onOpenResource }) {
|
|
1512
1754
|
const v = cell?.value;
|
|
1513
|
-
if (v === void 0 || v === null || v === "") return /* @__PURE__ */
|
|
1755
|
+
if (v === void 0 || v === null || v === "") return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt" });
|
|
1514
1756
|
if (v && typeof v === "object" && !Array.isArray(v) && v.kind) {
|
|
1515
|
-
if (v.kind === "image") return /* @__PURE__ */
|
|
1516
|
-
return /* @__PURE__ */
|
|
1757
|
+
if (v.kind === "image") return /* @__PURE__ */ jsx11(RefImage, { refVal: v, fetchBlobUrl });
|
|
1758
|
+
return /* @__PURE__ */ jsx11(ResourceChip, { refVal: v, onOpen: onOpenResource });
|
|
1517
1759
|
}
|
|
1518
1760
|
switch (col.type) {
|
|
1519
1761
|
case "select":
|
|
1520
|
-
return /* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-pill", style: { background: pillColor(String(v), col.options) }, children: String(v) });
|
|
1521
1763
|
case "tags": {
|
|
1522
1764
|
const tags = Array.isArray(v) ? v : String(v).split(",").map((s) => s.trim()).filter(Boolean);
|
|
1523
|
-
return /* @__PURE__ */
|
|
1765
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-pills", children: tags.map((t) => /* @__PURE__ */ jsx11("span", { className: "shg-pill", style: { background: pillColor(t, col.options) }, children: t }, t)) });
|
|
1524
1766
|
}
|
|
1525
1767
|
case "checkbox":
|
|
1526
|
-
return /* @__PURE__ */
|
|
1768
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-check" + (v ? " on" : ""), children: v ? "\u2713" : "" });
|
|
1527
1769
|
case "url": {
|
|
1528
1770
|
const href = /^https?:\/\//i.test(String(v)) ? String(v) : `https://${v}`;
|
|
1529
|
-
return /* @__PURE__ */
|
|
1771
|
+
return /* @__PURE__ */ jsx11("a", { className: "shg-link", href, target: "_blank", rel: "noreferrer", onClick: (e) => e.stopPropagation(), children: String(v) });
|
|
1530
1772
|
}
|
|
1531
1773
|
case "number":
|
|
1532
|
-
return /* @__PURE__ */
|
|
1774
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt shg-num", children: String(v) });
|
|
1533
1775
|
default:
|
|
1534
|
-
return /* @__PURE__ */
|
|
1776
|
+
return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt", children: typeof v === "object" ? JSON.stringify(v) : String(v) });
|
|
1535
1777
|
}
|
|
1536
1778
|
}
|
|
1537
1779
|
function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false, fetchBlobUrl, onOpenResource, peerMarks, onActiveCell }) {
|
|
1538
1780
|
const columns = sheet?.columns || [];
|
|
1539
1781
|
const rows = sheet?.rows || [];
|
|
1540
1782
|
const cells = sheet?.cells || {};
|
|
1541
|
-
const [editing, setEditing] =
|
|
1542
|
-
const [draft, setDraft] =
|
|
1543
|
-
const [menuCol, setMenuCol] =
|
|
1544
|
-
const [sizeDraft, setSizeDraft] =
|
|
1545
|
-
const [dnd, setDnd] =
|
|
1546
|
-
const [dropAt, setDropAt] =
|
|
1547
|
-
const inputRef =
|
|
1548
|
-
const dragRef =
|
|
1783
|
+
const [editing, setEditing] = useState7(null);
|
|
1784
|
+
const [draft, setDraft] = useState7("");
|
|
1785
|
+
const [menuCol, setMenuCol] = useState7(null);
|
|
1786
|
+
const [sizeDraft, setSizeDraft] = useState7({});
|
|
1787
|
+
const [dnd, setDnd] = useState7(null);
|
|
1788
|
+
const [dropAt, setDropAt] = useState7(null);
|
|
1789
|
+
const inputRef = useRef6(null);
|
|
1790
|
+
const dragRef = useRef6(null);
|
|
1549
1791
|
const startResize = (e, kind, id, start) => {
|
|
1550
1792
|
if (readOnly) return;
|
|
1551
1793
|
e.preventDefault();
|
|
@@ -1640,7 +1882,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1640
1882
|
const numW = Math.max(40, 24 + String(rows.length || 1).length * 9);
|
|
1641
1883
|
const numStyle = { width: numW, minWidth: numW, maxWidth: numW };
|
|
1642
1884
|
const rowHeight = (row) => sizeDraft.row && sizeDraft.row[row.id] || row.height || void 0;
|
|
1643
|
-
|
|
1885
|
+
useEffect6(() => {
|
|
1644
1886
|
if (editing && inputRef.current) inputRef.current.focus();
|
|
1645
1887
|
}, [editing]);
|
|
1646
1888
|
const mutate = (fn) => {
|
|
@@ -1707,7 +1949,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1707
1949
|
if (col.type === "resource") {
|
|
1708
1950
|
const d = typeof draft === "object" && draft ? draft : { kind: "sheet" };
|
|
1709
1951
|
const set = (k, v) => setDraft({ ...d, [k]: v });
|
|
1710
|
-
return /* @__PURE__ */
|
|
1952
|
+
return /* @__PURE__ */ jsx11(
|
|
1711
1953
|
PopPortal,
|
|
1712
1954
|
{
|
|
1713
1955
|
anchor: editing.rect,
|
|
@@ -1715,17 +1957,17 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1715
1957
|
estHeight: 230,
|
|
1716
1958
|
className: "shg-select-pop shg-ref-pop",
|
|
1717
1959
|
onClose: () => setEditing(null),
|
|
1718
|
-
children: /* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
1724
|
-
/* @__PURE__ */
|
|
1960
|
+
children: /* @__PURE__ */ jsxs10("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
1961
|
+
/* @__PURE__ */ jsx11("select", { className: "shg-menu-input", value: d.kind || "sheet", onChange: (e) => set("kind", e.target.value), children: RESOURCE_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k, children: k }, k)) }),
|
|
1962
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "Name", value: d.name || "", onChange: (e) => set("name", e.target.value) }),
|
|
1963
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "Resource id (e.g. sheet.\u2026)", value: d.id || "", onChange: (e) => set("id", e.target.value) }),
|
|
1964
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "or URL", value: d.url || "", onChange: (e) => set("url", e.target.value) }),
|
|
1965
|
+
/* @__PURE__ */ jsxs10("div", { className: "shg-menu-actions", children: [
|
|
1966
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-pop-clear", onClick: () => {
|
|
1725
1967
|
setCell(editing.rowId, editing.colId, null);
|
|
1726
1968
|
setEditing(null);
|
|
1727
1969
|
}, children: "Clear" }),
|
|
1728
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-menu-apply", onClick: () => {
|
|
1729
1971
|
setCell(editing.rowId, editing.colId, d);
|
|
1730
1972
|
setEditing(null);
|
|
1731
1973
|
}, children: "Set" })
|
|
@@ -1736,7 +1978,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1736
1978
|
}
|
|
1737
1979
|
if (col.type === "select") {
|
|
1738
1980
|
const opts = normOptions(col.options);
|
|
1739
|
-
return /* @__PURE__ */
|
|
1981
|
+
return /* @__PURE__ */ jsxs10(
|
|
1740
1982
|
PopPortal,
|
|
1741
1983
|
{
|
|
1742
1984
|
anchor: editing.rect,
|
|
@@ -1745,8 +1987,8 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1745
1987
|
className: "shg-select-pop",
|
|
1746
1988
|
onClose: () => setEditing(null),
|
|
1747
1989
|
children: [
|
|
1748
|
-
opts.length === 0 && /* @__PURE__ */
|
|
1749
|
-
opts.map((o) => /* @__PURE__ */
|
|
1990
|
+
opts.length === 0 && /* @__PURE__ */ jsx11("div", { className: "shg-pop-note", children: "No options yet \u2014 add them in the column menu." }),
|
|
1991
|
+
opts.map((o) => /* @__PURE__ */ jsx11(
|
|
1750
1992
|
"button",
|
|
1751
1993
|
{
|
|
1752
1994
|
className: "shg-pill shg-pill-btn",
|
|
@@ -1760,7 +2002,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1760
2002
|
},
|
|
1761
2003
|
o.label
|
|
1762
2004
|
)),
|
|
1763
|
-
/* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ jsx11(
|
|
1764
2006
|
"button",
|
|
1765
2007
|
{
|
|
1766
2008
|
className: "shg-pop-clear",
|
|
@@ -1777,7 +2019,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1777
2019
|
);
|
|
1778
2020
|
}
|
|
1779
2021
|
const inputType = col.type === "date" ? "date" : col.type === "number" ? "number" : "text";
|
|
1780
|
-
return /* @__PURE__ */
|
|
2022
|
+
return /* @__PURE__ */ jsx11(
|
|
1781
2023
|
"input",
|
|
1782
2024
|
{
|
|
1783
2025
|
ref: inputRef,
|
|
@@ -1794,18 +2036,18 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1794
2036
|
}
|
|
1795
2037
|
);
|
|
1796
2038
|
};
|
|
1797
|
-
return /* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
columns.map((col) => /* @__PURE__ */
|
|
2039
|
+
return /* @__PURE__ */ jsx11("div", { className: "shg", children: /* @__PURE__ */ jsx11("div", { className: "shg-scroll", children: /* @__PURE__ */ jsxs10("table", { className: "shg-table", children: [
|
|
2040
|
+
/* @__PURE__ */ jsx11("thead", { children: /* @__PURE__ */ jsxs10("tr", { children: [
|
|
2041
|
+
/* @__PURE__ */ jsx11("th", { className: "shg-corner", style: numStyle }),
|
|
2042
|
+
columns.map((col) => /* @__PURE__ */ jsxs10(
|
|
1801
2043
|
"th",
|
|
1802
2044
|
{
|
|
1803
2045
|
className: "shg-col" + (col.type === "compute" ? " shg-col-compute" : "") + dndClass("col", col.id),
|
|
1804
2046
|
style: colWidth(col) ? { width: colWidth(col), minWidth: colWidth(col), maxWidth: colWidth(col) } : void 0,
|
|
1805
2047
|
...dndProps("col", col.id),
|
|
1806
2048
|
children: [
|
|
1807
|
-
!readOnly && /* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
2049
|
+
!readOnly && /* @__PURE__ */ jsx11("span", { className: "shg-resize-col", onMouseDown: (e) => startResize(e, "col", col.id, colWidth(col) || e.currentTarget.closest("th").offsetWidth) }),
|
|
2050
|
+
/* @__PURE__ */ jsx11("div", { className: "shg-col-h", children: /* @__PURE__ */ jsx11(
|
|
1809
2051
|
ColumnHeader,
|
|
1810
2052
|
{
|
|
1811
2053
|
col,
|
|
@@ -1828,10 +2070,10 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1828
2070
|
},
|
|
1829
2071
|
col.id
|
|
1830
2072
|
)),
|
|
1831
|
-
!readOnly && /* @__PURE__ */
|
|
2073
|
+
!readOnly && /* @__PURE__ */ jsx11("th", { className: "shg-add-col", children: /* @__PURE__ */ jsx11("button", { className: "shg-add", onClick: addColumn, title: "Add column", children: "+" }) })
|
|
1832
2074
|
] }) }),
|
|
1833
|
-
/* @__PURE__ */
|
|
1834
|
-
rows.map((row, ri) => /* @__PURE__ */
|
|
2075
|
+
/* @__PURE__ */ jsxs10("tbody", { children: [
|
|
2076
|
+
rows.map((row, ri) => /* @__PURE__ */ jsxs10(
|
|
1835
2077
|
"tr",
|
|
1836
2078
|
{
|
|
1837
2079
|
style: {
|
|
@@ -1839,7 +2081,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1839
2081
|
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
1840
2082
|
},
|
|
1841
2083
|
children: [
|
|
1842
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsxs10(
|
|
1843
2085
|
"td",
|
|
1844
2086
|
{
|
|
1845
2087
|
className: "shg-rownum" + dndClass("row", row.id),
|
|
@@ -1847,9 +2089,9 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1847
2089
|
title: "Drag to reorder",
|
|
1848
2090
|
...dndProps("row", row.id),
|
|
1849
2091
|
children: [
|
|
1850
|
-
/* @__PURE__ */
|
|
1851
|
-
!readOnly && /* @__PURE__ */
|
|
1852
|
-
!readOnly && /* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ jsx11("span", { children: ri + 1 }),
|
|
2093
|
+
!readOnly && /* @__PURE__ */ jsx11("button", { className: "shg-rowdel", onClick: () => deleteRow(row.id), title: "Delete row", children: "\xD7" }),
|
|
2094
|
+
!readOnly && /* @__PURE__ */ jsx11("span", { className: "shg-resize-row", onMouseDown: (e) => startResize(e, "row", row.id, rowHeight(row) || e.currentTarget.closest("tr").offsetHeight) })
|
|
1853
2095
|
]
|
|
1854
2096
|
}
|
|
1855
2097
|
),
|
|
@@ -1857,7 +2099,7 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1857
2099
|
const c = cells[cellKey(row.id, col.id)] || {};
|
|
1858
2100
|
const isEditing = editing && editing.rowId === row.id && editing.colId === col.id;
|
|
1859
2101
|
const peer = peerMarks && peerMarks[cellKey(row.id, col.id)];
|
|
1860
|
-
return /* @__PURE__ */
|
|
2102
|
+
return /* @__PURE__ */ jsxs10(
|
|
1861
2103
|
"td",
|
|
1862
2104
|
{
|
|
1863
2105
|
className: "shg-cell" + (col.type === "compute" ? " shg-cell-compute" : "") + (c.status && col.type === "compute" ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
|
|
@@ -1867,16 +2109,16 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1867
2109
|
},
|
|
1868
2110
|
title: c.error || "",
|
|
1869
2111
|
children: [
|
|
1870
|
-
peer && /* @__PURE__ */
|
|
1871
|
-
isEditing ? renderEditor(col) : /* @__PURE__ */
|
|
2112
|
+
peer && /* @__PURE__ */ jsx11("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
|
|
2113
|
+
isEditing ? renderEditor(col) : /* @__PURE__ */ jsxs10(
|
|
1872
2114
|
"div",
|
|
1873
2115
|
{
|
|
1874
2116
|
className: "shg-val",
|
|
1875
2117
|
style: { maxWidth: colWidth(col) ? colWidth(col) - 20 : 400 },
|
|
1876
2118
|
children: [
|
|
1877
|
-
col.type === "compute" && /* @__PURE__ */
|
|
1878
|
-
/* @__PURE__ */
|
|
1879
|
-
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */
|
|
2119
|
+
col.type === "compute" && /* @__PURE__ */ jsx11(StatusDot, { status: c.status }),
|
|
2120
|
+
/* @__PURE__ */ jsx11(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
|
|
2121
|
+
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */ jsx11(
|
|
1880
2122
|
"button",
|
|
1881
2123
|
{
|
|
1882
2124
|
className: "shg-runcell",
|
|
@@ -1896,25 +2138,25 @@ function SheetGrid({ sheet, onChange, onRunCell, onRunColumn, readOnly = false,
|
|
|
1896
2138
|
col.id
|
|
1897
2139
|
);
|
|
1898
2140
|
}),
|
|
1899
|
-
!readOnly && /* @__PURE__ */
|
|
2141
|
+
!readOnly && /* @__PURE__ */ jsx11("td", { className: "shg-pad" })
|
|
1900
2142
|
]
|
|
1901
2143
|
},
|
|
1902
2144
|
row.id
|
|
1903
2145
|
)),
|
|
1904
|
-
!readOnly && /* @__PURE__ */
|
|
1905
|
-
/* @__PURE__ */
|
|
1906
|
-
/* @__PURE__ */
|
|
2146
|
+
!readOnly && /* @__PURE__ */ jsxs10("tr", { className: "shg-ghost-row", onClick: addRow, children: [
|
|
2147
|
+
/* @__PURE__ */ jsx11("td", { className: "shg-rownum shg-ghost-num", style: numStyle, children: "+" }),
|
|
2148
|
+
/* @__PURE__ */ jsx11("td", { className: "shg-ghost-cell", colSpan: columns.length + 1, children: "New row" })
|
|
1907
2149
|
] })
|
|
1908
2150
|
] })
|
|
1909
2151
|
] }) }) });
|
|
1910
2152
|
}
|
|
1911
2153
|
function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, onCloseMenu, onRename, onConfigure, onDelete, onRun }) {
|
|
1912
|
-
const [editing, setEditing] =
|
|
1913
|
-
const [name, setName] =
|
|
1914
|
-
|
|
1915
|
-
return /* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */
|
|
1917
|
-
editing && !readOnly ? /* @__PURE__ */
|
|
2154
|
+
const [editing, setEditing] = useState7(false);
|
|
2155
|
+
const [name, setName] = useState7(col.name);
|
|
2156
|
+
useEffect6(() => setName(col.name), [col.name]);
|
|
2157
|
+
return /* @__PURE__ */ jsxs10("div", { className: "shg-colhdr", children: [
|
|
2158
|
+
/* @__PURE__ */ jsxs10("div", { className: "shg-colhdr-main", children: [
|
|
2159
|
+
editing && !readOnly ? /* @__PURE__ */ jsx11(
|
|
1918
2160
|
"input",
|
|
1919
2161
|
{
|
|
1920
2162
|
className: "shg-colname-input",
|
|
@@ -1929,17 +2171,17 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
1929
2171
|
if (e.key === "Enter") e.target.blur();
|
|
1930
2172
|
}
|
|
1931
2173
|
}
|
|
1932
|
-
) : /* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
2174
|
+
) : /* @__PURE__ */ jsx11("span", { className: "shg-colname", onDoubleClick: () => !readOnly && setEditing(true), title: col.name, children: col.name }),
|
|
2175
|
+
/* @__PURE__ */ jsxs10("span", { className: "shg-coltype" + (col.type === "compute" ? " compute" : ""), children: [
|
|
1934
2176
|
TYPE_LABEL[col.type] || col.type,
|
|
1935
2177
|
col.type === "compute" && col.compute?.kind ? ` \xB7 ${col.compute.kind}` : ""
|
|
1936
2178
|
] })
|
|
1937
2179
|
] }),
|
|
1938
|
-
!readOnly && /* @__PURE__ */
|
|
1939
|
-
onRun && /* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
2180
|
+
!readOnly && /* @__PURE__ */ jsxs10("div", { className: "shg-colhdr-tools", children: [
|
|
2181
|
+
onRun && /* @__PURE__ */ jsx11("button", { className: "shg-colrun", onClick: onRun, title: "Run this column", children: "\u25B6 Run" }),
|
|
2182
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-colmenu-btn", onClick: (e) => onMenu(e), title: "Column settings", children: "\u22EF" })
|
|
1941
2183
|
] }),
|
|
1942
|
-
menuOpen && !readOnly && /* @__PURE__ */
|
|
2184
|
+
menuOpen && !readOnly && /* @__PURE__ */ jsx11(
|
|
1943
2185
|
ColumnMenu,
|
|
1944
2186
|
{
|
|
1945
2187
|
col,
|
|
@@ -1956,19 +2198,19 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
1956
2198
|
] });
|
|
1957
2199
|
}
|
|
1958
2200
|
function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
1959
|
-
const [type, setType] =
|
|
1960
|
-
const [optText, setOptText] =
|
|
2201
|
+
const [type, setType] = useState7(col.type || "text");
|
|
2202
|
+
const [optText, setOptText] = useState7(
|
|
1961
2203
|
normOptions(col.options).map((o) => o.label).join("\n")
|
|
1962
2204
|
);
|
|
1963
2205
|
const comp = col.compute || {};
|
|
1964
|
-
const [kind, setKind] =
|
|
1965
|
-
const [prompt, setPrompt] =
|
|
1966
|
-
const [harnessId, setHarnessId] =
|
|
1967
|
-
const [wfSlug, setWfSlug] =
|
|
1968
|
-
const [outKey, setOutKey] =
|
|
1969
|
-
const [deps, setDeps] =
|
|
1970
|
-
const ref =
|
|
1971
|
-
|
|
2206
|
+
const [kind, setKind] = useState7(comp.kind || "prompt");
|
|
2207
|
+
const [prompt, setPrompt] = useState7(comp.prompt || "");
|
|
2208
|
+
const [harnessId, setHarnessId] = useState7(comp.harness_id || "");
|
|
2209
|
+
const [wfSlug, setWfSlug] = useState7(comp.workflow_slug || "");
|
|
2210
|
+
const [outKey, setOutKey] = useState7(comp.output_key || "");
|
|
2211
|
+
const [deps, setDeps] = useState7(new Set(comp.deps || []));
|
|
2212
|
+
const ref = useRef6(null);
|
|
2213
|
+
useEffect6(() => {
|
|
1972
2214
|
const onDown = (e) => {
|
|
1973
2215
|
if (ref.current && !ref.current.contains(e.target)) onClose();
|
|
1974
2216
|
};
|
|
@@ -2002,17 +2244,17 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
2002
2244
|
}
|
|
2003
2245
|
onApply(patch);
|
|
2004
2246
|
};
|
|
2005
|
-
return /* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */
|
|
2247
|
+
return /* @__PURE__ */ jsx11(PopPortal, { anchor, width: 250, estHeight: 340, className: "shg-menu", onClose, children: /* @__PURE__ */ jsxs10("div", { ref, onClick: (e) => e.stopPropagation(), children: [
|
|
2248
|
+
/* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
2007
2249
|
"Type",
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
MANUAL_TYPES.map((t) => /* @__PURE__ */
|
|
2010
|
-
/* @__PURE__ */
|
|
2250
|
+
/* @__PURE__ */ jsxs10("select", { className: "shg-menu-input", value: type, onChange: (e) => setType(e.target.value), children: [
|
|
2251
|
+
MANUAL_TYPES.map((t) => /* @__PURE__ */ jsx11("option", { value: t, children: TYPE_LABEL[t] }, t)),
|
|
2252
|
+
/* @__PURE__ */ jsx11("option", { value: "compute", children: "Computed" })
|
|
2011
2253
|
] })
|
|
2012
2254
|
] }),
|
|
2013
|
-
(type === "select" || type === "tags") && /* @__PURE__ */
|
|
2255
|
+
(type === "select" || type === "tags") && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
2014
2256
|
"Options (one per line)",
|
|
2015
|
-
/* @__PURE__ */
|
|
2257
|
+
/* @__PURE__ */ jsx11(
|
|
2016
2258
|
"textarea",
|
|
2017
2259
|
{
|
|
2018
2260
|
className: "shg-menu-input",
|
|
@@ -2023,15 +2265,15 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
2023
2265
|
}
|
|
2024
2266
|
)
|
|
2025
2267
|
] }),
|
|
2026
|
-
type === "compute" && /* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2268
|
+
type === "compute" && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2269
|
+
/* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
2028
2270
|
"Runs",
|
|
2029
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ jsx11("select", { className: "shg-menu-input", value: kind, onChange: (e) => setKind(e.target.value), children: COMPUTE_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k.kind, children: k.label }, k.kind)) })
|
|
2030
2272
|
] }),
|
|
2031
|
-
(kind === "prompt" || kind === "harness") && /* @__PURE__ */
|
|
2273
|
+
(kind === "prompt" || kind === "harness") && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
2032
2274
|
"Prompt \u2014 reference columns as ",
|
|
2033
2275
|
"{{Name}}",
|
|
2034
|
-
/* @__PURE__ */
|
|
2276
|
+
/* @__PURE__ */ jsx11(
|
|
2035
2277
|
"textarea",
|
|
2036
2278
|
{
|
|
2037
2279
|
className: "shg-menu-input",
|
|
@@ -2042,32 +2284,32 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
2042
2284
|
}
|
|
2043
2285
|
)
|
|
2044
2286
|
] }),
|
|
2045
|
-
kind === "harness" && /* @__PURE__ */
|
|
2287
|
+
kind === "harness" && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
2046
2288
|
"Agent id",
|
|
2047
|
-
/* @__PURE__ */
|
|
2289
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: harnessId, onChange: (e) => setHarnessId(e.target.value), placeholder: "chrn_\u2026" })
|
|
2048
2290
|
] }),
|
|
2049
|
-
kind === "workflow" && /* @__PURE__ */
|
|
2050
|
-
/* @__PURE__ */
|
|
2291
|
+
kind === "workflow" && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
2292
|
+
/* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
2051
2293
|
"Workflow id",
|
|
2052
|
-
/* @__PURE__ */
|
|
2294
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: wfSlug, onChange: (e) => setWfSlug(e.target.value), placeholder: "my-workflow" })
|
|
2053
2295
|
] }),
|
|
2054
|
-
/* @__PURE__ */
|
|
2296
|
+
/* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
|
|
2055
2297
|
"Output key (optional)",
|
|
2056
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: outKey, onChange: (e) => setOutKey(e.target.value), placeholder: "summary" })
|
|
2057
2299
|
] })
|
|
2058
2300
|
] }),
|
|
2059
|
-
others.length > 0 && /* @__PURE__ */
|
|
2301
|
+
others.length > 0 && /* @__PURE__ */ jsxs10("div", { className: "shg-menu-lbl", children: [
|
|
2060
2302
|
"Reads columns",
|
|
2061
|
-
/* @__PURE__ */
|
|
2062
|
-
/* @__PURE__ */
|
|
2303
|
+
/* @__PURE__ */ jsx11("div", { className: "shg-menu-deps", children: others.map((c) => /* @__PURE__ */ jsxs10("label", { className: "shg-menu-dep", children: [
|
|
2304
|
+
/* @__PURE__ */ jsx11("input", { type: "checkbox", checked: deps.has(c.id), onChange: () => toggleDep(c.id) }),
|
|
2063
2305
|
" ",
|
|
2064
2306
|
c.name
|
|
2065
2307
|
] }, c.id)) })
|
|
2066
2308
|
] })
|
|
2067
2309
|
] }),
|
|
2068
|
-
/* @__PURE__ */
|
|
2069
|
-
/* @__PURE__ */
|
|
2070
|
-
/* @__PURE__ */
|
|
2310
|
+
/* @__PURE__ */ jsxs10("div", { className: "shg-menu-actions", children: [
|
|
2311
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-menu-del", onClick: onDelete, children: "Delete column" }),
|
|
2312
|
+
/* @__PURE__ */ jsx11("button", { className: "shg-menu-apply", onClick: apply, children: "Apply" })
|
|
2071
2313
|
] })
|
|
2072
2314
|
] }) });
|
|
2073
2315
|
}
|
|
@@ -2106,6 +2348,7 @@ export {
|
|
|
2106
2348
|
CodeBlock,
|
|
2107
2349
|
Composer,
|
|
2108
2350
|
DEFAULT_STATUS_LABELS,
|
|
2351
|
+
DialogHost,
|
|
2109
2352
|
GOOGLE_ENABLED,
|
|
2110
2353
|
GoogleButton,
|
|
2111
2354
|
IcCheck,
|
|
@@ -2159,6 +2402,7 @@ export {
|
|
|
2159
2402
|
switchOrg,
|
|
2160
2403
|
taskStatusGroup,
|
|
2161
2404
|
toolMeta,
|
|
2405
|
+
useDialog,
|
|
2162
2406
|
useResizablePane,
|
|
2163
2407
|
withReasoning,
|
|
2164
2408
|
withResult,
|