Skip to content

Commit 9c2a6d9

Browse files
committed
fix: align class/tags native tags types
1 parent c35b01b commit 9c2a6d9

File tree

2 files changed

+110
-27
lines changed

2 files changed

+110
-27
lines changed

.changeset/silly-shrimps-buy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"marko": patch
3+
---
4+
5+
Align class api native tag types with tags api.

packages/runtime-class/tags-html.d.ts

Lines changed: 105 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -382,36 +382,36 @@ declare global {
382382
* Fires after printing the document.
383383
* @see https://html.spec.whatwg.org/multipage/indices.html#event-afterprint
384384
*/
385-
onAfterprint?: AttrEventHandler<Event, HTMLBodyElement>;
386-
"on-afterprint"?: this["onAfterprint"];
385+
onAfterPrint?: AttrEventHandler<Event, HTMLBodyElement>;
386+
"on-afterprint"?: this["onAfterPrint"];
387387

388388
/**
389389
* Fires before printing the document.
390390
* @see https://html.spec.whatwg.org/multipage/indices.html#event-beforeprint
391391
*/
392-
onBeforeprint?: AttrEventHandler<Event, HTMLBodyElement>;
393-
"on-beforeprint"?: this["onBeforeprint"];
392+
onBeforePrint?: AttrEventHandler<Event, HTMLBodyElement>;
393+
"on-beforeprint"?: this["onBeforePrint"];
394394

395395
/**
396396
* Fired when the page is about to be unloaded, in case the page would like to show a warning prompt.
397397
* @see https://html.spec.whatwg.org/multipage/indices.html#event-beforeunload
398398
*/
399-
onBeforeunload?: AttrEventHandler<BeforeUnloadEvent, HTMLBodyElement>;
400-
"on-beforeunload"?: this["onBeforeunload"];
399+
onBeforeUnload?: AttrEventHandler<BeforeUnloadEvent, HTMLBodyElement>;
400+
"on-beforeunload"?: this["onBeforeUnload"];
401401

402402
/**
403403
* Fired when the fragment part of the document's URL changes.
404404
* @see https://html.spec.whatwg.org/multipage/indices.html#event-hashchange
405405
*/
406-
onHashchange?: AttrEventHandler<HashChangeEvent, HTMLBodyElement>;
407-
"on-hashchange"?: this["onHashchange"];
406+
onHashChange?: AttrEventHandler<HashChangeEvent, HTMLBodyElement>;
407+
"on-hashchange"?: this["onHashChange"];
408408

409409
/**
410410
* Fired when the user's preferred languages change.
411411
* @see https://html.spec.whatwg.org/multipage/indices.html#event-languagechange
412412
*/
413-
onLanguagechange?: AttrEventHandler<Event, HTMLBodyElement>;
414-
"on-languagechange"?: this["onLanguagechange"];
413+
onLanguageChange?: AttrEventHandler<Event, HTMLBodyElement>;
414+
"on-languagechange"?: this["onLanguageChange"];
415415

416416
/**
417417
* Fired when the window receives a message.
@@ -424,8 +424,8 @@ declare global {
424424
* Fired when the window receives an error message.
425425
* @see https://html.spec.whatwg.org/multipage/indices.html#event-messageerror
426426
*/
427-
onMessageerror?: AttrEventHandler<MessageEvent, HTMLBodyElement>;
428-
"on-messageerror"?: this["onMessageerror"];
427+
onMessageError?: AttrEventHandler<MessageEvent, HTMLBodyElement>;
428+
"on-messageerror"?: this["onMessageError"];
429429

430430
/**
431431
* Fired when the network connection is lost.
@@ -445,29 +445,29 @@ declare global {
445445
* Fired when the page's session history entry stops being the active entry.
446446
* @see https://html.spec.whatwg.org/multipage/indices.html#event-pagehide
447447
*/
448-
onPagehide?: AttrEventHandler<PageTransitionEvent, HTMLBodyElement>;
449-
"on-pagehide"?: this["onPagehide"];
448+
onPageHide?: AttrEventHandler<PageTransitionEvent, HTMLBodyElement>;
449+
"on-pagehide"?: this["onPageHide"];
450450

451451
/**
452452
* Fired when the page's session history entry becomes the active entry.
453453
* @see https://html.spec.whatwg.org/multipage/indices.html#event-pageshow
454454
*/
455-
onPageshow?: AttrEventHandler<PageTransitionEvent, HTMLBodyElement>;
456-
"on-pageshow"?: this["onPageshow"];
455+
onPageShow?: AttrEventHandler<PageTransitionEvent, HTMLBodyElement>;
456+
"on-pageshow"?: this["onPageShow"];
457457

458458
/**
459459
* Fired when the window's session history is popped.
460460
* @see https://html.spec.whatwg.org/multipage/indices.html#event-popstate
461461
*/
462-
onPopstate?: AttrEventHandler<PopStateEvent, HTMLBodyElement>;
463-
"on-popstate"?: this["onPopstate"];
462+
onPopState?: AttrEventHandler<PopStateEvent, HTMLBodyElement>;
463+
"on-popstate"?: this["onPopState"];
464464

465465
/**
466466
* Fires when a previously-unhandled promise rejection becomes handled.
467467
* @see https://html.spec.whatwg.org/multipage/indices.html#event-rejectionhandled
468468
*/
469-
onRejectionhandled?: AttrEventHandler<Event, HTMLBodyElement>;
470-
"on-rejectionhandled"?: this["onRejectionhandled"];
469+
onRejectionHandled?: AttrEventHandler<Event, HTMLBodyElement>;
470+
"on-rejectionhandled"?: this["onRejectionHandled"];
471471

472472
/**
473473
* Fired when the corresponding localStorage or sessionStorage storage areas change.
@@ -696,6 +696,13 @@ declare global {
696696
* @see https://html.spec.whatwg.org/multipage/interactive-elements.html#attr-details-open
697697
*/
698698
open?: AttrBoolean;
699+
700+
// NON STANDARD
701+
/**
702+
* Called whenever a the `open` attribute has changed.
703+
* When `openChange` is a function, `open` becomes controlled.
704+
*/
705+
openChange?: AttrMissing | ((open: boolean) => void);
699706
}
700707
interface Dfn extends HTMLAttributes<HTMLElement> {}
701708
interface Dialog extends HTMLAttributes<HTMLDialogElement> {
@@ -704,6 +711,13 @@ declare global {
704711
* @see https://html.spec.whatwg.org/multipage/interactive-elements.html#attr-dialog-open
705712
*/
706713
open?: AttrBoolean;
714+
715+
// NON STANDARD
716+
/**
717+
* Called whenever a the `open` attribute has changed.
718+
* When `openChange` is a function, `open` becomes controlled.
719+
*/
720+
openChange?: AttrMissing | ((open: boolean) => void);
707721
}
708722
interface Div extends HTMLAttributes<HTMLDivElement> {}
709723
interface DL extends HTMLAttributes<HTMLDListElement> {}
@@ -831,8 +845,8 @@ declare global {
831845
* Fired at a form element when it is constructing the entry list
832846
* @see https://html.spec.whatwg.org/multipage/indices.html#event-formdata
833847
*/
834-
onFormdata?: AttrEventHandler<FormDataEvent, HTMLFormElement>;
835-
"on-formdata"?: this["onFormdata"];
848+
onFormData?: AttrEventHandler<FormDataEvent, HTMLFormElement>;
849+
"on-formdata"?: this["onFormData"];
836850

837851
/**
838852
* Fired when a form is submitted, either by user interaction or through a script.
@@ -1279,6 +1293,41 @@ declare global {
12791293
* @see https://html.spec.whatwg.org/multipage/embedded-content-other.html#attr-dim-width
12801294
*/
12811295
width?: AttrStringOrNumber;
1296+
1297+
// NON STANDARD
1298+
1299+
/**
1300+
* Called whenever a the `checked` property of an `input` has changed.
1301+
* When `checkedChange` is a function, `checked` becomes controlled.
1302+
* This means the `checked` property is synchronized instead of the `checked` attribute.
1303+
*/
1304+
checkedChange?: AttrMissing | ((checked: boolean) => void);
1305+
1306+
/**
1307+
* Used to synchronize the `checked` attribute with a `value` attribute used across related `input type="checkbox"` and `input type="radio"` controls.
1308+
* When `checkedValue` is a string, the `checked` attribute will be set to a boolean that is `true` if the `checkedValue` is the same as the `value`.
1309+
* When `checkedValue` is an array of strings, the `checked` attribute will be set to a boolean that is `true` if the `checkedValue` array includes the `value`.
1310+
* If the `checkedValue` is falsy then `checked` is always `false`.
1311+
*/
1312+
checkedValue?: AttrMissing | string | string[];
1313+
/**
1314+
* Called whenever a `input type="checkbox"` or `input type="radio"` using the `checkedValue` attribute has changed.
1315+
* When `checkedValueChange` is a function, `checked` becomes controlled.
1316+
* This means the `checked` property is synchronized instead of the `checked` attribute.
1317+
*/
1318+
checkedValueChange?:
1319+
| AttrMissing
1320+
| ((
1321+
/** Note this is hack that allows you to work with the value as both a string and a string[] without needing generics */
1322+
checkedValue: string & string[],
1323+
) => void);
1324+
1325+
/**
1326+
* Called whenever a the `value` property of an `input` has changed.
1327+
* When `valueChange` is a function, `value` becomes controlled. This means
1328+
* This means the `value` property is synchronized instead of the `value` attribute.
1329+
*/
1330+
valueChange?: AttrMissing | ((value: string) => void);
12821331
}
12831332

12841333
interface Ins extends HTMLAttributes<HTMLModElement> {
@@ -1841,6 +1890,26 @@ declare global {
18411890
* @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-select-size
18421891
*/
18431892
size?: AttrStringOrNumber;
1893+
1894+
// NON STANDARD
1895+
1896+
/**
1897+
* When the `value` is a string, nested `<option>` tags with a matching `value` attribute become `selected`.
1898+
* When the `value` is an array of strings, nested `<option>` tags with a `value` contained within the array are `selected.
1899+
*/
1900+
value?: AttrMissing | string | string[];
1901+
1902+
/**
1903+
* Called whenever a the `value` property of the `select` has changed.
1904+
* When `valueChange` is a function, `value` becomes controlled. This means
1905+
* This means the `value` property is synchronized instead of the `value` attribute.
1906+
*/
1907+
valueChange?:
1908+
| AttrMissing
1909+
| ((
1910+
/** Note this is hack that allows you to work with the value as both a string and a string[] without needing generics */
1911+
value: string & string[],
1912+
) => void);
18441913
}
18451914

18461915
interface Slot extends HTMLAttributes<HTMLSlotElement> {
@@ -2088,17 +2157,26 @@ declare global {
20882157
*/
20892158
rows?: AttrStringOrNumber;
20902159

2091-
/**
2092-
* (Non-standard). Represents the current value of the <textarea> element.
2093-
*/
2094-
value?: AttrString;
2095-
20962160
/**
20972161
* Controls the line wrapping behavior of the <textarea> element.
20982162
* "hard" inserts line breaks in the submitted value, "soft" doesn't, and "off" disables wrapping.
20992163
* @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-textarea-wrap
21002164
*/
21012165
wrap?: AttrMissing | "hard" | "soft" | "off";
2166+
2167+
// NON STANDARD
2168+
2169+
/**
2170+
* Represents the current value of the `textarea` element.
2171+
*/
2172+
value?: AttrMissing | string;
2173+
2174+
/**
2175+
* Called whenever a the `value` property of the `textarea` has changed.
2176+
* When `valueChange` is a function, `value` becomes controlled. This means
2177+
* This means the `value` property is synchronized instead of the `value` attribute.
2178+
*/
2179+
valueChange?: AttrMissing | ((value: string) => void);
21022180
}
21032181

21042182
interface TFoot extends HTMLAttributes<HTMLTableSectionElement> {

0 commit comments

Comments
 (0)