recurrence_ui 0.3.1 → 0.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30bda1d3e659e5be4acd1c5addc226c2bddcbb9d862bbee836a15542b896722c
4
- data.tar.gz: e68a05739a7cc1e34a6d01b9b0cbc16f8a569a28ab0d2cd1c998f028d4eeb360
3
+ metadata.gz: '069d35c9479d4f10916502bc7e13e13db0b26a758b3ff8b41619d632918f78c2'
4
+ data.tar.gz: f88fdf5a43cbbd18858f53ba8eb1592de132cc9ab5d711e38375322f4c3fdada
5
5
  SHA512:
6
- metadata.gz: 3cc4b0b312432613d8c5780648d373a48286527c8864458c149d73244a449fb9c2b445dde608fe246b6980aef8a74ec62b4cbabc14f06ad8bf4e654d53f50133
7
- data.tar.gz: 2fb010565904f3f9635c277c1834607200b6f35e30058568da1722b5b9bd60d77d82ce7242d419b6d711e09c5773e7387df0b472508932face14a8b474d91576
6
+ metadata.gz: 72ac32f1763a7ef149adcc46356ed811e8dbd2c2b6dcd8e469631e902765f039ca170b2d7a183d8620a3df2d8dffb9f71f7eca1459794700e15c0d1469cd4c50
7
+ data.tar.gz: d80d3ddd4307f2a0a45d59e03c915b91a76d24c68956b2ecd91966faa6ec46eea106cac44d8d302e9ec7aa3cefc31d305ef3935b5ec5eb6a786b59b66d685664
@@ -220,7 +220,7 @@
220
220
 
221
221
  /* Edit Icon wrapper */
222
222
  .rui-summary-icon {
223
- @apply opacity-0 group-hover:opacity-100 transition-opacity duration-200 text-gray-400 dark:text-gray-500;
223
+ @apply opacity-0 group-hover:opacity-100 transition-opacity duration-200 text-[var(--app-text-muted)] dark:text-gray-500;
224
224
  }
225
225
  /* Rule Accordion Card Container */
226
226
  .rui-card-container {
@@ -1,4 +1,4 @@
1
- import RecurrenceUiController from "recurrence_ui/recurrence_ui_controller"
1
+ import RecurrenceUiController from "./recurrence_ui_controller"
2
2
 
3
3
  export function registerRecurrenceUiController(application) {
4
4
  if (application) {
data/config/importmap.rb CHANGED
@@ -1,6 +1,3 @@
1
1
  # config/importmap.rb in the recurrence_ui gem
2
2
  pin "recurrence_ui", to: "recurrence_ui/index.js"
3
3
  pin "recurrence_ui/recurrence_ui_controller", to: "recurrence_ui/recurrence_ui_controller.js"
4
-
5
- # Явно указываем Importmap, где лежат файлы гема на диске
6
- pin_all_from File.expand_path("../app/javascript/recurrence_ui", __dir__), under: "recurrence_ui"
@@ -3,9 +3,24 @@ module RecurrenceUi
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
  source_root File.expand_path("templates", __dir__)
5
5
 
6
- desc "Installs RecurrenceUi JavaScript and CSS integration into the application"
6
+ desc "Installs RecurrenceUi importmap, JS controller registration, and Tailwind CSS styles"
7
7
 
8
- def register_js
8
+ def add_importmap_pin
9
+ importmap_file = "config/importmap.rb"
10
+ if File.exist?(importmap_file)
11
+ pin_code = "\npin \"recurrence_ui\", to: \"recurrence_ui/index.js\"\n"
12
+ if File.read(importmap_file).include?("recurrence_ui")
13
+ say "RecurrenceUi pin already exists in #{importmap_file}", :blue
14
+ else
15
+ append_to_file importmap_file, pin_code
16
+ say "Added recurrence_ui pin to #{importmap_file}", :green
17
+ end
18
+ else
19
+ say "Could not find #{importmap_file}. Importmap configuration skipped.", :yellow
20
+ end
21
+ end
22
+
23
+ def register_controller
9
24
  app_js_paths = [
10
25
  Rails.root.join("app/javascript/application.js"),
11
26
  Rails.root.join("app/javascript/packs/application.js")
@@ -17,13 +32,15 @@ module RecurrenceUi
17
32
  content = File.read(target_js)
18
33
 
19
34
  if content.include?("recurrence_ui")
20
- say "RecurrenceUi is already registered in #{target_js.relative_path_from(Rails.root)}", :yellow
35
+ say "RecurrenceUi is already registered in #{target_js.relative_path_from(Rails.root)}", :blue
21
36
  else
22
37
  append_to_file target_js, <<~JS
23
38
 
24
39
  // Register RecurrenceUi Stimulus controller
25
40
  import { registerRecurrenceUiController } from "recurrence_ui"
26
- registerRecurrenceUiController(application)
41
+ if (typeof window.Stimulus !== "undefined") {
42
+ registerRecurrenceUiController(window.Stimulus)
43
+ }
27
44
  JS
28
45
  say "Added RecurrenceUi registration to #{target_js.relative_path_from(Rails.root)}", :green
29
46
  end
@@ -33,30 +50,27 @@ module RecurrenceUi
33
50
  end
34
51
 
35
52
  def register_styles
36
- tailwind_css_path = Rails.root.join("app/assets/tailwind/application.css")
37
- tailwind_css_alt_path = Rails.root.join("app/assets/stylesheets/application.tailwind.css")
53
+ tailwind_css_paths = [
54
+ Rails.root.join("app/assets/tailwind/application.css"),
55
+ Rails.root.join("app/assets/stylesheets/application.tailwind.css"),
56
+ Rails.root.join("app/assets/stylesheets/application.css")
57
+ ]
38
58
 
39
- target_css = if File.exist?(tailwind_css_path)
40
- tailwind_css_path
41
- elsif File.exist?(tailwind_css_alt_path)
42
- tailwind_css_alt_path
43
- else
44
- nil
45
- end
59
+ target_css = tailwind_css_paths.find { |path| File.exist?(path) }
46
60
 
47
61
  if target_css
48
62
  content = File.read(target_css)
49
63
  import_line = '@import "recurrence_ui/application.css";'
50
64
 
51
- unless content.include?(import_line)
65
+ if content.include?(import_line)
66
+ say "RecurrenceUi styles import already exists in #{target_css.relative_path_from(Rails.root)}", :blue
67
+ else
52
68
  if content.include?('@import "tailwindcss";')
53
69
  inject_into_file target_css, "\n#{import_line}", after: '@import "tailwindcss";'
54
70
  else
55
71
  prepend_to_file target_css, "#{import_line}\n"
56
72
  end
57
73
  say "Added RecurrenceUi styles import to #{target_css.relative_path_from(Rails.root)}", :green
58
- else
59
- say "RecurrenceUi styles import already exists in #{target_css.relative_path_from(Rails.root)}", :blue
60
74
  end
61
75
  else
62
76
  say "Tailwind CSS file not found. Please add `@import \"recurrence_ui/application.css\";` manually.", :yellow
@@ -6,11 +6,11 @@ module RecurrenceUi
6
6
  isolate_namespace RecurrenceUi
7
7
 
8
8
  # 1. Add importmap support for the gem
9
- initializer "recurrence_ui.importmap", before: "importmap" do |app|
10
- if app.config.respond_to?(:importmap)
11
- app.config.importmap.paths << Engine.root.join("config/importmap.rb")
12
- end
13
- end
9
+ #initializer "recurrence_ui.importmap", before: "importmap" do |app|
10
+ # if app.config.respond_to?(:importmap)
11
+ # app.config.importmap.paths << Engine.root.join("config/importmap.rb")
12
+ # end
13
+ #end
14
14
 
15
15
  # 2. Assets (только стили и картинки, если нужны, т.к. JS обслуживает Importmap)
16
16
  initializer "recurrence_ui.assets" do |app|
@@ -1,3 +1,3 @@
1
1
  module RecurrenceUi
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurrence_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katerina German