@internetarchive/collection-browser 0.1.8 → 0.1.9

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.
package/package.json CHANGED
@@ -3,18 +3,20 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "0.1.8",
6
+ "version": "0.1.9",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
10
- "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
11
- "build": "tsc",
12
- "prepare": "tsc && husky install",
10
+ "start": "yarn run prepare && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
11
+ "prepare:ghpages": "rimraf ghpages && yarn run prepare && vite build",
12
+ "prepare": "rimraf dist && tsc && husky install",
13
13
  "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
14
14
  "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
15
15
  "circular": "madge --circular --extensions ts .",
16
16
  "test": "tsc && yarn run lint && yarn run circular && wtr --coverage",
17
- "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
17
+ "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
18
+ "deploy": "yarn run prepare:ghpages && touch ghpages/.nojekyll && yarn run deploy:gh",
19
+ "deploy:gh": "gh-pages -t -d ghpages -m \"Build for $(git log --pretty=format:\"%h %an %ai %s\" -n1) [skip ci]\""
18
20
  },
19
21
  "types": "dist/index.d.ts",
20
22
  "dependencies": {
@@ -23,6 +25,7 @@
23
25
  "@internetarchive/field-parsers": "^0.1.3",
24
26
  "@internetarchive/histogram-date-range": "^0.1.6",
25
27
  "@internetarchive/infinite-scroller": "^0.1.2",
28
+ "@internetarchive/local-cache": "^0.2.1",
26
29
  "@internetarchive/search-service": "^0.3.4",
27
30
  "@internetarchive/shared-resize-observer": "^0.2.0",
28
31
  "@lit/localize": "^0.11.2",
@@ -31,7 +34,6 @@
31
34
  "typescript-cookie": "^1.0.3"
32
35
  },
33
36
  "devDependencies": {
34
- "@internetarchive/local-cache": "^0.2.1",
35
37
  "@internetarchive/result-type": "^0.0.1",
36
38
  "@open-wc/eslint-config": "^7.0.0",
37
39
  "@open-wc/testing": "^3.0.3",
@@ -46,12 +48,15 @@
46
48
  "eslint-plugin-import": "^2.25.3",
47
49
  "eslint-plugin-lit-a11y": "^2.2.0",
48
50
  "eslint-plugin-wc": "^1.3.2",
51
+ "gh-pages": "^4.0.0",
49
52
  "husky": "^7.0.0",
50
53
  "madge": "^5.0.1",
51
54
  "prettier": "^2.4.1",
55
+ "rimraf": "^3.0.2",
52
56
  "sinon": "^12.0.1",
53
57
  "tslib": "^2.3.1",
54
- "typescript": "^4.4.4"
58
+ "typescript": "^4.4.4",
59
+ "vite": "^2.9.9"
55
60
  },
