q-colorize-mixin
Advanced tools
Comparing version 2.0.0-alpha.4 to 2.0.0-alpha.5
/*! | ||
* q-colorize-mixin v2.0.0-alpha.4 | ||
* q-colorize-mixin v2.0.0-alpha.5 | ||
* (c) 2021 Jeff Galbraith <jeff@quasar.dev> | ||
* Released under the MIT License. | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version="2.0.0-alpha.4",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"],useColorizeProps={color:String};function useColorize(){function e(e){return!!e&&CSS_COLOR_NAMES.includes(e.toLowerCase())}function r(r){return!!r&&(!!r.match(/^(#|(rgb|hsl)a?\()/)||e(r))}function o(e){return!!e&&e.startsWith("--")}function l(e,o){return void 0===o&&(o="black"),void 0===e&&void 0!==o?l(o):r(e)?e:a(e,o)}function a(e,r){return"var("+(o(e)?e:"--q-color-"+e)+", '"+r+"')"}function i(e){return r(e)||o(e)}function s(e,r){var o;if(void 0===r&&(r={}),i(e)){var a=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"background-color":""+a})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["bg-"+s]=!0,o))}return r}function t(e,r){var o;if(void 0===r&&(r={}),i(e)){var a=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{color:""+a,"caret-color":""+a})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["text-"+s]=!0,o))}return r}return{isNamedCssColor:e,isCssColor:r,isCssVar:o,calculateColor:l,makeQuasarColorVar:a,isValidCssColor:i,setBothColors:function(e,r,o){return void 0===o&&(o={}),t(e,s(r,o))},setBackgroundColor:s,setTextColor:t,setBorderColor:function(e,r){var o;if(void 0===r&&(r={}),i(e)){var a=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"border-color":""+a})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["border-color-"+s]=!0,o))}return r}}}useColorize.version=version;var index={useColorize:useColorize,useColorizeProps:useColorizeProps,version:version};exports.default=index,exports.useColorize=useColorize,exports.useColorizeProps=useColorizeProps,exports.version=version; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var version="2.0.0-alpha.5",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"],useColorizeProps={color:String};function useColorize(){function e(e){return!!e&&CSS_COLOR_NAMES.includes(e.toLowerCase())}function r(r){return!!r&&(!!r.match(/^(#|(rgb|hsl)a?\()/)||e(r))}function o(e){return!!e&&e.startsWith("--")}function i(e,o){return void 0===o&&(o="black"),void 0===e&&void 0!==o?i(o):r(e)?e:l(e,o)}function l(e,r){return"var("+(o(e)?e:"--q-color-"+e)+", '"+r+"')"}function s(e){return r(e)||o(e)}function a(e,r){var o;if(void 0===r&&(r={}),s(e)){var l=i(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"background-color":""+l})}else if(e){var a=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["bg-"+a]=!0,o))}return r}function t(e,r){var o;if(void 0===r&&(r={}),s(e)){var l=i(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{color:""+l,"caret-color":""+l})}else if(e){var a=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["text-"+a]=!0,o))}return r}return{isNamedCssColor:e,isCssColor:r,isCssVar:o,calculateColor:i,makeQuasarColorVar:l,isValidCssColor:s,setBothColors:function(e,r,o){return void 0===o&&(o={}),t(e,a(r,o))},setBackgroundColor:a,setTextColor:t,setBorderColor:function(e,r){var o;if(void 0===r&&(r={}),s(e)){var l=i(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"border-color":""+l})}else if(e){var a=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["border-color-"+a]=!0,o))}return r}}}var methods=useColorize(),QColorizeMixin={name:"QColorizeMixin",props:Object.assign({},useColorizeProps),methods:methods};QColorizeMixin.version=version;var index={QColorizeMixin:QColorizeMixin,useColorize:useColorize,useColorizeProps:useColorizeProps,version:version};exports.QColorizeMixin=QColorizeMixin,exports.default=index,exports.useColorize=useColorize,exports.useColorizeProps=useColorizeProps,exports.version=version; |
/*! | ||
* q-colorize-mixin v2.0.0-alpha.4 | ||
* q-colorize-mixin v2.0.0-alpha.5 | ||
* (c) 2021 Jeff Galbraith <jeff@quasar.dev> | ||
* Released under the MIT License. | ||
*/ | ||
var version="2.0.0-alpha.4",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"],useColorizeProps={color:String};function useColorize(){function e(e){return!!e&&CSS_COLOR_NAMES.includes(e.toLowerCase())}function r(r){return!!r&&(!!r.match(/^(#|(rgb|hsl)a?\()/)||e(r))}function o(e){return!!e&&e.startsWith("--")}function l(e,o){return void 0===o&&(o="black"),void 0===e&&void 0!==o?l(o):r(e)?e:a(e,o)}function a(e,r){return"var("+(o(e)?e:"--q-color-"+e)+", '"+r+"')"}function i(e){return r(e)||o(e)}function s(e,r){var o;if(void 0===r&&(r={}),i(e)){var a=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"background-color":""+a})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["bg-"+s]=!0,o))}return r}function t(e,r){var o;if(void 0===r&&(r={}),i(e)){var a=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{color:""+a,"caret-color":""+a})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["text-"+s]=!0,o))}return r}return{isNamedCssColor:e,isCssColor:r,isCssVar:o,calculateColor:l,makeQuasarColorVar:a,isValidCssColor:i,setBothColors:function(e,r,o){return void 0===o&&(o={}),t(e,s(r,o))},setBackgroundColor:s,setTextColor:t,setBorderColor:function(e,r){var o;if(void 0===r&&(r={}),i(e)){var a=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"border-color":""+a})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["border-color-"+s]=!0,o))}return r}}}useColorize.version=version;var index={useColorize:useColorize,useColorizeProps:useColorizeProps,version:version};export default index;export{useColorize,useColorizeProps,version}; | ||
var version="2.0.0-alpha.5",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"],useColorizeProps={color:String};function useColorize(){function e(e){return!!e&&CSS_COLOR_NAMES.includes(e.toLowerCase())}function r(r){return!!r&&(!!r.match(/^(#|(rgb|hsl)a?\()/)||e(r))}function o(e){return!!e&&e.startsWith("--")}function l(e,o){return void 0===o&&(o="black"),void 0===e&&void 0!==o?l(o):r(e)?e:i(e,o)}function i(e,r){return"var("+(o(e)?e:"--q-color-"+e)+", '"+r+"')"}function a(e){return r(e)||o(e)}function s(e,r){var o;if(void 0===r&&(r={}),a(e)){var i=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"background-color":""+i})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["bg-"+s]=!0,o))}return r}function n(e,r){var o;if(void 0===r&&(r={}),a(e)){var i=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{color:""+i,"caret-color":""+i})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["text-"+s]=!0,o))}return r}return{isNamedCssColor:e,isCssColor:r,isCssVar:o,calculateColor:l,makeQuasarColorVar:i,isValidCssColor:a,setBothColors:function(e,r,o){return void 0===o&&(o={}),n(e,s(r,o))},setBackgroundColor:s,setTextColor:n,setBorderColor:function(e,r){var o;if(void 0===r&&(r={}),a(e)){var i=l(e);void 0===r.style&&(r.style={}),r.style=Object.assign({},r.style,{"border-color":""+i})}else if(e){var s=e.toString().trim();void 0===r.class&&(r.class={}),r.class=Object.assign({},r.class,((o={})["border-color-"+s]=!0,o))}return r}}}var methods=useColorize(),QColorizeMixin={name:"QColorizeMixin",props:Object.assign({},useColorizeProps),methods:methods};QColorizeMixin.version=version;var index={QColorizeMixin:QColorizeMixin,useColorize:useColorize,useColorizeProps:useColorizeProps,version:version};export default index;export{QColorizeMixin,useColorize,useColorizeProps,version}; |
{ | ||
"name": "q-colorize-mixin", | ||
"version": "2.0.0-alpha.4", | ||
"version": "2.0.0-alpha.5", | ||
"author": "Jeff Galbraith <jeff@quasar.dev>", | ||
@@ -33,26 +33,28 @@ "description": "Quasar color mixin", | ||
"devDependencies": { | ||
"@babel/core": "^7.13.13", | ||
"@babel/eslint-parser": "^7.13.10", | ||
"@rollup/plugin-buble": "^0.21.3", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^11.1.1", | ||
"@rollup/plugin-node-resolve": "^11.2.1", | ||
"@vue/eslint-config-standard": "^6.0.0", | ||
"autoprefixer": "^10.2.4", | ||
"autoprefixer": "^10.2.5", | ||
"babel-eslint": "^10.1.0", | ||
"chalk": "^4.1.0", | ||
"cssnano": "^4.1.10", | ||
"eslint": "^7.19.0", | ||
"eslint": "^7.23.0", | ||
"eslint-loader": "^4.0.2", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-promise": "^4.3.1", | ||
"eslint-plugin-quasar": "^1.0.0", | ||
"eslint-plugin-standard": "^4.1.0", | ||
"eslint-plugin-vue": "^7.5.0", | ||
"open": "^7.4.0", | ||
"postcss": "^8.2.5", | ||
"quasar": "^1.15.2", | ||
"quasar-json-api": "^1.2.5", | ||
"eslint-plugin-vue": "^7.8.0", | ||
"open": "^8.0.4", | ||
"postcss": "^8.2.8", | ||
"quasar": "^1.15.9", | ||
"quasar-json-api": "^1.2.6", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.38.5", | ||
"rollup": "^2.42.4", | ||
"rtlcss": "^3.1.2", | ||
"sass": "^1.32.6", | ||
"sass": "^1.32.8", | ||
"uglify-es": "^3.3.9", | ||
@@ -59,0 +61,0 @@ "zlib": "^1.0.5" |
@@ -9,2 +9,23 @@ QColorizeMixin | ||
# Release Notes | ||
**v2.0.0 (alpha)** does not have any breaking changes, but it does add new functionality to support Quasar v2 and Vue v3. | ||
If using Quasar v1, use this mixin as you normally would. | ||
If using Quasar v2, with Vue 3 composition API, there are exposed the `useColorizeProps` and `useColorize` methods. The later exposes the methods: | ||
```js | ||
import { useColorizeProps, useColorize } from 'q-colorize-mixin' | ||
// ... | ||
props: { | ||
// your other prop definitions | ||
...useColorizeProps() | ||
}, | ||
setup (props) { | ||
...useColorize() | ||
} | ||
``` | ||
# Features | ||
@@ -11,0 +32,0 @@ |
@@ -30,7 +30,9 @@ // 'transparent' at beginning of array as it's not really a color, | ||
export const useColorizeProps = { | ||
// Vue 3 | ||
const useColorizeProps = { | ||
color: String | ||
} | ||
export default function () { | ||
// Vue 3 | ||
function useColorize () { | ||
function isNamedCssColor (color) { | ||
@@ -148,1 +150,19 @@ return !!color && CSS_COLOR_NAMES.includes(color.toLowerCase()) | ||
} | ||
const methods = useColorize() | ||
// Vue 2 compatible | ||
export default { | ||
name: 'QColorizeMixin', | ||
props: { | ||
...useColorizeProps | ||
}, | ||
methods | ||
} | ||
export { | ||
useColorizeProps, | ||
useColorize | ||
} |
import { version } from '../package.json' | ||
import useColorize, { useColorizeProps } from './components/QColorizeMixin.js' | ||
import QColorizeMixin, { useColorize, useColorizeProps } from './components/QColorizeMixin.js' | ||
useColorize.version = version | ||
QColorizeMixin.version = version | ||
export { | ||
QColorizeMixin, | ||
useColorize, | ||
@@ -13,2 +14,3 @@ useColorizeProps, | ||
export default { | ||
QColorizeMixin, | ||
useColorize, | ||
@@ -15,0 +17,0 @@ useColorizeProps, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151032
2783
112
28