@builder.io/mitosis 0.0.96 → 0.0.97
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/dist/src/generators/angular.js +3 -2
- package/dist/src/generators/builder.js +3 -3
- package/dist/src/generators/lit/generate.js +2 -5
- package/dist/src/generators/marko/generate.js +2 -2
- package/dist/src/generators/mitosis.js +2 -2
- package/dist/src/generators/qwik/component-generator.js +34 -17
- package/dist/src/generators/qwik/component.js +17 -6
- package/dist/src/generators/qwik/directives.d.ts +0 -8
- package/dist/src/generators/qwik/directives.js +35 -7
- package/dist/src/generators/qwik/helpers/state.d.ts +5 -1
- package/dist/src/generators/qwik/helpers/state.js +5 -10
- package/dist/src/generators/qwik/jsx.d.ts +2 -1
- package/dist/src/generators/qwik/jsx.js +21 -11
- package/dist/src/generators/qwik/src-generator.d.ts +1 -1
- package/dist/src/generators/qwik/src-generator.js +2 -2
- package/dist/src/generators/react/blocks.js +10 -2
- package/dist/src/generators/react/generator.js +3 -3
- package/dist/src/generators/solid/index.js +3 -2
- package/dist/src/generators/solid/state/helpers.js +20 -25
- package/dist/src/generators/stencil/generate.js +2 -5
- package/dist/src/generators/svelte/svelte.js +6 -3
- package/dist/src/generators/swift-ui.js +2 -2
- package/dist/src/generators/template.js +2 -5
- package/dist/src/generators/vue/compositionApi.js +2 -2
- package/dist/src/generators/vue/helpers.js +30 -47
- package/dist/src/generators/vue/optionsApi.js +2 -2
- package/dist/src/generators/vue/types.d.ts +1 -0
- package/dist/src/generators/vue/vue.js +10 -4
- package/dist/src/helpers/dedent.d.ts +1 -0
- package/dist/src/helpers/dedent.js +87 -0
- package/dist/src/helpers/is-root-text-node.d.ts +1 -1
- package/dist/src/helpers/plugins/process-code.d.ts +1 -1
- package/dist/src/helpers/plugins/process-code.js +1 -0
- package/dist/src/helpers/replace-identifiers.d.ts +2 -0
- package/dist/src/helpers/replace-identifiers.js +9 -1
- package/dist/src/helpers/strip-state-and-props-refs.js +2 -2
- package/dist/src/helpers/styles/collect-css.js +15 -6
- package/dist/src/helpers/styles/helpers.d.ts +1 -1
- package/dist/src/helpers/styles/helpers.js +10 -3
- package/dist/src/parsers/builder/builder.js +41 -38
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/jsx-runtime.d.ts +2 -0
- package/package.json +2 -2
|
@@ -28,8 +28,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.componentToAngular = exports.blockToAngular = void 0;
|
|
31
|
-
var dedent_1 = __importDefault(require("dedent"));
|
|
32
31
|
var standalone_1 = require("prettier/standalone");
|
|
32
|
+
var dedent_1 = require("../helpers/dedent");
|
|
33
33
|
var collect_css_1 = require("../helpers/styles/collect-css");
|
|
34
34
|
var fast_clone_1 = require("../helpers/fast-clone");
|
|
35
35
|
var get_refs_1 = require("../helpers/get-refs");
|
|
@@ -269,6 +269,7 @@ var componentToAngular = function (userOptions) {
|
|
|
269
269
|
case 'hooks-deps':
|
|
270
270
|
case 'state':
|
|
271
271
|
case 'properties':
|
|
272
|
+
case 'dynamic-jsx-elements':
|
|
272
273
|
return function (x) { return x; };
|
|
273
274
|
}
|
|
274
275
|
}),
|
|
@@ -387,7 +388,7 @@ var componentToAngular = function (userOptions) {
|
|
|
387
388
|
.join(',');
|
|
388
389
|
return "const defaultProps = {".concat(defalutPropsString, "};\n");
|
|
389
390
|
};
|
|
390
|
-
var str = (0, dedent_1.
|
|
391
|
+
var str = (0, dedent_1.dedent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { ", " ", " Component ", "", " } from '@angular/core';\n ", "\n\n ", "\n ", "\n ", "\n\n @Component({\n ", "\n })\n export class ", " {\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "], ["\n import { ", " ", " Component ", "", " } from '@angular/core';\n ", "\n\n ", "\n ", "\n ", "\n\n @Component({\n ", "\n })\n export class ", " {\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "])), outputs.length ? 'Output, EventEmitter, \n' : '', ((_g = options === null || options === void 0 ? void 0 : options.experimental) === null || _g === void 0 ? void 0 : _g.inject) ? 'Inject, forwardRef,' : '', domRefs.size ? ', ViewChild, ElementRef' : '', props.size ? ', Input' : '', options.standalone ? "import { CommonModule } from '@angular/common';" : '', json.types ? json.types.join('\n') : '', getPropsDefinition({ json: json }), (0, render_imports_1.renderPreComponent)({
|
|
391
392
|
component: json,
|
|
392
393
|
target: 'angular',
|
|
393
394
|
excludeMitosisComponents: !options.standalone && !options.preserveImports,
|
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.componentToBuilder = exports.blockToBuilder = void 0;
|
|
22
22
|
var get_state_object_string_1 = require("../helpers/get-state-object-string");
|
|
23
23
|
var fast_clone_1 = require("../helpers/fast-clone");
|
|
24
|
-
var dedent_1 =
|
|
24
|
+
var dedent_1 = require("../helpers/dedent");
|
|
25
25
|
var standalone_1 = require("prettier/standalone");
|
|
26
26
|
var json5_1 = __importDefault(require("json5"));
|
|
27
27
|
var is_upper_case_1 = require("../helpers/is-upper-case");
|
|
@@ -241,8 +241,8 @@ var componentToBuilder = function (options) {
|
|
|
241
241
|
var result = (0, fast_clone_1.fastClone)({
|
|
242
242
|
data: {
|
|
243
243
|
httpRequests: (_c = (_b = component === null || component === void 0 ? void 0 : component.meta) === null || _b === void 0 ? void 0 : _b.useMetadata) === null || _c === void 0 ? void 0 : _c.httpRequests,
|
|
244
|
-
jsCode: tryFormat((0, dedent_1.
|
|
245
|
-
tsCode: tryFormat((0, dedent_1.
|
|
244
|
+
jsCode: tryFormat((0, dedent_1.dedent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n\n ", "\n \n ", "\n "], ["\n ", "\n\n ", "\n \n ", "\n "])), !(0, has_props_1.hasProps)(component) ? '' : "var props = state;", !hasState ? '' : "Object.assign(state, ".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(component), ");"), !((_d = component.hooks.onMount) === null || _d === void 0 ? void 0 : _d.code) ? '' : component.hooks.onMount.code)),
|
|
245
|
+
tsCode: tryFormat((0, dedent_1.dedent)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n\n ", "\n\n ", "\n "], ["\n ", "\n\n ", "\n\n ", "\n "])), !(0, has_props_1.hasProps)(component) ? '' : "var props = state;", !hasState ? '' : "useState(".concat((0, get_state_object_string_1.getStateObjectStringFromComponent)(component), ");"), !((_e = component.hooks.onMount) === null || _e === void 0 ? void 0 : _e.code)
|
|
246
246
|
? ''
|
|
247
247
|
: "onMount(() => {\n ".concat(component.hooks.onMount.code, "\n })"))),
|
|
248
248
|
blocks: component.children
|
|
@@ -3,13 +3,10 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
7
|
exports.componentToLit = void 0;
|
|
11
|
-
var dedent_1 = __importDefault(require("dedent"));
|
|
12
8
|
var standalone_1 = require("prettier/standalone");
|
|
9
|
+
var dedent_1 = require("../../helpers/dedent");
|
|
13
10
|
var get_state_object_string_1 = require("../../helpers/get-state-object-string");
|
|
14
11
|
var render_imports_1 = require("../../helpers/render-imports");
|
|
15
12
|
var jsx_1 = require("../../parsers/jsx");
|
|
@@ -180,7 +177,7 @@ var componentToLit = function (options) {
|
|
|
180
177
|
html = html.replace(/\n{3,}/g, '\n\n');
|
|
181
178
|
}
|
|
182
179
|
}
|
|
183
|
-
var str = (0, dedent_1.
|
|
180
|
+
var str = (0, dedent_1.dedent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n import { LitElement, html, css } from 'lit';\n import { customElement, property, state, query } from 'lit/decorators.js';\n\n ", "\n ", "\n\n @customElement('", "')\n export default class ", " extends LitElement {\n ", "\n\n ", "\n\n ", "\n \n \n ", "\n\n ", "\n ", "\n \n ", "\n ", "\n ", "\n \n render() {\n return html`\n ", "\n ", "\n `\n }\n }\n "], ["\n ", "\n import { LitElement, html, css } from 'lit';\n import { customElement, property, state, query } from 'lit/decorators.js';\n\n ", "\n ", "\n\n @customElement('", "')\n export default class ", " extends LitElement {\n ", "\n\n ", "\n\n ", "\n \n \n ", "\n\n ", "\n ", "\n \n ", "\n ", "\n ", "\n \n render() {\n return html\\`\n ", "\n ", "\n \\`\n }\n }\n "])), (0, render_imports_1.renderPreComponent)({ component: json, target: 'lit' }), json.types ? json.types.join('\n') : '', hasSpread
|
|
184
181
|
? "\n const spread = (properties) =>\n directive((part) => {\n for (const property in properties) {\n const value = properties[attr];\n part.element[property] = value;\n }\n });\n "
|
|
185
182
|
: '', ((_b = json.meta.useMetadata) === null || _b === void 0 ? void 0 : _b.tagName) || getCustomTagName(json.name, options), json.name, options.useShadowDom
|
|
186
183
|
? ''
|
|
@@ -19,8 +19,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.markoFormatHtml = exports.postprocessHtml = exports.preprocessHtml = exports.componentToMarko = void 0;
|
|
22
|
-
var dedent_1 = __importDefault(require("dedent"));
|
|
23
22
|
var standalone_1 = require("prettier/standalone");
|
|
23
|
+
var dedent_1 = require("../../helpers/dedent");
|
|
24
24
|
var get_state_object_string_1 = require("../../helpers/get-state-object-string");
|
|
25
25
|
var render_imports_1 = require("../../helpers/render-imports");
|
|
26
26
|
var jsx_1 = require("../../parsers/jsx");
|
|
@@ -176,7 +176,7 @@ var componentToMarko = function (userOptions) {
|
|
|
176
176
|
console.warn('Could not format css', err);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
var jsString = (0, dedent_1.
|
|
179
|
+
var jsString = (0, dedent_1.dedent)(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
|
|
180
180
|
? ''
|
|
181
181
|
: "onCreate(".concat(thisHasProps ? 'input' : '', ") {\n this.state = ").concat(dataString, "\n }"), Array.from(domRefs)
|
|
182
182
|
.map(function (refName) { return "get ".concat((0, lodash_1.camelCase)(refName), "() { \n return this.getEl('").concat((0, lodash_1.camelCase)(refName), "')\n }"); })
|
|
@@ -28,9 +28,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.componentToMitosis = exports.blockToMitosis = exports.DEFAULT_FORMAT = void 0;
|
|
31
|
-
var dedent_1 = __importDefault(require("dedent"));
|
|
32
31
|
var json5_1 = __importDefault(require("json5"));
|
|
33
32
|
var standalone_1 = require("prettier/standalone");
|
|
33
|
+
var dedent_1 = require("../helpers/dedent");
|
|
34
34
|
var fast_clone_1 = require("../helpers/fast-clone");
|
|
35
35
|
var get_components_1 = require("../helpers/get-components");
|
|
36
36
|
var get_refs_1 = require("../helpers/get-refs");
|
|
@@ -157,7 +157,7 @@ var componentToMitosis = function (toMitosisOptions) {
|
|
|
157
157
|
var needsMitosisCoreImport = Boolean(hasState || refs.length || mitosisComponents.length);
|
|
158
158
|
var stringifiedUseMetadata = json5_1.default.stringify(component.meta.useMetadata);
|
|
159
159
|
// TODO: smart only pull in imports as needed
|
|
160
|
-
var str = (0, dedent_1.
|
|
160
|
+
var str = (0, dedent_1.dedent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n\n ", "\n\n ", "\n\n export default function ", "(props) {\n ", "\n ", "\n\n ", "\n\n ", "\n\n return (", "\n ", "\n ", ")\n }\n\n "], ["\n ", "\n ", "\n ", "\n\n ", "\n\n ", "\n\n export default function ", "(props) {\n ", "\n ", "\n\n ", "\n\n ", "\n\n return (", "\n ", "\n ", ")\n }\n\n "])), !needsMitosisCoreImport
|
|
161
161
|
? ''
|
|
162
162
|
: "import { ".concat(!hasState ? '' : 'useStore, ', " ").concat(!refs.length ? '' : 'useRef, ', " ").concat(mitosisComponents.join(', '), " } from '@builder.io/mitosis';"), !otherComponents.length ? '' : "import { ".concat(otherComponents.join(','), " } from '@components';"), json.types ? json.types.join('\n') : '', (0, render_imports_1.renderPreComponent)({ component: json, target: 'mitosis' }), stringifiedUseMetadata && stringifiedUseMetadata !== '{}'
|
|
163
163
|
? "".concat(jsx_1.METADATA_HOOK_NAME, "(").concat(stringifiedUseMetadata, ")")
|
|
@@ -6,7 +6,6 @@ var fast_clone_1 = require("../../helpers/fast-clone");
|
|
|
6
6
|
var collect_css_1 = require("../../helpers/styles/collect-css");
|
|
7
7
|
var state_1 = require("../../helpers/state");
|
|
8
8
|
var add_prevent_default_1 = require("./helpers/add-prevent-default");
|
|
9
|
-
var convert_method_to_function_1 = require("./helpers/convert-method-to-function");
|
|
10
9
|
var jsx_1 = require("./jsx");
|
|
11
10
|
var src_generator_1 = require("./src-generator");
|
|
12
11
|
var plugins_1 = require("../../modules/plugins");
|
|
@@ -34,6 +33,7 @@ var PLUGINS = [
|
|
|
34
33
|
case 'hooks':
|
|
35
34
|
case 'hooks-deps':
|
|
36
35
|
case 'properties':
|
|
36
|
+
case 'dynamic-jsx-elements':
|
|
37
37
|
// update signal getters to have `.value`
|
|
38
38
|
return function (code, k) {
|
|
39
39
|
// `ref` should not update the signal value access
|
|
@@ -47,7 +47,19 @@ var PLUGINS = [
|
|
|
47
47
|
to: function (x) { return (x === ref ? "".concat(x, ".value") : "".concat(ref, ".value.").concat(x)); },
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
|
|
50
|
+
// update signal getters to have `.value`
|
|
51
|
+
return (0, replace_identifiers_1.replaceStateIdentifier)(function (name) {
|
|
52
|
+
var state = json.state[name];
|
|
53
|
+
switch (state === null || state === void 0 ? void 0 : state.type) {
|
|
54
|
+
case 'getter':
|
|
55
|
+
return "".concat(name, ".value");
|
|
56
|
+
case 'function':
|
|
57
|
+
case 'method':
|
|
58
|
+
case 'property':
|
|
59
|
+
case undefined:
|
|
60
|
+
return "state.".concat(name);
|
|
61
|
+
}
|
|
62
|
+
})(code);
|
|
51
63
|
};
|
|
52
64
|
}
|
|
53
65
|
}),
|
|
@@ -77,27 +89,27 @@ var componentToQwik = function (userOptions) {
|
|
|
77
89
|
emitImports(file, component);
|
|
78
90
|
emitTypes(file, component);
|
|
79
91
|
emitExports(file, component);
|
|
80
|
-
var
|
|
81
|
-
var isLightComponent = ((_c = (_b =
|
|
82
|
-
var mutable_1 = ((_d =
|
|
83
|
-
var imports_1 = ((_e =
|
|
92
|
+
var metadata_1 = component.meta.useMetadata || {};
|
|
93
|
+
var isLightComponent = ((_c = (_b = metadata_1 === null || metadata_1 === void 0 ? void 0 : metadata_1.qwik) === null || _b === void 0 ? void 0 : _b.component) === null || _c === void 0 ? void 0 : _c.isLight) || false;
|
|
94
|
+
var mutable_1 = ((_d = metadata_1 === null || metadata_1 === void 0 ? void 0 : metadata_1.qwik) === null || _d === void 0 ? void 0 : _d.mutable) || [];
|
|
95
|
+
var imports_1 = ((_e = metadata_1 === null || metadata_1 === void 0 ? void 0 : metadata_1.qwik) === null || _e === void 0 ? void 0 : _e.imports) || {};
|
|
84
96
|
Object.keys(imports_1).forEach(function (key) { return file.import(imports_1[key], key); });
|
|
85
|
-
var state_3 = (0, state_2.emitStateMethodsAndRewriteBindings)(file, component,
|
|
97
|
+
var state_3 = (0, state_2.emitStateMethodsAndRewriteBindings)(file, component, metadata_1);
|
|
86
98
|
var hasState_1 = (0, state_1.checkHasState)(component);
|
|
87
99
|
var css_1 = null;
|
|
88
100
|
var componentFn = (0, src_generator_1.arrowFnBlock)(['props'], [
|
|
89
101
|
function () {
|
|
90
|
-
var _a
|
|
102
|
+
var _a;
|
|
91
103
|
css_1 = emitUseStyles(file, component);
|
|
92
104
|
emitUseContext(file, component);
|
|
93
105
|
emitUseRef(file, component);
|
|
94
|
-
hasState_1 &&
|
|
106
|
+
hasState_1 &&
|
|
107
|
+
(0, state_2.emitUseStore)({ file: file, stateInit: state_3, isDeep: (_a = metadata_1 === null || metadata_1 === void 0 ? void 0 : metadata_1.qwik) === null || _a === void 0 ? void 0 : _a.hasDeepStore });
|
|
108
|
+
emitUseComputed(file, component);
|
|
95
109
|
emitUseContextProvider(file, component);
|
|
96
110
|
emitUseClientEffect(file, component);
|
|
97
111
|
emitUseMount(file, component);
|
|
98
112
|
emitUseTask(file, component);
|
|
99
|
-
emitTagNameHack(file, component, (_a = component.meta.useMetadata) === null || _a === void 0 ? void 0 : _a.elementTag);
|
|
100
|
-
emitTagNameHack(file, component, (_b = component.meta.useMetadata) === null || _b === void 0 ? void 0 : _b.componentElementTag);
|
|
101
113
|
emitJSX(file, component, mutable_1);
|
|
102
114
|
},
|
|
103
115
|
], [(component.propsTypeRef || 'any') + (isLightComponent ? '&{key?:any}' : '')]);
|
|
@@ -126,11 +138,6 @@ function emitExports(file, component) {
|
|
|
126
138
|
file.src.emit(code);
|
|
127
139
|
});
|
|
128
140
|
}
|
|
129
|
-
function emitTagNameHack(file, component, metadataValue) {
|
|
130
|
-
if (typeof metadataValue === 'string' && metadataValue) {
|
|
131
|
-
file.src.emit(metadataValue, '=', (0, convert_method_to_function_1.convertMethodToFunction)(metadataValue, (0, state_2.getStateMethodsAndGetters)(component.state), (0, state_2.getLexicalScopeVars)(component)), ';');
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
141
|
function emitUseClientEffect(file, component) {
|
|
135
142
|
if (component.hooks.onMount) {
|
|
136
143
|
// This is called useMount, but in practice it is used as
|
|
@@ -172,7 +179,7 @@ function emitJSX(file, component, mutable) {
|
|
|
172
179
|
if (file.options.isPretty) {
|
|
173
180
|
file.src.emit('\n\n');
|
|
174
181
|
}
|
|
175
|
-
file.src.emit('return ', (0, jsx_1.renderJSXNodes)(file, directives, handlers, component.children, styles, parentSymbolBindings));
|
|
182
|
+
file.src.emit('return ', (0, jsx_1.renderJSXNodes)(file, directives, handlers, component.children, styles, null, parentSymbolBindings));
|
|
176
183
|
}
|
|
177
184
|
function emitUseContextProvider(file, component) {
|
|
178
185
|
Object.entries(component.context.set).forEach(function (_a) {
|
|
@@ -265,3 +272,13 @@ function extractGetterBody(code) {
|
|
|
265
272
|
var end = code.lastIndexOf('}');
|
|
266
273
|
return code.substring(start + 1, end).trim();
|
|
267
274
|
}
|
|
275
|
+
function emitUseComputed(file, component) {
|
|
276
|
+
for (var _i = 0, _a = Object.entries(component.state); _i < _a.length; _i++) {
|
|
277
|
+
var _b = _a[_i], key = _b[0], stateValue = _b[1];
|
|
278
|
+
switch (stateValue === null || stateValue === void 0 ? void 0 : stateValue.type) {
|
|
279
|
+
case 'getter':
|
|
280
|
+
file.src.const("\n ".concat(key, " = ").concat(file.import(file.qwikModule, 'useComputed$').localName, "(() => {\n ").concat(extractGetterBody(stateValue.code), "\n })\n "));
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -27,6 +27,7 @@ var jsx_1 = require("./jsx");
|
|
|
27
27
|
var src_generator_1 = require("./src-generator");
|
|
28
28
|
var stable_serialize_1 = require("./helpers/stable-serialize");
|
|
29
29
|
var styles_1 = require("./helpers/styles");
|
|
30
|
+
var directives_1 = require("./directives");
|
|
30
31
|
function createFileSet(options) {
|
|
31
32
|
if (options === void 0) { options = {}; }
|
|
32
33
|
var opts = __assign({ qwikLib: '@builder.io/qwik', qrlPrefix: './', output: 'ts', minify: false, jsx: true }, options);
|
|
@@ -98,13 +99,16 @@ function addComponent(fileSet, component, opts) {
|
|
|
98
99
|
var directives = new Map();
|
|
99
100
|
var rootChildren = component.children;
|
|
100
101
|
addComponentOnMount(onRenderFile, function () {
|
|
101
|
-
return this.emit('return ', (0, jsx_1.renderJSXNodes)(onRenderFile, directives, handlers, rootChildren, styles, {}), ';');
|
|
102
|
+
return this.emit('return ', (0, jsx_1.renderJSXNodes)(onRenderFile, directives, handlers, rootChildren, styles, null, {}), ';');
|
|
102
103
|
}, componentName, component, useStyles);
|
|
103
104
|
componentFile.exportConst(componentName, (0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, 'componentQrl'), [generateQrl(componentFile, onRenderFile, componentName + 'OnMount')], ['any', 'any']));
|
|
104
105
|
directives.forEach(function (code, name) {
|
|
105
106
|
fileSet.med.import(fileSet.med.qwikModule, 'h');
|
|
106
107
|
fileSet.med.exportConst(name, code, true);
|
|
107
108
|
});
|
|
109
|
+
fileSet.low.exportConst('__proxyMerge__', directives_1.DIRECTIVES['__proxyMerge__'], true);
|
|
110
|
+
fileSet.med.exportConst('__proxyMerge__', directives_1.DIRECTIVES['__proxyMerge__'], true);
|
|
111
|
+
fileSet.high.exportConst('__proxyMerge__', directives_1.DIRECTIVES['__proxyMerge__'], true);
|
|
108
112
|
}
|
|
109
113
|
exports.addComponent = addComponent;
|
|
110
114
|
function generateStyles(fromFile, dstFile, symbol, scoped) {
|
|
@@ -130,7 +134,12 @@ function addBuilderBlockClass(children) {
|
|
|
130
134
|
}
|
|
131
135
|
function renderUseLexicalScope(file) {
|
|
132
136
|
return function () {
|
|
133
|
-
|
|
137
|
+
if (this.file.options.isBuilder) {
|
|
138
|
+
return this.emit('const [s,l]=', file.import(file.qwikModule, 'useLexicalScope').localName, '();', 'const state=__proxyMerge__(s,l);');
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return this.emit('const state=', file.import(file.qwikModule, 'useLexicalScope').localName, '()[0]');
|
|
142
|
+
}
|
|
134
143
|
};
|
|
135
144
|
}
|
|
136
145
|
exports.renderUseLexicalScope = renderUseLexicalScope;
|
|
@@ -152,15 +161,17 @@ function addComponentOnMount(componentFile, onRenderEmit, componentName, compone
|
|
|
152
161
|
}
|
|
153
162
|
componentFile.exportConst(componentName + 'OnMount', function () {
|
|
154
163
|
var _this = this;
|
|
155
|
-
this.emit((0, src_generator_1.arrowFnValue)(['
|
|
164
|
+
this.emit((0, src_generator_1.arrowFnValue)(['p'], function () {
|
|
156
165
|
var _a;
|
|
157
166
|
return _this.emit.apply(_this, __spreadArray(__spreadArray(['{',
|
|
158
|
-
'const
|
|
167
|
+
'const s=',
|
|
159
168
|
componentFile.import(componentFile.qwikModule, 'useStore').localName,
|
|
160
169
|
'(()=>{',
|
|
161
|
-
'const state
|
|
170
|
+
'const state=Object.assign({},structuredClone(typeof __STATE__==="object"&&__STATE__[p.serverStateId]),p);'], inputInitializer, false), [inlineCode((_a = component.hooks.onMount) === null || _a === void 0 ? void 0 : _a.code),
|
|
162
171
|
'return state;',
|
|
163
|
-
'});',
|
|
172
|
+
'},{deep:true});',
|
|
173
|
+
'const l={};',
|
|
174
|
+
'const state=__proxyMerge__(s,l);',
|
|
164
175
|
useStyles,
|
|
165
176
|
onRenderEmit,
|
|
166
177
|
';}'], false));
|
|
@@ -21,12 +21,4 @@ interface ImageProps {
|
|
|
21
21
|
noWebp?: boolean;
|
|
22
22
|
}
|
|
23
23
|
export declare function Image(props: ImageProps): any;
|
|
24
|
-
export declare function __passThroughProps__(dstProps: Record<string, any>, srcProps: Record<string, any>): Record<string, any>;
|
|
25
|
-
export declare function CoreButton(props: {
|
|
26
|
-
text?: string;
|
|
27
|
-
link?: string;
|
|
28
|
-
class?: string;
|
|
29
|
-
openInNewTab?: string;
|
|
30
|
-
tagName$: string;
|
|
31
|
-
}): any;
|
|
32
24
|
export {};
|
|
@@ -4,7 +4,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.Image = exports.DIRECTIVES = void 0;
|
|
8
8
|
var for_1 = require("../../helpers/nodes/for");
|
|
9
9
|
var minify_1 = require("../minify");
|
|
10
10
|
var src_generator_1 = require("./src-generator");
|
|
@@ -40,12 +40,17 @@ exports.DIRECTIVES = {
|
|
|
40
40
|
_this.emit('(', expr, '||[]).map(');
|
|
41
41
|
_this.isBuilder && _this.emit('(('), _this.emit('function(', forArgs, '){');
|
|
42
42
|
if (_this.isBuilder) {
|
|
43
|
-
_this.emit('
|
|
43
|
+
_this.emit('const l={...this,', (0, src_generator_1.iteratorProperty)(expr), ':', forName, '==null?{}:', forName, ',', function () {
|
|
44
|
+
return forArgs.forEach(function (arg) {
|
|
45
|
+
_this.emit(arg, ':', arg, ',');
|
|
46
|
+
});
|
|
47
|
+
}, '};');
|
|
48
|
+
_this.emit('const state = __proxyMerge__(s,l);');
|
|
44
49
|
}
|
|
45
50
|
_this.emit('return(');
|
|
46
51
|
blockFn();
|
|
47
52
|
_this.emit(');}');
|
|
48
|
-
_this.isBuilder && _this.emit(').bind(
|
|
53
|
+
_this.isBuilder && _this.emit(').bind(l))');
|
|
49
54
|
_this.emit(')');
|
|
50
55
|
});
|
|
51
56
|
};
|
|
@@ -53,6 +58,7 @@ exports.DIRECTIVES = {
|
|
|
53
58
|
Image: (0, minify_1.minify)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", ""], ["", ""])), Image),
|
|
54
59
|
CoreButton: (0, minify_1.minify)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["", ""], ["", ""])), CoreButton),
|
|
55
60
|
__passThroughProps__: (0, minify_1.minify)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["", ""], ["", ""])), __passThroughProps__),
|
|
61
|
+
__proxyMerge__: (0, minify_1.minify)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["", ""], ["", ""])), __proxyMerge__),
|
|
56
62
|
};
|
|
57
63
|
function Image(props) {
|
|
58
64
|
var _a;
|
|
@@ -81,7 +87,7 @@ function Image(props) {
|
|
|
81
87
|
.map(function (size) {
|
|
82
88
|
return updateQueryParam(webpImage_1, 'width', size) + ' ' + size + 'w';
|
|
83
89
|
})
|
|
84
|
-
.concat(
|
|
90
|
+
.concat(tryAppendWidth(image))
|
|
85
91
|
.join(', ');
|
|
86
92
|
imgProps.srcset = srcset;
|
|
87
93
|
jsx = jsx = [
|
|
@@ -113,6 +119,14 @@ function Image(props) {
|
|
|
113
119
|
}
|
|
114
120
|
return uri + separator + key + '=' + encodeURIComponent(value);
|
|
115
121
|
}
|
|
122
|
+
function tryAppendWidth(url) {
|
|
123
|
+
var match = url.match(/[?&]width=(\d+)/);
|
|
124
|
+
var width = match && match[1];
|
|
125
|
+
if (width) {
|
|
126
|
+
return [url + ' ' + width + 'w'];
|
|
127
|
+
}
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
116
130
|
}
|
|
117
131
|
exports.Image = Image;
|
|
118
132
|
function __passThroughProps__(dstProps, srcProps) {
|
|
@@ -124,7 +138,6 @@ function __passThroughProps__(dstProps, srcProps) {
|
|
|
124
138
|
}
|
|
125
139
|
return dstProps;
|
|
126
140
|
}
|
|
127
|
-
exports.__passThroughProps__ = __passThroughProps__;
|
|
128
141
|
function CoreButton(props) {
|
|
129
142
|
var hasLink = !!props.link;
|
|
130
143
|
var hProps = {
|
|
@@ -135,5 +148,20 @@ function CoreButton(props) {
|
|
|
135
148
|
};
|
|
136
149
|
return h(hasLink ? 'a' : props.tagName$ || 'span', __passThroughProps__(hProps, props));
|
|
137
150
|
}
|
|
138
|
-
|
|
139
|
-
|
|
151
|
+
function __proxyMerge__(state, local) {
|
|
152
|
+
return new Proxy(state, {
|
|
153
|
+
get: function (obj, prop) {
|
|
154
|
+
if (local && prop in local) {
|
|
155
|
+
return local[prop];
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
return state[prop];
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
set: function (obj, prop, value) {
|
|
162
|
+
obj[prop] = value;
|
|
163
|
+
return true;
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -20,7 +20,11 @@ export declare type StateValues = Record<PropertyName, StateValue>;
|
|
|
20
20
|
* @param file
|
|
21
21
|
* @param stateInit
|
|
22
22
|
*/
|
|
23
|
-
export declare function emitUseStore(file
|
|
23
|
+
export declare function emitUseStore({ file, stateInit, isDeep, }: {
|
|
24
|
+
file: File;
|
|
25
|
+
stateInit: StateInit;
|
|
26
|
+
isDeep: boolean;
|
|
27
|
+
}): void;
|
|
24
28
|
export declare function emitStateMethodsAndRewriteBindings(file: File, component: MitosisComponent, metadata: Record<string, any>): StateInit;
|
|
25
29
|
export declare function getLexicalScopeVars(component: MitosisComponent): string[];
|
|
26
30
|
export declare type MethodMap = Record<string, 'method' | 'getter'>;
|
|
@@ -21,7 +21,8 @@ var babel_transform_1 = require("../../../helpers/babel-transform");
|
|
|
21
21
|
* @param file
|
|
22
22
|
* @param stateInit
|
|
23
23
|
*/
|
|
24
|
-
function emitUseStore(
|
|
24
|
+
function emitUseStore(_a) {
|
|
25
|
+
var file = _a.file, stateInit = _a.stateInit, isDeep = _a.isDeep;
|
|
25
26
|
var state = stateInit[0];
|
|
26
27
|
var hasState = state && Object.keys(state).length > 0;
|
|
27
28
|
if (hasState) {
|
|
@@ -29,7 +30,8 @@ function emitUseStore(file, stateInit) {
|
|
|
29
30
|
if (file.options.isTypeScript) {
|
|
30
31
|
file.src.emit('<any>');
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
var fnArgs = [(0, stable_inject_1.stableInject)(state), isDeep ? '{deep: true}' : undefined].filter(Boolean);
|
|
34
|
+
file.src.emit("(".concat(fnArgs, ");"));
|
|
33
35
|
}
|
|
34
36
|
else {
|
|
35
37
|
// TODO hack for now so that `state` variable is defined, even though it is never read.
|
|
@@ -45,22 +47,15 @@ function emitStateMethods(file, componentState, lexicalArgs) {
|
|
|
45
47
|
var stateValue = componentState[key];
|
|
46
48
|
switch (stateValue === null || stateValue === void 0 ? void 0 : stateValue.type) {
|
|
47
49
|
case 'method':
|
|
48
|
-
case 'getter':
|
|
49
50
|
case 'function':
|
|
50
51
|
var code = stateValue.code;
|
|
51
52
|
var prefixIdx = 0;
|
|
52
|
-
if (stateValue.type === '
|
|
53
|
-
prefixIdx += 'get '.length;
|
|
54
|
-
}
|
|
55
|
-
else if (stateValue.type === 'function') {
|
|
53
|
+
if (stateValue.type === 'function') {
|
|
56
54
|
prefixIdx += 'function '.length;
|
|
57
55
|
}
|
|
58
56
|
code = code.substring(prefixIdx);
|
|
59
57
|
code = (0, convert_method_to_function_1.convertMethodToFunction)(code, methodMap, lexicalArgs).replace('(', "(".concat(lexicalArgs.join(','), ","));
|
|
60
58
|
var functionName = code.split(/\(/)[0];
|
|
61
|
-
if (stateValue.type === 'getter') {
|
|
62
|
-
stateInit.push("state.".concat(key, "=").concat(functionName, "(").concat(lexicalArgs.join(','), ")"));
|
|
63
|
-
}
|
|
64
59
|
if (!file.options.isTypeScript) {
|
|
65
60
|
// Erase type information
|
|
66
61
|
code = (0, babel_transform_1.convertTypeScriptToJS)(code);
|
|
@@ -9,8 +9,9 @@ import { CssStyles } from './helpers/styles';
|
|
|
9
9
|
* @param handlers A set of handlers which we came across so that they can be rendered
|
|
10
10
|
* @param children A list of children to convert to JSX
|
|
11
11
|
* @param styles Store for styles which we came across so that they can be rendered.
|
|
12
|
+
* @param key Key to be used for the node if needed
|
|
12
13
|
* @param parentSymbolBindings A set of bindings from parent to be written into the child.
|
|
13
14
|
* @param root True if this is the root JSX, and may need a Fragment wrapper.
|
|
14
15
|
* @returns
|
|
15
16
|
*/
|
|
16
|
-
export declare function renderJSXNodes(file: File, directives: Map<string, string>, handlers: Map<string, string>, children: MitosisNode[], styles: Map<string, CssStyles>, parentSymbolBindings: Record<string, string>, root?: boolean): any;
|
|
17
|
+
export declare function renderJSXNodes(file: File, directives: Map<string, string>, handlers: Map<string, string>, children: MitosisNode[], styles: Map<string, CssStyles>, key: string | null | undefined, parentSymbolBindings: Record<string, string>, root?: boolean): any;
|
|
@@ -32,11 +32,12 @@ var src_generator_1 = require("./src-generator");
|
|
|
32
32
|
* @param handlers A set of handlers which we came across so that they can be rendered
|
|
33
33
|
* @param children A list of children to convert to JSX
|
|
34
34
|
* @param styles Store for styles which we came across so that they can be rendered.
|
|
35
|
+
* @param key Key to be used for the node if needed
|
|
35
36
|
* @param parentSymbolBindings A set of bindings from parent to be written into the child.
|
|
36
37
|
* @param root True if this is the root JSX, and may need a Fragment wrapper.
|
|
37
38
|
* @returns
|
|
38
39
|
*/
|
|
39
|
-
function renderJSXNodes(file, directives, handlers, children, styles, parentSymbolBindings, root) {
|
|
40
|
+
function renderJSXNodes(file, directives, handlers, children, styles, key, parentSymbolBindings, root) {
|
|
40
41
|
if (root === void 0) { root = true; }
|
|
41
42
|
return function () {
|
|
42
43
|
var _this = this;
|
|
@@ -86,15 +87,12 @@ function renderJSXNodes(file, directives, handlers, children, styles, parentSymb
|
|
|
86
87
|
});
|
|
87
88
|
_this.emit(directive(child, blockFn_1));
|
|
88
89
|
!_this.isJSX && _this.emit(',');
|
|
90
|
+
includedHelperDirectives(directive.toString(), directives);
|
|
89
91
|
}
|
|
90
92
|
else {
|
|
91
93
|
if (typeof directive == 'string') {
|
|
92
94
|
directives.set(childName, directive);
|
|
93
|
-
|
|
94
|
-
var name = match[0];
|
|
95
|
-
var code = directives_1.DIRECTIVES[name];
|
|
96
|
-
typeof code == 'string' && directives.set(name, code);
|
|
97
|
-
});
|
|
95
|
+
includedHelperDirectives(directive, directives);
|
|
98
96
|
if (file.module !== 'med' && file.imports.hasImport(childName)) {
|
|
99
97
|
file.import('./med.js', childName);
|
|
100
98
|
}
|
|
@@ -122,10 +120,15 @@ function renderJSXNodes(file, directives, handlers, children, styles, parentSymb
|
|
|
122
120
|
props.class = addClass(styleProps.CLASS_NAME, props.class);
|
|
123
121
|
}
|
|
124
122
|
}
|
|
123
|
+
key = props['builder-id'] || key;
|
|
124
|
+
if (props.innerHTML) {
|
|
125
|
+
// Special case. innerHTML requires `key` in Qwik
|
|
126
|
+
props = __assign({ key: key || 'default' }, props);
|
|
127
|
+
}
|
|
125
128
|
var symbolBindings = {};
|
|
126
129
|
var bindings = rewriteHandlers(file, handlers, child.bindings, symbolBindings);
|
|
127
130
|
_this.jsxBegin(childName, props, __assign(__assign(__assign({}, bindings), parentSymbolBindings), specialBindings));
|
|
128
|
-
renderJSXNodes(file, directives, handlers, child.children, styles, symbolBindings, false).call(_this);
|
|
131
|
+
renderJSXNodes(file, directives, handlers, child.children, styles, key, symbolBindings, false).call(_this);
|
|
129
132
|
_this.jsxEnd(childName);
|
|
130
133
|
}
|
|
131
134
|
}
|
|
@@ -140,13 +143,20 @@ function renderJSXNodes(file, directives, handlers, children, styles, parentSymb
|
|
|
140
143
|
children = children.filter(function (c) { return !isEmptyTextNode(c); });
|
|
141
144
|
var childNeedsFragment = children.length > 1 || (children.length && isTextNode(children[0]));
|
|
142
145
|
childNeedsFragment && srcBuilder.jsxBeginFragment(fragmentSymbol);
|
|
143
|
-
renderJSXNodes(file, directives, handlers, children, styles, {}, false).call(srcBuilder);
|
|
146
|
+
renderJSXNodes(file, directives, handlers, children, styles, null, {}, false).call(srcBuilder);
|
|
144
147
|
childNeedsFragment && srcBuilder.jsxEndFragment();
|
|
145
148
|
};
|
|
146
149
|
}
|
|
147
150
|
};
|
|
148
151
|
}
|
|
149
152
|
exports.renderJSXNodes = renderJSXNodes;
|
|
153
|
+
function includedHelperDirectives(directive, directives) {
|
|
154
|
+
Array.from(directive.matchAll(/(__[\w]+__)/g)).forEach(function (match) {
|
|
155
|
+
var name = match[0];
|
|
156
|
+
var code = directives_1.DIRECTIVES[name];
|
|
157
|
+
typeof code == 'string' && directives.set(name, code);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
150
160
|
function isSymbol(name) {
|
|
151
161
|
return name.charAt(0) == name.charAt(0).toUpperCase();
|
|
152
162
|
}
|
|
@@ -190,16 +200,16 @@ function rewriteHandlers(file, handlers, bindings, symbolBindings) {
|
|
|
190
200
|
if (Object.prototype.hasOwnProperty.call(bindings, key)) {
|
|
191
201
|
var bindingValue = bindings[key];
|
|
192
202
|
var bindingExpr = bindingValue.code;
|
|
193
|
-
var handlerBlock =
|
|
203
|
+
var handlerBlock = handlers.get(bindingExpr);
|
|
194
204
|
if (key == 'css') {
|
|
195
205
|
continue;
|
|
196
206
|
}
|
|
197
|
-
else if (
|
|
207
|
+
else if (handlerBlock) {
|
|
198
208
|
key = "".concat(key, "$");
|
|
199
209
|
bindingExpr = (0, src_generator_1.invoke)(file.import(file.qwikModule, 'qrl'), [
|
|
200
210
|
(0, src_generator_1.quote)(file.qrlPrefix + 'high.js'),
|
|
201
211
|
(0, src_generator_1.quote)(handlerBlock),
|
|
202
|
-
'[state]',
|
|
212
|
+
file.options.isBuilder ? '[s,l]' : '[state]',
|
|
203
213
|
]);
|
|
204
214
|
}
|
|
205
215
|
else if (symbolBindings && key.startsWith('symbol.data.')) {
|
|
@@ -61,7 +61,7 @@ export declare class Symbol {
|
|
|
61
61
|
}
|
|
62
62
|
export declare class Imports {
|
|
63
63
|
imports: Map<string, Map<string, Symbol>>;
|
|
64
|
-
get(moduleName: string, symbolName: string,
|
|
64
|
+
get(moduleName: string, symbolName: string, asVar?: string): Symbol;
|
|
65
65
|
hasImport(localName: string): boolean;
|
|
66
66
|
}
|
|
67
67
|
export declare function quote(text: string): string;
|
|
@@ -456,7 +456,7 @@ var Imports = /** @class */ (function () {
|
|
|
456
456
|
function Imports() {
|
|
457
457
|
this.imports = new Map();
|
|
458
458
|
}
|
|
459
|
-
Imports.prototype.get = function (moduleName, symbolName,
|
|
459
|
+
Imports.prototype.get = function (moduleName, symbolName, asVar) {
|
|
460
460
|
var importSymbols = this.imports.get(moduleName);
|
|
461
461
|
if (!importSymbols) {
|
|
462
462
|
importSymbols = new Map();
|
|
@@ -464,7 +464,7 @@ var Imports = /** @class */ (function () {
|
|
|
464
464
|
}
|
|
465
465
|
var symbol = importSymbols.get(symbolName);
|
|
466
466
|
if (!symbol) {
|
|
467
|
-
symbol = new Symbol(symbolName,
|
|
467
|
+
symbol = new Symbol(symbolName, asVar || symbolName);
|
|
468
468
|
importSymbols.set(symbolName, symbol);
|
|
469
469
|
}
|
|
470
470
|
return symbol;
|
|
@@ -20,8 +20,10 @@ var is_children_1 = __importDefault(require("../../helpers/is-children"));
|
|
|
20
20
|
var slots_1 = require("../../helpers/slots");
|
|
21
21
|
var filter_empty_text_nodes_1 = require("../../helpers/filter-empty-text-nodes");
|
|
22
22
|
var is_valid_attribute_name_1 = require("../../helpers/is-valid-attribute-name");
|
|
23
|
+
var is_root_text_node_1 = require("../../helpers/is-root-text-node");
|
|
23
24
|
var for_1 = require("../../helpers/nodes/for");
|
|
24
25
|
var jsx_1 = require("../../parsers/jsx");
|
|
26
|
+
var mitosis_node_1 = require("../../types/mitosis-node");
|
|
25
27
|
var helpers_1 = require("./helpers");
|
|
26
28
|
var state_1 = require("./state");
|
|
27
29
|
var NODE_MAPPERS = {
|
|
@@ -97,11 +99,17 @@ var NODE_MAPPERS = {
|
|
|
97
99
|
},
|
|
98
100
|
Show: function (json, options, component) {
|
|
99
101
|
var _a;
|
|
100
|
-
var wrap = (0, helpers_1.wrapInFragment)(json);
|
|
102
|
+
var wrap = (0, helpers_1.wrapInFragment)(json) || (0, is_root_text_node_1.isRootTextNode)(json);
|
|
103
|
+
var wrapElse = json.meta.else &&
|
|
104
|
+
((0, helpers_1.wrapInFragment)(json.meta.else) || (0, mitosis_node_1.checkIsForNode)(json.meta.else));
|
|
101
105
|
return "{".concat((0, helpers_1.processBinding)((_a = json.bindings.when) === null || _a === void 0 ? void 0 : _a.code, options), " ? (\n ").concat(wrap ? (0, helpers_1.openFrag)(options) : '').concat(json.children
|
|
102
106
|
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
103
107
|
.map(function (item) { return (0, exports.blockToReact)(item, options, component); })
|
|
104
|
-
.join('\n')).concat(wrap ? (0, helpers_1.closeFrag)(options) : '', "\n ) : ").concat(!json.meta.else
|
|
108
|
+
.join('\n')).concat(wrap ? (0, helpers_1.closeFrag)(options) : '', "\n ) : ").concat(!json.meta.else
|
|
109
|
+
? 'null'
|
|
110
|
+
: (wrapElse ? (0, helpers_1.openFrag)(options) : '') +
|
|
111
|
+
(0, exports.blockToReact)(json.meta.else, options, component) +
|
|
112
|
+
(wrapElse ? (0, helpers_1.closeFrag)(options) : ''), "}");
|
|
105
113
|
},
|
|
106
114
|
};
|
|
107
115
|
var ATTTRIBUTE_MAPPERS = {
|