├── .github └── workflows │ ├── build-docs.yml │ └── npm-publish.yml ├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── cmp ├── Button.svelte ├── Card.svelte ├── Checkbox.svelte ├── Col.svelte ├── Container.svelte ├── Details.svelte ├── Field.svelte ├── Icon.svelte ├── Input.svelte ├── Modal.svelte ├── Nav.svelte ├── Radio.svelte ├── Row.svelte ├── Tab.svelte ├── Tabs.svelte ├── Tag.svelte ├── index.js └── utils.js ├── docs_src ├── .gitignore ├── package.json ├── src │ ├── examples.css │ ├── font.css │ ├── includes │ │ ├── Details.svelte │ │ ├── GithubLink.svelte │ │ ├── error.md │ │ ├── logo.md │ │ ├── sidebar.md │ │ └── topbar.md │ ├── pages │ │ ├── components │ │ │ ├── buttons.md │ │ │ ├── card.md │ │ │ ├── container.md │ │ │ ├── details.md │ │ │ ├── form.md │ │ │ ├── grid.md │ │ │ ├── icon.md │ │ │ ├── modal.md │ │ │ ├── nav.md │ │ │ ├── tabs.md │ │ │ └── tag.md │ │ ├── customization.md │ │ ├── elements.md │ │ ├── getting-started.md │ │ ├── index.md │ │ ├── install.md │ │ ├── usage.md │ │ ├── utilites.md │ │ └── why_chota.md │ ├── static │ │ ├── favicon.png │ │ ├── icons │ │ │ ├── javascript.svg │ │ │ ├── sprite.svg │ │ │ └── svelte.svg │ │ ├── overpass-400.woff2 │ │ └── overpass-600.woff2 │ └── theme.css └── svelte-docs.config.js ├── esbuild.js └── package.json /.github/workflows/build-docs.yml: -------------------------------------------------------------------------------- 1 | name: Build Documentation 2 | 3 | on: 4 | push: 5 | paths: 6 | - '.github/workflows/build-docs.yml' 7 | - 'docs_src/*' 8 | - 'docs_src/*/*' 9 | - 'docs_src/*/*/*' 10 | - 'docs_src/*/*/*/*' 11 | - 'cmp/*' 12 | - 'cmp/*/*' 13 | 14 | jobs: 15 | docs-build-deploy: 16 | runs-on: ubuntu-18.04 17 | steps: 18 | - uses: actions/checkout@master 19 | 20 | - name: Setup Node 21 | uses: actions/setup-node@v1 22 | with: 23 | node-version: 12.x 24 | 25 | - name: Build 26 | run: npm i && cd docs_src && npm i && npm run build 27 | 28 | - name: Deploy 29 | uses: peaceiris/actions-gh-pages@v2.4.0 30 | env: 31 | ACTIONS_DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} 32 | PUBLISH_BRANCH: gh-pages 33 | PUBLISH_DIR: ./docs_src/__DOCS__/dist/svelte-chota 34 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish on NPM 2 | 3 | on: 4 | push: 5 | paths: 6 | - '.github/workflows/npm-publish.yml' 7 | - 'package.json' 8 | 9 | jobs: 10 | publish-npm: 11 | runs-on: ubuntu-18.04 12 | steps: 13 | - uses: actions/checkout@v1 14 | - name: Setup Node 15 | uses: actions/setup-node@v1 16 | with: 17 | node-version: 12 18 | registry-url: https://registry.npmjs.org/ 19 | - name: Installing NPM deps 20 | run: npm install 21 | - name: Building & publishing on NPM 22 | run: npm publish 23 | env: 24 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | yarn.lock 4 | package-lock.json 5 | dist -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | docs_src -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Svelte-chota changelog 2 | 3 | ## 1.6.1 4 | 5 | * Enchanced dropdown button 6 | 7 | ## 1.6.0 8 | 9 | * Add Container component 10 | 11 | ## 1.5.0 12 | 13 | * Icons can be set from SVG sprites 14 | * remove property `path` from the Icons 15 | 16 | ## 1.4.0 17 | 18 | * More powerful icon component 19 | 20 | ## 1.3.0 21 | 22 | * Now you can add any atribute on the component 23 | * Added submit property for button 24 | * Refactoring Input component 25 | 26 | ## 1.2.0 27 | 28 | * Add events forwarders for any `on:eventname` directive. It could be used with almost any component. 29 | 30 | ## 1.1.6 31 | 32 | * Fix icon size on buttons 33 | 34 | ## 1.0.0 35 | 36 | * First release -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Alexey Schebelev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # svelte-chota 2 | Svelte UI components based on the super light-weight [chota](https://jenil.github.io/chota/) CSS framework. 3 | 4 | [![npm](https://img.shields.io/npm/v/svelte-chota)](https://www.npmjs.com/package/svelte-chota) [![npm](https://img.shields.io/npm/dt/svelte-chota)](https://www.npmjs.com/package/svelte-chota) [![](https://github.com/AlexxNB/svelte-chota/workflows/Publish%20on%20NPM/badge.svg)](https://github.com/AlexxNB/svelte-chota/actions?workflow=Publish+on+NPM) [![](https://github.com/AlexxNB/svelte-chota/workflows/Build%20Documentation/badge.svg)](https://github.com/AlexxNB/svelte-chota/actions?workflow=Build+Documentation) 5 | 6 | ## Why chota? 7 | 8 | When you decide to use [Svelte](https://svelte.dev) in your projects, you expect very tiny bundles of code. 9 | 10 | [chota](https://jenil.github.io/chota/) is a super light-weight CSS framework, which adds only ~3kb of gzipped code to your CSS bundle. 11 | 12 | [Svelte-chota](https://github.com/AlexxNB/svelte-chota) is a UI kit for easily using [chota](https://jenil.github.io/chota/) in your [Svelte](https://svelte.dev) projects. 13 | 14 | ## Documentation 15 | * Svelte-chota [documentation](https://alexxnb.github.io/svelte-chota). 16 | * chota [documentation](https://jenil.github.io/chota/). 17 | 18 | ## Installation 19 | 20 | You should install two packages: 21 | 22 | * `chota` - css framework itself 23 | * `svelte-chota` - Svelte components for chota 24 | 25 | ```bash 26 | npm install -D chota svelte-chota 27 | ``` 28 | 29 | Then open the app root file (usually `App.svelte`) and add `chota` import at the top of a ` 36 | ``` 37 | 38 | ## Usage 39 | 40 | Just import the necessary components from the svelte-chota package in your components: 41 | 42 | ```html 43 | 46 | 47 | 48 | ``` 49 | 50 | ### Events handlers 51 | 52 | You can use any `on:eventname` directive with any components: 53 | 54 | ```html 55 | 59 | 60 | 64 | ``` 65 | ### Attributes 66 | 67 | Any attribute can be passed to the component, even the `class` attribute. 68 | 69 | ```html 70 | 73 | 74 | 75 |

Hey!

76 |
77 | ``` 78 | -------------------------------------------------------------------------------- /cmp/Button.svelte: -------------------------------------------------------------------------------- 1 | 62 | 63 | 64 | {#if dropdown === false} 65 | 87 | {:else} 88 | 112 | {/if} 113 | 114 | 115 | 172 | -------------------------------------------------------------------------------- /cmp/Card.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 |
8 | {#if $$slots.header} 9 |
10 | 11 |
12 | {/if} 13 | 14 | {#if $$slots.footer} 15 | 18 | {/if} 19 |
20 | -------------------------------------------------------------------------------- /cmp/Checkbox.svelte: -------------------------------------------------------------------------------- 1 | 32 | 33 | {#if labeled} 34 | 43 | {:else} 44 | handleChange(e.srcElement.checked)} 46 | use:events 47 | {...$$restProps} 48 | {checked} 49 | /> 50 | {/if} 51 | 52 | -------------------------------------------------------------------------------- /cmp/Col.svelte: -------------------------------------------------------------------------------- 1 | 30 | 31 |
32 | 33 |
-------------------------------------------------------------------------------- /cmp/Container.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 |
-------------------------------------------------------------------------------- /cmp/Details.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 | 13 |
14 | 15 | -------------------------------------------------------------------------------- /cmp/Field.svelte: -------------------------------------------------------------------------------- 1 | 34 | 35 |
36 | {#if label} 37 | 38 | 39 | {/if} 40 |

41 | {#if message} 42 |

{message}

43 | {:else} 44 |

 

45 | {/if} 46 |
47 | 48 | 62 | -------------------------------------------------------------------------------- /cmp/Icon.svelte: -------------------------------------------------------------------------------- 1 | 70 | 71 | {#if url} 72 | 73 | 74 | 75 | {:else if use} 76 | 77 | 78 | 79 | {:else} 80 | 81 | {#if spin !== false} 82 | 83 | 84 | 85 | {:else} 86 | 87 | {/if} 88 | 89 | {/if} 90 | 91 | 92 | -------------------------------------------------------------------------------- /cmp/Input.svelte: -------------------------------------------------------------------------------- 1 | 51 | 52 | {#if type === 'textarea'} 53 | 60 | {:else} 61 | 69 | {/if} 70 | 71 | -------------------------------------------------------------------------------- /cmp/Modal.svelte: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | {#if open} 13 |
14 |
open=false}/> 15 |
16 |
17 | {/if} 18 | 19 | 48 | -------------------------------------------------------------------------------- /cmp/Nav.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 24 | 25 | 38 | -------------------------------------------------------------------------------- /cmp/Radio.svelte: -------------------------------------------------------------------------------- 1 | 18 | 19 | {#if labeled} 20 | 29 | {:else} 30 | 36 | {/if} 37 | 38 | -------------------------------------------------------------------------------- /cmp/Row.svelte: -------------------------------------------------------------------------------- 1 | 8 | 9 |
10 | 11 |
-------------------------------------------------------------------------------- /cmp/Tab.svelte: -------------------------------------------------------------------------------- 1 | 14 | 15 | active_tab.set( (tabid === false) ? id : tabid)}> 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /cmp/Tabs.svelte: -------------------------------------------------------------------------------- 1 | 19 | 20 | -------------------------------------------------------------------------------- /cmp/Tag.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /cmp/index.js: -------------------------------------------------------------------------------- 1 | import Container from './Container.svelte'; 2 | import Nav from './Nav.svelte'; 3 | import Row from './Row.svelte'; 4 | import Col from './Col.svelte'; 5 | import Button from './Button.svelte'; 6 | import Tabs from './Tabs.svelte'; 7 | import Tab from './Tab.svelte'; 8 | import Card from './Card.svelte'; 9 | import Tag from './Tag.svelte'; 10 | import Details from './Details.svelte'; 11 | import Input from './Input.svelte'; 12 | import Field from './Field.svelte'; 13 | import Radio from './Radio.svelte'; 14 | import Checkbox from './Checkbox.svelte'; 15 | import Modal from './Modal.svelte'; 16 | import Icon from './Icon.svelte'; 17 | 18 | export { 19 | Container, 20 | Nav, 21 | Row, Col, 22 | Button, 23 | Tabs, Tab, 24 | Card, 25 | Tag, 26 | Details, 27 | Input, 28 | Field, 29 | Radio, 30 | Checkbox, 31 | Modal, 32 | Icon, 33 | } -------------------------------------------------------------------------------- /cmp/utils.js: -------------------------------------------------------------------------------- 1 | export function isArray(obj) { 2 | return Object.prototype.toString.call(obj) === '[object Array]' 3 | } 4 | 5 | 6 | import {bubble, listen,get_current_component} from 'svelte/internal'; 7 | export function getEventsAction() { 8 | const component = get_current_component(); 9 | return node => { 10 | const events = Object.keys(component.$$.callbacks); 11 | const listeners = []; 12 | 13 | events.forEach( 14 | event => listeners.push( 15 | listen(node, event, e => bubble(component, e)) 16 | ) 17 | ); 18 | 19 | return { 20 | destroy: () => { 21 | listeners.forEach( 22 | listener => listener() 23 | ); 24 | } 25 | } 26 | }; 27 | } -------------------------------------------------------------------------------- /docs_src/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | __DOCS__ -------------------------------------------------------------------------------- /docs_src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "svelte-docs-template", 4 | "version": "0.3.1", 5 | "dependencies": { 6 | "@svelte-docs/server": "^0.1.6" 7 | }, 8 | "devDependencies": { 9 | "@mdi/js": "^4.9.95", 10 | "@svelte-docs/core": "^0.10.13", 11 | "@svelte-docs/publisher": "^0.2.3", 12 | "@svelte-docs/themes": "^1.0.1", 13 | "chota": "^0.7.1", 14 | "npm-run-all": "^4.1.5", 15 | "rollup": "^2.35.1" 16 | }, 17 | "scripts": { 18 | "build": "rollup -c node_modules/@svelte-docs/core/rollup.config.js", 19 | "autobuild": "rollup -c node_modules/@svelte-docs/core/rollup.config.js -w", 20 | "dev": "run-p start:dev start:pagewatch autobuild", 21 | "start": "node node_modules/@svelte-docs/server", 22 | "start:dev": "node node_modules/@svelte-docs/server --dev --single", 23 | "start:pagewatch": "node node_modules/@svelte-docs/core/watcher", 24 | "deploy": "npm run build && node node_modules/@svelte-docs/publisher" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /docs_src/src/examples.css: -------------------------------------------------------------------------------- 1 | /* Styling of the examples view */ 2 | 3 | @import 'chota/dist/chota.css'; 4 | body{ 5 | padding: 1rem; 6 | } 7 | 8 | .col, 9 | [class*=" col-"], 10 | [class^='col-'] { 11 | background-color: #40b3ff; 12 | text-align: center; 13 | } 14 | -------------------------------------------------------------------------------- /docs_src/src/font.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Overpass'; 3 | font-style: normal; 4 | font-weight: 400; 5 | src: 6 | url('static/overpass-400.woff2') format('woff2'); 7 | } 8 | 9 | @font-face { 10 | font-family: 'Overpass'; 11 | font-style: normal; 12 | font-weight: 500; 13 | src: 14 | url('static/overpass-600.woff2') format('woff2'); 15 | } -------------------------------------------------------------------------------- /docs_src/src/includes/Details.svelte: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 |

{title}

10 |

{comment}

11 | 12 |
13 | 14 | -------------------------------------------------------------------------------- /docs_src/src/includes/GithubLink.svelte: -------------------------------------------------------------------------------- 1 | 34 | 35 | 37 | 38 | {#if hover}Github{/if} 39 | 40 | -------------------------------------------------------------------------------- /docs_src/src/includes/error.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: 'no_sidebar' 3 | --- 4 | # Page not found! # 5 | 6 | [Go to start page](/) 7 | 8 | -------------------------------------------------------------------------------- /docs_src/src/includes/logo.md: -------------------------------------------------------------------------------- 1 | # [SvelteChota](/) # 2 | 3 | -------------------------------------------------------------------------------- /docs_src/src/includes/sidebar.md: -------------------------------------------------------------------------------- 1 | * Getting Started 2 | - [Why chota?](why_chota) 3 | - [Installation](install) 4 | - [Usage](usage) 5 | * chota 6 | - [Customization](customization) 7 | - [Utilites](utilites) 8 | - [Elements](elements) 9 | * Components 10 | - [Container](components/container) 11 | - [Grid](components/grid) 12 | - [Buttons](components/buttons) 13 | - [Form](components/form) 14 | - [Nav](components/nav) 15 | - [Tabs](components/tabs) 16 | - [Card](components/card) 17 | - [Tag](components/tag) 18 | - [Details](components/details) 19 | - [Modal](components/modal) 20 | - [Icon](components/icon) 21 | -------------------------------------------------------------------------------- /docs_src/src/includes/topbar.md: -------------------------------------------------------------------------------- 1 | import GithubLink from '@INCLUDES/GithubLink.svelte'; 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs_src/src/pages/components/buttons.md: -------------------------------------------------------------------------------- 1 | # Buttons 2 | 3 | ### Default buttons 4 | 5 | ```example script:hide 6 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | ``` 18 | 19 | ### Outline buttons 20 | 21 | ```example script:hide 22 | 25 | 26 | 27 | 28 | 29 | 30 | ``` 31 | 32 | ### Submit button 33 | 34 | ```example script:hide 35 | 38 |
39 | 40 |
41 | ``` 42 | 43 | 44 | ### Icon buttons 45 | 46 | The properties `icon` and `iconRight` accept any [valid source](components/icon) for an icon. For example, you may use the [@mdi/js](https://www.npmjs.com/package/@mdi/js) package. 47 | 48 | ```example 49 | 53 | 54 | 55 | 56 | 67 | 68 | 69 | 70 | ``` 71 | 72 | 73 | ### Dropdown button 74 | 75 | ```example script:hide height:130 76 | 80 | 83 | ``` 84 | 85 | 86 | ##### Autoclose 87 | 88 | With the `autoclose` property the dropdown will close when clicked inside it. 89 | 90 | ```example script:hide height:200 91 | 95 | 101 | ``` 102 | 103 | ##### Open 104 | 105 | The `open` property sets the state of the dropdown's visibility. 106 | 107 | ```example height:230 108 | 113 | 118 | 119 |

120 | 121 | ``` 122 | -------------------------------------------------------------------------------- /docs_src/src/pages/components/card.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Card 4 | 5 | ```example script:hide 6 | 9 | 10 | Lorem ipsum dolor sit amet, 11 | consectetur adipisicing elit. 12 | Doloremque cumque velit id. 13 | 14 | ``` 15 | 16 | ```example script:hide 17 | 20 |
21 | 22 |

Card title

23 | 24 | A nisi ullam impedit molestiae, sapiente id, 25 | numquam accusantium eius cum, iste eum iusto 26 | blanditiis doloribus beatae. 27 | Molestias iste explicabo libero nam, 28 | voluptas harum ipsum quod velit enim. 29 | Quae, cupiditate? 30 | 31 |
32 | 33 | 34 |
35 |
36 |
37 | ``` -------------------------------------------------------------------------------- /docs_src/src/pages/components/container.md: -------------------------------------------------------------------------------- 1 | # Container 2 | 3 | The `Container` component is just a wrapper for centered content on the page. 4 | 5 | ```svelte 6 | 7 | Hello 8 | 9 | ``` -------------------------------------------------------------------------------- /docs_src/src/pages/components/details.md: -------------------------------------------------------------------------------- 1 | # Details 2 | 3 | ```example script:hide 4 | 7 |
8 | StarWars spoiler 9 | 10 | Han Solo died... 11 |
12 | ``` 13 | 14 | 15 | ### open 16 | 17 | The `open` property allows details to be open by default. 18 | 19 | ```example script:hide 20 | 23 |
24 | The GoT spoiler 25 | 26 | Everybody died... 27 |
28 | ``` -------------------------------------------------------------------------------- /docs_src/src/pages/components/form.md: -------------------------------------------------------------------------------- 1 | # Form 2 | 3 | ### Inputs 4 | 5 | ```example script:hide 6 | 9 |

10 |

11 |

12 |

13 |

14 |

15 |

16 | ``` 17 | 18 | 19 | 20 | #### States 21 | 22 | ```example script:hide 23 | 26 |

27 |

28 |

29 | ``` 30 | 31 | ### Field 32 | 33 | ```example script:hide 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | ``` 49 | 50 | 51 | 52 | #### Grouped 53 | 54 | ```example 55 | 59 | 60 | 61 | 62 | 63 | 66 | 67 | ``` 68 | 69 | #### Gapless 70 | 71 | ```example 72 | 76 | 77 | 78 | 79 | 10 | 11 | 12 | Hello, I am a simple modal. 13 | 14 | 15 | ``` 16 | 17 | 18 | ```example height:300 19 | 25 | 26 | 27 | 28 | 29 |

Destroy the world

30 | 31 |

Are you sure?

32 | 33 |
34 | 35 | 36 |
37 |
38 |
39 | ``` 40 | -------------------------------------------------------------------------------- /docs_src/src/pages/components/nav.md: -------------------------------------------------------------------------------- 1 | # Nav 2 | 3 | 4 | ```example script:hide 5 | 8 | 9 | 18 | ``` 19 | 20 | ```example script:hide 21 | 24 | 25 | 30 | ``` -------------------------------------------------------------------------------- /docs_src/src/pages/components/tabs.md: -------------------------------------------------------------------------------- 1 | # Tabs 2 | 3 | ### Simple usage 4 | 5 | ```example 6 | 10 | 11 | 12 | Tab1 13 | Tab2 14 | Tab3 15 | 16 | 17 | Current active tab: {active_tab} 18 | ``` 19 | 20 | 21 | 22 | ### Property: tabid 23 | 24 | ```example 25 | 29 | 30 | 31 | Tab1 32 | Tab2 33 | Tab3 34 | 35 | 36 | Current active tab: {active_tab} 37 | ``` 38 | 39 | 40 | ### Full width 41 | 42 | ```example script:hide 43 | 46 | 47 | 48 | Tab1 49 | Tab2 50 | Tab3 51 | 52 | ``` -------------------------------------------------------------------------------- /docs_src/src/pages/components/tag.md: -------------------------------------------------------------------------------- 1 | # Tag 2 | 3 | ```example script:hide 4 | 7 | One 8 | Two 9 | Three 10 | Small 11 | Large 12 | ``` -------------------------------------------------------------------------------- /docs_src/src/pages/customization.md: -------------------------------------------------------------------------------- 1 | # Customization 2 | 3 | [chota](https://jenil.github.io/chota/) is customized by setting CSS variables. See [official docs](https://jenil.github.io/chota/#customizing) for more info. 4 | 5 | You can set CSS variables in an external _*.css_ file or inside `App.svelte` using the `:global` modifier. 6 | 7 | ```svelte 8 | 22 | ``` -------------------------------------------------------------------------------- /docs_src/src/pages/elements.md: -------------------------------------------------------------------------------- 1 | # Elements 2 | 3 | You can find how common HTML-elements look with [chota](https://jenil.github.io/chota/) on the [Demo page](https://cdn.rawgit.com/jenil/chota/master/test/index.html). 4 | 5 | Feel free to look at the demo page's source code for more info about their composition. 6 | -------------------------------------------------------------------------------- /docs_src/src/pages/getting-started.md: -------------------------------------------------------------------------------- 1 | # About my component 2 | 3 | It is a very cool button. 4 | 5 | ## Installation 6 | 7 | Run this command: 8 | 9 | ```shell 10 | $ npm install -D my-svelte-button 11 | ``` 12 | 13 | Then you can import it in your projects: 14 | 15 | ```html 16 | 19 | ``` 20 | -------------------------------------------------------------------------------- /docs_src/src/pages/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: false 3 | layout: 'no_sidebar' 4 | --- 5 | 6 |
7 | # Svelte-Chota # 8 |
9 | 10 |
11 | UI component library for [Svelte](https://svelte.dev) built with tiny [chota.css](https://jenil.github.io/chota/) 12 |
13 | 14 | 17 | 18 | -------------------------------------------------------------------------------- /docs_src/src/pages/install.md: -------------------------------------------------------------------------------- 1 | import Details from '@INCLUDES/Details.svelte'; 2 | 3 | # Installation 4 | 5 | You have two ways to start working with `chota` and `svelte-chota`. These instructions apply to the official [svelte template](https://github.com/sveltejs/template). 6 | 7 | 8 |
11 | 12 | 1. Install two node packages for development: 13 | 14 | * `chota` - css framework itself 15 | * `svelte-chota` - Svelte components for chota 16 | 17 | ```shell 18 | $ npm install --save-dev chota svelte-chota 19 | ``` 20 | 21 | 2. Open your root component file (usually `App.svelte`) and add the `chota` import at the top of a ` 28 | ``` 29 | 30 |
31 | 32 | 33 |
37 | 38 | Another way to import `chota` without Rollup's config changing is using CDN. In this case an internet connection is required for users of your app. 39 | 40 | 1. Install `svelte-chota` for production: 41 | 42 | ```shell 43 | $ npm install --save-prod svelte-chota 44 | ``` 45 | 46 | 2. Import styles from chota's CDN in the `style` block of the your `App.svelte`. 47 | 48 | ```html 49 | 52 | ``` 53 | 54 | > This way is ideal for use in sandboxes. See example on the [REPL](https://svelte.dev/repl/23f96be8ef424e12b584f9ed00761e88) 55 |
56 | -------------------------------------------------------------------------------- /docs_src/src/pages/usage.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | 3 | Just import the necessary components from the `svelte-chota` package inside your components. 4 | 5 | ```svelte 6 | 9 | 10 | 11 | ``` 12 | 13 | 14 | ### Events handlers 15 | 16 | You can use any `on:eventname` directive with any component. 17 | 18 | ```example 19 | 23 | 24 | 28 | ``` 29 | 30 | 31 | ### Attributes 32 | 33 | Any attribute can be passed to the component, even the `class` attribute. 34 | 35 | ```example 36 | 39 | 40 | 45 |

