-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
6 changed files
with
175 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// @ts-nocheck | ||
import type { UnistylesThemes, UnistylesBreakpoints } from '../../global' | ||
|
||
export class UnistylesMockedBridge { | ||
constructor() {} | ||
|
||
public get screenWidth() { | ||
return 400 | ||
} | ||
|
||
public get screenHeight() { | ||
return 860 | ||
} | ||
|
||
public get enabledPlugins() { | ||
return [] | ||
} | ||
|
||
public get hasAdaptiveThemes() { | ||
return true | ||
} | ||
|
||
public get themeName() { | ||
return 'default' | ||
} | ||
|
||
public get breakpoint() { | ||
return 'sm' | ||
} | ||
|
||
public get colorScheme() { | ||
return 'dark' | ||
} | ||
|
||
public get contentSizeCategory() { | ||
return 'unspecified' | ||
} | ||
|
||
public get sortedBreakpointPairs() { | ||
return [['sm', 320], ['md', 480], ['lg', 640], ['xl', 800]] | ||
} | ||
|
||
public get insets() { | ||
return { | ||
top: 0, | ||
right: 0, | ||
bottom: 0, | ||
left: 0 | ||
} | ||
} | ||
|
||
public get statusBar() { | ||
return { | ||
height: 20, | ||
width: 400 | ||
} | ||
} | ||
|
||
public get navigationBar() { | ||
return { | ||
height: 0, | ||
width: 0 | ||
} | ||
} | ||
|
||
public set themes(themes: Array<keyof UnistylesThemes>) {} | ||
public useBreakpoints(breakpoints: UnistylesBreakpoints) {} | ||
public useTheme(name: keyof UnistylesThemes) {} | ||
public updateTheme(name: keyof UnistylesThemes) {} | ||
public useAdaptiveThemes(enable: boolean) {} | ||
public addPlugin(pluginName: string, notify: boolean) {} | ||
public removePlugin(pluginName: string) {} | ||
} |
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,23 @@ | ||
// @ts-nocheck | ||
import type { UnistylesBreakpoints, UnistylesThemes } from '../../global' | ||
import type { UnistylesPlugin, UnistylesConfig, UnistylesBridge } from '../../types' | ||
|
||
export class UnistylesMockedRegistry { | ||
public config: UnistylesConfig = {} | ||
public breakpoints: UnistylesBreakpoints = {} as UnistylesBreakpoints | ||
public sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]> = [] | ||
public plugins: Array<UnistylesPlugin> = [] | ||
public themes: UnistylesThemes = {} as UnistylesThemes | ||
public themeNames: Array<keyof UnistylesThemes> = [] | ||
|
||
constructor(private unistylesBridge: UnistylesBridge) {} | ||
|
||
public addThemes = (themes: UnistylesThemes) => this | ||
public addBreakpoints = (breakpoints: UnistylesBreakpoints) => this | ||
public addConfig = (config: UnistylesConfig) => this | ||
public getTheme = (forName: keyof UnistylesThemes) => ({} as UnistylesThemes[keyof UnistylesThemes]) | ||
public addPlugin = (plugin: UnistylesPlugin, notify: boolean = true) => {} | ||
public removePlugin = (plugin: UnistylesPlugin) => {} | ||
public updateTheme = (name: keyof UnistylesThemes, theme: UnistylesThemes[keyof UnistylesThemes]) => {} | ||
public hasTheme = (name: keyof UnistylesThemes) => true | ||
} |
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,65 @@ | ||
// @ts-nocheck | ||
import { ScreenOrientation } from '../../common' | ||
import type { UnistylesBridge, UnistylesPlugin, UnistylesRegistry } from '../../types' | ||
import type { UnistylesThemes } from '../../global' | ||
|
||
export class UnistylesMockedRuntime { | ||
constructor(private unistylesBridge: UnistylesBridge, private unistylesRegistry: UnistylesRegistry) {} | ||
|
||
public get colorScheme() { | ||
return this.unistylesBridge.colorScheme | ||
} | ||
|
||
public get hasAdaptiveThemes() { | ||
return this.unistylesBridge.hasAdaptiveThemes | ||
} | ||
|
||
public get themeName() { | ||
return this.unistylesBridge.themeName | ||
} | ||
|
||
public get contentSizeCategory() { | ||
return this.unistylesBridge.contentSizeCategory | ||
} | ||
|
||
public get breakpoint() { | ||
return this.unistylesBridge.breakpoint | ||
} | ||
|
||
public get breakpoints() { | ||
return this.unistylesRegistry.breakpoints | ||
} | ||
|
||
public get enabledPlugins() { | ||
return this.unistylesBridge.enabledPlugins | ||
} | ||
|
||
public get screen() { | ||
return { | ||
width: this.unistylesBridge.screenWidth, | ||
height: this.unistylesBridge.screenHeight | ||
} | ||
} | ||
|
||
public get insets() { | ||
return this.unistylesBridge.insets | ||
} | ||
|
||
public get statusBar() { | ||
return this.unistylesBridge.statusBar | ||
} | ||
|
||
public get navigationBar() { | ||
return this.unistylesBridge.navigationBar | ||
} | ||
|
||
public get orientation() { | ||
return ScreenOrientation.Portrait | ||
} | ||
|
||
public setTheme = (name: keyof UnistylesThemes) => true | ||
public updateTheme = (name: keyof UnistylesThemes, theme: UnistylesThemes[keyof UnistylesThemes]) => {} | ||
public setAdaptiveThemes = (enabled: boolean) => {} | ||
public addPlugin = (plugin: UnistylesPlugin) => {} | ||
public removePlugin = (plugin: UnistylesPlugin) => {} | ||
} |
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,3 @@ | ||
export { UnistylesMockedBridge } from './UnistylesMockedBridge' | ||
export { UnistylesMockedRegistry } from './UnistylesMockedRegistry' | ||
export { UnistylesMockedRuntime } from './UnistylesMockedRuntime' |