@builder.io/mitosis 0.0.56-2 → 0.0.56-22
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__/angular.test.js +2 -13
- package/dist/src/__tests__/builder.test.js +3 -3
- package/dist/src/__tests__/data/basic-child-component.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-child-component.raw.jsx +21 -0
- package/dist/src/__tests__/data/basic-context.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-context.raw.jsx +29 -0
- package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.jsx +10 -0
- package/dist/src/__tests__/data/basic-for-show.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-for-show.raw.jsx +20 -0
- package/dist/src/__tests__/data/basic-for.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-for.raw.jsx +23 -0
- package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-forwardRef.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-forwardRef.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-onChange.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-onChange.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-onMount-update.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-onMount-update.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-onUpdate-return.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-onUpdate-return.raw.jsx +24 -0
- package/dist/src/__tests__/data/basic-outputs-meta.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-outputs-meta.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-outputs.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-outputs.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-props-destructure.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-props-destructure.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-props.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-props.raw.jsx +13 -0
- package/dist/src/__tests__/data/basic-ref-assignment.raw.d.ts +4 -0
- package/dist/src/__tests__/data/basic-ref-assignment.raw.jsx +15 -0
- package/dist/src/__tests__/data/basic-ref-usePrevious.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-ref-usePrevious.raw.jsx +35 -0
- package/dist/src/__tests__/data/basic-ref.raw.d.ts +4 -0
- package/dist/src/__tests__/data/basic-ref.raw.jsx +36 -0
- package/dist/src/__tests__/data/basic.raw.d.ts +6 -1
- package/dist/src/__tests__/data/basic.raw.jsx +13 -4
- package/dist/src/__tests__/data/blocks/button-with-metadata.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/button.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/classname-jsx.raw.d.ts +7 -0
- package/dist/src/__tests__/data/blocks/classname-jsx.raw.jsx +15 -0
- package/dist/src/__tests__/data/blocks/columns.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/columns.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/content-slot-html.raw.d.ts +7 -0
- package/dist/src/__tests__/data/blocks/content-slot-html.raw.jsx +15 -0
- package/dist/src/__tests__/data/blocks/content-slot-jsx.raw.d.ts +6 -0
- package/dist/src/__tests__/data/blocks/content-slot-jsx.raw.jsx +12 -0
- package/dist/src/__tests__/data/blocks/custom-code.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/custom-code.raw.jsx +3 -7
- package/dist/src/__tests__/data/blocks/embed.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/embed.raw.jsx +3 -7
- package/dist/src/__tests__/data/blocks/form.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/form.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/image.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/image.raw.jsx +8 -9
- package/dist/src/__tests__/data/blocks/img-state.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/img-state.raw.jsx +17 -0
- package/dist/src/__tests__/data/blocks/img.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/input.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/input.raw.jsx +1 -3
- package/dist/src/__tests__/data/blocks/multiple-onUpdate.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.jsx +7 -1
- package/dist/src/__tests__/data/blocks/onInit-onMount.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/onInit-onMount.raw.jsx +13 -0
- package/dist/src/__tests__/data/blocks/onInit.raw.d.ts +8 -0
- package/dist/src/__tests__/data/blocks/onInit.raw.jsx +20 -0
- package/dist/src/__tests__/data/blocks/onMount.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/onUpdate.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/raw-text.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/rootShow.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/section-state.raw.d.ts +6 -0
- package/dist/src/__tests__/data/blocks/section-state.raw.jsx +17 -0
- package/dist/src/__tests__/data/blocks/section.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/select.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/select.raw.jsx +1 -3
- package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/self-referencing-component.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/shadow-dom.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/shadow-dom.raw.jsx +2 -4
- package/dist/src/__tests__/data/blocks/slot-html.raw.d.ts +5 -0
- package/dist/src/__tests__/data/blocks/slot-html.raw.jsx +15 -0
- package/dist/src/__tests__/data/blocks/slot-jsx.raw.d.ts +5 -0
- package/dist/src/__tests__/data/blocks/slot-jsx.raw.jsx +12 -0
- package/dist/src/__tests__/data/blocks/stamped-io.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +2 -4
- package/dist/src/__tests__/data/blocks/submit-button.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/text.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/text.raw.jsx +3 -1
- package/dist/src/__tests__/data/blocks/textarea.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/video.raw.d.ts +1 -1
- package/dist/src/__tests__/data/blocks/video.raw.jsx +1 -1
- package/dist/src/__tests__/data/context/component-with-context.lite.d.ts +3 -1
- package/dist/src/__tests__/data/context/component-with-context.lite.jsx +7 -2
- package/dist/src/__tests__/data/styles/class-and-className.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/class-and-className.raw.jsx +10 -0
- package/dist/src/__tests__/data/styles/class.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/class.raw.jsx +10 -0
- package/dist/src/__tests__/data/styles/className.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/className.raw.jsx +10 -0
- package/dist/src/__tests__/data/styles/classState.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/classState.raw.jsx +12 -0
- package/dist/src/__tests__/data/types/component-props-interface.raw.d.ts +6 -0
- package/dist/src/__tests__/data/types/component-props-interface.raw.jsx +6 -0
- package/dist/src/__tests__/data/types/component-props-type.raw.d.ts +6 -0
- package/dist/src/__tests__/data/types/component-props-type.raw.jsx +6 -0
- package/dist/src/__tests__/data/types/preserve-typing.raw.d.ts +8 -0
- package/dist/src/__tests__/data/types/preserve-typing.raw.jsx +6 -0
- package/dist/src/__tests__/html.test.js +2 -13
- package/dist/src/__tests__/liquid.test.js +2 -103
- package/dist/src/__tests__/parse-jsx.test.js +22 -0
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.js +34 -0
- package/dist/src/__tests__/qwik/src-generator.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/src-generator.test.js +65 -0
- package/dist/src/__tests__/qwik.directive.test.js +1 -0
- package/dist/src/__tests__/qwik.test.js +54 -23
- package/dist/src/__tests__/react-native.test.js +3 -136
- package/dist/src/__tests__/react.test.js +5 -135
- package/dist/src/__tests__/shared.d.ts +3 -0
- package/dist/src/__tests__/shared.js +232 -0
- package/dist/src/__tests__/solid.test.js +2 -97
- package/dist/src/__tests__/stencil.test.js +3 -98
- package/dist/src/__tests__/styles.test.d.ts +1 -0
- package/dist/src/__tests__/styles.test.js +23 -0
- package/dist/src/__tests__/svelte.test.js +2 -31
- package/dist/src/__tests__/vue.test.js +2 -134
- package/dist/src/__tests__/webcomponent.test.js +8 -5
- package/dist/src/constants/hooks.d.ts +6 -0
- package/dist/src/constants/hooks.js +9 -0
- package/dist/src/flow.d.ts +6 -0
- package/dist/src/flow.js +6 -2
- package/dist/src/generators/angular.d.ts +8 -2
- package/dist/src/generators/angular.js +202 -44
- package/dist/src/generators/builder.d.ts +2 -2
- package/dist/src/generators/builder.js +19 -26
- package/dist/src/generators/context/{react copy.d.ts → qwik.d.ts} +2 -2
- package/dist/src/generators/context/{react copy.js → qwik.js} +4 -5
- package/dist/src/generators/context/svelte.d.ts +1 -1
- package/dist/src/generators/helpers/context.js +1 -2
- package/dist/src/generators/html.d.ts +1 -1
- package/dist/src/generators/html.js +365 -108
- package/dist/src/generators/liquid.d.ts +1 -1
- package/dist/src/generators/liquid.js +18 -25
- package/dist/src/generators/mitosis.d.ts +1 -1
- package/dist/src/generators/mitosis.js +37 -35
- package/dist/src/generators/qwik/component-generator.d.ts +4 -0
- package/dist/src/generators/qwik/component-generator.js +276 -0
- package/dist/src/generators/qwik/component.js +21 -25
- package/dist/src/generators/qwik/convertMethodToFunction.d.ts +1 -0
- package/dist/src/generators/qwik/convertMethodToFunction.js +161 -0
- package/dist/src/generators/qwik/directives.js +27 -22
- package/dist/src/generators/qwik/handlers.js +3 -19
- package/dist/src/generators/qwik/index.d.ts +3 -1
- package/dist/src/generators/qwik/index.js +3 -1
- package/dist/src/generators/qwik/jsx.js +33 -13
- package/dist/src/generators/qwik/src-generator.d.ts +21 -8
- package/dist/src/generators/qwik/src-generator.js +163 -42
- package/dist/src/generators/qwik/styles.js +3 -3
- package/dist/src/generators/react-native.d.ts +2 -2
- package/dist/src/generators/react-native.js +8 -10
- package/dist/src/generators/react.d.ts +4 -2
- package/dist/src/generators/react.js +152 -80
- package/dist/src/generators/solid.d.ts +1 -1
- package/dist/src/generators/solid.js +41 -35
- package/dist/src/generators/stencil/collect-class-string.js +5 -8
- package/dist/src/generators/stencil/generate.d.ts +1 -1
- package/dist/src/generators/stencil/generate.js +16 -21
- package/dist/src/generators/svelte.d.ts +2 -2
- package/dist/src/generators/svelte.js +97 -43
- package/dist/src/generators/swift-ui.d.ts +1 -1
- package/dist/src/generators/swift-ui.js +17 -19
- package/dist/src/generators/template.d.ts +1 -1
- package/dist/src/generators/template.js +11 -18
- package/dist/src/generators/vue.d.ts +12 -8
- package/dist/src/generators/vue.js +111 -63
- package/dist/src/helpers/babel-transform.js +3 -8
- package/dist/src/helpers/create-mitosis-component.d.ts +1 -1
- package/dist/src/helpers/create-mitosis-component.js +1 -1
- package/dist/src/helpers/create-mitosis-node.js +1 -1
- package/dist/src/helpers/fast-clone.js +1 -3
- package/dist/src/helpers/filter-empty-text-nodes.js +1 -2
- package/dist/src/helpers/get-bindings.d.ts +2 -0
- package/dist/src/helpers/get-bindings.js +18 -0
- package/dist/src/helpers/get-prop-functions.d.ts +5 -0
- package/dist/src/helpers/get-prop-functions.js +29 -0
- package/dist/src/helpers/get-props-ref.d.ts +2 -0
- package/dist/src/helpers/get-props-ref.js +32 -0
- package/dist/src/helpers/get-refs.js +3 -2
- package/dist/src/helpers/get-state-object-string.d.ts +4 -3
- package/dist/src/helpers/get-state-object-string.js +23 -20
- package/dist/src/helpers/get-styles.js +4 -3
- package/dist/src/helpers/getters-to-functions.d.ts +1 -1
- package/dist/src/helpers/getters-to-functions.js +1 -1
- package/dist/src/helpers/has-bindings-text.d.ts +2 -0
- package/dist/src/helpers/has-bindings-text.js +21 -0
- package/dist/src/helpers/has-stateful-dom.d.ts +2 -0
- package/dist/src/helpers/has-stateful-dom.js +21 -0
- package/dist/src/helpers/is-children.js +2 -1
- package/dist/src/helpers/is-component.js +1 -3
- package/dist/src/helpers/is-html-attribute.d.ts +4 -0
- package/dist/src/helpers/is-html-attribute.js +380 -0
- package/dist/src/helpers/map-refs.js +17 -3
- package/dist/src/helpers/parsers.js +1 -2
- package/dist/src/helpers/render-imports.d.ts +18 -2
- package/dist/src/helpers/render-imports.js +100 -54
- package/dist/src/helpers/render-imports.test.d.ts +1 -0
- package/dist/src/helpers/render-imports.test.js +19 -0
- package/dist/src/helpers/replace-idenifiers.js +5 -7
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +4 -1
- package/dist/src/helpers/strip-state-and-props-refs.js +24 -6
- package/dist/src/helpers/styles/collect-css.d.ts +6 -0
- package/dist/src/helpers/styles/collect-css.js +87 -0
- package/dist/src/helpers/styles/collect-css.test.d.ts +1 -0
- package/dist/src/helpers/styles/collect-css.test.js +18 -0
- package/dist/src/helpers/styles/collect-styled-components.d.ts +2 -0
- package/dist/src/helpers/styles/collect-styled-components.js +61 -0
- package/dist/src/helpers/{collect-styles.d.ts → styles/helpers.d.ts} +5 -10
- package/dist/src/helpers/styles/helpers.js +61 -0
- package/dist/src/helpers/typescript.d.ts +2 -0
- package/dist/src/{jsx-types.js → helpers/typescript.js} +0 -0
- package/dist/src/index.d.ts +7 -4
- package/dist/src/index.js +24 -8
- package/dist/src/modules/plugins.d.ts +1 -1
- package/dist/src/parsers/angular.js +22 -34
- package/dist/src/parsers/builder.d.ts +25 -23
- package/dist/src/parsers/builder.js +59 -67
- package/dist/src/parsers/jsx.d.ts +2 -1
- package/dist/src/parsers/jsx.js +300 -93
- package/dist/src/parsers/liquid.js +51 -149
- package/dist/src/plugins/compile-away-builder-components.js +158 -115
- package/dist/src/symbols/symbol-processor.js +10 -7
- package/dist/src/targets.d.ts +7 -5
- package/dist/src/targets.js +7 -1
- package/dist/src/types/config.d.ts +42 -13
- package/dist/src/types/mitosis-component.d.ts +31 -10
- package/dist/src/types/mitosis-node.d.ts +15 -9
- package/dist/src/types/transpiler.d.ts +14 -0
- package/dist/src/types/transpiler.js +2 -0
- package/dist/test/qwik/Accordion/low.jsx +9 -3
- package/dist/test/qwik/Accordion/med.jsx +2 -8
- package/dist/test/qwik/For/low.jsx +29 -25
- package/dist/test/qwik/For/med.jsx +2 -8
- package/dist/test/qwik/Image/high.js +1 -1
- package/dist/test/qwik/Image/med.js +15 -13
- package/dist/test/qwik/Image.slow/high.js +1 -1
- package/dist/test/qwik/Image.slow/med.js +15 -13
- package/dist/test/qwik/bindings/low.cjs +12 -3
- package/dist/test/qwik/bindings/med.cjs +1 -10
- package/dist/test/qwik/button/high.js +1 -1
- package/dist/test/qwik/button/low.js +9 -3
- package/dist/test/qwik/button/med.js +2 -8
- package/dist/test/qwik/component/bindings/low.jsx +48 -5
- package/dist/test/qwik/component/bindings/med.jsx +3 -49
- package/dist/test/qwik/component/component/inputs/high.cjsx +1 -1
- package/dist/test/qwik/component/component/inputs/med.cjsx +8 -9
- package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
- package/dist/test/qwik/for-loop.bindings/low.cjs +46 -0
- package/dist/test/qwik/for-loop.bindings/med.cjs +5 -0
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +9 -3
- package/dist/test/qwik/hello_world/stylesheet/med.jsx +2 -8
- package/dist/test/qwik/mount/high.cjs +0 -0
- package/dist/test/qwik/mount/low.cjs +45 -0
- package/dist/test/qwik/mount/med.cjs +3 -0
- package/dist/test/qwik/page-with-symbol/low.js +9 -3
- package/dist/test/qwik/page-with-symbol/med.js +2 -8
- package/dist/test/qwik/show-hide/high.jsx +1 -1
- package/dist/test/qwik/show-hide/med.jsx +15 -13
- package/dist/test/qwik/svg/low.js +9 -3
- package/dist/test/qwik/svg/med.js +2 -8
- package/dist/test/qwik/todo/Todo.cjs/high.cjs +6 -10
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +9 -9
- package/dist/test/qwik/todo/Todo.js/high.js +7 -10
- package/dist/test/qwik/todo/Todo.js/med.js +9 -9
- package/dist/test/qwik/todo/Todo.tsx/high.tsx +7 -10
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +9 -9
- package/dist/test/qwik/todos/Todo.tsx/high.tsx +1 -1
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +15 -12
- package/dist/test/qwik/todos/Todo.tsx/med.tsx +1 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -6
- package/README.md +0 -239
- package/dist/src/__tests__/data/blocks/onUpdate.raw copy.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/onUpdate.raw copy.jsx +0 -10
- package/dist/src/__tests__/data/blocks/slot.raw.d.ts +0 -5
- package/dist/src/__tests__/data/blocks/slot.raw.jsx +0 -6
- package/dist/src/__tests__/data/blocks/styles.raw.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/styles.raw.jsx +0 -10
- package/dist/src/helpers/babel-transform copy.d.ts +0 -8
- package/dist/src/helpers/babel-transform copy.js +0 -138
- package/dist/src/helpers/collect-styles.js +0 -178
- package/dist/src/jsx-types.d.ts +0 -1171
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var angular_1 = require("../generators/angular");
|
|
4
|
-
var
|
|
5
|
-
var onUpdate = require('./data/blocks/onUpdate.raw');
|
|
6
|
-
var slot = require('./data/blocks/slot.raw');
|
|
4
|
+
var shared_1 = require("./shared");
|
|
7
5
|
describe('Angular', function () {
|
|
8
|
-
|
|
9
|
-
var component = (0, jsx_1.parseJsx)(onUpdate);
|
|
10
|
-
var output = (0, angular_1.componentToAngular)()({ component: component });
|
|
11
|
-
expect(output).toMatchSnapshot();
|
|
12
|
-
});
|
|
13
|
-
test('ng-content', function () {
|
|
14
|
-
var component = (0, jsx_1.parseJsx)(slot);
|
|
15
|
-
var output = (0, angular_1.componentToAngular)()({ component: component });
|
|
16
|
-
expect(output).toMatchSnapshot();
|
|
17
|
-
});
|
|
6
|
+
(0, shared_1.runTestsForTarget)('angular', (0, angular_1.componentToAngular)());
|
|
18
7
|
});
|
|
@@ -160,7 +160,7 @@ describe('Builder', function () {
|
|
|
160
160
|
});
|
|
161
161
|
}); });
|
|
162
162
|
test('Regenerate Image', function () {
|
|
163
|
-
var code = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import {
|
|
163
|
+
var code = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { useStore } from \"@builder.io/mitosis\";\n import { Image } from \"@components\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <Image\n image=\"https://cdn.builder.io/api/v1/image/foobar\"\n sizes=\"100vw\"\n backgroundSize=\"contain\"\n css={{\n marignTop: \"50px\",\n display: \"block\",\n }}\n />\n </div>\n );\n }\n "], ["\n import { useStore } from \"@builder.io/mitosis\";\n import { Image } from \"@components\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <Image\n image=\"https://cdn.builder.io/api/v1/image/foobar\"\n sizes=\"100vw\"\n backgroundSize=\"contain\"\n css={{\n marignTop: \"50px\",\n display: \"block\",\n }}\n />\n </div>\n );\n }\n "])));
|
|
164
164
|
var component = (0, jsx_1.parseJsx)(code);
|
|
165
165
|
var builderJson = (0, builder_1.componentToBuilder)()({ component: component });
|
|
166
166
|
var backToMitosis = (0, builder_2.builderContentToMitosisComponent)(builderJson);
|
|
@@ -174,7 +174,7 @@ describe('Builder', function () {
|
|
|
174
174
|
expect(react).toMatchSnapshot();
|
|
175
175
|
});
|
|
176
176
|
test('Regenerate Text', function () {
|
|
177
|
-
var code = (0, dedent_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n import {
|
|
177
|
+
var code = (0, dedent_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n import { useStore } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <h2\n css={{\n marginBottom: \"20px\",\n }}\n >\n Hello!\n </h2>\n </div>\n );\n }\n "], ["\n import { useStore } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <h2\n css={{\n marginBottom: \"20px\",\n }}\n >\n Hello!\n </h2>\n </div>\n );\n }\n "])));
|
|
178
178
|
var component = (0, jsx_1.parseJsx)(code);
|
|
179
179
|
var builderJson = (0, builder_1.componentToBuilder)()({ component: component });
|
|
180
180
|
var backToMitosis = (0, builder_2.builderContentToMitosisComponent)(builderJson);
|
|
@@ -184,7 +184,7 @@ describe('Builder', function () {
|
|
|
184
184
|
expect(mitosis.trim()).toEqual(code.trim());
|
|
185
185
|
});
|
|
186
186
|
test('Regenerate loop', function () {
|
|
187
|
-
var code = (0, dedent_1.default)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n import {
|
|
187
|
+
var code = (0, dedent_1.default)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n import { useStore, For } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <For each={state.people}>\n {(person, index) => (\n <div\n key={person}\n css={{\n padding: \"10px 0\",\n }}\n >\n <span>{person}</span>\n <span>{index}</span>\n </div>\n )}\n </For>\n );\n }\n "], ["\n import { useStore, For } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <For each={state.people}>\n {(person, index) => (\n <div\n key={person}\n css={{\n padding: \"10px 0\",\n }}\n >\n <span>{person}</span>\n <span>{index}</span>\n </div>\n )}\n </For>\n );\n }\n "])));
|
|
188
188
|
var component = (0, jsx_1.parseJsx)(code);
|
|
189
189
|
var builderJson = (0, builder_1.componentToBuilder)()({ component: component });
|
|
190
190
|
var backToMitosis = (0, builder_2.builderContentToMitosisComponent)(builderJson);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicChildComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
7
|
+
var basic_raw_1 = __importDefault(require("./basic.raw"));
|
|
8
|
+
var basic_onMount_update_raw_1 = __importDefault(require("./basic-onMount-update.raw"));
|
|
9
|
+
function MyBasicChildComponent() {
|
|
10
|
+
var state = (0, mitosis_1.useStore)({
|
|
11
|
+
name: 'Steve',
|
|
12
|
+
dev: 'PatrickJS',
|
|
13
|
+
});
|
|
14
|
+
return (<div>
|
|
15
|
+
<basic_raw_1.default id={state.dev}/>
|
|
16
|
+
<div>
|
|
17
|
+
<basic_onMount_update_raw_1.default hi={state.name} bye={state.dev}/>
|
|
18
|
+
</div>
|
|
19
|
+
</div>);
|
|
20
|
+
}
|
|
21
|
+
exports.default = MyBasicChildComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
var injection_js_1 = require("@dummy/injection-js");
|
|
5
|
+
function MyBasicComponent() {
|
|
6
|
+
(0, mitosis_1.setContext)(injection_js_1.Injector, (0, injection_js_1.createInjector)());
|
|
7
|
+
var myService = (0, mitosis_1.useContext)(injection_js_1.MyService);
|
|
8
|
+
var state = (0, mitosis_1.useStore)({
|
|
9
|
+
name: 'PatrickJS',
|
|
10
|
+
});
|
|
11
|
+
(0, mitosis_1.onInit)(function () {
|
|
12
|
+
var hi = myService.method('hi');
|
|
13
|
+
console.log(hi);
|
|
14
|
+
});
|
|
15
|
+
(0, mitosis_1.onMount)(function () {
|
|
16
|
+
var bye = myService.method('hi');
|
|
17
|
+
console.log(bye);
|
|
18
|
+
});
|
|
19
|
+
function onChange() {
|
|
20
|
+
var change = myService.method('change');
|
|
21
|
+
console.log(change);
|
|
22
|
+
}
|
|
23
|
+
return (<div>
|
|
24
|
+
{myService.method('hello') + state.name}
|
|
25
|
+
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
26
|
+
<input onChange={onChange}></input>
|
|
27
|
+
</div>);
|
|
28
|
+
}
|
|
29
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var custom_mitosis_1 = require("@dummy/custom-mitosis");
|
|
4
|
+
function MyBasicComponent() {
|
|
5
|
+
var state = (0, custom_mitosis_1.useStore)({
|
|
6
|
+
name: 'PatrickJS',
|
|
7
|
+
});
|
|
8
|
+
return <div>Hello {state.name}! I can run in React, Qwik, Vue, Solid, or Liquid!</div>;
|
|
9
|
+
}
|
|
10
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicForShowComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicForShowComponent() {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
name: 'PatrickJS',
|
|
7
|
+
names: ['Steve', 'PatrickJS'],
|
|
8
|
+
});
|
|
9
|
+
return (<div>
|
|
10
|
+
<mitosis_1.For each={state.names}>
|
|
11
|
+
{function (person) { return (<mitosis_1.Show when={person === state.name}>
|
|
12
|
+
<input value={state.name} onChange={function (event) {
|
|
13
|
+
state.name = event.target.value + ' and ' + person;
|
|
14
|
+
}}/>
|
|
15
|
+
Hello {person}! I can run in Qwik, Web Component, React, Vue, Solid, or Liquid!
|
|
16
|
+
</mitosis_1.Show>); }}
|
|
17
|
+
</mitosis_1.For>
|
|
18
|
+
</div>);
|
|
19
|
+
}
|
|
20
|
+
exports.default = MyBasicForShowComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicForComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicForComponent() {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
name: 'PatrickJS',
|
|
7
|
+
names: ['Steve', 'PatrickJS'],
|
|
8
|
+
});
|
|
9
|
+
(0, mitosis_1.onMount)(function () {
|
|
10
|
+
console.log('onMount code');
|
|
11
|
+
});
|
|
12
|
+
return (<div>
|
|
13
|
+
<mitosis_1.For each={state.names}>
|
|
14
|
+
{function (person) { return (<>
|
|
15
|
+
<input value={state.name} onChange={function (event) {
|
|
16
|
+
state.name = event.target.value + ' and ' + person;
|
|
17
|
+
}}/>
|
|
18
|
+
Hello {person}! I can run in Qwik, Web Component, React, Vue, Solid, or Liquid!
|
|
19
|
+
</>); }}
|
|
20
|
+
</mitosis_1.For>
|
|
21
|
+
</div>);
|
|
22
|
+
}
|
|
23
|
+
exports.default = MyBasicForComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
(0, mitosis_1.useMetadata)({
|
|
5
|
+
forwardRef: 'inputRef',
|
|
6
|
+
});
|
|
7
|
+
function MyBasicForwardRefComponent(props) {
|
|
8
|
+
var state = (0, mitosis_1.useStore)({
|
|
9
|
+
name: 'PatrickJS',
|
|
10
|
+
});
|
|
11
|
+
return (<div>
|
|
12
|
+
<input ref={props.inputRef} css={{
|
|
13
|
+
color: 'red',
|
|
14
|
+
}} value={state.name} onChange={function (event) { return (state.name = event.target.value); }}/>
|
|
15
|
+
</div>);
|
|
16
|
+
}
|
|
17
|
+
exports.default = MyBasicForwardRefComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicForwardRefComponent(props) {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
name: 'PatrickJS',
|
|
7
|
+
});
|
|
8
|
+
return (<div>
|
|
9
|
+
<input ref={props.inputRef} css={{
|
|
10
|
+
color: 'red',
|
|
11
|
+
}} value={state.name} onChange={function (event) { return (state.name = event.target.value); }}/>
|
|
12
|
+
</div>);
|
|
13
|
+
}
|
|
14
|
+
exports.default = MyBasicForwardRefComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicComponent() {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
name: 'Steve',
|
|
7
|
+
});
|
|
8
|
+
return (<div class="test" css={{
|
|
9
|
+
padding: '10px',
|
|
10
|
+
}}>
|
|
11
|
+
<input value={state.name} onChange={function (myEvent) {
|
|
12
|
+
state.name = myEvent.target.value;
|
|
13
|
+
}}/>
|
|
14
|
+
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
15
|
+
</div>);
|
|
16
|
+
}
|
|
17
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicOnMountUpdateComponent(props) {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
name: 'PatrickJS',
|
|
7
|
+
names: ['Steve', 'PatrickJS'],
|
|
8
|
+
});
|
|
9
|
+
(0, mitosis_1.onInit)(function () {
|
|
10
|
+
state.name = 'PatrickJS onInit' + props.hi;
|
|
11
|
+
});
|
|
12
|
+
(0, mitosis_1.onMount)(function () {
|
|
13
|
+
state.name = 'PatrickJS onMount' + props.bye;
|
|
14
|
+
});
|
|
15
|
+
return <div>Hello {state.name}</div>;
|
|
16
|
+
}
|
|
17
|
+
exports.default = MyBasicOnMountUpdateComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicOnUpdateReturnComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicOnUpdateReturnComponent() {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
name: 'PatrickJS',
|
|
7
|
+
});
|
|
8
|
+
(0, mitosis_1.onUpdate)(function () {
|
|
9
|
+
var controller = new AbortController();
|
|
10
|
+
var signal = controller.signal;
|
|
11
|
+
fetch('https://patrickjs.com/api/resource.json', { signal: signal })
|
|
12
|
+
.then(function (response) { return response.json(); })
|
|
13
|
+
.then(function (data) {
|
|
14
|
+
state.name = data.name;
|
|
15
|
+
});
|
|
16
|
+
return function () {
|
|
17
|
+
if (!signal.aborted) {
|
|
18
|
+
controller.abort();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}, [state.name]);
|
|
22
|
+
return <div>Hello! {state.name}</div>;
|
|
23
|
+
}
|
|
24
|
+
exports.default = MyBasicOnUpdateReturnComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicOutputsComponent(props: any): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
(0, mitosis_1.useMetadata)({
|
|
5
|
+
outputs: ['onMessage', 'onEvent'],
|
|
6
|
+
});
|
|
7
|
+
function MyBasicOutputsComponent(props) {
|
|
8
|
+
var state = (0, mitosis_1.useStore)({
|
|
9
|
+
name: 'PatrickJS',
|
|
10
|
+
});
|
|
11
|
+
(0, mitosis_1.onMount)(function () {
|
|
12
|
+
props.onMessage(state.name);
|
|
13
|
+
props.onEvent(props.message);
|
|
14
|
+
});
|
|
15
|
+
return <div></div>;
|
|
16
|
+
}
|
|
17
|
+
exports.default = MyBasicOutputsComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicOutputsComponent(props: any): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicOutputsComponent(props) {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
name: 'PatrickJS',
|
|
7
|
+
});
|
|
8
|
+
(0, mitosis_1.onMount)(function () {
|
|
9
|
+
props.onMessage(state.name);
|
|
10
|
+
props.onEvent(props.message);
|
|
11
|
+
});
|
|
12
|
+
return <div></div>;
|
|
13
|
+
}
|
|
14
|
+
exports.default = MyBasicOutputsComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.run = exports.bar = exports.a = void 0;
|
|
4
|
+
var b = 3;
|
|
5
|
+
var foo = function () { };
|
|
6
|
+
exports.a = 3;
|
|
7
|
+
var bar = function () { };
|
|
8
|
+
exports.bar = bar;
|
|
9
|
+
function run(value) { }
|
|
10
|
+
exports.run = run;
|
|
11
|
+
function MyBasicComponent(props) {
|
|
12
|
+
return <div></div>;
|
|
13
|
+
}
|
|
14
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicComponent(_a) {
|
|
5
|
+
var c = _a.children, type = _a.type;
|
|
6
|
+
var state = (0, mitosis_1.useStore)({
|
|
7
|
+
name: 'Decadef20',
|
|
8
|
+
});
|
|
9
|
+
return (<div>
|
|
10
|
+
{c} {type}
|
|
11
|
+
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
12
|
+
</div>);
|
|
13
|
+
}
|
|
14
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicComponent(props) {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
name: 'Decadef20',
|
|
7
|
+
});
|
|
8
|
+
return (<div>
|
|
9
|
+
{props.children} {props.type}
|
|
10
|
+
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
11
|
+
</div>);
|
|
12
|
+
}
|
|
13
|
+
exports.default = MyBasicComponent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicRefAssignmentComponent(props) {
|
|
5
|
+
var holdValueRef = (0, mitosis_1.useRef)('Patrick');
|
|
6
|
+
function handlerClick(event) {
|
|
7
|
+
event.preventDefault();
|
|
8
|
+
console.log('current value', holdValueRef);
|
|
9
|
+
holdValueRef = holdValueRef + 'JS';
|
|
10
|
+
}
|
|
11
|
+
return (<div>
|
|
12
|
+
<button onClick={function (evt) { return handlerClick(evt); }}>Click</button>
|
|
13
|
+
</div>);
|
|
14
|
+
}
|
|
15
|
+
exports.default = MyBasicRefAssignmentComponent;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePrevious = void 0;
|
|
4
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
5
|
+
function usePrevious(value) {
|
|
6
|
+
// The ref object is a generic container whose current property is mutable ...
|
|
7
|
+
// ... and can hold any value, similar to an instance property on a class
|
|
8
|
+
var ref = (0, mitosis_1.useRef)(null);
|
|
9
|
+
// Store current value in ref
|
|
10
|
+
(0, mitosis_1.onUpdate)(function () {
|
|
11
|
+
ref = value;
|
|
12
|
+
}, [value]); // Only re-run if value changes
|
|
13
|
+
// Return previous value (happens before update in useEffect above)
|
|
14
|
+
return ref;
|
|
15
|
+
}
|
|
16
|
+
exports.usePrevious = usePrevious;
|
|
17
|
+
function MyPreviousComponent(props) {
|
|
18
|
+
var state = (0, mitosis_1.useStore)({
|
|
19
|
+
count: 0,
|
|
20
|
+
});
|
|
21
|
+
var prevCount = (0, mitosis_1.useRef)(state.count);
|
|
22
|
+
(0, mitosis_1.onUpdate)(function () {
|
|
23
|
+
prevCount = state.count;
|
|
24
|
+
}, [state.count]); //
|
|
25
|
+
// Get the previous value (was passed into hook on last render)
|
|
26
|
+
// const prevCount = usePrevious(state.count);
|
|
27
|
+
// Display both current and previous count value
|
|
28
|
+
return (<div>
|
|
29
|
+
<h1>
|
|
30
|
+
Now: {state.count}, before: {prevCount}
|
|
31
|
+
</h1>
|
|
32
|
+
<button onClick={function () { return (state.count += 1); }}>Increment</button>
|
|
33
|
+
</div>);
|
|
34
|
+
}
|
|
35
|
+
exports.default = MyPreviousComponent;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
return (<div>
|
|
18
|
+
{props.showInput && (<>
|
|
19
|
+
<input ref={inputRef} css={{
|
|
20
|
+
color: 'red',
|
|
21
|
+
}} value={state.name} onBlur={function (event) { return onBlur(); }} onChange={function (event) { return (state.name = event.target.value); }}/>
|
|
22
|
+
|
|
23
|
+
<label ref={inputNoArgRef} for="cars">
|
|
24
|
+
Choose a car:
|
|
25
|
+
</label>
|
|
26
|
+
|
|
27
|
+
<select name="cars" id="cars">
|
|
28
|
+
<option value="supra">GR Supra</option>
|
|
29
|
+
<option value="86">GR 86</option>
|
|
30
|
+
</select>
|
|
31
|
+
</>)}
|
|
32
|
+
Hello
|
|
33
|
+
{lowerCaseName()}! I can run in React, Qwik, Vue, Solid, or Web Component!
|
|
34
|
+
</div>);
|
|
35
|
+
}
|
|
36
|
+
exports.default = MyBasicRefComponent;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_VALUES = void 0;
|
|
3
4
|
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
exports.DEFAULT_VALUES = {
|
|
6
|
+
name: 'Steve',
|
|
7
|
+
};
|
|
8
|
+
function MyBasicComponent(props) {
|
|
9
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
10
|
name: 'Steve',
|
|
11
|
+
underscore_fn_name: function () {
|
|
12
|
+
return 'bar';
|
|
13
|
+
},
|
|
7
14
|
});
|
|
8
|
-
return (<div
|
|
9
|
-
|
|
15
|
+
return (<div class="test" css={{
|
|
16
|
+
padding: '10px',
|
|
17
|
+
}}>
|
|
18
|
+
<input value={exports.DEFAULT_VALUES.name || state.name} onChange={function (myEvent) { return (state.name = myEvent.target.value); }}/>
|
|
10
19
|
Hello! I can run in React, Vue, Solid, or Liquid!
|
|
11
20
|
</div>);
|
|
12
21
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function ClassNameCode(props) {
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
|
+
bindings: 'a binding',
|
|
7
|
+
});
|
|
8
|
+
return (<div>
|
|
9
|
+
{/*// @ts-ignore */}
|
|
10
|
+
<div className="no binding">Without Binding</div>
|
|
11
|
+
{/*// @ts-ignore */}
|
|
12
|
+
<div className={state.bindings}>With binding</div>
|
|
13
|
+
</div>);
|
|
14
|
+
}
|
|
15
|
+
exports.default = ClassNameCode;
|
|
@@ -8,5 +8,5 @@ export interface ColumnProps {
|
|
|
8
8
|
stackColumnsAt?: 'tablet' | 'mobile' | 'never';
|
|
9
9
|
reverseColumnsWhenStacked?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export default function Column(props: ColumnProps): JSX.Element;
|
|
11
|
+
export default function Column(props: ColumnProps): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
4
|
function Column(props) {
|
|
5
|
-
var state = (0, mitosis_1.
|
|
5
|
+
var state = (0, mitosis_1.useStore)({
|
|
6
6
|
getColumns: function () {
|
|
7
7
|
return props.columns || [];
|
|
8
8
|
},
|