Comparing version
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.36.7", | ||
"version": "5.36.8", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -47,3 +47,3 @@ /** @import { BlockStatement, Expression, Statement } from 'estree' */ | ||
if (node.fallback) { | ||
const open = b.stmt(b.assignment('+=', b.id('$$payload.out'), block_open)); | ||
const open = b.stmt(b.call(b.member(b.id('$$payload.out'), b.id('push')), block_open)); | ||
@@ -53,3 +53,3 @@ const fallback = /** @type {BlockStatement} */ (context.visit(node.fallback)); | ||
fallback.body.unshift( | ||
b.stmt(b.assignment('+=', b.id('$$payload.out'), b.literal(BLOCK_OPEN_ELSE))) | ||
b.stmt(b.call(b.member(b.id('$$payload.out'), b.id('push')), b.literal(BLOCK_OPEN_ELSE))) | ||
); | ||
@@ -56,0 +56,0 @@ |
@@ -20,6 +20,8 @@ /** @import { BlockStatement, Expression } from 'estree' */ | ||
consequent.body.unshift(b.stmt(b.assignment('+=', b.id('$$payload.out'), block_open))); | ||
consequent.body.unshift( | ||
b.stmt(b.call(b.member(b.id('$$payload.out'), b.id('push')), block_open)) | ||
); | ||
alternate.body.unshift( | ||
b.stmt(b.assignment('+=', b.id('$$payload.out'), b.literal(BLOCK_OPEN_ELSE))) | ||
b.stmt(b.call(b.member(b.id('$$payload.out'), b.id('push')), b.literal(BLOCK_OPEN_ELSE))) | ||
); | ||
@@ -26,0 +28,0 @@ |
@@ -99,6 +99,6 @@ /** @import { AssignmentOperator, Expression, Identifier, Node, Statement } from 'estree' */ | ||
* @param {Identifier} out | ||
* @param {AssignmentOperator} operator | ||
* @param {AssignmentOperator | 'push'} operator | ||
* @returns {Statement[]} | ||
*/ | ||
export function build_template(template, out = b.id('$$payload.out'), operator = '+=') { | ||
export function build_template(template, out = b.id('$$payload.out'), operator = 'push') { | ||
/** @type {string[]} */ | ||
@@ -114,14 +114,28 @@ let strings = []; | ||
const flush = () => { | ||
statements.push( | ||
b.stmt( | ||
b.assignment( | ||
operator, | ||
out, | ||
b.template( | ||
strings.map((cooked, i) => b.quasi(cooked, i === strings.length - 1)), | ||
expressions | ||
if (operator === 'push') { | ||
statements.push( | ||
b.stmt( | ||
b.call( | ||
b.member(out, b.id('push')), | ||
b.template( | ||
strings.map((cooked, i) => b.quasi(cooked, i === strings.length - 1)), | ||
expressions | ||
) | ||
) | ||
) | ||
) | ||
); | ||
); | ||
} else { | ||
statements.push( | ||
b.stmt( | ||
b.assignment( | ||
operator, | ||
out, | ||
b.template( | ||
strings.map((cooked, i) => b.quasi(cooked, i === strings.length - 1)), | ||
expressions | ||
) | ||
) | ||
) | ||
); | ||
} | ||
strings = []; | ||
@@ -128,0 +142,0 @@ expressions = []; |
@@ -535,3 +535,5 @@ /** @import { Derived, Effect, Source } from '#client' */ | ||
if (effect.deps === null && effect.first === null && effect.nodes_start === null) { | ||
if (effect.teardown === null) { | ||
// if there's no teardown or abort controller we completely unlink | ||
// the effect from the graph | ||
if (effect.teardown === null && effect.ac === null) { | ||
// remove this effect from the graph | ||
@@ -538,0 +540,0 @@ unlink_effect(effect); |
@@ -18,6 +18,8 @@ /** @import { Snippet } from 'svelte' */ | ||
var getters = /** @type {Getters<Params>} */ (args.map((value) => () => value)); | ||
payload.out += fn(...getters) | ||
.render() | ||
.trim(); | ||
payload.out.push( | ||
fn(...getters) | ||
.render() | ||
.trim() | ||
); | ||
}; | ||
} |
@@ -43,3 +43,3 @@ /** @import { Component } from '#server' */ | ||
console.error(message); | ||
payload.head.out += `<script>console.error(${JSON.stringify(message)})</script>`; | ||
payload.head.out.push(`<script>console.error(${JSON.stringify(message)})</script>`); | ||
} | ||
@@ -46,0 +46,0 @@ |
@@ -36,8 +36,8 @@ /** @import { ComponentType, SvelteComponent } from 'svelte' */ | ||
export function element(payload, tag, attributes_fn = noop, children_fn = noop) { | ||
payload.out += '<!---->'; | ||
payload.out.push('<!---->'); | ||
if (tag) { | ||
payload.out += `<${tag}`; | ||
payload.out.push(`<${tag}`); | ||
attributes_fn(); | ||
payload.out += `>`; | ||
payload.out.push(`>`); | ||
@@ -47,9 +47,9 @@ if (!is_void(tag)) { | ||
if (!is_raw_text_element(tag)) { | ||
payload.out += EMPTY_COMMENT; | ||
payload.out.push(EMPTY_COMMENT); | ||
} | ||
payload.out += `</${tag}>`; | ||
payload.out.push(`</${tag}>`); | ||
} | ||
} | ||
payload.out += '<!---->'; | ||
payload.out.push('<!---->'); | ||
} | ||
@@ -77,3 +77,3 @@ | ||
on_destroy = []; | ||
payload.out += BLOCK_OPEN; | ||
payload.out.push(BLOCK_OPEN); | ||
@@ -103,7 +103,7 @@ let reset_reset_element; | ||
payload.out += BLOCK_CLOSE; | ||
payload.out.push(BLOCK_CLOSE); | ||
for (const cleanup of on_destroy) cleanup(); | ||
on_destroy = prev_on_destroy; | ||
let head = payload.head.out + payload.head.title; | ||
let head = payload.head.out.join('') + payload.head.title; | ||
@@ -114,6 +114,8 @@ for (const { hash, code } of payload.css) { | ||
const body = payload.out.join(''); | ||
return { | ||
head, | ||
html: payload.out, | ||
body: payload.out | ||
html: body, | ||
body: body | ||
}; | ||
@@ -132,5 +134,5 @@ } finally { | ||
const head_payload = payload.head; | ||
head_payload.out += BLOCK_OPEN; | ||
head_payload.out.push(BLOCK_OPEN); | ||
fn(head_payload); | ||
head_payload.out += BLOCK_CLOSE; | ||
head_payload.out.push(BLOCK_CLOSE); | ||
} | ||
@@ -150,9 +152,9 @@ | ||
if (is_html) { | ||
payload.out += `<svelte-css-wrapper style="display: contents; ${styles}">`; | ||
payload.out.push(`<svelte-css-wrapper style="display: contents; ${styles}">`); | ||
} else { | ||
payload.out += `<g style="${styles}">`; | ||
payload.out.push(`<g style="${styles}">`); | ||
} | ||
if (dynamic) { | ||
payload.out += '<!---->'; | ||
payload.out.push('<!---->'); | ||
} | ||
@@ -163,5 +165,5 @@ | ||
if (is_html) { | ||
payload.out += `<!----></svelte-css-wrapper>`; | ||
payload.out.push(`<!----></svelte-css-wrapper>`); | ||
} else { | ||
payload.out += `<!----></g>`; | ||
payload.out.push(`<!----></g>`); | ||
} | ||
@@ -451,3 +453,3 @@ } | ||
if (is_promise(promise)) { | ||
payload.out += BLOCK_OPEN; | ||
payload.out.push(BLOCK_OPEN); | ||
promise.then(null, noop); | ||
@@ -458,3 +460,3 @@ if (pending_fn !== null) { | ||
} else if (then_fn !== null) { | ||
payload.out += BLOCK_OPEN_ELSE; | ||
payload.out.push(BLOCK_OPEN_ELSE); | ||
then_fn(promise); | ||
@@ -506,3 +508,3 @@ } | ||
const uid = payload.uid(); | ||
payload.out += '<!--#' + uid + '-->'; | ||
payload.out.push('<!--#' + uid + '-->'); | ||
return uid; | ||
@@ -576,8 +578,11 @@ } | ||
var body = payload.out.slice(i); | ||
var body = payload.out.slice(i).join(''); | ||
if (body.replace(/<!---->/g, '') === payload.select_value) { | ||
// replace '>' with ' selected>' (closing tag will be added later) | ||
payload.out = payload.out.slice(0, i - 1) + ' selected>' + body; | ||
var last_item = payload.out[i - 1]; | ||
payload.out[i - 1] = last_item.slice(0, -1) + ' selected>'; | ||
// Remove the old items after position i and add the body as a single item | ||
payload.out.splice(i, payload.out.length - i, body); | ||
} | ||
} |
export class HeadPayload { | ||
/** @type {Set<{ hash: string; code: string }>} */ | ||
css = new Set(); | ||
out = ''; | ||
/** @type {string[]} */ | ||
out = []; | ||
uid = () => ''; | ||
title = ''; | ||
constructor(css = new Set(), out = '', title = '', uid = () => '') { | ||
constructor(css = new Set(), /** @type {string[]} */ out = [], title = '', uid = () => '') { | ||
this.css = css; | ||
@@ -19,3 +20,4 @@ this.out = out; | ||
css = new Set(); | ||
out = ''; | ||
/** @type {string[]} */ | ||
out = []; | ||
uid = () => ''; | ||
@@ -40,3 +42,3 @@ select_value = undefined; | ||
payload.out = out; | ||
payload.out = [...out]; | ||
payload.css = new Set(css); | ||
@@ -46,3 +48,3 @@ payload.uid = uid; | ||
payload.head = new HeadPayload(); | ||
payload.head.out = head.out; | ||
payload.head.out = [...head.out]; | ||
payload.head.css = new Set(head.css); | ||
@@ -62,3 +64,3 @@ payload.head.title = head.title; | ||
export function assign_payload(p1, p2) { | ||
p1.out = p2.out; | ||
p1.out = [...p2.out]; | ||
p1.css = p2.css; | ||
@@ -65,0 +67,0 @@ p1.head = p2.head; |
@@ -7,3 +7,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.36.7'; | ||
export const VERSION = '5.36.8'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is too big to display
2577799
0.04%56784
0.05%