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 .DS_Store
dist dist
elm-stuff/0.19.1 elm-stuff/0.19.1
example/elm-stuff/0.19.1
node_modules node_modules

View File

@ -2,8 +2,8 @@
> for building single page apps > 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", "type": "package",
"source-directories": [ "name": "ryannhg/elm-app",
"src", "summary": "a way to build single page apps with Elm",
"example", "license": "BSD-3-Clause",
"elm-stuff/.elm-spa" "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": { "dependencies": {
"direct": { "elm/browser": "1.0.0 <= v < 2.0.0",
"elm/browser": "1.0.2", "elm/core": "1.0.0 <= v < 2.0.0",
"elm/core": "1.0.2", "elm/html": "1.0.0 <= v < 2.0.0",
"elm/html": "1.0.0", "elm/url": "1.0.0 <= v < 2.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": { "test-dependencies": {}
"direct": {}, }
"indirect": {}
}
}

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,14 +10,14 @@ import Generated.Docs.Route
import Generated.Guide.Pages import Generated.Guide.Pages
import Generated.Guide.Route import Generated.Guide.Route
import Generated.Params as Params import Generated.Params as Params
import Generated.Route as Route exposing (Route(..)) import Generated.Route as Route exposing (Route)
import Layout as Layout import Layout as Layout
import Pages.Docs import Pages.Docs
import Pages.Guide import Pages.Guide
import Pages.NotFound import Pages.NotFound
import Pages.SignIn import Pages.SignIn
import Pages.Top import Pages.Top
import Utils.Page as Page exposing (Page) import Utils.Spa as Spa
type Model type Model
@ -40,9 +40,9 @@ type Msg
| Docs_Folder_Msg Generated.Docs.Pages.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 =
Page.layout Spa.layout
{ view = Layout.view { view = Layout.view
, recipe = , recipe =
{ init = init { init = init
@ -57,7 +57,7 @@ page =
type alias Recipe flags model msg appMsg = 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 = type alias Recipes msg =
@ -74,43 +74,43 @@ type alias Recipes msg =
recipes : Recipes msg recipes : Recipes msg
recipes = recipes =
{ top = { top =
Page.recipe Spa.recipe
{ page = Pages.Top.page { page = Pages.Top.page
, toModel = TopModel , toModel = TopModel
, toMsg = TopMsg , toMsg = TopMsg
} }
, docs = , docs =
Page.recipe Spa.recipe
{ page = Pages.Docs.page { page = Pages.Docs.page
, toModel = DocsModel , toModel = DocsModel
, toMsg = DocsMsg , toMsg = DocsMsg
} }
, notFound = , notFound =
Page.recipe Spa.recipe
{ page = Pages.NotFound.page { page = Pages.NotFound.page
, toModel = NotFoundModel , toModel = NotFoundModel
, toMsg = NotFoundMsg , toMsg = NotFoundMsg
} }
, signIn = , signIn =
Page.recipe Spa.recipe
{ page = Pages.SignIn.page { page = Pages.SignIn.page
, toModel = SignInModel , toModel = SignInModel
, toMsg = SignInMsg , toMsg = SignInMsg
} }
, guide = , guide =
Page.recipe Spa.recipe
{ page = Pages.Guide.page { page = Pages.Guide.page
, toModel = GuideModel , toModel = GuideModel
, toMsg = GuideMsg , toMsg = GuideMsg
} }
, guide_folder = , guide_folder =
Page.recipe Spa.recipe
{ page = Generated.Guide.Pages.page { page = Generated.Guide.Pages.page
, toModel = Guide_Folder_Model , toModel = Guide_Folder_Model
, toMsg = Guide_Folder_Msg , toMsg = Guide_Folder_Msg
} }
, docs_folder = , docs_folder =
Page.recipe Spa.recipe
{ page = Generated.Docs.Pages.page { page = Generated.Docs.Pages.page
, toModel = Docs_Folder_Model , toModel = Docs_Folder_Model
, toMsg = Docs_Folder_Msg , toMsg = Docs_Folder_Msg
@ -122,7 +122,7 @@ recipes =
-- INIT -- INIT
init : Route -> Page.Init Model Msg init : Route -> Spa.Init Model Msg
init route_ = init route_ =
case route_ of case route_ of
Route.Top flags -> Route.Top flags ->
@ -151,7 +151,7 @@ init route_ =
-- UPDATE -- UPDATE
update : Msg -> Model -> Page.Update Model Msg update : Msg -> Model -> Spa.Update Model Msg
update bigMsg bigModel = update bigMsg bigModel =
case ( bigMsg, bigModel ) of case ( bigMsg, bigModel ) of
( TopMsg msg, TopModel model ) -> ( TopMsg msg, TopModel model ) ->
@ -183,7 +183,7 @@ update bigMsg bigModel =
-- BUNDLE -- BUNDLE
bundle : Model -> Page.Bundle Msg msg bundle : Model -> Spa.Bundle Msg msg
bundle bigModel = bundle bigModel =
case bigModel of case bigModel of
TopModel model -> 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", "resolved": "https://registry.npmjs.org/crocks/-/crocks-0.12.1.tgz",
"integrity": "sha512-2qCRJwBmPlRQXzd50k9gt9PaItultOP8lj/cKSH2Eai9aeBuNqAnDuyolAm9TGn6Pw/4BgbxtPJLU1S+tQ4WMQ==" "integrity": "sha512-2qCRJwBmPlRQXzd50k9gt9PaItultOP8lj/cKSH2Eai9aeBuNqAnDuyolAm9TGn6Pw/4BgbxtPJLU1S+tQ4WMQ=="
}, },
"cross-Appwn": { "cross-spawn": {
"version": "5.0.1", "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=", "integrity": "sha1-o7uzAtsil8vqPATt82lB9GE6o5k=",
"requires": { "requires": {
"lru-cache": "^4.0.1", "lru-cache": "^4.0.1",
@ -306,7 +306,7 @@
"chokidar": "3.0.2", "chokidar": "3.0.2",
"commander": "2.17.1", "commander": "2.17.1",
"crocks": "0.12.1", "crocks": "0.12.1",
"cross-Appwn": "5.0.1", "cross-spawn": "5.0.1",
"elm-hot": "1.1.1", "elm-hot": "1.1.1",
"finalhandler": "1.1.2", "finalhandler": "1.1.2",
"http-proxy": "1.17.0", "http-proxy": "1.17.0",
@ -388,7 +388,7 @@
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
"requires": { "requires": {
"cross-Appwn": "^6.0.0", "cross-spawn": "^6.0.0",
"get-stream": "^4.0.0", "get-stream": "^4.0.0",
"is-stream": "^1.1.0", "is-stream": "^1.1.0",
"npm-run-path": "^2.0.0", "npm-run-path": "^2.0.0",
@ -397,9 +397,9 @@
"strip-eof": "^1.0.0" "strip-eof": "^1.0.0"
}, },
"dependencies": { "dependencies": {
"cross-Appwn": { "cross-spawn": {
"version": "6.0.5", "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==", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
"requires": { "requires": {
"nice-try": "^1.0.4", "nice-try": "^1.0.4",
@ -505,9 +505,9 @@
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
}, },
"fsevents": { "fsevents": {
"version": "2.1.1", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.1.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz",
"integrity": "sha512-4FRPXWETxtigtJW/gxzEDsX1LVbPAM93VleB83kZB+ellqbHMkyt2aJfuzNLRvFPnGi6bcE5SvfxgbXPeKteJw==", "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==",
"optional": true "optional": true
}, },
"get-caller-file": { "get-caller-file": {
@ -887,9 +887,9 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
}, },
"picomatch": { "picomatch": {
"version": "2.1.0", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.0.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.1.tgz",
"integrity": "sha512-uhnEDzAbrcJ8R3g2fANnSuXZMBtkpSjxTTgn2LeSiQlfmq72enQJWdQllXW24MBLYnA1SBD2vfvx2o0Zw3Ielw==" "integrity": "sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA=="
}, },
"pseudomap": { "pseudomap": {
"version": "1.0.2", "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.Pages as Pages
import Generated.Routes as Routes import Generated.Routes as Routes
import Global import Global
import Pages.NotFound
main : App.Program Global.Flags Global.Model Global.Msg Pages.Model Pages.Msg 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 Components.Hero
import Element exposing (..) import Element exposing (..)
import Generated.Params as Params import Generated.Params as Params
import Utils.Page exposing (Page) import Utils.Spa exposing (Page)
type alias Model = type alias Model =

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,23 +1,14 @@
{ {
"name": "elm-spa-elm-ui", "name": "elm-spa",
"version": "1.0.0", "version": "1.0.0",
"description": "elm-live running in the browser!", "description": "",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"start": "npm run dev", "start": "npm run dev",
"dev": "npm run elm:spa:build && npm run elm:spa:watch & npm run elm:live", "example": "npm run dev",
"build": "npm run elm:spa:build && npm run elm:compile", "dev": "(cd example && npm install && npm run dev)"
"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"
}, },
"dependencies": {},
"devDependencies": {}, "devDependencies": {},
"keywords": [] "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 module App.Types exposing
( Bundle ( Page, Recipe
, Init , Init, Update, Bundle
, Page
, Recipe
, Update
) )
{-|
## 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 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 = 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 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 = 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 Page.Recipe pageRoute pageModel pageMsg layoutModel layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg
{-| Init
-}
type alias Init layoutModel layoutMsg globalModel globalMsg = type alias Init layoutModel layoutMsg globalModel globalMsg =
Page.Init layoutModel layoutMsg globalModel globalMsg Page.Init layoutModel layoutMsg globalModel globalMsg
{-| Update
-}
type alias Update layoutModel layoutMsg globalModel globalMsg = type alias Update layoutModel layoutMsg globalModel globalMsg =
Page.Update layoutModel layoutMsg globalModel globalMsg Page.Update layoutModel layoutMsg globalModel globalMsg
{-| Bundle
-}
type alias Bundle layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg = type alias Bundle layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg =
Page.Bundle layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg Page.Bundle layoutMsg uiLayoutMsg globalModel globalMsg msg uiMsg