-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
128 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { PathElement } from "./pathElements"; | ||
|
||
export type FindChildResult<TChild> = ChildFoundResult<TChild> | NoChildResult; | ||
|
||
export interface ChildFoundResult<TChild> { | ||
newChild: TChild; | ||
closePrevious?: boolean; | ||
|
||
pathForChild?: PathElement[]; | ||
attachToParent?: boolean; | ||
} | ||
|
||
export interface NoChildResult { | ||
newChild: undefined; | ||
closePrevious?: boolean; | ||
} | ||
|
||
export function isChildFoundResult<T>(result: FindChildResult<T>): result is ChildFoundResult<T> { | ||
return !!result.newChild; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export default interface PathElement { | ||
export interface PathElement<TParamsValue = string | undefined> { | ||
name: string; | ||
params?: Record<string, string>; | ||
params?: Record<string, TParamsValue>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import type { HasLifecycleEvents } from "../screens/hasLifecycleHandlers"; | ||
import type ScreenBase from "../screens/screenBase"; | ||
import LifecycleScreenNavigatorBase from "./lifecycleScreenNavigatorBase"; | ||
import type ScreenLifecycleEventHub from "./screenLifecycleEventHub"; | ||
|
||
export default class SimpleScreenNavigator< | ||
TScreen extends Partial<HasLifecycleEvents> & Partial<ScreenBase> = any, | ||
TNavigationParams extends Record<string, string> = Record<string, string> | ||
> extends LifecycleScreenNavigatorBase<TScreen, TNavigationParams> {} | ||
TNavigationParams extends Record<string, string | undefined> = Record<string, string | undefined> | ||
> extends LifecycleScreenNavigatorBase<TScreen, TNavigationParams> { | ||
constructor(screen?: TScreen, navigationPrefix?: string, eventHub?: ScreenLifecycleEventHub<TScreen>) { | ||
super(screen, eventHub); | ||
|
||
if (navigationPrefix) { | ||
this.getNavigationState = () => [{ name: navigationPrefix }, this.createDefaultNavigationState()]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import type PathElement from "../models/pathElements"; | ||
import type { Awaitable } from "@frui.ts/helpers"; | ||
import type { PathElement } from "../models/pathElements"; | ||
|
||
export interface ScreenNavigator { | ||
readonly isActive: boolean; | ||
|
||
canNavigate(path: PathElement[]): Promise<boolean> | boolean; | ||
canNavigate(path: PathElement[]): Awaitable<boolean>; | ||
navigate(path: PathElement[]): Promise<void>; | ||
|
||
navigationName: string; | ||
getNavigationState(): PathElement; | ||
getNavigationState(): PathElement[]; | ||
|
||
parent: ScreenNavigator | undefined; | ||
getPrimaryChild(): ScreenNavigator | undefined; | ||
} | ||
|
||
export interface LifecycleScreenNavigator extends ScreenNavigator { | ||
canDeactivate(isClosing: boolean): Promise<boolean> | boolean; | ||
canDeactivate(isClosing: boolean): Awaitable<boolean>; | ||
deactivate(isClosing: boolean): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.