softricity-ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -2
- package/lib/cli.mjs +322 -0
- package/lib/prompt-lib.mjs +215 -0
- package/package.json +33 -4
- package/registry/assets/fonts/Urbanist_500Medium.ttf +0 -0
- package/registry/assets/fonts/Urbanist_600SemiBold.ttf +0 -0
- package/registry/assets/fonts/Urbanist_700Bold.ttf +0 -0
- package/registry/assets/fonts/urbanist-latin.woff2 +0 -0
- package/registry/catalog.md +122 -0
- package/registry/components/charts/area-chart/AreaChart.tsx +153 -0
- package/registry/components/charts/area-chart/demo.tsx +18 -0
- package/registry/components/charts/area-chart/meta.json +17 -0
- package/registry/components/charts/bar-chart/BarChart.tsx +76 -0
- package/registry/components/charts/bar-chart/demo.tsx +18 -0
- package/registry/components/charts/bar-chart/meta.json +19 -0
- package/registry/components/charts/candlestick-chart/CandlestickChart.tsx +196 -0
- package/registry/components/charts/candlestick-chart/demo.tsx +39 -0
- package/registry/components/charts/candlestick-chart/meta.json +16 -0
- package/registry/components/charts/capsule-chart/CapsuleChart.tsx +89 -0
- package/registry/components/charts/capsule-chart/demo.tsx +15 -0
- package/registry/components/charts/capsule-chart/meta.json +17 -0
- package/registry/components/charts/funnel-chart/FunnelChart.tsx +59 -0
- package/registry/components/charts/funnel-chart/demo.tsx +14 -0
- package/registry/components/charts/funnel-chart/meta.json +16 -0
- package/registry/components/charts/gauge-chart/GaugeChart.tsx +89 -0
- package/registry/components/charts/gauge-chart/demo.tsx +12 -0
- package/registry/components/charts/gauge-chart/meta.json +17 -0
- package/registry/components/charts/ring/Ring.tsx +52 -0
- package/registry/components/charts/ring/demo.tsx +13 -0
- package/registry/components/charts/ring/meta.json +18 -0
- package/registry/components/charts/sparkline/Sparkline.tsx +41 -0
- package/registry/components/charts/sparkline/demo.tsx +12 -0
- package/registry/components/charts/sparkline/meta.json +18 -0
- package/registry/components/data-display/accordion/Accordion.tsx +68 -0
- package/registry/components/data-display/accordion/demo.tsx +13 -0
- package/registry/components/data-display/accordion/meta.json +18 -0
- package/registry/components/data-display/action-list/ActionList.tsx +55 -0
- package/registry/components/data-display/action-list/demo.tsx +24 -0
- package/registry/components/data-display/action-list/meta.json +17 -0
- package/registry/components/data-display/activity-feed/ActivityFeed.tsx +56 -0
- package/registry/components/data-display/activity-feed/demo.tsx +17 -0
- package/registry/components/data-display/activity-feed/meta.json +14 -0
- package/registry/components/data-display/breakdown-list/BreakdownList.tsx +58 -0
- package/registry/components/data-display/breakdown-list/demo.tsx +14 -0
- package/registry/components/data-display/breakdown-list/meta.json +17 -0
- package/registry/components/data-display/card/Card.tsx +51 -0
- package/registry/components/data-display/card/demo.tsx +16 -0
- package/registry/components/data-display/card/meta.json +19 -0
- package/registry/components/data-display/change/Change.tsx +35 -0
- package/registry/components/data-display/change/demo.tsx +12 -0
- package/registry/components/data-display/change/meta.json +17 -0
- package/registry/components/data-display/count-number/CountNumber.tsx +12 -0
- package/registry/components/data-display/count-number/demo.tsx +16 -0
- package/registry/components/data-display/count-number/meta.json +16 -0
- package/registry/components/data-display/data-table/DataTable.tsx +83 -0
- package/registry/components/data-display/data-table/demo.tsx +30 -0
- package/registry/components/data-display/data-table/meta.json +18 -0
- package/registry/components/data-display/description-list/DescriptionList.tsx +16 -0
- package/registry/components/data-display/description-list/demo.tsx +10 -0
- package/registry/components/data-display/description-list/meta.json +13 -0
- package/registry/components/data-display/empty-state/EmptyState.tsx +14 -0
- package/registry/components/data-display/empty-state/demo.tsx +13 -0
- package/registry/components/data-display/empty-state/meta.json +18 -0
- package/registry/components/data-display/goal-card/GoalCard.tsx +33 -0
- package/registry/components/data-display/goal-card/demo.tsx +7 -0
- package/registry/components/data-display/goal-card/meta.json +16 -0
- package/registry/components/data-display/heatmap/Heatmap.tsx +56 -0
- package/registry/components/data-display/heatmap/demo.tsx +17 -0
- package/registry/components/data-display/heatmap/meta.json +17 -0
- package/registry/components/data-display/kpi-card/KpiCard.tsx +47 -0
- package/registry/components/data-display/kpi-card/demo.tsx +20 -0
- package/registry/components/data-display/kpi-card/meta.json +18 -0
- package/registry/components/data-display/leaderboard-card/LeaderboardCard.tsx +40 -0
- package/registry/components/data-display/leaderboard-card/demo.tsx +13 -0
- package/registry/components/data-display/leaderboard-card/meta.json +16 -0
- package/registry/components/data-display/legend/Legend.tsx +19 -0
- package/registry/components/data-display/legend/demo.tsx +5 -0
- package/registry/components/data-display/legend/meta.json +13 -0
- package/registry/components/data-display/meter/Meter.tsx +33 -0
- package/registry/components/data-display/meter/demo.tsx +14 -0
- package/registry/components/data-display/meter/meta.json +19 -0
- package/registry/components/data-display/notice-list/NoticeList.tsx +30 -0
- package/registry/components/data-display/notice-list/demo.tsx +22 -0
- package/registry/components/data-display/notice-list/meta.json +17 -0
- package/registry/components/data-display/odometer/Odometer.tsx +37 -0
- package/registry/components/data-display/odometer/demo.tsx +15 -0
- package/registry/components/data-display/odometer/meta.json +14 -0
- package/registry/components/data-display/permission-matrix/PermissionMatrix.tsx +77 -0
- package/registry/components/data-display/permission-matrix/demo.tsx +20 -0
- package/registry/components/data-display/permission-matrix/meta.json +16 -0
- package/registry/components/data-display/pricing-card/PricingCard.tsx +108 -0
- package/registry/components/data-display/pricing-card/demo.tsx +33 -0
- package/registry/components/data-display/pricing-card/meta.json +16 -0
- package/registry/components/data-display/segment-bar/SegmentBar.tsx +46 -0
- package/registry/components/data-display/segment-bar/demo.tsx +12 -0
- package/registry/components/data-display/segment-bar/meta.json +17 -0
- package/registry/components/data-display/settings-row/SettingsRow.tsx +14 -0
- package/registry/components/data-display/settings-row/demo.tsx +18 -0
- package/registry/components/data-display/settings-row/meta.json +13 -0
- package/registry/components/data-display/split-bar/SplitBar.tsx +23 -0
- package/registry/components/data-display/split-bar/demo.tsx +13 -0
- package/registry/components/data-display/split-bar/meta.json +13 -0
- package/registry/components/data-display/stat/Stat.tsx +33 -0
- package/registry/components/data-display/stat/demo.tsx +12 -0
- package/registry/components/data-display/stat/meta.json +13 -0
- package/registry/components/data-display/stat-strip/StatStrip.tsx +40 -0
- package/registry/components/data-display/stat-strip/demo.tsx +15 -0
- package/registry/components/data-display/stat-strip/meta.json +16 -0
- package/registry/components/data-display/theme-picker/ThemePicker.tsx +82 -0
- package/registry/components/data-display/theme-picker/demo.tsx +21 -0
- package/registry/components/data-display/theme-picker/meta.json +18 -0
- package/registry/components/data-display/tick-value/TickValue.tsx +19 -0
- package/registry/components/data-display/tick-value/demo.tsx +12 -0
- package/registry/components/data-display/tick-value/meta.json +13 -0
- package/registry/components/data-display/ticker/Ticker.tsx +32 -0
- package/registry/components/data-display/ticker/demo.tsx +12 -0
- package/registry/components/data-display/ticker/meta.json +13 -0
- package/registry/components/data-display/timeline/Timeline.tsx +72 -0
- package/registry/components/data-display/timeline/demo.tsx +19 -0
- package/registry/components/data-display/timeline/meta.json +17 -0
- package/registry/components/data-display/token-icon/TokenIcon.tsx +38 -0
- package/registry/components/data-display/token-icon/demo.tsx +13 -0
- package/registry/components/data-display/token-icon/meta.json +17 -0
- package/registry/components/data-display/transaction-row/TransactionRow.tsx +54 -0
- package/registry/components/data-display/transaction-row/demo.tsx +20 -0
- package/registry/components/data-display/transaction-row/meta.json +14 -0
- package/registry/components/data-display/uptime-strip/UptimeStrip.tsx +52 -0
- package/registry/components/data-display/uptime-strip/demo.tsx +15 -0
- package/registry/components/data-display/uptime-strip/meta.json +17 -0
- package/registry/components/domain-blocks/auction-lot-card/AuctionLotCard.tsx +123 -0
- package/registry/components/domain-blocks/auction-lot-card/demo.tsx +26 -0
- package/registry/components/domain-blocks/auction-lot-card/meta.json +23 -0
- package/registry/components/domain-blocks/balance-card/BalanceCard.tsx +80 -0
- package/registry/components/domain-blocks/balance-card/demo.tsx +16 -0
- package/registry/components/domain-blocks/balance-card/meta.json +14 -0
- package/registry/components/domain-blocks/calendar/Calendar.tsx +376 -0
- package/registry/components/domain-blocks/calendar/demo.tsx +53 -0
- package/registry/components/domain-blocks/calendar/meta.json +23 -0
- package/registry/components/domain-blocks/call-bar/CallBar.tsx +45 -0
- package/registry/components/domain-blocks/call-bar/demo.tsx +23 -0
- package/registry/components/domain-blocks/call-bar/meta.json +14 -0
- package/registry/components/domain-blocks/card-stack/CardStack.tsx +65 -0
- package/registry/components/domain-blocks/card-stack/demo.tsx +12 -0
- package/registry/components/domain-blocks/card-stack/meta.json +16 -0
- package/registry/components/domain-blocks/contact-profile-card/ContactProfileCard.tsx +216 -0
- package/registry/components/domain-blocks/contact-profile-card/demo.tsx +38 -0
- package/registry/components/domain-blocks/contact-profile-card/meta.json +16 -0
- package/registry/components/domain-blocks/customer-card/CustomerCard.tsx +112 -0
- package/registry/components/domain-blocks/customer-card/demo.tsx +40 -0
- package/registry/components/domain-blocks/customer-card/meta.json +30 -0
- package/registry/components/domain-blocks/invoice-preview/InvoicePreview.tsx +100 -0
- package/registry/components/domain-blocks/invoice-preview/demo.tsx +22 -0
- package/registry/components/domain-blocks/invoice-preview/meta.json +17 -0
- package/registry/components/domain-blocks/kanban-board/KanbanBoard.tsx +221 -0
- package/registry/components/domain-blocks/kanban-board/demo.tsx +48 -0
- package/registry/components/domain-blocks/kanban-board/meta.json +24 -0
- package/registry/components/domain-blocks/keypad/Keypad.tsx +67 -0
- package/registry/components/domain-blocks/keypad/demo.tsx +15 -0
- package/registry/components/domain-blocks/keypad/meta.json +13 -0
- package/registry/components/domain-blocks/node-canvas/NodeCanvas.tsx +120 -0
- package/registry/components/domain-blocks/node-canvas/demo.tsx +18 -0
- package/registry/components/domain-blocks/node-canvas/meta.json +16 -0
- package/registry/components/domain-blocks/onboarding-carousel/OnboardingCarousel.tsx +100 -0
- package/registry/components/domain-blocks/onboarding-carousel/demo.tsx +13 -0
- package/registry/components/domain-blocks/onboarding-carousel/meta.json +16 -0
- package/registry/components/domain-blocks/pay-card/PayCard.tsx +51 -0
- package/registry/components/domain-blocks/pay-card/demo.tsx +25 -0
- package/registry/components/domain-blocks/pay-card/meta.json +14 -0
- package/registry/components/domain-blocks/project-card/ProjectCard.tsx +59 -0
- package/registry/components/domain-blocks/project-card/demo.tsx +34 -0
- package/registry/components/domain-blocks/project-card/meta.json +16 -0
- package/registry/components/domain-blocks/quick-actions/QuickActions.tsx +58 -0
- package/registry/components/domain-blocks/quick-actions/demo.tsx +31 -0
- package/registry/components/domain-blocks/quick-actions/meta.json +28 -0
- package/registry/components/domain-blocks/quota-card/QuotaCard.tsx +48 -0
- package/registry/components/domain-blocks/quota-card/demo.tsx +20 -0
- package/registry/components/domain-blocks/quota-card/meta.json +16 -0
- package/registry/components/domain-blocks/recipient-picker/RecipientPicker.tsx +42 -0
- package/registry/components/domain-blocks/recipient-picker/demo.tsx +16 -0
- package/registry/components/domain-blocks/recipient-picker/meta.json +16 -0
- package/registry/components/domain-blocks/sign-in/SignIn.tsx +77 -0
- package/registry/components/domain-blocks/sign-in/demo.tsx +20 -0
- package/registry/components/domain-blocks/sign-in/meta.json +18 -0
- package/registry/components/domain-blocks/task-checklist/TaskChecklist.tsx +116 -0
- package/registry/components/domain-blocks/task-checklist/demo.tsx +23 -0
- package/registry/components/domain-blocks/task-checklist/meta.json +16 -0
- package/registry/components/layout/app-shell/AppShell.tsx +50 -0
- package/registry/components/layout/app-shell/demo.tsx +37 -0
- package/registry/components/layout/app-shell/meta.json +18 -0
- package/registry/components/layout/mesh-background/MeshBackground.tsx +39 -0
- package/registry/components/layout/mesh-background/demo.tsx +14 -0
- package/registry/components/layout/mesh-background/meta.json +14 -0
- package/registry/components/layout/page-header/PageHeader.tsx +19 -0
- package/registry/components/layout/page-header/demo.tsx +13 -0
- package/registry/components/layout/page-header/meta.json +18 -0
- package/registry/components/layout/section-label/SectionLabel.tsx +6 -0
- package/registry/components/layout/section-label/demo.tsx +12 -0
- package/registry/components/layout/section-label/meta.json +13 -0
- package/registry/components/layout/toolbar/Toolbar.tsx +7 -0
- package/registry/components/layout/toolbar/demo.tsx +21 -0
- package/registry/components/layout/toolbar/meta.json +13 -0
- package/registry/components/navigation/breadcrumbs/Breadcrumbs.tsx +22 -0
- package/registry/components/navigation/breadcrumbs/demo.tsx +10 -0
- package/registry/components/navigation/breadcrumbs/meta.json +13 -0
- package/registry/components/navigation/command-finder/CommandFinder.tsx +135 -0
- package/registry/components/navigation/command-finder/demo.tsx +28 -0
- package/registry/components/navigation/command-finder/meta.json +18 -0
- package/registry/components/navigation/command-trigger/CommandTrigger.tsx +66 -0
- package/registry/components/navigation/command-trigger/demo.tsx +12 -0
- package/registry/components/navigation/command-trigger/meta.json +16 -0
- package/registry/components/navigation/dock/Dock.tsx +64 -0
- package/registry/components/navigation/dock/demo.tsx +22 -0
- package/registry/components/navigation/dock/meta.json +14 -0
- package/registry/components/navigation/mega-menu/MegaMenu.tsx +111 -0
- package/registry/components/navigation/mega-menu/demo.tsx +26 -0
- package/registry/components/navigation/mega-menu/meta.json +16 -0
- package/registry/components/navigation/pill-nav/PillNav.tsx +45 -0
- package/registry/components/navigation/pill-nav/demo.tsx +14 -0
- package/registry/components/navigation/pill-nav/meta.json +14 -0
- package/registry/components/navigation/segmented/Segmented.tsx +60 -0
- package/registry/components/navigation/segmented/demo.tsx +16 -0
- package/registry/components/navigation/segmented/meta.json +19 -0
- package/registry/components/navigation/sidebar-nav/SidebarNav.tsx +147 -0
- package/registry/components/navigation/sidebar-nav/demo.tsx +30 -0
- package/registry/components/navigation/sidebar-nav/meta.json +18 -0
- package/registry/components/navigation/steps/Steps.tsx +43 -0
- package/registry/components/navigation/steps/demo.tsx +19 -0
- package/registry/components/navigation/steps/meta.json +17 -0
- package/registry/components/navigation/tabbar/Tabbar.tsx +33 -0
- package/registry/components/navigation/tabbar/demo.tsx +16 -0
- package/registry/components/navigation/tabbar/meta.json +18 -0
- package/registry/components/navigation/tabs/Tabs.tsx +50 -0
- package/registry/components/navigation/tabs/demo.tsx +15 -0
- package/registry/components/navigation/tabs/meta.json +18 -0
- package/registry/components/navigation/topbar/Topbar.tsx +39 -0
- package/registry/components/navigation/topbar/demo.tsx +26 -0
- package/registry/components/navigation/topbar/meta.json +17 -0
- package/registry/components/overlays/overlay-system/demo.tsx +52 -0
- package/registry/components/overlays/overlay-system/meta.json +20 -0
- package/registry/components/overlays/overlay-system/overlays.tsx +360 -0
- package/registry/components/overlays/success-check/SuccessCheck.tsx +42 -0
- package/registry/components/overlays/success-check/demo.tsx +19 -0
- package/registry/components/overlays/success-check/meta.json +28 -0
- package/registry/components/primitives/avatar/Avatar.tsx +46 -0
- package/registry/components/primitives/avatar/demo.tsx +20 -0
- package/registry/components/primitives/avatar/meta.json +19 -0
- package/registry/components/primitives/badge/Badge.tsx +15 -0
- package/registry/components/primitives/badge/demo.tsx +9 -0
- package/registry/components/primitives/badge/meta.json +13 -0
- package/registry/components/primitives/button/Button.tsx +53 -0
- package/registry/components/primitives/button/demo.tsx +28 -0
- package/registry/components/primitives/button/meta.json +17 -0
- package/registry/components/primitives/checkbox/Checkbox.tsx +30 -0
- package/registry/components/primitives/checkbox/demo.tsx +16 -0
- package/registry/components/primitives/checkbox/meta.json +18 -0
- package/registry/components/primitives/chip/Chip.tsx +35 -0
- package/registry/components/primitives/chip/demo.tsx +15 -0
- package/registry/components/primitives/chip/meta.json +13 -0
- package/registry/components/primitives/copy-button/CopyButton.tsx +49 -0
- package/registry/components/primitives/copy-button/demo.tsx +15 -0
- package/registry/components/primitives/copy-button/meta.json +31 -0
- package/registry/components/primitives/field/Field.tsx +81 -0
- package/registry/components/primitives/field/demo.tsx +21 -0
- package/registry/components/primitives/field/meta.json +19 -0
- package/registry/components/primitives/icon/Icon.tsx +26 -0
- package/registry/components/primitives/icon/demo.tsx +25 -0
- package/registry/components/primitives/icon/icons.ts +208 -0
- package/registry/components/primitives/icon/meta.json +17 -0
- package/registry/components/primitives/icon-button/IconButton.tsx +42 -0
- package/registry/components/primitives/icon-button/demo.tsx +14 -0
- package/registry/components/primitives/icon-button/meta.json +17 -0
- package/registry/components/primitives/icon-tile/IconTile.tsx +37 -0
- package/registry/components/primitives/icon-tile/demo.tsx +16 -0
- package/registry/components/primitives/icon-tile/meta.json +17 -0
- package/registry/components/primitives/kbd/Kbd.tsx +11 -0
- package/registry/components/primitives/kbd/demo.tsx +9 -0
- package/registry/components/primitives/kbd/meta.json +13 -0
- package/registry/components/primitives/live-dot/LiveDot.tsx +15 -0
- package/registry/components/primitives/live-dot/demo.tsx +11 -0
- package/registry/components/primitives/live-dot/meta.json +13 -0
- package/registry/components/primitives/pill/Pill.tsx +52 -0
- package/registry/components/primitives/pill/demo.tsx +24 -0
- package/registry/components/primitives/pill/meta.json +38 -0
- package/registry/components/primitives/search-input/SearchInput.tsx +23 -0
- package/registry/components/primitives/search-input/demo.tsx +13 -0
- package/registry/components/primitives/search-input/meta.json +17 -0
- package/registry/components/primitives/skeleton/Skeleton.tsx +21 -0
- package/registry/components/primitives/skeleton/demo.tsx +11 -0
- package/registry/components/primitives/skeleton/meta.json +13 -0
- package/registry/components/primitives/slide-to-confirm/SlideToConfirm.tsx +60 -0
- package/registry/components/primitives/slide-to-confirm/demo.tsx +16 -0
- package/registry/components/primitives/slide-to-confirm/meta.json +13 -0
- package/registry/components/primitives/slider/Slider.tsx +155 -0
- package/registry/components/primitives/slider/demo.tsx +33 -0
- package/registry/components/primitives/slider/meta.json +16 -0
- package/registry/components/primitives/spinner/Spinner.tsx +6 -0
- package/registry/components/primitives/spinner/demo.tsx +10 -0
- package/registry/components/primitives/spinner/meta.json +13 -0
- package/registry/components/primitives/stepper/Stepper.tsx +36 -0
- package/registry/components/primitives/stepper/demo.tsx +14 -0
- package/registry/components/primitives/stepper/meta.json +17 -0
- package/registry/components/primitives/switch/Switch.tsx +37 -0
- package/registry/components/primitives/switch/demo.tsx +15 -0
- package/registry/components/primitives/switch/meta.json +19 -0
- package/registry/index.json +3303 -0
- package/registry/lib/chart-math.ts +23 -0
- package/registry/lib/cn.ts +41 -0
- package/registry/lib/motion.ts +104 -0
- package/registry/package.json +16 -0
- package/registry/templates/brisko/Template.tsx +149 -0
- package/registry/templates/brisko/data.ts +32 -0
- package/registry/templates/brisko/template.json +11 -0
- package/registry/templates/kavora/Template.tsx +44 -0
- package/registry/templates/kavora/data.ts +21 -0
- package/registry/templates/kavora/pages/Orders.tsx +58 -0
- package/registry/templates/kavora/pages/Overview.tsx +78 -0
- package/registry/templates/kavora/template.json +12 -0
- package/registry/templates/kestro-desk/Template.tsx +61 -0
- package/registry/templates/kestro-desk/data.ts +31 -0
- package/registry/templates/kestro-desk/pages/History.tsx +64 -0
- package/registry/templates/kestro-desk/pages/Overview.tsx +91 -0
- package/registry/templates/kestro-desk/template.json +12 -0
- package/registry/templates/rapport/Template.tsx +36 -0
- package/registry/templates/rapport/data.ts +28 -0
- package/registry/templates/rapport/pages/Customers.tsx +49 -0
- package/registry/templates/rapport/pages/Pipeline.tsx +92 -0
- package/registry/templates/rapport/template.json +12 -0
- package/registry/templates/sagewell/Template.tsx +21 -0
- package/registry/templates/sagewell/pages/Cards.tsx +49 -0
- package/registry/templates/sagewell/pages/Home.tsx +53 -0
- package/registry/templates/sagewell/pages/Send.tsx +37 -0
- package/registry/templates/sagewell/template.json +13 -0
- package/registry/tokens/base.css +37 -0
- package/registry/tokens/index.css +8 -0
- package/registry/tokens/tailwind.css +83 -0
- package/registry/tokens/themes/brisko.css +34 -0
- package/registry/tokens/themes/kavora.css +32 -0
- package/registry/tokens/themes/kestro.css +32 -0
- package/registry/tokens/themes/rapport.css +35 -0
- package/registry/tokens/themes/sagewell.css +34 -0
- package/server.mjs +358 -0
package/README.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Softricity UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**63 dashboard components and 5 full templates for Next.js 15 + Tailwind CSS v4 + TypeScript — served to your AI through MCP.**
|
|
4
|
+
|
|
5
|
+
Ask your AI assistant for a sortable table, a KPI row, a command palette or a whole dashboard. It finds the right part, copies the source into your project (you own it, edit anything), wires the theme, and tells you what to install. No runtime package, no lock-in.
|
|
6
|
+
|
|
7
|
+
- **Components:** buttons, fields, tabs, segmented controls, sidebar, dock, ⌘K finder, KPI cards, data table, charts (area, bars, capsules, ring, donut), drawers, modals, menus, toasts, sign-in, pay card, keypad…
|
|
8
|
+
- **Templates:** trading desk, coffee-trading admin, ops automation, CRM, mobile banking.
|
|
9
|
+
- **Themes:** `kestro` · `kavora` · `brisko` · `rapport` · `sagewell`, light + dark — or make your own brand theme in one call.
|
|
10
|
+
- **Low token use:** short text answers; code and full rebuild prompts only when the AI asks.
|
|
11
|
+
|
|
12
|
+
## Install in your AI app
|
|
13
|
+
|
|
14
|
+
Needs Node 18.17+. The server runs on your machine via `npx`.
|
|
15
|
+
|
|
16
|
+
**Claude Code**
|
|
17
|
+
```bash
|
|
18
|
+
claude mcp add softricity-ui -- npx -y softricity-ui
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Claude Desktop** — Settings → Developer → Edit config (`claude_desktop_config.json`):
|
|
22
|
+
```json
|
|
23
|
+
{ "mcpServers": { "softricity-ui": { "command": "npx", "args": ["-y", "softricity-ui"] } } }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Cursor** — `~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project): same JSON as above.
|
|
27
|
+
|
|
28
|
+
**VS Code (Copilot agent mode)** — `.vscode/mcp.json`:
|
|
29
|
+
```json
|
|
30
|
+
{ "servers": { "softricity-ui": { "type": "stdio", "command": "npx", "args": ["-y", "softricity-ui"] } } }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Windsurf** — `~/.codeium/windsurf/mcp_config.json`: same JSON as Claude Desktop.
|
|
34
|
+
|
|
35
|
+
Windows: if `npx` is not found by your app, use `"command": "cmd", "args": ["/c", "npx", "-y", "softricity-ui"]`.
|
|
36
|
+
|
|
37
|
+
## Then just ask
|
|
38
|
+
|
|
39
|
+
> Set up Softricity UI in this project with the kavora theme.
|
|
40
|
+
> Add a sortable orders table and a row of KPI cards to the dashboard page.
|
|
41
|
+
> Make a theme called "acme" from our brand purple #6d28d9 and use it.
|
|
42
|
+
> Add the rapport CRM template.
|
|
43
|
+
> Which parts did I change since I added them?
|
|
44
|
+
|
|
45
|
+
Your project needs Next.js (App Router) and Tailwind CSS v4 (`npx create-next-app@latest` includes both).
|
|
46
|
+
|
|
47
|
+
## Tools
|
|
48
|
+
|
|
49
|
+
| Tool | What it does |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `ui_overview` | what's available — start here |
|
|
52
|
+
| `ui_search` | find parts by words or names (`"sortable table"`, `"segmented"`) |
|
|
53
|
+
| `ui_component` | one part: `meta` (default) · `code` · `demo` · `prompt` (self-contained rebuild prompt) |
|
|
54
|
+
| `ui_match` | "do you already have something like X?" |
|
|
55
|
+
| `ui_tokens` | theme colors, radii, type sizes |
|
|
56
|
+
| `ui_template` | list templates / one template's pages and parts |
|
|
57
|
+
| `ui_project` | your project: set up?, theme, installed parts, which ones you modified |
|
|
58
|
+
| `ui_init` | one-time setup: config, theme tokens, `globals.css` import |
|
|
59
|
+
| `ui_add` | copy parts + their dependencies into `ui/` (never overwrites your edits unless asked) |
|
|
60
|
+
| `ui_add_template` | copy a whole template + a route (`/t/<id>`) |
|
|
61
|
+
| `ui_theme_create` | new brand theme from your colors (light + dark) |
|
|
62
|
+
|
|
63
|
+
## What gets written to your project
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
uilib.json settings (folder, import alias, themes)
|
|
67
|
+
ui/tokens/ base.css, tailwind.css, themes/<theme>.css, index.css
|
|
68
|
+
ui/lib/ small helpers (cn, motion, chart math)
|
|
69
|
+
ui/components/<cat>/<id>/ the parts you added — edit freely
|
|
70
|
+
ui/templates/<id>/ templates you added
|
|
71
|
+
app/globals.css + one @import line for the tokens
|
|
72
|
+
```
|
|
73
|
+
Put the theme on `<html>`: `<html data-ui-theme="kavora" data-theme="light">`. Parts with overlays need `<OverlayHost />` once in your root layout. All parts use `tailwind-merge`, and many use `gsap` for motion (`npm i tailwind-merge gsap`; the AI or CLI tells you which).
|
|
74
|
+
|
|
75
|
+
## CLI (same package, no AI needed)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx softricity-ui init --theme kavora
|
|
79
|
+
npx softricity-ui list
|
|
80
|
+
npx softricity-ui add data-table kpi-card
|
|
81
|
+
npx softricity-ui template rapport
|
|
82
|
+
npx softricity-ui prompt pay-card --theme sagewell --out pay-card.md
|
|
83
|
+
```
|
package/lib/cli.mjs
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// uilib — copy registry components, themes and templates into a Next.js + Tailwind v4 project.
|
|
3
|
+
// shadcn-style: files are copied into your repo (you own them), imports rewritten to your alias.
|
|
4
|
+
// No dependencies. Node 18+.
|
|
5
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync, statSync, copyFileSync } from 'node:fs';
|
|
6
|
+
import { dirname, join, relative, resolve, posix } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { execSync } from 'node:child_process';
|
|
9
|
+
|
|
10
|
+
const CLI_DIR = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const CWD = process.cwd();
|
|
12
|
+
const CONFIG = 'uilib.json';
|
|
13
|
+
/** Command name shown in messages (the npm package sets softricity-ui). */
|
|
14
|
+
const BIN = process.env.UILIB_BIN ?? 'uilib';
|
|
15
|
+
|
|
16
|
+
/* ---------- args ---------- */
|
|
17
|
+
const argv = process.argv.slice(2);
|
|
18
|
+
const flags = {};
|
|
19
|
+
const pos = [];
|
|
20
|
+
for (let i = 0; i < argv.length; i++) {
|
|
21
|
+
const a = argv[i];
|
|
22
|
+
if (a.startsWith('--')) {
|
|
23
|
+
const [k, v] = a.slice(2).split('=');
|
|
24
|
+
if (v !== undefined) flags[k] = v;
|
|
25
|
+
else if (argv[i + 1] && !argv[i + 1].startsWith('--') && ['registry', 'dir', 'alias', 'theme', 'route', 'css', 'out'].includes(k)) flags[k] = argv[++i];
|
|
26
|
+
else flags[k] = true;
|
|
27
|
+
} else pos.push(a);
|
|
28
|
+
}
|
|
29
|
+
const [cmd, ...rest] = pos;
|
|
30
|
+
|
|
31
|
+
/* ---------- output ---------- */
|
|
32
|
+
const c = (n) => (s) => (process.stdout.isTTY ? `\x1b[${n}m${s}\x1b[0m` : s);
|
|
33
|
+
const bold = c(1), dim = c(2), green = c(32), yellow = c(33), red = c(31), cyan = c(36);
|
|
34
|
+
const log = (...a) => console.log(...a);
|
|
35
|
+
const die = (msg) => { console.error(red(`✖ ${msg}`)); process.exit(1); };
|
|
36
|
+
|
|
37
|
+
/* ---------- registry ---------- */
|
|
38
|
+
// Registry: flag → env → bundled next to this file (npm package: lib/../registry) → repo (cli/bin/../../registry).
|
|
39
|
+
const REG = resolve(flags.registry ?? process.env.UILIB_REGISTRY ?? [join(CLI_DIR, '..', 'registry'), join(CLI_DIR, '..', '..', 'registry')].find((p) => existsSync(join(p, 'index.json'))) ?? join(CLI_DIR, '..', '..', 'registry'));
|
|
40
|
+
if (!existsSync(join(REG, 'index.json'))) die(`registry not found at ${REG} (use --registry <path> or UILIB_REGISTRY)`);
|
|
41
|
+
const index = JSON.parse(readFileSync(join(REG, 'index.json'), 'utf8'));
|
|
42
|
+
const byKey = new Map(index.components.map((m) => [`${m.category}/${m.id}`, m]));
|
|
43
|
+
const byId = new Map(index.components.map((m) => [m.id, m]));
|
|
44
|
+
const findComp = (q) => byKey.get(q) ?? byId.get(q) ?? index.components.find((m) => m.name.toLowerCase() === q.toLowerCase() || (m.aliases ?? []).some((a) => a.toLowerCase() === q.toLowerCase()));
|
|
45
|
+
|
|
46
|
+
/* ---------- project config ---------- */
|
|
47
|
+
const cfgPath = join(CWD, CONFIG);
|
|
48
|
+
const loadCfg = () => {
|
|
49
|
+
if (!existsSync(cfgPath)) die(`no ${CONFIG} here. Run: npx ${BIN} init`);
|
|
50
|
+
return JSON.parse(readFileSync(cfgPath, 'utf8'));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** Rewrite @ui/... imports to the project alias. */
|
|
54
|
+
const rewrite = (src, alias) => src.replace(/(['"])@ui\//g, `$1${alias}/`);
|
|
55
|
+
|
|
56
|
+
function writeFile(dest, content, { force } = {}) {
|
|
57
|
+
const rel = relative(CWD, dest);
|
|
58
|
+
if (existsSync(dest) && !force) {
|
|
59
|
+
if (readFileSync(dest, 'utf8') === content) return log(dim(` = ${rel}`));
|
|
60
|
+
return log(yellow(` ! ${rel} exists and differs — skipped (use --overwrite)`));
|
|
61
|
+
}
|
|
62
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
63
|
+
writeFileSync(dest, content);
|
|
64
|
+
log(green(` + ${rel}`));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* ---------- dependency resolution ---------- */
|
|
68
|
+
const LIB_RE = /@ui\/lib\/([\w-]+)/g;
|
|
69
|
+
const COMP_RE = /@ui\/components\/([\w-]+\/[\w-]+)\//g;
|
|
70
|
+
|
|
71
|
+
/** All component keys + lib files needed by these keys (deps followed recursively, imports scanned). */
|
|
72
|
+
function resolveDeps(keys) {
|
|
73
|
+
const comps = new Set();
|
|
74
|
+
const libs = new Set();
|
|
75
|
+
const npm = new Set();
|
|
76
|
+
const visit = (k) => {
|
|
77
|
+
if (comps.has(k)) return;
|
|
78
|
+
const m = byKey.get(k);
|
|
79
|
+
if (!m) die(`unknown component ${k}`);
|
|
80
|
+
comps.add(k);
|
|
81
|
+
(m.npmDeps ?? []).forEach((d) => npm.add(d));
|
|
82
|
+
for (const f of m.files) {
|
|
83
|
+
const src = readFileSync(join(REG, 'components', k, f), 'utf8');
|
|
84
|
+
for (const x of src.matchAll(LIB_RE)) libs.add(x[1]);
|
|
85
|
+
for (const x of src.matchAll(COMP_RE)) visit(x[1]);
|
|
86
|
+
}
|
|
87
|
+
(m.registryDeps ?? []).forEach(visit);
|
|
88
|
+
};
|
|
89
|
+
keys.forEach(visit);
|
|
90
|
+
// lib files may import each other / gsap
|
|
91
|
+
for (const l of [...libs]) {
|
|
92
|
+
const src = readFileSync(join(REG, 'lib', `${l}.ts`), 'utf8');
|
|
93
|
+
for (const x of src.matchAll(LIB_RE)) libs.add(x[1]);
|
|
94
|
+
// every bare package a lib file imports (gsap, tailwind-merge, …)
|
|
95
|
+
for (const x of src.matchAll(/from '((?:@[\w-]+\/)?[a-z][\w-]*)(?:\/[^']*)?'/g)) npm.add(x[1]);
|
|
96
|
+
}
|
|
97
|
+
return { comps: [...comps], libs: [...libs], npm: [...npm] };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function copyComponents(keys, cfg, opts) {
|
|
101
|
+
const { comps, libs, npm } = resolveDeps(keys);
|
|
102
|
+
const out = resolve(CWD, cfg.dir);
|
|
103
|
+
log(bold(`\nComponents (${comps.length})`));
|
|
104
|
+
for (const k of comps) {
|
|
105
|
+
const m = byKey.get(k);
|
|
106
|
+
const files = [...m.files, ...(opts.demo ? ['demo.tsx'] : [])];
|
|
107
|
+
for (const f of files) {
|
|
108
|
+
const src = join(REG, 'components', k, f);
|
|
109
|
+
if (existsSync(src)) writeFile(join(out, 'components', k, f), rewrite(readFileSync(src, 'utf8'), cfg.alias), opts);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
log(bold(`\nLib (${libs.length})`));
|
|
113
|
+
for (const l of libs) writeFile(join(out, 'lib', `${l}.ts`), rewrite(readFileSync(join(REG, 'lib', `${l}.ts`), 'utf8'), cfg.alias), opts);
|
|
114
|
+
return npm;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function installNpm(pkgs) {
|
|
118
|
+
const pj = existsSync(join(CWD, 'package.json')) ? JSON.parse(readFileSync(join(CWD, 'package.json'), 'utf8')) : {};
|
|
119
|
+
const have = { ...pj.dependencies, ...pj.devDependencies };
|
|
120
|
+
const missing = pkgs.filter((p) => !have[p]);
|
|
121
|
+
if (!missing.length) return;
|
|
122
|
+
const pm = existsSync(join(CWD, 'pnpm-lock.yaml')) ? 'pnpm add' : existsSync(join(CWD, 'yarn.lock')) ? 'yarn add' : existsSync(join(CWD, 'bun.lockb')) ? 'bun add' : 'npm install';
|
|
123
|
+
const line = `${pm} ${missing.join(' ')}`;
|
|
124
|
+
if (flags['no-install']) return log(yellow(`\nRun: ${line}`));
|
|
125
|
+
log(bold(`\nInstalling: ${line}`));
|
|
126
|
+
try { execSync(line, { stdio: 'inherit', cwd: CWD }); } catch { log(yellow(`Install failed. Run it yourself: ${line}`)); }
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ---------- tokens ---------- */
|
|
130
|
+
function writeTokens(cfg, opts) {
|
|
131
|
+
const out = join(resolve(CWD, cfg.dir), 'tokens');
|
|
132
|
+
const themes = [...new Set(cfg.themes ?? [cfg.theme])];
|
|
133
|
+
writeFile(join(out, 'base.css'), readFileSync(join(REG, 'tokens', 'base.css'), 'utf8'), opts);
|
|
134
|
+
writeFile(join(out, 'tailwind.css'), readFileSync(join(REG, 'tokens', 'tailwind.css'), 'utf8'), opts);
|
|
135
|
+
for (const t of themes) {
|
|
136
|
+
const p = join(REG, 'tokens', 'themes', `${t}.css`);
|
|
137
|
+
if (!existsSync(p)) {
|
|
138
|
+
// Custom theme made in the project (e.g. by the MCP ui_theme_create tool): keep it.
|
|
139
|
+
if (existsSync(join(out, 'themes', `${t}.css`))) continue;
|
|
140
|
+
die(`unknown theme ${t}. Themes: ${index.themes.join(', ')}`);
|
|
141
|
+
}
|
|
142
|
+
writeFile(join(out, 'themes', `${t}.css`), readFileSync(p, 'utf8'), opts);
|
|
143
|
+
}
|
|
144
|
+
const idx = `/* Generated by uilib. Import once after \`@import "tailwindcss";\` */\n@import './base.css';\n${themes.map((t) => `@import './themes/${t}.css';`).join('\n')}\n@import './tailwind.css';\n`;
|
|
145
|
+
writeFile(join(out, 'index.css'), idx, { force: true });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Add the tokens import to the global css (after tailwindcss). */
|
|
149
|
+
function wireCss(cfg) {
|
|
150
|
+
const css = resolve(CWD, cfg.css);
|
|
151
|
+
if (!existsSync(css)) return log(yellow(`\n! ${cfg.css} not found. Add this after @import "tailwindcss":\n @import "${posix.normalize(relative(dirname(css), join(resolve(CWD, cfg.dir), 'tokens', 'index.css')).split('\\').join('/'))}";`));
|
|
152
|
+
let s = readFileSync(css, 'utf8');
|
|
153
|
+
const rel = relative(dirname(css), join(resolve(CWD, cfg.dir), 'tokens', 'index.css')).split('\\').join('/');
|
|
154
|
+
const line = `@import "${rel.startsWith('.') ? rel : `./${rel}`}";`;
|
|
155
|
+
if (s.includes(line)) return;
|
|
156
|
+
if (!/@import\s+["']tailwindcss["']/.test(s)) log(yellow(`! ${cfg.css} has no @import "tailwindcss" — uilib needs Tailwind v4.`));
|
|
157
|
+
s = /@import\s+["']tailwindcss["'];?/.test(s) ? s.replace(/(@import\s+["']tailwindcss["'];?)/, `$1\n${line}`) : `${line}\n${s}`;
|
|
158
|
+
writeFileSync(css, s);
|
|
159
|
+
log(green(` ~ ${relative(CWD, css)} (imports tokens)`));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* ---------- commands ---------- */
|
|
163
|
+
function help() {
|
|
164
|
+
log((`${bold('uilib')} — copy UI Library parts into a Next.js + Tailwind v4 project
|
|
165
|
+
|
|
166
|
+
${bold('Usage')}
|
|
167
|
+
uilib init [--theme kestro] [--dir ui] [--alias @/ui] [--css app/globals.css]
|
|
168
|
+
uilib list [category]
|
|
169
|
+
uilib info <component>
|
|
170
|
+
uilib add <component...> [--demo] [--overwrite] [--no-install]
|
|
171
|
+
uilib theme <name> [--add] switch (or --add another) theme
|
|
172
|
+
uilib template <id> [--route t/<id>] copy a full template + its parts + a route
|
|
173
|
+
uilib templates list templates
|
|
174
|
+
uilib prompt <component|template:<id>> [--theme x] [--out file.md]
|
|
175
|
+
self-contained rebuild prompt for any AI (stdout or file)
|
|
176
|
+
|
|
177
|
+
${bold('Options')}
|
|
178
|
+
--registry <path> registry folder (default: next to this CLI) · env UILIB_REGISTRY
|
|
179
|
+
|
|
180
|
+
Themes: ${index.themes.join(', ')}
|
|
181
|
+
Components are matched by id, category/id, name or source alias (e.g. "Seg", ".kpi").`).replaceAll('uilib ', `${BIN} `).replace('uilib', BIN));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function init() {
|
|
185
|
+
if (existsSync(cfgPath) && !flags.overwrite) die(`${CONFIG} already exists (use --overwrite)`);
|
|
186
|
+
const appDir = existsSync(join(CWD, 'src', 'app')) ? 'src/app' : 'app';
|
|
187
|
+
const srcBase = appDir.startsWith('src') ? 'src/' : '';
|
|
188
|
+
const theme = flags.theme ?? 'kestro';
|
|
189
|
+
if (!index.themes.includes(theme)) die(`unknown theme ${theme}. Themes: ${index.themes.join(', ')}`);
|
|
190
|
+
const cfg = { $schema: 'uilib/1', dir: flags.dir ?? `${srcBase}ui`, alias: flags.alias ?? '@/ui', css: flags.css ?? `${appDir}/globals.css`, theme, themes: [theme], appDir };
|
|
191
|
+
writeFileSync(cfgPath, JSON.stringify(cfg, null, 2) + '\n');
|
|
192
|
+
log(green(` + ${CONFIG}`));
|
|
193
|
+
writeTokens(cfg, { force: !!flags.overwrite });
|
|
194
|
+
wireCss(cfg);
|
|
195
|
+
// alias check
|
|
196
|
+
const ts = ['tsconfig.json', 'jsconfig.json'].map((f) => join(CWD, f)).find(existsSync);
|
|
197
|
+
const paths = ts ? JSON.parse(readFileSync(ts, 'utf8').replace(/\/\/.*$/gm, '')).compilerOptions?.paths ?? {} : {};
|
|
198
|
+
const aliasOk = Object.keys(paths).some((p) => cfg.alias.startsWith(p.replace('/*', '')));
|
|
199
|
+
log(`\n${bold('Next steps')}
|
|
200
|
+
1. Put the theme on <html>: <html data-ui-theme="${theme}" data-theme="light">
|
|
201
|
+
2. Load the Urbanist font (or set --font) — e.g. next/font/google Urbanist, then style={{'--font': 'var(--font-urbanist)'}} on <html>.
|
|
202
|
+
3. Add parts: npx ${BIN} add button card overlay-system
|
|
203
|
+
${aliasOk ? '' : yellow(` ! tsconfig has no path covering "${cfg.alias}". Add "paths": { "@/*": ["./${srcBase}*"] }`)}`);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function list() {
|
|
207
|
+
const cat = rest[0];
|
|
208
|
+
for (const k of index.categories.filter((x) => !cat || x === cat)) {
|
|
209
|
+
log(bold(`\n${k}`));
|
|
210
|
+
for (const m of index.components.filter((x) => x.category === k)) log(` ${cyan(m.id.padEnd(18))} ${dim(m.description.slice(0, 90))}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function info() {
|
|
215
|
+
const m = findComp(rest[0] ?? '') ?? die(`no component "${rest[0]}"`);
|
|
216
|
+
const { comps, libs, npm } = resolveDeps([`${m.category}/${m.id}`]);
|
|
217
|
+
log(`${bold(m.name)} ${dim(`${m.category}/${m.id}`)}\n${m.description}\n
|
|
218
|
+
exports: ${m.exports.join(', ')}
|
|
219
|
+
variants: ${m.variants.join(', ') || '—'}
|
|
220
|
+
brings: ${comps.join(', ')}
|
|
221
|
+
lib: ${libs.join(', ') || '—'}
|
|
222
|
+
npm: ${npm.join(', ') || '—'}
|
|
223
|
+
sources: ${Object.keys(m.sources ?? {}).join(', ')}
|
|
224
|
+
aliases: ${(m.aliases ?? []).join(' · ')}${m.notes ? `\nnotes: ${m.notes}` : ''}`);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function add() {
|
|
228
|
+
if (!rest.length) die(`which components? e.g. ${BIN} add button data-table`);
|
|
229
|
+
const cfg = loadCfg();
|
|
230
|
+
const keys = rest.map((q) => { const m = findComp(q); if (!m) die(`no component "${q}" (try: uilib list)`); return `${m.category}/${m.id}`; });
|
|
231
|
+
const npm = copyComponents(keys, cfg, { demo: !!flags.demo, force: !!flags.overwrite });
|
|
232
|
+
installNpm(npm);
|
|
233
|
+
const first = byKey.get(keys[0]);
|
|
234
|
+
log(`\n${green('✔ done')} import { ${first.exports[0]} } from '${cfg.alias}/components/${keys[0]}/${first.files[0].replace(/\.tsx?$/, '')}';`);
|
|
235
|
+
if (keys.some((k) => resolveDeps([k]).comps.includes('overlays/overlay-system'))) log(dim(' Uses overlays: mount <OverlayHost /> once in your root layout.'));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function theme() {
|
|
239
|
+
const name = rest[0] ?? die('which theme? ' + index.themes.join(', '));
|
|
240
|
+
if (!index.themes.includes(name)) die(`unknown theme ${name}`);
|
|
241
|
+
const cfg = loadCfg();
|
|
242
|
+
cfg.themes = flags.add ? [...new Set([...(cfg.themes ?? [cfg.theme]), name])] : [name];
|
|
243
|
+
if (!flags.add) cfg.theme = name;
|
|
244
|
+
writeFileSync(cfgPath, JSON.stringify(cfg, null, 2) + '\n');
|
|
245
|
+
writeTokens(cfg, { force: !!flags.overwrite });
|
|
246
|
+
log(`\nSet ${bold(`data-ui-theme="${cfg.theme}"`)} on <html>.${flags.add ? ` Wrappers can use data-ui-theme="${name}".` : ''}`);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function templates() {
|
|
250
|
+
for (const t of index.templates) log(` ${cyan(t.id.padEnd(14))} ${t.device.padEnd(8)} ${dim(`${t.pages.length} pages · ${t.components.length} parts · theme ${t.theme}`)} ${t.description.slice(0, 70)}`);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function template() {
|
|
254
|
+
const id = rest[0] ?? die('which template? uilib templates');
|
|
255
|
+
const t = index.templates.find((x) => x.id === id) ?? die(`no template ${id}`);
|
|
256
|
+
const cfg = loadCfg();
|
|
257
|
+
const opts = { force: !!flags.overwrite };
|
|
258
|
+
// theme
|
|
259
|
+
if (!(cfg.themes ?? []).includes(t.theme)) { cfg.themes = [...(cfg.themes ?? [cfg.theme]), t.theme]; writeFileSync(cfgPath, JSON.stringify(cfg, null, 2) + '\n'); writeTokens(cfg, { force: !!flags.overwrite }); }
|
|
260
|
+
// parts
|
|
261
|
+
const npm = copyComponents(t.components, cfg, opts);
|
|
262
|
+
// template files
|
|
263
|
+
const src = join(REG, 'templates', id);
|
|
264
|
+
const dest = join(resolve(CWD, cfg.dir), 'templates', id);
|
|
265
|
+
log(bold('\nTemplate'));
|
|
266
|
+
const walk = (d) => { for (const f of readdirSync(d)) { const p = join(d, f); if (statSync(p).isDirectory()) walk(p); else if (/\.(tsx?|json)$/.test(f)) writeFile(join(dest, relative(src, p)), rewrite(readFileSync(p, 'utf8'), cfg.alias), opts); } };
|
|
267
|
+
walk(src);
|
|
268
|
+
// route
|
|
269
|
+
const route = flags.route ?? `t/${id}`;
|
|
270
|
+
const routeDir = join(resolve(CWD, cfg.appDir ?? 'app'), ...route.split('/'), '[[...page]]');
|
|
271
|
+
writeFile(join(routeDir, 'page.tsx'), `import { TemplateRoute } from './TemplateRoute';
|
|
272
|
+
|
|
273
|
+
const PAGES = ${JSON.stringify(t.pages.map((p) => p.id))};
|
|
274
|
+
export const generateStaticParams = () => [{ page: [] }, ...PAGES.map((p) => ({ page: [p] }))];
|
|
275
|
+
|
|
276
|
+
export default async function Page({ params }: { params: Promise<{ page?: string[] }> }) {
|
|
277
|
+
const { page } = await params;
|
|
278
|
+
return <TemplateRoute page={page?.[0] ?? PAGES[0]} />;
|
|
279
|
+
}
|
|
280
|
+
`, opts);
|
|
281
|
+
writeFile(join(routeDir, 'TemplateRoute.tsx'), `'use client';
|
|
282
|
+
// ${t.name} template route (generated by uilib). The template forces its theme on <html>.
|
|
283
|
+
import { useEffect } from 'react';
|
|
284
|
+
import { useRouter } from 'next/navigation';
|
|
285
|
+
import Template from '${cfg.alias}/templates/${id}/Template';
|
|
286
|
+
import { OverlayHost } from '${cfg.alias}/components/overlays/overlay-system/overlays';
|
|
287
|
+
|
|
288
|
+
export function TemplateRoute({ page }: { page: string }) {
|
|
289
|
+
const router = useRouter();
|
|
290
|
+
useEffect(() => {
|
|
291
|
+
const h = document.documentElement;
|
|
292
|
+
const prev = h.dataset.uiTheme;
|
|
293
|
+
h.dataset.uiTheme = '${t.theme}';
|
|
294
|
+
return () => { if (prev) h.dataset.uiTheme = prev; };
|
|
295
|
+
}, []);
|
|
296
|
+
return (
|
|
297
|
+
<>
|
|
298
|
+
<Template page={page} go={(p) => router.push('/${route}/' + p)} />
|
|
299
|
+
<OverlayHost />
|
|
300
|
+
</>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
`, opts);
|
|
304
|
+
installNpm([...new Set([...npm, 'gsap'])]);
|
|
305
|
+
log(`\n${green('✔ done')} open /${route}`);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
async function prompt() {
|
|
309
|
+
const q = rest[0] ?? die('which component or template:<id>?');
|
|
310
|
+
const local = new URL('./prompt-lib.mjs', import.meta.url); // inside the npm package
|
|
311
|
+
const { createPromptKit } = await import(existsSync(fileURLToPath(local)) ? local.href : new URL('../../scripts/prompt-lib.mjs', import.meta.url).href);
|
|
312
|
+
const kit = createPromptKit(REG);
|
|
313
|
+
if (flags.theme && !index.themes.includes(flags.theme)) die(`unknown theme ${flags.theme}`);
|
|
314
|
+
let md;
|
|
315
|
+
if (q.startsWith('template:')) md = kit.templatePrompt(q.slice(9), { theme: flags.theme });
|
|
316
|
+
else { const m = findComp(q) ?? die(`no component "${q}"`); md = kit.componentPrompt(`${m.category}/${m.id}`, { theme: flags.theme ?? 'kestro' }); }
|
|
317
|
+
if (flags.out) { writeFileSync(resolve(CWD, flags.out), md); log(green(` + ${flags.out}`), dim(`(${(md.length / 1024).toFixed(1)} KB ≈ ${Math.round(md.length / 4)} tokens)`)); }
|
|
318
|
+
else process.stdout.write(md);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const CMDS = { init, list, info, add, theme, templates, template, prompt, help };
|
|
322
|
+
await (CMDS[cmd] ?? help)();
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// Replicate-prompt generator. One self-contained Markdown prompt per component or template:
|
|
2
|
+
// any AI (or person) can rebuild the exact part from it with no access to this repo.
|
|
3
|
+
// Context-lean on purpose: only the tokens, utilities, keyframes and icons the code actually uses.
|
|
4
|
+
// Used by scripts/build-prompts.mjs and `uilib prompt`.
|
|
5
|
+
import { readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
|
|
6
|
+
import { join, relative } from 'node:path';
|
|
7
|
+
|
|
8
|
+
const LIB_RE = /@ui\/lib\/([\w-]+)/g;
|
|
9
|
+
const COMP_RE = /@ui\/components\/([\w-]+\/[\w-]+)\//g;
|
|
10
|
+
const ALIAS = '@/ui';
|
|
11
|
+
const rewrite = (s) => s.replace(/(['"])@ui\//g, `$1${ALIAS}/`);
|
|
12
|
+
const read = (p) => readFileSync(p, 'utf8');
|
|
13
|
+
const fence = (lang, title, code) => `\`\`\`${lang} title="${title}"\n${code.replace(/\s+$/, '')}\n\`\`\``;
|
|
14
|
+
|
|
15
|
+
export function createPromptKit(REG) {
|
|
16
|
+
const index = JSON.parse(read(join(REG, 'index.json')));
|
|
17
|
+
const byKey = new Map(index.components.map((m) => [`${m.category}/${m.id}`, m]));
|
|
18
|
+
const tw = read(join(REG, 'tokens', 'tailwind.css'));
|
|
19
|
+
const base = read(join(REG, 'tokens', 'base.css'));
|
|
20
|
+
|
|
21
|
+
// name in utility → css var. e.g. card-2 → --card-2, text size md → --fs-md, rounded-lg → --r-lg
|
|
22
|
+
const colorMap = [...tw.matchAll(/--color-([\w-]+):\s*var\(--([\w-]+)\)/g)].map((m) => [m[1], m[2]]).sort((a, b) => b[0].length - a[0].length);
|
|
23
|
+
const textMap = [...tw.matchAll(/--text-([\w-]+):\s*var\(--([\w-]+)\)/g)].map((m) => [m[1], m[2]]);
|
|
24
|
+
const radiusMap = [...tw.matchAll(/--radius-([\w-]+):\s*var\(--([\w-]+)\)/g)].map((m) => [m[1], m[2]]);
|
|
25
|
+
const utilities = [...tw.matchAll(/@utility ([\w-]+) \{([^\n]*)\}\n/g)].map((m) => ({ name: m[1], body: m[0].trim() }));
|
|
26
|
+
const keyframes = [...base.matchAll(/@keyframes (ui-[\w-]+)[^\n]*\n/g)].map((m) => ({ name: m[1], body: m[0].trim() }));
|
|
27
|
+
|
|
28
|
+
function resolve(keys) {
|
|
29
|
+
const comps = [], libs = new Set(), npm = new Set(), seen = new Set();
|
|
30
|
+
const visit = (k) => {
|
|
31
|
+
if (seen.has(k)) return;
|
|
32
|
+
seen.add(k);
|
|
33
|
+
const m = byKey.get(k);
|
|
34
|
+
if (!m) throw new Error(`unknown component ${k}`);
|
|
35
|
+
(m.npmDeps ?? []).forEach((d) => npm.add(d));
|
|
36
|
+
for (const f of m.files) {
|
|
37
|
+
const src = read(join(REG, 'components', k, f));
|
|
38
|
+
for (const x of src.matchAll(LIB_RE)) libs.add(x[1]);
|
|
39
|
+
for (const x of src.matchAll(COMP_RE)) visit(x[1]);
|
|
40
|
+
}
|
|
41
|
+
(m.registryDeps ?? []).forEach(visit);
|
|
42
|
+
comps.push(k); // deps first
|
|
43
|
+
};
|
|
44
|
+
keys.forEach(visit);
|
|
45
|
+
for (const l of [...libs]) { const s = read(join(REG, 'lib', `${l}.ts`)); for (const x of s.matchAll(LIB_RE)) libs.add(x[1]); for (const x of s.matchAll(/from '((?:@[\w-]+\/)?[a-z][\w-]*)(?:\/[^']*)?'/g)) npm.add(x[1]); }
|
|
46
|
+
return { comps, libs: [...libs], npm: [...npm] };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Which tokens / utilities / keyframes / icons a body of code needs. */
|
|
50
|
+
function analyse(code) {
|
|
51
|
+
const vars = new Set();
|
|
52
|
+
for (const m of code.matchAll(/var\(--([\w-]+)/g)) vars.add(m[1]);
|
|
53
|
+
// Dynamic names like var(--h${hue}) / var(--c${i}) / var(--tile-${i}) → every numbered token with that prefix.
|
|
54
|
+
for (const m of code.matchAll(/var\(--([\w-]*)\$\{/g)) for (let i = 0; i <= 9; i++) vars.add(`${m[1]}${i}`);
|
|
55
|
+
// Class-like tokens. Quotes/backticks split tokens so 'bg-card' inside strings is seen.
|
|
56
|
+
const cls = code.match(/[\w:\-[\]/.!&>()=]+/g) ?? [];
|
|
57
|
+
vars.add('bg'); vars.add('ink'); // body rule in the token block
|
|
58
|
+
const hasClass = (re) => cls.some((c) => re.test(c));
|
|
59
|
+
for (const [n, v] of colorMap) if (hasClass(new RegExp(`(^|[:-])(bg|text|ring|border|fill|stroke|outline|from|to|via|shadow|accent|decoration|caret|divide)-${n}(\\/\\d+)?$`))) vars.add(v);
|
|
60
|
+
for (const [n, v] of textMap) if (hasClass(new RegExp(`(^|:)text-${n}$`))) vars.add(v);
|
|
61
|
+
for (const [n, v] of radiusMap) if (hasClass(new RegExp(`(^|:)rounded(-[tblr]{1,2})?-${n}$`))) vars.add(v);
|
|
62
|
+
if (hasClass(/(^|:)shadow-card$/)) vars.add('shadow');
|
|
63
|
+
if (hasClass(/(^|:)shadow-pop$/)) vars.add('shadow-lg');
|
|
64
|
+
const utils = utilities.filter((u) => hasClass(new RegExp(`(^|:)${u.name}$`)));
|
|
65
|
+
for (const u of utils) for (const m of u.body.matchAll(/var\(--([\w-]+)/g)) vars.add(m[1]);
|
|
66
|
+
const kfs = keyframes.filter((k) => code.includes(k.name));
|
|
67
|
+
for (const k of kfs) for (const m of k.body.matchAll(/var\(--([\w-]+)/g)) vars.add(m[1]);
|
|
68
|
+
if (code.includes('font-sans') || true) vars.add('font');
|
|
69
|
+
return { vars, utils, kfs };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Values of vars for a theme (light + dark), falling back to base.css. */
|
|
73
|
+
function tokenBlock(vars, theme) {
|
|
74
|
+
const css = read(join(REG, 'tokens', 'themes', `${theme}.css`));
|
|
75
|
+
const [light, dark = ''] = css.split(/\[data-theme='dark'\]/);
|
|
76
|
+
const pick = (src) => Object.fromEntries([...src.matchAll(/--([\w-]+):\s*([^;]+);/g)].map((m) => [m[1], m[2].trim()]));
|
|
77
|
+
const L = { ...pick(base.split(/\[data-theme='dark'\] \{ --scrim/)[0]), ...pick(light) };
|
|
78
|
+
const D = pick(dark);
|
|
79
|
+
const want = [...vars].filter((v) => !v.startsWith('font-') && v !== 't');
|
|
80
|
+
const line = (map, v) => (map[v] !== undefined ? ` --${v}: ${map[v]};` : null);
|
|
81
|
+
const l = want.map((v) => line(L, v)).filter(Boolean);
|
|
82
|
+
const d = want.map((v) => line(D, v)).filter(Boolean);
|
|
83
|
+
// Scoped to the theme attribute so several themes can live in one app without bleeding.
|
|
84
|
+
return `[data-ui-theme='${theme}'] {\n${l.join('\n')}\n}\n[data-ui-theme='${theme}'][data-theme='dark'] {\n${d.join('\n')}\n}`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Tailwind @theme lines for the vars in use. */
|
|
88
|
+
function bridge(vars) {
|
|
89
|
+
const lines = [];
|
|
90
|
+
for (const [n, v] of colorMap) if (vars.has(v)) lines.push(` --color-${n}: var(--${v});`);
|
|
91
|
+
const t = textMap.filter(([, v]) => vars.has(v));
|
|
92
|
+
if (t.length) lines.push(' --text-*: initial;', ...t.map(([n, v]) => ` --text-${n}: var(--${v});`));
|
|
93
|
+
for (const [n, v] of radiusMap) if (vars.has(v)) lines.push(` --radius-${n}: var(--${v});`);
|
|
94
|
+
if (vars.has('shadow')) lines.push(' --shadow-card: var(--shadow);');
|
|
95
|
+
if (vars.has('shadow-lg')) lines.push(' --shadow-pop: var(--shadow-lg);');
|
|
96
|
+
lines.push(' --font-sans: var(--font);');
|
|
97
|
+
return `@theme inline {\n${lines.join('\n')}\n}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** icons.ts trimmed to names the code uses (string literals that are icon keys). */
|
|
101
|
+
function trimmedIcons(code) {
|
|
102
|
+
const src = read(join(REG, 'components', 'primitives', 'icon', 'icons.ts'));
|
|
103
|
+
const all = [...src.matchAll(/^ {2}"([^"]+)": ("(?:[^"\\]|\\.)*"),$/gm)];
|
|
104
|
+
const used = new Set();
|
|
105
|
+
for (const m of code.matchAll(/['"`]([\w-]+)['"`]/g)) used.add(m[1]);
|
|
106
|
+
used.add('info');
|
|
107
|
+
const keep = all.filter((m) => used.has(m[1]));
|
|
108
|
+
return `// Line icons, 24x24, stroked. Trimmed to the icons this part uses; add more from the full set when needed.\nexport const ICONS = {\n${keep.map((m) => ` ${JSON.stringify(m[1])}: ${m[2]},`).join('\n')}\n} as const satisfies Record<string, string>;\n\nexport type IconName = keyof typeof ICONS;\n`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function filesFor(comps, libs, extra = []) {
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const l of libs) out.push({ path: `ui/lib/${l}.ts`, code: rewrite(read(join(REG, 'lib', `${l}.ts`))) });
|
|
114
|
+
for (const k of comps) for (const f of byKey.get(k).files) out.push({ path: `ui/components/${k}/${f}`, code: rewrite(read(join(REG, 'components', k, f))) });
|
|
115
|
+
return [...out, ...extra];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function setupSection(theme, vars, utils, kfs, npm) {
|
|
119
|
+
return `## 1. Setup
|
|
120
|
+
- Next.js 15 App Router, React 19, TypeScript, **Tailwind CSS v4**${npm.length ? `, npm: \`${npm.join(' ')}\`` : ''}.
|
|
121
|
+
- Path alias \`@/*\` → project root. Files below go under \`ui/\` and import each other as \`${ALIAS}/…\`.
|
|
122
|
+
- Font: **Urbanist** 400–700 (Google Fonts \`https://fonts.google.com/specimen/Urbanist\`, or \`next/font/google\`). Set \`--font\` to it.
|
|
123
|
+
- On \`<html>\`: \`data-ui-theme="${theme}"\` and \`data-theme="light"\` (or \`"dark"\`).
|
|
124
|
+
|
|
125
|
+
## 2. Design tokens (theme \`${theme}\`, only what this part uses)
|
|
126
|
+
Put in a CSS file imported **after** \`@import "tailwindcss";\`:
|
|
127
|
+
${fence('css', 'ui/tokens.css', `${tokenBlock(vars, theme)}\n[data-ui-theme] > body { background: var(--bg); color: var(--ink); font-family: var(--font); }\n\n${bridge(vars)}${utils.length ? `\n\n${utils.map((u) => u.body).join('\n')}` : ''}${kfs.length ? `\n\n${kfs.map((k) => k.body).join('\n')}` : ''}`)}`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function componentPrompt(key, { theme = 'kestro' } = {}) {
|
|
131
|
+
const m = byKey.get(key);
|
|
132
|
+
if (!m) throw new Error(`unknown component ${key}`);
|
|
133
|
+
const demoPath = join(REG, 'components', key, 'demo.tsx');
|
|
134
|
+
const rawDemo = existsSync(demoPath) ? read(demoPath) : '';
|
|
135
|
+
// The usage example may import helper parts (e.g. Button) — include them so the prompt stands alone.
|
|
136
|
+
const demoDeps = [...rawDemo.matchAll(COMP_RE)].map((x) => x[1]).filter((k) => byKey.has(k));
|
|
137
|
+
const { comps, libs, npm } = resolve([...demoDeps, key]);
|
|
138
|
+
const iconUsed = comps.includes('primitives/icon');
|
|
139
|
+
const files = filesFor(comps, libs);
|
|
140
|
+
const demo = rewrite(rawDemo);
|
|
141
|
+
const allCode = files.filter((f) => !f.path.endsWith('/icons.ts')).map((f) => f.code).join('\n') + demo;
|
|
142
|
+
if (iconUsed) {
|
|
143
|
+
const i = files.findIndex((f) => f.path.endsWith('primitives/icon/icons.ts'));
|
|
144
|
+
if (i >= 0) files[i] = { path: files[i].path, code: trimmedIcons(allCode) };
|
|
145
|
+
}
|
|
146
|
+
const { vars, utils, kfs } = analyse(allCode);
|
|
147
|
+
const src = Object.entries(m.sources ?? {}).map(([s, w]) => `${s} (${w})`).join('; ');
|
|
148
|
+
return `# Rebuild: ${m.name} (\`${key}\`)
|
|
149
|
+
|
|
150
|
+
${m.description}
|
|
151
|
+
|
|
152
|
+
- **Exports:** ${m.exports.map((e) => `\`${e}\``).join(', ')}
|
|
153
|
+
- **Variants:** ${m.variants.join(', ') || '—'}
|
|
154
|
+
- **Found in:** ${src}${m.notes ? `\n- **Notes:** ${m.notes}` : ''}
|
|
155
|
+
|
|
156
|
+
Rebuild it **exactly**: same DOM, classes, motion and accessibility. Create every file below verbatim, then render the usage example.
|
|
157
|
+
|
|
158
|
+
${setupSection(theme, vars, utils, kfs, npm)}
|
|
159
|
+
|
|
160
|
+
## 3. Files (${files.length}, dependencies first)
|
|
161
|
+
${files.map((f) => fence(f.path.endsWith('.tsx') ? 'tsx' : 'ts', f.path, f.code)).join('\n\n')}
|
|
162
|
+
${demo ? `\n## 4. Usage example\n${fence('tsx', `app/demo/${m.id}/page.tsx`, demo.replace(/from '\.\/([\w-]+)'/g, `from '${ALIAS}/components/${key}/$1'`))}\n` : ''}
|
|
163
|
+
## ${demo ? 5 : 4}. Check
|
|
164
|
+
- Renders in light and dark (\`data-theme\`) with no hard-coded colors beyond those in the code.
|
|
165
|
+
- Keyboard: every control reachable with Tab, visible focus ring.
|
|
166
|
+
- \`prefers-reduced-motion: reduce\` → animations jump to the end state.${comps.includes('overlays/overlay-system') ? '\n- Mount `<OverlayHost />` once (root layout) — overlays render there.' : ''}
|
|
167
|
+
`;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function templatePrompt(id, { theme } = {}) {
|
|
171
|
+
const t = index.templates.find((x) => x.id === id);
|
|
172
|
+
if (!t) throw new Error(`unknown template ${id}`);
|
|
173
|
+
const th = theme ?? t.theme;
|
|
174
|
+
const dir = join(REG, 'templates', id);
|
|
175
|
+
const tfiles = [];
|
|
176
|
+
const walk = (d) => { for (const f of readdirSync(d)) { const p = join(d, f); if (statSync(p).isDirectory()) walk(p); else if (/\.tsx?$/.test(f)) tfiles.push({ path: `ui/templates/${id}/${relative(dir, p).split('\\').join('/')}`, code: rewrite(read(p)) }); } };
|
|
177
|
+
walk(dir);
|
|
178
|
+
const { comps, libs, npm } = resolve(t.components);
|
|
179
|
+
const all = filesFor(comps, libs).map((f) => f.code).join('\n') + tfiles.map((f) => f.code).join('\n');
|
|
180
|
+
const { vars, utils, kfs } = analyse(all);
|
|
181
|
+
// Icons the template + its parts use (part prompts only carry their own icons).
|
|
182
|
+
if (comps.includes('primitives/icon')) tfiles.push({ path: 'ui/components/primitives/icon/icons.ts', code: trimmedIcons(all.replace(/^export const ICONS[\s\S]*?as const[^\n]*\n/m, '')) });
|
|
183
|
+
return `# Rebuild template: ${t.name} (\`${id}\`)
|
|
184
|
+
|
|
185
|
+
${t.description}
|
|
186
|
+
|
|
187
|
+
- **Device:** ${t.device} · **Theme:** ${th} · **Source:** ${t.source}
|
|
188
|
+
- **Pages:** ${t.pages.map((p) => `\`${p.id}\` ${p.label}`).join(', ')}
|
|
189
|
+
- **Uses ${comps.length} registry parts:** ${comps.map((c) => `\`${c}\``).join(', ')}
|
|
190
|
+
|
|
191
|
+
The template is composition only. First get each part listed above — fastest: \`uilib add ${t.components.map((c) => c.split('/')[1]).join(' ')}\`, or rebuild each from its own prompt (\`uilib prompt <id>\`). Then create the template files below.
|
|
192
|
+
|
|
193
|
+
${setupSection(th, vars, utils, kfs, [...new Set([...npm, 'gsap'])])}
|
|
194
|
+
|
|
195
|
+
## 3. Template files
|
|
196
|
+
${tfiles.map((f) => fence(f.path.endsWith('.tsx') ? 'tsx' : 'ts', f.path, f.code)).join('\n\n')}
|
|
197
|
+
|
|
198
|
+
## 4. Route
|
|
199
|
+
${fence('tsx', `app/t/${id}/[[...page]]/page.tsx`, `'use client';
|
|
200
|
+
import { use, useEffect } from 'react';
|
|
201
|
+
import { useRouter } from 'next/navigation';
|
|
202
|
+
import Template from '${ALIAS}/templates/${id}/Template';
|
|
203
|
+
import { OverlayHost } from '${ALIAS}/components/overlays/overlay-system/overlays';
|
|
204
|
+
|
|
205
|
+
export default function Page({ params }: { params: Promise<{ page?: string[] }> }) {
|
|
206
|
+
const { page } = use(params);
|
|
207
|
+
const router = useRouter();
|
|
208
|
+
useEffect(() => { document.documentElement.dataset.uiTheme = '${th}'; }, []);
|
|
209
|
+
return (<><Template page={page?.[0] ?? '${t.pages[0].id}'} go={(p) => router.push('/t/${id}/' + p)} /><OverlayHost /></>);
|
|
210
|
+
}`)}
|
|
211
|
+
`;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return { index, componentPrompt, templatePrompt, byKey };
|
|
215
|
+
}
|