q-colorize-mixin
Advanced tools
Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3
/*! | ||
* q-colorize-mixin v1.0.0-alpha.2 | ||
* q-colorize-mixin v1.0.0-alpha.3 | ||
* (c) 2019 Jeff Galbraith <jeff@quasar.dev> | ||
* Released under the MIT License. | ||
*/ | ||
"use strict";var version="1.0.0-alpha.2",CSS_COLOR_NAMES=["transparent","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],QColorizeMixin={name:"QColorizeMixin",props:{color:String},methods:{isNamedCssColor:function(e){return!!e&&CSS_COLOR_NAMES.includes(e.toLowerCase())},isCssColor:function(e){return!!e&&(!!e.match(/^(#|(rgb|hsl)a?\()/)||this.isNamedCssColor(e))},isCssVar:function(e){return!!e&&e.startsWith("--")},calculateColor:function(e,r){return void 0===r&&(r="black"),void 0===e&&void 0!==r?this.calculateColor(r):this.isCssColor(e)?e:this.makeQuasarColorVar(e,r)},makeQuasarColorVar:function(e,r){return"var("+(this.isCssVar(e)?e:"--q-color-"+e)+", '"+r+"')"},isValidCssColor:function(e){return this.isCssColor(e)||this.isCssVar(e)},setBothColors:function(e,r,l){return void 0===l&&(l={}),this.setTextColor(e,this.setBackgroundColor(r,l))},setBackgroundColor:function(e,r){var l;if(void 0===r&&(r={}),this.isValidCssColor(e)){var o=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"background-color":""+o})}else if(e){var i=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((l={})["bg-"+i]=!0,l))}return r},setTextColor:function(e,r){var l;if(void 0===r&&(r={}),this.isValidCssColor(e)){var o=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{color:""+o,"caret-color":""+o})}else if(e){var i=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((l={})["text-"+i]=!0,l))}return r},setBorderColor:function(e,r){var l;if(void 0===r&&(r={}),this.isValidCssColor(e)){var o=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"border-color":""+o})}else if(e){var i=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((l={})["border-"+i]=!0,l))}return r}}};QColorizeMixin.version=version,module.exports=QColorizeMixin; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version="1.0.0-alpha.3",CSS_COLOR_NAMES=["transparent","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],QColorizeMixin={name:"QColorizeMixin",props:{color:String},methods:{isNamedCssColor:function(e){return!!e&&CSS_COLOR_NAMES.includes(e.toLowerCase())},isCssColor:function(e){return!!e&&(!!e.match(/^(#|(rgb|hsl)a?\()/)||this.isNamedCssColor(e))},isCssVar:function(e){return!!e&&e.startsWith("--")},calculateColor:function(e,r){return void 0===r&&(r="black"),void 0===e&&void 0!==r?this.calculateColor(r):this.isCssColor(e)?e:this.makeQuasarColorVar(e,r)},makeQuasarColorVar:function(e,r){return"var("+(this.isCssVar(e)?e:"--q-color-"+e)+", '"+r+"')"},isValidCssColor:function(e){return this.isCssColor(e)||this.isCssVar(e)},setBothColors:function(e,r,o){return void 0===o&&(o={}),this.setTextColor(e,this.setBackgroundColor(r,o))},setBackgroundColor:function(e,r){var o;if(void 0===r&&(r={}),this.isValidCssColor(e)){var i=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"background-color":""+i})}else if(e){var l=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["bg-"+l]=!0,o))}return r},setTextColor:function(e,r){var o;if(void 0===r&&(r={}),this.isValidCssColor(e)){var i=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{color:""+i,"caret-color":""+i})}else if(e){var l=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["text-"+l]=!0,o))}return r},setBorderColor:function(e,r){var o;if(void 0===r&&(r={}),this.isValidCssColor(e)){var i=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"border-color":""+i})}else if(e){var l=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["border-"+l]=!0,o))}return r}}};QColorizeMixin.version=version;var index={QColorizeMixin:QColorizeMixin,version:version,install:function(e){e.component(QColorizeMixin.name,QColorizeMixin)}};exports.QColorizeMixin=QColorizeMixin,exports.default=index; |
/*! | ||
* q-colorize-mixin v1.0.0-alpha.2 | ||
* q-colorize-mixin v1.0.0-alpha.3 | ||
* (c) 2019 Jeff Galbraith <jeff@quasar.dev> | ||
* Released under the MIT License. | ||
*/ | ||
var version="1.0.0-alpha.2",CSS_COLOR_NAMES=["transparent","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],QColorizeMixin={name:"QColorizeMixin",props:{color:String},methods:{isNamedCssColor:function(e){return!!e&&CSS_COLOR_NAMES.includes(e.toLowerCase())},isCssColor:function(e){return!!e&&(!!e.match(/^(#|(rgb|hsl)a?\()/)||this.isNamedCssColor(e))},isCssVar:function(e){return!!e&&e.startsWith("--")},calculateColor:function(e,r){return void 0===r&&(r="black"),void 0===e&&void 0!==r?this.calculateColor(r):this.isCssColor(e)?e:this.makeQuasarColorVar(e,r)},makeQuasarColorVar:function(e,r){return"var("+(this.isCssVar(e)?e:"--q-color-"+e)+", '"+r+"')"},isValidCssColor:function(e){return this.isCssColor(e)||this.isCssVar(e)},setBothColors:function(e,r,l){return void 0===l&&(l={}),this.setTextColor(e,this.setBackgroundColor(r,l))},setBackgroundColor:function(e,r){var l;if(void 0===r&&(r={}),this.isValidCssColor(e)){var o=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"background-color":""+o})}else if(e){var i=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((l={})["bg-"+i]=!0,l))}return r},setTextColor:function(e,r){var l;if(void 0===r&&(r={}),this.isValidCssColor(e)){var o=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{color:""+o,"caret-color":""+o})}else if(e){var i=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((l={})["text-"+i]=!0,l))}return r},setBorderColor:function(e,r){var l;if(void 0===r&&(r={}),this.isValidCssColor(e)){var o=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"border-color":""+o})}else if(e){var i=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((l={})["border-"+i]=!0,l))}return r}}};QColorizeMixin.version=version;export default QColorizeMixin;export{QColorizeMixin}; | ||
var version="1.0.0-alpha.3",CSS_COLOR_NAMES=["transparent","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],QColorizeMixin={name:"QColorizeMixin",props:{color:String},methods:{isNamedCssColor:function(e){return!!e&&CSS_COLOR_NAMES.includes(e.toLowerCase())},isCssColor:function(e){return!!e&&(!!e.match(/^(#|(rgb|hsl)a?\()/)||this.isNamedCssColor(e))},isCssVar:function(e){return!!e&&e.startsWith("--")},calculateColor:function(e,r){return void 0===r&&(r="black"),void 0===e&&void 0!==r?this.calculateColor(r):this.isCssColor(e)?e:this.makeQuasarColorVar(e,r)},makeQuasarColorVar:function(e,r){return"var("+(this.isCssVar(e)?e:"--q-color-"+e)+", '"+r+"')"},isValidCssColor:function(e){return this.isCssColor(e)||this.isCssVar(e)},setBothColors:function(e,r,o){return void 0===o&&(o={}),this.setTextColor(e,this.setBackgroundColor(r,o))},setBackgroundColor:function(e,r){var o;if(void 0===r&&(r={}),this.isValidCssColor(e)){var i=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"background-color":""+i})}else if(e){var l=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["bg-"+l]=!0,o))}return r},setTextColor:function(e,r){var o;if(void 0===r&&(r={}),this.isValidCssColor(e)){var i=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{color:""+i,"caret-color":""+i})}else if(e){var l=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["text-"+l]=!0,o))}return r},setBorderColor:function(e,r){var o;if(void 0===r&&(r={}),this.isValidCssColor(e)){var i=this.calculateColor(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"border-color":""+i})}else if(e){var l=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["border-"+l]=!0,o))}return r}}};QColorizeMixin.version=version;var index={QColorizeMixin:QColorizeMixin,version:version,install:function(e){e.component(QColorizeMixin.name,QColorizeMixin)}};export default index;export{QColorizeMixin}; |
{ | ||
"name": "q-colorize-mixin", | ||
"version": "1.0.0-alpha.2", | ||
"version": "1.0.0-alpha.3", | ||
"author": "Jeff Galbraith <jeff@quasar.dev>", | ||
@@ -8,10 +8,5 @@ "description": "Quasar color mixin", | ||
"module": "dist/index.esm.js", | ||
"main": "dist/quasar.common.js", | ||
"main": "dist/index.common.js", | ||
"scripts": { | ||
"dev": "cd dev; yarn dev; cd ..", | ||
"dev:umd": "yarn build && node build/script.open-umd.js", | ||
"dev:ssr": "cd dev; yarn 'dev:ssr'; cd ..", | ||
"dev:ios": "cd dev; yarn 'dev:ios'; cd ..", | ||
"dev:android": "cd dev; yarn 'dev:android'; cd ..", | ||
"dev:electron": "cd dev; yarn 'dev:electron'; cd ..", | ||
"build": "node build/index.js", | ||
@@ -46,8 +41,7 @@ "build:js": "node build/script.javascript.js", | ||
"quasar", | ||
"quasar-framework", | ||
"quasarframework", | ||
"vue", | ||
"mix-in", | ||
"mixin", | ||
"color", | ||
"background-color", | ||
"theme" | ||
"background-color" | ||
], | ||
@@ -54,0 +48,0 @@ "browserslist": [ |
103
README.md
@@ -1,55 +0,50 @@ | ||
# Component QColorizeMixin | ||
# QColorizeMixin | ||
<img src="https://img.shields.io/npm/v/q-colorize-mixin.svg?label=q-colorize-mixin"> | ||
<img src="https://img.shields.io/npm/v/mixin.svg?label=mixin"> | ||
# Component QColorizeMixin | ||
> Short description of the component | ||
QColorizeMixin | ||
=== | ||
QColorizeMixin is a Vue Mix-in library for components created with Quasar Framework. It is only for components that use a `render` function. It does not work with template formats found with SFC (single file components). | ||
# Usage | ||
# Features | ||
## Quasar CLI project | ||
Allows you to "skin" your component with customized text, background and border colors. You can use: | ||
1. any color from the [Quasar Color Palette](https://quasar.dev/style/color-palette#Color-List), | ||
2. any # color (ex: `#c0c0c0`), | ||
3. rgb/rgba/hsl/hsla color (ex: `rgb(255,0,0)`), | ||
4. any css named colors (ex: `ghostwhite`) or | ||
5. any Quasar colors from css var (ex: `--q-color-red-10`) | ||
6. any Quasar colors as `border-` (ex: `border-blue-grey-10`) | ||
```js | ||
import Vue from 'vue' | ||
import QColorizeMixin from 'q-colorize-mixin' | ||
This is a lot of choices! | ||
Vue.use(QColorizeMixin) | ||
``` | ||
# Install | ||
To add this mix-in to your Quasar application, run the following (in your Quasar app folder): | ||
or: | ||
```bash | ||
yarn add q-colorize-mixin | ||
```js | ||
<script> | ||
import QColorizeMixin from 'q-colorize-mixin' | ||
# or | ||
export default { | ||
components: { | ||
QColorizeMixin | ||
} | ||
} | ||
</script> | ||
npm install q-colorize-mixin | ||
``` | ||
## UMD variant | ||
# Uninstall | ||
To remove this mix-in from your Quasar application, run the following (in your Quasar app folder): | ||
Exports `window.QColorizeMixin`. | ||
```bash | ||
yarn remove q-colorize-mixin | ||
Add the following tag(s) after the Quasar ones: | ||
# or | ||
```html | ||
<head> | ||
<!-- AFTER the Quasar stylesheet tags: --> | ||
<link href="https://cdn.jsdelivr.net/npm/q-colorize-mixin/dist/index.min.css" rel="stylesheet" type="text/css"> | ||
</head> | ||
<body> | ||
<!-- at end of body, AFTER Quasar script(s): --> | ||
<script src="https://cdn.jsdelivr.net/npm/q-colorize-mixin/dist/index.umd.min.js"></script> | ||
</body> | ||
npm remove q-colorize-mixin | ||
``` | ||
If you need the RTL variant of the CSS, then go for the following (instead of the above stylesheet link): | ||
```html | ||
<link href="https://cdn.jsdelivr.net/npm/q-colorize-mixin/dist/index.rtl.min.css" rel="stylesheet" type="text/css"> | ||
``` | ||
# Documentation and Examples | ||
Examples with code can be found [here](https://hawkeye64.github.io/q-colorize-mixin/examples). | ||
# Demo Project (source) | ||
Source for the demo application can be found [here](https://github.com/hawkeye64/q-colorize-mixin/tree/master/demo). | ||
# Setup | ||
@@ -62,26 +57,30 @@ ```bash | ||
```bash | ||
$ cd ui | ||
# start dev in SPA mode | ||
$ yarn dev | ||
``` | ||
# start dev in UMD mode | ||
$ yarn dev:umd | ||
# Building package | ||
```bash | ||
$ cd ui | ||
# start dev in SSR mode | ||
$ yarn dev:ssr | ||
$ yarn build | ||
``` | ||
# start dev in Cordova iOS mode | ||
$ yarn dev:ios | ||
# Building Demo | ||
```bash | ||
# first time prep | ||
$ cd ui | ||
$ yarn link | ||
$ cd ../demo | ||
$ yarn link "q-colorize-mixin" | ||
# start dev in Cordova Android mode | ||
$ yarn dev:android | ||
# for interactive - browser opens automatically | ||
$ quasar dev | ||
# start dev in Electron mode | ||
$ yarn dev:electron | ||
# for build - goes to docs folder | ||
$ yarn build-demo | ||
``` | ||
# Building package | ||
```bash | ||
$ yarn build | ||
``` | ||
# Donate | ||
@@ -88,0 +87,0 @@ If you appreciate the work that went into this, please consider [donating to Quasar](https://donate.quasar.dev). |
@@ -10,2 +10,9 @@ import { version } from '../package.json' | ||
export default QColorizeMixin | ||
export default { | ||
QColorizeMixin, | ||
version, | ||
install (Vue) { | ||
Vue.component(QColorizeMixin.name, QColorizeMixin) | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
126695
13
2146
90