@internetarchive/collection-browser 0.1.3 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/src/assets/img/icons/mediatype/livemusic.d.ts +1 -0
  2. package/dist/src/assets/img/icons/mediatype/livemusic.js +7 -0
  3. package/dist/src/assets/img/icons/mediatype/livemusic.js.map +1 -0
  4. package/dist/src/assets/img/icons/mediatype/photos.d.ts +1 -0
  5. package/dist/src/assets/img/icons/mediatype/photos.js +7 -0
  6. package/dist/src/assets/img/icons/mediatype/photos.js.map +1 -0
  7. package/dist/src/collection-browser.d.ts +1 -1
  8. package/dist/src/collection-browser.js +1 -0
  9. package/dist/src/collection-browser.js.map +1 -1
  10. package/dist/src/helpers.d.ts +1 -0
  11. package/dist/src/helpers.js +20 -0
  12. package/dist/src/helpers.js.map +1 -0
  13. package/dist/src/mediatype/mediatype-color.d.ts +3 -0
  14. package/dist/src/mediatype/mediatype-color.js +15 -0
  15. package/dist/src/mediatype/mediatype-color.js.map +1 -0
  16. package/dist/src/mediatype/mediatype-display.d.ts +3 -0
  17. package/dist/src/mediatype/mediatype-display.js +86 -0
  18. package/dist/src/mediatype/mediatype-display.js.map +1 -0
  19. package/dist/src/mediatype/mediatype-icon.d.ts +10 -0
  20. package/dist/src/mediatype/mediatype-icon.js +105 -0
  21. package/dist/src/mediatype/mediatype-icon.js.map +1 -0
  22. package/dist/src/mediatype/mediatype-text.d.ts +3 -0
  23. package/dist/src/mediatype/mediatype-text.js +17 -0
  24. package/dist/src/mediatype/mediatype-text.js.map +1 -0
  25. package/dist/src/mediatype/mediatypeConfig.d.ts +3 -0
  26. package/dist/src/mediatype/mediatypeConfig.js +86 -0
  27. package/dist/src/mediatype/mediatypeConfig.js.map +1 -0
  28. package/dist/src/mediatype-icon.d.ts +9 -0
  29. package/dist/src/mediatype-icon.js +78 -0
  30. package/dist/src/mediatype-icon.js.map +1 -0
  31. package/dist/src/sort-filter-bar/img/grid.d.ts +1 -0
  32. package/dist/src/sort-filter-bar/img/grid.js +5 -0
  33. package/dist/src/sort-filter-bar/img/grid.js.map +1 -0
  34. package/dist/src/tiles/item-image.d.ts +4 -0
  35. package/dist/src/tiles/item-image.js +30 -10
  36. package/dist/src/tiles/item-image.js.map +1 -1
  37. package/dist/src/tiles/list/tile-list-detail.d.ts +7 -0
  38. package/dist/src/tiles/list/tile-list-detail.js +28 -0
  39. package/dist/src/tiles/list/tile-list-detail.js.map +1 -0
  40. package/dist/src/tiles/loading-tile.d.ts +5 -0
  41. package/dist/src/tiles/loading-tile.js +32 -0
  42. package/dist/src/tiles/loading-tile.js.map +1 -0
  43. package/dist/src/utils/format-string.d.ts +2 -0
  44. package/dist/src/utils/format-string.js +7 -0
  45. package/dist/src/utils/format-string.js.map +1 -0
  46. package/dist/src/waveform-thumbnail.d.ts +7 -0
  47. package/dist/src/waveform-thumbnail.js +106 -0
  48. package/dist/src/waveform-thumbnail.js.map +1 -0
  49. package/dist/src/waveform-view.d.ts +0 -0
  50. package/dist/src/waveform-view.js +2 -0
  51. package/dist/src/waveform-view.js.map +1 -0
  52. package/dist/src/your-webcomponent.d.ts +8 -0
  53. package/dist/src/your-webcomponent.js +38 -0
  54. package/dist/src/your-webcomponent.js.map +1 -0
  55. package/dist/test/mediatype-icon.test.d.ts +0 -0
  56. package/dist/test/mediatype-icon.test.js +3 -0
  57. package/dist/test/mediatype-icon.test.js.map +1 -0
  58. package/dist/test/mediatypeConfig.test.d.ts +1 -0
  59. package/dist/test/mediatypeConfig.test.js +17 -0
  60. package/dist/test/mediatypeConfig.test.js.map +1 -0
  61. package/dist/test/utils/format-string.test.d.ts +1 -0
  62. package/dist/test/utils/format-string.test.js +17 -0
  63. package/dist/test/utils/format-string.test.js.map +1 -0
  64. package/dist/test/your-webcomponent.test.d.ts +1 -0
  65. package/dist/test/your-webcomponent.test.js +23 -0
  66. package/dist/test/your-webcomponent.test.js.map +1 -0
  67. package/package.json +2 -2
  68. package/src/collection-browser.ts +1 -1
  69. package/src/tiles/item-image.ts +31 -11
@@ -0,0 +1,7 @@
1
+ import { CSSResultGroup, LitElement } from 'lit';
2
+ export declare class WaveformThumbnail extends LitElement {
3
+ baseNavigationUrl?: string;
4
+ identifier?: string;
5
+ render(): import("lit-html").TemplateResult<1>;
6
+ static get styles(): CSSResultGroup;
7
+ }
@@ -0,0 +1,106 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ let WaveformThumbnail = class WaveformThumbnail extends LitElement {
5
+ render() {
6
+ const imgSrcUrl = `${this.baseNavigationUrl}/services/img/${this.identifier}`;
7
+ const randomGradient = `grad${Math.floor(Math.random() * (6 - 1) + 1)}`;
8
+ return html `
9
+ <div class="box" id=${randomGradient}>
10
+ <div
11
+ class="item-image"
12
+ style="background-image:url(${imgSrcUrl})"
13
+ ></div>
14
+ </div>
15
+ `;
16
+ }
17
+ static get styles() {
18
+ return css `
19
+ .box {
20
+ width: 16rem;
21
+ height: 16rem;
22
+ overflow: hidden;
23
+ position: relative;
24
+ box-shadow: 1px 1px 2px 0px;
25
+ display: flex;
26
+ }
27
+
28
+ .item-image {
29
+ width: 16rem;
30
+ height: 16rem;
31
+ object-fit: cover;
32
+ background-repeat: no-repeat;
33
+ background-position: center center;
34
+ position: relative;
35
+ -webkit-appearance: none;
36
+ overflow: visible;
37
+ mix-blend-mode: screen;
38
+ }
39
+
40
+ #grad1 {
41
+ background: linear-gradient(
42
+ hsl(300, 80%, 55%),
43
+ hsl(330, 80%, 33%) 35%,
44
+ hsl(330, 80%, 22%) 70%,
45
+ hsl(0, 0%, 0%)
46
+ );
47
+ }
48
+
49
+ #grad2 {
50
+ background: linear-gradient(
51
+ hsl(200, 80%, 55%),
52
+ hsl(230, 80%, 33%) 35%,
53
+ hsl(230, 80%, 22%) 70%,
54
+ hsl(0, 0%, 0%)
55
+ );
56
+ }
57
+
58
+ #grad3 {
59
+ background: linear-gradient(
60
+ hsl(160, 80%, 55%),
61
+ hsl(190, 80%, 33%) 35%,
62
+ hsl(190, 80%, 22%) 70%,
63
+ hsl(0, 0%, 0%)
64
+ );
65
+ }
66
+
67
+ #grad4 {
68
+ background: linear-gradient(
69
+ hsl(250, 80%, 55%),
70
+ hsl(280, 80%, 33%) 35%,
71
+ hsl(280, 80%, 22%) 70%,
72
+ hsl(0, 0%, 0%)
73
+ );
74
+ }
75
+
76
+ #grad5 {
77
+ background: linear-gradient(
78
+ hsl(280, 80%, 55%),
79
+ hsl(310, 80%, 33%) 35%,
80
+ hsl(310, 80%, 22%) 70%,
81
+ hsl(0, 0%, 0%)
82
+ );
83
+ }
84
+
85
+ #grad6 {
86
+ background: linear-gradient(
87
+ hsl(340, 80%, 55%),
88
+ hsl(0, 80%, 33%) 35%,
89
+ hsl(0, 80%, 22%) 70%,
90
+ hsl(0, 0%, 0%)
91
+ );
92
+ }
93
+ `;
94
+ }
95
+ };
96
+ __decorate([
97
+ property({ type: String })
98
+ ], WaveformThumbnail.prototype, "baseNavigationUrl", void 0);
99
+ __decorate([
100
+ property({ type: String })
101
+ ], WaveformThumbnail.prototype, "identifier", void 0);
102
+ WaveformThumbnail = __decorate([
103
+ customElement('waveform-thumbnail')
104
+ ], WaveformThumbnail);
105
+ export { WaveformThumbnail };
106
+ //# sourceMappingURL=waveform-thumbnail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waveform-thumbnail.js","sourceRoot":"","sources":["../../src/waveform-thumbnail.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,UAAU;IAK/C,MAAM;QACJ,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,iBAAiB,iBAAiB,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9E,MAAM,cAAc,GAAG,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAExE,OAAO,IAAI,CAAA;4BACa,cAAc;;;wCAGF,SAAS;;;KAG5C,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2ET,CAAC;IACJ,CAAC;CACF,CAAA;AAhG6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA4B;AAE3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAqB;AAHrC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAiG7B;SAjGY,iBAAiB","sourcesContent":["import { css, CSSResultGroup, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement('waveform-thumbnail')\nexport class WaveformThumbnail extends LitElement {\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) identifier?: string;\n\n render() {\n const imgSrcUrl = `${this.baseNavigationUrl}/services/img/${this.identifier}`;\n const randomGradient = `grad${Math.floor(Math.random() * (6 - 1) + 1)}`;\n\n return html`\n <div class=\"box\" id=${randomGradient}>\n <div\n class=\"item-image\"\n style=\"background-image:url(${imgSrcUrl})\"\n ></div>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return css`\n .box {\n width: 16rem;\n height: 16rem;\n overflow: hidden;\n position: relative;\n box-shadow: 1px 1px 2px 0px;\n display: flex;\n }\n\n .item-image {\n width: 16rem;\n height: 16rem;\n object-fit: cover;\n background-repeat: no-repeat;\n background-position: center center;\n position: relative;\n -webkit-appearance: none;\n overflow: visible;\n mix-blend-mode: screen;\n }\n\n #grad1 {\n background: linear-gradient(\n hsl(300, 80%, 55%),\n hsl(330, 80%, 33%) 35%,\n hsl(330, 80%, 22%) 70%,\n hsl(0, 0%, 0%)\n );\n }\n\n #grad2 {\n background: linear-gradient(\n hsl(200, 80%, 55%),\n hsl(230, 80%, 33%) 35%,\n hsl(230, 80%, 22%) 70%,\n hsl(0, 0%, 0%)\n );\n }\n\n #grad3 {\n background: linear-gradient(\n hsl(160, 80%, 55%),\n hsl(190, 80%, 33%) 35%,\n hsl(190, 80%, 22%) 70%,\n hsl(0, 0%, 0%)\n );\n }\n\n #grad4 {\n background: linear-gradient(\n hsl(250, 80%, 55%),\n hsl(280, 80%, 33%) 35%,\n hsl(280, 80%, 22%) 70%,\n hsl(0, 0%, 0%)\n );\n }\n\n #grad5 {\n background: linear-gradient(\n hsl(280, 80%, 55%),\n hsl(310, 80%, 33%) 35%,\n hsl(310, 80%, 22%) 70%,\n hsl(0, 0%, 0%)\n );\n }\n\n #grad6 {\n background: linear-gradient(\n hsl(340, 80%, 55%),\n hsl(0, 80%, 33%) 35%,\n hsl(0, 80%, 22%) 70%,\n hsl(0, 0%, 0%)\n );\n }\n `;\n }\n}\n"]}
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=waveform-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waveform-view.js","sourceRoot":"","sources":["../../src/waveform-view.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -0,0 +1,8 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class YourWebComponent extends LitElement {
3
+ title: string;
4
+ counter: number;
5
+ private increment;
6
+ render(): import("lit-html").TemplateResult<1>;
7
+ static styles: import("lit").CSSResult;
8
+ }
@@ -0,0 +1,38 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, css, LitElement } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
4
+ let YourWebComponent = class YourWebComponent extends LitElement {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.title = 'Hey there';
8
+ this.counter = 5;
9
+ }
10
+ increment() {
11
+ this.counter += 1;
12
+ }
13
+ render() {
14
+ return html `
15
+ <h2>${this.title}, Number: ${this.counter}!</h2>
16
+ <button @click=${this.increment}>increment</button>
17
+ <slot name="my-slot"> </slot>
18
+ `;
19
+ }
20
+ };
21
+ YourWebComponent.styles = css `
22
+ :host {
23
+ display: block;
24
+ padding: 25px;
25
+ color: var(--your-webcomponent-text-color, #000);
26
+ }
27
+ `;
28
+ __decorate([
29
+ property({ type: String })
30
+ ], YourWebComponent.prototype, "title", void 0);
31
+ __decorate([
32
+ property({ type: Number })
33
+ ], YourWebComponent.prototype, "counter", void 0);
34
+ YourWebComponent = __decorate([
35
+ customElement('your-webcomponent')
36
+ ], YourWebComponent);
37
+ export { YourWebComponent };
38
+ //# sourceMappingURL=your-webcomponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"your-webcomponent.js","sourceRoot":"","sources":["../../src/your-webcomponent.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG5D,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,UAAU;IAAhD;;QAC8B,UAAK,GAAG,WAAW,CAAC;QAEpB,YAAO,GAAG,CAAC,CAAC;IAqB1C,CAAC;IAnBS,SAAS;QACf,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;YACH,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,OAAO;uBACxB,IAAI,CAAC,SAAS;;KAEhC,CAAC;IACJ,CAAC;CASF,CAAA;AAPQ,uBAAM,GAAG,GAAG,CAAA;;;;;;GAMlB,CAAC;AAtB0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAqB;AAEpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAa;AAH7B,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAwB5B;SAxBY,gBAAgB","sourcesContent":["import { html, css, LitElement } from 'lit';\nimport { property, customElement } from 'lit/decorators.js';\n\n@customElement('your-webcomponent')\nexport class YourWebComponent extends LitElement {\n @property({ type: String }) title = 'Hey there';\n\n @property({ type: Number }) counter = 5;\n\n private increment() {\n this.counter += 1;\n }\n\n render() {\n return html`\n <h2>${this.title}, Number: ${this.counter}!</h2>\n <button @click=${this.increment}>increment</button>\n <slot name=\"my-slot\"> </slot>\n `;\n }\n\n static styles = css`\n :host {\n display: block;\n padding: 25px;\n color: var(--your-webcomponent-text-color, #000);\n }\n `;\n}\n"]}
File without changes
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ describe('MediatypeIcon', () => { });
3
+ //# sourceMappingURL=mediatype-icon.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediatype-icon.test.js","sourceRoot":"","sources":["../../test/mediatype-icon.test.ts"],"names":[],"mappings":";AAAA,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC","sourcesContent":["describe('MediatypeIcon', () => {});\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { mediatypeConfig } from '../src/mediatype/mediatypeConfig';
3
+ describe('mediatypeConfig', () => {
4
+ it('returns undefined', () => {
5
+ expect(mediatypeConfig['']).to.equal(undefined);
6
+ expect(mediatypeConfig.test).to.equal(undefined);
7
+ expect(mediatypeConfig.media).to.equal(undefined);
8
+ expect(mediatypeConfig.testing).to.equal(undefined);
9
+ });
10
+ it('returns audio', () => {
11
+ expect(mediatypeConfig.audio).to.exist;
12
+ expect(mediatypeConfig.audio.color).to.exist;
13
+ expect(mediatypeConfig.audio.icon).to.exist;
14
+ expect(mediatypeConfig.audio.text).to.exist;
15
+ });
16
+ });
17
+ //# sourceMappingURL=mediatypeConfig.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediatypeConfig.test.js","sourceRoot":"","sources":["../../test/mediatypeConfig.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAChD,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAClD,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QACvC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAC7C,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAC5C,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { mediatypeConfig } from '../src/mediatype/mediatypeConfig';\n\ndescribe('mediatypeConfig', () => {\n it('returns undefined', () => {\n expect(mediatypeConfig['']).to.equal(undefined);\n expect(mediatypeConfig.test).to.equal(undefined);\n expect(mediatypeConfig.media).to.equal(undefined);\n expect(mediatypeConfig.testing).to.equal(undefined);\n });\n\n it('returns audio', () => {\n expect(mediatypeConfig.audio).to.exist;\n expect(mediatypeConfig.audio.color).to.exist;\n expect(mediatypeConfig.audio.icon).to.exist;\n expect(mediatypeConfig.audio.text).to.exist;\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { isStrOneLiner } from '../../src/utils/format-string';
3
+ const testShortTextNoSpaces = 'Loremipsumdolorsitamet';
4
+ const testLongText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua';
5
+ const testLongOnelineText = 'Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlaboreetdoloremagnaaliqua';
6
+ describe('isStrOneLiner', () => {
7
+ it('returns true if string has no spaces and have long text', () => {
8
+ expect(isStrOneLiner(testLongOnelineText)).to.equal(true);
9
+ });
10
+ it('returns false if string has no spaces but text length not more than 24', () => {
11
+ expect(isStrOneLiner(testShortTextNoSpaces)).to.equal(false);
12
+ });
13
+ it('returns false if string has spaces', () => {
14
+ expect(isStrOneLiner(testLongText)).to.equal(false);
15
+ });
16
+ });
17
+ //# sourceMappingURL=format-string.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-string.test.js","sourceRoot":"","sources":["../../../test/utils/format-string.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AACvD,MAAM,YAAY,GAChB,4HAA4H,CAAC;AAC/H,MAAM,mBAAmB,GACvB,0GAA0G,CAAC;AAE7G,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,MAAM,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { isStrOneLiner } from '../../src/utils/format-string';\n\nconst testShortTextNoSpaces = 'Loremipsumdolorsitamet';\nconst testLongText =\n 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua';\nconst testLongOnelineText =\n 'Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlaboreetdoloremagnaaliqua';\n\ndescribe('isStrOneLiner', () => {\n it('returns true if string has no spaces and have long text', () => {\n expect(isStrOneLiner(testLongOnelineText)).to.equal(true);\n });\n\n it('returns false if string has no spaces but text length not more than 24', () => {\n expect(isStrOneLiner(testShortTextNoSpaces)).to.equal(false);\n });\n\n it('returns false if string has spaces', () => {\n expect(isStrOneLiner(testLongText)).to.equal(false);\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ import '../src/your-webcomponent';
@@ -0,0 +1,23 @@
1
+ import { html, fixture, expect } from '@open-wc/testing';
2
+ import '../src/your-webcomponent';
3
+ describe('YourWebComponent', () => {
4
+ it('has a default title "Hey there" and counter 5', async () => {
5
+ const el = await fixture(html `<your-webcomponent></your-webcomponent>`);
6
+ expect(el.title).to.equal('Hey there');
7
+ expect(el.counter).to.equal(5);
8
+ });
9
+ it('increases the counter on button click', async () => {
10
+ const el = await fixture(html `<your-webcomponent></your-webcomponent>`);
11
+ el.shadowRoot.querySelector('button').click();
12
+ expect(el.counter).to.equal(6);
13
+ });
14
+ it('can override the title via attribute', async () => {
15
+ const el = await fixture(html `<your-webcomponent title="attribute title"></your-webcomponent>`);
16
+ expect(el.title).to.equal('attribute title');
17
+ });
18
+ it('passes the a11y audit', async () => {
19
+ const el = await fixture(html `<your-webcomponent></your-webcomponent>`);
20
+ await expect(el).shadowDom.to.be.accessible();
21
+ });
22
+ });
23
+ //# sourceMappingURL=your-webcomponent.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"your-webcomponent.test.js","sourceRoot":"","sources":["../../test/your-webcomponent.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,0BAA0B,CAAC;AAElC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,yCAAyC,CAC9C,CAAC;QAEF,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,yCAAyC,CAC9C,CAAC;QACF,EAAE,CAAC,UAAW,CAAC,aAAa,CAAC,QAAQ,CAAE,CAAC,KAAK,EAAE,CAAC;QAEhD,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,iEAAiE,CACtE,CAAC;QAEF,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,yCAAyC,CAC9C,CAAC;QAEF,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\n\nimport type { YourWebComponent } from '../src/your-webcomponent';\nimport '../src/your-webcomponent';\n\ndescribe('YourWebComponent', () => {\n it('has a default title \"Hey there\" and counter 5', async () => {\n const el = await fixture<YourWebComponent>(\n html`<your-webcomponent></your-webcomponent>`\n );\n\n expect(el.title).to.equal('Hey there');\n expect(el.counter).to.equal(5);\n });\n\n it('increases the counter on button click', async () => {\n const el = await fixture<YourWebComponent>(\n html`<your-webcomponent></your-webcomponent>`\n );\n el.shadowRoot!.querySelector('button')!.click();\n\n expect(el.counter).to.equal(6);\n });\n\n it('can override the title via attribute', async () => {\n const el = await fixture<YourWebComponent>(\n html`<your-webcomponent title=\"attribute title\"></your-webcomponent>`\n );\n\n expect(el.title).to.equal('attribute title');\n });\n\n it('passes the a11y audit', async () => {\n const el = await fixture<YourWebComponent>(\n html`<your-webcomponent></your-webcomponent>`\n );\n\n await expect(el).shadowDom.to.be.accessible();\n });\n});\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "0.1.3",
6
+ "version": "0.1.6",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  "@internetarchive/feature-feedback": "^0.1.2",
23
23
  "@internetarchive/field-parsers": "^0.1.3",
