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>
|
<script>
|
||||||
export default {
|
export function updateFoo(value) {
|
||||||
tag: 'custom-element',
|
foo = value;
|
||||||
|
|
||||||
methods: {
|
|
||||||
updateFoo(value) {
|
|
||||||
this.foo = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
export let foo;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>{foo}</p>
|
@ -1,7 +1,7 @@
|
|||||||
<h1>Hello {name}!</h1>
|
<svelte:meta tag="custom-element"/>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let name;
|
||||||
tag: 'custom-element'
|
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
export default {
|
export let count = 0;
|
||||||
tag: 'my-counter',
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
count: 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<button on:click='{() => count += 1}'>count: {count}</button>
|
@ -1,12 +1,10 @@
|
|||||||
<Counter bind:count/>
|
<svelte:meta tag="my-app"/>
|
||||||
<p>clicked {count} times</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Counter from './Counter.html';
|
import Counter from './Counter.html';
|
||||||
|
|
||||||
export default {
|
export let count;
|
||||||
tag: 'my-app',
|
|
||||||
|
|
||||||
components: { Counter }
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Counter bind:count/>
|
||||||
|
<p>clicked {count} times</p>
|
@ -1,7 +1,7 @@
|
|||||||
<h1>Hello {name}!</h1>
|
<svelte:meta tag="custom-element"/>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let name;
|
||||||
tag: 'custom-element'
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<h1>Hello {name}!</h1>
|
@ -1,8 +1,9 @@
|
|||||||
<p>foo: {foo}</p>
|
<svelte:meta tag="my-app"/>
|
||||||
<p>bar: {bar}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let foo;
|
||||||
tag: 'my-app'
|
export let bar;
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>foo: {foo}</p>
|
||||||
|
<p>bar: {bar}</p>
|
@ -1,9 +1,12 @@
|
|||||||
|
<svelte:meta tag="my-app"/>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
import { onmount } from 'svelte';
|
||||||
tag: 'my-app',
|
|
||||||
|
export let wasCreated;
|
||||||
|
|
||||||
oncreate() {
|
onmount(() => {
|
||||||
this.wasCreated = true;
|
wasCreated = true;
|
||||||
}
|
});
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
<my-widget class="foo" {items}/>
|
<svelte:meta tag="custom-element"/>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import './my-widget.html';
|
import './my-widget.html';
|
||||||
|
|
||||||
export default {
|
export let items = ['a', 'b', 'c'];
|
||||||
tag: 'custom-element',
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
items: ['a', 'b', 'c']
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<my-widget class="foo" {items}/>
|
@ -1,14 +1,8 @@
|
|||||||
<p>{items.length} items</p>
|
<svelte:meta tag="my-widget"/>
|
||||||
<p>{items.join(', ')}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let items = [];
|
||||||
tag: 'my-widget',
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
items: []
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>{items.length} items</p>
|
||||||
|
<p>{items.join(', ')}</p>
|
@ -1,13 +1,7 @@
|
|||||||
<div>
|
|
||||||
<Nested/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Nested from './Nested.html';
|
import Nested from './Nested.html';
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
Nested
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Nested/>
|
||||||
|
</div>
|
@ -1,11 +1,5 @@
|
|||||||
<Nested/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Nested from './Nested.html';
|
import Nested from './Nested.html';
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
Nested
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</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}
|
{#if clicked}
|
||||||
<p>clicked!</p>
|
<p>clicked!</p>
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
<Nested foo={[1, 2, 3]}/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
const Nested = window.Nested;
|
||||||
components: {
|
|
||||||
Nested: window.Nested
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Nested foo={[1, 2, 3]}/>
|
@ -1,10 +1,7 @@
|
|||||||
<Nested foo='bar'/>
|
<svelte:meta immutable/>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
const Nested = window.Nested;
|
||||||
immutable: true,
|
|
||||||
components: {
|
|
||||||
Nested: window.Nested
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Nested foo='bar'/>
|
@ -1,9 +1,5 @@
|
|||||||
<Nested foo='bar'/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
const Nested = window.Nested;
|
||||||
components: {
|
|
||||||
Nested: window.Nested
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Nested foo='bar'/>
|
@ -1,9 +1,5 @@
|
|||||||
<Nested foo='bar'/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
const Nested = window.Nested;
|
||||||
components: {
|
|
||||||
Nested: window.Nested
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Nested foo='bar'/>
|
@ -1,8 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export let x;
|
||||||
computed: {
|
|
||||||
a: ({ x }) => x * 2,
|
function a() {
|
||||||
b: ({ x }) => x * 3
|
return x * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
function b() {
|
||||||
|
return x * 3;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
</script>
|
@ -1,11 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
import { onmount } from 'svelte';
|
||||||
data: () => ({
|
|
||||||
foo: 'bar'
|
|
||||||
}),
|
|
||||||
|
|
||||||
oncreate() {
|
export let foo = 'bar';
|
||||||
|
|
||||||
|
onmount(() => {
|
||||||
alert(JSON.stringify(data()));
|
alert(JSON.stringify(data()));
|
||||||
}
|
});
|
||||||
};
|
|
||||||
</script>
|
</script>
|
@ -1,12 +1,12 @@
|
|||||||
<p>
|
|
||||||
{Math.max(0, foo)}
|
|
||||||
{bar}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let foo;
|
||||||
computed: {
|
|
||||||
bar: ({ foo }) => foo * 2
|
function bar() {
|
||||||
|
return foo * 2;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{Math.max(0, foo)}
|
||||||
|
{bar()}
|
||||||
|
</p>
|
@ -1,9 +1 @@
|
|||||||
<LazyLoad load="{() => import('./Foo.html')}"/>
|
<LazyLoad load="{() => import('./Foo.html')}"/>
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
LazyLoad
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
@ -1,16 +1,13 @@
|
|||||||
<button on:foo='foo( bar )'>foo</button>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let bar;
|
||||||
methods: {
|
|
||||||
foo ( bar ) {
|
function handleFoo(bar) {
|
||||||
console.log( bar );
|
console.log( bar );
|
||||||
}
|
}
|
||||||
},
|
|
||||||
events: {
|
function foo(node, callback) {
|
||||||
foo ( node, callback ) {
|
|
||||||
// code goes here
|
// code goes here
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
export default {
|
function handleTouchstart() {
|
||||||
methods: {
|
|
||||||
handleTouchstart() {
|
|
||||||
// ...
|
// ...
|
||||||
},
|
}
|
||||||
|
|
||||||
handleClick() {
|
function handleClick() {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
import Imported from 'Imported.html';
|
import Imported from 'Imported.html';
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
Imported,
|
|
||||||
NonImported
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Imported/>
|
||||||
|
<NonImported/>
|
@ -1,18 +1,9 @@
|
|||||||
|
<script scope="shared">
|
||||||
|
export const SOME_CONSTANT = 42;
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export function foo(bar) {
|
||||||
methods: {
|
|
||||||
foo ( bar ) {
|
|
||||||
console.log( bar );
|
console.log( bar );
|
||||||
}
|
}
|
||||||
},
|
|
||||||
setup: (Component) => {
|
|
||||||
Component.SOME_CONSTANT = 42;
|
|
||||||
Component.factory = function (target) {
|
|
||||||
return new Component({
|
|
||||||
target: target
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Component.prototype.foo( 'baz' );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
@ -1,27 +1,25 @@
|
|||||||
|
<script scope="shared">
|
||||||
|
export function preload(input) {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
import { ondestroy, onmount } from 'svelte';
|
||||||
oncreate() {
|
|
||||||
|
onmount(() => {
|
||||||
console.log('oncreate');
|
console.log('oncreate');
|
||||||
},
|
});
|
||||||
|
|
||||||
ondestroy() {
|
ondestroy(() => {
|
||||||
console.log('ondestroy');
|
console.log('ondestroy');
|
||||||
},
|
});
|
||||||
|
|
||||||
methods: {
|
function foo() {
|
||||||
foo() {
|
|
||||||
console.log('foo');
|
console.log('foo');
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
events: {
|
function swipe(node, callback) {
|
||||||
swipe(node, callback) {
|
|
||||||
// TODO implement
|
// TODO implement
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
preload(input) {
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
@ -1,9 +1,5 @@
|
|||||||
<div {id}/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let id = 'foo';
|
||||||
data: () => ({
|
|
||||||
id: 'foo'
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div {id}/>
|
@ -1,9 +1,5 @@
|
|||||||
<div style='color: {color};'>{color}</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let color = 'red';
|
||||||
data: () => ({
|
|
||||||
color: 'red'
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div style='color: {color};'>{color}</div>
|
@ -1,11 +1,5 @@
|
|||||||
<Component value="10px"/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Component from './Component.html';
|
import Component from './Component.html';
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
Component
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Component value="10px"/>
|
@ -1,13 +1,9 @@
|
|||||||
{#await promise then value}
|
|
||||||
<Foo {value} />
|
|
||||||
{/await}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Foo from './Foo.html';
|
import Foo from './Foo.html';
|
||||||
|
|
||||||
export default {
|
export let promise;
|
||||||
components: {
|
|
||||||
Foo
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#await promise then value}
|
||||||
|
<Foo {value} />
|
||||||
|
{/await}
|
@ -1,7 +1,7 @@
|
|||||||
{#await thePromise}
|
{#await thePromise}
|
||||||
<p>loading...</p>
|
<p>loading...</p>
|
||||||
{:then theValue}
|
{: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}
|
{:catch theError}
|
||||||
<p>oh no! {theError.message}</p>
|
<p>oh no! {theError.message}</p>
|
||||||
{/await}
|
{/await}
|
@ -1,27 +1,22 @@
|
|||||||
<select bind:value="selected.letter">
|
|
||||||
{#each uppercase as letter}
|
|
||||||
<option value="{letter}">{letter}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
{selected.letter}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let letters = [
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
letters: [
|
|
||||||
'a',
|
'a',
|
||||||
'b',
|
'b',
|
||||||
'c'
|
'c'
|
||||||
],
|
];
|
||||||
selected: {
|
export let selected = {
|
||||||
letter: ''
|
letter: ''
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed:{
|
|
||||||
uppercase: ({ letters }) => letters.map(x => x.toUpperCase())
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function uppercase() {
|
||||||
|
return letters.map(x => x.toUpperCase());
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<select bind:value="selected.letter">
|
||||||
|
{#each uppercase as letter}
|
||||||
|
<option value="{letter}">{letter}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
{selected.letter}
|
@ -1,15 +1,13 @@
|
|||||||
{#each items as item}
|
|
||||||
<div><input type='checkbox' bind:checked='item.completed'><p>{item.description}</p></div>
|
|
||||||
{/each}
|
|
||||||
|
|
||||||
<p>{numCompleted} completed</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let items;
|
||||||
computed: {
|
|
||||||
numCompleted ({ items }) {
|
function numCompleted() {
|
||||||
return items.reduce( ( total, item ) => total + ( item.completed ? 1 : 0 ), 0 );
|
return items.reduce( ( total, item ) => total + ( item.completed ? 1 : 0 ), 0 );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#each items as item}
|
||||||
|
<div><input type='checkbox' bind:checked='item.completed'><p>{item.description}</p></div>
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
<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>
|
<script>
|
||||||
export default {
|
export let cats;
|
||||||
oncreate() {},
|
|
||||||
methods: {
|
function someCheck() {
|
||||||
someCheck() {
|
|
||||||
console.log('Check');
|
console.log('Check');
|
||||||
}
|
}
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</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 @@
|
|||||||
{#if !hidden}
|
|
||||||
<slot></slot>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let hidden = true;
|
||||||
data () {
|
|
||||||
return {
|
export function toggle() {
|
||||||
hidden: true
|
hidden = !this.get().hidden;
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toggle () {
|
|
||||||
this.set({
|
|
||||||
hidden: !this.get().hidden
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if !hidden}
|
||||||
|
<slot></slot>
|
||||||
|
{/if}
|
@ -1,15 +1,13 @@
|
|||||||
<Two bind:foo/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { onmount } from 'svelte';
|
||||||
import Two from './Two.html';
|
import Two from './Two.html';
|
||||||
|
|
||||||
export default {
|
export let snapshot;
|
||||||
components: {
|
export let foo;
|
||||||
Two
|
|
||||||
},
|
|
||||||
|
|
||||||
oncreate() {
|
onmount(() => {
|
||||||
this.snapshot = this.get().foo;
|
snapshot = foo;
|
||||||
}
|
});
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Two bind:foo/>
|
@ -1,15 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export let bar = 1;
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
bar: 1
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
function foo() {
|
||||||
foo({ bar }) {
|
|
||||||
return bar * 2;
|
return bar * 2;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
@ -1,9 +1,5 @@
|
|||||||
<One ref:one/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import One from './One.html';
|
import One from './One.html';
|
||||||
|
|
||||||
export default {
|
|
||||||
components: { One }
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<One ref:one/>
|
@ -1,20 +1,12 @@
|
|||||||
<p>bar in Foo: {bar}</p>
|
|
||||||
<p>baz in Foo: {baz}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let bar = 1;
|
||||||
data() {
|
export let baz = 2;
|
||||||
return {
|
|
||||||
bar: 1,
|
|
||||||
baz: 2
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
export function double() {
|
||||||
double() {
|
bar = bar * 2;
|
||||||
const { bar, baz } = this.get();
|
baz = baz * 2;
|
||||||
this.set({ bar: bar * 2, baz: baz * 2 });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
import Foo from './Foo.html';
|
import Foo from './Foo.html';
|
||||||
|
|
||||||
export default {
|
export let bar;
|
||||||
components: {
|
export let baz;
|
||||||
Foo
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
export default {
|
export let user;
|
||||||
helpers: {
|
|
||||||
isActive(user) {
|
function isActive(user) {
|
||||||
return user.active;
|
return user.active;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div class:active="isActive(user)"></div>
|
@ -1,33 +1,22 @@
|
|||||||
<input type='number' bind:value='count'>
|
|
||||||
|
|
||||||
<ol>
|
|
||||||
{#each ids as id}
|
|
||||||
<Nested {id} bind:value="idToValue[id]">
|
|
||||||
{id}: value is {idToValue[id]}
|
|
||||||
</Nested>
|
|
||||||
{/each}
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Nested from './Nested.html';
|
import Nested from './Nested.html';
|
||||||
|
|
||||||
export default {
|
export let count;
|
||||||
data() {
|
export let idToValue = Object.create(null);
|
||||||
return {
|
|
||||||
idToValue: Object.create(null)
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
function ids() {
|
||||||
ids({ count }) {
|
|
||||||
return new Array(count)
|
return new Array(count)
|
||||||
.fill(null)
|
.fill(null)
|
||||||
.map((_, i) => 'id-' + i);
|
.map((_, i) => 'id-' + i);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
Nested
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<input type='number' bind:value='count'>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
{#each ids as id}
|
||||||
|
<Nested {id} bind:value="idToValue[id]">
|
||||||
|
{id}: value is {idToValue[id]}
|
||||||
|
</Nested>
|
||||||
|
{/each}
|
||||||
|
</ol>
|
@ -1,34 +1,23 @@
|
|||||||
<input type='number' bind:value='count'>
|
|
||||||
|
|
||||||
<ol>
|
|
||||||
{#each ids as object (object.id)}
|
|
||||||
<Nested bind:value='idToValue[object.id]' id='{object.id}'>
|
|
||||||
{object.id}: value is {idToValue[object.id]}
|
|
||||||
</Nested>
|
|
||||||
{/each}
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Nested from './Nested.html';
|
import Nested from './Nested.html';
|
||||||
|
|
||||||
export default {
|
export let count;
|
||||||
data() {
|
export let idToValue = Object.create(null);
|
||||||
return {
|
|
||||||
idToValue: Object.create(null)
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
function ids() {
|
||||||
ids({ count }) {
|
|
||||||
return new Array(count)
|
return new Array(count)
|
||||||
.fill(null)
|
.fill(null)
|
||||||
.map((_, i) => ({ id: 'id-' + i}))
|
.map((_, i) => ({ id: 'id-' + i}))
|
||||||
.reverse();
|
.reverse();
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
Nested
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<input type='number' bind:value='count'>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
{#each ids as object (object.id)}
|
||||||
|
<Nested bind:value='idToValue[object.id]' id='{object.id}'>
|
||||||
|
{object.id}: value is {idToValue[object.id]}
|
||||||
|
</Nested>
|
||||||
|
{/each}
|
||||||
|
</ol>
|
@ -1,22 +1,12 @@
|
|||||||
{#if x}
|
|
||||||
<Widget bind:foo='bar.baz'/>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Widget from './Widget.html';
|
import Widget from './Widget.html';
|
||||||
|
|
||||||
export default {
|
export let x = false;
|
||||||
data: function () {
|
export let bar = {
|
||||||
return {
|
|
||||||
x: false,
|
|
||||||
bar: {
|
|
||||||
baz: 42
|
baz: 42
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
Widget
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</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>
|
<script>
|
||||||
import Nested from './Nested.html';
|
import Nested from './Nested.html';
|
||||||
|
|
||||||
export default {
|
export let fields = ['firstname', 'lastname'];
|
||||||
data: function () {
|
export let values = {
|
||||||
return {
|
|
||||||
fields: ['firstname', 'lastname'],
|
|
||||||
values: {
|
|
||||||
firstname: '',
|
firstname: '',
|
||||||
lastname: ''
|
lastname: ''
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
Nested
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#each fields as field}
|
||||||
|
<Nested {field} bind:value='values[field]'/>
|
||||||
|
{/each}
|
@ -1,9 +1,5 @@
|
|||||||
<p>y: {y}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let y = 'bar';
|
||||||
data: () => ({
|
|
||||||
y: 'bar'
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>y: {y}</p>
|
@ -1,7 +1,3 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export let x = true;
|
||||||
data: () => ({
|
|
||||||
x: true
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
@ -1,9 +1,5 @@
|
|||||||
<p>y: {y}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let y = 'foo';
|
||||||
data: () => ({
|
|
||||||
y: 'foo'
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>y: {y}</p>
|
@ -1,9 +1,5 @@
|
|||||||
<p>y: {y}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let y = 'bar';
|
||||||
data: () => ({
|
|
||||||
y: 'bar'
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>y: {y}</p>
|
@ -1,7 +1,3 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export let x = true;
|
||||||
data: () => ({
|
|
||||||
x: true
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
@ -1,9 +1,5 @@
|
|||||||
<p>y: {y}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let y = 'foo';
|
||||||
data: () => ({
|
|
||||||
y: 'foo'
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>y: {y}</p>
|
@ -1,44 +1,37 @@
|
|||||||
<ComponentSelector {components} bind:selectedComponent/>
|
|
||||||
<Editor bind:code='selectedComponent.source' />
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
{compiled}
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { onprops } from 'svelte';
|
||||||
|
|
||||||
import Editor from './Editor.html';
|
import Editor from './Editor.html';
|
||||||
import ComponentSelector from './ComponentSelector.html';
|
import ComponentSelector from './ComponentSelector.html';
|
||||||
|
|
||||||
export default {
|
export let components;
|
||||||
components: {
|
export let selectedComponent;
|
||||||
ComponentSelector,
|
export let compiled;
|
||||||
Editor
|
|
||||||
},
|
|
||||||
|
|
||||||
onstate({ changed, current }) {
|
let previouslySelectedComponent;
|
||||||
const { selectedComponent } = this.get();
|
|
||||||
|
|
||||||
if (changed.components) {
|
onprops(() => {
|
||||||
components.forEach(component => {
|
components.forEach(component => {
|
||||||
if (component === selectedComponent) return;
|
if (component === selectedComponent) return;
|
||||||
component.compiled = component.source.toUpperCase();
|
component.compiled = component.source.toUpperCase();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (changed.selectedComponent) {
|
if (selectedComponent !== previouslySelectedComponent) {
|
||||||
selectedComponent.compiled = selectedComponent.source.toUpperCase();
|
selectedComponent.compiled = selectedComponent.source.toUpperCase();
|
||||||
this.updateBundle();
|
updateBundle();
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
updateBundle() {
|
|
||||||
const components = this.get('components');
|
|
||||||
|
|
||||||
const compiled = components.map(component => component.compiled).join('\n');
|
previouslySelectedComponent = selectedComponent;
|
||||||
|
|
||||||
this.set({ compiled });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateBundle() {
|
||||||
|
compiled = components.map(component => component.compiled).join('\n');
|
||||||
}
|
}
|
||||||
</script>
|
</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>
|
<script>
|
||||||
import Widget from './Widget.html';
|
import Widget from './Widget.html';
|
||||||
|
|
||||||
export default {
|
export let deep = {
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
deep: {
|
|
||||||
name: 'foo'
|
name: 'foo'
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
Widget
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Widget bind:value='deep.name'/>
|
||||||
|
|
||||||
|
<p>{deep.name}</p>
|
@ -1,13 +1,9 @@
|
|||||||
{#each a as x}
|
|
||||||
<Widget bind:value='x'/>
|
|
||||||
{/each}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Widget from './Widget.html';
|
import Widget from './Widget.html';
|
||||||
|
|
||||||
export default {
|
export let a;
|
||||||
components: {
|
|
||||||
Widget
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#each a as x}
|
||||||
|
<Widget bind:value='x'/>
|
||||||
|
{/each}
|
@ -1,12 +1,8 @@
|
|||||||
<B bind:currentIdentifier />
|
|
||||||
<B bind:currentIdentifier />
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import B from './B.html';
|
import B from './B.html';
|
||||||
|
|
||||||
export default {
|
export let currentIdentifier;
|
||||||
components: {
|
|
||||||
B
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<B bind:currentIdentifier />
|
||||||
|
<B bind:currentIdentifier />
|
@ -1,23 +1,19 @@
|
|||||||
<span
|
|
||||||
on:click="toggle()"
|
|
||||||
class="{isCurrentlySelected ? 'selected' : ''}"
|
|
||||||
>
|
|
||||||
<slot></slot>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let currentIdentifier;
|
||||||
computed: {
|
export let identifier;
|
||||||
isCurrentlySelected: ({ currentIdentifier, identifier }) => currentIdentifier === identifier
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toggle() {
|
|
||||||
const isCurrentlySelected = this.get().isCurrentlySelected
|
|
||||||
|
|
||||||
this.set({
|
function isCurrentlySelected() {
|
||||||
currentIdentifier: isCurrentlySelected ? null : this.get().identifier
|
return currentIdentifier === identifier;
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
currentIdentifier = isCurrentlySelected ? null : identifier
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<span
|
||||||
|
on:click="{toggle}"
|
||||||
|
class="{isCurrentlySelected() ? 'selected' : ''}"
|
||||||
|
>
|
||||||
|
<slot></slot>
|
||||||
|
</span>
|
@ -1,17 +1,8 @@
|
|||||||
<A bind:currentIdentifier />
|
|
||||||
<A bind:currentIdentifier />
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import A from './A.html';
|
import A from './A.html';
|
||||||
|
|
||||||
export default {
|
export let currentIdentifier = 2;
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
currentIdentifier: 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
A
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<A bind:currentIdentifier />
|
||||||
|
<A bind:currentIdentifier />
|
@ -1,14 +1,11 @@
|
|||||||
<button on:click='set({ "x-count": state["x-count"] + 1 })'>+1</button>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let undefined = 0;
|
||||||
data: () => ({
|
|
||||||
"x-count": 0
|
function state() {
|
||||||
}),
|
// [svelte-upgrade warning]
|
||||||
computed: {
|
// this function needs to be manually rewritten
|
||||||
state(arg) {
|
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<button on:click='{() => undefined += 1}'>+1</button>
|
@ -1,12 +1,8 @@
|
|||||||
<Counter bind:x-count='x'/>
|
|
||||||
<p>count: {x}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Counter from './Counter.html';
|
import Counter from './Counter.html';
|
||||||
|
|
||||||
export default {
|
export let x;
|
||||||
components: {
|
|
||||||
Counter
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
import Baz from './Baz.html';
|
import Baz from './Baz.html';
|
||||||
|
|
||||||
export default {
|
export let x;
|
||||||
components: { Baz }
|
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<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>
|
<script>
|
||||||
import Bar from './Bar.html';
|
import Bar from './Bar.html';
|
||||||
|
|
||||||
export default {
|
export let x;
|
||||||
components: { Bar }
|
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
import Foo from './Foo.html';
|
import Foo from './Foo.html';
|
||||||
|
|
||||||
export default {
|
export let x;
|
||||||
components: { Foo }
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<p>x: {x}</p>
|
||||||
|
|
||||||
|
<Foo bind:x/>
|
@ -1,9 +1,5 @@
|
|||||||
<button on:click='set({ count: count + 1 })'>+1</button>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export let count = 0;
|
||||||
data: () => ({
|
|
||||||
count: 0
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<button on:click='{() => count += 1}'>+1</button>
|
@ -1,16 +1,8 @@
|
|||||||
<Counter bind:count='x'/>
|
|
||||||
<p>count: {x}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Counter from './Counter.html';
|
import Counter from './Counter.html';
|
||||||
|
|
||||||
export default {
|
export let x = 10;
|
||||||
data: () => ({
|
|
||||||
x: 10
|
|
||||||
}),
|
|
||||||
|
|
||||||
components: {
|
|
||||||
Counter
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</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}
|
{#if show}
|
||||||
<Nested bind:show/>
|
<Nested bind:show/>
|
||||||
{:else}
|
{:else}
|
||||||
<button on:click="set({show:true})">Show</button>
|
<button on:click="{() => show = true}">Show</button>
|
||||||
{/if}
|
{/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>
|
<script>
|
||||||
export default {
|
export let count = 0;
|
||||||
data: () => ({
|
|
||||||
count: 0
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<button on:click='{() => count += 1}'>+1</button>
|
@ -1,12 +1,8 @@
|
|||||||
<Counter bind:count='x'/>
|
|
||||||
<p>count: {x}</p>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Counter from './Counter.html';
|
import Counter from './Counter.html';
|
||||||
|
|
||||||
export default {
|
export let x;
|
||||||
components: {
|
|
||||||
Counter
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Counter bind:count='x'/>
|
||||||
|
<p>count: {x}</p>
|
@ -1,17 +1,10 @@
|
|||||||
{#if foo}
|
|
||||||
<Widget p='{q}'/>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Widget from './Widget.html';
|
import Widget from './Widget.html';
|
||||||
|
|
||||||
export default {
|
export let foo = false;
|
||||||
data: () => ({
|
export let q;
|
||||||
foo: false
|
|
||||||
}),
|
|
||||||
|
|
||||||
components: {
|
|
||||||
Widget
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if foo}
|
||||||
|
<Widget p='{q}'/>
|
||||||
|
{/if}
|
@ -1,11 +1,9 @@
|
|||||||
<div>
|
|
||||||
<Widget {foo}/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Widget from './Widget.html';
|
import Widget from './Widget.html';
|
||||||
|
|
||||||
export default {
|
export let foo;
|
||||||
components: { Widget }
|
|
||||||
};
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
import Widget from './Widget.html';
|
import Widget from './Widget.html';
|
||||||
|
|
||||||
export default {
|
export let bar;
|
||||||
components: { Widget }
|
export let x;
|
||||||
};
|
export let compound;
|
||||||
|
export let go;
|
||||||
</script>
|
</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>
|
<script>
|
||||||
import Widget from './Widget.html';
|
import Widget from './Widget.html';
|
||||||
|
|
||||||
export default {
|
|
||||||
components: { Widget }
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Widget foo=''/>
|
||||||
|
</div>
|
@ -1,10 +1,5 @@
|
|||||||
<Link x href="/cool"/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Link from './Link.html';
|
import Link from './Link.html';
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
Link
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Link x href="/cool"/>
|
@ -1,9 +1,5 @@
|
|||||||
<Foo x/>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Foo from './Foo.html';
|
import Foo from './Foo.html';
|
||||||
|
|
||||||
export default {
|
|
||||||
components: { Foo }
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Foo x/>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue