From 115ff225509a94760e709c543629d7f4e4a2a365 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 12 Feb 2024 02:30:08 +0800 Subject: [PATCH 01/36] refactor: update types.d.ts path --- package.json | 6 +++--- src/CalHeatmap.ts | 4 ++-- src/DataFetcher.ts | 2 +- src/TemplateCollection.ts | 2 +- src/calendar/CalendarPainter.ts | 2 +- src/calendar/DomainCollection.ts | 2 +- src/calendar/Navigator.ts | 2 +- src/calendar/Populator.ts | 2 +- src/domain/DomainCoordinates.ts | 2 +- src/domain/DomainLabelPainter.ts | 2 +- src/domain/DomainPainter.ts | 2 +- src/domain/DomainsContainerPainter.ts | 2 +- src/helpers/DateHelper.ts | 2 +- src/options/Options.ts | 2 +- src/options/OptionsValidator.ts | 2 +- src/scale.ts | 2 +- src/subDomain/SubDomainPainter.ts | 2 +- src/templates/day.ts | 2 +- src/templates/ghDay.ts | 2 +- src/templates/hour.ts | 2 +- src/templates/minute.ts | 2 +- src/templates/month.ts | 2 +- src/templates/week.ts | 2 +- src/templates/xDay.ts | 2 +- src/templates/year.ts | 2 +- src/{types/index.d.ts => types.d.ts} | 4 ++-- test/TemplateCollection.test.ts | 2 +- test/fixtures/quarterTemplate.ts | 2 +- test/helpers/DateHelper.test.ts | 2 +- test/options/OptionsValidator.test.ts | 2 +- 30 files changed, 34 insertions(+), 34 deletions(-) rename src/{types/index.d.ts => types.d.ts} (95%) diff --git a/package.json b/package.json index 5c3bf34f..1efe7cfa 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ ".": { "import": "./dist/cal-heatmap.esm.js", "require": "./dist/cal-heatmap.js", - "types": "./src/types/index.d.ts" + "types": "./src/types.d.ts" }, "./package.json": "./package.json", "./cal-heatmap.css": "./dist/cal-heatmap.css", @@ -41,7 +41,7 @@ "directories": { "test": "test" }, - "types": "./src/types/index.d.ts", + "types": "./src/types.d.ts", "node": ">=14.16", "browserslist": "last 2 versions, not dead, > 0.2%", "dependencies": { @@ -127,7 +127,7 @@ ], "files": [ "dist", - "src/types" + "src/types.d.ts" ], "config": { "commitizen": { diff --git a/src/CalHeatmap.ts b/src/CalHeatmap.ts index 203584c8..a41dc18d 100755 --- a/src/CalHeatmap.ts +++ b/src/CalHeatmap.ts @@ -25,12 +25,12 @@ import type { PluginDefinition, Timestamp, DeepPartial, -} from './types/index'; +} from './types'; import { ScrollDirection } from './constant'; export default class CalHeatmap { - static VERSION = VERSION; + static readonly VERSION = VERSION; options: Options; diff --git a/src/DataFetcher.ts b/src/DataFetcher.ts index 54aee7e1..57d54e8e 100644 --- a/src/DataFetcher.ts +++ b/src/DataFetcher.ts @@ -3,7 +3,7 @@ import { } from 'd3-fetch'; import type { DataOptions, DataRecord } from './options/Options'; -import type { Timestamp } from './types/index'; +import type { Timestamp } from './types'; import type CalHeatmap from './CalHeatmap'; export default class DataFetcher { diff --git a/src/TemplateCollection.ts b/src/TemplateCollection.ts index 55f2a15d..323ad7c6 100644 --- a/src/TemplateCollection.ts +++ b/src/TemplateCollection.ts @@ -2,7 +2,7 @@ import castArray from 'lodash-es/castArray'; import DefaultTemplates from './templates/index'; import type Options from './options/Options'; -import type { Template, TemplateResult } from './types/index'; +import type { Template, TemplateResult } from './types'; import type DateHelper from './helpers/DateHelper'; export default class TemplateCollection { diff --git a/src/calendar/CalendarPainter.ts b/src/calendar/CalendarPainter.ts index 1d50ba27..f89102b6 100644 --- a/src/calendar/CalendarPainter.ts +++ b/src/calendar/CalendarPainter.ts @@ -5,7 +5,7 @@ import PluginPainter from '../plugins/PluginPainter'; import type CalHeatmap from '../CalHeatmap'; import { ScrollDirection } from '../constant'; -import type { Dimensions } from '../types/index'; +import type { Dimensions } from '../types'; export const DEFAULT_SELECTOR = '.ch-container'; diff --git a/src/calendar/DomainCollection.ts b/src/calendar/DomainCollection.ts index ae375cdc..d8466164 100644 --- a/src/calendar/DomainCollection.ts +++ b/src/calendar/DomainCollection.ts @@ -1,6 +1,6 @@ import castArray from 'lodash-es/castArray'; -import type { SubDomain, DomainType, Timestamp } from '../types/index'; +import type { SubDomain, DomainType, Timestamp } from '../types'; import type { DataOptions, DataGroupType, diff --git a/src/calendar/Navigator.ts b/src/calendar/Navigator.ts index 56689d9d..a8ccca7c 100644 --- a/src/calendar/Navigator.ts +++ b/src/calendar/Navigator.ts @@ -2,7 +2,7 @@ import { ScrollDirection } from '../constant'; import type CalHeatmap from '../CalHeatmap'; import type DomainCollection from './DomainCollection'; -import type { Timestamp } from '../types/index'; +import type { Timestamp } from '../types'; export default class Navigator { calendar: CalHeatmap; diff --git a/src/calendar/Populator.ts b/src/calendar/Populator.ts index 523a8ee3..cd966ca1 100644 --- a/src/calendar/Populator.ts +++ b/src/calendar/Populator.ts @@ -3,7 +3,7 @@ import { hcl } from 'd3-color'; import { normalizedScale, applyScaleStyle } from '../scale'; import type CalHeatmap from '../CalHeatmap'; -import type { SubDomain, Timestamp } from '../types/index'; +import type { SubDomain, Timestamp } from '../types'; export default class Populator { calendar: CalHeatmap; diff --git a/src/domain/DomainCoordinates.ts b/src/domain/DomainCoordinates.ts index 4bca7d4a..a2d2ff7e 100644 --- a/src/domain/DomainCoordinates.ts +++ b/src/domain/DomainCoordinates.ts @@ -4,7 +4,7 @@ import { horizontalPadding, verticalPadding } from '../helpers/PositionHelper'; import type CalHeatmap from '../CalHeatmap'; import type DomainPainter from './DomainPainter'; import type DomainCollection from '../calendar/DomainCollection'; -import type { SubDomain, Dimensions, Timestamp } from '../types/index'; +import type { SubDomain, Dimensions, Timestamp } from '../types'; type SubDomainWithCoordinates = Required & { pre_x: number; diff --git a/src/domain/DomainLabelPainter.ts b/src/domain/DomainLabelPainter.ts index e93b2883..f3e884cf 100644 --- a/src/domain/DomainLabelPainter.ts +++ b/src/domain/DomainLabelPainter.ts @@ -7,7 +7,7 @@ import { import { DOMAIN_FORMAT } from '../calendar/DomainCollection'; import type CalHeatmap from '../CalHeatmap'; -import type { Timestamp } from '../types/index'; +import type { Timestamp } from '../types'; const DEFAULT_SELECTOR = '.ch-domain-text'; diff --git a/src/domain/DomainPainter.ts b/src/domain/DomainPainter.ts index 10010d20..6a46e5fc 100644 --- a/src/domain/DomainPainter.ts +++ b/src/domain/DomainPainter.ts @@ -2,7 +2,7 @@ import DomainCoordinates from './DomainCoordinates'; import type CalHeatmap from '../CalHeatmap'; import type { ScrollDirection } from '../constant'; -import type { Dimensions, Timestamp } from '../types/index'; +import type { Dimensions, Timestamp } from '../types'; const DEFAULT_SELECTOR = '.ch-domain'; diff --git a/src/domain/DomainsContainerPainter.ts b/src/domain/DomainsContainerPainter.ts index af84161c..76db8f61 100644 --- a/src/domain/DomainsContainerPainter.ts +++ b/src/domain/DomainsContainerPainter.ts @@ -5,7 +5,7 @@ import SubDomainPainter from '../subDomain/SubDomainPainter'; import { ScrollDirection } from '../constant'; import type CalHeatmap from '../CalHeatmap'; -import type { Dimensions } from '../types/index'; +import type { Dimensions } from '../types'; const BASE_SELECTOR = '.ch-domain-container'; const TRANSITION_CLASSNAME = 'in-transition'; diff --git a/src/helpers/DateHelper.ts b/src/helpers/DateHelper.ts index 93a5a168..8f95cbdd 100644 --- a/src/helpers/DateHelper.ts +++ b/src/helpers/DateHelper.ts @@ -15,7 +15,7 @@ import updateLocale from 'dayjs/plugin/updateLocale'; import type { ManipulateType, PluginFunc, Ls } from 'dayjs'; import type { OptionsType } from '../options/Options'; -import type { Timestamp, DomainType } from '../types/index'; +import type { Timestamp, DomainType } from '../types'; dayjs.extend(weekOfYear); dayjs.extend(isoWeeksInYear); diff --git a/src/options/Options.ts b/src/options/Options.ts index 124cb33d..56199cb5 100644 --- a/src/options/Options.ts +++ b/src/options/Options.ts @@ -4,7 +4,7 @@ import has from 'lodash-es/has'; import get from 'lodash-es/get'; import set from 'lodash-es/set'; import type { Ls } from 'dayjs'; -import type { DeepPartial, DomainType, Timestamp } from '../types/index'; +import type { DeepPartial, DomainType, Timestamp } from '../types'; import { OPTIONS_DEFAULT_DOMAIN_TYPE, OPTIONS_DEFAULT_SUBDOMAIN_TYPE, diff --git a/src/options/OptionsValidator.ts b/src/options/OptionsValidator.ts index 97648d8a..15f44456 100644 --- a/src/options/OptionsValidator.ts +++ b/src/options/OptionsValidator.ts @@ -1,6 +1,6 @@ import type TemplateCollection from '../TemplateCollection'; import type { DomainOptions, SubDomainOptions, DataOptions } from './Options'; -import type { DomainType } from '../types/index'; +import type { DomainType } from '../types'; const ALLOWED_DATA_TYPES = ['json', 'csv', 'tsv', 'txt']; diff --git a/src/scale.ts b/src/scale.ts index bc5f58fc..f16ba2d0 100644 --- a/src/scale.ts +++ b/src/scale.ts @@ -3,7 +3,7 @@ import { scale } from '@observablehq/plot'; import { OptionsType } from './options/Options'; import { SCALE_BASE_OPACITY_COLOR } from './constant'; -import type { SubDomain } from './types/index'; +import type { SubDomain } from './types'; type ValueType = string | number | undefined; diff --git a/src/subDomain/SubDomainPainter.ts b/src/subDomain/SubDomainPainter.ts index e4147144..5eae1cd4 100644 --- a/src/subDomain/SubDomainPainter.ts +++ b/src/subDomain/SubDomainPainter.ts @@ -1,6 +1,6 @@ import { Position } from '../constant'; import type CalHeatmap from '../CalHeatmap'; -import type { Timestamp, SubDomain } from '../types/index'; +import type { Timestamp, SubDomain } from '../types'; export const DEFAULT_SELECTOR = '.ch-subdomain'; const HIGHLIGHT_CLASSNAME = 'highlight'; diff --git a/src/templates/day.ts b/src/templates/day.ts index 626912aa..0103133d 100644 --- a/src/templates/day.ts +++ b/src/templates/day.ts @@ -1,5 +1,5 @@ import type { OptionsType, DomainOptions } from '../options/Options'; -import type { Template, DomainType } from '../types/index'; +import type { Template, DomainType } from '../types'; const dayTemplate: Template = ( DateHelper, diff --git a/src/templates/ghDay.ts b/src/templates/ghDay.ts index 641a011d..acb4bb58 100644 --- a/src/templates/ghDay.ts +++ b/src/templates/ghDay.ts @@ -1,4 +1,4 @@ -import type { Template, DomainType } from '../types/index'; +import type { Template, DomainType } from '../types'; const dayTemplate: Template = (DateHelper) => { const ROWS_COUNT = 7; diff --git a/src/templates/hour.ts b/src/templates/hour.ts index afdfcad3..319bdaab 100644 --- a/src/templates/hour.ts +++ b/src/templates/hour.ts @@ -1,5 +1,5 @@ import type { DomainOptions } from '../options/Options'; -import type { Template, DomainType } from '../types/index'; +import type { Template, DomainType } from '../types'; const hourTemplate: Template = ( DateHelper, diff --git a/src/templates/minute.ts b/src/templates/minute.ts index d45d50f1..0e171816 100644 --- a/src/templates/minute.ts +++ b/src/templates/minute.ts @@ -1,4 +1,4 @@ -import type { Template, DomainType } from '../types/index'; +import type { Template, DomainType } from '../types'; const minuteTemplate: Template = (DateHelper) => { const COLUMNS_COUNT = 10; diff --git a/src/templates/month.ts b/src/templates/month.ts index 2d2912be..5c5e3e0f 100644 --- a/src/templates/month.ts +++ b/src/templates/month.ts @@ -1,4 +1,4 @@ -import type { Template, DomainType } from '../types/index'; +import type { Template, DomainType } from '../types'; const monthTemplate: Template = (DateHelper) => { const ALLOWED_DOMAIN_TYPE: DomainType[] = ['year']; diff --git a/src/templates/week.ts b/src/templates/week.ts index 0c2fc51e..aaaf7ee2 100644 --- a/src/templates/week.ts +++ b/src/templates/week.ts @@ -1,5 +1,5 @@ import type { DomainOptions } from '../options/Options'; -import type { Template, DomainType } from '../types/index'; +import type { Template, DomainType } from '../types'; const weekTemplate: Template = ( DateHelper, diff --git a/src/templates/xDay.ts b/src/templates/xDay.ts index 57ce1fe3..c1fe5bda 100644 --- a/src/templates/xDay.ts +++ b/src/templates/xDay.ts @@ -1,5 +1,5 @@ import type { OptionsType, DomainOptions } from '../options/Options'; -import type { Template, DomainType } from '../types/index'; +import type { Template, DomainType } from '../types'; const dayTemplate: Template = ( DateHelper, diff --git a/src/templates/year.ts b/src/templates/year.ts index f41e6d34..c73ae9fd 100644 --- a/src/templates/year.ts +++ b/src/templates/year.ts @@ -1,4 +1,4 @@ -import type { Template, DomainType } from '../types/index'; +import type { Template, DomainType } from '../types'; const yearTemplate: Template = (DateHelper) => { const ALLOWED_DOMAIN_TYPE: DomainType[] = []; diff --git a/src/types/index.d.ts b/src/types.d.ts similarity index 95% rename from src/types/index.d.ts rename to src/types.d.ts index 1b4c9dff..bf6e746c 100644 --- a/src/types/index.d.ts +++ b/src/types.d.ts @@ -1,8 +1,8 @@ import type { PluginFunc } from 'dayjs'; import type dayjs from 'dayjs'; -import type { OptionsType } from '../options/Options'; -import type DateHelper from '../helpers/DateHelper'; +import type { OptionsType } from './options/Options'; +import type DateHelper from './helpers/DateHelper'; export type Timestamp = number; export type DomainType = diff --git a/test/TemplateCollection.test.ts b/test/TemplateCollection.test.ts index dc27ea47..3a6a800c 100644 --- a/test/TemplateCollection.test.ts +++ b/test/TemplateCollection.test.ts @@ -1,7 +1,7 @@ import TemplateCollection from '../src/TemplateCollection'; import DateHelper from '../src/helpers/DateHelper'; import Options from '../src/options/Options'; -import type { TemplateResult } from '../src/types/index'; +import type { TemplateResult } from '../src/types'; describe('TemplateCollection', () => { let t: TemplateCollection; diff --git a/test/fixtures/quarterTemplate.ts b/test/fixtures/quarterTemplate.ts index 3f52e6f8..3c3fa2c5 100644 --- a/test/fixtures/quarterTemplate.ts +++ b/test/fixtures/quarterTemplate.ts @@ -1,6 +1,6 @@ import type { OpUnitType } from 'dayjs'; import type DateHelper from '../../src/helpers/DateHelper'; -import type { DomainType } from '../../src/types/index'; +import type { DomainType } from '../../src/types'; const quarterTemplate = (DateHelper: DateHelper) => ({ name: 'quarter', diff --git a/test/helpers/DateHelper.test.ts b/test/helpers/DateHelper.test.ts index 1256a1dd..d9ca083f 100644 --- a/test/helpers/DateHelper.test.ts +++ b/test/helpers/DateHelper.test.ts @@ -6,7 +6,7 @@ import DateHelper from '../../src/helpers/DateHelper'; import weekData from '../fixtures/weekNumberDates'; import dates from '../fixtures/dates'; import Options from '../../src/options/Options'; -import type { DomainType } from '../../src/types/index'; +import type { DomainType } from '../../src/types'; const date = new Date('2020-01-02T04:24:25.256+00:00'); const DEFAULT_LOCALE = 'en'; diff --git a/test/options/OptionsValidator.test.ts b/test/options/OptionsValidator.test.ts index 5a640d5e..48b73415 100644 --- a/test/options/OptionsValidator.test.ts +++ b/test/options/OptionsValidator.test.ts @@ -2,7 +2,7 @@ import validate from '../../src/options/OptionsValidator'; import TemplateCollection from '../../src/TemplateCollection'; import Options from '../../src/options/Options'; -import type { TemplateResult } from '../../src/types/index'; +import type { TemplateResult } from '../../src/types'; import DateHelper from '../../src/helpers/DateHelper'; describe('OptionsValidator', () => { From 556b372377fc2c7c3e3422c9184c5ad97d9327aa Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 12 Feb 2024 02:31:23 +0800 Subject: [PATCH 02/36] refactoring: remove all plugins --- CHANGELOG.md | 6 +- index.js | 5 +- package-lock.json | 10 -- rollup.config.js | 16 +- src/cal-heatmap.scss | 67 --------- src/plugins/CalendarLabel.ts | 216 --------------------------- src/plugins/Legend.ts | 86 ----------- src/plugins/LegendLite.ts | 145 ------------------ src/plugins/PluginManager.ts | 2 +- src/plugins/Tooltip.ts | 180 ---------------------- src/types/plugins/CalendarLabel.d.ts | 36 ----- src/types/plugins/Legend.d.ts | 27 ---- src/types/plugins/LegendLite.d.ts | 30 ---- src/types/plugins/Tooltip.d.ts | 33 ---- test/e2e/index-d3v6-umd.html | 5 - test/e2e/index-d3v7-esm.html | 18 +-- test/e2e/index-d3v7-umd.html | 5 - test/frontend/export.js | 4 - test/frontend/legend.js | 148 ------------------ test/frontend/tooltip.js | 125 ---------------- 20 files changed, 11 insertions(+), 1153 deletions(-) delete mode 100644 src/plugins/CalendarLabel.ts delete mode 100644 src/plugins/Legend.ts delete mode 100644 src/plugins/LegendLite.ts delete mode 100644 src/plugins/Tooltip.ts delete mode 100644 src/types/plugins/CalendarLabel.d.ts delete mode 100644 src/types/plugins/Legend.d.ts delete mode 100644 src/types/plugins/LegendLite.d.ts delete mode 100644 src/types/plugins/Tooltip.d.ts delete mode 100644 test/frontend/legend.js delete mode 100644 test/frontend/tooltip.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 50bd02e2..624a1ec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -## v4.2.4 [2023-12-29] +## v4.3.0 [] + +### BREAKING CHANGES + +- [refactor] - Move all plugins to their own repositories in https://github.com/cal-heatmap/ ### Fixes diff --git a/index.js b/index.js index a839edf0..ceba74ed 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,4 @@ import CalHeatmap from './src/CalHeatmap'; -import Tooltip from './src/plugins/Tooltip'; -import Legend from './src/plugins/Legend'; -import LegendLite from './src/plugins/LegendLite'; import VERSION from './src/version'; -export { CalHeatmap as default, Tooltip, Legend, LegendLite, VERSION }; \ No newline at end of file +export { CalHeatmap as default, VERSION }; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 415bb266..a1bfdc98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "MIT", "dependencies": { "@observablehq/plot": "^0.6.0", - "@popperjs/core": "^2.11.6", "core-js": "^3.35.1", "d3-color": "^3.1.0", "d3-fetch": "^3.0.1", @@ -3441,15 +3440,6 @@ "node": ">=14" } }, - "node_modules/@popperjs/core": { - "version": "2.11.8", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", - "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/popperjs" - } - }, "node_modules/@puppeteer/browsers": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.0.0.tgz", diff --git a/rollup.config.js b/rollup.config.js index 89950359..64835f4a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -53,12 +53,10 @@ writeFileSync( ); const globals = { - '@popperjs/core': 'Popper', 'd3-selection': 'd3', d3: 'd3', 'd3-color': 'd3', 'd3-fetch': 'd3', - 'd3-selection': 'd3', 'd3-transition': 'd3', }; @@ -127,17 +125,5 @@ export default [ 'd3-selection', 'd3-transition', ], - }), - ...exportConfig('src/plugins/Tooltip.ts', 'Tooltip', 'plugins/Tooltip', { - external: ['@popperjs/core'], - }), - ...exportConfig('src/plugins/Legend.ts', 'Legend', 'plugins/Legend', { - external: ['d3-selection', 'd3'], - }), - ...exportConfig('src/plugins/LegendLite.ts', 'LegendLite', 'plugins/LegendLite', { - external: ['d3-selection', 'd3'], - }), - ...exportConfig('src/plugins/CalendarLabel.ts', 'CalendarLabel', 'plugins/CalendarLabel', { - external: ['d3-selection', 'd3'], - }), + }) ]; diff --git a/src/cal-heatmap.scss b/src/cal-heatmap.scss index 2e48aeef..83f1b6c0 100644 --- a/src/cal-heatmap.scss +++ b/src/cal-heatmap.scss @@ -66,70 +66,3 @@ } } } - -#ch-plugin-legend { - > svg { - background: transparent; - color: currentColor; - } -} - -#ch-tooltip { - $arrow-size: 8px; - - padding: 5px 10px; - background: #222; - color: #bbb; - font-size: 12px; - line-height: 1.4; - text-align: center; - border-radius: 2px; - box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2); - display: none; - box-sizing: border-box; - - &[data-show] { - display: block; - } - - &-arrow, - &-arrow::before { - background: inherit; - width: $arrow-size; - height: $arrow-size; - position: absolute; - } - - &-arrow { - visibility: hidden; - } - - &-arrow::before { - visibility: visible; - content: ''; - transform: rotate(45deg); - } - - &[data-popper-placement^='top'] > &-arrow { - bottom: calc($arrow-size / -2); - margin-left: calc($arrow-size / -2); - } - - &[data-popper-placement^='bottom'] > &-arrow { - top: calc($arrow-size / -2); - margin-left: calc($arrow-size / -2); - } - - &[data-popper-placement^='left'] > &-arrow { - right: calc($arrow-size / -2); - } - - &[data-popper-placement^='right'] > &-arrow { - left: calc($arrow-size / -2); - } - - &[data-theme='dark'] { - background: #636e7b; - color: #cdd9e5; - } -} diff --git a/src/plugins/CalendarLabel.ts b/src/plugins/CalendarLabel.ts deleted file mode 100644 index e8ef2992..00000000 --- a/src/plugins/CalendarLabel.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { Position } from '../constant'; -import { - isHorizontal, - isVertical, - horizontalPadding, - verticalPadding, -} from '../helpers/PositionHelper'; - -import type CalHeatmap from '../CalHeatmap'; -import type { - // eslint-disable-next-line import/no-named-default - default as ICalendarLabel, - ComputedOptions, - CalendarLabelOptions, -} from '../types/plugins/CalendarLabel'; - -const DEFAULT_SELECTOR = '.ch-plugin-calendar-label'; - -const defaultOptions: CalendarLabelOptions = { - enabled: true, - - dimensions: { - width: 0, - height: 0, - }, - - position: 'left', - - text: () => [], - - padding: [0, 0, 0, 0], -}; - -export default class CalendarLabel implements ICalendarLabel { - name = 'CalendarLabel'; - - calendar: CalHeatmap; - - root: any; - - shown: boolean; - - options: CalendarLabelOptions; - - computedOptions: ComputedOptions; - - constructor(calendar: CalHeatmap) { - const subDomain = calendar?.options?.options?.subDomain; - - this.calendar = calendar; - this.root = null; - this.shown = false; - this.options = defaultOptions; - this.computedOptions = { - radius: subDomain?.radius, - width: subDomain?.width, - height: subDomain?.height, - gutter: subDomain?.gutter, - textAlign: 'start', - }; - } - - setup(pluginOptions?: Partial): void { - this.options = { ...defaultOptions, ...pluginOptions }; - } - - paint(): Promise { - const { enabled } = this.options; - - if (!enabled) { - return this.destroy(); - } - - this.shown = true; - - const calendarRoot = this.calendar.calendarPainter.root; - - if (!this.root) { - this.root = calendarRoot - .append('svg') - .attr('class', DEFAULT_SELECTOR.slice(1)) - .attr('data-key', this.options.key) - .attr('x', 0) - .attr('y', 0); - } - - this.build(); - - return Promise.resolve(); - } - - destroy(): Promise { - if (this.root !== null) { - this.root.remove(); - this.root = null; - } - - return Promise.resolve(); - } - - build() { - this.#buildComputedOptions(); - this.#computeDimensions(); - - this.root - .selectAll('g') - .data(this.options.text) - .join((enter: any) => enter - .append('g') - .call((selection: any) => selection - .append('rect') - .attr('class', `${DEFAULT_SELECTOR.slice(1)}-bg`) - .attr('style', 'fill: transparent') - .call((s: any) => this.#setRectAttr(s))) - .call((selection: any) => selection - .append('text') - .attr('class', `${DEFAULT_SELECTOR.slice(1)}-text`) - .attr('dominant-baseline', 'central') - .attr('text-anchor', 'middle') - .attr('style', 'fill: currentColor; font-size: 10px') - .call((s: any) => this.#setTextAttr(s)))); - - return Promise.resolve(); - } - - #buildComputedOptions() { - Object.keys(this.computedOptions).forEach((key: string) => { - if (typeof this.options[key as keyof ComputedOptions] !== 'undefined') { - // @ts-ignore - this.computedOptions[key] = this.options[key]; - } - }); - } - - /** - * Compute the total dimension of the current plugin - */ - #computeDimensions(): void { - const { width, height, gutter } = this.computedOptions; - const { text, padding, position } = this.options; - const labelsCount = text().length; - - this.options.dimensions = { - width: width + horizontalPadding(padding), - height: height + verticalPadding(padding), - }; - - if (isVertical(position!)) { - this.options.dimensions.width += (width + gutter) * (labelsCount - 1); - } else { - this.options.dimensions.height += (height + gutter) * (labelsCount - 1); - } - } - - #setRectAttr(selection: any) { - const { width, height, radius } = this.computedOptions; - - selection - .attr('width', width) - .attr('height', height) - .attr('rx', radius && radius > 0 ? radius : null) - .attr('ry', radius && radius > 0 ? radius : null) - .attr('x', (_d: string, i: number) => this.#getX(i)) - .attr('y', (_d: string, i: number) => this.#getY(i)); - } - - #setTextAttr(selection: any): void { - const { height, textAlign } = this.computedOptions; - - selection - .attr('text-anchor', textAlign) - .attr( - 'x', - (_d: string, i: number) => this.#getTextXOffset() + this.#getX(i), - ) - .attr('y', (_d: string, i: number) => this.#getY(i) + height! / 2) - .text((data: string) => data); - } - - #getTextXOffset() { - const { width, textAlign } = this.computedOptions; - - switch (textAlign) { - case 'start': - return 0; - case 'middle': - return width / 2; - case 'end': - return width; - default: - return 0; - } - } - - #getX(index: number) { - const { position, padding } = this.options; - const { width, gutter } = this.computedOptions; - - if (isHorizontal(position!)) { - return padding[Position.LEFT]; - } - - return padding[Position.LEFT] + (width + gutter) * index; - } - - #getY(index: number) { - const { position, padding } = this.options; - const { height, gutter } = this.computedOptions; - - if (isVertical(position!)) { - return padding[Position.TOP]; - } - - return padding[Position.TOP] + (height + gutter) * index; - } -} diff --git a/src/plugins/Legend.ts b/src/plugins/Legend.ts deleted file mode 100644 index a20f07d6..00000000 --- a/src/plugins/Legend.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { select } from 'd3-selection'; -import { legend } from '@observablehq/plot'; - -import type CalHeatmap from '../CalHeatmap'; -import type { - // eslint-disable-next-line import/no-named-default - default as ILegend, - LegendOptions, -} from '../types/plugins/Legend'; - -const DEFAULT_SELECTOR = '#ch-plugin-legend'; - -const defaultOptions: LegendOptions = { - // Whether to display the legend - enabled: true, - - itemSelector: null, - - label: null, - - width: 130, -}; - -export default class Legend implements ILegend { - name = 'Legend'; - - calendar: CalHeatmap; - - root: any; - - shown: boolean; - - options: LegendOptions; - - constructor(calendar: CalHeatmap) { - this.calendar = calendar; - this.root = null; - this.shown = false; - this.options = defaultOptions; - } - - setup(pluginOptions?: Partial): void { - this.options = { ...defaultOptions, ...pluginOptions }; - } - - paint(): Promise { - const scaleOptions = this.calendar.options.options.scale; - const { enabled, itemSelector } = this.options; - - if (!enabled || (itemSelector && select(itemSelector).empty())) { - return this.destroy(); - } - - this.shown = true; - - this.root = select( - itemSelector || this.calendar.options.options.itemSelector, - ); - - if (this.root.select(DEFAULT_SELECTOR).empty()) { - this.root = this.root.append('div').attr('id', DEFAULT_SELECTOR.slice(1)); - } else { - this.root = this.root.select(DEFAULT_SELECTOR); - } - - // @ts-ignore - const node = legend({ - ...scaleOptions, - ...this.options, - }); - - this.root.selectAll('*').remove(); - this.root.append(() => node); - - return Promise.resolve(); - } - - destroy(): Promise { - if (this.root !== null) { - this.root.remove(); - this.root = null; - } - - return Promise.resolve(); - } -} diff --git a/src/plugins/LegendLite.ts b/src/plugins/LegendLite.ts deleted file mode 100644 index adec4450..00000000 --- a/src/plugins/LegendLite.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { select, create } from 'd3-selection'; -import { normalizedScale, applyScaleStyle } from '../scale'; -import { DEFAULT_SELECTOR as MAIN_SELECTOR } from '../calendar/CalendarPainter'; -import { - DEFAULT_SELECTOR as SUBDOMAIN_SELECTOR, -} from '../subDomain/SubDomainPainter'; - -import type CalHeatmap from '../CalHeatmap'; -import type { - // eslint-disable-next-line import/no-named-default - default as ILegendLite, - LegendLiteOptions, -} from '../types/plugins/LegendLite'; -import { - OPTIONS_DEFAULT_SUBDOMAIN_WIDTH, - OPTIONS_DEFAULT_SUBDOMAIN_HEIGHT, - OPTIONS_DEFAULT_SUBDOMAIN_GUTTER, - OPTIONS_DEFAULT_SUBDOMAIN_RADIUS, -} from '../constant'; - -const DEFAULT_SELECTOR = '.ch-plugin-legend-lite'; - -const defaultOptions: LegendLiteOptions = { - enabled: true, // Whether to display the legend - itemSelector: null, - width: OPTIONS_DEFAULT_SUBDOMAIN_WIDTH, - height: OPTIONS_DEFAULT_SUBDOMAIN_HEIGHT, - gutter: OPTIONS_DEFAULT_SUBDOMAIN_GUTTER, - radius: OPTIONS_DEFAULT_SUBDOMAIN_RADIUS, - includeBlank: false, -}; - -export default class LegendLite implements ILegendLite { - name = 'LegendLite'; - - calendar: CalHeatmap; - - root: any; - - shown: boolean; - - options: LegendLiteOptions; - - constructor(calendar: CalHeatmap) { - this.calendar = calendar; - this.root = null; - this.shown = false; - this.options = defaultOptions; - } - - setup(pluginOptions?: Partial): void { - this.options = { ...this.options, ...pluginOptions }; - } - - paint(): Promise { - const { enabled, itemSelector } = this.options; - - if (!enabled || (itemSelector && select(itemSelector).empty())) { - return this.destroy(); - } - - this.shown = true; - - this.root = select( - itemSelector || this.calendar.options.options.itemSelector, - ); - - if (this.root.select(DEFAULT_SELECTOR).empty()) { - this.root = this.root - .append('div') - .attr('class', DEFAULT_SELECTOR.slice(1)); - } else { - this.root = this.root.select(DEFAULT_SELECTOR); - } - - const node = this.#buildLegend(); - - this.root.selectAll('*').remove(); - this.root.append(() => node.node()); - - return Promise.resolve(); - } - - destroy(): Promise { - if (this.root !== null) { - this.root.remove(); - this.root = null; - } - - return Promise.resolve(); - } - - #buildLegend() { - const node = create('svg'); - const scale = normalizedScale(this.calendar.options.options.scale); - const { - width, height, gutter, includeBlank, - } = this.options; - - const localRange = [...scale.range]; - if (includeBlank) { - localRange.unshift(null); - } - - node - .attr('class', MAIN_SELECTOR.slice(1)) - .attr( - 'width', - localRange.length * width + (localRange.length - 1) * gutter, - ) - .attr('height', height); - - node - .selectAll('rect') - .data(localRange) - .join( - (enter: any) => enter.append('rect').call((sc: any) => - // eslint-disable-next-line implicit-arrow-linebreak - this.#nodeAttrs(sc, scale)), - (update: any) => update - .selectAll('rect') - .call((sc: any) => this.#nodeAttrs(sc, scale)), - ); - - return node; - } - - #nodeAttrs(selection: any, scale: any) { - const { - width, height, radius, gutter, - } = this.options; - - return selection - .attr('width', width) - .attr('height', height) - .attr('class', `${SUBDOMAIN_SELECTOR.slice(1)}-bg`) - .attr('rx', radius) - .attr('ry', radius) - .attr('x', (_d: any, i: number) => i * (width + gutter)) - .attr('y', 0) - .call((element: any) => { - applyScaleStyle(element, scale, this.calendar.options.options.scale!); - }); - } -} diff --git a/src/plugins/PluginManager.ts b/src/plugins/PluginManager.ts index c8510e07..eba03db1 100644 --- a/src/plugins/PluginManager.ts +++ b/src/plugins/PluginManager.ts @@ -6,7 +6,7 @@ import { PluginOptions, IPluginConstructor, IPlugin, -} from '../types/index'; +} from '../types'; type PluginSetting = { options?: PluginOptions; diff --git a/src/plugins/Tooltip.ts b/src/plugins/Tooltip.ts deleted file mode 100644 index b100cba8..00000000 --- a/src/plugins/Tooltip.ts +++ /dev/null @@ -1,180 +0,0 @@ -import { createPopper } from '@popperjs/core'; - -import type { VirtualElement, StrictModifiers } from '@popperjs/core'; -import type CalHeatmap from '../CalHeatmap'; -import type { Timestamp } from '../types/index'; -import type { - ITooltip, - TooltipOptions, -} from '../types/plugins/Tooltip'; - -const DEFAULT_SELECTOR = '#ch-tooltip'; - -const defaultOptions: Partial = { - enabled: true, - - // Expecting a function, which will return the tooltip content - text: (_timestamp, value, dayjsDate): string => - // eslint-disable-next-line implicit-arrow-linebreak - `${value} - ${dayjsDate.format('LLLL')}`, -}; - -const DEFAULT_POPPER_OPTIONS = { - placement: 'top', - modifiers: [ - { - name: 'offset', - options: { - offset: [0, 8], - }, - }, - ], -}; - -const virtualElement: VirtualElement = { - getBoundingClientRect(x = 0, y = 0): DOMRect { - return { - width: 0, - height: 0, - top: y, - right: x, - bottom: y, - left: x, - x, - y, - toJSON: () => {}, - }; - }, -}; - -export default class Tooltip implements ITooltip { - name = 'Tooltip'; - - calendar: CalHeatmap; - - root: HTMLElement | null; - - popperInstance: any; - - popperOptions: any; - - options: Partial; - - listenerAttached: boolean; - - constructor(calendar: CalHeatmap) { - this.calendar = calendar; - this.root = null; - this.popperInstance = null; - this.options = defaultOptions; - this.listenerAttached = false; - } - - setup(pluginOptions?: Partial): void { - this.options = { ...defaultOptions, ...pluginOptions }; - const event = this.calendar.eventEmitter; - - if (!this.options.enabled) { - if (this.listenerAttached) { - event.off('mouseover', this.mouseOverCallback, this); - event.off('mouseout', this.mouseOutCallback, this); - - this.listenerAttached = false; - } - - this.destroy(); - return; - } - - this.popperOptions = { ...DEFAULT_POPPER_OPTIONS, ...this.options }; - - this.root = document.getElementById(DEFAULT_SELECTOR.slice(1)); - - if (!this.root) { - const tooltipElem = document.createElement('div'); - tooltipElem.setAttribute('id', DEFAULT_SELECTOR.slice(1)); - tooltipElem.setAttribute('role', 'tooltip'); - tooltipElem.innerHTML = - `
` + - ``; - - this.root = document.body.appendChild(tooltipElem); - } - - this.root.setAttribute('data-theme', this.calendar.options.options.theme); - - this.popperInstance = createPopper( - virtualElement, - this.root, - this.popperOptions, - ); - - if (!this.listenerAttached) { - event.on('mouseover', this.mouseOverCallback, this); - event.on('mouseout', this.mouseOutCallback, this); - this.listenerAttached = true; - } - } - - mouseOverCallback(e: PointerEvent, timestamp: Timestamp, value: number) { - this.#show(e.target, timestamp, value); - } - - mouseOutCallback() { - this.#hide(); - } - - // eslint-disable-next-line class-methods-use-this - paint(): Promise { - return Promise.resolve(); - } - - destroy(): Promise { - if (this.root) { - this.root.remove(); - } - - return Promise.resolve(); - } - - #show(e: any, timestamp: Timestamp, value: number): void { - const formatter = this.options.text; - const title = formatter ? - formatter(timestamp, value, this.calendar.dateHelper.date(timestamp)) : - null; - - if (!title) { - return; - } - - virtualElement.getBoundingClientRect = () => e.getBoundingClientRect(); - document.getElementById(`${DEFAULT_SELECTOR.slice(1)}-body`)!.innerHTML = - title; - - this.popperInstance.setOptions(() => ({ - ...this.popperOptions, - modifiers: [ - ...this.popperOptions.modifiers, - { name: 'eventListeners', enabled: true }, - ], - })); - - this.popperInstance.update(); - - this.root!.setAttribute('data-show', '1'); - } - - #hide(): void { - this.root!.removeAttribute('data-show'); - - this.popperInstance.setOptions(() => ({ - ...this.popperOptions, - modifiers: [ - ...this.popperOptions.modifiers, - { name: 'eventListeners', enabled: false }, - ], - })); - } -} diff --git a/src/types/plugins/CalendarLabel.d.ts b/src/types/plugins/CalendarLabel.d.ts deleted file mode 100644 index aab38384..00000000 --- a/src/types/plugins/CalendarLabel.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { IPlugin, PluginOptions } from '../index'; -import type { TextAlign, Padding } from '../../options/Options'; - -export type ComputedOptions = { - radius: number; - width: number; - height: number; - gutter: number; - textAlign: TextAlign; -}; - -export interface CalendarLabelOptions extends PluginOptions, - Partial { - enabled: boolean; - text: () => string[]; - padding: Padding; -} - -export interface ICalendarLabel extends IPlugin { -} - -export default class CalendarLabel { - name: string; - - calendar: CalHeatmap; - - options: PluginOptions; - - root: any; - - setup: (options?: PluginOptions) => void; - - paint: () => Promise; - - destroy: () => Promise; -} diff --git a/src/types/plugins/Legend.d.ts b/src/types/plugins/Legend.d.ts deleted file mode 100644 index c206f0fd..00000000 --- a/src/types/plugins/Legend.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { IPlugin, PluginOptions } from '../index'; - -export interface LegendOptions extends PluginOptions { - enabled: boolean; - itemSelector: string | null; - label: string | null; - width: number; -} - -export interface ILegend extends IPlugin { -} - -export default class Legend { - name: string; - - calendar: CalHeatmap; - - options: PluginOptions; - - root: any; - - setup: (options?: PluginOptions) => void; - - paint: () => Promise; - - destroy: () => Promise; -} diff --git a/src/types/plugins/LegendLite.d.ts b/src/types/plugins/LegendLite.d.ts deleted file mode 100644 index 487ab31d..00000000 --- a/src/types/plugins/LegendLite.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { IPlugin, PluginOptions } from '../index'; - -export interface LegendLiteOptions extends PluginOptions { - enabled: boolean; - itemSelector: string | null; - width: number; - height: number; - radius: number; - gutter: number; - includeBlank: boolean; -} - -export interface ILegendLite extends IPlugin { -} - -export default class LegendLite { - name: string; - - calendar: CalHeatmap; - - options: PluginOptions; - - root: any; - - setup: (options?: PluginOptions) => void; - - paint: () => Promise; - - destroy: () => Promise; -} diff --git a/src/types/plugins/Tooltip.d.ts b/src/types/plugins/Tooltip.d.ts deleted file mode 100644 index 930c124c..00000000 --- a/src/types/plugins/Tooltip.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type dayjs from 'dayjs'; -import type { IPlugin, PluginOptions } from '../index'; - -interface PopperOptions { - placement: any; - modifiers: any[]; - strategy: any; - onFirstUpdate?: any; -} - -interface TooltipOptions extends PluginOptions, PopperOptions { - enabled: boolean; - text: (timestamp: Timestamp, value: number, dayjsDate: dayjs.Dayjs) => string; -} - -export interface ITooltip extends IPlugin { -} - -export default class Tooltip { - name: string; - - calendar: CalHeatmap; - - options: PluginOptions; - - root: any; - - setup: (options?: PluginOptions) => void; - - paint: () => Promise; - - destroy: () => Promise; -} diff --git a/test/e2e/index-d3v6-umd.html b/test/e2e/index-d3v6-umd.html index a72f2784..80eed3de 100644 --- a/test/e2e/index-d3v6-umd.html +++ b/test/e2e/index-d3v6-umd.html @@ -2,11 +2,6 @@ - - - - - diff --git a/test/e2e/index-d3v7-esm.html b/test/e2e/index-d3v7-esm.html index bb71604b..898e2b1e 100644 --- a/test/e2e/index-d3v7-esm.html +++ b/test/e2e/index-d3v7-esm.html @@ -15,26 +15,14 @@ "d3-color": "https://cdn.skypack.dev/d3-color", "d3-fetch": "https://cdn.skypack.dev/d3-fetch", "d3-transition": "https://cdn.skypack.dev/d3-transition", - "d3": "https://cdn.skypack.dev/d3", - "@popperjs/core": "https://cdn.skypack.dev/@popperjs/core" + "d3": "https://cdn.skypack.dev/d3" } } -
diff --git a/test/e2e/index-d3v7-umd.html b/test/e2e/index-d3v7-umd.html index c50685c3..0f63a92c 100644 --- a/test/e2e/index-d3v7-umd.html +++ b/test/e2e/index-d3v7-umd.html @@ -2,11 +2,6 @@ - - - - - diff --git a/test/frontend/export.js b/test/frontend/export.js index 4010fdd8..cf754dd1 100644 --- a/test/frontend/export.js +++ b/test/frontend/export.js @@ -16,8 +16,6 @@ import domainSort from './domainSort'; import data from './data'; import date from './date'; import verticalOrientation from './verticalOrientation'; -import legend from './legend'; -import tooltip from './tooltip'; import fill from './fill'; export default [ @@ -37,8 +35,6 @@ export default [ domainSort, data, date, - legend, verticalOrientation, - tooltip, fill, ]; diff --git a/test/frontend/legend.js b/test/frontend/legend.js deleted file mode 100644 index 841a0b8f..00000000 --- a/test/frontend/legend.js +++ /dev/null @@ -1,148 +0,0 @@ -import Legend from '../../src/plugins/Legend'; - -/* eslint-disable arrow-body-style */ -const data = { - title: 'Plugins: Legend', - tests: [ - { - title: 'renders the legend after the calendar', - setup: (cal, d3) => { - d3.select('body').append('div').attr('id', 'legend'); - return cal.paint({ ...window.defaultOptions }, [[Legend]]); - }, - expectations: [ - { - current: (d3) => { - return d3.select('#cal-heatmap #ch-plugin-legend').nodes().length; - }, - expected: () => 1, - }, - ], - }, - { - title: 'renders the legend in the given itemSelector', - setup: (cal, d3) => { - d3.select('body').append('div').attr('id', 'legend'); - return cal.paint({ ...window.defaultOptions }, [ - [Legend, { itemSelector: '#legend' }], - ]); - }, - expectations: [ - { - current: (d3) => { - return d3.select('#cal-heatmap #ch-plugin-legend').nodes().length; - }, - expected: () => 0, - }, - { - current: (d3) => { - return d3.select('#legend svg').nodes().length; - }, - expected: () => 1, - }, - ], - }, - { - title: 'does not render the legend', - setup: (cal, d3) => { - d3.select('body').append('div').attr('id', 'legend'); - return cal.paint({ ...window.defaultOptions }, [ - [Legend, { enabled: false }], - ]); - }, - expectations: [ - { - current: (d3) => { - return d3.select('#ch-plugin-legend').nodes().length; - }, - expected: () => 0, - }, - ], - }, - { - title: 'adds a title to the legend', - setup: (cal, d3) => { - d3.select('body').append('div').attr('id', 'legend'); - return cal.paint({ ...window.defaultOptions }, [ - [Legend, { label: 'Test' }], - ]); - }, - expectations: [ - { - current: (d3) => { - return d3.select('#ch-plugin-legend svg > text').html(); - }, - expected: () => 'Test', - }, - ], - }, - { - title: 'paints the subDomain with the colors', - setup: (cal, d3) => { - d3.select('body').append('div').attr('id', 'legend'); - return cal.paint( - { - ...window.defaultOptions, - range: 1, - scale: { - color: { - domain: [0, 100], - type: 'quantize', - range: ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494'], - }, - }, - }, - [[Legend, { itemSelector: '#legend' }]], - ); - }, - expectations: [ - { - current: (d3) => { - return d3.selectAll('#legend rect').nodes().length; - }, - expected: () => 5, - }, - { - current: (d3) => { - return d3.select('#legend rect:nth-child(1)').attr('fill'); - }, - expected: () => '#ffffcc', - }, - { - current: (d3) => { - return d3.select('#legend rect:nth-child(5)').attr('fill'); - }, - expected: () => '#253494', - }, - ], - }, - { - title: 'is destroyed alongside the calendar', - setup: (cal, d3) => { - d3.select('body').append('div').attr('id', 'legend'); - return cal.paint({ ...window.defaultOptions }, [[Legend]]); - }, - execute: (cal) => { - cal.destroy(); - }, - preExpectations: [ - { - current: (d3) => { - return d3.selectAll('#ch-plugin-legend').nodes().length; - }, - expected: () => 1, - }, - ], - expectations: [ - { - current: (d3) => { - return d3.selectAll('#ch-plugin-legend').nodes().length; - }, - expected: () => 0, - }, - ], - }, - ], -}; - -export default data; diff --git a/test/frontend/tooltip.js b/test/frontend/tooltip.js deleted file mode 100644 index 1f353c8f..00000000 --- a/test/frontend/tooltip.js +++ /dev/null @@ -1,125 +0,0 @@ -/* eslint-disable arrow-body-style */ - -import Tooltip from '../../src/plugins/Tooltip'; - -const data = { - title: 'Plugin: Tooltip', - tests: [ - { - title: 'disables the tooltip', - setup: (cal) => { - return cal.paint(window.defaultOptions, [ - [Tooltip, { enabled: false }], - ]); - }, - expectations: [ - { - current: (d3) => { - return d3.select('#ch-tooltip').node(); - }, - expected: () => null, - }, - ], - }, - { - title: 'enables the tooltip', - setup: (cal) => { - return cal.paint(window.defaultOptions, [[Tooltip, { enabled: true }]]); - }, - execute: (cal, d3) => { - return cal.eventEmitter.emit( - 'mouseover', - { - target: d3.select('.ch-subdomain-bg').node(), - }, - 1, - 1, - ); - }, - preExpectations: [ - { - current: (d3) => { - return d3.select('#ch-tooltip').node(); - }, - expected: () => null, - }, - ], - expectations: [ - { - current: (d3) => { - return d3.select('#ch-tooltip').attr('data-show'); - }, - expected: () => '1', - }, - { - current: (d3) => { - return d3.select('#ch-tooltip-body').html(); - }, - notExpected: () => '', - }, - ], - }, - { - title: 'destroys the plugin alongside the calendar', - setup: (cal) => { - return cal.paint(window.defaultOptions, [ - [Tooltip, { enabled: true }], - ]); - }, - execute: (cal) => { - return cal.destroy(); - }, - expectations: [ - { - current: (d3) => { - return d3.select('#ch-tooltip').node(); - }, - expected: () => null, - }, - ], - }, - { - title: 'formats the text with the user given function', - setup: (cal) => { - return cal.paint( - { ...window.defaultOptions, date: { start: new Date('2000-01-05') } }, - [ - [ - Tooltip, - { - enabled: true, - text: (d, v) => `${new Date(d).getFullYear()}-${v}`, - }, - ], - ], - ); - }, - execute: (cal, d3) => { - return cal.eventEmitter.emit( - 'mouseover', - { - target: d3.select('.ch-subdomain-bg').node(), - }, - +new Date('2000-01-05'), - 10, - ); - }, - expectations: [ - { - current: (d3) => { - return d3.select('#ch-tooltip-body').html(); - }, - expected: () => '2000-10', - }, - ], - }, - { - title: 'honors the locale', - }, - { - title: 'honors the timezone', - }, - ], -}; - -export default data; From 7dcb4f85f49b4c6148ccd366cb438e0cddd851a8 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 12 Feb 2024 02:31:52 +0800 Subject: [PATCH 03/36] chore: fix dead link --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1efe7cfa..26c16a5c 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "homepage": "https://cal-heatmap.com", "author": { "name": "Wan Qi Chen", - "url": "http://www.kamisama.me" + "url": "https://github.com/wa0x6e" }, "license": "MIT", "bugs": "https://github.com/wa0x6e/cal-heatmap/issues", From 7c0ea7c0ab05dfc6551003c54d9029542abd5e9e Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 12 Feb 2024 14:59:06 +0800 Subject: [PATCH 04/36] chore: stop exporting plugin files --- package.json | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/package.json b/package.json index 26c16a5c..de2f3421 100644 --- a/package.json +++ b/package.json @@ -16,27 +16,7 @@ "types": "./src/types.d.ts" }, "./package.json": "./package.json", - "./cal-heatmap.css": "./dist/cal-heatmap.css", - "./plugins/Tooltip": { - "import": "./dist/plugins/Tooltip.esm.js", - "require": "./dist/plugins/Tooltip.js", - "types": "./src/types/plugins/Tooltip.d.ts" - }, - "./plugins/Legend": { - "import": "./dist/plugins/Legend.esm.js", - "require": "./dist/plugins/Legend.js", - "types": "./src/types/plugins/Legend.d.ts" - }, - "./plugins/LegendLite": { - "import": "./dist/plugins/LegendLite.esm.js", - "require": "./dist/plugins/LegendLite.js", - "types": "./src/types/plugins/LegendLite.d.ts" - }, - "./plugins/CalendarLabel": { - "import": "./dist/plugins/CalendarLabel.esm.js", - "require": "./dist/plugins/CalendarLabel.js", - "types": "./src/types/plugins/CalendarLabel.d.ts" - } + "./cal-heatmap.css": "./dist/cal-heatmap.css" }, "directories": { "test": "test" From 5b3bca73c41ba382568d7a6ef6528abda1b10a8d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:15:26 +0000 Subject: [PATCH 05/36] chore(deps): update dependency node to v20.11.1 --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 8b0beab1..2dbbe00e 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20.11.0 +20.11.1 From 27252578cb56cb005657459a02d3daf7517f6b6b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:15:58 +0000 Subject: [PATCH 06/36] chore(deps): update dependency browserslist to v4.23.0 --- package-lock.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 415bb266..e9c5168c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5764,9 +5764,9 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.22.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz", - "integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==", + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz", + "integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==", "dev": true, "funding": [ { @@ -5783,8 +5783,8 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001580", - "electron-to-chromium": "^1.4.648", + "caniuse-lite": "^1.0.30001587", + "electron-to-chromium": "^1.4.668", "node-releases": "^2.0.14", "update-browserslist-db": "^1.0.13" }, @@ -6053,9 +6053,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001580", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001580.tgz", - "integrity": "sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==", + "version": "1.0.30001587", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", + "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", "dev": true, "funding": [ { @@ -7551,9 +7551,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.648", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.648.tgz", - "integrity": "sha512-EmFMarXeqJp9cUKu/QEciEApn0S/xRcpZWuAm32U7NgoZCimjsilKXHRO9saeEW55eHZagIDg6XTUOv32w9pjg==", + "version": "1.4.673", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.673.tgz", + "integrity": "sha512-zjqzx4N7xGdl5468G+vcgzDhaHkaYgVcf9MqgexcTqsl2UHSCmOj/Bi3HAprg4BZCpC7HyD8a6nZl6QAZf72gw==", "dev": true }, "node_modules/emittery": { From e4628827e29c8357c520a6ffa62ff0b047e2285e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 05:02:23 +0000 Subject: [PATCH 07/36] chore(deps): update dependency eslint-plugin-jest to v27.9.0 --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 415bb266..084a342f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8061,9 +8061,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "27.6.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.3.tgz", - "integrity": "sha512-+YsJFVH6R+tOiO3gCJon5oqn4KWc+mDq2leudk8mrp8RFubLOo9CVyi3cib4L7XMpxExmkmBZQTPDYVBzgpgOA==", + "version": "27.9.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", + "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.10.0" @@ -8072,7 +8072,7 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" }, "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0", + "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0", "eslint": "^7.0.0 || ^8.0.0", "jest": "*" }, From 3d780469e51ce13f04595419b366033deda8f33d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 05:02:42 +0000 Subject: [PATCH 08/36] chore(deps): update dependency rollup to v4.12.0 --- package-lock.json | 110 +++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/package-lock.json b/package-lock.json index 415bb266..ac6dd1ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3683,9 +3683,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.10.0.tgz", - "integrity": "sha512-/MeDQmcD96nVoRumKUljsYOLqfv1YFJps+0pTrb2Z9Nl/w5qNUysMaWQsrd1mvAlNT4yza1iVyIu4Q4AgF6V3A==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.12.0.tgz", + "integrity": "sha512-+ac02NL/2TCKRrJu2wffk1kZ+RyqxVUlbjSagNgPm94frxtr+XDL12E5Ll1enWskLrtrZ2r8L3wED1orIibV/w==", "cpu": [ "arm" ], @@ -3696,9 +3696,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.10.0.tgz", - "integrity": "sha512-lvu0jK97mZDJdpZKDnZI93I0Om8lSDaiPx3OiCk0RXn3E8CMPJNS/wxjAvSJJzhhZpfjXsjLWL8LnS6qET4VNQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.12.0.tgz", + "integrity": "sha512-OBqcX2BMe6nvjQ0Nyp7cC90cnumt8PXmO7Dp3gfAju/6YwG0Tj74z1vKrfRz7qAv23nBcYM8BCbhrsWqO7PzQQ==", "cpu": [ "arm64" ], @@ -3709,9 +3709,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.10.0.tgz", - "integrity": "sha512-uFpayx8I8tyOvDkD7X6n0PriDRWxcqEjqgtlxnUA/G9oS93ur9aZ8c8BEpzFmsed1TH5WZNG5IONB8IiW90TQg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.12.0.tgz", + "integrity": "sha512-X64tZd8dRE/QTrBIEs63kaOBG0b5GVEd3ccoLtyf6IdXtHdh8h+I56C2yC3PtC9Ucnv0CpNFJLqKFVgCYe0lOQ==", "cpu": [ "arm64" ], @@ -3722,9 +3722,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.10.0.tgz", - "integrity": "sha512-nIdCX03qFKoR/MwQegQBK+qZoSpO3LESurVAC6s6jazLA1Mpmgzo3Nj3H1vydXp/JM29bkCiuF7tDuToj4+U9Q==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.12.0.tgz", + "integrity": "sha512-cc71KUZoVbUJmGP2cOuiZ9HSOP14AzBAThn3OU+9LcA1+IUqswJyR1cAJj3Mg55HbjZP6OLAIscbQsQLrpgTOg==", "cpu": [ "x64" ], @@ -3735,9 +3735,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.10.0.tgz", - "integrity": "sha512-Fz7a+y5sYhYZMQFRkOyCs4PLhICAnxRX/GnWYReaAoruUzuRtcf+Qnw+T0CoAWbHCuz2gBUwmWnUgQ67fb3FYw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.12.0.tgz", + "integrity": "sha512-a6w/Y3hyyO6GlpKL2xJ4IOh/7d+APaqLYdMf86xnczU3nurFTaVN9s9jOXQg97BE4nYm/7Ga51rjec5nfRdrvA==", "cpu": [ "arm" ], @@ -3748,9 +3748,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.10.0.tgz", - "integrity": "sha512-yPtF9jIix88orwfTi0lJiqINnlWo6p93MtZEoaehZnmCzEmLL0eqjA3eGVeyQhMtxdV+Mlsgfwhh0+M/k1/V7Q==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.12.0.tgz", + "integrity": "sha512-0fZBq27b+D7Ar5CQMofVN8sggOVhEtzFUwOwPppQt0k+VR+7UHMZZY4y+64WJ06XOhBTKXtQB/Sv0NwQMXyNAA==", "cpu": [ "arm64" ], @@ -3761,9 +3761,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.10.0.tgz", - "integrity": "sha512-9GW9yA30ib+vfFiwjX+N7PnjTnCMiUffhWj4vkG4ukYv1kJ4T9gHNg8zw+ChsOccM27G9yXrEtMScf1LaCuoWQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.12.0.tgz", + "integrity": "sha512-eTvzUS3hhhlgeAv6bfigekzWZjaEX9xP9HhxB0Dvrdbkk5w/b+1Sxct2ZuDxNJKzsRStSq1EaEkVSEe7A7ipgQ==", "cpu": [ "arm64" ], @@ -3774,9 +3774,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.10.0.tgz", - "integrity": "sha512-X1ES+V4bMq2ws5fF4zHornxebNxMXye0ZZjUrzOrf7UMx1d6wMQtfcchZ8SqUnQPPHdOyOLW6fTcUiFgHFadRA==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.12.0.tgz", + "integrity": "sha512-ix+qAB9qmrCRiaO71VFfY8rkiAZJL8zQRXveS27HS+pKdjwUfEhqo2+YF2oI+H/22Xsiski+qqwIBxVewLK7sw==", "cpu": [ "riscv64" ], @@ -3787,9 +3787,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.10.0.tgz", - "integrity": "sha512-w/5OpT2EnI/Xvypw4FIhV34jmNqU5PZjZue2l2Y3ty1Ootm3SqhI+AmfhlUYGBTd9JnpneZCDnt3uNOiOBkMyw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.12.0.tgz", + "integrity": "sha512-TenQhZVOtw/3qKOPa7d+QgkeM6xY0LtwzR8OplmyL5LrgTWIXpTQg2Q2ycBf8jm+SFW2Wt/DTn1gf7nFp3ssVA==", "cpu": [ "x64" ], @@ -3800,9 +3800,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.10.0.tgz", - "integrity": "sha512-q/meftEe3QlwQiGYxD9rWwB21DoKQ9Q8wA40of/of6yGHhZuGfZO0c3WYkN9dNlopHlNT3mf5BPsUSxoPuVQaw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.12.0.tgz", + "integrity": "sha512-LfFdRhNnW0zdMvdCb5FNuWlls2WbbSridJvxOvYWgSBOYZtgBfW9UGNJG//rwMqTX1xQE9BAodvMH9tAusKDUw==", "cpu": [ "x64" ], @@ -3813,9 +3813,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.10.0.tgz", - "integrity": "sha512-NrR6667wlUfP0BHaEIKgYM/2va+Oj+RjZSASbBMnszM9k+1AmliRjHc3lJIiOehtSSjqYiO7R6KLNrWOX+YNSQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.12.0.tgz", + "integrity": "sha512-JPDxovheWNp6d7AHCgsUlkuCKvtu3RB55iNEkaQcf0ttsDU/JZF+iQnYcQJSk/7PtT4mjjVG8N1kpwnI9SLYaw==", "cpu": [ "arm64" ], @@ -3826,9 +3826,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.10.0.tgz", - "integrity": "sha512-FV0Tpt84LPYDduIDcXvEC7HKtyXxdvhdAOvOeWMWbQNulxViH2O07QXkT/FffX4FqEI02jEbCJbr+YcuKdyyMg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.12.0.tgz", + "integrity": "sha512-fjtuvMWRGJn1oZacG8IPnzIV6GF2/XG+h71FKn76OYFqySXInJtseAqdprVTDTyqPxQOG9Exak5/E9Z3+EJ8ZA==", "cpu": [ "ia32" ], @@ -3839,9 +3839,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.10.0.tgz", - "integrity": "sha512-OZoJd+o5TaTSQeFFQ6WjFCiltiYVjIdsXxwu/XZ8qRpsvMQr4UsVrE5UyT9RIvsnuF47DqkJKhhVZ2Q9YW9IpQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.12.0.tgz", + "integrity": "sha512-ZYmr5mS2wd4Dew/JjT0Fqi2NPB/ZhZ2VvPp7SmvPZb4Y1CG/LRcS6tcRo2cYU7zLK5A7cdbhWnnWmUjoI4qapg==", "cpu": [ "x64" ], @@ -16298,9 +16298,9 @@ "integrity": "sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g==" }, "node_modules/rollup": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.10.0.tgz", - "integrity": "sha512-t2v9G2AKxcQ8yrG+WGxctBes1AomT0M4ND7jTFBCVPXQ/WFTvNSefIrNSmLKhIKBrvN8SG+CZslimJcT3W2u2g==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.12.0.tgz", + "integrity": "sha512-wz66wn4t1OHIJw3+XU7mJJQV/2NAfw5OAk6G6Hoo3zcvz/XOfQ52Vgi+AN4Uxoxi0KBBwk2g8zPrTDA4btSB/Q==", "dev": true, "dependencies": { "@types/estree": "1.0.5" @@ -16313,19 +16313,19 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.10.0", - "@rollup/rollup-android-arm64": "4.10.0", - "@rollup/rollup-darwin-arm64": "4.10.0", - "@rollup/rollup-darwin-x64": "4.10.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.10.0", - "@rollup/rollup-linux-arm64-gnu": "4.10.0", - "@rollup/rollup-linux-arm64-musl": "4.10.0", - "@rollup/rollup-linux-riscv64-gnu": "4.10.0", - "@rollup/rollup-linux-x64-gnu": "4.10.0", - "@rollup/rollup-linux-x64-musl": "4.10.0", - "@rollup/rollup-win32-arm64-msvc": "4.10.0", - "@rollup/rollup-win32-ia32-msvc": "4.10.0", - "@rollup/rollup-win32-x64-msvc": "4.10.0", + "@rollup/rollup-android-arm-eabi": "4.12.0", + "@rollup/rollup-android-arm64": "4.12.0", + "@rollup/rollup-darwin-arm64": "4.12.0", + "@rollup/rollup-darwin-x64": "4.12.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.12.0", + "@rollup/rollup-linux-arm64-gnu": "4.12.0", + "@rollup/rollup-linux-arm64-musl": "4.12.0", + "@rollup/rollup-linux-riscv64-gnu": "4.12.0", + "@rollup/rollup-linux-x64-gnu": "4.12.0", + "@rollup/rollup-linux-x64-musl": "4.12.0", + "@rollup/rollup-win32-arm64-msvc": "4.12.0", + "@rollup/rollup-win32-ia32-msvc": "4.12.0", + "@rollup/rollup-win32-x64-msvc": "4.12.0", "fsevents": "~2.3.2" } }, From 2c5a1e361a42eb606f73cef6b8455393baa7c769 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 07:35:42 +0000 Subject: [PATCH 09/36] chore(deps): update dependency sass to v1.71.0 --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 415bb266..0547e872 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16558,9 +16558,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sass": { - "version": "1.70.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.70.0.tgz", - "integrity": "sha512-uUxNQ3zAHeAx5nRFskBnrWzDUJrrvpCPD5FNAoRvTi0WwremlheES3tg+56PaVtCs5QDRX5CBLxxKMDJMEa1WQ==", + "version": "1.71.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.71.0.tgz", + "integrity": "sha512-HKKIKf49Vkxlrav3F/w6qRuPcmImGVbIXJ2I3Kg0VMA+3Bav+8yE9G5XmP5lMj6nl4OlqbPftGAscNaNu28b8w==", "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0", From 97b87f4effcbf1f947d4b5a2e52923891d4e6917 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 07:35:56 +0000 Subject: [PATCH 10/36] fix(deps): update dependency core-js to v3.36.0 --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 415bb266..4b908de4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6431,9 +6431,9 @@ "dev": true }, "node_modules/core-js": { - "version": "3.35.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.35.1.tgz", - "integrity": "sha512-IgdsbxNyMskrTFxa9lWHyMwAJU5gXOPP+1yO+K59d50VLVAIDAbs7gIv705KzALModfK3ZrSZTPNpC0PQgIZuw==", + "version": "3.36.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.36.0.tgz", + "integrity": "sha512-mt7+TUBbTFg5+GngsAxeKBTl5/VS0guFeJacYge9OmHb+m058UwwIm41SE9T4Den7ClatV57B6TYTuJ0CX1MAw==", "hasInstallScript": true, "funding": { "type": "opencollective", From cf3aad700d36a57a396eda7a790c94e4e3aa5482 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Sun, 18 Feb 2024 03:23:44 +0800 Subject: [PATCH 11/36] fix: expose more functions for plugin use --- src/types.d.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/types.d.ts b/src/types.d.ts index bf6e746c..ba2b9e6a 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,7 +1,7 @@ import type { PluginFunc } from 'dayjs'; import type dayjs from 'dayjs'; - -import type { OptionsType } from './options/Options'; +import type EventEmitter from 'eventemitter3'; +import type Options, { OptionsType } from './options/Options'; import type DateHelper from './helpers/DateHelper'; export type Timestamp = number; @@ -55,7 +55,8 @@ export type Dimensions = { // Plugin export interface IPlugin { - name: string; + readonly VERSION: string; + readonly name: string; calendar: CalHeatmap; options: PluginOptions; root: any; @@ -76,6 +77,14 @@ export interface PluginOptions { export type PluginDefinition = [IPluginConstructor, Partial?]; export default class CalHeatmap { + static readonly VERSION = string; + + options: Options; + + eventEmitter: EventEmitter; + + dateHelper: DateHelper; + constructor(); paint( From 657e881fb79ccbcd9b96d3dab7345372dda559ad Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Sun, 18 Feb 2024 03:24:08 +0800 Subject: [PATCH 12/36] chore: release v4.3.0-beta.0 --- package.json | 2 +- src/version.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index de2f3421..085beee6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cal-heatmap", - "version": "4.2.4", + "version": "4.3.0-beta-0", "description": "Cal-Heatmap is a javascript module to create calendar heatmap to visualize time series data", "keywords": [ "calendar", diff --git a/src/version.ts b/src/version.ts index 761f7e67..33e004e6 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -const VERSION = '4.2.4'; +const VERSION = '4.3.0-beta-0'; export default VERSION; From ee8398701e8f98c8b69eebe246f68dde8da9195e Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Sun, 18 Feb 2024 03:27:25 +0800 Subject: [PATCH 13/36] chore: fix merge --- package-lock.json | 4 ++-- package.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index c40825ba..b7f2b9bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cal-heatmap", - "version": "4.2.4", + "version": "4.3.0-beta-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cal-heatmap", - "version": "4.2.4", + "version": "4.3.0-beta-0", "license": "MIT", "dependencies": { "@observablehq/plot": "^0.6.0", diff --git a/package.json b/package.json index 085beee6..0640fb2e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "browserslist": "last 2 versions, not dead, > 0.2%", "dependencies": { "@observablehq/plot": "^0.6.0", - "@popperjs/core": "^2.11.6", "core-js": "^3.35.1", "d3-color": "^3.1.0", "d3-fetch": "^3.0.1", From f4e5b0525eddd27fc79d5fd631058ff1b9f4fc41 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Sun, 18 Feb 2024 20:49:49 +0800 Subject: [PATCH 14/36] fix: update typing --- src/types.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/types.d.ts b/src/types.d.ts index ba2b9e6a..83bfadef 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -55,8 +55,6 @@ export type Dimensions = { // Plugin export interface IPlugin { - readonly VERSION: string; - readonly name: string; calendar: CalHeatmap; options: PluginOptions; root: any; From f8fb4ea9e9778f5ff53717b9cda884ff35ea8b0f Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Sun, 18 Feb 2024 21:06:27 +0800 Subject: [PATCH 15/36] fix: fix typing for new plugin interface --- src/plugins/PluginManager.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/PluginManager.ts b/src/plugins/PluginManager.ts index eba03db1..0a44ac63 100644 --- a/src/plugins/PluginManager.ts +++ b/src/plugins/PluginManager.ts @@ -24,15 +24,15 @@ function extractPluginName( PluginClass: IPluginConstructor, options?: PluginOptions, ): string { - return `${new PluginClass().name}${options?.key || ''}`; + return `${PluginClass.name}${options?.key || ''}`; } export default class PluginManager { calendar: CalHeatmap; - settings: Map; + settings: Map; - plugins: Map; + plugins: Map; pendingPaint: Set; From 315909ed6eb0a257ec376ce51bfb62042baaba40 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 19 Feb 2024 01:10:13 +0800 Subject: [PATCH 16/36] fix: improve type export --- rollup.config.js | 2 +- src/CalHeatmap.ts | 6 ++---- src/calendar/CalendarPainter.ts | 2 +- src/calendar/Navigator.ts | 2 +- src/{constant.ts => constants.ts} | 0 src/domain/DomainCoordinates.ts | 2 +- src/domain/DomainLabelPainter.ts | 2 +- src/domain/DomainPainter.ts | 2 +- src/domain/DomainsContainerPainter.ts | 2 +- src/helpers/PositionHelper.ts | 4 ++-- src/index.ts | 8 ++++++++ src/options/Options.ts | 8 ++++---- src/scale.ts | 2 +- src/subDomain/SubDomainPainter.ts | 2 +- src/types.d.ts | 20 +++++++++++++++++++- 15 files changed, 44 insertions(+), 20 deletions(-) rename src/{constant.ts => constants.ts} (100%) create mode 100644 src/index.ts diff --git a/rollup.config.js b/rollup.config.js index 64835f4a..bb651441 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -115,7 +115,7 @@ const exportConfig = (input, name, output, options = {}) => { }; export default [ - ...exportConfig('src/CalHeatmap.ts', 'CalHeatmap', pkg.name, { + ...exportConfig('src/index.ts', 'CalHeatmap', pkg.name, { external: [ 'd3', 'd3-color', diff --git a/src/CalHeatmap.ts b/src/CalHeatmap.ts index a41dc18d..49edc9ee 100755 --- a/src/CalHeatmap.ts +++ b/src/CalHeatmap.ts @@ -12,12 +12,12 @@ import DomainCollection from './calendar/DomainCollection'; import DateHelper from './helpers/DateHelper'; import validate from './options/OptionsValidator'; import PluginManager from './plugins/PluginManager'; +import TemplateCollection from './TemplateCollection'; +import { ScrollDirection } from './constants'; import VERSION from './version'; import './cal-heatmap.scss'; -import TemplateCollection from './TemplateCollection'; - import type { OptionsType } from './options/Options'; import type { Template, @@ -27,8 +27,6 @@ import type { DeepPartial, } from './types'; -import { ScrollDirection } from './constant'; - export default class CalHeatmap { static readonly VERSION = VERSION; diff --git a/src/calendar/CalendarPainter.ts b/src/calendar/CalendarPainter.ts index f89102b6..74af0e6a 100644 --- a/src/calendar/CalendarPainter.ts +++ b/src/calendar/CalendarPainter.ts @@ -4,7 +4,7 @@ import DomainsContainerPainter from '../domain/DomainsContainerPainter'; import PluginPainter from '../plugins/PluginPainter'; import type CalHeatmap from '../CalHeatmap'; -import { ScrollDirection } from '../constant'; +import { ScrollDirection } from '../constants'; import type { Dimensions } from '../types'; export const DEFAULT_SELECTOR = '.ch-container'; diff --git a/src/calendar/Navigator.ts b/src/calendar/Navigator.ts index a8ccca7c..7cc99596 100644 --- a/src/calendar/Navigator.ts +++ b/src/calendar/Navigator.ts @@ -1,4 +1,4 @@ -import { ScrollDirection } from '../constant'; +import { ScrollDirection } from '../constants'; import type CalHeatmap from '../CalHeatmap'; import type DomainCollection from './DomainCollection'; diff --git a/src/constant.ts b/src/constants.ts similarity index 100% rename from src/constant.ts rename to src/constants.ts diff --git a/src/domain/DomainCoordinates.ts b/src/domain/DomainCoordinates.ts index a2d2ff7e..5792273e 100644 --- a/src/domain/DomainCoordinates.ts +++ b/src/domain/DomainCoordinates.ts @@ -1,4 +1,4 @@ -import { ScrollDirection } from '../constant'; +import { ScrollDirection } from '../constants'; import { horizontalPadding, verticalPadding } from '../helpers/PositionHelper'; import type CalHeatmap from '../CalHeatmap'; diff --git a/src/domain/DomainLabelPainter.ts b/src/domain/DomainLabelPainter.ts index f3e884cf..7185f32c 100644 --- a/src/domain/DomainLabelPainter.ts +++ b/src/domain/DomainLabelPainter.ts @@ -1,4 +1,4 @@ -import { Position } from '../constant'; +import { Position } from '../constants'; import { isVertical, verticalPadding, diff --git a/src/domain/DomainPainter.ts b/src/domain/DomainPainter.ts index 6a46e5fc..0bd11ac5 100644 --- a/src/domain/DomainPainter.ts +++ b/src/domain/DomainPainter.ts @@ -1,7 +1,7 @@ import DomainCoordinates from './DomainCoordinates'; import type CalHeatmap from '../CalHeatmap'; -import type { ScrollDirection } from '../constant'; +import type { ScrollDirection } from '../constants'; import type { Dimensions, Timestamp } from '../types'; const DEFAULT_SELECTOR = '.ch-domain'; diff --git a/src/domain/DomainsContainerPainter.ts b/src/domain/DomainsContainerPainter.ts index 76db8f61..8f3570d9 100644 --- a/src/domain/DomainsContainerPainter.ts +++ b/src/domain/DomainsContainerPainter.ts @@ -2,7 +2,7 @@ import { select } from 'd3-selection'; import DomainPainter from './DomainPainter'; import DomainLabelPainter from './DomainLabelPainter'; import SubDomainPainter from '../subDomain/SubDomainPainter'; -import { ScrollDirection } from '../constant'; +import { ScrollDirection } from '../constants'; import type CalHeatmap from '../CalHeatmap'; import type { Dimensions } from '../types'; diff --git a/src/helpers/PositionHelper.ts b/src/helpers/PositionHelper.ts index 84416707..8f2c6077 100644 --- a/src/helpers/PositionHelper.ts +++ b/src/helpers/PositionHelper.ts @@ -1,5 +1,5 @@ -import { Position } from '../constant'; -import type { Padding } from '../options/Options'; +import { Position } from '../constants'; +import type { Padding } from '../types'; export function isHorizontal(position: string): boolean { return position === 'left' || position === 'right'; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000..f0104c11 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,8 @@ +import CalHeatmap from './CalHeatmap'; +import * as constants from './constants'; +import * as positionHelpers from './helpers/PositionHelper'; + +const helpers = { position: positionHelpers }; + +export default CalHeatmap; +export { constants, helpers }; diff --git a/src/options/Options.ts b/src/options/Options.ts index 56199cb5..22ded5df 100644 --- a/src/options/Options.ts +++ b/src/options/Options.ts @@ -4,7 +4,9 @@ import has from 'lodash-es/has'; import get from 'lodash-es/get'; import set from 'lodash-es/set'; import type { Ls } from 'dayjs'; -import type { DeepPartial, DomainType, Timestamp } from '../types'; +import type { + DeepPartial, DomainType, Timestamp, TextAlign, Padding, +} from '../types'; import { OPTIONS_DEFAULT_DOMAIN_TYPE, OPTIONS_DEFAULT_SUBDOMAIN_TYPE, @@ -20,13 +22,11 @@ import { SCALE_BASE_COLOR_TYPE, SCALE_BASE_COLOR_DOMAIN, OPTIONS_DEFAULT_LOCALE, -} from '../constant'; +} from '../constants'; import OptionsPreProcessors from './OptionsPreProcessors'; type SortOrder = 'asc' | 'desc'; -export type TextAlign = 'start' | 'middle' | 'end'; -export type Padding = [number, number, number, number]; export type DomainOptions = { type: DomainType; diff --git a/src/scale.ts b/src/scale.ts index f16ba2d0..56cb0788 100644 --- a/src/scale.ts +++ b/src/scale.ts @@ -1,7 +1,7 @@ // @ts-ignore import { scale } from '@observablehq/plot'; import { OptionsType } from './options/Options'; -import { SCALE_BASE_OPACITY_COLOR } from './constant'; +import { SCALE_BASE_OPACITY_COLOR } from './constants'; import type { SubDomain } from './types'; diff --git a/src/subDomain/SubDomainPainter.ts b/src/subDomain/SubDomainPainter.ts index 5eae1cd4..d4691992 100644 --- a/src/subDomain/SubDomainPainter.ts +++ b/src/subDomain/SubDomainPainter.ts @@ -1,4 +1,4 @@ -import { Position } from '../constant'; +import { Position } from '../constants'; import type CalHeatmap from '../CalHeatmap'; import type { Timestamp, SubDomain } from '../types'; diff --git a/src/types.d.ts b/src/types.d.ts index 83bfadef..34becf79 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -3,6 +3,7 @@ import type dayjs from 'dayjs'; import type EventEmitter from 'eventemitter3'; import type Options, { OptionsType } from './options/Options'; import type DateHelper from './helpers/DateHelper'; +import type CalendarPainter from './calendar/CalendarPainter'; export type Timestamp = number; export type DomainType = @@ -14,6 +15,8 @@ export type DomainType = | 'day' | 'hour' | 'minute'; +export type TextAlign = 'start' | 'middle' | 'end'; +export type Padding = [number, number, number, number]; export type DeepPartial = T extends object ? { @@ -74,7 +77,7 @@ export interface PluginOptions { } export type PluginDefinition = [IPluginConstructor, Partial?]; -export default class CalHeatmap { +declare class CalHeatmap { static readonly VERSION = string; options: Options; @@ -83,6 +86,8 @@ export default class CalHeatmap { dateHelper: DateHelper; + calendarPainter: CalendarPainter; + constructor(); paint( @@ -108,3 +113,16 @@ export default class CalHeatmap { extendDayjs(plugin: PluginFunc): dayjs.Dayjs; } + +declare const constants: Record; +declare const helpers: { + position: { + isHorizontal(position: string): boolean + isVertical(position: string): boolean + horizontalPadding(padding: Padding): number + verticalPadding(padding: Padding): number + } +}; + +export default CalHeatmap; +export { constants, helpers }; From 955e31f06d819a5ddd56307216cff24ec5da01d7 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 19 Feb 2024 01:22:37 +0800 Subject: [PATCH 17/36] chore: remove comments --- tsconfig.json | 108 +++++--------------------------------------------- 1 file changed, 9 insertions(+), 99 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 49f5b9d6..f58200e4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,104 +1,14 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "esnext", /* Specify what module code is generated. */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "build-tsc", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "target": "es2016", + "module": "esnext", + "moduleResolution": "node", + "outDir": "build-tsc", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noUnusedParameters": true, + "skipLibCheck": true }, "include": ["./src/**/*.ts", "./test/**/*.ts", "./test/**/*.js"] } From 86765f1934c8e5d7540b795ecb8b98c55ce04faf Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 19 Feb 2024 01:23:27 +0800 Subject: [PATCH 18/36] release: release 4.3.0-beta.1 --- package.json | 2 +- src/version.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0640fb2e..ce18b9d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta-0", + "version": "4.3.0-beta-1", "description": "Cal-Heatmap is a javascript module to create calendar heatmap to visualize time series data", "keywords": [ "calendar", diff --git a/src/version.ts b/src/version.ts index 33e004e6..b132e123 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -const VERSION = '4.3.0-beta-0'; +const VERSION = '4.3.0-beta-1'; export default VERSION; From 89a3a71b4091e1616877ee202bb33934135efbf5 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 19 Feb 2024 01:28:42 +0800 Subject: [PATCH 19/36] chore: fix versioning format --- package.json | 2 +- src/version.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ce18b9d1..21f1a342 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta-1", + "version": "4.3.0-beta.1", "description": "Cal-Heatmap is a javascript module to create calendar heatmap to visualize time series data", "keywords": [ "calendar", diff --git a/src/version.ts b/src/version.ts index b132e123..caf432ef 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -const VERSION = '4.3.0-beta-1'; +const VERSION = '4.3.0-beta.1'; export default VERSION; From d75f7536882f767923c8543d58e10a011e6dfc88 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 19 Feb 2024 03:50:39 +0800 Subject: [PATCH 20/36] refactor: move more const to constants for easier reuse --- src/calendar/CalendarPainter.ts | 9 +++++---- src/constants.ts | 6 ++++++ src/domain/DomainLabelPainter.ts | 8 +++----- src/domain/DomainPainter.ts | 12 +++++------- src/subDomain/SubDomainPainter.ts | 20 +++++++++++--------- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/calendar/CalendarPainter.ts b/src/calendar/CalendarPainter.ts index 74af0e6a..eae0a1af 100644 --- a/src/calendar/CalendarPainter.ts +++ b/src/calendar/CalendarPainter.ts @@ -2,13 +2,14 @@ import { select } from 'd3-selection'; import DomainsContainerPainter from '../domain/DomainsContainerPainter'; import PluginPainter from '../plugins/PluginPainter'; +import { + ScrollDirection, + DEFAULT_CALENDAR_CONTAINER_SELECTOR, +} from '../constants'; import type CalHeatmap from '../CalHeatmap'; -import { ScrollDirection } from '../constants'; import type { Dimensions } from '../types'; -export const DEFAULT_SELECTOR = '.ch-container'; - export default class CalendarPainter { calendar: CalHeatmap; @@ -38,7 +39,7 @@ export default class CalendarPainter { this.root = select(itemSelector) .append('svg') .attr('data-theme', theme) - .attr('class', DEFAULT_SELECTOR.slice(1)); + .attr('class', DEFAULT_CALENDAR_CONTAINER_SELECTOR.slice(1)); this.domainsContainerPainter.setup(); } diff --git a/src/constants.ts b/src/constants.ts index 890cae2d..4d715fbd 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -28,3 +28,9 @@ export const SCALE_BASE_OPACITY_COLOR = 'red'; export const SCALE_BASE_COLOR_SCHEME = 'YlOrBr'; export const SCALE_BASE_COLOR_TYPE = 'quantize'; export const SCALE_BASE_COLOR_DOMAIN = [0, 100]; + +export const DEFAULT_CALENDAR_CONTAINER_SELECTOR = '.ch-container'; +export const DEFAULT_DOMAIN_SELECTOR = '.ch-domain'; +export const DEFAULT_DOMAIN_LABEL_SELECTOR = '.ch-domain-text'; +export const DEFAULT_SUBDOMAIN_SELECTOR = '.ch-subdomain'; +export const SUBDOMAIN_HIGHLIGHT_CLASSNAME = 'highlight'; diff --git a/src/domain/DomainLabelPainter.ts b/src/domain/DomainLabelPainter.ts index 7185f32c..ec3fa700 100644 --- a/src/domain/DomainLabelPainter.ts +++ b/src/domain/DomainLabelPainter.ts @@ -1,4 +1,4 @@ -import { Position } from '../constants'; +import { Position, DEFAULT_DOMAIN_LABEL_SELECTOR } from '../constants'; import { isVertical, verticalPadding, @@ -9,8 +9,6 @@ import { DOMAIN_FORMAT } from '../calendar/DomainCollection'; import type CalHeatmap from '../CalHeatmap'; import type { Timestamp } from '../types'; -const DEFAULT_SELECTOR = '.ch-domain-text'; - export default class DomainLabelPainter { calendar: CalHeatmap; @@ -31,7 +29,7 @@ export default class DomainLabelPainter { } root - .selectAll(DEFAULT_SELECTOR) + .selectAll(DEFAULT_DOMAIN_LABEL_SELECTOR) .data( (d: Timestamp) => [d], (d: Timestamp) => d, @@ -39,7 +37,7 @@ export default class DomainLabelPainter { .join( (enter: any) => enter .append('text') - .attr('class', DEFAULT_SELECTOR.slice(1)) + .attr('class', DEFAULT_DOMAIN_LABEL_SELECTOR.slice(1)) .attr('x', (d: Timestamp) => this.#getX(d)) .attr('y', (d: Timestamp) => this.#getY(d)) .attr('text-anchor', label.textAlign) diff --git a/src/domain/DomainPainter.ts b/src/domain/DomainPainter.ts index 0bd11ac5..5dadbbda 100644 --- a/src/domain/DomainPainter.ts +++ b/src/domain/DomainPainter.ts @@ -1,11 +1,9 @@ import DomainCoordinates from './DomainCoordinates'; +import { ScrollDirection, DEFAULT_DOMAIN_SELECTOR } from '../constants'; import type CalHeatmap from '../CalHeatmap'; -import type { ScrollDirection } from '../constants'; import type { Dimensions, Timestamp } from '../types'; -const DEFAULT_SELECTOR = '.ch-domain'; - export default class DomainPainter { calendar: CalHeatmap; @@ -41,7 +39,7 @@ export default class DomainPainter { const promises: Promise[] = []; this.root = rootNode - .selectAll(DEFAULT_SELECTOR) + .selectAll(DEFAULT_DOMAIN_SELECTOR) .data(this.calendar.domainCollection.keys, (d: Timestamp) => d) .join( (enter: any) => enter @@ -55,7 +53,7 @@ export default class DomainPainter { .append('rect') .attr('width', (d: Timestamp) => coor.get(d)!.inner_width) .attr('height', (d: Timestamp) => coor.get(d)!.inner_height) - .attr('class', `${DEFAULT_SELECTOR.slice(1)}-bg`)) + .attr('class', `${DEFAULT_DOMAIN_SELECTOR.slice(1)}-bg`)) .call((enterSelection: any) => promises.push( enterSelection .transition(t) @@ -75,7 +73,7 @@ export default class DomainPainter { )) .call((updateSelection: any) => promises.push( updateSelection - .selectAll(`${DEFAULT_SELECTOR}-bg`) + .selectAll(`${DEFAULT_DOMAIN_SELECTOR}-bg`) .transition(t) .attr('width', (d: Timestamp) => coor.get(d)!.inner_width) .attr('height', (d: Timestamp) => coor.get(d)!.inner_height) @@ -95,7 +93,7 @@ export default class DomainPainter { } #getClassName(d: Timestamp): string { - let classname = DEFAULT_SELECTOR.slice(1); + let classname = DEFAULT_DOMAIN_SELECTOR.slice(1); const helper = this.calendar.dateHelper.date(d); switch (this.calendar.options.options.domain.type) { diff --git a/src/subDomain/SubDomainPainter.ts b/src/subDomain/SubDomainPainter.ts index d4691992..7c17e188 100644 --- a/src/subDomain/SubDomainPainter.ts +++ b/src/subDomain/SubDomainPainter.ts @@ -1,10 +1,12 @@ -import { Position } from '../constants'; +import { + Position, + DEFAULT_SUBDOMAIN_SELECTOR, + SUBDOMAIN_HIGHLIGHT_CLASSNAME, +} from '../constants'; + import type CalHeatmap from '../CalHeatmap'; import type { Timestamp, SubDomain } from '../types'; -export const DEFAULT_SELECTOR = '.ch-subdomain'; -const HIGHLIGHT_CLASSNAME = 'highlight'; - export default class SubDomainPainter { calendar: CalHeatmap; @@ -17,7 +19,7 @@ export default class SubDomainPainter { paint(root: any): void { this.root = root || this.root; - const containerClassname = `${DEFAULT_SELECTOR}-container`; + const containerClassname = `${DEFAULT_SUBDOMAIN_SELECTOR}-container`; const subDomainSvgGroup = this.root .selectAll(containerClassname) @@ -66,7 +68,7 @@ export default class SubDomainPainter { .insert('rect') .attr('class', (d: SubDomain) => // eslint-disable-next-line implicit-arrow-linebreak - this.#classname(d.t, `${DEFAULT_SELECTOR.slice(1)}-bg`)) + this.#classname(d.t, `${DEFAULT_SUBDOMAIN_SELECTOR.slice(1)}-bg`)) .attr('width', width) .attr('height', height) .attr('x', (d: SubDomain) => this.#getX(d)) @@ -87,7 +89,7 @@ export default class SubDomainPainter { .selectAll('rect') .attr('class', (d: SubDomain) => // eslint-disable-next-line implicit-arrow-linebreak - this.#classname(d.t, `${DEFAULT_SELECTOR.slice(1)}-bg`)) + this.#classname(d.t, `${DEFAULT_SUBDOMAIN_SELECTOR.slice(1)}-bg`)) .attr('width', width) .attr('height', height) .attr('x', (d: SubDomain) => this.#getX(d)) @@ -143,7 +145,7 @@ export default class SubDomainPainter { const unitFn = this.calendar.templateCollection.get(type).extractUnit; if (unitFn(+d) === unitFn(timestamp)) { - classname = HIGHLIGHT_CLASSNAME; + classname = SUBDOMAIN_HIGHLIGHT_CLASSNAME; } }); } @@ -162,7 +164,7 @@ export default class SubDomainPainter { .append('text') .attr('class', (d: SubDomain) => // eslint-disable-next-line implicit-arrow-linebreak - this.#classname(d.t, `${DEFAULT_SELECTOR.slice(1)}-text`)) + this.#classname(d.t, `${DEFAULT_SUBDOMAIN_SELECTOR.slice(1)}-text`)) .attr('x', (d: SubDomain) => this.#getX(d) + width / 2) .attr('y', (d: SubDomain) => this.#getY(d) + height / 2) .attr('text-anchor', 'middle') From 79350112fe33116bd026f5bd322277441f7cfbd4 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 19 Feb 2024 03:59:56 +0800 Subject: [PATCH 21/36] refactor: remove DEFAULT_ prefix --- src/calendar/CalendarPainter.ts | 4 ++-- src/constants.ts | 8 ++++---- src/domain/DomainLabelPainter.ts | 6 +++--- src/domain/DomainPainter.ts | 10 +++++----- src/subDomain/SubDomainPainter.ts | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/calendar/CalendarPainter.ts b/src/calendar/CalendarPainter.ts index eae0a1af..d6fd0a82 100644 --- a/src/calendar/CalendarPainter.ts +++ b/src/calendar/CalendarPainter.ts @@ -4,7 +4,7 @@ import DomainsContainerPainter from '../domain/DomainsContainerPainter'; import PluginPainter from '../plugins/PluginPainter'; import { ScrollDirection, - DEFAULT_CALENDAR_CONTAINER_SELECTOR, + CALENDAR_CONTAINER_SELECTOR, } from '../constants'; import type CalHeatmap from '../CalHeatmap'; @@ -39,7 +39,7 @@ export default class CalendarPainter { this.root = select(itemSelector) .append('svg') .attr('data-theme', theme) - .attr('class', DEFAULT_CALENDAR_CONTAINER_SELECTOR.slice(1)); + .attr('class', CALENDAR_CONTAINER_SELECTOR.slice(1)); this.domainsContainerPainter.setup(); } diff --git a/src/constants.ts b/src/constants.ts index 4d715fbd..4da17d75 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -29,8 +29,8 @@ export const SCALE_BASE_COLOR_SCHEME = 'YlOrBr'; export const SCALE_BASE_COLOR_TYPE = 'quantize'; export const SCALE_BASE_COLOR_DOMAIN = [0, 100]; -export const DEFAULT_CALENDAR_CONTAINER_SELECTOR = '.ch-container'; -export const DEFAULT_DOMAIN_SELECTOR = '.ch-domain'; -export const DEFAULT_DOMAIN_LABEL_SELECTOR = '.ch-domain-text'; -export const DEFAULT_SUBDOMAIN_SELECTOR = '.ch-subdomain'; +export const CALENDAR_CONTAINER_SELECTOR = '.ch-container'; +export const DOMAIN_SELECTOR = '.ch-domain'; +export const DOMAIN_LABEL_SELECTOR = '.ch-domain-text'; +export const SUBDOMAIN_SELECTOR = '.ch-subdomain'; export const SUBDOMAIN_HIGHLIGHT_CLASSNAME = 'highlight'; diff --git a/src/domain/DomainLabelPainter.ts b/src/domain/DomainLabelPainter.ts index ec3fa700..70f535bd 100644 --- a/src/domain/DomainLabelPainter.ts +++ b/src/domain/DomainLabelPainter.ts @@ -1,4 +1,4 @@ -import { Position, DEFAULT_DOMAIN_LABEL_SELECTOR } from '../constants'; +import { Position, DOMAIN_LABEL_SELECTOR } from '../constants'; import { isVertical, verticalPadding, @@ -29,7 +29,7 @@ export default class DomainLabelPainter { } root - .selectAll(DEFAULT_DOMAIN_LABEL_SELECTOR) + .selectAll(DOMAIN_LABEL_SELECTOR) .data( (d: Timestamp) => [d], (d: Timestamp) => d, @@ -37,7 +37,7 @@ export default class DomainLabelPainter { .join( (enter: any) => enter .append('text') - .attr('class', DEFAULT_DOMAIN_LABEL_SELECTOR.slice(1)) + .attr('class', DOMAIN_LABEL_SELECTOR.slice(1)) .attr('x', (d: Timestamp) => this.#getX(d)) .attr('y', (d: Timestamp) => this.#getY(d)) .attr('text-anchor', label.textAlign) diff --git a/src/domain/DomainPainter.ts b/src/domain/DomainPainter.ts index 5dadbbda..be6ae571 100644 --- a/src/domain/DomainPainter.ts +++ b/src/domain/DomainPainter.ts @@ -1,5 +1,5 @@ import DomainCoordinates from './DomainCoordinates'; -import { ScrollDirection, DEFAULT_DOMAIN_SELECTOR } from '../constants'; +import { ScrollDirection, DOMAIN_SELECTOR } from '../constants'; import type CalHeatmap from '../CalHeatmap'; import type { Dimensions, Timestamp } from '../types'; @@ -39,7 +39,7 @@ export default class DomainPainter { const promises: Promise[] = []; this.root = rootNode - .selectAll(DEFAULT_DOMAIN_SELECTOR) + .selectAll(DOMAIN_SELECTOR) .data(this.calendar.domainCollection.keys, (d: Timestamp) => d) .join( (enter: any) => enter @@ -53,7 +53,7 @@ export default class DomainPainter { .append('rect') .attr('width', (d: Timestamp) => coor.get(d)!.inner_width) .attr('height', (d: Timestamp) => coor.get(d)!.inner_height) - .attr('class', `${DEFAULT_DOMAIN_SELECTOR.slice(1)}-bg`)) + .attr('class', `${DOMAIN_SELECTOR.slice(1)}-bg`)) .call((enterSelection: any) => promises.push( enterSelection .transition(t) @@ -73,7 +73,7 @@ export default class DomainPainter { )) .call((updateSelection: any) => promises.push( updateSelection - .selectAll(`${DEFAULT_DOMAIN_SELECTOR}-bg`) + .selectAll(`${DOMAIN_SELECTOR}-bg`) .transition(t) .attr('width', (d: Timestamp) => coor.get(d)!.inner_width) .attr('height', (d: Timestamp) => coor.get(d)!.inner_height) @@ -93,7 +93,7 @@ export default class DomainPainter { } #getClassName(d: Timestamp): string { - let classname = DEFAULT_DOMAIN_SELECTOR.slice(1); + let classname = DOMAIN_SELECTOR.slice(1); const helper = this.calendar.dateHelper.date(d); switch (this.calendar.options.options.domain.type) { diff --git a/src/subDomain/SubDomainPainter.ts b/src/subDomain/SubDomainPainter.ts index 7c17e188..2be2955c 100644 --- a/src/subDomain/SubDomainPainter.ts +++ b/src/subDomain/SubDomainPainter.ts @@ -1,6 +1,6 @@ import { Position, - DEFAULT_SUBDOMAIN_SELECTOR, + SUBDOMAIN_SELECTOR, SUBDOMAIN_HIGHLIGHT_CLASSNAME, } from '../constants'; @@ -19,7 +19,7 @@ export default class SubDomainPainter { paint(root: any): void { this.root = root || this.root; - const containerClassname = `${DEFAULT_SUBDOMAIN_SELECTOR}-container`; + const containerClassname = `${SUBDOMAIN_SELECTOR}-container`; const subDomainSvgGroup = this.root .selectAll(containerClassname) @@ -68,7 +68,7 @@ export default class SubDomainPainter { .insert('rect') .attr('class', (d: SubDomain) => // eslint-disable-next-line implicit-arrow-linebreak - this.#classname(d.t, `${DEFAULT_SUBDOMAIN_SELECTOR.slice(1)}-bg`)) + this.#classname(d.t, `${SUBDOMAIN_SELECTOR.slice(1)}-bg`)) .attr('width', width) .attr('height', height) .attr('x', (d: SubDomain) => this.#getX(d)) @@ -89,7 +89,7 @@ export default class SubDomainPainter { .selectAll('rect') .attr('class', (d: SubDomain) => // eslint-disable-next-line implicit-arrow-linebreak - this.#classname(d.t, `${DEFAULT_SUBDOMAIN_SELECTOR.slice(1)}-bg`)) + this.#classname(d.t, `${SUBDOMAIN_SELECTOR.slice(1)}-bg`)) .attr('width', width) .attr('height', height) .attr('x', (d: SubDomain) => this.#getX(d)) @@ -164,7 +164,7 @@ export default class SubDomainPainter { .append('text') .attr('class', (d: SubDomain) => // eslint-disable-next-line implicit-arrow-linebreak - this.#classname(d.t, `${DEFAULT_SUBDOMAIN_SELECTOR.slice(1)}-text`)) + this.#classname(d.t, `${SUBDOMAIN_SELECTOR.slice(1)}-text`)) .attr('x', (d: SubDomain) => this.#getX(d) + width / 2) .attr('y', (d: SubDomain) => this.#getY(d) + height / 2) .attr('text-anchor', 'middle') From 9dbf107b6f55bb45016ef1e2fd758ad081e68d31 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 19 Feb 2024 04:00:28 +0800 Subject: [PATCH 22/36] refactor: move scale to helper --- src/calendar/Populator.ts | 2 +- src/{scale.ts => helpers/ScaleHelper.ts} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/{scale.ts => helpers/ScaleHelper.ts} (90%) diff --git a/src/calendar/Populator.ts b/src/calendar/Populator.ts index cd966ca1..d1818506 100644 --- a/src/calendar/Populator.ts +++ b/src/calendar/Populator.ts @@ -1,6 +1,6 @@ import isFunction from 'lodash-es/isFunction'; import { hcl } from 'd3-color'; -import { normalizedScale, applyScaleStyle } from '../scale'; +import { normalizedScale, applyScaleStyle } from '../helpers/ScaleHelper'; import type CalHeatmap from '../CalHeatmap'; import type { SubDomain, Timestamp } from '../types'; diff --git a/src/scale.ts b/src/helpers/ScaleHelper.ts similarity index 90% rename from src/scale.ts rename to src/helpers/ScaleHelper.ts index 56cb0788..e925fe73 100644 --- a/src/scale.ts +++ b/src/helpers/ScaleHelper.ts @@ -1,9 +1,9 @@ // @ts-ignore import { scale } from '@observablehq/plot'; -import { OptionsType } from './options/Options'; -import { SCALE_BASE_OPACITY_COLOR } from './constants'; +import { OptionsType } from '../options/Options'; +import { SCALE_BASE_OPACITY_COLOR } from '../constants'; -import type { SubDomain } from './types'; +import type { SubDomain } from '../types'; type ValueType = string | number | undefined; From 88a266881b2b6dad1fbcb0853470f8fb17ae8f28 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 Feb 2024 00:49:17 +0000 Subject: [PATCH 23/36] chore(deps): update dependency eslint to v8.57.0 --- package-lock.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index b7f2b9bc..a6e15ba7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta-0", + "version": "4.3.0-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cal-heatmap", - "version": "4.3.0-beta-0", + "version": "4.3.0-beta.1", "license": "MIT", "dependencies": { "@observablehq/plot": "^0.6.0", @@ -2140,9 +2140,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2170,13 +2170,13 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -2197,9 +2197,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", "dev": true }, "node_modules/@isaacs/cliui": { @@ -7757,16 +7757,16 @@ } }, "node_modules/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", From 38f1407764f7afc6ef7360491bea912c5819bf5e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 Feb 2024 19:24:39 +0000 Subject: [PATCH 24/36] chore(deps): update dependency tsd to v0.30.7 --- package-lock.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index b7f2b9bc..458d19c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta-0", + "version": "4.3.0-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cal-heatmap", - "version": "4.3.0-beta-0", + "version": "4.3.0-beta.1", "license": "MIT", "dependencies": { "@observablehq/plot": "^0.6.0", @@ -17694,9 +17694,9 @@ } }, "node_modules/tsd": { - "version": "0.30.4", - "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.30.4.tgz", - "integrity": "sha512-ncC4SwAeUk0OTcXt5h8l0/gOLHJSp9ogosvOADT6QYzrl0ITm398B3wkz8YESqefIsEEwvYAU8bvo7/rcN/M0Q==", + "version": "0.30.7", + "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.30.7.tgz", + "integrity": "sha512-oTiJ28D6B/KXoU3ww/Eji+xqHJojiuPVMwA12g4KYX1O72N93Nb6P3P3h2OAhhf92Xl8NIhb/xFmBZd5zw/xUw==", "dev": true, "dependencies": { "@tsd/typescript": "~5.3.3", From c846f31168b30d498c5a7b0930a4bbb6ad36d7f4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 13:30:55 +0000 Subject: [PATCH 25/36] chore(deps): update dependency puppeteer to v22.3.0 --- package-lock.json | 246 +++++++++++++++++++++++++++------------------- 1 file changed, 146 insertions(+), 100 deletions(-) diff --git a/package-lock.json b/package-lock.json index 28e98ec6..d0f458fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3441,16 +3441,17 @@ } }, "node_modules/@puppeteer/browsers": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.0.0.tgz", - "integrity": "sha512-3PS82/5+tnpEaUWonjAFFvlf35QHF15xqyGd34GBa5oP5EPVfFXRsbSxIGYf1M+vZlqBZ3oxT1kRg9OYhtt8ng==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.1.0.tgz", + "integrity": "sha512-xloWvocjvryHdUjDam/ZuGMh7zn4Sn3ZAaV4Ah2e2EwEt90N3XphZlSsU3n0VDc1F7kggCjMuH0UuxfPQ5mD9w==", "dev": true, "dependencies": { "debug": "4.3.4", "extract-zip": "2.0.1", "progress": "2.0.3", - "proxy-agent": "6.3.1", - "tar-fs": "3.0.4", + "proxy-agent": "6.4.0", + "semver": "7.6.0", + "tar-fs": "3.0.5", "unbzip2-stream": "1.4.3", "yargs": "17.7.2" }, @@ -3461,6 +3462,39 @@ "node": ">=18" } }, + "node_modules/@puppeteer/browsers/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@puppeteer/browsers/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@puppeteer/browsers/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/@rollup/plugin-babel": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-6.0.4.tgz", @@ -5326,9 +5360,9 @@ } }, "node_modules/b4a": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", - "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==", + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", + "integrity": "sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==", "dev": true }, "node_modules/babel-jest": { @@ -5537,6 +5571,43 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bare-events": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.2.0.tgz", + "integrity": "sha512-Yyyqff4PIFfSuthCZqLlPISTWHmnQxoPuAvkmgzsJEmG3CesdIv6Xweayl0JkCZJSB2yYIdJyEz97tpxNhgjbg==", + "dev": true, + "optional": true + }, + "node_modules/bare-fs": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.2.0.tgz", + "integrity": "sha512-+VhW202E9eTVGkX7p+TNXtZC4RTzj9JfJW7PtfIbZ7mIQ/QT9uOafQTx7lx2n9ERmWsXvLHF4hStAFn4gl2mQw==", + "dev": true, + "optional": true, + "dependencies": { + "bare-events": "^2.0.0", + "bare-os": "^2.0.0", + "bare-path": "^2.0.0", + "streamx": "^2.13.0" + } + }, + "node_modules/bare-os": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.2.0.tgz", + "integrity": "sha512-hD0rOPfYWOMpVirTACt4/nK8mC55La12K5fY1ij8HAdfQakD62M+H4o4tpfKzVGLgRDTuk3vjA4GqGXXCeFbag==", + "dev": true, + "optional": true + }, + "node_modules/bare-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-2.1.0.tgz", + "integrity": "sha512-DIIg7ts8bdRKwJRJrUMy/PICEaQZaPGZ26lsSx9MJSwIhSrcdHn7/C8W+XmnG/rKi6BaRcz+JO00CjZteybDtw==", + "dev": true, + "optional": true, + "dependencies": { + "bare-os": "^2.1.0" + } + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -6140,9 +6211,9 @@ } }, "node_modules/chromium-bidi": { - "version": "0.5.8", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.5.8.tgz", - "integrity": "sha512-blqh+1cEQbHBKmok3rVJkBlBxt9beKBgOsxbFgs7UJcoVbbeZ+K7+6liAsjgpc8l1Xd55cQUy14fXZdGSb4zIw==", + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.5.10.tgz", + "integrity": "sha512-4hsPE1VaLLM/sgNK/SlLbI24Ra7ZOuWAjA3rhw1lVCZ8ZiUgccS6cL5L/iqo4hjRcl5vwgYJ8xTtbXdulA9b6Q==", "dev": true, "dependencies": { "mitt": "3.0.1", @@ -7189,9 +7260,9 @@ } }, "node_modules/data-uri-to-buffer": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.1.tgz", - "integrity": "sha512-MZd3VlchQkp8rdend6vrx7MmVDJzSNTBvghvKjirLkD+WTChA3KUf0jkE68Q4UyctNqI11zZO9/x2Yx+ub5Cvg==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", "dev": true, "engines": { "node": ">= 14" @@ -7404,9 +7475,9 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1232444", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1232444.tgz", - "integrity": "sha512-pM27vqEfxSxRkTMnF+XCmxSEb6duO5R+t8A9DEEJgy4Wz2RVanje2mmj99B6A3zv2r/qGfYlOvYznUhuokizmg==", + "version": "0.0.1249869", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1249869.tgz", + "integrity": "sha512-Ctp4hInA0BEavlUoRy9mhGq0i+JSo/AwVyX2EFgZmV1kYB+Zq+EMBAn52QWu6FbRr10hRb6pBl420upbp4++vg==", "dev": true }, "node_modules/diff": { @@ -9162,50 +9233,32 @@ } }, "node_modules/get-uri": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.2.tgz", - "integrity": "sha512-5KLucCJobh8vBY1K07EFV4+cPZH3mrV9YeAruUseCQKHB58SGjjT2l9/eA9LD082IiuMjSlFJEcdJ27TXvbZNw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz", + "integrity": "sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==", "dev": true, "dependencies": { "basic-ftp": "^5.0.2", - "data-uri-to-buffer": "^6.0.0", + "data-uri-to-buffer": "^6.0.2", "debug": "^4.3.4", - "fs-extra": "^8.1.0" + "fs-extra": "^11.2.0" }, "engines": { "node": ">= 14" } }, "node_modules/get-uri/node_modules/fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", "dev": true, "dependencies": { "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" }, "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/get-uri/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/get-uri/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" + "node": ">=14.14" } }, "node_modules/glob": { @@ -13575,12 +13628,6 @@ "node": ">=10" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -14497,9 +14544,9 @@ } }, "node_modules/pac-proxy-agent/node_modules/http-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", - "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, "dependencies": { "agent-base": "^7.1.0", @@ -14510,9 +14557,9 @@ } }, "node_modules/pac-proxy-agent/node_modules/https-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", - "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", "dev": true, "dependencies": { "agent-base": "^7.0.2", @@ -14537,25 +14584,18 @@ } }, "node_modules/pac-resolver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.0.tgz", - "integrity": "sha512-Fd9lT9vJbHYRACT8OhCbZBbxr6KRSawSovFpy8nDGshaK99S/EBhVIHp9+crhxrsZOuvLpgL1n23iyPg6Rl2hg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", "dev": true, "dependencies": { "degenerator": "^5.0.0", - "ip": "^1.1.8", "netmask": "^2.0.2" }, "engines": { "node": ">= 14" } }, - "node_modules/pac-resolver/node_modules/ip": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", - "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==", - "dev": true - }, "node_modules/pacote": { "version": "15.2.0", "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.2.0.tgz", @@ -15520,15 +15560,15 @@ } }, "node_modules/proxy-agent": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.3.1.tgz", - "integrity": "sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz", + "integrity": "sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==", "dev": true, "dependencies": { "agent-base": "^7.0.2", "debug": "^4.3.4", - "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.2", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.3", "lru-cache": "^7.14.1", "pac-proxy-agent": "^7.0.1", "proxy-from-env": "^1.1.0", @@ -15551,9 +15591,9 @@ } }, "node_modules/proxy-agent/node_modules/http-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.0.tgz", - "integrity": "sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, "dependencies": { "agent-base": "^7.1.0", @@ -15564,9 +15604,9 @@ } }, "node_modules/proxy-agent/node_modules/https-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz", - "integrity": "sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", "dev": true, "dependencies": { "agent-base": "^7.0.2", @@ -15646,15 +15686,15 @@ } }, "node_modules/puppeteer": { - "version": "22.0.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.0.0.tgz", - "integrity": "sha512-zYVnjwJngnSB4dbkWp7DHFSIc3nqHvZzrdHyo9+ugV1nq1Lm8obOMcmCFaGfR3PJs0EmYNz+/skBeO45yvASCQ==", + "version": "22.3.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.3.0.tgz", + "integrity": "sha512-GC+tyjzYKjaNjhlDAuqRgDM+IOsqOG75Da4L28G4eULNLLxKDt+79x2OOSQ47HheJBgGq7ATSExNE6gayxP6cg==", "dev": true, "hasInstallScript": true, "dependencies": { - "@puppeteer/browsers": "2.0.0", + "@puppeteer/browsers": "2.1.0", "cosmiconfig": "9.0.0", - "puppeteer-core": "22.0.0" + "puppeteer-core": "22.3.0" }, "bin": { "puppeteer": "lib/esm/puppeteer/node/cli.js" @@ -15664,16 +15704,16 @@ } }, "node_modules/puppeteer-core": { - "version": "22.0.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.0.0.tgz", - "integrity": "sha512-S3s91rLde0A86PWVeNY82h+P0fdS7CTiNWAicCVH/bIspRP4nS2PnO5j+VTFqCah0ZJizGzpVPAmxVYbLxTc9w==", + "version": "22.3.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.3.0.tgz", + "integrity": "sha512-Ho5Vdpdro05ZyCx/l5Hkc5vHiibKTaY37fIAD9NF9Gi/vDxkVTeX40U/mFnEmeoxyuYALvWCJfi7JTT82R6Tuw==", "dev": true, "dependencies": { - "@puppeteer/browsers": "2.0.0", - "chromium-bidi": "0.5.8", + "@puppeteer/browsers": "2.1.0", + "chromium-bidi": "0.5.10", "cross-fetch": "4.0.0", "debug": "4.3.4", - "devtools-protocol": "0.0.1232444", + "devtools-protocol": "0.0.1249869", "ws": "8.16.0" }, "engines": { @@ -16954,13 +16994,16 @@ } }, "node_modules/streamx": { - "version": "2.15.5", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.5.tgz", - "integrity": "sha512-9thPGMkKC2GctCzyCUjME3yR03x2xNo0GPKGkRw2UMYN+gqWa9uqpyNWhmsNCutU5zHmkUum0LsCRQTXUgUCAg==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.16.1.tgz", + "integrity": "sha512-m9QYj6WygWyWa3H1YY69amr4nVgy61xfjys7xO7kviL5rfIEc2naf+ewFiOA+aEJD7y0JO3h2GoiUv4TDwEGzQ==", "dev": true, "dependencies": { "fast-fifo": "^1.1.0", "queue-tick": "^1.0.1" + }, + "optionalDependencies": { + "bare-events": "^2.2.0" } }, "node_modules/string_decoder": { @@ -17257,20 +17300,23 @@ } }, "node_modules/tar-fs": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", - "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.5.tgz", + "integrity": "sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==", "dev": true, "dependencies": { - "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^2.1.1", + "bare-path": "^2.1.0" } }, "node_modules/tar-stream": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz", - "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", "dev": true, "dependencies": { "b4a": "^1.6.4", From 2aa2cf23b9cb6291e8f31ba1d2f87dbc4ef5f064 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 01:07:46 +0000 Subject: [PATCH 26/36] chore(deps): update dependency autoprefixer to v10.4.18 --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 28e98ec6..d12cbb6a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5266,9 +5266,9 @@ } }, "node_modules/autoprefixer": { - "version": "10.4.17", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.17.tgz", - "integrity": "sha512-/cpVNRLSfhOtcGflT13P2794gVSgmPgTR+erw5ifnMLZb0UnSlkK4tquLmkd3BhA+nLo5tX8Cu0upUsGKvKbmg==", + "version": "10.4.18", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.18.tgz", + "integrity": "sha512-1DKbDfsr6KUElM6wg+0zRNkB/Q7WcKYAaK+pzXn+Xqmszm/5Xa9coeNdtP88Vi+dPzZnMjhge8GIV49ZQkDa+g==", "dev": true, "funding": [ { @@ -5285,8 +5285,8 @@ } ], "dependencies": { - "browserslist": "^4.22.2", - "caniuse-lite": "^1.0.30001578", + "browserslist": "^4.23.0", + "caniuse-lite": "^1.0.30001591", "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", "picocolors": "^1.0.0", @@ -6043,9 +6043,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001587", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", - "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", + "version": "1.0.30001591", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz", + "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==", "dev": true, "funding": [ { From d426dba131786409dc3475e095856236aea84438 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 01:07:54 +0000 Subject: [PATCH 27/36] chore(deps): update dependency @babel/preset-env to v7.24.0 --- package-lock.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 28e98ec6..ebae51e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -337,9 +337,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz", + "integrity": "sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -1304,14 +1304,14 @@ } }, "node_modules/@babel/plugin-transform-object-rest-spread": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz", - "integrity": "sha512-9x9K1YyeQVw0iOXJlIzwm8ltobIIv7j2iLyP2jIhEbqPRQ7ScNgwQufU2I0Gq11VjyG4gI4yMXt2VFags+1N3g==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.0.tgz", + "integrity": "sha512-y/yKMm7buHpFFXfxVFS4Vk1ToRJDilIa6fKRioB9Vjichv58TDGXTvqV0dN7plobAmTW5eSEGXDngE+Mm+uO+w==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.23.3", - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/compat-data": "^7.23.5", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", "@babel/plugin-transform-parameters": "^7.23.3" }, @@ -1606,14 +1606,14 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.23.9.tgz", - "integrity": "sha512-3kBGTNBBk9DQiPoXYS0g0BYlwTQYUTifqgKTjxUwEUkduRT2QOa0FPGBJ+NROQhGyYO5BuTJwGvBnqKDykac6A==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.24.0.tgz", + "integrity": "sha512-ZxPEzV9IgvGn73iK0E6VB9/95Nd7aMFpbE0l8KQFDG70cOV9IxRP7Y2FUPmlK0v6ImlLqYX50iuZ3ZTVhOF2lA==", "dev": true, "dependencies": { "@babel/compat-data": "^7.23.5", "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/helper-validator-option": "^7.23.5", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.23.3", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.23.3", @@ -1666,7 +1666,7 @@ "@babel/plugin-transform-new-target": "^7.23.3", "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", "@babel/plugin-transform-numeric-separator": "^7.23.4", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", "@babel/plugin-transform-object-super": "^7.23.3", "@babel/plugin-transform-optional-catch-binding": "^7.23.4", "@babel/plugin-transform-optional-chaining": "^7.23.4", From 76b33795001d84cace58ccddfb6a952175b77915 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Sun, 3 Mar 2024 21:26:32 +0800 Subject: [PATCH 28/36] fix: add scale to helpers --- src/helpers/ScaleHelper.ts | 2 +- src/types.d.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/helpers/ScaleHelper.ts b/src/helpers/ScaleHelper.ts index e925fe73..3c77af50 100644 --- a/src/helpers/ScaleHelper.ts +++ b/src/helpers/ScaleHelper.ts @@ -44,7 +44,7 @@ export function applyScaleStyle( _scale: any, scaleOptions: OptionsType['scale'], keyname?: string, -) { +): void { Object.entries(scaleStyle(_scale, scaleOptions)).forEach(([prop, val]) => // eslint-disable-next-line implicit-arrow-linebreak elem.style(prop, (d: SubDomain | string) => diff --git a/src/types.d.ts b/src/types.d.ts index 34becf79..65ea5d3c 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -121,6 +121,15 @@ declare const helpers: { isVertical(position: string): boolean horizontalPadding(padding: Padding): number verticalPadding(padding: Padding): number + }, + scale: { + normalizedScale(scaleOptions: OptionsType['scale']): any + applyScaleStyle( + elem: any, + _scale: any, + scaleOptions: OptionsType['scale'], + keyname?: string, + ): void } }; From ddb6899a6d34346ca272735c382886c9ae826918 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Sun, 3 Mar 2024 21:29:36 +0800 Subject: [PATCH 29/36] release: release 4.3.0-beta.2 --- package.json | 2 +- src/version.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 21f1a342..7ee0aeb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta.1", + "version": "4.3.0-beta.2", "description": "Cal-Heatmap is a javascript module to create calendar heatmap to visualize time series data", "keywords": [ "calendar", diff --git a/src/version.ts b/src/version.ts index caf432ef..d4dbe556 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -const VERSION = '4.3.0-beta.1'; +const VERSION = '4.3.0-beta.2'; export default VERSION; From 63b3642eb8945219c85a87fa9e0e3734bcd8471b Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 4 Mar 2024 01:27:37 +0800 Subject: [PATCH 30/36] fix: `plugins` params now expect an array of plugin instance --- src/CalHeatmap.ts | 7 ++++--- src/plugins/PluginManager.ts | 32 ++++++++++---------------------- src/types.d.ts | 8 ++------ 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/CalHeatmap.ts b/src/CalHeatmap.ts index 49edc9ee..ea53214c 100755 --- a/src/CalHeatmap.ts +++ b/src/CalHeatmap.ts @@ -22,7 +22,7 @@ import type { OptionsType } from './options/Options'; import type { Template, Dimensions, - PluginDefinition, + IPlugin, Timestamp, DeepPartial, } from './types'; @@ -91,12 +91,13 @@ export default class CalHeatmap { * Setup and paint the calendar with the given options * * @param {Object} options The Options object + * @param {Array} plugins An optional array of plugins to add to the calendar * @return A Promise, which will fulfill once all the underlying asynchronous * tasks settle, whether resolved or rejected. */ async paint( options?: DeepPartial, - plugins?: PluginDefinition[] | PluginDefinition, + plugins?: IPlugin[] | IPlugin, ): Promise { this.options.init(options); await this.dateHelper.setup(this.options); @@ -110,7 +111,7 @@ export default class CalHeatmap { } if (plugins) { - this.pluginManager.add(castArray(plugins as any) as PluginDefinition[]); + this.pluginManager.add(castArray(plugins)); } this.calendarPainter.setup(); diff --git a/src/plugins/PluginManager.ts b/src/plugins/PluginManager.ts index 0a44ac63..b27a7d51 100644 --- a/src/plugins/PluginManager.ts +++ b/src/plugins/PluginManager.ts @@ -2,10 +2,8 @@ import isEqual from 'lodash-es/isEqual'; import type CalHeatmap from '../CalHeatmap'; import { - PluginDefinition, - PluginOptions, - IPluginConstructor, IPlugin, + PluginOptions, } from '../types'; type PluginSetting = { @@ -13,18 +11,8 @@ type PluginSetting = { dirty: boolean; }; -function createPlugin( - Creator: IPluginConstructor, - calendar: CalHeatmap, -): IPlugin { - return new Creator(calendar); -} - -function extractPluginName( - PluginClass: IPluginConstructor, - options?: PluginOptions, -): string { - return `${PluginClass.name}${options?.key || ''}`; +function extractPluginName(plugin: IPlugin): string { + return `${plugin.constructor.name}${plugin.options?.key || ''}`; } export default class PluginManager { @@ -43,27 +31,27 @@ export default class PluginManager { this.pendingPaint = new Set(); } - add(plugins: PluginDefinition[]): void { - plugins.forEach(([PluginClass, pluginOptions]) => { - const name = extractPluginName(PluginClass, pluginOptions); + add(plugins: IPlugin[]): void { + plugins.forEach((plugin) => { + const name = extractPluginName(plugin); const existingPlugin = this.plugins.get(name); if ( existingPlugin && this.settings.get(name) && - isEqual(this.settings.get(name)!.options, pluginOptions) + isEqual(this.settings.get(name)!.options, plugin.options) ) { return; } this.settings.set(name, { - options: pluginOptions, + options: plugin.options, dirty: true, }); if (!this.plugins.has(name)) { - this.plugins.set(name, createPlugin(PluginClass, this.calendar)); + this.plugins.set(name, plugin); } this.pendingPaint.add(this.plugins.get(name)!); @@ -76,7 +64,7 @@ export default class PluginManager { if (typeof settings !== 'undefined') { if (settings.dirty) { - pluginInstance.setup(settings.options); + pluginInstance.setup(this.calendar, settings.options); settings.dirty = false; this.settings.set(name, settings); diff --git a/src/types.d.ts b/src/types.d.ts index 65ea5d3c..ec00d2af 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -62,20 +62,16 @@ export interface IPlugin { options: PluginOptions; root: any; - setup: (options?: PluginOptions) => void; + setup: (calendar: CalHeatmap, options?: PluginOptions) => void; paint: () => Promise; destroy: () => Promise; } -export interface IPluginConstructor { - new (calendar?: CalHeatmap): IPlugin; -} export interface PluginOptions { position?: 'top' | 'right' | 'bottom' | 'left'; dimensions?: Dimensions; key?: string; } -export type PluginDefinition = [IPluginConstructor, Partial?]; declare class CalHeatmap { static readonly VERSION = string; @@ -92,7 +88,7 @@ declare class CalHeatmap { paint( options?: DeepPartial, - plugins?: PluginDefinition[] | PluginDefinition, + plugins?: IPlugin[], ): Promise; addTemplates(templates: Template | Template[]): void; From c0374bbb2136c93287d4ae36f251350db31c9b7d Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 4 Mar 2024 01:28:28 +0800 Subject: [PATCH 31/36] fix: update d3 types --- package-lock.json | 238 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 5 +- 2 files changed, 230 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 28e98ec6..1040ceda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta.1", + "version": "4.3.0-beta.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cal-heatmap", - "version": "4.3.0-beta.1", + "version": "4.3.0-beta.2", "license": "MIT", "dependencies": { "@observablehq/plot": "^0.6.0", @@ -28,10 +28,7 @@ "@rollup/plugin-replace": "^5.0.1", "@rollup/plugin-terser": "^0.4.0", "@rollup/plugin-typescript": "^11.0.0", - "@types/d3-color": "^3.1.0", - "@types/d3-fetch": "^3.0.1", - "@types/d3-selection": "^3.0.3", - "@types/d3-transition": "^3.0.2", + "@types/d3": "^7.4.3", "@types/jest": "^29.2.4", "@types/lodash-es": "^4.17.6", "@types/selenium-webdriver": "^4.1.10", @@ -4043,16 +4040,121 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/d3": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz", + "integrity": "sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==", + "dev": true, + "dependencies": { + "@types/d3-array": "*", + "@types/d3-axis": "*", + "@types/d3-brush": "*", + "@types/d3-chord": "*", + "@types/d3-color": "*", + "@types/d3-contour": "*", + "@types/d3-delaunay": "*", + "@types/d3-dispatch": "*", + "@types/d3-drag": "*", + "@types/d3-dsv": "*", + "@types/d3-ease": "*", + "@types/d3-fetch": "*", + "@types/d3-force": "*", + "@types/d3-format": "*", + "@types/d3-geo": "*", + "@types/d3-hierarchy": "*", + "@types/d3-interpolate": "*", + "@types/d3-path": "*", + "@types/d3-polygon": "*", + "@types/d3-quadtree": "*", + "@types/d3-random": "*", + "@types/d3-scale": "*", + "@types/d3-scale-chromatic": "*", + "@types/d3-selection": "*", + "@types/d3-shape": "*", + "@types/d3-time": "*", + "@types/d3-time-format": "*", + "@types/d3-timer": "*", + "@types/d3-transition": "*", + "@types/d3-zoom": "*" + } + }, + "node_modules/@types/d3-array": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.1.tgz", + "integrity": "sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg==", + "dev": true + }, + "node_modules/@types/d3-axis": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.6.tgz", + "integrity": "sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-brush": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.6.tgz", + "integrity": "sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-chord": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.6.tgz", + "integrity": "sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==", + "dev": true + }, "node_modules/@types/d3-color": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", "dev": true }, + "node_modules/@types/d3-contour": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-3.0.6.tgz", + "integrity": "sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==", + "dev": true, + "dependencies": { + "@types/d3-array": "*", + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-delaunay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz", + "integrity": "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==", + "dev": true + }, + "node_modules/@types/d3-dispatch": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.6.tgz", + "integrity": "sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==", + "dev": true + }, + "node_modules/@types/d3-drag": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.7.tgz", + "integrity": "sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, "node_modules/@types/d3-dsv": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.1.tgz", - "integrity": "sha512-76pBHCMTvPLt44wFOieouXcGXWOF0AJCceUvaFkxSZEu4VDUdv93JfpMa6VGNFs01FHfuP4a5Ou68eRG1KBfTw==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.7.tgz", + "integrity": "sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g==", + "dev": true + }, + "node_modules/@types/d3-ease": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", "dev": true }, "node_modules/@types/d3-fetch": { @@ -4064,12 +4166,114 @@ "@types/d3-dsv": "*" } }, + "node_modules/@types/d3-force": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.9.tgz", + "integrity": "sha512-IKtvyFdb4Q0LWna6ymywQsEYjK/94SGhPrMfEr1TIc5OBeziTi+1jcCvttts8e0UWZIxpasjnQk9MNk/3iS+kA==", + "dev": true + }, + "node_modules/@types/d3-format": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.4.tgz", + "integrity": "sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==", + "dev": true + }, + "node_modules/@types/d3-geo": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.1.0.tgz", + "integrity": "sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==", + "dev": true, + "dependencies": { + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-hierarchy": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.1.6.tgz", + "integrity": "sha512-qlmD/8aMk5xGorUvTUWHCiumvgaUXYldYjNVOWtYoTYY/L+WwIEAmJxUmTgr9LoGNG0PPAOmqMDJVDPc7DOpPw==", + "dev": true + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", + "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", + "dev": true, + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-P2dlU/q51fkOc/Gfl3Ul9kicV7l+ra934qBFXCFhrZMOL6du1TM0pm1ThYvENukyOn5h9v+yMJ9Fn5JK4QozrQ==", + "dev": true + }, + "node_modules/@types/d3-polygon": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.2.tgz", + "integrity": "sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==", + "dev": true + }, + "node_modules/@types/d3-quadtree": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.6.tgz", + "integrity": "sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==", + "dev": true + }, + "node_modules/@types/d3-random": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.3.tgz", + "integrity": "sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==", + "dev": true + }, + "node_modules/@types/d3-scale": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz", + "integrity": "sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ==", + "dev": true, + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-scale-chromatic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.0.3.tgz", + "integrity": "sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==", + "dev": true + }, "node_modules/@types/d3-selection": { "version": "3.0.10", "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.10.tgz", "integrity": "sha512-cuHoUgS/V3hLdjJOLTT691+G2QoqAjCVLmr4kJXR4ha56w1Zdu8UUQ5TxLRqudgNjwXeQxKMq4j+lyf9sWuslg==", "dev": true }, + "node_modules/@types/d3-shape": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.6.tgz", + "integrity": "sha512-5KKk5aKGu2I+O6SONMYSNflgiP0WfZIQvVUMan50wHsLG1G94JlxEVnCpQARfTtzytuY0p/9PXXZb3I7giofIA==", + "dev": true, + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.3.tgz", + "integrity": "sha512-2p6olUZ4w3s+07q3Tm2dbiMZy5pCDfYwtLXXHUnVzXgQlZ/OyPtUz6OL382BkOuGlLXqfT+wqv8Fw2v8/0geBw==", + "dev": true + }, + "node_modules/@types/d3-time-format": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.3.tgz", + "integrity": "sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==", + "dev": true + }, + "node_modules/@types/d3-timer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", + "dev": true + }, "node_modules/@types/d3-transition": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.8.tgz", @@ -4079,12 +4283,28 @@ "@types/d3-selection": "*" } }, + "node_modules/@types/d3-zoom": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.8.tgz", + "integrity": "sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==", + "dev": true, + "dependencies": { + "@types/d3-interpolate": "*", + "@types/d3-selection": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, + "node_modules/@types/geojson": { + "version": "7946.0.14", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", + "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==", + "dev": true + }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", diff --git a/package.json b/package.json index 7ee0aeb4..19a5b885 100644 --- a/package.json +++ b/package.json @@ -44,10 +44,7 @@ "@rollup/plugin-replace": "^5.0.1", "@rollup/plugin-terser": "^0.4.0", "@rollup/plugin-typescript": "^11.0.0", - "@types/d3-color": "^3.1.0", - "@types/d3-fetch": "^3.0.1", - "@types/d3-selection": "^3.0.3", - "@types/d3-transition": "^3.0.2", + "@types/d3": "^7.4.3", "@types/jest": "^29.2.4", "@types/lodash-es": "^4.17.6", "@types/selenium-webdriver": "^4.1.10", From 3ed0d722f5ee15cfacb7621f38296869d136cb65 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 4 Mar 2024 01:29:30 +0800 Subject: [PATCH 32/36] release: release 4.3.0-beta.3 --- package-lock.json | 4 ++-- package.json | 2 +- src/version.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1040ceda..cd2ef0ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta.2", + "version": "4.3.0-beta.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cal-heatmap", - "version": "4.3.0-beta.2", + "version": "4.3.0-beta.3", "license": "MIT", "dependencies": { "@observablehq/plot": "^0.6.0", diff --git a/package.json b/package.json index 19a5b885..e95e6f0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta.2", + "version": "4.3.0-beta.3", "description": "Cal-Heatmap is a javascript module to create calendar heatmap to visualize time series data", "keywords": [ "calendar", diff --git a/src/version.ts b/src/version.ts index d4dbe556..4f48b53a 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -const VERSION = '4.3.0-beta.2'; +const VERSION = '4.3.0-beta.3'; export default VERSION; From 885c0bd0b4f8bac4491386b042c1b6d066bf4d33 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 3 Mar 2024 17:30:05 +0000 Subject: [PATCH 33/36] chore(deps): update dependency sass to v1.71.1 --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index cd2ef0ef..8df3c8f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16768,9 +16768,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sass": { - "version": "1.71.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.71.0.tgz", - "integrity": "sha512-HKKIKf49Vkxlrav3F/w6qRuPcmImGVbIXJ2I3Kg0VMA+3Bav+8yE9G5XmP5lMj6nl4OlqbPftGAscNaNu28b8w==", + "version": "1.71.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.71.1.tgz", + "integrity": "sha512-wovtnV2PxzteLlfNzbgm1tFXPLoZILYAMJtvoXXkD7/+1uP41eKkIt1ypWq5/q2uT94qHjXehEYfmjKOvjL9sg==", "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0", From 64e315bd777f79c62409dbb5e41fd2325b50fd71 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 3 Mar 2024 17:30:21 +0000 Subject: [PATCH 34/36] chore(deps): update dependency selenium-webdriver to v4.18.1 --- package-lock.json | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index cd2ef0ef..063851ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16797,9 +16797,9 @@ } }, "node_modules/selenium-webdriver": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.17.0.tgz", - "integrity": "sha512-e2E+2XBlGepzwgFbyQfSwo9Cbj6G5fFfs9MzAS00nC99EewmcS2rwn2MwtgfP7I5p1e7DYv4HQJXtWedsu6DvA==", + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.18.1.tgz", + "integrity": "sha512-uP4OJ5wR4+VjdTi5oi/k8oieV2fIhVdVuaOPrklKghgS59w7Zz3nGa5gcG73VcU9EBRv5IZEBRhPr7qFJAj5mQ==", "dev": true, "dependencies": { "jszip": "^3.10.1", @@ -16811,15 +16811,12 @@ } }, "node_modules/selenium-webdriver/node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", + "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", "dev": true, - "dependencies": { - "rimraf": "^3.0.0" - }, "engines": { - "node": ">=8.17.0" + "node": ">=14.14" } }, "node_modules/semver": { From 83c9083c4b9690e0022d7ca80e6945f8d39e1c3b Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 4 Mar 2024 02:14:50 +0800 Subject: [PATCH 35/36] fix: fix missing scaleHelper export --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index f0104c11..49761a4c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,9 @@ import CalHeatmap from './CalHeatmap'; import * as constants from './constants'; import * as positionHelpers from './helpers/PositionHelper'; +import * as scaleHelpers from './helpers/ScaleHelper'; -const helpers = { position: positionHelpers }; +const helpers = { position: positionHelpers, scale: scaleHelpers }; export default CalHeatmap; export { constants, helpers }; From 940612f9a78113c5e78e6a15915e6bbcd64d5366 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Mon, 4 Mar 2024 02:15:37 +0800 Subject: [PATCH 36/36] release: release 4.3.0-beta.4 --- package-lock.json | 4 ++-- package.json | 2 +- src/version.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index cd2ef0ef..d9811b51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta.3", + "version": "4.3.0-beta.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cal-heatmap", - "version": "4.3.0-beta.3", + "version": "4.3.0-beta.4", "license": "MIT", "dependencies": { "@observablehq/plot": "^0.6.0", diff --git a/package.json b/package.json index e95e6f0e..bedbb483 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cal-heatmap", - "version": "4.3.0-beta.3", + "version": "4.3.0-beta.4", "description": "Cal-Heatmap is a javascript module to create calendar heatmap to visualize time series data", "keywords": [ "calendar", diff --git a/src/version.ts b/src/version.ts index 4f48b53a..85de6a73 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ -const VERSION = '4.3.0-beta.3'; +const VERSION = '4.3.0-beta.4'; export default VERSION;