@internetarchive/ia-item-navigator 0.0.0-a9 → 0.0.2-a2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/README.md +29 -19
  2. package/demo/app-root.ts +37 -31
  3. package/demo/index.html +1 -0
  4. package/dist/demo/app-root.d.ts +11 -15
  5. package/dist/demo/app-root.js +26 -26
  6. package/dist/demo/app-root.js.map +1 -1
  7. package/dist/src/interfaces/custom-theater-interface.d.ts +20 -0
  8. package/dist/src/interfaces/custom-theater-interface.js +2 -0
  9. package/dist/src/interfaces/custom-theater-interface.js.map +1 -0
  10. package/dist/src/interfaces/event-interfaces.d.ts +11 -11
  11. package/dist/src/interfaces/event-interfaces.js.map +1 -1
  12. package/dist/src/interfaces/menu-interfaces.d.ts +6 -7
  13. package/dist/src/interfaces/menu-interfaces.js.map +1 -1
  14. package/dist/src/interfaces/nav-controller-interface.d.ts +11 -6
  15. package/dist/src/interfaces/nav-controller-interface.js.map +1 -1
  16. package/dist/src/item-inspector/item-inspector.d.ts +0 -47
  17. package/dist/src/item-inspector/item-inspector.js +253 -271
  18. package/dist/src/item-inspector/item-inspector.js.map +1 -1
  19. package/dist/src/item-navigator.d.ts +41 -28
  20. package/dist/src/item-navigator.js +96 -113
  21. package/dist/src/item-navigator.js.map +1 -1
  22. package/dist/src/no-theater-available.d.ts +9 -0
  23. package/dist/src/no-theater-available.js +79 -0
  24. package/dist/src/no-theater-available.js.map +1 -0
  25. package/dist/test/book-nav-stub.d.ts +22 -0
  26. package/dist/test/book-nav-stub.js +49 -0
  27. package/dist/test/book-nav-stub.js.map +1 -0
  28. package/dist/test/ia-item-navigator.test.d.ts +1 -0
  29. package/dist/test/ia-item-navigator.test.js +279 -131
  30. package/dist/test/ia-item-navigator.test.js.map +1 -1
  31. package/dist/test/ia-stub.d.ts +22 -0
  32. package/dist/test/ia-stub.js +34 -3
  33. package/dist/test/ia-stub.js.map +1 -1
  34. package/dist/test/no-theater-available.test.d.ts +1 -0
  35. package/dist/test/no-theater-available.test.js +27 -0
  36. package/dist/test/no-theater-available.test.js.map +1 -0
  37. package/package.json +4 -3
  38. package/src/interfaces/custom-theater-interface.ts +28 -0
  39. package/src/interfaces/event-interfaces.ts +15 -11
  40. package/src/interfaces/menu-interfaces.ts +9 -10
  41. package/src/item-navigator.ts +133 -144
  42. package/src/no-theater-available.ts +85 -0
  43. package/test/book-nav-stub.ts +47 -0
  44. package/test/ia-item-navigator.test.ts +365 -156
  45. package/test/ia-stub.ts +78 -2
  46. package/test/no-theater-available.test.ts +32 -0
  47. package/demo/demo-book-manifest.json +0 -1163
  48. package/src/interfaces/nav-controller-interface.ts +0 -18
  49. package/src/item-inspector/files-by-type/files-by-type-provider.ts +0 -43
  50. package/src/item-inspector/files-by-type/ia-files-by-type.ts +0 -100
  51. package/src/item-inspector/item-inspector.ts +0 -296
  52. package/src/item-inspector/share-provider.ts +0 -51
  53. package/src/item-inspector/visual-mod-provider.ts +0 -65
  54. package/src/item-navigator-js.js +0 -372
@@ -1,272 +1,254 @@
1
- import { __decorate } from "tslib";
2
- /* eslint-disable no-console */
3
- /* eslint-disable import/no-duplicates */
4
- import { css, html, LitElement, customElement, property, state, } from 'lit-element';
5
- import { ModalConfig, } from '@internetarchive/modal-manager';
6
- import { ShareProvider } from './share-provider';
7
- import { FilesByTypeProvider } from './files-by-type/files-by-type-provider';
8
- import { VisualModsProvider } from './visual-mod-provider';
9
- // eslint-disable-next-line no-shadow
10
- var ItemInspectorEvents;
11
- (function (ItemInspectorEvents) {
12
- ItemInspectorEvents["menuUpdated"] = "menuUpdated";
13
- ItemInspectorEvents["updateSideMenu"] = "updateSideMenu";
14
- ItemInspectorEvents["PostInit"] = "PostInit";
15
- ItemInspectorEvents["ViewportInFullScreen"] = "ViewportInFullScreen";
16
- })(ItemInspectorEvents || (ItemInspectorEvents = {}));
17
- let IaItemInspector = class IaItemInspector extends LitElement {
18
- constructor() {
19
- super(...arguments);
20
- this.itemMD = {
21
- metadata: {},
22
- };
23
- this.baseHost = 'https://archive.org';
24
- this.menuProviders = {};
25
- this.menuShortcuts = [];
26
- this.sideMenuOpen = false;
27
- this.fullscreenState = false;
28
- this.fileCount = 0;
29
- this.loaded = false;
30
- this.shortcutOrder = ['visualMods'];
31
- }
32
- firstUpdated() {
33
- this.loaded = true;
34
- console.log('modal', this.modal);
35
- }
36
- updated(changed) {
37
- if (changed.has('loaded')) {
38
- setTimeout(() => this.emitLoadingStatusUpdate(this.loaded), 1000);
39
- }
40
- if (changed.has('itemMD') && this.itemMD) {
41
- this.parseItemInfo();
42
- this.setMenu();
43
- }
44
- if (changed.has('menuProviders') || changed.has('menuShortcuts')) {
45
- this.updateMenuContents();
46
- }
47
- }
48
- modalClosedCallback() {
49
- console.log('item-inspector, modal closed');
50
- }
51
- openModal() {
52
- const config = new ModalConfig();
53
- const customModalContent = html `
54
- Can contain any markup, including web components. Event listeners also
55
- work. Try clicking on the picture.
56
- <div style="text-align: center">
57
- <a href="https://fillmurray.com" style="display: block">Fill Murray</a>
58
- <img src="100x100.jpg" alt="foo" />
59
- </div>
60
- `;
61
- this.modal.showModal({
62
- config,
63
- customModalContent,
64
- userClosedModalCallback: this.modalClosedCallback,
65
- });
66
- }
67
- render() {
68
- var _a;
69
- const { identifier = '' } = (_a = this.itemMD) === null || _a === void 0 ? void 0 : _a.metadata;
70
- return html `
71
- <section>
72
- <div>
73
- <h2>${identifier}</h2>
74
- </div>
75
- <img src=${this.imageUrl} alt=${`${identifier} thumbnail`} />
76
- <button @click=${() => this.openModal()}>open modal</button>
77
- <p style="font-size: 20px;">
78
- Bacon ipsum dolor amet flank chicken leberkas sausage, meatball pork
79
- belly jowl. Chislic bacon salami frankfurter shankle drumstick
80
- andouille ball tip alcatra. Fatback beef ribs chicken, jerky ground
81
- round hamburger pork chop biltong. Shoulder short loin rump jerky
82
- kielbasa pork porchetta fatback ribeye pork belly sirloin chislic
83
- turducken corned beef tri-tip. Chuck pancetta meatball tail, spare
84
- ribs ham hock capicola pig. Ham hock hamburger chicken tri-tip venison
85
- swine burgdoggen boudin meatloaf pastrami chuck. Tri-tip spare ribs
86
- drumstick, tail rump hamburger burgdoggen swine t-bone tongue
87
- andouille chislic alcatra. Pork loin jowl frankfurter, doner meatball
88
- short loin ham hock filet mignon hamburger rump turkey bresaola
89
- shoulder sirloin flank. Ribeye sausage pig t-bone bacon frankfurter
90
- cupim capicola fatback pastrami ball tip pork belly. Picanha pancetta
91
- andouille flank shankle venison tri-tip tail, kevin turkey turducken
92
- chicken. Bacon picanha swine frankfurter, prosciutto chislic doner
93
- alcatra pork loin corned beef jowl biltong meatball chuck. Bacon
94
- burgdoggen pig fatback cupim t-bone. Cow pork loin bresaola brisket
95
- shoulder filet mignon chicken. Sirloin bresaola porchetta beef
96
- capicola meatloaf brisket shankle jerky turkey pork tri-tip swine
97
- kevin salami. Meatball t-bone doner venison. Pig tri-tip chuck, shank
98
- chicken pork chop landjaeger spare ribs jerky swine ham hock buffalo
99
- sirloin. Leberkas pancetta tenderloin, meatloaf buffalo rump pastrami
100
- chuck. Jerky cupim porchetta, tenderloin chuck andouille venison pork
101
- salami. Chuck strip steak cupim, turducken ham hock kielbasa shoulder
102
- porchetta chislic short loin tri-tip biltong cow corned beef.
103
- </p>
104
- </section>
105
- `;
106
- }
107
- addMenuShortcut(menuId) {
108
- if (this.menuShortcuts.find(m => m.id === menuId)) {
109
- return;
110
- }
111
- const shortcut = this.menuProviders[menuId];
112
- this.menuShortcuts.push(shortcut);
113
- this.sortMenuShortcuts();
114
- this.emitMenuShortcutsUpdated();
115
- }
116
- /**
117
- * Removes a provider object from the menuShortcuts array and emits a
118
- * menuShortcutsUpdated event.
119
- */
120
- removeMenuShortcut(menuId) {
121
- this.menuShortcuts = this.menuShortcuts.filter(m => m.id !== menuId);
122
- this.emitMenuShortcutsUpdated();
123
- }
124
- /**
125
- * Sorts the menuShortcuts property by comparing each provider's id to
126
- * the id in each iteration over the shortcutOrder array.
127
- */
128
- sortMenuShortcuts() {
129
- this.menuShortcuts = this.shortcutOrder.reduce((shortcuts, id) => {
130
- const menu = this.menuShortcuts.find(m => m.id === id);
131
- // eslint-disable-next-line no-param-reassign
132
- if (menu) {
133
- const newShortcuts = [...shortcuts, menu];
134
- // eslint-disable-next-line no-param-reassign
135
- shortcuts = newShortcuts;
136
- }
137
- return shortcuts;
138
- }, []);
139
- }
140
- emitMenuShortcutsUpdated() {
141
- const event = new CustomEvent('menuShortcutsUpdated', {
142
- detail: this.menuShortcuts,
143
- });
144
- this.dispatchEvent(event);
145
- }
146
- setMenu() {
147
- const menuProviders = {
148
- share: new ShareProvider({
149
- item: this.itemMD,
150
- baseHost: this.baseHost,
151
- subPrefix: '',
152
- }),
153
- filesByType: new FilesByTypeProvider({
154
- item: this.itemMD,
155
- baseHost: this.baseHost,
156
- subPrefix: '',
157
- }),
158
- visualMods: new VisualModsProvider({
159
- updated: (modType) => {
160
- if (modType === 'toggleFullscreen') {
161
- this.updateFullscreenState();
162
- }
163
- },
164
- item: this.itemMD,
165
- baseHost: this.baseHost,
166
- subPrefix: '',
167
- // maybe DOM root for class configs?
168
- }),
169
- };
170
- this.menuProviders = menuProviders;
171
- this.addMenuShortcut('visualMods');
172
- }
173
- updateFullscreenState() {
174
- const isFullScreen = !this.fullscreenState;
175
- this.fullscreenState = isFullScreen;
176
- const event = new CustomEvent('ViewportInFullScreen', {
177
- detail: { isFullScreen },
178
- });
179
- this.dispatchEvent(event);
180
- }
181
- updateMenuContents() {
182
- const { share, filesByType, visualMods } = this.menuProviders;
183
- const availableMenus = [filesByType, share, visualMods].filter(menu => !!menu);
184
- const event = new CustomEvent(ItemInspectorEvents.menuUpdated, {
185
- detail: availableMenus,
186
- });
187
- this.dispatchEvent(event);
188
- }
189
- emitLoadingStatusUpdate(loaded) {
190
- const event = new CustomEvent('loadingStateUpdated', {
191
- detail: { loaded },
192
- });
193
- this.dispatchEvent(event);
194
- }
195
- parseItemInfo() {
196
- var _a, _b;
197
- this.fileCount = ((_b = (_a = this.itemMD) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b.length) || 0;
198
- }
199
- get imageUrl() {
200
- const { metadata = {} } = this.itemMD;
201
- const url = `${this.baseHost}/download/${metadata === null || metadata === void 0 ? void 0 : metadata.identifier}/__ia_thumb.jpg`;
202
- return url;
203
- }
204
- static get styles() {
205
- const main = css `
206
- :host {
207
- display: block;
208
- width: 100%;
209
- margin: 0 auto;
210
- position: relative;
211
- overflow: auto;
212
- background-color: black;
213
- color: var(--primaryTextColor, #fff);
214
- }
215
-
216
- :host,
217
- section {
218
- min-height: inherit;
219
- height: inherit;
220
- }
221
-
222
- section {
223
- margin: auto;
224
- width: 100%;
225
- text-align: center;
226
- }
227
-
228
- img {
229
- border: 1px solid var(--primaryTextColor, #fff);
230
- }
231
- `;
232
- return [main];
233
- }
234
- };
235
- __decorate([
236
- property({ type: Object })
237
- ], IaItemInspector.prototype, "itemMD", void 0);
238
- __decorate([
239
- property({ type: String })
240
- ], IaItemInspector.prototype, "baseHost", void 0);
241
- __decorate([
242
- property({ type: Object })
243
- ], IaItemInspector.prototype, "menuProviders", void 0);
244
- __decorate([
245
- property({ type: Array })
246
- ], IaItemInspector.prototype, "menuShortcuts", void 0);
247
- __decorate([
248
- property({ type: Boolean })
249
- ], IaItemInspector.prototype, "sideMenuOpen", void 0);
250
- __decorate([
251
- property({ type: Boolean })
252
- ], IaItemInspector.prototype, "fullscreenState", void 0);
253
- __decorate([
254
- property({ attribute: false })
255
- ], IaItemInspector.prototype, "modal", void 0);
256
- __decorate([
257
- property({ attribute: false })
258
- ], IaItemInspector.prototype, "sharedRO", void 0);
259
- __decorate([
260
- state()
261
- ], IaItemInspector.prototype, "fileCount", void 0);
262
- __decorate([
263
- state()
264
- ], IaItemInspector.prototype, "loaded", void 0);
265
- __decorate([
266
- state()
267
- ], IaItemInspector.prototype, "shortcutOrder", void 0);
268
- IaItemInspector = __decorate([
269
- customElement('ia-item-inspector')
270
- ], IaItemInspector);
271
- export { IaItemInspector };
1
+ "use strict";
2
+ // /* eslint-disable no-console */
3
+ // import {
4
+ // css,
5
+ // html,
6
+ // LitElement,
7
+ // customElement,
8
+ // property,
9
+ // state,
10
+ // } from 'lit-element';
11
+ // import { MetadataResponse } from '@internetarchive/search-service';
12
+ // import {
13
+ // ModalManagerInterface,
14
+ // ModalConfig,
15
+ // } from '@internetarchive/modal-manager';
16
+ // import { SharedResizeObserverInterface } from '@internetarchive/shared-resize-observer';
17
+ // import { IntNavController } from '../interfaces/nav-controller-interface';
18
+ // import {
19
+ // IntMenuProvider,
20
+ // IntMenuShortcut,
21
+ // } from '../interfaces/menu-interfaces';
22
+ // import { IntManageFullscreenEvent } from '../interfaces/event-interfaces';
23
+ // import { ShareProvider } from './share-provider';
24
+ // import { FilesByTypeProvider } from './files-by-type/files-by-type-provider';
25
+ // import { VisualModsProvider } from './visual-mod-provider';
26
+ // // eslint-disable-next-line no-shadow
27
+ // enum ItemInspectorEvents {
28
+ // menuUpdated = 'menuUpdated',
29
+ // updateSideMenu = 'updateSideMenu',
30
+ // PostInit = 'PostInit',
31
+ // ViewportInFullScreen = 'ViewportInFullScreen',
32
+ // }
33
+ // interface menuProvidersInt {
34
+ // [menuId: string]: IntMenuProvider;
35
+ // }
36
+ // @customElement('ia-item-inspector')
37
+ // export class IaItemInspector extends LitElement implements IntNavController {
38
+ // @property({ type: Object }) itemMD: MetadataResponse = {
39
+ // metadata: {},
40
+ // } as MetadataResponse;
41
+ // @property({ type: String }) baseHost = 'https://archive.org';
42
+ // @property({ type: Object }) menuProviders: menuProvidersInt = {};
43
+ // @property({ type: Array }) menuShortcuts: IntMenuShortcut[] = [];
44
+ // @property({ type: Boolean }) sideMenuOpen = false;
45
+ // @property({ type: Boolean }) fullscreenState = false;
46
+ // @property({ attribute: false }) modal!: ModalManagerInterface;
47
+ // @property({ attribute: false }) sharedRO!: SharedResizeObserverInterface;
48
+ // @state() fileCount: number = 0;
49
+ // @state() loaded: boolean = false;
50
+ // @state() private shortcutOrder = ['visualMods'];
51
+ // firstUpdated() {
52
+ // this.loaded = true;
53
+ // console.log('modal', this.modal);
54
+ // }
55
+ // updated(changed: any) {
56
+ // if (changed.has('loaded')) {
57
+ // setTimeout(() => this.emitLoadingStatusUpdate(this.loaded), 1000);
58
+ // }
59
+ // if (changed.has('itemMD') && this.itemMD) {
60
+ // this.parseItemInfo();
61
+ // this.setMenu();
62
+ // }
63
+ // if (changed.has('menuProviders') || changed.has('menuShortcuts')) {
64
+ // this.updateMenuContents();
65
+ // }
66
+ // }
67
+ // modalClosedCallback() {
68
+ // console.log('item-inspector, modal closed');
69
+ // }
70
+ // openModal() {
71
+ // const config = new ModalConfig();
72
+ // const customModalContent = html`
73
+ // Can contain any markup, including web components. Event listeners also
74
+ // work. Try clicking on the picture.
75
+ // <div style="text-align: center">
76
+ // <a href="https://fillmurray.com" style="display: block">Fill Murray</a>
77
+ // <img src="100x100.jpg" alt="foo" />
78
+ // </div>
79
+ // `;
80
+ // this.modal.showModal({
81
+ // config,
82
+ // customModalContent,
83
+ // userClosedModalCallback: this.modalClosedCallback,
84
+ // });
85
+ // }
86
+ // render() {
87
+ // const { identifier = '' } = this.itemMD?.metadata;
88
+ // return html`
89
+ // <section>
90
+ // <div>
91
+ // <h2>${identifier}</h2>
92
+ // </div>
93
+ // <img src=${this.imageUrl} alt=${`${identifier} thumbnail`} />
94
+ // <button @click=${() => this.openModal()}>open modal</button>
95
+ // <p style="font-size: 20px;">
96
+ // Bacon ipsum dolor amet flank chicken leberkas sausage, meatball pork
97
+ // belly jowl. Chislic bacon salami frankfurter shankle drumstick
98
+ // andouille ball tip alcatra. Fatback beef ribs chicken, jerky ground
99
+ // round hamburger pork chop biltong. Shoulder short loin rump jerky
100
+ // kielbasa pork porchetta fatback ribeye pork belly sirloin chislic
101
+ // turducken corned beef tri-tip. Chuck pancetta meatball tail, spare
102
+ // ribs ham hock capicola pig. Ham hock hamburger chicken tri-tip venison
103
+ // swine burgdoggen boudin meatloaf pastrami chuck. Tri-tip spare ribs
104
+ // drumstick, tail rump hamburger burgdoggen swine t-bone tongue
105
+ // andouille chislic alcatra. Pork loin jowl frankfurter, doner meatball
106
+ // short loin ham hock filet mignon hamburger rump turkey bresaola
107
+ // shoulder sirloin flank. Ribeye sausage pig t-bone bacon frankfurter
108
+ // cupim capicola fatback pastrami ball tip pork belly. Picanha pancetta
109
+ // andouille flank shankle venison tri-tip tail, kevin turkey turducken
110
+ // chicken. Bacon picanha swine frankfurter, prosciutto chislic doner
111
+ // alcatra pork loin corned beef jowl biltong meatball chuck. Bacon
112
+ // burgdoggen pig fatback cupim t-bone. Cow pork loin bresaola brisket
113
+ // shoulder filet mignon chicken. Sirloin bresaola porchetta beef
114
+ // capicola meatloaf brisket shankle jerky turkey pork tri-tip swine
115
+ // kevin salami. Meatball t-bone doner venison. Pig tri-tip chuck, shank
116
+ // chicken pork chop landjaeger spare ribs jerky swine ham hock buffalo
117
+ // sirloin. Leberkas pancetta tenderloin, meatloaf buffalo rump pastrami
118
+ // chuck. Jerky cupim porchetta, tenderloin chuck andouille venison pork
119
+ // salami. Chuck strip steak cupim, turducken ham hock kielbasa shoulder
120
+ // porchetta chislic short loin tri-tip biltong cow corned beef.
121
+ // </p>
122
+ // </section>
123
+ // `;
124
+ // }
125
+ // addMenuShortcut(menuId: keyof menuProvidersInt) {
126
+ // if (this.menuShortcuts.find(m => m.id === menuId)) {
127
+ // return;
128
+ // }
129
+ // const shortcut = this.menuProviders[menuId];
130
+ // this.menuShortcuts.push(shortcut);
131
+ // this.sortMenuShortcuts();
132
+ // this.emitMenuShortcutsUpdated();
133
+ // }
134
+ // /**
135
+ // * Removes a provider object from the menuShortcuts array and emits a
136
+ // * menuShortcutsUpdated event.
137
+ // */
138
+ // removeMenuShortcut(menuId: string) {
139
+ // this.menuShortcuts = this.menuShortcuts.filter(m => m.id !== menuId);
140
+ // this.emitMenuShortcutsUpdated();
141
+ // }
142
+ // /**
143
+ // * Sorts the menuShortcuts property by comparing each provider's id to
144
+ // * the id in each iteration over the shortcutOrder array.
145
+ // */
146
+ // sortMenuShortcuts() {
147
+ // this.menuShortcuts = this.shortcutOrder.reduce(
148
+ // (shortcuts: IntMenuShortcut[], id) => {
149
+ // const menu = this.menuShortcuts.find(m => m.id === id);
150
+ // // eslint-disable-next-line no-param-reassign
151
+ // if (menu) {
152
+ // const newShortcuts = [...shortcuts, menu];
153
+ // // eslint-disable-next-line no-param-reassign
154
+ // shortcuts = newShortcuts;
155
+ // }
156
+ // return shortcuts;
157
+ // },
158
+ // []
159
+ // );
160
+ // }
161
+ // emitMenuShortcutsUpdated() {
162
+ // const event = new CustomEvent('menuShortcutsUpdated', {
163
+ // detail: this.menuShortcuts,
164
+ // });
165
+ // this.dispatchEvent(event);
166
+ // }
167
+ // setMenu() {
168
+ // const menuProviders = {
169
+ // share: new ShareProvider({
170
+ // item: this.itemMD,
171
+ // baseHost: this.baseHost,
172
+ // subPrefix: '',
173
+ // }),
174
+ // filesByType: new FilesByTypeProvider({
175
+ // item: this.itemMD,
176
+ // baseHost: this.baseHost,
177
+ // subPrefix: '',
178
+ // }),
179
+ // visualMods: new VisualModsProvider({
180
+ // updated: (modType: string) => {
181
+ // if (modType === 'toggleFullscreen') {
182
+ // this.updateFullscreenState();
183
+ // }
184
+ // },
185
+ // item: this.itemMD,
186
+ // baseHost: this.baseHost,
187
+ // subPrefix: '',
188
+ // // maybe DOM root for class configs?
189
+ // }),
190
+ // };
191
+ // this.menuProviders = menuProviders;
192
+ // this.addMenuShortcut('visualMods');
193
+ // }
194
+ // updateFullscreenState() {
195
+ // const isFullScreen = !this.fullscreenState;
196
+ // this.fullscreenState = isFullScreen;
197
+ // const event = new CustomEvent('ViewportInFullScreen', {
198
+ // detail: { isFullScreen },
199
+ // } as IntManageFullscreenEvent);
200
+ // this.dispatchEvent(event);
201
+ // }
202
+ // updateMenuContents() {
203
+ // const { share, filesByType, visualMods } = this.menuProviders;
204
+ // const availableMenus = [filesByType, share, visualMods].filter(
205
+ // menu => !!menu
206
+ // );
207
+ // const event = new CustomEvent(ItemInspectorEvents.menuUpdated, {
208
+ // detail: availableMenus,
209
+ // });
210
+ // this.dispatchEvent(event);
211
+ // }
212
+ // emitLoadingStatusUpdate(loaded: boolean) {
213
+ // const event = new CustomEvent('loadingStateUpdated', {
214
+ // detail: { loaded },
215
+ // });
216
+ // this.dispatchEvent(event);
217
+ // }
218
+ // parseItemInfo() {
219
+ // this.fileCount = this.itemMD?.files?.length || 0;
220
+ // }
221
+ // get imageUrl() {
222
+ // const { metadata = {} } = this.itemMD;
223
+ // const url = `${this.baseHost}/download/${metadata?.identifier}/__ia_thumb.jpg`;
224
+ // return url;
225
+ // }
226
+ // static get styles() {
227
+ // const main = css`
228
+ // :host {
229
+ // display: block;
230
+ // width: 100%;
231
+ // margin: 0 auto;
232
+ // position: relative;
233
+ // overflow: auto;
234
+ // background-color: black;
235
+ // color: var(--primaryTextColor, #fff);
236
+ // }
237
+ // :host,
238
+ // section {
239
+ // min-height: inherit;
240
+ // height: inherit;
241
+ // }
242
+ // section {
243
+ // margin: auto;
244
+ // width: 100%;
245
+ // text-align: center;
246
+ // }
247
+ // img {
248
+ // border: 1px solid var(--primaryTextColor, #fff);
249
+ // }
250
+ // `;
251
+ // return [main];
252
+ // }
253
+ // }
272
254
  //# sourceMappingURL=item-inspector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"item-inspector.js","sourceRoot":"","sources":["../../../src/item-inspector/item-inspector.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,yCAAyC;AACzC,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,GACN,MAAM,aAAa,CAAC;AAGrB,OAAO,EAEL,WAAW,GACZ,MAAM,gCAAgC,CAAC;AASxC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3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\n} from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\n\nimport {\n ModalManagerInterface,\n ModalConfig,\n} from '@internetarchive/modal-manager';\nimport { SharedResizeObserverInterface } from '@internetarchive/shared-resize-observer';\nimport { IntNavController } from '../interfaces/nav-controller-interface';\nimport {\n IntMenuProvider,\n IntMenuShortcut,\n} from '../interfaces/menu-interfaces';\nimport { IntManageFullscreenEvent } from '../interfaces/event-interfaces';\n\nimport { ShareProvider } from './share-provider';\nimport { FilesByTypeProvider } from './files-by-type/files-by-type-provider';\nimport { VisualModsProvider } from './visual-mod-provider';\n\n// eslint-disable-next-line no-shadow\nenum ItemInspectorEvents {\n menuUpdated = 'menuUpdated',\n updateSideMenu = 'updateSideMenu',\n PostInit = 'PostInit',\n ViewportInFullScreen = 'ViewportInFullScreen',\n}\n\ninterface menuProvidersInt {\n [menuId: string]: IntMenuProvider;\n}\n\n@customElement('ia-item-inspector')\nexport class IaItemInspector extends LitElement implements IntNavController {\n @property({ type: Object }) itemMD: MetadataResponse = {\n metadata: {},\n } as MetadataResponse;\n\n @property({ type: String }) baseHost = 'https://archive.org';\n\n @property({ type: Object }) menuProviders: menuProvidersInt = {};\n\n @property({ type: Array }) menuShortcuts: IntMenuShortcut[] = [];\n\n @property({ type: Boolean }) sideMenuOpen = false;\n\n @property({ type: Boolean }) fullscreenState = false;\n\n @property({ attribute: false }) modal!: ModalManagerInterface;\n\n @property({ attribute: false }) sharedRO!: SharedResizeObserverInterface;\n\n @state() fileCount: number = 0;\n\n @state() loaded: boolean = false;\n\n @state() private shortcutOrder = ['visualMods'];\n\n firstUpdated() {\n this.loaded = true;\n console.log('modal', this.modal);\n }\n\n updated(changed: any) {\n if (changed.has('loaded')) {\n setTimeout(() => this.emitLoadingStatusUpdate(this.loaded), 1000);\n }\n\n if (changed.has('itemMD') && this.itemMD) {\n this.parseItemInfo();\n this.setMenu();\n }\n\n if (changed.has('menuProviders') || changed.has('menuShortcuts')) {\n this.updateMenuContents();\n }\n }\n\n modalClosedCallback() {\n console.log('item-inspector, modal closed');\n }\n\n openModal() {\n const config = new ModalConfig();\n const customModalContent = html`\n Can contain any markup, including web components. Event listeners also\n work. Try clicking on the picture.\n <div style=\"text-align: center\">\n <a href=\"https://fillmurray.com\" style=\"display: block\">Fill Murray</a>\n <img src=\"100x100.jpg\" alt=\"foo\" />\n </div>\n `;\n\n this.modal.showModal({\n config,\n customModalContent,\n userClosedModalCallback: this.modalClosedCallback,\n });\n }\n\n render() {\n const { identifier = '' } = this.itemMD?.metadata;\n return html`\n <section>\n <div>\n <h2>${identifier}</h2>\n </div>\n <img src=${this.imageUrl} alt=${`${identifier} thumbnail`} />\n <button @click=${() => this.openModal()}>open modal</button>\n <p style=\"font-size: 20px;\">\n Bacon ipsum dolor amet flank chicken leberkas sausage, meatball pork\n belly jowl. Chislic bacon salami frankfurter shankle drumstick\n andouille ball tip alcatra. Fatback beef ribs chicken, jerky ground\n round hamburger pork chop biltong. Shoulder short loin rump jerky\n kielbasa pork porchetta fatback ribeye pork belly sirloin chislic\n turducken corned beef tri-tip. Chuck pancetta meatball tail, spare\n ribs ham hock capicola pig. Ham hock hamburger chicken tri-tip venison\n swine burgdoggen boudin meatloaf pastrami chuck. Tri-tip spare ribs\n drumstick, tail rump hamburger burgdoggen swine t-bone tongue\n andouille chislic alcatra. Pork loin jowl frankfurter, doner meatball\n short loin ham hock filet mignon hamburger rump turkey bresaola\n shoulder sirloin flank. Ribeye sausage pig t-bone bacon frankfurter\n cupim capicola fatback pastrami ball tip pork belly. Picanha pancetta\n andouille flank shankle venison tri-tip tail, kevin turkey turducken\n chicken. Bacon picanha swine frankfurter, prosciutto chislic doner\n alcatra pork loin corned beef jowl biltong meatball chuck. Bacon\n burgdoggen pig fatback cupim t-bone. Cow pork loin bresaola brisket\n shoulder filet mignon chicken. Sirloin bresaola porchetta beef\n capicola meatloaf brisket shankle jerky turkey pork tri-tip swine\n kevin salami. Meatball t-bone doner venison. Pig tri-tip chuck, shank\n chicken pork chop landjaeger spare ribs jerky swine ham hock buffalo\n sirloin. Leberkas pancetta tenderloin, meatloaf buffalo rump pastrami\n chuck. Jerky cupim porchetta, tenderloin chuck andouille venison pork\n salami. Chuck strip steak cupim, turducken ham hock kielbasa shoulder\n porchetta chislic short loin tri-tip biltong cow corned beef.\n </p>\n </section>\n `;\n }\n\n addMenuShortcut(menuId: keyof menuProvidersInt) {\n if (this.menuShortcuts.find(m => m.id === menuId)) {\n return;\n }\n\n const shortcut = this.menuProviders[menuId];\n this.menuShortcuts.push(shortcut);\n this.sortMenuShortcuts();\n this.emitMenuShortcutsUpdated();\n }\n\n /**\n * Removes a provider object from the menuShortcuts array and emits a\n * menuShortcutsUpdated event.\n */\n removeMenuShortcut(menuId: string) {\n this.menuShortcuts = this.menuShortcuts.filter(m => m.id !== menuId);\n this.emitMenuShortcutsUpdated();\n }\n\n /**\n * Sorts the menuShortcuts property by comparing each provider's id to\n * the id in each iteration over the shortcutOrder array.\n */\n sortMenuShortcuts() {\n this.menuShortcuts = this.shortcutOrder.reduce(\n (shortcuts: IntMenuShortcut[], id) => {\n const menu = this.menuShortcuts.find(m => m.id === id);\n\n // eslint-disable-next-line no-param-reassign\n if (menu) {\n const newShortcuts = [...shortcuts, menu];\n // eslint-disable-next-line no-param-reassign\n shortcuts = newShortcuts;\n }\n return shortcuts;\n },\n []\n );\n }\n\n emitMenuShortcutsUpdated() {\n const event = new CustomEvent('menuShortcutsUpdated', {\n detail: this.menuShortcuts,\n });\n this.dispatchEvent(event);\n }\n\n setMenu() {\n const menuProviders = {\n share: new ShareProvider({\n item: this.itemMD,\n baseHost: this.baseHost,\n subPrefix: '',\n }),\n filesByType: new FilesByTypeProvider({\n item: this.itemMD,\n baseHost: this.baseHost,\n subPrefix: '',\n }),\n visualMods: new VisualModsProvider({\n updated: (modType: string) => {\n if (modType === 'toggleFullscreen') {\n this.updateFullscreenState();\n }\n },\n item: this.itemMD,\n baseHost: this.baseHost,\n subPrefix: '',\n // maybe DOM root for class configs?\n }),\n };\n\n this.menuProviders = menuProviders;\n this.addMenuShortcut('visualMods');\n }\n\n updateFullscreenState() {\n const isFullScreen = !this.fullscreenState;\n this.fullscreenState = isFullScreen;\n\n const event = new CustomEvent('ViewportInFullScreen', {\n detail: { isFullScreen },\n } as IntManageFullscreenEvent);\n this.dispatchEvent(event);\n }\n\n updateMenuContents() {\n const { share, filesByType, visualMods } = this.menuProviders;\n const availableMenus = [filesByType, share, visualMods].filter(\n menu => !!menu\n );\n\n const event = new CustomEvent(ItemInspectorEvents.menuUpdated, {\n detail: availableMenus,\n });\n\n this.dispatchEvent(event);\n }\n\n emitLoadingStatusUpdate(loaded: boolean) {\n const event = new CustomEvent('loadingStateUpdated', {\n detail: { loaded },\n });\n this.dispatchEvent(event);\n }\n\n parseItemInfo() {\n this.fileCount = this.itemMD?.files?.length || 0;\n }\n\n get imageUrl() {\n const { metadata = {} } = this.itemMD;\n const url = `${this.baseHost}/download/${metadata?.identifier}/__ia_thumb.jpg`;\n return url;\n }\n\n static get styles() {\n const main = css`\n :host {\n display: block;\n width: 100%;\n margin: 0 auto;\n position: relative;\n overflow: auto;\n background-color: black;\n color: var(--primaryTextColor, #fff);\n }\n\n :host,\n section {\n min-height: inherit;\n height: inherit;\n }\n\n section {\n margin: auto;\n width: 100%;\n text-align: center;\n }\n\n img {\n border: 1px solid var(--primaryTextColor, #fff);\n }\n `;\n return [main];\n }\n}\n"]}
1
+ {"version":3,"file":"item-inspector.js","sourceRoot":"","sources":["../../../src/item-inspector/item-inspector.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,WAAW;AACX,SAAS;AACT,UAAU;AACV,gBAAgB;AAChB,mBAAmB;AACnB,cAAc;AACd,WAAW;AACX,wBAAwB;AACxB,sEAAsE;AAEtE,WAAW;AACX,2BAA2B;AAC3B,iBAAiB;AACjB,2CAA2C;AAC3C,2FAA2F;AAC3F,6EAA6E;AAC7E,WAAW;AACX,qBAAqB;AACrB,qBAAqB;AACrB,0CAA0C;AAC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AC9B,kDAAkD;AAClD,2CAA2C;AAE3C,8DAA8D;AAC9D,kCAAkC;AAClC,sCAAsC;AACtC,iCAAiC;AACjC,MAAM;AAEN,2BAA2B;AAC3B,qEAAqE;AACrE,sEAAsE;AACtE,uBAAuB;AACvB,SAAS;AAET,uEAAuE;AACvE,gCAAgC;AAChC,UAAU;AAEV,iCAAiC;AACjC,MAAM;AAEN,+CAA+C;AAC/C,6DAA6D;AAC7D,4BAA4B;AAC5B,UAAU;AACV,iCAAiC;AACjC,MAAM;AAEN,sBAAsB;AACtB,wDAAwD;AACxD,MAAM;AAEN,qBAAqB;AACrB,6CAA6C;AAC7C,sFAAsF;AACtF,kBAAkB;AAClB,MAAM;AAEN,0BAA0B;AAC1B,wBAAwB;AACxB,gBAAgB;AAChB,0BAA0B;AAC1B,uBAAuB;AACvB,0BAA0B;AAC1B,8BAA8B;AAC9B,0BAA0B;AAC1B,mCAAmC;AACnC,gDAAgD;AAChD,UAAU;AAEV,eAAe;AACf,kBAAkB;AAClB,+BAA+B;AAC/B,2BAA2B;AAC3B,UAAU;AAEV,kBAAkB;AAClB,wBAAwB;AACxB,uBAAuB;AACvB,8BAA8B;AAC9B,UAAU;AAEV,cAAc;AACd,2DAA2D;AAC3D,UAAU;AACV,SAAS;AACT,qBAAqB;AACrB,MAAM;AACN,IAAI","sourcesContent":["// /* eslint-disable no-console */\n// import {\n// css,\n// html,\n// LitElement,\n// customElement,\n// property,\n// state,\n// } from 'lit-element';\n// import { MetadataResponse } from '@internetarchive/search-service';\n\n// import {\n// ModalManagerInterface,\n// ModalConfig,\n// } from '@internetarchive/modal-manager';\n// import { SharedResizeObserverInterface } from '@internetarchive/shared-resize-observer';\n// import { IntNavController } from '../interfaces/nav-controller-interface';\n// import {\n// IntMenuProvider,\n// IntMenuShortcut,\n// } from '../interfaces/menu-interfaces';\n// import { IntManageFullscreenEvent } from '../interfaces/event-interfaces';\n\n// import { ShareProvider } from './share-provider';\n// import { FilesByTypeProvider } from './files-by-type/files-by-type-provider';\n// import { VisualModsProvider } from './visual-mod-provider';\n\n// // eslint-disable-next-line no-shadow\n// enum ItemInspectorEvents {\n// menuUpdated = 'menuUpdated',\n// updateSideMenu = 'updateSideMenu',\n// PostInit = 'PostInit',\n// ViewportInFullScreen = 'ViewportInFullScreen',\n// }\n\n// interface menuProvidersInt {\n// [menuId: string]: IntMenuProvider;\n// }\n\n// @customElement('ia-item-inspector')\n// export class IaItemInspector extends LitElement implements IntNavController {\n// @property({ type: Object }) itemMD: MetadataResponse = {\n// metadata: {},\n// } as MetadataResponse;\n\n// @property({ type: String }) baseHost = 'https://archive.org';\n\n// @property({ type: Object }) menuProviders: menuProvidersInt = {};\n\n// @property({ type: Array }) menuShortcuts: IntMenuShortcut[] = [];\n\n// @property({ type: Boolean }) sideMenuOpen = false;\n\n// @property({ type: Boolean }) fullscreenState = false;\n\n// @property({ attribute: false }) modal!: ModalManagerInterface;\n\n// @property({ attribute: false }) sharedRO!: SharedResizeObserverInterface;\n\n// @state() fileCount: number = 0;\n\n// @state() loaded: boolean = false;\n\n// @state() private shortcutOrder = ['visualMods'];\n\n// firstUpdated() {\n// this.loaded = true;\n// console.log('modal', this.modal);\n// }\n\n// updated(changed: any) {\n// if (changed.has('loaded')) {\n// setTimeout(() => this.emitLoadingStatusUpdate(this.loaded), 1000);\n// }\n\n// if (changed.has('itemMD') && this.itemMD) {\n// this.parseItemInfo();\n// this.setMenu();\n// }\n\n// if (changed.has('menuProviders') || changed.has('menuShortcuts')) {\n// this.updateMenuContents();\n// }\n// }\n\n// modalClosedCallback() {\n// console.log('item-inspector, modal closed');\n// }\n\n// openModal() {\n// const config = new ModalConfig();\n// const customModalContent = html`\n// Can contain any markup, including web components. Event listeners also\n// work. Try clicking on the picture.\n// <div style=\"text-align: center\">\n// <a href=\"https://fillmurray.com\" style=\"display: block\">Fill Murray</a>\n// <img src=\"100x100.jpg\" alt=\"foo\" />\n// </div>\n// `;\n\n// this.modal.showModal({\n// config,\n// customModalContent,\n// userClosedModalCallback: this.modalClosedCallback,\n// });\n// }\n\n// render() {\n// const { identifier = '' } = this.itemMD?.metadata;\n// return html`\n// <section>\n// <div>\n// <h2>${identifier}</h2>\n// </div>\n// <img src=${this.imageUrl} alt=${`${identifier} thumbnail`} />\n// <button @click=${() => this.openModal()}>open modal</button>\n// <p style=\"font-size: 20px;\">\n// Bacon ipsum dolor amet flank chicken leberkas sausage, meatball pork\n// belly jowl. Chislic bacon salami frankfurter shankle drumstick\n// andouille ball tip alcatra. Fatback beef ribs chicken, jerky ground\n// round hamburger pork chop biltong. Shoulder short loin rump jerky\n// kielbasa pork porchetta fatback ribeye pork belly sirloin chislic\n// turducken corned beef tri-tip. Chuck pancetta meatball tail, spare\n// ribs ham hock capicola pig. Ham hock hamburger chicken tri-tip venison\n// swine burgdoggen boudin meatloaf pastrami chuck. Tri-tip spare ribs\n// drumstick, tail rump hamburger burgdoggen swine t-bone tongue\n// andouille chislic alcatra. Pork loin jowl frankfurter, doner meatball\n// short loin ham hock filet mignon hamburger rump turkey bresaola\n// shoulder sirloin flank. Ribeye sausage pig t-bone bacon frankfurter\n// cupim capicola fatback pastrami ball tip pork belly. Picanha pancetta\n// andouille flank shankle venison tri-tip tail, kevin turkey turducken\n// chicken. Bacon picanha swine frankfurter, prosciutto chislic doner\n// alcatra pork loin corned beef jowl biltong meatball chuck. Bacon\n// burgdoggen pig fatback cupim t-bone. Cow pork loin bresaola brisket\n// shoulder filet mignon chicken. Sirloin bresaola porchetta beef\n// capicola meatloaf brisket shankle jerky turkey pork tri-tip swine\n// kevin salami. Meatball t-bone doner venison. Pig tri-tip chuck, shank\n// chicken pork chop landjaeger spare ribs jerky swine ham hock buffalo\n// sirloin. Leberkas pancetta tenderloin, meatloaf buffalo rump pastrami\n// chuck. Jerky cupim porchetta, tenderloin chuck andouille venison pork\n// salami. Chuck strip steak cupim, turducken ham hock kielbasa shoulder\n// porchetta chislic short loin tri-tip biltong cow corned beef.\n// </p>\n// </section>\n// `;\n// }\n\n// addMenuShortcut(menuId: keyof menuProvidersInt) {\n// if (this.menuShortcuts.find(m => m.id === menuId)) {\n// return;\n// }\n\n// const shortcut = this.menuProviders[menuId];\n// this.menuShortcuts.push(shortcut);\n// this.sortMenuShortcuts();\n// this.emitMenuShortcutsUpdated();\n// }\n\n// /**\n// * Removes a provider object from the menuShortcuts array and emits a\n// * menuShortcutsUpdated event.\n// */\n// removeMenuShortcut(menuId: string) {\n// this.menuShortcuts = this.menuShortcuts.filter(m => m.id !== menuId);\n// this.emitMenuShortcutsUpdated();\n// }\n\n// /**\n// * Sorts the menuShortcuts property by comparing each provider's id to\n// * the id in each iteration over the shortcutOrder array.\n// */\n// sortMenuShortcuts() {\n// this.menuShortcuts = this.shortcutOrder.reduce(\n// (shortcuts: IntMenuShortcut[], id) => {\n// const menu = this.menuShortcuts.find(m => m.id === id);\n\n// // eslint-disable-next-line no-param-reassign\n// if (menu) {\n// const newShortcuts = [...shortcuts, menu];\n// // eslint-disable-next-line no-param-reassign\n// shortcuts = newShortcuts;\n// }\n// return shortcuts;\n// },\n// []\n// );\n// }\n\n// emitMenuShortcutsUpdated() {\n// const event = new CustomEvent('menuShortcutsUpdated', {\n// detail: this.menuShortcuts,\n// });\n// this.dispatchEvent(event);\n// }\n\n// setMenu() {\n// const menuProviders = {\n// share: new ShareProvider({\n// item: this.itemMD,\n// baseHost: this.baseHost,\n// subPrefix: '',\n// }),\n// filesByType: new FilesByTypeProvider({\n// item: this.itemMD,\n// baseHost: this.baseHost,\n// subPrefix: '',\n// }),\n// visualMods: new VisualModsProvider({\n// updated: (modType: string) => {\n// if (modType === 'toggleFullscreen') {\n// this.updateFullscreenState();\n// }\n// },\n// item: this.itemMD,\n// baseHost: this.baseHost,\n// subPrefix: '',\n// // maybe DOM root for class configs?\n// }),\n// };\n\n// this.menuProviders = menuProviders;\n// this.addMenuShortcut('visualMods');\n// }\n\n// updateFullscreenState() {\n// const isFullScreen = !this.fullscreenState;\n// this.fullscreenState = isFullScreen;\n\n// const event = new CustomEvent('ViewportInFullScreen', {\n// detail: { isFullScreen },\n// } as IntManageFullscreenEvent);\n// this.dispatchEvent(event);\n// }\n\n// updateMenuContents() {\n// const { share, filesByType, visualMods } = this.menuProviders;\n// const availableMenus = [filesByType, share, visualMods].filter(\n// menu => !!menu\n// );\n\n// const event = new CustomEvent(ItemInspectorEvents.menuUpdated, {\n// detail: availableMenus,\n// });\n\n// this.dispatchEvent(event);\n// }\n\n// emitLoadingStatusUpdate(loaded: boolean) {\n// const event = new CustomEvent('loadingStateUpdated', {\n// detail: { loaded },\n// });\n// this.dispatchEvent(event);\n// }\n\n// parseItemInfo() {\n// this.fileCount = this.itemMD?.files?.length || 0;\n// }\n\n// get imageUrl() {\n// const { metadata = {} } = this.itemMD;\n// const url = `${this.baseHost}/download/${metadata?.identifier}/__ia_thumb.jpg`;\n// return url;\n// }\n\n// static get styles() {\n// const main = css`\n// :host {\n// display: block;\n// width: 100%;\n// margin: 0 auto;\n// position: relative;\n// overflow: auto;\n// background-color: black;\n// color: var(--primaryTextColor, #fff);\n// }\n\n// :host,\n// section {\n// min-height: inherit;\n// height: inherit;\n// }\n\n// section {\n// margin: auto;\n// width: 100%;\n// text-align: center;\n// }\n\n// img {\n// border: 1px solid var(--primaryTextColor, #fff);\n// }\n// `;\n// return [main];\n// }\n// }\n"]}