@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,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFileExtensionForTarget = exports.getComponentFileExtensionForTarget = exports.renameImport = exports.renameComponentImport = exports.renameComponentFile = exports.INPUT_EXTENSION_REGEX = exports.checkIsMitosisComponentFilePath = exports.checkIsLiteComponentFilePath = exports.checkIsSvelteComponentFilePath = exports.COMPONENT_IMPORT_EXTENSIONS = void 0;
|
|
4
|
+
const output_1 = require("./output");
|
|
5
|
+
const COMPONENT_EXTENSIONS = {
|
|
6
|
+
jsx: ['.lite.tsx', '.lite.jsx'],
|
|
7
|
+
svelte: ['.svelte'],
|
|
8
|
+
};
|
|
9
|
+
exports.COMPONENT_IMPORT_EXTENSIONS = [COMPONENT_EXTENSIONS.svelte, COMPONENT_EXTENSIONS.jsx]
|
|
10
|
+
.flat()
|
|
11
|
+
.concat(['.lite']);
|
|
12
|
+
const checkIsSvelteComponentFilePath = (filePath) => COMPONENT_EXTENSIONS.svelte.some((x) => filePath.endsWith(x));
|
|
13
|
+
exports.checkIsSvelteComponentFilePath = checkIsSvelteComponentFilePath;
|
|
14
|
+
const checkIsLiteComponentFilePath = (filePath) => COMPONENT_EXTENSIONS.jsx.some((x) => filePath.endsWith(x));
|
|
15
|
+
exports.checkIsLiteComponentFilePath = checkIsLiteComponentFilePath;
|
|
16
|
+
const checkIsMitosisComponentFilePath = (filePath) => (0, exports.checkIsLiteComponentFilePath)(filePath) || (0, exports.checkIsSvelteComponentFilePath)(filePath);
|
|
17
|
+
exports.checkIsMitosisComponentFilePath = checkIsMitosisComponentFilePath;
|
|
18
|
+
/**
|
|
19
|
+
* Matches `.svelte`, `.lite.tsx`, `.lite.jsx` files (with optional `.jsx`/`.tsx` extension)
|
|
20
|
+
*/
|
|
21
|
+
exports.INPUT_EXTENSION_REGEX = /\.(svelte|(lite(\.tsx|\.jsx)?))/g;
|
|
22
|
+
const getExplicitFileExtension = (path, explicitBuildFileExtensions) => {
|
|
23
|
+
if (explicitBuildFileExtensions) {
|
|
24
|
+
for (const [extension, regex] of Object.entries(explicitBuildFileExtensions)) {
|
|
25
|
+
const match = path.match(regex);
|
|
26
|
+
if (match) {
|
|
27
|
+
return extension;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
};
|
|
33
|
+
const renameComponentFile = ({ path, target, options, }) => {
|
|
34
|
+
var _a;
|
|
35
|
+
const explicitExtension = getExplicitFileExtension(path, (_a = options.options[target]) === null || _a === void 0 ? void 0 : _a.explicitBuildFileExtensions);
|
|
36
|
+
const extension = explicitExtension !== null && explicitExtension !== void 0 ? explicitExtension : (0, exports.getComponentFileExtensionForTarget)({
|
|
37
|
+
type: 'filename',
|
|
38
|
+
target,
|
|
39
|
+
isTypescript: (0, output_1.checkShouldOutputTypeScript)({ options, target }),
|
|
40
|
+
});
|
|
41
|
+
return path.replace(exports.INPUT_EXTENSION_REGEX, extension);
|
|
42
|
+
};
|
|
43
|
+
exports.renameComponentFile = renameComponentFile;
|
|
44
|
+
/**
|
|
45
|
+
* just like `INPUT_EXTENSION_REGEX`, but adds trailing quotes to the end of import paths.
|
|
46
|
+
*/
|
|
47
|
+
const INPUT_EXTENSION_IMPORT_REGEX = /\.(svelte|(lite(\.tsx|\.jsx)?))(?<quote>['"])/g;
|
|
48
|
+
const renameComponentImport = ({ importPath, target, explicitImportFileExtension, }) => {
|
|
49
|
+
return importPath.replace(INPUT_EXTENSION_IMPORT_REGEX, `${(0, exports.getComponentFileExtensionForTarget)({
|
|
50
|
+
type: 'import',
|
|
51
|
+
target,
|
|
52
|
+
explicitImportFileExtension,
|
|
53
|
+
})}$4`);
|
|
54
|
+
};
|
|
55
|
+
exports.renameComponentImport = renameComponentImport;
|
|
56
|
+
const renameImport = ({ importPath, target, explicitImportFileExtension, }) => {
|
|
57
|
+
return importPath.replace(/\.js(['"])/g, `${(0, exports.getFileExtensionForTarget)({
|
|
58
|
+
target,
|
|
59
|
+
explicitImportFileExtension,
|
|
60
|
+
})}$1`);
|
|
61
|
+
};
|
|
62
|
+
exports.renameImport = renameImport;
|
|
63
|
+
/**
|
|
64
|
+
* Provides the correct file extension for a given component. This is used:
|
|
65
|
+
* - in `core` to render import statements within other components.
|
|
66
|
+
* - in `cli` to render filenames for generated components, and import statements within plain `.js`/`.ts` files.
|
|
67
|
+
*/
|
|
68
|
+
const getComponentFileExtensionForTarget = (args) => {
|
|
69
|
+
switch (args.target) {
|
|
70
|
+
case 'angular': {
|
|
71
|
+
switch (args.type) {
|
|
72
|
+
case 'import':
|
|
73
|
+
return '.js';
|
|
74
|
+
case 'filename':
|
|
75
|
+
return args.isTypescript ? '.ts' : '.js';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
case 'alpine':
|
|
79
|
+
case 'html':
|
|
80
|
+
return '.html';
|
|
81
|
+
case 'svelte':
|
|
82
|
+
return '.svelte';
|
|
83
|
+
case 'swift':
|
|
84
|
+
return '.swift';
|
|
85
|
+
case 'vue':
|
|
86
|
+
return '.vue';
|
|
87
|
+
case 'webcomponent':
|
|
88
|
+
return '.ts';
|
|
89
|
+
case 'lit':
|
|
90
|
+
return '.ts';
|
|
91
|
+
case 'qwik': {
|
|
92
|
+
switch (args.type) {
|
|
93
|
+
case 'import':
|
|
94
|
+
return '.jsx';
|
|
95
|
+
case 'filename':
|
|
96
|
+
return args.isTypescript ? '.tsx' : '.jsx';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
case 'solid':
|
|
100
|
+
case 'preact':
|
|
101
|
+
case 'react':
|
|
102
|
+
case 'reactNative':
|
|
103
|
+
case 'rsc':
|
|
104
|
+
case 'stencil':
|
|
105
|
+
switch (args.type) {
|
|
106
|
+
case 'import':
|
|
107
|
+
// we can't have `.jsx`/`.tsx` extensions in the import paths, so we stick with implicit file extensions.
|
|
108
|
+
return args.explicitImportFileExtension ? '.js' : '';
|
|
109
|
+
case 'filename':
|
|
110
|
+
return args.isTypescript ? '.tsx' : '.jsx';
|
|
111
|
+
}
|
|
112
|
+
case 'marko':
|
|
113
|
+
return '.marko';
|
|
114
|
+
default:
|
|
115
|
+
return '.js';
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports.getComponentFileExtensionForTarget = getComponentFileExtensionForTarget;
|
|
119
|
+
const getFileExtensionForTarget = ({ target, explicitImportFileExtension, }) => {
|
|
120
|
+
switch (target) {
|
|
121
|
+
case 'angular':
|
|
122
|
+
case 'alpine':
|
|
123
|
+
case 'html':
|
|
124
|
+
case 'svelte':
|
|
125
|
+
case 'swift':
|
|
126
|
+
case 'vue':
|
|
127
|
+
case 'webcomponent':
|
|
128
|
+
case 'lit':
|
|
129
|
+
case 'qwik':
|
|
130
|
+
case 'react':
|
|
131
|
+
case 'reactNative':
|
|
132
|
+
case 'rsc':
|
|
133
|
+
case 'solid':
|
|
134
|
+
case 'stencil':
|
|
135
|
+
case 'marko':
|
|
136
|
+
case 'preact':
|
|
137
|
+
default:
|
|
138
|
+
return explicitImportFileExtension ? '.js' : '';
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
exports.getFileExtensionForTarget = getFileExtensionForTarget;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MitosisComponent } from '../types/mitosis-component';
|
|
2
|
+
import { Overwrite, Prettify } from './typescript';
|
|
3
|
+
type PartialMitosisComponent = Prettify<Overwrite<Partial<MitosisComponent>, {
|
|
4
|
+
hooks: Partial<MitosisComponent['hooks']>;
|
|
5
|
+
}>>;
|
|
6
|
+
export declare const createMitosisComponent: (options?: PartialMitosisComponent) => MitosisComponent;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMitosisComponent = void 0;
|
|
4
|
+
const createMitosisComponent = (options) => {
|
|
5
|
+
const { name, hooks, ...remainingOpts } = options || {};
|
|
6
|
+
const { onEvent = [], onMount = [], ...remainingHooks } = hooks || {};
|
|
7
|
+
return {
|
|
8
|
+
'@type': '@builder.io/mitosis/component',
|
|
9
|
+
imports: [],
|
|
10
|
+
exports: {},
|
|
11
|
+
inputs: [],
|
|
12
|
+
meta: {},
|
|
13
|
+
refs: {},
|
|
14
|
+
state: {},
|
|
15
|
+
children: [],
|
|
16
|
+
context: { get: {}, set: {} },
|
|
17
|
+
subComponents: [],
|
|
18
|
+
name: name || 'MyComponent',
|
|
19
|
+
hooks: {
|
|
20
|
+
onMount,
|
|
21
|
+
onEvent,
|
|
22
|
+
...remainingHooks,
|
|
23
|
+
},
|
|
24
|
+
...remainingOpts,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
exports.createMitosisComponent = createMitosisComponent;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMitosisContext = void 0;
|
|
4
|
+
function createMitosisContext(options) {
|
|
5
|
+
return {
|
|
6
|
+
'@type': '@builder.io/mitosis/context',
|
|
7
|
+
value: {},
|
|
8
|
+
...options,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.createMitosisContext = createMitosisContext;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMitosisNode = void 0;
|
|
4
|
+
const createMitosisNode = (options) => ({
|
|
5
|
+
'@type': '@builder.io/mitosis/node',
|
|
6
|
+
name: 'div',
|
|
7
|
+
meta: {},
|
|
8
|
+
scope: {},
|
|
9
|
+
properties: {},
|
|
10
|
+
bindings: {},
|
|
11
|
+
children: [],
|
|
12
|
+
...options,
|
|
13
|
+
});
|
|
14
|
+
exports.createMitosisNode = createMitosisNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dashCase: (string: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function dedent(strings: TemplateStringsArray, ...values: any[]): string;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Based on "dedent" package
|
|
3
|
+
// Latest commit 2381e76 on Feb 15, 2017
|
|
4
|
+
// Source: https://raw.githubusercontent.com/dmnd/dedent/master/dedent.js
|
|
5
|
+
// License: MIT
|
|
6
|
+
// Updates:
|
|
7
|
+
// 1. Converted to TypeScript
|
|
8
|
+
// 2. Preserve whitespace inside backtick string literals
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.dedent = void 0;
|
|
11
|
+
function dedent(strings, ...values) {
|
|
12
|
+
const raw = typeof strings === 'string' ? [strings] : strings.raw;
|
|
13
|
+
// first, perform interpolation
|
|
14
|
+
let result = '';
|
|
15
|
+
for (let i = 0; i < raw.length; i++) {
|
|
16
|
+
result += raw[i]
|
|
17
|
+
// join lines when there is a suppressed newline
|
|
18
|
+
.replace(/\\\n[ \t]*/g, '')
|
|
19
|
+
// handle escaped backticks
|
|
20
|
+
.replace(/\\`/g, '`');
|
|
21
|
+
if (i < values.length) {
|
|
22
|
+
result += values[i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// now strip indentation
|
|
26
|
+
const lines = split(result);
|
|
27
|
+
let mindent = null;
|
|
28
|
+
lines.forEach((l) => {
|
|
29
|
+
let m = l.match(/^(\s+)\S+/);
|
|
30
|
+
if (m) {
|
|
31
|
+
let indent = m[1].length;
|
|
32
|
+
if (!mindent) {
|
|
33
|
+
// this is the first indented line
|
|
34
|
+
mindent = indent;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
mindent = Math.min(mindent, indent);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (mindent !== null) {
|
|
42
|
+
const m = mindent;
|
|
43
|
+
result = lines.map((l) => (l[0] === ' ' ? l.slice(m) : l)).join('\n');
|
|
44
|
+
}
|
|
45
|
+
// trim trailing whitespace on all lines
|
|
46
|
+
result = result
|
|
47
|
+
.split('\n')
|
|
48
|
+
.map((l) => l.trimEnd())
|
|
49
|
+
.join('\n');
|
|
50
|
+
return (result
|
|
51
|
+
// dedent eats leading and trailing whitespace too
|
|
52
|
+
.trim()
|
|
53
|
+
// handle escaped newlines at the end to ensure they don't get stripped too
|
|
54
|
+
.replace(/\\n/g, '\n'));
|
|
55
|
+
}
|
|
56
|
+
exports.dedent = dedent;
|
|
57
|
+
/**
|
|
58
|
+
* Splits a string by newlines.
|
|
59
|
+
* Preserve whitespace inside backtick string literals.
|
|
60
|
+
* @param input The original input string.
|
|
61
|
+
* @returns The split string.
|
|
62
|
+
*/
|
|
63
|
+
function split(input) {
|
|
64
|
+
const result = [];
|
|
65
|
+
let prev = '';
|
|
66
|
+
let current = '';
|
|
67
|
+
let inBackticks = false;
|
|
68
|
+
for (let i = 0; i < input.length; i++) {
|
|
69
|
+
const char = input[i];
|
|
70
|
+
if (prev !== '\\' && char === '`') {
|
|
71
|
+
inBackticks = !inBackticks;
|
|
72
|
+
}
|
|
73
|
+
if (!inBackticks && char === '\n') {
|
|
74
|
+
result.push(current);
|
|
75
|
+
current = '';
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
current += char;
|
|
79
|
+
}
|
|
80
|
+
prev = char;
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkIsBindingNativeEvent = exports.getEventNameWithoutOn = exports.checkIsEvent = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const checkIsEvent = (code) => code.startsWith('on') && /[A-Z]/.test(code.charAt(2));
|
|
6
|
+
exports.checkIsEvent = checkIsEvent;
|
|
7
|
+
const getEventNameWithoutOn = (code) => (0, lodash_1.camelCase)(code.replace('on', ''));
|
|
8
|
+
exports.getEventNameWithoutOn = getEventNameWithoutOn;
|
|
9
|
+
const nativeEvents = [
|
|
10
|
+
'abort',
|
|
11
|
+
'animationcancel',
|
|
12
|
+
'animationend',
|
|
13
|
+
'animationiteration',
|
|
14
|
+
'animationstart',
|
|
15
|
+
'auxclick',
|
|
16
|
+
'beforeinput',
|
|
17
|
+
'beforetoggle',
|
|
18
|
+
'blur',
|
|
19
|
+
'cancel',
|
|
20
|
+
'canplay',
|
|
21
|
+
'canplaythrough',
|
|
22
|
+
'change',
|
|
23
|
+
'click',
|
|
24
|
+
'close',
|
|
25
|
+
'compositionend',
|
|
26
|
+
'compositionstart',
|
|
27
|
+
'compositionupdate',
|
|
28
|
+
'contextlost',
|
|
29
|
+
'contextmenu',
|
|
30
|
+
'contextrestored',
|
|
31
|
+
'copy',
|
|
32
|
+
'cuechange',
|
|
33
|
+
'cut',
|
|
34
|
+
'dblclick',
|
|
35
|
+
'drag',
|
|
36
|
+
'dragend',
|
|
37
|
+
'dragenter',
|
|
38
|
+
'dragleave',
|
|
39
|
+
'dragover',
|
|
40
|
+
'dragstart',
|
|
41
|
+
'drop',
|
|
42
|
+
'durationchange',
|
|
43
|
+
'emptied',
|
|
44
|
+
'ended',
|
|
45
|
+
'error',
|
|
46
|
+
'focus',
|
|
47
|
+
'focusin',
|
|
48
|
+
'focusout',
|
|
49
|
+
'formdata',
|
|
50
|
+
'gotpointercapture',
|
|
51
|
+
'input',
|
|
52
|
+
'invalid',
|
|
53
|
+
'keydown',
|
|
54
|
+
'keypress',
|
|
55
|
+
'keyup',
|
|
56
|
+
'load',
|
|
57
|
+
'loadeddata',
|
|
58
|
+
'loadedmetadata',
|
|
59
|
+
'loadstart',
|
|
60
|
+
'lostpointercapture',
|
|
61
|
+
'mousedown',
|
|
62
|
+
'mouseenter',
|
|
63
|
+
'mouseleave',
|
|
64
|
+
'mousemove',
|
|
65
|
+
'mouseout',
|
|
66
|
+
'mouseover',
|
|
67
|
+
'mouseup',
|
|
68
|
+
'paste',
|
|
69
|
+
'pause',
|
|
70
|
+
'play',
|
|
71
|
+
'playing',
|
|
72
|
+
'pointercancel',
|
|
73
|
+
'pointerdown',
|
|
74
|
+
'pointerenter',
|
|
75
|
+
'pointerleave',
|
|
76
|
+
'pointermove',
|
|
77
|
+
'pointerout',
|
|
78
|
+
'pointerover',
|
|
79
|
+
'pointerup',
|
|
80
|
+
'progress',
|
|
81
|
+
'ratechange',
|
|
82
|
+
'reset',
|
|
83
|
+
'resize',
|
|
84
|
+
'scroll',
|
|
85
|
+
'scrollend',
|
|
86
|
+
'securitypolicyviolation',
|
|
87
|
+
'seeked',
|
|
88
|
+
'seeking',
|
|
89
|
+
'select',
|
|
90
|
+
'selectionchange',
|
|
91
|
+
'selectstart',
|
|
92
|
+
'slotchange',
|
|
93
|
+
'stalled',
|
|
94
|
+
'submit',
|
|
95
|
+
'suspend',
|
|
96
|
+
'timeupdate',
|
|
97
|
+
'toggle',
|
|
98
|
+
'touchcancel',
|
|
99
|
+
'touchend',
|
|
100
|
+
'touchmove',
|
|
101
|
+
'touchstart',
|
|
102
|
+
'transitioncancel',
|
|
103
|
+
'transitionend',
|
|
104
|
+
'transitionrun',
|
|
105
|
+
'transitionstart',
|
|
106
|
+
'volumechange',
|
|
107
|
+
'waiting',
|
|
108
|
+
'webkitanimationend',
|
|
109
|
+
'webkitanimationiteration',
|
|
110
|
+
'webkitanimationstart',
|
|
111
|
+
'webkittransitionend',
|
|
112
|
+
'wheel',
|
|
113
|
+
];
|
|
114
|
+
const checkIsBindingNativeEvent = (code) => !!nativeEvents.find((nativeEvent) => nativeEvent === code.toLowerCase());
|
|
115
|
+
exports.checkIsBindingNativeEvent = checkIsBindingNativeEvent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fastClone: <T extends object>(obj: T) => T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterEmptyTextNodes = exports.isEmptyTextNode = void 0;
|
|
4
|
+
const isEmptyTextNode = (node) => {
|
|
5
|
+
return typeof node.properties._text === 'string' && node.properties._text.trim().length === 0;
|
|
6
|
+
};
|
|
7
|
+
exports.isEmptyTextNode = isEmptyTextNode;
|
|
8
|
+
const filterEmptyTextNodes = (node) => !(0, exports.isEmptyTextNode)(node);
|
|
9
|
+
exports.filterEmptyTextNodes = filterEmptyTextNodes;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.format = void 0;
|
|
4
|
+
const preSpaceRegex = /^\s*/g;
|
|
5
|
+
const DEFAULT_INDENT_SPACES = 2;
|
|
6
|
+
/**
|
|
7
|
+
* Generic formatter for languages prettier doesn't support, like Swift
|
|
8
|
+
*
|
|
9
|
+
* Not super sophisticated, but much better than nothing
|
|
10
|
+
*/
|
|
11
|
+
const format = (str, indentSpaces = DEFAULT_INDENT_SPACES) => {
|
|
12
|
+
let currentIndent = 0;
|
|
13
|
+
const lines = str.split('\n');
|
|
14
|
+
lines.forEach((item, index) => {
|
|
15
|
+
item = item.trimEnd();
|
|
16
|
+
if (!item) {
|
|
17
|
+
lines[index] = '';
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
lines[index] = item.replace(preSpaceRegex, ' '.repeat(currentIndent * indentSpaces));
|
|
21
|
+
const nextLine = lines[index + 1];
|
|
22
|
+
if (!nextLine) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (nextLine.match(/^\s*[})][,;]?\s*$/)) {
|
|
26
|
+
currentIndent--;
|
|
27
|
+
}
|
|
28
|
+
else if (item.match(/([({]| in)$/)) {
|
|
29
|
+
currentIndent++;
|
|
30
|
+
}
|
|
31
|
+
currentIndent = Math.max(currentIndent, 0);
|
|
32
|
+
});
|
|
33
|
+
return lines.join('\n').replace(/\n{3,}/g, '\n\n');
|
|
34
|
+
};
|
|
35
|
+
exports.format = format;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBindingsCode = void 0;
|
|
4
|
+
function getBindingsCode(children) {
|
|
5
|
+
const bindings = [];
|
|
6
|
+
children.forEach((child) => {
|
|
7
|
+
Object.values(child.bindings || []).forEach((binding) => {
|
|
8
|
+
bindings.push(binding.code);
|
|
9
|
+
});
|
|
10
|
+
if (child.children) {
|
|
11
|
+
bindings.push(...getBindingsCode(child.children));
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return bindings;
|
|
15
|
+
}
|
|
16
|
+
exports.getBindingsCode = getBindingsCode;
|
|
@@ -0,0 +1,26 @@
|
|
|
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.getChildComponents = void 0;
|
|
7
|
+
const is_mitosis_node_1 = require("../helpers/is-mitosis-node");
|
|
8
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
9
|
+
const getChildComponents = (json) => {
|
|
10
|
+
const nodes = [];
|
|
11
|
+
const childComponents = [json.name]; // a component can be recursively used in itself
|
|
12
|
+
(0, legacy_1.default)(json).forEach(function (item) {
|
|
13
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
14
|
+
nodes.push(item.name);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
for (const { imports } of json.imports) {
|
|
18
|
+
for (const key of Object.keys(imports)) {
|
|
19
|
+
if (nodes.includes(key)) {
|
|
20
|
+
childComponents.push(key);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return childComponents;
|
|
25
|
+
};
|
|
26
|
+
exports.getChildComponents = getChildComponents;
|
|
@@ -0,0 +1,18 @@
|
|
|
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.getComponentsUsed = void 0;
|
|
7
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
8
|
+
const is_mitosis_node_1 = require("./is-mitosis-node");
|
|
9
|
+
function getComponentsUsed(json) {
|
|
10
|
+
const components = new Set();
|
|
11
|
+
(0, legacy_1.default)(json).forEach(function (item) {
|
|
12
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
13
|
+
components.add(item.name);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return components;
|
|
17
|
+
}
|
|
18
|
+
exports.getComponentsUsed = getComponentsUsed;
|
|
@@ -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
|
+
exports.getComponents = void 0;
|
|
7
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
8
|
+
const is_mitosis_node_1 = require("./is-mitosis-node");
|
|
9
|
+
const is_upper_case_1 = require("./is-upper-case");
|
|
10
|
+
function getComponents(json) {
|
|
11
|
+
const components = new Set();
|
|
12
|
+
(0, legacy_1.default)(json).forEach(function (item) {
|
|
13
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
14
|
+
if ((0, is_upper_case_1.isUpperCase)(item.name[0])) {
|
|
15
|
+
components.add(item.name);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return components;
|
|
20
|
+
}
|
|
21
|
+
exports.getComponents = getComponents;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MitosisComponent } from '../types/mitosis-component';
|
|
2
|
+
/**
|
|
3
|
+
* Return custom imports of basic values (aka things
|
|
4
|
+
* that are not ClassCase like components and types)
|
|
5
|
+
*
|
|
6
|
+
* For for code like:
|
|
7
|
+
* import { foo, bar } from './constants'
|
|
8
|
+
*
|
|
9
|
+
* Will return:
|
|
10
|
+
* ['foo', 'bar' ]
|
|
11
|
+
*
|
|
12
|
+
* This also filters for strings that appears to be actually used
|
|
13
|
+
* by the template
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCustomImports(json: MitosisComponent): string[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCustomImports = void 0;
|
|
4
|
+
const is_upper_case_1 = require("./is-upper-case");
|
|
5
|
+
/**
|
|
6
|
+
* Return custom imports of basic values (aka things
|
|
7
|
+
* that are not ClassCase like components and types)
|
|
8
|
+
*
|
|
9
|
+
* For for code like:
|
|
10
|
+
* import { foo, bar } from './constants'
|
|
11
|
+
*
|
|
12
|
+
* Will return:
|
|
13
|
+
* ['foo', 'bar' ]
|
|
14
|
+
*
|
|
15
|
+
* This also filters for strings that appears to be actually used
|
|
16
|
+
* by the template
|
|
17
|
+
*/
|
|
18
|
+
function getCustomImports(json) {
|
|
19
|
+
const blocksString = JSON.stringify(json.children);
|
|
20
|
+
const customImports = json.imports
|
|
21
|
+
.map((item) => {
|
|
22
|
+
return Object.keys(item.imports).filter((item) => item &&
|
|
23
|
+
// this ignores component imports, which are CamelCased.
|
|
24
|
+
(!(0, is_upper_case_1.isUpperCase)(item[0]) ||
|
|
25
|
+
// this includes constants which are typically CAPITALIZED.
|
|
26
|
+
item.toUpperCase() === item));
|
|
27
|
+
})
|
|
28
|
+
.flat()
|
|
29
|
+
// This is imperfect. Basically, if the string of this import name
|
|
30
|
+
// doesn't occur at all, it's definitely not used. If it does, it might.
|
|
31
|
+
// So this simple check helps us ~90% of the time not over-add imports
|
|
32
|
+
// to templates. Arguably "good enough" for now, as there is generally no
|
|
33
|
+
// consequence to over adding here, and it would be a lot more performance expensive
|
|
34
|
+
// during compilation to do a complete AST parse and look for real references
|
|
35
|
+
.filter((item) => blocksString.includes(item));
|
|
36
|
+
return customImports;
|
|
37
|
+
}
|
|
38
|
+
exports.getCustomImports = getCustomImports;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getFunctionString: (code: string) => string;
|