@builder.io/mitosis 0.0.56-29 → 0.0.56-31
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__/data/advanced-ref.raw.d.ts +4 -0
- package/dist/src/__tests__/data/advanced-ref.raw.jsx +39 -0
- package/dist/src/__tests__/shared.js +26 -0
- package/dist/src/generators/angular.d.ts +1 -0
- package/dist/src/generators/angular.js +17 -7
- package/dist/src/generators/qwik/component.js +8 -8
- package/dist/src/generators/qwik/jsx.js +1 -1
- package/dist/src/generators/react.js +1 -1
- package/dist/src/generators/solid/index.d.ts +3 -0
- package/dist/src/generators/solid/index.js +330 -0
- package/dist/src/generators/solid/state.d.ts +22 -0
- package/dist/src/generators/solid/state.js +158 -0
- package/dist/src/generators/solid/types.d.ts +5 -0
- package/dist/src/generators/solid/types.js +2 -0
- package/dist/src/helpers/babel-transform.js +1 -0
- package/dist/src/helpers/map-refs.js +6 -0
- package/dist/src/helpers/nullable.d.ts +3 -0
- package/dist/src/helpers/nullable.js +7 -0
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +1 -0
- package/dist/src/helpers/strip-state-and-props-refs.js +9 -1
- package/dist/src/helpers/styles/helpers.d.ts +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/src/__tests__/data/show/nested-show.raw copy.d.ts +0 -6
- package/dist/src/__tests__/data/show/nested-show.raw copy.jsx +0 -11
- package/dist/src/__tests__/parse-jsx.test.js +0 -37
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.d.ts +0 -1
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.js +0 -34
- package/dist/src/__tests__/qwik/src-generator.test.d.ts +0 -1
- package/dist/src/__tests__/qwik/src-generator.test.js +0 -65
- package/dist/src/__tests__/qwik.directive.test.d.ts +0 -1
- package/dist/src/__tests__/qwik.directive.test.js +0 -108
- package/dist/src/__tests__/styles.test.js +0 -23
- package/dist/src/helpers/babel-transform.test.d.ts +0 -1
- package/dist/src/helpers/babel-transform.test.js +0 -7
- package/dist/src/helpers/generic-format.test.d.ts +0 -1
- package/dist/src/helpers/generic-format.test.js +0 -8
- package/dist/src/helpers/remove-surrounding-block.test.d.ts +0 -1
- package/dist/src/helpers/remove-surrounding-block.test.js +0 -9
- package/dist/src/helpers/styles/collect-css.test.js +0 -18
- package/dist/test/qwik/Accordion/high.jsx +0 -0
- package/dist/test/qwik/Accordion/low.jsx +0 -225
- package/dist/test/qwik/Accordion/med.jsx +0 -4
- package/dist/test/qwik/For/high.jsx +0 -0
- package/dist/test/qwik/For/low.jsx +0 -43
- package/dist/test/qwik/For/med.jsx +0 -4
- package/dist/test/qwik/Image/high.js +0 -9
- package/dist/test/qwik/Image/low.js +0 -0
- package/dist/test/qwik/Image/med.js +0 -151
- package/dist/test/qwik/Image.slow/high.js +0 -9
- package/dist/test/qwik/Image.slow/low.js +0 -0
- package/dist/test/qwik/Image.slow/med.js +0 -151
- package/dist/test/qwik/bindings/high.cjs +0 -0
- package/dist/test/qwik/bindings/low.cjs +0 -41
- package/dist/test/qwik/bindings/med.cjs +0 -3
- package/dist/test/qwik/button/high.js +0 -3
- package/dist/test/qwik/button/low.js +0 -16
- package/dist/test/qwik/button/med.js +0 -31
- package/dist/test/qwik/component/bindings/high.jsx +0 -0
- package/dist/test/qwik/component/bindings/low.jsx +0 -96
- package/dist/test/qwik/component/bindings/med.jsx +0 -7
- package/dist/test/qwik/component/component/inputs/high.cjsx +0 -9
- package/dist/test/qwik/component/component/inputs/low.cjsx +0 -0
- package/dist/test/qwik/component/component/inputs/med.cjsx +0 -64
- package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
- package/dist/test/qwik/for-loop.bindings/low.cjs +0 -52
- package/dist/test/qwik/for-loop.bindings/med.cjs +0 -5
- package/dist/test/qwik/hello_world/stylesheet/high.jsx +0 -0
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +0 -17
- package/dist/test/qwik/hello_world/stylesheet/med.jsx +0 -4
- package/dist/test/qwik/mount/high.cjs +0 -0
- package/dist/test/qwik/mount/low.cjs +0 -45
- package/dist/test/qwik/mount/med.cjs +0 -3
- package/dist/test/qwik/page-with-symbol/high.js +0 -0
- package/dist/test/qwik/page-with-symbol/low.js +0 -24
- package/dist/test/qwik/page-with-symbol/med.js +0 -4
- package/dist/test/qwik/show-hide/high.jsx +0 -9
- package/dist/test/qwik/show-hide/low.jsx +0 -0
- package/dist/test/qwik/show-hide/med.jsx +0 -177
- package/dist/test/qwik/svg/high.js +0 -0
- package/dist/test/qwik/svg/low.js +0 -21
- package/dist/test/qwik/svg/med.js +0 -4
- package/dist/test/qwik/todo/Todo.cjs/high.cjs +0 -19
- package/dist/test/qwik/todo/Todo.cjs/low.cjs +0 -0
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +0 -47
- package/dist/test/qwik/todo/Todo.js/high.js +0 -19
- package/dist/test/qwik/todo/Todo.js/low.js +0 -0
- package/dist/test/qwik/todo/Todo.js/med.js +0 -44
- package/dist/test/qwik/todo/Todo.tsx/high.tsx +0 -19
- package/dist/test/qwik/todo/Todo.tsx/low.tsx +0 -0
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +0 -40
- package/dist/test/qwik/todos/Todo.tsx/high.tsx +0 -7
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +0 -29
- package/dist/test/qwik/todos/Todo.tsx/med.tsx +0 -4
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicRefComponent(props) {
|
|
5
|
+
var inputRef = (0, mitosis_1.useRef)(null);
|
|
6
|
+
var inputNoArgRef = (0, mitosis_1.useRef)(null);
|
|
7
|
+
var state = (0, mitosis_1.useStore)({
|
|
8
|
+
name: 'PatrickJS',
|
|
9
|
+
});
|
|
10
|
+
function onBlur() {
|
|
11
|
+
// Maintain focus
|
|
12
|
+
inputRef.focus();
|
|
13
|
+
}
|
|
14
|
+
function lowerCaseName() {
|
|
15
|
+
return state.name.toLowerCase();
|
|
16
|
+
}
|
|
17
|
+
(0, mitosis_1.onUpdate)(function () {
|
|
18
|
+
console.log('Received an update');
|
|
19
|
+
}, [inputRef, inputNoArgRef]);
|
|
20
|
+
return (<div>
|
|
21
|
+
{props.showInput && (<>
|
|
22
|
+
<input ref={inputRef} css={{
|
|
23
|
+
color: 'red',
|
|
24
|
+
}} value={state.name} onBlur={function (event) { return onBlur(); }} onChange={function (event) { return (state.name = event.target.value); }}/>
|
|
25
|
+
|
|
26
|
+
<label ref={inputNoArgRef} for="cars">
|
|
27
|
+
Choose a car:
|
|
28
|
+
</label>
|
|
29
|
+
|
|
30
|
+
<select name="cars" id="cars">
|
|
31
|
+
<option value="supra">GR Supra</option>
|
|
32
|
+
<option value="86">GR 86</option>
|
|
33
|
+
</select>
|
|
34
|
+
</>)}
|
|
35
|
+
Hello
|
|
36
|
+
{lowerCaseName()}! I can run in React, Qwik, Vue, Solid, or Web Component!
|
|
37
|
+
</div>);
|
|
38
|
+
}
|
|
39
|
+
exports.default = MyBasicRefComponent;
|
|
@@ -128,6 +128,12 @@ var SHOW_TESTS = {
|
|
|
128
128
|
nestedShow: require('./data/show/nested-show.raw'),
|
|
129
129
|
showWithFor: require('./data/show/show-with-for.raw'),
|
|
130
130
|
};
|
|
131
|
+
var ADVANCED_REF = {
|
|
132
|
+
AdvancedRef: require('./data/advanced-ref.raw'),
|
|
133
|
+
};
|
|
134
|
+
var ON_UPDATE_RETURN = {
|
|
135
|
+
basicOnUpdateReturn: require('./data/basic-onUpdate-return.raw'),
|
|
136
|
+
};
|
|
131
137
|
var TESTS_FOR_TARGET = {
|
|
132
138
|
react: [
|
|
133
139
|
BASIC_TESTS,
|
|
@@ -136,6 +142,8 @@ var TESTS_FOR_TARGET = {
|
|
|
136
142
|
FORWARD_REF_TESTS,
|
|
137
143
|
MULTI_ON_UPDATE_TESTS,
|
|
138
144
|
FORM_BLOCK_TESTS,
|
|
145
|
+
ADVANCED_REF,
|
|
146
|
+
ON_UPDATE_RETURN,
|
|
139
147
|
// FOR_SHOW_TESTS,
|
|
140
148
|
],
|
|
141
149
|
angular: [
|
|
@@ -146,6 +154,8 @@ var TESTS_FOR_TARGET = {
|
|
|
146
154
|
MULTI_ON_UPDATE_TESTS,
|
|
147
155
|
FORM_BLOCK_TESTS,
|
|
148
156
|
FOR_SHOW_TESTS,
|
|
157
|
+
ADVANCED_REF,
|
|
158
|
+
ON_UPDATE_RETURN,
|
|
149
159
|
],
|
|
150
160
|
webcomponent: [
|
|
151
161
|
BASIC_TESTS,
|
|
@@ -154,6 +164,8 @@ var TESTS_FOR_TARGET = {
|
|
|
154
164
|
FORWARD_REF_TESTS,
|
|
155
165
|
MULTI_ON_UPDATE_TESTS,
|
|
156
166
|
FOR_SHOW_TESTS,
|
|
167
|
+
ADVANCED_REF,
|
|
168
|
+
ON_UPDATE_RETURN,
|
|
157
169
|
// FORM_BLOCK_TESTS
|
|
158
170
|
],
|
|
159
171
|
vue: [
|
|
@@ -164,6 +176,8 @@ var TESTS_FOR_TARGET = {
|
|
|
164
176
|
MULTI_ON_UPDATE_TESTS,
|
|
165
177
|
FORM_BLOCK_TESTS,
|
|
166
178
|
FOR_SHOW_TESTS,
|
|
179
|
+
ADVANCED_REF,
|
|
180
|
+
ON_UPDATE_RETURN,
|
|
167
181
|
],
|
|
168
182
|
svelte: [
|
|
169
183
|
BASIC_TESTS,
|
|
@@ -172,6 +186,8 @@ var TESTS_FOR_TARGET = {
|
|
|
172
186
|
MULTI_ON_UPDATE_TESTS,
|
|
173
187
|
FORM_BLOCK_TESTS,
|
|
174
188
|
FOR_SHOW_TESTS,
|
|
189
|
+
ADVANCED_REF,
|
|
190
|
+
ON_UPDATE_RETURN,
|
|
175
191
|
],
|
|
176
192
|
html: [
|
|
177
193
|
BASIC_TESTS,
|
|
@@ -180,6 +196,8 @@ var TESTS_FOR_TARGET = {
|
|
|
180
196
|
FORWARD_REF_TESTS,
|
|
181
197
|
MULTI_ON_UPDATE_TESTS,
|
|
182
198
|
FOR_SHOW_TESTS,
|
|
199
|
+
ADVANCED_REF,
|
|
200
|
+
ON_UPDATE_RETURN,
|
|
183
201
|
// FORM_BLOCK_TESTS
|
|
184
202
|
],
|
|
185
203
|
stencil: [
|
|
@@ -189,6 +207,8 @@ var TESTS_FOR_TARGET = {
|
|
|
189
207
|
FORWARD_REF_TESTS,
|
|
190
208
|
// MULTI_ON_UPDATE_TESTS,
|
|
191
209
|
FORM_BLOCK_TESTS,
|
|
210
|
+
ADVANCED_REF,
|
|
211
|
+
ON_UPDATE_RETURN,
|
|
192
212
|
// FOR_SHOW_TESTS
|
|
193
213
|
],
|
|
194
214
|
solid: [
|
|
@@ -199,6 +219,8 @@ var TESTS_FOR_TARGET = {
|
|
|
199
219
|
MULTI_ON_UPDATE_TESTS,
|
|
200
220
|
FORM_BLOCK_TESTS,
|
|
201
221
|
FOR_SHOW_TESTS,
|
|
222
|
+
ADVANCED_REF,
|
|
223
|
+
ON_UPDATE_RETURN,
|
|
202
224
|
],
|
|
203
225
|
reactNative: [
|
|
204
226
|
BASIC_TESTS,
|
|
@@ -207,6 +229,8 @@ var TESTS_FOR_TARGET = {
|
|
|
207
229
|
FORWARD_REF_TESTS,
|
|
208
230
|
MULTI_ON_UPDATE_TESTS,
|
|
209
231
|
FORM_BLOCK_TESTS,
|
|
232
|
+
ADVANCED_REF,
|
|
233
|
+
ON_UPDATE_RETURN,
|
|
210
234
|
// FOR_SHOW_TESTS,
|
|
211
235
|
],
|
|
212
236
|
liquid: [
|
|
@@ -216,6 +240,8 @@ var TESTS_FOR_TARGET = {
|
|
|
216
240
|
FORWARD_REF_TESTS,
|
|
217
241
|
MULTI_ON_UPDATE_TESTS,
|
|
218
242
|
FORM_BLOCK_TESTS,
|
|
243
|
+
ADVANCED_REF,
|
|
244
|
+
ON_UPDATE_RETURN,
|
|
219
245
|
],
|
|
220
246
|
qwik: [
|
|
221
247
|
BASIC_TESTS,
|
|
@@ -6,6 +6,7 @@ interface AngularBlockOptions {
|
|
|
6
6
|
contextVars?: string[];
|
|
7
7
|
outputVars?: string[];
|
|
8
8
|
childComponents?: string[];
|
|
9
|
+
domRefs?: string[];
|
|
9
10
|
}
|
|
10
11
|
export declare const blockToAngular: (json: MitosisNode, options?: ToAngularOptions, blockOptions?: AngularBlockOptions) => string;
|
|
11
12
|
export declare const componentToAngular: (options?: ToAngularOptions) => Transpiler;
|
|
@@ -68,6 +68,7 @@ var blockToAngular = function (json, options, blockOptions) {
|
|
|
68
68
|
var contextVars = (blockOptions === null || blockOptions === void 0 ? void 0 : blockOptions.contextVars) || [];
|
|
69
69
|
var outputVars = (blockOptions === null || blockOptions === void 0 ? void 0 : blockOptions.outputVars) || [];
|
|
70
70
|
var childComponents = (blockOptions === null || blockOptions === void 0 ? void 0 : blockOptions.childComponents) || [];
|
|
71
|
+
var domRefs = (blockOptions === null || blockOptions === void 0 ? void 0 : blockOptions.domRefs) || [];
|
|
71
72
|
if (mappers[json.name]) {
|
|
72
73
|
return mappers[json.name](json, options, blockOptions);
|
|
73
74
|
}
|
|
@@ -86,6 +87,7 @@ var blockToAngular = function (json, options, blockOptions) {
|
|
|
86
87
|
// the context is the class
|
|
87
88
|
contextVars: [],
|
|
88
89
|
outputVars: outputVars,
|
|
90
|
+
domRefs: domRefs,
|
|
89
91
|
}), "}}");
|
|
90
92
|
}
|
|
91
93
|
var str = '';
|
|
@@ -94,6 +96,7 @@ var blockToAngular = function (json, options, blockOptions) {
|
|
|
94
96
|
str += "<ng-container *ngFor=\"let ".concat(json.properties._forName, " of ").concat((0, strip_state_and_props_refs_1.stripStateAndPropsRefs)((_e = json.bindings.each) === null || _e === void 0 ? void 0 : _e.code, {
|
|
95
97
|
contextVars: contextVars,
|
|
96
98
|
outputVars: outputVars,
|
|
99
|
+
domRefs: domRefs,
|
|
97
100
|
}), "\">");
|
|
98
101
|
str += json.children.map(function (item) { return (0, exports.blockToAngular)(item, options, blockOptions); }).join('\n');
|
|
99
102
|
str += "</ng-container>";
|
|
@@ -102,6 +105,7 @@ var blockToAngular = function (json, options, blockOptions) {
|
|
|
102
105
|
str += "<ng-container *ngIf=\"".concat((0, strip_state_and_props_refs_1.stripStateAndPropsRefs)((_f = json.bindings.when) === null || _f === void 0 ? void 0 : _f.code, {
|
|
103
106
|
contextVars: contextVars,
|
|
104
107
|
outputVars: outputVars,
|
|
108
|
+
domRefs: domRefs,
|
|
105
109
|
}), "\">");
|
|
106
110
|
str += json.children.map(function (item) { return (0, exports.blockToAngular)(item, options, blockOptions); }).join('\n');
|
|
107
111
|
str += "</ng-container>";
|
|
@@ -136,6 +140,7 @@ var blockToAngular = function (json, options, blockOptions) {
|
|
|
136
140
|
var useValue = (0, strip_state_and_props_refs_1.stripStateAndPropsRefs)(code, {
|
|
137
141
|
contextVars: contextVars,
|
|
138
142
|
outputVars: outputVars,
|
|
143
|
+
domRefs: domRefs,
|
|
139
144
|
});
|
|
140
145
|
if (key.startsWith('on')) {
|
|
141
146
|
var event_1 = key.replace('on', '').toLowerCase();
|
|
@@ -252,14 +257,14 @@ var componentToAngular = function (options) {
|
|
|
252
257
|
if (options.prettier !== false) {
|
|
253
258
|
css = tryFormat(css, 'css');
|
|
254
259
|
}
|
|
260
|
+
var blockOptions = {
|
|
261
|
+
contextVars: contextVars,
|
|
262
|
+
outputVars: outputVars,
|
|
263
|
+
domRefs: [],
|
|
264
|
+
childComponents: childComponents,
|
|
265
|
+
};
|
|
255
266
|
var template = json.children
|
|
256
|
-
.map(function (item) {
|
|
257
|
-
return (0, exports.blockToAngular)(item, options, {
|
|
258
|
-
contextVars: contextVars,
|
|
259
|
-
outputVars: outputVars,
|
|
260
|
-
childComponents: childComponents,
|
|
261
|
-
});
|
|
262
|
-
})
|
|
267
|
+
.map(function (item) { return (0, exports.blockToAngular)(item, options, blockOptions); })
|
|
263
268
|
.join('\n');
|
|
264
269
|
if (options.prettier !== false) {
|
|
265
270
|
template = tryFormat(template, 'html');
|
|
@@ -272,6 +277,7 @@ var componentToAngular = function (options) {
|
|
|
272
277
|
replaceWith: 'this.',
|
|
273
278
|
contextVars: contextVars,
|
|
274
279
|
outputVars: outputVars,
|
|
280
|
+
domRefs: Array.from(domRefs),
|
|
275
281
|
});
|
|
276
282
|
},
|
|
277
283
|
});
|
|
@@ -294,6 +300,7 @@ var componentToAngular = function (options) {
|
|
|
294
300
|
replaceWith: 'this.',
|
|
295
301
|
contextVars: contextVars,
|
|
296
302
|
outputVars: outputVars,
|
|
303
|
+
domRefs: Array.from(domRefs),
|
|
297
304
|
}))
|
|
298
305
|
: '', ";");
|
|
299
306
|
})
|
|
@@ -313,6 +320,7 @@ var componentToAngular = function (options) {
|
|
|
313
320
|
replaceWith: 'this.',
|
|
314
321
|
contextVars: contextVars,
|
|
315
322
|
outputVars: outputVars,
|
|
323
|
+
domRefs: Array.from(domRefs),
|
|
316
324
|
}), "\n "), "\n }"), !((_o = component.hooks.onUpdate) === null || _o === void 0 ? void 0 : _o.length)
|
|
317
325
|
? ''
|
|
318
326
|
: "ngAfterContentChecked() {\n ".concat(component.hooks.onUpdate.reduce(function (code, hook) {
|
|
@@ -320,6 +328,7 @@ var componentToAngular = function (options) {
|
|
|
320
328
|
replaceWith: 'this.',
|
|
321
329
|
contextVars: contextVars,
|
|
322
330
|
outputVars: outputVars,
|
|
331
|
+
domRefs: Array.from(domRefs),
|
|
323
332
|
});
|
|
324
333
|
return code + '\n';
|
|
325
334
|
}, ''), "\n }"), !component.hooks.onUnMount
|
|
@@ -328,6 +337,7 @@ var componentToAngular = function (options) {
|
|
|
328
337
|
replaceWith: 'this.',
|
|
329
338
|
contextVars: contextVars,
|
|
330
339
|
outputVars: outputVars,
|
|
340
|
+
domRefs: Array.from(domRefs),
|
|
331
341
|
}), "\n }"));
|
|
332
342
|
if (options.plugins) {
|
|
333
343
|
str = (0, plugins_1.runPreCodePlugins)(str, options.plugins);
|
|
@@ -71,15 +71,15 @@ function addComponent(fileSet, component, opts) {
|
|
|
71
71
|
var styles = _opts.shareStyles ? getCommonStyles(fileSet).styles : new Map();
|
|
72
72
|
(0, styles_1.collectStyles)(component.children, styles);
|
|
73
73
|
var useStyles = function () { return null; };
|
|
74
|
-
if (
|
|
75
|
-
if (_opts.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
if (styles.size) {
|
|
75
|
+
if (_opts.shareStyles) {
|
|
76
|
+
if (_opts.isRoot) {
|
|
77
|
+
var symbolName = componentName + '_styles';
|
|
78
|
+
getCommonStyles(fileSet).symbolName = symbolName;
|
|
79
|
+
useStyles = generateStyles(onRenderFile, fileSet.low, symbolName, false);
|
|
80
|
+
}
|
|
79
81
|
}
|
|
80
|
-
|
|
81
|
-
else {
|
|
82
|
-
if (styles.size) {
|
|
82
|
+
else {
|
|
83
83
|
var symbolName = componentName + '_styles';
|
|
84
84
|
onRenderFile.exportConst(symbolName, (0, styles_1.renderStyles)(styles));
|
|
85
85
|
useStyles = generateStyles(onRenderFile, onRenderFile, symbolName, true);
|
|
@@ -77,7 +77,7 @@ function renderJSXNodes(file, directives, handlers, children, styles, parentSymb
|
|
|
77
77
|
if (typeof directive == 'function') {
|
|
78
78
|
_this.emit(directive(child, function () {
|
|
79
79
|
var children = child.children.filter(function (c) { return !isEmptyTextNode(c); });
|
|
80
|
-
var needsFragment = children.length > 1 || isTextNode(children[0]);
|
|
80
|
+
var needsFragment = children.length > 1 || (children.length === 1 && isTextNode(children[0]));
|
|
81
81
|
needsFragment && _this.jsxBeginFragment(fragmentSymbol);
|
|
82
82
|
renderJSXNodes(file, directives, handlers, children, styles, {}, false).call(_this);
|
|
83
83
|
needsFragment && _this.jsxEndFragment();
|
|
@@ -483,7 +483,7 @@ var _componentToReact = function (json, options, isSubComponent) {
|
|
|
483
483
|
propsArgs = "props: ".concat(json.propsTypeRef);
|
|
484
484
|
}
|
|
485
485
|
var str = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "", "function ", "(", "", ") {\n ", "\n ", "\n ", "\n ", "\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n return (\n ", "\n ", "\n ", "\n ", "\n );\n }", "\n\n ", "\n\n ", "\n "], ["\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "", "function ", "(", "", ") {\n ", "\n ", "\n ", "\n ", "\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n return (\n ", "\n ", "\n ", "\n ", "\n );\n }", "\n\n ", "\n\n ", "\n "])), options.type !== 'native'
|
|
486
|
-
? ''
|
|
486
|
+
? "import * as React from 'react';"
|
|
487
487
|
: "\n import * as React from 'react';\n import { View, StyleSheet, Image, Text } from 'react-native';\n ", styledComponentsCode ? "import styled from 'styled-components';\n" : '', reactLibImports.size ? "import { ".concat(Array.from(reactLibImports).join(', '), " } from 'react'") : '', componentHasStyles && stylesType === 'emotion' && options.format !== 'lite'
|
|
488
488
|
? "/** @jsx jsx */\n import { jsx } from '@emotion/react'".trim()
|
|
489
489
|
: '', hasState && stateType === 'valtio' ? "import { useLocalProxy } from 'valtio/utils';" : '', hasState && stateType === 'solid' ? "import { useMutable } from 'react-solid-state';" : '', stateType === 'mobx' && hasState
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.componentToSolid = void 0;
|
|
31
|
+
var dedent_1 = __importDefault(require("dedent"));
|
|
32
|
+
var standalone_1 = require("prettier/standalone");
|
|
33
|
+
var helpers_1 = require("../../helpers/styles/helpers");
|
|
34
|
+
var get_refs_1 = require("../../helpers/get-refs");
|
|
35
|
+
var get_state_object_string_1 = require("../../helpers/get-state-object-string");
|
|
36
|
+
var render_imports_1 = require("../../helpers/render-imports");
|
|
37
|
+
var jsx_1 = require("../../parsers/jsx");
|
|
38
|
+
var plugins_1 = require("../../modules/plugins");
|
|
39
|
+
var fast_clone_1 = require("../../helpers/fast-clone");
|
|
40
|
+
var strip_meta_properties_1 = require("../../helpers/strip-meta-properties");
|
|
41
|
+
var get_components_used_1 = require("../../helpers/get-components-used");
|
|
42
|
+
var traverse_1 = __importDefault(require("traverse"));
|
|
43
|
+
var is_mitosis_node_1 = require("../../helpers/is-mitosis-node");
|
|
44
|
+
var filter_empty_text_nodes_1 = require("../../helpers/filter-empty-text-nodes");
|
|
45
|
+
var create_mitosis_node_1 = require("../../helpers/create-mitosis-node");
|
|
46
|
+
var context_1 = require("../helpers/context");
|
|
47
|
+
var babel_transform_1 = require("../../helpers/babel-transform");
|
|
48
|
+
var core_1 = require("@babel/core");
|
|
49
|
+
var lodash_1 = require("lodash");
|
|
50
|
+
var state_1 = require("./state");
|
|
51
|
+
var nullable_1 = require("../../helpers/nullable");
|
|
52
|
+
var DEFAULT_OPTIONS = {
|
|
53
|
+
state: 'signals',
|
|
54
|
+
};
|
|
55
|
+
// Transform <foo.bar key="value" /> to <component :is="foo.bar" key="value" />
|
|
56
|
+
function processDynamicComponents(json, options) {
|
|
57
|
+
var found = false;
|
|
58
|
+
(0, traverse_1.default)(json).forEach(function (node) {
|
|
59
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(node)) {
|
|
60
|
+
if (node.name.includes('.')) {
|
|
61
|
+
node.bindings.component = { code: node.name };
|
|
62
|
+
node.name = 'Dynamic';
|
|
63
|
+
found = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return found;
|
|
68
|
+
}
|
|
69
|
+
function getContextString(component, options) {
|
|
70
|
+
var str = '';
|
|
71
|
+
for (var key in component.context.get) {
|
|
72
|
+
str += "\n const ".concat(key, " = useContext(").concat(component.context.get[key].name, ");\n ");
|
|
73
|
+
}
|
|
74
|
+
return str;
|
|
75
|
+
}
|
|
76
|
+
// This should really be a preprocessor mapping the `class` attribute binding based on what other values have
|
|
77
|
+
// to make this more pluggable
|
|
78
|
+
var collectClassString = function (json) {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
var staticClasses = [];
|
|
81
|
+
if (json.properties.class) {
|
|
82
|
+
staticClasses.push(json.properties.class);
|
|
83
|
+
delete json.properties.class;
|
|
84
|
+
}
|
|
85
|
+
if (json.properties.className) {
|
|
86
|
+
staticClasses.push(json.properties.className);
|
|
87
|
+
delete json.properties.className;
|
|
88
|
+
}
|
|
89
|
+
var dynamicClasses = [];
|
|
90
|
+
if (typeof ((_a = json.bindings.class) === null || _a === void 0 ? void 0 : _a.code) === 'string') {
|
|
91
|
+
dynamicClasses.push(json.bindings.class.code);
|
|
92
|
+
delete json.bindings.class;
|
|
93
|
+
}
|
|
94
|
+
if (typeof ((_b = json.bindings.className) === null || _b === void 0 ? void 0 : _b.code) === 'string') {
|
|
95
|
+
dynamicClasses.push(json.bindings.className.code);
|
|
96
|
+
delete json.bindings.className;
|
|
97
|
+
}
|
|
98
|
+
if (typeof ((_c = json.bindings.css) === null || _c === void 0 ? void 0 : _c.code) === 'string' && json.bindings.css.code.trim().length > 4) {
|
|
99
|
+
dynamicClasses.push("css(".concat(json.bindings.css.code, ")"));
|
|
100
|
+
}
|
|
101
|
+
delete json.bindings.css;
|
|
102
|
+
var staticClassesString = staticClasses.join(' ');
|
|
103
|
+
var dynamicClassesString = dynamicClasses.join(" + ' ' + ");
|
|
104
|
+
var hasStaticClasses = Boolean(staticClasses.length);
|
|
105
|
+
var hasDynamicClasses = Boolean(dynamicClasses.length);
|
|
106
|
+
if (hasStaticClasses && !hasDynamicClasses) {
|
|
107
|
+
return "\"".concat(staticClassesString, "\"");
|
|
108
|
+
}
|
|
109
|
+
if (hasDynamicClasses && !hasStaticClasses) {
|
|
110
|
+
return "{".concat(dynamicClassesString, "}");
|
|
111
|
+
}
|
|
112
|
+
if (hasDynamicClasses && hasStaticClasses) {
|
|
113
|
+
return "{\"".concat(staticClassesString, " \" + ").concat(dynamicClassesString, "}");
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
};
|
|
117
|
+
var preProcessBlockCode = function (json, options) {
|
|
118
|
+
var processCode = (0, state_1.updateStateCode)(options);
|
|
119
|
+
for (var key in json.properties) {
|
|
120
|
+
var value = json.properties[key];
|
|
121
|
+
if (value) {
|
|
122
|
+
json.properties[key] = processCode(value);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
for (var key in json.bindings) {
|
|
126
|
+
var value = json.bindings[key];
|
|
127
|
+
if (value === null || value === void 0 ? void 0 : value.code) {
|
|
128
|
+
json.bindings[key] = {
|
|
129
|
+
arguments: value.arguments,
|
|
130
|
+
code: processCode(value.code),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var blockToSolid = function (json, options) {
|
|
136
|
+
var _a, _b, _c;
|
|
137
|
+
preProcessBlockCode(json, options);
|
|
138
|
+
if (json.properties._text) {
|
|
139
|
+
return json.properties._text;
|
|
140
|
+
}
|
|
141
|
+
if ((_a = json.bindings._text) === null || _a === void 0 ? void 0 : _a.code) {
|
|
142
|
+
return "{".concat(json.bindings._text.code, "}");
|
|
143
|
+
}
|
|
144
|
+
if (json.name === 'For') {
|
|
145
|
+
var needsWrapper = json.children.length !== 1;
|
|
146
|
+
// The SolidJS `<For>` component has a special index() signal function.
|
|
147
|
+
// https://www.solidjs.com/docs/latest#%3Cfor%3E
|
|
148
|
+
return "<For each={".concat((_b = json.bindings.each) === null || _b === void 0 ? void 0 : _b.code, "}>\n {(").concat(json.properties._forName, ", _index) => {\n const index = _index();\n return ").concat(needsWrapper ? '<>' : '').concat(json.children
|
|
149
|
+
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
150
|
+
.map(function (child) { return blockToSolid(child, options); }), "}}\n ").concat(needsWrapper ? '</>' : '', "\n </For>");
|
|
151
|
+
}
|
|
152
|
+
var str = '';
|
|
153
|
+
if (json.name === 'Fragment') {
|
|
154
|
+
str += '<';
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
str += "<".concat(json.name, " ");
|
|
158
|
+
}
|
|
159
|
+
if (json.name === 'Show' && json.meta.else) {
|
|
160
|
+
str += "fallback={".concat(blockToSolid(json.meta.else, options), "}");
|
|
161
|
+
}
|
|
162
|
+
var classString = collectClassString(json);
|
|
163
|
+
if (classString) {
|
|
164
|
+
str += " class=".concat(classString, " ");
|
|
165
|
+
}
|
|
166
|
+
if ((_c = json.bindings._spread) === null || _c === void 0 ? void 0 : _c.code) {
|
|
167
|
+
str += " {...(".concat(json.bindings._spread.code, ")} ");
|
|
168
|
+
}
|
|
169
|
+
for (var key in json.properties) {
|
|
170
|
+
var value = json.properties[key];
|
|
171
|
+
str += " ".concat(key, "=\"").concat(value, "\" ");
|
|
172
|
+
}
|
|
173
|
+
for (var key in json.bindings) {
|
|
174
|
+
var _d = json.bindings[key], code = _d.code, _e = _d.arguments, cusArg = _e === void 0 ? ['event'] : _e;
|
|
175
|
+
if (key === '_spread' || key === '_forName') {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (!code)
|
|
179
|
+
continue;
|
|
180
|
+
if (key.startsWith('on')) {
|
|
181
|
+
var useKey = key === 'onChange' && json.name === 'input' ? 'onInput' : key;
|
|
182
|
+
str += " ".concat(useKey, "={(").concat(cusArg.join(','), ") => ").concat(code, "} ");
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
var useValue = code;
|
|
186
|
+
if (key === 'style') {
|
|
187
|
+
// Convert camelCase keys to kebab-case
|
|
188
|
+
// TODO: support more than top level objects, may need
|
|
189
|
+
// a runtime helper for expressions that are not a direct
|
|
190
|
+
// object literal, such as ternaries and other expression
|
|
191
|
+
// types
|
|
192
|
+
useValue = (0, babel_transform_1.babelTransformExpression)(code, {
|
|
193
|
+
ObjectExpression: function (path) {
|
|
194
|
+
// TODO: limit to top level objects only
|
|
195
|
+
for (var _i = 0, _a = path.node.properties; _i < _a.length; _i++) {
|
|
196
|
+
var property = _a[_i];
|
|
197
|
+
if (core_1.types.isObjectProperty(property)) {
|
|
198
|
+
if (core_1.types.isIdentifier(property.key) || core_1.types.isStringLiteral(property.key)) {
|
|
199
|
+
var key_1 = core_1.types.isIdentifier(property.key)
|
|
200
|
+
? property.key.name
|
|
201
|
+
: property.key.value;
|
|
202
|
+
property.key = core_1.types.stringLiteral((0, lodash_1.kebabCase)(key_1));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
str += " ".concat(key, "={").concat(useValue, "} ");
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (jsx_1.selfClosingTags.has(json.name)) {
|
|
213
|
+
return str + ' />';
|
|
214
|
+
}
|
|
215
|
+
str += '>';
|
|
216
|
+
if (json.children) {
|
|
217
|
+
str += json.children
|
|
218
|
+
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
219
|
+
.map(function (item) { return blockToSolid(item, options); })
|
|
220
|
+
.join('\n');
|
|
221
|
+
}
|
|
222
|
+
if (json.name === 'Fragment') {
|
|
223
|
+
str += '</>';
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
str += "</".concat(json.name, ">");
|
|
227
|
+
}
|
|
228
|
+
return str;
|
|
229
|
+
};
|
|
230
|
+
var getRefsString = function (json) {
|
|
231
|
+
return Array.from((0, get_refs_1.getRefs)(json))
|
|
232
|
+
.map(function (ref) { return "let ".concat(ref, ";"); })
|
|
233
|
+
.join('\n');
|
|
234
|
+
};
|
|
235
|
+
function addProviderComponents(json, options) {
|
|
236
|
+
for (var key in json.context.set) {
|
|
237
|
+
var _a = json.context.set[key], name_1 = _a.name, value = _a.value;
|
|
238
|
+
json.children = [
|
|
239
|
+
(0, create_mitosis_node_1.createMitosisNode)(__assign({ name: "".concat(name_1, ".Provider"), children: json.children }, (value && {
|
|
240
|
+
bindings: {
|
|
241
|
+
value: { code: (0, get_state_object_string_1.getMemberObjectString)(value) },
|
|
242
|
+
},
|
|
243
|
+
}))),
|
|
244
|
+
];
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
var preProcessComponentCode = function (json, options) {
|
|
248
|
+
var _a;
|
|
249
|
+
var processCode = (0, state_1.updateStateCode)(options);
|
|
250
|
+
if ((_a = json.hooks.onMount) === null || _a === void 0 ? void 0 : _a.code) {
|
|
251
|
+
json.hooks.onMount.code = processCode(json.hooks.onMount.code);
|
|
252
|
+
}
|
|
253
|
+
if (json.hooks.onUpdate) {
|
|
254
|
+
for (var _i = 0, _b = json.hooks.onUpdate; _i < _b.length; _i++) {
|
|
255
|
+
var hook = _b[_i];
|
|
256
|
+
hook.code = processCode(hook.code);
|
|
257
|
+
if (hook.deps) {
|
|
258
|
+
hook.deps = processCode(hook.deps);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
var componentToSolid = function (passedOptions) {
|
|
264
|
+
if (passedOptions === void 0) { passedOptions = DEFAULT_OPTIONS; }
|
|
265
|
+
return function (_a) {
|
|
266
|
+
var _b, _c, _d, _e, _f, _g;
|
|
267
|
+
var component = _a.component;
|
|
268
|
+
var options = __assign(__assign({}, DEFAULT_OPTIONS), passedOptions);
|
|
269
|
+
var json = (0, fast_clone_1.fastClone)(component);
|
|
270
|
+
if (options.plugins) {
|
|
271
|
+
json = (0, plugins_1.runPreJsonPlugins)(json, options.plugins);
|
|
272
|
+
}
|
|
273
|
+
addProviderComponents(json, options);
|
|
274
|
+
var componentHasStyles = (0, helpers_1.hasCss)(json);
|
|
275
|
+
var addWrapper = json.children.filter(filter_empty_text_nodes_1.filterEmptyTextNodes).length !== 1;
|
|
276
|
+
if (options.plugins) {
|
|
277
|
+
json = (0, plugins_1.runPostJsonPlugins)(json, options.plugins);
|
|
278
|
+
}
|
|
279
|
+
preProcessComponentCode(json, options);
|
|
280
|
+
(0, strip_meta_properties_1.stripMetaProperties)(json);
|
|
281
|
+
var foundDynamicComponents = processDynamicComponents(json, options);
|
|
282
|
+
var state = (0, state_1.getState)(json, options);
|
|
283
|
+
var componentsUsed = (0, get_components_used_1.getComponentsUsed)(json);
|
|
284
|
+
var componentHasContext = (0, context_1.hasContext)(json);
|
|
285
|
+
var hasShowComponent = componentsUsed.has('Show');
|
|
286
|
+
var hasForComponent = componentsUsed.has('For');
|
|
287
|
+
var solidJSImports = __spreadArray(__spreadArray([
|
|
288
|
+
componentHasContext ? 'useContext' : undefined,
|
|
289
|
+
hasShowComponent ? 'Show' : undefined,
|
|
290
|
+
hasForComponent ? 'For' : undefined,
|
|
291
|
+
((_b = json.hooks.onMount) === null || _b === void 0 ? void 0 : _b.code) ? 'onMount' : undefined
|
|
292
|
+
], (((_c = json.hooks.onUpdate) === null || _c === void 0 ? void 0 : _c.length) ? ['on', 'createEffect'] : []), true), ((_d = state === null || state === void 0 ? void 0 : state.import.solidjs) !== null && _d !== void 0 ? _d : []), true).filter(nullable_1.checkIsDefined);
|
|
293
|
+
var storeImports = (_e = state === null || state === void 0 ? void 0 : state.import.store) !== null && _e !== void 0 ? _e : [];
|
|
294
|
+
var str = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n ", "\n ", "\n\n function ", "(props) {\n ", "\n \n ", "\n ", "\n\n ", "\n ", "\n\n return (", "\n ", "\n ", ")\n }\n\n export default ", ";\n "], ["\n ", "\n ", "\n ", "\n ", "\n ", "\n\n function ", "(props) {\n ", "\n \n ", "\n ", "\n\n ", "\n ", "\n\n return (", "\n ", "\n ", ")\n }\n\n export default ", ";\n "])), solidJSImports.length > 0 ? "import { ".concat(solidJSImports.join(', '), " } from 'solid-js';") : '', !foundDynamicComponents ? '' : "import { Dynamic } from 'solid-js/web';", storeImports.length > 0 ? "import { ".concat(storeImports.join(', '), " } from 'solid-js/store';") : '', !componentHasStyles ? '' : "import { css } from \"solid-styled-components\";", (0, render_imports_1.renderPreComponent)({ component: json, target: 'solid' }), json.name, (_f = state === null || state === void 0 ? void 0 : state.str) !== null && _f !== void 0 ? _f : '', getRefsString(json), getContextString(json, options), !((_g = json.hooks.onMount) === null || _g === void 0 ? void 0 : _g.code) ? '' : "onMount(() => { ".concat(json.hooks.onMount.code, " })"), json.hooks.onUpdate
|
|
295
|
+
? json.hooks.onUpdate
|
|
296
|
+
.map(function (hook, index) {
|
|
297
|
+
if (hook.deps) {
|
|
298
|
+
var hookName = "onUpdateFn_".concat(index);
|
|
299
|
+
return "\n function ".concat(hookName, "() { ").concat(hook.code, " };\n createEffect(on(() => ").concat(hook.deps, ", ").concat(hookName, "));\n ");
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
// TO-DO: support `onUpdate` without `deps`
|
|
303
|
+
return '';
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
.join('\n')
|
|
307
|
+
: '', addWrapper ? '<>' : '', json.children
|
|
308
|
+
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
309
|
+
.map(function (item) { return blockToSolid(item, options); })
|
|
310
|
+
.join('\n'), addWrapper ? '</>' : '', json.name);
|
|
311
|
+
// HACK: for some reason we are generating `state.state.foo` instead of `state.foo`
|
|
312
|
+
// need a full fix, but this unblocks a lot in the short term
|
|
313
|
+
str = str.replace(/state\.state\./g, 'state.');
|
|
314
|
+
if (options.plugins) {
|
|
315
|
+
str = (0, plugins_1.runPreCodePlugins)(str, options.plugins);
|
|
316
|
+
}
|
|
317
|
+
if (options.prettier !== false) {
|
|
318
|
+
str = (0, standalone_1.format)(str, {
|
|
319
|
+
parser: 'typescript',
|
|
320
|
+
plugins: [require('prettier/parser-typescript')],
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
if (options.plugins) {
|
|
324
|
+
str = (0, plugins_1.runPostCodePlugins)(str, options.plugins);
|
|
325
|
+
}
|
|
326
|
+
return str;
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
exports.componentToSolid = componentToSolid;
|
|
330
|
+
var templateObject_1;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MitosisComponent } from '../../types/mitosis-component';
|
|
2
|
+
import { ToSolidOptions } from './types';
|
|
3
|
+
declare type State = {
|
|
4
|
+
str: string;
|
|
5
|
+
import: {
|
|
6
|
+
store?: [string];
|
|
7
|
+
solidjs?: [string];
|
|
8
|
+
};
|
|
9
|
+
values?: StateValue[];
|
|
10
|
+
};
|
|
11
|
+
export declare const updateStateCode: (options: ToSolidOptions) => (value: string) => string;
|
|
12
|
+
declare enum StateValueType {
|
|
13
|
+
'function' = "function",
|
|
14
|
+
'method' = "method",
|
|
15
|
+
'data' = "data"
|
|
16
|
+
}
|
|
17
|
+
interface StateValue {
|
|
18
|
+
str: string;
|
|
19
|
+
type: StateValueType;
|
|
20
|
+
}
|
|
21
|
+
export declare const getState: (json: MitosisComponent, options: ToSolidOptions) => State | undefined;
|
|
22
|
+
export {};
|