@floless/app 0.101.0 → 0.101.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.
@@ -50770,7 +50770,7 @@ var require_dist6 = __commonJS({
50770
50770
 
50771
50771
  // install-path.mjs
50772
50772
  var import_node_fs = require("node:fs");
50773
- function resolveRealInstallExePure(execPath, localAppData, exists, readdir3, realpath2) {
50773
+ function resolveRealInstallExePure(execPath, localAppData, exists, readdir4, realpath2) {
50774
50774
  if (!execPath) return execPath;
50775
50775
  let resolved = execPath;
50776
50776
  try {
@@ -50789,7 +50789,7 @@ function resolveRealInstallExePure(execPath, localAppData, exists, readdir3, rea
50789
50789
  const packagesDir2 = `${laRoot}\\Packages`;
50790
50790
  let packages;
50791
50791
  try {
50792
- packages = readdir3(packagesDir2);
50792
+ packages = readdir4(packagesDir2);
50793
50793
  } catch {
50794
50794
  return execPath;
50795
50795
  }
@@ -53106,7 +53106,7 @@ function appVersion() {
53106
53106
  return resolveVersion({
53107
53107
  isSea: isSea2(),
53108
53108
  sqVersionXml: readSqVersionXml(),
53109
- define: true ? "0.101.0" : void 0,
53109
+ define: true ? "0.101.1" : 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.101.0" : void 0 });
53119
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.101.1" : void 0 });
53120
53120
  }
53121
53121
 
53122
53122
  // workflow-update.ts
@@ -54397,6 +54397,7 @@ function readContractForApp(appId, readAppFn = readApp) {
54397
54397
 
54398
54398
  // projects-store.ts
54399
54399
  var import_node_fs20 = require("node:fs");
54400
+ var import_promises = require("node:fs/promises");
54400
54401
  var import_node_path18 = require("node:path");
54401
54402
  var import_node_os13 = require("node:os");
54402
54403
  var import_node_crypto6 = require("node:crypto");
@@ -55351,19 +55352,6 @@ function deflateSync(data, opts) {
55351
55352
  function inflateSync(data, opts) {
55352
55353
  return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);
55353
55354
  }
55354
- var fltn = function(d, p, t, o) {
55355
- for (var k in d) {
55356
- var val = d[k], n = p + k, op = o;
55357
- if (Array.isArray(val))
55358
- op = mrg(o, val[1]), val = val[0];
55359
- if (ArrayBuffer.isView(val))
55360
- t[n] = [val, op];
55361
- else {
55362
- t[n += "/"] = [new u8(0), op];
55363
- fltn(val, n, t, o);
55364
- }
55365
- }
55366
- };
55367
55355
  var te = typeof TextEncoder != "undefined" && /* @__PURE__ */ new TextEncoder();
55368
55356
  var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder();
55369
55357
  var tds = 0;
@@ -55714,49 +55702,6 @@ var Zip = /* @__PURE__ */ (function() {
55714
55702
  };
55715
55703
  return Zip2;
55716
55704
  })();
55717
- function zipSync(data, opts) {
55718
- if (!opts)
55719
- opts = {};
55720
- var r = {};
55721
- var files2 = [];
55722
- fltn(data, "", r, opts);
55723
- var o = 0;
55724
- var tot = 0;
55725
- for (var fn in r) {
55726
- var _a2 = r[fn], file = _a2[0], p = _a2[1];
55727
- var compression = p.level == 0 ? 0 : 8;
55728
- var f = strToU8(fn), s = f.length;
55729
- var com = p.comment, m = com && strToU8(com), ms = m && m.length;
55730
- var exl = exfl(p.extra);
55731
- if (s > 65535)
55732
- err(11);
55733
- var d = compression ? deflateSync(file, p) : file, l = d.length;
55734
- var c = crc();
55735
- c.p(file);
55736
- files2.push(mrg(p, {
55737
- size: file.length,
55738
- crc: c.d(),
55739
- c: d,
55740
- f,
55741
- m,
55742
- u: s != fn.length || m && com.length != ms,
55743
- o,
55744
- compression
55745
- }));
55746
- o += 30 + s + exl + l;
55747
- tot += 76 + 2 * (s + exl) + (ms || 0) + l;
55748
- }
55749
- var out = new u8(tot + 22), oe = o, cdl = tot - o;
55750
- for (var i = 0; i < files2.length; ++i) {
55751
- var f = files2[i];
55752
- wzh(out, f.o, f, f.f, f.u, f.c.length);
55753
- var badd = 30 + f.f.length + exfl(f.extra);
55754
- out.set(f.c, f.o + badd);
55755
- wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);
55756
- }
55757
- wzf(out, o, files2.length, cdl, oe);
55758
- return out;
55759
- }
55760
55705
  function unzipSync(data, opts) {
55761
55706
  var files2 = {};
55762
55707
  var e = data.length - 22;
@@ -55872,9 +55817,27 @@ function renameProject(id, name) {
55872
55817
  const meta = readMeta(safeProjectId(id));
55873
55818
  if (!meta) throw new ProjectError(`unknown project: ${id}`);
55874
55819
  if (typeof name !== "string" || !name.trim()) throw new ProjectError("project name required");
55875
- const next = { ...meta, name: name.trim(), updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
55876
- writeMeta(next);
55877
- return next;
55820
+ const nextName = name.trim();
55821
+ if (nextName === meta.name) return meta;
55822
+ let newId = `${slugify(nextName)}-${(0, import_node_crypto6.randomBytes)(3).toString("hex")}`;
55823
+ while ((0, import_node_fs20.existsSync)(projectDir(newId)) || (0, import_node_fs20.existsSync)((0, import_node_path18.join)(ARCHIVE, newId))) newId = `${slugify(nextName)}-${(0, import_node_crypto6.randomBytes)(3).toString("hex")}`;
55824
+ const from = projectDir(id), to = projectDir(newId);
55825
+ try {
55826
+ (0, import_node_fs20.renameSync)(from, to);
55827
+ } catch {
55828
+ throw new ProjectError("couldn\u2019t rename the project folder \u2014 it may be open or in use. Close the project and try again.");
55829
+ }
55830
+ try {
55831
+ const next = { ...meta, id: newId, name: nextName, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
55832
+ writeMeta(next);
55833
+ return next;
55834
+ } catch (e) {
55835
+ try {
55836
+ (0, import_node_fs20.renameSync)(to, from);
55837
+ } catch {
55838
+ }
55839
+ throw e;
55840
+ }
55878
55841
  }
55879
55842
  function markApproved(id) {
55880
55843
  const meta = readMeta(safeProjectId(id));
@@ -55942,21 +55905,50 @@ function exportFilename(name) {
55942
55905
  const clean = name.replace(/[^a-z0-9\-_. ]+/gi, " ").replace(/\s+/g, " ").trim().slice(0, 60);
55943
55906
  return clean || "project";
55944
55907
  }
55945
- function exportProjectZip(id) {
55908
+ var ZIP_SLICE = 1024 * 1024;
55909
+ var yieldToLoop = () => new Promise((r) => setImmediate(r));
55910
+ async function zipYielding(files2, level) {
55911
+ const parts = [];
55912
+ let failed = null;
55913
+ const zipper = new Zip((err2, chunk) => {
55914
+ if (err2) failed = err2;
55915
+ else parts.push(chunk);
55916
+ });
55917
+ for (const [name, bytes] of Object.entries(files2)) {
55918
+ if (failed) break;
55919
+ const file = new ZipDeflate(name, { level });
55920
+ zipper.add(file);
55921
+ if (bytes.length === 0) {
55922
+ file.push(new Uint8Array(0), true);
55923
+ continue;
55924
+ }
55925
+ for (let off = 0; off < bytes.length && !failed; off += ZIP_SLICE) {
55926
+ const end = Math.min(off + ZIP_SLICE, bytes.length);
55927
+ file.push(bytes.subarray(off, end), end >= bytes.length);
55928
+ await yieldToLoop();
55929
+ }
55930
+ }
55931
+ zipper.end();
55932
+ if (failed) throw failed;
55933
+ return Buffer.concat(parts);
55934
+ }
55935
+ async function exportProjectZip(id) {
55946
55936
  const meta = readMeta(safeProjectId(id));
55947
55937
  if (!meta) throw new ProjectError(`unknown project: ${id}`);
55948
55938
  const root = projectDir(id);
55949
55939
  const files2 = {};
55950
- const walk2 = (abs, rel) => {
55951
- for (const e of (0, import_node_fs20.readdirSync)(abs, { withFileTypes: true })) {
55940
+ const walk2 = async (abs, rel) => {
55941
+ const entries = await (0, import_promises.readdir)(abs, { withFileTypes: true });
55942
+ await Promise.all(entries.map(async (e) => {
55952
55943
  const childAbs = (0, import_node_path18.join)(abs, e.name);
55953
55944
  const childRel = rel ? `${rel}/${e.name}` : e.name;
55954
- if (e.isDirectory()) walk2(childAbs, childRel);
55955
- else if (e.isFile()) files2[`${id}/${childRel}`] = (0, import_node_fs20.readFileSync)(childAbs);
55956
- }
55945
+ if (e.isDirectory()) await walk2(childAbs, childRel);
55946
+ else if (e.isFile()) files2[`${id}/${childRel}`] = await (0, import_promises.readFile)(childAbs);
55947
+ }));
55957
55948
  };
55958
- walk2(root, "");
55959
- return { data: zipSync(files2, { level: 6 }), filename: `${exportFilename(meta.name)}.zip` };
55949
+ await walk2(root, "");
55950
+ const data = await zipYielding(files2, 6);
55951
+ return { data, filename: `${exportFilename(meta.name)}.zip` };
55960
55952
  }
55961
55953
  var IMPORT_MAX_FILES = 1e4;
55962
55954
  var IMPORT_MAX_UNCOMPRESSED = 2 * 1024 * 1024 * 1024;
@@ -55988,7 +55980,10 @@ function importProjectZip(data) {
55988
55980
  } catch {
55989
55981
  throw new ProjectError("archive project.json is unreadable");
55990
55982
  }
55991
- const name = typeof srcMeta.name === "string" && srcMeta.name.trim() ? srcMeta.name.trim() : "Imported project";
55983
+ const rawName = typeof srcMeta.name === "string" && srcMeta.name.trim() ? srcMeta.name.trim() : "Imported project";
55984
+ const takenNames = new Set(listProjects().map((p) => p.name));
55985
+ let name = rawName;
55986
+ for (let n = 1; takenNames.has(name); n++) name = n === 1 ? `${rawName} (imported)` : `${rawName} (imported ${n})`;
55992
55987
  const app = typeof srcMeta.app === "string" ? srcMeta.app.trim() : "";
55993
55988
  if (!/^[a-z0-9][a-z0-9._-]*$/i.test(app)) throw new ProjectError(`archive names an invalid app id: ${app || "(empty)"}`);
55994
55989
  let id = `${slugify(name)}-${(0, import_node_crypto6.randomBytes)(3).toString("hex")}`;
@@ -61869,7 +61864,7 @@ function generateXlsxFileContents(arg1, arg2, arg3) {
61869
61864
  sheetsOptions = setConditionalFormattingRulesGlobalIndexes(sheetsOptions);
61870
61865
  var features = getFeatures(options.features);
61871
61866
  var files2 = {};
61872
- var readFile = function readFile2(path) {
61867
+ var readFile2 = function readFile3(path) {
61873
61868
  return files2[path];
61874
61869
  };
61875
61870
  var writeFiles = function writeFiles2(filesToWrite) {
@@ -61936,7 +61931,7 @@ function generateXlsxFileContents(arg1, arg2, arg3) {
61936
61931
  sheetIndex++;
61937
61932
  }
61938
61933
  writeFiles(getWrittenFiles(features, sheetsOptions, {
61939
- read: readFile
61934
+ read: readFile2
61940
61935
  }));
61941
61936
  files2["xl/styles.xml"] = generateStylesXml(getCellStyles(), sheetsOptions, features);
61942
61937
  files2["xl/sharedStrings.xml"] = generateSharedStringsXml(getSharedStrings());
@@ -63955,7 +63950,7 @@ var import_node_child_process6 = require("node:child_process");
63955
63950
  var import_node_crypto11 = require("node:crypto");
63956
63951
  var import_node_fs36 = require("node:fs");
63957
63952
  var import_node_stream3 = require("node:stream");
63958
- var import_promises = require("node:stream/promises");
63953
+ var import_promises2 = require("node:stream/promises");
63959
63954
  var import_node_path32 = require("node:path");
63960
63955
 
63961
63956
  // post-update-marker.mjs
@@ -64112,7 +64107,7 @@ async function checkForUpdate() {
64112
64107
  }
64113
64108
  async function sha1OfFile(path) {
64114
64109
  const hash = (0, import_node_crypto11.createHash)("sha1");
64115
- await (0, import_promises.pipeline)((0, import_node_fs36.createReadStream)(path), hash);
64110
+ await (0, import_promises2.pipeline)((0, import_node_fs36.createReadStream)(path), hash);
64116
64111
  return hash.digest("hex").toUpperCase();
64117
64112
  }
64118
64113
  async function downloadPackage(asset) {
@@ -64127,7 +64122,7 @@ async function downloadPackage(asset) {
64127
64122
  signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
64128
64123
  });
64129
64124
  if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status} for ${asset.FileName}`);
64130
- await (0, import_promises.pipeline)(import_node_stream3.Readable.fromWeb(res.body), (0, import_node_fs36.createWriteStream)(dest));
64125
+ await (0, import_promises2.pipeline)(import_node_stream3.Readable.fromWeb(res.body), (0, import_node_fs36.createWriteStream)(dest));
64131
64126
  const got = await sha1OfFile(dest);
64132
64127
  if (got !== want) throw new Error(`SHA1 mismatch for ${asset.FileName}: feed=${want} got=${got}`);
64133
64128
  return dest;
@@ -65026,12 +65021,12 @@ var import_node_fs39 = require("node:fs");
65026
65021
 
65027
65022
  // node_modules/chokidar/esm/index.js
65028
65023
  var import_fs2 = require("fs");
65029
- var import_promises4 = require("fs/promises");
65024
+ var import_promises5 = require("fs/promises");
65030
65025
  var import_events = require("events");
65031
65026
  var sysPath2 = __toESM(require("path"), 1);
65032
65027
 
65033
65028
  // node_modules/readdirp/esm/index.js
65034
- var import_promises2 = require("node:fs/promises");
65029
+ var import_promises3 = require("node:fs/promises");
65035
65030
  var import_node_stream4 = require("node:stream");
65036
65031
  var import_node_path35 = require("node:path");
65037
65032
  var EntryTypes = {
@@ -65098,7 +65093,7 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
65098
65093
  const { root, type } = opts;
65099
65094
  this._fileFilter = normalizeFilter(opts.fileFilter);
65100
65095
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
65101
- const statMethod = opts.lstat ? import_promises2.lstat : import_promises2.stat;
65096
+ const statMethod = opts.lstat ? import_promises3.lstat : import_promises3.stat;
65102
65097
  if (wantBigintFsStats) {
65103
65098
  this._stat = (path) => statMethod(path, { bigint: true });
65104
65099
  } else {
@@ -65169,7 +65164,7 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
65169
65164
  async _exploreDir(path, depth) {
65170
65165
  let files2;
65171
65166
  try {
65172
- files2 = await (0, import_promises2.readdir)(path, this._rdOptions);
65167
+ files2 = await (0, import_promises3.readdir)(path, this._rdOptions);
65173
65168
  } catch (error) {
65174
65169
  this._onError(error);
65175
65170
  }
@@ -65207,8 +65202,8 @@ var ReaddirpStream = class extends import_node_stream4.Readable {
65207
65202
  if (stats && stats.isSymbolicLink()) {
65208
65203
  const full = entry2.fullPath;
65209
65204
  try {
65210
- const entryRealPath = await (0, import_promises2.realpath)(full);
65211
- const entryRealPathStats = await (0, import_promises2.lstat)(entryRealPath);
65205
+ const entryRealPath = await (0, import_promises3.realpath)(full);
65206
+ const entryRealPathStats = await (0, import_promises3.lstat)(entryRealPath);
65212
65207
  if (entryRealPathStats.isFile()) {
65213
65208
  return "file";
65214
65209
  }
@@ -65251,7 +65246,7 @@ function readdirp(root, options = {}) {
65251
65246
 
65252
65247
  // node_modules/chokidar/esm/handler.js
65253
65248
  var import_fs = require("fs");
65254
- var import_promises3 = require("fs/promises");
65249
+ var import_promises4 = require("fs/promises");
65255
65250
  var sysPath = __toESM(require("path"), 1);
65256
65251
  var import_os = require("os");
65257
65252
  var STR_DATA = "data";
@@ -65278,7 +65273,7 @@ var EVENTS = {
65278
65273
  };
65279
65274
  var EV = EVENTS;
65280
65275
  var THROTTLE_MODE_WATCH = "watch";
65281
- var statMethods = { lstat: import_promises3.lstat, stat: import_promises3.stat };
65276
+ var statMethods = { lstat: import_promises4.lstat, stat: import_promises4.stat };
65282
65277
  var KEY_LISTENERS = "listeners";
65283
65278
  var KEY_ERR = "errHandlers";
65284
65279
  var KEY_RAW = "rawEmitters";
@@ -65635,7 +65630,7 @@ var setFsWatchListener = (path, fullPath, options, handlers) => {
65635
65630
  cont.watcherUnusable = true;
65636
65631
  if (isWindows && error.code === "EPERM") {
65637
65632
  try {
65638
- const fd2 = await (0, import_promises3.open)(path, "r");
65633
+ const fd2 = await (0, import_promises4.open)(path, "r");
65639
65634
  await fd2.close();
65640
65635
  broadcastErr(error);
65641
65636
  } catch (err2) {
@@ -65764,7 +65759,7 @@ var NodeFsHandler = class {
65764
65759
  return;
65765
65760
  if (!newStats || newStats.mtimeMs === 0) {
65766
65761
  try {
65767
- const newStats2 = await (0, import_promises3.stat)(file);
65762
+ const newStats2 = await (0, import_promises4.stat)(file);
65768
65763
  if (this.fsw.closed)
65769
65764
  return;
65770
65765
  const at = newStats2.atimeMs;
@@ -65819,7 +65814,7 @@ var NodeFsHandler = class {
65819
65814
  this.fsw._incrReadyCount();
65820
65815
  let linkPath;
65821
65816
  try {
65822
- linkPath = await (0, import_promises3.realpath)(path);
65817
+ linkPath = await (0, import_promises4.realpath)(path);
65823
65818
  } catch (e) {
65824
65819
  this.fsw._emitReady();
65825
65820
  return true;
@@ -65967,7 +65962,7 @@ var NodeFsHandler = class {
65967
65962
  let closer;
65968
65963
  if (stats.isDirectory()) {
65969
65964
  const absPath = sysPath.resolve(path);
65970
- const targetPath = follow ? await (0, import_promises3.realpath)(path) : path;
65965
+ const targetPath = follow ? await (0, import_promises4.realpath)(path) : path;
65971
65966
  if (this.fsw.closed)
65972
65967
  return;
65973
65968
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -65977,7 +65972,7 @@ var NodeFsHandler = class {
65977
65972
  this.fsw._symlinkPaths.set(absPath, targetPath);
65978
65973
  }
65979
65974
  } else if (stats.isSymbolicLink()) {
65980
- const targetPath = follow ? await (0, import_promises3.realpath)(path) : path;
65975
+ const targetPath = follow ? await (0, import_promises4.realpath)(path) : path;
65981
65976
  if (this.fsw.closed)
65982
65977
  return;
65983
65978
  const parent = sysPath.dirname(wh.watchPath);
@@ -66138,7 +66133,7 @@ var DirEntry = class {
66138
66133
  return;
66139
66134
  const dir = this.path;
66140
66135
  try {
66141
- await (0, import_promises4.readdir)(dir);
66136
+ await (0, import_promises5.readdir)(dir);
66142
66137
  } catch (err2) {
66143
66138
  if (this._removeWatcher) {
66144
66139
  this._removeWatcher(sysPath2.dirname(dir), sysPath2.basename(dir));
@@ -66463,7 +66458,7 @@ var FSWatcher = class extends import_events.EventEmitter {
66463
66458
  const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path) : path;
66464
66459
  let stats2;
66465
66460
  try {
66466
- stats2 = await (0, import_promises4.stat)(fullPath);
66461
+ stats2 = await (0, import_promises5.stat)(fullPath);
66467
66462
  } catch (err2) {
66468
66463
  }
66469
66464
  if (!stats2 || this.closed)
@@ -67362,7 +67357,7 @@ async function startServer() {
67362
67357
  });
67363
67358
  app.get("/api/projects/:id/export.zip", async (req, reply) => {
67364
67359
  try {
67365
- const { data, filename } = exportProjectZip(req.params.id);
67360
+ const { data, filename } = await exportProjectZip(req.params.id);
67366
67361
  return reply.header("content-type", "application/zip").header("content-disposition", `attachment; filename="${filename.replace(/["\r\n]/g, "")}"`).send(Buffer.from(data));
67367
67362
  } catch (e) {
67368
67363
  if (e instanceof ProjectError) return reply.status(404).send({ ok: false, error: e.message });
@@ -2496,9 +2496,9 @@
2496
2496
  el.addEventListener('animationend', () => el.classList.remove('is-new'), { once: true });
2497
2497
  }
2498
2498
 
2499
- // Shared rename/duplicate/archive — used by both the kebab menu (one project, from the
2500
- // landing grid) and the header project-picker's inline row actions below (any project,
2501
- // from anywhere). Never switches projects itself — the caller decides navigation.
2499
+ // rename/duplicate/archive on ONE project — driven by the landing-grid card ⋯ menu (the header
2500
+ // project-picker is now a pure switcher with no inline actions). Never switches projects itself
2501
+ // except where a rename of the OPEN project must re-src its iframes — the caller decides navigation.
2502
2502
  // Each branch updates the local `projects` array from the endpoint's result (unshift a duplicate,
2503
2503
  // move a rename to the front, filter out an archive — the unshift mirrors createSeeded/
2504
2504
  // createFromDrawing) and repaints the grid IMMEDIATELY, so the change is on screen WITH the toast
@@ -2515,16 +2515,20 @@
2515
2515
  if (action === 'rename') {
2516
2516
  const name = await promptName('Rename project', 'New name', proj ? proj.name : '');
2517
2517
  if (!name) return;
2518
+ const wasCurrent = !!(current && current.id === id);
2518
2519
  const { project } = await api(`/api/projects/${encodeURIComponent(id)}`, { method: 'PATCH', body: JSON.stringify({ name }) });
2519
- if (current && current.id === id) { current = project; $projName.textContent = project.name; $crumbName.textContent = project.name; }
2520
- // Rename bumps updatedAt server-side and the grid is newest-activity-first, so the reconcile
2521
- // will move this card to the front regardless. Do that move now (not an in-place swap) so it
2522
- // happens once, with the flash, rather than as a jump a second later when loadProjects() lands.
2520
+ // Rename now also changes the on-disk id (the folder tracks the display name), so update the grid
2521
+ // BY THE OLD id and re-front the card — once, with the flash, rather than as a jump a second later
2522
+ // when loadProjects() reconciles. The unshift must land before any openProject(newId) below so it
2523
+ // can find the project in `projects`.
2523
2524
  const i = projects.findIndex((p) => p.id === id);
2524
2525
  if (i >= 0) projects.splice(i, 1);
2525
2526
  projects.unshift(project);
2526
2527
  renderLanding();
2527
2528
  flashCard(project.id, { scroll: true });
2529
+ // If the renamed project was the OPEN one, its editor iframes still carry ?project=<old id> —
2530
+ // re-open so they re-src to the new id (a stale id 404s the next contract read/write/autosave).
2531
+ if (wasCurrent) await openProject(project.id);
2528
2532
  showToast(`Renamed to "${project.name}"`, 'ok');
2529
2533
  } else if (action === 'duplicate') {
2530
2534
  const { project } = await api(`/api/projects/${encodeURIComponent(id)}/duplicate`, { method: 'POST', body: '{}' });
@@ -2649,13 +2653,15 @@
2649
2653
  const pid = escapeAttr(p.id);
2650
2654
  const displayApp = appDisplayName(p.app);
2651
2655
  const meta = `${escapeHtml(displayApp)} · ${escapeHtml(relAgo(p.updatedAt))}`;
2652
- return `<div class="wf-option" role="option" id="ws-proj-opt-${pid}" data-id="${pid}" data-search="${escapeAttr((p.name + ' ' + displayApp + ' ' + p.app).toLowerCase())}" tabindex="-1" aria-selected="${current && current.id === p.id ? 'true' : 'false'}">`
2653
- + `<span class="wf-option-name">${escapeHtml(p.name)}</span><span class="wf-option-meta">${meta}</span>`
2654
- + `<span class="wf-option-actions">`
2655
- + `<button type="button" class="wf-act act-edit" data-act="rename" data-id="${pid}" tabindex="-1" data-tip="Rename" aria-label="Rename ${escapeAttr(p.name)}">✎</button>`
2656
- + `<button type="button" class="wf-act act-dup" data-act="duplicate" data-id="${pid}" tabindex="-1" data-tip="Duplicate" aria-label="Duplicate ${escapeAttr(p.name)}">⧉</button>`
2657
- + `<button type="button" class="wf-act act-archive" data-act="archive" data-id="${pid}" tabindex="-1" data-tip="Archive — recoverable" aria-label="Archive ${escapeAttr(p.name)}">⏏</button>`
2658
- + `</span></div>`;
2656
+ // A PURE SWITCHER: no per-row Rename/Duplicate/Archive icons — project MANAGEMENT lives only on
2657
+ // the landing cards' ⋯ menu (a picker that only lets you switch has one predictable affordance
2658
+ // per row; a lone kept icon would have no rule a user could guess). Clicking a row switches.
2659
+ // The current project carries `.selected` (not just aria-selected) so the accent "you are here"
2660
+ // marker (.wf-option.selected in app.css) actually shows — mirrors the workflow picker (aware.js).
2661
+ // It matters more now the action icons are gone: without it the open row is visually unmarked.
2662
+ const here = current && current.id === p.id;
2663
+ return `<div class="wf-option${here ? ' selected' : ''}" role="option" id="ws-proj-opt-${pid}" data-id="${pid}" data-search="${escapeAttr((p.name + ' ' + displayApp + ' ' + p.app).toLowerCase())}" tabindex="-1" aria-selected="${here ? 'true' : 'false'}">`
2664
+ + `<span class="wf-option-name">${escapeHtml(p.name)}</span><span class="wf-option-meta">${meta}</span></div>`;
2659
2665
  }).join('');
2660
2666
  html += `<div class="wf-empty-search" hidden>No projects match '<span class="wf-empty-term"></span>'</div>`;
2661
2667
  $projList.innerHTML = html;
@@ -2737,8 +2743,8 @@
2737
2743
  }
2738
2744
  if ($projList) {
2739
2745
  $projList.addEventListener('click', (e) => {
2740
- const act = e.target.closest('[data-act]');
2741
- if (act) { closeProjCombo(false); doProjectAction(act.dataset.act, act.dataset.id); return; }
2746
+ // Pure switcher: a row click switches projects. Management (rename/duplicate/archive) is on the
2747
+ // landing cards only, so there are no inline action icons to hit-test around here anymore.
2742
2748
  const o = e.target.closest('.wf-option');
2743
2749
  if (o) selectProjById(o.dataset.id);
2744
2750
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.101.0",
3
+ "version": "0.101.1",
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": {