turbo_ready 0.0.2 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -1
- data/README.md +6 -9
- data/app/assets/builds/turbo_ready.js +1 -1
- data/app/assets/builds/turbo_ready.js.map +3 -3
- data/app/javascript/turbo_ready.js +1 -1
- data/lib/turbo_ready/railtie.rb +6 -0
- data/lib/turbo_ready/string.rb +2 -0
- data/lib/turbo_ready/version.rb +1 -1
- data/package.json +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: 49adf06ca42cd8446e06096b63f685f0ccd145309e0b7a3a44b3f6a3814888cf
|
4
|
+
data.tar.gz: '01680461dbe9c06341d3f37e7376ead03a961edcd5793d121db60c436f768352'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22bf305821c44a16923d89bbd7a5844a15a6e39b331d76011199ee062cfcbfd32fa06b44bbbaaa8f794fbffbec733aef44e07d14dcbf81146f208b8ec2238bc0
|
7
|
+
data.tar.gz: c7b3acb2078e06f0455f17d068796550304c2989a8d3c03d1d1e8c729a90f4811eec9dc854a7d195abf9da02c4e0b6237a1474550b79453ace208e1cea1510cb
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
turbo_ready (0.0.
|
4
|
+
turbo_ready (0.0.5)
|
5
5
|
rails (>= 6.1)
|
6
6
|
turbo-rails (>= 1.1)
|
7
7
|
|
@@ -132,6 +132,8 @@ GEM
|
|
132
132
|
racc (~> 1.4)
|
133
133
|
nokogiri (1.13.8-arm64-darwin)
|
134
134
|
racc (~> 1.4)
|
135
|
+
nokogiri (1.13.8-x86_64-linux)
|
136
|
+
racc (~> 1.4)
|
135
137
|
parallel (1.22.1)
|
136
138
|
parser (3.1.2.1)
|
137
139
|
ast (~> 2.4.1)
|
@@ -237,6 +239,7 @@ GEM
|
|
237
239
|
PLATFORMS
|
238
240
|
aarch64-linux-musl
|
239
241
|
arm64-darwin-21
|
242
|
+
x86_64-linux
|
240
243
|
|
241
244
|
DEPENDENCIES
|
242
245
|
magic_frozen_string_literal
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
</h1>
|
9
9
|
<p align="center">
|
10
10
|
<a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/" target="_blank">
|
11
|
-
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-
|
11
|
+
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-278-brightgreen.svg?style=flat" />
|
12
12
|
</a>
|
13
13
|
<a href="https://github.com/testdouble/standard" target="_blank">
|
14
14
|
<img alt="Ruby Code Style" src="https://img.shields.io/badge/Ruby_Code_Style-standard-brightgreen.svg" />
|
@@ -16,6 +16,9 @@
|
|
16
16
|
<a href="https://github.com/sheerun/prettier-standard" target="_blank">
|
17
17
|
<img alt="JavaScript Code Style" src="https://img.shields.io/badge/JavaScript_Code_Style-prettier_standard-ff69b4.svg" />
|
18
18
|
</a>
|
19
|
+
<a href="https://bundlephobia.com/package/turbo_ready" target="_blank">
|
20
|
+
<img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/turbo_ready?label=minified%20size">
|
21
|
+
</a>
|
19
22
|
</p>
|
20
23
|
</p>
|
21
24
|
|
@@ -96,13 +99,7 @@ yarn add "turbo_ready@VERSION --exact"
|
|
96
99
|
|
97
100
|
## Setup
|
98
101
|
|
99
|
-
1.
|
100
|
-
|
101
|
-
```ruby
|
102
|
-
# config/initializers/turbo_ready.rb
|
103
|
-
TurboReady.patch! # Adds TurboReady stream actions to Turbo
|
104
|
-
```
|
105
|
-
2. Import and intialize TurboReady in your JavaScript application.
|
102
|
+
1. Import and intialize TurboReady in your JavaScript application.
|
106
103
|
|
107
104
|
```js
|
108
105
|
// app/javascript/application.js
|
@@ -225,7 +222,7 @@ and [StimulusReflex](https://github.com/stimulusreflex/stimulus_reflex).
|
|
225
222
|
|
226
223
|
Restrict your direct application usage to DOM manipulation that falls outside the purview of
|
227
224
|
[Turbo's official actions](https://turbo.hotwired.dev/reference/streams#the-seven-actions)...
|
228
|
-
*
|
225
|
+
*don't overdo it and find yourself maintaining spaghetti code reminiscent of the jQuery days.*
|
229
226
|
|
230
227
|
## Releasing
|
231
228
|
|
@@ -1,2 +1,2 @@
|
|
1
|
-
function l(){let
|
1
|
+
function l(){let n=JSON.parse(this.templateContent.textContent),{id:h,method:c,args:i,receiver:a,selector:r}=n,t=[self];switch(r&&(t=Array.from(document.querySelectorAll(r))),a&&(t=t.map(o=>{let e=o,s=a.split(".");for(;s.length>0;)e=e[s.shift()];return e})),c){case"dispatchEvent":let o=new CustomEvent(i[0],i[1]||{});t.forEach(e=>e.dispatchEvent(o));break;default:t.forEach(e=>e[c].apply(e,i))}}function f(n){n.invoke=l}var p={initialize:f};export{p 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, method, args, receiver, selector } = 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 () {\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,OAAAC,EAAQ,KAAAC,EAAM,SAAAC,EAAU,SAAAC,CAAS,EAAIL,EAC7CM,EAAY,CAAC,IAAI,EAYrB,OAXID,IAAUC,EAAY,MAAM,KAAK,SAAS,iBAAiBD,CAAQ,CAAC,GAEpED,IACFE,EAAYA,EAAU,IAAIC,GAAK,CAC7B,IAAIC,EAAUD,EACRE,EAAQL,EAAS,MAAM,GAAG,EAChC,KAAOK,EAAM,OAAS,GAAGD,EAAUA,EAAQC,EAAM,MAAM,GACvD,OAAOD,CACT,CAAC,GAGKN,OACD,gBACH,IAAMQ,EAAM,IAAI,YAAYP,EAAK,GAAIA,EAAK,IAAM,CAAC,CAAC,EAClDG,EAAU,QAAQC,GAAKA,EAAE,cAAcG,CAAG,CAAC,EAC3C,cAEAJ,EAAU,QAAQC,GAAKA,EAAEL,GAAQ,MAAMK,EAAGJ,CAAI,CAAC,EAErD,CAEA,SAASQ,
|
6
|
-
"names": ["invoke", "payload", "id", "method", "args", "receiver", "selector", "receivers", "r", "context", "chain", "evt", "initialize", "turbo_ready_default"]
|
4
|
+
"sourcesContent": ["function invoke () {\n const payload = JSON.parse(this.templateContent.textContent)\n const { id, method, args, receiver, selector } = 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,OAAAC,EAAQ,KAAAC,EAAM,SAAAC,EAAU,SAAAC,CAAS,EAAIL,EAC7CM,EAAY,CAAC,IAAI,EAYrB,OAXID,IAAUC,EAAY,MAAM,KAAK,SAAS,iBAAiBD,CAAQ,CAAC,GAEpED,IACFE,EAAYA,EAAU,IAAIC,GAAK,CAC7B,IAAIC,EAAUD,EACRE,EAAQL,EAAS,MAAM,GAAG,EAChC,KAAOK,EAAM,OAAS,GAAGD,EAAUA,EAAQC,EAAM,MAAM,GACvD,OAAOD,CACT,CAAC,GAGKN,OACD,gBACH,IAAMQ,EAAM,IAAI,YAAYP,EAAK,GAAIA,EAAK,IAAM,CAAC,CAAC,EAClDG,EAAU,QAAQC,GAAKA,EAAE,cAAcG,CAAG,CAAC,EAC3C,cAEAJ,EAAU,QAAQC,GAAKA,EAAEL,GAAQ,MAAMK,EAAGJ,CAAI,CAAC,EAErD,CAEA,SAASQ,EAAYC,EAAe,CAClCA,EAAc,OAASb,CACzB,CAEA,IAAOc,EAAQ,CAAE,WAAAF,CAAW",
|
6
|
+
"names": ["invoke", "payload", "id", "method", "args", "receiver", "selector", "receivers", "r", "context", "chain", "evt", "initialize", "streamActions", "turbo_ready_default"]
|
7
7
|
}
|
data/lib/turbo_ready/railtie.rb
CHANGED
data/lib/turbo_ready/string.rb
CHANGED
data/lib/turbo_ready/version.rb
CHANGED
data/package.json
CHANGED