@aria-ui/core
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -168,12 +168,12 @@ import { Signal as Signal$1, ReadonlySignal as ReadonlySignal$1, batch as batch$1, untracked as untracked$1, signal, computed } from '@preact/signals-core'; | ||
/** | ||
* Set the `role` attribute of the element when it's connected. | ||
* | ||
* You can pass a string or a compute function that returns a string. | ||
* | ||
* @group DOM | ||
*/ | ||
declare function useAriaRole(element: ConnectableElement, compute: () => AriaRole | undefined): VoidFunction; | ||
declare function useAriaRole(element: ConnectableElement, role: AriaRole | (() => AriaRole | undefined)): VoidFunction; | ||
/** | ||
* @group DOM | ||
*/ | ||
declare function setAriaRole(element: ConnectableElement, role: AriaRole): void; | ||
/** | ||
* @group DOM | ||
*/ | ||
declare function useQuerySelector<E extends Element = Element>(element: ConnectableElement, selector: string): ReadonlySignal<E | null>; | ||
@@ -186,3 +186,3 @@ /** | ||
/** | ||
* Merge two objects, with the second object taking precedence. Only keys | ||
* Merges two objects, with the second object taking precedence. Only keys | ||
* present in the first object will be included in the result. | ||
@@ -215,2 +215,2 @@ * | ||
export { BaseElement, type ConnectableElement, type Context, type ReadonlySignal, type Signal, type SignalValue, type SingalState, assignProps, batch, createComputed, createContext, createSignal, mapSignals, mapValues, setAriaRole, untracked, useAriaAttribute, useAriaRole, useAttribute, useEffect, useEventListener, useQuerySelector, useQuerySelectorAll, useStyle }; | ||
export { BaseElement, type ConnectableElement, type Context, type ReadonlySignal, type Signal, type SignalValue, type SingalState, assignProps, batch, createComputed, createContext, createSignal, mapSignals, mapValues, untracked, useAriaAttribute, useAriaRole, useAttribute, useEffect, useEventListener, useQuerySelector, useQuerySelectorAll, useStyle }; |
@@ -96,5 +96,9 @@ // src/base-element.ts | ||
element.addEventListener("aria-ui/context-request", (event) => { | ||
if (element === event.target) { | ||
return; | ||
} | ||
const { key, callback } = event; | ||
if (key === this.key) { | ||
callback(signal3); | ||
event.stopPropagation(); | ||
} | ||
@@ -172,8 +176,6 @@ }); | ||
} | ||
function useAriaRole(element, compute) { | ||
function useAriaRole(element, role) { | ||
const compute = typeof role === "string" ? () => role : role; | ||
return useAttribute(element, "role", compute); | ||
} | ||
function setAriaRole(element, role) { | ||
element.setAttribute("role", role); | ||
} | ||
function useMutationObserver(element, options) { | ||
@@ -257,3 +259,2 @@ const mutationCounter = createSignal(1); | ||
mapValues, | ||
setAriaRole, | ||
untracked, | ||
@@ -260,0 +261,0 @@ useAriaAttribute, |
{ | ||
"name": "@aria-ui/core", | ||
"type": "module", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"private": false, | ||
@@ -14,3 +14,3 @@ "sideEffects": false, | ||
"@dddstack/ariatype-aria-roles": "^2.0.0", | ||
"@preact/signals-core": "^1.5.1" | ||
"@preact/signals-core": "^1.6.0" | ||
}, | ||
@@ -17,0 +17,0 @@ "devDependencies": { |
@@ -164,3 +164,3 @@ # @aria-ui/core | ||
Merge two objects, with the second object taking precedence. Only keys present in the first object will be included in the result. | ||
Merges two objects, with the second object taking precedence. Only keys present in the first object will be included in the result. | ||
@@ -216,3 +216,3 @@ ### mapSignals() | ||
```ts | ||
function batch<T>(callback: () => T): T; | ||
function batch<T>(fn: () => T): T; | ||
``` | ||
@@ -227,3 +227,3 @@ | ||
```ts | ||
function createComputed<T>(compute: () => T): ReadonlySignal<T>; | ||
function createComputed<T>(fn: () => T): ReadonlySignal<T>; | ||
``` | ||
@@ -248,3 +248,3 @@ | ||
```ts | ||
function untracked<T>(callback: () => T): T; | ||
function untracked<T>(fn: () => T): T; | ||
``` | ||
@@ -251,0 +251,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21369
466
Updated@preact/signals-core@^1.6.0