@substrate-system/actor-typeahead 0.0.3 → 0.0.4

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/index.js CHANGED
@@ -11,11 +11,20 @@ class ActorTypeahead extends WebComponent.create("actor-typeahead") {
11
11
  __name(this, "ActorTypeahead");
12
12
  }
13
13
  static reflectedStringAttributes = ["host", "rows"];
14
+ /**
15
+ * Returns the text announced when a Typeahead request settles with
16
+ * `count` Suggestions, including 0 when nothing matched the Query.
17
+ * Defaults to English. Replace it to translate; the replacement
18
+ * handles plurals and 0. Read at announce time, so it can be set
19
+ * after connect.
20
+ */
21
+ announce = defaultAnnounce;
14
22
  #id = `actor-typeahead-${++instances}`;
15
23
  #actors = [];
16
24
  #index = -1;
17
- #pressed = false;
18
25
  #suggestionList = null;
26
+ #suggestionCount = null;
27
+ #nbsp = false;
19
28
  #timer;
20
29
  #controller = null;
21
30
  constructor() {
@@ -44,18 +53,23 @@ class ActorTypeahead extends WebComponent.create("actor-typeahead") {
44
53
  if (evt instanceof KeyboardEvent) this.#onkeydown(evt);
45
54
  break;
46
55
  case "focusout":
47
- this.#onfocusout();
56
+ if (evt instanceof FocusEvent) this.#onfocusout(evt);
48
57
  break;
49
- case "pointerdown":
50
- this.#pressed = true;
58
+ case "mousedown":
59
+ evt.preventDefault();
51
60
  break;
52
- case "pointerup":
53
- this.#onpointerup(evt);
61
+ case "click":
62
+ this.#onclick(evt);
54
63
  break;
55
64
  }
56
65
  }
57
66
  #onkeydown(evt) {
58
67
  const last = this.#actors.length - 1;
68
+ const moves = ["ArrowDown", "ArrowUp", "PageDown", "PageUp"];
69
+ if (last < 0 && moves.includes(evt.key)) {
70
+ evt.preventDefault();
71
+ return;
72
+ }
59
73
  switch (evt.key) {
60
74
  case "ArrowDown":
61
75
  evt.preventDefault();
@@ -69,7 +83,7 @@ class ActorTypeahead extends WebComponent.create("actor-typeahead") {
69
83
  break;
70
84
  case "ArrowUp":
71
85
  evt.preventDefault();
72
- this.#index = Math.max(this.#index - 1, 0);
86
+ this.#index = this.#index < 0 ? last : this.#index - 1;
73
87
  this.render();
74
88
  break;
75
89
  case "PageUp":
@@ -127,18 +141,29 @@ class ActorTypeahead extends WebComponent.create("actor-typeahead") {
127
141
  this.#actors = parseActors(json);
128
142
  this.#index = -1;
129
143
  this.render();
144
+ this.#announce(this.#actors.length);
130
145
  }
131
- #onfocusout() {
132
- if (this.#pressed) return;
146
+ /**
147
+ * Write the Suggestion count. A trailing no-break space alternates
148
+ * between writes, so screen readers re-read an identical count.
149
+ */
150
+ #announce(count) {
151
+ if (!this.#suggestionCount) return;
152
+ this.#nbsp = !this.#nbsp;
153
+ this.#suggestionCount.textContent = this.announce(count) + (this.#nbsp ? "\xA0" : "");
154
+ }
155
+ /**
156
+ * Close only when focus leaves the host. Some assistive technology
157
+ * focuses a Suggestion before it sends the click that selects it.
158
+ */
159
+ #onfocusout(evt) {
160
+ const next = evt.relatedTarget;
161
+ if (next instanceof Node && this.contains(next)) return;
133
162
  this.#clear();
134
163
  }
135
- #onpointerup(evt) {
136
- this.#pressed = false;
164
+ #onclick(evt) {
137
165
  const option = evt.target instanceof Element ? evt.target.closest('[role="option"]') : null;
138
- if (!option) {
139
- this.qs("input")?.focus();
140
- return;
141
- }
166
+ if (!option) return;
142
167
  this.#select(Number(option.dataset.index));
143
168
  }
144
169
  #select(index) {
@@ -167,24 +192,32 @@ class ActorTypeahead extends WebComponent.create("actor-typeahead") {
167
192
  this.render();
168
193
  }
169
194
  /**
170
- * Render into light DOM, next to the authored `<input>`. Only the
171
- * Suggestion list is rebuilt, so the input element, and anything the
172
- * consumer attached to it, is never replaced. On the input, only the
195
+ * Render into light DOM. Only the suggestion list is rebuilt,
196
+ * so the input element, and anything the consumer attached to it,
197
+ * is never replaced. On the input, only the
173
198
  * ARIA combobox attributes are written, plus `autocomplete="off"`
174
199
  * when the page did not set `autocomplete`.
175
200
  */
176
201
  render() {
177
202
  if (!this.#suggestionList) {
178
- this.#suggestionList = document.createElement("ul");
203
+ this.#suggestionList = document.createElement("div");
179
204
  this.#suggestionList.className = "suggestion-list";
180
205
  this.#suggestionList.id = `${this.#id}-list`;
181
206
  this.#suggestionList.setAttribute("role", "listbox");
182
207
  if (ANCHORED) this.#suggestionList.popover = "manual";
183
- this.#suggestionList.addEventListener("pointerdown", this);
184
- this.#suggestionList.addEventListener("pointerup", this);
208
+ this.#suggestionList.addEventListener("mousedown", this);
209
+ this.#suggestionList.addEventListener("click", this);
185
210
  }
186
211
  const list = this.#suggestionList;
187
212
  if (list.parentNode !== this) this.append(list);
213
+ if (!this.#suggestionCount) {
214
+ this.#suggestionCount = document.createElement("div");
215
+ this.#suggestionCount.className = "suggestion-count";
216
+ this.#suggestionCount.setAttribute("role", "status");
217
+ }
218
+ const count = this.#suggestionCount;
219
+ if (count.parentNode !== this) this.append(count);
220
+ if (!this.#actors.length) count.textContent = "";
188
221
  list.replaceChildren(...this.#actors.map((actor, i) => {
189
222
  const option = suggestion(actor, i, i === this.#index);
190
223
  option.id = this.#optionId(i);
@@ -200,11 +233,11 @@ class ActorTypeahead extends WebComponent.create("actor-typeahead") {
200
233
  }
201
234
  input.setAttribute("aria-controls", list.id);
202
235
  input.setAttribute("aria-expanded", String(open));
203
- const labels = [...input.labels ?? []].map((label) => label.id).filter(Boolean);
204
- if (labels.length) {
205
- list.setAttribute("aria-labelledby", labels.join(" "));
206
- } else {
207
- list.removeAttribute("aria-labelledby");
236
+ const name = nameSource(input, this);
237
+ for (const attr of ["aria-labelledby", "aria-label"]) {
238
+ const value = name[attr];
239
+ if (value) list.setAttribute(attr, value);
240
+ else list.removeAttribute(attr);
208
241
  }
209
242
  if (this.#actors[this.#index]) {
210
243
  input.setAttribute(
@@ -236,12 +269,14 @@ class ActorTypeahead extends WebComponent.create("actor-typeahead") {
236
269
  }
237
270
  ActorTypeahead.define();
238
271
  function suggestion(actor, index, active) {
239
- const li = document.createElement("li");
240
- li.className = "suggestion";
241
- li.setAttribute("role", "option");
242
- li.setAttribute("aria-selected", String(active));
243
- li.dataset.index = String(index);
244
- li.dataset.handle = actor.handle;
272
+ const button = document.createElement("button");
273
+ button.type = "button";
274
+ button.tabIndex = -1;
275
+ button.className = "suggestion";
276
+ button.setAttribute("role", "option");
277
+ button.setAttribute("aria-selected", String(active));
278
+ button.dataset.index = String(index);
279
+ button.dataset.handle = actor.handle;
245
280
  const avatar = document.createElement("div");
246
281
  avatar.className = "avatar";
247
282
  const img = document.createElement("img");
@@ -252,10 +287,40 @@ function suggestion(actor, index, active) {
252
287
  handle.className = "handle";
253
288
  handle.textContent = actor.handle;
254
289
  avatar.append(img);
255
- li.append(avatar, handle);
256
- return li;
290
+ button.append(avatar, handle);
291
+ return button;
257
292
  }
258
293
  __name(suggestion, "suggestion");
294
+ function nameSource(input, host) {
295
+ const labelledby = input.getAttribute("aria-labelledby");
296
+ if (labelledby) return { "aria-labelledby": labelledby };
297
+ const label = input.getAttribute("aria-label");
298
+ if (label) return { "aria-label": label };
299
+ const labels = [...input.labels ?? []];
300
+ if (!labels.length) return {};
301
+ if (labels.every((label2) => label2.id)) {
302
+ return {
303
+ "aria-labelledby": labels.map((label2) => label2.id).join(" ")
304
+ };
305
+ }
306
+ const text = labels.map((label2) => labelText(label2, host).trim()).filter(Boolean).join(" ");
307
+ return text ? { "aria-label": text } : {};
308
+ }
309
+ __name(nameSource, "nameSource");
310
+ function labelText(label, host) {
311
+ const walker = document.createTreeWalker(label, NodeFilter.SHOW_TEXT, {
312
+ acceptNode: /* @__PURE__ */ __name((node) => host.contains(node) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT, "acceptNode")
313
+ });
314
+ let text = "";
315
+ while (walker.nextNode()) text += walker.currentNode.nodeValue;
316
+ return text;
317
+ }
318
+ __name(labelText, "labelText");
319
+ function defaultAnnounce(count) {
320
+ if (count === 0) return "No Suggestions";
321
+ return count === 1 ? "1 Suggestion available" : `${count} Suggestions available`;
322
+ }
323
+ __name(defaultAnnounce, "defaultAnnounce");
259
324
  function parseActors(json) {
260
325
  if (!isRecord(json) || !Array.isArray(json.actors)) return [];
261
326
  return json.actors.flatMap((actor) => {
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n *\n * Copyright (c) 2026 Jake Lazaroff\n *\n * Repository: https://tangled.org/jakelazaroff.com/actor-typeahead\n */\n\nimport { WebComponent } from '@substrate-system/web-component'\n\n// for document.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'actor-typeahead':ActorTypeahead\n }\n}\n\nexport interface Actor {\n handle:string;\n avatar?:string;\n}\n\nconst DEFAULT_HOST = 'https://public.api.bsky.app'\nconst DEFAULT_ROWS = 5\n\n// how long the Query must stay unchanged before a Typeahead request\nconst DEBOUNCE_MS = 150\n\n// The Suggestion list is a top-layer popover, positioned against the host\n// with CSS anchor positioning. `anchor-scope` shipped last of that set, so\n// it gates the group. Without it, the old absolute layout is used.\nconst ANCHORED = typeof CSS !== 'undefined' &&\n CSS.supports('anchor-scope: --a')\n\n// counts instances, so each one gets unique element ids\nlet instances = 0\n\n/**\n * @attribute {string} [host] - The host to which to make the typeahead\n * API call.\n * @attribute {number} [rows] - The maximum number of Suggestions to\n * display in the Suggestion list.\n *\n * @fires actor-typeahead:select - A Suggestion was chosen from the\n * Suggestion list. The event `detail` is `{ handle, avatar }`.\n *\n * @cssprop --color-background - Controls the color of the Suggestion list\n * background.\n * @cssprop --color-border - Controls the color of the Suggestion list\n * border.\n * @cssprop --color-shadow - Controls the color of the Suggestion list\n * shadow.\n * @cssprop --color-hover - Controls the background color of each\n * Suggestion on hover.\n * @cssprop --color-avatar-fallback - Controls the background color of an\n * avatar circle if the image fails to load.\n * @cssprop --radius - Controls the corner radius of the Suggestion list.\n * @cssprop --padding-suggestion-list - Controls the padding of the\n * Suggestion list.\n *\n * @summary A small web component that progressively enhances an <input>\n * element into an autocomplete for ATProto handles.\n *\n * @tag actor-typeahead\n */\nexport class ActorTypeahead extends WebComponent.create('actor-typeahead') {\n static reflectedStringAttributes = ['host', 'rows']\n\n declare host:string|null\n declare rows:string|null\n\n #id = `actor-typeahead-${++instances}`\n #actors:Actor[] = []\n #index = -1\n #pressed = false\n #suggestionList:HTMLUListElement|null = null\n #timer:ReturnType<typeof setTimeout>|undefined\n #controller:AbortController|null = null\n\n constructor () {\n super()\n this.addEventListener('input', this)\n this.addEventListener('focusout', this)\n this.addEventListener('keydown', this)\n }\n\n /**\n * Stop any pending Typeahead request. The Suggestion list is left as\n * is; the next Query rebuilds it.\n */\n disconnectedCallback () {\n this.#cancel()\n }\n\n get #limit ():number {\n const rows = Number.parseInt(this.rows ?? '')\n return Number.isNaN(rows) ? DEFAULT_ROWS : rows\n }\n\n handleEvent (evt:Event) {\n switch (evt.type) {\n case 'input':\n this.#oninput(evt)\n break\n\n case 'keydown':\n if (evt instanceof KeyboardEvent) this.#onkeydown(evt)\n break\n\n case 'focusout':\n this.#onfocusout()\n break\n\n case 'pointerdown':\n this.#pressed = true\n break\n\n case 'pointerup':\n this.#onpointerup(evt)\n break\n }\n }\n\n #onkeydown (evt:KeyboardEvent) {\n const last = this.#actors.length - 1\n\n switch (evt.key) {\n case 'ArrowDown':\n evt.preventDefault()\n this.#index = Math.min(this.#index + 1, last)\n this.render()\n break\n\n case 'PageDown':\n evt.preventDefault()\n this.#index = last\n this.render()\n break\n\n case 'ArrowUp':\n evt.preventDefault()\n this.#index = Math.max(this.#index - 1, 0)\n this.render()\n break\n\n case 'PageUp':\n evt.preventDefault()\n this.#index = 0\n this.render()\n break\n\n case 'Escape':\n // with the list closed, let a dialog close; still cancel\n // any pending Typeahead request\n if (this.#actors.length) evt.preventDefault()\n this.#clear()\n break\n\n case 'Enter':\n // with nothing Highlighted, let the form submit, and\n // drop any pending Typeahead request\n if (!this.#actors[this.#index]) {\n this.#cancel()\n break\n }\n evt.preventDefault()\n this.#select(this.#index)\n break\n }\n }\n\n #oninput (evt:Event) {\n if (!(evt.target instanceof HTMLInputElement)) return\n\n const query = evt.target.value\n if (!query) {\n this.#clear()\n return\n }\n\n // keep the current Suggestions on screen until the new response\n this.#cancel()\n this.#timer = setTimeout(() => this.#request(query), DEBOUNCE_MS)\n }\n\n async #request (query:string) {\n this.#timer = undefined\n const url = new URL(\n 'xrpc/app.bsky.actor.searchActorsTypeahead',\n this.host ?? DEFAULT_HOST\n )\n url.searchParams.set('q', query)\n url.searchParams.set('limit', String(this.#limit))\n\n const controller = new AbortController()\n this.#controller = controller\n const { signal } = controller\n\n let json:unknown\n try {\n const res = await fetch(url, { signal })\n if (signal.aborted) return\n if (!res.ok) throw new Error(`status ${res.status}`)\n json = await res.json()\n } catch (err) {\n // a newer Query, or a close, cancelled this request\n if (isAbortError(err)) return\n // any other failure closes the Suggestion list, quietly\n this.#clear()\n return\n }\n if (signal.aborted) return\n\n this.#actors = parseActors(json)\n this.#index = -1\n this.render()\n }\n\n #onfocusout () {\n if (this.#pressed) return\n this.#clear()\n }\n\n #onpointerup (evt:Event) {\n this.#pressed = false\n\n const option = evt.target instanceof Element ?\n evt.target.closest<HTMLElement>('[role=\"option\"]') :\n null\n\n if (!option) {\n this.qs('input')?.focus()\n return\n }\n\n this.#select(Number(option.dataset.index))\n }\n\n #select (index:number) {\n const actor = this.#actors[index]\n const input = this.qs('input')\n if (!actor || !input) return\n\n input.value = actor.handle\n input.focus()\n this.#clear()\n this.emit<Actor>('select', { detail: actor })\n }\n\n /**\n * Stop any pending Typeahead request: the debounce timer, and the\n * request in flight, whose response is then dropped.\n */\n #cancel () {\n clearTimeout(this.#timer)\n this.#timer = undefined\n this.#controller?.abort()\n this.#controller = null\n }\n\n #clear () {\n this.#cancel()\n this.#actors = []\n this.#index = -1\n this.render()\n }\n\n /**\n * Render into light DOM, next to the authored `<input>`. Only the\n * Suggestion list is rebuilt, so the input element, and anything the\n * consumer attached to it, is never replaced. On the input, only the\n * ARIA combobox attributes are written, plus `autocomplete=\"off\"`\n * when the page did not set `autocomplete`.\n */\n render () {\n if (!this.#suggestionList) {\n this.#suggestionList = document.createElement('ul')\n this.#suggestionList.className = 'suggestion-list'\n this.#suggestionList.id = `${this.#id}-list`\n this.#suggestionList.setAttribute('role', 'listbox')\n if (ANCHORED) this.#suggestionList.popover = 'manual'\n this.#suggestionList.addEventListener('pointerdown', this)\n this.#suggestionList.addEventListener('pointerup', this)\n }\n\n const list = this.#suggestionList\n if (list.parentNode !== this) this.append(list)\n\n list.replaceChildren(...this.#actors.map((actor, i) => {\n const option = suggestion(actor, i, i === this.#index)\n option.id = this.#optionId(i)\n return option\n }))\n\n const open = this.#toggle(list, this.#actors.length > 0)\n\n const input = this.qs('input')\n if (input) {\n input.setAttribute('role', 'combobox')\n input.setAttribute('aria-autocomplete', 'list')\n if (!input.hasAttribute('autocomplete')) {\n input.setAttribute('autocomplete', 'off')\n }\n input.setAttribute('aria-controls', list.id)\n input.setAttribute('aria-expanded', String(open))\n\n const labels = [...(input.labels ?? [])]\n .map(label => label.id)\n .filter(Boolean)\n if (labels.length) {\n list.setAttribute('aria-labelledby', labels.join(' '))\n } else {\n list.removeAttribute('aria-labelledby')\n }\n\n if (this.#actors[this.#index]) {\n input.setAttribute(\n 'aria-activedescendant',\n this.#optionId(this.#index)\n )\n } else {\n input.removeAttribute('aria-activedescendant')\n }\n }\n }\n\n /**\n * Show or hide the Suggestion list popover, guarded on its current\n * state so repeated renders neither throw nor toggle. A disconnected\n * popover cannot be shown, e.g. when a response arrives after the host\n * was removed. Returns whether the Suggestion list is open.\n */\n #toggle (list:HTMLElement, open:boolean):boolean {\n if (!ANCHORED) return open\n if (!list.isConnected) return false\n\n const isOpen = list.matches(':popover-open')\n if (open && !isOpen) list.showPopover()\n if (!open && isOpen) list.hidePopover()\n return list.matches(':popover-open')\n }\n\n #optionId (index:number):string {\n return `${this.#id}-option-${index}`\n }\n}\n\nActorTypeahead.define()\n\n/**\n * Build one Suggestion. Values from the API go through `textContent` and\n * properties, never through `innerHTML`.\n */\nfunction suggestion (\n actor:Actor,\n index:number,\n active:boolean\n):HTMLLIElement {\n const li = document.createElement('li')\n li.className = 'suggestion'\n li.setAttribute('role', 'option')\n li.setAttribute('aria-selected', String(active))\n li.dataset.index = String(index)\n li.dataset.handle = actor.handle\n\n const avatar = document.createElement('div')\n avatar.className = 'avatar'\n\n const img = document.createElement('img')\n img.className = 'img'\n img.alt = ''\n if (actor.avatar) img.src = actor.avatar\n\n const handle = document.createElement('span')\n handle.className = 'handle'\n handle.textContent = actor.handle\n\n avatar.append(img)\n li.append(avatar, handle)\n\n return li\n}\n\nfunction parseActors (json:unknown):Actor[] {\n if (!isRecord(json) || !Array.isArray(json.actors)) return []\n\n return json.actors.flatMap((actor:unknown) => {\n if (!isRecord(actor) || typeof actor.handle !== 'string') return []\n\n return [typeof actor.avatar === 'string' ?\n { handle: actor.handle, avatar: actor.avatar } :\n { handle: actor.handle }]\n })\n}\n\nfunction isAbortError (err:unknown):boolean {\n return err instanceof DOMException && err.name === 'AbortError'\n}\n\nfunction isRecord (value:unknown):value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n"],
5
- "mappings": ";;AASA,SAAS,oBAAoB;AAc7B,MAAM,eAAe;AACrB,MAAM,eAAe;AAGrB,MAAM,cAAc;AAKpB,MAAM,WAAW,OAAO,QAAQ,eAC5B,IAAI,SAAS,mBAAmB;AAGpC,IAAI,YAAY;AA8BT,MAAM,uBAAuB,aAAa,OAAO,iBAAiB,EAAE;AAAA,EAlE3E,OAkE2E;AAAA;AAAA;AAAA,EACvE,OAAO,4BAA4B,CAAC,QAAQ,MAAM;AAAA,EAKlD,MAAM,mBAAmB,EAAE,SAAS;AAAA,EACpC,UAAkB,CAAC;AAAA,EACnB,SAAS;AAAA,EACT,WAAW;AAAA,EACX,kBAAwC;AAAA,E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 "sourcesContent": ["/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n *\n * Copyright (c) 2026 Jake Lazaroff\n *\n * Repository: https://tangled.org/jakelazaroff.com/actor-typeahead\n */\n\nimport { WebComponent } from '@substrate-system/web-component'\n\n// for document.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'actor-typeahead':ActorTypeahead\n }\n}\n\nexport interface Actor {\n handle:string;\n avatar?:string;\n}\n\nconst DEFAULT_HOST = 'https://public.api.bsky.app'\nconst DEFAULT_ROWS = 5\n\n// how long the Query must stay unchanged before a Typeahead request\nconst DEBOUNCE_MS = 150\n\n// The Suggestion list is a top-layer popover, positioned against the host\n// with CSS anchor positioning. `anchor-scope` shipped last of that set, so\n// it gates the group. Without it, the old absolute layout is used.\nconst ANCHORED = typeof CSS !== 'undefined' &&\n CSS.supports('anchor-scope: --a')\n\n// counts instances, so each one gets unique element ids\nlet instances = 0\n\n/**\n * @attribute {string} [host] - The host to which to make the typeahead\n * API call.\n * @attribute {number} [rows] - The maximum number of Suggestions to\n * display in the Suggestion list.\n *\n * @fires actor-typeahead:select - A Suggestion was chosen from the\n * Suggestion list. The event `detail` is `{ handle, avatar }`.\n *\n * @cssprop --color-background - Controls the color of the Suggestion list\n * background.\n * @cssprop --color-border - Controls the color of the Suggestion list\n * border.\n * @cssprop --color-shadow - Controls the color of the Suggestion list\n * shadow.\n * @cssprop --color-hover - Controls the background color of each\n * Suggestion on hover.\n * @cssprop --color-avatar-fallback - Controls the background color of an\n * avatar circle if the image fails to load.\n * @cssprop --radius - Controls the corner radius of the Suggestion list.\n * @cssprop --padding-suggestion-list - Controls the padding of the\n * Suggestion list.\n *\n * @summary A small web component that progressively enhances an <input>\n * element into an autocomplete for ATProto handles.\n *\n * @tag actor-typeahead\n */\nexport class ActorTypeahead extends WebComponent.create('actor-typeahead') {\n static reflectedStringAttributes = ['host', 'rows']\n\n declare host:string|null\n declare rows:string|null\n\n /**\n * Returns the text announced when a Typeahead request settles with\n * `count` Suggestions, including 0 when nothing matched the Query.\n * Defaults to English. Replace it to translate; the replacement\n * handles plurals and 0. Read at announce time, so it can be set\n * after connect.\n */\n announce:(count:number) => string = defaultAnnounce\n\n #id = `actor-typeahead-${++instances}`\n #actors:Actor[] = []\n #index = -1\n #suggestionList:HTMLDivElement|null = null\n #suggestionCount:HTMLDivElement|null = null\n #nbsp = false\n #timer:ReturnType<typeof setTimeout>|undefined\n #controller:AbortController|null = null\n\n constructor () {\n super()\n this.addEventListener('input', this)\n this.addEventListener('focusout', this)\n this.addEventListener('keydown', this)\n }\n\n /**\n * Stop any pending Typeahead request. The Suggestion list is left as\n * is; the next Query rebuilds it.\n */\n disconnectedCallback () {\n this.#cancel()\n }\n\n get #limit ():number {\n const rows = Number.parseInt(this.rows ?? '')\n return Number.isNaN(rows) ? DEFAULT_ROWS : rows\n }\n\n handleEvent (evt:Event) {\n switch (evt.type) {\n case 'input':\n this.#oninput(evt)\n break\n\n case 'keydown':\n if (evt instanceof KeyboardEvent) this.#onkeydown(evt)\n break\n\n case 'focusout':\n if (evt instanceof FocusEvent) this.#onfocusout(evt)\n break\n\n case 'mousedown':\n // a press or a tap keeps focus on the Authored input\n evt.preventDefault()\n break\n\n case 'click':\n this.#onclick(evt)\n break\n }\n }\n\n #onkeydown (evt:KeyboardEvent) {\n const last = this.#actors.length - 1\n const moves = ['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp']\n // with no Suggestions there is nothing to move to, and a render\n // would empty a \"No Suggestions\" announcement\n if (last < 0 && moves.includes(evt.key)) {\n evt.preventDefault()\n return\n }\n\n switch (evt.key) {\n case 'ArrowDown':\n evt.preventDefault()\n this.#index = Math.min(this.#index + 1, last)\n this.render()\n break\n\n case 'PageDown':\n evt.preventDefault()\n this.#index = last\n this.render()\n break\n\n case 'ArrowUp':\n evt.preventDefault()\n // wrap from nothing Highlighted to the last Suggestion,\n // and from the first back to nothing (the APG pattern)\n this.#index = this.#index < 0 ? last : this.#index - 1\n this.render()\n break\n\n case 'PageUp':\n evt.preventDefault()\n this.#index = 0\n this.render()\n break\n\n case 'Escape':\n // with the list closed, let a dialog close; still cancel\n // any pending Typeahead request\n if (this.#actors.length) evt.preventDefault()\n this.#clear()\n break\n\n case 'Enter':\n // with nothing Highlighted, let the form submit, and\n // drop any pending Typeahead request\n if (!this.#actors[this.#index]) {\n this.#cancel()\n break\n }\n evt.preventDefault()\n this.#select(this.#index)\n break\n }\n }\n\n #oninput (evt:Event) {\n if (!(evt.target instanceof HTMLInputElement)) return\n\n const query = evt.target.value\n if (!query) {\n this.#clear()\n return\n }\n\n // keep the current Suggestions on screen until the new response\n this.#cancel()\n this.#timer = setTimeout(() => this.#request(query), DEBOUNCE_MS)\n }\n\n async #request (query:string) {\n this.#timer = undefined\n const url = new URL(\n 'xrpc/app.bsky.actor.searchActorsTypeahead',\n this.host ?? DEFAULT_HOST\n )\n url.searchParams.set('q', query)\n url.searchParams.set('limit', String(this.#limit))\n\n const controller = new AbortController()\n this.#controller = controller\n const { signal } = controller\n\n let json:unknown\n try {\n const res = await fetch(url, { signal })\n if (signal.aborted) return\n if (!res.ok) throw new Error(`status ${res.status}`)\n json = await res.json()\n } catch (err) {\n // a newer Query, or a close, cancelled this request\n if (isAbortError(err)) return\n // any other failure closes the Suggestion list, quietly\n this.#clear()\n return\n }\n if (signal.aborted) return\n\n this.#actors = parseActors(json)\n this.#index = -1\n // after render(), which empties the count when there are none\n this.render()\n this.#announce(this.#actors.length)\n }\n\n /**\n * Write the Suggestion count. A trailing no-break space alternates\n * between writes, so screen readers re-read an identical count.\n */\n #announce (count:number) {\n if (!this.#suggestionCount) return\n this.#nbsp = !this.#nbsp\n this.#suggestionCount.textContent = this.announce(count) +\n (this.#nbsp ? '\\u00a0' : '')\n }\n\n /**\n * Close only when focus leaves the host. Some assistive technology\n * focuses a Suggestion before it sends the click that selects it.\n */\n #onfocusout (evt:FocusEvent) {\n const next = evt.relatedTarget\n if (next instanceof Node && this.contains(next)) return\n this.#clear()\n }\n\n #onclick (evt:Event) {\n const option = evt.target instanceof Element ?\n evt.target.closest<HTMLElement>('[role=\"option\"]') :\n null\n if (!option) return\n\n this.#select(Number(option.dataset.index))\n }\n\n #select (index:number) {\n const actor = this.#actors[index]\n const input = this.qs('input')\n if (!actor || !input) return\n\n input.value = actor.handle\n input.focus()\n this.#clear()\n this.emit<Actor>('select', { detail: actor })\n }\n\n /**\n * Stop any pending Typeahead request: the debounce timer, and the\n * request in flight, whose response is then dropped.\n */\n #cancel () {\n clearTimeout(this.#timer)\n this.#timer = undefined\n this.#controller?.abort()\n this.#controller = null\n }\n\n #clear () {\n this.#cancel()\n this.#actors = []\n this.#index = -1\n this.render()\n }\n\n /**\n * Render into light DOM. Only the suggestion list is rebuilt,\n * so the input element, and anything the consumer attached to it,\n * is never replaced. On the input, only the\n * ARIA combobox attributes are written, plus `autocomplete=\"off\"`\n * when the page did not set `autocomplete`.\n */\n render () {\n if (!this.#suggestionList) {\n this.#suggestionList = document.createElement('div')\n this.#suggestionList.className = 'suggestion-list'\n this.#suggestionList.id = `${this.#id}-list`\n this.#suggestionList.setAttribute('role', 'listbox')\n if (ANCHORED) this.#suggestionList.popover = 'manual'\n this.#suggestionList.addEventListener('mousedown', this)\n this.#suggestionList.addEventListener('click', this)\n }\n\n const list = this.#suggestionList\n if (list.parentNode !== this) this.append(list)\n\n // the live region exists empty before its first write, because\n // screen readers often skip a region inserted already filled\n if (!this.#suggestionCount) {\n this.#suggestionCount = document.createElement('div')\n this.#suggestionCount.className = 'suggestion-count'\n this.#suggestionCount.setAttribute('role', 'status')\n }\n const count = this.#suggestionCount\n if (count.parentNode !== this) this.append(count)\n // only a response writes the count; any close empties it, and a\n // response with no Suggestions writes it after this render\n if (!this.#actors.length) count.textContent = ''\n\n list.replaceChildren(...this.#actors.map((actor, i) => {\n const option = suggestion(actor, i, i === this.#index)\n option.id = this.#optionId(i)\n return option\n }))\n\n const open = this.#toggle(list, this.#actors.length > 0)\n\n const input = this.qs('input')\n if (input) {\n input.setAttribute('role', 'combobox')\n input.setAttribute('aria-autocomplete', 'list')\n if (!input.hasAttribute('autocomplete')) {\n input.setAttribute('autocomplete', 'off')\n }\n input.setAttribute('aria-controls', list.id)\n input.setAttribute('aria-expanded', String(open))\n\n // the Suggestion list carries at most one of the two\n const name = nameSource(input, this)\n for (const attr of ['aria-labelledby', 'aria-label'] as const) {\n const value = name[attr]\n if (value) list.setAttribute(attr, value)\n else list.removeAttribute(attr)\n }\n\n if (this.#actors[this.#index]) {\n input.setAttribute(\n 'aria-activedescendant',\n this.#optionId(this.#index)\n )\n } else {\n input.removeAttribute('aria-activedescendant')\n }\n }\n }\n\n /**\n * Show or hide the Suggestion list popover, guarded on its current\n * state so repeated renders neither throw nor toggle. A disconnected\n * popover cannot be shown, e.g. when a response arrives after the host\n * was removed. Returns whether the Suggestion list is open.\n */\n #toggle (list:HTMLElement, open:boolean):boolean {\n if (!ANCHORED) return open\n if (!list.isConnected) return false\n\n const isOpen = list.matches(':popover-open')\n if (open && !isOpen) list.showPopover()\n if (!open && isOpen) list.hidePopover()\n return list.matches(':popover-open')\n }\n\n #optionId (index:number):string {\n return `${this.#id}-option-${index}`\n }\n}\n\nActorTypeahead.define()\n\n/**\n * Build one Suggestion. Values from the API go through `textContent` and\n * properties, never through `innerHTML`.\n */\nfunction suggestion (\n actor:Actor,\n index:number,\n active:boolean\n):HTMLButtonElement {\n const button = document.createElement('button')\n // a button, so every input method can activate it, but not a\n // submit button, and out of the tab order, because focus stays on\n // the Authored input\n button.type = 'button'\n button.tabIndex = -1\n button.className = 'suggestion'\n button.setAttribute('role', 'option')\n button.setAttribute('aria-selected', String(active))\n button.dataset.index = String(index)\n button.dataset.handle = actor.handle\n\n const avatar = document.createElement('div')\n avatar.className = 'avatar'\n\n const img = document.createElement('img')\n img.className = 'img'\n img.alt = ''\n if (actor.avatar) img.src = actor.avatar\n\n const handle = document.createElement('span')\n handle.className = 'handle'\n handle.textContent = actor.handle\n\n avatar.append(img)\n button.append(avatar, handle)\n\n return button\n}\n\n/**\n * What names the Authored input, in the order of accessible name\n * computation, as the attribute the Suggestion list copies it to.\n */\nfunction nameSource (input:HTMLInputElement, host:HTMLElement):{\n 'aria-labelledby'?:string;\n 'aria-label'?:string;\n} {\n const labelledby = input.getAttribute('aria-labelledby')\n if (labelledby) return { 'aria-labelledby': labelledby }\n\n const label = input.getAttribute('aria-label')\n if (label) return { 'aria-label': label }\n\n // reference the labels when they all have ids, otherwise copy their\n // text, because the component never writes ids onto the page\n const labels = [...(input.labels ?? [])]\n if (!labels.length) return {}\n if (labels.every(label => label.id)) {\n return {\n 'aria-labelledby': labels.map(label => label.id).join(' ')\n }\n }\n\n const text = labels\n .map(label => labelText(label, host).trim())\n .filter(Boolean)\n .join(' ')\n return text ? { 'aria-label': text } : {}\n}\n\n/**\n * The text of a label, without the Host element's content, which a\n * label that wraps the Host element would otherwise include.\n */\nfunction labelText (label:HTMLLabelElement, host:HTMLElement):string {\n const walker = document.createTreeWalker(label, NodeFilter.SHOW_TEXT, {\n acceptNode: node => host.contains(node) ?\n NodeFilter.FILTER_REJECT :\n NodeFilter.FILTER_ACCEPT\n })\n\n let text = ''\n while (walker.nextNode()) text += walker.currentNode.nodeValue\n return text\n}\n\n/**\n * The default English Suggestion count announcement.\n */\nfunction defaultAnnounce (count:number):string {\n if (count === 0) return 'No Suggestions'\n return count === 1 ?\n '1 Suggestion available' :\n `${count} Suggestions available`\n}\n\nfunction parseActors (json:unknown):Actor[] {\n if (!isRecord(json) || !Array.isArray(json.actors)) return []\n\n return json.actors.flatMap((actor:unknown) => {\n if (!isRecord(actor) || typeof actor.handle !== 'string') return []\n\n return [typeof actor.avatar === 'string' ?\n { handle: actor.handle, avatar: actor.avatar } :\n { handle: actor.handle }]\n })\n}\n\nfunction isAbortError (err:unknown):boolean {\n return err instanceof DOMException && err.name === 'AbortError'\n}\n\nfunction isRecord (value:unknown):value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EAC1C,OAAO,OAAO,EACd,KAAK,GAAG;AACb,SAAO,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;AAC5C;AAzBS;AA+BT,SAAS,UAAW,OAAwB,MAAyB;AACjE,QAAM,SAAS,SAAS,iBAAiB,OAAO,WAAW,WAAW;AAAA,IAClE,YAAY,iCAAQ,KAAK,SAAS,IAAI,IAClC,WAAW,gBACX,WAAW,eAFH;AAAA,EAGhB,CAAC;AAED,MAAI,OAAO;AACX,SAAO,OAAO,SAAS,EAAG,SAAQ,OAAO,YAAY;AACrD,SAAO;AACX;AAVS;AAeT,SAAS,gBAAiB,OAAqB;AAC3C,MAAI,UAAU,EAAG,QAAO;AACxB,SAAO,UAAU,IACb,2BACA,GAAG,KAAK;AAChB;AALS;AAOT,SAAS,YAAa,MAAsB;AACxC,MAAI,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,QAAQ,KAAK,MAAM,EAAG,QAAO,CAAC;AAE5D,SAAO,KAAK,OAAO,QAAQ,CAAC,UAAkB;AAC1C,QAAI,CAAC,SAAS,KAAK,KAAK,OAAO,MAAM,WAAW,SAAU,QAAO,CAAC;AAElE,WAAO,CAAC,OAAO,MAAM,WAAW,WAC5B,EAAE,QAAQ,MAAM,QAAQ,QAAQ,MAAM,OAAO,IAC7C,EAAE,QAAQ,MAAM,OAAO,CAAC;AAAA,EAChC,CAAC;AACL;AAVS;AAYT,SAAS,aAAc,KAAqB;AACxC,SAAO,eAAe,gBAAgB,IAAI,SAAS;AACvD;AAFS;AAIT,SAAS,SAAU,OAAgD;AAC/D,SAAO,OAAO,UAAU,YAAY,UAAU;AAClD;AAFS;",
6
+ "names": ["label"]
7
7
  }
@@ -1 +1 @@
1
- actor-typeahead{--color-background-inherited:var(--color-background,#fff);--color-border-inherited:var(--color-border,#0002);--color-shadow-inherited:var(--color-shadow,#000);--color-hover-inherited:var(--color-hover,#0001);--color-avatar-fallback-inherited:var(--color-avatar-fallback,#0002);--radius-inherited:var(--radius,8px);--padding-suggestion-list-inherited:var(--padding-suggestion-list,4px);anchor-name:--actor-typeahead;anchor-scope:--actor-typeahead;font-family:system-ui;display:block;position:relative;& .suggestion-list,& .suggestion-list *,& .suggestion-list :before,& .suggestion-list :after{box-sizing:border-box;margin:0;padding:0}& .suggestion-list{background-color:var(--color-background-inherited);border:1px solid var(--color-border-inherited);border-radius:var(--radius-inherited);width:100%;box-shadow:0 6px 6px -4px rgb(from var(--color-shadow-inherited) r g b / 20%);padding:var(--padding-suggestion-list-inherited);background-clip:padding-box;flex-direction:column;margin-top:4px;list-style:none;display:flex;position:absolute;left:0;overflow:hidden;&:empty{display:none}&[popover]{position-anchor:--actor-typeahead;position-try-fallbacks:flip-block;inset:auto;top:anchor(bottom);left:anchor(left);margin:0;width:anchor-size(width);color:inherit;margin-block-start:4px;position:fixed;&:not(:popover-open){display:none}}}& .suggestion{all:unset;box-sizing:border-box;border-radius:calc(var(--radius-inherited) - var(--padding-suggestion-list-inherited));cursor:default;align-items:center;gap:8px;width:100%;height:calc(1.5rem + 12px);padding:6px 8px;display:flex;&:hover,&[aria-selected=true]{background-color:var(--color-hover-inherited)}}& .avatar{background-color:var(--color-avatar-fallback-inherited);border-radius:50%;flex-shrink:0;width:1.5rem;height:1.5rem;overflow:hidden}& .img{width:100%;height:100%;display:block}& .handle{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}}actor-typeahead:not(:defined){display:none}
1
+ actor-typeahead{--color-background-inherited:var(--color-background,#fff);--color-border-inherited:var(--color-border,#0007);--color-shadow-inherited:var(--color-shadow,#000);--color-hover-inherited:var(--color-hover,#0001);--color-avatar-fallback-inherited:var(--color-avatar-fallback,#0002);--radius-inherited:var(--radius,8px);--padding-suggestion-list-inherited:var(--padding-suggestion-list,4px);anchor-name:--actor-typeahead;anchor-scope:--actor-typeahead;font-family:system-ui;display:block;position:relative;& .suggestion-list,& .suggestion-list *,& .suggestion-list :before,& .suggestion-list :after{box-sizing:border-box;margin:0;padding:0}& .suggestion-list{background-color:var(--color-background-inherited);border:1px solid var(--color-border-inherited);border-radius:var(--radius-inherited);width:100%;box-shadow:0 6px 6px -4px rgb(from var(--color-shadow-inherited) r g b / 20%);padding:var(--padding-suggestion-list-inherited);background-clip:padding-box;flex-direction:column;margin-top:4px;display:flex;position:absolute;left:0;overflow:hidden;&:empty{display:none}&[popover]{position-anchor:--actor-typeahead;position-try-fallbacks:flip-block;inset:auto;top:anchor(bottom);left:anchor(left);margin:0;width:anchor-size(width);color:inherit;margin-block-start:4px;position:fixed;&:not(:popover-open){display:none}}}& .suggestion-count{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}& .suggestion{all:unset;box-sizing:border-box;border-radius:calc(var(--radius-inherited) - var(--padding-suggestion-list-inherited));cursor:default;align-items:center;gap:8px;width:100%;height:calc(1.5rem + 12px);padding:6px 8px;display:flex;&:hover,&[aria-selected=true]{background-color:var(--color-hover-inherited)}&[aria-selected=true]{outline-offset:-2px;outline:2px solid}@media (forced-colors:active){&[aria-selected=true]{forced-color-adjust:none;color:highlighttext;background-color:highlight}}}& .avatar{background-color:var(--color-avatar-fallback-inherited);border-radius:50%;flex-shrink:0;width:1.5rem;height:1.5rem;overflow:hidden}& .img{width:100%;height:100%;display:block}& .handle{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}}actor-typeahead:not(:defined){display:none}
package/dist/index.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var T=Object.defineProperty;var s=(e,t)=>T(e,"name",{value:t,configurable:!0});var k=Object.defineProperty,L=s((e,t)=>k(e,"name",{value:t,configurable:!0}),"__name");function p(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r?typeof r=="boolean"?r?(t+` ${n}`).trim():t:Array.isArray(r)?t+` ${n}="${r.join(" ")}"`:(t+` ${n}="${r}"`).trim():t},"")}s(p,"toAttributes");L(p,"toAttributes");var x=Object.defineProperty,S=s((e,t)=>x(e,"name",{value:t,configurable:!0}),"__name");function C(e){return document.querySelector(e)}s(C,"qs");S(C,"qs");var P=Object.defineProperty,_=s((e,t)=>P(e,"name",{value:t,configurable:!0}),"__name");function O(e){return document.querySelectorAll(e)}s(O,"qsa");_(O,"qsa");var M=Object.defineProperty,d=s((e,t)=>M(e,"name",{value:t,configurable:!0}),"__name");function b(e){return document.createElement(e).constructor!==window.HTMLElement}s(b,"isRegistered");d(b,"isRegistered");function N(e,t){typeof window>"u"||"customElements"in window&&(b(e)||window.customElements.define(e,t))}s(N,"define");d(N,"define");function h(e,t){return e.matches||(e=e.parentElement),e.matches(t)?e:e.closest(t)}s(h,"match");d(h,"match");var $=Object.defineProperty,u=s((e,t)=>$(e,"name",{value:t,configurable:!0}),"__name"),l=class e extends window.HTMLElement{static{s(this,"WebComponent")}static{u(this,"WebComponent")}static TAG="";TAG="";static reflectedBooleanAttributes=[];static reflectedStringAttributes=[];static get observedAttributes(){return[...new Set([...this.reflectedBooleanAttributes,...this.reflectedStringAttributes])]}static match(t){return h(t,this.TAG)}static create(t){let n=class extends e{static{s(this,"CreatedClass")}static{u(this,"CreatedClass")}static TAG=t;TAG=t;render(){throw new Error("`render` should be implemented by children")}};return n.define=function(){return e.define.call(this)},n.event=function(r){return e.event.call(this,r)},n}static define(){v(this.TAG,this)}attributeChangedCallback(t,n,r){let o=this[A(t)];o&&o.call(this,n,r)}connectedCallback(){this.render()}qs(t){return this.querySelector(t)}qsa(t){return this.querySelectorAll(t)}static event(t){return g(this.TAG,t)}emit(t,n={}){if(t==="*")throw new Error('Do not emit the literal "*"');let{bubbles:r=!0,cancelable:o=!0,detail:a}=n,i=`${this.TAG}:${t}`,c=new CustomEvent(i,{bubbles:r,cancelable:o,detail:a});return this.dispatchEvent(c)}dispatch(t,n={}){let r=new CustomEvent(t,{bubbles:n.bubbles===void 0?!0:n.bubbles,cancelable:n.cancelable===void 0?!0:n.cancelable,detail:n.detail});return this.dispatchEvent(r)}on(t,n,r){let o=e.event.call(this,t);this.addEventListener(o,n,r)}off(t,n,r){let o=e.event.call(this,t);this.removeEventListener(o,n,r)}};function g(e,t){return`${e}:${t}`}s(g,"eventName");u(g,"eventName");var m=Object.create(null);function A(e){return m[e]||(m[e]=`handleChange_${e}`)}s(A,"handlerKey");u(A,"handlerKey");function w(e){return document.createElement(e).constructor!==window.HTMLElement}s(w,"isRegistered");u(w,"isRegistered");function v(e,t){if(typeof window>"u"||!("customElements"in window)||w(e))return;let n=t,r=n.reflectedBooleanAttributes??[],o=n.reflectedStringAttributes??[],a=t.prototype;for(let i of r)i in HTMLElement.prototype||Object.getOwnPropertyDescriptor(a,i)||Object.defineProperty(a,i,{get(){return this.hasAttribute(i)},set(c){this.toggleAttribute(i,!!c)},configurable:!0,enumerable:!0});for(let i of o){if(r.includes(i)){console.warn(`[web-component] "${i}" appears in both reflectedBooleanAttributes and reflectedStringAttributes on <${e}>. Boolean wins.`);continue}i in HTMLElement.prototype||Object.getOwnPropertyDescriptor(a,i)||Object.defineProperty(a,i,{get(){return this.getAttribute(i)},set(c){c==null?this.removeAttribute(i):this.setAttribute(i,String(c))},configurable:!0,enumerable:!0})}window.customElements.define(e,t)}s(v,"define");u(v,"define");var q="https://public.api.bsky.app",D=5,j=150,E=typeof CSS<"u"&&CSS.supports("anchor-scope: --a"),H=0,f=class extends l.create("actor-typeahead"){static{s(this,"ActorTypeahead")}static reflectedStringAttributes=["host","rows"];#c=`actor-typeahead-${++H}`;#e=[];#t=-1;#o=!1;#n=null;#i;#a=null;constructor(){super(),this.addEventListener("input",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}disconnectedCallback(){this.#s()}get#d(){let t=Number.parseInt(this.rows??"");return Number.isNaN(t)?D:t}handleEvent(t){switch(t.type){case"input":this.#f(t);break;case"keydown":t instanceof KeyboardEvent&&this.#h(t);break;case"focusout":this.#b();break;case"pointerdown":this.#o=!0;break;case"pointerup":this.#m(t);break}}#h(t){let n=this.#e.length-1;switch(t.key){case"ArrowDown":t.preventDefault(),this.#t=Math.min(this.#t+1,n),this.render();break;case"PageDown":t.preventDefault(),this.#t=n,this.render();break;case"ArrowUp":t.preventDefault(),this.#t=Math.max(this.#t-1,0),this.render();break;case"PageUp":t.preventDefault(),this.#t=0,this.render();break;case"Escape":this.#e.length&&t.preventDefault(),this.#r();break;case"Enter":if(!this.#e[this.#t]){this.#s();break}t.preventDefault(),this.#u(this.#t);break}}#f(t){if(!(t.target instanceof HTMLInputElement))return;let n=t.target.value;if(!n){this.#r();return}this.#s(),this.#i=setTimeout(()=>this.#p(n),j)}async#p(t){this.#i=void 0;let n=new URL("xrpc/app.bsky.actor.searchActorsTypeahead",this.host??q);n.searchParams.set("q",t),n.searchParams.set("limit",String(this.#d));let r=new AbortController;this.#a=r;let{signal:o}=r,a;try{let i=await fetch(n,{signal:o});if(o.aborted)return;if(!i.ok)throw new Error(`status ${i.status}`);a=await i.json()}catch(i){if(G(i))return;this.#r();return}o.aborted||(this.#e=B(a),this.#t=-1,this.render())}#b(){this.#o||this.#r()}#m(t){this.#o=!1;let n=t.target instanceof Element?t.target.closest('[role="option"]'):null;if(!n){this.qs("input")?.focus();return}this.#u(Number(n.dataset.index))}#u(t){let n=this.#e[t],r=this.qs("input");!n||!r||(r.value=n.handle,r.focus(),this.#r(),this.emit("select",{detail:n}))}#s(){clearTimeout(this.#i),this.#i=void 0,this.#a?.abort(),this.#a=null}#r(){this.#s(),this.#e=[],this.#t=-1,this.render()}render(){this.#n||(this.#n=document.createElement("ul"),this.#n.className="suggestion-list",this.#n.id=`${this.#c}-list`,this.#n.setAttribute("role","listbox"),E&&(this.#n.popover="manual"),this.#n.addEventListener("pointerdown",this),this.#n.addEventListener("pointerup",this));let t=this.#n;t.parentNode!==this&&this.append(t),t.replaceChildren(...this.#e.map((o,a)=>{let i=R(o,a,a===this.#t);return i.id=this.#l(a),i}));let n=this.#g(t,this.#e.length>0),r=this.qs("input");if(r){r.setAttribute("role","combobox"),r.setAttribute("aria-autocomplete","list"),r.hasAttribute("autocomplete")||r.setAttribute("autocomplete","off"),r.setAttribute("aria-controls",t.id),r.setAttribute("aria-expanded",String(n));let o=[...r.labels??[]].map(a=>a.id).filter(Boolean);o.length?t.setAttribute("aria-labelledby",o.join(" ")):t.removeAttribute("aria-labelledby"),this.#e[this.#t]?r.setAttribute("aria-activedescendant",this.#l(this.#t)):r.removeAttribute("aria-activedescendant")}}#g(t,n){if(!E)return n;if(!t.isConnected)return!1;let r=t.matches(":popover-open");return n&&!r&&t.showPopover(),!n&&r&&t.hidePopover(),t.matches(":popover-open")}#l(t){return`${this.#c}-option-${t}`}};f.define();function R(e,t,n){let r=document.createElement("li");r.className="suggestion",r.setAttribute("role","option"),r.setAttribute("aria-selected",String(n)),r.dataset.index=String(t),r.dataset.handle=e.handle;let o=document.createElement("div");o.className="avatar";let a=document.createElement("img");a.className="img",a.alt="",e.avatar&&(a.src=e.avatar);let i=document.createElement("span");return i.className="handle",i.textContent=e.handle,o.append(a),r.append(o,i),r}s(R,"suggestion");function B(e){return!y(e)||!Array.isArray(e.actors)?[]:e.actors.flatMap(t=>!y(t)||typeof t.handle!="string"?[]:[typeof t.avatar=="string"?{handle:t.handle,avatar:t.avatar}:{handle:t.handle}])}s(B,"parseActors");function G(e){return e instanceof DOMException&&e.name==="AbortError"}s(G,"isAbortError");function y(e){return typeof e=="object"&&e!==null}s(y,"isRecord");export{f as ActorTypeahead};
1
+ var T=Object.defineProperty;var o=(e,t)=>T(e,"name",{value:t,configurable:!0});var k=Object.defineProperty,L=o((e,t)=>k(e,"name",{value:t,configurable:!0}),"__name");function b(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r?typeof r=="boolean"?r?(t+` ${n}`).trim():t:Array.isArray(r)?t+` ${n}="${r.join(" ")}"`:(t+` ${n}="${r}"`).trim():t},"")}o(b,"toAttributes");L(b,"toAttributes");var x=Object.defineProperty,C=o((e,t)=>x(e,"name",{value:t,configurable:!0}),"__name");function N(e){return document.querySelector(e)}o(N,"qs");C(N,"qs");var S=Object.defineProperty,P=o((e,t)=>S(e,"name",{value:t,configurable:!0}),"__name");function _(e){return document.querySelectorAll(e)}o(_,"qsa");P(_,"qsa");var D=Object.defineProperty,d=o((e,t)=>D(e,"name",{value:t,configurable:!0}),"__name");function p(e){return document.createElement(e).constructor!==window.HTMLElement}o(p,"isRegistered");d(p,"isRegistered");function M(e,t){typeof window>"u"||"customElements"in window&&(p(e)||window.customElements.define(e,t))}o(M,"define");d(M,"define");function h(e,t){return e.matches||(e=e.parentElement),e.matches(t)?e:e.closest(t)}o(h,"match");d(h,"match");var O=Object.defineProperty,l=o((e,t)=>O(e,"name",{value:t,configurable:!0}),"__name"),u=class e extends window.HTMLElement{static{o(this,"WebComponent")}static{l(this,"WebComponent")}static TAG="";TAG="";static reflectedBooleanAttributes=[];static reflectedStringAttributes=[];static get observedAttributes(){return[...new Set([...this.reflectedBooleanAttributes,...this.reflectedStringAttributes])]}static match(t){return h(t,this.TAG)}static create(t){let n=class extends e{static{o(this,"CreatedClass")}static{l(this,"CreatedClass")}static TAG=t;TAG=t;render(){throw new Error("`render` should be implemented by children")}};return n.define=function(){return e.define.call(this)},n.event=function(r){return e.event.call(this,r)},n}static define(){v(this.TAG,this)}attributeChangedCallback(t,n,r){let s=this[A(t)];s&&s.call(this,n,r)}connectedCallback(){this.render()}qs(t){return this.querySelector(t)}qsa(t){return this.querySelectorAll(t)}static event(t){return g(this.TAG,t)}emit(t,n={}){if(t==="*")throw new Error('Do not emit the literal "*"');let{bubbles:r=!0,cancelable:s=!0,detail:a}=n,i=`${this.TAG}:${t}`,c=new CustomEvent(i,{bubbles:r,cancelable:s,detail:a});return this.dispatchEvent(c)}dispatch(t,n={}){let r=new CustomEvent(t,{bubbles:n.bubbles===void 0?!0:n.bubbles,cancelable:n.cancelable===void 0?!0:n.cancelable,detail:n.detail});return this.dispatchEvent(r)}on(t,n,r){let s=e.event.call(this,t);this.addEventListener(s,n,r)}off(t,n,r){let s=e.event.call(this,t);this.removeEventListener(s,n,r)}};function g(e,t){return`${e}:${t}`}o(g,"eventName");l(g,"eventName");var m=Object.create(null);function A(e){return m[e]||(m[e]=`handleChange_${e}`)}o(A,"handlerKey");l(A,"handlerKey");function E(e){return document.createElement(e).constructor!==window.HTMLElement}o(E,"isRegistered");l(E,"isRegistered");function v(e,t){if(typeof window>"u"||!("customElements"in window)||E(e))return;let n=t,r=n.reflectedBooleanAttributes??[],s=n.reflectedStringAttributes??[],a=t.prototype;for(let i of r)i in HTMLElement.prototype||Object.getOwnPropertyDescriptor(a,i)||Object.defineProperty(a,i,{get(){return this.hasAttribute(i)},set(c){this.toggleAttribute(i,!!c)},configurable:!0,enumerable:!0});for(let i of s){if(r.includes(i)){console.warn(`[web-component] "${i}" appears in both reflectedBooleanAttributes and reflectedStringAttributes on <${e}>. Boolean wins.`);continue}i in HTMLElement.prototype||Object.getOwnPropertyDescriptor(a,i)||Object.defineProperty(a,i,{get(){return this.getAttribute(i)},set(c){c==null?this.removeAttribute(i):this.setAttribute(i,String(c))},configurable:!0,enumerable:!0})}window.customElements.define(e,t)}o(v,"define");l(v,"define");var H="https://public.api.bsky.app",$=5,j=150,w=typeof CSS<"u"&&CSS.supports("anchor-scope: --a"),q=0,f=class extends u.create("actor-typeahead"){static{o(this,"ActorTypeahead")}static reflectedStringAttributes=["host","rows"];announce=G;#l=`actor-typeahead-${++q}`;#e=[];#t=-1;#n=null;#r=null;#a=!1;#s;#c=null;constructor(){super(),this.addEventListener("input",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}disconnectedCallback(){this.#o()}get#h(){let t=Number.parseInt(this.rows??"");return Number.isNaN(t)?$:t}handleEvent(t){switch(t.type){case"input":this.#b(t);break;case"keydown":t instanceof KeyboardEvent&&this.#f(t);break;case"focusout":t instanceof FocusEvent&&this.#g(t);break;case"mousedown":t.preventDefault();break;case"click":this.#A(t);break}}#f(t){let n=this.#e.length-1,r=["ArrowDown","ArrowUp","PageDown","PageUp"];if(n<0&&r.includes(t.key)){t.preventDefault();return}switch(t.key){case"ArrowDown":t.preventDefault(),this.#t=Math.min(this.#t+1,n),this.render();break;case"PageDown":t.preventDefault(),this.#t=n,this.render();break;case"ArrowUp":t.preventDefault(),this.#t=this.#t<0?n:this.#t-1,this.render();break;case"PageUp":t.preventDefault(),this.#t=0,this.render();break;case"Escape":this.#e.length&&t.preventDefault(),this.#i();break;case"Enter":if(!this.#e[this.#t]){this.#o();break}t.preventDefault(),this.#u(this.#t);break}}#b(t){if(!(t.target instanceof HTMLInputElement))return;let n=t.target.value;if(!n){this.#i();return}this.#o(),this.#s=setTimeout(()=>this.#p(n),j)}async#p(t){this.#s=void 0;let n=new URL("xrpc/app.bsky.actor.searchActorsTypeahead",this.host??H);n.searchParams.set("q",t),n.searchParams.set("limit",String(this.#h));let r=new AbortController;this.#c=r;let{signal:s}=r,a;try{let i=await fetch(n,{signal:s});if(s.aborted)return;if(!i.ok)throw new Error(`status ${i.status}`);a=await i.json()}catch(i){if(I(i))return;this.#i();return}s.aborted||(this.#e=U(a),this.#t=-1,this.render(),this.#m(this.#e.length))}#m(t){this.#r&&(this.#a=!this.#a,this.#r.textContent=this.announce(t)+(this.#a?"\xA0":""))}#g(t){let n=t.relatedTarget;n instanceof Node&&this.contains(n)||this.#i()}#A(t){let n=t.target instanceof Element?t.target.closest('[role="option"]'):null;n&&this.#u(Number(n.dataset.index))}#u(t){let n=this.#e[t],r=this.qs("input");!n||!r||(r.value=n.handle,r.focus(),this.#i(),this.emit("select",{detail:n}))}#o(){clearTimeout(this.#s),this.#s=void 0,this.#c?.abort(),this.#c=null}#i(){this.#o(),this.#e=[],this.#t=-1,this.render()}render(){this.#n||(this.#n=document.createElement("div"),this.#n.className="suggestion-list",this.#n.id=`${this.#l}-list`,this.#n.setAttribute("role","listbox"),w&&(this.#n.popover="manual"),this.#n.addEventListener("mousedown",this),this.#n.addEventListener("click",this));let t=this.#n;t.parentNode!==this&&this.append(t),this.#r||(this.#r=document.createElement("div"),this.#r.className="suggestion-count",this.#r.setAttribute("role","status"));let n=this.#r;n.parentNode!==this&&this.append(n),this.#e.length||(n.textContent=""),t.replaceChildren(...this.#e.map((a,i)=>{let c=R(a,i,i===this.#t);return c.id=this.#d(i),c}));let r=this.#E(t,this.#e.length>0),s=this.qs("input");if(s){s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.hasAttribute("autocomplete")||s.setAttribute("autocomplete","off"),s.setAttribute("aria-controls",t.id),s.setAttribute("aria-expanded",String(r));let a=B(s,this);for(let i of["aria-labelledby","aria-label"]){let c=a[i];c?t.setAttribute(i,c):t.removeAttribute(i)}this.#e[this.#t]?s.setAttribute("aria-activedescendant",this.#d(this.#t)):s.removeAttribute("aria-activedescendant")}}#E(t,n){if(!w)return n;if(!t.isConnected)return!1;let r=t.matches(":popover-open");return n&&!r&&t.showPopover(),!n&&r&&t.hidePopover(),t.matches(":popover-open")}#d(t){return`${this.#l}-option-${t}`}};f.define();function R(e,t,n){let r=document.createElement("button");r.type="button",r.tabIndex=-1,r.className="suggestion",r.setAttribute("role","option"),r.setAttribute("aria-selected",String(n)),r.dataset.index=String(t),r.dataset.handle=e.handle;let s=document.createElement("div");s.className="avatar";let a=document.createElement("img");a.className="img",a.alt="",e.avatar&&(a.src=e.avatar);let i=document.createElement("span");return i.className="handle",i.textContent=e.handle,s.append(a),r.append(s,i),r}o(R,"suggestion");function B(e,t){let n=e.getAttribute("aria-labelledby");if(n)return{"aria-labelledby":n};let r=e.getAttribute("aria-label");if(r)return{"aria-label":r};let s=[...e.labels??[]];if(!s.length)return{};if(s.every(i=>i.id))return{"aria-labelledby":s.map(i=>i.id).join(" ")};let a=s.map(i=>F(i,t).trim()).filter(Boolean).join(" ");return a?{"aria-label":a}:{}}o(B,"nameSource");function F(e,t){let n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:o(s=>t.contains(s)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT,"acceptNode")}),r="";for(;n.nextNode();)r+=n.currentNode.nodeValue;return r}o(F,"labelText");function G(e){return e===0?"No Suggestions":e===1?"1 Suggestion available":`${e} Suggestions available`}o(G,"defaultAnnounce");function U(e){return!y(e)||!Array.isArray(e.actors)?[]:e.actors.flatMap(t=>!y(t)||typeof t.handle!="string"?[]:[typeof t.avatar=="string"?{handle:t.handle,avatar:t.avatar}:{handle:t.handle}])}o(U,"parseActors");function I(e){return e instanceof DOMException&&e.name==="AbortError"}o(I,"isAbortError");function y(e){return typeof e=="object"&&e!==null}o(y,"isRecord");export{f as ActorTypeahead};
2
2
  //# sourceMappingURL=index.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../node_modules/@substrate-system/web-component/src/attributes.ts", "../node_modules/@substrate-system/web-component/src/qs.ts", "../node_modules/@substrate-system/web-component/src/qsa.ts", "../node_modules/@substrate-system/web-component/src/util.ts", "../node_modules/@substrate-system/web-component/src/index.ts", "../src/index.ts"],
4
- "sourcesContent": ["export type Attrs = Record<string, undefined|null|string|number|boolean|(string|number)[]>\n\n/**\n * Transform an object into an HTML attributes string. The object should be\n * like `{ attributeName: value }`.\n *\n * @param attrs An object for the attributes.\n * @returns {string} A string suitable for use as HTML attributes.\n */\nexport function toAttributes (attrs:Attrs):string {\n return Object.keys(attrs).reduce((acc, k) => {\n const value = attrs[k]\n if (!value) return acc\n\n if (typeof value === 'boolean') {\n if (value) return (acc + ` ${k}`).trim()\n return acc\n }\n\n if (Array.isArray(value)) {\n return (acc + ` ${k}=\"${value.join(' ')}\"`)\n }\n\n return (acc + ` ${k}=\"${value}\"`).trim()\n }, '')\n}\n", "export function qs<K extends keyof HTMLElementTagNameMap> (\n selectors:K\n):HTMLElementTagNameMap[K]|null\n\nexport function qs<K extends keyof SVGElementTagNameMap> (\n selectors:K\n):SVGElementTagNameMap[K]|null\n\nexport function qs<E extends Element = Element> (\n selectors:string\n):E|null\n\nexport function qs (selectors:string):Element|null {\n return document.querySelector(selectors)\n}\n", "export function qsa<K extends keyof HTMLElementTagNameMap> (\n selectors:K\n):NodeListOf<HTMLElementTagNameMap[K]>\n\nexport function qsa<K extends keyof SVGElementTagNameMap> (\n selectors:K\n):NodeListOf<SVGElementTagNameMap[K]>\n\nexport function qsa<E extends Element = Element> (\n selectors:string\n):NodeListOf<E>\n\nexport function qsa (selectors:string):NodeListOf<Element> {\n return document.querySelectorAll(selectors)\n}\n", "export { toAttributes } from './attributes.js'\n\n/**\n * Check if the given tag name has been registered.\n *\n * @see {@link https://stackoverflow.com/a/28210364 stackoverflow}\n * @param {string} elName The custom element tag name.\n * @returns {boolean} True if the given name has been registered already.\n */\nexport function isRegistered (elName:string):boolean {\n return document.createElement(elName).constructor !== window.HTMLElement\n}\n\nexport function define (name:string, element:CustomElementConstructor) {\n if (typeof window === 'undefined') return\n if (!('customElements' in window)) return\n if (!isRegistered(name)) {\n window.customElements.define(name, element)\n }\n}\n\n/**\n * Get the closes parent element matching the given selector.\n * @param el Element to start from\n * @param s Selector for an element\n * @returns {HTMLElement|null} The closes parent element that matches.\n */\nexport function match (el:HTMLElement, s:string):HTMLElement|null {\n if (!el.matches) el = el.parentElement!\n return el.matches(s) ? el : el.closest(s)\n}\n\nexport * from './qs.js'\nexport * from './qsa.js'\n", "import { match as _match } from './util.js'\n\nexport abstract class WebComponent extends window.HTMLElement {\n static TAG:string = ''\n TAG:string = ''\n\n /**\n * Declare boolean attributes that should be reflected as properties.\n * The base class auto-generates getters/setters and includes these in\n * `observedAttributes`. Framework property assignment (e.g. Preact's\n * `el.disabled = true`) will then correctly set the attribute.\n */\n static reflectedBooleanAttributes:string[] = []\n\n /**\n * Declare string attributes that should be reflected as properties.\n * Getter returns `string|null` (null when attribute is absent).\n * Setting `null` or `undefined` removes the attribute.\n */\n static reflectedStringAttributes:string[] = []\n\n /**\n * Auto-derived from `reflectedBooleanAttributes` and\n * `reflectedStringAttributes`. Override with `super.observedAttributes`\n * to add non-reflected observed attributes:\n *\n * ```ts\n * static get observedAttributes () {\n * return [...super.observedAttributes, 'aria-label']\n * }\n * ```\n */\n static get observedAttributes ():string[] {\n return [...new Set([\n ...this.reflectedBooleanAttributes,\n ...this.reflectedStringAttributes,\n ])]\n }\n\n static match (el:HTMLElement):HTMLElement|null {\n return _match(el, this.TAG)\n }\n\n static create<T extends string> (elementName:T):typeof WebComponent & {\n new (...args:any[]):WebComponent & { TAG:T };\n TAG:T;\n define: typeof WebComponent.define;\n event: typeof WebComponent.event;\n } {\n const CreatedClass = class extends WebComponent {\n static TAG = elementName\n TAG = elementName\n render () {\n throw new Error('`render` should be implemented by children')\n }\n }\n\n // Copy static methods with proper binding\n CreatedClass.define = function () {\n return WebComponent.define.call(this)\n }\n CreatedClass.event = function (evType:string) {\n return WebComponent.event.call(this, evType)\n }\n\n return CreatedClass\n }\n\n static define<T extends {\n new (...args:any[]):WebComponent;\n TAG:string;\n }>(this:T) {\n define(this.TAG, this)\n }\n\n /**\n * Runs when the value of an attribute is changed.\n *\n * Depends on `static observedAttributes`.\n *\n * Should name methods like `handleChange_disabled`.\n *\n * @param {string} name The attribute name\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n attributeChangedCallback (\n name:string,\n oldValue:string,\n newValue:string\n ):void {\n const handler = this[handlerKey(name)]\n if (handler) {\n handler.call(this, oldValue, newValue)\n }\n }\n\n connectedCallback () {\n this.render()\n }\n\n abstract render ():any\n\n qs<K extends keyof HTMLElementTagNameMap>(\n selector:K\n ):HTMLElementTagNameMap[K]|null;\n\n qs<E extends Element = Element>(selector:string):E|null;\n qs (selector:string):Element|null {\n return this.querySelector(selector)\n }\n\n qsa<K extends keyof HTMLElementTagNameMap>(\n selector:K\n ):HTMLElementTagNameMap[K]|null;\n\n qsa<E extends Element = Element>(selector:string):E|null;\n qsa (selector:string):NodeListOf<Element> {\n return this.querySelectorAll(selector)\n }\n\n /**\n * Take a non-namepsaced event name, return namespace event name.\n *\n * @param {string} evType The non-namespace event name\n * @returns {string} Namespaced event name, eg, `my-component:click`\n */\n static event (evType:string):string {\n return eventName(this.TAG, evType)\n }\n\n /**\n * Emit a namespaced event.\n *\n * @param type (non-namespaced) event type string\n * @param opts `bubbles`, `detail`, and `cancelable`. Default is\n * `{ bubbles: true, cancelable: true }`\n * @returns {boolean}\n */\n emit<T = any> (type:string, opts:Partial<{\n bubbles:boolean,\n cancelable:boolean,\n detail:CustomEvent<T>['detail']\n }> = {}):boolean {\n if (type === '*') throw new Error('Do not emit the literal \"*\"')\n\n const { bubbles = true, cancelable = true, detail } = opts\n const namespacedType = `${this.TAG}:${type}`\n\n const event = new CustomEvent(namespacedType, {\n bubbles,\n cancelable,\n detail\n })\n\n return this.dispatchEvent(event)\n }\n\n /**\n * Create and emit an event, no namespacing.\n */\n dispatch<T> (type:string, opts:Partial<{\n bubbles:boolean,\n cancelable:boolean,\n detail:CustomEvent<T>['detail']\n }> = {}):boolean {\n const event = new CustomEvent(type, {\n bubbles: (opts.bubbles === undefined) ? true : opts.bubbles,\n cancelable: (opts.cancelable === undefined) ? true : opts.cancelable,\n detail: opts.detail\n })\n\n return this.dispatchEvent(event)\n }\n\n /**\n * Listen for namespaced events.\n */\n on<T extends Event = Event> (\n evName:string,\n handler:(ev:T)=>any,\n options?:boolean|AddEventListenerOptions\n ):void;\n\n on (\n evName:string,\n handler:EventListenerObject,\n options?:boolean|AddEventListenerOptions\n ):void;\n\n on (\n evName:string,\n handler:((ev:Event)=>any)|EventListenerObject,\n options?:boolean|AddEventListenerOptions\n ):void {\n const fullEvName = WebComponent.event.call(this, evName)\n this.addEventListener(fullEvName, handler as EventListenerOrEventListenerObject, options)\n }\n\n /**\n * Remove a namespaced event listener.\n */\n off<T extends Event = Event> (\n evName:string,\n handler:(ev:T)=>any,\n options?:boolean|EventListenerOptions\n ):void;\n\n off (\n evName:string,\n handler:EventListenerObject,\n options?:boolean|EventListenerOptions\n ):void;\n\n off (\n evName:string,\n handler:((ev:Event)=>any)|EventListenerObject,\n options?:boolean|EventListenerOptions\n ):void {\n const fullEvName = WebComponent.event.call(this, evName)\n this.removeEventListener(fullEvName, handler as EventListenerOrEventListenerObject, options)\n }\n}\n\nfunction eventName (namespace:string, evType:string) {\n return `${namespace}:${evType}`\n}\n\n/**\n * Cache of attribute name -> handler method name (`handleChange_<attr>`).\n * Building the lookup string once per attribute avoids re-allocating it on\n * every `attributeChangedCallback`.\n */\nconst handlerKeys:Record<string, string> = Object.create(null)\nfunction handlerKey (name:string):string {\n return handlerKeys[name] || (handlerKeys[name] = `handleChange_${name}`)\n}\n\n/**\n * Check if the given tag name has been registered.\n *\n * @see {@link https://stackoverflow.com/a/28210364 stackoverflow}\n * @param {string} elName The custom element tag name.\n * @returns {boolean} True if the given name has been registered already.\n */\nexport function isRegistered (elName:string):boolean {\n return document.createElement(elName).constructor !== window.HTMLElement\n}\n\nexport function define (name:string, element:CustomElementConstructor) {\n if (typeof window === 'undefined') return\n if (!('customElements' in window)) return\n if (isRegistered(name)) return\n\n const ctor = element as unknown as typeof WebComponent\n const boolAttrs:string[] = ctor.reflectedBooleanAttributes ?? []\n const strAttrs:string[] = ctor.reflectedStringAttributes ?? []\n const proto = (element as any).prototype\n\n for (const attr of boolAttrs) {\n // Skip built-in IDL attributes on HTMLElement and ancestors\n // (covers Element.prototype, Node.prototype, etc.)\n if (attr in HTMLElement.prototype) continue\n // Skip if the subclass already defines an own-property accessor\n if (Object.getOwnPropertyDescriptor(proto, attr)) continue\n Object.defineProperty(proto, attr, {\n get (this:HTMLElement):boolean {\n return this.hasAttribute(attr)\n },\n set (this:HTMLElement, v:unknown) {\n this.toggleAttribute(attr, Boolean(v))\n },\n configurable: true,\n enumerable: true,\n })\n }\n\n for (const attr of strAttrs) {\n if (boolAttrs.includes(attr)) {\n console.warn(\n `[web-component] \"${attr}\" appears in both ` +\n 'reflectedBooleanAttributes and reflectedStringAttributes ' +\n `on <${name}>. Boolean wins.`\n )\n continue\n }\n if (attr in HTMLElement.prototype) continue\n if (Object.getOwnPropertyDescriptor(proto, attr)) continue\n Object.defineProperty(proto, attr, {\n get (this:HTMLElement):string|null {\n return this.getAttribute(attr)\n },\n set (this:HTMLElement, v:unknown) {\n // null and undefined both remove the attribute\n if (v == null) {\n this.removeAttribute(attr)\n } else {\n this.setAttribute(attr, String(v))\n }\n },\n configurable: true,\n enumerable: true,\n })\n }\n\n window.customElements.define(name, element)\n}\n", "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n *\n * Copyright (c) 2026 Jake Lazaroff\n *\n * Repository: https://tangled.org/jakelazaroff.com/actor-typeahead\n */\n\nimport { WebComponent } from '@substrate-system/web-component'\n\n// for document.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'actor-typeahead':ActorTypeahead\n }\n}\n\nexport interface Actor {\n handle:string;\n avatar?:string;\n}\n\nconst DEFAULT_HOST = 'https://public.api.bsky.app'\nconst DEFAULT_ROWS = 5\n\n// how long the Query must stay unchanged before a Typeahead request\nconst DEBOUNCE_MS = 150\n\n// The Suggestion list is a top-layer popover, positioned against the host\n// with CSS anchor positioning. `anchor-scope` shipped last of that set, so\n// it gates the group. Without it, the old absolute layout is used.\nconst ANCHORED = typeof CSS !== 'undefined' &&\n CSS.supports('anchor-scope: --a')\n\n// counts instances, so each one gets unique element ids\nlet instances = 0\n\n/**\n * @attribute {string} [host] - The host to which to make the typeahead\n * API call.\n * @attribute {number} [rows] - The maximum number of Suggestions to\n * display in the Suggestion list.\n *\n * @fires actor-typeahead:select - A Suggestion was chosen from the\n * Suggestion list. The event `detail` is `{ handle, avatar }`.\n *\n * @cssprop --color-background - Controls the color of the Suggestion list\n * background.\n * @cssprop --color-border - Controls the color of the Suggestion list\n * border.\n * @cssprop --color-shadow - Controls the color of the Suggestion list\n * shadow.\n * @cssprop --color-hover - Controls the background color of each\n * Suggestion on hover.\n * @cssprop --color-avatar-fallback - Controls the background color of an\n * avatar circle if the image fails to load.\n * @cssprop --radius - Controls the corner radius of the Suggestion list.\n * @cssprop --padding-suggestion-list - Controls the padding of the\n * Suggestion list.\n *\n * @summary A small web component that progressively enhances an <input>\n * element into an autocomplete for ATProto handles.\n *\n * @tag actor-typeahead\n */\nexport class ActorTypeahead extends WebComponent.create('actor-typeahead') {\n static reflectedStringAttributes = ['host', 'rows']\n\n declare host:string|null\n declare rows:string|null\n\n #id = `actor-typeahead-${++instances}`\n #actors:Actor[] = []\n #index = -1\n #pressed = false\n #suggestionList:HTMLUListElement|null = null\n #timer:ReturnType<typeof setTimeout>|undefined\n #controller:AbortController|null = null\n\n constructor () {\n super()\n this.addEventListener('input', this)\n this.addEventListener('focusout', this)\n this.addEventListener('keydown', this)\n }\n\n /**\n * Stop any pending Typeahead request. The Suggestion list is left as\n * is; the next Query rebuilds it.\n */\n disconnectedCallback () {\n this.#cancel()\n }\n\n get #limit ():number {\n const rows = Number.parseInt(this.rows ?? '')\n return Number.isNaN(rows) ? DEFAULT_ROWS : rows\n }\n\n handleEvent (evt:Event) {\n switch (evt.type) {\n case 'input':\n this.#oninput(evt)\n break\n\n case 'keydown':\n if (evt instanceof KeyboardEvent) this.#onkeydown(evt)\n break\n\n case 'focusout':\n this.#onfocusout()\n break\n\n case 'pointerdown':\n this.#pressed = true\n break\n\n case 'pointerup':\n this.#onpointerup(evt)\n break\n }\n }\n\n #onkeydown (evt:KeyboardEvent) {\n const last = this.#actors.length - 1\n\n switch (evt.key) {\n case 'ArrowDown':\n evt.preventDefault()\n this.#index = Math.min(this.#index + 1, last)\n this.render()\n break\n\n case 'PageDown':\n evt.preventDefault()\n this.#index = last\n this.render()\n break\n\n case 'ArrowUp':\n evt.preventDefault()\n this.#index = Math.max(this.#index - 1, 0)\n this.render()\n break\n\n case 'PageUp':\n evt.preventDefault()\n this.#index = 0\n this.render()\n break\n\n case 'Escape':\n // with the list closed, let a dialog close; still cancel\n // any pending Typeahead request\n if (this.#actors.length) evt.preventDefault()\n this.#clear()\n break\n\n case 'Enter':\n // with nothing Highlighted, let the form submit, and\n // drop any pending Typeahead request\n if (!this.#actors[this.#index]) {\n this.#cancel()\n break\n }\n evt.preventDefault()\n this.#select(this.#index)\n break\n }\n }\n\n #oninput (evt:Event) {\n if (!(evt.target instanceof HTMLInputElement)) return\n\n const query = evt.target.value\n if (!query) {\n this.#clear()\n return\n }\n\n // keep the current Suggestions on screen until the new response\n this.#cancel()\n this.#timer = setTimeout(() => this.#request(query), DEBOUNCE_MS)\n }\n\n async #request (query:string) {\n this.#timer = undefined\n const url = new URL(\n 'xrpc/app.bsky.actor.searchActorsTypeahead',\n this.host ?? DEFAULT_HOST\n )\n url.searchParams.set('q', query)\n url.searchParams.set('limit', String(this.#limit))\n\n const controller = new AbortController()\n this.#controller = controller\n const { signal } = controller\n\n let json:unknown\n try {\n const res = await fetch(url, { signal })\n if (signal.aborted) return\n if (!res.ok) throw new Error(`status ${res.status}`)\n json = await res.json()\n } catch (err) {\n // a newer Query, or a close, cancelled this request\n if (isAbortError(err)) return\n // any other failure closes the Suggestion list, quietly\n this.#clear()\n return\n }\n if (signal.aborted) return\n\n this.#actors = parseActors(json)\n this.#index = -1\n this.render()\n }\n\n #onfocusout () {\n if (this.#pressed) return\n this.#clear()\n }\n\n #onpointerup (evt:Event) {\n this.#pressed = false\n\n const option = evt.target instanceof Element ?\n evt.target.closest<HTMLElement>('[role=\"option\"]') :\n null\n\n if (!option) {\n this.qs('input')?.focus()\n return\n }\n\n this.#select(Number(option.dataset.index))\n }\n\n #select (index:number) {\n const actor = this.#actors[index]\n const input = this.qs('input')\n if (!actor || !input) return\n\n input.value = actor.handle\n input.focus()\n this.#clear()\n this.emit<Actor>('select', { detail: actor })\n }\n\n /**\n * Stop any pending Typeahead request: the debounce timer, and the\n * request in flight, whose response is then dropped.\n */\n #cancel () {\n clearTimeout(this.#timer)\n this.#timer = undefined\n this.#controller?.abort()\n this.#controller = null\n }\n\n #clear () {\n this.#cancel()\n this.#actors = []\n this.#index = -1\n this.render()\n }\n\n /**\n * Render into light DOM, next to the authored `<input>`. Only the\n * Suggestion list is rebuilt, so the input element, and anything the\n * consumer attached to it, is never replaced. On the input, only the\n * ARIA combobox attributes are written, plus `autocomplete=\"off\"`\n * when the page did not set `autocomplete`.\n */\n render () {\n if (!this.#suggestionList) {\n this.#suggestionList = document.createElement('ul')\n this.#suggestionList.className = 'suggestion-list'\n this.#suggestionList.id = `${this.#id}-list`\n this.#suggestionList.setAttribute('role', 'listbox')\n if (ANCHORED) this.#suggestionList.popover = 'manual'\n this.#suggestionList.addEventListener('pointerdown', this)\n this.#suggestionList.addEventListener('pointerup', this)\n }\n\n const list = this.#suggestionList\n if (list.parentNode !== this) this.append(list)\n\n list.replaceChildren(...this.#actors.map((actor, i) => {\n const option = suggestion(actor, i, i === this.#index)\n option.id = this.#optionId(i)\n return option\n }))\n\n const open = this.#toggle(list, this.#actors.length > 0)\n\n const input = this.qs('input')\n if (input) {\n input.setAttribute('role', 'combobox')\n input.setAttribute('aria-autocomplete', 'list')\n if (!input.hasAttribute('autocomplete')) {\n input.setAttribute('autocomplete', 'off')\n }\n input.setAttribute('aria-controls', list.id)\n input.setAttribute('aria-expanded', String(open))\n\n const labels = [...(input.labels ?? [])]\n .map(label => label.id)\n .filter(Boolean)\n if (labels.length) {\n list.setAttribute('aria-labelledby', labels.join(' '))\n } else {\n list.removeAttribute('aria-labelledby')\n }\n\n if (this.#actors[this.#index]) {\n input.setAttribute(\n 'aria-activedescendant',\n this.#optionId(this.#index)\n )\n } else {\n input.removeAttribute('aria-activedescendant')\n }\n }\n }\n\n /**\n * Show or hide the Suggestion list popover, guarded on its current\n * state so repeated renders neither throw nor toggle. A disconnected\n * popover cannot be shown, e.g. when a response arrives after the host\n * was removed. Returns whether the Suggestion list is open.\n */\n #toggle (list:HTMLElement, open:boolean):boolean {\n if (!ANCHORED) return open\n if (!list.isConnected) return false\n\n const isOpen = list.matches(':popover-open')\n if (open && !isOpen) list.showPopover()\n if (!open && isOpen) list.hidePopover()\n return list.matches(':popover-open')\n }\n\n #optionId (index:number):string {\n return `${this.#id}-option-${index}`\n }\n}\n\nActorTypeahead.define()\n\n/**\n * Build one Suggestion. Values from the API go through `textContent` and\n * properties, never through `innerHTML`.\n */\nfunction suggestion (\n actor:Actor,\n index:number,\n active:boolean\n):HTMLLIElement {\n const li = document.createElement('li')\n li.className = 'suggestion'\n li.setAttribute('role', 'option')\n li.setAttribute('aria-selected', String(active))\n li.dataset.index = String(index)\n li.dataset.handle = actor.handle\n\n const avatar = document.createElement('div')\n avatar.className = 'avatar'\n\n const img = document.createElement('img')\n img.className = 'img'\n img.alt = ''\n if (actor.avatar) img.src = actor.avatar\n\n const handle = document.createElement('span')\n handle.className = 'handle'\n handle.textContent = actor.handle\n\n avatar.append(img)\n li.append(avatar, handle)\n\n return li\n}\n\nfunction parseActors (json:unknown):Actor[] {\n if (!isRecord(json) || !Array.isArray(json.actors)) return []\n\n return json.actors.flatMap((actor:unknown) => {\n if (!isRecord(actor) || typeof actor.handle !== 'string') return []\n\n return [typeof actor.avatar === 'string' ?\n { handle: actor.handle, avatar: actor.avatar } :\n { handle: actor.handle }]\n })\n}\n\nfunction isAbortError (err:unknown):boolean {\n return err instanceof DOMException && err.name === 'AbortError'\n}\n\nfunction isRecord (value:unknown):value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n"],
5
- "mappings": "sKASO,SAASA,EAAcC,EAAoB,CAC9C,OAAO,OAAO,KAAKA,CAAK,EAAE,OAAO,CAACC,EAAKC,IAAM,CACzC,IAAMC,EAAQH,EAAME,CAAC,EACrB,OAAKC,EAED,OAAOA,GAAU,UACbA,GAAeF,EAAM,IAAIC,CAAC,IAAI,KAAK,EAChCD,EAGP,MAAM,QAAQE,CAAK,EACXF,EAAM,IAAIC,CAAC,KAAKC,EAAM,KAAK,GAAG,CAAC,KAGnCF,EAAM,IAAIC,CAAC,KAAKC,CAAK,KAAK,KAAK,EAXpBF,CAYvB,EAAG,EAAE,CACT,CAhBgBG,EAAAL,EAAA,gBAAAK,EAAAL,EAAA,cAAA,yFCGT,SAASM,EAAIC,EAA+B,CAC/C,OAAO,SAAS,cAAcA,C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B,EAAShB,CAAK,GAAK,OAAOA,EAAM,QAAW,SAAiB,CAAC,EAE3D,CAAC,OAAOA,EAAM,QAAW,SAC5B,CAAE,OAAQA,EAAM,OAAQ,OAAQA,EAAM,MAAO,EAC7C,CAAE,OAAQA,EAAM,MAAO,CAAC,CAC/B,CACL,CAVS/B,EAAA4B,EAAA,eAYT,SAASD,EAAcD,EAAqB,CACxC,OAAOA,aAAe,cAAgBA,EAAI,OAAS,YACvD,CAFS1B,EAAA2B,EAAA,gBAIT,SAASoB,EAAUC,EAAgD,CAC/D,OAAO,OAAOA,GAAU,UAAYA,IAAU,IAClD,CAFShD,EAAA+C,EAAA",
6
- "names": ["toAttributes", "attrs", "acc", "k", "value", "__name", "qs", "selectors", "__name", "qsa", "selectors", "__name", "isRegistered", "elName", "__name", "define", "name", "element", "match", "el", "s", "WebComponent", "_WebComponent", "__name", "el", "match", "elementName", "CreatedClass", "evType", "define", "name", "oldValue", "newValue", "handler", "handlerKey", "selector", "eventName", "type", "opts", "bubbles", "cancelable", "detail", "namespacedType", "event", "evName", "options", "fullEvName", "namespace", "handlerKeys", "isRegistered", "elName", "element", "ctor", "boolAttrs", "strAttrs", "proto", "attr", "v", "DEFAULT_HOST", "DEFAULT_ROWS", "DEBOUNCE_MS", "ANCHORED", "instances", "ActorTypeahead", "WebComponent", "__name", "#id", "#actors", "#index", "#pressed", "#suggestionList", "#timer", "#controller", "#cancel", "#limit", "rows", "evt", "#oninput", "#onkeydown", "#onfocusout", "#onpointerup", "last", "#clear", "#select", "query", "#request", "url", "controller", "signal", "json", "res", "err", "isAbortError", "parseActors", "option", "index", "actor", "input", "list", "i", "suggestion", "#optionId", "open", "#toggle", "labels", "label", "isOpen", "active", "li", "avatar", "img", "handle", "isRecord", "value"]
4
+ "sourcesContent": ["export type Attrs = Record<string, undefined|null|string|number|boolean|(string|number)[]>\n\n/**\n * Transform an object into an HTML attributes string. The object should be\n * like `{ attributeName: value }`.\n *\n * @param attrs An object for the attributes.\n * @returns {string} A string suitable for use as HTML attributes.\n */\nexport function toAttributes (attrs:Attrs):string {\n return Object.keys(attrs).reduce((acc, k) => {\n const value = attrs[k]\n if (!value) return acc\n\n if (typeof value === 'boolean') {\n if (value) return (acc + ` ${k}`).trim()\n return acc\n }\n\n if (Array.isArray(value)) {\n return (acc + ` ${k}=\"${value.join(' ')}\"`)\n }\n\n return (acc + ` ${k}=\"${value}\"`).trim()\n }, '')\n}\n", "export function qs<K extends keyof HTMLElementTagNameMap> (\n selectors:K\n):HTMLElementTagNameMap[K]|null\n\nexport function qs<K extends keyof SVGElementTagNameMap> (\n selectors:K\n):SVGElementTagNameMap[K]|null\n\nexport function qs<E extends Element = Element> (\n selectors:string\n):E|null\n\nexport function qs (selectors:string):Element|null {\n return document.querySelector(selectors)\n}\n", "export function qsa<K extends keyof HTMLElementTagNameMap> (\n selectors:K\n):NodeListOf<HTMLElementTagNameMap[K]>\n\nexport function qsa<K extends keyof SVGElementTagNameMap> (\n selectors:K\n):NodeListOf<SVGElementTagNameMap[K]>\n\nexport function qsa<E extends Element = Element> (\n selectors:string\n):NodeListOf<E>\n\nexport function qsa (selectors:string):NodeListOf<Element> {\n return document.querySelectorAll(selectors)\n}\n", "export { toAttributes } from './attributes.js'\n\n/**\n * Check if the given tag name has been registered.\n *\n * @see {@link https://stackoverflow.com/a/28210364 stackoverflow}\n * @param {string} elName The custom element tag name.\n * @returns {boolean} True if the given name has been registered already.\n */\nexport function isRegistered (elName:string):boolean {\n return document.createElement(elName).constructor !== window.HTMLElement\n}\n\nexport function define (name:string, element:CustomElementConstructor) {\n if (typeof window === 'undefined') return\n if (!('customElements' in window)) return\n if (!isRegistered(name)) {\n window.customElements.define(name, element)\n }\n}\n\n/**\n * Get the closes parent element matching the given selector.\n * @param el Element to start from\n * @param s Selector for an element\n * @returns {HTMLElement|null} The closes parent element that matches.\n */\nexport function match (el:HTMLElement, s:string):HTMLElement|null {\n if (!el.matches) el = el.parentElement!\n return el.matches(s) ? el : el.closest(s)\n}\n\nexport * from './qs.js'\nexport * from './qsa.js'\n", "import { match as _match } from './util.js'\n\nexport abstract class WebComponent extends window.HTMLElement {\n static TAG:string = ''\n TAG:string = ''\n\n /**\n * Declare boolean attributes that should be reflected as properties.\n * The base class auto-generates getters/setters and includes these in\n * `observedAttributes`. Framework property assignment (e.g. Preact's\n * `el.disabled = true`) will then correctly set the attribute.\n */\n static reflectedBooleanAttributes:string[] = []\n\n /**\n * Declare string attributes that should be reflected as properties.\n * Getter returns `string|null` (null when attribute is absent).\n * Setting `null` or `undefined` removes the attribute.\n */\n static reflectedStringAttributes:string[] = []\n\n /**\n * Auto-derived from `reflectedBooleanAttributes` and\n * `reflectedStringAttributes`. Override with `super.observedAttributes`\n * to add non-reflected observed attributes:\n *\n * ```ts\n * static get observedAttributes () {\n * return [...super.observedAttributes, 'aria-label']\n * }\n * ```\n */\n static get observedAttributes ():string[] {\n return [...new Set([\n ...this.reflectedBooleanAttributes,\n ...this.reflectedStringAttributes,\n ])]\n }\n\n static match (el:HTMLElement):HTMLElement|null {\n return _match(el, this.TAG)\n }\n\n static create<T extends string> (elementName:T):typeof WebComponent & {\n new (...args:any[]):WebComponent & { TAG:T };\n TAG:T;\n define: typeof WebComponent.define;\n event: typeof WebComponent.event;\n } {\n const CreatedClass = class extends WebComponent {\n static TAG = elementName\n TAG = elementName\n render () {\n throw new Error('`render` should be implemented by children')\n }\n }\n\n // Copy static methods with proper binding\n CreatedClass.define = function () {\n return WebComponent.define.call(this)\n }\n CreatedClass.event = function (evType:string) {\n return WebComponent.event.call(this, evType)\n }\n\n return CreatedClass\n }\n\n static define<T extends {\n new (...args:any[]):WebComponent;\n TAG:string;\n }>(this:T) {\n define(this.TAG, this)\n }\n\n /**\n * Runs when the value of an attribute is changed.\n *\n * Depends on `static observedAttributes`.\n *\n * Should name methods like `handleChange_disabled`.\n *\n * @param {string} name The attribute name\n * @param {string} oldValue The old attribute value\n * @param {string} newValue The new attribute value\n */\n attributeChangedCallback (\n name:string,\n oldValue:string,\n newValue:string\n ):void {\n const handler = this[handlerKey(name)]\n if (handler) {\n handler.call(this, oldValue, newValue)\n }\n }\n\n connectedCallback () {\n this.render()\n }\n\n abstract render ():any\n\n qs<K extends keyof HTMLElementTagNameMap>(\n selector:K\n ):HTMLElementTagNameMap[K]|null;\n\n qs<E extends Element = Element>(selector:string):E|null;\n qs (selector:string):Element|null {\n return this.querySelector(selector)\n }\n\n qsa<K extends keyof HTMLElementTagNameMap>(\n selector:K\n ):HTMLElementTagNameMap[K]|null;\n\n qsa<E extends Element = Element>(selector:string):E|null;\n qsa (selector:string):NodeListOf<Element> {\n return this.querySelectorAll(selector)\n }\n\n /**\n * Take a non-namepsaced event name, return namespace event name.\n *\n * @param {string} evType The non-namespace event name\n * @returns {string} Namespaced event name, eg, `my-component:click`\n */\n static event (evType:string):string {\n return eventName(this.TAG, evType)\n }\n\n /**\n * Emit a namespaced event.\n *\n * @param type (non-namespaced) event type string\n * @param opts `bubbles`, `detail`, and `cancelable`. Default is\n * `{ bubbles: true, cancelable: true }`\n * @returns {boolean}\n */\n emit<T = any> (type:string, opts:Partial<{\n bubbles:boolean,\n cancelable:boolean,\n detail:CustomEvent<T>['detail']\n }> = {}):boolean {\n if (type === '*') throw new Error('Do not emit the literal \"*\"')\n\n const { bubbles = true, cancelable = true, detail } = opts\n const namespacedType = `${this.TAG}:${type}`\n\n const event = new CustomEvent(namespacedType, {\n bubbles,\n cancelable,\n detail\n })\n\n return this.dispatchEvent(event)\n }\n\n /**\n * Create and emit an event, no namespacing.\n */\n dispatch<T> (type:string, opts:Partial<{\n bubbles:boolean,\n cancelable:boolean,\n detail:CustomEvent<T>['detail']\n }> = {}):boolean {\n const event = new CustomEvent(type, {\n bubbles: (opts.bubbles === undefined) ? true : opts.bubbles,\n cancelable: (opts.cancelable === undefined) ? true : opts.cancelable,\n detail: opts.detail\n })\n\n return this.dispatchEvent(event)\n }\n\n /**\n * Listen for namespaced events.\n */\n on<T extends Event = Event> (\n evName:string,\n handler:(ev:T)=>any,\n options?:boolean|AddEventListenerOptions\n ):void;\n\n on (\n evName:string,\n handler:EventListenerObject,\n options?:boolean|AddEventListenerOptions\n ):void;\n\n on (\n evName:string,\n handler:((ev:Event)=>any)|EventListenerObject,\n options?:boolean|AddEventListenerOptions\n ):void {\n const fullEvName = WebComponent.event.call(this, evName)\n this.addEventListener(fullEvName, handler as EventListenerOrEventListenerObject, options)\n }\n\n /**\n * Remove a namespaced event listener.\n */\n off<T extends Event = Event> (\n evName:string,\n handler:(ev:T)=>any,\n options?:boolean|EventListenerOptions\n ):void;\n\n off (\n evName:string,\n handler:EventListenerObject,\n options?:boolean|EventListenerOptions\n ):void;\n\n off (\n evName:string,\n handler:((ev:Event)=>any)|EventListenerObject,\n options?:boolean|EventListenerOptions\n ):void {\n const fullEvName = WebComponent.event.call(this, evName)\n this.removeEventListener(fullEvName, handler as EventListenerOrEventListenerObject, options)\n }\n}\n\nfunction eventName (namespace:string, evType:string) {\n return `${namespace}:${evType}`\n}\n\n/**\n * Cache of attribute name -> handler method name (`handleChange_<attr>`).\n * Building the lookup string once per attribute avoids re-allocating it on\n * every `attributeChangedCallback`.\n */\nconst handlerKeys:Record<string, string> = Object.create(null)\nfunction handlerKey (name:string):string {\n return handlerKeys[name] || (handlerKeys[name] = `handleChange_${name}`)\n}\n\n/**\n * Check if the given tag name has been registered.\n *\n * @see {@link https://stackoverflow.com/a/28210364 stackoverflow}\n * @param {string} elName The custom element tag name.\n * @returns {boolean} True if the given name has been registered already.\n */\nexport function isRegistered (elName:string):boolean {\n return document.createElement(elName).constructor !== window.HTMLElement\n}\n\nexport function define (name:string, element:CustomElementConstructor) {\n if (typeof window === 'undefined') return\n if (!('customElements' in window)) return\n if (isRegistered(name)) return\n\n const ctor = element as unknown as typeof WebComponent\n const boolAttrs:string[] = ctor.reflectedBooleanAttributes ?? []\n const strAttrs:string[] = ctor.reflectedStringAttributes ?? []\n const proto = (element as any).prototype\n\n for (const attr of boolAttrs) {\n // Skip built-in IDL attributes on HTMLElement and ancestors\n // (covers Element.prototype, Node.prototype, etc.)\n if (attr in HTMLElement.prototype) continue\n // Skip if the subclass already defines an own-property accessor\n if (Object.getOwnPropertyDescriptor(proto, attr)) continue\n Object.defineProperty(proto, attr, {\n get (this:HTMLElement):boolean {\n return this.hasAttribute(attr)\n },\n set (this:HTMLElement, v:unknown) {\n this.toggleAttribute(attr, Boolean(v))\n },\n configurable: true,\n enumerable: true,\n })\n }\n\n for (const attr of strAttrs) {\n if (boolAttrs.includes(attr)) {\n console.warn(\n `[web-component] \"${attr}\" appears in both ` +\n 'reflectedBooleanAttributes and reflectedStringAttributes ' +\n `on <${name}>. Boolean wins.`\n )\n continue\n }\n if (attr in HTMLElement.prototype) continue\n if (Object.getOwnPropertyDescriptor(proto, attr)) continue\n Object.defineProperty(proto, attr, {\n get (this:HTMLElement):string|null {\n return this.getAttribute(attr)\n },\n set (this:HTMLElement, v:unknown) {\n // null and undefined both remove the attribute\n if (v == null) {\n this.removeAttribute(attr)\n } else {\n this.setAttribute(attr, String(v))\n }\n },\n configurable: true,\n enumerable: true,\n })\n }\n\n window.customElements.define(name, element)\n}\n", "/* This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n *\n * Copyright (c) 2026 Jake Lazaroff\n *\n * Repository: https://tangled.org/jakelazaroff.com/actor-typeahead\n */\n\nimport { WebComponent } from '@substrate-system/web-component'\n\n// for document.querySelector\ndeclare global {\n interface HTMLElementTagNameMap {\n 'actor-typeahead':ActorTypeahead\n }\n}\n\nexport interface Actor {\n handle:string;\n avatar?:string;\n}\n\nconst DEFAULT_HOST = 'https://public.api.bsky.app'\nconst DEFAULT_ROWS = 5\n\n// how long the Query must stay unchanged before a Typeahead request\nconst DEBOUNCE_MS = 150\n\n// The Suggestion list is a top-layer popover, positioned against the host\n// with CSS anchor positioning. `anchor-scope` shipped last of that set, so\n// it gates the group. Without it, the old absolute layout is used.\nconst ANCHORED = typeof CSS !== 'undefined' &&\n CSS.supports('anchor-scope: --a')\n\n// counts instances, so each one gets unique element ids\nlet instances = 0\n\n/**\n * @attribute {string} [host] - The host to which to make the typeahead\n * API call.\n * @attribute {number} [rows] - The maximum number of Suggestions to\n * display in the Suggestion list.\n *\n * @fires actor-typeahead:select - A Suggestion was chosen from the\n * Suggestion list. The event `detail` is `{ handle, avatar }`.\n *\n * @cssprop --color-background - Controls the color of the Suggestion list\n * background.\n * @cssprop --color-border - Controls the color of the Suggestion list\n * border.\n * @cssprop --color-shadow - Controls the color of the Suggestion list\n * shadow.\n * @cssprop --color-hover - Controls the background color of each\n * Suggestion on hover.\n * @cssprop --color-avatar-fallback - Controls the background color of an\n * avatar circle if the image fails to load.\n * @cssprop --radius - Controls the corner radius of the Suggestion list.\n * @cssprop --padding-suggestion-list - Controls the padding of the\n * Suggestion list.\n *\n * @summary A small web component that progressively enhances an <input>\n * element into an autocomplete for ATProto handles.\n *\n * @tag actor-typeahead\n */\nexport class ActorTypeahead extends WebComponent.create('actor-typeahead') {\n static reflectedStringAttributes = ['host', 'rows']\n\n declare host:string|null\n declare rows:string|null\n\n /**\n * Returns the text announced when a Typeahead request settles with\n * `count` Suggestions, including 0 when nothing matched the Query.\n * Defaults to English. Replace it to translate; the replacement\n * handles plurals and 0. Read at announce time, so it can be set\n * after connect.\n */\n announce:(count:number) => string = defaultAnnounce\n\n #id = `actor-typeahead-${++instances}`\n #actors:Actor[] = []\n #index = -1\n #suggestionList:HTMLDivElement|null = null\n #suggestionCount:HTMLDivElement|null = null\n #nbsp = false\n #timer:ReturnType<typeof setTimeout>|undefined\n #controller:AbortController|null = null\n\n constructor () {\n super()\n this.addEventListener('input', this)\n this.addEventListener('focusout', this)\n this.addEventListener('keydown', this)\n }\n\n /**\n * Stop any pending Typeahead request. The Suggestion list is left as\n * is; the next Query rebuilds it.\n */\n disconnectedCallback () {\n this.#cancel()\n }\n\n get #limit ():number {\n const rows = Number.parseInt(this.rows ?? '')\n return Number.isNaN(rows) ? DEFAULT_ROWS : rows\n }\n\n handleEvent (evt:Event) {\n switch (evt.type) {\n case 'input':\n this.#oninput(evt)\n break\n\n case 'keydown':\n if (evt instanceof KeyboardEvent) this.#onkeydown(evt)\n break\n\n case 'focusout':\n if (evt instanceof FocusEvent) this.#onfocusout(evt)\n break\n\n case 'mousedown':\n // a press or a tap keeps focus on the Authored input\n evt.preventDefault()\n break\n\n case 'click':\n this.#onclick(evt)\n break\n }\n }\n\n #onkeydown (evt:KeyboardEvent) {\n const last = this.#actors.length - 1\n const moves = ['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp']\n // with no Suggestions there is nothing to move to, and a render\n // would empty a \"No Suggestions\" announcement\n if (last < 0 && moves.includes(evt.key)) {\n evt.preventDefault()\n return\n }\n\n switch (evt.key) {\n case 'ArrowDown':\n evt.preventDefault()\n this.#index = Math.min(this.#index + 1, last)\n this.render()\n break\n\n case 'PageDown':\n evt.preventDefault()\n this.#index = last\n this.render()\n break\n\n case 'ArrowUp':\n evt.preventDefault()\n // wrap from nothing Highlighted to the last Suggestion,\n // and from the first back to nothing (the APG pattern)\n this.#index = this.#index < 0 ? last : this.#index - 1\n this.render()\n break\n\n case 'PageUp':\n evt.preventDefault()\n this.#index = 0\n this.render()\n break\n\n case 'Escape':\n // with the list closed, let a dialog close; still cancel\n // any pending Typeahead request\n if (this.#actors.length) evt.preventDefault()\n this.#clear()\n break\n\n case 'Enter':\n // with nothing Highlighted, let the form submit, and\n // drop any pending Typeahead request\n if (!this.#actors[this.#index]) {\n this.#cancel()\n break\n }\n evt.preventDefault()\n this.#select(this.#index)\n break\n }\n }\n\n #oninput (evt:Event) {\n if (!(evt.target instanceof HTMLInputElement)) return\n\n const query = evt.target.value\n if (!query) {\n this.#clear()\n return\n }\n\n // keep the current Suggestions on screen until the new response\n this.#cancel()\n this.#timer = setTimeout(() => this.#request(query), DEBOUNCE_MS)\n }\n\n async #request (query:string) {\n this.#timer = undefined\n const url = new URL(\n 'xrpc/app.bsky.actor.searchActorsTypeahead',\n this.host ?? DEFAULT_HOST\n )\n url.searchParams.set('q', query)\n url.searchParams.set('limit', String(this.#limit))\n\n const controller = new AbortController()\n this.#controller = controller\n const { signal } = controller\n\n let json:unknown\n try {\n const res = await fetch(url, { signal })\n if (signal.aborted) return\n if (!res.ok) throw new Error(`status ${res.status}`)\n json = await res.json()\n } catch (err) {\n // a newer Query, or a close, cancelled this request\n if (isAbortError(err)) return\n // any other failure closes the Suggestion list, quietly\n this.#clear()\n return\n }\n if (signal.aborted) return\n\n this.#actors = parseActors(json)\n this.#index = -1\n // after render(), which empties the count when there are none\n this.render()\n this.#announce(this.#actors.length)\n }\n\n /**\n * Write the Suggestion count. A trailing no-break space alternates\n * between writes, so screen readers re-read an identical count.\n */\n #announce (count:number) {\n if (!this.#suggestionCount) return\n this.#nbsp = !this.#nbsp\n this.#suggestionCount.textContent = this.announce(count) +\n (this.#nbsp ? '\\u00a0' : '')\n }\n\n /**\n * Close only when focus leaves the host. Some assistive technology\n * focuses a Suggestion before it sends the click that selects it.\n */\n #onfocusout (evt:FocusEvent) {\n const next = evt.relatedTarget\n if (next instanceof Node && this.contains(next)) return\n this.#clear()\n }\n\n #onclick (evt:Event) {\n const option = evt.target instanceof Element ?\n evt.target.closest<HTMLElement>('[role=\"option\"]') :\n null\n if (!option) return\n\n this.#select(Number(option.dataset.index))\n }\n\n #select (index:number) {\n const actor = this.#actors[index]\n const input = this.qs('input')\n if (!actor || !input) return\n\n input.value = actor.handle\n input.focus()\n this.#clear()\n this.emit<Actor>('select', { detail: actor })\n }\n\n /**\n * Stop any pending Typeahead request: the debounce timer, and the\n * request in flight, whose response is then dropped.\n */\n #cancel () {\n clearTimeout(this.#timer)\n this.#timer = undefined\n this.#controller?.abort()\n this.#controller = null\n }\n\n #clear () {\n this.#cancel()\n this.#actors = []\n this.#index = -1\n this.render()\n }\n\n /**\n * Render into light DOM. Only the suggestion list is rebuilt,\n * so the input element, and anything the consumer attached to it,\n * is never replaced. On the input, only the\n * ARIA combobox attributes are written, plus `autocomplete=\"off\"`\n * when the page did not set `autocomplete`.\n */\n render () {\n if (!this.#suggestionList) {\n this.#suggestionList = document.createElement('div')\n this.#suggestionList.className = 'suggestion-list'\n this.#suggestionList.id = `${this.#id}-list`\n this.#suggestionList.setAttribute('role', 'listbox')\n if (ANCHORED) this.#suggestionList.popover = 'manual'\n this.#suggestionList.addEventListener('mousedown', this)\n this.#suggestionList.addEventListener('click', this)\n }\n\n const list = this.#suggestionList\n if (list.parentNode !== this) this.append(list)\n\n // the live region exists empty before its first write, because\n // screen readers often skip a region inserted already filled\n if (!this.#suggestionCount) {\n this.#suggestionCount = document.createElement('div')\n this.#suggestionCount.className = 'suggestion-count'\n this.#suggestionCount.setAttribute('role', 'status')\n }\n const count = this.#suggestionCount\n if (count.parentNode !== this) this.append(count)\n // only a response writes the count; any close empties it, and a\n // response with no Suggestions writes it after this render\n if (!this.#actors.length) count.textContent = ''\n\n list.replaceChildren(...this.#actors.map((actor, i) => {\n const option = suggestion(actor, i, i === this.#index)\n option.id = this.#optionId(i)\n return option\n }))\n\n const open = this.#toggle(list, this.#actors.length > 0)\n\n const input = this.qs('input')\n if (input) {\n input.setAttribute('role', 'combobox')\n input.setAttribute('aria-autocomplete', 'list')\n if (!input.hasAttribute('autocomplete')) {\n input.setAttribute('autocomplete', 'off')\n }\n input.setAttribute('aria-controls', list.id)\n input.setAttribute('aria-expanded', String(open))\n\n // the Suggestion list carries at most one of the two\n const name = nameSource(input, this)\n for (const attr of ['aria-labelledby', 'aria-label'] as const) {\n const value = name[attr]\n if (value) list.setAttribute(attr, value)\n else list.removeAttribute(attr)\n }\n\n if (this.#actors[this.#index]) {\n input.setAttribute(\n 'aria-activedescendant',\n this.#optionId(this.#index)\n )\n } else {\n input.removeAttribute('aria-activedescendant')\n }\n }\n }\n\n /**\n * Show or hide the Suggestion list popover, guarded on its current\n * state so repeated renders neither throw nor toggle. A disconnected\n * popover cannot be shown, e.g. when a response arrives after the host\n * was removed. Returns whether the Suggestion list is open.\n */\n #toggle (list:HTMLElement, open:boolean):boolean {\n if (!ANCHORED) return open\n if (!list.isConnected) return false\n\n const isOpen = list.matches(':popover-open')\n if (open && !isOpen) list.showPopover()\n if (!open && isOpen) list.hidePopover()\n return list.matches(':popover-open')\n }\n\n #optionId (index:number):string {\n return `${this.#id}-option-${index}`\n }\n}\n\nActorTypeahead.define()\n\n/**\n * Build one Suggestion. Values from the API go through `textContent` and\n * properties, never through `innerHTML`.\n */\nfunction suggestion (\n actor:Actor,\n index:number,\n active:boolean\n):HTMLButtonElement {\n const button = document.createElement('button')\n // a button, so every input method can activate it, but not a\n // submit button, and out of the tab order, because focus stays on\n // the Authored input\n button.type = 'button'\n button.tabIndex = -1\n button.className = 'suggestion'\n button.setAttribute('role', 'option')\n button.setAttribute('aria-selected', String(active))\n button.dataset.index = String(index)\n button.dataset.handle = actor.handle\n\n const avatar = document.createElement('div')\n avatar.className = 'avatar'\n\n const img = document.createElement('img')\n img.className = 'img'\n img.alt = ''\n if (actor.avatar) img.src = actor.avatar\n\n const handle = document.createElement('span')\n handle.className = 'handle'\n handle.textContent = actor.handle\n\n avatar.append(img)\n button.append(avatar, handle)\n\n return button\n}\n\n/**\n * What names the Authored input, in the order of accessible name\n * computation, as the attribute the Suggestion list copies it to.\n */\nfunction nameSource (input:HTMLInputElement, host:HTMLElement):{\n 'aria-labelledby'?:string;\n 'aria-label'?:string;\n} {\n const labelledby = input.getAttribute('aria-labelledby')\n if (labelledby) return { 'aria-labelledby': labelledby }\n\n const label = input.getAttribute('aria-label')\n if (label) return { 'aria-label': label }\n\n // reference the labels when they all have ids, otherwise copy their\n // text, because the component never writes ids onto the page\n const labels = [...(input.labels ?? [])]\n if (!labels.length) return {}\n if (labels.every(label => label.id)) {\n return {\n 'aria-labelledby': labels.map(label => label.id).join(' ')\n }\n }\n\n const text = labels\n .map(label => labelText(label, host).trim())\n .filter(Boolean)\n .join(' ')\n return text ? { 'aria-label': text } : {}\n}\n\n/**\n * The text of a label, without the Host element's content, which a\n * label that wraps the Host element would otherwise include.\n */\nfunction labelText (label:HTMLLabelElement, host:HTMLElement):string {\n const walker = document.createTreeWalker(label, NodeFilter.SHOW_TEXT, {\n acceptNode: node => host.contains(node) ?\n NodeFilter.FILTER_REJECT :\n NodeFilter.FILTER_ACCEPT\n })\n\n let text = ''\n while (walker.nextNode()) text += walker.currentNode.nodeValue\n return text\n}\n\n/**\n * The default English Suggestion count announcement.\n */\nfunction defaultAnnounce (count:number):string {\n if (count === 0) return 'No Suggestions'\n return count === 1 ?\n '1 Suggestion available' :\n `${count} Suggestions available`\n}\n\nfunction parseActors (json:unknown):Actor[] {\n if (!isRecord(json) || !Array.isArray(json.actors)) return []\n\n return json.actors.flatMap((actor:unknown) => {\n if (!isRecord(actor) || typeof actor.handle !== 'string') return []\n\n return [typeof actor.avatar === 'string' ?\n { handle: actor.handle, avatar: actor.avatar } :\n { handle: actor.handle }]\n })\n}\n\nfunction isAbortError (err:unknown):boolean {\n return err instanceof DOMException && err.name === 'AbortError'\n}\n\nfunction isRecord (value:unknown):value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n"],
5
+ "mappings": "sKASO,SAASA,EAAcC,EAAoB,CAC9C,OAAO,OAAO,KAAKA,CAAK,EAAE,OAAO,CAACC,EAAKC,IAAM,CACzC,IAAMC,EAAQH,EAAME,CAAC,EACrB,OAAKC,EAED,OAAOA,GAAU,UACbA,GAAeF,EAAM,IAAIC,CAAC,IAAI,KAAK,EAChCD,EAGP,MAAM,QAAQE,CAAK,EACXF,EAAM,IAAIC,CAAC,KAAKC,EAAM,KAAK,GAAG,CAAC,KAGnCF,EAAM,IAAIC,CAAC,KAAKC,CAAK,KAAK,KAAK,EAXpBF,CAYvB,EAAG,EAAE,CACT,CAhBgBG,EAAAL,EAAA,gBAAAK,EAAAL,EAAA,cAAA,yFCGT,SAASM,EAAIC,EAA+B,CAC/C,OAAO,SAAS,cAAcA,CAA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6D,GAAQP,EAAK,SAASO,CAAI,EAClC,WAAW,cACX,WAAW,cAFH,aAGhB,CAAC,EAEGH,EAAO,GACX,KAAOE,EAAO,SAAS,GAAGF,GAAQE,EAAO,YAAY,UACrD,OAAOF,CACX,CAVS1D,EAAA2D,EAAA,aAeT,SAAS1D,EAAiBgC,EAAqB,CAC3C,OAAIA,IAAU,EAAU,iBACjBA,IAAU,EACb,yBACA,GAAGA,CAAK,wBAChB,CALSjC,EAAAC,EAAA,mBAOT,SAAS8B,EAAaJ,EAAsB,CACxC,MAAI,CAACmC,EAASnC,CAAI,GAAK,CAAC,MAAM,QAAQA,EAAK,MAAM,EAAU,CAAC,EAErDA,EAAK,OAAO,QAASU,GACpB,CAACyB,EAASzB,CAAK,GAAK,OAAOA,EAAM,QAAW,SAAiB,CAAC,EAE3D,CAAC,OAAOA,EAAM,QAAW,SAC5B,CAAE,OAAQA,EAAM,OAAQ,OAAQA,EAAM,MAAO,EAC7C,CAAE,OAAQA,EAAM,MAAO,CAAC,CAC/B,CACL,CAVSrC,EAAA+B,EAAA,eAYT,SAASD,EAAcD,EAAqB,CACxC,OAAOA,aAAe,cAAgBA,EAAI,OAAS,YACvD,CAFS7B,EAAA8B,EAAA,gBAIT,SAASgC,EAAUf,EAAgD,CAC/D,OAAO,OAAOA,GAAU,UAAYA,IAAU,IAClD,CAFS/C,EAAA8D,EAAA",
6
+ "names": ["toAttributes", "attrs", "acc", "k", "value", "__name", "qs", "selectors", "__name", "qsa", "selectors", "__name", "isRegistered", "elName", "__name", "define", "name", "element", "match", "el", "s", "WebComponent", "_WebComponent", "__name", "el", "match", "elementName", "CreatedClass", "evType", "define", "name", "oldValue", "newValue", "handler", "handlerKey", "selector", "eventName", "type", "opts", "bubbles", "cancelable", "detail", "namespacedType", "event", "evName", "options", "fullEvName", "namespace", "handlerKeys", "isRegistered", "elName", "element", "ctor", "boolAttrs", "strAttrs", "proto", "attr", "v", "DEFAULT_HOST", "DEFAULT_ROWS", "DEBOUNCE_MS", "ANCHORED", "instances", "ActorTypeahead", "WebComponent", "__name", "defaultAnnounce", "#id", "#actors", "#index", "#suggestionList", "#suggestionCount", "#nbsp", "#timer", "#controller", "#cancel", "#limit", "rows", "evt", "#oninput", "#onkeydown", "#onfocusout", "#onclick", "last", "moves", "#clear", "#select", "query", "#request", "url", "controller", "signal", "json", "res", "err", "isAbortError", "parseActors", "#announce", "count", "next", "option", "index", "actor", "input", "list", "suggestion", "#optionId", "open", "#toggle", "name", "nameSource", "attr", "value", "isOpen", "active", "button", "avatar", "img", "handle", "host", "labelledby", "label", "labels", "text", "labelText", "walker", "node", "isRecord"]
7
7
  }