@stylable/core
Advanced tools
Comparing version 2.0.5 to 2.0.6
@@ -11,3 +11,3 @@ import * as postcss from 'postcss'; | ||
export declare const booleanStateDelimiter = "--"; | ||
export declare const stateWithParamDelimiter = "---"; | ||
export declare const stateWithParamDelimiter: string; | ||
export declare const stateErrors: { | ||
@@ -29,2 +29,3 @@ UNKNOWN_STATE_USAGE: (name: string) => string; | ||
export declare function createAttributeState(stateName: string, namespace: string, param: string): string; | ||
export declare function resolveStateParam(param: string): string; | ||
//# sourceMappingURL=pseudo-states.d.ts.map |
@@ -14,3 +14,3 @@ "use strict"; | ||
exports.booleanStateDelimiter = '--'; | ||
exports.stateWithParamDelimiter = '---'; | ||
exports.stateWithParamDelimiter = exports.booleanStateDelimiter + exports.stateMiddleDelimiter; | ||
/* tslint:disable:max-line-length */ | ||
@@ -289,11 +289,19 @@ exports.stateErrors = { | ||
function createStateWithParamClassName(stateName, namespace, param) { | ||
// tslint:disable-next-line: max-line-length | ||
return "" + namespace + exports.stateWithParamDelimiter + stateName + exports.stateMiddleDelimiter + param.length + exports.stateMiddleDelimiter + param; | ||
return "" + namespace + exports.stateWithParamDelimiter + stateName + resolveStateParam(param); | ||
} | ||
exports.createStateWithParamClassName = createStateWithParamClassName; | ||
function createAttributeState(stateName, namespace, param) { | ||
// tslint:disable-next-line:max-line-length | ||
return "class~=\"" + namespace + exports.stateWithParamDelimiter + stateName + exports.stateMiddleDelimiter + param.length + exports.stateMiddleDelimiter + utils_1.stripQuotation(JSON.stringify(param).replace(/\s/gm, '_')) + "\""; | ||
return "class~=\"" + createStateWithParamClassName(stateName, namespace, param) + "\""; | ||
} | ||
exports.createAttributeState = createAttributeState; | ||
function resolveStateParam(param) { | ||
if (stylable_utils_1.isValidClassName(param)) { | ||
return "" + exports.stateMiddleDelimiter + param.length + exports.stateMiddleDelimiter + param; | ||
} | ||
else { | ||
// tslint:disable-next-line: max-line-length | ||
return "" + exports.stateMiddleDelimiter + param.length + exports.stateMiddleDelimiter + utils_1.stripQuotation(JSON.stringify(param).replace(/\s/gm, '_')); | ||
} | ||
} | ||
exports.resolveStateParam = resolveStateParam; | ||
//# sourceMappingURL=pseudo-states.js.map |
{ | ||
"name": "@stylable/core", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "CSS for Components", | ||
@@ -19,3 +19,3 @@ "main": "./cjs/index.js", | ||
"enhanced-resolve": "^4.1.0", | ||
"is-vendor-prefixed": "^1.0.0", | ||
"is-vendor-prefixed": "^3.3.0", | ||
"lodash.clonedeep": "^4.5.0", | ||
@@ -48,3 +48,3 @@ "murmurhash": "^0.0.2", | ||
"license": "BSD-3-Clause", | ||
"gitHead": "5aca5a9142c8a798d802ad1d09b5b8e0cb189856" | ||
"gitHead": "6a142469d537cbd5cfea431097c6c518e425184d" | ||
} |
@@ -20,3 +20,3 @@ import * as postcss from 'postcss'; | ||
export const booleanStateDelimiter = '--'; | ||
export const stateWithParamDelimiter = '---'; | ||
export const stateWithParamDelimiter = booleanStateDelimiter + stateMiddleDelimiter; | ||
@@ -412,9 +412,16 @@ /* tslint:disable:max-line-length */ | ||
export function createStateWithParamClassName(stateName: string, namespace: string, param: string) { | ||
// tslint:disable-next-line: max-line-length | ||
return `${namespace}${stateWithParamDelimiter}${stateName}${stateMiddleDelimiter}${param.length}${stateMiddleDelimiter}${param}`; | ||
return `${namespace}${stateWithParamDelimiter}${stateName}${resolveStateParam(param)}`; | ||
} | ||
export function createAttributeState(stateName: string, namespace: string, param: string) { | ||
// tslint:disable-next-line:max-line-length | ||
return `class~="${namespace}${stateWithParamDelimiter}${stateName}${stateMiddleDelimiter}${param.length}${stateMiddleDelimiter}${stripQuotation(JSON.stringify(param).replace(/\s/gm, '_'))}"`; | ||
return `class~="${createStateWithParamClassName(stateName, namespace, param)}"`; | ||
} | ||
export function resolveStateParam(param: string) { | ||
if (isValidClassName(param)) { | ||
return `${stateMiddleDelimiter}${param.length}${stateMiddleDelimiter}${param}`; | ||
} else { | ||
// tslint:disable-next-line: max-line-length | ||
return `${stateMiddleDelimiter}${param.length}${stateMiddleDelimiter}${stripQuotation(JSON.stringify(param).replace(/\s/gm, '_'))}`; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
543391
8865
+ Addedis-vendor-prefixed@3.5.0(transitive)
- Removedis-vendor-prefixed@1.0.0(transitive)
Updatedis-vendor-prefixed@^3.3.0