How to use the @stylable/core.valueMapping.from 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 / provider.ts View on Github external
d.parent.nodes!.find(n => {
                            return (
                                (n as postcss.Declaration).prop === valueMapping.from &&
                                path.resolve(
                                    path.dirname(scannedMeta.source),
                                    (n as postcss.Declaration).value.replace(/"/g, '')
                                ) === defMeta.source
                            );
                        })
                    ) {
github wix / stylable / packages / language-service / src / lib / completion-providers.ts View on Github external
provide({
        parentSelector,
        meta,
        fullLineText,
        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) &&
            parentSelector &&
            lineChunkAtCursor.startsWith(valueMapping.mixin + ':')
        ) {
            if (fullLineText.lastIndexOf('(') > fullLineText.lastIndexOf(')')) {
                return [];
            }

            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 => isMixin(ms, meta, fs, tsLangService))
github wix / stylable / packages / language-service / src / lib / completion-providers.ts View on Github external
provide({
        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';
                    })