Socket
Socket
Sign inDemoInstall

@zag-js/dom-query

Package Overview
Dependencies
Maintainers
0
Versions
669
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/dom-query - npm Package Compare versions

Comparing version 0.57.0 to 0.58.0

2

dist/index.d.ts

@@ -150,3 +150,3 @@ type Booleanish = boolean | "true" | "false";

getWin: (ctx: ScopeContext) => Window & typeof globalThis;
getActiveElement: (ctx: ScopeContext) => HTMLElement | null;
getActiveElement: (ctx: ScopeContext) => Element | null;
isActiveElement: (ctx: ScopeContext, elem: HTMLElement | null) => boolean;

@@ -153,0 +153,0 @@ getById: <T_1 extends Element = HTMLElement>(ctx: ScopeContext, id: string) => T_1 | null;

@@ -653,9 +653,9 @@ "use strict";

function createScope(methods) {
const screen = {
const dom = {
getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
getDoc: (ctx) => getDocument(screen.getRootNode(ctx)),
getWin: (ctx) => screen.getDoc(ctx).defaultView ?? window,
getActiveElement: (ctx) => screen.getDoc(ctx).activeElement,
isActiveElement: (ctx, elem) => elem === screen.getActiveElement(ctx),
getById: (ctx, id) => screen.getRootNode(ctx).getElementById(id),
getDoc: (ctx) => getDocument(dom.getRootNode(ctx)),
getWin: (ctx) => dom.getDoc(ctx).defaultView ?? window,
getActiveElement: (ctx) => dom.getRootNode(ctx).activeElement,
isActiveElement: (ctx, elem) => elem === dom.getActiveElement(ctx),
getById: (ctx, id) => dom.getRootNode(ctx).getElementById(id),
setValue: (elem, value) => {

@@ -668,3 +668,3 @@ if (elem == null || value == null) return;

};
return { ...screen, ...methods };
return { ...dom, ...methods };
}

@@ -671,0 +671,0 @@

{
"name": "@zag-js/dom-query",
"version": "0.57.0",
"version": "0.58.0",
"description": "The dom helper library for zag.js machines",

@@ -5,0 +5,0 @@ "keywords": [

@@ -8,10 +8,10 @@ import { getDocument } from "./env"

export function createScope<T>(methods: T) {
const screen = {
const dom = {
getRootNode: (ctx: ScopeContext) => (ctx.getRootNode?.() ?? document) as Document | ShadowRoot,
getDoc: (ctx: ScopeContext) => getDocument(screen.getRootNode(ctx)),
getWin: (ctx: ScopeContext) => screen.getDoc(ctx).defaultView ?? window,
getActiveElement: (ctx: ScopeContext) => screen.getDoc(ctx).activeElement as HTMLElement | null,
isActiveElement: (ctx: ScopeContext, elem: HTMLElement | null) => elem === screen.getActiveElement(ctx),
getDoc: (ctx: ScopeContext) => getDocument(dom.getRootNode(ctx)),
getWin: (ctx: ScopeContext) => dom.getDoc(ctx).defaultView ?? window,
getActiveElement: (ctx: ScopeContext) => dom.getRootNode(ctx).activeElement,
isActiveElement: (ctx: ScopeContext, elem: HTMLElement | null) => elem === dom.getActiveElement(ctx),
getById: <T extends Element = HTMLElement>(ctx: ScopeContext, id: string) =>
screen.getRootNode(ctx).getElementById(id) as T | null,
dom.getRootNode(ctx).getElementById(id) as T | null,
setValue: <T extends { value: string }>(elem: T | null, value: string | number | null | undefined) => {

@@ -25,3 +25,3 @@ if (elem == null || value == null) return

return { ...screen, ...methods }
return { ...dom, ...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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc