feat(compat): sweep of components against the real core with strict diagnostics

This commit is contained in:
kj
2026-10-05 17:36:08 -03:00
parent 1127272330
commit 0b98b7a26b
19 changed files with 740 additions and 1 deletions
+33
View File
@@ -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);
});