@stylable/core
Version:
CSS for Components
76 lines • 2.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StylableMeta = void 0;
const stylable_utils_1 = require("./stylable-utils");
const features_1 = require("./features");
const features = [
features_1.STSymbol,
features_1.STImport,
features_1.STNamespace,
features_1.STGlobal,
features_1.STScope,
features_1.STVar,
features_1.STCustomSelector,
features_1.STCustomState,
features_1.STMixin,
features_1.CSSClass,
features_1.CSSType,
features_1.CSSPseudoClass,
features_1.CSSCustomProperty,
features_1.CSSKeyframes,
features_1.CSSLayer,
features_1.CSSContains,
features_1.STStructure,
];
class StylableMeta {
constructor(sourceAst, diagnostics, flags) {
this.sourceAst = sourceAst;
this.diagnostics = diagnostics;
this.flags = flags;
this.data = {};
this.root = '';
this.source = (0, stylable_utils_1.getSourcePath)(this.sourceAst, this.diagnostics);
this.type = this.source.endsWith('.st.css') ? 'stylable' : 'css';
this.namespace = '';
this.urls = [];
this.transformDiagnostics = null;
this.transformedScopes = null;
/** @deprecated */
this.scopes = [];
this.globals = {};
// initiate features
const context = { meta: this, diagnostics };
for (const { hooks } of features) {
hooks.metaInit(context);
}
}
getSymbol(name) {
return features_1.STSymbol.get(this, name);
}
getAllSymbols() {
return features_1.STSymbol.getAll(this);
}
getClass(name) {
return features_1.CSSClass.get(this, name);
}
getAllClasses() {
return features_1.CSSClass.getAll(this);
}
getTypeElement(name) {
return features_1.CSSType.get(this, name);
}
getAllTypeElements() {
return features_1.CSSType.getAll(this);
}
getImportStatements() {
return features_1.STImport.getImportStatements(this);
}
getStVar(name) {
return features_1.STSymbol.get(this, name, `var`);
}
getAllStVars() {
return features_1.STSymbol.getAllByType(this, `var`);
}
}
exports.StylableMeta = StylableMeta;
//# sourceMappingURL=stylable-meta.js.map