@builder.io/mitosis 0.0.45 → 0.0.46
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/__tests__/builder.test.js +71 -68
- package/dist/src/__tests__/context.test.js +13 -10
- package/dist/src/__tests__/data/basic.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/button-with-metadata.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/columns.raw.jsx +2 -2
- package/dist/src/__tests__/data/blocks/custom-code.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/embed.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/form.raw.jsx +5 -5
- package/dist/src/__tests__/data/blocks/image.raw.jsx +4 -4
- package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +4 -4
- package/dist/src/__tests__/data/context/component-with-context.lite.jsx +2 -2
- package/dist/src/__tests__/data/context/simple.context.lite.js +1 -1
- package/dist/src/__tests__/html.test.js +2 -2
- package/dist/src/__tests__/liquid.test.js +34 -34
- package/dist/src/__tests__/parse-jsx.test.js +1 -1
- package/dist/src/__tests__/qwik.test.js +36 -36
- package/dist/src/__tests__/react-native.test.js +35 -35
- package/dist/src/__tests__/react.test.js +35 -35
- package/dist/src/__tests__/solid.test.js +32 -32
- package/dist/src/__tests__/vue.test.js +35 -34
- package/dist/src/generators/angular.d.ts +4 -7
- package/dist/src/generators/angular.js +77 -81
- package/dist/src/generators/builder.d.ts +4 -4
- package/dist/src/generators/builder.js +57 -57
- package/dist/src/generators/context/react.d.ts +3 -1
- package/dist/src/generators/context/react.js +20 -17
- package/dist/src/generators/html.d.ts +5 -9
- package/dist/src/generators/html.js +205 -199
- package/dist/src/generators/liquid.d.ts +5 -9
- package/dist/src/generators/liquid.js +62 -59
- package/dist/src/generators/mitosis.d.ts +6 -7
- package/dist/src/generators/mitosis.js +61 -63
- package/dist/src/generators/qwik/component.js +13 -13
- package/dist/src/generators/qwik/handlers.js +12 -8
- package/dist/src/generators/qwik/jsx.js +13 -9
- package/dist/src/generators/qwik/styles.js +11 -7
- package/dist/src/generators/react-native.d.ts +4 -7
- package/dist/src/generators/react-native.js +25 -22
- package/dist/src/generators/react.d.ts +4 -8
- package/dist/src/generators/react.js +103 -112
- package/dist/src/generators/solid.d.ts +4 -8
- package/dist/src/generators/solid.js +55 -54
- package/dist/src/generators/svelte.d.ts +4 -7
- package/dist/src/generators/svelte.js +120 -123
- package/dist/src/generators/swift-ui.d.ts +2 -2
- package/dist/src/generators/swift-ui.js +62 -62
- package/dist/src/generators/template.d.ts +4 -8
- package/dist/src/generators/template.js +48 -45
- package/dist/src/generators/vue.d.ts +9 -9
- package/dist/src/generators/vue.js +169 -169
- package/dist/src/helpers/babel-transform.js +9 -9
- package/dist/src/helpers/collect-styles.js +39 -39
- package/dist/src/helpers/dash-case.js +1 -1
- package/dist/src/helpers/generic-format.test.js +2 -2
- package/dist/src/helpers/get-components-used.js +2 -2
- package/dist/src/helpers/get-components.js +3 -3
- package/dist/src/helpers/get-props.js +1 -1
- package/dist/src/helpers/get-refs.js +2 -2
- package/dist/src/helpers/get-state-object-string.js +5 -5
- package/dist/src/helpers/get-state-used.js +1 -1
- package/dist/src/helpers/get-styles.js +1 -1
- package/dist/src/helpers/getters-to-functions.js +4 -4
- package/dist/src/helpers/handle-missing-state.js +1 -1
- package/dist/src/helpers/has-component.js +2 -2
- package/dist/src/helpers/has-props.js +1 -1
- package/dist/src/helpers/is-children.js +1 -1
- package/dist/src/helpers/json.d.ts +1 -0
- package/dist/src/helpers/json.js +17 -0
- package/dist/src/helpers/map-refs.js +4 -4
- package/dist/src/helpers/map-to-attributes.js +4 -4
- package/dist/src/helpers/map-to-css.js +2 -2
- package/dist/src/helpers/parse-node.js +2 -2
- package/dist/src/helpers/parse-reactive-script.js +4 -4
- package/dist/src/helpers/process-http-requests.js +1 -1
- package/dist/src/helpers/process-tag-references.js +4 -4
- package/dist/src/helpers/remove-surrounding-block.test.js +1 -1
- package/dist/src/helpers/render-imports.js +7 -7
- package/dist/src/helpers/replace-idenifiers.js +1 -1
- package/dist/src/helpers/strip-meta-properties.js +2 -2
- package/dist/src/helpers/trace-reference-to-module-path.js +1 -1
- package/dist/src/helpers/traverse-nodes.js +2 -2
- package/dist/src/helpers/try-prettier-format.js +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/modules/plugins.d.ts +2 -10
- package/dist/src/parsers/angular.js +13 -13
- package/dist/src/parsers/builder.js +54 -58
- package/dist/src/parsers/context.js +2 -2
- package/dist/src/parsers/jsx.js +59 -87
- package/dist/src/parsers/liquid.js +191 -194
- package/dist/src/plugins/compile-away-builder-components.js +49 -45
- package/dist/src/plugins/compile-away-components.js +3 -3
- package/dist/src/plugins/map-styles.js +3 -3
- package/dist/src/targets.d.ts +24 -0
- package/dist/src/targets.js +30 -0
- package/dist/src/types/config.d.ts +31 -0
- package/dist/src/types/{jsx-lite-component.js → config.js} +0 -0
- package/dist/{test/qwik/Todo/Todo.js/low.js → src/types/generators.d.ts} +0 -0
- package/dist/src/types/generators.js +1 -0
- package/dist/src/types/plugins.d.ts +11 -0
- package/dist/src/types/{jsx-lite-context.js → plugins.js} +0 -0
- package/dist/test/qwik/{Todo → todo}/Todo.cjs/high.cjs +0 -0
- package/dist/test/qwik/{Todo → todo}/Todo.cjs/low.cjs +0 -0
- package/dist/test/qwik/{Todo → todo}/Todo.cjs/med.cjs +0 -0
- package/dist/test/qwik/{Todo → todo}/Todo.js/high.js +0 -0
- package/dist/test/qwik/{qwik/todo → todo}/Todo.js/low.js +0 -0
- package/dist/test/qwik/{Todo → todo}/Todo.js/med.js +0 -0
- package/dist/test/qwik/{Todo → todo}/Todo.tsx/high.tsx +0 -0
- package/dist/test/qwik/{Todo → todo}/Todo.tsx/low.tsx +0 -0
- package/dist/test/qwik/{Todo → todo}/Todo.tsx/med.tsx +0 -0
- package/dist/test/qwik/{Todos → todos}/Todo.tsx/high.tsx +0 -0
- package/dist/test/qwik/{Todos → todos}/Todo.tsx/low.tsx +0 -0
- package/dist/test/qwik/{Todos → todos}/Todo.tsx/med.tsx +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/src/__tests__/data/blocks/tabs.raw.d.ts +0 -11
- package/dist/src/__tests__/data/blocks/tabs.raw.jsx +0 -24
- package/dist/src/__tests__/qoot.test.d.ts +0 -1
- package/dist/src/__tests__/qoot.test.js +0 -115
- package/dist/src/generators/jsx-lite.d.ts +0 -10
- package/dist/src/generators/jsx-lite.js +0 -176
- package/dist/src/generators/qoot.d.ts +0 -21
- package/dist/src/generators/qoot.js +0 -442
- package/dist/src/generators/qwik.d.ts +0 -21
- package/dist/src/generators/qwik.js +0 -458
- package/dist/src/helpers/create-jsx-lite-component.d.ts +0 -2
- package/dist/src/helpers/create-jsx-lite-component.js +0 -16
- package/dist/src/helpers/create-jsx-lite-context.d.ts +0 -4
- package/dist/src/helpers/create-jsx-lite-context.js +0 -18
- package/dist/src/helpers/create-jsx-lite-node.d.ts +0 -2
- package/dist/src/helpers/create-jsx-lite-node.js +0 -16
- package/dist/src/helpers/is-jsx-lite-node.d.ts +0 -2
- package/dist/src/helpers/is-jsx-lite-node.js +0 -7
- package/dist/src/types/jsx-lite-component.d.ts +0 -63
- package/dist/src/types/jsx-lite-context.d.ts +0 -6
- package/dist/src/types/jsx-lite-node.d.ts +0 -13
- package/dist/src/types/jsx-lite-node.js +0 -2
- package/dist/src/types/jsx-lite-styles.d.ts +0 -1
- package/dist/src/types/jsx-lite-styles.js +0 -2
- package/dist/test/qoot/Todo/bundle.js +0 -88
- package/dist/test/qoot/Todo/component.ts +0 -17
- package/dist/test/qoot/Todo/onButtonClick.ts +0 -13
- package/dist/test/qoot/Todo/onInput2Blur.ts +0 -11
- package/dist/test/qoot/Todo/onInput2KeyUp.ts +0 -10
- package/dist/test/qoot/Todo/onInputClick.ts +0 -10
- package/dist/test/qoot/Todo/onLabelDblClick.ts +0 -11
- package/dist/test/qoot/Todo/public.ts +0 -4
- package/dist/test/qoot/Todo/template.tsx +0 -46
- package/dist/test/qoot/Todos/component.ts +0 -9
- package/dist/test/qoot/Todos/onInputClick.ts +0 -14
- package/dist/test/qoot/Todos/public.ts +0 -3
- package/dist/test/qoot/Todos/template.tsx +0 -30
- package/dist/test/qwik/Todo/bundle.js +0 -46
- package/dist/test/qwik/Todo/component.ts +0 -17
- package/dist/test/qwik/Todo/onButtonClick.ts +0 -10
- package/dist/test/qwik/Todo/onInput2Blur.ts +0 -14
- package/dist/test/qwik/Todo/onInput2KeyUp.ts +0 -10
- package/dist/test/qwik/Todo/onInputClick.ts +0 -13
- package/dist/test/qwik/Todo/onLabelDblClick.ts +0 -11
- package/dist/test/qwik/Todo/public.ts +0 -3
- package/dist/test/qwik/Todo/template.tsx +0 -46
- package/dist/test/qwik/Todo.ts +0 -4
- package/dist/test/qwik/Todo_component.ts +0 -17
- package/dist/test/qwik/Todo_onButtonClick.ts +0 -13
- package/dist/test/qwik/Todo_onInput2Blur.ts +0 -14
- package/dist/test/qwik/Todo_onInput2KeyUp.ts +0 -10
- package/dist/test/qwik/Todo_onInputClick.ts +0 -13
- package/dist/test/qwik/Todo_onLabelDblClick.ts +0 -14
- package/dist/test/qwik/Todo_template.tsx +0 -46
- package/dist/test/qwik/Todos/component.ts +0 -9
- package/dist/test/qwik/Todos/onInputClick.ts +0 -14
- package/dist/test/qwik/Todos/public.ts +0 -3
- package/dist/test/qwik/Todos/template.tsx +0 -30
- package/dist/test/qwik/Todos.ts +0 -3
- package/dist/test/qwik/Todos_component.ts +0 -9
- package/dist/test/qwik/Todos_onInputClick.ts +0 -14
- package/dist/test/qwik/Todos_template.tsx +0 -30
- package/dist/test/qwik/qwik/Image/high.js +0 -1
- package/dist/test/qwik/qwik/Image/low.js +0 -75
- package/dist/test/qwik/qwik/Image/med.js +0 -9
- package/dist/test/qwik/qwik/Image.slow/high.js +0 -1
- package/dist/test/qwik/qwik/Image.slow/low.js +0 -75
- package/dist/test/qwik/qwik/Image.slow/med.js +0 -9
- package/dist/test/qwik/qwik/button/high.js +0 -8
- package/dist/test/qwik/qwik/button/low.js +0 -34
- package/dist/test/qwik/qwik/button/med.js +0 -9
- package/dist/test/qwik/qwik/hello_world/stylesheet/high.jsx +0 -1
- package/dist/test/qwik/qwik/hello_world/stylesheet/low.jsx +0 -24
- package/dist/test/qwik/qwik/hello_world/stylesheet/med.jsx +0 -9
- package/dist/test/qwik/qwik/page-with-symbol/high.js +0 -1
- package/dist/test/qwik/qwik/page-with-symbol/low.js +0 -49
- package/dist/test/qwik/qwik/page-with-symbol/med.js +0 -9
- package/dist/test/qwik/qwik/svg/high.js +0 -1
- package/dist/test/qwik/qwik/svg/low.js +0 -30
- package/dist/test/qwik/qwik/svg/med.js +0 -9
- package/dist/test/qwik/qwik/todo/Todo.cjs/high.cjs +0 -31
- package/dist/test/qwik/qwik/todo/Todo.cjs/low.cjs +0 -1
- package/dist/test/qwik/qwik/todo/Todo.cjs/med.cjs +0 -59
- package/dist/test/qwik/qwik/todo/Todo.js/high.js +0 -5
- package/dist/test/qwik/qwik/todo/Todo.js/med.js +0 -1
- package/dist/test/qwik/qwik/todo/Todo.tsx/high.tsx +0 -30
- package/dist/test/qwik/qwik/todo/Todo.tsx/low.tsx +0 -1
- package/dist/test/qwik/qwik/todo/Todo.tsx/med.tsx +0 -34
- package/dist/test/qwik/qwik/todos/Todo.tsx/high.tsx +0 -12
- package/dist/test/qwik/qwik/todos/Todo.tsx/low.tsx +0 -24
- package/dist/test/qwik/qwik/todos/Todo.tsx/med.tsx +0 -8
|
@@ -29,10 +29,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
__setModuleDefault(result, mod);
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
33
|
-
for (var i = 0,
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
33
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
34
|
+
if (ar || !(i in from)) {
|
|
35
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
36
|
+
ar[i] = from[i];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
40
|
};
|
|
37
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -63,8 +67,8 @@ function updateQueryParam(uri, key, value) {
|
|
|
63
67
|
}
|
|
64
68
|
var wrapOutput = function (node, child, components) {
|
|
65
69
|
var inputNames = getComponentInputNames(node.name);
|
|
66
|
-
exports.compileAwayBuilderComponentsFromTree(child, components);
|
|
67
|
-
return create_mitosis_node_1.createMitosisNode(__assign(__assign({}, node), { properties: __assign({}, lodash_1.omit.apply(void 0, __spreadArray([node.properties], inputNames))), bindings: __assign({}, lodash_1.omit.apply(void 0, __spreadArray([node.bindings], inputNames))),
|
|
70
|
+
(0, exports.compileAwayBuilderComponentsFromTree)(child, components);
|
|
71
|
+
return (0, create_mitosis_node_1.createMitosisNode)(__assign(__assign({}, node), { properties: __assign({}, lodash_1.omit.apply(void 0, __spreadArray([node.properties], inputNames, false))), bindings: __assign({}, lodash_1.omit.apply(void 0, __spreadArray([node.bindings], inputNames, false))),
|
|
68
72
|
// TODO: forward tagName as a $tagName="..."
|
|
69
73
|
name: node.properties._tagName || node.properties.$tagName || 'div', children: Array.isArray(child) ? child : [child] }));
|
|
70
74
|
};
|
|
@@ -85,14 +89,14 @@ exports.components = {
|
|
|
85
89
|
bindings.innerHTML = node.properties.text;
|
|
86
90
|
}
|
|
87
91
|
if ('openInNewTab' in node.bindings) {
|
|
88
|
-
bindings.target = node.bindings.openInNewTab
|
|
92
|
+
bindings.target = "".concat(node.bindings.openInNewTab, " ? '_blank' : '_self'");
|
|
89
93
|
}
|
|
90
94
|
var omitFields = ['link', 'openInNewTab', 'text'];
|
|
91
95
|
var hasLink = node.properties.link || node.bindings.link;
|
|
92
|
-
return create_mitosis_node_1.createMitosisNode(__assign(__assign({}, node), { name: hasLink ? 'a' : node.properties.$tagName || 'span', properties: __assign(__assign({}, lodash_1.omit(node.properties, omitFields)), properties), bindings: __assign(__assign({}, lodash_1.omit(node.bindings, omitFields)), bindings) }));
|
|
96
|
+
return (0, create_mitosis_node_1.createMitosisNode)(__assign(__assign({}, node), { name: hasLink ? 'a' : node.properties.$tagName || 'span', properties: __assign(__assign({}, (0, lodash_1.omit)(node.properties, omitFields)), properties), bindings: __assign(__assign({}, (0, lodash_1.omit)(node.bindings, omitFields)), bindings) }));
|
|
93
97
|
},
|
|
94
98
|
Embed: function (node, context, components) {
|
|
95
|
-
return wrapOutput(node, create_mitosis_node_1.createMitosisNode({
|
|
99
|
+
return wrapOutput(node, (0, create_mitosis_node_1.createMitosisNode)({
|
|
96
100
|
name: node.properties.builderTag || 'div',
|
|
97
101
|
properties: {
|
|
98
102
|
innerHTML: node.properties.content || '',
|
|
@@ -104,27 +108,27 @@ exports.components = {
|
|
|
104
108
|
var accordionItems = JSON5.parse(itemsJSON);
|
|
105
109
|
var children = accordionItems.map(function (accordionItem) {
|
|
106
110
|
var titleChildren = accordionItem.title.map(function (element) {
|
|
107
|
-
return builder_1.builderElementToMitosisNode(element, {
|
|
111
|
+
return (0, builder_1.builderElementToMitosisNode)(element, {
|
|
108
112
|
includeBuilderExtras: true,
|
|
109
113
|
preserveTextBlocks: true,
|
|
110
114
|
});
|
|
111
115
|
});
|
|
112
116
|
var detailChildren = accordionItem.detail.map(function (element) {
|
|
113
|
-
return builder_1.builderElementToMitosisNode(element, {
|
|
117
|
+
return (0, builder_1.builderElementToMitosisNode)(element, {
|
|
114
118
|
includeBuilderExtras: true,
|
|
115
119
|
preserveTextBlocks: true,
|
|
116
120
|
});
|
|
117
121
|
});
|
|
118
|
-
return create_mitosis_node_1.createMitosisNode({
|
|
122
|
+
return (0, create_mitosis_node_1.createMitosisNode)({
|
|
119
123
|
name: 'div',
|
|
120
124
|
properties: { builder: 'accordion' },
|
|
121
125
|
children: [
|
|
122
|
-
create_mitosis_node_1.createMitosisNode({
|
|
126
|
+
(0, create_mitosis_node_1.createMitosisNode)({
|
|
123
127
|
name: 'div',
|
|
124
128
|
properties: { builder: 'accordion-title' },
|
|
125
129
|
children: titleChildren,
|
|
126
130
|
}),
|
|
127
|
-
create_mitosis_node_1.createMitosisNode({
|
|
131
|
+
(0, create_mitosis_node_1.createMitosisNode)({
|
|
128
132
|
name: 'div',
|
|
129
133
|
properties: { builder: 'accordion-detail' },
|
|
130
134
|
children: detailChildren,
|
|
@@ -132,7 +136,7 @@ exports.components = {
|
|
|
132
136
|
],
|
|
133
137
|
});
|
|
134
138
|
});
|
|
135
|
-
return wrapOutput(node, create_mitosis_node_1.createMitosisNode({
|
|
139
|
+
return wrapOutput(node, (0, create_mitosis_node_1.createMitosisNode)({
|
|
136
140
|
name: node.properties.builderTag || 'div',
|
|
137
141
|
properties: {
|
|
138
142
|
$name: 'accordion',
|
|
@@ -142,27 +146,27 @@ exports.components = {
|
|
|
142
146
|
},
|
|
143
147
|
BuilderMasonry: function () {
|
|
144
148
|
// TODO
|
|
145
|
-
return create_mitosis_node_1.createMitosisNode({
|
|
149
|
+
return (0, create_mitosis_node_1.createMitosisNode)({
|
|
146
150
|
name: 'div',
|
|
147
151
|
properties: { 'data-missing-component': 'BuilderMasonry' },
|
|
148
152
|
});
|
|
149
153
|
},
|
|
150
154
|
BuilderTabs: function () {
|
|
151
155
|
// TODO
|
|
152
|
-
return create_mitosis_node_1.createMitosisNode({
|
|
156
|
+
return (0, create_mitosis_node_1.createMitosisNode)({
|
|
153
157
|
name: 'div',
|
|
154
158
|
properties: { 'data-missing-component': 'BuilderTabs' },
|
|
155
159
|
});
|
|
156
160
|
},
|
|
157
161
|
BuilderCarousel: function () {
|
|
158
162
|
// TODO
|
|
159
|
-
return create_mitosis_node_1.createMitosisNode({
|
|
163
|
+
return (0, create_mitosis_node_1.createMitosisNode)({
|
|
160
164
|
name: 'div',
|
|
161
165
|
properties: { 'data-missing-component': 'BuilderCarousel' },
|
|
162
166
|
});
|
|
163
167
|
},
|
|
164
168
|
CustomCode: function (node, context, components) {
|
|
165
|
-
return wrapOutput(node, create_mitosis_node_1.createMitosisNode({
|
|
169
|
+
return wrapOutput(node, (0, create_mitosis_node_1.createMitosisNode)({
|
|
166
170
|
name: node.properties.builderTag || 'div',
|
|
167
171
|
properties: {
|
|
168
172
|
innerHTML: node.properties.code || '',
|
|
@@ -170,7 +174,7 @@ exports.components = {
|
|
|
170
174
|
}), components);
|
|
171
175
|
},
|
|
172
176
|
CoreSection: function (node, context, components) {
|
|
173
|
-
return wrapOutput(node, create_mitosis_node_1.createMitosisNode({
|
|
177
|
+
return wrapOutput(node, (0, create_mitosis_node_1.createMitosisNode)({
|
|
174
178
|
name: 'section',
|
|
175
179
|
properties: __assign(__assign(__assign({}, node.properties), { $name: 'section' }), (node.bindings.lazyLoad === 'true' && {
|
|
176
180
|
lazyLoad: 'true',
|
|
@@ -181,9 +185,9 @@ exports.components = {
|
|
|
181
185
|
alignSelf: 'stretch',
|
|
182
186
|
flexGrow: '1',
|
|
183
187
|
boxSizing: 'border-box',
|
|
184
|
-
maxWidth: ((node.bindings.maxWidth &&
|
|
188
|
+
maxWidth: "".concat((node.bindings.maxWidth &&
|
|
185
189
|
Number(node.bindings.maxWidth)) ||
|
|
186
|
-
1200
|
|
190
|
+
1200, "px"),
|
|
187
191
|
display: 'flex',
|
|
188
192
|
flexDirection: 'column',
|
|
189
193
|
alignItems: 'stretch',
|
|
@@ -207,10 +211,10 @@ exports.components = {
|
|
|
207
211
|
}
|
|
208
212
|
function getColumnWidth(index) {
|
|
209
213
|
var subtractWidth = (gutterSize * (columns.length - 1)) / columns.length;
|
|
210
|
-
return "calc("
|
|
214
|
+
return "calc(".concat(getWidth(index), "% - ").concat(subtractWidth, "px)");
|
|
211
215
|
}
|
|
212
216
|
var properties = node.properties;
|
|
213
|
-
return wrapOutput(node, create_mitosis_node_1.createMitosisNode({
|
|
217
|
+
return wrapOutput(node, (0, create_mitosis_node_1.createMitosisNode)({
|
|
214
218
|
name: 'div',
|
|
215
219
|
properties: {
|
|
216
220
|
class: 'builder-columns',
|
|
@@ -219,7 +223,7 @@ exports.components = {
|
|
|
219
223
|
css: JSON.stringify(__assign({ display: 'flex' }, (properties.stackColumnsAt === 'never'
|
|
220
224
|
? {}
|
|
221
225
|
: (_a = {},
|
|
222
|
-
_a["@media (max-width: "
|
|
226
|
+
_a["@media (max-width: ".concat(properties.stackColumnsAt !== 'tablet' ? 639 : 999, "px)")] = {
|
|
223
227
|
flexDirection: properties.reverseColumnsWhenStacked === 'true'
|
|
224
228
|
? 'column-reverse'
|
|
225
229
|
: 'column',
|
|
@@ -229,17 +233,17 @@ exports.components = {
|
|
|
229
233
|
},
|
|
230
234
|
children: columns.map(function (col, index) {
|
|
231
235
|
var _a;
|
|
232
|
-
return create_mitosis_node_1.createMitosisNode({
|
|
236
|
+
return (0, create_mitosis_node_1.createMitosisNode)({
|
|
233
237
|
name: 'div',
|
|
234
238
|
properties: {
|
|
235
239
|
$name: 'column',
|
|
236
240
|
class: 'builder-column',
|
|
237
241
|
},
|
|
238
242
|
bindings: {
|
|
239
|
-
css: JSON.stringify(__assign({ display: 'flex', flexDirection: 'column', alignItems: 'stretch', lineHeight: 'normal', width: ""
|
|
243
|
+
css: JSON.stringify(__assign({ display: 'flex', flexDirection: 'column', alignItems: 'stretch', lineHeight: 'normal', width: "".concat(getColumnWidth(index)), marginLeft: "".concat(index === 0 ? 0 : gutterSize, "px") }, (properties.stackColumnsAt === 'never'
|
|
240
244
|
? {}
|
|
241
245
|
: (_a = {},
|
|
242
|
-
_a["@media (max-width: "
|
|
246
|
+
_a["@media (max-width: ".concat(properties.stackColumnsAt !== 'tablet' ? 639 : 999, "px)")] = {
|
|
243
247
|
width: '100%',
|
|
244
248
|
marginLeft: 0,
|
|
245
249
|
},
|
|
@@ -261,23 +265,23 @@ exports.components = {
|
|
|
261
265
|
aspectRatio = null;
|
|
262
266
|
}
|
|
263
267
|
var srcSet = srcset ||
|
|
264
|
-
""
|
|
268
|
+
"".concat((node.properties.image || '').match(/builder\.io/)
|
|
265
269
|
? widths
|
|
266
270
|
.map(function (size) {
|
|
267
|
-
return updateQueryParam(node.properties.image, 'width', String(size))
|
|
271
|
+
return "".concat(updateQueryParam(node.properties.image, 'width', String(size)), " ").concat(size, "w");
|
|
268
272
|
})
|
|
269
273
|
.concat([node.properties.image])
|
|
270
274
|
.join(', ')
|
|
271
275
|
: '');
|
|
272
276
|
var source = node.bindings.noWebp !== 'true' &&
|
|
273
|
-
create_mitosis_node_1.createMitosisNode({
|
|
277
|
+
(0, create_mitosis_node_1.createMitosisNode)({
|
|
274
278
|
name: 'source',
|
|
275
279
|
properties: {
|
|
276
280
|
srcset: srcSet.replace(/\?/g, '?format=webp&'),
|
|
277
281
|
type: 'image/webp',
|
|
278
282
|
},
|
|
279
283
|
});
|
|
280
|
-
var img = create_mitosis_node_1.createMitosisNode({
|
|
284
|
+
var img = (0, create_mitosis_node_1.createMitosisNode)({
|
|
281
285
|
name: 'img',
|
|
282
286
|
properties: noUndefined({
|
|
283
287
|
$name: 'image',
|
|
@@ -301,12 +305,12 @@ exports.components = {
|
|
|
301
305
|
: {}))),
|
|
302
306
|
}),
|
|
303
307
|
});
|
|
304
|
-
var picture = create_mitosis_node_1.createMitosisNode({
|
|
308
|
+
var picture = (0, create_mitosis_node_1.createMitosisNode)({
|
|
305
309
|
name: 'picture',
|
|
306
310
|
children: source ? [source, img] : [img],
|
|
307
311
|
});
|
|
308
312
|
var imgSizer = aspectRatio &&
|
|
309
|
-
create_mitosis_node_1.createMitosisNode({
|
|
313
|
+
(0, create_mitosis_node_1.createMitosisNode)({
|
|
310
314
|
name: 'div',
|
|
311
315
|
properties: {
|
|
312
316
|
$name: 'image-sizer',
|
|
@@ -323,7 +327,7 @@ exports.components = {
|
|
|
323
327
|
});
|
|
324
328
|
var children = node.children &&
|
|
325
329
|
node.children.length &&
|
|
326
|
-
create_mitosis_node_1.createMitosisNode({
|
|
330
|
+
(0, create_mitosis_node_1.createMitosisNode)({
|
|
327
331
|
name: 'div',
|
|
328
332
|
properties: {
|
|
329
333
|
$name: 'image-contents',
|
|
@@ -355,7 +359,7 @@ exports.components = {
|
|
|
355
359
|
aspectRatio = null;
|
|
356
360
|
}
|
|
357
361
|
var videoContainerNodes = [];
|
|
358
|
-
videoContainerNodes.push(create_mitosis_node_1.createMitosisNode({
|
|
362
|
+
videoContainerNodes.push((0, create_mitosis_node_1.createMitosisNode)({
|
|
359
363
|
name: 'video',
|
|
360
364
|
properties: noUndefined({
|
|
361
365
|
$name: 'builder-video',
|
|
@@ -384,7 +388,7 @@ exports.components = {
|
|
|
384
388
|
}),
|
|
385
389
|
}),
|
|
386
390
|
children: [
|
|
387
|
-
create_mitosis_node_1.createMitosisNode({
|
|
391
|
+
(0, create_mitosis_node_1.createMitosisNode)({
|
|
388
392
|
name: 'source',
|
|
389
393
|
properties: {
|
|
390
394
|
type: 'video/mp4',
|
|
@@ -397,7 +401,7 @@ exports.components = {
|
|
|
397
401
|
],
|
|
398
402
|
}));
|
|
399
403
|
aspectRatio &&
|
|
400
|
-
videoContainerNodes.push(create_mitosis_node_1.createMitosisNode({
|
|
404
|
+
videoContainerNodes.push((0, create_mitosis_node_1.createMitosisNode)({
|
|
401
405
|
name: 'div',
|
|
402
406
|
properties: {
|
|
403
407
|
$name: 'builder-video-sizer',
|
|
@@ -413,7 +417,7 @@ exports.components = {
|
|
|
413
417
|
}));
|
|
414
418
|
node.children &&
|
|
415
419
|
node.children.length &&
|
|
416
|
-
videoContainerNodes.push(create_mitosis_node_1.createMitosisNode({
|
|
420
|
+
videoContainerNodes.push((0, create_mitosis_node_1.createMitosisNode)({
|
|
417
421
|
name: 'div',
|
|
418
422
|
properties: {
|
|
419
423
|
$name: 'image-contents',
|
|
@@ -432,7 +436,7 @@ exports.components = {
|
|
|
432
436
|
},
|
|
433
437
|
children: node.children,
|
|
434
438
|
}));
|
|
435
|
-
var videoContainer = create_mitosis_node_1.createMitosisNode({
|
|
439
|
+
var videoContainer = (0, create_mitosis_node_1.createMitosisNode)({
|
|
436
440
|
name: 'div',
|
|
437
441
|
properties: {
|
|
438
442
|
$name: 'video-container',
|
|
@@ -446,8 +450,8 @@ exports.components = {
|
|
|
446
450
|
},
|
|
447
451
|
};
|
|
448
452
|
var compileAwayBuilderComponentsFromTree = function (tree, components) {
|
|
449
|
-
traverse_1.default(tree).forEach(function (item) {
|
|
450
|
-
if (is_mitosis_node_1.isMitosisNode(item)) {
|
|
453
|
+
(0, traverse_1.default)(tree).forEach(function (item) {
|
|
454
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
451
455
|
var mapper = components[item.name];
|
|
452
456
|
if (mapper) {
|
|
453
457
|
var result = mapper(item, this, components);
|
|
@@ -463,15 +467,15 @@ var compileAwayBuilderComponents = function (pluginOptions) {
|
|
|
463
467
|
if (pluginOptions === void 0) { pluginOptions = {}; }
|
|
464
468
|
var obj = exports.components;
|
|
465
469
|
if (pluginOptions.omit) {
|
|
466
|
-
obj = lodash_1.omit(obj, pluginOptions.omit);
|
|
470
|
+
obj = (0, lodash_1.omit)(obj, pluginOptions.omit);
|
|
467
471
|
}
|
|
468
472
|
if (pluginOptions.only) {
|
|
469
|
-
obj = lodash_1.pick(obj, pluginOptions.only);
|
|
473
|
+
obj = (0, lodash_1.pick)(obj, pluginOptions.only);
|
|
470
474
|
}
|
|
471
475
|
return function (options) { return ({
|
|
472
476
|
json: {
|
|
473
477
|
pre: function (json) {
|
|
474
|
-
exports.compileAwayBuilderComponentsFromTree(json, exports.components);
|
|
478
|
+
(0, exports.compileAwayBuilderComponentsFromTree)(json, exports.components);
|
|
475
479
|
},
|
|
476
480
|
},
|
|
477
481
|
}); };
|
|
@@ -19,7 +19,7 @@ var lodash_1 = require("lodash");
|
|
|
19
19
|
var traverse_1 = __importDefault(require("traverse"));
|
|
20
20
|
var is_mitosis_node_1 = require("../helpers/is-mitosis-node");
|
|
21
21
|
var getRenderOptions = function (node) {
|
|
22
|
-
return __assign(__assign({}, lodash_1.mapValues(node.properties, function (value) { return "\""
|
|
22
|
+
return __assign(__assign({}, (0, lodash_1.mapValues)(node.properties, function (value) { return "\"".concat(value, "\""); })), (0, lodash_1.mapValues)(node.bindings, function (value) { return "{".concat(value, "}"); }));
|
|
23
23
|
};
|
|
24
24
|
exports.getRenderOptions = getRenderOptions;
|
|
25
25
|
/**
|
|
@@ -41,8 +41,8 @@ exports.getRenderOptions = getRenderOptions;
|
|
|
41
41
|
var compileAwayComponents = function (pluginOptions) { return function (options) { return ({
|
|
42
42
|
json: {
|
|
43
43
|
pre: function (json) {
|
|
44
|
-
traverse_1.default(json).forEach(function (item) {
|
|
45
|
-
if (is_mitosis_node_1.isMitosisNode(item)) {
|
|
44
|
+
(0, traverse_1.default)(json).forEach(function (item) {
|
|
45
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
46
46
|
var mapper = pluginOptions.components[item.name];
|
|
47
47
|
if (mapper) {
|
|
48
48
|
var result = mapper(item, this);
|
|
@@ -6,9 +6,9 @@ var traverse_nodes_1 = require("../helpers/traverse-nodes");
|
|
|
6
6
|
var mapStyles = function (pluginOptions) { return function (options) { return ({
|
|
7
7
|
json: {
|
|
8
8
|
pre: function (json) {
|
|
9
|
-
traverse_nodes_1.tarverseNodes(json, function (node, context) {
|
|
10
|
-
var styles = get_styles_1.getStyles(node);
|
|
11
|
-
get_styles_1.setStyles(node, pluginOptions.map(styles || {}, context));
|
|
9
|
+
(0, traverse_nodes_1.tarverseNodes)(json, function (node, context) {
|
|
10
|
+
var styles = (0, get_styles_1.getStyles)(node);
|
|
11
|
+
(0, get_styles_1.setStyles)(node, pluginOptions.map(styles || {}, context));
|
|
12
12
|
});
|
|
13
13
|
},
|
|
14
14
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const targets: {
|
|
2
|
+
angular: (options?: import("./generators/angular").ToAngularOptions) => import(".").Transpiler;
|
|
3
|
+
builder: (options?: import("./generators/builder").ToBuilderOptions) => ({ component, }: import(".").TranspilerArgs) => {
|
|
4
|
+
data: {
|
|
5
|
+
httpRequests: any;
|
|
6
|
+
jsCode: string;
|
|
7
|
+
tsCode: string;
|
|
8
|
+
blocks: import("@builder.io/sdk").BuilderElement[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
customElement: (options?: import("./generators/html").ToHtmlOptions) => import(".").Transpiler;
|
|
12
|
+
html: (options?: import("./generators/html").ToHtmlOptions) => import(".").Transpiler;
|
|
13
|
+
mitosis: (toMitosisOptions?: Partial<import("./generators/mitosis").ToMitosisOptions>) => import(".").Transpiler;
|
|
14
|
+
liquid: (options?: import("./generators/liquid").ToLiquidOptions) => import(".").Transpiler;
|
|
15
|
+
react: (reactOptions?: import("./generators/react").ToReactOptions) => import(".").Transpiler;
|
|
16
|
+
reactNative: (options?: import("./generators/react-native").ToReactNativeOptions) => import(".").Transpiler;
|
|
17
|
+
solid: (options?: import("./generators/solid").ToSolidOptions) => import(".").Transpiler;
|
|
18
|
+
svelte: (options?: import("./generators/svelte").ToSvelteOptions) => import(".").Transpiler;
|
|
19
|
+
swift: (options?: import("./generators/swift-ui").ToSwiftOptions) => import(".").Transpiler;
|
|
20
|
+
template: (options?: import("./generators/template").ToTemplateOptions) => import(".").Transpiler;
|
|
21
|
+
vue: (options?: import("./generators/vue").ToVueOptions) => ({ component, path }: import(".").TranspilerArgs & {
|
|
22
|
+
path: string;
|
|
23
|
+
}) => string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.targets = void 0;
|
|
4
|
+
var angular_1 = require("./generators/angular");
|
|
5
|
+
var builder_1 = require("./generators/builder");
|
|
6
|
+
var html_1 = require("./generators/html");
|
|
7
|
+
var mitosis_1 = require("./generators/mitosis");
|
|
8
|
+
var liquid_1 = require("./generators/liquid");
|
|
9
|
+
var react_1 = require("./generators/react");
|
|
10
|
+
var react_native_1 = require("./generators/react-native");
|
|
11
|
+
var solid_1 = require("./generators/solid");
|
|
12
|
+
var svelte_1 = require("./generators/svelte");
|
|
13
|
+
var swift_ui_1 = require("./generators/swift-ui");
|
|
14
|
+
var template_1 = require("./generators/template");
|
|
15
|
+
var vue_1 = require("./generators/vue");
|
|
16
|
+
exports.targets = {
|
|
17
|
+
angular: angular_1.componentToAngular,
|
|
18
|
+
builder: builder_1.componentToBuilder,
|
|
19
|
+
customElement: html_1.componentToCustomElement,
|
|
20
|
+
html: html_1.componentToHtml,
|
|
21
|
+
mitosis: mitosis_1.componentToMitosis,
|
|
22
|
+
liquid: liquid_1.componentToLiquid,
|
|
23
|
+
react: react_1.componentToReact,
|
|
24
|
+
reactNative: react_native_1.componentToReactNative,
|
|
25
|
+
solid: solid_1.componentToSolid,
|
|
26
|
+
svelte: svelte_1.componentToSvelte,
|
|
27
|
+
swift: swift_ui_1.componentToSwift,
|
|
28
|
+
template: template_1.componentToTemplate,
|
|
29
|
+
vue: vue_1.componentToVue,
|
|
30
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MitosisComponent } from '..';
|
|
2
|
+
import { Plugin } from './plugins';
|
|
3
|
+
declare type Targets = typeof import('../targets').targets;
|
|
4
|
+
export declare type Target = keyof Targets;
|
|
5
|
+
export declare type GeneratorOptions = {
|
|
6
|
+
[K in keyof Targets]: NonNullable<Parameters<Targets[K]>[0]>;
|
|
7
|
+
};
|
|
8
|
+
declare type FileInfo = {
|
|
9
|
+
path: string;
|
|
10
|
+
content: string;
|
|
11
|
+
target: string;
|
|
12
|
+
};
|
|
13
|
+
export interface TranspilerArgs {
|
|
14
|
+
path?: string;
|
|
15
|
+
component: MitosisComponent;
|
|
16
|
+
}
|
|
17
|
+
export declare type Transpiler = (args: TranspilerArgs) => string;
|
|
18
|
+
export interface BaseTranspilerOptions {
|
|
19
|
+
prettier?: boolean;
|
|
20
|
+
plugins?: Plugin[];
|
|
21
|
+
}
|
|
22
|
+
export declare type MitosisConfig = {
|
|
23
|
+
type?: 'library';
|
|
24
|
+
targets: Target[];
|
|
25
|
+
dest?: string;
|
|
26
|
+
files?: string | string[];
|
|
27
|
+
overridesDir?: string;
|
|
28
|
+
mapFile?: (info: FileInfo) => FileInfo | Promise<FileInfo>;
|
|
29
|
+
options: Partial<GeneratorOptions>;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MitosisComponent } from './mitosis-component';
|
|
2
|
+
export declare type Plugin = (options?: any) => {
|
|
3
|
+
json?: {
|
|
4
|
+
pre?: (json: MitosisComponent) => MitosisComponent | void;
|
|
5
|
+
post?: (json: MitosisComponent) => MitosisComponent | void;
|
|
6
|
+
};
|
|
7
|
+
code?: {
|
|
8
|
+
pre?: (code: string) => string;
|
|
9
|
+
post?: (code: string) => string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|