@luzmo/lucero 1.0.1-alpha.8 → 1.0.1-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,14 @@ import { LuzmoTextFieldBase } from './../text-field/text-field';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class LuzmoColorField extends LuzmoTextFieldBase {
|
|
9
9
|
static get styles(): CSSResultArray;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the color handle with the preview color is shown
|
|
12
|
+
*/
|
|
10
13
|
viewColor: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the alpha channel is not allowed
|
|
16
|
+
*/
|
|
17
|
+
noAlphaChannel: boolean;
|
|
11
18
|
private colorController;
|
|
12
19
|
constructor();
|
|
13
20
|
set value(value: string);
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
19
|
-
<
|
|
18
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../base-CBCg3yyw.cjs"),u=require("../color-controller-_ZwyhvaU.cjs"),h=require("../text-field-BTkr42k4.cjs"),d=":host{position:relative}";var c=Object.defineProperty,a=(i,e,l,v)=>{for(var o=void 0,s=i.length-1,n;s>=0;s--)(n=i[s])&&(o=n(e,l,o)||o);return o&&c(e,l,o),o};class r extends h.LuzmoTextFieldBase{constructor(){super(),this.viewColor=!1,this.noAlphaChannel=!1,this._value="",this.colorController=new u.ColorController(this)}static get styles(){return[...super.styles,t.r(d)]}set value(e){if(e===this.value)return;const l=this._value;this._value=e,this.requestUpdate("value",l)}get value(){return this._value}renderColorHandle(){return this.viewColor&&this.valid?t.x`
|
|
19
|
+
<luzmo-color-handle
|
|
20
20
|
size="m"
|
|
21
21
|
color=${this.colorController.getColor("srgb").toString()}
|
|
22
|
-
></
|
|
23
|
-
`:
|
|
22
|
+
></luzmo-color-handle>
|
|
23
|
+
`:t.x``}getColorValue(){return this.valid?this.colorController.getColor("srgb").toString():""}render(){return this.viewColor&&Promise.resolve().then(()=>require("../color-handle/index.cjs")),t.x` ${super.render()} ${this.renderColorHandle()} `}checkValidity(){let e=super.checkValidity();if(this.value){const l=this.colorController.validateColorString(this.value);this.valid=e=l.isValid&&(!this.noAlphaChannel||l.alpha===1),this.invalid=!e,this.valid&&(this.colorController.color=this.value)}else this.valid=this.invalid=!1;return e}}a([t.n({type:Boolean,attribute:"view-color"})],r.prototype,"viewColor");a([t.n({type:Boolean,attribute:"no-alpha-channel"})],r.prototype,"noAlphaChannel");customElements.get("luzmo-color-field")||customElements.define("luzmo-color-field",r);exports.LuzmoColorField=r;
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
16
|
* SOFTWARE.
|
|
17
17
|
* */
|
|
18
|
-
import { r as
|
|
19
|
-
import { C as
|
|
20
|
-
import { a as
|
|
18
|
+
import { r as s, x as i, n as m } from "../base-WsynuqaS.js";
|
|
19
|
+
import { C as d } from "../color-controller-DTp1juRz.js";
|
|
20
|
+
import { a as z } from "../text-field-ol9Ed5lQ.js";
|
|
21
21
|
const c = () => {
|
|
22
22
|
if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
|
|
23
23
|
const l = document.createElement("style");
|
|
@@ -25,34 +25,34 @@ const c = () => {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
c();
|
|
28
|
-
const
|
|
29
|
-
var
|
|
30
|
-
for (var
|
|
31
|
-
(
|
|
32
|
-
return
|
|
28
|
+
const f = ":host{position:relative}";
|
|
29
|
+
var h = Object.defineProperty, a = (l, o, r, g) => {
|
|
30
|
+
for (var e = void 0, t = l.length - 1, n; t >= 0; t--)
|
|
31
|
+
(n = l[t]) && (e = n(o, r, e) || e);
|
|
32
|
+
return e && h(o, r, e), e;
|
|
33
33
|
};
|
|
34
|
-
class
|
|
34
|
+
class u extends z {
|
|
35
35
|
constructor() {
|
|
36
|
-
super(), this.viewColor = !1, this._value = "", this.colorController = new
|
|
36
|
+
super(), this.viewColor = !1, this.noAlphaChannel = !1, this._value = "", this.colorController = new d(this);
|
|
37
37
|
}
|
|
38
38
|
static get styles() {
|
|
39
|
-
return [...super.styles,
|
|
39
|
+
return [...super.styles, s(f)];
|
|
40
40
|
}
|
|
41
41
|
set value(o) {
|
|
42
42
|
if (o === this.value)
|
|
43
43
|
return;
|
|
44
|
-
const
|
|
45
|
-
this._value = o, this.requestUpdate("value",
|
|
44
|
+
const r = this._value;
|
|
45
|
+
this._value = o, this.requestUpdate("value", r);
|
|
46
46
|
}
|
|
47
47
|
get value() {
|
|
48
48
|
return this._value;
|
|
49
49
|
}
|
|
50
50
|
renderColorHandle() {
|
|
51
51
|
return this.viewColor && this.valid ? i`
|
|
52
|
-
<
|
|
52
|
+
<luzmo-color-handle
|
|
53
53
|
size="m"
|
|
54
54
|
color=${this.colorController.getColor("srgb").toString()}
|
|
55
|
-
></
|
|
55
|
+
></luzmo-color-handle>
|
|
56
56
|
` : i``;
|
|
57
57
|
}
|
|
58
58
|
getColorValue() {
|
|
@@ -63,15 +63,23 @@ class m extends d {
|
|
|
63
63
|
}
|
|
64
64
|
checkValidity() {
|
|
65
65
|
let o = super.checkValidity();
|
|
66
|
-
|
|
67
|
-
this.
|
|
68
|
-
|
|
66
|
+
if (this.value) {
|
|
67
|
+
const r = this.colorController.validateColorString(
|
|
68
|
+
this.value
|
|
69
|
+
);
|
|
70
|
+
this.valid = o = r.isValid && (!this.noAlphaChannel || r.alpha === 1), this.invalid = !o, this.valid && (this.colorController.color = this.value);
|
|
71
|
+
} else
|
|
72
|
+
this.valid = this.invalid = !1;
|
|
73
|
+
return o;
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
],
|
|
74
|
-
|
|
76
|
+
a([
|
|
77
|
+
m({ type: Boolean, attribute: "view-color" })
|
|
78
|
+
], u.prototype, "viewColor");
|
|
79
|
+
a([
|
|
80
|
+
m({ type: Boolean, attribute: "no-alpha-channel" })
|
|
81
|
+
], u.prototype, "noAlphaChannel");
|
|
82
|
+
customElements.get("luzmo-color-field") || customElements.define("luzmo-color-field", u);
|
|
75
83
|
export {
|
|
76
|
-
|
|
84
|
+
u as LuzmoColorField
|
|
77
85
|
};
|