Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@zag-js/core

Package Overview
Dependencies
Maintainers
1
Versions
1026
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/core - npm Package Compare versions

Comparing version
1.41.1
to
2.0.0-next.0
+5
-0
dist/scope.d.mts

@@ -11,2 +11,7 @@ import { isActiveElement } from '@zag-js/dom-query';

getById: <T extends Element = HTMLElement>(id: string) => T | null;
query: <T extends Element = HTMLElement>(selector: string) => T | null;
queryAll: <T extends Element = HTMLElement>(selector: string) => T[];
selector: (part: {
attr: string;
}) => string;
id?: string | undefined | undefined;

@@ -13,0 +18,0 @@ ids?: Record<string, any> | undefined;

@@ -11,2 +11,7 @@ import { isActiveElement } from '@zag-js/dom-query';

getById: <T extends Element = HTMLElement>(id: string) => T | null;
query: <T extends Element = HTMLElement>(selector: string) => T | null;
queryAll: <T extends Element = HTMLElement>(selector: string) => T[];
selector: (part: {
attr: string;
}) => string;
id?: string | undefined | undefined;

@@ -13,0 +18,0 @@ ids?: Record<string, any> | undefined;

+7
-1

@@ -33,2 +33,5 @@ "use strict";

const getById = (id) => getRootNode().getElementById(id);
const queryFn = (selector) => getRootNode().querySelector(selector) ?? null;
const queryAllFn = (selector) => Array.from(getRootNode().querySelectorAll(selector));
const selectorFn = (part) => `[${part.attr}="${props.id}"]`;
return {

@@ -41,3 +44,6 @@ ...props,

isActiveElement: import_dom_query.isActiveElement,
getById
getById,
query: queryFn,
queryAll: queryAllFn,
selector: selectorFn
};

@@ -44,0 +50,0 @@ }

@@ -9,2 +9,5 @@ // src/scope.ts

const getById = (id) => getRootNode().getElementById(id);
const queryFn = (selector) => getRootNode().querySelector(selector) ?? null;
const queryAllFn = (selector) => Array.from(getRootNode().querySelectorAll(selector));
const selectorFn = (part) => `[${part.attr}="${props.id}"]`;
return {

@@ -17,3 +20,6 @@ ...props,

isActiveElement,
getById
getById,
query: queryFn,
queryAll: queryAllFn,
selector: selectorFn
};

@@ -20,0 +26,0 @@ }

@@ -70,2 +70,7 @@ type Dict = Record<string, any>;

getById: <T extends Element = HTMLElement>(id: string) => T | null;
query: <T extends Element = HTMLElement>(selector: string) => T | null;
queryAll: <T extends Element = HTMLElement>(selector: string) => T[];
selector: (part: {
attr: string;
}) => string;
getActiveElement: () => HTMLElement | null;

@@ -72,0 +77,0 @@ isActiveElement: (elem: HTMLElement | null) => boolean;

@@ -70,2 +70,7 @@ type Dict = Record<string, any>;

getById: <T extends Element = HTMLElement>(id: string) => T | null;
query: <T extends Element = HTMLElement>(selector: string) => T | null;
queryAll: <T extends Element = HTMLElement>(selector: string) => T[];
selector: (part: {
attr: string;
}) => string;
getActiveElement: () => HTMLElement | null;

@@ -72,0 +77,0 @@ isActiveElement: (elem: HTMLElement | null) => boolean;

+3
-3
{
"name": "@zag-js/core",
"version": "1.41.1",
"version": "2.0.0-next.0",
"description": "A minimal implementation of xstate fsm for UI machines",

@@ -28,4 +28,4 @@ "keywords": [

"dependencies": {
"@zag-js/utils": "1.41.1",
"@zag-js/dom-query": "1.41.1"
"@zag-js/utils": "2.0.0-next.0",
"@zag-js/dom-query": "2.0.0-next.0"
},

@@ -32,0 +32,0 @@ "devDependencies": {