anentrypoint-design 0.0.355 → 0.0.356

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.355",
3
+ "version": "0.0.356",
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",
@@ -73,6 +73,32 @@ export function useLongPress(targetEl, callback, { ms = 500 } = {}) {
73
73
  return () => { cancel(); evts.forEach(([k, fn]) => targetEl.removeEventListener(k, fn)); };
74
74
  }
75
75
 
76
+ // withBusy — run an async action with its triggering button disabled +
77
+ // busy-labelled, so a double-click/double-tap can't fire it twice and the
78
+ // user sees progress. Restores the button (label, disabled state,
79
+ // aria-busy) when the action settles, including on throw. Re-entry while
80
+ // already busy is dropped silently rather than queued. Mirrors docstudio's
81
+ // dom-busy.js withButtonBusy — agentgui's app.js has no equivalent anywhere,
82
+ // so every async-click handler (share/delete/retry/approve-deny) is
83
+ // currently unguarded against rapid repeat clicks firing the same mutating
84
+ // request twice.
85
+ export async function withBusy(btn, fn, busyLabel = '...') {
86
+ if (!btn) return fn();
87
+ if (btn.disabled) return; // already in flight -> drop the repeat
88
+ const prevHtml = btn.innerHTML;
89
+ const prevDisabled = btn.disabled;
90
+ btn.disabled = true;
91
+ btn.setAttribute('aria-busy', 'true');
92
+ if (busyLabel != null) btn.textContent = busyLabel;
93
+ try {
94
+ return await fn();
95
+ } finally {
96
+ btn.disabled = prevDisabled;
97
+ btn.removeAttribute('aria-busy');
98
+ btn.innerHTML = prevHtml;
99
+ }
100
+ }
101
+
76
102
  // Tooltip — single shared bubble appended to <body>.
77
103
  let _tipEl = null, _tipFloat = null, _tipTimer = null, _tipId = 0;
78
104
  function _hideTip() {
package/src/components.js CHANGED
@@ -90,7 +90,7 @@ export {
90
90
  export {
91
91
  Tooltip, Popover, Dropdown, useLongPress, useFloating,
92
92
  CommandPalette, EmojiPicker, BootOverlay, SettingsPopover,
93
- AuthModal, VideoLightbox, PermissionMenu, ApprovalPrompt
93
+ AuthModal, VideoLightbox, PermissionMenu, ApprovalPrompt, withBusy
94
94
  } from './components/overlay-primitives.js';
95
95
 
96
96
  export {