@scratch/scratch-svg-renderer 11.0.0-beta.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.
Files changed (54) hide show
  1. package/.editorconfig +15 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.js +10 -0
  4. package/.gitattributes +38 -0
  5. package/.nvmrc +1 -0
  6. package/CHANGELOG.md +1300 -0
  7. package/LICENSE +12 -0
  8. package/README.md +89 -0
  9. package/TRADEMARK +1 -0
  10. package/commitlint.config.js +4 -0
  11. package/package.json +76 -0
  12. package/playground/index.html +132 -0
  13. package/playground/scratch-svg-renderer.js +17830 -0
  14. package/playground/scratch-svg-renderer.js.map +1 -0
  15. package/release.config.js +14 -0
  16. package/src/bitmap-adapter.js +156 -0
  17. package/src/fixup-svg-string.js +61 -0
  18. package/src/font-converter.js +38 -0
  19. package/src/font-inliner.js +50 -0
  20. package/src/index.js +22 -0
  21. package/src/load-svg-string.js +334 -0
  22. package/src/playground/index.html +132 -0
  23. package/src/sanitize-svg.js +104 -0
  24. package/src/serialize-svg-to-string.js +19 -0
  25. package/src/svg-element.js +71 -0
  26. package/src/svg-renderer.js +169 -0
  27. package/src/transform-applier.js +628 -0
  28. package/src/util/log.js +4 -0
  29. package/test/bitmapAdapter_getResized.js +102 -0
  30. package/test/fixtures/css-import.sanitized.svg +5 -0
  31. package/test/fixtures/css-import.svg +11 -0
  32. package/test/fixtures/embedded-cat-foo.sanitized.svg +3 -0
  33. package/test/fixtures/embedded-cat-foo.svg +3 -0
  34. package/test/fixtures/embedded-cat-xlink.svg +3 -0
  35. package/test/fixtures/hearts.svg +31 -0
  36. package/test/fixtures/invalid-cloud.svg +1 -0
  37. package/test/fixtures/metadata-body.svg +6 -0
  38. package/test/fixtures/metadata-onload.sanitized.svg +3 -0
  39. package/test/fixtures/metadata-onload.svg +7 -0
  40. package/test/fixtures/onload-script.svg +7 -0
  41. package/test/fixtures/red-and-white-carousel-pound-in-href.sanitized.svg +74 -0
  42. package/test/fixtures/red-and-white-carousel-pound-in-href.svg +74 -0
  43. package/test/fixtures/reserved-namespace.sanitized.svg +3 -0
  44. package/test/fixtures/reserved-namespace.svg +4 -0
  45. package/test/fixtures/scratch_cat_bitmap_within_svg.sanitized.svg +1 -0
  46. package/test/fixtures/scratch_cat_bitmap_within_svg.svg +1 -0
  47. package/test/fixtures/script.sanitized.svg +4 -0
  48. package/test/fixtures/script.svg +8 -0
  49. package/test/fixtures/svg-tag-prefixes.svg +37 -0
  50. package/test/fixup-svg-string.js +144 -0
  51. package/test/sanitize-svg.js +34 -0
  52. package/test/test-output/transform-applier-test.html +373 -0
  53. package/test/transform-applier.js +796 -0
  54. package/webpack.config.js +72 -0
package/.editorconfig ADDED
@@ -0,0 +1,15 @@
1
+ root = true
2
+
3
+ [*]
4
+ end_of_line = lf
5
+ insert_final_newline = true
6
+ charset = utf-8
7
+ indent_size = 4
8
+ trim_trailing_whitespace = true
9
+
10
+ [*.{js}]
11
+ indent_style = space
12
+
13
+ [*.{json,json5}]
14
+ indent_style = space
15
+ indent_size = 2
package/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ dist/*
2
+ node_modules/*
3
+ playground/*
package/.eslintrc.js ADDED
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ extends: ['scratch', 'scratch/es6', 'scratch/node'],
3
+ globals: {
4
+ document: true,
5
+ window: true,
6
+ DOMParser: true,
7
+ Image: true,
8
+ XMLSerializer: true
9
+ }
10
+ };
package/.gitattributes ADDED
@@ -0,0 +1,38 @@
1
+ # Set the default behavior, in case people don't have core.autocrlf set.
2
+ * text=auto
3
+
4
+ # Explicitly specify line endings for as many files as possible.
5
+ # People who (for example) rsync between Windows and Linux need this.
6
+
7
+ # File types which we know are binary
8
+ *.sb2 binary
9
+
10
+ # Prefer LF for most file types
11
+ *.css text eol=lf
12
+ *.frag text eol=lf
13
+ *.htm text eol=lf
14
+ *.html text eol=lf
15
+ *.iml text eol=lf
16
+ *.js text eol=lf
17
+ *.js.map text eol=lf
18
+ *.json text eol=lf
19
+ *.json5 text eol=lf
20
+ *.md text eol=lf
21
+ *.vert text eol=lf
22
+ *.xml text eol=lf
23
+ *.yml text eol=lf
24
+
25
+ # Prefer LF for these files
26
+ .editorconfig text eol=lf
27
+ .eslintignore text eol=lf
28
+ .eslintrc text eol=lf
29
+ .gitattributes text eol=lf
30
+ .gitignore text eol=lf
31
+ .gitmodules text eol=lf
32
+ .npmignore text eol=lf
33
+ LICENSE text eol=lf
34
+ Makefile text eol=lf
35
+ README text eol=lf
36
+ TRADEMARK text eol=lf
37
+
38
+ # Use CRLF for Windows-specific file types
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v20