reifyui 0.18.5 → 0.19.1
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 +43 -0
- package/dist/index.cjs +128 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +122 -8
- package/dist/index.js.map +1 -1
- package/dist/tree.cjs +1159 -0
- package/dist/tree.cjs.map +1 -0
- package/dist/tree.d.ts +178 -0
- package/dist/tree.js +1129 -0
- package/dist/tree.js.map +1 -0
- package/package.json +9 -1
- package/src/auth/AuthForm.jsx +2 -0
- package/src/auth/client.js +34 -4
- package/src/auth/personCheck.js +98 -0
- package/src/index.d.ts +7 -1
- package/src/index.js +2 -1
- package/src/tree/FileTree.jsx +668 -0
- package/src/tree/index.d.ts +178 -0
- package/src/tree/index.js +14 -0
- package/src/tree/model.js +220 -0
- package/styles/tree.css +199 -0
package/README.md
CHANGED
|
@@ -62,6 +62,7 @@ A production-grade surface for rendering and interacting with a live agent turn:
|
|
|
62
62
|
| **Slides** (`reifyui/slides`) | `SlideView`, `SlideStage`, `EditorCanvas`, `Presentation`, `ElementView`, `themeVars` — render a JSON deck, edit it by direct manipulation, present it |
|
|
63
63
|
| **Spreadsheet** | `SheetGrid`, `sheetToDelimited`, `sheetToAoA` — an AI-editable grid, extensible with your own column types |
|
|
64
64
|
| **HarnessRouter** (`reifyui/harness`) | `configureKit`, `kitHarness`, `listSessions`, `readFile`, `writeFile`, `createResponse`, `streamTurn`, `turnsToMessages`, `fileToInputBlock` — the transport for apps served by a HarnessRouter console |
|
|
65
|
+
| **File tree** (`reifyui/tree`) | `FileTree`, `buildFileTree`, `treeKeyAction`, `nameProblem`, `canMove` — a folder tree of files the way an editor's Explorer shows one: names typed in place, a delete asked in the row, drag into a folder, a right-click menu, the WAI-ARIA tree keyboard |
|
|
65
66
|
| **Agent chat** (`reifyui/agent-chat`) | `AgentConversation`, `AgentTurnView`, `AgentComposer`, `WorkingIndicator`, `StepRow`, `WorkGroup`, `TodoCard`, `reduceTurn`, `turnFromMessage`, `describeTool`, `motionFor` — an agent's turn the way Claude Code shows it: one live line, work folded to a past-tense line per run of calls, every call one click from its input and output |
|
|
66
67
|
| **Icons / tool meta** | `Ic*` icon set, `toolMeta`, `humanize`, `summarizeSteps` |
|
|
67
68
|
| **Auth (optional)** | `configureAuth`, `login`, `AuthForm`, `GoogleButton` — a thin JWT client for products with a `/v1/auth`-style backend; wired to nothing by default |
|
|
@@ -157,6 +158,7 @@ import 'reifyui/styles/panels.css'; // panel + panel grid, stat tile, res
|
|
|
157
158
|
import 'reifyui/styles/tasks.css'; // task list
|
|
158
159
|
import 'reifyui/styles/dialog.css'; // alert / confirm / prompt dialogs
|
|
159
160
|
import 'reifyui/styles/agent-chat.css'; // reifyui/agent-chat: the agent conversation
|
|
161
|
+
import 'reifyui/styles/tree.css'; // reifyui/tree: the file tree
|
|
160
162
|
```
|
|
161
163
|
|
|
162
164
|
Themes are CSS-variable files — load one, or switch at runtime by toggling which you apply. Override
|
|
@@ -231,6 +233,47 @@ into a kind, a target, lines added and removed, and the plan; a browser call rea
|
|
|
231
233
|
the logos: pass your mark as a node and `motionFor(base)` names a motion, or none for three dots.
|
|
232
234
|
All motion stops under `prefers-reduced-motion`.
|
|
233
235
|
|
|
236
|
+
## File tree
|
|
237
|
+
|
|
238
|
+
`reifyui/tree` is a folder tree of files the way an editor's Explorer shows one. It draws a flat
|
|
239
|
+
list of paths (folders are implied by the files in them; a `dir` entry keeps an empty one) and
|
|
240
|
+
reports what the person did; your list changes and comes back in.
|
|
241
|
+
|
|
242
|
+
```jsx
|
|
243
|
+
import { FileTree } from 'reifyui/tree';
|
|
244
|
+
import 'reifyui/styles/tree.css';
|
|
245
|
+
|
|
246
|
+
<FileTree
|
|
247
|
+
title="Snippets"
|
|
248
|
+
entries={[{ path: 'tasks/refund', kind: 'file' }, { path: 'drafts', kind: 'dir' }]}
|
|
249
|
+
selected={open} onSelect={(path, kind) => kind === 'file' && setOpen(path)}
|
|
250
|
+
labels={{ newFile: 'New snippet', newFileInput: 'Name of the new snippet' }}
|
|
251
|
+
onCreate={({ path, kind }) => api.create(path, kind)} // a returned string is shown under the name
|
|
252
|
+
onRename={({ from, to }) => api.rename(from, to)}
|
|
253
|
+
onDelete={({ path, kind }) => api.remove(path, kind)}
|
|
254
|
+
onMove={({ from, toDir }) => api.move(from, toDir)}
|
|
255
|
+
onUpload={(dir) => pickFilesInto(dir)} // your own file picker
|
|
256
|
+
validateName={(name) => (name.length > 64 ? 'Use 64 characters or fewer.' : '')}
|
|
257
|
+
menuItems={[{ id: 'include', label: 'Copy include line', when: (p, kind) => kind === 'file',
|
|
258
|
+
onSelect: (p) => copy(`{{template "${p}" .}}`) }]}
|
|
259
|
+
/>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
The header holds the title and, beside it, New file, New folder, Upload and Collapse all (only the
|
|
263
|
+
ones whose handler you pass; `actions` picks fewer). New file and New folder open a name field in the
|
|
264
|
+
folder in use: Enter keeps it, Escape puts it away, leaving the field keeps a valid name. `''`, `.`,
|
|
265
|
+
`..`, a slash and a name already in that folder are refused before `validateName` is asked. F2 or the
|
|
266
|
+
row's pencil renames in place; Delete asks in the row ("Delete tasks and the 3 files in it?"); a row
|
|
267
|
+
drags into another folder or the top, never into itself. A right click, Shift+F10 or the menu key
|
|
268
|
+
opens the row's menu. Arrow keys, Home and End move; Right and Left open, close and step in and out.
|
|
269
|
+
A handler may return a message, or a Promise of one, to refuse: it shows where the person acted.
|
|
270
|
+
|
|
271
|
+
`open` + `onOpenChange` control the open folders (`defaultOpen` otherwise: every folder, or a list).
|
|
272
|
+
`readOnly` draws the tree with nothing to change. `busy`, `pending` (paths with a save in flight),
|
|
273
|
+
`rowErrors` and `error` show what the host is doing. Every word is in `labels`. The model it runs on
|
|
274
|
+
(`buildFileTree`, `visibleRows`, `treeKeyAction`, `nameProblem`, `canMove`) needs no React, so a
|
|
275
|
+
host can check a name or a move by the same rules. Colours come from `--uic-*` (or `--rui-tree-*`).
|
|
276
|
+
|
|
234
277
|
## Slides
|
|
235
278
|
|
|
236
279
|
A deck is JSON — a fixed 1920×1080 stage, and elements with absolute frames and stable ids. That
|
package/dist/index.cjs
CHANGED
|
@@ -76,6 +76,7 @@ __export(src_exports, {
|
|
|
76
76
|
MentionText: () => MentionText,
|
|
77
77
|
MicrosoftButton: () => MicrosoftButton,
|
|
78
78
|
Modal: () => Modal,
|
|
79
|
+
PERSON_CHECK_FAILED: () => PERSON_CHECK_FAILED,
|
|
79
80
|
PaneResizer: () => PaneResizer,
|
|
80
81
|
Panel: () => Panel,
|
|
81
82
|
PanelGrid: () => PanelGrid,
|
|
@@ -121,12 +122,14 @@ __export(src_exports, {
|
|
|
121
122
|
microsoftSignIn: () => microsoftSignIn,
|
|
122
123
|
packLayout: () => packLayout,
|
|
123
124
|
parseArgs: () => parseArgs,
|
|
125
|
+
personToken: () => personToken,
|
|
124
126
|
prettyJson: () => prettyJson,
|
|
125
127
|
pumpResponsesStream: () => pumpResponsesStream,
|
|
126
128
|
readSSEStream: () => readSSEStream,
|
|
127
129
|
refreshToken: () => refreshToken,
|
|
128
130
|
register: () => register,
|
|
129
131
|
requestPasswordReset: () => requestPasswordReset,
|
|
132
|
+
resendVerification: () => resendVerification,
|
|
130
133
|
sheetToAoA: () => sheetToAoA,
|
|
131
134
|
sheetToDelimited: () => sheetToDelimited,
|
|
132
135
|
summarizeSteps: () => summarizeSteps,
|
|
@@ -987,10 +990,10 @@ var Chip = (0, import_react6.forwardRef)(function Chip2(props, ref) {
|
|
|
987
990
|
removeLabel,
|
|
988
991
|
trailing,
|
|
989
992
|
className,
|
|
990
|
-
slot,
|
|
993
|
+
slot: slot2,
|
|
991
994
|
...rest
|
|
992
995
|
} = props;
|
|
993
|
-
const isSlot =
|
|
996
|
+
const isSlot = slot2 ?? (Boolean(onClick) && !selected);
|
|
994
997
|
const cls2 = [
|
|
995
998
|
"uic-chip",
|
|
996
999
|
selected ? "is-selected" : "",
|
|
@@ -1190,8 +1193,8 @@ function toolKind(name) {
|
|
|
1190
1193
|
function str(v) {
|
|
1191
1194
|
return v == null ? "" : typeof v === "string" ? v : Array.isArray(v) ? v.join(" ") : String(v);
|
|
1192
1195
|
}
|
|
1193
|
-
function firstOf(a,
|
|
1194
|
-
for (const k of
|
|
1196
|
+
function firstOf(a, keys2) {
|
|
1197
|
+
for (const k of keys2) {
|
|
1195
1198
|
const v = a[k];
|
|
1196
1199
|
if (v != null && v !== "" && !(Array.isArray(v) && !v.length)) return v;
|
|
1197
1200
|
}
|
|
@@ -2386,11 +2389,11 @@ function inputLines(d, item) {
|
|
|
2386
2389
|
if (lines.length > (path ? 1 : 0)) return { lines, copy: typeof item.args === "string" ? item.args : JSON.stringify(a, null, 2) };
|
|
2387
2390
|
}
|
|
2388
2391
|
if (a._raw != null) return { lines: asLines(a._raw), copy: a._raw };
|
|
2389
|
-
const
|
|
2390
|
-
const flat =
|
|
2392
|
+
const keys2 = Object.keys(a);
|
|
2393
|
+
const flat = keys2.length && keys2.every((k) => a[k] == null || typeof a[k] !== "object");
|
|
2391
2394
|
if (flat) {
|
|
2392
2395
|
const lines = [];
|
|
2393
|
-
for (const k of
|
|
2396
|
+
for (const k of keys2) {
|
|
2394
2397
|
const v = a[k] == null ? "" : String(a[k]);
|
|
2395
2398
|
const vs = v.split("\n");
|
|
2396
2399
|
lines.push({ text: `${k}: ${vs[0]}`, cls: "is-kv" });
|
|
@@ -2398,7 +2401,7 @@ function inputLines(d, item) {
|
|
|
2398
2401
|
}
|
|
2399
2402
|
return { lines, copy: typeof item.args === "string" ? item.args : JSON.stringify(a, null, 2) };
|
|
2400
2403
|
}
|
|
2401
|
-
const js =
|
|
2404
|
+
const js = keys2.length ? JSON.stringify(a, null, 2) : "";
|
|
2402
2405
|
return { lines: js ? asLines(js) : [], copy: js };
|
|
2403
2406
|
}
|
|
2404
2407
|
function StepDetail(props) {
|
|
@@ -3460,8 +3463,8 @@ function PaneResizer(props) {
|
|
|
3460
3463
|
const { pane, className, title = "Drag to resize (double-click to reset)" } = props;
|
|
3461
3464
|
const vertical = pane.axis === "y";
|
|
3462
3465
|
const onKeyDown = (e) => {
|
|
3463
|
-
const
|
|
3464
|
-
if (!
|
|
3466
|
+
const keys2 = vertical ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"];
|
|
3467
|
+
if (!keys2.includes(e.key)) return;
|
|
3465
3468
|
if (!pane.nudge) return;
|
|
3466
3469
|
e.preventDefault();
|
|
3467
3470
|
const step = e.shiftKey ? 96 : 24;
|
|
@@ -3977,6 +3980,96 @@ function ChoiceList({ label, entry, onPick }) {
|
|
|
3977
3980
|
] });
|
|
3978
3981
|
}
|
|
3979
3982
|
|
|
3983
|
+
// src/auth/personCheck.js
|
|
3984
|
+
var SCRIPT = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";
|
|
3985
|
+
var WAIT_MS = 6e4;
|
|
3986
|
+
var PERSON_CHECK_FAILED = "We couldn't confirm you're a person. Please try again.";
|
|
3987
|
+
var keys = /* @__PURE__ */ new Map();
|
|
3988
|
+
var script = null;
|
|
3989
|
+
function siteKey(engine) {
|
|
3990
|
+
let p = keys.get(engine);
|
|
3991
|
+
if (!p) {
|
|
3992
|
+
p = fetch(`${engine}/v1/auth/person-check`, { cache: "no-store" }).then(async (r) => {
|
|
3993
|
+
if (!r.ok) throw new Error("no answer");
|
|
3994
|
+
const b = await r.json();
|
|
3995
|
+
return typeof b?.site_key === "string" ? b.site_key : "";
|
|
3996
|
+
}).catch(() => {
|
|
3997
|
+
keys.delete(engine);
|
|
3998
|
+
return "";
|
|
3999
|
+
});
|
|
4000
|
+
keys.set(engine, p);
|
|
4001
|
+
}
|
|
4002
|
+
return p;
|
|
4003
|
+
}
|
|
4004
|
+
function loadScript() {
|
|
4005
|
+
script ?? (script = new Promise((resolve, reject) => {
|
|
4006
|
+
if (window.turnstile) {
|
|
4007
|
+
resolve(window.turnstile);
|
|
4008
|
+
return;
|
|
4009
|
+
}
|
|
4010
|
+
const s = document.createElement("script");
|
|
4011
|
+
s.src = SCRIPT;
|
|
4012
|
+
s.async = true;
|
|
4013
|
+
s.defer = true;
|
|
4014
|
+
s.onload = () => window.turnstile ? resolve(window.turnstile) : reject(new Error(PERSON_CHECK_FAILED));
|
|
4015
|
+
s.onerror = () => {
|
|
4016
|
+
script = null;
|
|
4017
|
+
s.remove();
|
|
4018
|
+
reject(new Error(PERSON_CHECK_FAILED));
|
|
4019
|
+
};
|
|
4020
|
+
document.head.appendChild(s);
|
|
4021
|
+
}));
|
|
4022
|
+
return script;
|
|
4023
|
+
}
|
|
4024
|
+
function slot() {
|
|
4025
|
+
const shown = Array.from(document.querySelectorAll("[data-person-check]")).find((el2) => el2.offsetParent !== null);
|
|
4026
|
+
if (shown) return shown;
|
|
4027
|
+
let el = document.getElementById("person-check-fallback");
|
|
4028
|
+
if (!el) {
|
|
4029
|
+
el = document.createElement("div");
|
|
4030
|
+
el.id = "person-check-fallback";
|
|
4031
|
+
el.className = "person-check-fallback";
|
|
4032
|
+
document.body.appendChild(el);
|
|
4033
|
+
}
|
|
4034
|
+
return el;
|
|
4035
|
+
}
|
|
4036
|
+
async function personToken(door, engine) {
|
|
4037
|
+
const key = await siteKey(engine);
|
|
4038
|
+
if (!key) return "";
|
|
4039
|
+
const ts = await loadScript();
|
|
4040
|
+
const host = document.createElement("div");
|
|
4041
|
+
slot().appendChild(host);
|
|
4042
|
+
return new Promise((resolve, reject) => {
|
|
4043
|
+
let id = "";
|
|
4044
|
+
const done = (fn) => {
|
|
4045
|
+
clearTimeout(timer);
|
|
4046
|
+
try {
|
|
4047
|
+
if (id) ts.remove(id);
|
|
4048
|
+
} catch {
|
|
4049
|
+
}
|
|
4050
|
+
host.remove();
|
|
4051
|
+
fn();
|
|
4052
|
+
};
|
|
4053
|
+
const fail = () => done(() => reject(new Error(PERSON_CHECK_FAILED)));
|
|
4054
|
+
const timer = setTimeout(fail, WAIT_MS);
|
|
4055
|
+
try {
|
|
4056
|
+
id = ts.render(host, {
|
|
4057
|
+
sitekey: key,
|
|
4058
|
+
action: door,
|
|
4059
|
+
appearance: "interaction-only",
|
|
4060
|
+
theme: "auto",
|
|
4061
|
+
"refresh-expired": "never",
|
|
4062
|
+
callback: (token) => done(() => resolve(token)),
|
|
4063
|
+
"error-callback": fail,
|
|
4064
|
+
"expired-callback": fail,
|
|
4065
|
+
"timeout-callback": fail
|
|
4066
|
+
});
|
|
4067
|
+
} catch {
|
|
4068
|
+
fail();
|
|
4069
|
+
}
|
|
4070
|
+
});
|
|
4071
|
+
}
|
|
4072
|
+
|
|
3980
4073
|
// src/auth/client.js
|
|
3981
4074
|
var _cfg = {
|
|
3982
4075
|
// Same-origin. A product that forgets to configure gets the working default rather than the
|
|
@@ -4053,7 +4146,8 @@ async function login(email, password) {
|
|
|
4053
4146
|
return s;
|
|
4054
4147
|
}
|
|
4055
4148
|
async function register(email, password, name = "") {
|
|
4056
|
-
const
|
|
4149
|
+
const turnstile_token = await personToken("register", _cfg.engine);
|
|
4150
|
+
const s = toSession(await authPost("/v1/auth/register", { email, password, name, product: _cfg.product, turnstile_token }));
|
|
4057
4151
|
setSession(s);
|
|
4058
4152
|
return s;
|
|
4059
4153
|
}
|
|
@@ -4067,12 +4161,30 @@ async function microsoftSignIn(credential) {
|
|
|
4067
4161
|
setSession(s);
|
|
4068
4162
|
return s;
|
|
4069
4163
|
}
|
|
4070
|
-
async function
|
|
4071
|
-
|
|
4164
|
+
async function readMailDoorError(res) {
|
|
4165
|
+
if (res.status === 400 || res.status === 403 || res.status === 503) {
|
|
4166
|
+
try {
|
|
4167
|
+
const d = (await res.json())?.detail;
|
|
4168
|
+
if (typeof d === "string" && d.length > 0 && d.length < 200) return d;
|
|
4169
|
+
} catch {
|
|
4170
|
+
}
|
|
4171
|
+
}
|
|
4172
|
+
return "We could not send the request. Please try again later.";
|
|
4173
|
+
}
|
|
4174
|
+
async function mailDoor(path, door, email) {
|
|
4175
|
+
const turnstile_token = await personToken(door, _cfg.engine);
|
|
4176
|
+
const res = await fetch(`${_cfg.engine}${path}`, {
|
|
4072
4177
|
method: "POST",
|
|
4073
4178
|
headers: { "content-type": "application/json" },
|
|
4074
|
-
body: JSON.stringify({ email, product: _cfg.product })
|
|
4179
|
+
body: JSON.stringify({ email, product: _cfg.product, turnstile_token })
|
|
4075
4180
|
});
|
|
4181
|
+
if (!res.ok) throw new Error(await readMailDoorError(res));
|
|
4182
|
+
}
|
|
4183
|
+
async function requestPasswordReset(email) {
|
|
4184
|
+
await mailDoor("/v1/auth/request-password-reset", "reset", email);
|
|
4185
|
+
}
|
|
4186
|
+
async function resendVerification(email) {
|
|
4187
|
+
await mailDoor("/v1/auth/resend-verification", "resend", email);
|
|
4076
4188
|
}
|
|
4077
4189
|
async function switchOrg(orgId) {
|
|
4078
4190
|
const current = getSession();
|
|
@@ -4450,6 +4562,7 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
4450
4562
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { children: "Email" }),
|
|
4451
4563
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
4452
4564
|
] }),
|
|
4565
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-person-check": "", className: "person-check" }),
|
|
4453
4566
|
err && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "auth-err", children: err }),
|
|
4454
4567
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
|
|
4455
4568
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "auth-switch", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: () => {
|
|
@@ -4487,6 +4600,7 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
4487
4600
|
}
|
|
4488
4601
|
)
|
|
4489
4602
|
] }),
|
|
4603
|
+
mode === "register" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-person-check": "", className: "person-check" }),
|
|
4490
4604
|
err && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "auth-err", children: err }),
|
|
4491
4605
|
/* @__PURE__ */ (0, import_jsx_runtime14.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" }),
|
|
4492
4606
|
(GOOGLE_ENABLED || MICROSOFT_ENABLED) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "auth-or", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "or" }) }),
|