mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-27 11:05:46 +03:00
Goodbye PathKey! 👋
This commit is contained in:
parent
f47d2b1ed6
commit
da14d2e88f
@ -5,13 +5,12 @@ import Element exposing (Element)
|
||||
import Html.Attributes as Attr
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
import List.Extra
|
||||
import Pages
|
||||
import Pages.ImagePath as ImagePath exposing (ImagePath)
|
||||
|
||||
|
||||
type alias Author =
|
||||
{ name : String
|
||||
, avatar : ImagePath Pages.PathKey
|
||||
, avatar : ImagePath ()
|
||||
, bio : String
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ But before the user even requests the page, we have the following data:
|
||||
-}
|
||||
|
||||
import Head
|
||||
import Pages
|
||||
import Pages.PagePath exposing (PagePath)
|
||||
import Pages.StaticHttp as StaticHttp
|
||||
import Shared
|
||||
@ -62,7 +61,7 @@ type alias TemplateWithState routeParams templateStaticData templateModel templa
|
||||
-> Shared.PageView templateMsg
|
||||
, head :
|
||||
StaticPayload templateStaticData routeParams
|
||||
-> List (Head.Tag Pages.PathKey)
|
||||
-> List (Head.Tag ())
|
||||
, init : routeParams -> ( templateModel, Cmd templateMsg )
|
||||
, update : routeParams -> templateMsg -> templateModel -> Shared.Model -> ( templateModel, Cmd templateMsg, Maybe Shared.SharedMsg )
|
||||
, subscriptions : routeParams -> PagePath -> templateModel -> Shared.Model -> Sub templateMsg
|
||||
@ -90,7 +89,7 @@ type Builder routeParams templateStaticData
|
||||
, staticRoutes : StaticHttp.Request (List routeParams)
|
||||
, head :
|
||||
StaticPayload templateStaticData routeParams
|
||||
-> List (Head.Tag Pages.PathKey)
|
||||
-> List (Head.Tag ())
|
||||
}
|
||||
|
||||
|
||||
@ -181,7 +180,7 @@ buildWithSharedState config builderState =
|
||||
withStaticData :
|
||||
{ staticData : routeParams -> StaticHttp.Request templateStaticData
|
||||
, staticRoutes : StaticHttp.Request (List routeParams)
|
||||
, head : StaticPayload templateStaticData routeParams -> List (Head.Tag Pages.PathKey)
|
||||
, head : StaticPayload templateStaticData routeParams -> List (Head.Tag ())
|
||||
}
|
||||
-> Builder routeParams templateStaticData
|
||||
withStaticData { staticData, head, staticRoutes } =
|
||||
@ -194,7 +193,7 @@ withStaticData { staticData, head, staticRoutes } =
|
||||
|
||||
{-| -}
|
||||
noStaticData :
|
||||
{ head : StaticPayload () routeParams -> List (Head.Tag Pages.PathKey)
|
||||
{ head : StaticPayload () routeParams -> List (Head.Tag ())
|
||||
, staticRoutes : StaticHttp.Request (List routeParams)
|
||||
}
|
||||
-> Builder routeParams ()
|
||||
|
@ -1,5 +1,5 @@
|
||||
const exposingList =
|
||||
"(PathKey, allPages, allImages, internals, images, isValidRoute, pages, builtAt)";
|
||||
"(allPages, allImages, internals, images, isValidRoute, pages, builtAt)";
|
||||
|
||||
function staticRouteStuff(staticRoutes) {
|
||||
return `
|
||||
@ -12,7 +12,7 @@ ${staticRoutes.routeRecord}
|
||||
${staticRoutes.imageAssetsRecord}
|
||||
|
||||
|
||||
allImages : List (ImagePath PathKey)
|
||||
allImages : List (ImagePath ())
|
||||
allImages =
|
||||
[${staticRoutes.allImages.join("\n , ")}
|
||||
]
|
||||
@ -65,10 +65,6 @@ builtAt =
|
||||
Time.millisToPosix ${Math.round(global.builtAt.getTime())}
|
||||
|
||||
|
||||
type alias PathKey
|
||||
= ()
|
||||
|
||||
|
||||
buildImage : List String -> ImagePath ()
|
||||
buildImage path =
|
||||
ImagePath.build ("images" :: path)
|
||||
@ -79,12 +75,12 @@ buildPage path =
|
||||
PagePath.build path
|
||||
|
||||
|
||||
directoryWithIndex : List String -> Directory PathKey Directory.WithIndex
|
||||
directoryWithIndex : List String -> Directory () Directory.WithIndex
|
||||
directoryWithIndex path =
|
||||
Directory.withIndex () allPages path
|
||||
|
||||
|
||||
directoryWithoutIndex : List String -> Directory PathKey Directory.WithoutIndex
|
||||
directoryWithoutIndex : List String -> Directory () Directory.WithoutIndex
|
||||
directoryWithoutIndex path =
|
||||
Directory.withoutIndex () allPages path
|
||||
|
||||
@ -94,7 +90,7 @@ port toJsPort : Json.Encode.Value -> Cmd msg
|
||||
port fromJsPort : (Json.Decode.Value -> msg) -> Sub msg
|
||||
|
||||
|
||||
internals : Pages.Internal.Internal PathKey
|
||||
internals : Pages.Internal.Internal ()
|
||||
internals =
|
||||
{ applicationType = Pages.Internal.Browser
|
||||
, toJsPort = toJsPort
|
||||
@ -132,10 +128,6 @@ builtAt =
|
||||
Time.millisToPosix ${Math.round(global.builtAt.getTime())}
|
||||
|
||||
|
||||
type alias PathKey
|
||||
= ()
|
||||
|
||||
|
||||
buildImage : List String -> ImagePath ()
|
||||
buildImage path =
|
||||
ImagePath.build ("images" :: path)
|
||||
@ -146,12 +138,12 @@ buildPage path =
|
||||
PagePath.build path
|
||||
|
||||
|
||||
directoryWithIndex : List String -> Directory PathKey Directory.WithIndex
|
||||
directoryWithIndex : List String -> Directory () Directory.WithIndex
|
||||
directoryWithIndex path =
|
||||
Directory.withIndex () allPages path
|
||||
|
||||
|
||||
directoryWithoutIndex : List String -> Directory PathKey Directory.WithoutIndex
|
||||
directoryWithoutIndex : List String -> Directory () Directory.WithoutIndex
|
||||
directoryWithoutIndex path =
|
||||
Directory.withoutIndex () allPages path
|
||||
|
||||
@ -162,7 +154,7 @@ port toJsPort : Json.Encode.Value -> Cmd msg
|
||||
port fromJsPort : (Json.Decode.Value -> msg) -> Sub msg
|
||||
|
||||
|
||||
internals : Pages.Internal.Internal PathKey
|
||||
internals : Pages.Internal.Internal ()
|
||||
internals =
|
||||
{ applicationType = Pages.Internal.Cli
|
||||
, toJsPort = toJsPort
|
||||
|
Loading…
Reference in New Issue
Block a user