prefab-ui 0.1.0__tar.gz
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.
- prefab_ui-0.1.0/.claude/skills/docs-build-pipeline/SKILL.md +110 -0
- prefab_ui-0.1.0/.claude/skills/writing-component-docs/SKILL.md +93 -0
- prefab_ui-0.1.0/.github/actions/run-pytest/action.yml +18 -0
- prefab_ui-0.1.0/.github/actions/setup-uv/action.yml +33 -0
- prefab_ui-0.1.0/.github/workflows/build-renderer.yml +44 -0
- prefab_ui-0.1.0/.github/workflows/publish-renderer.yml +52 -0
- prefab_ui-0.1.0/.github/workflows/publish.yml +27 -0
- prefab_ui-0.1.0/.github/workflows/run-renderer-tests.yml +40 -0
- prefab_ui-0.1.0/.github/workflows/run-static.yml +42 -0
- prefab_ui-0.1.0/.github/workflows/run-tests.yml +63 -0
- prefab_ui-0.1.0/.gitignore +42 -0
- prefab_ui-0.1.0/.pre-commit-config.yaml +61 -0
- prefab_ui-0.1.0/.python-version +1 -0
- prefab_ui-0.1.0/CLAUDE.md +20 -0
- prefab_ui-0.1.0/LICENSE +201 -0
- prefab_ui-0.1.0/PKG-INFO +154 -0
- prefab_ui-0.1.0/README.md +130 -0
- prefab_ui-0.1.0/VISION.md +255 -0
- prefab_ui-0.1.0/docs/_preview-build/README.md +315 -0
- prefab_ui-0.1.0/docs/_preview-build/extract_examples.py +58 -0
- prefab_ui-0.1.0/docs/_preview-build/generate_content.py +169 -0
- prefab_ui-0.1.0/docs/_preview-build/generate_playground_bundle.py +48 -0
- prefab_ui-0.1.0/docs/_preview-build/generate_protocol_pages.py +376 -0
- prefab_ui-0.1.0/docs/_preview-build/generate_protocol_ref.py +273 -0
- prefab_ui-0.1.0/docs/_preview-build/html_renderer.py +752 -0
- prefab_ui-0.1.0/docs/_preview-build/input.css +42 -0
- prefab_ui-0.1.0/docs/_preview-build/package-lock.json +18 -0
- prefab_ui-0.1.0/docs/_preview-build/package.json +5 -0
- prefab_ui-0.1.0/docs/_preview-build/render_previews.py +374 -0
- prefab_ui-0.1.0/docs/_preview-build/scope_css.py +93 -0
- prefab_ui-0.1.0/docs/actions/call-tool.mdx +133 -0
- prefab_ui-0.1.0/docs/actions/open-link.mdx +154 -0
- prefab_ui-0.1.0/docs/actions/send-message.mdx +178 -0
- prefab_ui-0.1.0/docs/actions/set-state.mdx +488 -0
- prefab_ui-0.1.0/docs/actions/update-context.mdx +147 -0
- prefab_ui-0.1.0/docs/actions.mdx +76 -0
- prefab_ui-0.1.0/docs/assets/banner.png +0 -0
- prefab_ui-0.1.0/docs/assets/hello-world-card.png +0 -0
- prefab_ui-0.1.0/docs/assets/showcase.png +0 -0
- prefab_ui-0.1.0/docs/components/accordion.mdx +306 -0
- prefab_ui-0.1.0/docs/components/alert.mdx +445 -0
- prefab_ui-0.1.0/docs/components/area-chart.mdx +490 -0
- prefab_ui-0.1.0/docs/components/badge.mdx +233 -0
- prefab_ui-0.1.0/docs/components/bar-chart.mdx +412 -0
- prefab_ui-0.1.0/docs/components/button-group.mdx +184 -0
- prefab_ui-0.1.0/docs/components/button.mdx +415 -0
- prefab_ui-0.1.0/docs/components/calendar.mdx +199 -0
- prefab_ui-0.1.0/docs/components/card.mdx +400 -0
- prefab_ui-0.1.0/docs/components/checkbox.mdx +263 -0
- prefab_ui-0.1.0/docs/components/code.mdx +119 -0
- prefab_ui-0.1.0/docs/components/column.mdx +312 -0
- prefab_ui-0.1.0/docs/components/combobox.mdx +326 -0
- prefab_ui-0.1.0/docs/components/conditional.mdx +393 -0
- prefab_ui-0.1.0/docs/components/container.mdx +100 -0
- prefab_ui-0.1.0/docs/components/data-table.mdx +233 -0
- prefab_ui-0.1.0/docs/components/date-picker.mdx +214 -0
- prefab_ui-0.1.0/docs/components/define-use.mdx +154 -0
- prefab_ui-0.1.0/docs/components/dialog.mdx +197 -0
- prefab_ui-0.1.0/docs/components/div-span.mdx +123 -0
- prefab_ui-0.1.0/docs/components/field.mdx +241 -0
- prefab_ui-0.1.0/docs/components/foreach.mdx +315 -0
- prefab_ui-0.1.0/docs/components/grid.mdx +376 -0
- prefab_ui-0.1.0/docs/components/icon.mdx +184 -0
- prefab_ui-0.1.0/docs/components/image.mdx +94 -0
- prefab_ui-0.1.0/docs/components/input.mdx +301 -0
- prefab_ui-0.1.0/docs/components/label.mdx +105 -0
- prefab_ui-0.1.0/docs/components/line-chart.mdx +480 -0
- prefab_ui-0.1.0/docs/components/markdown.mdx +72 -0
- prefab_ui-0.1.0/docs/components/pages.mdx +383 -0
- prefab_ui-0.1.0/docs/components/pie-chart.mdx +307 -0
- prefab_ui-0.1.0/docs/components/popover.mdx +188 -0
- prefab_ui-0.1.0/docs/components/progress.mdx +274 -0
- prefab_ui-0.1.0/docs/components/radar-chart.mdx +310 -0
- prefab_ui-0.1.0/docs/components/radial-chart.mdx +252 -0
- prefab_ui-0.1.0/docs/components/radio.mdx +309 -0
- prefab_ui-0.1.0/docs/components/row.mdx +590 -0
- prefab_ui-0.1.0/docs/components/select.mdx +417 -0
- prefab_ui-0.1.0/docs/components/separator.mdx +191 -0
- prefab_ui-0.1.0/docs/components/slider.mdx +291 -0
- prefab_ui-0.1.0/docs/components/slot.mdx +224 -0
- prefab_ui-0.1.0/docs/components/spinner.mdx +125 -0
- prefab_ui-0.1.0/docs/components/switch.mdx +265 -0
- prefab_ui-0.1.0/docs/components/table.mdx +339 -0
- prefab_ui-0.1.0/docs/components/tabs.mdx +353 -0
- prefab_ui-0.1.0/docs/components/textarea.mdx +174 -0
- prefab_ui-0.1.0/docs/components/tooltip.mdx +180 -0
- prefab_ui-0.1.0/docs/components/typography.mdx +411 -0
- prefab_ui-0.1.0/docs/css.mdx +84 -0
- prefab_ui-0.1.0/docs/docs.json +311 -0
- prefab_ui-0.1.0/docs/examples/todo.mdx +388 -0
- prefab_ui-0.1.0/docs/expressions/context.mdx +255 -0
- prefab_ui-0.1.0/docs/expressions/operators.mdx +317 -0
- prefab_ui-0.1.0/docs/expressions/overview.mdx +148 -0
- prefab_ui-0.1.0/docs/expressions/pipes.mdx +409 -0
- prefab_ui-0.1.0/docs/expressions/templates.mdx +234 -0
- prefab_ui-0.1.0/docs/overview.mdx +252 -0
- prefab_ui-0.1.0/docs/patterns/confirmation.mdx +238 -0
- prefab_ui-0.1.0/docs/patterns/data-display.mdx +412 -0
- prefab_ui-0.1.0/docs/patterns/forms.mdx +342 -0
- prefab_ui-0.1.0/docs/patterns/interactivity.mdx +396 -0
- prefab_ui-0.1.0/docs/patterns/responsive-layouts.mdx +44 -0
- prefab_ui-0.1.0/docs/patterns/reusable-components.mdx +140 -0
- prefab_ui-0.1.0/docs/playground-app.js +2 -0
- prefab_ui-0.1.0/docs/playground.mdx +55 -0
- prefab_ui-0.1.0/docs/protocol/accordion-item.mdx +58 -0
- prefab_ui-0.1.0/docs/protocol/accordion.mdx +94 -0
- prefab_ui-0.1.0/docs/protocol/alert-description.mdx +35 -0
- prefab_ui-0.1.0/docs/protocol/alert-title.mdx +35 -0
- prefab_ui-0.1.0/docs/protocol/alert.mdx +65 -0
- prefab_ui-0.1.0/docs/protocol/append-state.mdx +46 -0
- prefab_ui-0.1.0/docs/protocol/area-chart.mdx +102 -0
- prefab_ui-0.1.0/docs/protocol/badge.mdx +50 -0
- prefab_ui-0.1.0/docs/protocol/bar-chart.mdx +97 -0
- prefab_ui-0.1.0/docs/protocol/block-quote.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/button-group.mdx +54 -0
- prefab_ui-0.1.0/docs/protocol/button.mdx +91 -0
- prefab_ui-0.1.0/docs/protocol/calendar.mdx +53 -0
- prefab_ui-0.1.0/docs/protocol/card-content.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/card-description.mdx +53 -0
- prefab_ui-0.1.0/docs/protocol/card-footer.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/card-header.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/card-title.mdx +53 -0
- prefab_ui-0.1.0/docs/protocol/card.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/chart-series.mdx +37 -0
- prefab_ui-0.1.0/docs/protocol/checkbox.mdx +74 -0
- prefab_ui-0.1.0/docs/protocol/code.mdx +43 -0
- prefab_ui-0.1.0/docs/protocol/column.mdx +113 -0
- prefab_ui-0.1.0/docs/protocol/combobox-option.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/combobox.mdx +79 -0
- prefab_ui-0.1.0/docs/protocol/condition.mdx +47 -0
- prefab_ui-0.1.0/docs/protocol/container.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/data-table-column.mdx +31 -0
- prefab_ui-0.1.0/docs/protocol/data-table.mdx +76 -0
- prefab_ui-0.1.0/docs/protocol/date-picker.mdx +48 -0
- prefab_ui-0.1.0/docs/protocol/dialog.mdx +61 -0
- prefab_ui-0.1.0/docs/protocol/div.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/field.mdx +63 -0
- prefab_ui-0.1.0/docs/protocol/for-each.mdx +50 -0
- prefab_ui-0.1.0/docs/protocol/form.mdx +54 -0
- prefab_ui-0.1.0/docs/protocol/grid.mdx +137 -0
- prefab_ui-0.1.0/docs/protocol/h1.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/h2.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/h3.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/h4.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/heading.mdx +46 -0
- prefab_ui-0.1.0/docs/protocol/icon.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/image.mdx +56 -0
- prefab_ui-0.1.0/docs/protocol/inline-code.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/input.mdx +135 -0
- prefab_ui-0.1.0/docs/protocol/label.mdx +61 -0
- prefab_ui-0.1.0/docs/protocol/large.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/lead.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/line-chart.mdx +97 -0
- prefab_ui-0.1.0/docs/protocol/markdown.mdx +35 -0
- prefab_ui-0.1.0/docs/protocol/muted.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/open-link.mdx +27 -0
- prefab_ui-0.1.0/docs/protocol/overview.mdx +138 -0
- prefab_ui-0.1.0/docs/protocol/p.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/page.mdx +58 -0
- prefab_ui-0.1.0/docs/protocol/pages.mdx +61 -0
- prefab_ui-0.1.0/docs/protocol/pie-chart.mdx +86 -0
- prefab_ui-0.1.0/docs/protocol/pop-state.mdx +39 -0
- prefab_ui-0.1.0/docs/protocol/popover.mdx +75 -0
- prefab_ui-0.1.0/docs/protocol/progress.mdx +55 -0
- prefab_ui-0.1.0/docs/protocol/radar-chart.mdx +92 -0
- prefab_ui-0.1.0/docs/protocol/radial-chart.mdx +86 -0
- prefab_ui-0.1.0/docs/protocol/radio-group.mdx +58 -0
- prefab_ui-0.1.0/docs/protocol/radio.mdx +66 -0
- prefab_ui-0.1.0/docs/protocol/row.mdx +113 -0
- prefab_ui-0.1.0/docs/protocol/select-option.mdx +50 -0
- prefab_ui-0.1.0/docs/protocol/select.mdx +85 -0
- prefab_ui-0.1.0/docs/protocol/send-message.mdx +27 -0
- prefab_ui-0.1.0/docs/protocol/separator.mdx +47 -0
- prefab_ui-0.1.0/docs/protocol/set-state.mdx +31 -0
- prefab_ui-0.1.0/docs/protocol/show-toast.mdx +58 -0
- prefab_ui-0.1.0/docs/protocol/slider.mdx +74 -0
- prefab_ui-0.1.0/docs/protocol/slot.mdx +50 -0
- prefab_ui-0.1.0/docs/protocol/small.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/span.mdx +35 -0
- prefab_ui-0.1.0/docs/protocol/spinner.mdx +40 -0
- prefab_ui-0.1.0/docs/protocol/switch.mdx +75 -0
- prefab_ui-0.1.0/docs/protocol/tab.mdx +63 -0
- prefab_ui-0.1.0/docs/protocol/table-body.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/table-caption.mdx +35 -0
- prefab_ui-0.1.0/docs/protocol/table-cell.mdx +53 -0
- prefab_ui-0.1.0/docs/protocol/table-footer.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/table-head.mdx +53 -0
- prefab_ui-0.1.0/docs/protocol/table-header.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/table-row.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/table.mdx +45 -0
- prefab_ui-0.1.0/docs/protocol/tabs.mdx +75 -0
- prefab_ui-0.1.0/docs/protocol/text.mdx +51 -0
- prefab_ui-0.1.0/docs/protocol/textarea.mdx +93 -0
- prefab_ui-0.1.0/docs/protocol/toggle-state.mdx +27 -0
- prefab_ui-0.1.0/docs/protocol/tool-call.mdx +40 -0
- prefab_ui-0.1.0/docs/protocol/tooltip.mdx +64 -0
- prefab_ui-0.1.0/docs/protocol/update-context.mdx +39 -0
- prefab_ui-0.1.0/docs/renderer.js +8710 -0
- prefab_ui-0.1.0/docs/serve.mdx +90 -0
- prefab_ui-0.1.0/docs/snippets/component-playground.mdx +21 -0
- prefab_ui-0.1.0/docs/snippets/component-preview.mdx +176 -0
- prefab_ui-0.1.0/docs/snippets/gen/welcome/code_showcase.mdx +1289 -0
- prefab_ui-0.1.0/docs/styles/style.css +18 -0
- prefab_ui-0.1.0/docs/testing.mdx +226 -0
- prefab_ui-0.1.0/docs/vercel.json +12 -0
- prefab_ui-0.1.0/docs/welcome.mdx +1471 -0
- prefab_ui-0.1.0/examples/todo/app.py +152 -0
- prefab_ui-0.1.0/justfile +44 -0
- prefab_ui-0.1.0/loq.toml +15 -0
- prefab_ui-0.1.0/pyproject.toml +105 -0
- prefab_ui-0.1.0/renderer/.gitignore +1 -0
- prefab_ui-0.1.0/renderer/components.json +23 -0
- prefab_ui-0.1.0/renderer/mcp.html +12 -0
- prefab_ui-0.1.0/renderer/package-lock.json +8300 -0
- prefab_ui-0.1.0/renderer/package.json +90 -0
- prefab_ui-0.1.0/renderer/playground.html +12 -0
- prefab_ui-0.1.0/renderer/renderer.html +12 -0
- prefab_ui-0.1.0/renderer/src/actions.test.ts +688 -0
- prefab_ui-0.1.0/renderer/src/actions.ts +297 -0
- prefab_ui-0.1.0/renderer/src/app.tsx +167 -0
- prefab_ui-0.1.0/renderer/src/components/alert-wrapper.tsx +34 -0
- prefab_ui-0.1.0/renderer/src/components/button-wrapper.tsx +27 -0
- prefab_ui-0.1.0/renderer/src/components/charts.tsx +393 -0
- prefab_ui-0.1.0/renderer/src/components/combobox-wrapper.tsx +128 -0
- prefab_ui-0.1.0/renderer/src/components/compound.tsx +492 -0
- prefab_ui-0.1.0/renderer/src/components/content.tsx +220 -0
- prefab_ui-0.1.0/renderer/src/components/control-flow.tsx +51 -0
- prefab_ui-0.1.0/renderer/src/components/data-display.tsx +202 -0
- prefab_ui-0.1.0/renderer/src/components/field-wrapper.tsx +44 -0
- prefab_ui-0.1.0/renderer/src/components/form.tsx +347 -0
- prefab_ui-0.1.0/renderer/src/components/icon-wrapper.tsx +32 -0
- prefab_ui-0.1.0/renderer/src/components/layout.tsx +118 -0
- prefab_ui-0.1.0/renderer/src/components/registry.ts +206 -0
- prefab_ui-0.1.0/renderer/src/components/typography.tsx +257 -0
- prefab_ui-0.1.0/renderer/src/components/validation-error.tsx +51 -0
- prefab_ui-0.1.0/renderer/src/conditional.test.ts +115 -0
- prefab_ui-0.1.0/renderer/src/conditions.test.ts +286 -0
- prefab_ui-0.1.0/renderer/src/conditions.ts +33 -0
- prefab_ui-0.1.0/renderer/src/contract.test.ts +150 -0
- prefab_ui-0.1.0/renderer/src/demo-data.ts +1096 -0
- prefab_ui-0.1.0/renderer/src/dev-preview.tsx +153 -0
- prefab_ui-0.1.0/renderer/src/early-bridge.ts +87 -0
- prefab_ui-0.1.0/renderer/src/embed.tsx +179 -0
- prefab_ui-0.1.0/renderer/src/expression-pipes.test.ts +46 -0
- prefab_ui-0.1.0/renderer/src/expression.test.ts +742 -0
- prefab_ui-0.1.0/renderer/src/expression.ts +613 -0
- prefab_ui-0.1.0/renderer/src/foreach.test.ts +126 -0
- prefab_ui-0.1.0/renderer/src/index.css +261 -0
- prefab_ui-0.1.0/renderer/src/interpolation.test.ts +291 -0
- prefab_ui-0.1.0/renderer/src/interpolation.ts +121 -0
- prefab_ui-0.1.0/renderer/src/lib/icons.tsx +19 -0
- prefab_ui-0.1.0/renderer/src/lib/utils.ts +6 -0
- prefab_ui-0.1.0/renderer/src/main.tsx +47 -0
- prefab_ui-0.1.0/renderer/src/playground/bundle.json +62 -0
- prefab_ui-0.1.0/renderer/src/playground/editor.tsx +280 -0
- prefab_ui-0.1.0/renderer/src/playground/examples.json +1407 -0
- prefab_ui-0.1.0/renderer/src/playground/examples.ts +231 -0
- prefab_ui-0.1.0/renderer/src/playground/main.tsx +10 -0
- prefab_ui-0.1.0/renderer/src/playground/playground.tsx +419 -0
- prefab_ui-0.1.0/renderer/src/playground/pyodide.ts +181 -0
- prefab_ui-0.1.0/renderer/src/portal-container.tsx +23 -0
- prefab_ui-0.1.0/renderer/src/renderer.tsx +671 -0
- prefab_ui-0.1.0/renderer/src/schemas/accordion.ts +18 -0
- prefab_ui-0.1.0/renderer/src/schemas/actions.ts +147 -0
- prefab_ui-0.1.0/renderer/src/schemas/alert.ts +28 -0
- prefab_ui-0.1.0/renderer/src/schemas/badge.ts +21 -0
- prefab_ui-0.1.0/renderer/src/schemas/base.ts +29 -0
- prefab_ui-0.1.0/renderer/src/schemas/button.ts +38 -0
- prefab_ui-0.1.0/renderer/src/schemas/button_group.ts +9 -0
- prefab_ui-0.1.0/renderer/src/schemas/calendar.ts +12 -0
- prefab_ui-0.1.0/renderer/src/schemas/card.ts +40 -0
- prefab_ui-0.1.0/renderer/src/schemas/chart.ts +92 -0
- prefab_ui-0.1.0/renderer/src/schemas/checkbox.ts +16 -0
- prefab_ui-0.1.0/renderer/src/schemas/code.ts +10 -0
- prefab_ui-0.1.0/renderer/src/schemas/column.ts +8 -0
- prefab_ui-0.1.0/renderer/src/schemas/combobox.ts +22 -0
- prefab_ui-0.1.0/renderer/src/schemas/conditional.ts +20 -0
- prefab_ui-0.1.0/renderer/src/schemas/container.ts +8 -0
- prefab_ui-0.1.0/renderer/src/schemas/data_table.ts +22 -0
- prefab_ui-0.1.0/renderer/src/schemas/date_picker.ts +12 -0
- prefab_ui-0.1.0/renderer/src/schemas/dialog.ts +10 -0
- prefab_ui-0.1.0/renderer/src/schemas/div.ts +14 -0
- prefab_ui-0.1.0/renderer/src/schemas/field.ts +11 -0
- prefab_ui-0.1.0/renderer/src/schemas/foreach.ts +9 -0
- prefab_ui-0.1.0/renderer/src/schemas/form.ts +10 -0
- prefab_ui-0.1.0/renderer/src/schemas/grid.ts +9 -0
- prefab_ui-0.1.0/renderer/src/schemas/heading.ts +14 -0
- prefab_ui-0.1.0/renderer/src/schemas/icon.ts +10 -0
- prefab_ui-0.1.0/renderer/src/schemas/image.ts +12 -0
- prefab_ui-0.1.0/renderer/src/schemas/index.ts +205 -0
- prefab_ui-0.1.0/renderer/src/schemas/input.ts +36 -0
- prefab_ui-0.1.0/renderer/src/schemas/label.ts +10 -0
- prefab_ui-0.1.0/renderer/src/schemas/markdown.ts +9 -0
- prefab_ui-0.1.0/renderer/src/schemas/pages.ts +17 -0
- prefab_ui-0.1.0/renderer/src/schemas/popover.ts +11 -0
- prefab_ui-0.1.0/renderer/src/schemas/progress.ts +11 -0
- prefab_ui-0.1.0/renderer/src/schemas/radio.ts +22 -0
- prefab_ui-0.1.0/renderer/src/schemas/row.ts +8 -0
- prefab_ui-0.1.0/renderer/src/schemas/select.ts +24 -0
- prefab_ui-0.1.0/renderer/src/schemas/separator.ts +9 -0
- prefab_ui-0.1.0/renderer/src/schemas/slider.ts +16 -0
- prefab_ui-0.1.0/renderer/src/schemas/slot.ts +9 -0
- prefab_ui-0.1.0/renderer/src/schemas/spinner.ts +9 -0
- prefab_ui-0.1.0/renderer/src/schemas/switch.ts +16 -0
- prefab_ui-0.1.0/renderer/src/schemas/table.ts +69 -0
- prefab_ui-0.1.0/renderer/src/schemas/tabs.ts +21 -0
- prefab_ui-0.1.0/renderer/src/schemas/text.ts +11 -0
- prefab_ui-0.1.0/renderer/src/schemas/textarea.ts +18 -0
- prefab_ui-0.1.0/renderer/src/schemas/tooltip.ts +10 -0
- prefab_ui-0.1.0/renderer/src/schemas/typography.ts +53 -0
- prefab_ui-0.1.0/renderer/src/slot.test.ts +149 -0
- prefab_ui-0.1.0/renderer/src/state.test.ts +207 -0
- prefab_ui-0.1.0/renderer/src/state.ts +148 -0
- prefab_ui-0.1.0/renderer/src/style-nova.css +1417 -0
- prefab_ui-0.1.0/renderer/src/testing/mock-app.ts +34 -0
- prefab_ui-0.1.0/renderer/src/testing/state-store.ts +36 -0
- prefab_ui-0.1.0/renderer/src/theme.css +77 -0
- prefab_ui-0.1.0/renderer/src/ui/accordion.tsx +68 -0
- prefab_ui-0.1.0/renderer/src/ui/alert.tsx +63 -0
- prefab_ui-0.1.0/renderer/src/ui/badge.tsx +53 -0
- prefab_ui-0.1.0/renderer/src/ui/button.tsx +66 -0
- prefab_ui-0.1.0/renderer/src/ui/calendar.tsx +211 -0
- prefab_ui-0.1.0/renderer/src/ui/card.tsx +80 -0
- prefab_ui-0.1.0/renderer/src/ui/chart.tsx +388 -0
- prefab_ui-0.1.0/renderer/src/ui/checkbox.tsx +30 -0
- prefab_ui-0.1.0/renderer/src/ui/dialog.tsx +124 -0
- prefab_ui-0.1.0/renderer/src/ui/input.tsx +19 -0
- prefab_ui-0.1.0/renderer/src/ui/label.tsx +22 -0
- prefab_ui-0.1.0/renderer/src/ui/popover.tsx +35 -0
- prefab_ui-0.1.0/renderer/src/ui/progress.tsx +31 -0
- prefab_ui-0.1.0/renderer/src/ui/radio-group.tsx +43 -0
- prefab_ui-0.1.0/renderer/src/ui/select.tsx +144 -0
- prefab_ui-0.1.0/renderer/src/ui/separator.tsx +27 -0
- prefab_ui-0.1.0/renderer/src/ui/slider.tsx +57 -0
- prefab_ui-0.1.0/renderer/src/ui/spinner.tsx +23 -0
- prefab_ui-0.1.0/renderer/src/ui/switch.tsx +31 -0
- prefab_ui-0.1.0/renderer/src/ui/table.tsx +117 -0
- prefab_ui-0.1.0/renderer/src/ui/tabs.tsx +53 -0
- prefab_ui-0.1.0/renderer/src/ui/textarea.tsx +18 -0
- prefab_ui-0.1.0/renderer/src/ui/tooltip.tsx +28 -0
- prefab_ui-0.1.0/renderer/src/validation.test.ts +127 -0
- prefab_ui-0.1.0/renderer/src/validation.ts +95 -0
- prefab_ui-0.1.0/renderer/src/vite-env.d.ts +1 -0
- prefab_ui-0.1.0/renderer/tsconfig.json +26 -0
- prefab_ui-0.1.0/renderer/vite-plugins.ts +46 -0
- prefab_ui-0.1.0/renderer/vite.config.mcp.ts +34 -0
- prefab_ui-0.1.0/renderer/vite.config.playground.ts +33 -0
- prefab_ui-0.1.0/renderer/vite.config.renderer.ts +42 -0
- prefab_ui-0.1.0/renderer/vite.config.ts +45 -0
- prefab_ui-0.1.0/renderer/vitest.config.ts +14 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/appendState.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/openLink.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/popState.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/sendMessage.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/setState.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/showToast.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/toggleState.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/toolCall.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/actions/updateContext.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Accordion.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/AccordionItem.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Alert.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/AlertDescription.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/AlertTitle.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/AreaChart.json +12 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Badge.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/BarChart.json +12 -0
- prefab_ui-0.1.0/schemas/fixtures/components/BlockQuote.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Button.json +7 -0
- prefab_ui-0.1.0/schemas/fixtures/components/ButtonGroup.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Calendar.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Card.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/CardContent.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/CardDescription.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/CardFooter.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/CardHeader.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/CardTitle.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Checkbox.json +6 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Code.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Column.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Combobox.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/ComboboxOption.json +6 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Condition.json +9 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Container.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/DataTable.json +8 -0
- prefab_ui-0.1.0/schemas/fixtures/components/DatePicker.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Dialog.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Div.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Elif.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Else.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Field.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/ForEach.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Form.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Grid.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/H1.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/H2.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/H3.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/H4.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Heading.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Icon.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/If.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Image.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/InlineCode.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Input.json +6 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Label.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Large.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Lead.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/LineChart.json +11 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Markdown.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Muted.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/P.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Page.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Pages.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/PieChart.json +12 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Popover.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Progress.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/RadarChart.json +11 -0
- prefab_ui-0.1.0/schemas/fixtures/components/RadialChart.json +12 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Radio.json +7 -0
- prefab_ui-0.1.0/schemas/fixtures/components/RadioGroup.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Row.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Select.json +6 -0
- prefab_ui-0.1.0/schemas/fixtures/components/SelectOption.json +7 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Separator.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Slider.json +6 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Slot.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Small.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Span.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Spinner.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/State.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Switch.json +7 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Tab.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Table.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/TableBody.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/TableCaption.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/TableCell.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/TableFooter.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/TableHead.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/TableHeader.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/TableRow.json +3 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Tabs.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Text.json +4 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Textarea.json +5 -0
- prefab_ui-0.1.0/schemas/fixtures/components/Tooltip.json +4 -0
- prefab_ui-0.1.0/schemas/manifest.json +96 -0
- prefab_ui-0.1.0/scripts/generate_schemas.py +284 -0
- prefab_ui-0.1.0/skills/generative-prefab-ui/SKILL.md +192 -0
- prefab_ui-0.1.0/skills/generative-prefab-ui/references/actions.md +139 -0
- prefab_ui-0.1.0/skills/generative-prefab-ui/references/components.md +137 -0
- prefab_ui-0.1.0/skills/generative-prefab-ui/references/expressions.md +64 -0
- prefab_ui-0.1.0/skills/writing-prefab-python/SKILL.md +242 -0
- prefab_ui-0.1.0/skills/writing-prefab-python/references/forms.md +69 -0
- prefab_ui-0.1.0/skills/writing-prefab-python/references/testing.md +90 -0
- prefab_ui-0.1.0/src/prefab_ui/__init__.py +35 -0
- prefab_ui-0.1.0/src/prefab_ui/actions/__init__.py +58 -0
- prefab_ui-0.1.0/src/prefab_ui/actions/base.py +50 -0
- prefab_ui-0.1.0/src/prefab_ui/actions/mcp.py +64 -0
- prefab_ui-0.1.0/src/prefab_ui/actions/navigation.py +20 -0
- prefab_ui-0.1.0/src/prefab_ui/actions/state.py +138 -0
- prefab_ui-0.1.0/src/prefab_ui/actions/ui.py +27 -0
- prefab_ui-0.1.0/src/prefab_ui/app.py +159 -0
- prefab_ui-0.1.0/src/prefab_ui/cli/__init__.py +5 -0
- prefab_ui-0.1.0/src/prefab_ui/cli/__main__.py +5 -0
- prefab_ui-0.1.0/src/prefab_ui/cli/cli.py +674 -0
- prefab_ui-0.1.0/src/prefab_ui/components/__init__.py +189 -0
- prefab_ui-0.1.0/src/prefab_ui/components/accordion.py +107 -0
- prefab_ui-0.1.0/src/prefab_ui/components/alert.py +111 -0
- prefab_ui-0.1.0/src/prefab_ui/components/badge.py +72 -0
- prefab_ui-0.1.0/src/prefab_ui/components/base.py +275 -0
- prefab_ui-0.1.0/src/prefab_ui/components/button.py +97 -0
- prefab_ui-0.1.0/src/prefab_ui/components/button_group.py +48 -0
- prefab_ui-0.1.0/src/prefab_ui/components/calendar.py +45 -0
- prefab_ui-0.1.0/src/prefab_ui/components/card.py +145 -0
- prefab_ui-0.1.0/src/prefab_ui/components/chart.py +278 -0
- prefab_ui-0.1.0/src/prefab_ui/components/checkbox.py +53 -0
- prefab_ui-0.1.0/src/prefab_ui/components/code.py +36 -0
- prefab_ui-0.1.0/src/prefab_ui/components/column.py +43 -0
- prefab_ui-0.1.0/src/prefab_ui/components/combobox.py +92 -0
- prefab_ui-0.1.0/src/prefab_ui/components/conditional.py +90 -0
- prefab_ui-0.1.0/src/prefab_ui/components/container.py +24 -0
- prefab_ui-0.1.0/src/prefab_ui/components/data_table.py +69 -0
- prefab_ui-0.1.0/src/prefab_ui/components/date_picker.py +43 -0
- prefab_ui-0.1.0/src/prefab_ui/components/dialog.py +45 -0
- prefab_ui-0.1.0/src/prefab_ui/components/div.py +49 -0
- prefab_ui-0.1.0/src/prefab_ui/components/field.py +48 -0
- prefab_ui-0.1.0/src/prefab_ui/components/foreach.py +59 -0
- prefab_ui-0.1.0/src/prefab_ui/components/form.py +387 -0
- prefab_ui-0.1.0/src/prefab_ui/components/grid.py +91 -0
- prefab_ui-0.1.0/src/prefab_ui/components/heading.py +35 -0
- prefab_ui-0.1.0/src/prefab_ui/components/icon.py +58 -0
- prefab_ui-0.1.0/src/prefab_ui/components/image.py +24 -0
- prefab_ui-0.1.0/src/prefab_ui/components/input.py +97 -0
- prefab_ui-0.1.0/src/prefab_ui/components/label.py +59 -0
- prefab_ui-0.1.0/src/prefab_ui/components/markdown.py +32 -0
- prefab_ui-0.1.0/src/prefab_ui/components/pages.py +79 -0
- prefab_ui-0.1.0/src/prefab_ui/components/popover.py +46 -0
- prefab_ui-0.1.0/src/prefab_ui/components/progress.py +32 -0
- prefab_ui-0.1.0/src/prefab_ui/components/radio.py +72 -0
- prefab_ui-0.1.0/src/prefab_ui/components/row.py +43 -0
- prefab_ui-0.1.0/src/prefab_ui/components/select.py +93 -0
- prefab_ui-0.1.0/src/prefab_ui/components/separator.py +58 -0
- prefab_ui-0.1.0/src/prefab_ui/components/slider.py +52 -0
- prefab_ui-0.1.0/src/prefab_ui/components/slot.py +36 -0
- prefab_ui-0.1.0/src/prefab_ui/components/spinner.py +36 -0
- prefab_ui-0.1.0/src/prefab_ui/components/switch.py +54 -0
- prefab_ui-0.1.0/src/prefab_ui/components/table.py +145 -0
- prefab_ui-0.1.0/src/prefab_ui/components/tabs.py +87 -0
- prefab_ui-0.1.0/src/prefab_ui/components/text.py +34 -0
- prefab_ui-0.1.0/src/prefab_ui/components/textarea.py +65 -0
- prefab_ui-0.1.0/src/prefab_ui/components/tooltip.py +46 -0
- prefab_ui-0.1.0/src/prefab_ui/components/typography.py +273 -0
- prefab_ui-0.1.0/src/prefab_ui/css.py +163 -0
- prefab_ui-0.1.0/src/prefab_ui/define.py +69 -0
- prefab_ui-0.1.0/src/prefab_ui/py.typed +0 -0
- prefab_ui-0.1.0/src/prefab_ui/renderer/__init__.py +93 -0
- prefab_ui-0.1.0/src/prefab_ui/renderer/app.html +8800 -0
- prefab_ui-0.1.0/src/prefab_ui/testing.py +313 -0
- prefab_ui-0.1.0/src/prefab_ui/use.py +72 -0
- prefab_ui-0.1.0/tests/conftest.py +12 -0
- prefab_ui-0.1.0/tests/test_actions.py +381 -0
- prefab_ui-0.1.0/tests/test_app.py +206 -0
- prefab_ui-0.1.0/tests/test_components.py +642 -0
- prefab_ui-0.1.0/tests/test_conditional.py +197 -0
- prefab_ui-0.1.0/tests/test_contract.py +256 -0
- prefab_ui-0.1.0/tests/test_define_use_state.py +238 -0
- prefab_ui-0.1.0/tests/test_form_model.py +326 -0
- prefab_ui-0.1.0/tests/test_renderer.py +51 -0
- prefab_ui-0.1.0/tests/test_responsive.py +151 -0
- prefab_ui-0.1.0/tests/test_simulator.py +434 -0
- prefab_ui-0.1.0/uv.lock +736 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs-build-pipeline
|
|
3
|
+
description: >
|
|
4
|
+
How the Prefab docs build pipeline works: the scripts in
|
|
5
|
+
docs/_preview-build/, what they do, and how to update them. Use when
|
|
6
|
+
modifying build scripts, debugging doc generation failures, adding new
|
|
7
|
+
doc source paths, updating CSS safelists, or troubleshooting preview
|
|
8
|
+
rendering.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
`prefab dev build-docs` runs the full pipeline. The scripts live in
|
|
14
|
+
`docs/_preview-build/` and execute in this order:
|
|
15
|
+
|
|
16
|
+
1. **build:embed** (`npm run build:embed` in `renderer/`) — builds
|
|
17
|
+
`renderer/src/embed.tsx` as a self-contained IIFE via Vite library mode.
|
|
18
|
+
Output: `docs/embed.js`. Mintlify auto-injects `.js` files from the docs
|
|
19
|
+
directory as `<script>` tags on every page, so the IIFE executes and
|
|
20
|
+
registers `window.__prefab = { mountPreview }`. The build inlines all
|
|
21
|
+
dependencies (React, Radix, Recharts, Tailwind CSS) into a single file.
|
|
22
|
+
Config: `renderer/vite.config.embed.ts`.
|
|
23
|
+
2. **render_previews.py** — finds `<ComponentPreview auto>` blocks in MDX
|
|
24
|
+
files, executes the Python code, serializes component trees to JSON,
|
|
25
|
+
rebuilds the CodeGroup interior (Python + JSON tabs) and the `json`
|
|
26
|
+
prop on the tag
|
|
27
|
+
3. **generate_content.py** — concatenates all rendered MDX into
|
|
28
|
+
`content.html` for Tailwind to scan
|
|
29
|
+
4. **Tailwind CSS build** — compiles `input.css` → scoped CSS using the
|
|
30
|
+
content.html and MDX files as sources
|
|
31
|
+
5. **scope_css.py** — rewrites the compiled CSS to scope under shadow DOM
|
|
32
|
+
(`:host` selectors)
|
|
33
|
+
6. **generate_playground_bundle.py** — builds the playground JSON bundle
|
|
34
|
+
7. **extract_examples.py** — extracts Python code blocks from MDX files
|
|
35
|
+
into `renderer/src/playground/examples.json`
|
|
36
|
+
8. **generate_protocol_pages.py** — introspects Pydantic models and writes
|
|
37
|
+
one MDX page per component/action into `docs/protocol/`
|
|
38
|
+
9. **generate_protocol_ref.py** — updates `## Protocol Reference` sections
|
|
39
|
+
in component MDX files with compact pseudocode JSON blocks from Pydantic schemas
|
|
40
|
+
|
|
41
|
+
## Source Paths
|
|
42
|
+
|
|
43
|
+
Scripts read MDX files from `docs/` (components, actions, patterns, etc.)
|
|
44
|
+
and write generated output to:
|
|
45
|
+
- `docs/embed.js` — self-contained renderer module (built from `renderer/src/embed.tsx`)
|
|
46
|
+
- `docs/protocol/` — autogenerated protocol reference pages
|
|
47
|
+
- `docs/_preview-build/content.html` — concatenated content for Tailwind
|
|
48
|
+
- `renderer/src/playground/examples.json` — playground examples
|
|
49
|
+
- `renderer/src/playground/bundle.json` — playground bundle
|
|
50
|
+
|
|
51
|
+
If the docs directory structure changes, update the path constants in each
|
|
52
|
+
script. Key locations:
|
|
53
|
+
- `render_previews.py`: `docs_dir = Path(__file__).resolve().parents[1]`
|
|
54
|
+
- `generate_protocol_pages.py`: `PROTOCOL_DIR = Path(__file__).resolve().parents[1] / "protocol"`
|
|
55
|
+
- `extract_examples.py`: `docs_dir = root / "docs"`
|
|
56
|
+
- `input.css`: `@source "../**/*.mdx"` glob
|
|
57
|
+
|
|
58
|
+
## CSS Safelist
|
|
59
|
+
|
|
60
|
+
`renderer/src/index.css` has `@source inline(...)` lines that safelist
|
|
61
|
+
Tailwind classes available via `cssClass`. When adding new layout utilities
|
|
62
|
+
or CSS class patterns to components, extend the appropriate safelist line.
|
|
63
|
+
|
|
64
|
+
Current safelists cover: gap, grid-cols, items-*, justify-*, place-items-*,
|
|
65
|
+
flex utilities, spacing, sizing, typography, colors, and more.
|
|
66
|
+
|
|
67
|
+
## Common Tasks
|
|
68
|
+
|
|
69
|
+
**Adding a new component:** After writing the Python model and renderer,
|
|
70
|
+
run `prefab dev build-docs` to generate the protocol page in `docs/protocol/`.
|
|
71
|
+
Then write the component doc in `docs/components/`.
|
|
72
|
+
|
|
73
|
+
**Changing doc directory structure:** Update path constants in all scripts
|
|
74
|
+
listed under Source Paths above, plus the `@source` glob in `input.css`.
|
|
75
|
+
|
|
76
|
+
**Debugging blank previews:** Usually means the Python code block in
|
|
77
|
+
`<ComponentPreview auto>` raised an error during `render_previews.py`.
|
|
78
|
+
Run the script directly to see the traceback:
|
|
79
|
+
```bash
|
|
80
|
+
uv run docs/_preview-build/render_previews.py
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Previews render but look wrong in browser:** Check whether the needed
|
|
84
|
+
Tailwind classes are safelisted in `renderer/src/index.css`. Dynamic
|
|
85
|
+
classes passed via `cssClass` must appear in a safelist to be included
|
|
86
|
+
in the compiled CSS.
|
|
87
|
+
|
|
88
|
+
## Embed Module Architecture
|
|
89
|
+
|
|
90
|
+
`docs/embed.js` is a self-contained IIFE built from
|
|
91
|
+
`renderer/src/embed.tsx` via Vite library mode
|
|
92
|
+
(`renderer/vite.config.embed.ts`). It registers
|
|
93
|
+
`window.__prefab = { mountPreview }` when executed.
|
|
94
|
+
|
|
95
|
+
Mintlify auto-injects any `.js` file in the docs directory as a `<script>`
|
|
96
|
+
tag on every page. This means the IIFE runs before React components mount,
|
|
97
|
+
so `window.__prefab.mountPreview` is available synchronously when
|
|
98
|
+
`ComponentPreview` needs it. Mintlify does NOT serve `.js` files as
|
|
99
|
+
fetchable static assets (dynamic `import()` fails), which is why the IIFE
|
|
100
|
+
+ auto-injection approach is used instead of ES module format.
|
|
101
|
+
|
|
102
|
+
All dependencies (React, Radix, Recharts, Tailwind CSS) are bundled
|
|
103
|
+
inline — no external imports. The CSS is inlined as a string via Vite's
|
|
104
|
+
`?inline` import and processed through the `tailwindShadowDom` plugin
|
|
105
|
+
(shared in `renderer/vite-plugins.ts`) to strip `@property` declarations
|
|
106
|
+
that don't work in shadow DOM.
|
|
107
|
+
|
|
108
|
+
The same library-mode build mechanism could serve air-gapped MCP app
|
|
109
|
+
distribution: ship the built bundle alongside an MCP server so the client
|
|
110
|
+
can render Prefab UI without a live server or CDN.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-component-docs
|
|
3
|
+
description: >
|
|
4
|
+
Conventions for authoring and maintaining Prefab component and action
|
|
5
|
+
documentation pages (docs/components/*.mdx, docs/actions/*.mdx). Use when
|
|
6
|
+
creating new component docs, updating existing docs after API changes,
|
|
7
|
+
adding examples, or editing Protocol/API Reference sections.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Page Structure
|
|
11
|
+
|
|
12
|
+
Every component doc follows this section order (h2 headers for TOC):
|
|
13
|
+
|
|
14
|
+
1. **Frontmatter** — `title`, `description`, `icon`
|
|
15
|
+
2. **Intro paragraph** — one sentence explaining what the component does
|
|
16
|
+
3. **## Basic Usage** — simplest working example, no extra options
|
|
17
|
+
4. **## [Feature sections]** — one h2 per notable feature/variant
|
|
18
|
+
5. **## API Reference** — Python parameters (Card/ParamField format)
|
|
19
|
+
6. **## Protocol Reference** — protocol link + inline JSON schema
|
|
20
|
+
|
|
21
|
+
The page title doesn't appear in the TOC, so "Basic Usage" is the user's
|
|
22
|
+
entry point. Never drop straight into a preview without a heading.
|
|
23
|
+
|
|
24
|
+
## Component Previews
|
|
25
|
+
|
|
26
|
+
Only edit the Python code block inside `<ComponentPreview auto>`. The JSON
|
|
27
|
+
prop, CodeGroup wrapper, and Protocol tab are all generated — never write
|
|
28
|
+
them by hand.
|
|
29
|
+
|
|
30
|
+
After editing previews, run `prefab dev build-docs` to regenerate.
|
|
31
|
+
|
|
32
|
+
**Code block titles:** Always give the Python block a title (e.g.,
|
|
33
|
+
`` ```python Python ``). A block without a title produces a zero-width tab in
|
|
34
|
+
the CodeGroup that users can't click. The title goes before other directives:
|
|
35
|
+
`` ```python Python {5} ``.
|
|
36
|
+
|
|
37
|
+
**Python code style inside previews:**
|
|
38
|
+
- Target ~80 character line width
|
|
39
|
+
- Use implicit string concatenation for long text
|
|
40
|
+
- Wrap function arguments when they don't fit on one line
|
|
41
|
+
- Include all necessary imports
|
|
42
|
+
|
|
43
|
+
## API Reference
|
|
44
|
+
|
|
45
|
+
Use Card + ParamField. Lead with the most important parameters:
|
|
46
|
+
|
|
47
|
+
```mdx
|
|
48
|
+
<Card icon="code" title="ComponentName Parameters">
|
|
49
|
+
<ParamField body="param_name" type="str" default="value">
|
|
50
|
+
Description of the parameter.
|
|
51
|
+
</ParamField>
|
|
52
|
+
</Card>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Protocol Reference
|
|
56
|
+
|
|
57
|
+
This section is **auto-generated** by `generate_protocol_ref.py` (run via
|
|
58
|
+
`prefab dev build-docs`). Do not edit it by hand — it will be overwritten.
|
|
59
|
+
|
|
60
|
+
The generator reads `<Card icon="code" title="X Parameters">` cards from
|
|
61
|
+
the API Reference section, introspects the corresponding Pydantic model,
|
|
62
|
+
and produces compact pseudocode JSON blocks with links to the full protocol
|
|
63
|
+
pages. Components whose Card titles don't end in "Parameters" (like
|
|
64
|
+
If/Elif/Else) are skipped, allowing hand-written Protocol Reference
|
|
65
|
+
sections for special cases.
|
|
66
|
+
|
|
67
|
+
Inline JSON schema conventions (for reference / hand-written exceptions):
|
|
68
|
+
- Append `?` to optional property names
|
|
69
|
+
- Show default values inline for bools and enums
|
|
70
|
+
- Use `(required)` after the type for required props
|
|
71
|
+
- Use `[Component]` for children arrays
|
|
72
|
+
- Protocol slug is kebab-case of wire type (e.g., `AreaChart` → `area-chart`)
|
|
73
|
+
|
|
74
|
+
## Content Rules
|
|
75
|
+
|
|
76
|
+
- Use Hitchhiker's Guide to the Galaxy references for placeholder content.
|
|
77
|
+
Never use "Lorem ipsum" or marketing copy about the component itself.
|
|
78
|
+
- Do NOT add per-field "Supports interpolation" callouts. Interpolation is
|
|
79
|
+
universal and documented centrally at `/patterns/interpolation`.
|
|
80
|
+
|
|
81
|
+
## Files to Keep Aligned
|
|
82
|
+
|
|
83
|
+
When the Python API or wire protocol changes, update all of these:
|
|
84
|
+
|
|
85
|
+
- `src/prefab_ui/components/<name>.py` — Python model (source of truth)
|
|
86
|
+
- `renderer/src/schemas/<name>.ts` — Zod schema
|
|
87
|
+
- `renderer/src/components/` — renderer
|
|
88
|
+
- `docs/components/<name>.mdx` — documentation
|
|
89
|
+
- `schemas/fixtures/components/<Name>.json` — test fixtures
|
|
90
|
+
- `skills/generative-prefab-ui/` — distributable skill for wire protocol generation
|
|
91
|
+
- `skills/writing-prefab-python/` — distributable skill for Python DSL usage
|
|
92
|
+
|
|
93
|
+
After any change: `prefab dev build-docs` then `uv run pytest tests/ -x`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: "Run Pytest"
|
|
2
|
+
description: "Run pytest with appropriate flags for the platform"
|
|
3
|
+
|
|
4
|
+
runs:
|
|
5
|
+
using: "composite"
|
|
6
|
+
steps:
|
|
7
|
+
- name: Run pytest
|
|
8
|
+
shell: bash
|
|
9
|
+
run: |
|
|
10
|
+
TIMEOUT="5"
|
|
11
|
+
MAX_PROCS="4"
|
|
12
|
+
|
|
13
|
+
PARALLEL_FLAGS="--numprocesses auto --maxprocesses $MAX_PROCS --dist worksteal"
|
|
14
|
+
|
|
15
|
+
uv run --no-sync pytest \
|
|
16
|
+
--timeout=$TIMEOUT \
|
|
17
|
+
$PARALLEL_FLAGS \
|
|
18
|
+
tests
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: "Setup UV Environment"
|
|
2
|
+
description: "Install uv and dependencies (requires checkout first)"
|
|
3
|
+
|
|
4
|
+
inputs:
|
|
5
|
+
python-version:
|
|
6
|
+
description: "Python version to use"
|
|
7
|
+
required: false
|
|
8
|
+
default: "3.10"
|
|
9
|
+
resolution:
|
|
10
|
+
description: "Dependency resolution: locked, upgrade, or lowest-direct"
|
|
11
|
+
required: false
|
|
12
|
+
default: "locked"
|
|
13
|
+
|
|
14
|
+
runs:
|
|
15
|
+
using: "composite"
|
|
16
|
+
steps:
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v7
|
|
19
|
+
with:
|
|
20
|
+
enable-cache: true
|
|
21
|
+
cache-dependency-glob: "uv.lock"
|
|
22
|
+
python-version: ${{ inputs.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
shell: bash
|
|
26
|
+
run: |
|
|
27
|
+
if [ "${{ inputs.resolution }}" == "locked" ]; then
|
|
28
|
+
uv sync --locked
|
|
29
|
+
elif [ "${{ inputs.resolution }}" == "upgrade" ]; then
|
|
30
|
+
uv sync --upgrade
|
|
31
|
+
else
|
|
32
|
+
uv sync --resolution ${{ inputs.resolution }}
|
|
33
|
+
fi
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Build renderer
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
paths:
|
|
6
|
+
- "renderer/**"
|
|
7
|
+
- ".github/workflows/build-renderer.yml"
|
|
8
|
+
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
name: "Build docs/renderer.js for Mintlify"
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
timeout-minutes: 5
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
with:
|
|
23
|
+
ref: ${{ github.head_ref }}
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: "22"
|
|
28
|
+
cache: "npm"
|
|
29
|
+
cache-dependency-path: renderer/package-lock.json
|
|
30
|
+
|
|
31
|
+
- run: npm ci
|
|
32
|
+
working-directory: renderer
|
|
33
|
+
|
|
34
|
+
- run: npm run build:renderer
|
|
35
|
+
working-directory: renderer
|
|
36
|
+
|
|
37
|
+
- run: cp renderer/dist/renderer.js docs/renderer.js
|
|
38
|
+
|
|
39
|
+
- name: Commit updated renderer.js
|
|
40
|
+
run: |
|
|
41
|
+
git config user.name "github-actions[bot]"
|
|
42
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
43
|
+
git add docs/renderer.js
|
|
44
|
+
git diff --cached --quiet && echo "No changes" || git commit -m "Rebuild docs/renderer.js" && git push
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Publishes @prefecthq/prefab-ui to npm on release.
|
|
2
|
+
#
|
|
3
|
+
# Currently Mintlify loads renderer.js from the repo (committed by
|
|
4
|
+
# build-renderer.yml on PR). Once we're cutting regular releases, we
|
|
5
|
+
# should switch published docs to load from the npm CDN instead and
|
|
6
|
+
# stop committing renderer.js to git. The CDN fallback in
|
|
7
|
+
# component-preview.mdx already supports this — just remove
|
|
8
|
+
# docs/renderer.js from the repo and gitignore it.
|
|
9
|
+
name: Publish renderer to npm
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
id-token: write
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
publish:
|
|
22
|
+
name: "Build & publish @prefecthq/prefab-ui"
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
timeout-minutes: 5
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v6
|
|
28
|
+
|
|
29
|
+
- uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: "24"
|
|
32
|
+
cache: "npm"
|
|
33
|
+
cache-dependency-path: renderer/package-lock.json
|
|
34
|
+
registry-url: "https://registry.npmjs.org"
|
|
35
|
+
|
|
36
|
+
- name: Set npm version from git tag
|
|
37
|
+
working-directory: renderer
|
|
38
|
+
run: |
|
|
39
|
+
# Strip PEP 440 pre-release suffix: v0.1.0a1 → 0.1.0
|
|
40
|
+
RAW="${{ github.ref_name }}"
|
|
41
|
+
VERSION="${RAW#v}"
|
|
42
|
+
VERSION=$(echo "$VERSION" | sed -E 's/(a|b|rc)[0-9]+$//')
|
|
43
|
+
npm version "$VERSION" --no-git-tag-version
|
|
44
|
+
|
|
45
|
+
- run: npm ci
|
|
46
|
+
working-directory: renderer
|
|
47
|
+
|
|
48
|
+
- run: npm run build:publish
|
|
49
|
+
working-directory: renderer
|
|
50
|
+
|
|
51
|
+
- run: npm publish --access public --tag latest
|
|
52
|
+
working-directory: renderer
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
name: Upload to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v6
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: "Install uv"
|
|
21
|
+
uses: astral-sh/setup-uv@v7
|
|
22
|
+
|
|
23
|
+
- name: Build
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Publish to PyPi
|
|
27
|
+
run: uv publish -v dist/*
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Renderer Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
paths:
|
|
7
|
+
- "renderer/**"
|
|
8
|
+
- ".github/workflows/run-renderer-tests.yml"
|
|
9
|
+
|
|
10
|
+
pull_request:
|
|
11
|
+
paths:
|
|
12
|
+
- "renderer/**"
|
|
13
|
+
- ".github/workflows/run-renderer-tests.yml"
|
|
14
|
+
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
test:
|
|
22
|
+
name: "Renderer unit tests"
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
timeout-minutes: 5
|
|
25
|
+
|
|
26
|
+
defaults:
|
|
27
|
+
run:
|
|
28
|
+
working-directory: renderer
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v6
|
|
32
|
+
|
|
33
|
+
- uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version: "22"
|
|
36
|
+
cache: "npm"
|
|
37
|
+
cache-dependency-path: renderer/package-lock.json
|
|
38
|
+
|
|
39
|
+
- run: npm ci
|
|
40
|
+
- run: npm test
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Run static analysis
|
|
2
|
+
|
|
3
|
+
env:
|
|
4
|
+
PY_COLORS: 1
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: ["main"]
|
|
9
|
+
paths:
|
|
10
|
+
- "src/**"
|
|
11
|
+
- "tests/**"
|
|
12
|
+
- "uv.lock"
|
|
13
|
+
- "pyproject.toml"
|
|
14
|
+
- ".github/workflows/**"
|
|
15
|
+
|
|
16
|
+
pull_request:
|
|
17
|
+
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
static_analysis:
|
|
25
|
+
timeout-minutes: 2
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v6
|
|
30
|
+
|
|
31
|
+
- name: Setup uv
|
|
32
|
+
uses: ./.github/actions/setup-uv
|
|
33
|
+
with:
|
|
34
|
+
resolution: locked
|
|
35
|
+
|
|
36
|
+
- name: Install renderer dependencies
|
|
37
|
+
run: cd renderer && npm ci
|
|
38
|
+
|
|
39
|
+
- name: Run prek
|
|
40
|
+
uses: j178/prek-action@v1
|
|
41
|
+
env:
|
|
42
|
+
SKIP: no-commit-to-branch
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
env:
|
|
4
|
+
PY_COLORS: 1
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: ["main"]
|
|
9
|
+
paths:
|
|
10
|
+
- "src/**"
|
|
11
|
+
- "tests/**"
|
|
12
|
+
- "uv.lock"
|
|
13
|
+
- "pyproject.toml"
|
|
14
|
+
- ".github/workflows/**"
|
|
15
|
+
|
|
16
|
+
pull_request:
|
|
17
|
+
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
run_tests:
|
|
25
|
+
name: "Tests: Python ${{ matrix.python-version }} on ${{ matrix.os }}"
|
|
26
|
+
runs-on: ${{ matrix.os }}
|
|
27
|
+
strategy:
|
|
28
|
+
matrix:
|
|
29
|
+
os: [ubuntu-latest, windows-latest]
|
|
30
|
+
python-version: ["3.10"]
|
|
31
|
+
include:
|
|
32
|
+
- os: ubuntu-latest
|
|
33
|
+
python-version: "3.13"
|
|
34
|
+
fail-fast: false
|
|
35
|
+
timeout-minutes: 10
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v6
|
|
39
|
+
|
|
40
|
+
- name: Setup uv
|
|
41
|
+
uses: ./.github/actions/setup-uv
|
|
42
|
+
with:
|
|
43
|
+
python-version: ${{ matrix.python-version }}
|
|
44
|
+
resolution: locked
|
|
45
|
+
|
|
46
|
+
- name: Run tests
|
|
47
|
+
uses: ./.github/actions/run-pytest
|
|
48
|
+
|
|
49
|
+
run_tests_lowest_direct:
|
|
50
|
+
name: "Tests with lowest-direct dependencies"
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
timeout-minutes: 10
|
|
53
|
+
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v6
|
|
56
|
+
|
|
57
|
+
- name: Setup uv (lowest-direct)
|
|
58
|
+
uses: ./.github/actions/setup-uv
|
|
59
|
+
with:
|
|
60
|
+
resolution: lowest-direct
|
|
61
|
+
|
|
62
|
+
- name: Run tests
|
|
63
|
+
uses: ./.github/actions/run-pytest
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.eggs/
|
|
8
|
+
*.egg
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
.env
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.ruff_cache/
|
|
14
|
+
.ty/
|
|
15
|
+
*.so
|
|
16
|
+
|
|
17
|
+
# Node / renderer
|
|
18
|
+
node_modules/
|
|
19
|
+
renderer/dist/
|
|
20
|
+
|
|
21
|
+
# IDE
|
|
22
|
+
.idea/
|
|
23
|
+
.vscode/
|
|
24
|
+
*.swp
|
|
25
|
+
*.swo
|
|
26
|
+
|
|
27
|
+
# OS
|
|
28
|
+
.DS_Store
|
|
29
|
+
Thumbs.db
|
|
30
|
+
|
|
31
|
+
# Plans (internal strategy docs)
|
|
32
|
+
plans/
|
|
33
|
+
|
|
34
|
+
# Caches
|
|
35
|
+
.loq_cache
|
|
36
|
+
|
|
37
|
+
# Build artifacts (except renderer.js and playground-app.js — committed for Mintlify)
|
|
38
|
+
docs/embed.js
|
|
39
|
+
docs/css/preview.css
|
|
40
|
+
docs/playground.js
|
|
41
|
+
docs/component-bundle.js
|
|
42
|
+
docs/_preview-build/content.html
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
fail_fast: false
|
|
2
|
+
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
5
|
+
rev: v0.24.1
|
|
6
|
+
hooks:
|
|
7
|
+
- id: validate-pyproject
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
10
|
+
rev: v3.1.0
|
|
11
|
+
hooks:
|
|
12
|
+
- id: prettier
|
|
13
|
+
types_or: [yaml, json5, javascript, tsx, ts, css]
|
|
14
|
+
exclude: ^(renderer/src/ui/|docs/(embed|renderer)\.js)
|
|
15
|
+
|
|
16
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
17
|
+
rev: v0.15.0
|
|
18
|
+
hooks:
|
|
19
|
+
- id: ruff-check
|
|
20
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
21
|
+
- id: ruff-format
|
|
22
|
+
|
|
23
|
+
- repo: local
|
|
24
|
+
hooks:
|
|
25
|
+
- id: ty
|
|
26
|
+
name: ty check
|
|
27
|
+
entry: uv run --isolated ty check
|
|
28
|
+
language: system
|
|
29
|
+
types: [python]
|
|
30
|
+
files: ^src/|^tests/
|
|
31
|
+
pass_filenames: false
|
|
32
|
+
require_serial: true
|
|
33
|
+
|
|
34
|
+
- id: tsc
|
|
35
|
+
name: tsc (renderer type check)
|
|
36
|
+
entry: bash -c 'cd renderer && npx tsc --noEmit'
|
|
37
|
+
language: system
|
|
38
|
+
files: ^renderer/.*\.(ts|tsx)$
|
|
39
|
+
pass_filenames: false
|
|
40
|
+
require_serial: true
|
|
41
|
+
|
|
42
|
+
- id: loq
|
|
43
|
+
name: loq (file size limits)
|
|
44
|
+
entry: uv run loq
|
|
45
|
+
language: system
|
|
46
|
+
pass_filenames: false
|
|
47
|
+
|
|
48
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
49
|
+
rev: v6.0.0
|
|
50
|
+
hooks:
|
|
51
|
+
- id: no-commit-to-branch
|
|
52
|
+
name: prevent commits to main
|
|
53
|
+
args: [--branch, main]
|
|
54
|
+
|
|
55
|
+
- repo: https://github.com/codespell-project/codespell
|
|
56
|
+
rev: v2.4.1
|
|
57
|
+
hooks:
|
|
58
|
+
- id: codespell
|
|
59
|
+
exclude: ^(docs/(embed|renderer|playground-app)\.js|src/prefab_ui/renderer/app\.html)$
|
|
60
|
+
additional_dependencies:
|
|
61
|
+
- tomli
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Prefab
|
|
2
|
+
|
|
3
|
+
## Git Hooks
|
|
4
|
+
|
|
5
|
+
Pre-commit hooks are run via `prek`, not `pre-commit`. Run `prek` before committing.
|
|
6
|
+
|
|
7
|
+
## Component Architecture
|
|
8
|
+
|
|
9
|
+
**Pure-CSS kwargs resolve in Python, not the renderer.** When a Python component has a convenience kwarg that maps directly to CSS (like `spacing=4` → `my-4`), resolve it in `model_post_init` by compiling to `css_class` and marking the field `exclude=True`. The renderer should only see `cssClass` — it never needs to know about the kwarg. See `Row.gap`/`Row.align` and `Separator.spacing` for examples.
|
|
10
|
+
|
|
11
|
+
## Component Documentation
|
|
12
|
+
|
|
13
|
+
Doc conventions are encoded as agent skills in `.claude/skills/`:
|
|
14
|
+
- `writing-component-docs` — page structure, preview format, API/Protocol reference conventions
|
|
15
|
+
- `docs-build-pipeline` — how the build scripts work and when to update them
|
|
16
|
+
|
|
17
|
+
After any changes, regenerate docs and schemas:
|
|
18
|
+
```bash
|
|
19
|
+
prefab dev build-docs
|
|
20
|
+
```
|