view_component 2.25.0 → 2.25.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of view_component might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed1ee878b4b1519adcb75b06689a3341367cca5aa8ae4dd087cb2fba0c06a355
4
- data.tar.gz: 70459f53b555b8edf6675346a42c1be87bb36267bce23ffb9cc4a639731c1b77
3
+ metadata.gz: c411f9f34b25054093f7abe23c5842c7523f083ecdb1ba586429545548eca423
4
+ data.tar.gz: 744c27c0907544dfb93eb37ecf47c74dd7df86855c0e2b91f9619a77bd8eefc8
5
5
  SHA512:
6
- metadata.gz: 2ac2189345c278608e8dc96ec1c7f90472991aefc86da43968489f3ea3cff4c9306ef8280553b2dad6a7a35b24e74eabd2269b3efcba4026b00b642dcac0dcf4
7
- data.tar.gz: 6a393762db37291a6f6eaa2e19575aa035f103cc6c0fe71c96648fb827ed0e140c0e9d9f297901f699f7abd3e4946ca8e048bf53b1dbe62e47663e2bb591918e
6
+ metadata.gz: bee62ecbcfecbc53146b8a8e55207baf2d14769adda2bb2349494a82224acf12fa6584bfc32512e96474f28f011823f2c5712cbc021773d439c43fab8b090503
7
+ data.tar.gz: 3f519b85b066d89fdf75afb17563cb868bb4fb673caa21326661f0738b9b4398af068421064ca6f77abf08b7b46bdc549c132252b111b8fb3009809d430b9682
data/CHANGELOG.md CHANGED
@@ -2,11 +2,21 @@
2
2
 
3
3
  ## main
4
4
 
5
+ ## 2.25.1
6
+
7
+ * Experimental: call `._after_compile` class method after a component is compiled.
8
+
9
+ *Joel Hawksley*
10
+
11
+ * Fix bug where SlotV2 was rendered as an HTML string when using Slim.
12
+
13
+ *Manuel Puyol*
14
+
5
15
  ## 2.25.0
6
16
 
7
17
  * Add `--preview` generator option to create an associated preview file.
8
18
 
9
- *Bob Maerten*
19
+ *Bob Maerten*
10
20
 
11
21
  * Add argument validation to avoid `content` override.
12
22
 
@@ -23,6 +23,14 @@ module ViewComponent
23
23
  class_attribute :content_areas
24
24
  self.content_areas = [] # class_attribute:default doesn't work until Rails 5.2
25
25
 
26
+ # EXPERIMENTAL: This API is experimental and may be removed at any time.
27
+ # Hook for allowing components to do work as part of the compilation process.
28
+ #
29
+ # For example, one might compile component-specific assets at this point.
30
+ def self._after_compile
31
+ # noop
32
+ end
33
+
26
34
  # Entrypoint for rendering components.
27
35
  #
28
36
  # view_context: ActionView context from calling view
@@ -67,6 +67,8 @@ module ViewComponent
67
67
 
68
68
  define_render_template_for
69
69
 
70
+ component_class._after_compile
71
+
70
72
  CompileCache.register(component_class)
71
73
  end
72
74
 
@@ -22,8 +22,10 @@ module ViewComponent
22
22
  # If there is no slot renderable, we evaluate the block passed to
23
23
  # the slot and return it.
24
24
  def to_s
25
+ return @content if defined?(@content)
26
+
25
27
  view_context = @parent.send(:view_context)
26
- view_context.capture do
28
+ @content = view_context.capture do
27
29
  if defined?(@_component_instance)
28
30
  # render_in is faster than `parent.render`
29
31
  @_component_instance.render_in(view_context, &@_content_block)
@@ -33,6 +35,8 @@ module ViewComponent
33
35
  @_content_block.call
34
36
  end
35
37
  end
38
+
39
+ @content
36
40
  end
37
41
 
38
42
  # Allow access to public component methods via the wrapper
@@ -58,6 +62,10 @@ module ViewComponent
58
62
  @_component_instance.public_send(symbol, *args, &block)
59
63
  end
60
64
 
65
+ def html_safe?
66
+ to_s.html_safe?
67
+ end
68
+
61
69
  def respond_to_missing?(symbol, include_all = false)
62
70
  defined?(@_component_instance) && @_component_instance.respond_to?(symbol, include_all)
63
71
  end
@@ -4,7 +4,7 @@ module ViewComponent
4
4
  module VERSION
5
5
  MAJOR = 2
6
6
  MINOR = 25
7
- PATCH = 0
7
+ PATCH = 1
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.25.0
4
+ version: 2.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-25 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport