plutonium 0.27.0 → 0.29.0

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/app/assets/plutonium.css +2 -2
  4. data/app/assets/plutonium.js +13 -3
  5. data/app/assets/plutonium.js.map +3 -3
  6. data/app/assets/plutonium.min.js +1 -1
  7. data/app/assets/plutonium.min.js.map +2 -2
  8. data/app/views/resource/_resource_details.rabl +44 -1
  9. data/app/views/resource/index.rabl +44 -1
  10. data/app/views/resource/show.rabl +44 -1
  11. data/docs/guide/theming.md +431 -0
  12. data/lib/plutonium/core/controller.rb +5 -0
  13. data/lib/plutonium/interaction/response/redirect.rb +8 -0
  14. data/lib/plutonium/resource/controller.rb +7 -3
  15. data/lib/plutonium/resource/controllers/crud_actions.rb +1 -0
  16. data/lib/plutonium/ui/action_button.rb +11 -5
  17. data/lib/plutonium/ui/block.rb +4 -1
  18. data/lib/plutonium/ui/breadcrumbs.rb +10 -8
  19. data/lib/plutonium/ui/color_mode_selector.rb +2 -2
  20. data/lib/plutonium/ui/component/behaviour.rb +8 -0
  21. data/lib/plutonium/ui/component/kit.rb +1 -1
  22. data/lib/plutonium/ui/component/theme.rb +47 -0
  23. data/lib/plutonium/ui/display/components/attachment.rb +2 -2
  24. data/lib/plutonium/ui/display/theme.rb +16 -16
  25. data/lib/plutonium/ui/empty_card.rb +5 -2
  26. data/lib/plutonium/ui/form/components/key_value_store.rb +11 -11
  27. data/lib/plutonium/ui/form/components/secure_association.rb +2 -2
  28. data/lib/plutonium/ui/form/components/uppy.rb +5 -5
  29. data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +5 -5
  30. data/lib/plutonium/ui/form/query.rb +11 -11
  31. data/lib/plutonium/ui/form/resource.rb +2 -2
  32. data/lib/plutonium/ui/form/theme.rb +17 -17
  33. data/lib/plutonium/ui/layout/base.rb +2 -2
  34. data/lib/plutonium/ui/layout/header.rb +10 -7
  35. data/lib/plutonium/ui/layout/rodauth_layout.rb +5 -5
  36. data/lib/plutonium/ui/layout/sidebar.rb +2 -2
  37. data/lib/plutonium/ui/nav_grid_menu.rb +6 -6
  38. data/lib/plutonium/ui/nav_user.rb +8 -7
  39. data/lib/plutonium/ui/page/interactive_action.rb +4 -4
  40. data/lib/plutonium/ui/page_header.rb +7 -4
  41. data/lib/plutonium/ui/panel.rb +3 -3
  42. data/lib/plutonium/ui/sidebar_menu.rb +12 -12
  43. data/lib/plutonium/ui/skeleton_table.rb +8 -8
  44. data/lib/plutonium/ui/tab_list.rb +5 -3
  45. data/lib/plutonium/ui/table/components/attachment.rb +2 -2
  46. data/lib/plutonium/ui/table/components/pagy_info.rb +3 -3
  47. data/lib/plutonium/ui/table/components/pagy_pagination.rb +3 -3
  48. data/lib/plutonium/ui/table/components/scopes_bar.rb +14 -14
  49. data/lib/plutonium/ui/table/display_theme.rb +3 -3
  50. data/lib/plutonium/ui/table/resource.rb +2 -2
  51. data/lib/plutonium/ui/table/theme.rb +13 -13
  52. data/lib/plutonium/version.rb +1 -1
  53. data/lib/tasks/release.rake +45 -5
  54. data/package.json +1 -1
  55. data/src/css/core.css +2 -2
  56. data/src/css/easymde.css +8 -8
  57. data/src/css/intl_tel_input.css +7 -7
  58. data/src/css/slim_select.css +5 -5
  59. data/src/js/controllers/color_mode_controller.js +19 -3
  60. data/tailwind.options.js +75 -47
  61. metadata +4 -2
@@ -6,28 +6,28 @@ module Plutonium
6
6
  class Theme < Phlexi::Table::Theme
7
7
  def self.theme
8
8
  super.merge({
9
- selection_checkbox: "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",
9
+ selection_checkbox: "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-elevated-dark dark:border-gray-600",
10
10
  name_column: "font-medium text-gray-900 whitespace-nowrap dark:text-white",
11
11
  align_start: "text-start",
12
12
  align_end: "text-end",
13
- wrapper: "relative overflow-x-auto shadow-md sm:rounded-lg",
14
- base: "w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400",
15
- caption: "p-5 text-lg font-semibold text-left rtl:text-right text-gray-900 bg-white dark:text-white dark:bg-gray-800",
16
- description: "mt-1 text-sm font-normal text-gray-500 dark:text-gray-400",
17
- header: "text-xs text-gray-700 uppercase bg-gray-200 dark:bg-gray-700 dark:text-gray-400",
18
- header_grouping_cell: "px-6 py-3 text-center text-sm border-b border-t border-r last:border-r-0 dark:border-gray-800",
19
- header_cell: "px-6 py-3",
13
+ wrapper: "pu-table-wrapper relative overflow-x-auto shadow-md sm:rounded-sm",
14
+ base: "pu-table w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400",
15
+ caption: "p-md text-lg font-semibold text-left rtl:text-right text-gray-900 bg-surface dark:text-white dark:bg-surface-dark",
16
+ description: "mt-xs text-sm font-normal text-gray-500 dark:text-gray-400",
17
+ header: "pu-table-header text-xs text-gray-700 uppercase bg-elevated dark:bg-elevated-dark dark:text-gray-400",
18
+ header_grouping_cell: "px-lg py-sm text-center text-sm border-b border-t border-r last:border-r-0 dark:border-gray-800",
19
+ header_cell: "pu-table-header-cell px-lg py-sm",
20
20
  header_cell_content_wrapper: "inline-flex items-center",
21
21
  header_cell_sort_wrapper: "flex items-center",
22
- header_cell_sort_indicator: "ml-1.5",
23
- body_row: "bg-white border-b last:border-none dark:bg-gray-800 dark:border-gray-700",
24
- body_cell: "px-6 py-4 whitespace-pre max-w-[450px] overflow-hidden text-ellipsis transition-all duration-300 ease-in-out",
22
+ header_cell_sort_indicator: "ml-xs.5",
23
+ body_row: "pu-table-row bg-surface border-b last:border-none dark:bg-surface-dark dark:border-gray-700",
24
+ body_cell: "pu-table-cell px-lg py-md whitespace-pre max-w-[450px] overflow-hidden text-ellipsis transition-all duration-300 ease-in-out",
25
25
  sort_icon: "w-3 h-3",
26
26
  sort_icon_active: "text-primary-600",
27
27
  sort_icon_inactive: "text-gray-600 dark:text-gray-500",
28
- sort_index_clear_link: "ml-2",
28
+ sort_index_clear_link: "ml-sm",
29
29
  sort_index_clear_link_text: "text-xs font-bold text-gray-600 dark:text-gray-500",
30
- sort_index_clear_link_icon: "ml-1 text-red-600"
30
+ sort_index_clear_link_icon: "ml-xs text-red-600"
31
31
  })
32
32
  end
33
33
  end
@@ -1,5 +1,5 @@
1
1
  module Plutonium
