@builder.io/mitosis 0.0.56-58 → 0.0.56-59
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.
|
@@ -35,6 +35,7 @@ var map_refs_1 = require("../../helpers/map-refs");
|
|
|
35
35
|
var dash_case_1 = require("../../helpers/dash-case");
|
|
36
36
|
var has_props_1 = require("../../helpers/has-props");
|
|
37
37
|
var get_refs_1 = require("../../helpers/get-refs");
|
|
38
|
+
var lodash_1 = require("lodash");
|
|
38
39
|
// Having issues with this, so off for now
|
|
39
40
|
var USE_MARKO_PRETTIER = false;
|
|
40
41
|
/**
|
|
@@ -97,7 +98,7 @@ var blockToMarko = function (json, options) {
|
|
|
97
98
|
continue;
|
|
98
99
|
}
|
|
99
100
|
if (key === 'ref') {
|
|
100
|
-
str += " key=\"".concat(code, "\" ");
|
|
101
|
+
str += " key=\"".concat((0, lodash_1.camelCase)(code), "\" ");
|
|
101
102
|
}
|
|
102
103
|
else if (key.startsWith('on')) {
|
|
103
104
|
var useKey = key === 'onChange' && json.name === 'input' ? 'onInput' : key;
|
|
@@ -147,7 +148,7 @@ var componentToMarko = function (userOptions) {
|
|
|
147
148
|
}
|
|
148
149
|
var css = (0, collect_css_1.collectCss)(json);
|
|
149
150
|
var domRefs = (0, get_refs_1.getRefs)(json);
|
|
150
|
-
(0, map_refs_1.mapRefs)(json, function (refName) { return "this.".concat(refName); });
|
|
151
|
+
(0, map_refs_1.mapRefs)(json, function (refName) { return "this.".concat((0, lodash_1.camelCase)(refName)); });
|
|
151
152
|
if (options.plugins) {
|
|
152
153
|
json = (0, plugins_1.runPostJsonPlugins)(json, options.plugins);
|
|
153
154
|
}
|
|
@@ -182,14 +183,16 @@ var componentToMarko = function (userOptions) {
|
|
|
182
183
|
var jsString = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n\n class {\n ", "\n\n ", "\n\n ", "\n \n ", "\n ", "\n ", "\n }\n "], ["\n ", "\n\n class {\n ", "\n\n ", "\n\n ", "\n \n ", "\n ", "\n ", "\n }\n "])), (0, render_imports_1.renderPreComponent)({ component: json, target: 'marko' }), methodsString, !hasState
|
|
183
184
|
? ''
|
|
184
185
|
: "onCreate(".concat(thisHasProps ? 'input' : '', ") {\n this.state = ").concat(dataString, "\n }"), Array.from(domRefs)
|
|
185
|
-
.map(function (refName) { return "get ".concat(refName, "() { \n return this.getEl('").concat(refName, "')\n }"); })
|
|
186
|
+
.map(function (refName) { return "get ".concat((0, lodash_1.camelCase)(refName), "() { \n return this.getEl('").concat((0, lodash_1.camelCase)(refName), "')\n }"); })
|
|
186
187
|
.join('\n'), !((_b = json.hooks.onMount) === null || _b === void 0 ? void 0 : _b.code)
|
|
187
188
|
? ''
|
|
188
189
|
: "onMount() { ".concat(processBinding(json, json.hooks.onMount.code, 'class'), " }"), !((_c = json.hooks.onUnMount) === null || _c === void 0 ? void 0 : _c.code)
|
|
189
190
|
? ''
|
|
190
191
|
: "onDestroy() { ".concat(processBinding(json, json.hooks.onUnMount.code, 'class'), " }"), !((_d = json.hooks.onUpdate) === null || _d === void 0 ? void 0 : _d.length)
|
|
191
192
|
? ''
|
|
192
|
-
:
|
|
193
|
+
: "onRender() { ".concat(json.hooks.onUpdate
|
|
194
|
+
.map(function (hook) { return processBinding(json, hook.code, 'class'); })
|
|
195
|
+
.join('\n\n'), " }"));
|
|
193
196
|
var htmlString = json.children.map(function (item) { return blockToMarko(item, options); }).join('\n');
|
|
194
197
|
var cssString = css.length
|
|
195
198
|
? "style { \n ".concat((0, indent_1.indent)(css, 2).trim(), "\n}")
|