turbo_ready 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af0b62fe8b2388d16d3618854cc9d1b00dd1024d3769f5e87c92dce3682586c4
4
- data.tar.gz: 06d53211b87dd4bda3ee292a91860d99c374ffd190dd08650ff8fbe9ad54cfbe
3
+ metadata.gz: 84e74a8964537c211ee950824e5cab33421cd632888c954f8e1ad5f30a70fcd4
4
+ data.tar.gz: 1af940c593f7c8af7d8e12d1f61f710209277852432d61135351ffd8f6d431bc
5
5
  SHA512:
6
- metadata.gz: 114bd5e422668cf663a9848c499efb350cfacc907b2008f00a2cb55c82d76c9b505e296a68dbc34e8fdaa08a7f13f4da56a1ea6f678a99bead74d854cd6a7f0b
7
- data.tar.gz: 4ca3ba3dc2f673b9dd7d71b5c4ebdd635fca0097c942b7b51718a4eefbe205f3285380b9f6bb9dfe08ec6363a3837417bb3e43106d8c033d021b9d20299bb98d
6
+ metadata.gz: 60770246c2a8d176d25dd082bd601444153e4aff8d7c622b80120f85e8158b27dfeba7893b5502ad4387efb14b6deb608b86a85d691cc0fa66bccbdb24ec3aad
7
+ data.tar.gz: f5c450f5affaba551a74877e90eb943ff65e39a831ed597cca47094f9940f000e39a7fa802412985129f7af5d22ae3b313844a10e23eab3fe670b32ffc0ed2d5
data/Dockerfile ADDED
@@ -0,0 +1,27 @@
1
+ FROM ruby:3.1.2
2
+
3
+ RUN apt-get -y update && \
4
+ apt-get -y upgrade && \
5
+ apt-get -y --force-yes install build-essential sqlite3 tzdata && \
6
+ apt-get clean
7
+
8
+ COPY . /opt/turbo_ready
9
+ WORKDIR /opt/turbo_ready/test/dummy
10
+
11
+ VOLUME /usr/local/bundle
12
+
13
+ RUN gem update --system && \
14
+ gem install bundler && \
15
+ rm -f Gemfile.lock && \
16
+ bundle --without test && \
17
+ bundle update --bundler && \
18
+ bundle lock --add-platform x86_64-linux && \
19
+ bundle --without test
20
+
21
+ ENV RAILS_ENV=production
22
+ CMD rm -f tmp/pids/server.pid && \
23
+ bin/rails db:create db:migrate && \
24
+ bin/rails log:clear && \
25
+ bin/rails assets:clobber && \
26
+ bin/rails assets:precompile && \
27
+ bin/rails s --binding=0.0.0.0 --port=3000
data/Gemfile.lock CHANGED
@@ -1,81 +1,83 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- turbo_ready (0.0.6)
4
+ turbo_ready (0.1.0)
5
5
  rails (>= 6.1)
6
6
  turbo-rails (>= 1.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.3.1)
12
- actionpack (= 7.0.3.1)
13
- activesupport (= 7.0.3.1)
11
+ actioncable (7.0.4)
12
+ actionpack (= 7.0.4)
13
+ activesupport (= 7.0.4)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.3.1)
17
- actionpack (= 7.0.3.1)
18
- activejob (= 7.0.3.1)
19
- activerecord (= 7.0.3.1)
20
- activestorage (= 7.0.3.1)
21
- activesupport (= 7.0.3.1)
16
+ actionmailbox (7.0.4)
17
+ actionpack (= 7.0.4)
18
+ activejob (= 7.0.4)
19
+ activerecord (= 7.0.4)
20
+ activestorage (= 7.0.4)
21
+ activesupport (= 7.0.4)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.0.3.1)
27
- actionpack (= 7.0.3.1)
28
- actionview (= 7.0.3.1)
29
- activejob (= 7.0.3.1)
30
- activesupport (= 7.0.3.1)
26
+ actionmailer (7.0.4)
27
+ actionpack (= 7.0.4)
28
+ actionview (= 7.0.4)
29
+ activejob (= 7.0.4)
30
+ activesupport (= 7.0.4)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.0)
36
- actionpack (7.0.3.1)
37
- actionview (= 7.0.3.1)
38
- activesupport (= 7.0.3.1)
36
+ actionpack (7.0.4)
37
+ actionview (= 7.0.4)
38
+ activesupport (= 7.0.4)
39
39
  rack (~> 2.0, >= 2.2.0)
40
40
  rack-test (>= 0.6.3)
41
41
  rails-dom-testing (~> 2.0)
42
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.3.1)
44
- actionpack (= 7.0.3.1)
45
- activerecord (= 7.0.3.1)
46
- activestorage (= 7.0.3.1)
47
- activesupport (= 7.0.3.1)
43
+ actiontext (7.0.4)
44
+ actionpack (= 7.0.4)
45
+ activerecord (= 7.0.4)
46
+ activestorage (= 7.0.4)
47
+ activesupport (= 7.0.4)
48
48
  globalid (>= 0.6.0)
49
49
  nokogiri (>= 1.8.5)
50
- actionview (7.0.3.1)
51
- activesupport (= 7.0.3.1)
50
+ actionview (7.0.4)
51
+ activesupport (= 7.0.4)
52
52
  builder (~> 3.1)
53
53
  erubi (~> 1.4)
54
54
  rails-dom-testing (~> 2.0)
55
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.3.1)
57
- activesupport (= 7.0.3.1)
56
+ activejob (7.0.4)
57
+ activesupport (= 7.0.4)
58
58
  globalid (>= 0.3.6)
59
- activemodel (7.0.3.1)
60
- activesupport (= 7.0.3.1)
61
- activerecord (7.0.3.1)
62
- activemodel (= 7.0.3.1)
63
- activesupport (= 7.0.3.1)
64
- activestorage (7.0.3.1)
65
- actionpack (= 7.0.3.1)
66
- activejob (= 7.0.3.1)
67
- activerecord (= 7.0.3.1)
68
- activesupport (= 7.0.3.1)
59
+ activemodel (7.0.4)
60
+ activesupport (= 7.0.4)
61
+ activerecord (7.0.4)
62
+ activemodel (= 7.0.4)
63
+ activesupport (= 7.0.4)
64
+ activestorage (7.0.4)
65
+ actionpack (= 7.0.4)
66
+ activejob (= 7.0.4)
67
+ activerecord (= 7.0.4)
68
+ activesupport (= 7.0.4)
69
69
  marcel (~> 1.0)
70
70
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.3.1)
71
+ activesupport (7.0.4)
72
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
73
  i18n (>= 1.6, < 2)
74
74
  minitest (>= 5.1)
75
75
  tzinfo (~> 2.0)
76
76
  addressable (2.8.1)
77
77
  public_suffix (>= 2.0.2, < 6.0)
78
+ ansi (1.5.0)
78
79
  ast (2.4.2)
80
+ bindex (0.8.1)
79
81
  builder (3.2.4)
80
82
  byebug (11.1.3)
81
83
  capybara (3.37.1)
@@ -88,11 +90,20 @@ GEM
88
90
  regexp_parser (>= 1.5, < 3.0)
89
91
  xpath (~> 3.2)
90
92
  childprocess (4.1.0)
93
+ cliver (0.3.2)
91
94
  coderay (1.1.3)
92
95
  concurrent-ruby (1.1.10)
93
96
  crass (1.0.6)
97
+ cuprite (0.13)
98
+ capybara (>= 2.1, < 4)
99
+ ferrum (~> 0.11.0)
94
100
  digest (3.1.0)
95
101
  erubi (1.11.0)
102
+ ferrum (0.11)
103
+ addressable (~> 2.5)
104
+ cliver (~> 0.3)
105
+ concurrent-ruby (~> 1.1)
106
+ websocket-driver (>= 0.6, < 0.8)
96
107
  globalid (1.0.0)
97
108
  activesupport (>= 5.0)
98
109
  i18n (1.12.0)
@@ -101,7 +112,7 @@ GEM
101
112
  actionpack (>= 6.0.0)
102
113
  railties (>= 6.0.0)
103
114
  json (2.6.2)
104
- loofah (2.18.0)
115
+ loofah (2.19.0)
105
116
  crass (~> 1.0.2)
106
117
  nokogiri (>= 1.5.9)
107
118
  magic_frozen_string_literal (1.2.0)
@@ -111,7 +122,13 @@ GEM
111
122
  matrix (0.4.2)
112
123
  method_source (1.0.0)
113
124
  mini_mime (1.1.2)
125
+ mini_portile2 (2.8.0)
114
126
  minitest (5.16.3)
127
+ minitest-reporters (1.5.0)
128
+ ansi
129
+ builder
130
+ minitest (>= 5.0)
131
+ ruby-progressbar
115
132
  net-imap (0.2.3)
116
133
  digest
117
134
  net-protocol
@@ -127,6 +144,11 @@ GEM
127
144
  net-protocol
128
145
  timeout
129
146
  nio4r (2.5.8)
147
+ nokogiri (1.13.8)
148
+ mini_portile2 (~> 2.8.0)
149
+ racc (~> 1.4)
150
+ nokogiri (1.13.8-aarch64-linux)
151
+ racc (~> 1.4)
130
152
  nokogiri (1.13.8-arm64-darwin)
131
153
  racc (~> 1.4)
132
154
  parallel (1.22.1)
@@ -145,28 +167,28 @@ GEM
145
167
  rack (2.2.4)
146
168
  rack-test (2.0.2)
147
169
  rack (>= 1.3)
148
- rails (7.0.3.1)
149
- actioncable (= 7.0.3.1)
150
- actionmailbox (= 7.0.3.1)
151
- actionmailer (= 7.0.3.1)
152
- actionpack (= 7.0.3.1)
153
- actiontext (= 7.0.3.1)
154
- actionview (= 7.0.3.1)
155
- activejob (= 7.0.3.1)
156
- activemodel (= 7.0.3.1)
157
- activerecord (= 7.0.3.1)
158
- activestorage (= 7.0.3.1)
159
- activesupport (= 7.0.3.1)
170
+ rails (7.0.4)
171
+ actioncable (= 7.0.4)
172
+ actionmailbox (= 7.0.4)
173
+ actionmailer (= 7.0.4)
174
+ actionpack (= 7.0.4)
175
+ actiontext (= 7.0.4)
176
+ actionview (= 7.0.4)
177
+ activejob (= 7.0.4)
178
+ activemodel (= 7.0.4)
179
+ activerecord (= 7.0.4)
180
+ activestorage (= 7.0.4)
181
+ activesupport (= 7.0.4)
160
182
  bundler (>= 1.15.0)
161
- railties (= 7.0.3.1)
183
+ railties (= 7.0.4)
162
184
  rails-dom-testing (2.0.3)
163
185
  activesupport (>= 4.2.0)
164
186
  nokogiri (>= 1.6)
165
187
  rails-html-sanitizer (1.4.3)
166
188
  loofah (~> 2.3)
167
- railties (7.0.3.1)
168
- actionpack (= 7.0.3.1)
169
- activesupport (= 7.0.3.1)
189
+ railties (7.0.4)
190
+ actionpack (= 7.0.4)
191
+ activesupport (= 7.0.4)
170
192
  method_source
171
193
  rake (>= 12.2)
172
194
  thor (~> 1.0)
@@ -175,6 +197,7 @@ GEM
175
197
  rake (13.0.6)
176
198
  regexp_parser (2.5.0)
177
199
  rexml (3.2.5)
200
+ rouge (4.0.0)
178
201
  rubocop (1.35.1)
179
202
  json (~> 2.3)
180
203
  parallel (~> 1.10)
@@ -204,13 +227,22 @@ GEM
204
227
  actionpack (>= 5.2)
205
228
  activesupport (>= 5.2)
206
229
  sprockets (>= 3.0.0)
207
- sqlite3 (1.4.4)
230
+ sqlite3 (1.5.0)
231
+ mini_portile2 (~> 2.8.0)
232
+ sqlite3 (1.5.0-aarch64-linux)
233
+ sqlite3 (1.5.0-arm64-darwin)
208
234
  standard (1.16.1)
209
235
  rubocop (= 1.35.1)
210
236
  rubocop-performance (= 1.14.3)
211
237
  standardrb (1.0.1)
212
238
  standard
213
239
  strscan (3.0.4)
240
+ tailwindcss-rails (2.0.13)
241
+ railties (>= 6.0.0)
242
+ tailwindcss-rails (2.0.13-aarch64-linux)
243
+ railties (>= 6.0.0)
244
+ tailwindcss-rails (2.0.13-arm64-darwin)
245
+ railties (>= 6.0.0)
214
246
  thor (1.2.1)
215
247
  timeout (0.3.0)
216
248
  turbo-rails (1.1.1)
@@ -219,8 +251,13 @@ GEM
219
251
  railties (>= 6.0.0)
220
252
  tzinfo (2.0.5)
221
253
  concurrent-ruby (~> 1.0)
222
- unicode-display_width (2.2.0)
223
- webdrivers (5.0.0)
254
+ unicode-display_width (2.3.0)
255
+ web-console (4.2.0)
256
+ actionview (>= 6.0.0)
257
+ activemodel (>= 6.0.0)
258
+ bindex (>= 0.4.0)
259
+ railties (>= 6.0.0)
260
+ webdrivers (5.1.0)
224
261
  nokogiri (~> 1.6)
225
262
  rubyzip (>= 1.3.0)
226
263
  selenium-webdriver (~> 4.0)
@@ -233,22 +270,28 @@ GEM
233
270
  zeitwerk (2.6.0)
234
271
 
235
272
  PLATFORMS
273
+ aarch64-linux
236
274
  arm64-darwin-21
275
+ ruby
237
276
 
238
277
  DEPENDENCIES
239
278
  capybara
279
+ cuprite
240
280
  importmap-rails
241
281
  magic_frozen_string_literal
282
+ minitest-reporters
242
283
  net-smtp
243
284
  pry-byebug
244
285
  puma
245
286
  rake
246
287
  rexml
247
- selenium-webdriver
288
+ rouge
248
289
  sprockets-rails
249
290
  sqlite3
250
291
  standardrb
292
+ tailwindcss-rails
251
293
  turbo_ready!
294
+ web-console
252
295
  webdrivers
253
296
 
254
297
  BUNDLED WITH
data/README.md CHANGED
@@ -11,28 +11,28 @@
11
11
  </h1>
12
12
  <p align="center">
13
13
  <a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/">
14
- <img alt="Lines of Code" src="https://img.shields.io/badge/loc-143-47d299.svg" />
14
+ <img alt="Lines of Code" src="https://img.shields.io/badge/loc-140-47d299.svg" />
15
15
  </a>
16
16
  <a href="https://codeclimate.com/github/hopsoft/turbo_ready/maintainability">
17
17
  <img src="https://api.codeclimate.com/v1/badges/a69b6f73abc3ccd49261/maintainability" />
18
18
  </a>
19
19
  <a href="https://rubygems.org/gems/turbo_ready">
20
- <img alt="GEM" src="https://img.shields.io/gem/v/turbo_ready?color=168AFE&include_prereleases&logo=ruby&logoColor=FE1616">
20
+ <img alt="GEM Version" src="https://img.shields.io/gem/v/turbo_ready?color=168AFE&include_prereleases&logo=ruby&logoColor=FE1616">
21
21
  </a>
22
22
  <a href="https://rubygems.org/gems/turbo_ready">
23
- <img alt="Gem" src="https://img.shields.io/gem/dt/turbo_ready?color=168AFE&logo=ruby&logoColor=FE1616">
23
+ <img alt="GEM Downloads" src="https://img.shields.io/gem/dt/turbo_ready?color=168AFE&logo=ruby&logoColor=FE1616">
24
24
  </a>
25
25
  <a href="https://github.com/testdouble/standard">
26
26
  <img alt="Ruby Style" src="https://img.shields.io/badge/style-standard-168AFE?logo=ruby&logoColor=FE1616" />
27
27
  </a>
28
28
  <a href="https://www.npmjs.com/package/turbo_ready">
29
- <img alt="NPM" src="https://img.shields.io/npm/v/turbo_ready?color=168AFE&logo=npm">
29
+ <img alt="NPM Version" src="https://img.shields.io/npm/v/turbo_ready?color=168AFE&logo=npm">
30
30
  </a>
31
31
  <a href="https://www.npmjs.com/package/turbo_ready">
32
- <img alt="npm" src="https://img.shields.io/npm/dm/turbo_ready?color=168AFE&logo=npm">
32
+ <img alt="NPM Downloads" src="https://img.shields.io/npm/dm/turbo_ready?color=168AFE&logo=npm">
33
33
  </a>
34
34
  <a href="https://bundlephobia.com/package/turbo_ready@">
35
- <img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/turbo_ready?label=bundle%20size&logo=npm&color=47d299">
35
+ <img alt="NPM Bundle Size" src="https://img.shields.io/bundlephobia/minzip/turbo_ready?label=bundle%20size&logo=npm&color=47d299">
36
36
  </a>
37
37
  <a href="https://github.com/sheerun/prettier-standard">
38
38
  <img alt="JavaScript Style" src="https://img.shields.io/badge/style-prettier--standard-168AFE?logo=javascript&logoColor=f4e137" />
@@ -67,7 +67,7 @@ You can `invoke` any DOM method on the client with Turbo Streams.
67
67
  - [Setup](#setup)
68
68
  - [Usage](#usage)
69
69
  - [Method Chaining](#method-chaining)
70
- - [Dispatching Events](#dispatching-events)
70
+ - [Event Dispatch](#event-dispatch)
71
71
  - [Syntax Styles](#syntax-styles)
72
72
  - [Extending Behavior](#extending-behavior)
73
73
  - [Implementation Details](#implementation-details)
@@ -114,7 +114,7 @@ This is because CableReady already provides a rich set of powerful [DOM operatio
114
114
 
115
115
  - [rails](https://rubygems.org/gems/rails) `>=6.1`
116
116
  - [turbo-rails](https://rubygems.org/gems/turbo-rails) `>=1.1`
117
- - [@hotwired/turbo-rails](https://yarnpkg.com/package/@hotwired/turbo-rails) `>=7.2.0-beta.2`
117
+ - [@hotwired/turbo-rails](https://yarnpkg.com/package/@hotwired/turbo-rails) `>=7.2.0-rc.2`
118
118
 
119
119
  ## Installation
120
120
 
@@ -137,7 +137,7 @@ Import and intialize TurboReady in your application.
137
137
  ```diff
138
138
  # package.json
139
139
  "dependencies": {
140
- + "@hotwired/turbo-rails": ">=7.2.0-beta.2",
140
+ "@hotwired/turbo-rails": ">=7.2.0-rc.2",
141
141
  + "turbo_ready": "^0.0.6"
142
142
  ```
143
143
 
@@ -169,20 +169,18 @@ turbo_stream
169
169
  .invoke("document.body.insertAdjacentHTML", args: ["afterbegin", "<h1>Hello World!</h1>"]) # dot notation
170
170
  .invoke("setAttribute", args: ["data-turbo-ready", true], selector: ".button") # selector
171
171
  .invoke("classList.add", args: ["turbo-ready"], selector: "a") # dot notation + selector
172
- .flush # call flush when chaining invocations
173
172
  ```
174
173
 
175
- ### Dispatching Events
174
+ ### Event Dispatch
176
175
 
177
176
  It's possible to fire events on `window`, `document`, and element(s).
178
177
 
179
178
  ```ruby
180
179
  turbo_stream
181
- .invoke("dispatchEvent", args: ["turbo-ready:demo"]) # fires on window
180
+ .invoke(:dispatch_event, args: ["turbo-ready:demo"]) # fires on window
182
181
  .invoke("document.dispatchEvent", args: ["turbo-ready:demo"]) # fires on document
183
- .invoke("dispatchEvent", args: ["turbo-ready:demo"], selector: "#my-element") # fires on matching element(s)
184
- .invoke("dispatchEvent", args: ["turbo-ready:demo", {bubbles: true, detail: {...}}]) # set event options
185
- .flush
182
+ .invoke(:dispatch_event, args: ["turbo-ready:demo"], selector: "#my-element") # fires on matching element(s)
183
+ .invoke(:dispatch_event, args: ["turbo-ready:demo", {bubbles: true, detail: {...}}]) # set event options
186
184
  ```
187
185
 
188
186
  ### Syntax Styles
@@ -191,7 +189,7 @@ You can use [`snake_case`](https://en.wikipedia.org/wiki/Snake_case) when invoki
191
189
  It will implicitly convert to [`camelCase`](https://en.wikipedia.org/wiki/Camel_case).
192
190
 
193
191
  ```ruby
194
- turbo_stream.invoke :dispatch_event,
192
+ turbo_stream.invoke :event,
195
193
  args: ["turbo-ready:demo", {detail: {converts_to_camel_case: true}}]
196
194
  ```
197
195
 
@@ -252,14 +250,14 @@ turbo_stream
252
250
  The following Ruby code,
253
251
 
254
252
  ```ruby
255
- turbo_stream.invoke "console.log", args: ["Hello World!"], id: "1"
253
+ turbo_stream.invoke "console.log", args: ["Hello World!"], id: "123ABC"
256
254
  ```
257
255
 
258
256
  emits this HTML markup.
259
257
 
260
258
  ```html
261
259
  <turbo-stream action="invoke" target="DOM">
262
- <template>{"id":"1","receiver":"console","method":"log","args":["Hello World!"]}</template>
260
+ <template>{"id":"123ABC","receiver":"console","method":"log","args":["Hello World!"]}</template>
263
261
  </turbo-stream>
264
262
  ```
265
263
 
@@ -387,11 +385,6 @@ Connect with the core team on Twitter.
387
385
  <img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/hopsoft?logo=twitter&style=social">
388
386
  </a>
389
387
 
390
- ## TODOs
391
-
392
- - [ ] Add system tests [(review turbo-rails for guidance)](https://github.com/hotwired/turbo-rails/blob/main/test/system/broadcasts_test.rb)
393
- - [ ] Look into adding method chaining for broadcasts
394
-
395
388
  ## Releasing
396
389
 
397
390
  1. Run `yarn` and `bundle` to pick up the latest
@@ -1,2 +1,2 @@
1
- function l(){let n=JSON.parse(this.templateContent.textContent),{id:h,selector:c,receiver:a,method:r,args:i}=n,t=[self];switch(c&&(t=Array.from(document.querySelectorAll(c))),a&&(t=t.map(o=>{let e=o,s=a.split(".");for(;s.length>0;)e=e[s.shift()];return e})),r){case"dispatchEvent":let o=new CustomEvent(i[0],i[1]||{});t.forEach(e=>e.dispatchEvent(o));break;default:t.forEach(e=>e[r].apply(e,i))}}function f(n){n.invoke=l}var p={initialize:f};export{p as default};
1
+ function f(i,a,o={}){let r=new CustomEvent(a,o);i.forEach(t=>t.dispatchEvent(r))}function h(){let i=JSON.parse(this.templateContent.textContent),{id:a,selector:o,receiver:r,method:t,args:c}=i,e=[self];if(o&&(e=Array.from(document.querySelectorAll(o))),r&&(e=e.map(n=>{let s=n,l=r.split(".");for(;l.length>0;)s=s[l.shift()];return s})),t==="dispatchEvent")return f(e,c[0],c[1]||{});if(t.endsWith("="))return e.forEach(n=>n[t.slice(0,-1).trim()]=c[0]);e.forEach(n=>n[t].apply(n,c))}function p(i){i.invoke=h}var u={initialize:p};export{u as default};
2
2
  //# sourceMappingURL=turbo_ready.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../javascript/turbo_ready.js"],
4
- "sourcesContent": ["function invoke () {\n const payload = JSON.parse(this.templateContent.textContent)\n const { id, selector, receiver, method, args } = payload\n let receivers = [self]\n if (selector) receivers = Array.from(document.querySelectorAll(selector))\n\n if (receiver) {\n receivers = receivers.map(r => {\n let context = r\n const chain = receiver.split('.')\n while (chain.length > 0) context = context[chain.shift()]\n return context\n })\n }\n\n switch (method) {\n case 'dispatchEvent':\n const evt = new CustomEvent(args[0], args[1] || {})\n receivers.forEach(r => r.dispatchEvent(evt))\n break\n default:\n receivers.forEach(r => r[method].apply(r, args))\n }\n}\n\nfunction initialize (streamActions) {\n streamActions.invoke = invoke\n}\n\nexport default { initialize }\n"],
5
- "mappings": "AAAA,SAASA,GAAU,CACjB,IAAMC,EAAU,KAAK,MAAM,KAAK,gBAAgB,WAAW,EACrD,CAAE,GAAAC,EAAI,SAAAC,EAAU,SAAAC,EAAU,OAAAC,EAAQ,KAAAC,CAAK,EAAIL,EAC7CM,EAAY,CAAC,IAAI,EAYrB,OAXIJ,IAAUI,EAAY,MAAM,KAAK,SAAS,iBAAiBJ,CAAQ,CAAC,GAEpEC,IACFG,EAAYA,EAAU,IAAIC,GAAK,CAC7B,IAAIC,EAAUD,EACRE,EAAQN,EAAS,MAAM,GAAG,EAChC,KAAOM,EAAM,OAAS,GAAGD,EAAUA,EAAQC,EAAM,MAAM,GACvD,OAAOD,CACT,CAAC,GAGKJ,OACD,gBACH,IAAMM,EAAM,IAAI,YAAYL,EAAK,GAAIA,EAAK,IAAM,CAAC,CAAC,EAClDC,EAAU,QAAQC,GAAKA,EAAE,cAAcG,CAAG,CAAC,EAC3C,cAEAJ,EAAU,QAAQC,GAAKA,EAAEH,GAAQ,MAAMG,EAAGF,CAAI,CAAC,EAErD,CAEA,SAASM,EAAYC,EAAe,CAClCA,EAAc,OAASb,CACzB,CAEA,IAAOc,EAAQ,CAAE,WAAAF,CAAW",
6
- "names": ["invoke", "payload", "id", "selector", "receiver", "method", "args", "receivers", "r", "context", "chain", "evt", "initialize", "streamActions", "turbo_ready_default"]
4
+ "sourcesContent": ["function dispatch (targets, name, options = {}) {\n const evt = new CustomEvent(name, options)\n targets.forEach(t => t.dispatchEvent(evt))\n}\n\nfunction invoke () {\n const payload = JSON.parse(this.templateContent.textContent)\n const { id, selector, receiver, method, args } = payload\n let receivers = [self]\n if (selector) receivers = Array.from(document.querySelectorAll(selector))\n\n if (receiver) {\n receivers = receivers.map(r => {\n let context = r\n const chain = receiver.split('.')\n while (chain.length > 0) context = context[chain.shift()]\n return context\n })\n }\n\n // event dispatch\n if (method === 'dispatchEvent')\n return dispatch(receivers, args[0], args[1] || {})\n\n // property assignment\n if (method.endsWith('='))\n return receivers.forEach(r => (r[method.slice(0, -1).trim()] = args[0]))\n\n // method invocation\n receivers.forEach(r => r[method].apply(r, args))\n}\n\nfunction initialize (streamActions) {\n streamActions.invoke = invoke\n}\n\nexport default { initialize }\n"],
5
+ "mappings": "AAAA,SAASA,EAAUC,EAASC,EAAMC,EAAU,CAAC,EAAG,CAC9C,IAAMC,EAAM,IAAI,YAAYF,EAAMC,CAAO,EACzCF,EAAQ,QAAQ,GAAK,EAAE,cAAcG,CAAG,CAAC,CAC3C,CAEA,SAASC,GAAU,CACjB,IAAMC,EAAU,KAAK,MAAM,KAAK,gBAAgB,WAAW,EACrD,CAAE,GAAAC,EAAI,SAAAC,EAAU,SAAAC,EAAU,OAAAC,EAAQ,KAAAC,CAAK,EAAIL,EAC7CM,EAAY,CAAC,IAAI,EAarB,GAZIJ,IAAUI,EAAY,MAAM,KAAK,SAAS,iBAAiBJ,CAAQ,CAAC,GAEpEC,IACFG,EAAYA,EAAU,IAAIC,GAAK,CAC7B,IAAIC,EAAUD,EACRE,EAAQN,EAAS,MAAM,GAAG,EAChC,KAAOM,EAAM,OAAS,GAAGD,EAAUA,EAAQC,EAAM,MAAM,GACvD,OAAOD,CACT,CAAC,GAICJ,IAAW,gBACb,OAAOV,EAASY,EAAWD,EAAK,GAAIA,EAAK,IAAM,CAAC,CAAC,EAGnD,GAAID,EAAO,SAAS,GAAG,EACrB,OAAOE,EAAU,QAAQC,GAAMA,EAAEH,EAAO,MAAM,EAAG,EAAE,EAAE,KAAK,GAAKC,EAAK,EAAG,EAGzEC,EAAU,QAAQC,GAAKA,EAAEH,GAAQ,MAAMG,EAAGF,CAAI,CAAC,CACjD,CAEA,SAASK,EAAYC,EAAe,CAClCA,EAAc,OAASZ,CACzB,CAEA,IAAOa,EAAQ,CAAE,WAAAF,CAAW",
6
+ "names": ["dispatch", "targets", "name", "options", "evt", "invoke", "payload", "id", "selector", "receiver", "method", "args", "receivers", "r", "context", "chain", "initialize", "streamActions", "turbo_ready_default"]
7
7
  }
@@ -1,3 +1,8 @@
1
+ function dispatch (targets, name, options = {}) {
2
+ const evt = new CustomEvent(name, options)
3
+ targets.forEach(t => t.dispatchEvent(evt))
4
+ }
5
+
1
6
  function invoke () {
2
7
  const payload = JSON.parse(this.templateContent.textContent)
3
8
  const { id, selector, receiver, method, args } = payload
@@ -13,14 +18,16 @@ function invoke () {
13
18
  })
14
19
  }
15
20
 
16
- switch (method) {
17
- case 'dispatchEvent':
18
- const evt = new CustomEvent(args[0], args[1] || {})
19
- receivers.forEach(r => r.dispatchEvent(evt))
20
- break
21
- default:
22
- receivers.forEach(r => r[method].apply(r, args))
23
- }
21
+ // event dispatch
22
+ if (method === 'dispatchEvent')
23
+ return dispatch(receivers, args[0], args[1] || {})
24
+
25
+ // property assignment
26
+ if (method.endsWith('='))
27
+ return receivers.forEach(r => (r[method.slice(0, -1).trim()] = args[0]))
28
+
29
+ // method invocation
30
+ receivers.forEach(r => r[method].apply(r, args))
24
31
  }
25
32
 
26
33
  function initialize (streamActions) {
data/bin/loc CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/bin/bash
2
2
 
3
- cloc --exclude-ext=svg app lib
3
+ cloc --exclude-dir=assets app lib
data/bin/standardize CHANGED
@@ -2,4 +2,7 @@
2
2
 
3
3
  bundle exec magic_frozen_string_literal
4
4
  bundle exec standardrb --fix
5
- yarn run prettier-standard "app/javascript/**/*.js"
5
+ yarn run prettier-standard app/javascript/**/*.js
6
+ yarn run prettier-standard test/dummy/app/javascript/**/*.js
7
+ yarn run rustywind --write test/dummy/app
8
+ yarn run rustywind --write --custom-regex "(:\s[\"'])(.+)[\"']" test/dummy/app/views/_tailwind.yml.erb
@@ -0,0 +1,45 @@
1
+ version: "3.9"
2
+
3
+ x-default-app: &default_app
4
+ build: .
5
+ image: turbo_ready
6
+ tty: true
7
+ stdin_open: true
8
+ working_dir: /opt/turbo_ready/test/dummy
9
+ environment:
10
+ RAILS_ENV: development
11
+ volumes:
12
+ - ./:/opt/turbo_ready:cached
13
+ - bundle:/usr/local/bundle:delegated
14
+ - node_modules:/opt/turbo_ready/node_modules:delegated
15
+
16
+ volumes:
17
+ bundle:
18
+ node_modules:
19
+
20
+ services:
21
+ # ----------------------------------------------------------------------------
22
+ # Shell - Intended for tinkering and running misc commands
23
+ # ----------------------------------------------------------------------------
24
+ shell:
25
+ <<: *default_app
26
+ container_name: turbo_ready-shell
27
+ command: /bin/bash -c "tail -f /dev/null"
28
+
29
+ # ----------------------------------------------------------------------------
30
+ # Web - Runs the test/dummy Rails app
31
+ # ----------------------------------------------------------------------------
32
+ web:
33
+ <<: *default_app
34
+ container_name: turbo_ready-web
35
+ ports:
36
+ - 3000:3000
37
+ command: >
38
+ /bin/bash -c "rm -f tmp/pids/server.pid &&
39
+ bundle --without test &&
40
+ bundle lock --add-platform aarch64-linux &&
41
+ bin/rails db:create db:migrate &&
42
+ bin/rails log:clear &&
43
+ bin/rails assets:clobber &&
44
+ bin/rails assets:precompile &&
45
+ bin/rails s --binding=0.0.0.0 --port=3000"
data/fly.toml ADDED
@@ -0,0 +1,38 @@
1
+ # fly.toml file generated for turbo-ready on 2022-09-19T05:16:01-06:00
2
+
3
+ app = "turbo-ready"
4
+ kill_signal = "SIGINT"
5
+ kill_timeout = 5
6
+ processes = []
7
+
8
+ [env]
9
+
10
+ [experimental]
11
+ allowed_public_ports = []
12
+ auto_rollback = true
13
+
14
+ [[services]]
15
+ http_checks = []
16
+ internal_port = 3000
17
+ processes = ["app"]
18
+ protocol = "tcp"
19
+ script_checks = []
20
+ [services.concurrency]
21
+ hard_limit = 25
22
+ soft_limit = 20
23
+ type = "connections"
24
+
25
+ [[services.ports]]
26
+ force_https = true
27
+ handlers = ["http"]
28
+ port = 80
29
+
30
+ [[services.ports]]
31
+ handlers = ["tls", "http"]
32
+ port = 443
33
+
34
+ [[services.tcp_checks]]
35
+ grace_period = "1s"
36
+ interval = "15s"
37
+ restart_limit = 0
38
+ timeout = "2s"
@@ -16,14 +16,10 @@ class TurboReady::StringWrapper
16
16
  TurboReady::StringWrapper.new turbo_stream_invoke_tag(...), turbo_stream_strings: turbo_stream_strings
17
17
  end
18
18
 
19
- def flush
19
+ def to_s
20
20
  turbo_stream_strings.to_a.join("\n").html_safe
21
- ensure
22
- turbo_stream_strings.clear
23
21
  end
24
22
 
25
- alias_method :to_s, :flush
26
-
27
23
  private
28
24
 
29
25
  def turbo_stream_strings
@@ -17,7 +17,7 @@ module TurboReady::TagHelper
17
17
  args = camelize_args(args)
18
18
  end
19
19
 
20
- method_parts = method.to_s.split(".")
20
+ method_parts = method.to_s.split(".").map(&:strip).select(&:present?)
21
21
 
22
22
  HashWithIndifferentAccess.new(
23
23
  receiver: method_parts[0..-2].join("."),
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TurboReady
4
- VERSION = "0.0.6"
4
+ VERSION = "0.1.0"
5
5
  end