Better variable helper flow
This commit is contained in:
@@ -34,7 +34,7 @@ export class VariableHelper {
|
||||
return this;
|
||||
}
|
||||
|
||||
toCss() {
|
||||
public toCss() {
|
||||
if (!this.property) {
|
||||
return css`
|
||||
${unsafeCSS(this.buildVariableName())}
|
||||
@@ -61,4 +61,21 @@ export class VariableHelper {
|
||||
this.defaultValue
|
||||
})`;
|
||||
}
|
||||
|
||||
// static builders for convencience
|
||||
public static from(): VariableHelper {
|
||||
return new VariableHelper();
|
||||
}
|
||||
|
||||
public static fromDefaultValue(value: string | CSSResult) {
|
||||
return VariableHelper.from().withDefaultValue(value);
|
||||
}
|
||||
|
||||
public static fromProperty(property: string) {
|
||||
return VariableHelper.from().withProperty(property);
|
||||
}
|
||||
|
||||
public static fromVariableName(name: string) {
|
||||
return VariableHelper.from().withVariableName(name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user