anentrypoint-design 0.0.377 → 0.0.379

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anentrypoint-design",
3
- "version": "0.0.377",
3
+ "version": "0.0.379",
4
4
  "description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
5
5
  "type": "module",
6
6
  "main": "./dist/247420.js",
@@ -509,7 +509,10 @@ export function ContextMenu({ items = [], anchor = { x: 0, y: 0 }, onClose } = {
509
509
  // Re-clamp on resize/orientation change for the menu's lifetime.
510
510
  window.addEventListener('resize', clamp);
511
511
  el._dsCtxClampOff = () => { window.removeEventListener('resize', clamp); el._dsCtxClampOff = null; };
512
- queueMicrotask(() => { el.querySelector('button[data-ix]')?.focus(); });
512
+ // setTimeout(0), not queueMicrotask: the triggering contextmenu/click
513
+ // event's own default focus can otherwise win the race and leave focus
514
+ // outside the menu, breaking keyboard arrow-nav/Escape.
515
+ setTimeout(() => { el.querySelector('button[data-ix]')?.focus(); }, 0);
513
516
  }
514
517
  },
515
518
  ...items.map((it, i) => it.separator
@@ -581,10 +584,12 @@ export function Drawer({ side = 'left', open = false, onClose, children, ariaLab
581
584
  if (!el || el._dsTrap) return;
582
585
  el._dsTrap = true;
583
586
  el.addEventListener('keydown', (e) => trapTabKey(el, e));
584
- queueMicrotask(() => {
587
+ // setTimeout(0), not queueMicrotask — see Dialog's identical comment
588
+ // below: the opening click's own default focus can win a same-tick race.
589
+ setTimeout(() => {
585
590
  const f = el.querySelector(FOCUSABLE_SEL);
586
591
  (f || el).focus();
587
- });
592
+ }, 0);
588
593
  },
589
594
  }, ...kids(children))
590
595
  );
@@ -616,10 +621,14 @@ export function Dialog({ title, open = false, onClose, children, actions = [], d
616
621
  if (!el || el._dsTrap) return;
617
622
  el._dsTrap = true;
618
623
  el.addEventListener('keydown', (e) => trapTabKey(el, e));
619
- queueMicrotask(() => {
624
+ // setTimeout(0), not queueMicrotask: the triggering click's own default
625
+ // focus-on-click can win a same-tick microtask race and leave focus on
626
+ // the trigger button instead of the dialog, breaking Escape/Tab-trap
627
+ // for keyboard users (keydown only bubbles from the focused element).
628
+ setTimeout(() => {
620
629
  const f = el.querySelector(FOCUSABLE_SEL);
621
630
  (f || el).focus();
622
- });
631
+ }, 0);
623
632
  },
624
633
  },
625
634
  title != null ? h('div', { class: 'ds-ep-dialog-head' }, h('h2', { class: 'ds-ep-dialog-title' }, title)) : null,
@@ -141,7 +141,7 @@ async function* parseSseStream(response) {
141
141
  }
142
142
  }
143
143
  } finally {
144
- try { reader.releaseLock(); } catch { /* stream already closed/errored */ }
144
+ try { reader.releaseLock(); } catch { /* swallow: stream already closed/errored */ }
145
145
  }
146
146
  }
147
147
 
@@ -178,7 +178,7 @@ function partsFromMessages(assistantAndToolMessages) {
178
178
  const target = m.tool_call_id ? byId.get(m.tool_call_id) : null;
179
179
  let content = m.content;
180
180
  let isError = false;
181
- try { const parsed = JSON.parse(content); if (parsed && parsed.error) { isError = true; } } catch { /* not JSON, leave as-is */ }
181
+ try { const parsed = JSON.parse(content); if (parsed && parsed.error) { isError = true; } } catch { /* swallow: not JSON, leave as-is */ }
182
182
  if (target) { target.result = content; target.status = isError ? 'error' : 'done'; target.error = isError || undefined; }
183
183
  else parts.push({ kind: 'tool_result', name: 'result', result: content, error: isError || undefined, status: isError ? 'error' : 'done' });
184
184
  }
