phlex-stimulus 0.1.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8b9c452165c2b08a52c6685507e9c1f94b22005458554346556e46a33998135
4
- data.tar.gz: 68a407b65227a84bca594379893193e45ac26f6801d19549e6de9b0813295d5d
3
+ metadata.gz: f9daeb0661e299cb12e012622f2fd879e1b0a5b0cb47f35f10fa0d7a306ef1f1
4
+ data.tar.gz: e104306fddb134fd3aab3e8c3e987b132e209b4f59ce0196d711cb5b0ec19539
5
5
  SHA512:
6
- metadata.gz: 0c2f73b22f3dc37438baec632612c45bafb250f1269257c1d0b91913637d55956f122b85c6c92a50cea8b23b6b1b903624ee2dca9eb0cf3569541f0a259de210
7
- data.tar.gz: a9db4932ae974c748b8eab8f8935ed4e591f6f974b9c2f19e0edadf85fe542d79d5547b62db8dd69ccd78e99d0b05b7fdf1a4ff24103fc69126b325ade3189e4
6
+ metadata.gz: d89cc17fb9c9d6178adf2a52c5648a2cfce4b338b0b0e703d0ed62186958c1883e35c2597010cc584fc3f63dda930890a7c00b3215f984489bd3524f726182ee
7
+ data.tar.gz: 4ef495c9749504edff2fb5fd93e8027ba2ca9a739872078a66b52dbaea6880132101d905c481a594b1245ed1f168d9f5ddf9dd4b4c8d4058b5f3c8206e65faf4
data/CHANGELOG.md CHANGED
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  Add changes in new features here. Do not change the gem's version in pull/merge requests.
11
11
 
12
+ ## [0.1.3] - 28.07.2026
13
+
14
+ [Diff](https://github.com/espago/phlex-stimulus/compare/v0.1.2...v0.1.3)
15
+
16
+ - Fix tapioca compiler
17
+
18
+ ## [0.1.2] - 27.07.2026
19
+
20
+ [Diff](https://github.com/espago/phlex-stimulus/compare/v0.1.1...v0.1.2)
21
+
22
+ - Fix controller generators
23
+
12
24
  ## [0.1.1] - 27.07.2026
13
25
 
14
26
  [Diff](https://github.com/espago/phlex-stimulus/compare/v0.1.0...v0.1.1)
@@ -12,13 +12,26 @@ module Phlex::Stimulus::Generators
12
12
  #: -> void
13
13
  def create_files
14
14
  template 'controller.ts.erb',
15
- File.join(destination_root, 'app', 'javascript', 'controllers', class_path, "#{file_name}_controller.ts")
15
+ File.join(
16
+ destination_root,
17
+ 'app',
18
+ 'javascript',
19
+ 'controllers',
20
+ *class_path,
21
+ "#{file_name}_controller.ts",
22
+ )
16
23
 
17
24
  template 'component.rb.erb',
18
- File.join(destination_root, 'app', 'components', class_path, "#{file_name}_controller.rb")
25
+ File.join(
26
+ destination_root,
27
+ 'app',
28
+ 'components',
29
+ *class_path,
30
+ "#{file_name}_controller.rb",
31
+ )
19
32
 
20
33
  append_to_file File.join(destination_root, 'app', 'javascript', 'controllers', 'index.ts'),
21
- "import \"./#{class_path}/#{file_name}_controller\"\n"
34
+ "import \"./#{File.join(*class_path)}/#{file_name}_controller\"\n"
22
35
  end
23
36
 
24
37
  private
@@ -59,6 +59,17 @@ module Phlex::Stimulus::Generators
59
59
 
60
60
  copy_template 'app/javascript/utils/misc.ts'
61
61
  copy_template 'app/javascript/utils/template.ts'
62
+
63
+ append_to_file File.join(destination_root, 'sorbet', 'tapioca', 'require.rb'), <<~RUBY
64
+
65
+ # monkey patch so that tapioca doesn't override
66
+ # the default `new` constructor
67
+ class Phlex::SGML
68
+ class << self
69
+ undef_method :new
70
+ end
71
+ end
72
+ RUBY
62
73
  end
63
74
 
64
75
  private
@@ -1,4 +1,5 @@
1
1
  // import all your controllers here
2
+ import "./chain_controller"
2
3
  import "./log_controller"
3
4
  import "./sleep_controller"
4
5
  import "./classlist_controller"
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Phlex
5
5
  module Stimulus
6
- VERSION = '0.1.1'
6
+ VERSION = '0.1.3'
7
7
  end
8
8
  end
@@ -23,7 +23,7 @@ module Tapioca
23
23
  def decorate
24
24
  root.create_path(constant) do |klass|
25
25
  klass.comments << RBI::Comment.new(
26
- <<~DOC
26
+ <<~DOC,
27
27
  A Phlex component that wraps the `#{constant.controller_name.inspect}` Stimulus controller.
28
28
 
29
29
  LINK: #{constant.controller_path}
@@ -43,12 +43,12 @@ module Tapioca
43
43
 
44
44
  Result: `#{action.full_name.inspect}`
45
45
  DOC
46
- )
46
+ ),
47
47
  ]
48
48
  mod.create_method(
49
49
  action.ruby_action_method_name,
50
50
  return_type: 'String',
51
- comments: comments,
51
+ comments: comments,
52
52
  )
53
53
  end
54
54
 
@@ -62,12 +62,12 @@ module Tapioca
62
62
 
63
63
  Result: `#{target.target_name.inspect}`
64
64
  DOC
65
- )
65
+ ),
66
66
  ]
67
67
  mod.create_method(
68
68
  target.ruby_target_method_name,
69
69
  return_type: 'String',
70
- comments: comments,
70
+ comments: comments,
71
71
  )
72
72
  end
73
73
 
data/rbi/phlex.rbi ADDED
@@ -0,0 +1,41 @@
1
+ # typed: true
2
+
3
+ class Phlex::HTML < Phlex::SGML
4
+ include ActionView::Helpers::AssetUrlHelper
5
+ include ActionView::Helpers::FormHelper
6
+ include ActionView::Helpers::AssetTagHelper
7
+ include ActionView::Helpers::NumberHelper
8
+
9
+ sig { params(key: T.untyped, options: T.untyped).returns(String) }
10
+ def t(key, **options); end
11
+
12
+ def label(**attributes); end
13
+
14
+ def form_authenticity_token(*_arg0, **_arg1, &_arg2); end
15
+
16
+ sig { returns(ApplicationController::HelperProxy) }
17
+ def view_context; end
18
+
19
+ # Outputs an `<svg>` tag.
20
+ #
21
+ # [MDN Docs](https://developer.mozilla.org/docs/Web/SVG/Element/svg)
22
+ # [Spec](https://html.spec.whatwg.org/#the-svg-element)
23
+ #
24
+ # source://phlex//lib/phlex/html.rb#20
25
+ #
26
+ #: (*untyped, **String) ?{ (Phlex::SVG) -> void } -> void
27
+ def svg(*args, **attrs, &block); end
28
+ end
29
+
30
+ class Phlex::SGML
31
+ #: (String?) -> void
32
+ def plain(content); end
33
+
34
+ #: (String?) -> void
35
+ def raw(content); end
36
+ end
37
+
38
+ module Phlex::Rails::Helpers::Translate
39
+ sig { params(key: String, _arg1: T.anything).returns(String) }
40
+ def t(key, **_arg1); end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-stimulus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Espago
@@ -130,6 +130,8 @@ files:
130
130
  - lib/phlex/stimulus/components/base.rb
131
131
  - lib/phlex/stimulus/components/controller.rb
132
132
  - lib/phlex/stimulus/version.rb
133
+ - lib/tapioca/dsl/compilers/phlex_controller.rb
134
+ - rbi/phlex.rbi
133
135
  - sorbet/config
134
136
  - sorbet/rbi/annotations/.gitattributes
135
137
  - sorbet/rbi/annotations/actionmailer.rbi
@@ -234,7 +236,6 @@ files:
234
236
  - sorbet/rbi/shims/gems/rails.rbi
235
237
  - sorbet/rbi/shims/gems/refract.rbi
236
238
  - sorbet/rbi/shims/gems/shoulda-context.rbi
237
- - sorbet/tapioca/compilers/phlex_controller.rb
238
239
  - sorbet/tapioca/config.yml
239
240
  - sorbet/tapioca/extensions/load_gem.rb
240
241
  - sorbet/tapioca/require.rb