barefoot_js 0.37.0 → 0.38.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 +40 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02bbf6eeb947d4092a320ec5b8c347bc606bd244ad031d3ecda78be7015aae41
4
- data.tar.gz: e180021f0bf597e2af30271b2e939894ee292448dba0b42e429421123908511d
3
+ metadata.gz: 1e41b1648bc04ae22a5a00b7dcdcaed1ff705f48cc75861fbb4c6e959129a487
4
+ data.tar.gz: 87d4ea9e75e76579b053836d12e1a4bf0a41bb77ae36d38204ccc17bc7877152
5
5
  SHA512:
6
- metadata.gz: ed1b1b01f79e4f8a74c9c3574523abb2053359f14a71db80f7342dba6ecd32c24b13c8b218f339af167f994f2c2bdc43ef158293ceb6d8a66c5ce14c1b41d824
7
- data.tar.gz: fc76a6dc65b3bd6362ec80146cb2bc916df3aef14e9148e3c56319bd577c08d73eb5ff914092a04fde609fda8ba3db7c70ddf7b260d12e9c250dcd097f5ff133
6
+ metadata.gz: f35899f6343259ec56a5e1dfa758c955379088d99e972ce4fea17af6c86d985afd7fb865fd7950bee6aaea13f4ed0551b1a9a52821c6008805cbf6446488d2b9
7
+ data.tar.gz: 81a02b0d9947d78c2cb14392bf323ab717ab2a55d0e2adb39fa59a25c71e6562384e6994140c194645559aa141ab07fa78b2a7fdcfe27fee0c3168c11d40cc8f
data/lib/barefoot_js.rb CHANGED
@@ -70,6 +70,7 @@ module BarefootJS
70
70
  bf_accessor :_script_seen, default: -> { {} }
71
71
  bf_accessor :_preloads, default: -> { [] }
72
72
  bf_accessor :_preload_seen, default: -> { {} }
73
+ bf_accessor :_portal_elements, default: -> { [] }
73
74
  bf_accessor :_scope_id
74
75
  bf_accessor :_is_child, default: -> { false }
75
76
  bf_accessor :_bf_parent
@@ -271,6 +272,37 @@ module BarefootJS
271
272
  (preload_tags + script_tags).join("\n")
272
273
  end
273
274
 
275
+ # -----------------------------------------------------------------
276
+ # SSR Portal Element Registration (#3119)
277
+ # -----------------------------------------------------------------
278
+ #
279
+ # Collects an `ssrPortalOwnerScope`-flagged element's already-rendered,
280
+ # fully-evaluated markup (`erb-adapter.ts`'s `wrapSsrPortalElement`
281
+ # captures it via an output-buffer slice before calling here) so it can
282
+ # be emitted at the `portals` outlet near `</body>` instead of at its
283
+ # source position — the `ref`-callback SSR-portal pattern the
284
+ # dialog-style primitives use (`DialogOverlay`/`DialogContent`,
285
+ # `DropdownMenuContent`, `PopoverContent`, the explicit `<Portal>`
286
+ # component). `content` already carries its own `bf-po` attribute
287
+ # (stamped directly on its own tag by the compiler, matching exactly
288
+ # what the client `createPortal(el, document.body, { ownerScope })`
289
+ # stamps onto the SAME element at hydrate time), so unlike a hypothetical
290
+ # "wrap arbitrary children" collector this emits `content` UNWRAPPED —
291
+ # no extra `bf-pi`/`bf-po` container div, which would diverge from what
292
+ # the client stamps directly onto the element itself.
293
+ def register_portal_element(content)
294
+ _portal_elements.push(content)
295
+ nil
296
+ end
297
+
298
+ # Emits every collected SSR-portal element, in registration order. Place
299
+ # `<%= bf.portals %>` once near `</body>` in the app's own layout —
300
+ # mirrors `scripts` above (same "collect during render, emit at a single
301
+ # outlet" shape) and the Hono reference adapter's `<BfPortals />`.
302
+ def portals
303
+ _portal_elements.join("\n")
304
+ end
305
+
274
306
  # -----------------------------------------------------------------
275
307
  # Child Component Rendering
276
308
  # -----------------------------------------------------------------
@@ -353,6 +385,14 @@ module BarefootJS
353
385
  child_bf._script_seen(parent._script_seen)
354
386
  child_bf._preloads(parent._preloads)
355
387
  child_bf._preload_seen(parent._preload_seen)
388
+ # Shares the SAME root-level array object as `_scripts` above —
389
+ # every child renderer registered here closes over `parent` (the
390
+ # instance `register_components_from_manifest` was called on, the
391
+ # page root), so this reaches ANY "use client" nesting depth for
392
+ # free, unlike the Go adapter's `PropagatePortals`, which needed
393
+ # an explicit recursive walk because Go structs copy fields by
394
+ # value rather than sharing a mutable reference (#3119).
395
+ child_bf._portal_elements(parent._portal_elements)
356
396
 
357
397
  extra =
358
398
  if sig_init
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.37.0
4
+ version: 0.38.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-16 00:00:00.000000000 Z
11
+ date: 2026-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo