From dbd990a2fe48304cff0a9eef77b8b007c4d827bb Mon Sep 17 00:00:00 2001 From: Kai Date: Fri, 14 Mar 2025 21:15:03 +0100 Subject: [PATCH 1/6] feat: add .focus() function on component --- src/Component.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Component.ts b/src/Component.ts index a1971a4..1c6e5aa 100644 --- a/src/Component.ts +++ b/src/Component.ts @@ -89,6 +89,16 @@ export class Component extends ElementCompo return new Component(element); } + /** + * Puts the element into + * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus Focus} + * @param options + */ + public focus(options?: FocusOptions): this { + this.node.focus(options); + return this; + } + /** * Set style property * @param name Property name From a035b5662b43f5f7841b4a172b90c282ebbecdaa Mon Sep 17 00:00:00 2001 From: Kai Date: Fri, 14 Mar 2025 21:19:06 +0100 Subject: [PATCH 2/6] fix: typeof this instead of just this --- src/Component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Component.ts b/src/Component.ts index 1c6e5aa..7fc80cd 100644 --- a/src/Component.ts +++ b/src/Component.ts @@ -94,7 +94,7 @@ export class Component extends ElementCompo * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus Focus} * @param options */ - public focus(options?: FocusOptions): this { + public focus(options?: FocusOptions): typeof this { this.node.focus(options); return this; } From aba12812a9f1fa5587e1e07042c14c743ced8580 Mon Sep 17 00:00:00 2001 From: Kai Date: Fri, 14 Mar 2025 23:07:29 +0100 Subject: [PATCH 3/6] docs: add jsdoc for options param --- src/Component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Component.ts b/src/Component.ts index 7fc80cd..2c7dd2b 100644 --- a/src/Component.ts +++ b/src/Component.ts @@ -92,7 +92,7 @@ export class Component extends ElementCompo /** * Puts the element into * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus Focus} - * @param options + * @param options - An optional object for controlling aspects of the focusing process. */ public focus(options?: FocusOptions): typeof this { this.node.focus(options); From 6b03d63ce6cc95dc00c4180deff14560d9d5d25e Mon Sep 17 00:00:00 2001 From: Kai Date: Fri, 14 Mar 2025 23:25:42 +0100 Subject: [PATCH 4/6] Revert "Merge branch 'main' into 65-add-focus" This reverts commit 734729ab9aa2d0f07b37d911dfa37a04ad9d72e4, reversing changes made to aba12812a9f1fa5587e1e07042c14c743ced8580. --- src/Component.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Component.ts b/src/Component.ts index 0a560ad..2c7dd2b 100644 --- a/src/Component.ts +++ b/src/Component.ts @@ -89,15 +89,6 @@ export class Component extends ElementCompo return new Component(element); } - /** - * Test whether the element would be selected by the specified - * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors CSS selector}, or group of CSS selectors. - * @param selectors - */ - public is(selectors: string): boolean { - return this.node.matches(selectors); - } - /** * Puts the element into * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus Focus} From a673e7a679ea6e8793448db94f7fadf19fd7aa37 Mon Sep 17 00:00:00 2001 From: Kai Date: Fri, 14 Mar 2025 23:25:44 +0100 Subject: [PATCH 5/6] Reapply "Merge branch 'main' into 65-add-focus" This reverts commit 6b03d63ce6cc95dc00c4180deff14560d9d5d25e. --- src/Component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Component.ts b/src/Component.ts index 2c7dd2b..0a560ad 100644 --- a/src/Component.ts +++ b/src/Component.ts @@ -89,6 +89,15 @@ export class Component extends ElementCompo return new Component(element); } + /** + * Test whether the element would be selected by the specified + * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors CSS selector}, or group of CSS selectors. + * @param selectors + */ + public is(selectors: string): boolean { + return this.node.matches(selectors); + } + /** * Puts the element into * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus Focus} From c5481d273df240af16bbc6b298974a3bf620fac2 Mon Sep 17 00:00:00 2001 From: Kai Date: Fri, 14 Mar 2025 23:26:32 +0100 Subject: [PATCH 6/6] add a dot after the end of the sentence --- src/Component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Component.ts b/src/Component.ts index 0a560ad..6c4c981 100644 --- a/src/Component.ts +++ b/src/Component.ts @@ -100,7 +100,7 @@ export class Component extends ElementCompo /** * Puts the element into - * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus Focus} + * {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus focus}. * @param options - An optional object for controlling aspects of the focusing process. */ public focus(options?: FocusOptions): typeof this {