-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ea32d5
commit 9715626
Showing
13 changed files
with
2,700 additions
and
2,431 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
import { template, use } from 'htmplate' | ||
import { observe, Timer, Subject } from 'quel' | ||
import { define, onAttribute, onCleanup } from '../src' | ||
|
||
|
||
const tmpl = template`<div>elapsed: <span>0</span></div>` | ||
|
||
define('test-el', ({ start }) => { | ||
const host$ = use(tmpl) | ||
const span$ = host$.querySelector('span') | ||
|
||
const pad = start ? parseInt(start) : 0 | ||
const timers = new Subject() | ||
|
||
observe($ => span$.textContent = ($($(timers)) ?? 0) + pad) | ||
|
||
onAttribute('rate', (value) => timers.set(new Timer(parseInt(value)))) | ||
onCleanup(() => timers.get().stop()) | ||
|
||
return host$ | ||
import { define } from '../src' | ||
import { ref, template } from 'rehtm' | ||
|
||
define('a-button', () => { | ||
const span = ref() | ||
let count = 0 | ||
|
||
return template` | ||
<button onclick=${() => span.current.textContent = ++count}> | ||
Client <span ref=${span} role="status">0</span> | ||
</button> | ||
` | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
<script src="./index.js" type="module"></script> | ||
|
||
<say-hi to="World"></say-hi> | ||
<test-el rate="200"></test-el> | ||
<button id="move">MOVE</button> | ||
<button id="remove">REMOVE</button> | ||
<input type="range" min="10" max="1000" value="200"/> | ||
<a-button> | ||
<template shadowrootmode="open"><button>Server <span role="status">0</span></button></template> | ||
</a-button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1 @@ | ||
import sleep from 'sleep-promise' | ||
import { from, observe } from 'quel' | ||
|
||
import './component' | ||
import './simple-comp' | ||
|
||
const simple$ = document.querySelector('say-hi') | ||
|
||
const testEl$ = document.querySelector('test-el') | ||
const moveClick = from(document.querySelector('#move')) | ||
const removeClick = from(document.querySelector('#remove')) | ||
const rate = from(document.querySelector('input')) | ||
|
||
observe(async $ => { | ||
await sleep(200) | ||
$(rate) && testEl$.setAttribute('rate', parseInt($(rate))) | ||
}) | ||
|
||
observe($ => { | ||
if($(moveClick)) { | ||
testEl$.remove() | ||
document.body.appendChild(testEl$) | ||
|
||
simple$.setAttribute('to', 'Jack') | ||
} | ||
}) | ||
|
||
observe($ => $(removeClick) && testEl$.remove()) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters