Skip to content

Commit

Permalink
feat(parser): add MacroMarkersList (#444)
Browse files Browse the repository at this point in the history
This should fix a few parsing issues that were happening after recent updates.
  • Loading branch information
LuanRT authored Jul 16, 2023
1 parent a9cdbf7 commit 708c5f7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/parser/classes/EngagementPanelSectionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ import { YTNode } from '../helpers.js';
import Parser, { type RawNode } from '../index.js';
import ContinuationItem from './ContinuationItem.js';
import EngagementPanelTitleHeader from './EngagementPanelTitleHeader.js';
import MacroMarkersList from './MacroMarkersList.js';
import SectionList from './SectionList.js';
import StructuredDescriptionContent from './StructuredDescriptionContent.js';

export default class EngagementPanelSectionList extends YTNode {
static type = 'EngagementPanelSectionList';

header: EngagementPanelTitleHeader | null;
content: SectionList | ContinuationItem | StructuredDescriptionContent | null;
content: SectionList | ContinuationItem | StructuredDescriptionContent | MacroMarkersList | null;
target_id?: string;
panel_identifier?: string;
visibility?: string;

constructor(data: RawNode) {
super();
this.header = Parser.parseItem(data.header, EngagementPanelTitleHeader);
this.content = Parser.parseItem(data.content, [ SectionList, ContinuationItem, StructuredDescriptionContent ]);
this.content = Parser.parseItem(data.content, [ SectionList, ContinuationItem, StructuredDescriptionContent, MacroMarkersList ]);
this.panel_identifier = data.panelIdentifier;
this.target_id = data.targetId;
this.visibility = data.visibility;
Expand Down
17 changes: 17 additions & 0 deletions src/parser/classes/MacroMarkersInfoItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { YTNode } from '../helpers.js';
import { Parser, type RawNode } from '../index.js';
import Menu from './menus/Menu.js';
import Text from './misc/Text.js';

export default class MacroMarkersInfoItem extends YTNode {
static type = 'MacroMarkersInfoItem';

info_text: Text;
menu: Menu | null;

constructor(data: RawNode) {
super();
this.info_text = new Text(data.infoText);
this.menu = Parser.parseItem(data.menu, Menu);
}
}
18 changes: 18 additions & 0 deletions src/parser/classes/MacroMarkersList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { YTNode, type ObservedArray } from '../helpers.js';
import { Parser, type RawNode } from '../index.js';
import { Text } from '../misc.js';
import MacroMarkersInfoItem from './MacroMarkersInfoItem.js';
import MacroMarkersListItem from './MacroMarkersListItem.js';

export default class MacroMarkersList extends YTNode {
static type = 'MacroMarkersList';

contents: ObservedArray<MacroMarkersInfoItem | MacroMarkersListItem>;
sync_button_label: Text;

constructor(data: RawNode) {
super();
this.contents = Parser.parseArray(data.contents, [ MacroMarkersInfoItem, MacroMarkersListItem ]);
this.sync_button_label = new Text(data.syncButtonLabel);
}
}
2 changes: 2 additions & 0 deletions src/parser/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ export { default as LiveChatItemList } from './classes/LiveChatItemList.js';
export { default as LiveChatMessageInput } from './classes/LiveChatMessageInput.js';
export { default as LiveChatParticipant } from './classes/LiveChatParticipant.js';
export { default as LiveChatParticipantsList } from './classes/LiveChatParticipantsList.js';
export { default as MacroMarkersInfoItem } from './classes/MacroMarkersInfoItem.js';
export { default as MacroMarkersList } from './classes/MacroMarkersList.js';
export { default as MacroMarkersListItem } from './classes/MacroMarkersListItem.js';
export { default as Menu } from './classes/menus/Menu.js';
export { default as MenuNavigationItem } from './classes/menus/MenuNavigationItem.js';
Expand Down

0 comments on commit 708c5f7

Please sign in to comment.