@cutting/svg 4.41.4 → 4.43.1

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,6 +1,6 @@
1
- @cutting/svg:build: cache hit, replaying output 6ac6abf0d880aa6f
1
+ @cutting/svg:build: cache hit, replaying output 3ea9a47a8bc288f4
2
2
  @cutting/svg:build:
3
- @cutting/svg:build: > @cutting/svg@4.41.4 build /home/runner/work/cuttingedge/cuttingedge/packages/svg
3
+ @cutting/svg:build: > @cutting/svg@4.43.1 build /home/runner/work/cuttingedge/cuttingedge/packages/svg
4
4
  @cutting/svg:build: > NODE_ENV=production devtools rollup
5
5
  @cutting/svg:build:
6
6
  @cutting/svg:build: DEBUG using tsconfig.dist.json
@@ -13,7 +13,6 @@
13
13
  @cutting/svg:build: INFO writing index.js for @cutting/svg
14
14
  @cutting/svg:build: INFO writing index.js for @cutting/svg
15
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
16
  @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/objectSpread2' in output.globals – guessing '_objectSpread'
18
17
  @cutting/svg:build: No name was provided for external module '@babel/runtime/helpers/objectWithoutProperties' in output.globals – guessing '_objectWithoutProperties'
19
18
  @cutting/svg:build: No name was provided for external module '@cutting/use-get-parent-size' in output.globals – guessing 'useGetParentSize'
package/CHANGELOG.md CHANGED
@@ -1,423 +1,21 @@
1
1
  # @cutting/svg
2
2
 
3
- ## 4.41.4
3
+ ## 4.43.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [ba063559]
8
- - @cutting/util@4.44.0
9
- - @cutting/use-get-parent-size@1.15.4
7
+ - Updated dependencies [20164c54]
8
+ - @cutting/util@4.47.0
9
+ - @cutting/use-get-parent-size@1.17.1
10
10
 
11
- ## 4.41.3
12
-
13
- ### Patch Changes
14
-
15
- - Updated dependencies [244b74e5]
16
- - @cutting/util@4.43.0
17
- - @cutting/use-get-parent-size@1.15.3
18
-
19
- ## 4.41.2
20
-
21
- ### Patch Changes
22
-
23
- - Updated dependencies [b7c32b0d]
24
- - @cutting/util@4.42.0
25
- - @cutting/use-get-parent-size@1.15.2
26
-
27
- ## 4.41.1
28
-
29
- ### Patch Changes
30
-
31
- - Updated dependencies [bdc75fe3]
32
- - @cutting/util@4.41.0
33
- - @cutting/use-get-parent-size@1.15.1
34
-
35
- ## 4.41.0
36
-
37
- ### Minor Changes
38
-
39
- - d542ad8f: version
40
-
41
- ### Patch Changes
42
-
43
- - Updated dependencies [d542ad8f]
44
- - @cutting/use-get-parent-size@1.15.0
45
- - @cutting/util@4.40.0
46
-
47
- ## 4.40.1
48
-
49
- ### Patch Changes
50
-
51
- - Updated dependencies [22996a38]
52
- - @cutting/use-get-parent-size@1.14.1
53
-
54
- ## 4.40.0
55
-
56
- ### Minor Changes
57
-
58
- - is not well
59
-
60
- ### Patch Changes
61
-
62
- - Updated dependencies
63
- - @cutting/use-get-parent-size@1.14.0
64
- - @cutting/util@4.39.0
65
-
66
- ## 4.39.1
67
-
68
- ### Patch Changes
69
-
70
- - Updated dependencies [92d64693]
71
- - @cutting/util@4.38.1
72
- - @cutting/use-get-parent-size@1.13.1
73
-
74
- ## 4.39.0
75
-
76
- ### Minor Changes
77
-
78
- - aaa
79
-
80
- ### Patch Changes
81
-
82
- - Updated dependencies
83
- - @cutting/use-get-parent-size@1.13.0
84
- - @cutting/util@4.38.0
85
-
86
- ## 4.38.0
87
-
88
- ### Minor Changes
89
-
90
- - e08c3939: again
91
-
92
- ### Patch Changes
93
-
94
- - Updated dependencies [e08c3939]
95
- - @cutting/use-get-parent-size@1.12.0
96
- - @cutting/util@4.37.0
97
-
98
- ## 4.37.2
99
-
100
- ### Patch Changes
101
-
102
- - Updated dependencies [578d0a1a]
103
- - @cutting/util@4.36.0
104
- - @cutting/use-get-parent-size@1.11.2
105
-
106
- ## 4.37.1
107
-
108
- ### Patch Changes
109
-
110
- - dfb5f7bd: prefer workspace packages
111
- - Updated dependencies [dfb5f7bd]
112
- - @cutting/use-get-parent-size@1.11.1
113
- - @cutting/util@4.35.0
114
-
115
- ## 4.37.0
116
-
117
- ### Minor Changes
118
-
119
- - 72d1169e: run changesets
120
-
121
- ### Patch Changes
122
-
123
- - Updated dependencies [72d1169e]
124
- - @cutting/use-get-parent-size@1.11.0
125
- - @cutting/util@4.34.0
126
-
127
- ## 4.36.0
128
-
129
- ### Minor Changes
130
-
131
- - 11095849: component-library fixes
132
-
133
- ### Patch Changes
134
-
135
- - Updated dependencies [11095849]
136
- - @cutting/use-get-parent-size@1.10.0
137
- - @cutting/util@4.33.0
138
-
139
- ## 4.35.0
140
-
141
- ### Minor Changes
142
-
143
- - fe4c8c00: run pnpm -r update
144
-
145
- ### Patch Changes
146
-
147
- - Updated dependencies [fe4c8c00]
148
- - @cutting/use-get-parent-size@1.9.0
149
- - @cutting/util@4.32.0
150
-
151
- ## 4.34.1
152
-
153
- ### Patch Changes
154
-
155
- - e0188472: run changesets
156
- - Updated dependencies [e0188472]
157
- - @cutting/use-get-parent-size@1.8.1
158
- - @cutting/util@4.31.2
159
-
160
- ## 4.34.0
161
-
162
- ### Minor Changes
163
-
164
- - 8c139b38: rename elementRef parentRef
165
-
166
- ### Patch Changes
167
-
168
- - Updated dependencies [8c139b38]
169
- - @cutting/use-get-parent-size@1.8.0
170
-
171
- ## 4.33.0
172
-
173
- ### Minor Changes
174
-
175
- - 96855ac9: rename elementRef parentRef
176
-
177
- ### Patch Changes
178
-
179
- - Updated dependencies [96855ac9]
180
- - @cutting/use-get-parent-size@1.7.0
181
-
182
- ## 4.32.1
183
-
184
- ### Patch Changes
185
-
186
- - 0f3d2133: changesets fixes
187
- - Updated dependencies [0f3d2133]
188
- - @cutting/use-get-parent-size@1.6.11
189
- - @cutting/util@4.31.1
190
-
191
- ## 4.32.0
192
-
193
- ### Minor Changes
194
-
195
- - 3413251c: build in production
196
-
197
- ### Patch Changes
198
-
199
- - Updated dependencies [3413251c]
200
- - @cutting/util@4.31.0
201
- - @cutting/use-get-parent-size@1.6.10
202
-
203
- ## 4.31.9
204
-
205
- ### Patch Changes
206
-
207
- - Updated dependencies [e6a06fa0]
208
- - @cutting/util@4.30.0
209
- - @cutting/use-get-parent-size@1.6.9
210
-
211
- ## 4.31.8
212
-
213
- ### Patch Changes
214
-
215
- - 128579ea: fix changesets
216
- - Updated dependencies [128579ea]
217
- - @cutting/use-get-parent-size@1.6.8
218
- - @cutting/util@4.29.8
219
-
220
- ## 4.31.7
221
-
222
- ### Patch Changes
223
-
224
- - 565b42ff: yes
225
- - Updated dependencies [565b42ff]
226
- - @cutting/use-get-parent-size@1.6.7
227
- - @cutting/util@4.29.7
228
-
229
- ## 4.31.6
230
-
231
- ### Patch Changes
232
-
233
- - 0bdf3e9d: yarn.lock
234
- - 3bfd4f40: remove ignored packages
235
- - Updated dependencies [0bdf3e9d]
236
- - Updated dependencies [3bfd4f40]
237
- - @cutting/use-get-parent-size@1.6.6
238
- - @cutting/util@4.29.6
239
-
240
- ## 4.31.5
241
-
242
- ### Patch Changes
243
-
244
- - Updated dependencies [fe3eba28]
245
- - @cutting/util@4.29.5
246
- - @cutting/use-get-parent-size@1.6.5
247
-
248
- ## 4.31.4
249
-
250
- ### Patch Changes
251
-
252
- - 7262245f: consolidate versioning changes
253
- - Updated dependencies [7262245f]
254
- - @cutting/use-get-parent-size@1.6.4
255
- - @cutting/util@4.29.4
256
-
257
- ## 4.31.3
258
-
259
- ### Patch Changes
260
-
261
- - e8934df2: Add <Aliert />
262
- - 7262245f: consolidate versioning changes
263
- - Updated dependencies [e8934df2]
264
- - Updated dependencies [7262245f]
265
- - @cutting/use-get-parent-size@1.6.3
266
- - @cutting/util@4.29.3
267
-
268
- ## 4.31.2
269
-
270
- ### Patch Changes
271
-
272
- - 68080fa3: more
273
- - Updated dependencies [68080fa3]
274
- - @cutting/use-get-parent-size@1.6.2
275
- - @cutting/util@4.29.2
276
-
277
- ## 4.31.1
278
-
279
- ### Patch Changes
280
-
281
- - 8a44b1b8: add @cutting/vercel-wait-for-preview-url
282
- - Updated dependencies [8a44b1b8]
283
- - @cutting/use-get-parent-size@1.6.1
284
- - @cutting/util@4.29.1
285
-
286
- ## 4.31.0
287
-
288
- ### Minor Changes
289
-
290
- - 7edd9a89: upgrade to typescript 4.5
291
-
292
- ### Patch Changes
293
-
294
- - Updated dependencies [7edd9a89]
295
- - @cutting/use-get-parent-size@1.6.0
296
- - @cutting/util@4.29.0
297
-
298
- ## 4.30.1
299
-
300
- ### Patch Changes
301
-
302
- - Updated dependencies
303
- - @cutting/util@4.28.2
304
- - @cutting/use-get-parent-size@1.5.2
305
-
306
- ## 4.30.0
307
-
308
- ### Minor Changes
309
-
310
- - Make innerRef Ref
311
-
312
- ## 4.29.1
313
-
314
- ### Patch Changes
315
-
316
- - publish onBlur for component library
317
- - Updated dependencies
318
- - @cutting/use-get-parent-size@1.5.1
319
- - @cutting/util@4.28.1
320
-
321
- ## 4.29.0
322
-
323
- ### Minor Changes
324
-
325
- - clear vulnearabilities and upgrade effection
326
-
327
- ### Patch Changes
328
-
329
- - Updated dependencies
330
- - @cutting/use-get-parent-size@1.5.0
331
- - @cutting/util@4.28.0
332
-
333
- ## 4.28.2
334
-
335
- ### Patch Changes
336
-
337
- - eslint peerDependencies
338
- - Updated dependencies
339
- - @cutting/use-get-parent-size@1.4.2
340
- - @cutting/util@4.27.2
341
-
342
- ## 4.28.1
343
-
344
- ### Patch Changes
345
-
346
- - upgrade to webpack 5
347
- - Updated dependencies
348
- - @cutting/use-get-parent-size@1.4.1
349
- - @cutting/util@4.27.1
350
-
351
- ## 4.28.0
352
-
353
- ### Minor Changes
354
-
355
- - upgrade to new exports
356
-
357
- ### Patch Changes
358
-
359
- - Updated dependencies
360
- - @cutting/use-get-parent-size@1.4.0
361
- - @cutting/util@4.27.0
362
-
363
- ## 4.27.1
364
-
365
- ### Patch Changes
366
-
367
- - Updated dependencies [96c1f3d4fabbdad9315c8325a5951a9bcca2b0d8]
368
- - @cutting/util@4.26.0
369
- - @cutting/use-get-parent-size@1.3.1
370
-
371
- ## 4.26.1
372
-
373
- ### Patch Changes
374
-
375
- - fix postcss vulnerabilities
376
- - Updated dependencies
377
- - @cutting/use-get-parent-size@1.2.1
378
- - @cutting/util@4.24.2
379
-
380
- ## 4.26.0
381
-
382
- ### Minor Changes
383
-
384
- - use-parent-get-size
385
-
386
- ### Patch Changes
387
-
388
- - Updated dependencies
389
- - @cutting/use-get-parent-size@1.2.0
390
-
391
- ## 4.25.1
392
-
393
- ### Patch Changes
394
-
395
- - Updated dependencies
396
- - @cutting/use-get-parent-size@1.1.0
397
-
398
- ## 4.25.0
399
-
400
- ### Minor Changes
401
-
402
- - Add Point type
403
-
404
- ## 4.24.1
405
-
406
- ### Patch Changes
407
-
408
- - Fix babel issues and include a umd build for browser
409
- - Updated dependencies
410
- - @cutting/hooks@4.24.2
411
- - @cutting/util@4.24.1
412
-
413
- ## 4.24.0
11
+ ## 4.43.0
414
12
 
415
13
  ### Minor Changes
416
14
 
417
- - Add nested Mathax svg support
15
+ - d98dd7d1: use browserlistrc and remove babel targets
418
16
 
419
17
  ### Patch Changes
420
18
 
421
- - Updated dependencies
422
- - @cutting/util@4.24.0
423
- - @cutting/hooks@4.24.1
19
+ - Updated dependencies [d98dd7d1]
20
+ - @cutting/use-get-parent-size@1.17.0
21
+ - @cutting/util@4.46.0
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
7
6
  var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
8
7
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
9
8
  var react = require('react');
@@ -12,26 +11,25 @@ var cx = require('classnames');
12
11
 
13
12
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
14
13
 
15
- var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
16
14
  var _objectSpread__default = /*#__PURE__*/_interopDefault(_objectSpread);
17
15
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);
18
16
  var cx__default = /*#__PURE__*/_interopDefault(cx);
19
17
 
20
18
  function ResponsiveSVG(_ref) {
21
- var height = _ref.height,
22
- width = _ref.width,
23
- children = _ref.children,
24
- _ref$origin = _ref.origin,
25
- origin = _ref$origin === void 0 ? {
26
- x: 0,
27
- y: 0
28
- } : _ref$origin,
29
- _ref$preserveAspectRa = _ref.preserveAspectRatio,
30
- preserveAspectRatio = _ref$preserveAspectRa === void 0 ? 'xMaxYMid meet' : _ref$preserveAspectRa,
31
- innerRef = _ref.innerRef,
32
- className = _ref.className;
33
- var aspect = width / height;
34
- var adjustedHeight = Math.ceil(width / aspect);
19
+ let {
20
+ height,
21
+ width,
22
+ children,
23
+ origin = {
24
+ x: 0,
25
+ y: 0
26
+ },
27
+ preserveAspectRatio = 'xMaxYMid meet',
28
+ innerRef,
29
+ className
30
+ } = _ref;
31
+ const aspect = width / height;
32
+ const adjustedHeight = Math.ceil(width / aspect);
35
33
  return jsxRuntime.jsx("div", {
36
34
  "data-selector": "cutting-svg-container",
37
35
  style: {
@@ -52,9 +50,9 @@ function ResponsiveSVG(_ref) {
52
50
  });
53
51
  }
54
52
 
55
- var _excluded$2 = ["debounceDelay"],
56
- _excluded2 = ["parentRef", "children", "style", "scale", "align", "options"];
57
- var DefaultStyle = {
53
+ const _excluded$2 = ["debounceDelay"],
54
+ _excluded2 = ["parentRef", "children", "style", "scale", "align", "options"];
55
+ const DefaultStyle = {
58
56
  display: 'flex',
59
57
  flexDirection: 'column',
60
58
  flexGrow: 1,
@@ -63,43 +61,36 @@ var DefaultStyle = {
63
61
  overflow: 'hidden'
64
62
  };
65
63
  function ParentsizeSVG(_ref) {
66
- var parentRef = _ref.parentRef,
67
- children = _ref.children,
68
- _ref$style = _ref.style,
69
- style = _ref$style === void 0 ? DefaultStyle : _ref$style,
70
- _ref$scale = _ref.scale,
71
- scale = _ref$scale === void 0 ? 1 : _ref$scale,
72
- _ref$align = _ref.align,
73
- align = _ref$align === void 0 ? 'none' : _ref$align,
74
- _ref$options = _ref.options;
75
- _ref$options = _ref$options === void 0 ? {} : _ref$options;
76
-
77
- var _ref$options$debounce = _ref$options.debounceDelay,
78
- debounceDelay = _ref$options$debounce === void 0 ? 50 : _ref$options$debounce,
79
- optionsRest = _objectWithoutProperties__default["default"](_ref$options, _excluded$2),
64
+ let {
65
+ parentRef,
66
+ children,
67
+ style = DefaultStyle,
68
+ scale = 1,
69
+ align = 'none',
70
+ options: {
71
+ debounceDelay = 50
72
+ } = {}
73
+ } = _ref,
74
+ optionsRest = _objectWithoutProperties__default["default"](_ref.options, _excluded$2),
80
75
  rest = _objectWithoutProperties__default["default"](_ref, _excluded2);
81
76
 
82
- var _useParentSize = useGetParentSize.useParentSize(parentRef, _objectSpread__default["default"]({
83
- debounceDelay: debounceDelay
84
- }, optionsRest)),
85
- width = _useParentSize.width,
86
- height = _useParentSize.height;
87
-
88
- react.useEffect(function () {
77
+ const {
78
+ width,
79
+ height
80
+ } = useGetParentSize.useParentSize(parentRef, _objectSpread__default["default"]({
81
+ debounceDelay
82
+ }, optionsRest));
83
+ react.useEffect(() => {
89
84
  if (!parentRef.current) {
90
85
  return;
91
86
  }
92
87
 
93
- for (var _i = 0, _Object$entries = Object.entries(style); _i < _Object$entries.length; _i++) {
94
- var _Object$entries$_i = _slicedToArray__default["default"](_Object$entries[_i], 2),
95
- key = _Object$entries$_i[0],
96
- value = _Object$entries$_i[1];
97
-
88
+ for (const [key, value] of Object.entries(style)) {
98
89
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
99
90
  parentRef.current.style[key] = value;
100
91
  }
101
92
  }, [parentRef, style]);
102
- var transform = align === 'center' ? "translate(".concat(width / 2, ",").concat(height / 2 - 20, ") scale(").concat(scale, ")") : "translate(0,0) scale(".concat(scale, ")");
93
+ const transform = align === 'center' ? "translate(".concat(width / 2, ",").concat(height / 2 - 20, ") scale(").concat(scale, ")") : "translate(0,0) scale(".concat(scale, ")");
103
94
  return jsxRuntime.jsx(ResponsiveSVG, _objectSpread__default["default"](_objectSpread__default["default"]({
104
95
  width: width,
105
96
  height: height
@@ -111,16 +102,16 @@ function ParentsizeSVG(_ref) {
111
102
  }));
112
103
  }
113
104
 
114
- var _excluded$1 = ["y", "x", "transform", "className", "children", "innerRef"];
105
+ const _excluded$1 = ["y", "x", "transform", "className", "children", "innerRef"];
115
106
  function Group(_ref) {
116
- var _ref$y = _ref.y,
117
- y = _ref$y === void 0 ? 0 : _ref$y,
118
- _ref$x = _ref.x,
119
- x = _ref$x === void 0 ? 0 : _ref$x,
120
- transform = _ref.transform,
121
- className = _ref.className,
122
- children = _ref.children,
123
- innerRef = _ref.innerRef,
107
+ let {
108
+ y = 0,
109
+ x = 0,
110
+ transform,
111
+ className,
112
+ children,
113
+ innerRef
114
+ } = _ref,
124
115
  restProps = _objectWithoutProperties__default["default"](_ref, _excluded$1);
125
116
 
126
117
  return jsxRuntime.jsx("g", _objectSpread__default["default"](_objectSpread__default["default"]({
@@ -132,25 +123,24 @@ function Group(_ref) {
132
123
  }));
133
124
  }
134
125
 
135
- var _excluded = ["from", "to", "fill", "className", "innerRef"];
126
+ const _excluded = ["from", "to", "fill", "className", "innerRef"];
136
127
  function Line(_ref) {
137
- var _ref$from = _ref.from,
138
- from = _ref$from === void 0 ? {
139
- x: 0,
140
- y: 0
141
- } : _ref$from,
142
- _ref$to = _ref.to,
143
- to = _ref$to === void 0 ? {
144
- x: 1,
145
- y: 1
146
- } : _ref$to,
147
- _ref$fill = _ref.fill,
148
- fill = _ref$fill === void 0 ? 'transparent' : _ref$fill,
149
- className = _ref.className,
150
- innerRef = _ref.innerRef,
128
+ let {
129
+ from = {
130
+ x: 0,
131
+ y: 0
132
+ },
133
+ to = {
134
+ x: 1,
135
+ y: 1
136
+ },
137
+ fill = 'transparent',
138
+ className,
139
+ innerRef
140
+ } = _ref,
151
141
  restProps = _objectWithoutProperties__default["default"](_ref, _excluded);
152
142
 
153
- var isRectilinear = from.x === to.x || from.y === to.y;
143
+ const isRectilinear = from.x === to.x || from.y === to.y;
154
144
  return jsxRuntime.jsx("line", _objectSpread__default["default"]({
155
145
  ref: innerRef,
156
146
  className: cx__default["default"]('visx-line', className),
@@ -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 { ReactNode, Ref } from 'react';\nimport type { 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 children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\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 type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: 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 parentRef,\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(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.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 parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(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 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 function Group({\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 cx from 'classnames';\nimport type { 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 function Line({\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","parentRef","scale","align","options","debounceDelay","optionsRest","_objectWithoutProperties","_excluded","rest","useParentSize","_objectSpread","useEffect","current","Object","entries","_slicedToArray","key","value","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBgB,SAAAA,aAAA,CAQK,IAAA,EAAA;AAAA,EAPnBC,IAAAA,MAOmB,QAPnBA,MAOmB;AAAA,MANnBC,KAMmB,QANnBA,KAMmB;AAAA,MALnBC,QAKmB,QALnBA,QAKmB;AAAA,MAAA,WAAA,GAAA,IAAA,CAJnBC,MAImB;AAAA,MAJnBA,MAImB,GAJV,WAAA,KAAA,KAAA,CAAA,GAAA;AAAEC,IAAAA,CAAC,EAAE,CAAL;AAA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,CAAA,CAAA;;AACvC,EAAA,IAAMoB,aAAa,GAAGH,IAAI,CAAC7C,CAAL,KAAW8C,EAAE,CAAC9C,CAAd,IAAmB6C,IAAI,CAAC5C,CAAL,KAAW6C,EAAE,CAAC7C,CAAvD,CAAA;AAEA,EACEQ,OAAAA,cACE,CAAA,MAAA,EAAAuB,iCAAA,CAAA;AAAAlB,IAAAA,GAAG,EAAEX,QAAL;AACAC,IAAAA,SAAS,EAAEuC,sBAAE,CAAC,WAAD,EAAcvC,SAAd,CADb;AAEA6C,IAAAA,EAAE,EAAEJ,IAAI,CAAC7C,CAFT;AAGAkD,IAAAA,EAAE,EAAEL,IAAI,CAAC5C,CAHT;AAIAkD,IAAAA,EAAE,EAAEL,EAAE,CAAC9C,CAJP;AAKAoD,IAAAA,EAAE,EAAEN,EAAE,CAAC7C,CALP;AAMA8C,IAAAA,IAAI,EAAEA,IANN;AAOAM,IAAAA,cAAc,EAAEL,aAAa,GAAG,YAAH,GAAkB,MAAA;AAP/C,GAAA,EAQIN,SARJ,CAFJ,CAAA,CAAA;AAaD;;;;;;;"}
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 { ReactNode, Ref } from 'react';\nimport type { 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 children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\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 type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: 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 parentRef,\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(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.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 parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(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 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 function Group({\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 cx from 'classnames';\nimport type { 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 function Line({\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","parentRef","scale","align","options","debounceDelay","optionsRest","_excluded","rest","_objectWithoutProperties","useParentSize","_objectSpread","useEffect","current","key","value","Object","entries","transform","Group","restProps","cx","Line","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ToArray"),t=require("@babel/runtime/helpers/objectSpread2"),i=require("@babel/runtime/helpers/objectWithoutProperties"),a=require("react"),n=require("@cutting/use-get-parent-size"),s=require("classnames");function l(e){return e&&e.__esModule?e:{default:e}}var o=l(r),c=l(t),d=l(i),u=l(s);function f(r){var t=r.width,i=r.children,a=r.origin,n=void 0===a?{x:0,y:0}:a,s=r.preserveAspectRatio,l=void 0===s?"xMaxYMid meet":s,o=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:l,viewBox:"".concat(n.x," ").concat(n.y," ").concat(t," ").concat(d),ref:o,children:i})})}var v=["debounceDelay"],x=["parentRef","children","style","scale","align","options"],h={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},p=["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,a=r.x,n=void 0===a?0:a,s=r.transform,l=r.className,o=r.children,f=r.innerRef,v=d.default(r,p);return e.jsx("g",c.default(c.default({ref:f,className:u.default("visx-group",l),transform:s||"translate(".concat(n,", ").concat(i,")")},v),{},{children:o}))},exports.Line=function(r){var t=r.from,i=void 0===t?{x:0,y:0}:t,a=r.to,n=void 0===a?{x:1,y:1}:a,s=r.fill,l=void 0===s?"transparent":s,o=r.className,f=r.innerRef,v=d.default(r,y),x=i.x===n.x||i.y===n.y;return e.jsx("line",c.default({ref:f,className:u.default("visx-line",o),x1:i.x,y1:i.y,x2:n.x,y2:n.y,fill:l,shapeRendering:x?"crispEdges":"auto"},v))},exports.ParentsizeSVG=function(r){var t=r.parentRef,i=r.children,s=r.style,l=void 0===s?h:s,u=r.scale,p=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),w=d.default(r,x),N=n.useParentSize(t,c.default({debounceDelay:j},R)),q=N.width,M=N.height;a.useEffect((function(){if(t.current)for(var e=0,r=Object.entries(l);e<r.length;e++){var i=o.default(r[e],2);t.current.style[i[0]]=i[1]}}),[t,l]);var S="center"===m?"translate(".concat(q/2,",").concat(M/2-20,") scale(").concat(p,")"):"translate(0,0) scale(".concat(p,")");return e.jsx(f,c.default(c.default({width:q,height:M},w),{},{children:e.jsx("g",{transform:S,children:i})}))},exports.ResponsiveSVG=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@babel/runtime/helpers/objectSpread2"),r=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("react"),s=require("@cutting/use-get-parent-size"),a=require("classnames");function i(e){return e&&e.__esModule?e:{default:e}}var l=i(t),c=i(r),o=i(a);function f(t){let{height:r,width:n,children:s,origin:a={x:0,y:0},preserveAspectRatio:i="xMaxYMid meet",innerRef:l,className:c}=t;const o=Math.ceil(n/(n/r));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:i,viewBox:"".concat(a.x," ").concat(a.y," ").concat(n," ").concat(o),ref:l,children:s})})}const u=["debounceDelay"],d=["parentRef","children","style","scale","align","options"],x={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},p=["y","x","transform","className","children","innerRef"],h=["from","to","fill","className","innerRef"];exports.Group=function(t){let{y:r=0,x:n=0,transform:s,className:a,children:i,innerRef:f}=t,u=c.default(t,p);return e.jsx("g",l.default(l.default({ref:f,className:o.default("visx-group",a),transform:s||"translate(".concat(n,", ").concat(r,")")},u),{},{children:i}))},exports.Line=function(t){let{from:r={x:0,y:0},to:n={x:1,y:1},fill:s="transparent",className:a,innerRef:i}=t,f=c.default(t,h);const u=r.x===n.x||r.y===n.y;return e.jsx("line",l.default({ref:i,className:o.default("visx-line",a),x1:r.x,y1:r.y,x2:n.x,y2:n.y,fill:s,shapeRendering:u?"crispEdges":"auto"},f))},exports.ParentsizeSVG=function(t){let{parentRef:r,children:a,style:i=x,scale:o=1,align:p="none",options:{debounceDelay:h=50}={}}=t,y=c.default(t.options,u),m=c.default(t,d);const{width:v,height:g}=s.useParentSize(r,l.default({debounceDelay:h},y));n.useEffect((()=>{if(r.current)for(const[e,t]of Object.entries(i))r.current.style[e]=t}),[r,i]);const b="center"===p?"translate(".concat(v/2,",").concat(g/2-20,") scale(").concat(o,")"):"translate(0,0) scale(".concat(o,")");return e.jsx(f,l.default(l.default({width:v,height:g},m),{},{children:e.jsx("g",{transform:b,children:a})}))},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 { ReactNode, Ref } from 'react';\nimport type { 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 children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\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 type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: 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 parentRef,\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(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.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 parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(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 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 function Group({\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 cx from 'classnames';\nimport type { 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 function Line({\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","_ref","height","width","children","_ref$origin","origin","x","y","_ref$preserveAspectRa","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","_ref$y","_ref$x","transform","restProps","_objectWithoutProperties","_excluded","_objectSpread","cx","_ref$from","from","_ref$to","to","_ref$fill","fill","isRectilinear","jsx","x1","y1","x2","y2","shapeRendering","parentRef","_ref$style","_ref$scale","scale","_ref$align","align","_ref$options","options","_ref$options$debounce","debounceDelay","optionsRest","rest","_excluded2","useParentSize","useEffect","current","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedTo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,EAAQ,cAAKD,EAAS,EAAI,sBAAamD,EADxD,KAAA,wBAAAhC,OAE4BgC,EAH9B,KAMErC,OAAAA,MAAChB,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY2D,OAAIzD,SACnDY,EAAG4B,IAAA,IAAA,CAAAb,UAAWA,WAAY3B"}
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 { ReactNode, Ref } from 'react';\nimport type { 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 children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\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 type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: 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 parentRef,\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(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.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 parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(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 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 function Group({\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 cx from 'classnames';\nimport type { 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 function Line({\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","_ref","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","transform","restProps","_objectWithoutProperties","_excluded","_objectSpread","cx","from","to","fill","isRectilinear","jsx","x1","y1","x2","y2","shapeRendering","parentRef","scale","align","options","debounceDelay","optionsRest","rest","_excluded2","useParentSize","useEffect","current","key","value","Object","entries"],"mappings":"sXAmBgB,SAAAA,EAQKC,GARS,IAAAC,OAC5BA,EAD4BC,MAE5BA,EAF4BC,SAG5BA,EAH4BC,OAI5BA,EAAS,CAAEC,EAAG,EAAGC,EAAG,GAJQC,oBAK5BA,EAAsB,gBALMC,SAM5BA,EAN4BC,UAO5BA,GACmBT,EACnB,MAEMU,EAAiBC,KAAKC,KAAKV,GAFlBA,EAAQD,IAKrBY,OAAAA,EAAAA,IAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVf,OAAQ,OACTE,SAEDU,aACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAO,GAAAC,OA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,OACRC,SAASC,cAAEA,EAAgB,IAAuB,IAET9C,EAFP+C,cAAlCF,QAEyChB,GADtCmB,EACsCpB,EAAA,QAAA5B,EAAAiD,GACnC,MAAA/C,MAAEA,EAAFD,OAASA,GAAWiD,EAAaA,cAACR,EAADZ,UAAA,CAAcgB,cAAAA,GAAkBC,IAEvEI,EAAAA,WAAU,KACR,GAAKT,EAAUU,QAIf,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQ1C,GAExC4B,EAAUU,QAAQtC,MAAMuC,GAAcC,IAEvC,CAACZ,EAAW5B,IAEf,MAAMY,EACM,WAAVkB,EAAA,aAAA1B,OACiBhB,EAAQ,cAAKD,EAAS,EAAI,sBAAa0C,EADxD,KAAA,wBAAAzB,OAE4ByB,EAH9B,KAME9B,OAAAA,MAACd,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY+C,OAAI7C,SACnDU,EAAGuB,IAAA,IAAA,CAAAV,UAAWA,WAAYvB"}
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import r from"@babel/runtime/helpers/esm/slicedToArray";import i from"@babel/runtime/helpers/esm/objectSpread2";import t from"@babel/runtime/helpers/esm/objectWithoutProperties";import{useEffect as n}from"react";import{useParentSize as o}from"@cutting/use-get-parent-size";import a from"classnames";function c(r){var i=r.width,t=r.children,n=r.origin,o=void 0===n?{x:0,y:0}:n,a=r.preserveAspectRatio,c=void 0===a?"xMaxYMid meet":a,s=r.innerRef,l=r.className,f=Math.ceil(i/(i/r.height));return e("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e("svg",{style:{overflow:"visible"},className:l,preserveAspectRatio:c,viewBox:"".concat(o.x," ").concat(o.y," ").concat(i," ").concat(f),ref:s,children:t})})}var s=["debounceDelay"],l=["parentRef","children","style","scale","align","options"],f={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"};function d(a){var d=a.parentRef,m=a.children,v=a.style,h=void 0===v?f:v,p=a.scale,u=void 0===p?1:p,x=a.align,y=void 0===x?"none":x,g=a.options,b=(g=void 0===g?{}:g).debounceDelay,R=void 0===b?50:b,w=t(g,s),N=t(a,l),j=o(d,i({debounceDelay:R},w)),D=j.width,A=j.height;n((function(){if(d.current)for(var e=0,i=Object.entries(h);e<i.length;e++){var t=r(i[e],2);d.current.style[t[0]]=t[1]}}),[d,h]);var M="center"===y?"translate(".concat(D/2,",").concat(A/2-20,") scale(").concat(u,")"):"translate(0,0) scale(".concat(u,")");return e(c,i(i({width:D,height:A},N),{},{children:e("g",{transform:M,children:m})}))}var m=["y","x","transform","className","children","innerRef"];function v(r){var n=r.y,o=void 0===n?0:n,c=r.x,s=void 0===c?0:c,l=r.transform,f=r.className,d=r.children,v=r.innerRef,h=t(r,m);return e("g",i(i({ref:v,className:a("visx-group",f),transform:l||"translate(".concat(s,", ").concat(o,")")},h),{},{children:d}))}var h=["from","to","fill","className","innerRef"];function p(r){var n=r.from,o=void 0===n?{x:0,y:0}:n,c=r.to,s=void 0===c?{x:1,y:1}:c,l=r.fill,f=void 0===l?"transparent":l,d=r.className,m=r.innerRef,v=t(r,h),p=o.x===s.x||o.y===s.y;return e("line",i({ref:m,className:a("visx-line",d),x1:o.x,y1:o.y,x2:s.x,y2:s.y,fill:f,shapeRendering:p?"crispEdges":"auto"},v))}export{v as Group,p as Line,d as ParentsizeSVG,c as ResponsiveSVG};
1
+ import{jsx as e}from"react/jsx-runtime";import t from"@babel/runtime/helpers/esm/objectSpread2";import n from"@babel/runtime/helpers/esm/objectWithoutProperties";import{useEffect as r}from"react";import{useParentSize as i}from"@cutting/use-get-parent-size";import o from"classnames";function c(t){let{height:n,width:r,children:i,origin:o={x:0,y:0},preserveAspectRatio:c="xMaxYMid meet",innerRef:s,className:a}=t;const l=Math.ceil(r/(r/n));return e("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:e("svg",{style:{overflow:"visible"},className:a,preserveAspectRatio:c,viewBox:"".concat(o.x," ").concat(o.y," ").concat(r," ").concat(l),ref:s,children:i})})}const s=["debounceDelay"],a=["parentRef","children","style","scale","align","options"],l={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"};function f(o){let{parentRef:f,children:m,style:h=l,scale:p=1,align:d="none",options:{debounceDelay:x=50}={}}=o,u=n(o.options,s),y=n(o,a);const{width:g,height:v}=i(f,t({debounceDelay:x},u));r((()=>{if(f.current)for(const[e,t]of Object.entries(h))f.current.style[e]=t}),[f,h]);const b="center"===d?"translate(".concat(g/2,",").concat(v/2-20,") scale(").concat(p,")"):"translate(0,0) scale(".concat(p,")");return e(c,t(t({width:g,height:v},y),{},{children:e("g",{transform:b,children:m})}))}const m=["y","x","transform","className","children","innerRef"];function h(r){let{y:i=0,x:c=0,transform:s,className:a,children:l,innerRef:f}=r,h=n(r,m);return e("g",t(t({ref:f,className:o("visx-group",a),transform:s||"translate(".concat(c,", ").concat(i,")")},h),{},{children:l}))}const p=["from","to","fill","className","innerRef"];function d(r){let{from:i={x:0,y:0},to:c={x:1,y:1},fill:s="transparent",className:a,innerRef:l}=r,f=n(r,p);const m=i.x===c.x||i.y===c.y;return e("line",t({ref:l,className:o("visx-line",a),x1:i.x,y1:i.y,x2:c.x,y2:c.y,fill:s,shapeRendering:m?"crispEdges":"auto"},f))}export{h as Group,d as Line,f as ParentsizeSVG,c as ResponsiveSVG};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.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 { ReactNode, Ref } from 'react';\nimport type { 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 children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\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 type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: 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 parentRef,\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(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.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 parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(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 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 function Group({\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 cx from 'classnames';\nimport type { 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 function Line({\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","_ref","height","width","children","_ref$origin","origin","x","y","_ref$preserveAspectRa","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","parentRef","_ref$style","_ref$scale","scale","_ref$align","align","_ref$options","options","_ref$options$debounce","debounceDelay","optionsRest","_objectWithoutProperties","_excluded","rest","_excluded2","useParentSize","_objectSpread","useEffect","current","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","transform","Group","_ref$y","_ref$x","restProps","cx","Line","_ref$from","from","_ref$to","to","_ref$fill","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":"mVAmBgB,SAAAA,EAQKC,GAPnBC,IACAC,IAAAA,MACAC,IAAAA,SAKmBC,EAAAJ,EAJnBK,OAAAA,OAAS,IAAAD,EAAA,CAAEE,EAAG,EAAGC,EAAG,GAIDH,EAAAI,EAAAR,EAHnBS,oBAAAA,aAAsB,gBAGHD,EAFnBE,IAAAA,SACAC,IAAAA,UAIMC,EAAiBC,KAAKC,KAAKZ,GAFlBA,IARfD,SAaEc,OAAAA,EAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVjB,OAAQ,OACTE,SAEDY,SACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAO,GAAAC,OAAKf,EAAOC,EAAZ,KAAAc,OAAiBf,EAAOE,EAAxB,KAAAa,OAA6BlB,EAA7B,KAAAkB,OAAsCR,GAC7CS,IAAKX,EAAQP,SAEZA,2FC/BImB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW,KACXT,SAAU,UAGI,SAAAU,EAQ2B5B,GAPzC6B,IAAAA,IAAAA,UACA1B,IAAAA,SAMyC2B,EAAA9B,EALzCgB,MAAAA,aAAQM,EAKiCQ,EAAA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EAAA9D,EANvC+D,KAAAA,OAAO,IAAAD,EAAA,CAAExD,EAAG,EAAGC,EAAG,GAMqBuD,EAAAE,EAAAhE,EALvCiE,GAAAA,OAAK,IAAAD,EAAA,CAAE1D,EAAG,EAAGC,EAAG,GAKuByD,EAAAE,EAAAlE,EAJvCmE,KAAAA,aAAO,cAIgCD,EAHvCvD,IAAAA,UACAD,IAAAA,SACGiD,EACoCnB,EAAAxC,EAAAyC,GACjC2B,EAAgBL,EAAKzD,IAAM2D,EAAG3D,GAAKyD,EAAKxD,IAAM0D,EAAG1D,EAGrDQ,OAAAA,EACE,OAAA8B,EAAA,CAAAxB,IAAKX,EACLC,UAAWiD,EAAG,YAAajD,GAC3B0D,GAAIN,EAAKzD,EACTgE,GAAIP,EAAKxD,EACTgE,GAAIN,EAAG3D,EACPkE,GAAIP,EAAG1D,EACP4D,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,QAC3CT"}
1
+ {"version":3,"file":"index.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 { ReactNode, Ref } from 'react';\nimport type { 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 children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\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 type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: 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 parentRef,\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(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.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 parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(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 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 function Group({\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 cx from 'classnames';\nimport type { 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 function Line({\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","_ref","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","ParentsizeSVG","parentRef","scale","align","options","debounceDelay","optionsRest","_excluded","rest","_objectWithoutProperties","_excluded2","useParentSize","_objectSpread","useEffect","current","key","value","Object","entries","transform","Group","restProps","cx","Line","from","to","fill","isRectilinear","x1","y1","x2","y2","shapeRendering"],"mappings":"2RAmBgB,SAAAA,EAQKC,GARS,IAAAC,OAC5BA,EAD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OAAI/B,SACnDU,EAAG,IAAA,CAAAgC,UAAWA,WAAY1C,uECvC1B,SAAU2C,EAQH9C,GARS,IAAAM,EACpBA,EAAI,EADgBD,EAEpBA,EAAI,EAFgBwC,UAGpBA,EAHoBpC,UAIpBA,EAJoBN,SAKpBA,EALoBK,SAMpBA,GAEWR,EADR+C,EACQZ,EAAAnC,EAAAiC,GAETpB,OAAAA,EAAA,IAAAyB,EAAAA,EAAA,CACEnB,IAAKX,EACLC,UAAWuC,EAAG,aAAcvC,GAC5BoC,UAAWA,GAA0BxC,aAAAA,OAAAA,eAAMC,EAAvB,MAChByC,GAJN,GAAA,CAIe5C,SAEZA,kECnBS8C,EAOyBjD,GAPpB,IAAAkD,KACnBA,EAAO,CAAE7C,EAAG,EAAGC,EAAG,GADC6C,GAEnBA,EAAK,CAAE9C,EAAG,EAAGC,EAAG,GAFG8C,KAGnBA,EAAO,cAHY3C,UAInBA,EAJmBD,SAKnBA,GAEuCR,EADpC+C,EACoCZ,EAAAnC,EAAAiC,GACvC,MAAMoB,EAAgBH,EAAK7C,IAAM8C,EAAG9C,GAAK6C,EAAK5C,IAAM6C,EAAG7C,EAGrDO,OAAAA,EACE,OAAAyB,EAAA,CAAAnB,IAAKX,EACLC,UAAWuC,EAAG,YAAavC,GAC3B6C,GAAIJ,EAAK7C,EACTkD,GAAIL,EAAK5C,EACTkD,GAAIL,EAAG9C,EACPoD,GAAIN,EAAG7C,EACP8C,KAAMA,EACNM,eAAgBL,EAAgB,aAAe,QAC3CN"}
package/dist/umd/index.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/objectSpread2"),require("@babel/runtime/helpers/objectWithoutProperties"),require("react"),require("@cutting/use-get-parent-size"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@babel/runtime/helpers/slicedToArray","@babel/runtime/helpers/objectSpread2","@babel/runtime/helpers/objectWithoutProperties","react","@cutting/use-get-parent-size","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@cutting/svg"]={},e.jsxRuntime,e._slicedToArray,e._objectSpread,e._objectWithoutProperties,e.React,e.useGetParentSize,e.cx)}(this,(function(e,t,r,i,n,a,s,l){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var c=o(r),u=o(i),d=o(n),f=o(l);function h(e){var r=e.width,i=e.children,n=e.origin,a=void 0===n?{x:0,y:0}:n,s=e.preserveAspectRatio,l=void 0===s?"xMaxYMid meet":s,o=e.innerRef,c=e.className,u=Math.ceil(r/(r/e.height));return t.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:t.jsx("svg",{style:{overflow:"visible"},className:c,preserveAspectRatio:l,viewBox:"".concat(a.x," ").concat(a.y," ").concat(r," ").concat(u),ref:o,children:i})})}var p=["debounceDelay"],v=["parentRef","children","style","scale","align","options"],x={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},m=["y","x","transform","className","children","innerRef"],y=["from","to","fill","className","innerRef"];e.Group=function(e){var r=e.y,i=void 0===r?0:r,n=e.x,a=void 0===n?0:n,s=e.transform,l=e.className,o=e.children,c=e.innerRef,h=d.default(e,m);return t.jsx("g",u.default(u.default({ref:c,className:f.default("visx-group",l),transform:s||"translate(".concat(a,", ").concat(i,")")},h),{},{children:o}))},e.Line=function(e){var r=e.from,i=void 0===r?{x:0,y:0}:r,n=e.to,a=void 0===n?{x:1,y:1}:n,s=e.fill,l=void 0===s?"transparent":s,o=e.className,c=e.innerRef,h=d.default(e,y),p=i.x===a.x||i.y===a.y;return t.jsx("line",u.default({ref:c,className:f.default("visx-line",o),x1:i.x,y1:i.y,x2:a.x,y2:a.y,fill:l,shapeRendering:p?"crispEdges":"auto"},h))},e.ParentsizeSVG=function(e){var r=e.parentRef,i=e.children,n=e.style,l=void 0===n?x:n,o=e.scale,f=void 0===o?1:o,m=e.align,y=void 0===m?"none":m,b=e.options,g=(b=void 0===b?{}:b).debounceDelay,j=void 0===g?50:g,R=d.default(b,p),w=d.default(e,v),N=s.useParentSize(r,u.default({debounceDelay:j},R)),S=N.width,q=N.height;a.useEffect((function(){if(r.current)for(var e=0,t=Object.entries(l);e<t.length;e++){var i=c.default(t[e],2);r.current.style[i[0]]=i[1]}}),[r,l]);var P="center"===y?"translate(".concat(S/2,",").concat(q/2-20,") scale(").concat(f,")"):"translate(0,0) scale(".concat(f,")");return t.jsx(h,u.default(u.default({width:S,height:q},w),{},{children:t.jsx("g",{transform:P,children:i})}))},e.ResponsiveSVG=h}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("@babel/runtime/helpers/objectSpread2"),require("@babel/runtime/helpers/objectWithoutProperties"),require("react"),require("@cutting/use-get-parent-size"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@babel/runtime/helpers/objectSpread2","@babel/runtime/helpers/objectWithoutProperties","react","@cutting/use-get-parent-size","classnames"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@cutting/svg"]={},e.jsxRuntime,e._objectSpread,e._objectWithoutProperties,e.React,e.useGetParentSize,e.cx)}(this,(function(e,t,n,r,i,s,a){"use strict";function c(e){return e&&e.__esModule?e:{default:e}}var l=c(n),o=c(r),u=c(a);function f(e){let{height:n,width:r,children:i,origin:s={x:0,y:0},preserveAspectRatio:a="xMaxYMid meet",innerRef:c,className:l}=e;const o=Math.ceil(r/(r/n));return t.jsx("div",{"data-selector":"cutting-svg-container",style:{position:"relative",overflow:"visible",height:"1px"},children:t.jsx("svg",{style:{overflow:"visible"},className:l,preserveAspectRatio:a,viewBox:"".concat(s.x," ").concat(s.y," ").concat(r," ").concat(o),ref:c,children:i})})}const d=["debounceDelay"],p=["parentRef","children","style","scale","align","options"],x={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:"0%",overflow:"hidden"},h=["y","x","transform","className","children","innerRef"],m=["from","to","fill","className","innerRef"];e.Group=function(e){let{y:n=0,x:r=0,transform:i,className:s,children:a,innerRef:c}=e,f=o.default(e,h);return t.jsx("g",l.default(l.default({ref:c,className:u.default("visx-group",s),transform:i||"translate(".concat(r,", ").concat(n,")")},f),{},{children:a}))},e.Line=function(e){let{from:n={x:0,y:0},to:r={x:1,y:1},fill:i="transparent",className:s,innerRef:a}=e,c=o.default(e,m);const f=n.x===r.x||n.y===r.y;return t.jsx("line",l.default({ref:a,className:u.default("visx-line",s),x1:n.x,y1:n.y,x2:r.x,y2:r.y,fill:i,shapeRendering:f?"crispEdges":"auto"},c))},e.ParentsizeSVG=function(e){let{parentRef:n,children:r,style:a=x,scale:c=1,align:u="none",options:{debounceDelay:h=50}={}}=e,m=o.default(e.options,d),y=o.default(e,p);const{width:b,height:g}=s.useParentSize(n,l.default({debounceDelay:h},m));i.useEffect((()=>{if(n.current)for(const[e,t]of Object.entries(a))n.current.style[e]=t}),[n,a]);const j="center"===u?"translate(".concat(b/2,",").concat(g/2-20,") scale(").concat(c,")"):"translate(0,0) scale(".concat(c,")");return t.jsx(f,l.default(l.default({width:b,height:g},y),{},{children:t.jsx("g",{transform:j,children:r})}))},e.ResponsiveSVG=f}));
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.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 { ReactNode, Ref } from 'react';\nimport type { 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 children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\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 type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: 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 parentRef,\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(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.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 parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(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 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 function Group({\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 cx from 'classnames';\nimport type { 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 function Line({\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","_ref","height","width","children","_ref$origin","origin","x","y","_ref$preserveAspectRa","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","_ref$y","_ref$x","transform","restProps","_objectWithoutProperties","_excluded","_objectSpread","cx","_ref$from","from","_ref$to","to","_ref$fill","fill","isRectilinear","jsx","x1","y1","x2","y2","shapeRendering","parentRef","_ref$style","_ref$scale","scale","_ref$align","align","_ref$options","options","_ref$options$debounce","debounceDelay","optionsRest","rest","_excluded2","useParentSize","useEffect","current","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray"],"mappings":"84BAmBgB,SAAAA,EAQKC,GAPnBC,IACAC,IAAAA,MACAC,IAAAA,SAKmBC,EAAAJ,EAJnBK,OAAAA,OAAS,IAAAD,EAAA,CAAEE,EAAG,EAAGC,EAAG,GAIDH,EAAAI,EAAAR,EAHnBS,oBAAAA,aAAsB,gBAGHD,EAFnBE,IAAAA,SACAC,IAAAA,UAIMC,EAAiBC,KAAKC,KAAKZ,GAFlBA,IARfD,SAaEc,OAAAA,EAAAA,IAAA,MAAA,CAAA,gBACgB,wBACdC,MAAO,CACLC,SAAU,WACVC,SAAU,UACVjB,OAAQ,OACTE,SAEDY,aACEC,MAAO,CAAEE,SAAU,WACnBP,UAAWA,EACXF,oBAAqBA,EACrBU,QAAO,GAAAC,OAAKf,EAAOC,EAAZ,KAAAc,OAAiBf,EAAOE,EAAxB,KAAAa,OAA6BlB,EAA7B,KAAAkB,OAAsCR,GAC7CS,IAAKX,EAAQP,SAEZA,2FC/BImB,EAA8B,CACzCC,QAAS,OACTC,cAAe,SACfC,SAAU,EACVC,WAAY,EACZC,UAAW,KACXT,SAAU,0HCPN,SAQOlB,GAAA,IAAA4B,EAAA5B,EAPXO,EAAAA,aAAI,EAOOqB,EAAAC,EAAA7B,EANXM,EAAAA,aAAI,EAMOuB,EALXC,IAAAA,UACAnB,IAAAA,UACAR,IAAAA,SACAO,IAAAA,SACGqB,EACQC,EAAA,QAAAhC,EAAAiC,GAETlB,OAAAA,MAAA,IAAAmB,EAAA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MAAOD,IAAAA,OAEf8D,EAAAA,WAAU,WACR,GAAKd,EAAUe,QAIf,IAAA,IAAAC,EAAA,EAAAC,EAA2BC,OAAOC,QAAQpD,GAAQiD,EAAAC,EAAAG,OAAAJ,IAAA,CAA7C,IAAAK,EAAAC,EAAA,QAAAL,EAAAD,GAAA,GAEHhB,EAAUe,QAAQhD,MAFfsD,EAAA,IAAAA,EAAA,MAIJ,CAACrB,EAAWjC,IAEf,IAAMc,EACM,WAAVwB,EAAA,aAAAlC,OACiBlB,EAAQ,cAAKD,EAAS,EAAI,sBAAamD,EADxD,KAAA,wBAAAhC,OAE4BgC,EAH9B,KAMErC,OAAAA,MAAChB,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY2D,OAAIzD,SACnDY,EAAG4B,IAAA,IAAA,CAAAb,UAAWA,WAAY3B"}
1
+ {"version":3,"file":"index.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 { ReactNode, Ref } from 'react';\nimport type { 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 children: ReactNode;\n}\n\nexport function ResponsiveSVG({\n height,\n width,\n children,\n origin = { x: 0, y: 0 },\n preserveAspectRatio = 'xMaxYMid meet',\n innerRef,\n className,\n}: ResponsiveSVGProps): JSX.Element {\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 type { CSSProperties, PropsWithChildren, RefObject } from 'react';\nimport { useEffect } from 'react';\nimport type { UseParentSizeOptions } from '@cutting/use-get-parent-size';\nimport { useParentSize } from '@cutting/use-get-parent-size';\nimport type { ResponsiveSVGProps } from '../ResponsiveSVG/ResponsiveSVG';\nimport { ResponsiveSVG } from '../ResponsiveSVG/ResponsiveSVG';\n\ntype Align = 'none' | 'center';\n\nexport type ParentsizeSVGProps<E extends HTMLElement = HTMLElement> = {\n parentRef: 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 parentRef,\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(parentRef, { debounceDelay, ...optionsRest });\n\n useEffect(() => {\n if (!parentRef.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 parentRef.current.style[key as any] = value;\n }\n }, [parentRef, style]);\n\n const transform =\n align === 'center'\n ? `translate(${width / 2},${height / 2 - 20}) scale(${scale})`\n : `translate(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 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 function Group({\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 cx from 'classnames';\nimport type { 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 function Line({\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","_ref","height","width","children","origin","x","y","preserveAspectRatio","innerRef","className","adjustedHeight","Math","ceil","_jsx","style","position","overflow","viewBox","concat","ref","DefaultStyle","display","flexDirection","flexGrow","flexShrink","flexBasis","transform","restProps","_objectWithoutProperties","_excluded","_objectSpread","cx","from","to","fill","isRectilinear","jsx","x1","y1","x2","y2","shapeRendering","parentRef","scale","align","options","debounceDelay","optionsRest","rest","_excluded2","useParentSize","useEffect","current","key","value","Object","entries"],"mappings":"6xBAmBgB,SAAAA,EAQKC,GARS,IAAAC,OAC5BA,EAD4BC,MAE5BA,EAF4BC,SAG5BA,EAH4BC,OAI5BA,EAAS,CAAEC,EAAG,EAAGC,E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AKX,EACLC,UAAWsB,EAAAA,QAAG,YAAatB,GAC3B4B,GAAIL,EAAK3B,EACTiC,GAAIN,EAAK1B,EACTiC,GAAIN,EAAG5B,EACPmC,GAAIP,EAAG3B,EACP4B,KAAMA,EACNO,eAAgBN,EAAgB,aAAe,QAC3CR,qBFPM,SAQ2B3B,GARU,IAAA0C,UACnDA,EADmDvC,SAEnDA,EAFmDW,MAGnDA,EAAQM,EAH2CuB,MAInDA,EAAQ,EAJ2CC,MAKnDA,EAAQ,OACRC,SAASC,cAAEA,EAAgB,IAAuB,IAET9C,EAFP+C,cAAlCF,QAEyChB,GADtCmB,EACsCpB,EAAA,QAAA5B,EAAAiD,GACnC,MAAA/C,MAAEA,EAAFD,OAASA,GAAWiD,EAAaA,cAACR,EAADZ,UAAA,CAAcgB,cAAAA,GAAkBC,IAEvEI,EAAAA,WAAU,KACR,GAAKT,EAAUU,QAIf,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQ1C,GAExC4B,EAAUU,QAAQtC,MAAMuC,GAAcC,IAEvC,CAACZ,EAAW5B,IAEf,MAAMY,EACM,WAAVkB,EAAA,aAAA1B,OACiBhB,EAAQ,cAAKD,EAAS,EAAI,sBAAa0C,EADxD,KAAA,wBAAAzB,OAE4ByB,EAH9B,KAME9B,OAAAA,MAACd,uBAAcG,MAAOA,EAAOD,OAAQA,GAAY+C,OAAI7C,SACnDU,EAAGuB,IAAA,IAAA,CAAAV,UAAWA,WAAYvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cutting/svg",
3
- "version": "4.41.4",
3
+ "version": "4.43.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dagda1/cuttingedge.git"