start to reorganize the repo to support docs

This commit is contained in:
Ryan Haskell-Glatz 2019-11-11 15:35:15 -08:00
parent 66607e8a38
commit 1fc64ccfb7
62 changed files with 266 additions and 146 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
dist
elm-stuff/0.19.1
example/elm-stuff/0.19.1
node_modules

View File

@ -2,8 +2,8 @@
> for building single page apps
## local development
## run the example!
```
npm install && npm run dev
npm run example
```

View File

@ -1,29 +1,20 @@
{
"type": "application",
"source-directories": [
"src",
"example",
"elm-stuff/.elm-spa"
"type": "package",
"name": "ryannhg/elm-app",
"summary": "a way to build single page apps with Elm",
"license": "BSD-3-Clause",
"version": "1.0.0",
"exposed-modules": [
"App",
"App.Page",
"App.Types"
],
"elm-version": "0.19.1",
"elm-version": "0.19.0 <= v < 0.20.0",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.2",
"elm/html": "1.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0",
"elm-explorations/markdown": "1.0.0",
"mdgriffith/elm-ui": "1.1.5",
"ryannhg/elm-spa": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
"elm/browser": "1.0.0 <= v < 2.0.0",
"elm/core": "1.0.0 <= v < 2.0.0",
"elm/html": "1.0.0 <= v < 2.0.0",
"elm/url": "1.0.0 <= v < 2.0.0"
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
"test-dependencies": {}
}

View File

@ -1,5 +1,10 @@
# src
# elm-spa/example
> what a project might look like!
```elm
## running things
```
npm install
npm run dev
```

View File

@ -6,11 +6,11 @@ module Generated.Docs.Pages exposing
import App.Page
import Generated.Docs.Params as Params
import Generated.Docs.Route as Route exposing (Route(..))
import Generated.Docs.Route as Route exposing (Route)
import Layouts.Docs as Layout
import Pages.Docs.Dynamic
import Pages.Docs.Static
import Utils.Page as Page exposing (Page)
import Utils.Spa as Spa exposing (Page)
type Model
@ -25,7 +25,7 @@ type Msg
page : Page Route Model Msg layoutModel layoutMsg appMsg
page =
Page.layout
Spa.layout
{ view = Layout.view
, recipe =
{ init = init
@ -40,7 +40,7 @@ page =
type alias Recipe flags model msg appMsg =
Page.Recipe flags model msg Model Msg appMsg
Spa.Recipe flags model msg Model Msg appMsg
type alias Recipes msg =
@ -52,13 +52,13 @@ type alias Recipes msg =
recipes : Recipes msg
recipes =
{ dynamic =
Page.recipe
Spa.recipe
{ page = Pages.Docs.Dynamic.page
, toModel = DynamicModel
, toMsg = DynamicMsg
}
, static =
Page.recipe
Spa.recipe
{ page = Pages.Docs.Static.page
, toModel = StaticModel
, toMsg = StaticMsg
@ -70,7 +70,7 @@ recipes =
-- INIT
init : Route -> Page.Init Model Msg
init : Route -> Spa.Init Model Msg
init route =
case route of
Route.Dynamic _ flags ->
@ -84,7 +84,7 @@ init route =
-- UPDATE
update : Msg -> Model -> Page.Update Model Msg
update : Msg -> Model -> Spa.Update Model Msg
update bigMsg bigModel =
case ( bigMsg, bigModel ) of
( DynamicMsg msg, DynamicModel model ) ->
@ -101,7 +101,7 @@ update bigMsg bigModel =
-- BUNDLE
bundle : Model -> Page.Bundle Msg msg
bundle : Model -> Spa.Bundle Msg msg
bundle bigModel =
case bigModel of
DynamicModel model ->

View File

@ -6,10 +6,10 @@ module Generated.Guide.Dynamic.Dynamic.Pages exposing
import App.Page
import Generated.Guide.Dynamic.Dynamic.Params as Params
import Generated.Guide.Dynamic.Dynamic.Route as Route exposing (Route(..))
import Generated.Guide.Dynamic.Dynamic.Route as Route exposing (Route)
import Layouts.Guide.Dynamic.Dynamic as Layout
import Pages.Guide.Dynamic.Dynamic.Top
import Utils.Page as Page exposing (Page)
import Utils.Spa as Spa exposing (Page)
type Model
@ -22,7 +22,7 @@ type Msg
page : Page Route Model Msg layoutModel layoutMsg appMsg
page =
Page.layout
Spa.layout
{ view = Layout.view
, recipe =
{ init = init
@ -37,7 +37,7 @@ page =
type alias Recipe flags model msg appMsg =
Page.Recipe flags model msg Model Msg appMsg
Spa.Recipe flags model msg Model Msg appMsg
type alias Recipes msg =
@ -48,7 +48,7 @@ type alias Recipes msg =
recipes : Recipes msg
recipes =
{ top =
Page.recipe
Spa.recipe
{ page = Pages.Guide.Dynamic.Dynamic.Top.page
, toModel = TopModel
, toMsg = TopMsg
@ -60,7 +60,7 @@ recipes =
-- INIT
init : Route -> Page.Init Model Msg
init : Route -> Spa.Init Model Msg
init route =
case route of
Route.Top flags ->
@ -71,7 +71,7 @@ init route =
-- UPDATE
update : Msg -> Model -> Page.Update Model Msg
update : Msg -> Model -> Spa.Update Model Msg
update bigMsg bigModel =
case ( bigMsg, bigModel ) of
( TopMsg msg, TopModel model ) ->
@ -82,7 +82,7 @@ update bigMsg bigModel =
-- BUNDLE
bundle : Model -> Page.Bundle Msg msg
bundle : Model -> Spa.Bundle Msg msg
bundle bigModel =
case bigModel of
TopModel model ->

View File

@ -6,10 +6,10 @@ module Generated.Guide.Dynamic.Faq.Pages exposing
import App.Page
import Generated.Guide.Dynamic.Faq.Params as Params
import Generated.Guide.Dynamic.Faq.Route as Route exposing (Route(..))
import Generated.Guide.Dynamic.Faq.Route as Route exposing (Route)
import Layouts.Guide.Dynamic.Faq as Layout
import Pages.Guide.Dynamic.Faq.Top
import Utils.Page as Page exposing (Page)
import Utils.Spa as Spa exposing (Page)
type Model
@ -22,7 +22,7 @@ type Msg
page : Page Route Model Msg layoutModel layoutMsg appMsg
page =
Page.layout
Spa.layout
{ view = Layout.view
, recipe =
{ init = init
@ -37,7 +37,7 @@ page =
type alias Recipe flags model msg appMsg =
Page.Recipe flags model msg Model Msg appMsg
Spa.Recipe flags model msg Model Msg appMsg
type alias Recipes msg =
@ -48,7 +48,7 @@ type alias Recipes msg =
recipes : Recipes msg
recipes =
{ top =
Page.recipe
Spa.recipe
{ page = Pages.Guide.Dynamic.Faq.Top.page
, toModel = TopModel
, toMsg = TopMsg
@ -60,7 +60,7 @@ recipes =
-- INIT
init : Route -> Page.Init Model Msg
init : Route -> Spa.Init Model Msg
init route =
case route of
Route.Top flags ->
@ -71,7 +71,7 @@ init route =
-- UPDATE
update : Msg -> Model -> Page.Update Model Msg
update : Msg -> Model -> Spa.Update Model Msg
update bigMsg bigModel =
case ( bigMsg, bigModel ) of
( TopMsg msg, TopModel model ) ->
@ -82,7 +82,7 @@ update bigMsg bigModel =
-- BUNDLE
bundle : Model -> Page.Bundle Msg msg
bundle : Model -> Spa.Bundle Msg msg
bundle bigModel =
case bigModel of
TopModel model ->

View File

@ -15,7 +15,7 @@ import Layouts.Guide.Dynamic as Layout
import Pages.Guide.Dynamic.Dynamic
import Pages.Guide.Dynamic.Intro
import Pages.Guide.Dynamic.Other
import Utils.Page as Page exposing (Page)
import Utils.Spa as Spa exposing (Page)
type Model
@ -36,7 +36,7 @@ type Msg
page : Page Route Model Msg layoutModel layoutMsg appMsg
page =
Page.layout
Spa.layout
{ view = Layout.view
, recipe =
{ init = init
@ -51,7 +51,7 @@ page =
type alias Recipe flags model msg appMsg =
Page.Recipe flags model msg Model Msg appMsg
Spa.Recipe flags model msg Model Msg appMsg
type alias Recipes msg =
@ -66,31 +66,31 @@ type alias Recipes msg =
recipes : Recipes msg
recipes =
{ intro =
Page.recipe
Spa.recipe
{ page = Pages.Guide.Dynamic.Intro.page
, toModel = IntroModel
, toMsg = IntroMsg
}
, other =
Page.recipe
Spa.recipe
{ page = Pages.Guide.Dynamic.Other.page
, toModel = OtherModel
, toMsg = OtherMsg
}
, dynamic =
Page.recipe
Spa.recipe
{ page = Pages.Guide.Dynamic.Dynamic.page
, toModel = DynamicModel
, toMsg = DynamicMsg
}
, faq_folder =
Page.recipe
Spa.recipe
{ page = Generated.Guide.Dynamic.Faq.Pages.page
, toModel = Faq_FolderModel
, toMsg = Faq_FolderMsg
}
, dynamic_folder =
Page.recipe
Spa.recipe
{ page = Generated.Guide.Dynamic.Dynamic.Pages.page
, toModel = Dynamic_FolderModel
, toMsg = Dynamic_FolderMsg
@ -102,7 +102,7 @@ recipes =
-- INIT
init : Route -> Page.Init Model Msg
init : Route -> Spa.Init Model Msg
init route =
case route of
Route.Intro flags ->
@ -125,7 +125,7 @@ init route =
-- UPDATE
update : Msg -> Model -> Page.Update Model Msg
update : Msg -> Model -> Spa.Update Model Msg
update bigMsg bigModel =
case ( bigMsg, bigModel ) of
( IntroMsg msg, IntroModel model ) ->
@ -151,7 +151,7 @@ update bigMsg bigModel =
-- BUNDLE
bundle : Model -> Page.Bundle Msg msg
bundle : Model -> Spa.Bundle Msg msg
bundle bigModel =
case bigModel of
IntroModel model ->

View File

@ -13,7 +13,7 @@ import Layouts.Guide as Layout
import Pages.Guide.Elm
import Pages.Guide.ElmSpa
import Pages.Guide.Programming
import Utils.Page as Page exposing (Page)
import Utils.Spa as Spa exposing (Page)
type Model
@ -32,7 +32,7 @@ type Msg
page : Page Route Model Msg layoutModel layoutMsg appMsg
page =
Page.layout
Spa.layout
{ view = Layout.view
, recipe =
{ init = init
@ -47,7 +47,7 @@ page =
type alias Recipe flags model msg appMsg =
Page.Recipe flags model msg Model Msg appMsg
Spa.Recipe flags model msg Model Msg appMsg
type alias Recipes msg =
@ -61,25 +61,25 @@ type alias Recipes msg =
recipes : Recipes msg
recipes =
{ elm =
Page.recipe
Spa.recipe
{ page = Pages.Guide.Elm.page
, toModel = ElmModel
, toMsg = ElmMsg
}
, elmApp =
Page.recipe
Spa.recipe
{ page = Pages.Guide.ElmSpa.page
, toModel = ElmSpaModel
, toMsg = ElmSpaMsg
}
, programming =
Page.recipe
Spa.recipe
{ page = Pages.Guide.Programming.page
, toModel = ProgrammingModel
, toMsg = ProgrammingMsg
}
, dynamic_folder =
Page.recipe
Spa.recipe
{ page = Generated.Guide.Dynamic.Pages.page
, toModel = Dynamic_Folder_Model
, toMsg = Dynamic_Folder_Msg
@ -91,7 +91,7 @@ recipes =
-- INIT
init : Route -> Page.Init Model Msg
init : Route -> Spa.Init Model Msg
init route =
case route of
Route.Elm flags ->
@ -111,7 +111,7 @@ init route =
-- UPDATE
update : Msg -> Model -> Page.Update Model Msg
update : Msg -> Model -> Spa.Update Model Msg
update bigMsg bigModel =
case ( bigMsg, bigModel ) of
( ElmMsg msg, ElmModel model ) ->
@ -134,7 +134,7 @@ update bigMsg bigModel =
-- BUNDLE
bundle : Model -> Page.Bundle Msg msg
bundle : Model -> Spa.Bundle Msg msg
bundle bigModel =
case bigModel of
ElmModel model ->

View File

@ -10,14 +10,14 @@ import Generated.Docs.Route
import Generated.Guide.Pages
import Generated.Guide.Route
import Generated.Params as Params
import Generated.Route as Route exposing (Route(..))
import Generated.Route as Route exposing (Route)
import Layout as Layout
import Pages.Docs
import Pages.Guide
import Pages.NotFound
import Pages.SignIn
import Pages.Top
import Utils.Page as Page exposing (Page)
import Utils.Spa as Spa
type Model
@ -40,9 +40,9 @@ type Msg
| Docs_Folder_Msg Generated.Docs.Pages.Msg
page : Page Route Model Msg layoutModel layoutMsg appMsg
page : Spa.Page Route Model Msg layoutModel layoutMsg appMsg
page =
Page.layout
Spa.layout
{ view = Layout.view
, recipe =
{ init = init
@ -57,7 +57,7 @@ page =
type alias Recipe flags model msg appMsg =
Page.Recipe flags model msg Model Msg appMsg
Spa.Recipe flags model msg Model Msg appMsg
type alias Recipes msg =
@ -74,43 +74,43 @@ type alias Recipes msg =
recipes : Recipes msg
recipes =
{ top =
Page.recipe
Spa.recipe
{ page = Pages.Top.page
, toModel = TopModel
, toMsg = TopMsg
}
, docs =
Page.recipe
Spa.recipe
{ page = Pages.Docs.page
, toModel = DocsModel
, toMsg = DocsMsg
}
, notFound =
Page.recipe
Spa.recipe
{ page = Pages.NotFound.page
, toModel = NotFoundModel
, toMsg = NotFoundMsg
}
, signIn =
Page.recipe
Spa.recipe
{ page = Pages.SignIn.page
, toModel = SignInModel
, toMsg = SignInMsg
}
, guide =
Page.recipe
Spa.recipe
{ page = Pages.Guide.page
, toModel = GuideModel
, toMsg = GuideMsg
}
, guide_folder =
Page.recipe
Spa.recipe
{ page = Generated.Guide.Pages.page
, toModel = Guide_Folder_Model
, toMsg = Guide_Folder_Msg
}
, docs_folder =
Page.recipe
Spa.recipe
{ page = Generated.Docs.Pages.page
, toModel = Docs_Folder_Model
, toMsg = Docs_Folder_Msg
@ -122,7 +122,7 @@ recipes =
-- INIT
init : Route -> Page.Init Model Msg
init : Route -> Spa.Init Model Msg
init route_ =
case route_ of
Route.Top flags ->
@ -151,7 +151,7 @@ init route_ =
-- UPDATE
update : Msg -> Model -> Page.Update Model Msg
update : Msg -> Model -> Spa.Update Model Msg
update bigMsg bigModel =
case ( bigMsg, bigModel ) of
( TopMsg msg, TopModel model ) ->
@ -183,7 +183,7 @@ update bigMsg bigModel =
-- BUNDLE
bundle : Model -> Page.Bundle Msg msg
bundle : Model -> Spa.Bundle Msg msg
bundle bigModel =
case bigModel of
TopModel model ->

29
example/elm.json Normal file
View File

@ -0,0 +1,29 @@
{
"type": "application",
"source-directories": [
"src",
"../src",
"elm-stuff/.elm-spa"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.2",
"elm/html": "1.0.0",
"elm/json": "1.1.3",
"elm/url": "1.0.0",
"elm-explorations/markdown": "1.0.0",
"mdgriffith/elm-ui": "1.1.5",
"ryannhg/elm-spa": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

View File

@ -210,9 +210,9 @@
"resolved": "https://registry.npmjs.org/crocks/-/crocks-0.12.1.tgz",
"integrity": "sha512-2qCRJwBmPlRQXzd50k9gt9PaItultOP8lj/cKSH2Eai9aeBuNqAnDuyolAm9TGn6Pw/4BgbxtPJLU1S+tQ4WMQ=="
},
"cross-Appwn": {
"cross-spawn": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/cross-Appwn/-/cross-Appwn-5.0.1.tgz",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.0.1.tgz",
"integrity": "sha1-o7uzAtsil8vqPATt82lB9GE6o5k=",
"requires": {
"lru-cache": "^4.0.1",
@ -306,7 +306,7 @@
"chokidar": "3.0.2",
"commander": "2.17.1",
"crocks": "0.12.1",
"cross-Appwn": "5.0.1",
"cross-spawn": "5.0.1",
"elm-hot": "1.1.1",
"finalhandler": "1.1.2",
"http-proxy": "1.17.0",
@ -388,7 +388,7 @@
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
"requires": {
"cross-Appwn": "^6.0.0",
"cross-spawn": "^6.0.0",
"get-stream": "^4.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
@ -397,9 +397,9 @@
"strip-eof": "^1.0.0"
},
"dependencies": {
"cross-Appwn": {
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-Appwn/-/cross-Appwn-6.0.5.tgz",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
"requires": {
"nice-try": "^1.0.4",
@ -505,9 +505,9 @@
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fsevents": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.1.tgz",
"integrity": "sha512-4FRPXWETxtigtJW/gxzEDsX1LVbPAM93VleB83kZB+ellqbHMkyt2aJfuzNLRvFPnGi6bcE5SvfxgbXPeKteJw==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz",
"integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==",
"optional": true
},
"get-caller-file": {
@ -887,9 +887,9 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"picomatch": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.0.tgz",
"integrity": "sha512-uhnEDzAbrcJ8R3g2fANnSuXZMBtkpSjxTTgn2LeSiQlfmq72enQJWdQllXW24MBLYnA1SBD2vfvx2o0Zw3Ielw=="
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.1.tgz",
"integrity": "sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA=="
},
"pseudomap": {
"version": "1.0.2",

23
example/package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "your-elm-spa",
"version": "1.0.0",
"description": "an example for elm-spa!",
"main": "src/index.js",
"scripts": {
"start": "npm run dev",
"dev": "npm run elm:spa:build && npm run elm:spa:watch & npm run elm:live",
"build": "npm run elm:spa:build && npm run elm:compile",
"elm:compile": "elm make src/Main.elm --output=dist/elm.compiled.js --optimize",
"elm:live": "elm-live src/Main.elm --start-page=index.html --open --pushstate --port=1234 -- --output=dist/elm.compiled.js --debug",
"elm:spa:build": "echo '🌳 elm-spa build .'",
"elm:spa:watch": "SHELL=/bin/bash chokidar src -c 'npm run elm:spa:build'"
},
"dependencies": {
"chokidar-cli": "2.1.0",
"elm": "0.19.1-3",
"elm-live": "4.0.1",
"elm-spa": "1.1.0"
},
"devDependencies": {},
"keywords": []
}

View File

@ -5,7 +5,6 @@ import Element
import Generated.Pages as Pages
import Generated.Routes as Routes
import Global
import Pages.NotFound
main : App.Program Global.Flags Global.Model Global.Msg Pages.Model Pages.Msg

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -5,7 +5,7 @@ import Components.Hero
import Element exposing (..)
import Generated.Docs.Params as Params
import Global
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Docs.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Guide.Dynamic.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Guide.Dynamic.Dynamic.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Guide.Dynamic.Faq.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Guide.Dynamic.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Guide.Dynamic.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Guide.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Guide.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Guide.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -4,7 +4,7 @@ import App.Page
import Components.Hero
import Element exposing (..)
import Generated.Params as Params
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -12,7 +12,7 @@ import Global
import Html exposing (Html)
import Html.Attributes as Attr
import Html.Events as Events
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -8,7 +8,7 @@ import Element exposing (..)
import Generated.Params as Params
import Html.Attributes as Attr
import Ports
import Utils.Page exposing (Page)
import Utils.Spa exposing (Page)
type alias Model =

View File

@ -1,4 +1,4 @@
module Utils.Page exposing
module Utils.Spa exposing
( Bundle
, Init
, Page

View File

@ -1,23 +1,14 @@
{
"name": "elm-spa-elm-ui",
"name": "elm-spa",
"version": "1.0.0",
"description": "elm-live running in the browser!",
"description": "",
"main": "src/index.js",
"scripts": {
"start": "npm run dev",
"dev": "npm run elm:spa:build && npm run elm:spa:watch & npm run elm:live",
"build": "npm run elm:spa:build && npm run elm:compile",
"elm:compile": "elm make example/Main.elm --output=dist/elm.compiled.js --optimize",
"elm:live": "elm-live example/Main.elm --start-page=index.html --pushstate --port=8080 -- --output=dist/elm.compiled.js --debug",
"elm:spa:build": "echo '🌳 elm-spa build .'",
"elm:spa:watch": "SHELL=/bin/bash chokidar './example' -c 'npm run elm:spa:build'"
},
"dependencies": {
"chokidar-cli": "2.1.0",
"elm": "0.19.1-3",
"elm-live": "4.0.1",
"elm-spa": "1.1.0"
"example": "npm run dev",
"dev": "(cd example && npm install && npm run dev)"
},
"dependencies": {},
"devDependencies": {},
"keywords": []
}

View File

@ -1,8 +0,0 @@
{
"infiniteLoopProtection": true,
"hardReloadOnChange": false,
"view": "browser",
"container": {
"port": 8080
}
}

View File

@ -1,29 +1,118 @@
module App.Types exposing
( Bundle
, Init
, Page
, Recipe
, Update
( Page, Recipe
, Init, Update, Bundle
)
{-|
## Types so spooky, they got their own module! 👻
This module is all about exposing the types that `ryannhg/elm-app` uses
under the hood.
Because so much of your app is defined outside of this package, we see
a **lot of generic types**.
### Don't be spooked!
In practice, we usually handle this with a `Utils/Page.elm` file that
creates less generic `type alias` for use in your app!
module Utils.Spa exposing
( Bundle
, Init
, Page
, Recipe
, Update
, layout
, recipe
)
import App.Page
import App.Types
import Element exposing (Element)
import Global
type alias Page flags model msg layoutModel layoutMsg appMsg =
App.Types.Page flags model msg (Element msg) layoutModel layoutMsg (Element layoutMsg) Global.Model Global.Msg appMsg (Element appMsg)
type alias Recipe flags model msg layoutModel layoutMsg appMsg =
App.Types.Recipe flags model msg layoutModel layoutMsg (Element layoutMsg) Global.Model Global.Msg appMsg (Element appMsg)
type alias Init model msg =
App.Types.Init model msg Global.Model Global.Msg
type alias Update model msg =
App.Types.Update model msg Global.Model Global.Msg
type alias Bundle msg appMsg =
App.Types.Bundle msg (Element msg) Global.Model Global.Msg appMsg (Element appMsg)
layout config =
App.Page.layout
{ map = Element.map
, view = config.view
, recipe = config.recipe
}
recipe config =
App.Page.recipe
{ map = Element.map
, page = config.page
, toModel = config.toModel
, toMsg = config.toMsg
}
@docs Page, Recipe
@docs Init, Update, Bundle
-}
import Internals.Page as Page
{-| This type alias should be used in all `src/Pages` files.
module Pages.Example exposing
( page
, -- ...
)
import Utils.Spa as Spa
page : Spa.Page Params.Example Model Msg model msg appMsg
page =
App.Page.static
-- ...
-}
type alias Page pageRoute pageModel pageMsg uiPageMsg layoutModel layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg =
Page.Page pageRoute pageModel pageMsg uiPageMsg layoutModel layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg
{-| Recipe
-}
type alias Recipe pageRoute pageModel pageMsg layoutModel layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg =
Page.Recipe pageRoute pageModel pageMsg layoutModel layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg
{-| Init
-}
type alias Init layoutModel layoutMsg globalModel globalMsg =
Page.Init layoutModel layoutMsg globalModel globalMsg
{-| Update
-}
type alias Update layoutModel layoutMsg globalModel globalMsg =
Page.Update layoutModel layoutMsg globalModel globalMsg
{-| Bundle
-}
type alias Bundle layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg =
Page.Bundle layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg