clavarium 0.2.319-next.1 → 0.2.320-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.319-next.1",
3
+ "version": "0.2.320-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.319-next.1",
9
+ "version": "0.2.320-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.319-next.1",
3
+ "version": "0.2.320-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.",
@@ -29,5 +29,13 @@ export const SETTINGS_WORDS_FR = {
29
29
  'set-device': '1 appareil', 'set-devices': '{n} appareils', 'set-no-device': 'Aucun appareil', 'set-chat': 'Chat',
30
30
  'set-wakeups-on': '{on} sur {n} actifs', 'set-asleep': 'Endormie', 'set-not-looked': 'Pas encore regardée',
31
31
  'set-running-well': 'En marche · rien d\'anormal', 'set-conv-advanced': 'Archiver · remettre à neuf · supprimer',
32
+ /* New asset, one box (05-11, step 3): one verb per gesture -- Créer, Attacher, Terminé. */
33
+ 'set-na-new': 'Nouvel asset', 'set-na-attach': 'Attacher', 'set-na-there': 'Déjà là', 'set-na-or-new': 'ou un nouveau',
34
+ 'set-na-step-kind': 'Type', 'set-na-step-set': 'Réglage', 'set-na-step-made': 'Créé', 'set-na-back': 'Retour',
35
+ 'set-na-will': 'Sera relié à {name}', 'set-na-level': 'Ce qu\'il pourra faire', 'set-na-read': 'Lecture', 'set-na-write': 'Écriture',
36
+ 'set-na-made': '{name} créé', 'set-na-made-to': '{name} créé et relié à {to}', 'set-na-another': 'En créer un autre', 'set-na-done': 'Terminé',
37
+ 'set-na-create': 'Créer', 'set-na-new-key': '+ Nouvelle clé…',
38
+ 'set-na-k-folder': 'Dossier', 'set-na-k-git': 'Dépôt git', 'set-na-k-mailbox': 'Boîte mail', 'set-na-k-agenda': 'Agenda',
39
+ 'set-na-k-contacts': 'Contacts', 'set-na-k-secret': 'Secret', 'set-na-k-list': 'Classeur',
32
40
  };
33
41
  export const settingsWords = (lang) => (String(lang ?? '').toLowerCase().split('-')[0] === 'fr' ? { ...SETTINGS_WORDS_FR } : {});
package/web/app.js CHANGED
@@ -2309,7 +2309,6 @@
2309
2309
  paintConvStates(here);
2310
2310
  /* What can still be attached, for the picker. */
2311
2311
  const picker = $('attach-rows'); picker.replaceChildren();
2312
- $('attach-title').textContent = `Attach to "${current}"`;
2313
2312
  const offer = (name, kind, buttons) => {
2314
2313
  const row = document.createElement('div'); row.className = 'folder'; row.dataset.name = name;
2315
2314
  const label = document.createElement('b'); label.textContent = name;
@@ -3661,13 +3660,53 @@
3661
3660
  await refresh();
3662
3661
  await paintPanel();
3663
3662
  $('attach-picker').hidden = !picking;
3663
+ if (picking) openAttach();
3664
3664
  /* The folders button shows the folders: their chapter opened, in its tab. */
3665
3665
  openChapter('access', { show: !picking });
3666
3666
  if (picking) $('attach-picker').scrollIntoView({ block: 'nearest' });
3667
3667
  }
3668
3668
  $('folders').addEventListener('click', () => { void openAccess(false); });
3669
- $('attach-open').addEventListener('click', () => { openChapter('access'); $('attach-picker').hidden = false; $('attach-picker').scrollIntoView({ block: 'nearest' }); });
3670
- $('attach-close').addEventListener('click', () => { $('attach-picker').hidden = true; });
3669
+ /* ATTACH: ONE BUTTON (05-11). What is there already, to tick, or a new one -- the New asset box, with this
3670
+ conversation as its context: what is made there is attached to it at the end. */
3671
+ let attachNew = { kind: '', level: 'write' };
3672
+ function openAttach() {
3673
+ attachNew = { kind: '', level: 'write' };
3674
+ if (justMade?.to) justMade = null;
3675
+ $('attach-error').hidden = true;
3676
+ paintAttach();
3677
+ }
3678
+ function closeAttach() {
3679
+ $('attach-picker').hidden = true; $('attach-close').hidden = false;
3680
+ attachNew.kind = ''; if (justMade?.to) justMade = null;
3681
+ for (const f of $('attach-box').querySelectorAll('.as-form')) $('assets-forms').append(f);
3682
+ }
3683
+ function paintAttach() {
3684
+ const box = $('attach-box');
3685
+ for (const f of box.querySelectorAll('.as-form')) $('assets-forms').append(f);
3686
+ $('attach-park').append($('attach-there'));
3687
+ const who = shownName(conversations.find((c) => c.name === current)) || current;
3688
+ const made = justMade?.to === current ? justMade : null;
3689
+ const kind = made ? '' : attachNew.kind;
3690
+ /* At its ending, one Done: the box's own. */
3691
+ $('attach-close').hidden = Boolean(made);
3692
+ /* A secret is used or not: no level to choose. */
3693
+ const level = kind && kind !== 'secret' ? { options: [{ value: 'read', label: uiSaid('set-na-read', 'Read') }, { value: 'write', label: uiSaid('set-na-write', 'Write') }], value: attachNew.level, label: uiSaid('set-na-level', 'What it may do'), onChange: (v) => { attachNew.level = v; } } : null;
3694
+ box.replaceChildren(newAssetBox({
3695
+ kind, existing: $('attach-there'), title: '',
3696
+ context: made ? null : { line: uiSaid('set-na-will', 'Will be attached to {name}', { name: who }), level },
3697
+ made: made ? { said: uiSaid('set-na-made-to', '{name} created and attached to {to}', { name: made.name, to: who }), note: made.note } : null,
3698
+ onKind: (k) => {
3699
+ attachNew.kind = k; justMade = null; $('attach-error').hidden = true; paintAttach(); focusFirst(box);
3700
+ /* Its keys, read here too: Assets may not have been opened yet. */
3701
+ if (k === 'git') void getJson('/git-keys', []).then((keys) => paintKeys(keys));
3702
+ },
3703
+ onBack: () => { attachNew.kind = ''; $('attach-error').hidden = true; paintAttach(); },
3704
+ onAnother: () => { attachNew.kind = made.kind; justMade = null; paintAttach(); focusFirst(box); },
3705
+ onDone: () => { closeAttach(); },
3706
+ }));
3707
+ }
3708
+ $('attach-open').addEventListener('click', () => { openChapter('access'); $('attach-picker').hidden = false; openAttach(); $('attach-picker').scrollIntoView({ block: 'nearest' }); });
3709
+ $('attach-close').addEventListener('click', () => { closeAttach(); });
3671
3710
  $('attach-manage').addEventListener('click', () => { void openAssets(); });
