@lowdefy/engine 0.0.0-alpha.7 → 0.0.0-experimental-20231123124425

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.
Files changed (40) hide show
  1. package/LICENSE +201 -0
  2. package/dist/Actions.js +231 -486
  3. package/dist/Blocks.js +563 -572
  4. package/dist/Events.js +126 -0
  5. package/dist/Requests.js +107 -134
  6. package/dist/State.js +56 -83
  7. package/dist/actions/createCallMethod.js +29 -0
  8. package/dist/actions/createDisplayMessage.js +20 -0
  9. package/dist/actions/createGetActions.js +27 -0
  10. package/dist/actions/createGetBlockId.js +20 -0
  11. package/dist/actions/createGetEvent.js +27 -0
  12. package/dist/actions/createGetGlobal.js +27 -0
  13. package/dist/actions/createGetInput.js +27 -0
  14. package/dist/actions/createGetPageId.js +20 -0
  15. package/dist/actions/createGetRequestDetails.js +27 -0
  16. package/dist/actions/createGetState.js +27 -0
  17. package/dist/actions/createGetUrlQuery.js +32 -0
  18. package/dist/actions/createGetUser.js +27 -0
  19. package/dist/actions/createLink.js +20 -0
  20. package/dist/actions/createLogin.js +20 -0
  21. package/dist/actions/createLogout.js +20 -0
  22. package/dist/actions/createRequest.js +26 -0
  23. package/dist/actions/createReset.js +22 -0
  24. package/dist/actions/createResetValidation.js +21 -0
  25. package/dist/actions/createSetGlobal.js +25 -0
  26. package/dist/actions/createSetState.js +25 -0
  27. package/dist/actions/createUpdateSession.js +20 -0
  28. package/dist/actions/createValidate.js +25 -0
  29. package/dist/actions/getActionMethods.js +63 -0
  30. package/dist/actions/getFromObject.js +42 -0
  31. package/dist/createLink.js +71 -0
  32. package/dist/getBlockMatcher.js +61 -0
  33. package/dist/getContext.js +106 -153
  34. package/dist/index.js +10 -63
  35. package/package.json +27 -26
  36. package/CHANGELOG.md +0 -38
  37. package/dist/BlockActions.js +0 -211
  38. package/dist/Mutations.js +0 -100
  39. package/dist/getFieldValues.js +0 -49
  40. package/dist/makeContextId.js +0 -44
package/dist/Blocks.js CHANGED
@@ -1,590 +1,581 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- var _BlockActions = _interopRequireDefault(require("./BlockActions"));
11
-
12
- var _getFieldValues = _interopRequireDefault(require("./getFieldValues"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
-
20
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
-
22
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
23
-
24
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
-
26
- class Blocks {
27
- constructor(_ref) {
28
- var {
29
- arrayIndices,
30
- areas,
31
- context
32
- } = _ref;
33
- this.id = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);
34
- this.context = context;
35
- this.areas = _helpers.serializer.copy(areas || []);
36
- this.arrayIndices = _helpers.type.isArray(arrayIndices) ? arrayIndices : [];
37
- this.subBlocks = {};
38
- this.map = {};
39
- this.recCount = 0;
40
- this.init = this.init.bind(this);
41
- this.reset = this.reset.bind(this);
42
- this.recEval = this.recEval.bind(this);
43
- this.updateState = this.updateState.bind(this);
44
- this.updateStateFromRoot = this.updateStateFromRoot.bind(this);
45
- this.setBlocksCache = this.setBlocksCache.bind(this);
46
- this.recContainerDelState = this.recContainerDelState.bind(this);
47
- this.recUpdateArrayIndices = this.recUpdateArrayIndices.bind(this);
48
- this.recSetUndefined = this.recSetUndefined.bind(this);
49
- this.newBlocks = this.newBlocks.bind(this);
50
- this.getValidateRec = this.getValidateRec.bind(this);
51
- this.setBlocksLoadingCache = this.setBlocksLoadingCache.bind(this);
52
- this.generateBlockId = this.generateBlockId.bind(this);
53
- this.update = this.update.bind(this);
54
- this.validate = this.validate.bind(this);
55
- this.recRemoveBlocksFromMap = this.recRemoveBlocksFromMap.bind(this);
56
- }
57
-
58
- loopBlocks(fn) {
59
- if (_helpers.type.isObject(this.areas)) {
60
- Object.keys(this.areas).forEach(key => {
61
- if (_helpers.type.isArray(this.areas[key].blocks)) {
62
- this.areas[key].blocks.forEach(fn);
1
+ /* eslint-disable no-param-reassign */ /*
2
+ Copyright 2020-2023 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { applyArrayIndices, get, serializer, swap, type } from '@lowdefy/helpers';
16
+ import Events from './Events.js';
17
+ let Blocks = class Blocks {
18
+ loopBlocks(fn) {
19
+ if (type.isObject(this.areas)) {
20
+ Object.keys(this.areas).forEach((key)=>{
21
+ if (type.isArray(this.areas[key].blocks)) {
22
+ this.areas[key].blocks.forEach(fn);
23
+ }
24
+ });
63
25
  }
64
- });
65
26
  }
66
- }
67
-
68
- init(initState) {
69
- this.loopBlocks(block => {
70
- block.blockIdPattern = block.blockId;
71
- block.id = this.generateBlockId(block.blockIdPattern);
72
- block.fieldPattern = block.field;
73
- block.blockId = (0, _helpers.applyArrayIndices)(this.arrayIndices, block.blockIdPattern);
74
- this.context.RootBlocks.map[block.blockId] = block;
75
- block.field = !_helpers.type.isNone(block.fieldPattern) ? (0, _helpers.applyArrayIndices)(this.arrayIndices, block.fieldPattern) : block.blockId;
76
- block.visible = _helpers.type.isNone(block.visible) ? true : block.visible;
77
- block.required = _helpers.type.isNone(block.required) ? false : block.required;
78
- block.validate = _helpers.type.isArray(block.validate) ? block.validate : [];
79
- block.properties = _helpers.type.isNone(block.properties) ? {} : block.properties;
80
- block.style = _helpers.type.isNone(block.style) ? {} : block.style;
81
- block.layout = _helpers.type.isNone(block.layout) ? {} : block.layout;
82
- block.actions = _helpers.type.isNone(block.actions) ? {} : block.actions;
83
- block.visibleEval = {};
84
- block.propertiesEval = {};
85
- block.requiredEval = {};
86
- block.validationEval = {};
87
- block.styleEval = {};
88
- block.layoutEval = {};
89
- block.areasLayoutEval = {};
90
-
91
- if (!_helpers.type.isNone(block.areas)) {
92
- block.areasLayout = {};
93
- Object.keys(block.areas).forEach(key => {
94
- // eslint-disable-next-line no-unused-vars
95
- var _block$areas$key = block.areas[key],
96
- {
97
- blocks
98
- } = _block$areas$key,
99
- areaLayout = _objectWithoutProperties(_block$areas$key, ["blocks"]);
100
-
101
- block.areasLayout[key] = _objectSpread({}, areaLayout);
102
- });
103
- } else {
104
- block.areasLayout = {};
105
- }
106
-
107
- block.requestKeys = (0, _getFieldValues.default)('_request', block.style, block.properties, block.validate, block.visible, block.required);
108
- block.methods = {};
109
-
110
- block.registerMethod = (methodName, method) => {
111
- block.methods[methodName] = method;
112
- }; // TODO: add callMethod on block to be used by actions and accessible in blocks
113
-
114
-
115
- if ((0, _helpers.get)(block, 'meta.category') === 'list') {
116
- // TODO: to initialize new object in array, the new value should be passed by method to unshiftItem and pushItem
117
- block.unshiftItem = () => {
118
- this.subBlocks[block.id].forEach((bl, i) => {
119
- bl.recUpdateArrayIndices(this.arrayIndices.concat([i]), this.arrayIndices.concat([i + 1]));
120
- });
121
- this.subBlocks[block.id].unshift(this.newBlocks({
122
- arrayIndices: this.arrayIndices.concat([0]),
123
- block,
124
- initState: {}
125
- }));
126
- this.context.State.set(block.field, undefined); // set block and subBlock values undefined, so as not to pass values to new blocks
127
-
128
- this.subBlocks[block.id][0].recSetUndefined();
129
- block.update = true;
130
- this.context.update();
131
- };
132
-
133
- block.pushItem = () => {
134
- this.subBlocks[block.id].push(this.newBlocks({
135
- arrayIndices: this.arrayIndices.concat([this.subBlocks[block.id].length]),
136
- block,
137
- initState: {}
138
- }));
139
- block.update = true;
140
- this.context.update();
141
- };
142
-
143
- block.removeItem = index => {
144
- this.context.State.removeItem(block.blockId, index);
145
- var lastBlock = this.subBlocks[block.id][this.subBlocks[block.id].length - 1];
146
- lastBlock.recRemoveBlocksFromMap();
147
- var largerBlocks = this.subBlocks[block.id].slice(index + 1);
148
- largerBlocks.forEach((bl, i) => {
149
- bl.recUpdateArrayIndices(this.arrayIndices.concat([index + i + 1]), this.arrayIndices.concat([index + i]));
150
- });
151
- this.subBlocks[block.id].splice(index, 1);
152
- block.update = true;
153
- this.context.update();
154
- };
155
-
156
- block.moveItemUp = index => {
157
- if (index === 0) return;
158
- this.context.State.swapItems(block.blockId, index - 1, index);
159
- this.subBlocks[block.id][index - 1].recUpdateArrayIndices(this.arrayIndices.concat([index - 1]), this.arrayIndices.concat([index]));
160
- this.subBlocks[block.id][index].recUpdateArrayIndices(this.arrayIndices.concat([index]), this.arrayIndices.concat([index - 1]));
161
- (0, _helpers.swap)(this.subBlocks[block.id], index - 1, index);
162
- block.update = true;
163
- this.context.update();
164
- };
165
-
166
- block.moveItemDown = index => {
167
- if (index === this.subBlocks[block.id].length - 1) return;
168
- this.context.State.swapItems(block.blockId, index, index + 1);
169
- this.subBlocks[block.id][index + 1].recUpdateArrayIndices(this.arrayIndices.concat([index + 1]), this.arrayIndices.concat([index]));
170
- this.subBlocks[block.id][index].recUpdateArrayIndices(this.arrayIndices.concat([index]), this.arrayIndices.concat([index + 1]));
171
- (0, _helpers.swap)(this.subBlocks[block.id], index, index + 1);
172
- block.update = true;
173
- this.context.update();
174
- };
175
- }
176
-
177
- if ((0, _helpers.get)(block, 'meta.category') === 'input') {
178
- block.setValue = value => {
179
- block.value = _helpers.type.enforceType(block.meta.valueType, value);
180
- this.context.State.set(block.field, block.value);
181
- block.update = true;
182
- this.context.update();
183
- };
184
- }
185
-
186
- block.BlockActions = new _BlockActions.default({
187
- arrayIndices: this.arrayIndices,
188
- block,
189
- context: this.context
190
- });
191
- block.callAction = block.BlockActions.callAction;
192
- block.registerAction = block.BlockActions.registerAction;
193
- });
194
- this.reset(initState); // set initial values to blocks.
195
- }
196
-
197
- reset(initWithState) {
198
- var initState = _helpers.serializer.copy(initWithState || this.context.state);
199
-
200
- this.loopBlocks(block => {
201
- block.update = true;
202
-
203
- if ((0, _helpers.get)(block, 'meta.category') === 'input' || (0, _helpers.get)(block, 'meta.category') === 'list') {
204
- var blockValue = (0, _helpers.get)(initState, block.field);
205
-
206
- if (_helpers.type.isUndefined(blockValue)) {
207
- // default null value for block type
208
- blockValue = _helpers.type.enforceType(block.meta.valueType, null);
209
- this.context.State.set(block.field, block.value);
210
- block.update = true;
211
- }
212
-
213
- if ((0, _helpers.get)(block, 'meta.category') === 'list') {
214
- // load list value into list blocks
215
- if (!_helpers.type.isArray(this.subBlocks[block.id])) {
216
- this.subBlocks[block.id] = [];
217
- }
218
-
219
- if (_helpers.type.isArray(blockValue)) {
220
- blockValue.forEach((item, i) => {
221
- if (!this.subBlocks[block.id][i]) {
222
- this.subBlocks[block.id].push(this.newBlocks({
223
- arrayIndices: this.arrayIndices.concat([i]),
224
- block,
225
- initState
226
- }));
227
- } else {
228
- this.subBlocks[block.id][i].reset(initState);
229
- }
27
+ init(initState) {
28
+ this.loopBlocks((block)=>{
29
+ block.idPattern = block.id;
30
+ block.blockIdPattern = block.blockId;
31
+ block.id = applyArrayIndices(this.arrayIndices, block.idPattern);
32
+ block.blockId = applyArrayIndices(this.arrayIndices, block.blockIdPattern);
33
+ // CAUTION:
34
+ // map is not a direct reference to all blocks, blocks with duplicate ids will be overwritten in map
35
+ // which can cause issues with ambiguous config during call method since it will call only the method
36
+ // of the last initialized block for the referenced id.
37
+ this.context._internal.RootBlocks.map[block.blockId] = block;
38
+ block.events = type.isNone(block.events) ? {} : block.events;
39
+ block.layout = type.isNone(block.layout) ? {} : block.layout;
40
+ block.loading = type.isNone(block.loading) ? false : block.loading;
41
+ block.properties = type.isNone(block.properties) ? {} : block.properties;
42
+ block.required = type.isNone(block.required) ? false : block.required;
43
+ block.skeleton = type.isNone(block.skeleton) ? null : block.skeleton;
44
+ block.style = type.isNone(block.style) ? {} : block.style;
45
+ block.validate = type.isNone(block.validate) ? [] : block.validate;
46
+ block.visible = type.isNone(block.visible) ? true : block.visible;
47
+ block.areasLayoutEval = {};
48
+ block.layoutEval = {};
49
+ block.loadingEval = {};
50
+ block.propertiesEval = {};
51
+ block.requiredEval = {};
52
+ block.skeletonEval = {};
53
+ block.styleEval = {};
54
+ block.validationEval = {};
55
+ block.visibleEval = {};
56
+ try {
57
+ block.meta = this.context._internal.lowdefy._internal.blockComponents[block.type].meta;
58
+ } catch (error) {
59
+ throw new Error(`Block type ${block.type} not found at ${block.blockId}. Check your plugins to make sure the block is installed. For more info, see https://docs.lowdefy.com/plugins.`);
60
+ }
61
+ if (block.meta?.category !== 'container' && block.meta?.category !== 'display' && block.meta?.category !== 'input' && block.meta?.category !== 'list') {
62
+ throw new Error(`Block type ${block.type}.meta.category must be either "container", "display", "input" or "list".`);
63
+ }
64
+ if (!type.isNone(block.areas)) {
65
+ block.areasLayout = {};
66
+ Object.keys(block.areas).forEach((key)=>{
67
+ // eslint-disable-next-line no-unused-vars
68
+ const { blocks, ...areaLayout } = block.areas[key];
69
+ block.areasLayout[key] = {
70
+ ...areaLayout
71
+ };
72
+ });
73
+ } else {
74
+ block.areasLayout = {};
75
+ }
76
+ block.methods = {};
77
+ block.registerMethod = (methodName, method)=>{
78
+ block.methods[methodName] = method;
79
+ };
80
+ if (block.meta.category === 'list') {
81
+ // TODO: to initialize new object in array, the new value should be passed by method to unshiftItem and pushItem
82
+ block.unshiftItem = ()=>{
83
+ this.subBlocks[block.id].forEach((bl, i)=>{
84
+ bl.recUpdateArrayIndices(this.arrayIndices.concat([
85
+ i
86
+ ]), this.arrayIndices.concat([
87
+ i + 1
88
+ ]));
89
+ });
90
+ this.subBlocks[block.id].unshift(this.newBlocks({
91
+ arrayIndices: this.arrayIndices.concat([
92
+ 0
93
+ ]),
94
+ block,
95
+ initState: {}
96
+ }));
97
+ this.context._internal.State.set(block.blockId, undefined);
98
+ // set block and subBlock values undefined, so as not to pass values to new blocks
99
+ this.subBlocks[block.id][0].recSetUndefined();
100
+ block.update = true;
101
+ this.context._internal.update();
102
+ };
103
+ block.pushItem = ()=>{
104
+ this.subBlocks[block.id].push(this.newBlocks({
105
+ arrayIndices: this.arrayIndices.concat([
106
+ this.subBlocks[block.id].length
107
+ ]),
108
+ block,
109
+ initState: {}
110
+ }));
111
+ block.update = true;
112
+ this.context._internal.update();
113
+ };
114
+ block.removeItem = (index)=>{
115
+ this.context._internal.State.removeItem(block.blockId, index);
116
+ const lastBlock = this.subBlocks[block.id][this.subBlocks[block.id].length - 1];
117
+ lastBlock.recRemoveBlocksFromMap();
118
+ const largerBlocks = this.subBlocks[block.id].slice(index + 1);
119
+ largerBlocks.forEach((bl, i)=>{
120
+ bl.recUpdateArrayIndices(this.arrayIndices.concat([
121
+ index + i + 1
122
+ ]), this.arrayIndices.concat([
123
+ index + i
124
+ ]));
125
+ });
126
+ this.subBlocks[block.id].splice(index, 1);
127
+ block.update = true;
128
+ this.context._internal.update();
129
+ };
130
+ block.moveItemUp = (index)=>{
131
+ if (index === 0) return;
132
+ this.context._internal.State.swapItems(block.blockId, index - 1, index);
133
+ this.subBlocks[block.id][index - 1].recUpdateArrayIndices(this.arrayIndices.concat([
134
+ index - 1
135
+ ]), this.arrayIndices.concat([
136
+ index
137
+ ]));
138
+ this.subBlocks[block.id][index].recUpdateArrayIndices(this.arrayIndices.concat([
139
+ index
140
+ ]), this.arrayIndices.concat([
141
+ index - 1
142
+ ]));
143
+ swap(this.subBlocks[block.id], index - 1, index);
144
+ block.update = true;
145
+ this.context._internal.update();
146
+ };
147
+ block.moveItemDown = (index)=>{
148
+ if (index === this.subBlocks[block.id].length - 1) return;
149
+ this.context._internal.State.swapItems(block.blockId, index, index + 1);
150
+ this.subBlocks[block.id][index + 1].recUpdateArrayIndices(this.arrayIndices.concat([
151
+ index + 1
152
+ ]), this.arrayIndices.concat([
153
+ index
154
+ ]));
155
+ this.subBlocks[block.id][index].recUpdateArrayIndices(this.arrayIndices.concat([
156
+ index
157
+ ]), this.arrayIndices.concat([
158
+ index + 1
159
+ ]));
160
+ swap(this.subBlocks[block.id], index, index + 1);
161
+ block.update = true;
162
+ this.context._internal.update();
163
+ };
164
+ }
165
+ if (block.meta.category === 'input') {
166
+ block.setValue = (value)=>{
167
+ block.value = type.enforceType(block.meta.valueType, value);
168
+ this.context._internal.State.set(block.blockId, block.value);
169
+ block.update = true;
170
+ this.context._internal.update();
171
+ };
172
+ }
173
+ block.Events = new Events({
174
+ arrayIndices: this.arrayIndices,
175
+ block,
176
+ context: this.context
230
177
  });
231
- this.subBlocks[block.id].splice(blockValue.length);
232
- }
233
- } else {
234
- block.value = blockValue;
235
- }
236
- } else if ((0, _helpers.get)(block, 'meta.category') === 'container' || // do not make sub blocks for sub contexts
237
- (0, _helpers.get)(block, 'meta.category') === 'context' && this === this.context.RootBlocks) {
238
- if (!_helpers.type.isArray(this.subBlocks[block.id])) {
239
- this.subBlocks[block.id] = [];
240
- }
241
-
242
- if (!this.subBlocks[block.id][0]) {
243
- this.subBlocks[block.id].push(this.newBlocks({
244
- arrayIndices: this.arrayIndices,
245
- block,
246
- initState
247
- }));
248
- } else {
249
- this.subBlocks[block.id][0].reset(initState);
250
- }
251
- }
252
- });
253
- }
254
-
255
- newBlocks(_ref2) {
256
- var {
257
- arrayIndices,
258
- block,
259
- initState
260
- } = _ref2;
261
- var SubBlocks = new Blocks({
262
- arrayIndices,
263
- areas: block.areas,
264
- context: this.context
265
- });
266
- SubBlocks.init(initState);
267
- return SubBlocks;
268
- } // used for update comparison
269
-
270
-
271
- static blockEvalToString(block) {
272
- return _helpers.serializer.serializeToString({
273
- areasLayoutEval: block.areasLayoutEval,
274
- layoutEval: block.layoutEval,
275
- propertiesEval: block.propertiesEval,
276
- requiredEval: block.requiredEval,
277
- styleEval: block.styleEval,
278
- validationEval: block.validationEval,
279
- value: block.value,
280
- visibleEval: block.visibleEval
281
- });
282
- }
283
-
284
- recEval(visibleParent) {
285
- var repeat = false;
286
- this.loopBlocks(block => {
287
- if (block.meta.category === 'input') {
288
- var stateValue = (0, _helpers.get)(this.context.state, block.field); // enforce type here? should we reassign value here??
289
-
290
- block.value = _helpers.type.isUndefined(stateValue) ? block.value : stateValue;
291
- }
292
-
293
- var beforeVisible = block.visibleEval ? block.visibleEval.output : true;
294
-
295
- if (!visibleParent) {
296
- block.visibleEval.output = false;
297
- } else {
298
- block.visibleEval = this.context.parser.parse({
299
- input: block.visible,
300
- location: block.blockId,
301
- arrayIndices: this.arrayIndices
302
- }); // run parser on index combinations to get visible value object
303
- }
304
-
305
- if (beforeVisible !== block.visibleEval.output) {
306
- repeat = true;
307
- } // only evaluate visible blocks
308
-
309
-
310
- if (block.visibleEval.output !== false) {
311
- block.propertiesEval = this.context.parser.parse({
312
- input: block.properties,
313
- location: block.blockId,
314
- arrayIndices: this.arrayIndices
178
+ block.triggerEvent = block.Events.triggerEvent;
179
+ block.registerEvent = block.Events.registerEvent;
180
+ });
181
+ this.reset(initState); // set initial values to blocks.
182
+ }
183
+ reset(initWithState) {
184
+ const initState = serializer.copy(initWithState || this.context.state);
185
+ this.loopBlocks((block)=>{
186
+ block.update = true;
187
+ block.showValidation = false;
188
+ if (block.meta.category === 'input' || block.meta.category === 'list') {
189
+ let blockValue = get(initState, block.blockId);
190
+ if (type.isUndefined(blockValue)) {
191
+ // default null value for block type
192
+ blockValue = type.isUndefined(block.meta.initValue) ? type.enforceType(block.meta.valueType, null) : block.meta.initValue;
193
+ this.context._internal.State.set(block.blockId, blockValue);
194
+ }
195
+ if (block.meta.category === 'list') {
196
+ // load list value into list blocks
197
+ if (!type.isArray(this.subBlocks[block.id])) {
198
+ this.subBlocks[block.id] = [];
199
+ }
200
+ if (type.isArray(blockValue)) {
201
+ blockValue.forEach((item, i)=>{
202
+ if (!this.subBlocks[block.id][i]) {
203
+ this.subBlocks[block.id].push(this.newBlocks({
204
+ arrayIndices: this.arrayIndices.concat([
205
+ i
206
+ ]),
207
+ block,
208
+ initState
209
+ }));
210
+ } else {
211
+ this.subBlocks[block.id][i].reset(initState);
212
+ }
213
+ });
214
+ this.subBlocks[block.id].splice(blockValue.length);
215
+ }
216
+ } else {
217
+ block.value = blockValue;
218
+ }
219
+ } else if (block.meta.category === 'container') {
220
+ if (!type.isArray(this.subBlocks[block.id])) {
221
+ this.subBlocks[block.id] = [];
222
+ }
223
+ if (!this.subBlocks[block.id][0]) {
224
+ this.subBlocks[block.id].push(this.newBlocks({
225
+ arrayIndices: this.arrayIndices,
226
+ block,
227
+ initState
228
+ }));
229
+ } else {
230
+ this.subBlocks[block.id][0].reset(initState);
231
+ }
232
+ }
233
+ });
234
+ }
235
+ newBlocks({ arrayIndices, block, initState }) {
236
+ const SubBlocks = new Blocks({
237
+ arrayIndices,
238
+ areas: block.areas,
239
+ context: this.context
315
240
  });
316
- block.requiredEval = this.context.parser.parse({
317
- input: block.required,
318
- location: block.blockId,
319
- arrayIndices: this.arrayIndices
241
+ SubBlocks.init(initState);
242
+ return SubBlocks;
243
+ }
244
+ // used for update comparison
245
+ static blockEvalToString(block) {
246
+ return serializer.serializeToString({
247
+ areasLayoutEval: block.areasLayoutEval,
248
+ layoutEval: block.layoutEval,
249
+ loadingEval: block.loadingEval,
250
+ propertiesEval: block.propertiesEval,
251
+ requiredEval: block.requiredEval,
252
+ skeletonEval: block.skeletonEval,
253
+ styleEval: block.styleEval,
254
+ validationEval: block.validationEval,
255
+ value: block.value,
256
+ visibleEval: block.visibleEval
320
257
  });
321
- var requiredValidation = {
322
- pass: {
323
- _not: {
324
- _type: 'none'
258
+ }
259
+ recEval(visibleParent) {
260
+ let repeat = false;
261
+ this.loopBlocks((block)=>{
262
+ if (block.meta.category === 'input') {
263
+ const stateValue = get(this.context.state, block.blockId);
264
+ // TODO: related to #345
265
+ // enforce type here? should we reassign value here??
266
+ block.value = type.isUndefined(stateValue) ? block.value : stateValue;
325
267
  }
326
- },
327
- status: 'error',
328
- message: _helpers.type.isString(block.requiredEval.output) ? block.requiredEval.output : 'This field is required'
329
- };
330
- var validation = block.required === false ? block.validate : [requiredValidation, ...block.validate];
331
- block.validationEval = {
332
- output: {
333
- status: null,
334
- errors: [],
335
- warnings: []
336
- },
337
- errors: []
338
- };
339
- var validationError = false;
340
- var validationWarning = false;
341
- validation.forEach(test => {
342
- var parsed = this.context.parser.parse({
343
- input: test,
344
- location: block.blockId,
345
- arrayIndices: this.arrayIndices
346
- }); // for parser errors
347
-
348
- if (parsed.errors.length > 0) {
349
- block.validationEval.output.errors.push(parsed.output.message);
350
- block.validationEval.errors.push(parsed.errors);
351
- validationError = true;
352
- return;
353
- } // failed validation
354
-
355
-
356
- if (!parsed.output.pass) {
357
- // no status indication on validation tests defaults to error
358
- if (!test.status || test.status === 'error') {
359
- block.validationEval.output.errors.push(parsed.output.message);
360
- validationError = true;
268
+ const beforeVisible = block.visibleEval ? block.visibleEval.output : true;
269
+ if (visibleParent === false) {
270
+ block.visibleEval.output = false;
271
+ } else {
272
+ block.visibleEval = this.context._internal.parser.parse({
273
+ input: block.visible,
274
+ location: block.blockId,
275
+ arrayIndices: this.arrayIndices
276
+ }); // run parser on index combinations to get visible value object
361
277
  }
362
-
363
- if (test.status === 'warning') {
364
- block.validationEval.output.errors.push(parsed.output.message);
365
- validationWarning = true;
278
+ if (beforeVisible !== block.visibleEval.output) {
279
+ repeat = true;
280
+ }
281
+ // only evaluate visible blocks
282
+ if (block.visibleEval.output !== false) {
283
+ block.propertiesEval = this.context._internal.parser.parse({
284
+ input: block.properties,
285
+ location: block.blockId,
286
+ arrayIndices: this.arrayIndices
287
+ });
288
+ block.requiredEval = this.context._internal.parser.parse({
289
+ input: block.required,
290
+ location: block.blockId,
291
+ arrayIndices: this.arrayIndices
292
+ });
293
+ const requiredValidation = {
294
+ pass: {
295
+ _not: {
296
+ _type: 'none'
297
+ }
298
+ },
299
+ status: 'error',
300
+ message: type.isString(block.requiredEval.output) ? block.requiredEval.output : 'This field is required'
301
+ };
302
+ const validation = block.requiredEval.output === false ? block.validate : [
303
+ ...block.validate,
304
+ requiredValidation
305
+ ];
306
+ block.validationEval = {
307
+ output: {
308
+ status: null,
309
+ errors: [],
310
+ warnings: []
311
+ },
312
+ errors: []
313
+ };
314
+ let validationError = false;
315
+ let validationWarning = false;
316
+ validation.forEach((test)=>{
317
+ const parsed = this.context._internal.parser.parse({
318
+ input: test,
319
+ location: block.blockId,
320
+ arrayIndices: this.arrayIndices
321
+ });
322
+ // for parser errors
323
+ if (parsed.errors.length > 0) {
324
+ block.validationEval.output.errors.push(parsed.output.message);
325
+ block.validationEval.errors.push(parsed.errors);
326
+ validationError = true;
327
+ return;
328
+ }
329
+ // failed validation
330
+ if (!parsed.output.pass) {
331
+ // no status indication on validation tests defaults to error
332
+ if (!test.status || test.status === 'error') {
333
+ block.validationEval.output.errors.push(parsed.output.message);
334
+ validationError = true;
335
+ }
336
+ if (test.status === 'warning') {
337
+ block.validationEval.output.warnings.push(parsed.output.message);
338
+ validationWarning = true;
339
+ }
340
+ }
341
+ });
342
+ if (validation.length > 0) {
343
+ block.validationEval.output.status = 'success';
344
+ }
345
+ if (validationWarning) {
346
+ block.validationEval.output.status = 'warning';
347
+ }
348
+ if (validationError && block.showValidation) {
349
+ block.validationEval.output.status = 'error';
350
+ }
351
+ block.styleEval = this.context._internal.parser.parse({
352
+ input: block.style,
353
+ location: block.blockId,
354
+ arrayIndices: this.arrayIndices
355
+ });
356
+ block.layoutEval = this.context._internal.parser.parse({
357
+ input: block.layout,
358
+ location: block.blockId,
359
+ arrayIndices: this.arrayIndices
360
+ });
361
+ block.loadingEval = this.context._internal.parser.parse({
362
+ input: block.loading,
363
+ location: block.blockId,
364
+ arrayIndices: this.arrayIndices
365
+ });
366
+ block.skeletonEval = this.context._internal.parser.parse({
367
+ input: block.skeleton,
368
+ location: block.blockId,
369
+ arrayIndices: this.arrayIndices
370
+ });
371
+ block.areasLayoutEval = this.context._internal.parser.parse({
372
+ input: block.areasLayout,
373
+ location: block.blockId,
374
+ arrayIndices: this.arrayIndices
375
+ });
376
+ }
377
+ if (block.meta.category === 'container' || block.meta.category === 'list') {
378
+ if (this.subBlocks[block.id] && this.subBlocks[block.id].length > 0) {
379
+ this.subBlocks[block.id].forEach((blockClass)=>{
380
+ repeat = blockClass.recEval(block.visibleEval.output) || repeat;
381
+ });
382
+ }
383
+ }
384
+ const after = Blocks.blockEvalToString(block);
385
+ if (block.before !== after) {
386
+ block.update = true;
387
+ block.before = after;
366
388
  }
367
- }
368
389
  });
369
-
370
- if (this.context.showValidationErrors && validation.length > 0) {
371
- block.validationEval.output.status = 'success';
372
- }
373
-
374
- if (validationWarning) {
375
- block.validationEval.output.status = 'warning';
376
- }
377
-
378
- if (this.context.showValidationErrors && validationError) {
379
- block.validationEval.output.status = 'error';
380
- }
381
-
382
- block.styleEval = this.context.parser.parse({
383
- input: block.style,
384
- location: block.blockId,
385
- arrayIndices: this.arrayIndices
390
+ return repeat;
391
+ }
392
+ updateState() {
393
+ const toSet = new Set();
394
+ const toDelete = new Set();
395
+ this.loopBlocks((block)=>{
396
+ if (block.visibleEval.output !== false) {
397
+ if (block.meta.category === 'container' || block.meta.category === 'list') {
398
+ if (this.subBlocks[block.id] && this.subBlocks[block.id].length > 0) {
399
+ this.subBlocks[block.id].forEach((blockClass)=>{
400
+ blockClass.updateState();
401
+ });
402
+ } else {
403
+ toSet.add(block.blockId);
404
+ this.context._internal.State.set(block.blockId, type.enforceType(block.meta.valueType, null));
405
+ }
406
+ } else if (block.meta.category === 'input') {
407
+ toSet.add(block.blockId);
408
+ this.context._internal.State.set(block.blockId, block.value);
409
+ }
410
+ } else if (block.meta.category === 'container') {
411
+ this.subBlocks[block.id].forEach((blockClass)=>{
412
+ blockClass.recContainerDelState(toDelete);
413
+ });
414
+ } else {
415
+ toDelete.add(block.blockId);
416
+ }
386
417
  });
387
- block.layoutEval = this.context.parser.parse({
388
- input: block.layout,
389
- location: block.blockId,
390
- arrayIndices: this.arrayIndices
418
+ toDelete.forEach((field)=>{
419
+ if (!toSet.has(field)) {
420
+ this.context._internal.State.del(field);
421
+ }
391
422
  });
392
- block.areasLayoutEval = this.context.parser.parse({
393
- input: block.areasLayout,
394
- location: block.blockId,
395
- arrayIndices: this.arrayIndices
423
+ }
424
+ recContainerDelState(toDelete) {
425
+ this.loopBlocks((block)=>{
426
+ if (block.meta.category === 'container') {
427
+ this.subBlocks[block.id].forEach((blockClass)=>{
428
+ blockClass.recContainerDelState(toDelete);
429
+ });
430
+ } else {
431
+ toDelete.add(block.blockId);
432
+ }
396
433
  });
397
- }
398
-
399
- if ((0, _helpers.get)(block, 'meta.category') === 'container' || (0, _helpers.get)(block, 'meta.category') === 'context' || (0, _helpers.get)(block, 'meta.category') === 'list') {
400
- if (this.subBlocks[block.id] && this.subBlocks[block.id].length > 0) {
401
- this.subBlocks[block.id].forEach(blockClass => {
402
- repeat = blockClass.recEval(block.visibleEval.output) || repeat;
403
- });
434
+ }
435
+ updateStateFromRoot() {
436
+ const repeat = this.recEval(true);
437
+ this.updateState();
438
+ if (repeat && this.recCount < 20) {
439
+ this.recCount += 1;
440
+ this.updateStateFromRoot();
404
441
  }
405
- }
406
-
407
- var after = Blocks.blockEvalToString(block);
408
-
409
- if (block.before !== after) {
410
- block.update = true;
411
- block.before = after;
412
- }
413
- });
414
- return repeat;
415
- }
416
-
417
- updateState() {
418
- var toSet = new Set();
419
- var toDelete = new Set();
420
- this.loopBlocks(block => {
421
- if (block.visibleEval.output !== false) {
422
- if ((0, _helpers.get)(block, 'meta.category') === 'container' || (0, _helpers.get)(block, 'meta.category') === 'context' || (0, _helpers.get)(block, 'meta.category') === 'list') {
423
- if (this.subBlocks[block.id] && this.subBlocks[block.id].length > 0) {
424
- this.subBlocks[block.id].forEach(blockClass => {
425
- blockClass.updateState();
442
+ this.recCount = 0;
443
+ }
444
+ recUpdateArrayIndices(oldIndices, newIndices) {
445
+ newIndices.forEach((index, i)=>{
446
+ this.arrayIndices[i] = newIndices[i];
447
+ });
448
+ this.loopBlocks((block)=>{
449
+ block.blockId = applyArrayIndices(this.arrayIndices, block.blockIdPattern);
450
+ this.context._internal.RootBlocks.map[block.blockId] = block;
451
+ });
452
+ Object.keys(this.subBlocks).forEach((subKey)=>{
453
+ this.subBlocks[subKey].forEach((subBlock)=>{
454
+ subBlock.recUpdateArrayIndices(oldIndices, newIndices);
426
455
  });
427
- } else {
428
- toSet.add(block.field);
429
- this.context.State.set(block.field, _helpers.type.enforceType(block.meta.valueType, null));
430
- }
431
- } else if ((0, _helpers.get)(block, 'meta.category') === 'input') {
432
- toSet.add(block.field);
433
- this.context.State.set(block.field, block.value);
434
- }
435
- } else if ((0, _helpers.get)(block, 'meta.category') === 'container' || (0, _helpers.get)(block, 'meta.category') === 'context') {
436
- this.subBlocks[block.id].forEach(blockClass => {
437
- blockClass.recContainerDelState(toDelete);
438
456
  });
439
- } else {
440
- toDelete.add(block.field);
441
- }
442
- });
443
- toDelete.forEach(field => {
444
- if (!toSet.has(field)) {
445
- this.context.State.del(field);
446
- }
447
- });
448
- }
449
-
450
- recContainerDelState(toDelete) {
451
- this.loopBlocks(block => {
452
- if ((0, _helpers.get)(block, 'meta.category') === 'container' || (0, _helpers.get)(block, 'meta.category') === 'context') {
453
- this.subBlocks[block.id].forEach(blockClass => {
454
- blockClass.recContainerDelState(toDelete);
457
+ }
458
+ getValidateRec(match, result) {
459
+ this.loopBlocks((block)=>{
460
+ if (match(block.blockId)) {
461
+ block.showValidation = true;
462
+ block.update = true;
463
+ if (block.visibleEval.output !== false && block.validationEval.output && block.validationEval.output.errors.length > 0) {
464
+ block.validationEval.output.status = 'error';
465
+ result.push({
466
+ blockId: block.blockId,
467
+ validation: block.validationEval.output
468
+ });
469
+ }
470
+ }
455
471
  });
456
- } else {
457
- toDelete.add(block.field);
458
- }
459
- });
460
- }
461
-
462
- updateStateFromRoot() {
463
- var repeat = this.recEval(true);
464
- this.updateState();
465
-
466
- if (repeat && this.recCount < 20) {
467
- this.recCount += 1;
468
- this.updateStateFromRoot();
472
+ Object.keys(this.subBlocks).forEach((subKey)=>{
473
+ this.subBlocks[subKey].forEach((subBlock)=>{
474
+ subBlock.getValidateRec(match, result);
475
+ });
476
+ });
477
+ return result;
469
478
  }
470
-
471
- this.recCount = 0;
472
- }
473
-
474
- recUpdateArrayIndices(oldIndices, newIndices) {
475
- newIndices.forEach((index, i) => {
476
- this.arrayIndices[i] = newIndices[i];
477
- });
478
- this.loopBlocks(block => {
479
- block.blockId = (0, _helpers.applyArrayIndices)(this.arrayIndices, block.blockIdPattern);
480
- this.context.RootBlocks.map[block.blockId] = block;
481
- block.field = !_helpers.type.isNone(block.fieldPattern) ? (0, _helpers.applyArrayIndices)(this.arrayIndices, block.fieldPattern) : block.blockId;
482
- });
483
- Object.keys(this.subBlocks).forEach(subKey => {
484
- this.subBlocks[subKey].forEach(subBlock => {
485
- subBlock.recUpdateArrayIndices(oldIndices, newIndices);
486
- });
487
- });
488
- }
489
-
490
- getValidateRec(result) {
491
- this.loopBlocks(block => {
492
- if (block.visibleEval.output && block.validationEval.output.status === 'error') {
493
- result.push({
494
- blockId: block.blockId,
495
- validation: block.validationEval.output
479
+ recSetUndefined() {
480
+ this.loopBlocks((block)=>{
481
+ this.context._internal.State.set(block.blockId, undefined);
496
482
  });
497
- }
498
- });
499
- Object.keys(this.subBlocks).forEach(subKey => {
500
- this.subBlocks[subKey].forEach(subBlock => {
501
- subBlock.getValidateRec(result);
502
- });
503
- });
504
- return result;
505
- }
506
-
507
- recSetUndefined() {
508
- this.loopBlocks(block => {
509
- this.context.State.set(block.field, undefined);
510
- });
511
- Object.keys(this.subBlocks).forEach(subKey => {
512
- this.subBlocks[subKey].forEach(subBlock => {
513
- subBlock.recSetUndefined();
514
- });
515
- });
516
- }
517
-
518
- recRemoveBlocksFromMap() {
519
- this.loopBlocks(block => {
520
- delete this.context.RootBlocks.map[block.blockId];
521
- });
522
- Object.keys(this.subBlocks).forEach(subKey => {
523
- this.subBlocks[subKey].forEach(subBlock => {
524
- subBlock.recRemoveBlocksFromMap();
525
- });
526
- });
527
- }
528
-
529
- validate() {
530
- this.update(); // update to recalculate validationEval with showValidationErrors set to raise block errors
531
-
532
- return this.getValidateRec([]);
533
- }
534
-
535
- update() {
536
- this.updateStateFromRoot(); // update all the blocks
537
-
538
- this.setBlocksCache(); // finally update cache
539
- }
540
-
541
- setBlocksCache() {
542
- this.loopBlocks(block => {
543
- if (block.update) {
544
- block.update = false;
545
- block.loading = block.requestKeys.reduce((acc, key) => acc || (this.context.requests[key] ? this.context.requests[key].loading : true), false);
546
- block.eval = {
547
- areas: block.areasLayoutEval.output,
548
- actions: _helpers.type.isNone(block.BlockActions.actions) ? null : block.BlockActions.actions,
549
- properties: block.propertiesEval.output,
550
- required: block.requiredEval.output,
551
- layout: block.layoutEval.output,
552
- style: block.styleEval.output,
553
- validation: block.validationEval.output,
554
- value: _helpers.type.isNone(block.value) ? null : block.value,
555
- visible: block.visibleEval.output
556
- };
557
- this.context.updateBlock(block.id);
558
- }
559
- });
560
- Object.keys(this.subBlocks).forEach(subKey => {
561
- this.subBlocks[subKey].forEach(subBlock => {
562
- subBlock.setBlocksCache();
563
- });
564
- });
565
- }
566
-
567
- setBlocksLoadingCache() {
568
- this.loopBlocks(block => {
569
- block.loading_prev = block.loading;
570
- block.loading = block.requestKeys.reduce((acc, key) => acc || (this.context.requests[key] ? this.context.requests[key].loading : true), false);
571
-
572
- if (block.loading_prev !== block.loading) {
573
- this.context.updateBlock(block.id);
574
- }
575
- });
576
- Object.keys(this.subBlocks).forEach(subKey => {
577
- this.subBlocks[subKey].forEach(subBlock => {
578
- subBlock.setBlocksLoadingCache();
579
- });
580
- });
581
- }
582
-
583
- generateBlockId(blockIdPattern) {
584
- return "".concat(this.context.pageId, ":").concat(blockIdPattern, ":").concat(Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5));
585
- }
586
-
587
- }
588
-
589
- var _default = Blocks;
590
- exports.default = _default;
483
+ Object.keys(this.subBlocks).forEach((subKey)=>{
484
+ this.subBlocks[subKey].forEach((subBlock)=>{
485
+ subBlock.recSetUndefined();
486
+ });
487
+ });
488
+ }
489
+ recRemoveBlocksFromMap() {
490
+ this.loopBlocks((block)=>{
491
+ delete this.context._internal.RootBlocks.map[block.blockId];
492
+ });
493
+ Object.keys(this.subBlocks).forEach((subKey)=>{
494
+ this.subBlocks[subKey].forEach((subBlock)=>{
495
+ subBlock.recRemoveBlocksFromMap();
496
+ });
497
+ });
498
+ }
499
+ validate(match) {
500
+ this.updateStateFromRoot(); // update to recalculate validationEval to raise block errors
501
+ const validationErrors = this.getValidateRec(match, []); // get all relevant raised block errors and set showValidation
502
+ this.setBlocksCache(); // update cache to render
503
+ return validationErrors;
504
+ }
505
+ resetValidationRec(match) {
506
+ this.loopBlocks((block)=>{
507
+ if (match(block.blockId)) {
508
+ block.showValidation = false;
509
+ block.update = true;
510
+ }
511
+ });
512
+ Object.keys(this.subBlocks).forEach((subKey)=>{
513
+ this.subBlocks[subKey].forEach((subBlock)=>{
514
+ subBlock.resetValidationRec(match);
515
+ });
516
+ });
517
+ }
518
+ resetValidation(match) {
519
+ this.resetValidationRec(match);
520
+ this.setBlocksCache();
521
+ }
522
+ update() {
523
+ this.updateStateFromRoot(); // update all the blocks
524
+ this.setBlocksCache(); // finally update cache
525
+ }
526
+ setBlocksCache() {
527
+ this.loopBlocks((block)=>{
528
+ if (block.update) {
529
+ block.update = false;
530
+ block.eval = {
531
+ areas: block.areasLayoutEval.output,
532
+ events: type.isNone(block.Events.events) ? null : block.Events.events,
533
+ properties: block.propertiesEval.output,
534
+ loading: block.loadingEval.output,
535
+ skeleton: block.skeletonEval.output,
536
+ required: block.requiredEval.output,
537
+ layout: block.layoutEval.output,
538
+ style: block.styleEval.output,
539
+ validation: {
540
+ ...block.validationEval.output || {},
541
+ status: block.showValidation || block.validationEval.output?.status === 'warning' ? block.validationEval.output?.status : null
542
+ },
543
+ value: type.isNone(block.value) ? null : block.value,
544
+ visible: block.visibleEval.output
545
+ };
546
+ this.context._internal.lowdefy._internal.updateBlock(block.id);
547
+ }
548
+ });
549
+ Object.keys(this.subBlocks).forEach((subKey)=>{
550
+ this.subBlocks[subKey].forEach((subBlock)=>{
551
+ subBlock.setBlocksCache();
552
+ });
553
+ });
554
+ }
555
+ constructor({ arrayIndices = [], areas, context }){
556
+ this.id = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 5);
557
+ this.areas = serializer.copy(areas || []);
558
+ this.arrayIndices = arrayIndices;
559
+ this.context = context;
560
+ this.map = {};
561
+ this.recCount = 0;
562
+ this.subBlocks = {};
563
+ this.getValidateRec = this.getValidateRec.bind(this);
564
+ this.init = this.init.bind(this);
565
+ this.newBlocks = this.newBlocks.bind(this);
566
+ this.recContainerDelState = this.recContainerDelState.bind(this);
567
+ this.recEval = this.recEval.bind(this);
568
+ this.recRemoveBlocksFromMap = this.recRemoveBlocksFromMap.bind(this);
569
+ this.recSetUndefined = this.recSetUndefined.bind(this);
570
+ this.recUpdateArrayIndices = this.recUpdateArrayIndices.bind(this);
571
+ this.reset = this.reset.bind(this);
572
+ this.resetValidation = this.resetValidation.bind(this);
573
+ this.resetValidationRec = this.resetValidationRec.bind(this);
574
+ this.setBlocksCache = this.setBlocksCache.bind(this);
575
+ this.update = this.update.bind(this);
576
+ this.updateState = this.updateState.bind(this);
577
+ this.updateStateFromRoot = this.updateStateFromRoot.bind(this);
578
+ this.validate = this.validate.bind(this);
579
+ }
580
+ };
581
+ export default Blocks;