@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,7 @@
|
|
|
1
|
+
import { AngularApi } from '../../../generators/angular/types';
|
|
2
|
+
import type { MitosisComponent } from '../../../types/mitosis-component';
|
|
3
|
+
export declare const getOutputs: ({ json, outputVars, api, }: {
|
|
4
|
+
json: MitosisComponent;
|
|
5
|
+
outputVars: string[];
|
|
6
|
+
api?: AngularApi | undefined;
|
|
7
|
+
}) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOutputs = void 0;
|
|
4
|
+
const event_handlers_1 = require("../../../helpers/event-handlers");
|
|
5
|
+
const getOutputs = ({ json, outputVars, api, }) => {
|
|
6
|
+
const propsTypeRef = json.propsTypeRef !== 'any' ? json.propsTypeRef : undefined;
|
|
7
|
+
if (api === 'signals') {
|
|
8
|
+
return outputVars
|
|
9
|
+
.map((output) => {
|
|
10
|
+
const propType = propsTypeRef
|
|
11
|
+
? `<Parameters<Required<${propsTypeRef}>["${output}"]>[number] | void> `
|
|
12
|
+
: '';
|
|
13
|
+
return `${(0, event_handlers_1.getEventNameWithoutOn)(output)} = output${propType}()`;
|
|
14
|
+
})
|
|
15
|
+
.join('\n');
|
|
16
|
+
}
|
|
17
|
+
return outputVars
|
|
18
|
+
.map((output) => {
|
|
19
|
+
return `@Output() ${output} = new EventEmitter<any>()`;
|
|
20
|
+
})
|
|
21
|
+
.join('\n');
|
|
22
|
+
};
|
|
23
|
+
exports.getOutputs = getOutputs;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ToAngularOptions } from '../../../generators/angular/types';
|
|
2
|
+
import { MitosisComponent } from '../../../types/mitosis-component';
|
|
3
|
+
export declare const getDomRefs: ({ json, options, withAttributePassing, rootRef, }: {
|
|
4
|
+
json: MitosisComponent;
|
|
5
|
+
options: ToAngularOptions;
|
|
6
|
+
withAttributePassing?: boolean | undefined;
|
|
7
|
+
rootRef: string;
|
|
8
|
+
}) => Set<string>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDomRefs = void 0;
|
|
4
|
+
const hooks_1 = require("../../../generators/angular/helpers/hooks");
|
|
5
|
+
const dash_case_1 = require("../../../helpers/dash-case");
|
|
6
|
+
const get_refs_1 = require("../../../helpers/get-refs");
|
|
7
|
+
const map_refs_1 = require("../../../helpers/map-refs");
|
|
8
|
+
const types_1 = require("@babel/types");
|
|
9
|
+
const getDomRefs = ({ json, options, withAttributePassing, rootRef, }) => {
|
|
10
|
+
const domRefs = (0, get_refs_1.getRefs)(json);
|
|
11
|
+
const nativeElement = options.api === 'signals' ? `()?.nativeElement` : '?.nativeElement';
|
|
12
|
+
if (withAttributePassing) {
|
|
13
|
+
if (!domRefs.has(rootRef)) {
|
|
14
|
+
domRefs.add(rootRef);
|
|
15
|
+
}
|
|
16
|
+
(0, hooks_1.addCodeNgAfterViewInit)(json, `
|
|
17
|
+
const element: HTMLElement | null = this.${rootRef}${nativeElement};
|
|
18
|
+
this.enableAttributePassing(element, "${(0, dash_case_1.dashCase)(json.name)}");
|
|
19
|
+
`);
|
|
20
|
+
}
|
|
21
|
+
(0, map_refs_1.mapRefs)(json, (refName, extra) => {
|
|
22
|
+
const isDomRef = domRefs.has(refName);
|
|
23
|
+
let additional = nativeElement;
|
|
24
|
+
if ((extra === null || extra === void 0 ? void 0 : extra.type) === 'bindings' && options.api === 'signals') {
|
|
25
|
+
// we don't need nativeElement and this. for bindings in signals
|
|
26
|
+
return refName;
|
|
27
|
+
}
|
|
28
|
+
else if ((extra === null || extra === void 0 ? void 0 : extra.type) === 'hooks-deps-array' && options.api === 'signals') {
|
|
29
|
+
// we don't need nativeElement for deps-array in hooks
|
|
30
|
+
additional = '()';
|
|
31
|
+
}
|
|
32
|
+
else if ((extra === null || extra === void 0 ? void 0 : extra.path.parentPath) && (0, types_1.isAssignmentExpression)(extra === null || extra === void 0 ? void 0 : extra.path.parentPath.container)) {
|
|
33
|
+
// we cannot use conditionals for assignments, it has to be checked before
|
|
34
|
+
additional = options.api === 'signals' ? `()!.nativeElement` : '!.nativeElement';
|
|
35
|
+
}
|
|
36
|
+
return `this.${isDomRef ? '' : '_'}${refName}${isDomRef ? additional : ''}`;
|
|
37
|
+
});
|
|
38
|
+
return domRefs;
|
|
39
|
+
};
|
|
40
|
+
exports.getDomRefs = getDomRefs;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ToAngularOptions } from '../../../generators/angular/types';
|
|
2
|
+
import { MitosisComponent } from '../../../types/mitosis-component';
|
|
3
|
+
export declare const getAngularStyles: ({ json, options, }: {
|
|
4
|
+
json: MitosisComponent;
|
|
5
|
+
options: ToAngularOptions;
|
|
6
|
+
}) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAngularStyles = void 0;
|
|
4
|
+
const format_1 = require("../../../generators/angular/helpers/format");
|
|
5
|
+
const index_1 = require("../../../generators/angular/helpers/index");
|
|
6
|
+
const indent_1 = require("../../../helpers/indent");
|
|
7
|
+
const collect_css_1 = require("../../../helpers/styles/collect-css");
|
|
8
|
+
const getAngularStyles = ({ json, options, }) => {
|
|
9
|
+
(0, index_1.preprocessCssAsJson)(json);
|
|
10
|
+
let css = (0, collect_css_1.collectCss)(json);
|
|
11
|
+
if (options.prettier !== false) {
|
|
12
|
+
css = (0, format_1.tryFormat)(css, 'css');
|
|
13
|
+
}
|
|
14
|
+
const hostDisplayCss = options.visuallyIgnoreHostElement ? ':host { display: contents; }' : '';
|
|
15
|
+
return (0, indent_1.indent)(css.length ? [hostDisplayCss, css].join('\n') : hostDisplayCss, 8);
|
|
16
|
+
};
|
|
17
|
+
exports.getAngularStyles = getAngularStyles;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MitosisComponent } from '../../../types/mitosis-component';
|
|
2
|
+
export declare const addCodeNgAfterViewInit: (json: MitosisComponent, code: string) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Adds code to the `onUpdate` hook of a MitosisComponent.
|
|
5
|
+
*
|
|
6
|
+
* @param {MitosisComponent} root - The root MitosisComponent.
|
|
7
|
+
* @param {string} code - The code to be added to the `onUpdate` hook.
|
|
8
|
+
*/
|
|
9
|
+
export declare const addCodeToOnUpdate: (root: MitosisComponent, code: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Adds code to the `onInit` hook of a MitosisComponent.
|
|
12
|
+
*
|
|
13
|
+
* @param {MitosisComponent} root - The root MitosisComponent.
|
|
14
|
+
* @param {string} code - The code to be added to the `onInit` hook.
|
|
15
|
+
*/
|
|
16
|
+
export declare const addCodeToOnInit: (root: MitosisComponent, code: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a reactive state in Angular.
|
|
19
|
+
* Initializes the state with `null` because we cannot access `state.` or `props.` properties before the component is initialized.
|
|
20
|
+
* Adds the code (init/re-init code) to the `onInit` and `onUpdate` hooks.
|
|
21
|
+
* @param root The root MitosisComponent.
|
|
22
|
+
* @param stateName The name of the reactive state.
|
|
23
|
+
* @param code The code to be added to the onInit and onUpdate hooks.
|
|
24
|
+
*/
|
|
25
|
+
export declare const makeReactiveState: (root: MitosisComponent, stateName: string, code: string) => void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeReactiveState = exports.addCodeToOnInit = exports.addCodeToOnUpdate = exports.addCodeNgAfterViewInit = void 0;
|
|
4
|
+
const addCodeNgAfterViewInit = (json, code) => {
|
|
5
|
+
if (!json.compileContext) {
|
|
6
|
+
json.compileContext = {
|
|
7
|
+
angular: {
|
|
8
|
+
hooks: {
|
|
9
|
+
ngAfterViewInit: {
|
|
10
|
+
code: '',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
json.compileContext.angular.hooks.ngAfterViewInit.code += code;
|
|
17
|
+
};
|
|
18
|
+
exports.addCodeNgAfterViewInit = addCodeNgAfterViewInit;
|
|
19
|
+
/**
|
|
20
|
+
* Adds code to the `onUpdate` hook of a MitosisComponent.
|
|
21
|
+
*
|
|
22
|
+
* @param {MitosisComponent} root - The root MitosisComponent.
|
|
23
|
+
* @param {string} code - The code to be added to the `onUpdate` hook.
|
|
24
|
+
*/
|
|
25
|
+
const addCodeToOnUpdate = (root, code) => {
|
|
26
|
+
root.hooks.onUpdate = root.hooks.onUpdate || [];
|
|
27
|
+
root.hooks.onUpdate.push({
|
|
28
|
+
code,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.addCodeToOnUpdate = addCodeToOnUpdate;
|
|
32
|
+
/**
|
|
33
|
+
* Adds code to the `onInit` hook of a MitosisComponent.
|
|
34
|
+
*
|
|
35
|
+
* @param {MitosisComponent} root - The root MitosisComponent.
|
|
36
|
+
* @param {string} code - The code to be added to the `onInit` hook.
|
|
37
|
+
*/
|
|
38
|
+
const addCodeToOnInit = (root, code) => {
|
|
39
|
+
var _a;
|
|
40
|
+
if (!((_a = root.hooks.onInit) === null || _a === void 0 ? void 0 : _a.code)) {
|
|
41
|
+
root.hooks.onInit = { code: '' };
|
|
42
|
+
}
|
|
43
|
+
root.hooks.onInit.code += `\n${code};`;
|
|
44
|
+
};
|
|
45
|
+
exports.addCodeToOnInit = addCodeToOnInit;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a reactive state in Angular.
|
|
48
|
+
* Initializes the state with `null` because we cannot access `state.` or `props.` properties before the component is initialized.
|
|
49
|
+
* Adds the code (init/re-init code) to the `onInit` and `onUpdate` hooks.
|
|
50
|
+
* @param root The root MitosisComponent.
|
|
51
|
+
* @param stateName The name of the reactive state.
|
|
52
|
+
* @param code The code to be added to the onInit and onUpdate hooks.
|
|
53
|
+
*/
|
|
54
|
+
const makeReactiveState = (root, stateName, code) => {
|
|
55
|
+
root.state[stateName] = { code: 'null', type: 'property' };
|
|
56
|
+
(0, exports.addCodeToOnInit)(root, code);
|
|
57
|
+
(0, exports.addCodeToOnUpdate)(root, code);
|
|
58
|
+
};
|
|
59
|
+
exports.makeReactiveState = makeReactiveState;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AngularBlockOptions, ToAngularOptions } from '../../../generators/angular/types';
|
|
2
|
+
import { type MitosisComponent } from '../../../types/mitosis-component';
|
|
3
|
+
import { MitosisNode } from '../../../types/mitosis-node';
|
|
4
|
+
export declare const HELPER_FUNCTIONS: (isTs?: boolean) => {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getAppropriateTemplateFunctionKeys: (code: string) => string[];
|
|
8
|
+
export declare const getDefaultProps: ({ defaultProps }: MitosisComponent) => string;
|
|
9
|
+
/**
|
|
10
|
+
* if any state "property" is trying to access state.* or props.*
|
|
11
|
+
* then we need to move them to onInit where they can be accessed
|
|
12
|
+
* @param json The MitosisComponent.
|
|
13
|
+
*/
|
|
14
|
+
export declare const transformState: (json: MitosisComponent) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Checks if the first child has a "key" attribute - used for "For" elements
|
|
17
|
+
* @param node The node which should be "For"
|
|
18
|
+
*/
|
|
19
|
+
export declare const hasFirstChildKeyAttribute: (node: MitosisNode) => boolean;
|
|
20
|
+
export declare const preprocessCssAsJson: (json: MitosisComponent) => void;
|
|
21
|
+
export declare const generateNgModule: (content: string, name: string, componentsUsed: string[], component: MitosisComponent, bootstrapMapper: Function | null | undefined) => string;
|
|
22
|
+
export declare const traverseToGetAllDynamicComponents: (json: MitosisComponent, options: ToAngularOptions, blockOptions: AngularBlockOptions, api?: 'signals' | 'classic') => {
|
|
23
|
+
components: Set<string>;
|
|
24
|
+
dynamicTemplate: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const getTemplateFormat: (template: string) => string;
|
|
27
|
+
export declare const traverseAndCheckIfInnerHTMLIsUsed: (json: MitosisComponent) => boolean;
|
|
28
|
+
export declare const processAngularCode: ({ contextVars, outputVars, domRefs, replaceWith, }: {
|
|
29
|
+
contextVars: string[];
|
|
30
|
+
outputVars: string[];
|
|
31
|
+
domRefs: string[];
|
|
32
|
+
replaceWith?: string | undefined;
|
|
33
|
+
}) => (code: string) => string;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.processAngularCode = exports.traverseAndCheckIfInnerHTMLIsUsed = exports.getTemplateFormat = exports.traverseToGetAllDynamicComponents = exports.generateNgModule = exports.preprocessCssAsJson = exports.hasFirstChildKeyAttribute = exports.transformState = exports.getDefaultProps = exports.getAppropriateTemplateFunctionKeys = exports.HELPER_FUNCTIONS = void 0;
|
|
30
|
+
const blocks_1 = require("../../../generators/angular/classic/blocks");
|
|
31
|
+
const indent_1 = require("../../../helpers/indent");
|
|
32
|
+
const is_mitosis_node_1 = require("../../../helpers/is-mitosis-node");
|
|
33
|
+
const replace_identifiers_1 = require("../../../helpers/replace-identifiers");
|
|
34
|
+
const strip_state_and_props_refs_1 = require("../../../helpers/strip-state-and-props-refs");
|
|
35
|
+
const helpers_1 = require("../../../helpers/styles/helpers");
|
|
36
|
+
const babel = __importStar(require("@babel/core"));
|
|
37
|
+
const function_1 = require("fp-ts/function");
|
|
38
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
39
|
+
const blocks_2 = require("../signals/blocks");
|
|
40
|
+
const HELPER_FUNCTIONS = (isTs) => ({
|
|
41
|
+
useObjectWrapper: `useObjectWrapper(...args${isTs ? ': any[]' : ''}) {
|
|
42
|
+
let obj = {}
|
|
43
|
+
args.forEach((arg) => {
|
|
44
|
+
obj = { ...obj, ...arg };
|
|
45
|
+
});
|
|
46
|
+
return obj;
|
|
47
|
+
}`,
|
|
48
|
+
useObjectDotValues: `useObjectDotValues(obj${isTs ? ': any' : ''})${isTs ? ': any[]' : ''}) {
|
|
49
|
+
return Object.values(obj);
|
|
50
|
+
}`,
|
|
51
|
+
useTypeOf: `useTypeOf(obj${isTs ? ': any' : ''})${isTs ? ': string' : ''}) {
|
|
52
|
+
return typeof obj;
|
|
53
|
+
}`,
|
|
54
|
+
useJsonStringify: `useJsonStringify(...args${isTs ? ': any' : ''})${isTs ? ': string' : ''}) {
|
|
55
|
+
return JSON.stringify(...args);
|
|
56
|
+
}`,
|
|
57
|
+
setAttributes: `setAttributes(el${isTs ? ': HTMLElement' : ''}, value${isTs ? ': any' : ''}, changes${isTs ? '?: any' : ''}) {
|
|
58
|
+
if (!el) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const target = typeof changes === 'undefined' ? value : changes;
|
|
62
|
+
Object.keys(target).forEach((key) => {
|
|
63
|
+
if (key.startsWith('on')) {
|
|
64
|
+
if (this._listenerFns.has(key)) {
|
|
65
|
+
this._listenerFns.get(key)${isTs ? '!' : ''}();
|
|
66
|
+
}
|
|
67
|
+
this._listenerFns.set(key, this.renderer.listen(
|
|
68
|
+
el,
|
|
69
|
+
key.replace('on', '').toLowerCase(),
|
|
70
|
+
target[key]
|
|
71
|
+
));
|
|
72
|
+
} else {
|
|
73
|
+
this.renderer.setAttribute(el, key.toLowerCase(), target[key] ?? '');
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}`,
|
|
77
|
+
});
|
|
78
|
+
exports.HELPER_FUNCTIONS = HELPER_FUNCTIONS;
|
|
79
|
+
const getAppropriateTemplateFunctionKeys = (code) => Object.keys((0, exports.HELPER_FUNCTIONS)()).filter((key) => code.includes(key));
|
|
80
|
+
exports.getAppropriateTemplateFunctionKeys = getAppropriateTemplateFunctionKeys;
|
|
81
|
+
const getDefaultProps = ({ defaultProps }) => {
|
|
82
|
+
if (!defaultProps)
|
|
83
|
+
return '';
|
|
84
|
+
const defalutPropsString = Object.keys(defaultProps)
|
|
85
|
+
.map((prop) => {
|
|
86
|
+
var _a;
|
|
87
|
+
const value = defaultProps.hasOwnProperty(prop) ? (_a = defaultProps[prop]) === null || _a === void 0 ? void 0 : _a.code : 'undefined';
|
|
88
|
+
return `${prop}: ${value}`;
|
|
89
|
+
})
|
|
90
|
+
.join(',');
|
|
91
|
+
return `const defaultProps: any = {${defalutPropsString}};\n`;
|
|
92
|
+
};
|
|
93
|
+
exports.getDefaultProps = getDefaultProps;
|
|
94
|
+
/**
|
|
95
|
+
* if any state "property" is trying to access state.* or props.*
|
|
96
|
+
* then we need to move them to onInit where they can be accessed
|
|
97
|
+
* @param json The MitosisComponent.
|
|
98
|
+
*/
|
|
99
|
+
const transformState = (json) => {
|
|
100
|
+
Object.entries(json.state)
|
|
101
|
+
.reverse()
|
|
102
|
+
.forEach(([key, value]) => {
|
|
103
|
+
var _a;
|
|
104
|
+
if ((value === null || value === void 0 ? void 0 : value.type) === 'property') {
|
|
105
|
+
if (value.code && (value.code.includes('state.') || value.code.includes('props.'))) {
|
|
106
|
+
const code = (0, strip_state_and_props_refs_1.stripStateAndPropsRefs)(value.code, { replaceWith: 'this' });
|
|
107
|
+
json.state[key].code = 'null';
|
|
108
|
+
if (!((_a = json.hooks.onInit) === null || _a === void 0 ? void 0 : _a.code)) {
|
|
109
|
+
json.hooks.onInit = { code: '' };
|
|
110
|
+
}
|
|
111
|
+
json.hooks.onInit.code = `\nthis.${key} = ${code};\n${json.hooks.onInit.code}`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
exports.transformState = transformState;
|
|
117
|
+
/**
|
|
118
|
+
* Checks if the first child has a "key" attribute - used for "For" elements
|
|
119
|
+
* @param node The node which should be "For"
|
|
120
|
+
*/
|
|
121
|
+
const hasFirstChildKeyAttribute = (node) => {
|
|
122
|
+
var _a;
|
|
123
|
+
if (!node.children || node.children.length === 0) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
const firstChildBinding = node.children[0].bindings;
|
|
127
|
+
return Boolean(firstChildBinding && ((_a = firstChildBinding.key) === null || _a === void 0 ? void 0 : _a.code));
|
|
128
|
+
};
|
|
129
|
+
exports.hasFirstChildKeyAttribute = hasFirstChildKeyAttribute;
|
|
130
|
+
const preprocessCssAsJson = (json) => {
|
|
131
|
+
(0, legacy_1.default)(json).forEach((item) => {
|
|
132
|
+
var _a, _b;
|
|
133
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
134
|
+
if ((0, helpers_1.nodeHasCss)(item)) {
|
|
135
|
+
if ((_b = (_a = item.bindings.css) === null || _a === void 0 ? void 0 : _a.code) === null || _b === void 0 ? void 0 : _b.includes('"')) {
|
|
136
|
+
item.bindings.css.code = item.bindings.css.code.replace(/"/g, '"');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
exports.preprocessCssAsJson = preprocessCssAsJson;
|
|
143
|
+
const generateNgModule = (content, name, componentsUsed, component, bootstrapMapper) => {
|
|
144
|
+
return `import { NgModule } from "@angular/core";
|
|
145
|
+
import { CommonModule } from "@angular/common";
|
|
146
|
+
|
|
147
|
+
${content}
|
|
148
|
+
|
|
149
|
+
@NgModule({
|
|
150
|
+
declarations: [${name}],
|
|
151
|
+
imports: [CommonModule${componentsUsed.length ? ', ' + componentsUsed.map((comp) => `${comp}Module`).join(', ') : ''}],
|
|
152
|
+
exports: [${name}],
|
|
153
|
+
${bootstrapMapper ? bootstrapMapper(name, componentsUsed, component) : ''}
|
|
154
|
+
})
|
|
155
|
+
export class ${name}Module {}`;
|
|
156
|
+
};
|
|
157
|
+
exports.generateNgModule = generateNgModule;
|
|
158
|
+
const traverseToGetAllDynamicComponents = (json, options, blockOptions, api = 'classic') => {
|
|
159
|
+
const components = new Set();
|
|
160
|
+
let dynamicTemplate = '';
|
|
161
|
+
(0, legacy_1.default)(json).forEach((item) => {
|
|
162
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item) && item.name.includes('.')) {
|
|
163
|
+
const children = item.children
|
|
164
|
+
.map((child) => api === 'classic'
|
|
165
|
+
? (0, blocks_1.blockToAngular)({ root: json, json: child, options, blockOptions })
|
|
166
|
+
: (0, blocks_2.blockToAngularSignals)({ root: json, json: child, options, blockOptions }))
|
|
167
|
+
.join('\n');
|
|
168
|
+
dynamicTemplate = `<ng-template #${item.name.split('.')[1].toLowerCase() + 'Template'}>${children}</ng-template>`;
|
|
169
|
+
components.add(item.name);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
components,
|
|
174
|
+
dynamicTemplate,
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
exports.traverseToGetAllDynamicComponents = traverseToGetAllDynamicComponents;
|
|
178
|
+
const getTemplateFormat = (template) => (0, indent_1.indent)(template, 8).replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
|
|
179
|
+
exports.getTemplateFormat = getTemplateFormat;
|
|
180
|
+
const traverseAndCheckIfInnerHTMLIsUsed = (json) => {
|
|
181
|
+
let innerHTMLIsUsed = false;
|
|
182
|
+
(0, legacy_1.default)(json).forEach((item) => {
|
|
183
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
184
|
+
Object.keys(item.bindings).forEach((key) => {
|
|
185
|
+
if (key === 'innerHTML') {
|
|
186
|
+
innerHTMLIsUsed = true;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return innerHTMLIsUsed;
|
|
193
|
+
};
|
|
194
|
+
exports.traverseAndCheckIfInnerHTMLIsUsed = traverseAndCheckIfInnerHTMLIsUsed;
|
|
195
|
+
const { types } = babel;
|
|
196
|
+
/**
|
|
197
|
+
* Prefixes state identifiers with this.
|
|
198
|
+
* e.g. state.foo --> this.foo
|
|
199
|
+
*/
|
|
200
|
+
const prefixState = (code) => {
|
|
201
|
+
return (0, replace_identifiers_1.replaceNodes)({
|
|
202
|
+
code,
|
|
203
|
+
nodeMaps: [
|
|
204
|
+
{
|
|
205
|
+
from: types.identifier('state'),
|
|
206
|
+
to: types.thisExpression(),
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
}).trim();
|
|
210
|
+
};
|
|
211
|
+
const processAngularCode = ({ contextVars, outputVars, domRefs, replaceWith, }) => (code) => (0, function_1.pipe)((0, strip_state_and_props_refs_1.DO_NOT_USE_VARS_TRANSFORMS)(code, {
|
|
212
|
+
contextVars,
|
|
213
|
+
domRefs,
|
|
214
|
+
outputVars,
|
|
215
|
+
}),
|
|
216
|
+
/**
|
|
217
|
+
* Only prefix state that is in the Angular class component.
|
|
218
|
+
* Do not prefix state referenced in the template
|
|
219
|
+
*/
|
|
220
|
+
replaceWith === 'this' ? prefixState : (x) => x, (newCode) => (0, strip_state_and_props_refs_1.stripStateAndPropsRefs)(newCode, { replaceWith }));
|
|
221
|
+
exports.processAngularCode = processAngularCode;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSelector = void 0;
|
|
4
|
+
const compiler_1 = require("@angular/compiler");
|
|
5
|
+
function parseSelector(selector) {
|
|
6
|
+
const { element, classNames, attrs } = compiler_1.CssSelector.parse(selector)[0];
|
|
7
|
+
const attributes = attrs.reduce((acc, attr, i) => {
|
|
8
|
+
if (i % 2 === 0) {
|
|
9
|
+
acc[attr] = attrs[i + 1];
|
|
10
|
+
}
|
|
11
|
+
return acc;
|
|
12
|
+
}, {});
|
|
13
|
+
return {
|
|
14
|
+
element,
|
|
15
|
+
classNames,
|
|
16
|
+
attributes,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.parseSelector = parseSelector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./component"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AngularBlockOptions, ToAngularOptions } from '../../../generators/angular/types';
|
|
2
|
+
import { MitosisComponent } from '../../../types/mitosis-component';
|
|
3
|
+
import { MitosisNode } from '../../../types/mitosis-node';
|
|
4
|
+
export declare const blockToAngularSignals: ({ root, json, options, blockOptions, rootRef, }: {
|
|
5
|
+
root: MitosisComponent;
|
|
6
|
+
json: MitosisNode;
|
|
7
|
+
options?: ToAngularOptions | undefined;
|
|
8
|
+
rootRef?: string | undefined;
|
|
9
|
+
blockOptions?: AngularBlockOptions | undefined;
|
|
10
|
+
}) => string;
|