clavarium 0.2.234-next.1 → 0.2.236-next.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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.234-next.1",
3
+ "version": "0.2.236-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.234-next.1",
9
+ "version": "0.2.236-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.234-next.1",
3
+ "version": "0.2.236-next.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
package/web/app.js CHANGED
@@ -8229,17 +8229,28 @@
8229
8229
  /* A file read from the machine's disk says so, whatever else is said. */
8230
8230
  const origin = from ? 'Read from the disk of the machine: this file is not kept here, and goes with the machine.' : '';
8231
8231
  const note = (text) => { const all = [text, text === 'Loading...' ? '' : origin].filter(Boolean).join(' '); $('preview-note').textContent = all; $('preview-note').hidden = !all; };
8232
+ /* NOTHING TO SHOW (02-11): not an empty frame, but a file, why, and a Download button that is seen. */
8233
+ const cannot = (why) => {
8234
+ const box = el('div', 'preview-cannot');
8235
+ const icon = el('div', 'preview-cannot-icon'); icon.setAttribute('aria-hidden', 'true');
8236
+ icon.innerHTML = '<svg class="ic" viewBox="0 0 24 24"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/></svg>';
8237
+ const get = el('a', 'button primary preview-cannot-get'); get.href = address; get.setAttribute('download', name);
8238
+ get.innerHTML = '<svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v11"/><path d="m7 11 5 5 5-5"/><path d="M5 20h14"/></svg>';
8239
+ get.append(document.createTextNode(' Download'));
8240
+ box.append(icon, el('b', 'preview-cannot-name', name), el('p', 'hint', why), get);
8241
+ $('preview-body').replaceChildren(box); note('');
8242
+ };
8232
8243
  const kind = name.includes('.') ? name.split('.').pop().toLowerCase() : '';
8233
8244
  const known = PICTURES[kind] || kind === 'pdf' || TEXTS.includes(kind);
8234
- if (!known) { note('This kind of file is not shown here. Download it to open it.'); return; }
8235
- if (size > (TEXTS.includes(kind) ? TEXT_MAX : PREVIEW_MAX)) { note(`This file is too large to be shown here (${sizeOf(size)}). Download it to open it.`); return; }
8245
+ if (!known) { cannot(`${size ? `${sizeOf(size)} · ` : ''}This kind of file cannot be shown here.`); return; }
8246
+ if (size > (TEXTS.includes(kind) ? TEXT_MAX : PREVIEW_MAX)) { cannot(`${sizeOf(size)} · Too large to be shown here.`); return; }
8236
8247
  note('Loading...');
8237
8248
  let bytes;
8238
8249
  try {
8239
8250
  const r = await fetch(address);
8240
8251
  if (!r.ok) throw new Error((await r.json().catch(() => ({}))).error || 'The file could not be read.');
8241
8252
  bytes = await r.arrayBuffer();
8242
- } catch (error) { note(error.message); return; }
8253
+ } catch (error) { cannot(error.message); return; }
8243
8254
  if ($('viewer').hidden || $('preview-name').textContent !== name) return; /* closed meanwhile */
8244
8255
  const body = $('preview-body');
8245
8256
  if (PICTURES[kind]) {
@@ -8269,7 +8280,7 @@
8269
8280
  if ($('viewer').hidden) return;
8270
8281
  }
8271
8282
  note(doc.numPages > pages ? `The first ${pages} pages of ${doc.numPages}. Download the file to read the rest.` : `${doc.numPages} page${doc.numPages > 1 ? 's' : ''}.`);
8272
- } catch { body.replaceChildren(); note('This PDF could not be shown here. Download it to open it.'); }
8283
+ } catch { cannot('This PDF could not be shown here.'); }
8273
8284
  } else {
8274
8285
  const text = new TextDecoder('utf-8', { fatal: false }).decode(bytes);
8275
8286
  const source = () => { const pre = document.createElement('pre'); pre.className = 'source'; pre.textContent = text; return pre; };
package/web/index.html CHANGED
@@ -14,7 +14,7 @@
14
14
  <link rel="stylesheet" href="/vendor/diff2html.css">
15
15
  <div id="app" data-place="conversations">
16
16
  <aside id="list" hidden>
17
- <div class="top"><b id="list-title" title="Conversations">Clavarium</b><span class="top-acts"><button type="button" id="list-pin" class="icon-btn" aria-pressed="false" aria-label="Keep the list open" title="Keep the list open: it no longer folds when a conversation is opened"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg></button><button type="button" id="search-open" class="icon-btn" aria-label="Search conversations" title="Search (/ or Ctrl+K)" aria-expanded="false" aria-controls="search"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg></button><button type="button" id="new" class="primary">+ New</button></span></div>
17
+ <div class="top"><b id="list-title" title="Conversations">Clavarium</b><span class="top-acts"><button type="button" id="list-pin" class="icon-btn" aria-pressed="false" aria-label="Keep the list open" title="Keep the list open: it no longer folds when a conversation is opened"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg></button><button type="button" id="search-open" class="icon-btn" aria-label="Search conversations" title="Search (/ or Ctrl+K)" aria-expanded="false" aria-controls="search"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg></button><button type="button" id="new" class="icon-btn new-btn" aria-label="New conversation" title="New conversation"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14"/><path d="M5 12h14"/></svg></button></span></div>
18
18
  <!-- SEARCH, discreet: opened by the magnifier, "/" or Ctrl+K; filters as it is typed. -->
19
19
  <div id="search" role="search" hidden><input id="search-field" type="search" placeholder="Search" aria-label="Search conversations: name, folder, identifier, tool" autocomplete="off" spellcheck="false" maxlength="60" aria-controls="items"></div>
20
20
  <!-- Needs you and Recent: copies of rows of the list below, by when they were last used (app.js, paint). -->
package/web/style.css CHANGED
@@ -2110,3 +2110,15 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
2110
2110
  .as-live-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; max-width: 28rem; }
2111
2111
  .as-live-form > button { justify-self: start; margin-top: 4px; }
2112
2112
 
2113
+
2114
+ /* New conversation: a + like its neighbours, in the brass of an action (02-11: the words were loud). */
2115
+ #new.new-btn { color: var(--brass); }
2116
+ #new.new-btn:hover { border-color: var(--brass); }
2117
+
2118
+ /* A file that cannot be shown: its icon, its name, why, and Download, in the middle of the viewer. */
2119
+ .preview-cannot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 40vh; padding: 24px 16px; text-align: center; }
2120
+ .preview-cannot-icon .ic { width: 56px; height: 56px; stroke-width: 1.2; color: var(--ink2); }
2121
+ .preview-cannot-name { overflow-wrap: anywhere; max-width: 32rem; }
2122
+ .preview-cannot .hint { margin: 0; max-width: 32rem; }
2123
+ .preview-cannot-get { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; text-decoration: none; }
2124
+ .preview-cannot-get .ic { width: 18px; height: 18px; }