@trackunit/iris-app-api 0.2.2 → 0.2.4
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.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/types/extensions/fleetExtensionManifest.d.ts +14 -2
- package/src/types/extensions/fleetExtensionManifest.js.map +1 -1
- package/src/types/iconImage.d.ts +28 -13
- package/src/types/iconImage.js +7 -7
- package/src/types/iconImage.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.2.4](https://github.com/Trackunit/manager/compare/iris-app-api/0.2.3...iris-app-api/0.2.4) (2024-09-16)
|
|
6
|
+
|
|
7
|
+
## [0.2.3](https://github.com/Trackunit/manager/compare/iris-app-api/0.2.2...iris-app-api/0.2.3) (2024-09-11)
|
|
8
|
+
|
|
5
9
|
## [0.2.2](https://github.com/Trackunit/manager/compare/iris-app-api/0.2.1...iris-app-api/0.2.2) (2024-09-09)
|
|
6
10
|
|
|
7
11
|
## [0.2.1](https://github.com/Trackunit/manager/compare/iris-app-api/0.2.0...iris-app-api/0.2.1) (2024-09-05)
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IconByName,
|
|
1
|
+
import { IconByName, IconByPath } from "../iconImage";
|
|
2
2
|
import { AbstractExtensionManifest, RegExpType, TranslationKey, Translations } from "../irisAppExtensionManifest";
|
|
3
3
|
import { AccountScope } from "../scopes";
|
|
4
4
|
export interface FleetExtensionManifest extends AbstractExtensionManifest {
|
|
@@ -21,8 +21,20 @@ export interface FleetExtensionManifest extends AbstractExtensionManifest {
|
|
|
21
21
|
scopes?: AccountScope | AccountScope[];
|
|
22
22
|
};
|
|
23
23
|
menuItem: {
|
|
24
|
+
/**
|
|
25
|
+
* The name used in the menu item.
|
|
26
|
+
*/
|
|
24
27
|
name: string | Translations | TranslationKey;
|
|
28
|
+
/**
|
|
29
|
+
* The icon used in the menu item.
|
|
30
|
+
*
|
|
31
|
+
* @deprecated please use image instead.
|
|
32
|
+
*/
|
|
25
33
|
icon: string;
|
|
26
|
-
image?: IconByName |
|
|
34
|
+
image?: IconByName | IconByPath;
|
|
35
|
+
/**
|
|
36
|
+
* Description of the menu item, used in the 'Applications' menu.
|
|
37
|
+
*/
|
|
38
|
+
description?: string | Translations | TranslationKey;
|
|
27
39
|
};
|
|
28
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleetExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/fleetExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { IconByName,
|
|
1
|
+
{"version":3,"file":"fleetExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/fleetExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { IconByName, IconByPath } from \"../iconImage\";\nimport { AbstractExtensionManifest, RegExpType, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport interface FleetExtensionManifest extends AbstractExtensionManifest {\n type: \"FLEET_EXTENSION\";\n\n /**\n * Conditions for the fleet extension to be shown.\n * It is case insensitive so does not matter how you write the brand.\n * brand: \"trackunit\" and brand: \"Trackunit\" will be the same.\n *\n * Its doing AND between the conditions types and OR between the conditions of the same type:\n * - If both model and brand are used/filled out then asset needs to match both model and brand.\n * - If only brand or model is used/filled out then the asset needs to match the filled out property.\n * - If only scopes is used/filled out then the fleet extension will be shown if the user has the required scope.\n * - If more scopes are used/filled out then the fleet extension will be shown if the user has one of the required scopes.\n * - If no conditions are used/filled out then the asset home extension will be shown for all assets.\n */\n conditions?: {\n model?: (string | RegExpType)[] | string | RegExpType;\n brand?: (string | RegExpType)[] | string | RegExpType;\n scopes?: AccountScope | AccountScope[];\n };\n\n menuItem: {\n /**\n * The name used in the menu item.\n */\n name: string | Translations | TranslationKey;\n /**\n * The icon used in the menu item.\n *\n * @deprecated please use image instead.\n */\n icon: string;\n image?: IconByName | IconByPath;\n\n /**\n * Description of the menu item, used in the 'Applications' menu.\n */\n description?: string | Translations | TranslationKey;\n };\n}\n"]}
|
package/src/types/iconImage.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconName } from "./icons.generated";
|
|
2
2
|
type HexColor = `#${string}`;
|
|
3
3
|
type RgbColor = `rgb(${number},${number},${number})`;
|
|
4
|
+
export type SvgImagePath = `${string}.svg`;
|
|
4
5
|
/**
|
|
5
6
|
* Checks if the value is a valid hex color
|
|
6
7
|
*/
|
|
@@ -10,37 +11,51 @@ export declare const isHexColor: (color: any) => color is HexColor;
|
|
|
10
11
|
*/
|
|
11
12
|
export declare const isRgbColor: (color: any) => color is RgbColor;
|
|
12
13
|
export type Color = HexColor | RgbColor;
|
|
13
|
-
export type
|
|
14
|
+
export type Colorable = {
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Color of the background for the icon
|
|
17
|
+
* Supports hex or rgb
|
|
16
18
|
*
|
|
17
|
-
* @example "
|
|
19
|
+
* @example "#ff0000" or "rgb(255,0,0)"
|
|
18
20
|
*/
|
|
19
|
-
|
|
20
|
-
color?: Color;
|
|
21
|
-
};
|
|
22
|
-
export type IconByName = {
|
|
23
|
-
name: IconName;
|
|
21
|
+
background?: Color;
|
|
24
22
|
/**
|
|
25
|
-
* Color of the
|
|
23
|
+
* Color of the foreground for the icon
|
|
26
24
|
* Supports hex or rgb
|
|
27
25
|
*
|
|
28
26
|
* @example "#ff0000" or "rgb(255,0,0)"
|
|
29
27
|
*/
|
|
30
|
-
|
|
28
|
+
foreground?: Color;
|
|
31
29
|
};
|
|
30
|
+
export type IconByPath = {
|
|
31
|
+
/**
|
|
32
|
+
* Path relative to the projects src folder defined in the extensions sourceRoot
|
|
33
|
+
* ONLY supports svg files since we replace the color in the svg file at runtime.
|
|
34
|
+
*
|
|
35
|
+
* @example "assets/icon.svg"
|
|
36
|
+
*/
|
|
37
|
+
path: SvgImagePath;
|
|
38
|
+
} & Colorable;
|
|
39
|
+
export type IconByName = {
|
|
40
|
+
/**
|
|
41
|
+
* Name of the icon from the Iris Icons package
|
|
42
|
+
*
|
|
43
|
+
* @example "MapMarkerPointSquare"
|
|
44
|
+
*/
|
|
45
|
+
name: IconName;
|
|
46
|
+
} & Colorable;
|
|
32
47
|
/**
|
|
33
48
|
* Checks if value is an IconImage
|
|
34
49
|
*
|
|
35
50
|
* @param value - The value to check
|
|
36
|
-
* @returns
|
|
51
|
+
* @returns {boolean} True if value is an IconImage
|
|
37
52
|
*/
|
|
38
|
-
export declare const
|
|
53
|
+
export declare const isIconByPath: (value: unknown) => value is IconByPath;
|
|
39
54
|
/**
|
|
40
55
|
* Checks if value is an IconByName
|
|
41
56
|
*
|
|
42
57
|
* @param value - The value to check
|
|
43
|
-
* @returns - True if value is an IconByName
|
|
58
|
+
* @returns {boolean}- True if value is an IconByName
|
|
44
59
|
*/
|
|
45
60
|
export declare const isIconByName: (value: unknown) => value is IconByName;
|
|
46
61
|
export {};
|
package/src/types/iconImage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isIconByName = exports.
|
|
3
|
+
exports.isIconByName = exports.isIconByPath = exports.isRgbColor = exports.isHexColor = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Checks if the value is a valid hex color
|
|
6
6
|
*/
|
|
@@ -21,20 +21,20 @@ exports.isRgbColor = isRgbColor;
|
|
|
21
21
|
* Checks if value is an IconImage
|
|
22
22
|
*
|
|
23
23
|
* @param value - The value to check
|
|
24
|
-
* @returns
|
|
24
|
+
* @returns {boolean} True if value is an IconImage
|
|
25
25
|
*/
|
|
26
|
-
const
|
|
27
|
-
return
|
|
26
|
+
const isIconByPath = (value) => {
|
|
27
|
+
return typeof value === "object" && value !== null && "path" in value;
|
|
28
28
|
};
|
|
29
|
-
exports.
|
|
29
|
+
exports.isIconByPath = isIconByPath;
|
|
30
30
|
/**
|
|
31
31
|
* Checks if value is an IconByName
|
|
32
32
|
*
|
|
33
33
|
* @param value - The value to check
|
|
34
|
-
* @returns - True if value is an IconByName
|
|
34
|
+
* @returns {boolean}- True if value is an IconByName
|
|
35
35
|
*/
|
|
36
36
|
const isIconByName = (value) => {
|
|
37
|
-
return
|
|
37
|
+
return typeof value === "object" && value !== null && "name" in value;
|
|
38
38
|
};
|
|
39
39
|
exports.isIconByName = isIconByName;
|
|
40
40
|
//# sourceMappingURL=iconImage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconImage.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/iconImage.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"iconImage.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/iconImage.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,8DAA8D;AACvD,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE;IAC1D,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF;;GAEG;AACH,8DAA8D;AACvD,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE;IAC1D,OAAO,mCAAmC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAyCF;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE;IAClE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE;IAClE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB","sourcesContent":["import { IconName } from \"./icons.generated\";\n\ntype HexColor = `#${string}`;\ntype RgbColor = `rgb(${number},${number},${number})`;\nexport type SvgImagePath = `${string}.svg`;\n\n/**\n * Checks if the value is a valid hex color\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isHexColor = (color: any): color is HexColor => {\n return /^#[0-9A-F]{6}$/i.test(color) || /^#[0-9A-F]{3}$/i.test(color);\n};\n\n/**\n * Checks if the value is a valid rgb color\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isRgbColor = (color: any): color is RgbColor => {\n return /^rgb\\(\\d{1,3},\\d{1,3},\\d{1,3}\\)$/i.test(color);\n};\n\nexport type Color = HexColor | RgbColor;\n\nexport type Colorable = {\n /**\n * Color of the background for the icon\n * Supports hex or rgb\n *\n * @example \"#ff0000\" or \"rgb(255,0,0)\"\n */\n background?: Color;\n\n /**\n * Color of the foreground for the icon\n * Supports hex or rgb\n *\n * @example \"#ff0000\" or \"rgb(255,0,0)\"\n */\n foreground?: Color;\n};\n\nexport type IconByPath = {\n /**\n * Path relative to the projects src folder defined in the extensions sourceRoot\n * ONLY supports svg files since we replace the color in the svg file at runtime.\n *\n * @example \"assets/icon.svg\"\n */\n path: SvgImagePath;\n} & Colorable;\n\nexport type IconByName = {\n /**\n * Name of the icon from the Iris Icons package\n *\n * @example \"MapMarkerPointSquare\"\n */\n name: IconName;\n} & Colorable;\n\n/**\n * Checks if value is an IconImage\n *\n * @param value - The value to check\n * @returns {boolean} True if value is an IconImage\n */\nexport const isIconByPath = (value: unknown): value is IconByPath => {\n return typeof value === \"object\" && value !== null && \"path\" in value;\n};\n\n/**\n * Checks if value is an IconByName\n *\n * @param value - The value to check\n * @returns {boolean}- True if value is an IconByName\n */\nexport const isIconByName = (value: unknown): value is IconByName => {\n return typeof value === \"object\" && value !== null && \"name\" in value;\n};\n"]}
|