@trackunit/iris-app-api 1.6.19 → 1.6.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.6.22 (2025-09-02)
2
+
3
+ This was a version bump only for iris-app-api to align it with other projects, there were no code changes.
4
+
5
+ ## 1.6.21 (2025-09-02)
6
+
7
+ This was a version bump only for iris-app-api to align it with other projects, there were no code changes.
8
+
9
+ ## 1.6.20 (2025-09-01)
10
+
11
+ This was a version bump only for iris-app-api to align it with other projects, there were no code changes.
12
+
1
13
  ## 1.6.19 (2025-08-28)
2
14
 
3
15
  This was a version bump only for iris-app-api to align it with other projects, there were no code changes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-api",
3
- "version": "1.6.19",
3
+ "version": "1.6.22",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "engines": {
@@ -1,4 +1,4 @@
1
- import { IconByName, IconByPath } from "../iconImage";
1
+ import { IconByName, IconByPath, ImageByPath } from "../iconImage";
2
2
  import { AbstractExtensionManifest, TranslationKey, Translations } from "../irisAppExtensionManifest";
3
3
  export type WidgetSupportedLocations = "MY_HOME" | "SITE_HOME" | "PLAYGROUND";
4
4
  export type WidgetSupportedFilterBars = "CUSTOMERS" | "ASSETS" | "SITES";
@@ -88,9 +88,10 @@ export interface WidgetExtensionManifest extends AbstractExtensionManifest {
88
88
  */
89
89
  link: string;
90
90
  /**
91
- * A logo can be displayed in the footer to show that the widget is powered by an entity. You can use an SVG logo.
91
+ * A logo can be displayed in the footer to show that the widget is powered by an entity. You can use an SVG logo, and provide background and foreground colors.
92
+ * You can also use a SVG, PNG, JPEG or JPG logo directly max size 150x16px.
92
93
  */
93
- poweredByImage?: IconByPath;
94
+ poweredByImage?: ImageByPath;
94
95
  };
95
96
  /**
96
97
  * The locations where the widget can be placed. Choose between My Home, Site Home and Playground.
@@ -1 +1 @@
1
- {"version":3,"file":"widgetExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/widgetExtensionManifest.ts"],"names":[],"mappings":";;;AASa,QAAA,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAU,CAAC;AAIhE,QAAA,kBAAkB,GAAG;IAChC,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,UAAU;IACV,sBAAsB;IACtB,UAAU;IACV,UAAU;IACV,UAAU;IACV,iBAAiB;IACjB,MAAM;IACN,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,qBAAqB;IACrB,cAAc;IACd,uBAAuB;CACf,CAAC;AAEE,QAAA,8BAA8B,GAAG;IAC5C,GAAG,0BAAkB;IACrB,aAAa;IACb,gBAAgB;IAChB,2BAA2B;IAC3B,6BAA6B;IAC7B,6CAA6C;CAC9C,CAAC;AACW,QAAA,oBAAoB,GAAG,cAAuB,CAAC;AAK/C,QAAA,kCAAkC,GAAG,CAAC,GAAG,sCAA8B,EAAE,4BAAoB,CAAU,CAAC;AAGxG,QAAA,iBAAiB,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAU,CAAC;AAElE,QAAA,iCAAiC,GAAG,CAAC,GAAG,yBAAiB,EAAE,4BAAoB,CAAU,CAAC;AAG1F,QAAA,qBAAqB,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,CAAU,CAAC;AAE1F,QAAA,qCAAqC,GAAG,CAAC,GAAG,6BAAqB,EAAE,4BAAoB,CAAU,CAAC;AAGlG,QAAA,sBAAsB,GAAG,CAAC,KAAK,CAAU,CAAC","sourcesContent":["import { IconByName, IconByPath } from \"../iconImage\";\nimport { AbstractExtensionManifest, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\n\nexport type WidgetSupportedLocations = \"MY_HOME\" | \"SITE_HOME\" | \"PLAYGROUND\";\n\nexport type WidgetSupportedFilterBars = \"CUSTOMERS\" | \"ASSETS\" | \"SITES\";\n\nexport type WidgetSupportedFilters = WidgetSupportedFilterBars | \"TIME_RANGE\";\n\nexport const widgetTypes = [\"KPI\", \"CHART\", \"LIST\", \"MAP\", \"OTHER\"] as const;\n\nexport type WidgetType = (typeof widgetTypes)[number];\n\nexport const allAssetFilterKeys = [\n \"search\",\n \"siteIds\",\n \"groups\",\n \"types\",\n \"assetType\",\n \"brands\",\n \"models\",\n \"criticality\",\n \"activity\",\n \"metadataCompleteness\",\n \"lastSeen\",\n \"followed\",\n \"siteType\",\n \"ownerAccountIds\",\n \"area\",\n \"partner\",\n \"productionYears\",\n \"serviceStatus\",\n \"telematicsConnected\",\n \"activeFilter\",\n \"siteDepotOwnershipIds\",\n] as const;\n\nexport const allAssetFilterKeysWithCustomer = [\n ...allAssetFilterKeys,\n \"customerIds\",\n \"rentalStatuses\",\n \"rentalContractOrderNumber\",\n \"rentalContractReferenceCode\",\n \"rentalContractReferenceCodeDescriptionQuery\",\n];\nexport const customFieldFilterKey = \"customFields\" as const;\nexport type AssetFilterKeys = typeof allAssetFilterKeys;\n\nexport type AssetFilterKeysWithCustomer = typeof allAssetFilterKeysWithCustomer;\n\nexport const allAssetFilterKeysWithCustomFields = [...allAssetFilterKeysWithCustomer, customFieldFilterKey] as const;\nexport type AssetFilterKeysWithCustomFields = typeof allAssetFilterKeysWithCustomFields;\n\nexport const allSiteFilterKeys = [\"search\", \"siteStatus\", \"siteType\"] as const;\nexport type SiteFilterKeys = typeof allSiteFilterKeys;\nexport const allSiteFilterKeysWithCustomFields = [...allSiteFilterKeys, customFieldFilterKey] as const;\nexport type SiteFilterKeysWithCustomFields = typeof allSiteFilterKeysWithCustomFields;\n\nexport const allCustomerFilterKeys = [\"search\", \"customerType\", \"criticality\", \"servicePlan\"] as const;\nexport type CustomerFilterKeys = typeof allCustomerFilterKeys;\nexport const allCustomerFilterKeysWithCustomFields = [...allCustomerFilterKeys, customFieldFilterKey] as const;\nexport type CustomerFilterKeysWithCustomFields = typeof allCustomerFilterKeysWithCustomFields;\n\nexport const allTimeRangeFilterKeys = [\"ALL\"] as const;\nexport type TimeRangeFilterKeys = typeof allTimeRangeFilterKeys;\n\ntype FilterConfig<TFilterKeys extends ReadonlyArray<string>> = {\n include: Array<TFilterKeys[number]>;\n};\n\nexport type SupportedFiltersConfig = {\n ASSETS?: FilterConfig<AssetFilterKeysWithCustomFields>;\n SITES?: FilterConfig<SiteFilterKeysWithCustomFields>;\n CUSTOMERS?: FilterConfig<CustomerFilterKeysWithCustomFields>;\n TIME_RANGE?: FilterConfig<TimeRangeFilterKeys>;\n};\n\n/**\n * BETA! DO NOT USE THIS YET - its under development\n */\nexport interface WidgetExtensionManifest extends AbstractExtensionManifest {\n type: \"WIDGET_EXTENSION\";\n\n preview?: {\n /**\n * The description of the widget will be displayed in the drawer for adding widgets.\n */\n description?: string | Translations | TranslationKey;\n };\n\n /**\n * The widget type is used for filtering the widgets in the drawer.\n */\n widgetType: WidgetType;\n\n /**\n * Each widget must have one fixed size.\n * Standard widgets are 2x2.\n * Smaller widgets can be either 1x1 or 2x1.\n * It is not recommended to create widgets that are larger than 2x2 by default.\n * If a widget needs to support multiple sizes, create a separate widget for each size.\n * Use `allowFullWidth: true` to let users expand the widget across the full width of the screen.\n * This is generally recommended only for charts and maps where a larger display improves usability.\n */\n size: {\n default: {\n width: 1 | 2 | 3 | 4 | 5 | 6;\n height: 1 | 2 | 3 | 4 | 5 | 6;\n };\n allowFullWidth?: boolean;\n };\n\n header: {\n /**\n * The name of the widget to display in the header. Do not place date ranges or fixed filters in the name. It is used for finding the widget in the drawer.\n * Widgets sized 1x1 do not show the name in the header, but it is still visible in the drawer.\n */\n name: string | Translations | TranslationKey;\n\n /**\n * The image of the widget to display in the header, if not it will default to the icon of the manifest.\n * Most standard widgets use icons, but you can use an SVG logo instead.\n */\n image?: IconByName | IconByPath;\n\n /**\n * If true, a button will be on the header and an editDialog from the src folder of this extension will be loaded to allow users to configure the widget.\n */\n hasEditDialog?: boolean;\n };\n\n footer?: {\n /**\n * The link description to display in the footer, if not it will default to localized version of 'See full details'.\n */\n linkDescription?: string | Translations | TranslationKey;\n\n /**\n * The link to display in the footer. The link is fixed and will always point to the same route.\n */\n link: string;\n\n /**\n * A logo can be displayed in the footer to show that the widget is powered by an entity. You can use an SVG logo.\n */\n poweredByImage?: IconByPath;\n };\n\n /**\n * The locations where the widget can be placed. Choose between My Home, Site Home and Playground.\n */\n supportedLocations: Array<WidgetSupportedLocations>;\n\n /**\n * The filters that the widget can be filtered by. To support a date range filter, add \"TIME_RANGE\" to the list. The date range will be displayed separately in the menu.\n * If you would like to lock the filters to a specific value, you can do so by adding the filter to the list and setting the value to the filter.\n */\n supportedFilters?: SupportedFiltersConfig;\n}\n"]}
1
+ {"version":3,"file":"widgetExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/widgetExtensionManifest.ts"],"names":[],"mappings":";;;AASa,QAAA,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAU,CAAC;AAIhE,QAAA,kBAAkB,GAAG;IAChC,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,OAAO;IACP,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,UAAU;IACV,sBAAsB;IACtB,UAAU;IACV,UAAU;IACV,UAAU;IACV,iBAAiB;IACjB,MAAM;IACN,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,qBAAqB;IACrB,cAAc;IACd,uBAAuB;CACf,CAAC;AAEE,QAAA,8BAA8B,GAAG;IAC5C,GAAG,0BAAkB;IACrB,aAAa;IACb,gBAAgB;IAChB,2BAA2B;IAC3B,6BAA6B;IAC7B,6CAA6C;CAC9C,CAAC;AACW,QAAA,oBAAoB,GAAG,cAAuB,CAAC;AAK/C,QAAA,kCAAkC,GAAG,CAAC,GAAG,sCAA8B,EAAE,4BAAoB,CAAU,CAAC;AAGxG,QAAA,iBAAiB,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAU,CAAC;AAElE,QAAA,iCAAiC,GAAG,CAAC,GAAG,yBAAiB,EAAE,4BAAoB,CAAU,CAAC;AAG1F,QAAA,qBAAqB,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,CAAU,CAAC;AAE1F,QAAA,qCAAqC,GAAG,CAAC,GAAG,6BAAqB,EAAE,4BAAoB,CAAU,CAAC;AAGlG,QAAA,sBAAsB,GAAG,CAAC,KAAK,CAAU,CAAC","sourcesContent":["import { IconByName, IconByPath, ImageByPath } from \"../iconImage\";\nimport { AbstractExtensionManifest, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\n\nexport type WidgetSupportedLocations = \"MY_HOME\" | \"SITE_HOME\" | \"PLAYGROUND\";\n\nexport type WidgetSupportedFilterBars = \"CUSTOMERS\" | \"ASSETS\" | \"SITES\";\n\nexport type WidgetSupportedFilters = WidgetSupportedFilterBars | \"TIME_RANGE\";\n\nexport const widgetTypes = [\"KPI\", \"CHART\", \"LIST\", \"MAP\", \"OTHER\"] as const;\n\nexport type WidgetType = (typeof widgetTypes)[number];\n\nexport const allAssetFilterKeys = [\n \"search\",\n \"siteIds\",\n \"groups\",\n \"types\",\n \"assetType\",\n \"brands\",\n \"models\",\n \"criticality\",\n \"activity\",\n \"metadataCompleteness\",\n \"lastSeen\",\n \"followed\",\n \"siteType\",\n \"ownerAccountIds\",\n \"area\",\n \"partner\",\n \"productionYears\",\n \"serviceStatus\",\n \"telematicsConnected\",\n \"activeFilter\",\n \"siteDepotOwnershipIds\",\n] as const;\n\nexport const allAssetFilterKeysWithCustomer = [\n ...allAssetFilterKeys,\n \"customerIds\",\n \"rentalStatuses\",\n \"rentalContractOrderNumber\",\n \"rentalContractReferenceCode\",\n \"rentalContractReferenceCodeDescriptionQuery\",\n];\nexport const customFieldFilterKey = \"customFields\" as const;\nexport type AssetFilterKeys = typeof allAssetFilterKeys;\n\nexport type AssetFilterKeysWithCustomer = typeof allAssetFilterKeysWithCustomer;\n\nexport const allAssetFilterKeysWithCustomFields = [...allAssetFilterKeysWithCustomer, customFieldFilterKey] as const;\nexport type AssetFilterKeysWithCustomFields = typeof allAssetFilterKeysWithCustomFields;\n\nexport const allSiteFilterKeys = [\"search\", \"siteStatus\", \"siteType\"] as const;\nexport type SiteFilterKeys = typeof allSiteFilterKeys;\nexport const allSiteFilterKeysWithCustomFields = [...allSiteFilterKeys, customFieldFilterKey] as const;\nexport type SiteFilterKeysWithCustomFields = typeof allSiteFilterKeysWithCustomFields;\n\nexport const allCustomerFilterKeys = [\"search\", \"customerType\", \"criticality\", \"servicePlan\"] as const;\nexport type CustomerFilterKeys = typeof allCustomerFilterKeys;\nexport const allCustomerFilterKeysWithCustomFields = [...allCustomerFilterKeys, customFieldFilterKey] as const;\nexport type CustomerFilterKeysWithCustomFields = typeof allCustomerFilterKeysWithCustomFields;\n\nexport const allTimeRangeFilterKeys = [\"ALL\"] as const;\nexport type TimeRangeFilterKeys = typeof allTimeRangeFilterKeys;\n\ntype FilterConfig<TFilterKeys extends ReadonlyArray<string>> = {\n include: Array<TFilterKeys[number]>;\n};\n\nexport type SupportedFiltersConfig = {\n ASSETS?: FilterConfig<AssetFilterKeysWithCustomFields>;\n SITES?: FilterConfig<SiteFilterKeysWithCustomFields>;\n CUSTOMERS?: FilterConfig<CustomerFilterKeysWithCustomFields>;\n TIME_RANGE?: FilterConfig<TimeRangeFilterKeys>;\n};\n\n/**\n * BETA! DO NOT USE THIS YET - its under development\n */\nexport interface WidgetExtensionManifest extends AbstractExtensionManifest {\n type: \"WIDGET_EXTENSION\";\n\n preview?: {\n /**\n * The description of the widget will be displayed in the drawer for adding widgets.\n */\n description?: string | Translations | TranslationKey;\n };\n\n /**\n * The widget type is used for filtering the widgets in the drawer.\n */\n widgetType: WidgetType;\n\n /**\n * Each widget must have one fixed size.\n * Standard widgets are 2x2.\n * Smaller widgets can be either 1x1 or 2x1.\n * It is not recommended to create widgets that are larger than 2x2 by default.\n * If a widget needs to support multiple sizes, create a separate widget for each size.\n * Use `allowFullWidth: true` to let users expand the widget across the full width of the screen.\n * This is generally recommended only for charts and maps where a larger display improves usability.\n */\n size: {\n default: {\n width: 1 | 2 | 3 | 4 | 5 | 6;\n height: 1 | 2 | 3 | 4 | 5 | 6;\n };\n allowFullWidth?: boolean;\n };\n\n header: {\n /**\n * The name of the widget to display in the header. Do not place date ranges or fixed filters in the name. It is used for finding the widget in the drawer.\n * Widgets sized 1x1 do not show the name in the header, but it is still visible in the drawer.\n */\n name: string | Translations | TranslationKey;\n\n /**\n * The image of the widget to display in the header, if not it will default to the icon of the manifest.\n * Most standard widgets use icons, but you can use an SVG logo instead.\n */\n image?: IconByName | IconByPath;\n\n /**\n * If true, a button will be on the header and an editDialog from the src folder of this extension will be loaded to allow users to configure the widget.\n */\n hasEditDialog?: boolean;\n };\n\n footer?: {\n /**\n * The link description to display in the footer, if not it will default to localized version of 'See full details'.\n */\n linkDescription?: string | Translations | TranslationKey;\n\n /**\n * The link to display in the footer. The link is fixed and will always point to the same route.\n */\n link: string;\n\n /**\n * A logo can be displayed in the footer to show that the widget is powered by an entity. You can use an SVG logo, and provide background and foreground colors.\n * You can also use a SVG, PNG, JPEG or JPG logo directly max size 150x16px.\n */\n poweredByImage?: ImageByPath;\n };\n\n /**\n * The locations where the widget can be placed. Choose between My Home, Site Home and Playground.\n */\n supportedLocations: Array<WidgetSupportedLocations>;\n\n /**\n * The filters that the widget can be filtered by. To support a date range filter, add \"TIME_RANGE\" to the list. The date range will be displayed separately in the menu.\n * If you would like to lock the filters to a specific value, you can do so by adding the filter to the list and setting the value to the filter.\n */\n supportedFilters?: SupportedFiltersConfig;\n}\n"]}
@@ -2,6 +2,8 @@ import { IconName } from "./icons.generated";
2
2
  type HexColor = `#${string}`;
3
3
  type RgbColor = `rgb(${number},${number},${number})`;
4
4
  export type SvgImagePath = `${string}.svg`;
5
+ export type PngImagePath = `${string}.png`;
6
+ export type JpegImagePath = `${string}.jpeg` | `${string}.jpg`;
5
7
  /**
6
8
  * Checks if the value is a valid hex color
7
9
  */
@@ -36,6 +38,15 @@ export type IconByPath = {
36
38
  */
37
39
  path: SvgImagePath;
38
40
  } & Colorable;
41
+ export type ImageByPath = {
42
+ /**
43
+ * Path relative to the projects src folder defined in the extensions sourceRoot
44
+ * Supports png, jpeg, jpg and svg files.
45
+ *
46
+ * @example "assets/icon1.png" or "assets/icon2.jpeg" or "assets/icon3.jpg" or "assets/icon4.svg"
47
+ */
48
+ path: PngImagePath | JpegImagePath | SvgImagePath;
49
+ };
39
50
  export type IconByName = {
40
51
  /**
41
52
  * Name of the icon from the Iris Icons package
@@ -51,6 +62,34 @@ export type IconByName = {
51
62
  * @returns {boolean} True if value is an IconImage
52
63
  */
53
64
  export declare const isIconByPath: (value: unknown) => value is IconByPath;
65
+ /**
66
+ * Checks if value is a ImageByPath
67
+ *
68
+ * @param value - The value to check
69
+ * @returns {boolean} True if value is a ImageByPath
70
+ */
71
+ export declare const isImageByPath: (value: unknown) => value is ImageByPath;
72
+ /**
73
+ * Checks if the path is a svg path
74
+ *
75
+ * @param path - The path to check
76
+ * @returns {boolean} True if the path is a svg path
77
+ */
78
+ export declare const isSvgPath: (path: string | undefined | null) => path is SvgImagePath;
79
+ /**
80
+ * Checks if the path is a png path
81
+ *
82
+ * @param path - The path to check
83
+ * @returns {boolean} True if the path is a png path
84
+ */
85
+ export declare const isPngPath: (path: string | undefined | null) => path is PngImagePath;
86
+ /**
87
+ * Checks if the path is a jpeg or jpg path
88
+ *
89
+ * @param path - The path to check
90
+ * @returns {boolean} True if the path is a jpeg or jpg path
91
+ */
92
+ export declare const isJpgOrJpegPath: (path: string | undefined | null) => path is JpegImagePath;
54
93
  /**
55
94
  * Checks if value is an IconByName
56
95
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isIconByName = exports.isIconByPath = exports.isRgbColor = exports.isHexColor = void 0;
3
+ exports.isIconByName = exports.isJpgOrJpegPath = exports.isPngPath = exports.isSvgPath = exports.isImageByPath = exports.isIconByPath = exports.isRgbColor = exports.isHexColor = void 0;
4
4
  /**
5
5
  * Checks if the value is a valid hex color
6
6
  */
@@ -24,9 +24,66 @@ exports.isRgbColor = isRgbColor;
24
24
  * @returns {boolean} True if value is an IconImage
25
25
  */
26
26
  const isIconByPath = (value) => {
27
- return typeof value === "object" && value !== null && "path" in value;
27
+ return (typeof value === "object" &&
28
+ value !== null &&
29
+ "path" in value &&
30
+ typeof value.path === "string" &&
31
+ value.path.endsWith(".svg"));
28
32
  };
29
33
  exports.isIconByPath = isIconByPath;
34
+ /**
35
+ * Checks if value is a ImageByPath
36
+ *
37
+ * @param value - The value to check
38
+ * @returns {boolean} True if value is a ImageByPath
39
+ */
40
+ const isImageByPath = (value) => {
41
+ return (typeof value === "object" &&
42
+ value !== null &&
43
+ "path" in value &&
44
+ typeof value.path === "string" &&
45
+ ((0, exports.isPngPath)(value.path) || (0, exports.isJpgOrJpegPath)(value.path) || (0, exports.isSvgPath)(value.path)));
46
+ };
47
+ exports.isImageByPath = isImageByPath;
48
+ /**
49
+ * Checks if the path is a svg path
50
+ *
51
+ * @param path - The path to check
52
+ * @returns {boolean} True if the path is a svg path
53
+ */
54
+ const isSvgPath = (path) => {
55
+ if (path === undefined || path === null) {
56
+ return false;
57
+ }
58
+ return path.endsWith(".svg");
59
+ };
60
+ exports.isSvgPath = isSvgPath;
61
+ /**
62
+ * Checks if the path is a png path
63
+ *
64
+ * @param path - The path to check
65
+ * @returns {boolean} True if the path is a png path
66
+ */
67
+ const isPngPath = (path) => {
68
+ if (path === undefined || path === null) {
69
+ return false;
70
+ }
71
+ return path.endsWith(".png");
72
+ };
73
+ exports.isPngPath = isPngPath;
74
+ /**
75
+ * Checks if the path is a jpeg or jpg path
76
+ *
77
+ * @param path - The path to check
78
+ * @returns {boolean} True if the path is a jpeg or jpg path
79
+ */
80
+ const isJpgOrJpegPath = (path) => {
81
+ if (path === undefined || path === null) {
82
+ return false;
83
+ }
84
+ return path.endsWith(".jpeg") || path.endsWith(".jpg");
85
+ };
86
+ exports.isJpgOrJpegPath = isJpgOrJpegPath;
30
87
  /**
31
88
  * Checks if value is an IconByName
32
89
  *
@@ -1 +1 @@
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"]}
1
+ {"version":3,"file":"iconImage.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/iconImage.ts"],"names":[],"mappings":";;;AASA;;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;AAmDF;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE;IAClE,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB;AAEF;;;;;GAKG;AACI,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE;IACpE,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,CAAC,IAAA,iBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAA,uBAAe,EAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAA,iBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAChF,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,aAAa,iBAQxB;AAEF;;;;;GAKG;AACI,MAAM,SAAS,GAAG,CAAC,IAA+B,EAAwB,EAAE;IACjF,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB;AAEF;;;;;GAKG;AACI,MAAM,SAAS,GAAG,CAAC,IAA+B,EAAwB,EAAE;IACjF,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB;AAEF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,IAA+B,EAAyB,EAAE;IACxF,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC,CAAC;AALW,QAAA,eAAe,mBAK1B;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})`;\n\nexport type SvgImagePath = `${string}.svg`;\nexport type PngImagePath = `${string}.png`;\nexport type JpegImagePath = `${string}.jpeg` | `${string}.jpg`;\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 ImageByPath = {\n /**\n * Path relative to the projects src folder defined in the extensions sourceRoot\n * Supports png, jpeg, jpg and svg files.\n *\n * @example \"assets/icon1.png\" or \"assets/icon2.jpeg\" or \"assets/icon3.jpg\" or \"assets/icon4.svg\"\n */\n path: PngImagePath | JpegImagePath | SvgImagePath;\n};\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 (\n typeof value === \"object\" &&\n value !== null &&\n \"path\" in value &&\n typeof value.path === \"string\" &&\n value.path.endsWith(\".svg\")\n );\n};\n\n/**\n * Checks if value is a ImageByPath\n *\n * @param value - The value to check\n * @returns {boolean} True if value is a ImageByPath\n */\nexport const isImageByPath = (value: unknown): value is ImageByPath => {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"path\" in value &&\n typeof value.path === \"string\" &&\n (isPngPath(value.path) || isJpgOrJpegPath(value.path) || isSvgPath(value.path))\n );\n};\n\n/**\n * Checks if the path is a svg path\n *\n * @param path - The path to check\n * @returns {boolean} True if the path is a svg path\n */\nexport const isSvgPath = (path: string | undefined | null): path is SvgImagePath => {\n if (path === undefined || path === null) {\n return false;\n }\n return path.endsWith(\".svg\");\n};\n\n/**\n * Checks if the path is a png path\n *\n * @param path - The path to check\n * @returns {boolean} True if the path is a png path\n */\nexport const isPngPath = (path: string | undefined | null): path is PngImagePath => {\n if (path === undefined || path === null) {\n return false;\n }\n return path.endsWith(\".png\");\n};\n\n/**\n * Checks if the path is a jpeg or jpg path\n *\n * @param path - The path to check\n * @returns {boolean} True if the path is a jpeg or jpg path\n */\nexport const isJpgOrJpegPath = (path: string | undefined | null): path is JpegImagePath => {\n if (path === undefined || path === null) {\n return false;\n }\n return path.endsWith(\".jpeg\") || path.endsWith(\".jpg\");\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"]}