3672
3711
 
3673
3712
  /* ---------- ASSETS: one design, two pages (G and H) ----------
@@ -4555,7 +4594,7 @@
4555
4594
  const as = $('cassets-as');
4556
4595
  as.dataset.open = chosen ? 'detail' : 'list';
4557
4596
  paintAsList($('cassets-rows'), items, { chosen: chosen?.key, choose: (key) => pickRoomAsset(key), empty: 'Nothing is given to it yet.' });
4558
- const top = el('div', 'as-kind-head as-list-top'); top.append(el('h3', '', 'This conversation'), roundPlus('Attach an asset', () => { void openAccess(true); }));
4597
+ const top = el('div', 'as-kind-head as-list-top'); top.append(el('h3', '', 'This conversation'), roundPlus(uiSaid('set-na-attach', 'Attach'), () => { void openAccess(true); }));
4559
4598
  const pinnedRow = (entry, extra) => {
4560
4599
  const row = el('button', `as-row ts-entry${extra ? ` ${extra}` : ''}`); row.type = 'button'; row.dataset.asset = entry.key;
4561
4600
  if (chosen === entry) row.setAttribute('aria-current', 'true');
@@ -4930,6 +4969,55 @@
4930
4969
  if (!names.ok || pick.options.length) return;
4931
4970
  for (const [key, name] of Object.entries(names.data)) { const o = document.createElement('option'); o.value = key; o.textContent = name[binderLang()] ?? name.en; pick.append(o); }
4932
4971
  }
4972
+ /* NEW ASSET (05-11, step 3): ONE BOX (kit.js NewAsset) wherever an asset is made -- Assets (the "+" of a
4973
+ kind, the map's "+"), a conversation's Attach: the same kinds, the same forms (#assets-forms, moved in
4974
+ when asked for), one ending. The words, once each. */
4975
+ const newKinds = () => [['folder', uiSaid('set-na-k-folder', 'Folder')], ['git', uiSaid('set-na-k-git', 'Git repository')], ['mailbox', uiSaid('set-na-k-mailbox', 'Mailbox')],
4976
+ ['agenda', uiSaid('set-na-k-agenda', 'Calendar')], ['contacts', uiSaid('set-na-k-contacts', 'Contacts')], ['secret', uiSaid('set-na-k-secret', 'Secret')], ['list', uiSaid('set-na-k-list', LISTS_WORD.one)]]
4977
+ .map(([kind, label]) => ({ kind, label, icon: kindIcon(kind) }));
4978
+ function newAssetBox(opts) {
4979
+ return KIT.NewAsset({
4980
+ kinds: newKinds(), ...opts,
4981
+ words: { title: opts.title ?? uiSaid('set-na-new', 'New asset'), there: uiSaid('set-na-there', 'Already there'), orNew: uiSaid('set-na-or-new', 'or a new one'),
4982
+ steps: [uiSaid('set-na-step-kind', 'Kind'), uiSaid('set-na-step-set', 'Set up'), uiSaid('set-na-step-made', 'Created')],
4983
+ back: uiSaid('set-na-back', 'Back'), another: uiSaid('set-na-another', 'Create another'), done: uiSaid('set-na-done', 'Done') },
4984
+ form: (kind) => {
4985
+ const form = $(`${addForm(kind)}-box`); form.hidden = false;
4986
+ if (kind === 'git') { fillKeyChoice(); showVia(); }
4987
+ if (kind === 'list') void fillTemplates();
4988
+ return form;
4989
+ },
4990
+ });
4991
+ }
4992
+ /* The first field of the form shown in `holder`, focused. */
4993
+ const focusFirst = (holder) => { const f = holder.querySelector('.as-form input:not([type=radio])'); if (f) focusField(f); };
4994
+ /* What was just made: the box's ending ("✓ <name> created"), until Done. `to`: the conversation it was attached to. */
4995
+ let justMade = null;
4996
+ /* A form is in the conversation's Attach (its context), or in Assets. */
4997
+ const inAttach = (form) => $('attach-box').contains(form);
4998
+ const newAssetError = (form, message) => { const e = inAttach(form) ? $('attach-error') : $('assets-error'); e.textContent = message; e.hidden = false; };
4999
+ /* THE ONE ENDING. `give(conversation, level)` attaches it, when the box was opened from a conversation; in
5000
+ Assets it is opened, the ending above it. */
5001
+ async function assetMade(form, { key, name, give = null, note = '' }) {
5002
+ if (inAttach(form) && current) {
5003
+ const kind = attachNew.kind;
5004
+ if (give) await give(current, attachNew.level);
5005
+ justMade = { kind, key, name, note, to: current };
5006
+ attachNew.kind = '';
5007
+ await paintPanel();
5008
+ paintAttach();
5009
+ return;
5010
+ }
5011
+ justMade = { kind: assetsAdding, key, name, note };
5012
+ assetOpen = key; assetsAdding = '';
5013
+ }
5014
+ /* Another kind asked from inside a form (New mailbox's Google, Microsoft: the account's form). */
5015
+ async function newAssetKind(form, kind) {
5016
+ if (inAttach(form)) { attachNew.kind = kind; paintAttach(); return; }
5017
+ assetsAdding = kind; await paintAssets();
5018
+ }
5019
+ /* A Tether target given from Attach: Read watches, Write proposes (asks before each action). */
5020
+ const targetLevel = (level) => (level === 'write' ? 'propose' : 'watch');
4933
5021
  async function paintAssets() {
4934
5022
  if (place !== 'assets' || DEVICE) return;
4935
5023
  watchTether();
@@ -4965,6 +5053,7 @@
4965
5053
  }
4966
5054
  const shown = assetsQuery ? items.filter((i) => i.name.includes(assetsQuery.toLowerCase()) || i.name.toLowerCase().includes(assetsQuery.toLowerCase())) : items;
4967
5055
  const chosen = assetsAdding ? null : items.find((i) => i.key === assetOpen) ?? null;
5056
+ if (justMade && !justMade.to && justMade.key !== chosen?.key) justMade = null;
4968
5057
  /* A group can be the open thing too (its own detail: give it, rename it). */
4969
5058
  const chosenGroup = !assetsAdding && !chosen && assetOpen.startsWith('group:') ? assetGroups.find((g) => `group:${g.id}` === assetOpen) ?? null : null;
4970
5059
  /* Every call waiting for the owner, across all the connexions, gathered in one place
@@ -4995,35 +5084,14 @@
4995
5084
  for (const form of detail.querySelectorAll('.as-form, #gitview-remote-box')) $('assets-forms').append(form);
4996
5085
  detail.replaceChildren();
4997
5086
  const back = () => { assetOpen = ''; assetsAdding = ''; remember(); void paintAssets(); };
4998
- if (assetsAdding === 'choose' || (assetsAdding && assetsFromMap)) {
4999
- /* From the map's "+" of Assets: which kind, then its form; "<" goes back to the map. */
5000
- const out = el('button', 'as-link', '‹ Access'); out.type = 'button'; out.addEventListener('click', () => { if (!nav.close('compose')) back(); });
5001
- detail.append(out);
5002
- if (assetsAdding === 'choose') {
5003
- detail.append(el('h3', '', 'New asset'));
5004
- const kinds = el('div', 'as-kinds');
5005
- for (const [kind, word] of [['git', 'Git repository'], ['folder', 'Folder'], ['mailbox', 'Mailbox'], ['agenda', 'Calendar'], ['contacts', 'Address book'], ['secret', 'Secret'], ['list', LISTS_WORD.one]]) {
5006
- const b = el('button', '', word); b.type = 'button'; b.dataset.kind = kind;
5007
- b.addEventListener('click', () => { assetsAdding = kind; void paintAssets(); });
5008
- b.prepend(kindIcon(kind)); kinds.append(b);
5009
- }
5010
- detail.append(kinds);
5011
- return;
5012
- }
5013
- const form = $(`${addForm(assetsAdding)}-box`); form.hidden = false;
5014
- detail.append(form);
5015
- if (assetsAdding === 'git') { fillKeyChoice(); showVia(); }
5016
- if (assetsAdding === 'list') void fillTemplates();
5017
- focusField(form.querySelector('input:not([type=radio])'));
5018
- return;
5019
- }
5020
5087
  if (assetsAdding) {
5021
- const all2 = el('button', 'as-link as-back', '‹ Assets'); all2.type = 'button'; all2.addEventListener('click', () => { if (!nav.close('asset')) back(); });
5022
- const form = $(`${addForm(assetsAdding)}-box`); form.hidden = false;
5023
- detail.append(all2, form);
5024
- if (assetsAdding === 'git') { fillKeyChoice(); showVia(); }
5025
- if (assetsAdding === 'list') void fillTemplates();
5026
- focusField(form.querySelector('input:not([type=radio])'));
5088
+ /* The New asset box: from the map's "+" of Assets, which kind first ("<" goes back to the map);
5089
+ from the "+" of a kind, its form ("<" Assets). */
5090
+ const out = assetsFromMap || assetsAdding === 'choose' ? el('button', 'as-link', '‹ Access') : el('button', 'as-link as-back', '‹ Assets'); out.type = 'button';
5091
+ out.addEventListener('click', () => { if (!nav.close(assetsFromMap || assetsAdding === 'choose' ? 'compose' : 'asset')) back(); });
5092
+ const kind = assetsAdding === 'choose' ? '' : assetsAdding;
5093
+ detail.append(out, newAssetBox({ kind, onKind: (k) => { assetsAdding = k; void paintAssets(); } }));
5094
+ if (kind) focusFirst(detail);
5027
5095
  return;
5028
5096
  }
5029
5097
  if (chosenGroup) { groupDetail(detail, chosenGroup, items, back); return; }
@@ -5035,6 +5103,13 @@
5035
5103
  return;
5036
5104
  }
5037
5105
  if (!chosen) { if (items.length) detail.append(noAssetChosen()); return; }
5106
+ /* Just made here: the box's ending above it -- Create another, or Done. */
5107
+ if (justMade && !justMade.to && justMade.key === chosen.key) {
5108
+ const made = justMade;
5109
+ detail.append(newAssetBox({ kind: made.kind, made: { said: uiSaid('set-na-made', '{name} created', { name: made.name }), note: made.note },
5110
+ onAnother: () => { justMade = null; placeAssetStep(); assetsAdding = made.kind || 'choose'; void paintAssets(); },
5111
+ onDone: () => { justMade = null; void paintAssets(); } }));
5112
+ }
5038
5113
  detail.append(asTitle(chosen, back));
5039
5114
  detail.append(groupPicker(chosen, assetGroups));
5040
5115
  const ready = conversations.filter((c) => c.phase === 'ready');
@@ -5575,16 +5650,35 @@
5575
5650
  }
5576
5651
  fillKeyChoice();
5577
5652
  }
5578
- /* The key offered in "Add a repository": the one chosen stays chosen. */
5653
+ /* The key of "New repository": the kit's SecretPicker -- its keys, "+ New key…" made in place, and
5654
+ the new one chosen (its public half shown under it, to give the hosting service). */
5655
+ const gitKeyPick = KIT.SecretPicker({
5656
+ ids: { select: 'git-key', add: 'git-key-new', row: 'git-key-make', name: 'git-key-name', go: 'git-key-make-go' },
5657
+ none: 'No key yet: make one', addLabel: uiSaid('set-na-new-key', '+ New key…'), makeLabel: uiSaid('set-na-create', 'Create'), nameLabel: 'Name of the new key',
5658
+ nameAttrs: { maxlength: '32', pattern: '[a-z]([a-z0-9-]{0,30}[a-z0-9])?', placeholder: 'deploy-key', spellcheck: 'false', autocapitalize: 'off' },
5659
+ suggest: () => {
5660
+ const taken = new Set(gitKeys.map((k) => k.name));
5661
+ const wanted = $('git-name').value.trim();
5662
+ let suggestion = wanted && !taken.has(wanted) ? wanted : '';
5663
+ for (let n = 1; !suggestion; n += 1) if (!taken.has(`key-${n}`)) suggestion = `key-${n}`;
5664
+ return suggestion;
5665
+ },
5666
+ onMake: async (name) => {
5667
+ $('git-error').hidden = true;
5668
+ try {
5669
+ const made = await post(`${API}/git-keys`, { name });
5670
+ paintKeys(await fetch(`${API}/git-keys`).then((r) => r.json()));
5671
+ fillKeyChoice(made.name);
5672
+ return true;
5673
+ } catch (error) { $('git-error').textContent = error.message; $('git-error').hidden = false; return false; }
5674
+ },
5675
+ onChange: () => showChosenKey(),
5676
+ });
5677
+ $('git-key-pick').append(gitKeyPick);
5678
+ for (const [id, key] of [['git-key-new', 'set-na-new-key'], ['git-key-make-go', 'set-na-create']]) { const b = gitKeyPick.querySelector?.(`#${id}`); if (b) b.dataset.said = key; }
5679
+ /* The key offered in "New repository": the one chosen stays chosen. */
5579
5680
  function fillKeyChoice(chosen = $('git-key').value) {
5580
- const select = $('git-key'); select.replaceChildren();
5581
- if (gitKeys.length === 0) { const none = document.createElement('option'); none.value = ''; none.textContent = 'No key yet: make one'; select.append(none); }
5582
- for (const key of gitKeys) {
5583
- const o = document.createElement('option'); o.value = key.name;
5584
- o.textContent = key.usedBy.length ? `${key.name} (used by ${key.usedBy.join(', ')})` : key.name;
5585
- select.append(o);
5586
- }
5587
- if (gitKeys.some((k) => k.name === chosen)) select.value = chosen;
5681
+ gitKeyPick.set(gitKeys.map((key) => ({ value: key.name, label: key.usedBy.length ? `${key.name} (used by ${key.usedBy.join(', ')})` : key.name })), chosen);
5588
5682
  showChosenKey();
5589
5683
  }
5590
5684
  function showChosenKey() {
@@ -5605,25 +5699,6 @@
5605
5699
  const pick = looksSsh(from) ? 'ssh-key' : /^https:\/\//i.test(from) ? 'none' : '';
5606
5700
  if (pick) { $('git-new').querySelector(`input[name="git-via"][value="${pick}"]`).checked = true; showVia(); }
5607
5701
  });
5608
- $('git-key').addEventListener('change', showChosenKey);
5609
- $('git-key-new').addEventListener('click', () => {
5610
- const taken = new Set(gitKeys.map((k) => k.name));
5611
- const wanted = $('git-name').value.trim();
5612
- let suggestion = wanted && !taken.has(wanted) ? wanted : '';
5613
- for (let n = 1; !suggestion; n += 1) if (!taken.has(`key-${n}`)) suggestion = `key-${n}`;
5614
- $('git-key-name').value = suggestion;
5615
- $('git-key-make').hidden = false; focusField($('git-key-name'));
5616
- });
5617
- $('git-key-make-go').addEventListener('click', async () => {
5618
- $('git-error').hidden = true;
5619
- try {
5620
- const made = await post(`${API}/git-keys`, { name: $('git-key-name').value.trim() });
5621
- $('git-key-make').hidden = true;
5622
- gitKeys = await fetch(`${API}/git-keys`).then((r) => r.json());
5623
- fillKeyChoice(made.name);
5624
- await paintAssets();
5625
- } catch (error) { $('git-error').textContent = error.message; $('git-error').hidden = false; }
5626
- });
5627
5702
  $('git-key-copy').addEventListener('click', () => { void copyField($('git-key-public'), $('git-key-copy')); });
5628
5703
  /* Secrets: a name, and which conversations' tools are handed it. A value goes in and never comes back. */
5629
5704
  /* A VALUE OF SEVERAL LINES (a PEM or SSH key, a certificate): a box of its own, masked like the
@@ -5644,13 +5719,20 @@
5644
5719
  });
5645
5720
  $('secret-new').addEventListener('submit', async (event) => {
5646
5721
  event.preventDefault();
5647
- $('assets-error').hidden = true;
5722
+ $('assets-error').hidden = true; $('attach-error').hidden = true;
5648
5723
  const lines = !$('secret-lines').hidden;
5649
5724
  /* A key's last line ends with a line break: kept as it was pasted. */
5650
5725
  const value = lines ? $('secret-lines').value.replace(/\r\n?/g, '\n') : $('secret-value').value;
5651
5726
  const expires = $('secret-expires').value;
5652
- try { await post(`${API}/secrets`, { name: $('secret-name').value.trim(), value, ...(expires ? { expires } : {}) }); assetOpen = `secret:${$('secret-name').value.trim()}`; assetsAdding = ''; $('secret-name').value = ''; $('secret-expires').value = ''; secretLines(false, ''); }
5653
- catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
5727
+ const name = $('secret-name').value.trim();
5728
+ try {
5729
+ await post(`${API}/secrets`, { name, value, ...(expires ? { expires } : {}) });
5730
+ $('secret-name').value = ''; $('secret-expires').value = ''; secretLines(false, '');
5731
+ await assetMade($('secret-box'), { key: `secret:${name}`, name, give: async (to) => {
5732
+ await handTo(to, name, true, 'attach-error');
5733
+ $('secret-note').textContent = `${name} will be handed to the tool the next time it starts (leave the tool, then "Start it again").`;
5734
+ } });
5735
+ } catch (error) { newAssetError($('secret-box'), error.message); }
5654
5736
  await paintAssets();
5655
5737
  });
5656
5738
 
@@ -6051,7 +6133,6 @@
6051
6133
  $('access-for-clear').addEventListener('click', () => { accessFor = ''; void openAccessPage(accessTab, { push: false }); });
6052
6134
  for (const b of $('map-mode').querySelectorAll('[data-mode]')) b.addEventListener('click', () => { if (b.dataset.mode !== mapMode || accessTab !== 'map') void openAccessPage('map', { mode: b.dataset.mode }); });
6053
6135
  /* From a conversation's own sheet: Access, on that conversation alone. */
6054
- $('access-assets-here').addEventListener('click', () => { goTab('assets'); });
6055
6136
  $('access-devices-here').addEventListener('click', () => { void openAccessPage('map', { of: current }); });
6056
6137
 
6057
6138
  /* ---------- Settings: this device, and the platform ---------- */
@@ -7623,14 +7704,15 @@
7623
7704
  const made = await post(`${API}/resources`, { name: $('git-name').value.trim(), type: 'git', from, ...(from ? { via } : {}) });
7624
7705
  /* The secrets typed are not kept in the page a moment longer. */
7625
7706
  $('git-new').reset(); viaTouched = false; showVia(); fillKeyChoice(via.key);
7626
- /* A new repository opens on its card, where it is attached: the next thing to do. */
7627
- assetOpen = `git:${made.name}`;
7707
+ /* First contact with its host: said in the ending, kept there. */
7628
7708
  if (made.firstSeen) {
7629
7709
  $('git-said').textContent = `${made.name} was cloned. First contact with ${hostOf(made.from)}: its host key (${made.firstSeen.join(', ')}) was recorded. A different key later will be refused.`;
7630
7710
  $('git-said').hidden = false;
7631
- } else assetsAdding = '';
7711
+ }
7712
+ /* A new repository opens on its card, where it is attached: the next thing to do. */
7713
+ await assetMade($('git-box'), { key: `git:${made.name}`, name: made.name, note: made.firstSeen ? $('git-said').textContent : '', give: (to, level) => attachTo(to, made.name, level, 'attach-error') });
7632
7714
  } catch (error) { $('git-error').textContent = error.message; $('git-error').hidden = false; }
7633
- button.disabled = false; button.textContent = 'Add';
7715
+ button.disabled = false; button.textContent = 'Create';
7634
7716
  await paintAssets();
7635
7717
  });
7636
7718
  /* ---------- a repository: what would go out, then send it ---------- */
@@ -7996,6 +8078,11 @@
7996
8078
  same levels, through Tether -- with its sending server (SMTP) too, unless "No sending". The former
7997
8079
  read-only copy as files stays, ticked on purpose. */
7998
8080
  let mailboxLooked = '';
8081
+ /* An account connected: its targets (mail, calendar, contacts), the first opened, all given from Attach. */
8082
+ const targetsMade = (made, user) => {
8083
+ const targets = Array.isArray(made?.targets) ? made.targets : [];
8084
+ return { key: targets[0] ? `connexion:${targets[0].id}` : '', name: targets[0]?.title ?? user, give: (to, level) => Promise.all(targets.map((t) => grantTarget(t.id, to, targetLevel(level)))) };
8085
+ };
7999
8086
  $('mailbox-user').addEventListener('change', async () => {
8000
8087
  const user = $('mailbox-user').value.trim();
8001
8088
  if (!user.includes('@') || user === mailboxLooked) return;
@@ -8013,11 +8100,12 @@
8013
8100
  button.disabled = true; button.textContent = 'Trying it...';
8014
8101
  const host = $('mailbox-host').value.trim(); const port = $('mailbox-port').value.trim();
8015
8102
  try {
8016
- const made = await post(`${API}/accounts/classic`, { user: $('mailbox-user').value.trim(), password: $('mailbox-password').value, imap: port ? `${host}:${port}` : host, smtp: $('mailbox-smtp').value.trim(), kinds: ['mail'] });
8017
- if (made?.targets?.[0]?.id) assetOpen = `connexion:${made.targets[0].id}`;
8018
- assetsAdding = ''; $('mailbox-new').reset(); mailboxLooked = '';
8103
+ const user = $('mailbox-user').value.trim();
8104
+ const made = await post(`${API}/accounts/classic`, { user, password: $('mailbox-password').value, imap: port ? `${host}:${port}` : host, smtp: $('mailbox-smtp').value.trim(), kinds: ['mail'] });
8105
+ $('mailbox-new').reset(); mailboxLooked = '';
8106
+ await assetMade($('mailbox-box'), targetsMade(made, user));
8019
8107
  } catch (error) { $('mailbox-error').textContent = error.message; $('mailbox-error').hidden = false; }
8020
- button.disabled = false; button.textContent = 'Connect';
8108
+ button.disabled = false; button.textContent = 'Create';
8021
8109
  await paintAssets();
8022
8110
  });
