abstract-image 3.3.2 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +44 -38
  2. package/LICENSE +21 -21
  3. package/README.md +73 -73
  4. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-ellipse.js +379 -379
  5. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-group.js +123 -123
  6. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-line.js +55 -55
  7. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-polygon.js +89 -89
  8. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-polyline.js +79 -79
  9. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-rectangle.js +99 -99
  10. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-text-growth-directions.js +135 -135
  11. package/lib/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-text.js +63 -63
  12. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-ellipse.js +24 -24
  13. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-empty-text.js +26 -26
  14. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-group.js +31 -31
  15. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-line.js +20 -20
  16. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-polygon.js +34 -34
  17. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-polyline.js +26 -26
  18. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-rectangle.js +20 -20
  19. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-text-growth-directions.js +59 -59
  20. package/lib/exporters/__tests__/eps-export-image/test-defs/eps-text.js +26 -26
  21. package/package.json +4 -2
  22. package/src/__stories__/react-svg-export/example-1.stories.tsx +54 -54
  23. package/src/__stories__/svg-export/example-1.stories.tsx +42 -42
  24. package/src/exporters/__tests__/dxf2d-export-image/export-test-def.ts +11 -11
  25. package/src/exporters/__tests__/dxf2d-export-image/export.test.tsx +13 -13
  26. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-ellipse.ts +405 -405
  27. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-group.ts +166 -166
  28. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-line.ts +80 -80
  29. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-polygon.ts +114 -114
  30. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-polyline.ts +103 -103
  31. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-rectangle.ts +125 -125
  32. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-text-growth-directions.ts +214 -214
  33. package/src/exporters/__tests__/dxf2d-export-image/test-defs/dxf2d-text.ts +97 -97
  34. package/src/exporters/__tests__/eps-export-image/export-test-def.ts +11 -11
  35. package/src/exporters/__tests__/eps-export-image/export.test.tsx +13 -13
  36. package/src/exporters/__tests__/eps-export-image/test-defs/eps-ellipse.ts +50 -50
  37. package/src/exporters/__tests__/eps-export-image/test-defs/eps-empty-text.ts +60 -60
  38. package/src/exporters/__tests__/eps-export-image/test-defs/eps-group.ts +74 -74
  39. package/src/exporters/__tests__/eps-export-image/test-defs/eps-line.ts +45 -45
  40. package/src/exporters/__tests__/eps-export-image/test-defs/eps-polygon.ts +65 -65
  41. package/src/exporters/__tests__/eps-export-image/test-defs/eps-polyline.ts +58 -58
  42. package/src/exporters/__tests__/eps-export-image/test-defs/eps-rectangle.ts +46 -46
  43. package/src/exporters/__tests__/eps-export-image/test-defs/eps-text-growth-directions.ts +138 -138
  44. package/src/exporters/__tests__/eps-export-image/test-defs/eps-text.ts +60 -60
  45. package/src/exporters/__tests__/exception/png-unsupported.test.tsx +25 -25
  46. package/src/exporters/__tests__/exception/react-svg-direction-exception.test.tsx +65 -65
  47. package/src/exporters/__tests__/exception/svg-direction-exception.test.tsx +65 -65
  48. package/src/exporters/__tests__/png-export-image/export-test-def.ts +11 -11
  49. package/src/exporters/__tests__/png-export-image/export.test.tsx +13 -13
  50. package/src/exporters/__tests__/png-export-image/test-defs/png-createPNG.tsx +26 -26
  51. package/src/exporters/__tests__/react-svg-export-image/export-test-def.tsx +13 -13
  52. package/src/exporters/__tests__/react-svg-export-image/export.test.tsx +13 -13
  53. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-png.tsx +26 -26
  54. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary-url.tsx +26 -26
  55. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-binary.tsx +25 -25
  56. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-callback.tsx +60 -60
  57. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-ellipse.tsx +28 -28
  58. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-empty-text.tsx +35 -35
  59. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-group.tsx +44 -44
  60. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-line.tsx +26 -26
  61. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polygon.tsx +32 -32
  62. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polyline.tsx +33 -33
  63. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-rectangle.tsx +27 -27
  64. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-subimage.tsx +36 -36
  65. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-bold.tsx +50 -50
  66. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-growth-directions.tsx +80 -80
  67. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-italic.tsx +65 -65
  68. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text-sub.tsx +35 -35
  69. package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-text.tsx +35 -35
  70. package/src/exporters/__tests__/svg-export-image/export-test-def.ts +11 -11
  71. package/src/exporters/__tests__/svg-export-image/export.test.tsx +13 -13
  72. package/src/exporters/__tests__/svg-export-image/test-defs/svg-binary.tsx +25 -25
  73. package/src/exporters/__tests__/svg-export-image/test-defs/svg-ellipse.ts +27 -27
  74. package/src/exporters/__tests__/svg-export-image/test-defs/svg-empty-text.ts +34 -34
  75. package/src/exporters/__tests__/svg-export-image/test-defs/svg-group.ts +44 -44
  76. package/src/exporters/__tests__/svg-export-image/test-defs/svg-line.ts +26 -26
  77. package/src/exporters/__tests__/svg-export-image/test-defs/svg-polygon.ts +32 -32
  78. package/src/exporters/__tests__/svg-export-image/test-defs/svg-polyline.ts +33 -33
  79. package/src/exporters/__tests__/svg-export-image/test-defs/svg-rectangle.ts +27 -27
  80. package/src/exporters/__tests__/svg-export-image/test-defs/svg-text-bold.ts +50 -50
  81. package/src/exporters/__tests__/svg-export-image/test-defs/svg-text-growth-directions.ts +80 -80
  82. package/src/exporters/__tests__/svg-export-image/test-defs/svg-text-italic.ts +65 -65
  83. package/src/exporters/__tests__/svg-export-image/test-defs/svg-text.ts +35 -35
  84. package/src/exporters/dxf2d-export-image.ts +218 -218
  85. package/src/exporters/eps-export-image.ts +154 -154
  86. package/src/exporters/index.ts +3 -3
  87. package/src/exporters/png-export-image.ts +12 -12
  88. package/src/exporters/react-svg-export-image.tsx +315 -315
  89. package/src/exporters/svg-export-image.ts +309 -309
  90. package/src/index.ts +11 -11
  91. package/src/model/__tests__/color/export-test-def.ts +13 -13
  92. package/src/model/__tests__/color/export.test.tsx +14 -14
  93. package/src/model/__tests__/color/test-defs/color-from-string.ts +46 -46
  94. package/src/model/__tests__/color/test-defs/color-to-string.ts +35 -35
  95. package/src/model/__tests__/color/test-defs/color-undefined-2.ts +8 -8
  96. package/src/model/__tests__/color/test-defs/color-undefined.ts +8 -8
  97. package/src/model/abstract-image.ts +25 -25
  98. package/src/model/color.ts +52 -52
  99. package/src/model/component.ts +279 -279
  100. package/src/model/index.ts +5 -5
  101. package/src/model/point.ts +11 -11
  102. package/src/model/size.ts +11 -11
  103. package/lib/exporters/__tests__/svg-export-image.test.d.ts +0 -2
  104. package/lib/exporters/__tests__/svg-export-image.test.d.ts.map +0 -1
  105. package/lib/exporters/__tests__/svg-export-image.test.js +0 -35
  106. package/lib/exporters/__tests__/svg-export-image.test.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,38 +1,44 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
