Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="200">
<clipPath id="clip">
<rect id="rect" x="140" y="20" width="120" height="100" />
</clipPath>
<filter id="blur" width="160%" height="160%" x="-30%" y="-30%">
<!-- insert a neutral background color to prevent the backdrop showing
through blurred regions with alpa < 1 -->
<feFlood flood-color="#2e2e2e" result="neutral"/>
<feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blurred" />
<feMerge>
<feMergeNode in="neutral" />
<feMergeNode in="blurred" />
</feMerge>
</filter>
<!-- group everything you want to include in the backdrop -->
<g id="backdrop">
<rect fill="red" x="0" y="0" width="200" height="100" />
<rect fill="yellow" x="120" y="40" width="40" height="40" />
</g>
<!-- make sure the clip-path is applied after the filter -->
<g style="clip-path: url(#clip)">
<use xlink:href="#backdrop" style="filter: url(#blur)" />
</g>
<use xlink:href="#rect" style="fill:none;stroke:black" />
</svg>
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';

var root = $.from_svg(`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="200"><clipPath id="clip"><rect id="rect" x="140" y="20" width="120" height="100"></rect></clipPath><filter id="blur" width="160%" height="160%" x="-30%" y="-30%"><feFlood flood-color="#2e2e2e" result="neutral"></feFlood><feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blurred"></feGaussianBlur><feMerge><feMergeNode in="neutral"></feMergeNode><feMergeNode in="blurred"></feMergeNode></feMerge></filter><g id="backdrop"><rect fill="red" x="0" y="0" width="200" height="100"></rect><rect fill="yellow" x="120" y="40" width="40" height="40"></rect></g><g style="clip-path: url(#clip)"><use xlink:href="#backdrop" style="filter: url(#blur)"></use></g><use xlink:href="#rect" style="fill:none;stroke:black"></use></svg>`);

