@node-projects/web-component-designer-visualization-addons 0.1.96 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -22,5 +22,6 @@ export declare class ScriptSystem {
|
|
|
22
22
|
parseStringWithValues(text: string, context: contextType): Promise<string>;
|
|
23
23
|
getSignaName(name: string, outerContext: contextType): string;
|
|
24
24
|
static extractPart(obj: any, propertyPath: string): any;
|
|
25
|
-
|
|
25
|
+
createScriptContext(root: HTMLElement, event: Event, element: Element, parameters: Record<string, any>, relativeSignalsPath: string): any;
|
|
26
|
+
assignAllScripts(source: string, javascriptCode: string, shadowRoot: ShadowRoot, instance: HTMLElement, visualizationHandler: VisualizationHandler, assignExternalScript?: (element: Element, event: string, scriptData: any) => void): Promise<VisualisationElementScript>;
|
|
26
27
|
}
|
|
@@ -398,7 +398,10 @@ export class ScriptSystem {
|
|
|
398
398
|
}
|
|
399
399
|
return retVal;
|
|
400
400
|
}
|
|
401
|
-
|
|
401
|
+
createScriptContext(root, event, element, parameters, relativeSignalsPath) {
|
|
402
|
+
return { root, event, element, parameters, relativeSignalsPath };
|
|
403
|
+
}
|
|
404
|
+
async assignAllScripts(source, javascriptCode, shadowRoot, instance, visualizationHandler, assignExternalScript) {
|
|
402
405
|
const allElements = shadowRoot.querySelectorAll('*');
|
|
403
406
|
let jsObject = null;
|
|
404
407
|
if (javascriptCode) {
|
|
@@ -422,14 +425,14 @@ export class ScriptSystem {
|
|
|
422
425
|
if (script[0] == '{') {
|
|
423
426
|
let scriptObj = JSON.parse(script);
|
|
424
427
|
if ('commands' in scriptObj) {
|
|
425
|
-
e.addEventListener(evtName, (evt) => this.execute(scriptObj.commands,
|
|
428
|
+
e.addEventListener(evtName, (evt) => this.execute(scriptObj.commands, this.createScriptContext(instance, evt, e, scriptObj.parameters, scriptObj.relativeSignalsPath)));
|
|
426
429
|
}
|
|
427
430
|
else if ('blocks' in scriptObj) {
|
|
428
431
|
let compiledFunc = null;
|
|
429
432
|
e.addEventListener(evtName, async (evt) => {
|
|
430
433
|
if (!compiledFunc)
|
|
431
434
|
compiledFunc = await generateEventCodeFromBlockly(scriptObj);
|
|
432
|
-
compiledFunc(evt, shadowRoot, scriptObj.parameters, scriptObj.relativeSignalsPath ?? '', visualizationHandler,
|
|
435
|
+
compiledFunc(evt, shadowRoot, scriptObj.parameters, scriptObj.relativeSignalsPath ?? '', visualizationHandler, this.createScriptContext(instance, evt, e, scriptObj.parameters, scriptObj.relativeSignalsPath));
|
|
433
436
|
});
|
|
434
437
|
}
|
|
435
438
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScriptCommands, SetElementProperty } from "./ScriptCommands";
|
|
2
2
|
export declare class ScriptUpgrades {
|
|
3
|
-
static upgradeScriptCommand(scriptCommand: ScriptCommands): import("./ScriptCommands").Comment | import("./ScriptCommands").OpenScreen | import("./ScriptCommands").OpenUrl | import("./ScriptCommands").OpenDialog | import("./ScriptCommands").CloseDialog | import("./ScriptCommands").ToggleSignalValue | import("./ScriptCommands").SetSignalValue | import("./ScriptCommands").IncrementSignalValue | import("./ScriptCommands").DecrementSignalValue | import("./ScriptCommands").SetBitInSignal | import("./ScriptCommands").ClearBitInSignal | import("./ScriptCommands").ToggleBitInSignal | import("./ScriptCommands").Console | import("./ScriptCommands").CalculateSignalValue | import("./ScriptCommands").Javascript |
|
|
3
|
+
static upgradeScriptCommand(scriptCommand: ScriptCommands): SetElementProperty | import("./ScriptCommands").Comment | import("./ScriptCommands").OpenScreen | import("./ScriptCommands").OpenUrl | import("./ScriptCommands").OpenDialog | import("./ScriptCommands").CloseDialog | import("./ScriptCommands").ToggleSignalValue | import("./ScriptCommands").SetSignalValue | import("./ScriptCommands").IncrementSignalValue | import("./ScriptCommands").DecrementSignalValue | import("./ScriptCommands").SetBitInSignal | import("./ScriptCommands").ClearBitInSignal | import("./ScriptCommands").ToggleBitInSignal | import("./ScriptCommands").Console | import("./ScriptCommands").CalculateSignalValue | import("./ScriptCommands").Javascript | import("./ScriptCommands").Delay | import("./ScriptCommands").SwitchLanguage | import("./ScriptCommands").Login | import("./ScriptCommands").Logout | import("./ScriptCommands").SubscribeSignal | import("./ScriptCommands").UnsubscribeSignal | import("./ScriptCommands").WriteSignalsInGroup | import("./ScriptCommands").ClearSiganlsInGroup | import("./ScriptCommands").Condition | import("./ScriptCommands").Exit | import("./ScriptCommands").Label | import("./ScriptCommands").RunScript | import("./ScriptCommands").Goto | import("./ScriptCommands").CopySignalValuesFromFolder | import("./ScriptCommands").ShowMessageBox | import("./ScriptCommands").ExportSignalValuesAsJson | import("./ScriptCommands").ImportSignalValuesFromJson;
|
|
4
4
|
static upgradeSetElementProperty(scriptCommand: SetElementProperty): SetElementProperty;
|
|
5
5
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "web-component-designer addon for visualizations",
|
|
3
3
|
"name": "@node-projects/web-component-designer-visualization-addons",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.97",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|