build all

Refactor utility functions for improved readability and consistency

- Updated compatibility.js to use consistent line endings and formatting.
- Refactored component.js for better readability and structure, including consistent use of arrow functions and binding.
- Simplified dom.js functions with consistent formatting and improved readability.
- Enhanced emitter.js with consistent formatting and arrow function usage.
- Streamlined error.js for improved readability and consistency.
- Refactored file.js to use consistent formatting and improved readability.
- Improved format.js functions for better readability and consistency.
- Updated index.js to maintain consistent export formatting.
- Refactored property.js for improved readability and consistency.
- Enhanced subtitle.js with consistent formatting and improved readability.
- Refactored time.js for better readability and consistent formatting.

fix: update lint script to target only source files for consistency

Revert "fix: restore export statements for various plugins and update type definitions for better clarity"

This reverts commit b5e969d81ec765cd8a34b06e6ef4f232ef25087f.

fix: restore export statements for various plugins and update type definitions for better clarity

Refactor type definitions to use interfaces instead of type aliases for better extensibility and clarity across i18n, icons, option, player, quality, setting, subtitle, template, and utils modules.
This commit is contained in:
Harvey Zack committed 2025-08-03 13:17:33 +08:00
1 parent 532dd67cfd
commit 35ad9883af
447 files changed
+18248 -17946

No files matched your search

@@ -5,4 +5,4 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,n,r,i,o,s,c){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof a[r]&&a[r],l=u.i||{},f=u.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!f[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof a[r]&&a[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(h&&"string"==typeof t)return h(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}l.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},l.cache={};var c=f[t]=new p.Module(t);e[t][0].call(c.exports,l,c,c.exports,a)}return f[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=h,this.exports={}},p.modules=e,p.cache=f,p.parent=u,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return a[r]}}),a[r]=p;for(var d=0;d<t.length;d++)p(t[d]);if(n){var v=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({bzF6W:[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return h});var o=e("@swc/helpers/cjs/_call_super.cjs"),s=e("@swc/helpers/cjs/_class_call_check.cjs"),c=e("@swc/helpers/cjs/_create_class.cjs"),a=e("@swc/helpers/cjs/_inherits.cjs"),u=e("./emitter"),l=i.interopDefault(u),f=e("./utils"),h=function(e){"use strict";function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,s._)(this,t),(e=(0,o._)(this,t)).processing=!1,e.option={},e.setup(Object.assign({},t.DEFAULTS,n)),e.video=t.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(e),e.ondrop=e.ondrop.bind(e),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",t.ondragover),e.option.fileInput.addEventListener("drop",t.ondrop),e}return(0,a._)(t,e),(0,c._)(t,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,t);var n=this.option,r=n.fileInput,i=n.number,o=n.width,s=n.column;if(this.errorHandle(r instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==r.tagName||"file"!==r.type){r.style.position="relative";var c=document.createElement("input");c.type="file",c.style.position="absolute",c.style.width="100%",c.style.height="100%",c.style.left="0",c.style.top="0",c.style.right="0",c.style.bottom="0",c.style.opacity="0",r.appendChild(c),this.option.fileInput=c}return["number","width","column","begin","end"].forEach(function(t){e.errorHandle("number"==typeof e.option[t],"The '".concat(t,"' is not a number"))}),this.option.number=(0,f.clamp)(i,10,1e3),this.option.width=(0,f.clamp)(o,10,1e3),this.option.column=(0,f.clamp)(s,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var n=URL.createObjectURL(e);this.videoUrl=n,this.file=e,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,f.sleep)(1e3).then(function(){return e.start()});var t=this.option,n=t.width,r=t.number,i=t.begin,o=t.end,s=this.video.videoHeight/this.video.videoWidth*n;this.option.height=s,this.option.begin=(0,f.clamp)(i,0,this.video.duration),this.option.end=(0,f.clamp)(o||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=r/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var c=this.creatScreenshotDate(),a=this.creatCanvas(),u=a.getContext("2d");this.emit("canvas",a);var l=c.map(function(t,i){return function(){return new Promise(function(o){e.video.oncanplay=function(){u.drawImage(e.video,t.x,t.y,n,s),a.toBlob(function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(i+1)/r),e.video.oncanplay=null,o()})},e.video.currentTime=t.time})}});return this.processing=!0,(0,f.runPromisesInSeries)(l).then(function(){e.processing=!1,e.emLine truncated
!function(e,t,n,r,i,o,s,a){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof c[r]&&c[r],l=u.i||{},f=u.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!f[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof c[r]&&c[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(h&&"string"==typeof t)return h(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}l.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},l.cache={};var a=f[t]=new d.Module(t);e[t][0].call(a.exports,l,a,a.exports,c)}return f[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=h,this.exports={}},d.modules=e,d.cache=f,d.parent=u,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=l,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return c[r]}}),c[r]=d;for(var p=0;p<t.length;p++)d(t[p]);if(n){var v=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({a05wP:[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return h});var o=e("@swc/helpers/cjs/_call_super.cjs"),s=e("@swc/helpers/cjs/_class_call_check.cjs"),a=e("@swc/helpers/cjs/_create_class.cjs"),c=e("@swc/helpers/cjs/_inherits.cjs"),u=e("./emitter"),l=i.interopDefault(u),f=e("./utils"),h=function(e){"use strict";function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,s._)(this,t),(e=(0,o._)(this,t)).processing=!1,e.option={},e.setup(Object.assign({},t.DEFAULTS,n)),e.video=t.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(e),e.ondrop=e.ondrop.bind(e),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",t.ondragover),e.option.fileInput.addEventListener("drop",t.ondrop),e}return(0,c._)(t,e),(0,a._)(t,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,t);var n=this.option,r=n.fileInput,i=n.number,o=n.width,s=n.column;if(this.errorHandle(r instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==r.tagName||"file"!==r.type){r.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",r.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach(function(t){e.errorHandle("number"==typeof e.option[t],"The '".concat(t,"' is not a number"))}),this.option.number=(0,f.clamp)(i,10,1e3),this.option.width=(0,f.clamp)(o,10,1e3),this.option.column=(0,f.clamp)(s,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var n=URL.createObjectURL(e);this.videoUrl=n,this.file=e,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,f.sleep)(1e3).then(function(){return e.start()});var t=this.option,n=t.width,r=t.number,i=t.begin,o=t.end,s=this.video.videoHeight/this.video.videoWidth*n;this.option.height=s,this.option.begin=(0,f.clamp)(i,0,this.video.duration),this.option.end=(0,f.clamp)(o||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=r/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),c=this.creatCanvas(),u=c.getContext("2d");this.emit("canvas",c);var l=a.map(function(t,i){return function(){return new Promise(function(o){e.video.oncanplay=function(){u.drawImage(e.video,t.x,t.y,n,s),c.toBlob(function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(i+1)/r),e.video.oncanplay=null,o()})},e.video.currentTime=t.time})}});return this.processing=!0,(0,f.runPromisesInSeries)(l).then(function(){e.processing=!1,e.emLine truncated