@lvce-editor/renderer-process 21.13.0 → 21.15.0

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.
@@ -180,6 +180,13 @@ const downloadFile = (fileName, url) => {
180
180
  a.click();
181
181
  };
182
182
 
183
+ const instances = Object.create(null);
184
+ const get$1$1 = viewletId => {
185
+ return instances[viewletId];
186
+ };
187
+ const set$1$1 = (viewletId, instance) => {
188
+ instances[viewletId] = instance;
189
+ };
183
190
  const Audio$2 = 'audio';
184
191
  const Button$2 = 'button';
185
192
  const Col$2 = 'col';
@@ -419,13 +426,6 @@ const ElementTagMap = {
419
426
  const {
420
427
  getElementTag
421
428
  } = ElementTagMap;
422
- const instances = Object.create(null);
423
- const get$1$1 = viewletId => {
424
- return instances[viewletId];
425
- };
426
- const set$1$1 = (viewletId, instance) => {
427
- instances[viewletId] = instance;
428
- };
429
429
  const getEventListenerOptions$1 = (eventName, value) => {
430
430
  if (value.passive) {
431
431
  return {
@@ -750,6 +750,7 @@ const NavigateChild = 7;
750
750
  const NavigateParent = 8;
751
751
  const RemoveChild = 9;
752
752
  const NavigateSibling = 10;
753
+ const SetReferenceNodeUid = 11;
753
754
  const dragInfos = Object.create(null);
754
755
  const setDragInfo = (id, data) => {
755
756
  dragInfos[id] = data;
@@ -1088,6 +1089,23 @@ const applyPatch = ($Element, patches, eventMap = {}, id = 0) => {
1088
1089
  case SetAttribute:
1089
1090
  setProp($Current, patch.key, patch.value, events);
1090
1091
  break;
1092
+ case SetReferenceNodeUid:
1093
+ {
1094
+ // Get the new reference node instance
1095
+ const instance = get$1$1(patch.uid);
1096
+ if (!instance || !instance.state) {
1097
+ console.error('Cannot set reference node uid: instance not found', {
1098
+ uid: patch.uid
1099
+ });
1100
+ return;
1101
+ }
1102
+ const $NewNode = instance.state.$Viewlet;
1103
+ // Replace the current reference node with the new viewlet
1104
+ // @ts-ignore
1105
+ $Current.replaceWith($NewNode);
1106
+ $Current = $NewNode;
1107
+ break;
1108
+ }
1091
1109
  case SetText:
1092
1110
  setText$3($Current, patch.value);
1093
1111
  break;
@@ -9242,7 +9260,8 @@ const move = async (uid, selector, target) => {
9242
9260
  throw new Error(`Source element not found: ${selector}`);
9243
9261
  }
9244
9262
  const $Target = await waitForElement(target);
9245
- $Target.append($Source);
9263
+ // @ts-ignore
9264
+ $Target.moveBefore($Source, null);
9246
9265
  };
9247
9266
 
9248
9267
  // TODO this code is bad
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "21.13.0",
3
+ "version": "21.15.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"