barefoot_js 0.35.8 → 0.36.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/barefoot_js.rb +24 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4365bdb8be76258a96e2d32cfc1f75a52159664280f2bcbc6a2c0f0f95a21cd8
4
- data.tar.gz: 820c5c8cca92e6829fed00c932fea82e776f54f62012cac5ed48b026c669eed7
3
+ metadata.gz: ba56eceec534fc2a005728b7d25e6d77fef85f3f347ba8024c452eaecc99489b
4
+ data.tar.gz: 22801e47f891456113a30ce11485473fc2982e8c50397224647a8cc645b2b75e
5
5
  SHA512:
6
- metadata.gz: ef99dc26749f7195e31fde56e903437136b3036127b08bd87927de1b2bab3e474728c0e2e0398cd28bd4a579a27280556ccdf7d49f10d484613608275bf4b65a
7
- data.tar.gz: 03ff7d43463e1fd6392f4351189d124df6d7bfa916d7ca890ad6fb351f9f3c27705f9fcdf5ed516530c8fc99a95068942ec25727b7ff91e18f5cc308c7f01693
6
+ metadata.gz: 4e3156d8308f93e6fc17a0ac124763a82e1298359a411b352766acec35e2f8ddb57bbe8ec0c021c437707372366c0fa84bc7be13fddf26842cf14bda4022e720
7
+ data.tar.gz: e098d4600a31fb0f6aead0efc6daa2a879de49e1941bfb964048f416b97b1c3987964817f068ecb43ee731d3a42746aaa0e47557746f3425bcbbac280f22037b
data/lib/barefoot_js.rb CHANGED
@@ -876,6 +876,30 @@ module BarefootJS
876
876
  end
877
877
  end
878
878
 
879
+ # `isValidElement(x)` -- the framework "is this a renderable element (not
880
+ # plain text)?" predicate `Slot`'s `asChild` pattern uses (#2266, #3012).
881
+ # Mirrors JS's `'tag' in x && 'props' in x`: true only for a Hash
882
+ # carrying both keys (case-insensitively, matching the case-tolerant key
883
+ # lookups elsewhere in this module -- `get`'s Hash branch above, the Go
884
+ # adapter's `IsValidElement` (bf.go), and the Perl runtime's
885
+ # `is_element` this ports). A passed-through JSX child is represented as
886
+ # pre-rendered markup (a plain String) on this SSR model, so a
887
+ # non-empty STRING child is NOT a valid element -- routing
888
+ # `isValidElement` through bare truthiness here would wrongly take the
889
+ # element-merge branch.
890
+ def is_element(v)
891
+ return false unless v.is_a?(Hash)
892
+
893
+ has_tag = false
894
+ has_props = false
895
+ v.each_key do |k|
896
+ key = k.to_s.downcase
897
+ has_tag = true if key == 'tag'
898
+ has_props = true if key == 'props'
899
+ end
900
+ has_tag && has_props
901
+ end
902
+
879
903
  # Mirrors Hono's own CSS-injection guard (`hono/jsx/utils.ts`'s
880
904
  # `hasUnsafeStyleValue` -- the ORACLE a dynamic `style={{...}}` value
881
905
  # must match, #2261): a hand-rolled structural scan for characters that
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barefoot_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.8
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kobaken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-14 00:00:00.000000000 Z
11
+ date: 2026-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo