@bquery/bquery 1.0.0

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.
Files changed (80) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +266 -0
  3. package/dist/component/index.d.ts +155 -0
  4. package/dist/component/index.d.ts.map +1 -0
  5. package/dist/component.es.mjs +128 -0
  6. package/dist/component.es.mjs.map +1 -0
  7. package/dist/core/collection.d.ts +198 -0
  8. package/dist/core/collection.d.ts.map +1 -0
  9. package/dist/core/element.d.ts +301 -0
  10. package/dist/core/element.d.ts.map +1 -0
  11. package/dist/core/index.d.ts +5 -0
  12. package/dist/core/index.d.ts.map +1 -0
  13. package/dist/core/selector.d.ts +11 -0
  14. package/dist/core/selector.d.ts.map +1 -0
  15. package/dist/core/shared.d.ts +7 -0
  16. package/dist/core/shared.d.ts.map +1 -0
  17. package/dist/core/utils.d.ts +300 -0
  18. package/dist/core/utils.d.ts.map +1 -0
  19. package/dist/core.es.mjs +1015 -0
  20. package/dist/core.es.mjs.map +1 -0
  21. package/dist/full.d.ts +48 -0
  22. package/dist/full.d.ts.map +1 -0
  23. package/dist/full.es.mjs +43 -0
  24. package/dist/full.es.mjs.map +1 -0
  25. package/dist/full.iife.js +2 -0
  26. package/dist/full.iife.js.map +1 -0
  27. package/dist/full.umd.js +2 -0
  28. package/dist/full.umd.js.map +1 -0
  29. package/dist/index.d.ts +16 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.es.mjs +43 -0
  32. package/dist/index.es.mjs.map +1 -0
  33. package/dist/motion/index.d.ts +145 -0
  34. package/dist/motion/index.d.ts.map +1 -0
  35. package/dist/motion.es.mjs +104 -0
  36. package/dist/motion.es.mjs.map +1 -0
  37. package/dist/platform/buckets.d.ts +44 -0
  38. package/dist/platform/buckets.d.ts.map +1 -0
  39. package/dist/platform/cache.d.ts +71 -0
  40. package/dist/platform/cache.d.ts.map +1 -0
  41. package/dist/platform/index.d.ts +15 -0
  42. package/dist/platform/index.d.ts.map +1 -0
  43. package/dist/platform/notifications.d.ts +52 -0
  44. package/dist/platform/notifications.d.ts.map +1 -0
  45. package/dist/platform/storage.d.ts +69 -0
  46. package/dist/platform/storage.d.ts.map +1 -0
  47. package/dist/platform.es.mjs +245 -0
  48. package/dist/platform.es.mjs.map +1 -0
  49. package/dist/reactive/index.d.ts +8 -0
  50. package/dist/reactive/index.d.ts.map +1 -0
  51. package/dist/reactive/signal.d.ts +204 -0
  52. package/dist/reactive/signal.d.ts.map +1 -0
  53. package/dist/reactive.es.mjs +123 -0
  54. package/dist/reactive.es.mjs.map +1 -0
  55. package/dist/security/index.d.ts +8 -0
  56. package/dist/security/index.d.ts.map +1 -0
  57. package/dist/security/sanitize.d.ts +99 -0
  58. package/dist/security/sanitize.d.ts.map +1 -0
  59. package/dist/security.es.mjs +194 -0
  60. package/dist/security.es.mjs.map +1 -0
  61. package/package.json +120 -0
  62. package/src/component/index.ts +360 -0
  63. package/src/core/collection.ts +339 -0
  64. package/src/core/element.ts +493 -0
  65. package/src/core/index.ts +4 -0
  66. package/src/core/selector.ts +29 -0
  67. package/src/core/shared.ts +13 -0
  68. package/src/core/utils.ts +425 -0
  69. package/src/full.ts +101 -0
  70. package/src/index.ts +27 -0
  71. package/src/motion/index.ts +365 -0
  72. package/src/platform/buckets.ts +115 -0
  73. package/src/platform/cache.ts +130 -0
  74. package/src/platform/index.ts +18 -0
  75. package/src/platform/notifications.ts +87 -0
  76. package/src/platform/storage.ts +208 -0
  77. package/src/reactive/index.ts +9 -0
  78. package/src/reactive/signal.ts +347 -0
  79. package/src/security/index.ts +18 -0
  80. package/src/security/sanitize.ts +446 -0
@@ -0,0 +1,2 @@
1
+ (function(i,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(i=typeof globalThis<"u"?globalThis:i||self,w(i.bQuery={}))})(this,function(i){"use strict";const w="bquery-sanitizer";let C=null;const B=()=>typeof window.trustedTypes<"u",O=()=>{if(C)return C;const r=window;if(!r.trustedTypes)return null;try{return C=r.trustedTypes.createPolicy(w,{createHTML:t=>N(t)}),C}catch{return console.warn(`bQuery: Could not create Trusted Types policy "${w}"`),null}},F=new Set(["a","abbr","address","article","aside","b","bdi","bdo","blockquote","br","button","caption","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","input","ins","kbd","label","legend","li","main","mark","nav","ol","optgroup","option","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","var","wbr"]),I=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","role","src","srcset","style","tabindex","title","type","width","aria-*"]),R=["on","formaction"],U=["javascript:","data:","vbscript:"],z=(r,t,e)=>{const s=r.toLowerCase();for(const n of R)if(s.startsWith(n))return!1;return e&&s.startsWith("data-")||s.startsWith("aria-")?!0:t.has(s)},Q=r=>r.replace(/[\u0000-\u001F\u007F\s]+/g,"").toLowerCase(),W=r=>{const t=Q(r);for(const e of U)if(t.startsWith(e))return!1;return!0},N=(r,t={})=>{const{allowTags:e=[],allowAttributes:s=[],allowDataAttributes:n=!0,stripAllTags:o=!1}=t,a=new Set([...F,...e.map(u=>u.toLowerCase())]),l=new Set([...I,...s.map(u=>u.toLowerCase())]),c=document.createElement("template");if(c.innerHTML=r,o)return c.content.textContent??"";const d=document.createTreeWalker(c.content,NodeFilter.SHOW_ELEMENT),f=[];for(;d.nextNode();){const u=d.currentNode,v=u.tagName.toLowerCase();if(!a.has(v)){f.push(u);continue}const g=[];for(const m of Array.from(u.attributes)){const b=m.name.toLowerCase();if(!z(b,l,n)){g.push(m.name);continue}(b==="href"||b==="src"||b==="srcset")&&!W(m.value)&&g.push(m.name)}for(const m of g)u.removeAttribute(m)}for(const u of f)u.remove();return c.innerHTML},S=(r,t={})=>N(r,t),J=r=>{const t=O();return t?t.createHTML(r):S(r)},G=r=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return r.replace(/[&<>"'`]/g,e=>t[e])},K=r=>N(r,{stripAllTags:!0}),Z=(r=16)=>{const t=new Uint8Array(r);return crypto.getRandomValues(t),btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},x=r=>{const t=document.querySelector('meta[http-equiv="Content-Security-Policy"]');return t?(t.getAttribute("content")??"").includes(r):!1},X=r=>Array.isArray(r)?r:[r],h=(r,t)=>{for(const e of r)t(e)};class p{constructor(t){this.element=t}get raw(){return this.element}get node(){return this.element}addClass(...t){return this.element.classList.add(...t),this}removeClass(...t){return this.element.classList.remove(...t),this}toggleClass(t,e){return this.element.classList.toggle(t,e),this}attr(t,e){return e===void 0?this.element.getAttribute(t)??"":(this.element.setAttribute(t,e),this)}prop(t,e){return e===void 0?this.element[t]:(this.element[t]=e,this)}data(t,e){const s=t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);return e===void 0?this.element.getAttribute(`data-${s}`)??"":(this.element.setAttribute(`data-${s}`,e),this)}text(t){return t===void 0?this.element.textContent??"":(this.element.textContent=t,this)}html(t){return this.element.innerHTML=S(t),this}htmlUnsafe(t){return this.element.innerHTML=t,this}css(t,e){if(typeof t=="string")return e!==void 0&&this.element.style.setProperty(t,e),this;for(const[s,n]of Object.entries(t))this.element.style.setProperty(s,n);return this}append(t){return this.insertContent(t,"beforeend"),this}prepend(t){return this.insertContent(t,"afterbegin"),this}before(t){return this.insertContent(t,"beforebegin"),this}after(t){return this.insertContent(t,"afterend"),this}remove(){return this.element.remove(),this}empty(){return this.element.innerHTML="",this}clone(t=!0){return new p(this.element.cloneNode(t))}find(t){return Array.from(this.element.querySelectorAll(t))}findOne(t){return this.element.querySelector(t)}closest(t){return this.element.closest(t)}parent(){return this.element.parentElement}children(){return Array.from(this.element.children)}siblings(){const t=this.element.parentElement;return t?Array.from(t.children).filter(e=>e!==this.element):[]}next(){return this.element.nextElementSibling}prev(){return this.element.previousElementSibling}on(t,e){return this.element.addEventListener(t,e),this}once(t,e){return this.element.addEventListener(t,e,{once:!0}),this}off(t,e){return this.element.removeEventListener(t,e),this}trigger(t,e){return this.element.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0})),this}matches(t){return this.element.matches(t)}hasClass(t){return this.element.classList.contains(t)}show(t=""){return this.element.removeAttribute("hidden"),this.element.style.display=t,this}hide(){return this.element.style.display="none",this}toggle(t){const e=this.element.style.display==="none";return t??e?this.show():this.hide()}focus(){return this.element.focus(),this}blur(){return this.element.blur(),this}val(t){const e=this.element;return t===void 0?e.value??"":(e.value=t,this)}rect(){return this.element.getBoundingClientRect()}offset(){const t=this.element;return{width:t.offsetWidth,height:t.offsetHeight,top:t.offsetTop,left:t.offsetLeft}}insertContent(t,e){if(typeof t=="string"){this.element.insertAdjacentHTML(e,S(t));return}const s=X(t);h(s,n=>{this.element.insertAdjacentElement(e,n)})}}class A{constructor(t){this.elements=t}get length(){return this.elements.length}first(){return this.elements[0]}eq(t){const e=this.elements[t];return e?new p(e):void 0}firstEl(){return this.eq(0)}lastEl(){return this.eq(this.elements.length-1)}each(t){return this.elements.forEach((e,s)=>{t(new p(e),s)}),this}map(t){return this.elements.map(t)}filter(t){return new A(this.elements.filter(t))}reduce(t,e){return this.elements.reduce(t,e)}toArray(){return this.elements.map(t=>new p(t))}addClass(...t){return h(this.elements,e=>e.classList.add(...t)),this}removeClass(...t){return h(this.elements,e=>e.classList.remove(...t)),this}toggleClass(t,e){return h(this.elements,s=>s.classList.toggle(t,e)),this}attr(t,e){return e===void 0?this.first()?.getAttribute(t)??"":(h(this.elements,s=>s.setAttribute(t,e)),this)}removeAttr(t){return h(this.elements,e=>e.removeAttribute(t)),this}text(t){return t===void 0?this.first()?.textContent??"":(h(this.elements,e=>{e.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const e=S(t);return h(this.elements,s=>{s.innerHTML=e}),this}htmlUnsafe(t){return h(this.elements,e=>{e.innerHTML=t}),this}css(t,e){return typeof t=="string"?(e!==void 0&&h(this.elements,s=>{s.style.setProperty(t,e)}),this):(h(this.elements,s=>{for(const[n,o]of Object.entries(t))s.style.setProperty(n,o)}),this)}show(t=""){return h(this.elements,e=>{e.removeAttribute("hidden"),e.style.display=t}),this}hide(){return h(this.elements,t=>{t.style.display="none"}),this}on(t,e){return h(this.elements,s=>s.addEventListener(t,e)),this}once(t,e){return h(this.elements,s=>s.addEventListener(t,e,{once:!0})),this}off(t,e){return h(this.elements,s=>s.removeEventListener(t,e)),this}trigger(t,e){return h(this.elements,s=>{s.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0}))}),this}remove(){return h(this.elements,t=>t.remove()),this}empty(){return h(this.elements,t=>{t.innerHTML=""}),this}}const Y=r=>{if(typeof r!="string")return new p(r);const t=document.querySelector(r);if(!t)throw new Error(`bQuery: element not found for selector "${r}"`);return new p(t)},V=r=>Array.isArray(r)?new A(r):r instanceof NodeList?new A(Array.from(r)):new A(Array.from(document.querySelectorAll(r))),T={clone(r){return typeof structuredClone=="function"?structuredClone(r):JSON.parse(JSON.stringify(r))},merge(...r){const t={};for(const e of r)for(const[s,n]of Object.entries(e))T.isPlainObject(n)&&T.isPlainObject(t[s])?t[s]=T.merge(t[s],n):t[s]=n;return t},debounce(r,t){let e;return(...s)=>{e&&clearTimeout(e),e=setTimeout(()=>r(...s),t)}},throttle(r,t){let e=0;return(...s)=>{const n=Date.now();n-e>=t&&(e=n,r(...s))}},uid(r="bQuery"){return`${r}_${Math.random().toString(36).slice(2,9)}`},isElement(r){return r instanceof Element},isCollection(r){return!!(r&&typeof r=="object"&&"elements"in r)},isEmpty(r){return r==null?!0:typeof r=="string"?r.trim().length===0:Array.isArray(r)?r.length===0:typeof r=="object"?Object.keys(r).length===0:!1},isPlainObject(r){return Object.prototype.toString.call(r)==="[object Object]"},isFunction(r){return typeof r=="function"},isString(r){return typeof r=="string"},isNumber(r){return typeof r=="number"&&!Number.isNaN(r)},isBoolean(r){return typeof r=="boolean"},isArray(r){return Array.isArray(r)},parseJson(r,t){try{return JSON.parse(r)}catch{return t}},pick(r,t){const e={};for(const s of t)s in r&&(e[s]=r[s]);return e},omit(r,t){const e={...r};for(const s of t)delete e[s];return e},sleep(r){return new Promise(t=>setTimeout(t,r))},randomInt(r,t){return Math.floor(Math.random()*(t-r+1))+r},clamp(r,t,e){return Math.min(Math.max(r,t),e)},capitalize(r){return r&&r.charAt(0).toUpperCase()+r.slice(1)},toKebabCase(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()},toCamelCase(r){return r.replace(/[-_\s]+(.)?/g,(t,e)=>e?e.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}};let y=[],L=0;const P=new Set,k=(r,t)=>{y=[...y,r];try{return t()}finally{y=y.slice(0,-1)}},$=r=>{if(L>0){P.add(r);return}r()},tt=()=>{for(const r of Array.from(P))P.delete(r),r()};class H{constructor(t){this._value=t,this.subscribers=new Set}get value(){const t=y[y.length-1];return t&&this.subscribers.add(t),this._value}set value(t){if(!Object.is(this._value,t)){this._value=t;for(const e of this.subscribers)$(e)}}peek(){return this._value}update(t){this.value=t(this._value)}}class j{constructor(t){this.compute=t,this.dirty=!0,this.subscribers=new Set,this.markDirty=()=>{this.dirty=!0;for(const e of this.subscribers)$(e)}}get value(){const t=y[y.length-1];return t&&this.subscribers.add(t),this.dirty&&(this.dirty=!1,this.cachedValue=k(this.markDirty,this.compute)),this.cachedValue}}const q=r=>new H(r),et=r=>new j(r),M=r=>{let t,e=!1;const s=()=>{e||(t&&t(),t=k(s,r))};return s(),()=>{e=!0,t&&t()}},rt=r=>{L+=1;try{r()}finally{L-=1,L===0&&tt()}},st=(r,t)=>{let e=t;try{const n=localStorage.getItem(r);n!==null&&(e=JSON.parse(n))}catch{}const s=q(e);return M(()=>{try{localStorage.setItem(r,JSON.stringify(s.value))}catch{}}),s},nt=(r,t)=>{const{type:e}=t;if(e===String)return r;if(e===Number){const s=Number(r);return Number.isNaN(s)?r:s}if(e===Boolean){const s=r.trim().toLowerCase();return s===""||s==="true"||s==="1"?!0:s==="false"||s==="0"?!1:!!r}if(e===Object||e===Array)try{return JSON.parse(r)}catch{return r}if(typeof e=="function"){const s=e,n=e;try{return s(r)}catch{return new n(r)}}return r},it=(r,...t)=>r.reduce((e,s,n)=>`${e}${s}${t[n]??""}`,""),ot=(r,...t)=>{const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},s=n=>String(n??"").replace(/[&<>"'`]/g,a=>e[a]);return r.reduce((n,o,a)=>`${n}${o}${s(t[a])}`,"")},at=(r,t)=>{class e extends HTMLElement{constructor(){super(),this.state={...t.state??{}},this.props={},this.attachShadow({mode:"open"}),this.syncProps()}static get observedAttributes(){return Object.keys(t.props??{})}connectedCallback(){t.connected?.call(this),this.render()}disconnectedCallback(){t.disconnected?.call(this)}attributeChangedCallback(){this.syncProps(),this.render(!0)}setState(n,o){this.state[n]=o,this.render(!0)}getState(n){return this.state[n]}syncProps(){const n=t.props??{};for(const[o,a]of Object.entries(n)){const l=this.getAttribute(o);if(l==null){if(a.required&&a.default===void 0)throw new Error(`bQuery component: missing required prop "${o}"`);this.props[o]=a.default??void 0;continue}this.props[o]=nt(l,a)}}render(n=!1){const o=(c,d)=>{this.dispatchEvent(new CustomEvent(c,{detail:d,bubbles:!0,composed:!0}))};if(!this.shadowRoot)return;const a=t.render({props:this.props,state:this.state,emit:o}),l=t.styles?`<style>${t.styles}</style>`:"";this.shadowRoot.innerHTML=`${l}${a}`,n&&t.updated?.call(this)}}customElements.get(r)||customElements.define(r,e)},ct=async r=>{const t=typeof r=="function"?r:r.update,e=document;if(e.startViewTransition){await e.startViewTransition(()=>t()).finished;return}t()},E=r=>{const t=r.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},D=(r,t,e={})=>{const{duration:s=300,easing:n="ease-out",onComplete:o}=e,a=E(r);if(a.width===0||a.height===0)return Promise.resolve();const l=t.left-a.left,c=t.top-a.top,d=t.width/a.width,f=t.height/a.height;if(l===0&&c===0&&d===1&&f===1)return Promise.resolve();const u=r;return u.style.transform=`translate(${l}px, ${c}px) scale(${d}, ${f})`,u.style.transformOrigin="top left",u.offsetHeight,new Promise(v=>{const g=u.animate([{transform:`translate(${l}px, ${c}px) scale(${d}, ${f})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:s,easing:n,fill:"forwards"});g.onfinish=()=>{u.style.transform="",u.style.transformOrigin="",o?.(),v()}})},lt=async(r,t,e={})=>{const s=new Map;for(const o of r)s.set(o,E(o));t();const n=r.map(o=>{const a=s.get(o);return a?D(o,a,e):Promise.resolve()});await Promise.all(n)},ut={stiffness:100,damping:10,mass:1,precision:.01},ht=(r,t={})=>{const{stiffness:e,damping:s,mass:n,precision:o}={...ut,...t};let a=r,l=0,c=r,d=null,f=null;const u=new Set,v=()=>{for(const m of u)m(a)},g=()=>{const m=a-c,b=-e*m,vt=-s*l,Ct=(b+vt)/n;if(l+=Ct*(1/60),a+=l*(1/60),v(),Math.abs(l)<o&&Math.abs(m)<o){a=c,l=0,d=null,v(),f?.(),f=null;return}d=requestAnimationFrame(g)};return{to(m){return c=m,d!==null&&cancelAnimationFrame(d),new Promise(b=>{f=b,d=requestAnimationFrame(g)})},current(){return a},stop(){d!==null&&(cancelAnimationFrame(d),d=null),l=0,f?.(),f=null},onChange(m){return u.add(m),()=>u.delete(m)}}},dt={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}};class mt{constructor(t){this.bucketName=t,this.dbPromise=null,this.storeName="blobs"}openDB(){if(this.dbPromise)return this.dbPromise;const t=`bquery-bucket-${this.bucketName}`;return this.dbPromise=new Promise((e,s)=>{const n=indexedDB.open(t,1);n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName)},n.onsuccess=()=>e(n.result),n.onerror=()=>s(n.error)}),this.dbPromise}async withStore(t,e){const s=await this.openDB();return new Promise((n,o)=>{const l=s.transaction(this.storeName,t).objectStore(this.storeName),c=e(l);c.onsuccess=()=>n(c.result),c.onerror=()=>o(c.error)})}async put(t,e){await this.withStore("readwrite",s=>s.put(e,t))}async get(t){return await this.withStore("readonly",s=>s.get(t))??null}async remove(t){await this.withStore("readwrite",e=>e.delete(t))}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}}const ft={async open(r){return new mt(r)}};class pt{constructor(t){this.cache=t}async add(t){await this.cache.add(t)}async addAll(t){await this.cache.addAll(t)}async put(t,e){await this.cache.put(t,e)}async match(t){return this.cache.match(t)}async remove(t){return this.cache.delete(t)}async keys(){return(await this.cache.keys()).map(e=>e.url)}}const yt={isSupported(){return"caches"in window},async open(r){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");const t=await caches.open(r);return new pt(t)},async delete(r){return this.isSupported()?caches.delete(r):!1},async keys(){return this.isSupported()?caches.keys():[]}},gt={isSupported(){return"Notification"in window},getPermission(){return this.isSupported()?Notification.permission:"denied"},async requestPermission(){return this.isSupported()?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"},send(r,t){return this.isSupported()?Notification.permission!=="granted"?(console.warn("bQuery: Notification permission not granted"),null):new Notification(r,t):(console.warn("bQuery: Notifications not supported in this browser"),null)}};class _{constructor(t){this.storage=t}async get(t){const e=this.storage.getItem(t);if(e===null)return null;try{return JSON.parse(e)}catch{return e}}async set(t,e){const s=typeof e=="string"?e:JSON.stringify(e);this.storage.setItem(t,s)}async remove(t){this.storage.removeItem(t)}async clear(){this.storage.clear()}async keys(){return Object.keys(this.storage)}}class bt extends _{constructor(){super(localStorage)}}class wt extends _{constructor(){super(sessionStorage)}}class St{constructor(t){this.options=t,this.dbPromise=null}openDB(){return this.dbPromise?this.dbPromise:(this.dbPromise=new Promise((t,e)=>{const s=indexedDB.open(this.options.name,this.options.version??1);s.onupgradeneeded=()=>{const n=s.result;n.objectStoreNames.contains(this.options.store)||n.createObjectStore(this.options.store)},s.onsuccess=()=>t(s.result),s.onerror=()=>e(s.error)}),this.dbPromise)}async withStore(t,e){const s=await this.openDB();return new Promise((n,o)=>{const l=s.transaction(this.options.store,t).objectStore(this.options.store),c=e(l);c.onsuccess=()=>n(c.result),c.onerror=()=>o(c.error)})}async get(t){return await this.withStore("readonly",s=>s.get(t))??null}async set(t,e){await this.withStore("readwrite",s=>s.put(e,t))}async remove(t){await this.withStore("readwrite",e=>e.delete(t))}async clear(){await this.withStore("readwrite",t=>t.clear())}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}}const At={local(){return new bt},session(){return new wt},indexedDB(r){return new St(r)}};i.$=Y,i.$$=V,i.BQueryCollection=A,i.BQueryElement=p,i.Computed=j,i.Signal=H,i.batch=rt,i.buckets=ft,i.cache=yt,i.capturePosition=E,i.component=at,i.computed=et,i.createTrustedHtml=J,i.effect=M,i.escapeHtml=G,i.flip=D,i.flipList=lt,i.generateNonce=Z,i.getTrustedTypesPolicy=O,i.hasCSPDirective=x,i.html=it,i.isTrustedTypesSupported=B,i.notifications=gt,i.persistedSignal=st,i.safeHtml=ot,i.sanitize=S,i.sanitizeHtml=S,i.signal=q,i.spring=ht,i.springPresets=dt,i.storage=At,i.stripTags=K,i.transition=ct,i.utils=T,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=full.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"full.umd.js","sources":["../src/security/sanitize.ts","../src/core/shared.ts","../src/core/element.ts","../src/core/collection.ts","../src/core/selector.ts","../src/core/utils.ts","../src/reactive/signal.ts","../src/component/index.ts","../src/motion/index.ts","../src/platform/buckets.ts","../src/platform/cache.ts","../src/platform/notifications.ts","../src/platform/storage.ts"],"sourcesContent":["/**\n * Security utilities for HTML sanitization, CSP compatibility, and Trusted Types.\n * All DOM writes are sanitized by default to prevent XSS attacks.\n *\n * @module bquery/security\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Sanitizer configuration options.\n */\nexport interface SanitizeOptions {\n /** Allow these additional tags (default: none) */\n allowTags?: string[];\n /** Allow these additional attributes (default: none) */\n allowAttributes?: string[];\n /** Allow data-* attributes (default: true) */\n allowDataAttributes?: boolean;\n /** Strip all tags and return plain text (default: false) */\n stripAllTags?: boolean;\n}\n\n/**\n * Trusted Types policy name.\n */\nconst POLICY_NAME = 'bquery-sanitizer';\n\n// ============================================================================\n// Trusted Types Support\n// ============================================================================\n\n/** Window interface extended with Trusted Types */\ninterface TrustedTypesWindow extends Window {\n trustedTypes?: {\n createPolicy: (\n name: string,\n rules: { createHTML?: (input: string) => string }\n ) => TrustedTypePolicy;\n isHTML?: (value: unknown) => boolean;\n };\n}\n\n/** Trusted Types policy interface */\ninterface TrustedTypePolicy {\n createHTML: (input: string) => TrustedHTML;\n}\n\n/** Trusted HTML type placeholder for environments without Trusted Types */\ninterface TrustedHTML {\n toString(): string;\n}\n\n/** Cached Trusted Types policy */\nlet cachedPolicy: TrustedTypePolicy | null = null;\n\n/**\n * Check if Trusted Types API is available.\n * @returns True if Trusted Types are supported\n */\nexport const isTrustedTypesSupported = (): boolean => {\n return typeof (window as TrustedTypesWindow).trustedTypes !== 'undefined';\n};\n\n/**\n * Get or create the bQuery Trusted Types policy.\n * @returns The Trusted Types policy or null if unsupported\n */\nexport const getTrustedTypesPolicy = (): TrustedTypePolicy | null => {\n if (cachedPolicy) return cachedPolicy;\n\n const win = window as TrustedTypesWindow;\n if (!win.trustedTypes) return null;\n\n try {\n cachedPolicy = win.trustedTypes.createPolicy(POLICY_NAME, {\n createHTML: (input: string) => sanitizeHtmlCore(input),\n });\n return cachedPolicy;\n } catch {\n // Policy may already exist or be blocked by CSP\n console.warn(`bQuery: Could not create Trusted Types policy \"${POLICY_NAME}\"`);\n return null;\n }\n};\n\n// ============================================================================\n// Default Safe Lists\n// ============================================================================\n\n/**\n * Default allowed HTML tags considered safe.\n */\nconst DEFAULT_ALLOWED_TAGS = new Set([\n 'a',\n 'abbr',\n 'address',\n 'article',\n 'aside',\n 'b',\n 'bdi',\n 'bdo',\n 'blockquote',\n 'br',\n 'button',\n 'caption',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hgroup',\n 'hr',\n 'i',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'main',\n 'mark',\n 'nav',\n 'ol',\n 'optgroup',\n 'option',\n 'p',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'tr',\n 'u',\n 'ul',\n 'var',\n 'wbr',\n]);\n\n/**\n * Default allowed attributes considered safe.\n */\nconst DEFAULT_ALLOWED_ATTRIBUTES = new Set([\n 'alt',\n 'class',\n 'dir',\n 'height',\n 'hidden',\n 'href',\n 'id',\n 'lang',\n 'loading',\n 'name',\n 'role',\n 'src',\n 'srcset',\n 'style',\n 'tabindex',\n 'title',\n 'type',\n 'width',\n 'aria-*',\n]);\n\n/**\n * Dangerous attribute prefixes to always remove.\n */\nconst DANGEROUS_ATTR_PREFIXES = ['on', 'formaction'];\n\n/**\n * Dangerous URL protocols to block.\n */\nconst DANGEROUS_PROTOCOLS = ['javascript:', 'data:', 'vbscript:'];\n\n// ============================================================================\n// Core Sanitization\n// ============================================================================\n\n/**\n * Check if an attribute name is allowed.\n */\nconst isAllowedAttribute = (\n name: string,\n allowedSet: Set<string>,\n allowDataAttrs: boolean\n): boolean => {\n const lowerName = name.toLowerCase();\n\n // Check dangerous prefixes\n for (const prefix of DANGEROUS_ATTR_PREFIXES) {\n if (lowerName.startsWith(prefix)) return false;\n }\n\n // Check data attributes\n if (allowDataAttrs && lowerName.startsWith('data-')) return true;\n\n // Check aria attributes (allowed by default)\n if (lowerName.startsWith('aria-')) return true;\n\n // Check explicit allow list\n return allowedSet.has(lowerName);\n};\n\n/**\n * Normalize URL by removing control characters and whitespace.\n */\nconst normalizeUrl = (value: string): string =>\n value.replace(/[\\u0000-\\u001F\\u007F\\s]+/g, '').toLowerCase();\n\n/**\n * Check if a URL value is safe.\n */\nconst isSafeUrl = (value: string): boolean => {\n const normalized = normalizeUrl(value);\n for (const protocol of DANGEROUS_PROTOCOLS) {\n if (normalized.startsWith(protocol)) return false;\n }\n return true;\n};\n\n/**\n * Core sanitization logic (without Trusted Types wrapper).\n */\nconst sanitizeHtmlCore = (html: string, options: SanitizeOptions = {}): string => {\n const {\n allowTags = [],\n allowAttributes = [],\n allowDataAttributes = true,\n stripAllTags = false,\n } = options;\n\n // Build combined allow sets\n const allowedTags = new Set([...DEFAULT_ALLOWED_TAGS, ...allowTags.map((t) => t.toLowerCase())]);\n const allowedAttrs = new Set([\n ...DEFAULT_ALLOWED_ATTRIBUTES,\n ...allowAttributes.map((a) => a.toLowerCase()),\n ]);\n\n // Use template for parsing\n const template = document.createElement('template');\n template.innerHTML = html;\n\n if (stripAllTags) {\n return template.content.textContent ?? '';\n }\n\n // Walk the DOM tree\n const walker = document.createTreeWalker(template.content, NodeFilter.SHOW_ELEMENT);\n\n const toRemove: Element[] = [];\n\n while (walker.nextNode()) {\n const el = walker.currentNode as Element;\n const tagName = el.tagName.toLowerCase();\n\n // Remove disallowed tags entirely\n if (!allowedTags.has(tagName)) {\n toRemove.push(el);\n continue;\n }\n\n // Process attributes\n const attrsToRemove: string[] = [];\n for (const attr of Array.from(el.attributes)) {\n const attrName = attr.name.toLowerCase();\n\n // Check if attribute is allowed\n if (!isAllowedAttribute(attrName, allowedAttrs, allowDataAttributes)) {\n attrsToRemove.push(attr.name);\n continue;\n }\n\n // Validate URL attributes\n if (\n (attrName === 'href' || attrName === 'src' || attrName === 'srcset') &&\n !isSafeUrl(attr.value)\n ) {\n attrsToRemove.push(attr.name);\n }\n }\n\n // Remove disallowed attributes\n for (const attrName of attrsToRemove) {\n el.removeAttribute(attrName);\n }\n }\n\n // Remove disallowed elements\n for (const el of toRemove) {\n el.remove();\n }\n\n return template.innerHTML;\n};\n\n// ============================================================================\n// Public API\n// ============================================================================\n\n/**\n * Sanitize HTML string, removing dangerous elements and attributes.\n * Uses Trusted Types when available for CSP compliance.\n *\n * @param html - The HTML string to sanitize\n * @param options - Sanitization options\n * @returns Sanitized HTML string\n *\n * @example\n * ```ts\n * const safe = sanitizeHtml('<div onclick=\"alert(1)\">Hello</div>');\n * // Returns: '<div>Hello</div>'\n * ```\n */\nexport const sanitizeHtml = (html: string, options: SanitizeOptions = {}): string => {\n return sanitizeHtmlCore(html, options);\n};\n\n/**\n * Create a Trusted HTML value for use with Trusted Types-enabled sites.\n * Falls back to regular string when Trusted Types are unavailable.\n *\n * @param html - The HTML string to wrap\n * @returns Trusted HTML value or sanitized string\n */\nexport const createTrustedHtml = (html: string): TrustedHTML | string => {\n const policy = getTrustedTypesPolicy();\n if (policy) {\n return policy.createHTML(html);\n }\n return sanitizeHtml(html);\n};\n\n/**\n * Escape HTML entities to prevent XSS.\n * Use this for displaying user content as text.\n *\n * @param text - The text to escape\n * @returns Escaped HTML string\n *\n * @example\n * ```ts\n * escapeHtml('<script>alert(1)</script>');\n * // Returns: '&lt;script&gt;alert(1)&lt;/script&gt;'\n * ```\n */\nexport const escapeHtml = (text: string): string => {\n const escapeMap: Record<string, string> = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#x27;',\n '`': '&#x60;',\n };\n return text.replace(/[&<>\"'`]/g, (char) => escapeMap[char]);\n};\n\n/**\n * Strip all HTML tags and return plain text.\n *\n * @param html - The HTML string to strip\n * @returns Plain text content\n */\nexport const stripTags = (html: string): string => {\n return sanitizeHtmlCore(html, { stripAllTags: true });\n};\n\n// ============================================================================\n// CSP Helpers\n// ============================================================================\n\n/**\n * Generate a nonce for inline scripts/styles.\n * Use with Content-Security-Policy nonce directives.\n *\n * @param length - Nonce length (default: 16)\n * @returns Cryptographically random nonce string\n */\nexport const generateNonce = (length: number = 16): string => {\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n return btoa(String.fromCharCode(...array))\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '');\n};\n\n/**\n * Check if a CSP header is present with specific directive.\n * Useful for feature detection and fallback strategies.\n *\n * @param directive - The CSP directive to check (e.g., 'script-src')\n * @returns True if the directive appears to be enforced\n */\nexport const hasCSPDirective = (directive: string): boolean => {\n // Check meta tag\n const meta = document.querySelector('meta[http-equiv=\"Content-Security-Policy\"]');\n if (meta) {\n const content = meta.getAttribute('content') ?? '';\n return content.includes(directive);\n }\n return false;\n};\n","/**\n * Shared helpers for element wrappers.\n */\nexport type ElementList = Element[];\n\nexport const toElementList = (input: Element | ElementList): ElementList =>\n Array.isArray(input) ? input : [input];\n\nexport const applyAll = (elements: ElementList, action: (el: Element) => void) => {\n for (const el of elements) {\n action(el);\n }\n};\n","import { sanitizeHtml } from '../security/sanitize';\nimport { applyAll, toElementList } from './shared';\n\n/**\n * Wrapper for a single DOM element.\n * Provides a chainable, jQuery-like API for DOM manipulation.\n *\n * This class encapsulates a DOM element and provides methods for:\n * - Class manipulation (addClass, removeClass, toggleClass)\n * - Attribute and property access (attr, prop, data)\n * - Content manipulation (text, html, append, prepend)\n * - Style manipulation (css)\n * - Event handling (on, off, once, trigger)\n * - DOM traversal (find, closest, parent, children, siblings)\n *\n * All mutating methods return `this` for method chaining.\n *\n * @example\n * ```ts\n * $('#button')\n * .addClass('active')\n * .css({ color: 'blue' })\n * .on('click', () => console.log('clicked'));\n * ```\n */\nexport class BQueryElement {\n /**\n * Creates a new BQueryElement wrapper.\n * @param element - The DOM element to wrap\n */\n constructor(private readonly element: Element) {}\n\n /**\n * Exposes the raw DOM element when direct access is needed.\n * Use sparingly; prefer the wrapper methods for consistency.\n */\n get raw(): Element {\n return this.element;\n }\n\n /**\n * Exposes the underlying DOM element.\n * Provided for spec compatibility and read-only access.\n */\n get node(): Element {\n return this.element;\n }\n\n /** Add one or more classes. */\n addClass(...classNames: string[]): this {\n this.element.classList.add(...classNames);\n return this;\n }\n\n /** Remove one or more classes. */\n removeClass(...classNames: string[]): this {\n this.element.classList.remove(...classNames);\n return this;\n }\n\n /** Toggle a class by name. */\n toggleClass(className: string, force?: boolean): this {\n this.element.classList.toggle(className, force);\n return this;\n }\n\n /** Get or set an attribute. */\n attr(name: string, value?: string): string | this {\n if (value === undefined) {\n return this.element.getAttribute(name) ?? '';\n }\n this.element.setAttribute(name, value);\n return this;\n }\n\n /** Get or set a property. */\n prop<T extends keyof Element>(name: T, value?: Element[T]): Element[T] | this {\n if (value === undefined) {\n return this.element[name];\n }\n this.element[name] = value;\n return this;\n }\n\n /** Read or write data attributes in camelCase. */\n data(name: string, value?: string): string | this {\n const key = name.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);\n if (value === undefined) {\n return this.element.getAttribute(`data-${key}`) ?? '';\n }\n this.element.setAttribute(`data-${key}`, value);\n return this;\n }\n\n /** Get or set text content. */\n text(value?: string): string | this {\n if (value === undefined) {\n return this.element.textContent ?? '';\n }\n this.element.textContent = value;\n return this;\n }\n\n /** Set HTML content using a sanitized string. */\n /**\n * Sets sanitized HTML content on the element.\n * Uses the security module to sanitize input and prevent XSS attacks.\n *\n * @param value - The HTML string to set (will be sanitized)\n * @returns The instance for method chaining\n *\n * @example\n * ```ts\n * $('#content').html('<strong>Hello</strong>');\n * ```\n */\n html(value: string): this {\n this.element.innerHTML = sanitizeHtml(value);\n return this;\n }\n\n /**\n * Sets HTML content without sanitization.\n * Use only when you trust the HTML source completely.\n *\n * @param value - The raw HTML string to set\n * @returns The instance for method chaining\n *\n * @warning This method bypasses XSS protection. Use with caution.\n */\n htmlUnsafe(value: string): this {\n this.element.innerHTML = value;\n return this;\n }\n\n /**\n * Gets or sets CSS styles on the element.\n *\n * @param property - A CSS property name or an object of property-value pairs\n * @param value - The value when setting a single property\n * @returns The instance for method chaining\n *\n * @example\n * ```ts\n * // Single property\n * $('#box').css('color', 'red');\n *\n * // Multiple properties\n * $('#box').css({ color: 'red', 'font-size': '16px' });\n * ```\n */\n css(property: string | Record<string, string>, value?: string): this {\n if (typeof property === 'string') {\n if (value !== undefined) {\n (this.element as HTMLElement).style.setProperty(property, value);\n }\n return this;\n }\n\n for (const [key, val] of Object.entries(property)) {\n (this.element as HTMLElement).style.setProperty(key, val);\n }\n return this;\n }\n\n /**\n * Appends HTML or elements to the end of the element.\n *\n * @param content - HTML string or element(s) to append\n * @returns The instance for method chaining\n */\n append(content: string | Element | Element[]): this {\n this.insertContent(content, 'beforeend');\n return this;\n }\n\n /**\n * Prepends HTML or elements to the beginning of the element.\n *\n * @param content - HTML string or element(s) to prepend\n * @returns The instance for method chaining\n */\n prepend(content: string | Element | Element[]): this {\n this.insertContent(content, 'afterbegin');\n return this;\n }\n\n /**\n * Inserts content before this element.\n *\n * @param content - HTML string or element(s) to insert\n * @returns The instance for method chaining\n */\n before(content: string | Element | Element[]): this {\n this.insertContent(content, 'beforebegin');\n return this;\n }\n\n /**\n * Inserts content after this element.\n *\n * @param content - HTML string or element(s) to insert\n * @returns The instance for method chaining\n */\n after(content: string | Element | Element[]): this {\n this.insertContent(content, 'afterend');\n return this;\n }\n\n /**\n * Removes the element from the DOM.\n *\n * @returns The instance for method chaining (though element is now detached)\n */\n remove(): this {\n this.element.remove();\n return this;\n }\n\n /**\n * Clears all child nodes from the element.\n *\n * @returns The instance for method chaining\n */\n empty(): this {\n this.element.innerHTML = '';\n return this;\n }\n\n /**\n * Clones the element, optionally with all descendants.\n *\n * @param deep - If true, clone all descendants (default: true)\n * @returns A new BQueryElement wrapping the cloned element\n */\n clone(deep: boolean = true): BQueryElement {\n return new BQueryElement(this.element.cloneNode(deep) as Element);\n }\n\n /**\n * Finds all descendant elements matching the selector.\n *\n * @param selector - CSS selector to match\n * @returns Array of matching elements\n */\n find(selector: string): Element[] {\n return Array.from(this.element.querySelectorAll(selector));\n }\n\n /**\n * Finds the first descendant element matching the selector.\n *\n * @param selector - CSS selector to match\n * @returns The first matching element or null\n */\n findOne(selector: string): Element | null {\n return this.element.querySelector(selector);\n }\n\n /**\n * Finds the closest ancestor matching the selector.\n *\n * @param selector - CSS selector to match\n * @returns The matching ancestor or null\n */\n closest(selector: string): Element | null {\n return this.element.closest(selector);\n }\n\n /**\n * Gets the parent element.\n *\n * @returns The parent element or null\n */\n parent(): Element | null {\n return this.element.parentElement;\n }\n\n /**\n * Gets all child elements.\n *\n * @returns Array of child elements\n */\n children(): Element[] {\n return Array.from(this.element.children);\n }\n\n /**\n * Gets all sibling elements.\n *\n * @returns Array of sibling elements (excluding this element)\n */\n siblings(): Element[] {\n const parent = this.element.parentElement;\n if (!parent) return [];\n return Array.from(parent.children).filter((child) => child !== this.element);\n }\n\n /**\n * Gets the next sibling element.\n *\n * @returns The next sibling element or null\n */\n next(): Element | null {\n return this.element.nextElementSibling;\n }\n\n /**\n * Gets the previous sibling element.\n *\n * @returns The previous sibling element or null\n */\n prev(): Element | null {\n return this.element.previousElementSibling;\n }\n\n /**\n * Adds an event listener.\n *\n * @param event - Event type to listen for\n * @param handler - Event handler function\n * @returns The instance for method chaining\n */\n on(event: string, handler: EventListenerOrEventListenerObject): this {\n this.element.addEventListener(event, handler);\n return this;\n }\n\n /**\n * Adds a one-time event listener that removes itself after firing.\n *\n * @param event - Event type to listen for\n * @param handler - Event handler function\n * @returns The instance for method chaining\n */\n once(event: string, handler: EventListener): this {\n this.element.addEventListener(event, handler, { once: true });\n return this;\n }\n\n /**\n * Removes an event listener.\n *\n * @param event - Event type\n * @param handler - The handler to remove\n * @returns The instance for method chaining\n */\n off(event: string, handler: EventListenerOrEventListenerObject): this {\n this.element.removeEventListener(event, handler);\n return this;\n }\n\n /**\n * Triggers a custom event on the element.\n *\n * @param event - Event type to trigger\n * @param detail - Optional detail data to include with the event\n * @returns The instance for method chaining\n */\n trigger(event: string, detail?: unknown): this {\n this.element.dispatchEvent(new CustomEvent(event, { detail, bubbles: true, cancelable: true }));\n return this;\n }\n\n /**\n * Checks if the element matches a CSS selector.\n *\n * @param selector - CSS selector to match against\n * @returns True if the element matches the selector\n */\n matches(selector: string): boolean {\n return this.element.matches(selector);\n }\n\n /**\n * Checks if the element has a specific class.\n *\n * @param className - Class name to check\n * @returns True if the element has the class\n */\n hasClass(className: string): boolean {\n return this.element.classList.contains(className);\n }\n\n /**\n * Shows the element by removing the hidden attribute and setting display.\n *\n * @param display - Optional display value (default: '')\n * @returns The instance for method chaining\n */\n show(display: string = ''): this {\n this.element.removeAttribute('hidden');\n (this.element as HTMLElement).style.display = display;\n return this;\n }\n\n /**\n * Hides the element by setting display to 'none'.\n *\n * @returns The instance for method chaining\n */\n hide(): this {\n (this.element as HTMLElement).style.display = 'none';\n return this;\n }\n\n /**\n * Toggles the visibility of the element.\n *\n * @param force - Optional force show (true) or hide (false)\n * @returns The instance for method chaining\n */\n toggle(force?: boolean): this {\n const isHidden = (this.element as HTMLElement).style.display === 'none';\n const shouldShow = force ?? isHidden;\n return shouldShow ? this.show() : this.hide();\n }\n\n /**\n * Focuses the element.\n *\n * @returns The instance for method chaining\n */\n focus(): this {\n (this.element as HTMLElement).focus();\n return this;\n }\n\n /**\n * Blurs (unfocuses) the element.\n *\n * @returns The instance for method chaining\n */\n blur(): this {\n (this.element as HTMLElement).blur();\n return this;\n }\n\n /**\n * Gets or sets the value of form elements.\n *\n * @param newValue - Optional value to set\n * @returns The current value when getting, or the instance when setting\n */\n val(newValue?: string): string | this {\n const input = this.element as HTMLInputElement;\n if (newValue === undefined) {\n return input.value ?? '';\n }\n input.value = newValue;\n return this;\n }\n\n /**\n * Gets the bounding client rectangle of the element.\n *\n * @returns The element's bounding rectangle\n */\n rect(): DOMRect {\n return this.element.getBoundingClientRect();\n }\n\n /**\n * Gets the offset dimensions (width, height, top, left).\n *\n * @returns Object with offset dimensions\n */\n offset(): { width: number; height: number; top: number; left: number } {\n const el = this.element as HTMLElement;\n return {\n width: el.offsetWidth,\n height: el.offsetHeight,\n top: el.offsetTop,\n left: el.offsetLeft,\n };\n }\n\n /**\n * Internal method to insert content at a specified position.\n * @internal\n */\n private insertContent(content: string | Element | Element[], position: InsertPosition) {\n if (typeof content === 'string') {\n this.element.insertAdjacentHTML(position, sanitizeHtml(content));\n return;\n }\n\n const elements = toElementList(content);\n applyAll(elements, (el) => {\n this.element.insertAdjacentElement(position, el);\n });\n }\n}\n","import { sanitizeHtml } from '../security/sanitize';\nimport { BQueryElement } from './element';\nimport { applyAll } from './shared';\n\n/**\n * Wrapper for multiple DOM elements.\n * Provides batch operations on a collection of elements with chainable API.\n *\n * This class enables jQuery-like operations across multiple elements:\n * - All mutating methods apply to every element in the collection\n * - Getter methods return data from the first element\n * - Supports iteration via forEach, map, filter, and reduce\n *\n * @example\n * ```ts\n * $$('.items')\n * .addClass('highlight')\n * .css({ opacity: '0.8' })\n * .on('click', () => console.log('clicked'));\n * ```\n */\nexport class BQueryCollection {\n /**\n * Creates a new collection wrapper.\n * @param elements - Array of DOM elements to wrap\n */\n constructor(public readonly elements: Element[]) {}\n\n /**\n * Gets the number of elements in the collection.\n */\n get length(): number {\n return this.elements.length;\n }\n\n /**\n * Gets the first element in the collection, if any.\n * @internal\n */\n private first(): Element | undefined {\n return this.elements[0];\n }\n\n /**\n * Gets a single element as a BQueryElement wrapper.\n *\n * @param index - Zero-based index of the element\n * @returns BQueryElement wrapper or undefined if out of range\n */\n eq(index: number): BQueryElement | undefined {\n const el = this.elements[index];\n return el ? new BQueryElement(el) : undefined;\n }\n\n /**\n * Gets the first element as a BQueryElement wrapper.\n *\n * @returns BQueryElement wrapper or undefined if empty\n */\n firstEl(): BQueryElement | undefined {\n return this.eq(0);\n }\n\n /**\n * Gets the last element as a BQueryElement wrapper.\n *\n * @returns BQueryElement wrapper or undefined if empty\n */\n lastEl(): BQueryElement | undefined {\n return this.eq(this.elements.length - 1);\n }\n\n /**\n * Iterates over each element in the collection.\n *\n * @param callback - Function to call for each wrapped element\n * @returns The instance for method chaining\n */\n each(callback: (element: BQueryElement, index: number) => void): this {\n this.elements.forEach((element, index) => {\n callback(new BQueryElement(element), index);\n });\n return this;\n }\n\n /**\n * Maps each element to a new value.\n *\n * @param callback - Function to transform each element\n * @returns Array of transformed values\n */\n map<T>(callback: (element: Element, index: number) => T): T[] {\n return this.elements.map(callback);\n }\n\n /**\n * Filters elements based on a predicate.\n *\n * @param predicate - Function to test each element\n * @returns New BQueryCollection with matching elements\n */\n filter(predicate: (element: Element, index: number) => boolean): BQueryCollection {\n return new BQueryCollection(this.elements.filter(predicate));\n }\n\n /**\n * Reduces the collection to a single value.\n *\n * @param callback - Reducer function\n * @param initialValue - Initial accumulator value\n * @returns Accumulated result\n */\n reduce<T>(callback: (accumulator: T, element: Element, index: number) => T, initialValue: T): T {\n return this.elements.reduce(callback, initialValue);\n }\n\n /**\n * Converts the collection to an array of BQueryElement wrappers.\n *\n * @returns Array of BQueryElement instances\n */\n toArray(): BQueryElement[] {\n return this.elements.map((el) => new BQueryElement(el));\n }\n\n /** Add one or more classes to all elements. */\n addClass(...classNames: string[]): this {\n applyAll(this.elements, (el) => el.classList.add(...classNames));\n return this;\n }\n\n /** Remove one or more classes from all elements. */\n removeClass(...classNames: string[]): this {\n applyAll(this.elements, (el) => el.classList.remove(...classNames));\n return this;\n }\n\n /** Toggle a class on all elements. */\n toggleClass(className: string, force?: boolean): this {\n applyAll(this.elements, (el) => el.classList.toggle(className, force));\n return this;\n }\n\n /**\n * Sets an attribute on all elements or gets from first.\n *\n * @param name - Attribute name\n * @param value - Value to set (optional)\n * @returns Attribute value when getting, instance when setting\n */\n attr(name: string, value?: string): string | this {\n if (value === undefined) {\n return this.first()?.getAttribute(name) ?? '';\n }\n applyAll(this.elements, (el) => el.setAttribute(name, value));\n return this;\n }\n\n /**\n * Removes an attribute from all elements.\n *\n * @param name - Attribute name to remove\n * @returns The instance for method chaining\n */\n removeAttr(name: string): this {\n applyAll(this.elements, (el) => el.removeAttribute(name));\n return this;\n }\n\n /**\n * Sets text content on all elements or gets from first.\n *\n * @param value - Text to set (optional)\n * @returns Text content when getting, instance when setting\n */\n text(value?: string): string | this {\n if (value === undefined) {\n return this.first()?.textContent ?? '';\n }\n applyAll(this.elements, (el) => {\n el.textContent = value;\n });\n return this;\n }\n\n /**\n * Sets sanitized HTML on all elements or gets from first.\n *\n * @param value - HTML to set (optional, will be sanitized)\n * @returns HTML content when getting, instance when setting\n */\n html(value?: string): string | this {\n if (value === undefined) {\n return this.first()?.innerHTML ?? '';\n }\n const sanitized = sanitizeHtml(value);\n applyAll(this.elements, (el) => {\n el.innerHTML = sanitized;\n });\n return this;\n }\n\n /**\n * Sets HTML on all elements without sanitization.\n *\n * @param value - Raw HTML to set\n * @returns The instance for method chaining\n * @warning Bypasses XSS protection\n */\n htmlUnsafe(value: string): this {\n applyAll(this.elements, (el) => {\n el.innerHTML = value;\n });\n return this;\n }\n\n /**\n * Applies CSS styles to all elements.\n *\n * @param property - Property name or object of properties\n * @param value - Value when setting single property\n * @returns The instance for method chaining\n */\n css(property: string | Record<string, string>, value?: string): this {\n if (typeof property === 'string') {\n if (value !== undefined) {\n applyAll(this.elements, (el) => {\n (el as HTMLElement).style.setProperty(property, value);\n });\n }\n return this;\n }\n\n applyAll(this.elements, (el) => {\n for (const [key, val] of Object.entries(property)) {\n (el as HTMLElement).style.setProperty(key, val);\n }\n });\n return this;\n }\n\n /**\n * Shows all elements.\n *\n * @param display - Optional display value (default: '')\n * @returns The instance for method chaining\n */\n show(display: string = ''): this {\n applyAll(this.elements, (el) => {\n el.removeAttribute('hidden');\n (el as HTMLElement).style.display = display;\n });\n return this;\n }\n\n /**\n * Hides all elements.\n *\n * @returns The instance for method chaining\n */\n hide(): this {\n applyAll(this.elements, (el) => {\n (el as HTMLElement).style.display = 'none';\n });\n return this;\n }\n\n /**\n * Adds an event listener to all elements.\n *\n * @param event - Event type\n * @param handler - Event handler\n * @returns The instance for method chaining\n */\n on(event: string, handler: EventListenerOrEventListenerObject): this {\n applyAll(this.elements, (el) => el.addEventListener(event, handler));\n return this;\n }\n\n /**\n * Adds a one-time event listener to all elements.\n *\n * @param event - Event type\n * @param handler - Event handler\n * @returns The instance for method chaining\n */\n once(event: string, handler: EventListener): this {\n applyAll(this.elements, (el) => el.addEventListener(event, handler, { once: true }));\n return this;\n }\n\n /**\n * Removes an event listener from all elements.\n *\n * @param event - Event type\n * @param handler - The handler to remove\n * @returns The instance for method chaining\n */\n off(event: string, handler: EventListenerOrEventListenerObject): this {\n applyAll(this.elements, (el) => el.removeEventListener(event, handler));\n return this;\n }\n\n /**\n * Triggers a custom event on all elements.\n *\n * @param event - Event type\n * @param detail - Optional event detail\n * @returns The instance for method chaining\n */\n trigger(event: string, detail?: unknown): this {\n applyAll(this.elements, (el) => {\n el.dispatchEvent(new CustomEvent(event, { detail, bubbles: true, cancelable: true }));\n });\n return this;\n }\n\n /**\n * Removes all elements from the DOM.\n *\n * @returns The instance for method chaining\n */\n remove(): this {\n applyAll(this.elements, (el) => el.remove());\n return this;\n }\n\n /**\n * Clears all child nodes from all elements.\n *\n * @returns The instance for method chaining\n */\n empty(): this {\n applyAll(this.elements, (el) => {\n el.innerHTML = '';\n });\n return this;\n }\n}\n","import { BQueryCollection } from './collection';\nimport { BQueryElement } from './element';\n\n/**\n * Select a single element. Returns a wrapper for chainable operations.\n */\nexport const $ = (selector: string | Element): BQueryElement => {\n if (typeof selector !== 'string') {\n return new BQueryElement(selector);\n }\n const element = document.querySelector(selector);\n if (!element) {\n throw new Error(`bQuery: element not found for selector \"${selector}\"`);\n }\n return new BQueryElement(element);\n};\n\n/**\n * Select multiple elements. Returns a collection wrapper.\n */\nexport const $$ = (selector: string | Element[] | NodeListOf<Element>): BQueryCollection => {\n if (Array.isArray(selector)) {\n return new BQueryCollection(selector);\n }\n if (selector instanceof NodeList) {\n return new BQueryCollection(Array.from(selector));\n }\n return new BQueryCollection(Array.from(document.querySelectorAll(selector)));\n};\n","/**\n * Utility helpers used across the framework.\n * These are intentionally small and framework-agnostic to keep the core tiny.\n *\n * @module bquery/core/utils\n */\n\n/**\n * Utility object containing common helper functions.\n * All utilities are designed to be tree-shakeable and have zero dependencies.\n */\nexport const utils = {\n /**\n * Creates a deep clone using structuredClone if available, otherwise fallback to JSON.\n *\n * @template T - The type of value being cloned\n * @param value - The value to clone\n * @returns A deep copy of the value\n *\n * @example\n * ```ts\n * const original = { nested: { value: 1 } };\n * const copy = utils.clone(original);\n * copy.nested.value = 2;\n * console.log(original.nested.value); // 1\n * ```\n */\n clone<T>(value: T): T {\n if (typeof structuredClone === 'function') {\n return structuredClone(value);\n }\n return JSON.parse(JSON.stringify(value)) as T;\n },\n\n /**\n * Deep-merges plain objects into a new object.\n * Later sources override earlier ones for primitive values.\n * Objects are recursively merged.\n *\n * @template T - The type of the merged object\n * @param sources - Objects to merge\n * @returns A new object with all sources merged\n *\n * @example\n * ```ts\n * const result = utils.merge(\n * { a: 1, nested: { x: 1 } },\n * { b: 2, nested: { y: 2 } }\n * );\n * // Result: { a: 1, b: 2, nested: { x: 1, y: 2 } }\n * ```\n */\n merge<T extends Record<string, unknown>>(...sources: T[]): T {\n const result: Record<string, unknown> = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (utils.isPlainObject(value) && utils.isPlainObject(result[key])) {\n result[key] = utils.merge(\n result[key] as Record<string, unknown>,\n value as Record<string, unknown>\n );\n } else {\n result[key] = value;\n }\n }\n }\n return result as T;\n },\n\n /**\n * Creates a debounced function that delays execution until after\n * the specified delay has elapsed since the last call.\n *\n * @template TArgs - The argument types of the function\n * @param fn - The function to debounce\n * @param delayMs - Delay in milliseconds\n * @returns A debounced version of the function\n *\n * @example\n * ```ts\n * const search = utils.debounce((query: string) => {\n * console.log('Searching:', query);\n * }, 300);\n *\n * search('h');\n * search('he');\n * search('hello'); // Only this call executes after 300ms\n * ```\n */\n debounce<TArgs extends unknown[]>(\n fn: (...args: TArgs) => void,\n delayMs: number\n ): (...args: TArgs) => void {\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n return (...args: TArgs) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => fn(...args), delayMs);\n };\n },\n\n /**\n * Creates a throttled function that runs at most once per interval.\n *\n * @template TArgs - The argument types of the function\n * @param fn - The function to throttle\n * @param intervalMs - Minimum interval between calls in milliseconds\n * @returns A throttled version of the function\n *\n * @example\n * ```ts\n * const handleScroll = utils.throttle(() => {\n * console.log('Scroll position:', window.scrollY);\n * }, 100);\n *\n * window.addEventListener('scroll', handleScroll);\n * ```\n */\n throttle<TArgs extends unknown[]>(\n fn: (...args: TArgs) => void,\n intervalMs: number\n ): (...args: TArgs) => void {\n let lastRun = 0;\n return (...args: TArgs) => {\n const now = Date.now();\n if (now - lastRun >= intervalMs) {\n lastRun = now;\n fn(...args);\n }\n };\n },\n\n /**\n * Creates a stable unique ID for DOM usage.\n *\n * @param prefix - Optional prefix for the ID (default: 'bQuery')\n * @returns A unique identifier string\n *\n * @example\n * ```ts\n * const id = utils.uid('modal'); // 'modal_x7k2m9p'\n * ```\n */\n uid(prefix = 'bQuery'): string {\n return `${prefix}_${Math.random().toString(36).slice(2, 9)}`;\n },\n\n /**\n * Checks if a value is a DOM Element.\n *\n * @param value - The value to check\n * @returns True if the value is an Element\n */\n isElement(value: unknown): value is Element {\n return value instanceof Element;\n },\n\n /**\n * Checks if a value is a BQueryCollection-like object.\n *\n * @param value - The value to check\n * @returns True if the value has an elements array property\n */\n isCollection(value: unknown): value is { elements: Element[] } {\n return Boolean(value && typeof value === 'object' && 'elements' in (value as object));\n },\n\n /**\n * Checks for emptiness across common value types.\n *\n * @param value - The value to check\n * @returns True if the value is empty (null, undefined, empty string, empty array, or empty object)\n *\n * @example\n * ```ts\n * utils.isEmpty(''); // true\n * utils.isEmpty([]); // true\n * utils.isEmpty({}); // true\n * utils.isEmpty(null); // true\n * utils.isEmpty('hello'); // false\n * utils.isEmpty([1, 2]); // false\n * ```\n */\n isEmpty(value: unknown): boolean {\n if (value == null) return true;\n if (typeof value === 'string') return value.trim().length === 0;\n if (Array.isArray(value)) return value.length === 0;\n if (typeof value === 'object') return Object.keys(value as object).length === 0;\n return false;\n },\n\n /**\n * Checks if a value is a plain object (not null, array, or class instance).\n *\n * @param value - The value to check\n * @returns True if the value is a plain object\n */\n isPlainObject(value: unknown): value is Record<string, unknown> {\n return Object.prototype.toString.call(value) === '[object Object]';\n },\n\n /**\n * Checks if a value is a function.\n *\n * @param value - The value to check\n * @returns True if the value is a function\n */\n isFunction(value: unknown): value is (...args: unknown[]) => unknown {\n return typeof value === 'function';\n },\n\n /**\n * Checks if a value is a string.\n *\n * @param value - The value to check\n * @returns True if the value is a string\n */\n isString(value: unknown): value is string {\n return typeof value === 'string';\n },\n\n /**\n * Checks if a value is a number (excluding NaN).\n *\n * @param value - The value to check\n * @returns True if the value is a valid number\n */\n isNumber(value: unknown): value is number {\n return typeof value === 'number' && !Number.isNaN(value);\n },\n\n /**\n * Checks if a value is a boolean.\n *\n * @param value - The value to check\n * @returns True if the value is a boolean\n */\n isBoolean(value: unknown): value is boolean {\n return typeof value === 'boolean';\n },\n\n /**\n * Checks if a value is an array.\n *\n * @template T - The type of array elements\n * @param value - The value to check\n * @returns True if the value is an array\n */\n isArray<T = unknown>(value: unknown): value is T[] {\n return Array.isArray(value);\n },\n\n /**\n * Safely parses a JSON string, returning a default value on error.\n *\n * @template T - The expected type of the parsed value\n * @param json - The JSON string to parse\n * @param fallback - The default value if parsing fails\n * @returns The parsed value or the fallback\n *\n * @example\n * ```ts\n * utils.parseJson('{\"name\":\"bQuery\"}', {}); // { name: 'bQuery' }\n * utils.parseJson('invalid', {}); // {}\n * ```\n */\n parseJson<T>(json: string, fallback: T): T {\n try {\n return JSON.parse(json) as T;\n } catch {\n return fallback;\n }\n },\n\n /**\n * Picks specified keys from an object.\n *\n * @template T - The object type\n * @template K - The key type\n * @param obj - The source object\n * @param keys - Keys to pick\n * @returns A new object with only the specified keys\n *\n * @example\n * ```ts\n * const user = { name: 'John', age: 30, email: 'john@example.com' };\n * utils.pick(user, ['name', 'email']); // { name: 'John', email: 'john@example.com' }\n * ```\n */\n pick<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K> {\n const result = {} as Pick<T, K>;\n for (const key of keys) {\n if (key in obj) {\n result[key] = obj[key];\n }\n }\n return result;\n },\n\n /**\n * Omits specified keys from an object.\n *\n * @template T - The object type\n * @template K - The key type\n * @param obj - The source object\n * @param keys - Keys to omit\n * @returns A new object without the specified keys\n *\n * @example\n * ```ts\n * const user = { name: 'John', age: 30, password: 'secret' };\n * utils.omit(user, ['password']); // { name: 'John', age: 30 }\n * ```\n */\n omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n for (const key of keys) {\n delete result[key];\n }\n return result as Omit<T, K>;\n },\n\n /**\n * Delays execution for a specified number of milliseconds.\n *\n * @param ms - Milliseconds to delay\n * @returns A promise that resolves after the delay\n *\n * @example\n * ```ts\n * await utils.sleep(1000); // Wait 1 second\n * console.log('Done!');\n * ```\n */\n sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n },\n\n /**\n * Generates a random integer between min and max (inclusive).\n *\n * @param min - Minimum value\n * @param max - Maximum value\n * @returns A random integer in the range [min, max]\n *\n * @example\n * ```ts\n * const roll = utils.randomInt(1, 6); // Random dice roll\n * ```\n */\n randomInt(min: number, max: number): number {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n },\n\n /**\n * Clamps a number between a minimum and maximum value.\n *\n * @param value - The value to clamp\n * @param min - Minimum value\n * @param max - Maximum value\n * @returns The clamped value\n *\n * @example\n * ```ts\n * utils.clamp(150, 0, 100); // 100\n * utils.clamp(-10, 0, 100); // 0\n * utils.clamp(50, 0, 100); // 50\n * ```\n */\n clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n },\n\n /**\n * Capitalizes the first letter of a string.\n *\n * @param str - The string to capitalize\n * @returns The capitalized string\n *\n * @example\n * ```ts\n * utils.capitalize('hello'); // 'Hello'\n * ```\n */\n capitalize(str: string): string {\n if (!str) return str;\n return str.charAt(0).toUpperCase() + str.slice(1);\n },\n\n /**\n * Converts a string to kebab-case.\n *\n * @param str - The string to convert\n * @returns The kebab-cased string\n *\n * @example\n * ```ts\n * utils.toKebabCase('myVariableName'); // 'my-variable-name'\n * ```\n */\n toKebabCase(str: string): string {\n return str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/[\\s_]+/g, '-')\n .toLowerCase();\n },\n\n /**\n * Converts a string to camelCase.\n *\n * @param str - The string to convert\n * @returns The camelCased string\n *\n * @example\n * ```ts\n * utils.toCamelCase('my-variable-name'); // 'myVariableName'\n * ```\n */\n toCamelCase(str: string): string {\n return str\n .replace(/[-_\\s]+(.)?/g, (_, char) => (char ? char.toUpperCase() : ''))\n .replace(/^[A-Z]/, (char) => char.toLowerCase());\n },\n};\n","/**\n * Reactive primitives inspired by fine-grained reactivity.\n *\n * This module provides a minimal but powerful reactive system:\n * - Signal: A reactive value that notifies subscribers when changed\n * - Computed: A derived value that automatically updates when dependencies change\n * - Effect: A side effect that re-runs when its dependencies change\n * - Batch: Group multiple updates to prevent intermediate re-renders\n *\n * @module bquery/reactive\n *\n * @example\n * ```ts\n * const count = signal(0);\n * const doubled = computed(() => count.value * 2);\n *\n * effect(() => {\n * console.log(`Count: ${count.value}, Doubled: ${doubled.value}`);\n * });\n *\n * batch(() => {\n * count.value = 1;\n * count.value = 2;\n * });\n * // Logs: \"Count: 2, Doubled: 4\" (only once due to batching)\n * ```\n */\n\n/**\n * Observer function type used internally for tracking reactivity.\n */\nexport type Observer = () => void;\n\n/**\n * Cleanup function returned by effects for disposal.\n */\nexport type CleanupFn = () => void;\n\n// Internal state for tracking the current observer context\nlet observerStack: Observer[] = [];\nlet batchDepth = 0;\nconst pendingObservers = new Set<Observer>();\n\n/**\n * Tracks dependencies during a function execution.\n * @internal\n */\nconst track = <T>(observer: Observer, fn: () => T): T => {\n observerStack = [...observerStack, observer];\n try {\n return fn();\n } finally {\n observerStack = observerStack.slice(0, -1);\n }\n};\n\n/**\n * Schedules an observer to run, respecting batch mode.\n * @internal\n */\nconst scheduleObserver = (observer: Observer) => {\n if (batchDepth > 0) {\n pendingObservers.add(observer);\n return;\n }\n observer();\n};\n\n/**\n * Flushes all pending observers after a batch completes.\n * @internal\n */\nconst flushObservers = () => {\n for (const observer of Array.from(pendingObservers)) {\n pendingObservers.delete(observer);\n observer();\n }\n};\n\n/**\n * A reactive value container that notifies subscribers on change.\n *\n * Signals are the foundational primitive of the reactive system.\n * Reading a signal's value inside an effect or computed automatically\n * establishes a reactive dependency.\n *\n * @template T - The type of the stored value\n *\n * @example\n * ```ts\n * const name = signal('World');\n * console.log(name.value); // 'World'\n *\n * name.value = 'bQuery';\n * console.log(name.value); // 'bQuery'\n * ```\n */\nexport class Signal<T> {\n private subscribers = new Set<Observer>();\n\n /**\n * Creates a new signal with an initial value.\n * @param _value - The initial value\n */\n constructor(private _value: T) {}\n\n /**\n * Gets the current value and tracks the read if inside an observer.\n */\n get value(): T {\n const current = observerStack[observerStack.length - 1];\n if (current) {\n this.subscribers.add(current);\n }\n return this._value;\n }\n\n /**\n * Sets a new value and notifies all subscribers if the value changed.\n * Uses Object.is for equality comparison.\n */\n set value(next: T) {\n if (Object.is(this._value, next)) return;\n this._value = next;\n for (const subscriber of this.subscribers) {\n scheduleObserver(subscriber);\n }\n }\n\n /**\n * Reads the current value without tracking.\n * Useful when you need the value but don't want to create a dependency.\n *\n * @returns The current value\n */\n peek(): T {\n return this._value;\n }\n\n /**\n * Updates the value using a function.\n * Useful for updates based on the current value.\n *\n * @param updater - Function that receives current value and returns new value\n */\n update(updater: (current: T) => T): void {\n this.value = updater(this._value);\n }\n}\n\n/**\n * A computed value that derives from other reactive sources.\n *\n * Computed values are lazily evaluated and cached. They only\n * recompute when their dependencies change.\n *\n * @template T - The type of the computed value\n *\n * @example\n * ```ts\n * const price = signal(100);\n * const quantity = signal(2);\n * const total = computed(() => price.value * quantity.value);\n *\n * console.log(total.value); // 200\n * price.value = 150;\n * console.log(total.value); // 300\n * ```\n */\nexport class Computed<T> {\n private cachedValue!: T;\n private dirty = true;\n private subscribers = new Set<Observer>();\n private readonly markDirty = () => {\n this.dirty = true;\n for (const subscriber of this.subscribers) {\n scheduleObserver(subscriber);\n }\n };\n\n /**\n * Creates a new computed value.\n * @param compute - Function that computes the value\n */\n constructor(private readonly compute: () => T) {}\n\n /**\n * Gets the computed value, recomputing if dependencies changed.\n */\n get value(): T {\n const current = observerStack[observerStack.length - 1];\n if (current) {\n this.subscribers.add(current);\n }\n if (this.dirty) {\n this.dirty = false;\n this.cachedValue = track(this.markDirty, this.compute);\n }\n return this.cachedValue;\n }\n}\n\n/**\n * Creates a new reactive signal.\n *\n * @template T - The type of the signal value\n * @param value - The initial value\n * @returns A new Signal instance\n *\n * @example\n * ```ts\n * const count = signal(0);\n * count.value++; // Triggers subscribers\n * ```\n */\nexport const signal = <T>(value: T): Signal<T> => new Signal(value);\n\n/**\n * Creates a new computed value.\n *\n * @template T - The type of the computed value\n * @param fn - Function that computes the value from reactive sources\n * @returns A new Computed instance\n *\n * @example\n * ```ts\n * const doubled = computed(() => count.value * 2);\n * ```\n */\nexport const computed = <T>(fn: () => T): Computed<T> => new Computed(fn);\n\n/**\n * Creates a side effect that automatically re-runs when dependencies change.\n *\n * The effect runs immediately upon creation and then re-runs whenever\n * any signal or computed value read inside it changes.\n *\n * @param fn - The effect function to run\n * @returns A cleanup function to stop the effect\n *\n * @example\n * ```ts\n * const count = signal(0);\n *\n * const cleanup = effect(() => {\n * document.title = `Count: ${count.value}`;\n * });\n *\n * // Later, to stop the effect:\n * cleanup();\n * ```\n */\nexport const effect = (fn: () => void | CleanupFn): CleanupFn => {\n let cleanupFn: CleanupFn | void;\n let isDisposed = false;\n\n const observer: Observer = () => {\n if (isDisposed) return;\n\n // Run previous cleanup if exists\n if (cleanupFn) {\n cleanupFn();\n }\n\n // Run effect and capture cleanup\n cleanupFn = track(observer, fn);\n };\n\n observer();\n\n return () => {\n isDisposed = true;\n if (cleanupFn) {\n cleanupFn();\n }\n };\n};\n\n/**\n * Batches multiple signal updates into a single notification cycle.\n *\n * Updates made inside the batch function are deferred until the batch\n * completes, preventing intermediate re-renders and improving performance.\n *\n * @param fn - Function containing multiple signal updates\n *\n * @example\n * ```ts\n * batch(() => {\n * firstName.value = 'John';\n * lastName.value = 'Doe';\n * age.value = 30;\n * });\n * // Effects only run once with all three updates\n * ```\n */\nexport const batch = (fn: () => void): void => {\n batchDepth += 1;\n try {\n fn();\n } finally {\n batchDepth -= 1;\n if (batchDepth === 0) {\n flushObservers();\n }\n }\n};\n\n/**\n * Creates a signal that persists to localStorage.\n *\n * @template T - The type of the signal value\n * @param key - The localStorage key\n * @param initialValue - The initial value if not found in storage\n * @returns A Signal that syncs with localStorage\n *\n * @example\n * ```ts\n * const theme = persistedSignal('theme', 'light');\n * theme.value = 'dark'; // Automatically saved to localStorage\n * ```\n */\nexport const persistedSignal = <T>(key: string, initialValue: T): Signal<T> => {\n let stored: T = initialValue;\n\n try {\n const raw = localStorage.getItem(key);\n if (raw !== null) {\n stored = JSON.parse(raw) as T;\n }\n } catch {\n // Use initial value on parse error\n }\n\n const sig = signal(stored);\n\n // Create an effect to persist changes\n effect(() => {\n try {\n localStorage.setItem(key, JSON.stringify(sig.value));\n } catch {\n // Ignore storage errors\n }\n });\n\n return sig;\n};\n","/**\n * Minimal Web Component helper for building custom elements.\n *\n * This module provides a declarative API for defining Web Components\n * without complex build steps. Features include:\n * - Type-safe props with automatic attribute coercion\n * - Reactive state management\n * - Shadow DOM encapsulation with scoped styles\n * - Lifecycle hooks (connected, disconnected)\n * - Event emission helpers\n *\n * @module bquery/component\n *\n * @example\n * ```ts\n * import { component, html } from 'bquery/component';\n *\n * component('user-card', {\n * props: {\n * username: { type: String, required: true },\n * avatar: { type: String, default: '/default-avatar.png' },\n * },\n * styles: `\n * .card { padding: 1rem; border: 1px solid #ccc; }\n * `,\n * render({ props }) {\n * return html`\n * <div class=\"card\">\n * <img src=\"${props.avatar}\" alt=\"${props.username}\" />\n * <h3>${props.username}</h3>\n * </div>\n * `;\n * },\n * });\n * ```\n */\n\n/**\n * Defines a single prop's type and configuration.\n *\n * @template T - The TypeScript type of the prop value\n *\n * @example\n * ```ts\n * const myProp: PropDefinition<number> = {\n * type: Number,\n * required: false,\n * default: 0,\n * };\n * ```\n */\nexport type PropDefinition<T = unknown> = {\n /** Constructor or converter function for the prop type */\n type:\n | StringConstructor\n | NumberConstructor\n | BooleanConstructor\n | ObjectConstructor\n | ArrayConstructor\n | { new (value: unknown): T }\n | ((value: unknown) => T);\n /** Whether the prop must be provided */\n required?: boolean;\n /** Default value when prop is not provided */\n default?: T;\n};\n\n/**\n * Complete component definition including props, state, styles, and lifecycle.\n *\n * @template TProps - Type of the component's props\n */\nexport type ComponentDefinition<TProps extends Record<string, unknown> = Record<string, unknown>> =\n {\n /** Prop definitions with types and defaults */\n props?: Record<keyof TProps, PropDefinition>;\n /** Initial internal state */\n state?: Record<string, unknown>;\n /** CSS styles scoped to the component's shadow DOM */\n styles?: string;\n /** Lifecycle hook called when component is added to DOM */\n connected?: () => void;\n /** Lifecycle hook called when component is removed from DOM */\n disconnected?: () => void;\n /** Lifecycle hook called after reactive updates trigger a render */\n updated?: () => void;\n /** Render function returning HTML string */\n render: (context: {\n props: TProps;\n state: Record<string, unknown>;\n emit: (event: string, detail?: unknown) => void;\n }) => string;\n };\n\n/**\n * Coerces a string attribute value into a typed prop value.\n * Supports String, Number, Boolean, Object, Array, and custom converters.\n *\n * @internal\n * @template T - The target type\n * @param rawValue - The raw string value from the attribute\n * @param config - The prop definition with type information\n * @returns The coerced value of type T\n */\nconst coercePropValue = <T>(rawValue: string, config: PropDefinition<T>): T => {\n const { type } = config;\n\n if (type === String) return rawValue as T;\n\n if (type === Number) {\n const parsed = Number(rawValue);\n return (Number.isNaN(parsed) ? rawValue : parsed) as T;\n }\n\n if (type === Boolean) {\n const normalized = rawValue.trim().toLowerCase();\n if (normalized === '' || normalized === 'true' || normalized === '1') {\n return true as T;\n }\n if (normalized === 'false' || normalized === '0') {\n return false as T;\n }\n return Boolean(rawValue) as T;\n }\n\n if (type === Object || type === Array) {\n try {\n return JSON.parse(rawValue) as T;\n } catch {\n return rawValue as T;\n }\n }\n\n if (typeof type === 'function') {\n const callable = type as (value: unknown) => T;\n const constructable = type as new (value: unknown) => T;\n try {\n return callable(rawValue);\n } catch {\n return new constructable(rawValue);\n }\n }\n\n return rawValue as T;\n};\n\n/**\n * Tagged template literal for creating HTML strings.\n *\n * This function handles interpolation of values into HTML templates,\n * converting null/undefined to empty strings.\n *\n * @param strings - Template literal string parts\n * @param values - Interpolated values\n * @returns Combined HTML string\n *\n * @example\n * ```ts\n * const name = 'World';\n * const greeting = html`<h1>Hello, ${name}!</h1>`;\n * // Result: '<h1>Hello, World!</h1>'\n * ```\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]): string => {\n return strings.reduce((acc, part, index) => `${acc}${part}${values[index] ?? ''}`, '');\n};\n\n/**\n * Escapes HTML entities in interpolated values for XSS prevention.\n * Use this when you need to safely embed user content in templates.\n *\n * @param strings - Template literal string parts\n * @param values - Interpolated values to escape\n * @returns Combined HTML string with escaped values\n *\n * @example\n * ```ts\n * const userInput = '<script>alert(\"xss\")</script>';\n * const safe = safeHtml`<div>${userInput}</div>`;\n * // Result: '<div>&lt;script&gt;alert(\"xss\")&lt;/script&gt;</div>'\n * ```\n */\nexport const safeHtml = (strings: TemplateStringsArray, ...values: unknown[]): string => {\n const escapeMap: Record<string, string> = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#x27;',\n '`': '&#x60;',\n };\n\n const escape = (value: unknown): string => {\n const str = String(value ?? '');\n return str.replace(/[&<>\"'`]/g, (char) => escapeMap[char]);\n };\n\n return strings.reduce((acc, part, index) => `${acc}${part}${escape(values[index])}`, '');\n};\n\n/**\n * Defines and registers a custom Web Component.\n *\n * This function creates a new custom element with the given tag name\n * and configuration. The component uses Shadow DOM for encapsulation\n * and automatically re-renders when observed attributes change.\n *\n * @template TProps - Type of the component's props\n * @param tagName - The custom element tag name (must contain a hyphen)\n * @param definition - The component configuration\n *\n * @example\n * ```ts\n * component('counter-button', {\n * props: {\n * start: { type: Number, default: 0 },\n * },\n * state: { count: 0 },\n * styles: `\n * button { padding: 0.5rem 1rem; }\n * `,\n * connected() {\n * console.log('Counter mounted');\n * },\n * render({ props, state, emit }) {\n * return html`\n * <button onclick=\"this.getRootNode().host.increment()\">\n * Count: ${state.count}\n * </button>\n * `;\n * },\n * });\n * ```\n */\nexport const component = <TProps extends Record<string, unknown>>(\n tagName: string,\n definition: ComponentDefinition<TProps>\n): void => {\n /**\n * Internal Web Component class created for each component definition.\n * @internal\n */\n class BQueryComponent extends HTMLElement {\n /** Internal state object for the component */\n private readonly state = { ...(definition.state ?? {}) };\n /** Typed props object populated from attributes */\n private props = {} as TProps;\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n this.syncProps();\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n */\n static get observedAttributes(): string[] {\n return Object.keys(definition.props ?? {});\n }\n\n /**\n * Called when the element is added to the DOM.\n */\n connectedCallback(): void {\n definition.connected?.call(this);\n this.render();\n }\n\n /**\n * Called when the element is removed from the DOM.\n */\n disconnectedCallback(): void {\n definition.disconnected?.call(this);\n }\n\n /**\n * Called when an observed attribute changes.\n */\n attributeChangedCallback(): void {\n this.syncProps();\n this.render(true);\n }\n\n /**\n * Updates a state property and triggers a re-render.\n *\n * @param key - The state property key\n * @param value - The new value\n */\n setState(key: string, value: unknown): void {\n this.state[key] = value;\n this.render(true);\n }\n\n /**\n * Gets a state property value.\n *\n * @param key - The state property key\n * @returns The current value\n */\n getState<T = unknown>(key: string): T {\n return this.state[key] as T;\n }\n\n /**\n * Synchronizes props from attributes.\n * @internal\n */\n private syncProps(): void {\n const props = definition.props ?? {};\n for (const [key, config] of Object.entries(props) as [string, PropDefinition][]) {\n const attrValue = this.getAttribute(key);\n if (attrValue == null) {\n if (config.required && config.default === undefined) {\n throw new Error(`bQuery component: missing required prop \"${key}\"`);\n }\n (this.props as Record<string, unknown>)[key] = config.default ?? undefined;\n continue;\n }\n (this.props as Record<string, unknown>)[key] = coercePropValue(\n attrValue,\n config\n ) as TProps[keyof TProps];\n }\n }\n\n /**\n * Renders the component to its shadow root.\n * @internal\n */\n private render(triggerUpdated = false): void {\n /**\n * Emits a custom event from the component.\n */\n const emit = (event: string, detail?: unknown): void => {\n this.dispatchEvent(new CustomEvent(event, { detail, bubbles: true, composed: true }));\n };\n\n if (!this.shadowRoot) return;\n\n const markup = definition.render({\n props: this.props,\n state: this.state,\n emit,\n });\n\n const styles = definition.styles ? `<style>${definition.styles}</style>` : '';\n this.shadowRoot.innerHTML = `${styles}${markup}`;\n\n if (triggerUpdated) {\n definition.updated?.call(this);\n }\n }\n }\n\n if (!customElements.get(tagName)) {\n customElements.define(tagName, BQueryComponent);\n }\n};\n","/**\n * Motion module providing view transitions, FLIP animations, and spring physics.\n * Designed to work with modern browser APIs while providing smooth fallbacks.\n *\n * @module bquery/motion\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Options for view transitions.\n */\nexport interface TransitionOptions {\n /** The DOM update function to execute during transition */\n update: () => void;\n}\n\n/**\n * Captured element bounds for FLIP animations.\n */\nexport interface ElementBounds {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\n/**\n * FLIP animation configuration options.\n */\nexport interface FlipOptions {\n /** Animation duration in milliseconds */\n duration?: number;\n /** CSS easing function */\n easing?: string;\n /** Callback when animation completes */\n onComplete?: () => void;\n}\n\n/**\n * Spring physics configuration.\n */\nexport interface SpringConfig {\n /** Spring stiffness (default: 100) */\n stiffness?: number;\n /** Damping coefficient (default: 10) */\n damping?: number;\n /** Mass of the object (default: 1) */\n mass?: number;\n /** Velocity threshold for completion (default: 0.01) */\n precision?: number;\n}\n\n/**\n * Spring instance for animating values.\n */\nexport interface Spring {\n /** Start animating to target value */\n to(target: number): Promise<void>;\n /** Get current animated value */\n current(): number;\n /** Stop the animation */\n stop(): void;\n /** Subscribe to value changes */\n onChange(callback: (value: number) => void): () => void;\n}\n\n// ============================================================================\n// View Transitions\n// ============================================================================\n\n/** Extended document type with View Transitions API */\ntype DocumentWithTransition = Document & {\n startViewTransition?: (callback: () => void) => {\n finished: Promise<void>;\n ready: Promise<void>;\n updateCallbackDone: Promise<void>;\n };\n};\n\n/**\n * Execute a DOM update with view transition animation.\n * Falls back to immediate update when View Transitions API is unavailable.\n *\n * @param updateOrOptions - Update function or options object\n * @returns Promise that resolves when transition completes\n *\n * @example\n * ```ts\n * await transition(() => {\n * $('#content').text('Updated');\n * });\n * ```\n */\nexport const transition = async (\n updateOrOptions: (() => void) | TransitionOptions\n): Promise<void> => {\n const update = typeof updateOrOptions === 'function' ? updateOrOptions : updateOrOptions.update;\n\n const doc = document as DocumentWithTransition;\n\n if (doc.startViewTransition) {\n await doc.startViewTransition(() => update()).finished;\n return;\n }\n\n update();\n};\n\n// ============================================================================\n// FLIP Animations\n// ============================================================================\n\n/**\n * Capture the current bounds of an element for FLIP animation.\n *\n * @param element - The DOM element to measure\n * @returns The element's current position and size\n */\nexport const capturePosition = (element: Element): ElementBounds => {\n const rect = element.getBoundingClientRect();\n return {\n top: rect.top,\n left: rect.left,\n width: rect.width,\n height: rect.height,\n };\n};\n\n/**\n * Perform a FLIP (First, Last, Invert, Play) animation.\n * Animates an element from its captured position to its current position.\n *\n * @param element - The element to animate\n * @param firstBounds - The previously captured bounds\n * @param options - Animation configuration\n * @returns Promise that resolves when animation completes\n *\n * @example\n * ```ts\n * const first = capturePosition(element);\n * // ... DOM changes that move the element ...\n * await flip(element, first, { duration: 300 });\n * ```\n */\nexport const flip = (\n element: Element,\n firstBounds: ElementBounds,\n options: FlipOptions = {}\n): Promise<void> => {\n const { duration = 300, easing = 'ease-out', onComplete } = options;\n\n // Last: Get current position\n const lastBounds = capturePosition(element);\n\n // Skip animation if element has zero dimensions (avoid division by zero)\n if (lastBounds.width === 0 || lastBounds.height === 0) {\n return Promise.resolve();\n }\n\n // Invert: Calculate the delta\n const deltaX = firstBounds.left - lastBounds.left;\n const deltaY = firstBounds.top - lastBounds.top;\n const deltaW = firstBounds.width / lastBounds.width;\n const deltaH = firstBounds.height / lastBounds.height;\n\n // Skip animation if no change\n if (deltaX === 0 && deltaY === 0 && deltaW === 1 && deltaH === 1) {\n return Promise.resolve();\n }\n\n const htmlElement = element as HTMLElement;\n\n // Apply inverted transform\n htmlElement.style.transform = `translate(${deltaX}px, ${deltaY}px) scale(${deltaW}, ${deltaH})`;\n htmlElement.style.transformOrigin = 'top left';\n\n // Force reflow\n void htmlElement.offsetHeight;\n\n // Play: Animate back to current position\n return new Promise((resolve) => {\n const animation = htmlElement.animate(\n [\n {\n transform: `translate(${deltaX}px, ${deltaY}px) scale(${deltaW}, ${deltaH})`,\n },\n { transform: 'translate(0, 0) scale(1, 1)' },\n ],\n { duration, easing, fill: 'forwards' }\n );\n\n animation.onfinish = () => {\n htmlElement.style.transform = '';\n htmlElement.style.transformOrigin = '';\n onComplete?.();\n resolve();\n };\n });\n};\n\n/**\n * FLIP helper for animating a list of elements.\n * Useful for reordering lists with smooth animations.\n *\n * @param elements - Array of elements to animate\n * @param performUpdate - Function that performs the DOM update\n * @param options - Animation configuration\n *\n * @example\n * ```ts\n * await flipList(listItems, () => {\n * container.appendChild(container.firstChild); // Move first to last\n * });\n * ```\n */\nexport const flipList = async (\n elements: Element[],\n performUpdate: () => void,\n options: FlipOptions = {}\n): Promise<void> => {\n // First: Capture all positions\n const positions = new Map<Element, ElementBounds>();\n for (const el of elements) {\n positions.set(el, capturePosition(el));\n }\n\n // Perform DOM update\n performUpdate();\n\n // Animate each element\n const animations = elements.map((el) => {\n const first = positions.get(el);\n if (!first) return Promise.resolve();\n return flip(el, first, options);\n });\n\n await Promise.all(animations);\n};\n\n// ============================================================================\n// Spring Physics\n// ============================================================================\n\n/**\n * Default spring configuration values.\n */\nconst DEFAULT_SPRING_CONFIG: Required<SpringConfig> = {\n stiffness: 100,\n damping: 10,\n mass: 1,\n precision: 0.01,\n};\n\n/**\n * Create a spring-based animation for smooth, physics-based motion.\n *\n * @param initialValue - Starting value for the spring\n * @param config - Spring physics configuration\n * @returns Spring instance for controlling the animation\n *\n * @example\n * ```ts\n * const x = spring(0, { stiffness: 120, damping: 14 });\n * x.onChange((value) => {\n * element.style.transform = `translateX(${value}px)`;\n * });\n * await x.to(100);\n * ```\n */\nexport const spring = (initialValue: number, config: SpringConfig = {}): Spring => {\n const { stiffness, damping, mass, precision } = {\n ...DEFAULT_SPRING_CONFIG,\n ...config,\n };\n\n let current = initialValue;\n let velocity = 0;\n let target = initialValue;\n let animationFrame: number | null = null;\n let resolvePromise: (() => void) | null = null;\n const listeners = new Set<(value: number) => void>();\n\n const notifyListeners = () => {\n for (const listener of listeners) {\n listener(current);\n }\n };\n\n const step = () => {\n // Spring physics calculation\n const displacement = current - target;\n const springForce = -stiffness * displacement;\n const dampingForce = -damping * velocity;\n const acceleration = (springForce + dampingForce) / mass;\n\n velocity += acceleration * (1 / 60); // Assuming 60fps\n current += velocity * (1 / 60);\n\n notifyListeners();\n\n // Check if spring has settled\n if (Math.abs(velocity) < precision && Math.abs(displacement) < precision) {\n current = target;\n velocity = 0;\n animationFrame = null;\n notifyListeners();\n resolvePromise?.();\n resolvePromise = null;\n return;\n }\n\n animationFrame = requestAnimationFrame(step);\n };\n\n return {\n to(newTarget: number): Promise<void> {\n target = newTarget;\n\n if (animationFrame !== null) {\n cancelAnimationFrame(animationFrame);\n }\n\n return new Promise((resolve) => {\n resolvePromise = resolve;\n animationFrame = requestAnimationFrame(step);\n });\n },\n\n current(): number {\n return current;\n },\n\n stop(): void {\n if (animationFrame !== null) {\n cancelAnimationFrame(animationFrame);\n animationFrame = null;\n }\n velocity = 0;\n resolvePromise?.();\n resolvePromise = null;\n },\n\n onChange(callback: (value: number) => void): () => void {\n listeners.add(callback);\n return () => listeners.delete(callback);\n },\n };\n};\n\n/**\n * Preset spring configurations for common use cases.\n */\nexport const springPresets = {\n /** Gentle, slow-settling spring */\n gentle: { stiffness: 80, damping: 15 } as SpringConfig,\n /** Responsive, snappy spring */\n snappy: { stiffness: 200, damping: 20 } as SpringConfig,\n /** Bouncy, playful spring */\n bouncy: { stiffness: 300, damping: 8 } as SpringConfig,\n /** Stiff, quick spring with minimal overshoot */\n stiff: { stiffness: 400, damping: 30 } as SpringConfig,\n};\n","/**\n * Storage Buckets API wrapper.\n * Provides a simplified interface for storing blobs and binary data.\n * Falls back to IndexedDB when Storage Buckets API is not available.\n */\n\n/**\n * Bucket interface for blob storage operations.\n */\nexport interface Bucket {\n /**\n * Store a blob in the bucket.\n * @param key - Unique identifier for the blob\n * @param data - Blob data to store\n */\n put(key: string, data: Blob): Promise<void>;\n\n /**\n * Retrieve a blob from the bucket.\n * @param key - Blob identifier\n * @returns The stored blob or null if not found\n */\n get(key: string): Promise<Blob | null>;\n\n /**\n * Remove a blob from the bucket.\n * @param key - Blob identifier\n */\n remove(key: string): Promise<void>;\n\n /**\n * List all keys in the bucket.\n * @returns Array of blob keys\n */\n keys(): Promise<string[]>;\n}\n\n/**\n * IndexedDB-based bucket implementation.\n * Used as fallback when Storage Buckets API is unavailable.\n */\nclass IndexedDBBucket implements Bucket {\n private dbPromise: Promise<IDBDatabase> | null = null;\n private readonly storeName = 'blobs';\n\n constructor(private readonly bucketName: string) {}\n\n private openDB(): Promise<IDBDatabase> {\n if (this.dbPromise) return this.dbPromise;\n\n const dbName = `bquery-bucket-${this.bucketName}`;\n this.dbPromise = new Promise((resolve, reject) => {\n const request = indexedDB.open(dbName, 1);\n\n request.onupgradeneeded = () => {\n const db = request.result;\n if (!db.objectStoreNames.contains(this.storeName)) {\n db.createObjectStore(this.storeName);\n }\n };\n\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n });\n\n return this.dbPromise;\n }\n\n private async withStore<T>(\n mode: IDBTransactionMode,\n operation: (store: IDBObjectStore) => IDBRequest<T>\n ): Promise<T> {\n const db = await this.openDB();\n return new Promise((resolve, reject) => {\n const tx = db.transaction(this.storeName, mode);\n const store = tx.objectStore(this.storeName);\n const request = operation(store);\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n });\n }\n\n async put(key: string, data: Blob): Promise<void> {\n await this.withStore('readwrite', (store) => store.put(data, key));\n }\n\n async get(key: string): Promise<Blob | null> {\n const result = await this.withStore<Blob | undefined>('readonly', (store) => store.get(key));\n return result ?? null;\n }\n\n async remove(key: string): Promise<void> {\n await this.withStore('readwrite', (store) => store.delete(key));\n }\n\n async keys(): Promise<string[]> {\n const result = await this.withStore<IDBValidKey[]>('readonly', (store) => store.getAllKeys());\n return result.map((key) => String(key));\n }\n}\n\n/**\n * Bucket manager for creating and accessing storage buckets.\n */\nexport const buckets = {\n /**\n * Open or create a storage bucket.\n * @param name - Bucket name\n * @returns Bucket instance for blob operations\n */\n async open(name: string): Promise<Bucket> {\n // Storage Buckets API is experimental; use IndexedDB fallback\n return new IndexedDBBucket(name);\n },\n};\n","/**\n * Cache Storage API wrapper.\n * Provides a simplified interface for caching responses and assets.\n */\n\n/**\n * Cache handle interface for managing cached resources.\n */\nexport interface CacheHandle {\n /**\n * Add a resource to the cache by URL.\n * Fetches the resource and stores the response.\n * @param url - URL to fetch and cache\n */\n add(url: string): Promise<void>;\n\n /**\n * Add multiple resources to the cache.\n * @param urls - Array of URLs to fetch and cache\n */\n addAll(urls: string[]): Promise<void>;\n\n /**\n * Store a custom response in the cache.\n * @param url - URL key for the cached response\n * @param response - Response object to cache\n */\n put(url: string, response: Response): Promise<void>;\n\n /**\n * Retrieve a cached response.\n * @param url - URL to look up\n * @returns Cached Response or undefined if not found\n */\n match(url: string): Promise<Response | undefined>;\n\n /**\n * Remove a cached response.\n * @param url - URL to remove from cache\n * @returns True if the entry was deleted\n */\n remove(url: string): Promise<boolean>;\n\n /**\n * Get all cached request URLs.\n * @returns Array of cached URLs\n */\n keys(): Promise<string[]>;\n}\n\n/**\n * Internal cache handle implementation.\n */\nclass CacheHandleImpl implements CacheHandle {\n constructor(private readonly cache: Cache) {}\n\n async add(url: string): Promise<void> {\n await this.cache.add(url);\n }\n\n async addAll(urls: string[]): Promise<void> {\n await this.cache.addAll(urls);\n }\n\n async put(url: string, response: Response): Promise<void> {\n await this.cache.put(url, response);\n }\n\n async match(url: string): Promise<Response | undefined> {\n return this.cache.match(url);\n }\n\n async remove(url: string): Promise<boolean> {\n return this.cache.delete(url);\n }\n\n async keys(): Promise<string[]> {\n const requests = await this.cache.keys();\n return requests.map((req) => req.url);\n }\n}\n\n/**\n * Cache manager for accessing the Cache Storage API.\n */\nexport const cache = {\n /**\n * Check if Cache Storage API is supported.\n * @returns True if caches API is available\n */\n isSupported(): boolean {\n return 'caches' in window;\n },\n\n /**\n * Open or create a named cache.\n * @param name - Cache name\n * @returns CacheHandle for cache operations\n */\n async open(name: string): Promise<CacheHandle> {\n if (!this.isSupported()) {\n throw new Error('bQuery: Cache Storage API not supported');\n }\n const c = await caches.open(name);\n return new CacheHandleImpl(c);\n },\n\n /**\n * Delete a named cache.\n * @param name - Cache name to delete\n * @returns True if the cache was deleted\n */\n async delete(name: string): Promise<boolean> {\n if (!this.isSupported()) {\n return false;\n }\n return caches.delete(name);\n },\n\n /**\n * List all cache names.\n * @returns Array of cache names\n */\n async keys(): Promise<string[]> {\n if (!this.isSupported()) {\n return [];\n }\n return caches.keys();\n },\n};\n","/**\n * Web Notifications API wrapper.\n * Provides a simplified interface for browser notifications.\n */\n\n/**\n * Notification options matching the standard NotificationOptions interface.\n */\nexport interface NotificationOptions {\n /** Body text of the notification */\n body?: string;\n /** Icon URL for the notification */\n icon?: string;\n /** Badge icon for mobile devices */\n badge?: string;\n /** Tag for grouping notifications */\n tag?: string;\n /** Whether to require user interaction */\n requireInteraction?: boolean;\n /** Vibration pattern for mobile devices */\n vibrate?: number[];\n /** Additional data attached to the notification */\n data?: unknown;\n}\n\n/**\n * Notifications manager providing a clean interface for web notifications.\n */\nexport const notifications = {\n /**\n * Check if notifications are supported.\n * @returns True if Notification API is available\n */\n isSupported(): boolean {\n return 'Notification' in window;\n },\n\n /**\n * Get current permission status.\n * @returns Current permission state\n */\n getPermission(): NotificationPermission {\n if (!this.isSupported()) return 'denied';\n return Notification.permission;\n },\n\n /**\n * Request notification permission from the user.\n * @returns Promise resolving to the permission result\n */\n async requestPermission(): Promise<NotificationPermission> {\n if (!this.isSupported()) {\n return 'denied';\n }\n\n if (Notification.permission === 'granted') {\n return 'granted';\n }\n\n if (Notification.permission === 'denied') {\n return 'denied';\n }\n\n return Notification.requestPermission();\n },\n\n /**\n * Send a notification.\n * Requires 'granted' permission.\n * @param title - Notification title\n * @param options - Optional notification settings\n * @returns The Notification instance or null if not permitted\n */\n send(title: string, options?: NotificationOptions): Notification | null {\n if (!this.isSupported()) {\n console.warn('bQuery: Notifications not supported in this browser');\n return null;\n }\n\n if (Notification.permission !== 'granted') {\n console.warn('bQuery: Notification permission not granted');\n return null;\n }\n\n return new Notification(title, options);\n },\n};\n","/**\n * Unified storage adapters for web platform storage APIs.\n * Provides a consistent, promise-based interface with predictable errors.\n */\n\n/**\n * Common interface for all storage adapters.\n * All methods return promises for a unified async API.\n */\nexport interface StorageAdapter {\n /**\n * Retrieve a value by key.\n * @param key - The storage key\n * @returns The stored value or null if not found\n */\n get<T>(key: string): Promise<T | null>;\n\n /**\n * Store a value by key.\n * @param key - The storage key\n * @param value - The value to store\n */\n set<T>(key: string, value: T): Promise<void>;\n\n /**\n * Remove a value by key.\n * @param key - The storage key\n */\n remove(key: string): Promise<void>;\n\n /**\n * Clear all stored values.\n */\n clear(): Promise<void>;\n\n /**\n * Get all storage keys.\n * @returns Array of all keys\n */\n keys(): Promise<string[]>;\n}\n\n/**\n * Abstract base class for web storage adapters (localStorage/sessionStorage).\n * Implements DRY principle by sharing common logic.\n */\nabstract class WebStorageAdapter implements StorageAdapter {\n constructor(protected readonly storage: Storage) {}\n\n async get<T>(key: string): Promise<T | null> {\n const raw = this.storage.getItem(key);\n if (raw === null) return null;\n try {\n return JSON.parse(raw) as T;\n } catch {\n return raw as unknown as T;\n }\n }\n\n async set<T>(key: string, value: T): Promise<void> {\n const serialized = typeof value === 'string' ? value : JSON.stringify(value);\n this.storage.setItem(key, serialized);\n }\n\n async remove(key: string): Promise<void> {\n this.storage.removeItem(key);\n }\n\n async clear(): Promise<void> {\n this.storage.clear();\n }\n\n async keys(): Promise<string[]> {\n return Object.keys(this.storage);\n }\n}\n\n/**\n * localStorage adapter with async interface.\n */\nclass LocalStorageAdapter extends WebStorageAdapter {\n constructor() {\n super(localStorage);\n }\n}\n\n/**\n * sessionStorage adapter with async interface.\n */\nclass SessionStorageAdapter extends WebStorageAdapter {\n constructor() {\n super(sessionStorage);\n }\n}\n\n/**\n * IndexedDB configuration options.\n */\nexport interface IndexedDBOptions {\n /** Database name */\n name: string;\n /** Object store name */\n store: string;\n /** Database version (optional) */\n version?: number;\n}\n\n/**\n * IndexedDB key-value adapter.\n * Wraps IndexedDB with a simple key-value interface.\n */\nclass IndexedDBAdapter implements StorageAdapter {\n private dbPromise: Promise<IDBDatabase> | null = null;\n\n constructor(private readonly options: IndexedDBOptions) {}\n\n /**\n * Opens or creates the IndexedDB database.\n */\n private openDB(): Promise<IDBDatabase> {\n if (this.dbPromise) return this.dbPromise;\n\n this.dbPromise = new Promise((resolve, reject) => {\n const request = indexedDB.open(this.options.name, this.options.version ?? 1);\n\n request.onupgradeneeded = () => {\n const db = request.result;\n if (!db.objectStoreNames.contains(this.options.store)) {\n db.createObjectStore(this.options.store);\n }\n };\n\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n });\n\n return this.dbPromise;\n }\n\n /**\n * Executes a transaction on the object store.\n */\n private async withStore<T>(\n mode: IDBTransactionMode,\n operation: (store: IDBObjectStore) => IDBRequest<T>\n ): Promise<T> {\n const db = await this.openDB();\n return new Promise((resolve, reject) => {\n const tx = db.transaction(this.options.store, mode);\n const store = tx.objectStore(this.options.store);\n const request = operation(store);\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error);\n });\n }\n\n async get<T>(key: string): Promise<T | null> {\n const result = await this.withStore<T | undefined>('readonly', (store) => store.get(key));\n return result ?? null;\n }\n\n async set<T>(key: string, value: T): Promise<void> {\n await this.withStore('readwrite', (store) => store.put(value, key));\n }\n\n async remove(key: string): Promise<void> {\n await this.withStore('readwrite', (store) => store.delete(key));\n }\n\n async clear(): Promise<void> {\n await this.withStore('readwrite', (store) => store.clear());\n }\n\n async keys(): Promise<string[]> {\n const result = await this.withStore<IDBValidKey[]>('readonly', (store) => store.getAllKeys());\n return result.map((key) => String(key));\n }\n}\n\n/**\n * Storage factory providing access to different storage adapters.\n */\nexport const storage = {\n /**\n * Create a localStorage adapter.\n * @returns StorageAdapter wrapping localStorage\n */\n local(): StorageAdapter {\n return new LocalStorageAdapter();\n },\n\n /**\n * Create a sessionStorage adapter.\n * @returns StorageAdapter wrapping sessionStorage\n */\n session(): StorageAdapter {\n return new SessionStorageAdapter();\n },\n\n /**\n * Create an IndexedDB adapter with key-value interface.\n * @param options - Database and store configuration\n * @returns StorageAdapter wrapping IndexedDB\n */\n indexedDB(options: IndexedDBOptions): StorageAdapter {\n return new IndexedDBAdapter(options);\n },\n};\n"],"names":["POLICY_NAME","cachedPolicy","isTrustedTypesSupported","getTrustedTypesPolicy","win","input","sanitizeHtmlCore","DEFAULT_ALLOWED_TAGS","DEFAULT_ALLOWED_ATTRIBUTES","DANGEROUS_ATTR_PREFIXES","DANGEROUS_PROTOCOLS","isAllowedAttribute","name","allowedSet","allowDataAttrs","lowerName","prefix","normalizeUrl","value","isSafeUrl","normalized","protocol","html","options","allowTags","allowAttributes","allowDataAttributes","stripAllTags","allowedTags","t","allowedAttrs","a","template","walker","toRemove","el","tagName","attrsToRemove","attr","attrName","sanitizeHtml","createTrustedHtml","policy","escapeHtml","text","escapeMap","char","stripTags","generateNonce","length","array","hasCSPDirective","directive","meta","toElementList","applyAll","elements","action","BQueryElement","element","classNames","className","force","key","match","property","val","content","deep","selector","parent","child","event","handler","detail","display","isHidden","newValue","position","BQueryCollection","index","callback","predicate","initialValue","sanitized","$","$$","utils","sources","result","source","fn","delayMs","timeoutId","args","intervalMs","lastRun","now","json","fallback","obj","keys","ms","resolve","min","max","str","_","observerStack","batchDepth","pendingObservers","track","observer","scheduleObserver","flushObservers","Signal","_value","current","next","subscriber","updater","Computed","compute","signal","computed","effect","cleanupFn","isDisposed","batch","persistedSignal","stored","raw","sig","coercePropValue","rawValue","config","type","parsed","callable","constructable","strings","values","acc","part","safeHtml","escape","component","definition","BQueryComponent","props","attrValue","triggerUpdated","emit","markup","styles","transition","updateOrOptions","update","doc","capturePosition","rect","flip","firstBounds","duration","easing","onComplete","lastBounds","deltaX","deltaY","deltaW","deltaH","htmlElement","animation","flipList","performUpdate","positions","animations","first","DEFAULT_SPRING_CONFIG","spring","stiffness","damping","mass","precision","velocity","target","animationFrame","resolvePromise","listeners","notifyListeners","listener","step","displacement","springForce","dampingForce","acceleration","newTarget","springPresets","IndexedDBBucket","bucketName","dbName","reject","request","db","mode","operation","store","data","buckets","CacheHandleImpl","cache","url","urls","response","req","c","notifications","title","WebStorageAdapter","storage","serialized","LocalStorageAdapter","SessionStorageAdapter","IndexedDBAdapter"],"mappings":"8NA4BA,MAAMA,EAAc,mBA4BpB,IAAIC,EAAyC,KAMtC,MAAMC,EAA0B,IAC9B,OAAQ,OAA8B,aAAiB,IAOnDC,EAAwB,IAAgC,CACnE,GAAIF,EAAc,OAAOA,EAEzB,MAAMG,EAAM,OACZ,GAAI,CAACA,EAAI,aAAc,OAAO,KAE9B,GAAI,CACF,OAAAH,EAAeG,EAAI,aAAa,aAAaJ,EAAa,CACxD,WAAaK,GAAkBC,EAAiBD,CAAK,CAAA,CACtD,EACMJ,CACT,MAAQ,CAEN,eAAQ,KAAK,kDAAkDD,CAAW,GAAG,EACtE,IACT,CACF,EASMO,MAA2B,IAAI,CACnC,IACA,OACA,UACA,UACA,QACA,IACA,MACA,MACA,aACA,KACA,SACA,UACA,OACA,OACA,MACA,WACA,OACA,KACA,MACA,UACA,MACA,MACA,KACA,KACA,KACA,aACA,SACA,SACA,OACA,KACA,KACA,KACA,KACA,KACA,KACA,SACA,SACA,KACA,IACA,MACA,QACA,MACA,MACA,QACA,SACA,KACA,OACA,OACA,MACA,KACA,WACA,SACA,IACA,UACA,MACA,WACA,IACA,KACA,KACA,OACA,IACA,OACA,UACA,SACA,QACA,SACA,OACA,SACA,MACA,UACA,MACA,QACA,QACA,KACA,WACA,QACA,KACA,QACA,OACA,KACA,IACA,KACA,MACA,KACF,CAAC,EAKKC,MAAiC,IAAI,CACzC,MACA,QACA,MACA,SACA,SACA,OACA,KACA,OACA,UACA,OACA,OACA,MACA,SACA,QACA,WACA,QACA,OACA,QACA,QACF,CAAC,EAKKC,EAA0B,CAAC,KAAM,YAAY,EAK7CC,EAAsB,CAAC,cAAe,QAAS,WAAW,EAS1DC,EAAqB,CACzBC,EACAC,EACAC,IACY,CACZ,MAAMC,EAAYH,EAAK,YAAA,EAGvB,UAAWI,KAAUP,EACnB,GAAIM,EAAU,WAAWC,CAAM,EAAG,MAAO,GAO3C,OAHIF,GAAkBC,EAAU,WAAW,OAAO,GAG9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0,0 +1,16 @@
1
+ /**
2
+ * bQuery.js — The jQuery for the Modern Web Platform
3
+ *
4
+ * A zero-build, TypeScript-first library that bridges vanilla JavaScript
5
+ * and build-step frameworks with modern features.
6
+ *
7
+ * @module bquery
8
+ * @see https://github.com/your-org/bquery
9
+ */
10
+ export * from './core/index';
11
+ export * from './reactive/index';
12
+ export * from './component/index';
13
+ export * from './motion/index';
14
+ export * from './security/index';
15
+ export * from './platform/index';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,cAAc,CAAC;AAG7B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,gBAAgB,CAAC;AAG/B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { $ as i, $$ as r, BQueryCollection as s, BQueryElement as o, utils as p } from "./core.es.mjs";
2
+ import { Computed as n, Signal as c, batch as l, computed as m, effect as f, persistedSignal as u, signal as g } from "./reactive.es.mjs";
3
+ import { component as x, html as T, safeHtml as y } from "./component.es.mjs";
4
+ import { capturePosition as H, flip as P, flipList as S, spring as z, springPresets as C, transition as $ } from "./motion.es.mjs";
5
+ import { createTrustedHtml as B, escapeHtml as Q, generateNonce as k, getTrustedTypesPolicy as v, hasCSPDirective as D, isTrustedTypesSupported as E, sanitize as L, sanitize as N, stripTags as j } from "./security.es.mjs";
6
+ import { buckets as w, cache as A, notifications as F, storage as G } from "./platform.es.mjs";
7
+ export {
8
+ i as $,
9
+ r as $$,
10
+ s as BQueryCollection,
11
+ o as BQueryElement,
12
+ n as Computed,
13
+ c as Signal,
14
+ l as batch,
15
+ w as buckets,
16
+ A as cache,
17
+ H as capturePosition,
18
+ x as component,
19
+ m as computed,
20
+ B as createTrustedHtml,
21
+ f as effect,
22
+ Q as escapeHtml,
23
+ P as flip,
24
+ S as flipList,
25
+ k as generateNonce,
26
+ v as getTrustedTypesPolicy,
27
+ D as hasCSPDirective,
28
+ T as html,
29
+ E as isTrustedTypesSupported,
30
+ F as notifications,
31
+ u as persistedSignal,
32
+ y as safeHtml,
33
+ L as sanitize,
34
+ N as sanitizeHtml,
35
+ g as signal,
36
+ z as spring,
37
+ C as springPresets,
38
+ G as storage,
39
+ j as stripTags,
40
+ $ as transition,
41
+ p as utils
42
+ };
43
+ //# sourceMappingURL=index.es.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Motion module providing view transitions, FLIP animations, and spring physics.
3
+ * Designed to work with modern browser APIs while providing smooth fallbacks.
4
+ *
5
+ * @module bquery/motion
6
+ */
7
+ /**
8
+ * Options for view transitions.
9
+ */
10
+ export interface TransitionOptions {
11
+ /** The DOM update function to execute during transition */
12
+ update: () => void;
13
+ }
14
+ /**
15
+ * Captured element bounds for FLIP animations.
16
+ */
17
+ export interface ElementBounds {
18
+ top: number;
19
+ left: number;
20
+ width: number;
21
+ height: number;
22
+ }
23
+ /**
24
+ * FLIP animation configuration options.
25
+ */
26
+ export interface FlipOptions {
27
+ /** Animation duration in milliseconds */
28
+ duration?: number;
29
+ /** CSS easing function */
30
+ easing?: string;
31
+ /** Callback when animation completes */
32
+ onComplete?: () => void;
33
+ }
34
+ /**
35
+ * Spring physics configuration.
36
+ */
37
+ export interface SpringConfig {
38
+ /** Spring stiffness (default: 100) */
39
+ stiffness?: number;
40
+ /** Damping coefficient (default: 10) */
41
+ damping?: number;
42
+ /** Mass of the object (default: 1) */
43
+ mass?: number;
44
+ /** Velocity threshold for completion (default: 0.01) */
45
+ precision?: number;
46
+ }
47
+ /**
48
+ * Spring instance for animating values.
49
+ */
50
+ export interface Spring {
51
+ /** Start animating to target value */
52
+ to(target: number): Promise<void>;
53
+ /** Get current animated value */
54
+ current(): number;
55
+ /** Stop the animation */
56
+ stop(): void;
57
+ /** Subscribe to value changes */
58
+ onChange(callback: (value: number) => void): () => void;
59
+ }
60
+ /**
61
+ * Execute a DOM update with view transition animation.
62
+ * Falls back to immediate update when View Transitions API is unavailable.
63
+ *
64
+ * @param updateOrOptions - Update function or options object
65
+ * @returns Promise that resolves when transition completes
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * await transition(() => {
70
+ * $('#content').text('Updated');
71
+ * });
72
+ * ```
73
+ */
74
+ export declare const transition: (updateOrOptions: (() => void) | TransitionOptions) => Promise<void>;
75
+ /**
76
+ * Capture the current bounds of an element for FLIP animation.
77
+ *
78
+ * @param element - The DOM element to measure
79
+ * @returns The element's current position and size
80
+ */
81
+ export declare const capturePosition: (element: Element) => ElementBounds;
82
+ /**
83
+ * Perform a FLIP (First, Last, Invert, Play) animation.
84
+ * Animates an element from its captured position to its current position.
85
+ *
86
+ * @param element - The element to animate
87
+ * @param firstBounds - The previously captured bounds
88
+ * @param options - Animation configuration
89
+ * @returns Promise that resolves when animation completes
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const first = capturePosition(element);
94
+ * // ... DOM changes that move the element ...
95
+ * await flip(element, first, { duration: 300 });
96
+ * ```
97
+ */
98
+ export declare const flip: (element: Element, firstBounds: ElementBounds, options?: FlipOptions) => Promise<void>;
99
+ /**
100
+ * FLIP helper for animating a list of elements.
101
+ * Useful for reordering lists with smooth animations.
102
+ *
103
+ * @param elements - Array of elements to animate
104
+ * @param performUpdate - Function that performs the DOM update
105
+ * @param options - Animation configuration
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * await flipList(listItems, () => {
110
+ * container.appendChild(container.firstChild); // Move first to last
111
+ * });
112
+ * ```
113
+ */
114
+ export declare const flipList: (elements: Element[], performUpdate: () => void, options?: FlipOptions) => Promise<void>;
115
+ /**
116
+ * Create a spring-based animation for smooth, physics-based motion.
117
+ *
118
+ * @param initialValue - Starting value for the spring
119
+ * @param config - Spring physics configuration
120
+ * @returns Spring instance for controlling the animation
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const x = spring(0, { stiffness: 120, damping: 14 });
125
+ * x.onChange((value) => {
126
+ * element.style.transform = `translateX(${value}px)`;
127
+ * });
128
+ * await x.to(100);
129
+ * ```
130
+ */
131
+ export declare const spring: (initialValue: number, config?: SpringConfig) => Spring;
132
+ /**
133
+ * Preset spring configurations for common use cases.
134
+ */
135
+ export declare const springPresets: {
136
+ /** Gentle, slow-settling spring */
137
+ gentle: SpringConfig;
138
+ /** Responsive, snappy spring */
139
+ snappy: SpringConfig;
140
+ /** Bouncy, playful spring */
141
+ bouncy: SpringConfig;
142
+ /** Stiff, quick spring with minimal overshoot */
143
+ stiff: SpringConfig;
144
+ };
145
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/motion/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,IAAI,C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