@companion-surface/base 0.3.1 → 0.4.1

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,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.1](https://github.com/bitfocus/companion-surface-api/compare/companion-surface-base-v0.4.0...companion-surface-base-v0.4.1) (2025-11-01)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * drop unsupported colors mode ([765bd2b](https://github.com/bitfocus/companion-surface-api/commit/765bd2b759faa00372b1fdda8cc5b7b4cbf137d7))
9
+ * missing hid path ([d62a51e](https://github.com/bitfocus/companion-surface-api/commit/d62a51eaaf012da23281585d98fadb0194883ab3))
10
+
11
+ ## [0.4.0](https://github.com/bitfocus/companion-surface-api/compare/companion-surface-base-v0.3.1...companion-surface-base-v0.4.0) (2025-11-01)
12
+
13
+
14
+ ### Features
15
+
16
+ * custom surface config fields ([ea1a9b5](https://github.com/bitfocus/companion-surface-api/commit/ea1a9b5124f4a48c15292c86ec205ed87f715fab))
17
+ * custom surface config fields ([21abdb6](https://github.com/bitfocus/companion-surface-api/commit/21abdb644ed8b814ee8aed36faa0af250445ccb3))
18
+
3
19
  ## [0.3.1](https://github.com/bitfocus/companion-surface-api/compare/companion-surface-base-v0.3.0...companion-surface-base-v0.3.1) (2025-10-28)
4
20
 
5
21
 
@@ -50,7 +50,7 @@
50
50
  "colors": {
51
51
  "description": "If set, the control requests colours to be reported.",
52
52
  "type": "string",
53
- "enum": ["hex", "rgb"]
53
+ "enum": ["hex"]
54
54
  }
55
55
  },
56
56
  "additionalProperties": false
@@ -152,5 +152,9 @@ export interface CompanionInputFieldNumber extends CompanionInputFieldBase {
152
152
  * Note: values may not conform to this, it is a visual hint only
153
153
  */
154
154
  max: number;
155
+ /**
156
+ * The step size for incrementing/decrementing the value
157
+ */
158
+ step?: number;
155
159
  }
156
160
  //# sourceMappingURL=input.d.ts.map
@@ -1 +1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OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IAEX;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACb"}
@@ -20,6 +20,11 @@ export interface SurfaceInstance {
20
20
  * Clean up any resources, and close the surface
21
21
  */
22
22
  close(): Promise<void>;
23
+ /**
24
+ * If there are any config fields defined, when the user updates the config, this is called to inform the surface of the new config
25
+ * This will be called just before ready() with the initial config
26
+ */
27
+ updateConfig?(config: Record<string, any>): Promise<void>;
23
28
  /**
24
29
  * When the surface transitions into the ready state
25
30
  * This means that it is about to begin drawing
@@ -1 +1 @@
1
- {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/surface-api/instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAA;AAC1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE7D,MAAM,WAAW,eAAe;IAC/B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAE5B;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAErB;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtB;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAItB;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE7C;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtB;;;;OAIG;IACH,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAErE,eAAe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;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtB;;;;OAIG;IACH,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAErE,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAA;IAEhD,gBAAgB,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAEhE;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEnG;;;;OAIG;IACH,uBAAuB,CAAC,CAAC,aAAa,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;CAC9G"}
@@ -1,7 +1,7 @@
1
1
  import type { SurfacePincodeMap } from './pincode.js';
2
2
  import type { SurfaceInstance } from './instance.js';
3
3
  import type { SurfaceSchemaLayoutDefinition } from '../../generated/surface-layout.d.ts';
4
- import type { OptionsObject } from './input.js';
4
+ import type { OptionsObject, SomeCompanionInputField } from './input.js';
5
5
  /**
6
6
  * A representation of a HID device
7
7
  * A simplified form of the HIDDevice from node-hid
@@ -9,6 +9,7 @@ import type { OptionsObject } from './input.js';
9
9
  export interface HIDDevice {
10
10
  vendorId: number;
11
11
  productId: number;
12
+ path: string;
12
13
  serialNumber?: string | undefined;
13
14
  manufacturer?: string | undefined;
14
15
  product?: string | undefined;
@@ -57,6 +58,10 @@ export interface SurfaceRegisterProps {
57
58
  * A user facing location string for the surface
58
59
  */
59
60
  location: string | null;
61
+ /**
62
+ * Any configuration fields for the surface
63
+ */
64
+ configFields: SomeCompanionInputField[] | null;
60
65
  }
61
66
  export interface OpenSurfaceResult {
62
67
  surface: SurfaceInstance;
@@ -1 +1 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,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,2BAA2B;IAC3C,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,aAAa,CAAA;CACrB"}
package/dist/util.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export declare function assertNever(_v: never): void;
2
- export declare function parseColor(color: string | undefined): {
2
+ export interface RgbColor {
3
3
  r: number;
4
4
  g: number;
5
5
  b: number;
6
- };
6
+ }
7
+ export declare function parseColor(color: string | undefined): RgbColor;
7
8
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,EAAE,EAAE,KAAK,GAAG,IAAI,CAE3C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAMzF"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,EAAE,EAAE,KAAK,GAAG,IAAI,CAE3C;AAED,MAAM,WAAW,QAAQ;IACxB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACT;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAM9D"}
package/dist/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,C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CAAC,CAAC,CAAC,CAAA;IAEtD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;AACnB,CAAC"}
@@ -44,7 +44,7 @@ export interface SurfaceSchemaControlStylePreset {
44
44
  /**
45
45
  * If set, the control requests colours to be reported.
46
46
  */
47
- colors?: "hex" | "rgb";
47
+ colors?: "hex";
48
48
  }
49
49
  /**
50
50
  * If set, bitmaps of the specified size will be reported.
@@ -1 +1 @@
1
- "use strict";export const validate = validate20;export default validate20;const schema31 = {"$schema":"https://json-schema.org/draft/2020-12/schema","title":"SurfaceSchemaLayoutDefinition","description":"Schema describing a surface layout: default styling and a map of controls with positions and optional style overrides.","type":"object","$defs":{"size":{"title":"SurfaceSchemaBitmapConfig","description":"Bitmap content dimensions and format.","type":"object","properties":{"w":{"description":"Width in pixels (non-negative).","type":"number","minimum":0},"h":{"description":"Height in pixels (non-negative).","type":"number","minimum":0},"format":{"description":"Buffer pixel format","type":"string","title":"SurfaceSchemaPixelFormat","enum":["rgb","rgba","bgr","bgra"],"default":"rgb"}},"required":["w","h"],"additionalProperties":false},"stylePreset":{"title":"SurfaceSchemaControlStylePreset","description":"Styling options that can be applied to controls. Can be used as the default style or as per-control overrides.","type":"object","properties":{"bitmap":{"description":"If set, bitmaps of the specified size will be reported.","$ref":"#/$defs/size"},"text":{"description":"If true, the control requests text to be reported.","type":"boolean"},"textStyle":{"description":"If true, the control requests text style properties to be reported","type":"boolean"},"colors":{"description":"If set, the control requests colours to be reported.","type":"string","enum":["hex","rgb"]}},"additionalProperties":false}},"properties":{"stylePresets":{"description":"Named collection of style presets. The preset named `default` is required and is used as the fallback style for controls when no `stylePreset` is specified.","type":"object","properties":{"default":{"$ref":"#/$defs/stylePreset"}},"patternProperties":{"^.+$":{"$ref":"#/$defs/stylePreset"}},"required":["default"],"additionalProperties":false},"controls":{"type":"object","patternProperties":{"^[a-zA-Z0-9\\-\\/]+$":{"title":"SurfaceSchemaControlDefinition","description":"Single control definition. The id must be unique and may be user facing in logs. Typically the id would be in the form of 1/0, matching the row/column of the control.","type":"object","properties":{"row":{"description":"Zero-based row index for layout placement.","type":"number","minimum":0},"column":{"description":"Zero-based column index for layout placement.","type":"number","minimum":0},"stylePreset":{"description":"Optional name of a style preset defined in `stylePresets`. If present, the control will use the named preset instead of the default style.","type":"string","pattern":"^.+$"}},"required":["row","column"],"additionalProperties":false}},"additionalProperties":false}},"required":["stylePresets","controls"],"additionalProperties":false};const pattern4 = new RegExp("^.+$", "u");const pattern6 = new RegExp("^[a-zA-Z0-9\\-\\/]+$", "u");const schema32 = {"title":"SurfaceSchemaControlStylePreset","description":"Styling options that can be applied to controls. Can be used as the default style or as per-control overrides.","type":"object","properties":{"bitmap":{"description":"If set, bitmaps of the specified size will be reported.","$ref":"#/$defs/size"},"text":{"description":"If true, the control requests text to be reported.","type":"boolean"},"textStyle":{"description":"If true, the control requests text style properties to be reported","type":"boolean"},"colors":{"description":"If set, the control requests colours to be reported.","type":"string","enum":["hex","rgb"]}},"additionalProperties":false};const schema33 = {"title":"SurfaceSchemaBitmapConfig","description":"Bitmap content dimensions and format.","type":"object","properties":{"w":{"description":"Width in pixels (non-negative).","type":"number","minimum":0},"h":{"description":"Height in pixels (non-negative).","type":"number","minimum":0},"format":{"description":"Buffer pixel format","type":"string","title":"SurfaceSchemaPixelFormat","enum":["rgb","rgba","bgr","bgra"],"default":"rgb"}},"required":["w","h"],"additionalProperties":false};function validate21(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate21.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){const _errs1 = errors;for(const key0 in data){if(!((((key0 === "bitmap") || (key0 === "text")) || (key0 === "textStyle")) || (key0 === "colors"))){validate21.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.bitmap !== undefined){let data0 = data.bitmap;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing0;if(((data0.w === undefined) && (missing0 = "w")) || ((data0.h === undefined) && (missing0 = "h"))){validate21.errors = [{instancePath:instancePath+"/bitmap",schemaPath:"#/$defs/size/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {const _errs5 = errors;for(const key1 in data0){if(!(((key1 === "w") || (key1 === "h")) || (key1 === "format"))){validate21.errors = [{instancePath:instancePath+"/bitmap",schemaPath:"#/$defs/size/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"}];return false;break;}}if(_errs5 === errors){if(data0.w !== undefined){let data1 = data0.w;const _errs6 = errors;if(errors === _errs6){if((typeof data1 == "number") && (isFinite(data1))){if(data1 < 0 || isNaN(data1)){validate21.errors = [{instancePath:instancePath+"/bitmap/w",schemaPath:"#/$defs/size/properties/w/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}else {validate21.errors = [{instancePath:instancePath+"/bitmap/w",schemaPath:"#/$defs/size/properties/w/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.h !== undefined){let data2 = data0.h;const _errs8 = errors;if(errors === _errs8){if((typeof data2 == "number") && (isFinite(data2))){if(data2 < 0 || isNaN(data2)){validate21.errors = [{instancePath:instancePath+"/bitmap/h",schemaPath:"#/$defs/size/properties/h/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}else {validate21.errors = [{instancePath:instancePath+"/bitmap/h",schemaPath:"#/$defs/size/properties/h/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.format !== undefined){let data3 = data0.format;const _errs10 = errors;if(typeof data3 !== "string"){validate21.errors = [{instancePath:instancePath+"/bitmap/format",schemaPath:"#/$defs/size/properties/format/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}if(!((((data3 === "rgb") || (data3 === "rgba")) || (data3 === "bgr")) || (data3 === "bgra"))){validate21.errors = [{instancePath:instancePath+"/bitmap/format",schemaPath:"#/$defs/size/properties/format/enum",keyword:"enum",params:{allowedValues: schema33.properties.format.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}}}else {validate21.errors = [{instancePath:instancePath+"/bitmap",schemaPath:"#/$defs/size/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.text !== undefined){const _errs12 = errors;if(typeof data.text !== "boolean"){validate21.errors = [{instancePath:instancePath+"/text",schemaPath:"#/properties/text/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.textStyle !== undefined){const _errs14 = errors;if(typeof data.textStyle !== "boolean"){validate21.errors = [{instancePath:instancePath+"/textStyle",schemaPath:"#/properties/textStyle/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.colors !== undefined){let data6 = data.colors;const _errs16 = errors;if(typeof data6 !== "string"){validate21.errors = [{instancePath:instancePath+"/colors",schemaPath:"#/properties/colors/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}if(!((data6 === "hex") || (data6 === "rgb"))){validate21.errors = [{instancePath:instancePath+"/colors",schemaPath:"#/properties/colors/enum",keyword:"enum",params:{allowedValues: schema32.properties.colors.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs16 === errors;}else {var valid0 = true;}}}}}}else {validate21.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate21.errors = vErrors;return errors === 0;}validate21.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.stylePresets === undefined) && (missing0 = "stylePresets")) || ((data.controls === undefined) && (missing0 = "controls"))){validate20.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {const _errs1 = errors;for(const key0 in data){if(!((key0 === "stylePresets") || (key0 === "controls"))){validate20.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.stylePresets !== undefined){let data0 = data.stylePresets;const _errs2 = errors;if(errors === _errs2){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if((data0.default === undefined) && (missing1 = "default")){validate20.errors = [{instancePath:instancePath+"/stylePresets",schemaPath:"#/properties/stylePresets/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {const _errs4 = errors;for(const key1 in data0){if(!((key1 === "default") || (pattern4.test(key1)))){validate20.errors = [{instancePath:instancePath+"/stylePresets",schemaPath:"#/properties/stylePresets/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"}];return false;break;}}if(_errs4 === errors){if(data0.default !== undefined){const _errs5 = errors;if(!(validate21(data0.default, {instancePath:instancePath+"/stylePresets/default",parentData:data0,parentDataProperty:"default",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}var valid1 = _errs5 === errors;}else {var valid1 = true;}if(valid1){var valid2 = true;for(const key2 in data0){if(pattern4.test(key2)){const _errs6 = errors;if(!(validate21(data0[key2], {instancePath:instancePath+"/stylePresets/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data0,parentDataProperty:key2,rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}var valid2 = _errs6 === errors;if(!valid2){break;}}}}}}}else {validate20.errors = [{instancePath:instancePath+"/stylePresets",schemaPath:"#/properties/stylePresets/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.controls !== undefined){let data3 = data.controls;const _errs7 = errors;if(errors === _errs7){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){const _errs9 = errors;for(const key3 in data3){if(!(pattern6.test(key3))){validate20.errors = [{instancePath:instancePath+"/controls",schemaPath:"#/properties/controls/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"}];return false;break;}}if(_errs9 === errors){var valid3 = true;for(const key4 in data3){if(pattern6.test(key4)){let data4 = data3[key4];const _errs10 = errors;if(errors === _errs10){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){let missing2;if(((data4.row === undefined) && (missing2 = "row")) || ((data4.column === undefined) && (missing2 = "column"))){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {const _errs12 = errors;for(const key5 in data4){if(!(((key5 === "row") || (key5 === "column")) || (key5 === "stylePreset"))){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"}];return false;break;}}if(_errs12 === errors){if(data4.row !== undefined){let data5 = data4.row;const _errs13 = errors;if(errors === _errs13){if((typeof data5 == "number") && (isFinite(data5))){if(data5 < 0 || isNaN(data5)){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/row",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}else {validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/row",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/row/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}var valid4 = _errs13 === errors;}else {var valid4 = true;}if(valid4){if(data4.column !== undefined){let data6 = data4.column;const _errs15 = errors;if(errors === _errs15){if((typeof data6 == "number") && (isFinite(data6))){if(data6 < 0 || isNaN(data6)){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/column",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/column/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}else {validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/column",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/column/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}var valid4 = _errs15 === errors;}else {var valid4 = true;}if(valid4){if(data4.stylePreset !== undefined){let data7 = data4.stylePreset;const _errs17 = errors;if(errors === _errs17){if(typeof data7 === "string"){if(!pattern4.test(data7)){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/stylePreset",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/stylePreset/pattern",keyword:"pattern",params:{pattern: "^.+$"},message:"must match pattern \""+"^.+$"+"\""}];return false;}}else {validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/stylePreset",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/stylePreset/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid4 = _errs17 === errors;}else {var valid4 = true;}}}}}}else {validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid3 = _errs10 === errors;if(!valid3){break;}}}}}else {validate20.errors = [{instancePath:instancePath+"/controls",schemaPath:"#/properties/controls/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs7 === errors;}else {var valid0 = true;}}}}}else {validate20.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate20.errors = vErrors;return errors === 0;}validate20.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};
1
+ "use strict";export const validate = validate20;export default validate20;const schema31 = {"$schema":"https://json-schema.org/draft/2020-12/schema","title":"SurfaceSchemaLayoutDefinition","description":"Schema describing a surface layout: default styling and a map of controls with positions and optional style overrides.","type":"object","$defs":{"size":{"title":"SurfaceSchemaBitmapConfig","description":"Bitmap content dimensions and format.","type":"object","properties":{"w":{"description":"Width in pixels (non-negative).","type":"number","minimum":0},"h":{"description":"Height in pixels (non-negative).","type":"number","minimum":0},"format":{"description":"Buffer pixel format","type":"string","title":"SurfaceSchemaPixelFormat","enum":["rgb","rgba","bgr","bgra"],"default":"rgb"}},"required":["w","h"],"additionalProperties":false},"stylePreset":{"title":"SurfaceSchemaControlStylePreset","description":"Styling options that can be applied to controls. Can be used as the default style or as per-control overrides.","type":"object","properties":{"bitmap":{"description":"If set, bitmaps of the specified size will be reported.","$ref":"#/$defs/size"},"text":{"description":"If true, the control requests text to be reported.","type":"boolean"},"textStyle":{"description":"If true, the control requests text style properties to be reported","type":"boolean"},"colors":{"description":"If set, the control requests colours to be reported.","type":"string","enum":["hex"]}},"additionalProperties":false}},"properties":{"stylePresets":{"description":"Named collection of style presets. The preset named `default` is required and is used as the fallback style for controls when no `stylePreset` is specified.","type":"object","properties":{"default":{"$ref":"#/$defs/stylePreset"}},"patternProperties":{"^.+$":{"$ref":"#/$defs/stylePreset"}},"required":["default"],"additionalProperties":false},"controls":{"type":"object","patternProperties":{"^[a-zA-Z0-9\\-\\/]+$":{"title":"SurfaceSchemaControlDefinition","description":"Single control definition. The id must be unique and may be user facing in logs. Typically the id would be in the form of 1/0, matching the row/column of the control.","type":"object","properties":{"row":{"description":"Zero-based row index for layout placement.","type":"number","minimum":0},"column":{"description":"Zero-based column index for layout placement.","type":"number","minimum":0},"stylePreset":{"description":"Optional name of a style preset defined in `stylePresets`. If present, the control will use the named preset instead of the default style.","type":"string","pattern":"^.+$"}},"required":["row","column"],"additionalProperties":false}},"additionalProperties":false}},"required":["stylePresets","controls"],"additionalProperties":false};const pattern4 = new RegExp("^.+$", "u");const pattern6 = new RegExp("^[a-zA-Z0-9\\-\\/]+$", "u");const schema32 = {"title":"SurfaceSchemaControlStylePreset","description":"Styling options that can be applied to controls. Can be used as the default style or as per-control overrides.","type":"object","properties":{"bitmap":{"description":"If set, bitmaps of the specified size will be reported.","$ref":"#/$defs/size"},"text":{"description":"If true, the control requests text to be reported.","type":"boolean"},"textStyle":{"description":"If true, the control requests text style properties to be reported","type":"boolean"},"colors":{"description":"If set, the control requests colours to be reported.","type":"string","enum":["hex"]}},"additionalProperties":false};const schema33 = {"title":"SurfaceSchemaBitmapConfig","description":"Bitmap content dimensions and format.","type":"object","properties":{"w":{"description":"Width in pixels (non-negative).","type":"number","minimum":0},"h":{"description":"Height in pixels (non-negative).","type":"number","minimum":0},"format":{"description":"Buffer pixel format","type":"string","title":"SurfaceSchemaPixelFormat","enum":["rgb","rgba","bgr","bgra"],"default":"rgb"}},"required":["w","h"],"additionalProperties":false};function validate21(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate21.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){const _errs1 = errors;for(const key0 in data){if(!((((key0 === "bitmap") || (key0 === "text")) || (key0 === "textStyle")) || (key0 === "colors"))){validate21.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.bitmap !== undefined){let data0 = data.bitmap;const _errs2 = errors;const _errs3 = errors;if(errors === _errs3){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing0;if(((data0.w === undefined) && (missing0 = "w")) || ((data0.h === undefined) && (missing0 = "h"))){validate21.errors = [{instancePath:instancePath+"/bitmap",schemaPath:"#/$defs/size/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {const _errs5 = errors;for(const key1 in data0){if(!(((key1 === "w") || (key1 === "h")) || (key1 === "format"))){validate21.errors = [{instancePath:instancePath+"/bitmap",schemaPath:"#/$defs/size/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"}];return false;break;}}if(_errs5 === errors){if(data0.w !== undefined){let data1 = data0.w;const _errs6 = errors;if(errors === _errs6){if((typeof data1 == "number") && (isFinite(data1))){if(data1 < 0 || isNaN(data1)){validate21.errors = [{instancePath:instancePath+"/bitmap/w",schemaPath:"#/$defs/size/properties/w/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}else {validate21.errors = [{instancePath:instancePath+"/bitmap/w",schemaPath:"#/$defs/size/properties/w/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}var valid2 = _errs6 === errors;}else {var valid2 = true;}if(valid2){if(data0.h !== undefined){let data2 = data0.h;const _errs8 = errors;if(errors === _errs8){if((typeof data2 == "number") && (isFinite(data2))){if(data2 < 0 || isNaN(data2)){validate21.errors = [{instancePath:instancePath+"/bitmap/h",schemaPath:"#/$defs/size/properties/h/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}else {validate21.errors = [{instancePath:instancePath+"/bitmap/h",schemaPath:"#/$defs/size/properties/h/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}var valid2 = _errs8 === errors;}else {var valid2 = true;}if(valid2){if(data0.format !== undefined){let data3 = data0.format;const _errs10 = errors;if(typeof data3 !== "string"){validate21.errors = [{instancePath:instancePath+"/bitmap/format",schemaPath:"#/$defs/size/properties/format/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}if(!((((data3 === "rgb") || (data3 === "rgba")) || (data3 === "bgr")) || (data3 === "bgra"))){validate21.errors = [{instancePath:instancePath+"/bitmap/format",schemaPath:"#/$defs/size/properties/format/enum",keyword:"enum",params:{allowedValues: schema33.properties.format.enum},message:"must be equal to one of the allowed values"}];return false;}var valid2 = _errs10 === errors;}else {var valid2 = true;}}}}}}else {validate21.errors = [{instancePath:instancePath+"/bitmap",schemaPath:"#/$defs/size/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.text !== undefined){const _errs12 = errors;if(typeof data.text !== "boolean"){validate21.errors = [{instancePath:instancePath+"/text",schemaPath:"#/properties/text/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs12 === errors;}else {var valid0 = true;}if(valid0){if(data.textStyle !== undefined){const _errs14 = errors;if(typeof data.textStyle !== "boolean"){validate21.errors = [{instancePath:instancePath+"/textStyle",schemaPath:"#/properties/textStyle/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid0 = _errs14 === errors;}else {var valid0 = true;}if(valid0){if(data.colors !== undefined){let data6 = data.colors;const _errs16 = errors;if(typeof data6 !== "string"){validate21.errors = [{instancePath:instancePath+"/colors",schemaPath:"#/properties/colors/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}if(!(data6 === "hex")){validate21.errors = [{instancePath:instancePath+"/colors",schemaPath:"#/properties/colors/enum",keyword:"enum",params:{allowedValues: schema32.properties.colors.enum},message:"must be equal to one of the allowed values"}];return false;}var valid0 = _errs16 === errors;}else {var valid0 = true;}}}}}}else {validate21.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate21.errors = vErrors;return errors === 0;}validate21.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if(((data.stylePresets === undefined) && (missing0 = "stylePresets")) || ((data.controls === undefined) && (missing0 = "controls"))){validate20.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {const _errs1 = errors;for(const key0 in data){if(!((key0 === "stylePresets") || (key0 === "controls"))){validate20.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.stylePresets !== undefined){let data0 = data.stylePresets;const _errs2 = errors;if(errors === _errs2){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if((data0.default === undefined) && (missing1 = "default")){validate20.errors = [{instancePath:instancePath+"/stylePresets",schemaPath:"#/properties/stylePresets/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {const _errs4 = errors;for(const key1 in data0){if(!((key1 === "default") || (pattern4.test(key1)))){validate20.errors = [{instancePath:instancePath+"/stylePresets",schemaPath:"#/properties/stylePresets/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"}];return false;break;}}if(_errs4 === errors){if(data0.default !== undefined){const _errs5 = errors;if(!(validate21(data0.default, {instancePath:instancePath+"/stylePresets/default",parentData:data0,parentDataProperty:"default",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}var valid1 = _errs5 === errors;}else {var valid1 = true;}if(valid1){var valid2 = true;for(const key2 in data0){if(pattern4.test(key2)){const _errs6 = errors;if(!(validate21(data0[key2], {instancePath:instancePath+"/stylePresets/" + key2.replace(/~/g, "~0").replace(/\//g, "~1"),parentData:data0,parentDataProperty:key2,rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}var valid2 = _errs6 === errors;if(!valid2){break;}}}}}}}else {validate20.errors = [{instancePath:instancePath+"/stylePresets",schemaPath:"#/properties/stylePresets/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.controls !== undefined){let data3 = data.controls;const _errs7 = errors;if(errors === _errs7){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){const _errs9 = errors;for(const key3 in data3){if(!(pattern6.test(key3))){validate20.errors = [{instancePath:instancePath+"/controls",schemaPath:"#/properties/controls/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"}];return false;break;}}if(_errs9 === errors){var valid3 = true;for(const key4 in data3){if(pattern6.test(key4)){let data4 = data3[key4];const _errs10 = errors;if(errors === _errs10){if(data4 && typeof data4 == "object" && !Array.isArray(data4)){let missing2;if(((data4.row === undefined) && (missing2 = "row")) || ((data4.column === undefined) && (missing2 = "column"))){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"}];return false;}else {const _errs12 = errors;for(const key5 in data4){if(!(((key5 === "row") || (key5 === "column")) || (key5 === "stylePreset"))){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"}];return false;break;}}if(_errs12 === errors){if(data4.row !== undefined){let data5 = data4.row;const _errs13 = errors;if(errors === _errs13){if((typeof data5 == "number") && (isFinite(data5))){if(data5 < 0 || isNaN(data5)){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/row",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}else {validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/row",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/row/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}var valid4 = _errs13 === errors;}else {var valid4 = true;}if(valid4){if(data4.column !== undefined){let data6 = data4.column;const _errs15 = errors;if(errors === _errs15){if((typeof data6 == "number") && (isFinite(data6))){if(data6 < 0 || isNaN(data6)){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/column",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/column/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"}];return false;}}else {validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/column",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/column/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}var valid4 = _errs15 === errors;}else {var valid4 = true;}if(valid4){if(data4.stylePreset !== undefined){let data7 = data4.stylePreset;const _errs17 = errors;if(errors === _errs17){if(typeof data7 === "string"){if(!pattern4.test(data7)){validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/stylePreset",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/stylePreset/pattern",keyword:"pattern",params:{pattern: "^.+$"},message:"must match pattern \""+"^.+$"+"\""}];return false;}}else {validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1")+"/stylePreset",schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/properties/stylePreset/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}var valid4 = _errs17 === errors;}else {var valid4 = true;}}}}}}else {validate20.errors = [{instancePath:instancePath+"/controls/" + key4.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/controls/patternProperties/%5E%5Ba-zA-Z0-9%5C-%5C~1%5D%2B%24/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid3 = _errs10 === errors;if(!valid3){break;}}}}}else {validate20.errors = [{instancePath:instancePath+"/controls",schemaPath:"#/properties/controls/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs7 === errors;}else {var valid0 = true;}}}}}else {validate20.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate20.errors = vErrors;return errors === 0;}validate20.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companion-surface/base",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/bitfocus/companion-surface-api",