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
@@ -10,7 +10,7 @@
10
10
  inset-block-end: calc(var(--nk-space) * 5);
11
11
  display: flex;
12
12
  flex-direction: column;
13
- inline-size: min(26rem, calc(100vw - (var(--nk-space) * 10)));
13
+ inline-size: min(26rem, calc(100% - (var(--nk-space) * 10)));
14
14
  gap: calc(var(--nk-space) * 3);
15
15
  margin: 0;
16
16
  padding: 0;
@@ -33,7 +33,7 @@
33
33
  background: var(--_nk-toast-background);
34
34
  border: var(--nk-border-width) solid var(--_nk-toast-border);
35
35
  border-radius: var(--nk-radius-lg);
36
- box-shadow: var(--nk-shadow-lg);
36
+ box-shadow: var(--nk-shadow-md);
37
37
  transition:
38
38
  opacity var(--nk-duration-normal) var(--nk-ease),
39
39
  transform var(--nk-duration-normal) var(--nk-ease);
@@ -47,8 +47,8 @@
47
47
  }
48
48
 
49
49
  :where([data-nk="toast-item"] [data-slot="toast-item-title"]) {
50
- font-size: var(--nk-text-sm);
51
- font-weight: var(--nk-font-weight-semibold);
50
+ font-size: var(--nk-title-compact-size);
51
+ font-weight: var(--nk-title-compact-weight);
52
52
  line-height: var(--nk-leading-tight);
53
53
  text-wrap: balance;
54
54
  }
@@ -66,60 +66,13 @@
66
66
  }
67
67
 
68
68
  @layer nitro-kit.variant {
69
- :where([data-nk="toast-item"][data-variant="info"]) {
70
- --_nk-toast-background: color-mix(
71
- in oklab,
72
- var(--nk-color-info) 10%,
73
- var(--nk-color-surface)
74
- );
75
- --_nk-toast-foreground: var(--nk-color-info-content);
76
- --_nk-toast-border: color-mix(
77
- in oklab,
78
- var(--nk-color-info) 45%,
79
- transparent
80
- );
81
- }
82
-
83
- :where([data-nk="toast-item"][data-variant="success"]) {
84
- --_nk-toast-background: color-mix(
85
- in oklab,
86
- var(--nk-color-success) 10%,
87
- var(--nk-color-surface)
88
- );
89
- --_nk-toast-foreground: var(--nk-color-success-content);
90
- --_nk-toast-border: color-mix(
91
- in oklab,
92
- var(--nk-color-success) 45%,
93
- transparent
94
- );
95
- }
96
-
97
- :where([data-nk="toast-item"][data-variant="warning"]) {
98
- --_nk-toast-background: color-mix(
99
- in oklab,
100
- var(--nk-color-warning) 10%,
101
- var(--nk-color-surface)
102
- );
103
- --_nk-toast-foreground: var(--nk-color-warning-content);
104
- --_nk-toast-border: color-mix(
105
- in oklab,
106
- var(--nk-color-warning) 45%,
107
- transparent
108
- );
109
- }
110
-
111
- :where([data-nk="toast-item"][data-variant="error"]) {
112
- --_nk-toast-background: color-mix(
113
- in oklab,
114
- var(--nk-color-danger) 10%,
115
- var(--nk-color-surface)
116
- );
117
- --_nk-toast-foreground: var(--nk-color-danger-content);
118
- --_nk-toast-border: color-mix(
119
- in oklab,
120
- var(--nk-color-danger) 45%,
121
- transparent
122
- );
69
+ /* Colour, tint strength, and appearance switching all come from the shared
70
+ semantic palette, so a Toast and an Alert of the same variant render
71
+ identically. */
72
+ :where([data-nk="toast-item"][data-variant]) {
73
+ --_nk-toast-background: var(--_nk-semantic-surface);
74
+ --_nk-toast-border: var(--_nk-semantic-border);
75
+ --_nk-toast-foreground: var(--_nk-semantic-content);
123
76
  }
124
77
  }
125
78
 
@@ -1,7 +1,7 @@
1
1
  @layer nitro-kit.base {
2
2
  :where([data-nk="toolbar"]) {
3
3
  display: flex;
4
- min-width: 0;
4
+ min-inline-size: 0;
5
5
  flex-wrap: wrap;
6
6
  align-items: center;
7
7
  justify-content: space-between;
@@ -13,7 +13,7 @@
13
13
  [data-nk="toolbar"] > [data-slot="toolbar-trailing"]
14
14
  ) {
15
15
  display: flex;
16
- min-width: 0;
16
+ min-inline-size: 0;
17
17
  /* Regions never exceed the toolbar, so nested content such as a
18
18
  scrolling ButtonGroup receives real width pressure when stacked. */
19
19
  max-inline-size: 100%;
@@ -8,6 +8,10 @@
8
8
  position: absolute;
9
9
  z-index: 50;
10
10
  inline-size: max-content;
11
+ /* Absolutely positioned inside its wrapper, so a percentage would resolve
12
+ against the trigger, not the viewport. 100vw can overshoot by a classic
13
+ scrollbar's width, but only below a 22.5rem viewport, where scrollbars
14
+ overlay. The fixed overlays use 100% of the initial containing block. */
11
15
  max-inline-size: min(20rem, calc(100vw - (var(--nk-space) * 8)));
12
16
  padding: calc(var(--nk-space) * 1.5) calc(var(--nk-space) * 2.5);
13
17
  color: var(--nk-color-foreground);
@@ -106,7 +106,7 @@
106
106
  border-radius: var(--nk-radius-sm);
107
107
  }
108
108
  :where([data-nk="typeset"]) > table:not([data-nk], [data-typeset="off"]) {
109
- width: 100%;
109
+ inline-size: 100%;
110
110
  border-collapse: collapse;
111
111
  font-size: 0.925em;
112
112
  }
@@ -250,7 +250,7 @@
250
250
  }
251
251
 
252
252
  table {
253
- width: 100%;
253
+ inline-size: 100%;
254
254
  border-collapse: collapse;
255
255
  font-size: 0.925em;
256
256
  }
@@ -267,8 +267,8 @@
267
267
  }
268
268
 
269
269
  :where(img, video, svg) {
270
- max-width: 100%;
271
- height: auto;
270
+ max-inline-size: 100%;
271
+ block-size: auto;
272
272
  border-radius: var(--nk-radius-md);
273
273
  }
274
274
 
@@ -19,7 +19,7 @@
19
19
  /* Nitro-owned boxes never establish a min-content floor, so long slot
20
20
  content shrinks instead of overflowing its flex or grid parent. */
21
21
  :where([data-nk], [data-nk] [data-slot]) {
22
- min-width: 0;
22
+ min-inline-size: 0;
23
23
  }
24
24
 
25
25
  :where(html, :host) {
@@ -119,7 +119,7 @@
119
119
  }
120
120
 
121
121
  :where(input)::-webkit-date-and-time-value {
122
- min-height: 1lh;
122
+ min-block-size: 1lh;
123
123
  text-align: inherit;
124
124
  }
125
125
 
@@ -134,7 +134,7 @@
134
134
 
135
135
  :where(input)::-webkit-inner-spin-button,
136
136
  :where(input)::-webkit-outer-spin-button {
137
- height: auto;
137
+ block-size: auto;
138
138
  }
139
139
 
140
140
  :where(input):-moz-ui-invalid {
@@ -164,12 +164,12 @@
164
164
  }
165
165
 
166
166
  :where(img, video) {
167
- max-width: 100%;
168
- height: auto;
167
+ max-inline-size: 100%;
168
+ block-size: auto;
169
169
  }
170
170
 
171
171
  :where(hr) {
172
- height: 0;
172
+ block-size: 0;
173
173
  color: inherit;
174
174
  border-top-width: var(--nk-border-width);
175
175
  }