heyquilt 0.3.165 → 0.3.167
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/RELEASES.md +10 -0
- package/package.json +1 -1
- package/src/api/audit.js +0 -1
- package/src/api/composio.js +1 -64
- package/src/api/memory-store.js +0 -7
- package/src/api/routes/connections.js +1 -78
- package/src/api/routes/workspaces.js +3 -43
- package/src/api/supabase-store.js +0 -11
- package/src/control.js +0 -21
- package/src/presence.js +1 -2
- package/src/server.js +1 -15
- package/src/ui/app.css +5 -744
- package/src/ui/app.js +22 -38
- package/src/ui/board.js +7 -17
- package/src/ui/connections.js +41 -235
- package/src/ui/feed.js +8 -23
- package/src/ui/files.js +22 -67
- package/src/ui/home.js +6 -95
- package/src/ui/loom-model.js +8 -11
- package/src/ui/loom.css +2 -183
- package/src/ui/loom.js +55 -132
- package/src/ui/session.js +75 -1065
- package/src/ui/signin.js +6 -4
- package/src/ui/workspaces.js +1 -2
- package/src/ui-server.js +4 -50
- package/src/dev-servers.js +0 -65
- package/src/ui/home-view.js +0 -170
- package/src/ui/palette.js +0 -75
- package/src/ui/people-view.js +0 -116
package/src/ui/loom.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// lane that touched the file; threads stitch lanes that worked on the same file.
|
|
4
4
|
// Lanes that don't fit fold into strips of knots (and a crowd column past that).
|
|
5
5
|
import { esc, clock, ago, avatar, colorFor, basename, I } from './common.js'
|
|
6
|
-
import { toolLabel } from './tool-logo.js'
|
|
6
|
+
import { toolLogo, toolLabel } from './tool-logo.js'
|
|
7
7
|
import { markdown, visiblePrompt } from './feed.js'
|
|
8
8
|
import { textHtml } from './chat.js'
|
|
9
9
|
import { stitchTime, mentionRoute } from './loom-model.js'
|
|
@@ -53,12 +53,7 @@ export const showsLoom = (el) => !!el?.querySelector(':scope > .loom')
|
|
|
53
53
|
* render again ('expand', 'refresh').
|
|
54
54
|
* Skips the DOM when nothing changed.
|
|
55
55
|
*/
|
|
56
|
-
|
|
57
|
-
const replying = new Map()
|
|
58
|
-
const replied = new Map()
|
|
59
|
-
const kb = (n) => n >= 1048576 ? `${(n / 1048576).toFixed(1)} MB` : `${Math.max(1, Math.round(n / 1024))} KB`
|
|
60
|
-
|
|
61
|
-
export function renderLoom (el, { build, prefs, me, names, meAgent, onAction, extra = {} }) {
|
|
56
|
+
export function renderLoom (el, { build, prefs, me, names, meAgent, onAction }) {
|
|
62
57
|
handlers = { onAction }
|
|
63
58
|
// Naming a conversation: don't redraw under the typing (it redraws once the name is in).
|
|
64
59
|
const typing = el.querySelector('.lh-conv-edit')
|
|
@@ -68,20 +63,14 @@ export function renderLoom (el, { build, prefs, me, names, meAgent, onAction, ex
|
|
|
68
63
|
const merged = prefs.layout === 'merged' || (el.clientWidth > 0 && el.clientWidth < MERGE_BELOW)
|
|
69
64
|
lastWidth = el.clientWidth
|
|
70
65
|
model = build(merged, Math.max(0, el.clientWidth - 14)) // less a scrollbar
|
|
71
|
-
const html = loomHtml(model, { prefs, me, names, meAgent, merged
|
|
66
|
+
const html = loomHtml(model, { prefs, me, names, meAgent, merged })
|
|
72
67
|
if (wasLoom && html === lastHtml) return
|
|
73
68
|
const scroller = el.querySelector('.loom-scroll')
|
|
74
69
|
const atBottom = !scroller || scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight < 80
|
|
75
70
|
const top = scroller ? scroller.scrollTop : 0
|
|
76
71
|
const left = scroller ? scroller.scrollLeft : 0
|
|
77
72
|
lastHtml = html
|
|
78
|
-
const typingIn = document.activeElement && document.activeElement.closest && document.activeElement.closest('.lb-qr') ? document.activeElement.closest('.lb-qr').dataset.qr : null
|
|
79
73
|
el.innerHTML = html
|
|
80
|
-
// A quick reply being written keeps its words (and the cursor) across redraws.
|
|
81
|
-
for (const [key, r] of replying) {
|
|
82
|
-
const ta = el.querySelector(`.lb-qr[data-qr="${CSS.escape(key)}"] [data-qr-text]`)
|
|
83
|
-
if (ta) { ta.value = r.text || ''; if (key === typingIn || r.focus) { r.focus = false; ta.focus(); ta.setSelectionRange(ta.value.length, ta.value.length) } }
|
|
84
|
-
}
|
|
85
74
|
phaseNeedles(el)
|
|
86
75
|
packConvs(el)
|
|
87
76
|
const edit = el.querySelector('.lh-conv-edit')
|
|
@@ -116,7 +105,7 @@ export function renderLoom (el, { build, prefs, me, names, meAgent, onAction, ex
|
|
|
116
105
|
|
|
117
106
|
// ------------------------------------------------------------- markup --
|
|
118
107
|
|
|
119
|
-
function loomHtml (m, { prefs, me, names, meAgent, merged
|
|
108
|
+
function loomHtml (m, { prefs, me, names, meAgent, merged }) {
|
|
120
109
|
const lanes = m.lanes
|
|
121
110
|
const has = (at) => at && lanes.some((l) => l.name === at.lane && l.convs.some((c) => c.conv === at.conv))
|
|
122
111
|
if (convFocus && !has(convFocus)) convFocus = null
|
|
@@ -154,7 +143,7 @@ function loomHtml (m, { prefs, me, names, meAgent, merged, extra = {} }) {
|
|
|
154
143
|
: `<div class="loom-heads" style="grid-template-columns:${cols}">${m.columns.map((c) => {
|
|
155
144
|
if (c.kind === 'crowd') return crowdHeadHtml(c.lanes.map((n) => byName.get(n)), colorOf)
|
|
156
145
|
const l = byName.get(c.lane)
|
|
157
|
-
return c.kind === 'strip' ? stripHeadHtml(l, colorOf.get(l.name)) : headHtml(l, colorOf.get(l.name)
|
|
146
|
+
return c.kind === 'strip' ? stripHeadHtml(l, colorOf.get(l.name)) : headHtml(l, colorOf.get(l.name))
|
|
158
147
|
}).join('')}</div>`
|
|
159
148
|
|
|
160
149
|
const parts = []
|
|
@@ -169,7 +158,7 @@ function loomHtml (m, { prefs, me, names, meAgent, merged, extra = {} }) {
|
|
|
169
158
|
} else {
|
|
170
159
|
parts.push(`<div class="loom-thread merged" style="grid-column:1;grid-row:1 / ${m.rows + 2}" aria-hidden="true"></div>`)
|
|
171
160
|
}
|
|
172
|
-
for (const it of m.items) if (!it.folded) parts.push(itemHtml(it, { colorOf, me, names, meAgent, merged, dens
|
|
161
|
+
for (const it of m.items) if (!it.folded) parts.push(itemHtml(it, { colorOf, me, names, meAgent, merged, dens }))
|
|
173
162
|
for (const k of m.knots) parts.push(knotHtml(k, m, colorOf, me))
|
|
174
163
|
if (!m.items.some((it) => it.lane)) {
|
|
175
164
|
parts.push(`<div class="loom-empty" style="grid-column:1 / -1;grid-row:1">
|
|
@@ -208,23 +197,24 @@ function loomHtml (m, { prefs, me, names, meAgent, merged, extra = {} }) {
|
|
|
208
197
|
</div>`
|
|
209
198
|
}
|
|
210
199
|
|
|
211
|
-
function headHtml (l, color
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<span class="lh-
|
|
226
|
-
${
|
|
227
|
-
<
|
|
200
|
+
function headHtml (l, color) {
|
|
201
|
+
const status = !l.sharing ? '<span class="lh-st paused">paused</span>'
|
|
202
|
+
: l.working ? '<span class="lh-st live"><span class="pulse"></span><span class="lh-word">working</span></span>'
|
|
203
|
+
: l.online ? '<span class="lh-st"><span class="lh-word">idle</span></span>' : '<span class="lh-st off">offline</span>'
|
|
204
|
+
const holds = l.holds.length
|
|
205
|
+
? `<button type="button" class="lh-holds" data-loom-holds="${esc(l.name)}" title="${esc(`Holds ${l.holds.join(', ')}. Click for how long, why and who waits`)}">holds ${l.holds.length}${l.waiting ? ` · ${l.waiting} waiting` : ''}</button>`
|
|
206
|
+
: ''
|
|
207
|
+
return `<div class="loom-head" style="--c:${esc(color)}">
|
|
208
|
+
<button class="lh-who" data-loom-person="${esc(l.name)}" title="${esc(l.isMe ? 'Your AI chat' : `${l.name}'s AI chat`)}">
|
|
209
|
+
${avatar(l.name, l.color, l.online)}
|
|
210
|
+
<span class="lh-name">${esc(l.isMe ? 'You' : l.name)}</span>
|
|
211
|
+
${l.tool ? `<span class="lh-tool" title="${esc(toolLabel(l.tool))}">${toolLogo(l.tool)}</span>` : ''}
|
|
212
|
+
${l.kind === 'agent' ? '<span class="tag">AI</span>' : ''}
|
|
213
|
+
</button>
|
|
214
|
+
<span class="lh-meta">${status}${sinceHtml(l)}${holds}</span>
|
|
215
|
+
<button class="lh-pin${l.pinned ? ' on' : ''}" data-loom-pin="${esc(l.name)}" title="${l.pinned ? 'Unpin: let this lane fold when there\'s no room' : 'Pin: keep this lane open'}" aria-pressed="${l.pinned}" aria-label="${esc(`${l.pinned ? 'Unpin' : 'Pin'} ${l.name}'s lane`)}">${PIN}</button>
|
|
216
|
+
<button class="lh-hide" data-loom-hide="${esc(l.name)}" title="Hide this lane" aria-label="Hide ${esc(l.name)}'s lane">${I.x}</button>
|
|
217
|
+
${convsHtml(l)}
|
|
228
218
|
</div>`
|
|
229
219
|
}
|
|
230
220
|
|
|
@@ -324,10 +314,10 @@ function place (it, merged) {
|
|
|
324
314
|
// A turn sits by its latest activity (loom-model.js), so its time says when it started, and that it's still going.
|
|
325
315
|
function turnTime (it) {
|
|
326
316
|
const end = it.end && it.end !== it.ts ? `, last ${new Date(it.end).toLocaleString()}` : ''
|
|
327
|
-
return `<time title="${esc(`Started ${new Date(it.ts).toLocaleString()}${end}${it.live ? ' · still going' : ''}
|
|
317
|
+
return `<time title="${esc(`Started ${new Date(it.ts).toLocaleString()}${end}`)}">${esc(clock(it.ts))}${it.live ? '<span class="lc-going"> · still going</span>' : ''}</time>`
|
|
328
318
|
}
|
|
329
319
|
|
|
330
|
-
function itemHtml (it, { colorOf, me, names, meAgent, merged, dens
|
|
320
|
+
function itemHtml (it, { colorOf, me, names, meAgent, merged, dens }) {
|
|
331
321
|
if (it.type === 'gap' || it.type === 'day') {
|
|
332
322
|
const label = it.type === 'day'
|
|
333
323
|
? new Date(it.ts).toLocaleDateString([], { weekday: 'long', month: 'short', day: 'numeric' })
|
|
@@ -346,31 +336,17 @@ function itemHtml (it, { colorOf, me, names, meAgent, merged, dens, extra = {} }
|
|
|
346
336
|
return `<div class="lc-mark${fresh}" data-id="${it.id}" style="${style}">${who}<span>${it.type === 'paused' ? 'Paused sharing' : 'Resumed sharing'}</span>${time}</div>`
|
|
347
337
|
}
|
|
348
338
|
if (it.type === 'chat') {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
const face = relay ? `<span class="lb-relay">${I.globe}</span>` : avatar(by, color)
|
|
356
|
-
const unread = toMe && extra.seenAt && (it.ts || 0) > extra.seenAt(by)
|
|
357
|
-
const qr = toMe ? replying.get(it.key) : null
|
|
358
|
-
const sent = toMe ? replied.get(it.key) : null
|
|
359
|
-
return `<div class="loom-band${toMe ? ' tome' : ''}${unread ? ' unread' : ''}${relay ? ' relay' : ''}${fresh}" data-id="${it.id}" data-key="${esc(it.key)}" style="grid-column:1 / -1;grid-row:${it.row};--c:${esc(color)}"${toMe ? ` data-band-dm="${esc(by)}"` : ''}>
|
|
360
|
-
${face}<b>${esc(relay ? 'Quilt' : mine ? 'You' : by)}</b>${to ? `<span class="lb-to${toMe ? ' tome' : ''}">${esc(to)}</span>` : ''}
|
|
361
|
-
<span class="lb-text">${it.text ? textHtml(it.text, names, me, { meAgent }) : ''}${it.file ? `<span class="lc-file plain">${I.clip}${esc(it.file)}</span>` : ''}</span>
|
|
362
|
-
${toMe && !qr ? `<button type="button" class="lb-reply" data-band-reply="${esc(by)}" data-band-key="${esc(it.key)}">Reply</button>` : ''}
|
|
363
|
-
<time title="${esc(new Date(it.ts).toLocaleString())}">${esc(clock(it.ts))}</time>
|
|
364
|
-
${it.approval && extra.approval ? extra.approval(it) : ''}
|
|
365
|
-
${sent ? `<div class="lb-sent">↳ <b>You</b> <span>${esc(sent.text)}</span>${sent.files.length ? `<em>${sent.files.map((n) => `<span class="lb-qr-file">${I.clip}${esc(n)}</span>`).join('')}</em>` : ''}<i>· sent to ${esc(by)} directly</i></div>` : ''}
|
|
366
|
-
${qr ? `<form class="lb-qr" data-qr="${esc(it.key)}">${qr.files.length ? `<div class="lb-qr-files">${qr.files.map((f, i) => `<span class="lb-qr-file">${I.clip}<b>${esc(f.name)}</b><i>${esc(f.wsFile ? 'from Files' : kb(f.size))}</i><button type="button" data-qr-unfile="${i}" aria-label="${esc(`Remove ${f.name}`)}">${I.x}</button></span>`).join('')}</div>` : ''}
|
|
367
|
-
<div class="lb-qr-row"><button type="button" class="lb-qr-att" data-qr-attach title="Attach a file" aria-label="Attach a file">${I.clip}</button><input data-qr-text placeholder="${esc(`Reply to ${by} directly, or drop a file…`)}" aria-label="${esc(`Reply to ${by}`)}" autocomplete="off"><button type="submit" class="btn primary" data-qr-send>Send</button><input type="file" multiple hidden data-qr-file></div></form>` : ''}
|
|
368
|
-
</div>`
|
|
339
|
+
const to = it.to ? `<span class="lc-dm">to ${esc(it.to === me ? 'you' : it.to)}</span>` : ''
|
|
340
|
+
return `<article class="lc lc-chat${fresh}" data-id="${it.id}" tabindex="0" style="${style}" aria-label="${esc(`${it.lane} in chat`)}">
|
|
341
|
+
<header class="lc-head">${who}<span class="lc-kind">${I.chat}</span><span class="lc-label">${it.to ? 'Direct message' : 'Chat'}</span>${to}${time}</header>
|
|
342
|
+
${it.text ? `<div class="lc-text">${textHtml(it.text, names, me, { meAgent })}</div>` : ''}
|
|
343
|
+
${it.file ? `<div class="lc-files"><span class="lc-file plain">${I.clip}${esc(it.file)}</span></div>` : ''}
|
|
344
|
+
</article>`
|
|
369
345
|
}
|
|
370
346
|
if (it.type === 'task' || it.type === 'note') {
|
|
371
347
|
const col = `<span class="lc-col c-${esc(it.task.column)}">${esc(COLUMN[it.task.column] || it.task.column)}</span>`
|
|
372
348
|
return `<article class="lc lc-task${fresh}" data-id="${it.id}" tabindex="0" style="${style}" aria-label="${esc(it.type === 'task' ? `${it.lane} added a task` : `${it.lane} left a note on a task`)}">
|
|
373
|
-
<header class="lc-head">${who}<span class="lc-
|
|
349
|
+
<header class="lc-head">${who}<span class="lc-kind">${I.board}</span><span class="lc-label">${it.type === 'task' ? 'Added a task' : 'Note on a task'}</span>${time}</header>
|
|
374
350
|
<button class="lc-tasklink" data-loom-task="${esc(it.task.id)}" title="Open the task board">${esc(it.task.title)}</button>${col}
|
|
375
351
|
${it.type === 'note' ? `<div class="lc-text">${esc(it.text)}</div>` : ''}
|
|
376
352
|
</article>`
|
|
@@ -383,26 +359,21 @@ function itemHtml (it, { colorOf, me, names, meAgent, merged, dens, extra = {} }
|
|
|
383
359
|
const done = (it.tasks || []).some((t) => t.column === 'done')
|
|
384
360
|
const files = open ? it.edits : it.edits.slice(0, FILES_SHOWN)
|
|
385
361
|
const more = it.edits.length - files.length
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
it.
|
|
390
|
-
|
|
391
|
-
it.runs ? `ran ${it.runs} command${it.runs === 1 ? '' : 's'}` : ''
|
|
392
|
-
].filter(Boolean).join(' · ')
|
|
393
|
-
const label = `${it.lane === me ? 'Your' : `${it.lane}’s`} ${toolLabel(it.tool)}`
|
|
362
|
+
const counts = [
|
|
363
|
+
it.edits.length ? `${it.edits.length} file${it.edits.length === 1 ? '' : 's'} changed` : '',
|
|
364
|
+
it.reads ? `${it.reads} read` : '',
|
|
365
|
+
it.runs ? `${it.runs} command${it.runs === 1 ? '' : 's'}` : ''
|
|
366
|
+
].filter(Boolean)
|
|
394
367
|
const tasks = (it.tasks || []).map((t) => `<button class="lc-taskchip c-${esc(t.column)}" data-loom-task="${esc(t.id)}" title="${esc(`${COLUMN[t.column] || t.column}: ${t.title}`)}">${I.board}<span>${esc(t.title)}</span></button>`).join('')
|
|
395
368
|
const summary = it.summary || (reply && reply.summary) ? '<span class="tag summary" title="Summarized before sharing">summary</span>' : ''
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
369
|
+
return `<article class="lc lc-turn${open ? ' open' : ''}${done ? ' hemmed' : ''}${fresh}" data-id="${it.id}" data-key="${esc(it.key)}" data-lane="${esc(it.lane)}" data-conv="${esc(it.conv)}" tabindex="0" style="${style}" aria-expanded="${open}" aria-label="${esc(`${it.lane}'s AI: ${prompt.slice(0, 80) || 'a turn'}`)}">
|
|
370
|
+
<header class="lc-head">${who}<span class="lc-tool" title="${esc(toolLabel(it.tool))}">${toolLogo(it.tool)}</span>
|
|
371
|
+
${convChip(it)}${summary}${turnTime(it)}</header>
|
|
399
372
|
${prompt ? `<div class="lc-prompt">${esc(prompt)}</div>` : ''}
|
|
400
|
-
${
|
|
401
|
-
${reply && (dens === 'detailed' || !prompt) && !open ? `<div class="lc-reply">${esc(plain(reply.text))}</div>` : ''}
|
|
373
|
+
${reply && dens === 'detailed' && !open ? `<div class="lc-reply">${esc(plain(reply.text))}</div>` : ''}
|
|
402
374
|
${open ? `<div class="lc-replies">${it.replies.map((r) => `<div class="md">${markdown(r.text)}</div>`).join('')}</div>` : ''}
|
|
403
|
-
${files.length ? `<div class="lc-files">${files.map((p) => `<button class="lc-file" data-file="${esc(p)}">${esc(basename(p))}</button>`).join('')}${more > 0 ? `<span class="lc-more">+${more}</span>` : ''}</div>` : ''}
|
|
404
|
-
${tasks ? `<div class="lc-meta">${tasks}</div>` : ''}
|
|
405
|
-
${it.live ? '<div class="lc-live"><span class="pulse"></span>still going</div>' : ''}
|
|
375
|
+
${files.length && (dens === 'detailed' || open) ? `<div class="lc-files">${files.map((p) => `<button class="lc-file" data-file="${esc(p)}">${esc(basename(p))}</button>`).join('')}${more > 0 ? `<span class="lc-more">+${more}</span>` : ''}</div>` : ''}
|
|
376
|
+
${counts.length || tasks ? `<div class="lc-meta">${counts.length ? `<span>${esc(counts.join(' · '))}</span>` : ''}${tasks}</div>` : ''}
|
|
406
377
|
${open && it.actions.length ? `<ol class="lc-actions">${it.actions.map((a) => `<li>${esc(a)}</li>`).join('')}</ol>` : ''}
|
|
407
378
|
${open ? `<div class="lc-foot"><button class="btn sm" data-loom-conv="${esc(it.lane)}" data-loom-convid="${esc(it.conv)}">Open the whole conversation${I.arrowRight}</button></div>` : ''}
|
|
408
379
|
</article>`
|
|
@@ -410,6 +381,16 @@ function itemHtml (it, { colorOf, me, names, meAgent, merged, dens, extra = {} }
|
|
|
410
381
|
|
|
411
382
|
const COLUMN = { todo: 'To do', doing: 'In progress', qa: 'QA', done: 'Done' }
|
|
412
383
|
|
|
384
|
+
/**
|
|
385
|
+
* A turn's conversation on its card. In a lane with several, it carries the conversation's mark
|
|
386
|
+
* and following it is a click away (opening it stays in the open card); with one, it opens it.
|
|
387
|
+
*/
|
|
388
|
+
function convChip (it) {
|
|
389
|
+
if (it.convSlot == null) return `<button class="lc-conv" data-loom-conv="${esc(it.lane)}" data-loom-convid="${esc(it.conv)}" title="Open this conversation">${esc(it.convLabel || toolLabel(it.tool))}</button>`
|
|
390
|
+
const on = !!convFocus && convFocus.lane === it.lane && convFocus.conv === it.conv
|
|
391
|
+
return `<button class="lc-conv marked" data-loom-follow data-lane="${esc(it.lane)}" data-conv="${esc(it.conv)}" aria-pressed="${on}" title="${esc(`${it.convLabel}: click to ${on ? 'see every conversation' : 'follow just this conversation'}`)}">${CONV_MARKS[it.convSlot]}<span>${esc(it.convLabel)}</span></button>`
|
|
392
|
+
}
|
|
393
|
+
|
|
413
394
|
/** Markdown as one plain line of text, for a card's preview of a reply. */
|
|
414
395
|
function plain (text) {
|
|
415
396
|
return String(text || '')
|
|
@@ -439,9 +420,6 @@ const convMark = (slot, working) => {
|
|
|
439
420
|
return `<svg class="cm${working ? ' cm-live' : ''}" viewBox="0 0 57 57" aria-hidden="true">${PIECES.map(([x, y], i) => `<rect class="cm-p${on(i)}" x="${x}" y="${y}" width="${p}" height="${p}" rx="${r}" />`).join('')}<path class="cm-p${on(7)}" d="${CORNER.ink}" /><path class="cm-a${on(7)}" d="${CORNER.accent}" />${run}</svg>`
|
|
440
421
|
}
|
|
441
422
|
const CONV_MARKS = Array.from({ length: 8 }, (_, slot) => convMark(slot, false))
|
|
442
|
-
// A thread's cube on a lane card (dm06): the Q as three by three squares in the lane's colour, the
|
|
443
|
-
// eighth left out and the corner vermilion. A thread working now pulses; a quiet one is faded.
|
|
444
|
-
const GRID9 = `${'<i class="on"></i>'.repeat(7)}<i></i><i class="cnr"></i>`
|
|
445
423
|
const CONV_MARKS_LIVE = Array.from({ length: 8 }, (_, slot) => convMark(slot, true))
|
|
446
424
|
|
|
447
425
|
// A working AI's needle: it pieces patches on its lane's thread and sews them into the Q, slot by slot,
|
|
@@ -672,48 +650,6 @@ function showTip (root, anchor, html) {
|
|
|
672
650
|
|
|
673
651
|
function bind (el) {
|
|
674
652
|
const root = el.querySelector('.loom')
|
|
675
|
-
// A quick reply in a band to you: its words kept as typed, files added, Enter or Send sends it to them.
|
|
676
|
-
root.addEventListener('input', (e) => {
|
|
677
|
-
const f = e.target.closest('.lb-qr')
|
|
678
|
-
if (f && e.target.matches('[data-qr-text]')) { const r = replying.get(f.dataset.qr); if (r) r.text = e.target.value }
|
|
679
|
-
})
|
|
680
|
-
root.addEventListener('change', (e) => {
|
|
681
|
-
if (!e.target.matches('[data-qr-file]')) return
|
|
682
|
-
const r = replying.get(e.target.closest('.lb-qr').dataset.qr)
|
|
683
|
-
if (r) { r.files.push(...e.target.files); handlers.onAction('refresh') }
|
|
684
|
-
})
|
|
685
|
-
// Files dropped on a quick reply go with it.
|
|
686
|
-
root.addEventListener('dragover', (e) => { const f = e.target.closest('.lb-qr'); root.querySelectorAll('.lb-qr.drop').forEach((x) => x !== f && x.classList.remove('drop')); if (f) { e.preventDefault(); f.classList.add('drop') } })
|
|
687
|
-
root.addEventListener('dragleave', (e) => { const f = e.target.closest('.lb-qr'); if (f && !f.contains(e.relatedTarget)) f.classList.remove('drop') })
|
|
688
|
-
root.addEventListener('drop', (e) => {
|
|
689
|
-
const f = e.target.closest('.lb-qr')
|
|
690
|
-
if (!f) return
|
|
691
|
-
e.preventDefault()
|
|
692
|
-
f.classList.remove('drop')
|
|
693
|
-
const r = replying.get(f.dataset.qr)
|
|
694
|
-
if (r && e.dataTransfer.files.length) { r.files.push(...e.dataTransfer.files); handlers.onAction('refresh') }
|
|
695
|
-
})
|
|
696
|
-
root.addEventListener('keydown', (e) => {
|
|
697
|
-
if (e.key === 'Escape' && e.target.closest('.lb-qr')) { replying.delete(e.target.closest('.lb-qr').dataset.qr); handlers.onAction('refresh') }
|
|
698
|
-
})
|
|
699
|
-
root.addEventListener('submit', async (e) => {
|
|
700
|
-
const f = e.target.closest('.lb-qr')
|
|
701
|
-
if (!f) return
|
|
702
|
-
e.preventDefault()
|
|
703
|
-
const key = f.dataset.qr
|
|
704
|
-
const r = replying.get(key)
|
|
705
|
-
if (!r) return
|
|
706
|
-
r.text = f.querySelector('[data-qr-text]').value.trim()
|
|
707
|
-
if (!r.text && !r.files.length) return
|
|
708
|
-
const btn = f.querySelector('[data-qr-send]')
|
|
709
|
-
btn.disabled = true
|
|
710
|
-
try {
|
|
711
|
-
await handlers.onAction('reply', { to: r.to, text: r.text, files: r.files })
|
|
712
|
-
replied.set(key, { text: r.text, files: r.files.map((x) => x.name) })
|
|
713
|
-
replying.delete(key)
|
|
714
|
-
handlers.onAction('refresh')
|
|
715
|
-
} catch { btn.disabled = false }
|
|
716
|
-
})
|
|
717
653
|
const s = root.querySelector('.loom-scroll')
|
|
718
654
|
const jump = root.querySelector('.loom-jump')
|
|
719
655
|
// Scrolled up a way (or anything new came in below): a button back down to the latest.
|
|
@@ -755,20 +691,7 @@ function bind (el) {
|
|
|
755
691
|
if ((b = pick('[data-loom-open]'))) { crowdOpen = false; return act('open-lane', b.dataset.loomOpen) }
|
|
756
692
|
if ((b = pick('[data-loom-pin]'))) return act('pin', b.dataset.loomPin)
|
|
757
693
|
if ((b = pick('[data-loom-holds]'))) return act('holds', { name: b.dataset.loomHolds, anchor: b })
|
|
758
|
-
|
|
759
|
-
if ((b = pick('[data-loom-dm]'))) return act('dm', b.dataset.loomDm)
|
|
760
|
-
if ((b = pick('.lh-card [data-loom-conv]'))) return act('conv', { name: b.dataset.loomConv, conv: b.dataset.loomConvid, from: b.closest('.lh-card') })
|
|
761
|
-
if (pick('.lb-qr')) {
|
|
762
|
-
const f = pick('.lb-qr')
|
|
763
|
-
const r = replying.get(f.dataset.qr)
|
|
764
|
-
if ((b = pick('[data-qr-attach]')) && r) { act('attach', { anchor: b, upload: () => f.querySelector('[data-qr-file]').click(), add: (x) => { r.files.push(x); act('refresh') } }); return }
|
|
765
|
-
if ((b = pick('[data-qr-unfile]')) && r) { r.files.splice(Number(b.dataset.qrUnfile), 1); return act('refresh') }
|
|
766
|
-
return
|
|
767
|
-
}
|
|
768
|
-
// Reply opens a quick reply in the band; anywhere else on a band to you opens your thread with them.
|
|
769
|
-
if ((b = pick('[data-band-reply]'))) { replying.set(b.dataset.bandKey, { to: b.dataset.bandReply, text: '', files: [], focus: true }); return act('refresh') }
|
|
770
|
-
if ((b = pick('[data-band-dm]'))) return act('dm', b.dataset.bandDm)
|
|
771
|
-
if ((b = pick('[data-loom-person]'))) return act('person', b.dataset.loomPerson, b)
|
|
694
|
+
if ((b = pick('[data-loom-person]'))) return act('person', b.dataset.loomPerson)
|
|
772
695
|
if ((b = pick('[data-loom-follow]'))) {
|
|
773
696
|
const same = convFocus && convFocus.lane === b.dataset.lane && convFocus.conv === b.dataset.conv
|
|
774
697
|
convFocus = same ? null : { lane: b.dataset.lane, conv: b.dataset.conv }
|