TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:00 +02:00
commit f9941541b7
1178 changed files with 135377 additions and 0 deletions
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
class d{constructor(t,n){this.tsRef=t,this.tsTreeNode=n}getType(){const t=this.tsTreeNode.getValue();return this.tsRef.isType(t)?this.tsRef.getType(t):null}getFilteredProposals(t){const n={},r=[],o=this.tsTreeNode.getChildNodes(),u=this.tsTreeNode.getValue();for(const e in o)if(typeof o[e].value<"u"&&o[e].value!==null){const s={};s.word=e,this.tsRef.typeHasProperty(u,o[e].name)?(this.tsRef.cssClass="definedTSREFProperty",s.type=o[e].value):(s.cssClass="userProperty",this.tsRef.isType(o[e].value)?s.type=o[e].value:s.type=""),r.push(s),n[e]=!0}const i=this.tsRef.getPropertiesFromTypeId(this.tsTreeNode.getValue());for(const e in i)if(typeof i[e].value<"u"&&n[e]!==!0){const s={word:e,cssClass:"undefinedTSREFProperty",type:i[e].value};r.push(s)}const l=[];let p="";for(let e=0;e<r.length;e++){if(t.length===0){l.push(r[e]);continue}p=r[e].word.substring(0,t.length),p.toLowerCase()===t.toLowerCase()&&l.push(r[e])}return l}}export{d as CompletionResult};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import i from"@typo3/core/ajax/ajax-request.js";import{TsRef as l}from"@typo3/backend/code-editor/autocomplete/ts-ref.js";import{TsParser as n}from"@typo3/backend/code-editor/autocomplete/ts-parser.js";import{CompletionResult as p}from"@typo3/backend/code-editor/autocomplete/completion-result.js";class a{constructor(e){this.extTsObjTree={},this.parser=null,this.proposals=null,this.compResult=null,this.tsRef=new l,this.parser=new n(this.tsRef,this.extTsObjTree),this.tsRef.loadTsrefAsync(),this.loadExtTemplatesAsync(e)}refreshCodeCompletion(e){const t=this.getFilter(e),s=this.parser.buildTsObjTree(e);this.compResult=new p(this.tsRef,s),this.proposals=this.compResult.getFilteredProposals(t);const r=[];for(let o=0;o<this.proposals.length;o++)r[o]=this.proposals[o].word;return r}loadExtTemplatesAsync(e){if(Number.isNaN(e)||e===0)return null;new i(TYPO3.settings.ajaxUrls.codeeditor_codecompletion_loadtemplates).withQueryArguments({pageId:e}).get().then(async t=>{this.extTsObjTree.c=await t.resolve(),this.resolveExtReferencesRec(this.extTsObjTree.c)})}resolveExtReferencesRec(e){for(const t of Object.keys(e)){let s;if(e[t].v&&e[t].v.startsWith("<")&&!e[t].v.includes(">")){const r=e[t].v.replace(/</,"").trim();r.indexOf(" ")===-1&&(s=this.getExtChildNode(r),s!==null&&(e[t]=s))}!s&&e[t].c&&this.resolveExtReferencesRec(e[t].c)}}getExtChildNode(e){let t=this.extTsObjTree;const s=e.split(".");for(let r=0;r<s.length;r++){const o=s[r];if(typeof t.c>"u"||typeof t.c[o]>"u")return null;t=t.c[o]}return t}getFilter(e){return e.completingAfterDot?"":e.token.string.replace(".","").replace(/\s/g,"")}}export{a as TsCodeCompletion};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
class c{constructor(t,s){this.childNodes={},this.extPath="",this.parent=null,this.name=t,this.childNodes={},this.extPath="",this.value="",this.isExternal=!1,this.tsParser=s}getChildNodes(){const t=this.getExtNode();if(t!==null&&typeof t.c=="object")for(const s of Object.keys(t.c)){const e=new c(s,this.tsParser);e.global=!0,e.value=t.c[s].v?t.c[s].v:"",e.isExternal=!0,this.childNodes[s]=e}return this.childNodes}getValue(){if(this.value)return this.value;const t=this.getExtNode();if(t&&t.v)return t.v;const s=this.getNodeTypeFromTsref();return s||""}getNodeTypeFromTsref(){const t=this.extPath.split("."),s=t.pop(),e=this.parent.getValue();return e&&this.tsParser.tsRef.typeHasProperty(e,s)?this.tsParser.tsRef.getType(e).properties[s].value:""}getExtNode(){let t=this.tsParser.extTsObjTree;if(this.extPath==="")return t;const s=this.extPath.split(".");for(let e=0;e<s.length;e++){const r=s[e];if(typeof t.c>"u"||typeof t.c[r]>"u")return null;t=t.c[r]}return t}}class g extends Array{lastElementEquals(t){return this.length>0&&this[this.length-1]===t}popIfLastElementEquals(t){return this.lastElementEquals(t)?(this.pop(),!0):!1}}class E{constructor(t,s){this.tsRef=t,this.extTsObjTree=s,this.tsTree=new c("_L_",this)}getOperator(t){const s=[":=","=<","<",">","="];for(let e=0;e<s.length;e++){const r=s[e];if(t.indexOf(r)!==-1)return(r==="=<"||r==="<")&&t.indexOf(">")>-1?"=":r}return-1}buildTsObjTree(t){this.tsTree=new c("",this),this.tsTree.value="TLO";let s=1,e="",r=!1,o=!1;const n=new g,l=[];let i;for(;s<=t.currentLineNumber;){e="";const h=t.lineTokens[s-1];for(let f=0;f<=h.length;++f)if(f<h.length&&h[f].string.length>0){const a=h[f].string;a.startsWith("#")?n.push("#"):a==="("?n.push("("):a.startsWith("/*")?n.push("/*"):a==="{"&&this.getOperator(e)===-1&&(n.push("{"),l.push(e.trim()),r=!0),a.search(/^\s*\[.*\]/)!==-1&&e.search(/\S/)===-1&&a.search(/^\s*\[(global|end|GLOBAL|END)\]/)===-1&&!n.lastElementEquals("#")&&!n.lastElementEquals("/*")&&!n.lastElementEquals("{")&&!n.lastElementEquals("(")&&(o=!0,r=!0),e.search(/\S/)===-1&&!n.lastElementEquals("#")&&!n.lastElementEquals("/*")&&!n.lastElementEquals("(")&&(a.search(/^\s*\[(global|end|GLOBAL|END)\]/)!==-1&&!n.lastElementEquals("{")||a.search(/^\s*\[(global|GLOBAL)\]/)!==-1)&&(o=!1,r=!0),a===")"&&n.popIfLastElementEquals("("),a.startsWith("*/")&&(n.popIfLastElementEquals("/*"),r=!0),a==="}"&&e.replace(/\s/g,"")===""&&(n.popIfLastElementEquals("{"),l.length>0&&l.pop(),r=!0),n.lastElementEquals("#")||(e+=a)}else{if(!n.lastElementEquals("/*")&&!n.lastElementEquals("(")&&!r&&!o){e=e.trim();const a=this.getOperator(e);if(a!==-1){const d=e.indexOf(a);i=e.substring(0,d),l.length>0&&(i=l.join(".")+"."+i);let u=e.substring(d+a.length,e.length).trim();switch(i=i.trim(),a){case"=":i.search(/\s/g)===-1&&i.length>0&&this.setTreeNodeValue(i,u);break;case"=<":l.length>0&&u.substr(0,1)==="."&&(u=l.join(".")+u),i.search(/\s/g)===-1&&i.length>0&&u.search(/\s/g)===-1&&u.length>0&&this.setReference(i,u);break;case"<":l.length>0&&u.substr(0,1)==="."&&(u=l.join(".")+u),i.search(/\s/g)===-1&&i.length>0&&u.search(/\s/g)===-1&&u.length>0&&this.setCopy(i,u);break;case">":this.deleteTreeNodeValue(i);break;case":=":break;default:break}}}n.popIfLastElementEquals("#"),r=!1}s++}if(!n.lastElementEquals("/*")&&!n.lastElementEquals("(")&&!r){const h=e.indexOf("<");h!==-1?(i=e.substring(h+1,e.length).trim(),l.length>0&&i.substr(0,1)==="."&&(i=l.join(".")+i)):(i=e,l.length>0&&(i=l.join(".")+"."+i,i=i.replace(/\s/g,"")));const f=i.lastIndexOf(".");i=i.substring(0,f)}return this.getTreeNode(i)}getTreeNode(t){if(t=t.trim(),t.length===0)return this.tsTree;const s=t.split(".");let e=this.tsTree.childNodes,r,o=this.tsTree;for(let n=0;n<s.length;n++){if(r=s[n],typeof e[r]>"u"||typeof e[r].childNodes>"u"){e[r]=new c(r,this),e[r].parent=o;let l=o.extPath;l&&(l+="."),l+=r,e[r].extPath=l}if(n===s.length-1)return e[r];o=e[r],e=e[r].childNodes}}setTreeNodeValue(t,s){const e=this.getTreeNode(t);e.parent!==null&&e.parent.value==="GIFBUILDER"&&s==="TEXT"&&(s="GB_TEXT"),e.parent!==null&&e.parent.value==="GIFBUILDER"&&s==="IMAGE"&&(s="GB_IMAGE"),this.tsRef.isType(s)&&(e.value=s)}deleteTreeNodeValue(t){const s=this.getTreeNode(t);s.value=null,s.childNodes={}}setReference(t,s){const e=t.split("."),r=e[e.length-1],o=this.getTreeNode(t),n=this.getTreeNode(s);o.parent!==null?o.parent.childNodes[r]=n:this.tsTree.childNodes[r]=n}setCopy(t,s){this.clone=l=>{if(typeof l!="object")return l;const i={};for(const h in l)h!=="tsParser"&&(h!=="parent"?typeof l[h]=="object"?i[h]=this.clone(l[h]):i[h]=l[h]:"parent"in l&&(i.parent=l.parent));return i};const e=t.split("."),r=e[e.length-1],o=this.getTreeNode(t),n=this.getTreeNode(s);o.parent!==null?o.parent.childNodes[r]=this.clone(n):this.tsTree.childNodes[r]=this.clone(n)}}export{c as TreeNode,E as TsParser};
@@ -0,0 +1,13 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import h from"@typo3/core/ajax/ajax-request.js";class d{constructor(e,s,t){this.properties={},this.typeId=e,this.extends=s,this.properties=t}}class o{constructor(e,s,t){this.parentType=e,this.name=s,this.value=t}}class f{constructor(){this.typeTree={},this.doc=null}async loadTsrefAsync(){const e=await new h(TYPO3.settings.ajaxUrls.codeeditor_tsref).get();this.doc=await e.resolve(),this.buildTree()}buildTree(){for(const e of Object.keys(this.doc)){const s=this.doc[e];this.typeTree[e]=new d(e,s.extends||void 0,Object.fromEntries(Object.entries(s.properties).map(([t,r])=>[t,new o(e,t,r.type)])))}for(const e of Object.keys(this.typeTree))typeof this.typeTree[e].extends<"u"&&this.addPropertiesToType(this.typeTree[e],this.typeTree[e].extends,100)}addPropertiesToType(e,s,t){if(t<0)throw"Maximum recursion depth exceeded while trying to resolve the extends in the TSREF!";const r=s.split(",");for(let i=0;i<r.length;i++)if(typeof this.typeTree[r[i]]<"u"){typeof this.typeTree[r[i]].extends<"u"&&this.addPropertiesToType(this.typeTree[r[i]],this.typeTree[r[i]].extends,t-1);const y=this.typeTree[r[i]].properties;for(const p in y)typeof e.properties[p]>"u"&&(e.properties[p]=y[p])}}getPropertiesFromTypeId(e){return typeof this.typeTree[e]<"u"?(this.typeTree[e].properties.clone=function(){const s={};for(const t of Object.keys(this))s[t]=new o(this[t].parentType,this[t].name,this[t].value);return s},this.typeTree[e].properties):{}}typeHasProperty(e,s){return typeof this.typeTree[e]<"u"&&typeof this.typeTree[e].properties[s]<"u"}getType(e){return this.typeTree[e]}isType(e){return typeof this.typeTree[e]<"u"}}export{f as TsRef,o as TsRefProperty,d as TsRefType};