@arkitektio / bsx
BSX语言,块目录,块运行时和React渲染器:每个都有一个副本 Arkitekt前端(Orkestrator, newswitch, pocket)。
| 进口 | 什么 | 需要 |
|---|---|---|
@arkitektio/bsx | 语言(parseBsx, printBsx, analyzeBsx, completeBsx,…),词汇表和规范JSON | 没有什么 |
@arkitektio/bsx/catalogs | 全局目录契约(uiCatalog, htmlCatalog, logoCatalog, sceneCatalog, structureCatalog, shadcnCatalog)和prop-schema词汇表 | 萨德 |
@arkitektio/bsx/runtime | 运行时, defineBlokCatalog / implementBlokCatalog / ownBlokCatalog / declareBlokUi、声明、持久化、 configureBlokPlatform | React, zd, zustand, graphql |
@arkitektio/bsx/web | BlokRenderer, BlokComponentHost, BlokCatalogProvider, addBlokComponents | react-dom |
@arkitektio/bsx/shadcn | 选择加入:ui@1、html@1、logo@1和shadcn@1,使用shadcn/ui (shadcnUi, shadcnHtml, shadcnLogo, shadcnExtras) | 基数,顺风,… |
@arkitektio/bsx/scene | 选择加入:scene@1抽签三名(threeScene),现场主持人 | 三个,@react-three/fiber, @react-three/drei |
@arkitektio/bsx/editor | 摩纳哥BSX的编辑 | @monaco-editor /反应 |
@arkitektio/bsx/tailwind | 类块在运行时带来的顺风 | 顺风车,顺风车?raw) |
每个模块也可以通过其路径访问(@arkitektio/bsx/renderer/runtime/task)。
目录
一、 目录 契约:它包含哪些组件,每个组件需要什么(一个模式) 组件、位置、文本道具、回调事件)。它什么也没画。UI定义目录,在 打字稿;规范JSON是根据它们编写的。
- 全球目录 是有版本的(
ui@1),并在这里定义。实现一个完整声明的UI 因此,只使用全局目录的块会在每个声明它们的UI中呈现。 - UI自己的目录 是由UI: newswitch的
newswitch@2, 构造器的模块块。使用一个的块只在那里渲染。
一个 实现 应用的:是每个组件的渲染,是编译器检查的映射
合同(丢失或未知渲染失败) tsc)。
import {uiCatalog} from '@arkitektio/bsx/catalogs';
import {configureBlokPlatform, declareBlokUi, implementBlokCatalog, type BlokRender} from '@arkitektio/bsx/runtime';
import {shadcnExtras, shadcnHtml, shadcnLogo, shadcnUiRenders} from '@arkitektio/bsx/shadcn';
import {threeScene} from '@arkitektio/bsx/scene';
// Draw over one part of the reference implementation:
const MyButton: BlokRender<typeof uiCatalog.components.Button> = ({component, schema}) => { /* … */ };
const ui = implementBlokCatalog(uiCatalog, {...shadcnUiRenders, Button: MyButton});
export const app = declareBlokUi({
name: 'myapp',
implements: [ui, shadcnHtml, shadcnLogo, shadcnExtras, threeScene, myOwnCatalog],
});
// app.catalog: what the renderers draw. app.claims: the global catalogs it implements whole.
// Once, before the first render: what the bloks get from the app.
configureBlokPlatform({toast, describeError, useKeepLive, useColorScheme, tailwindTheme: appThemeCss, catalog: app.catalog});
UI自己的组件将该语言的默认视图(解析器、检查器、编辑器)与
registerBlokModules([parseSpecCatalog(blokModuleSpec(name, description, app.catalog), name)]).
在应用程序中
- 顺风。 块本身的类在运行时编译(
./tailwind). 器官捐献 实现自己的类不覆盖块外的门户,并且tw-animate-css是 仅仅构建。一个应用程序./shadcn增加了@source "<path to>/node_modules/@arkitektio/bsx/dist";. 一个自带组件的不需要它。 - 在vitest下,内联包(
test.server.deps.inline: ['@arkitektio/bsx']):./tailwind读取样式表?raw. - 三个必须是应用程序中的一个副本(它是对等的)。
radix-ui1.4.X是shadcn实现测试的对象(它的制表符触发)onValueChange1.8年两次。
规范JSON
src/spec/catalogs/<name>@<version>.json 因为全球目录是从合同中写出来的:
pnpm build && pnpm spec:export (当他们不同意时,测试失败)。arkitekt-spec的
scripts/sync_standard_catalog.py 把它们复制进去,然后把自己的语言写进去
付款: vocabulary.json, catalogs/[email protected] 宇称语料库 bsx_v2.json. 从来没有
编辑这三个。