@d3plus/core 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4112,7 +4112,7 @@ This is a global class, and extends all of the methods and functionality of [<co
4112
4112
  * [.snapping([*value*])](#Timeline.snapping) ↩︎
4113
4113
 
4114
4114
 
4115
- <a name="Timeline.render" href="#Timeline.render">#</a> Timeline.**render**([*callback*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L377)
4115
+ <a name="Timeline.render" href="#Timeline.render">#</a> Timeline.**render**([*callback*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L457)
4116
4116
 
4117
4117
  Draws the timeline.
4118
4118
 
@@ -4120,7 +4120,7 @@ Draws the timeline.
4120
4120
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4121
4121
 
4122
4122
 
4123
- <a name="Timeline.buttonPadding" href="#Timeline.buttonPadding">#</a> Timeline.**buttonPadding**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L529)
4123
+ <a name="Timeline.buttonPadding" href="#Timeline.buttonPadding">#</a> Timeline.**buttonPadding**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L667)
4124
4124
 
4125
4125
  If *value* is specified, sets the button padding and returns the current class instance. If *value* is not specified, returns the current button padding.
4126
4126
 
@@ -4128,7 +4128,7 @@ If *value* is specified, sets the button padding and returns the current class i
4128
4128
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4129
4129
 
4130
4130
 
4131
- <a name="Timeline.brushing" href="#Timeline.brushing">#</a> Timeline.**brushing**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L539)
4131
+ <a name="Timeline.brushing" href="#Timeline.brushing">#</a> Timeline.**brushing**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L679)
4132
4132
 
4133
4133
  If *value* is specified, toggles the brushing value and returns the current class instance. If *value* is not specified, returns the current brushing value.
4134
4134
 
@@ -4136,7 +4136,7 @@ If *value* is specified, toggles the brushing value and returns the current clas
4136
4136
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4137
4137
 
4138
4138
 
4139
- <a name="Timeline.brushFilter" href="#Timeline.brushFilter">#</a> Timeline.**brushFilter**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L553)
4139
+ <a name="Timeline.brushFilter" href="#Timeline.brushFilter">#</a> Timeline.**brushFilter**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L693)
4140
4140
 
4141
4141
  If *value* is specified, sets the brush event filter and returns the current class instance. If *value* is not specified, returns the current brush event filter.
4142
4142
 
@@ -4151,7 +4151,7 @@ function() {
4151
4151
  ```
4152
4152
 
4153
4153
 
4154
- <a name="Timeline.brushMin" href="#Timeline.brushMin">#</a> Timeline.**brushMin**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L563)
4154
+ <a name="Timeline.brushMin" href="#Timeline.brushMin">#</a> Timeline.**brushMin**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L705)
4155
4155
 
4156
4156
  Sets the minimum number of "ticks" to allow to be highlighted when using "ticks" buttonBehavior. Helpful when using x/y plots where you don't want the user to select less than 2 time periods. Value passed can either be a static Number, or a function that is expected to return a Number.
4157
4157
 
@@ -4159,7 +4159,7 @@ Sets the minimum number of "ticks" to allow to be highlighted when using "ticks"
4159
4159
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4160
4160
 
4161
4161
 
4162
- <a name="Timeline.buttonAlign" href="#Timeline.buttonAlign">#</a> Timeline.**buttonAlign**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L573)
4162
+ <a name="Timeline.buttonAlign" href="#Timeline.buttonAlign">#</a> Timeline.**buttonAlign**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L717)
4163
4163
 
4164
4164
  If *value* is specified, toggles the horizontal alignment of the button timeline. Accepted values are `"start"`, `"middle"` and `"end"`. If *value* is not specified, returns the current button value.
4165
4165
 
@@ -4167,7 +4167,7 @@ If *value* is specified, toggles the horizontal alignment of the button timeline
4167
4167
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4168
4168
 
4169
4169
 
4170
- <a name="Timeline.buttonBehavior" href="#Timeline.buttonBehavior">#</a> Timeline.**buttonBehavior**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L583)
4170
+ <a name="Timeline.buttonBehavior" href="#Timeline.buttonBehavior">#</a> Timeline.**buttonBehavior**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L729)
4171
4171
 
4172
4172
  If *value* is specified, toggles the style of the timeline. Accepted values are `"auto"`, `"buttons"` and `"ticks"`. If *value* is not specified, returns the current button value.
4173
4173
 
@@ -4175,7 +4175,7 @@ If *value* is specified, toggles the style of the timeline. Accepted values are
4175
4175
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4176
4176
 
4177
4177
 
4178
- <a name="Timeline.buttonHeight" href="#Timeline.buttonHeight">#</a> Timeline.**buttonHeight**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L593)
4178
+ <a name="Timeline.buttonHeight" href="#Timeline.buttonHeight">#</a> Timeline.**buttonHeight**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L741)
4179
4179
 
4180
4180
  If *value* is specified, sets the button height and returns the current class instance. If *value* is not specified, returns the current button height.
4181
4181
 
@@ -4183,7 +4183,7 @@ If *value* is specified, sets the button height and returns the current class in
4183
4183
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4184
4184
 
4185
4185
 
4186
- <a name="Timeline.handleConfig" href="#Timeline.handleConfig">#</a> Timeline.**handleConfig**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L603)
4186
+ <a name="Timeline.handleConfig" href="#Timeline.handleConfig">#</a> Timeline.**handleConfig**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L753)
4187
4187
 
4188
4188
  If *value* is specified, sets the handle style and returns the current class instance. If *value* is not specified, returns the current handle style.
4189
4189
 
@@ -4191,7 +4191,7 @@ If *value* is specified, sets the handle style and returns the current class ins
4191
4191
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4192
4192
 
4193
4193
 
4194
- <a name="Timeline.handleSize" href="#Timeline.handleSize">#</a> Timeline.**handleSize**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L613)
4194
+ <a name="Timeline.handleSize" href="#Timeline.handleSize">#</a> Timeline.**handleSize**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L765)
4195
4195
 
4196
4196
  If *value* is specified, sets the handle size and returns the current class instance. If *value* is not specified, returns the current handle size.
4197
4197
 
@@ -4199,7 +4199,7 @@ If *value* is specified, sets the handle size and returns the current class inst
4199
4199
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4200
4200
 
4201
4201
 
4202
- <a name="Timeline.on" href="#Timeline.on">#</a> Timeline.**on**([*typename*], [*listener*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L624)
4202
+ <a name="Timeline.on" href="#Timeline.on">#</a> Timeline.**on**([*typename*], [*listener*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L776)
4203
4203
 
4204
4204
  Adds or removes a *listener* for the specified brush event *typename*. If a *listener* is not specified, returns the currently-assigned listener for the specified event *typename*. Mirrors the core [d3-brush](https://github.com/d3/d3-brush#brush_on) behavior.
4205
4205
 
@@ -4207,7 +4207,7 @@ Adds or removes a *listener* for the specified brush event *typename*. If a *lis
4207
4207
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4208
4208
 
4209
4209
 
4210
- <a name="Timeline.playButton" href="#Timeline.playButton">#</a> Timeline.**playButton**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L634)
4210
+ <a name="Timeline.playButton" href="#Timeline.playButton">#</a> Timeline.**playButton**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L792)
4211
4211
 
4212
4212
  Determines the visibility of the play button to the left the of timeline, which will cycle through the available periods at a rate defined by the playButtonInterval method.
4213
4213
 
@@ -4215,7 +4215,7 @@ Determines the visibility of the play button to the left the of timeline, which
4215
4215
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4216
4216
 
4217
4217
 
4218
- <a name="Timeline.playButtonConfig" href="#Timeline.playButtonConfig">#</a> Timeline.**playButtonConfig**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L644)
4218
+ <a name="Timeline.playButtonConfig" href="#Timeline.playButtonConfig">#</a> Timeline.**playButtonConfig**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L802)
4219
4219
 
4220
4220
  The config Object for the Rect class used to create the playButton.
4221
4221
 
@@ -4223,7 +4223,7 @@ The config Object for the Rect class used to create the playButton.
4223
4223
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4224
4224
 
4225
4225
 
4226
- <a name="Timeline.playButtonInterval" href="#Timeline.playButtonInterval">#</a> Timeline.**playButtonInterval**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L654)
4226
+ <a name="Timeline.playButtonInterval" href="#Timeline.playButtonInterval">#</a> Timeline.**playButtonInterval**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L814)
4227
4227
 
4228
4228
  The value, in milliseconds, to use when cycling through the available time periods when the user clicks the playButton.
4229
4229
 
@@ -4231,7 +4231,7 @@ The value, in milliseconds, to use when cycling through the available time perio
4231
4231
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4232
4232
 
4233
4233
 
4234
- <a name="Timeline.selectionConfig" href="#Timeline.selectionConfig">#</a> Timeline.**selectionConfig**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L664)
4234
+ <a name="Timeline.selectionConfig" href="#Timeline.selectionConfig">#</a> Timeline.**selectionConfig**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L826)
4235
4235
 
4236
4236
  If *value* is specified, sets the selection style and returns the current class instance. If *value* is not specified, returns the current selection style.
4237
4237
 
@@ -4239,7 +4239,7 @@ If *value* is specified, sets the selection style and returns the current class
4239
4239
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4240
4240
 
4241
4241
 
4242
- <a name="Timeline.selection" href="#Timeline.selection">#</a> Timeline.**selection**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L674)
4242
+ <a name="Timeline.selection" href="#Timeline.selection">#</a> Timeline.**selection**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L838)
4243
4243
 
4244
4244
  If *value* is specified, sets the selection and returns the current class instance. If *value* is not specified, returns the current selection. Defaults to the most recent year in the timeline.
4245
4245
 
@@ -4247,7 +4247,7 @@ If *value* is specified, sets the selection and returns the current class instan
4247
4247
  This is a static method of [<code>Timeline</code>](#Timeline), and is chainable with other methods of this Class.
4248
4248
 
4249
4249
 
4250
- <a name="Timeline.snapping" href="#Timeline.snapping">#</a> Timeline.**snapping**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L684)
4250
+ <a name="Timeline.snapping" href="#Timeline.snapping">#</a> Timeline.**snapping**([*value*]) [<>](https://github.com/d3plus/d3plus/blob/main/packages/core/src/components/Timeline.js#L848)
4251
4251
 
4252
4252
  If *value* is specified, toggles the snapping value and returns the current class instance. If *value* is not specified, returns the current snapping value.
4253
4253
 
@@ -112,7 +112,7 @@ import { locale } from "@d3plus/locales";
112
112
  import { closest } from "@d3plus/math";
113
113
  import { textWrap } from "@d3plus/text";
114
114
  import { Axis, TextBox } from "../components/index.js";
115
- import { constant } from "../utils/index.js";
115
+ import { configPrep, constant } from "../utils/index.js";
116
116
  var colorMid = "#bbb";
117
117
  var Timeline = /*#__PURE__*/ function(Axis) {
118
118
  "use strict";
@@ -209,14 +209,14 @@ var Timeline = /*#__PURE__*/ function(Axis) {
209
209
  fontColor: colorDefaults.dark,
210
210
  fontSize: 15,
211
211
  text: function() {
212
- return _this._playTimer ? "&#x23f8;&#xFE0E;" : "⏵";
212
+ return _this._playTimer ? "" : "⏵";
213
213
  },
214
214
  textAnchor: "middle",
215
215
  verticalAlign: "middle"
216
216
  };
217
217
  _this._playButtonInterval = 1000;
218
218
  _this._selectionConfig = {
219
- "fill": "#228be6",
219
+ fill: "#228be6",
220
220
  "fill-opacity": function() {
221
221
  return _this._buttonBehaviorCurrent === "buttons" ? 0.3 : 1;
222
222
  },
@@ -494,7 +494,7 @@ var Timeline = /*#__PURE__*/ function(Axis) {
494
494
  });
495
495
  this._ticksWidth = maxLabel * ticks.length;
496
496
  }
497
- var playButtonWidth = this._playButton ? this._buttonHeight : 0;
497
+ var playButtonWidth = this._playButton ? this._playButtonConfig.width || this._buttonHeight : 0;
498
498
  var space = this._width - playButtonWidth;
499
499
  this._buttonBehaviorCurrent = this._buttonBehavior === "auto" ? this._ticksWidth < space ? "buttons" : "ticks" : this._buttonBehavior;
500
500
  var hiddenHandles = this._hiddenHandles = this._buttonBehaviorCurrent === "buttons" && !this._brushing;
@@ -564,9 +564,9 @@ var Timeline = /*#__PURE__*/ function(Axis) {
564
564
  x: this._paddingLeft - playButtonWidth,
565
565
  y: this._buttonBehaviorCurrent === "buttons" ? this._align === "middle" ? this._height / 2 - this._buttonHeight / 2 : this._align === "start" ? this._margin.top : this._height - this._buttonHeight - this._margin.bottom : this._outerBounds.y,
566
566
  width: playButtonWidth,
567
- height: playButtonWidth
567
+ height: this._buttonHeight
568
568
  }
569
- ] : []).select(playButtonGroup.node()).config(this._playButtonConfig).render();
569
+ ] : []).select(playButtonGroup.node()).config(configPrep.bind(this)(this._playButtonConfig)).render();
570
570
  return this;
571
571
  }
572
572
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3plus/core",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,13 +34,13 @@
34
34
  "test": "eslint index.js src/**/*.js && eslint --global=it test && mocha 'test/**/*-test.js'"
35
35
  },
36
36
  "dependencies": {
37
- "@d3plus/color": "3.0.6",
38
- "@d3plus/data": "3.0.6",
39
- "@d3plus/dom": "3.0.6",
40
- "@d3plus/format": "3.0.6",
41
- "@d3plus/locales": "3.0.6",
42
- "@d3plus/math": "3.0.6",
43
- "@d3plus/text": "3.0.6",
37
+ "@d3plus/color": "3.0.7",
38
+ "@d3plus/data": "3.0.7",
39
+ "@d3plus/dom": "3.0.7",
40
+ "@d3plus/format": "3.0.7",
41
+ "@d3plus/locales": "3.0.7",
42
+ "@d3plus/math": "3.0.7",
43
+ "@d3plus/text": "3.0.7",
44
44
  "@popperjs/core": "^2.11.8",
45
45
  "d3-array": "^3.2.4",
46
46
  "d3-brush": "^3.0.0",
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/core v3.0.6
2
+ @d3plus/core v3.0.7
3
3
  Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
4
4
  Copyright (c) 2025 D3plus - https://d3plus.org
5
5
  @license MIT
@@ -30240,7 +30240,7 @@
30240
30240
  });
30241
30241
  this._ticksWidth = maxLabel * ticks.length;
30242
30242
  }
30243
- const playButtonWidth = this._playButton ? this._buttonHeight : 0;
30243
+ const playButtonWidth = this._playButton ? this._playButtonConfig.width || this._buttonHeight : 0;
30244
30244
  const space = this._width - playButtonWidth;
30245
30245
  this._buttonBehaviorCurrent = this._buttonBehavior === "auto" ? this._ticksWidth < space ? "buttons" : "ticks" : this._buttonBehavior;
30246
30246
  const hiddenHandles = this._hiddenHandles = this._buttonBehaviorCurrent === "buttons" && !this._brushing;
@@ -30306,9 +30306,9 @@
30306
30306
  x: this._paddingLeft - playButtonWidth,
30307
30307
  y: this._buttonBehaviorCurrent === "buttons" ? this._align === "middle" ? this._height / 2 - this._buttonHeight / 2 : this._align === "start" ? this._margin.top : this._height - this._buttonHeight - this._margin.bottom : this._outerBounds.y,
30308
30308
  width: playButtonWidth,
30309
- height: playButtonWidth
30309
+ height: this._buttonHeight
30310
30310
  }
30311
- ] : []).select(playButtonGroup.node()).config(this._playButtonConfig).render();
30311
+ ] : []).select(playButtonGroup.node()).config(configPrep.bind(this)(this._playButtonConfig)).render();
30312
30312
  return this;
30313
30313
  }
30314
30314
  /**
@@ -30529,13 +30529,13 @@
30529
30529
  this._playButtonConfig = {
30530
30530
  fontColor: defaults.dark,
30531
30531
  fontSize: 15,
30532
- text: ()=>this._playTimer ? "&#x23f8;&#xFE0E;" : "⏵",
30532
+ text: ()=>this._playTimer ? "" : "⏵",
30533
30533
  textAnchor: "middle",
30534
30534
  verticalAlign: "middle"
30535
30535
  };
30536
30536
  this._playButtonInterval = 1000;
30537
30537
  this._selectionConfig = {
30538
- "fill": "#228be6",
30538
+ fill: "#228be6",
30539
30539
  "fill-opacity": ()=>this._buttonBehaviorCurrent === "buttons" ? 0.3 : 1,
30540
30540
  "stroke-width": 0
30541
30541
  };