Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cosmic-san

Package Overview
Dependencies
Maintainers
7
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cosmic-san

The san components of cosmic design ## Install ```shell npm install cosmic-ui-san -D ``` ## Config

  • 0.0.31
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
32
increased by966.67%
Maintainers
7
Weekly downloads
 
Created
Source

cosmic san components

The san components of cosmic design

Install

npm install cosmic-ui-san -D

Config

ts project

rollup or vite config:

import { defineConfig } from 'vite';
import path from 'path';
import { cStyle } from 'cosmic-ui-san/plugin/vanilla/rollup-plugin-san-cosmic';


export default defineConfig({
    build: {
        rollupOptions: {
            external: ['san', 'your-design-lib'],
        },
    },
    plugins: [
        cStyle({/* options */}),
    ]
});

SFC project

DOING

Options

optiontypedescdefault
targetstringcomponent tag's attribute namec-style
propNamestringthe precompiled name of component tag's attributestyles
basePathstringcss module's import base pathcosmic-ui

Usage

Usage 1:

import { Button } from 'cosmic-san';

export class Page extends Component {

    static template = `
        <Button
            c-style="icon"
        >
            button text
        </Button>
    `;
}

After PreCompile:

import { Button } from 'cosmic-san';
import { ButtonIcon as _ModuleCSS_1 } from 'cosmic-ui/button-icon.module.css'

export class Page extends Component {

    static template = `
        <Button
            styles="_ModuleCSS_1"
        >
            button text
        </Button>
    `;
}

Usage 2:

import { Button } from 'cosmic-san';

export class Page extends Component {

    static template = `
        <Button
            c-style="icon"
        >
            button text
        </Button>
    `;
}

After PreCompile:

import { Button } from 'cosmic-san';
import { ButtonIcon as _ModuleCSS_1 } from 'cosmic-ui/button-icon.module.css';

export class Page extends Component {

    static template = `
        <Button
            styles="_ModuleCSS_1"
        >
            button text
        </Button>
    `;
}

Usage 3:

import { Button } from 'cosmic-san';

export class Page extends Component {

    static template = `
        <Button
            c-style="./button-custom"
        >
            button text
        </Button>
        <Button
            c-style="./button-custom.module.css"
        >
            button text
        </Button>
    `;
}

After PreCompile:

import { Button } from './button.ts';
import _ModuleCSS_1 from './button.custom.css';
import _ModuleCSS_2 from './button.custom.module.css';

export class Page extends Component {

    static template = `
        <Button
            styles="_ModuleCSS_1"
        >
            button text 1
        </Button>
        <Button
            styles="_ModuleCSS_2"
        >
            button text 2
        </Button>
    `;
}

Usage 4:

import { Button } from 'cosmic-san';

export class Page extends Component {

    static template = `
        <Button
            c-style="-custom"
        >
            button text
        </Button>
    `;
}

After PreCompile:

import { Button } from 'cosmic-san';
import _ModuleCSS_1 from 'custom.module.css'

export class Page extends Component {

    static template = `
        <Button
            styles="_ModuleCSS_1"
        >
            button text
        </Button>
    `;
}

TODO:

  1. Support san component's static components property
  2. more robust import and export ability

FAQs

Package last updated on 24 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc