@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,377 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentToAngularSignals = void 0;
|
|
4
|
+
const helpers_1 = require("../../../generators/angular/helpers");
|
|
5
|
+
const format_1 = require("../../../generators/angular/helpers/format");
|
|
6
|
+
const get_outputs_1 = require("../../../generators/angular/helpers/get-outputs");
|
|
7
|
+
const get_refs_1 = require("../../../generators/angular/helpers/get-refs");
|
|
8
|
+
const get_styles_1 = require("../../../generators/angular/helpers/get-styles");
|
|
9
|
+
const hooks_1 = require("../../../generators/angular/helpers/hooks");
|
|
10
|
+
const blocks_1 = require("../../../generators/angular/signals/blocks");
|
|
11
|
+
const helpers_2 = require("../../../generators/angular/signals/helpers");
|
|
12
|
+
const get_computed_1 = require("../../../generators/angular/signals/helpers/get-computed");
|
|
13
|
+
const get_inputs_1 = require("../../../generators/angular/signals/helpers/get-inputs");
|
|
14
|
+
const get_code_processor_plugins_1 = require("../../../generators/angular/signals/plugins/get-code-processor-plugins");
|
|
15
|
+
const types_1 = require("../../../generators/angular/types");
|
|
16
|
+
const dedent_1 = require("../../../helpers/dedent");
|
|
17
|
+
const event_handlers_1 = require("../../../helpers/event-handlers");
|
|
18
|
+
const fast_clone_1 = require("../../../helpers/fast-clone");
|
|
19
|
+
const get_child_components_1 = require("../../../helpers/get-child-components");
|
|
20
|
+
const get_components_used_1 = require("../../../helpers/get-components-used");
|
|
21
|
+
const get_props_1 = require("../../../helpers/get-props");
|
|
22
|
+
const get_state_object_string_1 = require("../../../helpers/get-state-object-string");
|
|
23
|
+
const is_hook_empty_1 = require("../../../helpers/is-hook-empty");
|
|
24
|
+
const is_upper_case_1 = require("../../../helpers/is-upper-case");
|
|
25
|
+
const merge_options_1 = require("../../../helpers/merge-options");
|
|
26
|
+
const render_imports_1 = require("../../../helpers/render-imports");
|
|
27
|
+
const strip_meta_properties_1 = require("../../../helpers/strip-meta-properties");
|
|
28
|
+
const attribute_passing_1 = require("../../../helpers/web-components/attribute-passing");
|
|
29
|
+
const plugins_1 = require("../../../modules/plugins");
|
|
30
|
+
const lodash_1 = require("lodash");
|
|
31
|
+
const get_dynamic_template_refs_1 = require("./helpers/get-dynamic-template-refs");
|
|
32
|
+
const componentToAngularSignals = (userOptions = {}) => {
|
|
33
|
+
return ({ component }) => {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
35
|
+
// Make a copy we can safely mutate, similar to babel's toolchain
|
|
36
|
+
let json = (0, fast_clone_1.fastClone)(component);
|
|
37
|
+
// Init compileContext
|
|
38
|
+
json.compileContext = {
|
|
39
|
+
angular: {
|
|
40
|
+
hooks: {
|
|
41
|
+
ngAfterViewInit: {
|
|
42
|
+
code: '',
|
|
43
|
+
},
|
|
44
|
+
ngAfterContentInit: {
|
|
45
|
+
code: '',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
extra: {
|
|
49
|
+
importCalls: [],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
const options = (0, merge_options_1.initializeOptions)({
|
|
54
|
+
target: 'angular',
|
|
55
|
+
component,
|
|
56
|
+
defaults: types_1.DEFAULT_ANGULAR_OPTIONS,
|
|
57
|
+
userOptions,
|
|
58
|
+
});
|
|
59
|
+
options.typescript = true; // Angular uses ts all the time
|
|
60
|
+
options.api = 'signals';
|
|
61
|
+
if (options.plugins) {
|
|
62
|
+
json = (0, plugins_1.runPreJsonPlugins)({ json, plugins: options.plugins });
|
|
63
|
+
}
|
|
64
|
+
const withAttributePassing = (0, attribute_passing_1.shouldAddAttributePassing)(json, options);
|
|
65
|
+
const rootRef = (0, attribute_passing_1.getAddAttributePassingRef)(json, options);
|
|
66
|
+
const domRefs = (0, get_refs_1.getDomRefs)({ json, options, rootRef, withAttributePassing });
|
|
67
|
+
let props = Array.from((0, get_props_1.getProps)(json));
|
|
68
|
+
const events = props.filter((prop) => (0, event_handlers_1.checkIsEvent)(prop));
|
|
69
|
+
const childComponents = (0, get_child_components_1.getChildComponents)(json);
|
|
70
|
+
props = props.filter((prop) => {
|
|
71
|
+
// Best practise for Angular is to use Events without "on"
|
|
72
|
+
// Stencil doesn't need children as a prop
|
|
73
|
+
return prop !== 'children' && !(0, event_handlers_1.checkIsEvent)(prop);
|
|
74
|
+
});
|
|
75
|
+
const processBindingOptions = {
|
|
76
|
+
events,
|
|
77
|
+
props,
|
|
78
|
+
target: 'angular',
|
|
79
|
+
skipAppendEmit: true,
|
|
80
|
+
};
|
|
81
|
+
options.plugins = (0, get_code_processor_plugins_1.getCodeProcessorPlugins)(json, options, processBindingOptions);
|
|
82
|
+
if (options.plugins) {
|
|
83
|
+
json = (0, plugins_1.runPostJsonPlugins)({ json, plugins: options.plugins });
|
|
84
|
+
}
|
|
85
|
+
// CSS
|
|
86
|
+
const styles = (0, get_styles_1.getAngularStyles)({ json, options });
|
|
87
|
+
// Mitosis Metadata
|
|
88
|
+
const useMetadata = (_a = json.meta) === null || _a === void 0 ? void 0 : _a.useMetadata;
|
|
89
|
+
const onPush = ((_b = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _b === void 0 ? void 0 : _b.changeDetection) == 'OnPush';
|
|
90
|
+
const writeableSignals = ((_d = (_c = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _c === void 0 ? void 0 : _c.signals) === null || _d === void 0 ? void 0 : _d.writeable) || [];
|
|
91
|
+
const requiredSignals = ((_f = (_e = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _e === void 0 ? void 0 : _e.signals) === null || _f === void 0 ? void 0 : _f.required) || [];
|
|
92
|
+
// Context & Injectables
|
|
93
|
+
const injectables = Object.entries(((_g = json === null || json === void 0 ? void 0 : json.context) === null || _g === void 0 ? void 0 : _g.get) || {}).map(([variableName, { name }]) => {
|
|
94
|
+
return `public ${variableName} : ${name}`;
|
|
95
|
+
});
|
|
96
|
+
const shouldUseSanitizer = !((_h = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _h === void 0 ? void 0 : _h.sanitizeInnerHTML) && (0, helpers_1.traverseAndCheckIfInnerHTMLIsUsed)(json);
|
|
97
|
+
if (shouldUseSanitizer) {
|
|
98
|
+
injectables.push('protected sanitizer: DomSanitizer');
|
|
99
|
+
}
|
|
100
|
+
// HTML
|
|
101
|
+
let template = json.children
|
|
102
|
+
.map((item) => {
|
|
103
|
+
var _a, _b, _c, _d;
|
|
104
|
+
return (0, blocks_1.blockToAngularSignals)({
|
|
105
|
+
root: json,
|
|
106
|
+
json: item,
|
|
107
|
+
options,
|
|
108
|
+
rootRef: withAttributePassing && rootRef === attribute_passing_1.ROOT_REF ? rootRef : undefined, // only pass rootRef if it's not the default
|
|
109
|
+
blockOptions: {
|
|
110
|
+
childComponents,
|
|
111
|
+
nativeAttributes: (_b = (_a = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _a === void 0 ? void 0 : _a.nativeAttributes) !== null && _b !== void 0 ? _b : [],
|
|
112
|
+
nativeEvents: (_d = (_c = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _c === void 0 ? void 0 : _c.nativeEvents) !== null && _d !== void 0 ? _d : [],
|
|
113
|
+
sanitizeInnerHTML: !shouldUseSanitizer,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
})
|
|
117
|
+
.join('\n');
|
|
118
|
+
if (options.prettier !== false) {
|
|
119
|
+
// We need to use 'strict' mode for Angular otherwise it could add spaces around some content
|
|
120
|
+
template = (0, format_1.tryFormat)(template, 'html', 'strict');
|
|
121
|
+
}
|
|
122
|
+
const { components: dynamicComponents, dynamicTemplate } = (0, helpers_1.traverseToGetAllDynamicComponents)(json, options, {
|
|
123
|
+
childComponents,
|
|
124
|
+
nativeAttributes: (_m = (_l = (_k = (_j = json.meta) === null || _j === void 0 ? void 0 : _j.useMetadata) === null || _k === void 0 ? void 0 : _k.angular) === null || _l === void 0 ? void 0 : _l.nativeAttributes) !== null && _m !== void 0 ? _m : [],
|
|
125
|
+
nativeEvents: (_r = (_q = (_p = (_o = json.meta) === null || _o === void 0 ? void 0 : _o.useMetadata) === null || _p === void 0 ? void 0 : _p.angular) === null || _q === void 0 ? void 0 : _q.nativeEvents) !== null && _r !== void 0 ? _r : [],
|
|
126
|
+
}, 'signals');
|
|
127
|
+
const hasDynamicComponents = dynamicComponents.size > 0;
|
|
128
|
+
if (hasDynamicComponents) {
|
|
129
|
+
injectables.push('private viewContainer: ViewContainerRef');
|
|
130
|
+
json.compileContext.angular.hooks.ngAfterContentInit.code =
|
|
131
|
+
`this._updateView();` + json.compileContext.angular.hooks.ngAfterContentInit.code;
|
|
132
|
+
}
|
|
133
|
+
// Angular component settings
|
|
134
|
+
const componentsUsed = Array.from((0, get_components_used_1.getComponentsUsed)(json)).filter((item) => item.length && (0, is_upper_case_1.isUpperCase)(item[0]) && !types_1.BUILT_IN_COMPONENTS.has(item));
|
|
135
|
+
const componentSettings = {
|
|
136
|
+
selector: ((_s = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _s === void 0 ? void 0 : _s.selector)
|
|
137
|
+
? `'${(_t = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _t === void 0 ? void 0 : _t.selector}'`
|
|
138
|
+
: `'${(0, lodash_1.kebabCase)(json.name || 'my-component')}'`,
|
|
139
|
+
standalone: 'true',
|
|
140
|
+
imports: `[${['CommonModule', ...componentsUsed].join(', ')}]`,
|
|
141
|
+
template: `\`${dynamicTemplate}${(0, helpers_1.getTemplateFormat)(template)}\``,
|
|
142
|
+
};
|
|
143
|
+
if (onPush) {
|
|
144
|
+
componentSettings.changeDetection = 'ChangeDetectionStrategy.OnPush';
|
|
145
|
+
}
|
|
146
|
+
if (styles) {
|
|
147
|
+
componentSettings.styles = `\`${styles}\``;
|
|
148
|
+
}
|
|
149
|
+
if ((_u = useMetadata === null || useMetadata === void 0 ? void 0 : useMetadata.angular) === null || _u === void 0 ? void 0 : _u.skipHydration) {
|
|
150
|
+
componentSettings.host = `{ ngSkipHydration: 'true' }`;
|
|
151
|
+
}
|
|
152
|
+
(0, strip_meta_properties_1.stripMetaProperties)(json);
|
|
153
|
+
const dataString = (0, get_state_object_string_1.getStateObjectStringFromComponent)(json, {
|
|
154
|
+
format: 'class',
|
|
155
|
+
data: true,
|
|
156
|
+
functions: false,
|
|
157
|
+
getters: false,
|
|
158
|
+
valueMapper: (code, _, typeParameter, key) => {
|
|
159
|
+
var _a;
|
|
160
|
+
if (typeParameter && !code.length) {
|
|
161
|
+
console.error(`
|
|
162
|
+
Component ${json.name} has state property without an initial value'.
|
|
163
|
+
This will cause an error in Angular.
|
|
164
|
+
Please add a initial value for every state property even if it's \`undefined\`.`);
|
|
165
|
+
}
|
|
166
|
+
// Special case for _listenerFns - don't wrap in signal()
|
|
167
|
+
if (key === '_listenerFns') {
|
|
168
|
+
return code;
|
|
169
|
+
}
|
|
170
|
+
if (key) {
|
|
171
|
+
const propRefs = props.filter((prop) => code.includes(`this.${prop}()`));
|
|
172
|
+
if (propRefs.length > 0) {
|
|
173
|
+
if (!((_a = json.hooks.onInit) === null || _a === void 0 ? void 0 : _a.code)) {
|
|
174
|
+
json.hooks.onInit = {
|
|
175
|
+
code: `
|
|
176
|
+
this.${key}.set(${code});
|
|
177
|
+
`,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
json.hooks.onInit.code = `this.${key}.set(${code});`.concat(json.hooks.onInit.code);
|
|
182
|
+
}
|
|
183
|
+
return `signal${typeParameter ? `<${typeParameter}>` : ''}(undefined)`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return `signal${typeParameter ? `<${typeParameter}>` : ''}(${code})`;
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
const methodsString = (0, get_state_object_string_1.getStateObjectStringFromComponent)(json, {
|
|
190
|
+
format: 'class',
|
|
191
|
+
data: false,
|
|
192
|
+
functions: true,
|
|
193
|
+
getters: false,
|
|
194
|
+
onlyValueMapper: true,
|
|
195
|
+
valueMapper: (code, type, _, key) => {
|
|
196
|
+
return code.startsWith('function') ? code.replace('function', '').trim() : code;
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
// Handle getters as computed signals
|
|
200
|
+
const gettersString = (0, get_computed_1.getComputedGetters)({ json });
|
|
201
|
+
// Check if we need Renderer2 for spread attributes
|
|
202
|
+
const usesRenderer2 = !!json.state['_listenerFns'];
|
|
203
|
+
if (usesRenderer2) {
|
|
204
|
+
injectables.push('private renderer: Renderer2');
|
|
205
|
+
}
|
|
206
|
+
const importsViewChild = hasDynamicComponents ||
|
|
207
|
+
domRefs.size !== 0 ||
|
|
208
|
+
((_y = (_x = (_w = (_v = json.compileContext) === null || _v === void 0 ? void 0 : _v.angular) === null || _w === void 0 ? void 0 : _w.extra) === null || _x === void 0 ? void 0 : _x.spreadRefs) === null || _y === void 0 ? void 0 : _y.length) > 0;
|
|
209
|
+
// Imports
|
|
210
|
+
const emptyOnMount = (0, is_hook_empty_1.isHookEmpty)(json.hooks.onMount);
|
|
211
|
+
const emptyOnUnMount = (0, is_hook_empty_1.isHookEmpty)(json.hooks.onUnMount);
|
|
212
|
+
const AfterViewInit = Boolean(!emptyOnMount || withAttributePassing);
|
|
213
|
+
const OnDestroy = !emptyOnUnMount;
|
|
214
|
+
const coreImports = (0, helpers_2.getAngularCoreImportsAsString)({
|
|
215
|
+
refs: domRefs.size !== 0,
|
|
216
|
+
input: props.length !== 0,
|
|
217
|
+
output: events.length !== 0,
|
|
218
|
+
model: writeableSignals.length !== 0,
|
|
219
|
+
effect: ((_z = json.hooks.onUpdate) === null || _z === void 0 ? void 0 : _z.length) !== 0,
|
|
220
|
+
signal: dataString.length !== 0 || hasDynamicComponents,
|
|
221
|
+
computed: gettersString.length !== 0,
|
|
222
|
+
onPush,
|
|
223
|
+
AfterViewInit,
|
|
224
|
+
OnDestroy,
|
|
225
|
+
viewChild: importsViewChild,
|
|
226
|
+
viewContainerRef: hasDynamicComponents,
|
|
227
|
+
templateRef: hasDynamicComponents,
|
|
228
|
+
renderer: usesRenderer2,
|
|
229
|
+
});
|
|
230
|
+
// Hooks
|
|
231
|
+
if (!emptyOnMount) {
|
|
232
|
+
// `onMount` runs only in the browser, after view initialization. Guard it
|
|
233
|
+
// so it does not execute during SSR.
|
|
234
|
+
(0, hooks_1.addCodeNgAfterViewInit)(json, `if (typeof window !== 'undefined') {
|
|
235
|
+
${json.hooks.onMount.map((onMount) => onMount.code).join('\n')}
|
|
236
|
+
}`);
|
|
237
|
+
}
|
|
238
|
+
// Angular interfaces
|
|
239
|
+
const angularInterfaces = [];
|
|
240
|
+
if (AfterViewInit) {
|
|
241
|
+
angularInterfaces.push('AfterViewInit');
|
|
242
|
+
}
|
|
243
|
+
if (OnDestroy) {
|
|
244
|
+
angularInterfaces.push('OnDestroy');
|
|
245
|
+
}
|
|
246
|
+
let str = (0, dedent_1.dedent) `
|
|
247
|
+
import { ${coreImports} } from '@angular/core';
|
|
248
|
+
import { CommonModule } from '@angular/common';
|
|
249
|
+
${shouldUseSanitizer ? `import { DomSanitizer } from '@angular/platform-browser';` : ''}
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
${json.types ? json.types.join('\n') : ''}
|
|
253
|
+
${(0, helpers_1.getDefaultProps)(json)}
|
|
254
|
+
|
|
255
|
+
${(0, render_imports_1.renderPreComponent)({
|
|
256
|
+
explicitImportFileExtension: options.explicitImportFileExtension,
|
|
257
|
+
component: json,
|
|
258
|
+
target: 'angular',
|
|
259
|
+
preserveFileExtensions: options.preserveFileExtensions,
|
|
260
|
+
importMapper: (_, theImport, importedValues) => {
|
|
261
|
+
if (options.defaultExportComponents)
|
|
262
|
+
return undefined;
|
|
263
|
+
const { defaultImport } = importedValues;
|
|
264
|
+
const { path } = theImport;
|
|
265
|
+
if (defaultImport && componentsUsed.includes(defaultImport)) {
|
|
266
|
+
return `import { ${defaultImport} } from '${path}';`;
|
|
267
|
+
}
|
|
268
|
+
return undefined;
|
|
269
|
+
},
|
|
270
|
+
})}
|
|
271
|
+
|
|
272
|
+
@Component({
|
|
273
|
+
${Object.entries(componentSettings)
|
|
274
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
275
|
+
.join(',')}
|
|
276
|
+
})
|
|
277
|
+
export ${options.defaultExportComponents ? 'default ' : ''}class ${json.name} ${angularInterfaces.length ? ` implements ${angularInterfaces.join(',')}` : ''} {
|
|
278
|
+
${(0, lodash_1.uniq)(json.compileContext.angular.extra.importCalls)
|
|
279
|
+
.map((importCall) => `protected readonly ${importCall} = ${importCall};`)
|
|
280
|
+
.join('\n')}
|
|
281
|
+
|
|
282
|
+
${hasDynamicComponents ? (0, get_dynamic_template_refs_1.getDynamicTemplateRefs)(dynamicComponents) : ''}
|
|
283
|
+
${(0, get_inputs_1.getSignalInputs)({
|
|
284
|
+
json,
|
|
285
|
+
writeableSignals,
|
|
286
|
+
requiredSignals,
|
|
287
|
+
props: Array.from(props),
|
|
288
|
+
})}
|
|
289
|
+
${(0, get_outputs_1.getOutputs)({ json, outputVars: events, api: options.api })}
|
|
290
|
+
|
|
291
|
+
${Array.from(domRefs)
|
|
292
|
+
.map((refName) => `${refName} = viewChild<ElementRef>("${refName}")`)
|
|
293
|
+
.join('\n')}
|
|
294
|
+
${((_2 = (_1 = (_0 = json.compileContext) === null || _0 === void 0 ? void 0 : _0.angular) === null || _1 === void 0 ? void 0 : _1.extra) === null || _2 === void 0 ? void 0 : _2.spreadRefs)
|
|
295
|
+
? Array.from(new Set(json.compileContext.angular.extra.spreadRefs))
|
|
296
|
+
.filter((refName) => !Array.from(domRefs).includes(refName))
|
|
297
|
+
.map((refName) => `${refName} = viewChild<ElementRef>("${refName}")`)
|
|
298
|
+
.join('\n')
|
|
299
|
+
: ''}
|
|
300
|
+
|
|
301
|
+
${dataString}
|
|
302
|
+
${gettersString}
|
|
303
|
+
${methodsString}
|
|
304
|
+
|
|
305
|
+
constructor(${injectables.join(',\n')}) {
|
|
306
|
+
${(0, is_hook_empty_1.isHookEmpty)(json.hooks.onUpdate)
|
|
307
|
+
? ''
|
|
308
|
+
: `if (typeof window !== 'undefined') {
|
|
309
|
+
${(_3 = json.hooks.onUpdate) === null || _3 === void 0 ? void 0 : _3.map(({ code, depsArray }) =>
|
|
310
|
+
/**
|
|
311
|
+
* `allowSignalWrites` is required for Angular < 19 to permit signal writes
|
|
312
|
+
* inside effects. It was deprecated in Angular 19 (writes are always allowed)
|
|
313
|
+
* and logging it there produces console noise, so we gate it on the runtime
|
|
314
|
+
* Angular version to keep backwards compatibility with v17/v18.
|
|
315
|
+
*/
|
|
316
|
+
`effect(() => {
|
|
317
|
+
${(depsArray === null || depsArray === void 0 ? void 0 : depsArray.length)
|
|
318
|
+
? `
|
|
319
|
+
// --- Mitosis: Workaround to make sure the effect() is triggered ---
|
|
320
|
+
${depsArray.join('\n')}
|
|
321
|
+
// ---
|
|
322
|
+
`
|
|
323
|
+
: ''}
|
|
324
|
+
${code}
|
|
325
|
+
}, Number(VERSION.major) < 19 ? ({ allowSignalWrites: true } as any) : undefined);`).join('\n')}
|
|
326
|
+
}
|
|
327
|
+
`}}
|
|
328
|
+
|
|
329
|
+
${withAttributePassing ? (0, attribute_passing_1.getAttributePassingString)(options.typescript) : ''}
|
|
330
|
+
|
|
331
|
+
${(0, is_hook_empty_1.isHookEmpty)(json.hooks.onInit)
|
|
332
|
+
? ''
|
|
333
|
+
: `ngOnInit() {
|
|
334
|
+
${!((_4 = json.hooks) === null || _4 === void 0 ? void 0 : _4.onInit) ? '' : (_5 = json.hooks.onInit) === null || _5 === void 0 ? void 0 : _5.code}
|
|
335
|
+
}`}
|
|
336
|
+
|
|
337
|
+
${!hasDynamicComponents
|
|
338
|
+
? ''
|
|
339
|
+
: `
|
|
340
|
+
_updateView() {
|
|
341
|
+
${(0, get_dynamic_template_refs_1.getInitEmbedViewCode)(dynamicComponents)}
|
|
342
|
+
}`}
|
|
343
|
+
|
|
344
|
+
${
|
|
345
|
+
// hooks specific to Angular
|
|
346
|
+
((_7 = (_6 = json.compileContext) === null || _6 === void 0 ? void 0 : _6.angular) === null || _7 === void 0 ? void 0 : _7.hooks)
|
|
347
|
+
? Object.entries((_9 = (_8 = json.compileContext) === null || _8 === void 0 ? void 0 : _8.angular) === null || _9 === void 0 ? void 0 : _9.hooks)
|
|
348
|
+
.filter(([_, value]) => !(0, is_hook_empty_1.isHookEmpty)(value))
|
|
349
|
+
.map(([key, value]) => {
|
|
350
|
+
return `${key}() {
|
|
351
|
+
${value.code}
|
|
352
|
+
}`;
|
|
353
|
+
})
|
|
354
|
+
.join('\n')
|
|
355
|
+
: ''}
|
|
356
|
+
|
|
357
|
+
${emptyOnUnMount
|
|
358
|
+
? ''
|
|
359
|
+
: `ngOnDestroy() {
|
|
360
|
+
${((_10 = json.hooks.onUnMount) === null || _10 === void 0 ? void 0 : _10.code) || ''}
|
|
361
|
+
}`}
|
|
362
|
+
|
|
363
|
+
}
|
|
364
|
+
`;
|
|
365
|
+
if (options.plugins) {
|
|
366
|
+
str = (0, plugins_1.runPreCodePlugins)({ json, code: str, plugins: options.plugins });
|
|
367
|
+
}
|
|
368
|
+
if (options.prettier !== false) {
|
|
369
|
+
str = (0, format_1.tryFormat)(str, 'typescript');
|
|
370
|
+
}
|
|
371
|
+
if (options.plugins) {
|
|
372
|
+
str = (0, plugins_1.runPostCodePlugins)({ json, code: str, plugins: options.plugins });
|
|
373
|
+
}
|
|
374
|
+
return str;
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
exports.componentToAngularSignals = componentToAngularSignals;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MitosisComponent } from '../../../../types/mitosis-component';
|
|
2
|
+
import type { Binding } from '../../../../types/mitosis-node';
|
|
3
|
+
export declare const getComputedGetters: ({ json }: {
|
|
4
|
+
json: MitosisComponent;
|
|
5
|
+
}) => string;
|
|
6
|
+
export declare const createObjectSpreadComputed: (json: MitosisComponent, binding: Binding, key: string, isForContext?: boolean, forName?: string, indexName?: string) => string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createObjectSpreadComputed = exports.getComputedGetters = void 0;
|
|
4
|
+
const babel_transform_1 = require("../../../../helpers/babel-transform");
|
|
5
|
+
const symbol_processor_1 = require("../../../../symbols/symbol-processor");
|
|
6
|
+
const types_1 = require("@babel/types");
|
|
7
|
+
const lodash_1 = require("lodash");
|
|
8
|
+
const getComputedGetters = ({ json }) => {
|
|
9
|
+
const getterKeys = Object.keys((0, lodash_1.pickBy)(json.state, (i) => (i === null || i === void 0 ? void 0 : i.type) === 'getter'));
|
|
10
|
+
if (!getterKeys.length) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
return getterKeys
|
|
14
|
+
.map((key) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const code = (_b = (_a = json.state[key]) === null || _a === void 0 ? void 0 : _a.code) === null || _b === void 0 ? void 0 : _b.toString();
|
|
17
|
+
if (!code) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
// Transform `get foo() { return this.bar }` to `foo = computed(() => { return bar.value })`
|
|
21
|
+
const getterAsFunction = code
|
|
22
|
+
.replace('get', '')
|
|
23
|
+
.replace(key, '')
|
|
24
|
+
.trim()
|
|
25
|
+
.replace(/^\(\)/, '() =>');
|
|
26
|
+
return `${key} = computed(${getterAsFunction})`;
|
|
27
|
+
})
|
|
28
|
+
.filter(Boolean)
|
|
29
|
+
.join('\n');
|
|
30
|
+
};
|
|
31
|
+
exports.getComputedGetters = getComputedGetters;
|
|
32
|
+
const createObjectSpreadComputed = (json, binding, key, isForContext = false, forName = '', indexName = '') => {
|
|
33
|
+
const computedName = `objSpread_${key}_${(0, symbol_processor_1.hashCodeAsString)(binding.code)}`;
|
|
34
|
+
const transformedCode = (0, babel_transform_1.babelTransformExpression)(binding.code, {
|
|
35
|
+
MemberExpression(path) {
|
|
36
|
+
var _a;
|
|
37
|
+
if ((0, types_1.isMemberExpression)(path.node) &&
|
|
38
|
+
(0, types_1.isIdentifier)(path.node.object) &&
|
|
39
|
+
(0, types_1.isIdentifier)(path.node.property) &&
|
|
40
|
+
(path.node.object.name === 'props' || path.node.object.name === 'state') &&
|
|
41
|
+
!((_a = path.node.extra) === null || _a === void 0 ? void 0 : _a.processed)) {
|
|
42
|
+
path.node.object.name = 'this';
|
|
43
|
+
path.node.extra = { ...path.node.extra, processed: true };
|
|
44
|
+
const code = path.toString();
|
|
45
|
+
path.replaceWithSourceString(`${code}()`);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const finalCode = transformedCode
|
|
50
|
+
// Replace props.x.y with this.x().y
|
|
51
|
+
.replace(/\bprops\.(\w+)(\.\w+|\?\.\w+|\[.*?\])/g, (match, prop, rest) => {
|
|
52
|
+
return `this.${prop}()${rest}`;
|
|
53
|
+
})
|
|
54
|
+
// Replace state.x.y with this.x().y
|
|
55
|
+
.replace(/\bstate\.(\w+)(\.\w+|\?\.\w+|\[.*?\])/g, (match, prop, rest) => {
|
|
56
|
+
return `this.${prop}()${rest}`;
|
|
57
|
+
});
|
|
58
|
+
if (isForContext && (forName || indexName)) {
|
|
59
|
+
// Create a method that accepts the for loop context variables
|
|
60
|
+
const params = [];
|
|
61
|
+
if (forName)
|
|
62
|
+
params.push(forName);
|
|
63
|
+
if (indexName)
|
|
64
|
+
params.push(indexName);
|
|
65
|
+
json.state[computedName] = {
|
|
66
|
+
code: `${computedName}(${params.join(', ')}) { return ${finalCode} }`,
|
|
67
|
+
type: 'method',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// Creates a getter that gets converted to Angular's computed
|
|
72
|
+
json.state[computedName] = {
|
|
73
|
+
code: `get ${computedName}() { return ${finalCode} }`,
|
|
74
|
+
type: 'getter',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return computedName;
|
|
78
|
+
};
|
|
79
|
+
exports.createObjectSpreadComputed = createObjectSpreadComputed;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInitEmbedViewCode = exports.getDynamicTemplateRefs = void 0;
|
|
4
|
+
const getViewContainerRefName = (component) => {
|
|
5
|
+
return component.split('.')[1].toLowerCase() + 'TemplateRef';
|
|
6
|
+
};
|
|
7
|
+
const getNgTemplateRefName = (component) => {
|
|
8
|
+
return component.split('.')[1].toLowerCase() + 'Template';
|
|
9
|
+
};
|
|
10
|
+
const getDynamicTemplateRefs = (dynamicComponents) => {
|
|
11
|
+
return `
|
|
12
|
+
myContent = signal<any[]>([]);
|
|
13
|
+
${Array.from(dynamicComponents)
|
|
14
|
+
.map((component) => `${getViewContainerRefName(component)} = viewChild<TemplateRef<any>>('${getNgTemplateRefName(component)}');`)
|
|
15
|
+
.join('\n')}
|
|
16
|
+
`;
|
|
17
|
+
};
|
|
18
|
+
exports.getDynamicTemplateRefs = getDynamicTemplateRefs;
|
|
19
|
+
const getInitEmbedViewCode = (dynamicComponents) => {
|
|
20
|
+
return `
|
|
21
|
+
this.myContent.set([${Array.from(dynamicComponents)
|
|
22
|
+
.map((component) => `this.viewContainer.createEmbeddedView(this.${getViewContainerRefName(component)}()).rootNodes`)
|
|
23
|
+
.join(', ')}]);`;
|
|
24
|
+
};
|
|
25
|
+
exports.getInitEmbedViewCode = getInitEmbedViewCode;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MitosisComponent } from '../../../../types/mitosis-component';
|
|
2
|
+
export declare const getSignalInputs: ({ props, json, writeableSignals, requiredSignals, }: {
|
|
3
|
+
props: string[];
|
|
4
|
+
json: MitosisComponent;
|
|
5
|
+
writeableSignals: string[];
|
|
6
|
+
requiredSignals: string[];
|
|
7
|
+
}) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSignalInputs = void 0;
|
|
4
|
+
const getSignalInputs = ({ props, json, writeableSignals, requiredSignals, }) => {
|
|
5
|
+
const propsTypeRef = json.propsTypeRef !== 'any' ? json.propsTypeRef : undefined;
|
|
6
|
+
return props
|
|
7
|
+
.map((prop) => {
|
|
8
|
+
const hasDefaultProp = json.defaultProps && json.defaultProps.hasOwnProperty(prop);
|
|
9
|
+
const propType = propsTypeRef ? `${propsTypeRef}["${prop}"]` : 'any';
|
|
10
|
+
const defaultProp = hasDefaultProp ? `defaultProps["${prop}"]` : '';
|
|
11
|
+
return `${prop}: ${writeableSignals.includes(prop) ? 'ModelSignal' : 'InputSignal'}<${propType}> = ${writeableSignals.includes(prop) ? 'model' : 'input'}${requiredSignals.includes(prop) ? '.required' : ''}<${propType}>(${defaultProp})`;
|
|
12
|
+
})
|
|
13
|
+
.join('\n');
|
|
14
|
+
};
|
|
15
|
+
exports.getSignalInputs = getSignalInputs;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const getAngularCoreImportsAsString: ({ refs, output, input, model, onPush, effect, signal, AfterViewInit, OnDestroy, computed, viewChild, viewContainerRef, templateRef, renderer, }: {
|
|
2
|
+
refs: boolean;
|
|
3
|
+
output: boolean;
|
|
4
|
+
input: boolean;
|
|
5
|
+
model: boolean;
|
|
6
|
+
onPush: boolean;
|
|
7
|
+
AfterViewInit: boolean;
|
|
8
|
+
OnDestroy: boolean;
|
|
9
|
+
effect: boolean;
|
|
10
|
+
signal: boolean;
|
|
11
|
+
computed: boolean;
|
|
12
|
+
viewChild: boolean;
|
|
13
|
+
viewContainerRef: boolean;
|
|
14
|
+
templateRef: boolean;
|
|
15
|
+
renderer?: boolean | undefined;
|
|
16
|
+
}) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAngularCoreImportsAsString = void 0;
|
|
4
|
+
const getAngularCoreImportsAsString = ({ refs, output, input, model, onPush, effect, signal, AfterViewInit, OnDestroy, computed, viewChild, viewContainerRef, templateRef, renderer, }) => {
|
|
5
|
+
const angularCoreImports = {
|
|
6
|
+
Component: true,
|
|
7
|
+
viewChild: refs || viewChild,
|
|
8
|
+
ElementRef: refs || viewChild,
|
|
9
|
+
ViewContainerRef: viewContainerRef,
|
|
10
|
+
TemplateRef: templateRef,
|
|
11
|
+
Renderer2: renderer,
|
|
12
|
+
model,
|
|
13
|
+
output,
|
|
14
|
+
input,
|
|
15
|
+
effect,
|
|
16
|
+
VERSION: effect,
|
|
17
|
+
signal,
|
|
18
|
+
computed,
|
|
19
|
+
ChangeDetectionStrategy: onPush,
|
|
20
|
+
OnDestroy,
|
|
21
|
+
AfterViewInit,
|
|
22
|
+
InputSignal: input,
|
|
23
|
+
ModelSignal: model,
|
|
24
|
+
};
|
|
25
|
+
return Object.entries(angularCoreImports)
|
|
26
|
+
.map(([key, bool]) => (bool ? key : ''))
|
|
27
|
+
.filter((key) => !!key)
|
|
28
|
+
.join(', ');
|
|
29
|
+
};
|
|
30
|
+
exports.getAngularCoreImportsAsString = getAngularCoreImportsAsString;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ToAngularOptions } from '../../../../generators/angular/types';
|
|
2
|
+
import { ProcessBindingOptions } from '../../../../helpers/class-components';
|
|
3
|
+
import { MitosisComponent } from '../../../../types/mitosis-component';
|
|
4
|
+
export declare const getCodeProcessorPlugins: (json: MitosisComponent, options: ToAngularOptions, processBindingOptions: ProcessBindingOptions) => import("../../../..").MitosisPlugin[];
|