@luci-dev/skills 0.0.0-stage → 0.5.0
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/dist/benchmark.d.ts +48 -0
- package/dist/benchmark.d.ts.map +1 -0
- package/dist/benchmark.js +84 -0
- package/dist/benchmark.js.map +1 -0
- package/dist/discovery.d.ts +105 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +271 -0
- package/dist/discovery.js.map +1 -0
- package/dist/drafts.d.ts +20 -0
- package/dist/drafts.d.ts.map +1 -0
- package/dist/drafts.js +57 -0
- package/dist/drafts.js.map +1 -0
- package/dist/github.d.ts +49 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +93 -0
- package/dist/github.js.map +1 -0
- package/dist/import.d.ts +80 -0
- package/dist/import.d.ts.map +1 -0
- package/dist/import.js +286 -0
- package/dist/import.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/licenses.d.ts +30 -0
- package/dist/licenses.d.ts.map +1 -0
- package/dist/licenses.js +116 -0
- package/dist/licenses.js.map +1 -0
- package/dist/linter.d.ts +35 -0
- package/dist/linter.d.ts.map +1 -0
- package/dist/linter.js +262 -0
- package/dist/linter.js.map +1 -0
- package/dist/lss.d.ts +74 -0
- package/dist/lss.d.ts.map +1 -0
- package/dist/lss.js +273 -0
- package/dist/lss.js.map +1 -0
- package/dist/orchestrator.d.ts +164 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +370 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/packs.d.ts +50 -0
- package/dist/packs.d.ts.map +1 -0
- package/dist/packs.js +166 -0
- package/dist/packs.js.map +1 -0
- package/dist/preferences.d.ts +18 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +57 -0
- package/dist/preferences.js.map +1 -0
- package/dist/project.d.ts +45 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +183 -0
- package/dist/project.js.map +1 -0
- package/dist/rankability.d.ts +51 -0
- package/dist/rankability.d.ts.map +1 -0
- package/dist/rankability.js +217 -0
- package/dist/rankability.js.map +1 -0
- package/dist/registry.d.ts +82 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +300 -0
- package/dist/registry.js.map +1 -0
- package/dist/trust.d.ts +13 -0
- package/dist/trust.d.ts.map +1 -0
- package/dist/trust.js +41 -0
- package/dist/trust.js.map +1 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/library/3d/threejs/LICENSE.txt +21 -0
- package/library/3d/threejs/NOTICE.md +7 -0
- package/library/3d/threejs/SKILL.md +102 -0
- package/library/3d/threejs/luci.json +39 -0
- package/library/accessibility/accessibility-baseline/SKILL.md +51 -0
- package/library/accessibility/accessibility-baseline/luci.json +33 -0
- package/library/accessibility/fixing-accessibility/NOTICE.md +6 -0
- package/library/accessibility/fixing-accessibility/SKILL.md +141 -0
- package/library/accessibility/fixing-accessibility/luci.json +36 -0
- package/library/animation-motion/animation-systems/LICENSE.txt +21 -0
- package/library/animation-motion/animation-systems/NOTICE.md +7 -0
- package/library/animation-motion/animation-systems/SKILL.md +192 -0
- package/library/animation-motion/animation-systems/luci.json +32 -0
- package/library/animation-motion/animejs/SKILL.md +64 -0
- package/library/animation-motion/animejs/luci.json +12 -0
- package/library/animation-motion/motion-dev/SKILL.md +69 -0
- package/library/animation-motion/motion-dev/luci.json +13 -0
- package/library/animation-motion/react-view-transitions/AGENTS.md +1380 -0
- package/library/animation-motion/react-view-transitions/NOTICE.md +6 -0
- package/library/animation-motion/react-view-transitions/README.md +44 -0
- package/library/animation-motion/react-view-transitions/SKILL.md +334 -0
- package/library/animation-motion/react-view-transitions/luci.json +40 -0
- package/library/animation-motion/react-view-transitions/metadata.json +12 -0
- package/library/animation-motion/react-view-transitions/references/css-recipes.md +312 -0
- package/library/animation-motion/react-view-transitions/references/implementation.md +170 -0
- package/library/animation-motion/react-view-transitions/references/nextjs.md +233 -0
- package/library/animation-motion/react-view-transitions/references/patterns.md +274 -0
- package/library/animation-motion/react-view-transitions/references/troubleshooting.md +47 -0
- package/library/code-quality/code-review/NOTICE.md +6 -0
- package/library/code-quality/code-review/SKILL.md +94 -0
- package/library/code-quality/code-review/agents/openai.yaml +3 -0
- package/library/code-quality/code-review/luci.json +33 -0
- package/library/components/company-logos/LICENSE.txt +21 -0
- package/library/components/company-logos/NOTICE.md +7 -0
- package/library/components/company-logos/SKILL.md +27 -0
- package/library/components/company-logos/luci.json +38 -0
- package/library/components/container-lines/LICENSE.txt +21 -0
- package/library/components/container-lines/NOTICE.md +7 -0
- package/library/components/container-lines/SKILL.md +124 -0
- package/library/components/container-lines/luci.json +48 -0
- package/library/design-systems/build-design-system/NOTICE.md +6 -0
- package/library/design-systems/build-design-system/SKILL.md +78 -0
- package/library/design-systems/build-design-system/luci.json +29 -0
- package/library/design-systems/build-design-system/references/components.md +46 -0
- package/library/design-systems/build-design-system/references/glossary.md +77 -0
- package/library/design-systems/build-design-system/references/taste.md +37 -0
- package/library/design-systems/build-design-system/references/tokens.md +59 -0
- package/library/design-systems/build-design-system/references/traps.md +128 -0
- package/library/design-systems/build-design-system/scripts/capture-guard.mjs +470 -0
- package/library/design-systems/build-design-system/scripts/capture.mjs +355 -0
- package/library/design-systems/build-design-system/scripts/check-system.mjs +1883 -0
- package/library/design-systems/build-design-system/scripts/find-chromium.mjs +137 -0
- package/library/design-systems/build-design-system/scripts/oklch.mjs +221 -0
- package/library/design-systems/build-design-system/scripts/pixdiff.mjs +186 -0
- package/library/design-systems/component-docs/NOTICE.md +6 -0
- package/library/design-systems/component-docs/SKILL.md +50 -0
- package/library/design-systems/component-docs/luci.json +30 -0
- package/library/design-systems/component-docs/references/doc-format.md +85 -0
- package/library/design-systems/create-design-md/NOTICE.md +6 -0
- package/library/design-systems/create-design-md/SKILL.md +259 -0
- package/library/design-systems/create-design-md/luci.json +38 -0
- package/library/design-systems/design-system-boss/NOTICE.md +6 -0
- package/library/design-systems/design-system-boss/SKILL.md +58 -0
- package/library/design-systems/design-system-boss/luci.json +29 -0
- package/library/design-systems/design-system-boss/playbooks/build.md +10 -0
- package/library/design-systems/design-system-boss/playbooks/component.md +9 -0
- package/library/design-systems/design-system-boss/playbooks/migrate.md +11 -0
- package/library/design-systems/design-system-boss/playbooks/review.md +9 -0
- package/library/design-systems/migrate-design-system/NOTICE.md +6 -0
- package/library/design-systems/migrate-design-system/SKILL.md +62 -0
- package/library/design-systems/migrate-design-system/luci.json +33 -0
- package/library/design-systems/migrate-design-system/references/correct.md +37 -0
- package/library/design-systems/migrate-design-system/references/lessons.md +69 -0
- package/library/design-systems/migrate-design-system/references/parity.md +44 -0
- package/library/design-systems/migrate-design-system/references/running-many-agents.md +52 -0
- package/library/design-systems/migrate-design-system/scripts/bodies-check.mjs +215 -0
- package/library/design-systems/migrate-design-system/scripts/land.mjs +433 -0
- package/library/design-systems/migrate-design-system/scripts/legacy.mjs +283 -0
- package/library/design-systems/migrate-design-system/scripts/parity.mjs +173 -0
- package/library/design-systems/token-mapping/NOTICE.md +6 -0
- package/library/design-systems/token-mapping/SKILL.md +46 -0
- package/library/design-systems/token-mapping/luci.json +25 -0
- package/library/design-systems/token-mapping/references/mapping-rules.md +54 -0
- package/library/design-systems/ui-review/NOTICE.md +6 -0
- package/library/design-systems/ui-review/SKILL.md +53 -0
- package/library/design-systems/ui-review/luci.json +29 -0
- package/library/design-systems/ui-review/references/criteria.md +49 -0
- package/library/frontend/composition-patterns/AGENTS.md +946 -0
- package/library/frontend/composition-patterns/NOTICE.md +6 -0
- package/library/frontend/composition-patterns/README.md +60 -0
- package/library/frontend/composition-patterns/SKILL.md +86 -0
- package/library/frontend/composition-patterns/luci.json +33 -0
- package/library/frontend/composition-patterns/metadata.json +11 -0
- package/library/frontend/composition-patterns/rules/_sections.md +29 -0
- package/library/frontend/composition-patterns/rules/_template.md +24 -0
- package/library/frontend/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/library/frontend/composition-patterns/rules/architecture-compound-components.md +112 -0
- package/library/frontend/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/library/frontend/composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/library/frontend/composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/library/frontend/composition-patterns/rules/state-context-interface.md +191 -0
- package/library/frontend/composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/library/frontend/composition-patterns/rules/state-lift-state.md +125 -0
- package/library/frontend/design-mobile-apps/NOTICE.md +6 -0
- package/library/frontend/design-mobile-apps/SKILL.md +121 -0
- package/library/frontend/design-mobile-apps/designing.md +56 -0
- package/library/frontend/design-mobile-apps/endpoints.md +362 -0
- package/library/frontend/design-mobile-apps/implementing.md +213 -0
- package/library/frontend/design-mobile-apps/luci.json +31 -0
- package/library/frontend/design-mobile-apps/styling/nativewind.md +57 -0
- package/library/frontend/design-mobile-apps/styling/stylesheet.md +28 -0
- package/library/frontend/design-mobile-apps/styling/uniwind.md +38 -0
- package/library/frontend/frontend-design/LICENSE.txt +202 -0
- package/library/frontend/frontend-design/NOTICE.md +6 -0
- package/library/frontend/frontend-design/SKILL.md +81 -0
- package/library/frontend/frontend-design/luci.json +43 -0
- package/library/frontend/react-native-skills/AGENTS.md +2897 -0
- package/library/frontend/react-native-skills/NOTICE.md +6 -0
- package/library/frontend/react-native-skills/README.md +165 -0
- package/library/frontend/react-native-skills/SKILL.md +119 -0
- package/library/frontend/react-native-skills/luci.json +33 -0
- package/library/frontend/react-native-skills/metadata.json +16 -0
- package/library/frontend/react-native-skills/rules/_sections.md +86 -0
- package/library/frontend/react-native-skills/rules/_template.md +28 -0
- package/library/frontend/react-native-skills/rules/animation-derived-value.md +53 -0
- package/library/frontend/react-native-skills/rules/animation-gesture-detector-press.md +95 -0
- package/library/frontend/react-native-skills/rules/animation-gpu-properties.md +65 -0
- package/library/frontend/react-native-skills/rules/design-system-compound-components.md +66 -0
- package/library/frontend/react-native-skills/rules/fonts-config-plugin.md +71 -0
- package/library/frontend/react-native-skills/rules/imports-design-system-folder.md +68 -0
- package/library/frontend/react-native-skills/rules/js-hoist-intl.md +61 -0
- package/library/frontend/react-native-skills/rules/list-performance-callbacks.md +44 -0
- package/library/frontend/react-native-skills/rules/list-performance-function-references.md +132 -0
- package/library/frontend/react-native-skills/rules/list-performance-images.md +53 -0
- package/library/frontend/react-native-skills/rules/list-performance-inline-objects.md +97 -0
- package/library/frontend/react-native-skills/rules/list-performance-item-expensive.md +94 -0
- package/library/frontend/react-native-skills/rules/list-performance-item-memo.md +82 -0
- package/library/frontend/react-native-skills/rules/list-performance-item-types.md +104 -0
- package/library/frontend/react-native-skills/rules/list-performance-virtualize.md +67 -0
- package/library/frontend/react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
- package/library/frontend/react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
- package/library/frontend/react-native-skills/rules/navigation-native-navigators.md +188 -0
- package/library/frontend/react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
- package/library/frontend/react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
- package/library/frontend/react-native-skills/rules/react-state-dispatcher.md +91 -0
- package/library/frontend/react-native-skills/rules/react-state-fallback.md +56 -0
- package/library/frontend/react-native-skills/rules/react-state-minimize.md +65 -0
- package/library/frontend/react-native-skills/rules/rendering-no-falsy-and.md +74 -0
- package/library/frontend/react-native-skills/rules/rendering-text-in-text-component.md +36 -0
- package/library/frontend/react-native-skills/rules/scroll-position-no-state.md +82 -0
- package/library/frontend/react-native-skills/rules/state-ground-truth.md +80 -0
- package/library/frontend/react-native-skills/rules/ui-expo-image.md +66 -0
- package/library/frontend/react-native-skills/rules/ui-image-gallery.md +104 -0
- package/library/frontend/react-native-skills/rules/ui-measure-views.md +78 -0
- package/library/frontend/react-native-skills/rules/ui-menus.md +174 -0
- package/library/frontend/react-native-skills/rules/ui-native-modals.md +77 -0
- package/library/frontend/react-native-skills/rules/ui-pressable.md +61 -0
- package/library/frontend/react-native-skills/rules/ui-safe-area-scroll.md +65 -0
- package/library/frontend/react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
- package/library/frontend/react-native-skills/rules/ui-styling.md +87 -0
- package/library/frontend/tailwindcss/LICENSE.txt +21 -0
- package/library/frontend/tailwindcss/NOTICE.md +7 -0
- package/library/frontend/tailwindcss/SKILL.md +83 -0
- package/library/frontend/tailwindcss/luci.json +39 -0
- package/library/frontend-frameworks/react-best-practices/NOTICE.md +6 -0
- package/library/frontend-frameworks/react-best-practices/SKILL.md +151 -0
- package/library/frontend-frameworks/react-best-practices/luci.json +39 -0
- package/library/general/algorithmic-art/LICENSE.txt +202 -0
- package/library/general/algorithmic-art/NOTICE.md +6 -0
- package/library/general/algorithmic-art/SKILL.md +409 -0
- package/library/general/algorithmic-art/luci.json +27 -0
- package/library/general/algorithmic-art/templates/generator_template.js +223 -0
- package/library/general/algorithmic-art/templates/viewer.html +599 -0
- package/library/general/canvas-design/LICENSE.txt +202 -0
- package/library/general/canvas-design/NOTICE.md +6 -0
- package/library/general/canvas-design/SKILL.md +134 -0
- package/library/general/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/library/general/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/library/general/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/library/general/canvas-design/luci.json +29 -0
- package/library/index.json +2507 -0
- package/library/interaction/animation-on-scroll/LICENSE.txt +21 -0
- package/library/interaction/animation-on-scroll/NOTICE.md +7 -0
- package/library/interaction/animation-on-scroll/SKILL.md +115 -0
- package/library/interaction/animation-on-scroll/luci.json +38 -0
- package/library/micro-interactions/masked-reveal/LICENSE.txt +21 -0
- package/library/micro-interactions/masked-reveal/NOTICE.md +7 -0
- package/library/micro-interactions/masked-reveal/SKILL.md +187 -0
- package/library/micro-interactions/masked-reveal/luci.json +63 -0
- package/library/micro-interactions/micro-interaction/NOTICE.md +6 -0
- package/library/micro-interactions/micro-interaction/SKILL.md +177 -0
- package/library/micro-interactions/micro-interaction/luci.json +52 -0
- package/library/micro-interactions/micro-interaction/references/css-recipes.md +142 -0
- package/library/micro-interactions/micro-interaction/references/framer-motion-recipes.md +187 -0
- package/library/micro-interactions/micro-interaction/scripts/README.md +42 -0
- package/library/micro-interactions/micro-interaction/scripts/contact-sheet.sh +17 -0
- package/library/micro-interactions/micro-interaction/scripts/seek-shot.sh +21 -0
- package/library/performance/fixing-motion-performance/NOTICE.md +6 -0
- package/library/performance/fixing-motion-performance/SKILL.md +156 -0
- package/library/performance/fixing-motion-performance/luci.json +30 -0
- package/library/seo/fixing-metadata/NOTICE.md +6 -0
- package/library/seo/fixing-metadata/SKILL.md +111 -0
- package/library/seo/fixing-metadata/luci.json +36 -0
- package/library/shadcn-ui/migrate-radix-to-base/NOTICE.md +6 -0
- package/library/shadcn-ui/migrate-radix-to-base/SKILL.md +178 -0
- package/library/shadcn-ui/migrate-radix-to-base/class-mapping.md +62 -0
- package/library/shadcn-ui/migrate-radix-to-base/consumer-props.md +58 -0
- package/library/shadcn-ui/migrate-radix-to-base/disclosure.md +353 -0
- package/library/shadcn-ui/migrate-radix-to-base/display-misc.md +410 -0
- package/library/shadcn-ui/migrate-radix-to-base/form-controls.md +390 -0
- package/library/shadcn-ui/migrate-radix-to-base/luci.json +33 -0
- package/library/shadcn-ui/migrate-radix-to-base/menus.md +409 -0
- package/library/shadcn-ui/migrate-radix-to-base/overlays.md +459 -0
- package/library/shadcn-ui/migrate-radix-to-base/universal-patterns.md +286 -0
- package/library/shadcn-ui/migrate-radix-to-base/wrapper-shapes.md +110 -0
- package/library/shadcn-ui/shadcn/NOTICE.md +6 -0
- package/library/shadcn-ui/shadcn/SKILL.md +187 -0
- package/library/shadcn-ui/shadcn/agents/openai.yml +5 -0
- package/library/shadcn-ui/shadcn/assets/shadcn-small.png +0 -0
- package/library/shadcn-ui/shadcn/assets/shadcn.png +0 -0
- package/library/shadcn-ui/shadcn/assets/showcase/color-pair.tsx +126 -0
- package/library/shadcn-ui/shadcn/assets/showcase/preview-states.css +14 -0
- package/library/shadcn-ui/shadcn/assets/showcase/state-matrix.tsx +72 -0
- package/library/shadcn-ui/shadcn/cli.md +290 -0
- package/library/shadcn-ui/shadcn/customization.md +211 -0
- package/library/shadcn-ui/shadcn/design-system-page.md +268 -0
- package/library/shadcn-ui/shadcn/design-system.md +386 -0
- package/library/shadcn-ui/shadcn/evals/evals.json +126 -0
- package/library/shadcn-ui/shadcn/luci.json +34 -0
- package/library/shadcn-ui/shadcn/mcp.md +105 -0
- package/library/shadcn-ui/shadcn/references/updating-components.md +91 -0
- package/library/shadcn-ui/shadcn/references/workflow.md +31 -0
- package/library/shadcn-ui/shadcn/registry.md +277 -0
- package/library/shadcn-ui/shadcn/rules/base-vs-radix.md +306 -0
- package/library/shadcn-ui/shadcn/rules/chat.md +507 -0
- package/library/shadcn-ui/shadcn/rules/composition.md +213 -0
- package/library/shadcn-ui/shadcn/rules/forms.md +192 -0
- package/library/shadcn-ui/shadcn/rules/icons.md +101 -0
- package/library/shadcn-ui/shadcn/rules/styling.md +185 -0
- package/library/shadcn-ui/shadcn/scripts/showcase-coverage.mjs +53 -0
- package/library/systems/baseline-ui/NOTICE.md +6 -0
- package/library/systems/baseline-ui/SKILL.md +90 -0
- package/library/systems/baseline-ui/luci.json +35 -0
- package/library/testing/tdd/NOTICE.md +6 -0
- package/library/testing/tdd/SKILL.md +43 -0
- package/library/testing/tdd/agents/openai.yaml +3 -0
- package/library/testing/tdd/luci.json +29 -0
- package/library/testing/tdd/mocking.md +59 -0
- package/library/testing/tdd/tests.md +77 -0
- package/library/testing/webapp-testing/LICENSE.txt +202 -0
- package/library/testing/webapp-testing/NOTICE.md +6 -0
- package/library/testing/webapp-testing/SKILL.md +100 -0
- package/library/testing/webapp-testing/examples/console_logging.py +35 -0
- package/library/testing/webapp-testing/examples/element_discovery.py +40 -0
- package/library/testing/webapp-testing/examples/static_html_automation.py +33 -0
- package/library/testing/webapp-testing/luci.json +33 -0
- package/library/testing/webapp-testing/scripts/with_server.py +106 -0
- package/library/ui-ux/improve-ui/NOTICE.md +6 -0
- package/library/ui-ux/improve-ui/SKILL.md +127 -0
- package/library/ui-ux/improve-ui/agents/openai.yaml +13 -0
- package/library/ui-ux/improve-ui/luci.json +47 -0
- package/library/ui-ux/improve-ui/references/plan-template.md +55 -0
- package/library/ui-ux/landing-page/LICENSE.txt +21 -0
- package/library/ui-ux/landing-page/NOTICE.md +7 -0
- package/library/ui-ux/landing-page/SKILL.md +213 -0
- package/library/ui-ux/landing-page/luci.json +47 -0
- package/library/ui-ux/pricing-page/LICENSE.txt +21 -0
- package/library/ui-ux/pricing-page/NOTICE.md +7 -0
- package/library/ui-ux/pricing-page/SKILL.md +217 -0
- package/library/ui-ux/pricing-page/luci.json +47 -0
- package/library/ui-ux/prototype/LOGIC.md +67 -0
- package/library/ui-ux/prototype/NOTICE.md +6 -0
- package/library/ui-ux/prototype/SKILL.md +31 -0
- package/library/ui-ux/prototype/UI.md +112 -0
- package/library/ui-ux/prototype/agents/openai.yaml +3 -0
- package/library/ui-ux/prototype/luci.json +33 -0
- package/library/ui-ux/theme-factory/LICENSE.txt +202 -0
- package/library/ui-ux/theme-factory/NOTICE.md +6 -0
- package/library/ui-ux/theme-factory/SKILL.md +62 -0
- package/library/ui-ux/theme-factory/luci.json +35 -0
- package/library/ui-ux/theme-factory/themes/arctic-frost.md +19 -0
- package/library/ui-ux/theme-factory/themes/botanical-garden.md +19 -0
- package/library/ui-ux/theme-factory/themes/desert-rose.md +19 -0
- package/library/ui-ux/theme-factory/themes/forest-canopy.md +19 -0
- package/library/ui-ux/theme-factory/themes/golden-hour.md +19 -0
- package/library/ui-ux/theme-factory/themes/midnight-galaxy.md +19 -0
- package/library/ui-ux/theme-factory/themes/modern-minimalist.md +19 -0
- package/library/ui-ux/theme-factory/themes/ocean-depths.md +19 -0
- package/library/ui-ux/theme-factory/themes/sunset-boulevard.md +19 -0
- package/library/ui-ux/theme-factory/themes/tech-innovation.md +19 -0
- package/package.json +21 -3
- package/packs/design-system-build.json +10 -0
- package/packs/design-system.json +16 -0
- package/packs/marketing.json +11 -0
- package/packs/motion.json +12 -0
- package/packs/ui.json +13 -0
- package/README.md +0 -3
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
# Chat & Messaging
|
|
2
|
+
|
|
3
|
+
Components for conversation and chat UI. Compose these instead of hand-rolling
|
|
4
|
+
bubbles, scroll containers, dividers, or attachment cards.
|
|
5
|
+
|
|
6
|
+
Install: `npx shadcn@latest add message-scroller message bubble attachment marker trace code-block`
|
|
7
|
+
|
|
8
|
+
The same component names and props ship for both `base` and `radix`; only
|
|
9
|
+
composition differs (`render` vs `asChild`). See [base-vs-radix.md](./base-vs-radix.md).
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
- Scrollable threads use MessageScroller
|
|
14
|
+
- Message rows use Message
|
|
15
|
+
- Message surfaces use Bubble
|
|
16
|
+
- Attachments use Attachment
|
|
17
|
+
- System notes and dividers use Marker
|
|
18
|
+
- Assistant activity uses Trace
|
|
19
|
+
- Code and tool output use CodeBlock
|
|
20
|
+
- Streaming, anchoring, and jump-to-latest are built in
|
|
21
|
+
- Escape hatch: the scroller hooks
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Scrollable threads use MessageScroller
|
|
26
|
+
|
|
27
|
+
A conversation that scrolls, follows new messages, restores position, or jumps
|
|
28
|
+
to a message uses `MessageScroller`. Don't build a raw overflow container with
|
|
29
|
+
manual scroll wiring, and don't reach for `ScrollArea`.
|
|
30
|
+
|
|
31
|
+
The parts nest in a fixed order. Every direct child of the content is wrapped in
|
|
32
|
+
a `MessageScrollerItem` so the scroller can measure, anchor, preserve position,
|
|
33
|
+
track visibility, and jump to it. `MessageScrollerButton` sits inside
|
|
34
|
+
`MessageScroller`, after the viewport.
|
|
35
|
+
|
|
36
|
+
**Incorrect:**
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
// Hand-rolled scroll container with manual stick-to-bottom logic.
|
|
40
|
+
<div ref={scrollRef} onScroll={handleScroll} className="flex-1 overflow-y-auto">
|
|
41
|
+
<div className="flex flex-col gap-6 p-4">
|
|
42
|
+
{messages.map((m) => (
|
|
43
|
+
<ChatMessage key={m.id} message={m} />
|
|
44
|
+
))}
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Correct:**
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<MessageScrollerProvider autoScroll>
|
|
53
|
+
<MessageScroller>
|
|
54
|
+
<MessageScrollerViewport>
|
|
55
|
+
<MessageScrollerContent>
|
|
56
|
+
{messages.map((message) => (
|
|
57
|
+
<MessageScrollerItem
|
|
58
|
+
key={message.id}
|
|
59
|
+
messageId={message.id}
|
|
60
|
+
scrollAnchor={message.role === "user"}
|
|
61
|
+
>
|
|
62
|
+
<Message align={message.role === "user" ? "end" : "start"}>
|
|
63
|
+
{/* ...message content... */}
|
|
64
|
+
</Message>
|
|
65
|
+
</MessageScrollerItem>
|
|
66
|
+
))}
|
|
67
|
+
</MessageScrollerContent>
|
|
68
|
+
</MessageScrollerViewport>
|
|
69
|
+
<MessageScrollerButton />
|
|
70
|
+
</MessageScroller>
|
|
71
|
+
</MessageScrollerProvider>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Message rows use Message
|
|
77
|
+
|
|
78
|
+
`Message` lays out a single row: avatar, header, content, footer, with
|
|
79
|
+
alignment. Group consecutive rows from one sender with `MessageGroup`. Don't
|
|
80
|
+
rebuild the row from flex divs.
|
|
81
|
+
|
|
82
|
+
`align="end"` is the current user's side; `align="start"` is everyone else.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
<Message align="start">
|
|
86
|
+
<MessageAvatar>
|
|
87
|
+
<Avatar>
|
|
88
|
+
<AvatarImage src={sender.avatar} alt={sender.name} />
|
|
89
|
+
<AvatarFallback>{initials}</AvatarFallback>
|
|
90
|
+
</Avatar>
|
|
91
|
+
</MessageAvatar>
|
|
92
|
+
<MessageContent>
|
|
93
|
+
<MessageHeader>{sender.name}</MessageHeader>
|
|
94
|
+
<Bubble>
|
|
95
|
+
<BubbleContent>{text}</BubbleContent>
|
|
96
|
+
</Bubble>
|
|
97
|
+
<MessageFooter>{time}</MessageFooter>
|
|
98
|
+
</MessageContent>
|
|
99
|
+
</Message>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Message surfaces use Bubble
|
|
105
|
+
|
|
106
|
+
The colored message surface is `Bubble` + `BubbleContent`, never a styled `div`
|
|
107
|
+
with `bg-muted` / `bg-primary` and hand-managed corners.
|
|
108
|
+
|
|
109
|
+
- `variant`: `default`, `secondary`, `muted`, `tinted`, `outline`, `ghost`, `destructive`.
|
|
110
|
+
- `align`: `start` or `end` (matches the `Message` side).
|
|
111
|
+
|
|
112
|
+
`BubbleReactions` renders the reaction cluster. `side` (`top` | `bottom`) and
|
|
113
|
+
`align` (`start` | `end`) position it against the bubble. Don't lay reactions out
|
|
114
|
+
with absolutely-positioned `Badge`s.
|
|
115
|
+
|
|
116
|
+
**Incorrect:**
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
<div className="w-fit rounded-2xl bg-primary px-3 py-2 text-primary-foreground">
|
|
120
|
+
{text}
|
|
121
|
+
</div>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Correct:**
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
<Bubble variant="default" align="end">
|
|
128
|
+
<BubbleContent>{text}</BubbleContent>
|
|
129
|
+
<BubbleReactions side="bottom" align="end">
|
|
130
|
+
<Badge variant="secondary">👍 2</Badge>
|
|
131
|
+
</BubbleReactions>
|
|
132
|
+
</Bubble>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Attachments use Attachment
|
|
138
|
+
|
|
139
|
+
File and image attachments use `Attachment`, not `Item` or a custom card. It
|
|
140
|
+
carries upload state, so wire `state` to the real status rather than rendering a
|
|
141
|
+
separate spinner.
|
|
142
|
+
|
|
143
|
+
- `state`: `idle`, `uploading`, `processing`, `error`, `done`. `uploading` and
|
|
144
|
+
`processing` apply the `shimmer` animation to the title automatically.
|
|
145
|
+
- `size`: `default`, `sm`, `xs`. `orientation`: `horizontal`, `vertical`.
|
|
146
|
+
- Use `AttachmentGroup` to lay out several attachments in a scrolling row.
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
<Attachment state="done">
|
|
150
|
+
<AttachmentMedia variant="icon">
|
|
151
|
+
<FileTextIcon />
|
|
152
|
+
</AttachmentMedia>
|
|
153
|
+
<AttachmentContent>
|
|
154
|
+
<AttachmentTitle>homepage-feedback.pdf</AttachmentTitle>
|
|
155
|
+
<AttachmentDescription>PDF · 2.4 MB</AttachmentDescription>
|
|
156
|
+
</AttachmentContent>
|
|
157
|
+
<AttachmentActions>
|
|
158
|
+
<AttachmentAction>
|
|
159
|
+
<DownloadIcon />
|
|
160
|
+
</AttachmentAction>
|
|
161
|
+
</AttachmentActions>
|
|
162
|
+
</Attachment>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
For an image, use `<AttachmentMedia variant="image">` with an `img` child.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## System notes and dividers use Marker
|
|
170
|
+
|
|
171
|
+
Status lines ("Sarah joined the conversation"), date dividers ("Today"), and
|
|
172
|
+
labeled separators are `Marker`, not a `Separator` plus a centered span.
|
|
173
|
+
|
|
174
|
+
- `variant`: `default` (plain row), `separator` (centered label with rules on
|
|
175
|
+
each side), `border` (bottom-bordered row).
|
|
176
|
+
- `MarkerIcon` holds a leading icon; `MarkerContent` holds the label.
|
|
177
|
+
|
|
178
|
+
**Incorrect:**
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
<div className="flex items-center gap-3 py-2">
|
|
182
|
+
<Separator className="flex-1" />
|
|
183
|
+
<span className="text-xs text-muted-foreground">Today</span>
|
|
184
|
+
<Separator className="flex-1" />
|
|
185
|
+
</div>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Correct:**
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
<Marker variant="separator">
|
|
192
|
+
<MarkerContent>Today</MarkerContent>
|
|
193
|
+
</Marker>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Assistant activity uses Trace
|
|
199
|
+
|
|
200
|
+
What the assistant did or is doing (reasoning, tool calls, chain of thought,
|
|
201
|
+
steps, sources, file reads) is a `TraceLine` in a `Trace`, not a hand-rolled
|
|
202
|
+
`Collapsible` or a `Marker`. One line reports one thing; it may have detail.
|
|
203
|
+
|
|
204
|
+
- `TraceLine` is always the line: a `TraceIcon` and a `TraceTitle`, then an
|
|
205
|
+
optional `TraceDescription` for a count, a duration or a diff stat. `status`
|
|
206
|
+
goes on the `TraceLine`. Never hand-roll a span for secondary text.
|
|
207
|
+
- Behavior wraps the line. To make a line do something, wrap it in that thing's
|
|
208
|
+
trigger:
|
|
209
|
+
- nothing to open: the `TraceLine` alone;
|
|
210
|
+
- expands: `TraceCollapsible` > `TraceCollapsibleTrigger` > `TraceLine`, then
|
|
211
|
+
`TraceCollapsibleContent`. The trigger adds its own chevron;
|
|
212
|
+
- link: `<a href>` > `TraceLine`;
|
|
213
|
+
- overlay: `<SheetTrigger>` > `TraceLine` (Dialog, Drawer and Popover the
|
|
214
|
+
same). Aria: `<DialogTrigger><Button>` > `TraceLine`, with React Aria's
|
|
215
|
+
`Button`.
|
|
216
|
+
- Never make the line the trigger: no `asChild` or `render={<TraceLine />}` on
|
|
217
|
+
a trigger. The trigger must stay a real button.
|
|
218
|
+
- A `TraceCollapsibleTrigger` always has a `TraceCollapsibleContent`. A tool row
|
|
219
|
+
is a `TraceLine` until its output arrives, then a `TraceCollapsible`.
|
|
220
|
+
- Rows rendered from message parts go in one `Trace` per run of parts. A text
|
|
221
|
+
part or a pending approval ends the run. A heading for a run is plain text
|
|
222
|
+
above it, or a collapsible summary row.
|
|
223
|
+
- A pending approval (`approval-requested`) is a prompt, not a row. Render it
|
|
224
|
+
outside `Trace` as an `Item` with Approve and Deny in `ItemActions`. See
|
|
225
|
+
/docs/ai-elements/base/confirmation. Once answered, the tool part is a line
|
|
226
|
+
again.
|
|
227
|
+
- A summary (sources, a task, a whole turn) is a `TraceCollapsible` whose
|
|
228
|
+
`TraceCollapsibleContent` holds a `Trace`. Set the parent line's status and
|
|
229
|
+
title from its children yourself.
|
|
230
|
+
- `status` is `"running"`, `"error"` or `"pending"` (a plan step that has not
|
|
231
|
+
started), or omitted. The words agree: Running, Ran, Failed to run. Never dim
|
|
232
|
+
a line with `opacity-*`. Map SDK states yourself; never pass one through.
|
|
233
|
+
- Add a trailing `TraceIcon` only for a link (arrow-up-right for a new tab, with
|
|
234
|
+
sr-only " (opens in a new tab)" in the `TraceTitle`) or an overlay
|
|
235
|
+
(chevron-right).
|
|
236
|
+
- Open state goes on `TraceCollapsible`: `defaultOpen`, or `open` with
|
|
237
|
+
`onOpenChange` (aria: `defaultExpanded`, or `isExpanded` with
|
|
238
|
+
`onExpandedChange`).
|
|
239
|
+
- Use `Marker` for notes and dividers between turns, not for activity.
|
|
240
|
+
- A checkpoint marks a turn the reader can return to. Render a `Marker`
|
|
241
|
+
separator after that message, with a Button that calls `setMessages` with the
|
|
242
|
+
messages up to and including it. See /docs/ai-elements/base/checkpoint.
|
|
243
|
+
- A folder of files is nested `Collapsible`s, one folder per row, and a file is
|
|
244
|
+
a `Button`. See /docs/ai-elements/base/file-tree. A single file the assistant
|
|
245
|
+
read is still a `TraceLine`.
|
|
246
|
+
- A person's turn is a `Message` with `align="end"` and a `Bubble`. The
|
|
247
|
+
assistant's answer is a `Message`. See /docs/ai-elements/base/message.
|
|
248
|
+
- A thread is those turns in `MessageScroller`. The person's turn is the
|
|
249
|
+
`scrollAnchor`, and `autoScroll` follows the reply. See
|
|
250
|
+
/docs/ai-elements/base/chat.
|
|
251
|
+
- A prompt is an `InputGroup`: a textarea, an attachment chip, and a submit
|
|
252
|
+
button. See /docs/ai-elements/base/prompt-input.
|
|
253
|
+
- A suggestion is a `Button` that sends its label with `sendMessage({ text })`.
|
|
254
|
+
See /docs/ai-elements/base/suggestion.
|
|
255
|
+
- A model picker is a `DropdownMenu` with a `DropdownMenuRadioGroup`, next to a
|
|
256
|
+
second one for effort. Send the selected ids on `sendMessage` as
|
|
257
|
+
`body.model` and `body.effort`. See /docs/ai-elements/base/model-selector.
|
|
258
|
+
- An inline citation is a `HoverCard` on a short `Button` in the sentence, from
|
|
259
|
+
a `source-url` part. See /docs/ai-elements/base/inline-citation. A list of
|
|
260
|
+
sources after the answer is still Sources.
|
|
261
|
+
- Context usage is a `HoverCard` with `Progress`, read from message metadata
|
|
262
|
+
`usage`. The window size is the model's limit. See
|
|
263
|
+
/docs/ai-elements/base/context.
|
|
264
|
+
- Asked for an AI Elements component such as Tool, Reasoning, Chain of Thought,
|
|
265
|
+
Task, Plan, Sources or Subagent? It is a component page built with Trace (for example
|
|
266
|
+
/docs/ai-elements/base/tool). Install `trace` and copy the composition.
|
|
267
|
+
Message is one turn (/docs/ai-elements/base/message). Chat is the thread in
|
|
268
|
+
Message Scroller (/docs/ai-elements/base/chat). Checkpoint is a Marker
|
|
269
|
+
(/docs/ai-elements/base/checkpoint). File Tree is nested
|
|
270
|
+
Collapsibles (/docs/ai-elements/base/file-tree). Confirmation is an Item
|
|
271
|
+
(/docs/ai-elements/base/confirmation). Prompt Input is an Input Group
|
|
272
|
+
(/docs/ai-elements/base/prompt-input). Suggestion is a Button
|
|
273
|
+
(/docs/ai-elements/base/suggestion). Model Selector is a Dropdown Menu
|
|
274
|
+
(/docs/ai-elements/base/model-selector). Inline Citation is a Hover Card
|
|
275
|
+
(/docs/ai-elements/base/inline-citation). Context is a Hover Card and Progress
|
|
276
|
+
(/docs/ai-elements/base/context).
|
|
277
|
+
|
|
278
|
+
**Incorrect:**
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
const [open, setOpen] = useState(true)
|
|
282
|
+
|
|
283
|
+
<Collapsible open={open} onOpenChange={setOpen}>
|
|
284
|
+
<CollapsibleTrigger className="text-sm text-muted-foreground">
|
|
285
|
+
{isStreaming ? "Thinking..." : "Thought for a few seconds"}
|
|
286
|
+
</CollapsibleTrigger>
|
|
287
|
+
<CollapsibleContent>{part.text}</CollapsibleContent>
|
|
288
|
+
</Collapsible>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Correct:**
|
|
292
|
+
|
|
293
|
+
```tsx
|
|
294
|
+
<TraceCollapsible>
|
|
295
|
+
<TraceCollapsibleTrigger>
|
|
296
|
+
<TraceLine status={running ? "running" : undefined}>
|
|
297
|
+
<TraceIcon>
|
|
298
|
+
<BrainIcon />
|
|
299
|
+
</TraceIcon>
|
|
300
|
+
<TraceTitle>{running ? "Thinking" : "Thought"}</TraceTitle>
|
|
301
|
+
</TraceLine>
|
|
302
|
+
</TraceCollapsibleTrigger>
|
|
303
|
+
<TraceCollapsibleContent>{part.text}</TraceCollapsibleContent>
|
|
304
|
+
</TraceCollapsible>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**Incorrect:** a tool row whose output may not exist yet.
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
<TraceCollapsible>
|
|
311
|
+
<TraceCollapsibleTrigger>
|
|
312
|
+
<TraceLine status={status}>…</TraceLine>
|
|
313
|
+
</TraceCollapsibleTrigger>
|
|
314
|
+
{output && <TraceCollapsibleContent>{output}</TraceCollapsibleContent>}
|
|
315
|
+
</TraceCollapsible>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Correct:** a `TraceLine` until there is something to open.
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
function ToolRow({
|
|
322
|
+
icon,
|
|
323
|
+
title,
|
|
324
|
+
status,
|
|
325
|
+
output,
|
|
326
|
+
}: {
|
|
327
|
+
icon: React.ReactNode
|
|
328
|
+
title: string
|
|
329
|
+
status?: "running" | "error"
|
|
330
|
+
output?: string
|
|
331
|
+
}) {
|
|
332
|
+
const line = (
|
|
333
|
+
<TraceLine status={status}>
|
|
334
|
+
<TraceIcon>{icon}</TraceIcon>
|
|
335
|
+
<TraceTitle>{title}</TraceTitle>
|
|
336
|
+
</TraceLine>
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
if (output === undefined) {
|
|
340
|
+
return line
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return (
|
|
344
|
+
<TraceCollapsible>
|
|
345
|
+
<TraceCollapsibleTrigger>{line}</TraceCollapsibleTrigger>
|
|
346
|
+
<TraceCollapsibleContent>
|
|
347
|
+
<CodeBlock size="sm">
|
|
348
|
+
<CodeBlockContent wrap className="max-h-64">
|
|
349
|
+
{output}
|
|
350
|
+
</CodeBlockContent>
|
|
351
|
+
</CodeBlock>
|
|
352
|
+
</TraceCollapsibleContent>
|
|
353
|
+
</TraceCollapsible>
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Incorrect:** the trigger renders as the line, so it is a span.
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
<Sheet>
|
|
362
|
+
<SheetTrigger asChild>
|
|
363
|
+
<TraceLine>…</TraceLine>
|
|
364
|
+
</SheetTrigger>
|
|
365
|
+
</Sheet>
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**Correct:** sources, each link wrapping its own line.
|
|
369
|
+
|
|
370
|
+
```tsx
|
|
371
|
+
<TraceCollapsible>
|
|
372
|
+
<TraceCollapsibleTrigger>
|
|
373
|
+
<TraceLine>
|
|
374
|
+
<TraceIcon>
|
|
375
|
+
<GlobeIcon />
|
|
376
|
+
</TraceIcon>
|
|
377
|
+
<TraceTitle>Used {sources.length} sources</TraceTitle>
|
|
378
|
+
</TraceLine>
|
|
379
|
+
</TraceCollapsibleTrigger>
|
|
380
|
+
<TraceCollapsibleContent>
|
|
381
|
+
<Trace>
|
|
382
|
+
{sources.map((source) => (
|
|
383
|
+
<a key={source.url} href={source.url} target="_blank" rel="noreferrer">
|
|
384
|
+
<TraceLine>
|
|
385
|
+
<TraceIcon>
|
|
386
|
+
<GlobeIcon />
|
|
387
|
+
</TraceIcon>
|
|
388
|
+
<TraceTitle>
|
|
389
|
+
{source.title}
|
|
390
|
+
<span className="sr-only"> (opens in a new tab)</span>
|
|
391
|
+
</TraceTitle>
|
|
392
|
+
<TraceIcon>
|
|
393
|
+
<ArrowUpRightIcon />
|
|
394
|
+
</TraceIcon>
|
|
395
|
+
</TraceLine>
|
|
396
|
+
</a>
|
|
397
|
+
))}
|
|
398
|
+
</Trace>
|
|
399
|
+
</TraceCollapsibleContent>
|
|
400
|
+
</TraceCollapsible>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Code and tool output use CodeBlock
|
|
406
|
+
|
|
407
|
+
Code, terminal output, tool input and output, logs, stack traces and diffs are
|
|
408
|
+
a `CodeBlock`, never a hand-rolled `<pre>`.
|
|
409
|
+
|
|
410
|
+
- `CodeBlockContent` takes a string. Add `wrap` for tool output and errors,
|
|
411
|
+
`lineNumbers` for source, and a `max-h-*` class to cap the height.
|
|
412
|
+
- Errors use `variant="destructive"` on `CodeBlock`. Don't recolor the block.
|
|
413
|
+
- For diffs and highlighted lines, map each line to a `CodeBlockLine` with
|
|
414
|
+
`variant="added"`, `"removed"` or `"highlighted"`.
|
|
415
|
+
- `CodeBlockCopyButton` takes the text to copy as `value`.
|
|
416
|
+
- Output inside a Trace row is `size="sm"` with `wrap` and `max-h-64`, so long
|
|
417
|
+
output wraps and scrolls inside the row. Docs, Markdown fences and chat
|
|
418
|
+
answers use the default size.
|
|
419
|
+
- Header buttons go in `CodeBlockActions`. With no header, put
|
|
420
|
+
`CodeBlockActions` directly in `CodeBlock`; it floats and shows on hover.
|
|
421
|
+
- `code-block` installs `use-highlighted-code`. For source code, map the lines
|
|
422
|
+
of `useHighlightedCode(code, language)` into `CodeBlockLine`. In a Server
|
|
423
|
+
Component, use `await highlightCode(code, language)` instead. Don't
|
|
424
|
+
highlight tool output; pass the string.
|
|
425
|
+
- `startLine` numbers a snippet from the middle of a file.
|
|
426
|
+
|
|
427
|
+
**Incorrect:**
|
|
428
|
+
|
|
429
|
+
```tsx
|
|
430
|
+
<pre className="rounded-md bg-muted p-3 font-mono text-xs whitespace-pre-wrap">
|
|
431
|
+
{output}
|
|
432
|
+
</pre>
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
**Correct:**
|
|
436
|
+
|
|
437
|
+
```tsx
|
|
438
|
+
<CodeBlock>
|
|
439
|
+
<CodeBlockHeader>
|
|
440
|
+
<CodeBlockTitle>Output</CodeBlockTitle>
|
|
441
|
+
<CodeBlockActions>
|
|
442
|
+
<CodeBlockCopyButton value={output} />
|
|
443
|
+
</CodeBlockActions>
|
|
444
|
+
</CodeBlockHeader>
|
|
445
|
+
<CodeBlockContent wrap className="max-h-72">
|
|
446
|
+
{output}
|
|
447
|
+
</CodeBlockContent>
|
|
448
|
+
</CodeBlock>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Streaming, anchoring, and jump-to-latest are built in
|
|
454
|
+
|
|
455
|
+
`MessageScroller` handles the behavior that chat UIs usually reinvent. Don't
|
|
456
|
+
write a `useStickToBottom` hook, a `ResizeObserver`, or manual `scrollTop` math.
|
|
457
|
+
|
|
458
|
+
- **Follow the live edge while streaming.** `MessageScrollerProvider` with
|
|
459
|
+
`autoScroll` keeps the view pinned to new content and yields the moment the
|
|
460
|
+
user scrolls up. Streaming token updates that grow the last message are
|
|
461
|
+
followed automatically.
|
|
462
|
+
- **Anchor a turn.** `scrollAnchor` on a `MessageScrollerItem` marks the row to
|
|
463
|
+
hold in view (typically the user's message that started the turn).
|
|
464
|
+
- **Jump to latest.** `MessageScrollerButton` appears when the user scrolls away
|
|
465
|
+
and scrolls back on click. `direction="end"` (default) or `direction="start"`.
|
|
466
|
+
It is a self-managing control, so don't gate it behind your own scroll-position
|
|
467
|
+
state.
|
|
468
|
+
- **Open a saved transcript without a flash.** `defaultScrollPosition` applies
|
|
469
|
+
after mount. When it is `"end"` or `"last-anchor"`, the viewport has
|
|
470
|
+
`data-pending-scroll` until that position is applied. The styled viewport
|
|
471
|
+
hides. For `"end"` on first paint when messages are in the server HTML, copy
|
|
472
|
+
this script into the page, not into the primitive. Skip it for `"last-anchor"`
|
|
473
|
+
and for client-fetched messages. Keep `suppressHydrationWarning` on the
|
|
474
|
+
viewport. Pass a `nonce` if you use a Content Security Policy.
|
|
475
|
+
|
|
476
|
+
```tsx
|
|
477
|
+
const scrollToEndScript = `(function () {
|
|
478
|
+
var viewport = document.getElementById("messages")
|
|
479
|
+
if (!viewport) {
|
|
480
|
+
return
|
|
481
|
+
}
|
|
482
|
+
viewport.scrollTop = viewport.scrollHeight
|
|
483
|
+
viewport.removeAttribute("data-pending-scroll")
|
|
484
|
+
})()`
|
|
485
|
+
|
|
486
|
+
<MessageScroller>
|
|
487
|
+
<MessageScrollerViewport id="messages" suppressHydrationWarning>
|
|
488
|
+
<MessageScrollerContent>{/* transcript */}</MessageScrollerContent>
|
|
489
|
+
</MessageScrollerViewport>
|
|
490
|
+
<script dangerouslySetInnerHTML={{ __html: scrollToEndScript }} />
|
|
491
|
+
<MessageScrollerButton />
|
|
492
|
+
</MessageScroller>
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
For a "thinking…" indicator while the model generates, apply the `shimmer`
|
|
496
|
+
utility to text. Don't author a custom keyframe animation. See
|
|
497
|
+
[styling.md](./styling.md).
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## Escape hatch: the scroller hooks
|
|
502
|
+
|
|
503
|
+
For behavior the parts don't expose, read state from the hooks rather than
|
|
504
|
+
re-implementing the scroller: `useMessageScroller`,
|
|
505
|
+
`useMessageScrollerVisibility`, and `useMessageScrollerScrollable`. They come
|
|
506
|
+
from the auto-installed `@shadcn/react` dependency, so there's nothing extra to
|
|
507
|
+
install. Reach for them only when composition can't express what you need.
|