8023
8111
  /* New mailbox: IMAP and SMTP, connected live (02-11). Gmail and Microsoft sign in instead (token kept on
@@ -8032,7 +8120,7 @@
8032
8120
  const provider = b.dataset.provider;
8033
8121
  if (provider === 'classic') return;
8034
8122
  const user = $('mailbox-user').value.trim();
8035
- assetsAdding = 'connexion'; await paintAssets();
8123
+ await newAssetKind($('mailbox-box'), 'connexion');
8036
8124
  setConnexionProvider(provider);
8037
8125
  if (user.includes('@')) $('connexion-email').value = user;
8038
8126
  });
@@ -8087,9 +8175,10 @@
8087
8175
  try {
8088
8176
  const made = await post(`${API}/accounts/classic`, { user: $('connexion-email').value.trim(), password: $('connexion-password').value, kinds,
8089
8177
  imap: $('connexion-imap').value.trim(), smtp: $('connexion-smtp').value.trim(), caldav: $('connexion-caldav').value.trim(), carddav: $('connexion-carddav').value.trim() });
8090
- if (made?.targets?.[0]) assetOpen = `connexion:${made.targets[0].id}`;
8091
- assetsAdding = ''; lookedUp = '';
8178
+ const user = $('connexion-email').value.trim();
8179
+ lookedUp = '';
8092
8180
  $('connexion-new').reset(); setConnexionProvider('google');
8181
+ await assetMade($('connexion-box'), targetsMade(made, user));
8093
8182
  } catch (error) { $('connexion-error').textContent = error.message; $('connexion-error').hidden = false; }
8094
8183
  $('connexion-password').value = '';
8095
8184
  btn.disabled = false; btn.textContent = was;
@@ -8125,9 +8214,9 @@
8125
8214
  $('connexion-error').hidden = false;
8126
8215
  $('connexion-code').value = ''; $('connexion-paste').hidden = true;
8127
8216
  } else {
8128
- if (made?.targets?.[0]) assetOpen = `connexion:${made.targets[0].id}`;
8129
- assetsAdding = '';
8217
+ const user = $('connexion-email').value.trim();
8130
8218
  $('connexion-new').reset(); setConnexionProvider('google');
8219
+ await assetMade($('connexion-box'), targetsMade(made, user));
8131
8220
  }
8132
8221
  } catch (error) { $('connexion-error').textContent = error.message; $('connexion-error').hidden = false; }
8133
8222
  btn.disabled = false; btn.textContent = was;
@@ -8137,17 +8226,26 @@
8137
8226
  getJson('/accounts', null).then((d) => { if (d?.supported) { accountSupported = { ...d.supported, classic: ['mail', 'calendar', 'contacts'] }; setConnexionProvider($('connexion-new').dataset.provider || 'google'); } });
8138
8227
  $('list-new').addEventListener('submit', async (event) => {
8139
8228
  event.preventDefault();
8140
- $('assets-error').hidden = true;
8229
+ $('assets-error').hidden = true; $('attach-error').hidden = true;
8141
8230
  const made = await binderCall('create-list', { template: $('listnew-template').value, title: $('listnew-title').value.trim(), lang: binderLang() });
8142
- if (made.ok) { $('listnew-title').value = ''; assetsAdding = ''; assetOpen = `list:${made.data.id}`; listOpen = assetOpen; remember(); }
8143
- else { $('assets-error').textContent = made.text; $('assets-error').hidden = false; }
8231
+ if (made.ok) {
8232
+ $('listnew-title').value = '';
8233
+ const key = `list:${made.data.id}`;
8234
+ const attaching = inAttach($('list-box'));
8235
+ await assetMade($('list-box'), { key, name: made.data.title ?? $('listnew-template').selectedOptions[0]?.textContent ?? '', give: (to, level) => grantList(made.data.id, to, level) });
8236
+ if (!attaching) { listOpen = key; remember(); }
8237
+ } else newAssetError($('list-box'), made.text);
8144
8238
  await paintAssets();
8145
8239
  });
8146
8240
  $('folder-new').addEventListener('submit', async (event) => {
8147
8241
  event.preventDefault();
8148
8242
  $('assets-error').hidden = true;
8149
- try { const made = await post(`${API}/resources`, { name: $('folder-name').value.trim() }); $('folder-name').value = ''; assetsAdding = ''; if (made?.name) assetOpen = `folder:${made.name}`; }
8150
- catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
8243
+ $('attach-error').hidden = true;
8244
+ try {
8245
+ const made = await post(`${API}/resources`, { name: $('folder-name').value.trim() }); $('folder-name').value = '';
8246
+ const name = made?.name ?? '';
8247
+ await assetMade($('folder-box'), { key: name ? `folder:${name}` : '', name, give: name ? (to, level) => attachTo(to, name, level, 'attach-error') : null });
8248
+ } catch (error) { newAssetError($('folder-box'), error.message); }
8151
8249
  await paintAssets();
8152
8250
  });
8153
8251
 
package/web/index.html CHANGED
@@ -227,20 +227,23 @@
227
227
  <details class="chapter" id="chapter-access" data-chapter="access">
228
228
  <summary><span class="chapter-title" data-said="set-ch-access">Access</span><span class="chapter-about">Folders, repositories, secrets, network.</span></summary>
229
229
  <div class="chapter-body">
230
- <div class="panel-top"><b>Folders, repositories, mailboxes</b><button type="button" id="attach-open" class="primary">+ Attach</button></div>
230
+ <div class="panel-top"><b>Folders, repositories, mailboxes</b><button type="button" id="attach-open" class="primary" data-said="set-na-attach">Attach</button></div>
231
231
  <p class="hint tip" hidden>In its machine under <code>/resources/</code>. Read-only cannot be lifted by the tool.</p>
232
232
  <div id="panel-rows"></div>
233
233
  <p id="panel-empty" class="hint" hidden>Nothing is attached to this conversation.</p>
234
- <div class="row to-access"><button type="button" id="access-assets-here">Attach an asset</button><span class="hint">Every asset, in Access.</span></div>
235
234
  <div class="panel-top"><b>Secrets handed to its tool</b></div>
236
235
  <div id="access-secrets"></div>
237
236
  <p id="access-secrets-empty" class="hint" hidden>No secret is handed to it.</p>
238
237
  <p id="secret-note" class="hint" role="status"></p>
238
+ <!-- ATTACH: the New asset box (kit.js NewAsset) with this conversation as its context: what is
239
+ there already (#attach-there, moved into it), or a new one, attached at the end. -->
239
240
  <div id="attach-picker" hidden>
240
- <div class="panel-top"><b id="attach-title">Attach</b><button type="button" id="attach-close">Done</button></div>
241
- <div id="attach-rows"></div>
242
- <p id="attach-empty" class="hint" hidden>Everything there is is attached already.</p>
243
- <button type="button" id="attach-manage">Manage all assets</button>
241
+ <div class="panel-top"><b id="attach-title" data-said="set-na-attach">Attach</b><button type="button" id="attach-close" data-said="set-na-done">Done</button></div>
242
+ <div id="attach-box"></div>
243
+ <p id="attach-error" class="error" role="alert" hidden></p>
244
+ <div id="attach-park" hidden><div id="attach-there"><div id="attach-rows"></div>
245
+ <p id="attach-empty" class="hint" hidden>Everything there is is attached already.</p></div></div>
246
+ <button type="button" id="attach-manage" class="as-link">Manage all assets</button>
244
247
  </div>
245
248
  <div id="signin-setup" hidden>
246
249
  <div class="panel-top"><b>Sign-in mailbox</b></div>
@@ -760,8 +763,8 @@
760
763
  </fieldset>
761
764
  <div id="git-via-ssh-key" class="git-via-part">
762
765
  <label for="git-key">Key</label>
763
- <div class="row"><select id="git-key"></select><button type="button" id="git-key-new">New key</button></div>
764
- <div id="git-key-make" class="row" hidden><input id="git-key-name" maxlength="32" pattern="[a-z]([a-z0-9-]{0,30}[a-z0-9])?" aria-label="Name of the new key" placeholder="deploy-key" spellcheck="false" autocapitalize="off"><button type="button" id="git-key-make-go" class="primary">Make the key</button></div>
766
+ <!-- A SecretPicker (kit.js): #git-key, "+ New key…" (#git-key-new), made in place (#git-key-make). -->
767
+ <div id="git-key-pick"></div>
765
768
  <div id="git-key-shown" hidden>
766
769
  <label for="git-key-public">Public key: add it to the repository on the hosting service, then press Add</label>
767
770
  <div class="row"><textarea id="git-key-public" class="public-key" readonly rows="3" spellcheck="false"></textarea><button type="button" id="git-key-copy">Copy</button></div>
@@ -781,13 +784,13 @@
781
784
  <label for="git-pass">Password (kept sealed here)</label>
782
785
  <input id="git-pass" type="password" autocomplete="new-password">
783
786
  </div>
784
- <div class="row"><button type="submit" class="primary">Add</button></div>
787
+ <div class="row"><button type="submit" class="primary">Create</button></div>
785
788
  <p id="git-said" class="hint" role="status" hidden></p>
786
789
  <p id="git-error" class="error" role="alert" hidden></p>
787
790
  </form>
788
791
  <div class="panel-top"><b id="git-keys-title">SSH keys made here</b><small class="hint">the private half never leaves this server</small></div>
789
792
  <div id="git-keys"></div>
790
- <p id="git-keys-empty" class="hint">No key yet: "New key" in Add a repository makes one.</p>
793
+ <p id="git-keys-empty" class="hint">No key yet: "+ New key…" in New repository makes one.</p>
791
794
  </div>
792
795
  <div id="mailbox-box" class="as-form" data-kind="mailbox"><h3>New mailbox</h3>
793
796
  <div id="mailbox-provider" class="choices" role="group" aria-label="Kind of mailbox">
@@ -805,7 +808,7 @@
805
808
  <input id="mailbox-smtp" class="mailbox-live" placeholder="smtp.example.com — empty: no sending" spellcheck="false" autocapitalize="off">
806
809
  <label for="mailbox-password">Password</label>
807
810
  <div class="row"><input id="mailbox-password" type="password" autocomplete="new-password">
808
- <button type="submit" class="primary">Connect</button></div>
811
+ <button type="submit" class="primary">Create</button></div>
809
812
  <p id="mailbox-error" class="error" role="alert" hidden></p>
810
813
  </form>
811
814
  </div>
@@ -836,13 +839,13 @@
836
839
  <label for="connexion-carddav" id="connexion-carddav-label">Contacts address (CardDAV)</label>
837
840
  <input id="connexion-carddav" spellcheck="false" autocapitalize="off" placeholder="https://dav.example.com">
838
841
  <p class="hint">Filled from the email address when known; your host's help pages give them otherwise. The password stays on the server and never enters a machine.</p>
839
- <div class="row"><button type="button" id="connexion-classic-connect" class="primary">Connect</button></div>
842
+ <div class="row"><button type="button" id="connexion-classic-connect" class="primary">Create</button></div>
840
843
  </div>
841
844
  <p class="hint" id="connexion-notice"></p>
842
845
  <div class="row" id="connexion-open-row"><button type="button" id="connexion-open" class="primary">Open the sign-in page</button></div>
843
846
  <div id="connexion-paste" hidden>
844
847
  <label for="connexion-code">After you allow, the page will not load — copy its full address and paste it here</label>
845
- <div class="row"><input id="connexion-code" spellcheck="false" autocapitalize="off" placeholder="Paste the whole address from the bar"><button type="button" id="connexion-connect" class="primary">Connect</button></div>
848
+ <div class="row"><input id="connexion-code" spellcheck="false" autocapitalize="off" placeholder="Paste the whole address from the bar"><button type="button" id="connexion-connect" class="primary">Create</button></div>
846
849
  </div>
847
850
  <p id="connexion-error" class="error" role="alert" hidden></p>
848
851
  </form>
@@ -860,7 +863,7 @@
860
863
  <label for="secret-name">New secret, or a new value for an existing one</label>
861
864
  <div class="row"><input id="secret-name" maxlength="40" pattern="[A-Z][A-Z0-9_]*" title="Capitals, digits and underscores, starting with a letter. Example: MODEL_KEY" placeholder="MODEL_KEY" spellcheck="false" autocapitalize="characters" required>
862
865
  <input id="secret-value" type="password" placeholder="value (never shown again)" autocomplete="new-password" required>
863
- <button type="submit" class="primary">Save</button></div>
866
+ <button type="submit" class="primary">Create</button></div>
864
867
  <div class="row secret-expiry"><label for="secret-expires">Expires</label><input id="secret-expires" type="date"><small class="hint">Optional</small></div>
865
868
  <!-- A key or a certificate is several lines: pasted into the line above, they come here by themselves. -->
866
869
  <textarea id="secret-lines" class="secret-lines" rows="7" spellcheck="false" autocomplete="off" autocapitalize="off" placeholder="-----BEGIN ...-----&#10;...&#10;-----END ...-----" aria-label="Value, several lines (never shown again)" hidden></textarea>
package/web/kit.js CHANGED
@@ -10,6 +10,10 @@
10
10
  * ConvCard ONE CONVERSATION, three sizes: `row` (the list, Recent), `card` (the home deck),
11
11
  * `member` (a room's members, and the one that welcomes it). Same dot, name, line
12
12
  * of what it does now, chips; each place adds its own gestures (`actions`).
13
+ * StepFlow the steps of a gesture, the one at hand marked, "2 / 3"
14
+ * SecretPicker a key to choose, or "+ New key…" made in place
15
+ * NewAsset ONE BOX to make an asset (05-11, step 3): kinds, the kind's form, one ending;
16
+ * opened with a context (a conversation it will be attached to).
13
17
  *
14
18
  * No framework: each piece is a function that returns an element. Words: English here; the page
15
19
  * hands its own (`setWords`, app.js `uiSaid`) for the few the kit says by itself.
@@ -144,9 +148,115 @@
144
148
  return root;
145
149
  }
146
150
 
151
+ /* The steps of a gesture: done ones ticked, the one at hand `aria-current="step"`, and "2 / 3".
152
+ `at`: the step at hand (0 is the first); `steps.length`: all done. */
153
+ function StepFlow({ steps = [], at = 0, label = '' } = {}) {
154
+ const box = node('div', 'kit-steps');
155
+ const list = node('ol', 'kit-steps-list');
156
+ if (label) list.setAttribute('aria-label', label);
157
+ steps.forEach((s, i) => {
158
+ const li = node('li', i < at ? 'done' : '');
159
+ if (i === at) li.setAttribute('aria-current', 'step');
160
+ const n = node('span', 'kit-step-n', i < at ? '✓' : String(i + 1)); n.setAttribute('aria-hidden', 'true');
161
+ li.append(n, node('span', 'kit-step-w', s));
162
+ list.append(li);
163
+ });
164
+ box.append(list, node('small', 'kit-steps-count', `${Math.min(at + 1, steps.length)} / ${steps.length}`));
165
+ return box;
166
+ }
167
+
168
+ /* A KEY TO CHOOSE, or one made in place: its keys, then "+ New key…" opens a name and Create right
169
+ there. `ids` keeps the page's names for its parts { select, add, row, name, go }. `keys` [{ value,
170
+ label }]; `none`: said when there is none. `suggest()`: the name offered; `onMake(name)`: the page
171
+ makes it (and calls `.set` with the new list). `.set(keys, chosen)` fills it again, the chosen kept. */
172
+ function SecretPicker({ ids = {}, keys = [], value = '', label = '', none = '', addLabel, makeLabel, nameLabel = '', nameAttrs = {}, suggest = () => '', onMake = async () => {}, onChange = () => {} } = {}) {
173
+ const box = node('div', 'kit-secret');
174
+ const select = node('select'); if (ids.select) select.id = ids.select;
175
+ if (label) select.setAttribute('aria-label', label);
176
+ const add = node('button', 'kit-secret-add', addLabel ?? say('kit-new-key', '+ New key…')); add.type = 'button'; if (ids.add) add.id = ids.add;
177
+ const pick = node('div', 'row'); pick.append(select, add);
178
+ const make = node('div', 'row kit-secret-make'); if (ids.row) make.id = ids.row; make.hidden = true;
179
+ const name = node('input'); if (ids.name) name.id = ids.name;
180
+ if (nameLabel) name.setAttribute('aria-label', nameLabel);
181
+ for (const [k, v] of Object.entries(nameAttrs)) name.setAttribute(k, v);
182
+ const go = node('button', 'primary', makeLabel ?? say('kit-create', 'Create')); go.type = 'button'; if (ids.go) go.id = ids.go;
183
+ make.append(name, go);
184
+ box.append(pick, make);
185
+ box.set = (list, chosen = select.value) => {
186
+ select.replaceChildren();
187
+ if (!list.length && none) { const o = node('option', '', none); o.value = ''; select.append(o); }
188
+ for (const k of list) { const o = node('option', '', k.label ?? k.value); o.value = k.value; select.append(o); }
189
+ if (list.some((k) => k.value === chosen)) select.value = chosen;
190
+ };
191
+ box.set(keys, value);
192
+ select.addEventListener('change', () => onChange(select.value));
193
+ add.addEventListener('click', () => { name.value = suggest() ?? ''; make.hidden = false; name.focus?.(); });
194
+ go.addEventListener('click', async () => {
195
+ go.disabled = true;
196
+ try { if ((await onMake(name.value.trim())) !== false) make.hidden = true; } finally { go.disabled = false; }
197
+ });
198
+ return box;
199
+ }
200
+
201
+ /* NEW ASSET: ONE BOX, wherever an asset is made (Assets, a conversation's Attach). Its kinds, then
202
+ that kind's form (the page's own: `form(kind)`), then one ending: "✓ <name> created", Create
203
+ another, Done. Opened with a context, it says it on top (`context`: { line, level? }, `level` a
204
+ Segmented's options) and the page attaches what is made at the end. `existing`: what is there
205
+ already, offered above "or a new one". `made`: { said, note? } draws the ending.
206
+ kinds [{ kind, label, icon? }] kind '' : choose one words { title, there, orNew, steps[3], back, another, done }
207
+ `onBack`: a way back to the kinds from a form, where the frame has none of its own. */
208
+ function NewAsset({ kinds = [], kind = '', made = null, context = null, existing = null, form = () => null, words: w = {}, onKind = () => {}, onBack = null, onAnother = () => {}, onDone = () => {} } = {}) {
209
+ const root = node('div', 'kit-newasset');
210
+ root.dataset.step = made ? 'done' : kind ? 'form' : 'kind';
211
+ const steps = w.steps ?? [say('kit-step-kind', 'Kind'), say('kit-step-set', 'Set up'), say('kit-step-made', 'Created')];
212
+ if (context) {
213
+ const top = node('div', 'kit-na-context');
214
+ top.append(node('span', '', context.line ?? ''));
215
+ if (context.level) top.append(Segmented(context.level));
216
+ root.append(top);
217
+ }
218
+ const head = node('div', 'kit-na-head');
219
+ const title = w.title ?? say('kit-new-asset', 'New asset');
220
+ if (!kind && !made && title) head.append(node('h3', '', title));
221
+ head.append(StepFlow({ steps, at: made ? steps.length : kind ? 1 : 0 }));
222
+ root.append(head);
223
+ if (made) {
224
+ const end = node('div', 'kit-na-made');
225
+ const line = node('p', ''); line.setAttribute('role', 'status');
226
+ line.append(StatusDot({ state: 'ok' }), node('span', '', `✓ ${made.said}`));
227
+ end.append(line);
228
+ if (made.note) end.append(node('p', 'hint', made.note));
229
+ const acts = node('div', 'row kit-na-acts');
230
+ const again = node('button', '', w.another ?? say('kit-create-another', 'Create another')); again.type = 'button'; again.dataset.act = 'another';
231
+ const done = node('button', 'primary', w.done ?? say('kit-done', 'Done')); done.type = 'button'; done.dataset.act = 'done';
232
+ again.addEventListener('click', () => onAnother());
233
+ done.addEventListener('click', () => onDone());
234
+ acts.append(again, done); end.append(acts);
235
+ root.append(end);
236
+ return root;
237
+ }
238
+ if (kind) {
239
+ /* Back to the kinds, when the frame has no way back of its own. */
240
+ if (onBack) { const back = node('button', 'as-link kit-na-back', `\u2039 ${w.back ?? say('kit-back', 'Back')}`); back.type = 'button'; back.addEventListener('click', () => onBack()); root.append(back); }
241
+ const f = form(kind); if (f) root.append(f);
242
+ return root;
243
+ }
244
+ if (existing) root.append(node('h4', 'kit-na-sub', w.there ?? say('kit-already-there', 'Already there')), existing, node('h4', 'kit-na-sub', w.orNew ?? say('kit-or-new', 'or a new one')));
245
+ /* `.as-kinds`, `data-kind`: the names the page's rules and tests know. */
246
+ const list = node('div', 'as-kinds');
247
+ for (const k of kinds) {
248
+ const b = node('button', '', k.label ?? k.kind); b.type = 'button'; b.dataset.kind = k.kind;
249
+ if (k.icon) b.prepend(k.icon);
250
+ b.addEventListener('click', () => onKind(k.kind));
251
+ list.append(b);
252
+ }
253
+ root.append(list);
254
+ return root;
255
+ }
256
+
147
257
  window.clavariumKit = {
148
258
  STATES, STATE_WORDS, stateOf, hueOf, initialOf,
149
259
  setWords(fn) { if (typeof fn === 'function') words = fn; },
150
- StatusDot, Avatar, Chips, Switch, Segmented, InlineConfirm, ConvCard,
260
+ StatusDot, Avatar, Chips, Switch, Segmented, InlineConfirm, ConvCard, StepFlow, SecretPicker, NewAsset,
151
261
  };
