@@ -21,6 +21,7 @@ class Foldable
2121{
2222 protected array $ attributeByPlaceholder = [];
2323 protected array $ slotByPlaceholder = [];
24+ protected int $ placeholderIndex = 0 ;
2425
2526 protected ComponentNode $ renderable ;
2627 protected string $ html ;
@@ -51,7 +52,7 @@ public function fold(): string
5152 $ this ->setupSlots ();
5253 $ this ->mergeAwareProps ();
5354
54- $ this ->html = $ this ->renderer ->render ($ this ->renderable -> render () );
55+ $ this ->html = $ this ->renderer ->render ($ this ->renderable , $ this -> source );
5556
5657 $ this ->processUncompiledAttributes ();
5758 $ this ->restorePlaceholders ();
@@ -67,7 +68,7 @@ protected function setupAttributes(): void
6768 {
6869 foreach ($ this ->node ->attributes as $ key => $ attribute ) {
6970 if (! $ attribute ->isStaticValue ()) {
70- $ placeholder = 'BLAZE_PLACEHOLDER_ ' . strtoupper ( str ()-> random ()) ;
71+ $ placeholder = 'BLAZE_PLACEHOLDER_ ' . $ this -> placeholderIndex ++ . ' _ ' ;
7172
7273 $ this ->attributeByPlaceholder [$ placeholder ] = $ attribute ;
7374
@@ -95,7 +96,7 @@ protected function setupSlots(): void
9596
9697 foreach ($ this ->node ->children as $ child ) {
9798 if ($ child instanceof SlotNode) {
98- $ placeholder = 'BLAZE_PLACEHOLDER_ ' . strtoupper ( str ()-> random ()) ;
99+ $ placeholder = 'BLAZE_PLACEHOLDER_ ' . $ this -> placeholderIndex ++ . ' _ ' ;
99100
100101 $ this ->slotByPlaceholder [$ placeholder ] = $ child ;
101102
@@ -115,7 +116,7 @@ protected function setupSlots(): void
115116
116117 // Synthesize a default slot from loose content when there's not an explicit one
117118 if ($ looseContent && ! isset ($ slots ['slot ' ])) {
118- $ placeholder = 'BLAZE_PLACEHOLDER_ ' . strtoupper ( str ()-> random ()) ;
119+ $ placeholder = 'BLAZE_PLACEHOLDER_ ' . $ this -> placeholderIndex ++ . ' _ ' ;
119120
120121 $ defaultSlot = new SlotNode (
121122 name: 'slot ' ,
@@ -160,7 +161,7 @@ protected function mergeAwareProps(): void
160161 $ attribute = $ this ->node ->parentsAttributes [$ prop ];
161162
162163 if (! $ attribute ->isStaticValue ()) {
163- $ placeholder = 'BLAZE_PLACEHOLDER_ ' . strtoupper ( str ()-> random ()) ;
164+ $ placeholder = 'BLAZE_PLACEHOLDER_ ' . $ this -> placeholderIndex ++ . ' _ ' ;
164165
165166 $ this ->attributeByPlaceholder [$ placeholder ] = $ attribute ;
166167
@@ -201,7 +202,7 @@ protected function mergeAwareProps(): void
201202 */
202203 protected function processUncompiledAttributes (): void
203204 {
204- $ this ->html = preg_replace_callback ('/\[BLAZE_ATTR:(BLAZE_PLACEHOLDER_[A-Z0- 9]+)\](\r?\n)?/ ' , function ($ matches ) {
205+ $ this ->html = preg_replace_callback ('/\[BLAZE_ATTR:(BLAZE_PLACEHOLDER_[0- 9]+_ )\](\r?\n)?/ ' , function ($ matches ) {
205206 $ attribute = $ this ->attributeByPlaceholder [$ matches [1 ]];
206207
207208 if ($ attribute ->bound ()) {
0 commit comments