-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser): Add mobile guide nodes
- Loading branch information
Showing
6 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { YTNode } from '../../helpers.js'; | ||
import Text from '../misc/Text.js'; | ||
import { Parser, type RawNode } from '../../index.js'; | ||
|
||
export default class MobileTopbar extends YTNode { | ||
static type = 'MobileTopbar'; | ||
|
||
public placeholder_text: Text; | ||
public buttons; | ||
public logo_type?: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.placeholder_text = new Text(data.placeholderText); | ||
this.buttons = Parser.parseArray(data.buttons); | ||
|
||
if (Reflect.has(data, 'logo') && Reflect.has(data.logo, 'iconType')) | ||
this.logo_type = data.logo.iconType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { ObservedArray } from '../../helpers.js'; | ||
import { YTNode } from '../../helpers.js'; | ||
import { Parser, type RawNode } from '../../index.js'; | ||
|
||
export default class MultiPageMenuSection extends YTNode { | ||
static type = 'MultiPageMenuSection'; | ||
|
||
public items: ObservedArray<YTNode> | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.items = Parser.parseArray(data.items); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { YTNode } from '../../helpers.js'; | ||
import { Parser, type RawNode } from '../../index.js'; | ||
|
||
export default class PivotBar extends YTNode { | ||
static type = 'PivotBar'; | ||
|
||
public items; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.items = Parser.parseArray(data.items); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { YTNode } from '../../helpers.js'; | ||
import { type RawNode } from '../../index.js'; | ||
import Text from '../misc/Text.js'; | ||
import NavigationEndpoint from '../NavigationEndpoint.js'; | ||
|
||
export default class PivotBarItem extends YTNode { | ||
static type = 'PivotBarItem'; | ||
|
||
public pivot_identifier: string; | ||
public endpoint: NavigationEndpoint; | ||
public title: Text; | ||
public accessibility_label?: string; | ||
public icon_type?: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.pivot_identifier = data.pivotIdentifier; | ||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint); | ||
this.title = new Text(data.title); | ||
|
||
if (Reflect.has(data, 'accessibility') && Reflect.has(data.accessibility, 'accessibilityData')) | ||
this.accessibility_label = data.accessibility.accessibilityData.label; | ||
|
||
if (Reflect.has(data, 'icon') && Reflect.has(data.icon, 'iconType')) | ||
this.icon_type = data.icon.iconType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { YTNode } from '../../helpers.js'; | ||
import { Parser, type RawNode } from '../../index.js'; | ||
|
||
export default class TopbarMenuButton extends YTNode { | ||
static type = 'TopbarMenuButton'; | ||
|
||
public icon_type?: string; | ||
public menu_renderer: YTNode | null; | ||
public target_id: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
if (Reflect.has(data, 'icon') && Reflect.has(data.icon, 'iconType')) | ||
this.icon_type = data.icon.iconType; | ||
this.menu_renderer = Parser.parseItem(data.menuRenderer); | ||
this.target_id = data.targetId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters