@builder.io/mitosis 0.0.0-dev-20260605060721
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/constants/hooks.d.ts +16 -0
- package/dist/src/constants/hooks.js +19 -0
- package/dist/src/constants/html_tags.d.ts +2 -0
- package/dist/src/constants/html_tags.js +198 -0
- package/dist/src/constants/media-sizes.d.ts +22 -0
- package/dist/src/constants/media-sizes.js +34 -0
- package/dist/src/constants/method-literal-prefix.d.ts +1 -0
- package/dist/src/constants/method-literal-prefix.js +2 -0
- package/dist/src/flow.d.ts +26 -0
- package/dist/src/flow.js +27 -0
- package/dist/src/generators/alpine/generate.d.ts +11 -0
- package/dist/src/generators/alpine/generate.js +201 -0
- package/dist/src/generators/alpine/index.d.ts +2 -0
- package/dist/src/generators/alpine/index.js +18 -0
- package/dist/src/generators/alpine/render-mount-hook.d.ts +2 -0
- package/dist/src/generators/alpine/render-mount-hook.js +17 -0
- package/dist/src/generators/alpine/render-update-hooks.d.ts +5 -0
- package/dist/src/generators/alpine/render-update-hooks.js +44 -0
- package/dist/src/generators/alpine/types.d.ts +12 -0
- package/dist/src/generators/alpine/types.js +2 -0
- package/dist/src/generators/angular/classic/blocks.d.ts +10 -0
- package/dist/src/generators/angular/classic/blocks.js +409 -0
- package/dist/src/generators/angular/classic/component.d.ts +3 -0
- package/dist/src/generators/angular/classic/component.js +356 -0
- package/dist/src/generators/angular/classic/plugins/get-class-properties-plugin.d.ts +2 -0
- package/dist/src/generators/angular/classic/plugins/get-class-properties-plugin.js +138 -0
- package/dist/src/generators/angular/classic/plugins/get-code-processor-plugins.d.ts +8 -0
- package/dist/src/generators/angular/classic/plugins/get-code-processor-plugins.js +60 -0
- package/dist/src/generators/angular/component.d.ts +3 -0
- package/dist/src/generators/angular/component.js +27 -0
- package/dist/src/generators/angular/helpers/format.d.ts +1 -0
- package/dist/src/generators/angular/helpers/format.js +24 -0
- package/dist/src/generators/angular/helpers/get-inputs.d.ts +7 -0
- package/dist/src/generators/angular/helpers/get-inputs.js +18 -0
- package/dist/src/generators/angular/helpers/get-outputs.d.ts +7 -0
- package/dist/src/generators/angular/helpers/get-outputs.js +23 -0
- package/dist/src/generators/angular/helpers/get-refs.d.ts +8 -0
- package/dist/src/generators/angular/helpers/get-refs.js +40 -0
- package/dist/src/generators/angular/helpers/get-styles.d.ts +6 -0
- package/dist/src/generators/angular/helpers/get-styles.js +17 -0
- package/dist/src/generators/angular/helpers/hooks.d.ts +25 -0
- package/dist/src/generators/angular/helpers/hooks.js +59 -0
- package/dist/src/generators/angular/helpers/index.d.ts +33 -0
- package/dist/src/generators/angular/helpers/index.js +221 -0
- package/dist/src/generators/angular/helpers/parse-selector.d.ts +5 -0
- package/dist/src/generators/angular/helpers/parse-selector.js +19 -0
- package/dist/src/generators/angular/index.d.ts +2 -0
- package/dist/src/generators/angular/index.js +18 -0
- package/dist/src/generators/angular/signals/blocks.d.ts +10 -0
- package/dist/src/generators/angular/signals/blocks.js +379 -0
- package/dist/src/generators/angular/signals/component.d.ts +3 -0
- package/dist/src/generators/angular/signals/component.js +377 -0
- package/dist/src/generators/angular/signals/helpers/get-computed.d.ts +6 -0
- package/dist/src/generators/angular/signals/helpers/get-computed.js +79 -0
- package/dist/src/generators/angular/signals/helpers/get-dynamic-template-refs.d.ts +2 -0
- package/dist/src/generators/angular/signals/helpers/get-dynamic-template-refs.js +25 -0
- package/dist/src/generators/angular/signals/helpers/get-inputs.d.ts +7 -0
- package/dist/src/generators/angular/signals/helpers/get-inputs.js +15 -0
- package/dist/src/generators/angular/signals/helpers/index.d.ts +16 -0
- package/dist/src/generators/angular/signals/helpers/index.js +30 -0
- package/dist/src/generators/angular/signals/plugins/get-code-processor-plugins.d.ts +4 -0
- package/dist/src/generators/angular/signals/plugins/get-code-processor-plugins.js +547 -0
- package/dist/src/generators/angular/types.d.ts +72 -0
- package/dist/src/generators/angular/types.js +12 -0
- package/dist/src/generators/builder/generator.d.ts +12 -0
- package/dist/src/generators/builder/generator.js +876 -0
- package/dist/src/generators/builder/index.d.ts +2 -0
- package/dist/src/generators/builder/index.js +18 -0
- package/dist/src/generators/builder/types.d.ts +6 -0
- package/dist/src/generators/builder/types.js +2 -0
- package/dist/src/generators/context/angular.d.ts +9 -0
- package/dist/src/generators/context/angular.js +40 -0
- package/dist/src/generators/context/helpers/context-with-symbol-key.d.ts +5 -0
- package/dist/src/generators/context/helpers/context-with-symbol-key.js +33 -0
- package/dist/src/generators/context/qwik.d.ts +8 -0
- package/dist/src/generators/context/qwik.js +29 -0
- package/dist/src/generators/context/react.d.ts +10 -0
- package/dist/src/generators/context/react.js +30 -0
- package/dist/src/generators/context/rsc.d.ts +12 -0
- package/dist/src/generators/context/rsc.js +32 -0
- package/dist/src/generators/context/solid.d.ts +8 -0
- package/dist/src/generators/context/solid.js +30 -0
- package/dist/src/generators/context/svelte.d.ts +11 -0
- package/dist/src/generators/context/svelte.js +44 -0
- package/dist/src/generators/context/vue.d.ts +3 -0
- package/dist/src/generators/context/vue.js +5 -0
- package/dist/src/generators/helpers/context.d.ts +8 -0
- package/dist/src/generators/helpers/context.js +15 -0
- package/dist/src/generators/helpers/functions.d.ts +2 -0
- package/dist/src/generators/helpers/functions.js +31 -0
- package/dist/src/generators/helpers/minify.d.ts +1 -0
- package/dist/src/generators/helpers/minify.js +20 -0
- package/dist/src/generators/helpers/on-mount.d.ts +5 -0
- package/dist/src/generators/helpers/on-mount.js +25 -0
- package/dist/src/generators/helpers/rsc.d.ts +2 -0
- package/dist/src/generators/helpers/rsc.js +38 -0
- package/dist/src/generators/html/generator.d.ts +4 -0
- package/dist/src/generators/html/generator.js +1232 -0
- package/dist/src/generators/html/index.d.ts +2 -0
- package/dist/src/generators/html/index.js +18 -0
- package/dist/src/generators/html/types.d.ts +6 -0
- package/dist/src/generators/html/types.js +2 -0
- package/dist/src/generators/liquid/generator.d.ts +9 -0
- package/dist/src/generators/liquid/generator.js +161 -0
- package/dist/src/generators/liquid/index.d.ts +2 -0
- package/dist/src/generators/liquid/index.js +18 -0
- package/dist/src/generators/liquid/types.d.ts +5 -0
- package/dist/src/generators/liquid/types.js +2 -0
- package/dist/src/generators/lit/collect-class-string.d.ts +2 -0
- package/dist/src/generators/lit/collect-class-string.js +41 -0
- package/dist/src/generators/lit/generate.d.ts +3 -0
- package/dist/src/generators/lit/generate.js +271 -0
- package/dist/src/generators/lit/index.d.ts +2 -0
- package/dist/src/generators/lit/index.js +18 -0
- package/dist/src/generators/lit/types.d.ts +8 -0
- package/dist/src/generators/lit/types.js +2 -0
- package/dist/src/generators/marko/generate.d.ts +20 -0
- package/dist/src/generators/marko/generate.js +316 -0
- package/dist/src/generators/marko/index.d.ts +2 -0
- package/dist/src/generators/marko/index.js +18 -0
- package/dist/src/generators/marko/types.d.ts +4 -0
- package/dist/src/generators/marko/types.js +2 -0
- package/dist/src/generators/mitosis/generator.d.ts +7 -0
- package/dist/src/generators/mitosis/generator.js +367 -0
- package/dist/src/generators/mitosis/index.d.ts +2 -0
- package/dist/src/generators/mitosis/index.js +18 -0
- package/dist/src/generators/mitosis/types.d.ts +8 -0
- package/dist/src/generators/mitosis/types.js +2 -0
- package/dist/src/generators/qwik/component-generator.d.ts +3 -0
- package/dist/src/generators/qwik/component-generator.js +337 -0
- package/dist/src/generators/qwik/component.d.ts +21 -0
- package/dist/src/generators/qwik/component.js +170 -0
- package/dist/src/generators/qwik/directives.d.ts +24 -0
- package/dist/src/generators/qwik/directives.js +152 -0
- package/dist/src/generators/qwik/helpers/add-prevent-default.d.ts +7 -0
- package/dist/src/generators/qwik/helpers/add-prevent-default.js +33 -0
- package/dist/src/generators/qwik/helpers/convert-method-to-function.d.ts +2 -0
- package/dist/src/generators/qwik/helpers/convert-method-to-function.js +161 -0
- package/dist/src/generators/qwik/helpers/handlers.d.ts +3 -0
- package/dist/src/generators/qwik/helpers/handlers.js +60 -0
- package/dist/src/generators/qwik/helpers/stable-inject.d.ts +5 -0
- package/dist/src/generators/qwik/helpers/stable-inject.js +49 -0
- package/dist/src/generators/qwik/helpers/stable-serialize.d.ts +6 -0
- package/dist/src/generators/qwik/helpers/stable-serialize.js +50 -0
- package/dist/src/generators/qwik/helpers/state.d.ts +32 -0
- package/dist/src/generators/qwik/helpers/state.js +111 -0
- package/dist/src/generators/qwik/helpers/styles.d.ts +7 -0
- package/dist/src/generators/qwik/helpers/styles.js +70 -0
- package/dist/src/generators/qwik/index.d.ts +5 -0
- package/dist/src/generators/qwik/index.js +26 -0
- package/dist/src/generators/qwik/jsx.d.ts +17 -0
- package/dist/src/generators/qwik/jsx.js +223 -0
- package/dist/src/generators/qwik/src-generator.d.ts +83 -0
- package/dist/src/generators/qwik/src-generator.js +575 -0
- package/dist/src/generators/qwik/types.d.ts +14 -0
- package/dist/src/generators/qwik/types.js +2 -0
- package/dist/src/generators/react/blocks.d.ts +4 -0
- package/dist/src/generators/react/blocks.js +332 -0
- package/dist/src/generators/react/generator.d.ts +5 -0
- package/dist/src/generators/react/generator.js +399 -0
- package/dist/src/generators/react/helpers/default-props.d.ts +2 -0
- package/dist/src/generators/react/helpers/default-props.js +21 -0
- package/dist/src/generators/react/helpers/hooks.d.ts +20 -0
- package/dist/src/generators/react/helpers/hooks.js +67 -0
- package/dist/src/generators/react/helpers/index.d.ts +11 -0
- package/dist/src/generators/react/helpers/index.js +97 -0
- package/dist/src/generators/react/helpers/state.d.ts +17 -0
- package/dist/src/generators/react/helpers/state.js +198 -0
- package/dist/src/generators/react/index.d.ts +3 -0
- package/dist/src/generators/react/index.js +21 -0
- package/dist/src/generators/react/types.d.ts +22 -0
- package/dist/src/generators/react/types.js +2 -0
- package/dist/src/generators/react-native/extract-css-var-default-value.d.ts +1 -0
- package/dist/src/generators/react-native/extract-css-var-default-value.js +15 -0
- package/dist/src/generators/react-native/helpers.d.ts +3 -0
- package/dist/src/generators/react-native/helpers.js +133 -0
- package/dist/src/generators/react-native/index.d.ts +8 -0
- package/dist/src/generators/react-native/index.js +286 -0
- package/dist/src/generators/react-native/sanitize-react-native-block-styles.d.ts +4 -0
- package/dist/src/generators/react-native/sanitize-react-native-block-styles.js +57 -0
- package/dist/src/generators/react-native/types.d.ts +9 -0
- package/dist/src/generators/react-native/types.js +2 -0
- package/dist/src/generators/rsc/generator.d.ts +3 -0
- package/dist/src/generators/rsc/generator.js +77 -0
- package/dist/src/generators/rsc/index.d.ts +2 -0
- package/dist/src/generators/rsc/index.js +18 -0
- package/dist/src/generators/rsc/types.d.ts +5 -0
- package/dist/src/generators/rsc/types.js +2 -0
- package/dist/src/generators/solid/blocks.d.ts +4 -0
- package/dist/src/generators/solid/blocks.js +138 -0
- package/dist/src/generators/solid/helpers/styles.d.ts +3 -0
- package/dist/src/generators/solid/helpers/styles.js +47 -0
- package/dist/src/generators/solid/index.d.ts +4 -0
- package/dist/src/generators/solid/index.js +264 -0
- package/dist/src/generators/solid/state/helpers.d.ts +13 -0
- package/dist/src/generators/solid/state/helpers.js +88 -0
- package/dist/src/generators/solid/state/index.d.ts +1 -0
- package/dist/src/generators/solid/state/index.js +5 -0
- package/dist/src/generators/solid/state/signals.d.ts +7 -0
- package/dist/src/generators/solid/state/signals.js +53 -0
- package/dist/src/generators/solid/state/state.d.ts +14 -0
- package/dist/src/generators/solid/state/state.js +55 -0
- package/dist/src/generators/solid/state/store.d.ts +7 -0
- package/dist/src/generators/solid/state/store.js +76 -0
- package/dist/src/generators/solid/types.d.ts +10 -0
- package/dist/src/generators/solid/types.js +2 -0
- package/dist/src/generators/stencil/blocks.d.ts +9 -0
- package/dist/src/generators/stencil/blocks.js +122 -0
- package/dist/src/generators/stencil/component.d.ts +3 -0
- package/dist/src/generators/stencil/component.js +199 -0
- package/dist/src/generators/stencil/helpers/collect-class-string.d.ts +2 -0
- package/dist/src/generators/stencil/helpers/collect-class-string.js +43 -0
- package/dist/src/generators/stencil/helpers/index.d.ts +37 -0
- package/dist/src/generators/stencil/helpers/index.js +129 -0
- package/dist/src/generators/stencil/index.d.ts +2 -0
- package/dist/src/generators/stencil/index.js +18 -0
- package/dist/src/generators/stencil/plugins/get-code-processor-plugins.d.ts +4 -0
- package/dist/src/generators/stencil/plugins/get-code-processor-plugins.js +25 -0
- package/dist/src/generators/stencil/types.d.ts +37 -0
- package/dist/src/generators/stencil/types.js +2 -0
- package/dist/src/generators/svelte/blocks.d.ts +10 -0
- package/dist/src/generators/svelte/blocks.js +280 -0
- package/dist/src/generators/svelte/helpers.d.ts +6 -0
- package/dist/src/generators/svelte/helpers.js +14 -0
- package/dist/src/generators/svelte/index.d.ts +2 -0
- package/dist/src/generators/svelte/index.js +20 -0
- package/dist/src/generators/svelte/svelte.d.ts +3 -0
- package/dist/src/generators/svelte/svelte.js +412 -0
- package/dist/src/generators/svelte/types.d.ts +5 -0
- package/dist/src/generators/svelte/types.js +2 -0
- package/dist/src/generators/swift/blocks.d.ts +8 -0
- package/dist/src/generators/swift/blocks.js +304 -0
- package/dist/src/generators/swift/generator.d.ts +3 -0
- package/dist/src/generators/swift/generator.js +287 -0
- package/dist/src/generators/swift/helpers.d.ts +42 -0
- package/dist/src/generators/swift/helpers.js +412 -0
- package/dist/src/generators/swift/index.d.ts +2 -0
- package/dist/src/generators/swift/index.js +18 -0
- package/dist/src/generators/swift/types.d.ts +29 -0
- package/dist/src/generators/swift/types.js +2 -0
- package/dist/src/generators/taro/generator.d.ts +8 -0
- package/dist/src/generators/taro/generator.js +168 -0
- package/dist/src/generators/taro/index.d.ts +2 -0
- package/dist/src/generators/taro/index.js +18 -0
- package/dist/src/generators/taro/types.d.ts +3 -0
- package/dist/src/generators/taro/types.js +2 -0
- package/dist/src/generators/template/generator.d.ts +3 -0
- package/dist/src/generators/template/generator.js +131 -0
- package/dist/src/generators/template/index.d.ts +2 -0
- package/dist/src/generators/template/index.js +18 -0
- package/dist/src/generators/template/types.d.ts +4 -0
- package/dist/src/generators/template/types.js +2 -0
- package/dist/src/generators/vue/blocks.d.ts +8 -0
- package/dist/src/generators/vue/blocks.js +217 -0
- package/dist/src/generators/vue/compositionApi.d.ts +3 -0
- package/dist/src/generators/vue/compositionApi.js +128 -0
- package/dist/src/generators/vue/helpers.d.ts +25 -0
- package/dist/src/generators/vue/helpers.js +179 -0
- package/dist/src/generators/vue/index.d.ts +2 -0
- package/dist/src/generators/vue/index.js +18 -0
- package/dist/src/generators/vue/optionsApi.d.ts +3 -0
- package/dist/src/generators/vue/optionsApi.js +210 -0
- package/dist/src/generators/vue/types.d.ts +33 -0
- package/dist/src/generators/vue/types.js +2 -0
- package/dist/src/generators/vue/vue.d.ts +3 -0
- package/dist/src/generators/vue/vue.js +272 -0
- package/dist/src/helpers/apply-meta-tagname.d.ts +2 -0
- package/dist/src/helpers/apply-meta-tagname.js +20 -0
- package/dist/src/helpers/babel-transform.d.ts +7 -0
- package/dist/src/helpers/babel-transform.js +130 -0
- package/dist/src/helpers/bindings.d.ts +6 -0
- package/dist/src/helpers/bindings.js +9 -0
- package/dist/src/helpers/camel-case.d.ts +8 -0
- package/dist/src/helpers/camel-case.js +17 -0
- package/dist/src/helpers/capitalize.d.ts +1 -0
- package/dist/src/helpers/capitalize.js +10 -0
- package/dist/src/helpers/class-components.d.ts +13 -0
- package/dist/src/helpers/class-components.js +51 -0
- package/dist/src/helpers/component-file-extensions.d.ts +50 -0
- package/dist/src/helpers/component-file-extensions.js +141 -0
- package/dist/src/helpers/create-mitosis-component.d.ts +7 -0
- package/dist/src/helpers/create-mitosis-component.js +27 -0
- package/dist/src/helpers/create-mitosis-context.d.ts +4 -0
- package/dist/src/helpers/create-mitosis-context.js +11 -0
- package/dist/src/helpers/create-mitosis-node.d.ts +2 -0
- package/dist/src/helpers/create-mitosis-node.js +14 -0
- package/dist/src/helpers/dash-case.d.ts +1 -0
- package/dist/src/helpers/dash-case.js +6 -0
- package/dist/src/helpers/dedent.d.ts +1 -0
- package/dist/src/helpers/dedent.js +83 -0
- package/dist/src/helpers/event-handlers.d.ts +3 -0
- package/dist/src/helpers/event-handlers.js +115 -0
- package/dist/src/helpers/fast-clone.d.ts +1 -0
- package/dist/src/helpers/fast-clone.js +5 -0
- package/dist/src/helpers/filter-empty-text-nodes.d.ts +3 -0
- package/dist/src/helpers/filter-empty-text-nodes.js +9 -0
- package/dist/src/helpers/generic-format.d.ts +6 -0
- package/dist/src/helpers/generic-format.js +35 -0
- package/dist/src/helpers/get-bindings.d.ts +2 -0
- package/dist/src/helpers/get-bindings.js +16 -0
- package/dist/src/helpers/get-child-components.d.ts +2 -0
- package/dist/src/helpers/get-child-components.js +26 -0
- package/dist/src/helpers/get-components-used.d.ts +2 -0
- package/dist/src/helpers/get-components-used.js +18 -0
- package/dist/src/helpers/get-components.d.ts +2 -0
- package/dist/src/helpers/get-components.js +21 -0
- package/dist/src/helpers/get-custom-imports.d.ts +15 -0
- package/dist/src/helpers/get-custom-imports.js +38 -0
- package/dist/src/helpers/get-function-string.d.ts +1 -0
- package/dist/src/helpers/get-function-string.js +5 -0
- package/dist/src/helpers/get-prop-functions.d.ts +5 -0
- package/dist/src/helpers/get-prop-functions.js +28 -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-props.d.ts +5 -0
- package/dist/src/helpers/get-props.js +41 -0
- package/dist/src/helpers/get-refs.d.ts +2 -0
- package/dist/src/helpers/get-refs.js +21 -0
- package/dist/src/helpers/get-state-object-string.d.ts +20 -0
- package/dist/src/helpers/get-state-object-string.js +86 -0
- package/dist/src/helpers/get-state-used.d.ts +5 -0
- package/dist/src/helpers/get-state-used.js +28 -0
- package/dist/src/helpers/get-styles.d.ts +4 -0
- package/dist/src/helpers/get-styles.js +34 -0
- package/dist/src/helpers/get-tag-name.d.ts +2 -0
- package/dist/src/helpers/get-tag-name.js +7 -0
- package/dist/src/helpers/get-typed-function.d.ts +4 -0
- package/dist/src/helpers/get-typed-function.js +20 -0
- package/dist/src/helpers/getters-to-functions.d.ts +5 -0
- package/dist/src/helpers/getters-to-functions.js +36 -0
- package/dist/src/helpers/handle-missing-state.d.ts +2 -0
- package/dist/src/helpers/handle-missing-state.js +13 -0
- 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-component.d.ts +2 -0
- package/dist/src/helpers/has-component.js +21 -0
- package/dist/src/helpers/has-props.d.ts +2 -0
- package/dist/src/helpers/has-props.js +19 -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/has.d.ts +9 -0
- package/dist/src/helpers/has.js +27 -0
- package/dist/src/helpers/html-escape.d.ts +1 -0
- package/dist/src/helpers/html-escape.js +7 -0
- package/dist/src/helpers/indent.d.ts +1 -0
- package/dist/src/helpers/indent.js +7 -0
- package/dist/src/helpers/is-children.d.ts +6 -0
- package/dist/src/helpers/is-children.js +14 -0
- package/dist/src/helpers/is-component.d.ts +5 -0
- package/dist/src/helpers/is-component.js +8 -0
- package/dist/src/helpers/is-hook-empty.d.ts +2 -0
- package/dist/src/helpers/is-hook-empty.js +14 -0
- package/dist/src/helpers/is-html-attribute.d.ts +4 -0
- package/dist/src/helpers/is-html-attribute.js +371 -0
- package/dist/src/helpers/is-mitosis-node.d.ts +2 -0
- package/dist/src/helpers/is-mitosis-node.js +7 -0
- package/dist/src/helpers/is-root-text-node.d.ts +4 -0
- package/dist/src/helpers/is-root-text-node.js +12 -0
- package/dist/src/helpers/is-upper-case.d.ts +1 -0
- package/dist/src/helpers/is-upper-case.js +5 -0
- package/dist/src/helpers/is-valid-attribute-name.d.ts +1 -0
- package/dist/src/helpers/is-valid-attribute-name.js +7 -0
- package/dist/src/helpers/json.d.ts +3 -0
- package/dist/src/helpers/json.js +17 -0
- package/dist/src/helpers/map-refs.d.ts +9 -0
- package/dist/src/helpers/map-refs.js +91 -0
- package/dist/src/helpers/merge-options.d.ts +19 -0
- package/dist/src/helpers/merge-options.js +35 -0
- package/dist/src/helpers/mitosis-imports.d.ts +5 -0
- package/dist/src/helpers/mitosis-imports.js +48 -0
- package/dist/src/helpers/nodes/for.d.ts +4 -0
- package/dist/src/helpers/nodes/for.js +12 -0
- package/dist/src/helpers/nullable.d.ts +2 -0
- package/dist/src/helpers/nullable.js +5 -0
- package/dist/src/helpers/on-event.d.ts +14 -0
- package/dist/src/helpers/on-event.js +52 -0
- package/dist/src/helpers/output.d.ts +5 -0
- package/dist/src/helpers/output.js +10 -0
- package/dist/src/helpers/parse-node.d.ts +2 -0
- package/dist/src/helpers/parse-node.js +20 -0
- package/dist/src/helpers/parsers.d.ts +9 -0
- package/dist/src/helpers/parsers.js +66 -0
- package/dist/src/helpers/patterns.d.ts +8 -0
- package/dist/src/helpers/patterns.js +17 -0
- package/dist/src/helpers/plugins/process-code/index.d.ts +12 -0
- package/dist/src/helpers/plugins/process-code/index.js +169 -0
- package/dist/src/helpers/plugins/process-code/types.d.ts +7 -0
- package/dist/src/helpers/plugins/process-code/types.js +2 -0
- package/dist/src/helpers/plugins/process-signals.d.ts +22 -0
- package/dist/src/helpers/plugins/process-signals.js +179 -0
- package/dist/src/helpers/plugins/process-target-blocks.d.ts +6 -0
- package/dist/src/helpers/plugins/process-target-blocks.js +59 -0
- package/dist/src/helpers/process-http-requests.d.ts +2 -0
- package/dist/src/helpers/process-http-requests.js +25 -0
- package/dist/src/helpers/remove-surrounding-block.d.ts +6 -0
- package/dist/src/helpers/remove-surrounding-block.js +25 -0
- package/dist/src/helpers/render-imports.d.ts +42 -0
- package/dist/src/helpers/render-imports.js +169 -0
- package/dist/src/helpers/replace-identifiers.d.ts +27 -0
- package/dist/src/helpers/replace-identifiers.js +187 -0
- package/dist/src/helpers/replace-new-lines-in-strings.d.ts +1 -0
- package/dist/src/helpers/replace-new-lines-in-strings.js +26 -0
- package/dist/src/helpers/set.d.ts +7 -0
- package/dist/src/helpers/set.js +24 -0
- package/dist/src/helpers/signals/index.d.ts +1 -0
- package/dist/src/helpers/signals/index.js +17 -0
- package/dist/src/helpers/signals/signals.d.ts +22 -0
- package/dist/src/helpers/signals/signals.js +109 -0
- package/dist/src/helpers/slots.d.ts +5 -0
- package/dist/src/helpers/slots.js +26 -0
- package/dist/src/helpers/state.d.ts +2 -0
- package/dist/src/helpers/state.js +5 -0
- package/dist/src/helpers/strip-meta-properties.d.ts +2 -0
- package/dist/src/helpers/strip-meta-properties.js +26 -0
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +38 -0
- package/dist/src/helpers/strip-state-and-props-refs.js +86 -0
- package/dist/src/helpers/styles/collect-css.d.ts +7 -0
- package/dist/src/helpers/styles/collect-css.js +113 -0
- package/dist/src/helpers/styles/collect-styled-components.d.ts +2 -0
- package/dist/src/helpers/styles/collect-styled-components.js +64 -0
- package/dist/src/helpers/styles/helpers.d.ts +31 -0
- package/dist/src/helpers/styles/helpers.js +90 -0
- package/dist/src/helpers/trace-reference-to-module-path.d.ts +2 -0
- package/dist/src/helpers/trace-reference-to-module-path.js +13 -0
- package/dist/src/helpers/transform-state-setters.d.ts +14 -0
- package/dist/src/helpers/transform-state-setters.js +24 -0
- package/dist/src/helpers/transform-to-jsx.d.ts +4 -0
- package/dist/src/helpers/transform-to-jsx.js +13 -0
- package/dist/src/helpers/traverse-nodes.d.ts +4 -0
- package/dist/src/helpers/traverse-nodes.js +16 -0
- package/dist/src/helpers/try-prettier-format.d.ts +1 -0
- package/dist/src/helpers/try-prettier-format.js +24 -0
- package/dist/src/helpers/typescript-project.d.ts +7 -0
- package/dist/src/helpers/typescript-project.js +63 -0
- package/dist/src/helpers/typescript.d.ts +9 -0
- package/dist/src/helpers/typescript.js +5 -0
- package/dist/src/helpers/web-components/attribute-passing.d.ts +6 -0
- package/dist/src/helpers/web-components/attribute-passing.js +47 -0
- package/dist/src/index.d.ts +96 -0
- package/dist/src/index.js +74 -0
- package/dist/src/modules/plugins.d.ts +25 -0
- package/dist/src/modules/plugins.js +51 -0
- package/dist/src/parsers/angular.d.ts +5 -0
- package/dist/src/parsers/angular.js +154 -0
- package/dist/src/parsers/builder/builder.d.ts +55 -0
- package/dist/src/parsers/builder/builder.js +1198 -0
- package/dist/src/parsers/builder/helpers.d.ts +3 -0
- package/dist/src/parsers/builder/helpers.js +26 -0
- package/dist/src/parsers/builder/index.d.ts +1 -0
- package/dist/src/parsers/builder/index.js +17 -0
- package/dist/src/parsers/context.d.ts +6 -0
- package/dist/src/parsers/context.js +82 -0
- package/dist/src/parsers/jsx/ast.d.ts +5 -0
- package/dist/src/parsers/jsx/ast.js +74 -0
- package/dist/src/parsers/jsx/component-types.d.ts +8 -0
- package/dist/src/parsers/jsx/component-types.js +82 -0
- package/dist/src/parsers/jsx/context.d.ts +6 -0
- package/dist/src/parsers/jsx/context.js +68 -0
- package/dist/src/parsers/jsx/element-parser.d.ts +9 -0
- package/dist/src/parsers/jsx/element-parser.js +418 -0
- package/dist/src/parsers/jsx/exports.d.ts +5 -0
- package/dist/src/parsers/jsx/exports.js +76 -0
- package/dist/src/parsers/jsx/function-parser.d.ts +9 -0
- package/dist/src/parsers/jsx/function-parser.js +360 -0
- package/dist/src/parsers/jsx/helpers.d.ts +17 -0
- package/dist/src/parsers/jsx/helpers.js +85 -0
- package/dist/src/parsers/jsx/hooks/helpers.d.ts +5 -0
- package/dist/src/parsers/jsx/hooks/helpers.js +54 -0
- package/dist/src/parsers/jsx/hooks/index.d.ts +16 -0
- package/dist/src/parsers/jsx/hooks/index.js +96 -0
- package/dist/src/parsers/jsx/hooks/use-metadata.d.ts +9 -0
- package/dist/src/parsers/jsx/hooks/use-metadata.js +184 -0
- package/dist/src/parsers/jsx/hooks/use-target.d.ts +13 -0
- package/dist/src/parsers/jsx/hooks/use-target.js +135 -0
- package/dist/src/parsers/jsx/imports.d.ts +7 -0
- package/dist/src/parsers/jsx/imports.js +23 -0
- package/dist/src/parsers/jsx/index.d.ts +2 -0
- package/dist/src/parsers/jsx/index.js +5 -0
- package/dist/src/parsers/jsx/jsx.d.ts +10 -0
- package/dist/src/parsers/jsx/jsx.js +227 -0
- package/dist/src/parsers/jsx/props-types.d.ts +5 -0
- package/dist/src/parsers/jsx/props-types.js +22 -0
- package/dist/src/parsers/jsx/props.d.ts +2 -0
- package/dist/src/parsers/jsx/props.js +64 -0
- package/dist/src/parsers/jsx/signals.d.ts +9 -0
- package/dist/src/parsers/jsx/signals.js +99 -0
- package/dist/src/parsers/jsx/state.d.ts +17 -0
- package/dist/src/parsers/jsx/state.js +274 -0
- package/dist/src/parsers/jsx/types.d.ts +29 -0
- package/dist/src/parsers/jsx/types.js +2 -0
- package/dist/src/parsers/svelte/css/index.d.ts +3 -0
- package/dist/src/parsers/svelte/css/index.js +8 -0
- package/dist/src/parsers/svelte/helpers/bindings.d.ts +3 -0
- package/dist/src/parsers/svelte/helpers/bindings.js +75 -0
- package/dist/src/parsers/svelte/helpers/children.d.ts +5 -0
- package/dist/src/parsers/svelte/helpers/children.js +22 -0
- package/dist/src/parsers/svelte/helpers/expressions.d.ts +3 -0
- package/dist/src/parsers/svelte/helpers/expressions.js +20 -0
- package/dist/src/parsers/svelte/helpers/hooks.d.ts +2 -0
- package/dist/src/parsers/svelte/helpers/hooks.js +15 -0
- package/dist/src/parsers/svelte/helpers/mitosis-node.d.ts +2 -0
- package/dist/src/parsers/svelte/helpers/mitosis-node.js +16 -0
- package/dist/src/parsers/svelte/helpers/post-process.d.ts +15 -0
- package/dist/src/parsers/svelte/helpers/post-process.js +174 -0
- package/dist/src/parsers/svelte/helpers/string.d.ts +3 -0
- package/dist/src/parsers/svelte/helpers/string.js +26 -0
- package/dist/src/parsers/svelte/html/actions.d.ts +3 -0
- package/dist/src/parsers/svelte/html/actions.js +46 -0
- package/dist/src/parsers/svelte/html/each.d.ts +4 -0
- package/dist/src/parsers/svelte/html/each.js +20 -0
- package/dist/src/parsers/svelte/html/element.d.ts +3 -0
- package/dist/src/parsers/svelte/html/element.js +224 -0
- package/dist/src/parsers/svelte/html/fragment.d.ts +3 -0
- package/dist/src/parsers/svelte/html/fragment.js +16 -0
- package/dist/src/parsers/svelte/html/if-else.d.ts +3 -0
- package/dist/src/parsers/svelte/html/if-else.js +31 -0
- package/dist/src/parsers/svelte/html/index.d.ts +5 -0
- package/dist/src/parsers/svelte/html/index.js +80 -0
- package/dist/src/parsers/svelte/html/mustache-tag.d.ts +3 -0
- package/dist/src/parsers/svelte/html/mustache-tag.js +24 -0
- package/dist/src/parsers/svelte/html/slot.d.ts +3 -0
- package/dist/src/parsers/svelte/html/slot.js +20 -0
- package/dist/src/parsers/svelte/html/text.d.ts +66 -0
- package/dist/src/parsers/svelte/html/text.js +14 -0
- package/dist/src/parsers/svelte/index.d.ts +2 -0
- package/dist/src/parsers/svelte/index.js +59 -0
- package/dist/src/parsers/svelte/instance/context.d.ts +5 -0
- package/dist/src/parsers/svelte/instance/context.js +59 -0
- package/dist/src/parsers/svelte/instance/expressions.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/expressions.js +11 -0
- package/dist/src/parsers/svelte/instance/functions.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/functions.js +66 -0
- package/dist/src/parsers/svelte/instance/hooks.d.ts +5 -0
- package/dist/src/parsers/svelte/instance/hooks.js +32 -0
- package/dist/src/parsers/svelte/instance/imports.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/imports.js +32 -0
- package/dist/src/parsers/svelte/instance/index.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/index.js +123 -0
- package/dist/src/parsers/svelte/instance/properties.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/properties.js +22 -0
- package/dist/src/parsers/svelte/instance/reactive.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/reactive.js +33 -0
- package/dist/src/parsers/svelte/instance/references.d.ts +4 -0
- package/dist/src/parsers/svelte/instance/references.js +68 -0
- package/dist/src/parsers/svelte/instance/statements.d.ts +3 -0
- package/dist/src/parsers/svelte/instance/statements.js +10 -0
- package/dist/src/parsers/svelte/module/index.d.ts +3 -0
- package/dist/src/parsers/svelte/module/index.js +34 -0
- package/dist/src/parsers/svelte/types/index.d.ts +4 -0
- package/dist/src/parsers/svelte/types/index.js +2 -0
- package/dist/src/parsers/svelte/typescript/index.d.ts +7 -0
- package/dist/src/parsers/svelte/typescript/index.js +121 -0
- package/dist/src/plugins/compile-away-builder-components.d.ts +15 -0
- package/dist/src/plugins/compile-away-builder-components.js +609 -0
- package/dist/src/plugins/compile-away-components.d.ts +33 -0
- package/dist/src/plugins/compile-away-components.js +50 -0
- package/dist/src/plugins/map-styles.d.ts +12 -0
- package/dist/src/plugins/map-styles.js +16 -0
- package/dist/src/symbols/symbol-processor.d.ts +20 -0
- package/dist/src/symbols/symbol-processor.js +202 -0
- package/dist/src/targets.d.ts +25 -0
- package/dist/src/targets.js +46 -0
- package/dist/src/types/config.d.ts +103 -0
- package/dist/src/types/config.js +2 -0
- package/dist/src/types/json.d.ts +13 -0
- package/dist/src/types/json.js +2 -0
- package/dist/src/types/metadata.d.ts +55 -0
- package/dist/src/types/metadata.js +2 -0
- package/dist/src/types/mitosis-component.d.ts +162 -0
- package/dist/src/types/mitosis-component.js +2 -0
- package/dist/src/types/mitosis-context.d.ts +6 -0
- package/dist/src/types/mitosis-context.js +2 -0
- package/dist/src/types/mitosis-node.d.ts +117 -0
- package/dist/src/types/mitosis-node.js +12 -0
- package/dist/src/types/mitosis-styles.d.ts +1 -0
- package/dist/src/types/mitosis-styles.js +2 -0
- package/dist/src/types/plugins.d.ts +19 -0
- package/dist/src/types/plugins.js +2 -0
- package/dist/src/types/transpiler.d.ts +48 -0
- package/dist/src/types/transpiler.js +2 -0
- package/jsx-runtime.d.ts +2143 -0
- package/package.json +106 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TraverseContext } from 'neotraverse/legacy';
|
|
2
|
+
import { MitosisComponent } from '../types/mitosis-component';
|
|
3
|
+
import { MitosisStyles } from '../types/mitosis-styles';
|
|
4
|
+
type MapStylesOptions = {
|
|
5
|
+
map: (styles: MitosisStyles, context: TraverseContext) => MitosisStyles;
|
|
6
|
+
};
|
|
7
|
+
export declare const mapStyles: (pluginOptions: MapStylesOptions) => (options: any) => {
|
|
8
|
+
json: {
|
|
9
|
+
pre: (json: MitosisComponent) => void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapStyles = void 0;
|
|
4
|
+
const get_styles_1 = require("../helpers/get-styles");
|
|
5
|
+
const traverse_nodes_1 = require("../helpers/traverse-nodes");
|
|
6
|
+
const mapStyles = (pluginOptions) => (options) => ({
|
|
7
|
+
json: {
|
|
8
|
+
pre: (json) => {
|
|
9
|
+
(0, traverse_nodes_1.traverseNodes)(json, (node, context) => {
|
|
10
|
+
const styles = (0, get_styles_1.getStyles)(node);
|
|
11
|
+
(0, get_styles_1.setStyles)(node, pluginOptions.map(styles || {}, context));
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
exports.mapStyles = mapStyles;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MitosisComponent } from '../types/mitosis-component';
|
|
2
|
+
import { BuilderContent, BuilderElement } from '@builder.io/sdk';
|
|
3
|
+
export type SymbolHierarchy = {
|
|
4
|
+
depthFirstSymbols: BuilderElement[];
|
|
5
|
+
} & {
|
|
6
|
+
[id: string]: string[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Ensure every symbol in a BuilderContent tree has a unique ID.
|
|
10
|
+
* Mutates the data tree directly.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ensureAllSymbolsHaveIds(content: BuilderContent): void;
|
|
13
|
+
export declare function convertBuilderContentToSymbolHierarchy(content: BuilderContent, { collectComponentStyles, collectComponentState, }?: {
|
|
14
|
+
collectComponentStyles?: string[];
|
|
15
|
+
collectComponentState?: Record<string, any>;
|
|
16
|
+
}): SymbolHierarchy;
|
|
17
|
+
export declare function convertBuilderElementToMitosisComponent(element: BuilderElement): MitosisComponent | null;
|
|
18
|
+
export declare function getJsxSymbolComponentName(id: string): string;
|
|
19
|
+
export declare function hashCodeAsString(obj: any): string;
|
|
20
|
+
export declare function hashCode(obj: any, hash?: number): number;
|
|
@@ -0,0 +1,202 @@
|
|
|
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
|
+
exports.hashCode = exports.hashCodeAsString = exports.getJsxSymbolComponentName = exports.convertBuilderElementToMitosisComponent = exports.convertBuilderContentToSymbolHierarchy = exports.ensureAllSymbolsHaveIds = void 0;
|
|
7
|
+
const minify_1 = require("../generators/helpers/minify");
|
|
8
|
+
const builder_1 = require("../parsers/builder");
|
|
9
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
10
|
+
/**
|
|
11
|
+
* Ensure every symbol in a BuilderContent tree has a unique ID.
|
|
12
|
+
* Mutates the data tree directly.
|
|
13
|
+
*/
|
|
14
|
+
function ensureAllSymbolsHaveIds(content) {
|
|
15
|
+
let counter = 0;
|
|
16
|
+
const ids = new Set();
|
|
17
|
+
(0, legacy_1.default)(content).forEach(function (el) {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
if (this.key === 'jsCode' && isString(el) && el.endsWith('return _virtual_index')) {
|
|
20
|
+
// Sometimes rollup adds a final `return _virtual_index` but that causes VM evaluation to fail.
|
|
21
|
+
// Instead of a return on the last line, it needs a plain expression on the last line. Luckily
|
|
22
|
+
// because the rollup compile behavior is consistent this works pretty reliably
|
|
23
|
+
el = el.replace(/return _virtual_index$/, '_virtual_index');
|
|
24
|
+
this.parent && (this.parent.node.jsCode = el);
|
|
25
|
+
}
|
|
26
|
+
if ((0, builder_1.isBuilderElement)(el)) {
|
|
27
|
+
if (((_a = el === null || el === void 0 ? void 0 : el.component) === null || _a === void 0 ? void 0 : _a.name) === 'Symbol') {
|
|
28
|
+
const id = getIdFromSymbol(el);
|
|
29
|
+
if (id) {
|
|
30
|
+
if (ids.has(id)) {
|
|
31
|
+
if ((_c = (_b = el.component) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.symbol) {
|
|
32
|
+
const id = pad(counter++);
|
|
33
|
+
el.component.options.symbol.entry = id;
|
|
34
|
+
if (el.component.options.symbol.content) {
|
|
35
|
+
el.component.options.symbol.content.id = id;
|
|
36
|
+
}
|
|
37
|
+
ids.add(id);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
ids.add(id);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.ensureAllSymbolsHaveIds = ensureAllSymbolsHaveIds;
|
|
49
|
+
//TODO(misko): needs test
|
|
50
|
+
function convertBuilderContentToSymbolHierarchy(content, { collectComponentStyles, collectComponentState, } = {}) {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
if (collectComponentState && ((_a = content.data) === null || _a === void 0 ? void 0 : _a.state)) {
|
|
53
|
+
const state = (_b = content.data) === null || _b === void 0 ? void 0 : _b.state;
|
|
54
|
+
collectComponentState['ROOT_COMPONENT_STATE'] = state;
|
|
55
|
+
}
|
|
56
|
+
const path = [-1, content.id];
|
|
57
|
+
const hierarchy = {
|
|
58
|
+
depthFirstSymbols: [],
|
|
59
|
+
[content.id]: [],
|
|
60
|
+
};
|
|
61
|
+
(0, legacy_1.default)(content).forEach(function (el) {
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
let cssCode = el === null || el === void 0 ? void 0 : el.cssCode;
|
|
64
|
+
if (cssCode) {
|
|
65
|
+
collectComponentStyles && collectComponentStyles.push((0, minify_1.minify) `${cssCode}`);
|
|
66
|
+
}
|
|
67
|
+
while (path[0 /* Path.DEPTH */] >= this.path.length) {
|
|
68
|
+
path.shift();
|
|
69
|
+
path.shift();
|
|
70
|
+
}
|
|
71
|
+
if ((0, builder_1.isBuilderElement)(el)) {
|
|
72
|
+
if (((_a = el === null || el === void 0 ? void 0 : el.component) === null || _a === void 0 ? void 0 : _a.name) === 'Symbol') {
|
|
73
|
+
if (collectComponentState) {
|
|
74
|
+
const symbol = el.component.options.symbol;
|
|
75
|
+
const props = symbol.data || (symbol.data = {});
|
|
76
|
+
const state = (_c = (_b = symbol.content) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.state;
|
|
77
|
+
if (state) {
|
|
78
|
+
const id = hashCodeAsString(state);
|
|
79
|
+
props['serverStateId'] = id;
|
|
80
|
+
collectComponentState[id] = state;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (path[0 /* Path.DEPTH */] < this.path.length) {
|
|
84
|
+
const id = getIdFromSymbol(el);
|
|
85
|
+
hierarchy[id] = [];
|
|
86
|
+
addIfMissing(hierarchy[path[1 /* Path.ID */]], id);
|
|
87
|
+
path.unshift(this.path.length, id);
|
|
88
|
+
}
|
|
89
|
+
// TODO(misko): This should be `el.content` not `el`
|
|
90
|
+
// Because we don't wante to take the `<Symbol>` with us.
|
|
91
|
+
// TODO(misko): Do we really want to add ALL symbols? Even duplicates?
|
|
92
|
+
hierarchy.depthFirstSymbols.unshift(el);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return hierarchy;
|
|
97
|
+
}
|
|
98
|
+
exports.convertBuilderContentToSymbolHierarchy = convertBuilderContentToSymbolHierarchy;
|
|
99
|
+
function convertBuilderElementToMitosisComponent(element) {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
const symbolValue = (_b = (_a = element.component) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.symbol;
|
|
102
|
+
const elContent = symbolValue === null || symbolValue === void 0 ? void 0 : symbolValue.content;
|
|
103
|
+
if (!elContent) {
|
|
104
|
+
console.warn('Symbol missing content', element.id);
|
|
105
|
+
delete element.component; // TODO(misko): Should this be assign `undefined` for perf?
|
|
106
|
+
element.children = [];
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const id = getIdFromSymbol(element);
|
|
110
|
+
const componentName = getJsxSymbolComponentName(id);
|
|
111
|
+
delete element.component; // TODO(misko): Should this be assign `undefined` for perf?
|
|
112
|
+
element.children = [
|
|
113
|
+
(0, builder_1.createBuilderElement)({
|
|
114
|
+
component: {
|
|
115
|
+
name: componentName,
|
|
116
|
+
options: symbolValue.data,
|
|
117
|
+
},
|
|
118
|
+
properties: {
|
|
119
|
+
'builder-content-id': id,
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
];
|
|
123
|
+
const mitosisComponent = {
|
|
124
|
+
...(0, builder_1.builderContentToMitosisComponent)(elContent, {
|
|
125
|
+
includeBuilderExtras: true,
|
|
126
|
+
preserveTextBlocks: true,
|
|
127
|
+
}),
|
|
128
|
+
name: componentName,
|
|
129
|
+
};
|
|
130
|
+
mitosisComponent.meta.builderElId = element.id;
|
|
131
|
+
return mitosisComponent;
|
|
132
|
+
}
|
|
133
|
+
exports.convertBuilderElementToMitosisComponent = convertBuilderElementToMitosisComponent;
|
|
134
|
+
function getJsxSymbolComponentName(id) {
|
|
135
|
+
return 'Component' + id.toUpperCase().replace(/-/g, '');
|
|
136
|
+
}
|
|
137
|
+
exports.getJsxSymbolComponentName = getJsxSymbolComponentName;
|
|
138
|
+
function getIdFromSymbol(el) {
|
|
139
|
+
var _a, _b, _c;
|
|
140
|
+
// TODO(misko): Don't use entry us el.id???
|
|
141
|
+
return (_c = (_b = (_a = el.component) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.symbol) === null || _c === void 0 ? void 0 : _c.entry;
|
|
142
|
+
}
|
|
143
|
+
function addIfMissing(array, value) {
|
|
144
|
+
if (array.indexOf(value) == -1) {
|
|
145
|
+
array.push(value);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function isString(value) {
|
|
149
|
+
return typeof value == 'string';
|
|
150
|
+
}
|
|
151
|
+
function hashCodeAsString(obj) {
|
|
152
|
+
return Number(Math.abs(hashCode(obj))).toString(36);
|
|
153
|
+
}
|
|
154
|
+
exports.hashCodeAsString = hashCodeAsString;
|
|
155
|
+
function hashCode(obj, hash = 0) {
|
|
156
|
+
let value = 0;
|
|
157
|
+
switch (typeof obj) {
|
|
158
|
+
case 'number':
|
|
159
|
+
value = obj;
|
|
160
|
+
break;
|
|
161
|
+
case 'undefined':
|
|
162
|
+
value = Number.MIN_SAFE_INTEGER;
|
|
163
|
+
break;
|
|
164
|
+
case 'string':
|
|
165
|
+
for (let i = 0; i < obj.length; i++) {
|
|
166
|
+
hash = hashCodeApply(hash, obj.charCodeAt(i));
|
|
167
|
+
}
|
|
168
|
+
value = obj.length;
|
|
169
|
+
case 'boolean':
|
|
170
|
+
value = obj ? 1 : 0;
|
|
171
|
+
break;
|
|
172
|
+
case 'object':
|
|
173
|
+
if (obj === null) {
|
|
174
|
+
value = Number.MAX_SAFE_INTEGER;
|
|
175
|
+
}
|
|
176
|
+
else if (Array.isArray(obj)) {
|
|
177
|
+
for (let i = 0; i < obj.length; i++) {
|
|
178
|
+
hash = hashCode(obj[i], hash);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
for (const key of Object.keys(obj).sort()) {
|
|
183
|
+
if (obj.hasOwnProperty(key)) {
|
|
184
|
+
hash = hashCode(obj[key], hash);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
return hashCodeApply(hash, value);
|
|
191
|
+
}
|
|
192
|
+
exports.hashCode = hashCode;
|
|
193
|
+
function hashCodeApply(hash, value) {
|
|
194
|
+
hash = (hash << 5) - hash + value;
|
|
195
|
+
hash |= 0; // Convert to 32bit integer
|
|
196
|
+
return hash;
|
|
197
|
+
}
|
|
198
|
+
function pad(value) {
|
|
199
|
+
const padding = '000000';
|
|
200
|
+
let result = padding + String(value);
|
|
201
|
+
return result.substring(result.length - padding.length);
|
|
202
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const builder: (options?: import("./generators/builder").ToBuilderOptions) => ({ component }: import(".").TranspilerArgs) => import("@builder.io/sdk").BuilderContent;
|
|
2
|
+
export declare const targets: {
|
|
3
|
+
readonly alpine: import(".").TranspilerGenerator<import("./generators/alpine").ToAlpineOptions>;
|
|
4
|
+
readonly angular: import(".").TranspilerGenerator<import("./generators/angular").ToAngularOptions>;
|
|
5
|
+
readonly customElement: import(".").TranspilerGenerator<import("./generators/html").ToHtmlOptions>;
|
|
6
|
+
readonly html: import(".").TranspilerGenerator<import("./generators/html").ToHtmlOptions>;
|
|
7
|
+
readonly mitosis: import(".").TranspilerGenerator<Partial<import("./generators/mitosis").ToMitosisOptions>>;
|
|
8
|
+
readonly liquid: import(".").TranspilerGenerator<import("./generators/liquid").ToLiquidOptions>;
|
|
9
|
+
readonly react: import(".").TranspilerGenerator<Partial<import("./generators/react").ToReactOptions>>;
|
|
10
|
+
readonly reactNative: import(".").TranspilerGenerator<Partial<import("./generators/react-native").ToReactNativeOptions>>;
|
|
11
|
+
readonly solid: import(".").TranspilerGenerator<Partial<import("./generators/solid").ToSolidOptions>>;
|
|
12
|
+
readonly svelte: import(".").TranspilerGenerator<import("./generators/svelte").ToSvelteOptions>;
|
|
13
|
+
readonly swift: import(".").TranspilerGenerator<import("./generators/swift").ToSwiftOptions>;
|
|
14
|
+
readonly template: import(".").TranspilerGenerator<import("./generators/template").ToTemplateOptions>;
|
|
15
|
+
readonly webcomponent: import(".").TranspilerGenerator<import("./generators/html").ToHtmlOptions>;
|
|
16
|
+
readonly vue: import(".").TranspilerGenerator<Partial<import("./generators/vue").ToVueOptions>>;
|
|
17
|
+
readonly stencil: import(".").TranspilerGenerator<import("./generators/stencil").ToStencilOptions>;
|
|
18
|
+
readonly qwik: import(".").TranspilerGenerator<import("./generators/qwik").ToQwikOptions>;
|
|
19
|
+
readonly marko: import(".").TranspilerGenerator<import("./generators/marko").ToMarkoOptions>;
|
|
20
|
+
readonly preact: import(".").TranspilerGenerator<Partial<import("./generators/react").ToReactOptions>>;
|
|
21
|
+
readonly lit: import(".").TranspilerGenerator<import("./generators/lit").ToLitOptions>;
|
|
22
|
+
readonly rsc: import(".").TranspilerGenerator<Partial<import("./generators/react").ToReactOptions>>;
|
|
23
|
+
readonly taro: import(".").TranspilerGenerator<Partial<import("./generators/react").ToReactOptions>>;
|
|
24
|
+
};
|
|
25
|
+
export type Targets = keyof typeof targets;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.targets = exports.builder = void 0;
|
|
4
|
+
const alpine_1 = require("./generators/alpine");
|
|
5
|
+
const angular_1 = require("./generators/angular");
|
|
6
|
+
const builder_1 = require("./generators/builder");
|
|
7
|
+
const html_1 = require("./generators/html");
|
|
8
|
+
const liquid_1 = require("./generators/liquid");
|
|
9
|
+
const lit_1 = require("./generators/lit");
|
|
10
|
+
const marko_1 = require("./generators/marko");
|
|
11
|
+
const mitosis_1 = require("./generators/mitosis");
|
|
12
|
+
const qwik_1 = require("./generators/qwik");
|
|
13
|
+
const react_1 = require("./generators/react");
|
|
14
|
+
const react_native_1 = require("./generators/react-native");
|
|
15
|
+
const rsc_1 = require("./generators/rsc");
|
|
16
|
+
const solid_1 = require("./generators/solid");
|
|
17
|
+
const stencil_1 = require("./generators/stencil");
|
|
18
|
+
const svelte_1 = require("./generators/svelte");
|
|
19
|
+
const swift_1 = require("./generators/swift");
|
|
20
|
+
const taro_1 = require("./generators/taro");
|
|
21
|
+
const template_1 = require("./generators/template");
|
|
22
|
+
const vue_1 = require("./generators/vue");
|
|
23
|
+
exports.builder = builder_1.componentToBuilder;
|
|
24
|
+
exports.targets = {
|
|
25
|
+
alpine: alpine_1.componentToAlpine,
|
|
26
|
+
angular: angular_1.componentToAngular,
|
|
27
|
+
customElement: html_1.componentToCustomElement,
|
|
28
|
+
html: html_1.componentToHtml,
|
|
29
|
+
mitosis: mitosis_1.componentToMitosis,
|
|
30
|
+
liquid: liquid_1.componentToLiquid,
|
|
31
|
+
react: react_1.componentToReact,
|
|
32
|
+
reactNative: react_native_1.componentToReactNative,
|
|
33
|
+
solid: solid_1.componentToSolid,
|
|
34
|
+
svelte: svelte_1.componentToSvelte,
|
|
35
|
+
swift: swift_1.componentToSwift,
|
|
36
|
+
template: template_1.componentToTemplate,
|
|
37
|
+
webcomponent: html_1.componentToCustomElement,
|
|
38
|
+
vue: vue_1.componentToVue,
|
|
39
|
+
stencil: stencil_1.componentToStencil,
|
|
40
|
+
qwik: qwik_1.componentToQwik,
|
|
41
|
+
marko: marko_1.componentToMarko,
|
|
42
|
+
preact: react_1.componentToPreact,
|
|
43
|
+
lit: lit_1.componentToLit,
|
|
44
|
+
rsc: rsc_1.componentToRsc,
|
|
45
|
+
taro: taro_1.componentToTaro,
|
|
46
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { ParseMitosisOptions } from '../parsers/jsx';
|
|
2
|
+
import { targets } from '../targets';
|
|
3
|
+
import type { MitosisComponent } from './mitosis-component';
|
|
4
|
+
import { BaseTranspilerOptions, TranspilerGenerator } from './transpiler';
|
|
5
|
+
export type Format = 'esm' | 'cjs';
|
|
6
|
+
export type Language = 'js' | 'ts';
|
|
7
|
+
interface TranspilerOptions {
|
|
8
|
+
format?: Format;
|
|
9
|
+
}
|
|
10
|
+
type Targets = typeof targets;
|
|
11
|
+
export type Target = keyof Targets;
|
|
12
|
+
export type GeneratorOptions = {
|
|
13
|
+
[K in Target]: NonNullable<Parameters<Targets[K]>[0]> & {
|
|
14
|
+
transpiler?: TranspilerOptions;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type generatorsOption = {
|
|
18
|
+
[K in Target]: NonNullable<Targets[K]>;
|
|
19
|
+
};
|
|
20
|
+
export interface TargetContext {
|
|
21
|
+
target: Target;
|
|
22
|
+
generator: TranspilerGenerator<NonNullable<MitosisConfig['options'][Target]>>;
|
|
23
|
+
outputPath: string;
|
|
24
|
+
}
|
|
25
|
+
export interface OutputFiles {
|
|
26
|
+
outputDir: string;
|
|
27
|
+
outputFilePath: string;
|
|
28
|
+
}
|
|
29
|
+
export type MitosisConfig = {
|
|
30
|
+
generators?: generatorsOption;
|
|
31
|
+
/**
|
|
32
|
+
* Apply common options to all targets
|
|
33
|
+
*/
|
|
34
|
+
commonOptions?: Omit<BaseTranspilerOptions, 'experimental'>;
|
|
35
|
+
/**
|
|
36
|
+
* List of targets to compile to.
|
|
37
|
+
*/
|
|
38
|
+
targets: Target[];
|
|
39
|
+
/**
|
|
40
|
+
* The output directory. Defaults to `output`.
|
|
41
|
+
*/
|
|
42
|
+
dest?: string;
|
|
43
|
+
/**
|
|
44
|
+
* globs of files to transpile. Defaults to `src/*`.
|
|
45
|
+
*/
|
|
46
|
+
files?: string | string[];
|
|
47
|
+
/**
|
|
48
|
+
* Optional list of globs to exclude from transpilation.
|
|
49
|
+
*/
|
|
50
|
+
exclude?: string[];
|
|
51
|
+
/**
|
|
52
|
+
* The directory where overrides are stored. The structure of the override directory must match that of the source code,
|
|
53
|
+
* with each target having its own sub-directory: `${overridesDir}/${target}/*`
|
|
54
|
+
* Defaults to `overrides`.
|
|
55
|
+
*/
|
|
56
|
+
overridesDir?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Dictionary of per-target configuration. For each target, the available options can be inspected by going to
|
|
59
|
+
* `packages/core/src/generators/xxx/types.ts`.
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
*
|
|
63
|
+
* ```js
|
|
64
|
+
* options: {
|
|
65
|
+
* vue: {
|
|
66
|
+
* prettier: false,
|
|
67
|
+
* namePrefix: (path) => path + '-my-vue-code',
|
|
68
|
+
* },
|
|
69
|
+
* react: {
|
|
70
|
+
* stateType: 'builder';
|
|
71
|
+
* stylesType: 'styled-jsx'
|
|
72
|
+
* plugins: [myPlugin]
|
|
73
|
+
* }
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
options: Partial<GeneratorOptions>;
|
|
78
|
+
/**
|
|
79
|
+
* Configure a custom parser function which takes a string and returns MitosisJSON
|
|
80
|
+
* Defaults to the JSXParser of this project (src/parsers/jsx)
|
|
81
|
+
*/
|
|
82
|
+
parser?: (code: string, path?: string) => MitosisComponent | Promise<MitosisComponent>;
|
|
83
|
+
/**
|
|
84
|
+
* Configure a custom function that provides the output path for each target.
|
|
85
|
+
* If you don't provide a path for a target by returning `undefined`,
|
|
86
|
+
* the default path will be used, which is the target name in kebabCase.
|
|
87
|
+
*/
|
|
88
|
+
getTargetPath?: ({ target }: {
|
|
89
|
+
target: Target;
|
|
90
|
+
}) => string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Provide options to the parser.
|
|
93
|
+
*/
|
|
94
|
+
parserOptions?: {
|
|
95
|
+
jsx: Partial<ParseMitosisOptions> & {
|
|
96
|
+
/**
|
|
97
|
+
* Path to your project's `tsconfig.json` file. Needed for advanced types parsing (e.g. signals).
|
|
98
|
+
*/
|
|
99
|
+
tsConfigFilePath?: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type JSONPrimitive = string | null | number | boolean | undefined;
|
|
2
|
+
export type JSONObject = {
|
|
3
|
+
[key: string]: _JSON | undefined;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* We use an underscore to avoid collisions with the global `JSON` primitive type.
|
|
7
|
+
*/
|
|
8
|
+
export type _JSON = JSONPrimitive | JSONObject | _JSON[];
|
|
9
|
+
export type JSONPrimitiveOrNode = JSONPrimitive | babel.Node;
|
|
10
|
+
export type JSONOrNodeObject = {
|
|
11
|
+
[key: string]: JSONOrNode;
|
|
12
|
+
};
|
|
13
|
+
export type JSONOrNode = JSONPrimitiveOrNode | JSONOrNodeObject | JSONOrNode[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AlpineMetadata } from '../generators/alpine/types';
|
|
2
|
+
import { AngularMetadata } from '../generators/angular/types';
|
|
3
|
+
import { BuilderMetadata } from '../generators/builder/types';
|
|
4
|
+
import { HtmlMetadata } from '../generators/html/types';
|
|
5
|
+
import { LiquidMetadata } from '../generators/liquid/types';
|
|
6
|
+
import { LitMetadata } from '../generators/lit/types';
|
|
7
|
+
import { MarkoMetadata } from '../generators/marko/types';
|
|
8
|
+
import { MitosisMetadata } from '../generators/mitosis/types';
|
|
9
|
+
import { QwikMetadata } from '../generators/qwik/types';
|
|
10
|
+
import { ReactNativeMetadata } from '../generators/react-native/types';
|
|
11
|
+
import { ReactServerComponentsMetadata } from '../generators/rsc/types';
|
|
12
|
+
import { SolidMetadata } from '../generators/solid/types';
|
|
13
|
+
import { StencilMetadata } from '../generators/stencil/types';
|
|
14
|
+
import { SvelteMetadata } from '../generators/svelte/types';
|
|
15
|
+
import { SwiftMetadata } from '../generators/swift/types';
|
|
16
|
+
import { TaroMetadata } from '../generators/taro/types';
|
|
17
|
+
import { TemplateMetadata } from '../generators/template/types';
|
|
18
|
+
import { AttributePassingType, ReactMetadata, Target, VueMetadata } from '..';
|
|
19
|
+
type Targets = typeof import('../targets').targets;
|
|
20
|
+
type TargetOptions = {
|
|
21
|
+
[K in Target]?: Partial<NonNullable<Parameters<Targets[K]>[0]>>;
|
|
22
|
+
};
|
|
23
|
+
export type ComponentMetadata = {
|
|
24
|
+
[index: string]: any;
|
|
25
|
+
httpRequests?: Record<string, string>;
|
|
26
|
+
options?: TargetOptions;
|
|
27
|
+
/** @deprecated Use this for web-components to change the tagName */
|
|
28
|
+
tagName?: string;
|
|
29
|
+
/** @deprecated Use this for react forwardRef */
|
|
30
|
+
forwardRef?: string;
|
|
31
|
+
/** Enables shadowDom for web-components */
|
|
32
|
+
isAttachedToShadowDom?: boolean;
|
|
33
|
+
/** Enables/disables attribute passing for frameworks with custom elements like angular and stencil */
|
|
34
|
+
attributePassing?: AttributePassingType;
|
|
35
|
+
alpine?: AlpineMetadata;
|
|
36
|
+
angular?: AngularMetadata;
|
|
37
|
+
builder?: BuilderMetadata;
|
|
38
|
+
html?: HtmlMetadata;
|
|
39
|
+
lit?: LitMetadata;
|
|
40
|
+
liquid?: LiquidMetadata;
|
|
41
|
+
marko?: MarkoMetadata;
|
|
42
|
+
mitosis?: MitosisMetadata;
|
|
43
|
+
qwik?: QwikMetadata;
|
|
44
|
+
react?: ReactMetadata;
|
|
45
|
+
reactNative?: ReactNativeMetadata;
|
|
46
|
+
rsc?: ReactServerComponentsMetadata;
|
|
47
|
+
solid?: SolidMetadata;
|
|
48
|
+
stencil?: StencilMetadata;
|
|
49
|
+
svelte?: SvelteMetadata;
|
|
50
|
+
swift?: SwiftMetadata;
|
|
51
|
+
taro?: TaroMetadata;
|
|
52
|
+
template?: TemplateMetadata;
|
|
53
|
+
vue?: VueMetadata;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Dictionary } from '../helpers/typescript';
|
|
2
|
+
import { Target } from './config';
|
|
3
|
+
import { JSONObject } from './json';
|
|
4
|
+
import { ComponentMetadata } from './metadata';
|
|
5
|
+
import { MitosisNode } from './mitosis-node';
|
|
6
|
+
/**
|
|
7
|
+
* @example
|
|
8
|
+
* // import core, { useState, someThing as someAlias } from '..'
|
|
9
|
+
* {
|
|
10
|
+
* path: '@builder.io/mitosis',
|
|
11
|
+
* imports: {
|
|
12
|
+
* useState: 'useState',
|
|
13
|
+
* someAlias: 'someThing',
|
|
14
|
+
* core: 'default',
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // import * as core from '..'
|
|
20
|
+
* {
|
|
21
|
+
* path: '@builder.io/mitosis',
|
|
22
|
+
* imports: {
|
|
23
|
+
* core: '*',
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
export interface MitosisImport {
|
|
28
|
+
path: string;
|
|
29
|
+
imports: {
|
|
30
|
+
[key: string]: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
importKind?: 'type' | 'typeof' | 'value' | null;
|
|
33
|
+
}
|
|
34
|
+
export type ReactivityType = 'normal' | 'reactive';
|
|
35
|
+
export type ContextOptions = {
|
|
36
|
+
type?: ReactivityType;
|
|
37
|
+
};
|
|
38
|
+
export interface ContextGetInfo extends ContextOptions {
|
|
39
|
+
name: string;
|
|
40
|
+
path: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ContextSetInfo extends ContextOptions {
|
|
43
|
+
name: string;
|
|
44
|
+
value?: MitosisState;
|
|
45
|
+
ref?: string;
|
|
46
|
+
}
|
|
47
|
+
export type BaseHook = {
|
|
48
|
+
code: string;
|
|
49
|
+
deps?: string;
|
|
50
|
+
depsArray?: string[];
|
|
51
|
+
};
|
|
52
|
+
export type MitosisComponentInput = {
|
|
53
|
+
name: string;
|
|
54
|
+
defaultValue: any;
|
|
55
|
+
};
|
|
56
|
+
export type MitosisExports = {
|
|
57
|
+
[name: string]: MitosisExport;
|
|
58
|
+
};
|
|
59
|
+
export interface MitosisExport {
|
|
60
|
+
code: string;
|
|
61
|
+
usedInLocal?: boolean;
|
|
62
|
+
isFunction?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export type StateValueType = 'function' | 'getter' | 'method' | 'property';
|
|
65
|
+
export type StateValue = {
|
|
66
|
+
code: string;
|
|
67
|
+
typeParameter?: string;
|
|
68
|
+
type: StateValueType;
|
|
69
|
+
propertyType?: ReactivityType;
|
|
70
|
+
};
|
|
71
|
+
export type MitosisState = Dictionary<StateValue | undefined>;
|
|
72
|
+
export type TargetBlock<Return, Targets extends Target = Target> = Partial<{
|
|
73
|
+
[T in Targets | 'default']?: Return;
|
|
74
|
+
}>;
|
|
75
|
+
export type TargetBlockCode = TargetBlock<{
|
|
76
|
+
code: string;
|
|
77
|
+
}>;
|
|
78
|
+
export type TargetBlockDefinition = TargetBlockCode & {
|
|
79
|
+
settings: {
|
|
80
|
+
requiresDefault: boolean;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export type OnEventHook = BaseHook & {
|
|
84
|
+
refName: string;
|
|
85
|
+
eventName: string;
|
|
86
|
+
isRoot: boolean;
|
|
87
|
+
deps?: never;
|
|
88
|
+
eventArgName: string;
|
|
89
|
+
elementArgName?: string;
|
|
90
|
+
};
|
|
91
|
+
export type OnMountHook = BaseHook & {
|
|
92
|
+
onSSR?: boolean;
|
|
93
|
+
};
|
|
94
|
+
export type MitosisComponent = {
|
|
95
|
+
'@type': '@builder.io/mitosis/component';
|
|
96
|
+
name: string;
|
|
97
|
+
imports: MitosisImport[];
|
|
98
|
+
exports?: MitosisExports;
|
|
99
|
+
meta: JSONObject & {
|
|
100
|
+
useMetadata?: ComponentMetadata;
|
|
101
|
+
};
|
|
102
|
+
inputs: MitosisComponentInput[];
|
|
103
|
+
state: MitosisState;
|
|
104
|
+
context: {
|
|
105
|
+
get: Dictionary<ContextGetInfo>;
|
|
106
|
+
set: Dictionary<ContextSetInfo>;
|
|
107
|
+
};
|
|
108
|
+
signals?: {
|
|
109
|
+
signalTypeImportName?: string;
|
|
110
|
+
};
|
|
111
|
+
props?: {
|
|
112
|
+
[name: string]: {
|
|
113
|
+
propertyType: ReactivityType;
|
|
114
|
+
optional: boolean;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
refs: {
|
|
118
|
+
[useRef: string]: {
|
|
119
|
+
typeParameter?: string;
|
|
120
|
+
argument: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
hooks: {
|
|
124
|
+
init?: BaseHook;
|
|
125
|
+
onInit?: BaseHook;
|
|
126
|
+
onMount: OnMountHook[];
|
|
127
|
+
onUnMount?: BaseHook;
|
|
128
|
+
preComponent?: BaseHook;
|
|
129
|
+
postComponent?: BaseHook;
|
|
130
|
+
onUpdate?: BaseHook[];
|
|
131
|
+
onEvent: OnEventHook[];
|
|
132
|
+
};
|
|
133
|
+
targetBlocks?: Dictionary<TargetBlockDefinition>;
|
|
134
|
+
children: MitosisNode[];
|
|
135
|
+
subComponents: MitosisComponent[];
|
|
136
|
+
types?: string[];
|
|
137
|
+
propsTypeRef?: string;
|
|
138
|
+
defaultProps?: MitosisState;
|
|
139
|
+
style?: string;
|
|
140
|
+
/**
|
|
141
|
+
* This data is filled inside cli to provide more data for plugins
|
|
142
|
+
*/
|
|
143
|
+
pluginData?: {
|
|
144
|
+
target?: Target;
|
|
145
|
+
path?: string;
|
|
146
|
+
outputDir?: string;
|
|
147
|
+
outputFilePath?: string;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Used to store context of a component for a specific framework
|
|
151
|
+
* that we need access only during compilation (for internal use only) and gets removed after compilation.
|
|
152
|
+
*/
|
|
153
|
+
compileContext?: {
|
|
154
|
+
[K in Target]?: {
|
|
155
|
+
state?: MitosisState;
|
|
156
|
+
hooks?: {
|
|
157
|
+
[hookName: string]: BaseHook;
|
|
158
|
+
};
|
|
159
|
+
extra?: Record<string, any>;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
};
|