From 566da5b95f0d451215603cfd8b03239a1191bbe7 Mon Sep 17 00:00:00 2001 From: ComputerGuy <63362464+Ocean-OS@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:54:21 -0700 Subject: [PATCH] add tags, `AnimateDirective` --- packages/svelte/src/compiler/print/index.js | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/packages/svelte/src/compiler/print/index.js b/packages/svelte/src/compiler/print/index.js index 7495721d7e..771c997fdf 100644 --- a/packages/svelte/src/compiler/print/index.js +++ b/packages/svelte/src/compiler/print/index.js @@ -81,6 +81,18 @@ const visitors = { } }, + AnimateDirective(node, context) { + context.write(`animate:${node.name}`); + if ( + node.expression !== null && + !(node.expression.type === 'Identifier' && node.expression.name === node.name) + ) { + context.write('={'); + context.visit(node.expression); + context.write('}'); + } + }, + Atrule(node, context) { context.write(`@${node.name}`); if (node.prelude) context.write(` ${node.prelude}`); @@ -247,6 +259,25 @@ const visitors = { } }, + ConstTag(node, context) { + context.write('{@const '); + context.visit(node.declaration); // TODO does this work? + context.write('}'); + }, + + DebugTag(node, context) { + context.write('{@debug '); + let started = false; + for (const identifier of node.identifiers) { + if (started) { + context.write(', '); + } + context.visit(identifier); + started = true; + } + context.write('}'); + }, + Declaration(node, context) { context.write(`${node.property}: ${node.value};`); }, @@ -287,6 +318,12 @@ const visitors = { context.write('}'); }, + HtmlTag(node, context) { + context.write('{@html '); + context.visit(node.expression); + context.write('}'); + }, + IfBlock(node, context) { if (node.elseif) { context.write('{:else if ');