56
61
  "publishConfig": {
57
62
  "access": "public"
File without changes
@@ -162,6 +162,12 @@ export class CollectionBrowser
162
162
  */
163
163
  private endOfDataReached = false;
164
164
 
165
+ /**
166
+ * When page width resizes from desktop to mobile, set true to
167
+ * disable expand/collapse transition when loading.
168
+ */
169
+ private isResizeToMobile = false;
170
+
165
171
  private placeholderCellTemplate = html`<collection-browser-loading-tile></collection-browser-loading-tile>`;
166
172
 
167
173
  private tileModelAtCellIndex(index: number): TileModel | undefined {
@@ -241,31 +247,12 @@ export class CollectionBrowser
241
247
  render() {
242
248
  return html`
243
249
  <div id="content-container" class=${this.mobileView ? 'mobile' : ''}>
244
- <div id="left-column" class="column">
250
+ <div
251
+ id="left-column"
252
+ class="column${this.isResizeToMobile ? ' preload' : ''}"
253
+ >
245
254
  <div id="mobile-header-container">
246
- ${this.mobileView
247
- ? html`
248
- <div id="mobile-filter-collapse">
249
- <h1
250
- @click=${() => {
251
- this.mobileFacetsVisible = !this.mobileFacetsVisible;
252
- }}
253
- @keyup=${() => {
254
- this.mobileFacetsVisible = !this.mobileFacetsVisible;
255
- }}
256
- >
257
- <span
258
- class="collapser ${this.mobileFacetsVisible
259
- ? 'open'
260
- : ''}"
261
- >
262
- ${chevronIcon}
263
- </span>
264
- Filters
265
- </h1>
266
- </div>
267
- `
268
- : nothing}
255
+ ${this.mobileView ? this.mobileFacetsTemplate : nothing}
269
256
  <div id="results-total">
270
257
  <span id="big-results-count"
271
258
  >${this.totalResults !== undefined
@@ -382,6 +369,28 @@ export class CollectionBrowser
382
369
  return this.facetsLoading || this.fullYearAggregationLoading;
383
370
  }
384
371
 
372
+ private get mobileFacetsTemplate() {
373
+ return html`
374
+ <div id="mobile-filter-collapse">
375
+ <h1
376
+ @click=${() => {
377
+ this.isResizeToMobile = false;
378
+ this.mobileFacetsVisible = !this.mobileFacetsVisible;
379
+ }}
380
+ @keyup=${() => {
381
+ this.isResizeToMobile = false;
382
+ this.mobileFacetsVisible = !this.mobileFacetsVisible;
383
+ }}
384
+ >
385
+ <span class="collapser ${this.mobileFacetsVisible ? 'open' : ''}">
386
+ ${chevronIcon}
387
+ </span>
388
+ Filters
389
+ </h1>
390
+ </div>
391
+ `;
392
+ }
393
+
385
394
  private get facetsTemplate() {
386
395
  return html`
387
396
  ${this.facetsLoading ? this.loadingTemplate : nothing}
@@ -513,8 +522,13 @@ export class CollectionBrowser
513
522
  }
514
523
 
515
524
  handleResize(entry: ResizeObserverEntry): void {
525
+ const previousView = this.mobileView;
516
526
  if (entry.target === this.contentContainer) {
517
- this.mobileView = entry.contentRect.width < 600;
527
+ this.mobileView = entry.contentRect.width < this.mobileBreakpoint;
528
+ // If changing from desktop to mobile disable transition
529
+ if (this.mobileView && !previousView) {
530
+ this.isResizeToMobile = true;
531
+ }
518
532
  }
519
533
  }
520
534
 
@@ -1101,6 +1115,18 @@ export class CollectionBrowser
1101
1115
  display: block;
1102
1116
  }
1103
1117
 
1118
+ /**
1119
+ * When page width resizes from desktop to mobile, use this class to
1120
+ * disable expand/collapse transition when loading.
1121
+ */
1122
+ .preload * {
1123
+ transition: none !important;
1124
+ -webkit-transition: none !important;
1125
+ -moz-transition: none !important;
1126
+ -ms-transition: none !important;
1127
+ -o-transition: none !important;
1128
+ }
1129
+
1104
1130
  #content-container {
1105
1131
  display: flex;
1106
1132
  }
@@ -125,6 +125,7 @@ export class AccountTile extends LitElement {
125
125
  height: 25px;
126
126
  display: flex;
127
127
  justify-content: space-evenly;
128
+ line-height: initial;
128
129
  }
129
130
 
130
131
  #patron-icon {
@@ -141,6 +142,7 @@ export class AccountTile extends LitElement {
141
142
  display: -webkit-box;
142
143
  -webkit-box-orient: vertical;
143
144
  word-wrap: break-word;
145
+ word-break: break-all;
144
146
  line-height: 2rem;
145
147
  text-align: center;
146
148
  }
package/tsconfig.json CHANGED
@@ -16,5 +16,5 @@
16
16
  "rootDir": "./",
17
17
  "declaration": true
18
18
  },
19
- "include": ["**/*.ts"]
19
+ "include": ["src", "test", "index.ts"],
20
20
  }
package/vite.config.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { defineConfig } from 'vite';
2
+ import { resolve } from 'path';
3
+
4
+ // https://vitejs.dev/config/
5
+ export default defineConfig({
6
+ base: '',
7
+ build: {
8
+ outDir: 'ghpages',
9
+ manifest: true,
10
+ rollupOptions: {
11
+ input: {
12
+ main: resolve(__dirname, 'index.html'),
13
+ },
14
+ },
15
+ },
16
+ server: {
17
+ host: true,
18
+ port: 8080,
19
+ open: true,
20
+ cors: true,
21
+ },
22
+ });
@@ -5,7 +5,7 @@ const hmr = process.argv.includes('--hmr');
5
5
 
6
6
  export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
7
  nodeResolve: true,
8
- open: '/demo/',
8
+ open: '/',
9
9
  watch: !hmr,
10
10
 
11
11
  /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
package/dist/.nojekyll DELETED
File without changes