nitro_kit 2.0.0.alpha.2 → 2.0.0.alpha.3

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 (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -1
  3. data/README.md +23 -4
  4. data/STYLE_GUIDE.md +37 -5
  5. data/app/assets/stylesheets/nitro_kit.css +1714 -1358
  6. data/app/components/nitro_kit/accordion.rb +1 -7
  7. data/app/components/nitro_kit/app_navigation.rb +1 -2
  8. data/app/components/nitro_kit/app_shell.rb +1 -7
  9. data/app/components/nitro_kit/appearance_picker.rb +1 -11
  10. data/app/components/nitro_kit/avatar.rb +6 -1
  11. data/app/components/nitro_kit/avatar_stack.rb +3 -0
  12. data/app/components/nitro_kit/button_group.rb +2 -2
  13. data/app/components/nitro_kit/checkbox.rb +7 -4
  14. data/app/components/nitro_kit/checkbox_group.rb +0 -25
  15. data/app/components/nitro_kit/combobox.rb +3 -16
  16. data/app/components/nitro_kit/command_palette.rb +41 -59
  17. data/app/components/nitro_kit/component.rb +57 -5
  18. data/app/components/nitro_kit/danger_zone.rb +5 -1
  19. data/app/components/nitro_kit/data_section.rb +28 -4
  20. data/app/components/nitro_kit/details_table.rb +19 -8
  21. data/app/components/nitro_kit/dialog.rb +23 -19
  22. data/app/components/nitro_kit/dropdown.rb +1 -6
  23. data/app/components/nitro_kit/dropzone.rb +3 -14
  24. data/app/components/nitro_kit/empty_state.rb +21 -2
  25. data/app/components/nitro_kit/field.rb +35 -11
  26. data/app/components/nitro_kit/form_builder.rb +0 -1
  27. data/app/components/nitro_kit/progressive_image.rb +2 -2
  28. data/app/components/nitro_kit/radio_button.rb +7 -4
  29. data/app/components/nitro_kit/radio_button_group.rb +0 -25
  30. data/app/components/nitro_kit/select.rb +3 -3
  31. data/app/components/nitro_kit/settings_layout.rb +17 -4
  32. data/app/components/nitro_kit/{form_section.rb → settings_section.rb} +18 -11
  33. data/app/components/nitro_kit/sheet.rb +29 -20
  34. data/app/components/nitro_kit/stat_grid.rb +18 -2
  35. data/app/components/nitro_kit/table.rb +22 -3
  36. data/app/components/nitro_kit/tabs.rb +1 -13
  37. data/app/components/nitro_kit/toast.rb +4 -2
  38. data/app/components/nitro_kit/toolbar.rb +2 -0
  39. data/app/components/nitro_kit/tooltip.rb +7 -10
  40. data/app/javascript/controllers/nk/app_shell_controller.js +3 -3
  41. data/app/javascript/controllers/nk/appearance_controller.js +6 -0
  42. data/app/javascript/controllers/nk/combobox_controller.js +51 -1
  43. data/app/javascript/controllers/nk/command_palette_controller.js +21 -11
  44. data/app/javascript/controllers/nk/dialog_controller.js +54 -0
  45. data/app/javascript/controllers/nk/dropdown_controller.js +45 -0
  46. data/app/javascript/controllers/nk/dropzone_controller.js +2 -2
  47. data/app/javascript/controllers/nk/progressive_image_controller.js +11 -7
  48. data/app/javascript/controllers/nk/tabs_controller.js +8 -1
  49. data/app/javascript/controllers/nk/tooltip_controller.js +9 -0
  50. data/config/locales/en.yml +4 -1
  51. data/docs/agent_guide.md +31 -16
  52. data/docs/agent_native_spec.md +27 -10
  53. data/docs/browser_support.md +193 -0
  54. data/docs/component_contracts.md +88 -82
  55. data/docs/customization.md +27 -15
  56. data/docs/hotwire.md +15 -3
  57. data/docs/initialization_prompt.md +31 -6
  58. data/docs/migration_1_to_2.md +61 -19
  59. data/docs/patterns/application_foundation.md +6 -4
  60. data/docs/patterns/crud_resource.md +6 -3
  61. data/docs/patterns/destructive_action.md +25 -0
  62. data/docs/patterns/resource_form.md +1 -1
  63. data/docs/rails_conventions.md +4 -1
  64. data/docs/rails_integration.md +39 -11
  65. data/lib/generators/nitro_kit/upgrade_smoke_tests_generator.rb +12 -0
  66. data/lib/nitro_kit/installation.rb +9 -4
  67. data/lib/nitro_kit/migration_inventory.rb +268 -8
  68. data/lib/nitro_kit/upgrade_smoke_test.rb +10 -12
  69. data/lib/nitro_kit/version.rb +1 -1
  70. data/lib/rails/commands/nitro_kit/nitro_kit_command.rb +10 -3
  71. data/plugins/nitro-kit/skills/nitro-kit-hotwire/SKILL.md +4 -0
  72. data/plugins/nitro-kit/skills/nitro-kit-rails/SKILL.md +6 -1
  73. data/plugins/nitro-kit/skills/nitro-kit-ui/SKILL.md +18 -8
  74. data/src/stylesheets/nitro_kit/components/accordion.css +40 -40
  75. data/src/stylesheets/nitro_kit/components/alert.css +9 -9
  76. data/src/stylesheets/nitro_kit/components/app_navigation.css +19 -19
  77. data/src/stylesheets/nitro_kit/components/app_shell.css +196 -193
  78. data/src/stylesheets/nitro_kit/components/appearance_picker.css +41 -31
  79. data/src/stylesheets/nitro_kit/components/avatar.css +3 -3
  80. data/src/stylesheets/nitro_kit/components/avatar_stack.css +36 -19
  81. data/src/stylesheets/nitro_kit/components/button.css +83 -58
  82. data/src/stylesheets/nitro_kit/components/button_group.css +19 -14
  83. data/src/stylesheets/nitro_kit/components/card.css +11 -5
  84. data/src/stylesheets/nitro_kit/components/checkbox.css +40 -36
  85. data/src/stylesheets/nitro_kit/components/checkbox_group.css +13 -13
  86. data/src/stylesheets/nitro_kit/components/combobox.css +33 -23
  87. data/src/stylesheets/nitro_kit/components/command_palette.css +48 -47
  88. data/src/stylesheets/nitro_kit/components/control_group.css +52 -58
  89. data/src/stylesheets/nitro_kit/components/danger_zone.css +3 -3
  90. data/src/stylesheets/nitro_kit/components/data_section.css +1 -1
  91. data/src/stylesheets/nitro_kit/components/details_table.css +13 -13
  92. data/src/stylesheets/nitro_kit/components/dialog.css +6 -3
  93. data/src/stylesheets/nitro_kit/components/dropdown.css +29 -23
  94. data/src/stylesheets/nitro_kit/components/dropzone.css +71 -28
  95. data/src/stylesheets/nitro_kit/components/empty_state.css +6 -6
  96. data/src/stylesheets/nitro_kit/components/field.css +30 -26
  97. data/src/stylesheets/nitro_kit/components/field_group.css +13 -0
  98. data/src/stylesheets/nitro_kit/components/fieldset.css +6 -0
  99. data/src/stylesheets/nitro_kit/components/input.css +9 -2
  100. data/src/stylesheets/nitro_kit/components/layout.css +165 -165
  101. data/src/stylesheets/nitro_kit/components/page_header.css +3 -3
  102. data/src/stylesheets/nitro_kit/components/pagination.css +55 -46
  103. data/src/stylesheets/nitro_kit/components/pagination_bar.css +7 -7
  104. data/src/stylesheets/nitro_kit/components/palette.css +20 -20
  105. data/src/stylesheets/nitro_kit/components/progressive_image.css +44 -54
  106. data/src/stylesheets/nitro_kit/components/radio_button.css +36 -29
  107. data/src/stylesheets/nitro_kit/components/radio_button_group.css +43 -43
  108. data/src/stylesheets/nitro_kit/components/rich_text_area.css +15 -0
  109. data/src/stylesheets/nitro_kit/components/select.css +2 -9
  110. data/src/stylesheets/nitro_kit/components/settings_layout.css +21 -18
  111. data/src/stylesheets/nitro_kit/components/settings_section.css +84 -0
  112. data/src/stylesheets/nitro_kit/components/sheet.css +23 -3
  113. data/src/stylesheets/nitro_kit/components/stat_grid.css +10 -9
  114. data/src/stylesheets/nitro_kit/components/switch.css +37 -33
  115. data/src/stylesheets/nitro_kit/components/table.css +35 -31
  116. data/src/stylesheets/nitro_kit/components/tabs.css +43 -39
  117. data/src/stylesheets/nitro_kit/components/toast.css +20 -9
  118. data/src/stylesheets/nitro_kit/components/toolbar.css +14 -39
  119. data/src/stylesheets/nitro_kit/components/tooltip.css +34 -29
  120. data/src/stylesheets/nitro_kit/components/typeset.css +147 -1
  121. data/src/stylesheets/nitro_kit/reset.css +9 -9
  122. data/src/stylesheets/nitro_kit/tokens.css +8 -9
  123. metadata +4 -3
  124. data/src/stylesheets/nitro_kit/components/form_section.css +0 -71
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cfb9e904d8890216a6c778b5dd10655e22f77fa7508fd4d9eb9521453b61cd8
4
- data.tar.gz: 3c9564fa27b68e1a10c1febe8b7104416251a5203b1bd25aa89b1617cab1e116
3
+ metadata.gz: ac13933782cc8434035e1b9e27f836b19dfe96a0f98124b91f2a4d62a4222d7e
4
+ data.tar.gz: 3ac6f8709fba0d6b5bffdac9eca6f21db615408303284afbc7ef7dbb7809d8d4
5
5
  SHA512:
6
- metadata.gz: de02c676e41ea2cb0d674de967efa9c73aa8d6f65195af0bfae0ce35e305dc9fb5e53979659e5feed738cf0fdc4e968902931be726a5d1bd67f22a400ce3c0b2
7
- data.tar.gz: 2ffdd83fe0f4005c5146a3d9e4fa13e7ce8a6b6d84d0a7e881aace598a6ff938836b20c15f29bde5f9d72e9bed8ef2e4a6b8a083add6986a0acdacb653221a4e
6
+ metadata.gz: 3e7e6d588753fada85d9435dade70583da5322dab94a09a97c125f8847fcef74c99d8ed8654230d839babfb230cc589c73e8de8b60671665f90229a958b1705e
7
+ data.tar.gz: c13cc9b6315a6e5e17a34b1bcb9a7d1d8f624abbb3ffc53940a8c3f743c774efb6988dd8cddc36b45224afd44b41d0ccdbb57a0e5eacca07c4731b52cc21fa81
data/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 2.0.0.alpha.3
6
+
7
+ ### Added
8
+
9
+ - Add a dated browser verification matrix with full Chrome coverage, focused
10
+ Firefox and macOS Safari lanes, and explicit Android, iOS, and near-floor
11
+ release checks.
12
+ - Add `--nk-button-radius` so applications can preserve a button-specific shape without changing inputs and surfaces.
13
+ - Add structured JSON output to `nitro_kit:doctor` for migration automation.
14
+
15
+ ### Changed
16
+
17
+ - Accept Rails-style nested and conditional class values through `desperately_need_a_class:`, normalizing retained external-integration hooks without manual string formatting, while directing migrations to review every use and aim for zero.
18
+ - Make migration diagnostics surface usages of application-owned button treatments and provable 2.0 Table/Button runtime contract errors, and require semantic theme translation plus wide and narrow browser comparison.
19
+ - Recognize explicit Stimulus controller registration used by JavaScript bundlers.
20
+ - Explain the purpose and limits of generated host-integration smoke tests in each generated file.
21
+
22
+ ### Documentation
23
+
24
+ - Define the rolling evergreen browser-support policy, with Mobile Safari as a
25
+ first-class target and standards-first, feature-detected fallbacks for core
26
+ behavior.
27
+ - Classify every interactive component's no-JavaScript baseline as full,
28
+ reduced, or unavailable.
29
+ - Document native month and week inputs as progressive enhancement, including
30
+ server-side ISO validation and bounded Select guidance.
31
+ - Document Accordion's reduced single-group behavior where named details are
32
+ unavailable instead of adding a compatibility controller.
33
+
34
+ ### Fixed
35
+
36
+ - Keep Dialog, Sheet, and CommandPalette controls working when Invoker Commands
37
+ are unavailable while preserving the native declarative path and consistent
38
+ focus restoration in Safari.
39
+ - Stack AppShell toolbar actions below the title on narrow screens instead of
40
+ clipping child-route titles when a Back affordance and several actions share
41
+ the header.
42
+ - Restore Dropdown outside-tap dismissal on affected Mobile Safari Popover
43
+ implementations and keep its reduced placement inside the viewport.
44
+ - Provide readable Typeset styling in Firefox versions without CSS `@scope`.
45
+ - Keep settled progressive images visible when Turbo restores a cached page.
46
+ - Keep arbitrary multi-element Button content aligned inside the label slot.
47
+ - Keep the command palette at a stable height while filtering destinations.
48
+ - Use a neutral elevated surface instead of the primary accent for tooltips.
49
+ - Resolve implicit FormBuilder labels only when rendered, so custom field blocks work under strict i18n.
50
+ - Allow generated upgrade smoke tests to coexist with host catch-all routes while still rejecting exact route collisions.
51
+
3
52
  ## 2.0.0.alpha.2
4
53
 
5
54
  This alpha keeps the 2.0 API experimental while incorporating the first full
@@ -73,7 +122,7 @@ Nitro Kit 2.0 alpha is a ground-up, intentionally incompatible rebuild around ge
73
122
  - Static zero-specificity CSS, light and dark theme tokens with a no-JavaScript system fallback, and a separate Tailwind CSS v4 adapter.
74
123
  - Responsive Flex and Grid layouts with fixed mobile-first breakpoints, closed values, classless data contracts, and no Tailwind runtime; plus the constrained-width Container.
75
124
  - Sortable `Table` headers with caller-owned URLs, native `aria-sort`, and an optional Ransack gallery recipe.
76
- - Eleven blocks and shells: AuthShell, AppShell, SettingsLayout, Toolbar, PaginationBar, PageHeader, StatGrid, DataSection, FormSection, DangerZone, and EmptyState.
125
+ - Eleven blocks and shells: AuthShell, AppShell, SettingsLayout, Toolbar, PaginationBar, PageHeader, StatGrid, DataSection, SettingsSection, DangerZone, and EmptyState.
77
126
  - AppNavigation, AppearancePicker, DetailsTable, Dropzone, and ProgressiveImage components, plus the non-visual AppearanceBootstrap runtime.
78
127
  - Typed Choice values and direct-Phlex Rails FormBuilder integration with Active Model errors, native and direct uploads, and Turbo Frame/Stream examples.
79
128
  - Direct optional Pagy integration through `Pagination(pagy:)`, with an explicit URL callable for caller-owned destinations.
data/README.md CHANGED
@@ -6,16 +6,16 @@
6
6
 
7
7
  **Rails front-end for the agent era.**
8
8
 
9
- Nitro Kit is a gem-owned, agent-native UI system for Ruby on Rails. The `2.0.0.alpha.2` prerelease is a ground-up rebuild under active testing and must not be treated as stable. New documentation and the Nitro Kit Pro alpha catalog are coming next.
9
+ Nitro Kit is a gem-owned, agent-native UI system for Ruby on Rails. The `2.0.0.alpha.3` prerelease is a ground-up rebuild under active testing and must not be treated as stable. New documentation and the Nitro Kit Pro alpha catalog are coming next.
10
10
 
11
11
  [![RubyGems](https://img.shields.io/gem/v/nitro_kit.svg)](https://rubygems.org/gems/nitro_kit)
12
12
 
13
13
  ## Installation
14
14
 
15
- Install the alpha explicitly and keep it pinned while evaluating it.
15
+ Install the prerelease explicitly and keep it pinned while evaluating it.
16
16
 
17
17
  ```ruby
18
- gem "nitro_kit", "2.0.0.alpha.2"
18
+ gem "nitro_kit", "2.0.0.alpha.3"
19
19
  ```
20
20
 
21
21
  Use the released gem and commit `Gemfile` with `Gemfile.lock`. Before upgrading, review the changelog, run `bundle update nitro_kit`, rerun the installer, and test the application.
@@ -26,7 +26,26 @@ bin/rails generate nitro_kit:install
26
26
  bin/rails nitro_kit:doctor
27
27
  ```
28
28
 
29
- The [agent guide](docs/agent_guide.md), [Rails integration guide](docs/rails_integration.md), and [component contracts](docs/component_contracts.md) are included with the gem.
29
+ Example migration prompt:
30
+
31
+ > Upgrade this Rails app to Nitro Kit `2.0.0.alpha.3`. Run the installer, follow its diagnostics, preserve existing behavior and styling, and use Nitro Kit MCP patterns where helpful. Run tests and summarize changes or unresolved issues.
32
+
33
+ Example new application prompt:
34
+
35
+ > Build this Rails app with Nitro Kit `2.0.0.alpha.3`. Run the installer, follow the included agent guide, compose gem-owned components, and use Nitro Kit MCP patterns where helpful. Add tests and summarize the result.
36
+
37
+ The [agent guide](docs/agent_guide.md), [Rails integration guide](docs/rails_integration.md), [component contracts](docs/component_contracts.md), and [browser support policy](docs/browser_support.md) are included with the gem.
38
+
39
+ ## Browser support
40
+
41
+ Nitro Kit uses modern web standards while keeping core content and actions
42
+ usable for the overwhelming majority of people on maintained browsers. The
43
+ practical target is current stable and popular evergreen releases from roughly
44
+ the previous two years, with Mobile Safari as a first-class target. Small,
45
+ feature-detected fallbacks preserve essential behavior without holding
46
+ components to the oldest browser's feature set; visual polish may degrade. See
47
+ the [browser support policy](docs/browser_support.md) for the dated browser
48
+ matrix and canonical full/reduced/unavailable no-JavaScript classifications.
30
49
 
31
50
  Maintaining Nitro Kit 1? Its frozen documentation remains at [v1.nitrokit.dev](https://v1.nitrokit.dev).
32
51
 
data/STYLE_GUIDE.md CHANGED
@@ -32,6 +32,35 @@ render immediately and only work from a Phlex context; they do not work in ERB.
32
32
  - Let applications customize themes and compose product-specific UI without editing Nitro internals.
33
33
  - Keep behavior minimal, progressive, and Turbo-safe.
34
34
 
35
+ ## Browser compatibility
36
+
37
+ The public compatibility contract lives in
38
+ [`docs/browser_support.md`](docs/browser_support.md). Use modern standards while
39
+ keeping essential behavior usable for the overwhelming majority of people on
40
+ maintained browsers. The practical target is current stable and popular
41
+ evergreen Chrome, Edge, Firefox, macOS Safari, and iOS Safari releases from
42
+ roughly the previous two years. Treat Mobile Safari as a primary browser. The
43
+ dated release matrix sets the actual floor by release date and usage, not equal
44
+ major-version counts.
45
+
46
+ Prefer approved native standards even when their support is newer than the
47
+ window, but do not confuse standards adoption with baseline availability.
48
+ Feature-detect the preferred path and add the smallest Nitro-owned fallback
49
+ when its absence breaks core content, navigation, submission, disclosure, or
50
+ overlay operation. A simpler layout, placement, wrapping, or animation is an
51
+ acceptable fallback. Copying controllers into applications, requiring every
52
+ consumer to choose a polyfill, or silently leaving a control inert is not.
53
+
54
+ Record no-JavaScript behavior per interactive component. Test the native and
55
+ fallback paths, Turbo cache and reconnect lifecycles, keyboard behavior, and a
56
+ representative browser near the support-window floor. Chromium emulation alone
57
+ does not establish Safari or iOS compatibility.
58
+
59
+ Place a broadly supported CSS declaration before a newer visual enhancement,
60
+ or use a feature query when unsupported syntax would invalidate layout, color,
61
+ contrast, focus visibility, or interaction. Unsupported polish may disappear;
62
+ readability and operability may not.
63
+
35
64
  ## File layout
36
65
 
37
66
  ```text
@@ -206,7 +235,7 @@ component translates each string the controller needs and emits it through the
206
235
  Stimulus values API:
207
236
 
208
237
  ```html
209
- <div data-nk--dropzone-queued-value="Queued">
238
+ <div data-nk--dropzone-queued-value="Queued"></div>
210
239
  ```
211
240
 
212
241
  The controller reads the value and keeps the shipped English literal only as an
@@ -219,10 +248,13 @@ a translator sees one grammar in both languages.
219
248
  Nitro components never emit or depend on classes. The only exception is:
220
249
 
221
250
  ```ruby
222
- desperately_need_a_class: "external-widget-hook"
251
+ desperately_need_a_class: [
252
+ "external-widget-hook",
253
+ { "is-active": active? }
254
+ ]
223
255
  ```
224
256
 
225
- It must produce both the class and `data-nk-escape="class"`. Blank or non-string values raise. Implement this once in the base component.
257
+ It accepts Rails `class_names` values—strings, symbols, nested arrays, and conditional hashes—and normalizes them into a deduplicated string. It must contain at least one class and produce both the class and `data-nk-escape="class"`. Implement this once in the base component. Tailwind applications may run a Tailwind-aware merger before passing classes when conflicting utilities need resolution; Nitro does not require one.
226
258
 
227
259
  ## CSS architecture
228
260
 
@@ -275,7 +307,7 @@ Never target an unqualified `[data-slot]`. Never use `transition: all`.
275
307
 
276
308
  Public `--nk-*` variables cover themeable decisions: semantic colors, paired foregrounds, typography, spacing, radii, control dimensions, shadows, borders, motion, and content widths.
277
309
 
278
- Buttons and data-entry controls share control heights, radii, border geometry, focus treatment, and disabled treatment, but they do not share one surface role. Inputs, selects, textareas, and unchecked controls use the general surface tokens. The raised default Button uses the public `--nk-button-default-background`, `--nk-button-default-hover-background`, `--nk-button-default-foreground`, and `--nk-button-default-border` tokens. Button-like controls such as the native file selector may consume the same treatment; do not make ordinary data-entry surfaces depend on it.
310
+ Buttons and data-entry controls share control heights, the default radius scale, border geometry, focus treatment, and disabled treatment, but they do not share one surface role. `--nk-button-radius` may override only Button shape when an application deliberately distinguishes buttons from inputs and surfaces. Inputs, selects, textareas, and unchecked controls use the general surface tokens. The raised default Button uses the public `--nk-button-default-background`, `--nk-button-default-hover-background`, `--nk-button-default-foreground`, and `--nk-button-default-border` tokens. Button-like controls such as the native file selector may consume the same treatment; do not make ordinary data-entry surfaces depend on it.
279
311
 
280
312
  Private `--_nk-*` variables coordinate component mechanics and are not a theme API.
281
313
 
@@ -370,7 +402,7 @@ Do not add mandatory Dropzone.js, Ransack, or image-processing dependencies to N
370
402
 
371
403
  Native HTML and CSS own behavior when they already provide the required semantics. Stimulus adds the smallest missing enhancement.
372
404
 
373
- - Use `details`/`summary` for disclosure, declarative `command`/`commandfor` for dialogs, native Popover for dropdown visibility, and CSS hover/focus for tooltips.
405
+ - Prefer `details`/`summary` for disclosure, declarative `command`/`commandfor` for dialogs, native Popover for dropdown visibility, and CSS hover/focus for tooltips. Before making one authoritative, verify that it covers `docs/browser_support.md` or pair it with the smallest capability-detected fallback.
374
406
  - Do not mirror browser-owned open state into `data-state`, `aria-expanded`, or hidden attributes. Use targets and values only for state Nitro genuinely owns.
375
407
  - The exception is state HTML cannot express as an attribute at all. A checkbox's `indeterminate` is a DOM property with no markup form, so `Checkbox` mounts `nk--checkable` only when `indeterminate: true`, and that controller's whole scope is applying the property and owning the matching `data-state="indeterminate"`. Ordinary checked state stays native, with no controller and no mirrored `data-state`. Do not widen a controller past the one state the browser cannot express.
376
408
  - Keep native state selectors such as `[open]` and `:popover-open` authoritative in CSS.