@cutting/svg 4.41.2 → 4.42.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.
@@ -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:17,Group
4
+ FNF:1
5
+ FNH:0
6
+ FNDA:0,Group
7
+ DA:1,0
8
+ DA:17,0
9
+ DA:18,0
10
+ DA:19,0
11
+ DA:20,0
12
+ DA:21,0
13
+ DA:22,0
14
+ DA:23,0
15
+ DA:24,0
16
+ DA:26,0
17
+ LF:10
18
+ LH:0
19
+ BRDA:18,0,0,0
20
+ BRDA:18,0,1,0
21
+ BRDA:19,1,0,0
22
+ BRDA:19,1,1,0
23
+ BRDA:30,2,0,0
24
+ BRDA:30,2,1,0
25
+ BRF:6
26
+ BRH:0
27
+ end_of_record
28
+ TN:
29
+ SF:src/components/Line/Line.tsx
30
+ FN:14,Line
31
+ FNF:1
32
+ FNH:0
33
+ FNDA:0,Line
34
+ DA:1,0
35
+ DA:14,0
36
+ DA:15,0
37
+ DA:16,0
38
+ DA:17,0
39
+ DA:18,0
40
+ DA:19,0
41
+ DA:20,0
42
+ DA:22,0
43
+ DA:24,0
44
+ LF:10
45
+ LH:0
46
+ BRDA:15,0,0,0
47
+ BRDA:15,0,1,0
48
+ BRDA:16,1,0,0
49
+ BRDA:16,1,1,0
50
+ BRDA:17,2,0,0
51
+ BRDA:17,2,1,0
52
+ BRDA:22,3,0,0
53
+ BRDA:22,3,1,0
54
+ BRDA:33,4,0,0
55
+ BRDA:33,4,1,0
56
+ BRF:10
57
+ BRH:0
58
+ end_of_record
59
+ TN:
60
+ SF:src/components/ParentsizeSVG/ParentsizeSVG.tsx
61
+ FN:27,ParentsizeSVG
62
+ FN:38,(anonymous_7)
63
+ FNF:2
64
+ FNH:2
65
+ FNDA:6,ParentsizeSVG
66
+ FNDA:3,(anonymous_7)
67
+ DA:2,1
68
+ DA:4,1
69
+ DA:6,1
70
+ DA:18,1
71
+ DA:27,1
72
+ DA:28,6
73
+ DA:29,6
74
+ DA:30,6
75
+ DA:31,6
76
+ DA:32,6
77
+ DA:33,6
78
+ DA:34,6
79
+ DA:36,6
80
+ DA:38,6
81
+ DA:39,3
82
+ DA:40,3
83
+ DA:43,0
84
+ DA:45,0
85
+ DA:50,6
86
+ DA:54,6
87
+ LF:20
88
+ LH:18
89
+ BRDA:30,0,0,6
90
+ BRDA:30,0,1,0
91
+ BRDA:31,1,0,6
92
+ BRDA:31,1,1,0
93
+ BRDA:32,2,0,4
94
+ BRDA:32,2,1,2
95
+ BRDA:33,3,0,6
96
+ BRDA:33,3,1,0
97
+ BRDA:33,4,0,6
98
+ BRDA:33,4,1,0
99
+ BRDA:39,5,0,3
100
+ BRDA:50,6,0,2
101
+ BRDA:50,6,1,4
102
+ BRF:13
103
+ BRH:9
104
+ end_of_record
105
+ TN:
106
+ SF:src/components/ResponsiveSVG/ResponsiveSVG.tsx
107
+ FN:20,ResponsiveSVG
108
+ FNF:1
109
+ FNH:1
110
+ FNDA:9,ResponsiveSVG
111
+ DA:20,2
112
+ DA:21,9
113
+ DA:22,9
114
+ DA:23,9
115
+ DA:24,9
116
+ DA:25,9
117
+ DA:26,9
118
+ DA:27,9
119
+ DA:29,9
120
+ DA:31,9
121
+ DA:33,9
122
+ LF:11
123
+ LH:11
124
+ BRDA:24,0,0,9
125
+ BRDA:24,0,1,0
126
+ BRDA:25,1,0,9
127
+ BRDA:25,1,1,0
128
+ BRF:4
129
+ BRH:2
130
+ end_of_record
@@ -1,22 +1,22 @@
1
- @cutting/svg:build: cache hit, replaying output 2861b1424e73e315
2
- @cutting/svg:build:
3
- @cutting/svg:build: > @cutting/svg@4.41.2 build /home/runner/work/cuttingedge/cuttingedge/packages/svg
4
- @cutting/svg:build: > NODE_ENV=production devtools rollup
5
- @cutting/svg:build:
6
- @cutting/svg:build: DEBUG using tsconfig.dist.json
7
- @cutting/svg:build: WARNING emptying dist /home/runner/work/cuttingedge/cuttingedge/packages/svg/dist
8
- @cutting/svg:build: START using input file index.ts for @cutting/svg
9
- @cutting/svg:build:
10
- @cutting/svg:build: INFO Generating @cutting/svg bundle.
11
- @cutting/svg:build: INFO writing svg.cjs.development.js for @cutting/svg
12
- @cutting/svg:build: INFO writing svg.cjs.production.min.js for @cutting/svg
13
- @cutting/svg:build: INFO writing index.js for @cutting/svg
14
- @cutting/svg:build: INFO writing index.js for @cutting/svg
15
- @cutting/svg:build: No name was provided for external module 'react/jsx-runtime' in output.globals – guessing 'jsxRuntime'
16
- @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/slicedToArray' in output.globals – guessing '_slicedToArray'
17
- @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/objectSpread2' in output.globals – guessing '_objectSpread'
18
- @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/objectWithoutProperties' in output.globals – guessing '_objectWithoutProperties'
19
- @cutting/svg:build: No name was provided for external module '@cutting/use-get-parent-size' in output.globals – guessing 'useGetParentSize'
20
- @cutting/svg:build: No name was provided for external module 'classnames' in output.globals – guessing 'cx'
21
- @cutting/svg:build: DONE finished building
22
- @cutting/svg:build:
1
+ @cutting/svg:build: cache hit, replaying output 4f5e69d225bd4526
2
+ @cutting/svg:build: 
3
+ @cutting/svg:build: > @cutting/svg@4.41.3 build /Users/paulcowan/projects/cuttingedge/packages/svg
4
+ @cutting/svg:build: > NODE_ENV=production devtools rollup
5
+ @cutting/svg:build: 
6
+ @cutting/svg:build:  DEBUG using tsconfig.dist.json
7
+ @cutting/svg:build:  WARNING emptying dist /Users/paulcowan/projects/cuttingedge/packages/svg/dist
8
+ @cutting/svg:build:  START using input file index.ts for @cutting/svg
9
+ @cutting/svg:build: 
10
+ @cutting/svg:build:  INFO Generating @cutting/svg bundle.
11
+ @cutting/svg:build:  INFO writing svg.cjs.development.js for @cutting/svg
12
+ @cutting/svg:build:  INFO writing svg.cjs.production.min.js for @cutting/svg
13
+ @cutting/svg:build:  INFO writing index.js for @cutting/svg
14
+ @cutting/svg:build:  INFO writing index.js for @cutting/svg
15
+ @cutting/svg:build: No name was provided for external module 'react/jsx-runtime' in output.globals – guessing 'jsxRuntime'
16
+ @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/slicedToArray' in output.globals – guessing '_slicedToArray'
17
+ @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/objectSpread2' in output.globals – guessing '_objectSpread'
18
+ @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/objectWithoutProperties' in output.globals – guessing '_objectWithoutProperties'
19
+ @cutting/svg:build: No name was provided for external module '@cutting/use-get-parent-size' in output.globals – guessing 'useGetParentSize'
20
+ @cutting/svg:build: No name was provided for external module 'classnames' in output.globals – guessing 'cx'
21
+ @cutting/svg:build:  DONE finished building
22
+ @cutting/svg:build: 
@@ -0,0 +1,5 @@
1
+ @cutting/svg:lint: cache hit, replaying output 53676e9693250da9
2
+ @cutting/svg:lint: 
3
+ @cutting/svg:lint: > @cutting/svg@4.41.3 lint /Users/paulcowan/projects/cuttingedge/packages/svg
4
+ @cutting/svg:lint: > eslint ./src/**/*.{ts,tsx} --fix
5
+ @cutting/svg:lint: 
@@ -0,0 +1,34 @@
1
+ @cutting/svg:test: cache hit, replaying output 47a4c835f990b625
2
+ @cutting/svg:test: 
3
+ @cutting/svg:test: > @cutting/svg@4.41.3 test /Users/paulcowan/projects/cuttingedge/packages/svg
4
+ @cutting/svg:test: > NODE_ENV=test devtools test
5
+ @cutting/svg:test: 
6
+ @cutting/svg:test: /Users/paulcowan/projects/cuttingedge/packages/tsconfig/tsconfig.test.json
7
+ @cutting/svg:test: PASS src/components/ResponsiveSVG/ResponsiveSVG.test.tsx (17.314 s)
8
+ @cutting/svg:test:  useParentSize
9
+ @cutting/svg:test:  ✓ should set the svg viewBox attribute (37 ms)
10
+ @cutting/svg:test: 
11
+ @cutting/svg:test: PASS src/components/ParentsizeSVG/ParentSizeSVG.test.tsx (18.775 s)
12
+ @cutting/svg:test:  useParentSize
13
+ @cutting/svg:test:  ✓ should set the svg viewBox attribute (227 ms)
14
+ @cutting/svg:test:  ✓ should render a transform attribute when not aligned (6 ms)
15
+ @cutting/svg:test:  ✓ should render a transform attribute when aligned (72 ms)
16
+ @cutting/svg:test: 
17
+ @cutting/svg:test: --------------------|---------|----------|---------|---------|-------------------
18
+ @cutting/svg:test: File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
19
+ @cutting/svg:test: --------------------|---------|----------|---------|---------|-------------------
20
+ @cutting/svg:test: All files | 55.55 | 33.33 | 60 | 56.86 |
21
+ @cutting/svg:test:  Group | 0 | 0 | 0 | 0 |
22
+ @cutting/svg:test:  Group.tsx | 0 | 0 | 0 | 0 | 1-26
23
+ @cutting/svg:test:  Line | 0 | 0 | 0 | 0 |
24
+ @cutting/svg:test:  Line.tsx | 0 | 0 | 0 | 0 | 1-24
25
+ @cutting/svg:test:  ParentsizeSVG | 79.41 | 69.23 | 100 | 90 |
26
+ @cutting/svg:test:  ParentsizeSVG.tsx | 79.41 | 69.23 | 100 | 90 | 43-45
27
+ @cutting/svg:test:  ResponsiveSVG | 100 | 50 | 100 | 100 |
28
+ @cutting/svg:test:  ResponsiveSVG.tsx | 100 | 50 | 100 | 100 | 24-25
29
+ @cutting/svg:test: --------------------|---------|----------|---------|---------|-------------------
30
+ @cutting/svg:test: Test Suites: 2 passed, 2 total
31
+ @cutting/svg:test: Tests: 4 passed, 4 total
32
+ @cutting/svg:test: Snapshots: 0 total
33
+ @cutting/svg:test: Time: 26.917 s
34
+ @cutting/svg:test: Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @cutting/svg
2
2
 
3
+ ## 4.42.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 899bd8abb: help
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [899bd8abb]
12
+ - @cutting/use-get-parent-size@1.16.0
13
+ - @cutting/util@4.44.0
14
+
15
+ ## 4.41.3
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [244b74e5]
20
+ - @cutting/util@4.43.0
21
+ - @cutting/use-get-parent-size@1.15.3
22
+
3
23
  ## 4.41.2
4
24
 
5
25
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cutting/svg",
3
- "version": "4.41.2",
3
+ "version": "4.42.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dagda1/cuttingedge.git"
@@ -15,18 +15,18 @@
15
15
  "types": "dist/esm/index.d.ts",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@cutting/use-get-parent-size": "workspace:*",
19
- "@cutting/util": "workspace:*",
18
+ "@cutting/use-get-parent-size": "1.16.0",
19
+ "@cutting/util": "4.44.0",
20
20
  "classnames": "^2.3.1",
21
21
  "resize-observer-polyfill": "^1.5.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@babel/runtime": "7.17.9",
25
- "@cutting/component-library": "workspace:*",
26
- "@cutting/devtools": "workspace:*",
27
- "@cutting/eslint-config": "workspace:*",
28
- "@cutting/tsconfig": "workspace:*",
29
- "@cutting/useful-types": "workspace:*",
25
+ "@cutting/component-library": "5.18.0",
26
+ "@cutting/devtools": "4.46.0",
27
+ "@cutting/eslint-config": "4.37.0",
28
+ "@cutting/tsconfig": "4.34.0",
29
+ "@cutting/useful-types": "4.33.0",
30
30
  "@jest/globals": "27.5.1",
