@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,9 @@
|
|
|
1
|
+
import { ToStencilOptions } from '../../generators/stencil/types';
|
|
2
|
+
import { MitosisNode } from '../../types/mitosis-node';
|
|
3
|
+
export declare const blockToStencil: ({ json, options, insideJsx, rootRef, childComponents, }: {
|
|
4
|
+
json: MitosisNode;
|
|
5
|
+
options: ToStencilOptions;
|
|
6
|
+
insideJsx?: boolean | undefined;
|
|
7
|
+
rootRef?: string | undefined;
|
|
8
|
+
childComponents: string[];
|
|
9
|
+
}) => string;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.blockToStencil = void 0;
|
|
4
|
+
const html_tags_1 = require("../../constants/html_tags");
|
|
5
|
+
const helpers_1 = require("../../generators/stencil/helpers");
|
|
6
|
+
const collect_class_string_1 = require("../../generators/stencil/helpers/collect-class-string");
|
|
7
|
+
const event_handlers_1 = require("../../helpers/event-handlers");
|
|
8
|
+
const filter_empty_text_nodes_1 = require("../../helpers/filter-empty-text-nodes");
|
|
9
|
+
const for_1 = require("../../helpers/nodes/for");
|
|
10
|
+
const transform_to_jsx_1 = require("../../helpers/transform-to-jsx");
|
|
11
|
+
const mitosis_node_1 = require("../../types/mitosis-node");
|
|
12
|
+
const blockToStencil = ({ json, options = {}, insideJsx, rootRef, childComponents, }) => {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
14
|
+
let blockName = childComponents.find((impName) => impName === json.name)
|
|
15
|
+
? (0, helpers_1.getTagName)(json.name, options)
|
|
16
|
+
: json.name;
|
|
17
|
+
if (json.properties._text) {
|
|
18
|
+
return json.properties._text;
|
|
19
|
+
}
|
|
20
|
+
if ((_a = json.bindings._text) === null || _a === void 0 ? void 0 : _a.code) {
|
|
21
|
+
if (((_b = json.bindings._text) === null || _b === void 0 ? void 0 : _b.code) === 'this.children') {
|
|
22
|
+
// Replace this.children with default <slot>
|
|
23
|
+
return '<slot></slot>';
|
|
24
|
+
}
|
|
25
|
+
let code = json.bindings._text.code;
|
|
26
|
+
if (insideJsx) {
|
|
27
|
+
return `{${code}}`;
|
|
28
|
+
}
|
|
29
|
+
return code;
|
|
30
|
+
}
|
|
31
|
+
if ((0, mitosis_node_1.checkIsForNode)(json) && ((_c = json.bindings.each) === null || _c === void 0 ? void 0 : _c.code)) {
|
|
32
|
+
const wrap = json.children.length !== 1;
|
|
33
|
+
const forArgs = (0, for_1.getForArguments)(json).join(', ');
|
|
34
|
+
const expression = `${(_d = json.bindings.each) === null || _d === void 0 ? void 0 : _d.code}?.map((${forArgs}) => (
|
|
35
|
+
${wrap ? '<Fragment>' : ''}
|
|
36
|
+
${json.children
|
|
37
|
+
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
38
|
+
.map((item) => (0, exports.blockToStencil)({ json: item, options, insideJsx: wrap, childComponents }))
|
|
39
|
+
.join('\n')}
|
|
40
|
+
${wrap ? '</Fragment>' : ''}
|
|
41
|
+
))`;
|
|
42
|
+
if (insideJsx) {
|
|
43
|
+
return `{${expression}}`;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return expression;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (blockName === 'Show' && ((_e = json.bindings.when) === null || _e === void 0 ? void 0 : _e.code)) {
|
|
50
|
+
const wrap = json.children.length !== 1;
|
|
51
|
+
const expression = `${(_f = json.bindings.when) === null || _f === void 0 ? void 0 : _f.code} ? (
|
|
52
|
+
${wrap ? '<Fragment>' : ''}
|
|
53
|
+
${json.children
|
|
54
|
+
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
55
|
+
.map((item) => (0, exports.blockToStencil)({ json: item, options, insideJsx: wrap, childComponents }))
|
|
56
|
+
.join('\n')}
|
|
57
|
+
${wrap ? '</Fragment>' : ''}
|
|
58
|
+
) : ${!json.meta.else
|
|
59
|
+
? 'null'
|
|
60
|
+
: `(${(0, exports.blockToStencil)({
|
|
61
|
+
json: json.meta.else,
|
|
62
|
+
options,
|
|
63
|
+
childComponents,
|
|
64
|
+
})})`}`;
|
|
65
|
+
if (insideJsx) {
|
|
66
|
+
return `{${expression}}`;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return expression;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (blockName === 'Slot') {
|
|
73
|
+
blockName = 'slot';
|
|
74
|
+
}
|
|
75
|
+
let str = '';
|
|
76
|
+
str += `<${blockName} `;
|
|
77
|
+
const classString = (0, collect_class_string_1.collectClassString)(json);
|
|
78
|
+
if (classString) {
|
|
79
|
+
str += ` class=${classString} `;
|
|
80
|
+
}
|
|
81
|
+
for (const key in json.properties) {
|
|
82
|
+
const value = json.properties[key];
|
|
83
|
+
// Stencil uses ´htmlFor´ (JSX) instead of ´for´ (HTML)
|
|
84
|
+
str += ` ${(0, transform_to_jsx_1.transformAttributeToJSX)(key)}="${value}" `;
|
|
85
|
+
}
|
|
86
|
+
for (const key in json.bindings) {
|
|
87
|
+
const { code, arguments: cusArgs = [], type } = json.bindings[key];
|
|
88
|
+
if (type === 'spread') {
|
|
89
|
+
str += ` {...(${code})} `;
|
|
90
|
+
}
|
|
91
|
+
else if (key === 'ref') {
|
|
92
|
+
str += ` ref={(el:any) => {
|
|
93
|
+
${rootRef ? `this.${rootRef} = el` : ''}
|
|
94
|
+
${code.startsWith('this.') ? code : `this.${code}`} = el}
|
|
95
|
+
} `;
|
|
96
|
+
}
|
|
97
|
+
else if ((0, event_handlers_1.checkIsEvent)(key)) {
|
|
98
|
+
const asyncKeyword = ((_g = json.bindings[key]) === null || _g === void 0 ? void 0 : _g.async) ? 'async ' : '';
|
|
99
|
+
str += ` ${key}={${asyncKeyword}(${cusArgs.join(',')}) => ${code}} `;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
str += ` ${key}={${code}} `;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (html_tags_1.SELF_CLOSING_HTML_TAGS.has(blockName)) {
|
|
106
|
+
return str + ' />';
|
|
107
|
+
}
|
|
108
|
+
str += '>';
|
|
109
|
+
if (json.children) {
|
|
110
|
+
str += json.children
|
|
111
|
+
.map((item) => (0, exports.blockToStencil)({
|
|
112
|
+
json: item,
|
|
113
|
+
options,
|
|
114
|
+
insideJsx: true,
|
|
115
|
+
childComponents,
|
|
116
|
+
}))
|
|
117
|
+
.join('\n');
|
|
118
|
+
}
|
|
119
|
+
str += `</${blockName}>`;
|
|
120
|
+
return str;
|
|
121
|
+
};
|
|
122
|
+
exports.blockToStencil = blockToStencil;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentToStencil = void 0;
|
|
4
|
+
const on_mount_1 = require("../../generators/helpers/on-mount");
|
|
5
|
+
const blocks_1 = require("../../generators/stencil/blocks");
|
|
6
|
+
const helpers_1 = require("../../generators/stencil/helpers");
|
|
7
|
+
const get_code_processor_plugins_1 = require("../../generators/stencil/plugins/get-code-processor-plugins");
|
|
8
|
+
const dash_case_1 = require("../../helpers/dash-case");
|
|
9
|
+
const dedent_1 = require("../../helpers/dedent");
|
|
10
|
+
const event_handlers_1 = require("../../helpers/event-handlers");
|
|
11
|
+
const fast_clone_1 = require("../../helpers/fast-clone");
|
|
12
|
+
const get_child_components_1 = require("../../helpers/get-child-components");
|
|
13
|
+
const get_props_1 = require("../../helpers/get-props");
|
|
14
|
+
const get_state_object_string_1 = require("../../helpers/get-state-object-string");
|
|
15
|
+
const indent_1 = require("../../helpers/indent");
|
|
16
|
+
const map_refs_1 = require("../../helpers/map-refs");
|
|
17
|
+
const merge_options_1 = require("../../helpers/merge-options");
|
|
18
|
+
const strip_meta_properties_1 = require("../../helpers/strip-meta-properties");
|
|
19
|
+
const collect_css_1 = require("../../helpers/styles/collect-css");
|
|
20
|
+
const attribute_passing_1 = require("../../helpers/web-components/attribute-passing");
|
|
21
|
+
const plugins_1 = require("../../modules/plugins");
|
|
22
|
+
const standalone_1 = require("prettier/standalone");
|
|
23
|
+
const componentToStencil = (_options = {
|
|
24
|
+
typescript: true, // Stencil is uses .tsx always
|
|
25
|
+
}) => {
|
|
26
|
+
return ({ component }) => {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
28
|
+
let json = (0, fast_clone_1.fastClone)(component);
|
|
29
|
+
const options = (0, merge_options_1.initializeOptions)({
|
|
30
|
+
target: 'stencil',
|
|
31
|
+
component,
|
|
32
|
+
defaults: _options,
|
|
33
|
+
});
|
|
34
|
+
if (options.plugins) {
|
|
35
|
+
json = (0, plugins_1.runPreJsonPlugins)({ json, plugins: options.plugins });
|
|
36
|
+
}
|
|
37
|
+
(0, map_refs_1.mapRefs)(json, (refName) => `this.${refName}`);
|
|
38
|
+
let css = (0, collect_css_1.collectCss)(json);
|
|
39
|
+
let props = Array.from((0, get_props_1.getProps)(json));
|
|
40
|
+
const events = props.filter((prop) => (0, event_handlers_1.checkIsEvent)(prop));
|
|
41
|
+
const defaultProps = json.defaultProps;
|
|
42
|
+
const childComponents = (0, get_child_components_1.getChildComponents)(json);
|
|
43
|
+
props = props.filter((prop) => {
|
|
44
|
+
// Stencil doesn't need children as a prop
|
|
45
|
+
return prop !== 'children';
|
|
46
|
+
});
|
|
47
|
+
const processBindingOptions = { events, props, target: 'stencil' };
|
|
48
|
+
options.plugins = (0, get_code_processor_plugins_1.getCodeProcessorPlugins)(json, options, processBindingOptions);
|
|
49
|
+
if (options.plugins) {
|
|
50
|
+
json = (0, plugins_1.runPostJsonPlugins)({ json, plugins: options.plugins });
|
|
51
|
+
}
|
|
52
|
+
(0, strip_meta_properties_1.stripMetaProperties)(json);
|
|
53
|
+
const dataString = (0, get_state_object_string_1.getStateObjectStringFromComponent)(json, {
|
|
54
|
+
format: 'class',
|
|
55
|
+
data: true,
|
|
56
|
+
functions: false,
|
|
57
|
+
getters: false,
|
|
58
|
+
keyPrefix: '@State() ',
|
|
59
|
+
});
|
|
60
|
+
const methodsString = (0, get_state_object_string_1.getStateObjectStringFromComponent)(json, {
|
|
61
|
+
format: 'class',
|
|
62
|
+
data: false,
|
|
63
|
+
functions: true,
|
|
64
|
+
getters: true,
|
|
65
|
+
});
|
|
66
|
+
let refs = json.refs
|
|
67
|
+
? Object.entries(json.refs)
|
|
68
|
+
.map(([key, value]) => { var _a; return `private ${key}!: ${(_a = value.typeParameter) !== null && _a !== void 0 ? _a : 'HTMLElement'};`; })
|
|
69
|
+
.join('\n')
|
|
70
|
+
: '';
|
|
71
|
+
const wrap = (0, helpers_1.needsWrap)(json.children);
|
|
72
|
+
const withAttributePassing = !wrap && (0, attribute_passing_1.shouldAddAttributePassing)(json, options);
|
|
73
|
+
const rootRef = (0, attribute_passing_1.getAddAttributePassingRef)(json, options);
|
|
74
|
+
if (withAttributePassing && !refs.includes(rootRef)) {
|
|
75
|
+
refs += `\nprivate ${rootRef}!: HTMLElement;`;
|
|
76
|
+
}
|
|
77
|
+
if (options.prettier !== false) {
|
|
78
|
+
try {
|
|
79
|
+
css = (0, standalone_1.format)(css, {
|
|
80
|
+
parser: 'css',
|
|
81
|
+
plugins: [require('prettier/parser-postcss')],
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
console.warn('Could not format css', err);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
let tagName = (0, helpers_1.getTagName)(json.name, options);
|
|
89
|
+
if ((_a = json.meta.useMetadata) === null || _a === void 0 ? void 0 : _a.tagName) {
|
|
90
|
+
// Deprecated option, we shouldn't use this, instead change the name of your Mitosis component
|
|
91
|
+
tagName = (_b = json.meta.useMetadata) === null || _b === void 0 ? void 0 : _b.tagName;
|
|
92
|
+
}
|
|
93
|
+
const noDependencyOnUpdateHooks = (_d = (_c = json.hooks.onUpdate) === null || _c === void 0 ? void 0 : _c.filter((hook) => !hook.deps)) !== null && _d !== void 0 ? _d : [];
|
|
94
|
+
/*
|
|
95
|
+
* We want to create a function for every onUpdate hook that has dependencies.
|
|
96
|
+
* We call the function once in "componentDidLoad"
|
|
97
|
+
* And we create "Watch" decorators for every dependency
|
|
98
|
+
*/
|
|
99
|
+
const dependencyOnUpdateHooks = (_f = (_e = json.hooks.onUpdate) === null || _e === void 0 ? void 0 : _e.filter((hook) => hook.deps)) !== null && _f !== void 0 ? _f : [];
|
|
100
|
+
const coreImports = (0, helpers_1.getStencilCoreImportsAsString)({
|
|
101
|
+
wrap,
|
|
102
|
+
events,
|
|
103
|
+
props,
|
|
104
|
+
dataString,
|
|
105
|
+
watch: Boolean(dependencyOnUpdateHooks === null || dependencyOnUpdateHooks === void 0 ? void 0 : dependencyOnUpdateHooks.length),
|
|
106
|
+
});
|
|
107
|
+
const propOptions = {
|
|
108
|
+
...options.propOptions,
|
|
109
|
+
...(_h = (_g = json.meta.useMetadata) === null || _g === void 0 ? void 0 : _g.stencil) === null || _h === void 0 ? void 0 : _h.propOptions,
|
|
110
|
+
};
|
|
111
|
+
let str = (0, dedent_1.dedent) `
|
|
112
|
+
${(0, helpers_1.getImports)(json, options, childComponents)}
|
|
113
|
+
|
|
114
|
+
import { ${coreImports} } from '@stencil/core';
|
|
115
|
+
|
|
116
|
+
@Component({
|
|
117
|
+
tag: '${tagName}',
|
|
118
|
+
${((_j = json.meta.useMetadata) === null || _j === void 0 ? void 0 : _j.isAttachedToShadowDom) ? 'shadow: true,' : ''}
|
|
119
|
+
${css.length
|
|
120
|
+
? `styles: \`
|
|
121
|
+
${(0, indent_1.indent)(css, 8)}\`,`
|
|
122
|
+
: ''}
|
|
123
|
+
})
|
|
124
|
+
export class ${json.name} {
|
|
125
|
+
${refs}
|
|
126
|
+
${(0, helpers_1.getPropsAsCode)({ props, json, defaultProps, propOptions })}
|
|
127
|
+
${dataString}
|
|
128
|
+
${methodsString}
|
|
129
|
+
${(0, helpers_1.getExportsAndLocal)(json)}
|
|
130
|
+
${withAttributePassing ? (0, attribute_passing_1.getAttributePassingString)(true) : ''}
|
|
131
|
+
|
|
132
|
+
${dependencyOnUpdateHooks
|
|
133
|
+
.map((hook, index) => {
|
|
134
|
+
return `
|
|
135
|
+
watch${index}Fn() {
|
|
136
|
+
${hook.code}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
${(0, helpers_1.getDepsAsArray)(hook.deps)
|
|
140
|
+
.map((dep) => `@Watch("${dep}")`)
|
|
141
|
+
.join('\n')}
|
|
142
|
+
watch${index}(){
|
|
143
|
+
this.watch${index}Fn();
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
})
|
|
147
|
+
.join('\n')}
|
|
148
|
+
|
|
149
|
+
${`componentDidLoad() {
|
|
150
|
+
${withAttributePassing
|
|
151
|
+
? `this.enableAttributePassing(this.${rootRef}, "${(0, dash_case_1.dashCase)(json.name)}");`
|
|
152
|
+
: ''}
|
|
153
|
+
${json.hooks.onMount.length ? (0, on_mount_1.stringifySingleScopeOnMount)(json) : ''}
|
|
154
|
+
${dependencyOnUpdateHooks
|
|
155
|
+
.map((_, index) => `this.watch${index}Fn();`)
|
|
156
|
+
.join('\n')}
|
|
157
|
+
}`}
|
|
158
|
+
${!((_k = json.hooks.onUnMount) === null || _k === void 0 ? void 0 : _k.code)
|
|
159
|
+
? ''
|
|
160
|
+
: `disconnectedCallback() { ${json.hooks.onUnMount.code} }`}
|
|
161
|
+
${noDependencyOnUpdateHooks.length
|
|
162
|
+
? `componentDidUpdate() { ${noDependencyOnUpdateHooks
|
|
163
|
+
.map((hook) => hook.code)
|
|
164
|
+
.join('\n')} }`
|
|
165
|
+
: ''}
|
|
166
|
+
|
|
167
|
+
render() {
|
|
168
|
+
return (${wrap ? '<Host>' : ''}
|
|
169
|
+
|
|
170
|
+
${json.children
|
|
171
|
+
.map((item) => (0, blocks_1.blockToStencil)({
|
|
172
|
+
json: item,
|
|
173
|
+
options,
|
|
174
|
+
insideJsx: true,
|
|
175
|
+
childComponents,
|
|
176
|
+
rootRef: withAttributePassing && rootRef === attribute_passing_1.ROOT_REF ? rootRef : undefined, // only pass rootRef if it's not the default
|
|
177
|
+
}))
|
|
178
|
+
.join('\n')}
|
|
179
|
+
|
|
180
|
+
${wrap ? '</Host>' : ''})
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
184
|
+
if (options.plugins) {
|
|
185
|
+
str = (0, plugins_1.runPreCodePlugins)({ json, code: str, plugins: options.plugins });
|
|
186
|
+
}
|
|
187
|
+
if (options.prettier !== false) {
|
|
188
|
+
str = (0, standalone_1.format)(str, {
|
|
189
|
+
parser: 'typescript',
|
|
190
|
+
plugins: [require('prettier/parser-typescript')],
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (options.plugins) {
|
|
194
|
+
str = (0, plugins_1.runPostCodePlugins)({ json, code: str, plugins: options.plugins });
|
|
195
|
+
}
|
|
196
|
+
return str;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
exports.componentToStencil = componentToStencil;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collectClassString = void 0;
|
|
4
|
+
const bindingOpenChar = '{';
|
|
5
|
+
const bindingCloseChar = '}';
|
|
6
|
+
// This should really be a preprocessor mapping the `class` attribute binding based on what other values have
|
|
7
|
+
// to make this more pluggable
|
|
8
|
+
const collectClassString = (json) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const staticClasses = [];
|
|
11
|
+
if (json.properties.class) {
|
|
12
|
+
staticClasses.push(json.properties.class);
|
|
13
|
+
delete json.properties.class;
|
|
14
|
+
}
|
|
15
|
+
if (json.properties.className) {
|
|
16
|
+
staticClasses.push(json.properties.className);
|
|
17
|
+
delete json.properties.className;
|
|
18
|
+
}
|
|
19
|
+
const dynamicClasses = [];
|
|
20
|
+
if (typeof ((_a = json.bindings.class) === null || _a === void 0 ? void 0 : _a.code) === 'string') {
|
|
21
|
+
dynamicClasses.push(json.bindings.class.code);
|
|
22
|
+
delete json.bindings.class;
|
|
23
|
+
}
|
|
24
|
+
if (typeof ((_b = json.bindings.className) === null || _b === void 0 ? void 0 : _b.code) === 'string') {
|
|
25
|
+
dynamicClasses.push(json.bindings.className.code);
|
|
26
|
+
delete json.bindings.className;
|
|
27
|
+
}
|
|
28
|
+
const staticClassesString = staticClasses.join(' ');
|
|
29
|
+
const dynamicClassesString = dynamicClasses.join(" + ' ' + ");
|
|
30
|
+
const hasStaticClasses = Boolean(staticClasses.length);
|
|
31
|
+
const hasDynamicClasses = Boolean(dynamicClasses.length);
|
|
32
|
+
if (hasStaticClasses && !hasDynamicClasses) {
|
|
33
|
+
return `"${staticClassesString}"`;
|
|
34
|
+
}
|
|
35
|
+
if (hasDynamicClasses && !hasStaticClasses) {
|
|
36
|
+
return `${bindingOpenChar}${dynamicClassesString}${bindingCloseChar}`;
|
|
37
|
+
}
|
|
38
|
+
if (hasDynamicClasses && hasStaticClasses) {
|
|
39
|
+
return `${bindingOpenChar}"${staticClassesString} " + ${dynamicClassesString}${bindingCloseChar}`;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
exports.collectClassString = collectClassString;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { StencilPropOption, ToStencilOptions } from '../../../generators/stencil/types';
|
|
2
|
+
import { MitosisComponent, MitosisState } from '../../../types/mitosis-component';
|
|
3
|
+
import { MitosisNode } from '../../../types/mitosis-node';
|
|
4
|
+
export declare const getTagName: (name: string, { prefix }: ToStencilOptions) => string;
|
|
5
|
+
export declare const getPropsAsCode: ({ props, propOptions, defaultProps, json, }: {
|
|
6
|
+
props: string[];
|
|
7
|
+
json: MitosisComponent;
|
|
8
|
+
defaultProps?: MitosisState | undefined;
|
|
9
|
+
propOptions: Record<string, StencilPropOption>;
|
|
10
|
+
}) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Check for root element if it needs a wrapping <Host>
|
|
13
|
+
* @param children
|
|
14
|
+
*/
|
|
15
|
+
export declare const needsWrap: (children: MitosisNode[]) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Dynamically creates all imports from `@stencil/core`
|
|
18
|
+
* @param wrap
|
|
19
|
+
* @param events
|
|
20
|
+
* @param props
|
|
21
|
+
* @param dataString
|
|
22
|
+
* @param watch
|
|
23
|
+
*/
|
|
24
|
+
export declare const getStencilCoreImportsAsString: ({ wrap, events, props, dataString, watch, }: {
|
|
25
|
+
wrap: boolean;
|
|
26
|
+
events: string[];
|
|
27
|
+
props: string[];
|
|
28
|
+
dataString: string;
|
|
29
|
+
watch: boolean;
|
|
30
|
+
}) => string;
|
|
31
|
+
export declare const getImports: (json: MitosisComponent, options: ToStencilOptions, childComponents: string[]) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Converts the deps string into an array of strings
|
|
34
|
+
* @param deps The hook dependencies as string e.g.: "[this.a,this.b]"
|
|
35
|
+
*/
|
|
36
|
+
export declare const getDepsAsArray: (deps: string) => string[];
|
|
37
|
+
export declare const getExportsAndLocal: (json: MitosisComponent) => string;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExportsAndLocal = exports.getDepsAsArray = exports.getImports = exports.getStencilCoreImportsAsString = exports.needsWrap = exports.getPropsAsCode = exports.getTagName = void 0;
|
|
4
|
+
const dash_case_1 = require("../../../helpers/dash-case");
|
|
5
|
+
const event_handlers_1 = require("../../../helpers/event-handlers");
|
|
6
|
+
const render_imports_1 = require("../../../helpers/render-imports");
|
|
7
|
+
const getTagName = (name, { prefix }) => {
|
|
8
|
+
const dashName = (0, dash_case_1.dashCase)(name);
|
|
9
|
+
if (prefix) {
|
|
10
|
+
const dashPrefix = prefix.endsWith('-') ? prefix : `${prefix}-`;
|
|
11
|
+
if (!dashName.startsWith(dashPrefix)) {
|
|
12
|
+
return `${dashPrefix}${dashName}`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return dashName;
|
|
16
|
+
};
|
|
17
|
+
exports.getTagName = getTagName;
|
|
18
|
+
const getPropsAsCode = ({ props, propOptions, defaultProps, json, }) => {
|
|
19
|
+
const propsTypeRef = json.propsTypeRef;
|
|
20
|
+
const internalTypes = json.types;
|
|
21
|
+
const isInternalType = propsTypeRef && internalTypes && internalTypes.find((iType) => iType.includes(propsTypeRef));
|
|
22
|
+
return props
|
|
23
|
+
.map((item) => {
|
|
24
|
+
var _a;
|
|
25
|
+
const defaultProp = defaultProps ? (_a = defaultProps[item]) === null || _a === void 0 ? void 0 : _a.code : undefined;
|
|
26
|
+
const defaultPropString = defaultProp ? ` = ${defaultProp}` : '';
|
|
27
|
+
const propOption = propOptions[item];
|
|
28
|
+
const hasTyping = propsTypeRef &&
|
|
29
|
+
propsTypeRef !== 'any' &&
|
|
30
|
+
propsTypeRef !== 'unknown' &&
|
|
31
|
+
propsTypeRef !== 'never' &&
|
|
32
|
+
!isInternalType;
|
|
33
|
+
if ((0, event_handlers_1.checkIsEvent)(item)) {
|
|
34
|
+
// Stencil adds "on" to every `@Event` so we need to remove "on" from event props
|
|
35
|
+
// https://stenciljs.com/docs/events#using-events-in-jsx
|
|
36
|
+
const eventType = hasTyping
|
|
37
|
+
? `EventEmitter<Parameters<Required<${propsTypeRef}>["${item}"]>[number]> | void`
|
|
38
|
+
: 'any';
|
|
39
|
+
return `@Event() ${(0, event_handlers_1.getEventNameWithoutOn)(item)}: ${eventType}${defaultPropString}`;
|
|
40
|
+
}
|
|
41
|
+
const propType = hasTyping ? `${propsTypeRef}["${item}"]` : 'any';
|
|
42
|
+
return `@Prop(${propOption ? JSON.stringify(propOption) : ''}) ${item}: ${propType}${defaultPropString}`;
|
|
43
|
+
})
|
|
44
|
+
.join(';\n');
|
|
45
|
+
};
|
|
46
|
+
exports.getPropsAsCode = getPropsAsCode;
|
|
47
|
+
/**
|
|
48
|
+
* Check for root element if it needs a wrapping <Host>
|
|
49
|
+
* @param children
|
|
50
|
+
*/
|
|
51
|
+
const needsWrap = (children) => {
|
|
52
|
+
if (children.length !== 1) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
else if (children.length === 1) {
|
|
56
|
+
const firstChild = children.at(0);
|
|
57
|
+
if ((firstChild === null || firstChild === void 0 ? void 0 : firstChild.name) === 'Show' || (firstChild === null || firstChild === void 0 ? void 0 : firstChild.name) === 'For') {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
};
|
|
63
|
+
exports.needsWrap = needsWrap;
|
|
64
|
+
/**
|
|
65
|
+
* Dynamically creates all imports from `@stencil/core`
|
|
66
|
+
* @param wrap
|
|
67
|
+
* @param events
|
|
68
|
+
* @param props
|
|
69
|
+
* @param dataString
|
|
70
|
+
* @param watch
|
|
71
|
+
*/
|
|
72
|
+
const getStencilCoreImportsAsString = ({ wrap, events, props, dataString, watch, }) => {
|
|
73
|
+
const stencilCoreImports = {
|
|
74
|
+
Component: true,
|
|
75
|
+
h: true,
|
|
76
|
+
Fragment: true,
|
|
77
|
+
Host: wrap,
|
|
78
|
+
Watch: watch,
|
|
79
|
+
Event: events.length > 0,
|
|
80
|
+
EventEmitter: events.length > 0,
|
|
81
|
+
Prop: props.length > 0,
|
|
82
|
+
State: dataString.length > 0,
|
|
83
|
+
};
|
|
84
|
+
return Object.entries(stencilCoreImports)
|
|
85
|
+
.map(([key, bool]) => (bool ? key : ''))
|
|
86
|
+
.filter((key) => !!key)
|
|
87
|
+
.join(', ');
|
|
88
|
+
};
|
|
89
|
+
exports.getStencilCoreImportsAsString = getStencilCoreImportsAsString;
|
|
90
|
+
const getImports = (json, options, childComponents) => {
|
|
91
|
+
return (0, render_imports_1.renderPreComponent)({
|
|
92
|
+
explicitImportFileExtension: options.explicitImportFileExtension,
|
|
93
|
+
component: json,
|
|
94
|
+
target: 'stencil',
|
|
95
|
+
excludeExportAndLocal: true,
|
|
96
|
+
importMapper: (_, theImport, importedValues) => {
|
|
97
|
+
const childImport = importedValues.defaultImport;
|
|
98
|
+
if (childImport && childComponents.includes(childImport)) {
|
|
99
|
+
return `import {${childImport}} from '${theImport.path}';`;
|
|
100
|
+
}
|
|
101
|
+
return undefined;
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
exports.getImports = getImports;
|
|
106
|
+
/**
|
|
107
|
+
* Converts the deps string into an array of strings
|
|
108
|
+
* @param deps The hook dependencies as string e.g.: "[this.a,this.b]"
|
|
109
|
+
*/
|
|
110
|
+
const getDepsAsArray = (deps) => {
|
|
111
|
+
return deps
|
|
112
|
+
.replace('[', '')
|
|
113
|
+
.replace(']', '')
|
|
114
|
+
.replaceAll('this.', '')
|
|
115
|
+
.split(',')
|
|
116
|
+
.map((dep) => dep.trim());
|
|
117
|
+
};
|
|
118
|
+
exports.getDepsAsArray = getDepsAsArray;
|
|
119
|
+
const getExportsAndLocal = (json) => {
|
|
120
|
+
return Object.entries(json.exports || {})
|
|
121
|
+
.map(([key, { usedInLocal, code }]) => {
|
|
122
|
+
if (usedInLocal) {
|
|
123
|
+
return `${key} = ${code.substring(code.indexOf('=') + 1)}`;
|
|
124
|
+
}
|
|
125
|
+
return '';
|
|
126
|
+
})
|
|
127
|
+
.join('\n');
|
|
128
|
+
};
|
|
129
|
+
exports.getExportsAndLocal = getExportsAndLocal;
|
|
@@ -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,4 @@
|
|
|
1
|
+
import { ToStencilOptions } from '../../../generators/stencil/types';
|
|
2
|
+
import { ProcessBindingOptions } from '../../../helpers/class-components';
|
|
3
|
+
import { MitosisComponent } from '../../../types/mitosis-component';
|
|
4
|
+
export declare const getCodeProcessorPlugins: (json: MitosisComponent, options: ToStencilOptions, processBindingOptions: ProcessBindingOptions) => import("../../..").MitosisPlugin[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCodeProcessorPlugins = void 0;
|
|
4
|
+
const class_components_1 = require("../../../helpers/class-components");
|
|
5
|
+
const process_code_1 = require("../../../helpers/plugins/process-code");
|
|
6
|
+
const getCodeProcessorPlugins = (json, options, processBindingOptions) => {
|
|
7
|
+
return [
|
|
8
|
+
...(options.plugins || []),
|
|
9
|
+
(0, process_code_1.CODE_PROCESSOR_PLUGIN)((codeType) => {
|
|
10
|
+
switch (codeType) {
|
|
11
|
+
case 'bindings':
|
|
12
|
+
case 'properties':
|
|
13
|
+
case 'hooks':
|
|
14
|
+
case 'hooks-deps':
|
|
15
|
+
case 'hooks-deps-array':
|
|
16
|
+
case 'state':
|
|
17
|
+
case 'context-set':
|
|
18
|
+
case 'dynamic-jsx-elements':
|
|
19
|
+
case 'types':
|
|
20
|
+
return (code) => (0, class_components_1.processClassComponentBinding)(json, code, processBindingOptions);
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
];
|
|
24
|
+
};
|
|
25
|
+
exports.getCodeProcessorPlugins = getCodeProcessorPlugins;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseTranspilerOptions } from '../../types/transpiler';
|
|
2
|
+
export interface StencilPropOption {
|
|
3
|
+
attribute?: string;
|
|
4
|
+
mutable?: boolean;
|
|
5
|
+
reflect?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface StencilPropOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Add additional options for Stencil properties: https://stenciljs.com/docs/properties#prop-options.
|
|
10
|
+
* You need to map your properties you provide to the component.
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
* ```tsx
|
|
14
|
+
* propOptions: {
|
|
15
|
+
* className: {
|
|
16
|
+
* attribute: 'classname',
|
|
17
|
+
* mutable: false,
|
|
18
|
+
* reflect: false,
|
|
19
|
+
* },
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
propOptions?: Record<string, StencilPropOption>;
|
|
24
|
+
}
|
|
25
|
+
export interface ToStencilOptions extends BaseTranspilerOptions, StencilPropOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Add a prefix for every component like `my`.
|
|
28
|
+
* A Stencil component needs a prefix with a dash.
|
|
29
|
+
* You don't need this option if your Mitosis component includes the prefix already:
|
|
30
|
+
*
|
|
31
|
+
* Error: `export default function Button ...` -> tag: 'button'
|
|
32
|
+
* Success: `export default function MyButton ...` -> tag: 'my-button'
|
|
33
|
+
* Success: prefix="my" + `export default function Button ...` -> tag: 'my-button'
|
|
34
|
+
*/
|
|
35
|
+
prefix?: string;
|
|
36
|
+
}
|
|
37
|
+
export type StencilMetadata = {} & StencilPropOptions;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MitosisComponent } from '../../types/mitosis-component';
|
|
2
|
+
import { BaseNode, MitosisNode } from '../../types/mitosis-node';
|
|
3
|
+
import { ToSvelteOptions } from './types';
|
|
4
|
+
type BlockToSvelte<T extends BaseNode = MitosisNode> = (props: {
|
|
5
|
+
json: T;
|
|
6
|
+
options: ToSvelteOptions;
|
|
7
|
+
parentComponent: MitosisComponent;
|
|
8
|
+
}) => string;
|
|
9
|
+
export declare const blockToSvelte: BlockToSvelte;
|
|
10
|
+
export {};
|