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 +4 -4
- data/app/assets/stylesheets/recurrence_ui/components.css +1 -1
- data/app/javascript/recurrence_ui/index.js +1 -1
- data/config/importmap.rb +0 -3
- data/lib/generators/recurrence_ui/install/install_generator.rb +30 -16
- data/lib/recurrence_ui/engine.rb +5 -5
- data/lib/recurrence_ui/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '069d35c9479d4f10916502bc7e13e13db0b26a758b3ff8b41619d632918f78c2'
|
|
4
|
+
data.tar.gz: f88fdf5a43cbbd18858f53ba8eb1592de132cc9ab5d711e38375322f4c3fdada
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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-
|
|
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 {
|
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
|
|
6
|
+
desc "Installs RecurrenceUi importmap, JS controller registration, and Tailwind CSS styles"
|
|
7
7
|
|
|
8
|
-
def
|
|
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)}", :
|
|
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
|
-
|
|
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
|
-
|
|
37
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
data/lib/recurrence_ui/engine.rb
CHANGED
|
@@ -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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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|
|