@sparted/shared-library 1.0.29 → 1.1.0-rc1

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 (40) hide show
  1. package/_virtual/_tslib.js +6 -1
  2. package/_virtual/_tslib.js.map +1 -1
  3. package/array/array-to-map.d.ts +1 -1
  4. package/business/picture-spot/index.d.ts +2 -0
  5. package/business/picture-spot/index.js +8 -0
  6. package/business/picture-spot/index.js.map +1 -0
  7. package/business/types/content.d.ts +84 -0
  8. package/business/types/index.d.ts +4 -0
  9. package/business/types/index.js +3 -0
  10. package/{color → business/types}/index.js.map +1 -1
  11. package/business/types/media.d.ts +16 -0
  12. package/business/types/multilingual.d.ts +3 -0
  13. package/business/types/thematic.d.ts +9 -0
  14. package/cdn/types/cdn-factory.type.d.ts +14 -14
  15. package/cdn/utils/extract-info-from-url.util.d.ts +1 -1
  16. package/cdn/utils/get-cdn-from-s3-url.util.d.ts +1 -1
  17. package/cdn/utils/get-cdn-url.util.d.ts +1 -1
  18. package/fp/run-while.d.ts +2 -2
  19. package/http/encode-search-object.d.ts +1 -1
  20. package/http/fetch-with-timeout.d.ts +1 -1
  21. package/index.d.ts +0 -1
  22. package/index.js +0 -2
  23. package/index.js.map +1 -1
  24. package/linked-list/linked-list-utils.d.ts +4 -4
  25. package/linked-list/type.d.ts +7 -7
  26. package/math/interpolate.d.ts +1 -1
  27. package/math/number-range.d.ts +1 -1
  28. package/package.json +3 -4
  29. package/promise/execute-or-resolve-default.d.ts +1 -1
  30. package/string/replace-in-template.d.ts +1 -1
  31. package/time/get-time-diff-as-string.d.ts +2 -2
  32. package/types/function.d.ts +1 -1
  33. package/types/general.d.ts +5 -5
  34. package/types/object.d.ts +11 -11
  35. package/types/search.d.ts +8 -8
  36. package/color/get-contrast-color.d.ts +0 -1
  37. package/color/get-contrast-color.js +0 -21
  38. package/color/get-contrast-color.js.map +0 -1
  39. package/color/index.d.ts +0 -1
  40. package/color/index.js +0 -10
@@ -37,7 +37,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
37
37
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
38
38
  step((generator = generator.apply(thisArg, _arguments || [])).next());
39
39
  });
40
- }
40
+ }
41
+
42
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
43
+ var e = new Error(message);
44
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
45
+ };
41
46
 
42
47
  exports.__awaiter = __awaiter;
43
48
  exports.__rest = __rest;
@@ -1 +1 @@
1
- {"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export declare type ArrayToMapOptions<InitialValue, ModifiedValue = InitialValue> = {
1
+ export type ArrayToMapOptions<InitialValue, ModifiedValue = InitialValue> = {
2
2
  /**
3
3
  * Function to return the key used in the map.
4
4
  */
@@ -0,0 +1,2 @@
1
+ import { PictureSpot } from '../types';
2
+ export declare const getQuestions: (content: PictureSpot) => import("../types").MultilingualLabel[] | undefined;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const getQuestions = (content) => { var _a; return (_a = content.items) === null || _a === void 0 ? void 0 : _a.map(({ question }) => question); };
6
+
7
+ exports.getQuestions = getQuestions;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/business/picture-spot/index.ts"],"sourcesContent":["import { PictureSpot } from '../types';\n\nexport const getQuestions = (content: PictureSpot) => content.items?.map(({ question }) => question);\n"],"names":[],"mappings":";;;;AAEO,MAAM,YAAY,GAAG,CAAC,OAAoB,KAAK,EAAA,IAAA,EAAA,CAAA,CAAA,OAAA,CAAA,EAAA,GAAA,OAAO,CAAC,KAAK,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,QAAQ,CAAC,CAAA;;;;"}
@@ -0,0 +1,84 @@
1
+ import { MultilingualLabel } from './multilingual';
2
+ import { Image, Media } from './media';
3
+ import { Thematic } from './thematic';
4
+ export type ErrorText = {
5
+ type: 'error-text';
6
+ gameMedia?: Media;
7
+ explanationMedia?: Media;
8
+ explanation?: MultilingualLabel;
9
+ wrongText?: MultilingualLabel;
10
+ correctText?: MultilingualLabel;
11
+ };
12
+ export type MultipleChoiceQuestion = {
13
+ type: 'mcq';
14
+ gameMedia?: Media;
15
+ question?: MultilingualLabel;
16
+ explanation?: MultilingualLabel;
17
+ explanationMedia?: Media;
18
+ multiselect?: boolean;
19
+ choices?: {
20
+ correct: boolean;
21
+ text: MultilingualLabel;
22
+ }[];
23
+ };
24
+ export type NoInteraction = {
25
+ type: 'no-interaction';
26
+ firstMedia?: Media;
27
+ secondMedia?: Media;
28
+ title?: MultilingualLabel;
29
+ text?: MultilingualLabel;
30
+ };
31
+ export type OpenQuestion = {
32
+ type: 'open-question';
33
+ gameMedia?: Media;
34
+ question?: MultilingualLabel;
35
+ answer?: MultilingualLabel;
36
+ explanation?: MultilingualLabel;
37
+ explanationMedia?: Media;
38
+ levenshteinDistance?: number;
39
+ };
40
+ export type OrderingCards = {
41
+ type: 'ordering-cards';
42
+ explanation?: MultilingualLabel;
43
+ question?: MultilingualLabel;
44
+ topLabel?: MultilingualLabel;
45
+ bottomLabel?: MultilingualLabel;
46
+ cards: MultilingualLabel[];
47
+ };
48
+ export type PictureSpot = {
49
+ type: 'picture-spot';
50
+ image?: Image;
51
+ explanation?: MultilingualLabel;
52
+ items?: {
53
+ x: number;
54
+ y: number;
55
+ r: number;
56
+ question: MultilingualLabel;
57
+ description: MultilingualLabel;
58
+ }[];
59
+ };
60
+ export type SwipingCards = {
61
+ type: 'swiping-cards';
62
+ explanation?: MultilingualLabel;
63
+ question?: MultilingualLabel;
64
+ zones?: {
65
+ position: 'left' | 'right' | 'top' | 'bottom';
66
+ text: MultilingualLabel;
67
+ }[];
68
+ cards?: {
69
+ image?: Image;
70
+ text?: MultilingualLabel;
71
+ answer: 'left' | 'right' | 'top' | 'bottom';
72
+ }[];
73
+ };
74
+ export type Game = ErrorText | MultipleChoiceQuestion | NoInteraction | OpenQuestion | OrderingCards | PictureSpot | SwipingCards;
75
+ export type GameType = 'error-text' | 'mcq' | 'open-question' | 'no-interaction' | 'picture-spot' | 'swiping-cards' | 'ordering-cards';
76
+ export type BaseContent = {
77
+ id: number;
78
+ identifier: string;
79
+ name: MultilingualLabel;
80
+ thematic: Thematic;
81
+ coverImage?: Image;
82
+ status: string;
83
+ };
84
+ export type Content = BaseContent & (ErrorText | MultipleChoiceQuestion | NoInteraction | OpenQuestion | OrderingCards | PictureSpot | SwipingCards);
@@ -0,0 +1,4 @@
1
+ export * from './content';
2
+ export * from './media';
3
+ export * from './thematic';
4
+ export * from './multilingual';
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,16 @@
1
+ export type Image = {
2
+ id: number;
3
+ url: string;
4
+ filename: string;
5
+ width: number;
6
+ height: number;
7
+ };
8
+ export type Video = {
9
+ id: number;
10
+ url: string;
11
+ type: 'Youtube' | 'api.video' | 'Kumullus';
12
+ };
13
+ export type Media = {
14
+ image?: Image;
15
+ video?: Video;
16
+ };
@@ -0,0 +1,3 @@
1
+ export type MultilingualLabel = {
2
+ [languageCode: string]: string;
3
+ };
@@ -0,0 +1,9 @@
1
+ import type { MultilingualLabel } from './multilingual';
2
+ export type Thematic = {
3
+ id: number;
4
+ name: string;
5
+ level: number;
6
+ label: MultilingualLabel;
7
+ icon?: string;
8
+ parentId?: number;
9
+ };
@@ -1,5 +1,5 @@
1
- export declare type BaseUrlMapperFunc = (instanceId: string) => string;
2
- export declare type Transformation = {
1
+ export type BaseUrlMapperFunc = (instanceId: string) => string;
2
+ export type Transformation = {
3
3
  fit?: 'crop' | 'contain';
4
4
  width?: number;
5
5
  height?: number;
@@ -11,26 +11,26 @@ export declare type Transformation = {
11
11
  compress?: boolean;
12
12
  output?: 'jpeg' | 'png' | 'webp' | 'image';
13
13
  };
14
- export declare type CdnParams = {
14
+ export type CdnParams = {
15
15
  asThumbnail?: boolean;
16
16
  transformation?: Transformation;
17
17
  };
18
- export declare type TransformationQueries = (params: Transformation) => string;
19
- declare type TwicpicsOutputTransformation = ['output', Transformation['output']];
20
- declare type TwicpicsFitTransformation = ['cover' | 'crop' | 'contain', string] | ['quality', number];
21
- export declare type TwicpicsTransformation = TwicpicsOutputTransformation | TwicpicsFitTransformation;
22
- export declare type TwicpicsTransformationChain = TwicpicsTransformation[];
23
- export declare type GetCdnUrl = (instanceId: string, path: `/${string}`, params?: CdnParams) => string;
24
- export declare type GetCdnFromS3Url = (url: string, params?: CdnParams) => string;
25
- export declare type InstanceMapper = (instanceId: string) => string;
26
- export declare type CdnType = 'twicpics' | 'imgix';
27
- export declare type CdnConfig<T extends CdnType> = {
18
+ export type TransformationQueries = (params: Transformation) => string;
19
+ type TwicpicsOutputTransformation = ['output', Transformation['output']];
20
+ type TwicpicsFitTransformation = ['cover' | 'crop' | 'contain', string] | ['quality', number];
21
+ export type TwicpicsTransformation = TwicpicsOutputTransformation | TwicpicsFitTransformation;
22
+ export type TwicpicsTransformationChain = TwicpicsTransformation[];
23
+ export type GetCdnUrl = (instanceId: string, path: `/${string}`, params?: CdnParams) => string;
24
+ export type GetCdnFromS3Url = (url: string, params?: CdnParams) => string;
25
+ export type InstanceMapper = (instanceId: string) => string;
26
+ export type CdnType = 'twicpics' | 'imgix';
27
+ export type CdnConfig<T extends CdnType> = {
28
28
  type: T;
29
29
  domain: `https://${string}`;
30
30
  instanceMapper: InstanceMapper;
31
31
  cacheVersion?: T extends 'twicpics' ? number : undefined;
32
32
  };
33
- export declare type Cdn = {
33
+ export type Cdn = {
34
34
  getCdnUrl: GetCdnUrl;
35
35
  getCdnFromS3Url: GetCdnFromS3Url;
36
36
  };
@@ -1,4 +1,4 @@
1
- declare type ExtractInfoFromUrl = (url: string) => {
1
+ type ExtractInfoFromUrl = (url: string) => {
2
2
  instanceId: string;
3
3
  path: `/${string}`;
4
4
  } | undefined;
@@ -1,5 +1,5 @@
1
1
  import type { GetCdnFromS3Url, GetCdnUrl } from '../types';
2
- declare type FactoryConfig = {
2
+ type FactoryConfig = {
3
3
  getCdnUrl: GetCdnUrl;
4
4
  };
5
5
  export declare function getCdnFromS3UrlFactory(config: FactoryConfig): GetCdnFromS3Url;
@@ -1,5 +1,5 @@
1
1
  import type { GetCdnUrl, InstanceMapper, TransformationQueries } from '../types';
2
- declare type FactoryConfig = {
2
+ type FactoryConfig = {
3
3
  domain: `https://${string}`;
4
4
  instanceMapper: InstanceMapper;
5
5
  transformationQueries: TransformationQueries;
package/fp/run-while.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type RunWhileConfig<T> = {
1
+ export type RunWhileConfig<T> = {
2
2
  /**
3
3
  * Return a boolean to keep running the callback or not.
4
4
  */
@@ -17,7 +17,7 @@ export declare type RunWhileConfig<T> = {
17
17
  */
18
18
  initialValue: T;
19
19
  };
20
- export declare type RunWhileFn = <T>(config: RunWhileConfig<T>) => {
20
+ export type RunWhileFn = <T>(config: RunWhileConfig<T>) => {
21
21
  /**
22
22
  * The callback last result.
23
23
  */
@@ -1,5 +1,5 @@
1
1
  import { SearchObject } from '../types';
2
- export declare type EncodingConfig = {
2
+ export type EncodingConfig = {
3
3
  keyValueDelimiter: string;
4
4
  pairDelimiter: string;
5
5
  };
@@ -1,4 +1,4 @@
1
- export declare type RequestInitWithTimeout = RequestInit & {
1
+ export type RequestInitWithTimeout = RequestInit & {
2
2
  timeout?: number;
3
3
  };
4
4
  /**
package/index.d.ts CHANGED
@@ -12,4 +12,3 @@ export * from './predicates';
12
12
  export * from './promise';
13
13
  export * from './string';
14
14
  export * from './types';
15
- export * from './color';
package/index.js CHANGED
@@ -37,7 +37,6 @@ var executeWithDelay = require('./promise/execute-with-delay.js');
37
37
  var delay = require('./promise/delay.js');
38
38
  var replaceInTemplate = require('./string/replace-in-template.js');
39
39
  var isStringLengthWithinRange = require('./string/is-string-length-within-range.js');
40
- var getContrastColor = require('./color/get-contrast-color.js');
41
40
 
42
41
 
43
42
 
@@ -83,5 +82,4 @@ exports.executeWithDelay = executeWithDelay.executeWithDelay;
83
82
  exports.delay = delay.delay;
84
83
  exports.replaceInTemplate = replaceInTemplate.replaceInTemplate;
85
84
  exports.isStringLengthWithinRange = isStringLengthWithinRange.isStringLengthWithinRange;
86
- exports.getContrastColor = getContrastColor.getContrastColor;
87
85
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,21 +1,21 @@
1
1
  import { LinkedListFormat, LinkedListItem, SimpleLinkedList } from './type';
2
- export declare type WalkConfig<T extends LinkedListItem, Result> = {
2
+ export type WalkConfig<T extends LinkedListItem, Result> = {
3
3
  startId: string | null;
4
4
  items: Record<string, T>;
5
5
  initValue: Result;
6
6
  };
7
- declare type WalkCallbackResult<R> = {
7
+ type WalkCallbackResult<R> = {
8
8
  result: R;
9
9
  control?: {
10
10
  stop?: boolean;
11
11
  };
12
12
  };
13
- export declare type WalkCallback<Item, Result> = (accumulator: Result, current: Item) => WalkCallbackResult<Result>;
13
+ export type WalkCallback<Item, Result> = (accumulator: Result, current: Item) => WalkCallbackResult<Result>;
14
14
  export declare const walkListItemRecord: <T extends LinkedListItem, Result>(callback: WalkCallback<T, Result>, config: WalkConfig<T, Result>) => Result;
15
15
  export declare const findPreviousId: <T extends LinkedListItem>(id: string | null, list: SimpleLinkedList<T>) => string | null;
16
16
  export declare const assertItemCompatibility: <T extends LinkedListItem>(item: T, format: LinkedListFormat | null) => void;
17
17
  export declare const assertPresence: (id: string | null | undefined, items: Record<string, unknown>) => void;
18
- declare type PositionAssertionConfig = {
18
+ type PositionAssertionConfig = {
19
19
  previousId: string | null;
20
20
  list: SimpleLinkedList<LinkedListItem>;
21
21
  };
@@ -1,23 +1,23 @@
1
- export declare type LinkedListItem = {
1
+ export type LinkedListItem = {
2
2
  id: string;
3
3
  nextId: string | null;
4
4
  previousId?: string | null;
5
5
  };
6
- export declare type SimpleLinkedList<T extends LinkedListItem> = {
6
+ export type SimpleLinkedList<T extends LinkedListItem> = {
7
7
  headId: string | null;
8
8
  items: {
9
9
  [id: string]: T;
10
10
  };
11
11
  };
12
- export declare type ReduceCallback<Item, Result> = (accumulator: Result, current: Item) => Result;
13
- export declare type ItemPredicate<Item> = (item: Item) => boolean;
14
- export declare type LinkedListFormat = 'double' | 'single';
15
- export declare type ManipulationConfig<T extends LinkedListItem> = {
12
+ export type ReduceCallback<Item, Result> = (accumulator: Result, current: Item) => Result;
13
+ export type ItemPredicate<Item> = (item: Item) => boolean;
14
+ export type LinkedListFormat = 'double' | 'single';
15
+ export type ManipulationConfig<T extends LinkedListItem> = {
16
16
  format: LinkedListFormat | null;
17
17
  list: SimpleLinkedList<T>;
18
18
  factory: (list: SimpleLinkedList<T>) => LinkedList<T>;
19
19
  };
20
- export declare type LinkedList<T extends LinkedListItem> = {
20
+ export type LinkedList<T extends LinkedListItem> = {
21
21
  readonly head: T | null;
22
22
  readonly items: {
23
23
  [id: string]: T;
@@ -1,2 +1,2 @@
1
- export declare type RangeArray = [number, number];
1
+ export type RangeArray = [number, number];
2
2
  export declare const interpolate: (num: number, inputRange: RangeArray, outputRange: RangeArray) => number;
@@ -1,4 +1,4 @@
1
- export declare type NumberRange = {
1
+ export type NumberRange = {
2
2
  min: number;
3
3
  max: number;
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparted/shared-library",
3
- "version": "1.0.29",
3
+ "version": "1.1.0-rc1",
4
4
  "repository": "git@github.com:Sparted/shared-library.git",
5
5
  "author": {
6
6
  "name": "Sparted",
@@ -9,8 +9,7 @@
9
9
  },
10
10
  "license": "MIT",
11
11
  "sideEffets": false,
12
- "main": "index.js",
13
- "module": "index.js",
12
+ "main": "cjs/index.js",
14
13
  "files": [
15
14
  "**/*",
16
15
  "**/**"
@@ -20,7 +19,7 @@
20
19
  "lint": "eslint .",
21
20
  "clean": "rm -rf ./dist",
22
21
  "build": "yarn clean && rollup --config rollup.config.ts --configPlugin typescript2 && cp package.json ./dist/package.json",
23
- "build-and-publish": "yarn test && yarn build && (cd ./dist && NPM_CONFIG_REGISTRY=undefined npm publish)"
22
+ "build-and-publish": "yarn test && yarn build && (cd ./dist && yarn publish)"
24
23
  },
25
24
  "devDependencies": {
26
25
  "@types/glob": "^8.0.0",
@@ -1,4 +1,4 @@
1
- export declare type ExecutionConfig<Default> = {
1
+ export type ExecutionConfig<Default> = {
2
2
  execute: boolean;
3
3
  defaultValue: Default;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type ReplaceConfig = {
1
+ export type ReplaceConfig = {
2
2
  delimiter: string | {
3
3
  left: string;
4
4
  right: string;
@@ -1,4 +1,4 @@
1
- export declare type MonthLocaleLabels = [
1
+ export type MonthLocaleLabels = [
2
2
  string,
3
3
  string,
4
4
  string,
@@ -12,7 +12,7 @@ export declare type MonthLocaleLabels = [
12
12
  string,
13
13
  string
14
14
  ];
15
- export declare type DiffTemplate = {
15
+ export type DiffTemplate = {
16
16
  /**
17
17
  * e.g.: ("%time% %timelabel% blabla")
18
18
  */
@@ -1 +1 @@
1
- export declare type GenericFunction<TS extends any[], R> = (...args: TS) => R;
1
+ export type GenericFunction<TS extends any[], R> = (...args: TS) => R;
@@ -1,8 +1,8 @@
1
- export declare type Primitive = string | number | boolean;
2
- export declare type Nullable<T> = T | null;
3
- export declare type ValueType = Primitive | null | void | Array<any> | ReadonlyArray<any>;
4
- export declare type ValueOf<T> = T[keyof T];
5
- export declare type Range = {
1
+ export type Primitive = string | number | boolean;
2
+ export type Nullable<T> = T | null;
3
+ export type ValueType = Primitive | null | void | Array<any> | ReadonlyArray<any>;
4
+ export type ValueOf<T> = T[keyof T];
5
+ export type Range = {
6
6
  min: number;
7
7
  max: number;
8
8
  };
package/types/object.d.ts CHANGED
@@ -1,30 +1,30 @@
1
1
  import { ValueType } from './general';
2
- export declare type NonMethodKeys<T> = {
2
+ export type NonMethodKeys<T> = {
3
3
  [P in keyof T]: T[P] extends Function ? never : P;
4
4
  }[keyof T];
5
- export declare type Attributes<T> = {
5
+ export type Attributes<T> = {
6
6
  [K in NonMethodKeys<T>]: T[K];
7
7
  };
8
- export declare type PartialAttributes<T> = {
8
+ export type PartialAttributes<T> = {
9
9
  [K in NonMethodKeys<T>]?: T[K];
10
10
  };
11
- export declare type MethodKeys<T> = {
11
+ export type MethodKeys<T> = {
12
12
  [P in keyof T]: T[P] extends Function ? P : never;
13
13
  }[keyof T];
14
- export declare type Methods<T> = {
14
+ export type Methods<T> = {
15
15
  [K in MethodKeys<T>]: T[K];
16
16
  };
17
- export declare type PartialMethods<T> = {
17
+ export type PartialMethods<T> = {
18
18
  [K in MethodKeys<T>]?: T[K];
19
19
  };
20
- export declare type ClassType<T, Params extends Array<any> = Array<any>> = {
20
+ export type ClassType<T, Params extends Array<any> = Array<any>> = {
21
21
  new (...args: Params): T;
22
22
  };
23
- export declare type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
24
- export declare type DeepPartial<T> = T extends ValueType ? T : {
23
+ export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
24
+ export type DeepPartial<T> = T extends ValueType ? T : {
25
25
  [P in keyof T]?: DeepPartial<T[P]>;
26
26
  };
27
- export declare type Intersection<A, B> = {
27
+ export type Intersection<A, B> = {
28
28
  [P in keyof A & keyof B]: A[P] | B[P];
29
29
  };
30
30
  /**
@@ -32,4 +32,4 @@ export declare type Intersection<A, B> = {
32
32
  * "widen" the type by accident if it is a generic that should be inferred
33
33
  * from elsewhere.
34
34
  */
35
- export declare type NoInfer<T> = [T][T extends any ? 0 : never];
35
+ export type NoInfer<T> = [T][T extends any ? 0 : never];
package/types/search.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- export declare type SearchSortBy = string;
2
- export declare type SearchSortOrder = 'asc' | 'desc';
3
- export declare type SearchSort = {
1
+ export type SearchSortBy = string;
2
+ export type SearchSortOrder = 'asc' | 'desc';
3
+ export type SearchSort = {
4
4
  [by: SearchSortBy]: SearchSortOrder;
5
5
  };
6
- export declare type SearchQueryProperty = string;
7
- export declare type SearchQueryValue = string;
8
- export declare type SearchQuery = {
6
+ export type SearchQueryProperty = string;
7
+ export type SearchQueryValue = string;
8
+ export type SearchQuery = {
9
9
  [property: SearchQueryProperty]: SearchQueryValue;
10
10
  };
11
- export declare type SearchObject = {
11
+ export type SearchObject = {
12
12
  offset: number;
13
13
  limit: number;
14
14
  sort?: Record<string, SearchSortOrder>;
15
15
  query?: SearchQuery;
16
16
  };
17
- export declare type SearchResponse<T> = {
17
+ export type SearchResponse<T> = {
18
18
  items: ReadonlyArray<T>;
19
19
  offset: number;
20
20
  limit: number;
@@ -1 +0,0 @@
1
- export declare const getContrastColor: (bgColor: string, lightColor?: string, darkColor?: string) => string;
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const DEFAULT_LIGHT_COLOR = '#FFFFFF';
6
- const DEFAULT_DARK_COLOR = '#000000';
7
- // Based on https://stackoverflow.com/questions/11867545/change-text-color-based-on-brightness-of-the-covered-background-area
8
- const getContrastColor = (bgColor, lightColor = DEFAULT_LIGHT_COLOR, darkColor = DEFAULT_DARK_COLOR) => {
9
- const color = bgColor.charAt(0) === '#' ? bgColor.substring(1, 7) : bgColor;
10
- if (color.length !== 6) {
11
- throw new Error(`Invalid HEX color "${bgColor}" in sparted mail manager.`);
12
- }
13
- const r = parseInt(color.substring(0, 2), 16); // hexToR
14
- const g = parseInt(color.substring(2, 4), 16); // hexToG
15
- const b = parseInt(color.substring(4, 6), 16); // hexToB
16
- // Values from https://www.w3.org/TR/AERT/#color-contrast
17
- return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? darkColor : lightColor;
18
- };
19
-
20
- exports.getContrastColor = getContrastColor;
21
- //# sourceMappingURL=get-contrast-color.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-contrast-color.js","sources":["../../src/color/get-contrast-color.ts"],"sourcesContent":["const DEFAULT_LIGHT_COLOR = '#FFFFFF';\nconst DEFAULT_DARK_COLOR = '#000000';\n\n// Based on https://stackoverflow.com/questions/11867545/change-text-color-based-on-brightness-of-the-covered-background-area\nexport const getContrastColor = (bgColor: string, lightColor: string = DEFAULT_LIGHT_COLOR, darkColor: string = DEFAULT_DARK_COLOR): string => {\n const color = bgColor.charAt(0) === '#' ? bgColor.substring(1, 7) : bgColor;\n\n if (color.length !== 6) {\n throw new Error(`Invalid HEX color \"${bgColor}\" in sparted mail manager.`);\n }\n\n const r = parseInt(color.substring(0, 2), 16); // hexToR\n const g = parseInt(color.substring(2, 4), 16); // hexToG\n const b = parseInt(color.substring(4, 6), 16); // hexToB\n\n // Values from https://www.w3.org/TR/AERT/#color-contrast\n return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? darkColor : lightColor;\n};\n"],"names":[],"mappings":";;;;AAAA,MAAM,mBAAmB,GAAG,SAAS,CAAC;AACtC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAErC;AACO,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,UAAA,GAAqB,mBAAmB,EAAE,SAAoB,GAAA,kBAAkB,KAAY;IAC5I,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC;AAE5E,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACtB,QAAA,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,CAAA,0BAAA,CAA4B,CAAC,CAAC;AAC5E,KAAA;AAED,IAAA,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9C,IAAA,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9C,IAAA,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;;IAG9C,OAAO,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,GAAG,SAAS,GAAG,UAAU,CAAC;AAC1E;;;;"}
package/color/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './get-contrast-color';
package/color/index.js DELETED
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var getContrastColor = require('./get-contrast-color.js');
6
-
7
-
8
-
9
- exports.getContrastColor = getContrastColor.getContrastColor;
10
- //# sourceMappingURL=index.js.map