Skip to content

Commit

Permalink
feat: svelte-vega now exports VisualizationSpec (#30)
Browse files Browse the repository at this point in the history
* chore: svelte-vega now exports VisualizationSpec

Now exporting VisualizationSpec directly from svelte-vega, so no need to import vega-embed for that
anymore.

re #29

* chore: added Vega and VegaLite specs

Now also individually exports Vega and VegaLite specs.

re #29
  • Loading branch information
Alex Bäuerle authored May 7, 2021
1 parent 7abffdb commit 306d5f3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/sample-project/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { VisualizationSpec } from "vega-embed";
import { Vega, VegaLite } from "svelte-vega";
import type { VisualizationSpec } from "svelte-vega";
let dataVL = {
table: [
Expand Down
6 changes: 2 additions & 4 deletions packages/svelte-vega/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ For an example Svelte project using `svelte-vega`, see the [example application]

```typescript
<script lang="ts">
import type { VisualizationSpec } from "vega-embed";

import type { VisualizationSpec } from "svelte-vega";
import { Vega } from "svelte-vega";

const data = {
Expand All @@ -77,8 +76,7 @@ For an example Svelte project using `svelte-vega`, see the [example application]

```typescript
<script lang="ts">
import type { VisualizationSpec } from "vega-embed";

import type { VisualizationSpec } from "svelte-vega";
import { VegaLite } from "svelte-vega";

const data = {
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte-vega/src/Vega.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { EmbedOptions, Mode, VisualizationSpec } from "vega-embed";
import type { SignalListeners } from "./types";
import type { EmbedOptions, Mode } from "vega-embed";
import type { SignalListeners, VisualizationSpec } from "./types";
import VegaEmbed from "./VegaEmbed.svelte";
export let spec: VisualizationSpec;
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte-vega/src/VegaEmbed.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts">
import { createEventDispatcher, onDestroy } from "svelte";
import type { EmbedOptions, Result, VisualizationSpec } from "vega-embed";
import type { EmbedOptions, Result } from "vega-embed";
import vegaEmbed from "vega-embed";
import { WIDTH_HEIGHT } from "./constants";
import type { SignalListeners, View } from "./types";
import type { SignalListeners, View, VisualizationSpec } from "./types";
import {
addSignalListenersToView,
updateMultipleDatasetsInView,
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte-vega/src/VegaLite.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { EmbedOptions, Mode, VisualizationSpec } from "vega-embed";
import type { SignalListeners } from "./types";
import type { EmbedOptions, Mode } from "vega-embed";
import type { SignalListeners, VisualizationSpec } from "./types";
import VegaEmbed from "./VegaEmbed.svelte";
export let spec: VisualizationSpec;
Expand Down
8 changes: 7 additions & 1 deletion packages/svelte-vega/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { Result } from "vega-embed";
import type { Result, VisualizationSpec as Spec } from "vega-embed";
import type { Spec as VgSpec } from "vega";
import type { TopLevelSpec as VlSpec } from "vega-lite";

export type View = Result["view"];

Expand All @@ -7,3 +9,7 @@ export type SignalListener = (name: string, value: unknown) => void;
export type SignalListeners = {
[key: string]: SignalListener;
};

export type VisualizationSpec = Spec;
export type VegaSpec = VgSpec;
export type VegaLiteSpec = VlSpec;

0 comments on commit 306d5f3

Please sign in to comment.