heyquilt 0.3.152 → 0.3.155

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/src/ui/loom.css CHANGED
@@ -210,8 +210,8 @@
210
210
  .lc-foot .btn svg { width: 14px; height: 14px; }
211
211
  .lc-mark { position: relative; z-index: 2; justify-self: center; display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--warn); background: var(--bg); border: 1px dashed var(--warn); border-radius: 999px; padding: 1px 10px; }
212
212
 
213
- .loom[data-density="compact"] .lc { padding: 5px 9px 6px; }
214
- .loom[data-density="compact"] .lc-prompt, .loom[data-density="compact"] .lc-text { -webkit-line-clamp: 1; }
213
+ /* Compact is the dm06 card: the same box, its reply left out. */
214
+ .loom[data-density="compact"] .lc-text { -webkit-line-clamp: 2; }
215
215
  .loom[data-density="compact"] .lc.open .lc-prompt { -webkit-line-clamp: unset; }
216
216
  .loom[data-density="compact"] .lc-meta { margin-top: 3px; }
217
217
 
@@ -378,3 +378,183 @@
378
378
  .loom.tracing .lc.traced { box-shadow: 0 0 0 2px color-mix(in srgb, var(--k) 55%, transparent), var(--card-hover); }
379
379
  .loom.focusing .lc.lit { box-shadow: 0 0 0 2px var(--k), var(--card-hover); }
380
380
  }
381
+
382
+ /* The dm06 loom (session.js Chat tab): no bar, short lane cards, chat as bands across the lanes */
383
+ .loom-chat .loom-bar { display: none; }
384
+ .loom-heads { padding-top: 12px; padding-bottom: 12px; background: color-mix(in srgb, var(--bg) 94%, transparent); }
385
+ .loom-head.lh-card { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; column-gap: 8px; row-gap: 2px; padding: 8px 10px 7px; border-radius: 9px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--border), inset 0 3px 0 var(--c); cursor: pointer; }
386
+ .loom-head.lh-card:hover { box-shadow: inset 0 0 0 1px var(--border-strong), inset 0 3px 0 var(--c); }
387
+ .lh-card > .avatar { grid-row: 1 / 3; width: 26px; height: 26px; font-size: 11px; }
388
+ .lh-card .lh-name { grid-column: 2; grid-row: 1; font-size: 13px; font-weight: 600; white-space: nowrap; }
389
+ .lh-card .lh-tool { grid-column: 3; grid-row: 1; min-width: 0; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
390
+ .lh-card .lh-cubes { grid-column: 4; grid-row: 1; display: inline-flex; align-items: center; gap: 4px; justify-self: end; }
391
+ .lh-card .lh-cubes:empty { display: none; }
392
+ .lh-cube { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: color-mix(in srgb, var(--c) 10%, var(--panel)); cursor: pointer; }
393
+ .lh-cube .cm { width: 13px; height: 13px; }
394
+ .lh-card .lh-more { display: inline-grid; place-items: center; height: 20px; min-width: 22px; padding: 0 5px; border-radius: 6px; background: var(--panel-2); color: var(--muted); font: 600 11px var(--sans); }
395
+ .lh-dm { grid-column: 5; grid-row: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 22px; min-width: 24px; padding: 0 6px; border: 0; border-radius: 999px; background: var(--panel); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); cursor: pointer; font: 700 11px var(--sans); }
396
+ .lh-dm svg { width: 12px; height: 12px; } .lh-dm:hover { color: var(--text); }
397
+ .lh-dm.unread { background: var(--accent); color: var(--on-accent, #fff); box-shadow: none; }
398
+ .lh-card .lh-doing { grid-column: 2 / -1; grid-row: 2; display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
399
+ .lh-card .lh-doing.live { color: color-mix(in srgb, var(--c) 70%, var(--text)); font-weight: 600; }
400
+
401
+ .loom-band { position: relative; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-height: 40px; padding: 6px 14px 6px 8px; border-radius: 20px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.05); font-size: 13.5px; }
402
+ .loom-band > .avatar, .loom-band .lb-relay { width: 26px; height: 26px; font-size: 11px; flex: none; }
403
+ .loom-band .lb-relay { display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); color: var(--muted); } .loom-band .lb-relay svg { width: 14px; height: 14px; }
404
+ .loom-band > b { font-weight: 600; flex: none; }
405
+ .lb-to { flex: none; font-size: 11.5px; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 2px 8px; }
406
+ .lb-to.tome { background: var(--accent); color: var(--on-accent, #fff); font-weight: 600; }
407
+ .lb-text { flex: 1; min-width: 0; color: var(--text); overflow-wrap: anywhere; }
408
+ .lb-text p { margin: 0; display: inline; }
409
+ .loom-band time { flex: none; font-size: 12px; color: var(--faint); }
410
+ .loom-band.tome { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); cursor: pointer; }
411
+ .lb-reply { flex: none; height: 26px; padding: 0 12px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: 999px; background: var(--panel); color: var(--accent); font: 600 12px var(--sans); cursor: pointer; }
412
+ .loom-band .app-approval { flex: 1 0 100%; margin: 4px 0 2px 36px; }
413
+
414
+ /* The Chat tab: the loom fills the main area and the composer sits under it (the chat pane, without its list) */
415
+ .ws-body.chat-in-main.loom-chat .ws-main > #main { display: flex; flex-direction: column; flex: 1; min-height: 0; }
416
+ .ws-body.loom-chat .ws-main > .ws-chat { flex: none; }
417
+ .ws-body.loom-chat .ws-chat > .work-strip, .ws-body.loom-chat .ws-chat > .chat-head, .ws-body.loom-chat .ws-chat > .messages { display: none; }
418
+ /* The composer's "To": a chip (dm06), tinted for a direct message */
419
+ .ws-body.loom-chat .composer .to select { height: 26px; padding: 0 26px 0 11px; border: 0; border-radius: 999px; background-color: var(--panel-2); color: var(--text); font: 600 12.5px var(--sans); appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 13px) 11px, calc(100% - 9px) 11px; background-size: 4px 4px; background-repeat: no-repeat; cursor: pointer; }
420
+ .ws-body.loom-chat .composer .to select:has(option:checked:not([value=""])) { background-color: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); }
421
+ /* A person's view (feed.js head): back, who, their threads, their direct messages */
422
+ .pv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; padding: 10px 24px; border-bottom: 1px solid var(--border); background: var(--bg); box-shadow: inset 0 3px 0 var(--c, transparent); flex: none; }
423
+ .pv-back { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--muted); cursor: pointer; flex: none; }
424
+ .pv-back:hover { color: var(--text); border-color: var(--border-strong); } .pv-back svg { width: 15px; height: 15px; }
425
+ .pv-head > .avatar { width: 32px; height: 32px; font-size: 13px; flex: none; }
426
+ .pv-who { display: flex; flex-direction: column; min-width: 0; } .pv-who b { font-size: 15px; font-weight: 600; } .pv-who small { font-size: 12px; color: var(--muted); }
427
+ .pv-head .feed-convs { margin: 0 0 0 8px; padding: 0; border: 0; background: none; flex-wrap: wrap; }
428
+ .pv-sp { flex: 1; }
429
+ .pv-dm { display: inline-flex; align-items: center; gap: 6px; } .pv-dm svg { width: 14px; height: 14px; }
430
+ /* In the loom and a person's view, the back arrow does what the old tab row did */
431
+ .ws-body.loom-chat #mainbar { display: none; }
432
+ /* The morph into a person's view (session.js morphToPerson), and the cards rising back */
433
+ .loom.falling .loom-head, .loom.falling .lc, .loom.falling .loom-band, .loom.falling .loom-needle, .loom.falling .loom-thread { animation: loom-fall .28s cubic-bezier(.55, 0, .8, .3) var(--d, 0s) forwards; }
434
+ @keyframes loom-fall { to { transform: translateY(70px) rotate(var(--r, 0deg)); opacity: 0; } }
435
+ .pv-morph { pointer-events: none; transition: left .46s cubic-bezier(.45, .05, .2, 1), top .46s cubic-bezier(.45, .05, .2, 1), width .46s cubic-bezier(.45, .05, .2, 1), height .46s cubic-bezier(.45, .05, .2, 1), border-radius .46s; }
436
+ .pv-morph .lh-doing, .pv-morph .lh-cubes, .pv-morph .lh-dm { transition: opacity .2s; }
437
+ .pv-morph.grow { border-radius: 0; } .pv-morph.grow .lh-doing, .pv-morph.grow .lh-cubes, .pv-morph.grow .lh-dm { opacity: 0; }
438
+ .feed-scroll.pv-in { animation: pv-in .3s .18s both; } @keyframes pv-in { from { opacity: 0; transform: translateY(8px); } }
439
+ .loom.rising .loom-head, .loom.rising .lc, .loom.rising .loom-band { animation: loom-rise .45s cubic-bezier(.2, .8, .2, 1) both; }
440
+ @keyframes loom-rise { from { transform: translateY(40px); opacity: 0; } }
441
+ @media (prefers-reduced-motion: reduce) { .loom.rising .loom-head, .loom.rising .lc, .loom.rising .loom-band, .feed-scroll.pv-in { animation: none; } }
442
+ /* A direct message thread (session.js dmThreadHtml): theirs on the left, yours on the right */
443
+ .dm-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
444
+ .dm-scroll { flex: 1; min-height: 0; overflow-y: auto; }
445
+ .dm-list { display: flex; flex-direction: column; gap: 16px; padding: 22px 28px; }
446
+ .dm-msg { display: flex; align-items: flex-end; gap: 10px; max-width: 72%; }
447
+ .dm-msg > .avatar { width: 28px; height: 28px; font-size: 11px; flex: none; }
448
+ .dm-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
449
+ .dm-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
450
+ .dm-msg.mine .dm-body { align-items: flex-end; }
451
+ .dm-bubble { padding: 9px 13px; border-radius: 16px 16px 16px 6px; background: var(--panel); border: 1px solid var(--border); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
452
+ .dm-msg.mine .dm-bubble { border-radius: 16px 16px 6px 16px; background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--panel)); border-color: color-mix(in srgb, var(--c, var(--accent)) 25%, var(--border)); }
453
+ .dm-bubble .file-card { margin-top: 6px; }
454
+ .dm-msg time { font-size: 11.5px; color: var(--faint); }
455
+ .dm-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 60px auto; text-align: center; }
456
+
457
+ /* The composer in the loom, a person's view and a DM thread (dm06): one rounded box with the To chip,
458
+ the text, and a bar with + and @ on the left and send on the right */
459
+ .ws-body.loom-chat .ws-chat > .composer { margin: 8px 28px 18px; padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }
460
+ .ws-body.loom-chat .ws-chat > .composer:focus-within { border-color: var(--border-strong); }
461
+ .ws-body.loom-chat .composer .to { margin: 0; padding: 10px 16px 0; gap: 8px; font-size: 12.5px; color: var(--faint); }
462
+ .ws-body.loom-chat .composer .to .dd-btn { height: 24px; padding: 2px 10px; border: 0; border-radius: 999px; background: var(--panel-2); color: var(--text); font: 600 12.5px var(--sans); }
463
+ .ws-body.loom-chat .composer .to .dd-btn svg { width: 11px; height: 11px; color: var(--muted); }
464
+ .ws-body.loom-chat .composer .to:has(option:checked:not([value=""])) .dd-btn { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); }
465
+ .ws-body.loom-chat .composer .box { display: grid; grid-template-columns: auto auto auto 1fr auto; grid-template-areas: "ta ta ta ta ta" "plus at ws sp send"; align-items: center; gap: 0 4px; padding: 0 10px 10px; border: 0; border-radius: 0; background: none; }
466
+ .ws-body.loom-chat .composer .box:focus-within { border-color: transparent; }
467
+ .ws-body.loom-chat .composer textarea { grid-area: ta; min-height: 0; padding: 8px 6px 4px; font: 14.5px/1.5 var(--sans); }
468
+ .ws-body.loom-chat .composer #attach-btn { grid-area: plus; } .ws-body.loom-chat .composer #at-btn { grid-area: at; } .ws-body.loom-chat .composer [data-attach-workspace] { grid-area: ws; }
469
+ .ws-body.loom-chat .composer .box > .btn.icon { width: 32px; height: 32px; border-radius: 8px; color: var(--muted); }
470
+ .ws-body.loom-chat .composer #send-btn { grid-area: send; background: none; border: 0; box-shadow: none; color: var(--muted); }
471
+ .ws-body.loom-chat .composer #send-btn:not(:disabled):hover { color: var(--text); background: var(--panel-2); }
472
+ .ws-body.loom-chat .composer .box > .btn svg { width: 17px; height: 17px; }
473
+ #at-btn { display: none; } .ws-body.loom-chat #at-btn { display: grid; }
474
+ .ws-body.loom-chat .ws-chat > .typing { padding: 0 28px; }
475
+
476
+ /* A person's AI chat fills the width it has (no centred column) */
477
+ .ws-body.loom-chat .feed { max-width: none; margin: 0; padding: 22px 28px 40px; }
478
+ /* The morph lands in the person's header (.pv-head) exactly: back, avatar, name over tool */
479
+ .pv-morph .pv-mbk { position: absolute; opacity: 0; transition: opacity .3s .12s; }
480
+ .pv-morph.grow { grid-template-columns: 32px 32px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; row-gap: 0; align-content: center; padding: 10px 24px; background: var(--bg); box-shadow: inset 0 -1px 0 var(--border), inset 0 3px 0 var(--c); }
481
+ .pv-morph.grow .pv-mbk { position: static; grid-column: 1; grid-row: 1 / 3; opacity: 1; }
482
+ .pv-morph.grow > .avatar { grid-column: 2; grid-row: 1 / 3; width: 32px; height: 32px; font-size: 13px; }
483
+ .pv-morph.grow .lh-name { grid-column: 3; grid-row: 1; font-size: 15px; line-height: 1.35; }
484
+ .pv-morph.grow .lh-tool { grid-column: 3; grid-row: 2; font-size: 12px; line-height: 1.35; }
485
+ .pv-morph.grow .lh-doing, .pv-morph.grow .lh-cubes, .pv-morph.grow .lh-dm { display: none; }
486
+ .pv-head { min-height: 57px; box-sizing: border-box; }
487
+ .pv-who b { line-height: 1.35; } .pv-who small { line-height: 1.35; }
488
+ .pv-who b, .pv-morph.grow .lh-name { display: block; line-height: 20px; }
489
+ .pv-who small, .pv-morph.grow .lh-tool { display: block; line-height: 16px; }
490
+ .pv-who { gap: 0; }
491
+ .pv-morph.grow { row-gap: 0; }
492
+ .pv-morph.grow { box-sizing: border-box; border-bottom: 1px solid var(--border); box-shadow: inset 0 3px 0 var(--c); }
493
+ .ws-body.loom-chat .composer .to:has(option:checked:not([value=""])) .dd-btn { background: color-mix(in srgb, var(--to-c, var(--accent)) 13%, var(--panel)); color: color-mix(in srgb, var(--to-c, var(--accent)) 80%, var(--text)); }
494
+ /* DM thread, as the mockup: the face at the top beside who and when, the bubble under it; yours on the right */
495
+ .dm-msg { align-items: flex-start; }
496
+ .dm-msg.mine { flex-direction: row-reverse; }
497
+ .dm-who { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; } .dm-who b { font-weight: 600; } .dm-who time { font-size: 11.5px; color: var(--faint); }
498
+ .dm-msg.mine .dm-who { flex-direction: row-reverse; }
499
+ .dm-msg > .avatar { margin-top: 1px; }
500
+ .dm-day { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 11.5px; font-weight: 600; } .dm-day::before, .dm-day::after { content: ''; flex: 1; height: 1px; background: var(--border); }
501
+
502
+ /* A quick reply under a band to you (dm06): attach, one line and Send; files above it; what you sent stays under the line */
503
+ .lb-reply:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
504
+ .loom-band.tome:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
505
+ .loom-band.tome.unread > b, .loom-band.tome.unread .lb-text { font-weight: 700; color: var(--text); }
506
+ .loom-band.tome.unread::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
507
+ .lb-qr, .lb-sent { order: 2; flex: 1 0 100%; }
508
+ .lb-qr { position: relative; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 4px 0 2px 36px; cursor: default; border-radius: 12px; }
509
+ .lb-qr.drop { box-shadow: 0 0 0 2px var(--accent) inset; background: color-mix(in srgb, var(--accent) 5%, var(--panel)); }
510
+ .lb-qr-row { display: flex; gap: 8px; align-items: center; }
511
+ .lb-qr-files, .lb-sent em { display: flex; flex-wrap: wrap; gap: 6px; }
512
+ .lb-qr-file { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 9px; border: 1px dashed var(--border); border-radius: 7px; background: var(--panel); font-size: 12.5px; }
513
+ .lb-qr-file svg { width: 13px; height: 13px; color: var(--faint); }
514
+ .lb-qr-file b { font-weight: 600; } .lb-qr-file i { font-style: normal; color: var(--faint); font-size: 11.5px; }
515
+ .lb-qr-file button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--faint); cursor: pointer; }
516
+ .lb-qr-file button:hover { background: var(--panel-2); color: var(--text); } .lb-qr-file button svg { width: 12px; height: 12px; }
517
+ .lb-qr-att { display: grid; place-items: center; width: 34px; height: 34px; flex: none; padding: 0; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 9px; background: var(--panel); color: var(--accent); cursor: pointer; }
518
+ .lb-qr-att:hover { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); } .lb-qr-att svg { width: 16px; height: 16px; }
519
+ .lb-qr [data-qr-text] { flex: 1; min-width: 0; height: 34px; padding: 0 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 9px; background: var(--panel); font: 13.5px var(--sans); color: var(--text); outline: none; }
520
+ .lb-qr [data-qr-text]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
521
+ .lb-qr [data-qr-send] { height: 34px; }
522
+ .lb-sent { padding: 2px 0 2px 36px; font-size: 12.5px; color: var(--muted); cursor: default; }
523
+ .lb-sent b { color: var(--text); } .lb-sent i { font-style: normal; color: var(--faint); margin-left: 4px; }
524
+ .lb-sent em { display: inline-flex; margin-left: 6px; vertical-align: middle; } .lb-sent .lb-qr-file { height: 24px; }
525
+
526
+ /* A thread's cube on a lane card (dm06): the Q in three by three squares */
527
+ .lh-card .lh-cubes { gap: 5px; }
528
+ .lh-cube { display: grid; grid-template-columns: repeat(3, 5px); gap: 1.5px; place-items: stretch; width: auto; height: auto; padding: 3px; border-radius: 6px; background: var(--panel); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
529
+ .lh-cube i { width: 5px; height: 5px; border-radius: 1px; background: color-mix(in srgb, var(--c) 18%, var(--panel-2)); }
530
+ .lh-cube i.on { background: var(--c); }
531
+ .lh-cube i.cnr { background: var(--accent); }
532
+ .lh-cube.live i.on { animation: lh-cube-pulse 1.6s infinite; }
533
+ .lh-cube.live i.on:nth-child(3n) { animation-delay: .3s; } .lh-cube.live i.on:nth-child(3n+2) { animation-delay: .6s; }
534
+ .lh-cube.still i.on { opacity: .45; }
535
+ .lh-cube:hover { box-shadow: 0 0 0 1px var(--border-strong); }
536
+ @keyframes lh-cube-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
537
+ @media (prefers-reduced-motion: reduce) { .lh-cube.live i.on { animation: none; } }
538
+
539
+ /* An AI turn as the dm06 card: a square and "Bob's Cursor" in the lane's colour, the time; what was asked in bold;
540
+ what it did in one line; its files; "still going" while it works */
541
+ .lc { border-radius: 9px; padding: 10px 12px; }
542
+ .lc::before { border-bottom-right-radius: 9px; width: 14px; height: 14px; }
543
+ .lc-turn { display: flex; flex-direction: column; gap: 4px; }
544
+ .lc-turn .lc-head { margin: 0; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--k); }
545
+ .lc-turn .lc-head time { font-weight: 400; color: var(--faint); }
546
+ .lc-sq { width: 8px; height: 8px; border-radius: 2px; background: var(--k); flex: none; }
547
+ .lc-lab { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
548
+ .lc-turn .lc-prompt { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; -webkit-line-clamp: 2; }
549
+ .lc-did { font-size: 12px; color: var(--muted); line-height: 1.45; }
550
+ .lc-turn .lc-reply { margin: 0; font-size: 12px; }
551
+ .lc-turn .lc-files { margin-top: 2px; }
552
+ .lc-turn .lc-file { font-size: 11px; padding: 2px 6px; border-radius: 4px; border: 1px dashed var(--border-strong); background: none; color: var(--muted); }
553
+ .lc-turn .lc-file:hover, .lc-turn .lc-file.lit { border-style: solid; color: var(--text); background: color-mix(in srgb, var(--c) 10%, var(--panel)); }
554
+ .lc-turn .lc-meta { margin-top: 2px; }
555
+ .lc-turn.live { border-color: color-mix(in srgb, var(--k) 45%, var(--border)); }
556
+ .lc-live { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--accent); }
557
+ .lc.open .lc-prompt { font-weight: 500; }
558
+ .lc-task { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
559
+ .lc-task .lc-head { align-self: stretch; margin: 0; font-weight: 600; color: var(--k); } .lc-task .lc-head time { font-weight: 400; color: var(--faint); }
560
+ .lc-task .lc-tasklink { margin: 0; font-size: 13px; font-weight: 600; text-align: left; }
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 { toolLogo, toolLabel } from './tool-logo.js'
6
+ import { 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,7 +53,12 @@ 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
- export function renderLoom (el, { build, prefs, me, names, meAgent, onAction }) {
56
+ // Quick replies open in a band to you (dm06): band key -> { to, text, files }; what was sent from one: key -> text.
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 = {} }) {
57
62
  handlers = { onAction }
58
63
  // Naming a conversation: don't redraw under the typing (it redraws once the name is in).
59
64
  const typing = el.querySelector('.lh-conv-edit')
@@ -63,14 +68,20 @@ export function renderLoom (el, { build, prefs, me, names, meAgent, onAction })
63
68
  const merged = prefs.layout === 'merged' || (el.clientWidth > 0 && el.clientWidth < MERGE_BELOW)
64
69
  lastWidth = el.clientWidth
65
70
  model = build(merged, Math.max(0, el.clientWidth - 14)) // less a scrollbar
66
- const html = loomHtml(model, { prefs, me, names, meAgent, merged })
71
+ const html = loomHtml(model, { prefs, me, names, meAgent, merged, extra })
67
72
  if (wasLoom && html === lastHtml) return
68
73
  const scroller = el.querySelector('.loom-scroll')
69
74
  const atBottom = !scroller || scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight < 80
70
75
  const top = scroller ? scroller.scrollTop : 0
71
76
  const left = scroller ? scroller.scrollLeft : 0
72
77
  lastHtml = html
78
+ const typingIn = document.activeElement && document.activeElement.closest && document.activeElement.closest('.lb-qr') ? document.activeElement.closest('.lb-qr').dataset.qr : null
73
79
  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
+ }
74
85
  phaseNeedles(el)
75
86
  packConvs(el)
76
87
  const edit = el.querySelector('.lh-conv-edit')
@@ -105,7 +116,7 @@ export function renderLoom (el, { build, prefs, me, names, meAgent, onAction })
105
116
 
106
117
  // ------------------------------------------------------------- markup --
107
118
 
108
- function loomHtml (m, { prefs, me, names, meAgent, merged }) {
119
+ function loomHtml (m, { prefs, me, names, meAgent, merged, extra = {} }) {
109
120
  const lanes = m.lanes
110
121
  const has = (at) => at && lanes.some((l) => l.name === at.lane && l.convs.some((c) => c.conv === at.conv))
111
122
  if (convFocus && !has(convFocus)) convFocus = null
@@ -143,7 +154,7 @@ function loomHtml (m, { prefs, me, names, meAgent, merged }) {
143
154
  : `<div class="loom-heads" style="grid-template-columns:${cols}">${m.columns.map((c) => {
144
155
  if (c.kind === 'crowd') return crowdHeadHtml(c.lanes.map((n) => byName.get(n)), colorOf)
145
156
  const l = byName.get(c.lane)
146
- return c.kind === 'strip' ? stripHeadHtml(l, colorOf.get(l.name)) : headHtml(l, colorOf.get(l.name))
157
+ return c.kind === 'strip' ? stripHeadHtml(l, colorOf.get(l.name)) : headHtml(l, colorOf.get(l.name), extra)
147
158
  }).join('')}</div>`
148
159
 
149
160
  const parts = []
@@ -158,7 +169,7 @@ function loomHtml (m, { prefs, me, names, meAgent, merged }) {
158
169
  } else {
159
170
  parts.push(`<div class="loom-thread merged" style="grid-column:1;grid-row:1 / ${m.rows + 2}" aria-hidden="true"></div>`)
160
171
  }
161
- for (const it of m.items) if (!it.folded) parts.push(itemHtml(it, { colorOf, me, names, meAgent, merged, dens }))
172
+ for (const it of m.items) if (!it.folded) parts.push(itemHtml(it, { colorOf, me, names, meAgent, merged, dens, extra }))
162
173
  for (const k of m.knots) parts.push(knotHtml(k, m, colorOf, me))
163
174
  if (!m.items.some((it) => it.lane)) {
164
175
  parts.push(`<div class="loom-empty" style="grid-column:1 / -1;grid-row:1">
@@ -197,24 +208,23 @@ function loomHtml (m, { prefs, me, names, meAgent, merged }) {
197
208
  </div>`
198
209
  }
199
210
 
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)}
211
+ function headHtml (l, color, extra = {}) {
212
+ // The dm06 lane card: name and tool on one line, what they're doing under it, a cube per thread
213
+ // (up to three, or two and a count) and a direct-message button with what's unread from them.
214
+ const doing = !l.sharing ? 'Paused sharing' : l.working ? (l.focus || 'Working') : l.online ? (l.focus || 'Idle') : 'Offline'
215
+ const convs = l.convs || []
216
+ const shown = convs.length <= 3 ? convs : convs.slice(0, 2)
217
+ const cubes = shown.map((c) => `<span class="lh-cube${c.live ? ' live' : ' still'}" title="${esc(`${c.name || 'A conversation'}${c.live ? ' · working' : ''}`)}" data-loom-conv="${esc(l.name)}" data-loom-convid="${esc(c.conv)}">${GRID9}</span>`).join('') +
218
+ (convs.length > shown.length ? `<span class="lh-more" title="${esc(convs.slice(shown.length).map((c) => c.name).filter(Boolean).join(', '))}">+${convs.length - shown.length}</span>` : '')
219
+ const unread = extra.unreadFrom ? extra.unreadFrom(l.name) : 0
220
+ const dm = l.isMe ? '' : `<button type="button" class="lh-dm${unread ? ' unread' : ''}" data-loom-dm="${esc(l.name)}" title="${esc(unread ? `${unread} direct message${unread === 1 ? '' : 's'} from ${l.name}` : `Message ${l.name} directly`)}" aria-label="${esc(`Message ${l.name}`)}">${I.chat}${unread ? `<span>${unread}</span>` : ''}</button>`
221
+ return `<div class="loom-head lh-card" style="--c:${esc(color)}" data-loom-person="${esc(l.name)}" title="${esc(l.isMe ? 'Your AI chat' : `${l.name}'s AI chat`)}">
222
+ ${avatar(l.name, l.color, l.online)}
223
+ <b class="lh-name">${esc(l.isMe ? 'You' : l.name)}</b>
224
+ <small class="lh-tool">${esc(l.kind === 'agent' ? 'agent' : l.tool ? toolLabel(l.tool) : '')}</small>
225
+ <span class="lh-cubes">${cubes}</span>
226
+ ${dm}
227
+ <span class="lh-doing${l.working ? ' live' : ''}">${l.working ? '<span class="pulse"></span>' : ''}${esc(doing)}</span>
218
228
  </div>`
219
229
  }
220
230
 
@@ -314,10 +324,10 @@ function place (it, merged) {
314
324
  // A turn sits by its latest activity (loom-model.js), so its time says when it started, and that it's still going.
315
325
  function turnTime (it) {
316
326
  const end = it.end && it.end !== it.ts ? `, last ${new Date(it.end).toLocaleString()}` : ''
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>`
327
+ return `<time title="${esc(`Started ${new Date(it.ts).toLocaleString()}${end}${it.live ? ' · still going' : ''}`)}">${esc(clock(it.ts))}</time>`
318
328
  }
319
329
 
320
- function itemHtml (it, { colorOf, me, names, meAgent, merged, dens }) {
330
+ function itemHtml (it, { colorOf, me, names, meAgent, merged, dens, extra = {} }) {
321
331
  if (it.type === 'gap' || it.type === 'day') {
322
332
  const label = it.type === 'day'
323
333
  ? new Date(it.ts).toLocaleDateString([], { weekday: 'long', month: 'short', day: 'numeric' })
@@ -336,17 +346,31 @@ function itemHtml (it, { colorOf, me, names, meAgent, merged, dens }) {
336
346
  return `<div class="lc-mark${fresh}" data-id="${it.id}" style="${style}">${who}<span>${it.type === 'paused' ? 'Paused sharing' : 'Resumed sharing'}</span>${time}</div>`
337
347
  }
338
348
  if (it.type === 'chat') {
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>`
349
+ // A band across every lane (the dm06 loom): who, to whom, what, when. One to you is tinted and has Reply.
350
+ const by = it.lane || it.by || ''
351
+ const relay = it.relay
352
+ const mine = by === me
353
+ const toMe = !!it.to && it.to === me
354
+ const to = it.to ? (toMe ? 'to you · direct' : mine ? `to ${it.to} · direct` : 'direct') : relay ? '' : 'to everyone'
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>`
345
369
  }
346
370
  if (it.type === 'task' || it.type === 'note') {
347
371
  const col = `<span class="lc-col c-${esc(it.task.column)}">${esc(COLUMN[it.task.column] || it.task.column)}</span>`
348
372
  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`)}">
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>
373
+ <header class="lc-head">${who}<span class="lc-sq"></span><span class="lc-lab">${it.type === 'task' ? 'Task' : 'Note on a task'}</span>${time}</header>
350
374
  <button class="lc-tasklink" data-loom-task="${esc(it.task.id)}" title="Open the task board">${esc(it.task.title)}</button>${col}
351
375
  ${it.type === 'note' ? `<div class="lc-text">${esc(it.text)}</div>` : ''}
352
376
  </article>`
@@ -359,21 +383,26 @@ function itemHtml (it, { colorOf, me, names, meAgent, merged, dens }) {
359
383
  const done = (it.tasks || []).some((t) => t.column === 'done')
360
384
  const files = open ? it.edits : it.edits.slice(0, FILES_SHOWN)
361
385
  const more = it.edits.length - files.length
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)
386
+ // What it did, in one line (dm06): "Read 3 files · edited pricing.tsx and Plans.tsx · ran 6 commands".
387
+ const edited = it.edits.slice(0, 2).map((p) => basename(p))
388
+ const did = [
389
+ it.reads ? `read ${it.reads} file${it.reads === 1 ? '' : 's'}` : '',
390
+ it.edits.length ? `edited ${edited.join(' and ')}${it.edits.length > 2 ? ` and ${it.edits.length - 2} more` : ''}` : '',
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)}`
367
394
  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('')
368
395
  const summary = it.summary || (reply && reply.summary) ? '<span class="tag summary" title="Summarized before sharing">summary</span>' : ''
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>
396
+ // The dm06 card: a square and whose AI it is in the lane's colour, the time; what was asked; what it did; its files; still going.
397
+ return `<article class="lc lc-turn${open ? ' open' : ''}${done ? ' hemmed' : ''}${it.live ? ' live' : ''}${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'}`)}">
398
+ <header class="lc-head"><span class="lc-sq"></span><span class="lc-lab" title="${esc(it.convLabel || label)}">${esc(label)}</span>${summary}${turnTime(it)}</header>
372
399
  ${prompt ? `<div class="lc-prompt">${esc(prompt)}</div>` : ''}
373
- ${reply && dens === 'detailed' && !open ? `<div class="lc-reply">${esc(plain(reply.text))}</div>` : ''}
400
+ ${did ? `<small class="lc-did">${esc(did[0].toUpperCase() + did.slice(1))}</small>` : ''}
401
+ ${reply && (dens === 'detailed' || !prompt) && !open ? `<div class="lc-reply">${esc(plain(reply.text))}</div>` : ''}
374
402
  ${open ? `<div class="lc-replies">${it.replies.map((r) => `<div class="md">${markdown(r.text)}</div>`).join('')}</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>` : ''}
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>' : ''}
377
406
  ${open && it.actions.length ? `<ol class="lc-actions">${it.actions.map((a) => `<li>${esc(a)}</li>`).join('')}</ol>` : ''}
378
407
  ${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>` : ''}
379
408
  </article>`
@@ -381,16 +410,6 @@ function itemHtml (it, { colorOf, me, names, meAgent, merged, dens }) {
381
410
 
382
411
  const COLUMN = { todo: 'To do', doing: 'In progress', qa: 'QA', done: 'Done' }
383
412
 
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
-
394
413
  /** Markdown as one plain line of text, for a card's preview of a reply. */
395
414
  function plain (text) {
396
415
  return String(text || '')
@@ -420,6 +439,9 @@ const convMark = (slot, working) => {
420
439
  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>`
421
440
  }
422
441
  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>`
423
445
  const CONV_MARKS_LIVE = Array.from({ length: 8 }, (_, slot) => convMark(slot, true))
424
446
 
425
447
  // A working AI's needle: it pieces patches on its lane's thread and sews them into the Q, slot by slot,
@@ -650,6 +672,48 @@ function showTip (root, anchor, html) {
650
672
 
651
673
  function bind (el) {
652
674
  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
+ })
653
717
  const s = root.querySelector('.loom-scroll')
654
718
  const jump = root.querySelector('.loom-jump')
655
719
  // Scrolled up a way (or anything new came in below): a button back down to the latest.
@@ -691,7 +755,20 @@ function bind (el) {
691
755
  if ((b = pick('[data-loom-open]'))) { crowdOpen = false; return act('open-lane', b.dataset.loomOpen) }
692
756
  if ((b = pick('[data-loom-pin]'))) return act('pin', b.dataset.loomPin)
693
757
  if ((b = pick('[data-loom-holds]'))) return act('holds', { name: b.dataset.loomHolds, anchor: b })
694
- if ((b = pick('[data-loom-person]'))) return act('person', b.dataset.loomPerson)
758
+ // A lane card's message button and a thread cube come before the card itself; a band to you opens your DMs with its sender.
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)
695
772
  if ((b = pick('[data-loom-follow]'))) {
696
773
  const same = convFocus && convFocus.lane === b.dataset.lane && convFocus.conv === b.dataset.conv
697
774
  convFocus = same ? null : { lane: b.dataset.lane, conv: b.dataset.conv }
@@ -0,0 +1,75 @@
1
+ // The ⌘K palette (plans/app-redesign.md, the dm06 mockup): one box over the window that finds sessions,
2
+ // people, files and actions, grouped, and opens the pick. Pages register what they offer (`paletteSource`);
3
+ // the rail's search button and ⌘K / Ctrl+K open it.
4
+ import { esc, I, avatar } from './common.js'
5
+
6
+ const SEARCH = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>'
7
+ const sources = new Map() // name -> () => [{ group, title, sub, icon | face: { name, color }, run }]
8
+ let box = null
9
+ let items = []
10
+ let sel = 0
11
+
12
+ /** What a page offers in the palette, under `name` (replaced when called again). */
13
+ export function paletteSource (name, fn) { if (fn) sources.set(name, fn); else sources.delete(name) }
14
+
15
+ const mark = (text, q) => {
16
+ if (!q) return esc(text)
17
+ const i = text.toLowerCase().indexOf(q)
18
+ return i < 0 ? esc(text) : `${esc(text.slice(0, i))}<mark>${esc(text.slice(i, i + q.length))}</mark>${esc(text.slice(i + q.length))}`
19
+ }
20
+
21
+ function draw () {
22
+ const q = box.querySelector('input').value.trim().toLowerCase()
23
+ const all = [...sources.values()].flatMap((fn) => { try { return fn() || [] } catch { return [] } })
24
+ items = all.filter((it) => !q || `${it.title} ${it.sub || ''} ${it.group}`.toLowerCase().includes(q)).slice(0, 60)
25
+ if (sel >= items.length) sel = Math.max(0, items.length - 1)
26
+ let group = ''
27
+ const rows = items.map((it, i) => {
28
+ const head = it.group !== group ? `<div class="pal-h">${esc((group = it.group))}</div>` : ''
29
+ const ico = it.face ? `<span class="pal-i face">${avatar(it.face.name, it.face.color)}</span>` : `<span class="pal-i">${it.icon || I.arrowRight}</span>`
30
+ return `${head}<div class="pal-r${i === sel ? ' on' : ''}" data-pal-i="${i}" role="option" aria-selected="${i === sel}">${ico}<span class="pal-t"><b>${mark(it.title, q)}</b>${it.sub ? `<small>${mark(it.sub, q)}</small>` : ''}</span><span class="pal-k">↵</span></div>`
31
+ }).join('')
32
+ box.querySelector('.pal-res').innerHTML = rows || `<div class="pal-h none">Nothing matches “${esc(q)}”.</div>`
33
+ box.querySelector('.pal-r.on')?.scrollIntoView({ block: 'nearest' })
34
+ }
35
+
36
+ function close () { if (box) { box.hidden = true; box.previousElementSibling.hidden = true } }
37
+
38
+ function pick (i) {
39
+ const it = items[i]
40
+ if (!it) return
41
+ close()
42
+ it.run()
43
+ }
44
+
45
+ export function openPalette () {
46
+ if (!box) {
47
+ document.body.insertAdjacentHTML('beforeend', `<div class="pal-back" hidden></div><div class="pal" role="dialog" aria-label="Search" hidden>
48
+ <div class="pal-in">${SEARCH}<input placeholder="Search sessions, people and files, or type a command" autocomplete="off" spellcheck="false" aria-label="Search"><kbd>esc</kbd></div>
49
+ <div class="pal-res" role="listbox"></div>
50
+ <div class="pal-ft"><span><kbd>↑</kbd><kbd>↓</kbd> to move</span><span><kbd>↵</kbd> to open</span><span class="pal-sp"></span><span>⌘K opens this anywhere</span></div></div>`)
51
+ box = document.body.lastElementChild
52
+ const input = box.querySelector('input')
53
+ input.addEventListener('input', () => { sel = 0; draw() })
54
+ input.addEventListener('keydown', (e) => {
55
+ if (e.key === 'ArrowDown') { e.preventDefault(); sel = Math.min(items.length - 1, sel + 1); draw() }
56
+ if (e.key === 'ArrowUp') { e.preventDefault(); sel = Math.max(0, sel - 1); draw() }
57
+ if (e.key === 'Enter') { e.preventDefault(); pick(sel) }
58
+ if (e.key === 'Escape') { e.preventDefault(); close() }
59
+ })
60
+ box.querySelector('.pal-res').addEventListener('mousemove', (e) => { const r = e.target.closest('[data-pal-i]'); if (r && Number(r.dataset.palI) !== sel) { sel = Number(r.dataset.palI); draw() } })
61
+ box.querySelector('.pal-res').addEventListener('click', (e) => { const r = e.target.closest('[data-pal-i]'); if (r) pick(Number(r.dataset.palI)) })
62
+ box.previousElementSibling.addEventListener('mousedown', close)
63
+ }
64
+ sel = 0
65
+ box.hidden = false
66
+ box.previousElementSibling.hidden = false
67
+ const input = box.querySelector('input')
68
+ input.value = ''
69
+ draw()
70
+ input.focus()
71
+ }
72
+
73
+ document.addEventListener('keydown', (e) => {
74
+ if ((e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === 'k') { e.preventDefault(); if (box && !box.hidden) close(); else openPalette() }
75
+ })