| @@ -0,0 +1,20 @@ | ||
| import { h, render, Component, Text } from 'ink' | ||
| import argParser from 'yargs-parser' | ||
| import RosmaroBigText from './RosmaroBigText' | ||
|
|
||
| class App extends Component { | ||
|
|
||
| render() { | ||
| return ( | ||
| <div> | ||
| <RosmaroBigText name="rainbow" /> | ||
| </div> | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| App.defaultProps = { | ||
| args: argParser(process.argv.slice(2)) | ||
| } | ||
|
|
||
| export default App |
| @@ -0,0 +1,16 @@ | ||
| import { h, Text } from 'ink' | ||
| import TextAnimation from 'ink-text-animation' | ||
|
|
||
|
|
||
| export default ({ name = "glitch" }) => ( | ||
| <div> | ||
| <TextAnimation name={name} > | ||
| <Text> | ||
| <div> _ __ ___ ___ _ __ ___ __ _ _ __ ___ </div> | ||
| <div> | '__/ _ \/ __| '_ ` _ \ / _` | '__/ _ \ </div> | ||
| <div> | | | (_) \__ \ | | | | | (_| | | | (_) |</div> | ||
| <div> |_| \___/|___/_| |_| |_|\__,_|_| \___/ </div> | ||
| </Text> | ||
| </TextAnimation> | ||
| </div> | ||
| ) |
| @@ -0,0 +1,39 @@ | ||
| import { h, Component } from "ink"; | ||
| import rosmaro from 'rosmaro'; | ||
| import makeStorage from 'rosmaro-in-memory-storage'; | ||
| import makeLock from 'rosmaro-process-wide-lock'; | ||
|
|
||
| class RosmaroInk extends Component { | ||
| constructor(props) { | ||
| super(props) | ||
| this.state = { | ||
| view: null | ||
| } | ||
| this.refreshView = () => Promise.resolve(this.model.render()) | ||
| .then(view => this.setState({ view })); | ||
|
|
||
| this.model = rosmaro(Object.assign({}, this.props, { | ||
| afterTransition: () => { | ||
| this.props.afterTransition(); | ||
| this.refreshView(); | ||
| } | ||
| })); | ||
| } | ||
|
|
||
| componentDidMount() { | ||
| this.refreshView(); | ||
| } | ||
|
|
||
| render() { | ||
| return this.state.view; | ||
| } | ||
| } | ||
|
|
||
| RosmaroInk.defaultProps = { | ||
| storage: makeStorage(), | ||
| lock: makeLock(), | ||
| afterTransition: () => { } | ||
| } | ||
|
|
||
|
|
||
| export default RosmaroInk |
| @@ -1,7 +1,15 @@ | ||
| 'use strict' | ||
|
|
||
| import { h, render} from 'ink' | ||
| import App from './App' | ||
|
|
||
| const unmount = render(<App />); | ||
|
|
||
| /** | ||
| |-------------------------------------------------- | ||
| | its for now!!! | ||
| | usually use process.exit() instead | ||
| | add a rosmaro leaf with this functionality | ||
| |-------------------------------------------------- | ||
| */ | ||
| setTimeout(() => unmount(), 5000) |
| @@ -14,5 +14,8 @@ module.exports = { | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| resolve: { | ||
| alias: {"tinycolor": "tinycolor2"}, | ||
| } | ||
| } | ||