Skip to content

Commit c2b5b9d

Browse files
LuLaValvaagliga
authored andcommitted
refactor(ts): use Marko.HTML instead of Marko.Input when possible
1 parent b0b9786 commit c2b5b9d

File tree

76 files changed

+136
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+136
-133
lines changed

.changeset/healthy-ducks-sip.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ebay/ebayui-core": patch
3+
---
4+
5+
Refactor to simplify types

src/common/menu-utils/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface MenuItem extends Omit<Marko.Input<"button">, `on${string}`> {
1+
export interface MenuItem extends Omit<Marko.HTML.Button, `on${string}`> {
22
href?: string;
33
value?: string;
44
renderBody?: Marko.Body;

src/components/components/ebay-dialog-base/component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as eventUtils from "../../../common/event-utils";
66
import transition from "../../../common/transition";
77
import type { WithNormalizedProps } from "../../../global";
88

9-
interface DialogBaseInput extends Omit<Marko.Input<"div">, `on${string}`> {
9+
interface DialogBaseInput extends Omit<Marko.HTML.Div, `on${string}`> {
1010
"button-position"?: "right" | "left" | "bottom" | "hidden";
1111
"use-hidden-property"?: boolean;
1212
"base-el"?: string;
@@ -43,7 +43,7 @@ interface DialogBaseInput extends Omit<Marko.Input<"div">, `on${string}`> {
4343
"transition-el"?: "root" | "window";
4444
focus?: string;
4545
"prev-button"?: Marko.AttrTag<
46-
Omit<Marko.Input<"button">, `on${string}`> &
46+
Omit<Marko.HTML.Button, `on${string}`> &
4747
WithNormalizedProps<{
4848
"a11y-text"?: AttrString;
4949
}>

src/components/components/ebay-notice-base/component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AttrString, AttrClass } from "marko/tags-html";
22
import type { WithNormalizedProps } from "../../../global";
33

44
interface NoticeBaseInput
5-
extends Omit<Marko.Input<"section">, "title" | `on${string}`> {
5+
extends Omit<Marko.HTML.Section, "title" | `on${string}`> {
66
status?:
77
| "confirmation"
88
| "celebration"
@@ -23,12 +23,12 @@ interface NoticeBaseInput
2323
footer?: Marko.AttrTag<Marko.Renderable>;
2424
"a11y-dismiss-text"?: AttrString;
2525
title?: Marko.AttrTag<
26-
Marko.Input<"title"> & {
26+
Marko.HTML.Title & {
2727
as?: Marko.Renderable;
2828
}
2929
>;
3030
cta?: Marko.AttrTag<
31-
Marko.Input<"a"> & {
31+
Marko.HTML.A & {
3232
renderBody?: Marko.Renderable;
3333
}
3434
>;

src/components/components/ebay-tooltip-overlay/component-browser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ interface TooltipOverlayInput {
77
"style-left"?: string;
88
"style-right"?: string;
99
"style-bottom"?: string;
10-
heading?: Marko.Input<"span"> & {
10+
heading?: Marko.HTML.Span & {
1111
as?: keyof Marko.NativeTags;
1212
renderBody?: Marko.Body;
1313
} & Iterable<any>;
1414
id?: string;
1515
type: keyof typeof typeRoles;
16-
content?: Marko.AttrTag<Marko.Input<"span">>;
16+
content?: Marko.AttrTag<Marko.HTML.Span>;
1717
"a11y-close-text"?: AttrString;
1818
footer?: Marko.AttrTag<
1919
Marko.Renderable & {

src/components/ebay-area-chart/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ declare module "highcharts" {
2727
}
2828
}
2929

30-
interface AreaChartInput extends Omit<Marko.Input<"div">, `on${string}`> {
30+
interface AreaChartInput extends Omit<Marko.HTML.Div, `on${string}`> {
3131
title?: Highcharts.TitleOptions["text"];
3232
description?: Highcharts.SeriesAccessibilityOptionsObject["description"];
3333
series: Highcharts.SeriesAreaOptions | Highcharts.SeriesAreaOptions[];

src/components/ebay-avatar/index.marko

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import type { AttrString } from "marko/tags-html";
55

66
static type Size = 32 | 40 | 48 | 56 | 64 | 96 | 128;
77

8-
static interface AvatarInput extends Omit<Marko.Input<"div">, `on${string}`> {
8+
static interface AvatarInput extends Omit<Marko.HTML.Div, `on${string}`> {
99
username?: string;
1010
color?: string;
1111
"a11y-text"?: AttrString;
1212
size?: Size | `${Size}`;
13-
img?: Marko.AttrTag<Omit<Marko.Input<"img">, `on${string}`>>;
13+
img?: Marko.AttrTag<Omit<Marko.HTML.Img, `on${string}`>>;
1414
}
1515

1616
export interface Input extends WithNormalizedProps<AvatarInput> {}

src/components/ebay-badge/index.marko

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { processHtmlAttributes } from "../../common/html-attributes";
22
import type { AttrClass } from "marko/tags-html";
33
import type { WithNormalizedProps } from "../../global";
44

5-
static interface BadgeInput extends Marko.Input<"span"> {
5+
static interface BadgeInput extends Omit<Marko.HTML.Span, `on${string}`> {
66
type?: "menu" | "icon";
77
number?: number | string;
88
class?: AttrClass;

src/components/ebay-bar-chart/component.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ interface SeriesItem
2929
group?: string;
3030
}
3131

32-
interface BarChartInput
33-
extends Omit<Marko.Input<"div">, `on${string}` | "title"> {
32+
interface BarChartInput extends Omit<Marko.HTML.Div, `on${string}` | "title"> {
3433
title: Highcharts.TitleOptions["text"];
3534
description?: Highcharts.SeriesOptionsType["description"];
3635
"x-axis-label-format"?: Highcharts.XAxisLabelsOptions["format"];

src/components/ebay-breadcrumbs/component.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ import type { AttrClass, AttrString } from "marko/tags-html";
44
import type { MenuEvent } from "../ebay-menu/component";
55
import type { WithNormalizedProps } from "../../global";
66

7-
interface BreadcrumbsInput extends Omit<Marko.Input<"nav">, `on${string}`> {
7+
interface BreadcrumbsInput extends Omit<Marko.HTML.Nav, `on${string}`> {
88
"a11y-heading-tag"?: keyof Marko.NativeTags;
99
"a11y-heading-text"?: AttrString;
1010
"a11y-menu-button-text"?: AttrString;
1111
class?: AttrClass;
12-
items?: Marko.AttrTag<
13-
Marko.Input<"a"> | (Marko.Input<"button"> & { href: never })
14-
>;
12+
items?: Marko.AttrTag<Marko.HTML.A | (Marko.HTML.Button & { href: never })>;
1513
"on-select"?: (event: { originalEvent: Event; el: HTMLElement }) => void;
1614
}
1715

src/components/ebay-breadcrumbs/index.marko

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $ var anyHref = (items || []).some((element) => element.href != null);
3838
>
3939
<for|i| of=state.hiddenIndex>
4040
<@item
41-
type=(anyHref ? 'a' : 'button') as (Marko.Input<"button">["type"])
41+
type=(anyHref ? 'a' : 'button') as (Marko.HTML.Button["type"])
4242
...processHtmlAttributes(items[i])
4343
>
4444
<${items[i].renderBody}/>

src/components/ebay-button/index.marko

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface ButtonEvent<T extends Event> {
1010
originalEvent: T;
1111
}
1212

13-
export interface ButtonInput extends Omit<Marko.Input<"button">, `on${string}`> {
13+
export interface ButtonInput extends Omit<Marko.HTML.Button, `on${string}`> {
1414
href?: string;
1515
size?: (typeof validSizes)[number];
1616
priority?: "primary" | "secondary" | "tertiary" | "none";

src/components/ebay-carousel/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const LEFT = -1;
1414
const RIGHT = 1;
1515

1616
interface Item {
17-
htmlAttributes?: Marko.Input<"li">;
17+
htmlAttributes?: Marko.HTML.LI;
1818
key?: string;
1919
class?: AttrClass;
2020
style?: AttrStyle;

src/components/ebay-ccd/index.marko

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { processHtmlAttributes } from "../../common/html-attributes";
22
import type { WithNormalizedProps } from "../../global";
3-
static interface CCDInput extends Omit<Marko.Input<"div">, `on${string}`> {
3+
static interface CCDInput extends Omit<Marko.HTML.Div, `on${string}`> {
44
max?: string;
55
min?: string;
66
"charger-icon"?: "included" | "not-included";

src/components/ebay-character-count/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface CharacterCountEvent {
66
inputAriaLive: Marko.AriaAttributes["aria-live"];
77
}
88

9-
interface CharacterCountInput extends Omit<Marko.Input<"span">, `on${string}`> {
9+
interface CharacterCountInput extends Omit<Marko.HTML.Span, `on${string}`> {
1010
renderBody?: Marko.Body;
1111
value?: string | number;
1212
max: number;

src/components/ebay-checkbox/component-browser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface CheckboxEvent {
55
value: string;
66
checked: boolean;
77
}
8-
interface CheckboxInput extends Omit<Marko.Input<"input">, `on${string}`> {
8+
interface CheckboxInput extends Omit<Marko.HTML.Input, `on${string}`> {
99
"icon-style"?: "rounded" | "square";
1010
"on-change"?: (e: CheckboxEvent) => void;
1111
"on-focus"?: (e: CheckboxEvent) => void;

src/components/ebay-chip/index.marko

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { processHtmlAttributes } from "../../common/html-attributes";
22
import type { WithNormalizedProps } from "../../global";
33
import type { AttrBoolean, AttrString } from "marko/tags-html";
44

5-
static interface ChipInput extends Omit<Marko.Input<"span">, `on${string}`> {
5+
static interface ChipInput extends Omit<Marko.HTML.Span, `on${string}`> {
66
renderBody?: Marko.Body;
77
disabled?: AttrBoolean;
88
"a11y-delete-button-text"?: AttrString;

src/components/ebay-chips-combobox/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface ChipsComboboxEvent {
66
selected: string[];
77
}
88

9-
interface ChipsComboboxInput extends Omit<Marko.Input<"input">, `on${string}`> {
9+
interface ChipsComboboxInput extends Omit<Marko.HTML.Input, `on${string}`> {
1010
expanded?: boolean;
1111
fluid?: boolean;
1212
error?: boolean;

src/components/ebay-combobox/component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ export interface ComboboxEvent {
2020
options: Input["options"];
2121
}
2222

23-
interface ComboboxInput extends Omit<Marko.Input<"input">, `on${string}`> {
23+
interface ComboboxInput extends Omit<Marko.HTML.Input, `on${string}`> {
2424
expanded?: boolean;
2525
borderless?: boolean;
2626
fluid?: boolean;
2727
autocomplete?: "list" | "none";
2828
"list-selection"?: "manual" | "automatic";
2929
"floating-label"?: AttrString;
3030
"view-all-options"?: boolean;
31-
button?: Marko.Input<"button"> &
31+
button?: Marko.HTML.Button &
3232
Marko.AttrTag<{
3333
htmlAttributes?: Record<string, unknown>;
3434
renderBody?: Marko.Body;

src/components/ebay-cta-button/index.marko

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { processHtmlAttributes } from "../../common/html-attributes"
22
import type { WithNormalizedProps } from "../../global";
33

4-
static interface CtaButtonInput extends Marko.Input<"a"> {
4+
static interface CtaButtonInput extends Marko.HTML.A {
55
size?: "default" | "large";
66
}
77

src/components/ebay-details/component-browser.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { WithNormalizedProps } from "../../global";
22

3-
export interface DetailsInput
4-
extends Omit<Marko.Input<"details">, `on${string}`> {
3+
export interface DetailsInput extends Omit<Marko.HTML.Details, `on${string}`> {
54
text: string;
65
size?: "regular" | "small";
76
alignment?: "regular" | "center";

src/components/ebay-donut-chart/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface SeriesDonutOptions extends Omit<Highcharts.SeriesOptions, "type"> {
1717
}
1818

1919
interface DonutChartInput
20-
extends Omit<Marko.Input<"div">, `on${string}` | "title"> {
20+
extends Omit<Marko.HTML.Div, `on${string}` | "title"> {
2121
title?: Marko.AttrTag<Marko.Renderable>;
2222
metricValue?: Marko.AttrTag<Marko.Renderable>;
2323
metricLabel?: Marko.AttrTag<Marko.Renderable>;

src/components/ebay-eek/eek-util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const validRanges = {
77
A: ["G"],
88
};
99

10-
interface EekInput extends Omit<Marko.Input<"div">, `on${string}`> {
10+
interface EekInput extends Omit<Marko.HTML.Div, `on${string}`> {
1111
max: string;
1212
min: string;
1313
rating: string;

src/components/ebay-fake-link/component-browser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as eventUtils from "../../common/event-utils";
22
import type { WithNormalizedProps } from "../../global";
33

4-
interface FakeLinkInput extends Omit<Marko.Input<"button">, `on${string}`> {
4+
interface FakeLinkInput extends Omit<Marko.HTML.Button, `on${string}`> {
55
variant?: "inline" | "standalone";
66
"on-click"?: (event: { originalEvent: MouseEvent }) => void;
77
"on-escape"?: (event: { originalEvent: KeyboardEvent }) => void;

src/components/ebay-fake-menu-button/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
import type { WithNormalizedProps } from "../../global";
99
import type { AttrString } from "marko/tags-html";
1010

11-
interface FakeMenuButtonInput extends Omit<Marko.Input<"span">, `on${string}`> {
11+
interface FakeMenuButtonInput extends Omit<Marko.HTML.Span, `on${string}`> {
1212
text?: AttrString;
1313
size?: "none" | "large";
1414
"prefix-id"?: string;

src/components/ebay-fake-menu/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface Item extends MenuItem {
2323
export interface Separator {}
2424
interface FakeMenuInput
2525
extends BaseMenuInput,
26-
Omit<Marko.Input<"span">, `on${string}`> {
26+
Omit<Marko.HTML.Span, `on${string}`> {
2727
items?: Marko.AttrTag<Item>;
2828
separator?: Marko.AttrTag<Separator>;
2929
"class-prefix"?: string;

src/components/ebay-fake-tabs/index.marko

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ $ const {
1010
...htmlInput
1111
} = input;
1212

13-
export interface Tab extends Marko.Input<"li"> {
13+
export interface Tab extends Omit<Marko.HTML.LI, `on${string}`> {
1414
href: string;
1515
}
1616

17-
static interface FakeTabsInput extends Omit<Marko.Input<"div">, `on${string}`> {
17+
static interface FakeTabsInput extends Omit<Marko.HTML.Div, `on${string}`> {
1818
"selected-index"?: number;
1919
tabs?: Marko.AttrTag<Tab>;
2020
"tab-matches-current-url"?: boolean;
2121
}
2222

2323
export interface Input extends WithNormalizedProps<FakeTabsInput> {}
2424

25-
$ var tabAriaCurrent: Marko.Input<"li">['aria-current'] = tabMatchesCurrentUrl === false ? "true" : "page";
25+
$ var tabAriaCurrent: Marko.HTML.LI['aria-current'] = tabMatchesCurrentUrl === false ? "true" : "page";
2626

2727
<div
2828
...processHtmlAttributes(htmlInput)

src/components/ebay-file-input/component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ export interface FileInputEvent {
66
}
77

88
interface FileInputInput
9-
extends Omit<Marko.Input<"input">, `on${string}` | "type"> {
9+
extends Omit<Marko.HTML.Input, `on${string}` | "type"> {
1010
renderBody?: Marko.Body;
1111
header?: Marko.AttrTag<
1212
Marko.Input<`h${number}`> & {
1313
as?: `h${number}`;
1414
}
1515
>;
16-
subheader?: Marko.AttrTag<Marko.Input<"span">>;
16+
subheader?: Marko.AttrTag<Marko.HTML.Span>;
1717
"on-input"?: (event: FileInputEvent) => void;
1818
}
1919

src/components/ebay-file-preview-card/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type FilePreviewCardMenuAction = {
1313
label: string;
1414
};
1515

16-
interface FilePreviewCardInput extends Omit<Marko.Input<"div">, `on${string}`> {
16+
interface FilePreviewCardInput extends Omit<Marko.HTML.Div, `on${string}`> {
1717
"a11y-cancel-upload-text"?: AttrString;
1818
"delete-text"?: AttrString;
1919
as?: keyof Marko.NativeTags;

src/components/ebay-filter-menu-button/component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ export interface FilterMenuButtonEvent {
1919

2020
interface FilterMenuButtonInput
2121
extends BaseMenuInput,
22-
Omit<Marko.Input<"span">, `on${string}`> {
22+
Omit<Marko.HTML.Span, `on${string}`> {
2323
text?: AttrString;
2424
"footer-text"?: AttrString;
2525
"a11y-footer-text"?: AttrString;
2626
footer?: WithNormalizedProps<
27-
Omit<Marko.Input<"button">, `on${string}`> & {
27+
Omit<Marko.HTML.Button, `on${string}`> & {
2828
"a11y-footer-text"?: AttrString;
2929
}
3030
>;

src/components/ebay-filter-menu/component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface FilterMenuEvent<T extends Event = Event> {
2121

2222
interface FilterMenuInput
2323
extends BaseMenuInput,
24-
Omit<Marko.Input<"span">, `on${string}`> {
24+
Omit<Marko.HTML.Span, `on${string}`> {
2525
variant?: "form";
2626
"class-prefix"?: string;
2727
"form-name"?: string;
@@ -30,7 +30,7 @@ interface FilterMenuInput
3030
"footer-text"?: AttrString;
3131
"a11y-footer-text"?: AttrString;
3232
footer?: WithNormalizedProps<
33-
Omit<Marko.Input<"button">, `on${string}`> & {
33+
Omit<Marko.HTML.Button, `on${string}`> & {
3434
"a11y-footer-text"?: AttrString;
3535
}
3636
>;

src/components/ebay-filter/component.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { AttrString } from "marko/tags-html";
22
import type { WithNormalizedProps } from "../../global";
33

4-
export interface FilterInput
5-
extends Omit<Marko.Input<"button">, `on${string}`> {
4+
export interface FilterInput extends Omit<Marko.HTML.Button, `on${string}`> {
65
selected?: boolean;
76
href?: string;
87
"use-aria-pressed"?: boolean;

src/components/ebay-flag/index.marko

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { WithNormalizedProps } from "../../global";
22
static {
3-
interface FlagInput extends Omit<Marko.Input<"span">, `on${string}`> {
3+
interface FlagInput extends Omit<Marko.HTML.Span, `on${string}`> {
44
flag?: string;
55
}
66
}

src/components/ebay-icon-button/component-browser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as eventUtils from "../../common/event-utils";
33
import type { WithNormalizedProps } from "../../global";
44
import type { Input as ButtonInput } from "../ebay-button/index.marko";
55

6-
interface IconButtonInput extends Omit<Marko.Input<"button">, `on${string}`> {
6+
interface IconButtonInput extends Omit<Marko.HTML.Button, `on${string}`> {
77
"badge-number"?: number | string;
88
href?: string;
99
transparent?: boolean;

0 commit comments

Comments
 (0)