isorun 0.1.9-x86_64-darwin → 0.1.11-x86_64-darwin

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: '045309e2bebe24468befe3b77fff185b201da5bfbbac2e085d92fbe9499d3062'
4
- data.tar.gz: 5358e3731ab58c9c7b606a72e0d59308d736adc283e35ad3059a1d8066c15b6d
3
+ metadata.gz: 9d6862deb0b2c6aaa169054ece3dff2a1d76c27b0ecbabc0fb2f337c0210148f
4
+ data.tar.gz: f9816807a82dd1af1e2686d7e5644fbbce115240350d1e7253dc52acd0a9f423
5
5
  SHA512:
6
- metadata.gz: 5954fe17877449d65813377f931bc6a1e3df04fec3425934bcdbc499b1c6a03643cc38c772853766d030eed713fe85c3c2880ca6bf66c05a4bb2c1c0637385b6
7
- data.tar.gz: 322a650b2631c9e8248fc265a4011dc1c77b82f548a6ce6f901047303c7160ab101fc8e176f3652c35741349c24fea55653c5c6a479e77166599e3fe3a255068
6
+ metadata.gz: 53ca71b6f83d3aeb0a90dabbf2a011fb3c1fadad821a3fabf14937c52982722b2767c4329270f30ad7e26f1397957f0371c92508ac3002bd49f70c6b29fc59d5
7
+ data.tar.gz: adf35205d4454c0e4efe0ee099719babccc10d7950d0772f9eb8b9247898843f2a4b90a919e21d94ec8d8eae21202970c8c6398b22d3fdcbb26f05405a7ea4d8
@@ -14,16 +14,20 @@ module Isorun
14
14
  # </body>
15
15
  # </html>
16
16
  #
17
+ # @see https://api.rubyonrails.org/v5.1/classes/ActionView/Helpers/TagHelper.html#method-i-tag
17
18
  # @param id [String] An ID representing both, the asset bundle, and by
18
19
  # convention, the target node (e.g. `<div id="my_app">`)
20
+ # @param [Hash] options All valid tag options can also passed as options
21
+ # to this method
22
+ # @param [Hash, nil] ctx Pass variables to render context
19
23
  # @return [String]
20
- def isorun_app(id) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
24
+ def isorun_app(id, options = nil, ctx: nil) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
21
25
  ActiveSupport::Notifications.instrument "start.render.isorun", { ts: Time.current }
22
26
 
23
27
  module_path = Isorun.config.module_resolver.call(id)
24
28
 
25
29
  ssr_html = Isorun::Context.create(receiver: Isorun.config.receiver) do |context|
26
- render_context = { environment: Rails.env.to_s }
30
+ render_context = { environment: Rails.env.to_s }.merge(ctx)
27
31
  render_function = context.import.from(module_path)
28
32
 
29
33
  if render_function.blank?
@@ -43,7 +47,10 @@ module Isorun
43
47
  end
44
48
 
45
49
  html = if ssr_html.present?
46
- tag.div id: id do
50
+ options ||= {}
51
+ options[:id] = id
52
+
53
+ tag.div(**options) do
47
54
  ssr_html.html_safe # rubocop:disable Rails/OutputSafety
48
55
  end
49
56
  else
@@ -15,10 +15,14 @@ module Isorun
15
15
  # </body>
16
16
  # </html>
17
17
  #
18
- # @param id [String] An ID representing both, the asset bundle, and by
18
+ # @see https://api.rubyonrails.org/v5.1/classes/ActionView/Helpers/TagHelper.html#method-i-tag
19
+ # @param [String] id An ID representing both, the asset bundle, and by
19
20
  # convention, the target node (e.g. `<div id="my_app">`)
21
+ # @param [Hash] options All valid tag options can also passed as options
22
+ # to this method
23
+ # @param [Hash, nil] ctx Pass variables to render context
20
24
  # @return [String]
21
- def isorun_vite_app(id) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
25
+ def isorun_vite_app(id, options = nil, ctx: nil)
22
26
  ActiveSupport::Notifications.instrument "start.render.isorun", { ts: Time.current }
23
27
 
24
28
  # if id has a file extension, we extract the extension and reduce the ID
@@ -29,7 +33,7 @@ module Isorun
29
33
  module_path = Isorun.config.module_resolver.call(id)
30
34
 
31
35
  ssr_html = Isorun::Context.create(receiver: Isorun.config.receiver) do |context|
32
- render_context = { environment: Rails.env.to_s }
36
+ render_context = { environment: Rails.env.to_s }.merge(ctx)
33
37
  render_function = context.import.from(module_path)
34
38
 
35
39
  if render_function.blank?
@@ -49,7 +53,10 @@ module Isorun
49
53
  end
50
54
 
51
55
  html = if ssr_html.present?
52
- tag.div id: id do
56
+ options ||= {}
57
+ options[:id] = id
58
+
59
+ tag.div(**options) do
53
60
  ssr_html.html_safe # rubocop:disable Rails/OutputSafety
54
61
  end
55
62
  else
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "isorun"
3
- version = "0.1.9"
3
+ version = "0.1.11"
4
4
  edition = "2021"
5
5
  authors = ["Hannes Moser <box@hannesmoser.at>"]
6
6
  homepage = "https://github.com/eliias/isorun"
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isorun
4
- VERSION = "0.1.9"
4
+ VERSION = "0.1.11"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isorun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.11
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - Hannes Moser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-31 00:00:00.000000000 Z
11
+ date: 2023-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties