diff --git a/build.dev.js b/build.dev.js index 54b7a6f..b388c32 100644 --- a/build.dev.js +++ b/build.dev.js @@ -45,6 +45,10 @@ $cd: #62778d #526273 #425064; ::after{box-sizing:border-box;} ` +function parseName(str) { + return str.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`).replace(/^\-/, '') +} + function fixImport(str) { return str .replace(/import '([\w-/_.]*)'/g, 'import "$1.js"') @@ -140,8 +144,8 @@ const log = console.log ${js} -if(!customElements.get('wc-${name.toLowerCase()}')){ - customElements.define('wc-${name.toLowerCase()}', ${name}) +if(!customElements.get('wc-${parseName(name)}')){ + customElements.define('wc-${parseName(name)}', ${name}) } ` } diff --git a/build.prod.js b/build.prod.js index a59ad27..4bdfaa8 100644 --- a/build.prod.js +++ b/build.prod.js @@ -45,6 +45,10 @@ $cd: #62778d #526273 #425064; ::after{box-sizing:border-box;} ` +function parseName(str) { + return str.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`).replace(/^\-/, '') +} + function fixImport(str) { return str .replace(/import '([\w-/_.]*)'/g, 'import "$1.js"') @@ -149,8 +153,8 @@ function mkWCFile({ style, html, js }) { ${res.code} -if(!customElements.get('wc-${name.toLowerCase()}')){ - customElements.define('wc-${name.toLowerCase()}', ${name}) +if(!customElements.get('wc-${parseName(name)}')){ + customElements.define('wc-${parseName(name)}', ${name}) } ` } diff --git a/src/table/index.wc b/src/table/index.wc new file mode 100644 index 0000000..3ce7af9 --- /dev/null +++ b/src/table/index.wc @@ -0,0 +1,98 @@ + + + + + diff --git a/src/table/item.wc b/src/table/item.wc new file mode 100644 index 0000000..3edc94d --- /dev/null +++ b/src/table/item.wc @@ -0,0 +1,21 @@ + + + + +