@internetarchive/ia-topnav 1.1.19 → 1.1.21-alpha

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 (89) hide show
  1. package/.eslintrc +16 -16
  2. package/.storybook/.babelrc +15 -15
  3. package/.storybook/addons.js +7 -7
  4. package/.storybook/config.js +11 -11
  5. package/.storybook/webpack.config.js +5 -5
  6. package/LICENSE +661 -661
  7. package/README.md +145 -145
  8. package/demo.html +41 -41
  9. package/index.d.ts +105 -105
  10. package/index.js +3 -3
  11. package/package.json +65 -65
  12. package/src/assets/img/hamburger.js +36 -36
  13. package/src/assets/img/ia-icon.js +33 -33
  14. package/src/assets/img/icon-audio.js +23 -23
  15. package/src/assets/img/icon-close.js +16 -16
  16. package/src/assets/img/icon-donate.js +15 -15
  17. package/src/assets/img/icon-ellipses.js +15 -15
  18. package/src/assets/img/icon-ia-logo.js +24 -24
  19. package/src/assets/img/icon-images.js +15 -15
  20. package/src/assets/img/icon-search.js +15 -15
  21. package/src/assets/img/icon-software.js +15 -15
  22. package/src/assets/img/icon-texts.js +15 -15
  23. package/src/assets/img/icon-upload.js +15 -15
  24. package/src/assets/img/icon-user.js +15 -15
  25. package/src/assets/img/icon-video.js +15 -15
  26. package/src/assets/img/icon-web.js +15 -15
  27. package/src/assets/img/icon.js +18 -18
  28. package/src/assets/img/icons.js +29 -29
  29. package/src/assets/img/user.js +38 -38
  30. package/src/assets/img/wordmark-stacked.js +13 -13
  31. package/src/data/menus.js +603 -603
  32. package/src/desktop-subnav.js +45 -45
  33. package/src/dropdown-menu.js +98 -98
  34. package/src/ia-topnav.js +285 -285
  35. package/src/lib/formatUrl.js +1 -1
  36. package/src/lib/location-handler.js +5 -5
  37. package/src/lib/query-handler.js +7 -7
  38. package/src/lib/toSentenceCase.js +8 -8
  39. package/src/login-button.js +79 -79
  40. package/src/media-button.js +113 -113
  41. package/src/media-menu.js +133 -133
  42. package/src/media-slider.js +104 -104
  43. package/src/media-subnav.js +112 -112
  44. package/src/more-slider.js +33 -33
  45. package/src/nav-search.js +124 -124
  46. package/src/primary-nav.js +211 -211
  47. package/src/save-page-form.js +59 -59
  48. package/src/search-menu.js +115 -115
  49. package/src/signed-out-dropdown.js +10 -10
  50. package/src/styles/base.js +48 -48
  51. package/src/styles/desktop-subnav.js +37 -37
  52. package/src/styles/dropdown-menu.js +143 -143
  53. package/src/styles/ia-topnav.js +88 -88
  54. package/src/styles/login-button.js +70 -70
  55. package/src/styles/media-button.js +153 -153
  56. package/src/styles/media-menu.js +70 -70
  57. package/src/styles/media-slider.js +81 -81
  58. package/src/styles/media-subnav.js +156 -156
  59. package/src/styles/more-slider.js +15 -15
  60. package/src/styles/nav-search.js +134 -130
  61. package/src/styles/primary-nav.js +254 -254
  62. package/src/styles/save-page-form.js +53 -52
  63. package/src/styles/search-menu.js +104 -103
  64. package/src/styles/signed-out-dropdown.js +31 -31
  65. package/src/styles/user-menu.js +31 -31
  66. package/src/styles/wayback-search.js +48 -48
  67. package/src/styles/wayback-slider.js +30 -30
  68. package/src/tracked-element.js +27 -27
  69. package/src/user-menu.js +42 -42
  70. package/src/wayback-search.js +18 -18
  71. package/src/wayback-slider.js +88 -88
  72. package/stories/topnav-element.stories.js +7 -7
  73. package/test/assets/img/hamburger.test.js +15 -15
  74. package/test/assets/img/user.test.js +15 -15
  75. package/test/data/menus.test.js +19 -19
  76. package/test/dropdown-menu.test.js +25 -25
  77. package/test/ia-icon.test.js +13 -13
  78. package/test/ia-topnav.test.js +273 -273
  79. package/test/login-button.test.js +15 -15
  80. package/test/media-button.test.js +19 -19
  81. package/test/media-menu.test.js +40 -40
  82. package/test/media-slider.test.js +57 -57
  83. package/test/more-slider.test.js +13 -13
  84. package/test/nav-search.test.js +61 -61
  85. package/test/primary-nav.test.js +82 -82
  86. package/test/save-page-form.test.js +35 -35
  87. package/test/search-menu.test.js +49 -49
  88. package/test/user-menu.test.js +33 -33
  89. package/test/wayback-slider.test.js +80 -80
package/src/ia-topnav.js CHANGED
@@ -1,285 +1,285 @@
1
- import { LitElement, html, nothing } from 'https://offshoot.ux.archive.org/lit.js';
2
-
3
- import './primary-nav.js';
4
- import './user-menu.js';
5
- import './search-menu.js';
6
- import './media-slider.js';
7
- import './desktop-subnav.js';
8
- import './dropdown-menu.js';
9
- import './signed-out-dropdown.js';
10
- import iaTopNavCSS from './styles/ia-topnav.js';
11
- import { buildTopNavMenus, defaultTopNavConfig } from './data/menus.js';
12
-
13
- export default class IATopNav extends LitElement {
14
- static get styles() {
15
- return iaTopNavCSS;
16
- }
17
-
18
- // NOTE:
19
- // When adding properties, also add them to index.d.ts in the root `ia-topnav` directory
20
- // so Typescript can find them
21
- static get properties() {
22
- return {
23
- // we default to fully-qualified `https://archive.org` urls in nav, set to false for relatives
24
- localLinks: Boolean,
25
- // @see `data/menus.js` for a description:
26
- waybackPagesArchived: String,
27
- // the base host is for navigation, so may be empty for relative links
28
- baseHost: { type: String },
29
- // the media base host is the base host for images, such as the profile picture
30
- // which may not be hosted locally
31
- mediaBaseHost: { type: String },
32
- config: {
33
- type: Object,
34
- converter(value) {
35
- return JSON.parse(atob(value));
36
- },
37
- },
38
- hideSearch: { type: Boolean },
39
- mediaSliderOpen: { type: Boolean },
40
- menus: {
41
- type: Object,
42
- converter(value) {
43
- return JSON.parse(atob(value));
44
- },
45
- },
46
- openMenu: { type: String },
47
- screenName: { type: String },
48
- searchIn: { type: String },
49
- searchQuery: {
50
- type: String,
51
- converter(value) {
52
- return atob(value);
53
- },
54
- },
55
- selectedMenuOption: { type: String },
56
- username: { type: String },
57
- userProfileImagePath: { type: String },
58
- userProfileLastModified: { type: String },
59
- secondIdentitySlotMode: { type: String },
60
- };
61
- }
62
-
63
- constructor() {
64
- super();
65
- this.menuSetup();
66
- this.mediaBaseHost = 'https://archive.org';
67
- this.userProfileImagePath = '/services/img/user/profile';
68
- this.userProfileLastModified = '';
69
- this.config = defaultTopNavConfig;
70
- this.hideSearch = false;
71
- this.mediaSliderOpen = false;
72
- this.openMenu = '';
73
- this.searchIn = '';
74
- this.selectedMenuOption = '';
75
- this.secondIdentitySlotMode = '';
76
- }
77
-
78
- updated(props) {
79
- if (props.has('username') || props.has('localLinks') || props.has('baseHost') ||
80
- props.has('waybackPagesArchived')) {
81
- this.menuSetup();
82
- }
83
- }
84
-
85
- menuSetup() {
86
- this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
87
- this.username = this.getAttribute('username')
88
- this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
89
-
90
- // ensure we update other components that use `baseHost`
91
- this.baseHost = this.localLinks ? '' : 'https://archive.org';
92
-
93
- // re/build the nav
94
- this.menus = buildTopNavMenus(this.username, this.localLinks, this.waybackPagesArchived);
95
- }
96
-
97
- menuToggled({ detail }) {
98
- const currentMenu = this.openMenu;
99
- this.openMenu = currentMenu === detail.menuName ? '' : detail.menuName;
100
- // Keeps media slider open if media menu is open
101
- if (this.openMenu === 'media') {
102
- return;
103
- }
104
- this.closeMediaSlider();
105
- }
106
-
107
- openMediaSlider() {
108
- this.mediaSliderOpen = true;
109
- }
110
-
111
- closeMediaSlider() {
112
- this.mediaSliderOpen = false;
113
- this.selectedMenuOption = '';
114
- }
115
-
116
- closeMenus() {
117
- this.openMenu = '';
118
- this.closeMediaSlider();
119
- }
120
-
121
- searchInChanged(e) {
122
- this.searchIn = e.detail.searchIn;
123
- }
124
-
125
- trackClick({ detail }) {
126
- this.dispatchEvent(new CustomEvent('analyticsClick', {
127
- bubbles: true,
128
- composed: true,
129
- detail,
130
- }));
131
- }
132
-
133
- trackSubmit({ detail }) {
134
- this.dispatchEvent(new CustomEvent('analyticsSubmit', {
135
- bubbles: true,
136
- composed: true,
137
- detail,
138
- }));
139
- }
140
-
141
- mediaTypeSelected({ detail }) {
142
- if (this.selectedMenuOption === detail.mediatype) {
143
- this.closeMediaSlider();
144
- return;
145
- }
146
- this.selectedMenuOption = detail.mediatype;
147
- this.openMediaSlider();
148
- }
149
-
150
- get searchMenuOpened() {
151
- return this.openMenu === 'search';
152
- }
153
-
154
- get signedOutOpened() {
155
- return this.openMenu === 'login';
156
- }
157
-
158
- get userMenuOpened() {
159
- return this.openMenu === 'user';
160
- }
161
-
162
- get searchMenuTabIndex() {
163
- return this.searchMenuOpened ? '' : '-1';
164
- }
165
-
166
- get userMenuTabIndex() {
167
- return this.userMenuOpened ? '' : '-1';
168
- }
169
-
170
- get signedOutTabIndex() {
171
- return this.signedOutOpened ? '' : '-1';
172
- }
173
-
174
- get closeLayerClass() {
175
- return !!this.openMenu || this.mediaSliderOpen ? 'visible' : '';
176
- }
177
-
178
- get userMenu() {
179
- return html`
180
- <user-menu
181
- .baseHost=${this.baseHost}
182
- .config=${this.config}
183
- .menuItems=${this.userMenuItems}
184
- ?open=${this.openMenu === 'user'}
185
- .username=${this.username}
186
- ?hideSearch=${this.hideSearch}
187
- tabindex="${this.userMenuTabIndex}"
188
- @menuToggled=${this.menuToggled}
189
- @trackClick=${this.trackClick}
190
- ></user-menu>
191
- `;
192
- }
193
-
194
- get signedOutDropdown() {
195
- return html`
196
- <signed-out-dropdown
197
- .baseHost=${this.baseHost}
198
- .config=${this.config}
199
- .open=${this.signedOutOpened}
200
- ?hideSearch=${this.hideSearch}
201
- tabindex="${this.signedOutTabIndex}"
202
- .menuItems=${this.signedOutMenuItems}
203
- ></signed-out-dropdown>
204
- `;
205
- }
206
-
207
- get signedOutMenuItems() {
208
- return this.menus.signedOut;
209
- }
210
-
211
- get userMenuItems() {
212
- return this.menus.user;
213
- }
214
-
215
- get desktopSubnavMenuItems() {
216
- return this.menus.more;
217
- }
218
-
219
- get allowSecondaryIcon() {
220
- return this.secondIdentitySlotMode === 'allow';
221
- }
222
-
223
- get secondLogoSlot() {
224
- return this.allowSecondaryIcon
225
- ? html`
226
- <slot name="opt-sec-logo" slot="opt-sec-logo"></slot>
227
- <slot name="opt-sec-logo-mobile" slot="opt-sec-logo-mobile"></slot>
228
- `
229
- : nothing;
230
- }
231
-
232
- render() {
233
- return html`
234
- <div class="topnav">
235
- <primary-nav
236
- .baseHost=${this.baseHost}
237
- .mediaBaseHost=${this.mediaBaseHost}
238
- .config=${this.config}
239
- .openMenu=${this.openMenu}
240
- .screenName=${this.screenName}
241
- .searchIn=${this.searchIn}
242
- .searchQuery=${this.searchQuery}
243
- .secondIdentitySlotMode=${this.secondIdentitySlotMode}
244
- .selectedMenuOption=${this.selectedMenuOption}
245
- .username=${this.username}
246
- .userProfileImagePath=${this.userProfileImagePath}
247
- .userProfileLastModified=${this.userProfileLastModified}
248
- ?hideSearch=${this.hideSearch}
249
- @mediaTypeSelected=${this.mediaTypeSelected}
250
- @toggleSearchMenu=${this.toggleSearchMenu}
251
- @trackClick=${this.trackClick}
252
- @trackSubmit=${this.trackSubmit}
253
- @menuToggled=${this.menuToggled}
254
- >
255
- ${this.secondLogoSlot}
256
- </primary-nav>
257
- <media-slider
258
- .baseHost=${this.baseHost}
259
- .config=${this.config}
260
- .selectedMenuOption=${this.selectedMenuOption}
261
- .mediaSliderOpen=${this.mediaSliderOpen}
262
- .menus=${this.menus}
263
- ></media-slider>
264
- </div>
265
- ${this.username ? this.userMenu : this.signedOutDropdown}
266
- <search-menu
267
- .baseHost=${this.baseHost}
268
- .config=${this.config}
269
- .openMenu=${this.openMenu}
270
- tabindex="${this.searchMenuTabIndex}"
271
- ?hideSearch=${this.hideSearch}
272
- @searchInChanged=${this.searchInChanged}
273
- @trackClick=${this.trackClick}
274
- @trackSubmit=${this.trackSubmit}
275
- ></search-menu>
276
- <desktop-subnav
277
- .baseHost=${this.baseHost}
278
- .menuItems=${this.desktopSubnavMenuItems}
279
- ></desktop-subnav>
280
- <div id="close-layer" class="${this.closeLayerClass}" @click=${this.closeMenus}></div>
281
- `;
282
- }
283
- }
284
-
285
- customElements.define('ia-topnav', IATopNav);
1
+ import { LitElement, html, nothing } from 'https://offshoot.ux.archive.org/lit.js';
2
+
3
+ import './primary-nav.js';
4
+ import './user-menu.js';
5
+ import './search-menu.js';
6
+ import './media-slider.js';
7
+ import './desktop-subnav.js';
8
+ import './dropdown-menu.js';
9
+ import './signed-out-dropdown.js';
10
+ import iaTopNavCSS from './styles/ia-topnav.js';
11
+ import { buildTopNavMenus, defaultTopNavConfig } from './data/menus.js';
12
+
13
+ export default class IATopNav extends LitElement {
14
+ static get styles() {
15
+ return iaTopNavCSS;
16
+ }
17
+
18
+ // NOTE:
19
+ // When adding properties, also add them to index.d.ts in the root `ia-topnav` directory
20
+ // so Typescript can find them
21
+ static get properties() {
22
+ return {
23
+ // we default to fully-qualified `https://archive.org` urls in nav, set to false for relatives
24
+ localLinks: Boolean,
25
+ // @see `data/menus.js` for a description:
26
+ waybackPagesArchived: String,
27
+ // the base host is for navigation, so may be empty for relative links
28
+ baseHost: { type: String },
29
+ // the media base host is the base host for images, such as the profile picture
30
+ // which may not be hosted locally
31
+ mediaBaseHost: { type: String },
32
+ config: {
33
+ type: Object,
34
+ converter(value) {
35
+ return JSON.parse(atob(value));
36
+ },
37
+ },
38
+ hideSearch: { type: Boolean },
39
+ mediaSliderOpen: { type: Boolean },
40
+ menus: {
41
+ type: Object,
42
+ converter(value) {
43
+ return JSON.parse(atob(value));
44
+ },
45
+ },
46
+ openMenu: { type: String },
47
+ screenName: { type: String },
48
+ searchIn: { type: String },
49
+ searchQuery: {
50
+ type: String,
51
+ converter(value) {
52
+ return atob(value);
53
+ },
54
+ },
55
+ selectedMenuOption: { type: String },
56
+ username: { type: String },
57
+ userProfileImagePath: { type: String },
58
+ userProfileLastModified: { type: String },
59
+ secondIdentitySlotMode: { type: String },
60
+ };
61
+ }
62
+
63
+ constructor() {
64
+ super();
65
+ this.menuSetup();
66
+ this.mediaBaseHost = 'https://archive.org';
67
+ this.userProfileImagePath = '/services/img/user/profile';
68
+ this.userProfileLastModified = '';
69
+ this.config = defaultTopNavConfig;
70
+ this.hideSearch = false;
71
+ this.mediaSliderOpen = false;
72
+ this.openMenu = '';
73
+ this.searchIn = '';
74
+ this.selectedMenuOption = '';
75
+ this.secondIdentitySlotMode = '';
76
+ }
77
+
78
+ updated(props) {
79
+ if (props.has('username') || props.has('localLinks') || props.has('baseHost') ||
80
+ props.has('waybackPagesArchived')) {
81
+ this.menuSetup();
82
+ }
83
+ }
84
+
85
+ menuSetup() {
86
+ this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
87
+ this.username = this.getAttribute('username')
88
+ this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
89
+
90
+ // ensure we update other components that use `baseHost`
91
+ this.baseHost = this.localLinks ? '' : 'https://archive.org';
92
+
93
+ // re/build the nav
94
+ this.menus = buildTopNavMenus(this.username, this.localLinks, this.waybackPagesArchived);
95
+ }
96
+
97
+ menuToggled({ detail }) {
98
+ const currentMenu = this.openMenu;
99
+ this.openMenu = currentMenu === detail.menuName ? '' : detail.menuName;
100
+ // Keeps media slider open if media menu is open
101
+ if (this.openMenu === 'media') {
102
+ return;
103
+ }
104
+ this.closeMediaSlider();
105
+ }
106
+
107
+ openMediaSlider() {
108
+ this.mediaSliderOpen = true;
109
+ }
110
+
111
+ closeMediaSlider() {
112
+ this.mediaSliderOpen = false;
113
+ this.selectedMenuOption = '';
114
+ }
115
+
116
+ closeMenus() {
117
+ this.openMenu = '';
118
+ this.closeMediaSlider();
119
+ }
120
+
121
+ searchInChanged(e) {
122
+ this.searchIn = e.detail.searchIn;
123
+ }
124
+
125
+ trackClick({ detail }) {
126
+ this.dispatchEvent(new CustomEvent('analyticsClick', {
127
+ bubbles: true,
128
+ composed: true,
129
+ detail,
130
+ }));
131
+ }
132
+
133
+ trackSubmit({ detail }) {
134
+ this.dispatchEvent(new CustomEvent('analyticsSubmit', {
135
+ bubbles: true,
136
+ composed: true,
137
+ detail,
138
+ }));
139
+ }
140
+
141
+ mediaTypeSelected({ detail }) {
142
+ if (this.selectedMenuOption === detail.mediatype) {
143
+ this.closeMediaSlider();
144
+ return;
145
+ }
146
+ this.selectedMenuOption = detail.mediatype;
147
+ this.openMediaSlider();
148
+ }
149
+
150
+ get searchMenuOpened() {
151
+ return this.openMenu === 'search';
152
+ }
153
+
154
+ get signedOutOpened() {
155
+ return this.openMenu === 'login';
156
+ }
157
+
158
+ get userMenuOpened() {
159
+ return this.openMenu === 'user';
160
+ }
161
+
162
+ get searchMenuTabIndex() {
163
+ return this.searchMenuOpened ? '' : '-1';
164
+ }
165
+
166
+ get userMenuTabIndex() {
167
+ return this.userMenuOpened ? '' : '-1';
168
+ }
169
+
170
+ get signedOutTabIndex() {
171
+ return this.signedOutOpened ? '' : '-1';
172
+ }
173
+
174
+ get closeLayerClass() {
175
+ return !!this.openMenu || this.mediaSliderOpen ? 'visible' : '';
176
+ }
177
+
178
+ get userMenu() {
179
+ return html`
180
+ <user-menu
181
+ .baseHost=${this.baseHost}
182
+ .config=${this.config}
183
+ .menuItems=${this.userMenuItems}
184
+ ?open=${this.openMenu === 'user'}
185
+ .username=${this.username}
186
+ ?hideSearch=${this.hideSearch}
187
+ tabindex="${this.userMenuTabIndex}"
188
+ @menuToggled=${this.menuToggled}
189
+ @trackClick=${this.trackClick}
190
+ ></user-menu>
191
+ `;
192
+ }
193
+
194
+ get signedOutDropdown() {
195
+ return html`
196
+ <signed-out-dropdown
197
+ .baseHost=${this.baseHost}
198
+ .config=${this.config}
199
+ .open=${this.signedOutOpened}
200
+ ?hideSearch=${this.hideSearch}
201
+ tabindex="${this.signedOutTabIndex}"
202
+ .menuItems=${this.signedOutMenuItems}
203
+ ></signed-out-dropdown>
204
+ `;
205
+ }
206
+
207
+ get signedOutMenuItems() {
208
+ return this.menus.signedOut;
209
+ }
210
+
211
+ get userMenuItems() {
212
+ return this.menus.user;
213
+ }
214
+
215
+ get desktopSubnavMenuItems() {
216
+ return this.menus.more;
217
+ }
218
+
219
+ get allowSecondaryIcon() {
220
+ return this.secondIdentitySlotMode === 'allow';
221
+ }
222
+
223
+ get secondLogoSlot() {
224
+ return this.allowSecondaryIcon
225
+ ? html`
226
+ <slot name="opt-sec-logo" slot="opt-sec-logo"></slot>
227
+ <slot name="opt-sec-logo-mobile" slot="opt-sec-logo-mobile"></slot>
228
+ `
229
+ : nothing;
230
+ }
231
+
232
+ render() {
233
+ return html`
234
+ <div class="topnav">
235
+ <primary-nav
236
+ .baseHost=${this.baseHost}
237
+ .mediaBaseHost=${this.mediaBaseHost}
238
+ .config=${this.config}
239
+ .openMenu=${this.openMenu}
240
+ .screenName=${this.screenName}
241
+ .searchIn=${this.searchIn}
242
+ .searchQuery=${this.searchQuery}
243
+ .secondIdentitySlotMode=${this.secondIdentitySlotMode}
244
+ .selectedMenuOption=${this.selectedMenuOption}
245
+ .username=${this.username}
246
+ .userProfileImagePath=${this.userProfileImagePath}
247
+ .userProfileLastModified=${this.userProfileLastModified}
248
+ ?hideSearch=${this.hideSearch}
249
+ @mediaTypeSelected=${this.mediaTypeSelected}
250
+ @toggleSearchMenu=${this.toggleSearchMenu}
251
+ @trackClick=${this.trackClick}
252
+ @trackSubmit=${this.trackSubmit}
253
+ @menuToggled=${this.menuToggled}
254
+ >
255
+ ${this.secondLogoSlot}
256
+ </primary-nav>
257
+ <media-slider
258
+ .baseHost=${this.baseHost}
259
+ .config=${this.config}
260
+ .selectedMenuOption=${this.selectedMenuOption}
261
+ .mediaSliderOpen=${this.mediaSliderOpen}
262
+ .menus=${this.menus}
263
+ ></media-slider>
264
+ </div>
265
+ ${this.username ? this.userMenu : this.signedOutDropdown}
266
+ <search-menu
267
+ .baseHost=${this.baseHost}
268
+ .config=${this.config}
269
+ .openMenu=${this.openMenu}
270
+ tabindex="${this.searchMenuTabIndex}"
271
+ ?hideSearch=${this.hideSearch}
272
+ @searchInChanged=${this.searchInChanged}
273
+ @trackClick=${this.trackClick}
274
+ @trackSubmit=${this.trackSubmit}
275
+ ></search-menu>
276
+ <desktop-subnav
277
+ .baseHost=${this.baseHost}
278
+ .menuItems=${this.desktopSubnavMenuItems}
279
+ ></desktop-subnav>
280
+ <div id="close-layer" class="${this.closeLayerClass}" @click=${this.closeMenus}></div>
281
+ `;
282
+ }
283
+ }
284
+
285
+ customElements.define('ia-topnav', IATopNav);
@@ -1 +1 @@
1
- export default (url, baseHost) => (/^https?:/.test(url) ? url : `${baseHost}${url}`);
1
+ export default (url, baseHost) => (/^https?:/.test(url) ? url : `${baseHost}${url}`);
@@ -1,5 +1,5 @@
1
- /* istanbul ignore file */
2
-
3
- export default function (url) {
4
- window.location = url;
5
- }
1
+ /* istanbul ignore file */
2
+
3
+ export default function (url) {
4
+ window.location = url;
5
+ }
@@ -1,7 +1,7 @@
1
- /* istanbul ignore file */
2
-
3
- export default {
4
- performQuery(query) {
5
- window.location = `https://web.archive.org/web/*/${query}`;
6
- }
7
- };
1
+ /* istanbul ignore file */
2
+
3
+ export default {
4
+ performQuery(query) {
5
+ window.location = `https://web.archive.org/web/*/${query}`;
6
+ }
7
+ };
@@ -1,8 +1,8 @@
1
- const toSentenceCase = (phrase) => {
2
- const words = phrase.split(' ');
3
- const lastWord = words.pop();
4
- const capitalizedWord = `${lastWord.substr(0, 1).toUpperCase()}${lastWord.substr(1)}`;
5
- return words.length ? toSentenceCase(`${words.join(' ')}${capitalizedWord}`) : capitalizedWord;
6
- };
7
-
8
- export default toSentenceCase;
1
+ const toSentenceCase = (phrase) => {
2
+ const words = phrase.split(' ');
3
+ const lastWord = words.pop();
4
+ const capitalizedWord = `${lastWord.substr(0, 1).toUpperCase()}${lastWord.substr(1)}`;
5
+ return words.length ? toSentenceCase(`${words.join(' ')}${capitalizedWord}`) : capitalizedWord;
6
+ };
7
+
8
+ export default toSentenceCase;