diff --git a/scripts/generate-ui-complete-catalog.mjs b/scripts/generate-ui-complete-catalog.mjs deleted file mode 100644 index 373e3add..00000000 --- a/scripts/generate-ui-complete-catalog.mjs +++ /dev/null @@ -1,157 +0,0 @@ -import { existsSync, readFileSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; - -const root = join(import.meta.dirname, "..", "packages", "ui"); -const componentsDir = join(root, "components"); -const catalog = JSON.parse(readFileSync(join(root, "component-catalog.json"), "utf8")); - -function add(name, source) { - const file = join(componentsDir, `${name}.wrn`); - const generated = existsSync(file) && readFileSync(file, "utf8").includes("props { "); - if (!existsSync(file) || generated) writeFileSync(file, `${source.trim()}\n`, "utf8"); -} - -function action(name) { - return `component ${name} { - props { - label = "Action" - href = "" - type = "button" - variant = "primary" - disabled = false - class = "" - } - view { {#if href}{label}{:else}{/if} } -}`; -} - -function form(name) { - if (name.endsWith("Form")) { - return `component ${name} { - props { - title = "" - description = "" - action = "" - method = "post" - submitLabel = "Submit" - loading = false - disabled = false - class = "" - } - view {

{title}

{description}

} -}`; - } - return `component ${name} { - props { - label = "${name.replace(/(Input|Field|Selector|Picker|Toggle|Group|Editor)$/, "")}" - name = "" - value = "" - placeholder = "" - type = "text" - required = false - disabled = false - readonly = false - help = "" - error = "" - class = "" - } - view { } -}`; -} - -function overlay(name) { - return `component ${name} { - props { - title = "" - description = "" - open = false - closeLabel = "Close" - class = "" - } - view {
} -}`; -} - -function collection(name) { - return `component ${name} { - props { - title = "" - description = "" - empty = false - emptyText = "No items available." - class = "" - } - view {

{title}

{description}

{emptyText}

} -}`; -} - -function visualization(name) { - return `component ${name} { - props { - title = "" - value = "" - description = "" - summary = "" - loading = false - class = "" - } - view {
{title}{value}{description}

{summary}

} -}`; -} - -function feedback(name) { - return `component ${name} { - props { - label = "${name.replace(/(Badge|Indicator|Counter|State|Alert|Banner|Notice|Skeleton)$/, "")}" - title = "" - description = "" - value = "" - variant = "default" - class = "" - } - view { } -}`; -} - -function layout(name) { - return `component ${name} { - props { - eyebrow = "" - title = "" - description = "" - align = "start" - class = "" - } - view {
{eyebrow}

{title}

{description}

} -}`; -} - -function content(name) { - return `component ${name} { - props { - eyebrow = "" - title = "" - description = "" - href = "" - actionLabel = "Learn more" - image = "" - alt = "" - class = "" - } - view {
{#if image}{alt}{/if}{#if eyebrow}{eyebrow}{/if}{#if title}

{title}

{/if}{#if description}

{description}

{/if}{#if href}{actionLabel}{/if}
} -}`; -} - -const factories = { - actions: action, - forms: form, - overlays: overlay, - data: collection, - visualization, - feedback, - layout, - content, -}; -for (const entry of catalog.components) { - add(entry.name, factories[entry.category](entry.name)); -}