A Web Component that provides typeahead suggestions for AT Protocol (Bluesky) handles. Uses the public app.bsky.actor.searchActorsTypeahead API directly from the client.
···11{
22 "name": "@tijs/actor-typeahead",
33- "version": "0.1.0",
33+ "version": "0.2.0",
44+ "description": "Typeahead Web Component for AT Protocol (Bluesky) actor handles",
45 "exports": {
56 ".": "./mod.ts"
67 },
+15
mod.ts
···11+/**
22+ * Typeahead Web Component for AT Protocol actor handles.
33+ *
44+ * Wrap any `<input>` element with `<actor-typeahead>` to get autocomplete
55+ * suggestions from Bluesky's public API. Framework-agnostic, zero dependencies.
66+ *
77+ * @example
88+ * ```html
99+ * <actor-typeahead>
1010+ * <input type="text" placeholder="alice.bsky.social" />
1111+ * </actor-typeahead>
1212+ * ```
1313+ *
1414+ * @module
1515+ */
116export { default as ActorTypeahead } from "./src/actor-typeahead.ts";
+25-1
src/actor-typeahead.ts
···103103 return tmpl.cloneNode(true) as T;
104104}
105105106106-interface Actor {
106106+/** An actor returned from the Bluesky typeahead API. */
107107+export interface Actor {
108108+ /** The actor's handle (e.g. "alice.bsky.social"). */
107109 handle: string;
110110+ /** URL to the actor's avatar image. */
108111 avatar?: string;
109112}
110113114114+/**
115115+ * A Web Component that provides typeahead suggestions for AT Protocol handles.
116116+ *
117117+ * Wraps a slotted `<input>` element and displays a dropdown of matching actors
118118+ * fetched from Bluesky's `app.bsky.actor.searchActorsTypeahead` API.
119119+ * Supports keyboard navigation, pointer/click selection, and dispatches native
120120+ * `input` events so frameworks like React can detect value changes.
121121+ *
122122+ * Themeable via CSS custom properties: `--color-background`, `--color-border`,
123123+ * `--color-hover`, `--color-avatar-fallback`, `--radius`, `--padding-menu`.
124124+ *
125125+ * @example
126126+ * ```html
127127+ * <actor-typeahead rows="8">
128128+ * <input type="text" placeholder="alice.bsky.social" />
129129+ * </actor-typeahead>
130130+ * ```
131131+ */
111132export default class ActorTypeahead extends HTMLElement {
133133+ /** The default custom element tag name. */
112134 static tag = "actor-typeahead";
113135136136+ /** Register this component as a custom element under the given tag name. */
114137 static define(tag = this.tag): void {
115138 this.tag = tag;
116139···156179 return rows;
157180 }
158181182182+ /** Routes DOM events to the appropriate internal handler. */
159183 handleEvent(evt: Event) {
160184 switch (evt.type) {
161185 case "input":