UNPKG

@veltdev/sdk

Version:

Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.

2 lines (1 loc) 2.81 kB
import{da as I,ea as D,ga as E}from"./chunk-KU45CEXD.js";import{Nh as v,Ua as f,Ya as m,a as s,b as g,bi as C,da as n,di as y,qa as S,vc as d,wa as u,xc as p}from"./chunk-GR3NESUB.js";var B=(()=>{let r=class r extends E{set parentLocalUIState(e){try{e&&(this.localUIStateSignal=e,this.isLocalUIStateOwner=!1)}catch{}}get elementRef(){try{return this.hostElementRef}catch{return null}}getServiceComponentConfigSignal(){}constructor(){let e=n(u),t=n(D),o=n(p),l=n(C).get(v),h=n(I),c=n(y);super(e,t,o,l??void 0,void 0,h,c),this.defaultCondition=d(!0,{transform:i=>{try{return typeof i=="string"?i==="true"||i==="":i}catch{return!0}}}),this.isLocalUIStateOwner=!1;try{this.hostElementRef=e,this.themeService=t,this.dynamicDataService=h,this.loggingService=c,this.cd=o,this.commentService=l??void 0,this.initializeLocalUIState()}catch(i){this.loggingService=this.loggingService||c,this.loggingService?.catch?.("Error in V2PrimitiveThemedBase constructor:",i)}}initializeLocalUIState(){this.localUIStateSignal=S(this.getDefaultLocalUIState()),this.isLocalUIStateOwner=!0}getConditionalClassesContext(){return{componentConfigSignal:this.componentConfigSignal}}ngOnInit(){try{this.connectToServiceSignalIfStandalone(),this.dynamicDataService.applyConditionalClasses(this.hostElementRef?.nativeElement,this.getConditionalClassesContext()),this.setupA11yAttributes(),this.isLocalUIStateOwner&&this.setupDarkModeSync()}catch(e){this.loggingService.catch("Error in V2PrimitiveThemedBase ngOnInit:",e)}}connectToServiceSignalIfStandalone(){try{let e=this.componentConfigSignal();if(!e||!e?.uiState){let t=this.getServiceComponentConfigSignal();t&&(this.componentConfigSignal=t)}}catch(e){this.loggingService.catch("Error connecting to service signal:",e)}}ngOnDestroy(){try{this.darkModeConfigSyncSubscription&&this.darkModeConfigSyncSubscription.unsubscribe(),super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in V2PrimitiveThemedBase ngOnDestroy:",e)}}setupA11yAttributes(){}setupDarkModeSync(){try{this.darkModeConfigSyncSubscription=this.onDarkModeChange().subscribe(e=>{try{if(this.componentConfigSignal&&typeof this.componentConfigSignal=="function"){let t=this.componentConfigSignal();t&&t.uiState&&t.uiState.darkMode!==e&&this.componentConfigSignal.update(o=>g(s({},o),{uiState:g(s({},o.uiState),{darkMode:e})}))}}catch(t){this.loggingService.catch("Error in darkMode sync subscription:",t)}})}catch(e){this.loggingService.catch("Error in V2PrimitiveThemedBase setupDarkModeSync:",e)}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=f({type:r,selectors:[["app-v2-primitive-themed-base"]],inputs:{defaultCondition:[1,"defaultCondition"],parentLocalUIState:"parentLocalUIState"},standalone:!1,features:[m],decls:0,vars:0,template:function(t,o){},encapsulation:2});let a=r;return a})();export{B as a};