@phnx-labs/artifacts-cli 0.9.7 → 0.9.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.8 — 2026-10-12
4
+
5
+ - **A reply you are typing survives a teammate's comment.** On a shared document's review
6
+ rail, a new comment on any thread no longer wipes the reply, new comment or inline edit
7
+ you are writing; the text, focus and caret stay put, and a reply on the same thread no
8
+ longer closes your composer.
9
+
3
10
  ## 0.9.7 — 2026-10-11
4
11
 
5
12
  - **Comments live in the share bar.** On a shared document with review threads, a
@@ -301,6 +301,29 @@ export const COLLAB_SCRIPT = `<script>
301
301
  const item = document.createElement('li');
302
302
  item.className = 'collab-comment';
303
303
  item.dataset.commentId = comment.id;
304
+ const mine = !comment.deleted && !comment.pending && comment.author && comment.author.id && comment.author.id === viewerId();
305
+ if (mine && canComment() && thread.editing === comment.id) {
306
+ const form = document.createElement('form');
307
+ form.className = 'collab-editor';
308
+ const textarea = document.createElement('textarea');
309
+ textarea.setAttribute('aria-label', 'Edit comment');
310
+ textarea.value = thread.editValue;
311
+ textarea.addEventListener('input', () => { thread.editValue = textarea.value; });
312
+ const row = document.createElement('div');
313
+ row.className = 'collab-actions';
314
+ const save = document.createElement('button');
315
+ save.type = 'submit';
316
+ save.textContent = 'Save';
317
+ row.append(save, button('cancel-edit', 'Cancel'));
318
+ form.append(textarea, row);
319
+ form.addEventListener('submit', (event) => {
320
+ event.preventDefault();
321
+ const value = textarea.value.trim();
322
+ if (value) patchComment(thread, comment.id, { body: value }, 'Edit failed.');
323
+ });
324
+ item.append(form);
325
+ return item;
326
+ }
304
327
  const byline = document.createElement('div');
305
328
  byline.className = 'collab-byline';
306
329
  const author = document.createElement('span');
@@ -314,7 +337,6 @@ export const COLLAB_SCRIPT = `<script>
314
337
  body.className = 'collab-body' + (comment.deleted ? ' is-deleted' : '') + (comment.pending ? ' is-pending' : '');
315
338
  body.textContent = comment.deleted ? 'Comment deleted' : comment.body;
316
339
  item.append(byline, body);
317
- const mine = !comment.deleted && !comment.pending && comment.author && comment.author.id && comment.author.id === viewerId();
318
340
  if (mine && canComment()) {
319
341
  const actions = document.createElement('div');
320
342
  actions.className = 'collab-actions';
@@ -365,6 +387,7 @@ export const COLLAB_SCRIPT = `<script>
365
387
  textarea.setAttribute('aria-label', thread.draft ? 'Comment' : 'Reply');
366
388
  textarea.placeholder = thread.draft ? 'Comment on this selection…' : 'Reply…';
367
389
  textarea.value = thread.composerValue || '';
390
+ textarea.addEventListener('input', () => { thread.composerValue = textarea.value; });
368
391
  const row = document.createElement('div');
369
392
  row.className = 'collab-actions';
370
393
  const submit = document.createElement('button');
@@ -394,6 +417,11 @@ export const COLLAB_SCRIPT = `<script>
394
417
  };
395
418
 
