nitro_kit 2.0.0.alpha.3 → 2.0.0.alpha.4

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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +179 -0
  3. data/README.md +22 -26
  4. data/STYLE_GUIDE.md +10 -0
  5. data/app/assets/stylesheets/nitro_kit-tailwind-v4.css +3 -3
  6. data/app/assets/stylesheets/nitro_kit.css +1220 -572
  7. data/app/components/nitro_kit/accordion.rb +1 -19
  8. data/app/components/nitro_kit/alert.rb +1 -11
  9. data/app/components/nitro_kit/app_navigation.rb +44 -9
  10. data/app/components/nitro_kit/appearance_picker.rb +10 -1
  11. data/app/components/nitro_kit/badge.rb +13 -4
  12. data/app/components/nitro_kit/combobox.rb +1 -17
  13. data/app/components/nitro_kit/command_palette.rb +1 -0
  14. data/app/components/nitro_kit/dropzone.rb +1 -1
  15. data/app/components/nitro_kit/form_builder.rb +1 -1
  16. data/app/components/nitro_kit/select.rb +1 -14
  17. data/app/components/nitro_kit/tabs.rb +1 -0
  18. data/app/javascript/controllers/nk/command_palette_controller.js +4 -0
  19. data/app/javascript/controllers/nk/tabs_controller.js +13 -1
  20. data/docs/agent_guide.md +63 -138
  21. data/docs/agent_native_spec.md +72 -400
  22. data/docs/browser_support.md +77 -188
  23. data/docs/component_contracts.md +56 -36
  24. data/docs/customization.md +675 -89
  25. data/docs/hotwire.md +61 -99
  26. data/docs/initialization_prompt.md +27 -57
  27. data/docs/migration_1_to_2.md +34 -18
  28. data/docs/patterns/application_foundation.md +45 -121
  29. data/docs/patterns/crud_resource.md +44 -129
  30. data/docs/patterns/destructive_action.md +45 -102
  31. data/docs/patterns/flash_and_toast.md +18 -36
  32. data/docs/patterns/inline_edit.md +21 -44
  33. data/docs/patterns/queryable_collection.md +65 -161
  34. data/docs/patterns/resource_form.md +33 -81
  35. data/docs/rails_conventions.md +38 -78
  36. data/docs/rails_integration.md +96 -474
  37. data/lib/nitro_kit/installation.rb +11 -3
  38. data/lib/nitro_kit/migration_inventory.rb +15 -8
  39. data/lib/nitro_kit/version.rb +1 -1
  40. data/plugins/nitro-kit/skills/nitro-kit-rails/SKILL.md +7 -0
  41. data/plugins/nitro-kit/skills/nitro-kit-ui/SKILL.md +15 -8
  42. data/src/stylesheets/nitro_kit/components/accordion.css +4 -4
  43. data/src/stylesheets/nitro_kit/components/alert.css +20 -29
  44. data/src/stylesheets/nitro_kit/components/app_navigation.css +74 -2
  45. data/src/stylesheets/nitro_kit/components/app_shell.css +3 -3
  46. data/src/stylesheets/nitro_kit/components/appearance_picker.css +20 -8
  47. data/src/stylesheets/nitro_kit/components/auth_shell.css +2 -2
  48. data/src/stylesheets/nitro_kit/components/avatar.css +12 -8
  49. data/src/stylesheets/nitro_kit/components/avatar_stack.css +12 -10
  50. data/src/stylesheets/nitro_kit/components/badge.css +13 -9
  51. data/src/stylesheets/nitro_kit/components/button.css +42 -25
  52. data/src/stylesheets/nitro_kit/components/card.css +2 -2
  53. data/src/stylesheets/nitro_kit/components/checkbox.css +29 -46
  54. data/src/stylesheets/nitro_kit/components/checkbox_group.css +3 -3
  55. data/src/stylesheets/nitro_kit/components/combobox.css +6 -6
  56. data/src/stylesheets/nitro_kit/components/command_palette.css +62 -4
  57. data/src/stylesheets/nitro_kit/components/container.css +6 -6
  58. data/src/stylesheets/nitro_kit/components/control_group.css +9 -9
  59. data/src/stylesheets/nitro_kit/components/danger_zone.css +6 -6
  60. data/src/stylesheets/nitro_kit/components/data_section.css +4 -4
  61. data/src/stylesheets/nitro_kit/components/details_table.css +7 -5
  62. data/src/stylesheets/nitro_kit/components/dialog.css +3 -3
  63. data/src/stylesheets/nitro_kit/components/dropdown.css +7 -7
  64. data/src/stylesheets/nitro_kit/components/dropzone.css +7 -7
  65. data/src/stylesheets/nitro_kit/components/empty_state.css +4 -4
  66. data/src/stylesheets/nitro_kit/components/field.css +2 -2
  67. data/src/stylesheets/nitro_kit/components/fieldset.css +2 -2
  68. data/src/stylesheets/nitro_kit/components/flex.css +1 -1
  69. data/src/stylesheets/nitro_kit/components/grid.css +1 -1
  70. data/src/stylesheets/nitro_kit/components/icon.css +5 -5
  71. data/src/stylesheets/nitro_kit/components/input.css +33 -6
  72. data/src/stylesheets/nitro_kit/components/page_header.css +4 -4
  73. data/src/stylesheets/nitro_kit/components/pagination.css +3 -3
  74. data/src/stylesheets/nitro_kit/components/pagination_bar.css +2 -2
  75. data/src/stylesheets/nitro_kit/components/palette.css +140 -72
  76. data/src/stylesheets/nitro_kit/components/progressive_image.css +1 -1
  77. data/src/stylesheets/nitro_kit/components/radio_button.css +28 -33
  78. data/src/stylesheets/nitro_kit/components/radio_button_group.css +6 -6
  79. data/src/stylesheets/nitro_kit/components/rich_text_area.css +2 -2
  80. data/src/stylesheets/nitro_kit/components/select.css +24 -8
  81. data/src/stylesheets/nitro_kit/components/settings_layout.css +5 -5
  82. data/src/stylesheets/nitro_kit/components/settings_section.css +2 -2
  83. data/src/stylesheets/nitro_kit/components/sheet.css +10 -10
  84. data/src/stylesheets/nitro_kit/components/stat_grid.css +1 -1
  85. data/src/stylesheets/nitro_kit/components/switch.css +34 -40
  86. data/src/stylesheets/nitro_kit/components/table.css +8 -4
  87. data/src/stylesheets/nitro_kit/components/tabs.css +5 -1
  88. data/src/stylesheets/nitro_kit/components/textarea.css +20 -5
  89. data/src/stylesheets/nitro_kit/components/toast.css +11 -58
  90. data/src/stylesheets/nitro_kit/components/toolbar.css +2 -2
  91. data/src/stylesheets/nitro_kit/components/tooltip.css +4 -0
  92. data/src/stylesheets/nitro_kit/components/typeset.css +4 -4
  93. data/src/stylesheets/nitro_kit/reset.css +6 -6
  94. data/src/stylesheets/nitro_kit/tokens.css +497 -74
  95. metadata +1 -2
  96. data/docs/new_app_strategy.md +0 -22
