Skip to content
Snippets Groups Projects
Commit c40601d7 authored by Marcos Hollanda's avatar Marcos Hollanda
Browse files

Issue #3457610: Update regular expressions patterns for debug messages after Drupal 10.3

parent eb3a8ef6
No related branches found
No related tags found
1 merge request!10Update regexp patterns for debug messages
Drupal.themeElement={activated:!1,propertyHook:null,objectType:null,suggestions:null,filePath:null,dataNode:null,cacheHit:!1,cacheTags:null,cacheContexts:null,cacheKeys:null,cacheMaxAge:0,preBubblingCacheTags:null,preBubblingCacheContexts:null,preBubblingCacheKeys:null,preBubblingCacheMaxAge:0,renderingTime:0,initialState:null,init:function(){this.initialState={activated:this.activated,propertyHook:this.propertyHook,objectType:this.objectType,suggestions:this.suggestions,filePath:this.filePath,dataNode:this.dataNode,cacheHit:this.cacheHit,cacheTags:this.cacheTags,cacheContexts:this.cacheContexts,cacheKeys:this.cacheKeys,cacheMaxAge:this.cacheMaxAge,preBubblingCacheTags:this.preBubblingCacheTags,preBubblingCacheContexts:this.preBubblingCacheContexts,preBubblingCacheKeys:this.preBubblingCacheKeys,preBubblingCacheMaxAge:this.preBubblingCacheMaxAge,renderingTime:this.renderingTime}},setActivated(){this.activated=!0},setPropertyHook(e){this.propertyHook=e},setCacheHit(e){this.cacheHit=e},setCacheTags(e){this.cacheTags=this.parseListRegexpOutput(e)},setCacheContexts(e){this.cacheContexts=this.parseListRegexpOutput(e)},setCacheKeys(e){this.cacheKeys=this.parseListRegexpOutput(e)},setCacheMaxAge(e){this.cacheMaxAge=parseInt(e)},setPreBubblingCacheTags(e){this.preBubblingCacheTags=this.parseListRegexpOutput(e)},setPreBubblingCacheContexts(e){this.preBubblingCacheContexts=this.parseListRegexpOutput(e)},setPreBubblingCacheKeys(e){this.preBubblingCacheKeys=this.parseListRegexpOutput(e)},setPreBubblingCacheMaxAge(e){this.preBubblingCacheMaxAge=parseInt(e)},setRenderingTime(e){this.renderingTime=parseFloat(e)},setObjectType(e){this.objectType=e.split("__")[0]},setFilePath(e){this.filePath=e},setSuggestions(e){this.suggestions=this.pasreListOnOffRegexpOutput(e)},setDataNode(e){this.dataNode=e},getPropertyHook(){return this.propertyHook},getObjectType(){return this.objectType},getDisplayElements(){const{idControllerSelectedElementInfo:e,idControllerSelectedElementSuggestionsValue:t,idControllerSelectedElementFilePathValue:l,idControllerSelectedElementCacheHit:a,idControllerSelectedElementCacheMaxAge:s,idControllerSelectedElementCacheTags:i,idControllerSelectedElementCacheContexts:n,idControllerSelectedElementCacheKeys:c,idControllerSelectedElementPreBubblingCacheTags:h,idControllerSelectedElementPreBubblingCacheContexts:p,idControllerSelectedElementPreBubblingCacheKeys:r,idControllerSelectedElementPreBubblingCacheMaxAge:g,idControllerSelectedElementRenderingTime:o}=Drupal.vdUtilities.ids,{classNameSelectedElementInfoWrapper:u,classNameSelectedElementInfo:y,classNameSelectedElementSuggestionsWrapper:C,classNameSelectedElementSuggestions:b,classNameSelectedElementTemplateFilePathWrapper:d,classNameSelectedElementTemplateFilePath:m,classNameSelectedElementTemplateFilePathLabel:T}=Drupal.vdUtilities.classNames,{stringThemeElementInfo:x,stringThemeElementThemeSuggestions:E,stringThemeElementFilePath:B,stringThemeElementFilePathInlineLabel:S,stringThemeElementCacheHit:P,stringThemeElementCacheMaxAge:k,stringThemeElementCacheTags:f,stringThemeElementCacheContexts:A,stringThemeElementCacheKeys:H,stringThemeElementPreBubblingCacheTags:K,stringThemeElementPreBubblingCacheContexts:M,stringThemeElementPreBubblingCacheKeys:O,stringThemeElementPreBubblingCacheMaxAge:N,stringThemeElementRenderingTime:v}=Drupal.vdUtilities.strings;return[{key:"propertyHook",label:x,id:e,type:"template",displayType:"info",wrapperClasses:[u],valueClasses:[y]},{key:"suggestions",label:E,id:t,type:"template",displayType:"multipleCopyWithChecked",wrapperClasses:[C],valueClasses:[b]},{key:"filePath",label:B,inlineLabel:S,id:l,type:"template",displayType:"singleCopy",wrapperClasses:[d],valueClasses:[m]},{key:"cacheHit",label:P,id:a,type:"cache",displayType:"singleInfo"},{key:"cacheTags",label:f,id:i,type:"cache",displayType:"multipleCopy"},{key:"cacheContexts",label:A,id:n,type:"cache",displayType:"multipleCopy"},{key:"cacheKeys",label:H,id:c,type:"cache",displayType:"multipleCopy"},{key:"cacheMaxAge",label:k,id:s,type:"cache",displayType:"singleInfo"},{key:"preBubblingCacheTags",label:K,id:h,type:"cache",displayType:"multipleCopy"},{key:"preBubblingCacheContexts",label:M,id:p,type:"cache",displayType:"multipleCopy"},{key:"preBubblingCacheKeys",label:O,id:r,type:"cache",displayType:"multipleCopy"},{key:"preBubblingCacheMaxAge",label:N,id:g,type:"cache",displayType:"singleInfo"},{key:"renderingTime",label:v,id:o,type:"cache",displayType:"singleInfo"}]},parseListRegexpOutput:e=>e.split("\n").map((e=>e.trim().replace(/^\*\s/,""))).filter((e=>e.length>0)),pasreListOnOffRegexpOutput:e=>e.trim().split(/\n\s*/).map((e=>{const t=e.split(" ");return{suggestion:t[1],activated:"x"===t[0]}})),reset:function(){Object.assign(this,this.initialState)}};
\ No newline at end of file
Drupal.themeElement={activated:!1,propertyHook:null,objectType:null,suggestions:null,filePath:null,dataNode:null,cacheHit:!1,cacheTags:null,cacheContexts:null,cacheKeys:null,cacheMaxAge:0,preBubblingCacheTags:null,preBubblingCacheContexts:null,preBubblingCacheKeys:null,preBubblingCacheMaxAge:0,renderingTime:0,initialState:null,init:function(){this.initialState={activated:this.activated,propertyHook:this.propertyHook,objectType:this.objectType,suggestions:this.suggestions,filePath:this.filePath,dataNode:this.dataNode,cacheHit:this.cacheHit,cacheTags:this.cacheTags,cacheContexts:this.cacheContexts,cacheKeys:this.cacheKeys,cacheMaxAge:this.cacheMaxAge,preBubblingCacheTags:this.preBubblingCacheTags,preBubblingCacheContexts:this.preBubblingCacheContexts,preBubblingCacheKeys:this.preBubblingCacheKeys,preBubblingCacheMaxAge:this.preBubblingCacheMaxAge,renderingTime:this.renderingTime}},setActivated(){this.activated=!0},setPropertyHook(e){this.propertyHook=e},setCacheHit(e){this.cacheHit=e},setCacheTags(e){this.cacheTags=this.parseListRegexpOutput(e)},setCacheContexts(e){this.cacheContexts=this.parseListRegexpOutput(e)},setCacheKeys(e){this.cacheKeys=this.parseListRegexpOutput(e)},setCacheMaxAge(e){this.cacheMaxAge=parseInt(e)},setPreBubblingCacheTags(e){this.preBubblingCacheTags=this.parseListRegexpOutput(e)},setPreBubblingCacheContexts(e){this.preBubblingCacheContexts=this.parseListRegexpOutput(e)},setPreBubblingCacheKeys(e){this.preBubblingCacheKeys=this.parseListRegexpOutput(e)},setPreBubblingCacheMaxAge(e){this.preBubblingCacheMaxAge=parseInt(e)},setRenderingTime(e){this.renderingTime=parseFloat(e)},setObjectType(e){this.objectType=e.split("__")[0]},setFilePath(e){this.filePath=e},setSuggestions(e){this.suggestions=this.parseListOnOffRegexpOutput(e)},setDataNode(e){this.dataNode=e},getPropertyHook(){return this.propertyHook},getObjectType(){return this.objectType},getDisplayElements(){const{idControllerSelectedElementInfo:e,idControllerSelectedElementSuggestionsValue:t,idControllerSelectedElementFilePathValue:l,idControllerSelectedElementCacheHit:a,idControllerSelectedElementCacheMaxAge:s,idControllerSelectedElementCacheTags:i,idControllerSelectedElementCacheContexts:n,idControllerSelectedElementCacheKeys:c,idControllerSelectedElementPreBubblingCacheTags:h,idControllerSelectedElementPreBubblingCacheContexts:p,idControllerSelectedElementPreBubblingCacheKeys:r,idControllerSelectedElementPreBubblingCacheMaxAge:g,idControllerSelectedElementRenderingTime:o}=Drupal.vdUtilities.ids,{classNameSelectedElementInfoWrapper:u,classNameSelectedElementInfo:y,classNameSelectedElementSuggestionsWrapper:C,classNameSelectedElementSuggestions:b,classNameSelectedElementTemplateFilePathWrapper:d,classNameSelectedElementTemplateFilePath:m,classNameSelectedElementTemplateFilePathLabel:T}=Drupal.vdUtilities.classNames,{stringThemeElementInfo:x,stringThemeElementThemeSuggestions:E,stringThemeElementFilePath:B,stringThemeElementFilePathInlineLabel:S,stringThemeElementCacheHit:P,stringThemeElementCacheMaxAge:k,stringThemeElementCacheTags:f,stringThemeElementCacheContexts:A,stringThemeElementCacheKeys:H,stringThemeElementPreBubblingCacheTags:K,stringThemeElementPreBubblingCacheContexts:M,stringThemeElementPreBubblingCacheKeys:O,stringThemeElementPreBubblingCacheMaxAge:N,stringThemeElementRenderingTime:v}=Drupal.vdUtilities.strings;return[{key:"propertyHook",label:x,id:e,type:"template",displayType:"info",wrapperClasses:[u],valueClasses:[y]},{key:"suggestions",label:E,id:t,type:"template",displayType:"multipleCopyWithChecked",wrapperClasses:[C],valueClasses:[b]},{key:"filePath",label:B,inlineLabel:S,id:l,type:"template",displayType:"singleCopy",wrapperClasses:[d],valueClasses:[m]},{key:"cacheHit",label:P,id:a,type:"cache",displayType:"singleInfo"},{key:"cacheTags",label:f,id:i,type:"cache",displayType:"multipleCopy"},{key:"cacheContexts",label:A,id:n,type:"cache",displayType:"multipleCopy"},{key:"cacheKeys",label:H,id:c,type:"cache",displayType:"multipleCopy"},{key:"cacheMaxAge",label:k,id:s,type:"cache",displayType:"singleInfo"},{key:"preBubblingCacheTags",label:K,id:h,type:"cache",displayType:"multipleCopy"},{key:"preBubblingCacheContexts",label:M,id:p,type:"cache",displayType:"multipleCopy"},{key:"preBubblingCacheKeys",label:O,id:r,type:"cache",displayType:"multipleCopy"},{key:"preBubblingCacheMaxAge",label:N,id:g,type:"cache",displayType:"singleInfo"},{key:"renderingTime",label:v,id:o,type:"cache",displayType:"singleInfo"}]},parseListRegexpOutput:e=>e.split("\n").map((e=>e.trim().replace(/^\*\s/,""))).filter((e=>e.length>0)),parseListOnOffRegexpOutput:e=>e.trim().split(/\n\s*/).map((e=>{const t=e.split(" ");return{suggestion:t[1],activated:["x",""].includes(t[0])}})),reset:function(){Object.assign(this,this.initialState)}};
\ No newline at end of file
!function(e){e.behaviors.visualDebugger={body:document.body,utilities:e.vdUtilities,constants:{baseZIndex:0},classNames:{classNameVisualDebugger:"visual-debugger",classNameInitialized:"visual-debugger--initialized",classNameBaseLayer:"visual-debugger--base",classNameInstanceLayer:"instance-element",classNameInstanceLayerUnchecked:"instance-element--unchecked",classNameInstanceLayerChecked:"instance-element--checked",classNameInstanceLayerHover:"instance-element--hover",classNameObjectType:"object-type",classNameObjectTypeHover:"object-type--hover",classNameIconActivated:"icon-checkbox-checked",classNameIconDectivated:"icon-checkbox-unchecked",classNameCheckboxToggle:"checkbox-toggle",classNameSpanToggle:"span-toggle",classNameActivated:"item-activated",classNameDeactivated:"item-deactivated",classNameObjectTypeTyped:e=>`object-type--${e}`},layerAttributes:{layerIdAttributeName:"data-vd-id"},themeDebugNodes:null,triggerResizeObserver(e){const{body:t}=this,{layerIdAttributeName:s}=this.layerAttributes,{layerTargetIdAttributeName:a}=this.utilities.layerAttributes,n=new ResizeObserver((e=>{e.forEach((e=>{const n=e.target,i=n.getAttribute(s),c=t.querySelector(`[${a}="${i}"]`);this.setInstanceLayerSizeAndPosition(c,n)}))}));e.forEach((e=>{const{instanceRefElement:t}=e;n.observe(t)}))},triggerMutationObserver:function(e){new MutationObserver((()=>{e.forEach((e=>{this.setInstanceLayerSizeAndPosition(e.instanceLayer,e.instanceRefElement)}))})).observe(this.body,{attributes:!0,attributeFilter:["style"]})},regExs:{regexGetTemplateDebug:()=>new RegExp("^(THEME DEBUG|START RENDERED)$"),regexGetTemplateHook:()=>new RegExp("THEME HOOK: '([^']*)'"),regexGetTemplateSuggestions:()=>new RegExp("FILE NAME SUGGESTIONS:s*\ns*([^']*)s*\n*s*"),regexGetTemplateFilePath:()=>new RegExp("BEGIN OUTPUT from '([^']*)'"),regexGetTemplateEndOutput:()=>new RegExp("END OUTPUT from '([^']*)'"),regexGetCacheHit:()=>new RegExp("CACHE-HIT: (Yes|No)"),regexGetCacheTags:()=>new RegExp("^\\s?CACHE TAGS:s*\ns*([^']*)s*\n*s*"),regexGetCacheContexts:()=>new RegExp("^\\s?CACHE CONTEXTS:s*\ns*([^']*)s*\n*s*"),regexGetCacheKeys:()=>new RegExp("^\\s?CACHE KEYS:s*\ns*([^']*)s*\n*s*"),regexGetCacheMaxAge:()=>new RegExp("^\\s?CACHE MAX-AGE: (-?[0-9]*)"),regexGetPreBubblingCacheTags:()=>new RegExp("PRE-BUBBLING CACHE TAGS:s*\ns*([^']*)s*\n*s*"),regexGetPreBubblingCacheContexts:()=>new RegExp("PRE-BUBBLING CACHE CONTEXTS:s*\ns*([^']*)s*\n*s*"),regexGetPreBubblingCacheKeys:()=>new RegExp("PRE-BUBBLING CACHE KEYS:s*\ns*([^']*)s*\n*s*"),regexGetPreBubblingCacheMaxAge:()=>new RegExp("PRE-BUBBLING CACHE MAX-AGE: (-?[0-9]*)"),regexGetRenderingTime:()=>new RegExp("RENDERING TIME: (-?[0-9]*.?[0-9]*)")},controllerElement:null,getUniquePropertyHooks:e=>e.map((e=>e.instanceActiveElement.propertyHook)).filter(((e,t,s)=>s.indexOf(e)===t)).sort(),getCalculatedDomDepth(e){let t=0;for(;e.parentNode;)t++,e=e.parentNode;return t},generateBaseLayer(){const e=document.createElement("div"),{classNameVisualDebugger:t,classNameBaseLayer:s}=this.classNames;return e.classList.add(t),e.classList.add(s),e},getCheckedNodes(){return this.themeDebugNodes.filter((e=>e.instanceLayer.classList.contains(this.classNames.classNameInstanceLayerChecked)))},generateInstanceLayer(e,t,s){const a=document.createElement("div"),n=this.controllerElement,{classNameInstanceLayer:i,classNameInstanceLayerChecked:c,classNameInstanceLayerUnchecked:r,classNameObjectType:o,classNameObjectTypeTyped:l,classNameIconActivated:g,classNameIconDectivated:d,classNameCheckboxToggle:h,classNameSpanToggle:u,classNameActivated:m,classNameDeactivated:b}=this.classNames,{layerTargetIdAttributeName:E,instanceLayerActivatedAttributeName:y,layerAttributeIsVisible:x}=this.utilities.layerAttributes;a.classList.add(i,o,l(e.getObjectType()),r),a.setAttribute(E,s),a.setAttribute(x,!0),a.setAttribute(y,!1),a.style.zIndex=this.getCalculatedDomDepth(t),this.setInstanceLayerSizeAndPosition(a,t);const C=e,N=document.createElement("input");N.setAttribute("type","checkbox"),N.classList.add(h);const p=document.createElement("span");p.classList.add(u,m,g);const v=document.createElement("span");return v.classList.add(u,b,d),a.append(N,p,v),a.addEventListener("mouseenter",(()=>{N.focus({preventScroll:!0}),n.setActiveThemeElement(C)})),a.addEventListener("mouseleave",(()=>{N.blur(),n.resetActiveThemeElement(C)})),a.addEventListener("click",(()=>{this.getCheckedNodes().forEach((e=>{e.instanceLayer!==a&&e.instanceLayer.click()})),N.click()})),N.addEventListener("change",(()=>{a.setAttribute(y,N.checked),a.classList.toggle(c),a.classList.toggle(r),!0===N.checked?(N.focus(),n.setDefaultThemeElement(e)):(N.blur(),n.resetDefaultThemeElement(e))})),a},setInstanceLayerSizeAndPosition(e,t){const s=t.getBoundingClientRect(),a=Math.round(s.top+window.scrollY),n=Math.round(s.left+window.scrollX);let{width:i,height:c}=s;c=Math.round(c),i=Math.round(i),e.style.width=`${Math.round(i)}px`,e.style.height=`${Math.round(c)}px`,e.style.top=`${a}px`,e.style.left=`${n}px`},setthemeDebugNode(e,t,s){const{layerAttributeIsVisible:a,instanceLayerActivatedAttributeName:n}=this.utilities.layerAttributes,{classNameInstanceLayerHover:i,classNameObjectTypeHover:c}=this.classNames;return{instanceActiveElement:e,instanceLayer:t,instanceRefElement:s,showInstanceLayer(){this.instanceLayer.setAttribute(a,!0)},hideInstanceLayer(){this.instanceLayer.setAttribute(a,!1),"true"===this.instanceLayer.getAttribute(n)&&this.instanceLayer.click()},triggerMouseEnter(){this.instanceLayer.dispatchEvent(new MouseEvent("mouseenter")),this.instanceLayer.classList.add(i,c)},triggerMouseLeave(){this.instanceLayer.dispatchEvent(new MouseEvent("mouseleave")),this.instanceLayer.classList.remove(i,c)}}},attach:function(e,t){const{body:s}=this,{classNameInitialized:a}=this.classNames;s.classList.contains(a)||(s.classList.add(a),this.main(e,t,s))},main:function(t,s,a){const{regexGetTemplateDebug:n,regexGetTemplateHook:i,regexGetTemplateSuggestions:c,regexGetTemplateFilePath:r,regexGetCacheHit:o,regexGetCacheMaxAge:l,regexGetPreBubblingCacheTags:g,regexGetPreBubblingCacheContexts:d,regexGetPreBubblingCacheKeys:h,regexGetPreBubblingCacheMaxAge:u,regexGetRenderingTime:m,regexGetCacheTags:b,regexGetCacheContexts:E,regexGetCacheKeys:y}=this.regExs,{layerIdAttributeName:x}=this.layerAttributes,C=e.controllerElement;this.controllerElement=C;const N=this.generateBaseLayer();a.appendChild(N);let p=[],v=e.themeElement;v.init();document.querySelectorAll("*").forEach((e=>{const t=e.childNodes;Array.from(t).forEach((e=>{if(e.nodeType!==Node.COMMENT_NODE)return;if(n().test(e.textContent))return void v.setActivated();const t=e.textContent.match(o());if(t)return void v.setCacheHit(t[1]);const s=e.textContent.match(l());if(s)return void v.setCacheMaxAge(s[1]);const a=e.textContent.match(b());if(a)return void v.setCacheTags(a[1]);const C=e.textContent.match(E());if(C)return void v.setCacheContexts(C[1]);const A=e.textContent.match(y());if(A)return void v.setCacheKeys(A[1]);const L=e.textContent.match(g());if(L)return void v.setPreBubblingCacheTags(L[1]);const T=e.textContent.match(d());if(T)return void v.setPreBubblingCacheContexts(T[1]);const f=e.textContent.match(h());if(f)return void v.setPreBubblingCacheKeys(f[1]);const I=e.textContent.match(u());if(I)return void v.setPreBubblingCacheMaxAge(I[1]);const G=e.textContent.match(m());if(G)return void v.setRenderingTime(G[1]);const R=e.textContent.match(i());if(R)return v.setPropertyHook(R[1]),void v.setObjectType(R[1]);const B=e.textContent.match(c());if(B)return void v.setSuggestions(B[1]);const D=e.textContent.match(r());if(D){v.setFilePath(D[1]);const t=e.nextElementSibling;if(t&&t.nodeType===Node.ELEMENT_NODE&&null===v.dataNode){v.setDataNode(t);const e=Object.assign({},v),s=this.utilities.generateUniqueIdentifier(),a=this.generateInstanceLayer(e,t,s);t.setAttribute(x,s),N.appendChild(a),p.push(this.setthemeDebugNode(e,a,t))}v.reset()}}))})),this.themeDebugNodes=p,this.triggerMutationObserver(p),this.triggerResizeObserver(p),C.init(N,p),a.appendChild(C.generateControllerLayer()),C.executePostActivation()},detach:function(e,t,s){}}}(Drupal);
\ No newline at end of file
!function(e){e.behaviors.visualDebugger={body:document.body,utilities:e.vdUtilities,constants:{baseZIndex:0},classNames:{classNameVisualDebugger:"visual-debugger",classNameInitialized:"visual-debugger--initialized",classNameBaseLayer:"visual-debugger--base",classNameInstanceLayer:"instance-element",classNameInstanceLayerUnchecked:"instance-element--unchecked",classNameInstanceLayerChecked:"instance-element--checked",classNameInstanceLayerHover:"instance-element--hover",classNameObjectType:"object-type",classNameObjectTypeHover:"object-type--hover",classNameIconActivated:"icon-checkbox-checked",classNameIconDectivated:"icon-checkbox-unchecked",classNameCheckboxToggle:"checkbox-toggle",classNameSpanToggle:"span-toggle",classNameActivated:"item-activated",classNameDeactivated:"item-deactivated",classNameObjectTypeTyped:e=>`object-type--${e}`},layerAttributes:{layerIdAttributeName:"data-vd-id"},themeDebugNodes:null,triggerResizeObserver(e){const{body:t}=this,{layerIdAttributeName:s}=this.layerAttributes,{layerTargetIdAttributeName:a}=this.utilities.layerAttributes,n=new ResizeObserver((e=>{e.forEach((e=>{const n=e.target,i=n.getAttribute(s),c=t.querySelector(`[${a}="${i}"]`);this.setInstanceLayerSizeAndPosition(c,n)}))}));e.forEach((e=>{const{instanceRefElement:t}=e;n.observe(t)}))},triggerMutationObserver:function(e){new MutationObserver((()=>{e.forEach((e=>{this.setInstanceLayerSizeAndPosition(e.instanceLayer,e.instanceRefElement)}))})).observe(this.body,{attributes:!0,attributeFilter:["style"]})},regExs:{regexGetTemplateDebug:()=>new RegExp("^(THEME DEBUG|START RENDERER)$"),regexGetTemplateHook:()=>new RegExp("THEME HOOK: '([^']*)'"),regexGetTemplateSuggestions:()=>new RegExp("FILE NAME SUGGESTIONS:s*\ns*([^']*)s*\n*s*"),regexGetTemplateFilePath:()=>new RegExp("BEGIN( CUSTOM TEMPLATE)? OUTPUT from '([^']*)'"),regexGetTemplateEndOutput:()=>new RegExp("END OUTPUT from '([^']*)'"),regexGetCacheHit:()=>new RegExp("CACHE-HIT: (Yes|No)"),regexGetCacheTags:()=>new RegExp("^\\s?CACHE TAGS:s*\ns*([^']*)s*\n*s*"),regexGetCacheContexts:()=>new RegExp("^\\s?CACHE CONTEXTS:s*\ns*([^']*)s*\n*s*"),regexGetCacheKeys:()=>new RegExp("^\\s?CACHE KEYS:s*\ns*([^']*)s*\n*s*"),regexGetCacheMaxAge:()=>new RegExp("^\\s?CACHE MAX-AGE: (-?[0-9]*)"),regexGetPreBubblingCacheTags:()=>new RegExp("PRE-BUBBLING CACHE TAGS:s*\ns*([^']*)s*\n*s*"),regexGetPreBubblingCacheContexts:()=>new RegExp("PRE-BUBBLING CACHE CONTEXTS:s*\ns*([^']*)s*\n*s*"),regexGetPreBubblingCacheKeys:()=>new RegExp("PRE-BUBBLING CACHE KEYS:s*\ns*([^']*)s*\n*s*"),regexGetPreBubblingCacheMaxAge:()=>new RegExp("PRE-BUBBLING CACHE MAX-AGE: (-?[0-9]*)"),regexGetRenderingTime:()=>new RegExp("RENDERING TIME: (-?[0-9]*.?[0-9]*)")},controllerElement:null,getUniquePropertyHooks:e=>e.map((e=>e.instanceActiveElement.propertyHook)).filter(((e,t,s)=>s.indexOf(e)===t)).sort(),getCalculatedDomDepth(e){let t=0;for(;e.parentNode;)t++,e=e.parentNode;return t},generateBaseLayer(){const e=document.createElement("div"),{classNameVisualDebugger:t,classNameBaseLayer:s}=this.classNames;return e.classList.add(t),e.classList.add(s),e},getCheckedNodes(){return this.themeDebugNodes.filter((e=>e.instanceLayer.classList.contains(this.classNames.classNameInstanceLayerChecked)))},generateInstanceLayer(e,t,s){const a=document.createElement("div"),n=this.controllerElement,{classNameInstanceLayer:i,classNameInstanceLayerChecked:c,classNameInstanceLayerUnchecked:r,classNameObjectType:o,classNameObjectTypeTyped:l,classNameIconActivated:g,classNameIconDectivated:d,classNameCheckboxToggle:h,classNameSpanToggle:u,classNameActivated:m,classNameDeactivated:b}=this.classNames,{layerTargetIdAttributeName:E,instanceLayerActivatedAttributeName:y,layerAttributeIsVisible:x}=this.utilities.layerAttributes;a.classList.add(i,o,l(e.getObjectType()),r),a.setAttribute(E,s),a.setAttribute(x,!0),a.setAttribute(y,!1),a.style.zIndex=this.getCalculatedDomDepth(t),this.setInstanceLayerSizeAndPosition(a,t);const C=e,N=document.createElement("input");N.setAttribute("type","checkbox"),N.classList.add(h);const p=document.createElement("span");p.classList.add(u,m,g);const v=document.createElement("span");return v.classList.add(u,b,d),a.append(N,p,v),a.addEventListener("mouseenter",(()=>{N.focus({preventScroll:!0}),n.setActiveThemeElement(C)})),a.addEventListener("mouseleave",(()=>{N.blur(),n.resetActiveThemeElement(C)})),a.addEventListener("click",(()=>{this.getCheckedNodes().forEach((e=>{e.instanceLayer!==a&&e.instanceLayer.click()})),N.click()})),N.addEventListener("change",(()=>{a.setAttribute(y,N.checked),a.classList.toggle(c),a.classList.toggle(r),!0===N.checked?(N.focus(),n.setDefaultThemeElement(e)):(N.blur(),n.resetDefaultThemeElement(e))})),a},setInstanceLayerSizeAndPosition(e,t){const s=t.getBoundingClientRect(),a=Math.round(s.top+window.scrollY),n=Math.round(s.left+window.scrollX);let{width:i,height:c}=s;c=Math.floor(c),i=Math.floor(i),e.style.width=`${i}px`,e.style.height=`${c}px`,e.style.top=`${a}px`,e.style.left=`${n}px`},setthemeDebugNode(e,t,s){const{layerAttributeIsVisible:a,instanceLayerActivatedAttributeName:n}=this.utilities.layerAttributes,{classNameInstanceLayerHover:i,classNameObjectTypeHover:c}=this.classNames;return{instanceActiveElement:e,instanceLayer:t,instanceRefElement:s,showInstanceLayer(){this.instanceLayer.setAttribute(a,!0)},hideInstanceLayer(){this.instanceLayer.setAttribute(a,!1),"true"===this.instanceLayer.getAttribute(n)&&this.instanceLayer.click()},triggerMouseEnter(){this.instanceLayer.dispatchEvent(new MouseEvent("mouseenter")),this.instanceLayer.classList.add(i,c)},triggerMouseLeave(){this.instanceLayer.dispatchEvent(new MouseEvent("mouseleave")),this.instanceLayer.classList.remove(i,c)}}},attach:function(e,t){const{body:s}=this,{classNameInitialized:a}=this.classNames;s.classList.contains(a)||(s.classList.add(a),this.main(e,t,s))},main:function(t,s,a){const{regexGetTemplateDebug:n,regexGetTemplateHook:i,regexGetTemplateSuggestions:c,regexGetTemplateFilePath:r,regexGetCacheHit:o,regexGetCacheMaxAge:l,regexGetPreBubblingCacheTags:g,regexGetPreBubblingCacheContexts:d,regexGetPreBubblingCacheKeys:h,regexGetPreBubblingCacheMaxAge:u,regexGetRenderingTime:m,regexGetCacheTags:b,regexGetCacheContexts:E,regexGetCacheKeys:y}=this.regExs,{layerIdAttributeName:x}=this.layerAttributes,C=e.controllerElement;this.controllerElement=C;const N=this.generateBaseLayer();a.appendChild(N);let p=[],v=e.themeElement;v.init();document.querySelectorAll("*").forEach((e=>{const t=e.childNodes;Array.from(t).forEach((e=>{if(e.nodeType!==Node.COMMENT_NODE)return;if(n().test(e.textContent))return void v.setActivated();const t=e.textContent.match(o());if(t)return void v.setCacheHit(t[1]);const s=e.textContent.match(l());if(s)return void v.setCacheMaxAge(s[1]);const a=e.textContent.match(b());if(a)return void v.setCacheTags(a[1]);const C=e.textContent.match(E());if(C)return void v.setCacheContexts(C[1]);const A=e.textContent.match(y());if(A)return void v.setCacheKeys(A[1]);const L=e.textContent.match(g());if(L)return void v.setPreBubblingCacheTags(L[1]);const T=e.textContent.match(d());if(T)return void v.setPreBubblingCacheContexts(T[1]);const f=e.textContent.match(h());if(f)return void v.setPreBubblingCacheKeys(f[1]);const I=e.textContent.match(u());if(I)return void v.setPreBubblingCacheMaxAge(I[1]);const G=e.textContent.match(m());if(G)return void v.setRenderingTime(G[1]);const R=e.textContent.match(i());if(R)return v.setPropertyHook(R[1]),void v.setObjectType(R[1]);const B=e.textContent.match(c());if(B)return void v.setSuggestions(B[1]);const P=e.textContent.match(r());if(P){v.setFilePath(P[1]);const t=e.nextElementSibling;if(t&&t.nodeType===Node.ELEMENT_NODE&&null===v.dataNode){v.setDataNode(t);const e=Object.assign({},v),s=this.utilities.generateUniqueIdentifier(),a=this.generateInstanceLayer(e,t,s);t.setAttribute(x,s),N.appendChild(a),p.push(this.setthemeDebugNode(e,a,t))}v.reset()}}))})),this.themeDebugNodes=p,this.triggerMutationObserver(p),this.triggerResizeObserver(p),C.init(N,p),a.appendChild(C.generateControllerLayer()),C.executePostActivation()},detach:function(e,t,s){}}}(Drupal);
\ No newline at end of file
......@@ -105,7 +105,7 @@ Drupal.themeElement = {
},
setSuggestions(input) {
this.suggestions = this.pasreListOnOffRegexpOutput(input);
this.suggestions = this.parseListOnOffRegexpOutput(input);
},
setDataNode(input) {
......@@ -297,14 +297,14 @@ Drupal.themeElement = {
});
},
pasreListOnOffRegexpOutput(regexpOutput) {
parseListOnOffRegexpOutput(regexpOutput) {
return regexpOutput.trim()
.split(/\n\s*/)
.map((themeSuggestion) => {
const splitThemeSuggestion = themeSuggestion.split(' ');
return {
suggestion: splitThemeSuggestion[1],
activated: (splitThemeSuggestion[0] === 'x'),
activated: ['x', ''].includes(splitThemeSuggestion[0]),
};
});
},
......
......@@ -93,7 +93,7 @@
regExs: {
// Validate theme DEBUG.
regexGetTemplateDebug: () => new RegExp("^(THEME DEBUG|START RENDERED)$"),
regexGetTemplateDebug: () => new RegExp("^(THEME DEBUG|START RENDERER)$"),
// Validate template hook.
regexGetTemplateHook: () => new RegExp("THEME HOOK: '([^']*)'"),
......@@ -104,7 +104,7 @@
),
// Validate template file path.
regexGetTemplateFilePath: () => new RegExp("BEGIN OUTPUT from '([^']*)'"),
regexGetTemplateFilePath: () => new RegExp("BEGIN( CUSTOM TEMPLATE)? OUTPUT from '([^']*)'"),
// Validate complete theme analysis.
regexGetTemplateEndOutput: () => new RegExp("END OUTPUT from '([^']*)'"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment