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
@@ -20,13 +20,13 @@ module Plutonium
20
20
  if helpers.current_turbo_frame == "remote_modal"
21
21
  dialog(
22
22
  closedby: "any",
23
- class: "rounded-md w-full max-w-3xl
24
- bg-white dark:bg-gray-800
23
+ class: "rounded w-full max-w-3xl
24
+ bg-surface dark:bg-surface-dark
25
25
  border border-gray-200 dark:border-gray-700
26
26
  shadow-lg dark:shadow-gray-900/20
27
27
  backdrop:bg-black/60 backdrop:backdrop-blur-sm
28
28
  top-auto md:top-1/2 md:-translate-y-1/2 left-1/2 -translate-x-1/2
29
- max-h-[80%] p-6
29
+ max-h-[80%] p-lg
30
30
  hidden open:flex flex-col
31
31
  relative opacity-0 open:opacity-100
32
32
  transition-opacity duration-300 ease-in-out",
@@ -35,7 +35,7 @@ module Plutonium
35
35
  # Close button
36
36
  button(
37
37
  type: "button",
38
- class: "absolute top-4 right-4 p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors duration-200",
38
+ class: "absolute top-4 right-4 p-sm text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors duration-200",
39
39
  data: {action: "remote-modal#close"},
40
40
  "aria-label": "Close dialog"
41
41
  ) do
@@ -8,7 +8,10 @@ module Plutonium
8
8
  end
9
9
 
10
10
  def view_template
11
- div(class: "sm:flex sm:space-y-0 sm:space-x-4 sm:flex-row items-center justify-between space-y-3 mb-6") {
11
+ div(class: tokens(
12
+ theme_class(:page, element: :header),
13
+ "sm:flex sm:space-y-0 sm:space-x-md sm:flex-row items-center justify-between space-y-sm mb-lg"
14
+ )) {
12
15
  div {
13
16
  phlexi_render(@title) {
14
17
  render_title @title
@@ -18,7 +21,7 @@ module Plutonium
18
21
  render_description @description
19
22
  }
20
23
  }
21
- div(class: "flex flex-row space-x-2") {
24
+ div(class: "flex flex-row space-x-sm") {
22
25
  render_actions
23
26
  }
24
27
  }
@@ -27,13 +30,13 @@ module Plutonium
27
30
  private
28
31
 
29
32
  def render_title(title)
30
- h2(class: "mb-2 text-3xl font-extrabold leading-none tracking-tight text-gray-900 md:text-4xl dark:text-white") {
33
+ h2(class: tokens(theme_class(:page, element: :header_title), "mb-2 text-3xl font-extrabold leading-none tracking-tight text-gray-900 md:text-4xl dark:text-white")) {
31
34
  title
32
35
  }
33
36
  end
34
37
 
35
38
  def render_description(description)
36
- p(class: "text-gray-500 dark:text-gray-400") {
39
+ p(class: tokens(theme_class(:page, element: :header_description), "text-gray-500 dark:text-gray-400")) {
37
40
  description
38
41
  }
39
42
  end
@@ -32,17 +32,17 @@ module Plutonium
32
32
  private
33
33
 
34
34
  def wrapped(&)
35
- div(class: "mt-6", &)
35
+ div(class: tokens(theme_class(:panel), "mt-lg"), &)
36
36
  end
37
37
 
38
38
  def render_toolbar
39
- div(class: %(flex justify-between items-center mb-4)) do
39
+ div(class: %(flex justify-between items-center mb-md)) do
40
40
  if @title
41
41
  h5(class: %(text-2xl font-bold tracking-tight text-gray-900 dark:text-white)) do
42
42
  @title
43
43
  end
44
44
  end
45
- div(class: "flex space-x-4") do
45
+ div(class: "flex space-x-md") do
46
46
  @items.each do |item|
47
47
  render item
48
48
  end
@@ -13,34 +13,34 @@ module Plutonium
13
13
  def self.theme
14
14
  super.merge({
15
15
  # Base container styles
16
- nav: "space-y-2 pb-6 mb-6",
17
- items_container: "space-y-2",
16
+ nav: "pu-sidebar-menu space-y-sm pb-lg mb-lg",
17
+ items_container: "pu-sidebar-menu-items space-y-sm",
18
18
 
19
19
  # Item wrapper styles
20
- item_wrapper: "w-full transition-colors duration-200 ease-in-out",
20
+ item_wrapper: "pu-sidebar-menu-item w-full transition-colors duration-200 ease-in-out",
21
21
  item_parent: nil,
22
22
 
23
23
  # Link and button base styles
24
- item_link: "flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group",
25
- item_span: "flex items-center p-2 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700",
24
+ item_link: "pu-sidebar-menu-link flex items-center p-sm text-base font-normal text-gray-900 rounded-sm dark:text-white hover:bg-interactive dark:hover:bg-interactive-dark group",
25
+ item_span: "pu-sidebar-menu-button flex items-center p-sm w-full text-base font-normal text-gray-900 rounded-sm transition duration-75 group hover:bg-interactive dark:text-white dark:hover:bg-interactive-dark",
26
26
 
27
27
  # Label and content styles
28
- item_label: ->(depth) { "flex-1 #{(depth > 0) ? "ml-9" : "ml-3"} text-left whitespace-nowrap" },
28
+ item_label: ->(depth) { "pu-sidebar-menu-label flex-1 #{(depth > 0) ? "ml-9" : "ml-sm"} text-left whitespace-nowrap" },
29
29
 
30
30
  # Badge styles
31
- leading_badge: "inline-flex justify-center items-center w-5 h-5 text-xs font-semibold rounded-full text-primary-800 bg-primary-100 dark:bg-primary-200 dark:text-primary-800",
32
- trailing_badge: "inline-flex justify-center items-center px-2 ml-3 text-sm font-medium text-gray-800 bg-gray-200 rounded-full dark:bg-gray-700 dark:text-gray-300",
31
+ leading_badge: "pu-sidebar-menu-badge-leading inline-flex justify-center items-center w-5 h-5 text-xs font-semibold rounded-full text-primary-800 bg-primary-100 dark:bg-primary-200 dark:text-primary-800",
32
+ trailing_badge: "pu-sidebar-menu-badge-trailing inline-flex justify-center items-center px-sm ml-sm text-sm font-medium text-gray-800 bg-elevated rounded-full dark:bg-elevated-dark dark:text-gray-300",
33
33
 
34
34
  # Icon styles
35
- icon_wrapper: "shrink-0 w-6 h-6 flex items-center justify-center",
36
- icon: "text-gray-400 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white",
35
+ icon_wrapper: "pu-sidebar-menu-icon-wrapper shrink-0 w-6 h-6 flex items-center justify-center",
36
+ icon: "pu-sidebar-menu-icon text-gray-400 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white",
37
37
 
38
38
  # Collapse icon styles
39
- collapse_icon: "w-6 h-6 ml-auto transition-transform duration-200",
39
+ collapse_icon: "pu-sidebar-menu-collapse-icon w-6 h-6 ml-auto transition-transform duration-200",
40
40
  collapse_icon_expanded: "transform rotate-180",
41
41
 
42
42
  # Submenu styles
43
- sub_items_container: "hidden py-2 space-y-2",
43
+ sub_items_container: "pu-sidebar-menu-sub-items hidden py-sm space-y-sm",
44
44
 
45
45
  # Due to how we use turbo frames, we can't set active states
46
46
  active: nil
@@ -5,21 +5,21 @@ module Plutonium
5
5
  div(
6
6
  role: "status",
7
7
  class:
8
- "p-4 space-y-4 border border-gray-200 divide-y divide-gray-200 rounded shadow motion-safe:animate-pulse dark:divide-gray-700 md:p-6 dark:border-gray-700"
8
+ "p-md space-y-md border border-gray-200 divide-y divide-gray-200 rounded shadow motion-safe:animate-pulse dark:divide-gray-700 md:p-lg dark:border-gray-700"
9
9
  ) do
10
10
  div(class: "flex items-center justify-between") do
11
11
  div do
12
- div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5")
13
- div(class: "w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700")
12
+ div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-sm")
13
+ div(class: "w-32 h-2 bg-elevated rounded-full dark:bg-elevated-dark")
14
14
  end
15
- div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12")
15
+ div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-elevated-dark w-12")
16
16
  end
17
- div(class: "flex items-center justify-between pt-4") do
17
+ div(class: "flex items-center justify-between pt-md") do
18
18
  div do
19
- div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5")
20
- div(class: "w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700")
19
+ div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-sm")
20
+ div(class: "w-32 h-2 bg-elevated rounded-full dark:bg-elevated-dark")
21
21
  end
22
- div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12")
22
+ div(class: "h-2.5 bg-gray-300 rounded-full dark:bg-elevated-dark w-12")
23
23
  end
24
24
  span(class: "sr-only") { "Loading..." }
25
25
  end
@@ -20,19 +20,20 @@ module Plutonium
20
20
 
21
21
  def view_template
22
22
  div(
23
+ class: theme_class(:tab, element: :list),
23
24
  data_controller: "resource-tab-list",
24
25
  data_resource_tab_list_active_classes_value: "focus:outline-none text-primary-600 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-500 border-primary-600 dark:border-primary-500",
25
26
  data_resource_tab_list_in_active_classes_value: "dark:border-transparent text-gray-500 hover:text-gray-600 dark:text-gray-400 border-gray-100 hover:border-gray-300 dark:border-gray-700 dark:hover:text-gray-300"
26
27
  ) do
27
- div(class: "mb-4 border-b border-gray-200 dark:border-gray-700") do
28
+ div(class: "mb-md border-b border-gray-200 dark:border-gray-700") do
28
29
  ul(
29
- class: "flex flex-wrap -mb-px text-sm font-medium text-center space-x-2",
30
+ class: "flex flex-wrap -mb-px text-sm font-medium text-center space-x-sm",
30
31
  role: "tablist"
31
32
  ) do
32
33
  @tabs.each do |tab|
33
34
  li(role: "presentation") do
34
35
  button(
35
- class: "inline-block p-4 border-b-2 rounded-t-lg",
36
+ class: tokens(theme_class(:tab, element: :button), "inline-block p-md border-b-2 rounded-t-lg"),
36
37
  id: "#{tab[:identifier]}-tab",
37
38
  type: "button",
38
39
  role: "tab",
@@ -54,6 +55,7 @@ module Plutonium
54
55
  div do
55
56
  @tabs.each do |tab|
56
57
  div(
58
+ class: theme_class(:tab, element: :panel),
57
59
  hidden: true,
58
60
  id: "#{tab[:identifier]}-tabpanel",
59
61
  role: "tabpanel",
@@ -19,7 +19,7 @@ module Plutonium
19
19
 
20
20
  def render_thumbnail(attachment)
21
21
  div(
22
- class: "w-24 h-24 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 transition-all duration-300",
22
+ class: "w-24 h-24 bg-white border border-gray-200 rounded-sm shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 transition-all duration-300",
23
23
  data: {
24
24
  controller: "attachment-preview",
25
25
  attachment_preview_mime_type_value: attachment.content_type,
@@ -30,7 +30,7 @@ module Plutonium
30
30
  ) do
31
31
  a(
32
32
  href: attachment.url,
33
- class: "block aspect-square overflow-hidden rounded-lg",
33
+ class: "block aspect-square overflow-hidden rounded-sm",
34
34
  target: :blank,
35
35
  data: {
36
36
  attachment_preview_target: "thumbnailLink"
@@ -35,11 +35,11 @@ module Plutonium
35
35
 
36
36
  def per_page_selector
37
37
  div(
38
- class: "flex items-center space-x-2 mt-2 md:mt-0",
38
+ class: "flex items-center space-x-sm mt-sm md:mt-0",
39
39
  data_controller: "select-navigator"
40
40
  ) do
41
41
  id = "perPage#{SecureRandom.hex}"
42
- label(for: id, class: "mr-2") { "Per page" }
42
+ label(for: id, class: "mr-sm") { "Per page" }
43
43
  select(
44
44
  id: id, name: "items", class: select_classes,
45
45
  data_action: "change->select-navigator#navigate",
@@ -53,7 +53,7 @@ module Plutonium
53
53
  end
54
54
 
55
55
  def select_classes
56
- "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 min-w-[5em]"
56
+ "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-sm focus:ring-blue-500 focus:border-blue-500 block p-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 min-w-[5em]"
57
57
  end
58
58
 
59
59
  def page_url(limit)
@@ -12,7 +12,7 @@ module Plutonium
12
12
  end
13
13
 
14
14
  def view_template
15
- nav(aria_label: "Page navigation", class: "flex justify-center mt-4") do
15
+ nav(aria_label: "Page navigation", class: "flex justify-center mt-md") do
16
16
  ul(class: "inline-flex -space-x-px text-sm") do
17
17
  prev_link
18
18
  page_links
@@ -79,14 +79,14 @@ module Plutonium
79
79
  end
80
80
 
81
81
  def link_classes(first = false, last = false)
82
- classes = ["flex", "items-center", "justify-center", "px-3", "h-8", "leading-tight", "text-gray-500", "bg-white", "border", "border-gray-300", "hover:bg-gray-100", "hover:text-gray-700", "dark:bg-gray-800", "dark:border-gray-700", "dark:text-gray-400", "dark:hover:bg-gray-700", "dark:hover:text-white"]
82
+ classes = ["flex", "items-center", "justify-center", "px-sm", "h-8", "leading-tight", "text-gray-500", "bg-white", "border", "border-gray-300", "hover:bg-gray-100", "hover:text-gray-700", "dark:bg-gray-800", "dark:border-gray-700", "dark:text-gray-400", "dark:hover:bg-gray-700", "dark:hover:text-white"]
83
83
  classes << "rounded-s-lg" if first
84
84
  classes << "rounded-e-lg" if last
85
85
  classes.join(" ")
86
86
  end
87
87
 
88
88
  def current_link_classes
89
- "flex items-center justify-center px-3 h-8 text-blue-600 border border-gray-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white cursor-not-allowed"
89
+ "flex items-center justify-center px-sm h-8 text-blue-600 border border-gray-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white cursor-not-allowed"
90
90
  end
91
91
 
92
92
  def disabled_link_classes(first = false, last = false)
@@ -10,24 +10,24 @@ module Plutonium
10
10
  def view_template
11
11
  div(
12
12
  class:
13
- # "flex flex-wrap justify-between items-center gap-4 p-4 bg-white border border-gray-200 rounded-lg dark:bg-gray-800 dark:border-gray-700 mb-4"
14
- "flex flex-wrap justify-between items-center gap-4 mb-4"
13
+ # "flex flex-wrap justify-between items-center gap-md p-md bg-white border border-gray-200 rounded-sm dark:bg-gray-800 dark:border-gray-700 mb-md"
14
+ "flex flex-wrap justify-between items-center gap-md mb-md"
15
15
  ) do
16
- div(class: "flex flex-wrap items-center gap-2") do
16
+ div(class: "flex flex-wrap items-center gap-sm") do
17
17
  name = "all"
18
18
  if current_scope.blank?
19
19
  a(
20
20
  id: "#{name}-scope",
21
21
  href: current_query_object.build_url(scope: nil),
22
22
  class:
23
- "px-4 py-2 text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-lg hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
23
+ "px-md py-sm text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-sm hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
24
24
  ) { name.humanize }
25
25
  else
26
26
  a(
27
27
  id: "#{name}-scope",
28
28
  href: current_query_object.build_url(scope: nil),
29
29
  class:
30
- "px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
30
+ "px-md py-sm text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-sm hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
31
31
  ) { name.humanize }
32
32
  end
33
33
 
@@ -37,26 +37,26 @@ module Plutonium
37
37
  id: "#{name}-scope",
38
38
  href: current_query_object.build_url(scope: name),
39
39
  class:
40
- "px-4 py-2 text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-lg hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
40
+ "px-md py-sm text-sm font-medium text-white bg-primary-700 border border-primary-700 rounded-sm hover:bg-primary-800 focus:z-10 focus:ring-2 focus:ring-primary-700 focus:text-white dark:bg-primary-600 dark:border-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
41
41
  ) { name.humanize }
42
42
  else
43
43
  a(
44
44
  id: "#{name}-scope",
45
45
  href: current_query_object.build_url(scope: name),
46
46
  class:
47
- "px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-lg hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
47
+ "px-md py-sm text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-sm hover:bg-gray-100 hover:text-gray-700 focus:z-10 focus:ring-2 focus:ring-gray-300 focus:text-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:focus:text-white"
48
48
  ) { name.humanize }
49
49
  end
50
50
  end
51
51
  end
52
52
 
53
- # div(class: "flex flex-wrap items-center gap-2") do
53
+ # div(class: "flex flex-wrap items-center gap-sm") do
54
54
  # button(
55
55
  # class:
56
- # "inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-red-700 rounded-lg hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800"
56
+ # "inline-flex items-center px-sm py-sm text-sm font-medium text-white bg-red-700 rounded-sm hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800"
57
57
  # ) do
58
58
  # svg(
59
- # class: "w-4 h-4 mr-2",
59
+ # class: "w-4 h-4 mr-sm",
60
60
  # fill: "none",
61
61
  # stroke: "currentColor",
62
62
  # viewbox: "0 0 24 24",
@@ -74,10 +74,10 @@ module Plutonium
74
74
  # end
75
75
  # button(
76
76
  # class:
77
- # "inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-yellow-700 rounded-lg hover:bg-yellow-800 focus:ring-4 focus:outline-none focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800"
77
+ # "inline-flex items-center px-sm py-sm text-sm font-medium text-white bg-yellow-700 rounded-sm hover:bg-yellow-800 focus:ring-4 focus:outline-none focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800"
78
78
  # ) do
79
79
  # svg(
80
- # class: "w-4 h-4 mr-2",
80
+ # class: "w-4 h-4 mr-sm",
81
81
  # fill: "none",
82
82
  # stroke: "currentColor",
83
83
  # viewbox: "0 0 24 24",
@@ -97,13 +97,13 @@ module Plutonium
97
97
  # id: "dropdownActionButton",
98
98
  # data_dropdown_toggle: "dropdownAction",
99
99
  # class:
100
- # "inline-flex items-center text-gray-500 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-3 py-2 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700",
100
+ # "inline-flex items-center text-gray-500 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-sm text-sm px-sm py-sm dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700",
101
101
  # type: "button"
102
102
  # ) do
103
103
  # span(class: "sr-only") { "Action button" }
104
104
  # plain " More Actions "
105
105
  # svg(
106
- # class: "w-2.5 h-2.5 ml-2.5",
106
+ # class: "w-2.5 h-2.5 ml-sm",
107
107
  # aria_hidden: "true",
108
108
  # xmlns: "http://www.w3.org/2000/svg",
109
109
  # fill: "none",
@@ -7,14 +7,14 @@ module Plutonium
7
7
  def self.theme
8
8
  super.merge({
9
9
  value_wrapper: "max-h-[150px] overflow-y-auto",
10
- prefixed_icon: "w-4 h-4 mr-1",
10
+ prefixed_icon: "w-4 h-4 mr-xs",
11
11
  link: "text-primary-600 dark:text-primary-500",
12
12
  color: "flex items-center",
13
- color_indicator: "w-10 h-10 rounded-full mr-2",
13
+ color_indicator: "w-10 h-10 rounded-full mr-sm",
14
14
  email: "flex items-center text-primary-600 dark:text-primary-500 whitespace-nowrap",
15
15
  phone: "flex items-center text-primary-600 dark:text-primary-500 whitespace-nowrap",
16
16
  json: " whitespace-pre font-mono shadow-inner p-4",
17
- attachment_value_wrapper: "flex flex-wrap gap-1"
17
+ attachment_value_wrapper: "flex flex-wrap gap-xs"
18
18
  })
19
19
  end
20
20
  end
@@ -91,7 +91,7 @@ module Plutonium
91
91
  record = wrapped_object.unwrapped
92
92
  policy = policy_for(record:)
93
93
 
94
- div(class: "flex space-x-2") do
94
+ div(class: "flex space-x-sm") do
95
95
  resource_definition.defined_actions
96
96
  .select { |k, a| a.collection_record_action? && policy.allowed_to?(:"#{k}?") }
97
97
  .values
@@ -105,7 +105,7 @@ module Plutonium
105
105
  end
106
106
 
107
107
  def render_footer
108
- div(class: "lg:sticky lg:dyna:static bottom-[-2px] mt-1 p-4 pb-6 w-full z-30 bg-gray-50 dark:bg-gray-900") {
108
+ div(class: tokens(theme_class(:table, element: :footer), "lg:sticky lg:dyna:static bottom-[-2px] mt-xs p-md pb-lg w-full z-30 bg-page dark:bg-page-dark")) {
109
109
  TableInfo(pagy_instance)
110
110
  TablePagination(pagy_instance)
111
111
  }
@@ -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.28.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 {