@internetarchive/ia-topnav 1.1.23 → 1.1.25-alpha1

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