@@ -276,7 +276,7 @@ export const chat = makePage((ctx) => {
276
276
  }
277
277
 
278
278
  function stop() {
279
- if (ctx.state.abort) { try { ctx.state.abort.abort(); } catch { /* already settled */ } }
279
+ if (ctx.state.abort) { try { ctx.state.abort.abort(); } catch { /* swallow: already settled */ } }
280
280
  }
281
281
 
282
282
  return () => {
@@ -149,7 +149,7 @@ export function GitDiffView({ diff = '', filename } = {}) {
149
149
  const lang = langFromFilename(filename);
150
150
  const highlightRef = (el) => {
151
151
  if (!el) return;
152
- try { highlightAllUnder(el); } catch { /* progressive enhancement only */ }
152
+ try { highlightAllUnder(el); } catch { /* swallow: progressive enhancement only */ }
153
153
  };
154
154
  if (!hunks.length) {
155
155
  return h('div', { class: 'ds-git-diff-empty', role: 'status' }, 'no diff to show');
@@ -180,7 +180,10 @@ export function Popover({ open, anchorEl, onClose, placement = 'bottom-start', c
180
180
  };
181
181
  el.addEventListener('keydown', onKey);
182
182
  document.addEventListener('mousedown', onDown, true);
183
- queueMicrotask(() => { const f = el.querySelector(FOCUSABLE_SEL); (f || el).focus(); });
183
+ // setTimeout(0), not queueMicrotask see _anchoredOverlayLifecycle's
184
+ // comment: the opening click's own default focus-on-click can otherwise
185
+ // win the race and leave focus outside el, breaking Escape/Tab-trap.
186
+ setTimeout(() => { const f = el.querySelector(FOCUSABLE_SEL); (f || el).focus(); }, 0);
184
187
  _popovers.set(anchorEl, { dispose() {
185
188
  document.removeEventListener('mousedown', onDown, true);
186
189
  floating.dispose();
@@ -399,7 +402,14 @@ function _anchoredOverlayLifecycle(el, { anchorX, anchorY, fallbackW, fallbackH,
399
402
  const { left, top } = _clampToViewport(anchorX, anchorY, r.width || fallbackW, r.height || fallbackH);
400
403
  el.style.left = left + 'px'; el.style.top = top + 'px';
401
404
  };
402
- queueMicrotask(() => { place(); el.focus(); });
405
+ // setTimeout(0), not queueMicrotask: the triggering click's own default
406
+ // focus-on-click (moving focus to the clicked <button>) can run AFTER a
407
+ // same-tick microtask, so a queueMicrotask focus() call here was losing
408
+ // the race and leaving focus on the trigger button instead of the
409
+ // dialog -- breaking Escape-to-close (keydown only bubbles from the
410
+ // focused element) for any keyboard user. A macrotask reliably runs
411
+ // after the click's focus settles.
412
+ setTimeout(() => { place(); el.focus(); }, 0);
403
413
  const onDown = (e) => { if (!el.contains(e.target)) close(); };
404
414
  queueMicrotask(() => document.addEventListener('mousedown', onDown, true));
405
415
  return () => document.removeEventListener('mousedown', onDown, true);
@@ -837,7 +847,7 @@ export function VideoLightbox({ src, label = '', open = false, onClose } = {}) {
837
847
  class: 'ov-lightbox-backdrop', role: 'dialog', 'aria-modal': 'true', 'aria-label': label || 'Video',
838
848
  tabindex: '-1',
839
849
  onkeydown: (e) => { if (e.key === 'Escape') { e.preventDefault(); close(); } },
840
- ref: (el) => { if (el && !el._ovLb) { el._ovLb = true; queueMicrotask(() => el.focus()); } },
850
+ ref: (el) => { if (el && !el._ovLb) { el._ovLb = true; setTimeout(() => el.focus(), 0); } },
841
851
  onmousedown: (e) => { if (e.target === e.currentTarget) close(); },
842
852
  },
843
853
  h('button', { type: 'button', class: 'ov-lightbox-x', 'aria-label': 'close', onclick: close }, Icon('x')),