From 1fc64ccfb712d25bbaa3605b450e58c0ee8e16fb Mon Sep 17 00:00:00 2001 From: Ryan Haskell-Glatz Date: Mon, 11 Nov 2019 15:35:15 -0800 Subject: [PATCH] start to reorganize the repo to support docs --- .gitignore | 1 + README.md | 4 +- elm.json | 41 +++----- example/README.md | 9 +- .../.elm-spa/Generated/Docs/Pages.elm | 18 ++-- .../.elm-spa/Generated/Docs/Params.elm | 0 .../.elm-spa/Generated/Docs/Route.elm | 0 .../Generated/Guide/Dynamic/Dynamic/Pages.elm | 16 +-- .../Guide/Dynamic/Dynamic/Params.elm | 0 .../Generated/Guide/Dynamic/Dynamic/Route.elm | 0 .../Generated/Guide/Dynamic/Faq/Pages.elm | 16 +-- .../Generated/Guide/Dynamic/Faq/Params.elm | 0 .../Generated/Guide/Dynamic/Faq/Route.elm | 0 .../Generated/Guide/Dynamic/Pages.elm | 22 ++--- .../Generated/Guide/Dynamic/Params.elm | 0 .../Generated/Guide/Dynamic/Route.elm | 0 .../.elm-spa/Generated/Guide/Pages.elm | 20 ++-- .../.elm-spa/Generated/Guide/Params.elm | 0 .../.elm-spa/Generated/Guide/Route.elm | 0 .../elm-stuff}/.elm-spa/Generated/Pages.elm | 30 +++--- .../elm-stuff}/.elm-spa/Generated/Params.elm | 0 .../elm-stuff}/.elm-spa/Generated/Route.elm | 0 .../elm-stuff}/.elm-spa/Generated/Routes.elm | 0 .../elm-stuff}/.elm-spa/README.md | 0 example/elm.json | 29 ++++++ index.html => example/index.html | 0 .../package-lock.json | 24 ++--- example/package.json | 23 +++++ {public => example/public}/ports.js | 0 {public => example/public}/styles.css | 0 example/{ => src}/Components/Button.elm | 0 example/{ => src}/Components/Hero.elm | 0 example/{ => src}/Components/Section.elm | 0 example/{ => src}/Components/Styles.elm | 0 example/{ => src}/Global.elm | 0 example/{ => src}/Layout.elm | 0 example/{ => src}/Layouts/Docs.elm | 0 example/{ => src}/Layouts/Guide.elm | 0 example/{ => src}/Layouts/Guide/Dynamic.elm | 0 .../Layouts/Guide/Dynamic/Dynamic.elm | 0 .../{ => src}/Layouts/Guide/Dynamic/Faq.elm | 0 example/{ => src}/Main.elm | 1 - example/{ => src}/Pages/Docs.elm | 2 +- example/{ => src}/Pages/Docs/Dynamic.elm | 2 +- example/{ => src}/Pages/Docs/Static.elm | 2 +- example/{ => src}/Pages/Guide.elm | 2 +- .../{ => src}/Pages/Guide/Dynamic/Dynamic.elm | 2 +- .../Pages/Guide/Dynamic/Dynamic/Top.elm | 2 +- .../{ => src}/Pages/Guide/Dynamic/Faq/Top.elm | 2 +- .../{ => src}/Pages/Guide/Dynamic/Intro.elm | 2 +- .../{ => src}/Pages/Guide/Dynamic/Other.elm | 2 +- example/{ => src}/Pages/Guide/Elm.elm | 2 +- example/{ => src}/Pages/Guide/ElmSpa.elm | 2 +- example/{ => src}/Pages/Guide/Programming.elm | 2 +- example/{ => src}/Pages/NotFound.elm | 2 +- example/{ => src}/Pages/SignIn.elm | 2 +- example/{ => src}/Pages/Top.elm | 2 +- example/{ => src}/Ports.elm | 0 example/{Utils/Page.elm => src/Utils/Spa.elm} | 2 +- package.json | 19 +--- sandbox.config.json | 8 -- src/App/Types.elm | 99 ++++++++++++++++++- 62 files changed, 266 insertions(+), 146 deletions(-) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Docs/Pages.elm (85%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Docs/Params.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Docs/Route.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Dynamic/Pages.elm (84%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Dynamic/Params.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Dynamic/Route.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Faq/Pages.elm (84%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Faq/Params.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Faq/Route.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Pages.elm (92%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Params.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Dynamic/Route.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Pages.elm (91%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Params.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Guide/Route.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Pages.elm (90%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Params.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Route.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/Generated/Routes.elm (100%) rename {elm-stuff => example/elm-stuff}/.elm-spa/README.md (100%) create mode 100644 example/elm.json rename index.html => example/index.html (100%) rename package-lock.json => example/package-lock.json (98%) create mode 100644 example/package.json rename {public => example/public}/ports.js (100%) rename {public => example/public}/styles.css (100%) rename example/{ => src}/Components/Button.elm (100%) rename example/{ => src}/Components/Hero.elm (100%) rename example/{ => src}/Components/Section.elm (100%) rename example/{ => src}/Components/Styles.elm (100%) rename example/{ => src}/Global.elm (100%) rename example/{ => src}/Layout.elm (100%) rename example/{ => src}/Layouts/Docs.elm (100%) rename example/{ => src}/Layouts/Guide.elm (100%) rename example/{ => src}/Layouts/Guide/Dynamic.elm (100%) rename example/{ => src}/Layouts/Guide/Dynamic/Dynamic.elm (100%) rename example/{ => src}/Layouts/Guide/Dynamic/Faq.elm (100%) rename example/{ => src}/Main.elm (96%) rename example/{ => src}/Pages/Docs.elm (95%) rename example/{ => src}/Pages/Docs/Dynamic.elm (97%) rename example/{ => src}/Pages/Docs/Static.elm (95%) rename example/{ => src}/Pages/Guide.elm (96%) rename example/{ => src}/Pages/Guide/Dynamic/Dynamic.elm (96%) rename example/{ => src}/Pages/Guide/Dynamic/Dynamic/Top.elm (96%) rename example/{ => src}/Pages/Guide/Dynamic/Faq/Top.elm (96%) rename example/{ => src}/Pages/Guide/Dynamic/Intro.elm (96%) rename example/{ => src}/Pages/Guide/Dynamic/Other.elm (96%) rename example/{ => src}/Pages/Guide/Elm.elm (94%) rename example/{ => src}/Pages/Guide/ElmSpa.elm (94%) rename example/{ => src}/Pages/Guide/Programming.elm (94%) rename example/{ => src}/Pages/NotFound.elm (95%) rename example/{ => src}/Pages/SignIn.elm (99%) rename example/{ => src}/Pages/Top.elm (98%) rename example/{ => src}/Ports.elm (100%) rename example/{Utils/Page.elm => src/Utils/Spa.elm} (97%) delete mode 100644 sandbox.config.json diff --git a/.gitignore b/.gitignore index 088b52a..39bedb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store dist elm-stuff/0.19.1 +example/elm-stuff/0.19.1 node_modules \ No newline at end of file diff --git a/README.md b/README.md index 7bda966..e261c57 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ > for building single page apps -## local development +## run the example! ``` -npm install && npm run dev +npm run example ``` diff --git a/elm.json b/elm.json index cdddb6f..0ac93ab 100644 --- a/elm.json +++ b/elm.json @@ -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": {} +} \ No newline at end of file diff --git a/example/README.md b/example/README.md index 8b5893d..72e864c 100644 --- a/example/README.md +++ b/example/README.md @@ -1,5 +1,10 @@ -# src +# elm-spa/example +> what a project might look like! -```elm + +## running things ``` +npm install +npm run dev +``` \ No newline at end of file diff --git a/elm-stuff/.elm-spa/Generated/Docs/Pages.elm b/example/elm-stuff/.elm-spa/Generated/Docs/Pages.elm similarity index 85% rename from elm-stuff/.elm-spa/Generated/Docs/Pages.elm rename to example/elm-stuff/.elm-spa/Generated/Docs/Pages.elm index b3b8355..582910d 100644 --- a/elm-stuff/.elm-spa/Generated/Docs/Pages.elm +++ b/example/elm-stuff/.elm-spa/Generated/Docs/Pages.elm @@ -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 -> diff --git a/elm-stuff/.elm-spa/Generated/Docs/Params.elm b/example/elm-stuff/.elm-spa/Generated/Docs/Params.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Docs/Params.elm rename to example/elm-stuff/.elm-spa/Generated/Docs/Params.elm diff --git a/elm-stuff/.elm-spa/Generated/Docs/Route.elm b/example/elm-stuff/.elm-spa/Generated/Docs/Route.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Docs/Route.elm rename to example/elm-stuff/.elm-spa/Generated/Docs/Route.elm diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Pages.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Pages.elm similarity index 84% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Pages.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Pages.elm index 199029f..f3af745 100644 --- a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Pages.elm +++ b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Pages.elm @@ -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 -> diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Params.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Params.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Params.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Params.elm diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Route.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Route.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Route.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Dynamic/Route.elm diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Pages.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Pages.elm similarity index 84% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Pages.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Pages.elm index 9cd043e..695e7fa 100644 --- a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Pages.elm +++ b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Pages.elm @@ -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 -> diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Params.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Params.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Params.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Params.elm diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Route.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Route.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Route.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Faq/Route.elm diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Pages.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Pages.elm similarity index 92% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Pages.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Pages.elm index d23c520..594545e 100644 --- a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Pages.elm +++ b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Pages.elm @@ -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 -> diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Params.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Params.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Params.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Params.elm diff --git a/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Route.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Route.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Guide/Dynamic/Route.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Dynamic/Route.elm diff --git a/elm-stuff/.elm-spa/Generated/Guide/Pages.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Pages.elm similarity index 91% rename from elm-stuff/.elm-spa/Generated/Guide/Pages.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Pages.elm index 03daa93..3ca9ac0 100644 --- a/elm-stuff/.elm-spa/Generated/Guide/Pages.elm +++ b/example/elm-stuff/.elm-spa/Generated/Guide/Pages.elm @@ -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 -> diff --git a/elm-stuff/.elm-spa/Generated/Guide/Params.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Params.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Guide/Params.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Params.elm diff --git a/elm-stuff/.elm-spa/Generated/Guide/Route.elm b/example/elm-stuff/.elm-spa/Generated/Guide/Route.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Guide/Route.elm rename to example/elm-stuff/.elm-spa/Generated/Guide/Route.elm diff --git a/elm-stuff/.elm-spa/Generated/Pages.elm b/example/elm-stuff/.elm-spa/Generated/Pages.elm similarity index 90% rename from elm-stuff/.elm-spa/Generated/Pages.elm rename to example/elm-stuff/.elm-spa/Generated/Pages.elm index 9e079ba..38eb31b 100644 --- a/elm-stuff/.elm-spa/Generated/Pages.elm +++ b/example/elm-stuff/.elm-spa/Generated/Pages.elm @@ -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 -> diff --git a/elm-stuff/.elm-spa/Generated/Params.elm b/example/elm-stuff/.elm-spa/Generated/Params.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Params.elm rename to example/elm-stuff/.elm-spa/Generated/Params.elm diff --git a/elm-stuff/.elm-spa/Generated/Route.elm b/example/elm-stuff/.elm-spa/Generated/Route.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Route.elm rename to example/elm-stuff/.elm-spa/Generated/Route.elm diff --git a/elm-stuff/.elm-spa/Generated/Routes.elm b/example/elm-stuff/.elm-spa/Generated/Routes.elm similarity index 100% rename from elm-stuff/.elm-spa/Generated/Routes.elm rename to example/elm-stuff/.elm-spa/Generated/Routes.elm diff --git a/elm-stuff/.elm-spa/README.md b/example/elm-stuff/.elm-spa/README.md similarity index 100% rename from elm-stuff/.elm-spa/README.md rename to example/elm-stuff/.elm-spa/README.md diff --git a/example/elm.json b/example/elm.json new file mode 100644 index 0000000..b764cce --- /dev/null +++ b/example/elm.json @@ -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": {} + } +} diff --git a/index.html b/example/index.html similarity index 100% rename from index.html rename to example/index.html diff --git a/package-lock.json b/example/package-lock.json similarity index 98% rename from package-lock.json rename to example/package-lock.json index 36042bc..db291e5 100644 --- a/package-lock.json +++ b/example/package-lock.json @@ -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", diff --git a/example/package.json b/example/package.json new file mode 100644 index 0000000..83fcb01 --- /dev/null +++ b/example/package.json @@ -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": [] +} diff --git a/public/ports.js b/example/public/ports.js similarity index 100% rename from public/ports.js rename to example/public/ports.js diff --git a/public/styles.css b/example/public/styles.css similarity index 100% rename from public/styles.css rename to example/public/styles.css diff --git a/example/Components/Button.elm b/example/src/Components/Button.elm similarity index 100% rename from example/Components/Button.elm rename to example/src/Components/Button.elm diff --git a/example/Components/Hero.elm b/example/src/Components/Hero.elm similarity index 100% rename from example/Components/Hero.elm rename to example/src/Components/Hero.elm diff --git a/example/Components/Section.elm b/example/src/Components/Section.elm similarity index 100% rename from example/Components/Section.elm rename to example/src/Components/Section.elm diff --git a/example/Components/Styles.elm b/example/src/Components/Styles.elm similarity index 100% rename from example/Components/Styles.elm rename to example/src/Components/Styles.elm diff --git a/example/Global.elm b/example/src/Global.elm similarity index 100% rename from example/Global.elm rename to example/src/Global.elm diff --git a/example/Layout.elm b/example/src/Layout.elm similarity index 100% rename from example/Layout.elm rename to example/src/Layout.elm diff --git a/example/Layouts/Docs.elm b/example/src/Layouts/Docs.elm similarity index 100% rename from example/Layouts/Docs.elm rename to example/src/Layouts/Docs.elm diff --git a/example/Layouts/Guide.elm b/example/src/Layouts/Guide.elm similarity index 100% rename from example/Layouts/Guide.elm rename to example/src/Layouts/Guide.elm diff --git a/example/Layouts/Guide/Dynamic.elm b/example/src/Layouts/Guide/Dynamic.elm similarity index 100% rename from example/Layouts/Guide/Dynamic.elm rename to example/src/Layouts/Guide/Dynamic.elm diff --git a/example/Layouts/Guide/Dynamic/Dynamic.elm b/example/src/Layouts/Guide/Dynamic/Dynamic.elm similarity index 100% rename from example/Layouts/Guide/Dynamic/Dynamic.elm rename to example/src/Layouts/Guide/Dynamic/Dynamic.elm diff --git a/example/Layouts/Guide/Dynamic/Faq.elm b/example/src/Layouts/Guide/Dynamic/Faq.elm similarity index 100% rename from example/Layouts/Guide/Dynamic/Faq.elm rename to example/src/Layouts/Guide/Dynamic/Faq.elm diff --git a/example/Main.elm b/example/src/Main.elm similarity index 96% rename from example/Main.elm rename to example/src/Main.elm index 91ce514..02fef4c 100644 --- a/example/Main.elm +++ b/example/src/Main.elm @@ -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 diff --git a/example/Pages/Docs.elm b/example/src/Pages/Docs.elm similarity index 95% rename from example/Pages/Docs.elm rename to example/src/Pages/Docs.elm index 102423e..28815d0 100644 --- a/example/Pages/Docs.elm +++ b/example/src/Pages/Docs.elm @@ -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 = diff --git a/example/Pages/Docs/Dynamic.elm b/example/src/Pages/Docs/Dynamic.elm similarity index 97% rename from example/Pages/Docs/Dynamic.elm rename to example/src/Pages/Docs/Dynamic.elm index b32932b..f642229 100644 --- a/example/Pages/Docs/Dynamic.elm +++ b/example/src/Pages/Docs/Dynamic.elm @@ -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 = diff --git a/example/Pages/Docs/Static.elm b/example/src/Pages/Docs/Static.elm similarity index 95% rename from example/Pages/Docs/Static.elm rename to example/src/Pages/Docs/Static.elm index edeeae1..5fd7f30 100644 --- a/example/Pages/Docs/Static.elm +++ b/example/src/Pages/Docs/Static.elm @@ -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 = diff --git a/example/Pages/Guide.elm b/example/src/Pages/Guide.elm similarity index 96% rename from example/Pages/Guide.elm rename to example/src/Pages/Guide.elm index 837a864..30c7139 100644 --- a/example/Pages/Guide.elm +++ b/example/src/Pages/Guide.elm @@ -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 = diff --git a/example/Pages/Guide/Dynamic/Dynamic.elm b/example/src/Pages/Guide/Dynamic/Dynamic.elm similarity index 96% rename from example/Pages/Guide/Dynamic/Dynamic.elm rename to example/src/Pages/Guide/Dynamic/Dynamic.elm index 2c2341b..f86213b 100644 --- a/example/Pages/Guide/Dynamic/Dynamic.elm +++ b/example/src/Pages/Guide/Dynamic/Dynamic.elm @@ -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 = diff --git a/example/Pages/Guide/Dynamic/Dynamic/Top.elm b/example/src/Pages/Guide/Dynamic/Dynamic/Top.elm similarity index 96% rename from example/Pages/Guide/Dynamic/Dynamic/Top.elm rename to example/src/Pages/Guide/Dynamic/Dynamic/Top.elm index 252d4e1..a0dd69e 100644 --- a/example/Pages/Guide/Dynamic/Dynamic/Top.elm +++ b/example/src/Pages/Guide/Dynamic/Dynamic/Top.elm @@ -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 = diff --git a/example/Pages/Guide/Dynamic/Faq/Top.elm b/example/src/Pages/Guide/Dynamic/Faq/Top.elm similarity index 96% rename from example/Pages/Guide/Dynamic/Faq/Top.elm rename to example/src/Pages/Guide/Dynamic/Faq/Top.elm index 4e4ecfa..ce5bf43 100644 --- a/example/Pages/Guide/Dynamic/Faq/Top.elm +++ b/example/src/Pages/Guide/Dynamic/Faq/Top.elm @@ -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 = diff --git a/example/Pages/Guide/Dynamic/Intro.elm b/example/src/Pages/Guide/Dynamic/Intro.elm similarity index 96% rename from example/Pages/Guide/Dynamic/Intro.elm rename to example/src/Pages/Guide/Dynamic/Intro.elm index d0b62cf..aed5574 100644 --- a/example/Pages/Guide/Dynamic/Intro.elm +++ b/example/src/Pages/Guide/Dynamic/Intro.elm @@ -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 = diff --git a/example/Pages/Guide/Dynamic/Other.elm b/example/src/Pages/Guide/Dynamic/Other.elm similarity index 96% rename from example/Pages/Guide/Dynamic/Other.elm rename to example/src/Pages/Guide/Dynamic/Other.elm index 0cea77d..9ca0be7 100644 --- a/example/Pages/Guide/Dynamic/Other.elm +++ b/example/src/Pages/Guide/Dynamic/Other.elm @@ -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 = diff --git a/example/Pages/Guide/Elm.elm b/example/src/Pages/Guide/Elm.elm similarity index 94% rename from example/Pages/Guide/Elm.elm rename to example/src/Pages/Guide/Elm.elm index f1146a7..9377976 100644 --- a/example/Pages/Guide/Elm.elm +++ b/example/src/Pages/Guide/Elm.elm @@ -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 = diff --git a/example/Pages/Guide/ElmSpa.elm b/example/src/Pages/Guide/ElmSpa.elm similarity index 94% rename from example/Pages/Guide/ElmSpa.elm rename to example/src/Pages/Guide/ElmSpa.elm index 570118c..1ec8c7f 100644 --- a/example/Pages/Guide/ElmSpa.elm +++ b/example/src/Pages/Guide/ElmSpa.elm @@ -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 = diff --git a/example/Pages/Guide/Programming.elm b/example/src/Pages/Guide/Programming.elm similarity index 94% rename from example/Pages/Guide/Programming.elm rename to example/src/Pages/Guide/Programming.elm index 8dff7d6..b512903 100644 --- a/example/Pages/Guide/Programming.elm +++ b/example/src/Pages/Guide/Programming.elm @@ -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 = diff --git a/example/Pages/NotFound.elm b/example/src/Pages/NotFound.elm similarity index 95% rename from example/Pages/NotFound.elm rename to example/src/Pages/NotFound.elm index acce333..aeb3d07 100644 --- a/example/Pages/NotFound.elm +++ b/example/src/Pages/NotFound.elm @@ -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 = diff --git a/example/Pages/SignIn.elm b/example/src/Pages/SignIn.elm similarity index 99% rename from example/Pages/SignIn.elm rename to example/src/Pages/SignIn.elm index 0116fbf..bab2a3e 100644 --- a/example/Pages/SignIn.elm +++ b/example/src/Pages/SignIn.elm @@ -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 = diff --git a/example/Pages/Top.elm b/example/src/Pages/Top.elm similarity index 98% rename from example/Pages/Top.elm rename to example/src/Pages/Top.elm index 3db85c2..ecb662b 100644 --- a/example/Pages/Top.elm +++ b/example/src/Pages/Top.elm @@ -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 = diff --git a/example/Ports.elm b/example/src/Ports.elm similarity index 100% rename from example/Ports.elm rename to example/src/Ports.elm diff --git a/example/Utils/Page.elm b/example/src/Utils/Spa.elm similarity index 97% rename from example/Utils/Page.elm rename to example/src/Utils/Spa.elm index 8cf7e38..ae966ea 100644 --- a/example/Utils/Page.elm +++ b/example/src/Utils/Spa.elm @@ -1,4 +1,4 @@ -module Utils.Page exposing +module Utils.Spa exposing ( Bundle , Init , Page diff --git a/package.json b/package.json index 99494fe..69f194e 100644 --- a/package.json +++ b/package.json @@ -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": [] } diff --git a/sandbox.config.json b/sandbox.config.json deleted file mode 100644 index 28d9158..0000000 --- a/sandbox.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "infiniteLoopProtection": true, - "hardReloadOnChange": false, - "view": "browser", - "container": { - "port": 8080 - } -} diff --git a/src/App/Types.elm b/src/App/Types.elm index fac8b61..05cada3 100644 --- a/src/App/Types.elm +++ b/src/App/Types.elm @@ -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