31
31
  "@testing-library/jest-dom": "5.16.4",
32
32
  "@testing-library/react": "^13.0.1",
@@ -42,13 +42,6 @@
42
42
  "react": ">= 18.x.x",
43
43
  "react-dom": ">= 18.x.x"
44
44
  },
45
- "scripts": {
46
- "build": "NODE_ENV=production devtools rollup",
47
- "lint": "eslint ./src/**/*.{ts,tsx} --fix",
48
- "start": "PORT=8888 NODE_ENV=development devtools devserver-start",
49
- "test": "NODE_ENV=test devtools test",
50
- "test:ci": "CI=true pnpm test"
51
- },
52
45
  "volta": {
53
46
  "extends": "../../package.json"
54
47
  },
@@ -63,5 +56,13 @@
63
56
  "dist/esm/index.d.ts"
64
57
  ]
65
58
  }
66
- }
67
- }
59
+ },
60
+ "scripts": {
61
+ "build": "NODE_ENV=production devtools rollup",
62
+ "lint": "eslint ./src/**/*.{ts,tsx} --fix",
63
+ "start": "PORT=8888 NODE_ENV=development devtools devserver-start",
64
+ "test": "NODE_ENV=test devtools test",
65
+ "test:ci": "CI=true pnpm test"
66
+ },
67
+ "readme": "# @cutting/svg - reusable svg components for SVG documents\n[![npm version](https://img.shields.io/npm/v/@cutting/svg.svg)](https://www.npmjs.com/package/@cutting/svg)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\n## install \n\n```sh\npnpm add @cutting/svg\n\n# or\n\nnpm install @cutting/svg\n```\n\n## ParentsizeSVG\n\nA react component that will resize and scale to the dimensions of the supplied react [ref object](https://reactjs.org/docs/refs-and-the-dom.html).\n\n![svg document resizing to scale when using the ParentsizeSVG component](./img/sizer.gif)\n\nThe `ParentsizeSVG` component takes an `parentRef` prop that should point to a valid HTML DOM element.\n\n## usage\n\n```ts\nimport { useRef } from 'react';\nimport { ParentsizeSVG } from '@cutting/svg';\n\nexport function App(): JSX.Element {\n const ref = useRef<HTMLDivElement>(null);\n\n return (\n <div className={styles.container} ref={ref}>\n <ParentsizeSVG ref={ref}>\n <rect\n x=\"20%\"\n y=\"20%\"\n width={'50%'}\n height={'50%'}\n rx=\"20\"\n style={{ fill: '#ff0000', stroke: '#000000', strokeWidth: '2px' }}\n />\n </ParentsizeSVG>\n </div>\n );\n};\n```"
68
+ }
Binary file