nitro_kit 2.0.0.beta.1 → 2.0.0.beta.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +96 -1
  3. data/README.md +16 -2
  4. data/STYLE_GUIDE.md +4 -2
  5. data/app/assets/stylesheets/nitro_kit.css +567 -36
  6. data/app/assets/tailwind/nitro_kit/engine.css +15 -0
  7. data/app/components/nitro_kit/app_shell.rb +41 -5
  8. data/app/components/nitro_kit/avatar.rb +21 -2
  9. data/app/components/nitro_kit/card.rb +28 -1
  10. data/app/javascript/controllers/nk/app_shell_controller.js +64 -2
  11. data/config/locales/en.yml +1 -0
  12. data/docs/agent_native_spec.md +5 -4
  13. data/docs/browser_support.md +7 -1
  14. data/docs/component_contracts.md +93 -5
  15. data/docs/customization.md +35 -15
  16. data/docs/eject.md +86 -0
  17. data/docs/migration_1_to_2.md +1 -1
  18. data/docs/patterns/application_foundation.md +22 -0
  19. data/docs/patterns/inset_workspace.md +9 -1
  20. data/docs/rails_integration.md +4 -2
  21. data/lib/generators/nitro_kit/eject_generator.rb +26 -0
  22. data/lib/nitro_kit/ejection.rb +136 -0
  23. data/lib/nitro_kit/engine.rb +13 -0
  24. data/lib/nitro_kit/installation.rb +29 -7
  25. data/lib/nitro_kit/version.rb +1 -1
  26. data/lib/tasks/nitro_kit_tasks.rake +1 -1
  27. data/src/stylesheets/nitro_kit/components/app_navigation.css +4 -1
  28. data/src/stylesheets/nitro_kit/components/app_shell.css +209 -0
  29. data/src/stylesheets/nitro_kit/components/avatar.css +10 -0
  30. data/src/stylesheets/nitro_kit/components/avatar_stack.css +9 -5
  31. data/src/stylesheets/nitro_kit/components/card.css +206 -15
  32. data/src/stylesheets/nitro_kit/components/danger_zone.css +1 -1
  33. data/src/stylesheets/nitro_kit/components/dropzone.css +15 -0
  34. data/src/stylesheets/nitro_kit/components/empty_state.css +3 -3
  35. data/src/stylesheets/nitro_kit/components/field_group.css +6 -2
  36. data/src/stylesheets/nitro_kit/components/pagination_bar.css +3 -0
  37. data/src/stylesheets/nitro_kit/components/progressive_image.css +2 -0
  38. data/src/stylesheets/nitro_kit/components/settings_layout.css +2 -0
  39. data/src/stylesheets/nitro_kit/components/stat_grid.css +4 -4
  40. data/src/stylesheets/nitro_kit/components/toolbar.css +12 -0
  41. data/src/stylesheets/nitro_kit/components/tooltip.css +15 -1
  42. data/src/stylesheets/nitro_kit/components/typeset.css +4 -0
  43. data/src/stylesheets/nitro_kit/layers.css +8 -0
  44. data/src/stylesheets/nitro_kit/reset.css +12 -2
  45. data/{app/assets/stylesheets/nitro_kit-tailwind-v4.css → src/stylesheets/nitro_kit/tailwind.css} +4 -5
  46. data/src/stylesheets/nitro_kit/tokens.css +3 -2
  47. metadata +7 -3
@@ -22,11 +22,11 @@
22
22
  align-content: start;
23
23
  gap: calc(var(--nk-space) * 2);
24
24
  min-block-size: 100%;
25
- padding: calc(var(--nk-space) * 5);
25
+ padding: calc(var(--nk-space) * 6);
26
26
  background: var(--nk-color-surface);
27
27
  border: var(--nk-border-width) solid var(--nk-color-border);
28
- border-radius: var(--nk-radius-lg);
29
- box-shadow: var(--nk-shadow-sm);
28
+ border-radius: var(--nk-radius-xl);
29
+ box-shadow: var(--nk-shadow-xs);
30
30
  }
31
31
 
32
32
  :where([data-nk="stat-grid"] [data-slot="stat-grid-label"]) {
@@ -38,7 +38,7 @@
38
38
  :where([data-nk="stat-grid"] [data-slot="stat-grid-value"]) {
39
39
  font-size: var(--nk-text-2xl);
40
40
  font-variant-numeric: tabular-nums;
41
- font-weight: var(--nk-font-weight-bold);
41
+ font-weight: var(--nk-font-weight-semibold);
42
42
  line-height: var(--nk-leading-tight);
43
43
  overflow-wrap: anywhere;
44
44
  }
@@ -26,12 +26,24 @@
26
26
  justify-content: flex-end;
27
27
  margin-inline-start: auto;
28
28
  }
29
+
30
+ /* Application content in a region is a flex item; without this a heading
31
+ holding one long word keeps its min-content width and widens the page. */
32
+ :where(
33
+ [data-nk="toolbar"] > [data-slot="toolbar-leading"] > *,
34
+ [data-nk="toolbar"] > [data-slot="toolbar-trailing"] > *
35
+ ) {
36
+ min-inline-size: 0;
37
+ }
29
38
  }
30
39
 
31
40
  @layer nitro-kit.state {
32
41
  @media (width < 48rem) {
33
42
  :where([data-nk="toolbar"]) {
34
43
  flex-direction: column;
44
+ /* A wrapping column sizes its line to the widest item, so stretch
45
+ could not narrow anything; one column never needs to wrap. */
46
+ flex-wrap: nowrap;
35
47
  align-items: stretch;
36
48
  }
37
49
 
@@ -19,6 +19,9 @@
19
19
  line-height: var(--nk-leading-normal);
20
20
  text-wrap: pretty;
21
21
  pointer-events: auto;
22
+ /* Hidden tooltips leave layout entirely; a merely invisible one still
23
+ widens the page when it hangs past the viewport edge. */
24
+ display: none;
22
25
  visibility: hidden;
23
26
  background: var(--nk-color-elevated);
24
27
  border: var(--nk-border-width) solid var(--nk-color-border);
@@ -27,7 +30,8 @@
27
30
  opacity: 0;
28
31
  transition:
29
32
  opacity var(--nk-duration-fast) var(--nk-ease),
30
- visibility var(--nk-duration-fast) var(--nk-ease) allow-discrete;
33
+ visibility var(--nk-duration-fast) var(--nk-ease) allow-discrete,
34
+ display var(--nk-duration-fast) var(--nk-ease) allow-discrete;
31
35
  }
32
36
 
33
37
  :where([data-nk="tooltip"] > [data-slot="tooltip-content"]::before) {
@@ -111,8 +115,13 @@
111
115
  [data-nk="tooltip"]:not([data-dismissed]):focus-within
112
116
  > [data-slot="tooltip-content"]
113
117
  ) {
118
+ display: block;
114
119
  visibility: visible;
115
120
  opacity: 1;
121
+
122
+ @starting-style {
123
+ opacity: 0;
124
+ }
116
125
  }
117
126
 
118
127
  @media (hover: hover) {
@@ -120,8 +129,13 @@
120
129
  [data-nk="tooltip"]:not([data-dismissed]):hover
121
130
  > [data-slot="tooltip-content"]
122
131
  ) {
132
+ display: block;
123
133
  visibility: visible;
124
134
  opacity: 1;
135
+
136
+ @starting-style {
137
+ opacity: 0;
138
+ }
125
139
  }
126
140
  }
127
141
 
@@ -118,6 +118,9 @@
118
118
  padding: calc(var(--nk-space) * 2) calc(var(--nk-space) * 3);
119
119
  text-align: start;
120
120
  vertical-align: top;
121
+ /* Prose tables have no scroll wrapper, so an unbroken email or
122
+ identifier must be allowed to break inside its cell. */
123
+ overflow-wrap: anywhere;
121
124
  border-block-end: var(--nk-border-width) solid var(--nk-color-border);
122
125
  }
123
126
 
@@ -259,6 +262,7 @@
259
262
  padding: calc(var(--nk-space) * 2) calc(var(--nk-space) * 3);
260
263
  text-align: start;
261
264
  vertical-align: top;
265
+ overflow-wrap: anywhere;
262
266
  border-block-end: var(--nk-border-width) solid var(--nk-color-border);
263
267
  }
264
268
 
@@ -1,3 +1,11 @@
1
+ /*
2
+ * Global cascade-layer order. Declared first so that, when an application also
3
+ * loads a compiled Tailwind CSS v4 stylesheet, Nitro Kit sits between
4
+ * Tailwind's base and components layers and Tailwind utilities still win.
5
+ * Without Tailwind the extra layers are simply unused.
6
+ */
7
+ @layer properties, theme, base, nitro-kit, components, utilities;
8
+
1
9
  @layer nitro-kit.tokens,
2
10
  nitro-kit.reset,
3
11
  nitro-kit.base,
@@ -17,9 +17,19 @@
17
17
  }
18
18
 
19
19
  /* Nitro-owned boxes never establish a min-content floor, so long slot
20
- content shrinks instead of overflowing its flex or grid parent. */
20
+ content shrinks instead of overflowing its flex or grid parent, and a
21
+ word too long for its line breaks rather than painting past the box.
22
+ `break-word` leaves intrinsic sizing alone, so nothing shrinks that would
23
+ not have shrunk already; `nowrap` slots keep their single line. */
21
24
  :where([data-nk], [data-nk] [data-slot]) {
22
25
  min-inline-size: 0;
26
+ overflow-wrap: break-word;
27
+ }
28
+
29
+ /* A legend sizes to its content regardless of its fieldset, so a long
30
+ label would widen the page; cap it and let it wrap like any label. */
31
+ :where([data-nk] legend) {
32
+ max-inline-size: 100%;
23
33
  }
24
34
 
25
35
  :where(html, :host) {
@@ -106,7 +116,7 @@
106
116
  }
107
117
 
108
118
  :where(:disabled),
109
- ::file-selector-button:disabled {
119
+ :disabled::file-selector-button {
110
120
  cursor: default;
111
121
  }
112
122
 
@@ -1,10 +1,9 @@
1
1
  /*
2
- * Nitro Kit Tailwind CSS v4 adapter.
3
- * Load this before both Nitro Kit and compiled Tailwind stylesheets.
2
+ * Tailwind CSS v4 theme aliases. Maps Nitro tokens onto the theme variables
3
+ * Tailwind utilities read, so bg-background, rounded-md, shadow-sm and friends
4
+ * share one palette with the components. Tailwind itself stays an application
5
+ * concern: Nitro Kit never compiles, configures, or depends on it.
4
6
  */
5
-
6
- @layer properties, theme, base, nitro-kit, components, utilities;
7
-
8
7
  @layer nitro-kit.tokens {
9
8
  :where(:root, [data-theme]) {
10
9
  --font-sans: var(--nk-font-sans);
@@ -25,8 +25,9 @@
25
25
 
26
26
  /* The title scale. Four roles cover every owned title and legend: page
27
27
  for the one page heading, section for full-width section headers,
28
- surface for cards, dialogs, sheets, empty states, and fieldsets, and
29
- compact for control-group legends and status titles. */
28
+ surface for dialogs, sheets, empty states, and fieldsets, and compact
29
+ for control-group legends and status titles. Card titles scale with
30
+ the card's own size instead. */
30
31
  --nk-title-page-size: var(--nk-text-2xl);
31
32
  --nk-title-page-weight: var(--nk-font-weight-bold);
32
33
  --nk-title-section-size: var(--nk-text-xl);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nitro_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.1
4
+ version: 2.0.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Malmberg
@@ -92,8 +92,8 @@ files:
92
92
  - LICENSE
93
93
  - README.md
94
94
  - STYLE_GUIDE.md
95
- - app/assets/stylesheets/nitro_kit-tailwind-v4.css
96
95
  - app/assets/stylesheets/nitro_kit.css
96
+ - app/assets/tailwind/nitro_kit/engine.css
97
97
  - app/components/nitro_kit/accordion.rb
98
98
  - app/components/nitro_kit/alert.rb
99
99
  - app/components/nitro_kit/app_navigation.rb
@@ -179,6 +179,7 @@ files:
179
179
  - docs/browser_support.md
180
180
  - docs/component_contracts.md
181
181
  - docs/customization.md
182
+ - docs/eject.md
182
183
  - docs/hotwire.md
183
184
  - docs/initialization_prompt.md
184
185
  - docs/migration_1_to_2.md
@@ -192,9 +193,11 @@ files:
192
193
  - docs/patterns/resource_form.md
193
194
  - docs/rails_conventions.md
194
195
  - docs/rails_integration.md
196
+ - lib/generators/nitro_kit/eject_generator.rb
195
197
  - lib/generators/nitro_kit/install_generator.rb
196
198
  - lib/generators/nitro_kit/upgrade_smoke_tests_generator.rb
197
199
  - lib/nitro_kit.rb
200
+ - lib/nitro_kit/ejection.rb
198
201
  - lib/nitro_kit/engine.rb
199
202
  - lib/nitro_kit/installation.rb
200
203
  - lib/nitro_kit/migration_inventory.rb
@@ -267,6 +270,7 @@ files:
267
270
  - src/stylesheets/nitro_kit/components/typeset.css
268
271
  - src/stylesheets/nitro_kit/layers.css
269
272
  - src/stylesheets/nitro_kit/reset.css
273
+ - src/stylesheets/nitro_kit/tailwind.css
270
274
  - src/stylesheets/nitro_kit/tokens.css
271
275
  homepage: https://nitrokit.dev
272
276
  licenses:
@@ -290,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
294
  - !ruby/object:Gem::Version
291
295
  version: '0'
292
296
  requirements: []
293
- rubygems_version: 4.0.16
297
+ rubygems_version: 4.0.20
294
298
  specification_version: 4
295
299
  summary: An agent-native Phlex UI system for Rails
296
300
  test_files: []