phlex 1.10.3 → 1.11.0

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: 4a86bca32b72f150179b586843c71432ebfea0d892ad70b426ef0f8ce6d58f3f
4
- data.tar.gz: 235a24dc555ffcb1598660c9c5d539a5b050780a1ccec4d81b8b5115ea5b7f0e
3
+ metadata.gz: 91e06f170cfccd6ef24d00ef34643293d36c9df7540ffb3fe482577c4a115898
4
+ data.tar.gz: 9eb38a0b368e1543789252f6ba8cb80df204b73fc81d413fc47b758adba191bc
5
5
  SHA512:
6
- metadata.gz: 0b4ab7f24ba4955cc0622da21a363436a0b54cae4505ec0fd599dd2ddd53731175386b5fc9f62981807f7836d34edd7de851dd662a18b1e01c3935aa37956454
7
- data.tar.gz: eb0b42b41d70b8fb28ae3c9134f0ecddcc517698ac812c2f1c69b05c4b41d7d9148aca244d88b1bb8e8d817abcfafa9ac6968342890584b9b6cf539b320e2b27
6
+ metadata.gz: 4f2587dff9519706d7ec91c2745da7570c74a097b0282c0462504a54cc296312f1aee386a6645f1df5e7f503e1398df72681d345d18e5866f13a4dfcd4c4db1c
7
+ data.tar.gz: 3de0960cc4510e025620308ed8ae6c0b5594d3ee8a153b11c5c3eabdc74d3aa94193717f9a6fbc47fa378e8b7bbcd171a35bcfa3f486e66800bffd8da01bc033
data/lib/phlex/kit.rb CHANGED
@@ -1,31 +1,38 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phlex::Kit
4
- def self.extended(mod)
5
- warn "⚠️ [WARNING] Phlex::Kit is experimental and may be removed from future versions of Phlex."
6
- super
4
+ module LazyLoader
5
+ def method_missing(name, *args, **kwargs, &block)
6
+ if name[0] == name[0].upcase && __phlex_kit_constants__.include?(name) && __get_phlex_kit_constant__(name) && methods.include?(name)
7
+ public_send(name, *args, **kwargs, &block)
8
+ else
9
+ super
10
+ end
11
+ end
12
+
13
+ def respond_to_missing?(name, include_private = false)
14
+ if name[0] == name[0].upcase && __phlex_kit_constants__.include?(name) && __get_phlex_kit_constant__(name) && methods.include?(name)
15
+ true
16
+ else
17
+ super
18
+ end
19
+ end
7
20
  end
8
21
 
9
- # When a kit is included in a module, we need to load all of its components.
10
- def included(mod)
11
- constants.each { |c| const_get(c) if autoload?(c) }
12
- super
22
+ include LazyLoader
23
+
24
+ def self.extended(mod)
25
+ mod.include(LazyLoader)
26
+ mod.define_method(:__phlex_kit_constants__) { mod.__phlex_kit_constants__ }
27
+ mod.define_method(:__get_phlex_kit_constant__) { |name| mod.__get_phlex_kit_constant__(name) }
13
28
  end
14
29
 
15
- def method_missing(name, *args, **kwargs, &block)
16
- if name[0] == name[0].upcase && constants.include?(name) && const_get(name) && methods.include?(name)
17
- public_send(name, *args, **kwargs, &block)
18
- else
19
- super
20
- end
30
+ def __phlex_kit_constants__
31
+ constants
21
32
  end
22
33
 
23
- def respond_to_missing?(name, include_private = false)
24
- if name[0] == name[0].upcase && constants.include?(name) && const_get(name) && methods.include?(name)
25
- true
26
- else
27
- super
28
- end
34
+ def __get_phlex_kit_constant__(name)
35
+ const_get(name)
29
36
  end
30
37
 
31
38
  def const_added(name)
data/lib/phlex/sgml.rb CHANGED
@@ -71,7 +71,7 @@ module Phlex
71
71
 
72
72
  def self.method_added(method_name)
73
73
  if method_name == :template
74
- Kernel.warn "⚠️ [DEPRECATION] Defining the `template` method on a Phlex component will not be supported in Phlex 2.0. Please rename the method to `view_template` instead."
74
+ Kernel.warn "⚠️ [DEPRECATION] Defining the `template` method on a Phlex component will not be supported in Phlex 2.0. Please rename `#{name}#template` to `#{name}#view_template` instead."
75
75
  end
76
76
  end
77
77
 
@@ -105,6 +105,11 @@ module Phlex
105
105
  @_context = context
106
106
  @_view_context = view_context
107
107
  @_parent = parent
108
+ if @_rendered
109
+ warn "⚠️ [WARNING] You are rendering a component #{self.class.name} twice. This is not supported in Phlex 2.0."
110
+ end
111
+ @_rendered = true
112
+
108
113
  if fragments
109
114
  warn "⚠️ [WARNING] Selective Rendering is experimental, incomplete, and may change in future versions."
110
115
  @_context.target_fragments(fragments)
@@ -435,6 +440,10 @@ module Phlex
435
440
  raise ArgumentError, "Unsafe attribute name detected: #{k}."
436
441
  end
437
442
 
443
+ if lower_name.to_sym == :id && k != :id
444
+ warn "⚠️ [WARNING] Starting 2.0 Phlex will raise on non lowercase or string :id attribute."
445
+ end
446
+
438
447
  case v
439
448
  when true
440
449
  buffer << " " << name
data/lib/phlex/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phlex
4
- VERSION = "1.10.3"
4
+ VERSION = "1.11.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.3
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-01 00:00:00.000000000 Z
11
+ date: 2024-07-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A high-performance view framework optimised for fun.
14
14
  email:
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubygems_version: 3.5.3
65
+ rubygems_version: 3.5.13
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: A fun framework for building views in Ruby.