@canopy-iiif/app 0.8.3 → 0.8.5

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.
Files changed (36) hide show
  1. package/lib/build/build.js +2 -0
  2. package/lib/build/dev.js +38 -22
  3. package/lib/build/iiif.js +359 -83
  4. package/lib/build/mdx.js +12 -2
  5. package/lib/build/pages.js +15 -1
  6. package/lib/build/styles.js +53 -1
  7. package/lib/common.js +28 -6
  8. package/lib/components/navigation.js +308 -0
  9. package/lib/page-context.js +14 -0
  10. package/lib/search/search-app.jsx +177 -25
  11. package/lib/search/search-form-runtime.js +126 -19
  12. package/lib/search/search.js +130 -18
  13. package/package.json +4 -1
  14. package/ui/dist/index.mjs +204 -101
  15. package/ui/dist/index.mjs.map +4 -4
  16. package/ui/dist/server.mjs +167 -59
  17. package/ui/dist/server.mjs.map +4 -4
  18. package/ui/styles/_variables.scss +1 -0
  19. package/ui/styles/base/_common.scss +27 -5
  20. package/ui/styles/base/_heading.scss +2 -4
  21. package/ui/styles/base/index.scss +1 -0
  22. package/ui/styles/components/_card.scss +47 -4
  23. package/ui/styles/components/_sub-navigation.scss +76 -0
  24. package/ui/styles/components/header/_header.scss +1 -4
  25. package/ui/styles/components/header/_logo.scss +33 -10
  26. package/ui/styles/components/index.scss +1 -0
  27. package/ui/styles/components/search/_filters.scss +5 -7
  28. package/ui/styles/components/search/_form.scss +55 -17
  29. package/ui/styles/components/search/_results.scss +49 -14
  30. package/ui/styles/index.css +344 -56
  31. package/ui/styles/index.scss +2 -4
  32. package/ui/tailwind-canopy-iiif-plugin.js +10 -2
  33. package/ui/tailwind-canopy-iiif-preset.js +21 -19
  34. package/ui/theme.js +303 -0
  35. package/ui/styles/variables.emit.scss +0 -72
  36. package/ui/styles/variables.scss +0 -76
@@ -1,7 +1,5 @@
1
- @use "../variables" as *;
2
-
3
1
  h1 {
4
- font-family: $font-serif;
2
+ font-family: var(--font-serif);
5
3
  font-size: 2.618rem;
6
4
  line-height: 1.25;
7
5
  margin: 0 0 1rem 0;
@@ -9,7 +7,7 @@ h1 {
9
7
  }
10
8
 
11
9
  h2 {
12
- font-family: $font-serif;
10
+ font-family: var(--font-serif);
13
11
  font-size: 1.618rem;
14
12
  line-height: 1.25;
15
13
  margin: 0 0 0.618rem 0;
@@ -1,2 +1,3 @@
1
+ @use "variables";
1
2
  @use "./common";
2
3
  @use "./heading";
@@ -4,11 +4,13 @@
4
4
  text-decoration: none;
5
5
  color: inherit;
6
6
  // light gray border
7
- border: 1px solid rgb(230, 231, 234); /* slate-200 */
7
+ border: 1px solid var(--color-gray-200);
8
8
  border-radius: 0.5rem;
9
9
  overflow: hidden;
10
10
  transition: all 150ms cubic-bezier(0.22, 1, 0.36, 1);
11
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 3px 0 rgba(0, 0, 0, 0.05);
11
+ box-shadow:
12
+ 0 1px 3px 0 rgba(0, 0, 0, 0.05),
13
+ 0 1px 3px 0 rgba(0, 0, 0, 0.05);
12
14
 
13
15
  figure {
14
16
  margin: 0;
@@ -27,9 +29,15 @@
27
29
  width: 100%;
28
30
  height: 100%;
29
31
  object-fit: cover;
30
- display: block;
32
+ display: flex;
33
+ justify-content: center;
34
+ text-align: center;
35
+ flex-direction: column;
31
36
  opacity: 0;
32
37
  transition: opacity 500ms cubic-bezier(0.22, 1, 0.36, 1);
38
+ background: var(--color-gray-100);
39
+ color: var(--color-gray-600);
40
+ font-size: 83.333%;
33
41
  }
34
42
  }
35
43
 
@@ -64,6 +72,41 @@
64
72
  &:hover,
65
73
  &:focus {
66
74
  color: var(--color-brand-default);
67
- box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.07), 0 1px 2px 0 rgba(0, 0, 0, 0.07);
75
+ box-shadow:
76
+ 0 1px 2px 0 rgba(0, 0, 0, 0.07),
77
+ 0 1px 2px 0 rgba(0, 0, 0, 0.07);
78
+ }
79
+ }
80
+
81
+ .canopy-annotation-card {
82
+ @extend .canopy-card;
83
+
84
+ padding: 1rem;
85
+
86
+ mark {
87
+ color: var(--color-gray-900);
88
+ background-color: var(--color-brand-300);
89
+ padding: 0.1rem 0.25rem;
90
+ border-radius: 0.25rem;
91
+ margin: 0 -0.25rem;
92
+
93
+ mark::before,
94
+ mark::after {
95
+ clip-path: inset(100%);
96
+ clip: rect(1px, 1px, 1px, 1px);
97
+ height: 1px;
98
+ overflow: hidden;
99
+ position: absolute;
100
+ white-space: nowrap;
101
+ width: 1px;
102
+ }
103
+
104
+ mark::before {
105
+ content: " [highlight start] ";
106
+ }
107
+
108
+ mark::after {
109
+ content: " [highlight end] ";
110
+ }
68
111
  }
69
112
  }
@@ -0,0 +1,76 @@
1
+ .canopy-sub-navigation {
2
+ font-size: 0.95rem;
3
+ color: inherit;
4
+ }
5
+
6
+ .canopy-sub-navigation__heading {
7
+ font-weight: 600;
8
+ margin-bottom: 0.5rem;
9
+ }
10
+
11
+ .canopy-sub-navigation__list {
12
+ list-style: none;
13
+ margin: 0;
14
+ padding: 0;
15
+ }
16
+
17
+ .canopy-sub-navigation__item {
18
+ margin: 0;
19
+ padding: 0;
20
+ }
21
+
22
+ .canopy-sub-navigation__link {
23
+ display: block;
24
+ padding: 0.35rem 0.5rem;
25
+ border-radius: 0.375rem;
26
+ color: inherit;
27
+ text-decoration: none;
28
+ cursor: pointer;
29
+ transition:
30
+ background-color 120ms ease,
31
+ color 120ms ease;
32
+ }
33
+
34
+ .canopy-sub-navigation__link:hover {
35
+ color: var(--color-brand-default);
36
+ }
37
+
38
+ .canopy-sub-navigation__link.is-label {
39
+ cursor: default;
40
+ color: var(--color-gray-600, #52525b);
41
+ }
42
+
43
+ .canopy-sub-navigation__link.is-active {
44
+ color: var(--color-gray-900, #1d4ed8);
45
+ font-weight: 600;
46
+ }
47
+
48
+ .canopy-sub-navigation__list--nested {
49
+ margin: 0.35rem 0 0.35rem 0.5rem;
50
+ padding-left: 0.5rem;
51
+ border-left: 1px solid var(--color-gray-100, #e4e4e7);
52
+ }
53
+
54
+ .canopy-sub-navigation__link.depth-0 {
55
+ padding-left: 0.25rem;
56
+ }
57
+
58
+ .canopy-sub-navigation__link.depth-1 {
59
+ padding-left: calc(0.25rem);
60
+ }
61
+
62
+ .canopy-sub-navigation__link.depth-2 {
63
+ padding-left: calc(0.25rem * 2);
64
+ }
65
+
66
+ .canopy-sub-navigation__link.depth-3 {
67
+ padding-left: calc(0.25rem * 3);
68
+ }
69
+
70
+ .canopy-sub-navigation__link.depth-4 {
71
+ padding-left: calc(0.25rem * 4);
72
+ }
73
+
74
+ .canopy-sub-navigation__link.depth-5 {
75
+ padding-left: calc(0.25rem * 5);
76
+ }
@@ -1,5 +1,3 @@
1
- @use "../../variables" as *;
2
-
3
1
  @layer components {
4
2
  .canopy-header {
5
3
  display: flex;
@@ -7,7 +5,6 @@
7
5
  align-items: center;
8
6
  gap: 1.618rem;
9
7
  padding: 0.618rem 1rem;
10
- box-shadow: 5px 5px 19px rgba(0, 0, 0, 0.2);
11
- background: #fff;
8
+ background: var(--color-gray-50);
12
9
  }
13
10
  }
@@ -1,20 +1,43 @@
1
- @use "../../variables" as *;
2
-
3
- .canopy-logo {
1
+ a.canopy-logo {
4
2
  display: flex;
5
3
  align-items: center;
6
4
  gap: 0.618rem;
7
- font-weight: 400;
8
- font-size: 1.618rem;
9
- font-family: $font-serif;
10
- color: $color-gray-default;
5
+ font-weight: 600;
6
+ font-size: 1.382rem;
7
+ font-family: var(--font-serif);
8
+ color: var(--color-gray-default) !important;
9
+ letter-spacing: -0.025em;
10
+
11
+ &:hover {
12
+ text-decoration: none;
13
+ }
11
14
 
12
- img {
15
+ svg {
13
16
  height: 1.618rem;
14
17
  margin-bottom: -1px;
18
+
19
+ circle.canopy-logo-backlight {
20
+ fill: var(--color-brand-900);
21
+ color: var(--color-brand-900);
22
+ }
23
+
24
+ path.canopy-logo-overlay {
25
+ fill: var(--color-brand-default);
26
+ color: var(--color-brand-default);
27
+ }
15
28
  }
29
+ }
16
30
 
17
- &:hover {
18
- text-decoration: none;
31
+ html.dark a.canopy-logo {
32
+ svg {
33
+ circle.canopy-logo-backlight {
34
+ fill: var(--color-brand-200) !important;
35
+ color: var(--color-brand-200) !important;
36
+ }
37
+
38
+ path.canopy-logo-overlay {
39
+ fill: var(--color-brand-500) !important;
40
+ color: var(--color-brand-500) !important;
41
+ }
19
42
  }
20
43
  }
@@ -2,3 +2,4 @@
2
2
  @use "./header";
3
3
  @use "./hero";
4
4
  @use "./search";
5
+ @use "./sub-navigation";
@@ -1,5 +1,3 @@
1
- @use '../../variables' as *;
2
-
3
1
  .canopy-search-filters-overlay {
4
2
  position: fixed;
5
3
  inset: 0;
@@ -17,7 +15,7 @@
17
15
  max-width: 48rem;
18
16
  overflow: hidden;
19
17
  border-radius: 0.75rem;
20
- background: #fff;
18
+ background: var(--color-gray-100, #ffffff);
21
19
  box-shadow:
22
20
  0 25px 50px -12px rgba(15, 23, 42, 0.4),
23
21
  0 10px 20px rgba(15, 23, 42, 0.12);
@@ -91,7 +89,7 @@
91
89
  overflow: hidden;
92
90
 
93
91
  &[open] {
94
- background: #fff;
92
+ background: var(--color-gray-100, #ffffff);
95
93
  }
96
94
  }
97
95
 
@@ -120,7 +118,7 @@
120
118
 
121
119
  .canopy-search-filters__facet-content {
122
120
  border-top: 1px solid var(--color-gray-200, #e0e1e6);
123
- background: #fff;
121
+ background: var(--color-gray-100, #ffffff);
124
122
  padding: 1rem;
125
123
  max-height: 15rem;
126
124
  overflow-y: auto;
@@ -157,7 +155,7 @@
157
155
  padding: 0.25rem 0.5rem;
158
156
  font-size: var(--font-size-xs, 0.75rem);
159
157
  color: var(--color-gray-600, #80838d);
160
- background: #fff;
158
+ background: var(--color-gray-100, #ffffff);
161
159
  transition: background-color var(--duration-fast, 150ms) var(--easing-standard, ease),
162
160
  color var(--duration-fast, 150ms) var(--easing-standard, ease);
163
161
 
@@ -238,7 +236,7 @@
238
236
 
239
237
  .canopy-search-filters__button--secondary {
240
238
  border: 1px solid var(--color-gray-200, #e0e1e6);
241
- background: #fff;
239
+ background: var(--color-gray-100, #ffffff);
242
240
  color: var(--color-gray-600, #80838d);
243
241
 
244
242
  &:hover:not([disabled]) {
@@ -1,11 +1,13 @@
1
- @use "../../variables" as *;
2
-
3
1
  .canopy-search-form-shell {
4
2
  --search-form-label-padding-x: 0.75rem;
5
3
  --search-form-label-padding-y: 0.625rem;
6
4
  position: relative;
7
5
  backdrop-filter: blur(12px);
8
- background-color: color-mix(in srgb, #fff 95%, transparent);
6
+ background-color: color-mix(
7
+ in srgb,
8
+ var(--color-gray-100, #f0f0f3) 95%,
9
+ transparent
10
+ );
9
11
  transition:
10
12
  box-shadow var(--duration-fast, 150ms) ease,
11
13
  background-color var(--duration-fast, 150ms) ease;
@@ -36,9 +38,13 @@
36
38
  );
37
39
  }
38
40
 
39
- &:focus-within::after,
40
- &[data-has-value="1"]::after {
41
- opacity: 0;
41
+ svg {
42
+ width: 1.25rem;
43
+ height: 1.25rem;
44
+ flex-shrink: 0;
45
+ fill: var(--color-gray-400, #b9bbc6);
46
+ pointer-events: none;
47
+ transition: fill var(--duration-fast, 150ms) var(--easing-standard, ease);
42
48
  }
43
49
 
44
50
  input[data-canopy-search-form-input] {
@@ -47,12 +53,23 @@
47
53
  outline: none;
48
54
  background: transparent;
49
55
  box-shadow: none;
50
- opacity: 0;
51
56
  caret-color: transparent;
52
57
  transition: opacity var(--duration-fast, 150ms) ease;
53
58
  }
54
59
 
55
- &:focus-within input[data-canopy-search-form-input],
60
+ &:focus-within {
61
+ background-color: var(--color-brand-100);
62
+
63
+ input[data-canopy-search-form-input] {
64
+ opacity: 1;
65
+ caret-color: var(--color-gray-900, #121418);
66
+ }
67
+
68
+ svg {
69
+ fill: var(--color-brand-default, #3e63dd);
70
+ }
71
+ }
72
+
56
73
  &[data-has-value="1"] input[data-canopy-search-form-input] {
57
74
  opacity: 1;
58
75
  caret-color: var(--color-gray-900, #121418);
@@ -101,13 +118,33 @@
101
118
  padding: var(--search-form-label-padding-y) var(--search-form-label-padding-x);
102
119
  }
103
120
 
104
- .canopy-search-form__icon {
105
- width: 1.25rem;
106
- height: 1.25rem;
107
- flex-shrink: 0;
108
- color: var(--color-gray-400, #b9bbc6);
109
- pointer-events: none;
121
+ .canopy-search-form__clear {
122
+ border: 0;
123
+ background: transparent;
124
+ color: rgba(100, 116, 139, 0.9);
125
+ font-size: 1.25rem;
126
+ line-height: 1;
127
+ padding: 0 0.25rem;
128
+ margin-right: 0.25rem;
129
+ display: inline-flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ cursor: pointer;
110
133
  transition: color var(--duration-fast, 150ms) var(--easing-standard, ease);
134
+
135
+ &:hover,
136
+ &:focus-visible {
137
+ color: var(--color-brand-600, #3e63dd);
138
+ }
139
+
140
+ &:focus-visible {
141
+ outline: none;
142
+ box-shadow:
143
+ 0 0 0 2px var(--color-gray-100, #ffffff),
144
+ 0 0 0 4px
145
+ color-mix(in srgb, var(--color-brand-500, #3e63dd) 65%, transparent);
146
+ border-radius: 999px;
147
+ }
111
148
  }
112
149
 
113
150
  .canopy-search-form__input {
@@ -134,8 +171,9 @@
134
171
  align-items: center;
135
172
  gap: 0.382rem;
136
173
  border-radius: 0.382rem;
174
+ margin-right: 1px;
137
175
  border: 0;
138
- background: $color-brand-default;
176
+ background: var(--color-brand-default);
139
177
  color: #fff;
140
178
  font-weight: 400;
141
179
  font-size: 1rem;
@@ -147,14 +185,14 @@
147
185
 
148
186
  &:hover,
149
187
  &:focus-visible {
150
- background: $color-brand-800;
188
+ background: var(--color-brand-800);
151
189
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, 0.1));
152
190
  }
153
191
 
154
192
  &:focus-visible {
155
193
  outline: none;
156
194
  box-shadow:
157
- 0 0 0 2px #fff,
195
+ 0 0 0 2px var(--color-gray-100, #ffffff),
158
196
  0 0 0 4px
159
197
  color-mix(in srgb, var(--color-brand-500, #3e63dd) 65%, transparent);
160
198
  }
@@ -1,4 +1,38 @@
1
- @use '../../variables' as *;
1
+ .canopy-search-tabs-wrapper {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ align-items: center;
5
+ justify-content: space-between;
6
+ }
7
+
8
+ .canopy-search-results {
9
+ padding: 1.618rem;
10
+ }
11
+
12
+ .canopy-search-tabs {
13
+ display: flex;
14
+ align-items: center;
15
+ gap: 0.5rem;
16
+ margin-bottom: 1rem;
17
+
18
+ button {
19
+ background: none;
20
+ border: none;
21
+ padding: 0.382rem 0.618rem;
22
+ font-size: 1rem;
23
+ cursor: pointer;
24
+ color: var(--color-gray-600);
25
+ transition: all 0.2s ease-in-out;
26
+
27
+ &.active,
28
+ &:hover {
29
+ color: var(--color-brand-default);
30
+ background-color: var(--color-brand-100);
31
+ border-radius: 0.382rem;
32
+ font-weight: 400;
33
+ }
34
+ }
35
+ }
2
36
 
3
37
  .canopy-search-form-modal {
4
38
  .canopy-search-form-modal__trigger {
@@ -6,9 +40,9 @@
6
40
  align-items: center;
7
41
  gap: 0.25rem;
8
42
  padding: 0.25rem 0.5rem;
9
- border: 1px solid #e5e7eb;
10
- color: #374151;
11
- background: #fff;
43
+ border: 1px solid var(--color-gray-200, #e5e7eb);
44
+ color: var(--color-gray-700, #374151);
45
+ background: var(--color-gray-100, #ffffff);
12
46
  border-radius: 6px;
13
47
  cursor: pointer;
14
48
  }
@@ -26,7 +60,7 @@
26
60
 
27
61
  .canopy-search-form-modal__panel {
28
62
  position: relative;
29
- background: #fff;
63
+ background: var(--color-gray-100, #ffffff);
30
64
  min-width: 320px;
31
65
  max-width: 720px;
32
66
  width: 90%;
@@ -37,8 +71,8 @@
37
71
  --canopy-font-sans,
38
72
  system-ui,
39
73
  -apple-system,
40
- 'Segoe UI',
41
- 'Helvetica Neue',
74
+ "Segoe UI",
75
+ "Helvetica Neue",
42
76
  Helvetica,
43
77
  Arial,
44
78
  sans-serif
@@ -49,8 +83,8 @@
49
83
  position: absolute;
50
84
  top: 8px;
51
85
  right: 8px;
52
- border: 1px solid #e5e7eb;
53
- background: #fff;
86
+ border: 1px solid var(--color-gray-200, #e5e7eb);
87
+ background: var(--color-gray-100, #ffffff);
54
88
  border-radius: 6px;
55
89
  padding: 2px 6px;
56
90
  cursor: pointer;
@@ -58,13 +92,13 @@
58
92
 
59
93
  .canopy-search-form-modal__inputWrap {
60
94
  padding: 10px 12px;
61
- border-bottom: 1px solid #e5e7eb;
95
+ border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
62
96
  }
63
97
 
64
98
  .canopy-search-form-modal__input {
65
99
  width: 100%;
66
100
  padding: 8px 10px;
67
- border: 1px solid #e5e7eb;
101
+ border: 1px solid var(--color-gray-200, #e5e7eb);
68
102
  border-radius: 6px;
69
103
  outline: none;
70
104
  }
@@ -105,8 +139,8 @@
105
139
  left: 0;
106
140
  right: 0;
107
141
  top: calc(100% + 4px);
108
- background: #fff;
109
- border: 1px solid #e5e7eb;
142
+ background: var(--color-gray-100, #ffffff);
143
+ border: 1px solid var(--color-gray-200, #e5e7eb);
110
144
  border-radius: 8px;
111
145
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
112
146
  z-index: 1000;
@@ -116,6 +150,7 @@
116
150
  display: none;
117
151
  }
118
152
 
119
- .relative[data-canopy-search-form-auto='1']:focus-within [data-canopy-search-form-panel] {
153
+ .relative[data-canopy-search-form-auto="1"]:focus-within
154
+ [data-canopy-search-form-panel] {
120
155
  display: block;
121
156
  }