Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow all themes from vega themes in types #1288

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
export let vegaLite = vegaLiteImport;

// For backwards compatibility with Vega-Lite before v4.
const w = (typeof window !== 'undefined' ? window : undefined) as any;

Check warning on line 41 in src/embed.ts

View workflow job for this annotation

GitHub Actions / Test on Node

Unexpected any. Specify a different type
if (vegaLite === undefined && w?.vl?.compile) {
vegaLite = w.vl;
}
Expand Down Expand Up @@ -72,7 +72,7 @@
bind?: HTMLElement | string;
actions?: boolean | Actions;
mode?: Mode;
theme?: 'excel' | 'ggplot2' | 'quartz' | 'vox' | 'dark';
theme?: keyof Omit<typeof themes, 'version'>;
defaultStyle?: boolean | string;
logLevel?: number;
loader?: Loader | LoaderOptions;
Expand Down Expand Up @@ -109,7 +109,7 @@
'vega-lite': vegaLite ? vegaLite.version : 'not available',
};

const PREPROCESSOR: {[mode in Mode]: (spec: any, config?: Config) => VgSpec} = {

Check warning on line 112 in src/embed.ts

View workflow job for this annotation

GitHub Actions / Test on Node

Unexpected any. Specify a different type
vega: (vgSpec: VgSpec) => vgSpec,
'vega-lite': (vlSpec, config) => vegaLite.compile(vlSpec as VlSpec, {config: config as VlConfig}).spec,
};
Expand Down Expand Up @@ -212,7 +212,7 @@
}

function embedOptionsFromUsermeta(parsedSpec: VisualizationSpec) {
const opts = (parsedSpec.usermeta as any)?.embedOptions ?? {};

Check warning on line 215 in src/embed.ts

View workflow job for this annotation

GitHub Actions / Test on Node

Unexpected any. Specify a different type
if (isString(opts.defaultStyle)) {
// we don't allow styles set via usermeta since it would allow injection of logic (we set the style via innerHTML)
opts.defaultStyle = false;
Expand Down Expand Up @@ -266,7 +266,7 @@
const config: Config = isString(opt.config) ? JSON.parse(await loader.load(opt.config)) : opt.config ?? {};
const patch: PatchFunc | Operation[] = isString(opt.patch) ? JSON.parse(await loader.load(opt.patch)) : opt.patch;
return {
...(opt as any),

Check warning on line 269 in src/embed.ts

View workflow job for this annotation

GitHub Actions / Test on Node

Unexpected any. Specify a different type
...(patch ? {patch} : {}),
...(config ? {config} : {}),
};
Expand Down Expand Up @@ -377,7 +377,7 @@
loader,
logLevel,
renderer,
...(ast ? {expr: (vega as any).expressionInterpreter ?? opts.expr ?? expressionInterpreter} : {}),

Check warning on line 380 in src/embed.ts

View workflow job for this annotation

GitHub Actions / Test on Node

Unexpected any. Specify a different type
});

view.addSignalListener('autosize', (_, autosize: Exclude<AutoSize, string>) => {
Expand Down Expand Up @@ -447,7 +447,7 @@
details.append(summary);

documentClickHandler = (ev: MouseEvent) => {
if (!details.contains(ev.target as any)) {

Check warning on line 450 in src/embed.ts

View workflow job for this annotation

GitHub Actions / Test on Node

Unexpected any. Specify a different type
details.removeAttribute('open');
}
};
Expand Down
Loading