diff --git a/build.dev.js b/build.dev.js
index cc4dcb6..2d9f06b 100644
--- a/build.dev.js
+++ b/build.dev.js
@@ -87,12 +87,22 @@ function mkWCFile({ style, html, js }) {
/import ([\w]*) from '([a-z0-9\/\.\-_]*)'/g,
'import $1 from "$2.js"'
)
+ .replace(/constructor\([^)]?\)\s+\{/, 'constructor() {\n super()')
.replace(
'/* render */',
`
- super()
- this.root = this.attachShadow({ mode: 'open' })
- this.props = ${props}
+ Object.defineProperty(this, 'root', {
+ value: this.attachShadow({ mode: 'open' }),
+ writable: true,
+ enumerable: false,
+ configurable: true
+ })
+ Object.defineProperty(this, 'props', {
+ value: ${props},
+ writable: true,
+ enumerable: false,
+ configurable: true
+ })
this.root.innerHTML = \`${html}\`
`
diff --git a/build.prod.js b/build.prod.js
index ce63312..20e783d 100644
--- a/build.prod.js
+++ b/build.prod.js
@@ -100,8 +100,19 @@ function mkWCFile({ style, html, js }) {
'/* render */',
`
super()
- this.root = this.attachShadow({ mode: 'open' })
- this.props = ${props}
+
+ Object.defineProperty(this, 'root', {
+ value: this.attachShadow({ mode: 'open' }),
+ writable: true,
+ enumerable: false,
+ configurable: true
+ })
+ Object.defineProperty(this, 'props', {
+ value: ${props},
+ writable: true,
+ enumerable: false,
+ configurable: true
+ })
this.root.innerHTML = \`${html}\`
`
diff --git a/src/form/input.wc b/src/form/input.wc
index 9cddc68..e6af4ad 100644
--- a/src/form/input.wc
+++ b/src/form/input.wc
@@ -1,8 +1,8 @@
@@ -12,23 +12,26 @@
display: inline-block;
user-select: none;
color: nth($cd, 2);
+ border-radius: 4px;
}
label {
+ position: relative;
display: flex;
justify-content: center;
align-items: center;
- min-width: 32px;
+ min-width: 64px;
height: 32px;
font-size: 14px;
border: 1px solid nth($cp, 3);
- border-radius: 4px;
+ border-radius: inherit;
background: #fff;
color: inherit;
- cursor: inherit;
+ cursor: text;
input,
textarea {
+ width: 100%;
padding: 0 5px;
border: 0;
border-radius: inherit;
@@ -37,15 +40,60 @@ label {
background: none;
outline: none;
box-shadow: none;
+ cursor: inherit;
}
+ textarea {
+ height: 100%;
+ padding: 5px;
+ resize: none;
+ }
+ .prepend,
.append {
- display: inherit;
+ display: none;
+ justify-content: center;
+ align-items: center;
width: auto;
height: 30px;
- padding: 0 18px;
+ padding: 0 10px;
+ background: nth($cp, 1);
+ }
+ .prepend {
+ border-right: 1px solid nth($cp, 3);
+ border-radius: 4px 0 0 4px;
+ }
+ .append {
border-left: 1px solid nth($cp, 3);
border-radius: 0 4px 4px 0;
- background: nth($cp, 1);
+ }
+ &[prepend] .prepend {
+ display: flex;
+ }
+ &[append] .append {
+ display: flex;
+ }
+ /* ----- */
+ .icon {
+ padding: 0 5px;
+ --size: 20px;
+ }
+}
+/* --- */
+:host([disabled]) label {
+ background: nth($cp, 1);
+ cursor: not-allowed;
+ opacity: 0.6;
+}
+:host(:focus-within) {
+ box-shadow: 0 0 3px nth($ct, 1);
+}
+
+:host([type='textarea']) {
+ display: flex;
+ height: 80px;
+ label {
+ overflow: auto;
+ width: 100%;
+ height: 100%;
}
}
@@ -53,18 +101,142 @@ label {
diff --git a/src/icon/index.wc b/src/icon/index.wc
index a8b787f..c33b431 100644
--- a/src/icon/index.wc
+++ b/src/icon/index.wc
@@ -5,16 +5,14 @@