24
24
  "@internetarchive/histogram-date-range": "^0.1.6",
25
- "@internetarchive/infinite-scroller": "^0.1.0",
25
+ "@internetarchive/infinite-scroller": "^0.1.2",
26
26
  "@internetarchive/search-service": "^0.3.4",
27
27
  "@internetarchive/shared-resize-observer": "^0.2.0",
28
28
  "@lit/localize": "^0.11.2",
@@ -59,7 +59,7 @@ export class CollectionBrowser
59
59
  {
60
60
  @property({ type: String }) baseNavigationUrl?: string;
61
61
 
62
- @property({ type: String }) baseImageUrl?: string;
62
+ @property({ type: String }) baseImageUrl: string = 'https://archive.org';
63
63
 
64
64
  @property({ type: Object }) searchService?: SearchServiceInterface;
65
65
 
@@ -19,7 +19,9 @@ export class ItemImage extends LitElement {
19
19
 
20
20
  @property({ type: Boolean }) isListTile = false;
21
21
 
22
- @state() private isDeemphasize = false;
22
+ @state() private isDeemphasize: boolean = false;
23
+
24
+ @state() private isWaveform: boolean = false;
23
25
 
24
26
  @query('.item-image') private itemImageWaveform!: HTMLImageElement;
25
27
 
@@ -61,9 +63,9 @@ export class ItemImage extends LitElement {
61
63
 
62
64
  private get waveformTemplate() {
63
65
  return html`
64
- <div class="box" id=${this.randomGradient}>
66
+ <div class=${this.boxWaveformClass}>
65
67
  <img
66
- class="item-image"
68
+ class=${this.itemImageWaveformClass}
67
69
  src="${this.imageSrc}"
68
70
  alt="${ifDefined(this.model?.identifier)}"
69
71
  @load=${this.onLoadItemImageCheck}
@@ -86,7 +88,7 @@ export class ItemImage extends LitElement {
86
88
  this.itemImageWaveform.naturalWidth /
87
89
  this.itemImageWaveform.naturalHeight;
88
90
  if (aspectRatio === 4) {
89
- this.itemImageWaveform.classList.add('waveform');
91
+ this.isWaveform = true;
90
92
  }
91
93
  }
92
94
 
@@ -99,8 +101,26 @@ export class ItemImage extends LitElement {
99
101
  return this.isDeemphasize ? 'item-image-box' : undefined;
100
102
  }
101
103
 
104
+ private get boxWaveformClass() {
105
+ return `item-audio${this.isWaveform ? ` ${this.randomGradient}` : ''}`;
106
+ }
107
+
108
+ private get itemImageWaveformClass() {
109
+ return `item-image${this.isWaveform ? ' waveform' : ''}`;
110
+ }
111
+
102
112
  private get randomGradient() {
103
- return `grad${Math.floor(Math.random() * (6 - 1) + 1)}`;
113
+ let gradientInt = 1;
114
+ if (this.model?.identifier) {
115
+ gradientInt = this.generateHashCode(this.model.identifier) % 6;
116
+ }
117
+ return `grad${gradientInt}`;
118
+ }
119
+
120
+ private generateHashCode(str: string): number {
121
+ return str
122
+ .split('')
123
+ .reduce((acc: number, char: string) => acc + char.charCodeAt(0), 0);
104
124
  }
105
125
 
106
126
  static get styles(): CSSResultGroup {
@@ -160,7 +180,7 @@ export class ItemImage extends LitElement {
160
180
  text-align: center;
161
181
  }
162
182
 
163
- #grad1 {
183
+ .grad1 {
164
184
  background: linear-gradient(
165
185
  hsl(300, 80%, 55%),
166
186
  hsl(330, 80%, 33%) 35%,
@@ -169,7 +189,7 @@ export class ItemImage extends LitElement {
169
189
  );
170
190
  }
171
191
 
172
- #grad2 {
192
+ .grad2 {
173
193
  background: linear-gradient(
174
194
  hsl(200, 80%, 55%),
175
195
  hsl(230, 80%, 33%) 35%,
@@ -178,7 +198,7 @@ export class ItemImage extends LitElement {
178
198
  );
179
199
  }
180
200
 
181
- #grad3 {
201
+ .grad3 {
182
202
  background: linear-gradient(
183
203
  hsl(160, 80%, 55%),
184
204
  hsl(190, 80%, 33%) 35%,
@@ -187,7 +207,7 @@ export class ItemImage extends LitElement {
187
207
  );
188
208
  }
189
209
 
190
- #grad4 {
210
+ .grad4 {
191
211
  background: linear-gradient(
192
212
  hsl(250, 80%, 55%),
193
213
  hsl(280, 80%, 33%) 35%,
@@ -196,7 +216,7 @@ export class ItemImage extends LitElement {
196
216
  );
197
217
  }
198
218
 
199
- #grad5 {
219
+ .grad5 {
200
220
  background: linear-gradient(
201
221
  hsl(280, 80%, 55%),
202
222
  hsl(310, 80%, 33%) 35%,
@@ -205,7 +225,7 @@ export class ItemImage extends LitElement {
205
225
  );
206
226
  }
207
227
 
208
- #grad6 {
228
+ .grad6 {
209
229
  background: linear-gradient(
210
230
  hsl(340, 80%, 55%),
211
231
  hsl(0, 80%, 33%) 35%,