@node-projects/web-component-designer-visualization-addons 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockly/BlocklyJavascriptHelper.d.ts +1 -1
- package/dist/blockly/BlocklyJavascriptHelper.js +3 -1
- package/dist/blockly/components/GetParameter.js +1 -1
- package/dist/blockly/components/GetState.js +1 -1
- package/dist/blockly/components/SetState.js +1 -1
- package/dist/scripting/ScriptSystem.d.ts +1 -2
- package/dist/scripting/ScriptSystem.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './components/components.js';
|
|
2
|
-
export declare function generateEventCodeFromBlockly(data: any): Promise<(event: Event, shadowRoot: ShadowRoot, parameters: Record<string, any
|
|
2
|
+
export declare function generateEventCodeFromBlockly(data: any): Promise<(event: Event, shadowRoot: ShadowRoot, parameters: Record<string, any>, relativeSignalsPath: string) => void>;
|
|
@@ -9,7 +9,7 @@ const prefix = `function extractPart(obj, propertyPath) {
|
|
|
9
9
|
return retVal;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export async function run(eventData, shadowRoot, parameters) {
|
|
12
|
+
export async function run(eventData, shadowRoot, parameters, relativeSignalsPath) {
|
|
13
13
|
`;
|
|
14
14
|
const postfix = `}`;
|
|
15
15
|
export async function generateEventCodeFromBlockly(data) {
|
|
@@ -26,6 +26,8 @@ export async function generateEventCodeFromBlockly(data) {
|
|
|
26
26
|
//@ts-ignore
|
|
27
27
|
Blockly.JavaScript.addReservedWords('parameters');
|
|
28
28
|
//@ts-ignore
|
|
29
|
+
Blockly.JavaScript.addReservedWords('relativeSignalsPath');
|
|
30
|
+
//@ts-ignore
|
|
29
31
|
Blockly.JavaScript.addReservedWords('IOB');
|
|
30
32
|
//@ts-ignore
|
|
31
33
|
Blockly.JavaScript.addReservedWords('RUNTIME');
|
|
@@ -15,7 +15,7 @@ Blockly.Blocks['get_parameter'] = {
|
|
|
15
15
|
Blockly.JavaScript['get_parameter'] = function (block, generator) {
|
|
16
16
|
//@ts-ignore
|
|
17
17
|
const name = Blockly.JavaScript.valueToCode(block, 'NAME', Blockly.JavaScript.ORDER_ATOMIC);
|
|
18
|
-
const code = `parameters[${name}]`;
|
|
18
|
+
const code = `context.parameters[${name}]`;
|
|
19
19
|
//@ts-ignore
|
|
20
20
|
return [code, Blockly.JavaScript.ORDER_NONE];
|
|
21
21
|
};
|
|
@@ -15,7 +15,7 @@ Blockly.Blocks['get_state'] = {
|
|
|
15
15
|
Blockly.JavaScript['get_state'] = function (block, generator) {
|
|
16
16
|
//@ts-ignore
|
|
17
17
|
const id = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
|
|
18
|
-
const code = `(await IOB.getState(${id})).val`;
|
|
18
|
+
const code = `(await IOB.getState((${id}[0] === '.' ? relativeSignalsPath : '') + ${id})).val`;
|
|
19
19
|
//@ts-ignore
|
|
20
20
|
return [code, Blockly.JavaScript.ORDER_NONE];
|
|
21
21
|
};
|
|
@@ -21,6 +21,6 @@ Blockly.JavaScript['set_state'] = function (block) {
|
|
|
21
21
|
const id = Blockly.JavaScript.valueToCode(block, 'OID', Blockly.JavaScript.ORDER_ATOMIC);
|
|
22
22
|
//@ts-ignore
|
|
23
23
|
const value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_ATOMIC);
|
|
24
|
-
const code = `await IOB.setState(${id}, ${value});\n`;
|
|
24
|
+
const code = `await IOB.setState((${id}[0] === '.' ? relativeSignalsPath : '') + ${id}, ${value});\n`;
|
|
25
25
|
return code;
|
|
26
26
|
};
|
|
@@ -2,7 +2,7 @@ import { IScriptMultiplexValue } from "../interfaces/IScriptMultiplexValue.js";
|
|
|
2
2
|
import { VisualisationElementScript } from "../interfaces/VisualisationElementScript.js";
|
|
3
3
|
import { VisualizationHandler } from "../interfaces/VisualizationHandler.js";
|
|
4
4
|
import { ScriptCommands } from "./ScriptCommands.js";
|
|
5
|
-
type contextType = {
|
|
5
|
+
export type contextType = {
|
|
6
6
|
event: Event;
|
|
7
7
|
element: Element;
|
|
8
8
|
root: HTMLElement;
|
|
@@ -21,4 +21,3 @@ export declare class ScriptSystem {
|
|
|
21
21
|
static extractPart(obj: any, propertyPath: string): any;
|
|
22
22
|
assignAllScripts(source: string, javascriptCode: string, shadowRoot: ShadowRoot, instance: HTMLElement, assignExternalScript?: (element: Element, event: string, scriptData: any) => void): Promise<VisualisationElementScript>;
|
|
23
23
|
}
|
|
24
|
-
export {};
|
|
@@ -225,7 +225,7 @@ export class ScriptSystem {
|
|
|
225
225
|
e.addEventListener(evtName, async (evt) => {
|
|
226
226
|
if (!compiledFunc)
|
|
227
227
|
compiledFunc = await generateEventCodeFromBlockly(scriptObj);
|
|
228
|
-
compiledFunc(evt, shadowRoot, scriptObj.parameters);
|
|
228
|
+
compiledFunc(evt, shadowRoot, scriptObj.parameters, scriptObj.relativeSignalsPath ?? '');
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
else {
|
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.22",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|