Skip to content

Commit

Permalink
feat: support material-ui5
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Jun 28, 2024
1 parent 1b93186 commit d1e77eb
Show file tree
Hide file tree
Showing 146 changed files with 26,170 additions and 370 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Install the supported ui component library in your project and install the plug-
- taro 3
- shacn-svelte 0
- bits-ui 0
- material-ui 5

### [antdv demo](assets/antdv.gif)

Expand Down
1 change: 1 addition & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- taro 3
- shacn-svelte 0
- bits-ui 0
- material-ui 5

### [antdv demo](assets/antdv.gif)

Expand Down
9 changes: 5 additions & 4 deletions scripts/generateIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ const fsp = require('node:fs/promises')
const fg = require('fast-glob')

export async function run() {
const folder = 'src/ui/bitsUi'
const lib = 'bitsUi0'
const name = 'bitsUi0'
const folder = 'src/ui/materialUi'
const lib = 'materialUi5'
const name = 'materialUi5'
const isHyphen = false /** 生成的模板中的使用是 true ? a-affix : AAfix */
const isReact = false
const url = path.resolve(root, `${folder}/${name}`)
const entry = await fg(['**/*.json'], { dot: true, cwd: url })
const imports = entry.map((_url: string) => `import ${_url.split('.')[0]} from './${_url}'`)
Expand Down Expand Up @@ -37,7 +38,7 @@ const componentsMap = [
${map.join('\n ')}
]
export function ${name}Components() {
return componentsReducer(componentsMap, ${isHyphen}, '${prefix}', '${lib}')
return componentsReducer(componentsMap, ${isHyphen}, '${prefix}', '${lib}', ${isReact})
}
`
fsp.writeFile(path.resolve(root, `${folder}/${name}/index.ts`), template)
Expand Down
62 changes: 32 additions & 30 deletions scripts/materialUi.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,31 @@ function run() {
let description = ''
if (!children[3]) {
description = children[2].textContent
if (name.startsWith('on')) {
const params = children[2].querySelector('code')?.textContent
const description = children[2].textContent.replace(params, '')
events.push({
name,
description,
description_zh: description,
params
})
}
} else {
value = children[2].textContent
description = children[3].textContent
if (name.startsWith('on')) {
const params = children[3].querySelector('code')?.textContent
const description = children[3].textContent.replace(params, '')
events.push({
name,
description,
description_zh: description,
params
})
}
}
if (name.startsWith('on')) {
const params = children[3].querySelector('code').textContent
const description = children[3].textContent.replace(params, '')
events.push({
name,
description,
description_zh: description,
params
})
}

const type = children[1].textContent.replace(/'/g, '').replace(/ /g, ' ')
props[name] = {
description,
Expand Down Expand Up @@ -108,24 +119,13 @@ function run() {
return result
}

const storage = JSON.parse(localStorage.getItem('materialUi.data.cache') || '[]')
function setup() {
const childNodes = $0.childNodes
for (let i = 0; i < childNodes.length; i++) {
const item = childNodes[i]
const href = item.querySelector('a').href
location.href = href
setTimeout(() => {
const item = run()

storage.push(item)
console.log({ storage })
localStorage.setItem('materialUi.data.cache', JSON.stringify(storage))
i++
}, 5000)
}
return results
}
// const storage = JSON.parse(localStorage.getItem('materialUi.data.cache') || '[]')
// function setup() {
// const item = run()
// storage.push(item)
// localStorage.setItem('materialUi.data.cache', JSON.stringify(storage))
// return storage
// }



Expand Down Expand Up @@ -162,8 +162,10 @@ const cwd = process.cwd()
generateJson(data)
function generateJson() {
const baseSrc = 'src/ui/materialUi/materialUi5'
const url = path.resolve(cwd, baseSrc, `${data.name}.json`)
fsp.writeFile(url, JSON.stringify(data, null, 2), 'utf-8')
data.forEach(item=>{
const url = path.resolve(cwd, baseSrc, `${item.name}.json`)
fsp.writeFile(url, JSON.stringify(item, null, 2), 'utf-8')
})
}


Loading

0 comments on commit d1e77eb

Please sign in to comment.