@skyroc/scripts 2.5.0 → 2.5.2
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/README.md +6 -3
- package/dist/cli.mjs +2 -2
- package/dist/{config-BKkdncJS.mjs → config-Cj9IzlRz.mjs} +105 -5
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/templates/admin/package.json +5 -3
- package/templates/admin/src/assets/svg-icon/logo.svg +2 -14
- package/templates/admin/src/features/router/routeTree.gen.ts +71 -1
- package/templates/admin/src/pages/(auth)/login/code-login.tsx +79 -0
- package/templates/admin/src/pages/(auth)/login/index.tsx +22 -1
- package/templates/admin/src/pages/(auth)/login/layout.tsx +25 -23
- package/templates/admin/src/pages/(auth)/login/modules/Header.tsx +25 -0
- package/templates/admin/src/pages/(auth)/login/register.tsx +86 -0
- package/templates/admin/src/pages/(auth)/login/reset-pwd.tsx +73 -0
- package/templates/admin/uno.config.ts +1 -1
- package/templates/admin-root/.agents/skills/component-doc/SKILL.md +304 -0
- package/templates/admin-root/.agents/skills/component-refactoring/SKILL.md +483 -0
- package/templates/admin-root/.agents/skills/component-refactoring/references/complexity-patterns.md +493 -0
- package/templates/admin-root/.agents/skills/component-refactoring/references/component-splitting.md +477 -0
- package/templates/admin-root/.agents/skills/component-refactoring/references/hook-extraction.md +317 -0
- package/templates/admin-root/.agents/skills/doc-coauthoring/SKILL.md +375 -0
- package/templates/admin-root/.agents/skills/feature-dev/SKILL.md +78 -0
- package/templates/admin-root/.agents/skills/frontend-code-review/SKILL.md +73 -0
- package/templates/admin-root/.agents/skills/frontend-code-review/references/business-logic.md +15 -0
- package/templates/admin-root/.agents/skills/frontend-code-review/references/code-quality.md +44 -0
- package/templates/admin-root/.agents/skills/frontend-code-review/references/performance.md +45 -0
- package/templates/admin-root/.agents/skills/frontend-design/LICENSE.txt +177 -0
- package/templates/admin-root/.agents/skills/frontend-design/SKILL.md +42 -0
- package/templates/admin-root/.agents/skills/frontend-testing/SKILL.md +325 -0
- package/templates/admin-root/.agents/skills/frontend-testing/assets/component-test.template.tsx +293 -0
- package/templates/admin-root/.agents/skills/frontend-testing/assets/hook-test.template.ts +207 -0
- package/templates/admin-root/.agents/skills/frontend-testing/assets/utility-test.template.ts +154 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/async-testing.md +345 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/checklist.md +205 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/common-patterns.md +449 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/domain-components.md +523 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/mocking.md +512 -0
- package/templates/admin-root/.agents/skills/frontend-testing/references/workflow.md +269 -0
- package/templates/admin-root/.agents/skills/migrate-nativewind-to-uniwind/SKILL.md +734 -0
- package/templates/admin-root/.agents/skills/migrate-oxfmt/SKILL.md +202 -0
- package/templates/admin-root/.agents/skills/migrate-oxlint/SKILL.md +196 -0
- package/templates/admin-root/.agents/skills/native-component-doc/SKILL.md +245 -0
- package/templates/admin-root/.agents/skills/senior-frontend/SKILL.md +209 -0
- package/templates/admin-root/.agents/skills/senior-frontend/references/frontend_best_practices.md +103 -0
- package/templates/admin-root/.agents/skills/senior-frontend/references/nextjs_optimization_guide.md +103 -0
- package/templates/admin-root/.agents/skills/senior-frontend/references/react_patterns.md +103 -0
- package/templates/admin-root/.agents/skills/senior-frontend/scripts/bundle_analyzer.py +114 -0
- package/templates/admin-root/.agents/skills/senior-frontend/scripts/component_generator.py +114 -0
- package/templates/admin-root/.agents/skills/senior-frontend/scripts/frontend_scaffolder.py +114 -0
- package/templates/admin-root/.agents/skills/skill-creator/SKILL.md +355 -0
- package/templates/admin-root/.agents/skills/skill-creator/references/output-patterns.md +86 -0
- package/templates/admin-root/.agents/skills/skill-creator/references/workflows.md +28 -0
- package/templates/admin-root/.agents/skills/skill-creator/scripts/init_skill.py +300 -0
- package/templates/admin-root/.agents/skills/skill-creator/scripts/package_skill.py +110 -0
- package/templates/admin-root/.agents/skills/skill-creator/scripts/quick_validate.py +97 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/SKILL.md +163 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/acceptance-checklist.md +75 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/evidence-order.md +109 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/prd-rules.md +103 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/references/prototype-rules.md +85 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/scripts/verify-prototypes.mjs +144 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/templates/admin-page.html +771 -0
- package/templates/admin-root/.agents/skills/skyroc-admin-prd-prototype/templates/prd.md +182 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/SKILL.md +292 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/templates/admin-root/.agents/skills/uniwind/SKILL.md +64 -0
- package/templates/admin-root/.agents/skills/uniwind/references/component-bindings.md +338 -0
- package/templates/admin-root/.agents/skills/uniwind/references/css-and-utilities.md +325 -0
- package/templates/admin-root/.agents/skills/uniwind/references/integrations.md +75 -0
- package/templates/admin-root/.agents/skills/uniwind/references/pro.md +354 -0
- package/templates/admin-root/.agents/skills/uniwind/references/setup.md +144 -0
- package/templates/admin-root/.agents/skills/uniwind/references/styling-patterns.md +237 -0
- package/templates/admin-root/.agents/skills/uniwind/references/theming.md +309 -0
- package/templates/admin-root/.agents/skills/uniwind/references/troubleshooting.md +179 -0
- package/templates/admin-root/.agents/skills/uniwind/references/variants-and-selectors.md +224 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/AGENTS.md +2934 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/SKILL.md +136 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/templates/admin-root/.agents/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/templates/admin-root/.claude/settings.json +5 -0
- package/templates/admin-root/.claude/skills/component-doc/SKILL.md +304 -0
- package/templates/admin-root/.claude/skills/component-refactoring/SKILL.md +483 -0
- package/templates/admin-root/.claude/skills/component-refactoring/references/complexity-patterns.md +493 -0
- package/templates/admin-root/.claude/skills/component-refactoring/references/component-splitting.md +477 -0
- package/templates/admin-root/.claude/skills/component-refactoring/references/hook-extraction.md +317 -0
- package/templates/admin-root/.claude/skills/doc-coauthoring/SKILL.md +375 -0
- package/templates/admin-root/.claude/skills/feature-dev/SKILL.md +78 -0
- package/templates/admin-root/.claude/skills/frontend-code-review/SKILL.md +73 -0
- package/templates/admin-root/.claude/skills/frontend-code-review/references/business-logic.md +15 -0
- package/templates/admin-root/.claude/skills/frontend-code-review/references/code-quality.md +44 -0
- package/templates/admin-root/.claude/skills/frontend-code-review/references/performance.md +45 -0
- package/templates/admin-root/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/templates/admin-root/.claude/skills/frontend-design/SKILL.md +42 -0
- package/templates/admin-root/.claude/skills/frontend-testing/SKILL.md +325 -0
- package/templates/admin-root/.claude/skills/frontend-testing/assets/component-test.template.tsx +293 -0
- package/templates/admin-root/.claude/skills/frontend-testing/assets/hook-test.template.ts +207 -0
- package/templates/admin-root/.claude/skills/frontend-testing/assets/utility-test.template.ts +154 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/async-testing.md +345 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/checklist.md +205 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/common-patterns.md +449 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/domain-components.md +523 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/mocking.md +512 -0
- package/templates/admin-root/.claude/skills/frontend-testing/references/workflow.md +269 -0
- package/templates/admin-root/.claude/skills/migrate-nativewind-to-uniwind +1 -0
- package/templates/admin-root/.claude/skills/native-component-doc/SKILL.md +245 -0
- package/templates/admin-root/.claude/skills/senior-frontend/SKILL.md +209 -0
- package/templates/admin-root/.claude/skills/senior-frontend/references/frontend_best_practices.md +103 -0
- package/templates/admin-root/.claude/skills/senior-frontend/references/nextjs_optimization_guide.md +103 -0
- package/templates/admin-root/.claude/skills/senior-frontend/references/react_patterns.md +103 -0
- package/templates/admin-root/.claude/skills/senior-frontend/scripts/bundle_analyzer.py +114 -0
- package/templates/admin-root/.claude/skills/senior-frontend/scripts/component_generator.py +114 -0
- package/templates/admin-root/.claude/skills/senior-frontend/scripts/frontend_scaffolder.py +114 -0
- package/templates/admin-root/.claude/skills/skill-creator/SKILL.md +355 -0
- package/templates/admin-root/.claude/skills/skill-creator/references/output-patterns.md +86 -0
- package/templates/admin-root/.claude/skills/skill-creator/references/workflows.md +28 -0
- package/templates/admin-root/.claude/skills/skill-creator/scripts/init_skill.py +300 -0
- package/templates/admin-root/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/templates/admin-root/.claude/skills/skill-creator/scripts/quick_validate.py +97 -0
- package/templates/admin-root/.claude/skills/ui-ux-pro-max/SKILL.md +386 -0
- package/templates/admin-root/.claude/skills/ui-ux-pro-max/data +1 -0
- package/templates/admin-root/.claude/skills/ui-ux-pro-max/scripts +1 -0
- package/templates/admin-root/.claude/skills/uniwind +1 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/AGENTS.md +2934 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/SKILL.md +136 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/templates/admin-root/.claude/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/templates/admin-root/.cursor/settings.json +10 -0
- package/templates/admin-root/.editorconfig +19 -0
- package/templates/admin-root/.gitattributes +16 -0
- package/templates/admin-root/.oxfmtrc.json +35 -0
- package/templates/admin-root/AGENTS.md +297 -0
- package/templates/admin-root/CLAUDE.md +1 -0
- package/templates/admin-root/skills-lock.json +27 -0
- package/templates/admin-root.manifest.json +1317 -0
- package/templates/admin-shell/theme/antd/AntdProvider.tsx +1 -0
- package/templates/admin-shell/theme/antd/shared.ts +3 -3
- package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/colors.ts +3 -3
- package/templates/admin-shell/theme/antd-algorithm/algorithm/default/colors.ts +1 -1
- package/templates/admin-shell/theme/presets/default.json +1 -1
- package/templates/admin.meta.json +10 -6
- package/LICENSE +0 -21
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migrate-nativewind-to-uniwind
|
|
3
|
+
description: >
|
|
4
|
+
Migrate a React Native project from NativeWind to Uniwind. Use when the user wants to
|
|
5
|
+
replace NativeWind with Uniwind, upgrade from NativeWind, switch to Uniwind, or mentions
|
|
6
|
+
NativeWind-to-Uniwind migration. Handles package removal, config migration, Tailwind 4
|
|
7
|
+
upgrade, cssInterop removal, theme conversion, and all breaking changes.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Migrate NativeWind to Uniwind
|
|
11
|
+
|
|
12
|
+
Uniwind replaces NativeWind with better performance and stability. It requires **Tailwind CSS 4** and uses CSS-based theming instead of JS config.
|
|
13
|
+
|
|
14
|
+
## Pre-Migration Checklist
|
|
15
|
+
|
|
16
|
+
Before starting, read the project's existing config files to understand the current setup:
|
|
17
|
+
- `package.json` (NativeWind version, dependencies)
|
|
18
|
+
- `tailwind.config.js` / `tailwind.config.ts`
|
|
19
|
+
- `metro.config.js`
|
|
20
|
+
- `babel.config.js`
|
|
21
|
+
- `global.css` or equivalent CSS entry file
|
|
22
|
+
- `nativewind-env.d.ts` or `nativewind.d.ts`
|
|
23
|
+
- Any file using `cssInterop` or `remapProps` from `nativewind`
|
|
24
|
+
- Any file importing from `react-native-css-interop`
|
|
25
|
+
- Any ThemeProvider from NativeWind (`vars()` usage)
|
|
26
|
+
|
|
27
|
+
## Step 1: Remove NativeWind and Related Packages
|
|
28
|
+
|
|
29
|
+
Uninstall ALL of these packages (if present):
|
|
30
|
+
```bash
|
|
31
|
+
npm uninstall nativewind react-native-css-interop
|
|
32
|
+
# or
|
|
33
|
+
yarn remove nativewind react-native-css-interop
|
|
34
|
+
# or
|
|
35
|
+
bun remove nativewind react-native-css-interop
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**CRITICAL**: `react-native-css-interop` is a NativeWind dependency that must be removed. It is commonly missed during migration. Search the entire codebase for any imports from it:
|
|
39
|
+
```bash
|
|
40
|
+
rg "react-native-css-interop" -g "*.{ts,tsx,js,jsx}"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Remove every import and usage found.
|
|
44
|
+
|
|
45
|
+
## Step 2: Install Uniwind and Tailwind 4
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install uniwind tailwindcss@latest
|
|
49
|
+
# or
|
|
50
|
+
yarn add uniwind tailwindcss@latest
|
|
51
|
+
# or
|
|
52
|
+
bun add uniwind tailwindcss@latest
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Ensure `tailwindcss` is version 4+.
|
|
56
|
+
|
|
57
|
+
## Step 3: Update babel.config.js
|
|
58
|
+
|
|
59
|
+
Remove the NativeWind babel preset:
|
|
60
|
+
```js
|
|
61
|
+
// REMOVE this line from presets array:
|
|
62
|
+
// 'nativewind/babel'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
No Uniwind babel preset is needed.
|
|
66
|
+
|
|
67
|
+
## Step 4: Update metro.config.js
|
|
68
|
+
|
|
69
|
+
Replace NativeWind's metro config with Uniwind's. `withUniwindConfig` must be the **outermost wrapper**.
|
|
70
|
+
|
|
71
|
+
**Before (NativeWind):**
|
|
72
|
+
```js
|
|
73
|
+
const { withNativeWind } = require('nativewind/metro');
|
|
74
|
+
module.exports = withNativeWind(config, { input: './global.css' });
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**After (Uniwind):**
|
|
78
|
+
```js
|
|
79
|
+
const { getDefaultConfig } = require('expo/metro-config');
|
|
80
|
+
// For bare RN: const { getDefaultConfig } = require('@react-native/metro-config');
|
|
81
|
+
const { withUniwindConfig } = require('uniwind/metro');
|
|
82
|
+
|
|
83
|
+
const config = getDefaultConfig(__dirname);
|
|
84
|
+
|
|
85
|
+
module.exports = withUniwindConfig(config, {
|
|
86
|
+
cssEntryFile: './global.css',
|
|
87
|
+
polyfills: { rem: 14 },
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`cssEntryFile` must be a **relative path string** from project root (e.g. `./global.css` or `./app/global.css`).
|
|
92
|
+
Do **not** use absolute paths or `path.resolve(...)` / `path.join(...)` for this option.
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
// ❌ Broken
|
|
96
|
+
cssEntryFile: path.resolve(__dirname, 'app', 'global.css')
|
|
97
|
+
|
|
98
|
+
// ✅ Correct
|
|
99
|
+
cssEntryFile: './app/global.css'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Always set `polyfills.rem` to 14** to match NativeWind's default rem value and prevent spacing/sizing differences after migration.
|
|
103
|
+
|
|
104
|
+
If the project uses custom themes beyond `light`/`dark` (e.g. defined via NativeWind's `vars()` or a custom ThemeProvider), register them with `extraThemes`. Do NOT include `light` or `dark` — they are added automatically:
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
module.exports = withUniwindConfig(config, {
|
|
108
|
+
cssEntryFile: './global.css',
|
|
109
|
+
polyfills: { rem: 14 },
|
|
110
|
+
extraThemes: ['ocean', 'sunset', 'premium'],
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Options:
|
|
115
|
+
- `cssEntryFile` (required): relative path string to CSS entry file (from project root)
|
|
116
|
+
- `polyfills.rem` (required for migration): set to `14` to match NativeWind's rem base
|
|
117
|
+
- `extraThemes` (required if project has custom themes): array of custom theme names — do NOT include `light`/`dark`
|
|
118
|
+
- `dtsFile` (optional): path for generated TypeScript types, defaults to `./uniwind-types.d.ts`
|
|
119
|
+
- `debug` (optional): log unsupported CSS properties during dev
|
|
120
|
+
|
|
121
|
+
## Step 5: Update global.css
|
|
122
|
+
|
|
123
|
+
Replace NativeWind's Tailwind 3 directives with Tailwind 4 imports:
|
|
124
|
+
|
|
125
|
+
**Before:**
|
|
126
|
+
```css
|
|
127
|
+
@tailwind base;
|
|
128
|
+
@tailwind components;
|
|
129
|
+
@tailwind utilities;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**After:**
|
|
133
|
+
```css
|
|
134
|
+
@import 'tailwindcss';
|
|
135
|
+
@import 'uniwind';
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Step 6: Update CSS Entry Import
|
|
139
|
+
|
|
140
|
+
Ensure `global.css` is imported in your main App component (e.g., `App.tsx`), NOT in the root `index.ts`/`index.js` where you register the app — importing there breaks hot reload.
|
|
141
|
+
|
|
142
|
+
## Step 7: Delete NativeWind Type Definitions
|
|
143
|
+
|
|
144
|
+
Delete `nativewind-env.d.ts` or `nativewind.d.ts`. Uniwind auto-generates its own types at the path specified by `dtsFile`.
|
|
145
|
+
|
|
146
|
+
## Step 8: Delete tailwind.config.js
|
|
147
|
+
|
|
148
|
+
Remove `tailwind.config.js` / `tailwind.config.ts` entirely. All theme config moves to CSS using Tailwind 4's `@theme` directive.
|
|
149
|
+
|
|
150
|
+
Migrate custom theme values to `global.css`:
|
|
151
|
+
|
|
152
|
+
**Before (tailwind.config.js):**
|
|
153
|
+
```js
|
|
154
|
+
module.exports = {
|
|
155
|
+
theme: {
|
|
156
|
+
extend: {
|
|
157
|
+
colors: {
|
|
158
|
+
primary: '#00a8ff',
|
|
159
|
+
secondary: '#273c75',
|
|
160
|
+
},
|
|
161
|
+
fontFamily: {
|
|
162
|
+
normal: ['Roboto-Regular'],
|
|
163
|
+
bold: ['Roboto-Bold'],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**After (global.css):**
|
|
171
|
+
```css
|
|
172
|
+
@import 'tailwindcss';
|
|
173
|
+
@import 'uniwind';
|
|
174
|
+
|
|
175
|
+
@theme {
|
|
176
|
+
--color-primary: #00a8ff;
|
|
177
|
+
--color-secondary: #273c75;
|
|
178
|
+
--font-normal: 'Roboto-Regular';
|
|
179
|
+
--font-bold: 'Roboto-Bold';
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Font families must specify a **single font** — React Native doesn't support font fallbacks.
|
|
184
|
+
|
|
185
|
+
## Step 9: Remove ALL cssInterop and remapProps Usage
|
|
186
|
+
|
|
187
|
+
**This is the most commonly missed step.** Search the entire codebase:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
rg "cssInterop|remapProps" -g "*.{ts,tsx,js,jsx}"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Replace every `cssInterop()` / `remapProps()` call with Uniwind's `withUniwind()`:
|
|
194
|
+
|
|
195
|
+
**Before (NativeWind):**
|
|
196
|
+
```tsx
|
|
197
|
+
import { cssInterop } from 'react-native-css-interop';
|
|
198
|
+
import { Image } from 'expo-image';
|
|
199
|
+
|
|
200
|
+
cssInterop(Image, { className: 'style' });
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**After (Uniwind):**
|
|
204
|
+
```tsx
|
|
205
|
+
import { withUniwind } from 'uniwind';
|
|
206
|
+
import { Image as ExpoImage } from 'expo-image';
|
|
207
|
+
|
|
208
|
+
export const Image = withUniwind(ExpoImage);
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`withUniwind` automatically maps `className` → `style` and other common props. For custom prop mappings:
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
const StyledProgressBar = withUniwind(ProgressBar, {
|
|
215
|
+
width: {
|
|
216
|
+
fromClassName: 'widthClassName',
|
|
217
|
+
styleProperty: 'width',
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Define wrapped components at **module level** (not inside render functions). Each component should only be wrapped once:
|
|
223
|
+
|
|
224
|
+
- **Used in one file only** — define the wrapped component in that same file:
|
|
225
|
+
```tsx
|
|
226
|
+
// screens/ProfileScreen.tsx
|
|
227
|
+
import { withUniwind } from 'uniwind';
|
|
228
|
+
import { BlurView as RNBlurView } from '@react-native-community/blur';
|
|
229
|
+
|
|
230
|
+
const BlurView = withUniwind(RNBlurView);
|
|
231
|
+
|
|
232
|
+
export function ProfileScreen() {
|
|
233
|
+
return <BlurView className="flex-1" />;
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
- **Used across multiple files** — wrap once in a shared module and re-export:
|
|
238
|
+
```tsx
|
|
239
|
+
// components/styled.ts
|
|
240
|
+
import { withUniwind } from 'uniwind';
|
|
241
|
+
import { Image as ExpoImage } from 'expo-image';
|
|
242
|
+
import { LinearGradient as RNLinearGradient } from 'expo-linear-gradient';
|
|
243
|
+
|
|
244
|
+
export const Image = withUniwind(ExpoImage);
|
|
245
|
+
export const LinearGradient = withUniwind(RNLinearGradient);
|
|
246
|
+
```
|
|
247
|
+
Then import from the shared module everywhere:
|
|
248
|
+
```tsx
|
|
249
|
+
import { Image, LinearGradient } from '@/components/styled';
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Never call `withUniwind` on the same component in multiple files — wrap once, import everywhere.
|
|
253
|
+
|
|
254
|
+
**IMPORTANT**: Do NOT wrap components from `react-native` or `react-native-reanimated` with `withUniwind` — they already support `className` out of the box. This includes `View`, `Text`, `Image`, `ScrollView`, `FlatList`, `Pressable`, `TextInput`, `Animated.View`, etc. Only use `withUniwind` for **third-party** components (e.g. `expo-image`, `expo-linear-gradient`, `@react-native-community/blur`).
|
|
255
|
+
|
|
256
|
+
**IMPORTANT — accent- prefix for non-style color props**: React Native components have props like `color`, `tintColor`, `backgroundColor` that are NOT part of the `style` object. To set these via Tailwind classes, use the `accent-` prefix with the corresponding `*ClassName` prop:
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
// color prop → colorClassName with accent- prefix
|
|
260
|
+
<ActivityIndicator
|
|
261
|
+
className="m-4"
|
|
262
|
+
size="large"
|
|
263
|
+
colorClassName="accent-blue-500 dark:accent-blue-400"
|
|
264
|
+
/>
|
|
265
|
+
|
|
266
|
+
// color prop on Button
|
|
267
|
+
<Button
|
|
268
|
+
colorClassName="accent-background"
|
|
269
|
+
title="Press me"
|
|
270
|
+
/>
|
|
271
|
+
|
|
272
|
+
// tintColor prop → tintColorClassName with accent- prefix
|
|
273
|
+
<Image
|
|
274
|
+
className="w-6 h-6"
|
|
275
|
+
tintColorClassName="accent-red-500"
|
|
276
|
+
source={icon}
|
|
277
|
+
/>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Rule: `className` accepts any Tailwind utility for style-based props. For non-style props (color, tintColor, etc.), use `{propName}ClassName` with the `accent-` prefix. This applies to all built-in React Native components.
|
|
281
|
+
|
|
282
|
+
## Step 10: Migrate NativeWind Theme Variables
|
|
283
|
+
|
|
284
|
+
**Before (NativeWind JS themes with `vars()`):**
|
|
285
|
+
```tsx
|
|
286
|
+
import { vars } from 'nativewind';
|
|
287
|
+
|
|
288
|
+
export const themes = {
|
|
289
|
+
light: vars({
|
|
290
|
+
'--color-primary': '#00a8ff',
|
|
291
|
+
'--color-typography': '#000',
|
|
292
|
+
}),
|
|
293
|
+
dark: vars({
|
|
294
|
+
'--color-primary': '#273c75',
|
|
295
|
+
'--color-typography': '#fff',
|
|
296
|
+
}),
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// In JSX:
|
|
300
|
+
<View style={themes[colorScheme]}>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**After (Uniwind CSS themes):**
|
|
304
|
+
```css
|
|
305
|
+
@layer theme {
|
|
306
|
+
:root {
|
|
307
|
+
@variant light {
|
|
308
|
+
--color-primary: #00a8ff;
|
|
309
|
+
--color-typography: #000;
|
|
310
|
+
}
|
|
311
|
+
@variant dark {
|
|
312
|
+
--color-primary: #273c75;
|
|
313
|
+
--color-typography: #fff;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**IMPORTANT**: All theme variants must define the exact same set of CSS variables. If `light` defines `--color-primary` and `--color-typography`, then `dark` (and any custom theme) must also define both. Mismatched variables will cause a Uniwind runtime error.
|
|
320
|
+
|
|
321
|
+
No ThemeProvider wrapper needed. Remove the NativeWind `<ThemeProvider>` or `vars()` wrapper from JSX. Keep React Navigation's `<ThemeProvider>` if used.
|
|
322
|
+
|
|
323
|
+
If the project used nested theme wrappers to preview or force a theme for a specific subtree (for example a demo card, settings preview, or side-by-side theme comparison), use Uniwind Pro's `ScopedTheme` instead of changing the global theme:
|
|
324
|
+
```tsx
|
|
325
|
+
import { ScopedTheme } from 'uniwind';
|
|
326
|
+
|
|
327
|
+
<ScopedTheme theme="dark">
|
|
328
|
+
<PreviewCard />
|
|
329
|
+
</ScopedTheme>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
If the project has **custom themes beyond light/dark** (e.g. `ocean`, `premium`), you must:
|
|
333
|
+
1. Define them in CSS using `@variant`:
|
|
334
|
+
```css
|
|
335
|
+
@layer theme {
|
|
336
|
+
:root {
|
|
337
|
+
@variant ocean {
|
|
338
|
+
--color-primary: #0ea5e9;
|
|
339
|
+
--color-background: #0c4a6e;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
2. Register them in metro.config.js via `extraThemes` (skip `light`/`dark` — they are auto-added):
|
|
345
|
+
```js
|
|
346
|
+
module.exports = withUniwindConfig(config, {
|
|
347
|
+
cssEntryFile: './global.css',
|
|
348
|
+
polyfills: { rem: 14 },
|
|
349
|
+
extraThemes: ['ocean', 'premium'],
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Step 11: Migrate Safe Area Utilities
|
|
354
|
+
|
|
355
|
+
NativeWind's safe area classes need explicit setup in Uniwind:
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
import { SafeAreaProvider, SafeAreaListener } from 'react-native-safe-area-context';
|
|
359
|
+
import { Uniwind } from 'uniwind';
|
|
360
|
+
|
|
361
|
+
export default function App() {
|
|
362
|
+
return (
|
|
363
|
+
<SafeAreaProvider>
|
|
364
|
+
<SafeAreaListener
|
|
365
|
+
onChange={({ insets }) => {
|
|
366
|
+
Uniwind.updateInsets(insets);
|
|
367
|
+
}}
|
|
368
|
+
>
|
|
369
|
+
<View className="pt-safe px-safe">
|
|
370
|
+
{/* content */}
|
|
371
|
+
</View>
|
|
372
|
+
</SafeAreaListener>
|
|
373
|
+
</SafeAreaProvider>
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Step 12: Verify rem Value
|
|
379
|
+
|
|
380
|
+
NativeWind uses 14px as the base rem, Uniwind defaults to 16px. Step 4 already sets `polyfills: { rem: 14 }` in metro config to preserve NativeWind's spacing. If the user explicitly wants Uniwind's default (16px), they can remove the polyfill — but warn them that all spacing/sizing will shift.
|
|
381
|
+
|
|
382
|
+
## Step 13: Handle className Deduplication
|
|
383
|
+
|
|
384
|
+
Uniwind does NOT auto-deduplicate conflicting classNames (NativeWind did). If your codebase relies on override patterns like ``className={`p-4 ${overrideClass}`}``, set up a `cn` utility.
|
|
385
|
+
|
|
386
|
+
First, check if the project already has a `cn` helper (common in shadcn/ui projects):
|
|
387
|
+
```bash
|
|
388
|
+
rg "export function cn|export const cn" -g "*.{ts,tsx,js}"
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
If it exists, keep it as-is. If not, install dependencies and create it:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
npm install tailwind-merge clsx
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Create `lib/cn.ts` (or wherever utils live in the project):
|
|
398
|
+
```ts
|
|
399
|
+
import { type ClassValue, clsx } from 'clsx';
|
|
400
|
+
import { twMerge } from 'tailwind-merge';
|
|
401
|
+
|
|
402
|
+
export function cn(...inputs: ClassValue[]) {
|
|
403
|
+
return twMerge(clsx(inputs));
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Usage:
|
|
408
|
+
```tsx
|
|
409
|
+
import { cn } from '@/lib/cn';
|
|
410
|
+
|
|
411
|
+
<View className={cn('p-4 bg-white', props.className)} />
|
|
412
|
+
<Text className={cn('text-base', isActive && 'text-blue-500', disabled && 'opacity-50')} />
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Use `cn` instead of raw `twMerge` — it handles conditional classes, arrays, and falsy values via `clsx` before deduplicating with `tailwind-merge`.
|
|
416
|
+
|
|
417
|
+
Important utilities are also supported in Uniwind. If migrated NativeWind code intentionally forces an override with Tailwind's important modifier, keep it:
|
|
418
|
+
|
|
419
|
+
```tsx
|
|
420
|
+
<View className="bg-blue-500 !bg-red-500" />
|
|
421
|
+
<Pressable className="bg-blue-500 active:!bg-red-500" />
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Important utilities override non-important utilities for the same style property. Inline `style` still has the highest priority, even over important className utilities.
|
|
425
|
+
|
|
426
|
+
## Step 14: Update Animated Class Names
|
|
427
|
+
|
|
428
|
+
If the project used NativeWind `animated-*` / transition class patterns, migrate those to explicit `react-native-reanimated` usage. Uniwind OSS does not provide NativeWind-style animated class behavior.
|
|
429
|
+
|
|
430
|
+
Use this migration guide section as the source of truth:
|
|
431
|
+
- https://docs.uniwind.dev/migration-from-nativewind
|
|
432
|
+
|
|
433
|
+
## Step 15: Clean Up Remaining NativeWind References
|
|
434
|
+
|
|
435
|
+
Final sweep — search for and remove any remaining references:
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
rg "nativewind|NativeWind|native-wind" -g "*.{ts,tsx,js,jsx,json,css}"
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Check for:
|
|
442
|
+
- NativeWind imports in any file
|
|
443
|
+
- `nativewind` in `package.json` (devDependencies too)
|
|
444
|
+
- `react-native-css-interop` in `package.json`
|
|
445
|
+
- NativeWind babel preset in `babel.config.js`
|
|
446
|
+
- NativeWind metro wrapper in `metro.config.js`
|
|
447
|
+
- `nativewind-env.d.ts` or `nativewind.d.ts` files
|
|
448
|
+
- Any `cssInterop()` or `remapProps()` calls
|
|
449
|
+
- Any `vars()` imports from `nativewind`
|
|
450
|
+
|
|
451
|
+
## Uniwind APIs & Patterns
|
|
452
|
+
|
|
453
|
+
### useUniwind — Theme Access (re-renders on change)
|
|
454
|
+
|
|
455
|
+
Docs: https://docs.uniwind.dev/api/use-uniwind
|
|
456
|
+
|
|
457
|
+
```tsx
|
|
458
|
+
import { useUniwind } from 'uniwind';
|
|
459
|
+
|
|
460
|
+
const { theme, hasAdaptiveThemes } = useUniwind();
|
|
461
|
+
// theme: current theme name — "light", "dark", "system", or custom
|
|
462
|
+
// hasAdaptiveThemes: true if app follows system color scheme
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
Use for: displaying theme name in UI, conditional rendering by theme, side effects on theme change.
|
|
466
|
+
|
|
467
|
+
### Uniwind Static API — Theme Access (no re-render)
|
|
468
|
+
|
|
469
|
+
Access theme info without causing re-renders:
|
|
470
|
+
```tsx
|
|
471
|
+
import { Uniwind } from 'uniwind';
|
|
472
|
+
|
|
473
|
+
Uniwind.currentTheme // "light", "dark", "system", or custom
|
|
474
|
+
Uniwind.hasAdaptiveThemes // true if following system color scheme
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Use for: logging, analytics, imperative logic outside render.
|
|
478
|
+
|
|
479
|
+
### useResolveClassNames — Convert classNames to Style Objects
|
|
480
|
+
|
|
481
|
+
Docs: https://docs.uniwind.dev/api/use-resolve-class-names
|
|
482
|
+
|
|
483
|
+
Converts Tailwind classes into React Native style objects. Use when working with components that don't support `className` and can't be wrapped with `withUniwind` (e.g. react-navigation theme config):
|
|
484
|
+
|
|
485
|
+
```tsx
|
|
486
|
+
import { useResolveClassNames } from 'uniwind';
|
|
487
|
+
|
|
488
|
+
const headerStyle = useResolveClassNames('bg-blue-500');
|
|
489
|
+
const cardStyle = useResolveClassNames('bg-white dark:bg-gray-900');
|
|
490
|
+
|
|
491
|
+
<Stack.Navigator
|
|
492
|
+
screenOptions={{
|
|
493
|
+
headerStyle: headerStyle,
|
|
494
|
+
cardStyle: cardStyle,
|
|
495
|
+
}}
|
|
496
|
+
/>
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### useCSSVariable — Access CSS Variables in JS
|
|
500
|
+
|
|
501
|
+
Docs: https://docs.uniwind.dev/api/use-css-variable
|
|
502
|
+
|
|
503
|
+
Retrieve CSS variable values programmatically. Variable must be prefixed with `--` and match a variable defined in `global.css`:
|
|
504
|
+
|
|
505
|
+
```tsx
|
|
506
|
+
import { useCSSVariable } from 'uniwind';
|
|
507
|
+
|
|
508
|
+
const primaryColor = useCSSVariable('--color-primary');
|
|
509
|
+
const spacing = useCSSVariable('--spacing-4');
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
Use for: animations, third-party library configs, calculations with design tokens.
|
|
513
|
+
|
|
514
|
+
### CSS Functions — Custom Utilities
|
|
515
|
+
|
|
516
|
+
Docs: https://docs.uniwind.dev/api/css-functions
|
|
517
|
+
|
|
518
|
+
Define custom utilities using device-aware CSS functions like `hairlineWidth()`, `fontScale()`, `pixelRatio()`. These can be used everywhere (custom CSS classes, `@utility`, etc.) — but NOT inside `@theme {}` (which only accepts static values). Use `@utility` to create reusable Tailwind-style classes:
|
|
519
|
+
|
|
520
|
+
```css
|
|
521
|
+
@utility w-hairline { width: hairlineWidth(); }
|
|
522
|
+
@utility h-hairline { height: hairlineWidth(); }
|
|
523
|
+
@utility border-hairline { border-width: hairlineWidth(); }
|
|
524
|
+
@utility text-scaled { font-size: fontScale(); }
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
Then use as: `<View className="w-hairline h-hairline" />`
|
|
528
|
+
|
|
529
|
+
### Platform Selectors
|
|
530
|
+
|
|
531
|
+
Docs: https://docs.uniwind.dev/api/platform-select
|
|
532
|
+
|
|
533
|
+
Apply styles conditionally per platform using `ios:`, `android:`, `web:`, `native:` prefixes:
|
|
534
|
+
|
|
535
|
+
```tsx
|
|
536
|
+
<View className="ios:bg-red-500 android:bg-blue-500 web:bg-green-500">
|
|
537
|
+
<Text className="ios:text-white android:text-white web:text-black">
|
|
538
|
+
Platform-specific styles
|
|
539
|
+
</Text>
|
|
540
|
+
</View>
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Theme Switching
|
|
544
|
+
|
|
545
|
+
Docs: https://docs.uniwind.dev/theming/basics
|
|
546
|
+
|
|
547
|
+
By default Uniwind follows the system color scheme (adaptive themes). To switch themes programmatically:
|
|
548
|
+
|
|
549
|
+
```tsx
|
|
550
|
+
import { Uniwind } from 'uniwind';
|
|
551
|
+
|
|
552
|
+
Uniwind.setTheme('dark'); // force dark
|
|
553
|
+
Uniwind.setTheme('light'); // force light
|
|
554
|
+
Uniwind.setTheme('system'); // follow system (default)
|
|
555
|
+
Uniwind.setTheme('ocean'); // custom theme (must be in extraThemes)
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### ScopedTheme — Theme a Subtree Only
|
|
559
|
+
|
|
560
|
+
Docs: https://docs.uniwind.dev/api/scoped-themes
|
|
561
|
+
|
|
562
|
+
Use `ScopedTheme` when the project needs a different theme for only part of the UI (component previews, themed sections, nested demos) without changing the app-wide theme:
|
|
563
|
+
|
|
564
|
+
```tsx
|
|
565
|
+
import { ScopedTheme } from 'uniwind';
|
|
566
|
+
|
|
567
|
+
<View className="gap-3">
|
|
568
|
+
<PreviewCard />
|
|
569
|
+
|
|
570
|
+
<ScopedTheme theme="light">
|
|
571
|
+
<PreviewCard />
|
|
572
|
+
</ScopedTheme>
|
|
573
|
+
|
|
574
|
+
<ScopedTheme theme="dark">
|
|
575
|
+
<PreviewCard />
|
|
576
|
+
</ScopedTheme>
|
|
577
|
+
</View>
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
Important behavior:
|
|
581
|
+
- Nearest `ScopedTheme` wins (nested scopes are supported)
|
|
582
|
+
- Hooks like `useUniwind`, `useResolveClassNames`, and `useCSSVariable` resolve against the nearest scoped theme
|
|
583
|
+
- `withUniwind`-wrapped third-party components inside the scope also resolve themed values from that scope
|
|
584
|
+
- Custom theme names can be used in `ScopedTheme` (must be defined in `extraThemes`)
|
|
585
|
+
|
|
586
|
+
### Style Based on Themes — Prefer CSS Variables
|
|
587
|
+
|
|
588
|
+
Docs: https://docs.uniwind.dev/theming/style-based-on-themes
|
|
589
|
+
|
|
590
|
+
**Prefer using CSS variable-based classes over explicit dark:/light: variants.** Instead of:
|
|
591
|
+
```tsx
|
|
592
|
+
// Avoid this pattern
|
|
593
|
+
<View className="light:bg-white dark:bg-black" />
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
Define a CSS variable and use it directly:
|
|
597
|
+
```css
|
|
598
|
+
@layer theme {
|
|
599
|
+
:root {
|
|
600
|
+
@variant light { --color-background: #ffffff; }
|
|
601
|
+
@variant dark { --color-background: #000000; }
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
```
|
|
605
|
+
```tsx
|
|
606
|
+
// Preferred — automatically adapts to theme
|
|
607
|
+
<View className="bg-background" />
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
This is cleaner, easier to maintain, and works automatically with custom themes too.
|
|
611
|
+
|
|
612
|
+
### Runtime CSS Variable Updates
|
|
613
|
+
|
|
614
|
+
Docs: https://docs.uniwind.dev/theming/update-css-variables
|
|
615
|
+
|
|
616
|
+
Update theme variables at runtime, e.g. based on user preferences or API responses:
|
|
617
|
+
|
|
618
|
+
```tsx
|
|
619
|
+
import { Uniwind } from 'uniwind';
|
|
620
|
+
|
|
621
|
+
// Preconfigure theme based on user input or API response
|
|
622
|
+
Uniwind.updateCSSVariables('light', {
|
|
623
|
+
'--color-primary': '#ff6600',
|
|
624
|
+
'--color-background': '#1a1a2e',
|
|
625
|
+
});
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
This pattern should be used only when the app has real runtime theming needs (for example, user-selected brand colors or API-driven themes).
|
|
629
|
+
|
|
630
|
+
### Variants with tailwind-variants
|
|
631
|
+
|
|
632
|
+
Docs: https://docs.uniwind.dev/tailwind-basics#advanced-pattern-variants-and-compound-variants
|
|
633
|
+
|
|
634
|
+
For component variants and compound variants, use the `tailwind-variants` library:
|
|
635
|
+
|
|
636
|
+
```tsx
|
|
637
|
+
import { tv } from 'tailwind-variants';
|
|
638
|
+
|
|
639
|
+
const button = tv({
|
|
640
|
+
base: 'px-4 py-2 rounded-lg',
|
|
641
|
+
variants: {
|
|
642
|
+
color: {
|
|
643
|
+
primary: 'bg-primary text-white',
|
|
644
|
+
secondary: 'bg-secondary text-white',
|
|
645
|
+
},
|
|
646
|
+
size: {
|
|
647
|
+
sm: 'text-sm',
|
|
648
|
+
lg: 'text-lg px-6 py-3',
|
|
649
|
+
},
|
|
650
|
+
},
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
<Pressable className={button({ color: 'primary', size: 'lg' })} />
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
### Monorepo Support
|
|
657
|
+
|
|
658
|
+
Docs: https://docs.uniwind.dev/monorepos
|
|
659
|
+
|
|
660
|
+
If the project is a monorepo, add `@source` directives in `global.css` so Tailwind scans packages outside the CSS entry file's directory (only if that directory has components with Tailwind classes):
|
|
661
|
+
|
|
662
|
+
```css
|
|
663
|
+
@import 'tailwindcss';
|
|
664
|
+
@import 'uniwind';
|
|
665
|
+
@source "../../packages/ui/src";
|
|
666
|
+
@source "../../packages/shared/src";
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### FAQ
|
|
670
|
+
|
|
671
|
+
Docs: https://docs.uniwind.dev/faq
|
|
672
|
+
|
|
673
|
+
**Custom Fonts**: Uniwind maps className to font-family only — font files must be loaded separately (expo-font plugin in `app.json` or `react-native-asset` for bare RN). Font family names in `@theme` must exactly match filenames (without extension). Use `@variant` for per-platform fonts (must be inside `@layer theme { :root { } }`):
|
|
674
|
+
```css
|
|
675
|
+
@layer theme {
|
|
676
|
+
:root {
|
|
677
|
+
@variant ios { --font-sans: 'SF Pro Text'; }
|
|
678
|
+
@variant android { --font-sans: 'Roboto-Regular'; }
|
|
679
|
+
@variant web { --font-sans: 'system-ui'; }
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
**Data Selectors**: Use `data-[prop=value]:utility` for prop-based styling. Only equality checks supported:
|
|
685
|
+
```tsx
|
|
686
|
+
<View data-state={isOpen ? 'open' : 'closed'} className="data-[state=open]:bg-muted/50" />
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
**global.css Location in Expo Router**: Place at project root and import in root layout (`app/_layout.tsx`). If placed in `app/`, components outside need `@source` directives. Tailwind scans from `global.css` location.
|
|
690
|
+
|
|
691
|
+
**Full App Reloads on CSS Changes**: Metro can't hot-reload files with many providers. Move `global.css` import deeper in the component tree (e.g. navigation root or home screen) to fix.
|
|
692
|
+
|
|
693
|
+
**Gradients**: Built-in support, no extra deps needed. Use `bg-gradient-to-r from-red-500 via-yellow-500 to-green-500`. For `expo-linear-gradient`, use `useCSSVariable` to get colors — `withUniwind` won't work since gradient props are arrays.
|
|
694
|
+
|
|
695
|
+
**Style Specificity**: Inline `style` always overrides `className`. Use `className` for static styles, inline only for truly dynamic values. Avoid mixing both for the same property.
|
|
696
|
+
|
|
697
|
+
**Serialization Errors** (`Failed to serialize javascript object`): Clear caches: `watchman watch-del-all 2>/dev/null; rm -rf node_modules/.cache && npx expo start --clear`. Common causes: complex `@theme` configs, circular CSS variable references.
|
|
698
|
+
|
|
699
|
+
**Metro unstable_enablePackageExports Conflicts**: Some apps (crypto etc.) disable this, breaking Uniwind. Use selective resolver:
|
|
700
|
+
```js
|
|
701
|
+
config.resolver.unstable_enablePackageExports = false;
|
|
702
|
+
config.resolver.resolveRequest = (context, moduleName, platform) => {
|
|
703
|
+
if (['uniwind', 'culori'].some((prefix) => moduleName.startsWith(prefix))) {
|
|
704
|
+
return context.resolveRequest({ ...context, unstable_enablePackageExports: true }, moduleName, platform);
|
|
705
|
+
}
|
|
706
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
707
|
+
};
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
**Safe Area Classes**: `p-safe`, `pt-safe`, `pb-safe`, `px-safe`, `py-safe`, `m-safe`, `mt-safe`, etc. Also supports `-or-{value}` (min spacing) and `-offset-{value}` (extra spacing) variants.
|
|
711
|
+
|
|
712
|
+
**Next.js**: Not officially supported. Uniwind is for Metro and Vite. Community plugin: `uniwind-plugin-next`. For Next.js, use standard Tailwind CSS and share design tokens.
|
|
713
|
+
|
|
714
|
+
**Vite**: Supported since v1.2.0. Use `uniwind/vite` plugin alongside `@tailwindcss/vite`.
|
|
715
|
+
|
|
716
|
+
**UI Kits**: HeroUI Native, react-native-reusables and Gluestack 4.1+ works great with Uniwind
|
|
717
|
+
|
|
718
|
+
## Known Issues & Gotchas
|
|
719
|
+
|
|
720
|
+
1. **data-* attributes**: Uniwind supports `data-[prop=value]:utility` syntax for conditional styling, similar to NativeWind.
|
|
721
|
+
2. **Animated styles**: Migrate NativeWind animated classes to `react-native-reanimated` directly. Uniwind Pro has built-in Reanimated support.
|
|
722
|
+
|
|
723
|
+
## Verification
|
|
724
|
+
|
|
725
|
+
After migration, verify:
|
|
726
|
+
1. `npx react-native start --reset-cache` (clear Metro cache) or with expo `npx expo start -c`
|
|
727
|
+
2. All screens render correctly on iOS and Android
|
|
728
|
+
3. Theme switching works (light/dark)
|
|
729
|
+
4. Custom fonts load correctly
|
|
730
|
+
5. Safe area insets apply properly
|
|
731
|
+
6. No console warnings about missing styles
|
|
732
|
+
7. No remaining imports from `nativewind` or `react-native-css-interop`
|
|
733
|
+
|
|
734
|
+
**IMPORTANT**: Do NOT guess Uniwind APIs. If you are unsure about any Uniwind API, hook, component, or configuration option, fetch and verify against the official docs: [https://docs.uniwind.dev/llms-full.txt](https://docs.uniwind.dev/llms-full.txt)
|