diff --git a/.gitignore b/.gitignore index 18e29f6..6504047 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ dist-ssr *.sw? .DS_Store vue-m-ui/package-lock.json +vue-m-ui/npmCommands.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e5c8d71 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,68 @@ + +## 0.3.0 (06-06-2023) + +### Feature + +#### `` + +- Added the ability to add custom colors on input with shades on `hover` and `click` +- Added a set of custom sizes with the `size` string prop +- Added a set of custom shapes with the `shape` string prop +- Handle transparency with the `transparent` boolean prop +- Ability to add `custom elements` inside the button or optionally through the `text` string prop +- Added: `disabled` and `loading` with custom `loading-icon` with the `loading-circle` default icon + +#### Added the `` component 🎉 + +- Added the `id` prop at the input element or the `container-id` to select the whole element +- Optionally add the component on top of the input with the `label` string prop that contains the text, with the optional `label-id` string prop +- Placeholder... +- Added an icon with the `icon` string property *limited to a small set of open source icons* +- `type` string prop **Currently supports `text` and `email` inputs** +- Added a set of custom colors for the input element with the `color` string prop with the optional support for custom `hex` and `rgb/a` colors +- Added a set of custom colors for the text inside of the input element with the `text-color` string prop with the optional support for custom `hex` and `rgb/a` colors +- Added a set of custom sizes with the `size` string prop +- Added a set of custom shapes with the `shape` string prop +- Handle **bold text** with the `bold` boolean prop +- Added: `disabled` and `loading` with custom `loading-icon` with the `loading-circle` default icon +- Added automatic email validation of input of `type="email"` +- Added persistent validation bar on email inputs **This will change to fit other types as well** +- Autofocus... :> + +#### Added the `` component 🎉 + +- Added a set of custom colors for the `switch` element with the `color` string prop with the optional support for custom `hex` and `rgb/a` colors +- Added a set of custom sizes with the `size` string prop +- Added the custom width with the `custom-width` string prop that accepts normal css size units +- Added: `disabled` and `loading` + +#### Other + +- Added css minification with postcss cssnano plugin + +### Changed + +- Minor reorganizing of css with vars to better support color and style customization. + +### Fixed + +- Fixed some minor bugs on `` that wasn't detecting the tab on custom colors + +## 0.2.0 (01-06-2023) + +### Feature + +- Added the `` and `` Components with minor styling functionality that are still in development. + +### Changed + +- Minor reorganizing of the project structure for better scalability and maintainability. + +## 0.1.1 (26-05-2023) + +##### First of many! 🎉 + +### Feature +0.1.1 brings us the `` button element. + +The docs for usage will be out in a jiffy (prolly next week - May 30ish or later...) \ No newline at end of file diff --git a/README.md b/README.md index 7882d86..74668d4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ `0.1.1 is out! 🎉🥳` -![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/prolazydev/vue-m?color=blue&include_prereleases&style=for-the-badge) ![npm](https://img.shields.io/npm/dt/@prolazydev/vue-m?color=orange&label=downs&style=for-the-badge) [![license](https://img.shields.io/github/license/prolazydev/vue-m.svg?style=for-the-badge)](https://github.com/prolazydev/vue-m/blob/main/LICENSE) [![code with hearth by NHN Cloud](https://img.shields.io/badge/%3C%2F%3E%20with%20%20cooless%20%F0%9F%98%8E%20by-prolazydev-00bf76.svg?style=for-the-badge)](https://github.com/nhn) +![npm](https://img.shields.io/npm/v/@prolazydev/vue-m?color=blue&label=release&style=for-the-badge) ![npm](https://img.shields.io/npm/dt/@prolazydev/vue-m?color=orange&label=downs&style=for-the-badge) [![license](https://img.shields.io/github/license/prolazydev/vue-m.svg?style=for-the-badge)](https://github.com/prolazydev/vue-m/blob/main/LICENSE) [![npm](https://img.shields.io/badge/-changelog-orange?style=for-the-badge)](https://github.com/prolazydev/vue-m/blob/main/CHANGELOG.md) [![code with hearth by NHN Cloud](https://img.shields.io/badge/%3C%2F%3E%20with%20%20cooless%20%F0%9F%98%8E%20by-prolazydev-00bf76.svg?style=for-the-badge)](https://github.com/nhn) ## Introduction diff --git a/vue-m-ui/README.md b/vue-m-ui/README.md new file mode 100644 index 0000000..a22ebbf --- /dev/null +++ b/vue-m-ui/README.md @@ -0,0 +1,95 @@ +# vue-m ⚒ WORK IN PROGRESS + +[![npm](https://img.shields.io/npm/v/@prolazydev/vue-m?color=blue&label=release&style=for-the-badge)](https://github.com/prolazydev/vue-m) ![npm](https://img.shields.io/npm/dt/@prolazydev/vue-m?color=orange&label=downs&style=for-the-badge) [![license](https://img.shields.io/github/license/prolazydev/vue-m.svg?style=for-the-badge)](https://github.com/prolazydev/vue-m/blob/main/LICENSE) [![code with hearth by NHN Cloud](https://img.shields.io/badge/%3C%2F%3E%20with%20%20cooless%20%F0%9F%98%8E%20by-prolazydev-00bf76.svg?style=for-the-badge)](https://github.com/prolazydev) + +## Introduction + +`vue-m` is a Vue 3 UI component library designed to enhance the user interface of your Vue applications. It provides a collection of modern and responsive UI components that are easy to install and use. + +## Features + +- Modern and responsive UI components +- Easy installation and usage +- Built with Vue 3 and TypeScript +- Highly customizable and flexible + +## Installation + +You can install the `vue-m` package using npm or Yarn: + +```bash +npm install vue-m +``` + +or + +```bash +yarn add vue-m +``` + +## Usage + +To use the components from vue-m, register them in `main.ts`: + +```ts +import { createApp } from 'vue'; +import vueM from 'vue-m'; // Import the components +import 'vue-m/dist/vue-m.css'; // Import the styling (Optional) +import App from './App.vue'; + +createApp(App) + .use(vueM) + .mount('#app'); +``` + +Then use the components like this: + +```vue + +``` + +## TODO + +- Create the todos :> `Doing` + + diff --git a/vue-m-ui/package-lock.json b/vue-m-ui/package-lock.json index d792eed..c160948 100644 --- a/vue-m-ui/package-lock.json +++ b/vue-m-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "@prolazydev/vue-m", - "version": "0.1.2", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@prolazydev/vue-m", - "version": "0.1.2", + "version": "0.3.0", "license": "MIT", "dependencies": { "vue": "^3.2.0" @@ -15,6 +15,7 @@ "@types/node": "^20.1.3", "@vitejs/plugin-vue": "^4.1.0", "autoprefixer": "^10.4.14", + "cssnano": "^6.0.1", "path": "^0.12.7", "postcss": "^8.4.23", "postcss-cli": "^10.1.0", @@ -693,6 +694,15 @@ "string-argv": "~0.3.1" } }, + "node_modules/@trysound/sax": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", + "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/@ts-morph/common": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.19.0.tgz", @@ -1090,6 +1100,12 @@ "node": ">=8" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1149,6 +1165,18 @@ "node": ">= 6" } }, + "node_modules/caniuse-api": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", + "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", + "dev": true, + "dependencies": { + "browserslist": "^4.0.0", + "caniuse-lite": "^1.0.0", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001487", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001487.tgz", @@ -1234,6 +1262,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/colord": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", + "dev": true + }, "node_modules/colors": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz", @@ -1264,6 +1298,59 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/css-declaration-sorter": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz", + "integrity": "sha512-jDfsatwWMWN0MODAFuHszfjphEXfNw9JUAhmY4pLu3TyTU+ohUpsbVtbU+1MZn4a47D9kqh03i4eyOm+74+zew==", + "dev": true, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.0.9" + } + }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-tree": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", + "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", + "dev": true, + "dependencies": { + "mdn-data": "2.0.30", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "dev": true, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -1276,6 +1363,114 @@ "node": ">=4" } }, + "node_modules/cssnano": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-6.0.1.tgz", + "integrity": "sha512-fVO1JdJ0LSdIGJq68eIxOqFpIJrZqXUsBt8fkrBcztCQqAjQD51OhZp7tc0ImcbwXD4k7ny84QTV90nZhmqbkg==", + "dev": true, + "dependencies": { + "cssnano-preset-default": "^6.0.1", + "lilconfig": "^2.1.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/cssnano" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/cssnano-preset-default": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-6.0.1.tgz", + "integrity": "sha512-7VzyFZ5zEB1+l1nToKyrRkuaJIx0zi/1npjvZfbBwbtNTzhLtlvYraK/7/uqmX2Wb2aQtd983uuGw79jAjLSuQ==", + "dev": true, + "dependencies": { + "css-declaration-sorter": "^6.3.1", + "cssnano-utils": "^4.0.0", + "postcss-calc": "^9.0.0", + "postcss-colormin": "^6.0.0", + "postcss-convert-values": "^6.0.0", + "postcss-discard-comments": "^6.0.0", + "postcss-discard-duplicates": "^6.0.0", + "postcss-discard-empty": "^6.0.0", + "postcss-discard-overridden": "^6.0.0", + "postcss-merge-longhand": "^6.0.0", + "postcss-merge-rules": "^6.0.1", + "postcss-minify-font-values": "^6.0.0", + "postcss-minify-gradients": "^6.0.0", + "postcss-minify-params": "^6.0.0", + "postcss-minify-selectors": "^6.0.0", + "postcss-normalize-charset": "^6.0.0", + "postcss-normalize-display-values": "^6.0.0", + "postcss-normalize-positions": "^6.0.0", + "postcss-normalize-repeat-style": "^6.0.0", + "postcss-normalize-string": "^6.0.0", + "postcss-normalize-timing-functions": "^6.0.0", + "postcss-normalize-unicode": "^6.0.0", + "postcss-normalize-url": "^6.0.0", + "postcss-normalize-whitespace": "^6.0.0", + "postcss-ordered-values": "^6.0.0", + "postcss-reduce-initial": "^6.0.0", + "postcss-reduce-transforms": "^6.0.0", + "postcss-svgo": "^6.0.0", + "postcss-unique-selectors": "^6.0.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/cssnano-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-4.0.0.tgz", + "integrity": "sha512-Z39TLP+1E0KUcd7LGyF4qMfu8ZufI0rDzhdyAMsa/8UyNUU8wpS0fhdBxbQbv32r64ea00h4878gommRVg2BHw==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/csso": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", + "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", + "dev": true, + "dependencies": { + "css-tree": "~2.2.0" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/csso/node_modules/css-tree": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", + "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", + "dev": true, + "dependencies": { + "mdn-data": "2.0.28", + "source-map-js": "^1.0.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/csso/node_modules/mdn-data": { + "version": "2.0.28", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", + "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", + "dev": true + }, "node_modules/csstype": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", @@ -1337,6 +1532,61 @@ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", "dev": true }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dev": true, + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dev": true, + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dev": true, + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.395", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.395.tgz", @@ -1349,6 +1599,18 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/esbuild": { "version": "0.17.19", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", @@ -1824,6 +2086,18 @@ "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", "dev": true }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "node_modules/lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true + }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -1872,6 +2146,12 @@ "semver": "bin/semver.js" } }, + "node_modules/mdn-data": { + "version": "2.0.30", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", + "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", + "dev": true + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -1985,6 +2265,18 @@ "node": ">=0.10.0" } }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -2171,6 +2463,22 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/postcss-calc": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-9.0.1.tgz", + "integrity": "sha512-TipgjGyzP5QzEhsOZUaIkeO5mKeMFpebWzRogWG/ysonUlnHcq5aJe0jOjpfzUU8PeSaBQnrE8ehR0QA5vs8PQ==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.11", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.2" + } + }, "node_modules/postcss-cli": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/postcss-cli/-/postcss-cli-10.1.0.tgz", @@ -2200,6 +2508,88 @@ "postcss": "^8.0.0" } }, + "node_modules/postcss-colormin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-6.0.0.tgz", + "integrity": "sha512-EuO+bAUmutWoZYgHn2T1dG1pPqHU6L4TjzPlu4t1wZGXQ/fxV16xg2EJmYi0z+6r+MGV1yvpx1BHkUaRrPa2bw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0", + "colord": "^2.9.1", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-convert-values": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-6.0.0.tgz", + "integrity": "sha512-U5D8QhVwqT++ecmy8rnTb+RL9n/B806UVaS3m60lqle4YDFcpbS3ae5bTQIh3wOGUSDHSEtMYLs/38dNG7EYFw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-comments": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-6.0.0.tgz", + "integrity": "sha512-p2skSGqzPMZkEQvJsgnkBhCn8gI7NzRH2683EEjrIkoMiwRELx68yoUJ3q3DGSGuQ8Ug9Gsn+OuDr46yfO+eFw==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-duplicates": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-6.0.0.tgz", + "integrity": "sha512-bU1SXIizMLtDW4oSsi5C/xHKbhLlhek/0/yCnoMQany9k3nPBq+Ctsv/9oMmyqbR96HYHxZcHyK2HR5P/mqoGA==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-empty": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-6.0.0.tgz", + "integrity": "sha512-b+h1S1VT6dNhpcg+LpyiUrdnEZfICF0my7HAKgJixJLW7BnNmpRH34+uw/etf5AhOlIhIAuXApSzzDzMI9K/gQ==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-overridden": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-6.0.0.tgz", + "integrity": "sha512-4VELwssYXDFigPYAZ8vL4yX4mUepF/oCBeeIT4OXsJPYOtvJumyz9WflmJWTfDwCUcpDR+z0zvCWBXgTx35SVw==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, "node_modules/postcss-import": { "version": "15.1.0", "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", @@ -2265,6 +2655,104 @@ } } }, + "node_modules/postcss-merge-longhand": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-6.0.0.tgz", + "integrity": "sha512-4VSfd1lvGkLTLYcxFuISDtWUfFS4zXe0FpF149AyziftPFQIWxjvFSKhA4MIxMe4XM3yTDgQMbSNgzIVxChbIg==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0", + "stylehacks": "^6.0.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-merge-rules": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-6.0.1.tgz", + "integrity": "sha512-a4tlmJIQo9SCjcfiCcCMg/ZCEe0XTkl/xK0XHBs955GWg9xDX3NwP9pwZ78QUOWB8/0XCjZeJn98Dae0zg6AAw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0", + "cssnano-utils": "^4.0.0", + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-font-values": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-6.0.0.tgz", + "integrity": "sha512-zNRAVtyh5E8ndZEYXA4WS8ZYsAp798HiIQ1V2UF/C/munLp2r1UGHwf1+6JFu7hdEhJFN+W1WJQKBrtjhFgEnA==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-gradients": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-6.0.0.tgz", + "integrity": "sha512-wO0F6YfVAR+K1xVxF53ueZJza3L+R3E6cp0VwuXJQejnNUH0DjcAFe3JEBeTY1dLwGa0NlDWueCA1VlEfiKgAA==", + "dev": true, + "dependencies": { + "colord": "^2.9.1", + "cssnano-utils": "^4.0.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-params": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-6.0.0.tgz", + "integrity": "sha512-Fz/wMQDveiS0n5JPcvsMeyNXOIMrwF88n7196puSuQSWSa+/Ofc1gDOSY2xi8+A4PqB5dlYCKk/WfqKqsI+ReQ==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "cssnano-utils": "^4.0.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-selectors": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-6.0.0.tgz", + "integrity": "sha512-ec/q9JNCOC2CRDNnypipGfOhbYPuUkewGwLnbv6omue/PSASbHSU7s6uSQ0tcFRVv731oMIx8k0SP4ZX6be/0g==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, "node_modules/postcss-nested": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.1.tgz", @@ -2284,6 +2772,186 @@ "postcss": "^8.2.14" } }, + "node_modules/postcss-normalize-charset": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-6.0.0.tgz", + "integrity": "sha512-cqundwChbu8yO/gSWkuFDmKrCZ2vJzDAocheT2JTd0sFNA4HMGoKMfbk2B+J0OmO0t5GUkiAkSM5yF2rSLUjgQ==", + "dev": true, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-display-values": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-6.0.0.tgz", + "integrity": "sha512-Qyt5kMrvy7dJRO3OjF7zkotGfuYALETZE+4lk66sziWSPzlBEt7FrUshV6VLECkI4EN8Z863O6Nci4NXQGNzYw==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-positions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-6.0.0.tgz", + "integrity": "sha512-mPCzhSV8+30FZyWhxi6UoVRYd3ZBJgTRly4hOkaSifo0H+pjDYcii/aVT4YE6QpOil15a5uiv6ftnY3rm0igPg==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-repeat-style": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-6.0.0.tgz", + "integrity": "sha512-50W5JWEBiOOAez2AKBh4kRFm2uhrT3O1Uwdxz7k24aKtbD83vqmcVG7zoIwo6xI2FZ/HDlbrCopXhLeTpQib1A==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-string": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-6.0.0.tgz", + "integrity": "sha512-KWkIB7TrPOiqb8ZZz6homet2KWKJwIlysF5ICPZrXAylGe2hzX/HSf4NTX2rRPJMAtlRsj/yfkrWGavFuB+c0w==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-timing-functions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-6.0.0.tgz", + "integrity": "sha512-tpIXWciXBp5CiFs8sem90IWlw76FV4oi6QEWfQwyeREVwUy39VSeSqjAT7X0Qw650yAimYW5gkl2Gd871N5SQg==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-unicode": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-6.0.0.tgz", + "integrity": "sha512-ui5crYkb5ubEUDugDc786L/Me+DXp2dLg3fVJbqyAl0VPkAeALyAijF2zOsnZyaS1HyfPuMH0DwyY18VMFVNkg==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-url": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-6.0.0.tgz", + "integrity": "sha512-98mvh2QzIPbb02YDIrYvAg4OUzGH7s1ZgHlD3fIdTHLgPLRpv1ZTKJDnSAKr4Rt21ZQFzwhGMXxpXlfrUBKFHw==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-whitespace": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-6.0.0.tgz", + "integrity": "sha512-7cfE1AyLiK0+ZBG6FmLziJzqQCpTQY+8XjMhMAz8WSBSCsCNNUKujgIgjCAmDT3cJ+3zjTXFkoD15ZPsckArVw==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-ordered-values": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-6.0.0.tgz", + "integrity": "sha512-K36XzUDpvfG/nWkjs6d1hRBydeIxGpKS2+n+ywlKPzx1nMYDYpoGbcjhj5AwVYJK1qV2/SDoDEnHzlPD6s3nMg==", + "dev": true, + "dependencies": { + "cssnano-utils": "^4.0.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-reduce-initial": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-6.0.0.tgz", + "integrity": "sha512-s2UOnidpVuXu6JiiI5U+fV2jamAw5YNA9Fdi/GRK0zLDLCfXmSGqQtzpUPtfN66RtCbb9fFHoyZdQaxOB3WxVA==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-reduce-transforms": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-6.0.0.tgz", + "integrity": "sha512-FQ9f6xM1homnuy1wLe9lP1wujzxnwt1EwiigtWwuyf8FsqqXUDUp2Ulxf9A5yjlUOTdCJO6lonYjg1mgqIIi2w==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, "node_modules/postcss-reporter": { "version": "7.0.5", "resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-7.0.5.tgz", @@ -2317,6 +2985,37 @@ "node": ">=4" } }, + "node_modules/postcss-svgo": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-6.0.0.tgz", + "integrity": "sha512-r9zvj/wGAoAIodn84dR/kFqwhINp5YsJkLoujybWG59grR/IHx+uQ2Zo+IcOwM0jskfYX3R0mo+1Kip1VSNcvw==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.2.0", + "svgo": "^3.0.2" + }, + "engines": { + "node": "^14 || ^16 || >= 18" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-unique-selectors": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-6.0.0.tgz", + "integrity": "sha512-EPQzpZNxOxP7777t73RQpZE5e9TrnCrkvp7AH7a0l89JmZiPnS82y216JowHXwpBCQitfyxrof9TK3rYbi7/Yw==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, "node_modules/postcss-value-parser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", @@ -2594,6 +3293,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/stylehacks": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-6.0.0.tgz", + "integrity": "sha512-+UT589qhHPwz6mTlCLSt/vMNTJx8dopeJlZAlBMJPWA3ORqu6wmQY7FBXf+qD+FsqoBJODyqNxOUP3jdntFRdw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.4", + "postcss-selector-parser": "^6.0.4" + }, + "engines": { + "node": "^14 || ^16 || >=18.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, "node_modules/sucrase": { "version": "3.32.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.32.0.tgz", @@ -2628,6 +3343,39 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/svgo": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.0.2.tgz", + "integrity": "sha512-Z706C1U2pb1+JGP48fbazf3KxHrWOsLme6Rv7imFBn5EnuanDW1GPaA/P1/dvObE670JDePC3mnj0k0B7P0jjQ==", + "dev": true, + "dependencies": { + "@trysound/sax": "0.2.0", + "commander": "^7.2.0", + "css-select": "^5.1.0", + "css-tree": "^2.2.1", + "csso": "^5.0.5", + "picocolors": "^1.0.0" + }, + "bin": { + "svgo": "bin/svgo" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/svgo" + } + }, + "node_modules/svgo/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, "node_modules/tailwindcss": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.2.tgz", diff --git a/vue-m-ui/package.json b/vue-m-ui/package.json index c4d2fdb..dadd12e 100644 --- a/vue-m-ui/package.json +++ b/vue-m-ui/package.json @@ -1,6 +1,6 @@ { "name": "@prolazydev/vue-m", - "version": "0.1.2", + "version": "0.3.0", "private": false, "description": "UI components for Vue.js made with tailwind and ❤", "author": { @@ -41,7 +41,10 @@ "build:watch": "vue-tsc && vite build --watch", "build:style": "postcss ./src/style.css -o ./dist/vue-m.css", "build:style:watch": "postcss ./src/style.css -o ./dist/vue-m.css --watch", - "build:all": "npm run build && npm run build:style" + "build:all": "npm run build && npm run build:style", + "publish:patch": "npm version patch && npm run build && npm run build:style && npm publish", + "publish:minor": "npm version minor && npm run build && npm run build:style && npm publish", + "publish:major": "npm version major && npm run build && npm run build:style && npm publish" }, "peerDependencies": { "vue": "^3.2.0" @@ -53,6 +56,7 @@ "@types/node": "^20.1.3", "@vitejs/plugin-vue": "^4.1.0", "autoprefixer": "^10.4.14", + "cssnano": "^6.0.1", "path": "^0.12.7", "postcss": "^8.4.23", "postcss-cli": "^10.1.0", diff --git a/vue-m-ui/postcss.config.js b/vue-m-ui/postcss.config.js index 2e7af2b..77f8099 100644 --- a/vue-m-ui/postcss.config.js +++ b/vue-m-ui/postcss.config.js @@ -1,6 +1,11 @@ export default { plugins: { + cssnano: [ 'default', { + discardComments: { + removeAll: true, + }, + } ], tailwindcss: {}, autoprefixer: {}, }, -} +}; diff --git a/vue-m-ui/src/common/index.ts b/vue-m-ui/src/common/index.ts new file mode 100644 index 0000000..06f8661 --- /dev/null +++ b/vue-m-ui/src/common/index.ts @@ -0,0 +1,7 @@ +import { shapes, textColors } from "./styleProps"; + +export { + shapes, + textColors +}; + diff --git a/vue-m-ui/src/common/styleProps.ts b/vue-m-ui/src/common/styleProps.ts new file mode 100644 index 0000000..b32b16b --- /dev/null +++ b/vue-m-ui/src/common/styleProps.ts @@ -0,0 +1,25 @@ +export const shapes = { + 'default': 'm-general-shape-default', + 'round': 'm-general-shape-round', + 'box': 'm-general-shape-box', + 'pill': 'm-general-shape-pill', +}; + +export const textColors = { + 'default': '', + 'light': 'm-text-light', + 'dark': 'm-text-dark', + + 'primary': 'm-text-primary', + 'secondary': 'm-text-secondary', + 'success': 'm-text-success', + 'warning': 'm-text-warning', + 'danger': 'm-text-danger', + 'info': 'm-text-info', + + 'white': 'm-text-white', + 'black': 'm-text-black', + 'indigo': 'm-text-indigo', + 'purple': 'm-text-purple', + 'pink': 'm-text-pink', +}; diff --git a/vue-m-ui/src/components/index.ts b/vue-m-ui/src/components/index.ts index 26a8051..65abaf4 100644 --- a/vue-m-ui/src/components/index.ts +++ b/vue-m-ui/src/components/index.ts @@ -1,3 +1,4 @@ export { default as mBtn } from '@/components/m-btn/m-btn.vue'; export { default as mInput } from '@/components/m-input/m-input.vue'; +export { default as mSwitch } from '@/components/m-switch/m-switch.vue'; diff --git a/vue-m-ui/src/components/m-btn/m-btn.vue b/vue-m-ui/src/components/m-btn/m-btn.vue index 35780b9..3c03b4f 100644 --- a/vue-m-ui/src/components/m-btn/m-btn.vue +++ b/vue-m-ui/src/components/m-btn/m-btn.vue @@ -1,49 +1,37 @@ diff --git a/vue-m-ui/src/components/m-btn/props.ts b/vue-m-ui/src/components/m-btn/props.ts index 0d99e29..6492756 100644 --- a/vue-m-ui/src/components/m-btn/props.ts +++ b/vue-m-ui/src/components/m-btn/props.ts @@ -1,4 +1,4 @@ -export const btnStyles = { +export const btnColors = { default: 'm-btn m-btn-primary', primary: 'm-btn m-btn-primary', secondary: 'm-btn m-btn-secondary', @@ -23,51 +23,3 @@ export const btnSizes = { '2xl': 'm-btn-size-2xl', '3xl': 'm-btn-size-3xl', }; - -export const btnShapes = { - default: 'm-btn-shape-default', - square: 'm-btn-shape-square', - round: 'm-btn-shape-round', - pill: 'm-btn-shape-pill', -}; - -export const textColors = { - default: '', - - dark: 'm-text-dark', - light: 'm-text-light', - primary: 'm-text-primary', - secondary: 'm-text-secondary', - success: 'm-text-success', - clean: 'm-text-clean', - - white: 'm-text-white', - black: 'm-text-black', - indigo: 'm-text-indigo', - purple: 'm-text-purple', - pink: 'm-text-pink', -}; - -export function createLighterShades(color: any) { - let r, g, b, a; - if (color.startsWith('#')) { - // hex color - r = parseInt(color.slice(1, 3), 16); - g = parseInt(color.slice(3, 5), 16); - b = parseInt(color.slice(5, 7), 16); - a = 1; - } else if (color.startsWith('rgb')) { - // rgb or rgba color - const match = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/); - r = parseInt(match[ 1 ]); - g = parseInt(match[ 2 ]); - b = parseInt(match[ 3 ]); - a = match[ 4 ] ? parseFloat(match[ 4 ]) : 1; - } else - throw new Error('Invalid color format'); - - const factor = 0.2; // lighter shade factor - const shade1 = `rgba(${r + (255 - r) * factor}, ${g + (255 - g) * factor}, ${b + (255 - b) * factor}, ${a})`; - const shade2 = `rgba(${r + (255 - r) * factor * 2}, ${g + (255 - g) * factor * 2}, ${b + (255 - b) * factor * 2}, ${a})`; - return [ shade1, shade2 ]; -} \ No newline at end of file diff --git a/vue-m-ui/src/components/m-input/m-input.vue b/vue-m-ui/src/components/m-input/m-input.vue index 4e15463..79c4c59 100644 --- a/vue-m-ui/src/components/m-input/m-input.vue +++ b/vue-m-ui/src/components/m-input/m-input.vue @@ -1,37 +1,71 @@ - diff --git a/vue-m-ui/src/components/m-input/props.ts b/vue-m-ui/src/components/m-input/props.ts new file mode 100644 index 0000000..75f905a --- /dev/null +++ b/vue-m-ui/src/components/m-input/props.ts @@ -0,0 +1,38 @@ +export const colors = { + 'default': 'm-input-default', + 'light': 'm-input-light', + 'dark': 'm-input-dark', + + 'primary': 'm-input-primary', + 'secondary': 'm-input-secondary', + 'success': 'm-input-success', + 'warning': 'm-input-warning', + 'danger': 'm-input-danger', + 'info': 'm-input-info', + + 'indigo': 'm-input-indigo', + 'purple': 'm-input-purple', + 'pink': 'm-input-pink', +}; + +export const sizes = { + 'default': 'm-input-size-md', + '2xs': 'm-input-size-2xs', + 'xs': 'm-input-size-xs', + 'sm': 'm-input-size-sm', + 'md': 'm-input-size-md', + 'lg': 'm-input-size-lg', + 'xl': 'm-input-size-xl', + '2xl': 'm-input-size-2xl', +}; + +export const labelSizes = { + 'default': '1rem', + '2xs': '0.75rem', + 'xs': '0.75rem', + 'sm': '0.875rem', + 'md': '1rem', + 'lg': '1.125rem', + 'xl': '1.5rem', + '2xl': '1.875rem', +}; \ No newline at end of file diff --git a/vue-m-ui/src/components/m-switch/m-switch.vue b/vue-m-ui/src/components/m-switch/m-switch.vue new file mode 100644 index 0000000..7f54a71 --- /dev/null +++ b/vue-m-ui/src/components/m-switch/m-switch.vue @@ -0,0 +1,70 @@ + + + \ No newline at end of file diff --git a/vue-m-ui/src/components/m-switch/props.ts b/vue-m-ui/src/components/m-switch/props.ts new file mode 100644 index 0000000..49d795c --- /dev/null +++ b/vue-m-ui/src/components/m-switch/props.ts @@ -0,0 +1,44 @@ +export const colors = { + 'default': 'm-switch-primary', + 'light': 'm-switch-light', + 'dark': 'm-switch-dark', + + 'primary': 'm-switch-primary', + 'secondary': 'm-switch-secondary', + 'success': 'm-switch-success', + 'warning': 'm-switch-warning', + 'danger': 'm-switch-danger', + 'info': 'm-switch-info', + + 'indigo': 'm-switch-indigo', + 'purple': 'm-switch-purple', + 'pink': 'm-switch-pink', +}; + +export const knobColors = { + 'default': 'm-switch-default', + 'light': 'm-switch-light', + 'dark': 'm-switch-dark', + + 'primary': 'm-switch-primary', + 'secondary': 'm-switch-secondary', + 'success': 'm-switch-success', + 'warning': 'm-switch-warning', + 'danger': 'm-switch-danger', + 'info': 'm-switch-info', + + 'indigo': 'm-switch-indigo', + 'purple': 'm-switch-purple', + 'pink': 'm-switch-pink', +}; + +export const sizes = { + 'default': 'm-switch-size-md', + '2xs': 'm-switch-size-2xs', + 'xs': 'm-switch-size-xs', + 'sm': 'm-switch-size-sm', + 'md': 'm-switch-size-md', + 'lg': 'm-switch-size-lg', + 'xl': 'm-switch-size-xl', + '2xl': 'm-switch-size-2xl', +}; diff --git a/vue-m-ui/src/icons/loading-circle.vue b/vue-m-ui/src/icons/loading-circle.vue index cb633fb..93ce488 100644 --- a/vue-m-ui/src/icons/loading-circle.vue +++ b/vue-m-ui/src/icons/loading-circle.vue @@ -2,4 +2,4 @@ - + \ No newline at end of file diff --git a/vue-m-ui/src/icons/mail.vue b/vue-m-ui/src/icons/mail.vue new file mode 100644 index 0000000..d6d7153 --- /dev/null +++ b/vue-m-ui/src/icons/mail.vue @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/vue-m-ui/src/icons/password-icons.vue b/vue-m-ui/src/icons/password-icons.vue new file mode 100644 index 0000000..931b462 --- /dev/null +++ b/vue-m-ui/src/icons/password-icons.vue @@ -0,0 +1,19 @@ + + + diff --git a/vue-m-ui/src/icons/user.vue b/vue-m-ui/src/icons/user.vue index 1a32553..20651e7 100644 --- a/vue-m-ui/src/icons/user.vue +++ b/vue-m-ui/src/icons/user.vue @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/vue-m-ui/src/main.ts b/vue-m-ui/src/main.ts index 096fcdd..ac0f798 100644 --- a/vue-m-ui/src/main.ts +++ b/vue-m-ui/src/main.ts @@ -1,13 +1,12 @@ -import { mBtn, mInput } from "@/components"; +import { mBtn, mInput, mSwitch } from "@/components"; import type { App } from "vue"; export default { install: (app: App, options: any = {}) => { app.component('m-btn', mBtn) - app.component('m-input', mInput); + app.component('m-switch', mSwitch); } }; -export { mBtn, mInput }; - +export { mBtn, mInput, mSwitch }; diff --git a/vue-m-ui/src/style.css b/vue-m-ui/src/style.css index 6a3f85a..327d795 100644 --- a/vue-m-ui/src/style.css +++ b/vue-m-ui/src/style.css @@ -1,6 +1,29 @@ :root { --m-shadow-default: 0 0 #0000, 0 0 #0000, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); --m-shadow-none: 0 0 #0000, 0 0 #0000, 0 4px 6px -1px rgb(0 0 0 / 0.0), 0 2px 4px -2px rgb(0 0 0 / 0.0); + + --m-focus-shadow-border-thickness: 0 0 0 1.5px; + --m-focus-shadow-border-color: #f1f1f1; + + --m-input-icon-padding: 2.5rem; + --m-input-icon-w: 1.25rem; + --m-input-icon-h: 1.25rem; + + --m-switch-left: calc(100% - 1rem); + --m-switch-left-checked: calc(100% - 1rem); + + /* TODO: Recreate the colors as vars */ + /* COLORS */ + --m-bg-light: rgb(241 241 241); + --m-bg-dark: rgb(24 25 26); + --m-bg-dark-2: rgb(45, 45, 50); + --m-bg-dark-3: rgb(55, 55, 55); + + /* TODO: Create more colors */ + --m-color-lightPink: #ffccff; + + /* Switch colors */ + --m-switch-custom-knob-color: ''; } *{ @@ -10,7 +33,6 @@ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; - font-size: 100%; font-weight: 600; } @@ -19,7 +41,7 @@ @apply flex relative border-none font-semibold leading-6 active:shadow-none cursor-pointer disabled:pointer-events-none disabled:outline-none - ; +; box-shadow: var(--m-shadow-default); @@ -42,25 +64,39 @@ /* Button Disabled */ .m-btn:disabled { @apply select-none shadow-none; - /* filter: brightness(0.75) */ } .m-btn:disabled .m-btn-content { @apply opacity-30 select-none } /* Button Styles */ +.m-btn-light { + @apply m-text-dark bg-[#f1f1f1] hover:bg-zinc-100 active:bg-zinc-50 +} +.m-btn-light:focus-visible { + box-shadow: 0px 0px 0px 1.5px rgb(241 241 241); + outline-color: #404040; +} +.m-btn-dark { + @apply m-text-light bg-neutral-800 hover:bg-neutral-700 active:bg-neutral-600 +} +.m-btn-dark:focus-visible { + box-shadow: 0px 0px 0px 1.5px rgb(38 38 38); + outline-color: rgb(229 229 229); +} + .m-btn-primary { @apply m-text-light bg-blue-600 hover:bg-blue-500 active:bg-blue-400 } .m-btn-primary:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(37 99 235); + box-shadow: 0px 0px 0px 1.5px rgb(37 99 235); } .m-btn-secondary { @apply m-text-light bg-slate-600 hover:bg-slate-500 active:bg-slate-400 } .m-btn-secondary:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(71 85 105); + box-shadow: 0px 0px 0px 1.5px rgb(71 85 105); } .m-btn-success { @@ -68,59 +104,39 @@ shadow-emerald-600 } .m-btn-success:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(5 150 105); + box-shadow: 0px 0px 0px 1.5px rgb(5 150 105); } .m-btn-success:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(5 150 105); -} - -.m-btn-danger { - @apply m-text-light bg-red-600 hover:bg-red-500 active:bg-red-400 -} -.m-btn-danger:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(220 38 38); + box-shadow: 0px 0px 0px 1.5px rgb(5 150 105); } .m-btn-warning { @apply m-text-light bg-orange-600 hover:bg-orange-500 active:bg-orange-400 } .m-btn-warning:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(234 88 12); -} - -.m-btn-info { - @apply m-text-light bg-cyan-600 hover:bg-cyan-500 active:bg-cyan-400 -} -.m-btn-info:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(8 145 178); + box-shadow: 0px 0px 0px 1.5px rgb(234 88 12); } -.m-btn-light { - @apply m-text-dark bg-[#f1f1f1] hover:bg-zinc-100 active:bg-zinc-50 +.m-btn-danger { + @apply m-text-light bg-red-600 hover:bg-red-500 active:bg-red-400 } -.m-btn-light:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(241 241 241); - outline-color: #404040; +.m-btn-danger:focus-visible { + box-shadow: 0px 0px 0px 1.5px rgb(220 38 38); } -.m-btn-dark { - @apply m-text-light bg-neutral-800 hover:bg-neutral-700 active:bg-neutral-600 -} -.m-btn-dark:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(38 38 38); - outline-color: rgb(229 229 229); +.m-btn-info { + @apply m-text-light bg-cyan-600 hover:bg-cyan-500 active:bg-cyan-400 } - -.m-btn-pink:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(219 39 119); +.m-btn-info:focus-visible { + box-shadow: 0px 0px 0px 1.5px rgb(8 145 178); } .m-btn-indigo { @apply m-text-light bg-indigo-600 hover:bg-indigo-500 active:bg-indigo-400 } .m-btn-indigo:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(79 70 229); + box-shadow: 0px 0px 0px 1.5px rgb(79 70 229); } /* TODO: Glowing effect for all buttons */ /* .m-btn-indigo-glow { @@ -137,7 +153,7 @@ @apply m-text-light bg-purple-600 hover:bg-purple-500 active:bg-purple-400 } .m-btn-purple:focus-visible { - box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(147 51 234); + box-shadow: 0px 0px 0px 1.5px rgb(147 51 234); } .m-btn-pink { @@ -147,7 +163,6 @@ box-shadow: 0px 0px 0px white, 0px 0px 0px 1.5px rgb(219 39 119); } - /* Button Sizes */ .m-btn-size-xs { @apply px-1 py-1 text-xs leading-4 @@ -171,90 +186,566 @@ @apply px-11 py-10 text-5xl leading-6 outline-2 outline-offset-[-4px] } -/* Button shapes */ -.m-btn-shape-default { - @apply rounded-md -} -.m-btn-shape-square { - @apply rounded-none -} -.m-btn-shape-round { - @apply rounded-full -} -.m-btn-shape-pill { - @apply rounded-2xl -} - /* Button Transparency */ .m-btn-transparent { @apply bg-opacity-0 text-black hover:bg-opacity-70 } - +/* Button Content */ .m-btn-content { @apply transition-[opacity] } /* Input */ .m-input-main { - @apply h-[34px] -} - -.m-input-content { - @apply relative h-full + @apply flex flex-col text-base font-normal transition-[opacity] } .m-input { - @apply pl-10 py-2 px-2 w-full border-[#6b7280] border border-solid rounded-md shadow-md + @apply w-full border border-solid shadow-md transition-shadow outline outline-2 outline-transparent - focus:shadow-none focus:border-blue-600 - ; + focus:shadow-none focus:border-blue-600 z-10 + ; + font-weight: inherit; height: -webkit-fill-available; } +.m-input:disabled { + @apply select-none shadow-none opacity-30; +} -.m-input:focus { - box-shadow: 0px 0px 0px white, 0 0 0px 1px #2563eb; +.m-input-container { + @apply w-full flex flex-col relative; + font-weight: inherit; } -.m-input::placeholder { - @apply absolute top-[5px] left-[40.5px] +.m-input-container:disabled { + @apply overflow-hidden +} + +/* For email inputs */ +.m-input-email-progress-bar { + @apply w-[90%] h-2 m-auto mt-2 rounded-3xl translate-y-[-25px] shadow transition-all; +} +.m-input:focus ~ .m-input-email-progress-bar { + @apply translate-y-0; +} + +.m-animation-shake-error { + animation: shakeError 0.82s cubic-bezier(.36,.07,.19,.97) 0s 1 normal forwards; +} + +@keyframes shakeError { + 10%, 90% { + transform: translate3d(-1px, 0, 0); + } + + 20%, 80% { + transform: translate3d(2px, 0, 0); + } + + 30%, 50%, 70% { + transform: translate3d(-4px, 0, 0); + } + + 40%, 60% { + transform: translate3d(4px, 0, 0); + } +} + +/* Input Sizes */ +.m-input-size-2xs { + @apply py-[2px] px-1 text-xs ; + --m-input-icon-padding: 1.75rem; +} +.m-input-size-2xs ~ .m-icon { + @apply left-1; + --m-input-icon-w: 1rem; + --m-input-icon-h: 1rem; +} +.m-input-size-2xs ~ .m-input-label { + background: red +} +.m-input-size-2xs ~ .m-input-border { + @apply left-[24px] h-3 w-[1px] pointer-events-none; +} + +.m-input-size-xs { + @apply py-1 px-2 text-xs leading-5; + --m-input-icon-padding: 1.75rem; +} +.m-input-size-xs ~ .m-icon { + --m-input-icon-w: 1rem; + --m-input-icon-h: 1rem; +} +.m-input-size-xs ~ .m-input-border { + @apply left-6 h-4 w-[1px]; +} + +.m-input-size-sm { + @apply py-1 px-2 text-sm; + --m-input-icon-padding: 2rem; +} +.m-input-size-sm ~ .m-input-border { + @apply left-7 h-4 +} + +.m-input-size-md { + @apply py-[7px] px-2 text-base; + --m-input-icon-padding: 2.55rem; +} +.m-input-size-md ~ .m-input-border { + @apply left-[34px] h-[22px]; + +} +.m-input-size-md ~ .m-icon { + --m-input-icon-w: 1.5rem; + --m-input-icon-h: 1.5rem; } +.m-input-size-lg { + @apply py-2 p-3 text-lg; + --m-input-icon-padding: 3rem; +} +.m-input-size-lg ~ .m-icon { + --m-input-icon-w: 2rem; + --m-input-icon-h: 2rem; +} +.m-input-size-lg ~ .m-input-border { + @apply left-10 h-7 +} + +.m-input-size-xl { + @apply py-3 p-4 text-2xl border-2; + --m-focus-shadow-border-thickness: 0 0 0 2px; + --m-input-icon-padding: 4rem; +} +.m-input-size-xl ~ .m-icon { + @apply left-2; + --m-input-icon-w: 2.6rem; + --m-input-icon-h: 2.6rem; +} +.m-input-size-xl ~ .m-input-border { + @apply left-14 h-9 w-[2px]; +} + +.m-input-size-2xl { + @apply py-4 p-5 text-3xl leading-4 border-4; + --m-focus-shadow-border-thickness: 0 0 0 2.5px; + --m-input-icon-padding: 5rem; +} +.m-input-size-2xl ~ .m-icon { + @apply left-3; + --m-input-icon-w: 3.25rem; + --m-input-icon-h: 3.25rem; +} +.m-input-size-2xl ~ .m-input-border { + @apply left-[70px] h-11 w-[2px]; +} + +/* .m-input:focus { + box-shadow: 0 0 0px 1px #2563eb; +} */ + +/* TODO: fix placeholder */ +/* .m-input::placeholder { + @apply absolute top-[5px] left-[40.5px] +} */ + .m-input-border { - @apply h-5 w-[1px] absolute top-[7px] left-8 border-gray-500 z-10 bg-gray-600 + @apply h-5 w-[1px] absolute left-8 border-gray-500 z-10 bg-gray-600; + top: 50%; + transform: translateY(-50%) +} + +.m-input-label { + @apply text-left; + + font-weight: inherit; +} + +/* Input Colors */ +.m-input-default { + @apply border-[#6b7280]; +} +.m-input-default:focus { + @apply border-blue-600; + box-shadow: var(--m-focus-shadow-border-thickness) #2563eb; +} + +.m-input-primary { + @apply text-blue-600 placeholder:text-blue-300 border-blue-600 +} +.m-input-primary:focus { + @apply border-blue-600; + box-shadow: var(--m-focus-shadow-border-thickness) #2563eb; +} + +.m-input-secondary { + @apply text-gray-600 placeholder:text-gray-300 border-[#bbbbbb]; +} +.m-input-secondary:focus { + @apply border-[#bbbbbb]; + box-shadow: var(--m-focus-shadow-border-thickness) #bbbbbb; +} + +.m-input-success { + @apply text-emerald-600 placeholder:text-emerald-300 border-emerald-600; +} +.m-input-success:focus { + @apply border-emerald-600; + box-shadow: 0px 0px 0px 1.5px rgb(5, 150, 105); +} + +.m-input-danger { + @apply text-red-600 placeholder:text-red-300 border-red-600; +} +.m-input-danger:focus { + @apply border-red-600; + box-shadow: var(--m-focus-shadow-border-thickness) #dc2626; +} + +.m-input-warning { + @apply text-orange-600 placeholder:text-orange-300 border-orange-600; +} +.m-input-warning:focus { + @apply border-orange-600; + box-shadow: var(--m-focus-shadow-border-thickness) #ea580c; +} + +.m-input-info { + @apply text-cyan-600 placeholder:text-cyan-300 border-cyan-600; +} +.m-input-info:focus { + @apply border-cyan-600; + box-shadow: var(--m-focus-shadow-border-thickness) #0891b2; +} + +.m-input-dark { + @apply text-neutral-800 placeholder:text-neutral-300 border-neutral-800; +} +.m-input-dark:focus { + @apply border-neutral-800; + box-shadow: var(--m-focus-shadow-border-thickness) #262626; +} + +.m-input-light { + @apply text-neutral-100 placeholder:text-neutral-300 border-neutral-100 bg-transparent; +} +.m-input-light:focus { + @apply border-neutral-100 bg-transparent; + box-shadow: var(--m-focus-shadow-border-thickness) #f5f5f5; +} + +.m-input-indigo { + @apply text-indigo-600 placeholder:text-indigo-300 border-indigo-600; +} +.m-input-indigo:focus { + @apply border-indigo-600; + box-shadow: var(--m-focus-shadow-border-thickness) #4f46e5; +} + +.m-input-purple { + @apply text-cyan-600 placeholder:text-cyan-300 border-cyan-600; +} +.m-input-purple:focus { + @apply border-cyan-600; + box-shadow: var(--m-focus-shadow-border-thickness) #0891b2; +} + +.m-input-pink { + @apply text-pink-600 placeholder:text-pink-300 border-pink-600; +} +.m-input-pink:focus { + @apply border-pink-600; + box-shadow: var(--m-focus-shadow-border-thickness) #db2777; +} + +/* Input Icon */ +.m-input-icon { + padding-left: var(--m-input-icon-padding); } /* Icons */ .m-icon { - @apply w-5 h-5 absolute left-[5.5px] top-[8px] + @apply absolute left-[5.5px] pointer-events-none; + + width: var(--m-input-icon-w); + height: var(--m-input-icon-h); + + top: 50%; + transform: translateY(-47.5%) +} + +.m-icon-bold { + @apply stroke-2 +} + +.m-icons-eye { + @apply absolute w-5 h-5 z-10 top-2/4 right-2 translate-y-[-50%] cursor-pointer } /* Loading */ .m-loading { - @apply relative pointer-events-none opacity-30 + @apply relative pointer-events-none opacity-30 } /* Loading Icons */ .loading-icon { - @apply w-6 h-6 m-center-absolute text-white stroke-2 + @apply w-3/4 h-3/4 m-center-absolute text-white stroke-2 +} + +.m-loading-icon-handle { + @apply absolute w-full h-full bg-black/75 +} + +/* Switch */ +.m-switch { + @apply relative cursor-pointer appearance-none rounded transition-all + outline outline-1 outline-transparent outline-offset-0 + focus-visible:outline-white active:shadow-none + disabled:pointer-events-none disabled:shadow-none disabled:filter disabled:brightness-[75%] +; + + /* TODO: Match the shadow color with the switch color on focus visible */ + box-shadow: var(--m-shadow-default); +} +.m-switch::before { + @apply block absolute content-[''] top-2/4 translate-y-[-50%] rounded cursor-pointer transition-[left,width,height,filter,background-color] + bg-[#f1f1f1] border-none +; + left: var(--m-switch-left); +} + +/* Switch Colors */ +.m-switch-light { + @apply bg-[#f1f1f1] focus-within:outline-[var(--m-bg-dark-2)]; + --m-focus-shadow-border-color: #f1f1f1; +} +.m-switch-light::before { + @apply bg-[var(--m-bg-dark-2)]; +} + +.m-switch-dark { + @apply bg-slate-600; + --m-focus-shadow-border-color: #475569; } +.m-switch-primary { + @apply bg-blue-600; + --m-focus-shadow-border-color: #2563eb; +} + +.m-switch-secondary { + @apply bg-slate-600; + --m-focus-shadow-border-color: #475569; +} +.m-switch-success { + @apply bg-emerald-600; + --m-focus-shadow-border-color: #059669; +} +.m-switch-warning { + @apply bg-orange-600; + --m-focus-shadow-border-color: #ea580c; +} +.m-switch-danger { + @apply bg-red-600; + --m-focus-shadow-border-color: #dc2626; +} +.m-switch-info { + @apply bg-cyan-600; + --m-focus-shadow-border-color: #0891b2; +} +.m-switch-indigo { + @apply bg-indigo-600; + --m-focus-shadow-border-color: #4e46e5; +} +.m-switch-purple { + @apply bg-purple-600; + --m-focus-shadow-border-color: #9333ea; +} +.m-switch-pink { + @apply bg-pink-600; + --m-focus-shadow-border-color: #db2777; +} + +.m-switch-custom-color::before { + @apply bg-[var(--m-switch-custom-knob-color)] +} + +/* Switch Sizes */ +.m-switch-size-2xs { + @apply h-2 w-8; + --m-switch-left-checked: calc(100% - 6px); +} +.m-switch-size-2xs::before { + @apply h-1 w-1; + --m-switch-left: 2px; +} +.m-switch-size-2xs:active::before { + width: calc( 0.75rem + 5% ); +} +.m-switch-size-2xs:checked::before { + --m-switch-left-checked: calc(100% - 6px); + left: var(--m-switch-left-checked); +} +.m-switch-size-2xs:active:checked::before { + left: calc( 100% - 0.90rem - 5% ); +} +.m-switch-size-2xs:focus-visible { + box-shadow: 0px 0px 0px 3px var(--m-focus-shadow-border-color); +} + +.m-switch-size-xs { + @apply h-4 w-9; + --m-switch-left-checked: calc(100% - 14.5px); +} +.m-switch-size-xs::before { + @apply h-3 w-3 ; + --m-switch-left: 2.5px; +} +.m-switch-size-xs:active::before { + width: calc( 1rem + 5% ); +} +.m-switch-size-xs:checked::before { + --m-switch-left-checked: calc(100% - 14.5px); + left: var(--m-switch-left-checked); +} +.m-switch-size-xs:active:checked::before { + left: calc(100% - 1.15rem - 5%); +} +.m-switch-size-xs:focus-visible { + box-shadow: 0px 0px 0px 3px var(--m-focus-shadow-border-color); +} + +.m-switch-size-sm { + @apply h-5 w-10; + --m-switch-left-checked: calc(100% - 1rem); +} +.m-switch-size-sm::before { + @apply h-3 w-3 ; + --m-switch-left: 0.25rem; +} +.m-switch-size-sm:active::before { + width: calc( 1rem + 5% ); +} +.m-switch-size-sm:checked::before { + left: var(--m-switch-left-checked); +} +.m-switch-size-sm:active:checked::before { + left: calc(100% - 1.25rem - 5%); +} +.m-switch-size-sm:focus-visible { + box-shadow: 0px 0px 0px 3px var(--m-focus-shadow-border-color); +} + +.m-switch-size-md { + @apply h-7 w-12; + --m-switch-left-checked: calc(100% - 1.3rem); +} +.m-switch-size-md::before { + @apply h-5 w-4 ; + --m-switch-left: calc(0% + 0.3rem); +} +.m-switch-size-md:active::before { + width: calc( 1.25rem + 5% ); +} +.m-switch-size-md:checked::before { + left: var(--m-switch-left-checked); +} +.m-switch-size-md:active:checked::before { + left: calc(100% - 1.55rem - 5%); +} +.m-switch-size-md:focus-visible { + box-shadow: 0px 0px 0px 3px var(--m-focus-shadow-border-color); +} + +.m-switch-size-lg { + @apply h-10 w-16; + --m-switch-left-checked: calc(100% - 1.825rem); +} +.m-switch-size-lg::before { + @apply h-8 w-6 ; + --m-switch-left: calc(0% + 0.3rem); +} +.m-switch-size-lg:active::before { + width: calc( 1.75rem + 5% ); +} +.m-switch-size-lg:checked::before { + left: var(--m-switch-left-checked); +} +.m-switch-size-lg:active:checked::before { + left: calc(100% - 2.0575rem - 5%); +} +.m-switch-size-lg:focus-visible { + box-shadow: 0px 0px 0px 4px var(--m-focus-shadow-border-color); +} + +.m-switch-size-xl { + @apply h-14 w-[5.5rem] outline-2; + --m-switch-left-checked: calc(100% - 2.75rem); +} +.m-switch-size-xl::before { + @apply h-9 w-8; + --m-switch-left: 0.75rem; +} +.m-switch-size-xl:active::before { + width: calc( 2.25rem + 5% ); +} +.m-switch-size-xl:checked::before { + left: var(--m-switch-left-checked); +} +.m-switch-size-xl:active:checked::before { + left: calc(100% - 3rem - 5%); +} +.m-switch-size-xl:focus-visible { + box-shadow: 0px 0px 0px 5px var(--m-focus-shadow-border-color); +} + +/* Switch Loading Animation */ +@keyframes switchLoading { + to { left: var(--m-switch-left-checked) } +} +.m-switch-loading { + @apply pointer-events-none shadow-none; +} +.m-switch-loading:checked::before { + left: var(--m-switch-left); +} +/* NOTE: This is needed for the animation to not jump on the initial position based on checked state */ +.m-switch-loading::before { + animation: switchLoading 0.5s ease-in-out 0s infinite alternate; +} +.m-switch-loading:checked::before { + animation: switchLoading 0.5s ease-in-out 0s infinite alternate-reverse; +} + + /* General */ /* General Text Colors */ -.m-text-dark { - @apply text-[#18191A] -} .m-text-light { @apply text-[#f2f2f2] } +.m-text-dark { + @apply text-[#18191A] placeholder:text-zinc-300 +} + .m-text-primary { - @apply text-sky-400 + @apply text-sky-600 } .m-text-secondary { @apply text-[#bbbbbb] } .m-text-success { - @apply text-emerald-300; + @apply text-emerald-600; +} +.m-text-warning { + @apply text-orange-600; +} +.m-text-danger { + @apply text-red-600; +} +.m-text-info { + @apply text-cyan-600; } .m-text-white { @@ -273,6 +764,25 @@ @apply text-pink-600 } +/* General Text Boldness */ +.m-text-bold { + @apply font-bold +} + +/* General Shapes */ +.m-general-shape-default { + @apply rounded-md +} +.m-general-shape-round { + @apply rounded-full +} +.m-general-shape-box { + @apply rounded-none +} +.m-general-shape-pill { + @apply rounded-2xl +} + /* Util Classes */ .m-center-absolute { position: absolute; diff --git a/vue-m-ui/src/utils/index.ts b/vue-m-ui/src/utils/index.ts index 0d24ec6..ab04f37 100644 --- a/vue-m-ui/src/utils/index.ts +++ b/vue-m-ui/src/utils/index.ts @@ -1,8 +1,58 @@ import { defineAsyncComponent } from "vue"; -export function dynamicSVG(name: String) { - if (name) +export function dynamicSVG(name: String): boolean | any { + if (name) return defineAsyncComponent(() => import(`@/icons/${name}.vue`)); return false; +} + +export function createLighterShades(color: any) { + let r, g, b, a; + if (color.startsWith('#')) { + // hex color + r = parseInt(color.slice(1, 3), 16); + g = parseInt(color.slice(3, 5), 16); + b = parseInt(color.slice(5, 7), 16); + a = 1; + } else if (color.startsWith('rgb')) { + // rgb or rgba color + const match = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/); + r = parseInt(match[ 1 ]); + g = parseInt(match[ 2 ]); + b = parseInt(match[ 3 ]); + a = match[ 4 ] ? parseFloat(match[ 4 ]) : 1; + } else + throw new Error('Invalid color format'); + + const factor = 0.2; // lighter shade factor + const shade1 = `rgba(${r + (255 - r) * factor}, ${g + (255 - g) * factor}, ${b + (255 - b) * factor}, ${a})`; + const shade2 = `rgba(${r + (255 - r) * factor * 2}, ${g + (255 - g) * factor * 2}, ${b + (255 - b) * factor * 2}, ${a})`; + return [ shade1, shade2 ]; +} + +export function isValidEmail(email: string = '') { + // RFC 5322 standard + const emailPattern = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/; + // const emailPattern = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; + return emailPattern.test(email); +} + +export function isColorDark(color: string) { + // Convert hexadecimal or RGB color to RGB values + let rgb: number [] = []; + if (color.startsWith('#')) + rgb = [ + parseInt(color.slice(1, 3), 16), + parseInt(color.slice(3, 5), 16), + parseInt(color.slice(5, 7), 16) + ]; + else if (color.startsWith('rgb(')) + rgb = (color.match(/\d+/g) || []).map(Number); + + // Calculate relative luminance + const luminance = (0.2126 * rgb[ 0 ] + 0.7152 * rgb[ 1 ] + 0.0722 * rgb[ 2 ]) / 255; + + // Compare with threshold (0.5 is commonly used) + return luminance <= 0.5; } \ No newline at end of file diff --git a/vue-m-web/package.json b/vue-m-web/package.json index 0379efe..54c2884 100644 --- a/vue-m-web/package.json +++ b/vue-m-web/package.json @@ -9,16 +9,17 @@ "preview": "vite preview" }, "engines": { - "node": ">=18" - }, + "node": ">=18" + }, "dependencies": { - "@prolazydev/vue-m": "^0.1.4", + "@prolazydev/vue-m": "^0.3.0", "vue": "^3.2.47" }, "devDependencies": { "@types/node": "^20.2.5", "@vitejs/plugin-vue": "^4.1.0", "autoprefixer": "^10.4.14", + "cssnano": "^6.0.1", "path": "^0.12.7", "postcss": "^8.4.23", "tailwindcss": "^3.3.2", diff --git a/vue-m-web/postcss.config.js b/vue-m-web/postcss.config.js index 2e7af2b..e73b81a 100644 --- a/vue-m-web/postcss.config.js +++ b/vue-m-web/postcss.config.js @@ -1,6 +1,7 @@ export default { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} + plugins: { + tailwindcss: {}, + autoprefixer: {}, + ...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {}), + }, +}; diff --git a/vue-m-web/src/App.vue b/vue-m-web/src/App.vue index 1b273ab..c4ac09e 100644 --- a/vue-m-web/src/App.vue +++ b/vue-m-web/src/App.vue @@ -4,18 +4,39 @@

-
+
-
-

+

+

Button

- {{ color?.name }}
+
+

+ Input +

+
+ + +
+
+ +
+

+ Switch +

+
+ +

{{ switchVal }}

+
+
@@ -28,7 +49,10 @@ import { Color } from './types'; const color = ref({ name: 'default', color: 'default' }); const btn_el = ref(); const elIntervalId = ref(); +const switchVal = ref(false); +const inputShowcaseValue = ref(''); +const persist = ref(false); onMounted(() => { const mainTitle = document.getElementById('mainTitle')!; const uiElements = document.getElementsByClassName('m-el')!; @@ -48,6 +72,8 @@ onMounted(() => { for (let i = 0; i < uiElements.length; i++) uiElements[ i ].addEventListener('mouseleave', () => clearInterval(elIntervalId.value)); + + // TODO: #2f4f4f for the light bg on input }); diff --git a/vue-m-web/src/components/AllElements.vue b/vue-m-web/src/components/AllElements.vue new file mode 100644 index 0000000..9fa144e --- /dev/null +++ b/vue-m-web/src/components/AllElements.vue @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/vue-m-web/src/style.css b/vue-m-web/src/style.css index 4e044a1..de210fd 100644 --- a/vue-m-web/src/style.css +++ b/vue-m-web/src/style.css @@ -40,6 +40,12 @@ body { /* REUSABLE Classes */ .m-el { - @apply w-48 p-10 flex flex-col gap-10 text-center justify-center items-center font-semibold text-2xl - backdrop-blur-sm border-[6px] shadow-md hover:shadow-none transition-all + @apply min-w-[12rem] p-10 flex flex-col gap-10 text-center justify-center items-center font-semibold text-2xl + backdrop-blur-sm border-[6px] shadow-md hover:shadow-none transition-all; } + + +.m-el-name { + @apply cursor-pointer underline-offset-[6px] underline hover:underline-offset-2 select-none transition-all duration-[250ms]; +} + diff --git a/vue-m-web/src/utils/index.ts b/vue-m-web/src/utils/index.ts index 4944242..985b1e4 100644 --- a/vue-m-web/src/utils/index.ts +++ b/vue-m-web/src/utils/index.ts @@ -2,7 +2,6 @@ import { Color } from "../types"; export function bgMouseTracking() { var factor = 10; - const app = document.getElementById('app')!; document.onmousemove = function (e) {