plutonium 0.28.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -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/docs/guide/theming.md +431 -0
  9. data/lib/plutonium/core/controller.rb +5 -0
  10. data/lib/plutonium/interaction/response/redirect.rb +8 -0
  11. data/lib/plutonium/resource/controllers/crud_actions.rb +1 -0
  12. data/lib/plutonium/ui/action_button.rb +11 -5
  13. data/lib/plutonium/ui/block.rb +4 -1
  14. data/lib/plutonium/ui/breadcrumbs.rb +10 -8
  15. data/lib/plutonium/ui/color_mode_selector.rb +2 -2
  16. data/lib/plutonium/ui/component/behaviour.rb +8 -0
  17. data/lib/plutonium/ui/component/kit.rb +1 -1
  18. data/lib/plutonium/ui/component/theme.rb +47 -0
  19. data/lib/plutonium/ui/display/components/attachment.rb +2 -2
  20. data/lib/plutonium/ui/display/theme.rb +16 -16
  21. data/lib/plutonium/ui/empty_card.rb +5 -2
  22. data/lib/plutonium/ui/form/components/key_value_store.rb +11 -11
  23. data/lib/plutonium/ui/form/components/secure_association.rb +2 -2
  24. data/lib/plutonium/ui/form/components/uppy.rb +5 -5
  25. data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +5 -5
  26. data/lib/plutonium/ui/form/query.rb +11 -11
  27. data/lib/plutonium/ui/form/resource.rb +2 -2
  28. data/lib/plutonium/ui/form/theme.rb +17 -17
  29. data/lib/plutonium/ui/layout/base.rb +2 -2
  30. data/lib/plutonium/ui/layout/header.rb +10 -7
  31. data/lib/plutonium/ui/layout/rodauth_layout.rb +5 -5
  32. data/lib/plutonium/ui/layout/sidebar.rb +2 -2
  33. data/lib/plutonium/ui/nav_grid_menu.rb +6 -6
  34. data/lib/plutonium/ui/nav_user.rb +8 -7
  35. data/lib/plutonium/ui/page/interactive_action.rb +4 -4
  36. data/lib/plutonium/ui/page_header.rb +7 -4
  37. data/lib/plutonium/ui/panel.rb +3 -3
  38. data/lib/plutonium/ui/sidebar_menu.rb +12 -12
  39. data/lib/plutonium/ui/skeleton_table.rb +8 -8
  40. data/lib/plutonium/ui/tab_list.rb +5 -3
  41. data/lib/plutonium/ui/table/components/attachment.rb +2 -2
  42. data/lib/plutonium/ui/table/components/pagy_info.rb +3 -3
  43. data/lib/plutonium/ui/table/components/pagy_pagination.rb +3 -3
  44. data/lib/plutonium/ui/table/components/scopes_bar.rb +14 -14
  45. data/lib/plutonium/ui/table/display_theme.rb +3 -3
  46. data/lib/plutonium/ui/table/resource.rb +2 -2
  47. data/lib/plutonium/ui/table/theme.rb +13 -13
  48. data/lib/plutonium/version.rb +1 -1
  49. data/lib/tasks/release.rake +45 -5
  50. data/package.json +1 -1
  51. data/src/css/core.css +2 -2
  52. data/src/css/easymde.css +8 -8
  53. data/src/css/intl_tel_input.css +7 -7
  54. data/src/css/slim_select.css +5 -5
  55. data/src/js/controllers/color_mode_controller.js +19 -3
  56. data/tailwind.options.js +75 -47
  57. metadata +4 -2
@@ -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.28.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-12 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