mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Compare commits
24 Commits
drop-ie9-s
...
v1.3.4
Author | SHA1 | Date | |
---|---|---|---|
04787ee88a | |||
ba2b1cd8e9 | |||
d9222075da | |||
101c32ed71 | |||
ddffaecf6d | |||
fd22a01a3c | |||
ed57781594 | |||
eeda86bd5e | |||
0b1f0a7e90 | |||
38c682955a | |||
01ed87907a | |||
58ff0003f7 | |||
f143166551 | |||
cd0d7258c3 | |||
b482725994 | |||
1b55ed5668 | |||
68377b3244 | |||
6947982848 | |||
437b367d3b | |||
969638fb94 | |||
f919204efa | |||
c378e22069 | |||
2b4de68e92 | |||
1941b9e0ac |
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@ -101,22 +101,26 @@ jobs:
|
|||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
name: OSX Safari Stable
|
name: OSX Safari Stable
|
||||||
targetBrowser: Safari_Stable
|
targetBrowser: Safari_Stable
|
||||||
- os: macos-latest
|
- os: macos-10.15
|
||||||
name: iOS Simulator Safari 12
|
name: iOS Simulator Safari 12
|
||||||
targetBrowser: Safari_IOS_12
|
targetBrowser: Safari_IOS_12
|
||||||
xcode: /Applications/Xcode_10.3.app
|
xcode: /Applications/Xcode_10.3.app
|
||||||
- os: macos-latest
|
- os: macos-10.15
|
||||||
name: iOS Simulator Safari 13
|
name: iOS Simulator Safari 13
|
||||||
targetBrowser: Safari_IOS_13
|
targetBrowser: Safari_IOS_13
|
||||||
xcode: /Applications/Xcode_11.6_beta.app
|
xcode: /Applications/Xcode_11.7.app
|
||||||
- os: macos-latest
|
- os: macos-10.15
|
||||||
name: iOS Simulator Safari 14
|
name: iOS Simulator Safari 14
|
||||||
targetBrowser: Safari_IOS_14
|
targetBrowser: Safari_IOS_14
|
||||||
xcode: /Applications/Xcode_12_beta.app
|
xcode: /Applications/Xcode_12.4.app
|
||||||
|
- os: macos-11
|
||||||
|
name: iOS Simulator Safari 15.0
|
||||||
|
targetBrowser: Safari_IOS_15_0
|
||||||
|
xcode: /Applications/Xcode_13.0.app
|
||||||
- os: macos-11
|
- os: macos-11
|
||||||
name: iOS Simulator Safari 15
|
name: iOS Simulator Safari 15
|
||||||
targetBrowser: Safari_IOS_15
|
targetBrowser: Safari_IOS_15
|
||||||
xcode: /Applications/Xcode_13.0.app
|
xcode: /Applications/Xcode_13.2.app
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
name: Windows Internet Explorer 9 (Emulated)
|
name: Windows Internet Explorer 9 (Emulated)
|
||||||
targetBrowser: IE_9
|
targetBrowser: IE_9
|
||||||
|
130
CHANGELOG.md
130
CHANGELOG.md
@ -2,6 +2,103 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.3.4](https://github.com/niklasvh/html2canvas/compare/v1.3.3...v1.3.4) (2021-12-29)
|
||||||
|
|
||||||
|
|
||||||
|
### ci
|
||||||
|
|
||||||
|
* add ios 15.0 testing (#2780) ([d922207](https://github.com/niklasvh/html2canvas/commit/d9222075daaed08884491b0563fc899ee0ced731)), closes [#2780](https://github.com/niklasvh/html2canvas/issues/2780)
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* ios 15 font rendering crash (#2645) ([ba2b1cd](https://github.com/niklasvh/html2canvas/commit/ba2b1cd8e9a9d7932675d7abffce1526a609e769)), closes [#2645](https://github.com/niklasvh/html2canvas/issues/2645)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [1.3.3](https://github.com/niklasvh/html2canvas/compare/v1.3.2...v1.3.3) (2021-11-23)
|
||||||
|
|
||||||
|
|
||||||
|
### ci
|
||||||
|
|
||||||
|
* fix macos action runners (#2757) ([ed57781](https://github.com/niklasvh/html2canvas/commit/ed577815949b6a565df54f2101cf6f0fb731c290)), closes [#2757](https://github.com/niklasvh/html2canvas/issues/2757)
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* "offsets" text when font is big ([fd22a01](https://github.com/niklasvh/html2canvas/commit/fd22a01a3c9e39293f47caaed0c0e13d2dc8170c))
|
||||||
|
* const enums (#2651) ([eeda86b](https://github.com/niklasvh/html2canvas/commit/eeda86bd5e81fb4e97675fe9bee3d4d15899997f)), closes [#2651](https://github.com/niklasvh/html2canvas/issues/2651)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [1.3.2](https://github.com/niklasvh/html2canvas/compare/v1.3.1...v1.3.2) (2021-08-15)
|
||||||
|
|
||||||
|
|
||||||
|
### docs
|
||||||
|
|
||||||
|
* add warning for webgl cloning with preserveDrawingBuffer=false (#2661) ([01ed879](https://github.com/niklasvh/html2canvas/commit/01ed87907ad9c7688880e2c5cb8ebc22ef73a4d8)), closes [#2661](https://github.com/niklasvh/html2canvas/issues/2661)
|
||||||
|
* include src files on www (#2660) ([58ff000](https://github.com/niklasvh/html2canvas/commit/58ff0003f77d825ac027eeec95fa80c0123eaf8f)), closes [#2660](https://github.com/niklasvh/html2canvas/issues/2660)
|
||||||
|
|
||||||
|
### feat
|
||||||
|
|
||||||
|
* add support for data-html2canvas-debug property for debugging (#2658) ([cd0d725](https://github.com/niklasvh/html2canvas/commit/cd0d7258c3a93f2989d5d9ec0244ba2763ea2d23)), closes [#2658](https://github.com/niklasvh/html2canvas/issues/2658)
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* disable transition properties (#2659) ([f143166](https://github.com/niklasvh/html2canvas/commit/f1431665513e0a4636fb167a241f4a0571ba728a)), closes [#2659](https://github.com/niklasvh/html2canvas/issues/2659)
|
||||||
|
* overflows with absolutely positioned content (#2663) ([38c6829](https://github.com/niklasvh/html2canvas/commit/38c682955a9299ca7785af71d8f251df799405b0)), closes [#2663](https://github.com/niklasvh/html2canvas/issues/2663)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [1.3.1](https://github.com/niklasvh/html2canvas/compare/v1.3.0...v1.3.1) (2021-08-14)
|
||||||
|
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* multi arg transition/animation duration (#2657) ([1b55ed5](https://github.com/niklasvh/html2canvas/commit/1b55ed5668dcbbe1c6d8d7e94736d8f2da2d31c5)), closes [#2657](https://github.com/niklasvh/html2canvas/issues/2657)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [1.3.0](https://github.com/niklasvh/html2canvas/compare/v1.2.2...v1.3.0) (2021-08-13)
|
||||||
|
|
||||||
|
|
||||||
|
### feat
|
||||||
|
|
||||||
|
* add rtl render support (#2653) ([6947982](https://github.com/niklasvh/html2canvas/commit/694798284838b16882e648914da0905818aa366c)), closes [#2653](https://github.com/niklasvh/html2canvas/issues/2653)
|
||||||
|
* correctly break graphemes (#2652) ([437b367](https://github.com/niklasvh/html2canvas/commit/437b367d3ba9dfd7f9a4c8042ac8d00208c09770)), closes [#2652](https://github.com/niklasvh/html2canvas/issues/2652)
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* correctly handle allowTaint canvas cloning (#2649) ([c378e22](https://github.com/niklasvh/html2canvas/commit/c378e220694c14cb7b3b4b8650a7757f8fc23c7a)), closes [#2649](https://github.com/niklasvh/html2canvas/issues/2649)
|
||||||
|
* finish animation/transitions for elements (#2632) ([969638f](https://github.com/niklasvh/html2canvas/commit/969638fb94a0a14c64a667fa6e5689f79d9f1044)), closes [#2632](https://github.com/niklasvh/html2canvas/issues/2632)
|
||||||
|
|
||||||
|
### test
|
||||||
|
|
||||||
|
* add letter-spacing test for zwj emoji (#2650) ([f919204](https://github.com/niklasvh/html2canvas/commit/f919204efa06af219f155ca279f96124bb92862b)), closes [#2650](https://github.com/niklasvh/html2canvas/issues/2650)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [1.2.2](https://github.com/niklasvh/html2canvas/compare/v1.2.1...v1.2.2) (2021-08-10)
|
||||||
|
|
||||||
|
|
||||||
|
### ci
|
||||||
|
|
||||||
|
* add ios15 target (#2564) ([e429e04](https://github.com/niklasvh/html2canvas/commit/e429e0443adf5c7ca3041b97a8157b8911302206)), closes [#2564](https://github.com/niklasvh/html2canvas/issues/2564)
|
||||||
|
|
||||||
|
### docs
|
||||||
|
|
||||||
|
* update test previewer (#2637) ([7a06d0c](https://github.com/niklasvh/html2canvas/commit/7a06d0c2c2f3b8a1d1a8a85c540f8288b782e8c6)), closes [#2637](https://github.com/niklasvh/html2canvas/issues/2637)
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* parsing counter content in pseudo element (#2640) ([1941b9e](https://github.com/niklasvh/html2canvas/commit/1941b9e0acfd9243da0beaf70e1643cab1b4a963)), closes [#2640](https://github.com/niklasvh/html2canvas/issues/2640)
|
||||||
|
* radial gradient ry check (#2631) ([a0dd38a](https://github.com/niklasvh/html2canvas/commit/a0dd38a8be4e540ae1c1f4b4e41f6c386f3e454f)), closes [#2631](https://github.com/niklasvh/html2canvas/issues/2631)
|
||||||
|
* test for ios range line break error (#2635) ([f43f942](https://github.com/niklasvh/html2canvas/commit/f43f942fcd793dde9cdc6c0438f379ec3c05c405)), closes [#2635](https://github.com/niklasvh/html2canvas/issues/2635)
|
||||||
|
|
||||||
|
### test
|
||||||
|
|
||||||
|
* large base64 encoded background (#2636) ([e36408a](https://github.com/niklasvh/html2canvas/commit/e36408ad030fe31acd9969a37fe24c1621c0bd04)), closes [#2636](https://github.com/niklasvh/html2canvas/issues/2636)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [1.2.1](https://github.com/niklasvh/html2canvas/compare/v1.2.0...v1.2.1) (2021-08-05)
|
## [1.2.1](https://github.com/niklasvh/html2canvas/compare/v1.2.0...v1.2.1) (2021-08-05)
|
||||||
|
|
||||||
|
|
||||||
@ -141,9 +238,14 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
|
|
||||||
* update www deps (#2525) ([2a013e2](https://github.com/niklasvh/html2canvas/commit/2a013e20c814b7dbaea98f54f0bde8f553eb79a2)), closes [#2525](https://github.com/niklasvh/html2canvas/issues/2525)
|
* update www deps (#2525) ([2a013e2](https://github.com/niklasvh/html2canvas/commit/2a013e20c814b7dbaea98f54f0bde8f553eb79a2)), closes [#2525](https://github.com/niklasvh/html2canvas/issues/2525)
|
||||||
|
|
||||||
|
### feat
|
||||||
|
|
||||||
|
* add support for border-style dashed, dotted, double (#2531) ([72cd528](https://github.com/niklasvh/html2canvas/commit/72cd5284296e4cdb3fe88f2982ec7528604b6618))
|
||||||
|
|
||||||
### fix
|
### fix
|
||||||
|
|
||||||
* opacity with overflow hidden (#2450) ([82b7da5](https://github.com/niklasvh/html2canvas/commit/82b7da558c342e7f53d298bb1d843a5db86c3b21)), closes [#2450](https://github.com/niklasvh/html2canvas/issues/2450)
|
* opacity with overflow hidden (#2450) ([82b7da5](https://github.com/niklasvh/html2canvas/commit/82b7da558c342e7f53d298bb1d843a5db86c3b21)), closes [#2450](https://github.com/niklasvh/html2canvas/issues/2450)
|
||||||
|
* top right border radius (#2522) ([ba17267](https://github.com/niklasvh/html2canvas/commit/ba172678f07f962e9f54b398df087e86217d7a13))
|
||||||
|
|
||||||
### test
|
### test
|
||||||
|
|
||||||
@ -291,16 +393,16 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
* Fix white space appearing on element rendering (Fix #1438)
|
* Fix white space appearing on element rendering (Fix #1438)
|
||||||
* Reset canvas transform on finish (Fix #1494)
|
* Reset canvas transform on finish (Fix #1494)
|
||||||
|
|
||||||
# v1.0.0-alpha.11 - 1.4.2018
|
# v1.0.0-alpha.11 - 1.4.2018
|
||||||
* Fix IE11 member not found error
|
* Fix IE11 member not found error
|
||||||
* Support blob image resources in non-foreignObjectRendering mode
|
* Support blob image resources in non-foreignObjectRendering mode
|
||||||
|
|
||||||
# v1.0.0-alpha.10 - 15.2.2018
|
# v1.0.0-alpha.10 - 15.2.2018
|
||||||
* Re-introduce `onclone` option (Fix #1434)
|
* Re-introduce `onclone` option (Fix #1434)
|
||||||
* Add `ignoreElements` predicate function option
|
* Add `ignoreElements` predicate function option
|
||||||
* Fix version console logging
|
* Fix version console logging
|
||||||
|
|
||||||
# v1.0.0-alpha.9 - 7.1.2018
|
# v1.0.0-alpha.9 - 7.1.2018
|
||||||
* Fix dynamic style sheets
|
* Fix dynamic style sheets
|
||||||
* Fix > 50% border-radius values
|
* Fix > 50% border-radius values
|
||||||
|
|
||||||
@ -312,7 +414,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
* Fix form input rendering (#1338)
|
* Fix form input rendering (#1338)
|
||||||
* Improve word line breaking algorithm
|
* Improve word line breaking algorithm
|
||||||
|
|
||||||
# v1.0.0-alpha.6 - 28.12.2017
|
# v1.0.0-alpha.6 - 28.12.2017
|
||||||
* Fix list-style: none (#1340)
|
* Fix list-style: none (#1340)
|
||||||
* Extend supported values for pseudo element content
|
* Extend supported values for pseudo element content
|
||||||
|
|
||||||
@ -322,7 +424,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
* Fix overflow: auto
|
* Fix overflow: auto
|
||||||
* Added support for rendering list-style
|
* Added support for rendering list-style
|
||||||
|
|
||||||
v1.0.0-alpha.4 - 12.12.2017
|
v1.0.0-alpha.4 - 12.12.2017
|
||||||
* Fix rendering with multiple fonts defined (Fix #796)
|
* Fix rendering with multiple fonts defined (Fix #796)
|
||||||
* Add support for radial-gradients
|
* Add support for radial-gradients
|
||||||
* Fix logging option (#1302)
|
* Fix logging option (#1302)
|
||||||
@ -344,8 +446,8 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
##### Breaking Changes #####
|
##### Breaking Changes #####
|
||||||
* Remove deprecated onrendered callback, calling `html2canvas` returns a `Promise<HTMLCanvasElement>`
|
* Remove deprecated onrendered callback, calling `html2canvas` returns a `Promise<HTMLCanvasElement>`
|
||||||
* Removed option `type`, same results can be achieved by assigning `x`, `y`, `scrollX`, `scrollY`, `width` and `height` properties.
|
* Removed option `type`, same results can be achieved by assigning `x`, `y`, `scrollX`, `scrollY`, `width` and `height` properties.
|
||||||
|
|
||||||
## New featues / fixes
|
## New featues / fixes
|
||||||
* Add support for scaling canvas (defaults to device pixel ratio)
|
* Add support for scaling canvas (defaults to device pixel ratio)
|
||||||
* Add support for multiple text-shadows
|
* Add support for multiple text-shadows
|
||||||
* Add support for multiple text-decorations
|
* Add support for multiple text-decorations
|
||||||
@ -354,7 +456,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
* Correctly handle px and percentage values in linear-gradients
|
* Correctly handle px and percentage values in linear-gradients
|
||||||
* Correctly support all angle types for linear-gradients
|
* Correctly support all angle types for linear-gradients
|
||||||
* Add support for multiple values for background-repeat, background-position and background-size
|
* Add support for multiple values for background-repeat, background-position and background-size
|
||||||
|
|
||||||
# v0.5.0-beta4 - 23.1.2016
|
# v0.5.0-beta4 - 23.1.2016
|
||||||
* Fix logger requiring access to window object
|
* Fix logger requiring access to window object
|
||||||
* Derequire browserify build
|
* Derequire browserify build
|
||||||
@ -374,11 +476,11 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
* Fix transparent colors breaking gradients
|
* Fix transparent colors breaking gradients
|
||||||
* Preserve scrolling positions on render
|
* Preserve scrolling positions on render
|
||||||
|
|
||||||
# v0.5.0-alpha2 - 3.2.2015
|
# v0.5.0-alpha2 - 3.2.2015
|
||||||
* Switch to using browserify for building
|
* Switch to using browserify for building
|
||||||
* Fix (#517) Chrome stretches background images with 'auto' or single attributes
|
* Fix (#517) Chrome stretches background images with 'auto' or single attributes
|
||||||
|
|
||||||
# v0.5.0-alpha - 19.1.2015
|
# v0.5.0-alpha - 19.1.2015
|
||||||
* Complete rewrite of library
|
* Complete rewrite of library
|
||||||
* Switched interface to return Promise
|
* Switched interface to return Promise
|
||||||
* Uses hidden iframe window to perform rendering, allowing async rendering and doesn't force the viewport to be scrolled to the top anymore.
|
* Uses hidden iframe window to perform rendering, allowing async rendering and doesn't force the viewport to be scrolled to the top anymore.
|
||||||
@ -389,14 +491,14 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
* Changed format for proxy requests, permitting binary responses with CORS headers as well
|
* Changed format for proxy requests, permitting binary responses with CORS headers as well
|
||||||
* Fixed many layering issues (see z-index tests)
|
* Fixed many layering issues (see z-index tests)
|
||||||
|
|
||||||
# v0.4.1 - 7.9.2013
|
# v0.4.1 - 7.9.2013
|
||||||
* Added support for bower
|
* Added support for bower
|
||||||
* Improved z-index ordering
|
* Improved z-index ordering
|
||||||
* Basic implementation for CSS transformations
|
* Basic implementation for CSS transformations
|
||||||
* Fixed inline text in top element
|
* Fixed inline text in top element
|
||||||
* Basic implementation for text-shadow
|
* Basic implementation for text-shadow
|
||||||
|
|
||||||
# v0.4.0 - 30.1.2013
|
# v0.4.0 - 30.1.2013
|
||||||
* Added rendering tests with <a href="https://github.com/niklasvh/webdriver.js">webdriver</a>
|
* Added rendering tests with <a href="https://github.com/niklasvh/webdriver.js">webdriver</a>
|
||||||
* Switched to using grunt for building
|
* Switched to using grunt for building
|
||||||
* Removed support for IE<9, including any FlashCanvas bits
|
* Removed support for IE<9, including any FlashCanvas bits
|
||||||
@ -406,7 +508,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|||||||
* Support for placeholder rendering
|
* Support for placeholder rendering
|
||||||
* Reformatted all tests to small units to test specific features
|
* Reformatted all tests to small units to test specific features
|
||||||
|
|
||||||
# v0.3.4 - 26.6.2012
|
# v0.3.4 - 26.6.2012
|
||||||
|
|
||||||
* Removed (last?) jQuery dependencies (<a href="https://github.com/niklasvh/html2canvas/commit/343b86705fe163766fcf735eb0217130e4bd5b17">niklasvh</a>)
|
* Removed (last?) jQuery dependencies (<a href="https://github.com/niklasvh/html2canvas/commit/343b86705fe163766fcf735eb0217130e4bd5b17">niklasvh</a>)
|
||||||
* SVG-powered rendering (<a href="https://github.com/niklasvh/html2canvas/commit/67d3e0d0f59a5a654caf71a2e3be6494ff146c75">niklasvh</a>)
|
* SVG-powered rendering (<a href="https://github.com/niklasvh/html2canvas/commit/67d3e0d0f59a5a654caf71a2e3be6494ff146c75">niklasvh</a>)
|
||||||
|
@ -34,19 +34,25 @@ module.exports = function(config) {
|
|||||||
base: 'MobileSafari',
|
base: 'MobileSafari',
|
||||||
name: 'iPhone 8',
|
name: 'iPhone 8',
|
||||||
platform: 'iOS',
|
platform: 'iOS',
|
||||||
sdk: '13.6'
|
sdk: '13.7'
|
||||||
},
|
},
|
||||||
Safari_IOS_14: {
|
Safari_IOS_14: {
|
||||||
base: 'MobileSafari',
|
base: 'MobileSafari',
|
||||||
name: 'iPhone 8',
|
name: 'iPhone 8',
|
||||||
platform: 'iOS',
|
platform: 'iOS',
|
||||||
sdk: '14.0'
|
sdk: '14.4'
|
||||||
|
},
|
||||||
|
Safari_IOS_15_0: {
|
||||||
|
base: 'MobileSafari',
|
||||||
|
name: 'iPhone 13',
|
||||||
|
platform: 'iOS',
|
||||||
|
sdk: '15.0'
|
||||||
},
|
},
|
||||||
Safari_IOS_15: {
|
Safari_IOS_15: {
|
||||||
base: 'MobileSafari',
|
base: 'MobileSafari',
|
||||||
name: 'iPhone 8',
|
name: 'iPhone 13',
|
||||||
platform: 'iOS',
|
platform: 'iOS',
|
||||||
sdk: '15.0'
|
sdk: '15.2'
|
||||||
},
|
},
|
||||||
SauceLabs_IE9: {
|
SauceLabs_IE9: {
|
||||||
base: 'SauceLabs',
|
base: 'SauceLabs',
|
||||||
|
2551
package-lock.json
generated
2551
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
|||||||
"module": "dist/html2canvas.esm.js",
|
"module": "dist/html2canvas.esm.js",
|
||||||
"typings": "dist/types/index.d.ts",
|
"typings": "dist/types/index.d.ts",
|
||||||
"browser": "dist/html2canvas.js",
|
"browser": "dist/html2canvas.js",
|
||||||
"version": "1.2.1",
|
"version": "1.3.4",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Niklas von Hertzen",
|
"name": "Niklas von Hertzen",
|
||||||
"email": "niklasvh@gmail.com",
|
"email": "niklasvh@gmail.com",
|
||||||
@ -48,7 +48,7 @@
|
|||||||
"babel-loader": "^8.0.5",
|
"babel-loader": "^8.0.5",
|
||||||
"babel-plugin-add-module-exports": "^1.0.2",
|
"babel-plugin-add-module-exports": "^1.0.2",
|
||||||
"babel-plugin-dev-expression": "^0.2.1",
|
"babel-plugin-dev-expression": "^0.2.1",
|
||||||
"base64-arraybuffer": "0.2.0",
|
"base64-arraybuffer": "1.0.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"chai": "4.1.1",
|
"chai": "4.1.1",
|
||||||
"chromeless": "^1.5.2",
|
"chromeless": "^1.5.2",
|
||||||
@ -118,6 +118,7 @@
|
|||||||
"homepage": "https://html2canvas.hertzen.com",
|
"homepage": "https://html2canvas.hertzen.com",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"css-line-break": "2.0.1"
|
"css-line-break": "2.0.1",
|
||||||
|
"text-segmentation": "^1.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
src/core/debugger.ts
Normal file
29
src/core/debugger.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
const elementDebuggerAttribute = 'data-html2canvas-debug';
|
||||||
|
export const enum DebuggerType {
|
||||||
|
NONE,
|
||||||
|
ALL,
|
||||||
|
CLONE,
|
||||||
|
PARSE,
|
||||||
|
RENDER
|
||||||
|
}
|
||||||
|
|
||||||
|
const getElementDebugType = (element: Element): DebuggerType => {
|
||||||
|
const attribute = element.getAttribute(elementDebuggerAttribute);
|
||||||
|
switch (attribute) {
|
||||||
|
case 'all':
|
||||||
|
return DebuggerType.ALL;
|
||||||
|
case 'clone':
|
||||||
|
return DebuggerType.CLONE;
|
||||||
|
case 'parse':
|
||||||
|
return DebuggerType.PARSE;
|
||||||
|
case 'render':
|
||||||
|
return DebuggerType.RENDER;
|
||||||
|
default:
|
||||||
|
return DebuggerType.NONE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isDebugging = (element: Element, type: Omit<DebuggerType, DebuggerType.NONE>): boolean => {
|
||||||
|
const elementType = getElementDebugType(element);
|
||||||
|
return elementType === DebuggerType.ALL || type === elementType;
|
||||||
|
};
|
@ -1,8 +1,8 @@
|
|||||||
import {CSSValue} from './syntax/parser';
|
import {CSSValue} from './syntax/parser';
|
||||||
import {CSSTypes} from './types/index';
|
import {CSSTypes} from './types';
|
||||||
import {Context} from '../core/context';
|
import {Context} from '../core/context';
|
||||||
|
|
||||||
export enum PropertyDescriptorParsingType {
|
export const enum PropertyDescriptorParsingType {
|
||||||
VALUE,
|
VALUE,
|
||||||
LIST,
|
LIST,
|
||||||
IDENT_VALUE,
|
IDENT_VALUE,
|
||||||
|
@ -31,6 +31,7 @@ import {
|
|||||||
borderTopWidth
|
borderTopWidth
|
||||||
} from './property-descriptors/border-width';
|
} from './property-descriptors/border-width';
|
||||||
import {color} from './property-descriptors/color';
|
import {color} from './property-descriptors/color';
|
||||||
|
import {direction} from './property-descriptors/direction';
|
||||||
import {display, DISPLAY} from './property-descriptors/display';
|
import {display, DISPLAY} from './property-descriptors/display';
|
||||||
import {float, FLOAT} from './property-descriptors/float';
|
import {float, FLOAT} from './property-descriptors/float';
|
||||||
import {letterSpacing} from './property-descriptors/letter-spacing';
|
import {letterSpacing} from './property-descriptors/letter-spacing';
|
||||||
@ -57,6 +58,7 @@ import {Tokenizer} from './syntax/tokenizer';
|
|||||||
import {Color, color as colorType, isTransparent} from './types/color';
|
import {Color, color as colorType, isTransparent} from './types/color';
|
||||||
import {angle} from './types/angle';
|
import {angle} from './types/angle';
|
||||||
import {image} from './types/image';
|
import {image} from './types/image';
|
||||||
|
import {time} from './types/time';
|
||||||
import {opacity} from './property-descriptors/opacity';
|
import {opacity} from './property-descriptors/opacity';
|
||||||
import {textDecorationColor} from './property-descriptors/text-decoration-color';
|
import {textDecorationColor} from './property-descriptors/text-decoration-color';
|
||||||
import {textDecorationLine} from './property-descriptors/text-decoration-line';
|
import {textDecorationLine} from './property-descriptors/text-decoration-line';
|
||||||
@ -71,6 +73,7 @@ import {contains} from '../core/bitwise';
|
|||||||
import {content} from './property-descriptors/content';
|
import {content} from './property-descriptors/content';
|
||||||
import {counterIncrement} from './property-descriptors/counter-increment';
|
import {counterIncrement} from './property-descriptors/counter-increment';
|
||||||
import {counterReset} from './property-descriptors/counter-reset';
|
import {counterReset} from './property-descriptors/counter-reset';
|
||||||
|
import {duration} from './property-descriptors/duration';
|
||||||
import {quotes} from './property-descriptors/quotes';
|
import {quotes} from './property-descriptors/quotes';
|
||||||
import {boxShadow} from './property-descriptors/box-shadow';
|
import {boxShadow} from './property-descriptors/box-shadow';
|
||||||
import {paintOrder} from './property-descriptors/paint-order';
|
import {paintOrder} from './property-descriptors/paint-order';
|
||||||
@ -79,6 +82,7 @@ import {webkitTextStrokeWidth} from './property-descriptors/webkit-text-stroke-w
|
|||||||
import {Context} from '../core/context';
|
import {Context} from '../core/context';
|
||||||
|
|
||||||
export class CSSParsedDeclaration {
|
export class CSSParsedDeclaration {
|
||||||
|
animationDuration: ReturnType<typeof duration.parse>;
|
||||||
backgroundClip: ReturnType<typeof backgroundClip.parse>;
|
backgroundClip: ReturnType<typeof backgroundClip.parse>;
|
||||||
backgroundColor: Color;
|
backgroundColor: Color;
|
||||||
backgroundImage: ReturnType<typeof backgroundImage.parse>;
|
backgroundImage: ReturnType<typeof backgroundImage.parse>;
|
||||||
@ -104,6 +108,7 @@ export class CSSParsedDeclaration {
|
|||||||
borderLeftWidth: ReturnType<typeof borderLeftWidth.parse>;
|
borderLeftWidth: ReturnType<typeof borderLeftWidth.parse>;
|
||||||
boxShadow: ReturnType<typeof boxShadow.parse>;
|
boxShadow: ReturnType<typeof boxShadow.parse>;
|
||||||
color: Color;
|
color: Color;
|
||||||
|
direction: ReturnType<typeof direction.parse>;
|
||||||
display: ReturnType<typeof display.parse>;
|
display: ReturnType<typeof display.parse>;
|
||||||
float: ReturnType<typeof float.parse>;
|
float: ReturnType<typeof float.parse>;
|
||||||
fontFamily: ReturnType<typeof fontFamily.parse>;
|
fontFamily: ReturnType<typeof fontFamily.parse>;
|
||||||
@ -145,6 +150,7 @@ export class CSSParsedDeclaration {
|
|||||||
zIndex: ReturnType<typeof zIndex.parse>;
|
zIndex: ReturnType<typeof zIndex.parse>;
|
||||||
|
|
||||||
constructor(context: Context, declaration: CSSStyleDeclaration) {
|
constructor(context: Context, declaration: CSSStyleDeclaration) {
|
||||||
|
this.animationDuration = parse(context, duration, declaration.animationDuration);
|
||||||
this.backgroundClip = parse(context, backgroundClip, declaration.backgroundClip);
|
this.backgroundClip = parse(context, backgroundClip, declaration.backgroundClip);
|
||||||
this.backgroundColor = parse(context, backgroundColor, declaration.backgroundColor);
|
this.backgroundColor = parse(context, backgroundColor, declaration.backgroundColor);
|
||||||
this.backgroundImage = parse(context, backgroundImage, declaration.backgroundImage);
|
this.backgroundImage = parse(context, backgroundImage, declaration.backgroundImage);
|
||||||
@ -170,6 +176,7 @@ export class CSSParsedDeclaration {
|
|||||||
this.borderLeftWidth = parse(context, borderLeftWidth, declaration.borderLeftWidth);
|
this.borderLeftWidth = parse(context, borderLeftWidth, declaration.borderLeftWidth);
|
||||||
this.boxShadow = parse(context, boxShadow, declaration.boxShadow);
|
this.boxShadow = parse(context, boxShadow, declaration.boxShadow);
|
||||||
this.color = parse(context, color, declaration.color);
|
this.color = parse(context, color, declaration.color);
|
||||||
|
this.direction = parse(context, direction, declaration.direction);
|
||||||
this.display = parse(context, display, declaration.display);
|
this.display = parse(context, display, declaration.display);
|
||||||
this.float = parse(context, float, declaration.cssFloat);
|
this.float = parse(context, float, declaration.cssFloat);
|
||||||
this.fontFamily = parse(context, fontFamily, declaration.fontFamily);
|
this.fontFamily = parse(context, fontFamily, declaration.fontFamily);
|
||||||
@ -306,6 +313,8 @@ const parse = (context: Context, descriptor: CSSPropertyDescriptor<any>, style?:
|
|||||||
case 'length-percentage':
|
case 'length-percentage':
|
||||||
const value = parser.parseComponentValue();
|
const value = parser.parseComponentValue();
|
||||||
return isLengthPercentage(value) ? value : ZERO_LENGTH;
|
return isLengthPercentage(value) ? value : ZERO_LENGTH;
|
||||||
|
case 'time':
|
||||||
|
return time.parse(context, parser.parseComponentValue());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import {OVERFLOW_WRAP} from '../property-descriptors/overflow-wrap';
|
import {OVERFLOW_WRAP} from '../property-descriptors/overflow-wrap';
|
||||||
import {CSSParsedDeclaration} from '../index';
|
import {CSSParsedDeclaration} from '../index';
|
||||||
import {fromCodePoint, LineBreaker, toCodePoints} from 'css-line-break';
|
import {fromCodePoint, LineBreaker, toCodePoints} from 'css-line-break';
|
||||||
|
import {splitGraphemes} from 'text-segmentation';
|
||||||
import {Bounds, parseBounds} from './bounds';
|
import {Bounds, parseBounds} from './bounds';
|
||||||
import {FEATURES} from '../../core/features';
|
import {FEATURES} from '../../core/features';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
@ -86,7 +87,7 @@ const getRangeBounds = (context: Context, node: Text, offset: number, length: nu
|
|||||||
};
|
};
|
||||||
|
|
||||||
const breakText = (value: string, styles: CSSParsedDeclaration): string[] => {
|
const breakText = (value: string, styles: CSSParsedDeclaration): string[] => {
|
||||||
return styles.letterSpacing !== 0 ? toCodePoints(value).map((i) => fromCodePoint(i)) : breakWords(value, styles);
|
return styles.letterSpacing !== 0 ? splitGraphemes(value) : breakWords(value, styles);
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://drafts.csswg.org/css-text/#word-separator
|
// https://drafts.csswg.org/css-text/#word-separator
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {IPropertyListDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyListDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {CSSValue, isIdentToken} from '../syntax/parser';
|
import {CSSValue, isIdentToken} from '../syntax/parser';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum BACKGROUND_CLIP {
|
export const enum BACKGROUND_CLIP {
|
||||||
BORDER_BOX = 0,
|
BORDER_BOX = 0,
|
||||||
PADDING_BOX = 1,
|
PADDING_BOX = 1,
|
||||||
CONTENT_BOX = 2
|
CONTENT_BOX = 2
|
||||||
|
@ -3,7 +3,7 @@ import {CSSValue, isIdentToken, parseFunctionArgs} from '../syntax/parser';
|
|||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export type BackgroundRepeat = BACKGROUND_REPEAT[];
|
export type BackgroundRepeat = BACKGROUND_REPEAT[];
|
||||||
|
|
||||||
export enum BACKGROUND_REPEAT {
|
export const enum BACKGROUND_REPEAT {
|
||||||
REPEAT = 0,
|
REPEAT = 0,
|
||||||
NO_REPEAT = 1,
|
NO_REPEAT = 1,
|
||||||
REPEAT_X = 2,
|
REPEAT_X = 2,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum BORDER_STYLE {
|
export const enum BORDER_STYLE {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
SOLID = 1,
|
SOLID = 1,
|
||||||
DASHED = 2,
|
DASHED = 2,
|
||||||
|
23
src/css/property-descriptors/direction.ts
Normal file
23
src/css/property-descriptors/direction.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
|
import {Context} from '../../core/context';
|
||||||
|
|
||||||
|
export const enum DIRECTION {
|
||||||
|
LTR = 0,
|
||||||
|
RTL = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
export const direction: IPropertyIdentValueDescriptor<DIRECTION> = {
|
||||||
|
name: 'direction',
|
||||||
|
initialValue: 'ltr',
|
||||||
|
prefix: false,
|
||||||
|
type: PropertyDescriptorParsingType.IDENT_VALUE,
|
||||||
|
parse: (_context: Context, direction: string) => {
|
||||||
|
switch (direction) {
|
||||||
|
case 'rtl':
|
||||||
|
return DIRECTION.RTL;
|
||||||
|
case 'ltr':
|
||||||
|
default:
|
||||||
|
return DIRECTION.LTR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
14
src/css/property-descriptors/duration.ts
Normal file
14
src/css/property-descriptors/duration.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import {IPropertyListDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
|
import {Context} from '../../core/context';
|
||||||
|
import {CSSValue, isDimensionToken} from '../syntax/parser';
|
||||||
|
import {time} from '../types/time';
|
||||||
|
|
||||||
|
export const duration: IPropertyListDescriptor<number[]> = {
|
||||||
|
name: 'duration',
|
||||||
|
initialValue: '0s',
|
||||||
|
prefix: false,
|
||||||
|
type: PropertyDescriptorParsingType.LIST,
|
||||||
|
parse: (context: Context, tokens: CSSValue[]) => {
|
||||||
|
return tokens.filter(isDimensionToken).map((token) => time.parse(context, token));
|
||||||
|
}
|
||||||
|
};
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum FLOAT {
|
export const enum FLOAT {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
LEFT = 1,
|
LEFT = 1,
|
||||||
RIGHT = 2,
|
RIGHT = 2,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum FONT_STYLE {
|
export const enum FONT_STYLE {
|
||||||
NORMAL = 'normal',
|
NORMAL = 'normal',
|
||||||
ITALIC = 'italic',
|
ITALIC = 'italic',
|
||||||
OBLIQUE = 'oblique'
|
OBLIQUE = 'oblique'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum LIST_STYLE_POSITION {
|
export const enum LIST_STYLE_POSITION {
|
||||||
INSIDE = 0,
|
INSIDE = 0,
|
||||||
OUTSIDE = 1
|
OUTSIDE = 1
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum LIST_STYLE_TYPE {
|
export const enum LIST_STYLE_TYPE {
|
||||||
NONE = -1,
|
NONE = -1,
|
||||||
DISC = 0,
|
DISC = 0,
|
||||||
CIRCLE = 1,
|
CIRCLE = 1,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum OVERFLOW_WRAP {
|
export const enum OVERFLOW_WRAP {
|
||||||
NORMAL = 'normal',
|
NORMAL = 'normal',
|
||||||
BREAK_WORD = 'break-word'
|
BREAK_WORD = 'break-word'
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import {IPropertyListDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyListDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {CSSValue, isIdentToken} from '../syntax/parser';
|
import {CSSValue, isIdentToken} from '../syntax/parser';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum OVERFLOW {
|
export const enum OVERFLOW {
|
||||||
VISIBLE = 0,
|
VISIBLE = 0,
|
||||||
HIDDEN = 1,
|
HIDDEN = 1,
|
||||||
SCROLL = 2,
|
SCROLL = 2,
|
||||||
AUTO = 3
|
CLIP = 3,
|
||||||
|
AUTO = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
export const overflow: IPropertyListDescriptor<OVERFLOW[]> = {
|
export const overflow: IPropertyListDescriptor<OVERFLOW[]> = {
|
||||||
@ -20,6 +21,8 @@ export const overflow: IPropertyListDescriptor<OVERFLOW[]> = {
|
|||||||
return OVERFLOW.HIDDEN;
|
return OVERFLOW.HIDDEN;
|
||||||
case 'scroll':
|
case 'scroll':
|
||||||
return OVERFLOW.SCROLL;
|
return OVERFLOW.SCROLL;
|
||||||
|
case 'clip':
|
||||||
|
return OVERFLOW.CLIP;
|
||||||
case 'auto':
|
case 'auto':
|
||||||
return OVERFLOW.AUTO;
|
return OVERFLOW.AUTO;
|
||||||
case 'visible':
|
case 'visible':
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {IPropertyListDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyListDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {CSSValue, isIdentToken} from '../syntax/parser';
|
import {CSSValue, isIdentToken} from '../syntax/parser';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum PAINT_ORDER_LAYER {
|
export const enum PAINT_ORDER_LAYER {
|
||||||
FILL,
|
FILL,
|
||||||
STROKE,
|
STROKE,
|
||||||
MARKERS
|
MARKERS
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum POSITION {
|
export const enum POSITION {
|
||||||
STATIC = 0,
|
STATIC = 0,
|
||||||
RELATIVE = 1,
|
RELATIVE = 1,
|
||||||
ABSOLUTE = 2,
|
ABSOLUTE = 2,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum TEXT_ALIGN {
|
export const enum TEXT_ALIGN {
|
||||||
LEFT = 0,
|
LEFT = 0,
|
||||||
CENTER = 1,
|
CENTER = 1,
|
||||||
RIGHT = 2
|
RIGHT = 2
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum TEXT_TRANSFORM {
|
export const enum TEXT_TRANSFORM {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
LOWERCASE = 1,
|
LOWERCASE = 1,
|
||||||
UPPERCASE = 2,
|
UPPERCASE = 2,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
import {IPropertyIdentValueDescriptor, PropertyDescriptorParsingType} from '../IPropertyDescriptor';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
export enum VISIBILITY {
|
export const enum VISIBILITY {
|
||||||
VISIBLE = 0,
|
VISIBLE = 0,
|
||||||
HIDDEN = 1,
|
HIDDEN = 1,
|
||||||
COLLAPSE = 2
|
COLLAPSE = 2
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import {fromCodePoint, toCodePoints} from 'css-line-break';
|
import {fromCodePoint, toCodePoints} from 'css-line-break';
|
||||||
|
|
||||||
export enum TokenType {
|
export const enum TokenType {
|
||||||
STRING_TOKEN,
|
STRING_TOKEN,
|
||||||
BAD_STRING_TOKEN,
|
BAD_STRING_TOKEN,
|
||||||
LEFT_PARENTHESIS_TOKEN,
|
LEFT_PARENTHESIS_TOKEN,
|
||||||
|
@ -4,10 +4,7 @@ import {contains} from '../../../core/bitwise';
|
|||||||
import {CSSParsedCounterDeclaration} from '../../index';
|
import {CSSParsedCounterDeclaration} from '../../index';
|
||||||
|
|
||||||
export class CounterState {
|
export class CounterState {
|
||||||
readonly counters: {[key: string]: number[]};
|
private readonly counters: {[key: string]: number[]} = {};
|
||||||
constructor() {
|
|
||||||
this.counters = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
getCounterValue(name: string): number {
|
getCounterValue(name: string): number {
|
||||||
const counter = this.counters[name];
|
const counter = this.counters[name];
|
||||||
@ -18,7 +15,7 @@ export class CounterState {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCounterValues(name: string): number[] {
|
getCounterValues(name: string): readonly number[] {
|
||||||
const counter = this.counters[name];
|
const counter = this.counters[name];
|
||||||
return counter ? counter : [];
|
return counter ? counter : [];
|
||||||
}
|
}
|
||||||
@ -37,6 +34,9 @@ export class CounterState {
|
|||||||
const counter = this.counters[entry.counter];
|
const counter = this.counters[entry.counter];
|
||||||
if (counter && entry.increment !== 0) {
|
if (counter && entry.increment !== 0) {
|
||||||
canReset = false;
|
canReset = false;
|
||||||
|
if (!counter.length) {
|
||||||
|
counter.push(1);
|
||||||
|
}
|
||||||
counter[Math.max(0, counter.length - 1)] += entry.increment;
|
counter[Math.max(0, counter.length - 1)] += entry.increment;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,7 @@ import {radialGradient} from './functions/radial-gradient';
|
|||||||
import {prefixRadialGradient} from './functions/-prefix-radial-gradient';
|
import {prefixRadialGradient} from './functions/-prefix-radial-gradient';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
|
|
||||||
export enum CSSImageType {
|
export const enum CSSImageType {
|
||||||
URL,
|
URL,
|
||||||
LINEAR_GRADIENT,
|
LINEAR_GRADIENT,
|
||||||
RADIAL_GRADIENT
|
RADIAL_GRADIENT
|
||||||
@ -56,12 +56,12 @@ export interface CSSLinearGradientImage extends ICSSGradientImage {
|
|||||||
type: CSSImageType.LINEAR_GRADIENT;
|
type: CSSImageType.LINEAR_GRADIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CSSRadialShape {
|
export const enum CSSRadialShape {
|
||||||
CIRCLE,
|
CIRCLE,
|
||||||
ELLIPSE
|
ELLIPSE
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CSSRadialExtent {
|
export const enum CSSRadialExtent {
|
||||||
CLOSEST_SIDE,
|
CLOSEST_SIDE,
|
||||||
FARTHEST_SIDE,
|
FARTHEST_SIDE,
|
||||||
CLOSEST_CORNER,
|
CLOSEST_CORNER,
|
||||||
|
@ -1 +1 @@
|
|||||||
export type CSSTypes = 'angle' | 'color' | 'image' | 'length' | 'length-percentage';
|
export type CSSTypes = 'angle' | 'color' | 'image' | 'length' | 'length-percentage' | 'time';
|
||||||
|
20
src/css/types/time.ts
Normal file
20
src/css/types/time.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import {CSSValue} from '../syntax/parser';
|
||||||
|
import {TokenType} from '../syntax/tokenizer';
|
||||||
|
import {ITypeDescriptor} from '../ITypeDescriptor';
|
||||||
|
import {Context} from '../../core/context';
|
||||||
|
|
||||||
|
export const time: ITypeDescriptor<number> = {
|
||||||
|
name: 'time',
|
||||||
|
parse: (_context: Context, value: CSSValue): number => {
|
||||||
|
if (value.type === TokenType.DIMENSION_TOKEN) {
|
||||||
|
switch (value.unit.toLowerCase()) {
|
||||||
|
case 's':
|
||||||
|
return 1000 * value.number;
|
||||||
|
case 'ms':
|
||||||
|
return value.number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Unsupported time type`);
|
||||||
|
}
|
||||||
|
};
|
@ -20,10 +20,12 @@ import {LIST_STYLE_TYPE, listStyleType} from '../css/property-descriptors/list-s
|
|||||||
import {CSSParsedCounterDeclaration, CSSParsedPseudoDeclaration} from '../css/index';
|
import {CSSParsedCounterDeclaration, CSSParsedPseudoDeclaration} from '../css/index';
|
||||||
import {getQuote} from '../css/property-descriptors/quotes';
|
import {getQuote} from '../css/property-descriptors/quotes';
|
||||||
import {Context} from '../core/context';
|
import {Context} from '../core/context';
|
||||||
|
import {DebuggerType, isDebugging} from '../core/debugger';
|
||||||
|
|
||||||
export interface CloneOptions {
|
export interface CloneOptions {
|
||||||
ignoreElements?: (element: Element) => boolean;
|
ignoreElements?: (element: Element) => boolean;
|
||||||
onclone?: (document: Document, element: HTMLElement) => void;
|
onclone?: (document: Document, element: HTMLElement) => void;
|
||||||
|
allowTaint?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WindowOptions {
|
export interface WindowOptions {
|
||||||
@ -135,6 +137,9 @@ export class DocumentCloner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createElementClone<T extends HTMLElement | SVGElement>(node: T): HTMLElement | SVGElement {
|
createElementClone<T extends HTMLElement | SVGElement>(node: T): HTMLElement | SVGElement {
|
||||||
|
if (isDebugging(node, DebuggerType.CLONE)) {
|
||||||
|
debugger;
|
||||||
|
}
|
||||||
if (isCanvasElement(node)) {
|
if (isCanvasElement(node)) {
|
||||||
return this.createCanvasClone(node);
|
return this.createCanvasClone(node);
|
||||||
}
|
}
|
||||||
@ -189,7 +194,7 @@ export class DocumentCloner {
|
|||||||
img.src = canvas.toDataURL();
|
img.src = canvas.toDataURL();
|
||||||
return img;
|
return img;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.context.logger.info(`Unable to clone canvas contents, canvas is tainted`);
|
this.context.logger.info(`Unable to inline canvas contents, canvas is tainted`, canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,14 +206,27 @@ export class DocumentCloner {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
const clonedCtx = clonedCanvas.getContext('2d');
|
const clonedCtx = clonedCanvas.getContext('2d');
|
||||||
if (clonedCtx) {
|
if (clonedCtx) {
|
||||||
if (ctx) {
|
if (!this.options.allowTaint && ctx) {
|
||||||
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
|
clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
|
||||||
} else {
|
} else {
|
||||||
|
const gl = canvas.getContext('webgl2') ?? canvas.getContext('webgl');
|
||||||
|
if (gl) {
|
||||||
|
const attribs = gl.getContextAttributes();
|
||||||
|
if (attribs?.preserveDrawingBuffer === false) {
|
||||||
|
this.context.logger.warn(
|
||||||
|
'Unable to clone WebGL context as it has preserveDrawingBuffer=false',
|
||||||
|
canvas
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clonedCtx.drawImage(canvas, 0, 0);
|
clonedCtx.drawImage(canvas, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return clonedCanvas;
|
return clonedCanvas;
|
||||||
} catch (e) {}
|
} catch (e) {
|
||||||
|
this.context.logger.info(`Unable to clone canvas as it is tainted`, canvas);
|
||||||
|
}
|
||||||
|
|
||||||
return clonedCanvas;
|
return clonedCanvas;
|
||||||
}
|
}
|
||||||
@ -226,6 +244,7 @@ export class DocumentCloner {
|
|||||||
|
|
||||||
if (window && isElementNode(node) && (isHTMLElementNode(node) || isSVGElementNode(node))) {
|
if (window && isElementNode(node) && (isHTMLElementNode(node) || isSVGElementNode(node))) {
|
||||||
const clone = this.createElementClone(node);
|
const clone = this.createElementClone(node);
|
||||||
|
clone.style.transitionProperty = 'none';
|
||||||
|
|
||||||
const style = window.getComputedStyle(node);
|
const style = window.getComputedStyle(node);
|
||||||
const styleBefore = window.getComputedStyle(node, ':before');
|
const styleBefore = window.getComputedStyle(node, ':before');
|
||||||
|
@ -3,29 +3,44 @@ import {TextContainer} from './text-container';
|
|||||||
import {Bounds, parseBounds} from '../css/layout/bounds';
|
import {Bounds, parseBounds} from '../css/layout/bounds';
|
||||||
import {isHTMLElementNode} from './node-parser';
|
import {isHTMLElementNode} from './node-parser';
|
||||||
import {Context} from '../core/context';
|
import {Context} from '../core/context';
|
||||||
|
import {DebuggerType, isDebugging} from '../core/debugger';
|
||||||
|
|
||||||
export const enum FLAGS {
|
export const enum FLAGS {
|
||||||
CREATES_STACKING_CONTEXT = 1 << 1,
|
CREATES_STACKING_CONTEXT = 1 << 1,
|
||||||
CREATES_REAL_STACKING_CONTEXT = 1 << 2,
|
CREATES_REAL_STACKING_CONTEXT = 1 << 2,
|
||||||
IS_LIST_OWNER = 1 << 3
|
IS_LIST_OWNER = 1 << 3,
|
||||||
|
DEBUG_RENDER = 1 << 4
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ElementContainer {
|
export class ElementContainer {
|
||||||
readonly styles: CSSParsedDeclaration;
|
readonly styles: CSSParsedDeclaration;
|
||||||
readonly textNodes: TextContainer[];
|
readonly textNodes: TextContainer[] = [];
|
||||||
readonly elements: ElementContainer[];
|
readonly elements: ElementContainer[] = [];
|
||||||
bounds: Bounds;
|
bounds: Bounds;
|
||||||
flags: number;
|
flags = 0;
|
||||||
|
|
||||||
constructor(protected readonly context: Context, element: Element) {
|
constructor(protected readonly context: Context, element: Element) {
|
||||||
this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
|
if (isDebugging(element, DebuggerType.PARSE)) {
|
||||||
this.textNodes = [];
|
debugger;
|
||||||
this.elements = [];
|
|
||||||
if (this.styles.transform !== null && isHTMLElementNode(element)) {
|
|
||||||
// getBoundingClientRect takes transforms into account
|
|
||||||
element.style.transform = 'none';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
|
||||||
|
|
||||||
|
if (isHTMLElementNode(element)) {
|
||||||
|
if (this.styles.animationDuration.some((duration) => duration > 0)) {
|
||||||
|
element.style.animationDuration = '0s';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.styles.transform !== null) {
|
||||||
|
// getBoundingClientRect takes transforms into account
|
||||||
|
element.style.transform = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.bounds = parseBounds(this.context, element);
|
this.bounds = parseBounds(this.context, element);
|
||||||
this.flags = 0;
|
|
||||||
|
if (isDebugging(element, DebuggerType.RENDER)) {
|
||||||
|
this.flags |= FLAGS.DEBUG_RENDER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@ const renderElement = async (element: HTMLElement, opts: Partial<Options>): Prom
|
|||||||
const foreignObjectRendering = opts.foreignObjectRendering ?? false;
|
const foreignObjectRendering = opts.foreignObjectRendering ?? false;
|
||||||
|
|
||||||
const cloneOptions: CloneConfigurations = {
|
const cloneOptions: CloneConfigurations = {
|
||||||
|
allowTaint: opts.allowTaint ?? false,
|
||||||
onclone: opts.onclone,
|
onclone: opts.onclone,
|
||||||
ignoreElements: opts.ignoreElements,
|
ignoreElements: opts.ignoreElements,
|
||||||
inlineImages: foreignObjectRendering,
|
inlineImages: foreignObjectRendering,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {ElementPaint, parseStackingContexts, StackingContext} from '../stacking-context';
|
import {ElementPaint, parseStackingContexts, StackingContext} from '../stacking-context';
|
||||||
import {asString, Color, isTransparent} from '../../css/types/color';
|
import {asString, Color, isTransparent} from '../../css/types/color';
|
||||||
import {ElementContainer} from '../../dom/element-container';
|
import {ElementContainer, FLAGS} from '../../dom/element-container';
|
||||||
import {BORDER_STYLE} from '../../css/property-descriptors/border-style';
|
import {BORDER_STYLE} from '../../css/property-descriptors/border-style';
|
||||||
import {CSSParsedDeclaration} from '../../css/index';
|
import {CSSParsedDeclaration} from '../../css/index';
|
||||||
import {TextContainer} from '../../dom/text-container';
|
import {TextContainer} from '../../dom/text-container';
|
||||||
@ -19,7 +19,6 @@ import {
|
|||||||
import {calculateBackgroundRendering, getBackgroundValueForIndex} from '../background';
|
import {calculateBackgroundRendering, getBackgroundValueForIndex} from '../background';
|
||||||
import {isDimensionToken} from '../../css/syntax/parser';
|
import {isDimensionToken} from '../../css/syntax/parser';
|
||||||
import {TextBounds} from '../../css/layout/text';
|
import {TextBounds} from '../../css/layout/text';
|
||||||
import {fromCodePoint, toCodePoints} from 'css-line-break';
|
|
||||||
import {ImageElementContainer} from '../../dom/replaced-elements/image-element-container';
|
import {ImageElementContainer} from '../../dom/replaced-elements/image-element-container';
|
||||||
import {contentBox} from '../box-sizing';
|
import {contentBox} from '../box-sizing';
|
||||||
import {CanvasElementContainer} from '../../dom/replaced-elements/canvas-element-container';
|
import {CanvasElementContainer} from '../../dom/replaced-elements/canvas-element-container';
|
||||||
@ -44,6 +43,8 @@ import {TextShadow} from '../../css/property-descriptors/text-shadow';
|
|||||||
import {PAINT_ORDER_LAYER} from '../../css/property-descriptors/paint-order';
|
import {PAINT_ORDER_LAYER} from '../../css/property-descriptors/paint-order';
|
||||||
import {Renderer} from '../renderer';
|
import {Renderer} from '../renderer';
|
||||||
import {Context} from '../../core/context';
|
import {Context} from '../../core/context';
|
||||||
|
import {DIRECTION} from '../../css/property-descriptors/direction';
|
||||||
|
import {splitGraphemes} from 'text-segmentation';
|
||||||
|
|
||||||
export type RenderConfigurations = RenderOptions & {
|
export type RenderConfigurations = RenderOptions & {
|
||||||
backgroundColor: Color | null;
|
backgroundColor: Color | null;
|
||||||
@ -86,12 +87,12 @@ export class CanvasRenderer extends Renderer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyEffects(effects: IElementEffect[], target: EffectTarget): void {
|
applyEffects(effects: IElementEffect[]): void {
|
||||||
while (this._activeEffects.length) {
|
while (this._activeEffects.length) {
|
||||||
this.popEffect();
|
this.popEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
effects.filter((effect) => contains(effect.target, target)).forEach((effect) => this.applyEffect(effect));
|
effects.forEach((effect) => this.applyEffect(effect));
|
||||||
}
|
}
|
||||||
|
|
||||||
applyEffect(effect: IElementEffect): void {
|
applyEffect(effect: IElementEffect): void {
|
||||||
@ -134,6 +135,10 @@ export class CanvasRenderer extends Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async renderNode(paint: ElementPaint): Promise<void> {
|
async renderNode(paint: ElementPaint): Promise<void> {
|
||||||
|
if (contains(paint.container.flags, FLAGS.DEBUG_RENDER)) {
|
||||||
|
debugger;
|
||||||
|
}
|
||||||
|
|
||||||
if (paint.container.styles.isVisible()) {
|
if (paint.container.styles.isVisible()) {
|
||||||
await this.renderNodeBackgroundAndBorders(paint);
|
await this.renderNodeBackgroundAndBorders(paint);
|
||||||
await this.renderNodeContent(paint);
|
await this.renderNodeContent(paint);
|
||||||
@ -144,7 +149,7 @@ export class CanvasRenderer extends Renderer {
|
|||||||
if (letterSpacing === 0) {
|
if (letterSpacing === 0) {
|
||||||
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
|
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
|
||||||
} else {
|
} else {
|
||||||
const letters = toCodePoints(text.text).map((i) => fromCodePoint(i));
|
const letters = splitGraphemes(text.text);
|
||||||
letters.reduce((left, letter) => {
|
letters.reduce((left, letter) => {
|
||||||
this.ctx.fillText(letter, left, text.bounds.top + baseline);
|
this.ctx.fillText(letter, left, text.bounds.top + baseline);
|
||||||
|
|
||||||
@ -157,7 +162,7 @@ export class CanvasRenderer extends Renderer {
|
|||||||
const fontVariant = styles.fontVariant
|
const fontVariant = styles.fontVariant
|
||||||
.filter((variant) => variant === 'normal' || variant === 'small-caps')
|
.filter((variant) => variant === 'normal' || variant === 'small-caps')
|
||||||
.join('');
|
.join('');
|
||||||
const fontFamily = styles.fontFamily.join(', ');
|
const fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
|
||||||
const fontSize = isDimensionToken(styles.fontSize)
|
const fontSize = isDimensionToken(styles.fontSize)
|
||||||
? `${styles.fontSize.number}${styles.fontSize.unit}`
|
? `${styles.fontSize.number}${styles.fontSize.unit}`
|
||||||
: `${styles.fontSize.number}px`;
|
: `${styles.fontSize.number}px`;
|
||||||
@ -174,6 +179,8 @@ export class CanvasRenderer extends Renderer {
|
|||||||
|
|
||||||
this.ctx.font = font;
|
this.ctx.font = font;
|
||||||
|
|
||||||
|
this.ctx.direction = styles.direction === DIRECTION.RTL ? 'rtl' : 'ltr';
|
||||||
|
this.ctx.textAlign = 'left';
|
||||||
this.ctx.textBaseline = 'alphabetic';
|
this.ctx.textBaseline = 'alphabetic';
|
||||||
const {baseline, middle} = this.fontMetrics.getMetrics(fontFamily, fontSize);
|
const {baseline, middle} = this.fontMetrics.getMetrics(fontFamily, fontSize);
|
||||||
const paintOrder = styles.paintOrder;
|
const paintOrder = styles.paintOrder;
|
||||||
@ -286,7 +293,7 @@ export class CanvasRenderer extends Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async renderNodeContent(paint: ElementPaint): Promise<void> {
|
async renderNodeContent(paint: ElementPaint): Promise<void> {
|
||||||
this.applyEffects(paint.effects, EffectTarget.CONTENT);
|
this.applyEffects(paint.getEffects(EffectTarget.CONTENT));
|
||||||
const container = paint.container;
|
const container = paint.container;
|
||||||
const curves = paint.curves;
|
const curves = paint.curves;
|
||||||
const styles = container.styles;
|
const styles = container.styles;
|
||||||
@ -465,6 +472,9 @@ export class CanvasRenderer extends Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async renderStackContent(stack: StackingContext): Promise<void> {
|
async renderStackContent(stack: StackingContext): Promise<void> {
|
||||||
|
if (contains(stack.element.container.flags, FLAGS.DEBUG_RENDER)) {
|
||||||
|
debugger;
|
||||||
|
}
|
||||||
// https://www.w3.org/TR/css-position-3/#painting-order
|
// https://www.w3.org/TR/css-position-3/#painting-order
|
||||||
// 1. the background and borders of the element forming the stacking context.
|
// 1. the background and borders of the element forming the stacking context.
|
||||||
await this.renderNodeBackgroundAndBorders(stack.element);
|
await this.renderNodeBackgroundAndBorders(stack.element);
|
||||||
@ -682,7 +692,7 @@ export class CanvasRenderer extends Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async renderNodeBackgroundAndBorders(paint: ElementPaint): Promise<void> {
|
async renderNodeBackgroundAndBorders(paint: ElementPaint): Promise<void> {
|
||||||
this.applyEffects(paint.effects, EffectTarget.BACKGROUND_BORDERS);
|
this.applyEffects(paint.getEffects(EffectTarget.BACKGROUND_BORDERS));
|
||||||
const styles = paint.container.styles;
|
const styles = paint.container.styles;
|
||||||
const hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
|
const hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
|
||||||
|
|
||||||
@ -896,7 +906,7 @@ export class CanvasRenderer extends Renderer {
|
|||||||
const stack = parseStackingContexts(element);
|
const stack = parseStackingContexts(element);
|
||||||
|
|
||||||
await this.renderStack(stack);
|
await this.renderStack(stack);
|
||||||
this.applyEffects([], EffectTarget.BACKGROUND_BORDERS);
|
this.applyEffects([]);
|
||||||
return this.canvas;
|
return this.canvas;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -937,3 +947,12 @@ const canvasTextAlign = (textAlign: TEXT_ALIGN): CanvasTextAlign => {
|
|||||||
return 'left';
|
return 'left';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// see https://github.com/niklasvh/html2canvas/pull/2645
|
||||||
|
const iOSBrokenFonts = ['-apple-system', 'system-ui'];
|
||||||
|
|
||||||
|
const fixIOSSystemFonts = (fontFamilies: string[]): string[] => {
|
||||||
|
return /iPhone OS 15_(0|1)/.test(window.navigator.userAgent)
|
||||||
|
? fontFamilies.filter((fontFamily) => iOSBrokenFonts.indexOf(fontFamily) === -1)
|
||||||
|
: fontFamilies;
|
||||||
|
};
|
||||||
|
@ -20,36 +20,21 @@ export interface IElementEffect {
|
|||||||
export class TransformEffect implements IElementEffect {
|
export class TransformEffect implements IElementEffect {
|
||||||
readonly type: EffectType = EffectType.TRANSFORM;
|
readonly type: EffectType = EffectType.TRANSFORM;
|
||||||
readonly target: number = EffectTarget.BACKGROUND_BORDERS | EffectTarget.CONTENT;
|
readonly target: number = EffectTarget.BACKGROUND_BORDERS | EffectTarget.CONTENT;
|
||||||
readonly offsetX: number;
|
|
||||||
readonly offsetY: number;
|
|
||||||
readonly matrix: Matrix;
|
|
||||||
|
|
||||||
constructor(offsetX: number, offsetY: number, matrix: Matrix) {
|
constructor(readonly offsetX: number, readonly offsetY: number, readonly matrix: Matrix) {}
|
||||||
this.offsetX = offsetX;
|
|
||||||
this.offsetY = offsetY;
|
|
||||||
this.matrix = matrix;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ClipEffect implements IElementEffect {
|
export class ClipEffect implements IElementEffect {
|
||||||
readonly type: EffectType = EffectType.CLIP;
|
readonly type: EffectType = EffectType.CLIP;
|
||||||
readonly target: number;
|
|
||||||
readonly path: Path[];
|
|
||||||
|
|
||||||
constructor(path: Path[], target: EffectTarget) {
|
constructor(readonly path: Path[], readonly target: EffectTarget) {}
|
||||||
this.target = target;
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OpacityEffect implements IElementEffect {
|
export class OpacityEffect implements IElementEffect {
|
||||||
readonly type: EffectType = EffectType.OPACITY;
|
readonly type: EffectType = EffectType.OPACITY;
|
||||||
readonly target: number = EffectTarget.BACKGROUND_BORDERS | EffectTarget.CONTENT;
|
readonly target: number = EffectTarget.BACKGROUND_BORDERS | EffectTarget.CONTENT;
|
||||||
readonly opacity: number;
|
|
||||||
|
|
||||||
constructor(opacity: number) {
|
constructor(readonly opacity: number) {}
|
||||||
this.opacity = opacity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isTransformEffect = (effect: IElementEffect): effect is TransformEffect =>
|
export const isTransformEffect = (effect: IElementEffect): effect is TransformEffect =>
|
||||||
|
@ -27,6 +27,7 @@ export class FontMetrics {
|
|||||||
container.style.fontSize = fontSize;
|
container.style.fontSize = fontSize;
|
||||||
container.style.margin = '0';
|
container.style.margin = '0';
|
||||||
container.style.padding = '0';
|
container.style.padding = '0';
|
||||||
|
container.style.whiteSpace = 'nowrap';
|
||||||
|
|
||||||
body.appendChild(container);
|
body.appendChild(container);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {BezierCurve} from './bezier-curve';
|
import {BezierCurve} from './bezier-curve';
|
||||||
import {Vector} from './vector';
|
import {Vector} from './vector';
|
||||||
export enum PathType {
|
export const enum PathType {
|
||||||
VECTOR = 0,
|
VECTOR = 0,
|
||||||
BEZIER_CURVE = 1
|
BEZIER_CURVE = 1
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import {ElementContainer, FLAGS} from '../dom/element-container';
|
import {ElementContainer, FLAGS} from '../dom/element-container';
|
||||||
import {contains} from '../core/bitwise';
|
import {contains} from '../core/bitwise';
|
||||||
import {BoundCurves, calculateBorderBoxPath, calculatePaddingBoxPath} from './bound-curves';
|
import {BoundCurves, calculateBorderBoxPath, calculatePaddingBoxPath} from './bound-curves';
|
||||||
import {ClipEffect, EffectTarget, IElementEffect, OpacityEffect, TransformEffect} from './effects';
|
import {ClipEffect, EffectTarget, IElementEffect, isClipEffect, OpacityEffect, TransformEffect} from './effects';
|
||||||
import {OVERFLOW} from '../css/property-descriptors/overflow';
|
import {OVERFLOW} from '../css/property-descriptors/overflow';
|
||||||
import {equalPath} from './path';
|
import {equalPath} from './path';
|
||||||
import {DISPLAY} from '../css/property-descriptors/display';
|
import {DISPLAY} from '../css/property-descriptors/display';
|
||||||
import {OLElementContainer} from '../dom/elements/ol-element-container';
|
import {OLElementContainer} from '../dom/elements/ol-element-container';
|
||||||
import {LIElementContainer} from '../dom/elements/li-element-container';
|
import {LIElementContainer} from '../dom/elements/li-element-container';
|
||||||
import {createCounterText} from '../css/types/functions/counter';
|
import {createCounterText} from '../css/types/functions/counter';
|
||||||
|
import {POSITION} from '../css/property-descriptors/position';
|
||||||
|
|
||||||
export class StackingContext {
|
export class StackingContext {
|
||||||
element: ElementPaint;
|
element: ElementPaint;
|
||||||
@ -32,27 +33,24 @@ export class StackingContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ElementPaint {
|
export class ElementPaint {
|
||||||
container: ElementContainer;
|
readonly effects: IElementEffect[] = [];
|
||||||
effects: IElementEffect[];
|
readonly curves: BoundCurves;
|
||||||
curves: BoundCurves;
|
|
||||||
listValue?: string;
|
listValue?: string;
|
||||||
|
|
||||||
constructor(element: ElementContainer, parentStack: IElementEffect[]) {
|
constructor(readonly container: ElementContainer, readonly parent: ElementPaint | null) {
|
||||||
this.container = element;
|
this.curves = new BoundCurves(this.container);
|
||||||
this.effects = parentStack.slice(0);
|
if (this.container.styles.opacity < 1) {
|
||||||
this.curves = new BoundCurves(element);
|
this.effects.push(new OpacityEffect(this.container.styles.opacity));
|
||||||
if (element.styles.opacity < 1) {
|
|
||||||
this.effects.push(new OpacityEffect(element.styles.opacity));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.styles.transform !== null) {
|
if (this.container.styles.transform !== null) {
|
||||||
const offsetX = element.bounds.left + element.styles.transformOrigin[0].number;
|
const offsetX = this.container.bounds.left + this.container.styles.transformOrigin[0].number;
|
||||||
const offsetY = element.bounds.top + element.styles.transformOrigin[1].number;
|
const offsetY = this.container.bounds.top + this.container.styles.transformOrigin[1].number;
|
||||||
const matrix = element.styles.transform;
|
const matrix = this.container.styles.transform;
|
||||||
this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
|
this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.styles.overflowX !== OVERFLOW.VISIBLE) {
|
if (this.container.styles.overflowX !== OVERFLOW.VISIBLE) {
|
||||||
const borderBox = calculateBorderBoxPath(this.curves);
|
const borderBox = calculateBorderBoxPath(this.curves);
|
||||||
const paddingBox = calculatePaddingBoxPath(this.curves);
|
const paddingBox = calculatePaddingBoxPath(this.curves);
|
||||||
|
|
||||||
@ -65,16 +63,32 @@ export class ElementPaint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getParentEffects(): IElementEffect[] {
|
getEffects(target: EffectTarget): IElementEffect[] {
|
||||||
|
let inFlow = [POSITION.ABSOLUTE, POSITION.FIXED].indexOf(this.container.styles.position) === -1;
|
||||||
|
let parent = this.parent;
|
||||||
const effects = this.effects.slice(0);
|
const effects = this.effects.slice(0);
|
||||||
if (this.container.styles.overflowX !== OVERFLOW.VISIBLE) {
|
while (parent) {
|
||||||
const borderBox = calculateBorderBoxPath(this.curves);
|
const croplessEffects = parent.effects.filter((effect) => !isClipEffect(effect));
|
||||||
const paddingBox = calculatePaddingBoxPath(this.curves);
|
if (inFlow || parent.container.styles.position !== POSITION.STATIC || !parent.parent) {
|
||||||
if (!equalPath(borderBox, paddingBox)) {
|
effects.unshift(...croplessEffects);
|
||||||
effects.push(new ClipEffect(paddingBox, EffectTarget.BACKGROUND_BORDERS | EffectTarget.CONTENT));
|
inFlow = [POSITION.ABSOLUTE, POSITION.FIXED].indexOf(parent.container.styles.position) === -1;
|
||||||
|
if (parent.container.styles.overflowX !== OVERFLOW.VISIBLE) {
|
||||||
|
const borderBox = calculateBorderBoxPath(parent.curves);
|
||||||
|
const paddingBox = calculatePaddingBoxPath(parent.curves);
|
||||||
|
if (!equalPath(borderBox, paddingBox)) {
|
||||||
|
effects.unshift(
|
||||||
|
new ClipEffect(paddingBox, EffectTarget.BACKGROUND_BORDERS | EffectTarget.CONTENT)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
effects.unshift(...croplessEffects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parent = parent.parent;
|
||||||
}
|
}
|
||||||
return effects;
|
|
||||||
|
return effects.filter((effect) => contains(effect.target, target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +101,7 @@ const parseStackTree = (
|
|||||||
parent.container.elements.forEach((child) => {
|
parent.container.elements.forEach((child) => {
|
||||||
const treatAsRealStackingContext = contains(child.flags, FLAGS.CREATES_REAL_STACKING_CONTEXT);
|
const treatAsRealStackingContext = contains(child.flags, FLAGS.CREATES_REAL_STACKING_CONTEXT);
|
||||||
const createsStackingContext = contains(child.flags, FLAGS.CREATES_STACKING_CONTEXT);
|
const createsStackingContext = contains(child.flags, FLAGS.CREATES_STACKING_CONTEXT);
|
||||||
const paintContainer = new ElementPaint(child, parent.getParentEffects());
|
const paintContainer = new ElementPaint(child, parent);
|
||||||
if (contains(child.styles.display, DISPLAY.LIST_ITEM)) {
|
if (contains(child.styles.display, DISPLAY.LIST_ITEM)) {
|
||||||
listItems.push(paintContainer);
|
listItems.push(paintContainer);
|
||||||
}
|
}
|
||||||
@ -182,7 +196,7 @@ const processListItems = (owner: ElementContainer, elements: ElementPaint[]) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const parseStackingContexts = (container: ElementContainer): StackingContext => {
|
export const parseStackingContexts = (container: ElementContainer): StackingContext => {
|
||||||
const paintContainer = new ElementPaint(container, []);
|
const paintContainer = new ElementPaint(container, null);
|
||||||
const root = new StackingContext(paintContainer);
|
const root = new StackingContext(paintContainer);
|
||||||
const listItems: ElementPaint[] = [];
|
const listItems: ElementPaint[] = [];
|
||||||
parseStackTree(paintContainer, root, root, listItems);
|
parseStackTree(paintContainer, root, root, listItems);
|
||||||
|
@ -5,46 +5,93 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<script type="text/javascript" src="../test.js"></script>
|
<script type="text/javascript" src="../test.js"></script>
|
||||||
<style>
|
<style>
|
||||||
span {
|
|
||||||
color:blue;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
background-color: green;
|
|
||||||
}
|
|
||||||
div {
|
|
||||||
background: red;
|
|
||||||
border: 5px solid blue;
|
|
||||||
animation: spin 3s linear 1s infinite;
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes spin {
|
@keyframes rotate0 {
|
||||||
0% {
|
0% {
|
||||||
-webkit-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
/* Firefox 16+, IE 10+, Opera */ }
|
}
|
||||||
100% {
|
}
|
||||||
-webkit-transform: rotate(360deg);
|
|
||||||
transform: rotate(360deg);
|
|
||||||
/* Firefox 16+, IE 10+, Opera */ } }
|
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes rotate45 {
|
||||||
0% {
|
0% {
|
||||||
-webkit-transform: rotate(0deg);
|
transform: rotate(45deg);
|
||||||
transform: rotate(0deg);
|
}
|
||||||
/* Firefox 16+, IE 10+, Opera */ }
|
}
|
||||||
100% {
|
|
||||||
-webkit-transform: rotate(360deg);
|
p {
|
||||||
transform: rotate(360deg);
|
font: 22px/1 Arial, sans-serif;
|
||||||
/* Firefox 16+, IE 10+, Opera */ } }
|
position: absolute;
|
||||||
|
top: 25%;
|
||||||
|
left: 25%;
|
||||||
|
width: 50%;
|
||||||
|
height: 50%;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #666;
|
||||||
|
line-height: 90px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transformed.working p {
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.animated.working p {
|
||||||
|
animation-name: rotate0;
|
||||||
|
animation-duration: 1ms, 1ms;
|
||||||
|
animation-play-state: paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animated.broken p {
|
||||||
|
animation-name: rotate45;
|
||||||
|
animation-duration: 1ms;
|
||||||
|
animation-play-state: paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transitioned p {
|
||||||
|
transition: 1ms, 1ms;
|
||||||
|
transform: rotate(45deg)
|
||||||
|
}
|
||||||
|
|
||||||
|
.transition-delay {
|
||||||
|
transition: 1ms;
|
||||||
|
transition-delay: 50ms;
|
||||||
|
transform: rotate(45deg)
|
||||||
|
}
|
||||||
|
|
||||||
|
div {
|
||||||
|
float: left;
|
||||||
|
clear: left;
|
||||||
|
margin-right: 10px;
|
||||||
|
background-color: #ccc;
|
||||||
|
width: 180px;
|
||||||
|
height: 180px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div style="clip: rect(0px, 400px, 50px, 200px); ">Some inline text <span> followed by text in span </span> followed by more inline text.
|
<div class="transformed working">
|
||||||
<p>Then a block level element.</p>
|
<p>Hello</p>
|
||||||
Then more inline text.</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="animated working">
|
||||||
|
<p>Hello</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="animated broken">
|
||||||
|
<p>Hello</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="transitioned broken">
|
||||||
|
<p>Hello</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="transition-delay">
|
||||||
|
<p>Hello</p>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -51,6 +51,9 @@
|
|||||||
.scroll {
|
.scroll {
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
.clip {
|
||||||
|
overflow: clip;
|
||||||
|
}
|
||||||
.auto {
|
.auto {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
@ -70,6 +73,10 @@
|
|||||||
scroll
|
scroll
|
||||||
<p class="scroll">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
|
<p class="scroll">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cell">
|
||||||
|
clip
|
||||||
|
<p class="clip">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
|
||||||
|
</div>
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
auto
|
auto
|
||||||
<p class="auto">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
|
<p class="auto">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus pretium facilisis. Praesent rutrum eget nisl in tristique. Sed tincidunt nisl et tellus vulputate, nec rhoncus orci pretium.</p>
|
||||||
@ -129,5 +136,17 @@
|
|||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden">Hidden<div style="opacity: 0.5">With opacity</div></div>
|
<div class="hidden">Hidden<div style="opacity: 0.5">With opacity</div></div>
|
||||||
|
<div class="hidden" style="height: 0px; width: 50px;">
|
||||||
|
<div style="position: absolute; width: 50px; height: 50px; left:400px;">absolute on static parent</div>
|
||||||
|
</div>
|
||||||
|
<div class="hidden" style="height: 0px; width: 50px;">
|
||||||
|
<div style="position: relative; width: 10px; height: 10px; left:400px;">relative on static parent</div>
|
||||||
|
</div>
|
||||||
|
<div class="hidden" style="height: 0px; width: 50px;">
|
||||||
|
<div style="position: fixed; width: 50px; height: 50px; left:400px; top:0;">fixed on static parent</div>
|
||||||
|
</div>
|
||||||
|
<div class="hidden" style="height: 0px; width: 50px;position: relative;">
|
||||||
|
<div style="position: absolute; width: 10px; height: 10px; left:400px;">absolute on relative parent</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -86,6 +86,20 @@
|
|||||||
of the section counter, separated
|
of the section counter, separated
|
||||||
by a period */
|
by a period */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.issue-2639 {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.issue-2639::before {
|
||||||
|
content: counter(ol0) '. ';
|
||||||
|
counter-increment: ol0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.issue-2639:first-child {
|
||||||
|
counter-reset: ol0;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -163,5 +177,10 @@
|
|||||||
<li>item</li> <!-- 2 -->
|
<li>item</li> <!-- 2 -->
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li class="issue-2639">one</li>
|
||||||
|
<li class="issue-2639">two</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -11,6 +11,13 @@
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.apple-system {
|
||||||
|
font-family: -apple-system, Arial;
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-ui {
|
||||||
|
font-family: system-ui, Arial;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -32,5 +39,7 @@
|
|||||||
</p><p> 〔13〕 法捷耶夫(一九○一——一九五六),苏联名作家。他所作的小说《毁灭》于一九二七年出版,内容是描写苏联国内战争时期由苏联远东滨海边区工人、农民和革命知识分子所组成的一支游击队同国内反革命白卫军以及日本武装干涉军进行斗争的故事。这部小说曾由鲁迅译为汉文。
|
</p><p> 〔13〕 法捷耶夫(一九○一——一九五六),苏联名作家。他所作的小说《毁灭》于一九二七年出版,内容是描写苏联国内战争时期由苏联远东滨海边区工人、农民和革命知识分子所组成的一支游击队同国内反革命白卫军以及日本武装干涉军进行斗争的故事。这部小说曾由鲁迅译为汉文。
|
||||||
</p><p> 〔14〕 见鲁迅《集外集·自嘲》(《鲁迅全集》第7卷,人民文学出版社1981年版,第147页)。</p>
|
</p><p> 〔14〕 见鲁迅《集外集·自嘲》(《鲁迅全集》第7卷,人民文学出版社1981年版,第147页)。</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="apple-system">中文</div>
|
||||||
|
<div class="system-ui">中文</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -149,5 +149,6 @@
|
|||||||
<span>[AB / CD]</span>
|
<span>[AB / CD]</span>
|
||||||
</div>
|
</div>
|
||||||
<div>Emojis 🤷🏾♂️👨👩👧👦 :)</div>
|
<div>Emojis 🤷🏾♂️👨👩👧👦 :)</div>
|
||||||
|
<div style="letter-spacing: 2px">Emojis with letter-spacing 🤷🏾♂️👨👩👧👦 :) ❤️❤️❤️👨❤️💋👨👨❤️👨</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
2
www/.gitignore
vendored
2
www/.gitignore
vendored
@ -9,3 +9,5 @@ yarn-error.log
|
|||||||
src/results.json
|
src/results.json
|
||||||
static/tests/preview.js
|
static/tests/preview.js
|
||||||
src/preview.js
|
src/preview.js
|
||||||
|
.docusaurus
|
||||||
|
build/
|
||||||
|
@ -32,8 +32,10 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "n/a",
|
"main": "n/a",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"copybuild": "mkdirp public/dist && cpy ../dist/*.js public/dist",
|
"copy:build": "mkdirp public/dist && cpy ../dist/*.js public/dist",
|
||||||
"build": "npm run copybuild && gatsby build",
|
"copy:src": "mkdirp public/src && cpy ../src/**/*.ts public/src --parents",
|
||||||
|
"copy": "npm run copy:build && npm run copy:src",
|
||||||
|
"build": "npm run copy && gatsby build",
|
||||||
"start": "gatsby develop",
|
"start": "gatsby develop",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user