-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
123 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,13 @@ | ||
import { type RawNode, Parser } from '../index.js'; | ||
import { YTNode } from '../helpers.js'; | ||
|
||
export default class SharePanelHeader extends YTNode { | ||
static type = 'SharePanelHeader'; | ||
|
||
public title: YTNode; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = Parser.parseItem(data.title); | ||
} | ||
} |
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 { RawNode } from '../index.js'; | ||
import { YTNode } from '../helpers.js'; | ||
import { Text } from '../misc.js'; | ||
|
||
export default class SharePanelTitleV15 extends YTNode { | ||
static type = 'SharePanelTitleV15'; | ||
|
||
public title: Text; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = new Text(data.title); | ||
} | ||
} |
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,25 @@ | ||
import type { RawNode } from '../index.js'; | ||
import { Text } from '../misc.js'; | ||
import { YTNode } from '../helpers.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
|
||
export default class ShareTarget extends YTNode { | ||
static type = 'ShareTarget'; | ||
|
||
public endpoint?: NavigationEndpoint; | ||
public service_name: string; | ||
public target_id: string; | ||
public title: Text; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
if (Reflect.has(data, 'serviceEndpoint')) | ||
this.endpoint = new NavigationEndpoint(data.serviceEndpoint); | ||
else if (Reflect.has(data, 'navigationEndpoint')) | ||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint); | ||
|
||
this.service_name = data.serviceName; | ||
this.target_id = data.targetId; | ||
this.title = new Text(data.title); | ||
} | ||
} |
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 { RawNode } from '../index.js'; | ||
import { YTNode } from '../helpers.js'; | ||
import { Text } from '../misc.js'; | ||
|
||
export default class StartAt extends YTNode { | ||
static type = 'StartAt'; | ||
|
||
public start_at_option_label: Text; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.start_at_option_label = new Text(data.startAtOptionLabel); | ||
} | ||
} |
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 RawNode, Parser } from '../index.js'; | ||
import { type ObservedArray, YTNode } from '../helpers.js'; | ||
import ShareTarget from './ShareTarget.js'; | ||
|
||
export default class ThirdPartyShareTargetSection extends YTNode { | ||
static type = 'ThirdPartyShareTargetSection'; | ||
|
||
public share_targets: ObservedArray<ShareTarget>; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.share_targets = Parser.parseArray(data.shareTargets, ShareTarget); | ||
} | ||
} |
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,37 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { Parser, type RawNode } from '../index.js'; | ||
|
||
import StartAt from './StartAt.js'; | ||
import CopyLink from './CopyLink.js'; | ||
import SharePanelHeader from './SharePanelHeader.js'; | ||
import ThirdPartyShareTargetSection from './ThirdPartyShareTargetSection.js'; | ||
|
||
export type ThirdPartyNetworkSection = { | ||
share_target_container: ThirdPartyShareTargetSection | null, | ||
copy_link_container: CopyLink | null, | ||
start_at_container: StartAt | null | ||
}; | ||
|
||
export default class UnifiedSharePanel extends YTNode { | ||
static type = 'UnifiedSharePanel'; | ||
|
||
public third_party_network_section?: ThirdPartyNetworkSection; | ||
public header: SharePanelHeader | null; | ||
public share_panel_version: number; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
const contents = data.contents.find((content: RawNode) => content.thirdPartyNetworkSection); | ||
|
||
if (!contents) { | ||
this.third_party_network_section = { | ||
share_target_container: Parser.parseItem(contents.thirdPartyNetworkSection.shareTargetContainer, ThirdPartyShareTargetSection), | ||
copy_link_container: Parser.parseItem(contents.thirdPartyNetworkSection.copyLinkContainer, CopyLink), | ||
start_at_container: Parser.parseItem(contents.thirdPartyNetworkSection.startAtContainer, StartAt) | ||
}; | ||
} | ||
|
||
this.header = Parser.parseItem(data.header, SharePanelHeader); | ||
this.share_panel_version = data.sharePanelVersion; | ||
} | ||
} |
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