Skip to content

Commit

Permalink
0.0.620
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Dec 13, 2024
1 parent a8bc704 commit 395269f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ The nice thing is this allows us to reuse the same web component base with diffe
This assumes the document imports a js file, for example, that registers a custom element with name "plus-minus-base".


## Example 4b -- Support for inline script tag [TODO]
## Example 4b -- Support for inner script tag [TODO]

```html
<hello-world place=Earth>
Expand Down Expand Up @@ -350,7 +350,7 @@ This assumes the document imports a js file, for example, that registers a custo
<hello-world place=Venus></hello-world>
```


Another death-blow [against progressive enhancement](https://github.com/WICG/webcomponents/issues/477).
# Real world examples

## Example 1 up-down-counter
Expand Down
38 changes: 38 additions & 0 deletions demo/script/Example4a.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>With inner script</title>
<!-- #include virtual="/imports.html" -->
</head>
<body>
<hello-world place=Earth>
<template shadowrootmode=open>
<div></div>
<xtal-element
prop-info='{
"place": {},
"greeting": {}
}'
xform='{
"div": "greeting"
}'
>
<script>
document.currentScript.o = [
(place) => ({
greeting: `Hello, ${place}`
})
]
</script>
</xtal-element>
</template>
</hello-world>
<hello-world place=Mars></hello-world>
<hello-world place=Venus></hello-world>
<script type=module>
import '/index.js';
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions imports.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script type=importmap >
{
"imports": {
"blow-dry/": "/node_modules/blow-dry/",
"mount-observer/": "/node_modules/mount-observer/",
"trans-render/": "/trans-render/"
}
}
</script>

0 comments on commit 395269f

Please sign in to comment.