Hey!

46 |
47 | ``` -------------------------------------------------------------------------------- /docs_src/src/pages/utilites.md: -------------------------------------------------------------------------------- 1 | # Utilites 2 | 3 | [chota](https://jenil.github.io/chota/) has very useful CSS classes. You can apply these helper classes to almost any element in order to alter its style. 4 | 5 | 6 | * `text-primary` - Primary text 7 | * `text-light` - Light text 8 | * `text-white` - White text 9 | * `text-dark` - Dark text 10 | * `text-grey` - Grey text 11 | * `text-error` - Error text 12 | * `text-success` - Success text 13 | * `bg-primary` - primary background 14 | * `bg-light` - Light background 15 | * `bg-dark` - Dark background 16 | * `bg-grey` - Grey background 17 | * `bg-error` - Error background 18 | * `bg-success` - Success background 19 | * `bd-primary` - primary border 20 | * `bd-light` - Light border 21 | * `bd-dark` - Dark border 22 | * `bd-grey` - Grey border 23 | * `bd-error` - Error border 24 | * `bd-success` - Success border 25 | * `pull-right` - floats an element to the right 26 | * `pull-left` - floats an element to the left 27 | * `text-center` - center aligns text 28 | * `text-left` - left aligns text 29 | * `text-right` - right aligns text 30 | * `text-justify` - justify aligns text 31 | * `text-uppercase` - text to uppercase 32 | * `text-lowercase` - text to lowercase 33 | * `text-capitalize` - capitalizes text 34 | * `is-full-screen` - makes the element 100% view height 35 | * `is-full-width` - make the element 100% width 36 | * `is-vertical-align` - vertically centers element using flex 37 | * `is-horizontal-align` - horizontal centers element using flex 38 | * `is-center` - centers element using flex 39 | * `is-right` - right aligns element using flex 40 | * `is-left` - left aligns element using flex 41 | * `is-fixed` - fixed positioned element 42 | * `is-paddingless` - removes any padding 43 | * `is-marginless` - removes any margin 44 | * `is-rounded` - make the element round 45 | * `clearfix` - clears the floats 46 | * `is-hidden` - hides the element completely 47 | * `hide-xs` - hides the element for screens <600px 48 | * `hide-sm` - hides the element for screens >=600px and <900px 49 | * `hide-md` - hides the element for screens >=900px and <1200px 50 | * `hide-lg` - hides the element for screens >=1200px 51 | * `hide-pr` - hides the element for printing 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs_src/src/pages/why_chota.md: -------------------------------------------------------------------------------- 1 | # Why chota? 2 | 3 | When you decide to use [Svelte](https://svelte.dev) in your projects, you expect very tiny bundles of code. 4 | 5 | [chota](https://jenil.github.io/chota/) is a super light-weight CSS framework, which adds only ~3kb of gzipped code to your bundle. 6 | 7 | Svelte-chota is a UI kit for easily using [chota](https://jenil.github.io/chota/) in your [Svelte](https://svelte.dev) projects. -------------------------------------------------------------------------------- /docs_src/src/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexxNB/svelte-chota/0b4d259cec6a88f549fc8197bcf75c10f18aefed/docs_src/src/static/favicon.png -------------------------------------------------------------------------------- /docs_src/src/static/icons/javascript.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 | 23 | image/svg+xml 24 | 26 | 27 | 28 | 29 | 31 | 51 | 58 | 63 | 64 | -------------------------------------------------------------------------------- /docs_src/src/static/icons/sprite.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs_src/src/static/icons/svelte.svg: -------------------------------------------------------------------------------- 1 | svelte-logo -------------------------------------------------------------------------------- /docs_src/src/static/overpass-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexxNB/svelte-chota/0b4d259cec6a88f549fc8197bcf75c10f18aefed/docs_src/src/static/overpass-400.woff2 -------------------------------------------------------------------------------- /docs_src/src/static/overpass-600.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlexxNB/svelte-chota/0b4d259cec6a88f549fc8197bcf75c10f18aefed/docs_src/src/static/overpass-600.woff2 -------------------------------------------------------------------------------- /docs_src/src/theme.css: -------------------------------------------------------------------------------- 1 | /* Theme tunning: for full list ov variables visit the https://alexxnb.github.io/svelte-docs/theming */ 2 | @import "./font.css"; 3 | 4 | :root{ 5 | 6 | --primary: #14854F; 7 | --font: 'Overpass',sans-serif 8 | } 9 | 10 | body{ 11 | font-weight: 400; 12 | } 13 | 14 | h1,h2,h3,h4,h5,strong,b{ 15 | font-weight: 500; 16 | } -------------------------------------------------------------------------------- /docs_src/svelte-docs.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // if you will serve docs in subdirictory use '/subdir/' 3 | basepath: '/svelte-chota/', 4 | 5 | // theme 6 | theme: 'light', 7 | 8 | title: { 9 | // constant part of page title 10 | main: 'Svelte-Chota UI Components', 11 | 12 | // use first header's content as a part of page's title 13 | // it looks for `# Header` and `## Header` on the current page 14 | header: true, 15 | }, 16 | 17 | // URL to your favicon 18 | favicon: 'static/favicon.png', 19 | 20 | pathes: { 21 | // directory for files, generated in development mode 22 | dev: '__DOCS__/dev', 23 | 24 | // directory for builted documentaton 25 | build: '__DOCS__/dist', 26 | }, 27 | 28 | aliases:{ 29 | // Virtual packages 30 | // : , 31 | // 32 | // Ex1: './Button.svelte': './../dist/Button.svelte', 33 | // Ex2: 'mylib': './../dist/index.js', (don't miss `index` and `.js` at the end!) 34 | // 35 | // Then you can use: 36 | // import Button from './Button.svelte'; 37 | // import { Input } from 'mylib'; 38 | 'svelte-chota': './../cmp/index.js' 39 | }, 40 | 41 | preprocess: [ 42 | // preprocessors for Svelte if needed in Examples 43 | // syntax same as for `preprocess` option in `rollup-plugin-svelte` 44 | // Ex: Import preprocessor at top of the config file: 45 | // import {markdown} from 'svelte-preprocess-markdown'; 46 | // Then add it here: 47 | // markdown({filetype: 'svelte'}), 48 | 49 | ] 50 | 51 | } -------------------------------------------------------------------------------- /esbuild.js: -------------------------------------------------------------------------------- 1 | const esbuild = require('esbuild'); 2 | const sveltePlugin = require('esbuild-svelte'); 3 | const pkg = require('./package.json'); 4 | 5 | (async ()=>{ 6 | await esbuild.build({ 7 | entryPoints: ['cmp/index.js'], 8 | bundle: true, 9 | outfile: pkg.module, 10 | format: 'esm', 11 | minify: true, 12 | external: [ 13 | 'svelte', 14 | 'svelte/*' 15 | ], 16 | plugins: [sveltePlugin({compileOptions:{ 17 | dev: false, 18 | css: true 19 | }})] 20 | }); 21 | 22 | await esbuild.build({ 23 | entryPoints: ['cmp/index.js'], 24 | bundle: true, 25 | outfile: pkg.main, 26 | format: 'cjs', 27 | minify: true, 28 | external: [ 29 | 'svelte', 30 | 'svelte/*' 31 | ], 32 | plugins: [sveltePlugin({compileOptions:{ 33 | dev: false, 34 | css: true 35 | }})] 36 | }); 37 | })() -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "svelte-chota", 3 | "module": "dist/index.mjs", 4 | "main": "dist/index.js", 5 | "svelte": "cmp/index.js", 6 | "scripts": { 7 | "docs-dev": "cd ./docs_src && npm run dev", 8 | "docs-build": "cd ./docs_src && npm run build", 9 | "build": "node esbuild", 10 | "prepublishOnly": "npm run build" 11 | }, 12 | "keywords": [ 13 | "svelte", 14 | "chota", 15 | "svelte ui kit", 16 | "ui", 17 | "ui kit", 18 | "sveltejs" 19 | ], 20 | "files": [ 21 | "cmp", 22 | "dist" 23 | ], 24 | "devDependencies": { 25 | "esbuild": "^0.8.31", 26 | "esbuild-svelte": "^0.4.0", 27 | "svelte": "^3.31.2" 28 | }, 29 | "description": "Svelte UI components based on super lightweight chota CSS framework.", 30 | "version": "1.8.6", 31 | "repository": { 32 | "type": "git", 33 | "url": "git+https://github.com/AlexxNB/svelte-chota.git" 34 | }, 35 | "author": "Alexey Schebelev", 36 | "license": "MIT", 37 | "bugs": { 38 | "url": "https://github.com/AlexxNB/svelte-chota/issues" 39 | }, 40 | "homepage": "https://alexxnb.github.io/svelte-chota" 41 | } 42 | --------------------------------------------------------------------------------