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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3565dc0d8e80907e11600573cfb18049fe5360c9551facefb9a22d871bebad2e
4
- data.tar.gz: 2e82006304c22c3b663511abbefaee3a0fc8e96aa972b044e1fca640cfd9c262
3
+ metadata.gz: 6b844cfcb457df944a2483bda24a48e5e3ac40628bcef8ed9683fc46c38415db
4
+ data.tar.gz: 2a921f84036cfd9ff8b92e0e4c17e38451e0b948c033068b6a975b6252a7bbde
5
5
  SHA512:
6
- metadata.gz: 2490534f21cf102b00c00524457be4b6b6f3d048e2d0477ad20bdbf2818704d5b39580bc9f71d5f33de6f39fcdd97faa20e0c0cc05a3c338225091e1096fa428
7
- data.tar.gz: 6154769b9a73b2bf3e65e0c6a395a154109466d698f79dc5483378ed7f68cce060c41183725f240fff942a3cf09e03ac909b2f0d0f0da70a574a6712e28e1251
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.0...HEAD
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-hex-color-picker"
117
- data-turbo-mount-hex-color-picker-component-value="HexColorPicker"
118
- data-turbo-mount-hex-color-picker-props-value="{&quot;color&quot;:&quot;#034&quot;}"
125
+ <div data-controller="turbo-mount"
126
+ data-turbo-mount-component-value="HexColorPicker"
127
+ data-turbo-mount-props-value="{&quot;color&quot;:&quot;#034&quot;}"
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
- append_to_file "app/javascript/entrypoints/application.js", %(import "./turbo-mount"\n)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Turbo
4
4
  module Mount
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
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.0
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-05-31 00:00:00.000000000 Z
11
+ date: 2024-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties