@zag-js/dom-query
Advanced tools
Comparing version 0.0.0-dev-20230804152652 to 0.0.0-dev-20230804161728
@@ -18,3 +18,2 @@ type Booleanish = boolean | "true" | "false"; | ||
getById: <T_1 extends HTMLElement = HTMLElement>(ctx: Ctx, id: string) => T_1 | null; | ||
queryById: <T_2 extends HTMLElement = HTMLElement>(ctx: Ctx, id: string) => T_2; | ||
} & T; | ||
@@ -21,0 +20,0 @@ |
@@ -96,9 +96,3 @@ "use strict"; | ||
getActiveElement: (ctx) => screen.getDoc(ctx).activeElement, | ||
getById: (ctx, id) => screen.getRootNode(ctx).getElementById(id), | ||
queryById: (ctx, id) => { | ||
const el = screen.getById(ctx, id); | ||
if (!el) | ||
throw new Error(`Element with id "${id}" not found.`); | ||
return el; | ||
} | ||
getById: (ctx, id) => screen.getRootNode(ctx).getElementById(id) | ||
}; | ||
@@ -105,0 +99,0 @@ return { ...screen, ...methods }; |
{ | ||
"name": "@zag-js/dom-query", | ||
"version": "0.0.0-dev-20230804152652", | ||
"version": "0.0.0-dev-20230804161728", | ||
"description": "The dom helper library for zag.js machines", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -16,9 +16,4 @@ type Ctx = { getRootNode?: () => Document | ShadowRoot | Node } | ||
screen.getRootNode(ctx).getElementById(id) as T | null, | ||
queryById: <T extends HTMLElement = HTMLElement>(ctx: Ctx, id: string): T => { | ||
const el = screen.getById<T>(ctx, id) | ||
if (!el) throw new Error(`Element with id "${id}" not found.`) | ||
return el | ||
}, | ||
} | ||
return { ...screen, ...methods } | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
69254
882