plutonium 0.22.0 → 0.23.1

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.
@@ -1,5 +1 @@
1
- <%= render_component :breadcrumbs, resource_class:, parent: current_parent, resource: resource_record! %>
2
-
3
- <%= render_component :dyna_frame_content do %>
4
- <%= render "interactive_action_form", interactive_action: current_interactive_action %>
5
- <% end %>
1
+ <%= render current_definition.interactive_action_page_class.new %>
@@ -140,10 +140,9 @@
140
140
  end %>
141
141
  </div>
142
142
  <% end %>
143
+ <%= render "password_visibility" %>
143
144
  <% end %>
144
145
 
145
- <%= render "password_visibility" %>
146
-
147
146
  <%= form.submit rodauth.create_account_button,
148
147
  class:
149
148
  "w-full text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800" %>
@@ -0,0 +1,8 @@
1
+ # Alias json to jsonb in SQLite migrations
2
+ ActiveSupport.on_load(:active_record) do
3
+ ActiveRecord::ConnectionAdapters::SQLite3::TableDefinition.class_eval do
4
+ def jsonb(*args, **options)
5
+ json(*args, **options)
6
+ end
7
+ end
8
+ end
@@ -10,7 +10,7 @@ module ActiveModel
10
10
  #
11
11
  class AttachedValidator < EachValidator
12
12
  def validate_each(record, attribute, value)
13
- record.errors.add(attribute, (options[:message] || "must be attached")) unless value.attached?
13
+ record.errors.add(attribute, options[:message] || "must be attached") unless value.attached?
14
14
  end
15
15
  end
16
16
  end
@@ -43,7 +43,7 @@ module ActiveModel
43
43
  return true unless options[:image].present?
44
44
  return true unless FastImage.type(value).nil?
45
45
 
46
- record.errors.add(attribute, (options[:message] || "is not a valid image URL"))
46
+ record.errors.add(attribute, options[:message] || "is not a valid image URL")
47
47
  false
48
48
  end
49
49
  end
@@ -14,7 +14,7 @@ module Plutonium
14
14
  def filtered_resource_collection
15
15
  query_params = current_definition
16
16
  .query_form.new(nil, query_object: current_query_object, page_size: nil)
17
- .extract_input(params)[:q]
17
+ .extract_input(params, view_context:)[:q]
18
18
 
19
19
  base_query = current_authorized_scope
20
20
  current_query_object.apply(base_query, query_params)
@@ -5,8 +5,10 @@ module Plutonium
5
5
  module Component
6
6
  module Behaviour
7
7
  extend ActiveSupport::Concern
8
+ include Phlexi::Field::Common::Tokens
8
9
  include Methods
9
10
  include Kit
11
+ include Tokens
10
12
 
11
13
  if Rails.env.development?
12
14
  def around_template(&)
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Plutonium
4
+ module UI
5
+ module Component
6
+ module Tokens
7
+ def classes(*tokens, **conditional_tokens)
8
+ tokens = self.tokens(*tokens, **conditional_tokens)
9
+
10
+ if tokens.empty?
11
+ {}
12
+ else
13
+ {class: tokens}
14
+ end
15
+ end
16
+
17
+ def tokens(*tokens, **conditional_tokens)
18
+ conditional_tokens.each do |condition, token|
19
+ truthy = case condition
20
+ when Symbol then send(condition)
21
+ when Proc then condition.call
22
+ else raise ArgumentError, "The class condition must be a Symbol or a Proc."
23
+ end
24
+
25
+ if truthy
26
+ case token
27
+ when Hash then __append_token__(tokens, token[:then])
28
+ else __append_token__(tokens, token)
29
+ end
30
+ else
31
+ case token
32
+ when Hash then __append_token__(tokens, token[:else])
33
+ end
34
+ end
35
+ end
36
+
37
+ tokens = tokens.select(&:itself).join(" ")
38
+ tokens.strip!
39
+ tokens.gsub!(/\s+/, " ")
40
+ tokens
41
+ end
42
+
43
+ private
44
+
45
+ def __append_token__(tokens, token)
46
+ case token
47
+ when nil then nil
48
+ when String then tokens << token
49
+ when Symbol then tokens << token.name
50
+ when Array then tokens.concat(token)
51
+ else raise ArgumentError,
52
+ "Conditional classes must be Symbols, Strings, or Arrays of Symbols or Strings."
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -7,7 +7,7 @@ module Plutonium
7
7
  def view_template
8
8
  if current_turbo_frame.present?
9
9
  turbo_frame_tag(current_turbo_frame) do
10
- render "flash"
10
+ render partial("flash")
11
11
  yield
12
12
  end
13
13
  else
@@ -7,6 +7,7 @@ module Plutonium
7
7
  include Plutonium::UI::Component::Behaviour
8
8
 
9
9
  class Builder < Builder
10
+ include Phlexi::Field::Common::Tokens
10
11
  include Plutonium::UI::Form::Options::InferredTypes
11
12
 
12
13
  def easymde_tag(**, &)
@@ -21,7 +21,7 @@ module Plutonium
21
21
  valid_label: "text-green-700 dark:text-green-500",
22
22
  neutral_label: "text-gray-500 dark:text-gray-400",
23
23
  # input themes
24
- input: "w-full p-2 border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700",
24
+ input: "w-full p-2 border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 focus:ring-2",
25
25
  invalid_input: "bg-red-50 border-red-500 dark:border-red-500 text-red-900 dark:text-red-500 placeholder-red-700 dark:placeholder-red-500 focus:ring-red-500 focus:border-red-500",
26
26
  valid_input: "bg-green-50 border-green-500 dark:border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 focus:ring-green-500 focus:border-green-500",
27
27
  neutral_input: "border-gray-300 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white focus:ring-primary-500 focus:border-primary-500",
@@ -36,6 +36,7 @@ module Plutonium
36
36
  neutral_color: nil,
37
37
  # file
38
38
  # file: "w-full border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 focus:outline-none",
39
+ file: "w-full border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 border-gray-300 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white focus:ring-primary-500 focus:border-primary-500 focus:outline-none focus:ring-2 [&::file-selector-button]:mr-3 [&::file-selector-button]:px-4 [&::file-selector-button]:py-2 [&::file-selector-button]:bg-gray-50 [&::file-selector-button]:border-0 [&::file-selector-button]:rounded-l-md [&::file-selector-button]:text-sm [&::file-selector-button]:font-medium [&::file-selector-button]:text-gray-700 [&::file-selector-button]:hover:bg-gray-100 [&::file-selector-button]:cursor-pointer dark:[&::file-selector-button]:bg-gray-600 dark:[&::file-selector-button]:text-gray-200 dark:[&::file-selector-button]:hover:bg-gray-500",
39
40
  # hint themes
40
41
  hint: "mt-2 text-sm text-gray-500 dark:text-gray-200 whitespace-pre",
41
42
  # error themes
@@ -59,7 +59,7 @@ module Plutonium
59
59
  end
60
60
 
61
61
  def render_flash
62
- render "flash"
62
+ render partial("flash")
63
63
  end
64
64
 
65
65
  def render_before_content
@@ -17,8 +17,8 @@ module Plutonium
17
17
  def render_before_main
18
18
  super
19
19
 
20
- render("resource_header")
21
- render("resource_sidebar")
20
+ render partial("resource_header")
21
+ render partial("resource_sidebar")
22
22
  end
23
23
  end
24
24
  end
@@ -15,7 +15,7 @@ module Plutonium
15
15
  end
16
16
 
17
17
  def render_default_content
18
- render "resource_form"
18
+ render partial("resource_form")
19
19
  end
20
20
 
21
21
  def page_type = :edit_page
@@ -19,7 +19,7 @@ module Plutonium
19
19
  end
20
20
 
21
21
  def render_default_content
22
- render "resource_table"
22
+ render partial("resource_table")
23
23
  end
24
24
 
25
25
  def page_type = :index_page
@@ -15,7 +15,7 @@ module Plutonium
15
15
  end
16
16
 
17
17
  def render_default_content
18
- render "interactive_action_form"
18
+ render partial("interactive_action_form")
19
19
  end
20
20
 
21
21
  def page_type = :interactive_action_page
@@ -15,7 +15,7 @@ module Plutonium
15
15
  end
16
16
 
17
17
  def render_default_content
18
- render "resource_form"
18
+ render partial("resource_form")
19
19
  end
20
20
 
21
21
  def page_type = :new_page
@@ -19,7 +19,7 @@ module Plutonium
19
19
  end
20
20
 
21
21
  def render_default_content
22
- render "resource_details"
22
+ render partial("resource_details")
23
23
  end
24
24
 
25
25
  def page_type = :show_page
@@ -17,12 +17,8 @@ module Plutonium
17
17
  @content = content
18
18
  end
19
19
 
20
- def before_template
21
- vanish do
22
- @items.each do |item|
23
- render item
24
- end
25
- end
20
+ def before_template(&)
21
+ vanish(&)
26
22
  super
27
23
  end
28
24
 
@@ -1,5 +1,5 @@
1
1
  module Plutonium
2
- VERSION = "0.22.0"
2
+ VERSION = "0.23.1"
3
3
  NEXT_MAJOR_VERSION = VERSION.split(".").tap { |v|
4
4
  v[1] = v[1].to_i + 1
5
5
  v[2] = 0
data/src/css/core.css CHANGED
@@ -1,13 +1,16 @@
1
- @layer components {
2
- .pu-color-input::-webkit-color-swatch-wrapper {
3
- @apply p-0;
4
- }
1
+ /**
2
+ * Color Input Styles for Tailwind v4
3
+ * Converted from @layer components to work with v4
4
+ */
5
5
 
6
- .pu-color-input::-webkit-color-swatch {
7
- @apply border-none rounded-lg;
8
- }
6
+ .pu-color-input::-webkit-color-swatch-wrapper {
7
+ @apply p-0;
8
+ }
9
+
10
+ .pu-color-input::-webkit-color-swatch {
11
+ @apply border-none rounded-lg;
12
+ }
9
13
 
10
- .pu-color-input::-moz-color-swatch {
11
- @apply border-none rounded-lg;
12
- }
14
+ .pu-color-input::-moz-color-swatch {
15
+ @apply border-none rounded-lg;
13
16
  }