native-document 1.0.59 → 1.0.61

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -8,7 +8,6 @@ const ComponentRegistry = (function() {
8
8
 
9
9
  return function(...args) {
10
10
  const firstParam = args[0];
11
- console.log( args)
12
11
  if(firstParam?.__instance) {
13
12
  const instance = firstParam.__instance;
14
13
  const newInstance = factory(...instance.context.args, instance);
@@ -57,7 +57,7 @@ function transformObservableDeclarations(code) {
57
57
 
58
58
  return code.replace(regex, (match, varName, caller, method) => {
59
59
  const obsName = method ? `${caller}${method}` : 'Observable';
60
- return `console.log(arguments); const ${varName} = ${obsName}('${varName}', arguments[arguments.length - 1], `;
60
+ return `const ${varName} = ${obsName}('${varName}', arguments[arguments.length - 1], `;
61
61
  });
62
62
  }
63
63
 
@@ -118,7 +118,7 @@ export default function transformComponent(id, code, options) {
118
118
  id
119
119
  });
120
120
 
121
- s.prepend('import ComponentRegistry from "native-document/src/hrm/ComponentRegistry";');
121
+ s.prepend('import ComponentRegistry from "native-document/src/devtools/hrm/ComponentRegistry";');
122
122
  s.append(`export default ComponentRegistry.register('${id}', ${hrmComponentName}, { preserveState: ${options.preserveState} });`);
123
123
  s.append(hrmHookTemplateFormatted);
124
124
 
@@ -93,16 +93,17 @@ export default function Anchor(name, isUniqueChild = false) {
93
93
  };
94
94
 
95
95
  element.replaceContent = function(child) {
96
+ const childElement = Validator.isElement(child) ? child : ElementCreator.getChild(child);
96
97
  const parent = anchorEnd.parentNode;
97
98
  if(!parent) {
98
99
  return;
99
100
  }
100
101
  if(isParentUniqueChild(parent)) {
101
- parent.replaceChildren(anchorStart, child, anchorEnd);
102
+ parent.replaceChildren(anchorStart, childElement, anchorEnd);
102
103
  return;
103
104
  }
104
105
  element.removeChildren();
105
- parent.insertBefore(child, anchorEnd);
106
+ parent.insertBefore(childElement, anchorEnd);
106
107
  };
107
108
 
108
109
  element.setContent = element.replaceContent;