2
- VERSION = "0.27.0"
2
+ VERSION = "0.29.0"
3
3
  NEXT_MAJOR_VERSION = VERSION.split(".").tap { |v|
4
4
  v[1] = v[1].to_i + 1
5
5
  v[2] = 0
@@ -46,10 +46,19 @@ namespace :release do
46
46
  # Update version.rb
47
47
  version_file = "lib/plutonium/version.rb"
48
48
  content = File.read(version_file)
49
- updated_content = content.gsub(/VERSION = "[\d.]+"/, %{VERSION = "#{version}"})
49
+ updated_content = content.gsub(/VERSION = "[\d.]+"/, %(VERSION = "#{version}"))
50
50
  File.write(version_file, updated_content)
51
51
  puts "✓ Updated #{version_file}"
52
52
 
53
+ # Update package.json version
54
+ package_json_file = "package.json"
55
+ if File.exist?(package_json_file)
56
+ package_content = File.read(package_json_file)
57
+ updated_package = package_content.gsub(/"version":\s*"[\d.]+"/, %{"version": "#{version}"})
58
+ File.write(package_json_file, updated_package)
59
+ puts "✓ Updated #{package_json_file}"
60
+ end
61
+
53
62
  # Generate changelog using git-cliff
54
63
  if system("which git-cliff > /dev/null 2>&1")
55
64
  system("git-cliff --tag v#{version} -o CHANGELOG.md")
@@ -68,12 +77,19 @@ namespace :release do
68
77
  puts "3. Create and push the tag:"
69
78
  puts " git tag v#{version}"
70
79
  puts " git push origin main --tags"
71
- puts "4. Build and release the gem:"
80
+ puts "4. Build and release:"
72
81
  puts " rake release:publish"
73
82
  end
74
83
 
84
+ desc "Build front-end assets"
85
+ task :build_frontend do
86
+ puts "Building front-end assets..."
87
+ system("npm run build") || abort("Front-end build failed")
88
+ puts "✓ Built front-end assets"
89
+ end
90
+
75
91
  desc "Publish the gem to RubyGems"
76
- task :publish do
92
+ task :publish_gem do
77
93
  # Reload version constant in case it was updated
78
94
  load "lib/plutonium/version.rb"
79
95
  version = Plutonium::VERSION
@@ -93,6 +109,30 @@ namespace :release do
93
109
  File.delete(gem_file) if File.exist?(gem_file)
94
110
  end
95
111
 
112
+ desc "Publish the npm package"
113
+ task :publish_npm do
114
+ puts "Publishing npm package..."
115
+
116
+ # Check if user is logged in to npm
117
+ unless system("npm whoami > /dev/null 2>&1")
118
+ puts "⚠ You are not logged in to npm. Please run: npm login"
119
+ abort("npm authentication required")
120
+ end
121
+
122
+ # Publish to npm
123
+ system("npm publish --access public") || abort("npm publish failed")
124
+
125
+ # Get version from package.json
126
+ require "json"
127
+ package_json = JSON.parse(File.read("package.json"))
128
+ version = package_json["version"]
129
+
130
+ puts "✓ Published @radioactive-labs/plutonium #{version} to npm"
131
+ end
132
+
133
+ desc "Publish both gem and npm package"
134
+ task publish: [:build_frontend, :publish_gem, :publish_npm]
135
+
96
136
  desc "Full release workflow"
97
137
  task :full, [:version] do |_t, args|
98
138
  version = args[:version]
@@ -133,8 +173,8 @@ namespace :release do
133
173
  # Push commit (without tags yet)
134
174
  system("git push origin #{current_branch}")
135
175
 
136
- # Publish gem (do this BEFORE tagging)
137
- puts "\nPublishing gem to RubyGems..."
176
+ # Build and publish (do this BEFORE tagging)
177
+ puts "\nBuilding and publishing gem and npm package..."
138
178
  Rake::Task["release:publish"].invoke
139
179
 
140
180
  # Only tag and push tag if publish succeeded
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radioactive-labs/plutonium",
3
- "version": "0.4.11",
3
+ "version": "0.29.0",
4
4
  "description": "Core assets for the Plutonium gem",
5
5
  "type": "module",
6
6
  "main": "src/js/core.js",
data/src/css/core.css CHANGED
@@ -8,9 +8,9 @@
8
8
  }
9
9
 
10
10
  .pu-color-input::-webkit-color-swatch {
11
- @apply border-none rounded-lg;
11
+ @apply border-none rounded-sm;
12
12
  }
13
13
 
14
14
  .pu-color-input::-moz-color-swatch {
15
- @apply border-none rounded-lg;
15
+ @apply border-none rounded-sm;
16
16
  }
data/src/css/easymde.css CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  /* Container and CodeMirror theming */
8
8
  .EasyMDEContainer .CodeMirror {
9
- @apply border-gray-300 bg-white text-gray-900 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100;
9
+ @apply border-gray-300 bg-surface text-gray-900 dark:border-gray-600 dark:bg-surface-dark dark:text-gray-100;
10
10
  }
11
11
 
12
12
  .EasyMDEContainer .CodeMirror-focused .CodeMirror-selected {
@@ -31,7 +31,7 @@
31
31
 
32
32
  /* Gutter theming */
33
33
  .CodeMirror-gutters {
34
- @apply border-gray-300 bg-gray-50 dark:border-gray-600 dark:bg-gray-700;
34
+ @apply border-gray-300 bg-elevated dark:border-gray-600 dark:bg-elevated-dark;
35
35
  }
36
36
 
37
37
  .CodeMirror-linenumber {
@@ -44,11 +44,11 @@
44
44
 
45
45
  /* Toolbar theming */
46
46
  .editor-toolbar {
47
- @apply border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800;
47
+ @apply border-gray-300 bg-surface dark:border-gray-600 dark:bg-surface-dark;
48
48
  }
49
49
 
50
50
  .editor-toolbar.fullscreen {
51
- @apply bg-white dark:bg-gray-800;
51
+ @apply bg-surface dark:bg-surface-dark;
52
52
  }
53
53
 
54
54
  .editor-toolbar button {
@@ -71,7 +71,7 @@
71
71
 
72
72
  /* Preview theming */
73
73
  .editor-preview {
74
- @apply bg-gray-50 text-gray-900 dark:bg-gray-800 dark:text-gray-100;
74
+ @apply bg-elevated text-gray-900 dark:bg-surface-dark dark:text-gray-100;
75
75
  }
76
76
 
77
77
  .editor-preview pre {
@@ -84,7 +84,7 @@
84
84
  }
85
85
 
86
86
  .editor-preview-side {
87
- @apply border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800;
87
+ @apply border-gray-300 bg-surface dark:border-gray-600 dark:bg-surface-dark;
88
88
  }
89
89
 
90
90
  /* CodeMirror syntax highlighting - dark mode support */
@@ -127,11 +127,11 @@
127
127
 
128
128
  /* Dropdown theming */
129
129
  .editor-toolbar .easymde-dropdown {
130
- @apply bg-white border-gray-300 dark:bg-gray-800 dark:border-gray-600;
130
+ @apply bg-surface border-gray-300 dark:bg-surface-dark dark:border-gray-600;
131
131
  }
132
132
 
133
133
  .easymde-dropdown-content {
134
- @apply bg-white shadow-lg border border-gray-200 dark:bg-gray-800 dark:border-gray-600 dark:shadow-gray-900/20;
134
+ @apply bg-surface shadow-lg border border-gray-200 dark:bg-surface-dark dark:border-gray-600 dark:shadow-gray-900/20;
135
135
  }
136
136
 
137
137
  .easymde-dropdown-content button {
@@ -9,7 +9,7 @@
9
9
  --iti-hover-color: theme(colors.primary.50);
10
10
  --iti-border-color: theme(colors.gray.300);
11
11
  --iti-dialcode-color: theme(colors.gray.500);
12
- --iti-dropdown-bg: theme(colors.white);
12
+ --iti-dropdown-bg: theme(colors.surface.DEFAULT);
13
13
  --iti-arrow-color: theme(colors.gray.700);
14
14
  }
15
15
 
@@ -19,7 +19,7 @@
19
19
  --iti-hover-color: theme(colors.primary.900 / 0.3);
20
20
  --iti-border-color: theme(colors.gray.600);
21
21
  --iti-dialcode-color: theme(colors.gray.400);
22
- --iti-dropdown-bg: theme(colors.gray.700);
22
+ --iti-dropdown-bg: theme(colors.surface.dark);
23
23
  --iti-arrow-color: theme(colors.white);
24
24
  }
25
25
  }
@@ -29,7 +29,7 @@
29
29
  --iti-hover-color: theme(colors.primary.900 / 0.3);
30
30
  --iti-border-color: theme(colors.gray.600);
31
31
  --iti-dialcode-color: theme(colors.gray.400);
32
- --iti-dropdown-bg: theme(colors.gray.700);
32
+ --iti-dropdown-bg: theme(colors.surface.dark);
33
33
  --iti-arrow-color: theme(colors.white);
34
34
  }
35
35
 
@@ -42,7 +42,7 @@
42
42
  .iti input.iti__tel-input,
43
43
  .iti input.iti__tel-input[type=tel],
44
44
  .iti input.iti__tel-input[type=text] {
45
- @apply w-full border border-gray-300 rounded-md shadow-sm font-medium text-sm bg-white text-gray-700 outline-none transition-colors duration-200 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400;
45
+ @apply w-full border border-gray-300 rounded shadow-sm font-medium text-sm bg-surface text-gray-700 outline-none transition-colors duration-200 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-elevated-dark dark:border-gray-600 dark:text-white dark:placeholder-gray-400;
46
46
  padding: theme(spacing.2);
47
47
  padding-left: 52px;
48
48
  /* Space for country selector */
@@ -87,12 +87,12 @@
87
87
 
88
88
  /* Dropdown content styling to match form theme */
89
89
  .iti .iti__dropdown-content {
90
- @apply border border-gray-300 bg-white shadow-sm rounded-md dark:bg-gray-700 dark:border-gray-600;
90
+ @apply border border-gray-300 bg-surface shadow-sm rounded dark:bg-surface-dark dark:border-gray-600;
91
91
  }
92
92
 
93
93
  /* Search input to match form theme */
94
94
  .iti .iti__search-input {
95
- @apply w-full p-2 border border-gray-300 rounded-md shadow-sm font-medium text-sm bg-white text-gray-700 outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400;
95
+ @apply w-full p-2 border border-gray-300 rounded shadow-sm font-medium text-sm bg-surface text-gray-700 outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-elevated-dark dark:border-gray-600 dark:text-white dark:placeholder-gray-400;
96
96
  margin: theme(spacing.2);
97
97
  width: calc(100% - theme(spacing.4));
98
98
  }
@@ -186,7 +186,7 @@
186
186
  }
187
187
 
188
188
  .iti--fullscreen-popup .iti__dropdown-content {
189
- @apply bg-white dark:bg-gray-700;
189
+ @apply bg-surface dark:bg-surface-dark;
190
190
  }
191
191
 
192
192
  .iti--fullscreen-popup .iti__country {
@@ -36,7 +36,7 @@
36
36
 
37
37
  /* Main container - Updated to match form input theme */
38
38
  .ss-main {
39
- @apply flex flex-row relative select-none w-full min-h-8 p-2 cursor-pointer border border-gray-300 rounded-md shadow-sm font-medium text-sm bg-white text-gray-700 outline-none transition-colors duration-200 overflow-hidden focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400;
39
+ @apply flex flex-row relative select-none w-full min-h-8 p-2 cursor-pointer border border-gray-300 rounded shadow-sm font-medium text-sm bg-surface text-gray-700 outline-none transition-colors duration-200 overflow-hidden focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-elevated-dark dark:border-gray-600 dark:text-white dark:placeholder-gray-400;
40
40
  }
41
41
 
42
42
  .ss-main.ss-disabled {
@@ -131,7 +131,7 @@
131
131
 
132
132
  /* Content container - Updated to match shadow and borders */
133
133
  .ss-content {
134
- @apply absolute flex h-auto flex-col w-auto max-h-72 border border-gray-300 bg-white shadow-sm transition-all duration-200 opacity-0 z-[10000] overflow-hidden dark:bg-gray-700 dark:border-gray-600;
134
+ @apply absolute flex h-auto flex-col w-auto max-h-72 border border-gray-300 bg-surface shadow-sm transition-all duration-200 opacity-0 z-[10000] overflow-hidden dark:bg-surface-dark dark:border-gray-600;
135
135
  transform: scaleY(0);
136
136
  transform-origin: top;
137
137
  }
@@ -162,14 +162,14 @@
162
162
  }
163
163
 
164
164
  .ss-content .ss-search input {
165
- @apply inline-flex flex-auto w-full min-w-0 p-2 m-0 border border-gray-300 rounded-md shadow-sm font-medium text-sm bg-white outline-none text-left placeholder:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400;
165
+ @apply inline-flex flex-auto w-full min-w-0 p-2 m-0 border border-gray-300 rounded shadow-sm font-medium text-sm bg-surface outline-none text-left placeholder:text-gray-400 focus:ring-2 focus:ring-primary-500 focus:border-primary-500 dark:bg-elevated-dark dark:border-gray-600 dark:text-white dark:placeholder-gray-400;
166
166
  box-sizing: border-box;
167
167
  font-size: inherit;
168
168
  line-height: inherit;
169
169
  }
170
170
 
171
171
  .ss-content .ss-search .ss-addable {
172
- @apply inline-flex justify-center items-center cursor-pointer flex-none h-auto ml-2 border border-gray-300 rounded-md shadow-sm dark:border-gray-600;
172
+ @apply inline-flex justify-center items-center cursor-pointer flex-none h-auto ml-2 border border-gray-300 rounded shadow-sm dark:border-gray-600;
173
173
  }
174
174
 
175
175
  .ss-content .ss-search .ss-addable svg {
@@ -202,7 +202,7 @@
202
202
 
203
203
  /* Option groups - Updated colors */
204
204
  .ss-content .ss-list .ss-optgroup .ss-optgroup-label {
205
- @apply flex flex-row items-center justify-between p-2 bg-gray-50 dark:bg-gray-600;
205
+ @apply flex flex-row items-center justify-between p-2 bg-elevated dark:bg-elevated-dark;
206
206
  }
207
207
 
208
208
  .ss-content .ss-list .ss-optgroup .ss-optgroup-label .ss-optgroup-label-text {
@@ -6,8 +6,23 @@ export default class extends Controller {
6
6
 
7
7
  connect() {
8
8
  // Set initial mode from localStorage or default
9
- const mode = localStorage.theme || "light";
9
+ const mode = localStorage.getItem('theme') || "light";
10
10
  this.setMode(mode);
11
+
12
+ // Listen for cross-tab theme changes
13
+ this.handleStorageChange = (e) => {
14
+ console.log('Storage event received in color-mode controller:', e.key, e.newValue, e.oldValue)
15
+ if (e.key === 'theme' && e.newValue) {
16
+ console.log('Updating color-mode theme to:', e.newValue)
17
+ this.setMode(e.newValue);
18
+ }
19
+ };
20
+ window.addEventListener('storage', this.handleStorageChange);
21
+ }
22
+
23
+ disconnect() {
24
+ // Clean up event listener
25
+ window.removeEventListener('storage', this.handleStorageChange);
11
26
  }
12
27
 
13
28
  toggleMode() {
@@ -20,10 +35,8 @@ export default class extends Controller {
20
35
  // Update html class
21
36
  if (mode === "dark") {
22
37
  document.documentElement.classList.add("dark");
23
- localStorage.theme = "dark";
24
38
  } else {
25
39
  document.documentElement.classList.remove("dark");
26
- localStorage.theme = "light";
27
40
  }
28
41
 
29
42
  // Update button state
@@ -31,6 +44,9 @@ export default class extends Controller {
31
44
 
32
45
  // Show/hide icons
33
46
  this.toggleIcons(mode);
47
+
48
+ // Store in localStorage to trigger storage events in other tabs
49
+ localStorage.setItem('theme', mode);
34
50
  }
35
51
 
36
52
  toggleIcons(mode) {
data/tailwind.options.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export const content = [
2
- `${__dirname}/src/css/**/*.css`,
3
2
  `${__dirname}/src/js/**/*.js`,
4
3
  `${__dirname}/app/views/**/*.{rb,erb,js}`,
5
4
  `${__dirname}/lib/plutonium/**/*.rb`,
@@ -64,7 +63,36 @@ export const theme = {
64
63
  },
65
64
  },
66
65
  }),
66
+ // Semantic spacing scale - affects padding, margin, gap, space utilities
67
+ spacing: {
68
+ 'xs': '0.5rem', // 8px - extra small spacing
69
+ 'sm': '0.75rem', // 12px - small spacing (inputs, buttons, small gaps)
70
+ 'md': '1rem', // 16px - medium spacing (cards, tabs, standard gaps)
71
+ 'lg': '1.5rem', // 24px - large spacing (forms, displays, large spacing)
72
+ 'xl': '2rem', // 32px - extra large spacing
73
+ '2xl': '2.5rem', // 40px - 2x extra large spacing
74
+ '3xl': '3rem', // 48px - 3x extra large spacing
75
+ },
67
76
  colors: {
77
+ // Semantic background colors for theming - minimal, modern palette
78
+ surface: {
79
+ DEFAULT: '#ffffff', // Light mode surface (cards, forms, tables, panels)
80
+ dark: '#1f2937', // Dark mode surface - gray-800
81
+ },
82
+ page: {
83
+ DEFAULT: 'rgb(248 248 248)', // Light mode page - neutral gray
84
+ dark: '#111827', // Dark mode page - gray-900
85
+ },
86
+ elevated: {
87
+ DEFAULT: 'rgb(244 244 245)', // Light mode elevated - subtle
88
+ dark: '#374151', // Dark mode elevated - gray-700
89
+ },
90
+ interactive: {
91
+ DEFAULT: 'rgb(244 244 245)', // Light mode hover - subtle
92
+ dark: '#374151', // Dark mode hover - gray-700
93
+ },
94
+
95
+ // Brand colors
68
96
  primary: {
69
97
  50: '#F0FDFD',
70
98
  100: '#E0FAFA',
@@ -160,53 +188,53 @@ export const theme = {
160
188
  screens: {
161
189
  'xs': '475px',
162
190
  },
191
+ fontFamily: {
192
+ 'body': [
193
+ 'Lato',
194
+ 'ui-sans-serif',
195
+ 'system-ui',
196
+ '-apple-system',
197
+ 'system-ui',
198
+ 'Segoe UI',
199
+ 'Roboto',
200
+ 'Helvetica Neue',
201
+ 'Arial',
202
+ 'Noto Sans',
203
+ 'sans-serif',
204
+ 'Apple Color Emoji',
205
+ 'Segoe UI Emoji',
206
+ 'Segoe UI Symbol',
207
+ 'Noto Color Emoji'
208
+ ],
209
+ 'sans': [
210
+ 'Lato',
211
+ 'ui-sans-serif',
212
+ 'system-ui',
213
+ '-apple-system',
214
+ 'system-ui',
215
+ 'Segoe UI',
216
+ 'Roboto',
217
+ 'Helvetica Neue',
218
+ 'Arial',
219
+ 'Noto Sans',
220
+ 'sans-serif',
221
+ 'Apple Color Emoji',
222
+ 'Segoe UI Emoji',
223
+ 'Segoe UI Symbol',
224
+ 'Noto Color Emoji'
225
+ ],
226
+ 'mono': [
227
+ 'ui-monospace',
228
+ 'SFMono-Regular',
229
+ 'Menlo',
230
+ 'Monaco',
231
+ 'Consolas',
232
+ 'Liberation Mono',
233
+ 'Courier New',
234
+ 'monospace'
235
+ ]
236
+ },
163
237
  },
164
- fontFamily: {
165
- 'body': [
166
- 'Lato',
167
- 'ui-sans-serif',
168
- 'system-ui',
169
- '-apple-system',
170
- 'system-ui',
171
- 'Segoe UI',
172
- 'Roboto',
173
- 'Helvetica Neue',
174
- 'Arial',
175
- 'Noto Sans',
176
- 'sans-serif',
177
- 'Apple Color Emoji',
178
- 'Segoe UI Emoji',
179
- 'Segoe UI Symbol',
180
- 'Noto Color Emoji'
181
- ],
182
- 'sans': [
183
- 'Lato',
184
- 'ui-sans-serif',
185
- 'system-ui',
186
- '-apple-system',
187
- 'system-ui',
188
- 'Segoe UI',
189
- 'Roboto',
190
- 'Helvetica Neue',
191
- 'Arial',
192
- 'Noto Sans',
193
- 'sans-serif',
194
- 'Apple Color Emoji',
195
- 'Segoe UI Emoji',
196
- 'Segoe UI Symbol',
197
- 'Noto Color Emoji'
198
- ],
199
- 'mono': [
200
- 'ui-monospace',
201
- 'SFMono-Regular',
202
- 'Menlo',
203
- 'Monaco',
204
- 'Consolas',
205
- 'Liberation Mono',
206
- 'Courier New',
207
- 'monospace'
208
- ]
209
- }
210
238
  };
211
239
 
212
240
  export const safelist = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutonium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-11-05 00:00:00.000000000 Z
11
+ date: 2026-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -505,6 +505,7 @@ files:
505
505
  - docs/guide/index.md
506
506
  - docs/guide/introduction/01-what-is-plutonium.md
507
507
  - docs/guide/introduction/02-core-concepts.md
508
+ - docs/guide/theming.md
508
509
  - docs/guide/tutorial/01-project-setup.md
509
510
  - docs/guide/tutorial/02-creating-a-feature-package.md
510
511
  - docs/guide/tutorial/03-defining-resources.md
@@ -830,6 +831,7 @@ files:
830
831
  - lib/plutonium/ui/component/behaviour.rb
831
832
  - lib/plutonium/ui/component/kit.rb
832
833
  - lib/plutonium/ui/component/methods.rb
834
+ - lib/plutonium/ui/component/theme.rb
833
835
  - lib/plutonium/ui/component/tokens.rb
834
836
  - lib/plutonium/ui/display/base.rb
835
837
  - lib/plutonium/ui/display/components/association.rb