@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 o=require("../base-CBCg3yyw.cjs"),a=require("../color-controller-_ZwyhvaU.cjs"),u=require("../text-field-BTkr42k4.cjs"),d=":host{position:relative}";var h=Object.defineProperty,v=(t,e,l,c)=>{for(var r=void 0,i=t.length-1,n;i>=0;i--)(n=t[i])&&(r=n(e,l,r)||r);return r&&h(e,l,r),r};class s extends u.LuzmoTextFieldBase{constructor(){super(),this.viewColor=!1,this._value="",this.colorController=new a.ColorController(this)}static get styles(){return[...super.styles,o.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?o.x`
19
- <sp-color-handle
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
- ></sp-color-handle>
23
- `:o.x``}getColorValue(){return this.valid?this.colorController.getColor("srgb").toString():""}render(){return this.viewColor&&Promise.resolve().then(()=>require("../color-handle/index.cjs")),o.x` ${super.render()} ${this.renderColorHandle()} `}checkValidity(){let e=super.checkValidity();return this.value?(this.valid=e=this.colorController.validateColorString(this.value).isValid,this.invalid=!e,this.valid&&(this.colorController.color=this.value)):this.valid=this.invalid=!1,e}}v([o.n({type:Boolean,attribute:"view-color"})],s.prototype,"viewColor");customElements.get("luzmo-color-field")||customElements.define("luzmo-color-field",s);exports.LuzmoColorField=s;
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 n, x as i, n as s } from "../base-WsynuqaS.js";
19
- import { C as a } from "../color-controller-DTp1juRz.js";
20
- import { a as d } from "../text-field-ol9Ed5lQ.js";
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 z = ":host{position:relative}";
29
- var f = Object.defineProperty, g = (l, o, e, h) => {
30
- for (var r = void 0, t = l.length - 1, u; t >= 0; t--)
31
- (u = l[t]) && (r = u(o, e, r) || r);
32
- return r && f(o, e, r), r;
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 m extends d {
34
+ class u extends z {
35
35
  constructor() {
36
- super(), this.viewColor = !1, this._value = "", this.colorController = new a(this);
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, n(z)];
39
+ return [...super.styles, s(f)];
40
40
  }
41
41
  set value(o) {
42
42
  if (o === this.value)
43
43
  return;
44
- const e = this._value;
45
- this._value = o, this.requestUpdate("value", e);
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
- <sp-color-handle
52
+ <luzmo-color-handle
53
53
  size="m"
54
54
  color=${this.colorController.getColor("srgb").toString()}
55
- ></sp-color-handle>
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
- return this.value ? (this.valid = o = this.colorController.validateColorString(
67
- this.value
68
- ).isValid, this.invalid = !o, this.valid && (this.colorController.color = this.value)) : this.valid = this.invalid = !1, o;
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
- g([
72
- s({ type: Boolean, attribute: "view-color" })
73
- ], m.prototype, "viewColor");
74
- customElements.get("luzmo-color-field") || customElements.define("luzmo-color-field", m);
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
- m as LuzmoColorField
84
+ u as LuzmoColorField
77
85
  };