clavarium 0.2.235-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.235-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.235-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.235-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/style.css CHANGED
@@ -2114,3 +2114,11 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
2114
2114
  /* New conversation: a + like its neighbours, in the brass of an action (02-11: the words were loud). */
2115
2115
  #new.new-btn { color: var(--brass); }
2116
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; }