feat(compat): sweep of components against the real core with strict diagnostics
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
// Router de compatibilidad del paquete htmx: monta un componente propio sobre
|
||||
// el motor HTMLComponent/HTMX con el arranque real del core.
|
||||
|
||||
use Libs\HTMLComponent;
|
||||
use Libs\HTMX;
|
||||
use Libs\Router;
|
||||
|
||||
$views = ROOT_CORE . '/Views';
|
||||
if (!is_dir($views)) {
|
||||
mkdir($views, 0777, true);
|
||||
}
|
||||
|
||||
file_put_contents($views . '/CompatGreet.php', <<<'VIEW'
|
||||
<h1 id="compat-greet"><?php echo $this->escapedProperty('name'); ?></h1>
|
||||
VIEW);
|
||||
|
||||
file_put_contents($views . '/CompatButton.php', <<<'VIEW'
|
||||
<button hx-post="/compat/htmx/echo" hx-target="#compat-greet" class="btn">ir</button>
|
||||
VIEW);
|
||||
|
||||
Router::get('/compat/htmx/render', function () {
|
||||
echo 'GREET:';
|
||||
HTMLComponent::render('CompatGreet', ['name' => 'A<b>']);
|
||||
});
|
||||
|
||||
Router::get('/compat/htmx/static', function () {
|
||||
$instance = new HTMX([], '<i hx-get="/x">ok</i>');
|
||||
header('X-Marker: ' . (HTMX::isHtmx() ? 'yes' : 'no'));
|
||||
echo 'HTMX:' . var_export(HTMX::isPartialRequest(), true)
|
||||
. ':' . var_export($instance->getContent() !== '', true);
|
||||
});
|
||||
Reference in New Issue
Block a user