@internetarchive/histogram-date-range 1.2.1-alpha.1 → 1.2.2-alpha-webdev7377.0

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.
Files changed (35) hide show
  1. package/.editorconfig +29 -29
  2. package/.eslintrc.js +14 -14
  3. package/.github/workflows/ci.yml +30 -26
  4. package/LICENSE +661 -661
  5. package/README.md +113 -113
  6. package/demo/index.css +22 -22
  7. package/demo/index.html +159 -159
  8. package/dist/demo/js/app-root.d.ts +19 -19
  9. package/dist/demo/js/app-root.js +46 -46
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/src/histogram-date-range.d.ts +166 -159
  14. package/dist/src/histogram-date-range.js +856 -846
  15. package/dist/src/histogram-date-range.js.map +1 -1
  16. package/dist/test/histogram-date-range.test.d.ts +1 -1
  17. package/dist/test/histogram-date-range.test.js +488 -488
  18. package/dist/test/histogram-date-range.test.js.map +1 -1
  19. package/docs/demo/index.css +22 -22
  20. package/docs/demo/index.html +159 -159
  21. package/docs/dist/src/histogram-date-range.js +17 -12
  22. package/index.ts +1 -1
  23. package/package.json +85 -85
  24. package/snowpack.config.js +10 -10
  25. package/src/histogram-date-range.ts +923 -915
  26. package/test/histogram-date-range.test.ts +684 -684
  27. package/tsconfig.json +21 -21
  28. package/web-dev-server.config.mjs +28 -28
  29. package/web-test-runner.config.mjs +29 -29
  30. package/dist/demo/app-root.d.ts +0 -19
  31. package/dist/demo/app-root.js +0 -58
  32. package/dist/demo/app-root.js.map +0 -1
  33. package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.d.ts +0 -1
  34. package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.js +0 -2
  35. package/dist/docs/_snowpack/pkg/@internetarchive/ia-activity-indicator/ia-activity-indicator.js.map +0 -1
@@ -9,18 +9,18 @@ var __decorate = (decorators, target, key, kind) => {
9
9
  __defProp(target, key, result);
10
10
  return result;
11
11
  };
12
+ import "../../_snowpack/pkg/@internetarchive/ia-activity-indicator.js";
13
+ import dayjs from "../../_snowpack/pkg/dayjs/esm.js";
14
+ import customParseFormat from "../../_snowpack/pkg/dayjs/esm/plugin/customParseFormat.js";
12
15
  import {
13
16
  css,
14
17
  html,
15
- nothing,
16
18
  LitElement,
19
+ nothing,
17
20
  svg
18
21
  } from "../../_snowpack/pkg/lit.js";
19
- import {property, state, customElement} from "../../_snowpack/pkg/lit/decorators.js";
22
+ import {customElement, property, state} from "../../_snowpack/pkg/lit/decorators.js";
20
23
  import {live} from "../../_snowpack/pkg/lit/directives/live.js";
21
- import "../../_snowpack/pkg/@internetarchive/ia-activity-indicator.js";
22
- import dayjs from "../../_snowpack/pkg/dayjs/esm.js";
23
- import customParseFormat from "../../_snowpack/pkg/dayjs/esm/plugin/customParseFormat.js";
24
24
  dayjs.extend(customParseFormat);
25
25
  const WIDTH = 180;
26
26
  const HEIGHT = 40;
@@ -106,7 +106,7 @@ export let HistogramDateRange = class extends LitElement {
106
106
  this.removeListeners();
107
107
  super.disconnectedCallback();
108
108
  }
109
- updated(changedProps) {
109
+ willUpdate(changedProps) {
110
110
  if (changedProps.has("bins") || changedProps.has("minDate") || changedProps.has("maxDate") || changedProps.has("minSelectedDate") || changedProps.has("maxSelectedDate") || changedProps.has("width") || changedProps.has("height")) {
111
111
  this.handleDataUpdate();
112
112
  }
@@ -123,7 +123,6 @@ export let HistogramDateRange = class extends LitElement {
123
123
  this._histData = this.calculateHistData();
124
124
  this.minSelectedDate = this.minSelectedDate ? this.minSelectedDate : this.minDate;
125
125
  this.maxSelectedDate = this.maxSelectedDate ? this.maxSelectedDate : this.maxDate;
126
- this.requestUpdate();
127
126
  }
128
127
  calculateHistData() {
129
128
  const minValue = Math.min(...this.bins);
@@ -135,8 +134,8 @@ export let HistogramDateRange = class extends LitElement {
135
134
  return {
136
135
  value: v,
137
136
  height: Math.floor(Math.log1p(v) * valueScale),
138
- binStart: `${this.formatDate(i * dateScale + this._minDateMS)}`,
139
- binEnd: `${this.formatDate((i + 1) * dateScale + this._minDateMS)}`
137
+ binStart: `${this.formatDate(i * dateScale + this._minDateMS, this.resolvedTooltipDateFormat)}`,
138
+ binEnd: `${this.formatDate((i + 1) * dateScale + this._minDateMS, this.resolvedTooltipDateFormat)}`
140
139
  };
141
140
  });
142
141
  }
@@ -155,6 +154,9 @@ export let HistogramDateRange = class extends LitElement {
155
154
  get histogramRightEdgeX() {
156
155
  return this.width - this.sliderWidth;
157
156
  }
157
+ get resolvedTooltipDateFormat() {
158
+ return this.tooltipDateFormat ?? this.dateFormat ?? DATE_FORMAT;
159
+ }
158
160
  get loading() {
159
161
  return this._isLoading;
160
162
  }
@@ -431,7 +433,7 @@ export let HistogramDateRange = class extends LitElement {
431
433
  return bar;
432
434
  });
433
435
  }
434
- formatDate(dateMS) {
436
+ formatDate(dateMS, format = this.dateFormat) {
435
437
  if (Number.isNaN(dateMS)) {
436
438
  return "";
437
439
  }
@@ -439,7 +441,7 @@ export let HistogramDateRange = class extends LitElement {
439
441
  if (date.year() < 1e3) {
440
442
  return String(date.year());
441
443
  }
442
- return date.format(this.dateFormat);
444
+ return date.format(format);
443
445
  }
444
446
  get minInputTemplate() {
445
447
  return html`
@@ -676,6 +678,9 @@ __decorate([
676
678
  __decorate([
677
679
  property({type: String})
678
680
  ], HistogramDateRange.prototype, "dateFormat", 2);
681
+ __decorate([
682
+ property({type: String})
683
+ ], HistogramDateRange.prototype, "tooltipDateFormat", 2);
679
684
  __decorate([
680
685
  property({type: String})
681
686
  ], HistogramDateRange.prototype, "missingDataMessage", 2);
@@ -689,7 +694,7 @@ __decorate([
689
694
  property({type: Boolean})
690
695
  ], HistogramDateRange.prototype, "disabled", 2);
691
696
  __decorate([
692
- property({type: Object})
697
+ property({type: Array})
693
698
  ], HistogramDateRange.prototype, "bins", 2);
694
699
  __decorate([
695
700
  property({type: Boolean})
package/index.ts CHANGED
@@ -1 +1 @@
1
- export { HistogramDateRange } from './src/histogram-date-range';
1
+ export { HistogramDateRange } from './src/histogram-date-range';
package/package.json CHANGED
@@ -1,85 +1,85 @@
1
- {
2
- "name": "@internetarchive/histogram-date-range",
3
- "version": "1.2.1-alpha.1",
4
- "description": "Internet Archive histogram date range picker",
5
- "license": "AGPL-3.0-only",
6
- "main": "dist/index.js",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "scripts": {
13
- "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
14
- "build": "snowpack build && touch docs/.nojekyll",
15
- "prepublish": "tsc",
16
- "prepare": "npm run build",
17
- "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
18
- "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
19
- "test": "tsc && wtr --coverage",
20
- "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
21
- },
22
- "dependencies": {
23
- "@internetarchive/ia-activity-indicator": "^0.0.6",
24
- "dayjs": "^1.11.13",
25
- "lit": "^2.8.0"
26
- },
27
- "devDependencies": {
28
- "@open-wc/eslint-config": "^7.0.0",
29
- "@open-wc/testing": "^3.0.3",
30
- "@types/mocha": "^10.0.10",
31
- "@typescript-eslint/eslint-plugin": "^5.10.0",
32
- "@typescript-eslint/parser": "^5.10.0",
33
- "@web/dev-server": "^0.1.29",
34
- "@web/test-runner": "^0.19.0",
35
- "concurrently": "^7.0.0",
36
- "eslint": "^8.7.0",
37
- "eslint-config-prettier": "^8.3.0",
38
- "husky": "^4.3.8",
39
- "lint-staged": "^12.2.2",
40
- "lit-html": "^2.1.1",
41
- "prettier": "^2.5.1",
42
- "snowpack": "^3.8.8",
43
- "tslib": "^2.3.1",
44
- "typescript": "^4.5"
45
- },
46
- "eslintConfig": {
47
- "parser": "@typescript-eslint/parser",
48
- "extends": [
49
- "@open-wc/eslint-config",
50
- "eslint-config-prettier"
51
- ],
52
- "plugins": [
53
- "@typescript-eslint"
54
- ],
55
- "rules": {
56
- "no-unused-vars": "off",
57
- "@typescript-eslint/no-unused-vars": [
58
- "error"
59
- ],
60
- "import/no-unresolved": "off",
61
- "import/extensions": [
62
- "error",
63
- "always",
64
- {
65
- "ignorePackages": true
66
- }
67
- ]
68
- }
69
- },
70
- "prettier": {
71
- "singleQuote": true,
72
- "arrowParens": "avoid"
73
- },
74
- "husky": {
75
- "hooks": {
76
- "pre-commit": "lint-staged"
77
- }
78
- },
79
- "lint-staged": {
80
- "*.ts": [
81
- "eslint --fix",
82
- "prettier --write"
83
- ]
84
- }
85
- }
1
+ {
2
+ "name": "@internetarchive/histogram-date-range",
3
+ "version": "1.2.2-alpha-webdev7377.0",
4
+ "description": "Internet Archive histogram date range picker",
5
+ "license": "AGPL-3.0-only",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "scripts": {
13
+ "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
14
+ "build": "snowpack build && touch docs/.nojekyll",
15
+ "prepublish": "tsc",
16
+ "prepare": "npm run build",
17
+ "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
18
+ "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
19
+ "test": "tsc && wtr --coverage",
20
+ "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
21
+ },
22
+ "dependencies": {
23
+ "@internetarchive/ia-activity-indicator": "^0.0.6",
24
+ "dayjs": "^1.11.13",
25
+ "lit": "^2.8.0"
26
+ },
27
+ "devDependencies": {
28
+ "@open-wc/eslint-config": "^7.0.0",
29
+ "@open-wc/testing": "^3.0.3",
30
+ "@types/mocha": "^10.0.10",
31
+ "@typescript-eslint/eslint-plugin": "^5.10.0",
32
+ "@typescript-eslint/parser": "^5.10.0",
33
+ "@web/dev-server": "^0.1.29",
34
+ "@web/test-runner": "^0.19.0",
35
+ "concurrently": "^7.0.0",
36
+ "eslint": "^8.7.0",
37
+ "eslint-config-prettier": "^8.3.0",
38
+ "husky": "^4.3.8",
39
+ "lint-staged": "^12.2.2",
40
+ "lit-html": "^2.1.1",
41
+ "prettier": "^2.5.1",
42
+ "snowpack": "^3.8.8",
43
+ "tslib": "^2.3.1",
44
+ "typescript": "^4.5"
45
+ },
46
+ "eslintConfig": {
47
+ "parser": "@typescript-eslint/parser",
48
+ "extends": [
49
+ "@open-wc/eslint-config",
50
+ "eslint-config-prettier"
51
+ ],
52
+ "plugins": [
53
+ "@typescript-eslint"
54
+ ],
55
+ "rules": {
56
+ "no-unused-vars": "off",
57
+ "@typescript-eslint/no-unused-vars": [
58
+ "error"
59
+ ],
60
+ "import/no-unresolved": "off",
61
+ "import/extensions": [
62
+ "error",
63
+ "always",
64
+ {
65
+ "ignorePackages": true
66
+ }
67
+ ]
68
+ }
69
+ },
70
+ "prettier": {
71
+ "singleQuote": true,
72
+ "arrowParens": "avoid"
73
+ },
74
+ "husky": {
75
+ "hooks": {
76
+ "pre-commit": "lint-staged"
77
+ }
78
+ },
79
+ "lint-staged": {
80
+ "*.ts": [
81
+ "eslint --fix",
82
+ "prettier --write"
83
+ ]
84
+ }
85
+ }
@@ -1,10 +1,10 @@
1
- module.exports = {
2
- buildOptions: {
3
- out: 'docs',
4
- },
5
- mount: {
6
- 'demo/js': { url: '/dist/demo/js' },
7
- demo: { url: '/demo' },
8
- src: { url: '/dist/src' },
9
- },
10
- };
1
+ module.exports = {
2
+ buildOptions: {
3
+ out: 'docs',
4
+ },
5
+ mount: {
6
+ 'demo/js': { url: '/dist/demo/js' },
7
+ demo: { url: '/demo' },
8
+ src: { url: '/dist/src' },
9
+ },
10
+ };