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

[GSF] Syncing Fork #2

Merged
merged 4 commits into from Jan 9, 2020
Merged
Show file tree
Hide file tree
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
21 changes: 11 additions & 10 deletions .github/workflows/release.yml
Expand Up @@ -7,19 +7,20 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@master

- name: Publish
- uses: actions/setup-node@master
with:
node-version: 12
registry-url: 'https://registry.npmjs.org/'
- name: Publish to NPMJS
run: |
npm install
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config set scope d3-stencil
npm config list
npm publish --access public
env:
CI: true
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

320 changes: 192 additions & 128 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "d3-stencil",
"private": false,
"version": "2.2.2",
"version": "2.2.1",
"description": "Charts built with D3 and Stencil. Framework-agnostic, simple.",
"homepage": "https://github.com/edgarordonez/d3-stencil",
"keywords": [
Expand Down Expand Up @@ -30,18 +30,18 @@
"circular": "npx madge -c --extensions ts ./src --ts-config ./tsconfig.json"
},
"dependencies": {
"d3": "^5.14.2",
"d3": "^5.15.0",
"object-assign-deep": "^0.4.0"
},
"devDependencies": {
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@stencil/core": "^1.8.1",
"@commitlint/cli": "^8.3.3",
"@commitlint/config-conventional": "^8.3.3",
"@stencil/core": "^1.8.3",
"@stencil/router": "1.0.1",
"@stencil/sass": "^1.1.1",
"@stencil/utils": "0.0.5",
"@types/d3": "^5.7.2",
"@types/jest": "24.0.23",
"@types/jest": "24.0.25",
"@types/puppeteer": "1.20.3",
"coveralls": "^3.0.9",
"cz-conventional-changelog": "^3.0.2",
Expand Down
1 change: 0 additions & 1 deletion readme.md
@@ -1,4 +1,3 @@
[![CircleCI](https://circleci.com/gh/edgarordonez/d3-stencil/tree/master.svg?style=svg)](https://circleci.com/gh/edgarordonez/d3-stencil/tree/master)
[![Coverage Status](https://coveralls.io/repos/github/edgarordonez/d3-stencil/badge.svg?branch=master)](https://coveralls.io/github/edgarordonez/d3-stencil?branch=master)

[![D3-Stencil](https://d3-stencil.dev/img/d3-stencil_logo_main.png)](https://d3-stencil.dev)
Expand Down
13 changes: 7 additions & 6 deletions src/components/bcg-matrix-chart/bcg-matrix-chart.tsx
Expand Up @@ -4,17 +4,17 @@ import { max } from 'd3-array';
import { ScaleLinear, scaleLinear } from 'd3-scale';
import { axisBottom, axisLeft } from 'd3-axis';
import { pack, hierarchy, HierarchyCircularNode } from 'd3-hierarchy';
import { BcgMatrix } from '../../interfaces/data-types';
import { Graph, GraphData } from '../../interfaces';
import { Resize } from '../../decorators';
import { Graph, GraphData } from '@interfaces/index';
import { BcgMatrix } from '@interfaces/data-types';
import { Resize } from '@decorators/index';
import {
initTooltipIfExists,
initLegendIfExists,
formatter,
circularFind,
objectAssignDeep,
} from '../../utils';
import { DEFAULT_GRAPH_DATA_BCG } from '../../shared';
} from '@utils/index';
import { DEFAULT_GRAPH_DATA_BCG } from '@shared/index';

@Component({
tag: 'bcg-matrix-chart',
Expand Down Expand Up @@ -67,7 +67,8 @@ export class BGCMatrixChart implements Graph<BcgMatrix[]> {
this.drawChart();
}

@Method() async updateGraphData(graphData: GraphData<BcgMatrix[]>) {
@Method()
async updateGraphData(graphData: GraphData<BcgMatrix[]>) {
this.graphDataMerged = objectAssignDeep(
{ ...DEFAULT_GRAPH_DATA_BCG },
graphData,
Expand Down
11 changes: 6 additions & 5 deletions src/components/horizontal-bar-chart/horizontal-bar-chart.tsx
Expand Up @@ -3,16 +3,16 @@ import { Selection, select, event } from 'd3-selection';
import { max } from 'd3-array';
import { ScaleBand, scaleBand, ScaleLinear, scaleLinear } from 'd3-scale';
import { axisBottom, axisLeft } from 'd3-axis';
import { Graph, GraphData } from '../../interfaces';
import { Resize } from '../../decorators';
import { Graph, GraphData } from '@interfaces/index';
import { Resize } from '@decorators/index';
import {
initTooltipIfExists,
initLegendIfExists,
formatter,
circularFind,
objectAssignDeep
} from '../../utils';
import { DEFAULT_GRAPH_DATA_BAR } from '../../shared';
} from '@utils/index';
import { DEFAULT_GRAPH_DATA_BAR } from '@shared/index';

@Component({
tag: 'horizontal-bar-chart',
Expand Down Expand Up @@ -50,7 +50,8 @@ export class HorizontalBarChart implements Graph<number[]> {
this.drawChart();
}

@Method() async updateGraphData(graphData: GraphData<number[]>): Promise<any> {
@Method()
async updateGraphData(graphData: GraphData<number[]>): Promise<any> {
this.graphDataMerged = objectAssignDeep(
{ ...DEFAULT_GRAPH_DATA_BAR },
graphData,
Expand Down
9 changes: 5 additions & 4 deletions src/components/legend-chart/legend-chart.tsx
@@ -1,8 +1,8 @@
import { Component, h, Element, Prop, Method } from '@stencil/core';
import { Selection, select, event } from 'd3-selection';
import { LegendData } from '../../interfaces';
import { objectAssignDeep, circularFind } from '../../utils';
import { DEFAULT_LEGEND_DATA } from '../../shared';
import { LegendData } from '@interfaces/index';
import { objectAssignDeep, circularFind } from '@utils/index';
import { DEFAULT_LEGEND_DATA } from '@shared/index';

@Component({
tag: 'legend-chart',
Expand Down Expand Up @@ -31,7 +31,8 @@ export class LegendChart {
: this.drawVerticalLegend();
}

@Method() async callOnClick(callOnClickChild: (data: { label: string; index: number }) => any, ): Promise<any> {
@Method()
async callOnClick(callOnClickChild: (data: { label: string; index: number }) => any, ): Promise<any> {
this._callOnClick = callOnClickChild;
}

Expand Down
11 changes: 6 additions & 5 deletions src/components/line-annotations-chart/line-annotations-chart.tsx
@@ -1,10 +1,10 @@
import { Component, h, Element, Prop, Method, Listen } from '@stencil/core';
import { Selection, select, event } from 'd3-selection';
import { ScaleOrdinal, scaleOrdinal } from 'd3-scale';
import { Resize } from '../../decorators';
import { objectAssignDeep } from '../../utils';
import { Graph, GraphData } from '../../interfaces';
import { DEFAULT_GRAPH_DATA_ANNOTATIONS_LINE } from '../../shared';
import { Resize } from '@decorators/index';
import { objectAssignDeep } from '@utils/index';
import { Graph, GraphData } from '@interfaces/index';
import { DEFAULT_GRAPH_DATA_ANNOTATIONS_LINE } from '@shared/index';

@Component({
tag: 'line-annotations-chart',
Expand Down Expand Up @@ -33,7 +33,8 @@ export class LineAnnotationsChart implements Graph {
);
}

@Method() async updateGraphData(graphData: GraphData): Promise<any> {
@Method()
async updateGraphData(graphData: GraphData): Promise<any> {
this.graphDataMerged = objectAssignDeep(
{ ...DEFAULT_GRAPH_DATA_ANNOTATIONS_LINE },
graphData
Expand Down
11 changes: 6 additions & 5 deletions src/components/line-chart/line-chart.tsx
Expand Up @@ -12,16 +12,16 @@ import { max } from 'd3-array';
import { ScaleOrdinal, scaleOrdinal, ScaleLinear, scaleLinear } from 'd3-scale';
import { axisBottom, axisLeft } from 'd3-axis';
import { Line, line } from 'd3-shape';
import { Graph, GraphMeta, GraphData } from '../../interfaces';
import { Resize } from '../../decorators';
import { Graph, GraphMeta, GraphData } from '@interfaces/index';
import { Resize } from '@decorators/index';
import {
initTooltipIfExists,
initLegendIfExists,
formatter,
circularFind,
objectAssignDeep,
} from '../../utils';
import { DEFAULT_GRAPH_DATA_LINE } from '../../shared';
} from '@utils/index';
import { DEFAULT_GRAPH_DATA_LINE } from '@shared/index';

@Component({
tag: 'line-chart',
Expand Down Expand Up @@ -69,7 +69,8 @@ export class LineChart implements Graph {
this.handleOnRenderized();
}

@Method() async updateGraphData(graphData: GraphData): Promise<any> {
@Method()
async updateGraphData(graphData: GraphData): Promise<any> {
this.graphDataMerged = objectAssignDeep(
{ ...DEFAULT_GRAPH_DATA_LINE },
graphData,
Expand Down
11 changes: 6 additions & 5 deletions src/components/pie-chart/pie-chart.tsx
@@ -1,16 +1,16 @@
import { Component, h, Element, Prop, Method, State } from '@stencil/core';
import { Selection, select, event } from 'd3-selection';
import { Arc, arc, PieArcDatum, pie } from 'd3-shape';
import { Graph, GraphData } from '../../interfaces';
import { Resize } from '../../decorators';
import { Graph, GraphData } from '@interfaces/index';
import { Resize } from '@decorators/index';
import {
initTooltipIfExists,
initLegendIfExists,
formatter,
circularFind,
objectAssignDeep,
} from '../../utils';
import { DEFAULT_GRAPH_DATA_PIE } from '../../shared';
} from '@utils/index';
import { DEFAULT_GRAPH_DATA_PIE } from '@shared/index';

@Component({
tag: 'pie-chart',
Expand Down Expand Up @@ -53,7 +53,8 @@ export class PieChart implements Graph<number[]> {
this.drawChart();
}

@Method() async updateGraphData(graphData: GraphData<number[]>): Promise<any> {
@Method()
async updateGraphData(graphData: GraphData<number[]>): Promise<any> {
this.graphDataMerged = objectAssignDeep(
{ ...DEFAULT_GRAPH_DATA_PIE },
graphData,
Expand Down
9 changes: 6 additions & 3 deletions src/components/tooltip-chart/tooltip-chart.tsx
Expand Up @@ -11,20 +11,23 @@ export class TooltipChart {
@Element() tooltipEl: HTMLElement;
_tooltip: Selection<any, any, any, any>;

@Method() async tooltip(tooltip: any): Promise<any> {
@Method()
async tooltip(tooltip: any): Promise<any> {
this._tooltip = select(tooltip);
this._tooltip.style('text-align', this.align);
}

@Method() async show(message: string, positions: number[]): Promise<any> {
@Method()
async show(message: string, positions: number[]): Promise<any> {
this._tooltip.transition(transition().duration(200)).style('opacity', 0.9);
this._tooltip
.html(message)
.style('left', `${positions[0]}px`)
.style('top', `${positions[1] - 38}px`);
}

@Method() async hide(): Promise<any> {
@Method()
async hide(): Promise<any> {
this._tooltip.transition(transition().duration(500)).style('opacity', 0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/decorators/resize.ts
@@ -1,4 +1,4 @@
import { GraphMeta } from '../interfaces';
import { GraphMeta } from '@interfaces/index';

const resize = (graph: { axisData: boolean } = { axisData: false }) => {
const getAxisData = (
Expand Down
4 changes: 2 additions & 2 deletions src/index.d.ts
Expand Up @@ -6,7 +6,7 @@ export {
LegendData,
Formats,
HasData,
} from './interfaces';
} from '@interfaces/index';
export {
BcgMatrix,
} from './interfaces/data-types';
} from '@interfaces/data-types';
8 changes: 4 additions & 4 deletions src/interfaces/graph-data.ts
@@ -1,13 +1,13 @@
import { Data } from './data-types';
import { Styles } from './options-types';
import { HasData } from './has-data';
import { Data } from '@interfaces/data-types';
import { Styles } from '@interfaces/options-types';
import { HasData } from '@interfaces/has-data';
import {
PieChart,
BarChart,
LineChart,
LineAnnotationsChart,
BcgMatrixChart,
} from './charts-options';
} from '@interfaces/charts-options';

export type GraphData<T = number[][]> = Partial<{
pieChart: PieChart;
Expand Down
6 changes: 3 additions & 3 deletions src/shared/default-graph-data.ts
@@ -1,10 +1,10 @@
import { BcgMatrix } from '../interfaces/data-types';
import { GraphData, LegendData } from '../interfaces';
import { GraphData, LegendData } from '@interfaces/index';
import { BcgMatrix } from '@interfaces/data-types';
import {
hasDataIsNotEmpty,
hasDataBCGMatrixIsNotEmpty,
hasDataValidOnAnnotationsChart,
} from '../utils';
} from '@utils/index';

export const DEFAULT_GRAPH_DATA_PIE: GraphData = {
pieChart: {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/formats.ts
@@ -1,6 +1,6 @@
import { format } from 'd3-format';
import { timeFormat } from 'd3-time-format';
import { Formats } from '../interfaces';
import { Formats } from '@interfaces/index';
import { currencyFormatter } from './currency-formatter';

const formats: {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/formatter.ts
@@ -1,4 +1,4 @@
import { Formats as FORMATS } from '../interfaces';
import { Formats as FORMATS } from '@interfaces/index';
import { Formats } from './formats';

export const formatter = (
Expand Down
4 changes: 2 additions & 2 deletions src/utils/has-data.ts
@@ -1,5 +1,5 @@
import { GraphData, HasData } from '../interfaces';
import { BcgMatrix } from '../interfaces/data-types';
import { GraphData, HasData } from '@interfaces/index';
import { BcgMatrix } from '@interfaces/data-types';

const THROW_ERROR = (): Error => {
throw new Error(`The data injected isn't valid.`);
Expand Down
10 changes: 8 additions & 2 deletions tsconfig.json
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"baseUrl": ".",
"rootDir": "src",
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"declaration": false,
Expand All @@ -14,7 +13,14 @@
"noUnusedParameters": true,
"jsx": "react",
"jsxFactory": "h",
"skipLibCheck": true
"skipLibCheck": true,
"paths": {
"@components/*": ["src/components/*"],
"@decorators/*": ["src/decorators/*"],
"@interfaces/*": ["src/interfaces/*"],
"@shared/*": ["src/shared/*"],
"@utils/*": ["src/utils/*"]
}
},
"include": ["./**/*", "types/jsx.d.ts"],
"exclude": ["docs", "node_modules"]
Expand Down