├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml └── workflows │ ├── ci.yml │ ├── deploy.yml │ └── publish.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── babel.config.cjs ├── copy-assets.cjs ├── docs ├── color-modes.mdx ├── colors.mdx ├── configuration.mdx ├── elements.mdx ├── elements │ ├── alert.mdx │ ├── badge.mdx │ ├── button.mdx │ ├── card.mdx │ ├── checkbox.mdx │ ├── close.mdx │ ├── column.mdx │ ├── container.mdx │ ├── crumb.mdx │ ├── dropdown.mdx │ ├── input.mdx │ ├── label.mdx │ ├── menu.mdx │ ├── modal.mdx │ ├── navlink.mdx │ ├── progress.mdx │ ├── radio.mdx │ ├── scrim.mdx │ ├── select.mdx │ ├── slider.mdx │ ├── spinner.mdx │ ├── switch.mdx │ └── textarea.mdx ├── getting-started.mdx ├── helpers.mdx ├── helpers │ ├── colors.mdx │ ├── flexbox.mdx │ ├── other.mdx │ ├── sizing.mdx │ ├── spacing.mdx │ └── typography.mdx ├── markup.mdx ├── naming.mdx ├── packages │ ├── cli.mdx │ ├── colors.mdx │ ├── core.mdx │ ├── icons.mdx │ ├── modules.mdx │ ├── postcss.mdx │ ├── presets.mdx │ └── standalone.mdx ├── presets │ ├── base.mdx │ ├── dark.mdx │ ├── ice.mdx │ ├── mustard.mdx │ └── noir.mdx ├── reset.mdx ├── responsive.mdx ├── syntax.mdx └── theme.mdx ├── examples ├── _template.html ├── features.html ├── footer.html ├── hero.html ├── navbar.html ├── pricing.html ├── sign-in.html └── tabs.html ├── gulpfile.js ├── header.svg ├── jest.config.cjs ├── package.json ├── packages ├── cli │ ├── README.md │ ├── index.js │ └── package.json ├── colors │ ├── README.md │ ├── index.js │ └── package.json ├── core │ ├── README.md │ ├── index.js │ └── package.json ├── icons │ ├── README.md │ ├── index.js │ └── package.json ├── modules │ ├── README.md │ ├── elements.js │ ├── helpers.js │ ├── index.js │ ├── markup.js │ ├── package.json │ └── reset.js ├── postcss │ ├── README.md │ ├── index.js │ └── package.json ├── preset-base │ ├── README.md │ ├── index.js │ └── package.json ├── preset-dark │ ├── README.md │ ├── index.js │ └── package.json ├── preset-ice │ ├── README.md │ ├── index.js │ └── package.json ├── preset-mustard │ ├── README.md │ ├── index.js │ └── package.json ├── preset-noir │ ├── README.md │ ├── index.js │ └── package.json ├── presets │ ├── README.md │ ├── index.js │ └── package.json └── standalone │ ├── README.md │ ├── example.html │ ├── index.js │ └── package.json ├── playground ├── App.jsx ├── actions │ ├── playground.js │ └── worker.js ├── components │ ├── Brand.jsx │ ├── Button.jsx │ ├── Editor.jsx │ ├── FileTab.jsx │ ├── Preview.jsx │ └── ShareModal.jsx ├── defaults.js ├── hooks │ └── useEditor.js ├── index.html ├── package.json ├── playground.html ├── webpack.config.js └── worker.js ├── siimple-icons ├── README.md ├── header.png ├── package.json └── siimple.config.js ├── siimple ├── README.md ├── index.js ├── package.json ├── postcss.cjs └── siimple.config.js ├── test ├── build.test.js ├── merge.test.js ├── mixins.test.js ├── modules.test.js └── standalone.test.js └── website ├── assets └── styles.css ├── components ├── ColorPalette.jsx ├── Examples.jsx ├── Footer.jsx ├── Header.jsx ├── Icons.jsx ├── Link.jsx ├── LiveCode.jsx ├── ModalExample.jsx ├── Pagination.jsx ├── Preset.jsx ├── Section.jsx ├── Sidebar.jsx ├── Tabs.jsx └── Welcome.jsx ├── data ├── examples.json ├── features.json └── testimonials.json ├── gatsby-config.js ├── gatsby-node.js ├── gatsby-ssr.js ├── layouts ├── Docs.jsx └── Page.jsx ├── package.json ├── pages ├── 404.jsx ├── examples.mdx ├── icons.mdx └── index.mdx └── sidebar.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: jmjuanes 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: "🐛 Report a bug" 2 | description: "Okay, Houston... I think we've had a problem here..." 3 | title: "Bug: " 4 | labels: ["under-investigation"] 5 | body: 6 | - type: textarea 7 | attributes: 8 | label: "Describe the issue" 9 | description: "Please provide a clear and concise description of the bug or issue." 10 | validations: 11 | required: true 12 | 13 | - type: textarea 14 | attributes: 15 | label: "To reproduce" 16 | description: "Steps to reproduce the issue. If possible, add a link to JSFiddle or similar where we can inspect the issue." 17 | validations: 18 | required: true 19 | 20 | - type: textarea 21 | attributes: 22 | label: "Screenshots" 23 | description: "If applicable, add screenshots to help explain your problem." 24 | 25 | - type: dropdown 26 | attributes: 27 | label: "What browser(s) are you seeing the problem on?" 28 | multiple: true 29 | options: 30 | - Chrome 31 | - Safari 32 | - Firefox 33 | - Microsoft Edge 34 | - Opera 35 | 36 | - type: input 37 | attributes: 38 | label: "What version of **siimple** are you using?" 39 | placeholder: "e.g., v4.0.0" 40 | validations: 41 | required: true 42 | 43 | - type: textarea 44 | attributes: 45 | label: "Additional context" 46 | description: "You can add any other context about the problem here..." 47 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: 📚 Documentation 4 | url: https://www.siimple.xyz 5 | about: Check the documentation for usage. 6 | - name: 💬 Ask a Question 7 | url: https://github.com/jmjuanes/siimple/discussions 8 | about: How does X work? I made this! I have an idea... -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: "💡 Request a feature" 2 | description: "Suggest a new idea for siimple" 3 | title: "New feature: " 4 | labels: ["request-feature"] 5 | body: 6 | - type: dropdown 7 | attributes: 8 | label: "Feature type" 9 | options: 10 | - "New preset" 11 | - "New element" 12 | - "New icon" 13 | - "Other..." 14 | validations: 15 | required: true 16 | 17 | - type: textarea 18 | attributes: 19 | label: "Is your feature request related to a problem?" 20 | description: "A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]" 21 | 22 | - type: textarea 23 | attributes: 24 | label: "Describe the solution you'd like" 25 | description: "A clear and concise description of what you want to happen." 26 | validations: 27 | required: true 28 | 29 | - type: textarea 30 | attributes: 31 | label: "Describe alternatives you've considered" 32 | description: "A clear and concise description of any alternative solutions or features you've considered." 33 | 34 | - type: textarea 35 | attributes: 36 | label: "Additional context" 37 | description: "Add any other context or screenshots about the feature request here." 38 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | types: [opened, reopened, synchronize] 9 | 10 | jobs: 11 | ci: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: actions/setup-node@v2 16 | with: 17 | node-version: 16 18 | - run: yarn install 19 | - run: yarn run build 20 | - run: yarn run test 21 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy 2 | 3 | on: 4 | push: 5 | tags: ["*"] 6 | workflow_dispatch: 7 | 8 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 9 | permissions: 10 | contents: read 11 | pages: write 12 | id-token: write 13 | 14 | # Allow one concurrent deployment 15 | concurrency: 16 | group: "deploy" 17 | cancel-in-progress: true 18 | 19 | jobs: 20 | deploy: 21 | if: ${{ github.repository == 'jmjuanes/siimple' }} 22 | environment: 23 | name: github-pages 24 | url: ${{ steps.deployment.outputs.page_url }} 25 | runs-on: ubuntu-latest 26 | steps: 27 | - uses: actions/checkout@v3 28 | - uses: actions/setup-node@v2 29 | with: 30 | node-version: 16 31 | - uses: actions/configure-pages@v1 32 | - run: yarn install 33 | - run: yarn run build 34 | - run: yarn run build:website 35 | - uses: actions/upload-pages-artifact@v1 36 | with: 37 | path: public 38 | - uses: actions/deploy-pages@v1 39 | id: deployment 40 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish packages to NPM 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | jobs: 8 | ## Generate list of monorepo packages to publish 9 | packages: 10 | runs-on: ubuntu-latest 11 | outputs: 12 | names: ${{ steps.folders.outputs.folders }} 13 | steps: 14 | - uses: actions/checkout@v3 15 | - id: folders 16 | run: echo "::set-output name=folders::$(ls -d packages/* | jq -R -s -c 'split("\n")[:-1]')" 17 | ## Publish monorepo packages 18 | publish-packages: 19 | runs-on: ubuntu-20.04 20 | needs: [packages] 21 | strategy: 22 | matrix: 23 | package: ${{ fromJson(needs.packages.outputs.names) }} 24 | steps: 25 | - uses: actions/checkout@v3 26 | - uses: actions/setup-node@v3 27 | with: 28 | node-version: '16.x' 29 | registry-url: 'https://registry.npmjs.org' 30 | - run: cd ${{ matrix.package }} && npm publish --access public 31 | env: 32 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 33 | ## Publish main package 34 | publish-dist: 35 | runs-on: ubuntu-latest 36 | needs: [publish-packages] 37 | steps: 38 | - uses: actions/checkout@v3 39 | - uses: actions/setup-node@v3 40 | with: 41 | node-version: '16.x' 42 | registry-url: 'https://registry.npmjs.org' 43 | - run: yarn install 44 | - run: yarn run build 45 | - run: cd siimple && npm publish 46 | env: 47 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 48 | - run: cd siimple-icons && npm publish 49 | env: 50 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # General files and folders 2 | .DS_Store 3 | node_modules 4 | *.iml 5 | .idea 6 | *.swp 7 | package-lock.json 8 | yarn.lock 9 | firebase-debug.log 10 | *.tgz 11 | *.tar.gz 12 | *.log 13 | .cache 14 | 15 | # Env files 16 | .env 17 | .env.development 18 | .env.production 19 | .env.test 20 | 21 | # Release folders and files 22 | dist 23 | distributions 24 | release 25 | siimple.css 26 | siimple/*.css 27 | siimple-icons/*.css 28 | siimple-icons/siimple-icons.svg 29 | packages/*/*.css 30 | 31 | # Applications output folders 32 | public 33 | 34 | # Other folders and files 35 | .firebaserc 36 | .firebase 37 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [team@siimple.xyz](mailto:team@siimple.xyz). All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to siimple 2 | 3 | First, thanks a lot for taking the time to contribute to the **siimple** project! :blush::tada: 4 | 5 | Here you have the guidelines that you must read before start contributing to **siimple**. 6 | 7 | ## Code of Conduct 8 | 9 | You must read and follow the [code of conduct](./CODE_OF_CONDUCT.md) of **siimple**. 10 | 11 | ## Questions or problems 12 | 13 | We are happy to help you if you have any problem or questions using **siimple**. Please, send your problem to our [discussions forum](https://github.com/jmjuanes/siimple/discussions). 14 | 15 | ## How to contribute 16 | 17 | As an open source project, we love to receive contributions from the community. 18 | 19 | ### Improve the documentation 20 | 21 | We maintain a documentation site that is public available at https://www.siimple.xyz. You can help us improving the documentation by: 22 | - Adding missing information. 23 | - Fixing typos. 24 | - Updating them to the latest features of the toolkit. 25 | 26 | Feel free to open a new [documentation issue](https://github.com/jmjuanes/siimple/issues). 27 | 28 | ### Bugs 29 | 30 | If you want to report a bug in **siimple**, please open a new [bug issue here](https://github.com/jmjuanes/siimple/issues) and include as many details as possible with your report. Adding code or screenshots are very helpful. 31 | 32 | Also, you can help us and publish a new [pull request](https://github.com/jmjuanes/siimple/pulls) with the bugfix. Remember that **all pull request must be sent against the `main` branch**. 33 | 34 | ### Request a new feature 35 | 36 | You can request a new feature or suggest an improvement on existing functionalities by submitting a new [feature request issue](https://github.com/jmjuanes/siimple/issues). 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Josemi Juanes 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 | 23 | -------------------------------------------------------------------------------- /babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | ["@babel/preset-env", { 4 | targets: { 5 | node: "current", 6 | }, 7 | }], 8 | ], 9 | }; 10 | -------------------------------------------------------------------------------- /copy-assets.cjs: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | 4 | const publicPath = path.resolve(__dirname, "./public"); 5 | const assets = [ 6 | { 7 | from: "./website/public/", 8 | to: "./", 9 | }, 10 | { 11 | from: "./playground/public/", 12 | to: "./playground/", 13 | }, 14 | ]; 15 | 16 | // Clean prev public folder 17 | console.log(`Clean public folder '${publicPath}'`); 18 | if (fs.existsSync(publicPath)) { 19 | fs.rmSync(publicPath, {recursive: true}); 20 | } 21 | fs.mkdirSync(publicPath); 22 | 23 | // Copy assets 24 | console.log("Copying assets..."); 25 | assets.forEach(item => { 26 | const sourcePath = path.resolve(__dirname, item.from); 27 | const destPath = path.resolve(publicPath, item.to); 28 | 29 | console.log(`Copying '${sourcePath}' => '${destPath}'`); 30 | fs.cpSync(sourcePath, destPath, {recursive: true}); 31 | }); 32 | -------------------------------------------------------------------------------- /docs/color-modes.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Color Modes 3 | --- 4 | 5 | # Color Modes 6 | 7 | Color modes makes it easy to change the color mode of your website, including support for **dark and light modes**. 8 | 9 | ## Enable color modes 10 | 11 | To enable color mode you should set the `useColorModes` flag to `true` in your theme configuration: 12 | 13 | ```js title=siimple.config.js 14 | export default { 15 | useColorModes: true, 16 | // ...other configuration 17 | }; 18 | ``` 19 | 20 | ## Defining colors 21 | 22 | Color modes are configured in the `colorModes` field of your theme configuration. Use the key for the color mode name and a nested object for providing the custom colors for the color mode. 23 | 24 | ```js title=siimple.config.js 25 | import colors from "@siimple/colors"; 26 | 27 | export default { 28 | useColorModes: true, 29 | colors: { 30 | text: colors.gray["700"], 31 | background: "#fff", 32 | primary: colors.blue["500"], 33 | // ...other colors 34 | }, 35 | colorModes: { 36 | dark: { 37 | text: "#fff", 38 | background: colors.gray["800"], 39 | }, 40 | // ...other color modes 41 | }, 42 | // ...other configuration 43 | }; 44 | ``` 45 | 46 | In the previous example, we are defining a new color mode `dark` that will change the `text` and `background` colors when enabled. 47 | 48 | ## Manually enable a color mode 49 | 50 | Add an attribute `data-color-mode` to the `` tag with the color mode to apply. For example, if you define the `dark` color mode in your configuration file, you can enable it adding a `data-color-mode="dark"` in your `` tag: 51 | 52 | ```html 53 | 54 | 55 | 56 | ``` 57 | 58 | You can use JavaScript to change the color mode in runtime: 59 | 60 | ```js 61 | const setColorMode = mode => { 62 | document.querySelector("html").dataset.colorMode = mode; 63 | }; 64 | 65 | // Change the color mode 66 | setColorMode("dark"); 67 | ``` 68 | 69 | ## Enable Dark mode automatically 70 | 71 | You can easily enable the dark (or light) color mode automatically based on the user color preference using the `prefers-color-scheme` [media query](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme). 72 | 73 | Note that not all browsers supports the `prefers-color-scheme` media. You can check the browser compatibility there: https://caniuse.com/prefers-color-scheme. 74 | 75 | ### Using the useColorModesMediaQuery flag 76 | 77 | We also provide an additional flag called `useColorModesMediaQuery` to automatically use the `prefers-color-scheme` media query to enable the color mode based on the user configuration. 78 | 79 | Just set to `true` the `useColorModesMediaQuery` in your configuration file (note that the `useColorModes` flag **is also required**): 80 | 81 | ```js title=siimple.config.js 82 | export default { 83 | useColorModes: true, // Required!!! 84 | useColorModesMediaQuery: true, 85 | // Configure your color modes 86 | colorModes: { 87 | dark: { 88 | // ...dark color mode configuration 89 | }, 90 | // ...other color modes 91 | }, 92 | // ...other configuration 93 | }; 94 | ``` 95 | 96 | ### Using JavaScript 97 | 98 | You can use the [`matchMedia`](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) function of JavaScript to check if the document matches the `(prefers-color-scheme: dark)` media query and enable the dark color mode based on the user preference. 99 | 100 | There is an example using the `setColorMode` function previously created: 101 | 102 | ```js 103 | // Use matchMedia to check the user preference 104 | const prefersDark = window.matchMedia("(prefers-color-scheme: dark)"); 105 | 106 | // Initially enable dark mode 107 | setColorMode(prefersDark.matches ? "dark" : "light"); 108 | 109 | // Add event listener to color mode changes 110 | perfersDark.addListener(() => { 111 | setColorMode(prefersDark.matches ? "dark" : "light"); 112 | }); 113 | ``` 114 | -------------------------------------------------------------------------------- /docs/colors.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Colors" 3 | --- 4 | 5 | # Colors 6 | 7 | We provide a default color palette that you can use to customize your theme in case that you do not have any brand colors. 8 | 9 | 10 | 11 | ## Using default colors 12 | 13 | In case that you do not have custom colors defined in your project, you can import the `@siimple/colors` module in your configuration file to access the default colors provided in **siimple**. 14 | 15 | ```js title=siimple.config.js 16 | import colors from "@siimple/colors"; 17 | 18 | // Comfigure siimple using the color palette 19 | export default { 20 | colors: { 21 | primary: colors.mint["500"], 22 | secondary: colors.royal["600"], 23 | text: colors.gray["700"], 24 | // ...other colors 25 | }, 26 | // ...other configuration 27 | }; 28 | ``` 29 | 30 | ## Adding all colors to your theme 31 | 32 | You can register all colors in your theme just using a tiny piece of JS code to transform color objects into plain color names with the pattern `{name}-{shade}`: 33 | 34 | ```js title=siimple.config.js 35 | import colors from "@siimple/colors"; 36 | 37 | export default { 38 | colors: { 39 | ...Object.keys(colors).reduce((prev, name) => ({ 40 | ...prev, 41 | ...Object.fromEntries(Object.keys(colors[name]).map(shade => { 42 | return [`${name}-${shade}`, colors[name][shade]]; 43 | })), 44 | }), {}), 45 | // ...other colors 46 | }, 47 | // ...other configuration 48 | }; 49 | ``` 50 | 51 | If you have the helpers module enabled, this will generate the following colors helpers: 52 | 53 | ```css 54 | .has-bg-blue-100 { /* ... */ } 55 | .has-bg-highlight { /* ... */ } 56 | .has-bg-blue-300 { /* ... */ } 57 | /* ... */ 58 | .has-text-blue-100 { /* ... */ } 59 | .has-text-blue-200 { /* ... */ } 60 | .has-text-blue-300 { /* ... */ } 61 | /* ... */ 62 | ``` 63 | -------------------------------------------------------------------------------- /docs/elements/alert.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Alert 3 | --- 4 | 5 | # Alert 6 | 7 | An **alert** is a colored notification block generally used to catch the attention of your users of something important. An alert can be created adding the `alert` class to a `
` tag. 8 | 9 | ```html live=true 10 |
11 | Lorem ipsum dolor sit amet, consectetur adipiscing elit... 12 |
13 | ``` 14 | 15 | We provide an `is-secondary` modifier for using the secondary color defined in your theme as the background color of the alert: 16 | 17 | ```html live=true 18 |
19 | Lorem ipsum dolor sit amet, consectetur adipiscing elit... 20 |
21 | ``` 22 | 23 | You can add a close button to the alert using the `close` element: 24 | 25 | ```html live=true 26 |
27 |
Content of the alert message
28 |
29 |
30 | ``` 31 | 32 | ### Customize 33 | 34 | You can customize the alert element using the `alerts` field of your theme configuration. Styles defined in the `alerts.default` field will be applied to the base `alert` element, and any other field will generate additional variant modifiers for the alert element. 35 | 36 | ```js title=siimple.config.js 37 | export default { 38 | alerts: { 39 | default: { 40 | backgroundColor: "primary", 41 | color: "white", 42 | }, 43 | // ...other additional alert variants 44 | }, 45 | // ...other configuration 46 | }; 47 | ``` 48 | -------------------------------------------------------------------------------- /docs/elements/badge.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Badge 3 | description: Small labelling element 4 | --- 5 | 6 | # Badge 7 | 8 | **Badges** are useful elements for indicating status, attach metadata to another element or displaying numbers for counts. You can easily turn a `` or `
` element to a badge adding the `badge` class. 9 | 10 | ```html live=true 11 | Badge 12 | ``` 13 | 14 | We provide an `is-secondary` modifier for using the secondary color defined in your theme as the background color of the badge: 15 | 16 | ```html live=true 17 | Badge 18 | ``` 19 | 20 | ### Customize 21 | 22 | You can customize the badge element using the `badges` field of your theme configuration. Styles defined in the `badges.default` field will be applied to the base `badge` element, and any other field will generate additional variants modifiers for the badge element. 23 | 24 | 25 | ```js title=siimple.config.js 26 | export default { 27 | badges: { 28 | default: { 29 | backgroundColor: "primary", 30 | color: "white", 31 | }, 32 | // ...other additional variants for badges 33 | }, 34 | // ...other configuration 35 | }; 36 | ``` 37 | -------------------------------------------------------------------------------- /docs/elements/button.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Button" 3 | description: "The essential and classic button element" 4 | --- 5 | 6 | # Buttons 7 | 8 | Buttons are essential elements in any website or application for **actions**. The `button` class can be used in a ` 12 | ``` 13 | 14 | You can style your button using the secondary color of your theme with the mofidier `is-secondary`: 15 | 16 | ```html live=true 17 | 18 | ``` 19 | 20 | You can style a button as disabled using the `is-disabled` modifier and adding a `disabled` attribute to the button: 21 | 22 | ```html live=true 23 | 24 | ``` 25 | 26 | We also provide the `is-full` modifier to change the button width to the **full parent width**: 27 | 28 | ```html live=true 29 | 30 | ``` 31 | 32 | ### Customize 33 | 34 | You can customize the button element using the `buttons` field of your theme configuration. Styles defined in the `buttons.default` field will be applied to the base `button` element, and any other field will generate additional variant modifiers for the button element. 35 | 36 | ```js title=siimple.config.js 37 | export default { 38 | badges: { 39 | default: { 40 | backgroundColor: "primary", 41 | color: "white", 42 | }, 43 | // ...other additional buttons mixins 44 | // For examplem the following 'disabled' variant will generate a '.button.is-disabled' modifier 45 | disabled: { 46 | cursor: ["not-allowed", "!important"], 47 | opacity: ["0.6", "!important"], 48 | }, 49 | }, 50 | // ...other configuration 51 | }; 52 | ``` 53 | -------------------------------------------------------------------------------- /docs/elements/card.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Card" 3 | description: "A minimal and flexible container element" 4 | --- 5 | 6 | # Card 7 | 8 | A **card** is a flexible container element that holds content and actions about a single subject or topic. By default, cards have no fixed width. A card can be created adding a `card` class to a `
` tag. 9 | 10 | 11 | ```html live=true 12 |
13 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. 14 |
15 | ``` 16 | 17 | ### Customize 18 | 19 | The card element will apply the styles defined in the `layout.card` field of your theme configuration. 20 | 21 | ```js title=siimple.config.js 22 | export default { 23 | layout: { 24 | card: { 25 | backgroundColor: "white", 26 | color: "inherit", 27 | padding: "2rem", 28 | }, 29 | }, 30 | // ...other configuration 31 | }; 32 | ``` 33 | -------------------------------------------------------------------------------- /docs/elements/checkbox.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Checkbox" 3 | description: "Checkbox input component" 4 | --- 5 | 6 | # Checkbox 7 | 8 | Style your checkbox elements adding the `checkbox` style to the `` element. 9 | 10 | ```html live=true 11 | 15 | ``` 16 | 17 | By default, the checkbox will be displayed unchecked, but you can add a **checked** attribute to the `` element to display the checkbox as checked, or use the `is-active` modifier to manually display it as active. 18 | 19 | ```html live=true 20 | 24 | ``` 25 | 26 | Checkboxes can also display the **indeterminate** state. Remember that there is no HTML attribute to set this state, the only way to set this state is via [JavaScript](https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate). 27 | 28 | ```html 29 | 30 | 31 | 32 | 35 | ``` 36 | 37 | ### Customize 38 | 39 | The checkbox element will apply the styles defined in the `forms.checkbox` field of your theme configuration. 40 | 41 | ```js title=siimple.config.js 42 | export default { 43 | forms: { 44 | checkbox: { 45 | backgroundColor: "muted", 46 | color: "white", 47 | "&:checked, &:indeterminate": { 48 | backgroundColor: "primary", 49 | }, 50 | "&:indeterminate:after": { 51 | borderBottomColor: "white", 52 | }, 53 | "&:checked:after": { 54 | borderBottomColor: "white", 55 | borderLeftColor: "white", 56 | }, 57 | }, 58 | }, 59 | }; 60 | ``` 61 | -------------------------------------------------------------------------------- /docs/elements/close.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Close" 3 | description: "A close button" 4 | --- 5 | 6 | # Close 7 | 8 | Use the `close` class to create a close button: 9 | 10 | ```html align=center live=true 11 |
12 | ``` 13 | 14 | ### Customize 15 | 16 | The close element will apply the styles defined in the `buttons.close` field of your theme configuration. 17 | 18 | ```js title=siimple.config.js 19 | export default { 20 | buttons: { 21 | close: { 22 | color: "currentColor", 23 | }, 24 | }, 25 | }; 26 | ``` 27 | -------------------------------------------------------------------------------- /docs/elements/column.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Column" 3 | --- 4 | 5 | # Column 6 | 7 | You can add **columns** to your grid row using the class `column`, and wrapp all columns in a `columns`. By default, you do not have to specify the size of the column: **each column will have by default an equal width**, proportional to the number of columns you have added. 8 | 9 | ```html live=true 10 |
11 |
12 |
Column 1
13 |
14 |
15 |
Column 2
16 |
17 |
18 |
Column 3
19 |
20 |
21 | ``` 22 | 23 | To customize the width of each column, we provide the following modifiers: 24 | 25 | | Variant | Column size | 26 | |---------|-------------| 27 | | `is-one-fifth` | `width: 20%` | 28 | | `is-one-quarter` | `width: 25%` | 29 | | `is-one-third` | `width: 33.33%` | 30 | | `is-two-fifths` | `width: 40%` | 31 | | `is-half` | `width: 50%` | 32 | | `is-three-fifths` | `width: 60%` | 33 | | `is-two-thirds` | `width: 66.66%` | 34 | | `is-three-quarters` | `width: 75%` | 35 | | `is-four-fifths` | `width: 80%` | 36 | | `is-full` | `width: 100%` | 37 | 38 | Example: 39 | 40 | ```html live=true 41 |
42 |
43 |
2/3
44 |
45 |
46 |
1/3
47 |
48 |
49 | ``` 50 | 51 | You can also apply these variants in different breakpoints to customize the column behavior across different devices and screen sizes. 52 | 53 | You can combine different column classes to specify how the grid will be displayed on different devices. For example, if you create a grid with two columns and add the class `is-half` and `is-full-mobile`, your grid will have two columns on tablet screens and up, and one column on mobile devices. 54 | 55 | ```html 56 |
57 |
Column
58 |
Column
59 |
60 | ``` 61 | 62 | You can hide a column at a specific breakpoint using the responsive `is-hidden` helper. 63 | 64 | ```html 65 |
66 |
67 | Hidden on mobile 68 |
69 |
70 | Always visible 71 |
72 |
73 | ``` 74 | 75 | ### Customize 76 | 77 | The column element will apply the styles defined in the `layout.column` field of your theme configuration. 78 | 79 | ```js title=siimple.config.js 80 | export default { 81 | layout: { 82 | column: { 83 | paddingTop: "0.75rem", 84 | paddingBottom: "0.75rem", 85 | }, 86 | }, 87 | // ...other configuration 88 | }; 89 | ``` 90 | -------------------------------------------------------------------------------- /docs/elements/container.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Container 3 | description: A responsive element to center content horizontally 4 | --- 5 | 6 | # Container 7 | 8 | A **container** is a layout element that divides your website in sections and places the information it contains in the center of the window in every moment. Add the class `container` to your `
` to use it: 9 | 10 | ```html 11 |
12 | Lorem ipsum dolor sit amet, consectetur adipiscing elit... 13 |
14 | ``` 15 | 16 | By default the container has the maximun width minus the `32px` of padding left and right. You can customize the maximum width of the container providing your custom `maxWidth` value in the `layout.container` field of your theme (see below). 17 | 18 | ### Customize 19 | 20 | The container element will apply the styles defined in the `layout.container` field of your theme configuration. 21 | 22 | ```js title=siimple.config.js 23 | export default { 24 | layout: { 25 | container: { 26 | maxWidth: "560px", 27 | }, 28 | }, 29 | // ..other configuration 30 | }; 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/elements/crumb.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Crumb" 3 | description: "Show the current page navigation" 4 | --- 5 | 6 | # Crumb 7 | 8 | The breadcrumb is an easy-to-use element to keep track of the path the user has navigated. 9 | Each item should have the `crumb` class, and you can use the additional `crumbs` class to wrap all crumb elements: 10 | 11 | ```html live=true 12 |
13 | Home 14 | About 15 | Contact 16 |
17 | ``` 18 | 19 | We provide an `is-active` modifier to mark a crumb as active, for example to inform the user about the current page. 20 | 21 | ```html live=true 22 |
23 | Home 24 | About 25 | Contact us 26 |
27 | ``` 28 | 29 | ### Customize 30 | 31 | The crumb element will apply the styles defined in the `links.crumb` field of your theme configuration. 32 | 33 | ```js title=siimple.config.js 34 | export default { 35 | links:{ 36 | crumb: { 37 | color: "black", 38 | }, 39 | }, 40 | // ...other configuration 41 | }; 42 | ``` 43 | -------------------------------------------------------------------------------- /docs/elements/dropdown.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Dropdown 3 | --- 4 | 5 | # Dropdown 6 | 7 | Dropdowns are contextual elements usually used for displaying lists of links. Dropdowns are toggled by hovering the parent element. 8 | 9 | Dropdowns are created adding a `dropdown` class to a `
` element. To automatically display the dropdown when the user hovers the parent element, add a `with-dropdown` modifier to the parent element. 10 | 11 | ```html live=true 12 |
13 | 17 | 22 |
23 | ``` 24 | -------------------------------------------------------------------------------- /docs/elements/input.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Input" 3 | description: "The universal text input element" 4 | --- 5 | 6 | # Input 7 | 8 | Add the `input` class to your text-based `` tags (text, password, number and email types). 9 | 10 | ```html live=true 11 | 12 | 13 | ``` 14 | 15 | ### Customize 16 | 17 | The input element will apply the styles defined in the `forms.input` field of your theme configuration. 18 | 19 | ```js title=siimple.config.js 20 | export default { 21 | forms: { 22 | input: { 23 | backgroundColor: "muted", 24 | padding: "0.25rem", 25 | }, 26 | }, 27 | // ...other configuration 28 | }; 29 | ``` 30 | -------------------------------------------------------------------------------- /docs/elements/label.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Label" 3 | description: "Style your form labels" 4 | --- 5 | 6 | # Label 7 | 8 | Style your form **label** element adding a `label` class, useful with radio, checkbox and switch elements. 9 | 10 | ```html live=true 11 | 15 | ``` 16 | 17 | ### Customize 18 | 19 | The label element will apply the styles defined in the `forms.label` field of your theme configuration. 20 | 21 | ```js title=siimple.config.js 22 | export default { 23 | forms: { 24 | label: { 25 | color: "inherit", 26 | fontWeight: "bold", 27 | }, 28 | }, 29 | // ...other configuration 30 | }; 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/elements/menu.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Menu 3 | --- 4 | 5 | # Menu 6 | 7 | Use the `menu` class to create a menu button, useful for displaying hidden menus: 8 | 9 | ```html align=center live=true 10 | 11 | ``` 12 | 13 | ### Customize 14 | 15 | The menu element will apply the styles defined in the `buttons.menu` field of your theme configuration. 16 | 17 | ```js title=siimple.config.js 18 | export default { 19 | buttons: { 20 | menu: { 21 | borderColor: "currentColor", 22 | color: "currentColor", 23 | }, 24 | }, 25 | // ...other configuration 26 | }; 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/elements/modal.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Modal" 3 | --- 4 | 5 | # Modal 6 | 7 | Use the `modal` class to create a wrapper for your modal dialogs. Usually you will need to use also the `scrim` class to block the interaction with the background elements, and the `close` for displaying a close button in the modal. 8 | 9 | 10 | 11 | ```html 12 |
13 | 22 |
23 | ``` 24 | 25 | ### Customize 26 | 27 | The modal element will apply the styles defined in the `dialogs.modal` field of your theme configuration. 28 | 29 | ```js title=siimple.config.js 30 | export default { 31 | dialogs: { 32 | modal: { 33 | maxWidth: "500px", 34 | }, 35 | }, 36 | // ...other configuration 37 | }; 38 | ``` 39 | -------------------------------------------------------------------------------- /docs/elements/navlink.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "NavLink" 3 | description: "Navigation link element" 4 | --- 5 | 6 | # NavLink 7 | 8 | A navigation link element that you can use in your navigation sections, for example in the navbar. Just add a `navlink` class to your link to style it as a navigation link. 9 | 10 | ```html live=true 11 |
12 | Link 1 13 | Link 2 14 | Link 3 15 |
16 | ``` 17 | 18 | We provide an `is-active` modifier to mark a navigation link as active, and a `is-disabled` modifier to mark a navigation link as disabled. 19 | 20 | ```html live=true 21 |
22 | Link 1 23 | Link 2 24 | Link 3 25 |
26 | ``` 27 | 28 | ### Customize 29 | 30 | The navlink element will apply the styles defined in the `links.nav` field of your theme configuration. 31 | 32 | ```js title=siimple.config.js 33 | export default { 34 | links: { 35 | nav: { 36 | fontWeight: "bold", 37 | "&:hover": { 38 | color: "primary", 39 | }, 40 | "&.is-disabled": { 41 | opacity: "0.5", 42 | pointerEvents: "none", 43 | }, 44 | }, 45 | }, 46 | // ...other configuration 47 | }; 48 | ``` 49 | -------------------------------------------------------------------------------- /docs/elements/progress.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Progress" 3 | --- 4 | 5 | # Progress 6 | 7 | Style your `` elements using the class `progress`: 8 | 9 | ```html live=true 10 | 11 | ``` 12 | 13 | ### Customize 14 | 15 | The progress element will apply the styles defined in the `styles.progress` field of your theme configuration. 16 | 17 | ```js title=siimple.config.js 18 | export default { 19 | styles: { 20 | progress: { 21 | backgroundColor: "muted", 22 | color: "primary", 23 | }, 24 | }, 25 | // ..other configuration 26 | }; 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/elements/radio.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Radio" 3 | description: "Form radio component" 4 | --- 5 | 6 | # Radio 7 | 8 | Add a `radio` class to an `` element to style it as a radio. 9 | 10 | ```html live=true 11 | 15 | ``` 16 | 17 | By default, the radio will be displayed unchecked, but you can add a `checked` attribute to the `` element for displaying the radio as checked. 18 | 19 | ```html live=true 20 | 24 | ``` 25 | 26 | ### Customize 27 | 28 | The radio element will apply the styles defined in the `forms.radio` field of your theme configuration. 29 | 30 | ```js title=siimple.config.js 31 | export default { 32 | forms: { 33 | radio: { 34 | color: "primary", 35 | }, 36 | }, 37 | // ...other configuration 38 | }; 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/elements/scrim.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Scrim" 3 | --- 4 | 5 | # Scrim 6 | 7 | A **scrim** is a visual element that blocks the interaction with the background elements, allowing only to interact with the elements inside the scrim. 8 | 9 | You can create a scrim using the class `scrim`. By default, all elements inside the scrim will be centered in the screen. 10 | 11 | ```html 12 |
13 | Content of the scrim 14 |
15 | ``` 16 | 17 | ### Customize 18 | 19 | The scrim element will apply the styles defined in the `dialogs.scrim` field of your theme configuration. 20 | 21 | ```js title=siimple.config.js 22 | export default { 23 | dialogs: { 24 | scrim: { 25 | backgroundColor: "rgba(0, 0, 0, 0.5)", 26 | }, 27 | }, 28 | // ...other configuration 29 | }; 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/elements/select.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Select" 3 | description: "A basic dropdown selection element" 4 | --- 5 | 6 | # Select 7 | 8 | You can style your ` 12 | 13 | 14 | 15 | 16 | ``` 17 | 18 | ### Customize 19 | 20 | The select element will apply the styles defined in the `forms.select` field of your theme configuration. 21 | 22 | ```js title=siimple.config.js 23 | export default { 24 | forms: { 25 | select: { 26 | backgroundColor: "fill", 27 | }, 28 | }, 29 | // ...other configuration 30 | }; 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/elements/slider.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Slider" 3 | --- 4 | 5 | # Slider 6 | 7 | Use the `slider` class to style your range input elements: 8 | 9 | ```html live=true 10 | 11 | ``` 12 | 13 | ### Customize 14 | 15 | The slider element will apply the styles defined in the `forms.slider` field of your theme configuration. 16 | 17 | ```js title=siimple.config.js 18 | export default { 19 | forms: { 20 | slider: { 21 | backgroundColor: "fill", 22 | color: "primary", 23 | }, 24 | }, 25 | // ...other configuration 26 | }; 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/elements/spinner.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Spinner" 3 | description: "An animated and pure CSS loading indicator" 4 | --- 5 | 6 | # Spinner 7 | 8 | The **siimple spinner** is a pure CSS loading indicator used for showing the loading state in your website or application. For creating a spinner, just add a `spinner` class to any `
` element: 9 | 10 | ```html live=true align=center 11 |
12 | ``` 13 | 14 | ### Customize 15 | 16 | You can customize the spinner element using the `spinners` field of your the configuration: styles defined in the `spinners.default` field will be applied to the base `spinner` element, and any other field will generate additional variant modifiers for the spinner element. 17 | 18 | ```js title=siimple.config.js 19 | export default { 20 | spinners: { 21 | default: { 22 | color: "primary", 23 | }, 24 | // Other spinner variants 25 | }, 26 | // ...other configuration 27 | }; 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/elements/switch.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Switch" 3 | description: "Form switch element" 4 | --- 5 | 6 | # Switch 7 | 8 | Using the `switch` class you can style your checkbox elements like a **switch element**. 9 | 10 | ```html live=true 11 | 15 | ``` 16 | 17 | By default, the switch will be displayed inactive, but you can add a **checked** attribute to the `` element for displaying the switch as actived. 18 | 19 | ```html live=true 20 | 24 | ``` 25 | 26 | ### Customize 27 | 28 | The switch element will apply the styles defined in the `forms.switch` field of your theme configuration. 29 | 30 | ```js title=siimple.config.js 31 | export default { 32 | forms: { 33 | switch: { 34 | color: "primary", 35 | }, 36 | }, 37 | // ...other configuration 38 | }; 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/elements/textarea.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Textarea" 3 | description: "A multiline text input element" 4 | --- 5 | 6 | # Textarea 7 | 8 | Add the `textarea` class to your ` 12 | ``` 13 | 14 | ### Customize 15 | 16 | The textarea element will apply the styles defined in the `forms.textarea` field of your theme configuration. 17 | 18 | ```js title=siimple.config.js 19 | export default { 20 | forms: { 21 | textarea: { 22 | backgroundColor: "muted", 23 | padding: "1rem", 24 | }, 25 | }, 26 | // ...other configuration 27 | }; 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/helpers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Helpers 3 | --- 4 | 5 | # Helpers 6 | 7 | **Helpers** are modifiers that can be applied to any HTML element to change their style. 8 | 9 | ### Disable helpers 10 | 11 | Individual helpers can be disabled providing an object in the `modules` field of your configuration with the name of the helper setted to `false`: 12 | 13 | ```js title=siimple.config.js 14 | export default { 15 | modules: { 16 | textColor: false, 17 | margin: false, 18 | padding: false, 19 | }, 20 | // ...other configuration 21 | }; 22 | ``` 23 | 24 | ### Usage 25 | 26 | Helpers modifiers have the following class pattern: 27 | 28 | ``` 29 | .has-- 30 | .is- 31 | ``` 32 | 33 | Some helpers modifiers, like colors and sizes, always use the `.has--` pattern. In this case, 34 | 35 | - `shortcut` is the CSS attribute. For example we will use `bg` for the `background-color` and `w` for the `width`. 36 | - `name` is the CSS value to apply. For example `full` usually will apply a `100%` value. 37 | 38 | Example: 39 | 40 | ```html 41 | 44 | ``` 45 | 46 | Other simple helpers modifiers will use the `.is-` pattern. Example: 47 | 48 | ```html 49 | Hello world! 50 | ``` 51 | 52 | ### Themeable helpers 53 | 54 | There are some helpers that are generated using the theme defined in your configuration file. For example, if you customize the `primary` color in your theme, the `has-bg-primary` helper will use the color that you have specified in your theme instead of the default color of the **siimple** theme. 55 | 56 | Also, additional colors provided in the `colors` scale will generate an additional helpers. For example, the following configuration: 57 | 58 | ```js title=siimple.config.js 59 | export default { 60 | colors: { 61 | info: "#1991a9", 62 | success: "#299956", 63 | warning: "#fbc850", 64 | error: "#e23636", 65 | // ...other default colors 66 | }, 67 | // ...other configuration 68 | }; 69 | ``` 70 | 71 | Will generate the following additional helpers: 72 | 73 | ```css 74 | .has-bg-info {background-color: #1991a9;} 75 | .has-bg-success {background-color: #299956;} 76 | .has-bg-warning {background-color: #fbc850;} 77 | .has-bg-error {background-color: #e23636;} 78 | ``` 79 | -------------------------------------------------------------------------------- /docs/helpers/colors.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Colors" 3 | --- 4 | 5 | # Colors 6 | 7 | A collection of helpers to customize the text and background color of any element. 8 | 9 | ### Customize colors helpers 10 | 11 | You can customize colors helpers using the `colors` field of your theme configuration: any value provided will generate additional color helpers. 12 | 13 | ```js title=siimple.config.js 14 | import colors from "@siimple/colors"; 15 | 16 | export default { 17 | colors: { 18 | primary: colors.blue["500"], 19 | secondary: colors.mint["500"], 20 | accent: colors.royal["600"], 21 | // ...other colors 22 | }, 23 | // ...other configuration 24 | }; 25 | ``` 26 | 27 | ### Background color 28 | 29 | Use `has-bg-{name}` to set the background color of any element. Background color helpers will be generated using the values provided in the `colors` field of your theme. 30 | 31 | The following background helpers will be always available, regardless the colors you provide in your theme configuration: 32 | 33 | | Class | Applied value | 34 | |-------|---------------| 35 | | `has-bg-primary` | Will use the color defined in `colors.primary`. | 36 | | `has-bg-secondary` | Will use the color defined in `colors.secondary`. | 37 | | `has-bg-muted` | Will use the color defined in `colors.muted`. | 38 | 39 | Example: 40 | 41 | ```html live=true align=center 42 |
43 | Button 44 |
45 | ``` 46 | 47 | #### Background color on hover 48 | 49 | You can change the background color of any element on hover adding the `-hover` suffix to the background color helper. 50 | 51 | ```html live=true align=center 52 |
53 | Hover me 54 |
55 | ``` 56 | 57 | ### Text color 58 | 59 | Use `has-text-{name}` to set the text color of any element. Text colors helpers will be generated using the values provided in the `colors` field of your theme. 60 | 61 | The following text helpers will be always available, regardless the colors you provide in your theme configuration: 62 | 63 | | Class | Applied value | 64 | |-------|---------------| 65 | | `has-text-primary` | Will use the color defined in `colors.primary`. | 66 | | `has-text-secondary` | Will use the color defined in `colors.secondary`. | 67 | | `has-text-muted` | Will use the color defined in `colors.muted`. | 68 | 69 | Example: 70 | 71 | ```html live=true align=center 72 | 73 | Lorem ipsum dolor sit amet, consectetur adipiscing elit... 74 | 75 | ``` 76 | 77 | #### Text color on hover 78 | 79 | You can change the text color of any element on hover adding the `-hover` suffix to the text color helper. 80 | 81 | ```html live=true align=center 82 | 83 | Hover me 84 | 85 | ``` 86 | -------------------------------------------------------------------------------- /docs/helpers/sizing.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Sizing" 3 | description: "Modify the width or the height of an element" 4 | --- 5 | 6 | # Sizing 7 | 8 | You can use the sizing helpers to set the width or height of any element. 9 | 10 | ### Customize sizing helpers 11 | 12 | The sizes that will be used to generate the sizing helpers can be defined in the `sizes` field of your theme. 13 | 14 | ```js title=siimple.config.js 15 | export default { 16 | sizes: { 17 | "0": "0px", 18 | "1": "0.25rem", 19 | "2": "0.5rem", 20 | "4": "1rem", 21 | // ...other sizes 22 | }, 23 | // ...other configuration 24 | }; 25 | ``` 26 | 27 | The following sizes will be always included for generating the sizing helpers, regardless the sizes you provide in your theme configuration: 28 | 29 | | Name | Value | Notes | 30 | |------|-------|-------| 31 | | `auto` | `auto` | | 32 | | `none` | `0px` | | 33 | | `half` | `50%` | | 34 | | `full` | `100%` | | 35 | | `screen` | `100vw` | Will be applied only on `width` helper. | 36 | | `screen` | `100vh` | Will be applied only on `height` helper. | 37 | 38 | ### Width 39 | 40 | Add any of the `has-w-{size}` classnames to modify the `width` property of the element. 41 | 42 | Use `has-w-auto` to let the browser to automatically calculate the width of the element: 43 | 44 | ```html 45 |
46 | ``` 47 | 48 | Use `has-w-screen` to fit the width of the screen: 49 | 50 | ```html 51 |
52 | ``` 53 | 54 | Use the other clasess to set a fixed width: 55 | 56 | ```html live=true centered=true color=white 57 |
58 | .has-w-64 59 |
60 | ``` 61 | 62 | ## Height 63 | 64 | Add any of the `has-h-{size}` classnames to modify the `height` property of the element. 65 | 66 | Use `has-h-auto` to let the browser to automatically calculate the height of the element: 67 | 68 | ```html 69 |
70 | ``` 71 | 72 | Use `has-h-screen` to fit the height of the screen: 73 | 74 | ```html 75 |
76 | ``` 77 | 78 | Use the other clasess to set a fixed height: 79 | 80 | ```html live=true centered=true color=white 81 |
82 | has-h-32 83 |
84 | ``` 85 | 86 | ### Responsive sizing 87 | 88 | You can control the sizing of an element at a specific breakpoint adding a `-{breakpoint}` suffix to the sizing class. 89 | 90 | ```html 91 |
92 | . . . 93 |
94 | ``` 95 | -------------------------------------------------------------------------------- /docs/helpers/spacing.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Spacing" 3 | --- 4 | 5 | # Spacing 6 | 7 | You can use the spacing helpers to set the margin or padding of any element. 8 | 9 | ### Customize spacing helpers 10 | 11 | The sizes that will be used to generate the spacing helpers can be defined in the `space` field of your theme. 12 | 13 | ```js title=siimple.config.js 14 | export default { 15 | space: { 16 | "0": "0px", 17 | "1": "0.25rem", 18 | "2": "0.5rem", 19 | "4": "1rem", 20 | // ...other sizes 21 | }, 22 | // ...other configuration 23 | }; 24 | ``` 25 | 26 | The following sizes will be always included for generating the spacing helpers, regardless the sizes you provide in your theme configuration: 27 | 28 | | Name | Value | 29 | |------|-------| 30 | | `auto` | `auto` | 31 | | `none` | `0px` | 32 | | `half` | `50%` | 33 | | `full` | `100%` | 34 | 35 | ### Uniform padding or margin 36 | 37 | Use `has-p-{size}` to set the **padding** of all sides of the element, or `has-m-{size}` to set the **margin** of all sizes of the element. 38 | 39 | ```html live=true centered=true color=white 40 |
41 | has-p-6 42 |
43 | ``` 44 | 45 | ### Directional padding or margin 46 | 47 | Use `has-p{direction}-{size}` or `has-m{direction}-{size}` to set the **padding or margin of one side** of the element. The following sides are available: 48 | 49 | | Direction | Description | 50 | |-----------|-------------| 51 | | **t** | To set the margin or padding **top**. | 52 | | **b** | To set the margin or padding **bottom**. | 53 | | **l** | To set the margin or padding **left**. | 54 | | **r** | To set the margin or padding **right**. | 55 | 56 | ```html live=true centered=true color=white padding=12 57 |
58 | has-pt-12 59 |
60 |
61 | has-pr-12 62 |
63 |
64 | has-pb-12 65 |
66 |
67 | has-pl-12 68 |
69 | ``` 70 | 71 | ### Centering elements 72 | 73 | Use `has-ml-auto` and `has-mr-auto` classnames to set the margin left and right to `auto`. This will center the block with a fixed width. 74 | 75 | ```html live=true color=white 76 |
77 | Centered 78 |
79 | ``` 80 | 81 | ### Responsive spacing 82 | 83 | You can control the spacing of an element at a specific breakpoint adding a `-{breakpoint}` suffix to the padding or margin class. 84 | 85 | ```html 86 |
87 | . . . 88 |
89 | ``` 90 | -------------------------------------------------------------------------------- /docs/naming.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Naming methodology" 3 | description: "Understanding how siimple classnames has been designed" 4 | --- 5 | 6 | # Naming methodology 7 | 8 | The **siimple** toolkit uses a simplified version of the [**SMACSS** methodology](http://smacss.com) for naming classnames, as described on this section. 9 | 10 | ### Elements 11 | 12 | We use the following syntax for naming **elements** in siimple: 13 | 14 | ``` 15 | . 16 | ``` 17 | 18 | - ``: is the elements prefix that can be customized in the `prefix` section of the configuration. The default prefix applied in **siimple** is an empty string. 19 | - `` is the element name, for example `button` or `card`. 20 | 21 | Example: 22 | 23 | ```html 24 |
...
25 | ``` 26 | 27 | ### Modifiers 28 | 29 | **Modifiers** are a collection of low-level classnames that can be used in any element to modify some CSS properties. Modifiers always follows this syntax: 30 | 31 | ``` 32 | .has-- 33 | .is- 34 | ``` 35 | 36 | Example: 37 | 38 | ```html 39 |
40 | ... 41 |
42 | ``` 43 | 44 | #### Responsive modifiers 45 | 46 | Some modifiers can be applied conditionally at different breakpoints, for building adaptative and responsive interfaces. Responsive modifiers uses the following syntax: 47 | 48 | ``` 49 | .has--- 50 | .is-- 51 | ``` 52 | 53 | Example: 54 | 55 | ```html 56 |
57 | ... 58 |
59 | ``` 60 | 61 | #### Status modifiers 62 | 63 | Similar to responsive modifiers, you can apply some modifiers only in response to an specific status of the element. The classnames syntax in this case is very similar to the responsive modifiers: 64 | 65 | ``` 66 | .has--- 67 | .is-- 68 | ``` 69 | 70 | ##### Hover status 71 | 72 | Use the `hover` status to apply the modifier only on hover: 73 | 74 | ```html live=true align=center 75 |
76 | Hoverable button 77 |
78 | ``` 79 | 80 | #### Variant modifiers 81 | 82 | **Variant modifiers** are special modifiers used to change the default style of an element. Variant modifiers always use the following syntax: 83 | 84 | ``` 85 | .is- 86 | ``` 87 | 88 | Some elements, like buttons or bages will generate a variant modifier class for each additional variant specified in your configuration. 89 | 90 | The following example shows how to use the `secondary` variant of a button: 91 | 92 | ```html 93 | 96 | ``` 97 | 98 | ### Actionable modifiers 99 | 100 | In some elements we use special modifiers to active it. The syntax for this type of modifiers is: 101 | 102 | ``` 103 | .with- 104 | ``` 105 | 106 | For example, for displaying the dropdown when the user movers the cursor over the dropdown parent element, you should add the `with-dropdown` class to the dropdown parent element: 107 | 108 | ```html 109 |
110 | 111 | 114 |
115 | ``` 116 | -------------------------------------------------------------------------------- /docs/packages/cli.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: CLI 3 | --- 4 | 5 | import Readme from "../../packages/cli/README.md"; 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/packages/colors.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Colors 3 | --- 4 | 5 | import Readme from "../../packages/colors/README.md"; 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/packages/core.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Core 3 | --- 4 | 5 | import Readme from "../../packages/core/README.md"; 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/packages/icons.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Icons 3 | --- 4 | 5 | import Readme from "../../packages/icons/README.md"; 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/packages/modules.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Modules 3 | --- 4 | 5 | import Readme from "../../packages/modules/README.md"; 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/packages/postcss.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: PostCSS 3 | --- 4 | 5 | import Readme from "../../packages/postcss/README.md"; 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/packages/presets.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Presets 3 | --- 4 | 5 | import Readme from "../../packages/presets/README.md"; 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/packages/standalone.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Standalone 3 | --- 4 | 5 | import Readme from "../../packages/standalone/README.md"; 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/presets/base.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Preset base 3 | --- 4 | 5 | import Readme from "../../packages/preset-base/README.md"; 6 | 7 | 8 | 9 | ## Demo 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/presets/dark.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Preset dark 3 | --- 4 | 5 | import Readme from "../../packages/preset-dark/README.md"; 6 | 7 | 8 | 9 | ## Demo 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/presets/ice.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Preset ice 3 | --- 4 | 5 | import Readme from "../../packages/preset-ice/README.md"; 6 | 7 | 8 | 9 | ## Demo 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/presets/mustard.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Preset Mustard 3 | --- 4 | 5 | import Readme from "../../packages/preset-mustard/README.md"; 6 | 7 | 8 | 9 | ## Demo 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/presets/noir.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Preset Noir 3 | --- 4 | 5 | import Readme from "../../packages/preset-noir/README.md"; 6 | 7 | 8 | 9 | ## Demo 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/reset.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Reset 3 | --- 4 | 5 | # Reset 6 | 7 | This module provides a collection of CSS selections for reducing browser inconsistencies in things like default margin and padding of `` element, margins of `

` elements, and so on. 8 | 9 | 10 | ### Disable reset module 11 | 12 | The reset module can be disabled providing an object in the `modules` field of your configuration with the `reset` key setted to `false`: 13 | 14 | ```js title=siimple.config.js 15 | export default { 16 | modules: { 17 | reset: false, 18 | }, 19 | // ...other configuration 20 | }; 21 | ``` 22 | 23 | -------------------------------------------------------------------------------- /docs/responsive.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Responsive" 3 | description: "Understanding the responsive design of siimple" 4 | --- 5 | 6 | # Responsive 7 | 8 | The **siimple** toolkit has been designed to be fully responsive, so you can design an fully adaptative user interface. 9 | 10 | Some helpers and elements modifiers can be conditionally applied at different breakpoints, so you can customize how the user interface will be presented on different screen sizes. 11 | 12 | By default, we provide three screen breakpoints: 13 | 14 | | Prefix | Description | CSS media query | 15 | |--------|-------------|-----------------| 16 | | mobile | Applied to screen sizes up to `639px`. | `@media (max-width: 639px)` | 17 | | tablet | Applied to screen sizes from `640px`. | `@media (min-width: 640px)` | 18 | | desktop | Applied to screen sizes from `1264px`. | `@media (min-width: 1264px)` | 19 | 20 | 21 | The following example uses these responsive variants to customize how the card will be displayed for different screen sizes: 22 | 23 | ```html live=true bg=blue-200 24 |

25 |
26 | 27 |
28 |
29 |

Hello world!

30 |

31 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor 32 | incididunt ut labore et dolore magna aliqua. 33 |

34 |
35 |
36 | ``` 37 | -------------------------------------------------------------------------------- /examples/_template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Example 7 | 8 | 9 |
10 | 11 |
12 |

Simple 3 columns with link

13 |
14 |
15 | 16 |
17 | 18 | -------------------------------------------------------------------------------- /examples/navbar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Navbar Example 10 | 11 | 12 |
13 | 14 | 15 |
16 |

Dark navbar with action button on right

17 |
18 |
19 | 20 | 21 | 22 | Navbar 23 | 24 | 25 | 26 | 27 | 38 |
39 |
40 | 41 |
42 | 43 | -------------------------------------------------------------------------------- /examples/sign-in.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Sign-in Example 10 | 11 | 12 |
13 |
14 |
15 |

Sign in

16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 |
24 | 28 |
29 | 34 |
35 |
36 | 37 | -------------------------------------------------------------------------------- /examples/tabs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Tabs Example 10 | 11 | 12 |
13 | 14 | 15 |
16 |

Pill tabs

17 |
18 |
19 | Tab 1 20 | Tab 2 21 | Tab 3 22 |
23 |
24 | 25 | 26 |
27 |

Pill tabs with counter badges

28 |
29 | 40 |
41 | 42 | 43 |
44 |

Pill tabs with background

45 |
46 |
47 | Tab 1 48 | Tab 2 49 | Tab 3 50 |
51 |
52 | 53 | 54 |
55 |

Pill tabs with dark background

56 |
57 |
58 | Tab 1 59 | Tab 2 60 | Tab 3 61 |
62 |
63 | 64 |
65 | 66 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | import autoprefixer from "autoprefixer"; 2 | import gulp from "gulp"; 3 | import postcss from "gulp-postcss"; 4 | import rename from "gulp-rename"; 5 | import CleanCSS from "clean-css"; 6 | import through from "through2"; 7 | 8 | import {css} from "@siimple/core"; 9 | import {injectModules} from "@siimple/modules"; 10 | 11 | // Build Siimple 12 | const siimple = () => { 13 | return through.obj((file, enc, callback) => { 14 | import(file.path).then(rawConfig => { 15 | const result = css(injectModules(rawConfig.default)); 16 | file.contents = new Buffer.from(result); 17 | callback(null, file); 18 | }); 19 | }); 20 | }; 21 | 22 | // Minify CSS 23 | const minify = options => { 24 | return through.obj((file, enc, callback) => { 25 | const content = file.contents.toString() || ""; 26 | new CleanCSS(options).minify(content, (errors, result) => { 27 | if (errors) { 28 | return callback(errors.join(" ")); 29 | } 30 | file.contents = new Buffer.from(result.styles); 31 | return callback(null, file); 32 | }); 33 | }); 34 | }; 35 | 36 | const generateSvgSprite = () => { 37 | const attrs = `stroke-linecap="round" stroke-linejoin="round" stroke-width="2" fill="none"`; 38 | return through.obj((file, _, callback) => { 39 | import(file.path).then(rawIcons => { 40 | const content = Object.keys(rawIcons.default).map(name => { 41 | const p = rawIcons.default[name].path; 42 | return ``; 43 | }); 44 | content.unshift(``); 45 | content.push(``); 46 | file.contents = new Buffer.from(content.join("")); 47 | callback(null, file); 48 | }); 49 | }); 50 | }; 51 | 52 | gulp.task("clean", () => null); 53 | 54 | gulp.task("icons:sprite", () => { 55 | return gulp.src("packages/icons/index.js", {base: "./"}) 56 | .pipe(generateSvgSprite()) 57 | .pipe(rename("siimple-icons.svg")) 58 | .pipe(gulp.dest("siimple-icons/")); 59 | }); 60 | 61 | gulp.task("css", () => { 62 | return gulp.src("siimple*/siimple.config.js", {base: "./"}) 63 | .pipe(siimple()) 64 | .pipe(postcss([autoprefixer()])) 65 | .pipe(minify({ 66 | "compatibility": "*", 67 | "level": 2, 68 | })) 69 | .pipe(rename(currentPath => ({ 70 | dirname: currentPath.dirname, 71 | basename: currentPath.dirname, 72 | extname: ".css", 73 | }))) 74 | .pipe(gulp.dest(".")) 75 | }); 76 | -------------------------------------------------------------------------------- /header.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 17 | 18 | 20 | image/svg+xml 21 | 23 | 24 | 25 | 26 | 29 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /jest.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | clearMocks: true, 3 | testEnvironment: "node", 4 | }; 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "siimple-repo", 3 | "version": "4.3.1", 4 | "private": true, 5 | "description": "A minimal and themeable CSS toolkit for flat and clean designs.", 6 | "author": "Josemi Juanes ", 7 | "type": "module", 8 | "license": "MIT", 9 | "homepage": "https://www.siimple.xyz/", 10 | "repository": "https://github.com/jmjuanes/siimple", 11 | "bugs": "https://github.com/jmjuanes/siimple/issues", 12 | "workspaces": [ 13 | "packages/*", 14 | "playground", 15 | "website" 16 | ], 17 | "scripts": { 18 | "build": "yarn run build:css && yarn run build:icons", 19 | "build:css": "gulp css", 20 | "build:icons": "gulp icons:sprite", 21 | "build:docs": "cross-env DOCS_ONLY=true yarn workspace siimple-website build", 22 | "build:playground": "cross-env PLAYGROUND_ONLY=true yarn workspace siimple-playground build", 23 | "build:website": "yarn workspace siimple-website build && yarn workspace siimple-playground build && yarn copy-assets", 24 | "copy-assets": "node copy-assets.cjs", 25 | "serve": "yarn start:website", 26 | "start:website": "stattic --folder ./public --port 5000", 27 | "start:docs": "cross-env DOCS_ONLY=true yarn workspace siimple-website serve", 28 | "start:playground": "stattic --folder ./playground/public --port 5000", 29 | "test": "jest" 30 | }, 31 | "devDependencies": { 32 | "@babel/core": "^7.18.13", 33 | "@babel/plugin-transform-runtime": "^7.18.10", 34 | "@babel/preset-env": "^7.18.10", 35 | "autoprefixer": "^10.3.5", 36 | "babel-jest": "^29.0.1", 37 | "clean-css": "^5.2.4", 38 | "cross-env": "^7.0.3", 39 | "gulp": "^4.0.2", 40 | "gulp-cli": "^2.3.0", 41 | "gulp-postcss": "^9.0.1", 42 | "gulp-rename": "^2.0.0", 43 | "jest": "^29.0.1", 44 | "jest-environment-jsdom": "^29.0.1", 45 | "postcss": "^8.4.14", 46 | "stattic": "^0.4.0" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/cli/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/cli 2 | 3 | The **siimple** command line. 4 | 5 | > This package is included in the main `siimple` package and a separate installation is not required. 6 | 7 | ## Installation 8 | 9 | Add this package to your project using **npm**: 10 | 11 | ```bash 12 | $ npm install --save @siimple/cli 13 | ``` 14 | 15 | Note that **Node.js version >=14** is required for running the CLI tool. 16 | 17 | ## Usage 18 | 19 | The easiest way is using `npx` for running the **siimple** CLI tool: 20 | 21 | ```bash 22 | $ npx siimple -c siimple.config.js -o siimple.css 23 | ``` 24 | 25 | Instead of using `npx`, you can drop it inside of an `npm run` script in your `package.json` file: 26 | 27 | ```json title=package.json 28 | { 29 | "name": "my-project", 30 | "version": "1.0.0", 31 | "type": "module", 32 | "scripts": { 33 | "build-siimple": "siimple -c siimple.config.js -o siimple.css" 34 | }, 35 | // ...other package.json content 36 | } 37 | ``` 38 | 39 | Or you can directly execute it using the relative path to the executable file instead: 40 | 41 | ```bash 42 | $ ./node_modules/.bin/siimple -c siimple.config.js -o siimple.css 43 | ``` 44 | 45 | ## Generate your CSS 46 | 47 | Create a file called `siimple.config.js` with your configuration, and print the output CSS **to stdout**: 48 | 49 | ```bash 50 | $ npx siimple -c siimple.config.js 51 | ``` 52 | 53 | If you would like to save the generated CSS **to a file**, use the `-o` option instead with the path of the output `.css` file: 54 | 55 | ```bash 56 | $ npx siimple -c siimple.config.js -o siimple.css 57 | ``` 58 | 59 | > **Note**: **siimple** uses ECMAScript modules, so you will need to set `"type": "module"` in your `package.json` file or use `.mjs` as the extension for your configuration file (`siimple.config.mjs`). 60 | 61 | ## License 62 | 63 | [MIT License](https://github.com/jmjuanes/siimple/blob/main/LICENSE). 64 | -------------------------------------------------------------------------------- /packages/cli/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | import fs from "node:fs"; 4 | import path from "node:path"; 5 | import url from "node:url"; 6 | import {css} from "@siimple/core"; 7 | import {injectModules} from "@siimple/modules"; 8 | 9 | // Get CLI arguments 10 | const getArguments = () => { 11 | const args = process.argv.slice(2); 12 | const configIndex = args.indexOf("-c"); 13 | const outputIndex = args.indexOf("-o"); 14 | return { 15 | config: configIndex > -1 && args[configIndex + 1] ? args[configIndex + 1] : null, 16 | output: outputIndex > -1 && args[outputIndex + 1] ? args[outputIndex + 1] : null, 17 | }; 18 | }; 19 | 20 | // Resolve configuration 21 | const resolveConfig = configPath => { 22 | return import(url.pathToFileURL(configPath)).then(rawConfig => rawConfig.default); 23 | }; 24 | 25 | // Generate siimple CSS 26 | process.nextTick(() => { 27 | const args = getArguments(); 28 | if (!args.config) { 29 | console.error("No input configuration provided. Use the '-c' option."); 30 | return process.exit(1); 31 | } 32 | const configPath = path.resolve(process.cwd(), args.config); 33 | if (!fs.existsSync(configPath)) { 34 | console.error(`Configuration file '${configPath}' does not exist.`); 35 | return process.exit(1); 36 | } 37 | // Import configuration 38 | return resolveConfig(configPath).then(config => { 39 | return css(injectModules(config)); 40 | }).then(result => { 41 | // Print file in stdout 42 | if (!args.output) { 43 | return process.stdout.write(result); 44 | } 45 | // Save to file 46 | const outputPath = path.resolve(process.cwd(), args.output); 47 | fs.writeFileSync(outputPath, result, "utf8"); 48 | }).catch(error => { 49 | console.error(error); 50 | process.exit(1); 51 | }); 52 | }); 53 | -------------------------------------------------------------------------------- /packages/cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/cli", 3 | "version": "0.3.1", 4 | "description": "Command Line for siimple", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz", 11 | "bin": { 12 | "siimple": "./index.js" 13 | }, 14 | "dependencies": { 15 | "@siimple/core": "^0.3.1", 16 | "@siimple/modules": "^0.3.1" 17 | }, 18 | "keywords": [ 19 | "siimple", 20 | "cli" 21 | ], 22 | "files": [ 23 | "index.js", 24 | "README.md" 25 | ], 26 | "engines": { 27 | "node": ">=14" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/colors/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/colors 2 | 3 | A color palette for the **siimple CSS toolkit**. 4 | 5 | ## Install 6 | 7 | Install this module using **npm**: 8 | 9 | ```bash 10 | $ npm install --save @siimple/colors 11 | ``` 12 | 13 | ## Usage 14 | 15 | You can use the colors exported by this module in your `siimple.config.js` file, for example to generate your colors scale: 16 | 17 | ```js 18 | import colors from "@siimple/colors"; 19 | 20 | export default { 21 | colors: { 22 | text: colors.gray["700"], 23 | background: colors.gray["100"], 24 | primary: colors.mint["600"], 25 | }, 26 | // ...other configuration 27 | }; 28 | ``` 29 | 30 | Check out the [full list of available colors](https://www.siimple.xyz/colors). 31 | 32 | ## License 33 | 34 | [MIT License](https://github.com/jmjuanes/siimple/blob/main/LICENSE). 35 | -------------------------------------------------------------------------------- /packages/colors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/colors", 3 | "version": "0.3.1", 4 | "description": "A color palette for the siimple css toolkit", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "keywords": [ 14 | "siimple", 15 | "colors" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /packages/core/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/core 2 | 3 | The core engine of the **siimple CSS toolkit**, that can be used for building your own themeable CSS framework. 4 | 5 | ## Install 6 | 7 | Install this package using **npm**: 8 | 9 | ```bash 10 | $ npm install --save @siimple/core 11 | ``` 12 | 13 | ## API 14 | 15 | ### css(config) 16 | 17 | Given a [configuration object](https://www.siimple.xyz/configuration), this method will generate a CSS string with the parsed styles in `config.styles` and using the provided theme in the configuration object. 18 | 19 | ```js 20 | import {css} from "@siimple/core"; 21 | 22 | const result = css({ 23 | useBorderBox: false, 24 | useRootStyles: false, 25 | colors: { 26 | primary: "#34dde5", 27 | }, 28 | styles: { 29 | button: { 30 | backgroundColor: "primary", 31 | color: "white", 32 | p: "2rem", 33 | }, 34 | }, 35 | }); 36 | ``` 37 | 38 | This will generate the following CSS string: 39 | 40 | ```css 41 | button { 42 | background-color: #34dde5; 43 | color: white; 44 | padding: 2rem; 45 | } 46 | ``` 47 | 48 | ### mergeStyles(source, target) 49 | 50 | Performs a **deep merge** of the styles defined in the `target` object into the `source` object, and returns the merged styles object. 51 | 52 | ```js 53 | import {mergeStyles} from "@siimple/core"; 54 | 55 | const sourceStyles = { 56 | ".button": { 57 | backgroundColor: "primary", 58 | color: "white", 59 | padding: "1.5rem", 60 | "&:hover": { 61 | backgroundColor: "secondary", 62 | }, 63 | }, 64 | }; 65 | 66 | const mergedStyles = mergeStyles(sourceStyles, { 67 | ".button": { 68 | borderRadius: "0.5rem", 69 | "&:hover": { 70 | backgroundColor: "inherit", 71 | opacity: "0.5", 72 | }, 73 | }, 74 | }); 75 | ``` 76 | 77 | In the previous example the merged styles will be: 78 | 79 | ```js 80 | mergedStyles = { 81 | ".button": { 82 | backgroundColor: "primary", 83 | borderRadius: "0.5rem", 84 | color: "white", 85 | padding: "1.5rem", 86 | "&:hover": { 87 | backgroundColor: "inherit", 88 | opacity: "0.5", 89 | }, 90 | }, 91 | }; 92 | ``` 93 | 94 | ### mergeConfig(source, target) 95 | 96 | This function will return a new configuration object as a result of performing a **deep merge** of the `target` configuration object into `source`. 97 | 98 | ```js 99 | import {mergeConfig} from "@siimple/core"; 100 | 101 | const config = mergeConfig({ /* source */}, {/* target */}); 102 | ``` 103 | 104 | 105 | ## License 106 | 107 | [MIT License](https://github.com/jmjuanes/siimple/blob/main/LICENSE). 108 | -------------------------------------------------------------------------------- /packages/core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/core", 3 | "version": "0.3.1", 4 | "description": "Core module of the siimple css toolkit", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "keywords": [ 14 | "siimple" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/icons/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/icons 2 | 3 | Siimple icons in JSON format. 4 | 5 | ## Installation 6 | 7 | Use **npm** or **yarn** for adding this package to your project: 8 | 9 | ```bash 10 | $ yarn add @siimple/icons 11 | ``` 12 | 13 | ## Usage 14 | 15 | This package export all icons as a JavaScript object. The icon ID is the key, and as a value that is an object with the following properties: 16 | 17 | - `path`: the icon SVG path in string format. 18 | - `category`: the category which the icon belongs to (for example `arrows` or `interfaces`). 19 | 20 | Example: 21 | 22 | ```json 23 | { 24 | "arrow-right": { 25 | "category": "arrows", 26 | "path": "...", 27 | }, 28 | // ... 29 | } 30 | ``` 31 | 32 | All icons have a size of 24x24 pixels and a padding of 2 pixels. 33 | 34 | # License 35 | 36 | [MIT License](https://github.com/jmjuanes/siimple/blob/main/LICENSE). 37 | -------------------------------------------------------------------------------- /packages/icons/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/icons", 3 | "version": "0.3.1", 4 | "description": "Siimple icons in JSON format.", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz/icons", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "keywords": [ 14 | "siimple", 15 | "icons" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /packages/modules/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/modules 2 | 3 | Core modules for the **siimple CSS toolkit**. 4 | 5 | > This package is included in the main `siimple` package and a separate installation is not required. 6 | 7 | 8 | ## Install 9 | 10 | ```bash 11 | $ npm install --save @siimple/modules 12 | ``` 13 | 14 | ## Usage 15 | 16 | > This module is already integrated in the build process of the `siimple` main package, so you do not need to use the `injectModules` function. 17 | 18 | You can use the `injectModules` function to inject core modules in your configuration, using the `modules` field of your configuration object: 19 | 20 | ```js 21 | import {css} from "@siimple/core"; 22 | import {injectModules} from "@siimple/modules"; 23 | 24 | const result = css(injectModules({ 25 | modules: [ 26 | "button", 27 | "markup", 28 | "reset", 29 | ], 30 | // ...other configuration 31 | })); 32 | ``` 33 | 34 | ## API 35 | 36 | ### injectModules(config) 37 | 38 | Returns a new configuration object with the styles of the modules specified in the `config.modules` field of the provided configuration. The following values for the `config.modules` field are allowed: 39 | 40 | - **Array of strings**, to specify **only the module's styles** that will be injected in the configuration. 41 | - **Object** where the keys are the modules names and the values have a falsy value, to specify the modules that will be skipped. 42 | - **A falsy value** (for example `false` or `null`), to skip all modules. 43 | 44 | ### createHelper(options) 45 | 46 | Use this function to create new custom helpers. The `options` argument is an object with the configuration of the helper. 47 | 48 | Example: 49 | 50 | ```js 51 | import {css} from "@siimple/core"; 52 | import {createHelper} from "@siimple/modules"; 53 | 54 | const result = css({ 55 | // ...other configuration 56 | styles: { 57 | ...createHelper({ 58 | prefix: "is", 59 | states: ["default"], 60 | responsive: false, 61 | properties: ["textDecoration"], 62 | values: { 63 | "underlined": "underline", 64 | "not-underlined": ["none", "!important"], 65 | }, 66 | }), 67 | // ...other styles 68 | }, 69 | }); 70 | 71 | // Will generate the following styles: 72 | // .is-underlined {text-decoration: underline;} 73 | // .is-not-underlined {text-decoration: none !important;} 74 | ``` 75 | 76 | The `options` object accepts the following keys: 77 | 78 | - `prefix`: prefix for the helper, for example `is` or `has`. Default is an empty string `""`. This field is required if no shortcut is specified. 79 | - `shortcut`: shortcut name of the helper, for example you can use `m` as a shortcut for `margin` helpers. Required if no prefix are specified. 80 | - `states`: an array for generating additional helpers to match states like hovering or focus. Allowed values in the array: `"default"`, `"hover"` and `"focus"`. 81 | - `responsive`: a boolean to generate also responsive helpers based on the breakpoints specified in the configuration. Default is `false`. 82 | - `properties`: a list of CSS properties for the helper. 83 | - `values`: an object list of values to assign to the list of properties. The object key will be used as the helper name, and the value will be used as the CSS property value. 84 | 85 | 86 | ## License 87 | 88 | [MIT License](https://github.com/jmjuanes/siimple/blob/main/LICENSE). 89 | -------------------------------------------------------------------------------- /packages/modules/markup.js: -------------------------------------------------------------------------------- 1 | export const markup = { 2 | p: { 3 | fontWeight: "body", 4 | lineHeight: "body", 5 | marginBottom: "1rem", 6 | marginTop: "0px", 7 | apply: "text.paragraph", 8 | }, 9 | a: { 10 | color: "primary", 11 | apply: "text.link", 12 | }, 13 | small: { 14 | fontSize: "0", 15 | apply: "text.small", 16 | }, 17 | strong: { 18 | fontWeight: "700", 19 | apply: "text.strong", 20 | }, 21 | b: { 22 | fontWeight: "700", 23 | apply: "text.strong", 24 | }, 25 | pre: { 26 | fontFamily: "code", 27 | overflowX: "auto", 28 | }, 29 | code: { 30 | color: "primary", 31 | fontFamily: "code", 32 | fontSize: "0", 33 | fontWeight: "700", 34 | textDecoration: "none", 35 | apply: "text.code", 36 | }, 37 | hr: { 38 | backgroundColor: "muted", 39 | border: "0px", 40 | display: "block", 41 | height: "0.125rem", 42 | padding: "0px", 43 | "&:not(:first-child)": { 44 | marginTop: "1rem", 45 | }, 46 | "&:not(:last-child)": { 47 | marginBottom: "1rem", 48 | }, 49 | }, 50 | blockquote: { 51 | borderLeft: ["0.25rem", "solid", "currentColor"], 52 | color: "currentColor", 53 | display: "block", 54 | marginBottom: "1rem", 55 | marginLeft: "0px", 56 | marginRight: "0px", 57 | opacity: "0.6", 58 | paddingBottom: "0.75rem", 59 | paddingLeft: "1.25rem", 60 | paddingRight: "0.75rem", 61 | paddingTop: "0.75rem", 62 | }, 63 | table: { 64 | backgroundColor: "transparent", 65 | borderCollapse: "separate", 66 | borderSpacing: "0", 67 | borderWidth: "0px", 68 | boxSizing: "border-box", 69 | display: "table", 70 | marginBottom: "2rem", 71 | width: "100%", 72 | "& tr": { 73 | boxSizing: "border-box", 74 | display: "table-row", 75 | }, 76 | "& th,& td": { 77 | boxSizing: "border-box", 78 | display: "table-cell", 79 | lineHeight: "inherit", 80 | padding: "1rem", 81 | }, 82 | "& thead": { 83 | boxSizing: "border-box", 84 | display: "table-header-group", 85 | }, 86 | "& thead th": { 87 | borderBottomColor: "muted", 88 | borderBottomStyle: "solid", 89 | borderBottomWidth: "0.125rem", 90 | fontWeight: "bold", 91 | textAlign: "left", 92 | verticalAlign: "bottom", 93 | }, 94 | "& tbody": { 95 | display: "table-row-group", 96 | verticalAlign: "middle", 97 | }, 98 | "& tbody td": { 99 | borderTopColor: "muted", 100 | borderTopStyle: "solid", 101 | borderTopWidth: "0.125rem", 102 | verticalAlign: "top", 103 | }, 104 | }, 105 | ...Object.fromEntries([6,5,4,3,2,1].map(index => { 106 | const headingNumber = 7 - index; 107 | const headingConfig = { 108 | color: "heading", 109 | display: "block", 110 | fontFamily: "heading", 111 | fontSize: `${index}`, 112 | fontWeight: "heading", 113 | lineHeight: "heading", 114 | marginBottom: "0.5rem", 115 | padding: "0px", 116 | apply: "text.heading", 117 | }; 118 | return [`h${(headingNumber)}`, headingConfig]; 119 | })), 120 | }; 121 | -------------------------------------------------------------------------------- /packages/modules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/modules", 3 | "version": "0.3.1", 4 | "description": "Core modules for the siimple css toolkit", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz", 11 | "main": "index.js", 12 | "exports": { 13 | ".": "./index.js", 14 | "./elements": "./elements.js", 15 | "./markup": "./markup.js", 16 | "./helpers": "./helpers.js", 17 | "./reset": "./reset.js" 18 | }, 19 | "keywords": [ 20 | "siimple", 21 | "modules", 22 | "core" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /packages/modules/reset.js: -------------------------------------------------------------------------------- 1 | const applySameStyles = (items, styles) => Object.fromEntries(items.map(key => ([key, styles]))); 2 | 3 | export const reset = { 4 | // Reset box sizing of all elements 5 | // *, 6 | // *:before, 7 | // *:after { 8 | // box-sizing: border-box; 9 | // } 10 | // Set default html style 11 | html: { 12 | // boxSizing: "border-box", 13 | scrollBehavior: "smooth", 14 | }, 15 | // Set default body style 16 | body: { 17 | margin: "0", 18 | padding: "0", 19 | minHeight: "100vh", 20 | textRendering: "optimizeLegibility", 21 | "-webkit-font-smoothing": "antialiased", 22 | "-moz-osx-font-smoothing": "grayscale", 23 | }, 24 | // Reset margins on lists 25 | ...applySameStyles(["ul", "ol", "dl"], { 26 | marginBottom: "1rem", 27 | marginTop: "0", 28 | }), 29 | // Reset margins on paragraphs 30 | p: { 31 | marginBottom: "1rem", 32 | marginTop: "0", 33 | }, 34 | // Fix bold weight (in firefox) 35 | ...applySameStyles(["strong", "b"], { 36 | fontWeight: "bold", 37 | }), 38 | // Make images and videos responsive by default 39 | ...applySameStyles(["img", "video"], { 40 | display: "block", 41 | height: "auto", 42 | maxWidth: "100%", 43 | }), 44 | // Remove border from iframe 45 | iframe: { 46 | border: "0", 47 | }, 48 | // Reset table border 49 | table: { 50 | borderCollapse: "collapse", 51 | borderSpacing: "0", 52 | }, 53 | // td, 54 | // th { 55 | // padding: 0; 56 | // } 57 | // Reset headings 58 | ...applySameStyles(["h1", "h2", "h3", "h4", "h5", "h6"], { 59 | // marginTop: "0px", 60 | marginBottom: "0.5rem", 61 | }), 62 | }; 63 | -------------------------------------------------------------------------------- /packages/postcss/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/postcss 2 | 3 | Integrate **siimple** in your PostCSS build process using our plugin for PostCSS. 4 | 5 | ## Installation 6 | 7 | Add this package to your project using **npm**: 8 | 9 | ```bash 10 | $ npm install --save @siimple/postcss 11 | ``` 12 | 13 | Note that **Node.js >=14** and **postcss-cli >=10** are required. 14 | 15 | ## Usage 16 | 17 | In your `postcss.config.js`, include the plugin of **siimple** for PostCSS with the path to your `siimple.config.js` (or `siimple.config.mjs` if you are not in an ESM env): 18 | 19 | ```js 20 | import autoprefixer from "autoprefixer"; 21 | import siimple from "@siimple/postcss"; 22 | 23 | export default { 24 | plugins: [ 25 | siimple("./siimple.config.js"), 26 | autoprefixer(), 27 | // other plugins 28 | ], 29 | }; 30 | ``` 31 | 32 | ## License 33 | 34 | [MIT License](https://github.com/jmjuanes/siimple/blob/main/LICENSE). 35 | -------------------------------------------------------------------------------- /packages/postcss/index.js: -------------------------------------------------------------------------------- 1 | import path from "node:path"; 2 | import postcss from "postcss"; 3 | import {css} from "@siimple/core"; 4 | import {injectModules} from "@siimple/modules"; 5 | 6 | const resolveConfig = configOrPath => { 7 | if (configOrPath) { 8 | // if (typeof configOrPath === "string" && fs.existsSync(configOrPath)) { 9 | if (typeof configOrPath === "string") { 10 | const configPath = path.resolve(process.cwd(), configOrPath); 11 | return import(configPath).then(config => config.default); 12 | } 13 | else if (typeof configOrPath === "object") { 14 | return Promise.resolve(configOrPath); 15 | } 16 | } 17 | return Promise.resolve({}); // No configuration provided 18 | }; 19 | 20 | export default configOrPath => ({ 21 | postcssPlugin: "siimple", 22 | plugins: [ 23 | root => { 24 | return resolveConfig(configOrPath) 25 | .then(config => css(injectModules(config))) 26 | .then(styles => root.append(postcss.parse(styles))); 27 | }, 28 | ], 29 | }); 30 | -------------------------------------------------------------------------------- /packages/postcss/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/postcss", 3 | "version": "0.3.1", 4 | "description": "PostCSS plugin for siimple.", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "dependencies": { 14 | "@siimple/core": "^0.3.1", 15 | "@siimple/modules": "^0.3.1" 16 | }, 17 | "peerDependencies": { 18 | "postcss": ">=8.4.0", 19 | "postcss-cli": ">=10.0.0" 20 | }, 21 | "keywords": [ 22 | "siimple", 23 | "postcss" 24 | ], 25 | "files": [ 26 | "index.cjs", 27 | "README.md" 28 | ], 29 | "engines": { 30 | "node": ">=14" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/preset-base/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/preset-base 2 | 3 | Default theme preset for the **siimple CSS toolkit**. 4 | 5 | ## Install 6 | 7 | Install this package using **npm**: 8 | 9 | ```bash 10 | $ npm install --save @siimple/preset-base 11 | ``` 12 | 13 | ## Usage 14 | 15 | Use the base theme in your `siimple.config.js` file: 16 | 17 | ```js 18 | import base from "@siimple/preset-base"; 19 | 20 | export default { 21 | // Import all default scales, breakpoints and root styles 22 | ...base, 23 | // Extend default theme scales 24 | colors: { 25 | ...base.colors, 26 | text: "#000", 27 | }, 28 | // ...other configuration 29 | }; 30 | ``` 31 | -------------------------------------------------------------------------------- /packages/preset-base/index.js: -------------------------------------------------------------------------------- 1 | import colors from "@siimple/colors"; 2 | 3 | export const fonts = { 4 | sans: [ 5 | "-apple-system", 6 | "BlinkMacSystemFont", 7 | "'Segoe UI'", 8 | "Roboto", 9 | "'Helvetica Neue'", 10 | "Arial", 11 | "sans-serif", 12 | ].join(", "), 13 | serif: [ 14 | "Georgia", 15 | "Cambria", 16 | "'Times New Roman'", 17 | "Times", 18 | "serif", 19 | ].join(", "), 20 | monospace: [ 21 | "SFMono-Regular", 22 | "Menlo", 23 | "Monaco", 24 | "Consolas", 25 | "'Liberation Mono'", 26 | "'Courier New'", 27 | "monospace", 28 | ].join(", "), 29 | }; 30 | 31 | export const screens = { 32 | tablet: "640px", 33 | desktop: "1264px", 34 | widescreen: "1504px", 35 | }; 36 | 37 | export const sizes = { 38 | "0": "0px", 39 | "4": "1rem", 40 | "8": "2rem", 41 | "12": "3rem", 42 | "16": "4rem", 43 | "24": "6rem", 44 | "32": "8rem", 45 | "48": "12rem", 46 | "64": "16rem", 47 | "96": "24rem", 48 | "192": "48rem", 49 | }; 50 | 51 | export const space = { 52 | "0": "0px", 53 | "1": "0.25rem", 54 | "2": "0.5rem", 55 | "3": "0.75rem", 56 | "4": "1rem", 57 | "6": "1.5rem", 58 | "8": "2rem", 59 | "12": "3rem", 60 | "16": "4rem", 61 | "24": "6rem", 62 | }; 63 | 64 | export default { 65 | meta: { 66 | name: "base", 67 | fonts: [], 68 | }, 69 | breakpoints: { 70 | mobile: { 71 | max: screens.tablet, 72 | }, 73 | tablet: { 74 | min: screens.tablet, 75 | }, 76 | desktop: { 77 | min: screens.desktop, 78 | }, 79 | }, 80 | colors: { 81 | primary: colors.blue["500"], 82 | secondary: colors.royal["500"], 83 | highlight: colors.blue["200"], 84 | muted: colors.gray["200"], 85 | text: colors.gray["700"], 86 | heading: colors.gray["800"], 87 | background: "#fff", 88 | dark: colors.gray["800"], 89 | light: colors.gray["100"], 90 | white: "#fff", 91 | }, 92 | fonts: { 93 | body: fonts.sans, 94 | heading: "inherit", 95 | code: fonts.monospace, 96 | }, 97 | fontSizes: [ 98 | "0.875rem", // 0 99 | "16px", // 1 100 | "1.25rem", // 2 101 | "1.5rem", // 3 102 | "1.75rem", // 4 103 | "2rem", // 5 104 | "2.5rem", // 6 105 | "3rem", 106 | "3.5rem", 107 | "4rem", 108 | "4.5rem", 109 | ], 110 | fontWeights: { 111 | body: "400", 112 | heading: "700", 113 | }, 114 | lineHeights: { 115 | heading: "1.25", 116 | body: "1.5", 117 | }, 118 | sizes: sizes, 119 | space: space, 120 | // Default root styles 121 | root: { 122 | backgroundColor: "background", 123 | color: "text", 124 | fontFamily: "body", 125 | fontSize: "1", 126 | fontWeight: "body", 127 | lineHeight: "body", 128 | }, 129 | }; 130 | -------------------------------------------------------------------------------- /packages/preset-base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/preset-base", 3 | "version": "0.3.1", 4 | "description": "Base theme preset for the siimple css toolkit", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "dependencies": { 14 | "@siimple/colors": "^0.3.1" 15 | }, 16 | "keywords": [ 17 | "siimple", 18 | "preset", 19 | "theme" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /packages/preset-dark/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/preset-dark 2 | 3 | A dark theme preset for the **siimple CSS toolkit**. You can use this preset as a starting point for building your own dark theme for **siimple**. 4 | 5 | ## Install 6 | 7 | Add this preset to your project using **npm** or **yarn**: 8 | 9 | ```bash 10 | $ npm install --save @siimple/preset-dark 11 | ``` 12 | 13 | ## Usage 14 | 15 | Include this preset in your `siimple.config.js` file: 16 | 17 | ```js 18 | import dark from "@siimple/preset-dark"; 19 | 20 | export default { 21 | ...dark, 22 | // ...other configuration 23 | }; 24 | ``` 25 | -------------------------------------------------------------------------------- /packages/preset-dark/index.js: -------------------------------------------------------------------------------- 1 | import colors from "@siimple/colors"; 2 | import base from "@siimple/preset-base"; 3 | 4 | export default { 5 | ...base, 6 | meta: { 7 | name: "dark", 8 | fonts: [], 9 | }, 10 | colors: { 11 | primary: colors.blue["500"], 12 | secondary: colors.royal["500"], 13 | highlight: colors.blue["700"], 14 | muted: colors.gray["700"], 15 | text: "#fff", 16 | heading: "#fff", 17 | background: colors.gray["900"], 18 | dark: colors.gray["900"], 19 | white: "#fff", 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /packages/preset-dark/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/preset-dark", 3 | "version": "0.3.1", 4 | "description": "Dark theme preset for the siimple css toolkit", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz/presets/dark", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "dependencies": { 14 | "@siimple/colors": "^0.3.1", 15 | "@siimple/preset-base": "^0.3.1" 16 | }, 17 | "keywords": [ 18 | "siimple", 19 | "preset", 20 | "theme", 21 | "dark" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /packages/preset-ice/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/preset-ice 2 | 3 | A frosty and clean theme for **siimple**. Based on [Nord Theme](https://www.nordtheme.com). 4 | 5 | ## Installation 6 | 7 | Install this package using **npm**: 8 | 9 | ``` 10 | $ npm install --save siimple @siimple/preset-ice 11 | ``` 12 | 13 | ## Usage 14 | 15 | Use this theme in your `siimple.config.js` file: 16 | 17 | ```js 18 | import ice from "@siimple/preset-ice"; 19 | 20 | export default { 21 | ...ice, 22 | // ...other configuration 23 | }; 24 | ``` 25 | 26 | This preset uses `Poppins` as default font for body text and headings. You will need to import this font in your HTML file: 27 | 28 | ```html 29 | 30 | ``` 31 | 32 | ## Additional variants 33 | 34 | This preset introduces additional variants for some elements like buttons, alerts and badges. You can use the `success`, `warning` and `danger` variants to style your buttons, alerts and badges: 35 | 36 | ```html 37 | 38 | 39 | 40 | 41 | 42 | 43 |
Danger alert
44 |
Warning alert
45 |
Success alert
46 | 47 | 48 | Danger badge 49 | Warning badge 50 | Success badge 51 | ``` 52 | 53 | ## Acknowledgement 54 | 55 | This theme has been inspired in [Nord Color palette](https://www.nordtheme.com). 56 | -------------------------------------------------------------------------------- /packages/preset-ice/index.js: -------------------------------------------------------------------------------- 1 | import base from "@siimple/preset-base"; 2 | 3 | // Color palette based on https://github.com/arcticicestudio/nord 4 | // LICENSE: https://github.com/arcticicestudio/nord/blob/develop/LICENSE.md (MIT LICENSE) 5 | export const baseColors = { 6 | polar: [ 7 | "#2e3440", // Polar night (nord0) 8 | "#3b4252", // Ponar night (nord1) 9 | "#434c5e", // Polar night (nord2) 10 | "#4c566a", // Polar night (nord3) 11 | ], 12 | snow: [ 13 | "#d8dee9", // Snow storm (nord4) 14 | "#e5e9f0", // Snow storm (nord5) 15 | "#eceff4", // Snow storm (nord6) 16 | ], 17 | frost: [ 18 | "#8fbcbb", // Frost (nord7) 19 | "#88c0d0", // Frost (nord8) 20 | "#81a1c1", // Frost (nord9) 21 | "#5e81ac", // Frost (nord10) 22 | ], 23 | aurora: [ 24 | "#bf616a", // Aurora (nord11) 25 | "#d08770", // Aurora (nord12) 26 | "#ebcb8b", // Aurora (nord13) 27 | "#a3be8c", // Aurora (nord14) 28 | "#b48ead", // Aurora (nord15) 29 | ], 30 | }; 31 | 32 | export default { 33 | ...base, 34 | meta: { 35 | name: "ice", 36 | fonts: [ 37 | "https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap", 38 | ], 39 | }, 40 | colors: { 41 | primary: baseColors.frost[3], 42 | secondary: baseColors.aurora[4], 43 | background: "#fff", 44 | text: baseColors.polar[1], 45 | heading: baseColors.polar[0], 46 | muted: baseColors.snow[2], 47 | danger: baseColors.aurora[0], 48 | warning: baseColors.aurora[2], 49 | success: baseColors.aurora[3], 50 | ...baseColors, 51 | }, 52 | fonts: { 53 | body: "Poppins, sans-serif", 54 | heading: "Poppins, sans-serif", 55 | monospace: "Menlo, monospace", 56 | }, 57 | // Mixins 58 | ...Object.fromEntries(["alerts","badges","buttons"].map(name => { 59 | return [name, { 60 | danger: { 61 | backgroundColor: "danger", 62 | color: "white", 63 | }, 64 | warning: { 65 | backgroundColor: "warning", 66 | color: "white", 67 | }, 68 | success: { 69 | backgroundColor: "success", 70 | colors: "white", 71 | }, 72 | }]; 73 | })), 74 | forms: { 75 | checkbox: { 76 | backgroundColor: "muted", 77 | "&:checked,&:indeterminate": { 78 | backgroundColor: "primary", 79 | }, 80 | }, 81 | ...Object.fromEntries(["input","select", "textarea"].map(el => { 82 | return [el, { 83 | backgroundColor: "muted", 84 | "&:focus": { 85 | borderColor: "primary", 86 | }, 87 | }]; 88 | })), 89 | radio: { 90 | color: "primary", 91 | "&:before": { 92 | borderColor: "muted", 93 | }, 94 | "&:hover:after": { 95 | backgroundColor: "muted", 96 | }, 97 | }, 98 | }, 99 | }; 100 | -------------------------------------------------------------------------------- /packages/preset-ice/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/preset-ice", 3 | "version": "0.3.1", 4 | "description": "A frosty and clean theme for siimple. Based on Nord Theme.", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz/presets/ice", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "dependencies": { 14 | "@siimple/preset-base": "^0.3.1" 15 | }, 16 | "keywords": [ 17 | "siimple", 18 | "preset", 19 | "theme", 20 | "ice", 21 | "nord" 22 | ], 23 | "files": [ 24 | "index.js", 25 | "README.md" 26 | ], 27 | "presetFonts": [ 28 | "https://fonts.googleapis.com/css2?family=Poppins:wght@400;700" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/preset-mustard/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/preset-mustard 2 | 3 | A very clean and yellowish theme preset for the **siimple CSS toolkit**. 4 | 5 | ## Installation 6 | 7 | Add this preset to your project using **npm** or **yarn**: 8 | 9 | ```bash 10 | $ npm install --save @siimple/preset-mustard 11 | ``` 12 | 13 | ## Usage 14 | 15 | Include this preset in your `siimple.config.js` file: 16 | 17 | ```js 18 | import mustard from "@siimple/preset-mustard"; 19 | 20 | export default { 21 | ...mustard, 22 | // ...other configuration 23 | 24 | // If you need to define your own variants, first extend the preset variants. 25 | // For example: 26 | buttons: { 27 | ...mustard.buttons, 28 | // ...your custom buttons variants 29 | }, 30 | 31 | // In case that you need to add your custom styles, first extend the styles 32 | // defined in mustard.styles: 33 | styles: { 34 | ...mustard.styles, 35 | // ...your custom styles 36 | }, 37 | }; 38 | ``` 39 | 40 | This preset uses [`Inter`](https://fonts.google.com/specimen/Inter) as the default font family for both body and headings, so you will need to import this font in your HTML file: 41 | 42 | ```html 43 | 44 | ``` 45 | 46 | ## Additional variants 47 | 48 | This preset introduces additional variants for some elements like buttons, alerts and badges. For example, you can use the `light` variant to create a more lithen alert, badge or button: 49 | 50 | ```html 51 | 52 | 53 | 54 | 55 |
56 | Light alert content 57 |
58 | 59 | 60 | Light badge 61 | ``` 62 | 63 | You can also create `outlined` buttons or badges: 64 | 65 | ```html 66 | 67 | ``` 68 | -------------------------------------------------------------------------------- /packages/preset-mustard/index.js: -------------------------------------------------------------------------------- 1 | import base from "@siimple/preset-base"; 2 | 3 | export const colors = { 4 | primary: "#041f32", 5 | secondary: "#f8ad15", 6 | highlight: "#fbe27c", 7 | muted: "#f8f8fa", 8 | gray: "#757789", 9 | }; 10 | 11 | export default { 12 | ...base, 13 | // Preset meta information 14 | meta: { 15 | name: "mustard", 16 | fonts: [ 17 | "https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap", 18 | ], 19 | }, 20 | colors: { 21 | ...colors, 22 | text: colors.primary, 23 | heading: colors.primary, 24 | background: "#fff", 25 | }, 26 | fonts: { 27 | ...base.fonts, 28 | body: "'Inter', sans-serif", 29 | heading: "inherit", 30 | }, 31 | // Mixins 32 | bordered: { 33 | borderColor: "primary", 34 | borderStyle: "solid", 35 | borderWidth: "0.125rem", 36 | }, 37 | shadowed: { 38 | boxShadow: [ 39 | "0rem 1rem 1rem -0.5rem rgba(54,63,79,0.25)", 40 | "0 0 0 1px rgba(54,63,79,0.02)", 41 | ].join(","), 42 | }, 43 | // Variants 44 | alerts: { 45 | light: { 46 | backgroundColor: "highlight", 47 | color: "text", 48 | }, 49 | }, 50 | badges: { 51 | light: { 52 | backgroundColor: "highlight", 53 | color: "text", 54 | }, 55 | outlined: { 56 | apply: "bordered", 57 | backgroundColor: "background", 58 | color: "text", 59 | padding: ["0.125rem", "0.375rem"], 60 | }, 61 | }, 62 | buttons: { 63 | light: { 64 | backgroundColor: "highlight", 65 | color: "text", 66 | }, 67 | outlined: { 68 | apply: "bordered", 69 | backgroundColor: "background", 70 | color: "text", 71 | padding: ["0.625rem", "1.375rem"], 72 | "&:hover": { 73 | backgroundColor: "primary", 74 | color: "white", 75 | }, 76 | }, 77 | }, 78 | layout: { 79 | card: { 80 | apply: "bordered", 81 | }, 82 | }, 83 | dialogs: { 84 | modal: { 85 | apply: "bordered", 86 | }, 87 | scrim: { 88 | backdropFilter: "blur(2px)", 89 | }, 90 | }, 91 | links: { 92 | nav: { 93 | "&:hover": { 94 | backgroundColor: "highlight", 95 | }, 96 | }, 97 | }, 98 | styles: { 99 | ".has-font-inter": { 100 | fontFamily: "body", 101 | }, 102 | }, 103 | }; 104 | -------------------------------------------------------------------------------- /packages/preset-mustard/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/preset-mustard", 3 | "version": "0.3.1", 4 | "description": "A yellowish and clean theme for siimple.", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz/presets/mustard", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "dependencies": { 14 | "@siimple/preset-base": "^0.3.1" 15 | }, 16 | "keywords": [ 17 | "siimple", 18 | "preset", 19 | "theme", 20 | "mustard", 21 | "yellow", 22 | "clean" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /packages/preset-noir/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/preset-noir 2 | 3 | An elegant and classic theme for **siimple**. 4 | 5 | ## Installation 6 | 7 | Install this package using **npm**: 8 | 9 | ```bash 10 | $ npm install --save @siimple/preset-noir 11 | ``` 12 | 13 | ## Usage 14 | 15 | Add this theme to your `siimple.config.js` file: 16 | 17 | ```js 18 | import noir from "@siimple/preset-noir"; 19 | 20 | export default { 21 | ...noir, 22 | // ...other configuration 23 | styles: { 24 | ...noir.styles, 25 | // other custom styles 26 | }, 27 | }; 28 | ``` 29 | 30 | This preset uses [`Noto Serif`](https://fonts.google.com/specimen/Noto+Serif) for body text and for headings, so you will need to import this font in your HTML file: 31 | 32 | ```html 33 | 34 | ``` 35 | 36 | ## Additional variants 37 | 38 | This preset introduces additional variants for some elements. You can use the `outlined` variant to create an outlined button or badge: 39 | 40 | ```html 41 | 42 | 43 | 44 | 45 | Outlined badge 46 | ``` 47 | -------------------------------------------------------------------------------- /packages/preset-noir/index.js: -------------------------------------------------------------------------------- 1 | import base from "@siimple/preset-base"; 2 | 3 | // theme colors 4 | export const colors = { 5 | primary: "#161b29", 6 | secondary: "#757789", 7 | muted: "#d8d9de", 8 | highlight: "#9394a3", 9 | white: "#fff", 10 | }; 11 | 12 | export default { 13 | ...base, 14 | meta: { 15 | name: "noir", 16 | fonts: [ 17 | "https://fonts.googleapis.com/css2?family=Noto+Serif:wght@400;700", 18 | ], 19 | }, 20 | // Scales 21 | colors: { 22 | primary: colors.primary, 23 | secondary: colors.secondary, 24 | muted: colors.muted, 25 | text: colors.primary, 26 | heading: colors.primary, 27 | highlight: colors.highlight, 28 | background: colors.white, 29 | }, 30 | fonts: { 31 | ...base.fonts, 32 | body: "'Noto Serif', serif", 33 | heading: "inherit", 34 | }, 35 | fontWeights: { 36 | body: "400", 37 | bold: "700", 38 | heading: "700", 39 | }, 40 | // Mixins 41 | bordered: { 42 | borderColor: "primary", 43 | borderRadius: "0.5rem", 44 | borderStyle: "solid", 45 | borderWidth: "0.125rem", 46 | }, 47 | shadowed: { 48 | boxShadow: [ 49 | "0rem 1rem 1rem -0.5rem rgba(54,63,79,0.25)", 50 | "0 0 0 1px rgba(54,63,79,0.02)", 51 | ].join(","), 52 | }, 53 | // Variants 54 | badges: { 55 | outlined: { 56 | apply: "bordered", 57 | backgroundColor: "background", 58 | color: "primary", 59 | padding: ["0.125rem", "0.375rem"], 60 | }, 61 | }, 62 | buttons: { 63 | outlined: { 64 | apply: "bordered", 65 | backgroundColor: "background", 66 | color: "primary", 67 | padding: ["0.625rem", "1.375rem"], 68 | "&:hover": { 69 | backgroundColor: "primary", 70 | color: colors.white, 71 | }, 72 | }, 73 | }, 74 | layout: { 75 | card: { 76 | apply: "bordered", 77 | // backgroundColor: colors.white, 78 | boxShadow: ["none", "!important"], 79 | }, 80 | }, 81 | dialogs: { 82 | modal: { 83 | apply: "bordered", 84 | // backgroundColor: colors.white, 85 | }, 86 | scrim: { 87 | backdropFilter: "blur(2px)", 88 | }, 89 | }, 90 | forms: { 91 | input: { 92 | apply: "bordered", 93 | backgroundColor: "background", 94 | "&:focus": { 95 | borderColor: "primary", 96 | }, 97 | }, 98 | select: { 99 | apply: "bordered", 100 | backgroundColor: "background", 101 | "&:focus": { 102 | borderColor: "primary", 103 | }, 104 | }, 105 | textarea: { 106 | apply: "bordered", 107 | backgroundColor: "background", 108 | "&:focus": { 109 | borderColor: "primary", 110 | }, 111 | }, 112 | }, 113 | links: { 114 | dropdown: { 115 | apply: "bordered", 116 | backgroundColor: "background", 117 | }, 118 | nav: { 119 | color: "primary", 120 | "&:hover": { 121 | backgroundColor: "muted", 122 | }, 123 | // "&.is-active": { 124 | // backgroundColor: "highlight", 125 | // color: colors.white, 126 | // }, 127 | }, 128 | }, 129 | styles: { 130 | hr: { 131 | backgroundColor: "primary", 132 | }, 133 | // Additional helpers 134 | ".is-bordered": { 135 | apply: "bordered", 136 | }, 137 | }, 138 | }; 139 | -------------------------------------------------------------------------------- /packages/preset-noir/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/preset-noir", 3 | "version": "0.3.1", 4 | "description": "An elegant and classic theme for siimple.", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz/presets/noir", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "dependencies": { 14 | "@siimple/preset-base": "^0.3.1" 15 | }, 16 | "keywords": [ 17 | "siimple", 18 | "preset", 19 | "theme", 20 | "classic", 21 | "elegant" 22 | ], 23 | "files": [ 24 | "index.js", 25 | "README.md" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /packages/presets/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/presets 2 | 3 | A collection of all official presets for **siimple**. 4 | 5 | ## Installation 6 | 7 | Use **npm** or **yarn** for adding this package to your project: 8 | 9 | ```bash 10 | $ yarn add @siimple/presets 11 | ``` 12 | 13 | ## Usage 14 | 15 | Presets can be imported from this package to your `siimple.config.js` file: 16 | 17 | ```js 18 | import {base} from "@siimple/presets"; 19 | 20 | export default { 21 | ...base, 22 | // ...other custom configuration 23 | }; 24 | ``` 25 | 26 | The following presets can be imported: 27 | 28 | - [base](https://www.siimple.xyz/presets/base). 29 | - [dark](https://www.siimple.xyz/presets/dark). 30 | - [ice](https://www.siimple.xyz/presets/ice). 31 | - [mustard](https://www.siimple.xyz/presets/mustard). 32 | - [noir](https://www.siimple.xyz/presets/noir). 33 | 34 | 35 | # License 36 | 37 | [MIT License](https://github.com/jmjuanes/siimple/blob/main/LICENSE). 38 | -------------------------------------------------------------------------------- /packages/presets/index.js: -------------------------------------------------------------------------------- 1 | export {default as base} from "@siimple/preset-base"; 2 | export {default as dark} from "@siimple/preset-dark"; 3 | export {default as ice} from "@siimple/preset-ice"; 4 | export {default as mustard} from "@siimple/preset-mustard"; 5 | export {default as noir} from "@siimple/preset-noir"; 6 | -------------------------------------------------------------------------------- /packages/presets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/presets", 3 | "version": "0.3.1", 4 | "description": "A collection of presets for siimple.", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "dependencies": { 14 | "@siimple/preset-base": "^0.3.1", 15 | "@siimple/preset-dark": "^0.3.1", 16 | "@siimple/preset-ice": "^0.3.1", 17 | "@siimple/preset-mustard": "^0.3.1", 18 | "@siimple/preset-noir": "^0.3.1" 19 | }, 20 | "keywords": [ 21 | "siimple", 22 | "presets", 23 | "theme" 24 | ], 25 | "files": [ 26 | "index.js", 27 | "README.md" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /packages/standalone/README.md: -------------------------------------------------------------------------------- 1 | # @siimple/standalone (Experimental) 2 | 3 | Standalone script for using **siimple** directly in browser. 4 | 5 | > **Note**: this is an experimental package. API may change at any time. **Please do not use it in production**. 6 | 7 | ## When to use @siimple/standalone 8 | 9 | You should normally not use `@siimple/standalone` and use instead the CLI or the PostCSS plugin to generate a CSS file with the **siimple** styles. 10 | 11 | However, there are some valid use cases: 12 | 13 | - For rapid prototyping and development purposes: you can get started with **siimple** without any additional setup, just including a simple ` 26 | ``` 27 | 28 | > **NOTE**: remember to add the `type="module"` attribute in the ` 43 | 44 | 45 | 50 | ``` 51 | 52 | You can import additional packages to customize your theme. All packages will be imported automatically from the [esm.sh](https//esm.sh) CDN service: 53 | 54 | ```html 55 | 63 | ``` 64 | 65 | Using an external script is also supported: 66 | 67 | ```html 68 | 69 | ``` 70 | 71 | ## Prevent Flash of Unstyled Content 72 | 73 | You can prevent the common [Flash of unstyled content](https://en.wikipedia.org/wiki/Flash_of_unstyled_content) effect in your webpage by adding a new ` 80 | 81 | 82 | 83 | 84 | 85 | ``` 86 | 87 | After **siimple** is compiled, it will automatically reset this class and display the content of your body styled. 88 | 89 | ## License 90 | 91 | [MIT License](https://github.com/jmjuanes/siimple/blob/main/LICENSE). 92 | -------------------------------------------------------------------------------- /packages/standalone/example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | @siimple/standalone example 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 |

Hello world

21 | 22 | -------------------------------------------------------------------------------- /packages/standalone/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@siimple/standalone", 3 | "version": "0.3.1", 4 | "description": "Build siimple CSS directly in your browser", 5 | "author": "Josemi Juanes ", 6 | "type": "module", 7 | "license": "MIT", 8 | "repository": "https://github.com/jmjuanes/siimple", 9 | "bugs": "https://github.com/jmjuanes/siimple/issues", 10 | "homepage": "https://www.siimple.xyz", 11 | "main": "index.js", 12 | "exports": "./index.js", 13 | "keywords": [ 14 | "siimple", 15 | "css", 16 | "browser" 17 | ], 18 | "files": [ 19 | "index.js", 20 | "README.md" 21 | ], 22 | "engines": { 23 | "node": ">=14" 24 | }, 25 | "dependencies": { 26 | "@siimple/core": "^0.3.1", 27 | "@siimple/modules": "^0.3.1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /playground/actions/playground.js: -------------------------------------------------------------------------------- 1 | import lzString from "lz-string"; 2 | 3 | // Compress and decompress string 4 | const compressStr = str => lzString.compressToBase64(str); 5 | const decompressStr = str => lzString.decompressFromBase64(str); 6 | 7 | // Load playground content from source 8 | export const loadPlayground = content => { 9 | return new Promise((resolve, reject) => { 10 | const query = new URLSearchParams(window.location.hash.substr(1) || ""); 11 | // Check for playground data encoded in URL 12 | if (query.has("html") || query.has("config")) { 13 | if (query.has("html")) { 14 | content.html = decompressStr(query.get("html")); 15 | } 16 | if (query.has("config")) { 17 | content.config = decompressStr(query.get("config")); 18 | } 19 | } 20 | // Check for data in localStorage 21 | // else { 22 | // content.html = localStorage.getItem(htmlSymbol) || content.html; 23 | // content.config = localStorage.getItem(configSymbol) || content.config; 24 | // } 25 | return resolve(content); 26 | }); 27 | }; 28 | 29 | // Save playground content in local storage 30 | export const savePlayground = content => { 31 | // localStorage.setItem(htmlSymbol, content.html || ""); 32 | // localStorage.setItem(configSymbol, content.config || ""); 33 | }; 34 | 35 | // Share the playground code via URL 36 | export const sharePlayground = content => { 37 | return Promise.resolve().then(() => { 38 | const query = new URLSearchParams(); 39 | // Check for custom version 40 | // if (content.version !== "latest") { 41 | // query.set("version", "latest"); 42 | // } 43 | query.set("html", compressStr(content.html)); 44 | query.set("config", compressStr(content.config)); 45 | // return `${window.location.origin}#${query.toString()}`; 46 | return `${window.location.href}#${query.toString()}`; 47 | }); 48 | }; 49 | 50 | // Save playground in JSON format 51 | export const exportPlayground = content => { 52 | // const data = JSON.stringify({ 53 | // html: content.html || "", 54 | // config: content.config || "", 55 | // version: sandbox.version || "latest", 56 | // }); 57 | // const fileContent = URL.createObjectURL(new Blob([data], { 58 | // type: "application/json", 59 | // })); 60 | // const fileName = `playground-${kofi.timestamp("YYYY-MM-DD")}.json`; 61 | // return kofi.downloadFile(fileName, fileContent); 62 | }; 63 | -------------------------------------------------------------------------------- /playground/actions/worker.js: -------------------------------------------------------------------------------- 1 | // Compile siimple 2 | export const compile = (worker, config) => { 3 | return new Promise(resolve => { 4 | const id = Math.random().toString(36).slice(2, 9) + Date.now().toString(36); 5 | const onMessage = event => { 6 | if (event.data?.id === id) { 7 | worker.removeEventListener("message", onMessage); 8 | return resolve(event.data); 9 | } 10 | }; 11 | worker.addEventListener("message", onMessage); 12 | worker.postMessage({ 13 | id: id, 14 | config: config, 15 | }) 16 | }); 17 | }; 18 | -------------------------------------------------------------------------------- /playground/components/Brand.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import classNames from "classnames"; 3 | 4 | export const Brand = props => { 5 | const parentClass = classNames({ 6 | "is-not-underlined": true, 7 | "has-text-dark": props.theme === "light", 8 | "has-text-white": props.theme === "dark", 9 | }); 10 | return ( 11 | 12 | 13 | 14 | ); 15 | }; 16 | 17 | Brand.defaultProps = { 18 | url: "/", 19 | target: "_self", 20 | theme: "light", 21 | }; 22 | -------------------------------------------------------------------------------- /playground/components/Button.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import classNames from "classnames"; 3 | 4 | export const Button = props => { 5 | const buttonClass = classNames({ 6 | "is-flex has-items-center is-clickable is-rounded has-p-2 has-ml-2": true, 7 | "has-text-light has-text-primary-hover": !props.active && props.theme === "dark", 8 | "has-text-dark has-text-primary-hover": !props.active && props.theme === "light", 9 | "has-bg-primary has-text-white": !!props.active, 10 | }); 11 | return ( 12 |
13 | 14 |
15 | ); 16 | }; 17 | -------------------------------------------------------------------------------- /playground/components/Editor.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import classNames from "classnames"; 3 | 4 | export const Editor = React.forwardRef((props, ref) => { 5 | const editorClass = classNames({ 6 | "CodeCake has-w-full has-h-full has-p-none is-clipped": true, 7 | "CodeCake-dark has-bg-dark": props.theme === "dark", 8 | "CodeCake-light has-bg-light": props.theme === "light", 9 | }); 10 | return ( 11 |
12 |
13 |
14 | ); 15 | }); 16 | -------------------------------------------------------------------------------- /playground/components/FileTab.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import classNames from "classnames"; 3 | 4 | export const FileTab = props => { 5 | const tabClass = classNames({ 6 | "navlink has-text-center has-w-auto has-mr-2 has-pl-4 has-pr-4": true, 7 | "is-flex has-items-center": true, 8 | "has-text-highlight-hover": !props.active && props.theme === "dark", 9 | "has-bg-primary has-text-white has-text-white-hover": props.active, 10 | }); 11 | 12 | return ( 13 |
14 | {/* */} 15 | {props.text} 16 |
17 | ); 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /playground/components/Preview.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export const Preview = React.forwardRef((props, ref) => { 4 | return React.createElement("iframe", { 5 | ref: ref, 6 | style: { 7 | width: "100%", 8 | height: "100%", 9 | border: "0", 10 | backgroundColor: "#ffffff", 11 | }, 12 | sandbox: "allow-scripts allow-same-origin", 13 | scrolling: "yes", 14 | src: `${process.env.PUBLIC_PATH}playground.html`, 15 | onLoad: props.onLoad, 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /playground/components/ShareModal.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | // Share modal 4 | export const ShareModal = props => { 5 | const [copied, setCopied] = React.useState(false); 6 | const handleCopyClick = () => { 7 | navigator.clipboard.writeText(props.url).then(() => { 8 | setCopied(true); 9 | }); 10 | }; 11 | 12 | return ( 13 |
14 |
15 |
16 |

Share

17 |
18 |
19 |

You can use the following URL for sharing your code:

20 |
21 |