@mana-app/types 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Content, Chapter, ChapterData, SourceInfo, Property } from "../../types";
1
+ import { Content, Chapter, ChapterData, SourceInfo, Property, AdditionalInfoSectionItem } from "../../types";
2
2
  import { DirectoryHandler, ManaSource } from "../Source";
3
3
  export type SourceConfig = {
4
4
  /**
@@ -44,5 +44,9 @@ export interface ContentSource extends SourceCore, DirectoryHandler {
44
44
  * Called to get tags available on the source
45
45
  */
46
46
  getTags?(): Promise<Property[]>;
47
+ /**
48
+ * Called to get additional info section items for a content
49
+ */
50
+ getAdditionalInfoSectionItems?(contentId: string, sectionId: string): Promise<AdditionalInfoSectionItem[]>;
47
51
  }
48
52
  export {};
@@ -1,9 +1,7 @@
1
1
  import { DirectoryHandler } from "..";
2
- import { FullTrackItem } from "../../types";
3
2
  export interface AdvancedTracker extends DirectoryHandler {
4
3
  /**
5
4
  * This is called to get the info required to prepare a "profile page" for the title
6
5
  */
7
- getFullInformation(id: string): Promise<FullTrackItem>;
8
6
  toggleFavorite?(state: boolean): Promise<void>;
9
7
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseItem } from "./BaseItem";
2
2
  import { Chapter } from "./Chapter";
3
- import { HighlightCollection } from "./Collection";
4
3
  import { PublicationStatus, ContentType, ReadingMode } from "./Enums";
4
+ import { SimpleHighlight } from "./Highlight";
5
5
  import { Property } from "./Property";
6
6
  export type Content = BaseItem & {
7
7
  /**
@@ -10,10 +10,6 @@ export type Content = BaseItem & {
10
10
  * Note: Defaults to UNKNOWN if not defined.
11
11
  */
12
12
  status?: PublicationStatus;
13
- /**
14
- * Names of creators of the publication; Artists, Authors etc
15
- */
16
- creators?: string[];
17
13
  /**
18
14
  * Summary / Description of the content
19
15
  */
@@ -43,17 +39,14 @@ export type Content = BaseItem & {
43
39
  */
44
40
  recommendedPanelMode?: ReadingMode;
45
41
  /**
46
- * Additional Collections to display.
47
- *
48
- * Useful for display stuff like recommended Content
49
- */
50
- collections?: HighlightCollection[];
51
- /**
52
- * Additional Info that may be displayed with this content
42
+ * Additional Info Sections that may be displayed with this content
43
+ * The sections are displayed in the order they are defined
44
+ * Only 10 items per section are stored in the database, the user can view more which will require a implementation of getAdditionalInfoSectionItems and setting the hasMore property to true
53
45
  */
54
- info?: string[];
46
+ additionalInfo?: AdditionalInfoSection[];
55
47
  /**
56
48
  * The Content's defined Tracking ID's.
49
+ * e.g.: { "anilist": "1234567890", "mal": "1234567890" }
57
50
  */
58
51
  trackerInfo?: Record<string, string>;
59
52
  /**
@@ -61,7 +54,48 @@ export type Content = BaseItem & {
61
54
  *
62
55
  * Most websites display both the content information and chapters on the same page. Use to property to populate the chapters is such is the case
63
56
  *
64
- * Note: If Defined Suwatte will not make the subsequent requests required to get the content's chapters in the profile view.
57
+ * Note: If defined Mana will not make the subsequent requests required to get the content's chapters in the profile view.
65
58
  */
66
59
  chapters?: Chapter[];
67
60
  };
61
+ export declare enum AdditionalInfoType {
62
+ Staff = 1,
63
+ Highlights = 2,
64
+ Characters = 3
65
+ }
66
+ export interface AdditionalInfoBase<TType extends AdditionalInfoType = AdditionalInfoType> {
67
+ type: TType;
68
+ id: string;
69
+ title: string;
70
+ hasMore: boolean;
71
+ }
72
+ export type AdditionalInfoSection = StaffSection | HighlightsSection | CharactersSection;
73
+ export type StaffSection = AdditionalInfoBase<AdditionalInfoType.Staff> & {
74
+ items: StaffItem[];
75
+ };
76
+ export type HighlightsSection = AdditionalInfoBase<AdditionalInfoType.Highlights> & {
77
+ items: SimpleHighlight[];
78
+ };
79
+ export type CharactersSection = AdditionalInfoBase<AdditionalInfoType.Characters> & {
80
+ items: CharacterItem[];
81
+ };
82
+ export interface AdditionalInfoItemBase<TType extends AdditionalInfoType = AdditionalInfoType> {
83
+ readonly type: TType;
84
+ id: string;
85
+ }
86
+ export type StaffItem = AdditionalInfoItemBase<AdditionalInfoType.Staff> & {
87
+ id: string;
88
+ title: string;
89
+ subtitle?: string;
90
+ image?: string;
91
+ };
92
+ export type CharacterItem = AdditionalInfoItemBase<AdditionalInfoType.Characters> & {
93
+ id: string;
94
+ title: string;
95
+ subtitle?: string;
96
+ image?: string;
97
+ staffTitle?: string;
98
+ staffSubtitle?: string;
99
+ staffImage?: string;
100
+ };
101
+ export type AdditionalInfoSectionItem = StaffItem | CharacterItem | SimpleHighlight;
@@ -1,2 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdditionalInfoType = void 0;
4
+ var AdditionalInfoType;
5
+ (function (AdditionalInfoType) {
6
+ AdditionalInfoType[AdditionalInfoType["Staff"] = 1] = "Staff";
7
+ AdditionalInfoType[AdditionalInfoType["Highlights"] = 2] = "Highlights";
8
+ AdditionalInfoType[AdditionalInfoType["Characters"] = 3] = "Characters";
9
+ })(AdditionalInfoType || (exports.AdditionalInfoType = AdditionalInfoType = {}));
10
+ ;
@@ -2,6 +2,7 @@ import { ContextProvider } from "../core";
2
2
  import { Linkable } from "../page";
3
3
  import { TrackEntry } from "../tracker";
4
4
  import { BaseItem } from "./BaseItem";
5
+ import { AdditionalInfoType, AdditionalInfoItemBase } from "./Content";
5
6
  export type Highlight = BaseItem & ContextProvider & {
6
7
  id: string;
7
8
  /**
@@ -38,3 +39,9 @@ export type Badge = {
38
39
  count?: number;
39
40
  color?: string;
40
41
  };
42
+ export type SimpleHighlight = AdditionalInfoItemBase<AdditionalInfoType.Highlights> & BaseItem & {
43
+ /**
44
+ * Marks this highlight as non interactive
45
+ */
46
+ noninteractive?: boolean;
47
+ };
@@ -3,7 +3,6 @@ export * from "./Highlight";
3
3
  export * from "./Chapter";
4
4
  export * from "./ChapterData";
5
5
  export * from "./Property";
6
- export * from "./Collection";
7
6
  export * from "./Provider";
8
7
  export * from "./Enums";
9
8
  export * from "./ReaderContext";
@@ -19,7 +19,6 @@ __exportStar(require("./Highlight"), exports);
19
19
  __exportStar(require("./Chapter"), exports);
20
20
  __exportStar(require("./ChapterData"), exports);
21
21
  __exportStar(require("./Property"), exports);
22
- __exportStar(require("./Collection"), exports);
23
22
  __exportStar(require("./Provider"), exports);
24
23
  __exportStar(require("./Enums"), exports);
25
24
  __exportStar(require("./ReaderContext"), exports);
@@ -1,5 +1,3 @@
1
- import { Highlight, Property } from "../content";
2
- import { PublicationStatus } from "../content/Enums";
3
1
  export declare enum TrackStatus {
4
2
  READING = "READING",
5
3
  PLANNING = "PLANNING",
@@ -21,23 +19,3 @@ export type TrackEntry = {
21
19
  status: TrackStatus;
22
20
  progress: TrackProgress;
23
21
  };
24
- export type FullTrackItem = Highlight & {
25
- summary?: string;
26
- properties?: Property[];
27
- bannerCover?: string;
28
- isFavorite?: boolean;
29
- relatedTitles?: Highlight[];
30
- recommendedTitles?: Highlight[];
31
- links?: {
32
- title: string;
33
- url: string;
34
- }[];
35
- characters?: {
36
- name: string;
37
- role?: string;
38
- image?: string;
39
- summary?: string;
40
- }[];
41
- additionalTitles?: string[];
42
- status?: PublicationStatus;
43
- };
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ /*import { Highlight, Property } from "../content";
3
+ import { PublicationStatus } from "../content/Enums";*/
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  exports.TrackStatus = void 0;
4
6
  var TrackStatus;
@@ -10,3 +12,20 @@ var TrackStatus;
10
12
  TrackStatus["DROPPED"] = "DROPPED";
11
13
  TrackStatus["REREADING"] = "REREADING";
12
14
  })(TrackStatus || (exports.TrackStatus = TrackStatus = {}));
15
+ /*export type FullTrackItem = Highlight & {
16
+ summary?: string;
17
+ properties?: Property[];
18
+ bannerCover?: string;
19
+ isFavorite?: boolean;
20
+ relatedTitles?: Highlight[];
21
+ recommendedTitles?: Highlight[];
22
+ links?: { title: string; url: string }[];
23
+ characters?: {
24
+ name: string;
25
+ role?: string;
26
+ image?: string;
27
+ summary?: string;
28
+ }[];
29
+ additionalTitles?: string[];
30
+ status?: PublicationStatus;
31
+ };*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mana-app/types",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {