ShtukbaseStandard

The Shtukbase React component library

shtukbase-ui-react · 版本 0.3.3
其他3 条规范3 项检查

The same components as shtukbase-ui-html in React: the shadcn primitives with our classes and the Shtukbase composites; the code is placed in the project, as with shadcn, and draws with the CSS of the HTML library on the tokens of the chosen style.

关于该包

这段内容尚未翻译,下面是英文原文。

The React side of the Shtukbase design: the same components as shtukbase-ui-html, with the same ids, levels, states and controls, the same markup and the same classes. The look is written once, in the CSS of the HTML library; the React components only draw its classes and data attributes, and add behaviour.

As with shadcn and keer-ui: sources are copied into the project, not installed as a dependency. The place action puts them in the folder from the target: field of the page /design/shtukbase-ui-react.md (by default src/sb-ui) and runs by itself after install and update. Files the project edited are not touched by an update.

What it puts in the project:

  • /design/shtukbase-ui-react.md: what is inside, settings (target:, css:), what the project needs;
  • the library code in the target folder: primitives/, composites/, blocks/, shell/, lib/, styles/index.css; every component has a header (/*--- … ---*/, the one format of the build contract) and a <id>.states.tsx;
  • norms SBR-R01 (the library is intact), SBR-R02 (a component has a states file), SBR-R03 (the same components as the HTML library).

Components (one per id of shtukbase-ui-html): primitives button, badge, input, select, switch, slider come from shadcn (new-york-v4) with our classes added; the rest of the shadcn set (avatar, checkbox, label, progress, radio-group, separator, skeleton, textarea, tooltip, accordion, alert, breadcrumb, command, dialog, dropdown-menu, popover, table, tabs) has the shadcn names and slots and draws the markup of the HTML library (native inputs, details and plain surfaces, so the HTML side needs no script); chip, icon-plate, kicker, swatches, status-dot, the composites card, package-card, field, record-card, property-row, details-card, empty-state, tree-item, toolbar, search-field, settings-group and the blocks area, package-grid, settings-bar and peek are ours.

The parts in shell/: Sidebar and its parts, Panel, PanelSection, Collapsible, ScrollArea, Sheet and the layouts LayoutDocument, LayoutGrid, LayoutCatalog, LayoutCanvas (pan, zoom with the wheel and the keys, fit): plain elements with the classes of shtukbase-ui-html. The lens layout arranges these parts.

The package does not install dependencies (react, radix-ui, class-variance-authority, cn, lucide-react, tailwindcss 4, tw-animate-css); they are requirements for the project, and the list is on the page. The tests carry their own bundled copies (test/vendor) and need no install.

Boundary: no screens and no domain components; the look of our own composites is not repeated in Tailwind classes — it is the CSS of the HTML library. A control of the HTML library is a prop here (preset="cover").

规范 3

ID规范级别模式Enforcer
SBR-R01
The React component library is placed in the project: every file of its manifest is in its place and every relative import (code and CSS) finds its file.
MUST 拦截
检查
SBR-R02
Next to every component <id>.tsx in primitives/, composites/ and blocks/ lies <id>.states.tsx, which exports meta and states.
SHOULD 拦截
检查
SBR-R03
Every React component has a valid header whose id is its file name and whose level is its folder; when the project has shtukbase-ui-html, both libraries have the same ids and the same level, controls, states, statuses, uses and parts.
MUST 拦截
检查

“拦截”:enforcer 会阻止违规;“观察”:只记录违规。MUST 级别表示必须遵守;SHOULD 表示默认应当遵守。

动作 4

名称作用文件时机
placePlace the library in the project folder (target: on /design/shtukbase-ui-react.md); --force replaces edited files tooactions/place.ts
安装后 更新后
libraryThe library is intact: files in place, imports find their files
规范 SBR-R01
checks/library.ts
检查
statesA component has a states file
规范 SBR-R02
checks/states.ts
检查
sameThe same components as the HTML library: valid headers, the same ids, levels and controls
规范 SBR-R03
checks/same.ts
检查

shtuk check 运行检查;shtuk run shtukbase-ui-react <名称> 运行任意动作。“安装后”动作只有在包来自可信来源时才会自动运行。

页面 4

这些页面会放到项目中的以下路径。

包文件 146

它们会放到 .shtukbase/packages/shtukbase-ui-react/,动作从那里运行。

icon.svg 425 B
test/lib.ts 10.9 KB