nixify, README, license
This commit is contained in:
commit
57ea8d17b6
29 changed files with 2005 additions and 17 deletions
BIN
frontend/elm-stuff/0.19.1/d.dat
Normal file
BIN
frontend/elm-stuff/0.19.1/d.dat
Normal file
Binary file not shown.
BIN
frontend/elm-stuff/0.19.1/i.dat
Normal file
BIN
frontend/elm-stuff/0.19.1/i.dat
Normal file
Binary file not shown.
0
frontend/elm-stuff/0.19.1/lock
Normal file
0
frontend/elm-stuff/0.19.1/lock
Normal file
BIN
frontend/elm-stuff/0.19.1/o.dat
Normal file
BIN
frontend/elm-stuff/0.19.1/o.dat
Normal file
Binary file not shown.
9
frontend/shell.nix
Executable file
9
frontend/shell.nix
Executable file
|
@ -0,0 +1,9 @@
|
|||
{pkgs ? import <nixpkgs> {}}:
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
pkgs.elmPackages.elm
|
||||
pkgs.elmPackages.elm-format
|
||||
pkgs.uglify-js
|
||||
pkgs.ungoogled-chromium
|
||||
];
|
||||
}
|
40
frontend/src/ElmskellTypes/Generated/Decoder.elm
Executable file
40
frontend/src/ElmskellTypes/Generated/Decoder.elm
Executable file
|
@ -0,0 +1,40 @@
|
|||
module ElmskellTypes.Generated.Decoder exposing (..)
|
||||
|
||||
import Iso8601 as Iso
|
||||
import Json.Decode as D exposing (..)
|
||||
import Json.Decode.Pipeline as D exposing (required)
|
||||
|
||||
import ElmskellTypes.Generated.ElmStreet exposing (..)
|
||||
import ElmskellTypes.Generated.Types as T
|
||||
|
||||
|
||||
decodeCommand : Decoder T.Command
|
||||
decodeCommand = elmStreetDecodeEnum T.readCommand
|
||||
|
||||
decodeCookiesKept : Decoder T.CookiesKept
|
||||
decodeCookiesKept = D.succeed T.CookiesKept
|
||||
|> required "keepFont" D.bool
|
||||
|> required "keepPrompt" D.bool
|
||||
|> required "keepTheme" D.bool
|
||||
|
||||
decodeCoreColor : Decoder T.CoreColor
|
||||
decodeCoreColor = elmStreetDecodeEnum T.readCoreColor
|
||||
|
||||
decodeFont : Decoder T.Font
|
||||
decodeFont = D.succeed T.Font
|
||||
|> required "fontSize" D.float
|
||||
|
||||
decodeInput : Decoder T.Input
|
||||
decodeInput = D.succeed T.Input
|
||||
|> required "command" decodeCommand
|
||||
|> required "args" (D.list D.string)
|
||||
|
||||
decodePrompt : Decoder T.Prompt
|
||||
decodePrompt = D.succeed T.Prompt
|
||||
|> required "prompt" D.string
|
||||
|
||||
decodeTheme : Decoder T.Theme
|
||||
decodeTheme = elmStreetDecodeEnum T.readTheme
|
||||
|
||||
decodeThemeColor : Decoder T.ThemeColor
|
||||
decodeThemeColor = elmStreetDecodeEnum T.readThemeColor
|
52
frontend/src/ElmskellTypes/Generated/ElmStreet.elm
Executable file
52
frontend/src/ElmskellTypes/Generated/ElmStreet.elm
Executable file
|
@ -0,0 +1,52 @@
|
|||
module ElmskellTypes.Generated.ElmStreet exposing (..)
|
||||
|
||||
import Json.Encode as E exposing (Value)
|
||||
import Json.Decode as D exposing (Decoder)
|
||||
import Json.Decode.Pipeline as D exposing (..)
|
||||
|
||||
|
||||
elmStreetEncodeMaybe : (a -> Value) -> Maybe a -> Value
|
||||
elmStreetEncodeMaybe enc = Maybe.withDefault E.null << Maybe.map enc
|
||||
|
||||
elmStreetEncodeEither : (a -> Value) -> (b -> Value) -> Result a b -> Value
|
||||
elmStreetEncodeEither encA encB res = E.object <| case res of
|
||||
Err a -> [("Left", encA a)]
|
||||
Ok b -> [("Right", encB b)]
|
||||
|
||||
elmStreetEncodePair : (a -> Value) -> (b -> Value) -> (a, b) -> Value
|
||||
elmStreetEncodePair encA encB (a, b) = E.list identity [encA a, encB b]
|
||||
|
||||
elmStreetEncodeTriple : (a -> Value) -> (b -> Value) -> (c -> Value) -> (a, b, c) -> Value
|
||||
elmStreetEncodeTriple encA encB encC (a, b, c) = E.list identity [encA a, encB b, encC c]
|
||||
|
||||
elmStreetEncodeNonEmpty : (a -> Value) -> (a, List a) -> Value
|
||||
elmStreetEncodeNonEmpty encA (a, xs) = E.list encA <| a :: xs
|
||||
|
||||
decodeStr : (String -> Maybe a) -> String -> Decoder a
|
||||
decodeStr readX x = case readX x of
|
||||
Just a -> D.succeed a
|
||||
Nothing -> D.fail "Constructor not matched"
|
||||
|
||||
elmStreetDecodeEnum : (String -> Maybe a) -> Decoder a
|
||||
elmStreetDecodeEnum r = D.andThen (decodeStr r) D.string
|
||||
|
||||
elmStreetDecodeChar : Decoder Char
|
||||
elmStreetDecodeChar = D.andThen (decodeStr (Maybe.map Tuple.first << String.uncons)) D.string
|
||||
|
||||
elmStreetDecodeEither : Decoder a -> Decoder b -> Decoder (Result a b)
|
||||
elmStreetDecodeEither decA decB = D.oneOf
|
||||
[ D.field "Left" (D.map Err decA)
|
||||
, D.field "Right" (D.map Ok decB)
|
||||
]
|
||||
|
||||
elmStreetDecodePair : Decoder a -> Decoder b -> Decoder (a, b)
|
||||
elmStreetDecodePair decA decB = D.map2 Tuple.pair (D.index 0 decA) (D.index 1 decB)
|
||||
|
||||
elmStreetDecodeTriple : Decoder a -> Decoder b -> Decoder c -> Decoder (a, b, c)
|
||||
elmStreetDecodeTriple decA decB decC = D.map3 (\a b c -> (a,b,c)) (D.index 0 decA) (D.index 1 decB) (D.index 2 decC)
|
||||
|
||||
elmStreetDecodeNonEmpty : Decoder a -> Decoder (a, List a)
|
||||
elmStreetDecodeNonEmpty decA = D.list decA |> D.andThen (\xs -> case xs of
|
||||
h::t -> D.succeed (h, t)
|
||||
_ -> D.fail "Expecting non-empty array")
|
||||
|
47
frontend/src/ElmskellTypes/Generated/Encoder.elm
Executable file
47
frontend/src/ElmskellTypes/Generated/Encoder.elm
Executable file
|
@ -0,0 +1,47 @@
|
|||
module ElmskellTypes.Generated.Encoder exposing (..)
|
||||
|
||||
import Iso8601 as Iso
|
||||
import Json.Encode as E exposing (..)
|
||||
|
||||
import ElmskellTypes.Generated.ElmStreet exposing (..)
|
||||
import ElmskellTypes.Generated.Types as T
|
||||
|
||||
|
||||
encodeCommand : T.Command -> Value
|
||||
encodeCommand = E.string << T.showCommand
|
||||
|
||||
encodeCookiesKept : T.CookiesKept -> Value
|
||||
encodeCookiesKept x = E.object
|
||||
[ ("tag", E.string "CookiesKept")
|
||||
, ("keepFont", E.bool x.keepFont)
|
||||
, ("keepPrompt", E.bool x.keepPrompt)
|
||||
, ("keepTheme", E.bool x.keepTheme)
|
||||
]
|
||||
|
||||
encodeCoreColor : T.CoreColor -> Value
|
||||
encodeCoreColor = E.string << T.showCoreColor
|
||||
|
||||
encodeFont : T.Font -> Value
|
||||
encodeFont x = E.object
|
||||
[ ("tag", E.string "Font")
|
||||
, ("fontSize", E.float x.fontSize)
|
||||
]
|
||||
|
||||
encodeInput : T.Input -> Value
|
||||
encodeInput x = E.object
|
||||
[ ("tag", E.string "Input")
|
||||
, ("command", encodeCommand x.command)
|
||||
, ("args", (E.list E.string) x.args)
|
||||
]
|
||||
|
||||
encodePrompt : T.Prompt -> Value
|
||||
encodePrompt x = E.object
|
||||
[ ("tag", E.string "Prompt")
|
||||
, ("prompt", E.string x.prompt)
|
||||
]
|
||||
|
||||
encodeTheme : T.Theme -> Value
|
||||
encodeTheme = E.string << T.showTheme
|
||||
|
||||
encodeThemeColor : T.ThemeColor -> Value
|
||||
encodeThemeColor = E.string << T.showThemeColor
|
197
frontend/src/ElmskellTypes/Generated/Types.elm
Executable file
197
frontend/src/ElmskellTypes/Generated/Types.elm
Executable file
|
@ -0,0 +1,197 @@
|
|||
module ElmskellTypes.Generated.Types exposing (..)
|
||||
|
||||
import Time exposing (Posix)
|
||||
import Json.Decode exposing (Value)
|
||||
|
||||
|
||||
type Command
|
||||
= ClearCommand
|
||||
| ColorsCommand
|
||||
| CookiesCommand
|
||||
| DebugCommand
|
||||
| FontCommand
|
||||
| HelloCommand
|
||||
| HelpCommand
|
||||
| PromptCommand
|
||||
| ThemeCommand
|
||||
| TodoCommand
|
||||
|
||||
showCommand : Command -> String
|
||||
showCommand x = case x of
|
||||
ClearCommand -> "ClearCommand"
|
||||
ColorsCommand -> "ColorsCommand"
|
||||
CookiesCommand -> "CookiesCommand"
|
||||
DebugCommand -> "DebugCommand"
|
||||
FontCommand -> "FontCommand"
|
||||
HelloCommand -> "HelloCommand"
|
||||
HelpCommand -> "HelpCommand"
|
||||
PromptCommand -> "PromptCommand"
|
||||
ThemeCommand -> "ThemeCommand"
|
||||
TodoCommand -> "TodoCommand"
|
||||
|
||||
readCommand : String -> Maybe Command
|
||||
readCommand x = case x of
|
||||
"ClearCommand" -> Just ClearCommand
|
||||
"ColorsCommand" -> Just ColorsCommand
|
||||
"CookiesCommand" -> Just CookiesCommand
|
||||
"DebugCommand" -> Just DebugCommand
|
||||
"FontCommand" -> Just FontCommand
|
||||
"HelloCommand" -> Just HelloCommand
|
||||
"HelpCommand" -> Just HelpCommand
|
||||
"PromptCommand" -> Just PromptCommand
|
||||
"ThemeCommand" -> Just ThemeCommand
|
||||
"TodoCommand" -> Just TodoCommand
|
||||
_ -> Nothing
|
||||
|
||||
universeCommand : List Command
|
||||
universeCommand = [ ClearCommand
|
||||
, ColorsCommand
|
||||
, CookiesCommand
|
||||
, DebugCommand
|
||||
, FontCommand
|
||||
, HelloCommand
|
||||
, HelpCommand
|
||||
, PromptCommand
|
||||
, ThemeCommand
|
||||
, TodoCommand ]
|
||||
|
||||
type alias CookiesKept =
|
||||
{ keepFont : Bool
|
||||
, keepPrompt : Bool
|
||||
, keepTheme : Bool
|
||||
}
|
||||
|
||||
type CoreColor
|
||||
= Red
|
||||
| Green
|
||||
| Yellow
|
||||
| Blue
|
||||
| Magenta
|
||||
| Cyan
|
||||
| BrightRed
|
||||
| BrightGreen
|
||||
| BrightYellow
|
||||
| BrightBlue
|
||||
| BrightMagenta
|
||||
| BrightCyan
|
||||
|
||||
showCoreColor : CoreColor -> String
|
||||
showCoreColor x = case x of
|
||||
Red -> "Red"
|
||||
Green -> "Green"
|
||||
Yellow -> "Yellow"
|
||||
Blue -> "Blue"
|
||||
Magenta -> "Magenta"
|
||||
Cyan -> "Cyan"
|
||||
BrightRed -> "BrightRed"
|
||||
BrightGreen -> "BrightGreen"
|
||||
BrightYellow -> "BrightYellow"
|
||||
BrightBlue -> "BrightBlue"
|
||||
BrightMagenta -> "BrightMagenta"
|
||||
BrightCyan -> "BrightCyan"
|
||||
|
||||
readCoreColor : String -> Maybe CoreColor
|
||||
readCoreColor x = case x of
|
||||
"Red" -> Just Red
|
||||
"Green" -> Just Green
|
||||
"Yellow" -> Just Yellow
|
||||
"Blue" -> Just Blue
|
||||
"Magenta" -> Just Magenta
|
||||
"Cyan" -> Just Cyan
|
||||
"BrightRed" -> Just BrightRed
|
||||
"BrightGreen" -> Just BrightGreen
|
||||
"BrightYellow" -> Just BrightYellow
|
||||
"BrightBlue" -> Just BrightBlue
|
||||
"BrightMagenta" -> Just BrightMagenta
|
||||
"BrightCyan" -> Just BrightCyan
|
||||
_ -> Nothing
|
||||
|
||||
universeCoreColor : List CoreColor
|
||||
universeCoreColor = [ Red
|
||||
, Green
|
||||
, Yellow
|
||||
, Blue
|
||||
, Magenta
|
||||
, Cyan
|
||||
, BrightRed
|
||||
, BrightGreen
|
||||
, BrightYellow
|
||||
, BrightBlue
|
||||
, BrightMagenta
|
||||
, BrightCyan ]
|
||||
|
||||
type alias Font =
|
||||
{ fontSize : Float
|
||||
}
|
||||
|
||||
type alias Input =
|
||||
{ command : Command
|
||||
, args : List String
|
||||
}
|
||||
|
||||
type alias Prompt =
|
||||
{ prompt : String
|
||||
}
|
||||
|
||||
type Theme
|
||||
= Pit
|
||||
| Dim
|
||||
| Sky
|
||||
| Sun
|
||||
|
||||
showTheme : Theme -> String
|
||||
showTheme x = case x of
|
||||
Pit -> "Pit"
|
||||
Dim -> "Dim"
|
||||
Sky -> "Sky"
|
||||
Sun -> "Sun"
|
||||
|
||||
readTheme : String -> Maybe Theme
|
||||
readTheme x = case x of
|
||||
"Pit" -> Just Pit
|
||||
"Dim" -> Just Dim
|
||||
"Sky" -> Just Sky
|
||||
"Sun" -> Just Sun
|
||||
_ -> Nothing
|
||||
|
||||
universeTheme : List Theme
|
||||
universeTheme = [Pit, Dim, Sky, Sun]
|
||||
|
||||
type ThemeColor
|
||||
= Background
|
||||
| Foreground
|
||||
| Cursor
|
||||
| Black
|
||||
| White
|
||||
| BrightBlack
|
||||
| BrightWhite
|
||||
|
||||
showThemeColor : ThemeColor -> String
|
||||
showThemeColor x = case x of
|
||||
Background -> "Background"
|
||||
Foreground -> "Foreground"
|
||||
Cursor -> "Cursor"
|
||||
Black -> "Black"
|
||||
White -> "White"
|
||||
BrightBlack -> "BrightBlack"
|
||||
BrightWhite -> "BrightWhite"
|
||||
|
||||
readThemeColor : String -> Maybe ThemeColor
|
||||
readThemeColor x = case x of
|
||||
"Background" -> Just Background
|
||||
"Foreground" -> Just Foreground
|
||||
"Cursor" -> Just Cursor
|
||||
"Black" -> Just Black
|
||||
"White" -> Just White
|
||||
"BrightBlack" -> Just BrightBlack
|
||||
"BrightWhite" -> Just BrightWhite
|
||||
_ -> Nothing
|
||||
|
||||
universeThemeColor : List ThemeColor
|
||||
universeThemeColor = [ Background
|
||||
, Foreground
|
||||
, Cursor
|
||||
, Black
|
||||
, White
|
||||
, BrightBlack
|
||||
, BrightWhite ]
|
1173
frontend/src/Main.elm
Executable file
1173
frontend/src/Main.elm
Executable file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue