turbo-mount 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/README.md +13 -4
- data/lib/generators/turbo_mount/install_generator.rb +13 -1
- data/lib/turbo/mount/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b844cfcb457df944a2483bda24a48e5e3ac40628bcef8ed9683fc46c38415db
|
4
|
+
data.tar.gz: 2a921f84036cfd9ff8b92e0e4c17e38451e0b948c033068b6a975b6252a7bbde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c96cd642b8c68e23f1dc5f91b77d25b7465abd860625c45d9bfcda5b53fa3db2484308a79b3e2768cd1fbd57fa58b9b00b60a2ffb41bdbc63b31ab8393d49db9
|
7
|
+
data.tar.gz: cf4876ceda803c1ba4a023d8d13d18e6b7a764e866d84963d9a516ff03b26a7bd7d1e013b5f49595e6c4c32585f8c4f3485696e1f38a1bec78e33f7098db99d8
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning].
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.3.1] - 2024-06-16
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Fix entrypoint issue in the install generator. ([@skryukov])
|
15
|
+
|
10
16
|
## [0.3.0] - 2024-05-31
|
11
17
|
|
12
18
|
### Added
|
@@ -51,7 +57,8 @@ and this project adheres to [Semantic Versioning].
|
|
51
57
|
|
52
58
|
[@skryukov]: https://github.com/skryukov
|
53
59
|
|
54
|
-
[Unreleased]: https://github.com/skryukov/turbo-mount/compare/v0.3.
|
60
|
+
[Unreleased]: https://github.com/skryukov/turbo-mount/compare/v0.3.1...HEAD
|
61
|
+
[0.3.1]: https://github.com/skryukov/turbo-mount/compare/v0.3.0...v0.3.1
|
55
62
|
[0.3.0]: https://github.com/skryukov/turbo-mount/compare/v0.2.3...v0.3.0
|
56
63
|
[0.2.3]: https://github.com/skryukov/turbo-mount/compare/v0.2.2...v0.2.3
|
57
64
|
[0.2.2]: https://github.com/skryukov/turbo-mount/compare/v0.2.0...v0.2.2
|
data/README.md
CHANGED
@@ -91,6 +91,8 @@ Note: Importmap-only mode is quite limited in terms of JavaScript dependencies.
|
|
91
91
|
To begin using `TurboMount`, start by initializing the library and registering the components you intend to use. Here's how to set it up with a React plugin:
|
92
92
|
|
93
93
|
```js
|
94
|
+
// app/javascript/turbo-mount.js
|
95
|
+
|
94
96
|
import { TurboMount } from "turbo-mount";
|
95
97
|
import { registerComponent } from "turbo-mount/react";
|
96
98
|
import { HexColorPicker } from 'react-colorful';
|
@@ -100,7 +102,14 @@ const turboMount = new TurboMount(); // or new TurboMount({ application })
|
|
100
102
|
registerComponent(turboMount, "HexColorPicker", HexColorPicker);
|
101
103
|
```
|
102
104
|
|
103
|
-
If you prefer not to specify the `application` explicitly, `TurboMount` can automatically detect or initialize it. Turbo Mount uses the `window.Stimulus` if available; otherwise, it initializes a new Stimulus application.
|
105
|
+
If you prefer not to specify the `application` explicitly, `TurboMount` can automatically detect or initialize it. Turbo Mount uses the `window.Stimulus` if available; otherwise, it initializes a new Stimulus application.
|
106
|
+
|
107
|
+
Make sure your `application.js` is importing `turbo-mount.js`:
|
108
|
+
```js
|
109
|
+
import "@hotwired/turbo-rails"
|
110
|
+
import "./controllers"
|
111
|
+
import "./turbo-mount" // <------
|
112
|
+
```
|
104
113
|
|
105
114
|
### View Helpers
|
106
115
|
|
@@ -113,9 +122,9 @@ Use the following helpers to mount components in your views:
|
|
113
122
|
This will generate the following HTML:
|
114
123
|
|
115
124
|
```html
|
116
|
-
<div data-controller="turbo-mount
|
117
|
-
data-turbo-mount-
|
118
|
-
data-turbo-mount-
|
125
|
+
<div data-controller="turbo-mount"
|
126
|
+
data-turbo-mount-component-value="HexColorPicker"
|
127
|
+
data-turbo-mount-props-value="{"color":"#034"}"
|
119
128
|
class="mb-5">
|
120
129
|
</div>
|
121
130
|
```
|
@@ -54,7 +54,11 @@ module TurboMount
|
|
54
54
|
|
55
55
|
say "Creating Turbo Mount initializer"
|
56
56
|
template "turbo-mount.js", File.join("app/javascript/turbo-mount.js")
|
57
|
-
|
57
|
+
begin
|
58
|
+
append_to_file js_entrypoint, %(import "./turbo-mount"\n)
|
59
|
+
rescue
|
60
|
+
say 'Could not find the application entrypoint, please add `import "./turbo-mount"` manually.', :yellow
|
61
|
+
end
|
58
62
|
warn_about_vite_plugin if vite?
|
59
63
|
end
|
60
64
|
|
@@ -72,6 +76,14 @@ module TurboMount
|
|
72
76
|
run "bin/importmap pin #{FRAMEWORKS[framework][:pins]}"
|
73
77
|
end
|
74
78
|
|
79
|
+
def js_entrypoint
|
80
|
+
if vite?
|
81
|
+
"app/javascript/entrypoints/application.js"
|
82
|
+
else
|
83
|
+
"app/javascript/application.js"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
75
87
|
def vite?
|
76
88
|
Dir.glob(Rails.root.join("vite.config.*")).any?
|
77
89
|
end
|
data/lib/turbo/mount/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-mount
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Svyatoslav Kryukov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|