@internetarchive/ia-item-navigator 0.0.0 → 0.0.2
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 +113 -22
- package/demo/index.html +12 -4
- package/dist/demo/app-root.d.ts +27 -7
- package/dist/demo/app-root.js +98 -23
- 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 +13 -23
- package/dist/src/interfaces/event-interfaces.js.map +1 -1
- package/dist/src/interfaces/menu-interfaces.d.ts +7 -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/files-by-type/files-by-type-provider.js +5 -3
- package/dist/src/item-inspector/files-by-type/files-by-type-provider.js.map +1 -1
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.d.ts +1 -0
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.js +14 -0
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.js.map +1 -1
- package/dist/src/item-inspector/item-inspector.d.ts +0 -31
- package/dist/src/item-inspector/item-inspector.js +253 -181
- package/dist/src/item-inspector/item-inspector.js.map +1 -1
- package/dist/src/item-inspector/visual-mod-provider.d.ts +19 -0
- package/dist/src/item-inspector/visual-mod-provider.js +46 -0
- package/dist/src/item-inspector/visual-mod-provider.js.map +1 -0
- package/dist/src/item-navigator.d.ts +50 -28
- package/dist/src/item-navigator.js +216 -132
- 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 +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 +2 -0
- package/dist/test/ia-item-navigator.test.js +317 -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 +14 -5
- package/src/interfaces/custom-theater-interface.ts +28 -0
- package/src/interfaces/event-interfaces.ts +17 -24
- package/src/interfaces/menu-interfaces.ts +10 -9
- package/src/item-navigator.ts +257 -155
- package/src/loader.ts +9 -2
- package/src/no-theater-available.ts +85 -0
- package/test/book-nav-stub.ts +47 -0
- package/test/ia-item-navigator.test.ts +438 -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/demo/demo-item-md.json +0 -247
- package/src/interfaces/nav-controller-interface.ts +0 -18
- package/src/item-inspector/files-by-type/files-by-type-provider.ts +0 -41
- package/src/item-inspector/files-by-type/ia-files-by-type.ts +0 -84
- package/src/item-inspector/item-inspector.ts +0 -202
- package/src/item-inspector/share-provider.ts +0 -51
- package/src/item-navigator-js.js +0 -372
- package/test/your-webcomponent.test.ts +0 -40
@@ -1,22 +1,22 @@
|
|
1
1
|
import { TemplateResult } from 'lit-html';
|
2
2
|
import { MetadataResponse } from '@internetarchive/search-service';
|
3
|
-
export
|
3
|
+
export declare type MenuId = string;
|
4
|
+
export interface MenuShortcutInterface {
|
4
5
|
icon: TemplateResult;
|
5
|
-
id:
|
6
|
+
id: MenuId;
|
6
7
|
}
|
7
|
-
export interface
|
8
|
-
icon: TemplateResult;
|
9
|
-
id: string;
|
8
|
+
export interface MenuDetailsInterface extends MenuShortcutInterface {
|
10
9
|
label: string;
|
11
10
|
menuDetails?: TemplateResult;
|
12
11
|
selected?: boolean;
|
13
12
|
followable?: boolean;
|
14
13
|
href?: string;
|
15
14
|
}
|
16
|
-
export interface
|
15
|
+
export interface MenuProviderBaseConfigInterface {
|
17
16
|
item: MetadataResponse;
|
18
17
|
baseHost: string;
|
19
18
|
subPrefix: string;
|
19
|
+
updated?: any;
|
20
20
|
}
|
21
|
-
export interface
|
21
|
+
export interface MenuProviderInterface extends MenuProviderBaseConfigInterface, MenuDetailsInterface, MenuShortcutInterface {
|
22
22
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu-interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/menu-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\n\nexport interface
|
1
|
+
{"version":3,"file":"menu-interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/menu-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\n\nexport type MenuId = string;\nexport interface MenuShortcutInterface {\n icon: TemplateResult;\n id: MenuId;\n}\n\nexport interface MenuDetailsInterface extends MenuShortcutInterface {\n label: string;\n menuDetails?: TemplateResult;\n selected?: boolean;\n followable?: boolean;\n href?: string;\n}\n\nexport interface MenuProviderBaseConfigInterface {\n item: MetadataResponse;\n baseHost: string;\n subPrefix: string;\n updated?: any;\n}\nexport interface MenuProviderInterface\n extends MenuProviderBaseConfigInterface,\n MenuDetailsInterface,\n MenuShortcutInterface {}\n"]}
|
@@ -1,12 +1,17 @@
|
|
1
1
|
import { LitElement } from 'lit-element';
|
2
2
|
import { MetadataResponse } from '@internetarchive/search-service';
|
3
|
-
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
import { ModalManager } from '@internetarchive/modal-manager';
|
4
|
+
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
5
|
+
import { IntMenuProvider, IntMenuShortcut } from './menu-interfaces';
|
6
|
+
export interface CustomTheaterInterface extends LitElement {
|
7
|
+
baseHost?: string;
|
8
|
+
itemMD?: MetadataResponse;
|
9
|
+
menuProviders?: IntMenuProvider[];
|
10
|
+
menuShortcuts?: IntMenuShortcut[];
|
9
11
|
sideMenuOpen: boolean;
|
12
|
+
signedIn?: boolean | null;
|
13
|
+
sharedObserver?: SharedResizeObserver;
|
14
|
+
modal?: ModalManager;
|
10
15
|
emitLoadingStatusUpdate: (loaded: boolean) => void;
|
11
16
|
addMenuShortcut: (menuId: string) => void;
|
12
17
|
removeMenuShortcut: (menuId: string) => void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nav-controller-interface.js","sourceRoot":"","sources":["../../../src/interfaces/nav-controller-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement } from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport { IntMenuShortcut } from './menu-interfaces';\n\nexport interface
|
1
|
+
{"version":3,"file":"nav-controller-interface.js","sourceRoot":"","sources":["../../../src/interfaces/nav-controller-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement } from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { IntMenuProvider, IntMenuShortcut } from './menu-interfaces';\n\nexport interface CustomTheaterInterface extends LitElement {\n baseHost?: string;\n itemMD?: MetadataResponse;\n menuProviders?: IntMenuProvider[];\n menuShortcuts?: IntMenuShortcut[];\n sideMenuOpen: boolean;\n\n signedIn?: boolean | null;\n\n sharedObserver?: SharedResizeObserver;\n modal?: ModalManager;\n\n emitLoadingStatusUpdate: (loaded: boolean) => void;\n\n addMenuShortcut: (menuId: string) => void;\n removeMenuShortcut: (menuId: string) => void;\n sortMenuShortcuts: () => void;\n emitMenuShortcutsUpdated: () => void;\n}\n"]}
|
@@ -5,9 +5,11 @@ export class FilesByTypeProvider {
|
|
5
5
|
constructor(shareArgs) {
|
6
6
|
this.item = null;
|
7
7
|
this.baseHost = 'https://archive.org';
|
8
|
-
this.icon = html `<
|
9
|
-
style="
|
10
|
-
|
8
|
+
this.icon = html `<p
|
9
|
+
style="color: #fff; font-size: var(--iconHeight);"
|
10
|
+
>
|
11
|
+
F
|
12
|
+
</p>`;
|
11
13
|
this.id = 'filesByType';
|
12
14
|
this.label = 'Files by type';
|
13
15
|
this.component = null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"files-by-type-provider.js","sourceRoot":"","sources":["../../../../src/item-inspector/files-by-type/files-by-type-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AAEnD,OAAO,oBAAoB,CAAC;AAC5B,OAAO,wCAAwC,CAAC;AAMhD,MAAM,OAAO,mBAAmB;
|
1
|
+
{"version":3,"file":"files-by-type-provider.js","sourceRoot":"","sources":["../../../../src/item-inspector/files-by-type/files-by-type-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AAEnD,OAAO,oBAAoB,CAAC;AAC5B,OAAO,wCAAwC,CAAC;AAMhD,MAAM,OAAO,mBAAmB;IAmB9B,YAAY,SAA0B;QAlBtC,SAAI,GAAQ,IAAI,CAAC;QAEjB,aAAQ,GAAW,qBAAqB,CAAC;QAEzC,SAAI,GAAmB,IAAI,CAAA;;;;OAItB,CAAC;QAEN,OAAE,GAAW,aAAa,CAAC;QAE3B,UAAK,GAAW,eAAe,CAAC;QAEhC,cAAS,GAA0B,IAAI,CAAC;QAExC,cAAS,GAAW,EAAE,CAAC;QAGrB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,SAAS,CAAC;QACrD,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;QAErC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;cACX,IAAI,CAAC,IAAI;sBACD,KAAK;mBACR,IAAI,CAAC,QAAQ;yBACP,CAAC;IACxB,CAAC;CACF","sourcesContent":["import { html, TemplateResult } from 'lit-element';\n\nimport './ia-files-by-type';\nimport '@internetarchive/icon-share/icon-share';\nimport {\n IntMenuProvider,\n IntProviderArgs,\n} from '../../interfaces/menu-interfaces';\n\nexport class FilesByTypeProvider implements IntMenuProvider {\n item: any = null;\n\n baseHost: string = 'https://archive.org';\n\n icon: TemplateResult = html`<p\n style=\"color: #fff; font-size: var(--iconHeight);\"\n >\n F\n </p>`;\n\n id: string = 'filesByType';\n\n label: string = 'Files by type';\n\n component: TemplateResult | null = null;\n\n subPrefix: string = '';\n\n constructor(shareArgs: IntProviderArgs) {\n const { item, baseHost, subPrefix = '' } = shareArgs;\n const { title = '' } = item.metadata;\n\n this.item = item;\n this.baseHost = baseHost;\n this.subPrefix = subPrefix;\n\n this.component = html`<ia-files-by-type\n .item=${this.item}\n .description=\"${title}\"\n .baseHost=\"${this.baseHost}\"\n ></ia-files-by-type>`;\n }\n}\n"]}
|
@@ -21,6 +21,20 @@ let IaFilesByType = class IaFilesByType extends LitElement {
|
|
21
21
|
</div>
|
22
22
|
`;
|
23
23
|
}
|
24
|
+
sortByViewer() {
|
25
|
+
// const images = [];
|
26
|
+
// const books = [];
|
27
|
+
// const radio = [];
|
28
|
+
// const audio = [];
|
29
|
+
// const video = [];
|
30
|
+
// const albums = [];
|
31
|
+
// const software = [];
|
32
|
+
// this.collapsedFiles.forEach((fi) => {
|
33
|
+
// // if image
|
34
|
+
// // sort by various viewers
|
35
|
+
// })
|
36
|
+
return true;
|
37
|
+
}
|
24
38
|
collapseFiles() {
|
25
39
|
const { files = [] } = this === null || this === void 0 ? void 0 : this.item;
|
26
40
|
const archivalArtifacts = [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ia-files-by-type.js","sourceRoot":"","sources":["../../../../src/item-inspector/files-by-type/ia-files-by-type.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQxE,IAAqB,aAAa,GAAlC,MAAqB,aAAc,SAAQ,UAAU;IAArD;;QAC8B,SAAI,GAAqB,EAAsB,CAAC;QAEjD,sBAAiB,GAAW,EAAE,CAAC;QAE/B,mBAAc,GAAuB,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"ia-files-by-type.js","sourceRoot":"","sources":["../../../../src/item-inspector/files-by-type/ia-files-by-type.ts"],"names":[],"mappings":"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","sourcesContent":["import { MetadataResponse, File } from '@internetarchive/search-service';\nimport { html, customElement, LitElement, property } from 'lit-element';\n\ninterface CollapsedFileInt extends File {\n [menuId: string]: any;\n derivatives: [];\n}\n\n@customElement('ia-files-by-type')\nexport default class IaFilesByType extends LitElement {\n @property({ type: Object }) item: MetadataResponse = {} as MetadataResponse;\n\n @property({ type: Array }) archivalArtifacts: File[] = [];\n\n @property({ type: Array }) collapsedFiles: CollapsedFileInt[] = [];\n\n firstUpdated() {\n this.collapseFiles();\n }\n\n render() {\n return html`\n <div>\n <p>there are ${this.collapsedFiles.length} original files</p>\n\n <p>there are ${this.archivalArtifacts.length} archival artifacts</p>\n\n <p></p>\n </div>\n `;\n }\n\n sortByViewer() {\n // const images = [];\n // const books = [];\n // const radio = [];\n // const audio = [];\n // const video = [];\n // const albums = [];\n // const software = [];\n // this.collapsedFiles.forEach((fi) => {\n // // if image\n // // sort by various viewers\n // })\n\n return true;\n }\n\n collapseFiles() {\n const { files = [] } = this?.item as MetadataResponse;\n\n const archivalArtifacts: File[] = [];\n const origDir: any = {};\n\n files.forEach(fi => {\n const { format, source, name, original = '' } = fi as File;\n if (\n format.toLowerCase() === 'metadata' ||\n format.toLowerCase() === 'item tile'\n ) {\n archivalArtifacts.push(fi);\n return;\n }\n\n let origEntry: any = {};\n if (source === 'original') {\n origEntry = origDir[name];\n if (!origEntry) {\n // add new\n origDir[name] = { ...fi, derivatives: [] } as CollapsedFileInt;\n origEntry = origDir[name];\n } else {\n // update\n const merged = { ...origEntry, ...fi };\n origDir[name] = merged;\n }\n return;\n }\n\n if (source === 'derivative') {\n const keyToFile = original || '';\n origEntry = origDir[keyToFile];\n if (!origEntry && original) {\n // add new\n const fileFrame = { derivatives: [] } as CollapsedFileInt;\n origEntry = fileFrame;\n origEntry?.derivatives.push(fi);\n origDir[keyToFile] = origEntry;\n origEntry = origDir[keyToFile];\n }\n origEntry?.derivatives.push(fi);\n }\n });\n\n this.archivalArtifacts = archivalArtifacts;\n this.collapsedFiles = Object.keys(origDir).map(\n (fileName: string) => origDir[fileName]\n );\n }\n}\n"]}
|
@@ -1,31 +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 { IntMenuShortcut, IntMenuProvider } 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
|
-
shortcutOrder: string[];
|
14
|
-
sideMenuOpen: boolean;
|
15
|
-
fileCount: number;
|
16
|
-
loaded: boolean;
|
17
|
-
firstUpdated(): void;
|
18
|
-
updated(changed: any): void;
|
19
|
-
render(): import("lit-element").TemplateResult;
|
20
|
-
setMenu(): void;
|
21
|
-
addMenuShortcut(menuId: keyof menuProvidersInt): void;
|
22
|
-
sortMenuShortcuts(): void;
|
23
|
-
emitMenuShortcutsUpdated(): void;
|
24
|
-
removeMenuShortcut(menuId: string): void;
|
25
|
-
updateMenuContents(): void;
|
26
|
-
emitLoadingStatusUpdate(loaded: boolean): void;
|
27
|
-
parseItemInfo(): void;
|
28
|
-
get imageUrl(): string;
|
29
|
-
static get styles(): import("lit-element").CSSResult[];
|
30
|
-
}
|
31
|
-
export {};
|
@@ -1,182 +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
|
-
|
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
|
+
// }
|
182
254
|
//# sourceMappingURL=item-inspector.js.map
|