nitro_kit 2.0.0.beta.3 → 2.0.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.
Files changed (326) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/LICENSE +21 -28
  4. data/README.md +10 -9
  5. data/app/assets/stylesheets/nitro_kit.css +1660 -1401
  6. data/app/components/nitro_kit/accordion.rb +1 -13
  7. data/app/components/nitro_kit/app_navigation.rb +0 -12
  8. data/app/components/nitro_kit/app_shell.rb +5 -11
  9. data/app/components/nitro_kit/appearance_picker.rb +1 -7
  10. data/app/components/nitro_kit/combobox.rb +366 -21
  11. data/app/components/nitro_kit/command_palette.rb +7 -20
  12. data/app/components/nitro_kit/details_table.rb +5 -11
  13. data/app/components/nitro_kit/dropzone.rb +3 -15
  14. data/app/components/nitro_kit/field.rb +20 -2
  15. data/app/components/nitro_kit/pagination.rb +2 -8
  16. data/app/components/nitro_kit/settings_layout.rb +3 -9
  17. data/app/javascript/controllers/nk/app_shell_controller.js +2 -2
  18. data/app/javascript/controllers/nk/combobox_controller.js +308 -22
  19. data/app/javascript/controllers/nk/combobox_remote.js +70 -0
  20. data/app/javascript/controllers/nk/dropzone_controller.js +2 -2
  21. data/app/javascript/controllers/nk/tabs_controller.js +2 -2
  22. data/config/locales/en.yml +3 -0
  23. data/docs/agent_guide.md +43 -13
  24. data/docs/component_contracts.md +90 -61
  25. data/docs/customization.md +173 -35
  26. data/docs/initialization_prompt.md +4 -5
  27. data/docs/migration_1_to_2.md +10 -8
  28. data/docs/patterns/application_foundation.md +5 -0
  29. data/docs/patterns/composition.md +61 -0
  30. data/docs/patterns/crud_resource.md +5 -0
  31. data/docs/patterns/inset_workspace.md +21 -22
  32. data/docs/patterns/resource_form.md +65 -0
  33. data/docs/rails_integration.md +214 -2
  34. data/lib/generators/nitro_kit/install_generator.rb +5 -4
  35. data/lib/nitro_kit/installation.rb +327 -68
  36. data/lib/nitro_kit/migration_inventory.rb +18 -3
  37. data/lib/nitro_kit/version.rb +1 -1
  38. data/lib/rails/commands/nitro_kit/nitro_kit_command.rb +2 -2
  39. data/patterns/README.md +21 -0
  40. data/patterns/account-settings/files/app/components/ui/account_settings/account_deletion.rb +72 -0
  41. data/patterns/account-settings/files/app/components/ui/account_settings/base.rb +44 -0
  42. data/patterns/account-settings/files/app/components/ui/account_settings/page.rb +57 -0
  43. data/patterns/account-settings/files/app/components/ui/account_settings/preferences.rb +68 -0
  44. data/patterns/account-settings/files/app/components/ui/account_settings/profile.rb +86 -0
  45. data/patterns/account-settings/files/app/components/ui/account_settings/security.rb +69 -0
  46. data/patterns/account-settings/files/app/components/ui/account_settings/sessions.rb +86 -0
  47. data/patterns/account-settings/files/app/controllers/settings/account_deletions_controller.rb +35 -0
  48. data/patterns/account-settings/files/app/controllers/settings/base_controller.rb +12 -0
  49. data/patterns/account-settings/files/app/controllers/settings/other_sessions_controller.rb +8 -0
  50. data/patterns/account-settings/files/app/controllers/settings/preferences_controller.rb +27 -0
  51. data/patterns/account-settings/files/app/controllers/settings/profiles_controller.rb +20 -0
  52. data/patterns/account-settings/files/app/controllers/settings/securities_controller.rb +37 -0
  53. data/patterns/account-settings/files/app/controllers/settings/sessions_controller.rb +31 -0
  54. data/patterns/account-settings/files/app/models/account_settings/account_closure.rb +33 -0
  55. data/patterns/account-settings/files/app/models/account_settings/password_change.rb +42 -0
  56. data/patterns/account-settings/files/app/models/account_settings/session_summary.rb +45 -0
  57. data/patterns/account-settings/files/app/models/concerns/user/account_configurable.rb +18 -0
  58. data/patterns/account-settings/files/config/routes/account_settings.rb +10 -0
  59. data/patterns/account-settings/files/db/migrate/20260731020000_add_account_settings.rb +27 -0
  60. data/patterns/account-settings/files/test/controllers/settings/account_settings_flow_test.rb +84 -0
  61. data/patterns/account-settings/files/test/models/account_settings/password_change_test.rb +40 -0
  62. data/patterns/account-settings/files/test/system/account_settings_test.rb +52 -0
  63. data/patterns/account-settings/item.yml +4 -0
  64. data/patterns/account-settings/pattern.md +44 -0
  65. data/patterns/application-shell/files/app/assets/stylesheets/ui/application_shell.css +267 -0
  66. data/patterns/application-shell/files/app/components/ui/application_shell.rb +184 -0
  67. data/patterns/application-shell/item.yml +4 -0
  68. data/patterns/application-shell/pattern.md +110 -0
  69. data/patterns/authentication/files/app/components/ui/authentication/base.rb +11 -0
  70. data/patterns/authentication/files/app/components/ui/authentication/page.rb +53 -0
  71. data/patterns/authentication/files/app/components/ui/email_verifications/show.rb +62 -0
  72. data/patterns/authentication/files/app/components/ui/password_resets/new.rb +65 -0
  73. data/patterns/authentication/files/app/components/ui/passwords/edit.rb +72 -0
  74. data/patterns/authentication/files/app/components/ui/sessions/new.rb +58 -0
  75. data/patterns/authentication/files/app/components/ui/verification_emails/new.rb +59 -0
  76. data/patterns/authentication/files/app/controllers/concerns/authentication.rb +66 -0
  77. data/patterns/authentication/files/app/controllers/concerns/safe_return_navigation.rb +37 -0
  78. data/patterns/authentication/files/app/controllers/email_verifications_controller.rb +39 -0
  79. data/patterns/authentication/files/app/controllers/password_resets_controller.rb +33 -0
  80. data/patterns/authentication/files/app/controllers/passwords_controller.rb +51 -0
  81. data/patterns/authentication/files/app/controllers/sessions_controller.rb +42 -0
  82. data/patterns/authentication/files/app/controllers/verification_emails_controller.rb +33 -0
  83. data/patterns/authentication/files/app/jobs/authentication_delivery_job.rb +17 -0
  84. data/patterns/authentication/files/app/mailers/authentication_mailer.rb +15 -0
  85. data/patterns/authentication/files/app/models/authentication/credentials.rb +16 -0
  86. data/patterns/authentication/files/app/models/authentication/email_request.rb +17 -0
  87. data/patterns/authentication/files/app/models/concerns/user/email_verifiable.rb +40 -0
  88. data/patterns/authentication/files/app/models/session.rb +5 -0
  89. data/patterns/authentication/files/app/views/authentication_mailer/email_verification.html.erb +3 -0
  90. data/patterns/authentication/files/app/views/authentication_mailer/email_verification.text.erb +5 -0
  91. data/patterns/authentication/files/app/views/authentication_mailer/password_reset.html.erb +3 -0
  92. data/patterns/authentication/files/app/views/authentication_mailer/password_reset.text.erb +5 -0
  93. data/patterns/authentication/files/config/routes/authentication.rb +11 -0
  94. data/patterns/authentication/files/db/migrate/20260731000000_add_authentication_and_recovery.rb +13 -0
  95. data/patterns/authentication/files/test/controllers/authentication_flow_test.rb +103 -0
  96. data/patterns/authentication/files/test/controllers/safe_return_navigation_test.rb +18 -0
  97. data/patterns/authentication/files/test/mailers/authentication_mailer_test.rb +21 -0
  98. data/patterns/authentication/files/test/models/user_email_verifiable_test.rb +36 -0
  99. data/patterns/authentication/files/test/system/authentication_flow_test.rb +23 -0
  100. data/patterns/authentication/item.yml +12 -0
  101. data/patterns/authentication/pattern.md +54 -0
  102. data/patterns/crud-resource/files/app/assets/stylesheets/ui/projects.css +4 -0
  103. data/patterns/crud-resource/files/app/components/ui/projects/form.rb +89 -0
  104. data/patterns/crud-resource/files/app/components/ui/projects/index.rb +161 -0
  105. data/patterns/crud-resource/files/app/components/ui/projects/show.rb +84 -0
  106. data/patterns/crud-resource/files/app/controllers/projects/archivals_controller.rb +23 -0
  107. data/patterns/crud-resource/files/app/controllers/projects_controller.rb +70 -0
  108. data/patterns/crud-resource/files/app/models/project/archival.rb +8 -0
  109. data/patterns/crud-resource/files/app/models/project/event.rb +12 -0
  110. data/patterns/crud-resource/files/app/models/project/filter.rb +41 -0
  111. data/patterns/crud-resource/files/app/models/project.rb +41 -0
  112. data/patterns/crud-resource/files/app/views/projects/edit.html.erb +19 -0
  113. data/patterns/crud-resource/files/app/views/projects/index.html.erb +18 -0
  114. data/patterns/crud-resource/files/app/views/projects/new.html.erb +16 -0
  115. data/patterns/crud-resource/files/app/views/projects/show.html.erb +28 -0
  116. data/patterns/crud-resource/files/config/routes/crud_resource.rb +7 -0
  117. data/patterns/crud-resource/files/db/migrate/20260720000000_create_crud_resource.rb +37 -0
  118. data/patterns/crud-resource/files/test/controllers/projects_controller_test.rb +64 -0
  119. data/patterns/crud-resource/files/test/models/project_test.rb +34 -0
  120. data/patterns/crud-resource/files/test/support/crud_resource_test_helpers.rb +25 -0
  121. data/patterns/crud-resource/files/test/system/projects_crud_test.rb +87 -0
  122. data/patterns/crud-resource/item.yml +6 -0
  123. data/patterns/crud-resource/pattern.md +48 -0
  124. data/patterns/file-uploads/files/app/assets/stylesheets/ui/uploads.css +133 -0
  125. data/patterns/file-uploads/files/app/components/ui/uploads/base.rb +30 -0
  126. data/patterns/file-uploads/files/app/components/ui/uploads/index.rb +188 -0
  127. data/patterns/file-uploads/files/app/components/ui/uploads/page.rb +33 -0
  128. data/patterns/file-uploads/files/app/controllers/uploads/base_controller.rb +29 -0
  129. data/patterns/file-uploads/files/app/controllers/uploads/direct_uploads_controller.rb +55 -0
  130. data/patterns/file-uploads/files/app/controllers/uploads/retries_controller.rb +14 -0
  131. data/patterns/file-uploads/files/app/controllers/uploads_controller.rb +40 -0
  132. data/patterns/file-uploads/files/app/jobs/upload_blob_cleanup_job.rb +9 -0
  133. data/patterns/file-uploads/files/app/jobs/upload_processing_job.rb +10 -0
  134. data/patterns/file-uploads/files/app/jobs/upload_repair_job.rb +17 -0
  135. data/patterns/file-uploads/files/app/models/concerns/team/uploadable.rb +9 -0
  136. data/patterns/file-uploads/files/app/models/upload.rb +295 -0
  137. data/patterns/file-uploads/files/config/recurring/uploads.yml +7 -0
  138. data/patterns/file-uploads/files/config/routes/uploads.rb +5 -0
  139. data/patterns/file-uploads/files/db/migrate/20260802000000_add_file_uploads.rb +30 -0
  140. data/patterns/file-uploads/files/test/controllers/uploads_flow_test.rb +77 -0
  141. data/patterns/file-uploads/files/test/fixtures/files/workspace.png.base64 +1 -0
  142. data/patterns/file-uploads/files/test/fixtures/uploads.yml +17 -0
  143. data/patterns/file-uploads/files/test/models/upload_test.rb +55 -0
  144. data/patterns/file-uploads/files/test/system/file_uploads_test.rb +30 -0
  145. data/patterns/file-uploads/item.yml +4 -0
  146. data/patterns/file-uploads/pattern.md +71 -0
  147. data/patterns/nitro-kit-1-upgrade/files/docs/nitro_kit_1_upgrade.md +57 -0
  148. data/patterns/nitro-kit-1-upgrade/item.yml +4 -0
  149. data/patterns/nitro-kit-1-upgrade/pattern.md +30 -0
  150. data/patterns/onboarding/files/app/assets/stylesheets/ui/onboarding.css +55 -0
  151. data/patterns/onboarding/files/app/components/ui/onboarding/base.rb +11 -0
  152. data/patterns/onboarding/files/app/components/ui/onboarding/branch_form.rb +36 -0
  153. data/patterns/onboarding/files/app/components/ui/onboarding/details_form.rb +67 -0
  154. data/patterns/onboarding/files/app/components/ui/onboarding/invitation_plan_form.rb +48 -0
  155. data/patterns/onboarding/files/app/components/ui/onboarding/page.rb +75 -0
  156. data/patterns/onboarding/files/app/components/ui/onboarding/review.rb +51 -0
  157. data/patterns/onboarding/files/app/components/ui/onboarding/show.rb +32 -0
  158. data/patterns/onboarding/files/app/controllers/concerns/requires_finished_onboarding.rb +14 -0
  159. data/patterns/onboarding/files/app/controllers/onboarding/base_controller.rb +30 -0
  160. data/patterns/onboarding/files/app/controllers/onboarding/branches_controller.rb +16 -0
  161. data/patterns/onboarding/files/app/controllers/onboarding/completions_controller.rb +13 -0
  162. data/patterns/onboarding/files/app/controllers/onboarding/details_controller.rb +16 -0
  163. data/patterns/onboarding/files/app/controllers/onboarding/invitation_plans_controller.rb +20 -0
  164. data/patterns/onboarding/files/app/controllers/onboardings_controller.rb +7 -0
  165. data/patterns/onboarding/files/app/jobs/onboarding_invitation_delivery_job.rb +15 -0
  166. data/patterns/onboarding/files/app/models/concerns/team/onboardable.rb +23 -0
  167. data/patterns/onboarding/files/app/models/onboarding/completion.rb +17 -0
  168. data/patterns/onboarding/files/app/models/onboarding/invitation_delivery.rb +14 -0
  169. data/patterns/onboarding/files/app/models/onboarding.rb +174 -0
  170. data/patterns/onboarding/files/config/routes/onboarding.rb +11 -0
  171. data/patterns/onboarding/files/db/migrate/20260731010000_create_onboarding.rb +60 -0
  172. data/patterns/onboarding/files/test/controllers/onboarding_flow_test.rb +62 -0
  173. data/patterns/onboarding/files/test/fixtures/onboarding_completions.yml +3 -0
  174. data/patterns/onboarding/files/test/fixtures/onboardings.yml +25 -0
  175. data/patterns/onboarding/files/test/jobs/onboarding_invitation_delivery_job_test.rb +18 -0
  176. data/patterns/onboarding/files/test/models/onboarding_test.rb +60 -0
  177. data/patterns/onboarding/files/test/system/onboarding_flow_test.rb +39 -0
  178. data/patterns/onboarding/item.yml +4 -0
  179. data/patterns/onboarding/pattern.md +53 -0
  180. data/patterns/subscription-billing/files/app/components/ui/billing/base.rb +39 -0
  181. data/patterns/subscription-billing/files/app/components/ui/billing/checkout_result.rb +64 -0
  182. data/patterns/subscription-billing/files/app/components/ui/billing/page.rb +33 -0
  183. data/patterns/subscription-billing/files/app/components/ui/billing/show.rb +149 -0
  184. data/patterns/subscription-billing/files/app/controllers/billing/base_controller.rb +16 -0
  185. data/patterns/subscription-billing/files/app/controllers/billing/checkouts_controller.rb +65 -0
  186. data/patterns/subscription-billing/files/app/controllers/billing/portals_controller.rb +18 -0
  187. data/patterns/subscription-billing/files/app/controllers/billing_controller.rb +17 -0
  188. data/patterns/subscription-billing/files/app/controllers/webhooks/stripe_events_controller.rb +21 -0
  189. data/patterns/subscription-billing/files/app/jobs/billing/stripe_event_job.rb +16 -0
  190. data/patterns/subscription-billing/files/app/jobs/billing/subscription_reconciliation_job.rb +16 -0
  191. data/patterns/subscription-billing/files/app/jobs/billing/subscription_reconciliation_sweep_job.rb +9 -0
  192. data/patterns/subscription-billing/files/app/models/billing/checkout.rb +58 -0
  193. data/patterns/subscription-billing/files/app/models/billing/plan.rb +19 -0
  194. data/patterns/subscription-billing/files/app/models/billing/stripe_event.rb +73 -0
  195. data/patterns/subscription-billing/files/app/models/billing/subscription.rb +106 -0
  196. data/patterns/subscription-billing/files/app/models/concerns/team/billable.rb +36 -0
  197. data/patterns/subscription-billing/files/config/initializers/stripe.rb +29 -0
  198. data/patterns/subscription-billing/files/config/routes/subscription_billing.rb +10 -0
  199. data/patterns/subscription-billing/files/db/migrate/20260801000000_add_subscription_billing.rb +61 -0
  200. data/patterns/subscription-billing/files/test/controllers/billing_flow_test.rb +60 -0
  201. data/patterns/subscription-billing/files/test/models/billing/subscription_test.rb +40 -0
  202. data/patterns/subscription-billing/files/test/system/subscription_billing_test.rb +28 -0
  203. data/patterns/subscription-billing/item.yml +4 -0
  204. data/patterns/subscription-billing/pattern.md +59 -0
  205. data/patterns/team-management/files/app/components/ui/invitations/acceptance.rb +33 -0
  206. data/patterns/team-management/files/app/components/ui/teams/index.rb +87 -0
  207. data/patterns/team-management/files/app/components/ui/teams/invitation_form.rb +51 -0
  208. data/patterns/team-management/files/app/components/ui/teams/member_form.rb +78 -0
  209. data/patterns/team-management/files/app/components/ui/teams/members.rb +125 -0
  210. data/patterns/team-management/files/app/controllers/invitations/acceptances_controller.rb +29 -0
  211. data/patterns/team-management/files/app/controllers/teams/base_controller.rb +18 -0
  212. data/patterns/team-management/files/app/controllers/teams/invitations_controller.rb +42 -0
  213. data/patterns/team-management/files/app/controllers/teams/memberships_controller.rb +53 -0
  214. data/patterns/team-management/files/app/controllers/teams_controller.rb +30 -0
  215. data/patterns/team-management/files/app/mailers/team_invitation_mailer.rb +10 -0
  216. data/patterns/team-management/files/app/models/concerns/current_team.rb +13 -0
  217. data/patterns/team-management/files/app/models/concerns/user_teams.rb +37 -0
  218. data/patterns/team-management/files/app/models/invitation.rb +41 -0
  219. data/patterns/team-management/files/app/models/membership.rb +45 -0
  220. data/patterns/team-management/files/app/models/team.rb +25 -0
  221. data/patterns/team-management/files/app/views/invitations/acceptances/show.html.erb +1 -0
  222. data/patterns/team-management/files/app/views/team_invitation_mailer/invite.html.erb +10 -0
  223. data/patterns/team-management/files/app/views/team_invitation_mailer/invite.text.erb +7 -0
  224. data/patterns/team-management/files/app/views/teams/index.html.erb +15 -0
  225. data/patterns/team-management/files/app/views/teams/invitations/new.html.erb +22 -0
  226. data/patterns/team-management/files/app/views/teams/memberships/edit.html.erb +22 -0
  227. data/patterns/team-management/files/app/views/teams/memberships/index.html.erb +20 -0
  228. data/patterns/team-management/files/config/routes/team_management.rb +11 -0
  229. data/patterns/team-management/files/db/migrate/20260717000000_create_team_management.rb +31 -0
  230. data/patterns/team-management/files/test/models/invitation_test.rb +28 -0
  231. data/patterns/team-management/files/test/models/membership_test.rb +29 -0
  232. data/patterns/team-management/files/test/models/team_test.rb +31 -0
  233. data/patterns/team-management/files/test/support/team_management_test_helpers.rb +22 -0
  234. data/patterns/team-management/item.yml +4 -0
  235. data/patterns/team-management/pattern.md +47 -0
  236. data/patterns/webhook-deliveries/files/app/assets/stylesheets/ui/webhooks.css +179 -0
  237. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/base.rb +38 -0
  238. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/delivery.rb +160 -0
  239. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/endpoint.rb +149 -0
  240. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/form.rb +75 -0
  241. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/index.rb +142 -0
  242. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/page.rb +33 -0
  243. data/patterns/webhook-deliveries/files/app/components/ui/webhooks/secret.rb +38 -0
  244. data/patterns/webhook-deliveries/files/app/controllers/webhook_deliveries/replays_controller.rb +13 -0
  245. data/patterns/webhook-deliveries/files/app/controllers/webhook_deliveries_controller.rb +7 -0
  246. data/patterns/webhook-deliveries/files/app/controllers/webhook_endpoints/secrets_controller.rb +41 -0
  247. data/patterns/webhook-deliveries/files/app/controllers/webhook_endpoints_controller.rb +67 -0
  248. data/patterns/webhook-deliveries/files/app/controllers/webhooks/base_controller.rb +15 -0
  249. data/patterns/webhook-deliveries/files/app/jobs/webhook_delivery_job.rb +9 -0
  250. data/patterns/webhook-deliveries/files/app/jobs/webhook_delivery_repair_job.rb +11 -0
  251. data/patterns/webhook-deliveries/files/app/models/concerns/team/webhookable.rb +11 -0
  252. data/patterns/webhook-deliveries/files/app/models/webhook/attempt.rb +30 -0
  253. data/patterns/webhook-deliveries/files/app/models/webhook/delivery.rb +268 -0
  254. data/patterns/webhook-deliveries/files/app/models/webhook/endpoint.rb +58 -0
  255. data/patterns/webhook-deliveries/files/app/models/webhook/event.rb +98 -0
  256. data/patterns/webhook-deliveries/files/app/models/webhook/secret_reveal.rb +53 -0
  257. data/patterns/webhook-deliveries/files/app/models/webhook/signature.rb +22 -0
  258. data/patterns/webhook-deliveries/files/app/models/webhook/transport.rb +176 -0
  259. data/patterns/webhook-deliveries/files/app/views/webhook_deliveries/show.html.erb +5 -0
  260. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/edit.html.erb +1 -0
  261. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/index.html.erb +6 -0
  262. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/new.html.erb +1 -0
  263. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/secrets/new.html.erb +1 -0
  264. data/patterns/webhook-deliveries/files/app/views/webhook_endpoints/show.html.erb +7 -0
  265. data/patterns/webhook-deliveries/files/config/recurring/webhooks.yml +4 -0
  266. data/patterns/webhook-deliveries/files/config/routes/webhook_deliveries.rb +10 -0
  267. data/patterns/webhook-deliveries/files/db/migrate/20260803000000_add_webhook_deliveries.rb +126 -0
  268. data/patterns/webhook-deliveries/files/test/controllers/webhook_endpoints_flow_test.rb +48 -0
  269. data/patterns/webhook-deliveries/files/test/models/webhook/delivery_test.rb +70 -0
  270. data/patterns/webhook-deliveries/files/test/system/webhook_deliveries_test.rb +29 -0
  271. data/patterns/webhook-deliveries/item.yml +4 -0
  272. data/patterns/webhook-deliveries/pattern.md +120 -0
  273. data/plugins/nitro-kit/.codex-plugin/plugin.json +4 -4
  274. data/plugins/nitro-kit/skills/nitro-kit-hotwire/SKILL.md +7 -9
  275. data/plugins/nitro-kit/skills/nitro-kit-hotwire/agents/openai.yaml +1 -1
  276. data/plugins/nitro-kit/skills/nitro-kit-rails/SKILL.md +10 -9
  277. data/plugins/nitro-kit/skills/nitro-kit-rails/agents/openai.yaml +1 -1
  278. data/plugins/nitro-kit/skills/nitro-kit-ui/SKILL.md +27 -16
  279. data/plugins/nitro-kit/skills/nitro-kit-ui/agents/openai.yaml +1 -1
  280. data/src/stylesheets/nitro_kit/components/accordion.css +40 -40
  281. data/src/stylesheets/nitro_kit/components/alert.css +7 -6
  282. data/src/stylesheets/nitro_kit/components/app_navigation.css +50 -41
  283. data/src/stylesheets/nitro_kit/components/app_shell.css +371 -280
  284. data/src/stylesheets/nitro_kit/components/appearance_picker.css +38 -38
  285. data/src/stylesheets/nitro_kit/components/avatar.css +3 -3
  286. data/src/stylesheets/nitro_kit/components/avatar_stack.css +18 -18
  287. data/src/stylesheets/nitro_kit/components/badge.css +5 -2
  288. data/src/stylesheets/nitro_kit/components/button.css +57 -49
  289. data/src/stylesheets/nitro_kit/components/button_group.css +14 -14
  290. data/src/stylesheets/nitro_kit/components/checkbox.css +24 -24
  291. data/src/stylesheets/nitro_kit/components/checkbox_group.css +13 -13
  292. data/src/stylesheets/nitro_kit/components/combobox.css +152 -25
  293. data/src/stylesheets/nitro_kit/components/command_palette.css +59 -59
  294. data/src/stylesheets/nitro_kit/components/control_group.css +71 -54
  295. data/src/stylesheets/nitro_kit/components/details_table.css +9 -9
  296. data/src/stylesheets/nitro_kit/components/dialog.css +8 -12
  297. data/src/stylesheets/nitro_kit/components/dropdown.css +22 -26
  298. data/src/stylesheets/nitro_kit/components/dropzone.css +97 -100
  299. data/src/stylesheets/nitro_kit/components/empty_state.css +1 -0
  300. data/src/stylesheets/nitro_kit/components/field.css +26 -30
  301. data/src/stylesheets/nitro_kit/components/fieldset.css +2 -2
  302. data/src/stylesheets/nitro_kit/components/input.css +6 -14
  303. data/src/stylesheets/nitro_kit/components/layout.css +165 -165
  304. data/src/stylesheets/nitro_kit/components/page_header.css +3 -3
  305. data/src/stylesheets/nitro_kit/components/pagination.css +66 -49
  306. data/src/stylesheets/nitro_kit/components/pagination_bar.css +6 -6
  307. data/src/stylesheets/nitro_kit/components/palette.css +24 -22
  308. data/src/stylesheets/nitro_kit/components/progressive_image.css +38 -41
  309. data/src/stylesheets/nitro_kit/components/radio_button.css +19 -19
  310. data/src/stylesheets/nitro_kit/components/radio_button_group.css +43 -43
  311. data/src/stylesheets/nitro_kit/components/rich_text_area.css +4 -4
  312. data/src/stylesheets/nitro_kit/components/select.css +2 -2
  313. data/src/stylesheets/nitro_kit/components/settings_layout.css +17 -18
  314. data/src/stylesheets/nitro_kit/components/settings_section.css +12 -12
  315. data/src/stylesheets/nitro_kit/components/sheet.css +10 -10
  316. data/src/stylesheets/nitro_kit/components/stat_grid.css +9 -9
  317. data/src/stylesheets/nitro_kit/components/switch.css +23 -23
  318. data/src/stylesheets/nitro_kit/components/table.css +27 -27
  319. data/src/stylesheets/nitro_kit/components/tabs.css +32 -34
  320. data/src/stylesheets/nitro_kit/components/toolbar.css +6 -6
  321. data/src/stylesheets/nitro_kit/components/tooltip.css +26 -28
  322. data/src/stylesheets/nitro_kit/layers.css +2 -1
  323. data/src/stylesheets/nitro_kit/reset.css +9 -9
  324. data/src/stylesheets/nitro_kit/tailwind.css +6 -2
  325. data/src/stylesheets/nitro_kit/tokens.css +18 -9
  326. metadata +238 -2
@@ -213,6 +213,35 @@ script-src 'self' 'sha256-Vcime4euWSeYtHSfjYjqz/XhRyzMcLpn6Ip2LlaHleY='
213
213
 
214
214
  The value is also available as `NitroKit::AppearanceBootstrap::CSP_HASH`. The default preference is stored in a data attribute, so changing `default:` does not change the hash. Recheck the constant when upgrading because an intentional runtime change produces a new hash.
215
215
 
216
+ ## Named themes
217
+
218
+ Nitro's palettes follow `data-theme="light"` and `data-theme="dark"`, the two
219
+ values `AppearanceBootstrap` writes. An application that already owns
220
+ `data-theme`, such as a daisyUI app with `night` and `lofi`, declares which
221
+ palette each named theme uses with `data-nk-scheme` on the same element:
222
+
223
+ ```html
224
+ <html data-theme="night" data-nk-scheme="dark">
225
+ <body>
226
+ <section data-theme="lofi" data-nk-scheme="light">…</section>
227
+ </body>
228
+ </html>
229
+ ```
230
+
231
+ `data-nk-scheme` accepts `light` or `dark`. When an element carries both
232
+ attributes, `data-nk-scheme` decides, so `data-theme="dark"
233
+ data-nk-scheme="light"` renders the light palette. A root with neither
234
+ attribute follows `prefers-color-scheme`; a root with only an unrecognized
235
+ `data-theme`, such as `night`, keeps the light palette, which is why the hint
236
+ is required. The attribute also works on a subtree, exactly like `data-theme`.
237
+
238
+ Set the hint wherever the application sets its theme name, server-rendered or
239
+ in its own theme switcher. Do not combine a theme switcher that writes named
240
+ themes with `AppearanceBootstrap`: the bootstrap owns `data-theme` on the root
241
+ and overwrites it with `light` or `dark`. Application token overrides for a
242
+ named theme select the scheme rather than the name, for example
243
+ `[data-nk-scheme="dark"]` alongside `[data-theme="dark"]`.
244
+
216
245
  ## Choosing a theme
217
246
 
218
247
  Treat related tokens as a system:
@@ -226,12 +255,109 @@ Treat related tokens as a system:
226
255
 
227
256
  Check foreground pairs and focus indicators for contrast in both appearances. The semantic names describe use, not a fixed hue: `destructive` can be a project-appropriate red, but it should remain recognizably destructive everywhere it appears.
228
257
 
258
+ ## Bridging an existing theme
259
+
260
+ An application that already has a theme owner, such as daisyUI, can make Nitro
261
+ read that theme instead of maintaining two palettes. This walkthrough bridges a
262
+ daisyUI `night` theme. The same steps apply to any named theme.
263
+
264
+ 1. Mark the scheme. Without it, `night` renders Nitro's light palette, and
265
+ light-palette status text on a dark surface lands near 2:1 contrast.
266
+
267
+ ```html
268
+ <html data-theme="night" data-nk-scheme="dark">
269
+ …
270
+ </html>
271
+ ```
272
+
273
+ 2. Map the host's surface, text, and accent tokens onto Nitro's. Declare the
274
+ bridge unlayered, after Nitro Kit, on the element that carries the theme
275
+ name:
276
+
277
+ ```css
278
+ [data-theme="night"] {
279
+ --nk-color-canvas: var(--color-base-100);
280
+ --nk-color-surface: var(--color-base-200);
281
+ --nk-color-elevated: var(--color-base-300);
282
+ --nk-color-foreground: var(--color-base-content);
283
+ --nk-color-muted: var(--color-base-300);
284
+ --nk-color-muted-foreground: color-mix(
285
+ in oklab,
286
+ var(--color-base-content) 65%,
287
+ var(--color-base-100)
288
+ );
289
+ --nk-color-border: var(--color-base-300);
290
+ --nk-color-primary: var(--color-primary);
291
+ --nk-color-primary-foreground: var(--color-primary-content);
292
+ --nk-color-focus: var(--color-primary);
293
+ }
294
+ ```
295
+
296
+ Bridging `--color-primary` this way meets Nitro's reverse alias, which sets
297
+ `--color-primary` from `--nk-color-primary`. Opt out of that alias, as shown
298
+ in [Tailwind CSS v4 theme aliases](#tailwind-css-v4-theme-aliases), or the
299
+ two declarations form a cycle and both become invalid.
300
+
301
+ 3. Map status colors. Fills (`--nk-color-{family}`) can take the host's status
302
+ colors directly. Status text is different: daisyUI's `--color-success` is a
303
+ fill meant for `--color-success-content` text on top of it, while Nitro's
304
+ `-content` tokens are text drawn on the page surface. Do not map
305
+ `--color-success-content` to `--nk-color-success-content`; that is the
306
+ fill's foreground, usually near-black, and it disappears on a dark surface.
307
+ Mix the host's status color toward the host's text color instead:
308
+
309
+ ```css
310
+ [data-theme="night"] {
311
+ --nk-color-success: var(--color-success);
312
+ --nk-color-warning: var(--color-warning);
313
+ --nk-color-destructive: var(--color-error);
314
+ --nk-color-destructive-foreground: var(--color-error-content);
315
+
316
+ --nk-color-success-content: color-mix(
317
+ in oklab,
318
+ var(--color-success) 60%,
319
+ var(--color-base-content)
320
+ );
321
+ --nk-color-warning-content: color-mix(
322
+ in oklab,
323
+ var(--color-warning) 60%,
324
+ var(--color-base-content)
325
+ );
326
+ --nk-color-destructive-content: color-mix(
327
+ in oklab,
328
+ var(--color-error) 60%,
329
+ var(--color-base-content)
330
+ );
331
+
332
+ --nk-palette-success: var(--color-success);
333
+ --nk-palette-success-content: var(--nk-color-success-content);
334
+ --nk-palette-warning: var(--color-warning);
335
+ --nk-palette-warning-content: var(--nk-color-warning-content);
336
+ --nk-palette-destructive: var(--color-error);
337
+ --nk-palette-destructive-content: var(--nk-color-destructive-content);
338
+ }
339
+ ```
340
+
341
+ `--nk-color-destructive-content` colors field errors; the
342
+ `--nk-palette-*-content` tokens color Badge, Alert, and Toast text over
343
+ their tinted surfaces. Repeat for `info` and `neutral` when the host has
344
+ matching colors.
345
+
346
+ 4. Check contrast in the rendered page, not in the token file. Render a field
347
+ error, then a success, warning, and destructive Badge and Alert, on the
348
+ canvas and inside a Card. In the browser inspector, pick each text element
349
+ and read the contrast ratio the color picker reports against its actual
350
+ background. Aim for at least 4.5:1 for text and 3:1 for focus rings and
351
+ icons. Adjust the mix percentage per theme until every pair passes, then
352
+ repeat for each named theme the application ships.
353
+
229
354
  ## Theme customizer
230
355
 
231
356
  The interactive theme customizer lives at
232
- [nitrokit.dev/customize](https://nitrokit.dev/customize). It previews accent,
233
- neutral, radius, density, typography, and appearance choices, then copies the
234
- changed public tokens.
357
+ [gallery.nitrokit.dev/gallery/customize](https://gallery.nitrokit.dev/gallery/customize).
358
+ It previews accent colors (including custom brand ramps), neutral scales,
359
+ radius, density, typography, shell layout, and appearance choices, then copies
360
+ the changed public tokens.
235
361
 
236
362
  Paste the CSS into an application-owned stylesheet such as `app/assets/stylesheets/nitro_theme.css`, then load that stylesheet after Nitro Kit and any compiled Tailwind CSS:
237
363
 
@@ -494,7 +620,19 @@ canonical no-JavaScript matrix in [`browser_support.md`](browser_support.md).
494
620
 
495
621
  ## Tailwind CSS v4 theme aliases
496
622
 
497
- Nitro Kit does not require Tailwind, Tailwind configuration, or Tailwind Preflight — it ships its own global preflight in the `nitro-kit.reset` cascade layer, which unlayered application CSS always overrides. For applications that do compile Tailwind, `nitro_kit.css` establishes a compatible cascade-layer order and maps Nitro tokens to common Tailwind v4 theme variables, including background, foreground, primary, destructive, radii, shadows, fonts, spacing, and transition defaults. The aliases live in `src/stylesheets/nitro_kit/tailwind.css` inside the `nitro-kit.tokens` layer; without Tailwind they are inert custom properties.
623
+ Nitro Kit does not require Tailwind, Tailwind configuration, or Tailwind Preflight — it ships its own global preflight in the `nitro-kit.reset` cascade layer, which unlayered application CSS always overrides. For applications that do compile Tailwind, `nitro_kit.css` establishes a compatible cascade-layer order and maps Nitro tokens to common Tailwind v4 theme variables, including background, foreground, primary, destructive, radii, shadows, fonts, spacing, and transition defaults. The aliases live in `src/stylesheets/nitro_kit/tailwind.css` inside their own `nitro-kit.aliases` layer, on `:root` and on every element carrying `data-theme` or `data-nk-scheme`; without Tailwind they are inert custom properties.
624
+
625
+ The aliases point from Tailwind to Nitro: `--color-primary` reads `--nk-color-primary`. An application whose theme already defines one of those Tailwind variables, and which bridges Nitro onto it, must drop that alias. Declare `revert-layer` for the alias inside the `nitro-kit.aliases` layer:
626
+
627
+ ```css
628
+ @layer nitro-kit.aliases {
629
+ [data-theme="night"] {
630
+ --color-primary: revert-layer;
631
+ }
632
+ }
633
+ ```
634
+
635
+ `revert-layer` discards Nitro's alias for that property only, so the value falls back to whatever earlier layer defined it, such as Tailwind's `theme` layer or a daisyUI theme in `base`, and every other alias keeps working. List one declaration per alias the application's theme owns; in the [bridging walkthrough](#bridging-an-existing-theme) that is only `--color-primary`. It has to sit inside `nitro-kit.aliases`: an unlayered `revert-layer` reverts to the layered cascade, which includes the alias, and the cycle remains. The selector needs at least the specificity of one attribute, which `[data-theme="night"]` or `:root` already has.
498
636
 
499
637
  Tailwind remains compiled and configured by the application. An application can add further aliases in its Tailwind CSS source with the v4 CSS-first API:
500
638
 
@@ -516,37 +654,37 @@ The following variables are the complete public token set. Theme-independent tok
516
654
 
517
655
  ### Typography
518
656
 
519
- | Token | Role |
520
- | --------------------------- | -------------------------------------------------------------------- |
521
- | `--nk-font-sans` | Default UI font family. |
522
- | `--nk-font-mono` | Monospace font family. |
523
- | `--nk-text-xs` | Extra-small text size. |
524
- | `--nk-text-sm` | Small text size. |
525
- | `--nk-text-base` | Base text size. |
526
- | `--nk-text-lg` | Large text size. |
527
- | `--nk-text-xl` | Extra-large text size. |
528
- | `--nk-text-2xl` | Largest shipped display text size. |
529
- | `--nk-leading-tight` | Tight line-height ratio. |
530
- | `--nk-leading-normal` | Default line-height ratio. |
531
- | `--nk-leading-relaxed` | Relaxed line-height ratio. |
532
- | `--nk-font-weight-normal` | Normal text weight. |
533
- | `--nk-font-weight-medium` | Medium text weight. |
534
- | `--nk-font-weight-semibold` | Semibold text weight. |
535
- | `--nk-font-weight-bold` | Bold text weight. |
536
- | `--nk-title-page-size` | Page title size; the one top-level heading. |
537
- | `--nk-title-page-weight` | Page title weight. |
538
- | `--nk-title-section-size` | Section title size: data, settings, and danger sections. |
539
- | `--nk-title-section-weight` | Section title weight. |
540
- | `--nk-title-surface-size` | Surface title size: dialogs, sheets, empty states, fieldsets. |
541
- | `--nk-title-surface-weight` | Surface title weight. |
542
- | `--nk-title-compact-size` | Compact title size: legends, alert and toast titles. |
543
- | `--nk-title-compact-weight` | Compact title weight. |
544
- | `--nk-typeset-font-body` | Typeset body font family. |
545
- | `--nk-typeset-font-heading` | Typeset heading font family. |
546
- | `--nk-typeset-font-mono` | Typeset code font family. |
547
- | `--nk-typeset-size` | Typeset base text size. |
548
- | `--nk-typeset-leading` | Typeset body line-height ratio. |
549
- | `--nk-typeset-flow` | Typeset vertical rhythm unit. |
657
+ | Token | Role |
658
+ | --------------------------- | ------------------------------------------------------------- |
659
+ | `--nk-font-sans` | Default UI font family. |
660
+ | `--nk-font-mono` | Monospace font family. |
661
+ | `--nk-text-xs` | Extra-small text size. |
662
+ | `--nk-text-sm` | Small text size. |
663
+ | `--nk-text-base` | Base text size. |
664
+ | `--nk-text-lg` | Large text size. |
665
+ | `--nk-text-xl` | Extra-large text size. |
666
+ | `--nk-text-2xl` | Largest shipped display text size. |
667
+ | `--nk-leading-tight` | Tight line-height ratio. |
668
+ | `--nk-leading-normal` | Default line-height ratio. |
669
+ | `--nk-leading-relaxed` | Relaxed line-height ratio. |
670
+ | `--nk-font-weight-normal` | Normal text weight. |
671
+ | `--nk-font-weight-medium` | Medium text weight. |
672
+ | `--nk-font-weight-semibold` | Semibold text weight. |
673
+ | `--nk-font-weight-bold` | Bold text weight. |
674
+ | `--nk-title-page-size` | Page title size; the one top-level heading. |
675
+ | `--nk-title-page-weight` | Page title weight. |
676
+ | `--nk-title-section-size` | Section title size: data, settings, and danger sections. |
677
+ | `--nk-title-section-weight` | Section title weight. |
678
+ | `--nk-title-surface-size` | Surface title size: dialogs, sheets, empty states, fieldsets. |
679
+ | `--nk-title-surface-weight` | Surface title weight. |
680
+ | `--nk-title-compact-size` | Compact title size: legends, alert and toast titles. |
681
+ | `--nk-title-compact-weight` | Compact title weight. |
682
+ | `--nk-typeset-font-body` | Typeset body font family. |
683
+ | `--nk-typeset-font-heading` | Typeset heading font family. |
684
+ | `--nk-typeset-font-mono` | Typeset code font family. |
685
+ | `--nk-typeset-size` | Typeset base text size. |
686
+ | `--nk-typeset-leading` | Typeset body line-height ratio. |
687
+ | `--nk-typeset-flow` | Typeset vertical rhythm unit. |
550
688
 
551
689
  ### Spacing and dimensions
552
690
 
@@ -6,11 +6,10 @@
6
6
  `2.`.
7
7
  2. Choose the project-local Nitro Kit skill matching the task. It will resolve
8
8
  and read the installed, version-matched `docs/agent_guide.md`.
9
- 3. For greenfield planning or broad product work, check whether Nitro Kit
10
- catalog or MCP tools are available. When available, inventory and search by
11
- product workflow, retrieve relevant patterns, and state what will be used,
12
- adapted, or deferred. When unavailable, continue with the bundled guidance;
13
- catalog access is optional and must never block the work.
9
+ 3. For greenfield planning or broad product work, browse the bundled patterns
10
+ under `patterns/` in the installed gem (`patterns/README.md`) by product
11
+ workflow, read the relevant `pattern.md` guides and reference files, and
12
+ state what will be used, adapted, or deferred.
14
13
  4. Inspect the application before editing. Preserve established view, asset,
15
14
  authentication, and testing conventions unless the task changes them.
16
15
  5. For a greenfield application, run `bin/rails generate phlex:install` and use
@@ -7,12 +7,12 @@ Treat a 1.x migration as a product-flow review, not a helper rename. Nitro Kit
7
7
  2 deliberately removed copied components, `nk_*` helpers, application-owned
8
8
  `controllers/nk`, and unrestricted utility-class customization.
9
9
 
10
- ## Install the 2.0 prerelease before migrating
10
+ ## Install Nitro Kit 2.0 before migrating
11
11
 
12
- Add the 2.0 prerelease to the application's Gemfile:
12
+ Add Nitro Kit 2.0 to the application's Gemfile:
13
13
 
14
14
  ```ruby
15
- gem "nitro_kit", "2.0.0.beta.3"
15
+ gem "nitro_kit", "~> 2.0"
16
16
  ```
17
17
 
18
18
  Bundler records the exact released version in `Gemfile.lock`; commit `Gemfile`
@@ -39,11 +39,13 @@ rather than a moving Git branch.
39
39
  when buttons use a distinct shape from inputs and surfaces.
40
40
  5. Capture representative wide and narrow screenshots before conversion.
41
41
 
42
- If the Nitro Kit MCP catalog is connected, search it by workflow after this
43
- inventory — for example `mobile transcript navigation`, `settings form`, or
44
- `empty query results`. Do not search only for an old component name. MCP can
45
- deliver complete compositions; the installed gem remains the authority for
46
- the free component contract.
42
+ After this inventory, review the bundled application patterns under
43
+ `patterns/` in the installed gem (starting with
44
+ `patterns/nitro-kit-1-upgrade/pattern.md` and `patterns/README.md`) by workflow
45
+ — for example `account-settings`, `application-shell`, or `crud-resource` —
46
+ rather than searching only for an old component name. The bundled patterns show
47
+ complete application-owned compositions; the installed gem remains the
48
+ authority for the component contract.
47
49
 
48
50
  ## Select semantics before atoms
49
51
 
@@ -85,6 +85,11 @@ ordinary Rails flash and `303 See Other` redirects. Use the dedicated
85
85
 
86
86
  ## Acceptance checklist
87
87
 
88
+ Run the [page composition checklist](composition.md) on every route: one
89
+ gutter owner, one primary action with destructive actions kept out of
90
+ row-level prominence, populated/empty/invalid/narrow states, and one title
91
+ scale. Then verify the foundation itself:
92
+
88
93
  - Signup or sign-in selects a membership and team.
89
94
  - Cross-team records cannot be loaded.
90
95
  - Owner, administrator, and member policy differs where intended.
@@ -0,0 +1,61 @@
1
+ # Page composition checklist
2
+
3
+ **Audience:** Coding agents composing a page from Nitro components, a catalog
4
+ pattern, or retrieved source. Run this checklist on every page you add or
5
+ change, in addition to the pattern's own verification.
6
+
7
+ ## Summary
8
+
9
+ - Correct components do not make a coherent page; each rule below names one
10
+ owner for a decision that otherwise ends up made twice or not at all.
11
+ - One application-owned element owns the page gutter, and one shell toolbar
12
+ owns the page title.
13
+ - Keep at most one primary action per view and demote destructive actions out
14
+ of row-level prominence.
15
+ - Verify populated, empty, invalid, and narrow states before calling a page
16
+ done.
17
+
18
+ ## Checklist
19
+
20
+ 1. **One gutter owner.** Exactly one application-owned element inside
21
+ `shell.main` (or the host layout's main region) owns page padding: 24px on
22
+ desktop, 16px on narrow screens. Child pages, Cards, and Containers add no
23
+ outer padding of their own. A page with no gutter is as wrong as a page with
24
+ two. Tables fill the gutter; forms and reading content use a centered
25
+ `Container(size: :md)` or `Container(size: :lg)` inside it.
26
+ 2. **Clear action hierarchy.** At most one `primary` Button per view, normally
27
+ in the shell `Toolbar`. Other actions use the default treatment, never
28
+ ghost. Destructive actions are demoted out of row-level prominence:
29
+ - Repeated table rows carry at most one or two plain actions such as View
30
+ or Edit. Put deletion on the edit route's `DangerZone`, or behind a
31
+ default-treatment Dialog trigger or a Dropdown item when a row really
32
+ needs it (invitation revocation, member removal).
33
+ - `variant: :destructive` belongs inside an edit route's `DangerZone` and
34
+ on the confirming submit of a Dialog, never on repeated row triggers.
35
+ - Index, list, and detail pages show no destructive-treatment button before
36
+ the user has chosen to change or remove something.
37
+ 3. **Every state is designed.** Render and inspect populated, empty
38
+ (`EmptyState` with the creating action), invalid (422 with field errors and
39
+ an error summary), and narrow (390px: no document overflow, title and
40
+ persistent actions visible, Table scrolls inside its own wrapper) states.
41
+ Long names and many rows are part of populated.
42
+ 4. **One title scale.** The route has one `h1`, owned by the shell `Toolbar`
43
+ or the host layout's page header, at the same size on every route. Section
44
+ headings step down consistently (`SettingsSection`, `DataSection`, Card
45
+ titles); do not repeat the route title in a `PageHeader` or Card, and do
46
+ not invent per-page heading sizes.
47
+
48
+ ## How to check
49
+
50
+ - Count padded ancestors between `main` and the first piece of content: there
51
+ should be exactly one.
52
+ - Count `primary` and `destructive` Buttons visible on first render: at most
53
+ one of each, and destructive ones only on routes the user opened to change
54
+ or remove something.
55
+ - Load the empty collection, submit an invalid form, and resize to 390px
56
+ before calling the page finished.
57
+ - Compare the `h1` size and position with a neighboring route.
58
+
59
+ See [Application foundation](application_foundation.md) for shell ownership,
60
+ [CRUD resource](crud_resource.md) for route composition, and
61
+ [Destructive action](destructive_action.md) for confirmation mechanics.
@@ -66,6 +66,11 @@ Entity`. Public controllers query only publicly visible records.
66
66
 
67
67
  ## Acceptance checklist
68
68
 
69
+ Run the [page composition checklist](composition.md) on index, form, and
70
+ detail routes. In particular, index rows carry plain View or Edit actions;
71
+ permanent deletion lives in the edit route's `DangerZone`, and
72
+ destructive button treatment never appears in index rows.
73
+
69
74
  Test tenant isolation, authorization, public visibility, lifecycle resources,
70
75
  pagination, `303` redirects, and `422` validation. Protect the high-level
71
76
  composition: one title, one primary action, the correct form association,
@@ -93,9 +93,8 @@ Load this stylesheet after Nitro Kit:
93
93
  --nk-app-shell-sidebar-background: transparent;
94
94
  block-size: 100vh;
95
95
  block-size: 100dvh;
96
- padding: var(--workspace-inset) var(--workspace-inset) var(
97
- --workspace-inset
98
- ) 0;
96
+ padding: var(--workspace-inset) var(--workspace-inset)
97
+ var(--workspace-inset) 0;
99
98
  grid-template-rows: auto minmax(0, 1fr);
100
99
  column-gap: 0;
101
100
  overflow: hidden;
@@ -106,10 +105,10 @@ Load this stylesheet after Nitro Kit:
106
105
  border: 0;
107
106
  }
108
107
  :where(
109
- [data-ui="inset-workspace"]
110
- > [data-slot="app-shell-header"]
111
- > [data-slot="app-shell-brand"]
112
- ) {
108
+ [data-ui="inset-workspace"]
109
+ > [data-slot="app-shell-header"]
110
+ > [data-slot="app-shell-brand"]
111
+ ) {
113
112
  padding-inline: calc(var(--nk-space) * 6);
114
113
  border: 0;
115
114
  }
@@ -122,10 +121,10 @@ Load this stylesheet after Nitro Kit:
122
121
  box-shadow: var(--nk-shadow-sm);
123
122
  }
124
123
  :where(
125
- [data-ui="inset-workspace"][data-layout="sidebar"]
126
- > [data-slot="app-shell-header"]
127
- > [data-slot="app-shell-topbar"]
128
- ) {
124
+ [data-ui="inset-workspace"][data-layout="sidebar"]
125
+ > [data-slot="app-shell-header"]
126
+ > [data-slot="app-shell-topbar"]
127
+ ) {
129
128
  padding: calc(var(--nk-space) * 6);
130
129
  background: var(--nk-color-surface);
131
130
  border: var(--nk-border-width) solid var(--nk-color-border);
@@ -133,9 +132,9 @@ Load this stylesheet after Nitro Kit:
133
132
  border-radius: var(--nk-radius-xl) var(--nk-radius-xl) 0 0;
134
133
  }
135
134
  :where(
136
- [data-ui="inset-workspace"][data-layout="sidebar"]
137
- > [data-slot="app-shell-main"]
138
- ) {
135
+ [data-ui="inset-workspace"][data-layout="sidebar"]
136
+ > [data-slot="app-shell-main"]
137
+ ) {
139
138
  border-block-start: 0;
140
139
  border-start-start-radius: 0;
141
140
  border-start-end-radius: 0;
@@ -147,17 +146,17 @@ Load this stylesheet after Nitro Kit:
147
146
 
148
147
  @media (width < 48rem) {
149
148
  :where(
150
- [data-ui="inset-workspace"]
151
- > [data-slot="app-shell-header"]
152
- > [data-slot="app-shell-brand"]
153
- ) {
149
+ [data-ui="inset-workspace"]
150
+ > [data-slot="app-shell-header"]
151
+ > [data-slot="app-shell-brand"]
152
+ ) {
154
153
  display: none;
155
154
  }
156
155
  :where(
157
- [data-ui="inset-workspace"]
158
- [data-slot="app-shell-topbar"]
159
- > [data-nk="toolbar"]
160
- ) {
156
+ [data-ui="inset-workspace"]
157
+ [data-slot="app-shell-topbar"]
158
+ > [data-nk="toolbar"]
159
+ ) {
161
160
  flex-direction: row;
162
161
  flex-wrap: nowrap;
163
162
  align-items: center;
@@ -12,6 +12,8 @@ and update forms.
12
12
  - Use one primary submit: the shell toolbar owns it, or a standalone form keeps
13
13
  it inside `form.group`.
14
14
  - Wrap the form in a Turbo Frame only when it needs an independent lifecycle.
15
+ - Relation pickers use a remote `Combobox` whose `selected:` choices are rebuilt
16
+ from the submitted ids, so an invalid re-render keeps every selection.
15
17
 
16
18
  ## Form
17
19
 
@@ -60,6 +62,69 @@ Button("Save project", type: :submit, form: form_id, variant: :primary)
60
62
  Do not also call `form.submit` in the body. A standalone form without a toolbar
61
63
  keeps its submit in the same `form.group` as its visible fields.
62
64
 
65
+ ## Relation pickers
66
+
67
+ Pick associated records with a remote `Combobox`. Rails keeps search,
68
+ authorization, creation, and persistence; the combobox owns selection state,
69
+ stale-search cancellation, loading and error feedback, keyboard navigation, and
70
+ chips backed by hidden `name[]` fields.
71
+
72
+ ```ruby
73
+ render NitroKit::Combobox.new(
74
+ id: "post-tags",
75
+ name: form.field_name(:tag_ids, multiple: true),
76
+ label: "Tags",
77
+ src: tags_path(combobox: "post-tags"),
78
+ multiple: true,
79
+ selected: @post.tags.map { |tag| { label: tag.name, value: tag.id } }
80
+ )
81
+ ```
82
+
83
+ Build `selected:` from the model, never from the raw params, so an invalid
84
+ `422` re-render shows exactly the records that still exist. On an unsaved
85
+ record, `@post.tag_ids = params[:post][:tag_ids]` loads them in memory.
86
+
87
+ The search endpoint scopes records to the current user and renders
88
+ `Combobox::Results` without a layout. An action posts back to the application,
89
+ which answers with the record to select:
90
+
91
+ ```ruby
92
+ class TagsController < ApplicationController
93
+ def index
94
+ tags = Current.account.tags.search(params[:query]).limit(8)
95
+ render UI::TagResults.new(tags:, query: params[:query]), layout: false
96
+ end
97
+
98
+ def create
99
+ tag = Current.account.tags.create_or_find_by!(name: params.require(:tag)[:name])
100
+ render UI::TagResults.new(tags: [ tag ], query: nil), status: :created, layout: false
101
+ end
102
+ end
103
+
104
+ class UI::TagResults < Phlex::HTML
105
+ include Phlex::Rails::Helpers::Routes
106
+
107
+ def initialize(tags:, query:)
108
+ @tags = tags
109
+ @query = query.to_s.strip
110
+ end
111
+
112
+ def view_template
113
+ render NitroKit::Combobox::Results.new(id: "post-tags") do |results|
114
+ @tags.each { |tag| results.option(tag.name, value: tag.id) }
115
+ if @query.present? && @tags.none? { |tag| tag.name.casecmp?(@query) }
116
+ results.action("Create tag “#{@query}”", url: tags_path, params: { "tag[name]" => @query })
117
+ end
118
+ end
119
+ end
120
+ end
121
+ ```
122
+
123
+ Respond with a non-success status when creation fails; the combobox shows its
124
+ error message and keeps the existing chips. Use a single remote combobox
125
+ (without `multiple:`) for a `belongs_to` picker; it submits one hidden
126
+ `name` field.
127
+
63
128
  ## Responses
64
129
 
65
130
  ```ruby