clavarium 0.2.351-next.1 → 0.2.352-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.
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/server/settingswords.mjs +5 -0
- package/web/app.js +96 -137
- package/web/index.html +2 -2
- package/web/kit.js +96 -1
- package/web/style.css +31 -23
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.352-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.352-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/settingswords.mjs
CHANGED
|
@@ -82,5 +82,10 @@ export const SETTINGS_WORDS_FR = {
|
|
|
82
82
|
'set-rt-hint-free': 'Agit seul, tout est noté au journal', 'set-rt-hint-terminal': 'Tout son terminal',
|
|
83
83
|
'set-rt-hint-chat': 'Lit et écrit dans son chat', 'set-rt-hint-both': 'Son chat et son terminal',
|
|
84
84
|
'set-as-nobody': 'personne',
|
|
85
|
+
/* The one list of assets (06-11, kit AssetList): its views, its one button, a group's head, what an empty one says. */
|
|
86
|
+
'set-as-new': 'Nouveau', 'set-as-by-group': 'Groupes', 'set-as-by-type': 'Types', 'set-as-no-group': 'Sans groupe',
|
|
87
|
+
'set-as-fold': 'Replier', 'set-as-unfold': 'Déplier', 'set-as-group-open': 'Réglages de {name}', 'set-as-group-gear': 'Donner, renommer, supprimer',
|
|
88
|
+
'set-as-group-empty': 'Vide : glissez un asset ici', 'set-as-all-grouped': 'Chaque asset est dans un groupe',
|
|
89
|
+
'set-as-no-groups': 'Créez un groupe, puis glissez-y un asset',
|
|
85
90
|
};
|
|
86
91
|
export const settingsWords = (lang) => (String(lang ?? '').toLowerCase().split('-')[0] === 'fr' ? { ...SETTINGS_WORDS_FR } : {});
|
package/web/app.js
CHANGED
|
@@ -1316,6 +1316,8 @@
|
|
|
1316
1316
|
let words = null; try { words = chatWords; } catch { /* not read yet */ }
|
|
1317
1317
|
return (typeof words?.[key] === 'string' ? words[key] : fallback).replace(/\{(\w+)\}/g, (all, k) => (k in vars ? String(vars[k]) : all));
|
|
1318
1318
|
};
|
|
1319
|
+
/* The kit says its few words in the screen's language too (Holders' "nobody", the rights, the list's). */
|
|
1320
|
+
KIT.setWords((key, fallback) => uiSaid(key, fallback));
|
|
1319
1321
|
/* Who of a room speaks now (#282, an AI given a message and not done): « Cuisine parle… ». */
|
|
1320
1322
|
const speaking = (who) => (who.length > 1 ? uiSaid('room-speaking-many', '{names} are speaking\u2026', { names: who.join(', ') }) : uiSaid('room-speaking', '{name} is speaking\u2026', { name: who[0] }));
|
|
1321
1323
|
const thinkingOf = (r) => (Array.isArray(r?.thinking) ? r.thinking.filter((x) => typeof x === 'string' && x) : []);
|
|
@@ -3750,7 +3752,7 @@
|
|
|
3750
3752
|
/* BINDER'S LISTS, AS THIS PAGE NAMES THEM: the one place for the word (Assets, a conversation's tab). */
|
|
3751
3753
|
const LISTS_WORD = { many: 'Binders', one: 'Binder', a: 'a binder', its: 'Its binders' };
|
|
3752
3754
|
$('view-lists-word').textContent = LISTS_WORD.many; $('listnew-head').textContent = `New ${LISTS_WORD.one.toLowerCase()}`;
|
|
3753
|
-
const ASSET_KINDS = [['git', 'Git repositories', 'git-branch'], ['folder', 'Folders', 'folder'], ['mailbox', 'Mailboxes', 'mail'], ['agenda', 'Calendars', 'calendar'], ['contacts', 'Contacts', 'users'], ['secret', 'Secrets', 'key-round'], ['list', LISTS_WORD.many, '']];
|
|
3755
|
+
const ASSET_KINDS = [['git', 'Git repositories', 'git-branch'], ['folder', 'Folders', 'folder'], ['mailbox', 'Mailboxes', 'mail'], ['agenda', 'Calendars', 'calendar'], ['contacts', 'Contacts', 'users'], ['secret', 'Secrets', 'key-round'], ['list', LISTS_WORD.many, ''], ['acces', 'Accesses', 'link']];
|
|
3754
3756
|
/* A live Tether target shows in the category of its kind (a mailbox among the
|
|
3755
3757
|
mailboxes), not apart. Its connecting account is the rest of its id. */
|
|
3756
3758
|
const TETHER_CAT = { mail: 'mailbox', calendar: 'agenda', contacts: 'contacts' };
|
|
@@ -3817,92 +3819,37 @@
|
|
|
3817
3819
|
row.addEventListener('click', () => choose(item.key));
|
|
3818
3820
|
return row;
|
|
3819
3821
|
}
|
|
3820
|
-
/*
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3822
|
+
/* AN ITEM OF THESE LISTS, as the kit's AssetCard takes it (06-11, assets step 2): its point when it asks for
|
|
3823
|
+
you (a secret soon or past, a mailbox failing), the shade of its line, who has it or its right. */
|
|
3824
|
+
const cardOf = (item) => ({ key: item.key, kind: item.kind, name: item.name, sub: item.sub ?? '', live: item.live,
|
|
3825
|
+
state: item.dot === 'bad' || item.tone === 'bad' ? 'problem' : item.dot === 'warn' ? 'wait' : '', tone: item.dot || item.tone || '',
|
|
3826
|
+
holders: item.holders, right: item.right, count: item.count });
|
|
3827
|
+
/* Who has an asset, for its row: the conversations (their name as shown), then the devices given it. */
|
|
3828
|
+
const holdersOf = (names, key) => [...names.map((n) => ({ name: shownName(conversations.find((c) => c.name === n)) || n })), ...sharedDevices.filter((d) => (d.grants ?? []).some((g) => g.asset === key)).map((d) => ({ name: d.name ?? d.id }))];
|
|
3829
|
+
/* Who uses it, for the list (its holders) and for its panel's title (the number, as before: step 3 redraws it). */
|
|
3830
|
+
const usedBy = (names, key) => ({ holders: holdersOf(names, key), badge: String(names.length), badgeTitle: `Used by ${names.length} conversation${names.length === 1 ? '' : 's'}`, badgeTone: 'count' });
|
|
3831
|
+
/* A row pinned above the list (To send, Demandes): the same card, its number on its right. */
|
|
3832
|
+
const pinnedCard = (entry, { chosen, onOpen, extra = '' }) => KIT.AssetCard({ key: entry.key, kind: entry.kind, name: entry.name, sub: entry.sub, count: entry.count },
|
|
3833
|
+
{ cls: `as-row ts-entry${extra ? ` ${extra}` : ''}`, current: entry.key === chosen, onOpen });
|
|
3834
|
+
/* THE ONE LIST (kit AssetList), in `holder`: the Assets menu (scope 'all') or a conversation's tab. */
|
|
3835
|
+
function paintAssetList(holder, model, opts) {
|
|
3836
|
+
holder.replaceChildren(KIT.AssetList(model, { rowCls: 'as-row', ...opts }));
|
|
3835
3837
|
}
|
|
3836
3838
|
/* The group an asset is in, or '' for none. */
|
|
3837
3839
|
const groupOf = (key, groups) => groups.find((g) => (g.members ?? []).includes(key))?.id ?? '';
|
|
3838
3840
|
/* Groups the owner has folded shut in the by-group view (a convenience). */
|
|
3839
3841
|
const groupsFolded = (() => { try { const v = JSON.parse(localStorage.getItem('clavarium-groups-folded') ?? '[]'); return new Set(Array.isArray(v) ? v : []); } catch { return new Set(); } })();
|
|
3840
3842
|
const keepGroupsFolded = () => { try { localStorage.setItem('clavarium-groups-folded', JSON.stringify([...groupsFolded])); } catch { /* a private window */ } };
|
|
3841
|
-
/* The rows, by the owner's groups: a foldable section per group, then the
|
|
3842
|
-
loose ones. A group's name opens its own detail (rename, remove, give the
|
|
3843
|
-
whole group); the chevron folds it; "+" makes a new one. An asset is put
|
|
3844
|
-
into a group from the asset's own detail. */
|
|
3845
|
-
function paintAsGroups(holder, items, groups, { chosen, choose, empty }) {
|
|
3846
|
-
holder.replaceChildren();
|
|
3847
|
-
const byKey = new Map(items.map((i) => [i.key, i]));
|
|
3848
|
-
const addBar = el('div', 'as-group-new');
|
|
3849
|
-
if (groupAdding) {
|
|
3850
|
-
const form = el('form', 'as-group-form'); form.autocomplete = 'off';
|
|
3851
|
-
const input = el('input'); input.placeholder = 'Group name'; input.maxLength = 40; input.setAttribute('aria-label', 'New group name');
|
|
3852
|
-
const make = el('button', 'primary', 'Add'); make.type = 'submit';
|
|
3853
|
-
const cancel = el('button', '', 'Cancel'); cancel.type = 'button'; cancel.addEventListener('click', () => { groupAdding = false; void paintAssets(); });
|
|
3854
|
-
form.append(input, make, cancel);
|
|
3855
|
-
form.addEventListener('submit', async (event) => {
|
|
3856
|
-
event.preventDefault(); $('assets-error').hidden = true;
|
|
3857
|
-
try { const made = await post(`${API}/asset-groups`, { label: input.value.trim() }); groupAdding = false; assetOpen = `group:${made.id}`; remember(); }
|
|
3858
|
-
catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
|
|
3859
|
-
void paintAssets();
|
|
3860
|
-
});
|
|
3861
|
-
addBar.append(form);
|
|
3862
|
-
holder.append(addBar);
|
|
3863
|
-
queueMicrotask(() => input.focus());
|
|
3864
|
-
} else {
|
|
3865
|
-
addBar.append(roundPlus('New group', () => { groupAdding = true; void paintAssets(); }), el('span', 'hint', 'New group'));
|
|
3866
|
-
holder.append(addBar);
|
|
3867
|
-
}
|
|
3868
|
-
const section = (head, rows, none, { foldable, drop } = {}) => {
|
|
3869
|
-
const s = el('section', 'as-kind as-group'); s.append(head); s.dataset.drop = drop;
|
|
3870
|
-
if (!foldable || !head.dataset.folded) {
|
|
3871
|
-
if (rows.length === 0) s.append(el('p', 'hint as-none', none));
|
|
3872
|
-
for (const item of rows) s.append(assetRow(item, { chosen, choose }));
|
|
3873
|
-
}
|
|
3874
|
-
holder.append(s);
|
|
3875
|
-
};
|
|
3876
|
-
for (const g of groups) {
|
|
3877
|
-
const members = (g.members ?? []).map((k) => byKey.get(k)).filter(Boolean);
|
|
3878
|
-
const folded = groupsFolded.has(g.id);
|
|
3879
|
-
const head = el('div', 'as-kind-head as-group-head'); if (folded) head.dataset.folded = 'true';
|
|
3880
|
-
/* The whole header folds/unfolds the group; a gear opens its settings. */
|
|
3881
|
-
const toggle = el('button', 'as-group-name'); toggle.type = 'button';
|
|
3882
|
-
if (`group:${g.id}` === chosen) toggle.setAttribute('aria-current', 'true');
|
|
3883
|
-
toggle.setAttribute('aria-expanded', String(!folded));
|
|
3884
|
-
toggle.append(el('span', 'as-chev', folded ? '▸' : '▾'), el('h3', '', g.label), el('span', 'as-badge count', String(members.length)));
|
|
3885
|
-
toggle.title = folded ? 'Unfold' : 'Fold';
|
|
3886
|
-
toggle.addEventListener('click', () => { if (folded) groupsFolded.delete(g.id); else groupsFolded.add(g.id); keepGroupsFolded(); void paintAssets(); });
|
|
3887
|
-
const gear = el('button', 'as-gear', '⚙'); gear.type = 'button'; gear.setAttribute('aria-label', `Settings for ${g.label}`); gear.title = 'Give, rename, remove';
|
|
3888
|
-
gear.addEventListener('click', (e) => { e.stopPropagation(); choose(`group:${g.id}`); });
|
|
3889
|
-
head.append(toggle, gear);
|
|
3890
|
-
section(head, members, 'Empty. Drag an asset here, or open one to put it here.', { foldable: true, drop: g.id });
|
|
3891
|
-
}
|
|
3892
|
-
const grouped = new Set(groups.flatMap((g) => g.members ?? []));
|
|
3893
|
-
const loose = items.filter((i) => !grouped.has(i.key));
|
|
3894
|
-
const looseHead = el('div', 'as-kind-head'); looseHead.append(el('h3', '', 'No group'));
|
|
3895
|
-
section(looseHead, loose, groups.length ? 'Every asset is in a group.' : 'Make a group above, then open an asset to put it in it.', { drop: '' });
|
|
3896
|
-
if (items.length === 0 && empty) holder.append(el('p', 'hint', empty));
|
|
3897
|
-
if (groups.length) dragToGroups(holder);
|
|
3898
|
-
}
|
|
3899
3843
|
/* DRAGGING AN ASSET ONTO A GROUP (#111), like a binder's Kanban: a mouse drags once it
|
|
3900
3844
|
has moved a little; a finger after a short hold (so a swipe still scrolls). The row
|
|
3901
3845
|
follows the pointer as a light copy; the group under it lights up; let go on it, and
|
|
3902
3846
|
the asset is placed there ("No group" takes it out). A tap still opens the asset. */
|
|
3903
3847
|
function dragToGroups(holder) {
|
|
3848
|
+
/* Wired once: the list is drawn again and again inside the same holder. */
|
|
3849
|
+
if (holder.dataset.dragWired) return;
|
|
3850
|
+
holder.dataset.dragWired = 'true';
|
|
3904
3851
|
let drag = null;
|
|
3905
|
-
const sectionAt = (x, y) => document.elementFromPoint(x, y)?.closest?.('.
|
|
3852
|
+
const sectionAt = (x, y) => document.elementFromPoint(x, y)?.closest?.('.kit-aslist-group[data-drop]') ?? null;
|
|
3906
3853
|
const end = () => { if (!drag) return; clearTimeout(drag.hold); drag.ghost?.remove(); drag.over?.classList.remove('as-drop-over'); document.body.classList.remove('as-dragging'); drag = null; };
|
|
3907
3854
|
const start = (d) => {
|
|
3908
3855
|
d.on = true;
|
|
@@ -3913,9 +3860,10 @@
|
|
|
3913
3860
|
document.body.append(d.ghost); document.body.classList.add('as-dragging');
|
|
3914
3861
|
};
|
|
3915
3862
|
holder.addEventListener('pointerdown', (e) => {
|
|
3916
|
-
const row = e.target.closest('.as-row[data-asset]');
|
|
3917
|
-
|
|
3918
|
-
|
|
3863
|
+
const row = e.target.closest('.as-row[data-asset]:not(.ts-entry)');
|
|
3864
|
+
/* Only in the view by group, once there is a group to drag to. */
|
|
3865
|
+
if (!row || !holder.contains(row) || e.button > 0 || !holder.querySelector('.kit-aslist-group[data-drop]:not([data-drop=""])')) return;
|
|
3866
|
+
drag = { row, id: e.pointerId, x0: e.clientX, y0: e.clientY, on: false, touch: e.pointerType !== 'mouse', from: row.closest('.kit-aslist-group')?.dataset.drop };
|
|
3919
3867
|
if (drag.touch) { const d = drag; d.hold = setTimeout(() => { if (drag === d) { start(d); try { row.setPointerCapture(d.id); } catch { /* still heard */ } } }, 350); }
|
|
3920
3868
|
});
|
|
3921
3869
|
holder.addEventListener('pointermove', (e) => {
|
|
@@ -3965,16 +3913,31 @@
|
|
|
3965
3913
|
if (item.kind === 'list') return item.list.grants?.[id] ?? 'none';
|
|
3966
3914
|
return item.resource?.attachments?.[conversationName] ?? 'none';
|
|
3967
3915
|
}
|
|
3968
|
-
/* The toggle above the rows:
|
|
3969
|
-
function paintAssetsView() {
|
|
3916
|
+
/* The toggle above the rows: the owner's groups or the types (kit Segmented); `view`, the one shown. */
|
|
3917
|
+
function paintAssetsView(view) {
|
|
3970
3918
|
const bar = $('assets-view'); if (!bar) return;
|
|
3971
|
-
bar.replaceChildren()
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3919
|
+
bar.replaceChildren(KIT.Segmented({ options: [{ value: 'group', label: uiSaid('set-as-by-group', 'Groups') }, { value: 'type', label: uiSaid('set-as-by-type', 'Types') }], value: view, label: 'Arrange assets',
|
|
3920
|
+
onChange: (by) => { if (by === view) return; assetsBy = by; keepAssetsBy(); groupAdding = false; void paintAssets(); } }));
|
|
3921
|
+
}
|
|
3922
|
+
/* "+ New group", above the groups: a name in place, then made and opened. */
|
|
3923
|
+
function newGroupBar() {
|
|
3924
|
+
const addBar = el('div', 'as-group-new');
|
|
3925
|
+
if (groupAdding) {
|
|
3926
|
+
const form = el('form', 'as-group-form'); form.autocomplete = 'off';
|
|
3927
|
+
const input = el('input'); input.placeholder = 'Group name'; input.maxLength = 40; input.setAttribute('aria-label', 'New group name');
|
|
3928
|
+
const make = el('button', 'primary', 'Add'); make.type = 'submit';
|
|
3929
|
+
const cancel = el('button', '', 'Cancel'); cancel.type = 'button'; cancel.addEventListener('click', () => { groupAdding = false; void paintAssets(); });
|
|
3930
|
+
form.append(input, make, cancel);
|
|
3931
|
+
form.addEventListener('submit', async (event) => {
|
|
3932
|
+
event.preventDefault(); $('assets-error').hidden = true;
|
|
3933
|
+
try { const made = await post(`${API}/asset-groups`, { label: input.value.trim() }); groupAdding = false; assetOpen = `group:${made.id}`; remember(); }
|
|
3934
|
+
catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
|
|
3935
|
+
void paintAssets();
|
|
3936
|
+
});
|
|
3937
|
+
addBar.append(form);
|
|
3938
|
+
queueMicrotask(() => input.focus());
|
|
3939
|
+
} else addBar.append(roundPlus('New group', () => { groupAdding = true; void paintAssets(); }), el('span', 'hint', 'New group'));
|
|
3940
|
+
return addBar;
|
|
3978
3941
|
}
|
|
3979
3942
|
/* In an asset's detail: which group it is in. Moving it is a folder move
|
|
3980
3943
|
(it leaves any other group). New groups are made in the by-group view. */
|
|
@@ -4594,6 +4557,10 @@
|
|
|
4594
4557
|
const noAssetChosen = () => el('p', 'hint as-none', 'Select an asset to see its detail.');
|
|
4595
4558
|
|
|
4596
4559
|
/* ---- a conversation's own ---- */
|
|
4560
|
+
/* A conversation's tab, searched: its words, and whose they are. */
|
|
4561
|
+
let cassetsQuery = ''; let cassetsFor = '';
|
|
4562
|
+
$('cassets-search').addEventListener('input', () => { cassetsQuery = $('cassets-search').value.trim(); void paintRoomAssets(); });
|
|
4563
|
+
$('cassets-attach').addEventListener('click', () => { void openAccess(true); });
|
|
4597
4564
|
async function paintRoomAssets() {
|
|
4598
4565
|
if (!assetsShown) return;
|
|
4599
4566
|
watchTether();
|
|
@@ -4607,15 +4574,15 @@
|
|
|
4607
4574
|
const mineJobs = (Array.isArray(tether.jobs) ? tether.jobs : []).filter((j) => j.agent === `conversation:${current}`);
|
|
4608
4575
|
const mine = new Map((c?.resources ?? []).map((r) => [r.name, r.access]));
|
|
4609
4576
|
const items = [];
|
|
4610
|
-
if (c?.work === 'kept') items.push({ key: 'folder:work', kind: 'folder', name: 'work', own: true, sub: 'where its tool works', badge: 'write', badgeTone: 'write' });
|
|
4577
|
+
if (c?.work === 'kept') items.push({ key: 'folder:work', kind: 'folder', name: 'work', own: true, sub: 'where its tool works', badge: 'write', badgeTone: 'write', right: { level: 'write' } });
|
|
4611
4578
|
for (const r of all.filter((x) => mine.has(x.name))) {
|
|
4612
4579
|
const kind = kindOf(r); const access = mine.get(r.name);
|
|
4613
4580
|
const box = kind === 'mailbox' ? boxes.find((m) => m.name === r.name) : undefined;
|
|
4614
|
-
items.push({ key: `${kind}:${r.name}`, kind, name: r.name, resource: r, box, badge: access, badgeTone: access, badgeLong: access === 'write' ? 'read and write' : 'read only',
|
|
4581
|
+
items.push({ key: `${kind}:${r.name}`, kind, name: r.name, resource: r, box, badge: access, badgeTone: access, badgeLong: access === 'write' ? 'read and write' : 'read only', right: { key: kind, value: access },
|
|
4615
4582
|
sub: kind === 'git' ? gitSub(r) : kind === 'mailbox' ? boxSub(box) : 'folder', tone: box?.failure ? 'bad' : '' });
|
|
4616
4583
|
}
|
|
4617
4584
|
markSecrets(secrets);
|
|
4618
|
-
for (const s2 of secrets.filter((x) => x.conversations.includes(current))) items.push({ key: `secret:${s2.name}`, kind: 'secret', name: s2.name, secret: s2, ...secretItem(s2, 'name only · used by its agent') });
|
|
4585
|
+
for (const s2 of secrets.filter((x) => x.conversations.includes(current))) items.push({ key: `secret:${s2.name}`, kind: 'secret', name: s2.name, secret: s2, right: { level: 'use' }, ...secretItem(s2, 'name only · used by its agent') });
|
|
4619
4586
|
/* TO SEND, above them all, once it has a repository: every one of them on one screen. */
|
|
4620
4587
|
const gits = items.filter((i) => i.kind === 'git').map((i) => i.name);
|
|
4621
4588
|
const outbox = gits.length ? { key: 'send:all', kind: 'send', name: 'To send', sub: 'every repository, reviewed and sent at once' } : null;
|
|
@@ -4624,20 +4591,15 @@
|
|
|
4624
4591
|
const chosen = (outbox && roomPick === outbox.key ? outbox : null) ?? (demandes && roomPick === demandes.key ? demandes : null) ?? items.find((i) => i.key === roomPick) ?? null;
|
|
4625
4592
|
const as = $('cassets-as');
|
|
4626
4593
|
as.dataset.open = chosen ? 'detail' : 'list';
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
return row;
|
|
4637
|
-
};
|
|
4638
|
-
if (outbox) $('cassets-rows').prepend(pinnedRow(outbox));
|
|
4639
|
-
if (demandes) $('cassets-rows').prepend(pinnedRow(demandes, 'demande-entry'));
|
|
4640
|
-
$('cassets-rows').prepend(top);
|
|
4594
|
+
/* THE ONE LIST (kit AssetList), scope this conversation: by type, its right on each row; To send and
|
|
4595
|
+
Demandes pinned above. Its search is its own, emptied when another conversation is shown. */
|
|
4596
|
+
if (cassetsFor !== current) { cassetsFor = current; cassetsQuery = ''; $('cassets-search').value = ''; }
|
|
4597
|
+
const model = KIT.assetListModel({ items: items.map(cardOf), scope: `conversation:${current}`, query: cassetsQuery, kinds: ASSET_KINDS });
|
|
4598
|
+
const pinned = cassetsQuery ? [] : [
|
|
4599
|
+
demandes && pinnedCard({ ...demandes, count: waitingCount }, { chosen: chosen?.key, onOpen: pickRoomAsset, extra: 'demande-entry' }),
|
|
4600
|
+
outbox && pinnedCard(outbox, { chosen: chosen?.key, onOpen: pickRoomAsset }),
|
|
4601
|
+
];
|
|
4602
|
+
paintAssetList($('cassets-rows'), model, { chosen: chosen?.key, onOpen: pickRoomAsset, pinned, empty: 'Nothing is given to it yet.', noMatch: 'Nothing by that name.' });
|
|
4641
4603
|
if (c?.work === 'disk') $('cassets-rows').append(el('p', 'hint as-disk', 'Its work is on the disk of its machine: nothing of it is kept here.'));
|
|
4642
4604
|
const detail = $('cassets-detail');
|
|
4643
4605
|
if (!chosen) { unembedFiles(); detail.replaceChildren(); if (items.length) detail.append(noAssetChosen()); return; }
|
|
@@ -4748,10 +4710,10 @@
|
|
|
4748
4710
|
|
|
4749
4711
|
/* ---- the server's ---- */
|
|
4750
4712
|
let assetOpen = ''; let assetsAdding = ''; let assetsQuery = ''; let remoteShown = ''; let remoteEditing = false; let listOpen = ''; let listsSig = '';
|
|
4751
|
-
/* How the Assets list is arranged: by type
|
|
4752
|
-
|
|
4753
|
-
let assetsBy = '
|
|
4754
|
-
try {
|
|
4713
|
+
/* How the Assets list is arranged: by the owner's groups or by type. A per-viewer convenience, kept in the
|
|
4714
|
+
browser once chosen; never chosen (''), groups as soon as one exists, else types (kit assetListModel). */
|
|
4715
|
+
let assetsBy = '';
|
|
4716
|
+
try { const kept = localStorage.getItem('clavarium-assets-by'); if (kept === 'group' || kept === 'type') assetsBy = kept; } catch { /* a private window */ }
|
|
4755
4717
|
const keepAssetsBy = () => { try { localStorage.setItem('clavarium-assets-by', assetsBy); } catch { /* as above */ } };
|
|
4756
4718
|
/* The "+ New group" inline form being shown in the by-group view. */
|
|
4757
4719
|
let groupAdding = false;
|
|
@@ -4961,31 +4923,28 @@
|
|
|
4961
4923
|
markSecrets(secrets);
|
|
4962
4924
|
const items = [];
|
|
4963
4925
|
for (const r of all) {
|
|
4964
|
-
const kind = kindOf(r);
|
|
4926
|
+
const kind = kindOf(r);
|
|
4965
4927
|
const box = kind === 'mailbox' ? boxes.find((m) => m.name === r.name) : undefined;
|
|
4966
|
-
items.push({ key: `${kind}:${r.name}`, kind, name: r.name, resource: r, box,
|
|
4928
|
+
items.push({ key: `${kind}:${r.name}`, kind, name: r.name, resource: r, box, ...usedBy(Object.keys(r.attachments ?? {}), `${kind}:${r.name}`),
|
|
4967
4929
|
sub: kind === 'git' ? `${gitSub(r)}${viaText(r.via)}` : kind === 'mailbox' ? boxSub(box) : 'folder', tone: box?.failure ? 'bad' : '' });
|
|
4968
4930
|
}
|
|
4969
|
-
for (const s2 of secrets) items.push({ key: `secret:${s2.name}`, kind: 'secret', name: s2.name, secret: s2,
|
|
4931
|
+
for (const s2 of secrets) items.push({ key: `secret:${s2.name}`, kind: 'secret', name: s2.name, secret: s2, ...usedBy(s2.conversations, `secret:${s2.name}`), ...secretItem(s2, 'name only') });
|
|
4970
4932
|
/* Tether targets ("Connexions"): a mailbox, calendar or address book connected
|
|
4971
4933
|
by token, given to a conversation at a level. The token lives on the server. */
|
|
4972
4934
|
const allTargets = Array.isArray(tether.targets) ? tether.targets : [];
|
|
4973
4935
|
for (const tgt of allTargets) {
|
|
4974
|
-
const users = Object.keys(tgt.grants ?? {}).filter((id) => id.startsWith('conversation:')).length;
|
|
4936
|
+
const users = Object.keys(tgt.grants ?? {}).filter((id) => id.startsWith('conversation:')).map((id) => id.slice('conversation:'.length));
|
|
4975
4937
|
const acct = tetherAccount(tgt.id);
|
|
4976
4938
|
const siblings = allTargets.filter((o) => o.id !== tgt.id && tetherAccount(o.id) === acct).map((o) => connexionSub(o.kind));
|
|
4977
|
-
items.push({ key: `connexion:${tgt.id}`, kind: tetherCat(tgt.kind), name: tgt.title, target: tgt, siblings, live: true,
|
|
4978
|
-
badge: String(users), badgeTitle: `Used by ${users} conversation${users === 1 ? '' : 's'}`, badgeTone: 'count',
|
|
4939
|
+
items.push({ key: `connexion:${tgt.id}`, kind: tetherCat(tgt.kind), name: tgt.title, target: tgt, siblings, live: true, ...usedBy(users, `connexion:${tgt.id}`),
|
|
4979
4940
|
sub: siblings.length ? `linked: ${siblings.join(', ')}` : connexionSub(tgt.kind) });
|
|
4980
4941
|
}
|
|
4981
4942
|
/* Binder's lists: given to a conversation (read, write) in Binder itself. */
|
|
4982
4943
|
const shownLists = lists.ok && Array.isArray(lists.data) ? lists.data.filter((l) => !l.archived) : [];
|
|
4983
4944
|
listsSig = binderSig(lists.data);
|
|
4984
4945
|
for (const l of shownLists) {
|
|
4985
|
-
|
|
4986
|
-
items.push({ key: `list:${l.id}`, kind: 'list', name: l.title, list: l, badge: String(users), badgeTitle: `Used by ${users} conversation${users === 1 ? '' : 's'}`, badgeTone: 'count', sub: `${l.count} card${l.count === 1 ? '' : 's'}` });
|
|
4946
|
+
items.push({ key: `list:${l.id}`, kind: 'list', name: l.title, list: l, ...usedBy(givenTo(l).map((id) => id.slice('conversation:'.length)), `list:${l.id}`), sub: `${l.count} card${l.count === 1 ? '' : 's'}` });
|
|
4987
4947
|
}
|
|
4988
|
-
const shown = assetsQuery ? items.filter((i) => i.name.includes(assetsQuery.toLowerCase()) || i.name.toLowerCase().includes(assetsQuery.toLowerCase())) : items;
|
|
4989
4948
|
const chosen = assetsAdding ? null : items.find((i) => i.key === assetOpen) ?? null;
|
|
4990
4949
|
if (justMade && !justMade.to && justMade.key !== chosen?.key) justMade = null;
|
|
4991
4950
|
/* A group can be the open thing too (its own detail: give it, rename it). */
|
|
@@ -4995,24 +4954,19 @@
|
|
|
4995
4954
|
const allApprovals = Array.isArray(tether.approvals) ? tether.approvals : [];
|
|
4996
4955
|
const onDemandes = !assetsAdding && !chosen && !chosenGroup && assetOpen === 'demandes:all';
|
|
4997
4956
|
$('assets-as').dataset.open = chosen || chosenGroup || assetsAdding || onDemandes ? 'detail' : 'list';
|
|
4998
|
-
/* The "by type / by group" toggle sits above the rows (built once, kept). */
|
|
4999
|
-
paintAssetsView();
|
|
5000
4957
|
const choose = (key) => { placeAssetStep(); if (key !== assetOpen) groupGiveShow.clear(); assetOpen = key; assetsAdding = ''; remoteEditing = false; remember(); void paintAssets(); };
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
if (
|
|
5009
|
-
|
|
5010
|
-
if (
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
row.addEventListener('click', () => choose('demandes:all'));
|
|
5014
|
-
$('assets-rows').prepend(row);
|
|
5015
|
-
}
|
|
4958
|
+
/* THE ONE LIST (kit AssetList), scope all: groups by default once one exists; who has each on its right. */
|
|
4959
|
+
const model = KIT.assetListModel({ items: items.map(cardOf), groups: assetGroups, scope: 'all', by: assetsBy, query: assetsQuery, folded: [...groupsFolded], kinds: ASSET_KINDS });
|
|
4960
|
+
paintAssetsView(model.view);
|
|
4961
|
+
/* Above them all, once something waits: the owner reaches every call from here, not only by opening the
|
|
4962
|
+
right connexion. Then, in the view by group, "+ New group". */
|
|
4963
|
+
const pinned = [];
|
|
4964
|
+
if (allApprovals.length && !assetsQuery) pinned.push(pinnedCard({ key: 'demandes:all', kind: 'demandes', name: 'Demandes', sub: `${allApprovals.length} waiting for you`, count: allApprovals.length }, { chosen: onDemandes ? 'demandes:all' : '', onOpen: choose, extra: 'demande-entry' }));
|
|
4965
|
+
if (model.view === 'group') pinned.push(newGroupBar());
|
|
4966
|
+
paintAssetList($('assets-rows'), model, { chosen: chosen?.key ?? (chosenGroup ? `group:${chosenGroup.id}` : onDemandes ? 'demandes:all' : ''), onOpen: choose, pinned,
|
|
4967
|
+
onFold: (id) => { if (groupsFolded.has(id)) groupsFolded.delete(id); else groupsFolded.add(id); keepGroupsFolded(); void paintAssets(); },
|
|
4968
|
+
onGroup: (id) => choose(`group:${id}`), noMatch: 'Nothing by that name.' });
|
|
4969
|
+
if (model.view === 'group') dragToGroups($('assets-rows'));
|
|
5016
4970
|
const detail = $('assets-detail');
|
|
5017
4971
|
/* The forms go back to where they wait before the detail is drawn again. */
|
|
5018
4972
|
for (const form of detail.querySelectorAll('.as-form, #gitview-remote-box')) $('assets-forms').append(form);
|
|
@@ -5020,9 +4974,9 @@
|
|
|
5020
4974
|
const back = () => { assetOpen = ''; assetsAdding = ''; remember(); void paintAssets(); };
|
|
5021
4975
|
if (assetsAdding) {
|
|
5022
4976
|
/* The New asset box: from the map's "+" of Assets, which kind first ("<" goes back to the map);
|
|
5023
|
-
from
|
|
5024
|
-
const out = assetsFromMap
|
|
5025
|
-
out.addEventListener('click', () => { if (!nav.close(assetsFromMap
|
|
4977
|
+
from "+ New" of the list, which kind first too ("<" Assets). */
|
|
4978
|
+
const out = assetsFromMap ? el('button', 'as-link', '‹ Access') : el('button', 'as-link as-back', '‹ Assets'); out.type = 'button';
|
|
4979
|
+
out.addEventListener('click', () => { if (!nav.close(assetsFromMap ? 'compose' : 'asset')) back(); });
|
|
5026
4980
|
const kind = assetsAdding === 'choose' ? '' : assetsAdding;
|
|
5027
4981
|
detail.append(out, newAssetBox({ kind, onKind: (k) => { assetsAdding = k; void paintAssets(); }, boxHost: { where: '', repaint: () => { void paintAssets(); }, close: back } }));
|
|
5028
4982
|
if (kind) focusFirst(detail);
|
|
@@ -5294,6 +5248,8 @@
|
|
|
5294
5248
|
: settings.sshKey ? `Push key: SSH key ${settings.sshKey}` : 'Push key: none · the clone\'s access, same server only';
|
|
5295
5249
|
}
|
|
5296
5250
|
$('assets-search').addEventListener('input', () => { assetsQuery = $('assets-search').value.trim(); void paintAssets(); });
|
|
5251
|
+
/* ONE "+ New" (06-11, assets step 2), in place of a "+" per kind: the New asset box, its kind chosen in it. */
|
|
5252
|
+
$('assets-new').addEventListener('click', () => { placeAssetStep(); assetsAdding = 'choose'; remoteEditing = false; $('assets-error').hidden = true; void paintAssets(); });
|
|
5297
5253
|
$('assets-close').addEventListener('click', () => leavePlace());
|
|
5298
5254
|
/* The Assets place, on one asset (`key`), its remote form open (`remote`). */
|
|
5299
5255
|
async function openAssetsPlace(key, { remote = false, push = true } = {}) {
|
|
@@ -6372,6 +6328,9 @@
|
|
|
6372
6328
|
for (const b of document.querySelectorAll('button.tip-btn')) b.setAttribute('aria-label', uiSaid('set-why', 'Why'));
|
|
6373
6329
|
const s = document.querySelector('#settings .settings-search'); if (s) s.placeholder = uiSaid('set-search', 'Search');
|
|
6374
6330
|
const p = document.querySelector('#panel .settings-search'); if (p) p.placeholder = uiSaid('set-search', 'Search');
|
|
6331
|
+
$('cassets-search').placeholder = uiSaid('set-search', 'Search');
|
|
6332
|
+
/* The lists of assets drawn before the words came: drawn again, the kit's words in the screen's language. */
|
|
6333
|
+
try { if (place === 'assets') void paintAssets(); if (assetsShown) void paintRoomAssets(); } catch { /* not drawn yet */ }
|
|
6375
6334
|
}
|
|
6376
6335
|
void readWords().then(saySettings).catch(() => {});
|
|
6377
6336
|
|
package/web/index.html
CHANGED
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
each opened on the right (a folder: its files). -->
|
|
106
106
|
<div id="cassets" class="sheet as-room" hidden>
|
|
107
107
|
<div class="as" id="cassets-as">
|
|
108
|
-
<div class="as-list"><div id="cassets-rows"></div></div>
|
|
108
|
+
<div class="as-list"><div class="as-tools"><input type="search" id="cassets-search" placeholder="Search" aria-label="Search its assets" spellcheck="false" autocomplete="off"><button type="button" id="cassets-attach" class="as-new"><span aria-hidden="true">+ </span><span data-said="set-na-attach">Attach</span></button></div><div id="cassets-rows"></div></div>
|
|
109
109
|
<div class="as-detail" id="cassets-detail"></div>
|
|
110
110
|
</div>
|
|
111
111
|
</div>
|
|
@@ -751,7 +751,7 @@
|
|
|
751
751
|
<div class="panel-top"><b>Assets</b><button type="button" id="assets-close" class="as-link place-back">‹ Conversations</button></div>
|
|
752
752
|
<p id="assets-error" class="error" role="alert" hidden></p>
|
|
753
753
|
<div class="as" id="assets-as">
|
|
754
|
-
<div class="as-list"><div class="as-
|
|
754
|
+
<div class="as-list"><div class="as-tools"><input type="search" id="assets-search" placeholder="Search assets" aria-label="Search assets" spellcheck="false" autocomplete="off"><button type="button" id="assets-new" class="as-new primary"><span aria-hidden="true">+ </span><span data-said="set-as-new">New</span></button></div><div class="as-view" id="assets-view"></div><div id="assets-rows"></div></div>
|
|
755
755
|
<div class="as-detail" id="assets-detail"></div>
|
|
756
756
|
</div>
|
|
757
757
|
<div id="assets-forms" hidden>
|
package/web/kit.js
CHANGED
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
* AssetCard ONE ASSET, three sizes like ConvCard (06-11, assets step 1): `row` (a list), `chip` (a pill:
|
|
24
24
|
* a folded group, the thread, a call waiting), `head` (atop its panel). On its right, who has
|
|
25
25
|
* it (Holders) or, seen from one holder, its right (RightsBadge).
|
|
26
|
+
* AssetList THE ONE LIST of assets (06-11, assets step 2): the Assets menu and a conversation's tab, only its
|
|
27
|
+
* scope changes; by type or by group; an empty type not shown; assetListModel places the rows.
|
|
26
28
|
* RIGHTS THE ONE TABLE of what an asset can be given at, by its kind and by who gets it (a
|
|
27
29
|
* conversation, a device); "none" first. RightsBadge reads a right, RightsPicker sets it.
|
|
28
30
|
*
|
|
@@ -527,6 +529,7 @@
|
|
|
527
529
|
live a live link (a connexion): its rights are a connexion's
|
|
528
530
|
sub its one line ('' : none) state a point when it asks for you (wait,
|
|
529
531
|
problem: expiring, failing); else none
|
|
532
|
+
tone its line's shade, when the page has one ('warn': soon; 'bad': past, failing)
|
|
530
533
|
count a number that waits for you (calls waiting)
|
|
531
534
|
holders [{ name, hue? }] who has it (Assets) right { level | value, holder? } its right,
|
|
532
535
|
seen from one holder (a conversation)
|
|
@@ -551,6 +554,7 @@
|
|
|
551
554
|
if (a.sub || a.state) {
|
|
552
555
|
const line = node('small', 'kit-asset-sub');
|
|
553
556
|
if (a.state) { line.append(StatusDot({ state: a.state, label: a.sub ?? '' })); line.dataset.state = stateOf(a.state); }
|
|
557
|
+
if (a.tone) line.dataset.tone = a.tone;
|
|
554
558
|
if (a.sub) line.append(node('span', '', a.sub));
|
|
555
559
|
main.append(line);
|
|
556
560
|
}
|
|
@@ -567,8 +571,99 @@
|
|
|
567
571
|
return root;
|
|
568
572
|
}
|
|
569
573
|
|
|
574
|
+
/* THE LIST OF ASSETS (06-11, assets step 2): ONE LIST in the Assets menu and in a conversation's Assets tab;
|
|
575
|
+
only its scope changes -- 'all' (every asset, who has each on its right) or 'conversation:<name>' (what it
|
|
576
|
+
was given, each with its right). Two views of the same rows: by type, or by the owner's groups (the menu
|
|
577
|
+
only). A type with nothing in it is not shown; a group is (a place to drag to), unless a search empties it.
|
|
578
|
+
|
|
579
|
+
assetListModel: the rows placed, no page needed (tested alone).
|
|
580
|
+
items [{ key, kind, name, … }] as AssetCard takes them groups [{ id, label, members: [key] }]
|
|
581
|
+
scope 'all' | 'conversation:x' by the view kept ('type' | 'group'), or
|
|
582
|
+
'': groups once one exists, else types
|
|
583
|
+
query a name searched (any case) folded group ids folded shut kinds [[kind, title]] in order
|
|
584
|
+
-> { view, canGroup, sections: [{ id, title, kind | group, items, holders, folded, drop, empty }], shown, total } */
|
|
585
|
+
const scopeOf = (scope) => (String(scope ?? 'all').startsWith('conversation:') ? 'conversation' : 'all');
|
|
586
|
+
function assetListModel({ items = [], groups = [], scope = 'all', by = '', query = '', folded = [], kinds = [] } = {}) {
|
|
587
|
+
const canGroup = scopeOf(scope) === 'all';
|
|
588
|
+
const view = canGroup && (by === 'group' || (by !== 'type' && groups.length > 0)) ? 'group' : 'type';
|
|
589
|
+
const q = String(query ?? '').trim().toLowerCase();
|
|
590
|
+
const shown = q ? items.filter((i) => String(i.name ?? '').toLowerCase().includes(q)) : [...items];
|
|
591
|
+
const sections = [];
|
|
592
|
+
if (view === 'type') {
|
|
593
|
+
const order = kinds.length ? kinds : [...new Set(shown.map((i) => i.kind))].map((k) => [k, k]);
|
|
594
|
+
const known = new Set(order.map(([k]) => k));
|
|
595
|
+
for (const [kind, title] of order) {
|
|
596
|
+
const mine = shown.filter((i) => i.kind === kind);
|
|
597
|
+
if (mine.length) sections.push({ id: `kind:${kind}`, kind, title, items: mine });
|
|
598
|
+
}
|
|
599
|
+
/* A kind the page did not name is never dropped: it comes last, under its own name. */
|
|
600
|
+
for (const kind of [...new Set(shown.map((i) => i.kind).filter((k) => !known.has(k)))]) sections.push({ id: `kind:${kind}`, kind, title: kind, items: shown.filter((i) => i.kind === kind) });
|
|
601
|
+
} else {
|
|
602
|
+
const byKey = new Map(shown.map((i) => [i.key, i]));
|
|
603
|
+
const shut = new Set(folded);
|
|
604
|
+
const grouped = new Set();
|
|
605
|
+
for (const g of groups) {
|
|
606
|
+
for (const k of g.members ?? []) grouped.add(k);
|
|
607
|
+
const mine = (g.members ?? []).map((k) => byKey.get(k)).filter(Boolean);
|
|
608
|
+
if (q && !mine.length) continue;
|
|
609
|
+
const seen = new Set(); const holders = [];
|
|
610
|
+
for (const h of mine.flatMap((i) => i.holders ?? [])) if (h?.name && !seen.has(h.name)) { seen.add(h.name); holders.push(h); }
|
|
611
|
+
sections.push({ id: `group:${g.id}`, group: g.id, title: g.label, items: mine, holders, folded: shut.has(g.id), drop: g.id, empty: mine.length ? '' : 'group' });
|
|
612
|
+
}
|
|
613
|
+
const loose = shown.filter((i) => !grouped.has(i.key));
|
|
614
|
+
/* The loose ones stay a place to drag to (out of a group) while there are groups, even emptied. */
|
|
615
|
+
if (loose.length || (!q && items.length)) sections.push({ id: 'group:', group: '', title: say('set-as-no-group', 'No group'), items: loose, drop: '', empty: loose.length ? '' : groups.length ? 'grouped' : 'nogroups' });
|
|
616
|
+
}
|
|
617
|
+
return { view, canGroup, sections, shown: shown.length, total: items.length };
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/* The list drawn from its model. A row is an AssetCard (`rowCls` added: the page's handle on it); `pinned`,
|
|
621
|
+
rows above every section (what waits: To send, Demandes). `onOpen(key)`; a group's head folds it
|
|
622
|
+
(`onFold(id)`), its ⚙ opens it (`onGroup(id)`). `empty`: said when there is nothing at all; `noMatch`,
|
|
623
|
+
when a search finds nothing. */
|
|
624
|
+
function AssetList(model, { chosen = '', onOpen = () => {}, onFold = () => {}, onGroup = () => {}, rowCls = '', pinned = [], empty = '', noMatch = '' } = {}) {
|
|
625
|
+
const box = node('div', 'kit-aslist'); box.dataset.view = model.view;
|
|
626
|
+
box.append(...pinned.filter(Boolean));
|
|
627
|
+
const hints = {
|
|
628
|
+
group: say('set-as-group-empty', 'Empty: drag an asset here'),
|
|
629
|
+
grouped: say('set-as-all-grouped', 'Every asset is in a group'),
|
|
630
|
+
nogroups: say('set-as-no-groups', 'Make a group, then drag an asset into it'),
|
|
631
|
+
};
|
|
632
|
+
for (const s of model.sections) {
|
|
633
|
+
const sec = node('section', `kit-aslist-sec${s.group !== undefined ? ' kit-aslist-group' : ''}`);
|
|
634
|
+
if (s.kind !== undefined) sec.dataset.kind = s.kind;
|
|
635
|
+
if (s.drop !== undefined) sec.dataset.drop = s.drop;
|
|
636
|
+
const head = node('div', 'kit-aslist-head');
|
|
637
|
+
if (s.group) {
|
|
638
|
+
if (s.folded) head.dataset.folded = 'true';
|
|
639
|
+
const toggle = node('button', 'kit-aslist-fold'); toggle.type = 'button';
|
|
640
|
+
if (`group:${s.group}` === chosen) toggle.setAttribute('aria-current', 'true');
|
|
641
|
+
toggle.setAttribute('aria-expanded', String(!s.folded));
|
|
642
|
+
toggle.title = s.folded ? say('set-as-unfold', 'Unfold') : say('set-as-fold', 'Fold');
|
|
643
|
+
toggle.append(node('span', 'kit-aslist-chev', s.folded ? '▸' : '▾'), node('h3', '', s.title), node('span', 'kit-aslist-n', String(s.items.length)));
|
|
644
|
+
toggle.addEventListener('click', () => onFold(s.group));
|
|
645
|
+
head.append(toggle);
|
|
646
|
+
if (s.holders?.length) head.append(Holders(s.holders));
|
|
647
|
+
const gear = node('button', 'kit-aslist-gear', '⚙'); gear.type = 'button';
|
|
648
|
+
gear.setAttribute('aria-label', say('set-as-group-open', 'Settings for {name}').replace('{name}', s.title));
|
|
649
|
+
gear.title = say('set-as-group-gear', 'Give, rename, remove');
|
|
650
|
+
gear.addEventListener('click', (e) => { e?.stopPropagation?.(); onGroup(s.group); });
|
|
651
|
+
head.append(gear);
|
|
652
|
+
} else head.append(node('h3', '', s.title));
|
|
653
|
+
sec.append(head);
|
|
654
|
+
if (!s.folded) {
|
|
655
|
+
for (const a of s.items) sec.append(AssetCard(a, { size: 'row', cls: rowCls, current: a.key === chosen, onOpen }));
|
|
656
|
+
if (s.empty) sec.append(node('p', 'hint kit-aslist-none', hints[s.empty] ?? ''));
|
|
657
|
+
}
|
|
658
|
+
box.append(sec);
|
|
659
|
+
}
|
|
660
|
+
if (!model.total && empty) box.append(node('p', 'hint kit-aslist-said', empty));
|
|
661
|
+
else if (model.total && !model.shown && noMatch) box.append(node('p', 'hint kit-aslist-said', noMatch));
|
|
662
|
+
return box;
|
|
663
|
+
}
|
|
664
|
+
|
|
570
665
|
window.clavariumKit = {
|
|
571
|
-
AssetIcon, AssetCard, Holders, RightsBadge, RightsPicker,
|
|
666
|
+
AssetIcon, AssetCard, Holders, RightsBadge, RightsPicker, AssetList, assetListModel,
|
|
572
667
|
ASSET_ICONS, ASSET_KINDS, RIGHTS, RIGHT_LEVELS, rightsKey, rightsFor, rightOf, storedOf, lightest, rightWord,
|
|
573
668
|
shareSlices, ShareDonut, ShareKey,
|
|
574
669
|
STATES, STATE_WORDS, stateOf, hueOf, initialOf,
|
package/web/style.css
CHANGED
|
@@ -1159,26 +1159,17 @@ header .ic, #folders .ic { width: 18px; height: 18px; fill: none; stroke: curren
|
|
|
1159
1159
|
.as-detail { padding: 16px 20px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
|
|
1160
1160
|
/* The detail scrolls as a whole: nothing in it is squeezed (a branch diagram cut, its buttons over it) when a folder's files open below. */
|
|
1161
1161
|
.as-detail > * { flex-shrink: 0; }
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
.as-
|
|
1165
|
-
.as-
|
|
1166
|
-
|
|
1167
|
-
.as-view
|
|
1168
|
-
.as-view
|
|
1169
|
-
|
|
1162
|
+
/* Above the list: its search and its one button (+ New in Assets, + Attach in a conversation). */
|
|
1163
|
+
.as-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
|
|
1164
|
+
.as-tools input[type="search"] { flex: 1 1 auto; min-width: 0; width: 100%; padding: 9px 12px; border-radius: 9px; }
|
|
1165
|
+
.as-tools .as-new { flex: none; white-space: nowrap; font-size: .8125rem; font-weight: 600; padding: 8px 12px; border-radius: 9px; }
|
|
1166
|
+
/* Groups / Types (kit Segmented), above the rows. */
|
|
1167
|
+
.as-view { display: flex; margin-bottom: 4px; }
|
|
1168
|
+
.as-view .kit-seg { width: 100%; }
|
|
1169
|
+
.as-view .kit-seg > button { flex: 1 1 0; font-size: .8125rem; padding: 7px 8px; }
|
|
1170
|
+
/* The by-group view: make-a-group bar, its inline editor. */
|
|
1170
1171
|
.as-group-new { display: flex; align-items: center; gap: 6px; margin: 2px 0 4px; }
|
|
1171
1172
|
.as-group-new .hint { color: var(--ink2); }
|
|
1172
|
-
.as-group-head { gap: 4px; }
|
|
1173
|
-
.as-chev { flex: 0 0 auto; width: 16px; text-align: center; color: var(--ink2); font-size: .75rem; }
|
|
1174
|
-
.as-group-name { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; justify-content: flex-start; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 3px 6px; }
|
|
1175
|
-
.as-group-name:hover { border-color: var(--line); }
|
|
1176
|
-
.as-group-name[aria-current="true"] { background: var(--panel); border-color: var(--line); }
|
|
1177
|
-
.as-gear { flex: 0 0 auto; width: 30px; height: 30px; min-width: 0 !important; min-height: 0 !important; padding: 0; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--ink2); font-size: 1rem; opacity: 1; }
|
|
1178
|
-
/* On a mouse, keep it quiet until the group is hovered or open; on touch (no
|
|
1179
|
-
hover) it must stay visible, or it can never be reached. */
|
|
1180
|
-
@media (hover: hover) { .as-gear { opacity: 0; } .as-group-head:hover .as-gear, .as-group-name[aria-current="true"] + .as-gear { opacity: 1; } }
|
|
1181
|
-
.as-gear:hover { border-color: var(--line); color: var(--ink); }
|
|
1182
1173
|
.as-group-members { display: flex; flex-direction: column; gap: 2px; }
|
|
1183
1174
|
/* Give the group: a block per conversation, a row per asset at its own level. */
|
|
1184
1175
|
.as-give { display: flex; flex-direction: column; gap: 12px; }
|
|
@@ -1207,10 +1198,7 @@ header .ic, #folders .ic { width: 18px; height: 18px; fill: none; stroke: curren
|
|
|
1207
1198
|
.as-group-of { display: flex; align-items: center; gap: 10px; }
|
|
1208
1199
|
.as-group-of-label { font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
|
|
1209
1200
|
.as-group-of select { padding: 6px 9px; border-radius: 8px; }
|
|
1210
|
-
.as-
|
|
1211
|
-
.as-kind-head, .as-chapter { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
1212
|
-
.as-kind-head h3 { margin: 0; padding: 4px 6px; font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
|
|
1213
|
-
.as-list-top h3 { text-transform: none; letter-spacing: 0; font-size: .8125rem; color: var(--ink); }
|
|
1201
|
+
.as-chapter { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
1214
1202
|
.as-add { width: 30px; height: 30px; min-height: 0 !important; min-width: 0 !important; padding: 0; border-radius: 50%; font-size: 1rem; line-height: 1; color: var(--brass-ink); background: transparent; flex: 0 0 auto; }
|
|
1215
1203
|
.as-add:hover { border-color: var(--brass); }
|
|
1216
1204
|
.as-none { padding: 2px 8px 6px; }
|
|
@@ -2168,7 +2156,7 @@ details.commit > pre { margin: 6px 0 0 1.6em; white-space: pre-wrap; overflow-wr
|
|
|
2168
2156
|
.as-signature { display: flex; flex-direction: column; gap: 6px; margin: .6rem 0; }
|
|
2169
2157
|
.as-signature textarea { width: 100%; font: inherit; }
|
|
2170
2158
|
.as-drag-ghost { position: fixed; z-index: 90; pointer-events: none; opacity: .9; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); border-radius: 10px; background: var(--panel); }
|
|
2171
|
-
.
|
|
2159
|
+
.kit-aslist-group.as-drop-over { outline: 2px dashed var(--brass); outline-offset: 2px; border-radius: 10px; background: color-mix(in srgb, var(--brass) 7%, transparent); }
|
|
2172
2160
|
body.as-dragging { user-select: none; -webkit-user-select: none; }
|
|
2173
2161
|
body.as-dragging #assets-rows .as-row { touch-action: none; }
|
|
2174
2162
|
/* A flash started from its button in the thread: Tether's module draws its steps here, over the page. */
|
|
@@ -2851,3 +2839,23 @@ button.kit-switch[aria-checked="true"]::after { left: 18px; background: var(--ok
|
|
|
2851
2839
|
/* An API key's configuration, shown with it once (06-11). */
|
|
2852
2840
|
.apikeys-config { margin: 6px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font: .8125rem/1.45 var(--mono, ui-monospace, monospace); white-space: pre; overflow-x: auto; max-width: 100%; }
|
|
2853
2841
|
.apikeys-curl code { word-break: break-all; font-size: .75rem; }
|
|
2842
|
+
|
|
2843
|
+
/* THE ONE LIST OF ASSETS (06-11, kit AssetList): a section per type or per group, an empty type not shown; a group's
|
|
2844
|
+
head folds it, says how many, who has its assets, its ⚙ opens it. Rows are AssetCards. */
|
|
2845
|
+
.kit-aslist { display: flex; flex-direction: column; gap: 2px; }
|
|
2846
|
+
.kit-aslist > .kit-asset-row { margin-bottom: 2px; }
|
|
2847
|
+
.kit-aslist-sec { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
|
|
2848
|
+
.kit-aslist-head { display: flex; align-items: center; gap: 6px; min-height: 30px; }
|
|
2849
|
+
.kit-aslist-head h3 { margin: 0; padding: 4px 6px; font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2850
|
+
.kit-aslist-fold { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; justify-content: flex-start; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 2px 4px; min-height: 0 !important; }
|
|
2851
|
+
.kit-aslist-fold:hover { border-color: var(--line); }
|
|
2852
|
+
.kit-aslist-fold[aria-current="true"] { background: var(--panel); border-color: var(--line); }
|
|
2853
|
+
.kit-aslist-chev { flex: none; width: 16px; text-align: center; color: var(--ink2); font-size: .75rem; }
|
|
2854
|
+
.kit-aslist-n { flex: none; font-size: .6875rem; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--button); color: var(--ink); }
|
|
2855
|
+
.kit-aslist-gear { flex: none; width: 30px; height: 30px; min-width: 0 !important; min-height: 0 !important; padding: 0; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--ink2); font-size: 1rem; }
|
|
2856
|
+
.kit-aslist-gear:hover { border-color: var(--line); color: var(--ink); }
|
|
2857
|
+
@media (hover: hover) { .kit-aslist-gear { opacity: 0; } .kit-aslist-head:hover .kit-aslist-gear, .kit-aslist-gear:focus-visible, .kit-aslist-fold[aria-current="true"] ~ .kit-aslist-gear { opacity: 1; } }
|
|
2858
|
+
.kit-aslist-none, .kit-aslist-said { margin: 2px 8px 4px; font-size: .8125rem; }
|
|
2859
|
+
/* A line that asks for you keeps its shade: soon (warn), past or failing (bad). */
|
|
2860
|
+
.kit-asset-sub[data-tone="warn"] > .state-dot { background: var(--warn); }
|
|
2861
|
+
.kit-asset-sub[data-tone="bad"] { color: var(--danger); }
|