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

Use static import to work around Vite production build problem #134

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {PolymerElement} from '@polymer/polymer/polymer-element.js';
import {html} from '@polymer/polymer/lib/utils/html-tag.js';
import '@polymer/polymer/lib/utils/html-tag.js';
import ApexCharts from 'apexcharts/dist/apexcharts.esm';
import color from "onecolor";

class ApexChartsWrapper extends PolymerElement {
static get template() {
Expand Down Expand Up @@ -94,7 +95,6 @@ class ApexChartsWrapper extends PolymerElement {

ready() {
super.ready();
this.color = require('onecolor');
const div = document.createElement('div');
this.appendChild(div);
this.updateConfig();
Expand Down Expand Up @@ -236,15 +236,15 @@ class ApexChartsWrapper extends PolymerElement {
if (this.theme) {
this.config.theme = JSON.parse(this.theme);
} else if (!this.config.fill || !this.config.fill.type || !Array.isArray(this.config.fill.type) || this.config.fill.type[0] !== "gradient") {
if (backgroundColor && this.color(backgroundColor)) {
if (backgroundColor && color(backgroundColor)) {
this.config.theme = {
mode: ((this.color(backgroundColor).lightness() > 0.5) ? 'light' : 'dark')
mode: ((color(backgroundColor).lightness() > 0.5) ? 'light' : 'dark')
};
}
if (!this.colors && primaryColor && this.color(primaryColor)) {
if (!this.colors && primaryColor && color(primaryColor)) {
this.config.theme.monochrome = {
enabled: true,
color: this.color(primaryColor).hex(),
color: color(primaryColor).hex(),
shadeTo: 'light',
shadeIntensity: 0.65
}
Expand Down Expand Up @@ -297,19 +297,19 @@ class ApexChartsWrapper extends PolymerElement {
if (this.height) {
this.config.chart.height = this.height;
}
if (!this.config.chart.background && backgroundColor && this.color(backgroundColor)) {
if (!this.config.chart.background && backgroundColor && color(backgroundColor)) {
this.config.chart.background = backgroundColor;
}
if (!this.config.stroke) {
this.config.stroke = {};
}
if (this.config.chart && this.config.chart.type === "radar") {
if (!this.config.plotOptions && backgroundColor && this.color(backgroundColor)) {
if (!this.config.plotOptions && backgroundColor && color(backgroundColor)) {
this.config.plotOptions = {
radar: {
polygons: {
fill: {
colors: [this.color(backgroundColor).hex()]
colors: [color(backgroundColor).hex()]
}
}
}
Expand Down