@cutting/svg 4.29.1 → 4.31.2
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/.coverage/clover.xml +81 -0
- package/.coverage/coverage-final.json +5 -0
- package/.coverage/lcov-report/Group/Group.tsx.html +197 -0
- package/.coverage/lcov-report/Group/index.html +117 -0
- package/.coverage/lcov-report/Line/Line.tsx.html +200 -0
- package/.coverage/lcov-report/Line/index.html +117 -0
- package/.coverage/lcov-report/ParentsizeSVG/ParentsizeSVG.tsx.html +251 -0
- package/.coverage/lcov-report/ParentsizeSVG/index.html +117 -0
- package/.coverage/lcov-report/ResponsiveSVG/ResponsiveSVG.tsx.html +242 -0
- package/.coverage/lcov-report/ResponsiveSVG/index.html +117 -0
- package/.coverage/lcov-report/base.css +224 -0
- package/.coverage/lcov-report/block-navigation.js +87 -0
- package/.coverage/lcov-report/favicon.png +0 -0
- package/.coverage/lcov-report/index.html +162 -0
- package/.coverage/lcov-report/prettify.css +1 -0
- package/.coverage/lcov-report/prettify.js +2 -0
- package/.coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/.coverage/lcov-report/sorter.js +196 -0
- package/.coverage/lcov.info +130 -0
- package/CHANGELOG.md +46 -2
- package/demo/App.tsx +6 -7
- package/demo/global.css.ts +19 -0
- package/demo/tsconfig.json +7 -2
- package/dist/cjs/components/ResponsiveSVG/ResponsiveSVG.d.ts +2 -2
- package/dist/cjs/components/ResponsiveSVG/ResponsiveSVG.d.ts.map +1 -1
- package/dist/cjs/svg.cjs.development.js +14 -17
- package/dist/cjs/svg.cjs.development.js.map +1 -1
- package/dist/cjs/svg.cjs.production.min.js +1 -1
- package/dist/cjs/svg.cjs.production.min.js.map +1 -1
- package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.d.ts +2 -2
- package/dist/esm/components/ResponsiveSVG/ResponsiveSVG.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/umd/components/ResponsiveSVG/ResponsiveSVG.d.ts +2 -2
- package/dist/umd/components/ResponsiveSVG/ResponsiveSVG.d.ts.map +1 -1
- package/dist/umd/index.js +2 -0
- package/dist/umd/index.js.map +1 -0
- package/package.json +16 -15
- package/src/components/ResponsiveSVG/ResponsiveSVG.tsx +2 -2
- package/demo/global.module.scss +0 -26
- package/dist/esm/svg.esm.js +0 -2
- package/dist/esm/svg.esm.js.map +0 -1
- package/dist/umd/svg.umd.js +0 -2
- package/dist/umd/svg.umd.js.map +0 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
var addSorting = (function() {
|
|
3
|
+
'use strict';
|
|
4
|
+
var cols,
|
|
5
|
+
currentSort = {
|
|
6
|
+
index: 0,
|
|
7
|
+
desc: false
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// returns the summary table element
|
|
11
|
+
function getTable() {
|
|
12
|
+
return document.querySelector('.coverage-summary');
|
|
13
|
+
}
|
|
14
|
+
// returns the thead element of the summary table
|
|
15
|
+
function getTableHeader() {
|
|
16
|
+
return getTable().querySelector('thead tr');
|
|
17
|
+
}
|
|
18
|
+
// returns the tbody element of the summary table
|
|
19
|
+
function getTableBody() {
|
|
20
|
+
return getTable().querySelector('tbody');
|
|
21
|
+
}
|
|
22
|
+
// returns the th element for nth column
|
|
23
|
+
function getNthColumn(n) {
|
|
24
|
+
return getTableHeader().querySelectorAll('th')[n];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function onFilterInput() {
|
|
28
|
+
const searchValue = document.getElementById('fileSearch').value;
|
|
29
|
+
const rows = document.getElementsByTagName('tbody')[0].children;
|
|
30
|
+
for (let i = 0; i < rows.length; i++) {
|
|
31
|
+
const row = rows[i];
|
|
32
|
+
if (
|
|
33
|
+
row.textContent
|
|
34
|
+
.toLowerCase()
|
|
35
|
+
.includes(searchValue.toLowerCase())
|
|
36
|
+
) {
|
|
37
|
+
row.style.display = '';
|
|
38
|
+
} else {
|
|
39
|
+
row.style.display = 'none';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// loads the search box
|
|
45
|
+
function addSearchBox() {
|
|
46
|
+
var template = document.getElementById('filterTemplate');
|
|
47
|
+
var templateClone = template.content.cloneNode(true);
|
|
48
|
+
templateClone.getElementById('fileSearch').oninput = onFilterInput;
|
|
49
|
+
template.parentElement.appendChild(templateClone);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// loads all columns
|
|
53
|
+
function loadColumns() {
|
|
54
|
+
var colNodes = getTableHeader().querySelectorAll('th'),
|
|
55
|
+
colNode,
|
|
56
|
+
cols = [],
|
|
57
|
+
col,
|
|
58
|
+
i;
|
|
59
|
+
|
|
60
|
+
for (i = 0; i < colNodes.length; i += 1) {
|
|
61
|
+
colNode = colNodes[i];
|
|
62
|
+
col = {
|
|
63
|
+
key: colNode.getAttribute('data-col'),
|
|
64
|
+
sortable: !colNode.getAttribute('data-nosort'),
|
|
65
|
+
type: colNode.getAttribute('data-type') || 'string'
|
|
66
|
+
};
|
|
67
|
+
cols.push(col);
|
|
68
|
+
if (col.sortable) {
|
|
69
|
+
col.defaultDescSort = col.type === 'number';
|
|
70
|
+
colNode.innerHTML =
|
|
71
|
+
colNode.innerHTML + '<span class="sorter"></span>';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return cols;
|
|
75
|
+
}
|
|
76
|
+
// attaches a data attribute to every tr element with an object
|
|
77
|
+
// of data values keyed by column name
|
|
78
|
+
function loadRowData(tableRow) {
|
|
79
|
+
var tableCols = tableRow.querySelectorAll('td'),
|
|
80
|
+
colNode,
|
|
81
|
+
col,
|
|
82
|
+
data = {},
|
|
83
|
+
i,
|
|
84
|
+
val;
|
|
85
|
+
for (i = 0; i < tableCols.length; i += 1) {
|
|
86
|
+
colNode = tableCols[i];
|
|
87
|
+
col = cols[i];
|
|
88
|
+
val = colNode.getAttribute('data-value');
|
|
89
|
+
if (col.type === 'number') {
|
|
90
|
+
val = Number(val);
|
|
91
|
+
}
|
|
92
|
+
data[col.key] = val;
|
|
93
|
+
}
|
|
94
|
+
return data;
|
|
95
|
+
}
|
|
96
|
+
// loads all row data
|
|
97
|
+
function loadData() {
|
|
98
|
+
var rows = getTableBody().querySelectorAll('tr'),
|
|
99
|
+
i;
|
|
100
|
+
|
|
101
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
102
|
+
rows[i].data = loadRowData(rows[i]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// sorts the table using the data for the ith column
|
|
106
|
+
function sortByIndex(index, desc) {
|
|
107
|
+
var key = cols[index].key,
|
|
108
|
+
sorter = function(a, b) {
|
|
109
|
+
a = a.data[key];
|
|
110
|
+
b = b.data[key];
|
|
111
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
112
|
+
},
|
|
113
|
+
finalSorter = sorter,
|
|
114
|
+
tableBody = document.querySelector('.coverage-summary tbody'),
|
|
115
|
+
rowNodes = tableBody.querySelectorAll('tr'),
|
|
116
|
+
rows = [],
|
|
117
|
+
i;
|
|
118
|
+
|
|
119
|
+
if (desc) {
|
|
120
|
+
finalSorter = function(a, b) {
|
|
121
|
+
return -1 * sorter(a, b);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
for (i = 0; i < rowNodes.length; i += 1) {
|
|
126
|
+
rows.push(rowNodes[i]);
|
|
127
|
+
tableBody.removeChild(rowNodes[i]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
rows.sort(finalSorter);
|
|
131
|
+
|
|
132
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
133
|
+
tableBody.appendChild(rows[i]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// removes sort indicators for current column being sorted
|
|
137
|
+
function removeSortIndicators() {
|
|
138
|
+
var col = getNthColumn(currentSort.index),
|
|
139
|
+
cls = col.className;
|
|
140
|
+
|
|
141
|
+
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
|
142
|
+
col.className = cls;
|
|
143
|
+
}
|
|
144
|
+
// adds sort indicators for current column being sorted
|
|
145
|
+
function addSortIndicators() {
|
|
146
|
+
getNthColumn(currentSort.index).className += currentSort.desc
|
|
147
|
+
? ' sorted-desc'
|
|
148
|
+
: ' sorted';
|
|
149
|
+
}
|
|
150
|
+
// adds event listeners for all sorter widgets
|
|
151
|
+
function enableUI() {
|
|
152
|
+
var i,
|
|
153
|
+
el,
|
|
154
|
+
ithSorter = function ithSorter(i) {
|
|
155
|
+
var col = cols[i];
|
|
156
|
+
|
|
157
|
+
return function() {
|
|
158
|
+
var desc = col.defaultDescSort;
|
|
159
|
+
|
|
160
|
+
if (currentSort.index === i) {
|
|
161
|
+
desc = !currentSort.desc;
|
|
162
|
+
}
|
|
163
|
+
sortByIndex(i, desc);
|
|
164
|
+
removeSortIndicators();
|
|
165
|
+
currentSort.index = i;
|
|
166
|
+
currentSort.desc = desc;
|
|
167
|
+
addSortIndicators();
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
for (i = 0; i < cols.length; i += 1) {
|
|
171
|
+
if (cols[i].sortable) {
|
|
172
|
+
// add the click event handler on the th so users
|
|
173
|
+
// dont have to click on those tiny arrows
|
|
174
|
+
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
|
175
|
+
if (el.addEventListener) {
|
|
176
|
+
el.addEventListener('click', ithSorter(i));
|
|
177
|
+
} else {
|
|
178
|
+
el.attachEvent('onclick', ithSorter(i));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// adds sorting functionality to the UI
|
|
184
|
+
return function() {
|
|
185
|
+
if (!getTable()) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
cols = loadColumns();
|
|
189
|
+
loadData();
|
|
190
|
+
addSearchBox();
|
|
191
|
+
addSortIndicators();
|
|
192
|
+
enableUI();
|
|
193
|
+
};
|
|
194
|
+
})();
|
|
195
|
+
|
|
196
|
+
window.addEventListener('load', addSorting);
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
TN:
|
|
2
|
+
SF:src/components/Group/Group.tsx
|
|
3
|
+
FN:18,(anonymous_4)
|
|
4
|
+
FNF:1
|
|
5
|
+
FNH:0
|
|
6
|
+
FNDA:0,(anonymous_4)
|
|
7
|
+
DA:2,0
|
|
8
|
+
DA:18,0
|
|
9
|
+
DA:19,0
|
|
10
|
+
DA:20,0
|
|
11
|
+
DA:21,0
|
|
12
|
+
DA:22,0
|
|
13
|
+
DA:23,0
|
|
14
|
+
DA:24,0
|
|
15
|
+
DA:25,0
|
|
16
|
+
DA:27,0
|
|
17
|
+
LF:10
|
|
18
|
+
LH:0
|
|
19
|
+
BRDA:19,0,0,0
|
|
20
|
+
BRDA:19,0,1,0
|
|
21
|
+
BRDA:20,1,0,0
|
|
22
|
+
BRDA:20,1,1,0
|
|
23
|
+
BRDA:31,2,0,0
|
|
24
|
+
BRDA:31,2,1,0
|
|
25
|
+
BRF:6
|
|
26
|
+
BRH:0
|
|
27
|
+
end_of_record
|
|
28
|
+
TN:
|
|
29
|
+
SF:src/components/Line/Line.tsx
|
|
30
|
+
FN:15,(anonymous_4)
|
|
31
|
+
FNF:1
|
|
32
|
+
FNH:0
|
|
33
|
+
FNDA:0,(anonymous_4)
|
|
34
|
+
DA:2,0
|
|
35
|
+
DA:15,0
|
|
36
|
+
DA:16,0
|
|
37
|
+
DA:17,0
|
|
38
|
+
DA:18,0
|
|
39
|
+
DA:19,0
|
|
40
|
+
DA:20,0
|
|
41
|
+
DA:21,0
|
|
42
|
+
DA:23,0
|
|
43
|
+
DA:25,0
|
|
44
|
+
LF:10
|
|
45
|
+
LH:0
|
|
46
|
+
BRDA:16,0,0,0
|
|
47
|
+
BRDA:16,0,1,0
|
|
48
|
+
BRDA:17,1,0,0
|
|
49
|
+
BRDA:17,1,1,0
|
|
50
|
+
BRDA:18,2,0,0
|
|
51
|
+
BRDA:18,2,1,0
|
|
52
|
+
BRDA:23,3,0,0
|
|
53
|
+
BRDA:23,3,1,0
|
|
54
|
+
BRDA:34,4,0,0
|
|
55
|
+
BRDA:34,4,1,0
|
|
56
|
+
BRF:10
|
|
57
|
+
BRH:0
|
|
58
|
+
end_of_record
|
|
59
|
+
TN:
|
|
60
|
+
SF:src/components/ParentsizeSVG/ParentsizeSVG.tsx
|
|
61
|
+
FN:25,ParentsizeSVG
|
|
62
|
+
FN:36,(anonymous_7)
|
|
63
|
+
FNF:2
|
|
64
|
+
FNH:2
|
|
65
|
+
FNDA:2,ParentsizeSVG
|
|
66
|
+
FNDA:1,(anonymous_7)
|
|
67
|
+
DA:1,1
|
|
68
|
+
DA:3,1
|
|
69
|
+
DA:4,1
|
|
70
|
+
DA:16,1
|
|
71
|
+
DA:25,1
|
|
72
|
+
DA:26,2
|
|
73
|
+
DA:27,2
|
|
74
|
+
DA:28,2
|
|
75
|
+
DA:29,2
|
|
76
|
+
DA:30,2
|
|
77
|
+
DA:31,2
|
|
78
|
+
DA:32,2
|
|
79
|
+
DA:34,2
|
|
80
|
+
DA:36,2
|
|
81
|
+
DA:37,1
|
|
82
|
+
DA:38,1
|
|
83
|
+
DA:41,0
|
|
84
|
+
DA:43,0
|
|
85
|
+
DA:48,2
|
|
86
|
+
DA:50,2
|
|
87
|
+
LF:20
|
|
88
|
+
LH:18
|
|
89
|
+
BRDA:28,0,0,2
|
|
90
|
+
BRDA:28,0,1,0
|
|
91
|
+
BRDA:29,1,0,2
|
|
92
|
+
BRDA:29,1,1,0
|
|
93
|
+
BRDA:30,2,0,2
|
|
94
|
+
BRDA:30,2,1,0
|
|
95
|
+
BRDA:31,3,0,2
|
|
96
|
+
BRDA:31,3,1,0
|
|
97
|
+
BRDA:31,4,0,2
|
|
98
|
+
BRDA:31,4,1,0
|
|
99
|
+
BRDA:37,5,0,1
|
|
100
|
+
BRDA:48,6,0,0
|
|
101
|
+
BRDA:48,6,1,2
|
|
102
|
+
BRF:13
|
|
103
|
+
BRH:7
|
|
104
|
+
end_of_record
|
|
105
|
+
TN:
|
|
106
|
+
SF:src/components/ResponsiveSVG/ResponsiveSVG.tsx
|
|
107
|
+
FN:19,(anonymous_2)
|
|
108
|
+
FNF:1
|
|
109
|
+
FNH:1
|
|
110
|
+
FNDA:5,(anonymous_2)
|
|
111
|
+
DA:19,2
|
|
112
|
+
DA:20,5
|
|
113
|
+
DA:21,5
|
|
114
|
+
DA:22,5
|
|
115
|
+
DA:23,5
|
|
116
|
+
DA:24,5
|
|
117
|
+
DA:25,5
|
|
118
|
+
DA:26,5
|
|
119
|
+
DA:28,5
|
|
120
|
+
DA:30,5
|
|
121
|
+
DA:32,5
|
|
122
|
+
LF:11
|
|
123
|
+
LH:11
|
|
124
|
+
BRDA:23,0,0,5
|
|
125
|
+
BRDA:23,0,1,0
|
|
126
|
+
BRDA:24,1,0,5
|
|
127
|
+
BRDA:24,1,1,0
|
|
128
|
+
BRF:4
|
|
129
|
+
BRH:2
|
|
130
|
+
end_of_record
|
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,55 @@
|
|
|
1
1
|
# @cutting/svg
|
|
2
2
|
|
|
3
|
+
## 4.31.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 68080fa3: more
|
|
8
|
+
- Updated dependencies [68080fa3]
|
|
9
|
+
- @cutting/use-get-parent-size@1.6.2
|
|
10
|
+
- @cutting/util@4.29.2
|
|
11
|
+
|
|
12
|
+
## 4.31.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 8a44b1b8: add @cutting/vercel-wait-for-preview-url
|
|
17
|
+
- Updated dependencies [8a44b1b8]
|
|
18
|
+
- @cutting/use-get-parent-size@1.6.1
|
|
19
|
+
- @cutting/util@4.29.1
|
|
20
|
+
|
|
21
|
+
## 4.31.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- 7edd9a89: upgrade to typescript 4.5
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [7edd9a89]
|
|
30
|
+
- @cutting/use-get-parent-size@1.6.0
|
|
31
|
+
- @cutting/util@4.29.0
|
|
32
|
+
|
|
33
|
+
## 4.30.1
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies
|
|
38
|
+
- @cutting/util@4.28.2
|
|
39
|
+
- @cutting/use-get-parent-size@1.5.2
|
|
40
|
+
|
|
41
|
+
## 4.30.0
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- Make innerRef Ref
|
|
46
|
+
|
|
3
47
|
## 4.29.1
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
|
6
50
|
|
|
7
51
|
- publish onBlur for component library
|
|
8
|
-
- Updated dependencies
|
|
52
|
+
- Updated dependencies
|
|
9
53
|
- @cutting/use-get-parent-size@1.5.1
|
|
10
54
|
- @cutting/util@4.28.1
|
|
11
55
|
|
|
@@ -17,7 +61,7 @@
|
|
|
17
61
|
|
|
18
62
|
### Patch Changes
|
|
19
63
|
|
|
20
|
-
- Updated dependencies
|
|
64
|
+
- Updated dependencies
|
|
21
65
|
- @cutting/use-get-parent-size@1.5.0
|
|
22
66
|
- @cutting/util@4.28.0
|
|
23
67
|
|
package/demo/App.tsx
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import '@cutting/component-library/styles.css';
|
|
2
|
-
import type { FC } from 'react';
|
|
3
2
|
import { useRef } from 'react';
|
|
4
|
-
import { ApplicationLayout } from '@cutting/component-library';
|
|
3
|
+
import { ApplicationLayout, cuttingTheme } from '@cutting/component-library';
|
|
5
4
|
import { ParentsizeSVG } from '../src/components/ParentsizeSVG/ParentsizeSVG';
|
|
6
5
|
|
|
7
|
-
import styles from './global.
|
|
6
|
+
import * as styles from './global.css';
|
|
8
7
|
|
|
9
|
-
export
|
|
8
|
+
export function App(): JSX.Element {
|
|
10
9
|
const ref = useRef<HTMLDivElement>(null);
|
|
11
10
|
return (
|
|
12
|
-
<ApplicationLayout heading="@cutting/svg">
|
|
11
|
+
<ApplicationLayout heading="@cutting/svg" className={cuttingTheme}>
|
|
13
12
|
<div className={styles.container} ref={ref}>
|
|
14
|
-
<ParentsizeSVG elementRef={ref} options={{ debounceDelay:
|
|
13
|
+
<ParentsizeSVG elementRef={ref} options={{ debounceDelay: 10 }}>
|
|
15
14
|
<rect
|
|
16
15
|
x="20%"
|
|
17
16
|
y="20%"
|
|
@@ -33,4 +32,4 @@ export const App: FC = () => {
|
|
|
33
32
|
</div>
|
|
34
33
|
</ApplicationLayout>
|
|
35
34
|
);
|
|
36
|
-
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { globalStyle, style } from '@vanilla-extract/css';
|
|
2
|
+
|
|
3
|
+
export const container = style({
|
|
4
|
+
border: '1px solid yellow',
|
|
5
|
+
background: 'grey',
|
|
6
|
+
color: 'white',
|
|
7
|
+
overflow: 'hidden',
|
|
8
|
+
resize: 'both',
|
|
9
|
+
width: '50%',
|
|
10
|
+
height: '50%',
|
|
11
|
+
fontWeight: 'bold',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
margin: '0 auto',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
globalStyle('svg', {
|
|
18
|
+
border: '1px solid royalblue;',
|
|
19
|
+
});
|
package/demo/tsconfig.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"target": "
|
|
5
|
-
"module": "
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
6
|
"outDir": "dist",
|
|
7
7
|
"rootDir": "."
|
|
8
8
|
},
|
|
9
|
+
"references": [
|
|
10
|
+
{ "path": "../tsconfig.dist.json" },
|
|
11
|
+
{ "path": "../../hooks/tsconfig.dist.json" },
|
|
12
|
+
{ "path": "../../util/tsconfig.dist.json" }
|
|
13
|
+
],
|
|
9
14
|
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
10
15
|
"exclude": ["src/**/*.test.ts", "src/**/*.test.tsx"],
|
|
11
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FC,
|
|
1
|
+
import type { FC, Ref } from 'react';
|
|
2
2
|
import { PreserveAspectRatio } from '../../types/types';
|
|
3
3
|
export interface Point {
|
|
4
4
|
x: number;
|
|
@@ -9,7 +9,7 @@ export interface ResponsiveSVGProps {
|
|
|
9
9
|
height: number;
|
|
10
10
|
origin?: Point;
|
|
11
11
|
preserveAspectRatio?: PreserveAspectRatio;
|
|
12
|
-
innerRef?:
|
|
12
|
+
innerRef?: Ref<SVGSVGElement>;
|
|
13
13
|
className?: string;
|
|
14
14
|
hide?: boolean;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ResponsiveSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/ResponsiveSVG/ResponsiveSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAiChD,CAAC"}
|
|
@@ -44,26 +44,24 @@ var ResponsiveSVG = function ResponsiveSVG(_ref) {
|
|
|
44
44
|
className = _ref.className;
|
|
45
45
|
var aspect = width / height;
|
|
46
46
|
var adjustedHeight = Math.ceil(width / aspect);
|
|
47
|
-
return jsxRuntime.jsx("div",
|
|
47
|
+
return jsxRuntime.jsx("div", {
|
|
48
48
|
"data-selector": "cutting-svg-container",
|
|
49
49
|
style: {
|
|
50
50
|
position: 'relative',
|
|
51
51
|
overflow: 'visible',
|
|
52
52
|
height: '1px'
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
children: jsxRuntime.jsx("svg", Object.assign({
|
|
53
|
+
},
|
|
54
|
+
children: jsxRuntime.jsx("svg", {
|
|
56
55
|
style: {
|
|
57
56
|
overflow: 'visible'
|
|
58
57
|
},
|
|
59
58
|
className: className,
|
|
60
59
|
preserveAspectRatio: preserveAspectRatio,
|
|
61
60
|
viewBox: "".concat(origin.x, " ").concat(origin.y, " ").concat(width, " ").concat(adjustedHeight),
|
|
62
|
-
ref: innerRef
|
|
63
|
-
}, {
|
|
61
|
+
ref: innerRef,
|
|
64
62
|
children: children
|
|
65
|
-
}
|
|
66
|
-
}
|
|
63
|
+
}, void 0)
|
|
64
|
+
}, void 0);
|
|
67
65
|
};
|
|
68
66
|
|
|
69
67
|
var _excluded$2 = ["debounceDelay"],
|
|
@@ -114,15 +112,14 @@ function ParentsizeSVG(_ref) {
|
|
|
114
112
|
}
|
|
115
113
|
}, [elementRef, style]);
|
|
116
114
|
var transform = align === 'center' ? "translate(".concat(width / 2, ",").concat(height / 2 - 20, ") scale(").concat(scale, ")") : "0,0) scale(".concat(scale, ")");
|
|
117
|
-
return jsxRuntime.jsx(ResponsiveSVG,
|
|
115
|
+
return jsxRuntime.jsx(ResponsiveSVG, _objectSpread__default["default"](_objectSpread__default["default"]({
|
|
118
116
|
width: width,
|
|
119
117
|
height: height
|
|
120
|
-
}, rest, {
|
|
121
|
-
children: jsxRuntime.jsx("g",
|
|
122
|
-
transform: transform
|
|
123
|
-
}, {
|
|
118
|
+
}, rest), {}, {
|
|
119
|
+
children: jsxRuntime.jsx("g", {
|
|
120
|
+
transform: transform,
|
|
124
121
|
children: children
|
|
125
|
-
}
|
|
122
|
+
}, void 0)
|
|
126
123
|
}), void 0);
|
|
127
124
|
}
|
|
128
125
|
|
|
@@ -138,11 +135,11 @@ var Group = function Group(_ref) {
|
|
|
138
135
|
innerRef = _ref.innerRef,
|
|
139
136
|
restProps = _objectWithoutProperties__default["default"](_ref, _excluded$1);
|
|
140
137
|
|
|
141
|
-
return jsxRuntime.jsx("g",
|
|
138
|
+
return jsxRuntime.jsx("g", _objectSpread__default["default"](_objectSpread__default["default"]({
|
|
142
139
|
ref: innerRef,
|
|
143
140
|
className: cx__default["default"]('visx-group', className),
|
|
144
141
|
transform: transform || "translate(".concat(x, ", ").concat(y, ")")
|
|
145
|
-
}, restProps, {
|
|
142
|
+
}, restProps), {}, {
|
|
146
143
|
children: children
|
|
147
144
|
}), void 0);
|
|
148
145
|
};
|
|
@@ -166,7 +163,7 @@ var Line = function Line(_ref) {
|
|
|
166
163
|
restProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
167
164
|
|
|
168
165
|
var isRectilinear = from.x === to.x || from.y === to.y;
|
|
169
|
-
return jsxRuntime.jsx("line",
|
|
166
|
+
return jsxRuntime.jsx("line", _objectSpread__default["default"]({
|
|
170
167
|
ref: innerRef,
|
|
171
168
|
className: cx__default["default"]('visx-line', className),
|
|
172
169
|
x1: from.x,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.cjs.development.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { FC,
|
|
1
|
+
{"version":3,"file":"svg.cjs.development.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { FC, Ref } from 'react';\nimport { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n}\n\nexport const ResponsiveSVG: FC<ResponsiveSVGProps> = ({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}) => {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n};\n","import { CSSProperties, PropsWithChildren, RefObject, useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG, ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center' ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})` : `0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import type { FC } from 'react';\nimport cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport const Group: FC<GroupProps> = ({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element => {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n};\n","import type { FC } from 'react';\nimport cx from 'classnames';\nimport { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport const Line: FC<LineProps> = ({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element => {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n};\n"],"names":["ResponsiveSVG","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","aspect","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","elementRef","scale","align","options","debounceDelay","optionsRest","rest","useParentSize","useEffect","current","Object","entries","key","value","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkBaA,aAAa,GAA2B,SAAxCA,aAAwC;MACnDC,cAAAA;MACAC,aAAAA;MACAC,gBAAAA;yBACAC;MAAAA,kCAAS;AAAEC,IAAAA,CAAC,EAAE,CAAL;AAAQC,IAAAA,CAAC,EAAE;AAAX;mCACTC;MAAAA,yDAAsB;MACtBC,gBAAAA;MACAC,iBAAAA;AAEA,MAAMC,MAAM,GAAGR,KAAK,GAAGD,MAAvB;AAEA,MAAMU,cAAc,GAAGC,IAAI,CAACC,IAAL,CAAUX,KAAK,GAAGQ,MAAlB,CAAvB;AAEA,SACEI;qBACgB;AACdC,IAAAA,KAAK,EAAE;AACLC,MAAAA,QAAQ,EAAE,UADL;AAELC,MAAAA,QAAQ,EAAE,SAFL;AAGLhB,MAAAA,MAAM,EAAE;AAHH;c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EL,EAAE,CAAC1C;AACPgD,IAAAA,EAAE,EAAEN,EAAE,CAACzC;AACP0C,IAAAA,IAAI,EAAEA;AACNM,IAAAA,cAAc,EAAEL,aAAa,GAAG,YAAH,GAAkB;KAC3CN,mBAVR;AAaD;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/helpers/objectSpread2"),i=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("react"),s=require("@cutting/use-get-parent-size"),a=require("classnames");function o(e){return e&&e.__esModule?e:{default:e}}var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/helpers/objectSpread2"),i=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("react"),s=require("@cutting/use-get-parent-size"),a=require("classnames");function o(e){return e&&e.__esModule?e:{default:e}}var l=o(r),c=o(t),d=o(i),u=o(a);!function(){const e={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var f=function(r){var t=r.width,i=r.children,n=r.origin,s=void 0===n?{x:0,y:0}:n,a=r.preserveAspectRatio,o=void 0===a?"xMaxYMid meet":a,l=r.innerRef,c=r.className,d=Math.ceil(t/(t/r.height));return e.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e.jsx("svg",{style:{overflow:"visible"},className:c,preserveAspectRatio:o,viewBox:"".concat(s.x," ").concat(s.y," ").concat(t," ").concat(d),ref:l,children:i},void 0)},void 0)},v=["debounceDelay"],x=["elementRef","children","style","scale","align","options"],p={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},h=["y","x","transform","className","children","innerRef"],y=["from","to","fill","className","innerRef"];exports.Group=function(r){var t=r.y,i=void 0===t?0:t,n=r.x,s=void 0===n?0:n,a=r.transform,o=r.className,l=r.children,f=r.innerRef,v=d.default(r,h);return e.jsx("g",c.default(c.default({ref:f,className:u.default("visx-group",o),transform:a||"translate(".concat(s,", ").concat(i,")")},v),{},{children:l}),void 0)},exports.Line=function(r){var t=r.from,i=void 0===t?{x:0,y:0}:t,n=r.to,s=void 0===n?{x:1,y:1}:n,a=r.fill,o=void 0===a?"transparent":a,l=r.className,f=r.innerRef,v=d.default(r,y),x=i.x===s.x||i.y===s.y;return e.jsx("line",c.default({ref:f,className:u.default("visx-line",l),x1:i.x,y1:i.y,x2:s.x,y2:s.y,fill:o,shapeRendering:x?"crispEdges":"auto"},v),void 0)},exports.ParentsizeSVG=function(r){var t=r.elementRef,i=r.children,a=r.style,o=void 0===a?p:a,u=r.scale,h=void 0===u?1:u,y=r.align,m=void 0===y?"none":y,g=r.options,b=(g=void 0===g?{}:g).debounceDelay,j=void 0===b?50:b,R=d.default(g,v),N=d.default(r,x),w=s.useParentSize(t,c.default({debounceDelay:j},R)),q=w.width,D=w.height;n.useEffect((function(){if(t.current)for(var e=0,r=Object.entries(o);e<r.length;e++){var i=l.default(r[e],2);t.current.style[i[0]]=i[1]}}),[t,o]);var M="center"===m?"translate(".concat(q/2,",").concat(D/2-20,") scale(").concat(h,")"):"0,0) scale(".concat(h,")");return e.jsx(f,c.default(c.default({width:q,height:D},N),{},{children:e.jsx("g",{transform:M,children:i},void 0)}),void 0)},exports.ResponsiveSVG=f;
|
|
2
2
|
//# sourceMappingURL=svg.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.cjs.production.min.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { FC,
|
|
1
|
+
{"version":3,"file":"svg.cjs.production.min.js","sources":["../../src/components/ResponsiveSVG/ResponsiveSVG.tsx","../../src/components/ParentsizeSVG/ParentsizeSVG.tsx","../../src/components/Group/Group.tsx","../../src/components/Line/Line.tsx"],"sourcesContent":["import type { FC, Ref } from 'react';\nimport { PreserveAspectRatio } from '../../types/types';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface ResponsiveSVGProps {\n width: number;\n height: number;\n origin?: Point;\n preserveAspectRatio?: PreserveAspectRatio;\n innerRef?: Ref<SVGSVGElement>;\n className?: string;\n hide?: boolean;\n}\n\nexport const ResponsiveSVG: FC<ResponsiveSVGProps> = ({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}) => {\n const aspect = width / height;\n\n const adjustedHeight = Math.ceil(width / aspect);\n\n return (\n <div\n data-selector=\"cutting-svg-container\"\n style={{\n position: 'relative',\n overflow: 'visible',\n height: '1px',\n }}\n >\n <svg\n style={{ overflow: 'visible' }}\n className={className}\n preserveAspectRatio={preserveAspectRatio}\n viewBox={`${origin.x} ${origin.y} ${width} ${adjustedHeight}`}\n ref={innerRef}\n >\n {children}\n </svg>\n </div>\n );\n};\n","import { CSSProperties, PropsWithChildren, RefObject, useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport { ResponsiveSVG, ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement> = {\n elementRef: RefObject<E>;\n style?: CSSProperties;\n align?: Align;\n scale?: number;\n options?: Partial<UseParentSizeOptions>;\n} & Partial<Omit<ResponsiveSVGProps, 'innerRef' | 'height' | 'height'>>;\n\nexport const DefaultStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: '0%',\n overflow: 'hidden',\n} as const;\n\nexport function ParentsizeSVG<E extends HTMLElement>({\n elementRef,\n children,\n style = DefaultStyle,\n scale = 1,\n align = 'none',\n options: { debounceDelay = 50, ...optionsRest } = {},\n ...rest\n}: PropsWithChildren<ParentsizeSVGProps<E>>): JSX.Element | null {\n const { width, height } = useParentSize(elementRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n\n for (const [key, value] of Object.entries(style)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementRef.current.style[key as any] = value;\n }\n }, [elementRef, style]);\n\n const transform =\n align === 'center' ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})` : `0,0) scale(${scale})`;\n\n return (\n <ResponsiveSVG width={width} height={height} {...rest}>\n <g transform={transform}>{children}</g>\n </ResponsiveSVG>\n );\n}\n","import type { FC } from 'react';\nimport cx from 'classnames';\n\ntype GroupOnlyProps = {\n /** Top offset applied to `<g/>`. */\n y?: number;\n /** Left offset applied to `<g/>`. */\n x?: number;\n /** Override `x` and `y` to provide the entire `transform` string. */\n transform?: string;\n className?: string;\n children?: React.ReactNode;\n innerRef?: React.Ref<SVGGElement>;\n};\n\ntype GroupProps = GroupOnlyProps & Omit<React.SVGProps<SVGGElement>, keyof GroupOnlyProps>;\n\nexport const Group: FC<GroupProps> = ({\n y = 0,\n x = 0,\n transform,\n className,\n children,\n innerRef,\n ...restProps\n}: GroupProps): JSX.Element => {\n return (\n <g\n ref={innerRef}\n className={cx('visx-group', className)}\n transform={transform || `translate(${x}, ${y})`}\n {...restProps}\n >\n {children}\n </g>\n );\n};\n","import type { FC } from 'react';\nimport cx from 'classnames';\nimport { AddSVGProps, Point } from '../../types/types';\n\nexport type LineProps = {\n className?: string;\n innerRef?: React.Ref<SVGLineElement>;\n fill?: string;\n /** Starting x,y point of the line. */\n from?: Point;\n /** Ending x,y point of the line. */\n to?: Point;\n};\n\nexport const Line: FC<LineProps> = ({\n from = { x: 0, y: 0 },\n to = { x: 1, y: 1 },\n fill = 'transparent',\n className,\n innerRef,\n ...restProps\n}: AddSVGProps<LineProps, SVGLineElement>): JSX.Element => {\n const isRectilinear = from.x === to.x || from.y === to.y;\n\n return (\n <line\n ref={innerRef}\n className={cx('visx-line', className)}\n x1={from.x}\n y1={from.y}\n x2={to.x}\n y2={to.y}\n fill={fill}\n shapeRendering={isRectilinear ? 'crispEdges' : 'auto'}\n {...restProps}\n />\n );\n};\n"],"names":["ResponsiveSVG","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","height","_jsx","style","position","overflow","viewBox","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","transform","restProps","cx","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering","elementRef","scale","align","options","debounceDelay","optionsRest","rest","useParentSize","useEffect","current","Object","entries"],"mappings":"ymBAkBaA,EAAwC,gBAEnDC,IAAAA,MACAC,IAAAA,aACAC,OAAAA,aAAS,CAAEC,EAAG,EAAGC,EAAG,SACpBC,oBAAAA,aAAsB,kBACtBC,IAAAA,SACAC,IAAAA,UAIMC,EAAiBC,KAAKC,KAAKV,GAFlBA,IARfW,gBAaEC,6BACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVJ,OAAQ,gBAGVC,aACEC,MAAO,CAAEE,SAAU,WACnBR,UAAWA,EACXF,oBAAqBA,EACrBW,kBAAYd,EAAOC,cAAKD,EAAOE,cAAKJ,cAASQ,GAC7CS,IAAKX,WAEJL,uGChCIiB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW,KACXR,SAAU,gICJyB,oBACnCX,EAAAA,aAAI,QACJD,EAAAA,aAAI,IACJqB,IAAAA,UACAjB,IAAAA,UACAN,IAAAA,SACAK,IAAAA,SACGmB,wBAGDb,+BACEK,IAAKX,EACLC,UAAWmB,UAAG,aAAcnB,GAC5BiB,UAAWA,uBAA0BrB,eAAMC,QACvCqB,gBAEHxB,0BCnB4B,oBACjC0B,KAAAA,aAAO,C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