UNPKG

bigblocks

Version:

Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React

95 lines (94 loc) 4.02 kB
import chalk from "chalk"; import { Command } from "commander"; import { getRegistryIndex } from "../utils/registry.js"; // Import the aliases for display const COMPONENT_ALIASES = { // Authentication "auth-button": "authentication-authbutton", "login-form": "authentication-loginform", "signup-flow": "authentication-signupflow", "device-link": "authentication-devicelinkqr", "oauth-restore": "authentication-oauthrestoreflow", "auth-flow": "authentication-authfloworchestrator", // UI Components "loading-button": "ui-components-loadingbutton", "warning-card": "ui-components-warningcard", "bitcoin-avatar": "ui-components-bitcoinavatar", "qr-code": "ui-components-qrcoderenderer", "password-input": "ui-components-passwordinput", "error-display": "ui-components-errordisplay", modal: "ui-components-modal", dropzone: "ui-components-dropzone", // Profile "profile-card": "profile-management-profilecard", "profile-editor": "profile-management-profileeditor", "profile-dropdown": "profile-management-profiledropdownmenu", "profile-popover": "profile-management-profilepopover", "profile-switcher": "profile-management-profileswitcher", // Social "post-button": "social-components-postbutton", "like-button": "social-components-likebutton", "follow-button": "social-components-followbutton", "social-feed": "social-components-socialfeed", "post-card": "social-components-postcard", // Wallet "send-button": "wallet-components-sendbsvbutton", "donate-button": "wallet-components-donatebutton", "wallet-overview": "wallet-components-walletoverview", "token-balance": "wallet-components-tokenbalance", // Backup "backup-download": "backup-recovery-backupdownload", "backup-import": "backup-recovery-backupimport", "file-import": "backup-recovery-fileimport", "mnemonic-display": "backup-recovery-mnemonicdisplay", // Market "buy-button": "market-components-buylistingbutton", "sell-button": "market-components-createlistingbutton", "cancel-listing": "market-components-cancellistingbutton", "market-table": "market-components-markettable", // Inscriptions "inscription-button": "inscriptions-components-inscriptionbutton", "mint-button": "inscriptions-components-bsv20mintbutton", "collection-form": "inscriptions-components-collectionform", // Developer Tools "key-manager": "developer-tools-keymanager", "artifact-display": "developer-tools-artifactdisplay", // Providers "bitcoin-auth": "providers-bitcoinauthprovider", "bitcoin-query": "providers-bitcoinqueryprovider", }; // Create reverse mapping for display const ALIAS_LOOKUP = Object.fromEntries(Object.entries(COMPONENT_ALIASES).map(([alias, full]) => [full, alias])); export const list = new Command() .name("list") .description("List all available components") .action(async () => { try { const index = await getRegistryIndex(); console.log(chalk.bold("\nAvailable components:\n")); // Group by type const grouped = index.reduce((acc, component) => { const type = component.type.replace("registry:", ""); if (!acc[type]) acc[type] = []; acc[type].push(component.name); return acc; }, {}); // Display grouped with aliases for (const [type, names] of Object.entries(grouped)) { console.log(chalk.cyan(`${type}:`)); console.log(names .map((n) => { const alias = ALIAS_LOOKUP[n]; return alias ? ` • ${chalk.green(alias)} ${chalk.gray(`(${n})`)}` : ` • ${n}`; }) .join("\n")); console.log(); } } catch (error) { console.error(chalk.red("Failed to load components:"), error instanceof Error ? error.message : String(error)); } });