@devxcrew/react-ui 0.0.0-stage → 0.1.7
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 +85 -2
- package/package.json +105 -4
- package/src/blocks/agent-chat-workspace/agent-chat-workspace.tsx +162 -0
- package/src/blocks/agent-chat-workspace/index.ts +2 -0
- package/src/blocks/agent-provider-settings/agent-provider-settings.tsx +183 -0
- package/src/blocks/agent-provider-settings/index.ts +2 -0
- package/src/blocks/agent-task-workspace/agent-task-workspace.tsx +48 -0
- package/src/blocks/agent-task-workspace/index.ts +2 -0
- package/src/blocks/analysis-context/analysis-context.tsx +6 -0
- package/src/blocks/analysis-context/index.ts +1 -0
- package/src/blocks/app-header/app-header.tsx +159 -0
- package/src/blocks/app-header/index.ts +2 -0
- package/src/blocks/archived-chat-workspace/archived-chat-workspace.tsx +29 -0
- package/src/blocks/archived-chat-workspace/index.ts +2 -0
- package/src/blocks/auth/README.md +32 -0
- package/src/blocks/auth/admin-login-page.tsx +15 -0
- package/src/blocks/auth/admin-password-forgot-page.tsx +5 -0
- package/src/blocks/auth/auth-page-layout.tsx +90 -0
- package/src/blocks/auth/client-login-page.tsx +20 -0
- package/src/blocks/auth/client-password-forgot-page.tsx +5 -0
- package/src/blocks/auth/identity-management-desk.tsx +530 -0
- package/src/blocks/auth/index.ts +12 -0
- package/src/blocks/auth/login-page.tsx +206 -0
- package/src/blocks/auth/password-forgot-page.tsx +60 -0
- package/src/blocks/auth/portal-pages.tsx +32 -0
- package/src/blocks/auth/privileged-desk.tsx +55 -0
- package/src/blocks/auth/register-page.tsx +117 -0
- package/src/blocks/auth/session-boundary.tsx +296 -0
- package/src/blocks/auth/super-admin-login-page.tsx +15 -0
- package/src/blocks/auth/super-admin-password-forgot-page.tsx +5 -0
- package/src/blocks/blog/blog-card.tsx +156 -0
- package/src/blocks/blog/blog-reader.tsx +175 -0
- package/src/blocks/blog/blog-types.ts +47 -0
- package/src/blocks/blog/index.ts +3 -0
- package/src/blocks/chat-composer/chat-composer.tsx +140 -0
- package/src/blocks/chat-composer/index.ts +1 -0
- package/src/blocks/chat-history/chat-history.tsx +59 -0
- package/src/blocks/chat-history/index.ts +1 -0
- package/src/blocks/chat-response-progress/chat-response-progress.tsx +34 -0
- package/src/blocks/chat-response-progress/index.ts +2 -0
- package/src/blocks/chat-runtime-controls/chat-runtime-controls.tsx +56 -0
- package/src/blocks/chat-runtime-controls/index.ts +2 -0
- package/src/blocks/chat-runtime-trace/chat-runtime-trace.tsx +71 -0
- package/src/blocks/chat-runtime-trace/index.ts +2 -0
- package/src/blocks/codex-connection-settings/codex-connection-settings.tsx +42 -0
- package/src/blocks/codex-connection-settings/index.ts +1 -0
- package/src/blocks/dropzone/dropzone-file-item.tsx +113 -0
- package/src/blocks/dropzone/dropzone-types.ts +32 -0
- package/src/blocks/dropzone/dropzone.tsx +216 -0
- package/src/blocks/dropzone/index.ts +3 -0
- package/src/blocks/ecommerce/cart/cart-drawer.tsx +228 -0
- package/src/blocks/ecommerce/cart/cart-types.ts +27 -0
- package/src/blocks/ecommerce/cart/index.ts +2 -0
- package/src/blocks/ecommerce/categories/categories-types.ts +23 -0
- package/src/blocks/ecommerce/categories/category-showcase.tsx +125 -0
- package/src/blocks/ecommerce/categories/index.ts +2 -0
- package/src/blocks/ecommerce/checkout/checkout-types.ts +48 -0
- package/src/blocks/ecommerce/checkout/checkout-wizard.tsx +468 -0
- package/src/blocks/ecommerce/checkout/index.ts +2 -0
- package/src/blocks/ecommerce/comparison/comparison-types.ts +28 -0
- package/src/blocks/ecommerce/comparison/index.ts +2 -0
- package/src/blocks/ecommerce/comparison/product-comparison.tsx +174 -0
- package/src/blocks/ecommerce/coupon-wallet/coupon-wallet-types.ts +21 -0
- package/src/blocks/ecommerce/coupon-wallet/coupon-wallet.tsx +154 -0
- package/src/blocks/ecommerce/coupon-wallet/index.ts +2 -0
- package/src/blocks/ecommerce/delivery-tracker/delivery-tracker-types.ts +20 -0
- package/src/blocks/ecommerce/delivery-tracker/delivery-tracker.tsx +169 -0
- package/src/blocks/ecommerce/delivery-tracker/index.ts +2 -0
- package/src/blocks/ecommerce/index.ts +12 -0
- package/src/blocks/ecommerce/payment-methods/index.ts +2 -0
- package/src/blocks/ecommerce/payment-methods/payment-method-selector.tsx +224 -0
- package/src/blocks/ecommerce/payment-methods/payment-methods-types.ts +21 -0
- package/src/blocks/ecommerce/price-history/index.ts +2 -0
- package/src/blocks/ecommerce/price-history/price-history-chart.tsx +217 -0
- package/src/blocks/ecommerce/price-history/price-history-types.ts +16 -0
- package/src/blocks/ecommerce/reviews/index.ts +2 -0
- package/src/blocks/ecommerce/reviews/reviews-section.tsx +309 -0
- package/src/blocks/ecommerce/reviews/reviews-types.ts +26 -0
- package/src/blocks/ecommerce/wishlist/index.ts +2 -0
- package/src/blocks/ecommerce/wishlist/wishlist-grid.tsx +149 -0
- package/src/blocks/ecommerce/wishlist/wishlist-types.ts +19 -0
- package/src/blocks/execution-status/README.md +25 -0
- package/src/blocks/execution-status/execution-status.tsx +135 -0
- package/src/blocks/execution-status/index.ts +2 -0
- package/src/blocks/file-tree/file-icons.tsx +84 -0
- package/src/blocks/file-tree/file-tree-node.tsx +158 -0
- package/src/blocks/file-tree/file-tree-types.ts +33 -0
- package/src/blocks/file-tree/file-tree.tsx +163 -0
- package/src/blocks/file-tree/index.ts +5 -0
- package/src/blocks/filter-builder/filter-builder.tsx +169 -0
- package/src/blocks/filter-builder/filter-row.tsx +164 -0
- package/src/blocks/filter-builder/filter-types.ts +61 -0
- package/src/blocks/filter-builder/index.ts +12 -0
- package/src/blocks/footer/footer-types.ts +35 -0
- package/src/blocks/footer/index.ts +2 -0
- package/src/blocks/footer/site-footer.tsx +212 -0
- package/src/blocks/form/form-block.tsx +113 -0
- package/src/blocks/form/form-lookup-field.tsx +60 -0
- package/src/blocks/form/index.ts +4 -0
- package/src/blocks/handover-stack/handover-stack.tsx +41 -0
- package/src/blocks/handover-stack/index.ts +1 -0
- package/src/blocks/idea-handover/idea-handover-readiness.ts +41 -0
- package/src/blocks/idea-handover/idea-handover-workspace.tsx +150 -0
- package/src/blocks/idea-handover/index.ts +4 -0
- package/src/blocks/kanban/index.ts +11 -0
- package/src/blocks/kanban/kanban-board.tsx +146 -0
- package/src/blocks/kanban/kanban-card.tsx +149 -0
- package/src/blocks/kanban/kanban-column.tsx +102 -0
- package/src/blocks/kanban/kanban-types.ts +38 -0
- package/src/blocks/loader/global-loader.tsx +90 -0
- package/src/blocks/loader/index.ts +1 -0
- package/src/blocks/mascot/README.md +21 -0
- package/src/blocks/mascot/index.ts +2 -0
- package/src/blocks/mascot/mascot.tsx +202 -0
- package/src/blocks/master-list/README.md +21 -0
- package/src/blocks/master-list/index.ts +12 -0
- package/src/blocks/master-list/master-form.tsx +157 -0
- package/src/blocks/master-list/master-list-desk.tsx +370 -0
- package/src/blocks/master-list/master-list.tsx +189 -0
- package/src/blocks/master-list/types.ts +18 -0
- package/src/blocks/mermaid-preview/index.ts +1 -0
- package/src/blocks/mermaid-preview/mermaid-preview.tsx +164 -0
- package/src/blocks/notifications/README.md +7 -0
- package/src/blocks/notifications/index.ts +1 -0
- package/src/blocks/notifications/notification-center-page.tsx +73 -0
- package/src/blocks/pricing/index.ts +7 -0
- package/src/blocks/pricing/pricing-table.tsx +173 -0
- package/src/blocks/pricing/pricing-types.ts +34 -0
- package/src/blocks/product-card/index.ts +2 -0
- package/src/blocks/product-card/product-card-types.ts +35 -0
- package/src/blocks/product-card/product-card.tsx +183 -0
- package/src/blocks/table/data-table-block.tsx +313 -0
- package/src/blocks/table/data-table-filter-menu.tsx +48 -0
- package/src/blocks/table/data-table-icon-menu-trigger.tsx +44 -0
- package/src/blocks/table/data-table-menu-content.tsx +32 -0
- package/src/blocks/table/data-table-pagination.tsx +149 -0
- package/src/blocks/table/data-table-row-actions.tsx +53 -0
- package/src/blocks/table/data-table-status.tsx +42 -0
- package/src/blocks/table/data-table-toolbar.tsx +124 -0
- package/src/blocks/table/data-table-totals.tsx +31 -0
- package/src/blocks/table/index.ts +13 -0
- package/src/blocks/workspace/index.ts +19 -0
- package/src/blocks/workspace/workspace-action-card.tsx +73 -0
- package/src/blocks/workspace/workspace-application-header.tsx +67 -0
- package/src/blocks/workspace/workspace-entity-card.tsx +48 -0
- package/src/blocks/workspace/workspace-health-summary.tsx +15 -0
- package/src/blocks/workspace/workspace-metric-card.tsx +97 -0
- package/src/blocks/workspace/workspace-page-header.tsx +43 -0
- package/src/blocks/workspace/workspace-publish-status.tsx +15 -0
- package/src/blocks/workspace/workspace-route-checklist.tsx +28 -0
- package/src/blocks/workspace/workspace-runtime-status.tsx +48 -0
- package/src/blocks/workspace/workspace-section-card.tsx +42 -0
- package/src/components/accordion.tsx +65 -0
- package/src/components/alert-dialog.tsx +160 -0
- package/src/components/alert.tsx +68 -0
- package/src/components/aspect-ratio.tsx +22 -0
- package/src/components/attachment.tsx +195 -0
- package/src/components/avatar.tsx +90 -0
- package/src/components/badge.tsx +55 -0
- package/src/components/breadcrumb.tsx +100 -0
- package/src/components/bubble.tsx +123 -0
- package/src/components/button-group.tsx +79 -0
- package/src/components/button.tsx +71 -0
- package/src/components/calendar.tsx +185 -0
- package/src/components/card.tsx +100 -0
- package/src/components/carousel.tsx +229 -0
- package/src/components/chart.tsx +338 -0
- package/src/components/checkbox.tsx +27 -0
- package/src/components/collapsible.tsx +15 -0
- package/src/components/combobox.tsx +269 -0
- package/src/components/command.tsx +181 -0
- package/src/components/compact-model-switcher.tsx +128 -0
- package/src/components/context-menu.tsx +244 -0
- package/src/components/dialog.tsx +138 -0
- package/src/components/direction.tsx +1 -0
- package/src/components/drawer.tsx +208 -0
- package/src/components/dropdown-menu.tsx +257 -0
- package/src/components/empty.tsx +93 -0
- package/src/components/field.tsx +232 -0
- package/src/components/hover-card.tsx +45 -0
- package/src/components/input-group.tsx +146 -0
- package/src/components/input-otp.tsx +83 -0
- package/src/components/input.tsx +19 -0
- package/src/components/item.tsx +188 -0
- package/src/components/kbd.tsx +26 -0
- package/src/components/label.tsx +17 -0
- package/src/components/markdown-content.tsx +113 -0
- package/src/components/marker.tsx +67 -0
- package/src/components/menubar.tsx +267 -0
- package/src/components/message-scroller.tsx +91 -0
- package/src/components/message.tsx +84 -0
- package/src/components/native-select.tsx +54 -0
- package/src/components/navigation-menu.tsx +160 -0
- package/src/components/pagination.tsx +118 -0
- package/src/components/popover.tsx +74 -0
- package/src/components/progress.tsx +82 -0
- package/src/components/questionnaire.tsx +150 -0
- package/src/components/radio-group.tsx +35 -0
- package/src/components/resizable.tsx +41 -0
- package/src/components/rich-text-editor.tsx +604 -0
- package/src/components/scroll-area.tsx +47 -0
- package/src/components/select.tsx +189 -0
- package/src/components/separator.tsx +18 -0
- package/src/components/sheet.tsx +125 -0
- package/src/components/sidebar.tsx +693 -0
- package/src/components/skeleton.tsx +13 -0
- package/src/components/slider.tsx +51 -0
- package/src/components/sonner.tsx +45 -0
- package/src/components/sparkline.tsx +231 -0
- package/src/components/spinner.tsx +20 -0
- package/src/components/status-badge.tsx +114 -0
- package/src/components/switch.tsx +31 -0
- package/src/components/table.tsx +91 -0
- package/src/components/tabs.tsx +72 -0
- package/src/components/textarea.tsx +17 -0
- package/src/components/toast.tsx +222 -0
- package/src/components/toggle-group.tsx +85 -0
- package/src/components/toggle.tsx +42 -0
- package/src/components/tooltip.tsx +53 -0
- package/src/design-system/README.md +55 -0
- package/src/design-system/action-intents.ts +21 -0
- package/src/design-system/agent-manifest.ts +83 -0
- package/src/design-system/block-registry.ts +272 -0
- package/src/design-system/component-registry.ts +142 -0
- package/src/design-system/contracts.ts +69 -0
- package/src/design-system/defaults.ts +3 -0
- package/src/design-system/index.ts +29 -0
- package/src/design-system/mcp-server.ts +156 -0
- package/src/design-system/page-registry.ts +74 -0
- package/src/design-system/selection.ts +67 -0
- package/src/design-system/template-registry.ts +33 -0
- package/src/features/interface-topology/index.ts +14 -0
- package/src/features/interface-topology/interface-topology.types.ts +40 -0
- package/src/features/interface-topology/topology-control.tsx +18 -0
- package/src/features/interface-topology/topology-inspector.tsx +228 -0
- package/src/features/interface-topology/topology-marker.tsx +47 -0
- package/src/features/interface-topology/topology-region.tsx +44 -0
- package/src/features/interface-topology/use-interface-topology.ts +178 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-scroll-follow.ts +22 -0
- package/src/index.ts +11 -0
- package/src/layouts/README.md +65 -0
- package/src/layouts/agent-workspace/agent-activity-rail.tsx +101 -0
- package/src/layouts/agent-workspace/agent-workspace.tsx +27 -0
- package/src/layouts/agent-workspace/agent-workspace.types.ts +28 -0
- package/src/layouts/agent-workspace/index.ts +7 -0
- package/src/layouts/blog-header/blog-header-types.ts +25 -0
- package/src/layouts/blog-header/blog-header.tsx +172 -0
- package/src/layouts/blog-header/index.ts +2 -0
- package/src/layouts/documentation-workspace/README.md +8 -0
- package/src/layouts/documentation-workspace/documentation-workspace.tsx +34 -0
- package/src/layouts/documentation-workspace/index.ts +1 -0
- package/src/layouts/ecommerce-header/ecommerce-actions.tsx +89 -0
- package/src/layouts/ecommerce-header/ecommerce-announcement.tsx +43 -0
- package/src/layouts/ecommerce-header/ecommerce-drawer.tsx +97 -0
- package/src/layouts/ecommerce-header/ecommerce-header-types.ts +59 -0
- package/src/layouts/ecommerce-header/ecommerce-header.tsx +47 -0
- package/src/layouts/ecommerce-header/ecommerce-navigation.tsx +98 -0
- package/src/layouts/ecommerce-header/ecommerce-search.tsx +86 -0
- package/src/layouts/ecommerce-header/index.ts +2 -0
- package/src/layouts/main-workspace/index.ts +28 -0
- package/src/layouts/mdi/index.ts +1 -0
- package/src/layouts/mdi/mdi.tsx +20 -0
- package/src/layouts/mdi-main/index.ts +27 -0
- package/src/layouts/mdi-main/mdi-app-catalog.generated.ts +159 -0
- package/src/layouts/mdi-main/mdi-app-catalog.ts +76 -0
- package/src/layouts/mdi-main/mdi-app-switcher.tsx +107 -0
- package/src/layouts/mdi-main/mdi-feature-settings.tsx +135 -0
- package/src/layouts/mdi-main/mdi-global-search.tsx +192 -0
- package/src/layouts/mdi-main/mdi-main.tsx +241 -0
- package/src/layouts/mdi-main/mdi-notifications-menu.tsx +197 -0
- package/src/layouts/mdi-main/mdi-profile-menu.tsx +79 -0
- package/src/layouts/mdi-main/mdi-sidebar-navigation.tsx +226 -0
- package/src/layouts/mdi-main/mdi-sidebar.tsx +110 -0
- package/src/layouts/mdi-main/mdi-status-bar.tsx +26 -0
- package/src/layouts/mdi-main/mdi-top-menu-control.ts +4 -0
- package/src/layouts/mdi-main/mdi-top-menu.tsx +117 -0
- package/src/layouts/mdi-main/mdi-topology.tsx +297 -0
- package/src/layouts/mdi-main/mdi-tweak-panel.tsx +104 -0
- package/src/layouts/mdi-main/mdi-types.ts +131 -0
- package/src/layouts/mdi-main/use-mdi-features.ts +36 -0
- package/src/layouts/mdi-main/use-mdi-sidebar-state.ts +59 -0
- package/src/layouts/site-header/announcement-bar.tsx +55 -0
- package/src/layouts/site-header/category-strip.tsx +41 -0
- package/src/layouts/site-header/index.ts +16 -0
- package/src/layouts/site-header/main-navbar.tsx +179 -0
- package/src/layouts/site-header/mobile-drawer.tsx +140 -0
- package/src/layouts/site-header/site-header-types.ts +63 -0
- package/src/layouts/site-header/site-header.tsx +58 -0
- package/src/lib/random-id.ts +19 -0
- package/src/lib/utils.ts +6 -0
- package/src/providers/pdf-provider.ts +137 -0
- package/src/styles/globals.css +374 -0
- package/src/templates/README.md +12 -0
- package/src/templates/dashboard-01/components/app-sidebar.tsx +177 -0
- package/src/templates/dashboard-01/components/chart-area-interactive.tsx +276 -0
- package/src/templates/dashboard-01/components/data-table-cell-viewer.tsx +213 -0
- package/src/templates/dashboard-01/components/data-table.tsx +577 -0
- package/src/templates/dashboard-01/components/nav-documents.tsx +79 -0
- package/src/templates/dashboard-01/components/nav-main.tsx +55 -0
- package/src/templates/dashboard-01/components/nav-secondary.tsx +39 -0
- package/src/templates/dashboard-01/components/nav-user.tsx +97 -0
- package/src/templates/dashboard-01/components/section-cards.tsx +99 -0
- package/src/templates/dashboard-01/components/site-header.tsx +14 -0
- package/src/templates/dashboard-01/data.json +614 -0
- package/src/templates/dashboard-01/index.ts +7 -0
- package/src/templates/documentation-sidebar/app-sidebar.tsx +95 -0
- package/src/templates/documentation-sidebar/index.ts +2 -0
- package/src/templates/sidebar-07/components/app-sidebar.tsx +175 -0
- package/src/templates/sidebar-07/components/nav-main.tsx +64 -0
- package/src/templates/sidebar-07/components/nav-projects.tsx +79 -0
- package/src/templates/sidebar-07/components/nav-user.tsx +105 -0
- package/src/templates/sidebar-07/components/team-switcher.tsx +94 -0
- package/src/templates/sidebar-07/index.ts +1 -0
- package/src/templates/ui-page/index.ts +7 -0
- package/src/templates/ui-page/ui-browser-frame.tsx +27 -0
- package/src/templates/ui-page/ui-template-code.tsx +48 -0
- package/src/templates/ui-page/ui-template-header.tsx +87 -0
- package/src/templates/ui-page/ui-template-navigation.tsx +60 -0
- package/src/templates/ui-page/ui-template-page.tsx +97 -0
- package/src/theme/index.ts +12 -0
- package/src/theme/theme-config.ts +30 -0
- package/src/theme/theme-provider.tsx +142 -0
- package/src/theme/theme-selector.tsx +75 -0
- package/src/tokens/index.ts +15 -0
- package/src/vite-env.d.ts +3 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import type { DesignSystemBlockDefinition, DesignSystemVariantDefinition } from "./contracts";
|
|
2
|
+
|
|
3
|
+
const defaultVariant: DesignSystemVariantDefinition = {
|
|
4
|
+
description: "The package-owned application default.",
|
|
5
|
+
id: "default",
|
|
6
|
+
name: "Default",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const tableVariants: readonly DesignSystemVariantDefinition[] = [
|
|
10
|
+
{
|
|
11
|
+
description: "A complete workspace table with tools, totals, and pagination.",
|
|
12
|
+
id: "default",
|
|
13
|
+
name: "Workspace",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
description: "A compact table section without page-level tools.",
|
|
17
|
+
id: "section",
|
|
18
|
+
name: "Section",
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const workspaceEntityCardVariants: readonly DesignSystemVariantDefinition[] = [
|
|
23
|
+
defaultVariant,
|
|
24
|
+
{
|
|
25
|
+
description: "A workspace entity card with shared hover treatment for interactive inventory surfaces.",
|
|
26
|
+
id: "interactive",
|
|
27
|
+
name: "Interactive",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const designSystemBlocks: readonly DesignSystemBlockDefinition[] = [
|
|
32
|
+
{
|
|
33
|
+
defaultVariantId: "default",
|
|
34
|
+
description: "Shared runtime state, health, publish, and route readiness surfaces for workspace dashboards.",
|
|
35
|
+
id: "workspace-status",
|
|
36
|
+
name: "Workspace Status",
|
|
37
|
+
source: "@devxcrew/react-ui/blocks/workspace",
|
|
38
|
+
variants: [
|
|
39
|
+
defaultVariant,
|
|
40
|
+
{
|
|
41
|
+
description: "Runtime state with optional port, HTTP status, latency, and action.",
|
|
42
|
+
id: "runtime",
|
|
43
|
+
name: "Runtime",
|
|
44
|
+
},
|
|
45
|
+
{ description: "Compact health metric summary.", id: "health", name: "Health" },
|
|
46
|
+
{ description: "Published, review, or draft state badge.", id: "publish", name: "Publish" },
|
|
47
|
+
{ description: "Ready, pending, or blocked route checklist.", id: "routes", name: "Routes" },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
defaultVariantId: "default",
|
|
52
|
+
description: "A reusable entity card for workspace inventories, resources, and live status surfaces.",
|
|
53
|
+
id: "workspace-entity-card",
|
|
54
|
+
name: "Workspace Entity Card",
|
|
55
|
+
source: "@devxcrew/react-ui/blocks/workspace",
|
|
56
|
+
variants: workspaceEntityCardVariants,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
defaultVariantId: "default",
|
|
60
|
+
description: "Observed execution state, readiness checklists, and optional startup splash with measured values.",
|
|
61
|
+
id: "execution-status",
|
|
62
|
+
name: "Execution Status",
|
|
63
|
+
source: "@devxcrew/react-ui/blocks/execution-status",
|
|
64
|
+
variants: [defaultVariant],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
defaultVariantId: "default",
|
|
68
|
+
description: "A typed data table with application-owned rows and columns.",
|
|
69
|
+
id: "table",
|
|
70
|
+
name: "Table",
|
|
71
|
+
source: "@devxcrew/react-ui/blocks/table",
|
|
72
|
+
variants: tableVariants,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
defaultVariantId: "default",
|
|
76
|
+
description: "A typed application form frame with tabs, lookup fields, and actions.",
|
|
77
|
+
id: "form",
|
|
78
|
+
name: "Form",
|
|
79
|
+
source: "@devxcrew/react-ui/blocks/form",
|
|
80
|
+
variants: [defaultVariant],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
defaultVariantId: "default",
|
|
84
|
+
description: "A pointer-aware, clickable character rendered from two aligned 3x3 sprite sheets.",
|
|
85
|
+
id: "mascot",
|
|
86
|
+
name: "Mascot",
|
|
87
|
+
source: "@devxcrew/react-ui/blocks/mascot",
|
|
88
|
+
variants: [defaultVariant],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
defaultVariantId: "breadcrumb-actions",
|
|
92
|
+
description: "A shared page-level header with breadcrumb, title, filter, resource, and action arrangements.",
|
|
93
|
+
id: "app-header",
|
|
94
|
+
name: "App Header",
|
|
95
|
+
source: "@devxcrew/react-ui/blocks/app-header",
|
|
96
|
+
variants: [
|
|
97
|
+
{
|
|
98
|
+
description: "Breadcrumb context with an optional profile slot and primary action.",
|
|
99
|
+
id: "breadcrumb-actions",
|
|
100
|
+
name: "Breadcrumb + action",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
description: "Icon and page title with filter controls and a primary action.",
|
|
104
|
+
id: "title-actions",
|
|
105
|
+
name: "Title + filter + action",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
description: "Resource link with a copy affordance at the right edge.",
|
|
109
|
+
id: "resource-actions",
|
|
110
|
+
name: "Resource + copy",
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
defaultVariantId: "default",
|
|
116
|
+
description: "An interactive drag-and-drop Kanban board with sortable columns and cards.",
|
|
117
|
+
id: "kanban",
|
|
118
|
+
name: "Kanban Board",
|
|
119
|
+
source: "@devxcrew/react-ui/blocks/kanban",
|
|
120
|
+
variants: [defaultVariant],
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
defaultVariantId: "default",
|
|
124
|
+
description: "A hierarchical file and workspace explorer tree with icons, filter, and actions.",
|
|
125
|
+
id: "file-tree",
|
|
126
|
+
name: "File Tree",
|
|
127
|
+
source: "@devxcrew/react-ui/blocks/file-tree",
|
|
128
|
+
variants: [defaultVariant],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
defaultVariantId: "default",
|
|
132
|
+
description: "A drag-and-drop file upload zone with type/size validation and progress tracking.",
|
|
133
|
+
id: "dropzone",
|
|
134
|
+
name: "File Dropzone",
|
|
135
|
+
source: "@devxcrew/react-ui/blocks/dropzone",
|
|
136
|
+
variants: [defaultVariant],
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
defaultVariantId: "default",
|
|
140
|
+
description: "A safe live preview for Mermaid diagram source.",
|
|
141
|
+
id: "mermaid-preview",
|
|
142
|
+
name: "Mermaid Preview",
|
|
143
|
+
source: "@devxcrew/react-ui/blocks/mermaid-preview",
|
|
144
|
+
variants: [defaultVariant],
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
defaultVariantId: "default",
|
|
148
|
+
description: "A multi-condition query filter builder with combinators and typed operators.",
|
|
149
|
+
id: "filter-builder",
|
|
150
|
+
name: "Filter Builder",
|
|
151
|
+
source: "@devxcrew/react-ui/blocks/filter-builder",
|
|
152
|
+
variants: [defaultVariant],
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
defaultVariantId: "default",
|
|
156
|
+
description: "An e-commerce product card with image zoom, ratings, swatches, and cart actions.",
|
|
157
|
+
id: "product-card",
|
|
158
|
+
name: "Product Card",
|
|
159
|
+
source: "@devxcrew/react-ui/blocks/product-card",
|
|
160
|
+
variants: [defaultVariant],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
defaultVariantId: "default",
|
|
164
|
+
description: "A multi-tier pricing table with monthly/annual interval toggle and feature lists.",
|
|
165
|
+
id: "pricing",
|
|
166
|
+
name: "Pricing Table",
|
|
167
|
+
source: "@devxcrew/react-ui/blocks/pricing",
|
|
168
|
+
variants: [defaultVariant],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
defaultVariantId: "default",
|
|
172
|
+
description: "An interactive storefront slide-over cart drawer with quantity stepper and shipping threshold meter.",
|
|
173
|
+
id: "cart",
|
|
174
|
+
name: "Storefront Cart",
|
|
175
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/cart",
|
|
176
|
+
variants: [defaultVariant],
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
defaultVariantId: "default",
|
|
180
|
+
description: "A storefront category visual grid, megamenu navigation, and pill filter strip.",
|
|
181
|
+
id: "categories",
|
|
182
|
+
name: "Categories Showcase",
|
|
183
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/categories",
|
|
184
|
+
variants: [defaultVariant],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
defaultVariantId: "default",
|
|
188
|
+
description: "A multi-step checkout wizard covering shipping destination, payment method, and order review.",
|
|
189
|
+
id: "checkout",
|
|
190
|
+
name: "Checkout Wizard",
|
|
191
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/checkout",
|
|
192
|
+
variants: [defaultVariant],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
defaultVariantId: "default",
|
|
196
|
+
description: "A side-by-side product comparison matrix with spec rows and difference highlighting.",
|
|
197
|
+
id: "comparison",
|
|
198
|
+
name: "Product Comparison",
|
|
199
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/comparison",
|
|
200
|
+
variants: [defaultVariant],
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
defaultVariantId: "default",
|
|
204
|
+
description: "A promotional coupon wallet with voucher cards, instant code copy, and applied discount management.",
|
|
205
|
+
id: "coupon-wallet",
|
|
206
|
+
name: "Coupon Wallet",
|
|
207
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/coupon-wallet",
|
|
208
|
+
variants: [defaultVariant],
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
defaultVariantId: "default",
|
|
212
|
+
description: "A visual shipment milestone timeline with courier details and live delivery status.",
|
|
213
|
+
id: "delivery-tracker",
|
|
214
|
+
name: "Delivery Tracker",
|
|
215
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/delivery-tracker",
|
|
216
|
+
variants: [defaultVariant],
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
defaultVariantId: "default",
|
|
220
|
+
description: "A checkout payment method selector covering saved cards with CVV entry, UPI, wallets, and COD.",
|
|
221
|
+
id: "payment-methods",
|
|
222
|
+
name: "Payment Methods",
|
|
223
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/payment-methods",
|
|
224
|
+
variants: [defaultVariant],
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
defaultVariantId: "default",
|
|
228
|
+
description: "A historical price trend visualization with lowest/peak markers and price drop notifications.",
|
|
229
|
+
id: "price-history",
|
|
230
|
+
name: "Price History Tracker",
|
|
231
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/price-history",
|
|
232
|
+
variants: [defaultVariant],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
defaultVariantId: "default",
|
|
236
|
+
description: "An aggregate rating breakdown, verified customer reviews list, and write-review form.",
|
|
237
|
+
id: "reviews",
|
|
238
|
+
name: "Reviews & Ratings",
|
|
239
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/reviews",
|
|
240
|
+
variants: [defaultVariant],
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
defaultVariantId: "default",
|
|
244
|
+
description: "A saved items wishlist grid with stock availability indicators and quick move-to-cart actions.",
|
|
245
|
+
id: "wishlist",
|
|
246
|
+
name: "Wishlist Grid",
|
|
247
|
+
source: "@devxcrew/react-ui/blocks/ecommerce/wishlist",
|
|
248
|
+
variants: [defaultVariant],
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
defaultVariantId: "default",
|
|
252
|
+
description:
|
|
253
|
+
"A multi-column storefront and content footer with newsletter subscribe, social links, and payment badges.",
|
|
254
|
+
id: "footer",
|
|
255
|
+
name: "Site Footer",
|
|
256
|
+
source: "@devxcrew/react-ui/blocks/footer",
|
|
257
|
+
variants: [defaultVariant],
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
defaultVariantId: "default",
|
|
261
|
+
description:
|
|
262
|
+
"An editorial blog suite featuring post cards (standard, horizontal, compact) and rich article reading layout.",
|
|
263
|
+
id: "blog",
|
|
264
|
+
name: "Blog & Editorial",
|
|
265
|
+
source: "@devxcrew/react-ui/blocks/blog",
|
|
266
|
+
variants: [defaultVariant],
|
|
267
|
+
},
|
|
268
|
+
];
|
|
269
|
+
|
|
270
|
+
export function getDesignSystemBlock(blockId: string) {
|
|
271
|
+
return designSystemBlocks.find(({ id }) => id === blockId);
|
|
272
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { DesignSystemCategory, DesignSystemComponentDefinition, DesignSystemVariantDefinition } from "./contracts";
|
|
2
|
+
import { buttonDefaultVariant, buttonGroupDefaultOrientation } from "./defaults";
|
|
3
|
+
|
|
4
|
+
const defaultVariant: DesignSystemVariantDefinition = {
|
|
5
|
+
description: "The package-owned application default.",
|
|
6
|
+
id: "default",
|
|
7
|
+
name: "Default",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const componentNames: Record<DesignSystemCategory, readonly string[]> = {
|
|
11
|
+
Actions: ["Button", "Button Group", "Toggle", "Toggle Group"],
|
|
12
|
+
Communication: ["Attachment", "Bubble", "Message", "Message Scroller"],
|
|
13
|
+
"Data display": [
|
|
14
|
+
"Avatar",
|
|
15
|
+
"Badge",
|
|
16
|
+
"Calendar",
|
|
17
|
+
"Card",
|
|
18
|
+
"Carousel",
|
|
19
|
+
"Chart",
|
|
20
|
+
"Item",
|
|
21
|
+
"Kbd",
|
|
22
|
+
"Marker",
|
|
23
|
+
"Sparkline",
|
|
24
|
+
"Table",
|
|
25
|
+
],
|
|
26
|
+
Feedback: ["Alert", "Empty", "Progress", "Skeleton", "Sonner", "Spinner", "Toast"],
|
|
27
|
+
Forms: [
|
|
28
|
+
"Checkbox",
|
|
29
|
+
"Combobox",
|
|
30
|
+
"Field",
|
|
31
|
+
"Input",
|
|
32
|
+
"Input Group",
|
|
33
|
+
"Input OTP",
|
|
34
|
+
"Label",
|
|
35
|
+
"Native Select",
|
|
36
|
+
"Questionnaire",
|
|
37
|
+
"Radio Group",
|
|
38
|
+
"Rich Text Editor",
|
|
39
|
+
"Select",
|
|
40
|
+
"Slider",
|
|
41
|
+
"Switch",
|
|
42
|
+
"Textarea",
|
|
43
|
+
],
|
|
44
|
+
Layout: ["Aspect Ratio", "Collapsible", "Direction", "Resizable", "Scroll Area", "Separator"],
|
|
45
|
+
Navigation: ["Accordion", "Breadcrumb", "Menubar", "Navigation Menu", "Pagination", "Sidebar", "Tabs"],
|
|
46
|
+
Overlays: [
|
|
47
|
+
"Alert Dialog",
|
|
48
|
+
"Command",
|
|
49
|
+
"Context Menu",
|
|
50
|
+
"Dialog",
|
|
51
|
+
"Drawer",
|
|
52
|
+
"Dropdown Menu",
|
|
53
|
+
"Hover Card",
|
|
54
|
+
"Popover",
|
|
55
|
+
"Sheet",
|
|
56
|
+
"Tooltip",
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const componentVariants: Readonly<Record<string, readonly DesignSystemVariantDefinition[]>> = {
|
|
61
|
+
sidebar: [
|
|
62
|
+
defaultVariant,
|
|
63
|
+
{ id: "outline", name: "Outline", description: "A bordered sidebar menu button." },
|
|
64
|
+
{
|
|
65
|
+
id: "accented",
|
|
66
|
+
name: "Accented",
|
|
67
|
+
description: "A left-aligned sidebar menu button with a selected accent marker. Supports comfortable 40px rows.",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
accordion: [
|
|
71
|
+
{
|
|
72
|
+
description: "The standard borderless disclosure list.",
|
|
73
|
+
id: "default",
|
|
74
|
+
name: "Borderless",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
description: "A connected disclosure list with an outer border.",
|
|
78
|
+
id: "boxed",
|
|
79
|
+
name: "Boxed",
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
alert: [
|
|
83
|
+
{ description: "A neutral application notice.", id: "default", name: "Default" },
|
|
84
|
+
{
|
|
85
|
+
description: "A destructive or failed-state notice.",
|
|
86
|
+
id: "destructive",
|
|
87
|
+
name: "Destructive",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
button: [
|
|
91
|
+
{ description: "The main action on a surface.", id: "default", name: "Primary" },
|
|
92
|
+
{ description: "A strong action without theme emphasis.", id: "neutral", name: "Neutral" },
|
|
93
|
+
{ description: "An alternative action.", id: "secondary", name: "Secondary" },
|
|
94
|
+
{ description: "A successful completion action.", id: "success", name: "Success" },
|
|
95
|
+
{ description: "An action that needs review.", id: "warning", name: "Warning" },
|
|
96
|
+
{ description: "An informational action.", id: "info", name: "Information" },
|
|
97
|
+
{ description: "An irreversible action.", id: "destructive", name: "Destructive" },
|
|
98
|
+
{ description: "A bordered surface action.", id: "outline", name: "Outline" },
|
|
99
|
+
{ description: "A quiet contextual action.", id: "ghost", name: "Ghost" },
|
|
100
|
+
{ description: "A navigation action.", id: "link", name: "Link" },
|
|
101
|
+
],
|
|
102
|
+
"button-group": [
|
|
103
|
+
{
|
|
104
|
+
description: "A connected horizontal action group.",
|
|
105
|
+
id: buttonGroupDefaultOrientation,
|
|
106
|
+
name: "Horizontal",
|
|
107
|
+
},
|
|
108
|
+
{ description: "A connected vertical action group.", id: "vertical", name: "Vertical" },
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const designSystemCategories = Object.keys(componentNames) as DesignSystemCategory[];
|
|
113
|
+
|
|
114
|
+
export const designSystemComponents: readonly DesignSystemComponentDefinition[] = designSystemCategories.flatMap(
|
|
115
|
+
(category) => componentNames[category].map((name) => createComponentDefinition(category, name)),
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
export function getDesignSystemComponent(componentId: string) {
|
|
119
|
+
return designSystemComponents.find(({ id }) => id === componentId);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function createComponentDefinition(category: DesignSystemCategory, name: string): DesignSystemComponentDefinition {
|
|
123
|
+
const id = toId(name);
|
|
124
|
+
return {
|
|
125
|
+
category,
|
|
126
|
+
defaultVariantId: resolveDefaultVariantId(id),
|
|
127
|
+
id,
|
|
128
|
+
name,
|
|
129
|
+
source: `@devxcrew/react-ui/components/${id}`,
|
|
130
|
+
variants: componentVariants[id] ?? [defaultVariant],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function resolveDefaultVariantId(componentId: string) {
|
|
135
|
+
if (componentId === "button") return buttonDefaultVariant;
|
|
136
|
+
if (componentId === "button-group") return buttonGroupDefaultOrientation;
|
|
137
|
+
return "default";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function toId(name: string) {
|
|
141
|
+
return name.toLowerCase().replaceAll(" ", "-");
|
|
142
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export type DesignSystemCategory =
|
|
2
|
+
"Actions" | "Communication" | "Data display" | "Feedback" | "Forms" | "Layout" | "Navigation" | "Overlays";
|
|
3
|
+
|
|
4
|
+
export type DesignSystemVariantDefinition = {
|
|
5
|
+
description: string;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type DesignSystemAssetKind = "block" | "component" | "page" | "template";
|
|
11
|
+
|
|
12
|
+
export type DesignSystemOwnership = {
|
|
13
|
+
applicationOwns: readonly string[];
|
|
14
|
+
packageOwns: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type DesignSystemAssetManifest = {
|
|
18
|
+
defaultVariantId: string;
|
|
19
|
+
description: string;
|
|
20
|
+
id: string;
|
|
21
|
+
kind: DesignSystemAssetKind;
|
|
22
|
+
name: string;
|
|
23
|
+
ownership: DesignSystemOwnership;
|
|
24
|
+
source: string;
|
|
25
|
+
variants: readonly DesignSystemVariantDefinition[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type DesignSystemComponentDefinition = {
|
|
29
|
+
category: DesignSystemCategory;
|
|
30
|
+
defaultVariantId: string;
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
source: string;
|
|
34
|
+
variants: readonly DesignSystemVariantDefinition[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type DesignSystemBlockDefinition = {
|
|
38
|
+
defaultVariantId: string;
|
|
39
|
+
description: string;
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
source: string;
|
|
43
|
+
variants: readonly DesignSystemVariantDefinition[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type DesignSystemPageDefinition = {
|
|
47
|
+
defaultVariantId: string;
|
|
48
|
+
description: string;
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
source: string;
|
|
52
|
+
variants: readonly DesignSystemVariantDefinition[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type DesignSystemTemplateDefinition = DesignSystemPageDefinition;
|
|
56
|
+
|
|
57
|
+
export type DesignSystemSelection = {
|
|
58
|
+
blocks: Readonly<Record<string, string>>;
|
|
59
|
+
components: Readonly<Record<string, string>>;
|
|
60
|
+
pages: Readonly<Record<string, string>>;
|
|
61
|
+
templates: Readonly<Record<string, string>>;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type DesignSystemSelectionInput = {
|
|
65
|
+
blocks?: Readonly<Record<string, string>>;
|
|
66
|
+
components?: Readonly<Record<string, string>>;
|
|
67
|
+
pages?: Readonly<Record<string, string>>;
|
|
68
|
+
templates?: Readonly<Record<string, string>>;
|
|
69
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { designSystemCategories, designSystemComponents, getDesignSystemComponent } from "./component-registry";
|
|
2
|
+
export { designSystemBlocks, getDesignSystemBlock } from "./block-registry";
|
|
3
|
+
export { designSystemPages, getDesignSystemPage } from "./page-registry";
|
|
4
|
+
export { designSystemTemplates, getDesignSystemTemplate } from "./template-registry";
|
|
5
|
+
export { designSystemManifest, getDesignSystemAsset, validateDesignSystemManifest } from "./agent-manifest";
|
|
6
|
+
export {
|
|
7
|
+
createDesignSystemSelection,
|
|
8
|
+
defaultDesignSystemSelection,
|
|
9
|
+
resolveDesignSystemBlockVariant,
|
|
10
|
+
resolveDesignSystemComponentVariant,
|
|
11
|
+
resolveDesignSystemPageVariant,
|
|
12
|
+
resolveDesignSystemTemplateVariant,
|
|
13
|
+
} from "./selection";
|
|
14
|
+
export { buttonDefaultSize, buttonDefaultVariant, buttonGroupDefaultOrientation } from "./defaults";
|
|
15
|
+
export { actionVariantByIntent, resolveActionVariant } from "./action-intents";
|
|
16
|
+
export type { ActionIntent, ActionVariant } from "./action-intents";
|
|
17
|
+
export type {
|
|
18
|
+
DesignSystemBlockDefinition,
|
|
19
|
+
DesignSystemAssetKind,
|
|
20
|
+
DesignSystemAssetManifest,
|
|
21
|
+
DesignSystemOwnership,
|
|
22
|
+
DesignSystemCategory,
|
|
23
|
+
DesignSystemComponentDefinition,
|
|
24
|
+
DesignSystemPageDefinition,
|
|
25
|
+
DesignSystemTemplateDefinition,
|
|
26
|
+
DesignSystemSelection,
|
|
27
|
+
DesignSystemSelectionInput,
|
|
28
|
+
DesignSystemVariantDefinition,
|
|
29
|
+
} from "./contracts";
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDesignSystemSelection,
|
|
3
|
+
resolveDesignSystemBlockVariant,
|
|
4
|
+
resolveDesignSystemComponentVariant,
|
|
5
|
+
resolveDesignSystemPageVariant,
|
|
6
|
+
resolveDesignSystemTemplateVariant,
|
|
7
|
+
} from "./selection";
|
|
8
|
+
import { designSystemManifest, getDesignSystemAsset } from "./agent-manifest";
|
|
9
|
+
import type { DesignSystemAssetKind, DesignSystemSelectionInput } from "./contracts";
|
|
10
|
+
|
|
11
|
+
const toolDefinitions = [
|
|
12
|
+
{
|
|
13
|
+
name: "ui.list_assets",
|
|
14
|
+
description: "List package-owned UI assets that can be composed by an application.",
|
|
15
|
+
inputSchema: { type: "object", properties: { kind: { type: "string" }, query: { type: "string" } } },
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "ui.get_asset",
|
|
19
|
+
description: "Return the complete contract for one UI component, block, page, or template.",
|
|
20
|
+
inputSchema: { type: "object", required: ["id"], properties: { id: { type: "string" }, kind: { type: "string" } } },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "ui.resolve_variant",
|
|
24
|
+
description: "Resolve and validate one asset variant before generating application code.",
|
|
25
|
+
inputSchema: {
|
|
26
|
+
type: "object",
|
|
27
|
+
required: ["kind", "id"],
|
|
28
|
+
properties: { kind: { type: "string" }, id: { type: "string" }, variantId: { type: "string" } },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "ui.validate_selection",
|
|
33
|
+
description: "Validate package UI selections and reject unknown assets or variants.",
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
blocks: { type: "object" },
|
|
38
|
+
components: { type: "object" },
|
|
39
|
+
pages: { type: "object" },
|
|
40
|
+
templates: { type: "object" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
export async function handleUiMcpRequest(request: JsonRpcRequest): Promise<JsonRpcResponse | null> {
|
|
47
|
+
const id = request.id ?? null;
|
|
48
|
+
if (request.method === "notifications/initialized") return null;
|
|
49
|
+
if (request.method === "initialize") {
|
|
50
|
+
return result(id, {
|
|
51
|
+
protocolVersion: "2025-03-26",
|
|
52
|
+
serverInfo: { name: "codexsun-ui", version: "1.0.43" },
|
|
53
|
+
capabilities: { tools: {}, resources: {} },
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (request.method === "tools/list") return result(id, { tools: toolDefinitions });
|
|
57
|
+
if (request.method === "resources/list") {
|
|
58
|
+
return result(id, {
|
|
59
|
+
resources: [{ uri: "ui://manifest", name: "CODEXSUN UI design-system manifest", mimeType: "application/json" }],
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (request.method === "resources/read") {
|
|
63
|
+
if (request.params?.uri === "ui://manifest") return result(id, resource("ui://manifest", designSystemManifest));
|
|
64
|
+
return error(id, -32004, "Unknown UI resource.");
|
|
65
|
+
}
|
|
66
|
+
if (request.method !== "tools/call") return error(id, -32601, "Method not found.");
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
return result(id, {
|
|
70
|
+
content: [
|
|
71
|
+
{ type: "text", text: JSON.stringify(callTool(request.params?.name, request.params?.arguments ?? {})) },
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
} catch (cause) {
|
|
75
|
+
return error(id, -32002, cause instanceof Error ? cause.message : "UI contract validation failed.");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function startUiMcpServer() {
|
|
80
|
+
process.stdin.setEncoding("utf8");
|
|
81
|
+
let buffer = "";
|
|
82
|
+
for await (const chunk of process.stdin) {
|
|
83
|
+
buffer += chunk;
|
|
84
|
+
const lines = buffer.split("\n");
|
|
85
|
+
buffer = lines.pop() ?? "";
|
|
86
|
+
for (const line of lines.filter(Boolean)) {
|
|
87
|
+
let response: JsonRpcResponse | null;
|
|
88
|
+
try {
|
|
89
|
+
response = await handleUiMcpRequest(JSON.parse(line) as JsonRpcRequest);
|
|
90
|
+
} catch {
|
|
91
|
+
response = error(null, -32700, "Invalid JSON.");
|
|
92
|
+
}
|
|
93
|
+
if (response) process.stdout.write(`${JSON.stringify(response)}\n`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
type JsonRpcRequest = {
|
|
99
|
+
id?: string | number | null;
|
|
100
|
+
method: string;
|
|
101
|
+
params?: { name?: string; arguments?: Record<string, unknown>; uri?: string };
|
|
102
|
+
};
|
|
103
|
+
type JsonRpcResponse = {
|
|
104
|
+
jsonrpc: "2.0";
|
|
105
|
+
id: string | number | null;
|
|
106
|
+
result?: unknown;
|
|
107
|
+
error?: { code: number; message: string };
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
function callTool(name: string | undefined, input: Record<string, unknown>) {
|
|
111
|
+
if (name === "ui.list_assets") {
|
|
112
|
+
const kind = typeof input.kind === "string" ? input.kind : undefined;
|
|
113
|
+
const query = typeof input.query === "string" ? input.query.toLowerCase() : undefined;
|
|
114
|
+
return designSystemManifest.filter(
|
|
115
|
+
(asset) =>
|
|
116
|
+
(!kind || asset.kind === kind) &&
|
|
117
|
+
(!query || `${asset.id} ${asset.name} ${asset.description}`.toLowerCase().includes(query)),
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
if (name === "ui.get_asset") {
|
|
121
|
+
const kind = typeof input.kind === "string" ? (input.kind as DesignSystemAssetKind) : undefined;
|
|
122
|
+
const asset = getDesignSystemAsset(String(input.id), kind);
|
|
123
|
+
if (!asset) throw new Error(`Unknown UI asset: ${String(input.id)}`);
|
|
124
|
+
return asset;
|
|
125
|
+
}
|
|
126
|
+
if (name === "ui.resolve_variant")
|
|
127
|
+
return resolveVariant(
|
|
128
|
+
String(input.kind),
|
|
129
|
+
String(input.id),
|
|
130
|
+
typeof input.variantId === "string" ? input.variantId : undefined,
|
|
131
|
+
);
|
|
132
|
+
if (name === "ui.validate_selection") return createDesignSystemSelection(input as DesignSystemSelectionInput);
|
|
133
|
+
throw new Error(`Unknown UI tool: ${String(name)}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function resolveVariant(kind: string, id: string, variantId?: string) {
|
|
137
|
+
if (kind === "component") return resolveDesignSystemComponentVariant(id, variantId);
|
|
138
|
+
if (kind === "block") return resolveDesignSystemBlockVariant(id, variantId);
|
|
139
|
+
if (kind === "page") return resolveDesignSystemPageVariant(id, variantId);
|
|
140
|
+
if (kind === "template") return resolveDesignSystemTemplateVariant(id, variantId);
|
|
141
|
+
throw new Error(`Unknown UI asset kind: ${kind}`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function resource(uri: string, value: unknown) {
|
|
145
|
+
return { contents: [{ uri, mimeType: "application/json", text: JSON.stringify(value) }] };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function result(id: string | number | null, value: unknown): JsonRpcResponse {
|
|
149
|
+
return { jsonrpc: "2.0", id, result: value };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function error(id: string | number | null, code: number, message: string): JsonRpcResponse {
|
|
153
|
+
return { jsonrpc: "2.0", id, error: { code, message } };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (process.argv[1]?.endsWith("mcp-server.ts")) void startUiMcpServer();
|