Файловый менеджер - Редактировать - /home/lmsyaran/public_html/joomla5/media/vendor/codemirror/js/codemirror-lint.min.js
Назад
import{getPanel as K,EditorView as y,Decoration as m,hoverTooltip as X,showPanel as J,ViewPlugin as Q,logException as ee,gutter as te,showTooltip as ie,WidgetType as ne,GutterMarker as oe}from"@codemirror/view";import{StateEffect as w,RangeSet as P,StateField as R,Facet as I,combineConfig as F}from"@codemirror/state";function u(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&typeof i=="object"&&i.nodeType==null&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var o=i[n];typeof o=="string"?t.setAttribute(n,o):o!=null&&(t[n]=o)}e++}for(;e<arguments.length;e++)M(t,arguments[e]);return t}function M(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)M(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}class se{constructor(e,i,n){this.from=e,this.to=i,this.diagnostic=n}}class g{constructor(e,i,n){this.diagnostics=e,this.panel=i,this.selected=n}static init(e,i,n){let o=e,s=n.facet(h).markerFilter;s&&(o=s(o,n));let l=m.set(o.map(r=>r.from==r.to||r.from==r.to-1&&n.doc.lineAt(r.from).to==r.from?m.widget({widget:new me(r),diagnostic:r}).range(r.from):m.mark({attributes:{class:"cm-lintRange cm-lintRange-"+r.severity+(r.markClass?" "+r.markClass:"")},diagnostic:r,inclusive:!0}).range(r.from,r.to)),!0);return new g(l,i,b(l))}}function b(t,e=null,i=0){let n=null;return t.between(i,1e9,(o,s,{spec:l})=>{if(!(e&&l.diagnostic!=e))return n=new se(o,s,l.diagnostic),!1}),n}function E(t,e){let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(n=>n.is(k))||t.changes.touchesRange(i.from,i.to))}function B(t,e){return t.field(d,!1)?e:e.concat(w.appendConfig.of(W))}function O(t,e){return{effects:B(t,[k.of(e)])}}const k=w.define(),D=w.define(),j=w.define(),d=R.define({create(){return new g(m.none,null,null)},update(t,e){if(e.docChanged){let i=t.diagnostics.map(e.changes),n=null;if(t.selected){let o=e.changes.mapPos(t.selected.from,1);n=b(i,t.selected.diagnostic,o)||b(i,null,o)}t=new g(i,t.panel,n)}for(let i of e.effects)i.is(k)?t=g.init(i.value,t.panel,e.state):i.is(D)?t=new g(t.diagnostics,i.value?T.open:null,t.selected):i.is(j)&&(t=new g(t.diagnostics,t.panel,i.value));return t},provide:t=>[J.from(t,e=>e.panel),y.decorations.from(t,e=>e.diagnostics)]});function re(t){let e=t.field(d,!1);return e?e.diagnostics.size:0}const le=m.mark({class:"cm-lintRange cm-lintRange-active",inclusive:!0});function ae(t,e,i){let{diagnostics:n}=t.state.field(d),o=[],s=2e8,l=0;n.between(e-(i<0?1:0),e+(i>0?1:0),(a,c,{spec:f})=>{e>=a&&e<=c&&(a==c||(e>a||i>0)&&(e<c||i<0))&&(o.push(f.diagnostic),s=Math.min(a,s),l=Math.max(c,l))});let r=t.state.facet(h).tooltipFilter;return r&&(o=r(o,t.state)),o.length?{pos:s,end:l,above:t.state.doc.lineAt(s).to<l,create(){return{dom:G(t,o)}}}:null}function G(t,e){return u("ul",{class:"cm-tooltip-lint"},e.map(i=>z(t,i,!1)))}const H=t=>{let e=t.state.field(d,!1);(!e||!e.panel)&&t.dispatch({effects:B(t.state,[D.of(!0)])});let i=K(t,T.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},L=t=>{let e=t.state.field(d,!1);return!e||!e.panel?!1:(t.dispatch({effects:D.of(!1)}),!0)},$=t=>{let e=t.state.field(d,!1);if(!e)return!1;let i=t.state.selection.main,n=e.diagnostics.iter(i.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==i.from&&n.to==i.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},ce=t=>{let{state:e}=t,i=e.field(d,!1);if(!i)return!1;let n=e.selection.main,o,s,l,r;return i.diagnostics.between(0,e.doc.length,(a,c)=>{c<n.to&&(o==null||o<a)&&(o=a,s=c),(l==null||a>l)&&(l=a,r=c)}),l==null||o==null&&l==n.from?!1:(t.dispatch({selection:{anchor:o??l,head:s??r},scrollIntoView:!0}),!0)},fe=[{key:"Mod-Shift-m",run:H,preventDefault:!0},{key:"F8",run:$}],N=Q.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(h);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let t=Date.now();if(t<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:e}=this.view,{sources:i}=e.facet(h);i.length&&Promise.all(i.map(n=>Promise.resolve(n(this.view)))).then(n=>{let o=n.reduce((s,l)=>s.concat(l));this.view.state.doc==e.doc&&this.view.dispatch(O(this.view.state,o))},n=>{ee(this.view.state,n)})}}update(t){let e=t.state.facet(h);(t.docChanged||e!=t.startState.facet(h)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),h=I.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},F(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,i)=>e?i?n=>e(n)||i(n):e:i}))}});function de(t,e={}){return[h.of({source:t,config:e}),N,W]}function ue(t){let e=t.plugin(N);e&&e.force()}function V(t){let e=[];if(t)e:for(let{name:i}of t){for(let n=0;n<i.length;n++){let o=i[n];if(/[a-zA-Z]/.test(o)&&!e.some(s=>s.toLowerCase()==o.toLowerCase())){e.push(o);continue e}}e.push("")}return e}function z(t,e,i){var n;let o=i?V(e.actions):[];return u("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},u("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(n=e.actions)===null||n===void 0?void 0:n.map((s,l)=>{let r=!1,a=Z=>{if(Z.preventDefault(),r)return;r=!0;let S=b(t.state.field(d).diagnostics,e);S&&s.apply(t,S.from,S.to)},{name:c}=s,f=o[l]?c.indexOf(o[l]):-1,p=f<0?c:[c.slice(0,f),u("u",c.slice(f,f+1)),c.slice(f+1)];return u("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${c}${f<0?"":` (access key "${o[l]})"`}.`},p)}),e.source&&u("div",{class:"cm-diagnosticSource"},e.source))}class me extends ne{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return u("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Y{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=z(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class T{constructor(e){this.view=e,this.items=[];let i=o=>{if(o.keyCode==27)L(this.view),this.view.focus();else if(o.keyCode==38||o.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(o.keyCode==40||o.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(o.keyCode==36)this.moveSelection(0);else if(o.keyCode==35)this.moveSelection(this.items.length-1);else if(o.keyCode==13)this.view.focus();else if(o.keyCode>=65&&o.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],l=V(s.actions);for(let r=0;r<l.length;r++)if(l[r].toUpperCase().charCodeAt(0)==o.keyCode){let a=b(this.view.state.field(d).diagnostics,s);a&&s.actions[r].apply(e,a.from,a.to)}}else return;o.preventDefault()},n=o=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(o.target)&&this.moveSelection(s)};this.list=u("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:i,onclick:n}),this.dom=u("div",{class:"cm-panel-lint"},this.list,u("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>L(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(d).selected;if(!e)return-1;for(let i=0;i<this.items.length;i++)if(this.items[i].diagnostic==e.diagnostic)return i;return-1}update(){let{diagnostics:e,selected:i}=this.view.state.field(d),n=0,o=!1,s=null;for(e.between(0,this.view.state.doc.length,(l,r,{spec:a})=>{let c=-1,f;for(let p=n;p<this.items.length;p++)if(this.items[p].diagnostic==a.diagnostic){c=p;break}c<0?(f=new Y(this.view,a.diagnostic),this.items.splice(n,0,f),o=!0):(f=this.items[c],c>n&&(this.items.splice(n,c-n),o=!0)),i&&f.diagnostic==i.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),n++});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();this.items.length==0&&(this.items.push(new Y(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:r})=>{let a=r.height/this.list.offsetHeight;l.top<r.top?this.list.scrollTop-=(r.top-l.top)/a:l.bottom>r.bottom&&(this.list.scrollTop+=(l.bottom-r.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function i(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)i();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)i()}moveSelection(e){if(this.selectedIndex<0)return;let i=this.view.state.field(d),n=b(i.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:j.of(n)})}static open(e){return new T(e)}}function x(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function v(t){return x(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const he=y.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:v("#d11")},".cm-lintRange-warning":{backgroundImage:v("orange")},".cm-lintRange-info":{backgroundImage:v("#999")},".cm-lintRange-hint":{backgroundImage:v("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function _(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}class ge extends oe{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((i,n)=>_(i)<_(n.severity)?n.severity:i,"hint")}toDOM(e){let i=document.createElement("div");i.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,o=e.state.facet(C).tooltipFilter;return o&&(n=o(n,e.state)),n.length&&(i.onmouseover=()=>be(e,i,n)),i}}function pe(t,e){let i=n=>{let o=e.getBoundingClientRect();if(!(n.clientX>o.left-10&&n.clientX<o.right+10&&n.clientY>o.top-10&&n.clientY<o.bottom+10)){for(let s=n.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",i),t.state.field(U)&&t.dispatch({effects:A.of(null)})}};window.addEventListener("mousemove",i)}function be(t,e,i){function n(){let l=t.elementAtHeight(e.getBoundingClientRect().top+5-t.documentTop);t.coordsAtPos(l.from)&&t.dispatch({effects:A.of({pos:l.from,above:!1,create(){return{dom:G(t,i),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,pe(t,e)}let{hoverTime:o}=t.state.facet(C),s=setTimeout(n,o);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,o)}}function we(t,e){let i=Object.create(null);for(let o of e){let s=t.lineAt(o.from);(i[s.from]||(i[s.from]=[])).push(o)}let n=[];for(let o in i)n.push(new ge(i[o]).range(+o));return P.of(n,!0)}const ke=te({class:"cm-gutter-lint",markers:t=>t.state.field(q)}),q=R.define({create(){return P.empty},update(t,e){t=t.map(e.changes);let i=e.state.facet(C).markerFilter;for(let n of e.effects)if(n.is(k)){let o=n.value;i&&(o=i(o||[],e.state)),t=we(e.state.doc,o.slice(0))}return t}}),A=w.define(),U=R.define({create(){return null},update(t,e){return t&&e.docChanged&&(t=E(e,t)?null:Object.assign(Object.assign({},t),{pos:e.changes.mapPos(t.pos)})),e.effects.reduce((i,n)=>n.is(A)?n.value:i,t)},provide:t=>ie.from(t)}),ye=y.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:x('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:x('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:x('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),W=[d,y.decorations.compute([d],t=>{let{selected:e,panel:i}=t.field(d);return!e||!i||e.from==e.to?m.none:m.set([le.range(e.from,e.to)])}),X(ae,{hideOn:E}),he],C=I.define({combine(t){return F(t,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function xe(t={}){return[C.of(t),q,ke,ye,U]}function ve(t,e){let i=t.field(d,!1);if(i&&i.diagnostics.size)for(let n=P.iter([i.diagnostics]);n.value;n.next())e(n.value.spec.diagnostic,n.from,n.to)}export{L as closeLintPanel,re as diagnosticCount,ve as forEachDiagnostic,ue as forceLinting,xe as lintGutter,fe as lintKeymap,de as linter,$ as nextDiagnostic,H as openLintPanel,ce as previousDiagnostic,O as setDiagnostics,k as setDiagnosticsEffect};
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка