Skip to content

Commit

Permalink
unnest map from superfluous parent document
Browse files Browse the repository at this point in the history
  • Loading branch information
Stassi committed Nov 22, 2024
1 parent 7f06c33 commit 6de5bd6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 37 deletions.
24 changes: 11 additions & 13 deletions src/leaf/map/fullscreen/fullscreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,19 @@ export function fullscreenMap({
mapLifecycleEvent: FullscreenMapLifecycleEvent,
): (() => void) =>
fullscreenMapLifecycleListener({
document: {
map: {
control: {
anchor: {
assign: anchorAssign,
titleStates: anchorTitleStates,
},
map: {
control: {
anchor: {
assign: anchorAssign,
titleStates: anchorTitleStates,
},
fullscreen: {
classNames: fullscreenMapClassNames,
state: { get: getFullscreenState, toggle: toggleFullscreenState },
},
lifecycleEvent: mapLifecycleEvent,
map,
},
fullscreen: {
classNames: fullscreenMapClassNames,
state: { get: getFullscreenState, toggle: toggleFullscreenState },
},
lifecycleEvent: mapLifecycleEvent,
map,
},
})

Expand Down
44 changes: 20 additions & 24 deletions src/leaf/map/fullscreen/lifecycle-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,35 @@ import { type Map, type UseSwitch } from '@stassi/leaf'

export type FullscreenMapLifecycleEvent = 'ready' | 'unload'
export type FullscreenMapLifecycleListenerOptions = {
document: {
map: {
control: {
anchor: {
assign: ControlAnchorAssign
titleStates: ControlAnchorTitleStates
}
map: {
control: {
anchor: {
assign: ControlAnchorAssign
titleStates: ControlAnchorTitleStates
}
fullscreen: {
classNames: string
state: UseSwitch
}
lifecycleEvent: FullscreenMapLifecycleEvent
map: Map
}
fullscreen: {
classNames: string
state: UseSwitch
}
lifecycleEvent: FullscreenMapLifecycleEvent
map: Map
}
}

export type FullscreenMapLifecycleListener = () => void

export function fullscreenMapLifecycleListener({
document: {
map: {
control: {
anchor: { assign: anchorAssign, titleStates: anchorTitleStates },
},
fullscreen: {
classNames: fullscreenMapClassNames,
state: { get: getFullscreenState, toggle: toggleFullscreenState },
},
lifecycleEvent: mapLifecycleEvent,
map,
map: {
control: {
anchor: { assign: anchorAssign, titleStates: anchorTitleStates },
},
fullscreen: {
classNames: fullscreenMapClassNames,
state: { get: getFullscreenState, toggle: toggleFullscreenState },
},
lifecycleEvent: mapLifecycleEvent,
map,
},
}: FullscreenMapLifecycleListenerOptions): FullscreenMapLifecycleListener {
return function handleFullscreenMapLifecycleEvent(): void {
Expand Down

0 comments on commit 6de5bd6

Please sign in to comment.