Skip to content

Commit 566da5b

Browse files
committed
add tags, AnimateDirective
1 parent d96412b commit 566da5b

File tree

1 file changed

+37
-0
lines changed
  • packages/svelte/src/compiler/print

1 file changed

+37
-0
lines changed

packages/svelte/src/compiler/print/index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ const visitors = {
8181
}
8282
},
8383

84+
AnimateDirective(node, context) {
85+
context.write(`animate:${node.name}`);
86+
if (
87+
node.expression !== null &&
88+
!(node.expression.type === 'Identifier' && node.expression.name === node.name)
89+
) {
90+
context.write('={');
91+
context.visit(node.expression);
92+
context.write('}');
93+
}
94+
},
95+
8496
Atrule(node, context) {
8597
context.write(`@${node.name}`);
8698
if (node.prelude) context.write(` ${node.prelude}`);
@@ -247,6 +259,25 @@ const visitors = {
247259
}
248260
},
249261

262+
ConstTag(node, context) {
263+
context.write('{@const ');
264+
context.visit(node.declaration); // TODO does this work?
265+
context.write('}');
266+
},
267+
268+
DebugTag(node, context) {
269+
context.write('{@debug ');
270+
let started = false;
271+
for (const identifier of node.identifiers) {
272+
if (started) {
273+
context.write(', ');
274+
}
275+
context.visit(identifier);
276+
started = true;
277+
}
278+
context.write('}');
279+
},
280+
250281
Declaration(node, context) {
251282
context.write(`${node.property}: ${node.value};`);
252283
},
@@ -287,6 +318,12 @@ const visitors = {
287318
context.write('}');
288319
},
289320

321+
HtmlTag(node, context) {
322+
context.write('{@html ');
323+
context.visit(node.expression);
324+
context.write('}');
325+
},
326+
290327
IfBlock(node, context) {
291328
if (node.elseif) {
292329
context.write('{:else if ');

0 commit comments

Comments
 (0)