@internetarchive/elements 0.2.14-webdev-9022.0 → 0.4.0
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/dist/src/elements/ia-audio-element/ia-audio-element.d.ts +72 -0
- package/dist/src/elements/ia-audio-element/ia-audio-element.d.ts.map +1 -0
- package/dist/src/elements/ia-audio-element/ia-audio-element.js +173 -0
- package/dist/src/elements/ia-audio-element/ia-audio-element.js.map +1 -0
- package/dist/src/elements/ia-audio-element/models.d.ts +13 -0
- package/dist/src/elements/ia-audio-element/models.d.ts.map +1 -0
- package/dist/src/elements/ia-audio-element/models.js +2 -0
- package/dist/src/elements/ia-audio-element/models.js.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/clear-results.d.ts +3 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/clear-results.d.ts.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/clear-results.js +28 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/clear-results.js.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/disclosure.d.ts +3 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/disclosure.d.ts.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/disclosure.js +26 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/disclosure.js.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/magnifying-glass.d.ts +3 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/magnifying-glass.d.ts.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/magnifying-glass.js +22 -0
- package/dist/src/elements/ia-expandable-search-bar/assets/magnifying-glass.js.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/ia-expandable-search-bar.d.ts +53 -0
- package/dist/src/elements/ia-expandable-search-bar/ia-expandable-search-bar.d.ts.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/ia-expandable-search-bar.js +352 -0
- package/dist/src/elements/ia-expandable-search-bar/ia-expandable-search-bar.js.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/ia-quick-search.d.ts +19 -0
- package/dist/src/elements/ia-expandable-search-bar/ia-quick-search.d.ts.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/ia-quick-search.js +115 -0
- package/dist/src/elements/ia-expandable-search-bar/ia-quick-search.js.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/models.d.ts +13 -0
- package/dist/src/elements/ia-expandable-search-bar/models.d.ts.map +1 -0
- package/dist/src/elements/ia-expandable-search-bar/models.js +2 -0
- package/dist/src/elements/ia-expandable-search-bar/models.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/next-section.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/next-section.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/next-section.js +16 -0
- package/dist/src/elements/ia-playback-controls/assets/next-section.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/pause.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/pause.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/pause.js +17 -0
- package/dist/src/elements/ia-playback-controls/assets/pause.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/play.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/play.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/play.js +18 -0
- package/dist/src/elements/ia-playback-controls/assets/play.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/playback-speed.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/playback-speed.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/playback-speed.js +28 -0
- package/dist/src/elements/ia-playback-controls/assets/playback-speed.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/previous-section.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/previous-section.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/previous-section.js +16 -0
- package/dist/src/elements/ia-playback-controls/assets/previous-section.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/replay.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/replay.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/replay.js +28 -0
- package/dist/src/elements/ia-playback-controls/assets/replay.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/skip-ahead.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/skip-ahead.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/skip-ahead.js +29 -0
- package/dist/src/elements/ia-playback-controls/assets/skip-ahead.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-full.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-full.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-full.js +19 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-full.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-medium.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-medium.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-medium.js +24 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-medium.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-mute.d.ts +3 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-mute.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-mute.js +35 -0
- package/dist/src/elements/ia-playback-controls/assets/volume-mute.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/ia-playback-controls.d.ts +66 -0
- package/dist/src/elements/ia-playback-controls/ia-playback-controls.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/ia-playback-controls.js +337 -0
- package/dist/src/elements/ia-playback-controls/ia-playback-controls.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/models.d.ts +13 -0
- package/dist/src/elements/ia-playback-controls/models.d.ts.map +1 -0
- package/dist/src/elements/ia-playback-controls/models.js +12 -0
- package/dist/src/elements/ia-playback-controls/models.js.map +1 -0
- package/dist/src/elements/ia-radio-player/assets/next-result.d.ts +3 -0
- package/dist/src/elements/ia-radio-player/assets/next-result.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/assets/next-result.js +27 -0
- package/dist/src/elements/ia-radio-player/assets/next-result.js.map +1 -0
- package/dist/src/elements/ia-radio-player/assets/previous-result.d.ts +3 -0
- package/dist/src/elements/ia-radio-player/assets/previous-result.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/assets/previous-result.js +27 -0
- package/dist/src/elements/ia-radio-player/assets/previous-result.js.map +1 -0
- package/dist/src/elements/ia-radio-player/ia-radio-player.d.ts +130 -0
- package/dist/src/elements/ia-radio-player/ia-radio-player.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/ia-radio-player.js +748 -0
- package/dist/src/elements/ia-radio-player/ia-radio-player.js.map +1 -0
- package/dist/src/elements/ia-radio-player/ia-search-results-switcher.d.ts +22 -0
- package/dist/src/elements/ia-radio-player/ia-search-results-switcher.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/ia-search-results-switcher.js +137 -0
- package/dist/src/elements/ia-radio-player/ia-search-results-switcher.js.map +1 -0
- package/dist/src/elements/ia-radio-player/models.d.ts +29 -0
- package/dist/src/elements/ia-radio-player/models.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/models.js +2 -0
- package/dist/src/elements/ia-radio-player/models.js.map +1 -0
- package/dist/src/elements/ia-radio-player/search/backends/full-text-search-backend.d.ts +38 -0
- package/dist/src/elements/ia-radio-player/search/backends/full-text-search-backend.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/search/backends/full-text-search-backend.js +64 -0
- package/dist/src/elements/ia-radio-player/search/backends/full-text-search-backend.js.map +1 -0
- package/dist/src/elements/ia-radio-player/search/backends/full-text-search-response.d.ts +94 -0
- package/dist/src/elements/ia-radio-player/search/backends/full-text-search-response.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/search/backends/full-text-search-response.js +56 -0
- package/dist/src/elements/ia-radio-player/search/backends/full-text-search-response.js.map +1 -0
- package/dist/src/elements/ia-radio-player/search/backends/local-search-backend.d.ts +15 -0
- package/dist/src/elements/ia-radio-player/search/backends/local-search-backend.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/search/backends/local-search-backend.js +26 -0
- package/dist/src/elements/ia-radio-player/search/backends/local-search-backend.js.map +1 -0
- package/dist/src/elements/ia-radio-player/search/backends/search-backend.d.ts +12 -0
- package/dist/src/elements/ia-radio-player/search/backends/search-backend.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/search/backends/search-backend.js +2 -0
- package/dist/src/elements/ia-radio-player/search/backends/search-backend.js.map +1 -0
- package/dist/src/elements/ia-radio-player/search/models.d.ts +38 -0
- package/dist/src/elements/ia-radio-player/search/models.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/search/models.js +17 -0
- package/dist/src/elements/ia-radio-player/search/models.js.map +1 -0
- package/dist/src/elements/ia-radio-player/search/search-handler.d.ts +49 -0
- package/dist/src/elements/ia-radio-player/search/search-handler.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/search/search-handler.js +128 -0
- package/dist/src/elements/ia-radio-player/search/search-handler.js.map +1 -0
- package/dist/src/elements/ia-radio-player/search/search-helper.d.ts +9 -0
- package/dist/src/elements/ia-radio-player/search/search-helper.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/search/search-helper.js +15 -0
- package/dist/src/elements/ia-radio-player/search/search-helper.js.map +1 -0
- package/dist/src/elements/ia-radio-player/search/transcript-index.d.ts +45 -0
- package/dist/src/elements/ia-radio-player/search/transcript-index.d.ts.map +1 -0
- package/dist/src/elements/ia-radio-player/search/transcript-index.js +48 -0
- package/dist/src/elements/ia-radio-player/search/transcript-index.js.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/assets/next-section-marker.d.ts +3 -0
- package/dist/src/elements/ia-scrubber-bar/assets/next-section-marker.d.ts.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/assets/next-section-marker.js +18 -0
- package/dist/src/elements/ia-scrubber-bar/assets/next-section-marker.js.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/assets/previous-section-marker.d.ts +3 -0
- package/dist/src/elements/ia-scrubber-bar/assets/previous-section-marker.d.ts.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/assets/previous-section-marker.js +18 -0
- package/dist/src/elements/ia-scrubber-bar/assets/previous-section-marker.js.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/ia-scrubber-bar.d.ts +82 -0
- package/dist/src/elements/ia-scrubber-bar/ia-scrubber-bar.d.ts.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/ia-scrubber-bar.js +387 -0
- package/dist/src/elements/ia-scrubber-bar/ia-scrubber-bar.js.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/ia-section-marker.d.ts +16 -0
- package/dist/src/elements/ia-scrubber-bar/ia-section-marker.d.ts.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/ia-section-marker.js +109 -0
- package/dist/src/elements/ia-scrubber-bar/ia-section-marker.js.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/models.d.ts +21 -0
- package/dist/src/elements/ia-scrubber-bar/models.d.ts.map +1 -0
- package/dist/src/elements/ia-scrubber-bar/models.js +20 -0
- package/dist/src/elements/ia-scrubber-bar/models.js.map +1 -0
- package/dist/src/elements/ia-transcript-view/duration-formatter.d.ts +13 -0
- package/dist/src/elements/ia-transcript-view/duration-formatter.d.ts.map +1 -0
- package/dist/src/elements/ia-transcript-view/duration-formatter.js +25 -0
- package/dist/src/elements/ia-transcript-view/duration-formatter.js.map +1 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-entry.d.ts +25 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-entry.d.ts.map +1 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-entry.js +51 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-entry.js.map +1 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-view.d.ts +87 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-view.d.ts.map +1 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-view.js +565 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-view.js.map +1 -0
- package/dist/src/elements/ia-transcript-view/models.d.ts +34 -0
- package/dist/src/elements/ia-transcript-view/models.d.ts.map +1 -0
- package/dist/src/elements/ia-transcript-view/models.js +38 -0
- package/dist/src/elements/ia-transcript-view/models.js.map +1 -0
- package/dist/src/elements/ia-waveform-progress/ia-waveform-progress.d.ts +62 -0
- package/dist/src/elements/ia-waveform-progress/ia-waveform-progress.d.ts.map +1 -0
- package/dist/src/elements/ia-waveform-progress/ia-waveform-progress.js +217 -0
- package/dist/src/elements/ia-waveform-progress/ia-waveform-progress.js.map +1 -0
- package/dist/src/elements/ia-waveform-progress/models.d.ts +13 -0
- package/dist/src/elements/ia-waveform-progress/models.d.ts.map +1 -0
- package/dist/src/elements/ia-waveform-progress/models.js +2 -0
- package/dist/src/elements/ia-waveform-progress/models.js.map +1 -0
- package/dist/src/elements/index.d.ts +27 -0
- package/dist/src/elements/index.d.ts.map +1 -1
- package/dist/src/elements/index.js +27 -0
- package/dist/src/elements/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import type { AudioSource } from './models.js';
|
|
3
|
+
/**
|
|
4
|
+
* A declarative wrapper around the native `<audio>` element.
|
|
5
|
+
*
|
|
6
|
+
* `HTMLAudioElement` is imperative and its events do not cross a shadow root
|
|
7
|
+
* boundary, so this element exposes playback as reactive properties and
|
|
8
|
+
* re-dispatches the events consumers care about from the host.
|
|
9
|
+
*
|
|
10
|
+
* The element renders nothing visible unless `showControls` is set.
|
|
11
|
+
*/
|
|
12
|
+
export declare class IAAudioElement extends LitElement {
|
|
13
|
+
/** Whether to show the browser's native playback controls */
|
|
14
|
+
showControls: boolean;
|
|
15
|
+
/** Playback speed multiplier, where 1 is normal speed */
|
|
16
|
+
playbackRate: number;
|
|
17
|
+
/** Playback volume, from 0 (muted) to 1 (full) */
|
|
18
|
+
volume: number;
|
|
19
|
+
/** The sources to offer the browser, in order of preference */
|
|
20
|
+
sources: AudioSource[];
|
|
21
|
+
private audioElement?;
|
|
22
|
+
/**
|
|
23
|
+
* Length of the loaded track in seconds.
|
|
24
|
+
*
|
|
25
|
+
* Matches `HTMLMediaElement.duration`, so it is `NaN` until the browser has
|
|
26
|
+
* read the track's metadata, and can be `Infinity` for a stream. Check with
|
|
27
|
+
* `Number.isFinite` before doing arithmetic on it. Returns 0 only before the
|
|
28
|
+
* element has rendered at all.
|
|
29
|
+
*/
|
|
30
|
+
get duration(): number;
|
|
31
|
+
/** Playback position within the track in seconds */
|
|
32
|
+
get currentTime(): number;
|
|
33
|
+
/** Reloads the current sources, e.g. after changing them */
|
|
34
|
+
load(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Starts playback.
|
|
37
|
+
*
|
|
38
|
+
* `HTMLMediaElement.play()` returns a promise that rejects when the browser
|
|
39
|
+
* blocks playback (autoplay policy), when a `pause()` interrupts the request,
|
|
40
|
+
* and when no source can be decoded. The rejection is swallowed rather than
|
|
41
|
+
* left floating, so watch the events to know what happened: `playbackStarted`
|
|
42
|
+
* means playback began, and `error` means the browser could not load a
|
|
43
|
+
* source.
|
|
44
|
+
*/
|
|
45
|
+
play(): void;
|
|
46
|
+
/** Pauses playback */
|
|
47
|
+
pause(): void;
|
|
48
|
+
/** Jumps to an absolute position in the track */
|
|
49
|
+
seekTo(seconds: number): void;
|
|
50
|
+
/** Jumps forwards or backwards relative to the current position */
|
|
51
|
+
seekBy(seconds: number): void;
|
|
52
|
+
render(): TemplateResult;
|
|
53
|
+
private handleDurationChange;
|
|
54
|
+
private handleTimeChange;
|
|
55
|
+
private playbackStarted;
|
|
56
|
+
private playbackPaused;
|
|
57
|
+
private canPlay;
|
|
58
|
+
/**
|
|
59
|
+
* Fired by the `<audio>` itself when the resource it committed to turns out
|
|
60
|
+
* to be unplayable. It carries a `MediaError` describing what went wrong.
|
|
61
|
+
*/
|
|
62
|
+
private handleMediaError;
|
|
63
|
+
/**
|
|
64
|
+
* Fired by a `<source>` the browser could not use. The browser walks the
|
|
65
|
+
* sources in order, so one failing only matters once there are none left to
|
|
66
|
+
* try, which it signals by dropping to `NETWORK_NO_SOURCE`. It reports no
|
|
67
|
+
* `MediaError` on this path.
|
|
68
|
+
*/
|
|
69
|
+
private handleSourceError;
|
|
70
|
+
private emitError;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=ia-audio-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ia-audio-element.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-audio-element/ia-audio-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAc5C;;;;;;;;GAQG;AACH,qBACa,cAAe,SAAQ,UAAU;IAC5C,6DAA6D;IAChC,YAAY,UAAS;IAElD,yDAAyD;IAC7B,YAAY,SAAK;IAE7C,kDAAkD;IACtB,MAAM,SAAK;IAEvC,+DAA+D;IACpC,OAAO,EAAE,WAAW,EAAE,CAAM;IAEvC,OAAO,CAAC,YAAY,CAAC,CAA0B;IAE/D;;;;;;;OAOG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,oDAAoD;IACpD,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,4DAA4D;IAC5D,IAAI,IAAI,IAAI;IAQZ;;;;;;;;;OASG;IACH,IAAI,IAAI,IAAI;IAIZ,sBAAsB;IACtB,KAAK,IAAI,IAAI;IAIb,iDAAiD;IACjD,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK7B,mEAAmE;IACnE,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK7B,MAAM,IAAI,cAAc;IAyBxB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,OAAO;IAIf;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,SAAS;CAOlB"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, LitElement } from 'lit';
|
|
3
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
4
|
+
/**
|
|
5
|
+
* Event names emitted by this component
|
|
6
|
+
*/
|
|
7
|
+
const Events = {
|
|
8
|
+
TimeUpdate: 'timeupdate',
|
|
9
|
+
DurationChange: 'durationchange',
|
|
10
|
+
PlaybackStarted: 'playbackStarted',
|
|
11
|
+
PlaybackPaused: 'playbackPaused',
|
|
12
|
+
CanPlay: 'canplay',
|
|
13
|
+
Error: 'error',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A declarative wrapper around the native `<audio>` element.
|
|
17
|
+
*
|
|
18
|
+
* `HTMLAudioElement` is imperative and its events do not cross a shadow root
|
|
19
|
+
* boundary, so this element exposes playback as reactive properties and
|
|
20
|
+
* re-dispatches the events consumers care about from the host.
|
|
21
|
+
*
|
|
22
|
+
* The element renders nothing visible unless `showControls` is set.
|
|
23
|
+
*/
|
|
24
|
+
let IAAudioElement = class IAAudioElement extends LitElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
/** Whether to show the browser's native playback controls */
|
|
28
|
+
this.showControls = false;
|
|
29
|
+
/** Playback speed multiplier, where 1 is normal speed */
|
|
30
|
+
this.playbackRate = 1;
|
|
31
|
+
/** Playback volume, from 0 (muted) to 1 (full) */
|
|
32
|
+
this.volume = 1;
|
|
33
|
+
/** The sources to offer the browser, in order of preference */
|
|
34
|
+
this.sources = [];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Length of the loaded track in seconds.
|
|
38
|
+
*
|
|
39
|
+
* Matches `HTMLMediaElement.duration`, so it is `NaN` until the browser has
|
|
40
|
+
* read the track's metadata, and can be `Infinity` for a stream. Check with
|
|
41
|
+
* `Number.isFinite` before doing arithmetic on it. Returns 0 only before the
|
|
42
|
+
* element has rendered at all.
|
|
43
|
+
*/
|
|
44
|
+
get duration() {
|
|
45
|
+
return this.audioElement?.duration ?? 0;
|
|
46
|
+
}
|
|
47
|
+
/** Playback position within the track in seconds */
|
|
48
|
+
get currentTime() {
|
|
49
|
+
return this.audioElement?.currentTime ?? 0;
|
|
50
|
+
}
|
|
51
|
+
/** Reloads the current sources, e.g. after changing them */
|
|
52
|
+
load() {
|
|
53
|
+
if (!this.audioElement)
|
|
54
|
+
return;
|
|
55
|
+
this.audioElement.load();
|
|
56
|
+
// Loading resets the playback rate, so it has to be applied again.
|
|
57
|
+
this.audioElement.playbackRate = this.playbackRate;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Starts playback.
|
|
61
|
+
*
|
|
62
|
+
* `HTMLMediaElement.play()` returns a promise that rejects when the browser
|
|
63
|
+
* blocks playback (autoplay policy), when a `pause()` interrupts the request,
|
|
64
|
+
* and when no source can be decoded. The rejection is swallowed rather than
|
|
65
|
+
* left floating, so watch the events to know what happened: `playbackStarted`
|
|
66
|
+
* means playback began, and `error` means the browser could not load a
|
|
67
|
+
* source.
|
|
68
|
+
*/
|
|
69
|
+
play() {
|
|
70
|
+
this.audioElement?.play().catch(() => { });
|
|
71
|
+
}
|
|
72
|
+
/** Pauses playback */
|
|
73
|
+
pause() {
|
|
74
|
+
this.audioElement?.pause();
|
|
75
|
+
}
|
|
76
|
+
/** Jumps to an absolute position in the track */
|
|
77
|
+
seekTo(seconds) {
|
|
78
|
+
if (!this.audioElement)
|
|
79
|
+
return;
|
|
80
|
+
this.audioElement.currentTime = seconds;
|
|
81
|
+
}
|
|
82
|
+
/** Jumps forwards or backwards relative to the current position */
|
|
83
|
+
seekBy(seconds) {
|
|
84
|
+
if (!this.audioElement)
|
|
85
|
+
return;
|
|
86
|
+
this.audioElement.currentTime += seconds;
|
|
87
|
+
}
|
|
88
|
+
render() {
|
|
89
|
+
return html `
|
|
90
|
+
<audio
|
|
91
|
+
?controls=${this.showControls}
|
|
92
|
+
.volume=${this.volume}
|
|
93
|
+
.playbackRate=${this.playbackRate}
|
|
94
|
+
@timeupdate=${this.handleTimeChange}
|
|
95
|
+
@durationchange=${this.handleDurationChange}
|
|
96
|
+
@play=${this.playbackStarted}
|
|
97
|
+
@pause=${this.playbackPaused}
|
|
98
|
+
@canplay=${this.canPlay}
|
|
99
|
+
@error=${this.handleMediaError}
|
|
100
|
+
>
|
|
101
|
+
${this.sources.map((source) => html `<source
|
|
102
|
+
src=${source.url}
|
|
103
|
+
type=${source.mimetype}
|
|
104
|
+
@error=${this.handleSourceError}
|
|
105
|
+
/>`)}
|
|
106
|
+
</audio>
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
handleDurationChange(e) {
|
|
110
|
+
const target = e.target;
|
|
111
|
+
this.dispatchEvent(new CustomEvent(Events.DurationChange, {
|
|
112
|
+
detail: { duration: target.duration },
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
handleTimeChange(e) {
|
|
116
|
+
const target = e.target;
|
|
117
|
+
this.dispatchEvent(new CustomEvent(Events.TimeUpdate, {
|
|
118
|
+
detail: { currentTime: target.currentTime },
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
playbackStarted() {
|
|
122
|
+
this.dispatchEvent(new Event(Events.PlaybackStarted));
|
|
123
|
+
}
|
|
124
|
+
playbackPaused() {
|
|
125
|
+
this.dispatchEvent(new Event(Events.PlaybackPaused));
|
|
126
|
+
}
|
|
127
|
+
canPlay() {
|
|
128
|
+
this.dispatchEvent(new Event(Events.CanPlay));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Fired by the `<audio>` itself when the resource it committed to turns out
|
|
132
|
+
* to be unplayable. It carries a `MediaError` describing what went wrong.
|
|
133
|
+
*/
|
|
134
|
+
handleMediaError(e) {
|
|
135
|
+
this.emitError(e.target.error);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Fired by a `<source>` the browser could not use. The browser walks the
|
|
139
|
+
* sources in order, so one failing only matters once there are none left to
|
|
140
|
+
* try, which it signals by dropping to `NETWORK_NO_SOURCE`. It reports no
|
|
141
|
+
* `MediaError` on this path.
|
|
142
|
+
*/
|
|
143
|
+
handleSourceError() {
|
|
144
|
+
if (this.audioElement?.networkState !== HTMLMediaElement.NETWORK_NO_SOURCE)
|
|
145
|
+
return;
|
|
146
|
+
this.emitError(null);
|
|
147
|
+
}
|
|
148
|
+
emitError(error) {
|
|
149
|
+
this.dispatchEvent(new CustomEvent(Events.Error, {
|
|
150
|
+
detail: { error },
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
__decorate([
|
|
155
|
+
property({ type: Boolean })
|
|
156
|
+
], IAAudioElement.prototype, "showControls", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ type: Number })
|
|
159
|
+
], IAAudioElement.prototype, "playbackRate", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: Number })
|
|
162
|
+
], IAAudioElement.prototype, "volume", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({ type: Array })
|
|
165
|
+
], IAAudioElement.prototype, "sources", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
query('audio')
|
|
168
|
+
], IAAudioElement.prototype, "audioElement", void 0);
|
|
169
|
+
IAAudioElement = __decorate([
|
|
170
|
+
customElement('ia-audio-element')
|
|
171
|
+
], IAAudioElement);
|
|
172
|
+
export { IAAudioElement };
|
|
173
|
+
//# sourceMappingURL=ia-audio-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ia-audio-element.js","sourceRoot":"","sources":["../../../../src/elements/ia-audio-element/ia-audio-element.ts"],"names":[],"mappings":"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","sourcesContent":["import { html, LitElement, type TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\n\nimport type { AudioSource } from './models';\n\n/**\n * Event names emitted by this component\n */\nconst Events = {\n TimeUpdate: 'timeupdate',\n DurationChange: 'durationchange',\n PlaybackStarted: 'playbackStarted',\n PlaybackPaused: 'playbackPaused',\n CanPlay: 'canplay',\n Error: 'error',\n};\n\n/**\n * A declarative wrapper around the native `<audio>` element.\n *\n * `HTMLAudioElement` is imperative and its events do not cross a shadow root\n * boundary, so this element exposes playback as reactive properties and\n * re-dispatches the events consumers care about from the host.\n *\n * The element renders nothing visible unless `showControls` is set.\n */\n@customElement('ia-audio-element')\nexport class IAAudioElement extends LitElement {\n /** Whether to show the browser's native playback controls */\n @property({ type: Boolean }) showControls = false;\n\n /** Playback speed multiplier, where 1 is normal speed */\n @property({ type: Number }) playbackRate = 1;\n\n /** Playback volume, from 0 (muted) to 1 (full) */\n @property({ type: Number }) volume = 1;\n\n /** The sources to offer the browser, in order of preference */\n @property({ type: Array }) sources: AudioSource[] = [];\n\n @query('audio') private audioElement?: HTMLAudioElement | null;\n\n /**\n * Length of the loaded track in seconds.\n *\n * Matches `HTMLMediaElement.duration`, so it is `NaN` until the browser has\n * read the track's metadata, and can be `Infinity` for a stream. Check with\n * `Number.isFinite` before doing arithmetic on it. Returns 0 only before the\n * element has rendered at all.\n */\n get duration(): number {\n return this.audioElement?.duration ?? 0;\n }\n\n /** Playback position within the track in seconds */\n get currentTime(): number {\n return this.audioElement?.currentTime ?? 0;\n }\n\n /** Reloads the current sources, e.g. after changing them */\n load(): void {\n if (!this.audioElement) return;\n\n this.audioElement.load();\n // Loading resets the playback rate, so it has to be applied again.\n this.audioElement.playbackRate = this.playbackRate;\n }\n\n /**\n * Starts playback.\n *\n * `HTMLMediaElement.play()` returns a promise that rejects when the browser\n * blocks playback (autoplay policy), when a `pause()` interrupts the request,\n * and when no source can be decoded. The rejection is swallowed rather than\n * left floating, so watch the events to know what happened: `playbackStarted`\n * means playback began, and `error` means the browser could not load a\n * source.\n */\n play(): void {\n this.audioElement?.play().catch(() => {});\n }\n\n /** Pauses playback */\n pause(): void {\n this.audioElement?.pause();\n }\n\n /** Jumps to an absolute position in the track */\n seekTo(seconds: number): void {\n if (!this.audioElement) return;\n this.audioElement.currentTime = seconds;\n }\n\n /** Jumps forwards or backwards relative to the current position */\n seekBy(seconds: number): void {\n if (!this.audioElement) return;\n this.audioElement.currentTime += seconds;\n }\n\n render(): TemplateResult {\n return html`\n <audio\n ?controls=${this.showControls}\n .volume=${this.volume}\n .playbackRate=${this.playbackRate}\n @timeupdate=${this.handleTimeChange}\n @durationchange=${this.handleDurationChange}\n @play=${this.playbackStarted}\n @pause=${this.playbackPaused}\n @canplay=${this.canPlay}\n @error=${this.handleMediaError}\n >\n ${this.sources.map(\n (source) =>\n html`<source\n src=${source.url}\n type=${source.mimetype}\n @error=${this.handleSourceError}\n />`,\n )}\n </audio>\n `;\n }\n\n private handleDurationChange(e: Event): void {\n const target = e.target as HTMLAudioElement;\n this.dispatchEvent(\n new CustomEvent<{ duration: number }>(Events.DurationChange, {\n detail: { duration: target.duration },\n }),\n );\n }\n\n private handleTimeChange(e: Event): void {\n const target = e.target as HTMLAudioElement;\n this.dispatchEvent(\n new CustomEvent<{ currentTime: number }>(Events.TimeUpdate, {\n detail: { currentTime: target.currentTime },\n }),\n );\n }\n\n private playbackStarted(): void {\n this.dispatchEvent(new Event(Events.PlaybackStarted));\n }\n\n private playbackPaused(): void {\n this.dispatchEvent(new Event(Events.PlaybackPaused));\n }\n\n private canPlay(): void {\n this.dispatchEvent(new Event(Events.CanPlay));\n }\n\n /**\n * Fired by the `<audio>` itself when the resource it committed to turns out\n * to be unplayable. It carries a `MediaError` describing what went wrong.\n */\n private handleMediaError(e: Event): void {\n this.emitError((e.target as HTMLAudioElement).error);\n }\n\n /**\n * Fired by a `<source>` the browser could not use. The browser walks the\n * sources in order, so one failing only matters once there are none left to\n * try, which it signals by dropping to `NETWORK_NO_SOURCE`. It reports no\n * `MediaError` on this path.\n */\n private handleSourceError(): void {\n if (this.audioElement?.networkState !== HTMLMediaElement.NETWORK_NO_SOURCE)\n return;\n\n this.emitError(null);\n }\n\n private emitError(error: MediaError | null): void {\n this.dispatchEvent(\n new CustomEvent<{ error: MediaError | null }>(Events.Error, {\n detail: { error },\n }),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single playable source for an `<ia-audio-element>`.
|
|
3
|
+
*
|
|
4
|
+
* Sources are offered to the browser in order, and the browser picks the first
|
|
5
|
+
* one it can decode, so list the preferred format first.
|
|
6
|
+
*/
|
|
7
|
+
export interface AudioSource {
|
|
8
|
+
/** The URL of the audio file. */
|
|
9
|
+
url: string;
|
|
10
|
+
/** The MIME type of the audio file, e.g. `audio/mpeg`. */
|
|
11
|
+
mimetype: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-audio-element/models.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IAEZ,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/elements/ia-audio-element/models.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A single playable source for an `<ia-audio-element>`.\n *\n * Sources are offered to the browser in order, and the browser picks the first\n * one it can decode, so list the preferred format first.\n */\nexport interface AudioSource {\n /** The URL of the audio file. */\n url: string;\n\n /** The MIME type of the audio file, e.g. `audio/mpeg`. */\n mimetype: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-results.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-expandable-search-bar/assets/clear-results.ts"],"names":[],"mappings":";AAQA,wBAmBE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Circled cross that clears the search
|
|
3
|
+
*
|
|
4
|
+
* Decorative: the button around it carries the accessible name. The disc and
|
|
5
|
+
* the cross are themed separately, since one sits on top of the other.
|
|
6
|
+
*/
|
|
7
|
+
import { svg } from 'lit';
|
|
8
|
+
export default svg `
|
|
9
|
+
<svg
|
|
10
|
+
height="12"
|
|
11
|
+
viewBox="0 0 12 12"
|
|
12
|
+
width="12"
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
>
|
|
16
|
+
<g fill="none" fill-rule="evenodd">
|
|
17
|
+
<circle cx="6" cy="6" r="6" class="clear-disc" />
|
|
18
|
+
<g class="clear-cross" stroke-linecap="round">
|
|
19
|
+
<path d="m3.375 3.375 5.18412641 5.18412641" />
|
|
20
|
+
<path
|
|
21
|
+
d="m3.375 3.375 5.18412641 5.18412641"
|
|
22
|
+
transform="matrix(-1 0 0 1 12 0)"
|
|
23
|
+
/>
|
|
24
|
+
</g>
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
`;
|
|
28
|
+
//# sourceMappingURL=clear-results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-results.js","sourceRoot":"","sources":["../../../../../src/elements/ia-expandable-search-bar/assets/clear-results.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;CAmBjB,CAAC","sourcesContent":["/**\n * @file Circled cross that clears the search\n *\n * Decorative: the button around it carries the accessible name. The disc and\n * the cross are themed separately, since one sits on top of the other.\n */\nimport { svg } from 'lit';\n\nexport default svg`\n<svg\n height=\"12\"\n viewBox=\"0 0 12 12\"\n width=\"12\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n>\n <g fill=\"none\" fill-rule=\"evenodd\">\n <circle cx=\"6\" cy=\"6\" r=\"6\" class=\"clear-disc\" />\n <g class=\"clear-cross\" stroke-linecap=\"round\">\n <path d=\"m3.375 3.375 5.18412641 5.18412641\" />\n <path\n d=\"m3.375 3.375 5.18412641 5.18412641\"\n transform=\"matrix(-1 0 0 1 12 0)\"\n />\n </g>\n </g>\n</svg>\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-expandable-search-bar/assets/disclosure.ts"],"names":[],"mappings":";AAQA,wBAiBE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Chevron that opens and closes the quick search list
|
|
3
|
+
*
|
|
4
|
+
* Decorative: the button around it carries the accessible name. Inline so it
|
|
5
|
+
* can take its colour from the bar.
|
|
6
|
+
*/
|
|
7
|
+
import { svg } from 'lit';
|
|
8
|
+
export default svg `
|
|
9
|
+
<svg
|
|
10
|
+
height="9"
|
|
11
|
+
viewBox="0 0 19 9"
|
|
12
|
+
width="19"
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
d="m1 1 9 7 8-7"
|
|
18
|
+
fill="none"
|
|
19
|
+
stroke="currentColor"
|
|
20
|
+
stroke-linecap="round"
|
|
21
|
+
stroke-linejoin="round"
|
|
22
|
+
stroke-width="2"
|
|
23
|
+
/>
|
|
24
|
+
</svg>
|
|
25
|
+
`;
|
|
26
|
+
//# sourceMappingURL=disclosure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclosure.js","sourceRoot":"","sources":["../../../../../src/elements/ia-expandable-search-bar/assets/disclosure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiBjB,CAAC","sourcesContent":["/**\n * @file Chevron that opens and closes the quick search list\n *\n * Decorative: the button around it carries the accessible name. Inline so it\n * can take its colour from the bar.\n */\nimport { svg } from 'lit';\n\nexport default svg`\n<svg\n height=\"9\"\n viewBox=\"0 0 19 9\"\n width=\"19\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n>\n <path\n d=\"m1 1 9 7 8-7\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n />\n</svg>\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magnifying-glass.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-expandable-search-bar/assets/magnifying-glass.ts"],"names":[],"mappings":";AAQA,wBAaE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Magnifying glass shown at the start of the search bar
|
|
3
|
+
*
|
|
4
|
+
* Decorative: the input beside it carries the accessible name, so the icon is
|
|
5
|
+
* hidden from assistive tech. Inline so it can take its colour from the bar.
|
|
6
|
+
*/
|
|
7
|
+
import { svg } from 'lit';
|
|
8
|
+
export default svg `
|
|
9
|
+
<svg
|
|
10
|
+
height="14"
|
|
11
|
+
viewBox="0 0 14 14"
|
|
12
|
+
width="14"
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
d="m5.17668106 0c-2.859002 0-5.17668106 2.31767906-5.17668106 5.17668106 0 2.85900201 2.31767906 5.17668104 5.17668106 5.17668104.98756168.0210349 1.96052598-.240917 2.80403558-.75493263l4.09820586 4.20605333 1.7255603-1.7255603-4.20605333-4.09820586c.51401563-.8435096.77596753-1.8164739.75493263-2.80403558 0-2.859002-2.31767903-5.17668106-5.17668104-5.17668106m0 1.72556035c1.90600134 0 3.45112071 1.54511938 3.45112071 3.45112071 0 1.90600134-1.54511937 3.45112071-3.45112071 3.45112071-1.90600133 0-3.45112071-1.54511937-3.45112071-3.45112071 0-1.90600133 1.54511938-3.45112071 3.45112071-3.45112071"
|
|
18
|
+
fill="currentColor"
|
|
19
|
+
/>
|
|
20
|
+
</svg>
|
|
21
|
+
`;
|
|
22
|
+
//# sourceMappingURL=magnifying-glass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magnifying-glass.js","sourceRoot":"","sources":["../../../../../src/elements/ia-expandable-search-bar/assets/magnifying-glass.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;;;;;;;;;;CAajB,CAAC","sourcesContent":["/**\n * @file Magnifying glass shown at the start of the search bar\n *\n * Decorative: the input beside it carries the accessible name, so the icon is\n * hidden from assistive tech. Inline so it can take its colour from the bar.\n */\nimport { svg } from 'lit';\n\nexport default svg`\n<svg\n height=\"14\"\n viewBox=\"0 0 14 14\"\n width=\"14\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n>\n <path\n d=\"m5.17668106 0c-2.859002 0-5.17668106 2.31767906-5.17668106 5.17668106 0 2.85900201 2.31767906 5.17668104 5.17668106 5.17668104.98756168.0210349 1.96052598-.240917 2.80403558-.75493263l4.09820586 4.20605333 1.7255603-1.7255603-4.20605333-4.09820586c.51401563-.8435096.77596753-1.8164739.75493263-2.80403558 0-2.859002-2.31767903-5.17668106-5.17668104-5.17668106m0 1.72556035c1.90600134 0 3.45112071 1.54511938 3.45112071 3.45112071 0 1.90600134-1.54511937 3.45112071-3.45112071 3.45112071-1.90600133 0-3.45112071-1.54511937-3.45112071-3.45112071 0-1.90600133 1.54511938-3.45112071 3.45112071-3.45112071\"\n fill=\"currentColor\"\n />\n</svg>\n`;\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { LitElement, type CSSResultGroup, type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import type { QuickSearchEntry } from './models.js';
|
|
3
|
+
import './ia-quick-search.js';
|
|
4
|
+
/**
|
|
5
|
+
* A search bar with a quick search list that expands underneath it.
|
|
6
|
+
*/
|
|
7
|
+
export declare class IAExpandableSearchBar extends LitElement {
|
|
8
|
+
/** Whether the quick search list is showing */
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
/** Whether to offer the disclosure button that opens the quick search */
|
|
11
|
+
showsDisclosure: boolean;
|
|
12
|
+
/** The current search text */
|
|
13
|
+
searchTerm: string;
|
|
14
|
+
/** The suggestions to offer in the quick search list */
|
|
15
|
+
quickSearches: QuickSearchEntry[];
|
|
16
|
+
/** Placeholder text for the input */
|
|
17
|
+
placeholder: string;
|
|
18
|
+
/** The accessible name for the input */
|
|
19
|
+
label: string;
|
|
20
|
+
private searchInput?;
|
|
21
|
+
render(): TemplateResult;
|
|
22
|
+
/**
|
|
23
|
+
* Forces the field to match `searchTerm`.
|
|
24
|
+
*
|
|
25
|
+
* Lit's property binding dirty-checks against the value it last committed
|
|
26
|
+
* rather than against the DOM. A consumer that normalises `searchTerm` in
|
|
27
|
+
* its own `inputchange` handler can land back on that committed value, so
|
|
28
|
+
* the binding sees nothing to do and the field keeps whatever the listener
|
|
29
|
+
* typed. Writing it here keeps the two in step.
|
|
30
|
+
*/
|
|
31
|
+
updated(changedProperties: PropertyValues): void;
|
|
32
|
+
/**
|
|
33
|
+
* Tracks the input's value.
|
|
34
|
+
*
|
|
35
|
+
* Bound to `input` rather than `keyup` so that a paste from the mouse menu,
|
|
36
|
+
* autofill, a drag-and-drop and an IME composition all register, and so that
|
|
37
|
+
* arrow keys don't announce a change that never happened.
|
|
38
|
+
*/
|
|
39
|
+
private handleInput;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the Enter now coming up is the same one that went down on the
|
|
42
|
+
* input. Selecting a quick search with the keyboard hands focus back to the
|
|
43
|
+
* input mid-keystroke, so its keyup lands here without a matching keydown.
|
|
44
|
+
*/
|
|
45
|
+
private enterWentDownOnInput;
|
|
46
|
+
private handleKeyDown;
|
|
47
|
+
private handleKeyUp;
|
|
48
|
+
private clearSearch;
|
|
49
|
+
private quickSearchSelected;
|
|
50
|
+
private toggleDisclosure;
|
|
51
|
+
static get styles(): CSSResultGroup;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=ia-expandable-search-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ia-expandable-search-bar.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-expandable-search-bar/ia-expandable-search-bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAIb,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMjD,OAAO,mBAAmB,CAAC;AAY3B;;GAEG;AACH,qBACa,qBAAsB,SAAQ,UAAU;IACnD,+CAA+C;IAClB,MAAM,UAAS;IAE5C,yEAAyE;IAC5C,eAAe,UAAS;IAErD,8BAA8B;IACF,UAAU,SAAM;IAE5C,wDAAwD;IAC7B,aAAa,EAAE,gBAAgB,EAAE,CAAM;IAElE,qCAAqC;IACT,WAAW,SAAiB;IAExD,wCAAwC;IACZ,KAAK,SAAiB;IAE1B,OAAO,CAAC,WAAW,CAAC,CAA0B;IAEtE,MAAM,IAAI,cAAc;IAuDxB;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAMhD;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAWnB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB,CAAS;IAErC,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,mBAAmB;IAqB3B,OAAO,CAAC,gBAAgB;IAIxB,MAAM,KAAK,MAAM,IAAI,cAAc,CAsKlC;CACF"}
|