This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c993a3
commit 1698615
Showing
11 changed files
with
263 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<x-layout> | ||
@include('included-view') | ||
</x-layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script setup> | ||
const message = ref('Hello Included view!'); | ||
</script> | ||
|
||
<div style="padding: 10px; background: #eee;"> | ||
<input v-model="message" /> | ||
<p>The message is: <span v-html="message"></span></p> | ||
|
||
<x-two-way-binding /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<x-layout> | ||
<script setup> | ||
const message = ref('Hello World!'); | ||
</script> | ||
|
||
<input v-model="message" /> | ||
<p>The message is: <span v-html="message"></span></p> | ||
|
||
<x-two-way-binding /> | ||
</x-layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace ProtoneMedia\SpladeCore; | ||
|
||
use Illuminate\Support\Facades\Blade; | ||
use Illuminate\Support\Js; | ||
|
||
class PendingView | ||
{ | ||
public readonly string $originalView; | ||
|
||
public function __construct( | ||
public readonly string $viewWithoutScript, | ||
public readonly string $tag, | ||
public readonly array $rootLayoutTags | ||
) { | ||
|
||
} | ||
|
||
public function setOriginalView(string $originalView): self | ||
{ | ||
$this->originalView = $originalView; | ||
|
||
return $this; | ||
} | ||
|
||
public function render(string $hash): string | ||
{ | ||
$bridge = Js::from(['tag' => $this->tag, 'template_hash' => $hash])->toHtml(); | ||
|
||
if (empty($this->rootLayoutTags)) { | ||
return Blade::render(<<<HTML | ||
<generic-splade-component :bridge="{$bridge}"></generic-splade-component> | ||
HTML); | ||
} | ||
|
||
return Blade::render(<<<HTML | ||
{$this->rootLayoutTags[0]} | ||
<generic-splade-component :bridge="{$bridge}"></generic-splade-component> | ||
{$this->rootLayoutTags[1]} | ||
HTML); | ||
} | ||
|
||
public static function from(string $viewWithoutScript, string $path, array $rootLayoutTags) | ||
{ | ||
/** @var ComponentHelper */ | ||
$componentHelper = app(ComponentHelper::class); | ||
|
||
return new static($viewWithoutScript, $componentHelper->getTag($path), $rootLayoutTags); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.