4
-
5
- ## [Unreleased](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.3.2...master)
6
-
7
- ### Added
8
-
9
- ### Changed
10
-
11
- ### Removed
12
-
13
- ## [v3.3.2](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.0.0...abstract-image@3.3.2) - 2022-06-02
14
-
15
- ### Added
16
-
17
- - Support for URL as source for embedded binary images
18
- - Support for positioning and scaling embedded svg images
19
-
20
- ### Changed
21
-
22
- ### Removed
23
-
24
- ## [v3.1.4](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.1.3...abstract-image@3.1.4) - 2022-01-05
25
-
26
- ### Added
27
-
28
- - Added italic and mediumBold as options for texts
29
-
30
- ## [v3.0.1](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.0.0...abstract-image@3.0.1) - 2021-01-01
31
-
32
- ### Added
33
-
34
- - Added typing on GrowthDirection for textAnchor on the svg export.
35
-
36
- ## v3.0.0 - 2021-03-24
37
-
38
- - Start of changelog.
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
4
+
5
+ ## [Unreleased](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.3.3...master)
6
+
7
+ ### Added
8
+
9
+ ### Changed
10
+
11
+ ### Removed
12
+
13
+ ## [v3.3.3](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.3.2...abstract-image@3.3.3) - 2023-05-25
14
+
15
+ ### Added
16
+
17
+ - Add missing ramda dependency #106
18
+
19
+ ## [v3.3.2](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.0.0...abstract-image@3.3.2) - 2022-06-02
20
+
21
+ ### Added
22
+
23
+ - Support for URL as source for embedded binary images
24
+ - Support for positioning and scaling embedded svg images
25
+
26
+ ### Changed
27
+
28
+ ### Removed
29
+
30
+ ## [v3.1.4](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.1.3...abstract-image@3.1.4) - 2022-01-05
31
+
32
+ ### Added
33
+
34
+ - Added italic and mediumBold as options for texts
35
+
36
+ ## [v3.0.1](https://github.com/dividab/abstract-visuals/compare/abstract-image@3.0.0...abstract-image@3.0.1) - 2021-01-01
37
+
38
+ ### Added
39
+
40
+ - Added typing on GrowthDirection for textAnchor on the svg export.
41
+
42
+ ## v3.0.0 - 2021-03-24
43
+
44
+ - Start of changelog.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Divid AB
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Divid AB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,73 +1,73 @@
1
- # abstract-image
2
-
3
- [![npm version][version-image]][version-url]
4
- [![code style: prettier][prettier-image]][prettier-url]
5
- [![MIT license][license-image]][license-url]
6
-
7
- Dynamically create images using code or JSX and render to any format
8
-
9
- ## Introduction
10
-
11
- Sometimes you need to create an image dynamically, for example when dynamically generating schematics etc. This library makes that easy by providing tools to create an abstract representation of an image which can then be turned into a concrete format such as .png, .svg etc.
12
-
13
- ## Installation
14
-
15
- `npm install --save abstract-document`
16
-
17
- The library is compiled to ES5 and no polyfills are required.
18
-
19
- ## Usage
20
-
21
- ```js
22
- import * as React from "react";
23
- import * as AbstractImage from "abstract-image";
24
-
25
- export function AbstractImageExample() {
26
- const components = [
27
- AbstractImage.createLine(
28
- AbstractImage.createPoint(25, 25),
29
- AbstractImage.createPoint(80, 60),
30
- AbstractImage.black,
31
- 2
32
- ),
33
- AbstractImage.createRectangle(
34
- AbstractImage.createPoint(10, 50),
35
- AbstractImage.createPoint(40, 80),
36
- AbstractImage.blue,
37
- 2,
38
- AbstractImage.fromArgb(100, 0, 0, 0)
39
- ),
40
- AbstractImage.createRectangle(
41
- AbstractImage.createPoint(60, 50),
42
- AbstractImage.createPoint(90, 80),
43
- AbstractImage.blue,
44
- 2,
45
- AbstractImage.transparent
46
- ),
47
- ];
48
- const image = AbstractImage.createAbstractImage(
49
- AbstractImage.createPoint(0, 0),
50
- AbstractImage.createSize(400, 400),
51
- AbstractImage.white,
52
- components
53
- );
54
- const svg = AbstractImage.createSVG(image);
55
- return (
56
- <div>
57
- <h1>Svg</h1>
58
- <p>Test</p>
59
- <pre>{svg}</pre>
60
- <img width="400" height="400" src={`data:image/svg+xml;,${svg}`} />
61
- </div>
62
- );
63
- }
64
- ```
65
-
66
- [version-image]: https://img.shields.io/npm/v/abstract-image.svg?style=flat
67
- [version-url]: https://www.npmjs.com/package/abstract-image
68
- [license-image]: https://img.shields.io/github/license/dividab/abstract-visuals.svg?style=flat
69
- [license-url]: https://opensource.org/licenses/MIT
70
- [prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat
71
- [prettier-url]: https://github.com/prettier/prettier
72
-
73
- dummy
1
+ # abstract-image
2
+
3
+ [![npm version][version-image]][version-url]
4
+ [![code style: prettier][prettier-image]][prettier-url]
5
+ [![MIT license][license-image]][license-url]
6
+
7
+ Dynamically create images using code or JSX and render to any format
8
+
9
+ ## Introduction
10
+
11
+ Sometimes you need to create an image dynamically, for example when dynamically generating schematics etc. This library makes that easy by providing tools to create an abstract representation of an image which can then be turned into a concrete format such as .png, .svg etc.
12
+
13
+ ## Installation
14
+
15
+ `npm install --save abstract-document`
16
+
17
+ The library is compiled to ES5 and no polyfills are required.
18
+
19
+ ## Usage
20
+
21
+ ```js
22
+ import * as React from "react";
23
+ import * as AbstractImage from "abstract-image";
24
+
25
+ export function AbstractImageExample() {
26
+ const components = [
27
+ AbstractImage.createLine(
28
+ AbstractImage.createPoint(25, 25),
29
+ AbstractImage.createPoint(80, 60),
30
+ AbstractImage.black,
31
+ 2
32
+ ),
33
+ AbstractImage.createRectangle(
34
+ AbstractImage.createPoint(10, 50),
35
+ AbstractImage.createPoint(40, 80),
36
+ AbstractImage.blue,
37
+ 2,
38
+ AbstractImage.fromArgb(100, 0, 0, 0)
39
+ ),
40
+ AbstractImage.createRectangle(
41
+ AbstractImage.createPoint(60, 50),
42
+ AbstractImage.createPoint(90, 80),
43
+ AbstractImage.blue,
44
+ 2,
45
+ AbstractImage.transparent
46
+ ),
47
+ ];
48
+ const image = AbstractImage.createAbstractImage(
49
+ AbstractImage.createPoint(0, 0),
50
+ AbstractImage.createSize(400, 400),
51
+ AbstractImage.white,
52
+ components
53
+ );
54
+ const svg = AbstractImage.createSVG(image);
55
+ return (
56
+ <div>
57
+ <h1>Svg</h1>
58
+ <p>Test</p>
59
+ <pre>{svg}</pre>
60
+ <img width="400" height="400" src={`data:image/svg+xml;,${svg}`} />
61
+ </div>
62
+ );
63
+ }
64
+ ```
65
+
66
+ [version-image]: https://img.shields.io/npm/v/abstract-image.svg?style=flat
67
+ [version-url]: https://www.npmjs.com/package/abstract-image
68
+ [license-image]: https://img.shields.io/github/license/dividab/abstract-visuals.svg?style=flat
69
+ [license-url]: https://opensource.org/licenses/MIT
70
+ [prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat
71
+ [prettier-url]: https://github.com/prettier/prettier
72
+
73
+ dummy