Skip to content

Commit db915bf

Browse files
soundproofbootbrandyscarneythetaPC
authored
docs(methods): update component method documentation #4145 (#30495)
Issue number: resolves ionic-team/ionic-docs#4145 --------- ## What is the current behavior? Some component methods are missing param tags in the JSDoc comments. Some comments are out of order and the method description is below the last param description. Some back ticks are misplaced around words resulting in incorrect formatting in the docs site. ## What is the new behavior? Method documentation in app, action-sheet, alert, datetime, loading, menu, modal, popover, reorder-group, router, searchbar, and toast now include descriptions for all params, all method descriptions are placed above param descriptions, and back ticks are formatted correctly. All changes are within JSDoc comments so will result in a change to the docs site but no functional change to any components. ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information In order to preview these changes I took the JSON generated from the build on this branch and used it in the docusaurus script in place of the fetch from unpkg. I set up a preview from my fork on Vercel - https://ionic-docs-git-temptotestdocs-soundproofboots-projects.vercel.app/docs/components . The change I made to the docusaurus script to use this temp data is here - https://github.com/soundproofboot/ionic-docs/pull/1/files. tempDocs.json is the output of the framework build after making these changes. --------- Co-authored-by: Brandy Smith <[email protected]> Co-authored-by: Brandy Smith <[email protected]> Co-authored-by: Maria Hutt <[email protected]>
1 parent 4b5753a commit db915bf

File tree

13 files changed

+99
-58
lines changed

13 files changed

+99
-58
lines changed

core/src/components.d.ts

Lines changed: 32 additions & 18 deletions
Large diffs are not rendered by default.

core/src/components/action-sheet/action-sheet.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,15 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
210210

211211
/**
212212
* Dismiss the action sheet overlay after it has been presented.
213+
* This is a no-op if the overlay has not been presented yet. If you want
214+
* to remove an overlay from the DOM that was never presented, use the
215+
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
213216
*
214217
* @param data Any data to emit in the dismiss events.
215218
* @param role The role of the element that is dismissing the action sheet.
216219
* This can be useful in a button handler for determining which button was
217-
* clicked to dismiss the action sheet.
218-
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
219-
*
220-
* This is a no-op if the overlay has not been presented yet. If you want
221-
* to remove an overlay from the DOM that was never presented, use the
222-
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
220+
* clicked to dismiss the action sheet. Some examples include:
221+
* `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
223222
*/
224223
@Method()
225224
async dismiss(data?: any, role?: string): Promise<boolean> {

core/src/components/alert/alert.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,16 +432,15 @@ export class Alert implements ComponentInterface, OverlayInterface {
432432

433433
/**
434434
* Dismiss the alert overlay after it has been presented.
435+
* This is a no-op if the overlay has not been presented yet. If you want
436+
* to remove an overlay from the DOM that was never presented, use the
437+
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
435438
*
436439
* @param data Any data to emit in the dismiss events.
437440
* @param role The role of the element that is dismissing the alert.
438441
* This can be useful in a button handler for determining which button was
439-
* clicked to dismiss the alert.
440-
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
441-
*
442-
* This is a no-op if the overlay has not been presented yet. If you want
443-
* to remove an overlay from the DOM that was never presented, use the
444-
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
442+
* clicked to dismiss the alert. Some examples include:
443+
* `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
445444
*/
446445
@Method()
447446
async dismiss(data?: any, role?: string): Promise<boolean> {

core/src/components/app/app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export class App implements ComponentInterface {
6868
* a result of another user action. (Ex: We focus the first element
6969
* inside of a popover when the user presents it, but the popover is not always
7070
* presented as a result of keyboard action.)
71+
*
72+
* @param elements An array of HTML elements to set focus on.
7173
*/
7274
@Method()
7375
async setFocus(elements: HTMLElement[]) {

core/src/components/datetime/datetime.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ export class Datetime implements ComponentInterface {
524524
* Confirms the selected datetime value, updates the
525525
* `value` property, and optionally closes the popover
526526
* or modal that the datetime was presented in.
527+
*
528+
* @param closeOverlay If `true`, closes the parent overlay. Defaults to `false`.
527529
*/
528530
@Method()
529531
async confirm(closeOverlay = false) {
@@ -559,6 +561,8 @@ export class Datetime implements ComponentInterface {
559561
* Resets the internal state of the datetime but does not update the value.
560562
* Passing a valid ISO-8601 string will reset the state of the component to the provided date.
561563
* If no value is provided, the internal state will be reset to the clamped value of the min, max and today.
564+
*
565+
* @param startDate A valid [ISO-8601 string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format) to reset the datetime state to.
562566
*/
563567
@Method()
564568
async reset(startDate?: string) {
@@ -570,6 +574,8 @@ export class Datetime implements ComponentInterface {
570574
* optionally closes the popover
571575
* or modal that the datetime was
572576
* presented in.
577+
*
578+
* @param closeOverlay If `true`, closes the parent overlay. Defaults to `false`.
573579
*/
574580
@Method()
575581
async cancel(closeOverlay = false) {

core/src/components/loading/loading.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,16 +264,15 @@ export class Loading implements ComponentInterface, OverlayInterface {
264264

265265
/**
266266
* Dismiss the loading overlay after it has been presented.
267+
* This is a no-op if the overlay has not been presented yet. If you want
268+
* to remove an overlay from the DOM that was never presented, use the
269+
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
267270
*
268271
* @param data Any data to emit in the dismiss events.
269272
* @param role The role of the element that is dismissing the loading.
270273
* This can be useful in a button handler for determining which button was
271-
* clicked to dismiss the loading.
272-
* Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
273-
*
274-
* This is a no-op if the overlay has not been presented yet. If you want
275-
* to remove an overlay from the DOM that was never presented, use the
276-
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
274+
* clicked to dismiss the loading. Some examples include:
275+
* `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
277276
*/
278277
@Method()
279278
async dismiss(data?: any, role?: string): Promise<boolean> {

core/src/components/menu/menu.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ export class Menu implements ComponentInterface, MenuI {
353353
}
354354

355355
/**
356-
* Returns `true` is the menu is active.
356+
* Returns `true` if the menu is active.
357357
*
358358
* A menu is active when it can be opened or closed, meaning it's enabled
359359
* and it's not part of a `ion-split-pane`.
@@ -366,6 +366,10 @@ export class Menu implements ComponentInterface, MenuI {
366366
/**
367367
* Opens the menu. If the menu is already open or it can't be opened,
368368
* it returns `false`.
369+
*
370+
* @param animated If `true`, the menu will animate when opening.
371+
* If `false`, the menu will open instantly without animation.
372+
* Defaults to `true`.
369373
*/
370374
@Method()
371375
open(animated = true): Promise<boolean> {
@@ -375,24 +379,42 @@ export class Menu implements ComponentInterface, MenuI {
375379
/**
376380
* Closes the menu. If the menu is already closed or it can't be closed,
377381
* it returns `false`.
382+
*
383+
* @param animated If `true`, the menu will animate when closing. If `false`,
384+
* the menu will close instantly without animation. Defaults to `true`.
385+
* @param role The role of the element that is closing the menu.
386+
* This can be useful in a button handler for determining which button was
387+
* clicked to close the menu. Some examples include:
388+
* `"cancel"`, `"destructive"`, `"selected"`, and `"backdrop"`.
378389
*/
379390
@Method()
380391
close(animated = true, role?: string): Promise<boolean> {
381392
return this.setOpen(false, animated, role);
382393
}
383394

384395
/**
385-
* Toggles the menu. If the menu is already open, it will try to close, otherwise it will try to open it.
396+
* Toggles the menu. If the menu is already open, it will try to close,
397+
* otherwise it will try to open it.
386398
* If the operation can't be completed successfully, it returns `false`.
399+
*
400+
* @param animated If `true`, the menu will animate when opening/closing.
401+
* If `false`, the menu will open/close instantly without animation.
402+
* Defaults to `true`.
387403
*/
388404
@Method()
389405
toggle(animated = true): Promise<boolean> {
390406
return this.setOpen(!this._isOpen, animated);
391407
}
392408

393409
/**
394-
* Opens or closes the button.
410+
* Opens or closes the menu.
395411
* If the operation can't be completed successfully, it returns `false`.
412+
*
413+
* @param shouldOpen If `true`, the menu will open. If `false`, the menu
414+
* will close.
415+
* @param animated If `true`, the menu will animate when opening/closing.
416+
* If `false`, the menu will open/close instantly without animation.
417+
* @param role The role of the element that is closing the menu.
396418
*/
397419
@Method()
398420
setOpen(shouldOpen: boolean, animated = true, role?: string): Promise<boolean> {

core/src/components/modal/modal.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -739,13 +739,13 @@ export class Modal implements ComponentInterface, OverlayInterface {
739739

740740
/**
741741
* Dismiss the modal overlay after it has been presented.
742-
*
743-
* @param data Any data to emit in the dismiss events.
744-
* @param role The role of the element that is dismissing the modal. For example, 'cancel' or 'backdrop'.
745-
*
746742
* This is a no-op if the overlay has not been presented yet. If you want
747743
* to remove an overlay from the DOM that was never presented, use the
748744
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
745+
*
746+
* @param data Any data to emit in the dismiss events.
747+
* @param role The role of the element that is dismissing the modal.
748+
* For example, `cancel` or `backdrop`.
749749
*/
750750
@Method()
751751
async dismiss(data?: any, role?: string): Promise<boolean> {
@@ -841,8 +841,10 @@ export class Modal implements ComponentInterface, OverlayInterface {
841841
}
842842

843843
/**
844-
* Move a sheet style modal to a specific breakpoint. The breakpoint value must
845-
* be a value defined in your `breakpoints` array.
844+
* Move a sheet style modal to a specific breakpoint.
845+
*
846+
* @param breakpoint The breakpoint value to move the sheet modal to.
847+
* Must be a value defined in your `breakpoints` array.
846848
*/
847849
@Method()
848850
async setCurrentBreakpoint(breakpoint: number): Promise<void> {

core/src/components/popover/popover.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ export class Popover implements ComponentInterface, PopoverInterface {
459459
* Developers can pass a mouse, touch, or pointer event
460460
* to position the popover relative to where that event
461461
* was dispatched.
462+
*
463+
* @param event The event to position the popover relative to.
462464
*/
463465
@Method()
464466
async present(event?: MouseEvent | TouchEvent | PointerEvent | CustomEvent): Promise<void> {
@@ -540,15 +542,14 @@ export class Popover implements ComponentInterface, PopoverInterface {
540542

541543
/**
542544
* Dismiss the popover overlay after it has been presented.
545+
* This is a no-op if the overlay has not been presented yet. If you want
546+
* to remove an overlay from the DOM that was never presented, use the
547+
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
543548
*
544549
* @param data Any data to emit in the dismiss events.
545-
* @param role The role of the element that is dismissing the popover. For example, 'cancel' or 'backdrop'.
550+
* @param role The role of the element that is dismissing the popover. For example, `cancel` or `backdrop`.
546551
* @param dismissParentPopover If `true`, dismissing this popover will also dismiss
547552
* a parent popover if this popover is nested. Defaults to `true`.
548-
*
549-
* This is a no-op if the overlay has not been presented yet. If you want
550-
* to remove an overlay from the DOM that was never presented, use the
551-
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
552553
*/
553554
@Method()
554555
async dismiss(data?: any, role?: string, dismissParentPopover = true): Promise<boolean> {

core/src/components/reorder-group/reorder-group.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export class ReorderGroup implements ComponentInterface {
8989

9090
/**
9191
* Completes the reorder operation. Must be called by the `ionItemReorder` event.
92-
*
9392
* If a list of items is passed, the list will be reordered and returned in the
9493
* proper order.
9594
*

0 commit comments

Comments
 (0)