diva.js 7.2.4 → 7.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,159 +0,0 @@
1
- module View.Icons exposing (close, downloadSelection, fromFullscreen, hideSidebar, info, nextPage, openingPageView, pageViewOpen, prevPage, reset, scrollingPageView, shiftLeft, shiftRight, showSidebar, toFullscreen, zoomIn, zoomOut)
2
-
3
- import Html exposing (Html)
4
- import Svg exposing (svg)
5
- import Svg.Attributes exposing (d, fill, height, viewBox, width)
6
-
7
-
8
- close : Html msg
9
- close =
10
- makeSvgIcon
11
- { viewBox = "0 0 512 512"
12
- , path = "M64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V96c0-8.8-7.2-16-16-16H64zM0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zm175 79c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"
13
- }
14
-
15
-
16
- downloadSelection : Html msg
17
- downloadSelection =
18
- makeSvgIcon
19
- { viewBox = "0 0 448 512"
20
- , path = "M114.2 320L224 430 333.8 320H280c-13.3 0-24-10.7-24-24V176H192V296c0 13.3-10.7 24-24 24H114.2zM224 480c-11.5 0-22.5-4.6-30.6-12.7L77.6 351.2C68.9 342.5 64 330.7 64 318.4c0-25.6 20.8-46.4 46.4-46.4H144V176c0-26.5 21.5-48 48-48h64c26.5 0 48 21.5 48 48v96h33.6c25.6 0 46.4 20.8 46.4 46.4c0 12.3-4.9 24.1-13.6 32.8L254.6 467.3c-8.1 8.1-19.1 12.7-30.6 12.7zM32 96a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm96 0a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm64-32a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zM320 96a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm64-32a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"
21
- }
22
-
23
-
24
- fromFullscreen : Html msg
25
- fromFullscreen =
26
- makeSvgIcon
27
- { viewBox = "0 0 512 512"
28
- , path = "M7 7C-2.3 16.4-2.3 31.6 7 41l80 80L41.4 166.6c-6 6-9.4 14.1-9.4 22.6V192c0 17.7 14.3 32 32 32H192c17.7 0 32-14.3 32-32V64c0-17.7-14.3-32-32-32h-2.7c-8.5 0-16.6 3.4-22.6 9.4L121 87 41 7C31.6-2.3 16.4-2.3 7 7zM505 41c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L391 87 345.4 41.4c-6-6-14.1-9.4-22.6-9.4H320c-17.7 0-32 14.3-32 32V192c0 17.7 14.3 32 32 32H448c17.7 0 32-14.3 32-32v-2.7c0-8.5-3.4-16.6-9.4-22.6L425 121l80-80zM505 471l-80-80 45.7-45.7c6-6 9.4-14.1 9.4-22.6V320c0-17.7-14.3-32-32-32H320c-17.7 0-32 14.3-32 32V448c0 17.7 14.3 32 32 32h2.7c8.5 0 16.6-3.4 22.6-9.4L391 425l80 80c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9zM7 471c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l80-80 45.7 45.7c6 6 14.1 9.4 22.6 9.4H192c17.7 0 32-14.3 32-32V320c0-17.7-14.3-32-32-32H64c-17.7 0-32 14.3-32 32v2.7c0 8.5 3.4 16.6 9.4 22.6L87 391 7 471zM412.1 176H336V99.9L412.1 176zM336 412.1V336h76.1L336 412.1zM99.9 176L176 99.9V176H99.9zM176 412.1L99.9 336H176v76.1z"
29
- }
30
-
31
-
32
- hideSidebar : Html msg
33
- hideSidebar =
34
- makeSvgIcon
35
- { viewBox = "0 0 640 512"
36
- , path = "M24 64c13.3 0 24 10.7 24 24l0 336c0 13.3-10.7 24-24 24s-24-10.7-24-24L0 88C0 74.7 10.7 64 24 64zm217 71c9.4 9.4 9.4 24.6 0 33.9l-63 63 284.1 0-63-63c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0L537 239c9.4 9.4 9.4 24.6 0 33.9L433 377c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l63-63-284.1 0 63 63c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L103 273c-9.4-9.4-9.4-24.6 0-33.9L207 135c9.4-9.4 24.6-9.4 33.9 0zM640 88V424c0 13.3-10.7 24-24 24s-24-10.7-24-24V88c0-13.3 10.7-24 24-24s24 10.7 24 24z"
37
- }
38
-
39
-
40
- info : Html msg
41
- info =
42
- makeSvgIcon
43
- { viewBox = "0 0 512 512"
44
- , path = "M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336c-13.3 0-24 10.7-24 24s10.7 24 24 24h80c13.3 0 24-10.7 24-24s-10.7-24-24-24h-8V248c0-13.3-10.7-24-24-24H216c-13.3 0-24 10.7-24 24s10.7 24 24 24h24v64H216zm40-144a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"
45
- }
46
-
47
-
48
- nextPage : Html msg
49
- nextPage =
50
- makeSvgIcon
51
- { viewBox = "0 0 24 24"
52
- , path = "M8.59 16.59L10 18L16 12L10 6L8.59 7.41L13.17 12L8.59 16.59z"
53
- }
54
-
55
-
56
- openingPageView : Html msg
57
- openingPageView =
58
- makeSvgIcon
59
- { viewBox = "0 0 576 512"
60
- , path = "M156 32C100.6 32 48.8 46.6 27.1 53.6C10.3 59 0 74.5 0 91.1V403.5c0 26.1 24 44.2 48 40.2c19.8-3.3 54.8-7.7 100-7.7c54 0 97.5 25.5 112.5 35.6c7.5 5 16.8 8.4 27 8.4c11.5 0 21.6-4.2 29.3-9.9C330.2 460.3 369.1 436 428 436c47.7 0 80.5 4 99 7.2c23.9 4.1 49-13.8 49-40.6V91.1c0-16.5-10.3-32.1-27.1-37.5C527.2 46.6 475.4 32 420 32c-36.8 0-71.8 6.4-97.4 12.7c-12.8 3.2-23.5 6.3-30.9 8.7c-1.3 .4-2.6 .8-3.7 1.2c-1.1-.4-2.4-.8-3.7-1.2c-7.5-2.4-18.1-5.5-30.9-8.7C227.8 38.4 192.8 32 156 32zM264 97.3V417.9C238 404.2 196.8 388 148 388c-42.9 0-77.4 3.7-100 7.1V97.3C70.3 90.6 112.4 80 156 80c31.6 0 62.6 5.6 85.9 11.3c8.6 2.1 16.1 4.2 22.1 6zm48 319.2V97.3c6-1.8 13.5-3.9 22.1-6C357.4 85.6 388.4 80 420 80c43.6 0 85.7 10.6 108 17.3V394.7c-21.7-3.3-54.9-6.7-100-6.7c-51.4 0-90.8 15-116 28.6z"
61
- }
62
-
63
-
64
- pageViewOpen : Html msg
65
- pageViewOpen =
66
- makeSvgIcon
67
- { viewBox = "0 0 384 512"
68
- , path = "M64 464c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16H224v80c0 17.7 14.3 32 32 32h80V448c0 8.8-7.2 16-16 16H64zM64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V154.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0H64zM272 304c0-53-43-96-96-96s-96 43-96 96s43 96 96 96c17.8 0 34.4-4.8 48.7-13.2L263 425.1c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-38.3-38.3c8.5-14.3 13.3-31 13.3-48.9zm-96-48a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"
69
- }
70
-
71
-
72
- prevPage : Html msg
73
- prevPage =
74
- makeSvgIcon
75
- { viewBox = "0 0 24 24"
76
- , path = "M15.41 7.41L14 6L8 12L14 18L15.41 16.59L10.83 12L15.41 7.41z"
77
- }
78
-
79
-
80
- reset : Html msg
81
- reset =
82
- makeSvgIcon
83
- { viewBox = "0 0 512 512"
84
- , path = "M256 80c-72.7 0-135.2 44.1-162 107.1c-5.2 12.2-19.3 17.9-31.5 12.7s-17.9-19.3-12.7-31.5C83.9 88.2 163.4 32 256 32c52.5 0 102.8 20.8 139.9 57.9L448 142.1V88c0-13.3 10.7-24 24-24s24 10.7 24 24V200c0 13.3-10.7 24-24 24H360c-13.3 0-24-10.7-24-24s10.7-24 24-24h54.1l-52.1-52.1C333.8 95.8 295.7 80 256 80zM449.4 312.6c12.2 5.2 17.8 19.3 12.6 31.5C427.8 424 348.5 480 256 480c-52.5 0-102.8-20.8-139.9-57.9L64 369.9V424c0 13.3-10.7 24-24 24s-24-10.7-24-24V312c0-13.3 10.7-24 24-24H152c13.3 0 24 10.7 24 24s-10.7 24-24 24H97.9l52.1 52.1C178.2 416.2 216.3 432 256 432c72.6 0 135-43.9 161.9-106.8c5.2-12.2 19.3-17.8 31.5-12.6zM256 128c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"
85
- }
86
-
87
-
88
- scrollingPageView : Html msg
89
- scrollingPageView =
90
- makeSvgIcon
91
- { viewBox = "0 0 384 512"
92
- , path = "M64 48c-8.8 0-16 7.2-16 16V448c0 8.8 7.2 16 16 16H320c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64zM0 64C0 28.7 28.7 0 64 0H320c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zm120 64H264c13.3 0 24 10.7 24 24s-10.7 24-24 24H120c-13.3 0-24-10.7-24-24s10.7-24 24-24zm0 96H264c13.3 0 24 10.7 24 24s-10.7 24-24 24H120c-13.3 0-24-10.7-24-24s10.7-24 24-24zm0 96h48c13.3 0 24 10.7 24 24s-10.7 24-24 24H120c-13.3 0-24-10.7-24-24s10.7-24 24-24z"
93
- }
94
-
95
-
96
- shiftLeft : Html msg
97
- shiftLeft =
98
- makeSvgIcon
99
- { viewBox = "0 0 640 512"
100
- , path = "M 283.05 111 C 292.45 101.6 307.65 101.6 316.95 111 C 326.25 120.4 326.35 135.6 316.95 144.9 L 277.95 183.9 L 556.05 183.9 C 569.35 183.9 580.05 194.6 580.05 207.9 C 580.05 221.2 569.35 231.9 556.05 231.9 L 277.95 231.9 L 316.95 270.9 C 326.35 280.3 326.35 295.5 316.95 304.8 C 307.55 314.1 292.35 314.2 283.05 304.8 L 203.05 224.8 C 193.65 215.4 193.65 200.2 203.05 190.9 L 283.05 110.9 L 283.05 111 Z M 392 0 C 422.9 0 448 25.1 448 56 L 448 128 L 400 128 L 400 56 C 400 51.6 396.4 48 392 48 L 88 48 C 65.9 48 48 65.9 48 88 L 48 358.7 C 57.8 354.4 68.6 352 80 352 L 392 352 C 396.4 352 400 348.4 400 344 L 400 288 L 448 288 L 448 344 C 448 366.3 434.9 385.6 416 394.6 L 416 464 L 424 464 C 437.3 464 448 474.7 448 488 C 448 501.3 437.3 512 424 512 L 80 512 C 35.8 512 0 476.2 0 432 C 0 429.3 0.1 426.6 0.4 424 L 0 424 L 0 88 C 0 39.4 39.4 0 88 0 L 392 0 Z M 80 400 C 62.3 400 48 414.3 48 432 C 48 449.7 62.3 464 80 464 L 368 464 L 368 400 L 80 400 Z"
101
- }
102
-
103
-
104
- shiftRight : Html msg
105
- shiftRight =
106
- makeSvgIcon
107
- { viewBox = "0 0 640 512"
108
- , path = "M88 0C39.4 0 0 39.4 0 88V424H.4c-.3 2.6-.4 5.3-.4 8c0 44.2 35.8 80 80 80H424c13.3 0 24-10.7 24-24s-10.7-24-24-24h-8V394.6c18.9-9 32-28.3 32-50.6V288H400v56c0 4.4-3.6 8-8 8H80c-11.4 0-22.2 2.4-32 6.7V88c0-22.1 17.9-40 40-40H392c4.4 0 8 3.6 8 8v72h48V56c0-30.9-25.1-56-56-56H88zM368 400v64H80c-17.7 0-32-14.3-32-32s14.3-32 32-32H368zM553 111c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l39 39H280c-13.3 0-24 10.7-24 24s10.7 24 24 24H558.1l-39 39c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l80-80c9.4-9.4 9.4-24.6 0-33.9l-80-80z"
109
- }
110
-
111
-
112
- showSidebar : Html msg
113
- showSidebar =
114
- makeSvgIcon
115
- { viewBox = "0 0 512 512"
116
- , path = "M295 401L167 273c-9.4-9.4-9.4-24.6 0-33.9L295 111c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-87 87L488 232c13.3 0 24 10.7 24 24s-10.7 24-24 24l-246.1 0 87 87c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0zM168 80L88 80c-22.1 0-40 17.9-40 40l0 272c0 22.1 17.9 40 40 40l80 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-48.6 0-88-39.4-88-88L0 120C0 71.4 39.4 32 88 32l80 0c13.3 0 24 10.7 24 24s-10.7 24-24 24z"
117
- }
118
-
119
-
120
- toFullscreen : Html msg
121
- toFullscreen =
122
- makeSvgIcon
123
- { viewBox = "0 0 512 512"
124
- , path = "M156.1 80H80v76.1L156.1 80zM32 192V64c0-17.7 14.3-32 32-32H192c17.7 0 32 14.3 32 32v2.7c0 8.5-3.4 16.6-9.4 22.6L169 135l87 87 87-87L297.4 89.4c-6-6-9.4-14.1-9.4-22.6V64c0-17.7 14.3-32 32-32H448c17.7 0 32 14.3 32 32V192c0 17.7-14.3 32-32 32h-2.7c-8.5 0-16.6-3.4-22.6-9.4L377 169l-87 87 87 87 45.7-45.7c6-6 14.1-9.4 22.6-9.4H448c17.7 0 32 14.3 32 32V448c0 17.7-14.3 32-32 32H320c-17.7 0-32-14.3-32-32v-2.7c0-8.5 3.4-16.6 9.4-22.6L343 377l-87-87-87 87 45.7 45.7c6 6 9.4 14.1 9.4 22.6V448c0 17.7-14.3 32-32 32H64c-17.7 0-32-14.3-32-32V320c0-17.7 14.3-32 32-32h2.7c8.5 0 16.6 3.4 22.6 9.4L135 343l87-87-87-87L89.4 214.6c-6 6-14.1 9.4-22.6 9.4H64c-17.7 0-32-14.3-32-32zM355.9 432H432V355.9L355.9 432zM80 355.9V432h76.1L80 355.9zM355.9 80L432 156.1V80H355.9z"
125
- }
126
-
127
-
128
- zoomIn : Html msg
129
- zoomIn =
130
- makeSvgIcon
131
- { viewBox = "0 0 512 512"
132
- , path = "M208 48a160 160 0 1 1 0 320 160 160 0 1 1 0-320zm0 368c48.8 0 93.7-16.8 129.1-44.9L471 505c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L371.1 337.1C399.2 301.7 416 256.8 416 208C416 93.1 322.9 0 208 0S0 93.1 0 208S93.1 416 208 416zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"
133
- }
134
-
135
-
136
- zoomOut : Html msg
137
- zoomOut =
138
- makeSvgIcon
139
- { viewBox = "0 0 512 512"
140
- , path = "M208 48a160 160 0 1 1 0 320 160 160 0 1 1 0-320zm0 368c48.8 0 93.7-16.8 129.1-44.9L471 505c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L371.1 337.1C399.2 301.7 416 256.8 416 208C416 93.1 322.9 0 208 0S0 93.1 0 208S93.1 416 208 416zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"
141
- }
142
-
143
-
144
- makeSvgIcon :
145
- { path : String
146
- , viewBox : String
147
- }
148
- -> Html msg
149
- makeSvgIcon details =
150
- svg
151
- [ viewBox details.viewBox
152
- , width "100%"
153
- , height "100%"
154
- , fill "currentColor"
155
- ]
156
- [ Svg.path
157
- [ d details.path ]
158
- []
159
- ]
@@ -1,363 +0,0 @@
1
- module View.ManifestInfoModal exposing (viewManifestInfoModal)
2
-
3
- import Html exposing (Html, a, div, img, text)
4
- import Html.Attributes as HA exposing (alt, href, rel, src, target)
5
- import IIIF.Image exposing (ImageSize(..), createImageAddress, parseImageAddress, setImageUriSize)
6
- import IIIF.Language exposing (Language(..), extractLabelFromLanguageMap)
7
- import IIIF.Presentation exposing (Behavior(..), HomePage, IIIFManifest(..), Logo, Provider, ViewingDirection(..), ViewingHint(..), ViewingLayout(..), toCanvases, toHomepage, toLogo, toProvider, toRanges)
8
- import IIIF.Version exposing (IIIFVersion(..))
9
- import Model exposing (Model, ResourceResponse(..), currentManifest)
10
- import Msg exposing (Msg(..))
11
- import View.Helpers exposing (emptyHtml, viewButton, viewMaybe)
12
- import View.HtmlRenderer as HtmlRenderer
13
- import View.Icons as Icons
14
-
15
-
16
- viewManifestInfoModal : Model -> Html Msg
17
- viewManifestInfoModal model =
18
- if model.manifestInfoOpen then
19
- div
20
- [ HA.class "modal-overlay" ]
21
- [ div
22
- [ HA.class "modal is-narrow" ]
23
- [ viewHeader model
24
- , currentManifest model
25
- |> viewBody model
26
- ]
27
- ]
28
-
29
- else
30
- emptyHtml
31
-
32
-
33
- behaviorLabel : Behavior -> String
34
- behaviorLabel behavior =
35
- case behavior of
36
- AutoAdvanceBehavior ->
37
- "Auto-advance"
38
-
39
- NoAutoAdvanceBehavior ->
40
- "No auto-advance"
41
-
42
- RepeatBehavior ->
43
- "Repeat"
44
-
45
- NoRepeatBehavior ->
46
- "No repeat"
47
-
48
- UnorderedBehavior ->
49
- "Unordered"
50
-
51
- IndividualsBehavior ->
52
- "Individuals"
53
-
54
- ContinuousBehavior ->
55
- "Continuous"
56
-
57
- PagedBehavior ->
58
- "Paged"
59
-
60
- FacingPagesBehavior ->
61
- "Facing pages"
62
-
63
- NonPagedBehavior ->
64
- "Non-paged"
65
-
66
- MultiPartBehavior ->
67
- "Multi-part"
68
-
69
- TogetherBehavior ->
70
- "Together"
71
-
72
- SequenceBehavior ->
73
- "Sequence"
74
-
75
- ThumbnailNavBehavior ->
76
- "Thumbnail nav"
77
-
78
- NoNavBehavior ->
79
- "No nav"
80
-
81
- HiddenBehavior ->
82
- "Hidden"
83
-
84
-
85
- buildRows : Model -> IIIFManifest -> List ( String, Html Msg )
86
- buildRows model manifest =
87
- let
88
- (IIIFManifest version innerManifest) =
89
- manifest
90
-
91
- manifestUrl =
92
- case model.resourceResponse of
93
- ResourceLoadedManifest _ ->
94
- model.manifestUrl
95
-
96
- ResourceLoadedCollection collectionState ->
97
- collectionState.selectedManifestId
98
- |> Maybe.withDefault model.manifestUrl
99
-
100
- _ ->
101
- model.manifestUrl
102
-
103
- iiifVersion =
104
- case version of
105
- IIIFV2 ->
106
- "IIIF v2"
107
-
108
- IIIFV3 ->
109
- "IIIF v3"
110
-
111
- viewingHintOrBehavior =
112
- viewingLayoutLabel innerManifest.viewingLayout
113
-
114
- viewingDirection =
115
- viewingDirectionLabel innerManifest.viewingDirection
116
-
117
- summaryText =
118
- innerManifest.summary
119
- |> Maybe.map (extractLabelFromLanguageMap model.detectedLanguage)
120
- |> Maybe.withDefault "None"
121
-
122
- canvasCount =
123
- toCanvases manifest
124
- |> List.length
125
- |> String.fromInt
126
-
127
- rangeCount =
128
- toRanges manifest
129
- |> Maybe.map List.length
130
- |> Maybe.withDefault 0
131
- |> String.fromInt
132
- in
133
- ( "Manifest URL"
134
- , a
135
- [ href manifestUrl
136
- , target "_blank"
137
- , rel "noopener noreferrer"
138
- ]
139
- [ text manifestUrl ]
140
- )
141
- :: (if List.isEmpty model.acceptHeaders then
142
- []
143
-
144
- else
145
- let
146
- acceptHeaders =
147
- String.join ", " model.acceptHeaders
148
- in
149
- [ ( "Accept Headers", text acceptHeaders ) ]
150
- )
151
- ++ [ ( "Detected User Language", text (languageLabel model.detectedLanguage) )
152
- , ( "IIIF Version", text iiifVersion )
153
- , ( "Viewing Hint / Behavior", text viewingHintOrBehavior )
154
- , ( "Viewing Direction", text viewingDirection )
155
- , ( "Summary"
156
- , if summaryText == "None" then
157
- text summaryText
158
-
159
- else
160
- div [] (HtmlRenderer.renderHtml summaryText)
161
- )
162
- , ( "Canvases", text canvasCount )
163
- , ( "Ranges", text rangeCount )
164
- ]
165
-
166
-
167
- languageLabel : Language -> String
168
- languageLabel language =
169
- case language of
170
- LanguageCode code ->
171
- code
172
-
173
- None ->
174
- "none"
175
-
176
- Default ->
177
- "default"
178
-
179
-
180
- logoIiifUrl : Logo -> Maybe String
181
- logoIiifUrl logo =
182
- case logo.service |> Maybe.andThen List.head of
183
- Just service ->
184
- parseImageAddress service.id
185
- |> Maybe.map (setImageUriSize (WidthOnlySize 256) >> createImageAddress)
186
-
187
- Nothing ->
188
- Just logo.id
189
-
190
-
191
- providerHomepage : Provider -> Maybe HomePage
192
- providerHomepage provider =
193
- provider.homepage
194
- |> Maybe.andThen List.head
195
-
196
-
197
- providerLogo : Provider -> Maybe Logo
198
- providerLogo provider =
199
- provider.logo
200
- |> Maybe.andThen List.head
201
-
202
-
203
- viewBody : Model -> Maybe IIIFManifest -> Html Msg
204
- viewBody model maybeManifest =
205
- let
206
- rows =
207
- Maybe.map (buildRows model) maybeManifest
208
- |> Maybe.withDefault [ ( "Manifest", text "Not loaded" ) ]
209
-
210
- logoBlock =
211
- viewMaybe (viewLogoBlock model.detectedLanguage) maybeManifest
212
- in
213
- div
214
- [ HA.class "modal-body is-two-column" ]
215
- [ div
216
- [ HA.class "metadata-body" ]
217
- (List.map viewRow rows)
218
- , div
219
- [ HA.class "manifest-info-logo-wrap" ]
220
- [ logoBlock ]
221
- ]
222
-
223
-
224
- viewHeader : { a | fullscreen : Bool } -> Html Msg
225
- viewHeader { fullscreen } =
226
- div
227
- [ HA.class "modal-header" ]
228
- [ div
229
- [ HA.class "modal-title" ]
230
- [ text "Manifest Info" ]
231
- , div
232
- [ HA.class "modal-actions" ]
233
- [ div
234
- [ HA.class "modal-close-action" ]
235
- [ viewButton
236
- { label = ""
237
- , icon = Icons.close
238
- , onClickMsg = Just UserClickedCloseManifestInfo
239
- , isFullscreen = fullscreen
240
- }
241
- ]
242
- ]
243
- ]
244
-
245
-
246
- viewLogoBlock : Language -> IIIFManifest -> Html Msg
247
- viewLogoBlock language manifest =
248
- let
249
- ( providerLogoImage, homepageLink ) =
250
- case toProvider manifest |> Maybe.andThen List.head of
251
- Just provider ->
252
- ( providerLogo provider
253
- , providerHomepage provider
254
- )
255
-
256
- Nothing ->
257
- ( Nothing
258
- , toHomepage manifest |> Maybe.andThen List.head
259
- )
260
-
261
- logoUrl =
262
- case providerLogoImage of
263
- Just logo ->
264
- logoIiifUrl logo
265
-
266
- Nothing ->
267
- toLogo manifest
268
- |> Maybe.map (.id >> setImageUriSize (WidthOnlySize 256) >> createImageAddress)
269
- in
270
- if logoUrl /= Nothing || homepageLink /= Nothing then
271
- div []
272
- [ viewMaybe
273
- (\url ->
274
- img
275
- [ HA.class "manifest-info-logo"
276
- , src url
277
- , alt "Manifest logo"
278
- ]
279
- []
280
- )
281
- logoUrl
282
- , viewMaybe
283
- (\page ->
284
- let
285
- labelText =
286
- extractLabelFromLanguageMap language page.label
287
- in
288
- a
289
- [ href page.id
290
- , target "_blank"
291
- , rel "noopener noreferrer"
292
- ]
293
- [ text labelText ]
294
- )
295
- homepageLink
296
- ]
297
-
298
- else
299
- emptyHtml
300
-
301
-
302
- viewRow : ( String, Html Msg ) -> Html Msg
303
- viewRow ( labelText, valueNode ) =
304
- div
305
- [ HA.class "metadata-item" ]
306
- [ div [ HA.class "metadata-label" ] [ text labelText ]
307
- , div [ HA.class "metadata-value" ] [ valueNode ]
308
- ]
309
-
310
-
311
- viewingDirectionLabel : ViewingDirection -> String
312
- viewingDirectionLabel direction =
313
- case direction of
314
- LeftToRight ->
315
- "Left to Right"
316
-
317
- RightToLeft ->
318
- "Right to Left"
319
-
320
- TopToBottom ->
321
- "Top to Bottom"
322
-
323
- BottomToTop ->
324
- "Bottom to Top"
325
-
326
-
327
- viewingHintLabel : ViewingHint -> String
328
- viewingHintLabel hint =
329
- case hint of
330
- PagedHint ->
331
- "Paged"
332
-
333
- IndividualsHint ->
334
- "Individuals"
335
-
336
- ContinuousHint ->
337
- "Continuous"
338
-
339
- MultiPartHint ->
340
- "Multi-part"
341
-
342
- NonPagedHint ->
343
- "Non-paged"
344
-
345
- TopHint ->
346
- "Top"
347
-
348
- FacingPagesHint ->
349
- "Facing pages"
350
-
351
-
352
- viewingLayoutLabel : ViewingLayout -> String
353
- viewingLayoutLabel layout =
354
- case layout of
355
- LayoutV2 hint ->
356
- "Hint: " ++ viewingHintLabel hint
357
-
358
- LayoutV3 behaviors ->
359
- if List.isEmpty behaviors then
360
- "Behavior: None"
361
-
362
- else
363
- "Behavior: " ++ String.join ", " (List.map behaviorLabel behaviors)