feat(render): M2 — React 渲染内核 + 布局画廊(playground)

- core 新增 render 子路径(vibe-registry/render):PageView + WidgetView + LayoutGallery
- layout 注册项支持 render 实现;缺省兜底 DefaultLayout
- widget 注册项 component 挂真实 React 组件
- PageBlockDecl 增加 slot 字段(块落在布局哪个槽位)
- playground:admin 布局真实骨架 + 组件 + 订单页,dev 预览 + 生产构建通过
- 全量回归:core/qa-orchestrator/playground typecheck 全绿
This commit is contained in:
hellow-da-sb
2026-09-03 00:59:31 +08:00
parent 8c93bde5f6
commit 2277d55ac9
16 changed files with 1628 additions and 4 deletions
+12 -1
View File
@@ -9,6 +9,15 @@
export type RegistryKind = 'layout' | 'widget' | 'action' | 'schema' | 'theme'
/** 布局渲染函数签名(React 无关,render 层传入类型;避免 core 依赖 React) */
export interface LayoutRenderProps<S extends string = string> {
readonly slots: readonly S[]
/** slot → 已填充的 ReactNode 数组 */
readonly blocks: Record<string, readonly unknown[]>
/** 页面声明本身(含 title 等元信息) */
readonly page: { readonly layout: string; readonly title?: string }
}
/** 布局骨架:页面级结构。渲染内核据 slots 填充 blocks。 */
export interface LayoutRegistryEntry {
readonly kind: 'layout'
@@ -18,6 +27,8 @@ export interface LayoutRegistryEntry {
readonly slots: readonly string[]
/** 描述,供画廊/agent 展示 */
readonly description: string
/** 布局渲染实现(slots → 页面骨架)。可选:缺省用画廊的通用骨架 */
readonly render?: (props: LayoutRenderProps) => unknown
/** demo 数据(预览即真实,与实装共用渲染内核) */
readonly preview?: LayoutPreview
}
@@ -37,7 +48,7 @@ export interface LayoutPreview {
export interface WidgetRegistryEntry {
readonly kind: 'widget'
readonly id: string
/** 渲染组件。内核薄,仅做映射层 */
/** 渲染组件(React 组件;render 层消费,core 不依赖 React 类型) */
readonly component?: unknown
/** 关联字段/列 schema id(可选) */
readonly schemaId?: string