Skip to content

Commit

Permalink
Make compatible with ES Module imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Mar 8, 2024
1 parent be5587b commit cab3052
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,13 @@ Currently, there are some niggling problems which remain after generation;
1. Some givens of union types have duplicate shapes, need to comment out the encoder / decoders for some of them
2. introduce a nulltype parameter.


## Import map

```json
{
"imports": {
"@vega/npm": "https://cdn.jsdelivr.net/npm/"
}
}
```

2 changes: 1 addition & 1 deletion core/js/src/main/scala/viz/vega/facades/VegaEmbed.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ trait EmbedOptions:
end EmbedOptions

@js.native
@JSImport("vega-embed", JSImport.Default, "vegaEmbed")
@JSImport("@vega/npm/vega-embed@6/+esm", JSImport.Namespace, "vegaEmbed")
object VegaEmbed extends js.Object:
def apply(element: HTMLElement, spec: js.Object, options: EmbedOptions): js.Promise[EmbedResult] = js.native

Expand Down
2 changes: 1 addition & 1 deletion core/js/src/main/scala/viz/vega/facades/VegaView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ end Options
*/
@js.native
@annotation.nowarn("msg=unused explicit parameter")
@JSImport("vega-view", JSImport.Namespace, "vega.View")
@JSImport("@vega/npm/vega-view@5/+esm", JSImport.Namespace, "vega.View")
class VegaView(parsedSpec: js.Dynamic, config: js.Dynamic) extends js.Object:

def runAsync(): Unit = js.native
Expand Down

0 comments on commit cab3052

Please sign in to comment.