Merge pull request #2230 from sveltejs/gh-2205

Remove support for logic-less components
pull/2231/head
Rich Harris 6 years ago committed by GitHub
commit 07ceb2e767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -169,15 +169,6 @@ export default class Component {
const variable = this.var_lookup.get(subscribable_name);
variable.subscribable = true;
} else if (!this.ast.instance) {
this.add_var({
name,
export_name: name,
implicit: true,
mutated: false,
referenced: true,
writable: true
});
} else {
this.usedNames.add(name);
}
@ -1140,7 +1131,7 @@ export default class Component {
return `ctx.${name}`;
}
warn_if_undefined(node, template_scope: TemplateScope, allow_implicit?: boolean) {
warn_if_undefined(node, template_scope: TemplateScope) {
let { name } = node;
if (name[0] === '$') {
@ -1148,14 +1139,16 @@ export default class Component {
this.has_reactive_assignments = true;
}
if (allow_implicit && !this.ast.instance && !this.ast.module) return;
if (this.var_lookup.has(name)) return;
if (template_scope && template_scope.names.has(name)) return;
if (globalWhitelist.has(name)) return;
let message = `'${name}' is not defined`;
if (!this.ast.instance) message += `. Consider adding a <script> block with 'export let ${name}' to declare a prop`;
this.warn(node, {
code: 'missing-declaration',
message: `'${name}' is not defined`
message
});
}
}

@ -323,28 +323,6 @@ export default function dom(
addToSet(all_reactive_dependencies, d.dependencies);
});
let user_code;
if (component.javascript) {
user_code = component.javascript;
} else {
if (!component.ast.instance && !component.ast.module && (filtered_props.length > 0 || uses_props)) {
const statements = [];
if (filtered_props.length > 0) statements.push(`let { ${filtered_props.map(x => x.name).join(', ')} } = $$props;`);
reactive_stores.forEach(({ name }) => {
if (component.compileOptions.dev) {
statements.push(`${component.compileOptions.dev && `@validate_store(${name.slice(1)}, '${name.slice(1)}');`}`);
}
statements.push(`@subscribe($$self, ${name.slice(1)}, $$value => { ${name} = $$value; $$invalidate('${name}', ${name}); });`);
});
user_code = statements.join('\n');
}
}
const reactive_store_subscriptions = reactive_stores
.filter(store => {
const variable = component.var_lookup.get(store.name.slice(1));
@ -407,7 +385,7 @@ export default function dom(
${resubscribable_reactive_store_unsubscribers}
${user_code}
${component.javascript}
${renderer.slots.size && `let { ${[...renderer.slots].map(name => `$$slot_${sanitize(name)}`).join(', ')}, $$scope } = $$props;`}

@ -40,8 +40,6 @@ export default function ssr(
// TODO remove this, just use component.vars everywhere
const props = component.vars.filter(variable => !variable.module && variable.export_name);
let user_code;
if (component.javascript) {
component.rewrite_props(({ name }) => {
const value = `$${name}`;
@ -56,22 +54,6 @@ export default function ssr(
return insert;
});
user_code = component.javascript;
} else if (!component.ast.instance && !component.ast.module && (props.length > 0 || component.var_lookup.has('$$props'))) {
const statements = [];
if (props.length > 0) statements.push(`let { ${props.map(x => x.name).join(', ')} } = $$props;`);
reactive_stores.forEach(({ name }) => {
if (component.compileOptions.dev) {
statements.push(`${component.compileOptions.dev && `@validate_store(${name.slice(1)}, '${name.slice(1)}');`}`);
}
statements.push(`${name} = @get_store_value(${name.slice(1)});`);
});
user_code = statements.join('\n');
}
// TODO only do this for props with a default value
@ -121,7 +103,7 @@ export default function ssr(
return name;
})
.join(', ')};`,
user_code,
component.javascript,
parent_bindings.join('\n'),
css.code && `$$result.css.add(#css);`,
main

@ -85,7 +85,6 @@ export interface Var {
// used internally, but not exposed
global?: boolean;
implicit?: boolean; // logic-less template references
internal?: boolean; // event handlers, bindings
initialised?: boolean;
hoistable?: boolean;

@ -1,3 +1,7 @@
<script>
export let dynamic;
</script>
<span class='foo'>
<span class='bar'>text</span>
</span>

@ -1,3 +1,7 @@
<script>
export let dynamic;
</script>
<div>
<p data-foo='{dynamic}'>this is styled</p>
<p data-foo='baz'>this is unstyled</p>

@ -1,3 +1,7 @@
<script>
export let props;
</script>
<div {...props} >
Big red Comic Sans
</div>

@ -8,22 +8,22 @@ export default {
code: `css-unused-selector`,
message: "Unused CSS selector",
start: {
line: 12,
line: 16,
column: 1,
character: 123
character: 163
},
end: {
line: 12,
line: 16,
column: 13,
character: 135
character: 175
},
pos: 123,
pos: 163,
frame: `
10: }
11:
12: .maybeactive {
14: }
15:
16: .maybeactive {
^
13: color: green;
14: }`
17: color: green;
18: }`
}]
};

@ -1,3 +1,7 @@
<script>
export let active;
</script>
<div class='{active ? "active": "inactive"}'></div>
<style>

@ -1,2 +1,6 @@
<script>
export let name;
</script>
<input bind:value={name}>
<p>Hello {name}!</p>

@ -1 +1,5 @@
<script>
export let name;
</script>
<h1>Hello {name}!</h1>

@ -1 +1,5 @@
<script>
export let name;
</script>
<h1>Hello {name}!</h1>

@ -1,3 +1,7 @@
<script>
export let things;
</script>
<ul>
{#each things.foo as foo}
<li>{foo}</li>

@ -1,3 +1,7 @@
<script>
export let things;
</script>
<ul>
{#each things as thing}
<li>{thing}</li>

@ -1 +1,5 @@
<script>
export let className;
</script>
<div class={className}></div>

@ -1,3 +1,7 @@
<script>
let clicked;
</script>
<button on:click='{() => clicked = true}'>click me</button>
{#if clicked}

@ -1,3 +1,8 @@
<script>
export let foo;
export let bar;
</script>
<div>
{#if foo}
<p>foo!</p>

@ -1,3 +1,7 @@
<script>
export let foo;
</script>
<p>before</p>
{#if foo}
<p>foo!</p>

@ -1,3 +1,8 @@
<script>
export let foo;
export let bar;
</script>
{#if foo}
<p>foo!</p>
{/if}

@ -1,3 +1,7 @@
<script>
export let foo;
</script>
{#if foo}
<p>foo!</p>
{/if}

@ -1,3 +1,8 @@
<script>
export let w;
export let h;
</script>
<div bind:offsetWidth={w} bind:offsetHeight={h}>
some content
</div>

@ -14,7 +14,7 @@ function create_fragment(ctx) {
text2 = createText("!");
text3 = createText("\n");
debugger;
addLoc(h1, file, 0, 0, 0);
addLoc(h1, file, 4, 0, 38);
},
l: function claim(nodes) {

@ -1,2 +1,6 @@
<script>
export let name;
</script>
<h1>Hello {name}!</h1>
{@debug}

@ -9,7 +9,7 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
// (1:0) {#each things as thing}
// (8:0) {#each things as thing}
function create_each_block(ctx) {
var span, text0_value = ctx.thing.name, text0, text1;
@ -24,7 +24,7 @@ function create_each_block(ctx) {
console.log({ foo, bar, baz, thing });
debugger;
}
addLoc(span, file, 1, 1, 25);
addLoc(span, file, 8, 1, 116);
},
m: function mount(target, anchor) {
@ -75,7 +75,7 @@ function create_fragment(ctx) {
p = createElement("p");
text1 = createText("foo: ");
text2 = createText(ctx.foo);
addLoc(p, file, 5, 0, 91);
addLoc(p, file, 12, 0, 182);
},
l: function claim(nodes) {

@ -1,3 +1,10 @@
<script>
export let things;
export let foo;
export let bar;
export let baz;
</script>
{#each things as thing}
<span>{thing.name}</span>
{@debug foo, bar, baz, thing}

@ -9,7 +9,7 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
// (1:0) {#each things as thing}
// (6:0) {#each things as thing}
function create_each_block(ctx) {
var span, text0_value = ctx.thing.name, text0, text1;
@ -24,7 +24,7 @@ function create_each_block(ctx) {
console.log({ foo });
debugger;
}
addLoc(span, file, 1, 1, 25);
addLoc(span, file, 6, 1, 82);
},
m: function mount(target, anchor) {
@ -75,7 +75,7 @@ function create_fragment(ctx) {
p = createElement("p");
text1 = createText("foo: ");
text2 = createText(ctx.foo);
addLoc(p, file, 5, 0, 74);
addLoc(p, file, 10, 0, 131);
},
l: function claim(nodes) {

@ -1,3 +1,8 @@
<script>
export let things;
export let foo;
</script>
{#each things as thing}
<span>{thing.name}</span>
{@debug foo}

@ -4,8 +4,11 @@ import { create_ssr_component, debug, each, escape } from "svelte/internal";
const SvelteComponent = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
let { things, foo } = $$props;
if ($$props.things === void 0 && $$bindings.things && things !== void 0) $$bindings.things(things);
if ($$props.foo === void 0 && $$bindings.foo && foo !== void 0) $$bindings.foo(foo);
return `${each(things, (thing) => `<span>${escape(thing.name)}</span>
${debug(null, 2, 2, { foo })}`)}
${debug(null, 7, 2, { foo })}`)}
<p>foo: ${escape(foo)}</p>`;
});

@ -1,3 +1,8 @@
<script>
export let things;
export let foo;
</script>
{#each things as thing}
<span>{thing.name}</span>
{@debug foo}

@ -7,7 +7,7 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
// (1:0) {#each createElement as node}
// (5:0) {#each createElement as node}
function create_each_block(ctx) {
var span, text_value = ctx.node, text;

@ -1,3 +1,7 @@
<script>
export let createElement;
</script>
{#each createElement as node}
<span>{node}</span>
{/each}

@ -1,2 +1,6 @@
<script>
export let bar;
</script>
<div data-foo='bar'/>
<div data-foo='{bar}'/>

@ -39,4 +39,4 @@ class SvelteComponent extends SvelteComponent_1 {
}
}
export default SvelteComponent;
export default SvelteComponent;

@ -1,2 +1,6 @@
<script>
export let bar;
</script>
<div data-foo='bar'/>
<div data-foo='{bar}'/>

@ -1,3 +1,7 @@
<script>
export let bar;
</script>
<svg>
<g data-foo='bar'/>
<g data-foo='{bar}'/>

Before

Width:  |  Height:  |  Size: 56 B

After

Width:  |  Height:  |  Size: 93 B

@ -7,7 +7,7 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
// (1:0) {#each [a, b, c, d, e] as num}
// (9:0) {#each [a, b, c, d, e] as num}
function create_each_block(ctx) {
var span, text_value = ctx.num, text;

@ -1,3 +1,11 @@
<script>
export let a;
export let b;
export let c;
export let d;
export let e;
</script>
{#each [a, b, c, d, e] as num}
<span>{num}</span>
{/each}

@ -8,7 +8,7 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
// (1:0) {#each comments as comment, i}
// (8:0) {#each comments as comment, i}
function create_each_block(ctx) {
var div, strong, text0, text1, span, text2_value = ctx.comment.author, text2, text3, text4_value = ctx.elapsed(ctx.comment.time, ctx.time), text4, text5, text6, raw_value = ctx.comment.html, raw_before;

@ -1,3 +1,10 @@
<script>
export let comments;
export let elapsed;
export let time;
export let foo;
</script>
{#each comments as comment, i}
<div class='comment'>
<strong>{i}</strong>

@ -7,7 +7,7 @@ function get_each_context(ctx, list, i) {
return child_ctx;
}
// (1:0) {#each things as thing (thing.id)}
// (5:0) {#each things as thing (thing.id)}
function create_each_block(key_1, ctx) {
var div, text_value = ctx.thing.name, text;

@ -1,3 +1,7 @@
<script>
export let things;
</script>
{#each things as thing (thing.id)}
<div>{thing.name}</div>
{/each}

@ -1,7 +1,7 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, createComment, createElement, detachNode, flush, init, insert, noop, safe_not_equal } from "svelte/internal";
// (3:0) {:else}
// (7:0) {:else}
function create_else_block(ctx) {
var p;
@ -23,7 +23,7 @@ function create_else_block(ctx) {
};
}
// (1:0) {#if foo}
// (5:0) {#if foo}
function create_if_block(ctx) {
var p;

@ -1,3 +1,7 @@
<script>
export let foo;
</script>
{#if foo}
<p>foo!</p>
{:else}

@ -1,7 +1,7 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, createComment, createElement, detachNode, flush, init, insert, noop, safe_not_equal } from "svelte/internal";
// (1:0) {#if foo}
// (5:0) {#if foo}
function create_if_block(ctx) {
var p;

@ -1,3 +1,7 @@
<script>
export let foo;
</script>
{#if foo}
<p>foo!</p>
{/if}

@ -1 +1,7 @@
<script>
export let color;
export let x;
export let y;
</script>
<div style='color: {color}; transform: translate({x}px,{y}px);'></div>

@ -1 +1,5 @@
<script>
export let data;
</script>
<div style='background: url(data:image/png;base64,{data})'></div>

@ -1 +1,5 @@
<script>
export let color;
</script>
<div style='color: {color}'></div>

@ -1,2 +1,8 @@
<div style='{style}'></div>
<div style='{key}: {value}'></div>
<script>
export let style;
export let key;
export let value;
</script>
<div style={style}></div>
<div style="{key}: {value}"></div>

@ -1 +1,5 @@
<script>
export let files;
</script>
<input type="file" multiple bind:files>

@ -1 +1,5 @@
<script>
export let value;
</script>
<input type=range bind:value>

@ -1 +1,5 @@
<script>
export let foo;
</script>
<input type='checkbox' bind:checked={foo}>

@ -1 +1,11 @@
<script>
export let buffered;
export let seekable;
export let played;
export let currentTime;
export let duration;
export let paused;
export let volume;
</script>
<audio bind:buffered bind:seekable bind:played bind:currentTime bind:duration bind:paused bind:volume/>

@ -17,7 +17,7 @@ let a = 1;
let b = 2;
function instance($$self, $$props, $$invalidate) {
let max;

@ -1,3 +1,7 @@
<script>
export let current;
</script>
<select value={current}>
<option value="1">1</option>
<option value="2">2</option>

@ -1,3 +1,7 @@
<script>
export let custom;
</script>
<svelte:head>
<title>a {custom} title</title>
</svelte:head>

@ -1,7 +1,7 @@
/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, append, createComment, createElement, createText, detachNode, flush, init, insert, noop, safe_not_equal } from "svelte/internal";
// (2:1) {#if a}
// (10:1) {#if a}
function create_if_block_4(ctx) {
var p;
@ -23,7 +23,7 @@ function create_if_block_4(ctx) {
};
}
// (8:1) {#if b}
// (16:1) {#if b}
function create_if_block_3(ctx) {
var p;
@ -45,7 +45,7 @@ function create_if_block_3(ctx) {
};
}
// (12:1) {#if c}
// (20:1) {#if c}
function create_if_block_2(ctx) {
var p;
@ -67,7 +67,7 @@ function create_if_block_2(ctx) {
};
}
// (18:1) {#if d}
// (26:1) {#if d}
function create_if_block_1(ctx) {
var p;
@ -89,7 +89,7 @@ function create_if_block_1(ctx) {
};
}
// (25:0) {#if e}
// (33:0) {#if e}
function create_if_block(ctx) {
var p;

@ -1,3 +1,11 @@
<script>
export let a;
export let b;
export let c;
export let d;
export let e;
</script>
<div>
{#if a}
<p>a</p>

@ -1,3 +1,7 @@
<script>
export let y;
</script>
<svelte:window bind:scrollY={y}/>
<p>scrolled to {y}</p>

@ -1 +1,5 @@
<script>
let foo;
</script>
<Widget bind:foo/>

@ -1,24 +1,30 @@
{
"html": {
"start": 0,
"end": 18,
"start": 30,
"end": 48,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 18,
"start": 28,
"end": 30,
"type": "Text",
"data": "\n\n"
},
{
"start": 30,
"end": 48,
"type": "InlineComponent",
"name": "Widget",
"attributes": [
{
"start": 8,
"end": 16,
"start": 38,
"end": 46,
"type": "Binding",
"name": "foo",
"modifiers": [],
"expression": {
"start": 13,
"end": 16,
"start": 43,
"end": 46,
"type": "Identifier",
"name": "foo"
}
@ -28,7 +34,37 @@
}
]
},
"css": null,
"instance": null,
"module": null
"instance": {
"start": 0,
"end": 28,
"context": "default",
"content": {
"type": "Program",
"start": 8,
"end": 19,
"body": [
{
"type": "VariableDeclaration",
"start": 10,
"end": 18,
"declarations": [
{
"type": "VariableDeclarator",
"start": 14,
"end": 17,
"id": {
"type": "Identifier",
"start": 14,
"end": 17,
"name": "foo"
},
"init": null
}
],
"kind": "let"
}
],
"sourceType": "module"
}
}
}

@ -1 +1,5 @@
<script>
let name;
</script>
<input bind:value={name}>

@ -1,25 +1,31 @@
{
"html": {
"start": 0,
"end": 25,
"start": 31,
"end": 56,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 25,
"start": 29,
"end": 31,
"type": "Text",
"data": "\n\n"
},
{
"start": 31,
"end": 56,
"type": "Element",
"name": "input",
"attributes": [
{
"start": 7,
"end": 24,
"start": 38,
"end": 55,
"type": "Binding",
"name": "value",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 19,
"end": 23,
"start": 50,
"end": 54,
"name": "name"
}
}
@ -28,7 +34,37 @@
}
]
},
"css": null,
"instance": null,
"module": null
"instance": {
"start": 0,
"end": 29,
"context": "default",
"content": {
"type": "Program",
"start": 8,
"end": 20,
"body": [
{
"type": "VariableDeclaration",
"start": 10,
"end": 19,
"declarations": [
{
"type": "VariableDeclarator",
"start": 14,
"end": 18,
"id": {
"type": "Identifier",
"start": 14,
"end": 18,
"name": "name"
},
"init": null
}
],
"kind": "let"
}
],
"sourceType": "module"
}
}
}

@ -1 +1,5 @@
<script>
let foo;
</script>
<canvas bind:this={foo}></canvas>

@ -1,25 +1,31 @@
{
"html": {
"start": 0,
"end": 33,
"start": 30,
"end": 63,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 33,
"start": 28,
"end": 30,
"type": "Text",
"data": "\n\n"
},
{
"start": 30,
"end": 63,
"type": "Element",
"name": "canvas",
"attributes": [
{
"start": 8,
"end": 23,
"start": 38,
"end": 53,
"type": "Binding",
"name": "this",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 19,
"end": 22,
"start": 49,
"end": 52,
"name": "foo"
}
}
@ -28,7 +34,37 @@
}
]
},
"css": null,
"instance": null,
"module": null
"instance": {
"start": 0,
"end": 28,
"context": "default",
"content": {
"type": "Program",
"start": 8,
"end": 19,
"body": [
{
"type": "VariableDeclaration",
"start": 10,
"end": 18,
"declarations": [
{
"type": "VariableDeclarator",
"start": 14,
"end": 17,
"id": {
"type": "Identifier",
"start": 14,
"end": 17,
"name": "foo"
},
"init": null
}
],
"kind": "let"
}
],
"sourceType": "module"
}
}
}

@ -1 +1,5 @@
<script>
export let indeterminate;
</script>
<input type='checkbox' indeterminate='{indeterminate}'>

@ -1,3 +1,7 @@
<script>
export let items;
</script>
{#each items as item, i}
<div class='{item.foo ? "foo" : ""} {item.bar ? "bar" : ""}'>{i + 1}</div>
{/each}

@ -1 +1,6 @@
<script>
export let inputType;
export let inputValue;
</script>
<input type='{inputType}' value='{inputValue}'>

@ -1,3 +1,7 @@
<script>
export let foo;
</script>
<svg>
<use xlink:href="#{foo}"/>
</svg>

Before

Width:  |  Height:  |  Size: 40 B

After

Width:  |  Height:  |  Size: 77 B

@ -1 +1,5 @@
<script>
export let value;
</script>
<p data-value="{value}"></p>

@ -1,2 +1,6 @@
<script>
export let foo;
</script>
<input type='radio' bind:group={foo} value='{false}'>
<input type='radio' bind:group={foo} value='{true}'>

@ -1,3 +1,8 @@
<script>
export let thePromise;
export let show;
</script>
<div>
{#await thePromise}
<p>loading...</p>

@ -1,3 +1,7 @@
<script>
export let items;
</script>
{#each items as item}
{#await item.data}
<p>{item.title}: loading...</p>

@ -1,3 +1,8 @@
<script>
export let promise;
export let answer;
</script>
{#if promise}
{#await promise}
<p>wait for it...</p>

@ -1,3 +1,7 @@
<script>
export let thePromise;
</script>
<div>
{#await thePromise}
<p>loading...</p>

@ -1,3 +1,8 @@
<script>
export let show;
export let thePromise;
</script>
{#if show}
{#await thePromise}
<p>loading...</p>

@ -1,3 +1,7 @@
<script>
export let thePromise;
</script>
{#await thePromise}
<p>loading...</p>
{:then theValue}

@ -1,3 +1,7 @@
<script>
export let thePromise;
</script>
{#await thePromise}
waiting
{:then}

@ -1,3 +1,7 @@
<script>
export let thePromise;
</script>
{#await thePromise}
<p>loading...</p>
{:then theValue}

@ -1,3 +1,7 @@
<script>
export let thePromise;
</script>
{#await thePromise}
<p>loading...</p>
{:then theValue}

@ -1,3 +1,7 @@
<script>
export let promise;
</script>
{#await promise}
<p>loading...</p>
{:then value}

@ -1,3 +1,7 @@
<script>
export let thePromise;
</script>
{#await thePromise}
<p>loading...</p>
{:then theValue}

@ -1,3 +1,7 @@
<script>
export let thePromise;
</script>
{#await thePromise then theValue}
<p>the value is {theValue}</p>
{:catch theError}

@ -1,2 +1,9 @@
<script>
export let t;
export let d;
export let paused;
export let v;
</script>
<audio bind:currentTime={t} bind:duration={d} bind:paused bind:volume={v}
src='music.mp3'></audio>

@ -1,3 +1,8 @@
<script>
export let selected;
export let tasks;
</script>
<select bind:value={selected}>
{#each tasks as task}
<option value='{task}'>{task.description}</option>

@ -1,3 +1,8 @@
<script>
export let selected;
export let values;
</script>
<label>
<input type="checkbox" value="{values[0]}" bind:group={selected} /> {values[0].name}
</label>

@ -1,3 +1,8 @@
<script>
export let selected;
export let values;
</script>
{#each values as value}
<label>
<input type="checkbox" value="{value}" bind:group={selected} /> {value.name}

@ -1,3 +1,8 @@
<script>
export let checked;
export let indeterminate;
</script>
<input type='checkbox' bind:checked bind:indeterminate>
<p>checked? {checked}</p>
<p>indeterminate? {indeterminate}</p>

@ -1,2 +1,6 @@
<script>
export let foo;
</script>
<input type='checkbox' bind:checked={foo}>
<p>{foo}</p>

@ -1,2 +1,6 @@
<script>
export let count;
</script>
<input type='number' bind:value={count}>
<p>{typeof count} {count}</p>

@ -1,3 +1,8 @@
<script>
export let selected;
export let values;
</script>
{#each values as value}
<label>
<input type="radio" value="{value}" bind:group={selected} /> {value.name}

@ -1,2 +1,6 @@
<script>
export let count;
</script>
<input type='range' bind:value={count}>
<p>{typeof count} {count}</p>

@ -1,2 +1,6 @@
<script>
export let count;
</script>
<input type='range' bind:value={count}>
<p>{typeof count} {count}</p>

@ -1,3 +1,8 @@
<script>
export let foo;
export let items;
</script>
<div><input bind:value={foo}><p>{foo}</p></div>
{#each items as bar}

@ -1,3 +1,7 @@
<script>
export let items;
</script>
{#each items as item}
<div><input bind:value={item}><p>{item}</p></div>
{/each}

@ -1,2 +1,6 @@
<script>
export let component;
</script>
<h1>Hello {component.name}!</h1>
<input bind:value={component.name}/>

@ -1,2 +1,7 @@
<script>
export let obj;
export let prop;
</script>
<input bind:value={obj[prop]}>
<pre>{JSON.stringify(obj)}</pre>

@ -1,2 +1,7 @@
<script>
export let user;
export let prop;
</script>
<input bind:value={user[prop]}>
<p>hello {user.name}</p>

@ -1,3 +1,8 @@
<script>
export let objects;
export let prop;
</script>
{#each objects as obj}
<input bind:value={obj[prop]}>
<pre>{JSON.stringify(obj)}</pre>

@ -1,3 +1,7 @@
<script>
export let items;
</script>
{#each items as item}
<div><input bind:value={item.description}><p>{item.description}</p></div>
{/each}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save