plutonium 0.10.3 → 0.11.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 (185) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -2
  3. data/app/assets/application.js.bk +31419 -0
  4. data/app/assets/plutonium-original.png +0 -0
  5. data/app/assets/plutonium-white.png +0 -0
  6. data/app/assets/plutonium.css +1 -0
  7. data/app/assets/plutonium.ico +0 -0
  8. data/app/assets/plutonium.js +12416 -0
  9. data/app/assets/plutonium.js.map +7 -0
  10. data/app/assets/plutonium.min.js +39 -0
  11. data/app/assets/plutonium.min.js.map +7 -0
  12. data/app/assets/plutonium.png +0 -0
  13. data/app/views/application/_flash_alerts.html.erb +2 -2
  14. data/app/views/application/_resource_header.html.erb +261 -697
  15. data/app/views/application/_resource_sidebar.html.erb +14 -12
  16. data/app/views/components/action_button/action_button_component.rb +3 -3
  17. data/app/views/components/attributes.rb +184 -0
  18. data/app/views/components/base.rb +19 -40
  19. data/app/views/components/block/block_component.html.erb +1 -1
  20. data/app/views/components/block/block_component.rb +11 -7
  21. data/app/views/components/breadcrumbs/breadcrumbs_component.rb +3 -3
  22. data/app/views/components/button/button_component.html.erb +2 -2
  23. data/app/views/components/button/button_component.rb +10 -5
  24. data/app/views/components/dyna_frame_content/dyna_frame_content_component.html.erb +1 -0
  25. data/app/views/components/dyna_frame_content/dyna_frame_content_component.rb +3 -3
  26. data/app/views/components/dyna_frame_host/dyna_frame_host_component.html.erb +1 -2
  27. data/app/views/components/dyna_frame_host/dyna_frame_host_component.rb +12 -5
  28. data/app/views/components/empty_card/empty_card_component.rb +3 -3
  29. data/app/views/components/form/form_builder.rb +1 -1
  30. data/app/views/components/form/form_component.rb +3 -3
  31. data/app/views/components/has_many_panel/has_many_panel_component.html.erb +25 -0
  32. data/app/views/components/has_many_panel/has_many_panel_component.rb +16 -0
  33. data/app/views/components/header/header_component.rb +3 -3
  34. data/app/views/components/interactive_action_form/interactive_action_form_component.rb +3 -3
  35. data/app/views/components/nav_grid_menu/nav_grid_menu_component.html.erb +24 -0
  36. data/app/views/components/nav_grid_menu/nav_grid_menu_component.rb +23 -0
  37. data/app/views/components/nav_grid_menu_item/nav_grid_menu_item_component.html.erb +4 -0
  38. data/app/views/components/nav_grid_menu_item/nav_grid_menu_item_component.rb +20 -0
  39. data/app/views/components/nav_user/nav_user_component.html.erb +50 -0
  40. data/app/views/components/nav_user/nav_user_component.rb +32 -0
  41. data/app/views/components/nav_user_link/nav_user_link_component.html.erb +7 -0
  42. data/app/views/components/nav_user_link/nav_user_link_component.rb +23 -0
  43. data/app/views/components/nav_user_section/nav_user_section_component.html.erb +7 -0
  44. data/app/views/components/nav_user_section/nav_user_section_component.rb +18 -0
  45. data/app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.html.erb +1 -3
  46. data/app/views/components/nested_resource_form_fields/nested_resource_form_fields_component.rb +11 -5
  47. data/app/views/components/pagination/pagination_component.html.erb +1 -1
  48. data/app/views/components/pagination/pagination_component.rb +10 -7
  49. data/app/views/components/panel/panel_component.html.erb +13 -6
  50. data/app/views/components/panel/panel_component.rb +11 -5
  51. data/app/views/components/resource_header/resource_header_component.html.erb +83 -0
  52. data/app/views/components/resource_header/resource_header_component.rb +30 -0
  53. data/app/views/components/resource_layout/resource_layout_component.html.erb +49 -0
  54. data/app/views/components/resource_layout/resource_layout_component.rb +41 -0
  55. data/app/views/components/sidebar/sidebar_component.html.erb +3 -33
  56. data/app/views/components/sidebar/sidebar_component.rb +3 -3
  57. data/app/views/components/sidebar_menu/sidebar_menu_component.html.erb +4 -2
  58. data/app/views/components/sidebar_menu/sidebar_menu_component.rb +10 -6
  59. data/app/views/components/sidebar_menu_item/sidebar_menu_item_component.html.erb +63 -71
  60. data/app/views/components/sidebar_menu_item/sidebar_menu_item_component.rb +27 -8
  61. data/app/views/components/skeleton/table/table_component.html.erb +1 -1
  62. data/app/views/components/skeleton/table/table_component.rb +3 -3
  63. data/app/views/components/table/table_component.html.erb +40 -89
  64. data/app/views/components/table/table_component.rb +124 -28
  65. data/app/views/components/table_search_input/table_search_input_component.html.erb +1 -1
  66. data/app/views/components/table_search_input/table_search_input_component.rb +11 -6
  67. data/app/views/components/table_toolbar/table_toolbar_component.html.erb +1 -1
  68. data/app/views/components/table_toolbar/table_toolbar_component.rb +11 -3
  69. data/app/views/components/toolbar/toolbar_component.html.erb +2 -2
  70. data/app/views/components/toolbar/toolbar_component.rb +16 -8
  71. data/app/views/layouts/resource.html.erb +12 -45
  72. data/app/views/layouts/rodauth.html.erb +20 -36
  73. data/app/views/resource/_interactive_resource_action_form.html.erb +1 -1
  74. data/app/views/resource/_resource_details.html.erb +8 -5
  75. data/app/views/resource/_resource_table.html.erb +70 -1
  76. data/app/views/resource/interactive_resource_collection_action.html.erb +1 -0
  77. data/app/views/resource/interactive_resource_record_action.html.erb +1 -0
  78. data/app/views/resource/interactive_resource_recordless_action.html.erb +1 -0
  79. data/app/views/resource/new.html.erb +1 -0
  80. data/config/initializers/simple_form.rb +22 -2
  81. data/esbuild.config.js +35 -31
  82. data/lib/generators/pu/core/assets/assets_generator.rb +44 -0
  83. data/lib/generators/pu/core/assets/templates/tailwind.config.js +18 -0
  84. data/lib/generators/pu/core/install/install_generator.rb +4 -1
  85. data/lib/generators/pu/gem/dotenv/templates/config/initializers/001_ensure_required_env.rb +6 -0
  86. data/lib/generators/pu/gen/component/component_generator.rb +13 -10
  87. data/lib/generators/pu/gen/component/templates/component.html.erb.tt +1 -1
  88. data/lib/generators/pu/gen/component/templates/component.rb.tt +10 -4
  89. data/lib/generators/pu/pkg/app/app_generator.rb +4 -4
  90. data/lib/generators/pu/pkg/app/templates/app/controllers/concerns/controller.rb.tt +28 -0
  91. data/lib/generators/pu/pkg/app/templates/app/controllers/controller.rb.tt +5 -0
  92. data/lib/generators/pu/pkg/app/templates/app/controllers/dashboard_controller.rb.tt +1 -1
  93. data/lib/generators/pu/res/conn/conn_generator.rb +4 -4
  94. data/lib/generators/pu/res/conn/templates/app/controllers/resource_controller.rb.tt +1 -1
  95. data/lib/generators/pu/res/model/model_generator.rb +3 -3
  96. data/lib/generators/pu/res/scaffold/templates/policy.rb.tt +6 -0
  97. data/lib/generators/pu/service/sidekiq/sidekiq_generator.rb +0 -5
  98. data/lib/generators/pu/service/sidekiq/templates/app/sidekiq/sidekiq_job.rb +0 -2
  99. data/lib/plutonium/config.rb +2 -14
  100. data/lib/plutonium/core/associations/renderers/basic_renderer.rb +28 -0
  101. data/lib/plutonium/core/associations/renderers/factory.rb +36 -0
  102. data/lib/plutonium/core/associations/renderers/has_many_renderer.rb +16 -0
  103. data/lib/plutonium/core/autodiscovery/association_renderer_discoverer.rb +31 -0
  104. data/lib/plutonium/core/controllers/authorizable.rb +13 -17
  105. data/lib/plutonium/core/controllers/base.rb +3 -7
  106. data/lib/plutonium/core/controllers/presentable.rb +6 -1
  107. data/lib/plutonium/core/definers/association_renderer_definer.rb +33 -0
  108. data/lib/plutonium/core/fields/inputs/checkbox_input.rb +13 -0
  109. data/lib/plutonium/core/fields/inputs/factory.rb +1 -0
  110. data/lib/plutonium/core/fields/inputs/polymorphic_belongs_to_association_input.rb +1 -1
  111. data/lib/plutonium/core/ui/detail.rb +1 -0
  112. data/lib/plutonium/helpers/application_helper.rb +8 -9
  113. data/lib/plutonium/helpers/assets_helper.rb +41 -0
  114. data/lib/plutonium/helpers/display_helper.rb +13 -0
  115. data/lib/plutonium/helpers/form_helper.rb +1 -1
  116. data/lib/plutonium/helpers.rb +1 -0
  117. data/lib/plutonium/icons.rb +12 -5
  118. data/lib/plutonium/pkg/app.rb +10 -0
  119. data/lib/plutonium/pundit/context.rb +18 -0
  120. data/lib/plutonium/pundit/policy_finder.rb +25 -0
  121. data/lib/plutonium/railtie.rb +26 -8
  122. data/lib/plutonium/reloader.rb +18 -7
  123. data/lib/plutonium/resource/controller.rb +4 -0
  124. data/lib/plutonium/resource/policy.rb +69 -47
  125. data/lib/plutonium/resource/presenter.rb +1 -0
  126. data/lib/plutonium/resource/query_object.rb +139 -130
  127. data/lib/plutonium/rodauth/controller_methods.rb +7 -3
  128. data/lib/plutonium/version.rb +1 -1
  129. data/lib/plutonium.rb +9 -57
  130. data/package-lock.json +782 -17
  131. data/package.json +31 -8
  132. data/postcss.config.js +17 -7
  133. data/src/.npmignore +2 -0
  134. data/src/js/controllers/color_mode_controller.js +41 -0
  135. data/src/js/controllers/frame_navigator_controller.js +99 -0
  136. data/src/js/controllers/has_many_panel_controller.js +8 -0
  137. data/src/js/controllers/nav_grid_menu_controller.js +8 -0
  138. data/src/js/controllers/nav_grid_menu_item_controller.js +8 -0
  139. data/{app/views/components/tab_bar/tab_bar_controller.js → src/js/controllers/nav_user_controller.js} +2 -2
  140. data/src/js/controllers/nav_user_link_controller.js +8 -0
  141. data/src/js/controllers/nav_user_section_controller.js +8 -0
  142. data/src/js/controllers/register_controllers.js +45 -0
  143. data/{app/assets/javascripts → src/js}/controllers/resource_dismiss_controller.js +2 -0
  144. data/{app/assets/javascripts → src/js}/controllers/resource_drop_down_controller.js +2 -0
  145. data/src/js/controllers/resource_header_controller.js +8 -0
  146. data/src/js/controllers/resource_layout_controller.js +8 -0
  147. data/src/js/controllers/sidebar_menu_controller.js +8 -0
  148. data/src/js/controllers/sidebar_menu_item_controller.js +8 -0
  149. data/src/js/core.js +4 -0
  150. data/{app/assets/javascripts/plutonium-app.js → src/js/plutonium.js} +1 -1
  151. data/{app/assets/javascripts → src/js}/turbo/turbo_debug.js +2 -4
  152. data/tailwind.config.js +85 -84
  153. metadata +73 -39
  154. data/app/assets/build/plutonium.js +0 -5122
  155. data/app/assets/javascripts/controllers/index.js +0 -34
  156. data/app/assets/javascripts/plutonium.js +0 -1
  157. data/app/views/application/_color_modes.html.erb +0 -57
  158. data/app/views/components/tab_bar/tab_bar_component.html.erb +0 -11
  159. data/app/views/components/tab_bar/tab_bar_component.rb +0 -9
  160. data/app/views/resource/_nav_user.html.erb +0 -4
  161. data/app/views/resource/_tab_menu.html.erb +0 -13
  162. data/css.manifest +0 -3
  163. data/js.manifest +0 -4
  164. data/lib/generators/pu/pkg/app/templates/app/controllers/app_controller.rb.tt +0 -5
  165. data/lib/generators/pu/pkg/app/templates/app/controllers/package_controller.rb.tt +0 -26
  166. data/public/plutonium-assets/application.css +0 -25086
  167. data/public/plutonium-assets/plutonium-app-36KN5FVJ.js +0 -6
  168. data/public/plutonium-assets/plutonium-app-36KN5FVJ.js.map +0 -7
  169. data/public/plutonium-assets/plutonium-app-6WILQCTT.js +0 -39
  170. data/public/plutonium-assets/plutonium-app-6WILQCTT.js.map +0 -7
  171. data/public/plutonium-assets/plutonium.2d4f0c333cd000051d3b.css +0 -3424
  172. data/public/plutonium-assets/plutonium.50232e35b5495f5ad90d.css +0 -3415
  173. data/public/plutonium-assets/plutonium.8bee7a8482988b0360e3.css +0 -3420
  174. /data/{app/assets/build → lib/generators/pu/core/assets/templates}/.keep +0 -0
  175. /data/{app/assets/stylesheets → src/css}/plutonium.css +0 -0
  176. /data/{app/views/components/form → src/js/controllers}/form_controller.js +0 -0
  177. /data/{app/views/components/interactive_action_form → src/js/controllers}/interactive_action_form_controller.js +0 -0
  178. /data/{app/views/components/nested_resource_form_fields → src/js/controllers}/nested_resource_form_fields_controller.js +0 -0
  179. /data/{app/views/components/table → src/js/controllers}/table_controller.js +0 -0
  180. /data/{app/views/components/table_search_input → src/js/controllers}/table_search_input_controller.js +0 -0
  181. /data/{app/views/components/table_toolbar → src/js/controllers}/table_toolbar_controller.js +0 -0
  182. /data/{app/views/components/toolbar → src/js/controllers}/toolbar_controller.js +0 -0
  183. /data/{app/assets/javascripts → src/js}/turbo/index.js +0 -0
  184. /data/{app/assets/javascripts → src/js}/turbo/turbo_actions.js +0 -0
  185. /data/{app/assets/javascripts → src/js}/turbo/turbo_frame_monkey_patch.js +0 -0
data/package.json CHANGED
@@ -1,24 +1,47 @@
1
1
  {
2
- "devDependencies": {
2
+ "name": "@radioactive-labs/plutonium",
3
+ "version": "0.1.2",
4
+ "description": "Core assets for the Plutonium gem",
5
+ "type": "module",
6
+ "main": "src/js/core.js",
7
+ "files": [
8
+ "src/"
9
+ ],
10
+ "author": "Stefan Froelich (@thedumbtechguy)",
11
+ "license": "MIT",
12
+ "bugs": {
13
+ "url": "https://github.com/radioactive-labs/plutonium-core/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/radioactive-labs/plutonium-core.git"
18
+ },
19
+ "homepage": "https://github.com/radioactive-labs/plutonium-core#readme",
20
+ "dependencies": {
3
21
  "@hotwired/stimulus": "^3.2.2",
22
+ "lodash.debounce": "^4.0.8",
4
23
  "@hotwired/turbo": "^8.0.4",
24
+ "flowbite": "^2.3.0"
25
+ },
26
+ "devDependencies": {
5
27
  "@tailwindcss/forms": "^0.5.7",
6
28
  "autoprefixer": "^10.4.18",
7
29
  "concurrently": "^8.2.2",
8
30
  "esbuild": "^0.20.1",
9
31
  "esbuild-plugin-manifest": "^1.0.3",
10
- "flowbite": "^2.3.0",
11
- "lodash.debounce": "^4.0.8",
12
32
  "postcss": "^8.4.35",
13
33
  "postcss-cli": "^11.0.0",
14
34
  "postcss-hash": "^3.0.0",
15
- "tailwindcss": "^3.4.1"
35
+ "tailwindcss": "^3.4.1",
36
+ "cssnano": "^7.0.2"
16
37
  },
17
38
  "scripts": {
39
+ "build": "npm run js:prod && npm run css:prod",
18
40
  "dev": "concurrently \"npm run css:dev\" \"npm run js:dev\"",
19
- "css:dev": "postcss app/assets/stylesheets/plutonium.css -o public/plutonium-assets/build/plutonium-dev.css --watch",
20
- "js:dev": "node esbuild.config.js",
21
- "css:prod": "postcss app/assets/stylesheets/plutonium.css -o public/plutonium-assets/plutonium.css --prod",
22
- "js:prod": "node esbuild.config.js --prod"
41
+ "css:dev": "postcss src/css/plutonium.css -o src/build/plutonium.css --watch --dev",
42
+ "js:dev": "node esbuild.config.js --dev",
43
+ "css:prod": "postcss src/css/plutonium.css -o app/assets/plutonium.css && postcss src/css/plutonium.css -o src/dist/css/plutonium.css",
44
+ "js:prod": "node esbuild.config.js",
45
+ "prepare": "npm run build"
23
46
  }
24
47
  }
data/postcss.config.js CHANGED
@@ -1,11 +1,21 @@
1
- module.exports = {
1
+ const config = {
2
2
  plugins: {
3
3
  tailwindcss: {},
4
- autoprefixer: {},
5
- 'postcss-hash': {
6
- algorithm: 'sha256',
7
- trim: 20,
8
- manifest: process.argv.includes("--prod") ? './css.manifest' : './css.dev.manifest'
9
- },
4
+ autoprefixer: {}
10
5
  }
11
6
  }
7
+
8
+ if (process.argv.includes("--dev")) {
9
+ config.plugins['postcss-hash'] = {
10
+ algorithm: 'sha256',
11
+ trim: 20,
12
+ manifest: './src/build/css.manifest'
13
+ }
14
+ }
15
+ else {
16
+ config.plugins['cssnano'] = {
17
+ preset: 'default',
18
+ }
19
+ }
20
+
21
+ export default config
data/src/.npmignore ADDED
@@ -0,0 +1,2 @@
1
+ build/
2
+ js/plutonium.js
@@ -0,0 +1,41 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+
4
+ // Connects to data-controller="color-mode"
5
+ export default class extends Controller {
6
+ // static targets = ["trigger", "menu"]
7
+
8
+ connect() {
9
+ console.log(`color-mode connected: ${this.element}`)
10
+ this.updateColorMode()
11
+ }
12
+
13
+ disconnect() {
14
+ }
15
+
16
+ updateColorMode() {
17
+ if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
18
+ document.documentElement.classList.add('dark')
19
+ } else {
20
+ document.documentElement.classList.remove('dark')
21
+ }
22
+ }
23
+
24
+ setLightColorMode() {
25
+ // Whenever the user explicitly chooses light mode
26
+ localStorage.theme = 'light'
27
+ this.updateColorMode()
28
+ }
29
+
30
+ setDarkColorMode() {
31
+ // Whenever the user explicitly chooses dark mode
32
+ localStorage.theme = 'dark'
33
+ this.updateColorMode()
34
+ }
35
+
36
+ setSystemColorMode() {
37
+ // Whenever the user explicitly chooses to respect the OS preference
38
+ localStorage.removeItem('theme')
39
+ this.updateColorMode()
40
+ }
41
+ }
@@ -0,0 +1,99 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="frame-navigator"
4
+ export default class extends Controller {
5
+ static targets = ["frame", "refreshButton", "backButton", "homeButton"];
6
+
7
+ connect() {
8
+ console.log(`frame-navigator connected: ${this.element}`)
9
+
10
+ this.srcHistory = []
11
+ this.originalFrameSrc = this.frameTarget.src
12
+
13
+ if (this.hasRefreshButtonTarget) {
14
+ this.refreshButtonTarget.style.display = ''
15
+ this.refreshButtonClicked = this.refreshButtonClicked.bind(this);
16
+ this.refreshButtonTarget.addEventListener("click", this.refreshButtonClicked);
17
+ }
18
+
19
+ if (this.hasBackButtonTarget) {
20
+ this.backButtonClicked = this.backButtonClicked.bind(this);
21
+ this.backButtonTarget.addEventListener("click", this.backButtonClicked);
22
+ }
23
+
24
+ if (this.hasHomeButtonTarget) {
25
+ this.homeButtonClicked = this.homeButtonClicked.bind(this);
26
+ this.homeButtonTarget.addEventListener("click", this.homeButtonClicked);
27
+ }
28
+
29
+ this.frameLoaded = this.frameLoaded.bind(this);
30
+ this.frameTarget.addEventListener("turbo:frame-load", this.frameLoaded);
31
+
32
+ this.frameLoading = this.frameLoading.bind(this);
33
+ this.frameTarget.addEventListener("turbo:click", this.frameLoading);
34
+ this.frameTarget.addEventListener("turbo:submit-start", this.frameLoading);
35
+ }
36
+
37
+ disconnect() {
38
+ if (this.hasRefreshButtonTarget) this.refreshButtonTarget.removeEventListener("click", this.refreshButtonClicked);
39
+ if (this.hasBackButtonTarget) this.backButtonTarget.removeEventListener("click", this.backButtonClicked);
40
+ if (this.hasHomeButtonTarget) this.homeButtonTarget.removeEventListener("click", this.homeButtonClicked);
41
+
42
+ this.frameTarget.removeEventListener("turbo:frame-load", this.frameLoaded);
43
+ this.frameTarget.removeEventListener("turbo:click", this.frameLoading);
44
+ this.frameTarget.removeEventListener("turbo:submit-start", this.frameLoading);
45
+ }
46
+
47
+ frameLoading(event) {
48
+ if (this.hasRefreshButtonTarget) this.refreshButtonTarget.classList.add("motion-safe:animate-spin")
49
+ this.frameTarget.classList.add("motion-safe:animate-pulse")
50
+ }
51
+
52
+ frameLoaded(event) {
53
+ if (this.hasRefreshButtonTarget) this.refreshButtonTarget.classList.remove("motion-safe:animate-spin")
54
+ this.frameTarget.classList.remove("motion-safe:animate-pulse")
55
+
56
+ let src = event.target.src
57
+ if (src == this.currentSrc) {
58
+ // this must be a refresh
59
+ // do nothing
60
+ }
61
+ else if (src == this.originalFrameSrc)
62
+ this.srcHistory = [src]
63
+ else
64
+ this.srcHistory.push(src)
65
+
66
+ this.updateNavigationButtonsDisplay()
67
+ }
68
+
69
+ refreshButtonClicked(event) {
70
+ this.frameLoading(null)
71
+
72
+ this.frameTarget.reload()
73
+ }
74
+
75
+ backButtonClicked(event) {
76
+ this.frameLoading(null)
77
+
78
+ this.srcHistory.pop()
79
+ this.frameTarget.src = this.currentSrc
80
+ }
81
+
82
+ homeButtonClicked(event) {
83
+ this.frameLoading(null)
84
+
85
+ this.frameTarget.src = this.originalFrameSrc
86
+ }
87
+
88
+ get currentSrc() { return this.srcHistory[this.srcHistory.length - 1] }
89
+
90
+ updateNavigationButtonsDisplay() {
91
+ if (this.hasHomeButtonTarget) {
92
+ this.homeButtonTarget.style.display = this.srcHistory.length > 1 ? '' : 'none'
93
+ }
94
+
95
+ if (this.hasBackButtonTarget) {
96
+ this.backButtonTarget.style.display = this.srcHistory.length > 2 ? '' : 'none'
97
+ }
98
+ }
99
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="has-many-panel"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`has-many-panel connected: ${this.element}`)
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="nav-grid-menu"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`nav-grid-menu connected: ${this.element}`)
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="nav-grid-menu-item"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`nav-grid-menu-item connected: ${this.element}`)
7
+ }
8
+ }
@@ -1,8 +1,8 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
2
 
3
- // Connects to data-controller="tab-bar"
3
+ // Connects to data-controller="nav-user"
4
4
  export default class extends Controller {
5
5
  connect() {
6
- console.log(`tab-bar connected: ${this.element}`)
6
+ console.log(`nav-user connected: ${this.element}`)
7
7
  }
8
8
  }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="nav-user-link"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`nav-user-link connected: ${this.element}`)
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="nav-user-section"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`nav-user-section connected: ${this.element}`)
7
+ }
8
+ }
@@ -0,0 +1,45 @@
1
+ // Import controllers here
2
+ import ResourceLayoutController from "./resource_layout_controller.js"
3
+ import NavGridMenuItemController from "./nav_grid_menu_item_controller.js"
4
+ import NavGridMenuController from "./nav_grid_menu_controller.js"
5
+ import NavUserSectionController from "./nav_user_section_controller.js"
6
+ import NavUserLinkController from "./nav_user_link_controller.js"
7
+ import NavUserController from "./nav_user_controller.js"
8
+ import ResourceHeaderController from "./resource_header_controller.js"
9
+ import SidebarMenuItemController from "./sidebar_menu_item_controller.js"
10
+ import SidebarMenuController from "./sidebar_menu_controller.js"
11
+ import HasManyPanelController from "./has_many_panel_controller.js"
12
+ import NestedResourceFormFieldsController from "./nested_resource_form_fields_controller.js"
13
+ import ToolbarController from "./toolbar_controller.js"
14
+ import TableSearchInputController from "./table_search_input_controller.js"
15
+ import TableToolbarController from "./table_toolbar_controller.js"
16
+ import TableController from "./table_controller.js"
17
+ import FormController from "./form_controller.js"
18
+ import ResourceDropDownController from "./resource_drop_down_controller.js"
19
+ import ResourceDismissController from "./resource_dismiss_controller.js"
20
+ import FrameNavigatorController from "./frame_navigator_controller.js"
21
+ import ColorModeController from "./color_mode_controller.js"
22
+
23
+ export default function (application) {
24
+ // Register controllers here
25
+ application.register("resource-layout", ResourceLayoutController)
26
+ application.register("nav-grid-menu-item", NavGridMenuItemController)
27
+ application.register("nav-grid-menu", NavGridMenuController)
28
+ application.register("nav-user-section", NavUserSectionController)
29
+ application.register("nav-user-link", NavUserLinkController)
30
+ application.register("nav-user", NavUserController)
31
+ application.register("resource-header", ResourceHeaderController)
32
+ application.register("sidebar-menu-item", SidebarMenuItemController)
33
+ application.register("sidebar-menu", SidebarMenuController)
34
+ application.register("has-many-panel", HasManyPanelController)
35
+ application.register("nested-resource-form-fields", NestedResourceFormFieldsController)
36
+ application.register("toolbar", ToolbarController)
37
+ application.register("table-search-input", TableSearchInputController)
38
+ application.register("table-toolbar", TableToolbarController)
39
+ application.register("table", TableController)
40
+ application.register("form", FormController)
41
+ application.register("resource-drop-down", ResourceDropDownController)
42
+ application.register("resource-dismiss", ResourceDismissController)
43
+ application.register("frame-navigator", FrameNavigatorController)
44
+ application.register("color-mode", ColorModeController)
45
+ }
@@ -11,6 +11,8 @@ export default class extends Controller {
11
11
  }
12
12
 
13
13
  connect() {
14
+ console.log(`resource-dismiss connected: ${this.element}`)
15
+
14
16
  // https://flowbite.com/docs/components/alerts/#javascript-behaviour
15
17
  this.dismiss = new Dismiss(this.targetTarget, this.triggerTarget);
16
18
 
@@ -7,6 +7,8 @@ export default class extends Controller {
7
7
  static targets = ["trigger", "menu"]
8
8
 
9
9
  connect() {
10
+ console.log(`resource-drop-down connected: ${this.element}`)
11
+
10
12
  // https://flowbite.com/docs/components/dropdowns/#javascript-behaviour
11
13
  this.dropdown = new Dropdown(this.menuTarget, this.triggerTarget);
12
14
  }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="resource-header"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`resource-header connected: ${this.element}`)
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="resource-layout"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`resource-layout connected: ${this.element}`)
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="sidebar-menu"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`sidebar-menu connected: ${this.element}`)
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="sidebar-menu-item"
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log(`sidebar-menu-item connected: ${this.element}`)
7
+ }
8
+ }
data/src/js/core.js ADDED
@@ -0,0 +1,4 @@
1
+ import registerControllers from "./controllers/register_controllers.js"
2
+
3
+
4
+ export { registerControllers }
@@ -1,7 +1,7 @@
1
1
  import { Application } from "@hotwired/stimulus"
2
2
  const application = Application.start()
3
3
 
4
- import { registerControllers } from "./plutonium"
4
+ import { registerControllers } from "./core"
5
5
  registerControllers(application)
6
6
 
7
7
  import "./turbo"
@@ -1,4 +1,4 @@
1
- eventNames = [
1
+ [
2
2
  'turbo:click',
3
3
  'turbo:before-visit',
4
4
  'turbo:visit',
@@ -21,9 +21,7 @@ eventNames = [
21
21
  'turbo:before-morph-element',
22
22
  'turbo:morph-attribute',
23
23
  'turbo:morph',
24
- ]
25
-
26
- eventNames.forEach(eventName => {
24
+ ].forEach(eventName => {
27
25
  document.addEventListener(eventName, (event) => {
28
26
  console.log(event.type, event);
29
27
  });
data/tailwind.config.js CHANGED
@@ -1,90 +1,91 @@
1
-
2
1
  /** @type {import('tailwindcss').Config} */
3
2
 
4
- let safelist = [];
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
- // });
3
+ export const content = [
4
+ `${__dirname}/src/**/*.{css,js}`,
5
+ `${__dirname}/app/views/**/*.{rb,erb,js}`,
6
+ `${__dirname}/config/initializers/simple_form.rb`,
14
7
 
15
- module.exports = {
16
- content: [
17
- // node modules are not packaged as part of the gem.
18
- './node_modules/flowbite/**/*.js', // requires framework user to have flowbite installed.
19
- `${__dirname}/app/assets/**/*.css`,
20
- `${__dirname}/app/views/**/*.{rb,erb}`,
21
- `${__dirname}/config/initializers/simple_form.rb`,
22
- // TODO: temporary workaround for buttons flex basis hack.
23
- // To be removed after moving buttons_helper to components.
24
- // `${__dirname}/lib/plutonium/**/*.{rb,erb}`
25
- ],
26
- darkMode: "selector",
27
- plugins: [
28
- require('@tailwindcss/forms'),
29
- require('flowbite/plugin'),
30
- ],
31
- theme: {
32
- extend: {
33
- colors: {
34
- primary: {
35
- '50': '#f0f7fe',
36
- '100': '#ddecfc',
37
- '200': '#c3dffa',
38
- '300': '#99ccf7',
39
- '400': '#69b0f1',
40
- '500': '#4691eb',
41
- '600': '#3174df',
42
- '700': '#285fcc',
43
- '800': '#274ea6',
44
- '900': '#244484',
45
- '950': '#1b2b50',
46
- },
47
- },
48
- screens: {
49
- 'xs': '475px',
8
+ // node modules are not packaged as part of the gem.
9
+ // requires users to have flowbite installed in their own project.
10
+ './node_modules/flowbite/**/*.js',
11
+ // TODO: temporary workaround for legacy components.
12
+ // To be removed after converting buttons_helper and other files containing tailwind to components .
13
+ // `${__dirname}/lib/plutonium/**/*.{rb,erb}`
14
+ ];
15
+ export const darkMode = "selector";
16
+ export const plugins = [
17
+ // requires users to have the required packages installed in their own project.
18
+ require('@tailwindcss/forms'),
19
+ require('flowbite/plugin'),
20
+ ];
21
+ export const theme = {
22
+ extend: {
23
+ colors: {
24
+ primary: {
25
+ '50': '#f0f7fe',
26
+ '100': '#ddecfc',
27
+ '200': '#c3dffa',
28
+ '300': '#99ccf7',
29
+ '400': '#69b0f1',
30
+ '500': '#4691eb',
31
+ '600': '#3174df',
32
+ '700': '#285fcc',
33
+ '800': '#274ea6',
34
+ '900': '#244484',
35
+ '950': '#1b2b50',
50
36
  },
51
37
  },
52
- fontFamily: {
53
- 'body': [
54
- 'Lato',
55
- 'ui-sans-serif',
56
- 'system-ui',
57
- '-apple-system',
58
- 'system-ui',
59
- 'Segoe UI',
60
- 'Roboto',
61
- 'Helvetica Neue',
62
- 'Arial',
63
- 'Noto Sans',
64
- 'sans-serif',
65
- 'Apple Color Emoji',
66
- 'Segoe UI Emoji',
67
- 'Segoe UI Symbol',
68
- 'Noto Color Emoji'
69
- ],
70
- 'sans': [
71
- 'Lato',
72
- 'ui-sans-serif',
73
- 'system-ui',
74
- '-apple-system',
75
- 'system-ui',
76
- 'Segoe UI',
77
- 'Roboto',
78
- 'Helvetica Neue',
79
- 'Arial',
80
- 'Noto Sans',
81
- 'sans-serif',
82
- 'Apple Color Emoji',
83
- 'Segoe UI Emoji',
84
- 'Segoe UI Symbol',
85
- 'Noto Color Emoji'
86
- ]
87
- }
38
+ screens: {
39
+ 'xs': '475px',
40
+ },
88
41
  },
89
- safelist: safelist
90
- }
42
+ fontFamily: {
43
+ 'body': [
44
+ 'Lato',
45
+ 'ui-sans-serif',
46
+ 'system-ui',
47
+ '-apple-system',
48
+ 'system-ui',
49
+ 'Segoe UI',
50
+ 'Roboto',
51
+ 'Helvetica Neue',
52
+ 'Arial',
53
+ 'Noto Sans',
54
+ 'sans-serif',
55
+ 'Apple Color Emoji',
56
+ 'Segoe UI Emoji',
57
+ 'Segoe UI Symbol',
58
+ 'Noto Color Emoji'
59
+ ],
60
+ 'sans': [
61
+ 'Lato',
62
+ 'ui-sans-serif',
63
+ 'system-ui',
64
+ '-apple-system',
65
+ 'system-ui',
66
+ 'Segoe UI',
67
+ 'Roboto',
68
+ 'Helvetica Neue',
69
+ 'Arial',
70
+ 'Noto Sans',
71
+ 'sans-serif',
72
+ 'Apple Color Emoji',
73
+ 'Segoe UI Emoji',
74
+ 'Segoe UI Symbol',
75
+ 'Noto Color Emoji'
76
+ ]
77
+ }
78
+ };
79
+
80
+
81
+ // const _safelist = [];
82
+ // // Object.keys(colors).forEach((color) => {
83
+ // // if (typeof colors[color] === 'object') {
84
+ // // Object.keys(colors[color]).forEach((shade) => {
85
+ // // safelist.push(`bg-${color}-${shade}`);
86
+ // // safelist.push(`text-${color}-${shade}`);
87
+ // // // Add other utilities as needed
88
+ // // });
89
+ // // }
90
+ // // });
91
+ // export const safelist = _safelist;