publ-echo-test 0.0.79 → 0.0.81

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.
@@ -42,7 +42,7 @@ export type BulkBlockInternal = {
42
42
  };
43
43
  export declare const findBlockByBlockId: (blocks: Block[], blockId: string) => Block | null;
44
44
  export declare const findChildrenComponentIds: (blockStructure: Block[], targetId: string) => string[];
45
- export declare const findAllChildrenIds: (blockStructure: Block[], targetId: string) => string[];
45
+ export declare const findAllChildrenIds: (blockStructure: Block[], targetId: string, depth?: 'current' | 'deep') => string[];
46
46
  export declare const findAllChildrenComponentIds: (blockStructure: Block[], targetId: string) => number[];
47
47
  export declare const findAllParentGroups: (blockStructure: Block[], targetId: string) => GroupBlock[];
48
48
  export declare const findGroupBlocks: (blockStructure: Block[], targetId: string) => GroupBlock[];
@@ -58,14 +58,17 @@ export var findChildrenComponentIds = function (blockStructure, targetId) {
58
58
  var blockCBChildren = targetBlock.children.filter(function (child) { return child.type === 'COMPONENT_BLOCK'; });
59
59
  return blockCBChildren.map(function (cb) { return cb.componentBlockId.toString(); });
60
60
  };
61
- export var findAllChildrenIds = function (blockStructure, targetId) {
61
+ export var findAllChildrenIds = function (blockStructure, targetId, depth) {
62
+ if (depth === void 0) { depth = 'deep'; }
62
63
  var collectChildrenIds = function (block) {
63
64
  var ids = [];
64
65
  if ('children' in block && block.children) {
65
66
  for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
66
67
  var child = _a[_i];
67
68
  ids.push(child.blockId);
68
- ids = ids.concat(collectChildrenIds(child));
69
+ if (depth === 'deep') {
70
+ ids = ids.concat(collectChildrenIds(child));
71
+ }
69
72
  }
70
73
  }
71
74
  return ids;
@@ -202,7 +205,10 @@ export var addBulkToTarget = function (blockStructure, targetId, bulkIds // comp
202
205
  return false;
203
206
  });
204
207
  if (bulkBlocks.length !== bulkIds.length) {
205
- throw new Error("Some bulkIds do not exist as children of the target block.");
208
+ window.alert('Some bulkIds do not exist as children of the target block.');
209
+ console.log('bulkBLocks: ', bulkBlocks);
210
+ console.log('bulkIds: ', bulkIds);
211
+ return blockStructure;
206
212
  }
207
213
  if (bulkBlocks.length === 0) {
208
214
  return blockStructure;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.79",
3
+ "version": "0.0.81",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",
@@ -52,5 +52,8 @@
52
52
  "styled-components": "^5.3.10",
53
53
  "typescript": "^5.1.6",
54
54
  "web-vitals": "^2.1.4"
55
+ },
56
+ "dependencies": {
57
+ "build-lib": "^1.0.0"
55
58
  }
56
59
  }