@internetarchive/histogram-date-range 0.1.8 → 0.1.9

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.
@@ -1,23 +1,23 @@
1
- html {
2
- font-size: 10px;
3
- font-family: sans-serif;
4
- }
5
- body {
6
- background: white;
7
- }
8
- .container {
9
- margin-top: 20px;
10
- display: grid;
11
- justify-content: center;
12
- }
13
- .description {
14
- margin: 10px auto;
15
- }
16
- .received-events {
17
- position: absolute;
18
- top: 0;
19
- }
20
- button {
21
- font-size: 100%;
22
- margin: 10px auto;
1
+ html {
2
+ font-size: 10px;
3
+ font-family: sans-serif;
4
+ }
5
+ body {
6
+ background: white;
7
+ }
8
+ .container {
9
+ margin-top: 20px;
10
+ display: grid;
11
+ justify-content: center;
12
+ }
13
+ .description {
14
+ margin: 10px auto;
15
+ }
16
+ .received-events {
17
+ position: absolute;
18
+ top: 0;
19
+ }
20
+ button {
21
+ font-size: 100%;
22
+ margin: 10px auto;
23
23
  }
@@ -1,159 +1,159 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta name="viewport" content="width=device-width, initial-scale=1" />
5
- <meta charset="utf-8" />
6
- <link rel="stylesheet" href="index.css">
7
- </head>
8
-
9
- <script type="module">
10
- import '../dist/src/histogram-date-range.js';
11
- let eventCount = 0;
12
- import '../dist/demo/js/app-root.js';
13
- // listen to events from the component and display the data received from them
14
- document.addEventListener('histogramDateRangeUpdated', e => {
15
- document.querySelector('.received-events').innerHTML =
16
- ++eventCount + ': ' + JSON.stringify(e.detail);
17
- });
18
- </script>
19
- <body>
20
- <pre class="received-events"></pre>
21
- <div class="container">
22
- <div class="description">
23
- histogram inside a lit element
24
- </div>
25
- <app-root></app-root>
26
-
27
- <div class="description">
28
- pre-selected range with 1000ms debounce delay
29
- </div>
30
- <histogram-date-range
31
- minDate="1400"
32
- maxDate="2021"
33
- updateDelay="1000"
34
- minSelectedDate="1800"
35
- maxSelectedDate="1900"
36
- bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
37
- 13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
38
- 47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
39
- 32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
40
- ]"
41
- ></histogram-date-range>
42
- </div>
43
-
44
- <div class="container">
45
- <div class="description">range spanning negative to positive years</div>
46
- <histogram-date-range
47
- minDate="-1050" maxDate="2200"
48
- bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
49
- 13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
50
- 47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
51
- 32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
52
- ]"
53
- ></histogram-date-range>
54
- </div>
55
-
56
- <div class="container">
57
- <div class="description">
58
- small diff between max and min values
59
- </div>
60
- <histogram-date-range
61
- width="175"
62
- tooltipwidth="120"
63
- dateFormat="YYYY"
64
- updateDelay="1000"
65
- missingDataMessage="..."
66
- minSelectedDate="1987"
67
- maxSelectedDate="2016"
68
- minDate="1987"
69
- maxDate="2016"
70
- bins="[1519,1643,1880,2046,1973,2085,2148,2152,2349,2304,2314,2484,2590,2450,2495,2475,2392,2631,2504,2619,2519,2552,2462,2217,2171,2132,2127,2041,1638,1441]"
71
- >
72
- </histogram-date-range>
73
- </div>
74
-
75
- <div class="container">
76
- <div class="description">small year range and few bins</div>
77
- <histogram-date-range width="175" tooltipwidth="120"
78
- minDate="2008" maxDate="2016" bins="[76104,866978,1151617,986331,218672,107410,3324]">
79
- </histogram-date-range>
80
- </div>
81
-
82
- <div class="container">
83
- <div class="description">
84
- default range with custom styling and date format
85
- </div>
86
- <histogram-date-range
87
- width="300"
88
- height="50"
89
- tooltipWidth="140"
90
- dateFormat="DD MMM YYYY"
91
- style="
92
- --histogramDateRangeSliderColor: #d8b384;
93
- --histogramDateRangeSelectedRangeColor: #f3f0d7;
94
- --histogramDateRangeTooltipFontFamily: serif;
95
- --histogramDateRangeInputFontFamily: serif;
96
- --histogramDateRangeTooltipFontSize: 1rem;
97
- --histogramDateRangeInputWidth: 85px;
98
- "
99
- minDate="05 May 1972"
100
- maxDate="21 Dec 1980"
101
- bins="[ 85, 25, 200, 0, 0, 34, 0, 2, 5, 10, 0, 56, 10, 45, 100, 70, 50 ]"
102
- ></histogram-date-range>
103
- </div>
104
-
105
- <div class="container">
106
- <div class="description">loading state toggle</div>
107
- <histogram-date-range
108
- id="loading"
109
- minDate="1900"
110
- maxDate="2021"
111
- bins="[
112
- 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2, 13, 45, 67, 17, 66,
113
- 49, 93, 47, 61, 32, 32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
114
- ]"
115
- ></histogram-date-range>
116
- <button id="loading-toggle">toggle loading</button>
117
- </div>
118
- <script>
119
- document
120
- .querySelector('#loading-toggle')
121
- .addEventListener('click', () => {
122
- const histogram = document.querySelector(
123
- 'histogram-date-range#loading'
124
- );
125
- histogram.loading = !histogram.loading;
126
- });
127
- </script>
128
-
129
- <div class="container">
130
- <div class="description">data set up with js</div>
131
- <histogram-date-range id="js-setup"></histogram-date-range>
132
- </div>
133
- <script>
134
- document.addEventListener('DOMContentLoaded', function () {
135
- const histogram = document.querySelector(
136
- 'histogram-date-range#js-setup'
137
- );
138
- histogram.minDate = '1950';
139
- histogram.maxDate = '2000';
140
- // generate array of [0, 1, 2, ... 49]
141
- histogram.bins = [...Array(50).keys()];
142
- });
143
- </script>
144
-
145
- <div class="container">
146
- <div class="description">
147
- single bin
148
- </div>
149
- <histogram-date-range minDate="1926" maxDate="1926" bins="[8]">
150
- </histogram-date-range>
151
- </div>
152
-
153
- <div class="container">
154
- <div class="description">empty data</div>
155
- <histogram-date-range missingDataMessage="no data..."></histoghistogram-date-range>
156
- </div>
157
-
158
- </body>
159
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
5
+ <meta charset="utf-8" />
6
+ <link rel="stylesheet" href="index.css">
7
+ </head>
8
+
9
+ <script type="module">
10
+ import '../dist/src/histogram-date-range.js';
11
+ let eventCount = 0;
12
+ import '../dist/demo/js/app-root.js';
13
+ // listen to events from the component and display the data received from them
14
+ document.addEventListener('histogramDateRangeUpdated', e => {
15
+ document.querySelector('.received-events').innerHTML =
16
+ ++eventCount + ': ' + JSON.stringify(e.detail);
17
+ });
18
+ </script>
19
+ <body>
20
+ <pre class="received-events"></pre>
21
+ <div class="container">
22
+ <div class="description">
23
+ histogram inside a lit element
24
+ </div>
25
+ <app-root></app-root>
26
+
27
+ <div class="description">
28
+ pre-selected range with 1000ms debounce delay
29
+ </div>
30
+ <histogram-date-range
31
+ minDate="1400"
32
+ maxDate="2021"
33
+ updateDelay="1000"
34
+ minSelectedDate="1800"
35
+ maxSelectedDate="1900"
36
+ bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
37
+ 13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
38
+ 47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
39
+ 32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
40
+ ]"
41
+ ></histogram-date-range>
42
+ </div>
43
+
44
+ <div class="container">
45
+ <div class="description">range spanning negative to positive years</div>
46
+ <histogram-date-range
47
+ minDate="-1050" maxDate="2200"
48
+ bins="[ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2,
49
+ 13, 45, 28, 1, 8, 70, 37, 74, 67, 17, 66, 49, 93,
50
+ 47, 61, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32,
51
+ 32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
52
+ ]"
53
+ ></histogram-date-range>
54
+ </div>
55
+
56
+ <div class="container">
57
+ <div class="description">
58
+ small diff between max and min values
59
+ </div>
60
+ <histogram-date-range
61
+ width="175"
62
+ tooltipwidth="120"
63
+ dateFormat="YYYY"
64
+ updateDelay="1000"
65
+ missingDataMessage="..."
66
+ minSelectedDate="1987"
67
+ maxSelectedDate="2016"
68
+ minDate="1987"
69
+ maxDate="2016"
70
+ bins="[1519,1643,1880,2046,1973,2085,2148,2152,2349,2304,2314,2484,2590,2450,2495,2475,2392,2631,2504,2619,2519,2552,2462,2217,2171,2132,2127,2041,1638,1441]"
71
+ >
72
+ </histogram-date-range>
73
+ </div>
74
+
75
+ <div class="container">
76
+ <div class="description">small year range and few bins</div>
77
+ <histogram-date-range width="175" tooltipwidth="120"
78
+ minDate="2008" maxDate="2016" bins="[76104,866978,1151617,986331,218672,107410,3324]">
79
+ </histogram-date-range>
80
+ </div>
81
+
82
+ <div class="container">
83
+ <div class="description">
84
+ default range with custom styling and date format
85
+ </div>
86
+ <histogram-date-range
87
+ width="300"
88
+ height="50"
89
+ tooltipWidth="140"
90
+ dateFormat="DD MMM YYYY"
91
+ style="
92
+ --histogramDateRangeSliderColor: #d8b384;
93
+ --histogramDateRangeSelectedRangeColor: #f3f0d7;
94
+ --histogramDateRangeTooltipFontFamily: serif;
95
+ --histogramDateRangeInputFontFamily: serif;
96
+ --histogramDateRangeTooltipFontSize: 1rem;
97
+ --histogramDateRangeInputWidth: 85px;
98
+ "
99
+ minDate="05 May 1972"
100
+ maxDate="21 Dec 1980"
101
+ bins="[ 85, 25, 200, 0, 0, 34, 0, 2, 5, 10, 0, 56, 10, 45, 100, 70, 50 ]"
102
+ ></histogram-date-range>
103
+ </div>
104
+
105
+ <div class="container">
106
+ <div class="description">loading state toggle</div>
107
+ <histogram-date-range
108
+ id="loading"
109
+ minDate="1900"
110
+ maxDate="2021"
111
+ bins="[
112
+ 74, 67, 17, 66, 49, 93, 47, 61, 32, 46, 53, 2, 13, 45, 67, 17, 66,
113
+ 49, 93, 47, 61, 32, 32, 70, 37, 74, 67, 17, 66, 49, 93, 47, 61, 32
114
+ ]"
115
+ ></histogram-date-range>
116
+ <button id="loading-toggle">toggle loading</button>
117
+ </div>
118
+ <script>
119
+ document
120
+ .querySelector('#loading-toggle')
121
+ .addEventListener('click', () => {
122
+ const histogram = document.querySelector(
123
+ 'histogram-date-range#loading'
124
+ );
125
+ histogram.loading = !histogram.loading;
126
+ });
127
+ </script>
128
+
129
+ <div class="container">
130
+ <div class="description">data set up with js</div>
131
+ <histogram-date-range id="js-setup"></histogram-date-range>
132
+ </div>
133
+ <script>
134
+ document.addEventListener('DOMContentLoaded', function () {
135
+ const histogram = document.querySelector(
136
+ 'histogram-date-range#js-setup'
137
+ );
138
+ histogram.minDate = '1950';
139
+ histogram.maxDate = '2000';
140
+ // generate array of [0, 1, 2, ... 49]
141
+ histogram.bins = [...Array(50).keys()];
142
+ });
143
+ </script>
144
+
145
+ <div class="container">
146
+ <div class="description">
147
+ single bin
148
+ </div>
149
+ <histogram-date-range minDate="1926" maxDate="1926" bins="[8]">
150
+ </histogram-date-range>
151
+ </div>
152
+
153
+ <div class="container">
154
+ <div class="description">empty data</div>
155
+ <histogram-date-range missingDataMessage="no data..."></histoghistogram-date-range>
156
+ </div>
157
+
158
+ </body>
159
+ </html>
package/package.json CHANGED
@@ -1,84 +1,84 @@
1
- {
2
- "name": "@internetarchive/histogram-date-range",
3
- "version": "0.1.8",
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.3",
24
- "dayjs": "^1.10.7",
25
- "lit": "^2.2.7"
26
- },
27
- "devDependencies": {
28
- "@open-wc/eslint-config": "^7.0.0",
29
- "@open-wc/testing": "^3.0.3",
30
- "@typescript-eslint/eslint-plugin": "^5.10.0",
31
- "@typescript-eslint/parser": "^5.10.0",
32
- "@web/dev-server": "^0.1.29",
33
- "@web/test-runner": "^0.13.25",
34
- "concurrently": "^7.0.0",
35
- "eslint": "^8.7.0",
36
- "eslint-config-prettier": "^8.3.0",
37
- "husky": "^4.3.8",
38
- "lint-staged": "^12.2.2",
39
- "lit-html": "^2.1.1",
40
- "prettier": "^2.5.1",
41
- "snowpack": "^3.8.8",
42
- "tslib": "^2.3.1",
43
- "typescript": "^4.5"
44
- },
45
- "eslintConfig": {
46
- "parser": "@typescript-eslint/parser",
47
- "extends": [
48
- "@open-wc/eslint-config",
49
- "eslint-config-prettier"
50
- ],
51
- "plugins": [
52
- "@typescript-eslint"
53
- ],
54
- "rules": {
55
- "no-unused-vars": "off",
56
- "@typescript-eslint/no-unused-vars": [
57
- "error"
58
- ],
59
- "import/no-unresolved": "off",
60
- "import/extensions": [
61
- "error",
62
- "always",
63
- {
64
- "ignorePackages": true
65
- }
66
- ]
67
- }
68
- },
69
- "prettier": {
70
- "singleQuote": true,
71
- "arrowParens": "avoid"
72
- },
73
- "husky": {
74
- "hooks": {
75
- "pre-commit": "lint-staged"
76
- }
77
- },
78
- "lint-staged": {
79
- "*.ts": [
80
- "eslint --fix",
81
- "prettier --write"
82
- ]
83
- }
84
- }
1
+ {
2
+ "name": "@internetarchive/histogram-date-range",
3
+ "version": "0.1.9",
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.3",
24
+ "dayjs": "^1.10.7",
25
+ "lit": "^2.2.7"
26
+ },
27
+ "devDependencies": {
28
+ "@open-wc/eslint-config": "^7.0.0",
29
+ "@open-wc/testing": "^3.0.3",
30
+ "@typescript-eslint/eslint-plugin": "^5.10.0",
31
+ "@typescript-eslint/parser": "^5.10.0",
32
+ "@web/dev-server": "^0.1.29",
33
+ "@web/test-runner": "^0.13.25",
34
+ "concurrently": "^7.0.0",
35
+ "eslint": "^8.7.0",
36
+ "eslint-config-prettier": "^8.3.0",
37
+ "husky": "^4.3.8",
38
+ "lint-staged": "^12.2.2",
39
+ "lit-html": "^2.1.1",
40
+ "prettier": "^2.5.1",
41
+ "snowpack": "^3.8.8",
42
+ "tslib": "^2.3.1",
43
+ "typescript": "^4.5"
44
+ },
45
+ "eslintConfig": {
46
+ "parser": "@typescript-eslint/parser",
47
+ "extends": [
48
+ "@open-wc/eslint-config",
49
+ "eslint-config-prettier"
50
+ ],
51
+ "plugins": [
52
+ "@typescript-eslint"
53
+ ],
54
+ "rules": {
55
+ "no-unused-vars": "off",
56
+ "@typescript-eslint/no-unused-vars": [
57
+ "error"
58
+ ],
59
+ "import/no-unresolved": "off",
60
+ "import/extensions": [
61
+ "error",
62
+ "always",
63
+ {
64
+ "ignorePackages": true
65
+ }
66
+ ]
67
+ }
68
+ },
69
+ "prettier": {
70
+ "singleQuote": true,
71
+ "arrowParens": "avoid"
72
+ },
73
+ "husky": {
74
+ "hooks": {
75
+ "pre-commit": "lint-staged"
76
+ }
77
+ },
78
+ "lint-staged": {
79
+ "*.ts": [
80
+ "eslint --fix",
81
+ "prettier --write"
82
+ ]
83
+ }
84
+ }
@@ -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
+ };