Added minimal functionality for Robot teaching

- Added minimal HMI
- Added possibility to open and close all chamber doors
This commit is contained in:
2026-01-17 09:20:39 +01:00
parent 9f058db2a3
commit 2d11c43579
2274 changed files with 912690 additions and 162 deletions

View File

@@ -0,0 +1,49 @@
/**
* Checks if a right is allowed for the current user on this control or its parents
* Rules for granting access:
* - Designer Mode Master => true
* - Server Auth is not restricted (IsAuthRequired == false in Server) => TRUE
* - Server Auth is not known right now => null
* - Server Auth loading error => false
* - On this control: 1 Group has ALLOW => TRUE
* - On this control: 0 Groups have ALLOW, but 1 Group has DENY => FALSE
* - On this control: 0 Groups have ALLOW, 0 Groups have DENY => Ask Parent
* - use control default of the bottom most control with this right. TcHmi.Controls.System.TcHmiView has operate/observe set to TRUE
* - control has no parent (detached control) => null
* @param control Control to check
* @param requestedAccessright name of the access right
* @returns Returns true/false or null if the state is not known right now
* @preserve (Part of the public API)
*/
export declare function checkAccess(control: Readonly<TcHmi.Controls.System.baseTcHmiControl>, requestedAccessright: string): boolean | null;
/**
* Overrides a control access right to Deny state. Call with null to release the force again.
* @param control Control to check
* @param accessrightToOverride name of the access right
* @param forcedRight 'Deny' or null to release
*/
export declare function setControlRightOverride(control: Readonly<TcHmi.Controls.System.baseTcHmiControl>, accessrightToOverride: string, forcedRight: 'Deny' | null): boolean;
/**
* Returns a Set with a list of all overridden deny rights for a control.
* Gives an empty Set when no right is overridden.
* @param control Control to check
*/
export declare function getControlRightOverrides(control: Readonly<TcHmi.Controls.System.baseTcHmiControl>): Set<string>;
declare const _checkAccess: typeof checkAccess;
declare const _setControlRightOverride: typeof setControlRightOverride;
declare const _getControlRightOverrides: typeof getControlRightOverrides;
declare global {
namespace TcHmi {
/**
* Provides functions for checking rights.
* @preserve (Part of the public API)
*/
namespace Access {
const checkAccess: typeof _checkAccess;
const setControlRightOverride: typeof _setControlRightOverride;
const getControlRightOverrides: typeof _getControlRightOverrides;
}
}
}
export {};
//# sourceMappingURL=Access.d.ts.map

View File

@@ -0,0 +1,18 @@
import{accessManager}from"../System/AccessManager.js";import{isParameterTypeInvalid}from"../System/SystemFunctions.js";
/**
* Checks if a right is allowed for the current user on this control or its parents
* Rules for granting access:
* - Designer Mode Master => true
* - Server Auth is not restricted (IsAuthRequired == false in Server) => TRUE
* - Server Auth is not known right now => null
* - Server Auth loading error => false
* - On this control: 1 Group has ALLOW => TRUE
* - On this control: 0 Groups have ALLOW, but 1 Group has DENY => FALSE
* - On this control: 0 Groups have ALLOW, 0 Groups have DENY => Ask Parent
* - use control default of the bottom most control with this right. TcHmi.Controls.System.TcHmiView has operate/observe set to TRUE
* - control has no parent (detached control) => null
* @param control Control to check
* @param requestedAccessright name of the access right
* @returns Returns true/false or null if the state is not known right now
* @preserve (Part of the public API)
*/export function checkAccess(control,requestedAccessright){return control instanceof TcHmi.Controls.System.baseTcHmiControl&&(!isParameterTypeInvalid(requestedAccessright,"requestedAccessright",{type:"string",required:"valueNeeded",minStringLength:1})&&accessManager.checkAccess(control,requestedAccessright))}export function setControlRightOverride(control,accessrightToOverride,forcedRight){return control instanceof TcHmi.Controls.System.baseTcHmiControl&&(!isParameterTypeInvalid(accessrightToOverride,"accessrightToForce",{type:"string",required:"valueNeeded",minStringLength:1})&&(("Deny"===forcedRight||null===forcedRight)&&(accessManager.setControlRightOverride(control,accessrightToOverride,forcedRight),!0)))}export function getControlRightOverrides(control){return tchmi_clone_object(accessManager.getControlRightOverrides(control),{cloneSets:{deepCloneValues:!1}})}TcHmi.Access={checkAccess,setControlRightOverride,getControlRightOverrides};

View File

@@ -0,0 +1,291 @@
/**
* Deprecated. Please use new TcHmi.Animation()
* Creates a new animation
* @param controlName The name of the control for which the animation is intendend.
* @param selector A CSS selector to identify the element inside the control to animate.
* @preserve (Part of the public API)
* @deprecated Please use new TcHmi.Animation()
*/
declare function animProviderCreate(controlName: string, selector?: string): Animation;
declare global {
namespace TcHmi {
/**
* @deprecated
*/
namespace AnimationProvider {
/**
* @deprecated Please use new TcHmi.Animation()
*/
const create: typeof animProviderCreate;
}
}
}
export declare enum Status {
CONFIGURE = 0,
INITIALIZED = 1,
RUNNING = 2,
PAUSED = 3,
ENDED = 4
}
/**
* An animation class
*/
export declare class Animation {
/**
* Creates a new animation
* @param controlName The name of the control for which the animation is intendend.
* @param selector A CSS selector to identify the element inside the control to animate.
* @preserve (Part of the public API)
*/
constructor(controlName: string, selector?: string);
/**
* Returns the name of the control the animation is intended for.
* @returns The name of the control.
* @preserve (Part of the public API)
*/
controlName(): string;
/**
* Returns the selector of the element to animate.
* @returns The selector.
* @preserve (Part of the public API)
*/
selector(): string;
/**
* Returns the name of the animation.
* @returns The name of the animation.
* @preserve (Part of the public API)
*/
animationName(): string;
/**
* Returns the state of the animation.
* @returns The state.
* @preserve (Part of the public API)
*/
state(): Status;
/**
* Adds a keyframe.
* This function throws an exception if the progressPoint of the keyframe is not between 0 and 1 inclusive.
* @param keyframe The keyframe to add.
* @preserve (Part of the public API)
*/
addKeyframe(keyframe: Keyframe): this;
/**
* Adds a keyframe.
* This function throws an exception if the progressPoint is not between 0 and 1 inclusive.
* @param styles The styles for this keyframe.
* @param progressPoint A number between 0 and 1 inclusive to determine when this keyframe should be reached.
* @preserve (Part of the public API)
*/
addKeyframe(styles: TcHmi.Dictionary<string | string[]>, progressPoint: number): this;
/**
* Adds a keyframe.
* This function throws an exception if the progressPoint of the keyframe is not between 0 and 1 inclusive.
* @param property The CSS property for this keyframe.
* @param value The value for the CSS property at this keyframe.
* @param progressPoint A number between 0 and 1 inclusive to determine when this keyframe should be reached.
* @preserve (Part of the public API)
*/
addKeyframe(property: string, value: string, progressPoint: number): this;
/**
* Adds a keyframe.
* This function throws an exception if the progressPoint of the keyframe is not between 0 and 1 inclusive.
* @param property The CSS property for this keyframe.
* @param value An array of values for the CSS property at this keyframe. This is useful to pass vendor-prefixed CSS values to ensure compatibility.
* @param progressPoint A number between 0 and 1 inclusive to determine when this keyframe should be reached.
* @preserve (Part of the public API)
*/
addKeyframe(property: string, value: string[], progressPoint: number): this;
/**
* Removes all keyframes.
* @preserve (Part of the public API)
*/
clearKeyframes(): this;
/**
* Reverses the keyframes by subtracting the progressPoint from 1 and setting that as the new progressPoint.
* @preserve (Part of the public API)
*/
reverseKeyframes(): this;
/**
* Gets the keyframes of this animation.
* @returns The keyframes.
* @preserve (Part of the public API)
*/
keyframes(): Keyframe[];
/**
* Gets the configured duration for this animation. Default is 0.
* @returns The duration.
* @preserve (Part of the public API)
*/
duration(): number;
/**
* Sets the duration for this animation. Default is 0.
* @param valueNew The new duration.
* @preserve (Part of the public API)
*/
duration(valueNew: number | null): this;
/**
* Gets the delay before this animation starts. Default is 0.
* @returns The delay.
* @preserve (Part of the public API)
*/
delay(): number;
/**
* Sets the delay before this animation starts. Default is 0.
* @param valueNew {number} The new delay.
* @preserve (Part of the public API)
*/
delay(valueNew: number | null): this;
/**
* Gets the iteration count for this animation. Default is 1.
* @returns The iteration count.
* @preserve (Part of the public API)
*/
iterationCount(): number | 'infinite';
/**
* Sets the iteration count for this animation. Default is 1.
* @param valueNew The new iteration count.
* @preserve (Part of the public API)
*/
iterationCount(valueNew: number | 'infinite' | null): this;
/**
* Gets the order in which the keyframes are used. Default is 'normal'.
* @returns The direction.
* @preserve (Part of the public API)
*/
direction(): Direction;
/**
* Sets the order in which the keyframes are used. Default is 'normal'.
* @param valueNew The new direction.
* @preserve (Part of the public API)
*/
direction(valueNew: Direction | null): this;
/**
* Gets the timing function for this animation. Default is 'ease'.
* @returns The timing function.
* @preserve (Part of the public API)
*/
timingFunction(): string | ((t: number) => number);
/**
* Sets the timing function for this animation. Default is 'ease'.
* @param valueNew The new timing function. Possible values: "linear", "ease(-in/-out/-in-out)", "step-start/-end", "cubic-bezier(<number>, <number>, <number>, <number)", "steps(<number>, start/end)".
* @preserve (Part of the public API)
*/
timingFunction(valueNew: string | ((t: number) => number) | null): this;
/**
* Gets the fill mode. The fill mode determines whether the state of the first keyframe is applied to the element before the animation starts ('backwards'),
* the state of the last keyframe is applied to the element after the animation ends ('forwards'), both or none. Default is 'none'.
* @returns The fill mode.
* @preserve (Part of the public API)
*/
fillMode(): FillMode;
/**
* Sets the fill mode. The fill mode determines whether the state of the first keyframe is applied to the element before the animation starts ('backwards'),
* the state of the last keyframe is applied to the element after the animation ends ('forwards'), both or none. Default is 'none'.
* @param valueNew The new fill mode.
* @preserve (Part of the public API)
*/
fillMode(valueNew: FillMode | null): this;
/**
* Gets whether a cleanup is scheduled after the animation ends. Default is false.
* @returns The cleanup value.
* @preserve (Part of the public API)
*/
cleanup(): boolean;
/**
* Set whether to schedule a cleanup after the animation has finished. A cleanup removes all animation specific CSS and, depending on fillMode, persists the properties of the last keyframe to the element CSS. Default is false.
* @param valueNew {boolean} The cleanup value.
* @preserve (Part of the public API)
*/
cleanup(valueNew: boolean | null): this;
/**
* Gets whether the animation will be rendered via CSS or JavaScript. Will return false if the user has set useCss to false or configured features not supported by CSS. Default is true.
* @returns Whether CSS will be used.
* @preserve (Part of the public API)
*/
useCss(): boolean;
/**
* Sets whether to render the animation via CSS or JavaScript. JavaScript may offer better performance if the animation is often changed and restarted.
* If the animation has been configured with features unsupported by CSS, JavaScript will be used regardless of the value of useCss. Default is true.
* @param valueNew {boolean} Whether to use CSS, when available.
* @preserve (Part of the public API)
*/
useCss(valueNew: boolean | null): this;
/**
* Registers an event handler for one of the events animationstart, animationend or animationiteration.
* @param name The name of the event.
* @param callback The callback function.
* @preserve (Part of the public API)
*/
registerEventHandler(name: 'animationstart' | 'animationend' | 'animationiteration', callback: (event: AnimationEvent) => void): this;
/**
* Unregisters a previously registered event handler.
* @param name The name of the event.
* @param callback The callback function to unregister.
* @preserve (Part of the public API)
*/
unregisterEventHandler(name: 'animationstart' | 'animationend' | 'animationiteration', callback?: (event: AnimationEvent) => void): this;
/**
* Gets all event handlers
* @returns The event handlers.
* @preserve (Part of the public API)
*/
eventHandlers(): {
name: 'animationstart' | 'animationend' | 'animationiteration';
callback: (event: AnimationEvent) => void;
}[];
/**
* Run the animation.
* @preserve (Part of the public API)
*/
run(): this;
/**
* Pause the animation.
* @preserve (Part of the public API)
*/
pause(): this;
/**
* Cancels the animation and writes the last keyframe styles into the element CSS.
* @preserve (Part of the public API)
*/
skip(): this;
/**
* Resets the animation. This is an asynchronous operation.
* @param callback The function to call when the animation has been reset.
* @preserve (Part of the public API)
*/
reset(callback?: () => void): this;
static Status: typeof Status;
}
export interface Keyframe {
styles: TcHmi.Dictionary<string[]>;
progressPoint: number;
}
export interface AnimationEvent extends TcHmi.IResultObject {
animationName: string;
elapsedTime: number;
JQueryEvent?: JQuery.TriggeredEvent;
}
export type Direction = 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
export type FillMode = 'none' | 'forwards' | 'backwards' | 'both';
declare const _Animation: typeof Animation;
type tAnimation = Animation;
type tKeyframe = Keyframe;
type tAnimationEvent = AnimationEvent;
type tStatus = Status;
type tDirection = Direction;
type tFillMode = FillMode;
declare global {
namespace TcHmi {
let Animation: typeof _Animation;
type Animation = tAnimation;
namespace Animation {
type Keyframe = tKeyframe;
type AnimationEvent = tAnimationEvent;
type Status = tStatus;
type Direction = tDirection;
type FillMode = tFillMode;
}
}
}
export {};
//# sourceMappingURL=Animation.d.ts.map

View File

@@ -0,0 +1,131 @@
import{animationProvider}from"../System/AnimationProvider.js";
/**
* Deprecated. Please use new TcHmi.Animation()
* Creates a new animation
* @param controlName The name of the control for which the animation is intendend.
* @param selector A CSS selector to identify the element inside the control to animate.
* @preserve (Part of the public API)
* @deprecated Please use new TcHmi.Animation()
*/TcHmi.AnimationProvider={create:function(controlName,selector=""){return new Animation(controlName,selector)}};export var Status;!function(Status){Status[Status.CONFIGURE=0]="CONFIGURE",Status[Status.INITIALIZED=1]="INITIALIZED",Status[Status.RUNNING=2]="RUNNING",Status[Status.PAUSED=3]="PAUSED",Status[Status.ENDED=4]="ENDED"}(Status||(Status={}));let Animation=(()=>{var _a;let ___updateState_decorators,_instanceExtraInitializers=[];return class{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;___updateState_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],__esDecorate(this,null,___updateState_decorators,{kind:"method",name:"__updateState",static:!1,private:!1,access:{has:obj=>"__updateState"in obj,get:obj=>obj.__updateState},metadata:_metadata},null,_instanceExtraInitializers),_metadata&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}
/**
* Creates a new animation
* @param controlName The name of the control for which the animation is intendend.
* @param selector A CSS selector to identify the element inside the control to animate.
* @preserve (Part of the public API)
*/constructor(controlName,selector=""){this.__controlName=controlName,this.__selector=selector,this.__animationName=`anim-${tchmi_create_guid()}`}__controlName=__runInitializers(this,_instanceExtraInitializers);__selector;__animationName;__keyframes=[];__duration=0;__delay=0;__iterationCount=1;__direction="normal";__timingFunction="ease";__fillMode="none";__cleanup=!1;__useCss=!0;__eventHandlers=[];__state=Status.CONFIGURE;__updateState(status){this.__state=status}__animationController=null;
/**
* Returns the name of the control the animation is intended for.
* @returns The name of the control.
* @preserve (Part of the public API)
*/
controlName(){return this.__controlName}
/**
* Returns the selector of the element to animate.
* @returns The selector.
* @preserve (Part of the public API)
*/selector(){return this.__selector}
/**
* Returns the name of the animation.
* @returns The name of the animation.
* @preserve (Part of the public API)
*/animationName(){return this.__animationName}
/**
* Returns the state of the animation.
* @returns The state.
* @preserve (Part of the public API)
*/state(){return this.__state}
/**
* Adds a keyframe.
* This function throws an exception if the progressPoint of the keyframe is not between 0 and 1 inclusive.
* @preserve (Part of the public API)
*/
addKeyframe(keyframeOrStylesOrProperty,valueOrProgressPoint,progressPoint){if(!this.__configAllowed())return this;if(1===arguments.length){if(keyframeOrStylesOrProperty.progressPoint<0||keyframeOrStylesOrProperty.progressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");this.__keyframes.push(keyframeOrStylesOrProperty)}else if(2===arguments.length&&"number"==typeof valueOrProgressPoint){if(valueOrProgressPoint<0||valueOrProgressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");let keyframe={styles:{},progressPoint:valueOrProgressPoint};for(const[key,value]of Object.entries(keyframeOrStylesOrProperty))keyframe.styles[key]="string"==typeof value?[value]:value;this.__keyframes.push(keyframe)}else if("string"==typeof keyframeOrStylesOrProperty&&("string"==typeof valueOrProgressPoint||Array.isArray(valueOrProgressPoint))){if(void 0===progressPoint||progressPoint<0||progressPoint>1)throw new Error("Argument out of range: progressPoint must be between 0 and 1 inclusive.");let keyframe={styles:{},progressPoint};keyframe.styles[keyframeOrStylesOrProperty]="string"==typeof valueOrProgressPoint?[valueOrProgressPoint]:valueOrProgressPoint,this.__keyframes.push(keyframe)}return this}
/**
* Removes all keyframes.
* @preserve (Part of the public API)
*/clearKeyframes(){return this.__configAllowed()?(this.__keyframes=[],this):this}
/**
* Reverses the keyframes by subtracting the progressPoint from 1 and setting that as the new progressPoint.
* @preserve (Part of the public API)
*/reverseKeyframes(){return this.__keyframes.forEach(keyframe=>{keyframe.progressPoint=1-keyframe.progressPoint}),this}
/**
* Gets the keyframes of this animation.
* @returns The keyframes.
* @preserve (Part of the public API)
*/keyframes(){return this.__keyframes}
/**
* Sets the duration for this animation. Default is 0.
* @param valueNew The new duration.
* @preserve (Part of the public API)
*/duration(valueNew){return void 0===valueNew?this.__duration:this.__configAllowed()?(this.__duration=null===valueNew?0:valueNew,this):this}
/**
* Sets the delay before this animation starts. Default is 0.
* @param valueNew {number} The new delay.
* @preserve (Part of the public API)
*/delay(valueNew){return void 0===valueNew?this.__delay:this.__configAllowed()?(this.__delay=null===valueNew?0:valueNew,this):this}
/**
* Sets the iteration count for this animation. Default is 1.
* @param valueNew The new iteration count.
* @preserve (Part of the public API)
*/iterationCount(valueNew){return void 0===valueNew?this.__iterationCount:this.__configAllowed()?(this.__iterationCount=null===valueNew?1:valueNew,this):this}
/**
* Sets the order in which the keyframes are used. Default is 'normal'.
* @param valueNew The new direction.
* @preserve (Part of the public API)
*/direction(valueNew){return void 0===valueNew?this.__direction:this.__configAllowed()?(this.__direction=null===valueNew?"normal":valueNew,this):this}
/**
* Sets the timing function for this animation. Default is 'ease'.
* @param valueNew The new timing function. Possible values: "linear", "ease(-in/-out/-in-out)", "step-start/-end", "cubic-bezier(<number>, <number>, <number>, <number)", "steps(<number>, start/end)".
* @preserve (Part of the public API)
*/timingFunction(valueNew){return void 0===valueNew?this.__timingFunction:this.__configAllowed()?(this.__timingFunction=null===valueNew?"ease":valueNew,this):this}
/**
* Sets the fill mode. The fill mode determines whether the state of the first keyframe is applied to the element before the animation starts ('backwards'),
* the state of the last keyframe is applied to the element after the animation ends ('forwards'), both or none. Default is 'none'.
* @param valueNew The new fill mode.
* @preserve (Part of the public API)
*/fillMode(valueNew){return void 0===valueNew?this.__fillMode:this.__configAllowed()?(this.__fillMode=null===valueNew?"none":valueNew,this):this}
/**
* Set whether to schedule a cleanup after the animation has finished. A cleanup removes all animation specific CSS and, depending on fillMode, persists the properties of the last keyframe to the element CSS. Default is false.
* @param valueNew {boolean} The cleanup value.
* @preserve (Part of the public API)
*/cleanup(valueNew){return void 0===valueNew?this.__cleanup:(this.__cleanup=null!==valueNew&&valueNew,this.__state===Status.ENDED&&null!==this.__animationController&&this.__animationController.cleanup(),this)}
/**
* Sets whether to render the animation via CSS or JavaScript. JavaScript may offer better performance if the animation is often changed and restarted.
* If the animation has been configured with features unsupported by CSS, JavaScript will be used regardless of the value of useCss. Default is true.
* @param valueNew {boolean} Whether to use CSS, when available.
* @preserve (Part of the public API)
*/useCss(valueNew){return void 0===valueNew?this.__canUseCss()&&this.__useCss:this.__configAllowed()?(this.__useCss=null===valueNew||valueNew,this):this}
/**
* Registers an event handler for one of the events animationstart, animationend or animationiteration.
* @param name The name of the event.
* @param callback The callback function.
* @preserve (Part of the public API)
*/registerEventHandler(name,callback){return this.__eventHandlers.push({name,callback}),this}
/**
* Unregisters a previously registered event handler.
* @param name The name of the event.
* @param callback The callback function to unregister.
* @preserve (Part of the public API)
*/unregisterEventHandler(name,callback){return this.__eventHandlers=this.__eventHandlers.filter(handler=>!(handler.name===name&&(void 0===callback||handler.callback===callback))),this}
/**
* Gets all event handlers
* @returns The event handlers.
* @preserve (Part of the public API)
*/eventHandlers(){return this.__eventHandlers}
/**
* Run the animation.
* @preserve (Part of the public API)
*/run(){return 0===this.__keyframes.length?(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no keyframes defined."),this):0===this.__keyframes.filter(keyframe=>0===keyframe.progressPoint).length?(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no start keyframe with progressPoint 0 defined."),this):0===this.__keyframes.filter(keyframe=>1===keyframe.progressPoint).length?(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Animation] This animation has no end keyframe with progressPoint 1 defined."),this):(null!==this.__animationController&&this.__animationController.isValid()||(this.__animationController=animationProvider.createAnimationController(this,this.__updateState)),this.__animationController.run(),this)}
/**
* Pause the animation.
* @preserve (Part of the public API)
*/pause(){return null!==this.__animationController&&this.__animationController.pause(),this}
/**
* Cancels the animation and writes the last keyframe styles into the element CSS.
* @preserve (Part of the public API)
*/skip(){return null!==this.__animationController&&this.__animationController.skip(),this}
/**
* Resets the animation. This is an asynchronous operation.
* @param callback The function to call when the animation has been reset.
* @preserve (Part of the public API)
*/reset(callback){return null!==this.__animationController&&this.__animationController.reset(callback),this}__canUseCss(){return"string"==typeof this.__timingFunction}__configAllowed(){return this.__state===Status.CONFIGURE||this.__state===Status.ENDED||(TcHmi.Log.warn("[Source=Framework, Module=TcHmi.Animation] Configuring an animation is only allowed when it has the state CONFIGURE or ENDED."),!1)}static Status=Status}})();export{Animation};TcHmi.Animation=Animation;

View File

@@ -0,0 +1,130 @@
/**
* Provides methods to read base64 encoded data.
* @preserve (Part of the public API)
*/
export declare class Base64BinaryReader {
/**
* Creates a new Base64BinaryReader.
* This constructor throws an exception if the data is not valid base64.
* @param data The base64 encoded string to read from.
* @param endianness Whether the encoded data uses little endian (default) or big endian to store numbers.
* @preserve (Part of the public API)
*/
constructor(data: string, endianness?: TcHmi.Endianness);
/**
* Reads a boolean value.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readBoolean(): boolean;
/**
* Reads a single byte of data.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readByte(): number;
/**
* Reads a signed byte.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readSByte(): number;
/**
* Reads a signed 16-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readInt16(): number;
/**
* Reads an unsigned 16-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readUInt16(): number;
/**
* Reads a signed 32-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readInt32(): number;
/**
* Reads an unsigned 32-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readUInt32(): number;
/**
* Reads a signed 64-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readInt64(): bigint;
/**
* Reads an unsigned 64-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readUInt64(): bigint;
/**
* Reads a single precision floating point number.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readFloat(): number;
/**
* Reads a double precision floating point number.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/
readDouble(): number;
/**
* Reads a string. Will read until a zero byte is encountered, or until the specified length has been reached, or, if no length has been specified, until the end of the data.
* This function throws an exception if length is negative or reading the number of bytes specified by length from the current offset position would exceed the length of the available data.
* @param options (Optional) Options for the write.
* @param options.encoding (Optional) The encoding to use. Defaults to UTF-8.
* @param options.length (Optional) The length of the string to read in bytes.
* @preserve (Part of the public API)
*/
readString(options?: StringOptions): string;
/**
* Reads a string. Will read until a zero byte is encountered, or until the specified length has been reached, or, if no length has been specified, until the end of the data.
* This function throws an exception if length is negative or reading the number of bytes specified by length from the current offset position would exceed the length of the available data.
* @param length The length of the string to read in bytes.
* @preserve (Part of the public API)
*/
readString(length: number): string;
/**
* Returns the length of the data in bytes.
* @preserve (Part of the public API)
*/
getLength(): number;
/**
* Returns the current position of the read pointer.
* @preserve (Part of the public API)
*/
getOffset(): number;
/**
* Sets the position of the read pointer.
* @param offset The new position of the read pointer.
* @preserve (Part of the public API)
*/
setOffset(offset: number): void;
}
export interface StringOptions {
encoding?: 'UTF-8' | 'Latin-1' | 'Windows-1252';
length?: number;
}
declare const _Base64BinaryReader: typeof Base64BinaryReader;
type tBase64BinaryReader = Base64BinaryReader;
type tStringOptions = StringOptions;
declare global {
namespace TcHmi {
let Base64BinaryReader: typeof _Base64BinaryReader;
type Base64BinaryReader = tBase64BinaryReader;
namespace Base64BinaryReader {
type StringOptions = tStringOptions;
}
}
}
export {};
//# sourceMappingURL=Base64BinaryReader.d.ts.map

View File

@@ -0,0 +1,87 @@
/**
* Provides methods to read base64 encoded data.
* @preserve (Part of the public API)
*/
export class Base64BinaryReader{
/**
* Creates a new Base64BinaryReader.
* This constructor throws an exception if the data is not valid base64.
* @param data The base64 encoded string to read from.
* @param endianness Whether the encoded data uses little endian (default) or big endian to store numbers.
* @preserve (Part of the public API)
*/
constructor(data,endianness=TcHmi.Endianness.LittleEndian){let decoded=tchmi_base64decode(data);if(null===decoded)throw new Error(`Could not decode string "${data}" as base64.`);this.__data=[];for(let i=0,ii=decoded.length;i<ii;i++)this.__data.push(decoded.charCodeAt(i));this.__endianness=endianness}__data;__endianness;__offset=0;__stringEncodings={"UTF-8":{decode:(bytes,_endianness)=>{let codePoints=[];for(let i=0,byteLength=bytes.length;i<byteLength;i++){let byte=bytes[i];if(0===byte)return{codePoints,byteCount:i+1};if(byte<=127)codePoints.push(byte);else if(byte>=194&&byte<=244){let followBytes=1,firstByteMask=31,mask=32;for(;mask>0;)(byte&mask)>0?(followBytes++,firstByteMask>>>=1,mask>>>=1):mask=0;let codePoint=byte&firstByteMask,lastByteIndex=i+followBytes;if(lastByteIndex>=byteLength)codePoint=65533;else for(;i<lastByteIndex;){i++;let byte=bytes[i];if(byte<128||byte>191){codePoint=65533,i--;break}codePoint=codePoint<=67108863?(codePoint<<6|63&byte)>>>0:codePoint*Math.pow(2,6)+(63&byte)}codePoints.push(codePoint)}else codePoints.push(65533)}return{codePoints,byteCount:bytes.length}}},"Latin-1":{decode:(bytes,_endianness)=>{const terminatorIndex=bytes.indexOf(0);return-1!==terminatorIndex?{codePoints:bytes.slice(0,terminatorIndex),byteCount:terminatorIndex+1}:{codePoints:bytes,byteCount:bytes.length}}},"Windows-1252":{decode:(bytes,_endianness)=>{const differencesToLatin1={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},terminatorIndex=bytes.indexOf(0);return-1!==terminatorIndex?{codePoints:bytes.slice(0,terminatorIndex).map(byte=>byte in differencesToLatin1?differencesToLatin1[byte]:byte),byteCount:terminatorIndex+1}:{codePoints:bytes.map(byte=>byte in differencesToLatin1?differencesToLatin1[byte]:byte),byteCount:bytes.length}}}};__getChunk(length){if(this.__offset+length>this.__data.length)throw new RangeError(`Trying to read ${length} bytes from offset ${this.__offset} exceeds the length of the data.`);let chunk=this.__data.slice(this.__offset,this.__offset+length);return this.__offset+=length,this.__endianness===TcHmi.Endianness.BigEndian&&(chunk=chunk.reverse()),chunk}__readInteger(lengthInBytes,signed){let chunk=this.__getChunk(lengthInBytes),result=0;for(let i=0,ii=chunk.length;i<ii;i++){let byte=255&chunk[i];i<4?result=(result|byte<<8*i)>>>0:result+=byte*Math.pow(256,i)}if(signed){let mask=Math.pow(2,8*lengthInBytes-1);lengthInBytes<=4?result=(result&~mask)-((result&mask)>>>0):128&~chunk[chunk.length-1]||(result-=2*mask)}return result}__readBigInteger(lengthInBytes,signed){let chunk=this.__getChunk(lengthInBytes),result=0n;for(let i=0,ii=chunk.length;i<ii;i++){let byte=0xffn&BigInt(chunk[i]);result=BigInt.asUintN(8*lengthInBytes,result|byte<<8n*BigInt(i))}if(signed){const mask=2n**(8n*BigInt(lengthInBytes)-1n);lengthInBytes<=4?result=-BigInt.asUintN(8,result&mask)+(result&~mask):128&~chunk[chunk.length-1]||(result-=2n*mask),result=BigInt.asIntN(8*lengthInBytes,result)}else result=BigInt.asUintN(8*lengthInBytes,result);return result}__readFloatingPointNumber(lengthInBytes){let chunk=this.__getChunk(lengthInBytes),exponentBits=8,significandBits=23;switch(lengthInBytes){case 4:exponentBits=8,significandBits=23;break;case 8:exponentBits=11,significandBits=52}let bias=Math.pow(2,exponentBits-1)-1,parts=[{value:0,bitsToRead:significandBits},{value:0,bitsToRead:exponentBits},{value:0,bitsToRead:1}],partIndex=0,shift=0;for(let i=0;i<lengthInBytes||parts[partIndex].bitsToRead<0;i++){let carryOver=0;parts[partIndex].bitsToRead<0?(carryOver=8+parts[partIndex].bitsToRead,i--,partIndex++,shift=0):0===parts[partIndex].bitsToRead&&(partIndex++,shift=0);let byte=(255&chunk[i])>>>carryOver;parts[partIndex].bitsToRead<8&&(byte&=Math.pow(2,parts[partIndex].bitsToRead)-1),shift<=24?parts[partIndex].value=(parts[partIndex].value|byte<<shift)>>>0:parts[partIndex].value+=byte*Math.pow(2,shift),shift+=8-carryOver,parts[partIndex].bitsToRead-=8-carryOver}let significand=parts[0].value,exponent=parts[1].value,sign=parts[2].value;return exponent===Math.pow(2,exponentBits)-1?significand>0?NaN:1/0*(1===sign?-1:1):0===exponent&&0===significand?0*(1===sign?-1:1):0===exponent?(1===sign?-1:1)*significand*Math.pow(2,1-bias-significandBits):(1===sign?-1:1)*(1+significand/Math.pow(2,significandBits))*Math.pow(2,exponent-bias)}
/**
* Reads a boolean value.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readBoolean(){return 0!==this.__readInteger(1,!1)}
/**
* Reads a single byte of data.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readByte(){return this.__readInteger(1,!1)}
/**
* Reads a signed byte.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readSByte(){return this.__readInteger(1,!0)}
/**
* Reads a signed 16-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readInt16(){return this.__readInteger(2,!0)}
/**
* Reads an unsigned 16-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readUInt16(){return this.__readInteger(2,!1)}
/**
* Reads a signed 32-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readInt32(){return this.__readInteger(4,!0)}
/**
* Reads an unsigned 32-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readUInt32(){return this.__readInteger(4,!1)}
/**
* Reads a signed 64-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readInt64(){return this.__readBigInteger(8,!0)}
/**
* Reads an unsigned 64-bit integer.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readUInt64(){return this.__readBigInteger(8,!1)}
/**
* Reads a single precision floating point number.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readFloat(){return this.__readFloatingPointNumber(4)}
/**
* Reads a double precision floating point number.
* This function throws an exception if reading from the current offset position would exceed the length of the available data.
* @preserve (Part of the public API)
*/readDouble(){return this.__readFloatingPointNumber(8)}
/**
* Reads a string. Will read until a zero byte is encountered, or until the specified length has been reached, or, if no length has been specified, until the end of the data.
* This function throws an exception if length is negative or reading the number of bytes specified by length from the current offset position would exceed the length of the available data.
* @param optionsOrLength The options to use or the length of the string to read in bytes.
* @preserve (Part of the public API)
*/readString(optionsOrLength){let stringBytes,options={encoding:"UTF-8"};if("number"==typeof optionsOrLength?options.length=optionsOrLength:optionsOrLength&&(optionsOrLength.encoding&&optionsOrLength.encoding in this.__stringEncodings&&(options.encoding=optionsOrLength.encoding),void 0!==optionsOrLength.length&&(options.length=optionsOrLength.length)),void 0!==options.length){if(options.length<0)throw new RangeError("Length of the string to read must be positive.");if(this.__offset+options.length>this.__data.length)throw new RangeError(`Trying to read ${options.length} bytes from offset ${this.__offset} exceeds the length of the data.`);stringBytes=this.__data.slice(this.__offset,this.__offset+options.length)}else stringBytes=this.__data.slice(this.__offset);let result=this.__stringEncodings[options.encoding].decode(stringBytes,this.__endianness);return this.__offset+=options.length??result.byteCount,this.__getStringFromCodePoints(result.codePoints)}__getStringFromCodePoints(codePoints){let codeUnits=[];for(let i=0,ii=codePoints.length;i<ii;i++){let codePoint=codePoints[i];if(codePoint<=65535)codeUnits.push(codePoint);else{codePoint-=65536;let highSurrogate=55296+(codePoint>>10),lowSurrogate=codePoint%1024+56320;codeUnits.push(highSurrogate,lowSurrogate)}}return String.fromCharCode(...codeUnits)}
/**
* Returns the length of the data in bytes.
* @preserve (Part of the public API)
*/getLength(){return this.__data.length}
/**
* Returns the current position of the read pointer.
* @preserve (Part of the public API)
*/getOffset(){return this.__offset}
/**
* Sets the position of the read pointer.
* @param offset The new position of the read pointer.
* @preserve (Part of the public API)
*/setOffset(offset){this.__offset=Math.floor(offset)}}TcHmi.Base64BinaryReader=Base64BinaryReader;

View File

@@ -0,0 +1,138 @@
/**
* Provides methods to write base64 encoded data.
* @preserve (Part of the public API)
*/
export declare class Base64BinaryWriter {
/**
* Creates a new Base64BinaryWriter.
* @param endianness Whether to use little endian (default) or big endian when encoding numbers.
* @param length The desired length of the data. If this parameter is omitted the data will be expanded dynamically.
* @preserve (Part of the public API)
*/
constructor(endianness?: TcHmi.Endianness, length?: number);
/**
* Writes a boolean value.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The boolean value to write.
* @preserve (Part of the public API)
*/
writeBoolean(value: boolean): this;
/**
* Writes a single byte of data.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The byte to write.
* @preserve (Part of the public API)
*/
writeByte(value: number): this;
/**
* Writes a signed byte.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The byte to write.
* @preserve (Part of the public API)
*/
writeSByte(value: number): this;
/**
* Writes a signed 16-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/
writeInt16(value: number): this;
/**
* Writes an unsigned 16-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/
writeUInt16(value: number): this;
/**
* Writes a signed 32-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/
writeInt32(value: number): this;
/**
* Writes an unsigned 32-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/
writeUInt32(value: number): this;
/**
* Writes a signed 64-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/
writeInt64(value: bigint): this;
/**
* Writes an unsigned 64-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/
writeUInt64(value: bigint): this;
/**
* Writes a single precision floating point number.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/
writeFloat(value: number): this;
/**
* Writes a double precision floating point number.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/
writeDouble(value: number): this;
/**
* Writes a string.
* This function throws an exception if the provided value does not fit into the given length or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The string to write.
* @param options (Optional) Options for the write.
* @param options.encoding (Optional) The encoding to use. Defaults to UTF-8.
* @param options.length (Optional) The length of the string to write. If the string is shorter, the remaining space is filled with 0.
* @param options.addNullTerminator (Optional) Whether to add a terminating 0 at the end of the string, if it isn't already terminated.
* @preserve (Part of the public API)
*/
writeString(value: string, options?: StringOptions): this;
/**
* Writes a string.
* This function throws an exception if the provided value does not fit into the given length or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The string to write.
* @param length The length of the string to write. If the string is shorter, the remaining space is filled with 0.
* @preserve (Part of the public API)
*/
writeString(value: string, length: number): this;
/**
* Returns the base64 encoded string. If not enough data was written to fill the length the data should have, the rest is filled up with zeros.
* @preserve (Part of the public API)
*/
getEncodedString(): string;
/**
* Returns the length of the data that has been written.
* @preserve (Part of the public API)
*/
getLength(): number;
}
export interface StringOptions {
encoding?: 'UTF-8' | 'Latin-1' | 'Windows-1252';
length?: number;
addNullTerminator?: boolean;
}
declare const _Base64BinaryWriter: typeof Base64BinaryWriter;
type tBase64BinaryWriter = Base64BinaryWriter;
type tStringOptions = StringOptions;
declare global {
namespace TcHmi {
let Base64BinaryWriter: typeof _Base64BinaryWriter;
type Base64BinaryWriter = tBase64BinaryWriter;
namespace Base64BinaryWriter {
type StringOptions = tStringOptions;
}
}
}
export {};
//# sourceMappingURL=Base64BinaryWriter.d.ts.map

View File

@@ -0,0 +1,93 @@
/**
* Provides methods to write base64 encoded data.
* @preserve (Part of the public API)
*/
export class Base64BinaryWriter{
/**
* Creates a new Base64BinaryWriter.
* @param endianness Whether to use little endian (default) or big endian when encoding numbers.
* @param length The desired length of the data. If this parameter is omitted the data will be expanded dynamically.
* @preserve (Part of the public API)
*/
constructor(endianness=TcHmi.Endianness.LittleEndian,length){this.__endianness=endianness,this.__length=void 0!==length?length:1/0}__data=[];__endianness;__length;__stringEncodings={"UTF-8":{encode:(codePoints,_endianness)=>{let bytes=[];for(let i=0,ii=codePoints.length;i<ii;i++){let codePoint=codePoints[i];if(codePoint<=127)bytes.push(codePoint);else{let cpBytes=[],firstByteTemplate=192,firstByteMask=31,followByteTemplate=128,followByteMask=63;for(;codePoint>0&&cpBytes.length<=6;)cpBytes.push(followByteTemplate|codePoint&followByteMask),codePoint<=4294967295?codePoint>>>=6:codePoint=Math.floor(codePoint/Math.pow(2,6)),codePoint<=firstByteMask?(cpBytes.push(firstByteTemplate|codePoint&firstByteMask),codePoint=0):(firstByteTemplate=followByteTemplate|firstByteTemplate>>>1,firstByteMask>>>=1);bytes=bytes.concat(cpBytes.reverse())}}return bytes}},"Latin-1":{encode:(codePoints,_endianness)=>{if(codePoints.some(codePoint=>codePoint>255))throw new RangeError("The string to be encoded contains characters outside of the Latin1 range.");return codePoints}},"Windows-1252":{encode:(codePoints,_endianness)=>{const differencesToLatin1={8364:128,8218:130,402:131,8222:132,8230:133,8224:134,8225:135,710:136,8240:137,352:138,8249:139,338:140,381:142,8216:145,8217:146,8220:147,8221:148,8226:149,8211:150,8212:151,732:152,8482:153,353:154,8250:155,339:156,382:158,376:159};if((codePoints=codePoints.map(codePoint=>codePoint in differencesToLatin1?differencesToLatin1[codePoint]:codePoint)).some(codePoint=>codePoint>255))throw new RangeError("The string to be encoded contains characters outside of the Windows-1252 range.");return codePoints}}};__addChunk(chunk){if(this.__data.length+chunk.length>this.__length)throw new RangeError(`Trying to write ${chunk.length} bytes exceeds the length of the data.`);this.__endianness===TcHmi.Endianness.BigEndian&&(chunk=chunk.reverse()),this.__data=this.__data.concat(chunk)}__checkIntegerBounds(value,lengthInBytes,signed){if(value%1!=0)return!1;let range=Math.pow(2,8*lengthInBytes)-1,lowerBound=signed?-Math.ceil(range/2):0;return value>=lowerBound&&value<=range+lowerBound}__checkBigIntegerBounds(value,lengthInBytes,signed){if(signed){if(BigInt.asIntN(8*lengthInBytes,value)===value)return!0}else{if(BigInt.asUintN(8*lengthInBytes,value)===value)return!0}return!1}__writeInteger(value,lengthInBytes){let chunk=[];for(let i=0;i<lengthInBytes;i++)chunk.push(255&value),lengthInBytes-i<=4?value>>>=8:value=Math.floor(value/256);this.__addChunk(chunk)}__writeBigInteger(value,lengthInBytes){let chunk=[];for(let i=0;i<lengthInBytes;i++)chunk.push(Number(0xffn&value)),value=BigInt.asUintN(8*lengthInBytes,value)>>8n;this.__addChunk(chunk)}__writeFloatingPointNumber(value,lengthInBytes){let exponentBits,significandBits;switch(lengthInBytes){case 4:exponentBits=8,significandBits=23;break;case 8:exponentBits=11,significandBits=52}let exponent,significand,bias=Math.pow(2,exponentBits-1)-1,sign=value<0?1:0;if(isFinite(value))if(0===value)sign=1/value==-1/0?1:0,exponent=0,significand=0;else{value=Math.abs(value);let preComma=Math.floor(value),postComma=value-preComma,preCommaLength=0,num=preComma;for(;num>0;)preCommaLength++,num<=4294967295?num>>>=1:num=Math.floor(num/2);significand=preComma>0?preComma-Math.pow(2,preCommaLength-1):0;let significandLength=preCommaLength>0?preCommaLength-1:0;significandLength>significandBits&&(significand<=4294967295?significand>>>=significandLength-significandBits:significand=Math.floor(significand/Math.pow(2,significandLength-significandBits)),significandLength=significandBits);let postCommaIndexOfOne=-1;num=postComma;let i=0;for(;significandLength<significandBits;){num*=2;let bit=num>=1?1:0;i>=bias-1&&-1===postCommaIndexOfOne&&(postCommaIndexOfOne=i),bit&&(num--,-1===postCommaIndexOfOne&&(postCommaIndexOfOne=i,0===preCommaLength))?i++:(significand=significandLength<32?(significand<<1|bit)>>>0:2*significand+bit,(preCommaLength>0||postCommaIndexOfOne>-1||0===postComma)&&significandLength++,i++)}exponent=preCommaLength>0?preCommaLength-1:-postCommaIndexOfOne-1,exponent+=bias;let maxExponentValue=Math.pow(2,exponentBits)-1;exponent<1?exponent=0:exponent>maxExponentValue-1&&(exponent=maxExponentValue,significand=0)}else{exponent=0;for(let i=0;i<exponentBits;i++)exponent=exponent<<1|1;significand=isNaN(value)?1:0}let parts=[{value:significand,length:significandBits},{value:exponent,length:exponentBits},{value:sign,length:1}],chunk=[],partIndex=0;for(let i=0;i<lengthInBytes||parts[partIndex].length<0;i++){let carryBack=0;parts[partIndex].length<0?(carryBack=8+parts[partIndex].length,i--,partIndex++):0===parts[partIndex].length&&partIndex++,void 0===chunk[i]&&(chunk[i]=0),chunk[i]|=parts[partIndex].value<<carryBack&255,parts[partIndex].length<=32?parts[partIndex].value=parts[partIndex].value>>>8-carryBack:parts[partIndex].value=Math.floor(parts[partIndex].value/Math.pow(2,8-carryBack)),parts[partIndex].length-=8-carryBack}this.__addChunk(chunk)}
/**
* Writes a boolean value.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The boolean value to write.
* @preserve (Part of the public API)
*/writeBoolean(value){return this.writeByte(value?1:0),this}
/**
* Writes a single byte of data.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The byte to write.
* @preserve (Part of the public API)
*/writeByte(value){if(!this.__checkIntegerBounds(value,1,!1))throw new RangeError(`The value ${value} does not fit into a byte.`);return this.__writeInteger(value,1),this}
/**
* Writes a signed byte.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The byte to write.
* @preserve (Part of the public API)
*/writeSByte(value){if(!this.__checkIntegerBounds(value,1,!0))throw new RangeError(`The value ${value} does not fit into a signed byte.`);return this.__writeInteger(value,1),this}
/**
* Writes a signed 16-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/writeInt16(value){if(!this.__checkIntegerBounds(value,2,!0))throw new RangeError(`The value ${value} does not fit into an int16.`);return this.__writeInteger(value,2),this}
/**
* Writes an unsigned 16-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/writeUInt16(value){if(!this.__checkIntegerBounds(value,2,!1))throw new RangeError(`The value ${value} does not fit into an uint16.`);return this.__writeInteger(value,2),this}
/**
* Writes a signed 32-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/writeInt32(value){if(!this.__checkIntegerBounds(value,4,!0))throw new RangeError(`The value ${value} does not fit into a int32.`);return this.__writeInteger(value,4),this}
/**
* Writes an unsigned 32-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/writeUInt32(value){if(!this.__checkIntegerBounds(value,4,!1))throw new RangeError(`The value ${value} does not fit into an uint32.`);return this.__writeInteger(value,4),this}
/**
* Writes a signed 64-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/writeInt64(value){if(!this.__checkBigIntegerBounds(value,8,!0))throw new RangeError(`The value ${value} does not fit into a int64.`);return this.__writeBigInteger(value,8),this}
/**
* Writes an unsigned 64-bit integer.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/writeUInt64(value){if(!this.__checkBigIntegerBounds(value,8,!1))throw new RangeError(`The value ${value} does not fit into a uint64.`);return this.__writeBigInteger(value,8),this}
/**
* Writes a single precision floating point number.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/writeFloat(value){return this.__writeFloatingPointNumber(value,4),this}
/**
* Writes a double precision floating point number.
* This function throws an exception if the provided value does not fit into this datatype or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The number to write.
* @preserve (Part of the public API)
*/writeDouble(value){return this.__writeFloatingPointNumber(value,8),this}
/**
* Writes a string.
* This function throws an exception if the provided value does not fit into the given length or if length was specified during writer construction and the value to write does not fit into the remaining length.
* @param value The string to write.
* @param optionsOrLength The options to use or the length of the string to write.
* @preserve (Part of the public API)
*/writeString(value,optionsOrLength){let options={encoding:"UTF-8",addNullTerminator:!1};"number"==typeof optionsOrLength?options.length=optionsOrLength:optionsOrLength&&(optionsOrLength.encoding&&optionsOrLength.encoding in this.__stringEncodings&&(options.encoding=optionsOrLength.encoding),void 0!==optionsOrLength.length&&(options.length=optionsOrLength.length),optionsOrLength.addNullTerminator&&(options.addNullTerminator=!0));const codePoints=this.__getCodePointsFromString(value);options.addNullTerminator&&0!==codePoints[codePoints.length-1]&&codePoints.push(0);let bytes=this.__stringEncodings[options.encoding].encode(codePoints,this.__endianness);if(void 0!==options.length){for(;bytes.length<options.length;)bytes.push(0);if(bytes.length>options.length)throw new RangeError("The specified string does not fit into the specified length.")}if(this.__data.length+bytes.length>this.__length)throw new RangeError(`Trying to write ${bytes.length} bytes exceeds the length of the data.`);return this.__data=this.__data.concat(bytes),this}__getCodePointsFromString(value){let codePoints=[];for(let i=0,ii=value.length;i<ii;i++){let first=value.charCodeAt(i);if(first>=55296&&first<=56319&&i<ii-1){let second=value.charCodeAt(i+1);second>=56320&&second<=57343?(codePoints.push(1024*(first-55296)+second-56320+65536),i++):codePoints.push(first)}else codePoints.push(first)}return codePoints}
/**
* Returns the base64 encoded string. If not enough data was written to fill the length the data should have, the rest is filled up with zeros.
* @preserve (Part of the public API)
*/getEncodedString(){const length=this.__data.length;if(isFinite(this.__length)&&this.__data.length<this.__length){const start=this.__data.length;this.__data.length=this.__length,this.__data.fill(0,start)}const rawChunks=[];for(let i=0;i<this.__data.length;i+=1e4)rawChunks.push(String.fromCharCode(...this.__data.slice(i,i+1e4)));return this.__data.length=length,tchmi_base64encode(rawChunks.join(""))}
/**
* Returns the length of the data that has been written.
* @preserve (Part of the public API)
*/getLength(){return this.__data.length}}TcHmi.Base64BinaryWriter=Base64BinaryWriter;

View File

@@ -0,0 +1,107 @@
import { SymbolExpression } from './SymbolExpression.js';
/**
* Creates a binding between a symbol and a control attribute setter function.
* @param expression The target symbol expression.
* @param fn The target function as prototype reference.
* @param control The target control instance.
* @preserve (Part of the public API)
*/
export declare function create(expression: string, fn: (value: any) => void, control: TcHmi.Controls.System.baseTcHmiControl): void;
/**
* Creates a binding between a symbol and a control attribute setter function by name.
* @param expression The target symbol expression.
* @param fn The name of the control setter function.
* @param control The target control instance.
* @preserve (Part of the public API)
*/
export declare function createEx(expression: string, fn: string, control: TcHmi.Controls.System.baseTcHmiControl): void;
/**
* Creates a binding between a symbol and a control attribute setter function by name of property.
* @param expression The target symbol expression.
* @param propertyName The name of the control property.
* @param control The target control instance.
* @param options [Optional] Additional options for the binding.
* @param options.ctx Context for the binding symbol.
* @preserve (Part of the public API)
*/
export declare function createEx2(expression: string, propertyName: string, control: TcHmi.Controls.System.baseTcHmiControl, options?: {
ctx?: TcHmi.Context;
}): void;
/**
* Removes a binding between a symbol and a control attribute setter function.
* @param expression [OBSOLETE] The target symbol expression.
* @param fn The target function as prototype reference.
* @param control The target control instance.
* @param bReset [Optional] If set to false the setter will not resetted with null.
* @preserve (Part of the public API)
*/
export declare function remove(expression: string | null, fn: (value: any) => void, control: TcHmi.Controls.System.baseTcHmiControl, bReset?: boolean): void;
/**
* Removes a binding between a symbol and a control attribute setter function.
* @param expression [OBSOLETE] The target symbol expression.
* @param fn The name of the control setter function.
* @param control The target control instance.
* @param bReset [Optional] If set to false the setter will not resetted with null.
* @preserve (Part of the public API)
*/
export declare function removeEx(expression: string | null, fn: string, control: TcHmi.Controls.System.baseTcHmiControl, bReset?: boolean): void;
/**
* Removes a binding between a symbol and a control attribute setter function by name of property.
* @param _unused [OBSOLETE] The target symbol expression.
* @param propertyName The name of the control attribute property.
* @param control The target control instance.
* @param bReset [Optional] If set to false the setter will not resetted with null.
* @preserve (Part of the public API)
*/
export declare function removeEx2(_unused: string | null, propertyName: string, control: TcHmi.Controls.System.baseTcHmiControl, bReset?: boolean): void;
/**
* Returns true if a symbol is bound to the target control property.
* @param propertyName The name of the control attribute property.
* @param control The target control instance.
* @preserve (Part of the public API)
*/
export declare function exists(propertyName: string, control: TcHmi.Controls.System.baseTcHmiControl): boolean;
/**
* Returns the symbol expression of a binding as string or null if no symbol is bound to the target control property.
* @param propertyName The name of the control attribute property.
* @param control The target control instance.
* @preserve (Part of the public API)
*/
export declare function resolve(propertyName: string, control: TcHmi.Controls.System.baseTcHmiControl): string | null;
/**
* Returns the symbol expression of a binding as SymbolExpression object or null if no symbol is bound to the target control property.
* @param propertyName The name of the control attribute property.
* @param control The target control instance.
* @preserve (Part of the public API)
*/
export declare function resolveEx(propertyName: string, control: TcHmi.Controls.System.baseTcHmiControl): SymbolExpression | null;
declare const _create: typeof create;
declare const _createEx: typeof createEx;
declare const _createEx2: typeof createEx2;
declare const _remove: typeof remove;
declare const _removeEx: typeof removeEx;
declare const _removeEx2: typeof removeEx2;
declare const _exists: typeof exists;
declare const _resolve: typeof resolve;
declare const _resolveEx: typeof resolveEx;
declare global {
namespace TcHmi {
/**
* Provides functions for creating and removing bindings.
* @preserve (Part of the public API)
*/
namespace Binding {
let create: typeof _create;
let createEx: typeof _createEx;
let createEx2: typeof _createEx2;
let remove: typeof _remove;
let removeEx: typeof _removeEx;
let removeEx2: typeof _removeEx2;
let exists: typeof _exists;
let resolve: typeof _resolve;
let resolveEx: typeof _resolveEx;
}
}
}
export {};
//# sourceMappingURL=Binding.d.ts.map

View File

@@ -0,0 +1,66 @@
import{bindingManager}from"../System/BindingManager.js";import{controlManager}from"../System/ControlManager.js";import{isParameterTypeInvalid}from"../System/SystemFunctions.js";import{SymbolExpression}from"./SymbolExpression.js";function __getFuncName(fn,control){let res=null,current=control;do{const propertyNames=Object.getOwnPropertyNames(current);for(const propertyName of propertyNames)if("arguments"!==propertyName&&"caller"!==propertyName&&current[propertyName]===fn){res=propertyName;break}}while(current=Object.getPrototypeOf(current));return res}
/**
* Creates a binding between a symbol and a control attribute setter function.
* @param expression The target symbol expression.
* @param fn The target function as prototype reference.
* @param control The target control instance.
* @preserve (Part of the public API)
*/export function create(expression,fn,control){const fnName=__getFuncName(fn,control);null!==fnName&&createEx(expression,fnName,control)}
/**
* Creates a binding between a symbol and a control attribute setter function by name.
* @param expression The target symbol expression.
* @param fn The name of the control setter function.
* @param control The target control instance.
* @preserve (Part of the public API)
*/export function createEx(expression,fn,control){const attr=controlManager.getAttributeByPropertySetterName(control,fn);attr?bindingManager.createBinding(expression,attr.propertyName,control):TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] The attribute with the setter "+fn+" is not included in the description.json of "+control.getType()+". Creating a binding with this attribute failed.")}
/**
* Creates a binding between a symbol and a control attribute setter function by name of property.
* @param expression The target symbol expression.
* @param propertyName The name of the control property.
* @param control The target control instance.
* @param options [Optional] Additional options for the binding.
* @param options.ctx Context for the binding symbol.
* @preserve (Part of the public API)
*/export function createEx2(expression,propertyName,control,options){let parameterInvalid=isParameterTypeInvalid(expression,"expression",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Binding");parameterInvalid?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Binding] Creating binding failed. expression not valid: ",expression):(parameterInvalid=isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Binding"),parameterInvalid?TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Binding] Creating binding failed. propertyName not valid: ",propertyName):control instanceof TcHmi.Controls.System.baseTcHmiControl?bindingManager.createBinding(expression,propertyName,control,options):TcHmi.Log.errorEx("[Source=Framework, Module=TcHmi.Binding] Creating binding failed. control not valid: ",control))}
/**
* Removes a binding between a symbol and a control attribute setter function.
* @param expression [OBSOLETE] The target symbol expression.
* @param fn The target function as prototype reference.
* @param control The target control instance.
* @param bReset [Optional] If set to false the setter will not resetted with null.
* @preserve (Part of the public API)
*/export function remove(expression,fn,control,bReset=!0){const fnName=__getFuncName(fn,control);null!==fnName&&removeEx(expression,fnName,control,bReset)}
/**
* Removes a binding between a symbol and a control attribute setter function.
* @param expression [OBSOLETE] The target symbol expression.
* @param fn The name of the control setter function.
* @param control The target control instance.
* @param bReset [Optional] If set to false the setter will not resetted with null.
* @preserve (Part of the public API)
*/export function removeEx(expression,fn,control,bReset=!0){const attr=controlManager.getAttributeByPropertySetterName(control,fn);attr?removeEx2(expression,attr.propertyName,control,bReset):TcHmi.Log.error("[Source=Framework, Module=TcHmi.Binding] The attribute with the setter "+fn+" is not included in the description.json of "+control.getType()+". Removing a binding with this attribute failed.")}
/**
* Removes a binding between a symbol and a control attribute setter function by name of property.
* @param _unused [OBSOLETE] The target symbol expression.
* @param propertyName The name of the control attribute property.
* @param control The target control instance.
* @param bReset [Optional] If set to false the setter will not resetted with null.
* @preserve (Part of the public API)
*/export function removeEx2(_unused,propertyName,control,bReset=!0){bindingManager.removeBinding(propertyName,control,bReset)}
/**
* Returns true if a symbol is bound to the target control property.
* @param propertyName The name of the control attribute property.
* @param control The target control instance.
* @preserve (Part of the public API)
*/export function exists(propertyName,control){return!!resolve(propertyName,control)}
/**
* Returns the symbol expression of a binding as string or null if no symbol is bound to the target control property.
* @param propertyName The name of the control attribute property.
* @param control The target control instance.
* @preserve (Part of the public API)
*/export function resolve(propertyName,control){const binding=bindingManager.getBinding(propertyName,control);if(binding){const symbol=binding.getSymbol();if(symbol)return symbol.getExpression().toString()}return null}
/**
* Returns the symbol expression of a binding as SymbolExpression object or null if no symbol is bound to the target control property.
* @param propertyName The name of the control attribute property.
* @param control The target control instance.
* @preserve (Part of the public API)
*/export function resolveEx(propertyName,control){const binding=bindingManager.getBinding(propertyName,control);if(binding){const symbol=binding.getSymbol();if(symbol)return new SymbolExpression(symbol.getExpression().toString())}return null}TcHmi.Binding={create,createEx,createEx2,remove,removeEx,removeEx2,exists,resolve,resolveEx};

View File

@@ -0,0 +1,55 @@
import { CallbackCollection as Collection, AsyncCallbackCollection as AsyncCollection } from './CallbackCollection.js';
/**
* Calls a callback and catches exceptions to return them as value of type {Error} for further processing.
* @param callback function to call
* @param thisArg the this pointer in the function call
* @param args parameters for the function call
* @returns undefined or the Error in case of an exception
* @template T this for the call
* @template A Array of types for all parameter for the function
* @preserve (Part of the public API)
*/
export declare function callSafe<T extends object | null, A extends any[]>(callback: ICallback<T, A> | null | undefined, thisArg: T, ...args: A): Error | undefined;
/**
* Calls a callback and catches exceptions to return them as value of type {Error} for further processing and prints it to console for proper call stack.
* @param callback function to call
* @param thisArg the this pointer in the function call
* @param args parameters for the function call
* @returns undefined or the Error in case of an exception
* @template T this for the call
* @template A Array of types for all parameter for the function
* @preserve (Part of the public API)
*/
export declare function callSafeEx<T extends object | null, A extends any[]>(callback: ICallback<T, A> | null | undefined, thisArg: T, ...args: A): Error | undefined;
/**
* @template T this for the call
* @template A Array of types for all parameter for the function
*/
export interface ICallback<T extends object | null, A extends any[]> {
(this: T, ...args: A): void;
}
export { Collection, AsyncCollection };
declare const _callSafe: typeof callSafe;
declare const _callSafeEx: typeof callSafeEx;
declare const _Collection: typeof Collection;
declare const _AsyncCollection: typeof AsyncCollection;
type tICallback<T extends object | null, A extends any[]> = ICallback<T, A>;
type tCollection<C extends (...args: any[]) => any> = Collection<C>;
type tAsyncCollection<C extends (...args: any[]) => any> = AsyncCollection<C>;
declare global {
namespace TcHmi {
/**
* Provides resources for safely calling callback functions.
*/
namespace Callback {
let callSafe: typeof _callSafe;
let callSafeEx: typeof _callSafeEx;
type ICallback<T extends object | null, A extends any[]> = tICallback<T, A>;
let Collection: typeof _Collection;
let AsyncCollection: typeof _AsyncCollection;
type Collection<C extends (...args: any[]) => any> = tCollection<C>;
type AsyncCollection<C extends (...args: any[]) => any> = tAsyncCollection<C>;
}
}
}
//# sourceMappingURL=Callback.d.ts.map

View File

@@ -0,0 +1,21 @@
import{Log}from"./Log.js";import{CallbackCollection as Collection,AsyncCallbackCollection as AsyncCollection}from"./CallbackCollection.js";
/**
* Calls a callback and catches exceptions to return them as value of type {Error} for further processing.
* @param callback function to call
* @param thisArg the this pointer in the function call
* @param args parameters for the function call
* @returns undefined or the Error in case of an exception
* @template T this for the call
* @template A Array of types for all parameter for the function
* @preserve (Part of the public API)
*/export function callSafe(callback,thisArg,...args){let res;if(callback&&"function"==typeof callback)try{callback.call(thisArg,...args)}catch(e){res=e instanceof Error?e:new Error("Function "+(callback.name?callback.name+" ":"")+"has thrown a plain value (no Error object) and therefore lacks a callstack. Thrown value: "+e)}return res}
/**
* Calls a callback and catches exceptions to return them as value of type {Error} for further processing and prints it to console for proper call stack.
* @param callback function to call
* @param thisArg the this pointer in the function call
* @param args parameters for the function call
* @returns undefined or the Error in case of an exception
* @template T this for the call
* @template A Array of types for all parameter for the function
* @preserve (Part of the public API)
*/export function callSafeEx(callback,thisArg,...args){let res;if(callback&&"function"==typeof callback)try{callback.call(thisArg,...args)}catch(e){res=e instanceof Error?e:new Error("Function "+(callback.name?callback.name+" ":"")+"has thrown a plain value (no Error object) and therefore lacks a callstack. Thrown value: "+e)}return res&&Log.error(res),res}export{Collection,AsyncCollection};TcHmi.Callback={callSafe,callSafeEx,Collection,AsyncCollection};

View File

@@ -0,0 +1,51 @@
declare abstract class CallbackCollectionBase<C extends (...args: any[]) => any> {
protected __callbacks: Set<C>;
/**
* Adds a callback.
* @param callback The callback to add.
*/
add(callback: C): DestroyFunction;
/**
* Removes the callback.
* @param callback The callback to remove.
*/
remove(callback: C): void;
/**
* Removes all callbacks.
*/
clear(): void;
/**
* Returns a frozen object containig the add and remove methods. Useful for exposing these methods to the public
* without also exposing the trigger method.
*/
getManipulators(): Readonly<{
add: (callback: C) => DestroyFunction;
remove: (callback: C) => void;
}>;
}
/**
* A collection of callbacks.
*/
export declare class CallbackCollection<C extends (...args: any[]) => any> extends CallbackCollectionBase<C> {
/**
* Calls all registered callbacks with the provided arguments.
* @param args The parametes for the callback invocations.
*/
trigger(...args: Parameters<C>): PromiseSettledResult<ReturnType<C>>[];
}
/**
* A collection of asynchronous callbacks.
*/
export declare class AsyncCallbackCollection<C extends (...args: any[]) => Promise<any>> extends CallbackCollectionBase<C> {
/**
* Calls all registered callbacks with the provided arguments.
* @param args The parametes for the callback invocations.
*/
trigger(...args: Parameters<C>): Promise<PromiseSettledResult<Awaited<ReturnType<C>>>[]>;
}
/**
* A function that removes the callback from the collection when called.
*/
type DestroyFunction = () => void;
export {};
//# sourceMappingURL=CallbackCollection.d.ts.map

View File

@@ -0,0 +1 @@
class CallbackCollectionBase{__callbacks=new Set;add(callback){return this.__callbacks.add(callback),()=>this.remove(callback)}remove(callback){this.__callbacks.delete(callback)}clear(){this.__callbacks.clear()}getManipulators(){return Object.freeze({add:this.add.bind(this),remove:this.remove.bind(this)})}}export class CallbackCollection extends CallbackCollectionBase{trigger(...args){const result=[];for(const callback of this.__callbacks)try{result.push({status:"fulfilled",value:callback(...args)})}catch(error){result.push({status:"rejected",reason:error})}return result}}export class AsyncCallbackCollection extends CallbackCollectionBase{trigger(...args){let promises=[];for(const callback of this.__callbacks)try{promises.push(callback(...args))}catch(error){promises.push(Promise.reject(error instanceof Error?error:new Error("string"==typeof error?error:void 0)))}return Promise.allSettled(promises)}}

View File

@@ -0,0 +1,27 @@
/**
* Returns a copy of the current object which is constructed from tchmiconfig.json
* @preserve (Part of the public API)
*/
export declare function get(): TcHmi.IConfig;
/**
* Returns a Dictionary with all nuget packages of the project.
* Key is the Nuget ID.
* @preserve (Part of the public API)
*/
export declare function getNugetPackagesMetadata(): TcHmi.Dictionary<TcHmi.Config.NugetPackageMetadata>;
declare const _get: typeof get;
declare const _getNugetPackagesMetadata: typeof getNugetPackagesMetadata;
declare global {
namespace TcHmi {
/**
* Provides resources for accessing configuration data.
* @preserve (Part of the public API)
*/
namespace Config {
const get: typeof _get;
const getNugetPackagesMetadata: typeof _getNugetPackagesMetadata;
}
}
}
export {};
//# sourceMappingURL=Config.d.ts.map

View File

@@ -0,0 +1,10 @@
import{config,nugetPackagesMetadata}from"../System/System.js";
/**
* Returns a copy of the current object which is constructed from tchmiconfig.json
* @preserve (Part of the public API)
*/export function get(){return tchmi_clone_object(config)}
/**
* Returns a Dictionary with all nuget packages of the project.
* Key is the Nuget ID.
* @preserve (Part of the public API)
*/export function getNugetPackagesMetadata(){return tchmi_clone_object(nugetPackagesMetadata)}TcHmi.Config={get,getNugetPackagesMetadata};

View File

@@ -0,0 +1,15 @@
export {};
declare global {
namespace TcHmi {
/**
* Deprecated. Please use TcHmi.Controls.get()
* @deprecated Please use TcHmi.Controls.get()
*/
let control: TcHmi.Dictionary<TcHmi.Controls.System.baseTcHmiControl>;
/**
* Reserved
*/
let Control: never;
}
}
//# sourceMappingURL=Control.d.ts.map

View File

@@ -0,0 +1 @@
TcHmi.control??={},TcHmi.Control??={};export{};

View File

@@ -0,0 +1,66 @@
/**
* Creates a new control.
* This function throws an exception if one of the given parameter values is invalid.
* * Attributes are given with its html attribute names:
* ```json
* {
* 'data-tchmi-attribute1' : true,
* 'data-tchmi-attribute2' : false
* }
* ```
* @param type The type of the control.
* @param id The identifier of the control.
* @param attributes A dictionary for the attributes with the html attribute names as keys
* @param parent Optional. The logical parent control.
* @template C defines the type for the new control
* @preserve (Part of the public API)
*/
export declare function createEx<C extends TcHmi.Controls.System.baseTcHmiControl>(type: string, id: string, attributes: null | TcHmi.Dictionary<any>, parent?: TcHmi.Controls.System.baseTcHmiControl | null): C | undefined;
/** DEPRECATED API PARTS*/
/**
* DEPRECATED
* Creates a new control.
* @param html The base html for the control.
* @param unused Optional. Has to be set to null if parameter parent is used.
* @param parent Optional. The logical parent control.
* @template C defines the type for the new control
* @deprecated Please use createEx()
*/
declare function create<C extends TcHmi.Controls.System.baseTcHmiControl>(html: string, unused?: null, parent?: TcHmi.Controls.System.baseTcHmiControl | null): C | undefined;
/**
* DEPRECATED
* Creates a new control.
* The new control HTMLElement, available via getElement(), can be attached to the DOM afterwards.
* @param element The base element for the control.
* @param unused Optional. Has to be set to null if parameter parent is used.
* @param parent Optional. The logical parent control.
* @template C defines the type for the new control
* @deprecated Please use createEx()
*/
declare function create<C extends TcHmi.Controls.System.baseTcHmiControl>(element: JQuery, unused?: null, parent?: TcHmi.Controls.System.baseTcHmiControl | null): C | undefined;
/**
* DEPRECATED
* Creates a new control.
* @param type The type of the control.
* @param id The identifier of the control.
* @param parent Optional. The logical parent control.
* @template C defines the type for the new control
* @deprecated Please use createEx()
*/
declare function create<C extends TcHmi.Controls.System.baseTcHmiControl>(type: string, id: string, parent?: TcHmi.Controls.System.baseTcHmiControl | null): C | undefined;
declare const _create: typeof create;
declare const _createEx: typeof createEx;
declare global {
namespace TcHmi {
/**
* Class for creating control instances.
* @preserve (Part of the public API)
*/
namespace ControlFactory {
const create: typeof _create;
const createEx: typeof _createEx;
}
}
}
export {};
//# sourceMappingURL=ControlFactory.d.ts.map

View File

@@ -0,0 +1,28 @@
import{controlManager}from"../System/ControlManager.js";import{isParameterTypeInvalid}from"../System/SystemFunctions.js";
/**
* Creates a new control.
* This function throws an exception if one of the given parameter values is invalid.
* * Attributes are given with its html attribute names:
* ```json
* {
* 'data-tchmi-attribute1' : true,
* 'data-tchmi-attribute2' : false
* }
* ```
* @param type The type of the control.
* @param id The identifier of the control.
* @param attributes A dictionary for the attributes with the html attribute names as keys
* @param parent Optional. The logical parent control.
* @template C defines the type for the new control
* @preserve (Part of the public API)
*/export function createEx(type,id,attributes,parent){if(isParameterTypeInvalid(type,"type",{type:"string",required:"valueNeeded",minStringLength:1}))throw new TypeError(`[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: "${type}" for parameter: "type"`);if(isParameterTypeInvalid(id,"id",{type:"string",required:"valueNeeded",minStringLength:1}))throw new TypeError(`[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: "${id}" for parameter: id`);if(isParameterTypeInvalid(attributes,"attributes ",{type:"object",required:"nullOk"})||__tchmi_is_instanced_object(attributes))throw new TypeError(`[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: "${JSON.stringify(attributes)} " for parameter: attributes`);if(parent&&!(parent instanceof TcHmi.Controls.System.baseTcHmiControl))throw new TypeError(`[[Source=Framework, Module=TcHmi.ControlFactory.createEx] Invalid value: "${JSON.stringify(parent)}" for parameter: parent`);let elem=document.createElement("div");return elem.id=id,elem.setAttribute("data-tchmi-type",type),controlManager.compile(elem,parent,{designerIgnore:!0,overrideAttr:attributes}).control}
/**
* DEPRECATED
* Creates a new control.
* @param htmlOrElementOrType The HTML, jQuery element or type of the control.
* @param id Optional the identifier of the control.
* @param parent Optional. The logical parent control.
* @deprecated Please use createEx()
* @template C defines the type for the new control
* @preserve (Part of the public API)
*/function create(htmlOrElementOrType,id,parent){let jControl;if(null==id)jControl="string"==typeof htmlOrElementOrType?$(htmlOrElementOrType):htmlOrElementOrType;else{if("string"!=typeof htmlOrElementOrType)return void TcHmi.Log.error("[Source=Framework, Module=TcHmi.ControlFactory] Error compiling control. Wrong input parameter given.");jControl=$(`<div id="${id}" data-tchmi-type="${htmlOrElementOrType}"></div>`)}if(0===jControl.length)return;if(void 0!==TcHmi.Controls.get(jControl[0].id))return void TcHmi.Log.error(`[Source=Framework, Module=TcHmi.ControlFactory] Error compiling control. A control with the name ${jControl[0].id} already exists.`);return controlManager.compile(jControl[0],parent,{designerIgnore:!0}).control}TcHmi.ControlFactory={create,createEx};

View File

@@ -0,0 +1,125 @@
/**
* DEPRECATED
* Register a control.
* The Framework will fetch and interprete the Description.json in the Control Directory and optionally load a HTML Template file
* @param controlTypeName Name of the Control type.
* @param constructor Constructor which generates the TcHmi Control.
* @param directory Directory of the Control (base path is the Controls directory).
* @param template Template file of the Control (base path is the Controls directory).
* @template C defines the type for the control to register
* @preserve (Part of the public API)
* @deprecated Please use registerEx()
*/
declare function register<C extends TcHmi.Controls.System.baseTcHmiControl>(controlTypeName: string, constructor: TcHmi.Controls.baseTcHmiControlConstructor<C>, directory: string, template?: string | null): void;
/**
* Register a control.
* The Framework will fetch and interprete the Description.json in the Control Directory and optionally load a HTML Template file
* @param controlTypeName Name of the Control type.
* @param namespace Name of the Control namespace.
* @param constructor Constructor which generates the TcHmi Control.
* @param options options
* @param options.injectInGlobalObject Inject the control implementation at namespace.name in global object
* @template C defines the type for the control to register
* @preserve (Part of the public API)
*/
export declare function registerEx<C extends TcHmi.Controls.System.baseTcHmiControl>(controlTypeName: string, namespace: string, constructor: TcHmi.Controls.baseTcHmiControlConstructor<C>, options?: {
/** Inject the control implementation at namespace.name in global object */
injectInGlobalObject?: boolean;
}): void;
/**
* Get control by identifier. Returns the control or undefined.
* @param id Identifier of the Control.
* @template T Type of the Control
* @preserve (Part of the public API)
*/
export declare function get<T extends TcHmi.Controls.System.baseTcHmiControl>(id: string | null | undefined): T | undefined;
/**
* Gets description information of control by type.
* @param type Type of the Control.
* @preserve (Part of the public API)
*/
export declare function getDescription(type: string): TcHmi.ControlDescription | null;
/**
* Gets version information of control by type.
* @param type Type of the Control.
* @preserve (Part of the public API)
*/
export declare function getVersion(type: string): TcHmi.Version | null;
/**
* Returns the dynamic base path of a control.
* For example: 'Beckhoff.TwinCAT.HMI.Controls/TcHmiButton'
* @preserve (Part of the public API)
* @param type Control type name
*/
export declare function getBasePath(type: string): string | null;
/**
* Returns the dynamic base path of a control.
* For example: 'Beckhoff.TwinCAT.HMI.Controls/TcHmiButton'
* @preserve (Part of the public API)
* @param control TcHmi Control reference
*/
export declare function getBasePathEx(control: TcHmi.Controls.System.baseTcHmiControl): string | null;
/**
* Get an ES5 Map of all controls. Key of the map is the control identifier
* @preserve (Part of the public API)
*/
export declare function getMap(): Map<string, TcHmi.Controls.System.baseTcHmiControl>;
/**
* Limit a pixel dimension with the min and max dimension of the control.
* @param control Control to check the dimension
* @param dimension Dimension to check
* @param valueToTest Value which should be compared
*/
export declare function limitPixelDimensionToControlBound(control: TcHmi.Controls.System.baseTcHmiControl, dimension: 'width' | 'height', valueToTest: number | null): number | null;
/**
* DEPRECATED
* Does no longer do anything
* @deprecated Does no longer do anything
* @param callback will be imediately called
* @preserve (Part of the public API)
*/
declare function tachControls(callback?: null | ((this: null) => void)): void;
/**
* DEPRECATED
* Does no longer do anything
* @param callback will be imediately called
* @deprecated Does no longer do anything
*/
declare function tachControlsAsync(callback?: null | ((this: null) => void)): void;
declare const _register: typeof register;
declare const _registerEx: typeof registerEx;
declare const _get: typeof get;
declare const _getDescription: typeof getDescription;
declare const _getVersion: typeof getVersion;
declare const _getBasePath: typeof getBasePath;
declare const _getBasePathEx: typeof getBasePathEx;
declare const _getMap: typeof getMap;
declare const _limitPixelDimensionToControlBound: typeof limitPixelDimensionToControlBound;
declare const _tachControls: typeof tachControls;
declare const _tachControlsAsync: typeof tachControlsAsync;
declare global {
namespace TcHmi {
/**
* TwinCAT HMI Controls
* Check out
* https://infosys.beckhoff.com/content/1031/te2000_tc3_hmi_engineering/3728912139.html?id=2674190766896363084
* for an API reference.
* @preserve (Part of the public API)
*/
namespace Controls {
let register: typeof _register;
let registerEx: typeof _registerEx;
let get: typeof _get;
let getDescription: typeof _getDescription;
let getVersion: typeof _getVersion;
let getBasePath: typeof _getBasePath;
let getBasePathEx: typeof _getBasePathEx;
let getMap: typeof _getMap;
let limitPixelDimensionToControlBound: typeof _limitPixelDimensionToControlBound;
let tachControls: typeof _tachControls;
let tachControlsAsync: typeof _tachControlsAsync;
}
}
}
export {};
//# sourceMappingURL=Controls.d.ts.map

View File

@@ -0,0 +1,64 @@
import{mapControlNamesFromPackageManifestApi1ToApi0,injectInGlobalObject,controlRegistrations as registrations}from"../System/RegistrationHelpers.js";let controlManager,getControlBasePath,getControlBasePathEx;
/**
* DEPRECATED
* Register a control.
* The Framework will fetch and interprete the Description.json in the Control Directory and optionally load a HTML Template file
* @param controlTypeName Name of the Control type.
* @param constructor Constructor which generates the TcHmi Control.
* @param directory Directory of the Control (base path is the Controls directory).
* @param template Template file of the Control (base path is the Controls directory).
* @template C defines the type for the control to register
* @preserve (Part of the public API)
* @deprecated Please use registerEx()
*/
function register(controlTypeName,constructor,directory,template){let registration={name:controlTypeName,directory,error:TcHmi.Errors.NONE,apiVersion:0,ctrlConstructor:constructor,template};if(constructor.toString().startsWith("class"))registration.nativeEs6Control=!0;else{registration.nativeEs6Control=!1;let firstES6constructor=constructor;do{firstES6constructor=Object.getPrototypeOf(firstES6constructor)}while(firstES6constructor&&!firstES6constructor.toString().startsWith("class"));firstES6constructor&&(registration.nearestEs6Constructor=firstES6constructor)}registrations.map.has(controlTypeName)?registrations.map.set(controlTypeName,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.register",reason:'Ambiguous registration for the type name: "'+controlTypeName+'". Control will not be addressable by this type name. Please try fully qualified name to access control.'}}):registrations.map.set(controlTypeName,registration),registrations.array.push(registration),TcHmi.EventProvider.raise("System.onControlRegistered",registration)}
/**
* Register a control.
* The Framework will fetch and interprete the Description.json in the Control Directory and optionally load a HTML Template file
* @param controlTypeName Name of the Control type.
* @param namespace Name of the Control namespace.
* @param constructor Constructor which generates the TcHmi Control.
* @param options options
* @param options.injectInGlobalObject Inject the control implementation at namespace.name in global object
* @template C defines the type for the control to register
* @preserve (Part of the public API)
*/import("../System/ControlManager.js").then(module=>{controlManager=module.controlManager}),import("./Environment.js").then(module=>{getControlBasePath=module.getControlBasePath,getControlBasePathEx=module.getControlBasePathEx});export function registerEx(controlTypeName,namespace,constructor,options){let foundDuplicate=!1,registration={name:controlTypeName,namespace,error:TcHmi.Errors.NONE,apiVersion:1,ctrlConstructor:constructor};if(constructor.toString().startsWith("class"))registration.nativeEs6Control=!0;else{registration.nativeEs6Control=!1;let firstES6constructor=constructor;do{firstES6constructor=Object.getPrototypeOf(firstES6constructor)}while(firstES6constructor&&!firstES6constructor.toString().startsWith("class"));firstES6constructor&&(registration.nearestEs6Constructor=firstES6constructor)}const qname=namespace?namespace+"."+controlTypeName:controlTypeName;if(registrations.map.has(controlTypeName)?registrations.map.set(controlTypeName,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:`Ambiguous registration for the type name: "${controlTypeName}". Control will not be addressable by this type name. Please try fully qualified name to access control.`}}):registrations.map.set(controlTypeName,registration),registrations.map.has(qname)?(registrations.map.set(qname,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:`Ambiguous registration for the name: "${qname}". Control will not be usable.`}}),foundDuplicate=!0):(registrations.map.set(qname,registration),options?.injectInGlobalObject&&injectInGlobalObject(qname,constructor)),mapControlNamesFromPackageManifestApi1ToApi0.has(qname)){let nameLegacy=mapControlNamesFromPackageManifestApi1ToApi0.get(qname);registrations.map.has(nameLegacy)?(registrations.map.set(nameLegacy,{apiVersion:1,error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Controls.registerEx",reason:`Ambiguous registration for the name: "${nameLegacy}". Control will not be addressable by this name.`}}),foundDuplicate=!0):registrations.map.set(nameLegacy,registration)}foundDuplicate||(registrations.array.push(registration),TcHmi.EventProvider.raise("System.onControlRegistered",registration))}
/**
* Get control by identifier. Returns the control or undefined.
* @param id Identifier of the Control.
* @template T Type of the Control
* @preserve (Part of the public API)
*/export function get(id){if(!id||!controlManager)return;return controlManager.getControlsCache().get(id)}
/**
* Gets description information of control by type.
* @param type Type of the Control.
* @preserve (Part of the public API)
*/export function getDescription(type){return type&&controlManager?tchmi_clone_object(controlManager.getDescription(type,!0)):null}
/**
* Gets version information of control by type.
* @param type Type of the Control.
* @preserve (Part of the public API)
*/export function getVersion(type){if(!type||!controlManager)return null;let descr=controlManager.getDescription(type);return descr&&descr.version&&"object"==typeof descr.version?tchmi_clone_object(descr.version):null}
/**
* Returns the dynamic base path of a control.
* For example: 'Beckhoff.TwinCAT.HMI.Controls/TcHmiButton'
* @preserve (Part of the public API)
* @param type Control type name
*/export function getBasePath(type){return getControlBasePath?.(type)??null}
/**
* Returns the dynamic base path of a control.
* For example: 'Beckhoff.TwinCAT.HMI.Controls/TcHmiButton'
* @preserve (Part of the public API)
* @param control TcHmi Control reference
*/export function getBasePathEx(control){return getControlBasePathEx?.(control)??null}
/**
* Get an ES5 Map of all controls. Key of the map is the control identifier
* @preserve (Part of the public API)
*/export function getMap(){return controlManager?tchmi_clone_object(controlManager.getControlsCache(),{cloneMaps:{deepCloneKeys:!1,deepCloneValues:!1}}):(TcHmi.Log.error("[Source=Framework, Module=TcHmi.Controls] Accessing control map failed. System not ready."),new Map)}export function limitPixelDimensionToControlBound(control,dimension,valueToTest){let currentMinValue=null,currentMaxValue=null;return"height"===dimension?("px"===control.getMinHeightUnit()&&(currentMinValue=control.getMinHeight()??null),"px"===control.getMaxHeightUnit()&&(currentMaxValue=control.getMaxHeight()??null)):"width"===dimension&&("px"===control.getMinWidthUnit()&&(currentMinValue=control.getMinWidth()??null),"px"===control.getMaxWidthUnit()&&(currentMaxValue=control.getMaxWidth()??null)),null===valueToTest?currentMinValue:(currentMinValue&&valueToTest<currentMinValue&&(valueToTest=currentMinValue),currentMaxValue&&valueToTest&&valueToTest>currentMaxValue&&(valueToTest=currentMaxValue),valueToTest)}
/**
* DEPRECATED
* Does no longer do anything
* @deprecated Does no longer do anything
* @param callback will be imediately called
* @preserve (Part of the public API)
*/function tachControls(callback=null){TcHmi.Log.warn('[Source=Framework, Module=TcHmi.Controls] The function "TcHmi.Controls.tachControls(callback: null | ((this: void) => void) = null)" has been marked as deprecated and should no longer be used because it does no longer do anything.'),"function"==typeof callback&&callback.apply(null)}function tachControlsAsync(callback=null){TcHmi.Log.warn('[Source=Framework, Module=TcHmi.Controls] The function "TcHmi.Controls.tachControlsAsync(callback: null | ((this: void) => void) = null)" has been marked as deprecated and should no longer be used because it does no longer do anything.'),"function"==typeof callback&&callback.apply(null)}TcHmi.Controls={...TcHmi.Controls??{},register,registerEx,get,getDescription,getVersion,getBasePath,getBasePathEx,getMap,limitPixelDimensionToControlBound,tachControls,tachControlsAsync};

View File

@@ -0,0 +1,51 @@
/**
* Enables the decorated method to be used as an event handler by binding its this to the class it is defined on.
* @param options Options for the event handler.
*/
export declare function EventHandler<R, R2 extends R>(options?: R extends void | undefined ? EventHandlerOptions : EventHandlerOptions & ReturningEventHandlerOptions<R2>): <This extends TcHmi.Controls.System.baseTcHmiControl, Args extends any[]>(originalMethod: (this: This, ...args: Args) => R, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => R>) => (this: This, ...args: Args) => R;
/**
* Enables the decorated method to be used as a callback by binding its this to the class it is defined on.
* @param _originalMethod The method to decorate.
* @param context The decorator context.
*/
export declare function CallbackMethod<This extends any, Args extends any[], R>(_originalMethod: (this: This, ...args: Args) => R, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => R>): void;
/**
* Options for the event handler decorator.
* Not exported because it is not needed as an type.
*/
interface EventHandlerOptions {
/**
* Whether to check if the control is enabled before running the event handler.
*/
checkIsEnabled?: boolean;
/**
* Set this to a non-empty string to check whether the control has this access right or an array of strings
* to check whether the control has all of the access rights in the array.
*/
checkAccess?: string | string[];
/**
* Whether to check if the control is not in read only mode before running the event handler. Only supported
* on controls that have the IsReadOnly attribute.
*/
checkIsReadOnly?: boolean;
}
/**
* Extension for the event handler options that is used when an event handler is decorated that returns a value.
* Not exported because it is not needed as an type.
*/
interface ReturningEventHandlerOptions<R> {
/**
* Value that should be returned if the event handler returns early because one of its checks fails.
*/
earlyReturnValue: R;
}
declare const _EventHandler: typeof EventHandler;
declare const _CallbackMethod: typeof CallbackMethod;
declare global {
namespace TcHmi {
let EventHandler: typeof _EventHandler;
let CallbackMethod: typeof _CallbackMethod;
}
}
export {};
//# sourceMappingURL=Decorators.d.ts.map

View File

@@ -0,0 +1 @@
export function EventHandler(options){return function(originalMethod,context){const methodName=context.name;if(context.private)throw new Error(`'EventHandler' cannot decorate private properties like ${methodName}.`);return context.addInitializer(function(){this[methodName]=this[methodName].bind(this)}),options?function(...args){return options.checkIsEnabled&&!this.getIsEnabled()||options.checkIsReadOnly&&"getIsReadOnly"in this&&"function"==typeof this.getIsReadOnly&&this.getIsReadOnly()?options.earlyReturnValue:"string"!=typeof options.checkAccess||TcHmi.Access.checkAccess(this,options.checkAccess)?Array.isArray(options.checkAccess)&&options.checkAccess.some(access=>!TcHmi.Access.checkAccess(this,access))?options.earlyReturnValue:originalMethod.call(this,...args):options.earlyReturnValue}:originalMethod}}export function CallbackMethod(_originalMethod,context){const methodName=context.name;if(context.private)throw new Error(`'CallbackMethod' cannot decorate private properties like ${methodName}.`);context.addInitializer(function(){this[methodName]=this[methodName].bind(this)})}TcHmi.EventHandler=EventHandler;TcHmi.CallbackMethod=CallbackMethod;

View File

@@ -0,0 +1,114 @@
/**
* Change visibility of dialog and set its DialogType when showing.
* @param dialogOwner Caller Id to prevent overwriting forreign dialogs
* @param bVisibility Toggling visiblity of dialog
* @param dialogType Type of dialog
* @param options Options
* @returns returns false if the dialog could not be opened
* @preserve (Part of the public API)
*/
export declare function showDialog(dialogOwner: string, bVisibility: boolean, dialogType?: DialogType, options?: DialogOptions): boolean;
/**
* Changes the output content of the Dialog to a new value.
* Will always target DialogType.Overlay. Use updateTextEx if you want to target a specific DialogType.
* The default DialogSeverity is Info.
* @param dialogOwner Caller Id to prevent overwriting forreign dialogs
* @param html Content to show
* @param severity Severity for the content.
* @returns Success of the text update
* @preserve (Part of the public API)
*/
export declare function updateText(dialogOwner: string, html: string, severity?: DialogSeverity): boolean;
/**
* Changes the output content of the Dialog to a new value.
* The default DialogType is Overlay.
* The default DialogSeverity is Info.
* @param dialogOwner Caller Id to prevent overwriting forreign dialogs
* @param html Text to display
* @param options options
* @param options.dialogType Overlay or watermark
* @param options.severity severity of the text
* @param options.buttonReload If true a reload button is added
* @returns Success of the text update
* @preserve (Part of the public API)
*/
export declare function updateTextEx(dialogOwner: string, html: string, options?: {
dialogType?: DialogType;
severity?: DialogSeverity;
buttonReload?: boolean;
}): boolean;
/**
* Returns the current dialog owner or null.
* @preserve (Part of the public API)
*/
export declare function getDialogOwner(): string | null;
/**
* Builds a formatted message of hierarchical error objects for use in dialog.
* @param error Error object to show nicely
* @preserve (Part of the public API)
*/
export declare function buildMessage(error: TcHmi.IErrorDetails | undefined): string;
/**
* We support different severities for the dialog:
* Info
* Error
*/
export declare enum DialogSeverity {
Info = 0,
Warning = 1,
Error = 2
}
/**
* We support different types for the dialog:
* Overlay
* Watermark
*/
export declare enum DialogType {
/** An overlay dialog */
Overlay = 1,
/** A watermark */
Watermark = 2
}
/**
* Options for the system dialogs
*/
export interface DialogOptions {
/** The dialog should have a button to close the dialog. */
cancelable?: boolean;
/** The dialog should replace existing dialogs of different owner without respect. */
force?: boolean;
/** The dialog should be replaced by new dialogs of different owner without respect. */
forceable?: boolean;
}
declare const _showDialog: typeof showDialog;
declare const _updateText: typeof updateText;
declare const _updateTextEx: typeof updateTextEx;
declare const _getDialogOwner: typeof getDialogOwner;
declare const _buildMessage: typeof buildMessage;
declare const _DialogType: typeof DialogType;
type tDialogType = DialogType;
declare const _DialogSeverity: typeof DialogSeverity;
type tDialogSeverity = DialogSeverity;
type tDialogOptions = DialogOptions;
declare global {
namespace TcHmi {
/**
* Provides multiple types of dialogs to the user.
* @preserve (Part of the public API)
*/
namespace DialogManager {
const showDialog: typeof _showDialog;
const updateText: typeof _updateText;
const updateTextEx: typeof _updateTextEx;
const getDialogOwner: typeof _getDialogOwner;
const buildMessage: typeof _buildMessage;
const DialogType: typeof _DialogType;
type DialogType = tDialogType;
const DialogSeverity: typeof _DialogSeverity;
type DialogSeverity = tDialogSeverity;
type DialogOptions = tDialogOptions;
}
}
}
export {};
//# sourceMappingURL=DialogManager.d.ts.map

View File

@@ -0,0 +1,42 @@
import{dialogManager}from"../System/DialogManager.js";
/**
* Change visibility of dialog and set its DialogType when showing.
* @param dialogOwner Caller Id to prevent overwriting forreign dialogs
* @param bVisibility Toggling visiblity of dialog
* @param dialogType Type of dialog
* @param options Options
* @returns returns false if the dialog could not be opened
* @preserve (Part of the public API)
*/export function showDialog(dialogOwner,bVisibility,dialogType,options){return dialogManager.showDialog(dialogOwner,bVisibility,dialogType,options)}
/**
* Changes the output content of the Dialog to a new value.
* Will always target DialogType.Overlay. Use updateTextEx if you want to target a specific DialogType.
* The default DialogSeverity is Info.
* @param dialogOwner Caller Id to prevent overwriting forreign dialogs
* @param html Content to show
* @param severity Severity for the content.
* @returns Success of the text update
* @preserve (Part of the public API)
*/export function updateText(dialogOwner,html,severity=DialogSeverity.Info){return dialogManager.updateText(dialogOwner,html,severity)}
/**
* Changes the output content of the Dialog to a new value.
* The default DialogType is Overlay.
* The default DialogSeverity is Info.
* @param dialogOwner Caller Id to prevent overwriting forreign dialogs
* @param html Text to display
* @param options options
* @param options.dialogType Overlay or watermark
* @param options.severity severity of the text
* @param options.buttonReload If true a reload button is added
* @returns Success of the text update
* @preserve (Part of the public API)
*/export function updateTextEx(dialogOwner,html,options){return dialogManager.updateTextEx(dialogOwner,html,options)}
/**
* Returns the current dialog owner or null.
* @preserve (Part of the public API)
*/export function getDialogOwner(){return dialogManager.getDialogOwner()}
/**
* Builds a formatted message of hierarchical error objects for use in dialog.
* @param error Error object to show nicely
* @preserve (Part of the public API)
*/export function buildMessage(error){let __buildMessage=function(error,level){if(!error)return"";let res="",space="&nbsp;&nbsp;";for(let i=0,ii=level;i<ii;i++)space+="&nbsp;&nbsp;";if(error.code&&(res+="Code: "+error.code+"/0x"+error.code.toString(16)),error.message&&(res+=", Message: "+error.message),error.reason&&(res+="<br />"+space+"Reason: "+error.reason),error.domain&&(res+="<br />"+space+"Domain: "+error.domain),void 0!==error.errors&&error.errors.length){res+="<br />"+space+"as result of: ";for(let i=0,ii=error.errors.length;i<ii;i++)res+=__buildMessage(error.errors[i],level+1)}return res};return __buildMessage(error,0)}export var DialogSeverity;!function(DialogSeverity){DialogSeverity[DialogSeverity.Info=0]="Info",DialogSeverity[DialogSeverity.Warning=1]="Warning",DialogSeverity[DialogSeverity.Error=2]="Error"}(DialogSeverity||(DialogSeverity={}));export var DialogType;!function(DialogType){DialogType[DialogType.Overlay=1]="Overlay",DialogType[DialogType.Watermark=2]="Watermark"}(DialogType||(DialogType={}));TcHmi.DialogManager={showDialog,updateText,updateTextEx,getDialogOwner,buildMessage,DialogType,DialogSeverity};

View File

@@ -0,0 +1,45 @@
/**
* Adds an message to current error pane.
* @param id Identifier for the message. Must be unique.
* @param content Text content of the message
* @param type severity of the message
*/
export declare function add(id: string, content: string, type: MessageType): void;
/**
* Removes an message from current error pane.
* @param id Identifier for the message. Must be unique.
*/
export declare function remove(id: string): void;
export interface Message {
identifier: string;
type: MessageType;
content: string;
}
export declare enum MessageType {
Message = 0,
Error = 1,
Warning = 2,
Information = 3
}
declare const _add: typeof add;
declare const _remove: typeof remove;
declare const _MessageType: typeof MessageType;
type tMessage = Message;
type tMessageType = MessageType;
declare global {
namespace TcHmi.Engineering {
/**
* Provides resources for interaction with the Visual Studio error pane.
* @preserve (Part of the public API)
*/
namespace ErrorPane {
const add: typeof _add;
const remove: typeof _remove;
const MessageType: typeof _MessageType;
type Message = tMessage;
type MessageType = tMessageType;
}
}
}
export {};
//# sourceMappingURL=Engineering.ErrorPane.d.ts.map

View File

@@ -0,0 +1 @@
export function add(id,content,type){TCHMI_DESIGNER&&import("../System/Engineering/ErrorPane.js").then(module=>{module.errorPane.add(id,content,type)}).catch(ex=>{TcHmi.Log.errorEx("Loading TcHmi.ErrorPane.add designer service failed:",ex)})}export function remove(id){TCHMI_DESIGNER&&import("../System/Engineering/ErrorPane.js").then(module=>{module.errorPane.remove(id)}).catch(ex=>{TcHmi.Log.errorEx("Loading TcHmi.ErrorPane.remove designer service failed:",ex)})}export var MessageType;!function(MessageType){MessageType[MessageType.Message=0]="Message",MessageType[MessageType.Error=1]="Error",MessageType[MessageType.Warning=2]="Warning",MessageType[MessageType.Information=3]="Information"}(MessageType||(MessageType={}));TcHmi.Engineering??={},TcHmi.Engineering.ErrorPane={add,remove,MessageType};

View File

@@ -0,0 +1,85 @@
/**
* Returns the dynamic framework base path.
* For example: 'Beckhoff.TwinCAT.HMI.Framework'
* @preserve (Part of the public API)
*/
export declare function getBasePath(): string;
/**
* Returns the dynamic base path of a control.
* For example: 'Beckhoff.TwinCAT.HMI.Controls/TcHmiButton'
* @preserve (Part of the public API)
* @param type Control type name
*/
export declare function getControlBasePath(type: string): string | null;
/**
* Returns the dynamic base path of a control.
* For example: 'Beckhoff.TwinCAT.HMI.Controls/TcHmiButton'
* @preserve (Part of the public API)
* @param control TcHmi Control reference
*/
export declare function getControlBasePathEx(control: TcHmi.Controls.System.baseTcHmiControl): string | null;
/**
* Returns the dynamic base path of a function.
* @preserve (Part of the public API)
* @param name Function name
*/
export declare function getFunctionBasePath(name: string): string | null;
/**
* Returns the dynamic base path of a package.
* @preserve (Part of the public API)
* @param name Package name
*/
export declare function getPackageBasePath(name: string): string | null;
/**
* Returns an object describing if the current browser is a TcEmbeddedBrowser and what its capabilities are.
*/
export declare function getBrowserCapabilities(): BrowserCapabilities;
/**
* Returns the host base uri (with no pathname) which under normal circumstances is in the form "https://192.0.2.1:2020"
* but can for example be "https://192.0.2.1/TcHmiSrv" in reverse proxy scenarios.
* In this example http traffic to the external url "https://192.0.2.1/TcHmiSrv" will perhaps be sent to "https://192.0.2.1:2020".
* If you have to call static urls of the hmi server which are always host related (like "/Config") you should call this function and prepend the result.
* Example: let configUri = tchmi_path(TcHmi.Environment.getHostBaseUri() + '/Config');
*/
export declare function getHostBaseUri(): string;
/**
* path+query+hash of the hmi but as seen from the hmi server.
* Could be different for reverse proxy scenarios.
* Must be used for populating server redirects like /Logout?Location={1}
*/
export declare function getServerSidePathAndQuery(): string;
export interface BrowserCapabilities {
isCefSharp: boolean;
isTcEmbeddedBrowser: boolean;
supportsDownload: boolean;
}
declare const _getBasePath: typeof getBasePath;
declare const _getControlBasePath: typeof getControlBasePath;
declare const _getControlBasePathEx: typeof getControlBasePathEx;
declare const _getFunctionBasePath: typeof getFunctionBasePath;
declare const _getPackageBasePath: typeof getPackageBasePath;
declare const _getBrowserCapabilities: typeof getBrowserCapabilities;
declare const _getHostBaseUri: typeof getHostBaseUri;
declare const _getServerSidePathAndQuery: typeof getServerSidePathAndQuery;
type tBrowserCapabilities = BrowserCapabilities;
declare global {
namespace TcHmi {
/**
* Provides environment information.
* @preserve (Part of the public API)
*/
namespace Environment {
const getBasePath: typeof _getBasePath;
const getControlBasePath: typeof _getControlBasePath;
const getControlBasePathEx: typeof _getControlBasePathEx;
const getFunctionBasePath: typeof _getFunctionBasePath;
const getPackageBasePath: typeof _getPackageBasePath;
const getBrowserCapabilities: typeof _getBrowserCapabilities;
const getHostBaseUri: typeof _getHostBaseUri;
const getServerSidePathAndQuery: typeof _getServerSidePathAndQuery;
type BrowserCapabilities = tBrowserCapabilities;
}
}
}
export {};
//# sourceMappingURL=Environment.d.ts.map

View File

@@ -0,0 +1,28 @@
import{hostBaseUri,serverSidePathAndQuery,Data,config}from"../System/System.js";let __browserCapabilities={isCefSharp:"CefSharp"in window,isTcEmbeddedBrowser:!1,supportsDownload:!0};
/**
* Returns the dynamic framework base path.
* For example: 'Beckhoff.TwinCAT.HMI.Framework'
* @preserve (Part of the public API)
*/export function getBasePath(){return tchmi_path(config.basePath)}
/**
* Returns the dynamic base path of a control.
* For example: 'Beckhoff.TwinCAT.HMI.Controls/TcHmiButton'
* @preserve (Part of the public API)
* @param type Control type name
*/export function getControlBasePath(type){let module=Data.Modules.controls.map.get(type);return module&&module.error===TcHmi.Errors.NONE&&module.package&&"string"==typeof module.package.basePath&&module.manifestData&&"string"==typeof module.manifestData.basePath?tchmi_path(module.package.basePath+"/"+module.manifestData.basePath):null}
/**
* Returns the dynamic base path of a control.
* For example: 'Beckhoff.TwinCAT.HMI.Controls/TcHmiButton'
* @preserve (Part of the public API)
* @param control TcHmi Control reference
*/export function getControlBasePathEx(control){return control?getControlBasePath(control.getType()):null}
/**
* Returns the dynamic base path of a function.
* @preserve (Part of the public API)
* @param name Function name
*/export function getFunctionBasePath(name){let module=Data.Modules.functions.map.get(name);return module&&module.error===TcHmi.Errors.NONE&&module.package&&"string"==typeof module.package.basePath&&module.manifestData&&"string"==typeof module.manifestData.basePath?tchmi_path(module.package.basePath+"/"+module.manifestData.basePath):null}
/**
* Returns the dynamic base path of a package.
* @preserve (Part of the public API)
* @param name Package name
*/export function getPackageBasePath(name){let packageInfo=Data.packages.get(name);return packageInfo&&"string"==typeof packageInfo.basePath?tchmi_path(packageInfo.basePath):null}export function getBrowserCapabilities(){return __browserCapabilities}export function getHostBaseUri(){return hostBaseUri}export function getServerSidePathAndQuery(){return serverSidePathAndQuery}!async function(){if(!("CefSharp"in window))return void(__browserCapabilities={isCefSharp:!1,isTcEmbeddedBrowser:!1,supportsDownload:!0});const cefSharpWindow=window;if(!cefSharpWindow.tcEmbeddedBrowserGlobals)try{await cefSharpWindow.CefSharp.BindObjectAsync("tcEmbeddedBrowserGlobals")}catch(ex){return}__browserCapabilities={isCefSharp:!0,isTcEmbeddedBrowser:!!cefSharpWindow.tcEmbeddedBrowserGlobals,supportsDownload:cefSharpWindow.tcEmbeddedBrowserGlobals?.supportsDownload??!0}}();TcHmi.Environment={getBasePath,getControlBasePath,getControlBasePathEx,getFunctionBasePath,getPackageBasePath,getBrowserCapabilities,getHostBaseUri,getServerSidePathAndQuery};

View File

@@ -0,0 +1,134 @@
/**
* Provides functions for managing events.
* @preserve (Part of the public API)
*/
export declare class EventProvider {
/**
* Register a callback to an event name.
* If the name is a symbol expression the callback will be initially called when
* there is a symbol with this name.
* Returns a destroy function to remove the registration.
* @param name Name of the event.
* @param callback Callback which will be called
* @param options Data an event can be given while registration.
* @param registrationData Additional data and options for the event registration.
* @param registrationData.ctx Context to be used when resolving %ctx% symbols.
* @returns Destroy function which cleans up/unregisters
* @preserve (Part of the public API)
*/
static register(name: string, callback: (this: void, e: EventProvider.Event, ...args: any[]) => void, options?: any, registrationData?: {
ctx?: TcHmi.Context<any>;
}): TcHmi.DestroyFunction;
/**
* Calls all registered callbacks related to an event name.
* @param name Name of the event.
* @param args Optional parameter(s) which will be transfered to the callbacks
* @preserve (Part of the public API)
*/
static raise(name: string, ...args: any[]): void;
/**
* Calls the callback of a specific event registration.
* @param event Event object
* @param args optional parameter(s) which will be transfered to the callbacks
* @preserve (Part of the public API)
*/
static raiseEx(event: EventProvider.IEventEntry, ...args: any[]): void;
/**
* Watch for event registrations.
* @param name Name of the event to watch
* @param callback Callback which will be called
*/
static watchEventRegistration(name: string, callback: (data: EventProvider.IEventRegResultObject) => void): TcHmi.DestroyFunction;
/**
* Check if event is registered.
* @param name Name of the event
*/
static has(name: string): boolean;
/**
* Event registration count
* @param name Name of the event
*/
static count(name: string): number;
/**
* Registers an event on DOM elements and returns an easy to use DestroyFunction to remove the event later.
* @param element The element or elements to register the event on.
* @param type The type of event to register.
* @param listener The callback function that will handle the event.
* @param options Options for the event registrations. Defaults to { passive: true }.
*/
static registerDomEvent<K extends keyof HTMLElementEventMap>(element: Element | Document | Window | Iterable<Element>, type: K, listener: (this: EventTarget, event: HTMLElementEventMap[K]) => void, options?: AddEventListenerOptions): TcHmi.DestroyFunction;
/**
* Registers an event on DOM elements and returns an easy to use DestroyFunction to remove the event later.
* @param element The element or elements to register the event on.
* @param type The type of event to register.
* @param listener The callback function that will handle the event.
* @param options Options for the event registrations. Defaults to { passive: true }.
*/
static registerDomEvent(element: Element | Document | Window | Iterable<Element>, type: string, listener: (this: EventTarget, event: globalThis.Event) => void, options?: AddEventListenerOptions): TcHmi.DestroyFunction;
}
export declare namespace EventProvider {
enum EventRegWatchType {
REGISTER = 100,
DESTROY = 200
}
interface Event extends TcHmi.EventContext {
/** Function to unregister from this event. */
destroy: TcHmi.DestroyFunction;
}
interface IEventEntry {
/** Id for internal event management. */
id: number;
/** Name of the event. */
name: string;
callback: (this: void, e: Event, ...data: any[]) => void;
/** Data an event can be given while registration. */
options?: any;
/** Additional data and options for the event registration. */
registrationData?: {
/** Context to be used when resolving %ctx% symbols. */
ctx?: TcHmi.Context<any>;
};
/** Function to unregister from an event. */
destroy: TcHmi.DestroyFunction | null;
}
interface IEventRegResultObject extends TcHmi.IResultObject {
type: EventRegWatchType;
event: IEventEntry;
}
}
declare const _register: typeof EventProvider.register;
declare const _raise: typeof EventProvider.raise;
declare const _raiseEx: typeof EventProvider.raiseEx;
declare const _watchEventRegistration: typeof EventProvider.watchEventRegistration;
declare const _has: typeof EventProvider.has;
declare const _count: typeof EventProvider.count;
declare const _registerDomEvent: typeof EventProvider.registerDomEvent;
declare const _EventRegWatchType: typeof EventProvider.EventRegWatchType;
type tEvent = EventProvider.Event;
type tIEventRegResultObject = EventProvider.IEventRegResultObject;
type tIEventEntry = EventProvider.IEventEntry;
type tEventRegWatchType = EventProvider.EventRegWatchType;
declare global {
namespace TcHmi {
/**
* Provides functions for managing events.
* @preserve (Part of the public API)
*/
namespace EventProvider {
const register: typeof _register;
const raise: typeof _raise;
const raiseEx: typeof _raiseEx;
const watchEventRegistration: typeof _watchEventRegistration;
const has: typeof _has;
const count: typeof _count;
const registerDomEvent: typeof _registerDomEvent;
type Event = tEvent;
type IEventRegResultObject = tIEventRegResultObject;
type IEventEntry = tIEventEntry;
const EventRegWatchType: typeof _EventRegWatchType;
type EventRegWatchType = tEventRegWatchType;
}
}
}
export {};
//# sourceMappingURL=EventProvider.d.ts.map

View File

@@ -0,0 +1,31 @@
/**
* Provides functions for managing events.
* @preserve (Part of the public API)
*/
export class EventProvider{static __events=new Map;static __internalEventId=0;
/**
* Register a callback to an event name.
* If the name is a symbol expression the callback will be initially called when
* there is a symbol with this name.
* Returns a destroy function to remove the registration.
* @param name Name of the event.
* @param callback Callback which will be called
* @param options Data an event can be given while registration.
* @param registrationData Additional data and options for the event registration.
* @param registrationData.ctx Context to be used when resolving %ctx% symbols.
* @returns Destroy function which cleans up/unregisters
* @preserve (Part of the public API)
*/
static register(name,callback,options,registrationData){let destroyWatch,internalEventId=0,registeredName="";const destroy=()=>{(()=>{if(!internalEventId||!registeredName)return;destroyWatch&&(destroyWatch(),destroyWatch=void 0);const event=EventProvider.__events.get(registeredName),entry=event?.get(internalEventId);event&&(event.delete(internalEventId),0===event.size&&EventProvider.__events.delete(registeredName)),EventProvider.raise(`System.EventProvider.onDestroyedCallback<${registeredName}>`,entry),EventProvider.raise("System.EventProvider.onDestroyedCallback",entry),registeredName=""})()};return(name=>{internalEventId=++EventProvider.__internalEventId,registeredName=name;let event=EventProvider.__events.get(name);void 0===event&&(event=new Map,EventProvider.__events.set(name,event));const entry={id:internalEventId,name,callback,options,registrationData,destroy};event.set(internalEventId,entry),EventProvider.raise(`System.EventProvider.onRegisterCallback<${name}>`,entry),EventProvider.raise("System.EventProvider.onRegisterCallback",entry)})(name),destroy}
/**
* Calls all registered callbacks related to an event name.
* @param name Name of the event.
* @param args Optional parameter(s) which will be transfered to the callbacks
* @preserve (Part of the public API)
*/static raise(name,...args){const eventMap=EventProvider.__events.get(name);if(eventMap)for(const event of eventMap.values())TcHmi.Callback.callSafeEx(event.callback,null,{name:event.name,destroy:event.destroy??function(){}},...args)}
/**
* Calls the callback of a specific event registration.
* @param event Event object
* @param args optional parameter(s) which will be transfered to the callbacks
* @preserve (Part of the public API)
*/static raiseEx(event,...args){TcHmi.Callback.callSafeEx(event.callback,null,{name:event.name,destroy:event.destroy??function(){}},...args)}static watchEventRegistration(name,callback){let destroyEventOnDestroyCallback=null;const _register=function(event){destroyEventOnDestroyCallback=EventProvider.register(`System.EventProvider.onDestroyedCallback<${name}>`,function(e,event){TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,type:EventProvider.EventRegWatchType.DESTROY,event}),destroyEventOnDestroyCallback?(destroyEventOnDestroyCallback(),destroyEventOnDestroyCallback=null):e.destroy()}),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,type:EventProvider.EventRegWatchType.REGISTER,event})};let eventMap=EventProvider.__events.get(name);eventMap&&eventMap.forEach(_register);let destroyEventOnRegisterCallback=EventProvider.register(`System.EventProvider.onRegisterCallback<${name}>`,function(_e,event){_register(event)});return function(){destroyEventOnRegisterCallback&&(destroyEventOnRegisterCallback(),destroyEventOnRegisterCallback=null),destroyEventOnDestroyCallback&&(destroyEventOnDestroyCallback(),destroyEventOnDestroyCallback=null)}}static has(name){return EventProvider.__events.has(name)}static count(name){const events=EventProvider.__events.get(name);return events?.size??0}static registerDomEvent(element,type,listener,options){options=options?{passive:!0,...options}:{passive:!0};const elements=window.Symbol.iterator in element?element:[element];for(const element of elements)element.addEventListener(type,listener,options);return()=>{for(const element of elements)element.removeEventListener(type,listener,options)}}}!function(EventProvider){let EventRegWatchType;!function(EventRegWatchType){EventRegWatchType[EventRegWatchType.REGISTER=100]="REGISTER",EventRegWatchType[EventRegWatchType.DESTROY=200]="DESTROY"}(EventRegWatchType=EventProvider.EventRegWatchType||(EventProvider.EventRegWatchType={}))}(EventProvider||(EventProvider={}));EventProvider.register,EventProvider.raise,EventProvider.raiseEx,EventProvider.watchEventRegistration,EventProvider.has,EventProvider.count,EventProvider.registerDomEvent,EventProvider.EventRegWatchType;TcHmi.EventProvider=EventProvider;

View File

@@ -0,0 +1,178 @@
/**
* Represents a TcHmi Error.
*/
export declare class Exception extends Error {
protected __details: TcHmi.SelectableRequired<TcHmi.IErrorDetails, 'message'>;
/**
* Creates a new Exception.
* @param details The error details for this exception.
*/
constructor(details: TcHmi.IErrorDetails);
/**
* Creates a new Exception.
* @param code The error code.
* @param reason The reason for the error in user-friendly plain text.
* @param domain The domain the error originates from.
* @param exception Underlying native JavaScript error, if there is one.
*/
constructor(code: Exclude<TcHmi.Errors, TcHmi.Errors.NONE>, reason: string, domain: string, exception?: Error);
/**
* Creates a new Exception.
* @param code The error code.
* @param reason The reason for the error in user-friendly plain text.
* @param domain The domain the error originates from.
* @param errors Underlying TcHmi errors, if there are any.
*/
constructor(code: Exclude<TcHmi.Errors, TcHmi.Errors.NONE>, reason: string, domain: string, errors?: TcHmi.IErrorDetails[]);
/**
* Creates a new Exception.
* @param code The error code.
* @param reason The reason for the error in user-friendly plain text.
* @param domain The domain the error originates from.
* @param exception Underlying native JavaScript error, if there is one.
* @param errors Underlying TcHmi errors, if there are any.
*/
constructor(code: Exclude<TcHmi.Errors, TcHmi.Errors.NONE>, reason: string, domain: string, exception?: Error, errors?: TcHmi.IErrorDetails[]);
/**
* Gets the error code.
*/
get code(): TcHmi.Errors | number;
/**
* Gets the string name of the code in the Errors enum.
*/
get message(): string;
/**
* Gets the reason for the error in user-friendly plain text.
*/
get reason(): string | undefined;
/**
* Gets the domain the error originates from.
*/
get domain(): string | undefined;
/**
* Gets the underlying native JavaScript error, if there is one.
*/
get exception(): Error | undefined;
/**
* Gets the underlying TcHmi errors, if there are any.
*/
get errors(): TcHmi.IErrorDetails[] | undefined;
/**
* Gets the error details.
*/
get details(): TcHmi.IErrorDetails;
/**
* Adds underlying TcHmi errors.
* @param errors The errors to add.
*/
pushSubErrors(...errors: TcHmi.IErrorDetails[]): number;
/**
* Builds a formatted message of the Exception.
*/
buildMessage(): string;
/**
* Logs the Exception in the console with information about the caller.
* @param callerInfo Information about the caller.
* @param message An optional message to add further context.
*/
log(callerInfo: ControlInfo | FrameworkInfo | FunctionInfo, message?: string): void;
/**
* Logs the Exception in the console with information about the caller.
* @param callerInfo Information about the caller.
* @param message An optional message to add further context.
*/
log<T extends string>(callerInfo: LogInfo<T extends 'Control' | 'Framework' | 'Function' ? never : T>, message?: string): void;
/**
* Logs the Exception in the console with information about the caller.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs
* from the control type.
* @param message An optional message to add further context.
* @param optionalParameters Optional parameters that are appended to the logged message.
*/
log(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, message?: string, ...optionalParameters: any[]): void;
/**
* Logs the Exception in the console with information about the caller.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs
* from the control type.
* @param additionalInfo Additional custom context information. The key and value of this object will be shown
* in output. {Attribute: "Top"} will add "Attribute=Top" into the log.
* @param message An optional message to add further context.
* @param optionalParameters Optional parameters that are appended to the logged message.
*/
log(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, additionalInfo: TcHmi.Log.Controls.AdditionalInfo, message?: string, ...optionalParameters: any[]): void;
}
/**
* Info to be logged in front of the error message.
*/
export interface LogInfo<T extends string> {
/**
* The type of source of the log() call. Usually 'Control', 'Framework' or 'Function' but can also be a
* custom value.
*/
Source: T;
/**
* Custom information to log. The property name should start with a capital letter.
*/
[InfoName: string]: string | number | boolean;
}
/**
* Info about a control to be logged in front of the error message. In addition to the required properties,
* further custom information can also be added.
*/
export interface ControlInfo extends LogInfo<'Control'> {
/**
* The return value of getType(). Usually this is set in the second place of the ControlInfo object.
*/
Module: string;
/**
* The private #tchmiFQN (fully qualified name). Usually this is set in the third place of the ControlInfo
* object.
*/
Origin: string;
/**
* The return value of getId(). Usually this is set in the fourth place of the ControlInfo object.
*/
Id: string;
}
/**
* Info about a framework API to be logged in front of the error message. In addition to the required
* properties, further custom information can also be added.
*/
export interface FrameworkInfo extends LogInfo<'Framework'> {
/**
* The name and namespace of the API.
*/
Module: string;
}
/**
* Info about a function to be logged in front of the error message. In addition to the required properties,
* further custom information can also be added.
*/
export interface FunctionInfo extends LogInfo<'Function'> {
/**
* The name and namespace of the function.
*/
Module: string;
}
declare const _Exception: typeof Exception;
type tException = Exception;
type tLogInfo<T extends string> = LogInfo<T>;
type tControlInfo = ControlInfo;
type tFrameworkInfo = FrameworkInfo;
type tFunctionInfo = FunctionInfo;
declare global {
namespace TcHmi {
let Exception: typeof _Exception;
type Exception = tException;
namespace Exception {
type LogInfo<T extends string> = tLogInfo<T>;
type ControlInfo = tControlInfo;
type FrameworkInfo = tFrameworkInfo;
type FunctionInfo = tFunctionInfo;
}
}
}
export {};
//# sourceMappingURL=Exception.d.ts.map

View File

@@ -0,0 +1 @@
export class Exception extends Error{__details;constructor(detailsOrCode,reason,domain,exceptionOrErrors,errors){const message=("object"==typeof detailsOrCode?TcHmi.Errors[detailsOrCode.code]??detailsOrCode.message:TcHmi.Errors[detailsOrCode])??TcHmi.Errors[TcHmi.Errors.ERROR];super("object"==typeof detailsOrCode?detailsOrCode.reason??message:reason??message),super.message=message,Object.defineProperty(this,"message",{writable:!1}),this.__details="object"==typeof detailsOrCode?{...detailsOrCode,message}:{code:detailsOrCode,message,reason,domain,exception:exceptionOrErrors instanceof Error?exceptionOrErrors:void 0,errors:exceptionOrErrors instanceof Error?errors:exceptionOrErrors}}get code(){return this.__details.code}get message(){return this.__details.message}get reason(){return this.__details.reason}get domain(){return this.__details.domain}get exception(){return this.__details.exception}get errors(){return this.__details.errors}get details(){return this.__details}pushSubErrors(...errors){return this.__details.errors||(this.__details.errors=[]),this.__details.errors.push(...errors)}buildMessage(){return TcHmi.Log.buildMessage(this.__details)}log(callerInfoOrControl,messageOrOrigin,messageOrAdditionalInfo,...optionalParameters){if(TCHMI_CONSOLE_LOG_LEVEL<1&&!TcHmi.Log.Force)return;if(callerInfoOrControl instanceof TcHmi.Controls.System.baseTcHmiControl){const control=callerInfoOrControl,origin=messageOrOrigin,additionalInfo=messageOrAdditionalInfo&&"object"==typeof messageOrAdditionalInfo?messageOrAdditionalInfo:null;optionalParameters=[...optionalParameters];let message=(additionalInfo?optionalParameters.shift():messageOrAdditionalInfo)??"";return message=`${message?message+" ":""}${this.buildMessage()}`,void(additionalInfo?TcHmi.Log.Controls.error(control,origin,additionalInfo,message,...optionalParameters):TcHmi.Log.Controls.error(control,origin,message,...optionalParameters))}const callerInfo={...callerInfoOrControl},message=messageOrOrigin;"Control"===callerInfo.Source&&callerInfo.Module===callerInfo.Origin&&delete callerInfo.Origin,TcHmi.Log.errorEx(`[${Array.from(Object.entries(callerInfo)).map(([name,info])=>`${name}=${info}`).join(", ")}] ${message?message+" ":""}${this.buildMessage()}`)}}TcHmi.Exception=Exception;

View File

@@ -0,0 +1,258 @@
export declare enum FileStatus {
Pending = 0,
Uploading = 1,
Finished = 2,
Canceled = 3
}
export declare enum ChunkType {
/** File is sent as a whole. */
Disabled = 0,
/** Beginning of a file */
First = 1,
/** Middle part of a file (any number of times) */
Intermediate = 2,
/** End of a file */
Last = 3
}
/**
* Uploads files to the server. Files are uploaded sequentially and divided into chunks if necessary.
*/
export declare class FileUploader {
protected static __queue: QueuedFile[];
protected static __current: QueuedFile | null;
protected static __working: boolean;
protected static __preparedChunks: Promise<Map<string, Chunk> | null> | null;
protected static __chunkSize: null | number;
protected static __subscribedToChunkSize: boolean;
protected static __chunkSizeSubscriptionError: ProgressResultFail | null;
protected __queueTimeoutId: number;
protected readonly __options: TcHmi.SelectableRequired<Options, 'symbol'>;
/**
* Create a new FileUploader instance.
* @param options Options for uploading files with this FileUploader instance.
* @param options.domain The domain to upload files to. If not specified, files will be uploaded directly to the
* TcHmiSrv domain.
* @param options.symbol The symbol to upload files to. This symbol must take a writeValue containing the
* properties fileName (full path and name of the file, delimited by forward slashes), data (base64 encoded file
* contents) and chunkType (value of the enum FileUploader.ChunkType). Defaults to 'Upload'.
* @param options.chunkSize The chunk size to use while uploading. Defaults to the chunk size specified in the
* server config if not given, or if greater than the server config chunk size.
*/
constructor(options?: Options);
/**
* Queue a file for upload. Queued files will be managed in a single queue across all instances.
* If there is already a file with the same path in the queue, the already queued file will be canceled.
* The returned Promise will resolve when the file upload finishes, is canceled, or encounters an error.
* @param path The path to upload to.
* @param file The file to upload.
* @param options Options for this file upload.
* @param options.progressCallback A callback function that will be called with the upload progress or any
* errors whenever a chunk of the file was uploaded.
* @param options.additionalProperties Additional properties that are set in the write value. Properties named
* fileName, data or chunkType are reserved for use by the file uploader and will be ignored.
*/
queue(path: string, file: Blob, options?: QueueOptions): Promise<ProgressResultSuccess>;
/**
* Cancel the upload of a queued file. If an upload is canceled after it has already started, the upload is
* stopped, but the file fragment will remain on the server. It is the responsibility of the caller to delete it.
* @param path The path of the file that should be cancelled.
*/
cancel(path: string): Promise<boolean>;
/**
* The domain to upload files to. If not specified, files will be uploaded directly to the TcHmiSrv domain.
*/
set domain(value: string | undefined | null);
/**
* The domain to upload files to. If not specified, files will be uploaded directly to the TcHmiSrv domain.
*/
get domain(): typeof this.__options.domain;
/**
* The symbol to upload files to. This symbol must take a writeValue containing the properties fileName (full
* path and name of the file, delimited by forward slashes), data (base64 encoded file contents) and chunkType
* (value of the enum FileUploader.ChunkType). Defaults to 'Upload'.
*/
set symbol(value: string | undefined | null);
/**
* The symbol to upload files to. This symbol must take a writeValue containing the properties fileName (full
* path and name of the file, delimited by forward slashes), data (base64 encoded file contents) and chunkType
* (value of the enum FileUploader.ChunkType). Defaults to 'Upload'.
*/
get symbol(): typeof this.__options.symbol;
/**
* The chunk size to use while uploading. Defaults to the chunk size specified in the server config if not
* given, or if greater than the server config chunk size.
*/
set chunkSize(value: number | undefined | null);
/**
* The chunk size to use while uploading. Defaults to the chunk size specified in the server config if not
* given, or if greater than the server config chunk size.
*/
get chunkSize(): typeof this.__options.chunkSize;
/**
* Reads the file data as a base64 encoded string.
* @param file The file to read.
* @param offset The offset from which to start reading. Leave empty to read the whole file.
* @param limit How many bytes to read. Leave empty to read to the end of the file.
*/
static readFileAsBase64(file: Blob, offset?: number, limit?: number): Promise<string>;
/**
* Opens a dialog that allows the user to select one or more files from their local file system. Returns a
* promise that resolves to null if the file dialog is canceled and to a FileList if the user selects files.
* @param options Options for the file dialog.
* @param options.multiple Set to true to allow selecting more than one file. Defaults to false.
* @param options.acceptedFileTypes An array of unique file type specifiers. A unique file type specifier can be
* a case-insensitive filename extension starting with a dot, a valid MIME type string, or one of the strings
* 'audio/*', 'image/*' or 'video/*'.
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers.
* Leave empty to allow any file type to be selected.
*/
static openFileDialog(options?: FileDialogOptions): Promise<FileList | null>;
/**
* Split the files in the queue into chunks and upload them.
*/
protected static __workQueue(): Promise<void>;
/**
* Dequeue the first item, read the file and prepare it for upload. If the chunkSize is not yet reached, further
* files will be dequeued and also uploaded.
*/
protected static __createChunks(): Promise<Map<string, Chunk> | null>;
/**
* Upload the given chunks.
* @param chunks The chunks to upload.
*/
protected static __upload(chunks: Map<string, {
file: QueuedFile;
data: string;
type: ChunkType;
}>): void;
/**
* Subscribe to the TcHmiSrv.Config::CHUNKSIZE symbol
*/
protected static __subscribeChunkSize(): void;
static FileStatus: typeof FileStatus;
static ChunkType: typeof ChunkType;
}
export declare const openFileDialog: typeof FileUploader.openFileDialog;
export interface Options {
/**
* The domain to upload files to. If not specified, files will be uploaded directly to the TcHmiSrv domain.
*/
domain?: string;
/**
* The symbol to upload files to. This symbol must take a writeValue containing the properties fileName
* (full path and name of the file, delimited by forward slashes), data (base64 encoded file contents) and
* chunkType (value of the enum FileUploader.ChunkType). Defaults to 'Upload'.
*/
symbol?: string;
/**
* The chunk size to use while uploading. Defaults to the chunk size specified in the server config if not
* given, or if greater than the server config chunk size.
*/
chunkSize?: number;
}
export interface QueueOptions {
/**
* A callback function that will be called with the upload progress or any errors whenever a chunk of the
* file was uploaded.
*/
progressCallback?: ProgressCallback;
/**
* Additional properties that are set in the write value. Properties named fileName, data or chunkType are
* reserved for use by the file uploader and will be ignored.
*/
additionalProperties?: TcHmi.Dictionary<any>;
}
export interface QueuedFile {
file: Blob;
path: string;
domainAndSymbol: string;
additionalProperties?: QueueOptions['additionalProperties'];
chunkSize?: number;
offset: number;
status: FileStatus;
progressCallback: ProgressCallback;
}
export type ProgressCallback = (result: ProgressResult) => void;
export interface ProgressResultSuccess extends TcHmi.IResultObject {
error: TcHmi.Errors.NONE;
uploadedBytes: number;
totalBytes: number;
status: FileStatus;
}
export interface ProgressResultFail extends TcHmi.IResultObject {
error: Exclude<TcHmi.Errors, TcHmi.Errors.NONE>;
details: TcHmi.SelectableRequired<TcHmi.IErrorDetails, 'message' | 'reason' | 'domain'>;
}
export type ProgressResult = ProgressResultSuccess | ProgressResultFail;
export interface Chunk {
file: QueuedFile;
data: string;
type: ChunkType;
}
/** Common interface for all/most upload symbols */
export interface UploadWriteValue {
/** Identifier for the uploaded file. */
fileName: string;
/** Data as base64. Not used with isDirectory. */
data?: string;
/**
* The request should create a directory and not a file.
* Not supported by all extensions.
*/
isDirectory?: boolean;
/** Not supported by all extensions. */
checkSum?: string;
/** Chunktype: 0=file is sent as a whole, 1=beginning of a file, 2=middle part of a file (any number of times), 3=end of a file */
chunkType?: ChunkType;
}
/**
* Options for opening a file dialog.
*/
export interface FileDialogOptions {
/**
* Set to true to allow selecting more than one file. Defaults to false.
*/
multiple?: boolean;
/**
* An array of unique file type specifiers. A unique file type specifier can be a case-insensitive filename
* extension starting with a dot, a valid MIME type string, or one of the strings 'audio/*', 'image/*' or
* 'video/*'.
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers.
* Leave empty to allow any file type to be selected.
*/
acceptedFileTypes?: string[];
}
declare const _FileUploader: typeof FileUploader;
type tFileUploader = FileUploader;
type tFileStatus = FileStatus;
type tChunkType = ChunkType;
type tOptions = Options;
type tQueuedFile = QueuedFile;
type tProgressCallback = ProgressCallback;
type tProgressResult = ProgressResult;
type tProgressResultSuccess = ProgressResultSuccess;
type tProgressResultFail = ProgressResultFail;
type tChunk = Chunk;
type tUploadWriteValue = UploadWriteValue;
type tFileDialogOptions = FileDialogOptions;
declare global {
namespace TcHmi {
let FileUploader: typeof _FileUploader;
type FileUploader = tFileUploader;
namespace FileUploader {
type FileStatus = tFileStatus;
type ChunkType = tChunkType;
type Options = tOptions;
type QueuedFile = tQueuedFile;
type ProgressCallback = tProgressCallback;
type ProgressResult = tProgressResult;
type ProgressResultSuccess = tProgressResultSuccess;
type ProgressResultFail = tProgressResultFail;
type Chunk = tChunk;
type UploadWriteValue = tUploadWriteValue;
type FileDialogOptions = tFileDialogOptions;
}
}
}
export {};
//# sourceMappingURL=FileUploader.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,213 @@
/**
* The strategy to use while recursing into a tree structure.
*/
export declare enum Strategy {
/**
* Children will be evaluated first. If a child matches the filter, its parent will also match the filter.
*/
DepthFirst = 0,
/**
* Children will only be evaluated after the parent itself was tested. If a parent item does not match the
* filter, none of its children will match.
*/
BreadthFirst = 1
}
/**
* Allows users to build filters and filter data with them.
*/
export declare class FilterInstance<T = any> {
private __filter;
private __schema;
private __parsedFilter;
private __wrapInBrackets;
/**
* Creates a new empty filter. An empty filter will match any data.
* @param schema Optional schema that describes the filter. Necessary if you want to compare the values of
* dates, since the filter needs to know if a given string should be interpreted as a date in ISO-8601 format.
*/
constructor(schema?: TcHmi.JsonSchema);
/**
* Creates a copy of an existing filter instance.
* @param filter The filter instance to copy.
* @param schema Optional schema that describes the filter. If omitted, the schema of the existing filter
* instance will be used. Necessary if you want to compare the values of dates, since the filter needs to know
* if a given string should be interpreted as a date in ISO-8601 format.
*/
constructor(filter: FilterInstance, schema?: TcHmi.JsonSchema);
/**
* Creates a new filter instance based on an existing filter definition.
* @param filter The filter definition to use.
* @param schema Optional schema that describes the filter. Necessary if you want to compare the values of
* dates, since the filter needs to know if a given string should be interpreted as a date in ISO-8601 format.
*/
constructor(filter: TcHmi.Filter, schema?: TcHmi.JsonSchema);
/**
* Creates a new filter instance based on a single comparison.
* @param comparison The comparison to use.
* @param schema Optional schema that describes the filter. Necessary if you want to compare the values of
* dates, since the filter needs to know if a given string should be interpreted as a date in ISO-8601 format.
*/
constructor(comparison: TcHmi.Comparison, schema?: TcHmi.JsonSchema);
/**
* Creates a new filter instance based on a single comparison.
* @param path The path of the property that should be compared. The special values '{value}' and '{key}' can be
* used to refer to the items value or key directly.
* @param comparator How the comparison should be done.
* @param value The value to compare against.
* @param schema Optional schema that describes the filter. Necessary if you want to compare the values of
* dates, since the filter needs to know if a given string should be interpreted as a date in ISO-8601 format.
*/
constructor(path: '{value}' | '{key}' | string, comparator: TcHmi.Comparison['comparator'], value: TcHmi.Comparison['value'], schema?: TcHmi.JsonSchema);
/**
* Returns the current filter definition.
*/
getFilter(): TcHmi.Filter;
/**
* Returns the filter schema.
*/
getSchema(): TcHmi.JsonSchema | null;
/**
* Combines this filter with another filter using a logical and operator.
* @param filter The filter to append.
*/
and(filter: TcHmi.Filter | FilterInstance): this;
/**
* Combines this filter with a new comparison using a logical and operator.
* @param comparison The comparison to append.
*/
and(comparison: TcHmi.Comparison): this;
/**
* Combines this filter with a new comparison using a logical and operator.
* @param path The path of the property that should be compared. The special values '{value}' and '{key}' can be
* used to refer to the items value or key directly.
* @param comparator How the comparison should be done.
* @param value The value to compare against.
*/
and(path: '{value}' | '{key}' | string, comparator: TcHmi.Comparison['comparator'], value: TcHmi.Comparison['value']): this;
/**
* Combines this filter with another filter using a logical or operator.
* @param filter The filter to append.
*/
or(filter: TcHmi.Filter | FilterInstance): this;
/**
* Combines this filter with a new comparison using a logical or operator.
* @param comparison The comparison to append.
*/
or(comparison: TcHmi.Comparison): this;
/**
* Combines this filter with a new comparison using a logical or operator.
* @param path The path of the property that should be compared. The special values '{value}' and '{key}' can be
* used to refer to the items value or key directly.
* @param comparator How the comparison should be done.
* @param value The value to compare against.
*/
or(path: '{value}' | '{key}' | string, comparator: TcHmi.Comparison['comparator'], value: TcHmi.Comparison['value']): this;
/**
* Combines this filter with another filter or a comparison using a given logical operator.
* @param logic Whether to use and or or logic.
* @param filter The filter or comparison to combine this filter with.
*/
private __append;
/**
* Wraps the entire filter in brackets.
*/
wrapInBrackets(): this;
/**
* Compiles the filter. Returns an object indicating if any error occured during compilation.
*/
compile(): TcHmi.IResultObject;
/**
* Tests whether the given candidate matches the filter.
* @param candidate The candidate to test.
* @param key If the candidat originated in a collection, for example an array, you can specify the key or index
* of the candidate to support filters that filter by the key.
*/
test(candidate: T, key?: string | number): boolean;
/**
* Filter an array. Returns a new array which contains only the items that match the filter.
* @param array The array to filter.
*/
filter<D extends T[]>(array: D): D;
/**
* Filter a dictionary. Returns a new dictionary which contains only the items that match the filter.
* @param dictionary The dictionary to filter.
*/
filter<D extends TcHmi.Dictionary<T>>(dictionary: D): D;
/**
* Filter a map. Returns a new map which contains only the items that match the filter.
* @param map The map to filter.
*/
filter<D extends Map<string | number, T>>(map: D): D;
/**
* Filter a set. Returns a new set which contains only the items that match the filter.
* @param set The set to filter.
*/
filter<D extends Set<T>>(set: D): D;
/**
* Filter an array. Returns a new array which contains only the items that match the filter and a map array that
* contains the original indices of the filtered data.
* @param array The array to filter.
*/
filterWithMap<D extends T[]>(array: D): {
data: D;
map: number[];
};
/**
* Recursively filter a tree by applying the filter to all levels of the structure. Returns the filtered data.
* @param tree The tree to filter.
* @param childrenProperty The name of the property that contains child items of each tree node.
* @param strategy The strategy to use. DepthFirst will include items that don't match the filter if they have
* children that match, while BreadthFirst will only include items that directly match the filter, regardless of
* their children.
*/
filterTree<D extends Tree<T, C>, C extends keyof D[number]>(tree: D, childrenProperty: C, strategy?: Strategy): D;
/**
* Recursively filter a tree by applying the filter to all levels of the structure. Returns the filtered data
* and a map array that contains the original indices of the filtered data.
* @param tree The tree to filter.
* @param childrenProperty The name of the property that contains child items of each tree node.
* @param strategy The strategy to use. DepthFirst will include items that don't match the filter if they have
* children that match, while BreadthFirst will only include items that directly match the filter, regardless of
* their children.
*/
filterTreeWithMap<D extends Tree<T, C>, C extends keyof D[number]>(tree: D, childrenProperty: C, strategy?: Strategy): {
data: D;
map: TcHmi.HierarchicalFilterMap[];
};
/**
* Perform depth-first filtering.
* @param tree The tree to filter.
* @param childrenProperty The name of the property that contains child items of each tree node.
* @param parsedFilter The filter to use.
* @param path Set to an empty array to generate a filter map. Omit to skip filter map generation.
*/
private __depthFirst;
/**
* Perform breadth-first filtering.
* @param tree The tree to filter.
* @param childrenProperty The name of the property that contains child items of each tree node.
* @param parsedFilter The filter to use.
* @param path Set to an empty array to generate a filter map. Omit to skip filter map generation.
*/
private __breadthFirst;
static Strategy: typeof Strategy;
}
export type Tree<D, C extends string | number | symbol> = ({
[children in C]?: Tree<D, C>;
} & D)[];
declare const _FilterInstance: typeof FilterInstance;
type tStrategy = Strategy;
type tFilterInstance<T = any> = FilterInstance<T>;
type tTree<D, C extends string | number | symbol> = Tree<D, C>;
declare global {
namespace TcHmi {
let FilterInstance: typeof _FilterInstance;
type FilterInstance<T = any> = tFilterInstance<T>;
namespace FilterInstance {
type Strategy = tStrategy;
type Tree<D, C extends string | number | symbol> = tTree<D, C>;
}
}
}
export {};
//# sourceMappingURL=FilterInstance.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,74 @@
/**
* Used to execute functions based on a static JSON description.
* @template R Type of the result of the function
* @preserve (Part of the public API)
*/
export declare class Function<R = any> extends TcHmi.Destroyable {
/**
* constructor
* @param functionCallDescription function definition
*/
constructor(functionCallDescription: TcHmi.IFunction<R>);
/**
* Will raise the function defined in constructor argument f: IFunction.
* @param requiredArgs Optional required arguments. Will be injected before arguments defined in IFunction and after context object dummy if context object is required.
* @preserve (Part of the public API)
*/
execute(requiredArgs?: any[]): any;
/**
* Will raise the function defined in constructor argument f: IFunction and raises a callback afterwards.
* @param requiredArgs Optional required arguments. Will be injected before arguments defined in IFunction and after context object dummy if context object is required.
* @param callback Callback which will be called with the result
* @preserve (Part of the public API)
*/
executeEx(requiredArgs: any[] | undefined, callback: (this: Function<R>, data: IExecuteResultObject<R>) => void): TcHmi.DestroyFunction;
/**
* Will raise the function defined in constructor argument f: IFunction and forward the context object defined in ctx: TcHmi.Context if the function supports this.
* @param ctx Context object.
* @param requiredArgs Optional required arguments. Will be injected before arguments defined in IFunction and after context object dummy if context object is required.
* @preserve (Part of the public API)
*/
executeEx2(ctx: TcHmi.SelectableRequired<TcHmi.Context, 'success' | 'error'>, requiredArgs?: any[]): TcHmi.DestroyFunction;
/**
* Resolved the processed wait mode of the function call description.
* Even if a called function provides a synchronous wait mode it may be processed asynchronous if asynchronous working symbols
* are added as additional parameter because parameters are resolved before the underlying function is called.
*/
private __resolveProcessedWaitMode;
/**
* Returns true if the function call description will be processed asynchronous and false if not.
* Even if a called function provides a synchronous wait mode it may be processed asynchronous if asynchronous working symbols
* are added as additional parameter because parameters are resolved before the underlying function is called.
* This function throws an exception if the function object was destroyed, the function call description is missing or the function description is missing.
*/
isProcessedAsync(): boolean;
/**
* Releases all resources of the function
* @preserve (Part of the public API)
*/
destroy(): void;
/**
* Get the description of the function.
* @preserve (Part of the public API)
*/
getDescription(): TcHmi.FunctionDescription | undefined;
}
/**
* @template R Type of the result of the function
*/
export interface IExecuteResultObject<R = any> extends TcHmi.IResultObject {
/** Result of the function */
result?: R;
}
declare const _Function: typeof Function;
type tIExecuteResultObject<R = any> = IExecuteResultObject<R>;
declare global {
namespace TcHmi {
let Function: typeof _Function;
namespace Function {
type IExecuteResultObject<R = any> = tIExecuteResultObject<R>;
}
}
}
export {};
//# sourceMappingURL=Function.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,65 @@
/**
* Deprecated! Please use registerFunctionEx.
* @deprecated Please use registerFunctionEx.
* @param name name of the framework function
* @param functionImplementation Javascript function to execute
* @param _descriptionUrl Url for the function description
* @preserve (Part of the public API)
*/
declare function registerFrameworkFunction(name: string, functionImplementation: (...args: any[]) => any, _descriptionUrl?: string): void;
/**
* Deprecated! Please use registerFunctionEx.
* Registers a function created within a TwinCAT HMI project in the framework.
* @param name Name of the function
* @param functionImplementation Javascript function to execute
* @preserve (Part of the public API)
* @deprecated Please use registerFunctionEx.
*/
declare function registerFunction(name: string, functionImplementation: (...args: any[]) => any): void;
/**
* Registers a function created within a TwinCAT HMI project in the framework.
* @param name Name of the function
* @param namespace namespace of the function
* @param functionImplementation Javascript function to execute
* @param options options
* @param options.injectInGlobalObject Inject the function implementation at namespace.name in global object
* @preserve (Part of the public API)
*/
export declare function registerFunctionEx(name: string, namespace: string, functionImplementation: (...args: any[]) => any, options?: {
/** Inject the function implementation at namespace.name in global object */
injectInGlobalObject?: boolean;
}): void;
/**
* Returns a registered HMI function
* @param name Name of the function
* @preserve (Part of the public API)
*/
export declare function getFunction(name: string): ((...args: any[]) => any) | undefined;
/**
* Gets version information of function by name.
* @param name Name of the function
* @preserve (Part of the public API)
*/
export declare function getFunctionVersion(name: string): TcHmi.Version | null;
declare const _registerFunction: typeof registerFunction;
declare const _registerFunctionEx: typeof registerFunctionEx;
declare const _getFunction: typeof getFunction;
declare const _getFunctionVersion: typeof getFunctionVersion;
declare const _registerFrameworkFunction: typeof registerFrameworkFunction;
declare global {
namespace TcHmi {
/**
* Provides resources for managing functions.
* @preserve (Part of the public API)
*/
namespace Functions {
const registerFunction: typeof _registerFunction;
const registerFunctionEx: typeof _registerFunctionEx;
const getFunction: typeof _getFunction;
const getFunctionVersion: typeof _getFunctionVersion;
const registerFrameworkFunction: typeof _registerFrameworkFunction;
}
}
}
export {};
//# sourceMappingURL=Functions.d.ts.map

View File

@@ -0,0 +1,37 @@
import{injectInGlobalObject,functionRegistrations as registrations}from"../System/RegistrationHelpers.js";let Data;
/**
* Deprecated! Please use registerFunctionEx.
* @deprecated Please use registerFunctionEx.
* @param name name of the framework function
* @param functionImplementation Javascript function to execute
* @param _descriptionUrl Url for the function description
* @preserve (Part of the public API)
*/
function registerFrameworkFunction(name,functionImplementation,_descriptionUrl){registerFunction(name,functionImplementation)}
/**
* Deprecated! Please use registerFunctionEx.
* Registers a function created within a TwinCAT HMI project in the framework.
* @param name Name of the function
* @param functionImplementation Javascript function to execute
* @preserve (Part of the public API)
* @deprecated Please use registerFunctionEx.
*/function registerFunction(name,functionImplementation){const registration={name,func:functionImplementation,error:TcHmi.Errors.NONE};registrations.map.has(name)?registrations.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunction",reason:`Ambiguous registration for the name: "${name}". Function will not be addressable by this name. Please try fully qualified name to access function.`}}):(registrations.map.set(name,registration),registrations.array.push(registration)),TcHmi.EventProvider.raise("System.onFunctionRegistered",registration)}
/**
* Registers a function created within a TwinCAT HMI project in the framework.
* @param name Name of the function
* @param namespace namespace of the function
* @param functionImplementation Javascript function to execute
* @param options options
* @param options.injectInGlobalObject Inject the function implementation at namespace.name in global object
* @preserve (Part of the public API)
*/import("../System/System.js").then(module=>{Data=module.Data});export function registerFunctionEx(name,namespace,functionImplementation,options){let foundDuplicate=!1;const qname=namespace?namespace+"."+name:name,registration={name,namespace,error:TcHmi.Errors.NONE,func:functionImplementation};registrations.map.has(name)?registrations.map.set(name,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunctionEx",reason:`Ambiguous registration for the name: "${name}". Function will not be addressable by this name. Please try fully qualified name to access function.`}}):(registrations.map.set(name,registration),registrations.array.push(registration)),registrations.map.has(qname)?(registrations.map.set(qname,{error:TcHmi.Errors.E_NOT_UNIQUE,errorDetails:{code:TcHmi.Errors.E_NOT_UNIQUE,message:TcHmi.Errors[TcHmi.Errors.E_NOT_UNIQUE],domain:"TcHmi.Functions.registerFunctionEx",reason:`Ambiguous registration for the name: "${qname}". Function will not be addressable by this name.`}}),foundDuplicate=!0):(registrations.map.set(qname,registration),options?.injectInGlobalObject&&injectInGlobalObject(qname,functionImplementation)),foundDuplicate||TcHmi.EventProvider.raise("System.onFunctionRegistered",registration)}
/**
* Returns a registered HMI function
* @param name Name of the function
* @preserve (Part of the public API)
*/export function getFunction(name){let module=Data?.Modules.functions.map.get(name);if(module&&module.error===TcHmi.Errors.NONE&&module.reg)return module.reg.func}
/**
* Gets version information of function by name.
* @param name Name of the function
* @preserve (Part of the public API)
*/export function getFunctionVersion(name){let module=Data?.Modules.functions.map.get(name);return module&&module.error===TcHmi.Errors.NONE&&module.description&&"object"==typeof module.description.version?module.description.version:null}TcHmi.Functions={registerFunction,registerFunctionEx,getFunction,getFunctionVersion,registerFrameworkFunction};

View File

@@ -0,0 +1,26 @@
/**
* Starts a globally configured interval.
* @param name The name of the interval to start.
*/
export declare function start(name: string): void;
/**
* Stops a globally configured interval.
* @param name The name of the interval to stop.
*/
export declare function stop(name: string): void;
declare const _start: typeof start;
declare const _stop: typeof stop;
declare global {
namespace TcHmi {
/**
* Provides functionality to control global intervals.
* @preserve (Part of the public API)
*/
namespace Interval {
const start: typeof _start;
const stop: typeof _stop;
}
}
}
export {};
//# sourceMappingURL=Interval.d.ts.map

View File

@@ -0,0 +1 @@
import{intervalManager}from"../System/IntervalManager.js";export function start(name){intervalManager.start(name)}export function stop(name){intervalManager.stop(name)}TcHmi.Interval={start,stop};

View File

@@ -0,0 +1,92 @@
/**
* Closes the system keyboard.
*/
export declare function close(): void;
/**
* Get the provider name of the system keyboard.
*/
export declare function getProviderName(): string;
/**
* Set the provider name of the system keyboard.
* @param providerName Name of the system keyboard provider.
*/
export declare function setProviderName(providerName: string): void;
/**
* Gets if the system keyboard should open on focus of a textarea or input element.
*/
export declare function getAutoOpen(): boolean;
/**
* Sets if the system keyboard should open on focus of a textarea or input element.
* @param newState new value
*/
export declare function setAutoOpen(newState: boolean): void;
/**
* Get the url of the keyboard layout according to the requested input mode and the current localization.
* @param requestedInputMode the input mode of the input field the system keyboard is requested.
*/
export declare function getLayoutFileFromInputMode(requestedInputMode: string): LayoutResult;
/**
* Returns the project keyboard mapping. The project keyboard mapping maps pairs of input mode and keyboard layout urls to locale strings.
*/
export declare function getProjectKeyboardMapping(): TcHmi.Dictionary<TcHmi.Keyboard.InputModeMapping>;
/**
* Sets the project keyboard mapping. The project keyboard mapping maps pairs of input mode and keyboard layout urls to locale strings.
* @param projectKeyboardMapping new project keyboard mapping.
*/
export declare function setProjectKeyboardMapping(projectKeyboardMapping: TcHmi.Dictionary<TcHmi.Keyboard.InputModeMapping>): void;
/**
* Gets the layout object of the system keyboard container.
*/
export declare function getContainerLayout(): TcHmi.Keyboard.ContainerLayout | null;
/**
* Sets the layout object of the system keyboard container. The layout object defines the positioning and dimensions of the keyboard.
* @param layout dimensions and position of the system keyboard.
*/
export declare function setContainerLayout(layout: TcHmi.Keyboard.ContainerLayout): void;
export interface LayoutResultSuccess extends TcHmi.IResultObject {
error: TcHmi.Errors.NONE;
layoutUrl: string;
}
export interface LayoutResultFail extends TcHmi.IResultObject {
error: Exclude<TcHmi.Errors, TcHmi.Errors.NONE>;
details: TcHmi.SelectableRequired<TcHmi.IErrorDetails, 'message' | 'reason' | 'domain'>;
}
export type LayoutResult = LayoutResultSuccess | LayoutResultFail;
declare const _close: typeof close;
declare const _getProviderName: typeof getProviderName;
declare const _setProviderName: typeof setProviderName;
declare const _getAutoOpen: typeof getAutoOpen;
declare const _setAutoOpen: typeof setAutoOpen;
declare const _getLayoutFileFromInputMode: typeof getLayoutFileFromInputMode;
declare const _getProjectKeyboardMapping: typeof getProjectKeyboardMapping;
declare const _setProjectKeyboardMapping: typeof setProjectKeyboardMapping;
declare const _getContainerLayout: typeof getContainerLayout;
declare const _setContainerLayout: typeof setContainerLayout;
type tLayoutResultSuccess = LayoutResultSuccess;
type tLayoutResultFail = LayoutResultFail;
type tLayoutResult = LayoutResult;
declare global {
namespace TcHmi {
/**
* Provides an interface for keyboard interaction.
* @preserve (Part of the public API)
*/
namespace Keyboard {
const close: typeof _close;
const getProviderName: typeof _getProviderName;
const setProviderName: typeof _setProviderName;
const getAutoOpen: typeof _getAutoOpen;
const setAutoOpen: typeof _setAutoOpen;
const getLayoutFileFromInputMode: typeof _getLayoutFileFromInputMode;
const getProjectKeyboardMapping: typeof _getProjectKeyboardMapping;
const setProjectKeyboardMapping: typeof _setProjectKeyboardMapping;
const getContainerLayout: typeof _getContainerLayout;
const setContainerLayout: typeof _setContainerLayout;
type LayoutResultSuccess = tLayoutResultSuccess;
type LayoutResultFail = tLayoutResultFail;
type LayoutResult = tLayoutResult;
}
}
}
export {};
//# sourceMappingURL=Keyboard.d.ts.map

View File

@@ -0,0 +1 @@
import{keyboardManager}from"../System/KeyboardManager.js";export function close(){keyboardManager.close()}export function getProviderName(){return keyboardManager.getProviderName()}export function setProviderName(providerName){keyboardManager.setProviderName(providerName)}export function getAutoOpen(){return keyboardManager.getAutoOpen()}export function setAutoOpen(newState){keyboardManager.setAutoOpen(newState)}export function getLayoutFileFromInputMode(requestedInputMode){return keyboardManager.getLayoutFileFromInputMode(requestedInputMode)}export function getProjectKeyboardMapping(){return tchmi_clone_object(keyboardManager.getProjectKeyboardMapping())}export function setProjectKeyboardMapping(projectKeyboardMapping){keyboardManager.setProjectKeyboardMapping(projectKeyboardMapping)}export function getContainerLayout(){return keyboardManager.getContainerLayout()}export function setContainerLayout(layout){keyboardManager.setContainerLayout(layout)}TcHmi.Keyboard={close,getProviderName,setProviderName,getAutoOpen,setAutoOpen,getLayoutFileFromInputMode,getProjectKeyboardMapping,setProjectKeyboardMapping,getContainerLayout,setContainerLayout};

View File

@@ -0,0 +1,51 @@
export {};
/**
* Please use an array.
* @deprecated Please use an array.
*/
declare class List<T> extends Array<T> {
/**
* Please use an array.
* @deprecated Please use an array.
*/
constructor();
/**
* Please use an array.
* @deprecated Please use an array.
*/
first(predicate: ($: T) => boolean): T;
/**
* Please use an array.
* @deprecated Please use an array.
*/
firstOrDefault(predicate: ($: T) => boolean, _defaultValue?: T): T | null;
/**
* Please use an array.
* @deprecated Please use an array.
*/
remove(item: T): boolean;
/**
* Please use an array.
* @deprecated Please use an array.
*/
addRange(items: T[]): void;
/**
* Please use an array.
* @deprecated Please use an array.
*/
clearAll(): void;
/**
* Please use an array.
* @deprecated Please use an array.
*/
findIndex(predicate: ($: T, index: number, obj: T[]) => boolean): number;
}
declare const _List: typeof List;
type tList<T> = List<T>;
declare global {
namespace TcHmi {
let List: typeof _List;
type List<T> = tList<T>;
}
}
//# sourceMappingURL=List.d.ts.map

View File

@@ -0,0 +1 @@
class List extends Array{constructor(){super(),Object.setPrototypeOf(this,List.prototype)}first(predicate){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i]))return this[i];throw new Error("Array does not contain elements")}firstOrDefault(predicate,_defaultValue=null){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i]))return this[i];return null}remove(item){for(let i=0,len=this.length;i<len;i++)if(this[i]===item)return this.splice(i,1),!0;return!1}addRange(items){for(let i=0,len=items.length;i<len;i++)this.push(items[i])}clearAll(){for(;this.length>0;)this.pop()}findIndex(predicate){for(let i=0,len=this.length;i<len;i++)if(predicate(this[i],i,this))return i;return-1}}TcHmi.List=List;export{};

View File

@@ -0,0 +1,112 @@
/**
* Encapsulates access to the browsers localStorage. Provides methods to set, get and delete Items from localStorage
* that take and return properly typed values. Has a validation mechanism that automatically deletes items if their
* default initial value changes between class instantiations.
* @preserve (Part of the public API)
*/
export declare class LocalStorage<I extends {
[key: string]: unknown;
}, V extends Partial<{
[K in keyof I]: unknown;
}> = {
[K in keyof I]?: never;
}> {
protected __validationValues: V;
protected __name: string;
protected __storage: Partial<{
[K in keyof I]: Item<I[K], V[K]>;
}>;
/**
* Create a new storage instance with the specified name. Values that were previously stored under the same name
* will be read from the browsers localStorage and values that no longer match their validation values are removed.
* @param name The name of the storage instance.
* @param validationValues Values to validate stored items. The validationValue for each item will be stored in
* localStorage alongside the stored item. When a new storage instance is created, stored items whose validationValue
* no longer matches the validationValue given to the constructor will be deleted. The validationValue for each item
* should be chosen to be an attribute or similar value, that, when changed during engineering in the creator
* overrides the stored item value. This way, attributes that are changed in the creator are not overridden again by
* values from localStorage when the liveview is reloaded or a deployed HMI is updated.
* @preserve (Part of the public API)
*/
constructor(name: string, validationValues: V);
/**
* Create a new storage instance for the given control. The name of the instance will be derived from the control id.
* Values that were previously stored under the same name will be read from the browsers localStorage and values
* that no longer match their validation values are removed. For validation to function properly, storage instances
* should be created in the __init() method of controls.
* @param control The control for which to create the storage instance.
* @param validationValues Values to validate stored items. The validationValue for each item will be stored in
* localStorage alongside the stored item. When a new storage instance is created, stored items whose validationValue
* no longer matches the validationValue given to the constructor will be deleted. The validationValue for each item
* should be chosen to be an attribute or similar value, that, when changed during engineering in the creator
* overrides the stored item value. This way, attributes that are changed in the creator are not overridden again by
* values from localStorage when the liveview is reloaded or a deployed HMI is updated.
* @preserve (Part of the public API)
*/
constructor(control: TcHmi.Controls.System.baseTcHmiControl, validationValues: V);
/**
* Sets a stored value for the current user. Returns a boolean that indicates if writing to localStorage was successful.
* @param key The key of the value to set.
* @param value The value to set.
* @preserve (Part of the public API)
*/
set<K extends keyof I>(key: K, value: I[K]): boolean;
/**
* Sets a stored value for the current user only if a stored value is already set or the new value to be stored
* is not equal to the validationValue. This is useful if you want to avoid writing a value into localStorage if
* that value is already equal to the default value anyway. Returns a boolean that indicates if a new value was set.
* @param key The key of the value to set.
* @param value The value to set.
* @preserve (Part of the public API)
*/
setWithValidation<K extends keyof I>(key: K, value: I[K]): boolean;
/**
* Returns the stored value associated with the given key for the current user.
* @param key The key to read.
* @preserve (Part of the public API)
*/
get<K extends keyof I>(key: K): I[K] | undefined;
/**
* Deletes a stored value for the current user.
* @param key The key of the value to delete.
* @preserve (Part of the public API)
*/
delete<K extends keyof I>(key: K): void;
}
interface BaseItem<S> {
users?: TcHmi.Dictionary<S>;
}
interface ValidatedItem<S, V> extends BaseItem<S> {
validation: {
expectedValue: V;
};
}
export type Item<S, V = void> = BaseItem<S> | ValidatedItem<S, V>;
declare const _LocalStorage: typeof LocalStorage;
type tLocalStorage<I extends {
[key: string]: unknown;
}, V extends Partial<{
[K in keyof I]: unknown;
}> = {
[K in keyof I]?: never;
}> = LocalStorage<I, V>;
type tBaseItem<S> = BaseItem<S>;
type tValidatedItem<S, V> = ValidatedItem<S, V>;
declare global {
namespace TcHmi {
let LocalStorage: typeof _LocalStorage;
type LocalStorage<I extends {
[key: string]: unknown;
}, V extends Partial<{
[K in keyof I]: unknown;
}> = {
[K in keyof I]?: never;
}> = tLocalStorage<I, V>;
namespace LocalStorage {
type BaseItem<S> = tBaseItem<S>;
type ValidatedItem<S, V> = tValidatedItem<S, V>;
}
}
}
export {};
//# sourceMappingURL=LocalStorage.d.ts.map

View File

@@ -0,0 +1,31 @@
import{hostPrefix}from"../System/System.js";import{getCurrentUser}from"./Server.js";
/**
* Encapsulates access to the browsers localStorage. Provides methods to set, get and delete Items from localStorage
* that take and return properly typed values. Has a validation mechanism that automatically deletes items if their
* default initial value changes between class instantiations.
* @preserve (Part of the public API)
*/export class LocalStorage{__validationValues;__name;__storage;constructor(nameOrControl,__validationValues){this.__validationValues=__validationValues;const namePrefix=hostPrefix+"TcHmi.LocalStorage.data:",name="string"==typeof nameOrControl?nameOrControl:nameOrControl.getType()+":"+nameOrControl.getId();this.__name=namePrefix+name;let stored=window.localStorage.getItem(this.__name);if(null===stored){const legacyNamePrefix="TCHMI_STORAGE_USERDATA_";if(stored=window.localStorage.getItem(legacyNamePrefix+name),null!==stored)try{window.localStorage.setItem(this.__name,stored),window.localStorage.removeItem(legacyNamePrefix+name)}catch(ex){}}if(stored)try{this.__storage=JSON.parse(stored),"object"!=typeof this.__storage&&(this.__storage={})}catch(ex){this.__storage={}}else this.__storage={};for(const[key,value]of Object.entries(this.__validationValues)){const storageEntry=this.__storage[key];storageEntry&&"validation"in storageEntry&&!tchmi_equal(value,storageEntry.validation.expectedValue)&&this.delete(key)}}
/**
* Sets a stored value for the current user. Returns a boolean that indicates if writing to localStorage was successful.
* @param key The key of the value to set.
* @param value The value to set.
* @preserve (Part of the public API)
*/set(key,value){const user=getCurrentUser();if(!user)return!1;let storageForKey=this.__storage[key];if(!storageForKey){const validationValue=this.__validationValues[key];storageForKey=void 0!==validationValue?{validation:{expectedValue:validationValue}}:{},this.__storage[key]=storageForKey}storageForKey.users||(storageForKey.users={}),storageForKey.users[user]=value;try{window.localStorage.setItem(this.__name,JSON.stringify(this.__storage))}catch(ex){return TcHmi.Log.warnEx("[Source=Framework, Module=TcHmi.Storage] Failed to set item in localStorage. This could be caused by missing permissions or the available storage being full."+(ex instanceof Error?` Exception: ${ex.message}`:"")),!1}return!0}
/**
* Sets a stored value for the current user only if a stored value is already set or the new value to be stored
* is not equal to the validationValue. This is useful if you want to avoid writing a value into localStorage if
* that value is already equal to the default value anyway. Returns a boolean that indicates if a new value was set.
* @param key The key of the value to set.
* @param value The value to set.
* @preserve (Part of the public API)
*/setWithValidation(key,value){const user=getCurrentUser();if(!user)return!1;const valueEqualsValidation=key in this.__validationValues&&tchmi_equal(value,this.__validationValues[key]);let storageForKey=this.__storage[key];if(!storageForKey){if(valueEqualsValidation)return!1;const validationValue=this.__validationValues[key];storageForKey=void 0!==validationValue?{validation:{expectedValue:validationValue}}:{},this.__storage[key]=storageForKey}if(!storageForKey.users?.[user]&&valueEqualsValidation)return!1;storageForKey.users||(storageForKey.users={}),storageForKey.users[user]=value;try{window.localStorage.setItem(this.__name,JSON.stringify(this.__storage))}catch(ex){return TcHmi.Log.warnEx("[Source=Framework, Module=TcHmi.Storage] Failed to set item in localStorage. This could be caused by missing permissions or the available storage being full."+(ex instanceof Error?` Exception: ${ex.message}`:"")),!1}return!0}
/**
* Returns the stored value associated with the given key for the current user.
* @param key The key to read.
* @preserve (Part of the public API)
*/get(key){const user=getCurrentUser();if(!user)return;const storageForKey=this.__storage[key];return storageForKey&&storageForKey.users?storageForKey.users[user]:void 0}
/**
* Deletes a stored value for the current user.
* @param key The key of the value to delete.
* @preserve (Part of the public API)
*/delete(key){const storageForKey=this.__storage[key];if(storageForKey){const user=getCurrentUser();if(!user)return;storageForKey.users&&(delete storageForKey.users[user],0===Object.keys(storageForKey.users).length&&delete this.__storage[key])}if(Object.keys(this.__storage).length>0)try{window.localStorage.setItem(this.__name,JSON.stringify(this.__storage))}catch(ex){}else window.localStorage.removeItem(this.__name)}}TcHmi.LocalStorage=LocalStorage;

View File

@@ -0,0 +1,226 @@
/**
* Changes the locale of the HMI including all localization symbols.
* Note that this does not change the Time Format Locale.
* The locale name is given as ISO 639/BCP 47 identifier (Examples: 'en', 'en-US').
* @param locale locale name to load. The locale name is given as ISO 639/BCP 47 identifier (Examples: 'en', 'en-US').
* @param callback optional callback which is called after locale change
* @preserve (Part of the public API)
*/
export declare function load(locale: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): void;
/**
* Returns the current locale string for texts or undefined if no localized Symbol is available.
* Note that this is not the Time Format Locale.
* The locale name is given as ISO 639/BCP 47 identifier (Examples: 'en', 'en-US').
* @returns The current locale identifier as ISO 639/BCP 47 identifier (Examples: 'en', 'en-US').
* @preserve (Part of the public API)
*/
export declare function get(): string | undefined;
/**
* Returns the list of available application locales.
* The locale name is given as ISO 639/BCP 47 identifiers (Examples: 'en', 'en-US').
* @preserve (Part of the public API)
*/
export declare function getRegisteredLocales(): string[];
/**
* Returns the list of available control locales.
* The locale name is given as ISO 639/BCP 47 identifiers (Examples: 'en', 'en-US').
* @param type Control type (for example TcHmi.Controls.Beckhoff.TcHmiRadialGauge)
*/
export declare function getRegisteredLocalesForControl(type: string | null): string[];
/**
* Returns the list of available function locales.
* The locale name is given as ISO 639/BCP 47 identifiers (Examples: 'en', 'en-US').
* @param type Function type (for example TcHmi.Functions.Beckhoff.CheckAccess)
*/
export declare function getRegisteredLocalesForFunction(type: string | null): string[];
/**
* Allows safe access to a localization dictionary.
* @template K Keys this Reader will resolve
*/
export declare class LocalizationReader<K extends string = string> {
/**
* Allows safe access to a localization dictionary.
* @param localization localization dictionary
*/
constructor(localization: TcHmi.ILocalizedTextMap<K>);
private __localizationDictionary;
/**
* Returns the raw localization dictionary.
*/
getLocalization(): TcHmi.ILocalizedTextMap<K>;
/**
* Returns the value associated with the key or the key if not value exists.
* @param key Key to map to a localization
*/
get(key: K): string;
}
/**
* Used to access namespace related localization content.
* Do not use this class directly. Please use one of its specializations like TcHmi.Locale.ControlLocalization,
* TcHmi.Locale.FunctionLocalization or TcHmi.Locale.ApplicationLocalization.
* @template K Keys this Localization will provide.
*/
export declare abstract class Localization<K extends string = string> {
protected __namespace: string;
/**
* Returns a dictionary with all related localization texts.
* @param options optional locale level
*/
get(options?: LocalizationOptions): LocalizationReader<K>;
/**
* Watches the list of all related localization texts.
* Returns a destroy function to remove the watch.
* @param callback callback which is called on each value change
* @template WK Keys this watch will provide. Falls back to keys of the Localization.
*/
watch<WK extends string = K>(callback: (this: void, data: IWatchResultObject<WK>) => void): TcHmi.DestroyFunction;
/**
* Watches the list of all related localization texts.
* Returns a destroy function to remove the watch.
* @param options optional locale level
* @param callback callback which is called on each value change
* @template WK Keys this watch will provide. Falls back to keys of the Localization.
*/
watchEx<WK extends string = K>(options: LocalizationOptions | undefined, callback: (this: void, data: IWatchResultObject<WK>) => void): TcHmi.DestroyFunction;
/**
* Returns the text for a specific localization key or the key if no text is available.
* @param key Key which should be mapped to a text.
* @param options optional locale level
*/
getText(key: K, options?: LocalizationOptions): string;
/**
* Watches the text for a specific localization key or the key if no text is available.
* Returns a destroy function to remove the watch.
* @param key Key which is mapped to a text.
* @param callback callback which is called on each value change
*/
watchText(key: K, callback?: (this: void, data: IWatchTextResultObject) => void): TcHmi.DestroyFunction;
/**
* Watches the text for a specific localization key or the key if no text is available.
* @param key Key which is mapped to a text.
* @param options optional locale level
* @param callback callback which is called on each value change
*/
watchTextEx(key: K, options: LocalizationOptions | undefined, callback: (this: void, data: IWatchTextResultObject) => void): TcHmi.DestroyFunction;
}
/**
* Used to access application related localization content.
*/
export declare class ApplicationLocalization extends Localization {
/**
* Constructor
*/
constructor();
}
/**
* Used to access control related localization content.
*/
export declare class ControlLocalization extends Localization {
/**
* Constructor
* @param type Name+Namespace of the control
*/
constructor(type: string);
}
/**
* Used to access function related localization content.
*/
export declare class FunctionLocalization extends Localization {
/**
* Constructor
* @param type Name+Namespace of the function
*/
constructor(type: string);
}
/**
* Used to access package related localization content.
*/
export declare class PackageLocalization extends Localization {
/**
* Constructor
* @param id Id of the target NuGet package
*/
constructor(id: string);
}
export declare enum Level {
Application = 0,
Engineering = 1
}
export interface LocalizationOptions {
/**
* The locale level to use when fetching localization texts. Defaults to Level.Application.
* Should only be set to Level.Engineering in engineering scenarios.
*/
level?: Level;
/**
* When set to true html characters in localization texts will be replaced with html entities before being returned.
* Use this when the localization text will be injected to the DOM using innerHTML to prevent XSS injection.
*/
preventHtml?: boolean;
}
export interface IWatchResultObject<K extends string = string> extends TcHmi.IResultObject {
reader?: LocalizationReader<K>;
/** A destroy function to remove the watch. Only set if there is no error. */
destroy?: TcHmi.DestroyFunction;
}
export interface IWatchTextResultObject extends TcHmi.IResultObject {
text?: string;
/** A destroy function to remove the watch. Only set if there is no error. */
destroy?: TcHmi.DestroyFunction;
}
declare const _load: typeof load;
declare const _get: typeof get;
declare const _getRegisteredLocales: typeof getRegisteredLocales;
declare const _getRegisteredLocalesForControl: typeof getRegisteredLocalesForControl;
declare const _getRegisteredLocalesForFunction: typeof getRegisteredLocalesForFunction;
declare const _LocalizationReader: typeof LocalizationReader;
declare const _Localization: typeof Localization;
declare const _ApplicationLocalization: typeof ApplicationLocalization;
declare const _ControlLocalization: typeof ControlLocalization;
declare const _FunctionLocalization: typeof FunctionLocalization;
declare const _PackageLocalization: typeof PackageLocalization;
declare const _Level: typeof Level;
type tLocalizationReader<K extends string = string> = LocalizationReader<K>;
type tLocalization<K extends string = string> = Localization<K>;
type tApplicationLocalization = ApplicationLocalization;
type tControlLocalization = ControlLocalization;
type tFunctionLocalization = FunctionLocalization;
type tPackageLocalization = PackageLocalization;
type tLevel = Level;
type tLocalizationOptions = LocalizationOptions;
type tIWatchResultObject<K extends string = string> = IWatchResultObject<K>;
type tIWatchTextResultObject = IWatchTextResultObject;
declare global {
namespace TcHmi {
/**
* Provides resources for managing the localization.
* @preserve (Part of the public API)
*/
namespace Locale {
const load: typeof _load;
const get: typeof _get;
const getRegisteredLocales: typeof _getRegisteredLocales;
const getRegisteredLocalesForControl: typeof _getRegisteredLocalesForControl;
const getRegisteredLocalesForFunction: typeof _getRegisteredLocalesForFunction;
const LocalizationReader: typeof _LocalizationReader;
type LocalizationReader<K extends string = string> = tLocalizationReader<K>;
const Localization: typeof _Localization;
type Localization<K extends string = string> = tLocalization<K>;
const ApplicationLocalization: typeof _ApplicationLocalization;
type ApplicationLocalization = tApplicationLocalization;
const ControlLocalization: typeof _ControlLocalization;
type ControlLocalization = tControlLocalization;
const FunctionLocalization: typeof _FunctionLocalization;
type FunctionLocalization = tFunctionLocalization;
const PackageLocalization: typeof _PackageLocalization;
type PackageLocalization = tPackageLocalization;
const Level: typeof _Level;
type Level = tLevel;
type LocalizationOptions = tLocalizationOptions;
type IWatchResultObject<K extends string = string> = tIWatchResultObject<K>;
type IWatchTextResultObject = tIWatchTextResultObject;
}
}
}
export {};
//# sourceMappingURL=Locale.d.ts.map

View File

@@ -0,0 +1,21 @@
import{localizationManager}from"../System/LocalizationManager.js";import{isParameterTypeInvalid}from"../System/SystemFunctions.js";import{createTask}from"../System/Callback.js";
/**
* Changes the locale of the HMI including all localization symbols.
* Note that this does not change the Time Format Locale.
* The locale name is given as ISO 639/BCP 47 identifier (Examples: 'en', 'en-US').
* @param locale locale name to load. The locale name is given as ISO 639/BCP 47 identifier (Examples: 'en', 'en-US').
* @param callback optional callback which is called after locale change
* @preserve (Part of the public API)
*/export function load(locale,callback=null){isParameterTypeInvalid(locale,"locale",{type:"string",required:"nullOk",minStringLength:1},"TcHmi.Locale",callback)||localizationManager.loadLocale(locale,callback)}
/**
* Returns the current locale string for texts or undefined if no localized Symbol is available.
* Note that this is not the Time Format Locale.
* The locale name is given as ISO 639/BCP 47 identifier (Examples: 'en', 'en-US').
* @returns The current locale identifier as ISO 639/BCP 47 identifier (Examples: 'en', 'en-US').
* @preserve (Part of the public API)
*/export function get(){return localizationManager.getLocale()}
/**
* Returns the list of available application locales.
* The locale name is given as ISO 639/BCP 47 identifiers (Examples: 'en', 'en-US').
* @preserve (Part of the public API)
*/export function getRegisteredLocales(){let files=localizationManager.getFiles();if(!files)return[];let applicationFiles=files.get("TcHmi.System.Localization.Application");return applicationFiles?Array.from(applicationFiles.keys()):[]}export function getRegisteredLocalesForControl(type){let files=localizationManager.getFiles();if(!files)return[];let controlFiles=files.get("TcHmi.System.Localization.Control<"+type+">");return controlFiles?Array.from(controlFiles.keys()):[]}export function getRegisteredLocalesForFunction(type){let files=localizationManager.getFiles();if(!files)return[];let functionFiles=files.get("TcHmi.System.Localization.Function<"+type+">");return functionFiles?Array.from(functionFiles.keys()):[]}export class LocalizationReader{constructor(localization){this.__localizationDictionary=localization}__localizationDictionary;getLocalization(){return this.__localizationDictionary}get(key){let res=this.__localizationDictionary[key];return null==res&&(res=key),res}}export class Localization{__namespace="";get(options){return localizationManager.get(this.__namespace,options)}watch(callback){const callstackLinker=createTask("Locale.watch>"+this.__namespace);return localizationManager.watch(this.__namespace,void 0,data=>{callstackLinker.run(()=>{TcHmi.Callback.callSafeEx(callback,this,data)})})}watchEx(options={level:Level.Application},callback){const callstackLinker=createTask("Locale.watchEx>"+this.__namespace);return localizationManager.watch(this.__namespace,options,data=>{callstackLinker.run(()=>{TcHmi.Callback.callSafeEx(callback,this,data)})})}getText(key,options){return localizationManager.getText(this.__namespace,key,options)}watchText(key,callback){return localizationManager.watchText(this.__namespace,key,void 0,data=>{TcHmi.Callback.callSafeEx(callback,this,data)})}watchTextEx(key,options={level:Level.Application},callback){return localizationManager.watchText(this.__namespace,key,options,data=>{TcHmi.Callback.callSafeEx(callback,this,data)})}}export class ApplicationLocalization extends Localization{constructor(){super(),this.__namespace="TcHmi.System.Localization.Application"}}export class ControlLocalization extends Localization{constructor(type){super(),this.__namespace="TcHmi.System.Localization.Control<"+type+">"}}export class FunctionLocalization extends Localization{constructor(type){super(),this.__namespace="TcHmi.System.Localization.Function<"+type+">"}}export class PackageLocalization extends Localization{constructor(id){super(),this.__namespace="TcHmi.System.Localization.Package<"+id+">"}}export var Level;!function(Level){Level[Level.Application=0]="Application",Level[Level.Engineering=1]="Engineering"}(Level||(Level={}));TcHmi.Locale={load,get,getRegisteredLocales,getRegisteredLocalesForControl,getRegisteredLocalesForFunction,LocalizationReader,Localization,ApplicationLocalization,ControlLocalization,FunctionLocalization,PackageLocalization,Level};

View File

@@ -0,0 +1,87 @@
/**
* Do not call this function. It is only for internal use.
*/
export declare function __rebuildLocalizationCache(): void;
/**
* Returns a cached Intl.DateTimeFormat
* When no parameter is given the current setting of the user is used
*
* @param locale Locale like 'en'
* @param timeZone Timezone locator
* @param hour12 time format
* @param type format type
*/
export declare function getDateTimeFormatter(locale: string | undefined, timeZone: string | undefined, hour12: boolean | undefined, type?: FormatType): Intl.DateTimeFormat;
/**
* Skip non numeric chars and parseInt the rest.
* MS Browsers add Left-To-Right-Mark to output
* https://github.com/tc39/ecma402/issues/28
* @param input string input
* @preserve (Part of the public API)
*/
export declare function parseInt(input: string): number;
/**
* Parses a Date object
* formats it to a time zone and split its components into an object
* On error all entries will be NaN
* @param date Date object to parse
* @param options Options
* @preserve (Part of the public API)
*/
export declare function parseDate(date: Date, options?: ParseOptions): DateParts;
/**
* Formats a Date object down to milliseconds in the correct locale and time zone (config from server user or browser default)
* On error this will be null
* @param date Date Object to parse
* @param options Options
* @preserve (Part of the public API)
*/
export declare function formatDate(date: Date, options?: FormatOptions): string | null;
/** Holds a date splitted in the number parts */
export interface DateParts {
year: number;
month: number;
day: number;
hour: number;
minute: number;
second: number;
millisecond: number;
}
export interface ParseOptions {
timeZone?: string | undefined;
}
export interface FormatOptions extends ParseOptions {
/** Type of the format output. Can be 'full', 'date', 'time', 'time-no-millisec' or 'date-no-millisec' */
type?: FormatType;
/** Locale to format the string. Can be empty to use the time format locale of the current user. */
locale?: string | undefined | null;
}
export type FormatType = 'full' | 'date' | 'time' | 'time-no-millisec' | 'full-no-millisec';
declare const _getDateTimeFormatter: typeof getDateTimeFormatter;
declare const _formatDate: typeof formatDate;
declare const _parseDate: typeof parseDate;
declare const _parseInt: typeof parseInt;
type tDateParts = DateParts;
type tParseOptions = ParseOptions;
type tFormatOptions = FormatOptions;
type tFormatType = FormatType;
declare global {
namespace TcHmi {
/**
* Allows handling date and time formatting.
* @preserve (Part of the public API)
*/
namespace Localization {
const getDateTimeFormatter: typeof _getDateTimeFormatter;
const formatDate: typeof _formatDate;
const parseDate: typeof _parseDate;
const parseInt: typeof _parseInt;
type DateParts = tDateParts;
type ParseOptions = tParseOptions;
type FormatOptions = tFormatOptions;
type FormatType = tFormatType;
}
}
}
export {};
//# sourceMappingURL=Localization.d.ts.map

View File

@@ -0,0 +1,24 @@
import{accessManager}from"../System/AccessManager.js";export function __rebuildLocalizationCache(){__numberFormatMilliSecondsCache.clear(),__dateFormatCache.clear()}export function getDateTimeFormatter(locale,timeZone,hour12,type="full"){let level1=__dateFormatCache.get(locale);level1||(level1=new Map,__dateFormatCache.set(locale,level1));let level2=level1.get(timeZone);level2||(level2=new Map,level1.set(timeZone,level2));let level3=level2.get(hour12);level3||(level3=new Map,level2.set(hour12,level3));let formatter=level3.get(type);if(formatter)return formatter;const config=accessManager.getCurrentUserConfig();let timeFormatLocale=locale;timeFormatLocale||(timeFormatLocale=config.timeFormatLocale);let _timeZone=timeZone;_timeZone||(_timeZone=config.timeZone);try{new Intl.DateTimeFormat(timeFormatLocale)}catch(e){timeFormatLocale=void 0}try{new Intl.DateTimeFormat(timeFormatLocale,{timeZone:_timeZone})}catch(e){e instanceof RangeError&&(_timeZone=void 0)}let IntlOptions={timeZone:_timeZone,hour12};switch(type){case"date":IntlOptions.year="numeric",IntlOptions.month="numeric",IntlOptions.day="numeric";break;case"time":IntlOptions.fractionalSecondDigits=3;case"time-no-millisec":IntlOptions.hour="numeric",IntlOptions.minute="numeric",IntlOptions.second="numeric";break;case"full":IntlOptions.fractionalSecondDigits=3;case"full-no-millisec":IntlOptions.year="numeric",IntlOptions.month="numeric",IntlOptions.day="numeric",IntlOptions.hour="numeric",IntlOptions.minute="numeric",IntlOptions.second="numeric"}return IntlOptions.hour&&"function"!=typeof Intl.DateTimeFormat.prototype.formatToParts&&(IntlOptions.hour12=!1),formatter=new Intl.DateTimeFormat(timeFormatLocale,IntlOptions),level3.set(type,formatter),formatter}let __numberFormatMilliSecondsCache=new Map,__dateFormatCache=new Map;
/**
* Skip non numeric chars and parseInt the rest.
* MS Browsers add Left-To-Right-Mark to output
* https://github.com/tc39/ecma402/issues/28
* @param input string input
* @preserve (Part of the public API)
*/
export function parseInt(input){let value="";for(let i=0;i<input.length;i++)input.charCodeAt(i)>=32&&input.charCodeAt(i)<=126&&(value+=input[i]);return Number.parseInt(value,10)}
/**
* Parses a Date object
* formats it to a time zone and split its components into an object
* On error all entries will be NaN
* @param date Date object to parse
* @param options Options
* @preserve (Part of the public API)
*/export function parseDate(date,options){const dateObject={year:NaN,month:NaN,day:NaN,hour:NaN,minute:NaN,second:NaN,millisecond:NaN};if(isNaN(date.getTime()))return dateObject;let timeZone;if(options&&"string"==typeof options.timeZone&&(timeZone=options.timeZone),"function"==typeof Intl.DateTimeFormat.prototype.formatToParts){let parts=getDateTimeFormatter("de-DE",timeZone,!1,"full").formatToParts(date);dateObject.year=parseInt(parts.find(value=>"year"===value.type).value),dateObject.month=parseInt(parts.find(value=>"month"===value.type).value),dateObject.day=parseInt(parts.find(value=>"day"===value.type).value),dateObject.hour=parseInt(parts.find(value=>"hour"===value.type).value),dateObject.minute=parseInt(parts.find(value=>"minute"===value.type).value),dateObject.second=parseInt(parts.find(value=>"second"===value.type).value),dateObject.millisecond=date.getUTCMilliseconds()}else{let formatter=getDateTimeFormatter("de-DE",timeZone,!1,"date"),dateArray=formatter.format(date).split(".");dateObject.year=parseInt(dateArray[2]),dateObject.month=parseInt(dateArray[1]),dateObject.day=parseInt(dateArray[0]),formatter=getDateTimeFormatter("de-DE",timeZone,!1,"time");let timeArray=formatter.format(date).split(":");dateObject.hour=parseInt(timeArray[0]),dateObject.minute=parseInt(timeArray[1]),dateObject.second=parseInt(timeArray[2]),dateObject.millisecond=date.getUTCMilliseconds()}return dateObject}
/**
* Formats a Date object down to milliseconds in the correct locale and time zone (config from server user or browser default)
* On error this will be null
* @param date Date Object to parse
* @param options Options
* @preserve (Part of the public API)
*/export function formatDate(date,options){if(isNaN(date.getTime()))return null;const locale=options?.locale??void 0,timeZone=options?.timeZone,format=options?.type;return getDateTimeFormatter(locale,timeZone,void 0,format).format(date)}TcHmi.Localization={getDateTimeFormatter,formatDate,parseDate,parseInt};

View File

@@ -0,0 +1,113 @@
export type AdditionalInfo = {
/** attribute name of the control */
Attribute?: string | undefined | null;
Symbol?: string | undefined | null;
[key: string]: string | undefined | null;
};
/**
* Logging functions with contextual information for controls.
* @preserve (Part of the public API)
*/
export declare class Controls {
/**
* Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
* Adds contextual information (module type, ID, origin) to the message for improved traceability.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 1 or higher.
* See "client" page in config page of the server for live overrides.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs from the control type.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static error(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, message: string, ...optionalParameters: any[]): void;
/**
* Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
* Adds contextual information (module type, ID, origin, custom) to the message for improved traceability.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 1 or higher.
* See "client" page in config page of the server for live overrides.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs from the control type.
* @param additionalInfo Additional custom context information. The key and value of this object will be shown in output. {Attribute: "Top"} will add "Attribute=Top" into the log.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static error(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, additionalInfo: AdditionalInfo, message: string, ...optionalParameters: any[]): void;
/**
* Prints out a warn message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
* Adds contextual information (module type, ID, origin) to the message for improved traceability.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 2 or higher.
* See "client" page in config page of the server for live overrides.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs from the control type.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static warn(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, message: string, ...optionalParameters: any[]): void;
/**
* Prints out a warn message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
* Adds contextual information (module type, ID, origin, custom) to the message for improved traceability.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 2 or higher.
* See "client" page in config page of the server for live overrides.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs from the control type.
* @param additionalInfo Additional custom context information. The key and value of this object will be shown in output. {Attribute: "Top"} will add "Attribute=Top" into the log.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static warn(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, additionalInfo: AdditionalInfo, message: string, ...optionalParameters: any[]): void;
/**
* Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
* Adds contextual information (module type, ID, origin) to the message for improved traceability.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 3 or higher.
* See "client" page in config page of the server for live overrides.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs from the control type.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static info(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, message: string, ...optionalParameters: any[]): void;
/**
* Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
* Adds contextual information (module type, ID, origin, custom) to the message for improved traceability.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 3 or higher.
* See "client" page in config page of the server for live overrides.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs from the control type.
* @param additionalInfo Additional custom context information. The key and value of this object will be shown in output. {Attribute: "Top"} will add "Attribute=Top" into the log.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static info(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, additionalInfo: AdditionalInfo, message: string, ...optionalParameters: any[]): void;
/**
* Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
* Adds contextual information (module type, ID, origin) to the message for improved traceability.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 4 or higher.
* See "client" page in config page of the server for live overrides.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs from the control type.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static debug(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, message: string, ...optionalParameters: any[]): void;
/**
* Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
* Adds contextual information (module type, ID, origin, custom) to the message for improved traceability.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 4 or higher.
* See "client" page in config page of the server for live overrides.
* @param control Control instance used to derive module type and ID which is included in the composed context.
* @param origin The fully qualified name of the control which is included in the composed context if it differs from the control type.
* @param additionalInfo Additional custom context information. The key and value of this object will be shown in output. {Attribute: "Top"} will add "Attribute=Top" into the log.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static debug(control: TcHmi.Controls.System.baseTcHmiControl, origin: string, additionalInfo: AdditionalInfo, message: string, ...optionalParameters: any[]): void;
}
//# sourceMappingURL=Log.Controls.d.ts.map

View File

@@ -0,0 +1,5 @@
function __log(logFn,control,origin,messageOrAdditionalInfo,...optionalParameters){let composedLogDetails={context:`Source=Control, Module=${control.getType()}`+(origin&&origin!==control.getType()?`, Origin=${origin}`:"")+`, Id=${control.getId()}`,message:"",params:[]};if("object"==typeof messageOrAdditionalInfo){const additionalInfo=messageOrAdditionalInfo;for(const[key,value]of Object.entries(additionalInfo))composedLogDetails.context+=`, ${key}=${value}`;if([composedLogDetails.message,...composedLogDetails.params]=optionalParameters,"string"!=typeof composedLogDetails.message)throw new Error(`Incorrect use of log function. String expected, got ${typeof composedLogDetails.message}.`)}else composedLogDetails.message=messageOrAdditionalInfo,composedLogDetails.params=optionalParameters;logFn(`[${composedLogDetails.context}] ${composedLogDetails.message}`,...composedLogDetails.params)}
/**
* Logging functions with contextual information for controls.
* @preserve (Part of the public API)
*/export class Controls{static error(control,origin,messageOrAdditionalInfo,...optionalParameters){__log(TcHmi.Log.errorEx,control,origin,messageOrAdditionalInfo,...optionalParameters)}static warn(control,origin,messageOrAdditionalInfo,...optionalParameters){__log(TcHmi.Log.warnEx,control,origin,messageOrAdditionalInfo,...optionalParameters)}static info(control,origin,messageOrAdditionalInfo,...optionalParameters){__log(TcHmi.Log.infoEx,control,origin,messageOrAdditionalInfo,...optionalParameters)}static debug(control,origin,messageOrAdditionalInfo,...optionalParameters){__log(TcHmi.Log.debugEx,control,origin,messageOrAdditionalInfo,...optionalParameters)}}

View File

@@ -0,0 +1,172 @@
import { Controls as ControlsLog, type AdditionalInfo as ControlsAdditionalInfo } from './Log.Controls.js';
/**
* Logging functions
* @preserve (Part of the public API)
*/
export declare class Log {
/** When set to true no prefix will be printed with log messages. */
static Prefix: boolean;
/** When set to true the configured log level will be ignored and the messages logged anyway. */
static Force: boolean;
/**
* Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
* If the message is an object it will be inspectable in most debug tools. See errorEx if you want to show multiple objects.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 1 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param forceNoPrefix If set the date will be hidden
* @preserve (Part of the public API)
*/
static error(message: string | object | null | undefined, forceNoPrefix?: boolean): void;
/**
* Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 1 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static errorEx(message: string, ...optionalParameters: any[]): void;
/**
* Prints out a warning message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
* If the message is an object it will be inspectable in most debug tools. See warnEx if you want to show multiple objects.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 2 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param forceNoPrefix If set the date will be hidden
* @preserve (Part of the public API)
*/
static warn(message: string | object | null | undefined, forceNoPrefix?: boolean): void;
/**
* Prints out a warning message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 2 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static warnEx(message: string, ...optionalParameters: any[]): void;
/**
* Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
* If the message is an object it will be inspectable in most debug tools. See infoEx if you want to show multiple objects.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 3 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param forceNoPrefix If set the date will be hidden
* @preserve (Part of the public API)
*/
static info(message: string | object | null | undefined, forceNoPrefix?: boolean): void;
/**
* Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 3 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static infoEx(message: string, ...optionalParameters: any[]): void;
/**
* Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
* If the message is an object it will be inspectable in most debug tools. See debugEx if you want to show multiple objects.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 4 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param forceNoPrefix If set the date will be hidden
* @preserve (Part of the public API)
*/
static debug(message: string | object | null | undefined, forceNoPrefix?: boolean): void;
/**
* Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 4 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/
static debugEx(message: string, ...optionalParameters: any[]): void;
/**
* Starts a new timer for performance analysis and stops the current timer
* Is also responsible for console grouping
* @param timerName Human readable name of the starting Timer or null to end timer
*/
static performanceLog(timerName: string | null): void;
/**
* Starts a new timer for performance analysis
* @param timerName Human readable name of the starting Timer
*/
static performanceLogStart(timerName: string): void;
/**
* Stops an existing timer for performance analysis
* @param timerName Human readable name of the starting Timer
*/
static performanceLogEnd(timerName: string): void;
/**
* Builds a formatted message of hierarchical error objects.
* @param error Error object to show nicely
* @preserve (Part of the public API)
*/
static buildMessage(error: TcHmi.IErrorDetails | undefined): string;
}
export declare namespace Log.Controls {
let error: typeof _Cerror;
let warn: typeof _Cwarn;
let info: typeof _Cinfo;
let debug: typeof _Cdebug;
type AdditionalInfo = tCAdditionalInfo;
}
declare const _Prefix: boolean;
declare const _Force: boolean;
declare const _error: typeof Log.error;
declare const _errorEx: typeof Log.errorEx;
declare const _warn: typeof Log.warn;
declare const _warnEx: typeof Log.warnEx;
declare const _info: typeof Log.info;
declare const _infoEx: typeof Log.infoEx;
declare const _debug: typeof Log.debug;
declare const _debugEx: typeof Log.debugEx;
declare const _performanceLog: typeof Log.performanceLog;
declare const _performanceLogStart: typeof Log.performanceLogStart;
declare const _performanceLogEnd: typeof Log.performanceLogEnd;
declare const _buildMessage: typeof Log.buildMessage;
declare const _Cerror: typeof ControlsLog.error;
declare const _Cwarn: typeof ControlsLog.warn;
declare const _Cinfo: typeof ControlsLog.info;
declare const _Cdebug: typeof ControlsLog.debug;
type tCAdditionalInfo = ControlsAdditionalInfo;
declare global {
namespace TcHmi {
/**
* Provides functions for logging.
* @preserve (Part of the public API)
*/
namespace Log {
let Prefix: typeof _Prefix;
let Force: typeof _Force;
let error: typeof _error;
let errorEx: typeof _errorEx;
let warn: typeof _warn;
let warnEx: typeof _warnEx;
let info: typeof _info;
let infoEx: typeof _infoEx;
let debug: typeof _debug;
let debugEx: typeof _debugEx;
let performanceLog: typeof _performanceLog;
let performanceLogStart: typeof _performanceLogStart;
let performanceLogEnd: typeof _performanceLogEnd;
let buildMessage: typeof _buildMessage;
/**
* Logging functions with contextual information for controls.
* @preserve (Part of the public API)
*/
namespace Controls {
const error: typeof _Cerror;
const warn: typeof _Cwarn;
const info: typeof _Cinfo;
const debug: typeof _Cdebug;
type AdditionalInfo = tCAdditionalInfo;
}
}
}
}
export {};
//# sourceMappingURL=Log.d.ts.map

View File

@@ -0,0 +1,79 @@
import{SymbolExpressionFromText}from"../System/SymbolExpressionFromText.js";import{Init,isUnloaded}from"../System/System.js";import{Controls as ControlsLog}from"./Log.Controls.js";let __il=new((()=>{var _a;let ___onWebworkerMessage_decorators,_instanceExtraInitializers=[];return class{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;___onWebworkerMessage_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],__esDecorate(this,null,___onWebworkerMessage_decorators,{kind:"method",name:"__onWebworkerMessage",static:!1,private:!1,access:{has:obj=>"__onWebworkerMessage"in obj,get:obj=>obj.__onWebworkerMessage},metadata:_metadata},null,_instanceExtraInitializers),_metadata&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}__webworker=(__runInitializers(this,_instanceExtraInitializers),null);__persistentLogCache=[];__persistentLogInitPending=!1;__persistentLogInit(){this.__webworker||window.indexedDB&&(this.__persistentLogInitPending||(this.__persistentLogInitPending=!0,Init.initializedBaseConfig.then(()=>{try{this.__webworker=new Worker(TcHmi.Environment.getBasePath()+"/Worker/System/Log.IndexedDB.js",{type:"module"})}catch(e){Log.errorEx("[Source=Framework, Module=TcHmi.Log] Persistent logging failed because WebWorker.Log.IndexedDB.js could not be loaded.\n",e)}if(this.__webworker)for(this.__webworker.addEventListener("message",this.__onWebworkerMessage),this.__webworker.postMessage({command:"run",options:{maxEntries:TCHMI_PERSISTENT_LOG_MAX_ENTRIES,cacheInterval:TCHMI_PERSISTENT_LOG_CACHE_INTERVAL}});this.__persistentLogCache.length>0;){let entry=this.__persistentLogCache.shift();entry&&this.add(entry.timespan,entry.type,entry.message,entry.optionalParameters)}this.__persistentLogInitPending=!1})))}__onWebworkerMessage(messageEvent){let message=messageEvent.data;if(message&&"error"===message.event)Log.errorEx(message.args.message,...message.args.args)}add(timespan,type,message,...optionalParameters){let optionalParametersPrepared=[];for(let i=0,ii=optionalParameters.length;i<ii;i++){let op=optionalParameters[i];try{if(null!==op&&"object"==typeof op){op=__tchmi_is_instanced_object(op)?op.constructor&&op.constructor.name?'[IndexedDBLog: Serializing data not possible for type: "object" with constructor: "'+op.constructor.name+'"]':'[IndexedDBLog: Serializing data not possible for type: "object"]':JSON.parse(JSON.stringify(op,(_key,value)=>{if("function"==typeof value)return"[IndexedDBLog: Serializing data not possible for type: 'function']";if("object"==typeof value){return __tchmi_is_instanced_object(value)?value?.constructor?.name?'[IndexedDBLog: Serializing data not possible for type: "object" with constructor: "'+value.constructor.name+'"]':"[IndexedDBLog: Serializing data not possible for type: 'object']":value}return value}))}else null!==op&&"function"==typeof op&&(op='[IndexedDBLog: Serializing data not possible for type: "function"]')}catch(e){op=`[IndexedDBLog: Serializing data failed with an exception${e instanceof Error?": "+e.toString():""}]`}optionalParametersPrepared.push(op)}this.__webworker?this.__webworker.postMessage({command:"add",entry:{timespan,type,message,optionalParameters:optionalParametersPrepared}}):this.__persistentLogCache.push({timespan,type,message,optionalParameters:optionalParametersPrepared})}}})()),__oldTimerName=null,__performanceLogCache=new Map;function escapeSymbolExpressions(text){let expressions=new SymbolExpressionFromText(text).resolveExpressions();for(let expression of expressions){let expressionStr=expression.toString(),expressionStrEscaped=expressionStr.replace(/%s/g,"%%s").replace(/%i/g,"%%i").replace(/%c/g,"%%c");text=text.replace(expressionStr,expressionStrEscaped)}return text}
/**
* Logging functions
* @preserve (Part of the public API)
*/window.addEventListener("error",e=>{window.indexedDB&&(TCHMI_PERSISTENT_LOG_LEVEL<1||__il.add(Date.now(),"Error",e.error.stack))});export class Log{static Prefix=!0;static Force=!1;
/**
* Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
* If the message is an object it will be inspectable in most debug tools. See errorEx if you want to show multiple objects.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 1 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param forceNoPrefix If set the date will be hidden
* @preserve (Part of the public API)
*/
static error(message,forceNoPrefix=!1){isUnloaded||((TCHMI_CONSOLE_LOG_LEVEL>=1||Log.Force)&&(Log.Prefix&&!forceNoPrefix&&"object"!=typeof message?console.error("["+(new Date).toISOString()+"][Error] "+message):console.error(message)),TCHMI_PERSISTENT_LOG_LEVEL>=1&&window.indexedDB&&(__il.__persistentLogInit(),"string"==typeof message?__il.add(Date.now(),"Error",message):__il.add(Date.now(),"Error","",message)))}
/**
* Prints out an error message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 1 or higher.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 1 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/static errorEx(message,...optionalParameters){if(!isUnloaded){if(TCHMI_CONSOLE_LOG_LEVEL>=1||Log.Force){let messageEscaped=message;optionalParameters&&optionalParameters.length>0&&(messageEscaped=escapeSymbolExpressions(message)),Log.Prefix?console.error("["+(new Date).toISOString()+"][Error] "+messageEscaped,...optionalParameters):console.error(messageEscaped,...optionalParameters)}TCHMI_PERSISTENT_LOG_LEVEL>=1&&window.indexedDB&&(__il.__persistentLogInit(),__il.add(Date.now(),"Error",message,...optionalParameters))}}
/**
* Prints out a warning message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
* If the message is an object it will be inspectable in most debug tools. See warnEx if you want to show multiple objects.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 2 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param forceNoPrefix If set the date will be hidden
* @preserve (Part of the public API)
*/static warn(message,forceNoPrefix=!1){isUnloaded||((TCHMI_CONSOLE_LOG_LEVEL>=2||Log.Force)&&(Log.Prefix&&!forceNoPrefix&&"object"!=typeof message?console.warn("["+(new Date).toISOString()+"][Warning] "+message):console.warn(message)),TCHMI_PERSISTENT_LOG_LEVEL>=2&&window.indexedDB&&(__il.__persistentLogInit(),"string"==typeof message?__il.add(Date.now(),"Warning",message):__il.add(Date.now(),"Warning","",message)))}
/**
* Prints out a warning message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 2 or higher.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 2 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/static warnEx(message,...optionalParameters){if(!isUnloaded){if(TCHMI_CONSOLE_LOG_LEVEL>=2||Log.Force){let messageEscaped=message;optionalParameters&&optionalParameters.length>0&&(messageEscaped=escapeSymbolExpressions(message)),Log.Prefix?console.warn("["+(new Date).toISOString()+"][Warning] "+messageEscaped,...optionalParameters):console.warn(messageEscaped,...optionalParameters)}TCHMI_PERSISTENT_LOG_LEVEL>=2&&window.indexedDB&&(__il.__persistentLogInit(),__il.add(Date.now(),"Warning",message,...optionalParameters))}}
/**
* Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
* If the message is an object it will be inspectable in most debug tools. See infoEx if you want to show multiple objects.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 3 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param forceNoPrefix If set the date will be hidden
* @preserve (Part of the public API)
*/static info(message,forceNoPrefix=!1){isUnloaded||((TCHMI_CONSOLE_LOG_LEVEL>=3||Log.Force)&&(Log.Prefix&&!forceNoPrefix&&"object"!=typeof message?console.info("["+(new Date).toISOString()+"][Info] "+message):console.info(message)),TCHMI_PERSISTENT_LOG_LEVEL>=3&&window.indexedDB&&(__il.__persistentLogInit(),"string"==typeof message?__il.add(Date.now(),"Info",message):__il.add(Date.now(),"Info","",message)))}
/**
* Prints out an info message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 3 or higher.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 3 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/static infoEx(message,...optionalParameters){if(!isUnloaded){if(TCHMI_CONSOLE_LOG_LEVEL>=3||Log.Force){let messageEscaped=message;optionalParameters&&optionalParameters.length>0&&(messageEscaped=escapeSymbolExpressions(message)),Log.Prefix?console.info("["+(new Date).toISOString()+"][Info] "+messageEscaped,...optionalParameters):console.info(messageEscaped,...optionalParameters)}TCHMI_PERSISTENT_LOG_LEVEL>=3&&window.indexedDB&&(__il.__persistentLogInit(),__il.add(Date.now(),"Info",message,...optionalParameters))}}
/**
* Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
* If the message is an object it will be inspectable in most debug tools. See debugEx if you want to show multiple objects.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 4 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param forceNoPrefix If set the date will be hidden
* @preserve (Part of the public API)
*/static debug(message,forceNoPrefix=!1){isUnloaded||((TCHMI_CONSOLE_LOG_LEVEL>=4||Log.Force)&&(Log.Prefix&&!forceNoPrefix&&"object"!=typeof message?console.log("["+(new Date).toISOString()+"][Debug] "+message):console.log(message)),TCHMI_PERSISTENT_LOG_LEVEL>=4&&window.indexedDB&&(__il.__persistentLogInit(),"string"==typeof message?__il.add(Date.now(),"Debug",message):__il.add(Date.now(),"Debug","",message)))}
/**
* Prints out a debug message in the browsers console if TCHMI_CONSOLE_LOG_LEVEL is set to 4 or higher.
* Writes to browser database (IndexedDB) if TCHMI_PERSISTENT_LOG_LEVEL is set to 4 or higher.
* See "client" page in config page of the server for live overrides.
* @param message The text which will be printed out in the browsers console and/or written to the browser database.
* @param optionalParameters Optional parameters
* @preserve (Part of the public API)
*/static debugEx(message,...optionalParameters){if(!isUnloaded){if(TCHMI_CONSOLE_LOG_LEVEL>=4||Log.Force){let messageEscaped=message;optionalParameters&&optionalParameters.length>0&&(messageEscaped=escapeSymbolExpressions(message)),Log.Prefix?console.log("["+(new Date).toISOString()+"][Debug] "+messageEscaped,...optionalParameters):console.log(messageEscaped,...optionalParameters)}TCHMI_PERSISTENT_LOG_LEVEL>=4&&window.indexedDB&&(__il.__persistentLogInit(),__il.add(Date.now(),"Debug",message,...optionalParameters))}}static performanceLog(timerName){-1===TCHMI_CONSOLE_LOG_LEVEL&&(window.console&&window.console.timeEnd&&null!==__oldTimerName&&window.console.timeEnd(__oldTimerName),window.console&&window.console.time&&(null!==timerName&&window.console.time(timerName),__oldTimerName=timerName))}static performanceLogStart(timerName){-1===TCHMI_CONSOLE_LOG_LEVEL&&window.console&&window.console.time&&window.console.time(timerName),-1===TCHMI_PERSISTENT_LOG_LEVEL&&window.indexedDB&&window.performance&&window.performance.now&&(__performanceLogCache.set(timerName,window.performance.now()),__il.__persistentLogInit(),__il.add(Date.now(),"Debug","Timer: '"+timerName+"' started."))}static performanceLogEnd(timerName){if(-1===TCHMI_CONSOLE_LOG_LEVEL&&window.console&&window.console.timeEnd&&window.console.timeEnd(timerName),-1===TCHMI_PERSISTENT_LOG_LEVEL&&window.indexedDB&&window.performance&&window.performance.now){let start=__performanceLogCache.get(timerName);if(__performanceLogCache.delete(timerName),void 0!==start){let end=window.performance.now();__il.__persistentLogInit(),__il.add(Date.now(),"Debug","Timer: '"+timerName+"' finished after "+(end-start)+"ms.")}}}
/**
* Builds a formatted message of hierarchical error objects.
* @param error Error object to show nicely
* @preserve (Part of the public API)
*/static buildMessage(error){const __buildMessage=function(error,level){if(!error)return"";let res="",indention=" ".repeat(level+1);if(error.code&&(res+="Code: "+error.code+"/0x"+error.code.toString(16)),error.message&&(res+=", Message: "+error.message),error.reason&&(res+="\n"+indention+"Reason: "+error.reason),error.exception&&(res+="\n"+indention+"Exception: "+error.exception.toString()),error.domain&&(res+="\n"+indention+"Domain: "+error.domain),void 0!==error.errors&&error.errors.length){res+="\n"+indention+"as result of: ";for(let[index,errorItem]of error.errors.entries())res+=__buildMessage(errorItem,level+1),index!==error.errors.length-1&&(res+="\n"+indention)}return res};return __buildMessage(error,0)}}!function(Log){Log.Controls||(Log.Controls={})}(Log||(Log={})),TcHmi.Log=Log,TcHmi.Log.Controls=ControlsLog;Log.Prefix,Log.Force,Log.error,Log.errorEx,Log.warn,Log.warnEx,Log.info,Log.infoEx,Log.debug,Log.debugEx,Log.performanceLog,Log.performanceLogStart,Log.performanceLogEnd,Log.buildMessage,ControlsLog.error,ControlsLog.warn,ControlsLog.info,ControlsLog.debug;

View File

@@ -0,0 +1,222 @@
/**
* Convenience functionality for dealing with TwinCAT HMI object path syntax.
* @preserve (Part of the public API)
*/
export declare class ObjectPath implements Iterable<string | number> {
/**
* Stores the path as a string. This is only created if the constructor was called with a string or the toString
* method was called. It will be reset to null if the path is modified.
*/
private __pathString;
/**
* Stores the path as an array of property accessors. If the array does not contain any numbers, that will be
* indicated by isTokens.
*/
private __path;
/**
* Create an empty object path.
* @preserve (Part of the public API)
*/
constructor();
/**
* Create an object path instance from a path in string format. A path in string format uses '::' to denote
* object property access and '[]' to denote array element access. For example: 'foo::bar[1]'.
* @param path The path in string format.
* @preserve (Part of the public API)
*/
constructor(path: string);
/**
* Create an object path instance from an array of tokens. In an array of tokens, strings denote object property
* access, while numbers denote array element access. For example: ['foo', 'bar', 1]. To support legacy
* behavior, array element access can also be specified by enclosing a number in square brackets. For example:
* ['foo', 'bar', '[1]'].
* @param tokens The token array.
* @preserve (Part of the public API)
*/
constructor(tokens: (string | number)[]);
/**
* Append the given tokens to the back of the path. A token can be a single object property accessor, a single
* array element accessor using a number or string containing a number enclosed in brackets, or a complete path
* in string format, which will be parsed and its individual parts added to the object path instance.
* @param tokens The tokens to add.
* @returns The new length of the path.
* @preserve (Part of the public API)
*/
push(...tokens: (string | number)[]): number;
/**
* Removes the last property accessor from the back of the path and returns it. Object property accessors are
* returned as strings, while array element accessors are returned as numbers.
* @returns The removed property accessor.
* @preserve (Part of the public API)
*/
pop(): string | number | undefined;
/**
* Removes the last path token from the back of the path and returns it. Object property accessors are returned
* as strings, while array element accessors are returned as strings containing a number enclosed in brackets.
* @returns The removed path token.
* @preserve (Part of the public API)
*/
popAsPathToken(): string | undefined;
/**
* Append the given tokens to the front of the path. A token can be a single object property access, a single
* array element access using a number or string containing a number enclosed in brackets, or a complete path in
* string format, which will be parsed and its individual parts added to the object path instance.
* @param tokens The tokens to add.
* @returns The new length of the path.
* @preserve (Part of the public API)
*/
unshift(...tokens: (string | number)[]): number;
/**
* Removes the first property accessor from the front of the path and returns it. Object property accessors are
* returned as strings, while array element accessors are returned as numbers.
* @returns The removed property accessor.
* @preserve (Part of the public API)
*/
shift(): string | number | undefined;
/**
* Removes the first path token from the front of the path and returns it. Object property accessors are
* returned as strings, while array element accessors are returned as strings containing a number enclosed
* in brackets.
* @returns The removed path token.
* @preserve (Part of the public API)
*/
shiftAsPathToken(): string | undefined;
/**
* Add the given tokens to the front or back of the path.
* @param tokens The tokens to add.
* @param inFront Set to true to add the tokens to the front. Defaults to false.
* @returns The new length.
*/
private __add;
/**
* Removes the first or last token and returns it.
* @param inFront Set to true to remove the first token. Defaults to false.
* @returns The removed token.
*/
private __remove;
/**
* Returns a copy of a section of the path.
* For both start and end, a negative index can be used to indicate an offset from the end of the path.
* For example, -2 refers to the second to last token of the path.
* @param start The beginning index of the specified portion of the path.
* If start is undefined, then the slice begins at index 0.
* @param end The end index of the specified portion of the path. This is exclusive of the token at the index 'end'.
* If end is undefined, then the slice extends to the end of the path.
*/
slice(start?: number, end?: number): ObjectPath;
/**
* Returns the property accessor at the given index.
* @param index The index.
* @returns The property accessor at the given index.
* @preserve (Part of the public API)
*/
get(index: number): number | string | undefined;
/**
* Returns the property accessor at the given index. Array item accessors are returned as a string containing a
* number enclosed in brackets.
* @param index The index.
* @returns The property accessor at the given index.
* @preserve (Part of the public API)
*/
getAsPathToken(index: number): string | undefined;
/**
* The current length of the path.
* @preserve (Part of the public API)
*/
get length(): number;
/**
* Provides an IterableIterator for the object path. Iterates over all property accessors.
* @returns An IterableIterator.
* @preserve (Part of the public API)
*/
[window.Symbol.iterator](): IterableIterator<string | number>;
/**
* Reads the property of the given object or array that is indicated by the object path. Does not create a
* clone.
* @param target The object, array or string to read from.
* @returns The value of the property that was read.
* @preserve (Part of the public API)
*/
readFrom(target: TcHmi.Dictionary<any> | any[] | string): any;
/**
* Writes the given value to the property of the given object or array that is indicated by the object path.
* @param target The object or array to write to.
* @param value The value to write.
* @preserve (Part of the public API)
*/
writeTo(target: TcHmi.Dictionary<any> | any[] | string, value: any): void;
/**
* Applies a single property accessor to the given target. Returns the property that is indicated by the
* property accessor.
* @param target The target to apply the property accessor to.
* @param propertyAccessor The property accessor to apply.
* @returns The property that is indicated by the property accessor.
*/
private __applyPropertyAccessor;
/**
* Returns the path in string format.
* @returns The path in string format.
* @preserve (Part of the public API)
*/
toString(): string;
/**
* Converts the object path to tokens. Object property accessors are defined as strings, array item accessors
* are defined as strings containig a number enclosed in brackets.
* @returns The path in token array format.
* @preserve (Part of the public API)
*/
toPathTokens(): string[];
/**
* Splits the object path into tokens but converts tokens like [0] into 0 which can directly be used as array
* item accessors. Object property accessors are defined as strings.
* @returns The path in property accessors format.
* @preserve (Part of the public API)
*/
toPropertyAccessors(): (string | number)[];
/**
* Splits the object path into tokens.
* @param pathString The string to split.
* @param options Options for the split operation.
* @param options.noArrayBrackets Set to true to convert strings containing numbers in brackets to numbers.
* Defaults to false.
* @returns The path as an array in token or property accessor format.
*/
private __split;
/** Returns a string representation of a function. */
static toString(): string;
/**
* Returns the path in string format.
* @param tokens The path as an array in token or property accessor format.
* @returns The path in string format.
* @preserve (Part of the public API)
*/
static toString(tokens: (string | number)[]): string;
/**
* Converts the object path to tokens. Object property accessors are defined as strings, array item accessors
* are defined as strings containig a number enclosed in brackets.
* @param path The path to convert. A path in string format uses '::' to denote object property access and '[]'
* to denote array element access. For example: 'foo::bar[1]'.
* @returns The path in token array format.
* @preserve (Part of the public API)
*/
static toPathTokens(path: string): string[];
/**
* Splits the object path into tokens but converts tokens like [0] into 0 which can directly be used as array
* item accessors. Object property accessors are defined as strings.
* @param path The path to convert. A path in string format uses '::' to denote object property access and '[]'
* to denote array element access. For example: 'foo::bar[1]'.
* @returns The path in property accessors format.
* @preserve (Part of the public API)
*/
static toPropertyAccessors(path: string): (string | number)[];
}
declare const _ObjectPath: typeof ObjectPath;
type tObjectPath = ObjectPath;
declare global {
namespace TcHmi {
let ObjectPath: typeof _ObjectPath;
type ObjectPath = tObjectPath;
}
}
export {};
//# sourceMappingURL=ObjectPath.d.ts.map

View File

@@ -0,0 +1,120 @@
/**
* Convenience functionality for dealing with TwinCAT HMI object path syntax.
* @preserve (Part of the public API)
*/
export class ObjectPath{__pathString=null;__path;constructor(pathOrTokens){if("string"==typeof pathOrTokens){this.__pathString=pathOrTokens;const path=this.__split(this.__pathString,{noArrayBrackets:!0});this.__path={path,isPathTokens:!path.some(token=>"number"==typeof token)}}else if(pathOrTokens){for(const token of pathOrTokens)if("string"==typeof token){if(0===token.length)throw new Error(`Invalid token '${token}' found in token array '${JSON.stringify(pathOrTokens)}'. Empty string tokens are not allowed.`);if(token.includes("::"))throw new Error(`Invalid token '${token}' found in token array '${JSON.stringify(pathOrTokens)}'. The sequence '::' is not allowed in tokens because this is the token separator.`);if(token.includes("]["))throw new Error(`Invalid token '${token}' found in token array '${JSON.stringify(pathOrTokens)}'. One token cannot contain more than one array element accessor.`)}this.__path={path:[],isPathTokens:!0},this.push(...pathOrTokens)}else this.__path={path:[],isPathTokens:!0}}
/**
* Append the given tokens to the back of the path. A token can be a single object property accessor, a single
* array element accessor using a number or string containing a number enclosed in brackets, or a complete path
* in string format, which will be parsed and its individual parts added to the object path instance.
* @param tokens The tokens to add.
* @returns The new length of the path.
* @preserve (Part of the public API)
*/push(...tokens){return this.__add(tokens)}
/**
* Removes the last property accessor from the back of the path and returns it. Object property accessors are
* returned as strings, while array element accessors are returned as numbers.
* @returns The removed property accessor.
* @preserve (Part of the public API)
*/pop(){return this.__remove()}
/**
* Removes the last path token from the back of the path and returns it. Object property accessors are returned
* as strings, while array element accessors are returned as strings containing a number enclosed in brackets.
* @returns The removed path token.
* @preserve (Part of the public API)
*/popAsPathToken(){const token=this.__remove();return"number"==typeof token?`[${token}]`:token}
/**
* Append the given tokens to the front of the path. A token can be a single object property access, a single
* array element access using a number or string containing a number enclosed in brackets, or a complete path in
* string format, which will be parsed and its individual parts added to the object path instance.
* @param tokens The tokens to add.
* @returns The new length of the path.
* @preserve (Part of the public API)
*/unshift(...tokens){return this.__add(tokens,!0)}
/**
* Removes the first property accessor from the front of the path and returns it. Object property accessors are
* returned as strings, while array element accessors are returned as numbers.
* @returns The removed property accessor.
* @preserve (Part of the public API)
*/shift(){return this.__remove(!0)}
/**
* Removes the first path token from the front of the path and returns it. Object property accessors are
* returned as strings, while array element accessors are returned as strings containing a number enclosed
* in brackets.
* @returns The removed path token.
* @preserve (Part of the public API)
*/shiftAsPathToken(){const token=this.__remove(!0);return"number"==typeof token?`[${token}]`:token}__add(tokens,inFront=!1){if(0===tokens.length)return this.__path.path.length;this.__pathString=null,tokens=tokens.flatMap(token=>"string"==typeof token?this.__split(token,{noArrayBrackets:!0}):token);for(const token of tokens)if("number"==typeof token&&(this.__path.isPathTokens=!1,Number.isNaN(token)||!Number.isFinite(token)))throw new Error(`Invalid token ${token} found. Only finite numbers are allowed as array element accessors.`);return inFront?this.__path.path.unshift(...tokens):this.__path.path.push(...tokens),this.__path.path.length}__remove(inFront=!1){if(0===this.length)return;this.__pathString=null;const token=inFront?this.__path.path.shift():this.__path.path.pop();return this.__path.path.some(token=>"number"==typeof token)||(this.__path.isPathTokens=!0),token}slice(start,end){return new ObjectPath(this.__path.path.slice(start,end))}
/**
* Returns the property accessor at the given index.
* @param index The index.
* @returns The property accessor at the given index.
* @preserve (Part of the public API)
*/get(index){return this.__path.path[index]}
/**
* Returns the property accessor at the given index. Array item accessors are returned as a string containing a
* number enclosed in brackets.
* @param index The index.
* @returns The property accessor at the given index.
* @preserve (Part of the public API)
*/getAsPathToken(index){const token=this.__path.path[index];return"number"==typeof token?`[${token}]`:token}
/**
* The current length of the path.
* @preserve (Part of the public API)
*/get length(){return this.__path.path.length}
/**
* Provides an IterableIterator for the object path. Iterates over all property accessors.
* @returns An IterableIterator.
* @preserve (Part of the public API)
*/[window.Symbol.iterator](){return this.__path.path[window.Symbol.iterator]()}
/**
* Reads the property of the given object or array that is indicated by the object path. Does not create a
* clone.
* @param target The object, array or string to read from.
* @returns The value of the property that was read.
* @preserve (Part of the public API)
*/readFrom(target){for(const propertyAccessor of this)target=this.__applyPropertyAccessor(target,propertyAccessor);return target}
/**
* Writes the given value to the property of the given object or array that is indicated by the object path.
* @param target The object or array to write to.
* @param value The value to write.
* @preserve (Part of the public API)
*/writeTo(target,value){const iterator=this[window.Symbol.iterator]();let current=iterator.next();if(current.done)throw new Error("Could not write with empty path. The path must contain at least one token or property accessor to be able to write.");let next=iterator.next();for(;!next.done;)target=this.__applyPropertyAccessor(target,current.value),current=next,next=iterator.next();if(Array.isArray(target)){if("number"!=typeof current.value)throw new Error(`Could not write to property ${current.value} of array. Arrays can only be written to by numeric indices.`);target[current.value]=value}else{if(null===target)throw new Error(`Could not write to property ${current.value} of null.`);if("object"!=typeof target)throw new Error(`Could not write to property ${current.value} of type ${typeof target}.`);if("string"!=typeof current.value)throw new Error(`Could not write to property ${current.value} of object. Objects can only be written to by object property accessors, which must be strings and cannot be numbers enclosed in brackets.`);target[current.value]=value}}__applyPropertyAccessor(target,propertyAccessor){const targetType=typeof target;if(Array.isArray(target)||"string"===targetType){if("number"==typeof propertyAccessor||"length"===propertyAccessor)return target[propertyAccessor];throw new Error(`Could not read property ${propertyAccessor} of array or string. Arrays or strings can only be read by numeric indices, or their length property.`)}if(null===target)throw new Error(`Could not read property ${propertyAccessor} of null.`);if("object"===targetType){if("string"==typeof propertyAccessor)return target[propertyAccessor];throw new Error(`Could not read property ${propertyAccessor} of object. Objects can only be read by object property accessors, which must be strings and cannot be numbers enclosed in brackets.`)}throw new Error(`Could not read property ${propertyAccessor} of type ${targetType}.`)}
/**
* Returns the path in string format.
* @returns The path in string format.
* @preserve (Part of the public API)
*/toString(){if(this.__pathString)return this.__pathString;this.__pathString="";for(const token of this.__path.path)"string"==typeof token?0===this.__pathString.length?this.__pathString+=token:this.__pathString+="::"+token:this.__pathString+="["+token+"]";return this.__pathString}
/**
* Converts the object path to tokens. Object property accessors are defined as strings, array item accessors
* are defined as strings containig a number enclosed in brackets.
* @returns The path in token array format.
* @preserve (Part of the public API)
*/toPathTokens(){return this.__path.isPathTokens?this.__path.path:this.__path.path.map(token=>"number"==typeof token?`[${token}]`:token)}
/**
* Splits the object path into tokens but converts tokens like [0] into 0 which can directly be used as array
* item accessors. Object property accessors are defined as strings.
* @returns The path in property accessors format.
* @preserve (Part of the public API)
*/toPropertyAccessors(){return this.__path.path}__split(pathString,options){const res=[],noArrayBrackets=options?.noArrayBrackets??!1,tokens=pathString.split("::");for(let i=0,ii=tokens.length;i<ii;i++){let token=tokens[i];if(i>0&&0===token.length)throw new Error(`Invalid token '${token}' found in path '${pathString}'. Empty string tokens are not allowed. At least one character has to occurr before and after a '::' sequence which is not at the beginning of the path.`);let temp="",bracketsContent="",bracketsOpened=0,bracketsClosed=0;for(let j=0,jj=token.length;j<jj;j++){let c=token[j];if("["===c&&temp.length>0){if(bracketsOpened++,bracketsOpened>bracketsClosed+1)throw new Error(`Invalid token '${token}' found in path '${pathString}'. Multiple opening brackets before closing bracket.`);bracketsContent="",res.push(temp),temp="",noArrayBrackets||(temp+=c)}else if("]"===c){if(bracketsClosed++,bracketsOpened<bracketsClosed)throw new Error(`Invalid token '${token}' found in path '${pathString}'. Unexpected closing bracket.`);if(token.length>j+1&&"["!==token[j+1])throw new Error(`Invalid token '${token}' found in path '${pathString}'. Unexpected token after closing bracket.`);if(noArrayBrackets){let num=parseInt(bracketsContent,10);if(Number.isNaN(num))throw new Error(`Invalid token '${token}' found in path '${pathString}'. Unexpected token in brackets. Only numeric indices are allowed.`);res.push(num)}else temp+=c,res.push(temp);temp=""}else{if("["===c){if(bracketsOpened++,bracketsOpened>bracketsClosed+1)throw new Error(`Invalid token '${token}' found in path '${pathString}'. Multiple opening brackets before closing bracket.`);bracketsContent=""}(!noArrayBrackets||noArrayBrackets&&"["!==c&&"]"!==c)&&(temp+=c),"["!==c&&"]"!==c&&(bracketsContent+=c),j===jj-1&&temp.length>0&&res.push(temp)}}if(bracketsOpened>bracketsClosed)throw new Error(`Invalid token '${token}' found in path '${pathString}'. Missing closing bracket.`)}return res}
/**
* Returns the path in string format.
* @param tokens The path as an array in token or property accessor format.
* @returns The path in string format.
* @preserve (Part of the public API)
*/static toString(tokens){if(0===arguments.length)return Object.toString.call(this);return new ObjectPath(tokens).toString()}
/**
* Converts the object path to tokens. Object property accessors are defined as strings, array item accessors
* are defined as strings containig a number enclosed in brackets.
* @param path The path to convert. A path in string format uses '::' to denote object property access and '[]'
* to denote array element access. For example: 'foo::bar[1]'.
* @returns The path in token array format.
* @preserve (Part of the public API)
*/static toPathTokens(path){return new ObjectPath(path).toPathTokens()}
/**
* Splits the object path into tokens but converts tokens like [0] into 0 which can directly be used as array
* item accessors. Object property accessors are defined as strings.
* @param path The path to convert. A path in string format uses '::' to denote object property access and '[]'
* to denote array element access. For example: 'foo::bar[1]'.
* @returns The path in property accessors format.
* @preserve (Part of the public API)
*/static toPropertyAccessors(path){return new ObjectPath(path).toPropertyAccessors()}}TcHmi.ObjectPath=ObjectPath;

View File

@@ -0,0 +1,85 @@
/**
* @preserve (Part of the public API)
*/
export declare class ObjectResolver<T extends object | null> {
/**
* Creates a new ObjectResolver
* @param obj Object to resolve
* @param parentControl When a reference to a logical parent control is defined, calls to resolve or watch will be delayed, when they contain a symbol reference of type Control,
* until the controls parent partial (View, Content, UserControl) is initialized to guarantee that symbols of type Control which exist in this scope are available.
*/
constructor(obj: TcHmi.AllowSymbolExpressionsAsValues<T>, parentControl?: TcHmi.Controls.System.baseTcHmiControl | null);
/**
* Creates a new ObjectResolver
* @param obj Object to resolve
* @param options Options
* @param options.schema Schema that describes the expected object structure and types.
* @param options.parentControl When a reference to a logical parent control is defined, calls to resolve or watch will be delayed, when they contain a symbol reference of type Control,
* until the controls parent partial (View, Content, UserControl) is initialized to guarantee that symbols of type Control which exist in this scope are available.
*/
constructor(obj: TcHmi.AllowSymbolExpressionsAsValues<T>, options?: IOptions | null);
/**
* Resolves all symbol expression refs in the current object.
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
resolve(callback?: (this: void, data: IResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Watches for changes of symbol expressions in the current object und returns the object with updated values.
* Returns a destroy function to remove the watch.
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
watch(callback?: (this: void, data: IWatchResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Writes to the current object instance and reflects changes to possibly existing symbol expressions.
* @param obj The new object value
* @param dirtyPaths Paths in the object that have been changed. If not defined changes will be detected automatically.
* @param callback Will be called when the object (and all symbols mentioned within the object) have completed writing.
*/
write(obj: TcHmi.AllowSymbolExpressionsAsValues<T>, dirtyPaths?: string[], callback?: (data: TcHmi.IResultObject) => void): void;
/**
* Destroys the current object.
* @preserve (Part of the public API)
*/
destroy(): void;
}
export interface IWatchResultObject<T extends object | null> extends TcHmi.IResultObject {
value?: T;
/** A destroy function to remove the watch. Only set if there is no error. */
destroy?: TcHmi.DestroyFunction;
}
export interface IResultObject<T extends object | null> extends TcHmi.IResultObject {
value?: T;
}
export interface IOptions {
/**
* When a reference to a logical parent control is defined, calls to resolve or watch will be delayed, when they contain a symbol reference of type Control,
* until the controls parent partial (View, Content, UserControl) is initialized to guarantee that symbols of type Control which exist in this scope are available.
*/
parentControl?: TcHmi.Controls.System.baseTcHmiControl | null;
/** Schema that describes the expected object structure and types. When defined "type" will be ignored. */
schema?: TcHmi.JsonSchema;
/**
* TwinCAT HMI Type Definition string that will be used to resolve the related schema. Will be ignored when "schema" is defined.
*/
type?: string;
}
declare const _ObjectResolver: typeof ObjectResolver;
type tObjectResolver<T extends object | null> = ObjectResolver<T>;
type tIWatchResultObject<T extends object | null> = IWatchResultObject<T>;
type tIResultObject<T extends object | null> = IResultObject<T>;
type tIOptions = IOptions;
declare global {
namespace TcHmi {
let ObjectResolver: typeof _ObjectResolver;
type ObjectResolver<T extends object | null> = tObjectResolver<T>;
namespace ObjectResolver {
type IWatchResultObject<T extends object | null> = tIWatchResultObject<T>;
type IResultObject<T extends object | null> = tIResultObject<T>;
type IOptions = tIOptions;
}
}
}
export {};
//# sourceMappingURL=ObjectResolver.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,69 @@
import * as Server from './Server.js';
/**
* Get information about a specific license by sending a request to the TwinCAT license server.
* @param licenseId id to check
* @param callback Will be called after request.
*/
export declare function checkLicense(licenseId: string, callback?: null | ((this: void, data: ICheckLicenseResult) => void)): TcHmi.IErrorDetails;
/**
* Get information about a specific license by sending a request to the TwinCAT license server with given connection parameter.
* @param licenseId id to check
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
*/
export declare function checkLicenseEx(licenseId: string, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: ICheckLicenseResult) => void)): TcHmi.IErrorDetails;
export interface ICheckLicenseResult extends TcHmi.IResultObject {
/** License instance count */
count?: number;
/** Expiration time as ISO-8601 time string ('1804-03-05T00:25:27.70955161Z'). */
expireTimeUTC?: string;
/**
* License result (Valid if >= 0, Invalid if < 0)
* Can be compared to enum ADS.CheckLicenseResult
*/
result?: number | CheckLicenseResult;
}
export declare enum CheckLicenseResult {
/** Valid license */
S_VALID = 0,
/** License generated by System Manager (e.g. 7 day trial license) */
S_PENDING = 515,
/** No license found (unknown license id) */
E_LICENSENOTFOUND = -403769124,
/** License expired */
E_LICENSEEXPIRED = -403769125,
/** License exceeded */
E_LICENSEEXCEEDED = -403769126,
/** License invalid */
E_LICENSEINVALID = -403769127,
/** License invalid system id */
E_LICENSESYSTEMID = -403769128,
/** License not time limited */
E_LICENSENOTIMELIMIT = -403769129,
/** License issue time in the future */
E_LICENSEFUTUREISSUE = -403769130,
/** License time period to long */
E_LICENSETIMETOLONG = -403769131
}
declare const _checkLicense: typeof checkLicense;
declare const _checkLicenseEx: typeof checkLicenseEx;
declare const _CheckLicenseResult: typeof Server.ADS.CheckLicenseResult;
type tICheckLicenseResult = ICheckLicenseResult;
type tCheckLicenseResult = CheckLicenseResult;
declare global {
namespace TcHmi.Server {
/**
* Provides functions of the ADS server extension.
* @preserve (Part of the public API)
*/
namespace ADS {
const checkLicense: typeof _checkLicense;
const checkLicenseEx: typeof _checkLicenseEx;
let CheckLicenseResult: typeof _CheckLicenseResult;
type ICheckLicenseResult = tICheckLicenseResult;
type CheckLicenseResult = tCheckLicenseResult;
}
}
}
export {};
//# sourceMappingURL=Server.ADS.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,43 @@
import * as Server from './Server.js';
/**
* Creates a custom audit trail log entry.
* @param entry The data for the custom audit trail log entry.
* @param callback Will be called after request.
*/
export declare function createAuditLogEntry(entry: AuditLogEntry, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): void;
/**
* Creates a custom audit trail log entry.
* @param entry The data for the custom audit trail log entry.
* @param options Optional options
* @param callback Will be called after request.
* @returns
*/
export declare function createAuditLogEntryEx(entry: AuditLogEntry, options?: {
requestOptions: Server.IRequestOptions | null;
} | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): void;
export interface AuditLogEntry {
name: string;
contextDomain?: string;
comment?: string;
data?: any;
}
declare const _createAuditLogEntry: typeof createAuditLogEntry;
declare const _createAuditLogEntryEx: typeof createAuditLogEntryEx;
type tAuditLogEntry = AuditLogEntry;
declare global {
namespace TcHmi.Server {
/**
* Provides functions for the Audit Trail extension.
* @preserve (Part of the public API)
*/
namespace AuditTrail {
const createAuditLogEntry: typeof _createAuditLogEntry;
const createAuditLogEntryEx: typeof _createAuditLogEntryEx;
namespace CreateAuditLogEntry {
type AuditLogEntry = tAuditLogEntry;
}
}
}
}
export {};
//# sourceMappingURL=Server.AuditTrail.d.ts.map

View File

@@ -0,0 +1 @@
import*as Server from"./Server.js";import*as Events from"./Server.Events.js";export function createAuditLogEntry(entry,callback){createAuditLogEntryEx(entry,null,callback)}export function createAuditLogEntryEx(entry,options,callback){if(!entry)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_PARAMETER_INVALID,details:{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:'Parameter: "entry" must not be empty or undefined or null.',domain:"TcHmi.Server.AuditTrail"}});let requestOptions=options?.requestOptions??null;Server.requestEx({requestType:"ReadWrite",commands:[{symbol:"CreateEvent",version:2,writeValue:{name:"AuditLogEntry",domain:"TcHmiAuditTrail",payloadType:Events.Type.Payload,payload:{name:entry.name,contextDomain:entry.contextDomain??"TcHmiFramework",comment:entry.comment??"",data:entry.data}}}]},requestOptions,Server.handleResponse({success:()=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})},error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,res)}else{let res={error:data.error};data.details&&(res.details=data.details),TcHmi.Callback.callSafeEx(callback,null,res)}}}))}TcHmi.Server??={},TcHmi.Server.AuditTrail={createAuditLogEntry,createAuditLogEntryEx};

View File

@@ -0,0 +1,70 @@
import type * as Server from './Server.js';
/**
* Watches on specific domain.
* @param name Name of the domain to watch
* @param callback Callback which is called once and on every change
*/
export declare function watch(name: string, callback?: (data: IServerWatchResultObject<IDomainInfo>) => void): TcHmi.DestroyFunction;
export interface IWatchResultObject<T = any> extends TcHmi.IResultObject {
value?: T;
processedStart?: string;
processedEnd?: string;
dirtyPaths?: string[];
/** A destroy function to remove the watch. Only set if there is no error. */
destroy?: TcHmi.DestroyFunction;
}
export interface IServerWatchResultObject<T = any> extends IWatchResultObject<T> {
response?: Server.IMessage<T>;
}
/** IDomainInfo */
export interface IDomainInfo {
error?: TcHmi.IErrorDetails;
/** Shows if extension can be used for user management. */
authExtension: boolean;
/** The version of the extension's configuration. */
configVersion: string;
/** Indicates whether a debugger is or will be attached to the extension. */
debuggerAttached?: boolean;
/** Name of the extension. */
extension: string;
/** A more readable name version of the extension name. */
friendlyName: string;
/** The globally unique identifier associated with the extension. */
guid?: string;
/** Indicate the extension is license status. */
licensed?: boolean;
/** Shows if the domain refers to a remote server. */
remote?: boolean;
/** Shows if the extension is considered to be required. */
required?: boolean;
/** Shows the current state of the extension. */
state?: 'NotLoaded' | 'Loaded' | 'Initialized' | 'Invalid' | 'Disabled' | 'Unloading' | 'NotRunning';
/** Indicate the extension is a customer extension. */
thirdParty?: boolean;
/** Shows last update time of the config. */
updated?: string;
/** The version of the extension. */
version: string;
/** Indicates under which circumstances the extension configuration should be visible. */
visibility?: 'AlwaysShow' | 'AlwaysHide' | 'HideInEngineering';
}
declare const _watch: typeof watch;
type tIWatchResultObject<T = any> = IWatchResultObject<T>;
type tIServerWatchResultObject<T = any> = IServerWatchResultObject<T>;
type tIDomainInfo = IDomainInfo;
declare global {
namespace TcHmi.Server {
/**
* Provides functions for monitoring domains / extensions of the server.
* @preserve (Part of the public API)
*/
namespace Domains {
let watch: typeof _watch;
type IWatchResultObject<T = any> = tIWatchResultObject<T>;
type IServerWatchResultObject<T = any> = tIServerWatchResultObject<T>;
type IDomainInfo = tIDomainInfo;
}
}
}
export {};
//# sourceMappingURL=Server.Domains.d.ts.map

View File

@@ -0,0 +1 @@
export function watch(name,callback){let destroy,s=new TcHmi.Symbol("%s%ListDomains|SubscriptionMode=Change%/s%");return destroy=s.watchEx(null,data=>{destroy||(destroy=data.destroy),data&&data.error===TcHmi.Errors.NONE?data.value&&data.value[name]?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:tchmi_clone_object(data.value[name]),destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN,details:{code:TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_DOMAIN_UNKNOWN],reason:"Domain is unknown!",domain:"TcHmi.Server.Domains",errors:data.details?[data.details]:void 0}}):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})}),()=>{destroy&&(destroy(),destroy=void 0),s?.destroy(),s=null}}TcHmi.Server??={},TcHmi.Server.Domains={watch};

View File

@@ -0,0 +1,273 @@
import * as Server from './Server.js';
import { Filter as SystemFilter } from '../System/Filter.js';
/**
* Confirm an alarm.
* @param alarm The alarm to confirm.
* @param callback Asynchronous response callback which will be raised when the operation has finished.
*/
export declare function confirmAlarm(alarm: Alarm, callback?: (this: void, data: TcHmi.IResultObject) => void): void;
/**
* Export events.
* @param exportOptions An object containing the export settings.
* @param exportOptions.filter The filter to apply for the export.
* @param exportOptions.filename Optional filename for the exported file.
* @param callback Asynchronous response callback which will be raised when the operation has finished.
*/
export declare function exportEvents(exportOptions: {
filter?: TcHmi.Filter | null;
filename?: string;
}, callback?: (error: TcHmi.IResultObject) => void): void;
/**
* DEPRECATED
* Please use a subscription to the ListEvents server symbol instead, otherwise a high volume of events will lead to drastically reduced client performance.
* Register a consumer for events.
* Every registration will be queued for 200 ms. This can be forced via the flushRegistrations API.
* @param filter The filter of this consumer. Only events matching the filter will be passed on to the consumer.
* @param callbacks The callbacks to pass events back to the consumer. Consumers can specify one callback for listing events and one for the event subscription.
* @param callbacks.list The callback that is called when the event list has new data.
* @param callbacks.subscription The callback that is called when the subscription has new data.
* @param doneCallback The callback that is called when the registration has finished.
* @deprecated Please use a subscription to the ListEvents server symbol instead.
*/
export declare function registerConsumer(filter: TcHmi.Filter | null, callbacks: {
list?: (this: void, data: ListResult) => void;
subscription?: (this: void, data: SubscriptionResult) => void;
}, doneCallback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.DestroyFunction;
/**
* Flush the registrations of consumers that have been added via registerConsumer.
*/
export declare function flushRegistrations(): void;
/**
* Parses a raw server event and returns an object for consumption by controls etc.
* @param rawEvent The raw event to parse.
*/
export declare function parseServerEvent(rawEvent: RawServerEvent): Message | Alarm | PayloadEvent;
/**
* Creates a message or payload event on the server.
* @param event The event to create.
* @param callback Is called when the server responds to the CreateEvent request.
*/
export declare function createEvent(event: TcHmi.SelectableOptional<Message, 'sourceDomain'> | PayloadEvent, callback?: (this: void, data: TcHmi.IResultObject) => void): void;
interface Consumer {
filter: SystemFilter;
rawFilter: TcHmi.Filter | null;
activeAlarmIds: (number | string)[];
listCallback?: (data: ListResult) => void;
subscriptionCallback?: (data: SubscriptionResult) => void;
registration: {
listPending: boolean;
subscriptionPending: boolean;
callback?: null | ((this: void, data: TcHmi.IResultObject) => void);
};
}
export interface ListResult<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> extends TcHmi.IResultObject {
events?: Event<TPayload, TParams>[];
}
export interface SubscriptionResult<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> extends TcHmi.IResultObject {
event?: Event<TPayload, TParams>;
changeType?: ChangeType;
removedByFilter?: boolean;
}
export declare enum Type {
Message = 0,
Alarm = 1,
Payload = 2
}
export declare enum Severity {
Verbose = 0,
Info = 1,
Warning = 2,
Error = 3,
Critical = 4
}
export declare enum AlarmState {
Raised = 0,
Confirmed = 1,
Cleared = 2,
ClearedAndConfirmed = 3,
Invalid = 4
}
export declare enum ConfirmationState {
NotSupported = 0,
NotRequired = 1,
WaitForConfirmation = 2,
Confirmed = 3,
Reset = 4
}
interface EventBase {
/** The type of event */
type: Type;
/** The domain of the event */
domain: string;
/** The name of the event */
name: string;
timeReceived: Date;
sessionId?: string;
}
interface MessageOrAlarm<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> extends EventBase {
/** The type of event */
type: Type.Message | Type.Alarm;
/** The severity of the event */
severity: Severity;
/** DEPRECATED! This used to be used to differentiate the domain in which the event originated vs the domain which was responsible for delivering it. It now always holds the same value as domain.
* @deprecated This used to be used to differentiate the domain in which the event originated vs the domain which was responsible for delivering it. It now always holds the same value as domain.
*/
sourceDomain: string;
/** The localized text of the event */
text?: string | undefined;
/** The time at which the event was triggered */
timeRaised: Date;
/** Parameters set by the trigger of the event */
params: T;
}
export interface Message<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> extends MessageOrAlarm<T> {
/** The type of event */
type: Type.Message;
}
export interface Alarm<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> extends MessageOrAlarm<T> {
/** The type of event */
type: Type.Alarm;
/** A unique value with which this alarm can be identified */
id: number;
/** The time at which the alarm was confirmed by the trigger as no longer acute */
timeCleared: Date | null;
/** The time at which the alarm was acknowledged by the user */
timeConfirmed: Date | null;
alarmState: AlarmState;
/** The current confirmation status */
confirmationState: ConfirmationState;
}
export interface PayloadEvent<T = any> extends EventBase {
/** The type of event */
type: Type.Payload;
payload?: T;
}
export declare enum ChangeType {
AlarmRaised = 0,
AlarmChanged = 1,
AlarmDisposed = 2,
MessageSent = 3
}
export type Event<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = Message<TParams> | Alarm<TParams> | PayloadEvent<TPayload>;
export interface RawServerEvent {
domain: string;
name: string;
timeReceived: string;
payload?: RawServerMessage | RawServerAlarm | any;
payloadType?: Type;
localizedString?: string;
changeType?: ServerAlarmChangeType;
sessionId?: string;
}
export interface RawServerMessage {
name: string;
domain: string;
severity: Severity;
timeRaised: string;
params: TcHmi.Dictionary<any>;
}
export interface RawServerAlarm extends RawServerMessage {
id: number;
timeCleared: string | null;
timeConfirmed: string | null;
alarmState: AlarmState;
confirmationState: ConfirmationState;
}
export declare enum ServerAlarmChangeType {
Raise = 0,
Change = 1,
Dispose = 2
}
/**
* Type guard for alarms. Returns true if the given candidate is a Alarm, false otherwise
* @param value The candidate to test.
*/
export declare function isAlarm(value: Event): value is Alarm;
/**
* Type guard for Messages. Returns true if the given candidate is a Message, false otherwise
* @param value The candidate to test.
*/
export declare function isMessage(value: Event): value is Message;
/**
* Type guard for Payloads. Returns true if the given candidate is a Payload, false otherwise
* @param value The candidate to test.
*/
export declare function isPayload(value: Event): value is PayloadEvent;
declare const _confirmAlarm: typeof confirmAlarm;
declare const _exportEvents: typeof exportEvents;
declare const _registerConsumer: typeof registerConsumer;
declare const _flushRegistrations: typeof flushRegistrations;
declare const _parseServerEvent: typeof parseServerEvent;
declare const _createEvent: typeof createEvent;
declare const _isAlarm: typeof isAlarm;
declare const _isMessage: typeof isMessage;
declare const _isPayload: typeof isPayload;
type tConsumer = Consumer;
type tListResult<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = ListResult<TPayload, TParams>;
type tSubscriptionResult<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = SubscriptionResult<TPayload, TParams>;
declare const _Type: typeof Server.Events.Type;
type tType = Type;
declare const _Severity: typeof Server.Events.Severity;
type tSeverity = Severity;
declare const _AlarmState: typeof Server.Events.AlarmState;
type tAlarmState = AlarmState;
declare const _ConfirmationState: typeof Server.Events.ConfirmationState;
type tConfirmationState = ConfirmationState;
type tEventBase = EventBase;
type tMessageOrAlarm<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = MessageOrAlarm<T>;
type tMessage<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = Message<T>;
type tAlarm<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = Alarm<T>;
type tPayloadEvent<T = any> = PayloadEvent<T>;
declare const _ChangeType: typeof Server.Events.ChangeType;
type tChangeType = ChangeType;
type tEvent<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = Event<TPayload, TParams>;
type tRawServerEvent = RawServerEvent;
type tRawServerMessage = RawServerMessage;
type tRawServerAlarm = RawServerAlarm;
declare const _ServerAlarmChangeType: typeof Server.Events.ServerAlarmChangeType;
type tServerAlarmChangeType = ServerAlarmChangeType;
declare global {
namespace TcHmi.Server {
/**
* Provides functions for monitoring alarms and server events.
* @preserve (Part of the public API)
*/
namespace Events {
const confirmAlarm: typeof _confirmAlarm;
const exportEvents: typeof _exportEvents;
const registerConsumer: typeof _registerConsumer;
const flushRegistrations: typeof _flushRegistrations;
const parseServerEvent: typeof _parseServerEvent;
const createEvent: typeof _createEvent;
const isAlarm: typeof _isAlarm;
const isMessage: typeof _isMessage;
const isPayload: typeof _isPayload;
type Consumer = tConsumer;
type ListResult<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = tListResult<TPayload, TParams>;
type SubscriptionResult<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = tSubscriptionResult<TPayload, TParams>;
let Type: typeof _Type;
type Type = tType;
let Severity: typeof _Severity;
type Severity = tSeverity;
let AlarmState: typeof _AlarmState;
type AlarmState = tAlarmState;
let ConfirmationState: typeof _ConfirmationState;
type ConfirmationState = tConfirmationState;
type EventBase = tEventBase;
type MessageOrAlarm<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = tMessageOrAlarm<T>;
type Message<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = tMessage<T>;
type Alarm<T extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = tAlarm<T>;
type PayloadEvent<T = any> = tPayloadEvent<T>;
let ChangeType: typeof _ChangeType;
type ChangeType = tChangeType;
type Event<TPayload = any, TParams extends TcHmi.Dictionary<any> = TcHmi.Dictionary<any>> = tEvent<TPayload, TParams>;
type RawServerEvent = tRawServerEvent;
type RawServerMessage = tRawServerMessage;
type RawServerAlarm = tRawServerAlarm;
let ServerAlarmChangeType: typeof _ServerAlarmChangeType;
type ServerAlarmChangeType = tServerAlarmChangeType;
}
}
}
export {};
//# sourceMappingURL=Server.Events.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,192 @@
import * as Server from './Server.js';
/**
* Parse the domain from a settings object or autodetects it from the current loaded domains.
* @param settings Settings object
*/
export declare function getDefaultDomain(settings?: IOptions | null): Promise<string>;
/**
* Watches on the default domain.
* @param callback Callback which is called once and on every change
* @preserve (Part of the public API)
*/
export declare function watchDefaultDomain(callback?: null | ((data: IWatchResultObject<string>) => void)): TcHmi.DestroyFunction;
/**
* Adding a Symbol to the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function add(symbolName: string, settings: IEntrySettings, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Adding a Symbol to the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function addEx(symbolName: string, settings: IEntrySettings, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Adding a Symbol to the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param options global settings
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function addEx2(symbolName: string, settings: IEntrySettings, options: IOptions | null, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Removing a Symbol from the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function remove(symbolName: string, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Removing a Symbol from the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function removeEx(symbolName: string, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Removing a Symbol from the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param options global settings
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function removeEx2(symbolName: string, options: IOptions | null, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Update a config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function update(symbolName: string, settings: IEntrySettings, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Update a config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function updateEx(symbolName: string, settings: IEntrySettings, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Update a config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param options global settings
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function updateEx2(symbolName: string, settings: IEntrySettings, options: IOptions | null, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Gets the current config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function get(symbolName: string, callback?: null | ((this: void, data: IEntryResultObject) => void)): TcHmi.IErrorDetails;
/**
* Gets the current config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getEx(symbolName: string, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: IEntryResultObject) => void)): TcHmi.IErrorDetails;
/**
* Gets the current config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param options global settings
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getEx2(symbolName: string, options: IOptions | null, requestOptions: Server.IRequestOptions | null, callback?: null | ((this: void, data: IEntryResultObject) => void)): TcHmi.IErrorDetails;
export interface IWatchResultObject<T = any> extends TcHmi.IResultObject {
value?: T;
/** A destroy function to remove the watch. Only set if there is no error. */
destroy?: TcHmi.DestroyFunction;
}
export interface IEntrySettings {
/** ISO8601 Time Span */
INTERVAL?: string;
MAXENTRIES?: number;
ROWLIMIT?: number;
RECORDINGENABLED?: boolean;
}
export interface IEntrySettingsEx {
/** ISO8601 Time Span */
interval?: string;
maxEntries?: number;
rowLimit?: number;
recordingEnabled?: boolean;
}
/** Global options for the historization */
export interface IOptions {
/** Domain of the historize handling. Defaults to 'TcHmiPostgresHistorize' or 'TcHmiSqliteHistorize' (auto detected) */
domain?: string;
}
export interface IEntryResultObject extends TcHmi.IResultObject {
key?: string;
settings?: IEntrySettings;
}
declare const _getDefaultDomain: typeof getDefaultDomain;
declare const _watchDefaultDomain: typeof watchDefaultDomain;
declare const _add: typeof add;
declare const _addEx: typeof addEx;
declare const _addEx2: typeof addEx2;
declare const _remove: typeof remove;
declare const _removeEx: typeof removeEx;
declare const _removeEx2: typeof removeEx2;
declare const _update: typeof update;
declare const _updateEx: typeof updateEx;
declare const _updateEx2: typeof updateEx2;
declare const _get: typeof get;
declare const _getEx: typeof getEx;
declare const _getEx2: typeof getEx2;
type tIWatchResultObject<T = any> = IWatchResultObject<T>;
type tIEntrySettings = IEntrySettings;
type tIEntrySettingsEx = IEntrySettingsEx;
type tIOptions = IOptions;
type tIEntryResultObject = IEntryResultObject;
declare global {
namespace TcHmi.Server {
/**
* Provides functions for managing configuration settings of the TcHmiPostgresHistorize or TcHmiSqliteHistorize server extension.
* @preserve (Part of the public API)
*/
namespace Historize {
const getDefaultDomain: typeof _getDefaultDomain;
const watchDefaultDomain: typeof _watchDefaultDomain;
const add: typeof _add;
const addEx: typeof _addEx;
const addEx2: typeof _addEx2;
const remove: typeof _remove;
const removeEx: typeof _removeEx;
const removeEx2: typeof _removeEx2;
const update: typeof _update;
const updateEx: typeof _updateEx;
const updateEx2: typeof _updateEx2;
const get: typeof _get;
const getEx: typeof _getEx;
const getEx2: typeof _getEx2;
type IWatchResultObject<T = any> = tIWatchResultObject<T>;
type IEntrySettings = tIEntrySettings;
type IEntrySettingsEx = tIEntrySettingsEx;
type IOptions = tIOptions;
type IEntryResultObject = tIEntryResultObject;
}
}
}
export {};
//# sourceMappingURL=Server.Historize.d.ts.map

View File

@@ -0,0 +1,96 @@
import*as Server from"./Server.js";import{Exception}from"./Exception.js";import{isParameterTypeInvalid}from"../System/SystemFunctions.js";import{FilterInstance}from"./FilterInstance.js";import{config}from"../System/System.js";export function getDefaultDomain(settings){return settings?.domain?Promise.resolve(settings.domain):new Promise((resolve,reject)=>{null===Server.readSymbol("ListDomains",data=>{if(data.error||!data.results||!data.results[0]||!data.results[0].value)return void reject(new Exception(data.details??{code:data.error!==TcHmi.Errors.NONE?data.error:TcHmi.Errors.E_SERVER_READVALUE_MISSING,reason:"Failed to fetch domains",domain:"TcHmi.Server.Historize"}));let foundDomain;const domainInfoArr=Object.entries(data.results[0].value),[postgresDomain,_p]=domainInfoArr.find(([_,info])=>"TcHmiPostgresHistorize"===info.extension&&("Initialized"===info.state||"Loaded"===info.state))??[];foundDomain??=postgresDomain;const[sqliteDomain,_s]=domainInfoArr.find(([_,info])=>"TcHmiSqliteHistorize"===info.extension&&("Initialized"===info.state||"Loaded"===info.state))??[];foundDomain??=sqliteDomain,foundDomain?resolve(foundDomain):reject(new Exception({code:TcHmi.Errors.ERROR,reason:"No matching Historize domains found.",domain:"TcHmi.Server.Historize"}))})&&reject(new Exception({code:TcHmi.Errors.ERROR,reason:"Failed to send request to fetch domains",domain:"TcHmi.Server.Historize"}))})}
/**
* Watches on the default domain.
* @param callback Callback which is called once and on every change
* @preserve (Part of the public API)
*/export function watchDefaultDomain(callback=null){let domainSymbol=new TcHmi.Symbol("%s%ListDomains|SubscriptionMode=Change%/s%"),diagnosticsSubscriptionId=null,destroy=()=>{destroyWatch(),domainSymbol?.destroy(),domainSymbol=null,null!==diagnosticsSubscriptionId&&(Server.unsubscribeEx(diagnosticsSubscriptionId,null),diagnosticsSubscriptionId=null)};const destroyWatch=domainSymbol.watchEx(null,data=>{if(data.error||!data.value)return void TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:data.error,message:TcHmi.Errors[data.error],reason:"Error requesting historize extension name",domain:"TcHmi.Server.Historize",errors:data.details?[data.details]:void 0},destroy});let foundDomain;const domainInfoArr=Object.entries(data.value),[postgresDomain,_p]=domainInfoArr.find(([_,info])=>"TcHmiPostgresHistorize"===info.extension&&("Initialized"===info.state||"Loaded"===info.state))??[];foundDomain??=postgresDomain;const[sqliteDomain,_s]=domainInfoArr.find(([_,info])=>"TcHmiSqliteHistorize"===info.extension&&("Initialized"===info.state||"Loaded"===info.state))??[];foundDomain??=sqliteDomain,foundDomain?(null!==diagnosticsSubscriptionId&&(Server.unsubscribeEx(diagnosticsSubscriptionId,null),diagnosticsSubscriptionId=null),"TcHmiPostgresHistorize"===foundDomain&&(diagnosticsSubscriptionId=TcHmi.Server.subscribeEx([{symbol:`${postgresDomain}.Diagnostics`,filter:new FilterInstance("{key}","==","connectionState").or("{key}","==","domainState").getFilter()}],config.tcHmiServer.websocketIntervalTime,null,data=>{const value=data.response?.commands?.[0]?.readValue;data.error===TcHmi.Errors.NONE&&"Connected"===value?.connectionState&&"Good"===value?.domainState?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:postgresDomain,destroy}):sqliteDomain?TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:sqliteDomain,destroy}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:"Historize extension not connected or domain state not good",reason:"connectionState or domainState invalid",domain:"TcHmi.Server.Historize"},destroy})})),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,value:sqliteDomain,destroy})):TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:{code:TcHmi.Errors.E_NOT_SUPPORTED,message:TcHmi.Errors[TcHmi.Errors.E_NOT_SUPPORTED],reason:"Error requesting historize extension name. No compatible extension found",domain:"TcHmi.Server.Historize"},destroy})});return destroy}
/**
* Adding a Symbol to the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function add(symbolName,settings,callback=null){return addEx2(symbolName,settings,null,null,callback)}
/**
* Adding a Symbol to the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function addEx(symbolName,settings,requestOptions,callback=null){return addEx2(symbolName,settings,null,requestOptions,callback)}
/**
* Adding a Symbol to the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param options global settings
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function addEx2(symbolName,settings,options,requestOptions,callback=null){let isInvalid=isParameterTypeInvalid(symbolName,"symbolName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.Historize",callback);if(isInvalid)return isInvalid;if(isInvalid=isParameterTypeInvalid(settings,"settings ",{type:"object",required:"valueNeeded"},"TcHmi.Server.Historize",callback),isInvalid)return isInvalid;return getDefaultDomain(options).then(domain=>{const writeValue={interval:settings.INTERVAL??"PT1S",maxEntries:settings.MAXENTRIES??1e4,rowLimit:settings.ROWLIMIT??1e4,recordingEnabled:settings.RECORDINGENABLED??!0},writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:domain+".Config::historizedSymbolList::"+symbolName,writeValue}]};return null===Server.requestEx(writeRequest,requestOptions,Server.handleResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results&&data.results[0]){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:()=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))?Promise.reject(new globalThis.Error("Failed to add symbol")):Promise.resolve()}).catch(error=>{error instanceof Exception?TcHmi.Callback.callSafeEx(callback,null,{error:error.code,details:error.details}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Unknown error in addEx2",domain:"TcHmi.Server.Historize",exception:error}})}),{code:TcHmi.Errors.NONE}}
/**
* Removing a Symbol from the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function remove(symbolName,callback=null){return removeEx2(symbolName,null,null,callback)}
/**
* Removing a Symbol from the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function removeEx(symbolName,requestOptions,callback=null){return removeEx2(symbolName,null,requestOptions,callback)}
/**
* Removing a Symbol from the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param options global settings
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function removeEx2(symbolName,options,requestOptions,callback=null){let isInvalid=isParameterTypeInvalid(symbolName,"symbolName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.Historize",callback);if(isInvalid)return isInvalid;return getDefaultDomain(options).then(domain=>{const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage","Delete"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};return null===Server.requestEx(writeRequest,requestOptions,Server.handleResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results&&data.results[0]){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:()=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))?Promise.reject(new globalThis.Error("Failed to remove symbol")):Promise.resolve()}).catch(error=>{error instanceof Exception?TcHmi.Callback.callSafeEx(callback,null,{error:error.code,details:error.details}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Unknown error in removeEx",domain:"TcHmi.Server.Historize",exception:error}})}),{code:TcHmi.Errors.NONE}}
/**
* Update a config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function update(symbolName,settings,callback=null){return updateEx2(symbolName,settings,null,null,callback)}
/**
* Update a config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function updateEx(symbolName,settings,requestOptions,callback=null){return updateEx2(symbolName,settings,null,requestOptions,callback)}
/**
* Update a config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param settings Settings for the symbol
* @param options global settings
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function updateEx2(symbolName,settings,options,requestOptions,callback=null){let isInvalid=isParameterTypeInvalid(symbolName,"symbolName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.Historize",callback);if(isInvalid)return isInvalid;if(isInvalid=isParameterTypeInvalid(settings,"settings ",{type:"object",required:"valueNeeded"},"TcHmi.Server.Historize",callback),isInvalid)return isInvalid;return getDefaultDomain(options).then(domain=>{const readRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};return null===Server.requestEx(readRequest,requestOptions,Server.handleResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results&&data.results[0]){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let readValue=data.results[0].value;if(!readValue)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING});let writeValue=tchmi_clone_object(readValue);void 0!==settings.INTERVAL&&(writeValue.interval=settings.INTERVAL),void 0!==settings.MAXENTRIES&&(writeValue.maxEntries=settings.MAXENTRIES),void 0!==settings.ROWLIMIT&&(writeValue.rowLimit=settings.ROWLIMIT),void 0!==settings.RECORDINGENABLED&&(writeValue.recordingEnabled=settings.RECORDINGENABLED);const writeRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:domain+".Config::historizedSymbolList::"+symbolName,writeValue}]};Server.requestEx(writeRequest,requestOptions,Server.handleResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results&&data.results[0]){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:()=>{TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE})}}))}}))?Promise.reject(new globalThis.Error("Failed to update symbol")):Promise.resolve()}).catch(error=>{error instanceof Exception?TcHmi.Callback.callSafeEx(callback,null,{error:error.code,details:error.details}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Unknown error in updateEx2",domain:"TcHmi.Server.Historize",exception:error}})}),{code:TcHmi.Errors.NONE}}
/**
* Gets the current config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function get(symbolName,callback=null){return getEx2(symbolName,null,null,callback)}
/**
* Gets the current config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function getEx(symbolName,requestOptions,callback=null){return getEx2(symbolName,null,requestOptions,callback)}
/**
* Gets the current config of a Symbol in the Historize Configuration of the server
* @param symbolName Name of the Symbol to manipulate
* @param options global settings
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/export function getEx2(symbolName,options,requestOptions,callback=null){let isInvalid=isParameterTypeInvalid(symbolName,"symbolName",{type:"string",required:"valueNeeded",minStringLength:1},"TcHmi.Server.Historize",callback);if(isInvalid)return isInvalid;return getDefaultDomain(options).then(domain=>{const readRequest={requestType:"ReadWrite",commands:[{commandOptions:["SendErrorMessage"],symbol:domain+".Config::historizedSymbolList::"+symbolName}]};return null===Server.requestEx(readRequest,requestOptions,Server.handleResponse({error:data=>{if(data.error===TcHmi.Errors.NONE&&data.results&&data.results[0]){let res=data.results[0];TcHmi.Callback.callSafeEx(callback,null,{error:res.error,details:res.details})}else TcHmi.Callback.callSafeEx(callback,null,{error:data.error,details:data.details})},success:data=>{let readValue=data.results[0].value;if(!readValue)return void TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.E_SERVER_READVALUE_MISSING});let settings={};void 0!==readValue.interval&&(settings.INTERVAL=readValue.interval),void 0!==readValue.maxEntries&&(settings.MAXENTRIES=readValue.maxEntries),void 0!==readValue.rowLimit&&(settings.ROWLIMIT=readValue.rowLimit),void 0!==readValue.recordingEnabled&&(settings.RECORDINGENABLED=readValue.recordingEnabled),TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.NONE,key:symbolName,settings})}}))?Promise.reject(new globalThis.Error("Failed to get symbol")):Promise.resolve()}).catch(error=>{error instanceof Exception?TcHmi.Callback.callSafeEx(callback,null,{error:error.code,details:error.details}):TcHmi.Callback.callSafeEx(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,message:TcHmi.Errors[TcHmi.Errors.ERROR],reason:"Unknown error in getEx2",domain:"TcHmi.Server.Historize",exception:error}})}),{code:TcHmi.Errors.NONE}}TcHmi.Server??={},TcHmi.Server.Historize={getDefaultDomain,watchDefaultDomain,add,addEx,addEx2,remove,removeEx,removeEx2,update,updateEx,updateEx2,get,getEx,getEx2};

View File

@@ -0,0 +1,819 @@
import * as Server from './Server.js';
/**
* Lists all available recipe types
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listRecipeTypes(callback?: null | ((this: void, data: IRecipeTypeListResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all available recipe types
* This function provides more options to manipulate the request
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listRecipeTypesEx(options?: IRecipeListOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IRecipeTypeListResultObject) => void)): TcHmi.IErrorDetails;
/**
* Watches a list of all available recipe types
* @param options Options for the watch
* @param callback Callback which is called once and on every change
* @preserve (Part of the public API)
*/
export declare function watchRecipeTypesList(options?: IRecipeWatchOptions | null, callback?: null | ((this: void, data: IWatchResultObject<FolderRecipeType>) => void)): TcHmi.DestroyFunction;
/**
* Returns a recipe types addressed by name and optional path
* @param recipeTypeName Name of the recipe type
* @param path Name of the folder
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getRecipeType(recipeTypeName: string, path: string | null, callback?: null | ((this: void, data: IRecipeTypeGetResultObject) => void)): TcHmi.IErrorDetails;
/**
* Returns a recipe types addressed by name and optional path
* This function provides more options to manipulate the request
* @param recipeTypeName Name of the recipe type
* @param path Name of the folder
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getRecipeTypeEx(recipeTypeName: string, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IRecipeTypeGetResultObject) => void)): TcHmi.IErrorDetails;
/**
* Watches a recipe type
* @param recipeTypeName Name of the recipe type
* @param path Name of the folder
* @param options Options for the watch
* @param callback Callback which is called once and on every change
* @preserve (Part of the public API)
*/
export declare function watchRecipeType(recipeTypeName: string, path: string | null, options?: IRecipeWatchOptions | null, callback?: null | ((this: void, data: IWatchResultObject<RecipeType>) => void)): TcHmi.DestroyFunction;
/**
* Creates a recipe type folder
* @param path name of the new folder
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function createRecipeTypeFolder(path: string, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Creates a recipe type folder
* This function provides more options to manipulate the request
* @param path Name of the new folder
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function createRecipeTypeFolderEx(path: string, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Deletes a recipe type folder
* @param path name of the folder
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function deleteRecipeTypeFolder(path: string, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Deletes a recipe type folder
* This function provides more options to manipulate the request
* @param path Name of the folder
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function deleteRecipeTypeFolderEx(path: string, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Creates a new recipe type
* @param recipeTypeName Name of the recipe type
* @param recipeType recipe type definition
* @param path Path of the recipe type (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function createRecipeType(recipeTypeName: string, recipeType: RecipeType, path: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Creates a new recipe type
* This function provides more options to manipulate the request
* @param recipeTypeName Name of the recipe type
* @param recipeType Recipe type definition
* @param path Path of the recipe type (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function createRecipeTypeEx(recipeTypeName: string, recipeType: RecipeType, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Updates a recipe type
* @param recipeTypeName Name of the recipe type
* @param recipeType recipe type definition
* @param path Path of the recipe type (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function updateRecipeType(recipeTypeName: string, recipeType: RecipeType, path: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Updates a recipe type
* This function provides more options to manipulate the request
* @param recipeTypeName Name of the recipe type
* @param recipeType Recipe type definition
* @param path Path of the recipe type (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function updateRecipeTypeEx(recipeTypeName: string, recipeType: RecipeType, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Renames or moves a recipe type
* @param recipeTypeName Old name of the recipe type
* @param path Old path of the recipe type (root folder if set to null)
* @param newName New name of the recipe type
* @param newPath New path of the recipe type (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function renameRecipeType(recipeTypeName: string, path: string | null, newName: string, newPath: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Renames or moves a recipe type
* This function provides more options to manipulate the request
* @param recipeTypeName Old name of the recipe type
* @param path Old path of the recipe type (root folder if set to null)
* @param newName New name of the recipe type
* @param newPath New path of the recipe type (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function renameRecipeTypeEx(recipeTypeName: string, path: string | null, newName: string, newPath: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Renames or moves a recipe type folder
* @param recipeTypeFolderName Old name of the recipe type
* @param path Old path of the recipe type (root folder if set to null)
* @param newName New name of the recipe type
* @param newPath New path of the recipe type (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function renameRecipeTypeFolder(recipeTypeFolderName: string, path: string | null, newName: string, newPath: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Renames or moves a recipe type folder
* This function provides more options to manipulate the request
* @param recipeTypeFolderName Old name of the recipe type
* @param path Old path of the recipe type (root folder if set to null)
* @param newName New name of the recipe type
* @param newPath New path of the recipe type (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function renameRecipeTypeFolderEx(recipeTypeFolderName: string, path: string | null, newName: string, newPath: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Deletes a recipe type
* @param recipeTypeName Name of the recipe type
* @param path Path of the recipe type (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function deleteRecipeType(recipeTypeName: string, path: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Deletes a recipe type
* This function provides more options to manipulate the request
* @param recipeTypeName Name of the recipe type
* @param path Path of the recipe type (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function deleteRecipeTypeEx(recipeTypeName: string, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all available recipes
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listRecipes(callback?: null | ((this: void, data: IRecipeListResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all available recipes
* This function provides more options to manipulate the request
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listRecipesEx(options?: IRecipeListOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IRecipeListResultObject) => void)): TcHmi.IErrorDetails;
/**
* Watches a list of all available recipes
* @param options Options for the watch
* @param callback Callback which is called once and on every change
* @preserve (Part of the public API)
*/
export declare function watchRecipeList(options?: IRecipeWatchOptions | null, callback?: null | ((this: void, data: IWatchResultObject<FolderRecipe>) => void)): TcHmi.DestroyFunction;
/**
* Creates a recipe folder
* @param path name of the new folder
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function createRecipeFolder(path: string, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Creates a recipe folder
* This function provides more options to manipulate the request
* @param path name of the new folder
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function createRecipeFolderEx(path: string, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Deletes a recipe folder
* @param path name of the folder
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function deleteRecipeFolder(path: string, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Deletes a recipe folder
* This function provides more options to manipulate the request
* @param path Name of the folder
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function deleteRecipeFolderEx(path: string, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Creates a new recipe
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param recipe recipe definition
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function createRecipe(recipeName: string, path: string | null, recipe: Recipe, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Creates a new recipe
* This function provides more options to manipulate the request
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param recipe Recipe definition
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function createRecipeEx(recipeName: string, path: string | null, recipe: Recipe, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists one recipe
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getRecipe(recipeName: string, path: string | null, callback?: null | ((this: void, data: IGetRecipeResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists one recipe
* This function provides more options to manipulate the request
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getRecipeEx(recipeName: string, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IGetRecipeResultObject) => void)): TcHmi.IErrorDetails;
/**
* Watches a recipe
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param options Options for the watch
* @param callback Callback which is called once and on every change
* @preserve (Part of the public API)
*/
export declare function watchRecipe(recipeName: string, path: string | null, options?: IRecipeWatchOptions | null, callback?: null | ((this: void, data: IWatchResultObject<Recipe>) => void)): TcHmi.DestroyFunction;
/**
* Updates a recipe
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param newValues dictionary of the new values
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function updateRecipe(recipeName: string, path: string | null, newValues: TcHmi.Dictionary<any>, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Updates a recipe
* This function provides more options to manipulate the request
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param newValues Dictionary of the new values
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function updateRecipeEx(recipeName: string, path: string | null, newValues: TcHmi.Dictionary<any>, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Reads all values which is referenced by a recipe
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function readFromTarget(recipeName: string, path: string | null, callback?: null | ((this: void, data: IReadFromTargetResultObject) => void)): TcHmi.IErrorDetails;
/**
* Reads all values which is referenced by a recipe
* This function provides more options to manipulate the request
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function readFromTargetEx(recipeName: string, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IReadFromTargetResultObject) => void)): TcHmi.IErrorDetails;
/**
* Reads the current values which are referenced from a base recipe and write it back
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function teach(recipeName: string, path: string | null, callback?: null | ((this: void, data: IReadFromTargetResultObject) => void)): TcHmi.IErrorDetails;
/**
* Reads the current values which are referenced from a base recipe and write it back
* This function provides more options to manipulate the request
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function teachEx(recipeName: string, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IReadFromTargetResultObject) => void)): TcHmi.IErrorDetails;
/**
* Reads the current values which are referenced from a base recipe and write it into a new recipe
* @param recipeName Name of the base recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param newRecipeName Name of the new recipe. (could be prefixed with a path if separated with ::)
* @param newRecipePath Path of the new recipe. (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function teachAsNewRecipe(recipeName: string, path: string | null, newRecipeName: string, newRecipePath: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Reads the current values which are referenced from a base recipe and write it into a new recipe
* This function provides more options to manipulate the request
* @param recipeName Name of the base recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param newRecipeName Name of the new recipe. (could be prefixed with a path if separated with ::)
* @param newRecipePath Path of the new recipe. (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function teachAsNewRecipeEx(recipeName: string, path: string | null, newRecipeName: string, newRecipePath: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Activates a recipe (writes all values)
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function activate(recipeName: string, path: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Activates a recipe (writes all values)
* This function provides more options to manipulate the request
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function activateEx(recipeName: string, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all active recipes
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getActiveRecipes(callback?: null | ((this: void, data: IGetActiveRecipesResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all active recipes
* This function provides more options to manipulate the request
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getActiveRecipesEx(options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IGetActiveRecipesResultObject) => void)): TcHmi.IErrorDetails;
/**
* Watches a list of all active recipes
* @param options Options for the watch
* @param callback Callback which is called once and on every change
* @preserve (Part of the public API)
*/
export declare function watchActiveRecipes(options?: IRecipeWatchOptions | null, callback?: null | ((this: void, data: IWatchResultObject<string[]>) => void)): TcHmi.DestroyFunction;
/**
* Renames or moves a recipe
* @param recipeName Old name of the recipe (could be prefixed with a path if separated with ::)
* @param path Old path of the recipe (root folder if set to null)
* @param newName New name of the recipe
* @param newPath New path of the recipe (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function renameRecipe(recipeName: string, path: string | null, newName: string, newPath: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Renames or moves a recipe
* This function provides more options to manipulate the request
* @param recipeName Old name of the recipe (could be prefixed with a path if separated with ::)
* @param path Old path of the recipe (root folder if set to null)
* @param newName New name of the recipe
* @param newPath New path of the recipe (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function renameRecipeEx(recipeName: string, path: string | null, newName: string, newPath: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Renames or moves a recipe folder
* @param recipeFolderName Old name of the recipe (could be prefixed with a path if separated with ::)
* @param path Old path of the recipe (root folder if set to null)
* @param newName New name of the recipe
* @param newPath New path of the recipe (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function renameRecipeFolder(recipeFolderName: string, path: string | null, newName: string, newPath: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Renames or moves a recipe folder
* This function provides more options to manipulate the request
* @param recipeFolderName Old name of the recipe (could be prefixed with a path if separated with ::)
* @param path Old path of the recipe (root folder if set to null)
* @param newName Mew name of the recipe
* @param newPath New path of the recipe (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function renameRecipeFolderEx(recipeFolderName: string, path: string | null, newName: string, newPath: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Deletes a recipe
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function deleteRecipe(recipeName: string, path: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Deletes a recipe
* This function provides more options to manipulate the request
* @param recipeName Name of the recipe (could be prefixed with a path if separated with ::)
* @param path Path of the recipe (root folder if set to null)
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function deleteRecipeEx(recipeName: string, path: string | null, options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Downloads one or more recipes. Downloads all recipes when filter is the empty string, empty array or null.
* The sibling API downloadRecipesEx can include the referenced recipe types, too.
* This needs to be triggered by a user interaction (not on load or symbol change).
* @param filter Name or names of the recipes (could be prefixed with a path if separated with ::)
* @param path Path of the recipes (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function downloadRecipes(filter: string | string[] | null, path: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Downloads one or more recipes. Downloads all recipes when filter is the empty string, empty array or null.
* Can include the referenced recipe types, too, when set in options.
* This function provides more options to manipulate the request.
* This needs to be triggered by a user interaction (not on load or symbol change).
* @param filter Name or names of the recipes (could be prefixed with a path if separated with ::)
* @param path Path of the recipes (root folder if set to null)
* @param options Options for the download recipeManagement
* @param requestOptions Options for the request itself (not used right now)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function downloadRecipesEx(filter: string | string[] | null, path: string | null, options?: IRecipeDownloadOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Downloads one or more recipe types. Downloads all recipe types when recipeTypeName is the empty string or null.
* The sibling API downloadRecipeTypesEx can include the referenced recipe types, too.
* This needs to be triggered by a user interaction (not on load or symbol change).
* @param filter Name or names of the recipe types (could be prefixed with a path if separated with ::)
* @param path Path of the recipe types (root folder if set to null)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function downloadRecipeTypes(filter: string | string[] | null, path: string | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Downloads one or more recipe types. Downloads all recipe types when recipeTypeName is the empty string or null.
* Can include the referenced recipe types, too, when set in options.
* This function provides more options to manipulate the request.
* This needs to be triggered by a user interaction (not on load or symbol change).
* @param filter Name or names of the recipe types (could be prefixed with a path if separated with ::)
* @param path Path of the recipe types (root folder if set to null)
* @param options Options for the download recipeManagement
* @param requestOptions Options for the request itself (not used right now)
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function downloadRecipeTypesEx(filter: string | string[] | null, path: string | null, options?: IRecipeDownloadOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Uploads one or more recipe files (each containing one or all recipes or recipe types of a server).
* This needs to be triggered by a user interaction (not on load or symbol change).
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function uploadRecipeFiles(callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Uploads one or more recipe files (each containing one or all recipes or recipe types of a server).
* This needs to be triggered by a user interaction (not on load or symbol change).
* This function provides more options to manipulate the request
* @param options Options for the recipeManagement
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function uploadRecipeFilesEx(options?: IRecipeOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
export interface RecipeType {
/** List of RecipeTypes this RecipeType inherits */
recipeTypeNames?: string[];
/** List of symbol definitions for this RecipeType */
members: TcHmi.Dictionary<{
/** Name of the symbol of this entry */
symbol: string;
/** defaultValue for this symbol */
defaultValue: any;
/** Schema the value inside a Recipe should validate */
schema?: TcHmi.JsonSchema;
/** Engineering unit for this symbol */
unit?: string;
comment?: string;
enabled?: boolean;
/** Groups for engineering display */
group?: string;
/** Engineering display order */
order?: number;
} | {
/**
* References another recipeType.
* The used recipe name will be in the recipe as a string value.
*/
recipeType: string;
enabled?: boolean;
/** Groups for engineering display */
group?: string;
/** Engineering display order */
order?: number;
/** Engineering unit for this symbol */
unit?: string;
comment?: string;
}>;
options?: {
/** None: no restriction from recipeType
Disabled: All member of the recipe are disabled */
enabled?: 'None' | 'Disabled';
comment?: string;
};
}
/** Dictionary of folders or RecipeTypes */
export interface FolderRecipeType {
[index: string]: FolderRecipeType | RecipeType;
}
export interface IRecipeListResultObject extends TcHmi.IResultObject {
value?: FolderRecipe;
}
export interface Recipe {
/** Full path of the RecipeType this Recipe implements */
recipeTypeName: string;
/**
* Values for the symbols or the name of a linked recipe.
* Key is the symbol name or recipeType name.
*/
values: TcHmi.Dictionary<any>;
}
/** Dictionary of folders or Recipes */
export interface FolderRecipe {
[index: string]: FolderRecipe | Recipe;
}
export interface IRecipeTypeListResultObject extends TcHmi.IResultObject {
value?: FolderRecipeType;
}
export interface IRecipeTypeGetResultObject extends TcHmi.IResultObject {
value?: RecipeType;
}
export interface IGetRecipeResultObject extends TcHmi.IResultObject {
value?: Recipe;
}
export interface IReadFromTargetResultObject extends TcHmi.IResultObject {
/** This is an example key "subFolder::myRecipe" */
value?: TcHmi.Dictionary<Recipe>;
}
export interface IGetActiveRecipesResultObject extends TcHmi.IResultObject {
recipeList?: string[];
}
/** Options for all recipe APIs */
export interface IRecipeOptions {
/** domain of the RecipeManagement. defaults to TcHmiRecipeManagement */
domain?: string;
parallel?: boolean;
}
export interface IRecipeListOptions extends IRecipeOptions {
/** Subpath to list a subfolder */
path?: string;
}
export interface IRecipeDownloadOptions extends IRecipeOptions {
/** The export should contain referenced recipe types, too. Defaults to false. */
referencedRecipeTypes?: boolean;
}
export interface IRecipeWatchOptions extends IRecipeOptions {
}
export interface IWatchResultObject<T = any> extends TcHmi.IResultObject {
value?: T;
/** A destroy function to remove the watch. Only set if there is no error. */
destroy?: TcHmi.DestroyFunction;
response?: Server.IMessage<T>;
}
/**
* Type guard for recipes. Returns true if the given candidate is a Recipe, false otherwise
* @param candidate The candidate to test.
*/
export declare function isRecipe(candidate: FolderRecipe | Recipe): candidate is Recipe;
/**
* Type guard for recipe types. Returns true if the given candidate is a RecipeType, false otherwise
* @param candidate The candidate to test.
*/
export declare function isRecipeType(candidate: FolderRecipeType | RecipeType): candidate is RecipeType;
declare const _listRecipeTypes: typeof listRecipeTypes;
declare const _listRecipeTypesEx: typeof listRecipeTypesEx;
declare const _watchRecipeTypesList: typeof watchRecipeTypesList;
declare const _getRecipeType: typeof getRecipeType;
declare const _getRecipeTypeEx: typeof getRecipeTypeEx;
declare const _watchRecipeType: typeof watchRecipeType;
declare const _createRecipeTypeFolder: typeof createRecipeTypeFolder;
declare const _createRecipeTypeFolderEx: typeof createRecipeTypeFolderEx;
declare const _deleteRecipeTypeFolder: typeof deleteRecipeTypeFolder;
declare const _deleteRecipeTypeFolderEx: typeof deleteRecipeTypeFolderEx;
declare const _createRecipeType: typeof createRecipeType;
declare const _createRecipeTypeEx: typeof createRecipeTypeEx;
declare const _updateRecipeType: typeof updateRecipeType;
declare const _updateRecipeTypeEx: typeof updateRecipeTypeEx;
declare const _renameRecipeType: typeof renameRecipeType;
declare const _renameRecipeTypeEx: typeof renameRecipeTypeEx;
declare const _renameRecipeTypeFolder: typeof renameRecipeTypeFolder;
declare const _renameRecipeTypeFolderEx: typeof renameRecipeTypeFolderEx;
declare const _deleteRecipeType: typeof deleteRecipeType;
declare const _deleteRecipeTypeEx: typeof deleteRecipeTypeEx;
declare const _listRecipes: typeof listRecipes;
declare const _listRecipesEx: typeof listRecipesEx;
declare const _watchRecipeList: typeof watchRecipeList;
declare const _createRecipeFolder: typeof createRecipeFolder;
declare const _createRecipeFolderEx: typeof createRecipeFolderEx;
declare const _deleteRecipeFolder: typeof deleteRecipeFolder;
declare const _deleteRecipeFolderEx: typeof deleteRecipeFolderEx;
declare const _createRecipe: typeof createRecipe;
declare const _createRecipeEx: typeof createRecipeEx;
declare const _getRecipe: typeof getRecipe;
declare const _getRecipeEx: typeof getRecipeEx;
declare const _watchRecipe: typeof watchRecipe;
declare const _updateRecipe: typeof updateRecipe;
declare const _updateRecipeEx: typeof updateRecipeEx;
declare const _readFromTarget: typeof readFromTarget;
declare const _readFromTargetEx: typeof readFromTargetEx;
declare const _teach: typeof teach;
declare const _teachEx: typeof teachEx;
declare const _teachAsNewRecipe: typeof teachAsNewRecipe;
declare const _teachAsNewRecipeEx: typeof teachAsNewRecipeEx;
declare const _activate: typeof activate;
declare const _activateEx: typeof activateEx;
declare const _getActiveRecipes: typeof getActiveRecipes;
declare const _getActiveRecipesEx: typeof getActiveRecipesEx;
declare const _watchActiveRecipes: typeof watchActiveRecipes;
declare const _renameRecipe: typeof renameRecipe;
declare const _renameRecipeEx: typeof renameRecipeEx;
declare const _renameRecipeFolder: typeof renameRecipeFolder;
declare const _renameRecipeFolderEx: typeof renameRecipeFolderEx;
declare const _deleteRecipe: typeof deleteRecipe;
declare const _deleteRecipeEx: typeof deleteRecipeEx;
declare const _downloadRecipes: typeof downloadRecipes;
declare const _downloadRecipesEx: typeof downloadRecipesEx;
declare const _downloadRecipeTypes: typeof downloadRecipeTypes;
declare const _downloadRecipeTypesEx: typeof downloadRecipeTypesEx;
declare const _uploadRecipeFiles: typeof uploadRecipeFiles;
declare const _uploadRecipeFilesEx: typeof uploadRecipeFilesEx;
declare const _isRecipe: typeof isRecipe;
declare const _isRecipeType: typeof isRecipeType;
type tRecipeType = RecipeType;
type tFolderRecipeType = FolderRecipeType;
type tIRecipeListResultObject = IRecipeListResultObject;
type tRecipe = Recipe;
type tFolderRecipe = FolderRecipe;
type tIRecipeTypeListResultObject = IRecipeTypeListResultObject;
type tIRecipeTypeGetResultObject = IRecipeTypeGetResultObject;
type tIGetRecipeResultObject = IGetRecipeResultObject;
type tIReadFromTargetResultObject = IReadFromTargetResultObject;
type tIGetActiveRecipesResultObject = IGetActiveRecipesResultObject;
type tIRecipeOptions = IRecipeOptions;
type tIRecipeListOptions = IRecipeListOptions;
type tIRecipeDownloadOptions = IRecipeDownloadOptions;
type tIRecipeWatchOptions = IRecipeWatchOptions;
type tIWatchResultObject<T = any> = IWatchResultObject<T>;
type tRecipeDownloadOptions = IRecipeDownloadOptions;
declare global {
namespace TcHmi.Server {
/**
* Provides functions for recipe management.
* @preserve (Part of the public API)
*/
namespace RecipeManagement {
const listRecipeTypes: typeof _listRecipeTypes;
const listRecipeTypesEx: typeof _listRecipeTypesEx;
const watchRecipeTypesList: typeof _watchRecipeTypesList;
const getRecipeType: typeof _getRecipeType;
const getRecipeTypeEx: typeof _getRecipeTypeEx;
const watchRecipeType: typeof _watchRecipeType;
const createRecipeTypeFolder: typeof _createRecipeTypeFolder;
const createRecipeTypeFolderEx: typeof _createRecipeTypeFolderEx;
const deleteRecipeTypeFolder: typeof _deleteRecipeTypeFolder;
const deleteRecipeTypeFolderEx: typeof _deleteRecipeTypeFolderEx;
const createRecipeType: typeof _createRecipeType;
const createRecipeTypeEx: typeof _createRecipeTypeEx;
const updateRecipeType: typeof _updateRecipeType;
const updateRecipeTypeEx: typeof _updateRecipeTypeEx;
const renameRecipeType: typeof _renameRecipeType;
const renameRecipeTypeEx: typeof _renameRecipeTypeEx;
const renameRecipeTypeFolder: typeof _renameRecipeTypeFolder;
const renameRecipeTypeFolderEx: typeof _renameRecipeTypeFolderEx;
const deleteRecipeType: typeof _deleteRecipeType;
const deleteRecipeTypeEx: typeof _deleteRecipeTypeEx;
const listRecipes: typeof _listRecipes;
const listRecipesEx: typeof _listRecipesEx;
const watchRecipeList: typeof _watchRecipeList;
const createRecipeFolder: typeof _createRecipeFolder;
const createRecipeFolderEx: typeof _createRecipeFolderEx;
const deleteRecipeFolder: typeof _deleteRecipeFolder;
const deleteRecipeFolderEx: typeof _deleteRecipeFolderEx;
const createRecipe: typeof _createRecipe;
const createRecipeEx: typeof _createRecipeEx;
const getRecipe: typeof _getRecipe;
const getRecipeEx: typeof _getRecipeEx;
const watchRecipe: typeof _watchRecipe;
const updateRecipe: typeof _updateRecipe;
const updateRecipeEx: typeof _updateRecipeEx;
const readFromTarget: typeof _readFromTarget;
const readFromTargetEx: typeof _readFromTargetEx;
const teach: typeof _teach;
const teachEx: typeof _teachEx;
const teachAsNewRecipe: typeof _teachAsNewRecipe;
const teachAsNewRecipeEx: typeof _teachAsNewRecipeEx;
const activate: typeof _activate;
const activateEx: typeof _activateEx;
const getActiveRecipes: typeof _getActiveRecipes;
const getActiveRecipesEx: typeof _getActiveRecipesEx;
const watchActiveRecipes: typeof _watchActiveRecipes;
const renameRecipe: typeof _renameRecipe;
const renameRecipeEx: typeof _renameRecipeEx;
const renameRecipeFolder: typeof _renameRecipeFolder;
const renameRecipeFolderEx: typeof _renameRecipeFolderEx;
const deleteRecipe: typeof _deleteRecipe;
const deleteRecipeEx: typeof _deleteRecipeEx;
const downloadRecipes: typeof _downloadRecipes;
const downloadRecipesEx: typeof _downloadRecipesEx;
const downloadRecipeTypes: typeof _downloadRecipeTypes;
const downloadRecipeTypesEx: typeof _downloadRecipeTypesEx;
const uploadRecipeFiles: typeof _uploadRecipeFiles;
const uploadRecipeFilesEx: typeof _uploadRecipeFilesEx;
const isRecipe: typeof _isRecipe;
const isRecipeType: typeof _isRecipeType;
type RecipeType = tRecipeType;
type FolderRecipeType = tFolderRecipeType;
type IRecipeListResultObject = tIRecipeListResultObject;
type Recipe = tRecipe;
type FolderRecipe = tFolderRecipe;
type IRecipeTypeListResultObject = tIRecipeTypeListResultObject;
type IRecipeTypeGetResultObject = tIRecipeTypeGetResultObject;
type IGetRecipeResultObject = tIGetRecipeResultObject;
type IReadFromTargetResultObject = tIReadFromTargetResultObject;
type IGetActiveRecipesResultObject = tIGetActiveRecipesResultObject;
type IRecipeOptions = tIRecipeOptions;
type IRecipeListOptions = tIRecipeListOptions;
type IRecipeDownloadOptions = tIRecipeDownloadOptions;
type IRecipeWatchOptions = tIRecipeWatchOptions;
type IWatchResultObject<T = any> = tIWatchResultObject<T>;
type RecipeDownloadOptions = tRecipeDownloadOptions;
}
}
}
export {};
//# sourceMappingURL=Server.RecipeManagement.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,307 @@
import * as Server from './Server.js';
import { ACCESS as ServerACCESS } from './Server.js';
/**
* Add a new user with a given password
* @param userName Username to add.
* @param password Password for the new user.
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function addUser(userName: string, password: string, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Add a new user with a given password
* @param userName Username to add.
* @param password Password for the new user.
* @param options Optional details for this new user.
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function addUserEx(userName: string, password: string, options?: Partial<IUserDetails> | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all usernames as a string array
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUsernames(callback?: null | ((this: void, data: IUsernameListResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all usernames as a string array
* @param options Options
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUsernamesEx(options?: IUserManagementOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IUsernameListResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all username as a dictionary with all meta data
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUsers(callback?: null | ((this: void, data: IUserResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all username as a dictionary with all meta data
* @param options Options
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUsersEx(options?: IUserManagementOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IUserResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all user groups as a dictionary with all meta data
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUserGroups(callback?: null | ((this: void, data: IGroupResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all user groups as a dictionary with all meta data
* @param _options (not used till now)
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUserGroupsEx(_options?: TcHmi.Dictionary<never> | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IGroupResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all user group names as a string array.
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUserGroupNames(callback?: null | ((this: void, data: GroupNamesResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all user group names as a string array.
* @param _options (not used till now)
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUserGroupNamesEx(_options?: TcHmi.Dictionary<never> | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: GroupNamesResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all users of a group as a string array
* @param groupName group name to check
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUsersInGroup(groupName: string, callback?: null | ((this: void, data: IUsernameListResultObject) => void)): TcHmi.IErrorDetails;
/**
* Lists all users of a group as a string array
* @param groupName group name to check
* @param options Options
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function listUsersInGroupEx(groupName: string, options?: IUserManagementOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: IUsernameListResultObject) => void)): TcHmi.IErrorDetails;
/**
* Removes a user
* @param userName user name to remove
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function removeUser(userName: string, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Removes a user
* @param userName user name to remove
* @param options Options
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function removeUserEx(userName: string, options?: IUserManagementOptions | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Update user config
* @param userName Username to update.
* @param options Details for this user.
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function updateUser(userName: string | null, options: IUpdateUserDetails | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Update user config
* @param userName Username to update.
* @param options Details for this user.
* @param requestOptions Options for the request itself
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function updateUserEx(userName: string | null, options: IUpdateUserDetails | null, requestOptions?: Server.IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): TcHmi.IErrorDetails;
/**
* Check access rights for usermanagement functions
* @param options Option for setting usermanagement domain
* @param callback Will be called after request.
* @preserve (Part of the public API)
*/
export declare function getApiAccess(options: IUserManagementOptions | null, callback?: null | ((this: void, data: IApiAccessResultObject) => void)): TcHmi.IErrorDetails;
export interface IUserManagementOptions {
/** Domain of the user management. defaults to TcHmiUserManagement */
domain?: string;
}
export interface IBaseUserDetails extends IUserManagementOptions {
/** A user can be disabled or enabled. Setting this needs access to symbol 'DisableUser' or 'EnableUser'. */
enabled: boolean;
/** ISO8601 TimeSpan for logout after user interaction. Setting this needs access to symbol 'AddOrChangeUser'. */
autoLogout: string;
/** Locale of this user. 'client' and 'project' are special values for project global or browser. */
locale?: string;
/** Locale of this user for date formatting. 'client' and 'project' are special values for project global or browser. */
timeFormatLocale?: string;
/** Time zone of this user. 'client' and 'project' are special values for project global or browser. */
timeZone?: string;
}
export interface IUserDetails extends IBaseUserDetails {
/** list of groups the user is part of */
groups: string[];
}
export interface IUpdateUserDetails extends Partial<IBaseUserDetails> {
/** New username for this user. Access to symbol 'RenameUser' needed. */
newName?: string;
/** New password for the user. */
password?: string;
/** Current password for the user (needed if the user wants to change the password of itself). */
currentPassword?: string;
/** List of new groups the user will be part of. Access to symbol 'AddOrChangeUser' needed. */
addGroups?: string[];
/** List of groups the user will be removed. Access to symbol 'AddOrChangeUser' needed. */
removeGroups?: string[];
}
/** userList: string[]; */
export interface IUsernameListResultObject extends TcHmi.IResultObject {
userList?: string[];
}
/** userDetails: TcHmi.Dictionary<IUserDetails>; */
export interface IUserResultObject extends TcHmi.IResultObject {
userDetails?: TcHmi.Dictionary<IUserDetails>;
}
export interface IGroupDetails {
/** a group can be disabled */
enabled: boolean;
fileAccess: ServerACCESS;
files: TcHmi.Dictionary<ServerACCESS>;
symbolAccess: ServerACCESS;
symbols: TcHmi.Dictionary<ServerACCESS>;
}
export interface IGroupResultObject extends TcHmi.IResultObject {
groupDetailsList?: TcHmi.Dictionary<IGroupDetails>;
}
export interface GroupNamesResultObject extends TcHmi.IResultObject {
groupNames?: string[];
}
export interface IApiAccessResultObject extends TcHmi.IResultObject {
result?: {
addUser: {
general: boolean;
enable: boolean;
locale: boolean;
timeFormatLocale: boolean;
timeZone: boolean;
autoLogoff: boolean;
groups: boolean;
};
listUserNames: {
general: boolean;
};
listUsers: {
general: boolean;
enabled: boolean;
locale: boolean;
timeFormatLocale: boolean;
timeZone: boolean;
autoLogoff: boolean;
groups: boolean;
};
listUserGroupNames: {
general: boolean;
};
listUserGroups: {
general: boolean;
enabled: boolean;
fileAccess: boolean;
files: boolean;
symbolAccess: boolean;
symbols: boolean;
};
listUsersInGroup: {
general: boolean;
};
removeUser: {
general: boolean;
};
updateUser: {
general: boolean;
newName: boolean;
addGroups: boolean;
removeGroups: boolean;
enabled: boolean;
autoLogout: boolean;
locale: boolean;
timeFormatLocale: boolean;
timeZone: boolean;
changeOwnPassword: boolean;
changePassword: boolean;
};
};
}
declare const _addUser: typeof addUser;
declare const _addUserEx: typeof addUserEx;
declare const _listUsernames: typeof listUsernames;
declare const _listUsernamesEx: typeof listUsernamesEx;
declare const _listUsers: typeof listUsers;
declare const _listUsersEx: typeof listUsersEx;
declare const _listUserGroups: typeof listUserGroups;
declare const _listUserGroupsEx: typeof listUserGroupsEx;
declare const _listUserGroupNames: typeof listUserGroupNames;
declare const _listUserGroupNamesEx: typeof listUserGroupNamesEx;
declare const _listUsersInGroup: typeof listUsersInGroup;
declare const _listUsersInGroupEx: typeof listUsersInGroupEx;
declare const _removeUser: typeof removeUser;
declare const _removeUserEx: typeof removeUserEx;
declare const _updateUser: typeof updateUser;
declare const _updateUserEx: typeof updateUserEx;
declare const _getApiAccess: typeof getApiAccess;
type tIUserManagementOptions = IUserManagementOptions;
type tIBaseUserDetails = IBaseUserDetails;
type tIUserDetails = IUserDetails;
type tIUpdateUserDetails = IUpdateUserDetails;
type tIUsernameListResultObject = IUsernameListResultObject;
type tIUserResultObject = IUserResultObject;
type tIGroupDetails = IGroupDetails;
type tIGroupResultObject = IGroupResultObject;
type tGroupNamesResultObject = GroupNamesResultObject;
type tIApiAccessResultObject = IApiAccessResultObject;
declare global {
namespace TcHmi.Server {
/**
* Provides functions for user management.
* @preserve (Part of the public API)
*/
namespace UserManagement {
const addUser: typeof _addUser;
const addUserEx: typeof _addUserEx;
const listUsernames: typeof _listUsernames;
const listUsernamesEx: typeof _listUsernamesEx;
const listUsers: typeof _listUsers;
const listUsersEx: typeof _listUsersEx;
const listUserGroups: typeof _listUserGroups;
const listUserGroupsEx: typeof _listUserGroupsEx;
const listUserGroupNames: typeof _listUserGroupNames;
const listUserGroupNamesEx: typeof _listUserGroupNamesEx;
const listUsersInGroup: typeof _listUsersInGroup;
const listUsersInGroupEx: typeof _listUsersInGroupEx;
const removeUser: typeof _removeUser;
const removeUserEx: typeof _removeUserEx;
const updateUser: typeof _updateUser;
const updateUserEx: typeof _updateUserEx;
const getApiAccess: typeof _getApiAccess;
type IUserManagementOptions = tIUserManagementOptions;
type IBaseUserDetails = tIBaseUserDetails;
type IUserDetails = tIUserDetails;
type IUpdateUserDetails = tIUpdateUserDetails;
type IUsernameListResultObject = tIUsernameListResultObject;
type IUserResultObject = tIUserResultObject;
type IGroupDetails = tIGroupDetails;
type IGroupResultObject = tIGroupResultObject;
type GroupNamesResultObject = tGroupNamesResultObject;
type IApiAccessResultObject = tIApiAccessResultObject;
}
}
}
export {};
//# sourceMappingURL=Server.UserManagement.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,773 @@
import type { IServerSymbolMetaDataResultObject } from './Symbol.js';
export * as ADS from './Server.ADS.js';
export * as AuditTrail from './Server.AuditTrail.js';
export * as Domains from './Server.Domains.js';
export * as Events from './Server.Events.js';
export * as Historize from './Server.Historize.js';
export * as RecipeManagement from './Server.RecipeManagement.js';
export * as UserManagement from './Server.UserManagement.js';
/**
* Returns the current readyState value of the underlying websocket which is connected to the server. Returns null when system is not ready.
* Use constants like WebSocket.CLOSED or WebSocket.OPEN for comparison.
* If websocket is OPEN handshakes between server and framework may not yet be done and server may not be ready for full functionality.
* Use isReady function instead.
* @returns The current readyState value of the underlying websocket which is connected to the server or null.
* @preserve (Part of the public API)
* @deprecated Please use isReady function.
*/
declare function getWebsocketReadyState(): number | null;
/**
* Returns true if the websocket is ready and false if its not.
* If websocket is ready handshakes between server and framework may not yet be done and server may not be ready for full functionality.
* Use isReady function instead.
* @returns If true the websocket is ready for connectivity.
* @preserve (Part of the public API)
* @deprecated Please use isReady function.
*/
declare function isWebsocketReady(): boolean;
/**
* Returns true if the server is ready for application communication.
* Websocket is ready and handshakes are done.
* @preserve (Part of the public API)
*/
export declare function isReady(): boolean;
/**
* Returns the framework related api version of the server in the form x.x.x.x and null if the
* current server version does not support this information yet or the server communication is not yet ready.
* You can call isReady function to determine if server is ready for communication.
* You can use the global tchmi_compare_version function to compare the result against a specific version.
* @preserve (Part of the public API)
*/
export declare function getApiVersion(): string | null;
/**
* Write one value to a TwinCAT HMI Server symbol.
* @param symbolName The target TwinCAT HMI Server symbolname.
* @param value The value which should be written to the target symbol.
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Request id
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function writeSymbol<W = any, R = W>(symbolName: string, value: W, callback?: null | ((this: void, data: IResultObject<W, R>) => void)): number | null;
/**
* Write multiple values to a TwinCAT HMI Server symbol.
* @param symbolName The target TwinCAT HMI Server symbolnames as array.
* @param value The values (as array) which should be written to the target symbol.
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Request id
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function writeSymbol<W = any, R = W>(symbolName: string[], value: W[], callback?: null | ((this: void, data: IResultObject<W, R>) => void)): number | null;
/**
* Write one or more values to a server symbol.
* @param symbolNames The target server symbol name or list of symbol names
* @param values The value which should be written to the target symbol.
* @param requestOptions Options for the request itself
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Request id
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function writeSymbolEx<W = any, R = W>(symbolNames: string | string[], values: W | W[], requestOptions: IRequestOptions | null, callback?: null | ((this: void, data: IResultObject<W, R>) => void)): number | null;
/**
* Write one or more values to a server symbol.
* @param symbolNames The target server symbol name or list of symbol names
* @param values The value which should be written to the target symbol.
* @param options Options
* @param options.symbolOptions Options for the symbols
* @param options.requestOptions Options for the request to the server
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Request id
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function writeSymbolEx2<W = any, R = W>(symbolNames: string | string[], values: W | W[], options: {
symbolOptions?: ISymbolOptions | ISymbolOptions[] | null;
requestOptions?: IRequestOptions | null;
} | null, callback?: null | ((this: void, data: IResultObject<W, R>) => void)): number | null;
/**
* Reads the value of one or multiple TwinCAT HMI Server symbol.
* @param symbolNames The target TwinCAT HMI Server symbolname or list of symbol names
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
* @returns Request id
* @template W unused because this is a read only
* @template R Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readSymbol<W = any, R = W>(symbolNames: string | string[], callback?: null | ((this: void, data: IResultObject<undefined, R>) => void)): number | null;
/**
* Reads the value of one or multiple TwinCAT HMI Server symbol.
* @param symbolNames The target TwinCAT HMI Server symbolname or list of symbol names
* @param requestOptions Options for the request itself
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
* @returns Request id
* @template W unused because this is a read only
* @template R Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readSymbolEx<W = any, R = W>(symbolNames: string | string[], requestOptions: IRequestOptions | null, callback?: null | ((this: void, data: IResultObject<undefined, R>) => void)): number | null;
/**
* Reads the value of a server symbol
* @param symbolNames The target symbol name or list of symbol names
* @param options Options
* @param options.symbolOptions Options for the symbols
* @param options.requestOptions Options for the request to the server
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
* @returns Request id
* @template R Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readSymbolEx2<R = any>(symbolNames: string | string[], options: {
symbolOptions?: ISymbolOptions | ISymbolOptions[] | null;
requestOptions?: IRequestOptions | null;
} | null, callback?: null | ((this: void, data: IResultObject<undefined, R>) => void)): number | null;
/**
* Subscribe to one or more server symbols.
* @param symbolNames The target server symbol name or list of symbol names.
* @param interval Subscription refresh interval.
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Subscription id
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function subscribeSymbol<R = any>(symbolNames: string | string[], interval: number, callback?: null | ((this: void, data: IResultObject<unknown, R>) => void)): number | null;
/**
* Subscribe to one or more server symbols with writeValue support for function symbols with parameters or cyclic writing.
* @param symbolNames The target server symbol name or list of symbol names.
* @param writeValues The value which should be written to the target symbol with each call.
* @param interval Subscription refresh interval.
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Subscription id
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function subscribeSymbolEx<W = any, R = W>(symbolNames: string | string[], writeValues: W | W[] | undefined, interval: number, callback?: null | ((this: void, data: IResultObject<W, R>) => void)): number | null;
/**
* Subscribe to one or more server symbols with writeValue support for function symbols with parameters or cyclic writing.
* @param symbolNames The target server symbol name or list of symbol names.
* @param writeValues The value which should be written to the target symbol.
* @param interval Subscription refresh interval.
* @param options Options
* @param options.symbolOptions Options for the symbols
* @param options.requestOptions Options for the request to the server
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Subscription id
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function subscribeSymbolEx2<W = any, R = W>(symbolNames: string | string[], writeValues: W | W[] | undefined, interval: number, options: {
symbolOptions?: ISymbolOptions | ISymbolOptions[] | null;
requestOptions?: IRequestOptions | null;
} | null, callback?: null | ((this: void, data: IResultObject<W, R>) => void)): number | null;
/**
* Resolves the schema of a server symbol by name.
* @param symbolName The target symbol name.
* @param callback Possibly asynchronous callback which will be raised when the resolved schema is available or the schema can't be resolved.
*/
export declare function resolveSymbolSchema(symbolName: string, callback?: null | ((this: void, data: ISchemaResultObject) => void)): void;
/**
* Resolves the schema of a server symbol by name.
* @param symbolName The target symbol name.
* @param options Options
* @param callback Possibly asynchronous callback which will be raised when the resolved schema is available or the schema can't be resolved.
*/
export declare function resolveSymbolSchemaEx(symbolName: string, options: IResolveSchemaOptions | null, callback?: null | ((this: void, data: ISchemaResultObject) => void)): void;
/**
* Resolves meta data of a server symbol by name.
* @param symbolName The target symbol name.
* @param callback Callback which will be raised when the meta data is available or the meta data can't be resolved.
*/
export declare function resolveSymbolMetaData(symbolName: string, callback?: null | ((this: void, data: IServerSymbolMetaDataResultObject) => void)): void;
/**
* Requests a message to the hmi server with default connection parameter
* @param request Request object
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
* @returns Request id
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function request<W = any, R = W>(request: IMessage<W, R>, callback?: null | ((this: void, data: IResultObject<W, R>) => void)): number | null;
/**
* Requests a message to the hmi server with given connection parameter
* @param request Request object
* @param requestOptions Options for the request itself
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* The callback function gets 'error' (TcHmi.Errors.E_WEBSOCKET_NOT_READY or TcHmi.Errors.NONE) and the response
* @returns Request id
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function requestEx<W = any, R = W>(request: IMessage<W, R>, requestOptions: IRequestOptions | null, callback?: null | ((this: void, data: IResultObject<W, R>) => void)): number | null;
/**
* Subscribe to a to a list of commands.
* Subscription have to be unsubscribed by use of the TcHmi.Server.unsubscribe function.
* @param commands Command object with the subscription
* @param interval Subscription refresh interval.
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Request id
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function subscribe<R = any>(commands: ICommand<unknown, R>[], interval: number, callback?: null | ((this: void, data: IResultObject<unknown, R>) => void)): number | null;
/**
* Subscribe to a to a list of commands.
* Subscription have to be unsubscribed by use of the TcHmi.Server.unsubscribe function.
* @param commands Command object with the subscription
* @param interval Subscription refresh interval.
* @param requestOptions Options for the request itself
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Request id
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
* @preserve (Part of the public API)
*/
export declare function subscribeEx<R = any>(commands: ICommand<unknown, R>[], interval: number, requestOptions: IRequestOptions | null, callback?: null | ((this: void, data: IResultObject<unknown, R>) => void)): number | null;
/**
* Unsubscribe a list of commands.
* @param requestId The id of the subscription request which shall be unsubscribed.
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Request id
* @preserve (Part of the public API)
*/
export declare function unsubscribe(requestId: number, callback?: null | ((this: void, data: IResultObject) => void)): number | null;
/**
* Unsubscribe a list of commands.
* @param requestId The id of the subscription request which shall be unsubscribed.
* @param requestOptions Options for the request itself
* @param callback Asynchronous response callback which will be raised when the operation has finished.
* @returns Request id
* @preserve (Part of the public API)
*/
export declare function unsubscribeEx(requestId: number, requestOptions: IRequestOptions | null, callback?: null | ((this: void, data: IResultObject) => void)): number | null;
/**
* Releases a request and associated resources like callbacks.
* @param id Id of the request to release.
* @preserve (Part of the public API)
*/
export declare function releaseRequest(id: number | null): void;
/**
* Get current username as string (could be __SystemGuest/__SystemUser without auth) or null when unknown (while loading).
* @preserve (Part of the public API)
*/
export declare function getCurrentUser(this: void): string | null;
/**
* Get groups membership of current user as array (can be empty).
* @preserve (Part of the public API)
*/
export declare function getGroupsOfCurrentUser(this: void): string[];
/**
* Get current user config.
* @preserve (Part of the public API)
*/
export declare function getCurrentUserConfig(this: void): UserConfigOnServer;
/**
* Login into a TcHmiServer, reloads the page on success, call of a callback after login.
* The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
* @param userName String with the username
* @param password String with the password
* @param persistent Should the session be valid even after browser restart
* @param callback This callback is called if the login was sent
* @returns returns a boolean if the login was called
* @preserve (Part of the public API)
*/
export declare function login(userName: string | null | undefined, password: string | null | undefined, persistent?: boolean, callback?: (this: void, resultObject: TcHmi.IResultObject) => void): boolean;
/**
* Login into a TcHmiServer, reloads the page on success, call of a callback after login.
* The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
* @param userName String with the username
* @param password String with the password
* @param persistent Should the session be valid even after browser restart
* @param requestOptions Options for the request itself
* @param callback This callback is called if the login was sent
* @returns returns a boolean if the login was called
* @preserve (Part of the public API)
*/
export declare function loginEx(userName: string | null | undefined, password: string | null | undefined, persistent: boolean | undefined, requestOptions: IRequestOptions | null, callback?: (this: void, data: TcHmi.IResultObject) => void): boolean;
/**
* Login into a TcHmiServer, reloads the page on success if not deactivated, call of a callback after login.
* The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified the default auth extension will be used.
* @param userName String with the username
* @param password String with the password
* @param persistent Should the session be valid even after browser restart
* @param reload Reload hmi after session login.
* @param requestOptions Options for the request itself
* @param callback This callback is called if the login was sent
* @returns returns a boolean if the login was called
* @preserve (Part of the public API)
*/
export declare function loginEx2(userName: string | null | undefined, password: string | null | undefined, persistent: boolean | undefined, reload: boolean | undefined, requestOptions: IRequestOptions | null, callback?: (this: void, data: TcHmi.IResultObject) => void): boolean;
/**
* Logout from a TcHmiServer, reloads the page on success
* @param callback This callback is called after the logout was sent
* @returns returns a boolean if the logout was called
* @preserve (Part of the public API)
*/
export declare function logout(callback?: null | ((this: void, resultObject: TcHmi.IResultObject) => void)): boolean;
/**
* Logout from a TcHmiServer, reloads the page on success
* @param requestOptions Options for the request itself
* @param callback This callback is called after the logout was sent
* @returns returns a boolean if the logout was called
* @preserve (Part of the public API)
*/
export declare function logoutEx(requestOptions: IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): boolean;
/**
* Logout from a TcHmiServer, optional reloads the page on success
* @param reload Reload hmi after session logout
* @param requestOptions Options for the request itself
* @param callback This callback is called after the logout was sent
* @returns returns a boolean if the logout was called
* @preserve (Part of the public API)
*/
export declare function logoutEx2(reload: boolean | undefined, requestOptions: IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): boolean;
/**
* Logout all users with a specific username or all users from a TcHmiServer
* @param username username to logout.
* If empty string or null is provided, all users are logged out.
* The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified all users with the given name will be logged out.
* 'Domain::' will logout every user from this domain
* @param callback This callback is called after the request was sent
* @returns returns a boolean if the logout was called
* @preserve (Part of the public API)
*/
export declare function forceLogout(username: string | IForceLogoutTarget | null | undefined, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): boolean;
/**
* Logout all users with a specific username or all users from a TcHmiServer
* @param userName username to logout.
* If empty string or null is provided, all users are logged out.
* The authentication domain can be specified by using 'Domain::UserName'. If no domain is specified all users with the given name will be logged out.
* 'Domain::' will logout every user from this domain
* @param requestOptions Options for the request itself
* @param callback This callback is called after the request was sent
* @returns returns a boolean if the logout was called
* @preserve (Part of the public API)
*/
export declare function forceLogoutEx(userName: string | IForceLogoutTarget | null | undefined, requestOptions: IRequestOptions | null, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): boolean;
/**
* Analyze the server result and calls
* completed callback if done (on any case),
* error if there at least is one error on top level or command level and
* success if there was no error at all.
* @param args Object with callbacks for success, error and completed.
* @param args.success Is called when the response contains no errors at all.
* @param args.error Is called when the response contains at least one command with an error.
* @param args.completed Is called anyway regardless of success or error.
* @template W Type of the write value. Use 'any' (or omit) if this contains multiple different types.
* @template R Type of the read value. Use 'any' (or omit) if this contains multiple different types.
*/
export declare function handleResponse<W = any, R = W>(args: {
/** Called with no error. */
success?: (this: void, data: Required<IResultObject<W, R>>) => void;
/** Called with at least one error on top level or command level. */
error?: (this: void, data: IResultObject<W, R>) => void;
/** Called in any case. */
completed?: (this: void, data: IResultObject<W, R>) => void;
}): (data: IResultObject<W, R>) => void;
/**
* Result object which could have no response object.
* @template W Type of the write value. Use 'any' (or omit) if this interface contains multiple different types.
* @template R Type of the read value.Use 'any' (or omit) if this interface contains multiple different types.
*/
export interface IResultObject<W = any, R = W> extends TcHmi.IResultObject {
/** The response of the server. */
response?: TcHmi.SelectableRequired<IMessage<W, R>, 'apiVersion' | 'id' | 'sessionId' | 'commands'>;
/**
* The related command indices.
* In case of a bundled request the response may contain more than the request related commands.
* This array contains the indices of the request related command indicies.
**/
responseCommandIndices?: number[];
/**
* Read values per command.
* In case of a bundled request this array will only contain the request related results in order.
**/
results?: IValueResultObject<R>[];
}
/**
* Result object with value of a command.
* @template W Type of the write value. Use 'any' (or omit) if this interface contains multiple different types.
* @template R Type of the read value.Use 'any' (or omit) if this interface contains multiple different types.
*/
export interface IValueResultObject<R = any> extends IResultObject {
symbol?: string;
value?: R;
}
/**
* A message to the server.
* @template W Type of the write value. Use 'any' (or omit) if this interface contains multiple different types.
* @template R Type of the read value.Use 'any' (or omit) if this interface contains multiple different types.
*/
export type IMessage<W = any, R = W> = IReadWriteMessage<W, R> | ISubscriptionMessage<W, R> | IEventMessage<W, R>;
/**
* Message common interface.
* @template W Type of the write value. Use 'any' (or omit) if this interface contains multiple different types.
* @template R Type of the read value.Use 'any' (or omit) if this interface contains multiple different types.
*/
export interface IMessageBase<W = any, R = W> {
apiVersion?: string;
id?: number;
sessionId?: string;
/** Id of the server instance (cookies are shared with all servers on the same host) */
serverId?: string;
error?: TcHmi.IErrorDetails;
/** custom string which will be in the answer again */
customerData?: string;
commands?: ICommand<W, R>[];
}
/**
* A message to read or write to the server.
* @template W Type of the write value. Use 'any' (or omit) if this interface contains multiple different types.
* @template R Type of the read value.Use 'any' (or omit) if this interface contains multiple different types.
*/
export interface IReadWriteMessage<W = any, R = W> extends IMessageBase<W, R> {
requestType: 'ReadWrite';
}
/**
* A message to request a subscription in the server.
* @template W Type of the write value. Use 'any' (or omit) if this interface contains multiple different types.
* @template R Type of the read value.Use 'any' (or omit) if this interface contains multiple different types.
*/
export interface ISubscriptionMessage<W = any, R = W> extends IMessageBase<W, R> {
requestType: 'Subscription';
/** Minimal time the subscription ticks will be fired on symbol changes. If not set the default of the project will be used */
intervalTime?: number | null;
}
/**
* A message to request an event in the server.
* @template W Type of the write value. Use 'any' (or omit) if this interface contains multiple different types.
* @template R Type of the read value.Use 'any' (or omit) if this interface contains multiple different types.
*/
export interface IEventMessage<W = any, R = W> extends IMessageBase<W, R> {
requestType: 'Event';
}
export declare enum Error {
HMI_SUCCESS = 0,
HMI_E_FAIL = 257,
HMI_E_SYMBOL_IN_USE = 274,
HMI_E_SYMBOL_NOT_MAPPED = 513,
HMI_E_LICENSE_TARGET = 778,
HMI_E_MISSING_LICENSE_HANDSHAKE = 781,
HMI_E_LICENSE_VERIFY = 782,
HMI_E_PASSWORD_CHANGE_REQUIRED = 4096,
HMI_E_INSUFFICIENT_ACCESS = 4101
}
/**
* tchmi:server#/definitions/accessEnum
*
* NONE = 0,
* READ = 1,
* WRITE = 2,
* READWRITE = 3
*/
export declare enum ACCESS {
NONE = 0,
READ = 1,
WRITE = 2,
READWRITE = 3
}
/**
* One command for the server.
* @template W Type of the write value. Use 'any' (or omit) if this interface contains multiple different types.
* @template R Type of the read value.Use 'any' (or omit) if this interface contains multiple different types.
*/
export interface ICommand<W = any, R = W> {
/** Name of the symbol */
symbol: string;
/** Custom string which will be forwared to the response */
customerData?: string;
/** Write value */
writeValue?: W;
/** Read value */
readValue?: R;
/** Error of the command */
error?: TcHmi.IErrorDetails;
/** Command options */
commandOptions?: ICommandOptions[];
/** Filter for arrays and maps. */
filter?: TcHmi.Filter | string;
/** Maps the filtered, sorted, and paged values to their original positions */
filterMap?: number[];
/** Order by settings. This is processed before limit and offset are used. */
orderBy?: string;
/** Should/is the request restricted in amount of array entries? 0 disables the limit. */
limit?: number;
/** Array entries should/do not start at the beginning (Zero-based numbering) */
offset?: number;
/** The answer has this amount of entries */
maxEntries?: number;
/** The time the command processing has started as iso 8601 string. */
processedStart?: string;
/** The time the command processing has ended as iso 8601 string. */
processedEnd?: string;
/** The amount of sub symbol levels */
maxSubSymbolDepth?: number;
/** Extension specific data. */
extensionData?: TcHmi.Dictionary<object>;
/** The version of the symbol.*/
version?: number;
/** The index of the command in the request. */
commandIndex?: number;
}
/** Supported types of requests of the server. */
export type IRequestType = 'ReadWrite' | 'Subscription' | 'Event';
/** Supported commands options of requests of the server. */
export type ICommandOptions =
/** Config Symbols only: When using vectors, add the entry at the end instead of replacing it. */
'Add'
/** Config Symbols only: Deletes the given vector or map entry. */
| 'Delete'
/** Config Symbols only: Config beforeChange handlers are sent to beforeImport and the whole config is sent for easier validation. */
| 'Import'
/** Do not pass the symbol to the extension, simulate it instead. */
| 'Offline'
/** Set by the server only: Paging for this symbol has been done. */
| 'PagingHandled'
/** For subscriptions only: Send a response for each subscription tick, even if the data has not changed. */
| 'Poll'
/** Config Symbols only: Replace the whole data structure instead of partially updating it. */
| 'Replace'
/** Add error message and reason to the response. By default, only the error code is returned. */
| 'SendErrorMessage'
/** Send the writeValue for requests back to the client. */
| 'SendWriteValue'
/** Config Symbols only: If one of the commands in the request fails all changes will be rolled back. */
| 'Transaction'
/** Validate the readValue against the symbol's JSON schema before sending it to the client. */
| 'ValidateRead'
/** Do not merge subscriptions. */
| 'UniqueHash'
/** Use timespan instead of timestamp for the `processedStart` and `processedEnd` fields. */
| 'ProcessTimingAsTimespan' | 'Extension1' | 'Extension2' | 'Extension3' | 'Extension4';
/** Internal state of the user config */
export declare const enum UserConfigState {
/** Userconfig is still loaded. */
loading = 0,
/** Userconfig loading failed. */
loadingerror = 1,
/** No auth is required. */
noAuthRequired = 2,
/** Engineering server is active. */
communicationDisabled = 3,
/** Access set by group membership. */
usergroup = 4
}
export interface UserConfigOnServer {
/** State of the request for the config from server */
state: UserConfigState;
/** List of the groups the current user is member of */
userIsInGroups: string[];
/** Current Username (could be __SystemGuest/__SystemUser without auth) or null when unknown (while loading) */
name: string | null;
/**
* Current authentication domain for example "TcHmiUserManagement".
* This value is only set when auth is required/active.
*/
domain: string | null;
/** Current locale of this user for texts. Could be undefined if client locale should be used for this user! */
locale: string | undefined;
/** Configured locale of this user for texts. 'client' is the browser setting. 'project' refer to the default of the project which could be 'client' and a locale name. */
configLocale: string | 'client' | 'project';
/** Current locale of this user for date formatting. Could be undefined if client locale should be used for this user! */
timeFormatLocale: string | undefined;
/** Configured locale of this user for time formats. 'client' is the browser setting. 'project' refer to the default of the project which could be 'client' and a locale name. */
configTimeFormatLocale: string | undefined;
/** Current time zone of this user to use in .toLocaleString() option. Could be undefined if client locale should be used for this user! */
timeZone: string | undefined;
/**
* Millisecond offset to utc calculated from the current timeZone of the user.
* This is +1 * 60 * 60 * 1000 or +2 * 60 * 60 * 1000 for central Europe.
*/
timeZoneOffset: number;
/** Configured time zone of this user. 'client' is the browser setting. 'project' refer to the default of the project which could be 'client' and a time zone name. */
configTimeZone: string | undefined;
/** Current ip as seen from the server */
clientIp: string;
/** Current Session ID */
session: string | null;
/** Thumbprint/fingerprint of the client certificate */
clientCertificate: string | null;
/** Timespan (in ms) for a auto logoff. null disables auto logoff */
autoLogOffMilliSeconds: number | null;
/** Clear text error message */
errorMessage: string;
/** Name of the extension which handles default authentication */
defaultAuthExtension: string;
/** Name of the user group a new user will be by default */
defaultUserGroup: string;
}
/**
* Request level options
*/
export interface IRequestOptions {
/**
* After the timeout in ms the request will be aborted.
* Timer starts when the request hit the API, not when the request is send to the server (after waiting in the queue?).
**/
timeout?: number;
/** If not set to true the request will be held in the queue so every request is send after each others. */
parallel?: boolean;
/** The request can be added to a group. */
groupId?: string | null;
/** The request with the request id should be refreshed instead of creating a new request. */
refresh?: boolean;
}
/**
* Symbol/command level options
*/
export interface ISymbolOptions {
version: number;
}
export interface IForceLogoutTarget {
/** IP address of the client */
clientIp?: string;
/** Thumbprint of the used client certificate */
clientCertificate?: string;
/** User group */
group?: string;
/** session id of the user */
sessionId?: string;
}
export interface ISchemaResultObject extends TcHmi.IResultObject {
schema?: TcHmi.JsonSchema;
}
export interface IResolveSchemaOptions {
version?: number;
}
declare const _getWebsocketReadyState: typeof getWebsocketReadyState;
declare const _isWebsocketReady: typeof isWebsocketReady;
declare const _isReady: typeof isReady;
declare const _getApiVersion: typeof getApiVersion;
declare const _writeSymbol: typeof writeSymbol;
declare const _writeSymbolEx: typeof writeSymbolEx;
declare const _writeSymbolEx2: typeof writeSymbolEx2;
declare const _readSymbol: typeof readSymbol;
declare const _readSymbolEx: typeof readSymbolEx;
declare const _readSymbolEx2: typeof readSymbolEx2;
declare const _subscribeSymbol: typeof subscribeSymbol;
declare const _subscribeSymbolEx: typeof subscribeSymbolEx;
declare const _subscribeSymbolEx2: typeof subscribeSymbolEx2;
declare const _resolveSymbolSchema: typeof resolveSymbolSchema;
declare const _resolveSymbolSchemaEx: typeof resolveSymbolSchemaEx;
declare const _resolveSymbolMetaData: typeof resolveSymbolMetaData;
declare const _request: typeof request;
declare const _requestEx: typeof requestEx;
declare const _subscribe: typeof subscribe;
declare const _subscribeEx: typeof subscribeEx;
declare const _unsubscribe: typeof unsubscribe;
declare const _unsubscribeEx: typeof unsubscribeEx;
declare const _releaseRequest: typeof releaseRequest;
declare const _getCurrentUser: typeof getCurrentUser;
declare const _getGroupsOfCurrentUser: typeof getGroupsOfCurrentUser;
declare const _getCurrentUserConfig: typeof getCurrentUserConfig;
declare const _login: typeof login;
declare const _loginEx: typeof loginEx;
declare const _loginEx2: typeof loginEx2;
declare const _logout: typeof logout;
declare const _logoutEx: typeof logoutEx;
declare const _logoutEx2: typeof logoutEx2;
declare const _forceLogout: typeof forceLogout;
declare const _forceLogoutEx: typeof forceLogoutEx;
declare const _handleResponse: typeof handleResponse;
type tIResultObject<W = any, R = W> = IResultObject<W, R>;
type tIValueResultObject<R = any> = IValueResultObject<R>;
type tIMessage<W = any, R = W> = IMessage<W, R>;
type tIMessageBase<W = any, R = W> = IMessageBase<W, R>;
type tIReadWriteMessage<W = any, R = W> = IReadWriteMessage<W, R>;
type tISubscriptionMessage<W = any, R = W> = ISubscriptionMessage<W, R>;
type tISymbolOptions = ISymbolOptions;
type tIEventMessage<W = any, R = W> = IEventMessage<W, R>;
declare const _Error: typeof Error;
type tError = Error;
declare const _ACCESS: typeof ACCESS;
type tACCESS = ACCESS;
type tICommand<W = any, R = W> = ICommand<W, R>;
type tIRequestType = IRequestType;
type tICommandOptions = ICommandOptions;
type tIRequestOptions = IRequestOptions;
type tSymbolOptions = ISymbolOptions;
type tUserConfigState = UserConfigState;
type tUserConfigOnServer = UserConfigOnServer;
type tIForceLogoutTarget = IForceLogoutTarget;
type tISchemaResultObject = ISchemaResultObject;
type tIResolveSchemaOptions = IResolveSchemaOptions;
declare global {
namespace TcHmi {
/**
* Provides functions for interaction with the server.
* @preserve (Part of the public API)
*/
namespace Server {
let getWebsocketReadyState: typeof _getWebsocketReadyState;
let isWebsocketReady: typeof _isWebsocketReady;
let isReady: typeof _isReady;
let getApiVersion: typeof _getApiVersion;
let writeSymbol: typeof _writeSymbol;
let writeSymbolEx: typeof _writeSymbolEx;
let writeSymbolEx2: typeof _writeSymbolEx2;
let readSymbol: typeof _readSymbol;
let readSymbolEx: typeof _readSymbolEx;
let readSymbolEx2: typeof _readSymbolEx2;
let subscribeSymbol: typeof _subscribeSymbol;
let subscribeSymbolEx: typeof _subscribeSymbolEx;
let subscribeSymbolEx2: typeof _subscribeSymbolEx2;
let resolveSymbolSchema: typeof _resolveSymbolSchema;
let resolveSymbolSchemaEx: typeof _resolveSymbolSchemaEx;
let resolveSymbolMetaData: typeof _resolveSymbolMetaData;
let request: typeof _request;
let requestEx: typeof _requestEx;
let subscribe: typeof _subscribe;
let subscribeEx: typeof _subscribeEx;
let unsubscribe: typeof _unsubscribe;
let unsubscribeEx: typeof _unsubscribeEx;
let releaseRequest: typeof _releaseRequest;
let getCurrentUser: typeof _getCurrentUser;
let getGroupsOfCurrentUser: typeof _getGroupsOfCurrentUser;
let getCurrentUserConfig: typeof _getCurrentUserConfig;
let login: typeof _login;
let loginEx: typeof _loginEx;
let loginEx2: typeof _loginEx2;
let logout: typeof _logout;
let logoutEx: typeof _logoutEx;
let logoutEx2: typeof _logoutEx2;
let forceLogout: typeof _forceLogout;
let forceLogoutEx: typeof _forceLogoutEx;
let handleResponse: typeof _handleResponse;
type IResultObject<W = any, R = W> = tIResultObject<W, R>;
type IValueResultObject<R = any> = tIValueResultObject<R>;
type IMessage<W = any, R = W> = tIMessage<W, R>;
type IMessageBase<W = any, R = W> = tIMessageBase<W, R>;
type IReadWriteMessage<W = any, R = W> = tIReadWriteMessage<W, R>;
type ISubscriptionMessage<W = any, R = W> = tISubscriptionMessage<W, R>;
type ISymbolOptions = tISymbolOptions;
type IEventMessage<W = any, R = W> = tIEventMessage<W, R>;
let Error: typeof _Error;
type Error = tError;
let ACCESS: typeof _ACCESS;
type ACCESS = tACCESS;
type ICommand<W = any, R = W> = tICommand<W, R>;
type IRequestType = tIRequestType;
type ICommandOptions = tICommandOptions;
type IRequestOptions = tIRequestOptions;
type SymbolOptions = tSymbolOptions;
let userConfigState: typeof UserConfigState;
type userConfigState = tUserConfigState;
type userConfigOnServer = tUserConfigOnServer;
type IForceLogoutTarget = tIForceLogoutTarget;
type ISchemaResultObject = tISchemaResultObject;
type IResolveSchemaOptions = tIResolveSchemaOptions;
}
}
}
//# sourceMappingURL=Server.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,342 @@
/**
* Returns all computed styles that are active on the first given element. Does return values set by CSS files, the other Style APIs and AnimationProvider
* Unset or unknown CSS values will not be set in the result object.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
*/
export declare function getComputedElementStyle(element: Iterable<Element> | Element | undefined): TcHmi.Dictionary<string>;
/**
* Returns the given computed CSS property on the first given element. Does return values set by CSS files, the other Style APIs and AnimationProvider
* Unset or unknown CSS values will not be set in the result object.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyName The CSS property to get.
* @template T Name of the property to fetch
*/
export declare function getComputedElementStyle<T extends string>(element: Iterable<Element> | Element | undefined, propertyName: T): Record<T, string>;
/**
* Returns the given computed CSS property on the first given element. Does return values set by CSS files, the other Style APIs and AnimationProvider
* Unset or unknown CSS values will not be set in the result object.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyNames The CSS properties to get.
* @template T Names of the properties to fetch
*/
export declare function getComputedElementStyle<T extends string>(element: Iterable<Element> | Element | undefined, propertyNames: readonly T[]): Record<T, string>;
/**
* Returns all styles that are set on the first given element. Does not return values set by CSS files, the other Style APIs and AnimationProvider
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
*/
export declare function getSimpleElementStyle(element: Iterable<Element> | Element | undefined): TcHmi.Dictionary<string>;
/**
* Returns the given CSS property on the first given element. Does not return values set by CSS files, the other Style APIs and AnimationProvider
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyName The CSS property to get.
* @template T Name of the property to fetch
*/
export declare function getSimpleElementStyle<T extends string>(element: Iterable<Element> | Element | undefined, propertyName: T): Record<T, string>;
/**
* Returns the given CSS property on the first given element. Does not return values set by CSS files, the other Style APIs and AnimationProvider
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyNames The CSS properties to get.
* @template T Names of the properties to fetch
*/
export declare function getSimpleElementStyle<T extends string>(element: Iterable<Element> | Element | undefined, propertyNames: readonly T[]): Record<T, string>;
/**
* Style setter for simple styles in a collection of JQuery elements or single HTML or SVG Elements.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyName The CSS property to process.
* @param value The value for the CSS property.
*/
export declare function setSimpleElementStyle(element: Iterable<Element> | Element | undefined, propertyName: string, value: string | null | undefined): void;
/**
* Style setter forsimple styles in a collection of JQuery elements or single HTML or SVG Elements.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyName The CSS property to process.
* @param values An array of values for the CSS property. This is useful for providing vendor-prefixed values to ensure compatibility.
*/
export declare function setSimpleElementStyle(element: Iterable<Element> | Element | undefined, propertyName: string, values: readonly string[] | null): void;
/**
* Style setter for simple styles in a collection of JQuery elements or single HTML or SVG Elements.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param styles A dictionary of property-value pairs. Can be used to set multiple styles simultaneously. The values can be strings or null to remove values.
*/
export declare function setSimpleElementStyle(element: Iterable<Element> | Element | undefined, styles: Readonly<TcHmi.Dictionary<string | readonly string[] | null | undefined>> | null): void;
/**
* Style processor for generic styles.
* @param controlName The name of the target control.
* @param selector The target CSS selector. %id% is automatically replaced by the control name. Pass an empty string to target the control root.
* @param property The CSS property to process.
* @param value The value for the CSS property.
*/
export declare function processGenericStyle(controlName: string, selector: string, property: string, value: string | null): void;
/**
* Style processor for generic styles.
* @param controlName The name of the target control.
* @param selector The target CSS selector. %id% is automatically replaced by the control name. Pass an empty string to target the control root.
* @param propertyName The CSS property to process.
* @param value An array of values for the CSS property. This is useful for providing vendor-prefixed values to ensure compatibility.
*/
export declare function processGenericStyle(controlName: string, selector: string, propertyName: string, value: string[] | null): void;
/**
* Style processor for generic styles.
* @param controlName The name of the target control.
* @param selector The target CSS selector. %id% is automatically replaced by the control name. Pass an empty string to target the control root.
* @param styles A dictionary of property-value pairs. Can be used to set multiple styles simultaneously. The values can be strings or arrays of strings to provide vendor-prefixed values.
*/
export declare function processGenericStyle(controlName: string, selector: string, styles: TcHmi.Dictionary<string | string[] | null>): void;
/**
* Resolves a SolidColor object to a string representation for use as css color property.
* Has to be called with a valid SolidColor. Use isSolidColor to check
* @param colorObject The SolidColor to resolve.
* @preserve (Part of the public API)
*/
export declare function resolveSolidColorAsCssValue(colorObject: TcHmi.SolidColor): string;
/**
* Resolve a SolidColor object to a RGBAColor object.
* Has to be called with a valid SolidColor. Use isSolidColor to check
* @param colorObject The SolidColor to resolve.
* @preserve (Part of the public API)
*/
export declare function resolveSolidColorAsRGBA(colorObject: TcHmi.SolidColor): TcHmi.RGBAColor;
/**
* Normalize a SolidColor object
* Every supported color format will be returned as
* for example '#ff0000' or with transparency as 'rgba(255, 0, 0, 0.333)'
* Has to be called with a valid SolidColor. Use isSolidColor to check
* @param colorObject The SolidColor to normalize.
* @preserve (Part of the public API)
*/
export declare function normalizeColorAsCssValue(colorObject: TcHmi.SolidColor): string;
/**
* Resolves a LinearGradientColor object to a string representation for use in css background-image property.
* Has to be called with a valid LinearGradientColor. Use isLinearGradientColor to check
* @param colorObject The LinearGradientColor to resolve.
* @preserve (Part of the public API)
*/
export declare function resolveLinearGradientColorAsCssValue(colorObject: TcHmi.LinearGradientColor): string;
/**
* Style Processor for background. This handles spaces and ' or " in URLs, too.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new value for the background.
* @preserve (Part of the public API)
*/
export declare function processBackground(element: Iterable<HTMLElement> | HTMLElement | undefined, valueNew: Partial<TcHmi.Background> | null | undefined): void;
/**
* Style Processor for background colors and gradients.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new value for the background.
* @preserve (Part of the public API)
*/
export declare function processBackgroundColor(element: Iterable<HTMLElement> | HTMLElement | undefined, valueNew: TcHmi.Color | null | undefined): void;
/**
* Style Processor for background images. This handles spaces and ' or " in URLs, too.
* ValueNew undefined, null or empty string will remove the background image.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The URL of the image.
* @preserve (Part of the public API)
*/
export declare function processBackgroundImage(element: Iterable<HTMLElement> | HTMLElement | undefined, valueNew: string | null | undefined): void;
/**
* Style processor for SVG fill color.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new fill color.
* @preserve (Part of the public API)
* HTMLElement allowed because default jQuery type is HTMLElement
*/
export declare function processFillColor(element: JQuery<SVGElement | HTMLElement> | Iterable<SVGElement> | SVGElement | undefined, valueNew: TcHmi.Color | null | undefined): void;
/**
* Style processor for SVG stroke color.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new stroke color.
* @preserve (Part of the public API)
* HTMLElement allowed because default jQuery type is HTMLElement
*/
export declare function processStrokeColor(element: JQuery<SVGElement | HTMLElement> | Iterable<SVGElement> | SVGElement | undefined, valueNew: TcHmi.SolidColor | null | undefined): void;
/**
* Style processor for text color.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new text color.
* @preserve (Part of the public API)
*/
export declare function processTextColor(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: TcHmi.SolidColor | null | undefined): void;
/**
* Style processor for border color.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border color.
* @preserve (Part of the public API)
*/
export declare function processBorderColor(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: TcHmi.Color | null | undefined): void;
/**
* Style processor for border width.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border widths.
* @preserve (Part of the public API)
*/
export declare function processBorderWidth(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: Partial<TcHmi.BorderWidth> | null | undefined): void;
/**
* Style processor for border radius.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border radii.
* @preserve (Part of the public API)
*/
export declare function processBorderRadius(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: TcHmi.BorderRadius | null | undefined): void;
/**
* Style processor for border style.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border styles.
* @preserve (Part of the public API)
*/
export declare function processBorderStyle(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: TcHmi.BorderStyle | null | undefined): void;
/**
* Style processor for box shadow.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border styles.
* @preserve (Part of the public API)
*/
export declare function processBoxShadow(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: readonly TcHmi.BoxShadow[] | null | undefined): void;
/**
* Style processor for font family.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new font family.
* @preserve (Part of the public API)
*/
export declare function processFontFamily(element: JQuery | readonly Element[] | NodeListOf<Element> | HTMLCollectionOf<Element> | Element | undefined, valueNew: TcHmi.FontFamily | null | undefined): void;
/**
* Style processor for font size.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new font size.
* @param unitNew The new font size unit. Defaults to "px".
* @preserve (Part of the public API)
*/
export declare function processFontSize(element: JQuery | readonly Element[] | NodeListOf<Element> | HTMLCollectionOf<Element> | Element | undefined, valueNew: number | null | undefined, unitNew?: TcHmi.FontSizeUnit): void;
/**
* Style processor for font style.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new font style. Allowed values are "Normal", "Italic" and "Oblique".
* @preserve (Part of the public API)
*/
export declare function processFontStyle(element: JQuery | readonly Element[] | NodeListOf<Element> | HTMLCollectionOf<Element> | Element | undefined, valueNew: TcHmi.FontStyle | null | undefined): void;
/**
* Style processor for font weight.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new font weight. Allowed values are "Normal" and "Bold".
* @preserve (Part of the public API)
*/
export declare function processFontWeight(element: JQuery | readonly Element[] | NodeListOf<Element> | HTMLCollectionOf<Element> | Element | undefined, valueNew: TcHmi.FontWeight | null | undefined): void;
/**
* Style processor for visibility.
* Visibility also affects pointer events, i.e. a hidden element will not receive mouse click events.
* Hidden still uses space in fluid calculations, collapsed is ignored there.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new visibility. Allowed values are "Visible", "Collapsed" and "Hidden". Hidden still uses space in fluid calculations, collapsed is ignored there.
* @preserve (Part of the public API)
*/
export declare function processVisibility(element: JQuery | readonly Element[] | NodeListOf<Element> | HTMLCollectionOf<Element> | Element | undefined, valueNew: TcHmi.Visibility | null | undefined): void;
/**
* Style processor for horizontal alignment. This aligns the content of the target element, not the target element itself.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new horizontal alignment. Allowed values are "Left", "Center" and "Right".
* @preserve (Part of the public API)
*/
export declare function processContentHorizontalAlignment(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: TcHmi.HorizontalAlignment | null | undefined): void;
/**
* Style processor for vertical alignment. This aligns the content of the target element, not the target element itself.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new vertical alignment. Allowed values are "Top", "Center" and "Bottom".
* @preserve (Part of the public API)
*/
export declare function processContentVerticalAlignment(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: TcHmi.VerticalAlignment | null | undefined): void;
/**
* Style processor for content padding.
* Note: Percentages always refer to the width of the element, never its height (even for top and bottom).
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new content padding.
* @preserve (Part of the public API)
*/
export declare function processContentPadding(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: Partial<TcHmi.FourSidedCss> | null | undefined): void;
/**
* Theme processor for transforms.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new transform value or an array of transform values.
* @param order If this parameter is passed, the transforms in valueNew will replace the transform at the specified place, instead of replacing all transforms.
* @preserve (Part of the public API)
*/
export declare function processTransform(element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined, valueNew: TcHmi.Transform | TcHmi.Transform[] | null | undefined, order?: number): void;
/**
* Return the width of the given text in px as it would appear on the given element.
* Make sure the element you operate with is attached to the DOM.
* The function uses the computed values of the element which only exist when an element is attached to the DOM.
* This function only works with single line text.
* @param text The text to measure.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @preserve (Part of the public API)
*/
export declare function getTextWidth(text: string, element: JQuery | readonly HTMLElement[] | NodeListOf<HTMLElement> | HTMLCollectionOf<HTMLElement> | HTMLElement | undefined): number | null;
declare const _getComputedElementStyle: typeof getComputedElementStyle;
declare const _getSimpleElementStyle: typeof getSimpleElementStyle;
declare const _setSimpleElementStyle: typeof setSimpleElementStyle;
declare const _processGenericStyle: typeof processGenericStyle;
declare const _resolveSolidColorAsCssValue: typeof resolveSolidColorAsCssValue;
declare const _resolveSolidColorAsRGBA: typeof resolveSolidColorAsRGBA;
declare const _normalizeColorAsCssValue: typeof normalizeColorAsCssValue;
declare const _resolveLinearGradientColorAsCssValue: typeof resolveLinearGradientColorAsCssValue;
declare const _processBackground: typeof processBackground;
declare const _processBackgroundColor: typeof processBackgroundColor;
declare const _processBackgroundImage: typeof processBackgroundImage;
declare const _processFillColor: typeof processFillColor;
declare const _processStrokeColor: typeof processStrokeColor;
declare const _processTextColor: typeof processTextColor;
declare const _processBorderColor: typeof processBorderColor;
declare const _processBorderWidth: typeof processBorderWidth;
declare const _processBorderRadius: typeof processBorderRadius;
declare const _processBorderStyle: typeof processBorderStyle;
declare const _processBoxShadow: typeof processBoxShadow;
declare const _processFontFamily: typeof processFontFamily;
declare const _processFontSize: typeof processFontSize;
declare const _processFontStyle: typeof processFontStyle;
declare const _processFontWeight: typeof processFontWeight;
declare const _processVisibility: typeof processVisibility;
declare const _processContentHorizontalAlignment: typeof processContentHorizontalAlignment;
declare const _processContentVerticalAlignment: typeof processContentVerticalAlignment;
declare const _processContentPadding: typeof processContentPadding;
declare const _processTransform: typeof processTransform;
declare const _getTextWidth: typeof getTextWidth;
declare global {
namespace TcHmi {
/**
* Provides functions for manipulating HTML elements.
* @preserve (Part of the public API)
*/
namespace StyleProvider {
const getComputedElementStyle: typeof _getComputedElementStyle;
const getSimpleElementStyle: typeof _getSimpleElementStyle;
const setSimpleElementStyle: typeof _setSimpleElementStyle;
const processGenericStyle: typeof _processGenericStyle;
const resolveSolidColorAsCssValue: typeof _resolveSolidColorAsCssValue;
const resolveSolidColorAsRGBA: typeof _resolveSolidColorAsRGBA;
const normalizeColorAsCssValue: typeof _normalizeColorAsCssValue;
const resolveLinearGradientColorAsCssValue: typeof _resolveLinearGradientColorAsCssValue;
const processBackground: typeof _processBackground;
const processBackgroundColor: typeof _processBackgroundColor;
const processBackgroundImage: typeof _processBackgroundImage;
const processFillColor: typeof _processFillColor;
const processStrokeColor: typeof _processStrokeColor;
const processTextColor: typeof _processTextColor;
const processBorderColor: typeof _processBorderColor;
const processBorderWidth: typeof _processBorderWidth;
const processBorderRadius: typeof _processBorderRadius;
const processBorderStyle: typeof _processBorderStyle;
const processBoxShadow: typeof _processBoxShadow;
const processFontFamily: typeof _processFontFamily;
const processFontSize: typeof _processFontSize;
const processFontStyle: typeof _processFontStyle;
const processFontWeight: typeof _processFontWeight;
const processVisibility: typeof _processVisibility;
const processContentHorizontalAlignment: typeof _processContentHorizontalAlignment;
const processContentVerticalAlignment: typeof _processContentVerticalAlignment;
const processContentPadding: typeof _processContentPadding;
const processTransform: typeof _processTransform;
const getTextWidth: typeof _getTextWidth;
}
}
}
export {};
//# sourceMappingURL=StyleProvider.d.ts.map

View File

@@ -0,0 +1,184 @@
import{styleManager}from"../System/StyleManager.js";
/**
* Returns the given computed CSS property on the first given element. Does return values set by CSS files, the other Style APIs and AnimationProvider
* Unset or unknown CSS values will not be set in the result object.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyNameOrPropertyNames The CSS property (string) or properties (string array) to get.
* @preserve (Part of the public API)
*/export function getComputedElementStyle(element,propertyNameOrPropertyNames){return styleManager.__getElementStyle(element,propertyNameOrPropertyNames,!0)}
/**
* Returns the given CSS property on the first given element. Does not return values set by CSS files, the other Style APIs and AnimationProvider
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyNameOrPropertyNames The CSS property (string) or properties (string array) to get.
* @preserve (Part of the public API)
*/export function getSimpleElementStyle(element,propertyNameOrPropertyNames){return styleManager.__getElementStyle(element,propertyNameOrPropertyNames,!1)}
/**
* Style setter for simple styles in a collection of JQuery elements or single HTML or SVG Elements.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param propertyNameOrPropertyNames The CSS property to process or a dictionary of property value pairs.
* @param valueOrValues The value for the CSS property or an array of values. Only used if second parameter is no object.
* @preserve (Part of the public API)
*/export function setSimpleElementStyle(element,propertyNameOrPropertyNames,valueOrValues=null){styleManager.__setSimpleElementStyle(element,propertyNameOrPropertyNames,valueOrValues)}export function processGenericStyle(controlName,selector,propertyName,value=null){styleManager.processGenericStyle(controlName,selector,propertyName,value)}
/**
* Resolves a SolidColor object to a string representation for use as css color property.
* Has to be called with a valid SolidColor. Use isSolidColor to check
* @param colorObject The SolidColor to resolve.
* @preserve (Part of the public API)
*/export function resolveSolidColorAsCssValue(colorObject){return"none"===colorObject.color.toLowerCase()?"transparent":colorObject.color}
/**
* Resolve a SolidColor object to a RGBAColor object.
* Has to be called with a valid SolidColor. Use isSolidColor to check
* @param colorObject The SolidColor to resolve.
* @preserve (Part of the public API)
*/export function resolveSolidColorAsRGBA(colorObject){const canvas=document.createElement("canvas");canvas.width=canvas.height=1;const ctx=canvas.getContext("2d",{willReadFrequently:!0});ctx.clearRect(0,0,1,1),ctx.fillStyle=resolveSolidColorAsCssValue(colorObject),ctx.fillRect(0,0,1,1);const rgba=ctx.getImageData(0,0,1,1).data;return{r:rgba[0],g:rgba[1],b:rgba[2],a:rgba[3]}}let __normalizedColorMap=new Map;
/**
* Normalize a SolidColor object
* Every supported color format will be returned as
* for example '#ff0000' or with transparency as 'rgba(255, 0, 0, 0.333)'
* Has to be called with a valid SolidColor. Use isSolidColor to check
* @param colorObject The SolidColor to normalize.
* @preserve (Part of the public API)
*/export function normalizeColorAsCssValue(colorObject){const savedColor=__normalizedColorMap.get(colorObject.color);if(savedColor)return savedColor;const ctx=document.createElement("canvas").getContext("2d");ctx.strokeStyle=resolveSolidColorAsCssValue(colorObject);const resolvedColor=ctx.strokeStyle;return __normalizedColorMap.set(colorObject.color,resolvedColor),resolvedColor}
/**
* Resolves a LinearGradientColor object to a string representation for use in css background-image property.
* Has to be called with a valid LinearGradientColor. Use isLinearGradientColor to check
* @param colorObject The LinearGradientColor to resolve.
* @preserve (Part of the public API)
*/export function resolveLinearGradientColorAsCssValue(colorObject){let angle=colorObject.angle;null==angle&&(angle=0);let backgroundCssString="linear-gradient(";if(backgroundCssString+=angle+"deg",colorObject.stopPoints)for(let i=0,ii=colorObject.stopPoints.length;i<ii;i++){let stopPoint=colorObject.stopPoints[i];void 0!==stopPoint.stop&&null!==stopPoint.stop?backgroundCssString+=","+stopPoint.color+" "+stopPoint.stop:backgroundCssString+=","+stopPoint.color}return backgroundCssString+=")",backgroundCssString}
/**
* Style Processor for background. This handles spaces and ' or " in URLs, too.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new value for the background.
* @preserve (Part of the public API)
*/export function processBackground(element,valueNew){styleManager.processBackground(element,valueNew)}
/**
* Style Processor for background colors and gradients.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new value for the background.
* @preserve (Part of the public API)
*/export function processBackgroundColor(element,valueNew){styleManager.processBackground(element,{color:valueNew})}
/**
* Style Processor for background images. This handles spaces and ' or " in URLs, too.
* ValueNew undefined, null or empty string will remove the background image.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The URL of the image.
* @preserve (Part of the public API)
*/export function processBackgroundImage(element,valueNew){styleManager.processBackground(element,{image:valueNew??""})}
/**
* Style processor for SVG fill color.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new fill color.
* @preserve (Part of the public API)
* HTMLElement allowed because default jQuery type is HTMLElement
*/export function processFillColor(element,valueNew){styleManager.processFillColor(element,valueNew)}
/**
* Style processor for SVG stroke color.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new stroke color.
* @preserve (Part of the public API)
* HTMLElement allowed because default jQuery type is HTMLElement
*/export function processStrokeColor(element,valueNew){styleManager.processStrokeColor(element,valueNew)}
/**
* Style processor for text color.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new text color.
* @preserve (Part of the public API)
*/export function processTextColor(element,valueNew){styleManager.processTextColor(element,valueNew)}
/**
* Style processor for border color.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border color.
* @preserve (Part of the public API)
*/export function processBorderColor(element,valueNew){styleManager.processBorderColor(element,valueNew)}
/**
* Style processor for border width.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border widths.
* @preserve (Part of the public API)
*/export function processBorderWidth(element,valueNew){styleManager.processBorderWidth(element,valueNew)}
/**
* Style processor for border radius.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border radii.
* @preserve (Part of the public API)
*/export function processBorderRadius(element,valueNew){styleManager.processBorderRadius(element,valueNew)}
/**
* Style processor for border style.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border styles.
* @preserve (Part of the public API)
*/export function processBorderStyle(element,valueNew){styleManager.processBorderStyle(element,valueNew)}
/**
* Style processor for box shadow.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new border styles.
* @preserve (Part of the public API)
*/export function processBoxShadow(element,valueNew){styleManager.processBoxShadow(element,valueNew)}
/**
* Style processor for font family.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new font family.
* @preserve (Part of the public API)
*/export function processFontFamily(element,valueNew){styleManager.processFontFamily(element,valueNew)}
/**
* Style processor for font size.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new font size.
* @param unitNew The new font size unit. Defaults to "px".
* @preserve (Part of the public API)
*/export function processFontSize(element,valueNew,unitNew="px"){styleManager.processFontSize(element,valueNew,unitNew)}
/**
* Style processor for font style.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new font style. Allowed values are "Normal", "Italic" and "Oblique".
* @preserve (Part of the public API)
*/export function processFontStyle(element,valueNew){styleManager.processFontStyle(element,valueNew)}
/**
* Style processor for font weight.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new font weight. Allowed values are "Normal" and "Bold".
* @preserve (Part of the public API)
*/export function processFontWeight(element,valueNew){styleManager.processFontWeight(element,valueNew)}
/**
* Style processor for visibility.
* Visibility also affects pointer events, i.e. a hidden element will not receive mouse click events.
* Hidden still uses space in fluid calculations, collapsed is ignored there.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new visibility. Allowed values are "Visible", "Collapsed" and "Hidden". Hidden still uses space in fluid calculations, collapsed is ignored there.
* @preserve (Part of the public API)
*/export function processVisibility(element,valueNew){styleManager.processVisibility(element,valueNew)}
/**
* Style processor for horizontal alignment. This aligns the content of the target element, not the target element itself.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new horizontal alignment. Allowed values are "Left", "Center" and "Right".
* @preserve (Part of the public API)
*/export function processContentHorizontalAlignment(element,valueNew){styleManager.processContentHorizontalAlignment(element,valueNew)}
/**
* Style processor for vertical alignment. This aligns the content of the target element, not the target element itself.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new vertical alignment. Allowed values are "Top", "Center" and "Bottom".
* @preserve (Part of the public API)
*/export function processContentVerticalAlignment(element,valueNew){styleManager.processContentVerticalAlignment(element,valueNew)}
/**
* Style processor for content padding.
* Note: Percentages always refer to the width of the element, never its height (even for top and bottom).
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new content padding.
* @preserve (Part of the public API)
*/export function processContentPadding(element,valueNew){styleManager.processContentPadding(element,valueNew)}
/**
* Theme processor for transforms.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @param valueNew The new transform value or an array of transform values.
* @param order If this parameter is passed, the transforms in valueNew will replace the transform at the specified place, instead of replacing all transforms.
* @preserve (Part of the public API)
*/export function processTransform(element,valueNew,order){styleManager.processTransform(element,valueNew,order)}
/**
* Return the width of the given text in px as it would appear on the given element.
* Make sure the element you operate with is attached to the DOM.
* The function uses the computed values of the element which only exist when an element is attached to the DOM.
* This function only works with single line text.
* @param text The text to measure.
* @param element The jQuery collection or HTML/SVG element(s) to operate with.
* @preserve (Part of the public API)
*/export function getTextWidth(text,element){return styleManager.getTextWidth(text,element)}TcHmi.StyleProvider={getComputedElementStyle,getSimpleElementStyle,setSimpleElementStyle,processGenericStyle,resolveSolidColorAsCssValue,resolveSolidColorAsRGBA,normalizeColorAsCssValue,resolveLinearGradientColorAsCssValue,processBackground,processBackgroundColor,processBackgroundImage,processFillColor,processStrokeColor,processTextColor,processBorderColor,processBorderWidth,processBorderRadius,processBorderStyle,processBoxShadow,processFontFamily,processFontSize,processFontStyle,processFontWeight,processVisibility,processContentHorizontalAlignment,processContentVerticalAlignment,processContentPadding,processTransform,getTextWidth};

View File

@@ -0,0 +1,721 @@
import { SymbolExpression } from './SymbolExpression.js';
import type * as Server from './Server.js';
import { ObjectResolver as ApiObjectResolver } from './ObjectResolver.js';
/**
* Provides methods to read and write symbol values and schemas.
* @template ST Type of the value in the symbol.
* @preserve (Part of the public API)
*/
export declare class Symbol<ST = any> extends TcHmi.Destroyable {
/**
* Throws SyntaxError if called with no valid symbol expression.
* @param expression Expression for the symbol
*/
constructor(expression: string);
/**
* Throws SyntaxError if called with no valid arguments object.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
*/
constructor(expressionObject: ExpressionContainer);
/**
* Throws SyntaxError if called with no valid arguments object.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
*/
constructor(expressionOrExpressionObject: string | ExpressionContainer);
/**
* Reads the value of the current symbol.
* return undefined if the symbol is not available
* @returns A copy of the value
* @template T Type of the read value. Falls back to type of the symbol.
* @preserve (Part of the public API)
*/
read<T = ST>(): T | undefined;
/**
* Reads the value of the current symbol and raises a callback with a copy of the result.
* Returns a destroy function to terminate reading of asynchronous values.
* @param callback with gets a copy of the value
* @template T Type of the read value. Falls back to type of the symbol.
* @preserve (Part of the public API)
*/
readEx<T = ST>(callback?: (this: this, data: IReadResultObject<T> | IServerReadResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Reads the value of the current symbol and raises a callback with a copy of the result.
* Returns a destroy function to terminate reading of asynchronous values.
* @param options Options for symbol handling
* @param callback with gets a copy of the value
* @template T Type of the read value. Falls back to type of the symbol.
* @preserve (Part of the public API)
*/
readEx2<T = ST>(options: IOptions | null, callback?: (this: this, data: IReadResultObject<T> | IServerReadResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Writes the value of the current symbol.
* Returns a destroy function to terminate writing of asynchronous values.
* @param value The new value
* @param callback Callback will be called after success or failure
* @template W Type of the write value. Falls back to type of the symbol.
* @template R Type of the value after write. Falls back to W if not specified.
* @preserve (Part of the public API)
*/
write<W = ST, R = W>(value: W, callback?: (this: this, data: IWriteResultObject<R> | IServerWriteResultObject<W, R>) => void): TcHmi.DestroyFunction;
/**
* Writes the value of the current symbol.
* Returns a destroy function to terminate writing of asynchronous values.
* @param value Value to write
* @param options Options for symbol handling
* @param callback Callback will be called after success or failure
* @template W Type of the write value. Falls back to type of the symbol.
* @template R Type of the value after write. Falls back to W if not specified.
* @preserve (Part of the public API)
*/
writeEx<W = ST, R = W>(value: W, options: IOptions | null, callback?: (this: this, data: IWriteResultObject<R> | IServerWriteResultObject<W, R>) => void): TcHmi.DestroyFunction;
/**
* Watches for changes of the current symbol and raises the callback in case of a change.
* Returns a destroy function to remove the watch.
* @param callback Callback will be called with each change of the value of the symbol
* @template T Type of the value to watch. Falls back to type of the symbol.
* @preserve (Part of the public API)
*/
watch<T = ST>(callback?: (this: this, data: IWatchResultObject<T> | IServerWatchResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Watches for changes of the current symbol and raises the callback in case of a change.
* Returns a destroy function to remove the watch.
* @param options Options for symbol handling
* @param callback Callback will be called with each change of the value of the symbol
* @template T Type of the value to watch. Falls back to type of the symbol.
* @preserve (Part of the public API)
*/
watchEx<T = ST>(options: IOptions | null, callback?: (this: this, data: IWatchResultObject<T> | IServerWatchResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Returns the underlying SymbolExpression object.
* @preserve (Part of the public API)
*/
getExpression(): SymbolExpression;
/**
* Returns the context of the symbol.
* @preserve (Part of the public API)
*/
getContext(): TcHmi.Context | undefined;
/**
* Resolves the expression.
* @param callback Callback will be called after success (with the schema) or failure
* @preserve (Part of the public API)
*/
resolveExpression(callback: (data: IReadResultObject<SymbolExpression>) => void): TcHmi.DestroyFunction;
/**
* Watches the expression.
* @param callback Callback will be called after success (with the schema) or failure
* @preserve (Part of the public API)
*/
watchExpression(callback: (data: IReadResultObject<SymbolExpression>) => void): TcHmi.DestroyFunction;
/**
* Resolves the schema of the current symbol.
* @param callback Callback will be called after success (with the schema) or failure
* @preserve (Part of the public API)
*/
resolveSchema(callback?: (this: this, data: ISchemaResultObject) => void): void;
/**
* Resolves the reference of the symbol.
* Either a reference to the symbol itself or a reference to the value when the value is of type TcHmi.Symbol.
* @param callback Callback will be called after success or failure.
* @param options Options for symbol handling
* @preserve (Part of the public API)
*/
resolveReference(callback: (data: IResolveSymbolReferenceResultObject) => void, options?: IOptions): TcHmi.DestroyFunction;
/**
* Watches the reference of the symbol.
* Either a reference to the symbol itself or a reference to the value when the value is of type TcHmi.Symbol.
* @param callback Callback will be called after success or failure.
* @param options Options for symbol handling
* @preserve (Part of the public API)
*/
watchReference(callback: (data: IResolveSymbolReferenceResultObject) => void, options?: IOptions): TcHmi.DestroyFunction;
/**
* Resolves a dictionary of PLC (?) attributes from the underlying schema.
* @param callback Callback will be called after success (with the attributes) or failure
* @preserve (Part of the public API)
*/
resolveAttributes(callback?: (this: this, data: IAttributesResultObject) => void): TcHmi.DestroyFunction;
/**
* Resolves a PLC (?) attribute by name from the underlying schema.
* @param name Name of the PLC (?) attribute
* @param callback Callback will be called after success (with the attribute) or failure
* @preserve (Part of the public API)
*/
resolveAttribute(name: string, callback?: (this: this, data: IAttributesResultObject) => void): void;
/**
* Resolves a list of available versions of the symbol.
* @param callback Callback will be called after success (with the list of version) or failure
* @preserve (Part of the public API)
*/
resolveVersions(callback?: (this: this, data: IVersionsResultObject) => void): void;
/**
* Watches a list of available versions of the symbol.
* @param callback Callback will be called after success (with the list of version) or failure
* @preserve (Part of the public API)
*/
watchVersions(callback?: (this: this, data: IVersionsResultObject) => void): TcHmi.DestroyFunction;
/**
* Resolves the symbols meta data
* @param callback Callback will be called after success (with the meta data) or failure
* @preserve (Part of the public API)
*/
resolveMetaData(callback?: (this: this, data: IServerSymbolMetaDataResultObject) => void): void;
/**
* Watches for changes of the symbols meta data
* @param callback Callback will be called after success (with the meta data) or failure
* @preserve (Part of the public API)
*/
watchMetaData(callback?: (this: this, data: IServerSymbolMetaDataResultObject) => void): TcHmi.DestroyFunction;
/**
* Checks if this symbol exists
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
exists(callback?: (this: this, data: IExistsResultObject) => void): void;
/**
* Used to determine if this Symbol instance is processed async or sync?
* @preserve (Part of the public API)
*/
isProcessedAsync(): boolean;
/**
* Destroys the current symbol object when there are no more claimed destroy privileges.
* @preserve (Part of the public API)
*/
destroy(): void;
/**
* Returns function references which are handled by the symbol consumer.
*
* @preserve (Part of the public API)
*/
getReferenceDelegation(): ReferenceDelegation | null;
/**
* Please use TcHmi.ObjectResolver instead
* @deprecated Please use TcHmi.ObjectResolver instead
*/
static ObjectResolver: typeof ApiObjectResolver;
static read: typeof read;
static readEx: typeof readEx;
static readEx2: typeof readEx2;
static readEx3: typeof readEx3;
static write: typeof write;
static writeEx: typeof writeEx;
static writeEx2: typeof writeEx2;
static resolveExpression: typeof resolveExpression;
static resolveSchema: typeof resolveSchema;
static resolveAttributes: typeof resolveAttributes;
static resolveAttribute: typeof resolveAttribute;
static resolveVersions: typeof resolveVersions;
static resolveMetaData: typeof resolveMetaData;
static exists: typeof exists;
static isSymbolExpression: typeof isSymbolExpression;
static isSymbolExpressionEscaped: typeof isSymbolExpressionEscaped;
static escapeSymbolExpression: typeof escapeSymbolExpression;
static isIServerReadResultObject: typeof isIServerReadResultObject;
}
/**
* Reads the value of a symbol by name and type.
* This function throws an exception if the symbol type is not supported.
* @param name Name of the symbol (without for example %i% marker)
* @param type Type of the symbol as enum value
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function read<T = any>(name: string, type: TcHmi.SymbolType): T | undefined;
/**
* Reads the value of a symbol by expression.
* @param expression Expression for the symbol
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx<T = any>(expression: string): T | undefined;
/**
* Reads the value of a symbol by expression.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx<T = any>(expressionObject: ExpressionContainer): T | undefined;
/**
* Reads the value of a symbol by expression.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx<T = any>(expressionOrExpressionObject: string | ExpressionContainer): T | undefined;
/**
* Reads the value of a symbol by expression and raises a callback with the result.
* Returns a destroy function to terminate reading of asynchronous values.
* @param expression Expression for the symbol to read
* @param callback Callback will be called after success (with the value) or failure
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx2<T = any>(expression: string, callback?: (this: void, data: IReadResultObject<T> | IServerReadResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Reads the value of a symbol by expression and raises a callback with the result.
* Returns a destroy function to terminate reading of asynchronous values.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param callback Callback will be called after success (with the value) or failure
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx2<T = any>(expressionObject: ExpressionContainer, callback?: (this: void, data: IReadResultObject<T> | IServerReadResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Reads the value of a symbol by expression and raises a callback with the result.
* Returns a destroy function to terminate reading of asynchronous values.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param callback Callback will be called after success (with the value) or failure
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx2<T = any>(expressionOrExpressionObject: string | ExpressionContainer, callback?: (this: void, data: IReadResultObject<T> | IServerReadResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Reads the value of a symbol by expression and raises a callback with the result.
* Returns a destroy function to terminate reading of asynchronous values.
* @param expression Expression for the symbol
* @param options Options for symbol handling
* @param callback Callback will be called after success or failure
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx3<T = any>(expression: string, options: IOptions | null, callback?: (this: void, data: IReadResultObject<T> | IServerReadResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Reads the value of a symbol by expression and raises a callback with the result.
* Returns a destroy function to terminate reading of asynchronous values.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param options Options for symbol handling
* @param callback Callback will be called after success or failure
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx3<T = any>(expressionObject: ExpressionContainer, options: IOptions | null, callback?: (this: void, data: IReadResultObject<T> | IServerReadResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Reads the value of a symbol by expression and raises a callback with the result.
* Returns a destroy function to terminate reading of asynchronous values.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param options Options for symbol handling
* @param callback Callback will be called after success or failure
* @template T Type of the read value.
* @preserve (Part of the public API)
*/
export declare function readEx3<T = any>(expressionOrExpressionObject: string | ExpressionContainer, options: IOptions | null, callback?: (this: void, data: IReadResultObject<T> | IServerReadResultObject<T>) => void): TcHmi.DestroyFunction;
/**
* Writes the value of a symbol by name and type.
* This function throws an exception if the symbol type is not supported.
* Returns a destroy function to terminate writing of asynchronous values.
* @param name Name of the symbol (without for example %i% marker)
* @param type Type of the symbol as enum value
* @param value The new value
* @param callback Callback will be called after success or failure
* @template W Type of the write value.
* @template R Type of the value after write. Falls back to W if not specified.
* @preserve (Part of the public API)
*/
export declare function write<W = any, R = W>(name: string, type: TcHmi.SymbolType, value: W, callback?: null | ((this: void, data: IWriteResultObject<R> | IServerWriteResultObject<R>) => void)): TcHmi.DestroyFunction;
/**
* Writes the value of a symbol by expression.
* Returns a destroy function to terminate writing of asynchronous values.
* @param expression Expression for the symbol
* @param value Value to write
* @param callback Callback will be called after success or failure
* @template T Type of the write value.
* @preserve (Part of the public API)
*/
export declare function writeEx<T = any>(expression: string, value: T, callback?: null | ((this: void, data: IWriteResultObject<T> | IServerWriteResultObject<T>) => void)): TcHmi.DestroyFunction;
/**
* Writes the value of a symbol by expression.
* Returns a destroy function to terminate writing of asynchronous values.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param value Value to write
* @param callback Callback will be called after success or failure
* @template T Type of the write value.
* @preserve (Part of the public API)
*/
export declare function writeEx<T = any>(expressionObject: ExpressionContainer, value: T, callback?: null | ((this: void, data: IWriteResultObject<T> | IServerWriteResultObject<T>) => void)): TcHmi.DestroyFunction;
/**
* Writes the value of a symbol by expression.
* Returns a destroy function to terminate writing of asynchronous values.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param value Value to write
* @param callback Callback will be called after success or failure
* @template T Type of the write value.
* @preserve (Part of the public API)
*/
export declare function writeEx<T = any>(expressionOrExpressionObject: string | ExpressionContainer, value: T, callback?: null | ((this: void, data: IWriteResultObject<T> | IServerWriteResultObject<T>) => void)): TcHmi.DestroyFunction;
/**
* Writes the value of a symbol by expression.
* Returns a destroy function to terminate writing of asynchronous values.
* @param expression Expression for the symbol
* @param value Value to write
* @param options Options for symbol handling
* @param callback Callback will be called after success or failure
* @template T Type of the write value.
* @preserve (Part of the public API)
*/
export declare function writeEx2<T = any>(expression: string, value: T, options: IOptions | null, callback?: null | ((this: void, data: IWriteResultObject<T> | IServerWriteResultObject<T>) => void)): TcHmi.DestroyFunction;
/**
* Writes the value of a symbol by expression.
* Returns a destroy function to terminate writing of asynchronous values.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param value Value to write
* @param options Options for symbol handling
* @param callback Callback will be called after success or failure
* @template T Type of the write value.
* @preserve (Part of the public API)
*/
export declare function writeEx2<T = any>(expressionObject: ExpressionContainer, value: T, options: IOptions | null, callback?: null | ((this: void, data: IWriteResultObject<T> | IServerWriteResultObject<T>) => void)): TcHmi.DestroyFunction;
/**
* Writes the value of a symbol by expression.
* Returns a destroy function to terminate writing of asynchronous values.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param value Value to write
* @param options Options for symbol handling
* @param callback Callback will be called after success or failure
* @template T Type of the write value.
* @preserve (Part of the public API)
*/
export declare function writeEx2<T = any>(expressionOrExpressionObject: string | ExpressionContainer, value: T, options: IOptions | null, callback?: null | ((this: void, data: IWriteResultObject<T> | IServerWriteResultObject<T>) => void)): TcHmi.DestroyFunction;
/**
* Resolves the expression.
* @param expression Expression for the symbol
* @param callback Callback will be called after success (with the schema) or failure
* @preserve (Part of the public API)
*/
export declare function resolveExpression(expression: string, callback: (data: IReadResultObject<SymbolExpression>) => void): void;
/**
* Resolves the expression.
* @param expressionObject Expression meta data object including the expression itself and further information like context or string.
* @param callback Callback will be called after success (with the schema) or failure
* @preserve (Part of the public API)
*/
export declare function resolveExpression(expressionObject: ExpressionContainer, callback: (data: IReadResultObject<SymbolExpression>) => void): void;
/**
* Resolves the expression.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param callback Callback will be called after success (with the schema) or failure
* @preserve (Part of the public API)
*/
export declare function resolveExpression(expressionOrExpressionObject: string | ExpressionContainer, callback: (data: IReadResultObject<SymbolExpression>) => void): void;
/**
* Resolves the schema of the current symbol.
* @param expression Expression for the symbol
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveSchema(expression: string, callback?: (this: void, data: ISchemaResultObject) => void): void;
/**
* Resolves the schema of the current symbol.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveSchema(expressionObject: ExpressionContainer, callback?: (this: void, data: ISchemaResultObject) => void): void;
/**
* Resolves the schema of the current symbol.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveSchema(expressionOrExpressionObject: string | ExpressionContainer, callback?: (this: void, data: ISchemaResultObject) => void): void;
/**
* Resolves a dictionary of PLC (?) attributes from the underlying schema.
* @param expression Expression for the symbol
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveAttributes(expression: string, callback?: (this: void, data: IAttributesResultObject) => void): void;
/**
* Resolves a dictionary of PLC (?) attributes from the underlying schema.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveAttributes(expressionObject: ExpressionContainer, callback?: (this: void, data: IAttributesResultObject) => void): void;
/**
* Resolves a dictionary of PLC (?) attributes from the underlying schema.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveAttributes(expressionOrExpressionObject: string | ExpressionContainer, callback?: (this: void, data: TcHmi.Symbol.IAttributesResultObject) => void): void;
/**
* Resolves a PLC (?) attribute by name from the underlying schema.
* @param expression Expression for the symbol
* @param name Name of the PLC (?) attribute
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveAttribute(expression: string, name: string, callback?: (this: void, data: IAttributesResultObject) => void): void;
/**
* Resolves a PLC (?) attribute by name from the underlying schema.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param name Name of the PLC (?) attribute
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveAttribute(expressionObject: ExpressionContainer, name: string, callback?: (this: void, data: IAttributesResultObject) => void): void;
/**
* Resolves a PLC (?) attribute by name from the underlying schema.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param name Name of the PLC (?) attribute
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function resolveAttribute(expressionOrExpressionObject: string | ExpressionContainer, name: string, callback?: (this: void, data: IAttributesResultObject) => void): void;
/**
* Resolves a list of available versions of the symbol.
* @param expression Expression for the symbol
* @param callback Callback will be called after success (with the list of version) or failure
* @preserve (Part of the public API)
*/
export declare function resolveVersions(expression: string, callback?: (this: void, data: IVersionsResultObject) => void): void;
/**
* Resolves a list of available versions of the symbol.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param callback Callback will be called after success (with the list of version) or failure
* @preserve (Part of the public API)
*/
export declare function resolveVersions(expressionObject: ExpressionContainer, callback?: (this: void, data: IVersionsResultObject) => void): void;
/**
* Resolves a list of available versions of the symbol.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param callback Callback will be called after success (with the list of version) or failure
* @preserve (Part of the public API)
*/
export declare function resolveVersions(expressionOrExpressionObject: string | ExpressionContainer, callback?: (this: void, data: IVersionsResultObject) => void): void;
/**
* Resolves the symbols meta data
* @param expression Expression for the symbol
* @param callback Callback will be called after success (with the meta data) or failure
* @preserve (Part of the public API)
*/
export declare function resolveMetaData(expression: string, callback?: (this: void, data: IServerSymbolMetaDataResultObject) => void): void;
/**
* Resolves the symbols meta data
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param callback Callback will be called after success (with the meta data) or failure
* @preserve (Part of the public API)
*/
export declare function resolveMetaData(expressionObject: ExpressionContainer, callback?: (this: void, data: IServerSymbolMetaDataResultObject) => void): void;
/**
* Resolves the symbols meta data
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param callback Callback will be called after success (with the meta data) or failure
* @preserve (Part of the public API)
*/
export declare function resolveMetaData(expressionOrExpressionObject: string | ExpressionContainer, callback?: (this: void, data: IServerSymbolMetaDataResultObject) => void): void;
/**
* Checks if a symbol exists.
* @param expression Expression for the symbol
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function exists(expression: string, callback?: (this: void, data: IExistsResultObject) => void): void;
/**
* Checks if a symbol exists.
* @param expressionObject Expression meta data object including the expression itself and further information like context.
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function exists(expressionObject: ExpressionContainer, callback?: (this: void, data: IExistsResultObject) => void): void;
/**
* Checks if a symbol exists.
* @param expressionOrExpressionObject Expression meta data object including the expression itself and further information like context or string.
* @param callback Callback will be called after success or failure
* @preserve (Part of the public API)
*/
export declare function exists(expressionOrExpressionObject: string | ExpressionContainer, callback?: (this: void, data: IExistsResultObject) => void): void;
/**
* Returns true if the expression is a valid symbol expression
* @param expression Expression for the symbol
* @preserve (Part of the public API)
*/
export declare function isSymbolExpression(expression: string): boolean;
/**
* Returns true if expression is escaped with $ in opening expression tag before type token.
* Example:
* %$i%... -> true
* %i%... -> false
* @param expression Expression for the symbol
* @preserve (Part of the public API)
*/
export declare function isSymbolExpressionEscaped(expression: string): boolean;
/**
* Will remove one escape level from expression and return it.
* @param expression Expression for the symbol
* @preserve (Part of the public API)
*/
export declare function escapeSymbolExpression(expression: string): string;
/**
* A type assertion for differntiating a IServerReadResultObject from a IReadResultObject
* @param data IReadResultObject
*/
export declare function isIServerReadResultObject<T = any>(data: IReadResultObject<T> | IServerReadResultObject<T>): data is IServerReadResultObject<T>;
export interface ISymbolResultObject extends TcHmi.IResultObject {
/** The original expression of the symbol (unset in case of error) */
expression?: SymbolExpression;
/** The resolved expression used for processing this result (unset in case of error) */
expressionResolved?: SymbolExpression;
}
export interface IWatchResultObject<T = any> extends ISymbolResultObject {
value?: T;
processedStart?: string;
processedEnd?: string;
dirtyPaths?: string[];
/** A destroy function to remove the watch. Only set if there is no error. */
destroy?: TcHmi.DestroyFunction;
}
export interface IServerWatchResultObject<T = any, W = T> extends IWatchResultObject<T> {
response?: Server.IMessage<W, T>;
}
export interface IReadResultObject<T = any> extends ISymbolResultObject {
value?: T;
processedStart?: string;
processedEnd?: string;
dirtyPaths?: string[];
destroy?: TcHmi.DestroyFunction;
}
export interface IServerReadResultObject<T = any, W = T> extends IReadResultObject<T> {
response?: Server.IMessage<W, T>;
}
export interface IWriteResultObject<T = any> extends ISymbolResultObject {
/** The value after write. */
value?: T;
processedStart?: string;
processedEnd?: string;
dirtyPaths?: string[];
destroy?: TcHmi.DestroyFunction;
}
export interface IServerWriteResultObject<W = any, R = W> extends IWriteResultObject<R> {
response?: Server.IMessage<W, R>;
}
export interface ISchemaResultObject extends ISymbolResultObject {
schema?: TcHmi.JsonSchema;
destroy?: TcHmi.DestroyFunction;
}
export interface IExistsResultObject extends ISymbolResultObject {
result?: boolean;
}
export interface ExpressionContainer {
expression: string;
ctx?: TcHmi.Context;
}
export interface IAttributesResultObject extends ISymbolResultObject {
attributes?: TcHmi.Dictionary<any>;
}
export interface IAttributeResultObject<T = any> extends ISymbolResultObject {
name?: string;
value?: T;
}
export interface IVersionsResultObject extends ISymbolResultObject {
versions?: number[];
}
export interface IServerSymbolMetaDataResultObject extends ISymbolResultObject {
ListSymbols?: IListSymbols;
TcHmiAuditTrail?: {
AuditTrailSymbols?: {
enabled?: boolean;
commentRequired?: boolean;
};
};
}
export interface IListSymbols {
/** numeric access as in enum TcHmi.Server.ACCESS */
ACCESS?: number;
DOMAIN?: string;
DYNAMIC?: boolean;
HIDDEN?: boolean;
MAPPING?: string;
OPTIONS?: TcHmi.Dictionary<any>;
SCHEMA?: TcHmi.JsonSchema;
USEMAPPING?: boolean;
/** Versions the symbol supports on this server */
VERSIONS?: number[];
REAUTHENTICATION_REQUIRED?: boolean;
REVIEWER_GROUPS?: string[];
}
export interface IOptions {
forceParallel?: boolean;
forceReadWriteGroup?: string | number;
forceVersion?: number;
forceReferenceResolution?: 'Self' | 'Value';
forceWriteValue?: TcHmi.Dictionary<any>;
}
export interface ReferenceDelegation {
/**
* A function reference that has to be injected by the symbol reference consumer when able to preload.
* Preloading should be done when the function is called by the symbol reference provider and the
* symbol reference consumer must call the done callback function when preloading is done.
*/
preload?: (done: () => void) => void;
}
export interface IResolveSymbolReferenceResultObject extends ISymbolResultObject {
ref?: Symbol;
destroy: TcHmi.DestroyFunction;
}
declare const _Symbol: typeof Symbol;
type tSymbol<ST = any> = Symbol<ST>;
type tISymbolResultObject = ISymbolResultObject;
type tIWatchResultObject<T = any> = IWatchResultObject<T>;
type tIServerWatchResultObject<T = any> = IServerWatchResultObject<T>;
type tIReadResultObject<T = any> = IReadResultObject<T>;
type tIServerReadResultObject<T = any> = IServerReadResultObject<T>;
type tIWriteResultObject<T = any> = IWriteResultObject<T>;
type tIServerWriteResultObject<W = any, R = W> = IServerWriteResultObject<W, R>;
type tISchemaResultObject = ISchemaResultObject;
type tIExistsResultObject = IExistsResultObject;
type tIAttributesResultObject = IAttributesResultObject;
type tIAttributeResultObject<T = any> = IAttributeResultObject<T>;
type tIVersionsResultObject = IVersionsResultObject;
type tIServerSymbolMetaDataResultObject = IServerSymbolMetaDataResultObject;
type tIListSymbols = IListSymbols;
type tIOptions = IOptions;
type tReferenceDelegation = ReferenceDelegation;
type tIResolveSymbolReferenceResultObject = IResolveSymbolReferenceResultObject;
type tExpressionContainer = ExpressionContainer;
declare global {
namespace TcHmi {
let Symbol: typeof _Symbol;
type Symbol<ST = any> = tSymbol<ST>;
namespace Symbol {
type ISymbolResultObject = tISymbolResultObject;
type IWatchResultObject<T = any> = tIWatchResultObject<T>;
type IServerWatchResultObject<T = any> = tIServerWatchResultObject<T>;
type IReadResultObject<T = any> = tIReadResultObject<T>;
type IServerReadResultObject<T = any> = tIServerReadResultObject<T>;
type IWriteResultObject<T = any> = tIWriteResultObject<T>;
type IServerWriteResultObject<W = any, R = W> = tIServerWriteResultObject<W, R>;
type ISchemaResultObject = tISchemaResultObject;
type IExistsResultObject = tIExistsResultObject;
type IAttributesResultObject = tIAttributesResultObject;
type IAttributeResultObject<T = any> = tIAttributeResultObject<T>;
type IVersionsResultObject = tIVersionsResultObject;
type IServerSymbolMetaDataResultObject = tIServerSymbolMetaDataResultObject;
type IListSymbols = tIListSymbols;
type IOptions = tIOptions;
type ReferenceDelegation = tReferenceDelegation;
type IResolveSymbolReferenceResultObject = tIResolveSymbolReferenceResultObject;
type ExpressionContainer = tExpressionContainer;
type ObjectResolver<T extends object | null> = TcHmi.ObjectResolver<T>;
namespace ObjectResolver {
/**
* Please use TcHmi.ObjectResolver.IWatchResultObject instead.
* @deprecated Please use TcHmi.ObjectResolver.IWatchResultObject instead.
*/
type IWatchResultObject<T extends object | null> = TcHmi.ObjectResolver.IWatchResultObject<T>;
/**
* Please use TcHmi.ObjectResolver.IResultObject instead.
* @deprecated Please use TcHmi.ObjectResolver.IResultObject instead.
*/
type IResultObject<T extends object | null> = TcHmi.ObjectResolver.IResultObject<T>;
/**
* Please use TcHmi.ObjectResolver.IOptions instead.
* @deprecated Please use TcHmi.ObjectResolver.IOptions instead.
*/
type IOptions = TcHmi.ObjectResolver.IOptions;
}
}
}
}
export {};
//# sourceMappingURL=Symbol.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,305 @@
import type { IReadResultObject } from './Symbol.js';
/**
* Symbol expression parser.
* @preserve (Part of the public API)
*/
export declare class SymbolExpression {
/**
* Split string by pipe, but ignore pipes in brackets.
* @deprecated Please use SymbolExpression.parse instead. RegExp method will not work properly with nested symbol expressions.
* @preserve (Part of the public API)
*/
static RegExpExpressionGroupByPipe: RegExp;
/**
* Resolves the first expression occurrence and the content including line breaks.
* @deprecated Please use SymbolExpression.parse instead. RegExp method will not work properly with nested symbol expressions.
* @preserve (Part of the public API)
*/
static RegExpExpression: RegExp;
/**
* Resolves the first escapted expression occurrence and the content including line breaks.
* @deprecated Please use SymbolExpression.parse instead. RegExp method will not work properly with nested symbol expressions.
* @preserve (Part of the public API)
*/
static RegExpExpressionEscaped: RegExp;
/**
* Parses the given expression.
* @param expression The expression to be parsed.
*/
static parse(expression: string): IParseResultObject;
/**
* Creates a SymbolExpression instance
* @param expression expression string
*/
constructor(expression: string);
/**
* Returns the expression string.
* @preserve (Part of the public API)
*/
toString(): string;
/**
* Returns the content of the expression. The content is everything except the expression tags.
* @preserve (Part of the public API)
*/
getContent(): string | undefined;
/**
* Returns the tag of the expression. For example "s" in case of an expression of type Server.
* @preserve (Part of the public API)
*/
getTag(): TcHmi.SymbolTag | undefined;
/**
* Returns the name of the expression.
* In case of an expression of type Server getName will also contain the path. Use getNameEx to retrieve the name in all expressions which support having a name.
* @preserve (Part of the public API)
*/
getName(): string | undefined;
/**
* Returns the name of the expression.
* @preserve (Part of the public API)
*/
getNameEx(): string | undefined;
/**
* Returns the full name containing the base name and the path of the expression but no options.
* @preserve (Part of the public API)
*/
getFullName(): string | undefined;
/**
* Returns the path of the expression.
* In case of an expression of type Server getPath will return null. Use getPathEx if you want to retrieve the path in all expressions which support having a path.
* @preserve (Part of the public API)
*/
getPath(): string | null;
/**
* Returns the path of the expression.
* @preserve (Part of the public API)
*/
getPathEx(): string | null;
/**
* Returns the path tokens.
* In case of an expression of type Server getPathTokens will return null. Use getPathTokensEx if you want to retrieve the path tokens in all expressions which support having a path.
* @preserve (Part of the public API)
*/
getPathTokens(): string[] | null;
/**
* Returns the path tokens.
* @preserve (Part of the public API)
*/
getPathTokensEx(): string[] | null;
/**
* Returns the type of the expression.
* @preserve (Part of the public API)
*/
getType(): TcHmi.SymbolType;
/**
* Returns a Dictionary of option flags.
* @preserve (Part of the public API)
*/
getOptions(): IOptions;
/**
* Returns a Dictionary of option flags.
* @preserve (Part of the public API)
*/
getOptionsString(): string | null;
/**
* Returns an array of child symbol expressions.
* @returns
*/
getChildren(): SymbolExpression[];
/**
* Returns the current symbol expressions parse data.
* @returns
*/
getParseData(): IParseData | null;
/**
* Returns true if the expressions contains child symbols that have to be resolved before the expression can be resolved.
*/
hasChildren(): boolean;
/**
* Resolves the expression.
* @param callback The function that will be called when the result is available.
* @preserve (Part of the public API)
*/
resolve(callback: (data: IReadResultObject<SymbolExpression>) => void): TcHmi.DestroyFunction;
private __symbolRefCount;
/**
* Watches the expression.
* @param callback The function that will be called when the result is available.
* @preserve (Part of the public API)
*/
watch(callback: (data: IReadResultObject<SymbolExpression>) => void): TcHmi.DestroyFunction;
}
/**
* Symbol expression related option flags.
*/
export interface IOptions {
/** The binding mode to be used when the symbol expression is used to bind a symbol to a control attribute. */
BindingMode?: TcHmi.BindingMode;
/**
* DEPRECATED
* Will hold first defined BindingEvent. Complete list is stored in BindingEvents array.
* @deprecated
*/
BindingEvent?: string;
/**
* A list of control event names that will trigger a binding to read the control attribute and write it to the symbol
* when the symbol expression is used to bind a symbol to a control attribute.
*/
BindingEvents?: string[];
/**
* Timeout
* Only respected in case of a symbol expression of type Server or Control.
*/
Timeout?: number;
/**
* The interval used for Subscription requests to the symbol described by the expression.
* Only respected in case of a symbol expression of type Server.
*/
Interval?: number;
/**
* Defines if requests made to the symbol described by the expression will bypass the system request queue.
* Only respected in case of a symbol expression of type Server.
*/
Parallel?: boolean;
/**
* The mode used for Subscription requests to the symbol described by the expression.
* Only respected in case of a symbol expression of type Server.
*
* Change
* The server will send a message for a symbols current value when the server has detected a value change.
*
* Poll
* The server will send a message for a symbols current value with every interval timer tick.
* Can be used to always have information about the current value.
*
* ClientPoll
* Only respected for subscriptions from TcHmi.Symbol api.
* The client will run a timer (with subscriptions interval time) and send an update to the affected
* TcHmi.Symbol instance with the last known subscription value reported by the server
* with every timer tick.
* Can be used to always have information about the current value.
*
* ClientWriteConfirm
* Only respected for subscriptions from TcHmi.Symbol api.
* The client will send an one time update to the affected TcHmi.Symbol instance
* with the last known subscription value reported by the server after a write has happend
* via the affected TcHmi.Symbol instance.
* The update will be send after a timer (with subscriptions interval time) has triggered.
* The timer will be resetted when a write occurs while the timer is already running.
* Can be used to always have information about the current value after a write operation,
* without additional load on the server and the client.
* Can help if the value of a symbol is reset to the previous value after a successful write
* operation before the server was able to recognise the change caused by the write operation
* in the context of the subscription.
*/
SubscriptionMode?: 'Change' | 'Poll' | 'ClientPoll' | 'ClientWriteConfirm';
/**
* Subscription requests to the symbol described by the expression with the same SubscriptionGroup will be bundled into the same Subscription request to the server.
* Only respected in case of a symbol expression of type Server.
*/
SubscriptionGroup?: string;
/**
* ReadWrite requests to the symbol described by the expression with the same ReadWriteGroup will be bundled into the same request to the server when they are raised synchronous.
* Only respected in case of a symbol expression of type Server.
*/
ReadWriteGroup?: string;
/**
* Requests to the symbol described by the expression will contain the UniqueHash command options when set to true.
* Only respected in case of a symbol expression of type Server.
*/
UniqueHash?: boolean;
/**
* Requests to the symbol described by the expression will call this version of the symbol.
* Only respected in case of a symbol expression of type Server.
*/
Version?: number;
/**
* When the symbol expression is used to address an array this defines the start index.
*/
Start?: number;
/**
* When the symbol expression is used to address an array this defines the end index.
*/
End?: number;
/**
* Defines whether an event should be registered to listen for changes in the symbol value or if the symbol expression should be resolved and the resulting string be used as the event name.
* Only respected when the symbol expression is used to register an event.
*/
EventRegistrationMode?: 'Verbatim' | 'Resolve';
/**
* Defines if we should wait for a control to become available before reporting an error.
* The time to wait can be defined via Timeout option.
* Only respected in case of a symbol expression of type Control.
*/
WaitForControl?: boolean;
/**
* Determines how a binding will handle symbol related read/watch errors.
* Possible values:
* - Ignore: Ignore the error.
* - Reset: Forward the default toggle switch (null) to force the control attribute to reset to default value.
*/
BindingErrorHandling?: 'Ignore' | 'Reset';
/**
* Determines how a binding will handle symbol related write errors.
* Possible values:
* - Ignore: Ignore the error.
* - ReadBack: Read back the current symbol value after write attempt failure and forward it to the control.
*/
BindingWriteErrorHandling?: 'Ignore' | 'ReadBack';
/**
* Determines how a symbol should resolve a reference to itself.
* Possible values:
* - Self: Returns a reference to the symbol itself.
* - Value: When the symbol has a value of type symbol it will resolve the inner symbol reference recursively by forcing
* ReferenceResolution to Value for every layer until a non symbol value is found and resolve a reference to the symbol holding that value.
*/
ReferenceResolution?: 'Self' | 'Value';
/**
* WriteValue send with ReadWrite and Subscription requests to the symbol described by the expression.
* Only respected in case of a symbol expression of type Server.
*/
WriteValue?: any;
}
/**
* Symbol expression parse result.
*/
export interface IParseData {
type: TcHmi.SymbolType;
expression: string;
tag?: TcHmi.SymbolTag;
content?: string;
isEscaped: boolean;
escapeLevel: number;
fullName?: string;
name?: string;
path?: string;
options?: string[];
openStart?: number;
openEnd?: number;
closeStart?: number;
closeEnd?: number;
children?: IParseData[];
origin?: IParseData;
originOpenStart?: number;
originOpenEnd?: number;
originCloseStart?: number;
originCloseEnd?: number;
}
export interface IParseResultObject extends TcHmi.IResultObject {
data?: IParseData;
}
declare const _SymbolExpression: typeof SymbolExpression;
type tSymbolExpression = SymbolExpression;
type tIParseData = IParseData;
type tIOptions = IOptions;
declare global {
namespace TcHmi {
let SymbolExpression: typeof _SymbolExpression;
type SymbolExpression = tSymbolExpression;
namespace SymbolExpression {
type IParseData = tIParseData;
type IOptions = tIOptions;
}
}
}
export {};
//# sourceMappingURL=SymbolExpression.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,88 @@
/**
* (Re-)Starts the rtc connection to TwinCAT speech engine.
* @param options This option can override all setting from tchmiconfig.json and more
* @param callback Gets notification when opening connection failed.
* @preserve (Part of the public API)
*/
export declare function openConnection(options?: TcHmi.TcSpeech.ConnectionOptions & Partial<TcHmi.TcSpeech.BaseConfig>, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): void;
/**
* Closes an active connection to TwinCAT speech engine.
* @param options Can target a specific remote TwinCAT speech engine
* @param options.remoteSocketId socket id to close
* @param callback A callback to get feedback
* @preserve (Part of the public API)
*/
export declare function closeConnection(options?: {
remoteSocketId?: number;
}, callback?: null | ((this: void, data: TcHmi.IResultObject) => void)): void;
/**
* Sets the volume (between 0 and 1) of speech output on this device.
* @param valueNew new volume. Will be capped between 0 and 1.
* @preserve (Part of the public API)
*/
export declare function setVolume(valueNew: number): void;
/**
* Functions for SpeechSynthesis .
* @preserve (Part of the public API)
*/
export declare class SpeechSynthesis {
/** Text to be synthesized */
readonly text: string;
readonly options?: {
priority?: TcHmi.TcSpeech.AudioEntityPriority;
} | undefined;
/**
* Functions for SpeechSynthesis .
* @param text Text to be synthesized
* @param options Options
* @param options.priority Audio entity priority
* @preserve (Part of the public API)
*/
constructor(
/** Text to be synthesized */
text: string, options?: {
priority?: TcHmi.TcSpeech.AudioEntityPriority;
} | undefined);
private __guid;
/**
* Starting output of text. The connection must be open at this point and we have to have enableSpeaker.
* The callback will get a guid which can be used to stop or request status of the speech synthesis.
* @param callback The callback will get a guid which can be used to stop or request status of the speech synthesis.
* @preserve (Part of the public API)
*/
start(callback?: null | ((this: void, data: TcHmi.TcSpeech.SpeechSynthesisResult) => void)): void;
/**
* Request the state (queued, playing, stopped) of a given speech synthesis call.
* @param callback The callback will get the state of the speech synthesis
* @preserve (Part of the public API)
*/
getStatus(callback?: null | ((this: void, data: TcHmi.TcSpeech.SpeechSynthesisResult) => void)): void;
/**
* Stops a given speech synthesis call.
* @param callback The callback will get the state of the speech synthesis
* @preserve (Part of the public API)
*/
stop(callback?: null | ((this: void, data: TcHmi.TcSpeech.SpeechSynthesisResult) => void)): void;
}
declare const _openConnection: typeof openConnection;
declare const _closeConnection: typeof closeConnection;
declare const _setVolume: typeof setVolume;
declare const _SpeechSynthesis: typeof SpeechSynthesis;
type tSpeechSynthesis = SpeechSynthesis;
declare global {
namespace TcHmi {
/**
* Functions for interaction with TcSpeech.
* @preserve (Part of the public API)
*/
namespace TcSpeech {
let openConnection: typeof _openConnection;
let closeConnection: typeof _closeConnection;
let setVolume: typeof _setVolume;
let SpeechSynthesis: typeof _SpeechSynthesis;
type SpeechSynthesis = tSpeechSynthesis;
}
}
}
export {};
//# sourceMappingURL=TcSpeech.d.ts.map

View File

@@ -0,0 +1,48 @@
import{isParameterTypeInvalid}from"../System/SystemFunctions.js";import{tcSpeechManager}from"../System/TcSpeechManager.js";
/**
* (Re-)Starts the rtc connection to TwinCAT speech engine.
* @param options This option can override all setting from tchmiconfig.json and more
* @param callback Gets notification when opening connection failed.
* @preserve (Part of the public API)
*/export function openConnection(options={},callback){isParameterTypeInvalid(options.confidenceThreshold,"options.confidenceThreshold",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||isParameterTypeInvalid(options.defaultVolume,"options.defaultVolume",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||isParameterTypeInvalid(options.domain,"options.domain",{type:"string",required:"undefinedOk",minStringLength:1},"TcHmi.Speech",callback)||isParameterTypeInvalid(options.enableMicrophone,"options.enableMicrophone",{type:"boolean",required:"undefinedOk"},"TcHmi.Speech",callback)||isParameterTypeInvalid(options.enableSpeaker,"options.enableSpeaker",{type:"boolean",required:"undefinedOk"},"TcHmi.Speech",callback)||isParameterTypeInvalid(options.remoteSocketId,"options.remoteSocketId",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||isParameterTypeInvalid(options.sinkConstraints,"options.sinkConstraints",{type:"object",required:"undefinedOk"},"TcHmi.Speech",callback)||isParameterTypeInvalid(options.sourceConstraints,"options.sourceConstraints",{type:"object",required:"undefinedOk"},"TcHmi.Speech",callback)||tcSpeechManager.openConnection(options,callback)}
/**
* Closes an active connection to TwinCAT speech engine.
* @param options Can target a specific remote TwinCAT speech engine
* @param options.remoteSocketId socket id to close
* @param callback A callback to get feedback
* @preserve (Part of the public API)
*/export function closeConnection(options={},callback){isParameterTypeInvalid(options.remoteSocketId,"options.remoteSocketId",{type:"number",required:"undefinedOk"},"TcHmi.Speech",callback)||tcSpeechManager.closeConnection(options,callback)}
/**
* Sets the volume (between 0 and 1) of speech output on this device.
* @param valueNew new volume. Will be capped between 0 and 1.
* @preserve (Part of the public API)
*/export function setVolume(valueNew){tcSpeechManager.setVolume(valueNew)}
/**
* Functions for SpeechSynthesis .
* @preserve (Part of the public API)
*/export class SpeechSynthesis{text;options;
/**
* Functions for SpeechSynthesis .
* @param text Text to be synthesized
* @param options Options
* @param options.priority Audio entity priority
* @preserve (Part of the public API)
*/
constructor(text,options){this.text=text,this.options=options}__guid;
/**
* Starting output of text. The connection must be open at this point and we have to have enableSpeaker.
* The callback will get a guid which can be used to stop or request status of the speech synthesis.
* @param callback The callback will get a guid which can be used to stop or request status of the speech synthesis.
* @preserve (Part of the public API)
*/
start(callback){tcSpeechManager.speechSynthesisStart(this.text,this.options,data=>{this.__guid=data.guid,TcHmi.Callback.callSafe(callback,null,data)})}
/**
* Request the state (queued, playing, stopped) of a given speech synthesis call.
* @param callback The callback will get the state of the speech synthesis
* @preserve (Part of the public API)
*/getStatus(callback){this.__guid?tcSpeechManager.speechSynthesisGetStatus(this.__guid,callback):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,domain:"TcHmi.TcSpeech",reason:"No current speech synthesis."}})}
/**
* Stops a given speech synthesis call.
* @param callback The callback will get the state of the speech synthesis
* @preserve (Part of the public API)
*/stop(callback){this.__guid?tcSpeechManager.speechSynthesisStop(this.__guid,callback):TcHmi.Callback.callSafe(callback,null,{error:TcHmi.Errors.ERROR,details:{code:TcHmi.Errors.ERROR,domain:"TcHmi.TcSpeech",reason:"No current speech synthesis."}})}}TcHmi.TcSpeech={...TcHmi.TcSpeech??{},openConnection,closeConnection,setVolume,SpeechSynthesis};

View File

@@ -0,0 +1,50 @@
import type { Resource } from './Theme.js';
/**
* Parses every source of implicit properties and returns this or null
* Can have different value after the event onThemeDataChanged.
* The order of resources are
* 1) control class
* 2) theme definition of the control type in project
* 3) theme definition in control
* 4) defaultValueInternal in Description.json of the control
* @param control Control which needs the resource
* @param propertyName name of the property
* @template T Type of the default value
* @preserve (Part of the public API)
*/
export declare function getDefaultValue<T = any>(control: TcHmi.Controls.System.baseTcHmiControl, propertyName: string): Resource<T>;
/**
* Sets the default value of a property and change it (if needed) on theme change.
* @param control Control to manipulate
* @param propertyName Property to manipulate
* @returns returns an Error code
* @preserve (Part of the public API)
*/
export declare function setThemeValue(control: TcHmi.Controls.System.baseTcHmiControl, propertyName: string): TcHmi.Errors;
/**
* After calling this function the control property will not be changed on theme change anymore.
* Does not change the property value.
* @param control Control to manipulate
* @param propertyName Property to manipulate
* @returns returns an Error code
* @preserve (Part of the public API)
*/
export declare function releaseThemeValue(control: TcHmi.Controls.System.baseTcHmiControl, propertyName: string): TcHmi.Errors;
declare const _getDefaultValue: typeof getDefaultValue;
declare const _setThemeValue: typeof setThemeValue;
declare const _releaseThemeValue: typeof releaseThemeValue;
declare global {
namespace TcHmi.Theme {
/**
* Control property related API
* @preserve (Part of the public API)
*/
namespace Properties {
const getDefaultValue: typeof _getDefaultValue;
const setThemeValue: typeof _setThemeValue;
const releaseThemeValue: typeof _releaseThemeValue;
}
}
}
export {};
//# sourceMappingURL=Theme.Properties.d.ts.map

View File

@@ -0,0 +1,29 @@
import{controlManager}from"../System/ControlManager.js";import{isParameterTypeInvalid}from"../System/SystemFunctions.js";import{themeManager}from"../System/ThemeManager.js";
/**
* Parses every source of implicit properties and returns this or null
* Can have different value after the event onThemeDataChanged.
* The order of resources are
* 1) control class
* 2) theme definition of the control type in project
* 3) theme definition in control
* 4) defaultValueInternal in Description.json of the control
* @param control Control which needs the resource
* @param propertyName name of the property
* @template T Type of the default value
* @preserve (Part of the public API)
*/export function getDefaultValue(control,propertyName){return control instanceof TcHmi.Controls.System.baseTcHmiControl?isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1})?{error:TcHmi.Errors.E_PARAMETER_INVALID,origin:"system",originThemeName:themeManager.getTheme(),value:null}:themeManager.getDefaultPropertyValue(control,propertyName):{error:TcHmi.Errors.E_PARAMETER_INVALID,origin:"system",originThemeName:themeManager.getTheme(),value:null}}
/**
* Sets the default value of a property and change it (if needed) on theme change.
* @param control Control to manipulate
* @param propertyName Property to manipulate
* @returns returns an Error code
* @preserve (Part of the public API)
*/export function setThemeValue(control,propertyName){if(!(control instanceof TcHmi.Controls.System.baseTcHmiControl))return TcHmi.Errors.E_PARAMETER_INVALID;if(isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1}))return TcHmi.Errors.E_PARAMETER_INVALID;let error=controlManager.setControlProperty(control,propertyName,null);return error?error.code:TcHmi.Errors.NONE}
/**
* After calling this function the control property will not be changed on theme change anymore.
* Does not change the property value.
* @param control Control to manipulate
* @param propertyName Property to manipulate
* @returns returns an Error code
* @preserve (Part of the public API)
*/export function releaseThemeValue(control,propertyName){return control instanceof TcHmi.Controls.System.baseTcHmiControl?isParameterTypeInvalid(propertyName,"propertyName",{type:"string",required:"valueNeeded",minStringLength:1})?TcHmi.Errors.E_PARAMETER_INVALID:(themeManager.unwatchAttributeDefaults(control,propertyName),TcHmi.Errors.NONE):TcHmi.Errors.E_PARAMETER_INVALID}TcHmi.Theme??={},TcHmi.Theme.Properties={getDefaultValue,setThemeValue,releaseThemeValue};

View File

@@ -0,0 +1,40 @@
import type { Resource } from './Theme.js';
/**
* Gets a themed resource.
* Parses every source of properties and returns this or null
* Can have different value after the event onThemeDataChanged.
* The order of resources are
* 1) control class
* 2) theme definition of the control type in project
* 3) theme definition in control
*
* @param control Control which needs the resource
* @param resourceName name of the resource
* @returns returns the resource or null
* @template T Type of the value
* @preserve (Part of the public API)
*/
export declare function get<T = any>(control: TcHmi.Controls.System.baseTcHmiControl, resourceName: string): Resource<T>;
/**
* Resolves the basepath for a path value inside a theme resource
* @param control Control which asks for that
* @param resource resource to resolve the basepath
* @template T Type of the value
*/
export declare function resolveBasePath<T = any>(control: TcHmi.Controls.System.baseTcHmiControl, resource: Resource<T>): string;
declare const _get: typeof get;
declare const _resolveBasePath: typeof resolveBasePath;
declare global {
namespace TcHmi.Theme {
/**
* Control resource related API
* @preserve (Part of the public API)
*/
namespace Resources {
const get: typeof _get;
const resolveBasePath: typeof _resolveBasePath;
}
}
}
export {};
//# sourceMappingURL=Theme.Resources.d.ts.map

View File

@@ -0,0 +1,16 @@
import{Data}from"../System/System.js";import{isParameterTypeInvalid}from"../System/SystemFunctions.js";import{themeManager}from"../System/ThemeManager.js";
/**
* Gets a themed resource.
* Parses every source of properties and returns this or null
* Can have different value after the event onThemeDataChanged.
* The order of resources are
* 1) control class
* 2) theme definition of the control type in project
* 3) theme definition in control
*
* @param control Control which needs the resource
* @param resourceName name of the resource
* @returns returns the resource or null
* @template T Type of the value
* @preserve (Part of the public API)
*/export function get(control,resourceName){return control instanceof TcHmi.Controls.System.baseTcHmiControl?isParameterTypeInvalid(resourceName,"resourceName",{type:"string",required:"valueNeeded",minStringLength:1})?{error:TcHmi.Errors.E_PARAMETER_INVALID,origin:"system",originThemeName:themeManager.getTheme(),value:null}:themeManager.getThemeResource(control,resourceName):{error:TcHmi.Errors.E_PARAMETER_INVALID,origin:"system",originThemeName:themeManager.getTheme(),value:null}}export function resolveBasePath(control,resource){let url;if("control"===resource.origin){let module=Data.Modules.controls.map.get(control.getType());url=module&&module.error===TcHmi.Errors.NONE&&module.package&&module.manifestData?module.package.basePath+"/"+module.manifestData.basePath+"/Themes/"+resource.originThemeName+"/":module&&module.error!==TcHmi.Errors.NONE?"ControlModuleHasError/":"controlNotFoundInSystemCache/"}else url="Themes/"+resource.originThemeName+"/";return url}TcHmi.Theme??={},TcHmi.Theme.Resources={get,resolveBasePath};

View File

@@ -0,0 +1,44 @@
export * as Properties from './Theme.Properties.js';
export * as Resources from './Theme.Resources.js';
/**
* Returns the active theme.
* @preserve (Part of the public API)
*/
export declare function get(): string;
/**
* Sets the active theme.
* @param valueNew Name of the new theme.
* @preserve (Part of the public API)
*/
export declare function set(valueNew: string): TcHmi.Errors;
/**
* Returns all registered themes of the project.
* @preserve (Part of the public API)
*/
export declare function getRegisteredThemes(): string[];
export interface Resource<T extends any> extends TcHmi.IResultObject {
value: T | null;
/** The value is generated from the control, the project or in error case from the system. */
origin: 'control' | 'project' | 'system';
/** Resources of a control will get "Base" if they do not implement the current theme */
originThemeName: string;
}
declare const _get: typeof get;
declare const _set: typeof set;
declare const _getRegisteredThemes: typeof getRegisteredThemes;
type tResource<T extends any> = Resource<T>;
declare global {
namespace TcHmi {
/**
* Provides functions for managing and changing themes.
* @preserve (Part of the public API)
*/
namespace Theme {
let get: typeof _get;
let set: typeof _set;
let getRegisteredThemes: typeof _getRegisteredThemes;
type Resource<T extends any> = tResource<T>;
}
}
}
//# sourceMappingURL=Theme.d.ts.map

View File

@@ -0,0 +1,14 @@
import{config}from"../System/System.js";import{isParameterTypeInvalid}from"../System/SystemFunctions.js";import{themeManager}from"../System/ThemeManager.js";export*as Properties from"./Theme.Properties.js";export*as Resources from"./Theme.Resources.js";
/**
* Returns the active theme.
* @preserve (Part of the public API)
*/export function get(){return themeManager.getTheme()}
/**
* Sets the active theme.
* @param valueNew Name of the new theme.
* @preserve (Part of the public API)
*/export function set(valueNew){return isParameterTypeInvalid(valueNew,"valueNew",{type:"string",required:"valueNeeded",minStringLength:1})?TcHmi.Errors.E_PARAMETER_INVALID:themeManager.setTheme(valueNew,!0)}
/**
* Returns all registered themes of the project.
* @preserve (Part of the public API)
*/export function getRegisteredThemes(){return Object.keys(config.themes)}TcHmi.Theme={...TcHmi.Theme??{},get,set,getRegisteredThemes};

View File

@@ -0,0 +1,33 @@
/**
* Infrastructure to have calls which are sync but async if the time (in ms) is too long.
*/
export declare class TimedAsyncTask {
/**
* constructor
* @param duration Milliseconds for the threshold value
*/
constructor(duration: number);
__duration: number;
protected __than: number;
/**
* Call a callback.
* Sync if time is not later than the threshold value of the instance.
* Returns 0 if the callback is sync, otherwise the timeout id
* @param callback function to call (sync or async)
*/
do(callback: () => void): number;
/**
* Returns false if time is not later than the threshold value of the instance.
*/
timeQuotaReached(): boolean;
}
declare const _TimedAsyncTask: typeof TimedAsyncTask;
type tTimedAsyncTask = TimedAsyncTask;
declare global {
namespace TcHmi {
let TimedAsyncTask: typeof _TimedAsyncTask;
type TimedAsyncTask = tTimedAsyncTask;
}
}
export {};
//# sourceMappingURL=TimedAsyncTask.d.ts.map

View File

@@ -0,0 +1 @@
export class TimedAsyncTask{constructor(duration){this.__duration=duration,this.__than=0}__duration;__than;do(callback){return callback?this.timeQuotaReached()?setTimeout(callback):(callback(),0):0}timeQuotaReached(){if(this.__duration===1/0)return!1;let now=Date.now();return 0===this.__than&&(this.__than=now),now-this.__than>this.__duration&&(this.__than=now,!0)}}TcHmi.TimedAsyncTask=TimedAsyncTask;

View File

@@ -0,0 +1,185 @@
/**
* Appends the elements to the top layer above the normal visualization
* A reference to the element should be kept to be able to call remove() function
* The parent element will be a div with style="width:<browserwindowwidth>;height:<browserwindowheight>;"
* Your element could have style="min-width:50%;min-height:50%;"
* @param control Control which requests this. If no reference for justAbove is specified, the control element
* will be used as the justAbove reference, with conflict resolution set to Up.
* @param element HTML element which should be moved to TopMostLayer
* @param options Optional options
* @returns success of the add
* @preserve (Part of the public API)
*/
export declare function add<E extends HTMLElement>(control: TcHmi.Controls.System.baseTcHmiControl, element: E | undefined | null, options?: IOptions<E>): boolean;
/**
* Appends the elements to the top layer above the normal visualization
* A reference to the element should be kept to be able to call remove() function
* The parent element will be a div with style="width:<browserwindowwidth>;height:<browserwindowheight>;"
* Your element could have style="min-width:50%;min-height:50%;"
* @param control Control which requests this. If no reference for justAbove is specified, the control element
* will be used as the justAbove reference, with conflict resolution set to Up.
* @param element jQuery Collection with exactly one element which should be moved to TopMostLayer
* @param options Optional options
* @returns success of the add
* @preserve (Part of the public API)
*/
export declare function add(control: TcHmi.Controls.System.baseTcHmiControl, element: JQuery | undefined | null, options?: IOptions): boolean;
/**
* Removes the element from the top layer and returns it for later use by the caller
* If the element is not inside the TopMostLayer it will be returned without change.
* @param control control which requests this
* @param element HTML element which should be removed from TopMostLayer
* @returns The removed HTML element
* @preserve (Part of the public API)
*/
export declare function remove<E extends HTMLElement>(control: TcHmi.Controls.System.baseTcHmiControl, element: E): E;
/**
* Removes the element from the top layer and returns it for later use by the caller
* If the element is not inside the TopMostLayer it will be returned without change.
* @param control control which requests this
* @param element jQuery Collection with the element which should be removed from TopMostLayer
* @returns jQuery Collection
* @preserve (Part of the public API)
*/
export declare function remove(control: TcHmi.Controls.System.baseTcHmiControl, element: JQuery): JQuery;
/**
* Appends the elements to the top layer above the normal visualization (not control namespaced)
* A reference to the element should be kept to be able to call remove() function
* The parent element will be a div with style="width:<browserwindowwidth>;height:<browserwindowheight>;"
* Your element could have style="min-width:50%;min-height:50%;"
* @param element HTML element which should be moved to TopMostLayer
* @param options Optional options
* @returns success of the add
* @preserve (Part of the public API)
*/
export declare function addEx<E extends HTMLElement>(element: E | undefined | null, options?: IOptionsEx<E>): boolean;
/**
* Appends the elements to the top layer above the normal visualization (not control namespaced)
* A reference to the element should be kept to be able to call remove() function
* The parent element will be a div with style="width:<browserwindowwidth>;height:<browserwindowheight>;"
* Your element could have style="min-width:50%;min-height:50%;"
* @param element jQuery Collection with exactly one element which should be moved to TopMostLayer
* @param options Optional options
* @returns success of the add
* @preserve (Part of the public API)
*/
export declare function addEx(element: JQuery | undefined | null, options?: IOptionsEx): boolean;
/**
* Removes the element from the top layer and returns it for later use by the caller (not control namespaced)
* If the element is not inside the TopMostLayer it will be returned without change.
* @param element HTML element which should be removed from TopMostLayer
* @returns The removed HTML element
* @preserve (Part of the public API)
*/
export declare function removeEx<E extends HTMLElement>(element: E): E;
/**
* Removes the element from the top layer and returns it for later use by the caller (not control namespaced)
* If the element is not inside the TopMostLayer it will be returned without change.
* @param element jQuery Collection with the element which should be removed from TopMostLayer
* @returns jQuery Collection
* @preserve (Part of the public API)
*/
export declare function removeEx(element: JQuery): JQuery;
export interface IOptionsBase {
/** Center the element on the screen. Default is false. */
centerHorizontal?: boolean | null | undefined;
/** Center the element on the screen. Default is false. */
centerVertical?: boolean | null | undefined;
/** Should the overlay be darken over the background. Default is true. */
dimBackground?: boolean | null | undefined;
/** Prevents pointer events from passing through the overlay and prohibits interaction with elements behind the overlay. Default is true. */
modal?: boolean | null | undefined;
/** Should a click on the overlay close the TopMostLayer? Default is true. */
closeOnBackground?: boolean | null | undefined;
/** All further calls moves element to top instead of abort. Default is false. */
allowMultipleCall?: boolean;
/**
* Add to the TopMostLayer just above the reference element. This will result in the added element being as
* low as possible in the TopMostLayer order while still being above the reference. If two or more elements
* want to be the lowest element you can specify the conflict resolution behavior to either insert the newly
* added element above or below the other elements that want to be at the bottom. If the conflict resolution
* is not specifed it defaults to Up, which results in conflicting elements being inserted so that the last
* added element is at the highest postion of all conflicting elements.
*/
justAbove?: {
reference: Element;
conflictResolution?: ConflictResolution;
};
}
export declare enum ConflictResolution {
Up = 0,
Down = 1
}
/**
* Options for control based API
*/
export interface IOptions<E extends HTMLElement | JQuery = JQuery> extends IOptionsBase {
/**
* Callback which will be called when the element has been potentially being resized.
* Its parameter gets information about the parents dimension.
*/
resizeCb?: ((this: TcHmi.Controls.System.baseTcHmiControl, data: IResizeResultObject<E>) => void) | null | undefined;
/**
* Callback which will be called when the element has been removed.
* Its parameter has information if the element was not removed by a
* remove API call but for example with a click beside the element.
*/
removeCb?: ((this: TcHmi.Controls.System.baseTcHmiControl, data: IElemRemoveResultObject<E>) => void) | null | undefined;
}
/**
* Options for non-control based API
*/
export interface IOptionsEx<E extends HTMLElement | JQuery = JQuery> extends IOptionsBase {
/** Callback which will be called when the element has been potentially being resized */
resizeCb?: ((this: typeof globalThis, data: IResizeResultObject<E>) => void) | null | undefined;
/** Callback which will be called when the element has been removed*/
removeCb?: ((this: typeof globalThis, data: IElemRemoveResultObject<E>) => void) | null | undefined;
}
export interface IResizeResultObject<E extends HTMLElement | JQuery = JQuery> extends TcHmi.IResultObject {
/** The given element in the TopMostLayer */
element: E;
parentPixelSize: {
width: number;
height: number;
};
}
export interface IElemRemoveResultObject<E extends HTMLElement | JQuery = JQuery> extends TcHmi.IResultObject {
/** The detached element which was in the TopMostLayer */
element: E;
/** The removal was NOT triggered by an API call but for example by user click beside the element. */
canceled: boolean;
}
declare const _add: typeof add;
declare const _remove: typeof remove;
declare const _addEx: typeof addEx;
declare const _removeEx: typeof removeEx;
type tIOptionsBase = IOptionsBase;
declare const _ConflictResolution: typeof ConflictResolution;
type tConflictResolution = ConflictResolution;
type tIOptions<E extends HTMLElement | JQuery = JQuery> = IOptions<E>;
type tIOptionsEx<E extends HTMLElement | JQuery = JQuery> = IOptionsEx<E>;
type tIResizeResultObject<E extends HTMLElement | JQuery = JQuery> = IResizeResultObject<E>;
type tIElemRemoveResultObject<E extends HTMLElement | JQuery = JQuery> = IElemRemoveResultObject<E>;
declare global {
namespace TcHmi {
/**
* Provides a layer to show elements above the normal visualization.
* @preserve (Part of the public API)
*/
namespace TopMostLayer {
const add: typeof _add;
const remove: typeof _remove;
const addEx: typeof _addEx;
const removeEx: typeof _removeEx;
type IOptionsBase = tIOptionsBase;
const ConflictResolution: typeof _ConflictResolution;
type ConflictResolution = tConflictResolution;
type IOptions<E extends HTMLElement | JQuery = JQuery> = tIOptions<E>;
type IOptionsEx<E extends HTMLElement | JQuery = JQuery> = tIOptionsEx<E>;
type IResizeResultObject<E extends HTMLElement | JQuery = JQuery> = tIResizeResultObject<E>;
type IElemRemoveResultObject<E extends HTMLElement | JQuery = JQuery> = tIElemRemoveResultObject<E>;
}
}
}
export {};
//# sourceMappingURL=TopMostLayer.d.ts.map

View File

@@ -0,0 +1 @@
import{isParameterTypeInvalid}from"../System/SystemFunctions.js";import{topMostLayer}from"../System/TopMostLayer.js";export function add(control,element,options){return!(!control||TCHMI_DESIGNER)&&((!options||!(isParameterTypeInvalid(options.centerHorizontal,"options.centerHorizontal",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.centerVertical,"options.centerVertical",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.closeOnBackground,"options.closeOnBackground",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.dimBackground,"options.dimBackground",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.modal,"options.modal",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.allowMultipleCall,"options.allowMultipleCall",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.removeCb,"options.removeCb",{type:"function",required:"undefinedOk"})||isParameterTypeInvalid(options.resizeCb,"options.resizeCb",{type:"function",required:"undefinedOk"})))&&topMostLayer.add(control,element,options))}export function remove(control,element){return!control||TCHMI_DESIGNER?element:topMostLayer.remove(control,element,!1)}export function addEx(element,options){return!TCHMI_DESIGNER&&((!options||!(isParameterTypeInvalid(options.centerHorizontal,"options.centerHorizontal",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.centerVertical,"options.centerVertical",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.closeOnBackground,"options.closeOnBackground",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.dimBackground,"options.dimBackground",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.modal,"options.modal",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.allowMultipleCall,"options.allowMultipleCall",{type:"boolean",required:"undefinedOk"})||isParameterTypeInvalid(options.justAbove,"options.justAbove",{type:"object",required:"undefinedOk"})||isParameterTypeInvalid(options.removeCb,"options.removeCb",{type:"function",required:"undefinedOk"})||isParameterTypeInvalid(options.resizeCb,"options.resizeCb",{type:"function",required:"undefinedOk"})))&&topMostLayer.add(globalThis,element,options))}export function removeEx(element){return TCHMI_DESIGNER?element:topMostLayer.remove(globalThis,element,!1)}export var ConflictResolution;!function(ConflictResolution){ConflictResolution[ConflictResolution.Up=0]="Up",ConflictResolution[ConflictResolution.Down=1]="Down"}(ConflictResolution||(ConflictResolution={}));TcHmi.TopMostLayer={add,remove,addEx,removeEx,ConflictResolution};

View File

@@ -0,0 +1,22 @@
/**
* Runs a list of actions. Returns a Promise that is resolved or rejected when the actions finish or run into an
* error, so this method can be awaited. If you need a callback that is called synchronously in cases where the
* action list also runs synchronously, you can use the ctx parameters success and error callbacks.
* @param actions The actions to run.
* @param ctx A context object. Used for callbacks and if an action wants to access ctx symbols.
*/
export declare function run<T>(actions: TcHmi.Trigger.Action[], ctx?: TcHmi.Context<T>): Promise<T | undefined>;
declare const _run: typeof run;
declare global {
namespace TcHmi.Trigger {
/**
* Namespace to handle actions as used in triggers.
* @preserve (Part of the public API)
*/
namespace Actions {
let run: typeof _run;
}
}
}
export {};
//# sourceMappingURL=Trigger.Actions.d.ts.map

View File

@@ -0,0 +1 @@
import{triggerManager}from"../System/TriggerManager.js";import{Exception}from"./Exception.js";export function run(actions,ctx){return new Promise((resolve,reject)=>{const context={...ctx,success:result=>{ctx?.success?.(result),resolve(result)},error:(error,details)=>{ctx?.error?.(error,details),reject(new Exception(details??{code:error}))},args:ctx?.args??[]},diagGUID=TCHMI_CONSOLE_LOG_LEVEL>=4||TCHMI_PERSISTENT_LOG_LEVEL>=4?tchmi_create_guid():"";triggerManager.processActionList(context,actions,diagGUID)})}TcHmi.Trigger={...TcHmi.Trigger??{},Actions:{run}};

View File

@@ -0,0 +1,76 @@
export * as Actions from './Trigger.Actions.js';
/**
* Trigger Parser Type Guard which checks 'objectType' of Action
* @param obj object to test
*/
export declare function isCondition(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.Condition;
/**
* Trigger Parser Type Guard which checks 'objectType' of Action
* @param obj object to test
*/
export declare function isSwitchCase(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.SwitchCase;
/**
* Trigger Parser Type Guard which checks 'objectType' of Action
* @param obj object to test
*/
export declare function isControlApiFunction(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.ControlApiFunction;
/**
* Trigger Parser Type Guard which checks 'objectType' of Action
* @param obj object to test
*/
export declare function isWriteToSymbol(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.WriteToSymbol;
/**
* Trigger Parser Type Guard which checks 'objectType' of Action
* @param obj object to test
*/
export declare function isComment(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.Comment;
/**
* Check if an object is a Function.
* @param obj object to test
*/
export declare function isFunction(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.TAFunction;
/**
* Trigger Parser Type Guard which checks 'objectType' of Action
* @param obj object to test
*/
export declare function isJavaScript(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.JavaScript;
/**
* Trigger Parser Type Guard which checks 'objectType' of Action
* @param obj object to test
*/
export declare function isActionTemplate(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.ActionTemplate;
/**
* Check if an object is a FunctionExpression.
* @param obj object to test
*/
export declare function isFunctionExpression(obj: TcHmi.Trigger.Action): obj is TcHmi.Trigger.FunctionExpression;
/**
* Check if an object is a ControlAttributeBindingTarget.
* @param obj object to test
*/
export declare function isControlAttributeBindingTarget(obj: TcHmi.Trigger.BindingTarget): obj is TcHmi.Trigger.ControlAttributeBindingTarget;
declare const _isCondition: typeof isCondition;
declare const _isSwitchCase: typeof isSwitchCase;
declare const _isControlApiFunction: typeof isControlApiFunction;
declare const _isWriteToSymbol: typeof isWriteToSymbol;
declare const _isComment: typeof isComment;
declare const _isFunction: typeof isFunction;
declare const _isJavaScript: typeof isJavaScript;
declare const _isActionTemplate: typeof isActionTemplate;
declare const _isFunctionExpression: typeof isFunctionExpression;
declare const _isControlAttributeBindingTarget: typeof isControlAttributeBindingTarget;
declare global {
namespace TcHmi.Trigger {
let isCondition: typeof _isCondition;
let isSwitchCase: typeof _isSwitchCase;
let isControlApiFunction: typeof _isControlApiFunction;
let isWriteToSymbol: typeof _isWriteToSymbol;
let isComment: typeof _isComment;
let isFunction: typeof _isFunction;
let isJavaScript: typeof _isJavaScript;
let isActionTemplate: typeof _isActionTemplate;
let isFunctionExpression: typeof _isFunctionExpression;
let isControlAttributeBindingTarget: typeof _isControlAttributeBindingTarget;
}
}
//# sourceMappingURL=Trigger.d.ts.map

View File

@@ -0,0 +1 @@
export*as Actions from"./Trigger.Actions.js";export function isCondition(obj){return"Condition"===obj.objectType}export function isSwitchCase(obj){return"SwitchCase"===obj.objectType}export function isControlApiFunction(obj){return"ControlApiFunction"===obj.objectType}export function isWriteToSymbol(obj){return"WriteToSymbol"===obj.objectType}export function isComment(obj){return"Comment"===obj.objectType}export function isFunction(obj){return null!==obj&&"Function"===obj.objectType}export function isJavaScript(obj){return"JavaScript"===obj.objectType}export function isActionTemplate(obj){return"ActionTemplate"===obj.objectType}export function isFunctionExpression(obj){return null!==obj&&"FunctionExpression"===obj.objectType}export function isControlAttributeBindingTarget(obj){return"ControlAttributeBindingTarget"===obj.objectType}TcHmi.Trigger={...TcHmi.Trigger??{},isCondition,isSwitchCase,isControlApiFunction,isWriteToSymbol,isComment,isFunction,isJavaScript,isActionTemplate,isFunctionExpression,isControlAttributeBindingTarget};

Some files were not shown because too many files have changed in this diff Show More