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!
*/
import{LitElement as s,nothing as m,html as u}from"lit";import{property as f,query as p,customElement as h}from"lit/decorators.js";import g from"~labels/core.core";var c=function(i,e,t,o){var a=arguments.length,n=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,e,t,o);else for(var d=i.length-1;d>=0;d--)(l=i[d])&&(n=(a<3?l(n):a>3?l(e,t,n):l(e,t))||n);return a>3&&n&&Object.defineProperty(e,t,n),n};const b="typo3-iframe-module";let r=class extends s{constructor(){super(...arguments),this.endpoint=""}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="endpoint"&&o===t&&this.iframe.setAttribute("src",o)}connectedCallback(){super.connectedCallback(),this.endpoint&&this.dispatch("typo3-iframe-load",{url:this.endpoint,title:null})}createRenderRoot(){return this}render(){return this.endpoint?u`<iframe src=${this.endpoint} name=list_frame id=typo3-contentIframe class="scaffold-content-module-iframe t3js-scaffold-content-module-iframe" title=${g.get("iframe.listFrame")} @load=${this._loaded}></iframe>`:m}registerPagehideHandler(e){try{e.contentWindow.addEventListener("pagehide",t=>this._pagehide(t,e),{once:!0})}catch(t){throw console.error("Failed to access contentWindow of module iframe \u2013 using a foreign origin?"),t}}retrieveModuleStateFromIFrame(e){try{return{url:e.contentWindow.location.href,title:e.contentDocument.title,module:e.contentDocument.body.querySelector(".module[data-module-name]")?.getAttribute("data-module-name")}}catch{return console.error("Failed to access contentWindow of module iframe \u2013 using a foreign origin?"),{url:this.endpoint,title:null}}}_loaded({target:e}){const t=e;this.registerPagehideHandler(t);const o=this.retrieveModuleStateFromIFrame(t);this.dispatch("typo3-iframe-loaded",o)}_pagehide(e,t){new Promise(o=>window.setTimeout(o,0)).then(()=>{t.contentWindow!==null&&this.dispatch("typo3-iframe-load",{url:t.contentWindow.location.href,title:null})})}dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};c([f({type:String})],r.prototype,"endpoint",void 0),c([p("iframe",!0)],r.prototype,"iframe",void 0),r=c([h("typo3-iframe-module")],r);export{r as IframeModuleElement,b as componentName};
@@ -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{LitElement as h,css as f,html as b}from"lit";import{property as a,query as y,customElement as g}from"lit/decorators.js";import{ModuleUtility as c}from"@typo3/backend/module.js";var l=function(d,e,t,o){var n=arguments.length,i=n<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(d,e,t,o);else for(var m=d.length-1;m>=0;m--)(r=d[m])&&(i=(n<3?r(i):n>3?r(e,t,i):r(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};const u="@typo3/backend/module/iframe",p=()=>!0;let s=class extends h{static{this.styles=f`:host{width:100%;min-height:100%;flex:1 0 auto;display:flex;flex-direction:row}::slotted(*){min-height:100%;width:100%}`}constructor(){super(),this.module="",this.endpoint="",this.sitenameFirst=!1,this.titleComponents=null,this.addEventListener("typo3-module-load",({target:e,detail:t})=>{const o=e.getAttribute("slot");this.pushState({slotName:o,detail:t})}),this.addEventListener("typo3-module-loaded",({detail:e})=>{this.updateBrowserState(e)}),this.addEventListener("typo3-iframe-load",({detail:e})=>{let t={slotName:u,detail:e};if(t.detail.url.includes(this.stateTrackerUrl+"?state=")){const o=t.detail.url.split("?state=");t=JSON.parse(decodeURIComponent(o[1]||"{}"))}this.slotElement.getAttribute("name")!==t.slotName&&this.slotElement.setAttribute("name",t.slotName),this.markActive(t.slotName,this.slotElement.getAttribute("name")===u?null:t.detail.url,!1),this.updateBrowserState(t.detail),this.parentElement.dispatchEvent(new CustomEvent("typo3-module-load",{bubbles:!0,composed:!0,detail:t.detail}))}),this.addEventListener("typo3-iframe-loaded",({detail:e})=>{this.updateBrowserState(e),this.parentElement.dispatchEvent(new CustomEvent("typo3-module-loaded",{bubbles:!0,composed:!0,detail:e}))})}static get observedAttributes(){return[...super.observedAttributes,"sitename-first"]}connectedCallback(){super.connectedCallback(),this.sitenameFirst=this.hasAttribute("sitename-first")}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="sitename-first"&&(this.sitenameFirst=o!==null,this.updateBrowserTitle())}render(){const t=c.getFromName(this.module).component||u;return b`<slot name=${t}></slot>`}updated(){const t=c.getFromName(this.module).component||u;this.markActive(t,this.endpoint)}async markActive(e,t,o=!0){const n=await this.getModuleElement(e);t&&(o||n.getAttribute("endpoint")!==t)&&n.setAttribute("endpoint",t),n.hasAttribute("active")||n.setAttribute("active","");for(let i=n.previousElementSibling;i!==null;i=i.previousElementSibling)i.removeAttribute("active");for(let i=n.nextElementSibling;i!==null;i=i.nextElementSibling)i.removeAttribute("active")}async getModuleElement(e){let t=this.querySelector(`*[slot="${e}"]`);if(t!==null)return t;try{const o=await import(e+".js");if(t=this.querySelector(`*[slot="${e}"]`),t!==null)return t;if(!("componentName"in o))throw new Error(`module ${e} is missing the "componentName" export`);t=document.createElement(o.componentName)}catch(o){throw console.error({msg:`Error importing ${e} as backend module`,err:o}),o}return t.setAttribute("slot",e),this.appendChild(t),t}async pushState(e){const t=this.stateTrackerUrl+"?state="+encodeURIComponent(JSON.stringify(e));(await this.getModuleElement(u)).setAttribute("endpoint",t)}updateBrowserTitle(){let{titleComponents:e}=this;e!==null&&(this.sitenameFirst&&(e=e.toReversed()),document.title=e.join(" \xB7 "))}updateBrowserState(e){const t=new URL(e.url||"",window.location.origin),o=new URLSearchParams(t.search),n="title"in e?e.title:"";if(n!==null){const r=[this.sitename];n!==""&&r.unshift(n),this.titleComponents=r,this.updateBrowserTitle()}if(o.has("token"))o.delete("token"),t.search=o.toString();else if(o.has("install[controller]")){const r=o.get("install[controller]");t.pathname=this.entryPoint+"module/system/"+r,t.search=""}else return;const i=t.toString();window.history.replaceState(e,"",i)}};l([a({type:String,hasChanged:p})],s.prototype,"module",void 0),l([a({type:String,hasChanged:p})],s.prototype,"endpoint",void 0),l([a({type:String,attribute:"state-tracker"})],s.prototype,"stateTrackerUrl",void 0),l([a({type:String,attribute:"sitename"})],s.prototype,"sitename",void 0),l([a({type:String,attribute:"entry-point"})],s.prototype,"entryPoint",void 0),l([y("slot",!0)],s.prototype,"slotElement",void 0),s=l([g("typo3-backend-module-router")],s);export{s as ModuleRouter};