-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebe7e5f
commit db9aeb2
Showing
144 changed files
with
2,143 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const fg = require('fast-glob') | ||
const path = require('node:path') | ||
const root = process.cwd() | ||
const fsp = require('node:fs/promises') | ||
|
||
export async function run() { | ||
const folder = 'src/ui/bitsUi' | ||
const url = path.resolve(root, folder) | ||
const entry = await fg(['**/*.json'], { dot: true, cwd: url }) | ||
|
||
for (const relative of entry) { | ||
const realUrl = path.resolve(url, relative) | ||
let jsonStr = await fsp.readFile(realUrl, 'utf8') | ||
try { | ||
const json = JSON.parse(jsonStr) | ||
if (!json.props) | ||
continue | ||
let changed = false | ||
const needsDeleteKeys = [] | ||
for (const k in json.props) { | ||
if (!k.startsWith('on')) | ||
continue | ||
needsDeleteKeys.push(k) | ||
const value = json.props[k] | ||
const description = value.description | ||
json.events.push( | ||
{ name: k, description, description_zh: description } | ||
) | ||
changed = true | ||
} | ||
for (const item of json.events) { | ||
if (!item.name.startsWith('on')) { | ||
item.name = 'on'+item.name[0].toUpperCase()+item.name.slice(1) | ||
changed = true | ||
} | ||
} | ||
if (needsDeleteKeys.length) { | ||
needsDeleteKeys.forEach(k => delete json.props[k]) | ||
} | ||
if (changed) { | ||
jsonStr = JSON.stringify(json, null, 2) | ||
fsp.writeFile(realUrl, jsonStr) | ||
} | ||
} catch (error) { | ||
continue | ||
} | ||
} | ||
} | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "Alert.Description", | ||
"props": {}, | ||
"description": "Displays a callout for user attention.", | ||
"link": "https://shadcn-svelte.com/docs/components/alert", | ||
"link_zh": "https://shadcn-svelte.com/docs/components/alert", | ||
"typeDetail": {}, | ||
"events": [], | ||
"methods": [], | ||
"slots": [], | ||
"filename": "AlertDescription" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "Alert.Root", | ||
"props": { | ||
"variant": { | ||
"value": "", | ||
"default": "[]", | ||
"type": "default/destructive", | ||
"description": "", | ||
"description_zh": "" | ||
} | ||
}, | ||
"description": "Displays a callout for user attention.", | ||
"link": "https://shadcn-svelte.com/docs/components/alert", | ||
"link_zh": "https://shadcn-svelte.com/docs/components/alert", | ||
"typeDetail": {}, | ||
"events": [], | ||
"methods": [], | ||
"slots": [], | ||
"suggestions": [ | ||
"Alert.Title", | ||
"Alert.Description" | ||
], | ||
"filename": "AlertRoot" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "Alert.Title", | ||
"props": { | ||
"level": { | ||
"value": "", | ||
"default": "[]", | ||
"type": "h1/h2/h3/h4/h5/h6", | ||
"description": "", | ||
"description_zh": "" | ||
} | ||
}, | ||
"description": "Displays a callout for user attention.", | ||
"link": "https://shadcn-svelte.com/docs/components/alert", | ||
"link_zh": "https://shadcn-svelte.com/docs/components/alert", | ||
"typeDetail": {}, | ||
"events": [], | ||
"methods": [], | ||
"slots": [], | ||
"filename": "AlertTitle" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "Badge", | ||
"props": { | ||
"variant": { | ||
"value": "", | ||
"default": "[]", | ||
"type": "default/secondary/destructive/outline", | ||
"description": "", | ||
"description_zh": "" | ||
} | ||
}, | ||
"description": "A special button component that can receive Melt UI builders for use with the asChild prop.", | ||
"link": "https://shadcn-svelte.com/docs/components/badge", | ||
"link_zh": "https://shadcn-svelte.com/docs/components/badge", | ||
"typeDetail": {}, | ||
"events": [], | ||
"methods": [], | ||
"slots": [], | ||
"filename": "Badge" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "Breadcrumb.Ellipsis", | ||
"props": { | ||
"el": { | ||
"value": "", | ||
"default": "[]", | ||
"type": "HTMLSpanElement", | ||
"description": "", | ||
"description_zh": "" | ||
} | ||
}, | ||
"description": "A special button component that can receive Melt UI builders for use with the asChild prop.", | ||
"link": "https://shadcn-svelte.com/docs/components/breadcrumb", | ||
"link_zh": "https://shadcn-svelte.com/docs/components/breadcrumb", | ||
"typeDetail": {}, | ||
"events": [], | ||
"methods": [], | ||
"slots": [], | ||
"filename": "BreadcrumbEllipsis" | ||
} |
Oops, something went wrong.