This adds a new item_variables expression function when expressions are used inside a composition context.
The function takes a single argument, the id for an item inside the composition, and returns a map of variable name to value for that item. This allows you to do things like insert text in a label fetching properties of another item in the composition, eg
Insert scale of map into a label:
map_get( item_variables( 'map'),'map_scale')
Insert x coordinate of map center into a label:
x(map_get( item_variables( 'map'),'map_extent_center'))