mirror of https://github.com/sveltejs/svelte
parent
0cb475e32b
commit
f4323057a1
@ -1,36 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
function increment(_, counter) {
|
||||
counter.count += 1;
|
||||
}
|
||||
|
||||
var root = $.template_fn([['button', null, ' '], ' ', , ' '], 1);
|
||||
|
||||
export default function Await_block_scope($$anchor) {
|
||||
let counter = $.proxy({ count: 0 });
|
||||
const promise = $.derived(() => Promise.resolve(counter));
|
||||
var fragment = root();
|
||||
var button = $.first_child(fragment);
|
||||
|
||||
button.__click = [increment, counter];
|
||||
|
||||
var text = $.child(button);
|
||||
|
||||
$.reset(button);
|
||||
|
||||
var node = $.sibling(button, 2);
|
||||
|
||||
$.await(node, () => $.get(promise), null, ($$anchor, counter) => {});
|
||||
|
||||
var text_1 = $.sibling(node);
|
||||
|
||||
$.template_effect(() => {
|
||||
$.set_text(text, `clicks: ${counter.count ?? ''}`);
|
||||
$.set_text(text_1, ` ${counter.count ?? ''}`);
|
||||
});
|
||||
|
||||
$.append($$anchor, fragment);
|
||||
}
|
||||
|
||||
$.delegate(['click']);
|
@ -1,34 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
import TextInput from './Child.svelte';
|
||||
|
||||
const snippet = ($$anchor) => {
|
||||
$.next();
|
||||
|
||||
var text = $.text('Something');
|
||||
|
||||
$.append($$anchor, text);
|
||||
};
|
||||
|
||||
var root = $.template_fn([,, ' '], 1);
|
||||
|
||||
export default function Bind_component_snippet($$anchor) {
|
||||
let value = $.state('');
|
||||
const _snippet = snippet;
|
||||
var fragment = root();
|
||||
var node = $.first_child(fragment);
|
||||
|
||||
TextInput(node, {
|
||||
get value() {
|
||||
return $.get(value);
|
||||
},
|
||||
set value($$value) {
|
||||
$.set(value, $$value, true);
|
||||
}
|
||||
});
|
||||
|
||||
var text_1 = $.sibling(node);
|
||||
|
||||
$.template_effect(() => $.set_text(text_1, ` value: ${$.get(value) ?? ''}`));
|
||||
$.append($$anchor, fragment);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import 'svelte/internal/flags/legacy';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
export default function Bind_this($$anchor) {
|
||||
$.bind_this(Foo($$anchor, { $$legacy: true }), ($$value) => foo = $$value, () => foo);
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
export default function Class_state_field_constructor_assignment($$anchor, $$props) {
|
||||
$.push($$props, true);
|
||||
|
||||
class Foo {
|
||||
#a = $.state();
|
||||
|
||||
get a() {
|
||||
return $.get(this.#a);
|
||||
}
|
||||
|
||||
set a(value) {
|
||||
$.set(this.#a, value, true);
|
||||
}
|
||||
|
||||
#b = $.state();
|
||||
|
||||
constructor() {
|
||||
this.a = 1;
|
||||
$.set(this.#b, 2);
|
||||
}
|
||||
}
|
||||
|
||||
$.pop();
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/* index.svelte.js generated by Svelte VERSION */
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
let a = $.state(1);
|
||||
let b = $.state(2);
|
||||
let c = 3;
|
||||
let d = 4;
|
||||
|
||||
export function update(array) {
|
||||
{
|
||||
let [$$1, $$2] = array;
|
||||
|
||||
$.set(a, $$1, true);
|
||||
$.set(b, $$2, true);
|
||||
};
|
||||
|
||||
[c, d] = array;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var root = $.template_fn(
|
||||
[
|
||||
['div'],
|
||||
' ',
|
||||
['svg'],
|
||||
' ',
|
||||
['custom-element'],
|
||||
' ',
|
||||
['div'],
|
||||
' ',
|
||||
['svg'],
|
||||
' ',
|
||||
['custom-element']
|
||||
],
|
||||
3
|
||||
);
|
||||
|
||||
export default function Main($$anchor) {
|
||||
// needs to be a snapshot test because jsdom does auto-correct the attribute casing
|
||||
let x = 'test';
|
||||
let y = () => 'test';
|
||||
var fragment = root();
|
||||
var div = $.first_child(fragment);
|
||||
var svg = $.sibling(div, 2);
|
||||
var custom_element = $.sibling(svg, 2);
|
||||
|
||||
$.template_effect(() => $.set_custom_element_data(custom_element, 'fooBar', x));
|
||||
|
||||
var div_1 = $.sibling(custom_element, 2);
|
||||
var svg_1 = $.sibling(div_1, 2);
|
||||
var custom_element_1 = $.sibling(svg_1, 2);
|
||||
|
||||
$.template_effect(() => $.set_custom_element_data(custom_element_1, 'fooBar', y()));
|
||||
|
||||
$.template_effect(
|
||||
($0, $1) => {
|
||||
$.set_attribute(div, 'foobar', x);
|
||||
$.set_attribute(svg, 'viewBox', x);
|
||||
$.set_attribute(div_1, 'foobar', $0);
|
||||
$.set_attribute(svg_1, 'viewBox', $1);
|
||||
},
|
||||
[y, y]
|
||||
);
|
||||
|
||||
$.append($$anchor, fragment);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import 'svelte/internal/flags/legacy';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var root_1 = $.template_fn([['p']]);
|
||||
|
||||
export default function Each_index_non_null($$anchor) {
|
||||
var fragment = $.comment();
|
||||
var node = $.first_child(fragment);
|
||||
|
||||
$.each(node, 0, () => Array(10), $.index, ($$anchor, $$item, i) => {
|
||||
var p = root_1();
|
||||
|
||||
p.textContent = `index: ${i}`;
|
||||
$.append($$anchor, p);
|
||||
});
|
||||
|
||||
$.append($$anchor, fragment);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import 'svelte/internal/flags/legacy';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
export default function Each_string_template($$anchor) {
|
||||
var fragment = $.comment();
|
||||
var node = $.first_child(fragment);
|
||||
|
||||
$.each(node, 0, () => ['foo', 'bar', 'baz'], $.index, ($$anchor, thing) => {
|
||||
$.next();
|
||||
|
||||
var text = $.text();
|
||||
|
||||
$.template_effect(() => $.set_text(text, `${thing ?? ''}, `));
|
||||
$.append($$anchor, text);
|
||||
});
|
||||
|
||||
$.append($$anchor, fragment);
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
/* index.svelte.js generated by Svelte VERSION */
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
export const object = $.proxy({ ok: true });
|
@ -1,27 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
export default function Function_prop_no_getter($$anchor) {
|
||||
let count = $.state(0);
|
||||
|
||||
function onmouseup() {
|
||||
$.set(count, $.get(count) + 2);
|
||||
}
|
||||
|
||||
const plusOne = (num) => num + 1;
|
||||
|
||||
Button($$anchor, {
|
||||
onmousedown: () => $.set(count, $.get(count) + 1),
|
||||
onmouseup,
|
||||
onmouseenter: () => $.set(count, plusOne($.get(count)), true),
|
||||
children: ($$anchor, $$slotProps) => {
|
||||
$.next();
|
||||
|
||||
var text = $.text();
|
||||
|
||||
$.template_effect(() => $.set_text(text, `clicks: ${$.get(count) ?? ''}`));
|
||||
$.append($$anchor, text);
|
||||
},
|
||||
$$slots: { default: true }
|
||||
});
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
templatingMode: 'functional'
|
||||
}
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import 'svelte/internal/flags/legacy';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var root = $.template_fn(
|
||||
[
|
||||
['h1', null, 'hello'],
|
||||
' ',
|
||||
[
|
||||
'div',
|
||||
{ class: 'potato' },
|
||||
['p', null, 'child element'],
|
||||
' ',
|
||||
['p', null, 'another child element']
|
||||
]
|
||||
],
|
||||
1
|
||||
);
|
||||
|
||||
export default function Functional_templating($$anchor) {
|
||||
var fragment = root();
|
||||
|
||||
$.next(2);
|
||||
$.append($$anchor, fragment);
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
import * as $ from 'svelte/internal/server';
|
||||
|
||||
export default function Functional_templating($$payload) {
|
||||
$$payload.out += `<h1>hello</h1> <div class="potato"><p>child element</p> <p>another child element</p></div>`;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<h1>hello</h1>
|
||||
|
||||
<div class="potato">
|
||||
<p>child element</p>
|
||||
<p>another child element</p>
|
||||
</div>
|
@ -1,11 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import 'svelte/internal/flags/legacy';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var root = $.template_fn([['h1', null, 'hello world']]);
|
||||
|
||||
export default function Hello_world($$anchor) {
|
||||
var h1 = root();
|
||||
|
||||
$.append($$anchor, h1);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import 'svelte/internal/flags/legacy';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var root = $.template_fn([['h1', null, 'hello world']]);
|
||||
|
||||
function Hmr($$anchor) {
|
||||
var h1 = root();
|
||||
|
||||
$.append($$anchor, h1);
|
||||
}
|
||||
|
||||
if (import.meta.hot) {
|
||||
Hmr = $.hmr(Hmr, () => Hmr[$.HMR].source);
|
||||
|
||||
import.meta.hot.accept((module) => {
|
||||
module.default[$.HMR].source = Hmr[$.HMR].source;
|
||||
$.set(Hmr[$.HMR].source, module.default[$.HMR].original);
|
||||
});
|
||||
}
|
||||
|
||||
export default Hmr;
|
@ -1 +0,0 @@
|
||||
export * from '../../export.js';
|
@ -1,8 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import 'svelte/internal/flags/legacy';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
import { random } from './module.svelte';
|
||||
|
||||
export default function Imports_in_modules($$anchor) {
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
/* module.svelte.js generated by Svelte VERSION */
|
||||
import * as $ from 'svelte/internal/client';
|
||||
import { random } from './export';
|
||||
|
||||
export { random };
|
@ -1,46 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var on_click = (_, count) => $.update(count);
|
||||
|
||||
var root = $.template_fn(
|
||||
[
|
||||
['h1'],
|
||||
' ',
|
||||
['b'],
|
||||
' ',
|
||||
['button', null, ' '],
|
||||
' ',
|
||||
['h1']
|
||||
],
|
||||
1
|
||||
);
|
||||
|
||||
export default function Nullish_coallescence_omittance($$anchor) {
|
||||
let name = 'world';
|
||||
let count = $.state(0);
|
||||
var fragment = root();
|
||||
var h1 = $.first_child(fragment);
|
||||
|
||||
h1.textContent = 'Hello, world!';
|
||||
|
||||
var b = $.sibling(h1, 2);
|
||||
|
||||
b.textContent = '123';
|
||||
|
||||
var button = $.sibling(b, 2);
|
||||
|
||||
button.__click = [on_click, count];
|
||||
|
||||
var text = $.child(button);
|
||||
|
||||
$.reset(button);
|
||||
|
||||
var h1_1 = $.sibling(button, 2);
|
||||
|
||||
h1_1.textContent = 'Hello, world';
|
||||
$.template_effect(() => $.set_text(text, `Count is ${$.get(count) ?? ''}`));
|
||||
$.append($$anchor, fragment);
|
||||
}
|
||||
|
||||
$.delegate(['click']);
|
@ -1,17 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
export default function Props_identifier($$anchor, $$props) {
|
||||
$.push($$props, true);
|
||||
|
||||
let props = $.rest_props($$props, ['$$slots', '$$events', '$$legacy']);
|
||||
|
||||
$$props.a;
|
||||
props[a];
|
||||
$$props.a.b;
|
||||
$$props.a.b = true;
|
||||
props.a = true;
|
||||
props[a] = true;
|
||||
props;
|
||||
$.pop();
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import 'svelte/internal/flags/legacy';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var root = $.template_fn([['p'], ' ', ['p'], ' ', ,], 1);
|
||||
|
||||
export default function Purity($$anchor) {
|
||||
var fragment = root();
|
||||
var p = $.first_child(fragment);
|
||||
|
||||
p.textContent = '0';
|
||||
|
||||
var p_1 = $.sibling(p, 2);
|
||||
|
||||
p_1.textContent = location.href;
|
||||
|
||||
var node = $.sibling(p_1, 2);
|
||||
|
||||
Child(node, { prop: encodeURIComponent('hello') });
|
||||
$.append($$anchor, fragment);
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var root = $.template_fn(
|
||||
[
|
||||
[
|
||||
'header',
|
||||
null,
|
||||
[
|
||||
'nav',
|
||||
null,
|
||||
['a', { href: '/' }, 'Home'],
|
||||
' ',
|
||||
['a', { href: '/away' }, 'Away']
|
||||
]
|
||||
],
|
||||
' ',
|
||||
[
|
||||
'main',
|
||||
null,
|
||||
['h1', null, ' '],
|
||||
' ',
|
||||
[
|
||||
'div',
|
||||
{ class: 'static' },
|
||||
[
|
||||
'p',
|
||||
null,
|
||||
'we don\'t need to traverse these nodes'
|
||||
]
|
||||
],
|
||||
' ',
|
||||
['p', null, 'or'],
|
||||
' ',
|
||||
['p', null, 'these'],
|
||||
' ',
|
||||
['p', null, 'ones'],
|
||||
' ',
|
||||
,
|
||||
' ',
|
||||
['p', null, 'these'],
|
||||
' ',
|
||||
['p', null, 'trailing'],
|
||||
' ',
|
||||
['p', null, 'nodes'],
|
||||
' ',
|
||||
['p', null, 'can'],
|
||||
' ',
|
||||
['p', null, 'be'],
|
||||
' ',
|
||||
['p', null, 'completely'],
|
||||
' ',
|
||||
['p', null, 'ignored']
|
||||
],
|
||||
' ',
|
||||
['cant-skip', null, ['custom-elements']],
|
||||
' ',
|
||||
['div', null, ['input']],
|
||||
' ',
|
||||
['div', null, ['source']],
|
||||
' ',
|
||||
['select', null, ['option', null, 'a']],
|
||||
' ',
|
||||
[
|
||||
'img',
|
||||
{ src: '...', alt: '', loading: 'lazy' }
|
||||
],
|
||||
' ',
|
||||
[
|
||||
'div',
|
||||
null,
|
||||
[
|
||||
'img',
|
||||
{ src: '...', alt: '', loading: 'lazy' }
|
||||
]
|
||||
]
|
||||
],
|
||||
3
|
||||
);
|
||||
|
||||
export default function Skip_static_subtree($$anchor, $$props) {
|
||||
var fragment = root();
|
||||
var main = $.sibling($.first_child(fragment), 2);
|
||||
var h1 = $.child(main);
|
||||
var text = $.child(h1, true);
|
||||
|
||||
$.reset(h1);
|
||||
|
||||
var node = $.sibling(h1, 10);
|
||||
|
||||
$.html(node, () => $$props.content);
|
||||
$.next(14);
|
||||
$.reset(main);
|
||||
|
||||
var cant_skip = $.sibling(main, 2);
|
||||
var custom_elements = $.child(cant_skip);
|
||||
|
||||
$.set_custom_element_data(custom_elements, 'with', 'attributes');
|
||||
$.reset(cant_skip);
|
||||
|
||||
var div = $.sibling(cant_skip, 2);
|
||||
var input = $.child(div);
|
||||
|
||||
$.autofocus(input, true);
|
||||
$.reset(div);
|
||||
|
||||
var div_1 = $.sibling(div, 2);
|
||||
var source = $.child(div_1);
|
||||
|
||||
source.muted = true;
|
||||
$.reset(div_1);
|
||||
|
||||
var select = $.sibling(div_1, 2);
|
||||
var option = $.child(select);
|
||||
|
||||
option.value = option.__value = 'a';
|
||||
$.reset(select);
|
||||
|
||||
var img = $.sibling(select, 2);
|
||||
|
||||
$.next(2);
|
||||
$.template_effect(() => $.set_text(text, $$props.title));
|
||||
$.append($$anchor, fragment);
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
function reset(_, str, tpl) {
|
||||
$.set(str, '');
|
||||
$.set(str, ``);
|
||||
$.set(tpl, '');
|
||||
$.set(tpl, ``);
|
||||
}
|
||||
|
||||
var root = $.template_fn(
|
||||
[
|
||||
['input'],
|
||||
' ',
|
||||
['input'],
|
||||
' ',
|
||||
['button', null, 'reset']
|
||||
],
|
||||
1
|
||||
);
|
||||
|
||||
export default function State_proxy_literal($$anchor) {
|
||||
let str = $.state('');
|
||||
let tpl = $.state(``);
|
||||
var fragment = root();
|
||||
var input = $.first_child(fragment);
|
||||
|
||||
$.remove_input_defaults(input);
|
||||
|
||||
var input_1 = $.sibling(input, 2);
|
||||
|
||||
$.remove_input_defaults(input_1);
|
||||
|
||||
var button = $.sibling(input_1, 2);
|
||||
|
||||
button.__click = [reset, str, tpl];
|
||||
$.bind_value(input, () => $.get(str), ($$value) => $.set(str, $$value));
|
||||
$.bind_value(input_1, () => $.get(tpl), ($$value) => $.set(tpl, $$value));
|
||||
$.append($$anchor, fragment);
|
||||
}
|
||||
|
||||
$.delegate(['click']);
|
@ -1,11 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
export default function Svelte_element($$anchor, $$props) {
|
||||
let tag = $.prop($$props, 'tag', 3, 'hr');
|
||||
var fragment = $.comment();
|
||||
var node = $.first_child(fragment);
|
||||
|
||||
$.element(node, tag, false);
|
||||
$.append($$anchor, fragment);
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
import 'svelte/internal/disclose-version';
|
||||
import * as $ from 'svelte/internal/client';
|
||||
|
||||
var root = $.template_fn([['p', null, ' ']]);
|
||||
|
||||
export default function Text_nodes_deriveds($$anchor) {
|
||||
let count1 = 0;
|
||||
let count2 = 0;
|
||||
|
||||
function text1() {
|
||||
return count1;
|
||||
}
|
||||
|
||||
function text2() {
|
||||
return count2;
|
||||
}
|
||||
|
||||
var p = root();
|
||||
var text = $.child(p);
|
||||
|
||||
$.reset(p);
|
||||
$.template_effect(($0, $1) => $.set_text(text, `${$0 ?? ''}${$1 ?? ''}`), [text1, text2]);
|
||||
$.append($$anchor, p);
|
||||
}
|
Loading…
Reference in new issue