on master help sign in
Optimized a bit
b90989eiko
build.sh+7−3
@@ -2,8 +2,12 @@
2
2
3set -e
3set -e
4
4
5−cp -r "$SRC_DIR"/{appname.apparmor,appname.desktop,vanilla,index.html,style.css,manifest.json,logo.svg} "$INSTALL_DIR"
5+TEMP=$(mktemp -d)
6
6
7−elm make --debug "$SRC_DIR/frontend/Main.elm" --output="$INSTALL_DIR/elm.js"
7+cp -r "$SRC_DIR"/{vanilla,appname.apparmor,appname.desktop,manifest.json,logo.svg,index.html,style.css} "$INSTALL_DIR"
8
8
9+elm make "$SRC_DIR/frontend/Main.elm" --optimize --output="$TEMP/elm.js"
10+
11+terser "$TEMP/elm.js" --ecma 2018 --compress 'pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe' | terser --ecma 2018 --mangle --compress --output "$INSTALL_DIR/elm.js"
12+
9−(cd "$SRC_DIR" && spago bundle-app --to "$INSTALL_DIR/backend.js")
13+(cd "$SRC_DIR" && spago bundle-app --minify --to "$INSTALL_DIR/backend.js")
clickable.yaml+1−2
@@ -11,7 +11,6 @@ image_setup:
11 run:
11 run:
12
12
13 - (cd /tmp && curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz && gunzip elm.gz && chmod +x elm && mv elm /usr/local/bin/)
13 - (cd /tmp && curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz && gunzip elm.gz && chmod +x elm && mv elm /usr/local/bin/)
14− - npm install -g spago esbuild purescript --unsafe-perm=true
14+ - npm install -g spago esbuild purescript terser --unsafe-perm=true
15− - (cd / && curl https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.37.1.tar.xz >git.tar.gz && tar -xvf git.tar.gz && cd git-2.37.1 && ./configure --without-curl && make)
16
15
17restrict_arch: all
16restrict_arch: all
frontend/FFI.elm+1−2
@@ -14,8 +14,7 @@ port bridgeCmd : D.Value -> Cmd msg
14getBridge : (String -> msg) -> (Bridge.Sub -> msg) -> Sub msg
14getBridge : (String -> msg) -> (Bridge.Sub -> msg) -> Sub msg
15getBridge err f =
15getBridge err f =
16 bridgeSub
16 bridgeSub
17− ((\v -> Debug.log (E.encode 1 v) v)
18− >> D.decodeValue Bridge.jsonDecSub
17+ (D.decodeValue Bridge.jsonDecSub
19 >> (\res ->
18 >> (\res ->
20 case res of
19 case res of
21 Ok a ->
20 Ok a ->
frontend/Main.elm+3−2
@@ -4,6 +4,7 @@ import Bridge
4import Browser
4import Browser
5import FFI exposing (getBridge, sendBridge)
5import FFI exposing (getBridge, sendBridge)
6import Html exposing (..)
6import Html exposing (..)
7+import Html.Lazy as Lazy
7import List.Nonempty as Nonempty exposing (Nonempty(..))
8import List.Nonempty as Nonempty exposing (Nonempty(..))
8import Notification
9import Notification
9import Pages.Cipher as Cipher
10import Pages.Cipher as Cipher
@@ -169,8 +170,8 @@ init =
169view : Model -> Html Msg
170view : Model -> Html Msg
170view model =
171view model =
171 div []
172 div []
172− (maybeList (List.head model.notifications) (Notification.notification CloseNotification)
173+ (maybeList (List.head model.notifications) (Lazy.lazy2 Notification.notification CloseNotification)
173− ++ [ Navigation.showNavigationView model.pageStack showPage ]
174+ ++ [ Lazy.lazy2 Navigation.showNavigationView model.pageStack showPage ]
174 )
175 )
175
176
176
177
frontend/Pages/Ciphers.elm+5−2
@@ -4,6 +4,7 @@ import Bridge
4import Html exposing (..)
4import Html exposing (..)
5import Html.Attributes as Attr
5import Html.Attributes as Attr
6import Html.Events as Ev
6import Html.Events as Ev
7+import Html.Keyed as Keyed
7import Page exposing (..)
8import Page exposing (..)
8import Pages.Navigation as Navigation
9import Pages.Navigation as Navigation
9import Search
10import Search
@@ -150,18 +151,20 @@ view { selected } liftMsg { ciphers, search, ciphersListFilter } =
150 , Attr.attribute "autocomplete" "off"
151 , Attr.attribute "autocomplete" "off"
151 ]
152 ]
152 []
153 []
153− , ul [ Attr.class "p-list--divided" ]
154+ , Keyed.ul [ Attr.class "p-list--divided" ]
154 (ciphers
155 (ciphers
155 |> applyCipherFilter ciphersListFilter
156 |> applyCipherFilter ciphersListFilter
156 |> Search.searchList (cipherSearch search)
157 |> Search.searchList (cipherSearch search)
157 |> List.map
158 |> List.map
158 (\{ name, date, id } ->
159 (\{ name, date, id } ->
160+ ( id
159− li [ Attr.class "p-list__item cipher-row", Ev.onClick (selected id) ]
161+ , li [ Attr.class "p-list__item cipher-row", Ev.onClick (selected id) ]
160 [ div [ Attr.class "cipher-row-container" ]
162 [ div [ Attr.class "cipher-row-container" ]
161 [ p [] [ text name ]
163 [ p [] [ text name ]
162 , p [ Attr.class "p-text--small u-align-text--right u-text--muted" ] [ text date ]
164 , p [ Attr.class "p-text--small u-align-text--right u-text--muted" ] [ text date ]
163 ]
165 ]
164 ]
166 ]
167+ )
165 )
168 )
166 )
169 )
167 ]
170 ]
frontend/Pages/Navigation.elm+34−31
@@ -12,6 +12,7 @@ module Pages.Navigation exposing
12import Html exposing (..)
12import Html exposing (..)
13import Html.Attributes as Attr
13import Html.Attributes as Attr
14import Html.Events as Ev
14import Html.Events as Ev
15+import Html.Lazy as Lazy
15import List.Nonempty as Nonempty exposing (Nonempty)
16import List.Nonempty as Nonempty exposing (Nonempty)
16import Utils exposing (..)
17import Utils exposing (..)
17
18
@@ -27,36 +28,38 @@ type alias Config msg =
27 }
28 }
28
29
29
30
30−navigation : Config msg -> List (Html msg)
31+navigation : Config msg -> Html msg
31navigation { topButton, title } =
32navigation { topButton, title } =
33+ div []
32− (case topButton of
34+ ((case topButton of
33− Just (MenuButton cfg) ->
35+ Just (MenuButton cfg) ->
34− [ menu cfg ]
36+ [ Lazy.lazy menu cfg ]
35−
37+
36− _ ->
38+ _ ->
37− []
39+ []
38− )
40+ )
39− ++ [ nav [ Attr.class "p-tabs p-tabs__list" ]
41+ ++ [ nav [ Attr.class "p-tabs p-tabs__list" ]
40− [ h3 [ Attr.class "" ]
42+ [ h3 []
41− [ case topButton of
43+ [ case topButton of
42− Nothing ->
44+ Nothing ->
43− button
45+ button
44− [ Attr.class "p-button--base is-inline u-no-margin", Attr.style "visibility" "hidden" ]
46+ [ Attr.class "p-button--base is-inline u-no-margin", Attr.style "visibility" "hidden" ]
45− []
47+ []
46−
48+
47− Just (BackButton msg) ->
49+ Just (BackButton msg) ->
48− button
50+ button
49− [ Attr.class "p-button--base is-inline u-no-margin", Ev.onClick msg ]
51+ [ Attr.class "p-button--base is-inline u-no-margin", Ev.onClick msg ]
50− [ i [ Attr.class "p-icon--chevron-up ninety-counter" ] [] ]
52+ [ i [ Attr.class "p-icon--chevron-up ninety-counter" ] [] ]
51−
53+
52− Just (MenuButton cfg) ->
54+ Just (MenuButton cfg) ->
53− button
55+ button
54− [ Attr.class "p-button--base is-inline u-no-margin", Ev.onClick cfg.toggle ]
56+ [ Attr.class "p-button--base is-inline u-no-margin", Ev.onClick cfg.toggle ]
55− [ i [ Attr.class "p-icon--menu" ] [] ]
57+ [ i [ Attr.class "p-icon--menu" ] [] ]
56− , text title
58+ , text title
59+ ]
57 ]
60 ]
58− ]
61+ ]
59− ]
62+ )
60
63
61
64
62type alias MenuConfig msg =
65type alias MenuConfig msg =
@@ -144,9 +147,9 @@ showNavigationView stack render =
144 render (Nonempty.head stack)
147 render (Nonempty.head stack)
145 in
148 in
146 div []
149 div []
147− (navigation
150+ [ Lazy.lazy navigation
148 { topButton = topButton
151 { topButton = topButton
149 , title = title
152 , title = title
150 }
153 }
151− ++ [ main_ [] body ]
154+ , main_ [] body
152− )
155+ ]
frontend/Search.elm+1−1
@@ -84,7 +84,7 @@ type Query
84-}
84-}
85constructQueries : String -> List Query
85constructQueries : String -> List Query
86constructQueries =
86constructQueries =
87− prepareString >> String.words >> List.filter (String.isEmpty >> not) >> List.map Query
87+ prepareString >> String.words >> List.filter (String.isEmpty >> not) >> List.filter (String.length >> (<) 1) >> List.map Query
88
88
89
89
90{-| Search a search term within a search entry.
90{-| Search a search term within a search entry.