@data-slot/core 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=(e,t)=>e.querySelector(`[data-slot="${t}"]`),t=(e,t)=>[...e.querySelectorAll(`[data-slot="${t}"]`)],n=(e,t)=>[...e.querySelectorAll(`[data-slot="${t}"]`)];let r=0;const i=(e,t)=>e.id||=`${t}-${++r}`,a=(e,t,n)=>{n===null?e.removeAttribute(`aria-${t}`):e.setAttribute(`aria-${t}`,String(n))},o=(e,t,n)=>{t&&e.setAttribute(`aria-labelledby`,i(t,`title`)),n&&e.setAttribute(`aria-describedby`,i(n,`desc`))}
|
|
1
|
+
const e=(e,t)=>e.querySelector(`[data-slot="${t}"]`),t=(e,t)=>[...e.querySelectorAll(`[data-slot="${t}"]`)],n=(e,t)=>[...e.querySelectorAll(`[data-slot="${t}"]`)];let r=0;const i=(e,t)=>e.id||=`${t}-${++r}`,a=(e,t,n)=>{n===null?e.removeAttribute(`aria-${t}`):e.setAttribute(`aria-${t}`,String(n))},o=(e,t,n)=>{t&&e.setAttribute(`aria-labelledby`,i(t,`title`)),n&&e.setAttribute(`aria-describedby`,i(n,`desc`))};function s(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const c=(e,t,n)=>e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n})),l=(...e)=>t=>{for(let n of e){if(t.defaultPrevented)break;n?.(t)}};exports.composeHandlers=l,exports.emit=c,exports.ensureId=i,exports.getPart=e,exports.getParts=t,exports.getRoots=n,exports.linkLabelledBy=o,exports.on=s,exports.setAria=a;
|
package/dist/index.d.cts
CHANGED
|
@@ -31,7 +31,8 @@ declare const linkLabelledBy: (content: Element, title?: Element | null, descrip
|
|
|
31
31
|
/**
|
|
32
32
|
* Add an event listener and return a cleanup function
|
|
33
33
|
*/
|
|
34
|
-
declare
|
|
34
|
+
declare function on<K extends keyof HTMLElementEventMap>(el: EventTarget, type: K, fn: (e: HTMLElementEventMap[K]) => void, opts?: AddEventListenerOptions): () => void;
|
|
35
|
+
declare function on(el: EventTarget, type: string, fn: (e: Event) => void, opts?: AddEventListenerOptions): () => void;
|
|
35
36
|
/**
|
|
36
37
|
* Dispatch a custom event with optional detail
|
|
37
38
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ declare const linkLabelledBy: (content: Element, title?: Element | null, descrip
|
|
|
31
31
|
/**
|
|
32
32
|
* Add an event listener and return a cleanup function
|
|
33
33
|
*/
|
|
34
|
-
declare
|
|
34
|
+
declare function on<K extends keyof HTMLElementEventMap>(el: EventTarget, type: K, fn: (e: HTMLElementEventMap[K]) => void, opts?: AddEventListenerOptions): () => void;
|
|
35
|
+
declare function on(el: EventTarget, type: string, fn: (e: Event) => void, opts?: AddEventListenerOptions): () => void;
|
|
35
36
|
/**
|
|
36
37
|
* Dispatch a custom event with optional detail
|
|
37
38
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=(e,t)=>e.querySelector(`[data-slot="${t}"]`),t=(e,t)=>[...e.querySelectorAll(`[data-slot="${t}"]`)],n=(e,t)=>[...e.querySelectorAll(`[data-slot="${t}"]`)];let r=0;const i=(e,t)=>e.id||=`${t}-${++r}`,a=(e,t,n)=>{n===null?e.removeAttribute(`aria-${t}`):e.setAttribute(`aria-${t}`,String(n))},o=(e,t,n)=>{t&&e.setAttribute(`aria-labelledby`,i(t,`title`)),n&&e.setAttribute(`aria-describedby`,i(n,`desc`))}
|
|
1
|
+
const e=(e,t)=>e.querySelector(`[data-slot="${t}"]`),t=(e,t)=>[...e.querySelectorAll(`[data-slot="${t}"]`)],n=(e,t)=>[...e.querySelectorAll(`[data-slot="${t}"]`)];let r=0;const i=(e,t)=>e.id||=`${t}-${++r}`,a=(e,t,n)=>{n===null?e.removeAttribute(`aria-${t}`):e.setAttribute(`aria-${t}`,String(n))},o=(e,t,n)=>{t&&e.setAttribute(`aria-labelledby`,i(t,`title`)),n&&e.setAttribute(`aria-describedby`,i(n,`desc`))};function s(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const c=(e,t,n)=>e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n})),l=(...e)=>t=>{for(let n of e){if(t.defaultPrevented)break;n?.(t)}};export{l as composeHandlers,c as emit,i as ensureId,e as getPart,t as getParts,n as getRoots,o as linkLabelledBy,s as on,a as setAria};
|