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
Scatterplot.svelte
data.js
<script>
import Scatterplot from './Scatterplot.svelte';
import data from './data.js';
</script>

<div class="chart">
<h2>Anscombe's quartet</h2>

<Scatterplot points={data.a} />
<Scatterplot points={data.b} />
<Scatterplot points={data.c} />
<Scatterplot points={data.d} />
</div>

<style>
.chart {
width: 100%;
max-width: 640px;
height: calc(100% - 4em);
min-height: 280px;
max-height: 480px;
margin: 0 auto;
}
</style>

Error compiling component

WebAssembly.instantiateStreaming(): value type opcode @+13
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import Scatterplot from './Scatterplot.svelte';
import data from './data.js';

var root = $.template(`<div class="chart svelte-3diudx"><h2>Anscombe's quartet</h2> <!> <!> <!> <!></div>`);

export default function App($$anchor, $$props) {
$.push($$props, false);
$.init();

var div = root();
var node = $.sibling($.child(div), 2);

Scatterplot(node, {
get points() {
return data.a;
}
});

var node_1 = $.sibling(node, 2);

Scatterplot(node_1, {
get points() {
return data.b;
}
});

var node_2 = $.sibling(node_1, 2);

Scatterplot(node_2, {
get points() {
return data.c;
}
});
result = svelte.compile(source, {
generate: ,
});

.chart.svelte-3diudx {
width: 100%;
max-width: 640px;
height: calc(100% - 4em);
min-height: 280px;
max-height: 480px;
margin: 0 auto;
}

		
			
				
  • Root {
    • css: StyleSheet {...}
      • type: "StyleSheet"
      • start: 290
      • end: 442
      • attributes: []
      • children: [...] (1)
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 299
            • end: 305
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 299
                • end: 305
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • ClassSelector {...}
                        • type: "ClassSelector"
                        • name: "chart"
                        • start: 299
                        • end: 305
                        }
                      ]
                    • start: 299
                    • end: 305
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 306
            • end: 433
            • children: [...] (6)
              • Declaration {...}
                • type: "Declaration"
                • start: 310
                • end: 321
                • property: "width"
                • value: "100%"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 325
                • end: 341
                • property: "max-width"
                • value: "640px"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 345
                • end: 369
                • property: "height"
                • value: "calc(100% - 4em)"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 373
                • end: 390
                • property: "min-height"
                • value: "280px"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 394
                • end: 411
                • property: "max-height"
                • value: "480px"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 415
                • end: 429
                • property: "margin"
                • value: "0 auto"
                }
              ]
            }
          • start: 299
          • end: 433
          }
        ]
      • content: {...}
        • start: 297
        • end: 434
        • styles: "\n\t.chart {\n\t\twidth: 100%;\n\t\tmax-width: 640px;\n\t\theight: calc(100% - 4em);\n\t\tmin-height: 280px;\n\t\tmax-height: 480px;\n\t\tmargin: 0 auto;\n\t}\n"
        • comment: null
        }
      }
    • js: []
    • start: 100
    • end: 288
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (3)
        • Text {...}
          • type: "Text"
          • start: 98
          • end: 100
          • raw: "\n\n"
          • data: "\n\n"
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 100
          • end: 288
          • name: "div"
          • attributes: [...] (1)
            • Attribute {...}
              • type: "Attribute"
              • start: 105
              • end: 118
              • name: "class"
              • value: [...] (1)
                • Text {...}
                  • start: 112
                  • end: 117
                  • type: "Text"
                  • raw: "chart"
                  • data: "chart svelte-3diudx"
                  }
                ]
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (11)
              • Text {...}
                • type: "Text"
                • start: 119
                • end: 121
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 121
                • end: 148
                • name: "h2"
                • attributes: []
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 125
                      • end: 143
                      • raw: "Anscombe's quartet"
                      • data: "Anscombe's quartet"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 148
                • end: 151
                • raw: " "
                • data: " "
                }
              • Component {...}
                • type: "Component"
                • start: 151
                • end: 182
                • name: "Scatterplot"
                • attributes: [...] (1)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 164
                    • end: 179
                    • name: "points"
                    • value: ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 171
                      • end: 179
                      • expression: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 172
                        • end: 178
                        • loc: {...}
                          • start: {...}
                            • line: 9
                            • column: 22
                            }
                          • end: {...}
                            • line: 9
                            • column: 28
                            }
                          }
                        • object: Identifier {...}
                          • type: "Identifier"
                          • start: 172
                          • end: 176
                          • loc: {...}
                            • start: {...}
                              • line: 9
                              • column: 22
                              }
                            • end: {...}
                              • line: 9
                              • column: 26
                              }
                            }
                          • name: "data"
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 177
                          • end: 178
                          • loc: {...}
                            • start: {...}
                              • line: 9
                              • column: 27
                              }
                            • end: {...}
                              • line: 9
                              • column: 28
                              }
                            }
                          • name: "a"
                          }
                        • computed: false
                        • optional: false
                        }
                      }
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 182
                • end: 184
                • raw: " "
                • data: " "
                }
              • Component {...}
                • type: "Component"
                • start: 184
                • end: 215
                • name: "Scatterplot"
                • attributes: [...] (1)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 197
                    • end: 212
                    • name: "points"
                    • value: ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 204
                      • end: 212
                      • expression: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 205
                        • end: 211
                        • loc: {...}
                          • start: {...}
                            • line: 10
                            • column: 22
                            }
                          • end: {...}
                            • line: 10
                            • column: 28
                            }
                          }
                        • object: Identifier {...}
                          • type: "Identifier"
                          • start: 205
                          • end: 209
                          • loc: {...}
                            • start: {...}
                              • line: 10
                              • column: 22
                              }
                            • end: {...}
                              • line: 10
                              • column: 26
                              }
                            }
                          • name: "data"
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 210
                          • end: 211
                          • loc: {...}
                            • start: {...}
                              • line: 10
                              • column: 27
                              }
                            • end: {...}
                              • line: 10
                              • column: 28
                              }
                            }
                          • name: "b"
                          }
                        • computed: false
                        • optional: false
                        }
                      }
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 215
                • end: 217
                • raw: " "
                • data: " "
                }
              • Component {...}
                • type: "Component"
                • start: 217
                • end: 248
                • name: "Scatterplot"
                • attributes: [...] (1)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 230
                    • end: 245
                    • name: "points"
                    • value: ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 237
                      • end: 245
                      • expression: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 238
                        • end: 244
                        • loc: {...}
                          • start: {...}
                            • line: 11
                            • column: 22
                            }
                          • end: {...}
                            • line: 11
                            • column: 28
                            }
                          }
                        • object: Identifier {...}
                          • type: "Identifier"
                          • start: 238
                          • end: 242
                          • loc: {...}
                            • start: {...}
                              • line: 11
                              • column: 22
                              }
                            • end: {...}
                              • line: 11
                              • column: 26
                              }
                            }
                          • name: "data"
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 243
                          • end: 244
                          • loc: {...}
                            • start: {...}
                              • line: 11
                              • column: 27
                              }
                            • end: {...}
                              • line: 11
                              • column: 28
                              }
                            }
                          • name: "c"
                          }
                        • computed: false
                        • optional: false
                        }
                      }
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 248
                • end: 250
                • raw: " "
                • data: " "
                }
              • Component {...}
                • type: "Component"
                • start: 250
                • end: 281
                • name: "Scatterplot"
                • attributes: [...] (1)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 263
                    • end: 278
                    • name: "points"
                    • value: ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 270
                      • end: 278
                      • expression: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 271
                        • end: 277
                        • loc: {...}
                          • start: {...}
                            • line: 12
                            • column: 22
                            }
                          • end: {...}
                            • line: 12
                            • column: 28
                            }
                          }
                        • object: Identifier {...}
                          • type: "Identifier"
                          • start: 271
                          • end: 275
                          • loc: {...}
                            • start: {...}
                              • line: 12
                              • column: 22
                              }
                            • end: {...}
                              • line: 12
                              • column: 26
                              }
                            }
                          • name: "data"
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 276
                          • end: 277
                          • loc: {...}
                            • start: {...}
                              • line: 12
                              • column: 27
                              }
                            • end: {...}
                              • line: 12
                              • column: 28
                              }
                            }
                          • name: "d"
                          }
                        • computed: false
                        • optional: false
                        }
                      }
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 281
                • end: 282
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 288
          • end: 290
          • raw: "\n\n"
          • data: "\n\n"
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 98
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 89
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 4
            • column: 0
            }
          }
        • body: [...] (2)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 57
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 48
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 17
                • end: 28
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 8
                    }
                  • end: {...}
                    • line: 2
                    • column: 19
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 17
                  • end: 28
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 8
                      }
                    • end: {...}
                      • line: 2
                      • column: 19
                      }
                    }
                  • name: "Scatterplot"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 34
              • end: 56
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 25
                  }
                • end: {...}
                  • line: 2
                  • column: 47
                  }
                }
              • value: "./Scatterplot.svelte"
              • raw: "'./Scatterplot.svelte'"
              }
            }
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 59
            • end: 88
            • loc: {...}
              • start: {...}
                • line: 3
                • column: 1
                }
              • end: {...}
                • line: 3
                • column: 30
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 66
                • end: 70
                • loc: {...}
                  • start: {...}
                    • line: 3
                    • column: 8
                    }
                  • end: {...}
                    • line: 3
                    • column: 12
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 66
                  • end: 70
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 8
                      }
                    • end: {...}
                      • line: 3
                      • column: 12
                      }
                    }
                  • name: "data"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 76
              • end: 87
              • loc: {...}
                • start: {...}
                  • line: 3
                  • column: 18
                  }
                • end: {...}
                  • line: 3
                  • column: 29
                  }
                }
              • value: "./data.js"
              • raw: "'./data.js'"
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Scatterplot • Playground • Svelte