@mana-app/types 0.0.20 → 0.0.22

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.
Files changed (47) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -7
  3. package/dist/sources/ContentSource/ContentSource.d.ts +0 -4
  4. package/dist/sources/ContentSource/handlers/index.d.ts +0 -1
  5. package/dist/sources/ContentSource/handlers/index.js +0 -1
  6. package/dist/sources/ContentTracker/ContentTracker.d.ts +1 -15
  7. package/dist/sources/Source/extensions/SearchProvider.d.ts +8 -4
  8. package/dist/types/UI/Form.d.ts +14 -2
  9. package/dist/types/UI/UIDefinitions.d.ts +3 -2
  10. package/dist/types/UI/UIElementBuilders.d.ts +14 -2
  11. package/dist/types/UI/UIElementBuilders.js +7 -1
  12. package/dist/types/UI/UIElements.d.ts +12 -2
  13. package/dist/types/UI/UIElements.js +7 -1
  14. package/dist/types/UI/index.d.ts +2 -2
  15. package/dist/types/UI/index.js +12 -2
  16. package/dist/types/content/DeepLinkContext.d.ts +0 -2
  17. package/dist/types/content/Highlight.d.ts +2 -2
  18. package/dist/types/content/index.d.ts +0 -2
  19. package/dist/types/content/index.js +0 -2
  20. package/dist/types/core/index.d.ts +4 -0
  21. package/dist/types/page/index.d.ts +3 -3
  22. package/dist/types/search/PagedSearchResult.d.ts +1 -1
  23. package/dist/types/search/SearchFilter.d.ts +55 -26
  24. package/dist/types/search/SearchFilter.js +17 -8
  25. package/dist/types/search/SearchForm.d.ts +81 -0
  26. package/dist/types/search/SearchForm.js +36 -0
  27. package/dist/types/search/SearchRequest.d.ts +2 -2
  28. package/dist/types/search/index.d.ts +2 -1
  29. package/dist/types/search/index.js +17 -1
  30. package/dist/types/tracker/index.js +0 -19
  31. package/package.json +1 -1
  32. package/dist/sources/Source/extensions/DirectoryHandler.d.ts +0 -14
  33. package/dist/sources/Source/extensions/DirectoryHandler.js +0 -2
  34. package/dist/types/content/Collection.d.ts +0 -24
  35. package/dist/types/content/Collection.js +0 -2
  36. package/dist/types/content/ContextMenu.d.ts +0 -14
  37. package/dist/types/content/ContextMenu.js +0 -2
  38. package/dist/types/core/PagedResult.d.ts +0 -17
  39. package/dist/types/core/PagedResult.js +0 -2
  40. package/dist/types/directory/DirectoryConfig.d.ts +0 -31
  41. package/dist/types/directory/DirectoryConfig.js +0 -2
  42. package/dist/types/directory/DirectoryFilter.d.ts +0 -53
  43. package/dist/types/directory/DirectoryFilter.js +0 -30
  44. package/dist/types/directory/DirectoryRequest.d.ts +0 -37
  45. package/dist/types/directory/DirectoryRequest.js +0 -2
  46. package/dist/types/directory/index.d.ts +0 -3
  47. package/dist/types/directory/index.js +0 -19
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) [2022] [Shedrach Uzoukwu]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) [2022] [Shedrach Uzoukwu]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # mana-app/types
2
-
3
- mana-app/types definitions for building Mana JavaScript Sources.
4
-
5
- ## Installation
6
- ```bash
7
- npm i @mana-app/types
1
+ # mana-app/types
2
+
3
+ mana-app/types definitions for building Mana JavaScript Sources.
4
+
5
+ ## Installation
6
+ ```bash
7
+ npm i @mana-app/types
8
8
  ```
@@ -1,10 +1,6 @@
1
1
  import { Content, Chapter, ChapterData, SourceInfo, AdditionalInfoSectionItem } from "../../types";
2
2
  import { SearchProvider, ManaSource } from "../Source";
3
3
  export type SourceConfig = {
4
- /**
5
- * When `true`, Mana will disable being able to view more titles of a provided tags
6
- */
7
- readonly disableTagNavigation?: boolean;
8
4
  /**
9
5
  * When `true`, Mana will not check for updates on this source
10
6
  */
@@ -2,6 +2,5 @@ export * from "./ContentEvent";
2
2
  export * from "./ChapterEvent";
3
3
  export * from "./ProgressSync";
4
4
  export * from "./LibrarySync";
5
- export * from "./ContextMenuHandler";
6
5
  export * from "./GroupedUpdateProvider";
7
6
  export * from "./ImageRedrawHandler";
@@ -18,6 +18,5 @@ __exportStar(require("./ContentEvent"), exports);
18
18
  __exportStar(require("./ChapterEvent"), exports);
19
19
  __exportStar(require("./ProgressSync"), exports);
20
20
  __exportStar(require("./LibrarySync"), exports);
21
- __exportStar(require("./ContextMenuHandler"), exports);
22
21
  __exportStar(require("./GroupedUpdateProvider"), exports);
23
22
  __exportStar(require("./ImageRedrawHandler"), exports);
@@ -1,4 +1,4 @@
1
- import { Form, Highlight, SourceInfo, TrackProgressUpdate, TrackStatus } from "../../types";
1
+ import { Form, SourceInfo, TrackProgressUpdate, TrackStatus } from "../../types";
2
2
  import { ManaSource } from "../Source";
3
3
  export type TrackerConfig = {
4
4
  /**
@@ -21,21 +21,7 @@ export interface ContentTracker extends TrackerCore {
21
21
  * @param progress the updated reading progress
22
22
  */
23
23
  didUpdateLastReadChapter(id: string, progress: TrackProgressUpdate): Promise<void>;
24
- /**
25
- * Called when a user wants to link contents to your tracker.
26
- * @param titles An array containing all the provided names of an entry.
27
- */
28
- getResultsForTitles(titles: string[]): Promise<Highlight[]>;
29
- /**
30
- * A tracker item with the current entry for a title
31
- * @param id The ID of the title being queried
32
- */
33
- getTrackItem(id: string): Promise<Highlight>;
34
24
  didUpdateStatus(id: string, status: TrackStatus): Promise<void>;
35
- /**
36
- * Called when the user wants to start tracking a previously untracked entry
37
- */
38
- beginTracking(id: string, status: TrackStatus): Promise<void>;
39
25
  /**
40
26
  * Builds the form for updating the user's track state for a title
41
27
  */
@@ -1,15 +1,19 @@
1
- import { SearchRequest, PagedSearchResult, SortOption, SearchFilter } from "../../../types";
1
+ import { SearchRequest, PagedSearchResult, SortOption, SearchForm, SearchFormSubmission, SearchFormValidationResult } from "../../../types";
2
2
  export interface SearchProvider {
3
3
  /**
4
- * Fetches items/results for a directory request.
4
+ * Fetches items/results for a search request.
5
5
  */
6
6
  search(request: SearchRequest): Promise<PagedSearchResult>;
7
7
  /**
8
- * Fetches the available search filters for the source
8
+ * Fetches the advanced search form for the source.
9
9
  */
10
- getSearchFilters?(): Promise<SearchFilter[]>;
10
+ getSearchForm?(): Promise<SearchForm>;
11
11
  /**
12
12
  * Fetches the available sort options for the source
13
13
  */
14
14
  getSortOptions?(): Promise<SortOption[]>;
15
+ /**
16
+ * Validates the pending advanced search values before Mana applies them.
17
+ */
18
+ validateSearchForm?(form: SearchFormSubmission): Promise<SearchFormValidationResult>;
15
19
  }
@@ -1,5 +1,17 @@
1
- import { UIElement, UISection } from "./UIElements";
2
- export type FormSection = UISection<UIElement<any>>;
1
+ import { UISection, UISectionType } from "./UIElements";
2
+ import { UIButtonDefinition, UIDatePickerDefinition, UIExcludableMultiPickerDefinition, UIMultiPickerDefinition, UIPickerDefinition, UIStepperDefinition, UITextFieldDefinition, UIToggleDefinition } from "./UIDefinitions";
3
+ export type UIListElement = UIPickerDefinition | UIMultiPickerDefinition | UIExcludableMultiPickerDefinition | UIToggleDefinition | UITextFieldDefinition | UIDatePickerDefinition | UIStepperDefinition | UIButtonDefinition;
4
+ export type UITagSelectableElement = UIPickerDefinition | UIMultiPickerDefinition | UIExcludableMultiPickerDefinition;
5
+ export type UIListSection = UISection<UIListElement> & {
6
+ type?: UISectionType.LIST;
7
+ };
8
+ export type UITagsSection = {
9
+ type: UISectionType.TAGS;
10
+ header?: string;
11
+ footer?: string;
12
+ field: UITagSelectableElement;
13
+ };
14
+ export type FormSection = UIListSection | UITagsSection;
3
15
  export type Form = {
4
16
  sections: FormSection[];
5
17
  };
@@ -1,10 +1,11 @@
1
- import { UIComponentType, UIElement, UIInteractable, UISelectable } from "./UIElements";
1
+ import { UIComponentType, UIElement, UIInteractable, UISelectable, ExcludableMultiSelectValue } from "./UIElements";
2
2
  export type UIPickerDefinition = UIElement<UIComponentType.SELECT> & UISelectable & UIInteractable<string>;
3
3
  export type UIMultiPickerOptions = UISelectable & {
4
4
  minSelectionCount?: number;
5
5
  maxSelectionCount?: number;
6
6
  };
7
7
  export type UIMultiPickerDefinition = UIElement<UIComponentType.MULTISELECT> & UIMultiPickerOptions & UIInteractable<string[]>;
8
+ export type UIExcludableMultiPickerDefinition = UIElement<UIComponentType.EXCLUDABLE_MULTISELECT> & UISelectable & UIInteractable<ExcludableMultiSelectValue>;
8
9
  export type UIToggleDefinition = UIElement<UIComponentType.TOGGLE> & UIInteractable<boolean>;
9
10
  export type UITextFieldOptions = {
10
11
  placeholder?: string;
@@ -26,4 +27,4 @@ export type UIButtonOptions = {
26
27
  systemImage?: string;
27
28
  action: () => Promise<void>;
28
29
  };
29
- export type UIButtonDefinition = UIElement<UIComponentType.BUTTON>;
30
+ export type UIButtonDefinition = UIElement<UIComponentType.BUTTON> & UIButtonOptions;
@@ -1,9 +1,21 @@
1
- import { UIPickerDefinition, UIMultiPickerOptions, UIMultiPickerDefinition, UIToggleDefinition, UITextFieldOptions, UITextFieldDefinition, UIDatePickerDefinition, UIButtonOptions, UIButtonDefinition, UIStepperDefinition, UIStepperOptions } from "./UIDefinitions";
2
- import { UISelectable, UIInteractable, UISectionChild } from "./UIElements";
1
+ import { UIPickerDefinition, UIMultiPickerOptions, UIMultiPickerDefinition, UIExcludableMultiPickerDefinition, UIToggleDefinition, UITextFieldOptions, UITextFieldDefinition, UIDatePickerDefinition, UIButtonOptions, UIButtonDefinition, UIStepperDefinition, UIStepperOptions } from "./UIDefinitions";
2
+ import { ExcludableMultiSelectValue, UISelectable, UIInteractable, UISectionChild } from "./UIElements";
3
+ import { UIListElement, UIListSection as UIListSectionDefinition, UITagSelectableElement, UITagsSection as UITagsSectionDefinition } from "./Form";
3
4
  export declare const UIPicker: (props: UISelectable & UIInteractable<string>) => UIPickerDefinition;
4
5
  export declare const UIMultiPicker: (props: UIMultiPickerOptions & UIInteractable<string[]>) => UIMultiPickerDefinition;
6
+ export declare const UIExcludableMultiPicker: (props: UISelectable & UIInteractable<ExcludableMultiSelectValue>) => UIExcludableMultiPickerDefinition;
5
7
  export declare const UIToggle: (props: UIInteractable<boolean>) => UIToggleDefinition;
6
8
  export declare const UITextField: (props: UITextFieldOptions & UIInteractable<string>) => UITextFieldDefinition;
7
9
  export declare const UIDatePicker: (props: UIInteractable<Date>) => UIDatePickerDefinition;
8
10
  export declare const UIButton: (props: UIButtonOptions & UISectionChild) => UIButtonDefinition;
9
11
  export declare const UIStepper: (props: UIStepperOptions & UIInteractable<number>) => UIStepperDefinition;
12
+ export declare const UIListSection: (props: {
13
+ header?: string;
14
+ footer?: string;
15
+ children: UIListElement[];
16
+ }) => UIListSectionDefinition;
17
+ export declare const UITagsSection: (props: {
18
+ header?: string;
19
+ footer?: string;
20
+ field: UITagSelectableElement;
21
+ }) => UITagsSectionDefinition;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UIStepper = exports.UIButton = exports.UIDatePicker = exports.UITextField = exports.UIToggle = exports.UIMultiPicker = exports.UIPicker = void 0;
3
+ exports.UITagsSection = exports.UIListSection = exports.UIStepper = exports.UIButton = exports.UIDatePicker = exports.UITextField = exports.UIToggle = exports.UIExcludableMultiPicker = exports.UIMultiPicker = exports.UIPicker = void 0;
4
4
  const UIElements_1 = require("./UIElements");
5
5
  const UIPicker = (props) => (Object.assign(Object.assign({}, props), { type: UIElements_1.UIComponentType.SELECT }));
6
6
  exports.UIPicker = UIPicker;
7
7
  const UIMultiPicker = (props) => (Object.assign(Object.assign({}, props), { type: UIElements_1.UIComponentType.MULTISELECT }));
8
8
  exports.UIMultiPicker = UIMultiPicker;
9
+ const UIExcludableMultiPicker = (props) => (Object.assign(Object.assign({}, props), { type: UIElements_1.UIComponentType.EXCLUDABLE_MULTISELECT }));
10
+ exports.UIExcludableMultiPicker = UIExcludableMultiPicker;
9
11
  const UIToggle = (props) => (Object.assign(Object.assign({}, props), { type: UIElements_1.UIComponentType.TOGGLE }));
10
12
  exports.UIToggle = UIToggle;
11
13
  const UITextField = (props) => (Object.assign(Object.assign({}, props), { type: UIElements_1.UIComponentType.TEXTFIELD }));
@@ -16,3 +18,7 @@ const UIButton = (props) => (Object.assign(Object.assign({}, props), { type: UIE
16
18
  exports.UIButton = UIButton;
17
19
  const UIStepper = (props) => (Object.assign(Object.assign({}, props), { type: UIElements_1.UIComponentType.STEPPER }));
18
20
  exports.UIStepper = UIStepper;
21
+ const UIListSection = (props) => (Object.assign(Object.assign({}, props), { type: UIElements_1.UISectionType.LIST }));
22
+ exports.UIListSection = UIListSection;
23
+ const UITagsSection = (props) => (Object.assign(Object.assign({}, props), { type: UIElements_1.UISectionType.TAGS }));
24
+ exports.UITagsSection = UITagsSection;
@@ -4,10 +4,15 @@ export type UISectionChild = {
4
4
  title: string;
5
5
  };
6
6
  export type UISection<T extends UISectionChild> = {
7
+ type?: UISectionType.LIST;
7
8
  header?: string;
8
9
  footer?: string;
9
10
  children: T[];
10
11
  };
12
+ export declare enum UISectionType {
13
+ LIST = 0,
14
+ TAGS = 1
15
+ }
11
16
  export declare enum UIComponentType {
12
17
  SELECT = 0,
13
18
  MULTISELECT = 1,
@@ -15,9 +20,14 @@ export declare enum UIComponentType {
15
20
  TOGGLE = 3,
16
21
  TEXTFIELD = 4,
17
22
  BUTTON = 5,
18
- DATEPICKER = 6
23
+ DATEPICKER = 6,
24
+ EXCLUDABLE_MULTISELECT = 7
19
25
  }
20
- export type Primitive = boolean | string | number | string[] | Date;
26
+ export type ExcludableMultiSelectValue = {
27
+ included: string[];
28
+ excluded: string[];
29
+ };
30
+ export type Primitive = boolean | string | number | string[] | Date | ExcludableMultiSelectValue;
21
31
  export type UIElement<T extends UIComponentType> = UISectionChild & {
22
32
  type: T;
23
33
  };
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UIComponentType = void 0;
3
+ exports.UIComponentType = exports.UISectionType = void 0;
4
+ var UISectionType;
5
+ (function (UISectionType) {
6
+ UISectionType[UISectionType["LIST"] = 0] = "LIST";
7
+ UISectionType[UISectionType["TAGS"] = 1] = "TAGS";
8
+ })(UISectionType || (exports.UISectionType = UISectionType = {}));
4
9
  var UIComponentType;
5
10
  (function (UIComponentType) {
6
11
  UIComponentType[UIComponentType["SELECT"] = 0] = "SELECT";
@@ -10,4 +15,5 @@ var UIComponentType;
10
15
  UIComponentType[UIComponentType["TEXTFIELD"] = 4] = "TEXTFIELD";
11
16
  UIComponentType[UIComponentType["BUTTON"] = 5] = "BUTTON";
12
17
  UIComponentType[UIComponentType["DATEPICKER"] = 6] = "DATEPICKER";
18
+ UIComponentType[UIComponentType["EXCLUDABLE_MULTISELECT"] = 7] = "EXCLUDABLE_MULTISELECT";
13
19
  })(UIComponentType || (exports.UIComponentType = UIComponentType = {}));
@@ -1,4 +1,4 @@
1
- export * from "./Form";
1
+ export { Form, FormSection, UIListElement, UIListSection as UIListSectionDefinition, UITagSelectableElement, UITagsSection as UITagsSectionDefinition, } from "./Form";
2
2
  export * from "./UIElements";
3
3
  export * from "./UIDefinitions";
4
- export * from "./UIElementBuilders";
4
+ export { UIButton, UIDatePicker, UIExcludableMultiPicker, UIListSection, UIMultiPicker, UIPicker, UIStepper, UITagsSection, UITextField, UIToggle, } from "./UIElementBuilders";
@@ -14,7 +14,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Form"), exports);
17
+ exports.UIToggle = exports.UITextField = exports.UITagsSection = exports.UIStepper = exports.UIPicker = exports.UIMultiPicker = exports.UIListSection = exports.UIExcludableMultiPicker = exports.UIDatePicker = exports.UIButton = void 0;
18
18
  __exportStar(require("./UIElements"), exports);
19
19
  __exportStar(require("./UIDefinitions"), exports);
20
- __exportStar(require("./UIElementBuilders"), exports);
20
+ var UIElementBuilders_1 = require("./UIElementBuilders");
21
+ Object.defineProperty(exports, "UIButton", { enumerable: true, get: function () { return UIElementBuilders_1.UIButton; } });
22
+ Object.defineProperty(exports, "UIDatePicker", { enumerable: true, get: function () { return UIElementBuilders_1.UIDatePicker; } });
23
+ Object.defineProperty(exports, "UIExcludableMultiPicker", { enumerable: true, get: function () { return UIElementBuilders_1.UIExcludableMultiPicker; } });
24
+ Object.defineProperty(exports, "UIListSection", { enumerable: true, get: function () { return UIElementBuilders_1.UIListSection; } });
25
+ Object.defineProperty(exports, "UIMultiPicker", { enumerable: true, get: function () { return UIElementBuilders_1.UIMultiPicker; } });
26
+ Object.defineProperty(exports, "UIPicker", { enumerable: true, get: function () { return UIElementBuilders_1.UIPicker; } });
27
+ Object.defineProperty(exports, "UIStepper", { enumerable: true, get: function () { return UIElementBuilders_1.UIStepper; } });
28
+ Object.defineProperty(exports, "UITagsSection", { enumerable: true, get: function () { return UIElementBuilders_1.UITagsSection; } });
29
+ Object.defineProperty(exports, "UITextField", { enumerable: true, get: function () { return UIElementBuilders_1.UITextField; } });
30
+ Object.defineProperty(exports, "UIToggle", { enumerable: true, get: function () { return UIElementBuilders_1.UIToggle; } });
@@ -1,8 +1,6 @@
1
1
  import { PageLinkLabel } from "../page";
2
2
  import { Highlight } from "./Highlight";
3
- import { ReaderContext } from "./ReaderContext";
4
3
  export type DeepLinkContext = {
5
- read?: ReaderContext;
6
4
  content?: Highlight;
7
5
  link?: PageLinkLabel;
8
6
  };
@@ -1,4 +1,4 @@
1
- import { ContextProvider } from "../core";
1
+ import { ContextProvider, Pair } from "../core";
2
2
  import { Linkable } from "../page";
3
3
  import { TrackEntry } from "../tracker";
4
4
  import { BaseItem } from "./BaseItem";
@@ -12,7 +12,7 @@ export type Highlight = BaseItem & ContextProvider & {
12
12
  /**
13
13
  * Additional Info that may be displayed with this content
14
14
  */
15
- info?: Record<string, string>;
15
+ info?: Pair[];
16
16
  /**
17
17
  * Badge to be displayed with the tile
18
18
  */
@@ -5,8 +5,6 @@ export * from "./ChapterData";
5
5
  export * from "./Property";
6
6
  export * from "./Provider";
7
7
  export * from "./Enums";
8
- export * from "./ReaderContext";
9
- export * from "./ContextMenu";
10
8
  export * from "./DeepLinkContext";
11
9
  export * from "./BooleanState";
12
10
  export * from "./ContentProgressState";
@@ -21,8 +21,6 @@ __exportStar(require("./ChapterData"), exports);
21
21
  __exportStar(require("./Property"), exports);
22
22
  __exportStar(require("./Provider"), exports);
23
23
  __exportStar(require("./Enums"), exports);
24
- __exportStar(require("./ReaderContext"), exports);
25
- __exportStar(require("./ContextMenu"), exports);
26
24
  __exportStar(require("./DeepLinkContext"), exports);
27
25
  __exportStar(require("./BooleanState"), exports);
28
26
  __exportStar(require("./ContentProgressState"), exports);
@@ -6,3 +6,7 @@ export type Option = {
6
6
  id: string;
7
7
  title: string;
8
8
  };
9
+ export type Pair = {
10
+ key: string;
11
+ value: string;
12
+ };
@@ -1,9 +1,9 @@
1
1
  import { Badge, ContextProvider, Either, Highlight } from "..";
2
2
  import { SearchRequest } from "../search";
3
3
  /**
4
- * This object defines what page suwatte links to
4
+ * This object defines what page Mana links to
5
5
  *
6
- * If DirectoryRequest is provided, A DirectoryView is presented, otherwise it navigates to another page
6
+ * If a SearchRequest is provided, a search view is presented; otherwise it navigates to another page.
7
7
  */
8
8
  export type Linkable = Either<{
9
9
  page: PageLink;
@@ -25,7 +25,7 @@ export type PageLinkLabel = {
25
25
  */
26
26
  cover?: string;
27
27
  /**
28
- * The actual Link of the label, it should either be a PageLink pointing to a page to be navigated to OR a directory request to display a directory layout for
28
+ * The actual link of the label. It should either be a PageLink pointing to a page to navigate to or a SearchRequest to display search results.
29
29
  */
30
30
  link: Linkable;
31
31
  };
@@ -7,7 +7,7 @@ export type PagedSearchResult = {
7
7
  /**
8
8
  * Boolean Indicating whether this is the last available page.
9
9
  *
10
- * If this value is true or the results count is 0, Suwatte will stop making subsequent pagination requests
10
+ * If this value is true or the results count is 0, Mana will stop making subsequent pagination requests
11
11
  */
12
12
  isLastPage: boolean;
13
13
  /**
@@ -1,53 +1,82 @@
1
1
  import { Option } from "../core";
2
2
  export declare enum FilterType {
3
3
  /**
4
- * This Represents the filter as a toggle switch, the value returned in the directory request will be a `boolean`
4
+ * This represents the filter as a toggle switch; the value returned in the search request will be a boolean.
5
5
  */
6
6
  TOGGLE = 0,
7
7
  /**
8
- * This represents the filter as a picker, the value returned will be the `key` of the selected option as a `string`
8
+ * This represents the filter as a picker; the value returned in the search request will be the selected option.
9
9
  */
10
10
  SELECT = 1,
11
11
  /**
12
- * This Represents the filter as a multi-picker, the value returned will the the keys of the selected options as an array of strings
12
+ * This represents the filter as a multi-picker; the value returned in the search request will be the selected options.
13
13
  */
14
14
  MULTISELECT = 2,
15
15
  /**
16
- * This Represents the filter as a multi-picker,the value returned will be of type {@link ExcludableMultiSelectProp}
16
+ * This represents the filter as an include/exclude multi-picker; the value returned in the search request will contain included and excluded options.
17
17
  */
18
18
  EXCLUDABLE_MULTISELECT = 3,
19
19
  /**
20
- * This will represent the filter as a textfield, the value returned will be a string
20
+ * This represents the filter as a text field; the value returned in the search request will be a string.
21
21
  */
22
22
  TEXT = 4,
23
23
  /**
24
- * This is a basic filter that will only display the title or subtitle, it will not return any value in the populated `DirectoryRequest`
24
+ * This represents the filter as a numeric stepper; the value returned in the search request will be a number.
25
25
  */
26
- INFO = 5
27
- }
28
- export type SearchFilter = {
26
+ STEPPER = 5,
29
27
  /**
30
- * The ID of the filter
28
+ * This represents the filter as a date picker; the value returned in the search request will be an ISO-8601 string.
31
29
  */
30
+ DATEPICKER = 6
31
+ }
32
+ export type SearchFieldBase = {
32
33
  id: string;
33
- /**
34
- * The Title of the Filter
35
- */
36
34
  title: string;
37
- /**
38
- * The subtitle of the filter
39
- */
40
35
  subtitle?: string;
41
- /**
42
- * The Filter Type
43
- */
44
- type: FilterType;
45
- /**
46
- * The Filter's Options if the filter type is SELECT,MULTISELECT,EXCLUDABLE_SELECT
47
- */
48
- options?: Option[];
49
36
  };
37
+ export declare enum SearchPickerPresentation {
38
+ PAGE = "page",
39
+ PICKER = "picker"
40
+ }
41
+ export type SearchPickerField = SearchFieldBase & {
42
+ type: FilterType.SELECT;
43
+ options: Option[];
44
+ presentation?: SearchPickerPresentation;
45
+ };
46
+ export type SearchMultiPickerField = SearchFieldBase & {
47
+ type: FilterType.MULTISELECT;
48
+ options: Option[];
49
+ };
50
+ export type SearchExcludableMultiPickerField = SearchFieldBase & {
51
+ type: FilterType.EXCLUDABLE_MULTISELECT;
52
+ options: Option[];
53
+ };
54
+ export type SearchOptionField = SearchPickerField | SearchMultiPickerField | SearchExcludableMultiPickerField;
55
+ export type SearchToggleField = SearchFieldBase & {
56
+ type: FilterType.TOGGLE;
57
+ options?: never;
58
+ };
59
+ export type SearchTextField = SearchFieldBase & {
60
+ type: FilterType.TEXT;
61
+ options?: never;
62
+ placeholder?: string;
63
+ };
64
+ export type SearchStepperField = SearchFieldBase & {
65
+ type: FilterType.STEPPER;
66
+ options?: never;
67
+ upperBound?: number;
68
+ lowerBound?: number;
69
+ allowDecimal?: true | "true";
70
+ step?: number;
71
+ };
72
+ export type SearchDatePickerField = SearchFieldBase & {
73
+ type: FilterType.DATEPICKER;
74
+ options?: never;
75
+ };
76
+ export type SearchListField = SearchOptionField | SearchToggleField | SearchTextField | SearchStepperField | SearchDatePickerField;
77
+ export type SearchField = SearchListField;
78
+ export type SearchFilter = SearchListField;
50
79
  export type ExcludableMultiSelectProp = {
51
- included: string[];
52
- excluded: string[];
80
+ included: Option[];
81
+ excluded: Option[];
53
82
  };
@@ -1,30 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FilterType = void 0;
3
+ exports.SearchPickerPresentation = exports.FilterType = void 0;
4
4
  var FilterType;
5
5
  (function (FilterType) {
6
6
  /**
7
- * This Represents the filter as a toggle switch, the value returned in the directory request will be a `boolean`
7
+ * This represents the filter as a toggle switch; the value returned in the search request will be a boolean.
8
8
  */
9
9
  FilterType[FilterType["TOGGLE"] = 0] = "TOGGLE";
10
10
  /**
11
- * This represents the filter as a picker, the value returned will be the `key` of the selected option as a `string`
11
+ * This represents the filter as a picker; the value returned in the search request will be the selected option.
12
12
  */
13
13
  FilterType[FilterType["SELECT"] = 1] = "SELECT";
14
14
  /**
15
- * This Represents the filter as a multi-picker, the value returned will the the keys of the selected options as an array of strings
15
+ * This represents the filter as a multi-picker; the value returned in the search request will be the selected options.
16
16
  */
17
17
  FilterType[FilterType["MULTISELECT"] = 2] = "MULTISELECT";
18
18
  /**
19
- * This Represents the filter as a multi-picker,the value returned will be of type {@link ExcludableMultiSelectProp}
19
+ * This represents the filter as an include/exclude multi-picker; the value returned in the search request will contain included and excluded options.
20
20
  */
21
21
  FilterType[FilterType["EXCLUDABLE_MULTISELECT"] = 3] = "EXCLUDABLE_MULTISELECT";
22
22
  /**
23
- * This will represent the filter as a textfield, the value returned will be a string
23
+ * This represents the filter as a text field; the value returned in the search request will be a string.
24
24
  */
25
25
  FilterType[FilterType["TEXT"] = 4] = "TEXT";
26
26
  /**
27
- * This is a basic filter that will only display the title or subtitle, it will not return any value in the populated `DirectoryRequest`
27
+ * This represents the filter as a numeric stepper; the value returned in the search request will be a number.
28
28
  */
29
- FilterType[FilterType["INFO"] = 5] = "INFO";
29
+ FilterType[FilterType["STEPPER"] = 5] = "STEPPER";
30
+ /**
31
+ * This represents the filter as a date picker; the value returned in the search request will be an ISO-8601 string.
32
+ */
33
+ FilterType[FilterType["DATEPICKER"] = 6] = "DATEPICKER";
30
34
  })(FilterType || (exports.FilterType = FilterType = {}));
35
+ var SearchPickerPresentation;
36
+ (function (SearchPickerPresentation) {
37
+ SearchPickerPresentation["PAGE"] = "page";
38
+ SearchPickerPresentation["PICKER"] = "picker";
39
+ })(SearchPickerPresentation || (exports.SearchPickerPresentation = SearchPickerPresentation = {}));
@@ -0,0 +1,81 @@
1
+ import { SortSelection, FilterPrimitives } from "./SearchRequest";
2
+ import { SearchDatePickerField, SearchExcludableMultiPickerField, SearchFieldBase, SearchListField, SearchMultiPickerField, SearchOptionField, SearchPickerPresentation, SearchPickerField, SearchStepperField, SearchTextField as SearchTextFieldDefinition, SearchToggleField } from "./SearchFilter";
3
+ export declare enum SearchSectionType {
4
+ LIST = 0,
5
+ TAGS = 1,
6
+ SORT = 2
7
+ }
8
+ export declare enum SearchSortStyle {
9
+ LIST = "list",
10
+ TAGS = "tags",
11
+ PICKER = "picker"
12
+ }
13
+ export type SearchListSection = {
14
+ type: SearchSectionType.LIST;
15
+ header?: string;
16
+ footer?: string;
17
+ children: SearchListField[];
18
+ };
19
+ export type SearchTagsSection = {
20
+ type: SearchSectionType.TAGS;
21
+ header?: string;
22
+ footer?: string;
23
+ field: SearchOptionField;
24
+ };
25
+ export type SearchSortSection = {
26
+ type: SearchSectionType.SORT;
27
+ header?: string;
28
+ footer?: string;
29
+ style?: SearchSortStyle;
30
+ };
31
+ export type SearchSection = SearchListSection | SearchTagsSection | SearchSortSection;
32
+ export type SearchForm = {
33
+ sections: SearchSection[];
34
+ };
35
+ export type SearchFormSubmission<T extends Record<string, FilterPrimitives> = Record<string, FilterPrimitives>> = {
36
+ filters?: T;
37
+ sort?: SortSelection;
38
+ };
39
+ export type SearchFormValidationResult = {
40
+ valid: true;
41
+ } | {
42
+ valid: false;
43
+ message: string;
44
+ fieldErrors?: Record<string, string>;
45
+ };
46
+ export declare const SearchPicker: (props: SearchFieldBase & {
47
+ options: SearchOptionField["options"];
48
+ presentation?: SearchPickerPresentation;
49
+ }) => SearchPickerField;
50
+ export declare const SearchMultiPicker: (props: SearchFieldBase & {
51
+ options: SearchOptionField["options"];
52
+ }) => SearchMultiPickerField;
53
+ export declare const SearchExcludableMultiPicker: (props: SearchFieldBase & {
54
+ options: SearchOptionField["options"];
55
+ }) => SearchExcludableMultiPickerField;
56
+ export declare const SearchToggle: (props: SearchFieldBase) => SearchToggleField;
57
+ export declare const SearchTextField: (props: SearchFieldBase & {
58
+ placeholder?: string;
59
+ }) => SearchTextFieldDefinition;
60
+ export declare const SearchStepper: (props: SearchFieldBase & {
61
+ upperBound?: number;
62
+ lowerBound?: number;
63
+ allowDecimal?: true | "true";
64
+ step?: number;
65
+ }) => SearchStepperField;
66
+ export declare const SearchDatePicker: (props: SearchFieldBase) => SearchDatePickerField;
67
+ export declare const SearchListSection: (props: {
68
+ header?: string;
69
+ footer?: string;
70
+ children: SearchListField[];
71
+ }) => SearchListSection;
72
+ export declare const SearchTagsSection: (props: {
73
+ header?: string;
74
+ footer?: string;
75
+ field: SearchOptionField;
76
+ }) => SearchTagsSection;
77
+ export declare const SearchSortSection: (props?: {
78
+ header?: string;
79
+ footer?: string;
80
+ style?: SearchSortStyle;
81
+ }) => SearchSortSection;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchSortSection = exports.SearchTagsSection = exports.SearchListSection = exports.SearchDatePicker = exports.SearchStepper = exports.SearchTextField = exports.SearchToggle = exports.SearchExcludableMultiPicker = exports.SearchMultiPicker = exports.SearchPicker = exports.SearchSortStyle = exports.SearchSectionType = void 0;
4
+ const SearchFilter_1 = require("./SearchFilter");
5
+ var SearchSectionType;
6
+ (function (SearchSectionType) {
7
+ SearchSectionType[SearchSectionType["LIST"] = 0] = "LIST";
8
+ SearchSectionType[SearchSectionType["TAGS"] = 1] = "TAGS";
9
+ SearchSectionType[SearchSectionType["SORT"] = 2] = "SORT";
10
+ })(SearchSectionType || (exports.SearchSectionType = SearchSectionType = {}));
11
+ var SearchSortStyle;
12
+ (function (SearchSortStyle) {
13
+ SearchSortStyle["LIST"] = "list";
14
+ SearchSortStyle["TAGS"] = "tags";
15
+ SearchSortStyle["PICKER"] = "picker";
16
+ })(SearchSortStyle || (exports.SearchSortStyle = SearchSortStyle = {}));
17
+ const SearchPicker = (props) => (Object.assign(Object.assign({}, props), { type: SearchFilter_1.FilterType.SELECT }));
18
+ exports.SearchPicker = SearchPicker;
19
+ const SearchMultiPicker = (props) => (Object.assign(Object.assign({}, props), { type: SearchFilter_1.FilterType.MULTISELECT }));
20
+ exports.SearchMultiPicker = SearchMultiPicker;
21
+ const SearchExcludableMultiPicker = (props) => (Object.assign(Object.assign({}, props), { type: SearchFilter_1.FilterType.EXCLUDABLE_MULTISELECT }));
22
+ exports.SearchExcludableMultiPicker = SearchExcludableMultiPicker;
23
+ const SearchToggle = (props) => (Object.assign(Object.assign({}, props), { type: SearchFilter_1.FilterType.TOGGLE }));
24
+ exports.SearchToggle = SearchToggle;
25
+ const SearchTextField = (props) => (Object.assign(Object.assign({}, props), { type: SearchFilter_1.FilterType.TEXT }));
26
+ exports.SearchTextField = SearchTextField;
27
+ const SearchStepper = (props) => (Object.assign(Object.assign({}, props), { type: SearchFilter_1.FilterType.STEPPER }));
28
+ exports.SearchStepper = SearchStepper;
29
+ const SearchDatePicker = (props) => (Object.assign(Object.assign({}, props), { type: SearchFilter_1.FilterType.DATEPICKER }));
30
+ exports.SearchDatePicker = SearchDatePicker;
31
+ const SearchListSection = (props) => (Object.assign(Object.assign({}, props), { type: SearchSectionType.LIST }));
32
+ exports.SearchListSection = SearchListSection;
33
+ const SearchTagsSection = (props) => (Object.assign(Object.assign({}, props), { type: SearchSectionType.TAGS }));
34
+ exports.SearchTagsSection = SearchTagsSection;
35
+ const SearchSortSection = (props = {}) => (Object.assign(Object.assign({}, props), { type: SearchSectionType.SORT }));
36
+ exports.SearchSortSection = SearchSortSection;
@@ -1,6 +1,6 @@
1
- import { ContextProvider } from "../core";
1
+ import { ContextProvider, Option } from "../core";
2
2
  import { ExcludableMultiSelectProp } from "./SearchFilter";
3
- export type FilterPrimitives = string | string[] | boolean | number | ExcludableMultiSelectProp;
3
+ export type FilterPrimitives = string | boolean | number | Option | Option[] | ExcludableMultiSelectProp;
4
4
  export type SearchRequest<T extends Record<string, FilterPrimitives> = any> = ContextProvider & {
5
5
  /**
6
6
  * The Keywords the User would like to search
@@ -1,3 +1,4 @@
1
1
  export * from "./SearchRequest";
2
- export * from "./SearchFilter";
2
+ export { ExcludableMultiSelectProp, FilterType, SearchExcludableMultiPickerField, SearchField, SearchFieldBase, SearchFilter, SearchDatePickerField, SearchListField, SearchMultiPickerField, SearchOptionField, SearchPickerField, SearchPickerPresentation, SearchStepperField, SearchTextField as SearchTextFieldDefinition, SearchToggleField, } from "./SearchFilter";
3
3
  export * from "./SortOption";
4
+ export { SearchDatePicker, SearchExcludableMultiPicker, SearchForm, SearchFormSubmission, SearchFormValidationResult, SearchListSection, SearchMultiPicker, SearchPicker, SearchSection, SearchSectionType, SearchSortSection, SearchSortStyle, SearchTagsSection, SearchStepper, SearchTextField, SearchToggle, } from "./SearchForm";
@@ -14,6 +14,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SearchToggle = exports.SearchTextField = exports.SearchStepper = exports.SearchTagsSection = exports.SearchSortStyle = exports.SearchSortSection = exports.SearchSectionType = exports.SearchPicker = exports.SearchMultiPicker = exports.SearchListSection = exports.SearchExcludableMultiPicker = exports.SearchDatePicker = exports.SearchPickerPresentation = exports.FilterType = void 0;
17
18
  __exportStar(require("./SearchRequest"), exports);
18
- __exportStar(require("./SearchFilter"), exports);
19
+ var SearchFilter_1 = require("./SearchFilter");
20
+ Object.defineProperty(exports, "FilterType", { enumerable: true, get: function () { return SearchFilter_1.FilterType; } });
21
+ Object.defineProperty(exports, "SearchPickerPresentation", { enumerable: true, get: function () { return SearchFilter_1.SearchPickerPresentation; } });
19
22
  __exportStar(require("./SortOption"), exports);
23
+ var SearchForm_1 = require("./SearchForm");
24
+ Object.defineProperty(exports, "SearchDatePicker", { enumerable: true, get: function () { return SearchForm_1.SearchDatePicker; } });
25
+ Object.defineProperty(exports, "SearchExcludableMultiPicker", { enumerable: true, get: function () { return SearchForm_1.SearchExcludableMultiPicker; } });
26
+ Object.defineProperty(exports, "SearchListSection", { enumerable: true, get: function () { return SearchForm_1.SearchListSection; } });
27
+ Object.defineProperty(exports, "SearchMultiPicker", { enumerable: true, get: function () { return SearchForm_1.SearchMultiPicker; } });
28
+ Object.defineProperty(exports, "SearchPicker", { enumerable: true, get: function () { return SearchForm_1.SearchPicker; } });
29
+ Object.defineProperty(exports, "SearchSectionType", { enumerable: true, get: function () { return SearchForm_1.SearchSectionType; } });
30
+ Object.defineProperty(exports, "SearchSortSection", { enumerable: true, get: function () { return SearchForm_1.SearchSortSection; } });
31
+ Object.defineProperty(exports, "SearchSortStyle", { enumerable: true, get: function () { return SearchForm_1.SearchSortStyle; } });
32
+ Object.defineProperty(exports, "SearchTagsSection", { enumerable: true, get: function () { return SearchForm_1.SearchTagsSection; } });
33
+ Object.defineProperty(exports, "SearchStepper", { enumerable: true, get: function () { return SearchForm_1.SearchStepper; } });
34
+ Object.defineProperty(exports, "SearchTextField", { enumerable: true, get: function () { return SearchForm_1.SearchTextField; } });
35
+ Object.defineProperty(exports, "SearchToggle", { enumerable: true, get: function () { return SearchForm_1.SearchToggle; } });
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- /*import { Highlight, Property } from "../content";
3
- import { PublicationStatus } from "../content/Enums";*/
4
2
  Object.defineProperty(exports, "__esModule", { value: true });
5
3
  exports.TrackStatus = void 0;
6
4
  var TrackStatus;
@@ -12,20 +10,3 @@ var TrackStatus;
12
10
  TrackStatus["DROPPED"] = "DROPPED";
13
11
  TrackStatus["REREADING"] = "REREADING";
14
12
  })(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.20",
3
+ "version": "0.0.22",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -1,14 +0,0 @@
1
- import { DirectoryRequest, PagedResult, DirectoryConfig } from "../../../types";
2
- export interface DirectoryHandler {
3
- /**
4
- * Fetches items/results for a directory request.
5
- */
6
- getDirectory(request: DirectoryRequest): Promise<PagedResult>;
7
- /**
8
- * Fetches the required directory config for a request
9
- *
10
- * Mana will cache the response for each Configuration Key upon first resolution as the Configuration is not intended to be dynamic.
11
- * @param configID The Configuration key defined by the pre-provided {@link DirectoryRequest}. Will be undefined or null to use the default configuration
12
- */
13
- getDirectoryConfig(configID?: string): Promise<DirectoryConfig>;
14
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +0,0 @@
1
- import { DirectoryRequest } from "../directory";
2
- import { Highlight } from "./Highlight";
3
- export type HighlightCollection = {
4
- /**
5
- * The ID of the Collection
6
- */
7
- id: string;
8
- /**
9
- * The Title of the Collection
10
- */
11
- title: string;
12
- /**
13
- * The Subtitle of the Collection.
14
- */
15
- subtitle?: string;
16
- /**
17
- * The Highlights/Titles to be displayed within this collection
18
- */
19
- highlights: Highlight[];
20
- /**
21
- * The Directory Request to be made to view more results from this collection
22
- */
23
- request?: DirectoryRequest;
24
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- export type ContextMenuAction = {
2
- id: string;
3
- title: string;
4
- systemImage?: string;
5
- destructive?: boolean;
6
- /**
7
- * If enabled the action will be displayed basically as a grayed out text label
8
- */
9
- displayAsPlainLabel?: boolean;
10
- };
11
- export type ContextMenuGroup = {
12
- id: string;
13
- actions: ContextMenuAction[];
14
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- import { Highlight } from "../content";
2
- export type PagedResult = {
3
- /**
4
- * The results on this page
5
- */
6
- results: Highlight[];
7
- /**
8
- * Boolean Indicating whether this is the last available page.
9
- *
10
- * If this value is true or the results count is 0, Suwatte will stop making subsequent pagination requests
11
- */
12
- isLastPage: boolean;
13
- /**
14
- * The Total Results Count
15
- */
16
- totalResultCount?: number;
17
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,31 +0,0 @@
1
- import { Option } from "../core";
2
- import { DirectoryFilter } from "./DirectoryFilter";
3
- import { SortSelection } from "./DirectoryRequest";
4
- export type DirectoryConfig = {
5
- /**
6
- * Filters available
7
- */
8
- filters?: DirectoryFilter[];
9
- /**
10
- * Sort Options
11
- */
12
- sort?: {
13
- /**
14
- * Options Available
15
- */
16
- options: Option[];
17
- default?: SortSelection;
18
- /**
19
- * Indicates whether the sort order can be configured as ascending or descending
20
- */
21
- canChangeOrder?: boolean;
22
- };
23
- /**
24
- * Lists are similar to pages but are predefined.
25
- */
26
- lists?: Option[];
27
- /**
28
- * If set to true, suwatte will display the search bar. Defaults to true
29
- */
30
- searchable?: boolean;
31
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,53 +0,0 @@
1
- import { Option } from "../core";
2
- export declare enum FilterType {
3
- /**
4
- * This Represents the filter as a toggle switch, the value returned in the directory request will be a `boolean`
5
- */
6
- TOGGLE = 0,
7
- /**
8
- * This represents the filter as a picker, the value returned will be the `key` of the selected option as a `string`
9
- */
10
- SELECT = 1,
11
- /**
12
- * This Represents the filter as a multi-picker, the value returned will the the keys of the selected options as an array of strings
13
- */
14
- MULTISELECT = 2,
15
- /**
16
- * This Represents the filter as a multi-picker,the value returned will be of type {@link ExcludableMultiSelectProp}
17
- */
18
- EXCLUDABLE_MULTISELECT = 3,
19
- /**
20
- * This will represent the filter as a textfield, the value returned will be a string
21
- */
22
- TEXT = 4,
23
- /**
24
- * This is a basic filter that will only display the title or subtitle, it will not return any value in the populated `DirectoryRequest`
25
- */
26
- INFO = 5
27
- }
28
- export type DirectoryFilter = {
29
- /**
30
- * The ID of the filter
31
- */
32
- id: string;
33
- /**
34
- * The Title of the Filter
35
- */
36
- title: string;
37
- /**
38
- * The subtitle of the filter
39
- */
40
- subtitle?: string;
41
- /**
42
- * The Filter Type
43
- */
44
- type: FilterType;
45
- /**
46
- * The Filter's Options if the filter type is SELECT,MULTISELECT,EXCLUDABLE_SELECT
47
- */
48
- options?: Option[];
49
- };
50
- export type ExcludableMultiSelectProp = {
51
- included: string[];
52
- excluded: string[];
53
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FilterType = void 0;
4
- var FilterType;
5
- (function (FilterType) {
6
- /**
7
- * This Represents the filter as a toggle switch, the value returned in the directory request will be a `boolean`
8
- */
9
- FilterType[FilterType["TOGGLE"] = 0] = "TOGGLE";
10
- /**
11
- * This represents the filter as a picker, the value returned will be the `key` of the selected option as a `string`
12
- */
13
- FilterType[FilterType["SELECT"] = 1] = "SELECT";
14
- /**
15
- * This Represents the filter as a multi-picker, the value returned will the the keys of the selected options as an array of strings
16
- */
17
- FilterType[FilterType["MULTISELECT"] = 2] = "MULTISELECT";
18
- /**
19
- * This Represents the filter as a multi-picker,the value returned will be of type {@link ExcludableMultiSelectProp}
20
- */
21
- FilterType[FilterType["EXCLUDABLE_MULTISELECT"] = 3] = "EXCLUDABLE_MULTISELECT";
22
- /**
23
- * This will represent the filter as a textfield, the value returned will be a string
24
- */
25
- FilterType[FilterType["TEXT"] = 4] = "TEXT";
26
- /**
27
- * This is a basic filter that will only display the title or subtitle, it will not return any value in the populated `DirectoryRequest`
28
- */
29
- FilterType[FilterType["INFO"] = 5] = "INFO";
30
- })(FilterType || (exports.FilterType = FilterType = {}));
@@ -1,37 +0,0 @@
1
- import { ContextProvider } from "../core";
2
- import { ExcludableMultiSelectProp } from "./DirectoryFilter";
3
- export type FilterPrimitives = string | string[] | boolean | number | ExcludableMultiSelectProp;
4
- export type DirectoryRequest<T extends Record<string, FilterPrimitives> = any> = ContextProvider & {
5
- /**
6
- * The Keywords the User would like to search
7
- */
8
- query?: string;
9
- /**
10
- * The Page Number of the current search
11
- */
12
- page: number;
13
- listId?: string;
14
- /**
15
- * The User Selected Sort ID
16
- */
17
- sort?: SortSelection;
18
- /**
19
- * The populated filters with their mapped corresponding type
20
- */
21
- filters?: T;
22
- /**
23
- * When a user wants to view the entries in a single tag, this property will be populated with the tags identifier
24
- */
25
- tag?: {
26
- tagId: string;
27
- propertyId: string;
28
- };
29
- /**
30
- * Define the Configuration Suwatte should pass
31
- */
32
- configID?: string;
33
- };
34
- export type SortSelection = {
35
- id: string;
36
- ascending?: boolean;
37
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export * from "./DirectoryConfig";
2
- export * from "./DirectoryRequest";
3
- export * from "./DirectoryFilter";
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./DirectoryConfig"), exports);
18
- __exportStar(require("./DirectoryRequest"), exports);
19
- __exportStar(require("./DirectoryFilter"), exports);