opal_stimulus 0.1.2 → 0.1.3
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/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/lib/install/install_opal_stimulus.rb +1 -0
- data/lib/install/opal +4 -3
- data/lib/opal_stimulus/stimulus_controller.rb +5 -6
- data/lib/opal_stimulus/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 123ac1d5e6112d3896cd623518b80732351357cfa11443dd8142fd07f32bec49
|
4
|
+
data.tar.gz: 41bbd48c083fc12359f979f8c8c5d5de2486acd56cf969c0af417edf9576c1d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa36ee6800f4e0795640c29c061be9b5c49cdc639c9b976381af2ea41863a40a22cac80368956edb1ca569712191f016764d4c4fa16ceb9583f5fca164b391f5
|
7
|
+
data.tar.gz: 9cea24bad6cbf6bfba34ab79026b8589b6f25c180ee210f263568e275a91a1da16314539ecda837e222637657e4534a4d8a421ec8e38aa9c6a90b1c67cca1605
|
data/CHANGELOG.md
CHANGED
@@ -11,3 +11,8 @@
|
|
11
11
|
## [0.1.2] - 2025-07-29
|
12
12
|
|
13
13
|
- Implement Opal Source maps https://opalrb.com/docs/guides/v1.4.1/source_maps.html
|
14
|
+
|
15
|
+
## [0.1.3] - 2025-07-29
|
16
|
+
|
17
|
+
- Add missing ignore for app/assets/builds/opal.js.map
|
18
|
+
- Replace opal-browser with opal_proxy, check it out here.
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ bin/dev
|
|
25
25
|
|
26
26
|
## Basic Example
|
27
27
|
|
28
|
-
Here's a Hello World example with OpalStimulus. Compare with the [original JavaScript example](https://stimulus.hotwired.dev
|
28
|
+
Here's a Hello World example with OpalStimulus. Compare with the [original JavaScript example](https://stimulus.hotwired.dev/#:~:text=%2F%2F%20hello_controller.js%0Aimport%20%7B%20Controller%20%7D%20from%20%22stimulus%22%0A%0Aexport%20default%20class%20extends%20Controller%20%7B%0A%20%20static%20targets%20%3D%20%5B%20%22name%22%2C%20%22output%22%20%5D%0A%0A%20%20greet()%20%7B%0A%20%20%20%20this.outputTarget.textContent%20%3D%0A%20%20%20%20%20%20%60Hello%2C%20%24%7Bthis.nameTarget.value%7D!%60%0A%20%20%7D%0A%7D):
|
29
29
|
|
30
30
|
**Ruby Controller:**
|
31
31
|
|
@@ -37,7 +37,7 @@ class HelloController < StimulusController
|
|
37
37
|
self.targets = ["name", "output"]
|
38
38
|
|
39
39
|
def greet
|
40
|
-
output_target.
|
40
|
+
output_target.text_content = "Hello, #{name_target.value}!"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
```
|
@@ -40,6 +40,7 @@ window.Controller = Controller;
|
|
40
40
|
end
|
41
41
|
append_to_file ".gitignore", "/.opal-cache\n"
|
42
42
|
append_to_file ".gitignore", "app/assets/builds/opal.js\n"
|
43
|
+
append_to_file ".gitignore", "app/assets/builds/opal.js.map\n"
|
43
44
|
empty_directory APPLICATION_OPAL_STIMULUS_BIN_PATH
|
44
45
|
empty_directory APPLICATION_OPAL_STIMULUS_PATH
|
45
46
|
empty_directory "#{APPLICATION_OPAL_STIMULUS_PATH}/controllers"
|
data/lib/install/opal
CHANGED
@@ -4,11 +4,12 @@
|
|
4
4
|
require "bundler/setup"
|
5
5
|
require "listen"
|
6
6
|
require "opal"
|
7
|
-
require "opal-browser"
|
8
7
|
|
9
|
-
|
8
|
+
GEMS = ["opal_proxy", "opal_stimulus"]
|
10
9
|
|
11
|
-
|
10
|
+
GEMS.each do |gem_name|
|
11
|
+
Opal.use_gem(gem_name) rescue Opal.append_path(File.expand_path("lib", Bundler.rubygems.find_name(gem_name).first.full_gem_path))
|
12
|
+
end
|
12
13
|
|
13
14
|
Opal.append_path("app/opal")
|
14
15
|
|
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
require "opal"
|
4
4
|
require "native"
|
5
|
-
require "
|
6
|
-
require "browser/setup/full"
|
5
|
+
require "js/proxy"
|
7
6
|
|
8
7
|
class StimulusController < `Controller`
|
9
8
|
include Native::Wrapper
|
@@ -44,12 +43,12 @@ class StimulusController < `Controller`
|
|
44
43
|
|
45
44
|
targets.each do |target|
|
46
45
|
define_method(target + "_target") do
|
47
|
-
|
46
|
+
JS::Proxy.new(`this[#{target + "Target"}]`)
|
48
47
|
end
|
49
48
|
|
50
49
|
define_method(target + "_targets") do
|
51
50
|
`this[#{target + "Targets"}]`.map do |el|
|
52
|
-
|
51
|
+
JS::Proxy.new(el)
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
@@ -84,12 +83,12 @@ class StimulusController < `Controller`
|
|
84
83
|
|
85
84
|
outlets.each do |outlet|
|
86
85
|
define_method(outlet + "_outlet") do
|
87
|
-
|
86
|
+
JS::Proxy.new(`this[#{outlet + "Outlet"}]`)
|
88
87
|
end
|
89
88
|
|
90
89
|
define_method(outlet + "_outlets") do
|
91
90
|
`this[#{outlet + "Outlets"}]`.map do |outlet|
|
92
|
-
|
91
|
+
JS::Proxy.new(outlet)
|
93
92
|
end
|
94
93
|
end
|
95
94
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal_stimulus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Schito
|
@@ -38,19 +38,19 @@ dependencies:
|
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 3.9.0
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: opal_proxy
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 0.1.0
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.1.0
|
54
54
|
description: Opal Stimulus provides a way to write Stimulus controllers in Ruby, leveraging
|
55
55
|
the Opal compiler to convert Ruby code into JavaScript. This allows developers familiar
|
56
56
|
with Ruby to use the Stimulus framework without needing to write JavaScript directly.
|