Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stylable/dom-test-kit

Package Overview
Dependencies
Maintainers
5
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stylable/dom-test-kit - npm Package Compare versions

Comparing version 2.3.1-alpha.0 to 2.3.1-alpha.1

16

cjs/stylable-dom-util.d.ts

@@ -12,3 +12,4 @@ import { RuntimeStylesheet, StateValue } from '@stylable/runtime';

private root?;
constructor(stylesheet: RuntimeStylesheet, root?: Element | undefined);
private internal;
constructor(stylesheet: CommonStylesheet, root?: Element | undefined);
select(selector?: string, element?: PartialElement): Element | null;

@@ -19,10 +20,9 @@ selectAll(selector?: string, element?: PartialElement): Element[] | null;

getStyleState(element: PartialElement, stateName: string): string | boolean | null;
getStateValueFromClassName(cls: string, baseState: string): string;
getBaseStateWithParam(stateName: string): string;
getStateValueFromClassName(cls: string, baseState: string): any;
getBaseStateWithParam(stateName: string): any;
}
export declare class StylableDOMUtilCompat {
export declare class StylableDOMUtilV2 {
private stylesheet;
private root?;
private internal;
constructor(stylesheet: CommonStylesheet, root?: Element | undefined);
constructor(stylesheet: RuntimeStylesheet, root?: Element | undefined);
select(selector?: string, element?: PartialElement): Element | null;

@@ -33,5 +33,5 @@ selectAll(selector?: string, element?: PartialElement): Element[] | null;

getStyleState(element: PartialElement, stateName: string): string | boolean | null;
getStateValueFromClassName(cls: string, baseState: string): any;
getBaseStateWithParam(stateName: string): any;
getStateValueFromClassName(cls: string, baseState: string): string;
getBaseStateWithParam(stateName: string): string;
}
//# sourceMappingURL=stylable-dom-util.d.ts.map

@@ -10,8 +10,48 @@ "use strict";

this.root = root;
var mode = legacy_types_1.getStylesheetMode(stylesheet);
if (mode === 'legacy') {
this.internal = new stylable_dom_util_legacy_1.StylableDOMUtilLegacy(this.stylesheet, this.root);
}
else if (mode === 'compat') {
this.internal = new StylableDOMUtilV2(this.stylesheet.originStylesheet, this.root);
}
else {
this.internal = new StylableDOMUtilV2(this.stylesheet, this.root);
}
}
StylableDOMUtil.prototype.select = function (selector, element) {
return this.internal.select(selector, element);
};
StylableDOMUtil.prototype.selectAll = function (selector, element) {
return this.internal.selectAll(selector, element);
};
StylableDOMUtil.prototype.scopeSelector = function (selector) {
return this.internal.scopeSelector(selector);
};
StylableDOMUtil.prototype.hasStyleState = function (element, stateName, param) {
if (param === void 0) { param = true; }
return this.internal.hasStyleState(element, stateName, param);
};
StylableDOMUtil.prototype.getStyleState = function (element, stateName) {
return this.internal.getStyleState(element, stateName);
};
StylableDOMUtil.prototype.getStateValueFromClassName = function (cls, baseState) {
return this.internal.getStateValueFromClassName(cls, baseState);
};
StylableDOMUtil.prototype.getBaseStateWithParam = function (stateName) {
return this.internal.getBaseStateWithParam(stateName);
};
return StylableDOMUtil;
}());
exports.StylableDOMUtil = StylableDOMUtil;
var StylableDOMUtilV2 = /** @class */ (function () {
function StylableDOMUtilV2(stylesheet, root) {
this.stylesheet = stylesheet;
this.root = root;
}
StylableDOMUtilV2.prototype.select = function (selector, element) {
var el = element || this.root;
return el ? el.querySelector(this.scopeSelector(selector)) : null;
};
StylableDOMUtil.prototype.selectAll = function (selector, element) {
StylableDOMUtilV2.prototype.selectAll = function (selector, element) {
var el = element || this.root;

@@ -22,3 +62,3 @@ return el

};
StylableDOMUtil.prototype.scopeSelector = function (selector) {
StylableDOMUtilV2.prototype.scopeSelector = function (selector) {
var _this = this;

@@ -60,3 +100,3 @@ if (!selector) {

};
StylableDOMUtil.prototype.hasStyleState = function (element, stateName, param) {
StylableDOMUtilV2.prototype.hasStyleState = function (element, stateName, param) {
var _a;

@@ -67,3 +107,3 @@ if (param === void 0) { param = true; }

};
StylableDOMUtil.prototype.getStyleState = function (element, stateName) {
StylableDOMUtilV2.prototype.getStyleState = function (element, stateName) {
var _a;

@@ -87,3 +127,3 @@ var _this = this;

};
StylableDOMUtil.prototype.getStateValueFromClassName = function (cls, baseState) {
StylableDOMUtilV2.prototype.getStateValueFromClassName = function (cls, baseState) {
if (cls.startsWith(baseState)) {

@@ -98,3 +138,3 @@ var param = cls.slice(baseState.length);

};
StylableDOMUtil.prototype.getBaseStateWithParam = function (stateName) {
StylableDOMUtilV2.prototype.getBaseStateWithParam = function (stateName) {
var _a;

@@ -104,45 +144,5 @@ var singleCharState = 'x';

};
return StylableDOMUtil;
return StylableDOMUtilV2;
}());
exports.StylableDOMUtil = StylableDOMUtil;
var StylableDOMUtilCompat = /** @class */ (function () {
function StylableDOMUtilCompat(stylesheet, root) {
this.stylesheet = stylesheet;
this.root = root;
var mode = legacy_types_1.getStylesheetMode(stylesheet);
if (mode === 'legacy') {
this.internal = new stylable_dom_util_legacy_1.StylableDOMUtilLegacy(this.stylesheet, this.root);
}
else if (mode === 'compat') {
this.internal = new StylableDOMUtil(this.stylesheet.originStylesheet, this.root);
}
else {
this.internal = new StylableDOMUtil(this.stylesheet, this.root);
}
}
StylableDOMUtilCompat.prototype.select = function (selector, element) {
return this.internal.select(selector, element);
};
StylableDOMUtilCompat.prototype.selectAll = function (selector, element) {
return this.internal.selectAll(selector, element);
};
StylableDOMUtilCompat.prototype.scopeSelector = function (selector) {
return this.internal.scopeSelector(selector);
};
StylableDOMUtilCompat.prototype.hasStyleState = function (element, stateName, param) {
if (param === void 0) { param = true; }
return this.internal.hasStyleState(element, stateName, param);
};
StylableDOMUtilCompat.prototype.getStyleState = function (element, stateName) {
return this.internal.getStyleState(element, stateName);
};
StylableDOMUtilCompat.prototype.getStateValueFromClassName = function (cls, baseState) {
return this.internal.getStateValueFromClassName(cls, baseState);
};
StylableDOMUtilCompat.prototype.getBaseStateWithParam = function (stateName) {
return this.internal.getBaseStateWithParam(stateName);
};
return StylableDOMUtilCompat;
}());
exports.StylableDOMUtilCompat = StylableDOMUtilCompat;
exports.StylableDOMUtilV2 = StylableDOMUtilV2;
//# sourceMappingURL=stylable-dom-util.js.map
{
"name": "@stylable/dom-test-kit",
"version": "2.3.1-alpha.0",
"version": "2.3.1-alpha.1",
"description": "Stylable DOM testing utilities",

@@ -32,3 +32,3 @@ "main": "./cjs/index.js",

"license": "BSD-3-Clause",
"gitHead": "df3e414745ed1a5d70ce7c8a7f5f27b5ca03a4d3"
"gitHead": "2c40784c57eb358eeb2784fa1b4051431e5780a7"
}

@@ -20,2 +20,50 @@ import {

export class StylableDOMUtil {
// compat mode
private internal: any;
constructor(private stylesheet: CommonStylesheet, private root?: Element) {
const mode = getStylesheetMode(stylesheet);
if (mode === 'legacy') {
this.internal = new StylableDOMUtilLegacy(this.stylesheet, this.root);
} else if (mode === 'compat') {
this.internal = new StylableDOMUtilV2(
(this.stylesheet as any).originStylesheet,
this.root
);
} else {
this.internal = new StylableDOMUtilV2(this.stylesheet as RuntimeStylesheet, this.root);
}
}
public select(selector?: string, element?: PartialElement): Element | null {
return this.internal.select(selector, element);
}
public selectAll(selector?: string, element?: PartialElement): Element[] | null {
return this.internal.selectAll(selector, element);
}
public scopeSelector(selector?: string): string {
return this.internal.scopeSelector(selector);
}
public hasStyleState(
element: PartialElement,
stateName: string,
param: StateValue = true
): boolean {
return this.internal.hasStyleState(element, stateName, param);
}
public getStyleState(element: PartialElement, stateName: string): string | boolean | null {
return this.internal.getStyleState(element, stateName);
}
public getStateValueFromClassName(cls: string, baseState: string) {
return this.internal.getStateValueFromClassName(cls, baseState);
}
public getBaseStateWithParam(stateName: string) {
return this.internal.getBaseStateWithParam(stateName);
}
}
export class StylableDOMUtilV2 {
constructor(private stylesheet: RuntimeStylesheet, private root?: Element) {}

@@ -116,47 +164,1 @@ public select(selector?: string, element?: PartialElement): Element | null {

export class StylableDOMUtilCompat {
private internal: any;
constructor(private stylesheet: CommonStylesheet, private root?: Element) {
const mode = getStylesheetMode(stylesheet);
if (mode === 'legacy') {
this.internal = new StylableDOMUtilLegacy(this.stylesheet, this.root);
} else if (mode === 'compat') {
this.internal = new StylableDOMUtil(
(this.stylesheet as any).originStylesheet,
this.root
);
} else {
this.internal = new StylableDOMUtil(this.stylesheet as RuntimeStylesheet, this.root);
}
}
public select(selector?: string, element?: PartialElement): Element | null {
return this.internal.select(selector, element);
}
public selectAll(selector?: string, element?: PartialElement): Element[] | null {
return this.internal.selectAll(selector, element);
}
public scopeSelector(selector?: string): string {
return this.internal.scopeSelector(selector);
}
public hasStyleState(
element: PartialElement,
stateName: string,
param: StateValue = true
): boolean {
return this.internal.hasStyleState(element, stateName, param);
}
public getStyleState(element: PartialElement, stateName: string): string | boolean | null {
return this.internal.getStyleState(element, stateName);
}
public getStateValueFromClassName(cls: string, baseState: string) {
return this.internal.getStateValueFromClassName(cls, baseState);
}
public getBaseStateWithParam(stateName: string) {
return this.internal.getBaseStateWithParam(stateName);
}
}

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