@internetarchive/collection-browser 4.1.3-alpha-webdev8257.1 → 4.1.3
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/.editorconfig +29 -29
- package/.github/workflows/ci.yml +27 -27
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +1 -1
- package/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +0 -8
- package/dist/src/app-root.js +0 -31
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +0 -3
- package/dist/src/collection-browser.js +1 -8
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/tiles/models.d.ts +0 -14
- package/dist/src/tiles/models.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +1 -12
- package/dist/src/tiles/tile-dispatcher.js +4 -121
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/index.ts +0 -1
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +120 -120
- package/renovate.json +6 -6
- package/src/app-root.ts +0 -35
- package/src/collection-browser.ts +1 -7
- package/src/tiles/models.ts +0 -16
- package/src/tiles/tile-dispatcher.ts +5 -130
- package/tsconfig.json +25 -25
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +52 -52
- package/.claude/settings.local.json +0 -11
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { css, html, nothing, PropertyValues } from 'lit';
|
|
2
2
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
-
import { classMap } from 'lit/directives/class-map.js';
|
|
4
3
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
4
|
import { msg } from '@lit/localize';
|
|
6
5
|
import type {
|
|
@@ -19,7 +18,7 @@ import './list/tile-list-compact';
|
|
|
19
18
|
import './list/tile-list-compact-header';
|
|
20
19
|
import type { TileHoverPane } from './hover/tile-hover-pane';
|
|
21
20
|
import { BaseTileComponent } from './base-tile-component';
|
|
22
|
-
import { LayoutType
|
|
21
|
+
import { LayoutType } from './models';
|
|
23
22
|
import {
|
|
24
23
|
HoverPaneController,
|
|
25
24
|
HoverPaneControllerInterface,
|
|
@@ -73,9 +72,6 @@ export class TileDispatcher
|
|
|
73
72
|
'Remove this item from the list',
|
|
74
73
|
);
|
|
75
74
|
|
|
76
|
-
/** Action buttons to display at the bottom of the tile (grid mode only) */
|
|
77
|
-
@property({ type: Array }) tileActions: TileAction[] = [];
|
|
78
|
-
|
|
79
75
|
private hoverPaneController?: HoverPaneControllerInterface;
|
|
80
76
|
|
|
81
77
|
@query('#container')
|
|
@@ -108,20 +104,14 @@ export class TileDispatcher
|
|
|
108
104
|
|
|
109
105
|
render() {
|
|
110
106
|
const isGridMode = this.tileDisplayMode === 'grid';
|
|
111
|
-
const hasTileActions = isGridMode && this.showTileActions;
|
|
112
107
|
const hoverPaneTemplate =
|
|
113
108
|
this.hoverPaneController?.getTemplate() ?? nothing;
|
|
114
|
-
const containerClasses = classMap({
|
|
115
|
-
hoverable: isGridMode,
|
|
116
|
-
'has-tile-actions': hasTileActions,
|
|
117
|
-
});
|
|
118
109
|
return html`
|
|
119
|
-
<div id="container" class=${
|
|
110
|
+
<div id="container" class=${isGridMode ? 'hoverable' : ''}>
|
|
120
111
|
${this.tileDisplayMode === 'list-header'
|
|
121
112
|
? this.headerTemplate
|
|
122
113
|
: this.tileTemplate}
|
|
123
|
-
${this.
|
|
124
|
-
${hoverPaneTemplate}
|
|
114
|
+
${this.manageCheckTemplate} ${hoverPaneTemplate}
|
|
125
115
|
</div>
|
|
126
116
|
`;
|
|
127
117
|
}
|
|
@@ -316,60 +306,6 @@ export class TileDispatcher
|
|
|
316
306
|
});
|
|
317
307
|
}
|
|
318
308
|
|
|
319
|
-
/** Whether tile action buttons should be rendered */
|
|
320
|
-
private get showTileActions(): boolean {
|
|
321
|
-
return (
|
|
322
|
-
this.tileActions.length > 0 &&
|
|
323
|
-
!this.isManageView &&
|
|
324
|
-
this.tileDisplayMode === 'grid'
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
private get tileActionsTemplate() {
|
|
329
|
-
if (!this.showTileActions) return nothing;
|
|
330
|
-
|
|
331
|
-
return html`
|
|
332
|
-
<div
|
|
333
|
-
class="tile-actions"
|
|
334
|
-
@mouseenter=${this.handleTileActionsMouseEnter}
|
|
335
|
-
@mousemove=${(e: Event) => e.stopPropagation()}
|
|
336
|
-
>
|
|
337
|
-
${this.tileActions.map(
|
|
338
|
-
action => html`
|
|
339
|
-
<button
|
|
340
|
-
class="tile-action-btn"
|
|
341
|
-
@click=${(e: Event) => this.handleTileActionClick(e, action)}
|
|
342
|
-
>
|
|
343
|
-
${action.label}
|
|
344
|
-
</button>
|
|
345
|
-
`,
|
|
346
|
-
)}
|
|
347
|
-
</div>
|
|
348
|
-
`;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* When the mouse enters the tile actions area, dispatch a synthetic mouseleave
|
|
353
|
-
* on the host to cancel the hover pane's show timer and hide any visible pane.
|
|
354
|
-
*/
|
|
355
|
-
private handleTileActionsMouseEnter = (): void => {
|
|
356
|
-
this.dispatchEvent(new MouseEvent('mouseleave', { bubbles: false }));
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
private handleTileActionClick(e: Event, action: TileAction): void {
|
|
360
|
-
e.stopPropagation();
|
|
361
|
-
// Pre-set the hover pane controller's clicking flag so that focus
|
|
362
|
-
// restoration after a consumer-opened modal won't trigger the hover pane.
|
|
363
|
-
this.dispatchEvent(new PointerEvent('pointerdown'));
|
|
364
|
-
this.dispatchEvent(
|
|
365
|
-
new CustomEvent('tileActionClicked', {
|
|
366
|
-
detail: { actionId: action.id, model: this.model },
|
|
367
|
-
bubbles: true,
|
|
368
|
-
composed: true,
|
|
369
|
-
}),
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
309
|
private get tile() {
|
|
374
310
|
const {
|
|
375
311
|
model,
|
|
@@ -530,43 +466,8 @@ export class TileDispatcher
|
|
|
530
466
|
border-radius: 4px;
|
|
531
467
|
}
|
|
532
468
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
* so that the tile content and action buttons appear as one unified element.
|
|
536
|
-
*/
|
|
537
|
-
/*
|
|
538
|
-
* When tile actions are present, the container takes over the tile's
|
|
539
|
-
* border-radius and box-shadow so that the action bar appears as part
|
|
540
|
-
* of the same card. The inner tile's own shadow/radius are disabled
|
|
541
|
-
* via CSS variable overrides so there is no visual duplication.
|
|
542
|
-
*/
|
|
543
|
-
#container.has-tile-actions {
|
|
544
|
-
display: flex;
|
|
545
|
-
flex-direction: column;
|
|
546
|
-
overflow: hidden;
|
|
547
|
-
box-shadow: var(--tileShadow, 1px 1px 2px 0);
|
|
548
|
-
--tileBoxShadow: none;
|
|
549
|
-
--tileCornerRadius: 0;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
#container.has-tile-actions .tile-link {
|
|
553
|
-
flex: 1;
|
|
554
|
-
min-height: 0;
|
|
555
|
-
overflow: hidden;
|
|
556
|
-
border-radius: 0;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
/* Move hover shadow to container level when tile actions are present */
|
|
560
|
-
#container.hoverable:not(.has-tile-actions) a:focus,
|
|
561
|
-
#container.hoverable:not(.has-tile-actions) a:hover {
|
|
562
|
-
box-shadow: var(
|
|
563
|
-
--tileHoverBoxShadow,
|
|
564
|
-
0 0 6px 2px rgba(8, 8, 32, 0.8)
|
|
565
|
-
);
|
|
566
|
-
transition: box-shadow 0.1s ease;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
#container.hoverable.has-tile-actions:hover {
|
|
469
|
+
#container.hoverable a:focus,
|
|
470
|
+
#container.hoverable a:hover {
|
|
570
471
|
box-shadow: var(
|
|
571
472
|
--tileHoverBoxShadow,
|
|
572
473
|
0 0 6px 2px rgba(8, 8, 32, 0.8)
|
|
@@ -620,32 +521,6 @@ export class TileDispatcher
|
|
|
620
521
|
left: -9999px;
|
|
621
522
|
z-index: 2;
|
|
622
523
|
}
|
|
623
|
-
|
|
624
|
-
.tile-actions {
|
|
625
|
-
flex-shrink: 0;
|
|
626
|
-
display: flex;
|
|
627
|
-
border-top: 1px solid var(--tileActionSeparatorColor, #ddd);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
.tile-action-btn {
|
|
631
|
-
flex: 1;
|
|
632
|
-
padding: 8px;
|
|
633
|
-
border: none;
|
|
634
|
-
border-radius: 0;
|
|
635
|
-
font-size: 1.2rem;
|
|
636
|
-
cursor: pointer;
|
|
637
|
-
color: var(--tileActionColor, #333);
|
|
638
|
-
background: var(--tileActionBg, #fff);
|
|
639
|
-
transition: background 0.15s;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
.tile-action-btn + .tile-action-btn {
|
|
643
|
-
border-left: 1px solid var(--tileActionSeparatorColor, #ddd);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
.tile-action-btn:hover {
|
|
647
|
-
background: var(--tileActionHoverBg, #f0f0f0);
|
|
648
|
-
}
|
|
649
524
|
`,
|
|
650
525
|
];
|
|
651
526
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": [
|
|
8
|
-
"ESNext",
|
|
9
|
-
"dom",
|
|
10
|
-
"dom.iterable"
|
|
11
|
-
],
|
|
12
|
-
"strict": true,
|
|
13
|
-
"esModuleInterop": false,
|
|
14
|
-
"allowSyntheticDefaultImports": true,
|
|
15
|
-
"experimentalDecorators": true,
|
|
16
|
-
"importHelpers": true,
|
|
17
|
-
"outDir": "dist",
|
|
18
|
-
"sourceMap": true,
|
|
19
|
-
"inlineSources": true,
|
|
20
|
-
"rootDir": "./",
|
|
21
|
-
"declaration": true,
|
|
22
|
-
"useDefineForClassFields": false,
|
|
23
|
-
},
|
|
24
|
-
"include": ["src", "test", "index.ts", "types"],
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"noEmitOnError": true,
|
|
7
|
+
"lib": [
|
|
8
|
+
"ESNext",
|
|
9
|
+
"dom",
|
|
10
|
+
"dom.iterable"
|
|
11
|
+
],
|
|
12
|
+
"strict": true,
|
|
13
|
+
"esModuleInterop": false,
|
|
14
|
+
"allowSyntheticDefaultImports": true,
|
|
15
|
+
"experimentalDecorators": true,
|
|
16
|
+
"importHelpers": true,
|
|
17
|
+
"outDir": "dist",
|
|
18
|
+
"sourceMap": true,
|
|
19
|
+
"inlineSources": true,
|
|
20
|
+
"rootDir": "./",
|
|
21
|
+
"declaration": true,
|
|
22
|
+
"useDefineForClassFields": false,
|
|
23
|
+
},
|
|
24
|
+
"include": ["src", "test", "index.ts", "types"],
|
|
25
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
-
|
|
3
|
-
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
-
const hmr = process.argv.includes('--hmr');
|
|
5
|
-
|
|
6
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
-
nodeResolve: true,
|
|
8
|
-
open: '/',
|
|
9
|
-
watch: !hmr,
|
|
10
|
-
|
|
11
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
12
|
-
// esbuildTarget: 'auto'
|
|
13
|
-
|
|
14
|
-
/** Set appIndex to enable SPA routing */
|
|
15
|
-
// appIndex: 'demo/index.html',
|
|
16
|
-
|
|
17
|
-
/** Confgure bare import resolve plugin */
|
|
18
|
-
// nodeResolve: {
|
|
19
|
-
// exportConditions: ['browser', 'development']
|
|
20
|
-
// },
|
|
21
|
-
|
|
22
|
-
plugins: [
|
|
23
|
-
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
|
-
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
|
-
],
|
|
26
|
-
|
|
27
|
-
http2: true,
|
|
28
|
-
sslCert: './local.archive.org.cert',
|
|
29
|
-
sslKey: './local.archive.org.key',
|
|
30
|
-
});
|
|
1
|
+
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
+
|
|
3
|
+
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
+
const hmr = process.argv.includes('--hmr');
|
|
5
|
+
|
|
6
|
+
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
+
nodeResolve: true,
|
|
8
|
+
open: '/',
|
|
9
|
+
watch: !hmr,
|
|
10
|
+
|
|
11
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
12
|
+
// esbuildTarget: 'auto'
|
|
13
|
+
|
|
14
|
+
/** Set appIndex to enable SPA routing */
|
|
15
|
+
// appIndex: 'demo/index.html',
|
|
16
|
+
|
|
17
|
+
/** Confgure bare import resolve plugin */
|
|
18
|
+
// nodeResolve: {
|
|
19
|
+
// exportConditions: ['browser', 'development']
|
|
20
|
+
// },
|
|
21
|
+
|
|
22
|
+
plugins: [
|
|
23
|
+
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
|
+
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
http2: true,
|
|
28
|
+
sslCert: './local.archive.org.cert',
|
|
29
|
+
sslKey: './local.archive.org.key',
|
|
30
|
+
});
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import rollupImage from '@rollup/plugin-image';
|
|
2
|
-
import { rollupAdapter } from '@web/dev-server-rollup';
|
|
3
|
-
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
4
|
-
|
|
5
|
-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
6
|
-
|
|
7
|
-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
8
|
-
/** Test files to run */
|
|
9
|
-
files: 'dist/test/**/*.test.js',
|
|
10
|
-
|
|
11
|
-
/** Resolve bare module imports */
|
|
12
|
-
nodeResolve: {
|
|
13
|
-
exportConditions: ['browser', 'development'],
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
mimeTypes: {
|
|
17
|
-
'**/*.scss': 'js',
|
|
18
|
-
'**/*.css': 'js',
|
|
19
|
-
'**/*.svg': 'js',
|
|
20
|
-
'**/*.json': 'js',
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
/** Filter out lit dev mode logs */
|
|
24
|
-
filterBrowserLogs(log) {
|
|
25
|
-
for (const arg of log.args) {
|
|
26
|
-
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
plugins: [rollupAdapter(rollupImage())],
|
|
34
|
-
|
|
35
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
36
|
-
// esbuildTarget: 'auto',
|
|
37
|
-
|
|
38
|
-
/** Amount of browsers to run concurrently */
|
|
39
|
-
// concurrentBrowsers: 2,
|
|
40
|
-
|
|
41
|
-
/** Amount of test files per browser to test concurrently */
|
|
42
|
-
// concurrency: 1,
|
|
43
|
-
|
|
44
|
-
/** Browsers to run tests on */
|
|
45
|
-
// browsers: [
|
|
46
|
-
// playwrightLauncher({ product: 'chromium' }),
|
|
47
|
-
// playwrightLauncher({ product: 'firefox' }),
|
|
48
|
-
// playwrightLauncher({ product: 'webkit' }),
|
|
49
|
-
// ],
|
|
50
|
-
|
|
51
|
-
// See documentation for all available options
|
|
52
|
-
});
|
|
1
|
+
import rollupImage from '@rollup/plugin-image';
|
|
2
|
+
import { rollupAdapter } from '@web/dev-server-rollup';
|
|
3
|
+
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
4
|
+
|
|
5
|
+
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
6
|
+
|
|
7
|
+
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
8
|
+
/** Test files to run */
|
|
9
|
+
files: 'dist/test/**/*.test.js',
|
|
10
|
+
|
|
11
|
+
/** Resolve bare module imports */
|
|
12
|
+
nodeResolve: {
|
|
13
|
+
exportConditions: ['browser', 'development'],
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
mimeTypes: {
|
|
17
|
+
'**/*.scss': 'js',
|
|
18
|
+
'**/*.css': 'js',
|
|
19
|
+
'**/*.svg': 'js',
|
|
20
|
+
'**/*.json': 'js',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
/** Filter out lit dev mode logs */
|
|
24
|
+
filterBrowserLogs(log) {
|
|
25
|
+
for (const arg of log.args) {
|
|
26
|
+
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
plugins: [rollupAdapter(rollupImage())],
|
|
34
|
+
|
|
35
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
36
|
+
// esbuildTarget: 'auto',
|
|
37
|
+
|
|
38
|
+
/** Amount of browsers to run concurrently */
|
|
39
|
+
// concurrentBrowsers: 2,
|
|
40
|
+
|
|
41
|
+
/** Amount of test files per browser to test concurrently */
|
|
42
|
+
// concurrency: 1,
|
|
43
|
+
|
|
44
|
+
/** Browsers to run tests on */
|
|
45
|
+
// browsers: [
|
|
46
|
+
// playwrightLauncher({ product: 'chromium' }),
|
|
47
|
+
// playwrightLauncher({ product: 'firefox' }),
|
|
48
|
+
// playwrightLauncher({ product: 'webkit' }),
|
|
49
|
+
// ],
|
|
50
|
+
|
|
51
|
+
// See documentation for all available options
|
|
52
|
+
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(cd /c/Users/Laton/workspace/IA/iaux-collection-browser && npm test 2>&1)",
|
|
5
|
-
"Bash(cd /c/Users/Laton/workspace/IA/iaux-collection-browser && yarn run format 2>&1)",
|
|
6
|
-
"Bash(cd /c/Users/Laton/workspace/IA/iaux-collection-browser && npx tsc --noEmit 2>&1)",
|
|
7
|
-
"Bash(cd /c/Users/Laton/workspace/IA/iaux-collection-browser && npx wtr --coverage 2>&1)",
|
|
8
|
-
"Bash(cd /c/Users/Laton/workspace/IA/iaux-collection-browser && npm run format 2>&1)"
|
|
9
|
-
]
|
|
10
|
-
}
|
|
11
|
-
}
|