turbo_power 0.3.1 → 0.4.0
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/Gemfile +1 -1
- data/Gemfile.lock +11 -4
- data/README.md +34 -32
- data/lib/turbo_power/stream_helper.rb +99 -74
- data/lib/turbo_power/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 169485f07b14d287277676057c5fbc40f0d2a3f99ea935ac68205e19005dca7a
|
|
4
|
+
data.tar.gz: ece7bbaabd4b88f0c4eafe98bd1f9e107f593369c121de4e3b153208fea7bff9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c6f701b207610e647f4c820ce3a2d0b4abd02e3ca41f152d62782f37122a034645a59e9ca0571d621d610730206ae0b231a63b4af10753458f01d313bb4fa04
|
|
7
|
+
data.tar.gz: c9fa746cfb4337ac4ee7786dad0caeb67f5e42283d77b8fc05345d2165224a8bc1ed549aec00edf8c450a575aa8d1d4bb48a33e7ef6e74e9fe204e728a4b7ae5
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
turbo_power (0.
|
|
4
|
+
turbo_power (0.4.0)
|
|
5
5
|
turbo-rails (~> 1.3)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -32,6 +32,7 @@ GEM
|
|
|
32
32
|
builder (3.2.4)
|
|
33
33
|
concurrent-ruby (1.2.2)
|
|
34
34
|
crass (1.0.6)
|
|
35
|
+
docile (1.4.0)
|
|
35
36
|
erubi (1.12.0)
|
|
36
37
|
globalid (1.1.0)
|
|
37
38
|
activesupport (>= 5.0)
|
|
@@ -42,7 +43,6 @@ GEM
|
|
|
42
43
|
crass (~> 1.0.2)
|
|
43
44
|
nokogiri (>= 1.5.9)
|
|
44
45
|
method_source (1.0.0)
|
|
45
|
-
mini_portile2 (2.8.1)
|
|
46
46
|
minitest (5.17.0)
|
|
47
47
|
nokogiri (1.14.2-x86_64-darwin)
|
|
48
48
|
racc (~> 1.4)
|
|
@@ -82,6 +82,12 @@ GEM
|
|
|
82
82
|
rubocop-ast (1.24.0)
|
|
83
83
|
parser (>= 3.1.1.0)
|
|
84
84
|
ruby-progressbar (1.11.0)
|
|
85
|
+
simplecov (0.22.0)
|
|
86
|
+
docile (~> 1.1)
|
|
87
|
+
simplecov-html (~> 0.11)
|
|
88
|
+
simplecov_json_formatter (~> 0.1)
|
|
89
|
+
simplecov-html (0.12.3)
|
|
90
|
+
simplecov_json_formatter (0.1.4)
|
|
85
91
|
sprockets (4.2.0)
|
|
86
92
|
concurrent-ruby (~> 1.0)
|
|
87
93
|
rack (>= 2.2.4, < 4)
|
|
@@ -89,8 +95,7 @@ GEM
|
|
|
89
95
|
actionpack (>= 5.2)
|
|
90
96
|
activesupport (>= 5.2)
|
|
91
97
|
sprockets (>= 3.0.0)
|
|
92
|
-
sqlite3 (1.5.4)
|
|
93
|
-
mini_portile2 (~> 2.8.0)
|
|
98
|
+
sqlite3 (1.5.4-x86_64-darwin)
|
|
94
99
|
thor (1.2.1)
|
|
95
100
|
turbo-rails (1.3.3)
|
|
96
101
|
actionpack (>= 6.0.0)
|
|
@@ -103,10 +108,12 @@ GEM
|
|
|
103
108
|
|
|
104
109
|
PLATFORMS
|
|
105
110
|
x86_64-darwin-19
|
|
111
|
+
x86_64-darwin-22
|
|
106
112
|
|
|
107
113
|
DEPENDENCIES
|
|
108
114
|
rake (~> 13.0)
|
|
109
115
|
rubocop (~> 1.21)
|
|
116
|
+
simplecov
|
|
110
117
|
sprockets-rails
|
|
111
118
|
sqlite3
|
|
112
119
|
turbo_power!
|
data/README.md
CHANGED
|
@@ -87,37 +87,37 @@ import 'controllers'
|
|
|
87
87
|
|
|
88
88
|
### DOM Actions
|
|
89
89
|
|
|
90
|
-
* `turbo_stream.graft(
|
|
91
|
-
* [`turbo_stream.morph(
|
|
92
|
-
* `turbo_stream.inner_html(
|
|
93
|
-
* `turbo_stream.insert_adjacent_html(
|
|
94
|
-
* `turbo_stream.insert_adjacent_text(
|
|
95
|
-
* `turbo_stream.outer_html(
|
|
96
|
-
* `turbo_stream.text_content(
|
|
97
|
-
* `turbo_stream.set_meta(name, content)`
|
|
90
|
+
* `turbo_stream.graft(targets, parent, **attributes)`
|
|
91
|
+
* [`turbo_stream.morph(targets, html = nil, **attributes, &block)`](https://github.com/marcoroth/turbo-morph)
|
|
92
|
+
* `turbo_stream.inner_html(targets, html = nil, **attributes, &block)`
|
|
93
|
+
* `turbo_stream.insert_adjacent_html(targets, html = nil, position: 'beforeend', **attributes, &block)`
|
|
94
|
+
* `turbo_stream.insert_adjacent_text(targets, text, position: 'beforebegin', **attributes)`
|
|
95
|
+
* `turbo_stream.outer_html(targets, html = nil, **attributes, &block)`
|
|
96
|
+
* `turbo_stream.text_content(targets, text, **attributes)`
|
|
97
|
+
* `turbo_stream.set_meta(name, content, **attributes)`
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
### Attribute Actions
|
|
101
101
|
|
|
102
|
-
* `turbo_stream.add_css_class(
|
|
103
|
-
* `turbo_stream.remove_attribute(
|
|
104
|
-
* `turbo_stream.remove_css_class(
|
|
105
|
-
* `turbo_stream.set_attribute(
|
|
106
|
-
* `turbo_stream.set_dataset_attribute(
|
|
107
|
-
* `turbo_stream.set_property(
|
|
108
|
-
* `turbo_stream.set_style(
|
|
109
|
-
* `turbo_stream.set_styles(
|
|
110
|
-
* `turbo_stream.set_value(
|
|
102
|
+
* `turbo_stream.add_css_class(targets, classes, **attributes)`
|
|
103
|
+
* `turbo_stream.remove_attribute(targets, attribute, **attributes)`
|
|
104
|
+
* `turbo_stream.remove_css_class(targets, classes, **attributes)`
|
|
105
|
+
* `turbo_stream.set_attribute(targets, attribute, value, **attributes)`
|
|
106
|
+
* `turbo_stream.set_dataset_attribute(targets, attribute, value, **attributes)`
|
|
107
|
+
* `turbo_stream.set_property(targets, name, value, **attributes)`
|
|
108
|
+
* `turbo_stream.set_style(targets, name, value, **attributes)`
|
|
109
|
+
* `turbo_stream.set_styles(targets, styles, **attributes)`
|
|
110
|
+
* `turbo_stream.set_value(targets, value, **attributes)`
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
### Event Actions
|
|
114
114
|
|
|
115
|
-
* `turbo_stream.dispatch_event(
|
|
115
|
+
* `turbo_stream.dispatch_event(targets, name, detail: {}, **attributes)`
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
### Form Actions
|
|
119
119
|
|
|
120
|
-
* `turbo_stream.reset_form(
|
|
120
|
+
* `turbo_stream.reset_form(targets, **attributes)`
|
|
121
121
|
|
|
122
122
|
|
|
123
123
|
### Storage Actions
|
|
@@ -136,8 +136,8 @@ import 'controllers'
|
|
|
136
136
|
### Browser Actions
|
|
137
137
|
|
|
138
138
|
* `turbo_stream.reload(**attributes)`
|
|
139
|
-
* `turbo_stream.scroll_into_view(
|
|
140
|
-
* `turbo_stream.set_focus(
|
|
139
|
+
* `turbo_stream.scroll_into_view(targets, **attributes)`
|
|
140
|
+
* `turbo_stream.set_focus(targets, **attributes)`
|
|
141
141
|
* `turbo_stream.set_title(title, **attributes)`
|
|
142
142
|
|
|
143
143
|
|
|
@@ -149,15 +149,17 @@ import 'controllers'
|
|
|
149
149
|
|
|
150
150
|
### Browser History Actions
|
|
151
151
|
|
|
152
|
-
* `turbo_stream.
|
|
153
|
-
* `turbo_stream.
|
|
154
|
-
* `turbo_stream.
|
|
152
|
+
* `turbo_stream.history_back(**attributes)`
|
|
153
|
+
* `turbo_stream.history_forward(**attributes)`
|
|
154
|
+
* `turbo_stream.history_go(delta = 0, **attributes)`
|
|
155
|
+
* `turbo_stream.push_state(url, title = "", state = {}, **attributes)`
|
|
156
|
+
* `turbo_stream.replace_state(url, title = "", state = {}, **attributes)`
|
|
155
157
|
|
|
156
158
|
|
|
157
159
|
### Debug Actions
|
|
158
160
|
|
|
159
|
-
* `turbo_stream.console_log(message, level = :log)`
|
|
160
|
-
* `turbo_stream.console_table(data, columns)`
|
|
161
|
+
* `turbo_stream.console_log(message, level = :log, **attributes)`
|
|
162
|
+
* `turbo_stream.console_table(data, columns, **attributes)`
|
|
161
163
|
|
|
162
164
|
|
|
163
165
|
### Notification Actions
|
|
@@ -167,21 +169,21 @@ import 'controllers'
|
|
|
167
169
|
|
|
168
170
|
### Turbo Actions
|
|
169
171
|
|
|
170
|
-
* `turbo_stream.redirect_to(url, turbo_action = nil, **attributes)`
|
|
172
|
+
* `turbo_stream.redirect_to(url, turbo_action = nil, turbo_frame = nil, **attributes)`
|
|
171
173
|
* `turbo_stream.turbo_clear_cache()`
|
|
172
174
|
|
|
173
175
|
|
|
174
176
|
### Turbo Progress Bar Actions
|
|
175
177
|
|
|
176
|
-
* `turbo_stream.turbo_progress_bar_show()`
|
|
177
|
-
* `turbo_stream.turbo_progress_bar_hide()`
|
|
178
|
-
* `turbo_stream.turbo_progress_bar_set_value(value)`
|
|
178
|
+
* `turbo_stream.turbo_progress_bar_show(**attributes)`
|
|
179
|
+
* `turbo_stream.turbo_progress_bar_hide(**attributes)`
|
|
180
|
+
* `turbo_stream.turbo_progress_bar_set_value(value, **attributes)`
|
|
179
181
|
|
|
180
182
|
|
|
181
183
|
### Turbo Frame Actions
|
|
182
184
|
|
|
183
|
-
* `turbo_stream.turbo_frame_reload(frame_id)`
|
|
184
|
-
* `turbo_stream.turbo_frame_set_src(frame_id, src)`
|
|
185
|
+
* `turbo_stream.turbo_frame_reload(frame_id, **attributes)`
|
|
186
|
+
* `turbo_stream.turbo_frame_set_src(frame_id, src, **attributes)`
|
|
185
187
|
|
|
186
188
|
|
|
187
189
|
## Development
|
|
@@ -19,92 +19,109 @@ module TurboPower
|
|
|
19
19
|
|
|
20
20
|
# DOM Actions
|
|
21
21
|
|
|
22
|
-
def graft(
|
|
23
|
-
custom_action_all :graft, targets:
|
|
22
|
+
def graft(targets = nil, parent = nil, **attributes)
|
|
23
|
+
custom_action_all :graft, targets: targets, attributes: attributes.reverse_merge(parent: parent)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
def inner_html(
|
|
27
|
-
|
|
26
|
+
def inner_html(targets = nil, html = nil, **attributes, &block)
|
|
27
|
+
html = attributes[:html] || html
|
|
28
|
+
|
|
29
|
+
custom_action_all :inner_html, targets: targets, content: html, attributes: attributes.except(:html), &block
|
|
28
30
|
end
|
|
29
31
|
|
|
30
|
-
def insert_adjacent_html(
|
|
31
|
-
|
|
32
|
+
def insert_adjacent_html(targets = nil, html = nil, position: "beforeend", **attributes, &block)
|
|
33
|
+
html = attributes[:html] || html
|
|
34
|
+
|
|
35
|
+
custom_action_all :insert_adjacent_html, targets: targets, content: html, attributes: attributes.merge(position: position).except(:html), &block
|
|
32
36
|
end
|
|
33
37
|
|
|
34
|
-
def insert_adjacent_text(
|
|
35
|
-
custom_action_all :insert_adjacent_text, targets:
|
|
38
|
+
def insert_adjacent_text(targets = nil, text = nil, position: "beforebegin", **attributes)
|
|
39
|
+
custom_action_all :insert_adjacent_text, targets: targets, attributes: attributes.reverse_merge(text: text, position: position)
|
|
36
40
|
end
|
|
37
41
|
|
|
38
|
-
def morph(
|
|
39
|
-
|
|
42
|
+
def morph(targets = nil, html = nil, **attributes, &block)
|
|
43
|
+
html = attributes[:html] || html
|
|
44
|
+
|
|
45
|
+
custom_action_all :morph, targets: targets, content: html, attributes: attributes.except(:html), &block
|
|
40
46
|
end
|
|
41
47
|
|
|
42
|
-
def outer_html(
|
|
43
|
-
|
|
48
|
+
def outer_html(targets = nil, html = nil, **attributes, &block)
|
|
49
|
+
html = attributes[:html] || html
|
|
50
|
+
|
|
51
|
+
custom_action_all :outer_html, targets: targets, content: html, attributes: attributes.except(:html), &block
|
|
44
52
|
end
|
|
45
53
|
|
|
46
|
-
def text_content(
|
|
47
|
-
custom_action_all :text_content, targets:
|
|
54
|
+
def text_content(targets = nil, text = nil, **attributes)
|
|
55
|
+
custom_action_all :text_content, targets: targets, attributes: attributes.reverse_merge(text: text)
|
|
48
56
|
end
|
|
49
57
|
|
|
50
|
-
def set_meta(name, content, **attributes)
|
|
51
|
-
custom_action :set_meta, attributes: attributes.
|
|
58
|
+
def set_meta(name = nil, content = nil, **attributes)
|
|
59
|
+
custom_action :set_meta, attributes: attributes.reverse_merge(name: name, content: content)
|
|
52
60
|
end
|
|
53
61
|
|
|
54
62
|
# Attribute Actions
|
|
55
63
|
|
|
56
|
-
def add_css_class(
|
|
57
|
-
|
|
64
|
+
def add_css_class(targets = nil, classes = "", **attributes)
|
|
65
|
+
classes = attributes[:classes] || classes
|
|
66
|
+
classes = classes.join(" ") if classes.is_a?(Array)
|
|
67
|
+
|
|
68
|
+
custom_action_all :add_css_class, targets: targets, attributes: attributes.merge(classes: classes)
|
|
58
69
|
end
|
|
59
70
|
|
|
60
|
-
def remove_attribute(
|
|
61
|
-
custom_action_all :remove_attribute, targets:
|
|
71
|
+
def remove_attribute(targets = nil, attribute = nil, **attributes)
|
|
72
|
+
custom_action_all :remove_attribute, targets: targets, attributes: attributes.reverse_merge(attribute: attribute)
|
|
62
73
|
end
|
|
63
74
|
|
|
64
|
-
def remove_css_class(
|
|
65
|
-
|
|
75
|
+
def remove_css_class(targets = nil, classes = "", **attributes)
|
|
76
|
+
classes = attributes[:classes] || classes
|
|
77
|
+
classes = classes.join(" ") if classes.is_a?(Array)
|
|
78
|
+
|
|
79
|
+
custom_action_all :remove_css_class, targets: targets, attributes: attributes.merge(classes: classes)
|
|
66
80
|
end
|
|
67
81
|
|
|
68
|
-
def set_attribute(
|
|
69
|
-
custom_action_all :set_attribute, targets:
|
|
82
|
+
def set_attribute(targets = nil, attribute = nil, value = nil, **attributes)
|
|
83
|
+
custom_action_all :set_attribute, targets: targets, attributes: attributes.reverse_merge(attribute: attribute, value: value)
|
|
70
84
|
end
|
|
71
85
|
|
|
72
|
-
def set_dataset_attribute(
|
|
73
|
-
custom_action_all :set_dataset_attribute, targets:
|
|
86
|
+
def set_dataset_attribute(targets = nil, attribute = nil, value = nil, **attributes)
|
|
87
|
+
custom_action_all :set_dataset_attribute, targets: targets, attributes: attributes.reverse_merge(attribute: attribute, value: value)
|
|
74
88
|
end
|
|
75
89
|
|
|
76
|
-
def set_property(
|
|
77
|
-
custom_action_all :set_property, targets:
|
|
90
|
+
def set_property(targets = nil, name = nil, value = nil, **attributes)
|
|
91
|
+
custom_action_all :set_property, targets: targets, attributes: attributes.reverse_merge(name: name, value: value)
|
|
78
92
|
end
|
|
79
93
|
|
|
80
|
-
def set_style(
|
|
81
|
-
custom_action_all :set_style, targets:
|
|
94
|
+
def set_style(targets = nil, name = nil, value = nil, **attributes)
|
|
95
|
+
custom_action_all :set_style, targets: targets, attributes: attributes.reverse_merge(name: name, value: value)
|
|
82
96
|
end
|
|
83
97
|
|
|
84
|
-
def set_styles(
|
|
85
|
-
|
|
98
|
+
def set_styles(targets = nil, styles = nil, **attributes)
|
|
99
|
+
styles = attributes[:styles] || styles
|
|
100
|
+
styles = styles.map { |k, v| "#{k}: #{v}" }.join("; ") if styles.is_a?(Hash)
|
|
101
|
+
|
|
102
|
+
custom_action_all :set_styles, targets: targets, attributes: attributes.merge(styles: styles)
|
|
86
103
|
end
|
|
87
104
|
|
|
88
|
-
def set_value(
|
|
89
|
-
custom_action_all :set_value, targets:
|
|
105
|
+
def set_value(targets = nil, value = nil, **attributes)
|
|
106
|
+
custom_action_all :set_value, targets: targets, attributes: attributes.reverse_merge(value: value)
|
|
90
107
|
end
|
|
91
108
|
|
|
92
109
|
# Event Actions
|
|
93
110
|
|
|
94
|
-
def dispatch_event(
|
|
95
|
-
custom_action_all :dispatch_event, targets:
|
|
111
|
+
def dispatch_event(targets = nil, name = nil, detail: {}, **attributes)
|
|
112
|
+
custom_action_all :dispatch_event, targets: targets, content: detail.to_json, attributes: attributes.reverse_merge(name: name)
|
|
96
113
|
end
|
|
97
114
|
|
|
98
115
|
# Form Actions
|
|
99
116
|
|
|
100
|
-
def reset_form(
|
|
101
|
-
custom_action_all :reset_form, targets:
|
|
117
|
+
def reset_form(targets = nil, **attributes)
|
|
118
|
+
custom_action_all :reset_form, targets: targets, attributes: attributes
|
|
102
119
|
end
|
|
103
120
|
|
|
104
121
|
# Storage Actions
|
|
105
122
|
|
|
106
|
-
def clear_storage(type, **attributes)
|
|
107
|
-
custom_action :clear_storage, attributes: attributes.
|
|
123
|
+
def clear_storage(type = nil, **attributes)
|
|
124
|
+
custom_action :clear_storage, attributes: attributes.reverse_merge(type: type)
|
|
108
125
|
end
|
|
109
126
|
|
|
110
127
|
def clear_local_storage(**attributes)
|
|
@@ -115,27 +132,27 @@ module TurboPower
|
|
|
115
132
|
clear_storage("session", **attributes)
|
|
116
133
|
end
|
|
117
134
|
|
|
118
|
-
def remove_storage_item(key, type, **attributes)
|
|
119
|
-
custom_action :remove_storage_item, attributes: attributes.
|
|
135
|
+
def remove_storage_item(key = nil, type = nil, **attributes)
|
|
136
|
+
custom_action :remove_storage_item, attributes: attributes.reverse_merge(key: key, type: type)
|
|
120
137
|
end
|
|
121
138
|
|
|
122
|
-
def remove_local_storage_item(key, **attributes)
|
|
139
|
+
def remove_local_storage_item(key = nil, **attributes)
|
|
123
140
|
remove_storage_item(key, "local", **attributes)
|
|
124
141
|
end
|
|
125
142
|
|
|
126
|
-
def remove_session_storage_item(key, **attributes)
|
|
143
|
+
def remove_session_storage_item(key = nil, **attributes)
|
|
127
144
|
remove_storage_item(key, "session", **attributes)
|
|
128
145
|
end
|
|
129
146
|
|
|
130
|
-
def set_storage_item(key, value, type, **attributes)
|
|
131
|
-
custom_action :set_storage_item, attributes: attributes.
|
|
147
|
+
def set_storage_item(key = nil, value = nil, type = nil, **attributes)
|
|
148
|
+
custom_action :set_storage_item, attributes: attributes.reverse_merge(key: key, type: type, value: value)
|
|
132
149
|
end
|
|
133
150
|
|
|
134
|
-
def set_local_storage_item(key, value, **attributes)
|
|
151
|
+
def set_local_storage_item(key = nil, value = nil, **attributes)
|
|
135
152
|
set_storage_item(key, value, "local", **attributes)
|
|
136
153
|
end
|
|
137
154
|
|
|
138
|
-
def set_session_storage_item(key, value, **attributes)
|
|
155
|
+
def set_session_storage_item(key = nil, value = nil, **attributes)
|
|
139
156
|
set_storage_item(key, value, "session", **attributes)
|
|
140
157
|
end
|
|
141
158
|
|
|
@@ -145,38 +162,46 @@ module TurboPower
|
|
|
145
162
|
custom_action :reload, attributes: attributes
|
|
146
163
|
end
|
|
147
164
|
|
|
148
|
-
def scroll_into_view(
|
|
149
|
-
custom_action_all :scroll_into_view, targets:
|
|
165
|
+
def scroll_into_view(targets = nil, **attributes)
|
|
166
|
+
custom_action_all :scroll_into_view, targets: targets, attributes: attributes
|
|
150
167
|
end
|
|
151
168
|
|
|
152
|
-
def set_cookie(cookie, **attributes)
|
|
153
|
-
custom_action :set_cookie, attributes: attributes.
|
|
169
|
+
def set_cookie(cookie = nil, **attributes)
|
|
170
|
+
custom_action :set_cookie, attributes: attributes.reverse_merge(cookie: cookie)
|
|
154
171
|
end
|
|
155
172
|
|
|
156
173
|
def set_cookie_item(key = nil, value = nil, **attributes)
|
|
157
|
-
custom_action :set_cookie_item, attributes:
|
|
174
|
+
custom_action :set_cookie_item, attributes: attributes.reverse_merge(key: key, value: value)
|
|
158
175
|
end
|
|
159
176
|
|
|
160
|
-
def set_focus(
|
|
161
|
-
custom_action_all :set_focus, targets:
|
|
177
|
+
def set_focus(targets = nil, **attributes)
|
|
178
|
+
custom_action_all :set_focus, targets: targets, attributes: attributes
|
|
162
179
|
end
|
|
163
180
|
|
|
164
|
-
def set_title(title, **attributes)
|
|
165
|
-
custom_action :set_title, attributes: attributes.
|
|
181
|
+
def set_title(title = nil, **attributes)
|
|
182
|
+
custom_action :set_title, attributes: attributes.reverse_merge(title: title)
|
|
166
183
|
end
|
|
167
184
|
|
|
168
185
|
# Browser History Actions
|
|
169
186
|
|
|
170
|
-
def
|
|
171
|
-
custom_action :
|
|
187
|
+
def history_back(**attributes)
|
|
188
|
+
custom_action :history_back, attributes: attributes
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def history_forward(**attributes)
|
|
192
|
+
custom_action :history_forward, attributes: attributes
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def history_go(delta = 0, **attributes)
|
|
196
|
+
custom_action :history_go, attributes: attributes.reverse_merge(delta: delta)
|
|
172
197
|
end
|
|
173
198
|
|
|
174
|
-
def push_state(url, title =
|
|
175
|
-
custom_action :push_state, attributes: attributes.
|
|
199
|
+
def push_state(url = nil, title = "", state = {}, **attributes)
|
|
200
|
+
custom_action :push_state, attributes: attributes.reverse_merge(url: url, title: title, state: state)
|
|
176
201
|
end
|
|
177
202
|
|
|
178
|
-
def replace_state(url, title =
|
|
179
|
-
custom_action :replace_state, attributes: attributes.
|
|
203
|
+
def replace_state(url = nil, title = "", state = {}, **attributes)
|
|
204
|
+
custom_action :replace_state, attributes: attributes.reverse_merge(url: url, title: title, state: state)
|
|
180
205
|
end
|
|
181
206
|
|
|
182
207
|
# Debug Actions
|
|
@@ -185,20 +210,20 @@ module TurboPower
|
|
|
185
210
|
custom_action :console_log, attributes: attributes.reverse_merge(message: message, level: level)
|
|
186
211
|
end
|
|
187
212
|
|
|
188
|
-
def console_table(data, columns, **attributes)
|
|
189
|
-
custom_action :console_table, attributes: attributes.
|
|
213
|
+
def console_table(data = [], columns = [], **attributes)
|
|
214
|
+
custom_action :console_table, attributes: attributes.reverse_merge(data: data, columns: columns)
|
|
190
215
|
end
|
|
191
216
|
|
|
192
217
|
# Notification Actions
|
|
193
218
|
|
|
194
219
|
def notification(title = nil, **attributes)
|
|
195
|
-
custom_action :notification, attributes:
|
|
220
|
+
custom_action :notification, attributes: attributes.reverse_merge(title: title)
|
|
196
221
|
end
|
|
197
222
|
|
|
198
223
|
# Turbo Actions
|
|
199
224
|
|
|
200
|
-
def redirect_to(url = nil, turbo_action = "advance", **attributes)
|
|
201
|
-
custom_action :redirect_to, attributes:
|
|
225
|
+
def redirect_to(url = nil, turbo_action = "advance", turbo_frame = nil, **attributes)
|
|
226
|
+
custom_action :redirect_to, attributes: attributes.reverse_merge(url: url, turbo_action: turbo_action, turbo_frame: turbo_frame).compact
|
|
202
227
|
end
|
|
203
228
|
|
|
204
229
|
def turbo_clear_cache(**attributes)
|
|
@@ -215,18 +240,18 @@ module TurboPower
|
|
|
215
240
|
custom_action :turbo_progress_bar_hide, attributes: attributes
|
|
216
241
|
end
|
|
217
242
|
|
|
218
|
-
def turbo_progress_bar_set_value(value, **attributes)
|
|
219
|
-
custom_action :turbo_progress_bar_set_value, attributes: attributes.
|
|
243
|
+
def turbo_progress_bar_set_value(value = nil, **attributes)
|
|
244
|
+
custom_action :turbo_progress_bar_set_value, attributes: attributes.reverse_merge(value: value)
|
|
220
245
|
end
|
|
221
246
|
|
|
222
247
|
# Turbo Frame Actions
|
|
223
248
|
|
|
224
|
-
def turbo_frame_reload(
|
|
225
|
-
custom_action :turbo_frame_reload, target:
|
|
249
|
+
def turbo_frame_reload(target = nil, **attributes)
|
|
250
|
+
custom_action :turbo_frame_reload, target: target, attributes: attributes
|
|
226
251
|
end
|
|
227
252
|
|
|
228
|
-
def turbo_frame_set_src(
|
|
229
|
-
custom_action :turbo_frame_set_src, target:
|
|
253
|
+
def turbo_frame_set_src(target = nil, src = nil, **attributes)
|
|
254
|
+
custom_action :turbo_frame_set_src, target: target, attributes: attributes.reverse_merge(src: src)
|
|
230
255
|
end
|
|
231
256
|
end
|
|
232
257
|
end
|
data/lib/turbo_power/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: turbo_power
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marco Roth
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-09-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: turbo-rails
|
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
70
|
version: '0'
|
|
71
71
|
requirements: []
|
|
72
|
-
rubygems_version: 3.
|
|
72
|
+
rubygems_version: 3.3.26
|
|
73
73
|
signing_key:
|
|
74
74
|
specification_version: 4
|
|
75
75
|
summary: Power-pack for Turbo Streams
|