@styled/typescript-styled-plugin
Version: 
TypeScript language service plugin that adds IntelliSense for styled components
37 lines • 1.45 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigurationManager = void 0;
class ConfigurationManager {
    constructor() {
        this._configUpdatedListeners = new Set();
        this._configuration = ConfigurationManager.defaultConfiguration;
    }
    get config() { return this._configuration; }
    updateFromPluginConfig(config) {
        const lint = Object.assign({}, ConfigurationManager.defaultConfiguration.lint, config.lint || {});
        this._configuration = {
            tags: config.tags || ConfigurationManager.defaultConfiguration.tags,
            validate: typeof config.validate !== 'undefined' ? config.validate : ConfigurationManager.defaultConfiguration.validate,
            lint,
            emmet: config.emmet || ConfigurationManager.defaultConfiguration.emmet,
        };
        for (const listener of this._configUpdatedListeners) {
            listener();
        }
    }
    onUpdatedConfig(listener) {
        this._configUpdatedListeners.add(listener);
    }
}
ConfigurationManager.defaultConfiguration = {
    tags: ['styled', 'css', 'extend', 'injectGlobal', 'createGlobalStyle', 'keyframes'],
    validate: true,
    lint: {
        emptyRules: 'ignore',
    },
    emmet: {},
};
exports.ConfigurationManager = ConfigurationManager;
//# sourceMappingURL=_configuration.js.map