mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-02 08:59:26 +08:00
* fix: complete installation onboarding in the installing turn * fix: avoid redundant browser steps before onboarding delivery * fix: preload the template library before the final onboarding reveal * fix: stream onboarding text and copy unsupported composer drafts * docs: keep onboarding setup roots independent of supporting skills * ci: retire the queued onboarding callback test entry * fix: ship inline onboarding translation dependencies --------- Co-authored-by: bone3deep1962-collab <bone3deep1962@gmail.com>
24 lines
1001 B
TypeScript
24 lines
1001 B
TypeScript
/** Floating action feedback for self-contained, non-React host documents. */
|
|
export function createInlineFeedback(root: HTMLElement) {
|
|
const doc = root.ownerDocument, win = doc.defaultView!;
|
|
const node = doc.createElement('div');
|
|
node.className = 'motion-inline-toast'; node.setAttribute('role', 'status');
|
|
node.setAttribute('aria-live', 'polite'); node.setAttribute('popover', 'manual'); node.hidden = true;
|
|
let timer: number | undefined;
|
|
function clear() {
|
|
win.clearTimeout(timer); timer = undefined;
|
|
try { node.hidePopover?.(); } catch { /* Hosts without a popover layer use fixed positioning. */ }
|
|
node.hidden = true;
|
|
}
|
|
return {
|
|
show(text: string) {
|
|
clear(); if (!node.isConnected) root.append(node);
|
|
node.textContent = text; node.hidden = false;
|
|
try { node.showPopover?.(); } catch { /* Keep the fixed-position fallback visible. */ }
|
|
timer = win.setTimeout(clear, 3000);
|
|
},
|
|
clear,
|
|
destroy() { clear(); node.remove(); },
|
|
};
|
|
}
|