<?xml version="1.0" encoding="UTF-8"?>
<!-- Collapsing Home sidebar (docs/plan/skin-milionar/230-sidebar.md). With the focus right of the sidebar it shrinks
     to its icons and the content takes the freed width; skin setting HomeSidebarNoCollapse keeps the classic layout.
     A focus change runs transforms only: the content is laid out once at its collapsed width and slides, so no list
     reloads or lays out again. Geometry, in one place: the sidebar edge moves from 462 to 95 (shift 367), the edge of the focused icon square, the content
     is 1458 + 367 = 1825 wide, the backdrop grows by 1825 / 1458 = 125.17 % from its top right corner. -->
<includes>
	<!-- Under a modal dialog Kodi asks the dialog for the focus (a dialog's own list 9000 would expand the sidebar), so
	     the sidebar's focus is also kept in a Home property, set and cleared by the sidebar itself. -->
	<expression name="MilionarSidebarCollapsed">!Skin.HasSetting(HomeSidebarNoCollapse) + [[!System.HasActiveModalDialog + !Control.HasFocus(9000) + !ControlGroup(700).HasFocus] | [System.HasActiveModalDialog + String.IsEmpty(Window(Home).Property(milionar.sidebar.focus))]]</expression>

	<!-- the one motion of the sidebar; every part moves with it -->
	<include name="MilionarSidebarTween">
		<param name="center">auto</param>
		<param name="condition">$EXP[MilionarSidebarCollapsed]</param>
		<definition>
			<animation type="Conditional" condition="$PARAM[condition]">
				<effect type="$PARAM[type]" start="$PARAM[start]" end="$PARAM[end]" center="$PARAM[center]" time="400" tween="cubic" easing="out" />
			</animation>
		</definition>
	</include>
	<include name="MilionarSidebarFade">
		<animation effect="fade" time="200" tween="sine" easing="out">VisibleChange</animation>
	</include>
	<include name="MilionarSidebarExpandedOnly">
		<visible>!$EXP[MilionarSidebarCollapsed]</visible>
		<include>MilionarSidebarFade</include>
	</include>
	<include name="MilionarSidebarCollapsedOnly">
		<visible>$EXP[MilionarSidebarCollapsed]</visible>
		<include>MilionarSidebarFade</include>
	</include>

	<!-- the sidebar panel and the content move by the same distance -->
	<include name="MilionarSidebarShift">
		<include content="MilionarSidebarTween">
			<param name="type" value="slide" />
			<param name="start" value="0,0" />
			<param name="end" value="-367,0" />
		</include>
	</include>
	<!-- the logo mark centres on the icons -->
	<include name="MilionarSidebarLogoCollapse">
		<include content="MilionarSidebarTween">
			<param name="type" value="slide" />
			<param name="start" value="0,0" />
			<param name="end" value="-72,0" />
		</include>
	</include>
	<!-- Estuary's star (Pro tebe) carries its weight lower than the other menu icons: its centroid lies 3 px under the
	     label's, the others' within 1 px (measured on native captures). Lifted by 3 px it sits on the label's line. -->
	<include name="MilionarSidebarIconNudge">
		<animation effect="slide" start="0,0" end="0,-3" time="0" condition="String.IsEqual(ListItem.Art(thumb),icons/sidemenu/favourites.png)">Conditional</animation>
	</include>
	<!-- a mouse reaches the sidebar over its icons only: the content under its labels stays pointable when collapsed -->
	<include name="MilionarSidebarHitrect">
		<hitrect x="0" y="264" w="95" h="826" />
	</include>

	<!-- the content groups of Home (sections and detail) -->
	<include name="MilionarContentArea">
		<left>462</left>
		<include condition="!Skin.HasSetting(HomeSidebarNoCollapse)">MilionarContentAreaCollapsible</include>
	</include>
	<include name="MilionarContentAreaCollapsible">
		<width>1825</width>
		<include>MilionarSidebarShift</include>
	</include>
	<!-- content anchored 20 px past the screen's right edge stays there. The collapsible content ends 367 px past the
	     screen while expanded, so the anchor sits 367 px further in and slides out with the same tween as the content:
	     both motions cancel in every frame and the anchor never moves. -->
	<include name="MilionarContentRightEdge">
		<include condition="Skin.HasSetting(HomeSidebarNoCollapse)">MilionarContentRightEdgeFixed</include>
		<include condition="!Skin.HasSetting(HomeSidebarNoCollapse)">MilionarContentRightEdgeCollapsible</include>
	</include>
	<include name="MilionarContentRightEdgeFixed">
		<right>-20</right>
	</include>
	<include name="MilionarContentRightEdgeCollapsible">
		<right>347</right>
		<include content="MilionarSidebarTween">
			<param name="type" value="slide" />
			<param name="start" value="0,0" />
			<param name="end" value="367,0" />
		</include>
	</include>
	<include name="MilionarBackdropCollapse">
		<include content="MilionarSidebarTween">
			<param name="type" value="zoom" />
			<param name="start" value="100" />
			<param name="end" value="125.17" />
			<param name="center" value="1920,0" />
		</include>
	</include>
</includes>