@@ -1,193 +1,82 @@
1
1
  # Browser support
2
2
 
3
- Nitro Kit uses modern web standards while keeping core content and actions
4
- usable for the overwhelming majority of people on maintained browsers.
5
-
6
- The practical target is current stable and popular evergreen releases from
7
- roughly the two years before each Nitro Kit release. This includes Chrome and
8
- Edge on desktop, Chrome on Android, Firefox, Safari on macOS, and Safari on iOS.
9
- It is a coverage target, not a promise of identical results in every version or
10
- a reason to hold components to the oldest browser's feature set.
11
-
12
- Each release's dated test matrix sets the concrete floor using release date and
13
- real-world usage rather than an equal number of major versions. Mobile Safari
14
- is a first-class target, not a reduced mobile tier. Important usage,
15
- accessibility, or platform constraints may justify coverage outside the usual
16
- window.
17
-
18
- ## Functional baseline
19
-
20
- In browsers covered by a release's matrix, Nitro components must keep their
21
- essential content and actions usable. Forms must submit, links must navigate,
22
- disclosures and overlays must open and close, destructive actions must retain a
23
- usable request path, and controls must preserve their accessible names and
24
- keyboard behavior.
25
-
26
- Visual and convenience enhancements may degrade when a browser lacks a newer
27
- CSS or platform feature. Exact animation, preferred overlay placement, advanced
28
- text wrapping, and similar polish are not required when the simpler result
29
- remains understandable and operable. Support means usable and accessible, not
30
- pixel-identical presentation or identical convenience behavior.
31
-
32
- Nitro prefers approved web standards and native browser behavior, but native is
33
- not synonymous with supported. A newer standard can be adopted before it covers
34
- the practical browser target when Nitro can preserve essential behavior:
35
-
36
- 1. Keep the standard markup or API as the preferred path.
37
- 2. Detect support by capability rather than user agent.
38
- 3. Add the smallest Nitro-owned fallback needed to preserve functionality.
39
- 4. Use a focused polyfill only when a local fallback cannot provide the
40
- required semantics.
41
-
42
- Typeset is a CSS-only exception to the usual progressive-enhancement note:
43
- its readable source uses `@scope`, while the stylesheet also contains a
44
- low-specificity fallback for engines that do not parse `@scope` (including
45
- Firefox through 145). The fallback provides root typography and explicitly
46
- anchored direct-child rules for headings, flow elements, lists, code/pre, and
47
- tables, plus links within those supported semantic elements and their focus
48
- state. It excludes direct nested
49
- `[data-nk]` and `data-typeset="off"` boundaries and intentionally does not
50
- promise the full descendant styling of the scoped path.
51
-
52
- Applications should not need to copy Nitro controllers or install a general
53
- polyfill bundle for a Nitro-owned component. Browsers outside a release's matrix
54
- may still work, but Nitro does not promise fixes for them.
3
+ **Audience:** Application developers and coding agents evaluating Nitro Kit
4
+ compatibility. Core maintainers use this policy when changing components.
5
+
6
+ Nitro Kit targets current stable and widely used evergreen Chrome, Edge,
7
+ Firefox, macOS Safari, and iOS Safari releases from roughly the previous two
8
+ years. Mobile Safari is a first-class target. Browsers outside that window may
9
+ work, but are not guaranteed fixes.
10
+
11
+ Support means essential content and actions remain usable and accessible. It
12
+ does not promise pixel-identical rendering, animation, wrapping, or overlay
13
+ placement. Nitro adopts modern standards when it can preserve essential
14
+ behavior with capability detection and a focused fallback.
15
+
16
+ Normal support assumes Nitro Kit's documented JavaScript is installed. The
17
+ matrix below defines the reduced baseline when Nitro JavaScript, Stimulus, and
18
+ Turbo are absent. A server-rendered HTML response is not automatically a JavaScript-free
19
+ interaction: it may still be inside a closed dialog or depend
20
+ on Turbo transport.
21
+
22
+ ## Without Nitro JavaScript
23
+
24
+ - **Full** — essential content and actions remain available.
25
+ - **Reduced** — useful content or a simpler native interaction remains, but
26
+ part of the defining behavior is absent.
27
+ - **Unavailable** the defining interaction cannot be completed. Critical
28
+ actions need an ordinary server-rendered route outside the component.
29
+
30
+ | Component or family | Baseline without JavaScript |
31
+ | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
32
+ | Links, Button, ButtonTo, ordinary forms | **Full.** Native navigation and submission work; Turbo feedback and confirmation do not. |
33
+ | Input, Select, Textarea, Switch, RadioButton, Checkbox | **Full.** Indeterminate Checkbox is **Reduced** because `indeterminate` is a DOM property. |
34
+ | Accordion | **Full.** Single grouping is **Reduced** where named `details` is unsupported. |
35
+ | AppShell | **Full.** Navigation remains in document flow instead of becoming a drawer. |
36
+ | Appearance | **Reduced.** CSS follows system preference; a picker cannot persist changes. |
37
+ | Avatar | **Reduced.** The image and fallback render, but image failure does not reveal the fallback. |
38
+ | Combobox | **Full.** The native Select remains; searchable listbox behavior is absent. |
39
+ | Dialog and Sheet | **Reduced** with Invoker Commands; otherwise **Unavailable** while closed. |
40
+ | CommandPalette | **Reduced** with Invoker Commands; otherwise **Unavailable** while closed. Search, shortcuts, and Turbo results are absent. |
41
+ | Dropdown | **Reduced.** Native Popover works; menu keyboard behavior, focus restoration, trigger-relative placement, and the WebKit outside-pointer fallback are absent. |
42
+ | Dropzone | **Full.** The native file input submits; previews, validation feedback, progress, and direct upload are absent. |
43
+ | RichTextArea | **Unavailable** unless the host editor provides its own fallback. |
44
+ | ProgressiveImage | **Reduced.** The native image loads; enhanced load and error state are absent. |
45
+ | Tabs | **Reduced.** All panels remain visible; single-panel selection and keyboard behavior are absent. |
46
+ | Toast | **Reduced.** Flash content remains; dismissal is absent. |
47
+ | Tooltip | **Reduced.** CSS hover and focus disclosure remain; Escape dismissal is absent. |
48
+
49
+ ## Known native limitations
55
50
 
56
51
  ### Month and week inputs
57
52
 
58
- `Input(type: :month)` and `Input(type: :week)`, including the matching `Field`
59
- and `FormBuilder` paths, retain the standard native input types as progressive
60
- enhancement. Desktop Safari and Firefox can expose these controls as text
61
- inputs, and native week selection arrived later on iOS Safari. In those cases a
62
- picker, browser normalization, and enforcement of `min`, `max`, and `step` may
63
- be absent.
64
-
65
- Applications must accept and validate the submitted ISO shapes on the server:
66
- `YYYY-MM` for month and `YYYY-Www` for ISO week. They must also validate allowed
67
- ranges and increments as domain rules; the native constraint attributes are
68
- client-side hints, not an authorization or validation boundary. When choosing
69
- only from an exact, bounded set is essential, compose an application-owned
70
- `Select` with explicit month or week options instead of relying on a generic
71
- Nitro datepicker. Ordinary `date`, `time`, and `datetime-local` controls keep
72
- their existing contracts.
73
-
74
- ## JavaScript and progressive enhancement
75
-
76
- Normal support assumes the documented Nitro JavaScript is installed. Nitro is
77
- server-rendered and progressively enhanced, not JavaScript-free. Static content,
78
- links, ordinary forms, and only the component-specific baselines documented in
79
- the component contracts are guaranteed without JavaScript. Turbo transport,
80
- Stimulus enhancements, and compatibility bridges are then unavailable.
81
-
82
- The classifications below describe the rendered page with Nitro JavaScript,
83
- Stimulus, and Turbo absent:
84
-
85
- - **Full** means the component's essential content and action remain available;
86
- documented convenience behavior may still be absent.
87
- - **Reduced** means useful content or a simpler native interaction remains, but
88
- part of the component's defining interaction is absent.
89
- - **Unavailable** means the defining interaction cannot be completed. Critical
90
- actions need an ordinary server-rendered route outside that component.
91
-
92
- A server-rendered HTML response is not automatically a JavaScript-free
93
- interaction. It can still place content in a closed dialog or rely on Turbo to
94
- submit, replace, or confirm. Likewise, an HTML response branch is the fallback
95
- for Turbo transport, not proof that the surrounding control works without
96
- JavaScript.
97
-
98
- ### No-JavaScript component matrix
99
-
100
- | Component or family | Classification | Concise baseline without JavaScript |
101
- | ---------------------------------------------------------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
102
- | Links, Button, ButtonTo, and ordinary forms | Full | Native navigation and submission work. Submission indicators and Turbo transport or confirmation do not. |
103
- | Input, Select, Textarea, Switch, RadioButton, and Checkbox | Full; reduced for indeterminate Checkbox | Native controls edit and submit. `indeterminate: true` cannot be applied because it is a DOM property; month/week have the separate native-control limitations below. |
104
- | Accordion | Full; reduced single grouping where named `details` is unsupported | Every `details` opens and closes. Exclusive grouping depends on native shared-`name` support. |
105
- | AppShell | Full | Navigation stays visible in document flow at narrow widths; the enhanced drawer interaction is absent. |
106
- | Appearance | Reduced | CSS follows the system preference and server-rendered picker state remains visible, but a picker cannot apply or persist a new choice without the bootstrap runtime and controller. |
107
- | Avatar | Reduced | The native image and rendered fallback remain, but a failed image is not swapped to its fallback. |
108
- | Combobox | Full | The labelled native Select remains the named control and submission source; searchable listbox behavior is absent. |
109
- | Dialog and Sheet | Reduced with Invoker Commands; unavailable without them | Declarative trigger and close controls work only with native Invoker Commands. A server-open nonmodal Dialog remains visible; controller dismissal policy and the compatibility bridge are absent. |
110
- | CommandPalette | Reduced with Invoker Commands; unavailable without them | Native commands can open the dialog and its destination links navigate, but search, shortcut, announcements, and Turbo results are absent. Without Invoker Commands the closed content is unreachable. |
111
- | Dropdown | Reduced | Native Popover opens, closes, and light-dismisses. Menu keyboard conventions, focus restoration, collision-aware placement, and Nitro's outside-pointer compatibility fallback are absent; CSS supplies bounded top-left placement. |
112
- | Dropzone | Full | Its labelled native file input and ordinary form submission work; drag preview, policy feedback, progress, and direct upload are absent. |
113
- | RichTextArea | Unavailable unless the host editor provides its own fallback | Nitro wraps trusted host-editor markup and does not manufacture a plain-text control. The host editor owns its JavaScript and fallback contract. |
114
- | ProgressiveImage | Reduced | The native image loads and retains its accessible alternative; decode/load state and the visible error fallback are not enhanced. |
115
- | Tabs | Reduced | Every panel and its heading control remain visible and reachable; single-panel selection and APG keyboard behavior are absent. |
116
- | Toast | Reduced | Server-rendered flash content and live-region semantics remain; timed and manual dismissal are absent. |
117
- | Tooltip | Reduced | CSS hover and focus disclosure remain; Escape dismissal is absent. |
118
-
119
- Typeset is not interactive, but its no-JavaScript and no-`@scope` CSS path is
120
- also reduced: the fallback covers the documented semantic subset rather than
121
- full descendant parity.
122
-
123
- ### Compatibility details
124
-
125
- #### Accordion
126
-
127
- Accordion always keeps native `details` and `summary` as the disclosure
128
- authority. Its no-JavaScript baseline is full for opening and closing each
129
- item. In `single` mode, a shared `name` is the browser-native exclusive-group
130
- mechanism: browsers that support named details provide the full one-open-item
131
- behavior without a Nitro controller.
132
-
133
- The short Firefox gap before Firefox 130, including Firefox 128 ESR, has a
134
- reduced `single` baseline: each disclosure still opens and closes normally,
135
- but more than one item can remain open. Nitro does not detect the browser or
136
- install JavaScript merely to duplicate that native grouping. Applications for
137
- which strict one-open-at-a-time behavior is essential in that gap should use a
138
- different interaction with an application-owned server or JavaScript policy.
139
-
140
- Browser compatibility is verified against current stable browsers and
141
- representative older releases near the edge of the support window. Compatibility
142
- work prioritizes real Safari and iOS Safari coverage in addition to Chromium;
143
- tests that merely remove an attribute in current Chrome are useful branch tests,
144
- but are not a substitute for the affected browser engine.
145
-
146
- Dialog, Sheet, and CommandPalette keep declarative `command`/`commandfor`
147
- controls in their server markup. With Nitro JavaScript installed, their shared
148
- controller uses the reflected invoker relationship when available and falls
149
- back to `HTMLDialogElement.showModal()` or `close()` only when that relationship
150
- cannot run. Without JavaScript, opening and closing these overlays is available
151
- only in browsers with Invoker Commands; destination links and ordinary forms
152
- remain server-rendered, but content inside a closed dialog is not reachable.
153
-
154
- Each Nitro release records a dated tested-browser matrix. The rolling policy is
155
- the durable contract; the matrix records the concrete versions used to verify a
156
- particular release.
157
-
158
- ## Nitro Kit 2.0 release matrix (2026-08-05)
159
-
160
- This is the release checklist for the next Nitro 2.0 release. “Automated” means
161
- the Rails/Selenium system suite runs in CI; it does not claim that Selenium
162
- reproduces every device or browser UI detail. Version numbers are the stable
163
- targets recorded on this date, and should be refreshed if the release slips.
164
-
165
- | Target | Near-floor reference | Current release verification | Method |
166
- | --------------- | -------------------- | ---------------------------- | ----------------------------------------------------- |
167
- | Chrome desktop | Chrome 128 | Chrome 151 | Automated Ubuntu full-system-suite lane |
168
- | Edge desktop | Edge 128 | Edge 151 | Manual Chromium release check (same engine as Chrome) |
169
- | Chrome Android | Chrome 128 | Chrome 151 on Android | Manual real-device check |
170
- | Firefox desktop | Firefox 128 ESR | Firefox 153 | Automated Ubuntu priority-smoke lane |
171
- | Safari macOS | Safari 18 | Safari 26.5 | Automated `macos-latest` priority-smoke lane |
172
- | Safari iOS | Safari 18 / iOS 18 | Safari 26.5 / iOS 26.5 | Manual real-device release check |
173
-
174
- The automated matrix intentionally tests current Chrome, Firefox, and macOS
175
- Safari rather than downloading historical binaries. Chrome runs the full
176
- system suite. Firefox and Safari run `bin/browser-smoke`, the single maintained
177
- priority lane for Dialog, Sheet, CommandPalette, Dropdown/AppearancePicker,
178
- Accordion, Hotwire lifecycle, Typeset contracts, and date-family input
179
- behavior. Chrome DevTools emulation remains Chrome-only coverage and is not
180
- presented as cross-engine verification. Priority smoke lanes run with one
181
- worker; Chrome retains the full suite's normal parallelism.
182
-
183
- Before release, manually repeat those flows on one current Android Chrome and
184
- one current iPhone Safari, including narrow layout, VoiceOver/TalkBack where
185
- available, real form submission, and month/week ISO values. Record device OS,
186
- browser build, date, and any reduced-baseline behavior in the release notes.
187
- Do not describe the near-floor or iOS rows as automated coverage.
188
-
189
- The Firefox 128 ESR and older Safari behavior that cannot be installed
190
- reliably on GitHub-hosted runners is represented by capability-focused tests:
191
- stripping Invoker Commands and exercising Nitro fallbacks, plus the documented
192
- native month/week degradation. These branch simulations supplement, but do not
193
- replace, the dated real-browser checks.
53
+ `month` and `week` remain native input types. Some supported browsers expose
54
+ text entry without a picker, normalization, or reliable `min`, `max`, and
55
+ `step` enforcement. Applications must server-validate `YYYY-MM` or `YYYY-Www`
56
+ plus domain range and increment rules. Use an application-owned Select when an
57
+ exact bounded choice is required.
58
+
59
+ ### Dialog commands and Popover
60
+
61
+ Dialog, Sheet, and CommandPalette render declarative `command`/`commandfor`
62
+ controls. With Nitro JavaScript installed, the shared controller uses the
63
+ native relationship when available and falls back to `showModal()` or `close()`.
64
+ Dropdown keeps native Popover as the visibility authority and adds
65
+ keyboard, placement, focus, and WebKit outside-pointer behavior.
66
+
67
+ ### CSS feature fallbacks
68
+
69
+ Typeset uses `@scope` with a low-specificity fallback for browsers that do not
70
+ support it. The fallback covers the documented semantic text elements, not
71
+ every possible descendant selector.
72
+
73
+ ## Release verification
74
+
75
+ Automated CI runs the full system suite in Chrome and priority browser smoke
76
+ coverage in Firefox and macOS Safari. Before a release, maintainers also verify
77
+ the priority flows on current Android Chrome and iOS Safari. Capability-focused
78
+ tests supplement these runs; they do not prove an untested historical browser
79
+ version.
80
+
81
+ Release notes must record exact browser and device versions actually tested.
82
+ Do not publish planned or simulated versions as verified coverage.