@floless/app 0.86.0 → 0.87.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.
@@ -53106,7 +53106,7 @@ function appVersion() {
53106
53106
  return resolveVersion({
53107
53107
  isSea: isSea2(),
53108
53108
  sqVersionXml: readSqVersionXml(),
53109
- define: true ? "0.86.0" : void 0,
53109
+ define: true ? "0.87.0" : void 0,
53110
53110
  pkgVersion: readPkgVersion()
53111
53111
  });
53112
53112
  }
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
53116
53116
  return "dev";
53117
53117
  }
53118
53118
  function appChannel() {
53119
- return resolveChannel({ isSea: isSea2(), define: true ? "0.86.0" : void 0 });
53119
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.87.0" : void 0 });
53120
53120
  }
53121
53121
 
53122
53122
  // workflow-update.ts
@@ -54329,6 +54329,9 @@ function slugify(name) {
54329
54329
  function projectDir(id) {
54330
54330
  return (0, import_node_path18.join)(DIR2, safeProjectId(id));
54331
54331
  }
54332
+ function archiveDir(id) {
54333
+ return (0, import_node_path18.join)(ARCHIVE, safeProjectId(id));
54334
+ }
54332
54335
  function projectExportsDir(id) {
54333
54336
  return (0, import_node_path18.join)(projectDir(id), "exports");
54334
54337
  }
@@ -54336,17 +54339,19 @@ function projectKnowledgeDir(id) {
54336
54339
  return (0, import_node_path18.join)(projectDir(id), "knowledge");
54337
54340
  }
54338
54341
  var metaPath = (id) => (0, import_node_path18.join)(projectDir(id), "project.json");
54339
- function readMeta(id) {
54340
- const p = metaPath(id);
54341
- if (!(0, import_node_fs20.existsSync)(p)) return null;
54342
+ function readMetaFile(jsonPath, id) {
54343
+ if (!(0, import_node_fs20.existsSync)(jsonPath)) return null;
54342
54344
  try {
54343
- const meta = JSON.parse((0, import_node_fs20.readFileSync)(p, "utf8"));
54345
+ const meta = JSON.parse((0, import_node_fs20.readFileSync)(jsonPath, "utf8"));
54344
54346
  return meta && meta.id === id ? meta : null;
54345
54347
  } catch (e) {
54346
- console.warn(`projects-store: ignoring unreadable project.json at ${p}: ${e instanceof Error ? e.message : e}`);
54348
+ console.warn(`projects-store: ignoring unreadable project.json at ${jsonPath}: ${e instanceof Error ? e.message : e}`);
54347
54349
  return null;
54348
54350
  }
54349
54351
  }
54352
+ function readMeta(id) {
54353
+ return readMetaFile(metaPath(id), id);
54354
+ }
54350
54355
  var writeMeta = (meta) => (0, import_node_fs20.writeFileSync)(metaPath(meta.id), JSON.stringify(meta, null, 2));
54351
54356
  function listProjects() {
54352
54357
  if (!(0, import_node_fs20.existsSync)(DIR2)) return [];
@@ -54415,8 +54420,35 @@ function archiveProject(id) {
54415
54420
  (0, import_node_fs20.mkdirSync)(ARCHIVE, { recursive: true });
54416
54421
  const dest = (0, import_node_path18.join)(ARCHIVE, id);
54417
54422
  if ((0, import_node_fs20.existsSync)(dest)) throw new ProjectError(`already archived: ${id}`);
54423
+ const meta = readMeta(id);
54424
+ if (meta) writeMeta({ ...meta, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
54418
54425
  (0, import_node_fs20.renameSync)(dir, dest);
54419
54426
  }
54427
+ function listArchivedProjects() {
54428
+ if (!(0, import_node_fs20.existsSync)(ARCHIVE)) return [];
54429
+ const out = [];
54430
+ for (const entry2 of (0, import_node_fs20.readdirSync)(ARCHIVE, { withFileTypes: true })) {
54431
+ if (!entry2.isDirectory() || entry2.name.startsWith(".")) continue;
54432
+ const meta = readMetaFile((0, import_node_path18.join)(ARCHIVE, entry2.name, "project.json"), entry2.name);
54433
+ if (meta) out.push(meta);
54434
+ }
54435
+ return out.sort((a, b) => a.updatedAt < b.updatedAt ? 1 : -1);
54436
+ }
54437
+ function unarchiveProject(id) {
54438
+ const src = archiveDir(id);
54439
+ if (!(0, import_node_fs20.existsSync)(src)) throw new ProjectError(`not archived: ${id}`);
54440
+ const meta = readMetaFile((0, import_node_path18.join)(src, "project.json"), id);
54441
+ if (!meta) throw new ProjectError(`archived project has missing or unreadable metadata: ${id}`);
54442
+ const dest = projectDir(id);
54443
+ if ((0, import_node_fs20.existsSync)(dest)) throw new ProjectError(`a live project with that id already exists: ${id}`);
54444
+ (0, import_node_fs20.renameSync)(src, dest);
54445
+ return meta;
54446
+ }
54447
+ function deleteArchivedProject(id) {
54448
+ const dir = archiveDir(id);
54449
+ if (!(0, import_node_fs20.existsSync)(dir)) throw new ProjectError(`not archived: ${id}`);
54450
+ (0, import_node_fs20.rmSync)(dir, { recursive: true, force: true });
54451
+ }
54420
54452
 
54421
54453
  // knowledge-routes.ts
54422
54454
  var import_node_fs22 = require("node:fs");
@@ -66277,6 +66309,24 @@ async function startServer() {
66277
66309
  throw e;
66278
66310
  }
66279
66311
  });
66312
+ app.get("/api/projects/archived", async () => ({ ok: true, projects: listArchivedProjects() }));
66313
+ app.post("/api/projects/:id/unarchive", async (req, reply) => {
66314
+ try {
66315
+ return { ok: true, project: unarchiveProject(req.params.id) };
66316
+ } catch (e) {
66317
+ if (e instanceof ProjectError) return reply.status(400).send({ ok: false, error: e.message });
66318
+ throw e;
66319
+ }
66320
+ });
66321
+ app.delete("/api/projects/:id/archived", async (req, reply) => {
66322
+ try {
66323
+ deleteArchivedProject(req.params.id);
66324
+ return { ok: true };
66325
+ } catch (e) {
66326
+ if (e instanceof ProjectError) return reply.status(400).send({ ok: false, error: e.message });
66327
+ throw e;
66328
+ }
66329
+ });
66280
66330
  app.get("/api/projects/:id/versions", async (req, reply) => {
66281
66331
  const p = getProject(req.params.id);
66282
66332
  if (!p) return reply.status(404).send({ ok: false, error: `unknown project: ${req.params.id}` });
package/dist/web/app.css CHANGED
@@ -3473,6 +3473,34 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
3473
3473
  .ws-card .ws-kebab { background:transparent; border:1px solid transparent; color:var(--text-dim);
3474
3474
  padding:2px 7px; border-radius:4px; font-size:14px; line-height:1; flex:none; }
3475
3475
  .ws-card .ws-kebab:hover { border-color:var(--border-strong); color:var(--text); }
3476
+ /* Archived projects ("Trash") — a collapsed disclosure below the live grid. Demoted vs .ws-card:
3477
+ flat rows in one contained panel, muted text — reads as "put away", not "open me". */
3478
+ .ws-archived { margin-top:22px; border-top:1px solid var(--border); padding-top:10px; }
3479
+ .ws-archived-summary { list-style:none; cursor:pointer; display:inline-flex; align-items:center; gap:7px;
3480
+ font-size:10px; text-transform:uppercase; letter-spacing:.18em; color:var(--text-dim);
3481
+ padding:5px 6px; border-radius:4px; user-select:none; }
3482
+ .ws-archived-summary::-webkit-details-marker { display:none; }
3483
+ .ws-archived-summary:hover { color:var(--text-muted); }
3484
+ .ws-archived-summary:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
3485
+ .ws-archived[open] > .ws-archived-summary .ws-archived-caret { transform:rotate(90deg); }
3486
+ .ws-archived-count { font-family:var(--mono); letter-spacing:0; color:var(--text-muted); }
3487
+ .ws-archived-list { margin-top:8px; border:1px solid var(--border); border-radius:10px; background:var(--surface);
3488
+ max-height:320px; overflow-y:auto; scrollbar-width:thin; scrollbar-color:var(--border-strong) transparent; }
3489
+ .ws-archived-row { display:flex; align-items:center; justify-content:space-between; gap:12px;
3490
+ padding:10px 13px; border-bottom:1px solid var(--border); }
3491
+ .ws-archived-row:last-child { border-bottom:none; }
3492
+ .ws-archived-info { min-width:0; display:flex; flex-direction:column; gap:3px; }
3493
+ .ws-archived-name { font-size:13px; font-weight:600; color:var(--text-muted);
3494
+ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
3495
+ .ws-archived-meta { font-size:11px; color:var(--text-dim); }
3496
+ .ws-archived-meta .t { font-family:var(--mono); font-size:10px; }
3497
+ .ws-archived-actions { display:flex; gap:8px; flex:none; }
3498
+ .ws-archived-list .btn-mini { background:none; border:1px solid var(--border-strong); color:var(--text-muted);
3499
+ border-radius:6px; padding:4px 10px; font-size:11px; cursor:pointer; white-space:nowrap; }
3500
+ .ws-archived-list .ws-restore:hover { color:var(--text); border-color:var(--accent); }
3501
+ /* Destructive: neutral at rest, danger only on hover (same restraint as #rtn-delete-confirm). */
3502
+ .ws-archived-list .ws-del:hover { color:var(--err); border-color:var(--err);
3503
+ background:color-mix(in srgb, var(--err) 10%, transparent); }
3476
3504
  .ws-seed { border:2px dashed var(--accent-dim); background:transparent; border-radius:8px; min-height:150px;
3477
3505
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; cursor:pointer;
3478
3506
  color:var(--text-muted); font-size:12px; width:100%; text-align:center; padding:12px; }
@@ -2433,7 +2433,7 @@ function panel(){
2433
2433
  return;
2434
2434
  }}
2435
2435
  const arr=selArr();
2436
- if(arr.length===0){p.innerHTML='<h3 style="display:flex;justify-content:space-between;align-items:center">Legend'+(Object.keys(C.profile_colors).length?'<button class=ghost id=resetCols style="font-size:10px;padding:1px 6px">reset colours</button>':'')+'</h3><div class=legend>'+profs.filter(pr=>P.members.some(mm=>mm.profile===pr)).map(pr=>`<span><input type=color class=swc data-prof="${esc(pr)}" value="${colorFor(pr)}" data-tip="Click to recolour ${esc(pr)}">${esc(pr)}</span>`).join('')+'</div><div class=hint style="margin-top:12px">Click a member to edit; <b>Ctrl</b>/<b>Shift+click</b> to add/remove; drag an empty area to <b>box-select</b> — <b>left→right</b> grabs fully-enclosed, <b>right→left</b> grabs touched (Ctrl/Shift adds). Drag a selected line to move it (all selected move together) — it snaps onto nearby grid/endpoints; drag an end dot to adjust — also snaps (<b>Alt</b> off). Hold <b>Shift</b> to keep it straight (H/V). <b>Ctrl+D</b> duplicate, <b>Ctrl+Z/Y</b> undo/redo, <b>Del</b> delete, <b>Esc</b> deselect. <b>Ctrl+scroll</b> zoom, <b>middle-drag</b> pan, <b>Home</b> fit. Short even dashes = RFI (size unresolved, e.g. MF). A line with <b>arrowheads</b> is a <b>brace</b> — solid = above the floor, long–short dashes = below; the double arrowhead marks its lower end.</div>'+
2436
+ if(arr.length===0){p.innerHTML='<h3 style="display:flex;justify-content:space-between;align-items:center">Legend'+(Object.keys(C.profile_colors).length?'<button class=ghost id=resetCols style="font-size:10px;padding:1px 6px">reset colours</button>':'')+'</h3><div class=legend>'+profs.filter(pr=>P.members.some(mm=>mm.profile===pr)).map(pr=>`<span><input type=color class=swc data-prof="${esc(pr)}" value="${colorFor(pr)}" data-tip="Click to recolour ${esc(pr)}">${esc(pr)}</span>`).join('')+'</div><div class=hint style="margin-top:12px">Click a member to edit; <b>Ctrl</b>/<b>Shift+click</b> to add/remove; drag an empty area to <b>box-select</b> — <b>left→right</b> grabs fully-enclosed, <b>right→left</b> grabs touched (Ctrl/Shift adds). Drag a selected line to move it (all selected move together) — it snaps onto nearby grid/endpoints; drag an end dot to adjust — also snaps (<b>Alt</b> off). Hold <b>Shift</b> to keep it straight (H/V). <b>Ctrl+D</b> duplicate, <b>Ctrl+Z/Y</b> undo/redo, <b>Del</b> delete, <b>Esc</b> deselect. <b>Scroll</b> zoom, <b>middle-drag</b> pan, <b>Home</b> fit. Short even dashes = RFI (size unresolved, e.g. MF). A line with <b>arrowheads</b> is a <b>brace</b> — solid = above the floor, long–short dashes = below; the double arrowhead marks its lower end.</div>'+
2437
2437
  '<div style="border-top:1px solid var(--line);margin-top:12px;padding-top:12px"><div class=sect>Project defaults</div>'+
2438
2438
  '<div class=hint style="margin:0 0 6px;font-size:11px">Level <b>'+esc(fmtFtIn(defaultTOS))+'</b> ('+esc(P.sheet)+'). '+((P.tos_callouts&&P.tos_callouts.length)?'Per-zone T.O. STEEL callouts from the drawing applied to each member; ':'')+'ends ticked <b>default</b> follow the level.</div>'+
2439
2439
  '<div class=elab>Default TOS</div><input id=defTos inputmode=decimal placeholder="5 3/4&quot; · 1&#39;-0 1/4&quot;" value="'+esc(fmtFtIn(defaultTOS))+'"><span class=edec>'+esc(fmtDecIn(defaultTOS))+'</span>'+
@@ -5221,8 +5221,8 @@ document.getElementById('vt2d').onclick=()=>{if(view3d)setView(false);};
5221
5221
  document.getElementById('vt3d').onclick=()=>{if(!view3d)setView(true);};
5222
5222
  // Block the browser's Ctrl+wheel page-zoom anywhere in the app (fires even when the pointer isn't over the canvas). Canvas zoom below still runs.
5223
5223
  window.addEventListener('wheel',e=>{if(e.ctrlKey)e.preventDefault();},{passive:false});
5224
- // Ctrl+wheel = zoom at cursor
5225
- stage.addEventListener('wheel',e=>{if(e.ctrlKey){e.preventDefault();applyZoom(zoom*Math.exp(-e.deltaY*0.0015),e.clientX,e.clientY);}},{passive:false});
5224
+ // wheel = zoom at cursor (matches 3D; Ctrl+wheel too). Pan is middle-drag, below.
5225
+ stage.addEventListener('wheel',e=>{e.preventDefault();applyZoom(zoom*Math.exp(-e.deltaY*0.0015),e.clientX,e.clientY);},{passive:false});
5226
5226
  // middle-button drag = pan
5227
5227
  stage.addEventListener('mousedown',e=>{if(e.button===1)e.preventDefault();});
5228
5228
  let pan=null;
@@ -174,6 +174,7 @@
174
174
  let mode = 'workflows';
175
175
  try { if (localStorage.getItem(LS_MODE) === 'workspaces') mode = 'workspaces'; } catch { /* private mode */ }
176
176
  let projects = [];
177
+ let archived = []; // archived projects (the "Trash") — listed under a collapsed section on the landing
177
178
  // Installed workspace apps, in descriptor order. Populated from /api/apps in loadProjects():
178
179
  // the set = apps flagged workspace===true that ALSO have a WORKSPACE_APPS descriptor (an app
179
180
  // flagged workspace with no descriptor is skipped with a console note — never a broken open).
@@ -262,6 +263,11 @@
262
263
  // (the empty-state CTA would be a lie: "no projects yet" when the truth is "load failed").
263
264
  try { ({ projects } = await api('/api/projects')); }
264
265
  catch (err) { projects = []; showToast('Couldn’t load projects: ' + (err && err.message || err), 'warn'); }
266
+ // Archived ("Trash") list is a secondary concern — never let its failure blank the main workspace,
267
+ // but don't swallow it silently either: warn so a broken archive listing is diagnosable (a bare
268
+ // catch here would hide a real 500 and leave the "Archived" section invisible with no breadcrumb).
269
+ try { ({ projects: archived } = await api('/api/projects/archived')); }
270
+ catch (err) { archived = []; console.warn('[workspaces] archived list failed to load: ' + (err && err.message || err)); }
265
271
  // Which workspace apps to offer a create card for: those flagged workspace===true on /api/apps
266
272
  // that we ALSO know how to render (have a WORKSPACE_APPS descriptor). Keep descriptor order for a
267
273
  // stable card order. A load failure leaves wsAppIds at its descriptor-key fallback (still usable).
@@ -341,7 +347,29 @@
341
347
  : hasDrawingSeed
342
348
  ? 'No projects yet — drop a drawing above, or ask your terminal AI to trace a drawing set.'
343
349
  : 'No projects yet — import your current steel model above, or ask your terminal AI to read a drawing set.';
344
- html += `<div class="ws-empty-note">${escapeHtml(note)}</div>`;
350
+ html += `<div class="ws-empty-note">${escapeHtml(note)}${archived.length ? ' You have archived projects below.' : ''}</div>`;
351
+ }
352
+ // Archived ("Trash") section — a collapsed disclosure below the live grid, only when non-empty.
353
+ // Demoted rows (muted, no thumb) read as "put away"; each offers Restore + a guarded Delete.
354
+ if (archived.length) {
355
+ let rows = '';
356
+ for (const p of archived) {
357
+ const displayApp = appDisplayName(p.app);
358
+ rows += `<div class="ws-archived-row">` +
359
+ `<span class="ws-archived-info">` +
360
+ `<span class="ws-archived-name">${escapeHtml(p.name)}</span>` +
361
+ `<span class="ws-archived-meta">${escapeHtml(displayApp)} · archived <span class="t">${escapeHtml(relAgo(p.updatedAt))}</span></span>` +
362
+ `</span>` +
363
+ `<span class="ws-archived-actions">` +
364
+ `<button type="button" class="btn-mini ws-restore" data-restore="${escapeAttr(p.id)}" data-tip="Un-archive — returns to the live grid">↺ Restore</button>` +
365
+ `<button type="button" class="btn-mini ws-del" data-delete-archived="${escapeAttr(p.id)}" data-tip="Permanently erase this project from disk">Delete…</button>` +
366
+ `</span>` +
367
+ `</div>`;
368
+ }
369
+ html += `<details class="ws-archived">` +
370
+ `<summary class="ws-archived-summary"><span class="ws-archived-caret hd-caret" aria-hidden="true">▸</span>Archived <span class="ws-archived-count">${archived.length}</span></summary>` +
371
+ `<div class="ws-archived-list">${rows}</div>` +
372
+ `</details>`;
345
373
  }
346
374
  $landing.innerHTML = html;
347
375
  }
@@ -349,6 +377,10 @@
349
377
  $landing.addEventListener('click', async (e) => {
350
378
  const kebab = e.target.closest('[data-kebab]');
351
379
  if (kebab) { e.stopPropagation(); openProjMenu(kebab.dataset.kebab, kebab); return; }
380
+ const restore = e.target.closest('[data-restore]');
381
+ if (restore) { e.stopPropagation(); unarchiveProject(restore.dataset.restore); return; }
382
+ const del = e.target.closest('[data-delete-archived]');
383
+ if (del) { e.stopPropagation(); deleteArchivedProject(del.dataset.deleteArchived); return; }
352
384
  const card = e.target.closest('[data-open]');
353
385
  if (card) { openProject(card.dataset.open); return; }
354
386
  const seed = e.target.closest('[data-seed-app]');
@@ -2078,6 +2110,38 @@
2078
2110
  loadProjects();
2079
2111
  }
2080
2112
 
2113
+ // Restore an archived project to the live grid (the inverse of Archive). Fully reversible — Archive
2114
+ // puts it right back — so no confirm: a toast is consistent with how Rename/Duplicate/Archive confirm.
2115
+ async function unarchiveProject(id) {
2116
+ const p = archived.find((x) => x.id === id);
2117
+ try {
2118
+ await api(`/api/projects/${encodeURIComponent(id)}/unarchive`, { method: 'POST', body: '{}' });
2119
+ showToast(`Restored${p ? ` “${p.name}”` : ''}`, 'ok');
2120
+ } catch (err) { showToast('Restore failed: ' + (err && err.message || err), 'warn'); }
2121
+ loadProjects();
2122
+ }
2123
+
2124
+ // Permanently delete an archived project. Irreversible → a themed DANGER confirm (red commit, Cancel
2125
+ // focused) spells out exactly what is erased before the DELETE fires. Never a native confirm().
2126
+ async function deleteArchivedProject(id) {
2127
+ const p = archived.find((x) => x.id === id);
2128
+ const name = p ? p.name : id;
2129
+ if (!bridge.formModal) { showToast('Couldn’t open the confirm dialog', 'warn'); return; }
2130
+ const ok = await bridge.formModal({
2131
+ title: `Delete “${name}” permanently?`,
2132
+ sub: 'This erases the project’s contract, version history, and exports from disk. It cannot be undone.',
2133
+ fields: [],
2134
+ okLabel: 'Delete permanently',
2135
+ danger: true,
2136
+ });
2137
+ if (!ok) return;
2138
+ try {
2139
+ await api(`/api/projects/${encodeURIComponent(id)}/archived`, { method: 'DELETE' });
2140
+ showToast(`Deleted “${name}”`, 'ok');
2141
+ } catch (err) { showToast('Delete failed: ' + (err && err.message || err), 'warn'); }
2142
+ loadProjects();
2143
+ }
2144
+
2081
2145
  // ── header project picker ── mirrors #wf-combo/#wf-popover exactly (same DOM shape, same
2082
2146
  // CSS classes): search + flat list of ALL projects, each row showing name + app ·
2083
2147
  // last-touched, with inline Rename/Duplicate/Archive icons. Clicking a row opens/switches
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.86.0",
3
+ "version": "0.87.0",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {