Skip to content

Commit

Permalink
add libs
Browse files Browse the repository at this point in the history
  • Loading branch information
olton committed May 5, 2024
1 parent 83e6ee9 commit ea4d2d7
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 44,908 deletions.
4 changes: 2 additions & 2 deletions build/metro.all.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions build/metro.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion build/metro.css.map

This file was deleted.

44,862 changes: 9 additions & 44,853 deletions build/metro.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion build/metro.js.map

This file was deleted.

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
"dependencies": {
"@olton/animation": "^0.2.0",
"@olton/color": "^1.0.0-rc1",
"@olton/color": "^1.0.0",
"@olton/datetime": "^3.0.3",
"@olton/hooks": "^0.1.0",
"@olton/html": "^0.7.0",
Expand Down
70 changes: 36 additions & 34 deletions source/components/color-selector/color-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@

_setColorValues: function(){
var element = this.element, o = this.options;
var hsl = Color.Routines.toHSL(new Color.Primitives.HSL(this.hue, this.saturation, this.lightness));
var hsla = Color.Routines.toHSLA(new Color.Primitives.HSLA(this.hue, this.saturation, this.lightness, this.alpha));
var hsl = new Color.Primitives.HSL(this.hue, this.saturation, this.lightness)
var hsla = new Color.Primitives.HSLA(this.hue, this.saturation, this.lightness, this.alpha)
var rgb = Color.Routines.toRGB(hsl);
var rgba = Color.Routines.toRGBA(rgb, this.alpha);
var hsv = Color.Routines.toHSV(hsl);
Expand Down Expand Up @@ -539,7 +539,7 @@
backgroundColor: hex
});

const value = this.val()
const value = this.getVal()

if (controller && controller.length) {
controller.val(value).trigger("change");
Expand Down Expand Up @@ -630,6 +630,10 @@

alphaMap.on(Metro.events.startAll, function(e){

if (["hsla", "rgba"].includes(o.returnValueType) === false) {
return
}

that._getAlphaValue(Utils.pageXY(e).y);
that.alphaCursor.addClass("dragging");

Expand Down Expand Up @@ -709,39 +713,37 @@
});
},

val: function(v){
var o = this.options;

console.log(v)

if (!v) {
var res;
switch (o.returnValueType.toLowerCase()) {
case "rgb":
res = this.rgb;
break;
case "rgba":
res = this.rgba;
break;
case "hsl":
res = this.hsl;
break;
case "hsla":
res = this.hsla;
break;
case "hsv":
res = this.hsv;
break;
case "cmyk":
res = this.cmyk;
break;
default: res = this.hex;
}
console.log("res", res)
return o.returnAsString ? res.toString() : res;
getVal: function(){
var o = this.options, res;
switch (o.returnValueType.toLowerCase()) {
case "rgb":
res = this.rgb;
break;
case "rgba":
res = this.rgba;
break;
case "hsl":
res = this.hsl;
break;
case "hsla":
res = this.hsla;
break;
case "hsv":
res = this.hsv;
break;
case "cmyk":
res = this.cmyk;
break;
default: res = this.hex;
}
return o.returnAsString ? res.toString() : res;
},

// this._colorToPos(Color.Routines.parse(v));
val: function(v){
if (typeof v === "undefined") {
return this.getVal()
}
this._colorToPos(Color.Routines.parse(v));
},

user: function(v){
Expand Down
4 changes: 4 additions & 0 deletions source/components/color-selector/color-selector.less
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@
.dragging {
cursor: grab;
}

.color-cursor, .alpha-cursor, .hue-cursor {
user-select: none!important;
}
}


Expand Down
4 changes: 2 additions & 2 deletions source/components/cube/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@
return ;
}

rule1 = "0 0 10px " + Color.Routines.toRGBA(o.flashColor, 1);
rule2 = "0 0 10px " + Color.Routines.toRGBA(o.flashColor, o.attenuation);
rule1 = "0 0 10px " + Color.Routines.toRGBA(Color.Routines.parse(o.flashColor), 1);
rule2 = "0 0 10px " + Color.Routines.toRGBA(Color.Routines.parse(o.flashColor), o.attenuation);

for(i = 0; i < 3; i++) {
rules1.push(rule1);
Expand Down
2 changes: 1 addition & 1 deletion source/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
overlay.addClass("transparent");
} else {
overlay.css({
background: Color.Routines.toRGBA(o.overlayColor, o.overlayAlpha)
background: Color.Routines.toRGBA(Color.Routines.parse(o.overlayColor), o.overlayAlpha)
});
}

Expand Down
2 changes: 1 addition & 1 deletion source/components/info-box/info-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
overlay.addClass("transparent");
} else {
overlay.css({
background: Color.Routines.toRGBA(o.overlayColor, o.overlayAlpha)
background: Color.Routines.toRGBA(Color.Routines.parse(o.overlayColor), o.overlayAlpha)
});
}

Expand Down
3 changes: 1 addition & 2 deletions source/components/ripple/ripple.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
var el = $(target);
var rect = Utils.rect(el[0]);
var x, y;
var Colors = Color.Routines;

if (el.length === 0) {
return ;
Expand Down Expand Up @@ -67,7 +66,7 @@
}

ripple.css({
background: Colors.toRGBA(color, alpha),
background: Color.Routines.toRGBA(Color.Routines.parse(color), alpha),
width: size,
height: size,
top: y + 'px',
Expand Down
2 changes: 1 addition & 1 deletion source/components/spinner/spinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
spinnerButtonClick(plus, o.repeatThreshold);

e.preventDefault();
});
}, {passive: true});

spinner_buttons.on(Metro.events.stopAll, function(){
that.repeat_timer = false;
Expand Down
2 changes: 1 addition & 1 deletion source/components/tag-input/tag-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
remover.appendTo(tag);

if (o.randomColor === true) {
var colors = Color.Routines.colors(Color.Routines.PALETTES.ALL), bg, fg, bg_r;
var colors = Object.values(Object.assign({}, Color.StandardColors, Color.MetroColors)), bg, fg, bg_r;

bg = colors[$.random(0, colors.length - 1)];
bg_r = Color.Routines.darken(bg, 15);
Expand Down
2 changes: 1 addition & 1 deletion source/components/window/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
overlay.addClass("transparent");
} else {
overlay.css({
background: Color.Routines.toRGBA(o.overlayColor, o.overlayAlpha)
background: Color.Routines.toRGBA(Color.Routines.parse(o.overlayColor), o.overlayAlpha)
});
}

Expand Down
2 changes: 1 addition & 1 deletion source/core/metro.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
var Metro = {

version: "5.0.0-rc8",
build_time: "04.05.2024, 22:08:59",
build_time: "05.05.2024, 20:43:53",
buildNumber: 0,
isTouchable: isTouch,
fullScreenEnabled: document.fullscreenEnabled,
Expand Down

0 comments on commit ea4d2d7

Please sign in to comment.