publ-echo-test 0.0.121 → 0.0.124

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.
@@ -46,7 +46,7 @@ export declare const findDirectChildrenCbIds: (block: Block, targetId: string) =
46
46
  export declare const findAllChildrenCbIds: (block: Block, targetId: string) => number[];
47
47
  export declare const findAllChildrenBlockIds: (block: Block, targetId: string) => string[];
48
48
  export declare const findDirectChildrenBlockIds: (block: Block, targetId: string) => string[];
49
- export declare const findGroupBlocks: (blockStructure: Block, targetId: string) => GroupBlock[];
49
+ export declare const findGroupBlocks: (block: Block, targetId: string) => GroupBlock[];
50
50
  export declare const addBulkToTarget: (block: Block, targetId: string, bulkBlockIds: string[]) => Block;
51
51
  export declare const getBlockWorkDirPath: (block: Block, blockId: string) => string | null;
52
52
  export declare function formatBlockIdToCbId(blockId: string): number | null;
@@ -56,6 +56,9 @@ export var findBlockByBlockId = function (block, blockId) {
56
56
  if (block.type !== 'GROUP_BLOCK' || block.children.length === 0) {
57
57
  return null;
58
58
  }
59
+ if (block.blockId === 'ROOT' && blockId === 'ROOT') {
60
+ return block;
61
+ }
59
62
  for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
60
63
  var child = _a[_i];
61
64
  if (child.blockId === blockId) {
@@ -98,36 +101,41 @@ export var findDirectChildrenBlockIds = function (block, targetId) {
98
101
  }
99
102
  return collectChildrenBlockIds(targetBlock, 'current');
100
103
  };
101
- export var findGroupBlocks = function (blockStructure, targetId) {
102
- var targetBlock = findBlockByBlockId(blockStructure, targetId);
103
- var groupBlocks = [];
104
- if (targetBlock && targetBlock.blockId === 'ROOT') {
105
- if ('children' in targetBlock) {
106
- groupBlocks.push.apply(groupBlocks, targetBlock.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
107
- // Include BULK children if present
108
- var bulkBlocks = targetBlock.children.filter(function (child) { return child.blockId === 'BULK'; });
109
- bulkBlocks.forEach(function (bulk) {
110
- if ('children' in bulk && bulk.children) {
111
- groupBlocks.push.apply(groupBlocks, bulk.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
112
- }
113
- });
114
- return groupBlocks;
115
- }
104
+ export var findGroupBlocks = function (block, targetId) {
105
+ var targetBlock = findBlockByBlockId(block, targetId);
106
+ // const groupBlocks: Set<GroupBlock> = new Set();
107
+ if (!targetBlock) {
108
+ console.error('Target block not found');
109
+ return [];
116
110
  }
117
- if (targetBlock && targetBlock.type === 'GROUP_BLOCK') {
118
- groupBlocks.push(targetBlock);
119
- if (targetBlock.children) {
120
- groupBlocks.push.apply(groupBlocks, targetBlock.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
121
- // Include BULK children if present
122
- var bulkBlocks = targetBlock.children.filter(function (child) { return child.blockId === 'BULK'; });
123
- bulkBlocks.forEach(function (bulk) {
124
- if ('children' in bulk && bulk.children) {
125
- groupBlocks.push.apply(groupBlocks, bulk.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; }));
126
- }
127
- });
128
- }
111
+ // const addGroupBlocks = (block: GroupBlock | BulkBlockInternal) => {
112
+ // block.children.forEach(child => {
113
+ // if (child.type === 'GROUP_BLOCK') {
114
+ // groupBlocks.add(child as GroupBlock);
115
+ // }
116
+ // });
117
+ // };
118
+ if (targetBlock.type !== 'GROUP_BLOCK') {
119
+ console.error('Target block is not a group block');
120
+ return [];
129
121
  }
122
+ var groupBlocks = targetBlock.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; });
130
123
  return groupBlocks;
124
+ // if (targetBlock.blockId === 'ROOT') {
125
+ // addGroupBlocks(targetBlock as RootBlock);
126
+ // }
127
+ // if (targetBlock.type === 'GROUP_BLOCK') {
128
+ // groupBlocks.add(targetBlock as GroupBlock);
129
+ // addGroupBlocks(targetBlock);
130
+ // }
131
+ // // Handle BULK blocks
132
+ // if (targetBlock.type === 'GROUP_BLOCK') {
133
+ // const bulkBlocks = targetBlock.children.filter(child => child.blockId === 'BULK') as BulkBlockInternal[];
134
+ // bulkBlocks.forEach(bulk => {
135
+ // addGroupBlocks(bulk);
136
+ // });
137
+ // }
138
+ // return Array.from(groupBlocks); // Convert Set back to array
131
139
  };
132
140
  // export const findAllComponentBlockIds = (blockStructure: Block[]): number[] => {
133
141
  // const collectComponentBlockIds = (blocks: Block[]): number[] => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.121",
3
+ "version": "0.0.124",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",