How to use the @stylable/core.valueMapping.named function in @stylable/core

To help you get started, we’ve selected a few @stylable/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wix / stylable / packages / language-service / src / lib / completion-providers.ts View on Github external
meta,
        fullLineText,
        parentSelector,
        lineChunkAtCursor,
        position,
        fs,
        tsLangService,
        stylable
    }: ProviderOptions): Completion[] {
        if (
            meta.imports.some(
                imp => imp.fromRelative.endsWith('.ts') || imp.fromRelative.endsWith('.js')
            ) &&
            !fullLineText.trim().startsWith(valueMapping.from) &&
            !fullLineText.trim().startsWith(valueMapping.extends) &&
            !fullLineText.trim().startsWith(valueMapping.named) &&
            parentSelector &&
            ~fullLineText.indexOf(':') &&
            fullLineText.indexOf(':') < position.character &&
            !lineChunkAtCursor.startsWith(valueMapping.mixin + ':')
        ) {
            const { lastName } = getExistingNames(fullLineText, position);
            return (
                Object.keys(meta.mappedSymbols)
                    .filter(ms => meta.mappedSymbols[ms]._kind === 'import')
                    .filter(ms => ms.startsWith(lastName))
                    .filter(ms => {
                        const res = stylable.resolver.resolve(meta.mappedSymbols[ms]);
                        return res && res._kind === 'js';
                    })
                    // .filter(ms => names.length === 0 || !~names.indexOf(ms))
                    .filter(ms => !isMixin(ms, meta, fs, tsLangService))
github wix / stylable / packages / language-service / src / lib / provider.ts View on Github external
function isNamedDirective(line: string) {
    return line.indexOf(valueMapping.named) !== -1;
}