diff --git a/develop.md b/develop.md
index 28ad8b2..f95d640 100644
--- a/develop.md
+++ b/develop.md
@@ -18,7 +18,7 @@
-
+
diff --git a/src/card/index.js b/src/card/index.js
index 98022e0..4da0872 100644
--- a/src/card/index.js
+++ b/src/card/index.js
@@ -68,4 +68,4 @@ class Card extends Component {
}
}
-customElements.define('wc-card', Card)
+Card.reg('card')
diff --git a/src/code/index.js b/src/code/index.js
new file mode 100644
index 0000000..ad9b126
--- /dev/null
+++ b/src/code/index.js
@@ -0,0 +1,131 @@
+/**
+ * {}
+ * @author yutent
+ * @date 2023/03/20 18:02:01
+ */
+import { html, css, Component, nextTick } from '@bd/core'
+
+class Code extends Component {
+ static props = {
+ code: { type: String, default: '', attribute: false },
+ lang: ''
+ }
+
+ static styles = [
+ css`
+ :host {
+ display: flex;
+ border-radius: 3px;
+ }
+ .code-box {
+ display: flex;
+ flex-direction: column;
+ position: relative;
+ width: 100%;
+ margin: 10px 0;
+ border-radius: 3px;
+ background: #f7f8fb;
+ color: var(--color-dark-1);
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
+
+ .title {
+ flex-shrink: 0;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+ height: 32px;
+ padding: 0 12px;
+ line-height: 1;
+ font-size: 14px;
+ user-select: none;
+
+ section {
+ display: flex;
+ align-items: center;
+ }
+ i {
+ display: block;
+ width: 12px;
+ height: 12px;
+ margin-right: 6px;
+ border-radius: 50%;
+ background: var(--color-red-1);
+
+ &:nth-child(2) {
+ background: var(--color-orange-1);
+ }
+ &:nth-child(3) {
+ background: var(--color-green-1);
+ }
+ }
+ }
+ }
+ `,
+ css`
+ .code-block {
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ overflow-y: auto;
+ line-height: 20px;
+ font-size: 14px;
+ color: var(--color-dark-1);
+ cursor: text;
+ counter-reset: code;
+
+ code {
+ display: block;
+ position: relative;
+ min-height: 20px;
+ padding: 0 8px 0 45px;
+ font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
+ white-space: pre-wrap;
+ word-break: break-word;
+
+ &::before {
+ position: absolute;
+ left: 0;
+ width: 40px;
+ height: 100%;
+ padding-right: 5px;
+ text-align: right;
+ color: var(--color-grey-1);
+ content: counter(code);
+ counter-increment: code;
+ }
+ }
+ }
+ `
+ ]
+
+ mounted() {
+ var txt = this.innerHTML || this.textContent
+ txt = txt.trim().replace(/^[\r\n]|\s{2,}$/g, '')
+ if (txt.startsWith('') && txt.endsWith('')) {
+ txt = txt.slice(5, -6).trim()
+ }
+ if (txt) {
+ this.textContent = ''
+ nextTick(_ => {
+ this.code = txt.replace(/</g, '<').replace(/>/g, '>')
+ })
+ }
+ }
+
+ render() {
+ return html`
+
+
+
+ ${this.code.split('\n').map(s => html`${s}
`)}
+
+
+ `
+ }
+}
+
+Code.reg('code')
diff --git a/src/form/button.js b/src/form/button.js
index a86e27d..ce6732b 100644
--- a/src/form/button.js
+++ b/src/form/button.js
@@ -264,4 +264,4 @@ class Button extends Component {
}
}
-customElements.define('wc-button', Button)
+Button.reg('button')
diff --git a/src/form/link.js b/src/form/link.js
index cf676a8..d9d4f98 100644
--- a/src/form/link.js
+++ b/src/form/link.js
@@ -152,4 +152,4 @@ class Link extends Component {
}
}
-customElements.define('wc-link', Link)
+Link.reg('link')
diff --git a/src/form/passwd.js b/src/form/passwd.js
index 9635d24..d179d8b 100644
--- a/src/form/passwd.js
+++ b/src/form/passwd.js
@@ -241,4 +241,4 @@ class Passwd extends Component {
}
}
-customElements.define('wc-passwd', Passwd)
+Passwd.reg('passwd')
diff --git a/src/form/radio.js b/src/form/radio.js
index e69de29..66a5d14 100644
--- a/src/form/radio.js
+++ b/src/form/radio.js
@@ -0,0 +1,9 @@
+/**
+ * {}
+ * @author yutent
+ * @date 2023/03/21 16:14:10
+ */
+
+import { nextTick, css, html, Component } from '@bd/core'
+
+class Radio extends Component {}
diff --git a/src/icon/index.js b/src/icon/index.js
index 87f4999..60493d7 100644
--- a/src/icon/index.js
+++ b/src/icon/index.js
@@ -104,4 +104,4 @@ class Icon extends Component {
}
}
-customElements.define('wc-icon', Icon)
+Icon.reg('icon')
diff --git a/src/markd/index.js b/src/markd/index.js
new file mode 100644
index 0000000..74be18c
--- /dev/null
+++ b/src/markd/index.js
@@ -0,0 +1,578 @@
+/**
+ * markdown解析器
+ * @author yutent
+ * @date 2020/02/07 17:14:19
+ */
+
+const HR_LIST = ['=', '-', '_', '*']
+const LIST_RE = /^(([\+\-\*])|(\d+\.))\s/
+const TODO_RE = /^[\+\-\*]\s\[(x|\s)\]\s/
+const ESCAPE_RE = /\\([-+*_`\]\[\(\)])/g
+const QLINK_RE = /^\[(\d+)\]: ([\S]+)\s*?((['"])[\s\S]*?\4)?\s*?$/
+const TAG_RE = /<([\w\-]+)([\w\W]*?)>/g
+const ATTR_RE = /\s*?on[a-zA-Z]+="[^"]*?"\s*?/g
+const CODEBLOCK_RE = /```(.*?)([\w\W]*?)```/g
+const BLOCK_RE = /<([\w\-]+)([^>]*?)>([\w\W]*?)<\/\1>/g
+const IS_DOM_RE = /^<([\w\-]+)[^>]*?>.*?<\/\1>$/
+const STYLE_RE = /`
+ })
+ delete this.list
+ delete this.__LINKS__
+ return html
+ }
+}
+
+export default function (str) {
+ return Tool.init(str).parse()
+}
diff --git a/src/space/index.js b/src/space/index.js
index 5e4a53f..aad7193 100644
--- a/src/space/index.js
+++ b/src/space/index.js
@@ -52,4 +52,4 @@ class Space extends Component {
}
}
-customElements.define('wc-space', Space)
+Space.reg('space')