Skip to content

Commit 77e3ad1

Browse files
[TYPES] Added typeing and schema for Vis-2 icon set (#3076)
* Added types for vis icon set * Added types for vis icon set * Added Readme
1 parent 07f8f37 commit 77e3ad1

File tree

3 files changed

+62
-3
lines changed

3 files changed

+62
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
## __WORK IN PROGRESS__
88
* (@Apollon77) Allows only numbers for ts and tc fields in state when provided for setState
9+
* (@GermanBluefox) Added typing for visIconSets in `io-package.json`(for vis-2 SVG icon sets)
910

1011
## 7.0.7 (2025-04-17) - Lucy
1112
* (@foxriver76) fixed the edge-case problem on Windows (if adapter calls `readDir` on single file)
@@ -43,8 +44,7 @@
4344
* Backups created with 7.0.x cannot be restored with a previous version
4445

4546
**Features**
46-
* (@GermanBluefox) Added support for dynamic notification data
47-
(with this feature developers can create interactive notifications in the Admin adapter)
47+
* (@GermanBluefox) Added support for dynamic notification data (with this feature, developers can create interactive notifications in the Admin adapter)
4848
* (@GermanBluefox/@foxriver76) implemented automatic upload on adapter start if version mismatch is detected
4949
* (@foxriver76) improved backup/restore process to work for arbitrary large installations
5050
* (@foxriver76) added notification if new image is available on Docker Hub (for official docker systems)

packages/types-dev/objects.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,16 @@ declare global {
511511
/** If the widget was written with TypeScript */
512512
bundlerType?: 'module';
513513
/** The vis widget does not support the listed major versions of vis */
514-
ignoreInVersions: number[];
514+
ignoreInVersions?: number[];
515+
}
516+
517+
interface VisIconSet {
518+
name?: ioBroker.StringOrTranslated;
519+
url: string;
520+
/** If set, this is not a widget set, but icon set. url, name and icon are required */
521+
icon?: string; // base 64 string for iconSet (not used for widgetSets)
522+
/** The vis icon set does not support the listed major versions of vis */
523+
ignoreInVersions?: number[];
515524
}
516525

517526
type PaidLicenseType = 'paid' | 'commercial' | 'limited';
@@ -776,6 +785,8 @@ declare global {
776785
version: string;
777786
/** Definition of the vis-2 widgets */
778787
visWidgets?: Record<string, VisWidget>;
788+
/** Definition of the vis-2 icon sets */
789+
visIconSets?: Record<string, VisIconSet>;
779790
/** Include the adapter version in the URL of the web adapter, e.g. `http://ip:port/1.2.3/material` instead of `http://ip:port/material` */
780791
webByVersion?: boolean;
781792
/** Whether the web server in this adapter can be extended with plugin/extensions */

schemas/io-package.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,7 @@
14981498
".+": {
14991499
"description": "The key represents the name of a provided widget set",
15001500
"required": [
1501+
"name",
15011502
"url",
15021503
"components",
15031504
"i18n"
@@ -1526,6 +1527,10 @@
15261527
}
15271528
]
15281529
},
1530+
"name": {
1531+
"description": "Name of the widget set",
1532+
"type": "string"
1533+
},
15291534
"url": {
15301535
"description": "Relative path ('http://ip:port/vis/widgets/' + url) or full url to load component from",
15311536
"type": "string"
@@ -1557,6 +1562,49 @@
15571562
}
15581563
}
15591564
},
1565+
"visIconSets": {
1566+
"description": "Overview of vis 2 SVG icon sets provided by the adapter, define the name of the provided sets as keys",
1567+
"minProperties": 1,
1568+
"type": "object",
1569+
"patternProperties": {
1570+
".+": {
1571+
"description": "The key represents the name of a provided icon set",
1572+
"required": [
1573+
"url"
1574+
],
1575+
"type": "object",
1576+
"properties": {
1577+
"url": {
1578+
"description": "Relative path ('http://ip:port/vis/widgets/' + url) or full url to load JSON file from",
1579+
"type": "string"
1580+
},
1581+
"ignoreInVersions": {
1582+
"description": "The vis icon set does not support the listed major versions of vis",
1583+
"type": "array",
1584+
"items": {
1585+
"type": "number",
1586+
"multipleOf": 1
1587+
}
1588+
},
1589+
"name": {
1590+
"description": "Name of the icon set",
1591+
"anyOf": [
1592+
{
1593+
"type": "string"
1594+
},
1595+
{
1596+
"$ref": "#/definitions/multilingual"
1597+
}
1598+
]
1599+
},
1600+
"icon": {
1601+
"description": "Base 64 icon of the widget set, data:image/svg+xml;base64,...",
1602+
"type": "string"
1603+
}
1604+
}
1605+
}
1606+
}
1607+
},
15601608
"webByVersion": {
15611609
"description": "Show version as prefix in web adapter (usually - ip:port/material, webByVersion - ip:port/1.2.3/material)",
15621610
"type": "boolean"

0 commit comments

Comments
 (0)