kiso 0.4.0.pre → 0.4.1.pre
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 +14 -1
- data/app/assets/tailwind/kiso/engine.css +38 -27
- data/app/assets/tailwind/kiso/palettes/blue.css +1 -1
- data/app/assets/tailwind/kiso/palettes/green.css +1 -1
- data/app/assets/tailwind/kiso/palettes/orange.css +1 -1
- data/app/assets/tailwind/kiso/palettes/violet.css +1 -1
- data/app/assets/tailwind/kiso/palettes/zinc.css +1 -1
- data/app/helpers/kiso/app_component_helper.rb +10 -0
- data/app/helpers/kiso/component_helper.rb +30 -0
- data/app/views/kiso/components/_app.html.erb +2 -2
- data/lib/generators/kiso/component/templates/partial.html.erb.tt +2 -4
- data/lib/generators/kiso/component/templates/sub_part_partial.html.erb.tt +2 -4
- data/lib/kiso/engine.rb +4 -0
- data/lib/kiso/themes/layout.rb +11 -2
- data/lib/kiso/version.rb +1 -1
- data/lib/tasks/kiso.rake +36 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2746806e86680de2110a413ce1e6f29b0cc31a080bd1a41de7b5ac07902833cd
|
|
4
|
+
data.tar.gz: e4bd2a60cf877c765c15b57de4d2743ca4de925a65bd7646ef7783b39d32fbb9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28c754958c46ffee194a411b0fe995c99fb8e9fe7bce78a30113063311d690d591f4ac6d2ef3855384fbc71e46562477de4981173eb938cc5318c5339c72253e
|
|
7
|
+
data.tar.gz: fab0ce827f49744c698ff9522aa68dcca1d64c73ae1ba9a453297d2fbb3ca5f65fa9d06a15830cc6e5f4c1e1b301b8ecdb0aead95ed368423f7f728aa3058cf2
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.1.pre] - 2026-03-08
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `center:` variant on App layout component — `kui(:app, center: true)` applies full-viewport centering for login pages and similar single-focus layouts
|
|
15
|
+
- `kui_tag` / `appui_tag` helpers — collapse the common `content_tag` + `kiso_prepare_options` + theme rendering boilerplate into a single call; component generator templates now use `appui_tag` by default
|
|
16
|
+
- Shade scale auto-wiring — host apps defining `--color-primary-50` through `--color-primary-950` in their Tailwind `@theme` block now automatically feed into Kiso's semantic color tokens (shade 500 for light mode, 400 for dark mode, matching Nuxt UI conventions)
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Palette CSS files are now importable in host apps — a `kiso:palettes` rake task generates CSS stubs so `@import "../builds/tailwind/kiso/palettes/blue.css"` resolves correctly
|
|
21
|
+
|
|
10
22
|
## [0.4.0.pre] - 2026-03-08
|
|
11
23
|
|
|
12
24
|
### Added
|
|
@@ -100,7 +112,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
100
112
|
- Lookbook component previews
|
|
101
113
|
- Bridgetown documentation site
|
|
102
114
|
|
|
103
|
-
[Unreleased]: https://github.com/steveclarke/kiso/compare/v0.4.
|
|
115
|
+
[Unreleased]: https://github.com/steveclarke/kiso/compare/v0.4.1.pre...HEAD
|
|
116
|
+
[0.4.1.pre]: https://github.com/steveclarke/kiso/releases/tag/v0.4.1.pre
|
|
104
117
|
[0.4.0.pre]: https://github.com/steveclarke/kiso/releases/tag/v0.4.0.pre
|
|
105
118
|
[0.3.0.pre]: https://github.com/steveclarke/kiso/releases/tag/v0.3.0.pre
|
|
106
119
|
[0.2.2.pre]: https://github.com/steveclarke/kiso/releases/tag/v0.2.2.pre
|
|
@@ -51,29 +51,40 @@
|
|
|
51
51
|
Purpose-named tokens that flip in dark mode. Components use bg-primary,
|
|
52
52
|
text-foreground, etc. — never raw palette shades or dark: prefixes.
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
Two ways to customize brand colors:
|
|
55
|
+
|
|
56
|
+
1. Define a shade scale (Tailwind-native):
|
|
57
|
+
@theme {
|
|
58
|
+
--color-primary-50: oklch(...);
|
|
59
|
+
--color-primary-500: oklch(...);
|
|
60
|
+
--color-primary-950: oklch(...);
|
|
61
|
+
}
|
|
62
|
+
Kiso auto-wires: shade 500 for light mode, shade 400 for dark mode,
|
|
63
|
+
shade 50 for foreground (light), shade 950 for foreground (dark).
|
|
64
|
+
|
|
65
|
+
2. Override the semantic token directly:
|
|
66
|
+
@theme { --color-primary: oklch(0.55 0.10 237); }
|
|
56
67
|
*/
|
|
57
68
|
|
|
58
69
|
@theme {
|
|
59
|
-
/* Brand / action colors */
|
|
60
|
-
--color-primary: var(--color-rose-500);
|
|
61
|
-
--color-primary-foreground: white;
|
|
70
|
+
/* Brand / action colors — auto-wire from shade scale, fall back to defaults */
|
|
71
|
+
--color-primary: var(--color-primary-500, var(--color-rose-500));
|
|
72
|
+
--color-primary-foreground: var(--color-primary-50, white);
|
|
62
73
|
|
|
63
|
-
--color-secondary: var(--color-teal-600);
|
|
64
|
-
--color-secondary-foreground: white;
|
|
74
|
+
--color-secondary: var(--color-secondary-500, var(--color-teal-600));
|
|
75
|
+
--color-secondary-foreground: var(--color-secondary-50, white);
|
|
65
76
|
|
|
66
|
-
--color-success: var(--color-green-600);
|
|
67
|
-
--color-success-foreground: white;
|
|
77
|
+
--color-success: var(--color-success-500, var(--color-green-600));
|
|
78
|
+
--color-success-foreground: var(--color-success-50, white);
|
|
68
79
|
|
|
69
|
-
--color-info: var(--color-sky-600);
|
|
70
|
-
--color-info-foreground: white;
|
|
80
|
+
--color-info: var(--color-info-500, var(--color-sky-600));
|
|
81
|
+
--color-info-foreground: var(--color-info-50, white);
|
|
71
82
|
|
|
72
|
-
--color-warning: var(--color-amber-500);
|
|
73
|
-
--color-warning-foreground: var(--color-amber-950);
|
|
83
|
+
--color-warning: var(--color-warning-500, var(--color-amber-500));
|
|
84
|
+
--color-warning-foreground: var(--color-warning-950, var(--color-amber-950));
|
|
74
85
|
|
|
75
|
-
--color-error: var(--color-red-600);
|
|
76
|
-
--color-error-foreground: white;
|
|
86
|
+
--color-error: var(--color-error-500, var(--color-red-600));
|
|
87
|
+
--color-error-foreground: var(--color-error-50, white);
|
|
77
88
|
|
|
78
89
|
/* Surface tokens */
|
|
79
90
|
--color-background: white;
|
|
@@ -100,23 +111,23 @@
|
|
|
100
111
|
Redefine tokens under .dark — components never use dark: prefixes. */
|
|
101
112
|
|
|
102
113
|
.dark {
|
|
103
|
-
--color-primary: var(--color-rose-400);
|
|
104
|
-
--color-primary-foreground: var(--color-zinc-950);
|
|
114
|
+
--color-primary: var(--color-primary-400, var(--color-rose-400));
|
|
115
|
+
--color-primary-foreground: var(--color-primary-950, var(--color-zinc-950));
|
|
105
116
|
|
|
106
|
-
--color-secondary: var(--color-teal-400);
|
|
107
|
-
--color-secondary-foreground: var(--color-zinc-950);
|
|
117
|
+
--color-secondary: var(--color-secondary-400, var(--color-teal-400));
|
|
118
|
+
--color-secondary-foreground: var(--color-secondary-950, var(--color-zinc-950));
|
|
108
119
|
|
|
109
|
-
--color-success: var(--color-green-400);
|
|
110
|
-
--color-success-foreground: var(--color-zinc-950);
|
|
120
|
+
--color-success: var(--color-success-400, var(--color-green-400));
|
|
121
|
+
--color-success-foreground: var(--color-success-950, var(--color-zinc-950));
|
|
111
122
|
|
|
112
|
-
--color-info: var(--color-sky-400);
|
|
113
|
-
--color-info-foreground: var(--color-zinc-950);
|
|
123
|
+
--color-info: var(--color-info-400, var(--color-sky-400));
|
|
124
|
+
--color-info-foreground: var(--color-info-950, var(--color-zinc-950));
|
|
114
125
|
|
|
115
|
-
--color-warning: var(--color-amber-400);
|
|
116
|
-
--color-warning-foreground: var(--color-zinc-950);
|
|
126
|
+
--color-warning: var(--color-warning-400, var(--color-amber-400));
|
|
127
|
+
--color-warning-foreground: var(--color-warning-950, var(--color-zinc-950));
|
|
117
128
|
|
|
118
|
-
--color-error: var(--color-red-400);
|
|
119
|
-
--color-error-foreground: var(--color-zinc-950);
|
|
129
|
+
--color-error: var(--color-error-400, var(--color-red-400));
|
|
130
|
+
--color-error-foreground: var(--color-error-950, var(--color-zinc-950));
|
|
120
131
|
|
|
121
132
|
--color-background: var(--color-zinc-950);
|
|
122
133
|
--color-foreground: var(--color-zinc-50);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Based on shadcn/ui's Blue theme with OKLCH color values.
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
1. Import in your CSS: @import "kiso/palettes/blue.css";
|
|
6
|
+
1. Import in your CSS: @import "../builds/tailwind/kiso/palettes/blue.css";
|
|
7
7
|
2. Add to your HTML: <html data-palette="blue"> or <body data-palette="blue">
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Based on shadcn/ui's Green theme with OKLCH color values.
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
1. Import in your CSS: @import "kiso/palettes/green.css";
|
|
6
|
+
1. Import in your CSS: @import "../builds/tailwind/kiso/palettes/green.css";
|
|
7
7
|
2. Add to your HTML: <html data-palette="green"> or <body data-palette="green">
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Based on shadcn/ui's Orange theme with OKLCH color values.
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
1. Import in your CSS: @import "kiso/palettes/orange.css";
|
|
6
|
+
1. Import in your CSS: @import "../builds/tailwind/kiso/palettes/orange.css";
|
|
7
7
|
2. Add to your HTML: <html data-palette="orange"> or <body data-palette="orange">
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Based on shadcn/ui's Violet theme with OKLCH color values.
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
1. Import in your CSS: @import "kiso/palettes/violet.css";
|
|
6
|
+
1. Import in your CSS: @import "../builds/tailwind/kiso/palettes/violet.css";
|
|
7
7
|
2. Add to your HTML: <html data-palette="violet"> or <body data-palette="violet">
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Based on shadcn/ui's Zinc theme with OKLCH color values.
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
1. Import in your CSS: @import "kiso/palettes/zinc.css";
|
|
6
|
+
1. Import in your CSS: @import "../builds/tailwind/kiso/palettes/zinc.css";
|
|
7
7
|
2. Add to your HTML: <html data-palette="zinc"> or <body data-palette="zinc">
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -49,5 +49,15 @@ module Kiso
|
|
|
49
49
|
**kwargs, &block
|
|
50
50
|
)
|
|
51
51
|
end
|
|
52
|
+
|
|
53
|
+
# Renders a themed HTML element for host app components.
|
|
54
|
+
#
|
|
55
|
+
# Identical to {ComponentHelper#kui_tag} — provided as a naming
|
|
56
|
+
# convenience so host app partials use +appui_tag+ alongside +appui()+.
|
|
57
|
+
#
|
|
58
|
+
# @see ComponentHelper#kui_tag
|
|
59
|
+
def appui_tag(...)
|
|
60
|
+
kui_tag(...)
|
|
61
|
+
end
|
|
52
62
|
end
|
|
53
63
|
end
|
|
@@ -70,6 +70,36 @@ module Kiso
|
|
|
70
70
|
(component_options.delete(:data) || {}).merge(slot: slot, **data_attrs)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
+
# Renders a themed HTML element with Kiso conventions.
|
|
74
|
+
#
|
|
75
|
+
# Collapses the common +content_tag+ + +kiso_prepare_options+ + theme
|
|
76
|
+
# rendering boilerplate into a single call. Use in component partials
|
|
77
|
+
# instead of manually wiring +content_tag+.
|
|
78
|
+
#
|
|
79
|
+
# @param tag [Symbol] HTML element name (e.g. +:div+, +:span+, +:button+)
|
|
80
|
+
# @param theme [ClassVariants::Instance] the theme module to render classes from
|
|
81
|
+
# @param slot [String] the +data-slot+ value (kebab-case)
|
|
82
|
+
# @param css_classes [String] caller's class overrides, merged via +tailwind_merge+
|
|
83
|
+
# @param variants [Hash] variant values forwarded to +theme.render+
|
|
84
|
+
# (e.g. +{ size: :md, color: :primary }+)
|
|
85
|
+
# @param component_options [Hash] HTML attributes forwarded to +content_tag+
|
|
86
|
+
# (e.g. +id:+, +aria:+). A +data:+ key is extracted and merged with slot.
|
|
87
|
+
# @yield optional block for element content
|
|
88
|
+
# @return [ActiveSupport::SafeBuffer] rendered HTML
|
|
89
|
+
#
|
|
90
|
+
# @example In a component partial
|
|
91
|
+
# kui_tag :div, theme: Kiso::Themes::Badge, slot: "badge",
|
|
92
|
+
# css_classes: css_classes, variants: { color: color, variant: variant },
|
|
93
|
+
# **component_options do
|
|
94
|
+
# yield
|
|
95
|
+
# end
|
|
96
|
+
def kui_tag(tag, theme:, slot:, css_classes: "", variants: {}, **component_options, &block)
|
|
97
|
+
content_tag(tag,
|
|
98
|
+
class: theme.render(**variants, class: css_classes),
|
|
99
|
+
data: kiso_prepare_options(component_options, slot: slot),
|
|
100
|
+
**component_options, &block)
|
|
101
|
+
end
|
|
102
|
+
|
|
73
103
|
private
|
|
74
104
|
|
|
75
105
|
# Shared rendering pipeline for both kui() and appui().
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<%# locals: (css_classes: "", **component_options) %>
|
|
1
|
+
<%# locals: (center: false, css_classes: "", **component_options) %>
|
|
2
2
|
<%= content_tag :div,
|
|
3
|
-
class: Kiso::Themes::App.render(class: css_classes),
|
|
3
|
+
class: Kiso::Themes::App.render(center: center, class: css_classes),
|
|
4
4
|
data: kiso_prepare_options(component_options, slot: "app"),
|
|
5
5
|
**component_options do %>
|
|
6
6
|
<%= yield %>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<%% # locals: (css_classes: "", **component_options) %>
|
|
2
|
-
<%%=
|
|
3
|
-
|
|
4
|
-
data: kiso_prepare_options(component_options, slot: "<%= slot_name %>"),
|
|
5
|
-
**component_options do %>
|
|
2
|
+
<%%= appui_tag :div, theme: AppThemes::<%= has_namespace? ? "#{module_prefix}::" : "" %><%= class_name_without_namespace %>, slot: "<%= slot_name %>",
|
|
3
|
+
css_classes: css_classes, **component_options do %>
|
|
6
4
|
<%%= yield %>
|
|
7
5
|
<%% end %>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<%% # locals: (css_classes: "", **component_options) %>
|
|
2
|
-
<%%=
|
|
3
|
-
|
|
4
|
-
data: kiso_prepare_options(component_options, slot: "<%= sub_part_slot_name %>"),
|
|
5
|
-
**component_options do %>
|
|
2
|
+
<%%= appui_tag :div, theme: AppThemes::<%= has_namespace? ? "#{module_prefix}::" : "" %><%= sub_part_class_name %>, slot: "<%= sub_part_slot_name %>",
|
|
3
|
+
css_classes: css_classes, **component_options do %>
|
|
6
4
|
<%%= yield %>
|
|
7
5
|
<%% end %>
|
data/lib/kiso/engine.rb
CHANGED
|
@@ -10,6 +10,10 @@ module Kiso
|
|
|
10
10
|
class Engine < ::Rails::Engine
|
|
11
11
|
isolate_namespace Kiso
|
|
12
12
|
|
|
13
|
+
rake_tasks do
|
|
14
|
+
load Kiso::Engine.root.join("lib/tasks/kiso.rake")
|
|
15
|
+
end
|
|
16
|
+
|
|
13
17
|
# Loads Kiso's locale files so host apps can override translations.
|
|
14
18
|
initializer "kiso.i18n" do
|
|
15
19
|
config.i18n.load_path += Dir[root.join("config/locales/**/*.yml")]
|
data/lib/kiso/themes/layout.rb
CHANGED
|
@@ -5,10 +5,19 @@ module Kiso
|
|
|
5
5
|
#
|
|
6
6
|
# @example
|
|
7
7
|
# App.render
|
|
8
|
+
# App.render(center: true)
|
|
8
9
|
#
|
|
9
|
-
#
|
|
10
|
+
# Variants:
|
|
11
|
+
# - +center+ — centers content vertically and horizontally (e.g., login pages)
|
|
10
12
|
App = ClassVariants.build(
|
|
11
|
-
base: "bg-background text-foreground antialiased"
|
|
13
|
+
base: "bg-background text-foreground antialiased",
|
|
14
|
+
variants: {
|
|
15
|
+
center: {
|
|
16
|
+
true => "min-h-screen flex items-center justify-center",
|
|
17
|
+
false => ""
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaults: {center: false}
|
|
12
21
|
)
|
|
13
22
|
|
|
14
23
|
# Content containment with consistent max-width and padding.
|
data/lib/kiso/version.rb
CHANGED
data/lib/tasks/kiso.rake
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generates CSS stub files for Kiso's palette files in the host app.
|
|
2
|
+
#
|
|
3
|
+
# tailwindcss-rails creates a stub at app/assets/builds/tailwind/kiso.css
|
|
4
|
+
# for engine.css, but it doesn't handle subdirectories. Palette files at
|
|
5
|
+
# app/assets/tailwind/kiso/palettes/*.css inside the gem are invisible to
|
|
6
|
+
# the host app's Tailwind CLI without stubs.
|
|
7
|
+
#
|
|
8
|
+
# This task creates matching stubs so host apps can import palettes with:
|
|
9
|
+
# @import "../builds/tailwind/kiso/palettes/blue.css";
|
|
10
|
+
|
|
11
|
+
namespace :kiso do
|
|
12
|
+
desc "Generate CSS stubs for Kiso palette files"
|
|
13
|
+
task palettes: :environment do
|
|
14
|
+
palette_dir = Kiso::Engine.root.join("app/assets/tailwind/kiso/palettes")
|
|
15
|
+
next unless palette_dir.directory?
|
|
16
|
+
|
|
17
|
+
output_dir = Rails.root.join("app/assets/builds/tailwind/kiso/palettes")
|
|
18
|
+
FileUtils.mkdir_p(output_dir)
|
|
19
|
+
|
|
20
|
+
Dir[palette_dir.join("*.css")].each do |source|
|
|
21
|
+
name = File.basename(source)
|
|
22
|
+
stub_path = output_dir.join(name)
|
|
23
|
+
File.write(stub_path, <<~CSS)
|
|
24
|
+
/* DO NOT MODIFY THIS FILE, it was auto-generated by kiso */
|
|
25
|
+
|
|
26
|
+
@import "#{source}";
|
|
27
|
+
CSS
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Hook into tailwindcss-rails build pipeline so palette stubs are
|
|
33
|
+
# generated before the Tailwind CLI runs.
|
|
34
|
+
if Rake::Task.task_defined?("tailwindcss:engines")
|
|
35
|
+
Rake::Task["tailwindcss:engines"].enhance(["kiso:palettes"])
|
|
36
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kiso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1.pre
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steve Clarke
|
|
@@ -387,6 +387,7 @@ files:
|
|
|
387
387
|
- lib/kiso/themes/toggle.rb
|
|
388
388
|
- lib/kiso/themes/toggle_group.rb
|
|
389
389
|
- lib/kiso/version.rb
|
|
390
|
+
- lib/tasks/kiso.rake
|
|
390
391
|
homepage: https://github.com/steveclarke/kiso
|
|
391
392
|
licenses:
|
|
392
393
|
- MIT
|