@internetarchive/ia-item-navigator 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/.github/workflows/ci.yml +4 -5
  2. package/.github/workflows/gh-pages-main.yml +39 -0
  3. package/.github/workflows/pr-preview.yml +38 -0
  4. package/demo/app-root.ts +13 -13
  5. package/dist/demo/app-root.d.ts +47 -47
  6. package/dist/demo/app-root.js +200 -199
  7. package/dist/demo/app-root.js.map +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +3 -3
  10. package/dist/src/interfaces/custom-theater-interface.d.ts +20 -20
  11. package/dist/src/interfaces/custom-theater-interface.js +1 -1
  12. package/dist/src/interfaces/event-interfaces.d.ts +40 -40
  13. package/dist/src/interfaces/event-interfaces.js +1 -1
  14. package/dist/src/interfaces/menu-interfaces.d.ts +23 -22
  15. package/dist/src/interfaces/menu-interfaces.js +1 -1
  16. package/dist/src/interfaces/menu-interfaces.js.map +1 -1
  17. package/dist/src/item-navigator.d.ts +69 -69
  18. package/dist/src/item-navigator.js +259 -257
  19. package/dist/src/item-navigator.js.map +1 -1
  20. package/dist/src/loader.d.ts +9 -13
  21. package/dist/src/loader.js +35 -31
  22. package/dist/src/loader.js.map +1 -1
  23. package/dist/src/menu-slider/ia-menu-slider.d.ts +31 -30
  24. package/dist/src/menu-slider/ia-menu-slider.js +123 -124
  25. package/dist/src/menu-slider/ia-menu-slider.js.map +1 -1
  26. package/dist/src/menu-slider/menu-button.d.ts +19 -19
  27. package/dist/src/menu-slider/menu-button.js +75 -75
  28. package/dist/src/menu-slider/menu-button.js.map +1 -1
  29. package/dist/src/menu-slider/styles/menu-button.d.ts +2 -2
  30. package/dist/src/menu-slider/styles/menu-button.js +2 -2
  31. package/dist/src/menu-slider/styles/menu-slider.d.ts +2 -2
  32. package/dist/src/menu-slider/styles/menu-slider.js +5 -5
  33. package/dist/src/no-theater-available.d.ts +9 -9
  34. package/dist/src/no-theater-available.js +35 -35
  35. package/dist/src/no-theater-available.js.map +1 -1
  36. package/dist/test/ia-item-navigator.test.d.ts +1 -1
  37. package/dist/test/ia-item-navigator.test.js +296 -296
  38. package/dist/test/ia-item-navigator.test.js.map +1 -1
  39. package/dist/test/ia-stub.d.ts +22 -22
  40. package/dist/test/ia-stub.js +34 -34
  41. package/dist/test/no-theater-available.test.d.ts +1 -1
  42. package/dist/test/no-theater-available.test.js +22 -22
  43. package/dist/test/no-theater-available.test.js.map +1 -1
  44. package/dist/vite.config.d.ts +2 -0
  45. package/dist/vite.config.js +25 -0
  46. package/dist/vite.config.js.map +1 -0
  47. package/package.json +35 -21
  48. package/src/interfaces/menu-interfaces.ts +3 -1
  49. package/src/item-navigator.ts +9 -4
  50. package/src/loader.ts +5 -7
  51. package/src/menu-slider/ia-menu-slider.ts +17 -17
  52. package/src/menu-slider/menu-button.ts +3 -3
  53. package/src/no-theater-available.ts +1 -1
  54. package/test/ia-item-navigator.test.ts +24 -24
  55. package/test/no-theater-available.test.ts +2 -2
  56. package/tsconfig.json +2 -1
  57. package/vite.config.ts +25 -0
@@ -11,12 +11,12 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
 
13
13
  steps:
14
- - uses: actions/checkout@v2
15
- - uses: actions/setup-node@v1
14
+ - uses: actions/checkout@v3
15
+ - uses: actions/setup-node@v3
16
16
  with:
17
- node-version: 15.x
17
+ node-version: 16.x
18
18
 
19
- - name: Install dependencies
19
+ - name: Install dependencies
20
20
  run: yarn install
21
21
 
22
22
  - name: Run tests
@@ -24,4 +24,3 @@ jobs:
24
24
 
25
25
  - name: Upload reports
26
26
  run: npx codecov
27
-
@@ -0,0 +1,39 @@
1
+ # This workflow will generate the static page under `main` subdirectory inside the `gh-pages` branch
2
+
3
+ # This workflow will run every time new changes were pushed to the `main` branch
4
+
5
+ name: App build CI/CD to main branch
6
+
7
+ on:
8
+ push:
9
+ branches: [ main ]
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ with:
18
+ persist-credentials: false
19
+
20
+ - uses: actions/setup-node@v3
21
+ with:
22
+ node-version: 16.x
23
+
24
+ - name: Install dependencies
25
+ run: yarn install
26
+
27
+ - name: Create build files for gh-pages deploy
28
+ run: yarn ghpages:build
29
+
30
+ # Reference: https://github.com/JamesIves/github-pages-deploy-action
31
+ - name: Deploy 🚀
32
+ uses: JamesIves/github-pages-deploy-action@v4.4.1
33
+ with:
34
+ branch: gh-pages
35
+ folder: ghpages
36
+ clean-exclude: pr/
37
+ force: false
38
+ target-folder: main
39
+ token: ${{ secrets.GH_TOKEN }}
@@ -0,0 +1,38 @@
1
+ # This workflow will generate the static page under `pr` subdirectory inside the `gh-pages` branch
2
+
3
+ # This workflow will run every time there's a PR opened, reopened, synchronize, or closed
4
+
5
+ name: Deploy PR previews
6
+
7
+ on:
8
+ pull_request:
9
+ types:
10
+ - opened
11
+ - reopened
12
+ - synchronize
13
+ - closed
14
+
15
+ concurrency: preview-${{ github.ref }}
16
+
17
+ jobs:
18
+ deploy-preview:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v3
23
+
24
+ - uses: actions/setup-node@v3
25
+ with:
26
+ node-version: 16.x
27
+
28
+ - name: Install and Build
29
+ run: |
30
+ yarn install
31
+ yarn ghpages:build
32
+
33
+ # Reference: https://github.com/rossjrw/pr-preview-action
34
+ - name: Deploy preview
35
+ uses: rossjrw/pr-preview-action@v1
36
+ with:
37
+ source-dir: ./ghpages/
38
+ umbrella-dir: pr
package/demo/app-root.ts CHANGED
@@ -12,8 +12,9 @@ import { ItemNavigator } from '../src/item-navigator';
12
12
  import '../src/item-navigator';
13
13
  import {
14
14
  MenuShortcutInterface,
15
- MenuDetailsInterface,
15
+ MenuProviderInterface,
16
16
  } from '../src/interfaces/menu-interfaces';
17
+
17
18
  @customElement('app-root')
18
19
  export class AppRoot extends LitElement {
19
20
  /**
@@ -26,22 +27,20 @@ export class AppRoot extends LitElement {
26
27
  @property({ attribute: false }) sharedObserver = new SharedResizeObserver();
27
28
 
28
29
  @property({ type: Array, attribute: false })
29
- menuContents: MenuDetailsInterface[] = [];
30
+ menuContents: MenuProviderInterface[] = [];
30
31
 
31
32
  @property({ type: Array, attribute: false })
32
33
  menuShortcuts: MenuShortcutInterface[] = [];
33
34
 
34
- @property({ reflect: true, attribute: true }) fullscreen:
35
- | boolean
36
- | null = null;
35
+ @property({ reflect: true, attribute: true }) fullscreen: boolean | null =
36
+ null;
37
37
 
38
38
  @property({ reflect: true, attribute: true }) headerOn: true | null = null;
39
39
 
40
- @property({ reflect: true, attribute: true }) loaded = true;
40
+ @property({ reflect: true, attribute: true }) loaded: true | null = true;
41
41
 
42
- @property({ reflect: true, attribute: true }) showPlaceholder:
43
- | true
44
- | null = null;
42
+ @property({ reflect: true, attribute: true }) showPlaceholder: true | null =
43
+ null;
45
44
 
46
45
  @property({ reflect: true, attribute: true }) showTheaterExample:
47
46
  | true
@@ -56,7 +55,7 @@ export class AppRoot extends LitElement {
56
55
  console.log(
57
56
  '<app-root> component has loaded',
58
57
  this.modalMgr,
59
- this.sharedObserver
58
+ this.sharedObserver,
60
59
  );
61
60
 
62
61
  this.itemNav.viewAvailable = false;
@@ -76,7 +75,7 @@ export class AppRoot extends LitElement {
76
75
  if (mdResponse.error) {
77
76
  console.log('MD Fetch error: ', mdResponse.error);
78
77
  (window as any).confirm(
79
- 'There was an error fetching response, please check dev console'
78
+ 'There was an error fetching response, please check dev console',
80
79
  );
81
80
  return;
82
81
  }
@@ -120,7 +119,8 @@ export class AppRoot extends LitElement {
120
119
  }
121
120
 
122
121
  toggleLoader() {
123
- this.loaded = !this.loaded;
122
+ const nextState = this.loaded === true ? null : true;
123
+ this.loaded = nextState;
124
124
  }
125
125
 
126
126
  togglePlaceholder() {
@@ -162,7 +162,7 @@ export class AppRoot extends LitElement {
162
162
  label: 'Exit',
163
163
  selected: false,
164
164
  },
165
- ];
165
+ ] as any as MenuProviderInterface[];
166
166
 
167
167
  this.fullscreen = nextState;
168
168
  }
@@ -1,47 +1,47 @@
1
- import { LitElement, TemplateResult } from 'lit';
2
- import { MetadataResponse } from '@internetarchive/search-service';
3
- import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
4
- import { ModalManager } from '@internetarchive/modal-manager';
5
- import '@internetarchive/modal-manager';
6
- import '../src/item-navigator';
7
- import { MenuShortcutInterface, MenuDetailsInterface } from '../src/interfaces/menu-interfaces';
8
- export declare class AppRoot extends LitElement {
9
- /**
10
- * Example controller to connect to `<ia-item-navigator>`
11
- */
12
- itemMD?: MetadataResponse;
13
- encodedManifest: string;
14
- sharedObserver: SharedResizeObserver;
15
- menuContents: MenuDetailsInterface[];
16
- menuShortcuts: MenuShortcutInterface[];
17
- fullscreen: boolean | null;
18
- headerOn: true | null;
19
- loaded: boolean;
20
- showPlaceholder: true | null;
21
- showTheaterExample: true | null;
22
- private itemNav;
23
- modalMgr: ModalManager;
24
- firstUpdated(): void;
25
- updated(changed: any): void;
26
- fetchItemMD(): Promise<void>;
27
- get theaterReady(): boolean;
28
- get urlParams(): URLSearchParams;
29
- /** Fullscreen */
30
- get showFullscreen(): boolean;
31
- /** sets url query param `view=theater` to toggle fullscreen */
32
- toggleFS(): void;
33
- /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */
34
- fullscreenCheck(): void;
35
- /** End fullscreen */
36
- toggleHeader(): void;
37
- toggleLoader(): void;
38
- togglePlaceholder(): void;
39
- toggleImmersion(): void;
40
- toggleTheaterExample(): void;
41
- /** Views */
42
- get theaterExample(): TemplateResult;
43
- get headerExample(): TemplateResult;
44
- get isViewAvailable(): boolean;
45
- render(): TemplateResult;
46
- static styles: import("lit").CSSResult;
47
- }
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ import { MetadataResponse } from '@internetarchive/search-service';
3
+ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
4
+ import { ModalManager } from '@internetarchive/modal-manager';
5
+ import '@internetarchive/modal-manager';
6
+ import '../src/item-navigator';
7
+ import { MenuShortcutInterface, MenuProviderInterface } from '../src/interfaces/menu-interfaces';
8
+ export declare class AppRoot extends LitElement {
9
+ /**
10
+ * Example controller to connect to `<ia-item-navigator>`
11
+ */
12
+ itemMD?: MetadataResponse;
13
+ encodedManifest: string;
14
+ sharedObserver: SharedResizeObserver;
15
+ menuContents: MenuProviderInterface[];
16
+ menuShortcuts: MenuShortcutInterface[];
17
+ fullscreen: boolean | null;
18
+ headerOn: true | null;
19
+ loaded: true | null;
20
+ showPlaceholder: true | null;
21
+ showTheaterExample: true | null;
22
+ private itemNav;
23
+ modalMgr: ModalManager;
24
+ firstUpdated(): void;
25
+ updated(changed: any): void;
26
+ fetchItemMD(): Promise<void>;
27
+ get theaterReady(): boolean;
28
+ get urlParams(): URLSearchParams;
29
+ /** Fullscreen */
30
+ get showFullscreen(): boolean;
31
+ /** sets url query param `view=theater` to toggle fullscreen */
32
+ toggleFS(): void;
33
+ /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */
34
+ fullscreenCheck(): void;
35
+ /** End fullscreen */
36
+ toggleHeader(): void;
37
+ toggleLoader(): void;
38
+ togglePlaceholder(): void;
39
+ toggleImmersion(): void;
40
+ toggleTheaterExample(): void;
41
+ /** Views */
42
+ get theaterExample(): TemplateResult;
43
+ get headerExample(): TemplateResult;
44
+ get isViewAvailable(): boolean;
45
+ render(): TemplateResult;
46
+ static styles: import("lit").CSSResult;
47
+ }