mirror of https://github.com/sveltejs/svelte
update custom-elements tests update hydration tests update js tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some tests update some testspull/1864/head
parent
2231a7eb19
commit
7f3cd0d655
@ -1,13 +1,11 @@
|
||||
<p>{foo}</p>
|
||||
<svelte:meta tag="custom-element"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
tag: 'custom-element',
|
||||
export function updateFoo(value) {
|
||||
foo = value;
|
||||
}
|
||||
|
||||
methods: {
|
||||
updateFoo(value) {
|
||||
this.foo = value;
|
||||
}
|
||||
}
|
||||
};
|
||||
export let foo;
|
||||
</script>
|
||||
|
||||
<p>{foo}</p>
|
@ -1,7 +1,7 @@
|
||||
<h1>Hello {name}!</h1>
|
||||
<svelte:meta tag="custom-element"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
tag: 'custom-element'
|
||||
};
|
||||
export let name;
|
||||
</script>
|
||||
|
||||
<h1>Hello {name}!</h1>
|
@ -1,13 +1,7 @@
|
||||
<button on:click='set({ count: count + 1 })'>count: {count}</button>
|
||||
<svelte:meta tag="my-counter"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
tag: 'my-counter',
|
||||
|
||||
data() {
|
||||
return {
|
||||
count: 0
|
||||
};
|
||||
}
|
||||
};
|
||||
export let count = 0;
|
||||
</script>
|
||||
|
||||
<button on:click='{() => count += 1}'>count: {count}</button>
|
@ -1,12 +1,10 @@
|
||||
<Counter bind:count/>
|
||||
<p>clicked {count} times</p>
|
||||
<svelte:meta tag="my-app"/>
|
||||
|
||||
<script>
|
||||
import Counter from './Counter.html';
|
||||
|
||||
export default {
|
||||
tag: 'my-app',
|
||||
|
||||
components: { Counter }
|
||||
};
|
||||
export let count;
|
||||
</script>
|
||||
|
||||
<Counter bind:count/>
|
||||
<p>clicked {count} times</p>
|
@ -1,7 +1,7 @@
|
||||
<h1>Hello {name}!</h1>
|
||||
<svelte:meta tag="custom-element"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
tag: 'custom-element'
|
||||
};
|
||||
export let name;
|
||||
</script>
|
||||
|
||||
<h1>Hello {name}!</h1>
|
@ -1,8 +1,9 @@
|
||||
<p>foo: {foo}</p>
|
||||
<p>bar: {bar}</p>
|
||||
<svelte:meta tag="my-app"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
tag: 'my-app'
|
||||
};
|
||||
export let foo;
|
||||
export let bar;
|
||||
</script>
|
||||
|
||||
<p>foo: {foo}</p>
|
||||
<p>bar: {bar}</p>
|
@ -1,9 +1,12 @@
|
||||
<svelte:meta tag="my-app"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
tag: 'my-app',
|
||||
import { onmount } from 'svelte';
|
||||
|
||||
export let wasCreated;
|
||||
|
||||
oncreate() {
|
||||
this.wasCreated = true;
|
||||
}
|
||||
};
|
||||
onmount(() => {
|
||||
wasCreated = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -1,15 +1,9 @@
|
||||
<my-widget class="foo" {items}/>
|
||||
<svelte:meta tag="custom-element"/>
|
||||
|
||||
<script>
|
||||
import './my-widget.html';
|
||||
|
||||
export default {
|
||||
tag: 'custom-element',
|
||||
|
||||
data() {
|
||||
return {
|
||||
items: ['a', 'b', 'c']
|
||||
};
|
||||
}
|
||||
};
|
||||
export let items = ['a', 'b', 'c'];
|
||||
</script>
|
||||
|
||||
<my-widget class="foo" {items}/>
|
@ -1,14 +1,8 @@
|
||||
<p>{items.length} items</p>
|
||||
<p>{items.join(', ')}</p>
|
||||
<svelte:meta tag="my-widget"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
tag: 'my-widget',
|
||||
|
||||
data() {
|
||||
return {
|
||||
items: []
|
||||
};
|
||||
}
|
||||
};
|
||||
export let items = [];
|
||||
</script>
|
||||
|
||||
<p>{items.length} items</p>
|
||||
<p>{items.join(', ')}</p>
|
@ -1,13 +1,7 @@
|
||||
<div>
|
||||
<Nested/>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
import Nested from './Nested.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Nested
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<Nested/>
|
||||
</div>
|
@ -1,11 +1,5 @@
|
||||
<Nested/>
|
||||
|
||||
<script>
|
||||
import Nested from './Nested.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Nested
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<Nested/>
|
@ -1,4 +1,4 @@
|
||||
<button on:click='set({ clicked: true })'>click me</button>
|
||||
<button on:click='{() => clicked = true}'>click me</button>
|
||||
|
||||
{#if clicked}
|
||||
<p>clicked!</p>
|
||||
|
@ -1,23 +1,19 @@
|
||||
<a href="#" use:link>Test</a>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
actions: {
|
||||
link(node) {
|
||||
function link(node) {
|
||||
|
||||
function onClick(event) {
|
||||
event.preventDefault();
|
||||
history.pushState(null, null, event.target.href);
|
||||
}
|
||||
function onClick(event) {
|
||||
event.preventDefault();
|
||||
history.pushState(null, null, event.target.href);
|
||||
}
|
||||
|
||||
node.addEventListener('click', onClick);
|
||||
node.addEventListener('click', onClick);
|
||||
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('click', onClick);
|
||||
}
|
||||
}
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('click', onClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<a href="#" use:link>Test</a>
|
@ -1,9 +1,5 @@
|
||||
<Nested foo={[1, 2, 3]}/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
Nested: window.Nested
|
||||
}
|
||||
};
|
||||
const Nested = window.Nested;
|
||||
</script>
|
||||
|
||||
<Nested foo={[1, 2, 3]}/>
|
@ -1,10 +1,7 @@
|
||||
<Nested foo='bar'/>
|
||||
<svelte:meta immutable/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
immutable: true,
|
||||
components: {
|
||||
Nested: window.Nested
|
||||
}
|
||||
};
|
||||
const Nested = window.Nested;
|
||||
</script>
|
||||
|
||||
<Nested foo='bar'/>
|
@ -1,9 +1,5 @@
|
||||
<Nested foo='bar'/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
Nested: window.Nested
|
||||
}
|
||||
};
|
||||
const Nested = window.Nested;
|
||||
</script>
|
||||
|
||||
<Nested foo='bar'/>
|
@ -1,9 +1,5 @@
|
||||
<Nested foo='bar'/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
Nested: window.Nested
|
||||
}
|
||||
};
|
||||
const Nested = window.Nested;
|
||||
</script>
|
||||
|
||||
<Nested foo='bar'/>
|
@ -1,8 +1,11 @@
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
a: ({ x }) => x * 2,
|
||||
b: ({ x }) => x * 3
|
||||
}
|
||||
};
|
||||
export let x;
|
||||
|
||||
function a() {
|
||||
return x * 2;
|
||||
}
|
||||
|
||||
function b() {
|
||||
return x * 3;
|
||||
}
|
||||
</script>
|
@ -1,11 +1,9 @@
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
foo: 'bar'
|
||||
}),
|
||||
import { onmount } from 'svelte';
|
||||
|
||||
oncreate() {
|
||||
alert(JSON.stringify(data()));
|
||||
}
|
||||
};
|
||||
export let foo = 'bar';
|
||||
|
||||
onmount(() => {
|
||||
alert(JSON.stringify(data()));
|
||||
});
|
||||
</script>
|
@ -1,12 +1,12 @@
|
||||
<script>
|
||||
export let foo;
|
||||
|
||||
function bar() {
|
||||
return foo * 2;
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>
|
||||
{Math.max(0, foo)}
|
||||
{bar}
|
||||
{bar()}
|
||||
</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
bar: ({ foo }) => foo * 2
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,9 +1 @@
|
||||
<LazyLoad load="{() => import('./Foo.html')}"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
components: {
|
||||
LazyLoad
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,23 +1,21 @@
|
||||
{#each things as thing (thing.id)}
|
||||
<div animate:foo>{thing.name}</div>
|
||||
{/each}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
animations: {
|
||||
foo(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
export let things;
|
||||
|
||||
function foo(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
|
||||
return {
|
||||
delay: params.delay,
|
||||
duration: 100,
|
||||
tick: (t, u) => {
|
||||
node.dx = u * dx;
|
||||
node.dy = u * dy;
|
||||
}
|
||||
};
|
||||
return {
|
||||
delay: params.delay,
|
||||
duration: 100,
|
||||
tick: (t, u) => {
|
||||
node.dx = u * dx;
|
||||
node.dy = u * dy;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each things as thing (thing.id)}
|
||||
<div animate:foo>{thing.name}</div>
|
||||
{/each}
|
@ -1,16 +1,13 @@
|
||||
<button on:foo='foo( bar )'>foo</button>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
foo ( bar ) {
|
||||
console.log( bar );
|
||||
}
|
||||
},
|
||||
events: {
|
||||
foo ( node, callback ) {
|
||||
// code goes here
|
||||
}
|
||||
}
|
||||
};
|
||||
export let bar;
|
||||
|
||||
function handleFoo(bar) {
|
||||
console.log( bar );
|
||||
}
|
||||
|
||||
function foo(node, callback) {
|
||||
// code goes here
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:foo='{() => handleFoo( bar )}'>foo</button>
|
@ -1,19 +1,15 @@
|
||||
<div on:touchstart="handleTouchstart()">
|
||||
<button on:click|stopPropagation|preventDefault="handleClick()">click me</button>
|
||||
<button on:click|once|capture="handleClick()">or me</button>
|
||||
<button on:click|capture="handleClick()">or me!</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
handleTouchstart() {
|
||||
// ...
|
||||
},
|
||||
function handleTouchstart() {
|
||||
// ...
|
||||
}
|
||||
|
||||
handleClick() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
};
|
||||
function handleClick() {
|
||||
// ...
|
||||
}
|
||||
</script>
|
||||
|
||||
<div on:touchstart="{handleTouchstart}">
|
||||
<button on:click|stopPropagation|preventDefault="{handleClick}">click me</button>
|
||||
<button on:click|once|capture="{handleClick}">or me</button>
|
||||
<button on:click|capture="{handleClick}">or me!</button>
|
||||
</div>
|
@ -1,13 +1,6 @@
|
||||
<Imported/>
|
||||
<NonImported/>
|
||||
|
||||
<script>
|
||||
import Imported from 'Imported.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Imported,
|
||||
NonImported
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<Imported/>
|
||||
<NonImported/>
|
@ -1,18 +1,9 @@
|
||||
<script scope="shared">
|
||||
export const SOME_CONSTANT = 42;
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
foo ( bar ) {
|
||||
console.log( bar );
|
||||
}
|
||||
},
|
||||
setup: (Component) => {
|
||||
Component.SOME_CONSTANT = 42;
|
||||
Component.factory = function (target) {
|
||||
return new Component({
|
||||
target: target
|
||||
});
|
||||
}
|
||||
Component.prototype.foo( 'baz' );
|
||||
}
|
||||
};
|
||||
export function foo(bar) {
|
||||
console.log( bar );
|
||||
}
|
||||
</script>
|
@ -1,27 +1,25 @@
|
||||
<script scope="shared">
|
||||
export function preload(input) {
|
||||
return output;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
oncreate() {
|
||||
console.log('oncreate');
|
||||
},
|
||||
import { ondestroy, onmount } from 'svelte';
|
||||
|
||||
ondestroy() {
|
||||
console.log('ondestroy');
|
||||
},
|
||||
onmount(() => {
|
||||
console.log('oncreate');
|
||||
});
|
||||
|
||||
methods: {
|
||||
foo() {
|
||||
console.log('foo');
|
||||
}
|
||||
},
|
||||
ondestroy(() => {
|
||||
console.log('ondestroy');
|
||||
});
|
||||
|
||||
events: {
|
||||
swipe(node, callback) {
|
||||
// TODO implement
|
||||
}
|
||||
},
|
||||
function foo() {
|
||||
console.log('foo');
|
||||
}
|
||||
|
||||
preload(input) {
|
||||
return output;
|
||||
}
|
||||
};
|
||||
function swipe(node, callback) {
|
||||
// TODO implement
|
||||
}
|
||||
</script>
|
@ -1,21 +1,20 @@
|
||||
<h1 use:insert="display ? `Hello ${target}` : ''"></h1>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
actions: {
|
||||
insert(node, text) {
|
||||
export let display;
|
||||
export let target;
|
||||
|
||||
function insert(node, text) {
|
||||
|
||||
function onClick() {
|
||||
node.textContent = text;
|
||||
}
|
||||
node.addEventListener('click', onClick);
|
||||
function onClick() {
|
||||
node.textContent = text;
|
||||
}
|
||||
node.addEventListener('click', onClick);
|
||||
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('click', onClick);
|
||||
}
|
||||
}
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('click', onClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<h1 use:insert="{display ? `Hello ${target}` : ''}"></h1>
|
@ -1,22 +1,20 @@
|
||||
<button use:foo>{x}</button>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
actions: {
|
||||
foo(node) {
|
||||
let x = 0;
|
||||
export let x;
|
||||
|
||||
function foo(node) {
|
||||
let x = 0;
|
||||
|
||||
const handler = () => this.set({ x: x++ });
|
||||
const handler = () => x = x++;
|
||||
|
||||
node.addEventListener('click', handler);
|
||||
handler();
|
||||
node.addEventListener('click', handler);
|
||||
handler();
|
||||
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('click', handler);
|
||||
}
|
||||
};
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('click', handler);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<button use:foo>{x}</button>
|
@ -1,52 +1,44 @@
|
||||
<button use:tooltip="tooltip">action</button>
|
||||
<svelte:window on:keydown="checkForCtrl(event)" on:keyup="checkForCtrl(event)"/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return { tooltip: 'Perform an Action' };
|
||||
},
|
||||
export let tooltip = 'Perform an Action';
|
||||
|
||||
methods: {
|
||||
checkForCtrl(event) {
|
||||
if (event.ctrlKey) {
|
||||
this.set({ tooltip: 'Perform an augmented Action' });
|
||||
} else {
|
||||
this.set({ tooltip: 'Perform an Action' });
|
||||
}
|
||||
}
|
||||
},
|
||||
function checkForCtrl(event) {
|
||||
if (event.ctrlKey) {
|
||||
tooltip = 'Perform an augmented Action';
|
||||
} else {
|
||||
tooltip = 'Perform an Action';
|
||||
}
|
||||
}
|
||||
|
||||
actions: {
|
||||
tooltip(node, text) {
|
||||
let tooltip = null;
|
||||
function tooltip(node, text) {
|
||||
let tooltip = null;
|
||||
|
||||
function onMouseEnter() {
|
||||
tooltip = document.createElement('div');
|
||||
tooltip.classList.add('tooltip');
|
||||
tooltip.textContent = text;
|
||||
node.parentNode.appendChild(tooltip);
|
||||
}
|
||||
function onMouseEnter() {
|
||||
tooltip = document.createElement('div');
|
||||
tooltip.classList.add('tooltip');
|
||||
tooltip.textContent = text;
|
||||
node.parentNode.appendChild(tooltip);
|
||||
}
|
||||
|
||||
function onMouseLeave() {
|
||||
if (!tooltip) return;
|
||||
tooltip.remove();
|
||||
tooltip = null;
|
||||
}
|
||||
function onMouseLeave() {
|
||||
if (!tooltip) return;
|
||||
tooltip.remove();
|
||||
tooltip = null;
|
||||
}
|
||||
|
||||
node.addEventListener('mouseenter', onMouseEnter);
|
||||
node.addEventListener('mouseleave', onMouseLeave);
|
||||
node.addEventListener('mouseenter', onMouseEnter);
|
||||
node.addEventListener('mouseleave', onMouseLeave);
|
||||
|
||||
return {
|
||||
update(text) {
|
||||
if (tooltip) tooltip.textContent = text;
|
||||
},
|
||||
destroy() {
|
||||
node.removeEventListener('mouseenter', onMouseEnter);
|
||||
node.removeEventListener('mouseleave', onMouseLeave);
|
||||
}
|
||||
}
|
||||
return {
|
||||
update(text) {
|
||||
if (tooltip) tooltip.textContent = text;
|
||||
},
|
||||
destroy() {
|
||||
node.removeEventListener('mouseenter', onMouseEnter);
|
||||
node.removeEventListener('mouseleave', onMouseLeave);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<button use:tooltip="{tooltip}">action</button>
|
||||
<svelte:window on:keydown="{checkForCtrl}" on:keyup="{checkForCtrl}"/>
|
@ -1,34 +1,30 @@
|
||||
<button use:tooltip="'Perform an Action'">action</button>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
actions: {
|
||||
tooltip(node, text) {
|
||||
let tooltip = null;
|
||||
function tooltip(node, text) {
|
||||
let tooltip = null;
|
||||
|
||||
function onMouseEnter() {
|
||||
tooltip = document.createElement('div');
|
||||
tooltip.classList.add('tooltip');
|
||||
tooltip.textContent = text;
|
||||
node.parentNode.appendChild(tooltip);
|
||||
}
|
||||
function onMouseEnter() {
|
||||
tooltip = document.createElement('div');
|
||||
tooltip.classList.add('tooltip');
|
||||
tooltip.textContent = text;
|
||||
node.parentNode.appendChild(tooltip);
|
||||
}
|
||||
|
||||
function onMouseLeave() {
|
||||
if (!tooltip) return;
|
||||
tooltip.remove();
|
||||
tooltip = null;
|
||||
}
|
||||
function onMouseLeave() {
|
||||
if (!tooltip) return;
|
||||
tooltip.remove();
|
||||
tooltip = null;
|
||||
}
|
||||
|
||||
node.addEventListener('mouseenter', onMouseEnter);
|
||||
node.addEventListener('mouseleave', onMouseLeave);
|
||||
node.addEventListener('mouseenter', onMouseEnter);
|
||||
node.addEventListener('mouseleave', onMouseLeave);
|
||||
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('mouseenter', onMouseEnter);
|
||||
node.removeEventListener('mouseleave', onMouseLeave);
|
||||
}
|
||||
}
|
||||
return {
|
||||
destroy() {
|
||||
node.removeEventListener('mouseenter', onMouseEnter);
|
||||
node.removeEventListener('mouseleave', onMouseLeave);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<button use:tooltip="{'Perform an Action'}">action</button>
|
@ -1,19 +1,17 @@
|
||||
{#each things as thing (thing.id)}
|
||||
<div animate:flip>{thing.name}</div>
|
||||
{/each}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
animations: {
|
||||
flip(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
export let things;
|
||||
|
||||
function flip(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
|
||||
return {
|
||||
duration: 100,
|
||||
css: (t, u) => `transform: translate(${u + dx}px, ${u * dy}px)`
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
duration: 100,
|
||||
css: (t, u) => `transform: translate(${u + dx}px, ${u * dy}px)`
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each things as thing (thing.id)}
|
||||
<div animate:flip>{thing.name}</div>
|
||||
{/each}
|
@ -1,23 +1,21 @@
|
||||
{#each things as thing, i (thing.id)}
|
||||
<div animate:flip="{delay: i * 10}">{thing.name}</div>
|
||||
{/each}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
animations: {
|
||||
flip(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
export let things;
|
||||
|
||||
function flip(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
|
||||
return {
|
||||
delay: params.delay,
|
||||
duration: 100,
|
||||
tick: (t, u) => {
|
||||
node.dx = u * dx;
|
||||
node.dy = u * dy;
|
||||
}
|
||||
};
|
||||
return {
|
||||
delay: params.delay,
|
||||
duration: 100,
|
||||
tick: (t, u) => {
|
||||
node.dx = u * dx;
|
||||
node.dy = u * dy;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each things as thing, i (thing.id)}
|
||||
<div animate:flip="{delay: i * 10}">{thing.name}</div>
|
||||
{/each}
|
@ -1,22 +1,20 @@
|
||||
{#each things as thing (thing.id)}
|
||||
<div animate:flip>{thing.name}</div>
|
||||
{/each}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
animations: {
|
||||
flip(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
export let things;
|
||||
|
||||
function flip(node, animation, params) {
|
||||
const dx = animation.from.left - animation.to.left;
|
||||
const dy = animation.from.top - animation.to.top;
|
||||
|
||||
return {
|
||||
duration: 100,
|
||||
tick: (t, u) => {
|
||||
node.dx = u * dx;
|
||||
node.dy = u * dy;
|
||||
}
|
||||
};
|
||||
return {
|
||||
duration: 100,
|
||||
tick: (t, u) => {
|
||||
node.dx = u * dx;
|
||||
node.dy = u * dy;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each things as thing (thing.id)}
|
||||
<div animate:flip>{thing.name}</div>
|
||||
{/each}
|
@ -1,9 +1,5 @@
|
||||
<div {id}/>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
id: 'foo'
|
||||
})
|
||||
};
|
||||
export let id = 'foo';
|
||||
</script>
|
||||
|
||||
<div {id}/>
|
@ -1,9 +1,5 @@
|
||||
<div style='color: {color};'>{color}</div>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
color: 'red'
|
||||
})
|
||||
};
|
||||
export let color = 'red';
|
||||
</script>
|
||||
|
||||
<div style='color: {color};'>{color}</div>
|
@ -1,11 +1,5 @@
|
||||
<Component value="10px"/>
|
||||
|
||||
<script>
|
||||
import Component from './Component.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Component
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<Component value="10px"/>
|
@ -1,13 +1,9 @@
|
||||
{#await promise then value}
|
||||
<Foo {value} />
|
||||
{/await}
|
||||
|
||||
<script>
|
||||
import Foo from './Foo.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Foo
|
||||
}
|
||||
};
|
||||
export let promise;
|
||||
</script>
|
||||
|
||||
{#await promise then value}
|
||||
<Foo {value} />
|
||||
{/await}
|
@ -1,7 +1,7 @@
|
||||
{#await thePromise}
|
||||
<p>loading...</p>
|
||||
{:then theValue}
|
||||
<button ref:button on:click='set({ clicked: theValue })'>click me</button>
|
||||
<button ref:button on:click='{() => clicked = theValue}'>click me</button>
|
||||
{:catch theError}
|
||||
<p>oh no! {theError.message}</p>
|
||||
{/await}
|
@ -1,15 +1,13 @@
|
||||
<script>
|
||||
export let items;
|
||||
|
||||
function numCompleted() {
|
||||
return items.reduce( ( total, item ) => total + ( item.completed ? 1 : 0 ), 0 );
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each items as item}
|
||||
<div><input type='checkbox' bind:checked='item.completed'><p>{item.description}</p></div>
|
||||
{/each}
|
||||
|
||||
<p>{numCompleted} completed</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
numCompleted ({ items }) {
|
||||
return items.reduce( ( total, item ) => total + ( item.completed ? 1 : 0 ), 0 );
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<p>{numCompleted()} completed</p>
|
@ -1,14 +1,11 @@
|
||||
{#each cats as cat (cat.name)}
|
||||
<input type="checkbox" bind:checked="cat.checked" on:change="someCheck()">
|
||||
{/each}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
oncreate() {},
|
||||
methods: {
|
||||
someCheck() {
|
||||
console.log('Check');
|
||||
}
|
||||
},
|
||||
};
|
||||
export let cats;
|
||||
|
||||
function someCheck() {
|
||||
console.log('Check');
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each cats as cat (cat.name)}
|
||||
<input type="checkbox" bind:checked="cat.checked" on:change="{someCheck}">
|
||||
{/each}
|
@ -1 +1 @@
|
||||
<input bind:value='a' on:input='set({ b: 0 })'>
|
||||
<input bind:value='a' on:input='{() => b = 0}'>
|
@ -1,20 +1,11 @@
|
||||
<script>
|
||||
export let hidden = true;
|
||||
|
||||
export function toggle() {
|
||||
hidden = !this.get().hidden;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if !hidden}
|
||||
<slot></slot>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
hidden: true
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
toggle () {
|
||||
this.set({
|
||||
hidden: !this.get().hidden
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,15 +1,13 @@
|
||||
<Two bind:foo/>
|
||||
|
||||
<script>
|
||||
import { onmount } from 'svelte';
|
||||
import Two from './Two.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Two
|
||||
},
|
||||
export let snapshot;
|
||||
export let foo;
|
||||
|
||||
oncreate() {
|
||||
this.snapshot = this.get().foo;
|
||||
}
|
||||
};
|
||||
onmount(() => {
|
||||
snapshot = foo;
|
||||
});
|
||||
</script>
|
||||
|
||||
<Two bind:foo/>
|
@ -1,15 +1,7 @@
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
bar: 1
|
||||
};
|
||||
},
|
||||
export let bar = 1;
|
||||
|
||||
computed: {
|
||||
foo({ bar }) {
|
||||
return bar * 2;
|
||||
}
|
||||
}
|
||||
};
|
||||
function foo() {
|
||||
return bar * 2;
|
||||
}
|
||||
</script>
|
@ -1,9 +1,5 @@
|
||||
<One ref:one/>
|
||||
|
||||
<script>
|
||||
import One from './One.html';
|
||||
|
||||
export default {
|
||||
components: { One }
|
||||
};
|
||||
</script>
|
||||
|
||||
<One ref:one/>
|
@ -1,20 +1,12 @@
|
||||
<p>bar in Foo: {bar}</p>
|
||||
<p>baz in Foo: {baz}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
bar: 1,
|
||||
baz: 2
|
||||
};
|
||||
},
|
||||
export let bar = 1;
|
||||
export let baz = 2;
|
||||
|
||||
methods: {
|
||||
double() {
|
||||
const { bar, baz } = this.get();
|
||||
this.set({ bar: bar * 2, baz: baz * 2 });
|
||||
}
|
||||
}
|
||||
};
|
||||
export function double() {
|
||||
bar = bar * 2;
|
||||
baz = baz * 2;
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>bar in Foo: {bar}</p>
|
||||
<p>baz in Foo: {baz}</p>
|
@ -1,12 +1,9 @@
|
||||
<Foo ref:foo bind:bar bind:baz/>
|
||||
<p ref:p>{bar + baz}</p>
|
||||
|
||||
<script>
|
||||
import Foo from './Foo.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Foo
|
||||
}
|
||||
};
|
||||
export let bar;
|
||||
export let baz;
|
||||
</script>
|
||||
|
||||
<Foo ref:foo bind:bar bind:baz/>
|
||||
<p ref:p>{bar + baz}</p>
|
@ -1,11 +1,9 @@
|
||||
<div class:active="isActive(user)"></div>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
helpers: {
|
||||
isActive(user) {
|
||||
return user.active;
|
||||
}
|
||||
}
|
||||
export let user;
|
||||
|
||||
function isActive(user) {
|
||||
return user.active;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class:active="isActive(user)"></div>
|
@ -1,22 +1,12 @@
|
||||
{#if x}
|
||||
<Widget bind:foo='bar.baz'/>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
data: function () {
|
||||
return {
|
||||
x: false,
|
||||
bar: {
|
||||
baz: 42
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
Widget
|
||||
}
|
||||
export let x = false;
|
||||
export let bar = {
|
||||
baz: 42
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if x}
|
||||
<Widget bind:foo='bar.baz'/>
|
||||
{/if}
|
@ -1,22 +1,13 @@
|
||||
{#each fields as field}
|
||||
<Nested {field} bind:value='values[field]'/>
|
||||
{/each}
|
||||
|
||||
<script>
|
||||
import Nested from './Nested.html';
|
||||
|
||||
export default {
|
||||
data: function () {
|
||||
return {
|
||||
fields: ['firstname', 'lastname'],
|
||||
values: {
|
||||
firstname: '',
|
||||
lastname: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
components: {
|
||||
Nested
|
||||
}
|
||||
export let fields = ['firstname', 'lastname'];
|
||||
export let values = {
|
||||
firstname: '',
|
||||
lastname: ''
|
||||
};
|
||||
</script>
|
||||
|
||||
{#each fields as field}
|
||||
<Nested {field} bind:value='values[field]'/>
|
||||
{/each}
|
@ -1,9 +1,5 @@
|
||||
<p>y: {y}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
y: 'bar'
|
||||
})
|
||||
};
|
||||
export let y = 'bar';
|
||||
</script>
|
||||
|
||||
<p>y: {y}</p>
|
@ -1,7 +1,3 @@
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
x: true
|
||||
})
|
||||
};
|
||||
export let x = true;
|
||||
</script>
|
@ -1,9 +1,5 @@
|
||||
<p>y: {y}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
y: 'foo'
|
||||
})
|
||||
};
|
||||
export let y = 'foo';
|
||||
</script>
|
||||
|
||||
<p>y: {y}</p>
|
@ -1,9 +1,5 @@
|
||||
<p>y: {y}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
y: 'bar'
|
||||
})
|
||||
};
|
||||
export let y = 'bar';
|
||||
</script>
|
||||
|
||||
<p>y: {y}</p>
|
@ -1,7 +1,3 @@
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
x: true
|
||||
})
|
||||
};
|
||||
export let x = true;
|
||||
</script>
|
@ -1,9 +1,5 @@
|
||||
<p>y: {y}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
y: 'foo'
|
||||
})
|
||||
};
|
||||
export let y = 'foo';
|
||||
</script>
|
||||
|
||||
<p>y: {y}</p>
|
@ -1,44 +1,37 @@
|
||||
<ComponentSelector {components} bind:selectedComponent/>
|
||||
<Editor bind:code='selectedComponent.source' />
|
||||
|
||||
<pre>
|
||||
{compiled}
|
||||
</pre>
|
||||
|
||||
<script>
|
||||
import { onprops } from 'svelte';
|
||||
|
||||
import Editor from './Editor.html';
|
||||
import ComponentSelector from './ComponentSelector.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ComponentSelector,
|
||||
Editor
|
||||
},
|
||||
|
||||
onstate({ changed, current }) {
|
||||
const { selectedComponent } = this.get();
|
||||
export let components;
|
||||
export let selectedComponent;
|
||||
export let compiled;
|
||||
|
||||
if (changed.components) {
|
||||
components.forEach(component => {
|
||||
if (component === selectedComponent) return;
|
||||
component.compiled = component.source.toUpperCase();
|
||||
});
|
||||
}
|
||||
let previouslySelectedComponent;
|
||||
|
||||
if (changed.selectedComponent) {
|
||||
selectedComponent.compiled = selectedComponent.source.toUpperCase();
|
||||
this.updateBundle();
|
||||
}
|
||||
},
|
||||
onprops(() => {
|
||||
components.forEach(component => {
|
||||
if (component === selectedComponent) return;
|
||||
component.compiled = component.source.toUpperCase();
|
||||
});
|
||||
|
||||
methods: {
|
||||
updateBundle() {
|
||||
const components = this.get('components');
|
||||
if (selectedComponent !== previouslySelectedComponent) {
|
||||
selectedComponent.compiled = selectedComponent.source.toUpperCase();
|
||||
updateBundle();
|
||||
|
||||
const compiled = components.map(component => component.compiled).join('\n');
|
||||
|
||||
this.set({ compiled });
|
||||
}
|
||||
previouslySelectedComponent = selectedComponent;
|
||||
}
|
||||
});
|
||||
|
||||
function updateBundle() {
|
||||
compiled = components.map(component => component.compiled).join('\n');
|
||||
}
|
||||
</script>
|
||||
|
||||
<ComponentSelector {components} bind:selectedComponent/>
|
||||
<Editor bind:code='selectedComponent.source' />
|
||||
|
||||
<pre>
|
||||
{compiled}
|
||||
</pre>
|
@ -1,21 +1,11 @@
|
||||
<Widget bind:value='deep.name'/>
|
||||
|
||||
<p>{deep.name}</p>
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
deep: {
|
||||
name: 'foo'
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
Widget
|
||||
}
|
||||
export let deep = {
|
||||
name: 'foo'
|
||||
};
|
||||
</script>
|
||||
|
||||
<Widget bind:value='deep.name'/>
|
||||
|
||||
<p>{deep.name}</p>
|
@ -1,13 +1,9 @@
|
||||
{#each a as x}
|
||||
<Widget bind:value='x'/>
|
||||
{/each}
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Widget
|
||||
}
|
||||
};
|
||||
export let a;
|
||||
</script>
|
||||
|
||||
{#each a as x}
|
||||
<Widget bind:value='x'/>
|
||||
{/each}
|
@ -1,12 +1,8 @@
|
||||
<B bind:currentIdentifier />
|
||||
<B bind:currentIdentifier />
|
||||
|
||||
<script>
|
||||
import B from './B.html';
|
||||
import B from './B.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
B
|
||||
}
|
||||
}
|
||||
export let currentIdentifier;
|
||||
</script>
|
||||
|
||||
<B bind:currentIdentifier />
|
||||
<B bind:currentIdentifier />
|
@ -1,23 +1,19 @@
|
||||
<span
|
||||
on:click="toggle()"
|
||||
class="{isCurrentlySelected ? 'selected' : ''}"
|
||||
>
|
||||
<slot></slot>
|
||||
</span>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
computed: {
|
||||
isCurrentlySelected: ({ currentIdentifier, identifier }) => currentIdentifier === identifier
|
||||
},
|
||||
methods: {
|
||||
toggle() {
|
||||
const isCurrentlySelected = this.get().isCurrentlySelected
|
||||
export let currentIdentifier;
|
||||
export let identifier;
|
||||
|
||||
function isCurrentlySelected() {
|
||||
return currentIdentifier === identifier;
|
||||
}
|
||||
|
||||
this.set({
|
||||
currentIdentifier: isCurrentlySelected ? null : this.get().identifier
|
||||
})
|
||||
}
|
||||
function toggle() {
|
||||
currentIdentifier = isCurrentlySelected ? null : identifier
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<span
|
||||
on:click="{toggle}"
|
||||
class="{isCurrentlySelected() ? 'selected' : ''}"
|
||||
>
|
||||
<slot></slot>
|
||||
</span>
|
@ -1,17 +1,8 @@
|
||||
<A bind:currentIdentifier />
|
||||
<A bind:currentIdentifier />
|
||||
|
||||
<script>
|
||||
import A from './A.html';
|
||||
import A from './A.html';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentIdentifier: 2
|
||||
}
|
||||
},
|
||||
components: {
|
||||
A
|
||||
}
|
||||
}
|
||||
export let currentIdentifier = 2;
|
||||
</script>
|
||||
|
||||
<A bind:currentIdentifier />
|
||||
<A bind:currentIdentifier />
|
@ -1,14 +1,11 @@
|
||||
<button on:click='set({ "x-count": state["x-count"] + 1 })'>+1</button>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
"x-count": 0
|
||||
}),
|
||||
computed: {
|
||||
state(arg) {
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
};
|
||||
export let undefined = 0;
|
||||
|
||||
function state() {
|
||||
// [svelte-upgrade warning]
|
||||
// this function needs to be manually rewritten
|
||||
return arg;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click='{() => undefined += 1}'>+1</button>
|
@ -1,12 +1,8 @@
|
||||
<Counter bind:x-count='x'/>
|
||||
<p>count: {x}</p>
|
||||
|
||||
<script>
|
||||
import Counter from './Counter.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Counter
|
||||
}
|
||||
};
|
||||
export let x;
|
||||
</script>
|
||||
|
||||
<Counter bind:x-count='x'/>
|
||||
<p>count: {x}</p>
|
@ -1,12 +1,10 @@
|
||||
<button class='bar' on:click='set({ x: "q" })'>bar</button>
|
||||
<p>bar x: {x}</p>
|
||||
|
||||
<Baz bind:x/>
|
||||
|
||||
<script>
|
||||
import Baz from './Baz.html';
|
||||
|
||||
export default {
|
||||
components: { Baz }
|
||||
};
|
||||
export let x;
|
||||
</script>
|
||||
|
||||
<button class='bar' on:click='{() => x = "q"}'>bar</button>
|
||||
<p>bar x: {x}</p>
|
||||
|
||||
<Baz bind:x/>
|
@ -1,2 +1,2 @@
|
||||
<button class='baz' on:click='set({ x: "r" })'>baz</button>
|
||||
<button class='baz' on:click='{() => x = "r"}'>baz</button>
|
||||
<p>baz x: {x}</p>
|
@ -1,12 +1,10 @@
|
||||
<button class='foo' on:click='set({ x: "p" })'>foo</button>
|
||||
<p>foo x: {x}</p>
|
||||
|
||||
<Bar bind:x/>
|
||||
|
||||
<script>
|
||||
import Bar from './Bar.html';
|
||||
|
||||
export default {
|
||||
components: { Bar }
|
||||
};
|
||||
export let x;
|
||||
</script>
|
||||
|
||||
<button class='foo' on:click='{() => x = "p"}'>foo</button>
|
||||
<p>foo x: {x}</p>
|
||||
|
||||
<Bar bind:x/>
|
@ -1,11 +1,9 @@
|
||||
<p>x: {x}</p>
|
||||
|
||||
<Foo bind:x/>
|
||||
|
||||
<script>
|
||||
import Foo from './Foo.html';
|
||||
|
||||
export default {
|
||||
components: { Foo }
|
||||
};
|
||||
export let x;
|
||||
</script>
|
||||
|
||||
<p>x: {x}</p>
|
||||
|
||||
<Foo bind:x/>
|
@ -1,9 +1,5 @@
|
||||
<button on:click='set({ count: count + 1 })'>+1</button>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
count: 0
|
||||
})
|
||||
};
|
||||
export let count = 0;
|
||||
</script>
|
||||
|
||||
<button on:click='{() => count += 1}'>+1</button>
|
@ -1,16 +1,8 @@
|
||||
<Counter bind:count='x'/>
|
||||
<p>count: {x}</p>
|
||||
|
||||
<script>
|
||||
import Counter from './Counter.html';
|
||||
|
||||
export default {
|
||||
data: () => ({
|
||||
x: 10
|
||||
}),
|
||||
|
||||
components: {
|
||||
Counter
|
||||
}
|
||||
};
|
||||
export let x = 10;
|
||||
</script>
|
||||
|
||||
<Counter bind:count='x'/>
|
||||
<p>count: {x}</p>
|
@ -1 +1 @@
|
||||
<button on:click="set({show:false})">Hide</button>
|
||||
<button on:click="{() => show = false}">Hide</button>
|
@ -1,14 +1,10 @@
|
||||
<script>
|
||||
import Nested from './Nested.html';
|
||||
export let show;
|
||||
</script>
|
||||
|
||||
{#if show}
|
||||
<Nested bind:show/>
|
||||
{:else}
|
||||
<button on:click="set({show:true})">Show</button>
|
||||
<button on:click="{() => show = true}">Show</button>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
import Nested from './Nested.html';
|
||||
export default {
|
||||
components: {
|
||||
Nested
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,9 +1,5 @@
|
||||
<button on:click='set({ count: count + 1 })'>+1</button>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
count: 0
|
||||
})
|
||||
};
|
||||
export let count = 0;
|
||||
</script>
|
||||
|
||||
<button on:click='{() => count += 1}'>+1</button>
|
@ -1,12 +1,8 @@
|
||||
<Counter bind:count='x'/>
|
||||
<p>count: {x}</p>
|
||||
|
||||
<script>
|
||||
import Counter from './Counter.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Counter
|
||||
}
|
||||
};
|
||||
export let x;
|
||||
</script>
|
||||
|
||||
<Counter bind:count='x'/>
|
||||
<p>count: {x}</p>
|
@ -1,17 +1,10 @@
|
||||
{#if foo}
|
||||
<Widget p='{q}'/>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
data: () => ({
|
||||
foo: false
|
||||
}),
|
||||
|
||||
components: {
|
||||
Widget
|
||||
}
|
||||
};
|
||||
export let foo = false;
|
||||
export let q;
|
||||
</script>
|
||||
|
||||
{#if foo}
|
||||
<Widget p='{q}'/>
|
||||
{/if}
|
@ -1,11 +1,9 @@
|
||||
<div>
|
||||
<Widget {foo}/>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
components: { Widget }
|
||||
};
|
||||
export let foo;
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<Widget {foo}/>
|
||||
</div>
|
@ -1,11 +1,12 @@
|
||||
<div>
|
||||
<Widget foo='{bar}' baz='{40 + x}' qux='this is a {compound} string' quux='{go.deeper}'/>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
components: { Widget }
|
||||
};
|
||||
export let bar;
|
||||
export let x;
|
||||
export let compound;
|
||||
export let go;
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<Widget foo='{bar}' baz='{40 + x}' qux='this is a {compound} string' quux='{go.deeper}'/>
|
||||
</div>
|
@ -1,11 +1,7 @@
|
||||
<div>
|
||||
<Widget foo=''/>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
components: { Widget }
|
||||
};
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<Widget foo=''/>
|
||||
</div>
|
@ -1,10 +1,5 @@
|
||||
<Link x href="/cool"/>
|
||||
|
||||
<script>
|
||||
import Link from './Link.html';
|
||||
export default {
|
||||
components: {
|
||||
Link
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<Link x href="/cool"/>
|
@ -1,9 +1,5 @@
|
||||
<Foo x/>
|
||||
|
||||
<script>
|
||||
import Foo from './Foo.html';
|
||||
|
||||
export default {
|
||||
components: { Foo }
|
||||
};
|
||||
</script>
|
||||
|
||||
<Foo x/>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue