@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.
- package/README.md +29 -19
- package/demo/app-root.ts +37 -31
- package/demo/index.html +1 -0
- package/dist/demo/app-root.d.ts +11 -15
- package/dist/demo/app-root.js +26 -26
- package/dist/demo/app-root.js.map +1 -1
- package/dist/src/interfaces/custom-theater-interface.d.ts +20 -0
- package/dist/src/interfaces/custom-theater-interface.js +2 -0
- package/dist/src/interfaces/custom-theater-interface.js.map +1 -0
- package/dist/src/interfaces/event-interfaces.d.ts +11 -11
- package/dist/src/interfaces/event-interfaces.js.map +1 -1
- package/dist/src/interfaces/menu-interfaces.d.ts +6 -7
- package/dist/src/interfaces/menu-interfaces.js.map +1 -1
- package/dist/src/interfaces/nav-controller-interface.d.ts +11 -6
- package/dist/src/interfaces/nav-controller-interface.js.map +1 -1
- package/dist/src/item-inspector/item-inspector.d.ts +0 -47
- package/dist/src/item-inspector/item-inspector.js +253 -271
- package/dist/src/item-inspector/item-inspector.js.map +1 -1
- package/dist/src/item-navigator.d.ts +41 -28
- package/dist/src/item-navigator.js +96 -113
- package/dist/src/item-navigator.js.map +1 -1
- package/dist/src/no-theater-available.d.ts +9 -0
- package/dist/src/no-theater-available.js +79 -0
- package/dist/src/no-theater-available.js.map +1 -0
- package/dist/test/book-nav-stub.d.ts +22 -0
- package/dist/test/book-nav-stub.js +49 -0
- package/dist/test/book-nav-stub.js.map +1 -0
- package/dist/test/ia-item-navigator.test.d.ts +1 -0
- package/dist/test/ia-item-navigator.test.js +279 -131
- package/dist/test/ia-item-navigator.test.js.map +1 -1
- package/dist/test/ia-stub.d.ts +22 -0
- package/dist/test/ia-stub.js +34 -3
- package/dist/test/ia-stub.js.map +1 -1
- package/dist/test/no-theater-available.test.d.ts +1 -0
- package/dist/test/no-theater-available.test.js +27 -0
- package/dist/test/no-theater-available.test.js.map +1 -0
- package/package.json +4 -3
- package/src/interfaces/custom-theater-interface.ts +28 -0
- package/src/interfaces/event-interfaces.ts +15 -11
- package/src/interfaces/menu-interfaces.ts +9 -10
- package/src/item-navigator.ts +133 -144
- package/src/no-theater-available.ts +85 -0
- package/test/book-nav-stub.ts +47 -0
- package/test/ia-item-navigator.test.ts +365 -156
- package/test/ia-stub.ts +78 -2
- package/test/no-theater-available.test.ts +32 -0
- package/demo/demo-book-manifest.json +0 -1163
- package/src/interfaces/nav-controller-interface.ts +0 -18
- package/src/item-inspector/files-by-type/files-by-type-provider.ts +0 -43
- package/src/item-inspector/files-by-type/ia-files-by-type.ts +0 -100
- package/src/item-inspector/item-inspector.ts +0 -296
- package/src/item-inspector/share-provider.ts +0 -51
- package/src/item-inspector/visual-mod-provider.ts +0 -65
- package/src/item-navigator-js.js +0 -372
@@ -1,272 +1,254 @@
|
|
1
|
-
|
2
|
-
/* eslint-disable no-console */
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
//
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
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;AAE3D,qCAAqC;AACrC,IAAK,mBAKJ;AALD,WAAK,mBAAmB;IACtB,kDAA2B,CAAA;IAC3B,wDAAiC,CAAA;IACjC,4CAAqB,CAAA;IACrB,oEAA6C,CAAA;AAC/C,CAAC,EALI,mBAAmB,KAAnB,mBAAmB,QAKvB;AAOD,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,UAAU;IAA/C;;QAC8B,WAAM,GAAqB;YACrD,QAAQ,EAAE,EAAE;SACO,CAAC;QAEM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;;;;;;;;;;KA0Bf,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF,CAAA;AA7P6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAEL;AAEM;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAkC;AAEjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAsC;AAEtC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sDAAuC;AAEpC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDAAsB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAyB;AAErB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CAA+B;AAE9B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDAA0C;AAEhE;IAAR,KAAK,EAAE;kDAAuB;AAEtB;IAAR,KAAK,EAAE;+CAAyB;AAExB;IAAR,KAAK,EAAE;sDAAwC;AAvBrC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA8P3B;SA9PY,eAAe","sourcesContent":["/* eslint-disable no-console */\n/* eslint-disable import/no-duplicates */\nimport {\n css,\n html,\n LitElement,\n customElement,\n property,\n state,\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;AAC1C,6EAA6E;AAE7E,oDAAoD;AACpD,gFAAgF;AAChF,8DAA8D;AAE9D,wCAAwC;AACxC,6BAA6B;AAC7B,iCAAiC;AACjC,uCAAuC;AACvC,2BAA2B;AAC3B,mDAAmD;AACnD,IAAI;AAEJ,+BAA+B;AAC/B,uCAAuC;AACvC,IAAI;AAEJ,sCAAsC;AACtC,gFAAgF;AAChF,6DAA6D;AAC7D,oBAAoB;AACpB,2BAA2B;AAE3B,kEAAkE;AAElE,s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V,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"]}
|