neko-ui 1.0.16 → 1.0.18
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/es/avatar/index.js +1 -2
- package/es/back-top/index.js +1 -2
- package/es/button/index.js +1 -2
- package/es/capture-screen/index.js +1 -2
- package/es/cron-editor/index.js +1 -2
- package/es/get-prefix-cls/index.d.ts +2 -0
- package/es/get-prefix-cls/index.js +1 -0
- package/es/{variables.less → get-prefix-cls/index.less} +0 -0
- package/es/highlight-text/index.js +1 -2
- package/es/index.d.ts +2 -3
- package/es/index.js +1 -2
- package/es/input/index.js +1 -2
- package/es/markdown/index.global.less +1577 -6
- package/es/markdown/index.js +1 -2
- package/es/markdown/markdown-util.d.ts +1 -4
- package/es/markdown/markdown-util.js +1 -2
- package/es/markdown/prism.js +1 -2
- package/es/marquee/index.js +1 -2
- package/es/tooltip/index.js +1 -2
- package/es/use-theme/index.js +1 -2
- package/es/utils/broswer.js +1 -2
- package/es/wave-circle/index.js +1 -2
- package/lib/avatar/index.global.css +1 -76
- package/lib/avatar/index.js +1 -2
- package/lib/back-top/index.global.css +1 -103
- package/lib/back-top/index.js +1 -2
- package/lib/button/index.global.css +1 -288
- package/lib/button/index.js +1 -2
- package/lib/capture-screen/index.global.css +1 -69
- package/lib/capture-screen/index.js +1 -2
- package/lib/cron-editor/index.global.css +1 -3
- package/lib/cron-editor/index.js +1 -2
- package/lib/get-prefix-cls/index.css +1 -0
- package/lib/get-prefix-cls/index.d.ts +2 -0
- package/lib/get-prefix-cls/index.js +1 -0
- package/lib/highlight-text/index.global.css +1 -7
- package/lib/highlight-text/index.js +1 -2
- package/lib/index.d.ts +2 -3
- package/lib/index.js +1 -2
- package/lib/input/index.global.css +1 -59
- package/lib/input/index.js +1 -2
- package/lib/markdown/index.global.css +1 -1453
- package/lib/markdown/index.js +1 -2
- package/lib/markdown/markdown-util.d.ts +1 -4
- package/lib/markdown/markdown-util.js +1 -2
- package/lib/markdown/prism.js +1 -2
- package/lib/marquee/index.global.css +1 -44
- package/lib/marquee/index.js +1 -2
- package/lib/tooltip/index.global.css +1 -27
- package/lib/tooltip/index.js +1 -2
- package/lib/use-theme/index.js +1 -2
- package/lib/utils/broswer.js +1 -2
- package/lib/wave-circle/index.global.css +1 -82
- package/lib/wave-circle/index.js +1 -2
- package/package.json +7 -7
- package/es/avatar/index.js.map +0 -1
- package/es/back-top/index.js.map +0 -1
- package/es/button/index.js.map +0 -1
- package/es/capture-screen/index.js.map +0 -1
- package/es/cron-editor/index.js.map +0 -1
- package/es/highlight-text/index.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/input/index.js.map +0 -1
- package/es/markdown/copy.less +0 -71
- package/es/markdown/icon.less +0 -102
- package/es/markdown/index.js.map +0 -1
- package/es/markdown/markdown-util.js.map +0 -1
- package/es/markdown/md.less +0 -456
- package/es/markdown/pre-code.less +0 -674
- package/es/markdown/pre-viewer.less +0 -220
- package/es/markdown/prism.js.map +0 -1
- package/es/markdown/vars.less +0 -59
- package/es/marquee/index.js.map +0 -1
- package/es/tag/index.d.ts +0 -7
- package/es/tag/index.global.less +0 -25
- package/es/tag/index.js +0 -2
- package/es/tag/index.js.map +0 -1
- package/es/tooltip/index.js.map +0 -1
- package/es/use-theme/index.js.map +0 -1
- package/es/utils/broswer.js.map +0 -1
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +0 -2
- package/es/utils/index.js.map +0 -1
- package/es/wave-circle/index.js.map +0 -1
- package/lib/avatar/index.js.map +0 -1
- package/lib/back-top/index.js.map +0 -1
- package/lib/button/index.js.map +0 -1
- package/lib/capture-screen/index.js.map +0 -1
- package/lib/cron-editor/index.js.map +0 -1
- package/lib/highlight-text/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/input/index.js.map +0 -1
- package/lib/markdown/copy.css +0 -89
- package/lib/markdown/icon.css +0 -80
- package/lib/markdown/index.js.map +0 -1
- package/lib/markdown/markdown-util.js.map +0 -1
- package/lib/markdown/md.css +0 -444
- package/lib/markdown/pre-code.css +0 -593
- package/lib/markdown/pre-viewer.css +0 -194
- package/lib/markdown/prism.js.map +0 -1
- package/lib/markdown/vars.css +0 -57
- package/lib/marquee/index.js.map +0 -1
- package/lib/tag/index.d.ts +0 -7
- package/lib/tag/index.global.css +0 -27
- package/lib/tag/index.js +0 -2
- package/lib/tag/index.js.map +0 -1
- package/lib/tooltip/index.js.map +0 -1
- package/lib/use-theme/index.js.map +0 -1
- package/lib/utils/broswer.js.map +0 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -2
- package/lib/utils/index.js.map +0 -1
- package/lib/variables.css +0 -186
- package/lib/wave-circle/index.js.map +0 -1
package/es/avatar/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}import React,{useMemo}from"react";import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}import React,{useMemo}from"react";import getPrefixCls from"../get-prefix-cls";import{classNames}from"@moneko/common";import"./index.global.less";var Avatar=function(_param){var className=_param.className,_src=_param.src,src=_src===void 0?"https://gw.alipayobjects.com/zos/alicdn/HJtErOC0O/avatar.png":_src,alt=_param.alt,_imgProps=_param.imgProps,imgProps=_imgProps===void 0?{}:_imgProps,props=_objectWithoutProperties(_param,["className","src","alt","imgProps"]);var cls=useMemo(function(){return classNames([getPrefixCls("avatar"),className])},[className]);return React.createElement("div",_extends({className:cls},props),React.createElement("img",_extends({},imgProps,{src:src,alt:alt})))};export default Avatar;
|
package/es/back-top/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}import React,{memo,useCallback,useEffect,useMemo,useRef,useState}from"react";import ReactDOM from"react-dom";import{classNames,getMaxZindex,
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}import React,{memo,useCallback,useEffect,useMemo,useRef,useState}from"react";import ReactDOM from"react-dom";import{classNames,getMaxZindex,getScrollTop,isEqual,isFunction}from"@moneko/common";import getPrefixCls from"../get-prefix-cls";import"./index.global.less";var BackTop=function(_param){var _target=_param.target,target=_target===void 0?function(){return window}:_target,_visibilityHeight=_param.visibilityHeight,visibilityHeight=_visibilityHeight===void 0?400:_visibilityHeight,className=_param.className,props=_objectWithoutProperties(_param,["target","visibilityHeight","className"]);var ref=useRef(null);var ref1=_slicedToArray(useState(null),2),show=ref1[0],setShow=ref1[1];var handleScrollY=useCallback(function(){var scrollTop=0;var offsetHeight=0;if(isFunction(target)){var ele=target();if(ele){scrollTop=getScrollTop(ele);offsetHeight=ele.offsetHeight}}var nextShow=scrollTop>offsetHeight/3||scrollTop>visibilityHeight;if(Boolean(show)!==nextShow){setShow(nextShow)}},[show,target,visibilityHeight]);var handleBackTop=useCallback(function(){var ref;(ref=target())===null||ref===void 0?void 0:ref.scrollTo({top:0,behavior:"smooth"})},[target]);useEffect(function(){if(show&&ref.current){ref.current.style.zIndex=getMaxZindex().toString()}},[show]);useEffect(function(){if(isFunction(target)){var ref;(ref=target())===null||ref===void 0?void 0:ref.addEventListener("scroll",handleScrollY,false)}return function(){if(isFunction(target)){var ref;(ref=target())===null||ref===void 0?void 0:ref.removeEventListener("scroll",handleScrollY,false)}}},[handleScrollY,target]);var cls=useMemo(function(){return classNames([getPrefixCls("back-top"),className,!show&&getPrefixCls("back-top-out")])},[className,show]);var exit=useCallback(function(){if(show===false){setShow(null)}},[show]);var el=useMemo(function(){return React.createElement("div",_extends({},props,{ref:ref,onAnimationEnd:exit,className:cls,onClick:handleBackTop}))},[cls,exit,handleBackTop,props]);return show===null?null:ReactDOM.createPortal(el,target())};export default memo(BackTop,isEqual);
|
package/es/button/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}import React,{useCallback,useMemo,useRef}from"react";import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}import React,{useCallback,useMemo,useRef}from"react";import getPrefixCls from"../get-prefix-cls";import{classNames,isFunction}from"@moneko/common";import"./index.global.less";var Button=function(_param){var infinite=_param.infinite,ghost=_param.ghost,fill=_param.fill,circle=_param.circle,dashed=_param.dashed,float=_param.float,link=_param.link,className=_param.className,children=_param.children,disabled=_param.disabled,onClick=_param.onClick,type=_param.type,props=_objectWithoutProperties(_param,["infinite","ghost","fill","circle","dashed","float","link","className","children","disabled","onClick","type"]);var ref=useRef(null);var ref1=_slicedToArray(React.useState(false),2),animating=ref1[0],setAnimating=ref1[1];var handleClick=useCallback(function(e){if(disabled)return;setAnimating(true);if(isFunction(onClick)){onClick(e)}},[disabled,onClick]);var cls=useMemo(function(){return classNames([getPrefixCls("btn"),type&&getPrefixCls("btn-".concat(type)),infinite&&getPrefixCls("btn-infinite"),ghost&&getPrefixCls("btn-ghost"),fill&&getPrefixCls("btn-fill"),circle&&getPrefixCls("btn-circle"),dashed&&getPrefixCls("btn-dashed"),float&&getPrefixCls("btn-float"),animating&&getPrefixCls("btn-without"),disabled&&getPrefixCls("btn-disabled"),link&&getPrefixCls("btn-link"),className])},[type,infinite,ghost,fill,circle,dashed,float,animating,disabled,link,className]);var handleAnimationEnd=useCallback(function(){setAnimating(false)},[]);return React.createElement("div",_extends({},props,{className:cls,onClick:handleClick,onAnimationEnd:handleAnimationEnd,ref:ref}),React.createElement("span",{className:getPrefixCls("btn-text")},children))};export default Button;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var __generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};import React,{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Button}from"..";import{getPrefixCls}from"../utils";import{downloadBlob,isObject,isFunction,classNames}from"@moneko/common";import"./index.global.less";var displayMediaOptions={video:true,audio:{echoCancellation:true,noiseSuppression:true,sampleRate:44100}};var btnStatusDic={inactive:"primary",paused:"warning",recording:"success"};var CaptureScreen=function(_param){var _options=_param.options,options=_options===void 0?displayMediaOptions:_options,preview=_param.preview,controls=_param.controls,recorder=_param.recorder,className=_param.className,_captureScreenText=_param.captureScreenText,captureScreenText=_captureScreenText===void 0?"捕获屏幕":_captureScreenText,_stopCaptureText=_param.stopCaptureText,stopCaptureText=_stopCaptureText===void 0?"停止捕获":_stopCaptureText,_startRecorderText=_param.startRecorderText,startRecorderText=_startRecorderText===void 0?"开始录制":_startRecorderText,_stopRecorderText=_param.stopRecorderText,stopRecorderText=_stopRecorderText===void 0?"停止录制":_stopRecorderText,_pausedRecorderText=_param.pausedRecorderText,pausedRecorderText=_pausedRecorderText===void 0?"暂停录制":_pausedRecorderText,_recorderingText=_param.recorderingText,recorderingText=_recorderingText===void 0?"录制中":_recorderingText,_onRecorderError=_param.onRecorderError,onRecorderError=_onRecorderError===void 0?null:_onRecorderError,onStopRecorder=_param.onStopRecorder,onStartRecorder=_param.onStartRecorder,onStopCapture=_param.onStopCapture,onStartCapture=_param.onStartCapture,onRecorderDataAvailable=_param.onRecorderDataAvailable,onErrorCapture=_param.onErrorCapture,onSaveRecorder=_param.onSaveRecorder,props=_objectWithoutProperties(_param,["options","preview","controls","recorder","className","captureScreenText","stopCaptureText","startRecorderText","stopRecorderText","pausedRecorderText","recorderingText","onRecorderError","onStopRecorder","onStartRecorder","onStopCapture","onStartCapture","onRecorderDataAvailable","onErrorCapture","onSaveRecorder"]);var videoElem=useRef(null);var mediaRecorderRef=useRef(null);var mediaStreamRef=useRef(null);var chunks=useRef([]);var recorderRef=useRef(recorder);var ref=_slicedToArray(useState(null),2),mediaRecorder=ref[0],setMediaRecorder=ref[1];var ref1=_slicedToArray(useState(null),2),mediaStream=ref1[0],setMediaStream=ref1[1];var ref2=_slicedToArray(useState("inactive"),2),recordState=ref2[0],setRecordState=ref2[1];useEffect(function(){Object.assign(recorderRef,{current:recorder})},[recorder]);useEffect(function(){Object.assign(mediaStreamRef,{current:mediaStream})},[mediaStream]);useEffect(function(){Object.assign(mediaRecorderRef,{current:mediaRecorder})},[mediaRecorder]);var handleStartRecorder=useCallback(function(){if(mediaRecorderRef.current){if(isFunction(onStartRecorder)){onStartRecorder(mediaRecorderRef.current.state)}switch(mediaRecorderRef.current.state){case"inactive":mediaRecorderRef.current.start();break;case"paused":mediaRecorderRef.current.resume();break;case"recording":mediaRecorderRef.current.pause();break;default:break}setRecordState(mediaRecorderRef.current.state)}},[onStartRecorder]);var handleRecorderDataAvailable=useCallback(function(e){var ref;(ref=chunks.current)===null||ref===void 0?void 0:ref.push(e.data);if(isFunction(onRecorderDataAvailable)){onRecorderDataAvailable(e)}},[onRecorderDataAvailable]);var stopRecorder=useCallback(function(){if(mediaRecorderRef.current){if(mediaRecorderRef.current.state!=="inactive"){mediaRecorderRef.current.stop()}setRecordState(mediaRecorderRef.current.state)}if(isFunction(onStopRecorder)){onStopRecorder()}},[onStopRecorder]);var handleSaveRecorder=useCallback(function(){var ref,ref1,ref2;if(!((ref=chunks.current)===null||ref===void 0?void 0:ref.length))return;var blob=new Blob(chunks.current,{type:"video/webm"}),name=isObject(recorderRef.current)&&((ref1=recorderRef.current)===null||ref1===void 0?void 0:ref1.filename)||new Date().toISOString(),fileName=name+".webm";(ref2=chunks.current)===null||ref2===void 0?void 0:ref2.splice(0);if(isFunction(onSaveRecorder)){onSaveRecorder(blob,fileName)}else{downloadBlob(blob,fileName)}},[onSaveRecorder]);var stopCapture=useCallback(function(){stopRecorder();if(mediaStreamRef.current){var tracks=mediaStreamRef.current.getTracks();tracks===null||tracks===void 0?void 0:tracks.forEach(function(track){return track.stop()});setMediaStream(null)}if(isFunction(onStopCapture)){onStopCapture()}},[onStopCapture,stopRecorder]);var startCapture=useCallback(_asyncToGenerator(function(){var stream,err;return __generator(this,function(_state){switch(_state.label){case 0:stopCapture();_state.label=1;case 1:_state.trys.push([1,3,,4]);return[4,navigator.mediaDevices.getDisplayMedia(_objectSpread({},displayMediaOptions,options))];case 2:stream=_state.sent();if(stream){stream.addEventListener("inactive",stopCapture,false);setMediaStream(stream)}if(isFunction(onStartCapture)){onStartCapture(stream)}return[3,4];case 3:err=_state.sent();if(isFunction(onErrorCapture)){onErrorCapture(err)}return[3,4];case 4:return[2]}})}),[onErrorCapture,onStartCapture,options,stopCapture]);useEffect(function(){if(preview&&(videoElem===null||videoElem===void 0?void 0:videoElem.current)&&mediaStream){videoElem.current.srcObject=mediaStream}},[mediaStream,preview]);useEffect(function(){if((mediaStream===null||mediaStream===void 0?void 0:mediaStream.active)&&recorderRef.current){var recorderInstance=new MediaRecorder(mediaStream);recorderInstance.onstop=handleSaveRecorder;recorderInstance.onerror=onRecorderError;recorderInstance.ondataavailable=handleRecorderDataAvailable;setMediaRecorder(recorderInstance)}else{setMediaRecorder(null)}},[handleRecorderDataAvailable,handleSaveRecorder,mediaStream,onRecorderError]);useEffect(function(){var getMediaRecorderRef=function(){return mediaRecorderRef.current};var getMediaStreamRef=function(){return mediaStreamRef.current};return function(){var _mediaRecorderRef=getMediaRecorderRef();if(_mediaRecorderRef){if(_mediaRecorderRef.state!=="inactive"){_mediaRecorderRef.stop()}}var streamRef=getMediaStreamRef();if(streamRef){var tracks=streamRef.getTracks();tracks===null||tracks===void 0?void 0:tracks.forEach(function(track){return track.stop()})}}},[]);var recorderText=useMemo(function(){return({paused:pausedRecorderText,recording:recorderingText,inactive:startRecorderText})[recordState]},[pausedRecorderText,recordState,recorderingText,startRecorderText]);return React.createElement("div",_extends({className:classNames([getPrefixCls("capture-screen"),className])},props),React.createElement("div",{className:getPrefixCls("capture-screen-controller")},React.createElement(Button,{onClick:startCapture},captureScreenText),mediaStream&&React.createElement(React.Fragment,null,React.createElement(Button,{type:"error",onClick:stopCapture},stopCaptureText),recorder&&React.createElement("div",{className:getPrefixCls("capture-screen-controller-record")},React.createElement(Button,{type:btnStatusDic[recordState],onClick:handleStartRecorder},recorderText),recordState!=="inactive"&&React.createElement(Button,{type:"error",onClick:stopRecorder},stopRecorderText)))),preview&&mediaStream?React.createElement("div",{className:getPrefixCls("capture-screen-video")},React.createElement("span",{className:getPrefixCls("capture-screen-video-".concat(recordState))}),React.createElement("video",{ref:videoElem,autoPlay:true,controls:!!(mediaStream&&controls)})):null)};export default CaptureScreen;
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var __generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};import React,{useCallback,useEffect,useMemo,useRef,useState}from"react";import Button from"../button";import getPrefixCls from"../get-prefix-cls";import{downloadBlob,isObject,isFunction,classNames}from"@moneko/common";import"./index.global.less";var displayMediaOptions={video:true,audio:{echoCancellation:true,noiseSuppression:true,sampleRate:44100}};var btnStatusDic={inactive:"primary",paused:"warning",recording:"success"};var CaptureScreen=function(_param){var _options=_param.options,options=_options===void 0?displayMediaOptions:_options,preview=_param.preview,controls=_param.controls,recorder=_param.recorder,className=_param.className,_captureScreenText=_param.captureScreenText,captureScreenText=_captureScreenText===void 0?"捕获屏幕":_captureScreenText,_stopCaptureText=_param.stopCaptureText,stopCaptureText=_stopCaptureText===void 0?"停止捕获":_stopCaptureText,_startRecorderText=_param.startRecorderText,startRecorderText=_startRecorderText===void 0?"开始录制":_startRecorderText,_stopRecorderText=_param.stopRecorderText,stopRecorderText=_stopRecorderText===void 0?"停止录制":_stopRecorderText,_pausedRecorderText=_param.pausedRecorderText,pausedRecorderText=_pausedRecorderText===void 0?"暂停录制":_pausedRecorderText,_recorderingText=_param.recorderingText,recorderingText=_recorderingText===void 0?"录制中":_recorderingText,_onRecorderError=_param.onRecorderError,onRecorderError=_onRecorderError===void 0?null:_onRecorderError,onStopRecorder=_param.onStopRecorder,onStartRecorder=_param.onStartRecorder,onStopCapture=_param.onStopCapture,onStartCapture=_param.onStartCapture,onRecorderDataAvailable=_param.onRecorderDataAvailable,onErrorCapture=_param.onErrorCapture,onSaveRecorder=_param.onSaveRecorder,props=_objectWithoutProperties(_param,["options","preview","controls","recorder","className","captureScreenText","stopCaptureText","startRecorderText","stopRecorderText","pausedRecorderText","recorderingText","onRecorderError","onStopRecorder","onStartRecorder","onStopCapture","onStartCapture","onRecorderDataAvailable","onErrorCapture","onSaveRecorder"]);var videoElem=useRef(null);var mediaRecorderRef=useRef(null);var mediaStreamRef=useRef(null);var chunks=useRef([]);var recorderRef=useRef(recorder);var ref=_slicedToArray(useState(null),2),mediaRecorder=ref[0],setMediaRecorder=ref[1];var ref1=_slicedToArray(useState(null),2),mediaStream=ref1[0],setMediaStream=ref1[1];var ref2=_slicedToArray(useState("inactive"),2),recordState=ref2[0],setRecordState=ref2[1];useEffect(function(){Object.assign(recorderRef,{current:recorder})},[recorder]);useEffect(function(){Object.assign(mediaStreamRef,{current:mediaStream})},[mediaStream]);useEffect(function(){Object.assign(mediaRecorderRef,{current:mediaRecorder})},[mediaRecorder]);var handleStartRecorder=useCallback(function(){if(mediaRecorderRef.current){if(isFunction(onStartRecorder)){onStartRecorder(mediaRecorderRef.current.state)}switch(mediaRecorderRef.current.state){case"inactive":mediaRecorderRef.current.start();break;case"paused":mediaRecorderRef.current.resume();break;case"recording":mediaRecorderRef.current.pause();break;default:break}setRecordState(mediaRecorderRef.current.state)}},[onStartRecorder]);var handleRecorderDataAvailable=useCallback(function(e){var ref;(ref=chunks.current)===null||ref===void 0?void 0:ref.push(e.data);if(isFunction(onRecorderDataAvailable)){onRecorderDataAvailable(e)}},[onRecorderDataAvailable]);var stopRecorder=useCallback(function(){if(mediaRecorderRef.current){if(mediaRecorderRef.current.state!=="inactive"){mediaRecorderRef.current.stop()}setRecordState(mediaRecorderRef.current.state)}if(isFunction(onStopRecorder)){onStopRecorder()}},[onStopRecorder]);var handleSaveRecorder=useCallback(function(){var ref,ref1,ref2;if(!((ref=chunks.current)===null||ref===void 0?void 0:ref.length))return;var blob=new Blob(chunks.current,{type:"video/webm"}),name=isObject(recorderRef.current)&&((ref1=recorderRef.current)===null||ref1===void 0?void 0:ref1.filename)||new Date().toISOString(),fileName=name+".webm";(ref2=chunks.current)===null||ref2===void 0?void 0:ref2.splice(0);if(isFunction(onSaveRecorder)){onSaveRecorder(blob,fileName)}else{downloadBlob(blob,fileName)}},[onSaveRecorder]);var stopCapture=useCallback(function(){stopRecorder();if(mediaStreamRef.current){var tracks=mediaStreamRef.current.getTracks();tracks===null||tracks===void 0?void 0:tracks.forEach(function(track){return track.stop()});setMediaStream(null)}if(isFunction(onStopCapture)){onStopCapture()}},[onStopCapture,stopRecorder]);var startCapture=useCallback(_asyncToGenerator(function(){var stream,err;return __generator(this,function(_state){switch(_state.label){case 0:stopCapture();_state.label=1;case 1:_state.trys.push([1,3,,4]);return[4,navigator.mediaDevices.getDisplayMedia(_objectSpread({},displayMediaOptions,options))];case 2:stream=_state.sent();if(stream){stream.addEventListener("inactive",stopCapture,false);setMediaStream(stream)}if(isFunction(onStartCapture)){onStartCapture(stream)}return[3,4];case 3:err=_state.sent();if(isFunction(onErrorCapture)){onErrorCapture(err)}return[3,4];case 4:return[2]}})}),[onErrorCapture,onStartCapture,options,stopCapture]);useEffect(function(){if(preview&&(videoElem===null||videoElem===void 0?void 0:videoElem.current)&&mediaStream){videoElem.current.srcObject=mediaStream}},[mediaStream,preview]);useEffect(function(){if((mediaStream===null||mediaStream===void 0?void 0:mediaStream.active)&&recorderRef.current){var recorderInstance=new MediaRecorder(mediaStream);recorderInstance.onstop=handleSaveRecorder;recorderInstance.onerror=onRecorderError;recorderInstance.ondataavailable=handleRecorderDataAvailable;setMediaRecorder(recorderInstance)}else{setMediaRecorder(null)}},[handleRecorderDataAvailable,handleSaveRecorder,mediaStream,onRecorderError]);useEffect(function(){var getMediaRecorderRef=function(){return mediaRecorderRef.current};var getMediaStreamRef=function(){return mediaStreamRef.current};return function(){var _mediaRecorderRef=getMediaRecorderRef();if(_mediaRecorderRef){if(_mediaRecorderRef.state!=="inactive"){_mediaRecorderRef.stop()}}var streamRef=getMediaStreamRef();if(streamRef){var tracks=streamRef.getTracks();tracks===null||tracks===void 0?void 0:tracks.forEach(function(track){return track.stop()})}}},[]);var recorderText=useMemo(function(){return({paused:pausedRecorderText,recording:recorderingText,inactive:startRecorderText})[recordState]},[pausedRecorderText,recordState,recorderingText,startRecorderText]);return React.createElement("div",_extends({className:classNames([getPrefixCls("capture-screen"),className])},props),React.createElement("div",{className:getPrefixCls("capture-screen-controller")},React.createElement(Button,{onClick:startCapture},captureScreenText),mediaStream&&React.createElement(React.Fragment,null,React.createElement(Button,{type:"error",onClick:stopCapture},stopCaptureText),recorder&&React.createElement("div",{className:getPrefixCls("capture-screen-controller-record")},React.createElement(Button,{type:btnStatusDic[recordState],onClick:handleStartRecorder},recorderText),recordState!=="inactive"&&React.createElement(Button,{type:"error",onClick:stopRecorder},stopRecorderText)))),preview&&mediaStream?React.createElement("div",{className:getPrefixCls("capture-screen-video")},React.createElement("span",{className:getPrefixCls("capture-screen-video-".concat(recordState))}),React.createElement("video",{ref:videoElem,autoPlay:true,controls:!!(mediaStream&&controls)})):null)};export default CaptureScreen;
|
package/es/cron-editor/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{classNames}from"@moneko/common";import React from"react";import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{classNames}from"@moneko/common";import React from"react";import getPrefixCls from"../get-prefix-cls";var CornEditor=function(param){var className=param.className;return React.createElement("div",{className:classNames([getPrefixCls(""),className])},"CornEditor")};export default CornEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import css from"./index.less";import{getPrefixCls as prefixCls}from"@moneko/common";var getPrefixCls=function(className){var prefix=arguments.length>1&&arguments[1]!==void 0?arguments[1]:css.prefixCls;return prefixCls(className,prefix)};export default getPrefixCls;
|
|
File without changes
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}import React,{useEffect,useMemo,useState}from"react";import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}import React,{useEffect,useMemo,useState}from"react";import getPrefixCls from"../get-prefix-cls";import{classNames}from"@moneko/common";import"./index.global.less";export var RegExp_HighLight=/%c:(.+?):c%/i;export function strToHighlight(text){var str=text,strArr=RegExp_HighLight.exec(str);if(strArr){var textArr=[];for(;strArr!==null;strArr=RegExp_HighLight.exec(str)){var normalText=str.substring(0,strArr.index);if(normalText.trim().length){textArr.push({text:normalText})}textArr.push({hit:true,text:strArr[1]});str=str.substring(strArr[0].length+strArr.index);normalText=null}if(str.trim().length){textArr.push({text:str})}return textArr}return null}var HighlightText=function(param){var className=param.className,style=param.style,hitStyle=param.hitStyle,hitClassName=param.hitClassName,text=param.text,highlight=param.highlight,extra=param.extra,_flag=param.flag,flag=_flag===void 0?"g":_flag;var ref=_slicedToArray(useState(),2),texts=ref[0],setTexts=ref[1];var hitCls=useMemo(function(){return classNames([getPrefixCls("hit"),hitClassName])},[hitClassName]);useEffect(function(){if(typeof text==="string"&&highlight){var str=text;if(Array.isArray(highlight)){for(var i=0,len=highlight.length;i<len;i++){var item=highlight[i];var isOne=typeof item==="string";var hitStr=isOne?item:item.highlight;var iFlag=isOne?flag:item.flag;str=str.replace(new RegExp(hitStr,iFlag),"%c:".concat(hitStr,":c%"))}}else{str=str.replace(new RegExp(highlight,flag),"%c:".concat(highlight,":c%"))}setTexts(strToHighlight(str))}else{setTexts(null)}},[flag,highlight,text]);var hitNode=useMemo(function(){var ref;return(ref=texts===null||texts===void 0?void 0:texts.map(function(item,i){return item.hit?React.createElement("span",{key:item.text+i,className:hitCls,"data-text":item.text,style:hitStyle},item.text):item.text}))!==null&&ref!==void 0?ref:text},[hitCls,hitStyle,text,texts]);return React.createElement("div",{className:classNames([getPrefixCls("highlight-text"),className]),style:style},hitNode,extra&&React.createElement("span",{className:hitCls,style:hitStyle},extra))};export default HighlightText;
|
package/es/index.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ export { default as Markdown } from './markdown';
|
|
|
2
2
|
export type { MarkdownProps, CodeBlockToolType, AnchorType } from './markdown';
|
|
3
3
|
export { default as BackTop } from './back-top';
|
|
4
4
|
export type { BackTopProps } from './back-top';
|
|
5
|
-
export { default as Tag } from './tag';
|
|
6
|
-
export type { TagProps } from './tag';
|
|
7
5
|
export { default as HighlightText } from './highlight-text';
|
|
8
6
|
export type { Highlight, HighlightTextProps, HighlightTextJson } from './highlight-text';
|
|
9
7
|
export { default as useTheme } from './use-theme';
|
|
@@ -22,4 +20,5 @@ export { default as Button } from './button';
|
|
|
22
20
|
export type { ButtonProps, ButtonType } from './button';
|
|
23
21
|
export { default as Input } from './input';
|
|
24
22
|
export type { InputProps } from './input';
|
|
25
|
-
|
|
23
|
+
export { default as getPrefixCls } from './get-prefix-cls';
|
|
24
|
+
import './get-prefix-cls/index.less';
|
package/es/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export{default as Markdown}from"./markdown";export{default as BackTop}from"./back-top";export{default as
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export{default as Markdown}from"./markdown";export{default as BackTop}from"./back-top";export{default as HighlightText}from"./highlight-text";export{default as useTheme}from"./use-theme";export{default as Avatar}from"./avatar";export{default as Marquee}from"./marquee";export{default as CaptureScreen}from"./capture-screen";export{default as WaveCircle}from"./wave-circle";export{default as CronEditor}from"./cron-editor";export{default as Button}from"./button";export{default as Input}from"./input";export{default as getPrefixCls}from"./get-prefix-cls";import"./get-prefix-cls/index.less";
|
package/es/input/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}import React from"react";import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key]}return target}import React from"react";import getPrefixCls from"../get-prefix-cls";import{classNames}from"@moneko/common";import"./index.global.less";var Input=function(_param){var className=_param.className,_type=_param.type,type=_type===void 0?"text":_type,suffix=_param.suffix,prefix=_param.prefix,value=_param.value,prpos=_objectWithoutProperties(_param,["className","type","suffix","prefix","value"]);return React.createElement("span",{className:classNames([getPrefixCls("input-wrapper"),getPrefixCls("input-".concat(type)),className])},prefix&&React.createElement("span",{className:getPrefixCls("input-prefix")},prefix),React.createElement("input",_extends({value:value,className:getPrefixCls("input"),type:type},prpos)),suffix&&React.createElement("span",{className:getPrefixCls("input-suffix")},suffix))};export default Input;
|