export default function App($$anchor) {
var svg = root();

$.append($$anchor, svg);
}
result = svelte.compile(source, {
generate: ,
fragments: ,
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • Root {
    • css: null
    • js: []
    • start: 0
    • end: 1094
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (1)
        • RegularElement {...}
          • type: "RegularElement"
          • start: 0
          • end: 1094
          • name: "svg"
          • attributes: [...] (4)
            • Attribute {...}
              • type: "Attribute"
              • start: 5
              • end: 39
              • name: "xmlns"
              • value: [...] (1)
                • Text {...}
                  • start: 12
                  • end: 38
                  • type: "Text"
                  • raw: "http://www.w3.org/2000/svg"
                  • data: "http://www.w3.org/2000/svg"
                  }
                ]
              }
            • Attribute {...}
              • type: "Attribute"
              • start: 40
              • end: 82
              • name: "xmlns:xlink"
              • value: [...] (1)
                • Text {...}
                  • start: 53
                  • end: 81
                  • type: "Text"
                  • raw: "http://www.w3.org/1999/xlink"
                  • data: "http://www.w3.org/1999/xlink"
                  }
                ]
              }
            • Attribute {...}
              • type: "Attribute"
              • start: 83
              • end: 94
              • name: "width"
              • value: [...] (1)
                • Text {...}
                  • start: 90
                  • end: 93
                  • type: "Text"
                  • raw: "300"
                  • data: "300"
                  }
                ]
              }
            • Attribute {...}
              • type: "Attribute"
              • start: 95
              • end: 107
              • name: "height"
              • value: [...] (1)
                • Text {...}
                  • start: 103
                  • end: 106
                  • type: "Text"
                  • raw: "200"
                  • data: "200"
                  }
                ]
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (15)
              • Text {...}
                • type: "Text"
                • start: 108
                • end: 111
                • raw: "\n "
                • data: "\n "
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 111
                • end: 208
                • name: "clipPath"
                • attributes: [...] (1)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 121
                    • end: 130
                    • name: "id"
                    • value: [...] (1)
                      • Text {...}
                        • start: 125
                        • end: 129
                        • type: "Text"
                        • raw: "clip"
                        • data: "clip"
                        }
                      ]
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (3)
                    • Text {...}
                      • type: "Text"
                      • start: 131
                      • end: 136
                      • raw: "\n "
                      • data: "\n "
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 136
                      • end: 194
                      • name: "rect"
                      • attributes: [...] (5)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 142
                          • end: 151
                          • name: "id"
                          • value: [...] (1)
                            • Text {...}
                              • start: 146
                              • end: 150
                              • type: "Text"
                              • raw: "rect"
                              • data: "rect"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 152
                          • end: 159
                          • name: "x"
                          • value: [...] (1)
                            • Text {...}
                              • start: 155
                              • end: 158
                              • type: "Text"
                              • raw: "140"
                              • data: "140"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 160
                          • end: 166
                          • name: "y"
                          • value: [...] (1)
                            • Text {...}
                              • start: 163
                              • end: 165
                              • type: "Text"
                              • raw: "20"
                              • data: "20"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 167
                          • end: 178
                          • name: "width"
                          • value: [...] (1)
                            • Text {...}
                              • start: 174
                              • end: 177
                              • type: "Text"
                              • raw: "120"
                              • data: "120"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 179
                          • end: 191
                          • name: "height"
                          • value: [...] (1)
                            • Text {...}
                              • start: 187
                              • end: 190
                              • type: "Text"
                              • raw: "100"
                              • data: "100"
                              }
                            ]
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 194
                      • end: 197
                      • raw: "\n "
                      • data: "\n "
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 208
                • end: 211
                • raw: " "
                • data: " "
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 211
                • end: 642
                • name: "filter"
                • attributes: [...] (5)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 219
                    • end: 228
                    • name: "id"
                    • value: [...] (1)
                      • Text {...}
                        • start: 223
                        • end: 227
                        • type: "Text"
                        • raw: "blur"
                        • data: "blur"
                        }
                      ]
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 229
                    • end: 241
                    • name: "width"
                    • value: [...] (1)
                      • Text {...}
                        • start: 236
                        • end: 240
                        • type: "Text"
                        • raw: "160%"
                        • data: "160%"
                        }
                      ]
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 242
                    • end: 255
                    • name: "height"
                    • value: [...] (1)
                      • Text {...}
                        • start: 250
                        • end: 254
                        • type: "Text"
                        • raw: "160%"
                        • data: "160%"
                        }
                      ]
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 256
                    • end: 264
                    • name: "x"
                    • value: [...] (1)
                      • Text {...}
                        • start: 259
                        • end: 263
                        • type: "Text"
                        • raw: "-30%"
                        • data: "-30%"
                        }
                      ]
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 265
                    • end: 273
                    • name: "y"
                    • value: [...] (1)
                      • Text {...}
                        • start: 268
                        • end: 272
                        • type: "Text"
                        • raw: "-30%"
                        • data: "-30%"
                        }
                      ]
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (9)
                    • Text {...}
                      • type: "Text"
                      • start: 274
                      • end: 279
                      • raw: "\n "
                      • data: "\n "
                      }
                    • Comment {...}
                      • type: "Comment"
                      • start: 279
                      • end: 400
                      • data: " insert a neutral background color to prevent the backdrop showing\n through blurred regions with alpa < 1 "
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 400
                      • end: 405
                      • raw: "\n "
                      • data: "\n "
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 405
                      • end: 454
                      • name: "feFlood"
                      • attributes: [...] (2)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 414
                          • end: 435
                          • name: "flood-color"
                          • value: [...] (1)
                            • Text {...}
                              • start: 427
                              • end: 434
                              • type: "Text"
                              • raw: "#2e2e2e"
                              • data: "#2e2e2e"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 436
                          • end: 452
                          • name: "result"
                          • value: [...] (1)
                            • Text {...}
                              • start: 444
                              • end: 451
                              • type: "Text"
                              • raw: "neutral"
                              • data: "neutral"
                              }
                            ]
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 454
                      • end: 459
                      • raw: " "
                      • data: " "
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 459
                      • end: 531
                      • name: "feGaussianBlur"
                      • attributes: [...] (3)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 475
                          • end: 493
                          • name: "in"
                          • value: [...] (1)
                            • Text {...}
                              • start: 479
                              • end: 492
                              • type: "Text"
                              • raw: "SourceGraphic"
                              • data: "SourceGraphic"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 494
                          • end: 511
                          • name: "stdDeviation"
                          • value: [...] (1)
                            • Text {...}
                              • start: 508
                              • end: 510
                              • type: "Text"
                              • raw: "10"
                              • data: "10"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 512
                          • end: 528
                          • name: "result"
                          • value: [...] (1)
                            • Text {...}
                              • start: 520
                              • end: 527
                              • type: "Text"
                              • raw: "blurred"
                              • data: "blurred"
                              }
                            ]
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 531
                      • end: 536
                      • raw: " "
                      • data: " "
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 536
                      • end: 630
                      • name: "feMerge"
                      • attributes: []
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: [...] (5)
                          • Text {...}
                            • type: "Text"
                            • start: 545
                            • end: 552
                            • raw: "\n "
                            • data: "\n "
                            }
                          • RegularElement {...}
                            • type: "RegularElement"
                            • start: 552
                            • end: 580
                            • name: "feMergeNode"
                            • attributes: [...] (1)
                              • Attribute {...}
                                • type: "Attribute"
                                • start: 565
                                • end: 577
                                • name: "in"
                                • value: [...] (1)
                                  • Text {...}
                                    • start: 569
                                    • end: 576
                                    • type: "Text"
                                    • raw: "neutral"
                                    • data: "neutral"
                                    }
                                  ]
                                }
                              ]
                            • fragment: Fragment {...}
                              • type: "Fragment"
                              • nodes: []
                              }
                            }
                          • Text {...}
                            • type: "Text"
                            • start: 580
                            • end: 587
                            • raw: " "
                            • data: " "
                            }
                          • RegularElement {...}
                            • type: "RegularElement"
                            • start: 587
                            • end: 615
                            • name: "feMergeNode"
                            • attributes: [...] (1)
                              • Attribute {...}
                                • type: "Attribute"
                                • start: 600
                                • end: 612
                                • name: "in"
                                • value: [...] (1)
                                  • Text {...}
                                    • start: 604
                                    • end: 611
                                    • type: "Text"
                                    • raw: "blurred"
                                    • data: "blurred"
                                    }
                                  ]
                                }
                              ]
                            • fragment: Fragment {...}
                              • type: "Fragment"
                              • nodes: []
                              }
                            }
                          • Text {...}
                            • type: "Text"
                            • start: 615
                            • end: 620
                            • raw: "\n "
                            • data: "\n "
                            }
                          ]
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 630
                      • end: 633
                      • raw: "\n "
                      • data: "\n "
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 642
                • end: 645
                • raw: " "
                • data: " "
                }
              • Comment {...}
                • type: "Comment"
                • start: 645
                • end: 706
                • data: " group everything you want to include in the backdrop "
                }
              • Text {...}
                • type: "Text"
                • start: 706
                • end: 709
                • raw: ""
                • data: ""
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 709
                • end: 859
                • name: "g"
                • attributes: [...] (1)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 712
                    • end: 725
                    • name: "id"
                    • value: [...] (1)
                      • Text {...}
                        • start: 716
                        • end: 724
                        • type: "Text"
                        • raw: "backdrop"
                        • data: "backdrop"
                        }
                      ]
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (5)
                    • Text {...}
                      • type: "Text"
                      • start: 726
                      • end: 731
                      • raw: "\n "
                      • data: "\n "
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 731
                      • end: 787
                      • name: "rect"
                      • attributes: [...] (5)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 737
                          • end: 747
                          • name: "fill"
                          • value: [...] (1)
                            • Text {...}
                              • start: 743
                              • end: 746
                              • type: "Text"
                              • raw: "red"
                              • data: "red"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 748
                          • end: 753
                          • name: "x"
                          • value: [...] (1)
                            • Text {...}
                              • start: 751
                              • end: 752
                              • type: "Text"
                              • raw: "0"
                              • data: "0"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 754
                          • end: 759
                          • name: "y"
                          • value: [...] (1)
                            • Text {...}
                              • start: 757
                              • end: 758
                              • type: "Text"
                              • raw: "0"
                              • data: "0"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 760
                          • end: 771
                          • name: "width"
                          • value: [...] (1)
                            • Text {...}
                              • start: 767
                              • end: 770
                              • type: "Text"
                              • raw: "200"
                              • data: "200"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 772
                          • end: 784
                          • name: "height"
                          • value: [...] (1)
                            • Text {...}
                              • start: 780
                              • end: 783
                              • type: "Text"
                              • raw: "100"
                              • data: "100"
                              }
                            ]
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 787
                      • end: 792
                      • raw: " "
                      • data: " "
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 792
                      • end: 852
                      • name: "rect"
                      • attributes: [...] (5)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 798
                          • end: 811
                          • name: "fill"
                          • value: [...] (1)
                            • Text {...}
                              • start: 804
                              • end: 810
                              • type: "Text"
                              • raw: "yellow"
                              • data: "yellow"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 812
                          • end: 819
                          • name: "x"
                          • value: [...] (1)
                            • Text {...}
                              • start: 815
                              • end: 818
                              • type: "Text"
                              • raw: "120"
                              • data: "120"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 820
                          • end: 826
                          • name: "y"
                          • value: [...] (1)
                            • Text {...}
                              • start: 823
                              • end: 825
                              • type: "Text"
                              • raw: "40"
                              • data: "40"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 827
                          • end: 837
                          • name: "width"
                          • value: [...] (1)
                            • Text {...}
                              • start: 834
                              • end: 836
                              • type: "Text"
                              • raw: "40"
                              • data: "40"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 838
                          • end: 849
                          • name: "height"
                          • value: [...] (1)
                            • Text {...}
                              • start: 846
                              • end: 848
                              • type: "Text"
                              • raw: "40"
                              • data: "40"
                              }
                            ]
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 852
                      • end: 855
                      • raw: "\n "
                      • data: "\n "
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 859
                • end: 862
                • raw: " "
                • data: " "
                }
              • Comment {...}
                • type: "Comment"
                • start: 862
                • end: 922
                • data: " make sure the clip-path is applied after the filter "
                }
              • Text {...}
                • type: "Text"
                • start: 922
                • end: 925
                • raw: ""
                • data: ""
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 925
                • end: 1027
                • name: "g"
                • attributes: [...] (1)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 928
                    • end: 957
                    • name: "style"
                    • value: [...] (1)
                      • Text {...}
                        • start: 935
                        • end: 956
                        • type: "Text"
                        • raw: "clip-path: url(#clip)"
                        • data: "clip-path: url(#clip)"
                        }
                      ]
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (3)
                    • Text {...}
                      • type: "Text"
                      • start: 958
                      • end: 963
                      • raw: "\n "
                      • data: "\n "
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 963
                      • end: 1020
                      • name: "use"
                      • attributes: [...] (2)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 968
                          • end: 990
                          • name: "xlink:href"
                          • value: [...] (1)
                            • Text {...}
                              • start: 980
                              • end: 989
                              • type: "Text"
                              • raw: "#backdrop"
                              • data: "#backdrop"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 991
                          • end: 1017
                          • name: "style"
                          • value: [...] (1)
                            • Text {...}
                              • start: 998
                              • end: 1016
                              • type: "Text"
                              • raw: "filter: url(#blur)"
                              • data: "filter: url(#blur)"
                              }
                            ]
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 1020
                      • end: 1023
                      • raw: "\n "
                      • data: "\n "
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 1027
                • end: 1030
                • raw: " "
                • data: " "
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 1030
                • end: 1087
                • name: "use"
                • attributes: [...] (2)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 1035
                    • end: 1053
                    • name: "xlink:href"
                    • value: [...] (1)
                      • Text {...}
                        • start: 1047
                        • end: 1052
                        • type: "Text"
                        • raw: "#rect"
                        • data: "#rect"
                        }
                      ]
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 1054
                    • end: 1084
                    • name: "style"
                    • value: [...] (1)
                      • Text {...}
                        • start: 1061
                        • end: 1083
                        • type: "Text"
                        • raw: "fill:none;stroke:black"
                        • data: "fill:none;stroke:black"
                        }
                      ]
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 1087
                • end: 1088
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        ]
      }
    • options: null
    }
The AST is not public API and may change at any point in time