@@ -18,7 +18,7 @@ import { HTMLPerspectiveViewerElement } from "@finos/perspective-viewer";
1818import type * as psp_types from "@finos/perspective-viewer" ;
1919
2020import * as d3 from "d3" ;
21- import { D3FC_GLOBAL_STYLES } from "./d3fc_global_styles" ;
21+
2222import { Chart , Settings , Type } from "../types" ;
2323
2424const DEFAULT_PLUGIN_SETTINGS = {
@@ -30,17 +30,7 @@ const DEFAULT_PLUGIN_SETTINGS = {
3030 selectMode : "select" ,
3131} ;
3232
33- const styleSheets = [ ] ;
34- for ( const style of D3FC_GLOBAL_STYLES ) {
35- const sheet = new CSSStyleSheet ( ) ;
36- sheet . replaceSync ( style . textContent ) ;
37- styleSheets . push ( sheet ) ;
38- }
39-
40- const sheet = new CSSStyleSheet ( ) ;
41- sheet . replaceSync ( style ) ;
42-
43- styleSheets . push ( sheet ) ;
33+ const D3FC_GLOBAL_STYLES = [ ] ;
4434
4535const EXCLUDED_SETTINGS = [
4636 "crossValues" ,
@@ -63,6 +53,18 @@ async function register_element(plugin_name: string) {
6353 await perspectiveViewerClass . registerPlugin ( plugin_name ) ;
6454}
6555
56+ export function createStyleSheets ( sheets ) {
57+ for ( const style of sheets ) {
58+ const sheet = new CSSStyleSheet ( ) ;
59+ sheet . replaceSync ( style . textContent ) ;
60+ D3FC_GLOBAL_STYLES . push ( sheet ) ;
61+ }
62+
63+ const sheet = new CSSStyleSheet ( ) ;
64+ sheet . replaceSync ( style ) ;
65+ D3FC_GLOBAL_STYLES . push ( sheet ) ;
66+ }
67+
6668export function register ( ...plugin_names : string [ ] ) {
6769 const plugins = new Set (
6870 plugin_names . length > 0
@@ -115,7 +117,7 @@ class HTMLPerspectiveViewerD3fcPluginElement extends HTMLElement {
115117 connectedCallback ( ) {
116118 if ( ! this . _initialized ) {
117119 this . attachShadow ( { mode : "open" } ) ;
118- for ( const sheet of styleSheets ) {
120+ for ( const sheet of D3FC_GLOBAL_STYLES ) {
119121 this . shadowRoot . adoptedStyleSheets . push ( sheet ) ;
120122 }
121123
0 commit comments