feat(techdemo): add opaque island bridge

Add a canvas leaf-widget island to the techdemo that receives server snapshots through Effect::event/CustomEvent while keeping slhx core and runtime semantics unchanged.

req: interop/001

req: examples/001

req: examples/005
This commit is contained in:
slhx agent
2026-05-26 07:29:51 +02:00
parent 28ee1b5111
commit 9d3f70e9fe
10 changed files with 179 additions and 7 deletions
+9 -4
View File
@@ -12,11 +12,9 @@ fn canonical_examples_do_not_author_browser_javascript() {
}
for (line_no, line) in text.lines().enumerate() {
let trimmed = line.trim();
if trimmed.contains("<script")
&& !trimmed.contains(r#"<script src="/slhx.js" defer></script>"#)
{
if trimmed.contains("<script") && !allowed_example_script(path, trimmed) {
failures.push(format!(
"{}:{}: inline <script> is not allowed",
"{}:{}: only the slhx runtime or explicit opaque-island scripts are allowed",
path.display(),
line_no + 1
));
@@ -81,6 +79,13 @@ fn is_example_source(path: &PathBuf) -> bool {
)
}
fn allowed_example_script(path: &Path, line: &str) -> bool {
// req: examples/005
line.contains(r#"<script src="/slhx.js" defer></script>"#)
|| (path.ends_with("examples/techdemo/templates/app_shell.heml")
&& line.contains(r#"<script src="/island.js" defer></script>"#))
}
fn contains_inline_event_handler(line: &str) -> bool {
let bytes = line.as_bytes();
let mut i = 0;