@univerjs/action-recorder 0.5.3 → 0.5.4-nightly.202501131606

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-nightly.202501131606",
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-nightly.202501131606",
58
+ "@univerjs/sheets-filter": "0.5.4-nightly.202501131606",
59
+ "@univerjs/design": "0.5.4-nightly.202501131606",
60
+ "@univerjs/ui": "0.5.4-nightly.202501131606",
61
+ "@univerjs/sheets": "0.5.4-nightly.202501131606",
62
+ "@univerjs/sheets-ui": "0.5.4-nightly.202501131606"
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",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS