@stylable/dom-test-kit
Advanced tools
Comparing version 2.3.1-alpha.4 to 2.3.1
import { RuntimeStylesheet, StateValue } from '@stylable/runtime'; | ||
import { CommonStylesheet } from './legacy-types'; | ||
export interface PartialElement { | ||
@@ -9,15 +8,2 @@ querySelector: Element['querySelector']; | ||
} | ||
export declare class StylableDOMUtilCommon { | ||
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; | ||
} | ||
export declare class StylableDOMUtil { | ||
@@ -35,5 +21,2 @@ private stylesheet; | ||
} | ||
export declare class StylableDOMUtilCompat extends StylableDOMUtilCommon { | ||
getStyleState(element: PartialElement, stateName: string): string | null; | ||
} | ||
//# sourceMappingURL=stylable-dom-util.d.ts.map |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
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 StylableDOMUtilCommon = /** @class */ (function () { | ||
function StylableDOMUtilCommon(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); | ||
} | ||
} | ||
StylableDOMUtilCommon.prototype.select = function (selector, element) { | ||
return this.internal.select(selector, element); | ||
}; | ||
StylableDOMUtilCommon.prototype.selectAll = function (selector, element) { | ||
return this.internal.selectAll(selector, element); | ||
}; | ||
StylableDOMUtilCommon.prototype.scopeSelector = function (selector) { | ||
return this.internal.scopeSelector(selector); | ||
}; | ||
StylableDOMUtilCommon.prototype.hasStyleState = function (element, stateName, param) { | ||
if (param === void 0) { param = true; } | ||
return this.internal.hasStyleState(element, stateName, param); | ||
}; | ||
StylableDOMUtilCommon.prototype.getStyleState = function (element, stateName) { | ||
return this.internal.getStyleState(element, stateName); | ||
}; | ||
StylableDOMUtilCommon.prototype.getStateValueFromClassName = function (cls, baseState) { | ||
return this.internal.getStateValueFromClassName(cls, baseState); | ||
}; | ||
StylableDOMUtilCommon.prototype.getBaseStateWithParam = function (stateName) { | ||
return this.internal.getBaseStateWithParam(stateName); | ||
}; | ||
return StylableDOMUtilCommon; | ||
}()); | ||
exports.StylableDOMUtilCommon = StylableDOMUtilCommon; | ||
var StylableDOMUtil = /** @class */ (function () { | ||
@@ -154,14 +99,2 @@ function StylableDOMUtil(stylesheet, root) { | ||
exports.StylableDOMUtil = StylableDOMUtil; | ||
var StylableDOMUtilCompat = /** @class */ (function (_super) { | ||
__extends(StylableDOMUtilCompat, _super); | ||
function StylableDOMUtilCompat() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
StylableDOMUtilCompat.prototype.getStyleState = function (element, stateName) { | ||
var state = _super.prototype.getStyleState.call(this, element, stateName); | ||
return state === null ? null : state.toString(); | ||
}; | ||
return StylableDOMUtilCompat; | ||
}(StylableDOMUtilCommon)); | ||
exports.StylableDOMUtilCompat = StylableDOMUtilCompat; | ||
//# sourceMappingURL=stylable-dom-util.js.map |
{ | ||
"name": "@stylable/dom-test-kit", | ||
"version": "2.3.1-alpha.4", | ||
"version": "2.3.1", | ||
"description": "Stylable DOM testing utilities", | ||
@@ -15,4 +15,4 @@ "main": "./cjs/index.js", | ||
"dependencies": { | ||
"@stylable/core": "^2.3.1-alpha.0", | ||
"@stylable/runtime": "^2.3.1-alpha.0" | ||
"@stylable/core": "^2.3.1", | ||
"@stylable/runtime": "^2.3.1" | ||
}, | ||
@@ -33,3 +33,3 @@ "files": [ | ||
"license": "BSD-3-Clause", | ||
"gitHead": "ca58ebad37238b15443f6dcb07e92fafcb7378cc" | ||
"gitHead": "f28edefa3aa4a1276789b206e9e9f25d7869447f" | ||
} |
@@ -1,11 +0,3 @@ | ||
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'; | ||
@@ -19,50 +11,2 @@ export interface PartialElement { | ||
export class StylableDOMUtilCommon { | ||
// 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 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); | ||
} | ||
} | ||
export class StylableDOMUtil { | ||
@@ -163,9 +107,1 @@ constructor(private stylesheet: RuntimeStylesheet, private root?: Element) {} | ||
} | ||
export class StylableDOMUtilCompat extends StylableDOMUtilCommon { | ||
public getStyleState(element: PartialElement, stateName: string): string | null { | ||
const state = super.getStyleState(element, stateName); | ||
return state === null ? null : state.toString(); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
18035
13
218
Updated@stylable/core@^2.3.1
Updated@stylable/runtime@^2.3.1