@internetarchive/ia-item-navigator 0.0.0-a1 → 0.0.0-a14
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 +101 -34
- package/demo/index.html +9 -1
- package/dist/demo/app-root.d.ts +26 -7
- package/dist/demo/app-root.js +88 -34
- package/dist/demo/app-root.js.map +1 -1
- package/dist/src/interfaces/event-interfaces.d.ts +3 -13
- package/dist/src/interfaces/event-interfaces.js.map +1 -1
- package/dist/src/interfaces/menu-interfaces.d.ts +3 -2
- package/dist/src/interfaces/menu-interfaces.js.map +1 -1
- package/dist/src/interfaces/nav-controller-interface.d.ts +9 -0
- package/dist/src/interfaces/nav-controller-interface.js.map +1 -1
- package/dist/src/item-inspector/item-inspector.d.ts +0 -41
- package/dist/src/item-inspector/item-inspector.js +253 -215
- package/dist/src/item-inspector/item-inspector.js.map +1 -1
- package/dist/src/item-inspector/visual-mod-provider.d.ts +2 -0
- package/dist/src/item-inspector/visual-mod-provider.js +3 -0
- package/dist/src/item-inspector/visual-mod-provider.js.map +1 -1
- package/dist/src/item-navigator.d.ts +36 -22
- package/dist/src/item-navigator.js +118 -108
- package/dist/src/item-navigator.js.map +1 -1
- package/dist/src/loader.d.ts +5 -0
- package/dist/src/loader.js +8 -2
- package/dist/src/loader.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 +17 -0
- package/dist/test/book-nav-stub.js +42 -0
- package/dist/test/book-nav-stub.js.map +1 -0
- package/dist/test/ia-item-navigator.test.d.ts +2 -0
- package/dist/test/ia-item-navigator.test.js +321 -0
- package/dist/test/ia-item-navigator.test.js.map +1 -0
- package/dist/test/ia-stub-goody.d.ts +210 -0
- package/dist/test/ia-stub-goody.js +276 -0
- package/dist/test/ia-stub-goody.js.map +1 -0
- package/dist/test/ia-stub.d.ts +22 -0
- package/dist/test/ia-stub.js +35 -0
- package/dist/test/ia-stub.js.map +1 -0
- 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/event-interfaces.ts +3 -14
- package/src/interfaces/menu-interfaces.ts +3 -2
- package/src/interfaces/nav-controller-interface.ts +13 -0
- package/src/item-navigator.ts +144 -122
- package/src/loader.ts +9 -2
- package/src/no-theater-available.ts +85 -0
- package/test/book-nav-stub.ts +35 -0
- package/test/ia-item-navigator.test.ts +443 -0
- package/test/ia-stub.ts +79 -0
- package/test/no-theater-available.test.ts +32 -0
- package/demo/demo-book-manifest.json +0 -1163
- 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 -235
- package/src/item-inspector/share-provider.ts +0 -51
- package/src/item-inspector/visual-mod-provider.ts +0 -60
- package/src/item-navigator-js.js +0 -372
- package/test/your-webcomponent.test.ts +0 -40
@@ -1,41 +0,0 @@
|
|
1
|
-
import { LitElement } from 'lit-element';
|
2
|
-
import { MetadataResponse } from '@internetarchive/search-service';
|
3
|
-
import { IntNavController } from '../interfaces/nav-controller-interface';
|
4
|
-
import { IntMenuProvider, IntMenuShortcut } from '../interfaces/menu-interfaces';
|
5
|
-
interface menuProvidersInt {
|
6
|
-
[menuId: string]: IntMenuProvider;
|
7
|
-
}
|
8
|
-
export declare class IaItemInspector extends LitElement implements IntNavController {
|
9
|
-
itemMD: MetadataResponse;
|
10
|
-
baseHost: string;
|
11
|
-
menuProviders: menuProvidersInt;
|
12
|
-
menuShortcuts: IntMenuShortcut[];
|
13
|
-
sideMenuOpen: boolean;
|
14
|
-
fullscreenState: boolean;
|
15
|
-
fileCount: number;
|
16
|
-
loaded: boolean;
|
17
|
-
private shortcutOrder;
|
18
|
-
firstUpdated(): void;
|
19
|
-
updated(changed: any): void;
|
20
|
-
render(): import("lit-element").TemplateResult;
|
21
|
-
addMenuShortcut(menuId: keyof menuProvidersInt): void;
|
22
|
-
/**
|
23
|
-
* Removes a provider object from the menuShortcuts array and emits a
|
24
|
-
* menuShortcutsUpdated event.
|
25
|
-
*/
|
26
|
-
removeMenuShortcut(menuId: string): void;
|
27
|
-
/**
|
28
|
-
* Sorts the menuShortcuts property by comparing each provider's id to
|
29
|
-
* the id in each iteration over the shortcutOrder array.
|
30
|
-
*/
|
31
|
-
sortMenuShortcuts(): void;
|
32
|
-
emitMenuShortcutsUpdated(): void;
|
33
|
-
setMenu(): void;
|
34
|
-
updateFullscreenState(): void;
|
35
|
-
updateMenuContents(): void;
|
36
|
-
emitLoadingStatusUpdate(loaded: boolean): void;
|
37
|
-
parseItemInfo(): void;
|
38
|
-
get imageUrl(): string;
|
39
|
-
static get styles(): import("lit-element").CSSResult[];
|
40
|
-
}
|
41
|
-
export {};
|
@@ -1,216 +1,254 @@
|
|
1
|
-
|
2
|
-
/* eslint-disable no-console */
|
3
|
-
import {
|
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
|
-
|
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
|
+
// }
|
216
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,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,GACN,MAAM,aAAa,CAAC;AASrB,OAAO,EA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M,IAAI,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KA0Bf,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF,CAAA;AAvM6B;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;AAE5C;IAAR,KAAK,EAAE;kDAAuB;AAEtB;IAAR,KAAK,EAAE;+CAAyB;AAExB;IAAR,KAAK,EAAE;sDAAwC;AAnBrC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAwM3B;SAxMY,eAAe","sourcesContent":["/* eslint-disable no-console */\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 { IntNavController } from '../interfaces/nav-controller-interface';\nimport {\n IntMenuProvider,\n IntMenuShortcut,\n} from '../interfaces/menu-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 @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('loaded ');\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 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 </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 shortcuts = [...shortcuts, menu];\n }\n console.log({ shortcuts, menu });\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 console.log('visal mods updated', modType);\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 nextFSState = !this.fullscreenState;\n this.fullscreenState = nextFSState;\n this.dispatchEvent(\n new CustomEvent('ViewportInFullScreen', {\n detail: nextFSState,\n })\n );\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: hidden;\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,sEAAsE;AAEtE,sEAAsE;AAEtE,uDAAuD;AAEvD,0DAA0D;AAE1D,mEAAmE;AAEnE,8EAA8E;AAE9E,oCAAoC;AAEpC,sCAAsC;AAEtC,qDAAqD;AAErD,qBAAqB;AACrB,0BAA0B;AAC1B,wCAAwC;AACxC,MAAM;AAEN,4BAA4B;AAC5B,mCAAmC;AACnC,2EAA2E;AAC3E,QAAQ;AAER,kDAAkD;AAClD,8BAA8B;AAC9B,wBAAwB;AACxB,QAAQ;AAER,0EAA0E;AAC1E,mCAAmC;AACnC,QAAQ;AACR,MAAM;AAEN,4BAA4B;AAC5B,mDAAmD;AACnD,MAAM;AAEN,kBAAkB;AAClB,wCAAwC;AACxC,uCAAuC;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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"]}
|
@@ -34,8 +34,11 @@ export class VisualModsProvider {
|
|
34
34
|
this.updated = updated;
|
35
35
|
this.component = html `<ia-visual-mods
|
36
36
|
@fullscreenToggle=${() => this === null || this === void 0 ? void 0 : this.updated('toggleFullscreen')}
|
37
|
+
@openModa=${this.openModal}
|
37
38
|
></ia-visual-mods>`;
|
38
39
|
}
|
40
|
+
openModal() { }
|
41
|
+
closeModal() { }
|
39
42
|
toggleFullscreen() {
|
40
43
|
this.updated('toggleFullscreen');
|
41
44
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"visual-mod-provider.js","sourceRoot":"","sources":["../../../src/item-inspector/visual-mod-provider.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yCAAyC;;AAEzC,OAAO,EAAE,IAAI,EAAkB,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9E,OAAO,qCAAqC,CAAC;AAC7C,OAAO,gEAAgE,CAAC;AAOxE,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IACjC,gBAAgB;QACd,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;uBACQ,IAAI,CAAC,gBAAgB;eAC7B,CAAC;IACd,CAAC;CACF,CAAA;AAVK,UAAU;IADf,aAAa,CAAC,gBAAgB,CAAC;GAC1B,UAAU,CAUf;AAED,MAAM,OAAO,kBAAkB;IAqB7B,YAAY,YAA6B;QApBzC,SAAI,GAAQ,IAAI,CAAC;QAEjB,aAAQ,GAAW,qBAAqB,CAAC;QAEzC,SAAI,GAAmB,IAAI,CAAA;;gCAEG,CAAC;QAE/B,OAAE,GAAW,YAAY,CAAC;QAE1B,UAAK,GAAW,sBAAsB,CAAC;QAEvC,cAAS,GAA0B,IAAI,C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AAW,EAAE,CAAC;QAEvB,qBAAgB,GAAW,EAAE,CAAC;QAE9B,YAAO,GAAQ,GAAG,EAAE,GAAE,CAAC,CAAC;QAGtB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;QAEjE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;0BACC,GAAG,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC,kBAAkB,CAAC;kBAC/C,IAAI,CAAC,SAAS;uBACT,CAAC;IACtB,CAAC;IAED,SAAS,KAAI,CAAC;IAEd,UAAU,KAAI,CAAC;IAEf,gBAAgB;QACd,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACnC,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable max-classes-per-file */\n\nimport { html, TemplateResult, customElement, LitElement } from 'lit-element';\n\nimport '@internetarchive/ia-sharing-options';\nimport '@internetarchive/icon-visual-adjustment/icon-visual-adjustment';\nimport {\n IntMenuProvider,\n IntProviderArgs,\n} from '../interfaces/menu-interfaces';\n\n@customElement('ia-visual-mods')\nclass VisualMods extends LitElement {\n toggleFullscreen() {\n this.dispatchEvent(new Event('fullscreenToggle'));\n }\n\n render() {\n return html`<section>\n <button @click=${this.toggleFullscreen}>Toggle Fullscreen</button>\n </section>`;\n }\n}\n\nexport class VisualModsProvider implements IntMenuProvider {\n item: any = null;\n\n baseHost: string = 'https://archive.org';\n\n icon: TemplateResult = html`<ia-icon-visual-adjustment\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-visual-adjustment>`;\n\n id: string = 'visualMods';\n\n label: string = 'Visual Modifications';\n\n component: TemplateResult | null = null;\n\n subPrefix: string = '';\n\n encodedSubPrefix: string = '';\n\n updated: any = () => {};\n\n constructor(providerArgs: IntProviderArgs) {\n const { item, baseHost, subPrefix = '', updated } = providerArgs;\n\n this.updated = updated;\n\n this.component = html`<ia-visual-mods\n @fullscreenToggle=${() => this?.updated('toggleFullscreen')}\n @openModa=${this.openModal}\n ></ia-visual-mods>`;\n }\n\n openModal() {}\n\n closeModal() {}\n\n toggleFullscreen() {\n this.updated('toggleFullscreen');\n }\n}\n"]}
|