// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`generate UI file 1`] = ` "port module Pages exposing (PathKey, allPages, allImages, internals, images, isValidRoute, pages, builtAt) import Color exposing (Color) import Pages.Internal import Head import Html exposing (Html) import Json.Decode import Json.Encode import Pages.Platform import Pages.Manifest exposing (DisplayMode, Orientation) import Pages.Manifest.Category as Category exposing (Category) import Url.Parser as Url exposing ((), s) import Pages.ImagePath as ImagePath exposing (ImagePath) import Pages.PagePath as PagePath exposing (PagePath) import Pages.Directory as Directory exposing (Directory) import Time builtAt : Time.Posix builtAt = Time.millisToPosix 1589734402000 type PathKey = PathKey buildImage : List String -> ImagePath.Dimensions -> ImagePath PathKey buildImage path dimensions = ImagePath.build PathKey (\\"images\\" :: path) dimensions buildPage : List String -> PagePath PathKey buildPage path = PagePath.build PathKey path directoryWithIndex : List String -> Directory PathKey Directory.WithIndex directoryWithIndex path = Directory.withIndex PathKey allPages path directoryWithoutIndex : List String -> Directory PathKey Directory.WithoutIndex directoryWithoutIndex path = Directory.withoutIndex PathKey allPages path port toJsPort : Json.Encode.Value -> Cmd msg port fromJsPort : (Json.Decode.Value -> msg) -> Sub msg internals : Pages.Internal.Internal PathKey internals = { applicationType = Pages.Internal.Browser , toJsPort = toJsPort , fromJsPort = fromJsPort identity , content = content , pathKey = PathKey } allPages : List (PagePath PathKey) allPages = [ ] pages = { directory = directoryWithoutIndex [] } images = { staticHttpError = (buildImage [ \\"static-http-error.png\\" ] { width = 919, height = 105 }) , directory = directoryWithoutIndex [] } allImages : List (ImagePath PathKey) allImages = [(buildImage [ \\"static-http-error.png\\" ] { width = 919, height = 105 }) ] isValidRoute : String -> Result String () isValidRoute route = let validRoutes = List.map PagePath.toString allPages in if (route |> String.startsWith \\"http://\\") || (route |> String.startsWith \\"https://\\") || (route |> String.startsWith \\"#\\") || (validRoutes |> List.member route) then Ok () else (\\"Valid routes:\\\\n\\" ++ String.join \\"\\\\n\\\\n\\" validRoutes ) |> Err content : List ( List String, { extension: String, frontMatter : String, body : Maybe String } ) content = [ ] " `; exports[`generate template module connector 1`] = ` "module TemplateDemultiplexer exposing (..) import Browser import Global import GlobalMetadata as M exposing (Metadata) import Head import Html exposing (Html) import Pages import Pages.PagePath exposing (PagePath) import Pages.Platform import Pages.StaticHttp as StaticHttp import SiteConfig import Template.BlogIndex import Template.BlogPost import Template.Documentation import Template.Page import Template.Showcase type alias Model = { global : Global.Model , page : TemplateModel , current : Maybe { path : { path : PagePath Pages.PathKey , query : Maybe String , fragment : Maybe String } , metadata : Metadata } } type TemplateModel = ModelBlogIndex Template.BlogIndex.Model | ModelBlogPost Template.BlogPost.Model | ModelDocumentation Template.Documentation.Model | ModelPage Template.Page.Model | ModelShowcase Template.Showcase.Model | NotFound type Msg = MsgGlobal Global.Msg | OnPageChange { path : PagePath Pages.PathKey , query : Maybe String , fragment : Maybe String , metadata : Metadata } | MsgBlogIndex Template.BlogIndex.Msg | MsgBlogPost Template.BlogPost.Msg | MsgDocumentation Template.Documentation.Msg | MsgPage Template.Page.Msg | MsgShowcase Template.Showcase.Msg view : List ( PagePath Pages.PathKey, Metadata ) -> { path : PagePath Pages.PathKey , frontmatter : Metadata } -> StaticHttp.Request { view : Model -> Global.View -> { title : String, body : Html Msg } , head : List (Head.Tag Pages.PathKey) } view siteMetadata page = case page.frontmatter of M.MetadataBlogIndex metadata -> StaticHttp.map2 (\\\\data globalData -> { view = \\\\model rendered -> case model.page of ModelBlogIndex subModel -> Template.BlogIndex.template.view MsgBlogIndex MsgGlobal siteMetadata data subModel metadata rendered |> (\\\\{ title, body } -> Global.view globalData page model.global MsgGlobal { title = title, body = body } ) _ -> { title = \\"\\", body = Html.text \\"\\" } , head = Template.BlogIndex.template.head data page.path metadata } ) (Template.BlogIndex.template.staticData siteMetadata) (Global.staticData siteMetadata) M.MetadataBlogPost metadata -> StaticHttp.map2 (\\\\data globalData -> { view = \\\\model rendered -> case model.page of ModelBlogPost subModel -> Template.BlogPost.template.view MsgBlogPost MsgGlobal siteMetadata data subModel metadata rendered |> (\\\\{ title, body } -> Global.view globalData page model.global MsgGlobal { title = title, body = body } ) _ -> { title = \\"\\", body = Html.text \\"\\" } , head = Template.BlogPost.template.head data page.path metadata } ) (Template.BlogPost.template.staticData siteMetadata) (Global.staticData siteMetadata) M.MetadataDocumentation metadata -> StaticHttp.map2 (\\\\data globalData -> { view = \\\\model rendered -> case model.page of ModelDocumentation subModel -> Template.Documentation.template.view MsgDocumentation MsgGlobal siteMetadata data subModel metadata rendered |> (\\\\{ title, body } -> Global.view globalData page model.global MsgGlobal { title = title, body = body } ) _ -> { title = \\"\\", body = Html.text \\"\\" } , head = Template.Documentation.template.head data page.path metadata } ) (Template.Documentation.template.staticData siteMetadata) (Global.staticData siteMetadata) M.MetadataPage metadata -> StaticHttp.map2 (\\\\data globalData -> { view = \\\\model rendered -> case model.page of ModelPage subModel -> Template.Page.template.view MsgPage MsgGlobal siteMetadata data subModel metadata rendered |> (\\\\{ title, body } -> Global.view globalData page model.global MsgGlobal { title = title, body = body } ) _ -> { title = \\"\\", body = Html.text \\"\\" } , head = Template.Page.template.head data page.path metadata } ) (Template.Page.template.staticData siteMetadata) (Global.staticData siteMetadata) M.MetadataShowcase metadata -> StaticHttp.map2 (\\\\data globalData -> { view = \\\\model rendered -> case model.page of ModelShowcase subModel -> Template.Showcase.template.view MsgShowcase MsgGlobal siteMetadata data subModel metadata rendered |> (\\\\{ title, body } -> Global.view globalData page model.global MsgGlobal { title = title, body = body } ) _ -> { title = \\"\\", body = Html.text \\"\\" } , head = Template.Showcase.template.head data page.path metadata } ) (Template.Showcase.template.staticData siteMetadata) (Global.staticData siteMetadata) init : Maybe { path : { path : PagePath Pages.PathKey , query : Maybe String , fragment : Maybe String } , metadata : Metadata } -> ( Model, Cmd Msg ) init maybePagePath = ( { global = Global.init maybePagePath , page = case maybePagePath |> Maybe.map .metadata of Nothing -> NotFound Just meta -> case meta of M.MetadataBlogIndex metadata -> Template.BlogIndex.template.init metadata |> Tuple.first |> ModelBlogIndex M.MetadataBlogPost metadata -> Template.BlogPost.template.init metadata |> Tuple.first |> ModelBlogPost M.MetadataDocumentation metadata -> Template.Documentation.template.init metadata |> Tuple.first |> ModelDocumentation M.MetadataPage metadata -> Template.Page.template.init metadata |> Tuple.first |> ModelPage M.MetadataShowcase metadata -> Template.Showcase.template.init metadata |> Tuple.first |> ModelShowcase , current = maybePagePath } , Cmd.none ) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of MsgGlobal msg_ -> let ( globalModel, globalCmd ) = Global.update msg_ model.global in ( { model | global = globalModel }, globalCmd |> Cmd.map MsgGlobal ) OnPageChange record -> init <| Just { path = { path = record.path , query = record.query , fragment = record.fragment } , metadata = record.metadata } MsgBlogIndex msg_ -> let ( updatedPageModel, pageCmd ) = case ( model.page, model.current |> Maybe.map .metadata ) of ( ModelBlogIndex pageModel, Just (M.MetadataBlogIndex metadata) ) -> Template.BlogIndex.template.update metadata msg_ pageModel |> Tuple.mapBoth ModelBlogIndex (Cmd.map MsgBlogIndex) _ -> ( model.page, Cmd.none ) in ( { model | page = updatedPageModel, global = save updatedPageModel model.global }, pageCmd ) MsgBlogPost msg_ -> let ( updatedPageModel, pageCmd ) = case ( model.page, model.current |> Maybe.map .metadata ) of ( ModelBlogPost pageModel, Just (M.MetadataBlogPost metadata) ) -> Template.BlogPost.template.update metadata msg_ pageModel |> Tuple.mapBoth ModelBlogPost (Cmd.map MsgBlogPost) _ -> ( model.page, Cmd.none ) in ( { model | page = updatedPageModel, global = save updatedPageModel model.global }, pageCmd ) MsgDocumentation msg_ -> let ( updatedPageModel, pageCmd ) = case ( model.page, model.current |> Maybe.map .metadata ) of ( ModelDocumentation pageModel, Just (M.MetadataDocumentation metadata) ) -> Template.Documentation.template.update metadata msg_ pageModel |> Tuple.mapBoth ModelDocumentation (Cmd.map MsgDocumentation) _ -> ( model.page, Cmd.none ) in ( { model | page = updatedPageModel, global = save updatedPageModel model.global }, pageCmd ) MsgPage msg_ -> let ( updatedPageModel, pageCmd ) = case ( model.page, model.current |> Maybe.map .metadata ) of ( ModelPage pageModel, Just (M.MetadataPage metadata) ) -> Template.Page.template.update metadata msg_ pageModel |> Tuple.mapBoth ModelPage (Cmd.map MsgPage) _ -> ( model.page, Cmd.none ) in ( { model | page = updatedPageModel, global = save updatedPageModel model.global }, pageCmd ) MsgShowcase msg_ -> let ( updatedPageModel, pageCmd ) = case ( model.page, model.current |> Maybe.map .metadata ) of ( ModelShowcase pageModel, Just (M.MetadataShowcase metadata) ) -> Template.Showcase.template.update metadata msg_ pageModel |> Tuple.mapBoth ModelShowcase (Cmd.map MsgShowcase) _ -> ( model.page, Cmd.none ) in ( { model | page = updatedPageModel, global = save updatedPageModel model.global }, pageCmd ) save : TemplateModel -> Global.Model -> Global.Model save model globalModel= case model of ModelBlogIndex m -> Template.BlogIndex.template.save m globalModel ModelBlogPost m -> Template.BlogPost.template.save m globalModel ModelDocumentation m -> Template.Documentation.template.save m globalModel ModelPage m -> Template.Page.template.save m globalModel ModelShowcase m -> Template.Showcase.template.save m globalModel NotFound -> globalModel mainTemplate { documents, manifest, canonicalSiteUrl, subscriptions } = Pages.Platform.init { init = init , view = view , update = update , subscriptions = subscriptions , documents = documents , onPageChange = Just OnPageChange , manifest = manifest -- SiteConfig.manifest , canonicalSiteUrl = canonicalSiteUrl -- SiteConfig.canonicalUrl , internals = Pages.internals } mapDocument : Browser.Document Never -> Browser.Document mapped mapDocument document = { title = document.title , body = document.body |> List.map (Html.map never) } " `;