initial commit with charts and assistant chat
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[2283],{40226:(e,t,i)=>{i.d(t,{LevelsProperty:()=>g});var n=i(90054),s=i(16738),r=i(87465),o=i(78176),a=i(60973);const l={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:()=>Object(),unpack:()=>[]}};function h(e,t,i,n){return n.push(i[t]),n}function c(e,t,i,n){return n[t]=i[e],n}function u(){return[]}function d(){return{}}function _(e,t,i){return i.prefixes.forEach((n=>{const s=n+"level";for(let n=i.range[0];n<=i.range[1];n++)if(e[s+n]&&(0,r.isSameType)(e[s+n],t.typecheck())){let r=t.tpl();i.names.forEach(((i,o)=>{r=t.fill(""+o,i,e[s+n],r)})),e[s+n]=r}})),e}function p(e,t,i){return i(e,{tpl:d,fill:c,typecheck:t.typecheck.unpack},t)}class g extends o.DefaultProperty{constructor(e){const{levelsIterator:t=_,map:i={},...n}=e,s={...l,...i};n.state&&(n.state=p(n.state,s,t)),super(n),this._map=s,this._levelsIterator=t}state(e,t,i){const n=super.state(e,t);return i?n:(s=n,r=this._map,(0,this._levelsIterator)(s,{tpl:u,fill:h,typecheck:r.typecheck.pack},r));var s,r}preferences(){return(0,o.extractState)(this.state(this._excludedDefaultsKeys,void 0,!0),this._allDefaultsKeys)}applyTemplate(e,t){this.mergeAndFire((0,o.extractState)((0,s.default)((0,n.default)(t),p(e,this._map,this._levelsIterator)),this._allStateKeys,this._excludedTemplateKeys))}saveDefaults(){this._useUserPreferences&&(0,a.saveDefaults)(this._defaultName,this.preferences())}clone(){return new g(this._options())}merge(e,t){return super.merge(this._map?p(e,this._map,this._levelsIterator):e,t)}_options(){return{...super._options(),map:{...this._map},levelsIterator:this._levelsIterator}}}},5871:(e,t,i)=>{i.r(t),i.d(t,{LineToolFibChannel:()=>_});var n,s,r=i(50151),o=i(11542),a=i(95804),l=i(13896),h=i(40226),c=i(65045),u=i(63117);!function(e){e[e.FibChannelWithReverse=1]="FibChannelWithReverse",e[e.FibChannelWithoutReverse=2]="FibChannelWithoutReverse",e[e.TheLatest=2]="TheLatest"}(n||(n={})),function(e){e[e.LevelsCount=24]="LevelsCount"}(s||(s={}));const d=new a.TranslatedString("erase level line",o.t(null,void 0,i(77114)));class _ extends u.InplaceTextLineDataSource{constructor(e,t,n,s){super(e,t??_.createProperties(e.backgroundTheme().spawnOwnership()),n,s),this.version=2,Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,3898)).then((({FibChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 24}migrateVersion(e,t,i){i.properties.removeProperty("reverse")}pointsCount(){return 3}name(){return"Fib Channel"}processErase(e,t){const i="level"+t,n=(0,r.ensureDefined)(this.properties().child(i)).childs().visible;e.setProperty(n,!1,d,l.lineToolsDoNotAffectChartInvalidation)}editableTextProperties(){(0,r.assert)(!1,"unexpected method call")}static createProperties(e,t){const i=new h.LevelsProperty({defaultName:"linetoolfibchannel",state:t,map:{range:[1,24],names:["coeff","color","visible"]},theme:e});return this._configureProperties(i),i}async _getPropertyDefinitionsViewModelClass(){
|
||||
return(await Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,55200))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[];for(let i=1;i<=24;i++){const n=(0,r.ensureDefined)(e.child("level"+i));t.push((0,r.ensureDefined)(n.child("color")))}e.addChild("linesColors",new c.LineToolColorsProperty(t))}}},63117:(e,t,i)=>{i.d(t,{InplaceTextLineDataSource:()=>f,InplaceTextUndoCommand:()=>w});var n=i(50279),s=i(50151),r=i(10555),o=i(58978),a=i(24377),l=i(11542),h=i(95804),c=i(48943),u=i(22613),d=i(72270),_=i(41414),p=i(40472),g=i(13896);const v={selectionColor:(0,o.getHexColorByName)("color-tv-blue-500"),cursorColor:(0,o.getHexColorByName)("color-black")},m={selectionColor:(0,o.getHexColorByName)("color-white"),cursorColor:(0,o.getHexColorByName)("color-white")};var x;!function(e){e[e.TextEditingJustFinishedTime=100]="TextEditingJustFinishedTime"}(x||(x={}));class w extends d.UndoCommand{constructor(e,t,n,s){super(new h.TranslatedString("change {title} text",l.t(null,void 0,i(57122))).format({title:new h.TranslatedString(t.name(),t.translatedType())}),!0,!g.lineToolsDoNotAffectChartInvalidation),this._sourceId=t.id(),this._model=e,this._oldValue=n,this._newValue=s}redo(){const e=this._source();this._textProperty(e).setValue(this._newValue)}undo(){const e=this._source();this._textProperty(e).setValue(this._oldValue)}_textProperty(e){return e.editableTextProperties().text}_source(){return(0,s.ensureNotNull)(this._model.dataSourceForId(this._sourceId))}}class f extends _.LineDataSource{constructor(e,t,n,s){super(e,t,n,s),this._container=null,this._activeEditingOwnerSource=null,this._editableText=new u.WatchedValue(""),this._activateTextEditingEl=null,this._paneView=null,this._selectionData={},this._cursorPaneView=null,this._cursorPosition=null,this._editingOnCreation=!1,this._editingActivationTime=null,this._editingDeactivationTime=0,this._editableText.subscribe((()=>{this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id()))})),this._isDarkBackground=(0,c.combine)(((e,t)=>{if(null===t)return this._model.dark().value();const i=(0,a.blendRgba)((0,a.parseRgba)(e),(0,a.parseRgba)(t));return"black"===(0,a.rgbToBlackWhiteString)([i[0],i[1],i[2]],150)}),this._model.backgroundColor().spawnOwnership(),this._createDataSourceBackgroundColorWV()),Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,87866)).then((t=>{this._cursorPaneView=new t.InplaceTextCursorPaneView(this,e),this._additionalCursorDataGetters&&(this._cursorPaneView.setAdditionalCursorData(...this._additionalCursorDataGetters),null!==this._cursorPosition&&(this._cursorPaneView.setCursorPosition(this._cursorPosition),e.updateSource(this)))}))}destroy(){this._isDarkBackground.destroy(),this._editableText.unsubscribe(),this._closeTextEditor(),super.destroy()}editableTextStyle(){return{...this._isDarkBackground.value()?m:v}}removeIfEditableTextIsEmpty(){return!1}activateEditingOnCreation(){return!1}topPaneViews(e){
|
||||
return this._activeEditingOwnerSource&&e.hasDataSource(this._activeEditingOwnerSource)&&!window.TradingView.printing&&this._cursorPaneView?(this._cursorPaneView.update((0,p.sourceChangeEvent)(this.id())),[this._cursorPaneView]):null}dataAndViewsReady(){return super.dataAndViewsReady()&&null!==this._cursorPaneView}editableText(){return this._editableText}textEditingEl(){return this._activateTextEditingEl}activateTextEditingOn(e,t){this._activateTextEditingEl=e,this._editingOnCreation=!!t,this._editingActivationTime=performance.now(),this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id()))}deactivateTextEditing(){this._closeTextEditor()}textEditingActivationTime(){return this._editingActivationTime}textEditingJustFinished(){return performance.now()-this._editingDeactivationTime<100}setAdditionalCursorData(e,t){this._cursorPaneView?this._cursorPaneView.setAdditionalCursorData(e,t):this._additionalCursorDataGetters=[e,t]}_updateAllPaneViews(e){super._updateAllPaneViews(e),this._cursorPaneView?.update(e)}async _openTextEditor(e,t,n,o,a){if(null!==this._container)return;null===this._editingActivationTime&&(this._editingActivationTime=performance.now()),this._activateTextEditingEl=null,this._cursorPosition=null,this._container=document.createElement("div"),this._container.style.position="absolute",this._container.style.top="0",this._container.style.bottom="0",this._container.style.left="0",this._container.style.right="0",this._container.style.overflow="hidden",this._container.style.pointerEvents="none",t.appendChild(this._container);const{updateChartEditorText:l,closeChartEditorText:h}=await Promise.all([i.e(3637),i.e(2227),i.e(5592)]).then(i.bind(i,44847));if(null===this._container||this._isDestroyed)return;this._activeEditingOwnerSource=e,this._closeChartEditorText=h;const{text:c,textColor:u,wordWrap:d}=this.editableTextProperties(),{forbidLineBreaks:_,maxLength:g}=this.editableTextStyle();this._editableText.setValue(c.value());const v=this.isFixed()?(0,s.ensureDefined)(this.fixedPoint(e)):(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0],e)),m={position:(0,r.point)(v.x,v.y),textInfo:n,placeholder:o,text:this._editableText,textColor:u,wordWrap:d,forbidLineBreaks:_,maxLength:g,onClose:a,onSelectionChange:this._onSelectionChange.bind(this),onContextMenu:this.onContextMenu?this.onContextMenu.bind(this):void 0};l(this._container,m),this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id()))}_closeTextEditor(e){null===this._container||this._isDestroyed||(this._editingActivationTime=null,this._editingDeactivationTime=performance.now(),this._saveEditedText(),this._editingOnCreation=!1,this._onSelectionChange(),this._closeChartEditorText?.(this._container),this._closeChartEditorText=void 0,this._container.remove(),this._container=null,this._activeEditingOwnerSource=null,this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id())))}_saveEditedText(){const e=this.editableTextProperties().text.value(),t=this._editableText.value()
|
||||
;e!==t&&(this._editingOnCreation&&this.editableTextProperties().text.setValue(t),this._model.undoModel().undoHistory().pushUndoCommand(this._changeEditableTextUndoCommand(e,t)))}_changeEditableTextUndoCommand(e,t){return new w(this._model,this,e,t)}_createDataSourceBackgroundColorWV(){return new u.WatchedValue(null).readonly().ownership()}_onSelectionChange(e){if(null===this._container)return;const t={};if(void 0!==e){const{start:i,end:n}=e;i===n?t.cursorPosition=i:t.selectionRange=[Math.min(i,n),Math.max(i,n)]}(0,n.default)(t,this._selectionData)||(this._selectionData=t,this._paneViews.forEach((e=>{e.forEach((e=>{"setSelectionRange"in e&&e.setSelectionRange(t.selectionRange)}))})),this._cursorPaneView?this._cursorPaneView.setCursorPosition(t.cursorPosition):this._cursorPosition=t.cursorPosition??null,this.updateAllViewsAndRedraw((0,p.sourceChangeEvent)(this.id())))}}}}]);
|
||||
Reference in New Issue
Block a user