@loftyshaky/shared 0.0.37 → 0.0.38

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/app.js CHANGED
@@ -1 +1 @@
1
- import{M as Main}from"./chunk-main-dc684054.js";import"react";import"./chunk-main-91345fec.js";import"react-dom";global.page="front_end",global.misplaced_dependency=culprit_page=>err((()=>{if(page!==culprit_page){const msg=we.i18n.getMessage("dependencicies_from_other_page_loaded_into_this_page_alert")+culprit_page.toUpperCase();"background"===page?console.log(msg):alert(msg)}}),"shr_1193");class App{constructor(){this.log_error=(error_obj,error_code)=>{Main.i().output_error(error_obj,error_code)},this.get_ext_version=()=>{try{return"9.9.9"}catch(error_obj){this.log_error(error_obj,"shr_1191")}return""},this.msg=()=>{try{const msg_2="";return n(msg_2)?msg_2:""}catch(error_obj){this.log_error(error_obj,"shr_1192")}return""}}static i(){return this.i0||(this.i0=new this)}}global.app=App.i();export{App};
1
+ import{M as Main}from"./chunk-main-4f6c8169.js";import"react";import"./chunk-main-723a7930.js";import"react-dom";global.page="front_end",global.misplaced_dependency=culprit_page=>err((()=>{if(page!==culprit_page){const msg=we.i18n.getMessage("dependencicies_from_other_page_loaded_into_this_page_alert")+culprit_page.toUpperCase();"background"===page?console.log(msg):alert(msg)}}),"shr_1193");class App{constructor(){this.log_error=(error_obj,error_code)=>{Main.i().output_error(error_obj,error_code)},this.get_ext_version=()=>{try{return"9.9.9"}catch(error_obj){this.log_error(error_obj,"shr_1191")}return""},this.msg=()=>{try{const msg_2="";return n(msg_2)?msg_2:""}catch(error_obj){this.log_error(error_obj,"shr_1192")}return""}}static i(){return this.i0||(this.i0=new this)}}global.app=App.i();export{App};
@@ -1 +1 @@
1
- import{_ as __awaiter,o as observer,s as svg,B as Body$2,m as makeObservable,b as observable,d as action,r as runInAction,e as computed}from"./chunk-main-91345fec.js";import React__default,{useEffect}from"react";global.show_err_ribbon=(error_obj,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay,is_notification:is_notification=!1,notification_msg_key:notification_msg_key=""}={})=>Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay,is_notification:is_notification,notification_msg_key:notification_msg_key}),global.err=(f,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay}={})=>{try{return f()}catch(error_obj){Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay})}},global.err_async=(f,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay}={})=>__awaiter(void 0,void 0,void 0,(function*(){try{return yield f()}catch(error_obj){Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay})}})),global.throw_err=msg=>{throw new Error(msg)},global.throw_err_obj=error_obj=>{throw error_obj},global.err_obj=msg=>new Error(msg);const Body$1=observer(class extends React__default.Component{static getDerivedStateFromError(){Visibility.i().show_reload_ui_screen()}componentDidCatch(err_obj){show_err_ribbon(err_obj,"shr_1000",{error_msg_key:"cant_render_ui"})}render(){if(Visibility.i().page_is_crashed)return React__default.createElement("div",{className:"reload_ui_btn_w"},React__default.createElement("button",{className:x.cls(["btn","reload_ui"]),type:"button",onClick:Page.i().reload},ext.msg("reload_ui_btn_text")));const{children:children}=this.props;return children}}),Body=observer((props=>(useEffect((()=>{const{app_id:app_id}=props;(class{constructor(){this.load=({app_id:app_id})=>{x.css("font_face",document.head,`font_face_link_${app_id}`);const error_root=s(`.error_${app_id}`);if(n(error_root)){const error_shadow=n(error_root.shadowRoot)?error_root.shadowRoot:void 0;if(error_shadow){const error_css=x.css("error",error_shadow);n(error_css)&&x.bind(error_css,"load",(()=>{State.i().change_state({observable_key:"is_loaded",state:!0})}))}}}}static i(){return this.i0||(this.i0=new this)}}).i().load({app_id:app_id})}),[props]),React__default.createElement("div",{className:x.cls(["main","error",State.i().is_highlighted_cls,State.i().is_notification_cls]),role:"none",style:{display:State.i().is_visible_style},onMouseDown:State.i().clear_all_reset_state_timeouts},React__default.createElement(ExtName,null),React__default.createElement(Msg$1,null),React__default.createElement(CloseBtn,null))))),CloseBtn=observer((()=>React__default.createElement("button",{className:"close_btn",type:"button",onClick:()=>State.i().change_state({observable_key:"is_visible",state:!1})},React__default.createElement(svg.Close,null)))),ExtName=()=>React__default.createElement("span",{className:"ext_name"},`${ext.msg("name")||we.runtime.getManifest().name} `,React__default.createElement(Body$2,null)),Msg$1=observer((()=>React__default.createElement("div",{className:"msg"},Msg.i().main_msg,State.i().is_notification?void 0:React__default.createElement(React__default.Fragment,null,React__default.createElement("button",{type:"button",className:x.cls(["more_info_btn",Msg.i().more_info_btn_is_visible_cls]),onClick:()=>Msg.i().change_visibility_of_advanced_msg({is_visible:!0})},ext.msg("error_more_info_btn_text")),React__default.createElement("div",{className:Msg.i().advanced_msg_is_visible_cls},Msg.i().advanced_msg)))));class Main$2{constructor(){this.catch_fatal_error=callback=>__awaiter(this,void 0,void 0,(function*(){if("background"===page)callback();else if(is_ext){(yield ext.send_msg_resp({msg:"check_if_background_page_is_available"}))&&callback()}else callback()}))}static i(){return this.i0||(this.i0=new this)}}class Visibility{constructor(){this.page_is_crashed=!1,this.show_reload_ui_screen=()=>{this.page_is_crashed=!0},makeObservable(this,{page_is_crashed:observable,show_reload_ui_screen:action})}static i(){return this.i0||(this.i0=new this)}}class Main$1{constructor(){this.hide_delay=5e3,this.highlight_time=300,this.show_error=(error_obj,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=this.hide_delay,is_notification:is_notification=!1,notification_msg_key:notification_msg_key=""}={})=>{Main$2.i().catch_fatal_error((()=>{const error_ui_is_visible=!(x.in_service_worker||silent||error_obj&&error_obj.silent);if(error_ui_is_visible&&(is_notification?(State.i().change_state({observable_key:"is_notification",state:!0}),Msg.i().notification_msg_key=notification_msg_key):State.i().change_state({observable_key:"is_notification",state:!1}),State.i().change_state({observable_key:"is_visible",state:!0}),State.i().change_state({observable_key:"is_highlighted",state:!0}),State.i().clear_all_reset_state_timeouts(),error_obj&&error_obj.persistent||persistent||State.i().run_reset_state_timeout({observable_key:"is_visible",delay:hide_delay+this.highlight_time}),State.i().run_reset_state_timeout({observable_key:"is_highlighted",delay:this.highlight_time})),error_obj&&error_code){error_ui_is_visible&&Msg.i().change_visibility_of_advanced_msg({is_visible:!1});const error_msg_pre=ext.msg(`${error_obj.error_msg||error_msg_key}_error`),error_msg_final=error_msg_pre?` ${error_msg_pre}`:"";if(runInAction((()=>err((()=>{Msg.i().basic_msg=`${ext.msg("an_error_occured_msg")+error_msg_final}`,Msg.i().advanced_msg=`${ext.msg("error_code_label")+(error_obj.error_code||error_code)}\n${ext.msg("error_type_label")+error_obj.name}\n${ext.msg("error_msg_label")+error_obj.message}`}),"shr_1195"))),error_obj.exit||exit){const updated_error_obj=error_obj,set_updated_error_obj_propery=({key:key,undefined_property:undefined_property})=>{updated_error_obj[key]=n(error_obj[key])?error_obj[key]:undefined_property};throw set_updated_error_obj_propery({key:"error_code",undefined_property:error_code}),set_updated_error_obj_propery({key:"error_msg",undefined_property:error_msg_key}),set_updated_error_obj_propery({key:"silent",undefined_property:silent}),set_updated_error_obj_propery({key:"persistent",undefined_property:persistent}),set_updated_error_obj_propery({key:"exit",undefined_property:exit}),set_updated_error_obj_propery({key:"hide_delay",undefined_property:hide_delay}),updated_error_obj}this.output_error(error_obj,error_code)}}))},this.output_error=(error_obj,error_code)=>{const line="---------------------------",separator_bottom=`\n${line}`,error_code_and_msg=`${`${line}\n`}Code: ${error_code}\nMessage: ${error_obj.message}`,console_output=error_obj.stack?`${error_code_and_msg}\nStack: ${error_obj.stack+separator_bottom}`:error_code_and_msg+separator_bottom;console.error(console_output)},makeObservable(this,{show_error:action})}static i(){return this.i0||(this.i0=new this)}}class Msg{constructor(){this.advanced_msg_is_visible=!1,this.basic_msg="",this.advanced_msg="",this.notification_msg_key="",this.change_visibility_of_advanced_msg=({is_visible:is_visible})=>{this.advanced_msg_is_visible=is_visible},makeObservable(this,{advanced_msg_is_visible:observable,basic_msg:observable,advanced_msg:observable,notification_msg_key:observable,main_msg:computed,advanced_msg_is_visible_cls:computed,more_info_btn_is_visible_cls:computed,change_visibility_of_advanced_msg:action})}static i(){return this.i0||(this.i0=new this)}get advanced_msg_is_visible_cls(){return this.advanced_msg_is_visible?"":"none"}get more_info_btn_is_visible_cls(){return this.advanced_msg_is_visible?"none":""}get main_msg(){return State.i().is_notification?ext.msg(this.notification_msg_key):this.basic_msg}}class State{constructor(){this.is_loaded=!1,this.is_visible=!1,this.is_highlighted=!1,this.is_notification=!1,this.change_state=({observable_key:observable_key,state:state})=>{this[observable_key]=state},this.run_reset_state_timeout=({observable_key:observable_key,delay:delay})=>{this[`${observable_key}_timeout`]=global.setTimeout((()=>{this.change_state({observable_key:observable_key,state:!1})}),delay)},this.clear_all_reset_state_timeouts=()=>{n(this.is_visible_timeout)&&n(this.is_highlighted_timeout)&&(clearTimeout(this.is_visible_timeout),clearTimeout(this.is_highlighted_timeout))},makeObservable(this,{is_loaded:observable,is_visible:observable,is_highlighted:observable,is_notification:observable,is_visible_style:computed,is_highlighted_cls:computed,change_state:action})}static i(){return this.i0||(this.i0=new this)}get is_visible_style(){return this.is_loaded&&this.is_visible?"":"none"}get is_highlighted_cls(){return this.is_highlighted?"is_highlighted":""}get is_notification_cls(){return this.is_notification?"is_notification":""}}class Page{constructor(){this.reload=()=>{global.location.reload()}}static i(){return this.i0||(this.i0=new this)}}export{Body$1 as B,CloseBtn as C,ExtName as E,Main$1 as M,Visibility as V,Body as a,Msg$1 as b,Main$2 as c};
1
+ import{_ as __awaiter,o as observer,s as svg,B as Body$2,m as makeObservable,b as observable,d as action,r as runInAction,e as computed}from"./chunk-main-723a7930.js";import React__default,{useEffect}from"react";global.show_err_ribbon=(error_obj,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay,is_notification:is_notification=!1,notification_msg_key:notification_msg_key=""}={})=>Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay,is_notification:is_notification,notification_msg_key:notification_msg_key}),global.err=(f,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay}={})=>{try{return f()}catch(error_obj){Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay})}},global.err_async=(f,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=Main$1.i().hide_delay}={})=>__awaiter(void 0,void 0,void 0,(function*(){try{return yield f()}catch(error_obj){Main$1.i().show_error(error_obj,error_code,{error_msg_key:error_msg_key,silent:silent,persistent:persistent,exit:exit,hide_delay:hide_delay})}})),global.throw_err=msg=>{throw new Error(msg)},global.throw_err_obj=error_obj=>{throw error_obj},global.err_obj=msg=>new Error(msg);const Body$1=observer(class extends React__default.Component{static getDerivedStateFromError(){Visibility.i().show_reload_ui_screen()}componentDidCatch(err_obj){show_err_ribbon(err_obj,"shr_1000",{error_msg_key:"cant_render_ui"})}render(){if(Visibility.i().page_is_crashed)return React__default.createElement("div",{className:"reload_ui_btn_w"},React__default.createElement("button",{className:x.cls(["btn","reload_ui"]),type:"button",onClick:Page.i().reload},ext.msg("reload_ui_btn_text")));const{children:children}=this.props;return children}}),Body=observer((props=>(useEffect((()=>{const{app_id:app_id}=props;(class{constructor(){this.load=({app_id:app_id})=>{x.css("font_face",document.head,`font_face_link_${app_id}`);const error_root=s(`.error_${app_id}`);if(n(error_root)){const error_shadow=n(error_root.shadowRoot)?error_root.shadowRoot:void 0;if(error_shadow){const error_css=x.css("error",error_shadow);n(error_css)&&x.bind(error_css,"load",(()=>{State.i().change_state({observable_key:"is_loaded",state:!0})}))}}}}static i(){return this.i0||(this.i0=new this)}}).i().load({app_id:app_id})}),[props]),React__default.createElement("div",{className:x.cls(["main","error",State.i().is_highlighted_cls,State.i().is_notification_cls]),role:"none",style:{display:State.i().is_visible_style},onMouseDown:State.i().clear_all_reset_state_timeouts},React__default.createElement(ExtName,null),React__default.createElement(Msg$1,null),React__default.createElement(CloseBtn,null))))),CloseBtn=observer((()=>React__default.createElement("button",{className:"close_btn",type:"button",onClick:()=>State.i().change_state({observable_key:"is_visible",state:!1})},React__default.createElement(svg.Close,null)))),ExtName=()=>React__default.createElement("span",{className:"ext_name"},`${ext.msg("name")||we.runtime.getManifest().name} `,React__default.createElement(Body$2,null)),Msg$1=observer((()=>React__default.createElement("div",{className:"msg"},Msg.i().main_msg,State.i().is_notification?void 0:React__default.createElement(React__default.Fragment,null,React__default.createElement("button",{type:"button",className:x.cls(["more_info_btn",Msg.i().more_info_btn_is_visible_cls]),onClick:()=>Msg.i().change_visibility_of_advanced_msg({is_visible:!0})},ext.msg("error_more_info_btn_text")),React__default.createElement("div",{className:Msg.i().advanced_msg_is_visible_cls},Msg.i().advanced_msg)))));class Main$2{constructor(){this.catch_fatal_error=callback=>__awaiter(this,void 0,void 0,(function*(){if("background"===page)callback();else if(is_ext){(yield ext.send_msg_resp({msg:"check_if_background_page_is_available"}))&&callback()}else callback()}))}static i(){return this.i0||(this.i0=new this)}}class Visibility{constructor(){this.page_is_crashed=!1,this.show_reload_ui_screen=()=>{this.page_is_crashed=!0},makeObservable(this,{page_is_crashed:observable,show_reload_ui_screen:action})}static i(){return this.i0||(this.i0=new this)}}class Main$1{constructor(){this.hide_delay=5e3,this.highlight_time=300,this.show_error=(error_obj,error_code,{error_msg_key:error_msg_key="",silent:silent=!1,persistent:persistent=!1,exit:exit=!1,hide_delay:hide_delay=this.hide_delay,is_notification:is_notification=!1,notification_msg_key:notification_msg_key=""}={})=>{Main$2.i().catch_fatal_error((()=>{const error_ui_is_visible=!(x.in_service_worker||silent||error_obj&&error_obj.silent);if(error_ui_is_visible&&(is_notification?(State.i().change_state({observable_key:"is_notification",state:!0}),Msg.i().notification_msg_key=notification_msg_key):State.i().change_state({observable_key:"is_notification",state:!1}),State.i().change_state({observable_key:"is_visible",state:!0}),State.i().change_state({observable_key:"is_highlighted",state:!0}),State.i().clear_all_reset_state_timeouts(),error_obj&&error_obj.persistent||persistent||State.i().run_reset_state_timeout({observable_key:"is_visible",delay:hide_delay+this.highlight_time}),State.i().run_reset_state_timeout({observable_key:"is_highlighted",delay:this.highlight_time})),error_obj&&error_code){error_ui_is_visible&&Msg.i().change_visibility_of_advanced_msg({is_visible:!1});const error_msg_pre=ext.msg(`${error_obj.error_msg||error_msg_key}_error`),error_msg_final=error_msg_pre?` ${error_msg_pre}`:"";if(runInAction((()=>err((()=>{Msg.i().basic_msg=`${ext.msg("an_error_occured_msg")+error_msg_final}`,Msg.i().advanced_msg=`${ext.msg("error_code_label")+(error_obj.error_code||error_code)}\n${ext.msg("error_type_label")+error_obj.name}\n${ext.msg("error_msg_label")+error_obj.message}`}),"shr_1195"))),error_obj.exit||exit){const updated_error_obj=error_obj,set_updated_error_obj_propery=({key:key,undefined_property:undefined_property})=>{updated_error_obj[key]=n(error_obj[key])?error_obj[key]:undefined_property};throw set_updated_error_obj_propery({key:"error_code",undefined_property:error_code}),set_updated_error_obj_propery({key:"error_msg",undefined_property:error_msg_key}),set_updated_error_obj_propery({key:"silent",undefined_property:silent}),set_updated_error_obj_propery({key:"persistent",undefined_property:persistent}),set_updated_error_obj_propery({key:"exit",undefined_property:exit}),set_updated_error_obj_propery({key:"hide_delay",undefined_property:hide_delay}),updated_error_obj}this.output_error(error_obj,error_code)}}))},this.output_error=(error_obj,error_code)=>{const line="---------------------------",separator_bottom=`\n${line}`,error_code_and_msg=`${`${line}\n`}Code: ${error_code}\nMessage: ${error_obj.message}`,console_output=error_obj.stack?`${error_code_and_msg}\nStack: ${error_obj.stack+separator_bottom}`:error_code_and_msg+separator_bottom;console.error(console_output)},makeObservable(this,{show_error:action})}static i(){return this.i0||(this.i0=new this)}}class Msg{constructor(){this.advanced_msg_is_visible=!1,this.basic_msg="",this.advanced_msg="",this.notification_msg_key="",this.change_visibility_of_advanced_msg=({is_visible:is_visible})=>{this.advanced_msg_is_visible=is_visible},makeObservable(this,{advanced_msg_is_visible:observable,basic_msg:observable,advanced_msg:observable,notification_msg_key:observable,main_msg:computed,advanced_msg_is_visible_cls:computed,more_info_btn_is_visible_cls:computed,change_visibility_of_advanced_msg:action})}static i(){return this.i0||(this.i0=new this)}get advanced_msg_is_visible_cls(){return this.advanced_msg_is_visible?"":"none"}get more_info_btn_is_visible_cls(){return this.advanced_msg_is_visible?"none":""}get main_msg(){return State.i().is_notification?ext.msg(this.notification_msg_key):this.basic_msg}}class State{constructor(){this.is_loaded=!1,this.is_visible=!1,this.is_highlighted=!1,this.is_notification=!1,this.change_state=({observable_key:observable_key,state:state})=>{this[observable_key]=state},this.run_reset_state_timeout=({observable_key:observable_key,delay:delay})=>{this[`${observable_key}_timeout`]=global.setTimeout((()=>{this.change_state({observable_key:observable_key,state:!1})}),delay)},this.clear_all_reset_state_timeouts=()=>{n(this.is_visible_timeout)&&n(this.is_highlighted_timeout)&&(clearTimeout(this.is_visible_timeout),clearTimeout(this.is_highlighted_timeout))},makeObservable(this,{is_loaded:observable,is_visible:observable,is_highlighted:observable,is_notification:observable,is_visible_style:computed,is_highlighted_cls:computed,change_state:action})}static i(){return this.i0||(this.i0=new this)}get is_visible_style(){return this.is_loaded&&this.is_visible?"":"none"}get is_highlighted_cls(){return this.is_highlighted?"is_highlighted":""}get is_notification_cls(){return this.is_notification?"is_notification":""}}class Page{constructor(){this.reload=()=>{global.location.reload()}}static i(){return this.i0||(this.i0=new this)}}export{Body$1 as B,CloseBtn as C,ExtName as E,Main$1 as M,Visibility as V,Body as a,Msg$1 as b,Main$2 as c};