nitro_kit 2.0.0.beta.2 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -1
- data/README.md +2 -2
- data/STYLE_GUIDE.md +1 -1
- data/app/assets/stylesheets/nitro_kit.css +48 -1
- data/app/assets/tailwind/nitro_kit/engine.css +15 -0
- data/docs/browser_support.md +7 -1
- data/docs/component_contracts.md +1 -1
- data/docs/customization.md +33 -13
- data/docs/migration_1_to_2.md +1 -1
- data/docs/rails_integration.md +4 -2
- data/lib/nitro_kit/engine.rb +13 -0
- data/lib/nitro_kit/installation.rb +29 -7
- data/lib/nitro_kit/version.rb +1 -1
- data/lib/tasks/nitro_kit_tasks.rake +1 -1
- data/src/stylesheets/nitro_kit/layers.css +8 -0
- data/src/stylesheets/nitro_kit/reset.css +1 -1
- data/{app/assets/stylesheets/nitro_kit-tailwind-v4.css → src/stylesheets/nitro_kit/tailwind.css} +4 -5
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84caf95e1c63e0461bef9e9a0183b67d02bf3c00fee964f0d0ee321a23b5457f
|
|
4
|
+
data.tar.gz: 9ebac7e5aa8f5cc74f4930838b0760a364eaebc7f1d9a01d99d8a15ce152b135
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56d6151cb701d8254ee9671d900f8053ddcd023435b03157f590dbad2f5f283e489f4db54e34de122996006af532c725cd86cc0491d48810b17fa343e1654da4
|
|
7
|
+
data.tar.gz: 482fa5ddf8c57c09c3f7d6f3e4e607fcd125dcecf8ff23500474cb8926469e73c139a4126610bf4df7e59d37ada2ea47d38e2bcc462649a95248cf7009424ac1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0.beta.3
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Ship `app/assets/tailwind/nitro_kit/engine.css` for `tailwindcss-rails`
|
|
8
|
+
engine support, so a Tailwind CSS v4 application can `@import
|
|
9
|
+
"../builds/tailwind/nitro_kit"` and load Nitro Kit through its single
|
|
10
|
+
compiled `tailwind` stylesheet. The engine keeps that entry out of the asset
|
|
11
|
+
pipeline, and `nitro_kit:doctor` and the installer expect only `tailwind`
|
|
12
|
+
when the import is present.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Fold the Tailwind CSS v4 adapter into `nitro_kit.css`. The distribution
|
|
17
|
+
stylesheet now opens with the global cascade-layer order and carries the
|
|
18
|
+
Tailwind theme aliases from `src/stylesheets/nitro_kit/tailwind.css`, so a
|
|
19
|
+
Tailwind application links `nitro_kit` then `tailwind` and nothing else.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Replace the invalid `::file-selector-button:disabled` reset selector with
|
|
24
|
+
`:disabled::file-selector-button`, which Lightning CSS otherwise warns about
|
|
25
|
+
when the stylesheet goes through a Tailwind build.
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
|
|
29
|
+
- The separate `nitro_kit-tailwind-v4.css` asset. Remove it from the layout's
|
|
30
|
+
`stylesheet_link_tag`; `nitro_kit:doctor` flags a leftover link.
|
|
31
|
+
|
|
32
|
+
### Upgrade notes
|
|
33
|
+
|
|
34
|
+
- Pin `2.0.0.beta.3` explicitly. Beta releases may still change APIs; review
|
|
35
|
+
release notes before updating.
|
|
36
|
+
- Delete `"nitro_kit-tailwind-v4"` from every `stylesheet_link_tag`. The
|
|
37
|
+
`nitro_kit` stylesheet now provides the cascade-layer order and Tailwind
|
|
38
|
+
theme aliases itself, and must load before the compiled `tailwind`
|
|
39
|
+
stylesheet. Run `nitro_kit:doctor` to confirm the layout.
|
|
40
|
+
- A `tailwindcss-rails` application can optionally collapse to one stylesheet:
|
|
41
|
+
add `@import "../builds/tailwind/nitro_kit";` above `@import "tailwindcss";`
|
|
42
|
+
in `app/assets/tailwind/application.css` and link only `tailwind`.
|
|
43
|
+
|
|
3
44
|
## 2.0.0.beta.2
|
|
4
45
|
|
|
5
46
|
### Added
|
|
@@ -8,7 +49,7 @@
|
|
|
8
49
|
stop hand-rolling headers and footers. `actions` inside a `header` trail the
|
|
9
50
|
title and description; inside a `footer` they push to the end.
|
|
10
51
|
- Add Card `size: :sm | :md | :lg` density and `variant: :default | :muted |
|
|
11
|
-
|
|
52
|
+
:outline` surfaces, emitted as owned `data-size` and `data-variant`
|
|
12
53
|
attributes. Sizes coordinate padding, part gaps, corners, and title size.
|
|
13
54
|
- Add explicit `nitro_kit:eject COMPONENT` source-level customization, with
|
|
14
55
|
isolated Ruby/CSS/Stimulus dependencies, version provenance, and safe whole-snapshot
|
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
**Audience:** Rails developers evaluating or installing Nitro Kit.
|
|
8
8
|
|
|
9
|
-
Nitro Kit is a gem-owned Phlex UI system for Rails. The `2.0.0.beta.
|
|
9
|
+
Nitro Kit is a gem-owned Phlex UI system for Rails. The `2.0.0.beta.3` prerelease
|
|
10
10
|
is under active testing and is not stable.
|
|
11
11
|
|
|
12
12
|
[](https://rubygems.org/gems/nitro_kit)
|
|
@@ -16,7 +16,7 @@ is under active testing and is not stable.
|
|
|
16
16
|
Pin the prerelease:
|
|
17
17
|
|
|
18
18
|
```ruby
|
|
19
|
-
gem "nitro_kit", "2.0.0.beta.
|
|
19
|
+
gem "nitro_kit", "2.0.0.beta.3"
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
```sh
|
data/STYLE_GUIDE.md
CHANGED
|
@@ -330,7 +330,7 @@ Before JavaScript connects, `:root` follows `prefers-color-scheme`. Explicit `[d
|
|
|
330
330
|
|
|
331
331
|
Customization tools may read, preview, and export documented public tokens. Model customizer state as an immutable, explicitly versioned value object with closed named choices and readable URL parameters; never serialize an opaque arbitrary-token blob. Exports use stable selector and declaration ordering, cover light, dark, and system fallback, and contain only documented public variables. Structural preview choices may emit copyable component-composition examples, but never component implementations. Customization tools must not expose private `--_nk-*` values, edit the generated distribution asset, generate component copies, or turn arbitrary CSS into a Nitro contract.
|
|
332
332
|
|
|
333
|
-
|
|
333
|
+
`src/stylesheets/nitro_kit/tailwind.css` declares the global cascade-layer order and maps Nitro values into Tailwind v4 theme variables so a compiled Tailwind stylesheet composes with the distribution asset. Tailwind compilation, source detection, and utilities remain application concerns. Do not add Tailwind as a Nitro runtime dependency.
|
|
334
334
|
|
|
335
335
|
## Baseline
|
|
336
336
|
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/* Source: src/stylesheets/nitro_kit/layers.css */
|
|
7
|
+
/*
|
|
8
|
+
* Global cascade-layer order. Declared first so that, when an application also
|
|
9
|
+
* loads a compiled Tailwind CSS v4 stylesheet, Nitro Kit sits between
|
|
10
|
+
* Tailwind's base and components layers and Tailwind utilities still win.
|
|
11
|
+
* Without Tailwind the extra layers are simply unused.
|
|
12
|
+
*/
|
|
13
|
+
@layer properties, theme, base, nitro-kit, components, utilities;
|
|
14
|
+
|
|
7
15
|
@layer nitro-kit.tokens,
|
|
8
16
|
nitro-kit.reset,
|
|
9
17
|
nitro-kit.base,
|
|
@@ -635,6 +643,45 @@
|
|
|
635
643
|
}
|
|
636
644
|
}
|
|
637
645
|
|
|
646
|
+
/* Source: src/stylesheets/nitro_kit/tailwind.css */
|
|
647
|
+
/*
|
|
648
|
+
* Tailwind CSS v4 theme aliases. Maps Nitro tokens onto the theme variables
|
|
649
|
+
* Tailwind utilities read, so bg-background, rounded-md, shadow-sm and friends
|
|
650
|
+
* share one palette with the components. Tailwind itself stays an application
|
|
651
|
+
* concern: Nitro Kit never compiles, configures, or depends on it.
|
|
652
|
+
*/
|
|
653
|
+
@layer nitro-kit.tokens {
|
|
654
|
+
:where(:root, [data-theme]) {
|
|
655
|
+
--font-sans: var(--nk-font-sans);
|
|
656
|
+
--font-mono: var(--nk-font-mono);
|
|
657
|
+
--spacing: var(--nk-space);
|
|
658
|
+
|
|
659
|
+
--color-background: var(--nk-color-canvas);
|
|
660
|
+
--color-foreground: var(--nk-color-foreground);
|
|
661
|
+
--color-muted: var(--nk-color-muted);
|
|
662
|
+
--color-muted-content: var(--nk-color-muted-foreground);
|
|
663
|
+
--color-border: var(--nk-color-border);
|
|
664
|
+
--color-ring: var(--nk-color-focus);
|
|
665
|
+
--color-primary: var(--nk-color-primary);
|
|
666
|
+
--color-primary-foreground: var(--nk-color-primary-foreground);
|
|
667
|
+
--color-destructive: var(--nk-color-destructive);
|
|
668
|
+
--color-destructive-content: var(--nk-color-destructive-content);
|
|
669
|
+
--color-destructive-foreground: var(--nk-color-destructive-foreground);
|
|
670
|
+
|
|
671
|
+
--radius-sm: var(--nk-radius-sm);
|
|
672
|
+
--radius-md: var(--nk-radius-md);
|
|
673
|
+
--radius-lg: var(--nk-radius-lg);
|
|
674
|
+
--radius-xl: var(--nk-radius-xl);
|
|
675
|
+
|
|
676
|
+
--shadow-sm: var(--nk-shadow-sm);
|
|
677
|
+
--shadow-md: var(--nk-shadow-md);
|
|
678
|
+
--shadow-lg: var(--nk-shadow-lg);
|
|
679
|
+
|
|
680
|
+
--default-transition-duration: var(--nk-duration-normal);
|
|
681
|
+
--default-transition-timing-function: var(--nk-ease);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
638
685
|
/* Source: src/stylesheets/nitro_kit/reset.css */
|
|
639
686
|
/* Nitro Kit ships its own full-page preflight. It lives in the
|
|
640
687
|
`nitro-kit.reset` cascade layer, so unlayered application CSS always wins,
|
|
@@ -754,7 +801,7 @@
|
|
|
754
801
|
}
|
|
755
802
|
|
|
756
803
|
:where(:disabled),
|
|
757
|
-
::file-selector-button
|
|
804
|
+
:disabled::file-selector-button {
|
|
758
805
|
cursor: default;
|
|
759
806
|
}
|
|
760
807
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Nitro Kit entry point for tailwindcss-rails engine support.
|
|
3
|
+
*
|
|
4
|
+
* tailwindcss-rails writes app/assets/builds/tailwind/nitro_kit.css in the host
|
|
5
|
+
* application on every build or watch. Importing that file from the host's
|
|
6
|
+
* app/assets/tailwind/application.css bundles Nitro Kit into the single
|
|
7
|
+
* compiled Tailwind stylesheet:
|
|
8
|
+
*
|
|
9
|
+
* @import "../builds/tailwind/nitro_kit";
|
|
10
|
+
* @import "tailwindcss";
|
|
11
|
+
*
|
|
12
|
+
* Nitro Kit leads so its cascade-layer order and Tailwind theme aliases apply
|
|
13
|
+
* to the whole file, matching the stylesheet order in docs/customization.md.
|
|
14
|
+
*/
|
|
15
|
+
@import "../../stylesheets/nitro_kit.css";
|
data/docs/browser_support.md
CHANGED
|
@@ -73,7 +73,13 @@ every possible descendant selector.
|
|
|
73
73
|
## Release verification
|
|
74
74
|
|
|
75
75
|
Automated CI runs the full system suite in Chrome and priority browser smoke
|
|
76
|
-
coverage in Firefox and macOS Safari.
|
|
76
|
+
coverage in Firefox and macOS Safari. The Chrome lane runs headed under Xvfb
|
|
77
|
+
with a single worker. Headless Linux Chrome reports no `hover` or `pointer`
|
|
78
|
+
capability, so hover-gated behaviour such as the sidebar rail peek and tooltips
|
|
79
|
+
never engages there, and parallel headed windows share one X pointer whose
|
|
80
|
+
enter and leave events reset `:hover` while a test is mid-interaction. Linux
|
|
81
|
+
and Windows also reserve a classic scrollbar gutter that macOS does not, so
|
|
82
|
+
geometry assertions must not assume overlay scrollbars. Before a release, maintainers also verify
|
|
77
83
|
the priority flows on current Android Chrome and iOS Safari. Capability-focused
|
|
78
84
|
tests supplement these runs; they do not prove an untested historical browser
|
|
79
85
|
version.
|
data/docs/component_contracts.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
API. This table is also parsed by the gallery; keep every row to four cells and
|
|
5
5
|
escape literal pipe characters.
|
|
6
6
|
|
|
7
|
-
This is the shipped public catalog for `2.0.0.beta.
|
|
7
|
+
This is the shipped public catalog for `2.0.0.beta.3`. It records current Ruby
|
|
8
8
|
construction, rendered roots, closed vocabularies, compound cardinalities, and
|
|
9
9
|
integration boundaries. For task guidance, start with the
|
|
10
10
|
[agent guide](agent_guide.md) or [Rails integration](rails_integration.md).
|
data/docs/customization.md
CHANGED
|
@@ -11,10 +11,9 @@ Nitro Kit owns component Ruby, markup, behavior, and default CSS. Applications n
|
|
|
11
11
|
Load browser styles in this order:
|
|
12
12
|
|
|
13
13
|
1. Optional third-party base styles, such as Lexxy.
|
|
14
|
-
2. The
|
|
15
|
-
3. The
|
|
16
|
-
4.
|
|
17
|
-
5. Application styles, including Nitro token overrides.
|
|
14
|
+
2. The generated `nitro_kit` distribution stylesheet.
|
|
15
|
+
3. The application's compiled Tailwind CSS, when present.
|
|
16
|
+
4. Application styles, including Nitro token overrides.
|
|
18
17
|
|
|
19
18
|
`NitroKit::AppearanceBootstrap` precedes every entry in this list. The install
|
|
20
19
|
generator applies this order when it can identify conventional layout entries
|
|
@@ -34,14 +33,35 @@ A Rails application without Tailwind can use:
|
|
|
34
33
|
A Tailwind CSS v4 application can use:
|
|
35
34
|
|
|
36
35
|
```erb
|
|
37
|
-
<%= stylesheet_link_tag
|
|
38
|
-
"nitro_kit-tailwind-v4", \
|
|
39
|
-
"nitro_kit", \
|
|
40
|
-
"tailwind", \
|
|
41
|
-
"application", \
|
|
42
|
-
"data-turbo-track": "reload" %>
|
|
36
|
+
<%= stylesheet_link_tag "nitro_kit", "tailwind", "application", "data-turbo-track": "reload" %>
|
|
43
37
|
```
|
|
44
38
|
|
|
39
|
+
`nitro_kit.css` opens with the global cascade-layer order
|
|
40
|
+
`properties, theme, base, nitro-kit, components, utilities` and aliases Nitro
|
|
41
|
+
tokens onto Tailwind's theme variables, so it must load before the compiled
|
|
42
|
+
Tailwind stylesheet. The separate `nitro_kit-tailwind-v4` adapter from earlier
|
|
43
|
+
2.0 betas no longer exists; `nitro_kit:doctor` reports a leftover link.
|
|
44
|
+
|
|
45
|
+
A Tailwind CSS v4 application using `tailwindcss-rails` can instead ship one
|
|
46
|
+
stylesheet. Nitro Kit provides the engine entry `tailwindcss-rails` looks for,
|
|
47
|
+
`app/assets/tailwind/nitro_kit/engine.css`, and `tailwindcss:build` or
|
|
48
|
+
`tailwindcss:watch` generates `app/assets/builds/tailwind/nitro_kit.css` in the
|
|
49
|
+
application. Import it before Tailwind in `app/assets/tailwind/application.css`:
|
|
50
|
+
|
|
51
|
+
```css
|
|
52
|
+
@import "../builds/tailwind/nitro_kit";
|
|
53
|
+
@import "tailwindcss";
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then the layout loads only the compiled Tailwind stylesheet:
|
|
57
|
+
|
|
58
|
+
```erb
|
|
59
|
+
<%= stylesheet_link_tag "tailwind", "application", "data-turbo-track": "reload" %>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`nitro_kit:doctor` recognizes the import and reports a separate `nitro_kit`
|
|
63
|
+
link as a duplicate.
|
|
64
|
+
|
|
45
65
|
Keep overrides unlayered in application CSS and load them after Nitro Kit. Nitro's selectors use `:where()` inside named cascade layers, so an ordinary application rule can override a token without selector escalation or `!important`.
|
|
46
66
|
|
|
47
67
|
Do not edit `app/assets/stylesheets/nitro_kit.css` in the gem or a bundled copy of it. That file is generated from `src/stylesheets/nitro_kit/` and is replaced on upgrade. Variables named `--_nk-*` are private component mechanics and may change without notice. Only the `--nk-*` variables listed below are the customization contract.
|
|
@@ -472,9 +492,9 @@ This registers Nitro's `controllers/nk/*` modules together with application cont
|
|
|
472
492
|
For the resulting behavior when those modules are not registered, use the
|
|
473
493
|
canonical no-JavaScript matrix in [`browser_support.md`](browser_support.md).
|
|
474
494
|
|
|
475
|
-
##
|
|
495
|
+
## Tailwind CSS v4 theme aliases
|
|
476
496
|
|
|
477
|
-
Nitro Kit does not require Tailwind, Tailwind configuration, or Tailwind Preflight — it ships its own global preflight in the `nitro-kit.reset` cascade layer, which unlayered application CSS always overrides.
|
|
497
|
+
Nitro Kit does not require Tailwind, Tailwind configuration, or Tailwind Preflight — it ships its own global preflight in the `nitro-kit.reset` cascade layer, which unlayered application CSS always overrides. For applications that do compile Tailwind, `nitro_kit.css` establishes a compatible cascade-layer order and maps Nitro tokens to common Tailwind v4 theme variables, including background, foreground, primary, destructive, radii, shadows, fonts, spacing, and transition defaults. The aliases live in `src/stylesheets/nitro_kit/tailwind.css` inside the `nitro-kit.tokens` layer; without Tailwind they are inert custom properties.
|
|
478
498
|
|
|
479
499
|
Tailwind remains compiled and configured by the application. An application can add further aliases in its Tailwind CSS source with the v4 CSS-first API:
|
|
480
500
|
|
|
@@ -488,7 +508,7 @@ Tailwind remains compiled and configured by the application. An application can
|
|
|
488
508
|
}
|
|
489
509
|
```
|
|
490
510
|
|
|
491
|
-
Use `@theme inline` when a Tailwind theme variable references another custom property so generated utilities resolve the live Nitro value. The
|
|
511
|
+
Use `@theme inline` when a Tailwind theme variable references another custom property so generated utilities resolve the live Nitro value. The aliases do not make Tailwind a Nitro runtime dependency, configure source detection, generate utility classes, or permit Tailwind classes inside Nitro component APIs.
|
|
492
512
|
|
|
493
513
|
## Public token reference
|
|
494
514
|
|
data/docs/migration_1_to_2.md
CHANGED
|
@@ -12,7 +12,7 @@ Treat a 1.x migration as a product-flow review, not a helper rename. Nitro Kit
|
|
|
12
12
|
Add the 2.0 prerelease to the application's Gemfile:
|
|
13
13
|
|
|
14
14
|
```ruby
|
|
15
|
-
gem "nitro_kit", "2.0.0.beta.
|
|
15
|
+
gem "nitro_kit", "2.0.0.beta.3"
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Bundler records the exact released version in `Gemfile.lock`; commit `Gemfile`
|
data/docs/rails_integration.md
CHANGED
|
@@ -12,7 +12,7 @@ There are no `nk_form_with` helpers or general ERB component bridge.
|
|
|
12
12
|
Pin the current prerelease:
|
|
13
13
|
|
|
14
14
|
```ruby
|
|
15
|
-
gem "nitro_kit", "2.0.0.beta.
|
|
15
|
+
gem "nitro_kit", "2.0.0.beta.3"
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Use the released gem and commit `Gemfile` with `Gemfile.lock`. Before upgrading,
|
|
@@ -36,7 +36,9 @@ Load Nitro Kit before application styles:
|
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
For third-party base CSS, Tailwind, appearance setup, and token overrides, use
|
|
39
|
-
the canonical [stylesheet order](customization.md#stylesheet-order).
|
|
39
|
+
the canonical [stylesheet order](customization.md#stylesheet-order). A
|
|
40
|
+
`tailwindcss-rails` application can bundle Nitro Kit into its compiled Tailwind
|
|
41
|
+
stylesheet through the engine entry described there.
|
|
40
42
|
|
|
41
43
|
## Stimulus
|
|
42
44
|
|
data/lib/nitro_kit/engine.rb
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
module NitroKit
|
|
2
2
|
class Engine < ::Rails::Engine
|
|
3
|
+
# Rails would otherwise derive "nitro_kit_engine". tailwindcss-rails looks up
|
|
4
|
+
# app/assets/tailwind/<engine_name>/engine.css, so the name is public.
|
|
5
|
+
engine_name "nitro_kit"
|
|
6
|
+
|
|
3
7
|
IMPORTMAP_PATH = root.join("config/importmap.rb")
|
|
4
8
|
JAVASCRIPT_PATHS = [ root.join("app/javascript") ].freeze
|
|
9
|
+
TAILWIND_PATH = root.join("app/assets/tailwind")
|
|
5
10
|
|
|
6
11
|
initializer "nitro_kit.assets" do |app|
|
|
7
12
|
next unless app.config.respond_to?(:assets)
|
|
@@ -11,6 +16,14 @@ module NitroKit
|
|
|
11
16
|
end
|
|
12
17
|
end
|
|
13
18
|
|
|
19
|
+
# The Tailwind engine entry is a build input for tailwindcss-rails, not a
|
|
20
|
+
# servable asset. Keep it out of Propshaft's load path.
|
|
21
|
+
initializer "nitro_kit.exclude_tailwind_path", before: "propshaft.append_assets_path" do |app|
|
|
22
|
+
next unless app.config.respond_to?(:assets) && app.config.assets.respond_to?(:excluded_paths)
|
|
23
|
+
|
|
24
|
+
app.config.assets.excluded_paths << TAILWIND_PATH unless app.config.assets.excluded_paths.include?(TAILWIND_PATH)
|
|
25
|
+
end
|
|
26
|
+
|
|
14
27
|
initializer "nitro_kit.importmap", before: "importmap" do |app|
|
|
15
28
|
next unless app.config.respond_to?(:importmap)
|
|
16
29
|
|
|
@@ -9,9 +9,13 @@ module NitroKit
|
|
|
9
9
|
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
|
10
10
|
SKILLS = %w[nitro-kit-hotwire nitro-kit-rails nitro-kit-ui].freeze
|
|
11
11
|
SKILL_ROOTS = [ ".agents/skills", ".claude/skills" ].freeze
|
|
12
|
+
# nitro_kit-tailwind-v4 is the beta-era adapter that nitro_kit.css absorbed;
|
|
13
|
+
# it stays managed so doctor flags a leftover link instead of ignoring it.
|
|
12
14
|
MANAGED_STYLESHEETS = %w[
|
|
13
15
|
lexxy nitro_kit-tailwind-v4 nitro_kit tailwind application
|
|
14
16
|
].freeze
|
|
17
|
+
TAILWIND_ENTRY = "app/assets/tailwind/application.css"
|
|
18
|
+
TAILWIND_BUNDLE_IMPORT = %r{@import\s+["'](?:\.\./)+builds/tailwind/nitro_kit(?:\.css)?["']}
|
|
15
19
|
AGENTS_START = "<!-- nitro-kit:start -->"
|
|
16
20
|
AGENTS_END = "<!-- nitro-kit:end -->"
|
|
17
21
|
AGENTS_BLOCK = <<~MARKDOWN.freeze
|
|
@@ -217,8 +221,12 @@ module NitroKit
|
|
|
217
221
|
errors << "installer left the layout unchanged: #{edit_error}"
|
|
218
222
|
end
|
|
219
223
|
|
|
220
|
-
if assets.include?("nitro_kit-tailwind-v4")
|
|
221
|
-
errors << "remove nitro_kit-tailwind-v4
|
|
224
|
+
if assets.include?("nitro_kit-tailwind-v4")
|
|
225
|
+
errors << "remove stylesheet \"nitro_kit-tailwind-v4\"; nitro_kit now includes the Tailwind v4 layer order and theme aliases"
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
if tailwind_bundles_nitro_kit? && assets.include?("nitro_kit")
|
|
229
|
+
errors << "remove stylesheet \"nitro_kit\"; #{TAILWIND_ENTRY} already bundles it"
|
|
222
230
|
end
|
|
223
231
|
|
|
224
232
|
bootstrap_position = analysis.bootstraps.first&.range&.begin
|
|
@@ -569,17 +577,20 @@ module NitroKit
|
|
|
569
577
|
assets = managed_stylesheet_assets(analysis) - [ "nitro_kit-tailwind-v4" ]
|
|
570
578
|
assets << "lexxy" if dependency?("lexxy")
|
|
571
579
|
assets << "tailwind" if tailwind?(assets)
|
|
572
|
-
|
|
580
|
+
if tailwind_bundles_nitro_kit?
|
|
581
|
+
assets -= [ "nitro_kit" ]
|
|
582
|
+
assets << "tailwind"
|
|
583
|
+
else
|
|
584
|
+
assets << "nitro_kit"
|
|
585
|
+
end
|
|
573
586
|
assets << "application" if assets.include?("application") || application_stylesheet_asset?
|
|
574
|
-
assets << "nitro_kit-tailwind-v4" if assets.include?("tailwind")
|
|
575
587
|
ordered_stylesheets(assets.uniq)
|
|
576
588
|
end
|
|
577
589
|
|
|
578
590
|
def ordered_stylesheets(assets)
|
|
579
|
-
vendor = assets - %w[nitro_kit
|
|
591
|
+
vendor = assets - %w[nitro_kit tailwind application]
|
|
580
592
|
[
|
|
581
593
|
*vendor,
|
|
582
|
-
*(%w[nitro_kit-tailwind-v4] & assets),
|
|
583
594
|
*(%w[nitro_kit] & assets),
|
|
584
595
|
*(%w[tailwind] & assets),
|
|
585
596
|
*(%w[application] & assets)
|
|
@@ -597,6 +608,9 @@ module NitroKit
|
|
|
597
608
|
|
|
598
609
|
existing = managed_stylesheet_assets(analysis)
|
|
599
610
|
return "duplicate canonical stylesheet assets require manual review" if existing.uniq != existing
|
|
611
|
+
if existing.include?("nitro_kit-tailwind-v4")
|
|
612
|
+
return "drop \"nitro_kit-tailwind-v4\" from its stylesheet call without changing the call's options"
|
|
613
|
+
end
|
|
600
614
|
unless existing == expected.select { existing.include?(_1) }
|
|
601
615
|
return "existing canonical stylesheets are misordered; reorder their intact calls manually"
|
|
602
616
|
end
|
|
@@ -657,7 +671,15 @@ module NitroKit
|
|
|
657
671
|
end
|
|
658
672
|
|
|
659
673
|
def tailwind?(assets)
|
|
660
|
-
assets.include?("tailwind") || dependency?("tailwindcss-rails") || application_root.join(
|
|
674
|
+
assets.include?("tailwind") || dependency?("tailwindcss-rails") || application_root.join(TAILWIND_ENTRY).file?
|
|
675
|
+
end
|
|
676
|
+
|
|
677
|
+
# True when the application's Tailwind source imports the engine entry
|
|
678
|
+
# that tailwindcss-rails generates from app/assets/tailwind/nitro_kit/engine.css,
|
|
679
|
+
# so the compiled "tailwind" stylesheet already contains Nitro Kit.
|
|
680
|
+
def tailwind_bundles_nitro_kit?
|
|
681
|
+
entry = application_root.join(TAILWIND_ENTRY)
|
|
682
|
+
entry.file? && entry.read.match?(TAILWIND_BUNDLE_IMPORT)
|
|
661
683
|
end
|
|
662
684
|
|
|
663
685
|
def application_stylesheet_asset?
|
data/lib/nitro_kit/version.rb
CHANGED
|
@@ -9,7 +9,7 @@ module NitroKit
|
|
|
9
9
|
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
|
10
10
|
SOURCE_ROOT = ROOT.join("src/stylesheets/nitro_kit")
|
|
11
11
|
OUTPUT = ROOT.join("app/assets/stylesheets/nitro_kit.css")
|
|
12
|
-
FOUNDATION_SOURCES = %w[ layers.css tokens.css reset.css ].freeze
|
|
12
|
+
FOUNDATION_SOURCES = %w[ layers.css tokens.css tailwind.css reset.css ].freeze
|
|
13
13
|
BANNER = <<~CSS.freeze
|
|
14
14
|
/*
|
|
15
15
|
* Nitro Kit 2.0
|
|
@@ -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,
|
data/{app/assets/stylesheets/nitro_kit-tailwind-v4.css → src/stylesheets/nitro_kit/tailwind.css}
RENAMED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
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);
|
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.
|
|
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
|
|
@@ -270,6 +270,7 @@ files:
|
|
|
270
270
|
- src/stylesheets/nitro_kit/components/typeset.css
|
|
271
271
|
- src/stylesheets/nitro_kit/layers.css
|
|
272
272
|
- src/stylesheets/nitro_kit/reset.css
|
|
273
|
+
- src/stylesheets/nitro_kit/tailwind.css
|
|
273
274
|
- src/stylesheets/nitro_kit/tokens.css
|
|
274
275
|
homepage: https://nitrokit.dev
|
|
275
276
|
licenses:
|