152
262
  })();
package/web/style.css CHANGED
@@ -2647,6 +2647,30 @@ button.kit-switch[aria-checked="true"]::after { left: 18px; background: var(--ok
2647
2647
  /* INLINE CONFIRM: in place of its button, Keep first. */
2648
2648
  .kit-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
2649
2649
  .kit-confirm-q { color: var(--ink); }
2650
+ /* STEPFLOW: the steps of a gesture, the one at hand marked, and "2 / 3". */
2651
+ .kit-steps { display: flex; align-items: center; gap: 10px; min-width: 0; }
2652
+ .kit-steps-list { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; min-width: 0; font-size: .8125rem; color: var(--ink2); }
2653
+ .kit-steps-list > li { display: inline-flex; align-items: center; gap: 5px; }
2654
+ .kit-step-n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); font-size: .6875rem; font-weight: 600; }
2655
+ .kit-steps-list > li.done .kit-step-n { border-color: var(--ok); color: var(--ok); }
2656
+ .kit-steps-list > li[aria-current="step"] { color: var(--ink); font-weight: 600; }
2657
+ .kit-steps-list > li[aria-current="step"] .kit-step-n { border-color: var(--brass); background: var(--brass); color: var(--bg); }
2658
+ .kit-steps-count { margin-left: auto; flex: none; color: var(--ink2); font-size: .75rem; }
2659
+ /* SECRETPICKER: its keys, "+ New key…", and the new one's name made in place. */
2660
+ .kit-secret { display: flex; flex-direction: column; gap: 6px; }
2661
+ .kit-secret .row > select, .kit-secret .row > input { flex: 1; min-width: 0; }
2662
+ /* NEW ASSET: one box -- its context on top, its steps, the kinds or a form, one ending. */
2663
+ .kit-newasset { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
2664
+ .kit-na-context { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--brass) 10%, transparent); color: var(--brass-ink); font-size: .875rem; }
2665
+ .kit-na-context > .kit-seg { margin-left: auto; }
2666
+ .kit-na-head { display: flex; flex-direction: column; gap: 6px; }
2667
+ .kit-na-head > h3 { margin: 0; font-size: 1.125rem; }
2668
+ .kit-na-sub { margin: 4px 0 0; font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
2669
+ .kit-na-made { display: flex; flex-direction: column; gap: 8px; }
2670
+ .kit-na-made > p[role="status"] { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; color: var(--ink); }
2671
+ .kit-na-made > .hint { margin: 0; }
2672
+ .kit-na-acts { gap: 8px; justify-content: flex-end; }
2673
+ .as-detail > .kit-newasset[data-step="done"] { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
2650
2674
  /* THE CONVERSATION CARD: its avatar with its point on the corner, its name, what it does now, its chips;
2651
2675
  the gestures of its place at its end. Sizes: row (the list), card (the deck), member (a room's). */
2652
2676
  .kit-conv { --kc-av: 28px; --kc-ring: var(--bar); position: relative; display: grid; grid-template-columns: var(--kc-av) minmax(0, 1fr) auto; column-gap: 10px; align-items: start; text-align: left; color: var(--ink); min-width: 0; }