Skip to content

Commit d8b050a

Browse files
author
Chris Nelson
committed
WIP example.html loads with npx live-server .
1 parent 40d4324 commit d8b050a

6 files changed

+2213
-90
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# `<live-template>`
22

3+
The `<live-template>` provides a connected, or "live" template that connects to a stateful backend application provided by Livesate.
34
A `<live-template>` element connects a template to a state source (currently provided by [LiveState] ). After connecting to a LiveState channel, it will:
45

56
* render the initial state

example.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<html>
2+
<head>
3+
<script async src="https://ga.jspm.io/npm:[email protected]/dist/es-module-shims.js" crossorigin="anonymous"></script>
4+
<script type="importmap">
5+
{
6+
"imports": {
7+
"phx-live-state": "../phx-live-state/build/src/index.js",
8+
"templize/templize.js": "https://ga.jspm.io/npm:[email protected]/templize.js"
9+
},
10+
"scopes": {
11+
"../phx-live-state/": {
12+
"json-joy/esm/json-patch": "https://ga.jspm.io/npm:[email protected]/esm/json-patch/index.js",
13+
"phoenix": "https://ga.jspm.io/npm:[email protected]/priv/static/phoenix.mjs",
14+
"reflect-metadata": "https://ga.jspm.io/npm:[email protected]/Reflect.js",
15+
"subscript": "https://ga.jspm.io/npm:[email protected]/subscript.js",
16+
"wc-context": "https://ga.jspm.io/npm:[email protected]/core.js"
17+
},
18+
"https://ga.jspm.io/": {
19+
"element-props": "https://ga.jspm.io/npm:[email protected]/element-props.js",
20+
"process": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/process.js",
21+
"sube": "https://ga.jspm.io/npm:[email protected]/sube.js",
22+
"subscript": "https://ga.jspm.io/npm:[email protected]/subscript.js",
23+
"subscript/parse.js": "https://ga.jspm.io/npm:[email protected]/parse.js",
24+
"template-parts": "https://ga.jspm.io/npm:[email protected]/template-parts.js"
25+
}
26+
}
27+
}
28+
</script>
29+
<script type="module" src="./src/live-template.js"></script>
30+
</head>
31+
<live-template url="ws://localhost:4000/live_state" topic="todo:all">
32+
<ul>
33+
<li :each="{{todo in todos}}">{{todo}}</li>
34+
</ul>
35+
</live-template>
36+
</html>

importmap.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"env": [
3+
"browser",
4+
"development",
5+
"module"
6+
],
7+
"imports": {
8+
"phoenix": "https://ga.jspm.io/npm:[email protected]/priv/static/phoenix.mjs",
9+
"phx-live-state": "../phx-live-state/build/src/index.js",
10+
"templize/templize.js": "https://ga.jspm.io/npm:[email protected]/templize.js"
11+
},
12+
"scopes": {
13+
"../phx-live-state/": {
14+
"json-joy/esm/json-patch": "https://ga.jspm.io/npm:[email protected]/esm/json-patch/index.js",
15+
"phoenix": "https://ga.jspm.io/npm:[email protected]/priv/static/phoenix.mjs",
16+
"reflect-metadata": "https://ga.jspm.io/npm:[email protected]/Reflect.js",
17+
"subscript": "https://ga.jspm.io/npm:[email protected]/subscript.js",
18+
"wc-context": "https://ga.jspm.io/npm:[email protected]/core.js"
19+
},
20+
"https://ga.jspm.io/": {
21+
"element-props": "https://ga.jspm.io/npm:[email protected]/element-props.js",
22+
"process": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/process.js",
23+
"sube": "https://ga.jspm.io/npm:[email protected]/sube.js",
24+
"subscript": "https://ga.jspm.io/npm:[email protected]/subscript.js",
25+
"subscript/parse.js": "https://ga.jspm.io/npm:[email protected]/parse.js",
26+
"template-parts": "https://ga.jspm.io/npm:[email protected]/template-parts.js"
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)