plutonium 0.8.0 → 0.9.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -0
  3. data/Rakefile +10 -0
  4. data/app/assets/build/plutonium.js +5122 -0
  5. data/app/assets/javascripts/controllers/index.js +34 -0
  6. data/app/assets/javascripts/controllers/resource_dismiss_controller.js +37 -0
  7. data/app/assets/javascripts/controllers/resource_drop_down_controller.js +29 -0
  8. data/app/assets/javascripts/plutonium-app.js +7 -0
  9. data/app/assets/javascripts/plutonium.js +1 -0
  10. data/app/assets/{js → javascripts}/turbo/index.js +1 -1
  11. data/app/views/application/_flash.html.erb +1 -1
  12. data/app/views/application/_flash_alerts.html.erb +51 -7
  13. data/app/views/application/_flash_toasts.html.erb +53 -23
  14. data/app/views/application/_resource_header.html.erb +563 -561
  15. data/app/views/components/form/form_builder.rb +2 -2
  16. data/app/views/components/form/form_component.html.erb +5 -6
  17. data/app/views/components/interactive_action_form/interactive_action_form_component.html.erb +1 -1
  18. data/app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.html.erb +66 -0
  19. data/app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.rb +23 -0
  20. data/app/views/components/nested_resource_form_fields/nested_resource_form_fields_controller.js +64 -0
  21. data/app/views/components/sidebar/sidebar_component.html.erb +61 -63
  22. data/app/views/components/table_search_input/table_search_input_component.html.erb +1 -1
  23. data/app/views/layouts/resource.html copy.erb +0 -2
  24. data/app/views/layouts/resource.html.erb +1 -3
  25. data/app/views/layouts/rodauth.html.erb +0 -1
  26. data/app/views/resource/_interactive_resource_action_form.html.erb +1 -1
  27. data/css.manifest +3 -0
  28. data/esbuild.config.js +44 -0
  29. data/exe/pug +6 -0
  30. data/lib/generators/pu/gen/component/component_generator.rb +14 -5
  31. data/lib/generators/pu/gen/pug/pug_generator.rb +1 -1
  32. data/lib/generators/pu/lib/plutonium_generators/cli.rb +42 -0
  33. data/lib/generators/pu/lib/plutonium_generators/concerns/actions.rb +86 -72
  34. data/lib/generators/pu/lib/plutonium_generators/generator.rb +1 -5
  35. data/lib/generators/pu/lib/plutonium_generators.rb +8 -0
  36. data/lib/generators/pu/rodauth/install_generator.rb +1 -2
  37. data/lib/plutonium/core/actions/collection.rb +1 -1
  38. data/lib/plutonium/core/controllers/authorizable.rb +4 -4
  39. data/lib/plutonium/core/fields/inputs/base.rb +1 -1
  40. data/lib/plutonium/core/fields/inputs/nested_input.rb +57 -0
  41. data/lib/plutonium/core/fields/inputs/noop_input.rb +1 -1
  42. data/lib/plutonium/core/fields/inputs/phone_input.rb +1 -1
  43. data/lib/plutonium/core/fields/inputs/polymorphic_belongs_to_association_input.rb +1 -1
  44. data/lib/plutonium/core/fields/inputs/simple_form_association_input.rb +1 -1
  45. data/lib/plutonium/core/fields/inputs/simple_form_input.rb +1 -1
  46. data/lib/plutonium/pkg/base.rb +0 -4
  47. data/lib/plutonium/railtie.rb +10 -2
  48. data/lib/plutonium/resource/policy.rb +6 -0
  49. data/lib/plutonium/resource/presenter.rb +35 -0
  50. data/lib/plutonium/resource/record.rb +40 -7
  51. data/lib/plutonium/version.rb +1 -1
  52. data/lib/plutonium.rb +17 -14
  53. data/package.json +4 -3
  54. data/postcss.config.js +1 -1
  55. data/public/plutonium-assets/plutonium-app-36KN5FVJ.js +6 -0
  56. data/public/plutonium-assets/plutonium-app-36KN5FVJ.js.map +7 -0
  57. data/public/plutonium-assets/plutonium.50232e35b5495f5ad90d.css +3415 -0
  58. data/tailwind.config.js +11 -12
  59. data/templates/base.rb +8 -0
  60. metadata +28 -21
  61. data/app/assets/js/controllers/application.js +0 -6
  62. data/app/assets/js/controllers/dropdown_controller.js +0 -12
  63. data/app/assets/js/controllers/index.js +0 -21
  64. data/app/assets/js/plutonium.js +0 -2
  65. data/build.js +0 -12
  66. data/lib/generators/pu/gem/pagy/pagy_generator.rb +0 -25
  67. data/lib/generators/pu/gem/pagy/templates/config/initializers/pagy.rb +0 -4
  68. data/lib/generators/pu/gem/rabl/rabl_generator.rb +0 -25
  69. data/lib/generators/pu/gem/rabl/templates/.keep +0 -0
  70. data/lib/generators/pu/gem/rabl/templates/config/initializers/rabl.rb +0 -60
  71. data/lib/generators/pu/gem/simple_form/simple_form_generator.rb +0 -25
  72. data/lib/generators/pu/gem/simple_form/templates/.keep +0 -0
  73. /data/{lib/generators/pu/gem/pagy/templates → app/assets/build}/.keep +0 -0
  74. /data/app/assets/{js → javascripts}/turbo/turbo_actions.js +0 -0
  75. /data/app/assets/{js → javascripts}/turbo/turbo_debug.js +0 -0
  76. /data/app/assets/{js → javascripts}/turbo/turbo_frame_monkey_patch.js +0 -0
  77. /data/app/assets/{css → stylesheets}/plutonium.css +0 -0
data/tailwind.config.js CHANGED
@@ -1,17 +1,16 @@
1
- /** @type {import('tailwindcss').Config} */
2
1
 
3
- const colors = require('tailwindcss/colors');
2
+ /** @type {import('tailwindcss').Config} */
4
3
 
5
4
  let safelist = [];
6
- Object.keys(colors).forEach((color) => {
7
- if (typeof colors[color] === 'object') {
8
- Object.keys(colors[color]).forEach((shade) => {
9
- safelist.push(`bg-${color}-${shade}`);
10
- safelist.push(`text-${color}-${shade}`);
11
- // Add other utilities as needed
12
- });
13
- }
14
- });
5
+ // Object.keys(colors).forEach((color) => {
6
+ // if (typeof colors[color] === 'object') {
7
+ // Object.keys(colors[color]).forEach((shade) => {
8
+ // safelist.push(`bg-${color}-${shade}`);
9
+ // safelist.push(`text-${color}-${shade}`);
10
+ // // Add other utilities as needed
11
+ // });
12
+ // }
13
+ // });
15
14
 
16
15
  module.exports = {
17
16
  content: [
@@ -22,7 +21,7 @@ module.exports = {
22
21
  `${__dirname}/config/initializers/simple_form.rb`,
23
22
  // TODO: temporary workaround for buttons flex basis hack.
24
23
  // To be removed after moving buttons_helper to components.
25
- `${__dirname}/lib/plutonium/**/*.{rb,erb}`
24
+ // `${__dirname}/lib/plutonium/**/*.{rb,erb}`
26
25
  ],
27
26
  darkMode: "selector",
28
27
  plugins: [
data/templates/base.rb ADDED
@@ -0,0 +1,8 @@
1
+ gem "plutonium"
2
+
3
+ after_bundle do
4
+ generate "pu:core:install"
5
+
6
+ git add: "."
7
+ git commit: %( -m 'install plutonium' )
8
+ end
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.8.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-02 00:00:00.000000000 Z
11
+ date: 2024-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -203,7 +203,8 @@ description: Plutonium extends Rails' capabilities with a powerful, generator-dr
203
203
  you build applications with Rails, optimizing for rapid application development.
204
204
  email:
205
205
  - sfroelich01@gmail.com
206
- executables: []
206
+ executables:
207
+ - pug
207
208
  extensions: []
208
209
  extra_rdoc_files: []
209
210
  files:
@@ -219,7 +220,8 @@ files:
219
220
  - README copy.md
220
221
  - README.md
221
222
  - Rakefile
222
- - app/assets/css/plutonium.css
223
+ - app/assets/build/.keep
224
+ - app/assets/build/plutonium.js
223
225
  - app/assets/icons/flags/ghana.svg
224
226
  - app/assets/icons/outline/address-book.svg
225
227
  - app/assets/icons/outline/adjustments-horizontal.svg
@@ -707,14 +709,16 @@ files:
707
709
  - app/assets/icons/solid/youtube.svg
708
710
  - app/assets/icons/solid/zoom-in.svg
709
711
  - app/assets/icons/solid/zoom-out.svg
710
- - app/assets/js/controllers/application.js
711
- - app/assets/js/controllers/dropdown_controller.js
712
- - app/assets/js/controllers/index.js
713
- - app/assets/js/plutonium.js
714
- - app/assets/js/turbo/index.js
715
- - app/assets/js/turbo/turbo_actions.js
716
- - app/assets/js/turbo/turbo_debug.js
717
- - app/assets/js/turbo/turbo_frame_monkey_patch.js
712
+ - app/assets/javascripts/controllers/index.js
713
+ - app/assets/javascripts/controllers/resource_dismiss_controller.js
714
+ - app/assets/javascripts/controllers/resource_drop_down_controller.js
715
+ - app/assets/javascripts/plutonium-app.js
716
+ - app/assets/javascripts/plutonium.js
717
+ - app/assets/javascripts/turbo/index.js
718
+ - app/assets/javascripts/turbo/turbo_actions.js
719
+ - app/assets/javascripts/turbo/turbo_debug.js
720
+ - app/assets/javascripts/turbo/turbo_frame_monkey_patch.js
721
+ - app/assets/stylesheets/plutonium.css
718
722
  - app/views/application/_color_modes.html.erb
719
723
  - app/views/application/_flash.html.erb
720
724
  - app/views/application/_flash_alerts.html.erb
@@ -745,6 +749,9 @@ files:
745
749
  - app/views/components/interactive_action_form/interactive_action_form_component.html.erb
746
750
  - app/views/components/interactive_action_form/interactive_action_form_component.rb
747
751
  - app/views/components/interactive_action_form/interactive_action_form_controller.js
752
+ - app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.html.erb
753
+ - app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.rb
754
+ - app/views/components/nested_resource_form_fields/nested_resource_form_fields_controller.js
748
755
  - app/views/components/pagination/pagination_component.html.erb
749
756
  - app/views/components/pagination/pagination_component.rb
750
757
  - app/views/components/panel/panel_component.html.erb
@@ -833,11 +840,13 @@ files:
833
840
  - app/views/rodauth/webauthn_remove.html.erb
834
841
  - app/views/rodauth/webauthn_setup.html.erb
835
842
  - brakeman.ignore
836
- - build.js
837
843
  - config/initializers/hotwire_turbo_monkey_patches.rb
838
844
  - config/initializers/pagy.rb
839
845
  - config/initializers/rabl.rb
840
846
  - config/initializers/simple_form.rb
847
+ - css.manifest
848
+ - esbuild.config.js
849
+ - exe/pug
841
850
  - lib/active_model/validations/array_validator.rb
842
851
  - lib/active_model/validations/attached_validator.rb
843
852
  - lib/active_model/validations/url_validator.rb
@@ -851,14 +860,6 @@ files:
851
860
  - lib/generators/pu/core/install/templates/app/query_objects/resource_query_object.rb.tt
852
861
  - lib/generators/pu/core/install/templates/config/initializers/plutonium.rb
853
862
  - lib/generators/pu/core/install/templates/config/packages.rb
854
- - lib/generators/pu/gem/pagy/pagy_generator.rb
855
- - lib/generators/pu/gem/pagy/templates/.keep
856
- - lib/generators/pu/gem/pagy/templates/config/initializers/pagy.rb
857
- - lib/generators/pu/gem/rabl/rabl_generator.rb
858
- - lib/generators/pu/gem/rabl/templates/.keep
859
- - lib/generators/pu/gem/rabl/templates/config/initializers/rabl.rb
860
- - lib/generators/pu/gem/simple_form/simple_form_generator.rb
861
- - lib/generators/pu/gem/simple_form/templates/.keep
862
863
  - lib/generators/pu/gen/component/component_generator.rb
863
864
  - lib/generators/pu/gen/component/templates/component.html.erb.tt
864
865
  - lib/generators/pu/gen/component/templates/component.rb.tt
@@ -866,6 +867,7 @@ files:
866
867
  - lib/generators/pu/gen/pug/pug_generator.rb
867
868
  - lib/generators/pu/gen/pug/templates/pug.rb.tt
868
869
  - lib/generators/pu/lib/plutonium_generators.rb
870
+ - lib/generators/pu/lib/plutonium_generators/cli.rb
869
871
  - lib/generators/pu/lib/plutonium_generators/concerns/actions.rb
870
872
  - lib/generators/pu/lib/plutonium_generators/concerns/config.rb
871
873
  - lib/generators/pu/lib/plutonium_generators/concerns/logger.rb
@@ -1012,6 +1014,7 @@ files:
1012
1014
  - lib/plutonium/core/fields/inputs/date_time_input.rb
1013
1015
  - lib/plutonium/core/fields/inputs/factory.rb
1014
1016
  - lib/plutonium/core/fields/inputs/has_many_association_input.rb
1017
+ - lib/plutonium/core/fields/inputs/nested_input.rb
1015
1018
  - lib/plutonium/core/fields/inputs/noop_input.rb
1016
1019
  - lib/plutonium/core/fields/inputs/phone_input.rb
1017
1020
  - lib/plutonium/core/fields/inputs/polymorphic_belongs_to_association_input.rb
@@ -1069,8 +1072,12 @@ files:
1069
1072
  - public/plutonium-assets/fonts/bootstrap-icons.woff
1070
1073
  - public/plutonium-assets/fonts/bootstrap-icons.woff2
1071
1074
  - public/plutonium-assets/logo.png
1075
+ - public/plutonium-assets/plutonium-app-36KN5FVJ.js
1076
+ - public/plutonium-assets/plutonium-app-36KN5FVJ.js.map
1077
+ - public/plutonium-assets/plutonium.50232e35b5495f5ad90d.css
1072
1078
  - sig/plutonium.rbs
1073
1079
  - tailwind.config.js
1080
+ - templates/base.rb
1074
1081
  homepage: https://github.com/radioactive-labs/plutonium-core
1075
1082
  licenses:
1076
1083
  - MIT
@@ -1,6 +0,0 @@
1
- import { Application } from "@hotwired/stimulus"
2
-
3
- const application = Application.start()
4
- window.Stimulus = application
5
-
6
- export { application }
@@ -1,12 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- // Connects to data-controller="dropdown"
4
- export default class extends Controller {
5
- connect() {
6
- console.log(`form connected: ${this.element}`)
7
- }
8
-
9
- submit() {
10
- this.element.requestSubmit()
11
- }
12
- }
@@ -1,21 +0,0 @@
1
- import { application } from "./application"
2
-
3
- // Register controllers here
4
-
5
- import TabBarController from "../../../../app/views/components/tab_bar/tab_bar_controller.js"
6
- application.register("tab-bar", TabBarController)
7
-
8
- import ToolbarController from "../../../../app/views/components/toolbar/toolbar_controller.js"
9
- application.register("toolbar", ToolbarController)
10
-
11
- import TableSearchInputController from "../../../../app/views/components/table_search_input/table_search_input_controller.js"
12
- application.register("table-search-input", TableSearchInputController)
13
-
14
- import TableToolbarController from "../../../../app/views/components/table_toolbar/table_toolbar_controller.js"
15
- application.register("table-toolbar", TableToolbarController)
16
-
17
- import TableController from "../../../../app/views/components/table/table_controller.js"
18
- application.register("table", TableController)
19
-
20
- import FormController from "../../../../app/views/components/form/form_controller.js"
21
- application.register("form", FormController)
@@ -1,2 +0,0 @@
1
- import "./controllers"
2
- import "./turbo"
data/build.js DELETED
@@ -1,12 +0,0 @@
1
- const esbuild = require('esbuild');
2
- const manifestPlugin = require('esbuild-plugin-manifest')
3
-
4
- esbuild.context({
5
- entryPoints: ["app/assets/js/plutonium.js"],
6
- bundle: true,
7
- outdir: "public/plutonium-assets/build/",
8
- plugins: [manifestPlugin({
9
- filename: `${__dirname}/js.manifest`,
10
- shortNames: true,
11
- })],
12
- }).then((context) => context.watch().catch((e) => console.error(e.message)))
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../lib/plutonium_generators"
4
-
5
- module Pu
6
- module Gem
7
- class PagyGenerator < Rails::Generators::Base
8
- include PlutoniumGenerators::Generator
9
-
10
- source_root File.expand_path("templates", __dir__)
11
-
12
- desc "Install Pagy"
13
-
14
- def start
15
- Bundler.with_unbundled_env do
16
- run "bundle add pagy"
17
- end
18
-
19
- directory "config"
20
- rescue => e
21
- exception "#{self.class} failed:", e
22
- end
23
- end
24
- end
25
- end
@@ -1,4 +0,0 @@
1
- require "pagy/extras/bootstrap"
2
- require "pagy/extras/overflow"
3
- require "pagy/extras/trim"
4
- require "pagy/extras/headers"
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../lib/plutonium_generators"
4
-
5
- module Pu
6
- module Gem
7
- class RablGenerator < Rails::Generators::Base
8
- include PlutoniumGenerators::Generator
9
-
10
- source_root File.expand_path("templates", __dir__)
11
-
12
- desc "Install Rabl"
13
-
14
- def start
15
- Bundler.with_unbundled_env do
16
- run "bundle add rabl"
17
- end
18
-
19
- directory "config"
20
- rescue => e
21
- exception "#{self.class} failed:", e
22
- end
23
- end
24
- end
25
- end
File without changes
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # https://github.com/nesquena/rabl#configuration
4
-
5
- Rabl.configure do |config|
6
- config.cache_sources = !Rails.env.development? # Defaults to false
7
- config.raise_on_missing_attribute = !Rails.env.production? # Defaults to false
8
-
9
- # config.cache_all_output = false
10
- # config.cache_engine = Rabl::CacheEngine.new # Defaults to Rails cache
11
- # config.perform_caching = false
12
- # config.escape_all_output = false
13
- # config.json_engine = nil # Class with #dump class method (defaults JSON)
14
- # config.msgpack_engine = nil # Defaults to ::MessagePack
15
- # config.bson_engine = nil # Defaults to ::BSON
16
- # config.plist_engine = nil # Defaults to ::Plist::Emit
17
- # config.include_json_root = true
18
- # config.include_msgpack_root = true
19
- # config.include_bson_root = true
20
- # config.include_plist_root = true
21
- # config.include_xml_root = false
22
- # config.include_child_root = true
23
- # config.enable_json_callbacks = false
24
- # config.xml_options = { :dasherize => true, :skip_types => false }
25
- # config.view_paths = []
26
- # config.replace_nil_values_with_empty_strings = true # Defaults to false
27
- # config.replace_empty_string_values_with_nil_values = true # Defaults to false
28
- # config.exclude_nil_values = true # Defaults to false
29
- # config.exclude_empty_values_in_collections = true # Defaults to false
30
- # config.camelize_keys = :upper # Defaults to false
31
- end
32
-
33
- # Monkey Patch Rabl source lookup to make it compatible with Rails view lookup
34
- module Rabl
35
- module Sources
36
- private
37
-
38
- # Returns the rabl template path for Rails
39
- def fetch_rails_source(file, _options = {})
40
- # use Rails template resolution mechanism if possible (find_template)
41
- source_format = request_format if defined?(request_format)
42
-
43
- lookup_proc = lambda do |partial|
44
- context_scope.lookup_context.find(file, context_scope.lookup_context.prefixes, partial, [],
45
- {formats: [source_format]})
46
- end
47
- template = begin
48
- lookup_proc.call(false)
49
- rescue
50
- nil
51
- end
52
- template ||= begin
53
- lookup_proc.call(true)
54
- rescue
55
- nil
56
- end
57
- template&.identifier
58
- end
59
- end
60
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../lib/plutonium_generators"
4
-
5
- module Pu
6
- module Gem
7
- class SimpleFormGenerator < Rails::Generators::Base
8
- include PlutoniumGenerators::Generator
9
-
10
- source_root File.expand_path("templates", __dir__)
11
-
12
- desc "Install SimpleForm"
13
-
14
- def start
15
- Bundler.with_unbundled_env do
16
- run "bundle add simple_form"
17
- end
18
-
19
- directory "config"
20
- rescue => e
21
- exception "#{self.class} failed:", e
22
- end
23
- end
24
- end
25
- end
File without changes
File without changes