react-screenshots 0.5.9 → 0.5.15
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.
- package/LICENSE +21 -21
- package/README.md +145 -145
- package/electron/assets/index.7793f29e.js +222 -0
- package/electron/assets/{index.95e77ee2.css → index.78c5dcbf.css} +1 -1
- package/electron/electron.html +14 -15
- package/lib/react-screenshots.cjs.js +4 -4
- package/lib/react-screenshots.es.js +188 -190
- package/lib/style.css +1 -1
- package/lib/types/ScreenshotsBackground/getBoundsByPoints.d.ts +2 -2
- package/lib/types/ScreenshotsBackground/index.d.ts +4 -4
- package/lib/types/ScreenshotsButton/index.d.ts +12 -12
- package/lib/types/ScreenshotsCanvas/getBoundsByPoints.d.ts +2 -2
- package/lib/types/ScreenshotsCanvas/getPoints.d.ts +2 -2
- package/lib/types/ScreenshotsCanvas/index.d.ts +15 -15
- package/lib/types/ScreenshotsCanvas/isPointInDraw.d.ts +2 -2
- package/lib/types/ScreenshotsColor/index.d.ts +8 -8
- package/lib/types/ScreenshotsContext.d.ts +29 -29
- package/lib/types/ScreenshotsMagnifier/index.d.ts +8 -8
- package/lib/types/ScreenshotsOperations/index.d.ts +6 -6
- package/lib/types/ScreenshotsOption/index.d.ts +15 -15
- package/lib/types/ScreenshotsSize/index.d.ts +8 -8
- package/lib/types/ScreenshotsSizeColor/index.d.ts +10 -10
- package/lib/types/ScreenshotsTextarea/calculateNodeSize.d.ts +17 -17
- package/lib/types/ScreenshotsTextarea/index.d.ts +15 -15
- package/lib/types/composeImage.d.ts +10 -10
- package/lib/types/exports.d.ts +3 -3
- package/lib/types/hooks/useBounds.d.ts +7 -7
- package/lib/types/hooks/useCall.d.ts +2 -2
- package/lib/types/hooks/useCanvasContextRef.d.ts +2 -2
- package/lib/types/hooks/useCanvasMousedown.d.ts +1 -1
- package/lib/types/hooks/useCanvasMousemove.d.ts +1 -1
- package/lib/types/hooks/useCanvasMouseup.d.ts +1 -1
- package/lib/types/hooks/useCursor.d.ts +6 -6
- package/lib/types/hooks/useDispatcher.d.ts +2 -2
- package/lib/types/hooks/useDrawSelect.d.ts +2 -2
- package/lib/types/hooks/useEmiter.d.ts +8 -8
- package/lib/types/hooks/useHistory.d.ts +16 -16
- package/lib/types/hooks/useLang.d.ts +2 -2
- package/lib/types/hooks/useOperation.d.ts +6 -6
- package/lib/types/hooks/useReset.d.ts +2 -2
- package/lib/types/hooks/useStore.d.ts +2 -2
- package/lib/types/index.d.ts +13 -13
- package/lib/types/operations/Arrow/draw.d.ts +11 -11
- package/lib/types/operations/Arrow/index.d.ts +22 -22
- package/lib/types/operations/Brush/draw.d.ts +3 -3
- package/lib/types/operations/Brush/index.d.ts +14 -14
- package/lib/types/operations/Cancel/index.d.ts +2 -2
- package/lib/types/operations/Ellipse/draw.d.ts +11 -11
- package/lib/types/operations/Ellipse/index.d.ts +28 -28
- package/lib/types/operations/Mosaic/index.d.ts +11 -11
- package/lib/types/operations/Ok/index.d.ts +2 -2
- package/lib/types/operations/Rectangle/draw.d.ts +11 -11
- package/lib/types/operations/Rectangle/index.d.ts +28 -28
- package/lib/types/operations/Redo/index.d.ts +2 -2
- package/lib/types/operations/Save/index.d.ts +2 -2
- package/lib/types/operations/Text/index.d.ts +22 -22
- package/lib/types/operations/Undo/index.d.ts +2 -2
- package/lib/types/operations/index.d.ts +3 -3
- package/lib/types/operations/utils.d.ts +4 -4
- package/lib/types/types.d.ts +39 -39
- package/lib/types/useGetLoadedImage.d.ts +1 -1
- package/lib/types/zh_CN.d.ts +16 -16
- package/package.json +2 -2
- package/electron/assets/index.c68b977f.js +0 -14
- package/electron/assets/vendor.e3c417b2.js +0 -209
|
@@ -1 +1 @@
|
|
|
1
|
-
@font-face{font-family:screenshots-icon;src:url(data:font/woff2;base64,d09GMgABAAAAAAZYAAsAAAAADKgAAAYKAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDfAqKLIhJATYCJAMwCxoABCAFhUcHgQAb6QrILjGFawcSSC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bgBmAG8AbgB0AHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4AUgBlAGcAdQBsAGEAcgBzAGMAcgBlAGUAbgBzAGgAbwB0AHMALQBpAGMAbwBuAHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4AVgBlAHIAcwBpAG8AbgAgADEALgAwAHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4ARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwBAgEDAQQBBQEGAQcBCAEJAQoBCwEMAQ0ABWFycm93BHNhdmUGbW9zYWljBHJlZG8EdW5kbwdlbGxpcHNlCXJlY3RhbmdsZQR0ZXh0BmNhbmNlbAJvawVicnVzaAAA) format("truetype")}[class^=icon-],[class*=" icon-"]{font-family:screenshots-icon!important;font-style:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-ok:before{content:"\e001"}.icon-cancel:before{content:"\e002"}.icon-save:before{content:"\e003"}.icon-redo:before{content:"\e004"}.icon-undo:before{content:"\e005"}.icon-mosaic:before{content:"\e006"}.icon-text:before{content:"\e007"}.icon-brush:before{content:"\e008"}.icon-arrow:before{content:"\e009"}.icon-ellipse:before{content:"\e00a"}.icon-rectangle:before{content:"\e00b"}.screenshots{position:relative;transform:translateZ(0);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji}.screenshots,.screenshots *{box-sizing:border-box;user-select:none}.screenshots-magnifier{position:absolute;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji;left:0;top:0;width:100px;box-shadow:0 0 8px #000;z-index:9}.screenshots-magnifier,.screenshots-magnifier *{box-sizing:border-box;user-select:none}.screenshots-magnifier-body{position:relative;background-color:#fff}.screenshots-magnifier-body:before{content:"";background-color:#0a72a1;position:absolute;top:50%;left:0;width:100%;height:2px;z-index:1}.screenshots-magnifier-body:after{content:"";background-color:#0a72a1;position:absolute;top:0;left:50%;width:2px;height:100%;z-index:1}.screenshots-magnifier-body-canvas{display:block;width:100px;height:80px}.screenshots-magnifier-footer{height:40px;color:#fff;font-size:11px;background-color:#5f5e5e;padding:4px;white-space:nowrap;overflow:hidden;text-align:center}.screenshots-magnifier-footer-item{height:18px;line-height:18px}.screenshots-background{width:100%;height:100%;position:relative}.screenshots-background-image{width:100%;height:100%;display:block;border:none;outline:none;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;-webkit-font-smooting:antialiased}.screenshots-background-mask{width:100%;height:100%;position:absolute;top:0;right:0;bottom:0;left:0;background-color:#0000004d}.screenshots-canvas{position:absolute;left:0;top:0}.screenshots-canvas-body,.screenshots-canvas-mask{width:100%;height:100%;position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden}.screenshots-canvas-image{width:100%;height:100%;display:block;border:none;outline:none;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;-webkit-font-smooting:antialiased}.screenshots-canvas-panel{position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%}.screenshots-canvas-border-top{position:absolute;left:0;top:0;width:100%;height:2px;transform:translateY(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-right{position:absolute;left:100%;top:0;width:2px;height:100%;transform:translate(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-bottom{position:absolute;left:0;top:100%;width:100%;height:2px;transform:translateY(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-left{position:absolute;left:0;top:0;width:2px;height:100%;transform:translate(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-point-top{width:8px;height:8px;position:absolute;left:50%;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ns-resize}.screenshots-canvas-point-top-right{width:8px;height:8px;position:absolute;left:100%;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nesw-resize}.screenshots-canvas-point-right{width:8px;height:8px;position:absolute;left:100%;top:50%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ew-resize}.screenshots-canvas-point-right-bottom{width:8px;height:8px;position:absolute;left:100%;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nwse-resize}.screenshots-canvas-point-bottom{width:8px;height:8px;position:absolute;left:50%;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ns-resize}.screenshots-canvas-point-bottom-left{width:8px;height:8px;position:absolute;left:0;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nesw-resize}.screenshots-canvas-point-left{width:8px;height:8px;position:absolute;left:0;top:50%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ew-resize}.screenshots-canvas-point-left-top{width:8px;height:8px;position:absolute;left:0;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nwse-resize}.screenshots-option{position:absolute;left:0;top:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji}.screenshots-option,.screenshots-option *{box-sizing:border-box;user-select:none}.screenshots-option-container{height:34px;padding:3px;border-radius:2px;border:1px solid #ddd;background-color:#fff}.screenshots-option-arrow{position:absolute;border:6px solid transparent}.screenshots-option[data-placement=top]{transform:translate(-50%,-11px)}.screenshots-option[data-placement=top] .screenshots-option-arrow{transform:translate(-50%,-1px);border-top-color:#fff;top:100%;left:50%}.screenshots-option[data-placement=bottom]{transform:translate(-50%,11px)}.screenshots-option[data-placement=bottom] .screenshots-option-arrow{transform:translate(-50%,1px);border-bottom-color:#fff;bottom:100%;left:50%}.screenshots-button{width:26px;height:26px;line-height:26px;color:#333;font-size:18px;text-align:center;margin:0 3px;vertical-align:middle;cursor:pointer}.screenshots-button-checked,.screenshots-button:hover{background-color:#eee;outline:1px solid #777}.screenshots-button-disabled{color:#bbb;cursor:not-allowed}.screenshots-button-disabled:hover{background-color:#fff;outline:none}.screenshots-size{height:24px;display:flex;align-items:center}.screenshots-size-item{width:24px;height:24px;position:relative;margin:0 3px;cursor:pointer}.screenshots-size-pointer{background-color:#555;border-radius:50%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.screenshots-size-active>.screenshots-size-pointer{background-color:#39f}.screenshots-color{height:24px;display:flex;align-items:center}.screenshots-color-item{border:1px solid #777;width:24px;height:24px;cursor:pointer;position:relative;margin:0 3px}.screenshots-color-item:before{content:"";display:none;position:absolute;right:0;bottom:0;width:10px;height:10px;background-color:#333}.screenshots-color-item:after{content:"";display:none;width:8px;height:4px;position:absolute;right:5px;bottom:5px;border-bottom:2px solid #fff;border-left:2px solid #fff;transform:translate(5px,2px) rotate(-45deg) scale(.8)}.screenshots-color-active:before,.screenshots-color-active:after{display:block}.screenshots-sizecolor{height:24px;display:flex;align-items:center}.screenshots-textarea{box-sizing:border-box;position:absolute;left:0;top:0;margin:0;padding:0;background-color:transparent;border:2px solid #39f;resize:none;outline:none;white-space:nowrap;word-break:break-all;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji;text-align:left}.screenshots-operations{position:absolute;left:0;top:0}.screenshots-operations-buttons{display:flex;align-items:center;padding:3px;border-radius:2px;border:1px solid #ddd;background-color:#fff;overflow:hidden}.screenshots-operations-divider{background-color:#ddd;width:1px;height:26px;margin:0 3px}html,body,#app{height:100%;margin:0;padding:0;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.body{height:100%}
|
|
1
|
+
@font-face{font-family:screenshots-icon;src:url(data:font/woff2;base64,d09GMgABAAAAAAZYAAsAAAAADKgAAAYKAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDfAqKLIhJATYCJAMwCxoABCAFhUcHgQAb6QrILjGFawcSSCzDZuiIqeA+75Tu1r4heP5fp96nLxkkOwhUmIBwakdUSggj8dSRyDmdmP3/v2e9YsjsOCtlpI68YLtQmt4kZXqSN+LXCmO2C/Fv90v4tUEmt3UrwUwiDCzhRBNKIS+VhIsbwuYpUwbcwRfO/tJ+v6reiDo8hHD/+7ZDTbM3TUTr9w71RhJrhE6IEQ3Y1a4XkvASBDApIh15W/6CFchzGo0tKBgl3FoBs6dM03M0cr5nooeECq4UR9wrdWQNBmhLtTvAavXv5Q0l4gwahoK7T68JeTp02cdnKdtvg3qKvAYBR2uAASggr2bZMim8cAwKvTEPBaZfoZIK0usI+Cz/f/CJbKn35WDiRkPHQOHCasE/nhPEAcceeG5ossAnYhJM8GlJcINPEW6pg1ClAQLSASKedCIdF2yw5C3dSEcgTRBppAUEjjpdEQUiHCTrQDPhAoaRL2jEorpr/QUVkzRNSepUlpwcEID3D4sjwt1DpnpsO4o0e8vw1tFOQoGbT9p6iXL30WON9mrXrRsQ9gbXgGWbZNK5ydUeecktcPmVx2xq2UZo2hoD01uX+a9oHpWpTYeC6zX7QKDarVI12wHVbshETJ4QzRYLAsXyMQU9ThxwwX6sOUg3k23dOo643Xa3Hx9vQ0sbcX/gffrTcHSE4Noa10LLmF0mD/rfY5wbUSC7PwAiskYaj2311zU30Nsu1OlDy9KzHYuW2anTl5aDbJw9U/c0Zno7+sz03HqkYcLNq0vh2+wyw1veaKtmyzFnZq5LfkMAZNpuYhvBQUtAXIYgyruG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AQQJAAoAVgFtAAMAAQQJAAsAJgHDQ3JlYXRlZCBieSBpY29uZm9udHNjcmVlbnNob3RzLWljb25SZWd1bGFyc2NyZWVuc2hvdHMtaWNvbnNjcmVlbnNob3RzLWljb25WZXJzaW9uIDEuMHNjcmVlbnNob3RzLWljb25HZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQBDAHIAZQBhAHQAZQBkACAAYgB5ACAAaQBjAG8AbgBmAG8AbgB0AHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4AUgBlAGcAdQBsAGEAcgBzAGMAcgBlAGUAbgBzAGgAbwB0AHMALQBpAGMAbwBuAHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4AVgBlAHIAcwBpAG8AbgAgADEALgAwAHMAYwByAGUAZQBuAHMAaABvAHQAcwAtAGkAYwBvAG4ARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwBAgEDAQQBBQEGAQcBCAEJAQoBCwEMAQ0ABWFycm93BHNhdmUGbW9zYWljBHJlZG8EdW5kbwdlbGxpcHNlCXJlY3RhbmdsZQR0ZXh0BmNhbmNlbAJvawVicnVzaAAA) format("truetype")}[class^=icon-],[class*=" icon-"]{font-family:screenshots-icon!important;font-style:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-ok:before{content:"\e001"}.icon-cancel:before{content:"\e002"}.icon-save:before{content:"\e003"}.icon-redo:before{content:"\e004"}.icon-undo:before{content:"\e005"}.icon-mosaic:before{content:"\e006"}.icon-text:before{content:"\e007"}.icon-brush:before{content:"\e008"}.icon-arrow:before{content:"\e009"}.icon-ellipse:before{content:"\e00a"}.icon-rectangle:before{content:"\e00b"}.screenshots{position:relative;transform:translateZ(0);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji}.screenshots,.screenshots *{box-sizing:border-box;user-select:none}.screenshots-magnifier{position:absolute;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji;left:0;top:0;width:100px;box-shadow:0 0 8px #000;z-index:9}.screenshots-magnifier,.screenshots-magnifier *{box-sizing:border-box;user-select:none}.screenshots-magnifier-body{position:relative;background-color:#fff}.screenshots-magnifier-body:before{content:"";background-color:#0a72a1;position:absolute;top:50%;left:0;width:100%;height:2px;z-index:1}.screenshots-magnifier-body:after{content:"";background-color:#0a72a1;position:absolute;top:0;left:50%;width:2px;height:100%;z-index:1}.screenshots-magnifier-body-canvas{display:block;width:100px;height:80px}.screenshots-magnifier-footer{height:40px;color:#fff;font-size:11px;background-color:#5f5e5e;padding:4px;white-space:nowrap;overflow:hidden;text-align:center}.screenshots-magnifier-footer-item{height:18px;line-height:18px}.screenshots-background{width:100%;height:100%;position:relative}.screenshots-background-image{width:100%;height:100%;display:block;border:none;outline:none;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;-webkit-font-smooting:antialiased}.screenshots-background-mask{width:100%;height:100%;position:absolute;top:0;right:0;bottom:0;left:0;background-color:#0000004d}.screenshots-canvas{position:absolute;left:0;top:0;will-change:width,height,transform}.screenshots-canvas-body,.screenshots-canvas-mask{width:100%;height:100%;position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden}.screenshots-canvas-image{display:block;border:none;outline:none;will-change:transform;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;-webkit-font-smooting:antialiased}.screenshots-canvas-panel{width:100%;height:100%;position:absolute;left:0;top:0;right:0;bottom:0;will-change:width,height}.screenshots-canvas-border-top{position:absolute;left:0;top:0;width:100%;height:2px;transform:translateY(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-right{position:absolute;left:100%;top:0;width:2px;height:100%;transform:translate(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-bottom{position:absolute;left:0;top:100%;width:100%;height:2px;transform:translateY(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-border-left{position:absolute;left:0;top:0;width:2px;height:100%;transform:translate(-50%);background-color:#39f;pointer-events:none}.screenshots-canvas-point-top{width:8px;height:8px;position:absolute;left:50%;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ns-resize}.screenshots-canvas-point-top-right{width:8px;height:8px;position:absolute;left:100%;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nesw-resize}.screenshots-canvas-point-right{width:8px;height:8px;position:absolute;left:100%;top:50%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ew-resize}.screenshots-canvas-point-right-bottom{width:8px;height:8px;position:absolute;left:100%;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nwse-resize}.screenshots-canvas-point-bottom{width:8px;height:8px;position:absolute;left:50%;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ns-resize}.screenshots-canvas-point-bottom-left{width:8px;height:8px;position:absolute;left:0;top:100%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nesw-resize}.screenshots-canvas-point-left{width:8px;height:8px;position:absolute;left:0;top:50%;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:ew-resize}.screenshots-canvas-point-left-top{width:8px;height:8px;position:absolute;left:0;top:0;background-color:#39f;border-radius:50%;transform:translate(-50%,-50%);cursor:nwse-resize}.screenshots-option{position:absolute;left:0;top:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji}.screenshots-option,.screenshots-option *{box-sizing:border-box;user-select:none}.screenshots-option-container{height:34px;padding:3px;border-radius:2px;border:1px solid #ddd;background-color:#fff}.screenshots-option-arrow{position:absolute;border:6px solid transparent}.screenshots-option[data-placement=top]{transform:translate(-50%,-11px)}.screenshots-option[data-placement=top] .screenshots-option-arrow{transform:translate(-50%,-1px);border-top-color:#fff;top:100%;left:50%}.screenshots-option[data-placement=bottom]{transform:translate(-50%,11px)}.screenshots-option[data-placement=bottom] .screenshots-option-arrow{transform:translate(-50%,1px);border-bottom-color:#fff;bottom:100%;left:50%}.screenshots-button{width:26px;height:26px;line-height:26px;color:#333;font-size:18px;text-align:center;margin:0 3px;vertical-align:middle;cursor:pointer}.screenshots-button-checked,.screenshots-button:hover{background-color:#eee;outline:1px solid #777}.screenshots-button-disabled{color:#bbb;cursor:not-allowed}.screenshots-button-disabled:hover{background-color:#fff;outline:none}.screenshots-size{height:24px;display:flex;align-items:center}.screenshots-size-item{width:24px;height:24px;position:relative;margin:0 3px;cursor:pointer}.screenshots-size-pointer{background-color:#555;border-radius:50%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.screenshots-size-active>.screenshots-size-pointer{background-color:#39f}.screenshots-color{height:24px;display:flex;align-items:center}.screenshots-color-item{border:1px solid #777;width:24px;height:24px;cursor:pointer;position:relative;margin:0 3px}.screenshots-color-item:before{content:"";display:none;position:absolute;right:0;bottom:0;width:10px;height:10px;background-color:#333}.screenshots-color-item:after{content:"";display:none;width:8px;height:4px;position:absolute;right:5px;bottom:5px;border-bottom:2px solid #fff;border-left:2px solid #fff;transform:translate(5px,2px) rotate(-45deg) scale(.8)}.screenshots-color-active:before,.screenshots-color-active:after{display:block}.screenshots-sizecolor{height:24px;display:flex;align-items:center}.screenshots-textarea{box-sizing:border-box;position:absolute;left:0;top:0;margin:0;padding:0;background-color:transparent;border:2px solid #39f;resize:none;outline:none;white-space:nowrap;word-break:break-all;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji;text-align:left}.screenshots-operations{position:absolute;left:0;top:0;will-change:transform}.screenshots-operations-buttons{display:flex;align-items:center;padding:3px;border-radius:2px;border:1px solid #ddd;background-color:#fff;overflow:hidden}.screenshots-operations-divider{background-color:#ddd;width:1px;height:26px;margin:0 3px}html,body,#app{height:100%;margin:0;padding:0;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.body{height:100%}
|
package/electron/electron.html
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>react-screenshots</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index.
|
|
8
|
-
<link rel="
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>react-screenshots</title>
|
|
7
|
+
<script type="module" crossorigin src="./assets/index.7793f29e.js"></script>
|
|
8
|
+
<link rel="stylesheet" href="./assets/index.78c5dcbf.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="app"></div>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Oe=Object.defineProperty,Ve=Object.defineProperties;var qe=Object.getOwnPropertyDescriptors;var he=Object.getOwnPropertySymbols;var Ee=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable;var De=(e,t,n)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t)=>{for(var n in t||(t={}))Ee.call(t,n)&&De(e,n,t[n]);if(he)for(var n of he(t))Be.call(t,n)&&De(e,n,t[n]);return e},me=(e,t)=>Ve(e,qe(t));var Me=(e,t)=>{var n={};for(var c in e)Ee.call(e,c)&&t.indexOf(c)<0&&(n[c]=e[c]);if(e!=null&&he)for(var c of he(e))t.indexOf(c)<0&&Be.call(e,c)&&(n[c]=e[c]);return n};var i=require("react"),$e=require("react-dom");function Je(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var b=Je(i),B;(function(e){e[e.Edit=0]="Edit",e[e.Source=1]="Source"})(B||(B={}));function de({image:e,width:t,height:n,history:c,bounds:r}){return new Promise((o,s)=>{const a=document.createElement("canvas"),m=r.width*window.devicePixelRatio,d=r.height*window.devicePixelRatio;a.width=m,a.height=d;const l=a.getContext("2d");if(!l)return s(new Error("convert image to blob fail"));const u=e.naturalWidth/t,h=e.naturalHeight/n;l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="low",l.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),l.clearRect(0,0,r.width,r.height),l.drawImage(e,r.x*u,r.y*h,r.width*u,r.height*h,0,0,r.width,r.height),c.stack.slice(0,c.index+1).forEach(f=>{f.type===B.Source&&f.draw(l,f)}),a.toBlob(f=>{if(!f)return s(new Error("canvas toBlob fail"));o(f)},"image/png")})}const Le={magnifier_position_label:"\u5750\u6807",operation_ok_title:"\u786E\u5B9A",operation_cancel_title:"\u53D6\u6D88",operation_save_title:"\u4FDD\u5B58",operation_redo_title:"\u91CD\u505A",operation_undo_title:"\u64A4\u9500",operation_mosaic_title:"\u9A6C\u8D5B\u514B",operation_text_title:"\u6587\u672C",operation_brush_title:"\u753B\u7B14",operation_arrow_title:"\u7BAD\u5934",operation_ellipse_title:"\u692D\u5706",operation_rectangle_title:"\u77E9\u5F62"};var ve=b.default.createContext({store:{url:void 0,image:null,width:0,height:0,lang:Le,emiterRef:{current:{}},canvasContextRef:{current:null},history:{index:-1,stack:[]},bounds:null,cursor:"move",operation:void 0},dispatcher:{call:void 0,setHistory:void 0,setBounds:void 0,setCursor:void 0,setOperation:void 0}});function ce(){const{dispatcher:e}=i.useContext(ve);return e}function L(){const{store:e}=i.useContext(ve);return e}function J(){const{bounds:e}=L(),{setBounds:t}=ce(),n=i.useCallback(r=>{t==null||t(r)},[t]),c=i.useCallback(()=>{t==null||t(null)},[t]);return[e,{set:n,reset:c}]}function T(){const{lang:e}=L();return e}var Q="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsMagnifier/index.tsx";const K=100,Z=80;var Qe=i.memo(function({x:t,y:n}){const{width:c,height:r,image:o}=L(),s=T(),[a,m]=i.useState(null),d=i.useRef(null),l=i.useRef(null),u=i.useRef(null),[h,f]=i.useState("000000");return i.useLayoutEffect(()=>{if(!d.current)return;const g=d.current.getBoundingClientRect();let y=t+20,C=n+20;y+g.width>c&&(y=t-g.width-20),C+g.height>r&&(C=n-g.height-20),y<0&&(y=0),C<0&&(C=0),m({x:y,y:C})},[c,r,t,n]),i.useEffect(()=>{if(!o||!l.current){u.current=null;return}if(u.current||(u.current=l.current.getContext("2d")),!u.current)return;const g=u.current;g.clearRect(0,0,K,Z);const y=o.naturalWidth/c,C=o.naturalHeight/r;g.drawImage(o,t*y-K/2,n*C-Z/2,K,Z,0,0,K,Z);const{data:v}=g.getImageData(Math.floor(K/2),Math.floor(Z/2),1,1),R=Array.from(v.slice(0,3)).map(w=>w>=16?w.toString(16):`0${w.toString(16)}`).join("").toUpperCase();f(R)},[c,r,o,t,n]),b.default.createElement("div",{ref:d,className:"screenshots-magnifier",style:{transform:`translate(${a==null?void 0:a.x}px, ${a==null?void 0:a.y}px)`},__self:this,__source:{fileName:Q,lineNumber:89,columnNumber:5}},b.default.createElement("div",{className:"screenshots-magnifier-body",__self:this,__source:{fileName:Q,lineNumber:96,columnNumber:7}},b.default.createElement("canvas",{ref:l,className:"screenshots-magnifier-body-canvas",width:K,height:Z,__self:this,__source:{fileName:Q,lineNumber:97,columnNumber:9}})),b.default.createElement("div",{className:"screenshots-magnifier-footer",__self:this,__source:{fileName:Q,lineNumber:104,columnNumber:7}},b.default.createElement("div",{className:"screenshots-magnifier-footer-item",__self:this,__source:{fileName:Q,lineNumber:105,columnNumber:9}},s.magnifier_position_label,": (",t,",",n,")"),b.default.createElement("div",{className:"screenshots-magnifier-footer-item",__self:this,__source:{fileName:Q,lineNumber:108,columnNumber:9}},"RGB: #",h)))});function Ke({x:e,y:t},{x:n,y:c},r,o){return e>n&&([e,n]=[n,e]),t>c&&([t,c]=[c,t]),e<0&&(e=0),n>r&&(n=r),t<0&&(t=0),c>o&&(c=o),{x:e,y:t,width:n-e,height:c-t}}var pe="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsBackground/index.tsx",Ze=i.memo(function(){const{url:t,image:n,width:c,height:r}=L(),[o,s]=J(),a=i.useRef(null),m=i.useRef(null),d=i.useRef(!1),[l,u]=i.useState(null),h=i.useCallback((g,y)=>{if(!a.current)return;const{x:C,y:v}=a.current.getBoundingClientRect();s.set(Ke({x:g.x-C,y:g.y-v},{x:y.x-C,y:y.y-v},c,r))},[c,r,s]),f=i.useCallback(g=>{m.current||o||g.button!==0||(m.current={x:g.clientX,y:g.clientY},d.current=!1)},[o]);return i.useEffect(()=>{const g=C=>{if(a.current){const v=a.current.getBoundingClientRect();C.clientX<v.left||C.clientY<v.top||C.clientX>v.right||C.clientY>v.bottom?u(null):u({x:C.clientX-v.x,y:C.clientY-v.y})}!m.current||(h(m.current,{x:C.clientX,y:C.clientY}),d.current=!0)},y=C=>{!m.current||(d.current&&h(m.current,{x:C.clientX,y:C.clientY}),m.current=null,d.current=!1)};return window.addEventListener("mousemove",g),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",y)}},[h]),i.useLayoutEffect(()=>{(!n||o)&&u(null)},[n,o]),!t||!n?null:b.default.createElement("div",{ref:a,className:"screenshots-background",onMouseDown:f,__self:this,__source:{fileName:pe,lineNumber:120,columnNumber:5}},b.default.createElement("img",{className:"screenshots-background-image",src:t,__self:this,__source:{fileName:pe,lineNumber:121,columnNumber:7}}),b.default.createElement("div",{className:"screenshots-background-mask",__self:this,__source:{fileName:pe,lineNumber:122,columnNumber:7}}),l&&!o&&b.default.createElement(Qe,{x:l==null?void 0:l.x,y:l==null?void 0:l.y,__self:this,__source:{fileName:pe,lineNumber:123,columnNumber:31}}))});function A(){const{cursor:e}=L(),{setCursor:t}=ce(),n=i.useCallback(r=>{t==null||t(r)},[t]),c=i.useCallback(()=>{t==null||t("move")},[t]);return[e,{set:n,reset:c}]}function ee(){const{emiterRef:e}=L(),t=i.useCallback((o,s)=>{const a=e.current;Array.isArray(a[o])?a[o].push(s):a[o]=[s]},[e]),n=i.useCallback((o,s)=>{const a=e.current;if(Array.isArray(a[o])){const m=a[o].findIndex(d=>d===s);m!==-1&&a[o].splice(m,1)}},[e]),c=i.useCallback((o,...s)=>{const a=e.current;Array.isArray(a[o])&&a[o].forEach(m=>m(...s))},[e]),r=i.useCallback(()=>{e.current={}},[e]);return{on:t,off:n,emit:c,reset:r}}function X(){const{history:e}=L(),{setHistory:t}=ce(),n=i.useCallback(l=>{const{index:u,stack:h}=e;h.forEach(f=>{f.type===B.Source&&(f.isSelected=!1)}),l.type===B.Source?l.isSelected=!0:l.type===B.Edit&&(l.source.isSelected=!0),h.splice(u+1),h.push(l),t==null||t({index:h.length-1,stack:h})},[e,t]),c=i.useCallback(()=>{const{stack:l}=e;l.pop(),t==null||t({index:l.length-1,stack:l})},[e,t]),r=i.useCallback(()=>{const{index:l,stack:u}=e,h=u[l];h&&(h.type===B.Source?h.isSelected=!1:h.type===B.Edit&&h.source.editHistory.pop()),t==null||t({index:l<=0?-1:l-1,stack:u})},[e,t]),o=i.useCallback(()=>{const{index:l,stack:u}=e,h=u[l+1];h&&(h.type===B.Source?h.isSelected=!1:h.type===B.Edit&&h.source.editHistory.push(h)),t==null||t({index:l>=u.length-1?u.length-1:l+1,stack:u})},[e,t]),s=i.useCallback(l=>{t==null||t(G({},l))},[t]),a=i.useCallback(l=>{e.stack.forEach(u=>{u.type===B.Source&&(u===l?u.isSelected=!0:u.isSelected=!1)}),t==null||t(G({},e))},[e,t]),m=i.useCallback(()=>{e.stack.forEach(l=>{l.type===B.Source&&(l.isSelected=!1)}),t==null||t(G({},e))},[e,t]),d=i.useCallback(()=>{t==null||t({index:-1,stack:[]})},[t]);return[{index:e.index,stack:e.stack,top:e.stack.slice(e.index,e.index+1)[0]},{push:n,pop:c,undo:r,redo:o,set:s,select:a,clearSelect:m,reset:d}]}function I(){const{operation:e}=L(),{setOperation:t}=ce(),n=i.useCallback(r=>{t==null||t(r)},[t]),c=i.useCallback(()=>{t==null||t(void 0)},[t]);return[e,{set:n,reset:c}]}function et({x:e,y:t},{x:n,y:c},r,o,s,a){return e>n&&([e,n]=[n,e]),t>c&&([t,c]=[c,t]),e<0&&(e=0,a==="move"&&(n=r.width)),n>o&&(n=o,a==="move"&&(e=n-r.width)),t<0&&(t=0,a==="move"&&(c=r.height)),c>s&&(c=s,a==="move"&&(t=c-r.height)),{x:e,y:t,width:Math.max(n-e,1),height:Math.max(c-t,1)}}function tt(e,t,n,c){const r=e.clientX-n.x,o=e.clientY-n.y;let s=c.x,a=c.y,m=c.x+c.width,d=c.y+c.height;switch(t){case"top":a+=o;break;case"top-right":m+=r,a+=o;break;case"right":m+=r;break;case"right-bottom":m+=r,d+=o;break;case"bottom":d+=o;break;case"bottom-left":s+=r,d+=o;break;case"left":s+=r;break;case"left-top":s+=r,a+=o;break;case"move":s+=r,a+=o,m+=r,d+=o;break}return[{x:s,y:a},{x:m,y:d}]}function nt(e,t,n,c){if(!t)return!1;const r=document.createElement("canvas");r.width=e.width,r.height=e.height;const o=r.getContext("2d");if(!o)return!1;const{left:s,top:a}=t.getBoundingClientRect(),m=c.clientX-s,d=c.clientY-a;return[...n.stack.slice(0,n.index+1)].reverse().find(u=>{var h;return u.type!==B.Source?!1:(o.clearRect(0,0,e.width,e.height),(h=u.isHit)==null?void 0:h.call(u,o,u,{x:m,y:d}))})}var V="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsCanvas/index.tsx";const st=["top","right","bottom","left"];var j;(function(e){e.ResizeTop="top",e.ResizetopRight="top-right",e.ResizeRight="right",e.ResizeRightBottom="right-bottom",e.ResizeBottom="bottom",e.ResizeBottomLeft="bottom-left",e.ResizeLeft="left",e.ResizeLeftTop="left-top",e.Move="move"})(j||(j={}));const rt=[j.ResizeTop,j.ResizetopRight,j.ResizeRight,j.ResizeRightBottom,j.ResizeBottom,j.ResizeBottomLeft,j.ResizeLeft,j.ResizeLeftTop];var ot=i.memo(i.forwardRef(function(t,n){const{url:c,image:r,width:o,height:s}=L(),a=ee(),[m]=X(),[d]=A(),[l,u]=J(),[h]=I(),f=i.useRef(),g=i.useRef(null),y=i.useRef(null),C=i.useRef(null),v=i.useRef(null),R=i.useCallback(()=>{if(!l||!v.current)return;const p=v.current;p.imageSmoothingEnabled=!0,p.imageSmoothingQuality="low",p.clearRect(0,0,l.width,l.height),m.stack.slice(0,m.index+1).forEach(x=>{x.type===B.Source&&x.draw(p,x)})},[l,v,m]),w=i.useCallback((p,x)=>{if(!(p.button!==0||!l))if(!h)f.current=x,g.current={x:p.clientX,y:p.clientY},y.current={x:l.x,y:l.y,width:l.width,height:l.height};else{const N=nt(l,C.current,m,p.nativeEvent);N?a.emit("drawselect",N,p.nativeEvent):a.emit("mousedown",p.nativeEvent)}},[l,h,a,m]),_=i.useCallback(p=>{if(!f.current||!g.current||!y.current||!l)return;const x=tt(p,f.current,g.current,y.current);u.set(et(x[0],x[1],l,o,s,f.current))},[o,s,l,u]);return i.useLayoutEffect(()=>{if(!r||!l||!C.current){v.current=null;return}v.current||(v.current=C.current.getContext("2d")),R()},[r,l,R]),i.useEffect(()=>{const p=N=>{if(h)a.emit("mousemove",N);else{if(!f.current||!g.current||!y.current)return;_(N)}},x=N=>{if(h)a.emit("mouseup",N);else{if(!f.current||!g.current||!y.current)return;_(N),f.current=void 0,g.current=null,y.current=null}};return window.addEventListener("mousemove",p),window.addEventListener("mouseup",x),()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",x)}},[_,h,a]),i.useImperativeHandle(n,()=>v.current),b.default.createElement("div",{className:"screenshots-canvas",style:{width:(l==null?void 0:l.width)||0,height:(l==null?void 0:l.height)||0,transform:l?`translate(${l.x}px, ${l.y}px)`:"none"},__self:this,__source:{fileName:V,lineNumber:173,columnNumber:7}},b.default.createElement("div",{className:"screenshots-canvas-body",__self:this,__source:{fileName:V,lineNumber:181,columnNumber:9}},b.default.createElement("img",{className:"screenshots-canvas-image",src:c,style:{width:o,height:s,transform:l?`translate(${-l.x}px, ${-l.y}px)`:"none"},__self:this,__source:{fileName:V,lineNumber:183,columnNumber:11}}),b.default.createElement("canvas",{ref:C,className:"screenshots-canvas-panel",width:(l==null?void 0:l.width)||0,height:(l==null?void 0:l.height)||0,__self:this,__source:{fileName:V,lineNumber:192,columnNumber:11}})),b.default.createElement("div",{className:"screenshots-canvas-mask",style:{cursor:d},onMouseDown:p=>w(p,"move"),__self:this,__source:{fileName:V,lineNumber:199,columnNumber:9}}),st.map(p=>b.default.createElement("div",{key:p,className:`screenshots-canvas-border-${p}`,__self:this,__source:{fileName:V,lineNumber:207,columnNumber:18}})),rt.map(p=>b.default.createElement("div",{key:p,className:`screenshots-canvas-point-${p}`,onMouseDown:x=>w(x,p),__self:this,__source:{fileName:V,lineNumber:211,columnNumber:13}})))}));function ye(){const e=ce();return i.useCallback((n,...c)=>{var r;(r=e.call)==null||r.call(e,n,...c)},[e])}function W(){const{canvasContextRef:e}=L();return e}function Ne(){const e=ee(),[,t]=J(),[,n]=A(),[,c]=X(),[,r]=I();return i.useCallback(()=>{e.reset(),c.reset(),t.reset(),n.reset(),r.reset()},[e,c,t,n,r])}var Ce="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsOption/index.tsx",q;(function(e){e.Bottom="bottom",e.Top="top"})(q||(q={}));var ct=i.memo(function({open:t,content:n,children:c}){var y,C;const r=i.useRef(null),o=i.useRef(null),s=i.useRef(null),a=i.useContext(We),[m,d]=i.useState(q.Bottom),[l,u]=i.useState(null),[h,f]=i.useState(0),g=()=>(o.current||(o.current=document.createElement("div")),o.current);return i.useEffect(()=>{const v=g();return t&&document.body.appendChild(v),()=>{v.remove()}},[t]),i.useEffect(()=>{if(!t||!a||!r.current||!s.current)return;const v=r.current.getBoundingClientRect(),R=s.current.getBoundingClientRect();let w=m,_=v.left+v.width/2,p=v.top+v.height,x=h;if(_+R.width/2>a.x+a.width){const N=_;_=a.x+a.width-R.width/2,x=N-_}if(_<a.x+R.width/2){const N=_;_=a.x+R.width/2,x=N-_}p>window.innerHeight-R.height&&(w===q.Bottom&&(w=q.Top),p=v.top-R.height),p<0&&(w===q.Top&&(w=q.Bottom),p=v.top+v.height),w!==m&&d(w),((l==null?void 0:l.x)!==_||l.y!==p)&&u({x:_,y:p}),x!==h&&f(x)}),b.default.createElement(b.default.Fragment,null,i.cloneElement(c,{ref:r}),t&&n&&$e.createPortal(b.default.createElement("div",{ref:s,className:"screenshots-option",style:{visibility:l?"visible":"hidden",transform:`translate(${(y=l==null?void 0:l.x)!=null?y:0}px, ${(C=l==null?void 0:l.y)!=null?C:0}px)`},"data-placement":m,__self:this,__source:{fileName:Ce,lineNumber:111,columnNumber:11}},b.default.createElement("div",{className:"screenshots-option-container",__self:this,__source:{fileName:Ce,lineNumber:120,columnNumber:13}},n),b.default.createElement("div",{className:"screenshots-option-arrow",style:{marginLeft:h},__self:this,__source:{fileName:Ce,lineNumber:121,columnNumber:13}})),g()))});var Se="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsButton/index.tsx",P=i.memo(function({title:t,icon:n,checked:c,disabled:r,option:o,onClick:s}){const a=["screenshots-button"],m=i.useCallback(d=>{r||!s||s(d)},[r,s]);return c&&a.push("screenshots-button-checked"),r&&a.push("screenshots-button-disabled"),b.default.createElement(ct,{open:c,content:o,__self:this,__source:{fileName:Se,lineNumber:42,columnNumber:5}},b.default.createElement("div",{className:a.join(" "),title:t,onClick:m,__self:this,__source:{fileName:Se,lineNumber:43,columnNumber:7}},b.default.createElement("span",{className:n,__self:this,__source:{fileName:Se,lineNumber:44,columnNumber:9}})))}),it="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Ok/index.tsx";function at(){const{image:e,width:t,height:n,history:c,bounds:r,lang:o}=L(),s=W(),[,a]=X(),m=ye(),d=Ne(),l=i.useCallback(()=>{a.clearSelect(),setTimeout(()=>{!s.current||!e||!r||de({image:e,width:t,height:n,history:c,bounds:r}).then(u=>{m("onOk",u,r),d()})})},[s,a,e,t,n,c,r,m,d]);return b.default.createElement(P,{title:o.operation_ok_title,icon:"icon-ok",onClick:l,__self:this,__source:{fileName:it,lineNumber:36,columnNumber:10}})}var lt="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Cancel/index.tsx";function ut(){const e=ye(),t=Ne(),n=T(),c=i.useCallback(()=>{e("onCancel"),t()},[e,t]);return b.default.createElement(P,{title:n.operation_cancel_title,icon:"icon-cancel",onClick:c,__self:this,__source:{fileName:lt,lineNumber:17,columnNumber:10}})}var ft="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Save/index.tsx";function ht(){const{image:e,width:t,height:n,history:c,bounds:r,lang:o}=L(),s=W(),[,a]=X(),m=ye(),d=Ne(),l=i.useCallback(()=>{a.clearSelect(),setTimeout(()=>{!s.current||!e||!r||de({image:e,width:t,height:n,history:c,bounds:r}).then(u=>{m("onSave",u,r),d()})})},[s,a,e,t,n,c,r,m,d]);return b.default.createElement(P,{title:o.operation_save_title,icon:"icon-save",onClick:l,__self:this,__source:{fileName:ft,lineNumber:36,columnNumber:10}})}var mt="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Redo/index.tsx";function dt(){const e=T(),[t,n]=X(),c=i.useCallback(()=>{n.redo()},[n]);return b.default.createElement(P,{title:e.operation_redo_title,icon:"icon-redo",disabled:!t.stack.length||t.stack.length-1===t.index,onClick:c,__self:this,__source:{fileName:mt,lineNumber:15,columnNumber:5}})}var pt="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Undo/index.tsx";function gt(){const e=T(),[t,n]=X(),c=i.useCallback(()=>{n.undo()},[n]);return b.default.createElement(P,{title:e.operation_undo_title,icon:"icon-undo",disabled:t.index===-1,onClick:c,__self:this,__source:{fileName:pt,lineNumber:15,columnNumber:5}})}var Re="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsSize/index.tsx",He=i.memo(function({value:t,onChange:n}){const c=[3,6,9];return b.default.createElement("div",{className:"screenshots-size",__self:this,__source:{fileName:Re,lineNumber:12,columnNumber:5}},c.map(r=>{const o=["screenshots-size-item"];return r===t&&o.push("screenshots-size-active"),b.default.createElement("div",{key:r,className:o.join(" "),onClick:()=>n&&n(r),__self:this,__source:{fileName:Re,lineNumber:21,columnNumber:11}},b.default.createElement("div",{className:"screenshots-size-pointer",style:{width:r*1.8,height:r*1.8},__self:this,__source:{fileName:Re,lineNumber:22,columnNumber:13}}))}))});function te(e){const t=ee();i.useEffect(()=>(t.on("mousedown",e),()=>{t.off("mousedown",e)}),[e,t])}function ne(e){const t=ee();i.useEffect(()=>(t.on("mousemove",e),()=>{t.off("mousemove",e)}),[e,t])}function se(e){const t=ee();i.useEffect(()=>(t.on("mouseup",e),()=>{t.off("mouseup",e)}),[e,t])}var Xe="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Mosaic/index.tsx";function ge(e,t,n){if(!n)return[0,0,0,0];const{data:c,width:r}=n,o=t*r*4+e*4;return Array.from(c.slice(o,o+4))}function _t(e,t){const{tiles:n,size:c}=t.data;n.forEach(r=>{const o=Math.round(r.color[0]),s=Math.round(r.color[1]),a=Math.round(r.color[2]),m=r.color[3]/255;e.fillStyle=`rgba(${o}, ${s}, ${a}, ${m})`,e.fillRect(r.x-c/2,r.y-c/2,c,c)})}function bt(){const e=T(),{image:t,width:n,height:c}=L(),[r,o]=I(),s=W(),[a,m]=X(),[d]=J(),[,l]=A(),[u,h]=i.useState(3),f=i.useRef(null),g=i.useRef(null),y=r==="Mosaic",C=i.useCallback(()=>{o.set("Mosaic"),l.set("crosshair")},[o,l]),v=i.useCallback(()=>{y||(C(),m.clearSelect())},[y,C,m]),R=i.useCallback(p=>{if(!y||g.current||!f.current||!s.current)return;const x=s.current.canvas.getBoundingClientRect(),N=p.clientX-x.x,k=p.clientY-x.y,E=u*2;g.current={name:"Mosaic",type:B.Source,data:{size:E,tiles:[{x:N,y:k,color:ge(N,k,f.current)}]},editHistory:[],draw:_t}},[y,u,s]),w=i.useCallback(p=>{if(!y||!g.current||!s.current||!f.current)return;const x=s.current.canvas.getBoundingClientRect(),N=p.clientX-x.x,k=p.clientY-x.y,E=g.current.data.size,z=g.current.data.tiles;let S=z[z.length-1];if(!S)z.push({x:N,y:k,color:ge(N,k,f.current)});else{const U=S.x-N,D=S.y-k;let H=Math.sqrt(U**2+D**2);const be=-D/H,xe=-U/H;for(;H>E;){const re=Math.floor(S.x+E*xe),oe=Math.floor(S.y+E*be);S={x:re,y:oe,color:ge(re,oe,f.current)},z.push(S),H-=E}H>E/2&&z.push({x:N,y:k,color:ge(N,k,f.current)})}a.top!==g.current?m.push(g.current):m.set(a)},[y,s,a,m]),_=i.useCallback(()=>{!y||(g.current=null)},[y]);return te(R),ne(w),se(_),i.useEffect(()=>{if(!d||!t||!y)return;const p=document.createElement("canvas"),x=p.getContext("2d");if(!x)return;p.width=d.width,p.height=d.height;const N=t.naturalWidth/n,k=t.naturalHeight/c;x.drawImage(t,d.x*N,d.y*k,d.width*N,d.height*k,0,0,d.width,d.height),f.current=x.getImageData(0,0,d.width,d.height)},[n,c,d,t,y]),b.default.createElement(P,{title:e.operation_mosaic_title,icon:"icon-mosaic",checked:y,onClick:v,option:b.default.createElement(He,{value:u,onChange:h,__self:this,__source:{fileName:Xe,lineNumber:220,columnNumber:15}}),__self:this,__source:{fileName:Xe,lineNumber:215,columnNumber:5}})}var Pe="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsColor/index.tsx",xt=i.memo(function({value:t,onChange:n}){const c=["#ee5126","#fceb4d","#90e746","#51c0fa","#7a7a7a","#ffffff"];return b.default.createElement("div",{className:"screenshots-color",__self:this,__source:{fileName:Pe,lineNumber:12,columnNumber:5}},c.map(r=>{const o=["screenshots-color-item"];return r===t&&o.push("screenshots-color-active"),b.default.createElement("div",{key:r,className:o.join(" "),style:{backgroundColor:r},onClick:()=>n&&n(r),__self:this,__source:{fileName:Pe,lineNumber:19,columnNumber:11}})}))});var ke="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsSizeColor/index.tsx",ie=i.memo(function({size:t,color:n,onSizeChange:c,onColorChange:r}){return b.default.createElement("div",{className:"screenshots-sizecolor",__self:this,__source:{fileName:ke,lineNumber:20,columnNumber:5}},b.default.createElement(He,{value:t,onChange:c,__self:this,__source:{fileName:ke,lineNumber:21,columnNumber:7}}),b.default.createElement(xt,{value:n,onChange:r,__self:this,__source:{fileName:ke,lineNumber:22,columnNumber:7}}))});const vt=`
|
|
1
|
+
"use strict";var i=require("react"),De=require("react-dom");function Fe(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var _=Fe(i),D=(e=>(e[e.Edit=0]="Edit",e[e.Source=1]="Source",e))(D||{});function fe({image:e,width:t,height:o,history:a,bounds:s}){return new Promise((r,n)=>{const c=document.createElement("canvas"),p=s.width*window.devicePixelRatio,d=s.height*window.devicePixelRatio;c.width=p,c.height=d;const l=c.getContext("2d");if(!l)return n(new Error("convert image to blob fail"));const u=e.naturalWidth/t,f=e.naturalHeight/o;l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="low",l.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),l.clearRect(0,0,s.width,s.height),l.drawImage(e,s.x*u,s.y*f,s.width*u,s.height*f,0,0,s.width,s.height),a.stack.slice(0,a.index+1).forEach(h=>{h.type===D.Source&&h.draw(l,h)}),c.toBlob(h=>{if(!h)return n(new Error("canvas toBlob fail"));r(h)},"image/png")})}const Me={magnifier_position_label:"\u5750\u6807",operation_ok_title:"\u786E\u5B9A",operation_cancel_title:"\u53D6\u6D88",operation_save_title:"\u4FDD\u5B58",operation_redo_title:"\u91CD\u505A",operation_undo_title:"\u64A4\u9500",operation_mosaic_title:"\u9A6C\u8D5B\u514B",operation_text_title:"\u6587\u672C",operation_brush_title:"\u753B\u7B14",operation_arrow_title:"\u7BAD\u5934",operation_ellipse_title:"\u692D\u5706",operation_rectangle_title:"\u77E9\u5F62"};var ye=_.default.createContext({store:{url:void 0,image:null,width:0,height:0,lang:Me,emiterRef:{current:{}},canvasContextRef:{current:null},history:{index:-1,stack:[]},bounds:null,cursor:"move",operation:void 0},dispatcher:{call:void 0,setHistory:void 0,setBounds:void 0,setCursor:void 0,setOperation:void 0}});function re(){const{dispatcher:e}=i.useContext(ye);return e}function P(){const{store:e}=i.useContext(ye);return e}function q(){const{bounds:e}=P(),{setBounds:t}=re(),o=i.useCallback(s=>{t==null||t(s)},[t]),a=i.useCallback(()=>{t==null||t(null)},[t]);return[e,{set:o,reset:a}]}function U(){const{lang:e}=P();return e}var W="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsMagnifier\\index.tsx";const O=100,V=80;var je=i.memo(function({x:t,y:o}){const{width:a,height:s,image:r}=P(),n=U(),[c,p]=i.useState(null),d=i.useRef(null),l=i.useRef(null),u=i.useRef(null),[f,h]=i.useState("000000");return i.useLayoutEffect(()=>{if(!d.current)return;const b=d.current.getBoundingClientRect();let y=t+20,C=o+20;y+b.width>a&&(y=t-b.width-20),C+b.height>s&&(C=o-b.height-20),y<0&&(y=0),C<0&&(C=0),p({x:y,y:C})},[a,s,t,o]),i.useEffect(()=>{if(!r||!l.current){u.current=null;return}if(u.current||(u.current=l.current.getContext("2d")),!u.current)return;const b=u.current;b.clearRect(0,0,O,V);const y=r.naturalWidth/a,C=r.naturalHeight/s;b.drawImage(r,t*y-O/2,o*C-V/2,O,V,0,0,O,V);const{data:x}=b.getImageData(Math.floor(O/2),Math.floor(V/2),1,1),S=Array.from(x.slice(0,3)).map(w=>w>=16?w.toString(16):`0${w.toString(16)}`).join("").toUpperCase();h(S)},[a,s,r,t,o]),_.default.createElement("div",{ref:d,className:"screenshots-magnifier",style:{transform:`translate(${c==null?void 0:c.x}px, ${c==null?void 0:c.y}px)`},__self:this,__source:{fileName:W,lineNumber:89,columnNumber:5}},_.default.createElement("div",{className:"screenshots-magnifier-body",__self:this,__source:{fileName:W,lineNumber:96,columnNumber:7}},_.default.createElement("canvas",{ref:l,className:"screenshots-magnifier-body-canvas",width:O,height:V,__self:this,__source:{fileName:W,lineNumber:97,columnNumber:9}})),_.default.createElement("div",{className:"screenshots-magnifier-footer",__self:this,__source:{fileName:W,lineNumber:104,columnNumber:7}},_.default.createElement("div",{className:"screenshots-magnifier-footer-item",__self:this,__source:{fileName:W,lineNumber:105,columnNumber:9}},n.magnifier_position_label,": (",t,",",o,")"),_.default.createElement("div",{className:"screenshots-magnifier-footer-item",__self:this,__source:{fileName:W,lineNumber:108,columnNumber:9}},"RGB: #",f)))});function Ue({x:e,y:t},{x:o,y:a},s,r){return e>o&&([e,o]=[o,e]),t>a&&([t,a]=[a,t]),e<0&&(e=0),o>s&&(o=s),t<0&&(t=0),a>r&&(a=r),{x:e,y:t,width:o-e,height:a-t}}var ae="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsBackground\\index.tsx",Ge=i.memo(function(){const{url:t,image:o,width:a,height:s}=P(),[r,n]=q(),c=i.useRef(null),p=i.useRef(null),d=i.useRef(!1),[l,u]=i.useState(null),f=i.useCallback((b,y)=>{if(!c.current)return;const{x:C,y:x}=c.current.getBoundingClientRect();n.set(Ue({x:b.x-C,y:b.y-x},{x:y.x-C,y:y.y-x},a,s))},[a,s,n]),h=i.useCallback(b=>{p.current||r||b.button!==0||(p.current={x:b.clientX,y:b.clientY},d.current=!1)},[r]);return i.useEffect(()=>{const b=C=>{if(c.current){const x=c.current.getBoundingClientRect();C.clientX<x.left||C.clientY<x.top||C.clientX>x.right||C.clientY>x.bottom?u(null):u({x:C.clientX-x.x,y:C.clientY-x.y})}!p.current||(f(p.current,{x:C.clientX,y:C.clientY}),d.current=!0)},y=C=>{!p.current||(d.current&&f(p.current,{x:C.clientX,y:C.clientY}),p.current=null,d.current=!1)};return window.addEventListener("mousemove",b),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",y)}},[f]),i.useLayoutEffect(()=>{(!o||r)&&u(null)},[o,r]),!t||!o?null:_.default.createElement("div",{ref:c,className:"screenshots-background",onMouseDown:h,__self:this,__source:{fileName:ae,lineNumber:120,columnNumber:5}},_.default.createElement("img",{className:"screenshots-background-image",src:t,__self:this,__source:{fileName:ae,lineNumber:121,columnNumber:7}}),_.default.createElement("div",{className:"screenshots-background-mask",__self:this,__source:{fileName:ae,lineNumber:122,columnNumber:7}}),l&&!r&&_.default.createElement(je,{x:l==null?void 0:l.x,y:l==null?void 0:l.y,__self:this,__source:{fileName:ae,lineNumber:123,columnNumber:31}}))});function A(){const{cursor:e}=P(),{setCursor:t}=re(),o=i.useCallback(s=>{t==null||t(s)},[t]),a=i.useCallback(()=>{t==null||t("move")},[t]);return[e,{set:o,reset:a}]}function J(){const{emiterRef:e}=P(),t=i.useCallback((r,n)=>{const c=e.current;Array.isArray(c[r])?c[r].push(n):c[r]=[n]},[e]),o=i.useCallback((r,n)=>{const c=e.current;if(Array.isArray(c[r])){const p=c[r].findIndex(d=>d===n);p!==-1&&c[r].splice(p,1)}},[e]),a=i.useCallback((r,...n)=>{const c=e.current;Array.isArray(c[r])&&c[r].forEach(p=>p(...n))},[e]),s=i.useCallback(()=>{e.current={}},[e]);return{on:t,off:o,emit:a,reset:s}}function X(){const{history:e}=P(),{setHistory:t}=re(),o=i.useCallback(l=>{const{index:u,stack:f}=e;f.forEach(h=>{h.type===D.Source&&(h.isSelected=!1)}),l.type===D.Source?l.isSelected=!0:l.type===D.Edit&&(l.source.isSelected=!0),f.splice(u+1),f.push(l),t==null||t({index:f.length-1,stack:f})},[e,t]),a=i.useCallback(()=>{const{stack:l}=e;l.pop(),t==null||t({index:l.length-1,stack:l})},[e,t]),s=i.useCallback(()=>{const{index:l,stack:u}=e,f=u[l];f&&(f.type===D.Source?f.isSelected=!1:f.type===D.Edit&&f.source.editHistory.pop()),t==null||t({index:l<=0?-1:l-1,stack:u})},[e,t]),r=i.useCallback(()=>{const{index:l,stack:u}=e,f=u[l+1];f&&(f.type===D.Source?f.isSelected=!1:f.type===D.Edit&&f.source.editHistory.push(f)),t==null||t({index:l>=u.length-1?u.length-1:l+1,stack:u})},[e,t]),n=i.useCallback(l=>{t==null||t({...l})},[t]),c=i.useCallback(l=>{e.stack.forEach(u=>{u.type===D.Source&&(u===l?u.isSelected=!0:u.isSelected=!1)}),t==null||t({...e})},[e,t]),p=i.useCallback(()=>{e.stack.forEach(l=>{l.type===D.Source&&(l.isSelected=!1)}),t==null||t({...e})},[e,t]),d=i.useCallback(()=>{t==null||t({index:-1,stack:[]})},[t]);return[{index:e.index,stack:e.stack,top:e.stack.slice(e.index,e.index+1)[0]},{push:o,pop:a,undo:s,redo:r,set:n,select:c,clearSelect:p,reset:d}]}function T(){const{operation:e}=P(),{setOperation:t}=re(),o=i.useCallback(s=>{t==null||t(s)},[t]),a=i.useCallback(()=>{t==null||t(void 0)},[t]);return[e,{set:o,reset:a}]}function Ae({x:e,y:t},{x:o,y:a},s,r,n,c){return e>o&&([e,o]=[o,e]),t>a&&([t,a]=[a,t]),e<0&&(e=0,c==="move"&&(o=s.width)),o>r&&(o=r,c==="move"&&(e=o-s.width)),t<0&&(t=0,c==="move"&&(a=s.height)),a>n&&(a=n,c==="move"&&(t=a-s.height)),{x:e,y:t,width:Math.max(o-e,1),height:Math.max(a-t,1)}}function Te(e,t,o,a){const s=e.clientX-o.x,r=e.clientY-o.y;let n=a.x,c=a.y,p=a.x+a.width,d=a.y+a.height;switch(t){case"top":c+=r;break;case"top-right":p+=s,c+=r;break;case"right":p+=s;break;case"right-bottom":p+=s,d+=r;break;case"bottom":d+=r;break;case"bottom-left":n+=s,d+=r;break;case"left":n+=s;break;case"left-top":n+=s,c+=r;break;case"move":n+=s,c+=r,p+=s,d+=r;break}return[{x:n,y:c},{x:p,y:d}]}function He(e,t,o,a){if(!t)return!1;const s=document.createElement("canvas");s.width=e.width,s.height=e.height;const r=s.getContext("2d");if(!r)return!1;const{left:n,top:c}=t.getBoundingClientRect(),p=a.clientX-n,d=a.clientY-c;return[...o.stack.slice(0,o.index+1)].reverse().find(u=>{var f;return u.type!==D.Source?!1:(r.clearRect(0,0,e.width,e.height),(f=u.isHit)==null?void 0:f.call(u,r,u,{x:p,y:d}))})}var I="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsCanvas\\index.tsx";const Ie=["top","right","bottom","left"],We=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];var Oe=i.memo(i.forwardRef(function(t,o){const{url:a,image:s,width:r,height:n}=P(),c=J(),[p]=X(),[d]=A(),[l,u]=q(),[f]=T(),h=i.useRef(),b=i.useRef(null),y=i.useRef(null),C=i.useRef(null),x=i.useRef(null),S=i.useCallback(()=>{if(!l||!x.current)return;const m=x.current;m.imageSmoothingEnabled=!0,m.imageSmoothingQuality="low",m.clearRect(0,0,l.width,l.height),p.stack.slice(0,p.index+1).forEach(v=>{v.type===D.Source&&v.draw(m,v)})},[l,x,p]),w=i.useCallback((m,v)=>{if(!(m.button!==0||!l))if(!f)h.current=v,b.current={x:m.clientX,y:m.clientY},y.current={x:l.x,y:l.y,width:l.width,height:l.height};else{const N=He(l,C.current,p,m.nativeEvent);N?c.emit("drawselect",N,m.nativeEvent):c.emit("mousedown",m.nativeEvent)}},[l,f,c,p]),g=i.useCallback(m=>{if(!h.current||!b.current||!y.current||!l)return;const v=Te(m,h.current,b.current,y.current);u.set(Ae(v[0],v[1],l,r,n,h.current))},[r,n,l,u]);return i.useLayoutEffect(()=>{if(!s||!l||!C.current){x.current=null;return}x.current||(x.current=C.current.getContext("2d")),S()},[s,l,S]),i.useEffect(()=>{const m=N=>{if(f)c.emit("mousemove",N);else{if(!h.current||!b.current||!y.current)return;g(N)}},v=N=>{if(f)c.emit("mouseup",N);else{if(!h.current||!b.current||!y.current)return;g(N),h.current=void 0,b.current=null,y.current=null}};return window.addEventListener("mousemove",m),window.addEventListener("mouseup",v),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",v)}},[g,f,c]),i.useImperativeHandle(o,()=>x.current),_.default.createElement("div",{className:"screenshots-canvas",style:{width:(l==null?void 0:l.width)||0,height:(l==null?void 0:l.height)||0,transform:l?`translate(${l.x}px, ${l.y}px)`:"none"},__self:this,__source:{fileName:I,lineNumber:173,columnNumber:7}},_.default.createElement("div",{className:"screenshots-canvas-body",__self:this,__source:{fileName:I,lineNumber:181,columnNumber:9}},_.default.createElement("img",{className:"screenshots-canvas-image",src:a,style:{width:r,height:n,transform:l?`translate(${-l.x}px, ${-l.y}px)`:"none"},__self:this,__source:{fileName:I,lineNumber:183,columnNumber:11}}),_.default.createElement("canvas",{ref:C,className:"screenshots-canvas-panel",width:(l==null?void 0:l.width)||0,height:(l==null?void 0:l.height)||0,__self:this,__source:{fileName:I,lineNumber:192,columnNumber:11}})),_.default.createElement("div",{className:"screenshots-canvas-mask",style:{cursor:d},onMouseDown:m=>w(m,"move"),__self:this,__source:{fileName:I,lineNumber:199,columnNumber:9}}),Ie.map(m=>_.default.createElement("div",{key:m,className:`screenshots-canvas-border-${m}`,__self:this,__source:{fileName:I,lineNumber:207,columnNumber:18}})),We.map(m=>_.default.createElement("div",{key:m,className:`screenshots-canvas-point-${m}`,onMouseDown:v=>w(v,m),__self:this,__source:{fileName:I,lineNumber:211,columnNumber:13}})))}));function Ne(){const e=re();return i.useCallback((o,...a)=>{var s;(s=e.call)==null||s.call(e,o,...a)},[e])}function H(){const{canvasContextRef:e}=P();return e}function Ce(){const e=J(),[,t]=q(),[,o]=A(),[,a]=X(),[,s]=T();return i.useCallback(()=>{e.reset(),a.reset(),t.reset(),o.reset(),s.reset()},[e,a,t,o,s])}var pe="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsOption\\index.tsx",Ve=i.memo(function({open:t,content:o,children:a}){var y,C;const s=i.useRef(null),r=i.useRef(null),n=i.useRef(null),c=i.useContext(Ye),[p,d]=i.useState("bottom"),[l,u]=i.useState(null),[f,h]=i.useState(0),b=()=>(r.current||(r.current=document.createElement("div")),r.current);return i.useEffect(()=>{const x=b();return t&&document.body.appendChild(x),()=>{x.remove()}},[t]),i.useEffect(()=>{if(!t||!c||!s.current||!n.current)return;const x=s.current.getBoundingClientRect(),S=n.current.getBoundingClientRect();let w=p,g=x.left+x.width/2,m=x.top+x.height,v=f;if(g+S.width/2>c.x+c.width){const N=g;g=c.x+c.width-S.width/2,v=N-g}if(g<c.x+S.width/2){const N=g;g=c.x+S.width/2,v=N-g}m>window.innerHeight-S.height&&(w==="bottom"&&(w="top"),m=x.top-S.height),m<0&&(w==="top"&&(w="bottom"),m=x.top+x.height),w!==p&&d(w),((l==null?void 0:l.x)!==g||l.y!==m)&&u({x:g,y:m}),v!==f&&h(v)}),_.default.createElement(_.default.Fragment,null,i.cloneElement(a,{ref:s}),t&&o&&De.createPortal(_.default.createElement("div",{ref:n,className:"screenshots-option",style:{visibility:l?"visible":"hidden",transform:`translate(${(y=l==null?void 0:l.x)!=null?y:0}px, ${(C=l==null?void 0:l.y)!=null?C:0}px)`},"data-placement":p,__self:this,__source:{fileName:pe,lineNumber:111,columnNumber:11}},_.default.createElement("div",{className:"screenshots-option-container",__self:this,__source:{fileName:pe,lineNumber:120,columnNumber:13}},o),_.default.createElement("div",{className:"screenshots-option-arrow",style:{marginLeft:f},__self:this,__source:{fileName:pe,lineNumber:121,columnNumber:13}})),b()))});var be="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsButton\\index.tsx",Y=i.memo(function({title:t,icon:o,checked:a,disabled:s,option:r,onClick:n}){const c=["screenshots-button"],p=i.useCallback(d=>{s||!n||n(d)},[s,n]);return a&&c.push("screenshots-button-checked"),s&&c.push("screenshots-button-disabled"),_.default.createElement(Ve,{open:a,content:r,__self:this,__source:{fileName:be,lineNumber:42,columnNumber:5}},_.default.createElement("div",{className:c.join(" "),title:t,onClick:p,__self:this,__source:{fileName:be,lineNumber:43,columnNumber:7}},_.default.createElement("span",{className:o,__self:this,__source:{fileName:be,lineNumber:44,columnNumber:9}})))}),qe="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Ok\\index.tsx";function Je(){const{image:e,width:t,height:o,history:a,bounds:s,lang:r}=P(),n=H(),[,c]=X(),p=Ne(),d=Ce(),l=i.useCallback(()=>{c.clearSelect(),setTimeout(()=>{!n.current||!e||!s||fe({image:e,width:t,height:o,history:a,bounds:s}).then(u=>{p("onOk",u,s),d()})})},[n,c,e,t,o,a,s,p,d]);return _.default.createElement(Y,{title:r.operation_ok_title,icon:"icon-ok",onClick:l,__self:this,__source:{fileName:qe,lineNumber:36,columnNumber:10}})}var Qe="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Cancel\\index.tsx";function Ke(){const e=Ne(),t=Ce(),o=U(),a=i.useCallback(()=>{e("onCancel"),t()},[e,t]);return _.default.createElement(Y,{title:o.operation_cancel_title,icon:"icon-cancel",onClick:a,__self:this,__source:{fileName:Qe,lineNumber:17,columnNumber:10}})}var Ze="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Save\\index.tsx";function et(){const{image:e,width:t,height:o,history:a,bounds:s,lang:r}=P(),n=H(),[,c]=X(),p=Ne(),d=Ce(),l=i.useCallback(()=>{c.clearSelect(),setTimeout(()=>{!n.current||!e||!s||fe({image:e,width:t,height:o,history:a,bounds:s}).then(u=>{p("onSave",u,s),d()})})},[n,c,e,t,o,a,s,p,d]);return _.default.createElement(Y,{title:r.operation_save_title,icon:"icon-save",onClick:l,__self:this,__source:{fileName:Ze,lineNumber:36,columnNumber:10}})}var tt="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Redo\\index.tsx";function nt(){const e=U(),[t,o]=X(),a=i.useCallback(()=>{o.redo()},[o]);return _.default.createElement(Y,{title:e.operation_redo_title,icon:"icon-redo",disabled:!t.stack.length||t.stack.length-1===t.index,onClick:a,__self:this,__source:{fileName:tt,lineNumber:15,columnNumber:5}})}var st="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Undo\\index.tsx";function rt(){const e=U(),[t,o]=X(),a=i.useCallback(()=>{o.undo()},[o]);return _.default.createElement(Y,{title:e.operation_undo_title,icon:"icon-undo",disabled:t.index===-1,onClick:a,__self:this,__source:{fileName:st,lineNumber:15,columnNumber:5}})}var ge="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsSize\\index.tsx",Be=i.memo(function({value:t,onChange:o}){const a=[3,6,9];return _.default.createElement("div",{className:"screenshots-size",__self:this,__source:{fileName:ge,lineNumber:12,columnNumber:5}},a.map(s=>{const r=["screenshots-size-item"];return s===t&&r.push("screenshots-size-active"),_.default.createElement("div",{key:s,className:r.join(" "),onClick:()=>o&&o(s),__self:this,__source:{fileName:ge,lineNumber:21,columnNumber:11}},_.default.createElement("div",{className:"screenshots-size-pointer",style:{width:s*1.8,height:s*1.8},__self:this,__source:{fileName:ge,lineNumber:22,columnNumber:13}}))}))});function Q(e){const t=J();i.useEffect(()=>(t.on("mousedown",e),()=>{t.off("mousedown",e)}),[e,t])}function K(e){const t=J();i.useEffect(()=>(t.on("mousemove",e),()=>{t.off("mousemove",e)}),[e,t])}function Z(e){const t=J();i.useEffect(()=>(t.on("mouseup",e),()=>{t.off("mouseup",e)}),[e,t])}var Se="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Mosaic\\index.tsx";function le(e,t,o){if(!o)return[0,0,0,0];const{data:a,width:s}=o,r=t*s*4+e*4;return Array.from(a.slice(r,r+4))}function ot(e,t){const{tiles:o,size:a}=t.data;o.forEach(s=>{const r=Math.round(s.color[0]),n=Math.round(s.color[1]),c=Math.round(s.color[2]),p=s.color[3]/255;e.fillStyle=`rgba(${r}, ${n}, ${c}, ${p})`,e.fillRect(s.x-a/2,s.y-a/2,a,a)})}function ct(){const e=U(),{image:t,width:o,height:a}=P(),[s,r]=T(),n=H(),[c,p]=X(),[d]=q(),[,l]=A(),[u,f]=i.useState(3),h=i.useRef(null),b=i.useRef(null),y=s==="Mosaic",C=i.useCallback(()=>{r.set("Mosaic"),l.set("crosshair")},[r,l]),x=i.useCallback(()=>{y||(C(),p.clearSelect())},[y,C,p]),S=i.useCallback(m=>{if(!y||b.current||!h.current||!n.current)return;const v=n.current.canvas.getBoundingClientRect(),N=m.clientX-v.x,k=m.clientY-v.y,z=u*2;b.current={name:"Mosaic",type:D.Source,data:{size:z,tiles:[{x:N,y:k,color:le(N,k,h.current)}]},editHistory:[],draw:ot}},[y,u,n]),w=i.useCallback(m=>{if(!y||!b.current||!n.current||!h.current)return;const v=n.current.canvas.getBoundingClientRect(),N=m.clientX-v.x,k=m.clientY-v.y,z=b.current.data.size,E=b.current.data.tiles;let R=E[E.length-1];if(!R)E.push({x:N,y:k,color:le(N,k,h.current)});else{const ie=R.x-N,M=R.y-k;let L=Math.sqrt(ie**2+M**2);const me=-M/L,de=-ie/L;for(;L>z;){const ee=Math.floor(R.x+z*de),te=Math.floor(R.y+z*me);R={x:ee,y:te,color:le(ee,te,h.current)},E.push(R),L-=z}L>z/2&&E.push({x:N,y:k,color:le(N,k,h.current)})}c.top!==b.current?p.push(b.current):p.set(c)},[y,n,c,p]),g=i.useCallback(()=>{!y||(b.current=null)},[y]);return Q(S),K(w),Z(g),i.useEffect(()=>{if(!d||!t||!y)return;const m=document.createElement("canvas"),v=m.getContext("2d");if(!v)return;m.width=d.width,m.height=d.height;const N=t.naturalWidth/o,k=t.naturalHeight/a;v.drawImage(t,d.x*N,d.y*k,d.width*N,d.height*k,0,0,d.width,d.height),h.current=v.getImageData(0,0,d.width,d.height)},[o,a,d,t,y]),_.default.createElement(Y,{title:e.operation_mosaic_title,icon:"icon-mosaic",checked:y,onClick:x,option:_.default.createElement(Be,{value:u,onChange:f,__self:this,__source:{fileName:Se,lineNumber:220,columnNumber:15}}),__self:this,__source:{fileName:Se,lineNumber:215,columnNumber:5}})}var ke="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsColor\\index.tsx",it=i.memo(function({value:t,onChange:o}){const a=["#ee5126","#fceb4d","#90e746","#51c0fa","#7a7a7a","#ffffff"];return _.default.createElement("div",{className:"screenshots-color",__self:this,__source:{fileName:ke,lineNumber:12,columnNumber:5}},a.map(s=>{const r=["screenshots-color-item"];return s===t&&r.push("screenshots-color-active"),_.default.createElement("div",{key:s,className:r.join(" "),style:{backgroundColor:s},onClick:()=>o&&o(s),__self:this,__source:{fileName:ke,lineNumber:19,columnNumber:11}})}))});var _e="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsSizeColor\\index.tsx",oe=i.memo(function({size:t,color:o,onSizeChange:a,onColorChange:s}){return _.default.createElement("div",{className:"screenshots-sizecolor",__self:this,__source:{fileName:_e,lineNumber:20,columnNumber:5}},_.default.createElement(Be,{value:t,onChange:a,__self:this,__source:{fileName:_e,lineNumber:21,columnNumber:7}}),_.default.createElement(it,{value:o,onChange:s,__self:this,__source:{fileName:_e,lineNumber:22,columnNumber:7}}))});const at=`
|
|
2
2
|
min-width: 0 !important;
|
|
3
3
|
width: 0 !important;
|
|
4
4
|
min-height: 0 !important;
|
|
@@ -9,6 +9,6 @@ position: absolute !important;
|
|
|
9
9
|
z-index: -1000 !important;
|
|
10
10
|
top:0 !important;
|
|
11
11
|
right:0 !important;
|
|
12
|
-
`,
|
|
13
|
-
`).forEach((d,l)=>{e.fillText(d,
|
|
14
|
-
`).forEach(u=>{const h=e.measureText(u);c<h.width&&(c=h.width),r+=t.data.size});const{x:o,y:s}=t.editHistory.reduce((u,{data:h})=>({x:u.x+h.x2-h.x1,y:u.y+h.y2-h.y1}),{x:0,y:0}),a=t.data.x+o,m=t.data.y+s,d=a+c,l=m+r;return n.x>=a&&n.x<=d&&n.y>=m&&n.y<=l}function zt(){const e=T(),[t,n]=X(),[c]=J(),[r,o]=I(),[,s]=A(),a=W(),[m,d]=i.useState(3),[l,u]=i.useState("#ee5126"),h=i.useRef(null),f=i.useRef(null),[g,y]=i.useState(null),[C,v]=i.useState(""),R=r==="Text",w=i.useCallback(()=>{o.set("Text"),s.set("default")},[o,s]),_=i.useCallback(()=>{R||(w(),n.clearSelect())},[R,w,n]),p=i.useCallback(D=>{h.current&&(h.current.data.size=ze[D]),d(D)},[]),x=i.useCallback(D=>{h.current&&(h.current.data.color=D),u(D)},[]),N=i.useCallback(D=>{v(D),R&&h.current&&(h.current.data.text=D)},[R]),k=i.useCallback(()=>{h.current&&h.current.data.text&&n.push(h.current),h.current=null,v(""),y(null)},[n]),E=i.useCallback((D,H)=>{D.name==="Text"&&(w(),f.current={type:B.Edit,data:{x1:H.clientX,y1:H.clientY,x2:H.clientX,y2:H.clientY},source:D},n.select(D))},[w,n]),z=i.useCallback(D=>{if(!R||!a.current||h.current||!c)return;const{left:H,top:be}=a.current.canvas.getBoundingClientRect(),xe=window.getComputedStyle(a.current.canvas).fontFamily,re=D.clientX-H,oe=D.clientY-be;h.current={name:"Text",type:B.Source,data:{size:ze[m],color:l,fontFamily:xe,x:re,y:oe,text:""},editHistory:[],draw:kt,isHit:wt},y({x:D.clientX,y:D.clientY,maxWidth:c.width-re,maxHeight:c.height-oe})},[R,m,l,c,a]),S=i.useCallback(D=>{!R||f.current&&(f.current.data.x2=D.clientX,f.current.data.y2=D.clientY,t.top!==f.current?(f.current.source.editHistory.push(f.current),n.push(f.current)):n.set(t))},[R,t,n]),U=i.useCallback(()=>{!R||(f.current=null)},[R]);return ae(E),te(z),ne(S),se(U),b.default.createElement(b.default.Fragment,null,b.default.createElement(P,{title:e.operation_text_title,icon:"icon-text",checked:R,onClick:_,option:b.default.createElement(ie,{size:m,color:l,onSizeChange:p,onColorChange:x,__self:this,__source:{fileName:we,lineNumber:261,columnNumber:11}}),__self:this,__source:{fileName:we,lineNumber:255,columnNumber:7}}),R&&g&&b.default.createElement(Rt,{x:g.x,y:g.y,maxWidth:g.maxWidth,maxHeight:g.maxHeight,size:ze[m],color:l,value:C,onChange:N,onBlur:k,__self:this,__source:{fileName:we,lineNumber:265,columnNumber:9}}))}const Ye=4;function M(e,t,n){e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",e.beginPath(),e.arc(t,n,Ye,0,2*Math.PI),e.fill(),e.stroke()}function _e(e,t,n){t.draw(e,t);const{data:c}=e.getImageData(n.x,n.y,1,1);return c.some(r=>r!==0)}function $(e,t,n){if(!e)return!1;const{left:c,top:r}=e.getBoundingClientRect(),o=t.clientX-c,s=t.clientY-r;return(n.x-o)**2+(n.y-s)**2<Ye**2}function Et(e,t){const{size:n,color:c,points:r}=t.data;e.lineCap="round",e.lineJoin="round",e.lineWidth=n,e.strokeStyle=c;const o=t.editHistory.reduce((s,{data:a})=>({x:s.x+a.x2-a.x1,y:s.y+a.y2-a.y1}),{x:0,y:0});e.beginPath(),r.forEach((s,a)=>{a===0?e.moveTo(s.x+o.x,s.y+o.y):e.lineTo(s.x+o.x,s.y+o.y)}),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.beginPath(),r.forEach((s,a)=>{a===0?e.moveTo(s.x+o.x,s.y+o.y):e.lineTo(s.x+o.x,s.y+o.y)}),e.stroke())}var Fe="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Brush/index.tsx";function Bt(){const e=T(),[,t]=A(),[n,c]=I(),r=W(),[o,s]=X(),[a,m]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),h=i.useRef(null),f=n==="Brush",g=i.useCallback(()=>{c.set("Brush"),t.set("default")},[c,t]),y=i.useCallback(()=>{f||(g(),s.clearSelect())},[f,g,s]),C=i.useCallback((_,p)=>{_.name==="Brush"&&(g(),h.current={type:B.Edit,data:{x1:p.clientX,y1:p.clientY,x2:p.clientX,y2:p.clientY},source:_},s.select(_))},[g,s]),v=i.useCallback(_=>{if(!f||u.current||!r.current)return;const{left:p,top:x}=r.current.canvas.getBoundingClientRect();u.current={name:"Brush",type:B.Source,data:{size:a,color:d,points:[{x:_.clientX-p,y:_.clientY-x}]},editHistory:[],draw:Et,isHit:_e}},[f,r,a,d]),R=i.useCallback(_=>{if(!(!f||!r.current)){if(h.current)h.current.data.x2=_.clientX,h.current.data.y2=_.clientY,o.top!==h.current?(h.current.source.editHistory.push(h.current),s.push(h.current)):s.set(o);else if(u.current){const{left:p,top:x}=r.current.canvas.getBoundingClientRect();u.current.data.points.push({x:_.clientX-p,y:_.clientY-x}),o.top!==u.current?s.push(u.current):s.set(o)}}},[f,o,r,s]),w=i.useCallback(()=>{!f||(u.current&&s.clearSelect(),u.current=null,h.current=null)},[f,s]);return ae(C),te(v),ne(R),se(w),b.default.createElement(P,{title:e.operation_brush_title,icon:"icon-brush",checked:f,onClick:y,option:b.default.createElement(ie,{size:a,color:d,onSizeChange:m,onColorChange:l,__self:this,__source:{fileName:Fe,lineNumber:166,columnNumber:15}}),__self:this,__source:{fileName:Fe,lineNumber:161,columnNumber:5}})}function Te(e){let{x1:t,y1:n,x2:c,y2:r}=e.data;return e.editHistory.forEach(({data:o})=>{const s=o.x2-o.x1,a=o.y2-o.y1;o.type===le.Move?(t+=s,n+=a,c+=s,r+=a):o.type===le.MoveStart?(t+=s,n+=a):o.type===le.MoveEnd&&(c+=s,r+=a)}),me(G({},e.data),{x1:t,x2:c,y1:n,y2:r})}function Dt(e,t){const{size:n,color:c,x1:r,x2:o,y1:s,y2:a}=Te(t);e.lineCap="round",e.lineJoin="bevel",e.lineWidth=n,e.strokeStyle=c;const m=o-r,d=a-s,l=n*3,u=Math.atan2(d,m);e.beginPath(),e.moveTo(r,s),e.lineTo(o,a),e.lineTo(o-l*Math.cos(u-Math.PI/6),a-l*Math.sin(u-Math.PI/6)),e.moveTo(o,a),e.lineTo(o-l*Math.cos(u+Math.PI/6),a-l*Math.sin(u+Math.PI/6)),e.stroke(),t.isSelected&&(M(e,r,s),M(e,o,a))}var je="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Arrow/index.tsx",le;(function(e){e[e.Move=0]="Move",e[e.MoveStart=1]="MoveStart",e[e.MoveEnd=2]="MoveEnd"})(le||(le={}));function Mt(){const e=T(),[,t]=A(),[n,c]=I(),[r,o]=X(),s=W(),[a,m]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),h=i.useRef(null),f=n==="Arrow",g=i.useCallback(()=>{c.set("Arrow"),t.set("default")},[c,t]),y=i.useCallback(()=>{f||(g(),o.clearSelect())},[f,g,o]),C=i.useCallback((_,p)=>{if(_.name!=="Arrow"||!s.current)return;const x=_;g();const{x1:N,y1:k,x2:E,y2:z}=Te(x);let S=0;$(s.current.canvas,p,{x:N,y:k})?S=1:$(s.current.canvas,p,{x:E,y:z})&&(S=2),h.current={type:B.Edit,data:{type:S,x1:p.clientX,y1:p.clientY,x2:p.clientX,y2:p.clientY},source:x},o.select(_)},[s,g,o]),v=i.useCallback(_=>{if(!f||u.current||!s.current)return;const{left:p,top:x}=s.current.canvas.getBoundingClientRect();u.current={name:"Arrow",type:B.Source,data:{size:a,color:d,x1:_.clientX-p,y1:_.clientY-x,x2:_.clientX-p,y2:_.clientY-x},editHistory:[],draw:Dt,isHit:_e}},[f,d,a,s]),R=i.useCallback(_=>{if(!(!f||!s.current)){if(h.current)h.current.data.x2=_.clientX,h.current.data.y2=_.clientY,r.top!==h.current?(h.current.source.editHistory.push(h.current),o.push(h.current)):o.set(r);else if(u.current){const{left:p,top:x}=s.current.canvas.getBoundingClientRect();u.current.data.x2=_.clientX-p,u.current.data.y2=_.clientY-x,r.top!==u.current?o.push(u.current):o.set(r)}}},[f,r,s,o]),w=i.useCallback(()=>{!f||(u.current&&o.clearSelect(),u.current=null,h.current=null)},[f,o]);return ae(C),te(v),ne(R),se(w),b.default.createElement(P,{title:e.operation_arrow_title,icon:"icon-arrow",checked:f,onClick:y,option:b.default.createElement(ie,{size:a,color:d,onSizeChange:m,onColorChange:l,__self:this,__source:{fileName:je,lineNumber:190,columnNumber:15}}),__self:this,__source:{fileName:je,lineNumber:185,columnNumber:5}})}function Ue(e){let{x1:t,y1:n,x2:c,y2:r}=e.data;return e.editHistory.forEach(({data:o})=>{const s=o.x2-o.x1,a=o.y2-o.y1;o.type===Y.Move?(t+=s,n+=a,c+=s,r+=a):o.type===Y.ResizeTop?n+=a:o.type===Y.ResizeRightTop?(c+=s,n+=a):o.type===Y.ResizeRight?c+=s:o.type===Y.ResizeRightBottom?(c+=s,r+=a):o.type===Y.ResizeBottom?r+=a:o.type===Y.ResizeLeftBottom?(t+=s,r+=a):o.type===Y.ResizeLeft?t+=s:o.type===Y.ResizeLeftTop&&(t+=s,n+=a)}),me(G({},e.data),{x1:t,x2:c,y1:n,y2:r})}function $t(e,t){const{size:n,color:c,x1:r,y1:o,x2:s,y2:a}=Ue(t);e.lineCap="butt",e.lineJoin="miter",e.lineWidth=n,e.strokeStyle=c;const m=(r+s)/2,d=(o+a)/2,l=Math.abs(s-r)/2,u=Math.abs(a-o)/2,h=.5522848,f=l*h,g=u*h;e.beginPath(),e.moveTo(m-l,d),e.bezierCurveTo(m-l,d-g,m-f,d-u,m,d-u),e.bezierCurveTo(m+f,d-u,m+l,d-g,m+l,d),e.bezierCurveTo(m+l,d+g,m+f,d+u,m,d+u),e.bezierCurveTo(m-f,d+u,m-l,d+g,m-l,d),e.closePath(),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",e.beginPath(),e.moveTo(r,o),e.lineTo(s,o),e.lineTo(s,a),e.lineTo(r,a),e.closePath(),e.stroke(),M(e,(r+s)/2,o),M(e,s,o),M(e,s,(o+a)/2),M(e,s,a),M(e,(r+s)/2,a),M(e,r,a),M(e,r,(o+a)/2),M(e,r,o))}var Ge="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Ellipse/index.tsx",Y;(function(e){e[e.Move=0]="Move",e[e.ResizeTop=1]="ResizeTop",e[e.ResizeRightTop=2]="ResizeRightTop",e[e.ResizeRight=3]="ResizeRight",e[e.ResizeRightBottom=4]="ResizeRightBottom",e[e.ResizeBottom=5]="ResizeBottom",e[e.ResizeLeftBottom=6]="ResizeLeftBottom",e[e.ResizeLeft=7]="ResizeLeft",e[e.ResizeLeftTop=8]="ResizeLeftTop"})(Y||(Y={}));function Lt(){const e=T(),[t,n]=X(),[c,r]=I(),[,o]=A(),s=W(),[a,m]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),h=i.useRef(null),f=c==="Ellipse",g=i.useCallback(()=>{r.set("Ellipse"),o.set("crosshair")},[r,o]),y=i.useCallback(()=>{f||(g(),n.clearSelect())},[f,g,n]),C=i.useCallback((_,p)=>{if(_.name!=="Ellipse"||!s.current)return;const x=_;g();const{x1:N,y1:k,x2:E,y2:z}=Ue(x);let S=0;$(s.current.canvas,p,{x:(N+E)/2,y:k})?S=1:$(s.current.canvas,p,{x:E,y:k})?S=2:$(s.current.canvas,p,{x:E,y:(k+z)/2})?S=3:$(s.current.canvas,p,{x:E,y:z})?S=4:$(s.current.canvas,p,{x:(N+E)/2,y:z})?S=5:$(s.current.canvas,p,{x:N,y:z})?S=6:$(s.current.canvas,p,{x:N,y:(k+z)/2})?S=7:$(s.current.canvas,p,{x:N,y:k})&&(S=8),h.current={type:B.Edit,data:{type:S,x1:p.clientX,y1:p.clientY,x2:p.clientX,y2:p.clientY},source:x},n.select(_)},[s,g,n]),v=i.useCallback(_=>{if(!f||!s.current||u.current)return;const{left:p,top:x}=s.current.canvas.getBoundingClientRect(),N=_.clientX-p,k=_.clientY-x;u.current={name:"Ellipse",type:B.Source,data:{size:a,color:d,x1:N,y1:k,x2:N,y2:k},editHistory:[],draw:$t,isHit:_e}},[f,a,d,s]),R=i.useCallback(_=>{if(!(!f||!s.current)){if(h.current)h.current.data.x2=_.clientX,h.current.data.y2=_.clientY,t.top!==h.current?(h.current.source.editHistory.push(h.current),n.push(h.current)):n.set(t);else if(u.current){const{left:p,top:x}=s.current.canvas.getBoundingClientRect();u.current.data.x2=_.clientX-p,u.current.data.y2=_.clientY-x,t.top!==u.current?n.push(u.current):n.set(t)}}},[f,s,t,n]),w=i.useCallback(()=>{!f||(u.current&&n.clearSelect(),u.current=null,h.current=null)},[f,n]);return ae(C),te(v),ne(R),se(w),b.default.createElement(P,{title:e.operation_ellipse_title,icon:"icon-ellipse",checked:f,onClick:y,option:b.default.createElement(ie,{size:a,color:d,onSizeChange:m,onColorChange:l,__self:this,__source:{fileName:Ge,lineNumber:242,columnNumber:15}}),__self:this,__source:{fileName:Ge,lineNumber:237,columnNumber:5}})}function Ae(e){let{x1:t,y1:n,x2:c,y2:r}=e.data;return e.editHistory.forEach(({data:o})=>{const s=o.x2-o.x1,a=o.y2-o.y1;o.type===F.Move?(t+=s,n+=a,c+=s,r+=a):o.type===F.ResizeTop?n+=a:o.type===F.ResizeRightTop?(c+=s,n+=a):o.type===F.ResizeRight?c+=s:o.type===F.ResizeRightBottom?(c+=s,r+=a):o.type===F.ResizeBottom?r+=a:o.type===F.ResizeLeftBottom?(t+=s,r+=a):o.type===F.ResizeLeft?t+=s:o.type===F.ResizeLeftTop&&(t+=s,n+=a)}),me(G({},e.data),{x1:t,x2:c,y1:n,y2:r})}function Ht(e,t){const{size:n,color:c,x1:r,y1:o,x2:s,y2:a}=Ae(t);e.lineCap="butt",e.lineJoin="miter",e.lineWidth=n,e.strokeStyle=c,e.beginPath(),e.moveTo(r,o),e.lineTo(s,o),e.lineTo(s,a),e.lineTo(r,a),e.closePath(),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",M(e,(r+s)/2,o),M(e,s,o),M(e,s,(o+a)/2),M(e,s,a),M(e,(r+s)/2,a),M(e,r,a),M(e,r,(o+a)/2),M(e,r,o))}var Ie="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/operations/Rectangle/index.tsx",F;(function(e){e[e.Move=0]="Move",e[e.ResizeTop=1]="ResizeTop",e[e.ResizeRightTop=2]="ResizeRightTop",e[e.ResizeRight=3]="ResizeRight",e[e.ResizeRightBottom=4]="ResizeRightBottom",e[e.ResizeBottom=5]="ResizeBottom",e[e.ResizeLeftBottom=6]="ResizeLeftBottom",e[e.ResizeLeft=7]="ResizeLeft",e[e.ResizeLeftTop=8]="ResizeLeftTop"})(F||(F={}));function Xt(){const e=T(),[t,n]=X(),[c,r]=I(),[,o]=A(),s=W(),[a,m]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),h=i.useRef(null),f=c==="Rectangle",g=i.useCallback(()=>{r.set("Rectangle"),o.set("crosshair")},[r,o]),y=i.useCallback(()=>{f||(g(),n.clearSelect())},[f,g,n]),C=i.useCallback((_,p)=>{if(_.name!=="Rectangle"||!s.current)return;const x=_;g();const{x1:N,y1:k,x2:E,y2:z}=Ae(x);let S=0;$(s.current.canvas,p,{x:(N+E)/2,y:k})?S=1:$(s.current.canvas,p,{x:E,y:k})?S=2:$(s.current.canvas,p,{x:E,y:(k+z)/2})?S=3:$(s.current.canvas,p,{x:E,y:z})?S=4:$(s.current.canvas,p,{x:(N+E)/2,y:z})?S=5:$(s.current.canvas,p,{x:N,y:z})?S=6:$(s.current.canvas,p,{x:N,y:(k+z)/2})?S=7:$(s.current.canvas,p,{x:N,y:k})&&(S=8),h.current={type:B.Edit,data:{type:S,x1:p.clientX,y1:p.clientY,x2:p.clientX,y2:p.clientY},source:_},n.select(_)},[s,g,n]),v=i.useCallback(_=>{if(!f||!s.current||u.current)return;const{left:p,top:x}=s.current.canvas.getBoundingClientRect(),N=_.clientX-p,k=_.clientY-x;u.current={name:"Rectangle",type:B.Source,data:{size:a,color:d,x1:N,y1:k,x2:N,y2:k},editHistory:[],draw:Ht,isHit:_e}},[f,a,d,s]),R=i.useCallback(_=>{if(!(!f||!s.current)){if(h.current)h.current.data.x2=_.clientX,h.current.data.y2=_.clientY,t.top!==h.current?(h.current.source.editHistory.push(h.current),n.push(h.current)):n.set(t);else if(u.current){const{left:p,top:x}=s.current.canvas.getBoundingClientRect(),N=u.current.data;N.x2=_.clientX-p,N.y2=_.clientY-x,t.top!==u.current?n.push(u.current):n.set(t)}}},[f,s,t,n]),w=i.useCallback(()=>{!f||(u.current&&n.clearSelect(),u.current=null,h.current=null)},[f,n]);return ae(C),te(v),ne(R),se(w),b.default.createElement(P,{title:e.operation_rectangle_title,icon:"icon-rectangle",checked:f,onClick:y,option:b.default.createElement(ie,{size:a,color:d,onSizeChange:m,onColorChange:l,__self:this,__source:{fileName:Ie,lineNumber:242,columnNumber:15}}),__self:this,__source:{fileName:Ie,lineNumber:237,columnNumber:5}})}var Pt=[Xt,Lt,Mt,Bt,zt,bt,"|",gt,dt,"|",ht,ut,at];var ue="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/ScreenshotsOperations/index.tsx";const We=b.default.createContext(null);var Yt=i.memo(function(){var u,h;const{width:t,height:n}=L(),[c]=J(),[r,o]=i.useState(null),[s,a]=i.useState(null),m=i.useRef(null),d=i.useCallback(f=>{f.stopPropagation()},[]),l=i.useCallback(f=>{f.preventDefault(),f.stopPropagation()},[]);return i.useEffect(()=>{if(!c||!m.current)return;const f=m.current.getBoundingClientRect();let g=c.x+c.width-f.width,y=c.y+c.height+10;g<0&&(g=0),g>t-f.width&&(g=t-f.width),y>n-f.height&&(y=n-f.height-10),((s==null?void 0:s.x)!==g||s.y!==y)&&a({x:g,y}),((r==null?void 0:r.x)!==f.x||r.y!==f.y||r.width!==f.width||r.height!==f.height)&&o({x:f.x,y:f.y,width:f.width,height:f.height})}),c?b.default.createElement(We.Provider,{value:r,__self:this,__source:{fileName:ue,lineNumber:76,columnNumber:5}},b.default.createElement("div",{ref:m,className:"screenshots-operations",style:{visibility:s?"visible":"hidden",transform:`translate(${(u=s==null?void 0:s.x)!=null?u:0}px, ${(h=s==null?void 0:s.y)!=null?h:0}px)`},onDoubleClick:d,onContextMenu:l,__self:this,__source:{fileName:ue,lineNumber:77,columnNumber:7}},b.default.createElement("div",{className:"screenshots-operations-buttons",__self:this,__source:{fileName:ue,lineNumber:87,columnNumber:9}},Pt.map((f,g)=>f==="|"?b.default.createElement("div",{key:g,className:"screenshots-operations-divider",__self:this,__source:{fileName:ue,lineNumber:90,columnNumber:22}}):b.default.createElement(f,{key:g,__self:this,__source:{fileName:ue,lineNumber:92,columnNumber:22}}))))):null});function Ft(e){const[t,n]=i.useState(null);return i.useEffect(()=>{if(n(null),e==null)return;const c=document.createElement("img"),r=()=>n(c),o=()=>n(null);return c.addEventListener("load",r),c.addEventListener("error",o),c.src=e,()=>{c.removeEventListener("load",r),c.removeEventListener("error",o)}},[e]),t}var fe="/Users/nashaofu/Documents/GitHub/screenshots/packages/react-screenshots/src/Screenshots/index.tsx";function Tt(s){var a=s,{url:e,width:t,height:n,lang:c,className:r}=a,o=Me(a,["url","width","height","lang","className"]);const m=Ft(e),d=i.useRef(null),l=i.useRef({}),[u,h]=i.useState({index:-1,stack:[]}),[f,g]=i.useState(null),[y,C]=i.useState("move"),[v,R]=i.useState(void 0),w={url:e,width:t,height:n,image:m,lang:G(G({},Le),c),emiterRef:l,canvasContextRef:d,history:u,bounds:f,cursor:y,operation:v},_=i.useCallback((z,...S)=>{const U=o[z];typeof U=="function"&&U(...S)},[o]),p={call:_,setHistory:h,setBounds:g,setCursor:C,setOperation:R},x=["screenshots"];r&&x.push(r);const N=()=>{l.current={},h({index:-1,stack:[]}),g(null),C("move"),R(void 0)},k=i.useCallback(async z=>{if(!(z.button!==0||!m))if(f&&d.current)de({image:m,width:t,height:n,history:u,bounds:f}).then(S=>{_("onOk",S,f),N()});else{const S={x:0,y:0,width:t,height:n};de({image:m,width:t,height:n,history:u,bounds:S}).then(U=>{_("onOk",U,S),N()})}},[m,u,f,t,n,_]),E=i.useCallback(z=>{z.button===2&&(z.preventDefault(),_("onCancel"),N())},[_]);return i.useLayoutEffect(()=>{N()},[e]),b.default.createElement(ve.Provider,{value:{store:w,dispatcher:p},__self:this,__source:{fileName:fe,lineNumber:142,columnNumber:5}},b.default.createElement("div",{className:x.join(" "),style:{width:t,height:n},onDoubleClick:k,onContextMenu:E,__self:this,__source:{fileName:fe,lineNumber:143,columnNumber:7}},b.default.createElement(Ze,{__self:this,__source:{fileName:fe,lineNumber:149,columnNumber:9}}),b.default.createElement(ot,{ref:d,__self:this,__source:{fileName:fe,lineNumber:150,columnNumber:9}}),b.default.createElement(Yt,{__self:this,__source:{fileName:fe,lineNumber:151,columnNumber:9}})))}module.exports=Tt;
|
|
12
|
+
`,lt=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","text-indent","padding-left","padding-right","border-width","box-sizing","white-space","word-break"];let G;function ut(e){const t=window.getComputedStyle(e),o=t.getPropertyValue("box-sizing")||t.getPropertyValue("-moz-box-sizing")||t.getPropertyValue("-webkit-box-sizing"),a=parseFloat(t.getPropertyValue("padding-bottom"))+parseFloat(t.getPropertyValue("padding-top")),s=parseFloat(t.getPropertyValue("border-bottom-width"))+parseFloat(t.getPropertyValue("border-top-width"));return{sizingStyle:lt.map(n=>`${n}:${t.getPropertyValue(n)}`).join(";"),paddingSize:a,borderSize:s,boxSizing:o}}function ft(e,t,o,a){G||(G=document.createElement("textarea"),G.setAttribute("tab-index","-1"),document.body.appendChild(G));const{paddingSize:s,borderSize:r,boxSizing:n,sizingStyle:c}=ut(e);G.setAttribute("style",`${c};${at};max-width:${o}px;max-height:${a}px`),G.value=t||" ";let p=G.scrollWidth,d=G.scrollHeight;return n==="border-box"?(p+=r,d+=r):n==="content-box"&&(p-=s,d-=s),{width:Math.min(p,o),height:Math.min(d,a)}}var ht="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsTextarea\\index.tsx",mt=i.memo(function({x:t,y:o,maxWidth:a,maxHeight:s,size:r,color:n,value:c,onChange:p,onBlur:d}){const l=i.useRef(null),u=i.useRef(null),[f,h]=i.useState(0),[b,y]=i.useState(0),C=()=>(l.current||(l.current=document.createElement("div")),l.current);return i.useLayoutEffect(()=>(l.current&&(document.body.appendChild(l.current),requestAnimationFrame(()=>{var x;(x=u.current)==null||x.focus()})),()=>{var x;(x=l.current)==null||x.remove()}),[]),i.useLayoutEffect(()=>{if(!u.current)return;const{width:x,height:S}=ft(u.current,c,a,s);h(x),y(S)},[c,a,s]),De.createPortal(_.default.createElement("textarea",{ref:u,className:"screenshots-textarea",style:{color:n,width:f,height:b,maxWidth:a,maxHeight:s,fontSize:r,lineHeight:`${r}px`,transform:`translate(${t}px, ${o}px)`},value:c,onChange:x=>p&&p(x.target.value),onBlur:x=>d&&d(x),__self:this,__source:{fileName:ht,lineNumber:65,columnNumber:5}}),C())});function ce(e){const t=J();i.useEffect(()=>(t.on("drawselect",e),()=>{t.off("drawselect",e)}),[e,t])}var xe="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Text\\index.tsx";const ve={3:18,6:32,9:46};function dt(e,t){const{size:o,color:a,fontFamily:s,x:r,y:n,text:c}=t.data;e.fillStyle=a,e.textAlign="left",e.textBaseline="top",e.font=`${o}px ${s}`;const p=t.editHistory.reduce((d,{data:l})=>({x:d.x+l.x2-l.x1,y:d.y+l.y2-l.y1}),{x:0,y:0});c.split(`
|
|
13
|
+
`).forEach((d,l)=>{e.fillText(d,r+p.x,n+p.y+l*o)})}function pt(e,t,o){e.textAlign="left",e.textBaseline="top",e.font=`${t.data.size}px ${t.data.fontFamily}`;let a=0,s=0;t.data.text.split(`
|
|
14
|
+
`).forEach(u=>{const f=e.measureText(u);a<f.width&&(a=f.width),s+=t.data.size});const{x:r,y:n}=t.editHistory.reduce((u,{data:f})=>({x:u.x+f.x2-f.x1,y:u.y+f.y2-f.y1}),{x:0,y:0}),c=t.data.x+r,p=t.data.y+n,d=c+a,l=p+s;return o.x>=c&&o.x<=d&&o.y>=p&&o.y<=l}function bt(){const e=U(),[t,o]=X(),[a]=q(),[s,r]=T(),[,n]=A(),c=H(),[p,d]=i.useState(3),[l,u]=i.useState("#ee5126"),f=i.useRef(null),h=i.useRef(null),[b,y]=i.useState(null),[C,x]=i.useState(""),S=s==="Text",w=i.useCallback(()=>{r.set("Text"),n.set("default")},[r,n]),g=i.useCallback(()=>{S||(w(),o.clearSelect())},[S,w,o]),m=i.useCallback(M=>{f.current&&(f.current.data.size=ve[M]),d(M)},[]),v=i.useCallback(M=>{f.current&&(f.current.data.color=M),u(M)},[]),N=i.useCallback(M=>{x(M),S&&f.current&&(f.current.data.text=M)},[S]),k=i.useCallback(()=>{f.current&&f.current.data.text&&o.push(f.current),f.current=null,x(""),y(null)},[o]),z=i.useCallback((M,L)=>{M.name==="Text"&&(w(),h.current={type:D.Edit,data:{x1:L.clientX,y1:L.clientY,x2:L.clientX,y2:L.clientY},source:M},o.select(M))},[w,o]),E=i.useCallback(M=>{if(!S||!c.current||f.current||!a)return;const{left:L,top:me}=c.current.canvas.getBoundingClientRect(),de=window.getComputedStyle(c.current.canvas).fontFamily,ee=M.clientX-L,te=M.clientY-me;f.current={name:"Text",type:D.Source,data:{size:ve[p],color:l,fontFamily:de,x:ee,y:te,text:""},editHistory:[],draw:dt,isHit:pt},y({x:M.clientX,y:M.clientY,maxWidth:a.width-ee,maxHeight:a.height-te})},[S,p,l,a,c]),R=i.useCallback(M=>{!S||h.current&&(h.current.data.x2=M.clientX,h.current.data.y2=M.clientY,t.top!==h.current?(h.current.source.editHistory.push(h.current),o.push(h.current)):o.set(t))},[S,t,o]),ie=i.useCallback(()=>{!S||(h.current=null)},[S]);return ce(z),Q(E),K(R),Z(ie),_.default.createElement(_.default.Fragment,null,_.default.createElement(Y,{title:e.operation_text_title,icon:"icon-text",checked:S,onClick:g,option:_.default.createElement(oe,{size:p,color:l,onSizeChange:m,onColorChange:v,__self:this,__source:{fileName:xe,lineNumber:261,columnNumber:11}}),__self:this,__source:{fileName:xe,lineNumber:255,columnNumber:7}}),S&&b&&_.default.createElement(mt,{x:b.x,y:b.y,maxWidth:b.maxWidth,maxHeight:b.maxHeight,size:ve[p],color:l,value:C,onChange:N,onBlur:k,__self:this,__source:{fileName:xe,lineNumber:265,columnNumber:9}}))}const $e=4;function B(e,t,o){e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",e.beginPath(),e.arc(t,o,$e,0,2*Math.PI),e.fill(),e.stroke()}function he(e,t,o){t.draw(e,t);const{data:a}=e.getImageData(o.x,o.y,1,1);return a.some(s=>s!==0)}function $(e,t,o){if(!e)return!1;const{left:a,top:s}=e.getBoundingClientRect(),r=t.clientX-a,n=t.clientY-s;return(o.x-r)**2+(o.y-n)**2<$e**2}function gt(e,t){const{size:o,color:a,points:s}=t.data;e.lineCap="round",e.lineJoin="round",e.lineWidth=o,e.strokeStyle=a;const r=t.editHistory.reduce((n,{data:c})=>({x:n.x+c.x2-c.x1,y:n.y+c.y2-c.y1}),{x:0,y:0});e.beginPath(),s.forEach((n,c)=>{c===0?e.moveTo(n.x+r.x,n.y+r.y):e.lineTo(n.x+r.x,n.y+r.y)}),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.beginPath(),s.forEach((n,c)=>{c===0?e.moveTo(n.x+r.x,n.y+r.y):e.lineTo(n.x+r.x,n.y+r.y)}),e.stroke())}var Re="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Brush\\index.tsx";function _t(){const e=U(),[,t]=A(),[o,a]=T(),s=H(),[r,n]=X(),[c,p]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),f=i.useRef(null),h=o==="Brush",b=i.useCallback(()=>{a.set("Brush"),t.set("default")},[a,t]),y=i.useCallback(()=>{h||(b(),n.clearSelect())},[h,b,n]),C=i.useCallback((g,m)=>{g.name==="Brush"&&(b(),f.current={type:D.Edit,data:{x1:m.clientX,y1:m.clientY,x2:m.clientX,y2:m.clientY},source:g},n.select(g))},[b,n]),x=i.useCallback(g=>{if(!h||u.current||!s.current)return;const{left:m,top:v}=s.current.canvas.getBoundingClientRect();u.current={name:"Brush",type:D.Source,data:{size:c,color:d,points:[{x:g.clientX-m,y:g.clientY-v}]},editHistory:[],draw:gt,isHit:he}},[h,s,c,d]),S=i.useCallback(g=>{if(!(!h||!s.current)){if(f.current)f.current.data.x2=g.clientX,f.current.data.y2=g.clientY,r.top!==f.current?(f.current.source.editHistory.push(f.current),n.push(f.current)):n.set(r);else if(u.current){const{left:m,top:v}=s.current.canvas.getBoundingClientRect();u.current.data.points.push({x:g.clientX-m,y:g.clientY-v}),r.top!==u.current?n.push(u.current):n.set(r)}}},[h,r,s,n]),w=i.useCallback(()=>{!h||(u.current&&n.clearSelect(),u.current=null,f.current=null)},[h,n]);return ce(C),Q(x),K(S),Z(w),_.default.createElement(Y,{title:e.operation_brush_title,icon:"icon-brush",checked:h,onClick:y,option:_.default.createElement(oe,{size:c,color:d,onSizeChange:p,onColorChange:l,__self:this,__source:{fileName:Re,lineNumber:166,columnNumber:15}}),__self:this,__source:{fileName:Re,lineNumber:161,columnNumber:5}})}function Pe(e){let{x1:t,y1:o,x2:a,y2:s}=e.data;return e.editHistory.forEach(({data:r})=>{const n=r.x2-r.x1,c=r.y2-r.y1;r.type===ue.Move?(t+=n,o+=c,a+=n,s+=c):r.type===ue.MoveStart?(t+=n,o+=c):r.type===ue.MoveEnd&&(a+=n,s+=c)}),{...e.data,x1:t,x2:a,y1:o,y2:s}}function xt(e,t){const{size:o,color:a,x1:s,x2:r,y1:n,y2:c}=Pe(t);e.lineCap="round",e.lineJoin="bevel",e.lineWidth=o,e.strokeStyle=a;const p=r-s,d=c-n,l=o*3,u=Math.atan2(d,p);e.beginPath(),e.moveTo(s,n),e.lineTo(r,c),e.lineTo(r-l*Math.cos(u-Math.PI/6),c-l*Math.sin(u-Math.PI/6)),e.moveTo(r,c),e.lineTo(r-l*Math.cos(u+Math.PI/6),c-l*Math.sin(u+Math.PI/6)),e.stroke(),t.isSelected&&(B(e,s,n),B(e,r,c))}var we="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Arrow\\index.tsx",ue=(e=>(e[e.Move=0]="Move",e[e.MoveStart=1]="MoveStart",e[e.MoveEnd=2]="MoveEnd",e))(ue||{});function vt(){const e=U(),[,t]=A(),[o,a]=T(),[s,r]=X(),n=H(),[c,p]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),f=i.useRef(null),h=o==="Arrow",b=i.useCallback(()=>{a.set("Arrow"),t.set("default")},[a,t]),y=i.useCallback(()=>{h||(b(),r.clearSelect())},[h,b,r]),C=i.useCallback((g,m)=>{if(g.name!=="Arrow"||!n.current)return;const v=g;b();const{x1:N,y1:k,x2:z,y2:E}=Pe(v);let R=0;$(n.current.canvas,m,{x:N,y:k})?R=1:$(n.current.canvas,m,{x:z,y:E})&&(R=2),f.current={type:D.Edit,data:{type:R,x1:m.clientX,y1:m.clientY,x2:m.clientX,y2:m.clientY},source:v},r.select(g)},[n,b,r]),x=i.useCallback(g=>{if(!h||u.current||!n.current)return;const{left:m,top:v}=n.current.canvas.getBoundingClientRect();u.current={name:"Arrow",type:D.Source,data:{size:c,color:d,x1:g.clientX-m,y1:g.clientY-v,x2:g.clientX-m,y2:g.clientY-v},editHistory:[],draw:xt,isHit:he}},[h,d,c,n]),S=i.useCallback(g=>{if(!(!h||!n.current)){if(f.current)f.current.data.x2=g.clientX,f.current.data.y2=g.clientY,s.top!==f.current?(f.current.source.editHistory.push(f.current),r.push(f.current)):r.set(s);else if(u.current){const{left:m,top:v}=n.current.canvas.getBoundingClientRect();u.current.data.x2=g.clientX-m,u.current.data.y2=g.clientY-v,s.top!==u.current?r.push(u.current):r.set(s)}}},[h,s,n,r]),w=i.useCallback(()=>{!h||(u.current&&r.clearSelect(),u.current=null,f.current=null)},[h,r]);return ce(C),Q(x),K(S),Z(w),_.default.createElement(Y,{title:e.operation_arrow_title,icon:"icon-arrow",checked:h,onClick:y,option:_.default.createElement(oe,{size:c,color:d,onSizeChange:p,onColorChange:l,__self:this,__source:{fileName:we,lineNumber:190,columnNumber:15}}),__self:this,__source:{fileName:we,lineNumber:185,columnNumber:5}})}function Le(e){let{x1:t,y1:o,x2:a,y2:s}=e.data;return e.editHistory.forEach(({data:r})=>{const n=r.x2-r.x1,c=r.y2-r.y1;r.type===F.Move?(t+=n,o+=c,a+=n,s+=c):r.type===F.ResizeTop?o+=c:r.type===F.ResizeRightTop?(a+=n,o+=c):r.type===F.ResizeRight?a+=n:r.type===F.ResizeRightBottom?(a+=n,s+=c):r.type===F.ResizeBottom?s+=c:r.type===F.ResizeLeftBottom?(t+=n,s+=c):r.type===F.ResizeLeft?t+=n:r.type===F.ResizeLeftTop&&(t+=n,o+=c)}),{...e.data,x1:t,x2:a,y1:o,y2:s}}function yt(e,t){const{size:o,color:a,x1:s,y1:r,x2:n,y2:c}=Le(t);e.lineCap="butt",e.lineJoin="miter",e.lineWidth=o,e.strokeStyle=a;const p=(s+n)/2,d=(r+c)/2,l=Math.abs(n-s)/2,u=Math.abs(c-r)/2,f=.5522848,h=l*f,b=u*f;e.beginPath(),e.moveTo(p-l,d),e.bezierCurveTo(p-l,d-b,p-h,d-u,p,d-u),e.bezierCurveTo(p+h,d-u,p+l,d-b,p+l,d),e.bezierCurveTo(p+l,d+b,p+h,d+u,p,d+u),e.bezierCurveTo(p-h,d+u,p-l,d+b,p-l,d),e.closePath(),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",e.beginPath(),e.moveTo(s,r),e.lineTo(n,r),e.lineTo(n,c),e.lineTo(s,c),e.closePath(),e.stroke(),B(e,(s+n)/2,r),B(e,n,r),B(e,n,(r+c)/2),B(e,n,c),B(e,(s+n)/2,c),B(e,s,c),B(e,s,(r+c)/2),B(e,s,r))}var ze="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Ellipse\\index.tsx",F=(e=>(e[e.Move=0]="Move",e[e.ResizeTop=1]="ResizeTop",e[e.ResizeRightTop=2]="ResizeRightTop",e[e.ResizeRight=3]="ResizeRight",e[e.ResizeRightBottom=4]="ResizeRightBottom",e[e.ResizeBottom=5]="ResizeBottom",e[e.ResizeLeftBottom=6]="ResizeLeftBottom",e[e.ResizeLeft=7]="ResizeLeft",e[e.ResizeLeftTop=8]="ResizeLeftTop",e))(F||{});function Nt(){const e=U(),[t,o]=X(),[a,s]=T(),[,r]=A(),n=H(),[c,p]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),f=i.useRef(null),h=a==="Ellipse",b=i.useCallback(()=>{s.set("Ellipse"),r.set("crosshair")},[s,r]),y=i.useCallback(()=>{h||(b(),o.clearSelect())},[h,b,o]),C=i.useCallback((g,m)=>{if(g.name!=="Ellipse"||!n.current)return;const v=g;b();const{x1:N,y1:k,x2:z,y2:E}=Le(v);let R=0;$(n.current.canvas,m,{x:(N+z)/2,y:k})?R=1:$(n.current.canvas,m,{x:z,y:k})?R=2:$(n.current.canvas,m,{x:z,y:(k+E)/2})?R=3:$(n.current.canvas,m,{x:z,y:E})?R=4:$(n.current.canvas,m,{x:(N+z)/2,y:E})?R=5:$(n.current.canvas,m,{x:N,y:E})?R=6:$(n.current.canvas,m,{x:N,y:(k+E)/2})?R=7:$(n.current.canvas,m,{x:N,y:k})&&(R=8),f.current={type:D.Edit,data:{type:R,x1:m.clientX,y1:m.clientY,x2:m.clientX,y2:m.clientY},source:v},o.select(g)},[n,b,o]),x=i.useCallback(g=>{if(!h||!n.current||u.current)return;const{left:m,top:v}=n.current.canvas.getBoundingClientRect(),N=g.clientX-m,k=g.clientY-v;u.current={name:"Ellipse",type:D.Source,data:{size:c,color:d,x1:N,y1:k,x2:N,y2:k},editHistory:[],draw:yt,isHit:he}},[h,c,d,n]),S=i.useCallback(g=>{if(!(!h||!n.current)){if(f.current)f.current.data.x2=g.clientX,f.current.data.y2=g.clientY,t.top!==f.current?(f.current.source.editHistory.push(f.current),o.push(f.current)):o.set(t);else if(u.current){const{left:m,top:v}=n.current.canvas.getBoundingClientRect();u.current.data.x2=g.clientX-m,u.current.data.y2=g.clientY-v,t.top!==u.current?o.push(u.current):o.set(t)}}},[h,n,t,o]),w=i.useCallback(()=>{!h||(u.current&&o.clearSelect(),u.current=null,f.current=null)},[h,o]);return ce(C),Q(x),K(S),Z(w),_.default.createElement(Y,{title:e.operation_ellipse_title,icon:"icon-ellipse",checked:h,onClick:y,option:_.default.createElement(oe,{size:c,color:d,onSizeChange:p,onColorChange:l,__self:this,__source:{fileName:ze,lineNumber:242,columnNumber:15}}),__self:this,__source:{fileName:ze,lineNumber:237,columnNumber:5}})}function Xe(e){let{x1:t,y1:o,x2:a,y2:s}=e.data;return e.editHistory.forEach(({data:r})=>{const n=r.x2-r.x1,c=r.y2-r.y1;r.type===j.Move?(t+=n,o+=c,a+=n,s+=c):r.type===j.ResizeTop?o+=c:r.type===j.ResizeRightTop?(a+=n,o+=c):r.type===j.ResizeRight?a+=n:r.type===j.ResizeRightBottom?(a+=n,s+=c):r.type===j.ResizeBottom?s+=c:r.type===j.ResizeLeftBottom?(t+=n,s+=c):r.type===j.ResizeLeft?t+=n:r.type===j.ResizeLeftTop&&(t+=n,o+=c)}),{...e.data,x1:t,x2:a,y1:o,y2:s}}function Ct(e,t){const{size:o,color:a,x1:s,y1:r,x2:n,y2:c}=Xe(t);e.lineCap="butt",e.lineJoin="miter",e.lineWidth=o,e.strokeStyle=a,e.beginPath(),e.moveTo(s,r),e.lineTo(n,r),e.lineTo(n,c),e.lineTo(s,c),e.closePath(),e.stroke(),t.isSelected&&(e.lineWidth=1,e.strokeStyle="#000000",e.fillStyle="#ffffff",B(e,(s+n)/2,r),B(e,n,r),B(e,n,(r+c)/2),B(e,n,c),B(e,(s+n)/2,c),B(e,s,c),B(e,s,(r+c)/2),B(e,s,r))}var Ee="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\operations\\Rectangle\\index.tsx",j=(e=>(e[e.Move=0]="Move",e[e.ResizeTop=1]="ResizeTop",e[e.ResizeRightTop=2]="ResizeRightTop",e[e.ResizeRight=3]="ResizeRight",e[e.ResizeRightBottom=4]="ResizeRightBottom",e[e.ResizeBottom=5]="ResizeBottom",e[e.ResizeLeftBottom=6]="ResizeLeftBottom",e[e.ResizeLeft=7]="ResizeLeft",e[e.ResizeLeftTop=8]="ResizeLeftTop",e))(j||{});function St(){const e=U(),[t,o]=X(),[a,s]=T(),[,r]=A(),n=H(),[c,p]=i.useState(3),[d,l]=i.useState("#ee5126"),u=i.useRef(null),f=i.useRef(null),h=a==="Rectangle",b=i.useCallback(()=>{s.set("Rectangle"),r.set("crosshair")},[s,r]),y=i.useCallback(()=>{h||(b(),o.clearSelect())},[h,b,o]),C=i.useCallback((g,m)=>{if(g.name!=="Rectangle"||!n.current)return;const v=g;b();const{x1:N,y1:k,x2:z,y2:E}=Xe(v);let R=0;$(n.current.canvas,m,{x:(N+z)/2,y:k})?R=1:$(n.current.canvas,m,{x:z,y:k})?R=2:$(n.current.canvas,m,{x:z,y:(k+E)/2})?R=3:$(n.current.canvas,m,{x:z,y:E})?R=4:$(n.current.canvas,m,{x:(N+z)/2,y:E})?R=5:$(n.current.canvas,m,{x:N,y:E})?R=6:$(n.current.canvas,m,{x:N,y:(k+E)/2})?R=7:$(n.current.canvas,m,{x:N,y:k})&&(R=8),f.current={type:D.Edit,data:{type:R,x1:m.clientX,y1:m.clientY,x2:m.clientX,y2:m.clientY},source:g},o.select(g)},[n,b,o]),x=i.useCallback(g=>{if(!h||!n.current||u.current)return;const{left:m,top:v}=n.current.canvas.getBoundingClientRect(),N=g.clientX-m,k=g.clientY-v;u.current={name:"Rectangle",type:D.Source,data:{size:c,color:d,x1:N,y1:k,x2:N,y2:k},editHistory:[],draw:Ct,isHit:he}},[h,c,d,n]),S=i.useCallback(g=>{if(!(!h||!n.current)){if(f.current)f.current.data.x2=g.clientX,f.current.data.y2=g.clientY,t.top!==f.current?(f.current.source.editHistory.push(f.current),o.push(f.current)):o.set(t);else if(u.current){const{left:m,top:v}=n.current.canvas.getBoundingClientRect(),N=u.current.data;N.x2=g.clientX-m,N.y2=g.clientY-v,t.top!==u.current?o.push(u.current):o.set(t)}}},[h,n,t,o]),w=i.useCallback(()=>{!h||(u.current&&o.clearSelect(),u.current=null,f.current=null)},[h,o]);return ce(C),Q(x),K(S),Z(w),_.default.createElement(Y,{title:e.operation_rectangle_title,icon:"icon-rectangle",checked:h,onClick:y,option:_.default.createElement(oe,{size:c,color:d,onSizeChange:p,onColorChange:l,__self:this,__source:{fileName:Ee,lineNumber:242,columnNumber:15}}),__self:this,__source:{fileName:Ee,lineNumber:237,columnNumber:5}})}var kt=[St,Nt,vt,_t,bt,ct,"|",rt,nt,"|",et,Ke,Je];var ne="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\ScreenshotsOperations\\index.tsx";const Ye=_.default.createContext(null);var Rt=i.memo(function(){var u,f;const{width:t,height:o}=P(),[a]=q(),[s,r]=i.useState(null),[n,c]=i.useState(null),p=i.useRef(null),d=i.useCallback(h=>{h.stopPropagation()},[]),l=i.useCallback(h=>{h.preventDefault(),h.stopPropagation()},[]);return i.useEffect(()=>{if(!a||!p.current)return;const h=p.current.getBoundingClientRect();let b=a.x+a.width-h.width,y=a.y+a.height+10;b<0&&(b=0),b>t-h.width&&(b=t-h.width),y>o-h.height&&(y=o-h.height-10),(!n||Math.abs(n.x-b)>1||Math.abs(n.y-y)>1)&&c({x:b,y}),(!s||Math.abs(s.x-h.x)>1||Math.abs(s.y-h.y)>1||Math.abs(s.width-h.width)>1||Math.abs(s.height-h.height)>1)&&r({x:h.x,y:h.y,width:h.width,height:h.height})}),a?_.default.createElement(Ye.Provider,{value:s,__self:this,__source:{fileName:ne,lineNumber:79,columnNumber:5}},_.default.createElement("div",{ref:p,className:"screenshots-operations",style:{visibility:n?"visible":"hidden",transform:`translate(${(u=n==null?void 0:n.x)!=null?u:0}px, ${(f=n==null?void 0:n.y)!=null?f:0}px)`},onDoubleClick:d,onContextMenu:l,__self:this,__source:{fileName:ne,lineNumber:80,columnNumber:7}},_.default.createElement("div",{className:"screenshots-operations-buttons",__self:this,__source:{fileName:ne,lineNumber:90,columnNumber:9}},kt.map((h,b)=>h==="|"?_.default.createElement("div",{key:b,className:"screenshots-operations-divider",__self:this,__source:{fileName:ne,lineNumber:93,columnNumber:22}}):_.default.createElement(h,{key:b,__self:this,__source:{fileName:ne,lineNumber:95,columnNumber:22}}))))):null});function wt(e){const[t,o]=i.useState(null);return i.useEffect(()=>{if(o(null),e==null)return;const a=document.createElement("img"),s=()=>o(a),r=()=>o(null);return a.addEventListener("load",s),a.addEventListener("error",r),a.src=e,()=>{a.removeEventListener("load",s),a.removeEventListener("error",r)}},[e]),t}var se="C:\\Users\\nashaofu\\Documents\\Github\\screenshots\\packages\\react-screenshots\\src\\Screenshots\\index.tsx";function zt({url:e,width:t,height:o,lang:a,className:s,...r}){const n=wt(e),c=i.useRef(null),p=i.useRef({}),[d,l]=i.useState({index:-1,stack:[]}),[u,f]=i.useState(null),[h,b]=i.useState("move"),[y,C]=i.useState(void 0),x={url:e,width:t,height:o,image:n,lang:{...Me,...a},emiterRef:p,canvasContextRef:c,history:d,bounds:u,cursor:h,operation:y},S=i.useCallback((k,...z)=>{const E=r[k];typeof E=="function"&&E(...z)},[r]),w={call:S,setHistory:l,setBounds:f,setCursor:b,setOperation:C},g=["screenshots"];s&&g.push(s);const m=()=>{p.current={},l({index:-1,stack:[]}),f(null),b("move"),C(void 0)},v=i.useCallback(async k=>{if(!(k.button!==0||!n))if(u&&c.current)fe({image:n,width:t,height:o,history:d,bounds:u}).then(z=>{S("onOk",z,u),m()});else{const z={x:0,y:0,width:t,height:o};fe({image:n,width:t,height:o,history:d,bounds:z}).then(E=>{S("onOk",E,z),m()})}},[n,d,u,t,o,S]),N=i.useCallback(k=>{k.button===2&&(k.preventDefault(),S("onCancel"),m())},[S]);return i.useLayoutEffect(()=>{m()},[e]),_.default.createElement(ye.Provider,{value:{store:x,dispatcher:w},__self:this,__source:{fileName:se,lineNumber:142,columnNumber:5}},_.default.createElement("div",{className:g.join(" "),style:{width:t,height:o},onDoubleClick:v,onContextMenu:N,__self:this,__source:{fileName:se,lineNumber:143,columnNumber:7}},_.default.createElement(Ge,{__self:this,__source:{fileName:se,lineNumber:149,columnNumber:9}}),_.default.createElement(Oe,{ref:c,__self:this,__source:{fileName:se,lineNumber:150,columnNumber:9}}),_.default.createElement(Rt,{__self:this,__source:{fileName:se,lineNumber:151,columnNumber:9}})))}module.exports=zt;
|