396
419
  const renderRail = () => {
420
+ // Rebuilding replaces every textarea. Their text lives on the thread, but
421
+ // focus and the caret do not, so they are carried across: a teammate's
422
+ // comment landing anywhere must not interrupt whoever is typing.
423
+ const field = list.contains(document.activeElement) && document.activeElement.tagName === 'TEXTAREA' ? document.activeElement : null;
424
+ const typing = field && { thread: field.closest('[data-thread-id]').dataset.threadId, form: field.form.className, start: field.selectionStart, end: field.selectionEnd, direction: field.selectionDirection };
397
425
  const shown = [...threads.values()].filter((thread) => thread.draft || visible(thread));
398
426
  list.replaceChildren();
399
427
  if (!shown.length) {
@@ -403,6 +431,8 @@ export const COLLAB_SCRIPT = `<script>
403
431
  list.append(empty);
404
432
  }
405
433
  for (const thread of shown) list.append(threadItem(thread));
434
+ const restored = typing && list.querySelector('[data-thread-id="' + CSS.escape(typing.thread) + '"] .' + typing.form + ' textarea');
435
+ if (restored) { restored.focus(); restored.setSelectionRange(typing.start, typing.end, typing.direction); }
406
436
  const open = [...threads.values()].filter((thread) => !thread.draft && thread.status !== 'resolved').length;
407
437
  launcher.querySelector('.collab-count').textContent = String(open);
408
438
  launcher.setAttribute('aria-label', open === 1 ? '1 open review thread' : open + ' open review threads');
@@ -419,7 +449,7 @@ export const COLLAB_SCRIPT = `<script>
419
449
  if (!thread || !thread.id) return false;
420
450
  const existing = threads.get(thread.id);
421
451
  if (existing && Number(thread.cursor || 0) < Number(existing.cursor || 0)) return false;
422
- threads.set(thread.id, { ...existing, ...thread, draft: false, composer: false, error: null });
452
+ threads.set(thread.id, { ...existing, ...thread, draft: false, error: null });
423
453
  return true;
424
454
  };
425
455
 
@@ -569,6 +599,7 @@ export const COLLAB_SCRIPT = `<script>
569
599
  comments: current.comments.map((comment) => (comment.id === commentId
570
600
  ? { ...comment, ...(payload.deleted ? { deleted: true } : { body: payload.body, edited: true }) }
571
601
  : comment)),
602
+ editing: current.editing === commentId ? null : current.editing,
572
603
  error: null,
573
604
  }));
574
605
  renderRail();
@@ -612,7 +643,9 @@ export const COLLAB_SCRIPT = `<script>
612
643
  const thread = item && threads.get(item.dataset.threadId);
613
644
  if (!thread) return;
614
645
  const action = target.dataset.collabAction;
615
- if (action === 'reply') { thread.composer = true; thread.composerValue = ''; renderRail(); item.querySelector('textarea')?.focus(); return; }
646
+ // Rendering replaces the clicked item, so the new field is found through the list.
647
+ const field = (form) => list.querySelector('[data-thread-id="' + CSS.escape(thread.id) + '"] .' + form + ' textarea');
648
+ if (action === 'reply') { thread.composer = true; thread.composerValue = ''; renderRail(); field('collab-composer')?.focus(); return; }
616
649
  if (action === 'cancel') {
617
650
  if (thread.draft) { threads.delete('draft'); draft = null; selected = null; }
618
651
  else { thread.composer = false; thread.composerValue = ''; thread.error = null; }
@@ -622,32 +655,13 @@ export const COLLAB_SCRIPT = `<script>
622
655
  if (action === 'reopen') { setStatus(thread, 'open'); return; }
623
656
  if (action === 'delete') { patchComment(thread, target.dataset.collabTarget, { deleted: true }, 'Delete failed.'); return; }
624
657
  if (action === 'edit') {
625
- const commentId = target.dataset.collabTarget;
626
- const comment = thread.comments.find((value) => value.id === commentId);
658
+ const comment = thread.comments.find((value) => value.id === target.dataset.collabTarget);
627
659
  if (!comment) return;
628
- const holder = item.querySelector('[data-comment-id="' + CSS.escape(commentId) + '"]');
629
- const form = document.createElement('form');
630
- const textarea = document.createElement('textarea');
631
- textarea.setAttribute('aria-label', 'Edit comment');
632
- textarea.value = comment.body;
633
- const row = document.createElement('div');
634
- row.className = 'collab-actions';
635
- const save = document.createElement('button');
636
- save.type = 'submit';
637
- save.textContent = 'Save';
638
- row.append(save, button('cancel-edit', 'Cancel'));
639
- form.append(textarea, row);
640
- form.addEventListener('submit', (submitEvent) => {
641
- submitEvent.preventDefault();
642
- const value = textarea.value.trim();
643
- if (value) patchComment(thread, commentId, { body: value }, 'Edit failed.');
644
- });
645
- form.addEventListener('click', (clickEvent) => {
646
- if (clickEvent.target.closest('[data-collab-action="cancel-edit"]')) { clickEvent.preventDefault(); clickEvent.stopPropagation(); renderRail(); }
647
- });
648
- holder.replaceChildren(form);
649
- textarea.focus();
660
+ thread.editing = comment.id;
661
+ thread.editValue = comment.body;
662
+ renderRail(); field('collab-editor')?.focus(); return;
650
663
  }
664
+ if (action === 'cancel-edit') { thread.editing = null; renderRail(); }
651
665
  });
652
666
 
653
667
  list.addEventListener('focusin', (event) => {
@@ -1 +1 @@
1
- {"version":3,"file":"collab.js","sourceRoot":"","sources":["../../src/lib/collab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sFAAsF;AACtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,YAAY,CAAC,WAAmB;IAC9C,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACpF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6DA4C5B,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgiB7E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/artifacts-cli",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "Your coding agent writes Markdown; artifacts turns it into one polished HTML page you can read, mark up and share as a link.",
5
5
  "homepage": "https://artifacts-cli.sh",
6
6
  "repository": {