@univerjs/action-recorder 0.5.3 → 0.5.4

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/lib/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Y=Object.defineProperty;var Q=(r,n,e)=>n in r?Y(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var S=(r,n,e)=>Q(r,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),s=require("@univerjs/sheets"),T=require("@univerjs/sheets-filter"),u=require("@univerjs/sheets-ui"),f=require("@univerjs/ui"),b=require("rxjs"),R=require("@univerjs/design"),g=require("react");var v=function(){return v=Object.assign||function(r){for(var n,e=1,t=arguments.length;e<t;e++){n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r},v.apply(this,arguments)},X=function(r,n){var e={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&n.indexOf(t)<0&&(e[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(r);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(r,t[o])&&(e[t[o]]=r[t[o]]);return e},J=g.forwardRef(function(r,n){var e=r.icon,t=r.id,o=r.className,i=r.extend,c=X(r,["icon","id","className","extend"]),l="univerjs-icon univerjs-icon-".concat(t," ").concat(o||"").trim(),d=g.useRef("_".concat(te()));return W(e,"".concat(t),{defIds:e.defIds,idSuffix:d.current},v({ref:n,className:l},c),i)});function W(r,n,e,t,o){return g.createElement(r.tag,v(v({key:n},ee(r,e,o)),t),(re(r,e).children||[]).map(function(i,c){return W(i,"".concat(n,"-").concat(r.tag,"-").concat(c),e,void 0,o)}))}function ee(r,n,e){var t=v({},r.attrs);e!=null&&e.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=e.colorChannel1);var o=n.defIds;return!o||o.length===0||(r.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(i){var c=i[0],l=i[1];typeof l=="string"&&(t[c]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function re(r,n){var e,t=n.defIds;return!t||t.length===0?r:r.tag==="defs"&&(!((e=r.children)===null||e===void 0)&&e.length)?v(v({},r),{children:r.children.map(function(o){return typeof o.attrs.id=="string"&&t&&t.indexOf(o.attrs.id)>-1?v(v({},o),{attrs:v(v({},o.attrs),{id:o.attrs.id+n.idSuffix})}):o})}):r}function te(){return Math.random().toString(36).substring(2,8)}J.displayName="UniverIcon";var ne={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{fill:"currentColor",clipPath:"url(#record-single_clip0_1559_19)"},children:[{tag:"path",attrs:{d:"M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z"}},{tag:"path",attrs:{d:"M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z",fillRule:"evenodd",clipRule:"evenodd"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"record-single_clip0_1559_19"},children:[{tag:"path",attrs:{fill:"#fff",d:"M0 0H16V16H0z",transform:"translate(.94)"}}]}]}],defIds:["record-single_clip0_1559_19"]},N=g.forwardRef(function(r,n){return g.createElement(J,Object.assign({},r,{id:"record-single",ref:n,icon:ne}))});N.displayName="RecordSingle";var oe=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,ce=(r,n,e,t)=>{for(var o=t>1?void 0:t?ie(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&oe(n,e,o),o},x=(r,n)=>(e,t)=>n(e,t,r);exports.ActionRecorderService=class extends a.Disposable{constructor(e,t,o,i){super();S(this,"_shouldRecordCommands",new Set);S(this,"_panelOpened$",new b.BehaviorSubject(!1));S(this,"panelOpened$",this._panelOpened$.asObservable());S(this,"_recorder",null);S(this,"_recording$",new b.BehaviorSubject(!1));S(this,"recording$",this._recording$.asObservable());S(this,"_recorded$",new b.BehaviorSubject([]));S(this,"_recordedCommands$",new b.BehaviorSubject([]));S(this,"recordedCommands$",this._recordedCommands$.asObservable());this._commandSrv=e,this._logService=t,this._localFileService=o,this._instanceService=i}get recording(){return this._recording$.getValue()}get _recorded(){return this._recorded$.getValue()}get _recordedCommands(){return this._recordedCommands$.getValue()}registerRecordedCommand(e){if(e.type===a.CommandType.MUTATION)throw new Error("[CommandRecorderService] Cannot record mutation commands.");this._shouldRecordCommands.add(e.id)}togglePanel(e){this._panelOpened$.next(e),e===!1&&this.stopRecording()}startRecording(e=!1){this._recorder=this._commandSrv.onCommandExecuted(t=>{var o,i;if(this._shouldRecordCommands.has(t.id)){const c=this._recorded,l=this._recordedCommands;let d={...t};const h=(o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId(),{unitId:p=h,subUnitId:m}=d==null?void 0:d.params;if(e&&p&&m){const y=(i=this._instanceService.getUnit(p).getSheetBySheetId(m))==null?void 0:i.getName();d={...d,params:{...d.params,subUnitId:y}}}d.id===s.SetSelectionsOperation.id&&c.length>0&&c[c.length-1].id===s.SetSelectionsOperation.id?c[c.length-1]=d:(c.push(d),this._recorded$.next(c),d.type===a.CommandType.COMMAND&&(l.push(d),this._recordedCommands$.next(l)))}}),this._recording$.next(!0)}stopRecording(){var e;(e=this._recorder)==null||e.dispose(),this._recorder=null,this._recorded$.next([]),this._recordedCommands$.next([]),this._recording$.next(!1)}completeRecording(){const e=this._recorded.slice();this._localFileService.downloadFile(new Blob([JSON.stringify(e,null,2)]),"recorded-commands.json"),this._logService.error("Recorded commands:",e),this.stopRecording()}};exports.ActionRecorderService=ce([x(0,a.ICommandService),x(1,a.ILogService),x(2,f.ILocalFileService),x(3,a.IUniverInstanceService)],exports.ActionRecorderService);const z={id:"action-recorder.command.start-recording",type:a.CommandType.COMMAND,handler:(r,n)=>(r.get(exports.ActionRecorderService).startRecording(!!(n!=null&&n.replaceId)),!0)},k={id:"action-recorder.command.complete-recording",type:a.CommandType.COMMAND,handler:r=>(r.get(exports.ActionRecorderService).completeRecording(),!0)},H={id:"action-recorder.command.stop-recording",type:a.CommandType.COMMAND,handler:r=>(r.get(exports.ActionRecorderService).completeRecording(),!0)};var ae=Object.defineProperty,se=Object.getOwnPropertyDescriptor,de=(r,n,e,t)=>{for(var o=t>1?void 0:t?se(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&ae(n,e,o),o},O=(r,n)=>(e,t)=>n(e,t,r),w=(r=>(r.DEFAULT="default",r.NAME="name",r.ACTIVE="active",r))(w||{});exports.ActionReplayService=class extends a.Disposable{constructor(n,e,t,o,i){super(),this._messageService=n,this._instanceService=e,this._localFileService=t,this._logService=o,this._commandService=i}async replayLocalJSON(n="default"){const e=await this._localFileService.openFile({multiple:!1,accept:".json"});if(e.length!==1)return!1;const t=e[0];try{return this.replayCommands(JSON.parse(await t.text()),{mode:n})}catch{return this._messageService.show({type:R.MessageType.Error,content:`Failed to replay commands from local file ${t.name}.`}),!1}}async replayCommands(n,e){var i,c,l;const t=(i=this._instanceService.getFocusedUnit())==null?void 0:i.getUnitId();t||this._logService.error("[ReplayService]","no focused unit to replay commands");const{mode:o}=e||{};for(const d of n){const{id:h,params:p}=d,m=p;if(m){if(typeof m.unitId<"u"&&(m.unitId=t),o==="name"&&m.subUnitId!=="undefined"){const _=(c=this._instanceService.getFocusedUnit().getSheetBySheetName(m.subUnitId))==null?void 0:c.getSheetId();_?m.subUnitId=_:this._logService.error("[ReplayService]",`failed to find subunit by subUnitName = ${m.subUnitId}`)}if(o==="active"&&m.subUnitId!=="undefined"){const _=(l=this._instanceService.getFocusedUnit().getActiveSheet())==null?void 0:l.getSheetId();_?m.subUnitId=_:this._logService.error("[ReplayService]","failed to find active subunit")}if(!await this._commandService.executeCommand(h,p))return!1}else if(!await this._commandService.executeCommand(h))return!1}return!0}async replayCommandsWithDelay(n){var t;const e=(t=this._instanceService.getFocusedUnit())==null?void 0:t.getUnitId();e||this._logService.error("[ReplayService]","no focused unit to replay commands");for(const o of n){await a.awaitTime(le());const{id:i,params:c}=o;if(c){if(typeof c.unitId<"u"&&(c.unitId=e),!await this._commandService.executeCommand(i,c))return!1}else if(!await this._commandService.executeCommand(i))return!1}return!0}};exports.ActionReplayService=de([O(0,f.IMessageService),O(1,a.IUniverInstanceService),O(2,f.ILocalFileService),O(3,a.ILogService),O(4,a.ICommandService)],exports.ActionReplayService);function le(){return Math.floor(Math.random()*800)+200}const $={id:"action-recorder.command.replay-local-records",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON();return e&&r.get(f.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},E={id:"action-recorder.command.replay-local-records-name",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON(w.NAME);return e&&r.get(f.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},F={id:"action-recorder.command.replay-local-records-active",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON(w.ACTIVE);return e&&r.get(f.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},D={id:"action-recorder.operation.open-panel",type:a.CommandType.OPERATION,handler(r){return r.get(exports.ActionRecorderService).togglePanel(!0),!0}},G={id:"action-recorder.operation.close-panel",type:a.CommandType.OPERATION,handler(r){return r.get(exports.ActionRecorderService).togglePanel(!1),!0}};var j={exports:{}},A={};/**
1
+ "use strict";var Y=Object.defineProperty;var Q=(r,n,e)=>n in r?Y(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var g=(r,n,e)=>Q(r,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),s=require("@univerjs/sheets"),T=require("@univerjs/sheets-filter"),u=require("@univerjs/sheets-ui"),f=require("@univerjs/ui"),b=require("rxjs"),R=require("@univerjs/design"),v=require("react");var S=function(){return S=Object.assign||function(r){for(var n,e=1,t=arguments.length;e<t;e++){n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r},S.apply(this,arguments)},X=function(r,n){var e={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&n.indexOf(t)<0&&(e[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(r);o<t.length;o++)n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(r,t[o])&&(e[t[o]]=r[t[o]]);return e},J=v.forwardRef(function(r,n){var e=r.icon,t=r.id,o=r.className,i=r.extend,c=X(r,["icon","id","className","extend"]),l="univerjs-icon univerjs-icon-".concat(t," ").concat(o||"").trim(),d=v.useRef("_".concat(te()));return W(e,"".concat(t),{defIds:e.defIds,idSuffix:d.current},S({ref:n,className:l},c),i)});function W(r,n,e,t,o){return v.createElement(r.tag,S(S({key:n},ee(r,e,o)),t),(re(r,e).children||[]).map(function(i,c){return W(i,"".concat(n,"-").concat(r.tag,"-").concat(c),e,void 0,o)}))}function ee(r,n,e){var t=S({},r.attrs);e!=null&&e.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=e.colorChannel1);var o=n.defIds;return!o||o.length===0||(r.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(i){var c=i[0],l=i[1];typeof l=="string"&&(t[c]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function re(r,n){var e,t=n.defIds;return!t||t.length===0?r:r.tag==="defs"&&(!((e=r.children)===null||e===void 0)&&e.length)?S(S({},r),{children:r.children.map(function(o){return typeof o.attrs.id=="string"&&t&&t.indexOf(o.attrs.id)>-1?S(S({},o),{attrs:S(S({},o.attrs),{id:o.attrs.id+n.idSuffix})}):o})}):r}function te(){return Math.random().toString(36).substring(2,8)}J.displayName="UniverIcon";var ne={tag:"svg",attrs:{fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"g",attrs:{fill:"currentColor",clipPath:"url(#record-single_clip0_1559_19)"},children:[{tag:"path",attrs:{d:"M7.60303 10C8.7076 10 9.60303 9.10457 9.60303 8C9.60303 6.89543 8.7076 6 7.60303 6C6.49846 6 5.60303 6.89543 5.60303 8C5.60303 9.10457 6.49846 10 7.60303 10Z"}},{tag:"path",attrs:{d:"M1.66943 5.29023C1.66941 3.85426 2.83349 2.69017 4.26946 2.69019L10.9362 2.69026C12.3192 2.69028 13.45 3.77008 13.5315 5.13259L14.5692 4.55638C15.3024 4.14929 16.2032 4.67947 16.2032 5.51809V10.4819C16.2032 11.3205 15.3024 11.8507 14.5692 11.4436L13.5315 10.8674C13.45 12.2299 12.3192 13.3097 10.9362 13.3097H4.26953C2.83361 13.3097 1.66956 12.1457 1.66953 10.7098L1.66943 5.29023ZM13.5362 9.49743L15.0032 10.312V5.68799L13.5362 6.50254V9.49743ZM4.26945 3.89019C3.49623 3.89018 2.86942 4.517 2.86943 5.29021L2.86953 10.7098C2.86955 11.483 3.49634 12.1097 4.26953 12.1097H10.9362C11.7094 12.1097 12.3362 11.4829 12.3362 10.7097V5.29026C12.3362 4.51707 11.7094 3.89027 10.9362 3.89026L4.26945 3.89019Z",fillRule:"evenodd",clipRule:"evenodd"}}]},{tag:"defs",attrs:{},children:[{tag:"clipPath",attrs:{id:"record-single_clip0_1559_19"},children:[{tag:"path",attrs:{fill:"#fff",d:"M0 0H16V16H0z",transform:"translate(.94)"}}]}]}],defIds:["record-single_clip0_1559_19"]},N=v.forwardRef(function(r,n){return v.createElement(J,Object.assign({},r,{id:"record-single",ref:n,icon:ne}))});N.displayName="RecordSingle";var oe=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,ce=(r,n,e,t)=>{for(var o=t>1?void 0:t?ie(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&oe(n,e,o),o},x=(r,n)=>(e,t)=>n(e,t,r);exports.ActionRecorderService=class extends a.Disposable{constructor(e,t,o,i){super();g(this,"_shouldRecordCommands",new Set);g(this,"_panelOpened$",new b.BehaviorSubject(!1));g(this,"panelOpened$",this._panelOpened$.asObservable());g(this,"_recorder",null);g(this,"_recording$",new b.BehaviorSubject(!1));g(this,"recording$",this._recording$.asObservable());g(this,"_recorded$",new b.BehaviorSubject([]));g(this,"_recordedCommands$",new b.BehaviorSubject([]));g(this,"recordedCommands$",this._recordedCommands$.asObservable());this._commandSrv=e,this._logService=t,this._localFileService=o,this._instanceService=i}get recording(){return this._recording$.getValue()}get _recorded(){return this._recorded$.getValue()}get _recordedCommands(){return this._recordedCommands$.getValue()}registerRecordedCommand(e){if(e.type===a.CommandType.MUTATION)throw new Error("[CommandRecorderService] Cannot record mutation commands.");this._shouldRecordCommands.add(e.id)}togglePanel(e){this._panelOpened$.next(e),e===!1&&this.stopRecording()}startRecording(e=!1){this._recorder=this._commandSrv.onCommandExecuted(t=>{var o,i;if(this._shouldRecordCommands.has(t.id)){const c=this._recorded,l=this._recordedCommands;let d={...t};const h=(o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId(),{unitId:p=h,subUnitId:m}=d==null?void 0:d.params;if(e&&p&&m){const y=(i=this._instanceService.getUnit(p).getSheetBySheetId(m))==null?void 0:i.getName();d={...d,params:{...d.params,subUnitId:y}}}d.id===s.SetSelectionsOperation.id&&c.length>0&&c[c.length-1].id===s.SetSelectionsOperation.id?c[c.length-1]=d:(c.push(d),this._recorded$.next(c),d.type===a.CommandType.COMMAND&&(l.push(d),this._recordedCommands$.next(l)))}}),this._recording$.next(!0)}stopRecording(){var e;(e=this._recorder)==null||e.dispose(),this._recorder=null,this._recorded$.next([]),this._recordedCommands$.next([]),this._recording$.next(!1)}completeRecording(){const e=this._recorded.slice();this._localFileService.downloadFile(new Blob([JSON.stringify(e,null,2)]),"recorded-commands.json"),this._logService.error("Recorded commands:",e),this.stopRecording()}};exports.ActionRecorderService=ce([x(0,a.ICommandService),x(1,a.ILogService),x(2,f.ILocalFileService),x(3,a.IUniverInstanceService)],exports.ActionRecorderService);const z={id:"action-recorder.command.start-recording",type:a.CommandType.COMMAND,handler:(r,n)=>(r.get(exports.ActionRecorderService).startRecording(!!(n!=null&&n.replaceId)),!0)},k={id:"action-recorder.command.complete-recording",type:a.CommandType.COMMAND,handler:r=>(r.get(exports.ActionRecorderService).completeRecording(),!0)},H={id:"action-recorder.command.stop-recording",type:a.CommandType.COMMAND,handler:r=>(r.get(exports.ActionRecorderService).completeRecording(),!0)};var ae=Object.defineProperty,se=Object.getOwnPropertyDescriptor,de=(r,n,e,t)=>{for(var o=t>1?void 0:t?se(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&ae(n,e,o),o},O=(r,n)=>(e,t)=>n(e,t,r),w=(r=>(r.DEFAULT="default",r.NAME="name",r.ACTIVE="active",r))(w||{});exports.ActionReplayService=class extends a.Disposable{constructor(n,e,t,o,i){super(),this._messageService=n,this._instanceService=e,this._localFileService=t,this._logService=o,this._commandService=i}async replayLocalJSON(n="default"){const e=await this._localFileService.openFile({multiple:!1,accept:".json"});if(e.length!==1)return!1;const t=e[0];try{return this.replayCommands(JSON.parse(await t.text()),{mode:n})}catch{return this._messageService.show({type:R.MessageType.Error,content:`Failed to replay commands from local file ${t.name}.`}),!1}}async replayCommands(n,e){var i,c,l;const t=(i=this._instanceService.getFocusedUnit())==null?void 0:i.getUnitId();t||this._logService.error("[ReplayService]","no focused unit to replay commands");const{mode:o}=e||{};for(const d of n){const{id:h,params:p}=d,m=p;if(m){if(typeof m.unitId<"u"&&(m.unitId=t),o==="name"&&m.subUnitId!=="undefined"){const _=(c=this._instanceService.getFocusedUnit().getSheetBySheetName(m.subUnitId))==null?void 0:c.getSheetId();_?m.subUnitId=_:this._logService.error("[ReplayService]",`failed to find subunit by subUnitName = ${m.subUnitId}`)}if(o==="active"&&m.subUnitId!=="undefined"){const _=(l=this._instanceService.getFocusedUnit().getActiveSheet())==null?void 0:l.getSheetId();_?m.subUnitId=_:this._logService.error("[ReplayService]","failed to find active subunit")}if(!await this._commandService.executeCommand(h,p))return!1}else if(!await this._commandService.executeCommand(h))return!1}return!0}async replayCommandsWithDelay(n){var t;const e=(t=this._instanceService.getFocusedUnit())==null?void 0:t.getUnitId();e||this._logService.error("[ReplayService]","no focused unit to replay commands");for(const o of n){await a.awaitTime(le());const{id:i,params:c}=o;if(c){if(typeof c.unitId<"u"&&(c.unitId=e),!await this._commandService.executeCommand(i,c))return!1}else if(!await this._commandService.executeCommand(i))return!1}return!0}};exports.ActionReplayService=de([O(0,f.IMessageService),O(1,a.IUniverInstanceService),O(2,f.ILocalFileService),O(3,a.ILogService),O(4,a.ICommandService)],exports.ActionReplayService);function le(){return Math.floor(Math.random()*800)+200}const $={id:"action-recorder.command.replay-local-records",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON();return e&&r.get(f.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},E={id:"action-recorder.command.replay-local-records-name",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON(w.NAME);return e&&r.get(f.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},F={id:"action-recorder.command.replay-local-records-active",type:a.CommandType.COMMAND,handler:async r=>{const e=await r.get(exports.ActionReplayService).replayLocalJSON(w.ACTIVE);return e&&r.get(f.IMessageService).show({type:R.MessageType.Success,content:"Successfully replayed local records"}),e}},D={id:"action-recorder.operation.open-panel",type:a.CommandType.OPERATION,handler(r){return r.get(exports.ActionRecorderService).togglePanel(!0),!0}},G={id:"action-recorder.operation.close-panel",type:a.CommandType.OPERATION,handler(r){return r.get(exports.ActionRecorderService).togglePanel(!1),!0}};var j={exports:{}},A={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var L;function me(){if(L)return A;L=1;var r=g,n=Symbol.for("react.element"),e=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(l,d,h){var p,m={},y=null,_=null;h!==void 0&&(y=""+h),d.key!==void 0&&(y=""+d.key),d.ref!==void 0&&(_=d.ref);for(p in d)t.call(d,p)&&!i.hasOwnProperty(p)&&(m[p]=d[p]);if(l&&l.defaultProps)for(p in d=l.defaultProps,d)m[p]===void 0&&(m[p]=d[p]);return{$$typeof:n,type:l,key:y,ref:_,props:m,_owner:o.current}}return A.Fragment=e,A.jsx=c,A.jsxs=c,A}var B;function ue(){return B||(B=1,j.exports=me()),j.exports}var C=ue();function Z(r){var n,e,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var o=r.length;for(n=0;n<o;n++)r[n]&&(e=Z(r[n]))&&(t&&(t+=" "),t+=e)}else for(e in r)r[e]&&(t&&(t+=" "),t+=e);return t}function fe(){for(var r,n,e=0,t="",o=arguments.length;e<o;e++)(r=arguments[e])&&(n=Z(r))&&(t&&(t+=" "),t+=n);return t}const pe="univer-action-recorder-panel",ve="univer-action-recorder-panel-icon",Se="univer-action-recorder-panel-icon-recording",ge="univer-recording",he="univer-action-recorder-panel-title",Ce="univer-action-recorder-panel-actions",P={actionRecorderPanel:pe,actionRecorderPanelIcon:ve,actionRecorderPanelIconRecording:Se,recording:ge,actionRecorderPanelTitle:he,actionRecorderPanelActions:Ce};function _e(){const r=a.useDependency(exports.ActionRecorderService);return f.useObservable(r.panelOpened$)?C.jsx(ye,{}):null}function ye(){var p;const r=a.useDependency(a.ICommandService),n=a.useDependency(exports.ActionRecorderService),e=f.useObservable(n.recording$),t=f.useObservable(n.recordedCommands$),o=(p=t==null?void 0:t.length)!=null?p:0,i=g.useCallback(()=>{e||r.executeCommand(G.id)},[r,e]),c=g.useCallback(m=>{e||r.executeCommand(z.id,{replaceId:m})},[r,e]),l=g.useCallback(()=>{e&&r.executeCommand(k.id)},[r,e]),d=g.useCallback(()=>{e&&r.executeCommand(H.id)},[r,e]),h=e?o===0?"Recording...":`${o}: ${t[o-1].id}`:"Start Recording";return C.jsxs("div",{className:P.actionRecorderPanel,children:[C.jsx("div",{className:fe(P.actionRecorderPanelIcon,e?P.actionRecorderPanelIconRecording:!1),children:C.jsx(N,{})}),C.jsx("div",{className:P.actionRecorderPanelTitle,children:h}),C.jsxs("div",{className:P.actionRecorderPanelActions,children:[C.jsx(R.Button,{type:"default",size:"small",onClick:e?d:i,children:e?"Cancel":"Close"}),C.jsx(R.Button,{type:"primary",size:"small",onClick:e?l:()=>c(),children:e?"Save":"Start"}),!e&&C.jsx(R.Button,{type:"primary",size:"small",onClick:()=>c(!0),children:"Start(N)"})]})]})}const K="RECORD_MENU_ITEM";function Re(){return{id:K,type:f.MenuItemType.SUBITEMS,icon:"RecordSingle",tooltip:"action-recorder.menu.title"}}function Ie(r){const n=r.get(exports.ActionRecorderService);return{id:D.id,title:"action-recorder.menu.record",type:f.MenuItemType.BUTTON,disabled$:n.panelOpened$}}function Oe(){return{id:$.id,title:"action-recorder.menu.replay-local",type:f.MenuItemType.BUTTON}}function Ae(){return{id:E.id,title:"action-recorder.menu.replay-local-name",type:f.MenuItemType.BUTTON}}function Pe(){return{id:F.id,title:"action-recorder.menu.replay-local-active",type:f.MenuItemType.BUTTON}}const be={[f.RibbonStartGroup.OTHERS]:{[K]:{order:10,menuItemFactory:Re,[D.id]:{order:1,menuItemFactory:Ie},[$.id]:{order:2,menuItemFactory:Oe},[E.id]:{order:3,menuItemFactory:Ae},[F.id]:{order:4,menuItemFactory:Pe}}}};var xe=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Te=(r,n,e,t)=>{for(var o=t>1?void 0:t?Me(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&xe(n,e,o),o},I=(r,n)=>(e,t)=>n(e,t,r);let M=class extends a.Disposable{constructor(r,n,e,t,o,i){super(),this._commandSrv=r,this._uiPartsSrv=n,this._menuManagerService=e,this._componentManager=t,this._actionRecorderService=o,this._injector=i,this._initCommands(),this._initUI(),this._initSheetsCommands(),this._initDocsCommands()}_initCommands(){[z,H,k,D,G,$,E,F].forEach(r=>this._commandSrv.registerCommand(r))}_initUI(){this._uiPartsSrv.registerComponent(f.BuiltInUIPart.GLOBAL,()=>a.connectInjector(_e,this._injector)),this._componentManager.register("RecordSingle",N),this._menuManagerService.mergeMenu(be)}_initSheetsCommands(){[s.CopySheetCommand,s.DeleteRangeMoveLeftCommand,s.DeleteRangeMoveUpCommand,s.DeltaColumnWidthCommand,s.DeltaRowHeightCommand,s.InsertSheetCommand,s.InsertColAfterCommand,s.InsertColBeforeCommand,s.InsertRowAfterCommand,s.InsertRowBeforeCommand,s.RemoveSheetCommand,s.SetStyleCommand,s.AddWorksheetMergeCommand,s.AddWorksheetMergeAllCommand,s.AddWorksheetMergeVerticalCommand,s.AddWorksheetMergeHorizontalCommand,s.SetFrozenCommand,s.CancelFrozenCommand,s.SetHorizontalTextAlignCommand,s.SetOverlineCommand,u.SetRangeBoldCommand,u.SetRangeFontFamilyCommand,u.SetRangeFontSizeCommand,u.SetRangeItalicCommand,u.SetRangeStrickThroughCommand,u.SetRangeSubscriptCommand,u.SetRangeSuperscriptCommand,u.SetRangeTextColorCommand,u.SetRangeUnderlineCommand,s.SetRangeValuesCommand,s.SetStrikeThroughCommand,s.SetTextColorCommand,s.SetTextRotationCommand,s.SetTextWrapCommand,s.SetVerticalTextAlignCommand,u.SheetCopyCommand,u.SheetCutCommand,u.SheetPasteBesidesBorderCommand,u.SheetPasteColWidthCommand,u.SheetPasteCommand,u.SheetPasteFormatCommand,u.SheetPasteShortKeyCommand,u.SheetPasteValueCommand,u.AutoFillCommand,u.RefillCommand,s.SetWorksheetActivateCommand,s.SetWorksheetActiveOperation,s.SetSelectionsOperation,T.SetSheetFilterRangeCommand,T.SetSheetsFilterCriteriaCommand,T.RemoveSheetFilterCommand].forEach(r=>this._actionRecorderService.registerRecordedCommand(r))}_initDocsCommands(){}};M=Te([I(0,a.ICommandService),I(1,f.IUIPartsService),I(2,f.IMenuManagerService),I(3,a.Inject(f.ComponentManager)),I(4,a.Inject(exports.ActionRecorderService)),I(5,a.Inject(a.Injector))],M);const je="action-recorder.config",V={};var Ue=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,we=(r,n,e,t)=>{for(var o=t>1?void 0:t?Ne(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&Ue(n,e,o),o},q=(r,n)=>(e,t)=>n(e,t,r),U;exports.UniverActionRecorderPlugin=(U=class extends a.Plugin{constructor(n=V,e,t){super(),this._config=n,this._injector=e,this._configService=t;const{menu:o,...i}=a.merge({},V,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(je,i)}onStarting(){(this._config.replayOnly?[[exports.ActionReplayService]]:[[exports.ActionRecorderService],[exports.ActionReplayService],[M]]).forEach(e=>this._injector.add(e))}onSteady(){this._config.replayOnly||this._injector.get(M)}},S(U,"pluginName","UNIVER_ACTION_RECORDER_PLUGIN"),U);exports.UniverActionRecorderPlugin=we([q(1,a.Inject(a.Injector)),q(2,a.IConfigService)],exports.UniverActionRecorderPlugin);
9
+ */var L;function me(){if(L)return A;L=1;var r=v,n=Symbol.for("react.element"),e=Symbol.for("react.fragment"),t=Object.prototype.hasOwnProperty,o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(l,d,h){var p,m={},y=null,_=null;h!==void 0&&(y=""+h),d.key!==void 0&&(y=""+d.key),d.ref!==void 0&&(_=d.ref);for(p in d)t.call(d,p)&&!i.hasOwnProperty(p)&&(m[p]=d[p]);if(l&&l.defaultProps)for(p in d=l.defaultProps,d)m[p]===void 0&&(m[p]=d[p]);return{$$typeof:n,type:l,key:y,ref:_,props:m,_owner:o.current}}return A.Fragment=e,A.jsx=c,A.jsxs=c,A}var B;function ue(){return B||(B=1,j.exports=me()),j.exports}var C=ue();function Z(r){var n,e,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var o=r.length;for(n=0;n<o;n++)r[n]&&(e=Z(r[n]))&&(t&&(t+=" "),t+=e)}else for(e in r)r[e]&&(t&&(t+=" "),t+=e);return t}function fe(){for(var r,n,e=0,t="",o=arguments.length;e<o;e++)(r=arguments[e])&&(n=Z(r))&&(t&&(t+=" "),t+=n);return t}const pe="univer-action-recorder-panel",Se="univer-action-recorder-panel-icon",ge="univer-action-recorder-panel-icon-recording",ve="univer-recording",he="univer-action-recorder-panel-title",Ce="univer-action-recorder-panel-actions",P={actionRecorderPanel:pe,actionRecorderPanelIcon:Se,actionRecorderPanelIconRecording:ge,recording:ve,actionRecorderPanelTitle:he,actionRecorderPanelActions:Ce};function _e(){const r=a.useDependency(exports.ActionRecorderService);return f.useObservable(r.panelOpened$)?C.jsx(ye,{}):null}function ye(){var p;const r=a.useDependency(a.ICommandService),n=a.useDependency(exports.ActionRecorderService),e=f.useObservable(n.recording$),t=f.useObservable(n.recordedCommands$),o=(p=t==null?void 0:t.length)!=null?p:0,i=v.useCallback(()=>{e||r.executeCommand(G.id)},[r,e]),c=v.useCallback(m=>{e||r.executeCommand(z.id,{replaceId:m})},[r,e]),l=v.useCallback(()=>{e&&r.executeCommand(k.id)},[r,e]),d=v.useCallback(()=>{e&&r.executeCommand(H.id)},[r,e]),h=e?o===0?"Recording...":`${o}: ${t[o-1].id}`:"Start Recording";return C.jsxs("div",{className:P.actionRecorderPanel,children:[C.jsx("div",{className:fe(P.actionRecorderPanelIcon,e?P.actionRecorderPanelIconRecording:!1),children:C.jsx(N,{})}),C.jsx("div",{className:P.actionRecorderPanelTitle,children:h}),C.jsxs("div",{className:P.actionRecorderPanelActions,children:[C.jsx(R.Button,{type:"default",size:"small",onClick:e?d:i,children:e?"Cancel":"Close"}),C.jsx(R.Button,{type:"primary",size:"small",onClick:e?l:()=>c(),children:e?"Save":"Start"}),!e&&C.jsx(R.Button,{type:"primary",size:"small",onClick:()=>c(!0),children:"Start(N)"})]})]})}const K="RECORD_MENU_ITEM";function Re(){return{id:K,type:f.MenuItemType.SUBITEMS,icon:"RecordSingle",tooltip:"action-recorder.menu.title"}}function Ie(r){const n=r.get(exports.ActionRecorderService);return{id:D.id,title:"action-recorder.menu.record",type:f.MenuItemType.BUTTON,disabled$:n.panelOpened$}}function Oe(){return{id:$.id,title:"action-recorder.menu.replay-local",type:f.MenuItemType.BUTTON}}function Ae(){return{id:E.id,title:"action-recorder.menu.replay-local-name",type:f.MenuItemType.BUTTON}}function Pe(){return{id:F.id,title:"action-recorder.menu.replay-local-active",type:f.MenuItemType.BUTTON}}const be={[f.RibbonStartGroup.OTHERS]:{[K]:{order:10,menuItemFactory:Re,[D.id]:{order:1,menuItemFactory:Ie},[$.id]:{order:2,menuItemFactory:Oe},[E.id]:{order:3,menuItemFactory:Ae},[F.id]:{order:4,menuItemFactory:Pe}}}};var xe=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Te=(r,n,e,t)=>{for(var o=t>1?void 0:t?Me(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&xe(n,e,o),o},I=(r,n)=>(e,t)=>n(e,t,r);let M=class extends a.Disposable{constructor(r,n,e,t,o,i){super(),this._commandSrv=r,this._uiPartsSrv=n,this._menuManagerService=e,this._componentManager=t,this._actionRecorderService=o,this._injector=i,this._initCommands(),this._initUI(),this._initSheetsCommands(),this._initDocsCommands()}_initCommands(){[z,H,k,D,G,$,E,F].forEach(r=>this._commandSrv.registerCommand(r))}_initUI(){this._uiPartsSrv.registerComponent(f.BuiltInUIPart.GLOBAL,()=>a.connectInjector(_e,this._injector)),this._componentManager.register("RecordSingle",N),this._menuManagerService.mergeMenu(be)}_initSheetsCommands(){[s.CopySheetCommand,s.DeleteRangeMoveLeftCommand,s.DeleteRangeMoveUpCommand,s.DeltaColumnWidthCommand,s.DeltaRowHeightCommand,s.InsertSheetCommand,s.InsertColAfterCommand,s.InsertColBeforeCommand,s.InsertRowAfterCommand,s.InsertRowBeforeCommand,s.RemoveSheetCommand,s.SetStyleCommand,s.AddWorksheetMergeCommand,s.AddWorksheetMergeAllCommand,s.AddWorksheetMergeVerticalCommand,s.AddWorksheetMergeHorizontalCommand,s.SetFrozenCommand,s.CancelFrozenCommand,s.SetHorizontalTextAlignCommand,s.SetOverlineCommand,u.SetRangeBoldCommand,u.SetRangeFontFamilyCommand,u.SetRangeFontSizeCommand,u.SetRangeItalicCommand,u.SetRangeStrickThroughCommand,u.SetRangeSubscriptCommand,u.SetRangeSuperscriptCommand,u.SetRangeTextColorCommand,u.SetRangeUnderlineCommand,s.SetRangeValuesCommand,s.SetStrikeThroughCommand,s.SetTextColorCommand,s.SetTextRotationCommand,s.SetTextWrapCommand,s.SetVerticalTextAlignCommand,u.SheetCopyCommand,u.SheetCutCommand,u.SheetPasteBesidesBorderCommand,u.SheetPasteColWidthCommand,u.SheetPasteCommand,u.SheetPasteFormatCommand,u.SheetPasteShortKeyCommand,u.SheetPasteValueCommand,u.AutoFillCommand,u.RefillCommand,s.SetWorksheetActivateCommand,s.SetWorksheetActiveOperation,s.SetSelectionsOperation,T.SetSheetFilterRangeCommand,T.SetSheetsFilterCriteriaCommand,T.RemoveSheetFilterCommand].forEach(r=>this._actionRecorderService.registerRecordedCommand(r))}_initDocsCommands(){}};M=Te([I(0,a.ICommandService),I(1,f.IUIPartsService),I(2,f.IMenuManagerService),I(3,a.Inject(f.ComponentManager)),I(4,a.Inject(exports.ActionRecorderService)),I(5,a.Inject(a.Injector))],M);const je="action-recorder.config",V={};var Ue=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,we=(r,n,e,t)=>{for(var o=t>1?void 0:t?Ne(n,e):n,i=r.length-1,c;i>=0;i--)(c=r[i])&&(o=(t?c(n,e,o):c(o))||o);return t&&o&&Ue(n,e,o),o},q=(r,n)=>(e,t)=>n(e,t,r),U;exports.UniverActionRecorderPlugin=(U=class extends a.Plugin{constructor(n=V,e,t){super(),this._config=n,this._injector=e,this._configService=t;const{menu:o,...i}=a.merge({},V,this._config);o&&this._configService.setConfig("menu",o,{merge:!0}),this._configService.setConfig(je,i)}onStarting(){(this._config.replayOnly?[[exports.ActionReplayService]]:[[exports.ActionRecorderService],[exports.ActionReplayService],[M]]).forEach(e=>this._injector.add(e))}onSteady(){this._config.replayOnly||this._injector.get(M)}},g(U,"pluginName","UNIVER_ACTION_RECORDER_PLUGIN"),U);exports.UniverActionRecorderPlugin=we([q(1,a.Inject(a.Injector)),q(2,a.IConfigService)],exports.UniverActionRecorderPlugin);
package/lib/es/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  var me = Object.defineProperty;
2
2
  var ue = (e, r, t) => r in e ? me(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
3
  var u = (e, r, t) => ue(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { Disposable as D, CommandType as g, ICommandService as M, ILogService as Y, IUniverInstanceService as Q, awaitTime as fe, useDependency as T, Inject as b, Injector as X, connectInjector as pe, Plugin as ge, merge as he, IConfigService as ve } from "@univerjs/core";
5
- import { SetSelectionsOperation as E, CopySheetCommand as Se, DeleteRangeMoveLeftCommand as _e, DeleteRangeMoveUpCommand as Ce, DeltaColumnWidthCommand as ye, DeltaRowHeightCommand as Re, InsertSheetCommand as Ie, InsertColAfterCommand as Oe, InsertColBeforeCommand as Pe, InsertRowAfterCommand as xe, InsertRowBeforeCommand as be, RemoveSheetCommand as Ne, SetStyleCommand as Me, AddWorksheetMergeCommand as Ae, AddWorksheetMergeAllCommand as Ue, AddWorksheetMergeVerticalCommand as we, AddWorksheetMergeHorizontalCommand as $e, SetFrozenCommand as je, CancelFrozenCommand as Te, SetHorizontalTextAlignCommand as Ee, SetOverlineCommand as Fe, SetRangeValuesCommand as De, SetStrikeThroughCommand as Le, SetTextColorCommand as Be, SetTextRotationCommand as Ve, SetTextWrapCommand as Je, SetVerticalTextAlignCommand as We, SetWorksheetActivateCommand as ze, SetWorksheetActiveOperation as He } from "@univerjs/sheets";
4
+ import { Disposable as D, CommandType as g, ICommandService as M, ILogService as Y, IUniverInstanceService as Q, awaitTime as fe, useDependency as T, Inject as b, Injector as X, connectInjector as pe, Plugin as ge, merge as he, IConfigService as Se } from "@univerjs/core";
5
+ import { SetSelectionsOperation as E, CopySheetCommand as _e, DeleteRangeMoveLeftCommand as ve, DeleteRangeMoveUpCommand as Ce, DeltaColumnWidthCommand as ye, DeltaRowHeightCommand as Re, InsertSheetCommand as Ie, InsertColAfterCommand as Oe, InsertColBeforeCommand as Pe, InsertRowAfterCommand as xe, InsertRowBeforeCommand as be, RemoveSheetCommand as Ne, SetStyleCommand as Me, AddWorksheetMergeCommand as Ae, AddWorksheetMergeAllCommand as Ue, AddWorksheetMergeVerticalCommand as we, AddWorksheetMergeHorizontalCommand as $e, SetFrozenCommand as je, CancelFrozenCommand as Te, SetHorizontalTextAlignCommand as Ee, SetOverlineCommand as Fe, SetRangeValuesCommand as De, SetStrikeThroughCommand as Le, SetTextColorCommand as Be, SetTextRotationCommand as Ve, SetTextWrapCommand as Je, SetVerticalTextAlignCommand as We, SetWorksheetActivateCommand as ze, SetWorksheetActiveOperation as He } from "@univerjs/sheets";
6
6
  import { SetSheetFilterRangeCommand as qe, SetSheetsFilterCriteriaCommand as ke, RemoveSheetFilterCommand as Ge } from "@univerjs/sheets-filter";
7
7
  import { SetRangeBoldCommand as Ze, SetRangeFontFamilyCommand as Ke, SetRangeFontSizeCommand as Ye, SetRangeItalicCommand as Qe, SetRangeStrickThroughCommand as Xe, SetRangeSubscriptCommand as er, SetRangeSuperscriptCommand as rr, SetRangeTextColorCommand as tr, SetRangeUnderlineCommand as nr, SheetCopyCommand as or, SheetCutCommand as ir, SheetPasteBesidesBorderCommand as cr, SheetPasteColWidthCommand as ar, SheetPasteCommand as sr, SheetPasteFormatCommand as dr, SheetPasteShortKeyCommand as lr, SheetPasteValueCommand as mr, AutoFillCommand as ur, RefillCommand as fr } from "@univerjs/sheets-ui";
8
- import { ILocalFileService as ee, IMessageService as A, useObservable as F, RibbonStartGroup as pr, MenuItemType as I, ComponentManager as gr, IUIPartsService as hr, IMenuManagerService as vr, BuiltInUIPart as Sr } from "@univerjs/ui";
8
+ import { ILocalFileService as ee, IMessageService as A, useObservable as F, RibbonStartGroup as pr, MenuItemType as I, ComponentManager as gr, IUIPartsService as hr, IMenuManagerService as Sr, BuiltInUIPart as _r } from "@univerjs/ui";
9
9
  import { BehaviorSubject as O } from "rxjs";
10
10
  import { MessageType as U, Button as w } from "@univerjs/design";
11
- import _r, { forwardRef as re, useRef as Cr, createElement as te, useCallback as P } from "react";
11
+ import vr, { forwardRef as re, useRef as Cr, createElement as te, useCallback as P } from "react";
12
12
  var l = function() {
13
13
  return l = Object.assign || function(e) {
14
14
  for (var r, t = 1, n = arguments.length; t < n; t++) {
@@ -149,7 +149,7 @@ var Mr = Object.defineProperty, Ar = Object.getOwnPropertyDescriptor, Ur = (e, r
149
149
  (c = e[i]) && (o = (n ? c(r, t, o) : c(o)) || o);
150
150
  return n && o && Mr(r, t, o), o;
151
151
  }, C = (e, r) => (t, n) => r(t, n, e), B = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.NAME = "name", e.ACTIVE = "active", e))(B || {});
152
- let S = class extends D {
152
+ let _ = class extends D {
153
153
  constructor(e, r, t, n, o) {
154
154
  super(), this._messageService = e, this._instanceService = r, this._localFileService = t, this._logService = n, this._commandService = o;
155
155
  }
@@ -213,13 +213,13 @@ let S = class extends D {
213
213
  return !0;
214
214
  }
215
215
  };
216
- S = Ur([
216
+ _ = Ur([
217
217
  C(0, A),
218
218
  C(1, Q),
219
219
  C(2, ee),
220
220
  C(3, Y),
221
221
  C(4, M)
222
- ], S);
222
+ ], _);
223
223
  function wr() {
224
224
  return Math.floor(Math.random() * 800) + 200;
225
225
  }
@@ -227,7 +227,7 @@ const V = {
227
227
  id: "action-recorder.command.replay-local-records",
228
228
  type: g.COMMAND,
229
229
  handler: async (e) => {
230
- const t = await e.get(S).replayLocalJSON();
230
+ const t = await e.get(_).replayLocalJSON();
231
231
  return t && e.get(A).show({
232
232
  type: U.Success,
233
233
  content: "Successfully replayed local records"
@@ -237,7 +237,7 @@ const V = {
237
237
  id: "action-recorder.command.replay-local-records-name",
238
238
  type: g.COMMAND,
239
239
  handler: async (e) => {
240
- const t = await e.get(S).replayLocalJSON(B.NAME);
240
+ const t = await e.get(_).replayLocalJSON(B.NAME);
241
241
  return t && e.get(A).show({
242
242
  type: U.Success,
243
243
  content: "Successfully replayed local records"
@@ -247,7 +247,7 @@ const V = {
247
247
  id: "action-recorder.command.replay-local-records-active",
248
248
  type: g.COMMAND,
249
249
  handler: async (e) => {
250
- const t = await e.get(S).replayLocalJSON(B.ACTIVE);
250
+ const t = await e.get(_).replayLocalJSON(B.ACTIVE);
251
251
  return t && e.get(A).show({
252
252
  type: U.Success,
253
253
  content: "Successfully replayed local records"
@@ -280,7 +280,7 @@ var q;
280
280
  function $r() {
281
281
  if (q) return y;
282
282
  q = 1;
283
- var e = _r, r = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
283
+ var e = vr, r = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
284
284
  function c(a, d, f) {
285
285
  var s, p = {}, h = null, H = null;
286
286
  f !== void 0 && (h = "" + f), d.key !== void 0 && (h = "" + d.key), d.ref !== void 0 && (H = d.ref);
@@ -294,7 +294,7 @@ var k;
294
294
  function jr() {
295
295
  return k || (k = 1, $.exports = $r()), $.exports;
296
296
  }
297
- var v = jr();
297
+ var S = jr();
298
298
  function de(e) {
299
299
  var r, t, n = "";
300
300
  if (typeof e == "string" || typeof e == "number") n += e;
@@ -318,7 +318,7 @@ const Er = "univer-action-recorder-panel", Fr = "univer-action-recorder-panel-ic
318
318
  };
319
319
  function Jr() {
320
320
  const e = T(m);
321
- return F(e.panelOpened$) ? /* @__PURE__ */ v.jsx(Wr, {}) : null;
321
+ return F(e.panelOpened$) ? /* @__PURE__ */ S.jsx(Wr, {}) : null;
322
322
  }
323
323
  function Wr() {
324
324
  var s;
@@ -331,13 +331,13 @@ function Wr() {
331
331
  }, [e, t]), d = P(() => {
332
332
  t && e.executeCommand(ae.id);
333
333
  }, [e, t]), f = t ? o === 0 ? "Recording..." : `${o}: ${n[o - 1].id}` : "Start Recording";
334
- return /* @__PURE__ */ v.jsxs("div", { className: R.actionRecorderPanel, children: [
335
- /* @__PURE__ */ v.jsx("div", { className: Tr(R.actionRecorderPanelIcon, t ? R.actionRecorderPanelIconRecording : !1), children: /* @__PURE__ */ v.jsx(L, {}) }),
336
- /* @__PURE__ */ v.jsx("div", { className: R.actionRecorderPanelTitle, children: f }),
337
- /* @__PURE__ */ v.jsxs("div", { className: R.actionRecorderPanelActions, children: [
338
- /* @__PURE__ */ v.jsx(w, { type: "default", size: "small", onClick: t ? d : i, children: t ? "Cancel" : "Close" }),
339
- /* @__PURE__ */ v.jsx(w, { type: "primary", size: "small", onClick: t ? a : () => c(), children: t ? "Save" : "Start" }),
340
- !t && /* @__PURE__ */ v.jsx(w, { type: "primary", size: "small", onClick: () => c(!0), children: "Start(N)" })
334
+ return /* @__PURE__ */ S.jsxs("div", { className: R.actionRecorderPanel, children: [
335
+ /* @__PURE__ */ S.jsx("div", { className: Tr(R.actionRecorderPanelIcon, t ? R.actionRecorderPanelIconRecording : !1), children: /* @__PURE__ */ S.jsx(L, {}) }),
336
+ /* @__PURE__ */ S.jsx("div", { className: R.actionRecorderPanelTitle, children: f }),
337
+ /* @__PURE__ */ S.jsxs("div", { className: R.actionRecorderPanelActions, children: [
338
+ /* @__PURE__ */ S.jsx(w, { type: "default", size: "small", onClick: t ? d : i, children: t ? "Cancel" : "Close" }),
339
+ /* @__PURE__ */ S.jsx(w, { type: "primary", size: "small", onClick: t ? a : () => c(), children: t ? "Save" : "Start" }),
340
+ !t && /* @__PURE__ */ S.jsx(w, { type: "primary", size: "small", onClick: () => c(!0), children: "Start(N)" })
341
341
  ] })
342
342
  ] });
343
343
  }
@@ -408,7 +408,7 @@ var Kr = Object.defineProperty, Yr = Object.getOwnPropertyDescriptor, Qr = (e, r
408
408
  for (var o = n > 1 ? void 0 : n ? Yr(r, t) : r, i = e.length - 1, c; i >= 0; i--)
409
409
  (c = e[i]) && (o = (n ? c(r, t, o) : c(o)) || o);
410
410
  return n && o && Kr(r, t, o), o;
411
- }, _ = (e, r) => (t, n) => r(t, n, e);
411
+ }, v = (e, r) => (t, n) => r(t, n, e);
412
412
  let N = class extends D {
413
413
  constructor(e, r, t, n, o, i) {
414
414
  super(), this._commandSrv = e, this._uiPartsSrv = r, this._menuManagerService = t, this._componentManager = n, this._actionRecorderService = o, this._injector = i, this._initCommands(), this._initUI(), this._initSheetsCommands(), this._initDocsCommands();
@@ -426,15 +426,15 @@ let N = class extends D {
426
426
  ].forEach((e) => this._commandSrv.registerCommand(e));
427
427
  }
428
428
  _initUI() {
429
- this._uiPartsSrv.registerComponent(Sr.GLOBAL, () => pe(Jr, this._injector)), this._componentManager.register("RecordSingle", L), this._menuManagerService.mergeMenu(Zr);
429
+ this._uiPartsSrv.registerComponent(_r.GLOBAL, () => pe(Jr, this._injector)), this._componentManager.register("RecordSingle", L), this._menuManagerService.mergeMenu(Zr);
430
430
  }
431
431
  _initSheetsCommands() {
432
432
  [
433
433
  // InsertColCommand,
434
434
  // InsertRowCommand,
435
435
  // #region basic commands
436
- Se,
437
436
  _e,
437
+ ve,
438
438
  Ce,
439
439
  ye,
440
440
  Re,
@@ -505,12 +505,12 @@ let N = class extends D {
505
505
  }
506
506
  };
507
507
  N = Qr([
508
- _(0, M),
509
- _(1, hr),
510
- _(2, vr),
511
- _(3, b(gr)),
512
- _(4, b(m)),
513
- _(5, b(X))
508
+ v(0, M),
509
+ v(1, hr),
510
+ v(2, Sr),
511
+ v(3, b(gr)),
512
+ v(4, b(m)),
513
+ v(5, b(X))
514
514
  ], N);
515
515
  const Xr = "action-recorder.config", G = {};
516
516
  var et = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, tt = (e, r, t, n) => {
@@ -529,9 +529,9 @@ let K = (j = class extends ge {
529
529
  n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Xr, o);
530
530
  }
531
531
  onStarting() {
532
- (this._config.replayOnly ? [[S]] : [
532
+ (this._config.replayOnly ? [[_]] : [
533
533
  [m],
534
- [S],
534
+ [_],
535
535
  [N]
536
536
  ]).forEach((r) => this._injector.add(r));
537
537
  }
@@ -541,10 +541,10 @@ let K = (j = class extends ge {
541
541
  }, u(j, "pluginName", "UNIVER_ACTION_RECORDER_PLUGIN"), j);
542
542
  K = tt([
543
543
  Z(1, b(X)),
544
- Z(2, ve)
544
+ Z(2, Se)
545
545
  ], K);
546
546
  export {
547
547
  m as ActionRecorderService,
548
- S as ActionReplayService,
548
+ _ as ActionReplayService,
549
549
  K as UniverActionRecorderPlugin
550
550
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/action-recorder",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -52,23 +52,24 @@
52
52
  "rxjs": ">=7.0.0"
53
53
  },
54
54
  "dependencies": {
55
- "@univerjs/icons": "^0.2.10",
55
+ "@univerjs/icons": "^0.2.12",
56
56
  "clsx": "^2.1.1",
57
- "@univerjs/design": "0.5.3",
58
- "@univerjs/sheets": "0.5.3",
59
- "@univerjs/sheets-filter": "0.5.3",
60
- "@univerjs/sheets-ui": "0.5.3",
61
- "@univerjs/ui": "0.5.3",
62
- "@univerjs/core": "0.5.3"
57
+ "@univerjs/core": "0.5.4",
58
+ "@univerjs/sheets": "0.5.4",
59
+ "@univerjs/sheets-filter": "0.5.4",
60
+ "@univerjs/design": "0.5.4",
61
+ "@univerjs/sheets-ui": "0.5.4",
62
+ "@univerjs/ui": "0.5.4"
63
63
  },
64
64
  "devDependencies": {
65
65
  "less": "^4.2.1",
66
66
  "react": "18.3.1",
67
67
  "rxjs": "^7.8.1",
68
+ "tailwindcss": "^3.4.17",
68
69
  "typescript": "^5.7.2",
69
- "vite": "^6.0.6",
70
+ "vite": "^6.0.7",
70
71
  "vitest": "^2.1.8",
71
- "@univerjs-infra/shared": "0.5.3"
72
+ "@univerjs-infra/shared": "0.5.4"
72
73
  },
73
74
  "scripts": {
74
75
  "test": "vitest run",