-
-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube/Search): add
SearchSubMenu
node (#340)
- Loading branch information
Showing
6 changed files
with
78 additions
and
4 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,22 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Text from './misc/Text.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
|
||
class SearchFilter extends YTNode { | ||
static type = 'SearchFilter'; | ||
|
||
label: Text; | ||
endpoint: NavigationEndpoint; | ||
tooltip: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
|
||
this.label = new Text(data.label); | ||
this.endpoint = new NavigationEndpoint(data.endpoint); | ||
this.tooltip = data.tooltip; | ||
} | ||
} | ||
|
||
export default SearchFilter; |
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 { ObservedArray, YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import { Parser, YTNodes } from '../index.js'; | ||
import Text from './misc/Text.js'; | ||
|
||
class SearchFilterGroup extends YTNode { | ||
static type = 'SearchFilterGroup'; | ||
|
||
title: Text; | ||
filters: ObservedArray<YTNodes.SearchFilter> | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
|
||
this.title = new Text(data.title); | ||
this.filters = Parser.parseArray(data.filters, YTNodes.SearchFilter); | ||
} | ||
} | ||
|
||
export default SearchFilterGroup; |
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,21 @@ | ||
import { ObservedArray, YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser, { YTNodes } from '../index.js'; | ||
import Text from './misc/Text.js'; | ||
|
||
class SearchSubMenu extends YTNode { | ||
static type = 'SearchSubMenu'; | ||
|
||
title: Text; | ||
groups: ObservedArray<YTNodes.SearchFilterGroup> | null; | ||
button: YTNodes.ToggleButton | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = new Text(data.title); | ||
this.groups = Parser.parseArray(data.groups, YTNodes.SearchFilterGroup); | ||
this.button = Parser.parseItem(data.button, YTNodes.ToggleButton); | ||
} | ||
} | ||
|
||
export default SearchSubMenu; |
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
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
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