@internetarchive/ia-item-navigator 1.1.1 → 2.0.0-alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/demo/app-root.ts +190 -28
  2. package/dist/demo/app-root.d.ts +7 -3
  3. package/dist/demo/app-root.js +158 -22
  4. package/dist/demo/app-root.js.map +1 -1
  5. package/dist/index.d.ts +4 -1
  6. package/dist/index.js +5 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/src/{item-navigator.js → iaux-item-navigator.js} +3 -10
  9. package/dist/src/iaux-item-navigator.js.map +1 -0
  10. package/dist/src/menus/iaux-sharing-options.d.ts +28 -0
  11. package/dist/src/menus/iaux-sharing-options.js +277 -0
  12. package/dist/src/menus/iaux-sharing-options.js.map +1 -0
  13. package/dist/src/menus/iaux-viewable-files.d.ts +32 -0
  14. package/dist/src/menus/iaux-viewable-files.js +367 -0
  15. package/dist/src/menus/iaux-viewable-files.js.map +1 -0
  16. package/dist/src/menus/share-providers/email.d.ts +11 -0
  17. package/dist/src/menus/share-providers/email.js +15 -0
  18. package/dist/src/menus/share-providers/email.js.map +1 -0
  19. package/dist/src/menus/share-providers/facebook.d.ts +11 -0
  20. package/dist/src/menus/share-providers/facebook.js +15 -0
  21. package/dist/src/menus/share-providers/facebook.js.map +1 -0
  22. package/dist/src/menus/share-providers/pinterest.d.ts +11 -0
  23. package/dist/src/menus/share-providers/pinterest.js +15 -0
  24. package/dist/src/menus/share-providers/pinterest.js.map +1 -0
  25. package/dist/src/menus/share-providers/provider.d.ts +20 -0
  26. package/dist/src/menus/share-providers/provider.js +37 -0
  27. package/dist/src/menus/share-providers/provider.js.map +1 -0
  28. package/dist/src/menus/share-providers/share-provider-interface.d.ts +13 -0
  29. package/dist/src/menus/share-providers/share-provider-interface.js +2 -0
  30. package/dist/src/menus/share-providers/share-provider-interface.js.map +1 -0
  31. package/dist/src/menus/share-providers/tumblr.d.ts +11 -0
  32. package/dist/src/menus/share-providers/tumblr.js +15 -0
  33. package/dist/src/menus/share-providers/tumblr.js.map +1 -0
  34. package/dist/src/menus/share-providers/twitter.d.ts +11 -0
  35. package/dist/src/menus/share-providers/twitter.js +15 -0
  36. package/dist/src/menus/share-providers/twitter.js.map +1 -0
  37. package/dist/test/iaux-item-navigator.test.d.ts +1 -0
  38. package/dist/test/{ia-item-navigator.test.js → iaux-item-navigator.test.js} +49 -27
  39. package/dist/test/iaux-item-navigator.test.js.map +1 -0
  40. package/dist/test/iaux-sharing-options.test.d.ts +1 -0
  41. package/dist/test/iaux-sharing-options.test.js +64 -0
  42. package/dist/test/iaux-sharing-options.test.js.map +1 -0
  43. package/index.ts +9 -1
  44. package/package.json +11 -4
  45. package/src/{item-navigator.ts → iaux-item-navigator.ts} +2 -10
  46. package/src/menus/foo.json +84 -0
  47. package/src/menus/iaux-sharing-options.ts +281 -0
  48. package/src/menus/iaux-viewable-files.ts +377 -0
  49. package/src/menus/share-providers/email.ts +23 -0
  50. package/src/menus/share-providers/facebook.ts +23 -0
  51. package/src/menus/share-providers/pinterest.ts +23 -0
  52. package/src/menus/share-providers/provider.ts +63 -0
  53. package/src/menus/share-providers/share-provider-interface.ts +17 -0
  54. package/src/menus/share-providers/tumblr.ts +23 -0
  55. package/src/menus/share-providers/twitter.ts +23 -0
  56. package/test/ia-sharing-options.test.js +78 -0
  57. package/test/{iaux-item-navigator.test.txt → iaux-item-navigator.test.ts} +46 -24
  58. package/dist/src/item-navigator.js.map +0 -1
  59. package/dist/test/ia-item-navigator.test.d.ts +0 -1
  60. package/dist/test/ia-item-navigator.test.js.map +0 -1
  61. package/test/ia-item-navigator.test.ts +0 -417
  62. /package/dist/src/{item-navigator.d.ts → iaux-item-navigator.d.ts} +0 -0
  63. /package/test/{iaux-sharing-options.test.txt → iaux-sharing-options.test.ts} +0 -0
package/demo/app-root.ts CHANGED
@@ -8,17 +8,123 @@ import {
8
8
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
9
9
  import { ModalManager } from '@internetarchive/modal-manager';
10
10
  import '@internetarchive/modal-manager';
11
- import { ItemNavigator } from '../src/item-navigator';
12
- import '../src/item-navigator';
11
+ import type { ItemNavigator } from '../src/iaux-item-navigator';
12
+ import '../src/iaux-item-navigator';
13
+ import '../src/menus/iaux-sharing-options';
13
14
  import {
14
15
  MenuShortcutInterface,
15
16
  MenuProviderInterface,
16
17
  } from '../src/interfaces/menu-interfaces';
17
-
18
+ import { iauxShareIcon } from '../src/menus/iaux-sharing-options';
19
+ import { viewableFilesIcon } from '../src/menus/iaux-viewable-files';
20
+
21
+ const fileList = [
22
+ {
23
+ url_path: '/details/masterbookofamericanfolksong00shep',
24
+ file_subprefix: '01-The Master Book of American Folk Song',
25
+ title: 'The Master Book of American Folk Song',
26
+ file_source: '/01-The Master Book of American Folk Song_jp2.zip',
27
+ orig_sort: 0,
28
+ },
29
+ {
30
+ url_path:
31
+ '/details/masterbookofamericanfolksong00shep/02-Encyclopedia%20of%20the%20Traditional%20Music%20and%20Folk%20Songs%20of%20the%20United%20States%20Index%20A%20through%20M',
32
+ file_subprefix:
33
+ '02-Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M',
34
+ title:
35
+ 'Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M',
36
+ file_source:
37
+ '/02-Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M_jp2.zip',
38
+ orig_sort: 1,
39
+ },
40
+ {
41
+ url_path:
42
+ '/details/masterbookofamericanfolksong00shep/03-Encyclopedia%20of%20the%20Traditional%20Music%20and%20Folk%20Songs%20of%20the%20United%20States%20Index%20N%20through%20Z',
43
+ file_subprefix:
44
+ '03-Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z',
45
+ title:
46
+ 'Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z',
47
+ file_source:
48
+ '/03-Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z_jp2.zip',
49
+ orig_sort: 2,
50
+ },
51
+ {
52
+ url_path:
53
+ '/details/masterbookofamericanfolksong00shep/04-Letters%20to%20Riley%20Shepard',
54
+ file_subprefix: '04-Letters to Riley Shepard',
55
+ title: 'Letters to Riley Shepard',
56
+ file_source: '/04-Letters to Riley Shepard_jp2.zip',
57
+ orig_sort: 3,
58
+ },
59
+ {
60
+ url_path:
61
+ '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%201',
62
+ file_subprefix: 'Master Book of American Folk Song Vol. 1',
63
+ title: 'Master Book of American Folk Song Vol. 1.pdf',
64
+ file_source: '/Master Book of American Folk Song Vol. 1_jp2.zip',
65
+ orig_sort: 4,
66
+ },
67
+ {
68
+ url_path:
69
+ '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%202',
70
+ file_subprefix: 'Master Book of American Folk Song Vol. 2',
71
+ title: 'Master Book of American Folk Song Vol. 2.pdf',
72
+ file_source: '/Master Book of American Folk Song Vol. 2_jp2.zip',
73
+ orig_sort: 5,
74
+ },
75
+ {
76
+ url_path:
77
+ '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%203',
78
+ file_subprefix: 'Master Book of American Folk Song Vol. 3',
79
+ title: 'Master Book of American Folk Song Vol. 3.pdf',
80
+ file_source: '/Master Book of American Folk Song Vol. 3_jp2.zip',
81
+ orig_sort: 6,
82
+ },
83
+ {
84
+ url_path:
85
+ '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%204',
86
+ file_subprefix: 'Master Book of American Folk Song Vol. 4',
87
+ title: 'Master Book of American Folk Song Vol. 4.pdf',
88
+ file_source: '/Master Book of American Folk Song Vol. 4_jp2.zip',
89
+ orig_sort: 7,
90
+ },
91
+ {
92
+ url_path:
93
+ '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%205',
94
+ file_subprefix: 'Master Book of American Folk Song Vol. 5',
95
+ title: 'Master Book of American Folk Song Vol. 5',
96
+ file_source: '/Master Book of American Folk Song Vol. 5_jp2.zip',
97
+ orig_sort: 8,
98
+ },
99
+ {
100
+ url_path:
101
+ '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%206',
102
+ file_subprefix: 'Master Book of American Folk Song Vol. 6',
103
+ title: 'Master Book of American Folk Song Vol. 6.pdf',
104
+ file_source: '/Master Book of American Folk Song Vol. 6_jp2.zip',
105
+ orig_sort: 9,
106
+ },
107
+ {
108
+ url_path:
109
+ '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%207',
110
+ file_subprefix: 'Master Book of American Folk Song Vol. 7',
111
+ title: 'Master Book of American Folk Song Vol. 7.pdf',
112
+ file_source: '/Master Book of American Folk Song Vol. 7_jp2.zip',
113
+ orig_sort: 10,
114
+ },
115
+ {
116
+ url_path:
117
+ '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%208',
118
+ file_subprefix: 'Master Book of American Folk Song Vol. 8',
119
+ title: 'Master Book of American Folk Song Vol. 8.pdf',
120
+ file_source: '/Master Book of American Folk Song Vol. 8_jp2.zip',
121
+ orig_sort: 11,
122
+ },
123
+ ];
18
124
  @customElement('app-root')
19
125
  export class AppRoot extends LitElement {
20
126
  /**
21
- * Example controller to connect to `<ia-item-navigator>`
127
+ * Example controller to connect to `<iaux-item-navigator>`
22
128
  */
23
129
  @property({ type: Object }) itemMD?: MetadataResponse;
24
130
 
@@ -32,21 +138,28 @@ export class AppRoot extends LitElement {
32
138
  @property({ type: Array, attribute: false })
33
139
  menuShortcuts: MenuShortcutInterface[] = [];
34
140
 
35
- @property({ reflect: true, attribute: true }) fullscreen: boolean | null =
36
- null;
37
-
38
- @property({ reflect: true, attribute: true }) headerOn: true | null = null;
141
+ @property({ reflect: true, attribute: true, type: Boolean }) fullscreen:
142
+ | boolean
143
+ | null = null;
39
144
 
40
- @property({ reflect: true, attribute: true }) loaded: true | null = true;
145
+ @property({ reflect: true, attribute: true, type: Boolean }) headerOn:
146
+ | true
147
+ | null = null;
41
148
 
42
- @property({ reflect: true, attribute: true }) showPlaceholder: true | null =
43
- null;
149
+ @property({ reflect: true, attribute: true, type: Boolean }) loaded:
150
+ | true
151
+ | null = null;
44
152
 
45
- @property({ reflect: true, attribute: true }) showTheaterExample:
153
+ @property({ reflect: true, attribute: true, type: Boolean }) showPlaceholder:
46
154
  | true
47
- | null = true;
155
+ | null = null;
48
156
 
49
- @query('ia-item-navigator') private itemNav!: ItemNavigator;
157
+ @property({ reflect: true, attribute: true, type: Boolean })
158
+ showTheaterExample: true | null = null;
159
+
160
+ @property({ type: Array }) fileListToDisplay: any[] = fileList;
161
+
162
+ @query('iaux-item-navigator') private itemNav!: ItemNavigator;
50
163
 
51
164
  @query('modal-manager') modalMgr!: ModalManager;
52
165
 
@@ -66,11 +179,20 @@ export class AppRoot extends LitElement {
66
179
  if (changed.has('itemMD')) {
67
180
  this.fullscreenCheck();
68
181
  }
182
+
183
+ if (changed.has('fileList')) {
184
+ this.drawMenus();
185
+ }
69
186
  }
70
187
 
71
188
  async fetchItemMD() {
72
189
  const searchService = SearchService.default;
73
- const mdResponse = await searchService.fetchMetadata('ux-team-books');
190
+
191
+ // masterbookofamericanfolksong00shep => multiple files
192
+ // ux-team-books => item
193
+ const mdResponse = await searchService.fetchMetadata(
194
+ 'masterbookofamericanfolksong00shep',
195
+ );
74
196
 
75
197
  if (mdResponse.error) {
76
198
  console.log('MD Fetch error: ', mdResponse.error);
@@ -82,6 +204,7 @@ export class AppRoot extends LitElement {
82
204
 
83
205
  console.log('mdResponse.success', JSON.stringify(mdResponse.success));
84
206
  this.itemMD = mdResponse.success;
207
+ this.toggleTheaterExample();
85
208
  }
86
209
 
87
210
  get theaterReady(): boolean {
@@ -106,7 +229,7 @@ export class AppRoot extends LitElement {
106
229
  }
107
230
  }
108
231
 
109
- /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */
232
+ /** toggles attr: `<iaux-item-navigator viewportinfullscreen>` */
110
233
  fullscreenCheck(): void {
111
234
  if (this.showFullscreen && this.itemNav) {
112
235
  this.fullscreen = true;
@@ -182,15 +305,54 @@ export class AppRoot extends LitElement {
182
305
  // turn off placeholder
183
306
  this.showPlaceholder = null;
184
307
  this.showTheaterExample = true;
308
+ this.drawMenus();
309
+ }
310
+
311
+ drawMenus() {
312
+ const shareMenu = {
313
+ icon: iauxShareIcon,
314
+ label: 'Share this item',
315
+ id: 'share',
316
+ component: html`<iaux-sharing-options
317
+ .identifier=${this.itemMD?.metadata.identifier || 'ux-team-books'}
318
+ .type=${`book`}
319
+ .creator=${`UX Team`}
320
+ .description=${'list of test books'}
321
+ .baseHost=${'archive.org'}
322
+ .fileSubPrefix=${''}
323
+ ></iaux-sharing-options>`,
324
+ } as unknown as MenuProviderInterface;
325
+
326
+ const filesNewArr = [...fileList];
327
+ const viewableFilesMenu = {
328
+ id: 'viewable-files',
329
+ icon: viewableFilesIcon,
330
+ label: `Viewable Files (${fileList.length})`,
331
+ baseHost: 'archive.org',
332
+ item: this.itemMD as MetadataResponse,
333
+ subPrefix: '',
334
+ // sorter
335
+ actionButton: html`<iaux-sort-viewable-files
336
+ @fileListSorted=${(e: CustomEvent) => this.sortFilesCallback(e)}
337
+ .fileListRaw=${fileList}
338
+ ></iaux-sort-viewable-files>`,
339
+ component: html`<iaux-viewable-files
340
+ .fileList=${filesNewArr}
341
+ ></iaux-viewable-files> `,
342
+ };
343
+
344
+ this.menuContents = [viewableFilesMenu, shareMenu];
345
+ this.menuShortcuts = [viewableFilesMenu, shareMenu];
346
+ }
185
347
 
186
- const x = {
187
- icon: html`<p style="color: red">Allo</p>`,
188
- id: 'a',
189
- label: 'Hello world',
190
- menuDetails: html`<h3>Wheee!</h3>`,
191
- } as any;
192
- this.menuContents = [x];
193
- this.menuShortcuts = [x];
348
+ async sortFilesCallback(e: CustomEvent) {
349
+ const { sortType, sortedFiles } = e.detail;
350
+ this.fileListToDisplay = sortedFiles;
351
+ console.log('fileListSorted', { sortType, sortedFiles });
352
+ await this.updateComplete;
353
+ console.log('fileListSortedasyncd', { sortType, sortedFiles });
354
+ this.drawMenus();
355
+ // debugger;
194
356
  }
195
357
 
196
358
  /** Views */
@@ -200,7 +362,7 @@ export class AppRoot extends LitElement {
200
362
  <div class="theater-example">
201
363
  <img
202
364
  alt="cat theater"
203
- src="https://archive.org/download/encyclopediaofca0000poll_t2e2/__ia_thumb.jpg"
365
+ src="https://archive.org/download/masterbookofamericanfolksong00shep/__ia_thumb.jpg"
204
366
  />
205
367
  <h3>Welcome to Cat Theater</h3>
206
368
  </div>
@@ -256,7 +418,7 @@ export class AppRoot extends LitElement {
256
418
  return html`
257
419
  <h1>theater, in page</h1>
258
420
  <section>
259
- <ia-item-navigator
421
+ <iaux-item-navigator
260
422
  baseHost="https://archive.org"
261
423
  .item=${this.itemMD}
262
424
  .modal=${this.modalMgr}
@@ -269,7 +431,7 @@ export class AppRoot extends LitElement {
269
431
  >
270
432
  ${this.headerOn ? this.headerExample : ''}
271
433
  ${this.showTheaterExample ? this.theaterExample : ''}
272
- </ia-item-navigator>
434
+ </iaux-item-navigator>
273
435
  </section>
274
436
  <div>
275
437
  <button @click=${this.toggleHeader}>toggle header</button>
@@ -304,7 +466,7 @@ export class AppRoot extends LitElement {
304
466
  }
305
467
 
306
468
  :host,
307
- ia-item-navigator {
469
+ iaux-item-navigator {
308
470
  display: block;
309
471
  position: relative;
310
472
  width: 100%;
@@ -3,11 +3,12 @@ import { MetadataResponse } from '@internetarchive/search-service';
3
3
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
4
4
  import { ModalManager } from '@internetarchive/modal-manager';
5
5
  import '@internetarchive/modal-manager';
6
- import '../src/item-navigator';
6
+ import '../src/iaux-item-navigator';
7
+ import '../src/menus/iaux-sharing-options';
7
8
  import { MenuShortcutInterface, MenuProviderInterface } from '../src/interfaces/menu-interfaces';
8
9
  export declare class AppRoot extends LitElement {
9
10
  /**
10
- * Example controller to connect to `<ia-item-navigator>`
11
+ * Example controller to connect to `<iaux-item-navigator>`
11
12
  */
12
13
  itemMD?: MetadataResponse;
13
14
  encodedManifest: string;
@@ -19,6 +20,7 @@ export declare class AppRoot extends LitElement {
19
20
  loaded: true | null;
20
21
  showPlaceholder: true | null;
21
22
  showTheaterExample: true | null;
23
+ fileListToDisplay: any[];
22
24
  private itemNav;
23
25
  modalMgr: ModalManager;
24
26
  firstUpdated(): void;
@@ -30,7 +32,7 @@ export declare class AppRoot extends LitElement {
30
32
  get showFullscreen(): boolean;
31
33
  /** sets url query param `view=theater` to toggle fullscreen */
32
34
  toggleFS(): void;
33
- /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */
35
+ /** toggles attr: `<iaux-item-navigator viewportinfullscreen>` */
34
36
  fullscreenCheck(): void;
35
37
  /** End fullscreen */
36
38
  toggleHeader(): void;
@@ -38,6 +40,8 @@ export declare class AppRoot extends LitElement {
38
40
  togglePlaceholder(): void;
39
41
  toggleImmersion(): void;
40
42
  toggleTheaterExample(): void;
43
+ drawMenus(): void;
44
+ sortFilesCallback(e: CustomEvent): Promise<void>;
41
45
  /** Views */
42
46
  get theaterExample(): TemplateResult;
43
47
  get headerExample(): TemplateResult;
@@ -5,7 +5,96 @@ import { customElement, property, query } from 'lit/decorators.js';
5
5
  import { SearchService, } from '@internetarchive/search-service';
6
6
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
7
7
  import '@internetarchive/modal-manager';
8
- import '../src/item-navigator';
8
+ import '../src/iaux-item-navigator';
9
+ import '../src/menus/iaux-sharing-options';
10
+ import { iauxShareIcon } from '../src/menus/iaux-sharing-options';
11
+ import { viewableFilesIcon } from '../src/menus/iaux-viewable-files';
12
+ const fileList = [
13
+ {
14
+ url_path: '/details/masterbookofamericanfolksong00shep',
15
+ file_subprefix: '01-The Master Book of American Folk Song',
16
+ title: 'The Master Book of American Folk Song',
17
+ file_source: '/01-The Master Book of American Folk Song_jp2.zip',
18
+ orig_sort: 0,
19
+ },
20
+ {
21
+ url_path: '/details/masterbookofamericanfolksong00shep/02-Encyclopedia%20of%20the%20Traditional%20Music%20and%20Folk%20Songs%20of%20the%20United%20States%20Index%20A%20through%20M',
22
+ file_subprefix: '02-Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M',
23
+ title: 'Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M',
24
+ file_source: '/02-Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M_jp2.zip',
25
+ orig_sort: 1,
26
+ },
27
+ {
28
+ url_path: '/details/masterbookofamericanfolksong00shep/03-Encyclopedia%20of%20the%20Traditional%20Music%20and%20Folk%20Songs%20of%20the%20United%20States%20Index%20N%20through%20Z',
29
+ file_subprefix: '03-Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z',
30
+ title: 'Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z',
31
+ file_source: '/03-Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z_jp2.zip',
32
+ orig_sort: 2,
33
+ },
34
+ {
35
+ url_path: '/details/masterbookofamericanfolksong00shep/04-Letters%20to%20Riley%20Shepard',
36
+ file_subprefix: '04-Letters to Riley Shepard',
37
+ title: 'Letters to Riley Shepard',
38
+ file_source: '/04-Letters to Riley Shepard_jp2.zip',
39
+ orig_sort: 3,
40
+ },
41
+ {
42
+ url_path: '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%201',
43
+ file_subprefix: 'Master Book of American Folk Song Vol. 1',
44
+ title: 'Master Book of American Folk Song Vol. 1.pdf',
45
+ file_source: '/Master Book of American Folk Song Vol. 1_jp2.zip',
46
+ orig_sort: 4,
47
+ },
48
+ {
49
+ url_path: '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%202',
50
+ file_subprefix: 'Master Book of American Folk Song Vol. 2',
51
+ title: 'Master Book of American Folk Song Vol. 2.pdf',
52
+ file_source: '/Master Book of American Folk Song Vol. 2_jp2.zip',
53
+ orig_sort: 5,
54
+ },
55
+ {
56
+ url_path: '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%203',
57
+ file_subprefix: 'Master Book of American Folk Song Vol. 3',
58
+ title: 'Master Book of American Folk Song Vol. 3.pdf',
59
+ file_source: '/Master Book of American Folk Song Vol. 3_jp2.zip',
60
+ orig_sort: 6,
61
+ },
62
+ {
63
+ url_path: '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%204',
64
+ file_subprefix: 'Master Book of American Folk Song Vol. 4',
65
+ title: 'Master Book of American Folk Song Vol. 4.pdf',
66
+ file_source: '/Master Book of American Folk Song Vol. 4_jp2.zip',
67
+ orig_sort: 7,
68
+ },
69
+ {
70
+ url_path: '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%205',
71
+ file_subprefix: 'Master Book of American Folk Song Vol. 5',
72
+ title: 'Master Book of American Folk Song Vol. 5',
73
+ file_source: '/Master Book of American Folk Song Vol. 5_jp2.zip',
74
+ orig_sort: 8,
75
+ },
76
+ {
77
+ url_path: '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%206',
78
+ file_subprefix: 'Master Book of American Folk Song Vol. 6',
79
+ title: 'Master Book of American Folk Song Vol. 6.pdf',
80
+ file_source: '/Master Book of American Folk Song Vol. 6_jp2.zip',
81
+ orig_sort: 9,
82
+ },
83
+ {
84
+ url_path: '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%207',
85
+ file_subprefix: 'Master Book of American Folk Song Vol. 7',
86
+ title: 'Master Book of American Folk Song Vol. 7.pdf',
87
+ file_source: '/Master Book of American Folk Song Vol. 7_jp2.zip',
88
+ orig_sort: 10,
89
+ },
90
+ {
91
+ url_path: '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%208',
92
+ file_subprefix: 'Master Book of American Folk Song Vol. 8',
93
+ title: 'Master Book of American Folk Song Vol. 8.pdf',
94
+ file_source: '/Master Book of American Folk Song Vol. 8_jp2.zip',
95
+ orig_sort: 11,
96
+ },
97
+ ];
9
98
  let AppRoot = class AppRoot extends LitElement {
10
99
  constructor() {
11
100
  super(...arguments);
@@ -15,9 +104,10 @@ let AppRoot = class AppRoot extends LitElement {
15
104
  this.menuShortcuts = [];
16
105
  this.fullscreen = null;
17
106
  this.headerOn = null;
18
- this.loaded = true;
107
+ this.loaded = null;
19
108
  this.showPlaceholder = null;
20
- this.showTheaterExample = true;
109
+ this.showTheaterExample = null;
110
+ this.fileListToDisplay = fileList;
21
111
  }
22
112
  firstUpdated() {
23
113
  this.fetchItemMD();
@@ -29,10 +119,15 @@ let AppRoot = class AppRoot extends LitElement {
29
119
  if (changed.has('itemMD')) {
30
120
  this.fullscreenCheck();
31
121
  }
122
+ if (changed.has('fileList')) {
123
+ this.drawMenus();
124
+ }
32
125
  }
33
126
  async fetchItemMD() {
34
127
  const searchService = SearchService.default;
35
- const mdResponse = await searchService.fetchMetadata('ux-team-books');
128
+ // masterbookofamericanfolksong00shep => multiple files
129
+ // ux-team-books => item
130
+ const mdResponse = await searchService.fetchMetadata('masterbookofamericanfolksong00shep');
36
131
  if (mdResponse.error) {
37
132
  console.log('MD Fetch error: ', mdResponse.error);
38
133
  window.confirm('There was an error fetching response, please check dev console');
@@ -40,6 +135,7 @@ let AppRoot = class AppRoot extends LitElement {
40
135
  }
41
136
  console.log('mdResponse.success', JSON.stringify(mdResponse.success));
42
137
  this.itemMD = mdResponse.success;
138
+ this.toggleTheaterExample();
43
139
  }
44
140
  get theaterReady() {
45
141
  return this.modalMgr && this.sharedObserver && !!this.itemMD;
@@ -60,7 +156,7 @@ let AppRoot = class AppRoot extends LitElement {
60
156
  location.search = 'view=theater';
61
157
  }
62
158
  }
63
- /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */
159
+ /** toggles attr: `<iaux-item-navigator viewportinfullscreen>` */
64
160
  fullscreenCheck() {
65
161
  if (this.showFullscreen && this.itemNav) {
66
162
  this.fullscreen = true;
@@ -128,14 +224,51 @@ let AppRoot = class AppRoot extends LitElement {
128
224
  // turn off placeholder
129
225
  this.showPlaceholder = null;
130
226
  this.showTheaterExample = true;
131
- const x = {
132
- icon: html `<p style="color: red">Allo</p>`,
133
- id: 'a',
134
- label: 'Hello world',
135
- menuDetails: html `<h3>Wheee!</h3>`,
227
+ this.drawMenus();
228
+ }
229
+ drawMenus() {
230
+ var _a;
231
+ const shareMenu = {
232
+ icon: iauxShareIcon,
233
+ label: 'Share this item',
234
+ id: 'share',
235
+ component: html `<iaux-sharing-options
236
+ .identifier=${((_a = this.itemMD) === null || _a === void 0 ? void 0 : _a.metadata.identifier) || 'ux-team-books'}
237
+ .type=${`book`}
238
+ .creator=${`UX Team`}
239
+ .description=${'list of test books'}
240
+ .baseHost=${'archive.org'}
241
+ .fileSubPrefix=${''}
242
+ ></iaux-sharing-options>`,
136
243
  };
137
- this.menuContents = [x];
138
- this.menuShortcuts = [x];
244
+ const filesNewArr = [...fileList];
245
+ const viewableFilesMenu = {
246
+ id: 'viewable-files',
247
+ icon: viewableFilesIcon,
248
+ label: `Viewable Files (${fileList.length})`,
249
+ baseHost: 'archive.org',
250
+ item: this.itemMD,
251
+ subPrefix: '',
252
+ // sorter
253
+ actionButton: html `<iaux-sort-viewable-files
254
+ @fileListSorted=${(e) => this.sortFilesCallback(e)}
255
+ .fileListRaw=${fileList}
256
+ ></iaux-sort-viewable-files>`,
257
+ component: html `<iaux-viewable-files
258
+ .fileList=${filesNewArr}
259
+ ></iaux-viewable-files> `,
260
+ };
261
+ this.menuContents = [viewableFilesMenu, shareMenu];
262
+ this.menuShortcuts = [viewableFilesMenu, shareMenu];
263
+ }
264
+ async sortFilesCallback(e) {
265
+ const { sortType, sortedFiles } = e.detail;
266
+ this.fileListToDisplay = sortedFiles;
267
+ console.log('fileListSorted', { sortType, sortedFiles });
268
+ await this.updateComplete;
269
+ console.log('fileListSortedasyncd', { sortType, sortedFiles });
270
+ this.drawMenus();
271
+ // debugger;
139
272
  }
140
273
  /** Views */
141
274
  get theaterExample() {
@@ -144,7 +277,7 @@ let AppRoot = class AppRoot extends LitElement {
144
277
  <div class="theater-example">
145
278
  <img
146
279
  alt="cat theater"
147
- src="https://archive.org/download/encyclopediaofca0000poll_t2e2/__ia_thumb.jpg"
280
+ src="https://archive.org/download/masterbookofamericanfolksong00shep/__ia_thumb.jpg"
148
281
  />
149
282
  <h3>Welcome to Cat Theater</h3>
150
283
  </div>
@@ -188,7 +321,7 @@ let AppRoot = class AppRoot extends LitElement {
188
321
  return html `
189
322
  <h1>theater, in page</h1>
190
323
  <section>
191
- <ia-item-navigator
324
+ <iaux-item-navigator
192
325
  baseHost="https://archive.org"
193
326
  .item=${this.itemMD}
194
327
  .modal=${this.modalMgr}
@@ -201,7 +334,7 @@ let AppRoot = class AppRoot extends LitElement {
201
334
  >
202
335
  ${this.headerOn ? this.headerExample : ''}
203
336
  ${this.showTheaterExample ? this.theaterExample : ''}
204
- </ia-item-navigator>
337
+ </iaux-item-navigator>
205
338
  </section>
206
339
  <div>
207
340
  <button @click=${this.toggleHeader}>toggle header</button>
@@ -236,7 +369,7 @@ AppRoot.styles = css `
236
369
  }
237
370
 
238
371
  :host,
239
- ia-item-navigator {
372
+ iaux-item-navigator {
240
373
  display: block;
241
374
  position: relative;
242
375
  width: 100%;
@@ -289,22 +422,25 @@ __decorate([
289
422
  property({ type: Array, attribute: false })
290
423
  ], AppRoot.prototype, "menuShortcuts", void 0);
291
424
  __decorate([
292
- property({ reflect: true, attribute: true })
425
+ property({ reflect: true, attribute: true, type: Boolean })
293
426
  ], AppRoot.prototype, "fullscreen", void 0);
294
427
  __decorate([
295
- property({ reflect: true, attribute: true })
428
+ property({ reflect: true, attribute: true, type: Boolean })
296
429
  ], AppRoot.prototype, "headerOn", void 0);
297
430
  __decorate([
298
- property({ reflect: true, attribute: true })
431
+ property({ reflect: true, attribute: true, type: Boolean })
299
432
  ], AppRoot.prototype, "loaded", void 0);
300
433
  __decorate([
301
- property({ reflect: true, attribute: true })
434
+ property({ reflect: true, attribute: true, type: Boolean })
302
435
  ], AppRoot.prototype, "showPlaceholder", void 0);
303
436
  __decorate([
304
- property({ reflect: true, attribute: true })
437
+ property({ reflect: true, attribute: true, type: Boolean })
305
438
  ], AppRoot.prototype, "showTheaterExample", void 0);
306
439
  __decorate([
307
- query('ia-item-navigator')
440
+ property({ type: Array })
441
+ ], AppRoot.prototype, "fileListToDisplay", void 0);
442
+ __decorate([
443
+ query('iaux-item-navigator')
308
444
  ], AppRoot.prototype, "itemNav", void 0);
309
445
  __decorate([
310
446
  query('modal-manager')