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
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AccountSettings::AccountClosure
4
+ include ActiveModel::Model
5
+
6
+ CONFIRMATION = "DELETE"
7
+
8
+ attr_accessor :current_password, :confirmation
9
+ attr_reader :user
10
+
11
+ validates :current_password, presence: true
12
+ validates :confirmation, comparison: { equal_to: CONFIRMATION }
13
+ validate :current_password_is_correct
14
+
15
+ def initialize(user:, **attributes)
16
+ @user = user
17
+ super(attributes)
18
+ end
19
+
20
+ def save
21
+ return false unless valid?
22
+
23
+ user.destroy!
24
+ true
25
+ end
26
+
27
+ private
28
+ def current_password_is_correct
29
+ return if current_password.blank? || user.authenticate(current_password)
30
+
31
+ errors.add(:current_password, "is incorrect")
32
+ end
33
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AccountSettings::PasswordChange
4
+ include ActiveModel::Model
5
+
6
+ attr_accessor :current_password, :password, :password_confirmation
7
+ attr_reader :user, :current_session
8
+
9
+ validates :current_password, :password, :password_confirmation, presence: true
10
+ validates :password, length: { minimum: 12 }, allow_blank: true
11
+ validates :password, confirmation: true
12
+ validate :current_password_is_correct
13
+
14
+ def initialize(user:, current_session:, **attributes)
15
+ @user = user
16
+ @current_session = current_session
17
+ super(attributes)
18
+ end
19
+
20
+ def save
21
+ return false unless valid?
22
+
23
+ saved = false
24
+ user.class.transaction do
25
+ unless user.update(password:, password_confirmation:)
26
+ user.errors.each { |error| errors.add(error.attribute, error.message) }
27
+ raise ActiveRecord::Rollback
28
+ end
29
+
30
+ user.sessions.where.not(id: current_session&.id).destroy_all
31
+ saved = true
32
+ end
33
+ saved
34
+ end
35
+
36
+ private
37
+ def current_password_is_correct
38
+ return if current_password.blank? || user.authenticate(current_password)
39
+
40
+ errors.add(:current_password, "is incorrect")
41
+ end
42
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AccountSettings::SessionSummary
4
+ BROWSERS = {
5
+ "Edg/" => "Edge",
6
+ "Chrome/" => "Chrome",
7
+ "Firefox/" => "Firefox",
8
+ "Safari/" => "Safari"
9
+ }.freeze
10
+ PLATFORMS = {
11
+ "iPhone" => "iPhone",
12
+ "iPad" => "iPad",
13
+ "Android" => "Android",
14
+ "Macintosh" => "macOS",
15
+ "Windows" => "Windows",
16
+ "Linux" => "Linux"
17
+ }.freeze
18
+
19
+ attr_reader :session, :current_session
20
+
21
+ def initialize(session, current_session:)
22
+ @session = session
23
+ @current_session = current_session
24
+ end
25
+
26
+ def id = session.id
27
+ def current? = session == current_session
28
+ def ip_address = session.ip_address.presence || "Unknown IP"
29
+ def last_active_at = session.updated_at || session.created_at
30
+
31
+ def label
32
+ [ browser, platform ].compact.join(" on ").presence || "Unknown browser"
33
+ end
34
+
35
+ private
36
+ def browser
37
+ BROWSERS.find { |token, _| user_agent.include?(token) }&.last
38
+ end
39
+
40
+ def platform
41
+ PLATFORMS.find { |token, _| user_agent.include?(token) }&.last
42
+ end
43
+
44
+ def user_agent = session.user_agent.to_s
45
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module User::AccountConfigurable
4
+ extend ActiveSupport::Concern
5
+
6
+ APPEARANCES = %w[system light dark].freeze
7
+ LOCALES = %w[en da de].freeze
8
+
9
+ included do
10
+ normalizes :name, with: ->(name) { name.to_s.squish }
11
+
12
+ validates :name, presence: true, length: { maximum: 80 }
13
+ validates :time_zone, presence: true, inclusion: { in: ->(_) { ActiveSupport::TimeZone.all.map(&:name) } }
14
+ validates :locale, inclusion: { in: LOCALES }
15
+ validates :appearance, inclusion: { in: APPEARANCES }
16
+ validates :email_notifications, inclusion: { in: [ true, false ] }
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ # Draw with: draw :account_settings
2
+ namespace :settings do
3
+ root to: redirect("/settings/profile")
4
+ resource :profile, only: %i[show update]
5
+ resource :security, only: %i[show update]
6
+ resource :preferences, only: %i[show update]
7
+ resources :sessions, only: %i[index destroy]
8
+ resource :other_sessions, only: :destroy
9
+ resource :account_deletion, only: %i[show destroy]
10
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddAccountSettings < ActiveRecord::Migration[8.1]
4
+ def up
5
+ add_column :users, :name, :string
6
+ add_column :users, :time_zone, :string, null: false, default: "UTC"
7
+ add_column :users, :locale, :string, null: false, default: "en"
8
+ add_column :users, :appearance, :string, null: false, default: "system"
9
+ add_column :users, :email_notifications, :boolean, null: false, default: true
10
+
11
+ migration_user = Class.new(ActiveRecord::Base) { self.table_name = "users" }
12
+ migration_user.reset_column_information
13
+ migration_user.where(name: [ nil, "" ]).find_each do |user|
14
+ user.update_columns(name: user.email_address.to_s.split("@").first.presence || "Account owner")
15
+ end
16
+
17
+ change_column_null :users, :name, false
18
+ end
19
+
20
+ def down
21
+ remove_column :users, :email_notifications
22
+ remove_column :users, :appearance
23
+ remove_column :users, :locale
24
+ remove_column :users, :time_zone
25
+ remove_column :users, :name
26
+ end
27
+ end
@@ -0,0 +1,84 @@
1
+ require "test_helper"
2
+
3
+ class Settings::AccountSettingsFlowTest < ActionDispatch::IntegrationTest
4
+ setup do
5
+ @user = users(:verified)
6
+ @user.update!(password: "correct horse battery staple")
7
+ post session_path, params: {
8
+ authentication_credentials: {
9
+ email_address: @user.email_address,
10
+ password: "correct horse battery staple"
11
+ }
12
+ }
13
+ @current_session = @user.sessions.order(:created_at).last
14
+ end
15
+
16
+ test "profile cannot change the authenticated address" do
17
+ patch settings_profile_path, params: {
18
+ user: {
19
+ name: "Ada Byron",
20
+ time_zone: "London",
21
+ email_address: "attacker@example.test"
22
+ }
23
+ }
24
+
25
+ assert_redirected_to settings_profile_path
26
+ assert_equal "Ada Byron", @user.reload.name
27
+ assert_equal "verified@example.test", @user.email_address
28
+ end
29
+
30
+ test "wrong current password leaves every session intact" do
31
+ @user.sessions.create!(user_agent: "Chrome", ip_address: "198.51.100.8")
32
+
33
+ assert_no_difference -> { @user.sessions.count } do
34
+ patch settings_security_path, params: {
35
+ security: {
36
+ current_password: "wrong password",
37
+ password: "new password long enough",
38
+ password_confirmation: "new password long enough"
39
+ }
40
+ }
41
+ end
42
+
43
+ assert_response :unprocessable_entity
44
+ end
45
+
46
+ test "session endpoints stay scoped and preserve the current session" do
47
+ other = @user.sessions.create!(user_agent: "Firefox", ip_address: "192.0.2.4")
48
+ foreign = users(:unverified).sessions.create!(user_agent: "Chrome", ip_address: "198.51.100.8")
49
+
50
+ delete settings_session_path(other)
51
+ assert_redirected_to settings_sessions_path
52
+ refute Session.exists?(other.id)
53
+
54
+ delete settings_session_path(@current_session)
55
+ assert_redirected_to settings_sessions_path
56
+ assert Session.exists?(@current_session.id)
57
+
58
+ assert_raises(ActiveRecord::RecordNotFound) do
59
+ delete settings_session_path(foreign)
60
+ end
61
+ end
62
+
63
+ test "account deletion requires password and exact phrase" do
64
+ assert_no_difference "User.count" do
65
+ delete settings_account_deletion_path, params: {
66
+ account_deletion: {
67
+ current_password: "correct horse battery staple",
68
+ confirmation: "delete"
69
+ }
70
+ }
71
+ end
72
+ assert_response :unprocessable_entity
73
+
74
+ assert_difference "User.count", -1 do
75
+ delete settings_account_deletion_path, params: {
76
+ account_deletion: {
77
+ current_password: "correct horse battery staple",
78
+ confirmation: "DELETE"
79
+ }
80
+ }
81
+ end
82
+ assert_redirected_to new_session_path
83
+ end
84
+ end
@@ -0,0 +1,40 @@
1
+ require "test_helper"
2
+
3
+ class AccountSettings::PasswordChangeTest < ActiveSupport::TestCase
4
+ setup do
5
+ @user = users(:verified)
6
+ @user.update!(password: "correct horse battery staple")
7
+ @current_session = @user.sessions.create!(user_agent: "Safari", ip_address: "203.0.113.24")
8
+ @other_session = @user.sessions.create!(user_agent: "Chrome", ip_address: "198.51.100.8")
9
+ end
10
+
11
+ test "failed validation does not update the password or revoke sessions" do
12
+ change = AccountSettings::PasswordChange.new(
13
+ user: @user,
14
+ current_session: @current_session,
15
+ current_password: "wrong password",
16
+ password: "new password long enough",
17
+ password_confirmation: "new password long enough"
18
+ )
19
+
20
+ assert_no_changes -> { @user.reload.password_digest } do
21
+ assert_no_difference -> { @user.sessions.count } do
22
+ refute change.save
23
+ end
24
+ end
25
+ end
26
+
27
+ test "successful change retains only the current session" do
28
+ change = AccountSettings::PasswordChange.new(
29
+ user: @user,
30
+ current_session: @current_session,
31
+ current_password: "correct horse battery staple",
32
+ password: "new password long enough",
33
+ password_confirmation: "new password long enough"
34
+ )
35
+
36
+ assert change.save
37
+ assert @user.reload.authenticate("new password long enough")
38
+ assert_equal [ @current_session.id ], @user.sessions.pluck(:id)
39
+ end
40
+ end
@@ -0,0 +1,52 @@
1
+ require "application_system_test_case"
2
+
3
+ class AccountSettingsTest < ApplicationSystemTestCase
4
+ setup do
5
+ @user = users(:verified)
6
+ @user.update!(password: "correct horse battery staple")
7
+ visit new_session_path
8
+ fill_in "Email address", with: @user.email_address
9
+ fill_in "Password", with: "correct horse battery staple"
10
+ click_on "Sign in"
11
+ end
12
+
13
+ test "updates profile and corrects validation through Turbo" do
14
+ visit settings_profile_path
15
+ fill_in "Name", with: ""
16
+ click_on "Save profile"
17
+
18
+ assert_text "Check the highlighted fields"
19
+ assert_field "Name", with: ""
20
+
21
+ fill_in "Name", with: "Ada Byron"
22
+ select "London", from: "Time zone"
23
+ click_on "Save profile"
24
+
25
+ assert_text "Profile saved."
26
+ assert_field "Name", with: "Ada Byron"
27
+ end
28
+
29
+ test "reviews and revokes another browser session" do
30
+ other = @user.sessions.create!(
31
+ user_agent: "Mozilla/5.0 (Windows) Chrome/151.0",
32
+ ip_address: "198.51.100.8"
33
+ )
34
+
35
+ visit settings_sessions_path
36
+ assert_text "Chrome on Windows"
37
+ click_on "Revoke", match: :first
38
+
39
+ assert_text "Browser session revoked."
40
+ refute Session.exists?(other.id)
41
+ end
42
+
43
+ test "account deletion is a separate reviewed screen" do
44
+ visit settings_profile_path
45
+ click_on "Review account deletion"
46
+
47
+ assert_text "Permanently delete account"
48
+ assert_link "Keep my account"
49
+ assert_field "Current password", with: ""
50
+ assert_field "Type DELETE to confirm", with: ""
51
+ end
52
+ end
@@ -0,0 +1,4 @@
1
+ version: 1.0.0
2
+ title: Account settings
3
+ summary: Manage profile, preferences, password, browser sessions, and reviewed account deletion.
4
+ tags: [account-settings, profile, security, sessions, preferences, rails]
@@ -0,0 +1,44 @@
1
+ # Account settings
2
+
3
+ ## When to use
4
+
5
+ Use this pattern when a signed-in user needs one coherent place to manage personal profile data, interface preferences, credentials, browser sessions, and account deletion. It composes `UI::ApplicationShell` with `NitroKit::SettingsLayout`; account settings remain application-owned rather than becoming a generic component API.
6
+
7
+ ## Composition checklist
8
+
9
+ Run the page composition checklist in the installed gem's `docs/patterns/composition.md` (`bundle show nitro_kit`) before calling any adapted route finished: the shell owns the gutter and the `h1`, so `SettingsLayout` and its sections add no outer padding or repeated title. Session revocation rows use default-treatment buttons; destructive button treatment appears only on the account-deletion review. Inspect populated, empty other-sessions, invalid, and 390px states.
10
+
11
+ ## Ownership
12
+
13
+ The user owns profile and preference values across teams. Workspace settings, memberships, and billing belong elsewhere. The exemplar updates only `name` and `time_zone` on the profile screen; the authenticated address is visible but not editable because changing it must go through the host's verified-address flow.
14
+
15
+ Include `User::AccountConfigurable` beside the host application's authentication concern. Merge the migration with existing profile columns rather than adding duplicates. Adapt the preference choices to the application's supported locales and appearance implementation. Keep the persisted values useful without JavaScript: the server may emit the selected theme before paint and CSS may also honor `prefers-color-scheme` and `prefers-reduced-motion`.
16
+
17
+ ## Password and sessions
18
+
19
+ `AccountSettings::PasswordChange` verifies the current password, validates the new password and confirmation, updates through `has_secure_password`, and revokes every other persisted session only after a successful credential change. It never assigns password values back to rendered fields. The current browser remains signed in.
20
+
21
+ The sessions page scopes every lookup through `Current.user.sessions`. A user may revoke another session or all other sessions, but must use ordinary sign-out for the current one. User-agent parsing is deliberately modest and local; do not add a network geolocation lookup to a settings request. IP addresses are security data, so authorize the page and retain them only as long as the session policy requires.
22
+
23
+ ## Account deletion
24
+
25
+ Deletion uses a review screen, not an inline destructive button. The user sees the irreversible effects, confirms with the current password, and types `DELETE`. `AccountSettings::AccountClosure` validates without disclosing credential details and destroys the user only after every confirmation succeeds. The controller then clears `Current.session`, the signed session cookie, and the Rails session before redirecting outside the authenticated application.
26
+
27
+ Override `account_deletion_allowed?` in `Settings::BaseController` for host policy such as sole workspace ownership, legal holds, active subscriptions, or scheduled deletion. Resolve those obligations before showing a working destructive form; never accept a client-provided policy result.
28
+
29
+ ## Rendering
30
+
31
+ Each destination renders inside one `SettingsLayout` with a stable labelled navigation. Forms use `SettingsSection`, fieldsets, server validation, 422 responses, and 303 redirects. Data pages use `DataSection`; account deletion uses `DangerZone` with a safe escape. Turbo Drive is sufficient. No custom Stimulus controller, Turbo Frame, or full-width submit action is required.
32
+
33
+ Add the Settings destination to the host application's `UI::ApplicationShell` navigation. Replace the exemplar `projects_path` and `teams_path` destinations if the host shell uses different primary routes.
34
+
35
+ ## Verification
36
+
37
+ - Reject blank or overlong profile names and unknown time zones without changing persisted values.
38
+ - Keep email address out of profile update parameters and route address changes through verification.
39
+ - Reject wrong current passwords, short passwords, and mismatched confirmations without revoking sessions.
40
+ - On success, retain the current session and revoke every other session.
41
+ - Scope session destruction to the current user and refuse current-session revocation through the settings endpoint.
42
+ - Require both password and exact deletion phrase; confirm invalid attempts leave the user and sessions intact.
43
+ - Apply host deletion policy before mutation and clear cookies and server session after deletion.
44
+ - Browser-test Turbo 422 correction, compact actions, keyboard navigation, 390px layout, long user agents, both appearances, and an empty other-sessions state.
@@ -0,0 +1,267 @@
1
+ @layer components {
2
+ :where([data-ui="application-shell"] > [data-slot="app-shell-main"]) {
3
+ overflow: auto;
4
+ overscroll-behavior: contain;
5
+ }
6
+
7
+ :where(
8
+ [data-ui="application-shell"][data-layout="sidebar"]
9
+ [data-slot="app-navigation-header"]
10
+ ) {
11
+ flex-direction: column;
12
+ align-items: stretch;
13
+ gap: calc(var(--nk-space) * 3);
14
+ padding: calc(var(--nk-space) * 3);
15
+ }
16
+
17
+ :where(
18
+ [data-ui="application-shell"][data-layout="sidebar"]
19
+ [data-slot="app-navigation-header"]
20
+ [data-slot="dropdown-trigger"]
21
+ ) {
22
+ justify-content: flex-start;
23
+ inline-size: 100%;
24
+ }
25
+
26
+ :where(
27
+ [data-ui="application-shell"]
28
+ [data-slot="app-navigation-header"]
29
+ > [data-nk="dropdown"],
30
+ [data-ui="application-shell"] [data-ui="account-menu"]
31
+ ) {
32
+ inline-size: 100%;
33
+ }
34
+ :where(
35
+ [data-ui="application-shell"]
36
+ [data-ui="account-menu"]
37
+ > [data-slot="dropdown-trigger"]
38
+ ) {
39
+ inline-size: 100%;
40
+ justify-content: flex-start;
41
+ }
42
+ :where(
43
+ [data-ui="application-shell"]
44
+ [data-slot="dropdown-trigger"]
45
+ > [data-slot="button-label"]
46
+ ) {
47
+ flex: 1;
48
+ text-align: start;
49
+ }
50
+
51
+ :where([data-ui="application-shell"] [data-nk="command-palette"]) {
52
+ inline-size: auto;
53
+ }
54
+
55
+ :where([data-ui="application-shell"] [data-slot="command-palette-search"]) {
56
+ gap: calc(var(--nk-space) * 3);
57
+ padding: calc(var(--nk-space) * 3);
58
+ }
59
+
60
+ :where(
61
+ [data-ui="application-shell"] [data-slot="command-palette-search-icon"]
62
+ ) {
63
+ margin-inline-start: 0;
64
+ }
65
+
66
+ :where([data-ui="application-shell"] [data-slot="command-palette-panel"]) {
67
+ margin-block-start: calc(var(--nk-space) * 8);
68
+ margin-block-end: auto;
69
+ }
70
+
71
+ :where([data-ui="application-shell"] [data-slot="app-navigation-footer"]) {
72
+ display: flex;
73
+ flex-direction: column;
74
+ gap: calc(var(--nk-space) * 3);
75
+ }
76
+
77
+ @media (width < 48rem) {
78
+ :where(
79
+ [data-ui="application-shell"]
80
+ > [data-slot="app-shell-header"]:has([data-nk="toolbar"])
81
+ ) {
82
+ padding-block: calc(var(--nk-space) * 3);
83
+ }
84
+
85
+ :where([data-ui="application-shell"] [data-nk="toolbar"]) {
86
+ flex-direction: row;
87
+ align-items: center;
88
+ }
89
+
90
+ :where([data-ui="application-shell"] [data-slot="toolbar-trailing"]) {
91
+ margin-inline-start: auto;
92
+ justify-content: flex-end;
93
+ }
94
+ }
95
+
96
+ @media (width >= 48rem) {
97
+ :where(
98
+ [data-ui="application-shell"][data-layout="topbar"]
99
+ [data-slot="app-navigation-header"],
100
+ [data-ui="application-shell"][data-layout="topbar"]
101
+ [data-slot="app-navigation-footer"]
102
+ ) {
103
+ padding: calc(var(--nk-space) * 2) 0;
104
+ gap: calc(var(--nk-space) * 4);
105
+ border-block: 0;
106
+ }
107
+
108
+ :where(
109
+ [data-ui="application-shell"][data-layout="topbar"]
110
+ [data-nk="app-navigation"]
111
+ ) {
112
+ inline-size: 100%;
113
+ padding-inline: 0;
114
+ }
115
+ :where(
116
+ [data-ui="application-shell"][data-layout="topbar"]
117
+ [data-ui="account-identity"]
118
+ > span:not([data-nk="avatar"])
119
+ ) {
120
+ display: none;
121
+ }
122
+ :where(
123
+ [data-ui="application-shell"][data-layout="topbar"]
124
+ [data-slot="app-navigation-body"]
125
+ ) {
126
+ gap: calc(var(--nk-space) * 2);
127
+ }
128
+
129
+ :where(
130
+ [data-ui="application-shell"][data-layout="topbar"]
131
+ [data-slot="app-navigation-footer"]
132
+ [data-slot="command-palette-trigger-label"]
133
+ ) {
134
+ display: none;
135
+ }
136
+ }
137
+
138
+ /* Application composition: navigation owns its rail padding, this shell owns
139
+ the inset, and workspace-content owns the only page gutter. */
140
+ :where([data-ui="application-shell-content"]) {
141
+ --page-gutter: calc(var(--nk-space) * 4);
142
+ padding: var(--page-gutter);
143
+ }
144
+ :where(
145
+ [data-ui="application-shell-content"] > [data-nk="toolbar"],
146
+ [data-ui="application-shell-description"]
147
+ ) {
148
+ margin-block-end: var(--page-gutter);
149
+ }
150
+ @media (width >= 48rem) {
151
+ :where([data-ui="application-shell"]) {
152
+ --workspace-inset: calc(var(--nk-space) * 3);
153
+ --nk-app-shell-background: color-mix(
154
+ in oklab,
155
+ var(--nk-color-muted) 15%,
156
+ var(--nk-color-canvas)
157
+ );
158
+ --nk-app-shell-sidebar-background: transparent;
159
+ block-size: 100vh;
160
+ block-size: 100dvh;
161
+ padding: var(--workspace-inset);
162
+ grid-template-rows: auto minmax(0, 1fr);
163
+ column-gap: 0;
164
+ overflow: hidden;
165
+ }
166
+ :where([data-ui="application-shell"][data-layout="sidebar"]) {
167
+ padding-inline-start: 0;
168
+ }
169
+ :where(
170
+ [data-ui="application-shell"][data-layout="topbar"]
171
+ > [data-slot="app-shell-header"]
172
+ > [data-slot="app-shell-brand"]
173
+ ) {
174
+ display: none;
175
+ }
176
+ :where(
177
+ [data-ui="application-shell"][data-layout="topbar"]
178
+ > [data-slot="app-shell-sidebar"]
179
+ > [data-slot="app-shell-navigation"]
180
+ ) {
181
+ grid-column: 1 / -1;
182
+ background: transparent;
183
+ border: 0;
184
+ }
185
+ :where(
186
+ [data-ui="application-shell"][data-layout="topbar"]
187
+ [data-slot="app-navigation-footer"]
188
+ ) {
189
+ flex-direction: row;
190
+ align-items: center;
191
+ }
192
+ :where(
193
+ [data-ui="application-shell"][data-layout="topbar"]
194
+ [data-slot="app-navigation-header"]
195
+ > [data-nk="dropdown"],
196
+ [data-ui="application-shell"][data-layout="topbar"]
197
+ [data-ui="account-menu"]
198
+ ) {
199
+ inline-size: auto;
200
+ }
201
+ :where(
202
+ [data-ui="application-shell"][data-layout="sidebar"]
203
+ > [data-slot="app-shell-sidebar"]
204
+ ) {
205
+ position: static;
206
+ block-size: 100%;
207
+ border: 0;
208
+ }
209
+ :where([data-ui="application-shell"] > [data-slot="app-shell-main"]) {
210
+ background: var(--nk-color-surface);
211
+ border: var(--nk-border-width) solid var(--nk-color-border);
212
+ border-radius: var(--nk-radius-xl);
213
+ box-shadow: var(--nk-shadow-sm);
214
+ }
215
+ :where(
216
+ [data-ui="application-shell"][data-layout="sidebar"]
217
+ > [data-slot="app-shell-header"]
218
+ > [data-slot="app-shell-topbar"]
219
+ ) {
220
+ padding: calc(var(--nk-space) * 6);
221
+ background: var(--nk-color-surface);
222
+ border: var(--nk-border-width) solid var(--nk-color-border);
223
+ border-block-end: 0;
224
+ border-radius: var(--nk-radius-xl) var(--nk-radius-xl) 0 0;
225
+ }
226
+ :where(
227
+ [data-ui="application-shell"][data-layout="sidebar"]
228
+ > [data-slot="app-shell-main"]
229
+ ) {
230
+ border-block-start: 0;
231
+ border-start-start-radius: 0;
232
+ border-start-end-radius: 0;
233
+ }
234
+ :where([data-ui="application-shell-content"]) {
235
+ --page-gutter: calc(var(--nk-space) * 6);
236
+ }
237
+ }
238
+ }
239
+
240
+ :where([data-ui="account-identity"]) {
241
+ display: inline-flex;
242
+ align-items: center;
243
+ gap: calc(var(--nk-space) * 2);
244
+ }
245
+
246
+ :where([data-ui="application-logo"]) {
247
+ flex: none;
248
+ inline-size: 132px;
249
+ block-size: auto;
250
+ object-fit: contain;
251
+ }
252
+ :where([data-theme="dark"] [data-ui="application-logo"]) {
253
+ filter: invert(1) hue-rotate(180deg);
254
+ }
255
+ @media (prefers-color-scheme: dark) {
256
+ :where(html:not([data-theme="light"]) [data-ui="application-logo"]) {
257
+ filter: invert(1) hue-rotate(180deg);
258
+ }
259
+ }
260
+
261
+ :where(
262
+ [data-ui="application-shell"][data-layout="sidebar"]
263
+ [data-slot="app-navigation-header"]
264
+ > [data-ui="application-logo"]
265
+ ) {
266
+ margin-inline-start: calc(var(--nk-space) * 1.5);
267
+ }