@abgin/abgin 0.1.0 → 0.1.2
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/README.md +7 -8
- package/dist/abgin.js +2 -2
- package/dist/abgin.js.map +1 -1
- package/dist/chunks/{appbar-LLcnVLph.js → appbar-qrxjDiTR.js} +3 -3
- package/dist/chunks/{appbar-LLcnVLph.js.map → appbar-qrxjDiTR.js.map} +1 -1
- package/dist/chunks/{behavior-PpBNSUmo.js → behavior-DcTSsbjM.js} +2 -2
- package/dist/chunks/{behavior-PpBNSUmo.js.map → behavior-DcTSsbjM.js.map} +1 -1
- package/dist/chunks/{dialog-wNqzWPiS.js → dialog-YuGr7AZw.js} +3 -3
- package/dist/chunks/{dialog-wNqzWPiS.js.map → dialog-YuGr7AZw.js.map} +1 -1
- package/dist/chunks/{direction-BDKiHYas.js → direction-JCXVGRGq.js} +2 -2
- package/dist/chunks/{direction-BDKiHYas.js.map → direction-JCXVGRGq.js.map} +1 -1
- package/dist/chunks/drawer-V2-RJZaj.js +3 -0
- package/dist/chunks/{drawer-ZmlA-nWk.js.map → drawer-V2-RJZaj.js.map} +1 -1
- package/dist/chunks/{dropdown-BAvgXY5r.js → dropdown-BsSoDo4Z.js} +3 -3
- package/dist/chunks/{dropdown-BAvgXY5r.js.map → dropdown-BsSoDo4Z.js.map} +1 -1
- package/dist/chunks/{engine-CLGg6TrP.js → engine-DOFQfCtE.js} +3 -3
- package/dist/chunks/{engine-CLGg6TrP.js.map → engine-DOFQfCtE.js.map} +1 -1
- package/dist/chunks/{focus-BezZcM_N.js → focus-BNE6ytl8.js} +3 -3
- package/dist/chunks/{focus-BezZcM_N.js.map → focus-BNE6ytl8.js.map} +1 -1
- package/dist/chunks/{glass-CrY_zpD7.js → glass-9XMne6tP.js} +3 -3
- package/dist/chunks/{glass-CrY_zpD7.js.map → glass-9XMne6tP.js.map} +1 -1
- package/dist/chunks/modal-GUayszcw.js +3 -0
- package/dist/chunks/{modal-COcRYmWk.js.map → modal-GUayszcw.js.map} +1 -1
- package/dist/chunks/{motion-scene-BDU70ceZ.js → motion-scene-BNPBmw5W.js} +3 -3
- package/dist/chunks/{motion-scene-BDU70ceZ.js.map → motion-scene-BNPBmw5W.js.map} +1 -1
- package/dist/chunks/{optics-Dfs-jab-.js → optics-BSQ3SSNg.js} +2 -2
- package/dist/chunks/{optics-Dfs-jab-.js.map → optics-BSQ3SSNg.js.map} +1 -1
- package/dist/chunks/{overlay-C7vi0Jzf.js → overlay-CKgXnT5J.js} +3 -3
- package/dist/chunks/{overlay-C7vi0Jzf.js.map → overlay-CKgXnT5J.js.map} +1 -1
- package/dist/chunks/popover-CMbdxv9C.js +3 -0
- package/dist/chunks/{popover-CEIndATO.js.map → popover-CMbdxv9C.js.map} +1 -1
- package/dist/chunks/{position-Bf9Bk3ZK.js → position-Bx0n9Xgs.js} +3 -3
- package/dist/chunks/{position-Bf9Bk3ZK.js.map → position-Bx0n9Xgs.js.map} +1 -1
- package/dist/chunks/{sheet-C6pSKe8a.js → sheet-Dje0MQib.js} +3 -3
- package/dist/chunks/{sheet-C6pSKe8a.js.map → sheet-Dje0MQib.js.map} +1 -1
- package/dist/chunks/{sidebar-CF_I9jqC.js → sidebar-DA1aYsdf.js} +3 -3
- package/dist/chunks/{sidebar-CF_I9jqC.js.map → sidebar-DA1aYsdf.js.map} +1 -1
- package/dist/chunks/{tabbar-CRHZitw_.js → tabbar-B2BkNJJw.js} +3 -3
- package/dist/chunks/{tabbar-CRHZitw_.js.map → tabbar-B2BkNJJw.js.map} +1 -1
- package/dist/chunks/{tabs-1jFkGW6D.js → tabs-CUFBy_Bw.js} +3 -3
- package/dist/chunks/{tabs-1jFkGW6D.js.map → tabs-CUFBy_Bw.js.map} +1 -1
- package/dist/chunks/{toast-Cazk1MoR.js → toast-YwwbcxDG.js} +3 -3
- package/dist/chunks/{toast-Cazk1MoR.js.map → toast-YwwbcxDG.js.map} +1 -1
- package/dist/chunks/{toolbar-DJnAyNIW.js → toolbar-BxJFkGlB.js} +3 -3
- package/dist/chunks/{toolbar-DJnAyNIW.js.map → toolbar-BxJFkGlB.js.map} +1 -1
- package/dist/chunks/{tooltip-D-ySWdJM.js → tooltip-COC1Ta6M.js} +3 -3
- package/dist/chunks/{tooltip-D-ySWdJM.js.map → tooltip-COC1Ta6M.js.map} +1 -1
- package/dist/chunks/{webgl-backend-aGPldzh7.js → webgl-backend-BE1U7Yp0.js} +3 -3
- package/dist/chunks/{webgl-backend-aGPldzh7.js.map → webgl-backend-BE1U7Yp0.js.map} +1 -1
- package/dist/css/abgin.css +1 -1
- package/dist/css/background.css +1 -1
- package/dist/css/base.css +1 -1
- package/dist/css/components/accordion.css +1 -1
- package/dist/css/components/alert.css +1 -1
- package/dist/css/components/appbar.css +1 -1
- package/dist/css/components/badge.css +1 -1
- package/dist/css/components/breadcrumbs.css +1 -1
- package/dist/css/components/button.css +1 -1
- package/dist/css/components/card.css +1 -1
- package/dist/css/components/checkbox.css +1 -1
- package/dist/css/components/code.css +1 -1
- package/dist/css/components/divider.css +1 -1
- package/dist/css/components/drawer.css +1 -1
- package/dist/css/components/dropdown.css +1 -1
- package/dist/css/components/field.css +1 -1
- package/dist/css/components/icon.css +1 -1
- package/dist/css/components/input.css +1 -1
- package/dist/css/components/join.css +1 -1
- package/dist/css/components/kbd.css +1 -1
- package/dist/css/components/link.css +1 -1
- package/dist/css/components/list.css +1 -1
- package/dist/css/components/menu.css +1 -1
- package/dist/css/components/modal.css +1 -1
- package/dist/css/components/navbar.css +1 -1
- package/dist/css/components/pagination.css +1 -1
- package/dist/css/components/popover.css +1 -1
- package/dist/css/components/progress.css +1 -1
- package/dist/css/components/radio.css +1 -1
- package/dist/css/components/range.css +1 -1
- package/dist/css/components/search.css +1 -1
- package/dist/css/components/segmented.css +1 -1
- package/dist/css/components/select.css +1 -1
- package/dist/css/components/sheet.css +1 -1
- package/dist/css/components/shell.css +1 -1
- package/dist/css/components/sidebar.css +1 -1
- package/dist/css/components/spinner.css +1 -1
- package/dist/css/components/tabbar.css +1 -1
- package/dist/css/components/table.css +1 -1
- package/dist/css/components/tabs.css +1 -1
- package/dist/css/components/textarea.css +1 -1
- package/dist/css/components/toast.css +1 -1
- package/dist/css/components/toggle.css +1 -1
- package/dist/css/components/toolbar.css +1 -1
- package/dist/css/components/tooltip.css +1 -1
- package/dist/css/glass/appbar.css +1 -1
- package/dist/css/glass/base.css +1 -1
- package/dist/css/glass/button.css +1 -1
- package/dist/css/glass/card.css +1 -1
- package/dist/css/glass/checkbox.css +1 -1
- package/dist/css/glass/drawer.css +1 -1
- package/dist/css/glass/dropdown.css +1 -1
- package/dist/css/glass/join.css +1 -1
- package/dist/css/glass/modal.css +1 -1
- package/dist/css/glass/navbar.css +1 -1
- package/dist/css/glass/popover.css +1 -1
- package/dist/css/glass/radio.css +1 -1
- package/dist/css/glass/range.css +1 -1
- package/dist/css/glass/search.css +1 -1
- package/dist/css/glass/segmented.css +1 -1
- package/dist/css/glass/sheet.css +1 -1
- package/dist/css/glass/sidebar.css +1 -1
- package/dist/css/glass/tabbar.css +1 -1
- package/dist/css/glass/tabs.css +1 -1
- package/dist/css/glass/toast.css +1 -1
- package/dist/css/glass/toggle.css +1 -1
- package/dist/css/glass/toolbar.css +1 -1
- package/dist/css/glass/tooltip.css +1 -1
- package/dist/css/glass/vivid.css +1 -1
- package/dist/css/glass.css +1 -1
- package/dist/css/layers.css +1 -1
- package/dist/css/prose.css +1 -1
- package/dist/css/standard.css +1 -1
- package/dist/css/themes/dark.css +1 -1
- package/dist/css/themes/light.css +1 -1
- package/dist/css/tokens.css +1 -1
- package/dist/css/utilities.css +1 -1
- package/dist/manifest.json +380 -379
- package/package.json +5 -5
- package/dist/chunks/drawer-ZmlA-nWk.js +0 -3
- package/dist/chunks/modal-COcRYmWk.js +0 -3
- package/dist/chunks/popover-CEIndATO.js +0 -3
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
# abgin
|
|
1
|
+
# @abgin/abgin
|
|
2
2
|
|
|
3
|
-
Use
|
|
3
|
+
Use `@abgin/abgin` to add styles and optional JavaScript behaviors to pages without a bundler. The distribution includes
|
|
4
4
|
minified stylesheets, a browser-ready ES module, and the chunks it loads on demand.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Public npm and CDN distribution require [release approval](../../docs/RELEASE_READINESS.md).
|
|
6
|
+
Install the package with `npm install @abgin/abgin` and copy its `dist/` directory to an `abgin/` directory
|
|
7
|
+
beside your page. For a build from source, use `packages/abgin/dist/`. Serve both over HTTP.
|
|
9
8
|
|
|
10
9
|
## Stylesheets
|
|
11
10
|
|
|
@@ -28,8 +27,8 @@ The CSS styles native elements such as popovers and dialogs. Use the
|
|
|
28
27
|
behaviors, compatibility helpers, and toasts.
|
|
29
28
|
|
|
30
29
|
Add `css/components/code.css`, `css/components/kbd.css`, `css/prose.css`, or `css/background.css` to opt in to
|
|
31
|
-
those styles. The package exports the same files as
|
|
32
|
-
|
|
30
|
+
those styles. The package exports the same files as `@abgin/abgin/components/code.css`, `@abgin/abgin/components/kbd.css`,
|
|
31
|
+
`@abgin/abgin/prose.css`, and `@abgin/abgin/background.css`.
|
|
33
32
|
|
|
34
33
|
## The module
|
|
35
34
|
|
|
@@ -54,7 +53,7 @@ the code for each behavior from the neighboring `chunks/` directory when the pag
|
|
|
54
53
|
`start({ glass: true })`. The engine starts when a visible surface and the device meet its loading conditions.
|
|
55
54
|
Tests can opt in to software rendering with `start({ glass: { allowSoftware: true } })`.
|
|
56
55
|
- A local [Background scene](../../docs/BACKGROUND.md#using-the-image-with-optical-glass) can use its visible image
|
|
57
|
-
or picture as a backdrop source. Load
|
|
56
|
+
or picture as a backdrop source. Load `@abgin/abgin/background.css` explicitly and put `data-backdrop-source` on the
|
|
58
57
|
media. Unsupported compositions use CSS Glass.
|
|
59
58
|
- Keep `chunks/` beside `abgin.js` when copying or serving the distribution.
|
|
60
59
|
|
package/dist/abgin.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @abgin/abgin 0.1.
|
|
2
|
-
var e=class extends Error{name=`LifecycleDisposedError`;constructor(e=`The lifecycle scope was disposed.`,t){super(e,t)}};function
|
|
1
|
+
/*! @abgin/abgin 0.1.2 | MIT License */
|
|
2
|
+
var e=`0.1.2`,t=class extends Error{name=`LifecycleDisposedError`;constructor(e=`The lifecycle scope was disposed.`,t){super(e,t)}};function n(e){return e instanceof t}function r(e){`disconnect`in e?e.disconnect():e.dispose()}function i(e){let n=new AbortController,a=/* @__PURE__ */ new Set,o=!1,s=()=>o;async function c(e,r={}){if(o)throw new t(`The scope was disposed before the work started.`);let i;try{i=await(typeof e==`function`?e(n.signal):e)}catch(e){throw s()?new t(`The scope was disposed while the work ran.`,{cause:e}):e}if(s()){let e;try{r.discard?.(i)}catch(t){e=t}throw new t(`The scope was disposed before the result could be used.`,e===void 0?void 0:{cause:e})}return i}let l={get disposed(){return o},get signal(){return n.signal},onDispose(e){if(o)return e(),()=>{};let t=()=>{e()};return a.add(t),()=>{a.delete(t)}},listen(e,t,r,i){if(o)return()=>{};let a=typeof i==`boolean`?i:!!i?.capture,s=typeof i==`object`?i:{capture:a};e.addEventListener(t,r,{...s,signal:n.signal});let c=l.onDispose(()=>{e.removeEventListener(t,r,a)});return()=>{e.removeEventListener(t,r,a),c()}},track(e){return l.onDispose(()=>{r(e)}),e},settle:c,child(){return i(l)},dispose(){if(o)return;o=!0,n.abort(new t);let e=[];for(let t of[...a].reverse())try{t()}catch(t){e.push(t)}if(a.clear(),e.length)throw AggregateError(e,`One or more cleanups failed during disposal.`)}};if(e){let t=e.onDispose(()=>{l.dispose()});l.onDispose(t)}return l}function a(e){return!(`isConnected`in e)||e.isConnected!==!1}function o(e,t={}){let n=/* @__PURE__ */ new Map,r=i(t.parent),o=e=>{let t=n.get(e);return t?(t.dispose(),!0):!1};return{mount(t){if(r.disposed||n.has(t))return!1;let i=r.child();i.onDispose(()=>{n.get(t)===i&&n.delete(t)}),n.set(t,i);try{e(t,i)}catch(e){throw n.delete(t),i.dispose(),e}return!0},unmount:o,isMounted(e){return n.has(e)},prune(e=a){let t=[],r=0;for(let i of[...n.keys()])if(!e(i)){r++;try{o(i)}catch(e){t.push(e)}}if(t.length)throw AggregateError(t,`One or more elements failed to unmount while pruning.`);return r},get size(){return n.size},get disposed(){return r.disposed},dispose(){r.dispose()}}}const s=[`standard`,`glass`],c=[`lite`,`balanced`,`ultra`,`auto`],l=Object.freeze({appearance:`standard`,theme:`auto`,quality:`auto`,material:`regular`,direction:`ltr`}),u=Object.freeze({dark:`(prefers-color-scheme: dark)`,reducedMotion:`(prefers-reduced-motion: reduce)`,reducedTransparency:`(prefers-reduced-transparency: reduce)`,moreContrast:`(prefers-contrast: more)`,forcedColors:`(forced-colors: active)`}),d=/^[a-z][a-z0-9-]*$/,f=/^(?:[a-z][a-z0-9]*-)?$/;function p(e){if(!f.test(e))throw TypeError(`Invalid Abgin prefix "${e}": use lowercase letters and digits ending in "-", or "".`);return e}function m(e,t=``){return`data-${p(t)}${e}`}function h(e){return s.includes(e)}function g(e){return c.includes(e)}function _(e){return d.test(e)}function v(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode?.();return t&&t!==e&&t.host?t.host:null}function*y(e){for(let t=e;t;t=v(t))yield t}function b(e,t,n){for(let r of y(e)){let e=r.getAttribute(t);if(e!==null&&n(e))return e}}function x(e,t){for(let n of y(e))if(n.getAttribute(t)===`reduced`)return!0;return!1}function S(e){let t=globalThis.matchMedia;return typeof t==`function`&&t.call(globalThis,e).matches}function C(e){let t=globalThis.getComputedStyle;return typeof t==`function`?t.call(globalThis,e).direction:void 0}function w(e,t){for(let n of y(e)){let r=n.getAttribute(`dir`)?.toLowerCase();if(r===`ltr`||r===`rtl`)return r;if(r===`auto`)return(t.computedDirection??C)(e)===`rtl`?`rtl`:`ltr`}return l.direction}function T(e,t={}){let n=t.prefix??``,r=t.media??S,i=b(e,m(`theme`,n),_)??l.theme,a=i===`light`||i===`dark`?i:i===`auto`?r(u.dark)?`dark`:`light`:null;return{appearance:b(e,m(`appearance`,n),h)??l.appearance,theme:i,colorScheme:a,direction:w(e,t),quality:b(e,m(`quality`,n),g)??l.quality,material:b(e,m(`material`,n),_)??l.material,reducedTransparency:x(e,m(`transparency`,n))||r(u.reducedTransparency)||r(u.moreContrast),reducedMotion:x(e,m(`motion`,n))||r(u.reducedMotion)}}function E(e){let t=globalThis,n=e??t.document?.documentElement;if(!n||typeof t.getComputedStyle!=`function`)return``;let r=t.getComputedStyle.call(globalThis,n).getPropertyValue(`--ab-prefix`).trim().replace(/^(["'])(.*)\1$/,`$2`);return f.test(r)?r:``}const D={appbar:[`appbar`,async()=>(await import(`./chunks/appbar-qrxjDiTR.js`)).appbar],sidebar:[`sidebar`,async()=>(await import(`./chunks/sidebar-DA1aYsdf.js`)).sidebar],tabbar:[`tabbar-dock`,async()=>(await import(`./chunks/tabbar-B2BkNJJw.js`)).tabbar],tabs:[`tabs`,async()=>(await import(`./chunks/tabs-CUFBy_Bw.js`)).tabs],toolbar:[`toolbar`,async()=>(await import(`./chunks/toolbar-BxJFkGlB.js`)).toolbar]},O={dropdown:[`dropdown-menu`,async()=>(await import(`./chunks/dropdown-BsSoDo4Z.js`)).dropdown],popover:[`popover`,async()=>(await import(`./chunks/popover-CMbdxv9C.js`)).popover],tooltip:[`tooltip`,async()=>(await import(`./chunks/tooltip-COC1Ta6M.js`)).tooltip],modal:[`modal`,async()=>(await import(`./chunks/modal-GUayszcw.js`)).modal],drawer:[`drawer`,async()=>(await import(`./chunks/drawer-V2-RJZaj.js`)).drawer],sheet:[`sheet`,async()=>(await import(`./chunks/sheet-Dje0MQib.js`)).sheet]};function k(e,t=document,r={}){let i=E((t.ownerDocument??t).documentElement),a=r.onError??(e=>{console.error(`Abgin:`,e)}),o=e=>`.${i}${e}`,s=/* @__PURE__ */ new Map,c=/* @__PURE__ */ new Set,l=/* @__PURE__ */ new Map,u=[...Object.values(O),...Object.values(D)].map(([e])=>o(e)).join(`, `),d=async e=>{try{await e}catch(e){n(e)||a(e)}},f=async n=>{let r=await e.settle(n());r.mount(t),e.onDispose(()=>{r.unmount(t)})},p=async(t,n,r)=>{let i=s.get(t);i||s.set(t,i=e.settle(n()));let a=await i;if(e.disposed)return;let c=o(D[t]?.[0]??t);for(let e of r){if(!e.isConnected||!e.matches(c)||a.isMounted(e))continue;a.mount(e);let n=l.get(e);n||l.set(e,n=/* @__PURE__ */ new Map),n.set(t,a)}},m=e=>{let t=[];for(let[n,[r,i]]of Object.entries(O))!c.has(n)&&A(e,o(r)).length&&(c.add(n),t.push(d(f(i))));for(let[n,[r,i]]of Object.entries(D)){let a=A(e,o(r));a.length&&t.push(d(p(n,i,a)))}return t},h=e=>{for(let[t,n]of e?[[e,l.get(e)]]:[...l])if(n){for(let[e,r]of n){let i=D[e]?.[0]??e;t.isConnected&&t.matches(o(i))||(r.unmount(t),n.delete(e))}n.size||l.delete(t)}};return e.track(new MutationObserver(e=>{let t=!1;for(let n of e)if(n.type===`attributes`){let e=n.target;l.has(e)&&h(e),e.isConnected&&e.matches(u)&&Promise.all(m(e))}else{t||=n.removedNodes.length>0;for(let e of n.addedNodes)e.nodeType===1&&Promise.all(m(e))}t&&h()})).observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`]}),e.onDispose(()=>{for(let[e,t]of l)for(let n of t.values())n.unmount(e);l.clear()}),{ready:Promise.all(m(t)).then(()=>void 0),async refresh(n=t){if(!e.disposed){h();for(let[e,t]of l)if(e===n||n.contains(e)){for(let n of t.values())n.unmount(e);l.delete(e)}await Promise.all(m(n))}}}}function A(e,t){let n=[...e.querySelectorAll(t)];return e instanceof HTMLElement&&e.matches(t)?[e,...n]:n}const j=e;function M(e={}){let t=e.root??document,n=N.get(t);if(n)return n;let r=i(),a=e.onError??(e=>{console.error(`Abgin:`,e)}),o=k(r,t,{onError:a}),s=e.glass;if(s){let e=s===!0?{}:s;r.settle(import(`./chunks/glass-9XMne6tP.js`).then(e=>e.t)).then(({startGlass:n})=>{n(r,t,e,a)}).catch(e=>{r.disposed||a(e)})}let c={ready:o.ready,refresh:e=>o.refresh(e),async toaster(e={}){let{createToaster:n}=await r.settle(import(`./chunks/toast-YwwbcxDG.js`)),i=t.ownerDocument??t;return n(r,{...e,document:i})},stop(){N.get(t)===c&&N.delete(t),r.dispose()}};return N.set(t,c),c}const N=/* @__PURE__ */ new WeakMap;export{T as a,i as c,E as i,n as l,p as n,t as o,m as r,o as s,M as start,u as t,j as version};
|
|
3
3
|
//# sourceMappingURL=abgin.js.map
|
package/dist/abgin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abgin.js","names":["LifecycleDisposedError","message","options","isDisposedError","error","release","resource","createScope","parent","controller","cleanups","disposed","isDisposed","settle","work","value","failure","scope","cleanup","entry","target","type","listener","capture","base","unregister","errors","isConnected","element","createMountRegistry","setup","scopes","own","unmount","isAttached","count","APPEARANCES","QUALITIES","DEFAULTS","MEDIA","NAME","PREFIX","assertPrefix","prefix","attributeName","dimension","isAppearance","isQuality","isName","parentOf","node","root","ancestry","n","nearest","name","accept","reducedByAttribute","defaultMedia","query","match","defaultComputedDirection","computed","resolveDirection","resolve","media","theme","colorScheme","readPrefix","g","ELEMENTS","ROOTS","autoInit","report","selector","cls","loading","roots","mounted","any","guard","mountRoot","load","behavior","mountAll","found","loaded","scan","matching","only","records","removed","record","inside","version","start","running","instances","auto","glass","settings","startGlass","app","toasterOptions","createToaster","doc"],"sources":["../../core/dist/lifecycle.js","../../core/dist/config.js","../../ui/dist/auto.js","../src/index.ts"],"sourcesContent":["// Lifecycle primitives (ARCHITECTURE.md section 6.2, BUILD_AND_DISTRIBUTION.md section 8.6).\n//\n// A scope owns everything a behavior or engine creates: event listeners, observers, child scopes, and\n// pending asynchronous work. Disposing it is idempotent and releases all of them. Work that completes after\n// disposal is discarded and can never initialize anything: `settle()` rejects with `LifecycleDisposedError`\n// and hands a late result to its `discard` callback. The glass loader uses this contract to release an\n// engine that completes startup after the loader closes.\n/** Rejection reason of work that a disposed scope no longer accepts. */\nexport class LifecycleDisposedError extends Error {\n name = \"LifecycleDisposedError\";\n constructor(message = \"The lifecycle scope was disposed.\", options) {\n super(message, options);\n }\n}\nexport function isDisposedError(error) {\n return error instanceof LifecycleDisposedError;\n}\nfunction release(resource) {\n if (\"disconnect\" in resource)\n resource.disconnect();\n else\n resource.dispose();\n}\nexport function createScope(parent) {\n const controller = new AbortController();\n const cleanups = new Set();\n let disposed = false;\n // Read through a function: `disposed` changes while settle() awaits, which control-flow narrowing ignores.\n const isDisposed = () => disposed;\n async function settle(work, options = {}) {\n if (disposed)\n throw new LifecycleDisposedError(\"The scope was disposed before the work started.\");\n let value;\n try {\n value = await (typeof work === \"function\" ? work(controller.signal) : work);\n }\n catch (error) {\n if (isDisposed())\n throw new LifecycleDisposedError(\"The scope was disposed while the work ran.\", { cause: error });\n throw error;\n }\n if (isDisposed()) {\n let failure;\n try {\n options.discard?.(value);\n }\n catch (error) {\n failure = error;\n }\n const message = \"The scope was disposed before the result could be used.\";\n throw new LifecycleDisposedError(message, failure === undefined ? undefined : { cause: failure });\n }\n return value;\n }\n const scope = {\n get disposed() {\n return disposed;\n },\n get signal() {\n return controller.signal;\n },\n onDispose(cleanup) {\n if (disposed) {\n cleanup();\n return () => { };\n }\n // A wrapper keeps registrations distinct even when the same function is registered twice.\n const entry = () => {\n cleanup();\n };\n cleanups.add(entry);\n return () => {\n cleanups.delete(entry);\n };\n },\n listen(target, type, listener, options) {\n if (disposed)\n return () => { };\n const capture = typeof options === \"boolean\" ? options : Boolean(options?.capture);\n const base = typeof options === \"object\" ? options : { capture };\n target.addEventListener(type, listener, { ...base, signal: controller.signal });\n const unregister = scope.onDispose(() => {\n target.removeEventListener(type, listener, capture);\n });\n return () => {\n target.removeEventListener(type, listener, capture);\n unregister();\n };\n },\n track(resource) {\n scope.onDispose(() => {\n release(resource);\n });\n return resource;\n },\n settle,\n child() {\n return createScope(scope);\n },\n dispose() {\n if (disposed)\n return;\n disposed = true;\n controller.abort(new LifecycleDisposedError());\n const errors = [];\n for (const cleanup of [...cleanups].reverse()) {\n try {\n cleanup();\n }\n catch (error) {\n errors.push(error);\n }\n }\n cleanups.clear();\n if (errors.length)\n throw new AggregateError(errors, \"One or more cleanups failed during disposal.\");\n },\n };\n if (parent) {\n const unregister = parent.onDispose(() => {\n scope.dispose();\n });\n scope.onDispose(unregister);\n }\n return scope;\n}\n/** Default `prune()` test: objects without `isConnected` count as attached. */\nfunction isConnected(element) {\n return !(\"isConnected\" in element) || element.isConnected !== false;\n}\n/**\n * Idempotent mounting of a behavior: each element gets one scope; `mount()` twice is a no-op, `unmount()`\n * releases everything `setup` registered on the scope. If `setup` throws, the scope is released and the\n * element stays unmounted.\n */\nexport function createMountRegistry(setup, options = {}) {\n const scopes = new Map();\n // Element scopes are children of the registry's scope, so disposing the registry (directly or through\n // `options.parent`) disposes each element in its own try/catch: one failing cleanup cannot stop the rest.\n const own = createScope(options.parent);\n const unmount = (element) => {\n const scope = scopes.get(element);\n if (!scope)\n return false;\n scope.dispose();\n return true;\n };\n return {\n mount(element) {\n if (own.disposed || scopes.has(element))\n return false;\n const scope = own.child();\n // Registered before setup runs, so it runs after the behavior's cleanups; a scope runs every cleanup,\n // so the entry is removed even when one of them throws.\n scope.onDispose(() => {\n if (scopes.get(element) === scope)\n scopes.delete(element);\n });\n scopes.set(element, scope);\n try {\n setup(element, scope);\n }\n catch (error) {\n scopes.delete(element);\n scope.dispose();\n throw error;\n }\n return true;\n },\n unmount,\n isMounted(element) {\n return scopes.has(element);\n },\n prune(isAttached = isConnected) {\n const errors = [];\n let count = 0;\n for (const element of [...scopes.keys()]) {\n if (isAttached(element))\n continue;\n count++;\n try {\n unmount(element);\n }\n catch (error) {\n errors.push(error);\n }\n }\n if (errors.length)\n throw new AggregateError(errors, \"One or more elements failed to unmount while pruning.\");\n return count;\n },\n get size() {\n return scopes.size;\n },\n get disposed() {\n return own.disposed;\n },\n dispose() {\n own.dispose();\n },\n };\n}\n//# sourceMappingURL=lifecycle.js.map","// Configuration model (ARCHITECTURE.md section 6.1, DESIGN_TOKENS.md \"Dimensions\").\n//\n// The DOM is the only source of truth: configuration lives in attributes, CSS resolves appearance and theme\n// through custom-property inheritance, and these functions read the same attributes. Nothing here keeps\n// state, and nothing touches a browser global until a function is called, so importing this module is safe\n// in Node.js and in server-rendered pages.\nexport const APPEARANCES = [\"standard\", \"glass\"];\nexport const QUALITIES = [\"lite\", \"balanced\", \"ultra\", \"auto\"];\nexport const PREFERENCES = [\"auto\", \"reduced\"];\nexport const BUILT_IN_THEMES = [\"light\", \"dark\", \"auto\"];\nexport const BUILT_IN_MATERIALS = [\"regular\", \"clear\", \"frosted\", \"vivid\"];\n/** Values in effect when no element sets an attribute. */\nexport const DEFAULTS = Object.freeze({ appearance: \"standard\", theme: \"auto\", quality: \"auto\", material: \"regular\", direction: \"ltr\" });\n/** Media queries that reduce transparency or motion regardless of attributes (D-27: pages can only reduce). */\nexport const MEDIA = Object.freeze({\n dark: \"(prefers-color-scheme: dark)\",\n reducedMotion: \"(prefers-reduced-motion: reduce)\",\n reducedTransparency: \"(prefers-reduced-transparency: reduce)\",\n moreContrast: \"(prefers-contrast: more)\",\n forcedColors: \"(forced-colors: active)\",\n});\n/** Theme and material names follow the class-name rules, so they are safe in attribute selectors. */\nconst NAME = /^[a-z][a-z0-9-]*$/;\nconst PREFIX = /^(?:[a-z][a-z0-9]*-)?$/;\nexport function assertPrefix(prefix) {\n if (!PREFIX.test(prefix)) {\n throw new TypeError(`Invalid Abgin prefix \"${prefix}\": use lowercase letters and digits ending in \"-\", or \"\".`);\n }\n return prefix;\n}\n/** Attribute name of a dimension, with the optional prefix (`dir` is never prefixed). */\nexport function attributeName(dimension, prefix = \"\") {\n return `data-${assertPrefix(prefix)}${dimension}`;\n}\nfunction isAppearance(value) {\n return APPEARANCES.includes(value);\n}\nfunction isQuality(value) {\n return QUALITIES.includes(value);\n}\nfunction isPreference(value) {\n return PREFERENCES.includes(value);\n}\nfunction isName(value) {\n return NAME.test(value);\n}\n/** The parent in the flat tree: shadow roots continue at their host, as CSS inheritance does. */\nfunction parentOf(node) {\n if (node.parentElement)\n return node.parentElement;\n const root = node.getRootNode?.();\n return root && root !== node && root.host ? root.host : null;\n}\n/** Ancestors including the node itself, nearest first. */\nexport function* ancestry(node) {\n for (let n = node; n; n = parentOf(n))\n yield n;\n}\nfunction nearest(node, name, accept) {\n for (const n of ancestry(node)) {\n const value = n.getAttribute(name);\n if (value !== null && accept(value))\n return value;\n }\n return undefined;\n}\n/** Whether the node or an ancestor sets the preference to `reduced` (a nested `auto` cannot undo it). */\nfunction reducedByAttribute(node, name) {\n for (const n of ancestry(node))\n if (n.getAttribute(name) === \"reduced\")\n return true;\n return false;\n}\nfunction defaultMedia(query) {\n const match = globalThis.matchMedia;\n return typeof match === \"function\" ? match.call(globalThis, query).matches : false;\n}\nfunction defaultComputedDirection(node) {\n const computed = globalThis.getComputedStyle;\n return typeof computed === \"function\" ? computed.call(globalThis, node).direction : undefined;\n}\nfunction resolveDirection(node, options) {\n for (const n of ancestry(node)) {\n const value = n.getAttribute(\"dir\")?.toLowerCase();\n if (value === \"ltr\" || value === \"rtl\")\n return value;\n if (value === \"auto\") {\n const computed = (options.computedDirection ?? defaultComputedDirection)(node);\n return computed === \"rtl\" ? \"rtl\" : \"ltr\";\n }\n }\n return DEFAULTS.direction;\n}\n/** Resolves every configuration dimension for an element, as CSS does for the same element. */\nexport function resolve(node, options = {}) {\n const prefix = options.prefix ?? \"\";\n const media = options.media ?? defaultMedia;\n const theme = nearest(node, attributeName(\"theme\", prefix), isName) ?? DEFAULTS.theme;\n const colorScheme = theme === \"light\" || theme === \"dark\" ? theme : theme === \"auto\" ? (media(MEDIA.dark) ? \"dark\" : \"light\") : null;\n return {\n appearance: nearest(node, attributeName(\"appearance\", prefix), isAppearance) ?? DEFAULTS.appearance,\n theme,\n colorScheme,\n direction: resolveDirection(node, options),\n quality: nearest(node, attributeName(\"quality\", prefix), isQuality) ?? DEFAULTS.quality,\n material: nearest(node, attributeName(\"material\", prefix), isName) ?? DEFAULTS.material,\n reducedTransparency: reducedByAttribute(node, attributeName(\"transparency\", prefix)) ||\n media(MEDIA.reducedTransparency) ||\n media(MEDIA.moreContrast),\n reducedMotion: reducedByAttribute(node, attributeName(\"motion\", prefix)) || media(MEDIA.reducedMotion),\n };\n}\nconst CONFIGURABLE = [\n \"appearance\",\n \"theme\",\n \"quality\",\n \"material\",\n \"transparency\",\n \"motion\",\n \"direction\",\n];\nfunction isConfigurable(dimension) {\n return CONFIGURABLE.includes(dimension);\n}\nfunction validate(dimension, value) {\n const ok = typeof value === \"string\" &&\n (dimension === \"appearance\"\n ? isAppearance(value)\n : dimension === \"quality\"\n ? isQuality(value)\n : dimension === \"transparency\" || dimension === \"motion\"\n ? isPreference(value)\n : dimension === \"direction\"\n ? value === \"ltr\" || value === \"rtl\" || value === \"auto\"\n : isName(value));\n if (!ok)\n throw new TypeError(`Invalid value ${JSON.stringify(value)} for ${dimension}.`);\n}\n/**\n * Writes configuration attributes on an element (the document root by default). It keeps no hidden state:\n * the attributes are the configuration, and CSS applies them without JavaScript. It never loads glass code.\n *\n * The prefix, the root, every dimension name, and every value are validated before the first write, so\n * invalid input throws a `TypeError` and leaves the element unchanged. An error thrown by the element itself\n * while an attribute is written (for example by a custom setter) is not rolled back.\n */\nexport function configure(options, target = {}) {\n const prefix = assertPrefix(target.prefix ?? \"\");\n const root = target.root ?? globalThis.document?.documentElement;\n if (!root)\n throw new TypeError(\"configure() needs a root element outside a browser document.\");\n const writes = [];\n for (const [dimension, value] of Object.entries(options)) {\n if (value === undefined)\n continue;\n if (!isConfigurable(dimension))\n throw new TypeError(`Unknown configuration dimension \"${dimension}\".`);\n if (value !== null)\n validate(dimension, value);\n writes.push({ name: dimension === \"direction\" ? \"dir\" : attributeName(dimension, prefix), value });\n }\n for (const { name, value } of writes) {\n if (value === null)\n root.removeAttribute(name);\n else\n root.setAttribute(name, value);\n }\n}\n/**\n * Reads the class prefix that the loaded CSS declares (`--ab-prefix`), so JavaScript and CSS cannot disagree\n * (BUILD_AND_DISTRIBUTION.md section 5). Returns `\"\"` outside a browser or when the CSS sets none.\n */\nexport function readPrefix(root) {\n const g = globalThis;\n const element = root ?? g.document?.documentElement;\n if (!element || typeof g.getComputedStyle !== \"function\")\n return \"\";\n const raw = g.getComputedStyle.call(globalThis, element).getPropertyValue(\"--ab-prefix\").trim();\n const value = raw.replace(/^([\"'])(.*)\\1$/, \"$2\");\n return PREFIX.test(value) ? value : \"\";\n}\n//# sourceMappingURL=config.js.map","// Mounts behaviors by themselves (ARCHITECTURE.md section 6.2, D-99): one observer notices what a page contains, now and\n// later, and each behavior module is loaded the first time something needs it. Elements that are inserted, that gain or lose\n// a component class, and that are removed are followed; `refresh()` reconciles a part of the page that no observer can see\n// (a shadow root, a subtree that was detached while it changed). Optional; applications that know their components import\n// and mount them.\nimport { readPrefix } from \"@abgin/core/config\";\nimport { isDisposedError } from \"@abgin/core/lifecycle\";\n/** Behaviors of single elements, and behaviors that serve a whole root. */\nconst ELEMENTS = {\n appbar: [\"appbar\", async () => (await import(\"./appbar.js\")).appbar],\n sidebar: [\"sidebar\", async () => (await import(\"./sidebar.js\")).sidebar],\n tabbar: [\"tabbar-dock\", async () => (await import(\"./tabbar.js\")).tabbar],\n tabs: [\"tabs\", async () => (await import(\"./tabs.js\")).tabs],\n toolbar: [\"toolbar\", async () => (await import(\"./toolbar.js\")).toolbar],\n};\nconst ROOTS = {\n dropdown: [\"dropdown-menu\", async () => (await import(\"./dropdown.js\")).dropdown],\n popover: [\"popover\", async () => (await import(\"./popover.js\")).popover],\n tooltip: [\"tooltip\", async () => (await import(\"./tooltip.js\")).tooltip],\n modal: [\"modal\", async () => (await import(\"./modal.js\")).modal],\n drawer: [\"drawer\", async () => (await import(\"./drawer.js\")).drawer],\n sheet: [\"sheet\", async () => (await import(\"./sheet.js\")).sheet],\n};\nexport function autoInit(scope, root = document, options = {}) {\n const doc = root.ownerDocument ?? root;\n const prefix = readPrefix(doc.documentElement);\n const report = options.onError ??\n ((error) => {\n console.error(\"Abgin:\", error);\n });\n const selector = (cls) => `.${prefix}${cls}`;\n const loading = new Map();\n const roots = new Set();\n /** Mounted elements and their behaviors, by name. Entries go when the element leaves or loses its class. */\n const mounted = new Map();\n const any = [...Object.values(ROOTS), ...Object.values(ELEMENTS)].map(([cls]) => selector(cls)).join(\", \");\n const guard = async (work) => {\n try {\n await work;\n }\n catch (error) {\n if (!isDisposedError(error))\n report(error);\n }\n };\n const mountRoot = async (load) => {\n const behavior = await scope.settle(load());\n behavior.mount(root);\n scope.onDispose(() => {\n behavior.unmount(root);\n });\n };\n const mountAll = async (name, load, found) => {\n let loaded = loading.get(name);\n if (!loaded)\n loading.set(name, (loaded = scope.settle(load())));\n const behavior = await loaded;\n if (scope.disposed)\n return;\n const cls = selector(ELEMENTS[name]?.[0] ?? name);\n for (const element of found) {\n // Gone again while the module was loaded, no longer a component, or mounted by the application.\n if (!element.isConnected || !element.matches(cls) || behavior.isMounted(element))\n continue;\n behavior.mount(element);\n let own = mounted.get(element);\n if (!own)\n mounted.set(element, (own = new Map()));\n own.set(name, behavior);\n }\n };\n const scan = (node) => {\n const work = [];\n for (const [name, [cls, load]] of Object.entries(ROOTS)) {\n if (roots.has(name) || !matching(node, selector(cls)).length)\n continue;\n roots.add(name);\n work.push(guard(mountRoot(load)));\n }\n for (const [name, [cls, load]] of Object.entries(ELEMENTS)) {\n const found = matching(node, selector(cls));\n if (found.length)\n work.push(guard(mountAll(name, load, found)));\n }\n return work;\n };\n /** Releases what left the page or is no longer the component it was mounted as. A move keeps its element connected. */\n const release = (only) => {\n for (const [element, own] of only ? [[only, mounted.get(only)]] : [...mounted]) {\n if (!own)\n continue;\n for (const [name, behavior] of own) {\n const cls = ELEMENTS[name]?.[0] ?? name;\n if (element.isConnected && element.matches(selector(cls)))\n continue;\n behavior.unmount(element);\n own.delete(name);\n }\n if (!own.size)\n mounted.delete(element);\n }\n };\n const observer = scope.track(new MutationObserver((records) => {\n let removed = false;\n for (const record of records) {\n if (record.type === \"attributes\") {\n // A class changed: the element itself may have become, or stopped being, a component.\n const element = record.target;\n if (mounted.has(element))\n release(element);\n if (element.isConnected && element.matches(any))\n void Promise.all(scan(element));\n continue;\n }\n removed ||= record.removedNodes.length > 0;\n for (const node of record.addedNodes)\n if (node.nodeType === 1)\n void Promise.all(scan(node));\n }\n if (removed)\n release();\n }));\n observer.observe(root, { childList: true, subtree: true, attributes: true, attributeFilter: [\"class\"] });\n scope.onDispose(() => {\n for (const [element, own] of mounted)\n for (const behavior of own.values())\n behavior.unmount(element);\n mounted.clear();\n });\n return {\n ready: Promise.all(scan(root)).then(() => undefined),\n async refresh(node = root) {\n if (scope.disposed)\n return;\n release();\n // Mounted anew: a behavior that holds a part a framework replaced takes the new one.\n for (const [element, own] of mounted) {\n if (element !== node && !node.contains(element))\n continue;\n for (const behavior of own.values())\n behavior.unmount(element);\n mounted.delete(element);\n }\n await Promise.all(scan(node));\n },\n };\n}\nfunction matching(node, selector) {\n const inside = [...node.querySelectorAll(selector)];\n return node instanceof HTMLElement && node.matches(selector) ? [node, ...inside] : inside;\n}\n//# sourceMappingURL=auto.js.map","// `abgin`: the standalone distribution (D-100). One function starts what a page asks for: the behaviors of the components it\n// contains, each loaded the first time it is needed, and, only when `glass` is set, the glass loader, which imports the engine\n// only where a glass surface needs it. Importing this module does nothing. The types are declared here, so the bundle needs\n// no other package.\n\nimport { createScope } from \"@abgin/core/lifecycle\";\nimport { autoInit } from \"@abgin/ui/auto\";\n\nexport interface GlassStartOptions {\n /** Accepts software WebGL renderers, which are slow; for tests and continuous integration. */\n readonly allowSoftware?: boolean;\n /** Moves the mark of tabs and expands panels on the GPU where the engine draws them (default `true`). */\n readonly componentMotion?: boolean;\n}\n\nexport interface StartOptions {\n /** Where components are: the document, or a shadow root (default: the document). */\n readonly root?: Document | ShadowRoot;\n /** Loads the GPU glass engine where a glass surface needs it. CSS glass (`data-appearance=\"glass\"`) needs none of this. */\n readonly glass?: boolean | GlassStartOptions;\n /** Receives errors of loading and starting; by default they are logged. */\n readonly onError?: (error: unknown) => void;\n}\n\nexport type ToastColor = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface ToastOptions {\n readonly message: string;\n readonly title?: string;\n readonly color?: ToastColor;\n /** Milliseconds it stays, or `Infinity`. Default: 6000, and `Infinity` with an action. */\n readonly duration?: number;\n /** A button; it closes the toast unless the handler returns `false`. */\n readonly action?: { readonly label: string; readonly onClick: () => unknown };\n /** Label of the button that closes it; `null` for none (only with a duration). */\n readonly dismissLabel?: string | null;\n /** Interrupts assistive technology; errors do by default. */\n readonly assertive?: boolean;\n readonly onClose?: () => void;\n}\n\nexport interface ToasterOptions {\n /** `<block side> <inline alignment>`, default `block-end end`. */\n readonly placement?: string;\n /** Toasts shown at once; the others wait (default 3). */\n readonly max?: number;\n readonly label?: string;\n readonly dismissLabel?: string;\n readonly duration?: number;\n /** The element the region is in, for its theme, appearance, and direction (default: the body). */\n readonly container?: HTMLElement;\n}\n\nexport interface Toast {\n readonly element: HTMLElement | null;\n readonly closed: boolean;\n close(): void;\n}\n\nexport interface Toaster {\n show(options: ToastOptions | string): Toast;\n clear(): void;\n readonly shown: number;\n readonly waiting: number;\n}\n\nexport interface Abgin {\n /** Resolves when the behaviors of what the page contained at the start are mounted. */\n readonly ready: Promise<void>;\n /** Mounts what a part of the page contains and releases what left it (see `@abgin/ui/auto`). */\n refresh(node?: ParentNode): Promise<void>;\n /** A toaster that is closed with the rest; its module is loaded on the first call. */\n toaster(options?: ToasterOptions): Promise<Toaster>;\n /** Releases every behavior, observer, toaster, and the glass engine. Idempotent. */\n stop(): void;\n}\n\nexport const version: string = \"0.1.0\";\n\n/** Starts Abgin for a document. Calling it again for the same root returns the running instance. */\nexport function start(options: StartOptions = {}): Abgin {\n const root = options.root ?? document;\n const running = instances.get(root);\n if (running) return running;\n const scope = createScope();\n const report =\n options.onError ??\n ((error: unknown) => {\n console.error(\"Abgin:\", error);\n });\n const auto = autoInit(scope, root, { onError: report });\n const glass = options.glass;\n if (glass) {\n const settings: GlassStartOptions = glass === true ? {} : glass;\n void scope\n .settle(import(\"./glass.ts\"))\n .then(({ startGlass }) => {\n startGlass(scope, root, settings, report);\n })\n .catch((error: unknown) => {\n if (!scope.disposed) report(error);\n });\n }\n const app: Abgin = {\n ready: auto.ready,\n refresh: (node) => auto.refresh(node),\n async toaster(toasterOptions = {}) {\n const { createToaster } = await scope.settle(import(\"@abgin/ui/toast\"));\n const doc = root.ownerDocument ?? root;\n return createToaster(scope, { ...toasterOptions, document: doc });\n },\n stop() {\n if (instances.get(root) === app) instances.delete(root);\n scope.dispose();\n },\n };\n instances.set(root, app);\n return app;\n}\n\nconst instances = new WeakMap<Document | ShadowRoot, Abgin>();\n"],"mappings":";AAQA,IAAaA,EAAb,cAA4C,KAAM,CAC9C,KAAO,yBACP,YAAYC,EAAU,oCAAqCC,EAAS,CAChE,MAAMD,EAASC,CAAO,CAC1B,CACJ,EACA,SAAgBC,EAAgBC,EAAO,CACnC,OAAOA,aAAiBJ,CAC5B,CACA,SAASK,EAAQC,EAAU,CACnB,eAAgBA,EAChBA,EAAS,WAAW,EAEpBA,EAAS,QAAQ,CACzB,CACA,SAAgBC,EAAYC,EAAQ,CAChC,IAAMC,EAAa,IAAI,gBACjBC,kBAAW,IAAI,IACjBC,EAAW,GAETC,MAAmBD,EACzB,eAAeE,EAAOC,EAAMZ,EAAU,CAAC,EAAG,CACtC,GAAIS,EACA,MAAM,IAAIX,EAAuB,iDAAiD,EACtF,IAAIe,EACJ,GAAI,CACAA,EAAQ,MAAO,OAAOD,GAAS,WAAaA,EAAKL,EAAW,MAAM,EAAIK,EAC1E,OACOV,EAAO,CAGV,MAFIQ,EAAW,EACL,IAAIZ,EAAuB,6CAA8C,CAAE,MAAOI,CAAM,CAAC,EAC7FA,CACV,CACA,GAAIQ,EAAW,EAAG,C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F,EAAgB,SAAUE,CAAI,CAAC,CAClE,EACA,MAAO,CACDR,EAAU,IAAI9C,CAAI,IAAMmD,GAAKL,EAAU,OAAO9C,CAAI,EACtDlC,EAAM,QAAQ,CAChB,CACF,EAEA,OADAgF,EAAU,IAAI9C,EAAMmD,CAAG,EAChBA,CACT,CAEA,MAAML,kBAAY,IAAI,Q"}
|
|
1
|
+
{"version":3,"file":"abgin.js","names":["packageManifest.version","version$1","LifecycleDisposedError","message","options","isDisposedError","error","release","resource","createScope","parent","controller","cleanups","disposed","isDisposed","settle","work","value","failure","scope","cleanup","entry","target","type","listener","capture","base","unregister","errors","isConnected","element","createMountRegistry","setup","scopes","own","unmount","isAttached","count","APPEARANCES","QUALITIES","DEFAULTS","MEDIA","NAME","PREFIX","assertPrefix","prefix","attributeName","dimension","isAppearance","isQuality","isName","parentOf","node","root","ancestry","n","nearest","name","accept","reducedByAttribute","defaultMedia","query","match","defaultComputedDirection","computed","resolveDirection","resolve","media","theme","colorScheme","readPrefix","g","ELEMENTS","ROOTS","autoInit","report","selector","cls","loading","roots","mounted","any","guard","mountRoot","load","behavior","mountAll","found","loaded","scan","matching","only","records","removed","record","inside","version","start","running","instances","auto","glass","settings","startGlass","app","toasterOptions","createToaster","doc"],"sources":["../package.json","../../core/dist/lifecycle.js","../../core/dist/config.js","../../ui/dist/auto.js","../src/index.ts"],"sourcesContent":["","// Lifecycle primitives (ARCHITECTURE.md section 6.2, BUILD_AND_DISTRIBUTION.md section 8.6).\n//\n// A scope owns everything a behavior or engine creates: event listeners, observers, child scopes, and\n// pending asynchronous work. Disposing it is idempotent and releases all of them. Work that completes after\n// disposal is discarded and can never initialize anything: `settle()` rejects with `LifecycleDisposedError`\n// and hands a late result to its `discard` callback. The glass loader uses this contract to release an\n// engine that completes startup after the loader closes.\n/** Rejection reason of work that a disposed scope no longer accepts. */\nexport class LifecycleDisposedError extends Error {\n name = \"LifecycleDisposedError\";\n constructor(message = \"The lifecycle scope was disposed.\", options) {\n super(message, options);\n }\n}\nexport function isDisposedError(error) {\n return error instanceof LifecycleDisposedError;\n}\nfunction release(resource) {\n if (\"disconnect\" in resource)\n resource.disconnect();\n else\n resource.dispose();\n}\nexport function createScope(parent) {\n const controller = new AbortController();\n const cleanups = new Set();\n let disposed = false;\n // Read through a function: `disposed` changes while settle() awaits, which control-flow narrowing ignores.\n const isDisposed = () => disposed;\n async function settle(work, options = {}) {\n if (disposed)\n throw new LifecycleDisposedError(\"The scope was disposed before the work started.\");\n let value;\n try {\n value = await (typeof work === \"function\" ? work(controller.signal) : work);\n }\n catch (error) {\n if (isDisposed())\n throw new LifecycleDisposedError(\"The scope was disposed while the work ran.\", { cause: error });\n throw error;\n }\n if (isDisposed()) {\n let failure;\n try {\n options.discard?.(value);\n }\n catch (error) {\n failure = error;\n }\n const message = \"The scope was disposed before the result could be used.\";\n throw new LifecycleDisposedError(message, failure === undefined ? undefined : { cause: failure });\n }\n return value;\n }\n const scope = {\n get disposed() {\n return disposed;\n },\n get signal() {\n return controller.signal;\n },\n onDispose(cleanup) {\n if (disposed) {\n cleanup();\n return () => { };\n }\n // A wrapper keeps registrations distinct even when the same function is registered twice.\n const entry = () => {\n cleanup();\n };\n cleanups.add(entry);\n return () => {\n cleanups.delete(entry);\n };\n },\n listen(target, type, listener, options) {\n if (disposed)\n return () => { };\n const capture = typeof options === \"boolean\" ? options : Boolean(options?.capture);\n const base = typeof options === \"object\" ? options : { capture };\n target.addEventListener(type, listener, { ...base, signal: controller.signal });\n const unregister = scope.onDispose(() => {\n target.removeEventListener(type, listener, capture);\n });\n return () => {\n target.removeEventListener(type, listener, capture);\n unregister();\n };\n },\n track(resource) {\n scope.onDispose(() => {\n release(resource);\n });\n return resource;\n },\n settle,\n child() {\n return createScope(scope);\n },\n dispose() {\n if (disposed)\n return;\n disposed = true;\n controller.abort(new LifecycleDisposedError());\n const errors = [];\n for (const cleanup of [...cleanups].reverse()) {\n try {\n cleanup();\n }\n catch (error) {\n errors.push(error);\n }\n }\n cleanups.clear();\n if (errors.length)\n throw new AggregateError(errors, \"One or more cleanups failed during disposal.\");\n },\n };\n if (parent) {\n const unregister = parent.onDispose(() => {\n scope.dispose();\n });\n scope.onDispose(unregister);\n }\n return scope;\n}\n/** Default `prune()` test: objects without `isConnected` count as attached. */\nfunction isConnected(element) {\n return !(\"isConnected\" in element) || element.isConnected !== false;\n}\n/**\n * Idempotent mounting of a behavior: each element gets one scope; `mount()` twice is a no-op, `unmount()`\n * releases everything `setup` registered on the scope. If `setup` throws, the scope is released and the\n * element stays unmounted.\n */\nexport function createMountRegistry(setup, options = {}) {\n const scopes = new Map();\n // Element scopes are children of the registry's scope, so disposing the registry (directly or through\n // `options.parent`) disposes each element in its own try/catch: one failing cleanup cannot stop the rest.\n const own = createScope(options.parent);\n const unmount = (element) => {\n const scope = scopes.get(element);\n if (!scope)\n return false;\n scope.dispose();\n return true;\n };\n return {\n mount(element) {\n if (own.disposed || scopes.has(element))\n return false;\n const scope = own.child();\n // Registered before setup runs, so it runs after the behavior's cleanups; a scope runs every cleanup,\n // so the entry is removed even when one of them throws.\n scope.onDispose(() => {\n if (scopes.get(element) === scope)\n scopes.delete(element);\n });\n scopes.set(element, scope);\n try {\n setup(element, scope);\n }\n catch (error) {\n scopes.delete(element);\n scope.dispose();\n throw error;\n }\n return true;\n },\n unmount,\n isMounted(element) {\n return scopes.has(element);\n },\n prune(isAttached = isConnected) {\n const errors = [];\n let count = 0;\n for (const element of [...scopes.keys()]) {\n if (isAttached(element))\n continue;\n count++;\n try {\n unmount(element);\n }\n catch (error) {\n errors.push(error);\n }\n }\n if (errors.length)\n throw new AggregateError(errors, \"One or more elements failed to unmount while pruning.\");\n return count;\n },\n get size() {\n return scopes.size;\n },\n get disposed() {\n return own.disposed;\n },\n dispose() {\n own.dispose();\n },\n };\n}\n//# sourceMappingURL=lifecycle.js.map","// Configuration model (ARCHITECTURE.md section 6.1, DESIGN_TOKENS.md \"Dimensions\").\n//\n// The DOM is the only source of truth: configuration lives in attributes, CSS resolves appearance and theme\n// through custom-property inheritance, and these functions read the same attributes. Nothing here keeps\n// state, and nothing touches a browser global until a function is called, so importing this module is safe\n// in Node.js and in server-rendered pages.\nexport const APPEARANCES = [\"standard\", \"glass\"];\nexport const QUALITIES = [\"lite\", \"balanced\", \"ultra\", \"auto\"];\nexport const PREFERENCES = [\"auto\", \"reduced\"];\nexport const BUILT_IN_THEMES = [\"light\", \"dark\", \"auto\"];\nexport const BUILT_IN_MATERIALS = [\"regular\", \"clear\", \"frosted\", \"vivid\"];\n/** Values in effect when no element sets an attribute. */\nexport const DEFAULTS = Object.freeze({ appearance: \"standard\", theme: \"auto\", quality: \"auto\", material: \"regular\", direction: \"ltr\" });\n/** Media queries that reduce transparency or motion regardless of attributes (D-27: pages can only reduce). */\nexport const MEDIA = Object.freeze({\n dark: \"(prefers-color-scheme: dark)\",\n reducedMotion: \"(prefers-reduced-motion: reduce)\",\n reducedTransparency: \"(prefers-reduced-transparency: reduce)\",\n moreContrast: \"(prefers-contrast: more)\",\n forcedColors: \"(forced-colors: active)\",\n});\n/** Theme and material names follow the class-name rules, so they are safe in attribute selectors. */\nconst NAME = /^[a-z][a-z0-9-]*$/;\nconst PREFIX = /^(?:[a-z][a-z0-9]*-)?$/;\nexport function assertPrefix(prefix) {\n if (!PREFIX.test(prefix)) {\n throw new TypeError(`Invalid Abgin prefix \"${prefix}\": use lowercase letters and digits ending in \"-\", or \"\".`);\n }\n return prefix;\n}\n/** Attribute name of a dimension, with the optional prefix (`dir` is never prefixed). */\nexport function attributeName(dimension, prefix = \"\") {\n return `data-${assertPrefix(prefix)}${dimension}`;\n}\nfunction isAppearance(value) {\n return APPEARANCES.includes(value);\n}\nfunction isQuality(value) {\n return QUALITIES.includes(value);\n}\nfunction isPreference(value) {\n return PREFERENCES.includes(value);\n}\nfunction isName(value) {\n return NAME.test(value);\n}\n/** The parent in the flat tree: shadow roots continue at their host, as CSS inheritance does. */\nfunction parentOf(node) {\n if (node.parentElement)\n return node.parentElement;\n const root = node.getRootNode?.();\n return root && root !== node && root.host ? root.host : null;\n}\n/** Ancestors including the node itself, nearest first. */\nexport function* ancestry(node) {\n for (let n = node; n; n = parentOf(n))\n yield n;\n}\nfunction nearest(node, name, accept) {\n for (const n of ancestry(node)) {\n const value = n.getAttribute(name);\n if (value !== null && accept(value))\n return value;\n }\n return undefined;\n}\n/** Whether the node or an ancestor sets the preference to `reduced` (a nested `auto` cannot undo it). */\nfunction reducedByAttribute(node, name) {\n for (const n of ancestry(node))\n if (n.getAttribute(name) === \"reduced\")\n return true;\n return false;\n}\nfunction defaultMedia(query) {\n const match = globalThis.matchMedia;\n return typeof match === \"function\" ? match.call(globalThis, query).matches : false;\n}\nfunction defaultComputedDirection(node) {\n const computed = globalThis.getComputedStyle;\n return typeof computed === \"function\" ? computed.call(globalThis, node).direction : undefined;\n}\nfunction resolveDirection(node, options) {\n for (const n of ancestry(node)) {\n const value = n.getAttribute(\"dir\")?.toLowerCase();\n if (value === \"ltr\" || value === \"rtl\")\n return value;\n if (value === \"auto\") {\n const computed = (options.computedDirection ?? defaultComputedDirection)(node);\n return computed === \"rtl\" ? \"rtl\" : \"ltr\";\n }\n }\n return DEFAULTS.direction;\n}\n/** Resolves every configuration dimension for an element, as CSS does for the same element. */\nexport function resolve(node, options = {}) {\n const prefix = options.prefix ?? \"\";\n const media = options.media ?? defaultMedia;\n const theme = nearest(node, attributeName(\"theme\", prefix), isName) ?? DEFAULTS.theme;\n const colorScheme = theme === \"light\" || theme === \"dark\" ? theme : theme === \"auto\" ? (media(MEDIA.dark) ? \"dark\" : \"light\") : null;\n return {\n appearance: nearest(node, attributeName(\"appearance\", prefix), isAppearance) ?? DEFAULTS.appearance,\n theme,\n colorScheme,\n direction: resolveDirection(node, options),\n quality: nearest(node, attributeName(\"quality\", prefix), isQuality) ?? DEFAULTS.quality,\n material: nearest(node, attributeName(\"material\", prefix), isName) ?? DEFAULTS.material,\n reducedTransparency: reducedByAttribute(node, attributeName(\"transparency\", prefix)) ||\n media(MEDIA.reducedTransparency) ||\n media(MEDIA.moreContrast),\n reducedMotion: reducedByAttribute(node, attributeName(\"motion\", prefix)) || media(MEDIA.reducedMotion),\n };\n}\nconst CONFIGURABLE = [\n \"appearance\",\n \"theme\",\n \"quality\",\n \"material\",\n \"transparency\",\n \"motion\",\n \"direction\",\n];\nfunction isConfigurable(dimension) {\n return CONFIGURABLE.includes(dimension);\n}\nfunction validate(dimension, value) {\n const ok = typeof value === \"string\" &&\n (dimension === \"appearance\"\n ? isAppearance(value)\n : dimension === \"quality\"\n ? isQuality(value)\n : dimension === \"transparency\" || dimension === \"motion\"\n ? isPreference(value)\n : dimension === \"direction\"\n ? value === \"ltr\" || value === \"rtl\" || value === \"auto\"\n : isName(value));\n if (!ok)\n throw new TypeError(`Invalid value ${JSON.stringify(value)} for ${dimension}.`);\n}\n/**\n * Writes configuration attributes on an element (the document root by default). It keeps no hidden state:\n * the attributes are the configuration, and CSS applies them without JavaScript. It never loads glass code.\n *\n * The prefix, the root, every dimension name, and every value are validated before the first write, so\n * invalid input throws a `TypeError` and leaves the element unchanged. An error thrown by the element itself\n * while an attribute is written (for example by a custom setter) is not rolled back.\n */\nexport function configure(options, target = {}) {\n const prefix = assertPrefix(target.prefix ?? \"\");\n const root = target.root ?? globalThis.document?.documentElement;\n if (!root)\n throw new TypeError(\"configure() needs a root element outside a browser document.\");\n const writes = [];\n for (const [dimension, value] of Object.entries(options)) {\n if (value === undefined)\n continue;\n if (!isConfigurable(dimension))\n throw new TypeError(`Unknown configuration dimension \"${dimension}\".`);\n if (value !== null)\n validate(dimension, value);\n writes.push({ name: dimension === \"direction\" ? \"dir\" : attributeName(dimension, prefix), value });\n }\n for (const { name, value } of writes) {\n if (value === null)\n root.removeAttribute(name);\n else\n root.setAttribute(name, value);\n }\n}\n/**\n * Reads the class prefix that the loaded CSS declares (`--ab-prefix`), so JavaScript and CSS cannot disagree\n * (BUILD_AND_DISTRIBUTION.md section 5). Returns `\"\"` outside a browser or when the CSS sets none.\n */\nexport function readPrefix(root) {\n const g = globalThis;\n const element = root ?? g.document?.documentElement;\n if (!element || typeof g.getComputedStyle !== \"function\")\n return \"\";\n const raw = g.getComputedStyle.call(globalThis, element).getPropertyValue(\"--ab-prefix\").trim();\n const value = raw.replace(/^([\"'])(.*)\\1$/, \"$2\");\n return PREFIX.test(value) ? value : \"\";\n}\n//# sourceMappingURL=config.js.map","// Mounts behaviors by themselves (ARCHITECTURE.md section 6.2, D-99): one observer notices what a page contains, now and\n// later, and each behavior module is loaded the first time something needs it. Elements that are inserted, that gain or lose\n// a component class, and that are removed are followed; `refresh()` reconciles a part of the page that no observer can see\n// (a shadow root, a subtree that was detached while it changed). Optional; applications that know their components import\n// and mount them.\nimport { readPrefix } from \"@abgin/core/config\";\nimport { isDisposedError } from \"@abgin/core/lifecycle\";\n/** Behaviors of single elements, and behaviors that serve a whole root. */\nconst ELEMENTS = {\n appbar: [\"appbar\", async () => (await import(\"./appbar.js\")).appbar],\n sidebar: [\"sidebar\", async () => (await import(\"./sidebar.js\")).sidebar],\n tabbar: [\"tabbar-dock\", async () => (await import(\"./tabbar.js\")).tabbar],\n tabs: [\"tabs\", async () => (await import(\"./tabs.js\")).tabs],\n toolbar: [\"toolbar\", async () => (await import(\"./toolbar.js\")).toolbar],\n};\nconst ROOTS = {\n dropdown: [\"dropdown-menu\", async () => (await import(\"./dropdown.js\")).dropdown],\n popover: [\"popover\", async () => (await import(\"./popover.js\")).popover],\n tooltip: [\"tooltip\", async () => (await import(\"./tooltip.js\")).tooltip],\n modal: [\"modal\", async () => (await import(\"./modal.js\")).modal],\n drawer: [\"drawer\", async () => (await import(\"./drawer.js\")).drawer],\n sheet: [\"sheet\", async () => (await import(\"./sheet.js\")).sheet],\n};\nexport function autoInit(scope, root = document, options = {}) {\n const doc = root.ownerDocument ?? root;\n const prefix = readPrefix(doc.documentElement);\n const report = options.onError ??\n ((error) => {\n console.error(\"Abgin:\", error);\n });\n const selector = (cls) => `.${prefix}${cls}`;\n const loading = new Map();\n const roots = new Set();\n /** Mounted elements and their behaviors, by name. Entries go when the element leaves or loses its class. */\n const mounted = new Map();\n const any = [...Object.values(ROOTS), ...Object.values(ELEMENTS)].map(([cls]) => selector(cls)).join(\", \");\n const guard = async (work) => {\n try {\n await work;\n }\n catch (error) {\n if (!isDisposedError(error))\n report(error);\n }\n };\n const mountRoot = async (load) => {\n const behavior = await scope.settle(load());\n behavior.mount(root);\n scope.onDispose(() => {\n behavior.unmount(root);\n });\n };\n const mountAll = async (name, load, found) => {\n let loaded = loading.get(name);\n if (!loaded)\n loading.set(name, (loaded = scope.settle(load())));\n const behavior = await loaded;\n if (scope.disposed)\n return;\n const cls = selector(ELEMENTS[name]?.[0] ?? name);\n for (const element of found) {\n // Gone again while the module was loaded, no longer a component, or mounted by the application.\n if (!element.isConnected || !element.matches(cls) || behavior.isMounted(element))\n continue;\n behavior.mount(element);\n let own = mounted.get(element);\n if (!own)\n mounted.set(element, (own = new Map()));\n own.set(name, behavior);\n }\n };\n const scan = (node) => {\n const work = [];\n for (const [name, [cls, load]] of Object.entries(ROOTS)) {\n if (roots.has(name) || !matching(node, selector(cls)).length)\n continue;\n roots.add(name);\n work.push(guard(mountRoot(load)));\n }\n for (const [name, [cls, load]] of Object.entries(ELEMENTS)) {\n const found = matching(node, selector(cls));\n if (found.length)\n work.push(guard(mountAll(name, load, found)));\n }\n return work;\n };\n /** Releases what left the page or is no longer the component it was mounted as. A move keeps its element connected. */\n const release = (only) => {\n for (const [element, own] of only ? [[only, mounted.get(only)]] : [...mounted]) {\n if (!own)\n continue;\n for (const [name, behavior] of own) {\n const cls = ELEMENTS[name]?.[0] ?? name;\n if (element.isConnected && element.matches(selector(cls)))\n continue;\n behavior.unmount(element);\n own.delete(name);\n }\n if (!own.size)\n mounted.delete(element);\n }\n };\n const observer = scope.track(new MutationObserver((records) => {\n let removed = false;\n for (const record of records) {\n if (record.type === \"attributes\") {\n // A class changed: the element itself may have become, or stopped being, a component.\n const element = record.target;\n if (mounted.has(element))\n release(element);\n if (element.isConnected && element.matches(any))\n void Promise.all(scan(element));\n continue;\n }\n removed ||= record.removedNodes.length > 0;\n for (const node of record.addedNodes)\n if (node.nodeType === 1)\n void Promise.all(scan(node));\n }\n if (removed)\n release();\n }));\n observer.observe(root, { childList: true, subtree: true, attributes: true, attributeFilter: [\"class\"] });\n scope.onDispose(() => {\n for (const [element, own] of mounted)\n for (const behavior of own.values())\n behavior.unmount(element);\n mounted.clear();\n });\n return {\n ready: Promise.all(scan(root)).then(() => undefined),\n async refresh(node = root) {\n if (scope.disposed)\n return;\n release();\n // Mounted anew: a behavior that holds a part a framework replaced takes the new one.\n for (const [element, own] of mounted) {\n if (element !== node && !node.contains(element))\n continue;\n for (const behavior of own.values())\n behavior.unmount(element);\n mounted.delete(element);\n }\n await Promise.all(scan(node));\n },\n };\n}\nfunction matching(node, selector) {\n const inside = [...node.querySelectorAll(selector)];\n return node instanceof HTMLElement && node.matches(selector) ? [node, ...inside] : inside;\n}\n//# sourceMappingURL=auto.js.map","// `@abgin/abgin`: the standalone distribution (D-100). One function starts the behaviors for the components a page\n// contains, each loaded the first time it is needed, and, only when `glass` is set, the glass loader, which imports the engine\n// only where a glass surface needs it. Importing this module does nothing. The types are declared here, so the bundle needs\n// no other package.\n\nimport packageManifest from \"../package.json\" with { type: \"json\" };\nimport { createScope } from \"@abgin/core/lifecycle\";\nimport { autoInit } from \"@abgin/ui/auto\";\n\nexport interface GlassStartOptions {\n /** Accepts software WebGL renderers, which are slow; for tests and continuous integration. */\n readonly allowSoftware?: boolean;\n /** Moves the mark of tabs and expands panels on the GPU where the engine draws them (default `true`). */\n readonly componentMotion?: boolean;\n}\n\nexport interface StartOptions {\n /** Where components are: the document, or a shadow root (default: the document). */\n readonly root?: Document | ShadowRoot;\n /** Loads the GPU glass engine where a glass surface needs it. CSS glass (`data-appearance=\"glass\"`) needs none of this. */\n readonly glass?: boolean | GlassStartOptions;\n /** Receives errors of loading and starting; by default they are logged. */\n readonly onError?: (error: unknown) => void;\n}\n\nexport type ToastColor = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface ToastOptions {\n readonly message: string;\n readonly title?: string;\n readonly color?: ToastColor;\n /** Milliseconds it stays, or `Infinity`. Default: 6000, and `Infinity` with an action. */\n readonly duration?: number;\n /** A button; it closes the toast unless the handler returns `false`. */\n readonly action?: { readonly label: string; readonly onClick: () => unknown };\n /** Label of the button that closes it; `null` for none (only with a duration). */\n readonly dismissLabel?: string | null;\n /** Interrupts assistive technology; errors do by default. */\n readonly assertive?: boolean;\n readonly onClose?: () => void;\n}\n\nexport interface ToasterOptions {\n /** `<block side> <inline alignment>`, default `block-end end`. */\n readonly placement?: string;\n /** Toasts shown at once; the others wait (default 3). */\n readonly max?: number;\n readonly label?: string;\n readonly dismissLabel?: string;\n readonly duration?: number;\n /** The element the region is in, for its theme, appearance, and direction (default: the body). */\n readonly container?: HTMLElement;\n}\n\nexport interface Toast {\n readonly element: HTMLElement | null;\n readonly closed: boolean;\n close(): void;\n}\n\nexport interface Toaster {\n show(options: ToastOptions | string): Toast;\n clear(): void;\n readonly shown: number;\n readonly waiting: number;\n}\n\nexport interface Abgin {\n /** Resolves when the behaviors of what the page contained at the start are mounted. */\n readonly ready: Promise<void>;\n /** Mounts what a part of the page contains and releases what left it (see `@abgin/ui/auto`). */\n refresh(node?: ParentNode): Promise<void>;\n /** A toaster that is closed with the rest; its module is loaded on the first call. */\n toaster(options?: ToasterOptions): Promise<Toaster>;\n /** Releases every behavior, observer, toaster, and the glass engine. Idempotent. */\n stop(): void;\n}\n\nexport const version: string = packageManifest.version;\n\n/** Starts Abgin for a document. Calling it again for the same root returns the running instance. */\nexport function start(options: StartOptions = {}): Abgin {\n const root = options.root ?? document;\n const running = instances.get(root);\n if (running) return running;\n const scope = createScope();\n const report =\n options.onError ??\n ((error: unknown) => {\n console.error(\"Abgin:\", error);\n });\n const auto = autoInit(scope, root, { onError: report });\n const glass = options.glass;\n if (glass) {\n const settings: GlassStartOptions = glass === true ? {} : glass;\n void scope\n .settle(import(\"./glass.ts\"))\n .then(({ startGlass }) => {\n startGlass(scope, root, settings, report);\n })\n .catch((error: unknown) => {\n if (!scope.disposed) report(error);\n });\n }\n const app: Abgin = {\n ready: auto.ready,\n refresh: (node) => auto.refresh(node),\n async toaster(toasterOptions = {}) {\n const { createToaster } = await scope.settle(import(\"@abgin/ui/toast\"));\n const doc = root.ownerDocument ?? root;\n return createToaster(scope, { ...toasterOptions, document: doc });\n },\n stop() {\n if (instances.get(root) === app) instances.delete(root);\n scope.dispose();\n },\n };\n instances.set(root, app);\n return app;\n}\n\nconst instances = new WeakMap<Document | ShadowRoot, Abgin>();\n"],"mappings":";A,cCQaE,EAAb,cAA4C,KAAM,CAC9C,KAAO,yBACP,YAAYC,EAAU,oCAAqCC,EAAS,CAChE,MAAMD,EAASC,CAAO,CAC1B,CACJ,EACA,SAAgBC,EAAgBC,EAAO,CACnC,OAAOA,aAAiBJ,CAC5B,CACA,SAASK,EAAQC,EAAU,CACnB,eAAgBA,EAChBA,EAAS,WAAW,EAEpBA,EAAS,QAAQ,CACzB,CACA,SAAgBC,EAAYC,EAAQ,CAChC,IAAMC,EAAa,IAAI,gBACjBC,kBAAW,IAAI,IACjBC,EAAW,GAETC,MAAmBD,EACzB,eAAeE,EAAOC,EAAMZ,EAAU,CAAC,EAAG,CACtC,GAAIS,EACA,MAAM,IAAIX,EAAuB,iDAAiD,EACtF,IAAIe,EACJ,GAAI,CACAA,EAAQ,MAAO,OAAOD,GAAS,WAAaA,EAAKL,EAAW,MAAM,EAAIK,EAC1E,OACOV,EAAO,CAGV,MAFIQ,EAAW,EACL,IAAIZ,EAAuB,6CAA8C,CAAE,MAAOI,CAAM,CAAC,EAC7FA,CACV,CACA,GAAIQ,EAAW,EAAG,CACd,IAAII,EACJ,GAAI,CACAd,EAAQ,UAAUa,CAAK,CAC3B,OACOX,EAAO,CACVY,EAAUZ,CACd,CAEA,MAAM,IAAIJ,EAAuB,0DAASg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EAAM,QAAQ,CAChB,CACF,EAEA,OADAgF,EAAU,IAAI9C,EAAMmD,CAAG,EAChBA,CACT,CAEA,MAAML,kBAAY,IAAI,Q"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @abgin/abgin 0.1.
|
|
2
|
-
import{i as e}from"../abgin.js";import{t}from"./behavior-
|
|
3
|
-
//# sourceMappingURL=appbar-
|
|
1
|
+
/*! @abgin/abgin 0.1.2 | MIT License */
|
|
2
|
+
import{i as e}from"../abgin.js";import{t}from"./behavior-DcTSsbjM.js";const n=/* @__PURE__ */ t({name:`appbar`,setup(t,n){let r=t.ownerDocument,i=r.defaultView;if(!i)return;let a=e(r.documentElement),o=`${a}appbar-scrolled`,s=e=>{t.classList.toggle(o,e)},c=r.querySelector(`.${a}appbar-large-title`);if(c&&typeof IntersectionObserver==`function`){n.track(new IntersectionObserver(([e])=>{e&&s(!e.isIntersecting&&e.boundingClientRect.top<t.offsetHeight)},{rootMargin:`${String(-t.offsetHeight)}px 0px 0px 0px`})).observe(c);return}let l=()=>{s(i.scrollY>1)};l(),n.listen(i,`scroll`,l,{passive:!0})}});export{n as appbar};
|
|
3
|
+
//# sourceMappingURL=appbar-qrxjDiTR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appbar-
|
|
1
|
+
{"version":3,"file":"appbar-qrxjDiTR.js","names":["readPrefix","appbar","defineBehavior","element","scope","doc","view","prefix","cls","set","scrolled","title","entry","update"],"sources":["../../../ui/dist/appbar.js"],"sourcesContent":["// App bar: tells the bar when content is under it. Without a large title the bar is scrolled as soon as the page is;\n// with a .appbar-large-title on the page, once that title has gone under the bar, so the small title takes over at the\n// moment the large one disappears. The state is the appbar-scrolled class; CSS shows the scroll edge and the title.\nimport { readPrefix } from \"@abgin/core/config\";\nimport { defineBehavior } from \"./behavior.js\";\nexport const appbar = /* @__PURE__ */ defineBehavior({\n name: \"appbar\",\n setup(element, scope) {\n const doc = element.ownerDocument;\n const view = doc.defaultView;\n if (!view)\n return;\n const prefix = readPrefix(doc.documentElement);\n const cls = `${prefix}appbar-scrolled`;\n const set = (scrolled) => {\n element.classList.toggle(cls, scrolled);\n };\n const title = doc.querySelector(`.${prefix}appbar-large-title`);\n if (title && typeof IntersectionObserver === \"function\") {\n const observer = scope.track(new IntersectionObserver(([entry]) => {\n if (entry)\n set(!entry.isIntersecting && entry.boundingClientRect.top < element.offsetHeight);\n }, { rootMargin: `${String(-element.offsetHeight)}px 0px 0px 0px` }));\n observer.observe(title);\n return;\n }\n const update = () => {\n set(view.scrollY > 1);\n };\n update();\n scope.listen(view, \"scroll\", update, { passive: true });\n },\n});\n//# sourceMappingURL=appbar.js.map"],"mappings":";A,sEAKA,MAAaC,EAAyBC,kBAAe,CACjD,KAAM,SACN,MAAMC,EAASC,EAAO,CAClB,IAAMC,EAAMF,EAAQ,cACdG,EAAOD,EAAI,YACjB,GAAI,CAACC,EACD,OACJ,IAAMC,EAASP,EAAWK,EAAI,eAAe,EACvCG,EAAM,GAAGD,EAAO,iBAChBE,EAAOC,GAAa,CACtBP,EAAQ,UAAU,OAAOK,EAAKE,CAAQ,CAC1C,EACMC,EAAQN,EAAI,cAAc,IAAIE,EAAO,mBAAmB,EAC9D,GAAII,GAAS,OAAO,sBAAyB,WAAY,CACpCP,EAAM,MAAM,IAAI,sBAAsB,CAACQ,KAAW,CAC3DA,GACAH,EAAI,CAACG,EAAM,gBAAkBA,EAAM,mBAAmB,IAAMT,EAAQ,YAAY,CACxF,EAAG,CAAE,WAAY,GAAG,OAAO,CAACA,EAAQ,YAAY,EAAE,eAAgB,CAAC,CAC5D,CAAC,CAAC,QAAQQ,CAAK,EACtB,MACJ,CACA,IAAME,MAAe,CACjBJ,EAAIH,EAAK,QAAU,CAAC,CACxB,EACAO,EAAO,EACPT,EAAM,OAAOE,EAAM,SAAUO,EAAQ,CAAE,QAAS,EAAK,CAAC,CAC1D,CACJ,CAAC,E"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @abgin/abgin 0.1.
|
|
1
|
+
/*! @abgin/abgin 0.1.2 | MIT License */
|
|
2
2
|
import{s as e}from"../abgin.js";function t(t){if(!/^[a-z][a-z0-9-]*$/.test(t.name))throw TypeError(`Invalid behavior name "${t.name}".`);let n=e((e,n)=>{t.setup(e,n)});return{name:t.name,mount(e){n.mount(e)},unmount(e){n.unmount(e)},isMounted(e){return n.isMounted(e)},prune(e){return n.prune(e)},dispose(){n.dispose()}}}export{t};
|
|
3
|
-
//# sourceMappingURL=behavior-
|
|
3
|
+
//# sourceMappingURL=behavior-DcTSsbjM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"behavior-
|
|
1
|
+
{"version":3,"file":"behavior-DcTSsbjM.js","names":["createMountRegistry","defineBehavior","definition","registry","element","scope","isAttached"],"sources":["../../../ui/dist/behavior.js"],"sourcesContent":["// Behavior contract for component modules (ARCHITECTURE.md section 6.2): how they mount, idempotently, with one lifecycle scope\n// per element that releases every listener and observer on unmount. Behaviors of overlays mount on a root (a document).\nimport { createMountRegistry } from \"@abgin/core/lifecycle\";\nexport function defineBehavior(definition) {\n if (!/^[a-z][a-z0-9-]*$/.test(definition.name)) {\n throw new TypeError(`Invalid behavior name \"${definition.name}\".`);\n }\n const registry = createMountRegistry((element, scope) => {\n definition.setup(element, scope);\n });\n return {\n name: definition.name,\n mount(element) {\n registry.mount(element);\n },\n unmount(element) {\n registry.unmount(element);\n },\n isMounted(element) {\n return registry.isMounted(element);\n },\n prune(isAttached) {\n return registry.prune(isAttached);\n },\n dispose() {\n registry.dispose();\n },\n };\n}\n//# sourceMappingURL=behavior.js.map"],"mappings":";A,gCAGA,SAAgBC,EAAeC,EAAY,CACvC,GAAI,CAAC,oBAAoB,KAAKA,EAAW,IAAI,EACzC,MAAU,UAAU,0BAA0BA,EAAW,KAAK,GAAG,EAErE,IAAMC,EAAWH,GAAqBI,EAASC,IAAU,CACrDH,EAAW,MAAME,EAASC,CAAK,CACnC,CAAC,EACD,MAAO,CACH,KAAMH,EAAW,KACjB,MAAME,EAAS,CACXD,EAAS,MAAMC,CAAO,CAC1B,EACA,QAAQA,EAAS,CACbD,EAAS,QAAQC,CAAO,CAC5B,EACA,UAAUA,EAAS,CACf,OAAOD,EAAS,UAAUC,CAAO,CACrC,EACA,MAAME,EAAY,CACd,OAAOH,EAAS,MAAMG,CAAU,CACpC,EACA,SAAU,CACNH,EAAS,QAAQ,CACrB,CACJ,CACJ,C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @abgin/abgin 0.1.
|
|
2
|
-
import{a as e,n as t,t as n}from"./overlay-
|
|
3
|
-
//# sourceMappingURL=dialog-
|
|
1
|
+
/*! @abgin/abgin 0.1.2 | MIT License */
|
|
2
|
+
import{a as e,n as t,t as n}from"./overlay-CKgXnT5J.js";const r=`--ab-scroll-gutter`;function i(e,t,n){let r=t.getAttribute(`commandfor`),i=r?e.querySelector(`#${CSS.escape(r)}`):null;return i?.localName===`dialog`&&i.matches(n)?i:null}function a(e,t){typeof e.requestClose==`function`?e.requestClose(t):e.dispatchEvent(new Event(`cancel`,{cancelable:!0}))&&e.close(t)}function o(o,s,c){let l=n(o),u=l.defaultView;if(!u)return;if(`commandForElement`in u.HTMLButtonElement.prototype||s.listen(o,`click`,e=>{let t=e.target?.closest(`button[commandfor]`)??null;if(!t||t.disabled||e.defaultPrevented)return;let n=i(o,t,c);if(n)switch(t.getAttribute(`command`)){case`show-modal`:n.open||n.showModal();break;case`close`:n.open&&n.close(t.value);break;case`request-close`:n.open&&a(n,t.value)}}),!(`closedBy`in u.HTMLDialogElement.prototype)){let e=null,t=e=>{let t=e.target;if(t.localName!==`dialog`||!t.matches(`${c}[closedby="any" i]`)||!t.open)return null;let n=t.getBoundingClientRect();return e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom?null:t};s.listen(o,`pointerdown`,n=>{e=t(n)}),s.listen(o,`click`,n=>{let r=t(n);r&&r===e&&a(r),e=null}),s.listen(o,`cancel`,e=>{e.target.matches(`${c}[closedby="none" i]`)&&e.preventDefault()},!0)}let d=/* @__PURE__ */ new Set,f=()=>{d.size||(l.documentElement.style.removeProperty(r),l.documentElement.getAttribute(`style`)||l.documentElement.removeAttribute(`style`))};s.listen(o,`beforetoggle`,e=>{let t=e.target;if(e.newState!==`open`||d.size||!t.matches(`dialog${c}`))return;let n=u.innerWidth>l.documentElement.clientWidth;l.documentElement.style.setProperty(r,n?`stable`:`auto`),setTimeout(()=>{l.querySelector(`${c}:modal`)||f()},100)},!0),e(o,s,{selector:`dialog${c}`,open({overlay:e,scope:n}){d.add(e),n.onDispose(()=>{d.delete(e);for(let t of e.querySelectorAll(`[popover]`))t.matches(`:popover-open`)&&t.hidePopover();for(let n of e.querySelectorAll(`dialog`))t(n)&&n.close();f()})}}),s.onDispose(()=>{d.clear(),f()})}export{a as n,o as t};
|
|
3
|
+
//# sourceMappingURL=dialog-YuGr7AZw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-
|
|
1
|
+
{"version":3,"file":"dialog-YuGr7AZw.js","names":["watchOverlays","isOpen","documentOf","GUTTER","dialogFor","root","button","selector","id","dialog","requestClose","value","dialogs","scope","doc","view","event","outside","hit","r","open","release","bar","overlay","session","inner"],"sources":["../../../ui/dist/dialog.js"],"sourcesContent":["// Modal and modal drawer: `<dialog>` with `showModal()`. Modality, Escape, the initial focus, and focus return are the\n// browser's, and the page stops scrolling by a rule of the stylesheet that ends with the dialog. This adds invoker commands\n// and light dismiss where the browser lacks them, closes what is open inside a dialog that closes, and tells the stylesheet\n// whether the page had a scrollbar. Used by `modal` and `drawer`.\nimport { documentOf, isOpen, watchOverlays } from \"./overlay.js\";\nconst GUTTER = \"--ab-scroll-gutter\";\nconst SETTLE = 100;\nfunction dialogFor(root, button, selector) {\n const id = button.getAttribute(\"commandfor\");\n const dialog = id ? root.querySelector(`#${CSS.escape(id)}`) : null;\n return dialog?.localName === \"dialog\" && dialog.matches(selector) ? dialog : null;\n}\n/** Closes a dialog the way Escape does: with a cancelable `cancel` event first. */\nexport function requestClose(dialog, value) {\n if (typeof dialog.requestClose === \"function\")\n dialog.requestClose(value);\n else if (dialog.dispatchEvent(new Event(\"cancel\", { cancelable: true })))\n dialog.close(value);\n}\nexport function dialogs(root, scope, selector) {\n const doc = documentOf(root);\n const view = doc.defaultView;\n if (!view)\n return;\n // Invoker commands (Newly available 2025-12).\n if (!(\"commandForElement\" in view.HTMLButtonElement.prototype))\n scope.listen(root, \"click\", (event) => {\n const button = event.target?.closest(\"button[commandfor]\") ?? null;\n if (!button || button.disabled || event.defaultPrevented)\n return;\n const dialog = dialogFor(root, button, selector);\n if (!dialog)\n return;\n switch (button.getAttribute(\"command\")) {\n case \"show-modal\":\n if (!dialog.open)\n dialog.showModal();\n break;\n case \"close\":\n if (dialog.open)\n dialog.close(button.value);\n break;\n case \"request-close\":\n if (dialog.open)\n requestClose(dialog, button.value);\n break;\n }\n });\n // Light dismiss and no dismiss (`closedby`, not in every browser).\n if (!(\"closedBy\" in view.HTMLDialogElement.prototype)) {\n let outside = null;\n const hit = (event) => {\n const dialog = event.target;\n if (dialog.localName !== \"dialog\" || !dialog.matches(`${selector}[closedby=\"any\" i]`) || !dialog.open)\n return null;\n const r = dialog.getBoundingClientRect();\n const inside = event.clientX >= r.left && event.clientX <= r.right && event.clientY >= r.top && event.clientY <= r.bottom;\n return inside ? null : dialog;\n };\n // A press that starts inside, such as selecting text, closes nothing.\n scope.listen(root, \"pointerdown\", (event) => {\n outside = hit(event);\n });\n scope.listen(root, \"click\", (event) => {\n const dialog = hit(event);\n if (dialog && dialog === outside)\n requestClose(dialog);\n outside = null;\n });\n scope.listen(root, \"cancel\", (event) => {\n const dialog = event.target;\n if (dialog.matches(`${selector}[closedby=\"none\" i]`))\n event.preventDefault();\n }, true);\n }\n const open = new Set();\n const release = () => {\n if (open.size)\n return;\n doc.documentElement.style.removeProperty(GUTTER);\n if (!doc.documentElement.getAttribute(\"style\"))\n doc.documentElement.removeAttribute(\"style\");\n };\n // Before a dialog opens: whether the page has a scrollbar whose room must be kept.\n scope.listen(root, \"beforetoggle\", (event) => {\n const dialog = event.target;\n if (event.newState !== \"open\" || open.size || !dialog.matches(`dialog${selector}`))\n return;\n const bar = view.innerWidth > doc.documentElement.clientWidth;\n doc.documentElement.style.setProperty(GUTTER, bar ? \"stable\" : \"auto\");\n // It may never open, or be gone before that is known.\n setTimeout(() => {\n if (!doc.querySelector(`${selector}:modal`))\n release();\n }, SETTLE);\n }, true);\n watchOverlays(root, scope, {\n selector: `dialog${selector}`,\n open({ overlay, scope: session }) {\n open.add(overlay);\n session.onDispose(() => {\n open.delete(overlay);\n // Popovers of a dialog that closed would come back with it.\n for (const inner of overlay.querySelectorAll(\"[popover]\"))\n if (inner.matches(\":popover-open\"))\n inner.hidePopover();\n for (const inner of overlay.querySelectorAll(\"dialog\"))\n if (isOpen(inner))\n inner.close();\n release();\n });\n },\n });\n scope.onDispose(() => {\n open.clear();\n release();\n });\n}\n//# sourceMappingURL=dialog.js.map"],"mappings":";A,wDAKA,MAAMG,EAAS,qBAEf,SAASC,EAAUC,EAAMC,EAAQC,EAAU,CACvC,IAAMC,EAAKF,EAAO,aAAa,YAAY,EACrCG,EAASD,EAAKH,EAAK,cAAc,IAAI,IAAI,OAAOG,CAAE,GAAG,EAAI,KAC/D,OAAOC,GAAQ,YAAc,UAAYA,EAAO,QAAQF,CAAQ,EAAIE,EAAS,IACjF,CAEA,SAAgBC,EAAaD,EAAQE,EAAO,CACpC,OAAOF,EAAO,cAAiB,WAC/BA,EAAO,aAAaE,CAAK,EACpBF,EAAO,cAAc,IAAI,MAAM,SAAU,CAAE,WAAY,EAAK,CAAC,CAAC,GACnEA,EAAO,MAAME,CAAK,CAC1B,CACA,SAAgBC,EAAQP,EAAMQ,EAAON,EAAU,CAC3C,IAAMO,EAAMZ,EAAWG,CAAI,EACrBU,EAAOD,EAAI,YACjB,GAAI,CAACC,EAC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gB,CACdD,EAAK,OAETN,EAAI,gBAAgB,MAAM,eAAeX,CAAM,EAC1CW,EAAI,gBAAgB,aAAa,OAAO,GACzCA,EAAI,gBAAgB,gBAAgB,OAAO,EACnD,EAEAD,EAAM,OAAOR,EAAM,eAAiBW,GAAU,CAC1C,IAAMP,EAASO,EAAM,OACrB,GAAIA,EAAM,WAAa,QAAUI,EAAK,MAAQ,CAACX,EAAO,QAAQ,SAASF,GAAU,EAC7E,OACJ,IAAMe,EAAMP,EAAK,WAAaD,EAAI,gBAAgB,YAClDA,EAAI,gBAAgB,MAAM,YAAYX,EAAQmB,EAAM,SAAW,MAAM,EAErE,eAAiB,CACRR,EAAI,cAAc,GAAGP,EAAS,OAAO,GACtCc,EAAQ,CAChB,EAAG,GAAM,CACb,EAAG,EAAI,EACPrB,EAAcK,EAAMQ,EAAO,CACvB,SAAU,SAASN,IACnB,KAAK,CAAEgB,UAAS,MAAOC,GAAW,CAC9BJ,EAAK,IAAIG,CAAO,EAChBC,EAAQ,cAAgB,CACpBJ,EAAK,OAAOG,CAAO,EAEnB,IAAK,IAAME,KAASF,EAAQ,iBAAiB,WAAW,EAChDE,EAAM,QAAQ,eAAe,GAC7BA,EAAM,YAAY,EAC1B,IAAK,IAAMA,KAASF,EAAQ,iBAAiB,QAAQ,EAC7CtB,EAAOwB,CAAK,GACZA,EAAM,MAAM,EACpBJ,EAAQ,CACZ,CAAC,CACL,CACJ,CAAC,EACDR,EAAM,cAAgB,CAClBO,EAAK,MAAM,EACXC,EAAQ,CACZ,CAAC,CACL,C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @abgin/abgin 0.1.
|
|
1
|
+
/*! @abgin/abgin 0.1.2 | MIT License */
|
|
2
2
|
function e(e){return getComputedStyle(e).direction===`rtl`?`rtl`:`ltr`}function t(e,t){switch(e){case`block-start`:return`top`;case`block-end`:return`bottom`;case`inline-start`:return t===`rtl`?`right`:`left`;case`inline-end`:return t===`rtl`?`left`:`right`}}function n(e){switch(e){case`block-start`:return`block-end`;case`block-end`:return`block-start`;case`inline-start`:return`inline-end`;case`inline-end`:return`inline-start`}}export{n,t as r,e as t};
|
|
3
|
-
//# sourceMappingURL=direction-
|
|
3
|
+
//# sourceMappingURL=direction-JCXVGRGq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direction-
|
|
1
|
+
{"version":3,"file":"direction-JCXVGRGq.js","names":["directionOf","element","physicalSide","side","direction","oppositeSide"],"sources":["../../../ui/dist/direction.js"],"sourcesContent":["// Direction helpers (COMPONENT_STANDARD.md section 8): what the document direction means for an element, and the mapping\n// between logical and physical sides that positioning code needs. CSS uses logical properties and needs none of this.\n// Horizontal writing modes only.\n/** The computed direction of an element, `dir=\"auto\"` and `direction` in CSS included. Read it when it is needed. */\nexport function directionOf(element) {\n return getComputedStyle(element).direction === \"rtl\" ? \"rtl\" : \"ltr\";\n}\n/** `1` when the inline axis points right, `-1` when it points left: multiply inline distances with it. */\nexport function inlineSign(direction) {\n return direction === \"rtl\" ? -1 : 1;\n}\n/** The physical side of a logical one. */\nexport function physicalSide(side, direction) {\n switch (side) {\n case \"block-start\":\n return \"top\";\n case \"block-end\":\n return \"bottom\";\n case \"inline-start\":\n return direction === \"rtl\" ? \"right\" : \"left\";\n case \"inline-end\":\n return direction === \"rtl\" ? \"left\" : \"right\";\n }\n}\n/** The logical side of a physical one. */\nexport function logicalSide(side, direction) {\n switch (side) {\n case \"top\":\n return \"block-start\";\n case \"bottom\":\n return \"block-end\";\n case \"left\":\n return direction === \"rtl\" ? \"inline-end\" : \"inline-start\";\n case \"right\":\n return direction === \"rtl\" ? \"inline-start\" : \"inline-end\";\n }\n}\n/** The side a popup flips to when there is no room. */\nexport function oppositeSide(side) {\n switch (side) {\n case \"block-start\":\n return \"block-end\";\n case \"block-end\":\n return \"block-start\";\n case \"inline-start\":\n return \"inline-end\";\n case \"inline-end\":\n return \"inline-start\";\n }\n}\n//# sourceMappingURL=direction.js.map"],"mappings":";AAIA,SAAgBA,EAAYC,EAAS,CACjC,OAAO,iBAAiBA,CAAO,CAAC,CAAC,YAAc,MAAQ,MAAQ,KACnE,CAMA,SAAgBC,EAAaC,EAAMC,EAAW,CAC1C,OAAQD,EAAR,CACI,IAAK,cACD,MAAO,MACX,IAAK,YACD,MAAO,SACX,IAAK,eACD,OAAOC,IAAc,MAAQ,QAAU,OAC3C,IAAK,aACD,OAAOA,IAAc,MAAQ,OAAS,OAC9C,CACJ,CAeA,SAAgBC,EAAaF,EAAM,CAC/B,OAAQA,EAAR,CACI,IAAK,cACD,MAAO,YACX,IAAK,YACD,MAAO,cACX,IAAK,eACD,MAAO,aACX,IAAK,aACD,MAAO,cACf,CACJ,C"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! @abgin/abgin 0.1.2 | MIT License */
|
|
2
|
+
import{i as e}from"../abgin.js";import{t}from"./behavior-DcTSsbjM.js";import{t as n}from"./dialog-YuGr7AZw.js";import{a as r,r as i,t as a}from"./overlay-CKgXnT5J.js";const o=/* @__PURE__ */ t({name:`drawer`,setup(t,o){let s=`.${e(a(t).documentElement)}drawer`;n(t,o,s),r(t,o,{selector:`${s}[popover]`,open(e){i(t,e)}})}});export{o as drawer};
|
|
3
|
+
//# sourceMappingURL=drawer-V2-RJZaj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-
|
|
1
|
+
{"version":3,"file":"drawer-V2-RJZaj.js","names":["readPrefix","dialogs","watchOverlays","markExpanded","documentOf","drawer","defineBehavior","root","scope","selector","session"],"sources":["../../../ui/dist/drawer.js"],"sourcesContent":["// Drawer: a modal one is a `<dialog>`, one that is not modal a popover. Optional, like the modal's.\nimport { readPrefix } from \"@abgin/core/config\";\nimport { defineBehavior } from \"./behavior.js\";\nimport { dialogs } from \"./dialog.js\";\nimport { documentOf, markExpanded, watchOverlays } from \"./overlay.js\";\n/** Mount it on a document once; drawers that are inserted later need nothing. */\nexport const drawer = /* @__PURE__ */ defineBehavior({\n name: \"drawer\",\n setup(root, scope) {\n const selector = `.${readPrefix(documentOf(root).documentElement)}drawer`;\n dialogs(root, scope, selector);\n watchOverlays(root, scope, {\n selector: `${selector}[popover]`,\n open(session) {\n markExpanded(root, session);\n },\n });\n },\n});\n//# sourceMappingURL=drawer.js.map"],"mappings":";A,uKAMA,MAAaK,EAAyBC,kBAAe,CACjD,KAAM,SACN,MAAMC,EAAMC,EAAO,CACf,IAAMC,EAAW,IAAIT,EAAWI,EAAWG,CAAI,CAAC,CAAC,eAAe,EAAE,QAClEN,EAAQM,EAAMC,EAAOC,CAAQ,EAC7BP,EAAcK,EAAMC,EAAO,CACvB,SAAU,GAAGC,EAAS,WACtB,KAAKC,EAAS,CACVP,EAAaI,EAAMG,CAAO,CAC9B,CACJ,CAAC,CACL,CACJ,CAAC,E"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @abgin/abgin 0.1.
|
|
2
|
-
import{i as e}from"../abgin.js";import{t}from"./behavior-
|
|
3
|
-
//# sourceMappingURL=dropdown-
|
|
1
|
+
/*! @abgin/abgin 0.1.2 | MIT License */
|
|
2
|
+
import{i as e}from"../abgin.js";import{t}from"./behavior-DcTSsbjM.js";import{t as n}from"./direction-JCXVGRGq.js";import{n as r}from"./focus-BNE6ytl8.js";import{a as i,i as a,r as o,t as s}from"./overlay-CKgXnT5J.js";import{n as c}from"./position-Bx0n9Xgs.js";const l=`[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]`,u=e=>e.matches(`:disabled, [aria-disabled="true"]`),d=e=>(e.getAttribute(`aria-label`)??e.textContent).trim().toLocaleLowerCase();function f(e,t,n){let r=Array.from(t),i=r.length>1&&new Set(r).size===1,a=i?r[0]??``:t,o=r.length>1&&!i?n:n+1;for(let t=0;t<e.length;t++){let n=(o+t+e.length)%e.length;if(e[n]?.startsWith(a))return n}return-1}function p(e,t,i={}){let a=t=>t.closest(`[role="menu"], [role="menubar"]`)===e,o=r(e,t,{items:l,orientation:`vertical`,owns:a}),s=()=>[...e.querySelectorAll(l)].filter(e=>a(e)&&e.getClientRects().length>0),c=t=>{let n=t.composedPath().find(e=>e instanceof HTMLElement)?.closest(`[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]`)??null;return n&&e.contains(n)&&a(n)?n:null},p=``,m=0,h=(e,t)=>{let n=performance.now();if(n-m>500&&(p=``),m=n,e===` `&&!p)return!1;p+=e.toLocaleLowerCase();let r=s(),i=r[f(r.map(d),p,r.indexOf(t))];return i&&(o.set(i),i.focus()),!0};return t.listen(e,`keydown`,t=>{let r=t,a=c(r);if(!a||r.defaultPrevented||r.isComposing)return;if(r.key===`Tab`){i.onLeave?.(!0);return}if(r.ctrlKey||r.altKey||r.metaKey)return;let o=n(e)===`rtl`?`ArrowLeft`:`ArrowRight`,s=o===`ArrowLeft`?`ArrowRight`:`ArrowLeft`;r.key===o?!u(a)&&i.onEnter?.(a)&&r.preventDefault():r.key===s?i.onBack?.()&&r.preventDefault():Array.from(r.key).length===1&&h(r.key,a)?r.preventDefault():r.key===` `&&!a.matches(`button, input, summary`)&&(r.preventDefault(),a.click())}),t.listen(e,`click`,e=>{let t=c(e);t&&u(t)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),t.listen(e,`click`,t=>{let n=c(t);if(!n||t.defaultPrevented||n.hasAttribute(`popovertarget`))return;let r=n.getAttribute(`role`);if(r===`menuitemcheckbox`)n.setAttribute(`aria-checked`,String(n.getAttribute(`aria-checked`)!==`true`));else if(r===`menuitemradio`){let t=n.closest(`[role="group"]`)??e;for(let e of t.querySelectorAll(`[role="menuitemradio"]`))e.setAttribute(`aria-checked`,String(e===n))}i.onLeave?.(!0)}),{get items(){return s()},roving:o,focus(e){let t=s(),n=e===`first`?t[0]:t.at(-1);n&&(o.set(n),n.focus())}}}const m=/* @__PURE__ */ t({name:`dropdown`,setup(t,n){let r=s(t),l=`.${e(r.documentElement)}dropdown-menu[popover]`,u=`first`,d=/* @__PURE__ */ new Map,f=e=>{let n=e.getAttribute(`popovertarget`),r=n?t.querySelector(`#${CSS.escape(n)}`):null;return r?.matches(l)?r:null};n.listen(t,`keydown`,e=>{let t=e;if(t.defaultPrevented||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey||t.key!==`ArrowDown`&&t.key!==`ArrowUp`)return;let n=t.target?.closest(`[popovertarget]`)??null;if(!n||n.matches(`[role^="menuitem"], :disabled, [aria-disabled="true"]`))return;let r=f(n);r?.getAttribute(`role`)===`menu`&&(t.preventDefault(),u=t.key===`ArrowUp`?`last`:`first`,r.matches(`:popover-open`)?d.get(r)?.focus(u):a(r,n))}),i(t,n,{selector:l,open(e){let{overlay:n}=e,r=n.parentElement?.closest(l)??null;if(o(t,e),c(e,r?{side:`inline-end`,align:`start`}:{side:`block-end`,align:`start`}),n.getAttribute(`role`)!==`menu`)return;let i=()=>{let e=n;for(let t=r;t;t=t.parentElement?.closest(l)??null)e=t;return e},s=p(n,e.scope,{onLeave(e){let t=e?i():n;t.matches(`:popover-open`)&&t.hidePopover()},onEnter(e){let t=f(e);return t?(u=`first`,a(t,e),!0):!1},onBack(){return r?(n.hidePopover(),!0):!1}});d.set(n,s),e.scope.onDispose(()=>{d.delete(n)}),s.focus(u),u=`first`}})}});export{m as dropdown};
|
|
3
|
+
//# sourceMappingURL=dropdown-BsSoDo4Z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-BAvgXY5r.js","names":["readPrefix","directionOf","rovingFocus","watchOverlays","openFrom","markExpanded","documentOf","followOpener","MENU_ITEMS","disabled","item","labelOf","typeaheadIndex","labels","text","current","letters","repeated","search","from","i","index","menuNavigation","menu","scope","options","owns","roving","items","itemOf","event","n","typed","typedAt","type","key","now","all","target","e","towardsEnd","towardsStart","role","group","other","which","dropdown","defineBehavior","root","doc","selector","enterAt","open","targetOf","trigger","id","session","overlay","parent","top","up","submenu"],"sources":["../../../ui/dist/menu.js","../../../ui/dist/dropdown.js"],"sourcesContent":["// The keyboard of an application menu (Authoring Practices, menu pattern): one Tab stop, vertical arrows, Home and End,\n// typeahead, submenus along the inline axis, disabled items that can be found but not used. Website navigation is an ordinary\n// list and needs none of this.\nimport { directionOf } from \"./direction.js\";\nimport { rovingFocus } from \"./focus.js\";\nexport const MENU_ITEMS = '[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]';\n/** Time without a key after which typing starts a new search, in milliseconds. */\nconst TYPE_PAUSE = 500;\nconst disabled = (item) => item.matches(':disabled, [aria-disabled=\"true\"]');\nconst labelOf = (item) => (item.getAttribute(\"aria-label\") ?? item.textContent).trim().toLocaleLowerCase();\n/** The item typing leads to: the next one that starts with the text; the same letter again goes on from there. */\nexport function typeaheadIndex(labels, text, current) {\n const letters = Array.from(text);\n const repeated = letters.length > 1 && new Set(letters).size === 1;\n const search = repeated ? (letters[0] ?? \"\") : text;\n const from = letters.length > 1 && !repeated ? current : current + 1;\n for (let i = 0; i < labels.length; i++) {\n const index = (from + i + labels.length) % labels.length;\n if (labels[index]?.startsWith(search))\n return index;\n }\n return -1;\n}\nexport function menuNavigation(menu, scope, options = {}) {\n // Items of a submenu are its own.\n const owns = (item) => item.closest('[role=\"menu\"], [role=\"menubar\"]') === menu;\n const roving = rovingFocus(menu, scope, { items: MENU_ITEMS, orientation: \"vertical\", owns });\n const items = () => [...menu.querySelectorAll(MENU_ITEMS)].filter((i) => owns(i) && i.getClientRects().length > 0);\n const itemOf = (event) => {\n const target = event.composedPath().find((n) => n instanceof HTMLElement);\n const item = target?.closest(MENU_ITEMS) ?? null;\n return item && menu.contains(item) && owns(item) ? item : null;\n };\n let typed = \"\";\n let typedAt = 0;\n const type = (key, item) => {\n const now = performance.now();\n if (now - typedAt > TYPE_PAUSE)\n typed = \"\";\n typedAt = now;\n // Space starts no search; it uses the item.\n if (key === \" \" && !typed)\n return false;\n typed += key.toLocaleLowerCase();\n const all = items();\n const index = typeaheadIndex(all.map(labelOf), typed, all.indexOf(item));\n const target = all[index];\n if (target) {\n roving.set(target);\n target.focus();\n }\n return true;\n };\n scope.listen(menu, \"keydown\", (e) => {\n const event = e;\n const item = itemOf(event);\n if (!item || event.defaultPrevented || event.isComposing)\n return;\n if (event.key === \"Tab\") {\n // Focus goes back to where the menu was opened from, and Tab continues there.\n options.onLeave?.(true);\n return;\n }\n if (event.ctrlKey || event.altKey || event.metaKey)\n return;\n const towardsEnd = directionOf(menu) === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const towardsStart = towardsEnd === \"ArrowLeft\" ? \"ArrowRight\" : \"ArrowLeft\";\n if (event.key === towardsEnd) {\n if (!disabled(item) && options.onEnter?.(item))\n event.preventDefault();\n }\n else if (event.key === towardsStart) {\n if (options.onBack?.())\n event.preventDefault();\n }\n else if (Array.from(event.key).length === 1 && type(event.key, item)) {\n event.preventDefault();\n }\n else if (event.key === \" \" && !item.matches(\"button, input, summary\")) {\n // Links and other elements have no native activation with Space.\n event.preventDefault();\n item.click();\n }\n });\n // Before any handler of the application: a disabled item does nothing.\n scope.listen(menu, \"click\", (event) => {\n const item = itemOf(event);\n if (!item || !disabled(item))\n return;\n event.preventDefault();\n event.stopImmediatePropagation();\n }, true);\n scope.listen(menu, \"click\", (event) => {\n const item = itemOf(event);\n if (!item || event.defaultPrevented)\n return;\n if (item.hasAttribute(\"popovertarget\"))\n return; // opens its submenu\n const role = item.getAttribute(\"role\");\n if (role === \"menuitemcheckbox\") {\n item.setAttribute(\"aria-checked\", String(item.getAttribute(\"aria-checked\") !== \"true\"));\n }\n else if (role === \"menuitemradio\") {\n const group = item.closest('[role=\"group\"]') ?? menu;\n for (const other of group.querySelectorAll('[role=\"menuitemradio\"]'))\n other.setAttribute(\"aria-checked\", String(other === item));\n }\n options.onLeave?.(true);\n });\n return {\n get items() {\n return items();\n },\n roving,\n focus(which) {\n const all = items();\n const target = which === \"first\" ? all[0] : all.at(-1);\n if (!target)\n return;\n roving.set(target);\n target.focus();\n },\n };\n}\n//# sourceMappingURL=menu.js.map","// Dropdown (COMPONENT_STANDARD.md section 10.7): a popover opened by a button. Content of any kind is an ordinary popover; with\n// `role=\"menu\"` it is an application menu: focus moves into it, keys work in it (menu.ts), and it closes when an item is used.\nimport { readPrefix } from \"@abgin/core/config\";\nimport { defineBehavior } from \"./behavior.js\";\nimport { menuNavigation } from \"./menu.js\";\nimport { documentOf, markExpanded, openFrom, watchOverlays } from \"./overlay.js\";\nimport { followOpener } from \"./position.js\";\n/** Mount it on a document once; dropdowns that are inserted later need nothing. */\nexport const dropdown = /* @__PURE__ */ defineBehavior({\n name: \"dropdown\",\n setup(root, scope) {\n const doc = documentOf(root);\n const prefix = readPrefix(doc.documentElement);\n const selector = `.${prefix}dropdown-menu[popover]`;\n let enterAt = \"first\";\n /** Menus that are open, with their keys. */\n const open = new Map();\n const targetOf = (trigger) => {\n const id = trigger.getAttribute(\"popovertarget\");\n const target = id ? root.querySelector(`#${CSS.escape(id)}`) : null;\n return target?.matches(selector) ? target : null;\n };\n // The button of a menu: ArrowDown opens it at the first item, ArrowUp at the last; of an open one, they go into it.\n scope.listen(root, \"keydown\", (e) => {\n const event = e;\n if (event.defaultPrevented || event.ctrlKey || event.altKey || event.metaKey || event.shiftKey)\n return;\n if (event.key !== \"ArrowDown\" && event.key !== \"ArrowUp\")\n return;\n const trigger = event.target?.closest(\"[popovertarget]\") ?? null;\n if (!trigger || trigger.matches('[role^=\"menuitem\"], :disabled, [aria-disabled=\"true\"]'))\n return;\n const menu = targetOf(trigger);\n if (menu?.getAttribute(\"role\") !== \"menu\")\n return;\n event.preventDefault();\n enterAt = event.key === \"ArrowUp\" ? \"last\" : \"first\";\n if (!menu.matches(\":popover-open\"))\n openFrom(menu, trigger);\n // Open already, or opened by a click a moment ago: its session focuses it when it begins.\n else\n open.get(menu)?.focus(enterAt);\n });\n watchOverlays(root, scope, {\n selector,\n open(session) {\n const { overlay } = session;\n const parent = overlay.parentElement?.closest(selector) ?? null;\n markExpanded(root, session);\n followOpener(session, parent ? { side: \"inline-end\", align: \"start\" } : { side: \"block-end\", align: \"start\" });\n if (overlay.getAttribute(\"role\") !== \"menu\")\n return;\n const top = () => {\n let menu = overlay;\n for (let up = parent; up; up = up.parentElement?.closest(selector) ?? null)\n menu = up;\n return menu;\n };\n const menu = menuNavigation(overlay, session.scope, {\n onLeave(all) {\n const target = all ? top() : overlay;\n if (target.matches(\":popover-open\"))\n target.hidePopover();\n },\n onEnter(item) {\n const submenu = targetOf(item);\n if (!submenu)\n return false;\n enterAt = \"first\";\n openFrom(submenu, item);\n return true;\n },\n onBack() {\n if (!parent)\n return false;\n overlay.hidePopover();\n return true;\n },\n });\n open.set(overlay, menu);\n session.scope.onDispose(() => {\n open.delete(overlay);\n });\n menu.focus(enterAt);\n enterAt = \"first\";\n },\n });\n },\n});\n//# sourceMappingURL=dropdown.js.map"],"mappings":";A,oQAKA,MAAaQ,EAAa,uEAGpBC,EAAYC,GAASA,EAAK,QAAQ,mCAAmC,EACrEC,EAAWD,IAAUA,EAAK,aAAa,YAAY,GAAKA,EAAK,YAAA,CAAa,KAAK,CAAC,CAAC,kBAAkB,EAEzG,SAAgBE,EAAeC,EAAQC,EAAMC,EAAS,CAClD,IAAMC,EAAU,MAAM,KAAKF,CAAI,EACzBG,EAAWD,EAAQ,OAAS,GAAK,IAAI,IAAIA,CAAO,CAAC,CAAC,OAAS,EAC3DE,EAASD,EAAYD,EAAQ,IAAM,GAAMF,EACzCK,EAAOH,EAAQ,OAAS,GAAK,CAACC,EAAWF,EAAUA,EAAU,EACnE,IAAK,IAAIK,EAAI,EAAGA,EAAIP,EAAO,OAAQO,IAAK,CACpC,IAAMC,GAASF,EAAOC,EAAIP,EAAO,QAAUA,EAAO,OAClD,GAAIA,EAAOQ,EAAM,EAAE,WAAWH,CAAM,EAChC,OAAOG,CACf,CACA,MAAO,EACX,CACA,SAAgBC,EAAeC,EAAMC,EAAOC,EAAU,CAAC,EAAG,CAEtD,IAAMC,EAAQhB,GAASA,EAAK,QAAQ,iCAAiC,IAAMa,EACrEI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OACJ,IAAME,MAAY,CACd,IAAIpC,EAAOkC,EACX,IAAK,IAAIG,EAAKF,EAAQE,EAAIA,EAAKA,EAAG,eAAe,QAAQV,CAAQ,GAAK,KAClE3B,EAAOqC,EACX,OAAOrC,CACX,EACMA,EAAOD,EAAemC,EAASD,EAAQ,MAAO,CAChD,QAAQnB,EAAK,CACT,IAAMC,EAASD,EAAMsB,EAAI,EAAIF,EACzBnB,EAAO,QAAQ,eAAe,GAC9BA,EAAO,YAAY,CAC3B,EACA,QAAQ5B,EAAM,CACV,IAAMmD,EAAUR,EAAS3C,CAAI,EAK7B,OAJKmD,GAELV,EAAU,QACV/C,EAASyD,EAASnD,CAAI,EACf,IAHI,EAIf,EACA,QAAS,CAIL,OAHKgD,GAELD,EAAQ,YAAY,EACb,IAFI,EAGf,CACJ,CAAC,EACDL,EAAK,IAAIK,EAASlC,CAAI,EACtBiC,EAAQ,MAAM,cAAgB,CAC1BJ,EAAK,OAAOK,CAAO,CACvB,CAAC,EACDlC,EAAK,MAAM4B,CAAO,EAClBA,EAAU,OACd,CACJ,CAAC,CACL,CACJ,CAAC,E"}
|
|
1
|
+
{"version":3,"file":"dropdown-BsSoDo4Z.js","names":["readPrefix","directionOf","rovingFocus","watchOverlays","openFrom","markExpanded","documentOf","followOpener","MENU_ITEMS","disabled","item","labelOf","typeaheadIndex","labels","text","current","letters","repeated","search","from","i","index","menuNavigation","menu","scope","options","owns","roving","items","itemOf","event","n","typed","typedAt","type","key","now","all","target","e","towardsEnd","towardsStart","role","group","other","which","dropdown","defineBehavior","root","doc","selector","enterAt","open","targetOf","trigger","id","session","overlay","parent","top","up","submenu"],"sources":["../../../ui/dist/menu.js","../../../ui/dist/dropdown.js"],"sourcesContent":["// The keyboard of an application menu (Authoring Practices, menu pattern): one Tab stop, vertical arrows, Home and End,\n// typeahead, submenus along the inline axis, disabled items that can be found but not used. Website navigation is an ordinary\n// list and needs none of this.\nimport { directionOf } from \"./direction.js\";\nimport { rovingFocus } from \"./focus.js\";\nexport const MENU_ITEMS = '[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]';\n/** Time without a key after which typing starts a new search, in milliseconds. */\nconst TYPE_PAUSE = 500;\nconst disabled = (item) => item.matches(':disabled, [aria-disabled=\"true\"]');\nconst labelOf = (item) => (item.getAttribute(\"aria-label\") ?? item.textContent).trim().toLocaleLowerCase();\n/** The item typing leads to: the next one that starts with the text; the same letter again goes on from there. */\nexport function typeaheadIndex(labels, text, current) {\n const letters = Array.from(text);\n const repeated = letters.length > 1 && new Set(letters).size === 1;\n const search = repeated ? (letters[0] ?? \"\") : text;\n const from = letters.length > 1 && !repeated ? current : current + 1;\n for (let i = 0; i < labels.length; i++) {\n const index = (from + i + labels.length) % labels.length;\n if (labels[index]?.startsWith(search))\n return index;\n }\n return -1;\n}\nexport function menuNavigation(menu, scope, options = {}) {\n // Items of a submenu are its own.\n const owns = (item) => item.closest('[role=\"menu\"], [role=\"menubar\"]') === menu;\n const roving = rovingFocus(menu, scope, { items: MENU_ITEMS, orientation: \"vertical\", owns });\n const items = () => [...menu.querySelectorAll(MENU_ITEMS)].filter((i) => owns(i) && i.getClientRects().length > 0);\n const itemOf = (event) => {\n const target = event.composedPath().find((n) => n instanceof HTMLElement);\n const item = target?.closest(MENU_ITEMS) ?? null;\n return item && menu.contains(item) && owns(item) ? item : null;\n };\n let typed = \"\";\n let typedAt = 0;\n const type = (key, item) => {\n const now = performance.now();\n if (now - typedAt > TYPE_PAUSE)\n typed = \"\";\n typedAt = now;\n // Space starts no search; it uses the item.\n if (key === \" \" && !typed)\n return false;\n typed += key.toLocaleLowerCase();\n const all = items();\n const index = typeaheadIndex(all.map(labelOf), typed, all.indexOf(item));\n const target = all[index];\n if (target) {\n roving.set(target);\n target.focus();\n }\n return true;\n };\n scope.listen(menu, \"keydown\", (e) => {\n const event = e;\n const item = itemOf(event);\n if (!item || event.defaultPrevented || event.isComposing)\n return;\n if (event.key === \"Tab\") {\n // Focus goes back to where the menu was opened from, and Tab continues there.\n options.onLeave?.(true);\n return;\n }\n if (event.ctrlKey || event.altKey || event.metaKey)\n return;\n const towardsEnd = directionOf(menu) === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\";\n const towardsStart = towardsEnd === \"ArrowLeft\" ? \"ArrowRight\" : \"ArrowLeft\";\n if (event.key === towardsEnd) {\n if (!disabled(item) && options.onEnter?.(item))\n event.preventDefault();\n }\n else if (event.key === towardsStart) {\n if (options.onBack?.())\n event.preventDefault();\n }\n else if (Array.from(event.key).length === 1 && type(event.key, item)) {\n event.preventDefault();\n }\n else if (event.key === \" \" && !item.matches(\"button, input, summary\")) {\n // Links and other elements have no native activation with Space.\n event.preventDefault();\n item.click();\n }\n });\n // Before any handler of the application: a disabled item does nothing.\n scope.listen(menu, \"click\", (event) => {\n const item = itemOf(event);\n if (!item || !disabled(item))\n return;\n event.preventDefault();\n event.stopImmediatePropagation();\n }, true);\n scope.listen(menu, \"click\", (event) => {\n const item = itemOf(event);\n if (!item || event.defaultPrevented)\n return;\n if (item.hasAttribute(\"popovertarget\"))\n return; // opens its submenu\n const role = item.getAttribute(\"role\");\n if (role === \"menuitemcheckbox\") {\n item.setAttribute(\"aria-checked\", String(item.getAttribute(\"aria-checked\") !== \"true\"));\n }\n else if (role === \"menuitemradio\") {\n const group = item.closest('[role=\"group\"]') ?? menu;\n for (const other of group.querySelectorAll('[role=\"menuitemradio\"]'))\n other.setAttribute(\"aria-checked\", String(other === item));\n }\n options.onLeave?.(true);\n });\n return {\n get items() {\n return items();\n },\n roving,\n focus(which) {\n const all = items();\n const target = which === \"first\" ? all[0] : all.at(-1);\n if (!target)\n return;\n roving.set(target);\n target.focus();\n },\n };\n}\n//# sourceMappingURL=menu.js.map","// Dropdown (COMPONENT_STANDARD.md section 10.7): a popover opened by a button. Content of any kind is an ordinary popover; with\n// `role=\"menu\"` it is an application menu: focus moves into it, keys work in it (menu.ts), and it closes when an item is used.\nimport { readPrefix } from \"@abgin/core/config\";\nimport { defineBehavior } from \"./behavior.js\";\nimport { menuNavigation } from \"./menu.js\";\nimport { documentOf, markExpanded, openFrom, watchOverlays } from \"./overlay.js\";\nimport { followOpener } from \"./position.js\";\n/** Mount it on a document once; dropdowns that are inserted later need nothing. */\nexport const dropdown = /* @__PURE__ */ defineBehavior({\n name: \"dropdown\",\n setup(root, scope) {\n const doc = documentOf(root);\n const prefix = readPrefix(doc.documentElement);\n const selector = `.${prefix}dropdown-menu[popover]`;\n let enterAt = \"first\";\n /** Menus that are open, with their keys. */\n const open = new Map();\n const targetOf = (trigger) => {\n const id = trigger.getAttribute(\"popovertarget\");\n const target = id ? root.querySelector(`#${CSS.escape(id)}`) : null;\n return target?.matches(selector) ? target : null;\n };\n // The button of a menu: ArrowDown opens it at the first item, ArrowUp at the last; of an open one, they go into it.\n scope.listen(root, \"keydown\", (e) => {\n const event = e;\n if (event.defaultPrevented || event.ctrlKey || event.altKey || event.metaKey || event.shiftKey)\n return;\n if (event.key !== \"ArrowDown\" && event.key !== \"ArrowUp\")\n return;\n const trigger = event.target?.closest(\"[popovertarget]\") ?? null;\n if (!trigger || trigger.matches('[role^=\"menuitem\"], :disabled, [aria-disabled=\"true\"]'))\n return;\n const menu = targetOf(trigger);\n if (menu?.getAttribute(\"role\") !== \"menu\")\n return;\n event.preventDefault();\n enterAt = event.key === \"ArrowUp\" ? \"last\" : \"first\";\n if (!menu.matches(\":popover-open\"))\n openFrom(menu, trigger);\n // Open already, or opened by a click a moment ago: its session focuses it when it begins.\n else\n open.get(menu)?.focus(enterAt);\n });\n watchOverlays(root, scope, {\n selector,\n open(session) {\n const { overlay } = session;\n const parent = overlay.parentElement?.closest(selector) ?? null;\n markExpanded(root, session);\n followOpener(session, parent ? { side: \"inline-end\", align: \"start\" } : { side: \"block-end\", align: \"start\" });\n if (overlay.getAttribute(\"role\") !== \"menu\")\n return;\n const top = () => {\n let menu = overlay;\n for (let up = parent; up; up = up.parentElement?.closest(selector) ?? null)\n menu = up;\n return menu;\n };\n const menu = menuNavigation(overlay, session.scope, {\n onLeave(all) {\n const target = all ? top() : overlay;\n if (target.matches(\":popover-open\"))\n target.hidePopover();\n },\n onEnter(item) {\n const submenu = targetOf(item);\n if (!submenu)\n return false;\n enterAt = \"first\";\n openFrom(submenu, item);\n return true;\n },\n onBack() {\n if (!parent)\n return false;\n overlay.hidePopover();\n return true;\n },\n });\n open.set(overlay, menu);\n session.scope.onDispose(() => {\n open.delete(overlay);\n });\n menu.focus(enterAt);\n enterAt = \"first\";\n },\n });\n },\n});\n//# sourceMappingURL=dropdown.js.map"],"mappings":";A,oQAKA,MAAaQ,EAAa,uEAGpBC,EAAYC,GAASA,EAAK,QAAQ,mCAAmC,EACrEC,EAAWD,IAAUA,EAAK,aAAa,YAAY,GAAKA,EAAK,YAAA,CAAa,KAAK,CAAC,CAAC,kBAAkB,EAEzG,SAAgBE,EAAeC,EAAQC,EAAMC,EAAS,CAClD,IAAMC,EAAU,MAAM,KAAKF,CAAI,EACzBG,EAAWD,EAAQ,OAAS,GAAK,IAAI,IAAIA,CAAO,CAAC,CAAC,OAAS,EAC3DE,EAASD,EAAYD,EAAQ,IAAM,GAAMF,EACzCK,EAAOH,EAAQ,OAAS,GAAK,CAACC,EAAWF,EAAUA,EAAU,EACnE,IAAK,IAAIK,EAAI,EAAGA,EAAIP,EAAO,OAAQO,IAAK,CACpC,IAAMC,GAASF,EAAOC,EAAIP,EAAO,QAAUA,EAAO,OAClD,GAAIA,EAAOQ,EAAM,EAAE,WAAWH,CAAM,EAChC,OAAOG,CACf,CACA,MAAO,EACX,CACA,SAAgBC,EAAeC,EAAMC,EAAOC,EAAU,CAAC,EAAG,CAEtD,IAAMC,EAAQhB,GAASA,EAAK,QAAQ,iCAAiC,IAAMa,EACrEI,EAASzB,EAAYqB,EAAMC,EAAO,CAAE,MAAOhB,EAAY,YAAa,WAAYkB,MAAK,CAAC,EACtFE,MAAc,CAAC,GAAGL,EAAK,iBAAiBf,CAAU,CAAC,CAAC,CAAC,OAAQY,GA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