TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -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 r from"@typo3/backend/event/consumer-scope.js";class c{constructor(o){this.consumerScope=r,this.consumerScope=o}}export{c as AbstractContainer};
|
||||
@@ -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{ScaffoldIdentifierEnum as o}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import{AbstractContainer as u}from"@typo3/backend/viewport/abstract-container.js";import m from"@typo3/backend/event/client-request.js";import c from"@typo3/backend/event/interaction-request.js";import l from"@typo3/backend/viewport/loader.js";import i from"@typo3/backend/event/trigger-request.js";class f extends u{get(){return document.querySelector(o.contentModuleIframe).contentWindow}beforeSetUrl(e){return this.consumerScope.invoke(new i("typo3.beforeSetUrl",e))}setUrl(e,t,r){e instanceof URL&&(e=e.toString());const n=this.resolveRouterElement();if(n===null&&self!==top)return Promise.reject(new Error("Content container used in unsupported frame context"));t instanceof c||(t=new m("typo3.setUrl",null));const s=this.consumerScope.invoke(new i("typo3.setUrl",t));return s.then(()=>{n!==null?(l.start(),n.setAttribute("endpoint",e),n.setAttribute("module",r||null),n.parentElement.addEventListener("typo3-module-loaded",()=>l.finish(),{once:!0})):document.location.assign(e)}),s}getUrl(){return this.resolveRouterElement().getAttribute("endpoint")}refresh(e){const t=this.resolveIFrameElement();if(t===null)return Promise.reject();const r=this.consumerScope.invoke(new i("typo3.refresh",e));return r.then(()=>{t.contentWindow.location.reload()}),r}getIdFromUrl(){if(this.getUrl()){const e=new URL(this.getUrl(),window.location.origin).searchParams.get("id")??"";return parseInt(e,10)}return 0}resolveIFrameElement(){return document.querySelector(o.contentModuleIframe)}resolveRouterElement(){return document.querySelector(o.contentModuleRouter)}}export{f as default};
|
||||
@@ -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{html as d,nothing as g}from"lit";import{property as b,state as m,customElement as f}from"lit/decorators.js";import{PseudoButtonLitElement as x}from"@typo3/backend/element/pseudo-button.js";import{ContentNavigationSlotEnum as u,NavigationStateChangeEvent as p,NavigationToggleEvent as v}from"@typo3/backend/viewport/content-navigation.js";import"@typo3/backend/element/icon-element.js";var h=function(i,t,e,o){var r=arguments.length,n=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,t,e,o);else for(var l=i.length-1;l>=0;l--)(c=i[l])&&(n=(r<3?c(n):r>3?c(t,e,n):c(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},s;(function(i){i.collapse="collapse",i.expand="expand"})(s||(s={}));let a=class extends x{constructor(){super(...arguments),this.context=null,this.mutationObserver=null,this.resizeObserver=null,this.boundStateChangeHandler=this.handleStateChange.bind(this),this.boundFocusRequestHandler=this.handleFocusRequest.bind(this),this.pageHideHandler=()=>{this.releaseTopLevelListeners()}}connectedCallback(){if(super.connectedCallback(),this.hidden=!0,!this.action){console.error('<typo3-backend-content-navigation-toggle> requires an "action" attribute (collapsed or expanded)');return}this.discoverContext(),this.setupStateSync(),this.setupFocusListener(),this.setupResizeObserver(),window.addEventListener("pagehide",this.pageHideHandler)}disconnectedCallback(){super.disconnectedCallback(),this.releaseTopLevelListeners(),window.removeEventListener("pagehide",this.pageHideHandler)}render(){if(!this.context||!this.action)return d`${g}`;const t=this.action===s.collapse?"actions-panel-collapse-start":"actions-panel-expand-start";return d`<typo3-backend-icon identifier=${t} size=small></typo3-backend-icon>`}buttonActivated(){this.context?.contentNavigation.toggleNavigation()}shouldBeVisible(){if(!this.context||!this.action)return!1;const{contentNavigation:t}=this.context;return this.action===s.collapse?t.shouldShowCollapseButton():t.shouldShowExpandButton()}shouldRender(){return this.context!==null&&!this.hidden}discoverContext(){const t=this.findContentNavigation();t&&(this.context={contentNavigation:t,slot:this.detectSlot(t)},this.updateVisibility())}findContentNavigation(){const t=this.closest("typo3-backend-content-navigation");if(t)return t;try{const e=window.frameElement;if(e)return e.closest("typo3-backend-content-navigation")}catch{}return null}detectSlot(t){let e=this.parentElement;for(;e!==null;){if(e.parentElement===t){if(e.getAttribute("slot")===u.navigation)return u.navigation;break}e=e.parentElement}return u.content}getTargetDocument(){try{return window.top?.document??document}catch{return document}}setupStateSync(){if(!this.context)return;const{contentNavigation:t}=this.context;this.mutationObserver=new MutationObserver(e=>{for(const o of e)o.type==="attributes"&&this.updateVisibility()}),this.mutationObserver.observe(t,{attributes:!0,attributeFilter:["navigation-collapsed","navigation-hidden"]}),this.getTargetDocument().addEventListener(p.eventName,this.boundStateChangeHandler)}cleanupStateSync(){this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.getTargetDocument().removeEventListener(p.eventName,this.boundStateChangeHandler)}releaseTopLevelListeners(){this.cleanupStateSync(),this.cleanupFocusListener(),this.cleanupResizeObserver()}handleStateChange(t){const{contentNavigation:e}=this.context||{};e&&t.target===e&&this.updateVisibility()}updateVisibility(){this.hidden=!this.shouldBeVisible(),this.updateTitle()}updateTitle(){if(!this.context||!this.action)return;const{contentNavigation:t}=this.context;this.title=this.action===s.collapse?t.navigationLabelCollapse:t.navigationLabelExpand}setupFocusListener(){this.context&&this.context.contentNavigation.addEventListener(v.eventName,this.boundFocusRequestHandler)}cleanupFocusListener(){this.context&&this.context.contentNavigation.removeEventListener(v.eventName,this.boundFocusRequestHandler)}setupResizeObserver(){this.context&&(this.resizeObserver=new ResizeObserver(()=>{this.updateVisibility()}),this.resizeObserver.observe(this.context.contentNavigation),this.updateVisibility())}cleanupResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}handleFocusRequest(t){const{slot:e}=this.context||{};e===t.detail.focusTarget&&this.shouldRender()&&this.updateComplete.then(()=>{this.focus()})}};h([b({type:String})],a.prototype,"action",void 0),h([m()],a.prototype,"context",void 0),a=h([f("typo3-backend-content-navigation-toggle")],a);export{a as ContentNavigationToggle,s as ContentNavigationToggleActionEnum};
|
||||
File diff suppressed because one or more lines are too long
@@ -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{ScaffoldContentArea as t}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import"@typo3/backend/element/progress-bar-element.js";class e{static{this.el=null}static start(){(!this.el||!this.el.isConnected)&&(this.el=document.createElement("typo3-backend-progress-bar"),t.getContentContainer()?.appendChild(this.el)),this.el.start(!0)}static async finish(){this.el&&(await this.el.done(),this.el.isRunning()||(this.el=null))}}export{e as default};
|
||||
@@ -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{ScaffoldContentArea as c}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import{AbstractContainer as m}from"@typo3/backend/viewport/abstract-container.js";import l from"@typo3/backend/event/trigger-request.js";import{selector as p}from"@typo3/core/literals.js";class h extends m{constructor(t){super(t),this.activeComponentId=""}get contentNavigation(){return c.getContentNavigation()}get navigationContainer(){return c.getNavigationContainer()}showComponent(t){const n=this.contentNavigation,e=this.navigationContainer;if(!n||!e||(this.show(t),t===this.activeComponentId))return;if(this.activeComponentId!==""){const o=e.querySelector("#navigationComponent-"+this.activeComponentId.replace(/[/@]/g,"_"));o&&(o.style.display="none")}const i="navigationComponent-"+t.replace(/[/@]/g,"_");if(e.querySelectorAll(p`[data-component="${t}"]`).length===1){this.show(t),this.activeComponentId=t;return}import(t+".js").then(o=>{if(typeof o.navigationComponentName=="string"){const r=o.navigationComponentName,s=document.createElement(r);s.setAttribute("id",i),s.dataset.component=t,e.append(s)}else e.insertAdjacentHTML("beforeend",'<div data-component="'+t+'" id="'+i+'"></div>'),Object.values(o)[0].initialize("#"+i);this.show(t),this.activeComponentId=t})}hide(){this.contentNavigation?.hideNavigation()}show(t){const n=this.contentNavigation,e=this.navigationContainer;if(!n||!e)return;e.querySelectorAll("[data-component]").forEach(i=>i.style.display="none"),n.showNavigation();const a=e.querySelector('[data-component="'+t+'"]');a&&(a.style.display=null)}setUrl(t,n){const e=this.consumerScope.invoke(new l("typo3.setUrl",n));return e.then(()=>{this.contentNavigation?.showNavigation()}),e}}export{h as default};
|
||||
@@ -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{ScaffoldIdentifierEnum as c}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import n from"@typo3/backend/storage/persistent.js";var t;(function(l){l.sidebarExpanded="scaffold-sidebar-expanded",l.sidebarFlyout="scaffold-sidebar-flyout",l.toolbarExpanded="scaffold-toolbar-expanded"})(t||(t={}));class i extends CustomEvent{static{this.eventName="typo3:scaffold:sidebar:toggle"}constructor(e){super(i.eventName,{detail:{expanded:e},bubbles:!0,composed:!0})}}class a extends CustomEvent{static{this.eventName="typo3:scaffold:toolbar:toggle"}constructor(e){super(a.eventName,{detail:{expanded:e},bubbles:!0,composed:!0})}}class r extends CustomEvent{static{this.eventName="typo3:scaffold:toolbar:toggle-request"}constructor(){super(r.eventName,{bubbles:!0,composed:!0})}}class o extends CustomEvent{static{this.eventName="typo3:scaffold:search:toggle-request"}constructor(){super(o.eventName,{bubbles:!0,composed:!0})}}class d{static{this.STORAGE_KEY="typo3-sidebar-collapsed"}static{this.LARGE_SCREEN_QUERY="(min-width: 992px)"}static{this.mediaQuery=null}static{this.sidebarPreferExpanded=!0}static isSidebarExpanded(){return this.getScaffold()?.classList.contains(t.sidebarExpanded)??!1}static isSidebarFlyout(){return this.getScaffold()?.classList.contains(t.sidebarFlyout)??!1}static isSidebarVisible(){return this.isLargeScreen()?!0:this.isSidebarFlyout()}static isToolbarExpanded(){return this.getScaffold()?.classList.contains(t.toolbarExpanded)??!1}static isLargeScreen(){return window.matchMedia(this.LARGE_SCREEN_QUERY).matches}static initialize(){if(this.mediaQuery=window.matchMedia(this.LARGE_SCREEN_QUERY),this.mediaQuery.addEventListener("change",this.handleMediaQueryChange),document.body.dataset.context==="install"){const e=localStorage.getItem(this.STORAGE_KEY)==="true";this.sidebarPreferExpanded=!e}else this.sidebarPreferExpanded=this.isSidebarExpanded();this.initializeOverlay(),this.initializeEventListeners(),this.applyStateForViewport()}static toggleSidebar(e){this.getScaffold()&&(this.isLargeScreen()?this.toggleSidebarExpanded(e):this.toggleSidebarFlyout(e))}static toggleToolbar(e){const s=this.getScaffold();s&&(this.isLargeScreen()||(typeof e>"u"&&(e=!this.isToolbarExpanded()),s.classList.toggle(t.toolbarExpanded,e),e&&(s.classList.remove(t.sidebarExpanded),this.toggleSidebarFlyout(!1)),document.dispatchEvent(new a(e))))}static collapseAll(){const e=this.getScaffold();e&&e.classList.remove(t.sidebarExpanded,t.sidebarFlyout,t.toolbarExpanded)}static toggleSidebarExpanded(e){const s=this.getScaffold();s&&(e=e??!this.isSidebarExpanded(),this.sidebarPreferExpanded=e,s.classList.toggle(t.sidebarExpanded,e),s.classList.remove(t.sidebarFlyout,t.toolbarExpanded),this.persistSidebarState(e),document.dispatchEvent(new i(e)))}static toggleSidebarFlyout(e){const s=this.getScaffold();s&&(this.isLargeScreen()||(e=e??!this.isSidebarFlyout(),s.classList.toggle(t.sidebarFlyout,e),e&&s.classList.remove(t.sidebarExpanded,t.toolbarExpanded),document.dispatchEvent(new i(e))))}static initializeEventListeners(){document.addEventListener("typo3-module-load",()=>{this.toggleSidebarFlyout(!1),this.toggleToolbar(!1)}),document.addEventListener(r.eventName,()=>{this.toggleToolbar()}),document.addEventListener(o.eventName,()=>{this.collapseAll()})}static applyStateForViewport(){const e=this.getScaffold();e&&(this.isLargeScreen()?(e.classList.remove(t.sidebarFlyout),e.classList.toggle(t.sidebarExpanded,this.sidebarPreferExpanded)):e.classList.remove(t.sidebarExpanded,t.sidebarFlyout),document.dispatchEvent(new i(this.isSidebarVisible())))}static{this.handleMediaQueryChange=()=>{d.applyStateForViewport()}}static persistSidebarState(e){document.body.dataset.context==="install"?localStorage.setItem(this.STORAGE_KEY,e?"false":"true"):n.set("BackendComponents.States.typo3-sidebar",{collapsed:!e})}static getScaffold(){return document.querySelector(c.scaffold)}static initializeOverlay(){document.querySelector(".scaffold-overlay")?.addEventListener("click",s=>{s.preventDefault(),d.toggleSidebar(!1)})}}export{i as ScaffoldSidebarToggleEvent,d as ScaffoldState,t as ScaffoldStateClass,a as ScaffoldToolbarToggleEvent,o as SearchToggleRequestEvent,r as ToolbarToggleRequestEvent};
|
||||
@@ -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{ScaffoldIdentifierEnum as m}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import d from"@typo3/core/document-service.js";import u from"@typo3/core/event/regular-event.js";import{ModuleUtility as l,ModuleSelector as a}from"@typo3/backend/module.js";import{selector as c}from"@typo3/core/literals.js";import s from"@typo3/backend/module-menu.js";class n{static{this.toolbarSelector=".t3js-scaffold-toolbar"}constructor(){d.ready().then(()=>{this.initializeEvents()})}registerEvent(t){d.ready().then(()=>{t()}),new u("t3-topbar-update",t).bindTo(document.querySelector(m.header))}initializeEvents(){const t=document.querySelector(n.toolbarSelector);if(t===null)return;new u("click",(r,e)=>{r.preventDefault();const i=l.getRouteFromElement(e);s.App.showModule(i.identifier,i.params,r)}).delegateTo(t,a.link);const o=r=>{const e=r.detail.module;!e||!l.getFromName(e).link||this.highlightModule(e)};document.addEventListener("typo3-module-load",o),document.addEventListener("typo3-module-loaded",o)}highlightModule(t){const o=document.querySelector(n.toolbarSelector);if(o===null)return;o.querySelectorAll(a.link+".dropdown-item").forEach(e=>{e.classList.remove("active"),e.removeAttribute("aria-current")});const r=l.getFromName(t);this.highlightModuleItem(o,r,!0)}highlightModuleItem(t,o,r){const e=t.querySelectorAll(a.link+c`[data-moduleroute-identifier="${o.name}"].dropdown-item`);return e.forEach(i=>{i.classList.add("active"),r&&i.setAttribute("aria-current","location")}),e.length>0&&(r=!1),o.parent!==""&&this.highlightModuleItem(t,l.getFromName(o.parent),r),e.length>0}}export{n as default};
|
||||
@@ -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{ScaffoldIdentifierEnum as a}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import n from"@typo3/backend/viewport/toolbar.js";import s from"@typo3/core/ajax/ajax-request.js";class e{static{this.topbarSelector=a.header}constructor(){this.Toolbar=new n}refresh(){new s(TYPO3.settings.ajaxUrls.topbar).get().then(async r=>{const o=await r.resolve(),t=document.querySelector(e.topbarSelector);t!==null&&(t.innerHTML=o.topbar,t.dispatchEvent(new Event("t3-topbar-update")))})}}export{e as default};
|
||||
Reference in New Issue
Block a user