@node-projects/web-component-designer-visualization-addons 0.1.72 → 0.1.73
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/scripting/ScriptSystem.js +20 -13
- package/package.json +1 -1
|
@@ -100,12 +100,12 @@ export class ScriptSystem {
|
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
102
|
case 'Delay': {
|
|
103
|
-
const value = await this.getValue(command.value, context);
|
|
103
|
+
const value = await this.getValue(command.value ?? 500, context);
|
|
104
104
|
await sleep(value);
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
case 'Console': {
|
|
108
|
-
const target = await this.getValue(command.target, context);
|
|
108
|
+
const target = await this.getValue(command.target ?? 'log', context);
|
|
109
109
|
const message = await this.getValue(command.message, context);
|
|
110
110
|
console[target](message);
|
|
111
111
|
break;
|
|
@@ -143,16 +143,18 @@ export class ScriptSystem {
|
|
|
143
143
|
}
|
|
144
144
|
case 'SetBitInSignal': {
|
|
145
145
|
const signal = await this.getValue(command.signal, context);
|
|
146
|
+
const bitNumber = await this.getValue(command.bitNumber ?? 0, context);
|
|
146
147
|
let state = await this._visualizationHandler.getState(this.getSignaName(signal, context));
|
|
147
|
-
let mask = Long.fromNumber(1).shiftLeft(
|
|
148
|
+
let mask = Long.fromNumber(1).shiftLeft(bitNumber);
|
|
148
149
|
const newVal = Long.fromNumber(state.val).or(mask).toNumber();
|
|
149
150
|
await this._visualizationHandler.setState(this.getSignaName(signal, context), newVal);
|
|
150
151
|
break;
|
|
151
152
|
}
|
|
152
153
|
case 'ClearBitInSignal': {
|
|
153
154
|
const signal = await this.getValue(command.signal, context);
|
|
155
|
+
const bitNumber = await this.getValue(command.bitNumber ?? 0, context);
|
|
154
156
|
let state = await this._visualizationHandler.getState(this.getSignaName(signal, context));
|
|
155
|
-
let mask = Long.fromNumber(1).shiftLeft(
|
|
157
|
+
let mask = Long.fromNumber(1).shiftLeft(bitNumber);
|
|
156
158
|
mask.negate();
|
|
157
159
|
const newVal = Long.fromNumber(state.val).and(mask).toNumber();
|
|
158
160
|
await this._visualizationHandler.setState(this.getSignaName(signal, context), newVal);
|
|
@@ -160,8 +162,9 @@ export class ScriptSystem {
|
|
|
160
162
|
}
|
|
161
163
|
case 'ToggleBitInSignal': {
|
|
162
164
|
const signal = await this.getValue(command.signal, context);
|
|
165
|
+
const bitNumber = await this.getValue(command.bitNumber ?? 0, context);
|
|
163
166
|
let state = await this._visualizationHandler.getState(this.getSignaName(signal, context));
|
|
164
|
-
let mask = Long.fromNumber(1).shiftLeft(
|
|
167
|
+
let mask = Long.fromNumber(1).shiftLeft(bitNumber);
|
|
165
168
|
const newVal = Long.fromNumber(state.val).xor(mask).toNumber();
|
|
166
169
|
await this._visualizationHandler.setState(this.getSignaName(signal, context), newVal);
|
|
167
170
|
break;
|
|
@@ -181,23 +184,27 @@ export class ScriptSystem {
|
|
|
181
184
|
command = ScriptUpgrades.upgradeSetElementProperty(command);
|
|
182
185
|
const name = await this.getValue(command.name, context);
|
|
183
186
|
const value = await this.getValue(command.value, context);
|
|
184
|
-
const parentIndex = await this.getValue(command.parentIndex, context);
|
|
185
|
-
|
|
187
|
+
const parentIndex = await this.getValue(command.parentIndex ?? 0, context);
|
|
188
|
+
const target = await this.getValue(command.target ?? 'property', context);
|
|
189
|
+
const targetSelectorTarget = await this.getValue(command.targetSelectorTarget ?? 'property', context);
|
|
190
|
+
const targetSelector = await this.getValue(command.targetSelector ?? 'container', context);
|
|
191
|
+
const mode = await this.getValue(command.mode, context);
|
|
192
|
+
let elements = this.getTargetFromTargetSelector(context, targetSelectorTarget, parentIndex, targetSelector);
|
|
186
193
|
for (let e of elements) {
|
|
187
|
-
if (
|
|
194
|
+
if (target == 'attribute') {
|
|
188
195
|
e.setAttribute(name, value);
|
|
189
196
|
}
|
|
190
|
-
else if (
|
|
197
|
+
else if (target == 'property') {
|
|
191
198
|
e[name] = value;
|
|
192
199
|
}
|
|
193
|
-
else if (
|
|
200
|
+
else if (target == 'css') {
|
|
194
201
|
e.style[name] = value;
|
|
195
202
|
}
|
|
196
|
-
else if (
|
|
197
|
-
if (
|
|
203
|
+
else if (target == 'class') {
|
|
204
|
+
if (mode === 'toggle') {
|
|
198
205
|
e.classList.toggle(value);
|
|
199
206
|
}
|
|
200
|
-
else if (
|
|
207
|
+
else if (mode === 'remove') {
|
|
201
208
|
e.classList.remove(value);
|
|
202
209
|
}
|
|
203
210
|
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.73",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|