* KUTE.js now works when added to `<head>` but tween object initialization scripting must be added after `<body>` or when new `Element` target is appended into document
* updated `shorter-js`
This commit is contained in:
thednp 2020-07-27 09:42:21 +00:00
parent 64ac54a4d0
commit 65a56cd338
13 changed files with 32 additions and 33 deletions

View file

@ -1,5 +1,5 @@
/*!
* KUTE.js Base v2.0.11 (http://thednp.github.io/kute.js)
* KUTE.js Base v2.0.12 (http://thednp.github.io/kute.js)
* Copyright 2015-2020 © thednp
* Licensed under MIT (https://github.com/thednp/kute.js/blob/master/LICENSE)
*/
@ -9,7 +9,7 @@
(global = global || self, global.KUTE = factory());
}(this, (function () { 'use strict';
var version = "2.0.11";
var version = "2.0.12";
var KUTE = {};

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*!
* KUTE.js Extra v2.0.11 (http://thednp.github.io/kute.js)
* KUTE.js Extra v2.0.12 (http://thednp.github.io/kute.js)
* Copyright 2015-2020 © thednp
* Licensed under MIT (https://github.com/thednp/kute.js/blob/master/LICENSE)
*/
@ -9,7 +9,7 @@
(global = global || self, global.KUTE = factory());
}(this, (function () { 'use strict';
var version = "2.0.11";
var version = "2.0.12";
var KUTE = {};
@ -1116,8 +1116,8 @@
function trueColor (colorString) {
if (/rgb|rgba/.test(colorString)) {
var vrgb = colorString.replace(/\s|\)/,'').split('(')[1].split(',');
var colorAlpha = vrgb[3] ? vrgb[3] : null;
var vrgb = colorString.replace(/\s|\)/,'').split('(')[1].split(','),
colorAlpha = vrgb[3] ? vrgb[3] : null;
if (!colorAlpha) {
return { r: parseInt(vrgb[0]), g: parseInt(vrgb[1]), b: parseInt(vrgb[2]) };
} else {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

8
dist/kute.esm.js vendored
View file

@ -1,9 +1,9 @@
/*!
* KUTE.js Standard v2.0.11 (http://thednp.github.io/kute.js)
* KUTE.js Standard v2.0.12 (http://thednp.github.io/kute.js)
* Copyright 2015-2020 © thednp
* Licensed under MIT (https://github.com/thednp/kute.js/blob/master/LICENSE)
*/
var version = "2.0.11";
var version = "2.0.12";
var KUTE = {};
@ -820,8 +820,8 @@ function hexToRGB (hex) {
function trueColor (colorString) {
if (/rgb|rgba/.test(colorString)) {
var vrgb = colorString.replace(/\s|\)/,'').split('(')[1].split(',');
var colorAlpha = vrgb[3] ? vrgb[3] : null;
var vrgb = colorString.replace(/\s|\)/,'').split('(')[1].split(','),
colorAlpha = vrgb[3] ? vrgb[3] : null;
if (!colorAlpha) {
return { r: parseInt(vrgb[0]), g: parseInt(vrgb[1]), b: parseInt(vrgb[2]) };
} else {

File diff suppressed because one or more lines are too long

8
dist/kute.js vendored
View file

@ -1,5 +1,5 @@
/*!
* KUTE.js Standard v2.0.11 (http://thednp.github.io/kute.js)
* KUTE.js Standard v2.0.12 (http://thednp.github.io/kute.js)
* Copyright 2015-2020 © thednp
* Licensed under MIT (https://github.com/thednp/kute.js/blob/master/LICENSE)
*/
@ -9,7 +9,7 @@
(global = global || self, global.KUTE = factory());
}(this, (function () { 'use strict';
var version = "2.0.11";
var version = "2.0.12";
var KUTE = {};
@ -826,8 +826,8 @@
function trueColor (colorString) {
if (/rgb|rgba/.test(colorString)) {
var vrgb = colorString.replace(/\s|\)/,'').split('(')[1].split(',');
var colorAlpha = vrgb[3] ? vrgb[3] : null;
var vrgb = colorString.replace(/\s|\)/,'').split('(')[1].split(','),
colorAlpha = vrgb[3] ? vrgb[3] : null;
if (!colorAlpha) {
return { r: parseInt(vrgb[0]), g: parseInt(vrgb[1]), b: parseInt(vrgb[2]) };
} else {

4
dist/kute.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "kute.js",
"version": "2.0.11",
"version": "2.0.12",
"description": "JavaScript animation engine of the future is called KUTE.js.",
"main": "dist/kute.min.js",
"module": "dist/kute.esm.js",
@ -56,7 +56,7 @@
"dependencies": {
"cubic-bezier-easing": "^1.0.2",
"minifill": "^0.0.13",
"shorter-js": "^0.1.0"
"shorter-js": "^0.1.4"
},
"devDependencies": {
"@rollup/plugin-buble": "^0.21.3",

View file

@ -1,2 +1,2 @@
import transformProperty from './transformProperty.js'
export default transformProperty in document.body.style
export default transformProperty in document.head.style

View file

@ -3,20 +3,19 @@ import hexToRGB from './hexToRGB.js'
// trueColor - replace transparent and transform any color to rgba()/rgb()
export default function (colorString) {
if (/rgb|rgba/.test(colorString)) { // first check if it's a rgb string
const vrgb = colorString.replace(/\s|\)/,'').split('(')[1].split(',');
const colorAlpha = vrgb[3] ? vrgb[3] : null;
let vrgb = colorString.replace(/\s|\)/,'').split('(')[1].split(','),
colorAlpha = vrgb[3] ? vrgb[3] : null;
if (!colorAlpha) {
return { r: parseInt(vrgb[0]), g: parseInt(vrgb[1]), b: parseInt(vrgb[2]) };
} else {
return { r: parseInt(vrgb[0]), g: parseInt(vrgb[1]), b: parseInt(vrgb[2]), a: parseFloat(colorAlpha) };
}
} else if (/^#/.test(colorString)) {
const fromHex = hexToRGB(colorString); return { r: fromHex.r, g: fromHex.g, b: fromHex.b };
let fromHex = hexToRGB(colorString); return { r: fromHex.r, g: fromHex.g, b: fromHex.b };
} else if (/transparent|none|initial|inherit/.test(colorString)) {
return { r: 0, g: 0, b: 0, a: 0 };
} else if (!/^#|^rgb/.test(colorString) ) { // maybe we can check for web safe colors
const siteHead = document.getElementsByTagName('head')[0]; siteHead.style.color = colorString;
let siteHead = document.getElementsByTagName('head')[0]; siteHead.style.color = colorString;
let webColor = getComputedStyle(siteHead,null).color; webColor = /rgb/.test(webColor) ? webColor.replace(/[^\d,]/g, '').split(',') : [0,0,0];
siteHead.style.color = ''; return { r: parseInt(webColor[0]), g: parseInt(webColor[1]), b: parseInt(webColor[2]) };
}

View file

@ -2,7 +2,7 @@ import getPrefix from './getPrefix.js'
// trueProperty - returns prefixed property | property
export default function(property) {
return !(property in document.body.style)
return !(property in document.head.style)
? getPrefix() + (property.charAt(0).toUpperCase() + property.slice(1))
: property;
}