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.0 to 2.3.1-alpha.0

cjs/legacy-types.d.ts

14

cjs/stylable-dom-util.d.ts
import { RuntimeStylesheet, StateValue } from '@stylable/runtime';
import { CommonStylesheet } from './legacy-types';
export interface PartialElement {

@@ -20,2 +21,15 @@ querySelector: Element['querySelector'];

}
export declare class StylableDOMUtilCompat {
private stylesheet;
private root?;
private internal;
constructor(stylesheet: CommonStylesheet, root?: Element | undefined);
select(selector?: string, element?: PartialElement): Element | null;
selectAll(selector?: string, element?: PartialElement): Element[] | null;
scopeSelector(selector?: string): string;
hasStyleState(element: PartialElement, stateName: string, param?: StateValue): boolean;
getStyleState(element: PartialElement, stateName: string): string | boolean | null;
getStateValueFromClassName(cls: string, baseState: string): any;
getBaseStateWithParam(stateName: string): any;
}
//# sourceMappingURL=stylable-dom-util.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@stylable/core");
var legacy_types_1 = require("./legacy-types");
var stylable_dom_util_legacy_1 = require("./stylable-dom-util-legacy");
var StylableDOMUtil = /** @class */ (function () {

@@ -99,2 +101,42 @@ function StylableDOMUtil(stylesheet, root) {

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;
//# sourceMappingURL=stylable-dom-util.js.map

8

package.json
{
"name": "@stylable/dom-test-kit",
"version": "2.3.0",
"version": "2.3.1-alpha.0",
"description": "Stylable DOM testing utilities",

@@ -15,4 +15,4 @@ "main": "./cjs/index.js",

"dependencies": {
"@stylable/core": "^2.3.0",
"@stylable/runtime": "^2.3.0"
"@stylable/core": "^2.3.1-alpha.0",
"@stylable/runtime": "^2.3.1-alpha.0"
},

@@ -33,3 +33,3 @@ "files": [

"license": "BSD-3-Clause",
"gitHead": "e727713590e91a31858220a134710cce9e2051b7"
"gitHead": "df3e414745ed1a5d70ce7c8a7f5f27b5ca03a4d3"
}

@@ -1,3 +0,11 @@

import { isValidClassName, parseSelector, pseudoStates, stringifySelector, traverseNode } from '@stylable/core';
import {
isValidClassName,
parseSelector,
pseudoStates,
stringifySelector,
traverseNode
} from '@stylable/core';
import { RuntimeStylesheet, StateValue } from '@stylable/runtime';
import { CommonStylesheet, getStylesheetMode } from './legacy-types';
import { StylableDOMUtilLegacy } from './stylable-dom-util-legacy';

@@ -106,1 +114,48 @@ export interface PartialElement {

}
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