mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-25 07:42:11 +00:00
feat(Parser): Add SectionHeaderView and GridShelfView (#988)
* feat(parser): add sectionheaderview and gridshelfview * style: direct import instead of from ytnodes namespace * chore: clean up --------- Co-authored-by: absidue <48293849+absidue@users.noreply.github.com> Co-authored-by: Luan <luan.lrt4@gmail.com>
This commit is contained in:
27
src/parser/classes/GridShelfView.ts
Normal file
27
src/parser/classes/GridShelfView.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { ObservedArray } from '../helpers.js';
|
||||
import { YTNode } from '../helpers.js';
|
||||
import { Parser, type RawNode } from '../index.js';
|
||||
import ButtonView from './ButtonView.js';
|
||||
|
||||
export default class GridShelfView extends YTNode {
|
||||
static type = 'GridShelfView';
|
||||
|
||||
public contents: ObservedArray<YTNode>;
|
||||
public header: YTNode | null;
|
||||
public content_aspect_ratio: string;
|
||||
public enable_vertical_expansion: boolean;
|
||||
public show_more_button: ButtonView | null;
|
||||
public show_less_button: ButtonView | null;
|
||||
public min_collapsed_item_count: number;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.contents = Parser.parseArray(data.contents);
|
||||
this.header = Parser.parseItem(data.header);
|
||||
this.content_aspect_ratio = data.contentAspectRatio;
|
||||
this.enable_vertical_expansion = data.enableVerticalExpansion;
|
||||
this.show_more_button = Parser.parseItem(data.showMoreButton, ButtonView);
|
||||
this.show_less_button = Parser.parseItem(data.showLessButton, ButtonView);
|
||||
this.min_collapsed_item_count = data.minCollapsedItemCount;
|
||||
}
|
||||
}
|
||||
14
src/parser/classes/SectionHeaderView.ts
Normal file
14
src/parser/classes/SectionHeaderView.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
import Text from './misc/Text.js';
|
||||
|
||||
export default class SectionHeaderView extends YTNode {
|
||||
static type = 'SectionHeaderView';
|
||||
|
||||
public headline: Text;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.headline = Text.fromAttributed(data.headline);
|
||||
}
|
||||
}
|
||||
@@ -190,6 +190,7 @@ export { default as GridHeader } from './classes/GridHeader.js';
|
||||
export { default as GridMix } from './classes/GridMix.js';
|
||||
export { default as GridMovie } from './classes/GridMovie.js';
|
||||
export { default as GridPlaylist } from './classes/GridPlaylist.js';
|
||||
export { default as GridShelfView } from './classes/GridShelfView.js';
|
||||
export { default as GridShow } from './classes/GridShow.js';
|
||||
export { default as GridVideo } from './classes/GridVideo.js';
|
||||
export { default as GuideCollapsibleEntry } from './classes/GuideCollapsibleEntry.js';
|
||||
@@ -421,6 +422,7 @@ export { default as SearchSubMenu } from './classes/SearchSubMenu.js';
|
||||
export { default as SearchSuggestion } from './classes/SearchSuggestion.js';
|
||||
export { default as SearchSuggestionsSection } from './classes/SearchSuggestionsSection.js';
|
||||
export { default as SecondarySearchContainer } from './classes/SecondarySearchContainer.js';
|
||||
export { default as SectionHeaderView } from './classes/SectionHeaderView.js';
|
||||
export { default as SectionList } from './classes/SectionList.js';
|
||||
export { default as SegmentedLikeDislikeButton } from './classes/SegmentedLikeDislikeButton.js';
|
||||
export { default as SegmentedLikeDislikeButtonView } from './classes/SegmentedLikeDislikeButtonView.js';
|
||||
|
||||
Reference in New Issue
Block a user