@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,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Image = exports.DIRECTIVES = void 0;
|
|
4
|
+
const for_1 = require("../../helpers/nodes/for");
|
|
5
|
+
const minify_1 = require("../helpers/minify");
|
|
6
|
+
const src_generator_1 = require("./src-generator");
|
|
7
|
+
exports.DIRECTIVES = {
|
|
8
|
+
Show: (node, blockFn) => function () {
|
|
9
|
+
var _a;
|
|
10
|
+
const expr = (_a = node.bindings.when) === null || _a === void 0 ? void 0 : _a.code;
|
|
11
|
+
const elseBlockFn = blockFn.else;
|
|
12
|
+
this.jsxExpression(() => {
|
|
13
|
+
this.emit(expr, '?');
|
|
14
|
+
blockFn();
|
|
15
|
+
this.emit(':');
|
|
16
|
+
if (elseBlockFn) {
|
|
17
|
+
elseBlockFn();
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this.emit('null');
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
For: (_node, blockFn) => function () {
|
|
25
|
+
var _a;
|
|
26
|
+
const node = _node;
|
|
27
|
+
const expr = (_a = node.bindings.each) === null || _a === void 0 ? void 0 : _a.code;
|
|
28
|
+
this.jsxExpression(() => {
|
|
29
|
+
const forArgs = (0, for_1.getForArguments)(node);
|
|
30
|
+
const forName = forArgs[0];
|
|
31
|
+
this.emit('(', expr, '||[]).map(');
|
|
32
|
+
this.isBuilder && this.emit('((');
|
|
33
|
+
this.emit('(', forArgs, ') => {');
|
|
34
|
+
if (this.isBuilder) {
|
|
35
|
+
this.emit('const l={...this,', (0, src_generator_1.iteratorProperty)(expr), ':', forName, '==null?{}:', forName, ',', () => forArgs.forEach((arg) => {
|
|
36
|
+
this.emit(arg, ':', arg, ',');
|
|
37
|
+
}), '};');
|
|
38
|
+
this.emit('const state = __proxyMerge__(s,l);');
|
|
39
|
+
}
|
|
40
|
+
this.emit('return(');
|
|
41
|
+
blockFn();
|
|
42
|
+
this.emit(');}');
|
|
43
|
+
this.isBuilder && this.emit(').bind(l))');
|
|
44
|
+
this.emit(')');
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
Image: (0, minify_1.minify) `${Image}`,
|
|
48
|
+
CoreButton: (0, minify_1.minify) `${CoreButton}`,
|
|
49
|
+
__passThroughProps__: (0, minify_1.minify) `${__passThroughProps__}`,
|
|
50
|
+
__proxyMerge__: (0, minify_1.minify) `${__proxyMerge__}`,
|
|
51
|
+
};
|
|
52
|
+
function Image(props) {
|
|
53
|
+
var _a;
|
|
54
|
+
let jsx = props.children || [];
|
|
55
|
+
let image = props.image;
|
|
56
|
+
if (image) {
|
|
57
|
+
const isBuilderIoImage = !!(image || '').match(/\.builder\.io/) && !props.noWebp;
|
|
58
|
+
const isPixel = (_a = props.builderBlock) === null || _a === void 0 ? void 0 : _a.id.startsWith('builder-pixel-');
|
|
59
|
+
const imgProps = {
|
|
60
|
+
src: props.image,
|
|
61
|
+
style: `object-fit:${props.backgroundSize || 'cover'};object-position:${props.backgroundPosition || 'center'};` + (props.aspectRatio ? 'position:absolute;height:100%;width:100%;top:0;left:0' : ''),
|
|
62
|
+
sizes: props.sizes,
|
|
63
|
+
alt: props.altText,
|
|
64
|
+
role: !props.altText ? 'presentation' : undefined,
|
|
65
|
+
loading: isPixel ? 'eager' : 'lazy',
|
|
66
|
+
srcset: undefined,
|
|
67
|
+
};
|
|
68
|
+
const qwikBugWorkaround = (imgProps) => Object.keys(imgProps).forEach((k) => imgProps[k] === undefined && delete imgProps[k]);
|
|
69
|
+
qwikBugWorkaround(imgProps);
|
|
70
|
+
if (isBuilderIoImage) {
|
|
71
|
+
const webpImage = updateQueryParam(image, 'format', 'webp');
|
|
72
|
+
const srcset = ['100', '200', '400', '800', '1200', '1600', '2000']
|
|
73
|
+
.concat(props.srcsetSizes ? String(props.srcsetSizes).split(' ') : [])
|
|
74
|
+
.map((size) => {
|
|
75
|
+
return updateQueryParam(webpImage, 'width', size) + ' ' + size + 'w';
|
|
76
|
+
})
|
|
77
|
+
.concat(tryAppendWidth(image))
|
|
78
|
+
.join(', ');
|
|
79
|
+
imgProps.srcset = srcset;
|
|
80
|
+
jsx = jsx = [
|
|
81
|
+
h('picture', {}, [
|
|
82
|
+
h('source', { type: 'image/webp', srcset: srcset }),
|
|
83
|
+
h('img', imgProps, jsx),
|
|
84
|
+
]),
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
jsx = [h('img', imgProps, jsx)];
|
|
89
|
+
}
|
|
90
|
+
if (props.aspectRatio && !(props.fitContent && props.children && props.children.length)) {
|
|
91
|
+
const sizingDiv = h('div', {
|
|
92
|
+
class: 'builder-image-sizer',
|
|
93
|
+
style: `width:100%;padding-top:${(props.aspectRatio || 1) * 100}%;pointer-events:none;font-size:0`,
|
|
94
|
+
});
|
|
95
|
+
jsx.push(sizingDiv);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const children = props.children ? [jsx].concat(props.children) : [jsx];
|
|
99
|
+
return h(props.href ? 'a' : 'div', __passThroughProps__({ href: props.href, class: props.class }, props), children);
|
|
100
|
+
function updateQueryParam(uri = '', key, value) {
|
|
101
|
+
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
|
102
|
+
const separator = uri.indexOf('?') !== -1 ? '&' : '?';
|
|
103
|
+
if (uri.match(re)) {
|
|
104
|
+
return uri.replace(re, '$1' + key + '=' + encodeURIComponent(value) + '$2');
|
|
105
|
+
}
|
|
106
|
+
return uri + separator + key + '=' + encodeURIComponent(value);
|
|
107
|
+
}
|
|
108
|
+
function tryAppendWidth(url) {
|
|
109
|
+
const match = url.match(/[?&]width=(\d+)/);
|
|
110
|
+
const width = match && match[1];
|
|
111
|
+
if (width) {
|
|
112
|
+
return [url + ' ' + width + 'w'];
|
|
113
|
+
}
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.Image = Image;
|
|
118
|
+
function __passThroughProps__(dstProps, srcProps) {
|
|
119
|
+
for (const key in srcProps) {
|
|
120
|
+
if (Object.prototype.hasOwnProperty.call(srcProps, key) &&
|
|
121
|
+
((key.startsWith('on') && key.endsWith('$')) || key == 'style')) {
|
|
122
|
+
dstProps[key] = srcProps[key];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return dstProps;
|
|
126
|
+
}
|
|
127
|
+
function CoreButton(props) {
|
|
128
|
+
const hasLink = !!props.link;
|
|
129
|
+
const hProps = {
|
|
130
|
+
dangerouslySetInnerHTML: props.text || '',
|
|
131
|
+
href: props.link,
|
|
132
|
+
target: props.openInNewTab ? '_blank' : '_self',
|
|
133
|
+
class: props.class,
|
|
134
|
+
};
|
|
135
|
+
return h(hasLink ? 'a' : props.tagName$ || 'span', __passThroughProps__(hProps, props));
|
|
136
|
+
}
|
|
137
|
+
function __proxyMerge__(state, local) {
|
|
138
|
+
return new Proxy(state, {
|
|
139
|
+
get: (obj, prop) => {
|
|
140
|
+
if (local && prop in local) {
|
|
141
|
+
return local[prop];
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
return state[prop];
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
set: (obj, prop, value) => {
|
|
148
|
+
obj[prop] = value;
|
|
149
|
+
return true;
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MitosisComponent } from '../../../types/mitosis-component';
|
|
2
|
+
/**
|
|
3
|
+
* Find event handlers that explicitly call .preventDefault() and
|
|
4
|
+
* add preventdefault:event
|
|
5
|
+
* https://qwik.builder.io/tutorial/events/preventdefault
|
|
6
|
+
*/
|
|
7
|
+
export declare function addPreventDefault(json: MitosisComponent): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.addPreventDefault = void 0;
|
|
7
|
+
const event_handlers_1 = require("../../../helpers/event-handlers");
|
|
8
|
+
const is_mitosis_node_1 = require("../../../helpers/is-mitosis-node");
|
|
9
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
10
|
+
/**
|
|
11
|
+
* Find event handlers that explicitly call .preventDefault() and
|
|
12
|
+
* add preventdefault:event
|
|
13
|
+
* https://qwik.builder.io/tutorial/events/preventdefault
|
|
14
|
+
*/
|
|
15
|
+
function addPreventDefault(json) {
|
|
16
|
+
(0, legacy_1.default)(json).forEach((node) => {
|
|
17
|
+
var _a;
|
|
18
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(node)) {
|
|
19
|
+
if (node.bindings) {
|
|
20
|
+
for (const key of Object.keys(node.bindings)) {
|
|
21
|
+
if ((0, event_handlers_1.checkIsEvent)(key)) {
|
|
22
|
+
if ((_a = node.bindings[key]) === null || _a === void 0 ? void 0 : _a.code.includes('.preventDefault()')) {
|
|
23
|
+
const event = key.slice(2).toLowerCase();
|
|
24
|
+
node.properties['preventdefault:' + event] = '';
|
|
25
|
+
node.bindings[key].code = node.bindings[key].code.replace(/.*?\.preventDefault\(\);?/, '').trim();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.addPreventDefault = addPreventDefault;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertMethodToFunction = void 0;
|
|
4
|
+
function convertMethodToFunction(code, properties, lexicalArgs) {
|
|
5
|
+
const out = [];
|
|
6
|
+
let idx = 0;
|
|
7
|
+
let lastIdx = idx;
|
|
8
|
+
let end = code.length;
|
|
9
|
+
let mode = "code" /* Mode.code */;
|
|
10
|
+
let braceDepth = 0;
|
|
11
|
+
let stringEndBraceDepth = -1;
|
|
12
|
+
let stringEndBraceDepthQueue = [];
|
|
13
|
+
let lastCh = null;
|
|
14
|
+
while (idx < end) {
|
|
15
|
+
const ch = code.charCodeAt(idx++);
|
|
16
|
+
switch (mode) {
|
|
17
|
+
case "code" /* Mode.code */:
|
|
18
|
+
if (ch === QUOTE_DOUBLE) {
|
|
19
|
+
mode = "stringDouble" /* Mode.stringDouble */;
|
|
20
|
+
}
|
|
21
|
+
else if (ch === QUOTE_SINGLE) {
|
|
22
|
+
mode = "stringSingle" /* Mode.stringSingle */;
|
|
23
|
+
}
|
|
24
|
+
else if (ch === QUOTE_BACK_TICK) {
|
|
25
|
+
mode = "stringTemplate" /* Mode.stringTemplate */;
|
|
26
|
+
}
|
|
27
|
+
else if (ch === OPEN_BRACE) {
|
|
28
|
+
braceDepth++;
|
|
29
|
+
}
|
|
30
|
+
else if (lastCh == FORWARD_SLASH && ch == FORWARD_SLASH) {
|
|
31
|
+
mode = "commentSingleline" /* Mode.commentSingleline */;
|
|
32
|
+
}
|
|
33
|
+
else if (lastCh == FORWARD_SLASH && ch == STAR) {
|
|
34
|
+
mode = "commentMultiline" /* Mode.commentMultiline */;
|
|
35
|
+
}
|
|
36
|
+
else if (ch === CLOSE_BRACE) {
|
|
37
|
+
braceDepth--;
|
|
38
|
+
if (braceDepth === stringEndBraceDepth) {
|
|
39
|
+
stringEndBraceDepth = stringEndBraceDepthQueue.pop();
|
|
40
|
+
mode = "stringTemplate" /* Mode.stringTemplate */;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else if (isWord(ch, code, idx, 'this') || isWord(ch, code, idx, 'state')) {
|
|
44
|
+
idx--;
|
|
45
|
+
flush();
|
|
46
|
+
consumeIdent();
|
|
47
|
+
if (code.charCodeAt(idx) == DOT) {
|
|
48
|
+
idx++;
|
|
49
|
+
const propEndIdx = findIdentEnd();
|
|
50
|
+
const identifier = code.substring(idx, propEndIdx);
|
|
51
|
+
const propType = properties[identifier];
|
|
52
|
+
if (propType) {
|
|
53
|
+
const isGetter = code.charCodeAt(propEndIdx) !== OPEN_PAREN;
|
|
54
|
+
lastIdx = idx = propEndIdx + (isGetter ? 0 : 1);
|
|
55
|
+
if (isGetter) {
|
|
56
|
+
if (propType === 'method') {
|
|
57
|
+
out.push(identifier, `.bind(null,${lexicalArgs.join(',')})`);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
out.push(identifier, `(${lexicalArgs.join(',')})`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
out.push(identifier, `(${lexicalArgs.join(',')},`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
flush();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
case "commentSingleline" /* Mode.commentSingleline */:
|
|
74
|
+
if (ch == EOL)
|
|
75
|
+
mode = "code" /* Mode.code */;
|
|
76
|
+
break;
|
|
77
|
+
case "commentMultiline" /* Mode.commentMultiline */:
|
|
78
|
+
if (lastCh == STAR && ch == FORWARD_SLASH)
|
|
79
|
+
mode = "code" /* Mode.code */;
|
|
80
|
+
break;
|
|
81
|
+
case "stringSingle" /* Mode.stringSingle */:
|
|
82
|
+
if (lastCh !== BACKSLASH && ch == QUOTE_SINGLE)
|
|
83
|
+
mode = "code" /* Mode.code */;
|
|
84
|
+
break;
|
|
85
|
+
case "stringDouble" /* Mode.stringDouble */:
|
|
86
|
+
if (lastCh !== BACKSLASH && ch == QUOTE_DOUBLE)
|
|
87
|
+
mode = "code" /* Mode.code */;
|
|
88
|
+
break;
|
|
89
|
+
case "stringTemplate" /* Mode.stringTemplate */:
|
|
90
|
+
if (lastCh !== BACKSLASH && ch == QUOTE_BACK_TICK) {
|
|
91
|
+
mode = "code" /* Mode.code */;
|
|
92
|
+
}
|
|
93
|
+
else if (lastCh === DOLLAR && ch == OPEN_BRACE) {
|
|
94
|
+
mode = "code" /* Mode.code */;
|
|
95
|
+
stringEndBraceDepthQueue.push(stringEndBraceDepth);
|
|
96
|
+
stringEndBraceDepth = braceDepth;
|
|
97
|
+
braceDepth++;
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
lastCh = ch;
|
|
102
|
+
}
|
|
103
|
+
flush();
|
|
104
|
+
return out.join('');
|
|
105
|
+
function flush() {
|
|
106
|
+
out.push(code.substring(lastIdx, idx));
|
|
107
|
+
lastIdx = idx;
|
|
108
|
+
}
|
|
109
|
+
function findIdentEnd() {
|
|
110
|
+
let scanIdx = idx;
|
|
111
|
+
while (isIdentCh(code.charCodeAt(scanIdx)) && scanIdx < end) {
|
|
112
|
+
scanIdx++;
|
|
113
|
+
}
|
|
114
|
+
return scanIdx;
|
|
115
|
+
}
|
|
116
|
+
function consumeIdent() {
|
|
117
|
+
while (isIdentCh(code.charCodeAt(idx))) {
|
|
118
|
+
idx++;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.convertMethodToFunction = convertMethodToFunction;
|
|
123
|
+
function isIdentCh(ch) {
|
|
124
|
+
return ((CHAR_0 <= ch && ch <= CHAR_9) ||
|
|
125
|
+
(CHAR_a <= ch && ch <= CHAR_z) ||
|
|
126
|
+
(CHAR_A <= ch && ch <= CHAR_Z) ||
|
|
127
|
+
ch === UNDERSCORE ||
|
|
128
|
+
ch === DOLLAR);
|
|
129
|
+
}
|
|
130
|
+
function isWord(ch, code, idx, word) {
|
|
131
|
+
if (ch !== word.charCodeAt(0))
|
|
132
|
+
return false;
|
|
133
|
+
for (let i = 1; i < word.length; i++) {
|
|
134
|
+
if (code.charCodeAt(idx + i - 1) !== word.charCodeAt(i)) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (isIdentCh(code.charCodeAt(idx + word.length - 1))) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
const QUOTE_DOUBLE = '"'.charCodeAt(0);
|
|
144
|
+
const QUOTE_SINGLE = "'".charCodeAt(0);
|
|
145
|
+
const QUOTE_BACK_TICK = '`'.charCodeAt(0);
|
|
146
|
+
const BACKSLASH = `\\`.charCodeAt(0);
|
|
147
|
+
const FORWARD_SLASH = `/`.charCodeAt(0);
|
|
148
|
+
const EOL = `\n`.charCodeAt(0);
|
|
149
|
+
const STAR = `*`.charCodeAt(0);
|
|
150
|
+
const CHAR_0 = `0`.charCodeAt(0);
|
|
151
|
+
const CHAR_9 = `9`.charCodeAt(0);
|
|
152
|
+
const CHAR_a = `a`.charCodeAt(0);
|
|
153
|
+
const CHAR_z = `z`.charCodeAt(0);
|
|
154
|
+
const CHAR_A = `A`.charCodeAt(0);
|
|
155
|
+
const CHAR_Z = `Z`.charCodeAt(0);
|
|
156
|
+
const UNDERSCORE = `_`.charCodeAt(0);
|
|
157
|
+
const DOLLAR = `$`.charCodeAt(0);
|
|
158
|
+
const DOT = `.`.charCodeAt(0);
|
|
159
|
+
const OPEN_PAREN = '('.charCodeAt(0);
|
|
160
|
+
const OPEN_BRACE = '{'.charCodeAt(0);
|
|
161
|
+
const CLOSE_BRACE = '}'.charCodeAt(0);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderHandlers = void 0;
|
|
4
|
+
const event_handlers_1 = require("../../../helpers/event-handlers");
|
|
5
|
+
const component_1 = require("../component");
|
|
6
|
+
const src_generator_1 = require("../src-generator");
|
|
7
|
+
const IIF_START = '(() => {';
|
|
8
|
+
const IIF_END = '})()';
|
|
9
|
+
function extractJSBlock(binding) {
|
|
10
|
+
if (typeof binding == 'string') {
|
|
11
|
+
if (binding.startsWith('{') &&
|
|
12
|
+
binding.endsWith('}') &&
|
|
13
|
+
!binding.startsWith('{"') &&
|
|
14
|
+
!binding.endsWith('"}')) {
|
|
15
|
+
return binding.substring(1, binding.length - 2);
|
|
16
|
+
}
|
|
17
|
+
else if (binding.startsWith(IIF_START) && binding.endsWith(IIF_END)) {
|
|
18
|
+
return binding.substring(IIF_START.length, binding.length - IIF_END.length - 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
function renderHandlers(file, componentName, children) {
|
|
24
|
+
let id = 0;
|
|
25
|
+
const map = new Map();
|
|
26
|
+
const nodes = [...children];
|
|
27
|
+
while (nodes.length) {
|
|
28
|
+
const node = nodes.shift();
|
|
29
|
+
const bindings = node.bindings;
|
|
30
|
+
for (const key in bindings) {
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(bindings, key)) {
|
|
32
|
+
const { code: binding } = bindings[key];
|
|
33
|
+
if (binding != null) {
|
|
34
|
+
if (isEventName(key)) {
|
|
35
|
+
let block = extractJSBlock(binding) || binding;
|
|
36
|
+
const symbol = `${componentName}_${key}_${id++}`;
|
|
37
|
+
map.set(binding, symbol);
|
|
38
|
+
renderHandler(file, symbol, block);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
nodes.push(...node.children);
|
|
44
|
+
}
|
|
45
|
+
return map;
|
|
46
|
+
}
|
|
47
|
+
exports.renderHandlers = renderHandlers;
|
|
48
|
+
function renderHandler(file, symbol, code) {
|
|
49
|
+
const body = [code];
|
|
50
|
+
const shouldRenderStateRestore = code.indexOf('state') !== -1;
|
|
51
|
+
if (shouldRenderStateRestore) {
|
|
52
|
+
body.unshift((0, component_1.renderUseLexicalScope)(file));
|
|
53
|
+
}
|
|
54
|
+
file.exportConst(symbol, function () {
|
|
55
|
+
this.emit([(0, src_generator_1.arrowFnBlock)(['event'], body)]);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function isEventName(name) {
|
|
59
|
+
return (0, event_handlers_1.checkIsEvent)(name) && name.charAt(2).toUpperCase() == name.charAt(2);
|
|
60
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Similar to our `stableJSONSerialize` function, except that it does not stringify the values: it injects them as-is.
|
|
3
|
+
* This is needed for our `MitosisState` values which are JS expressions stored as strings.
|
|
4
|
+
*/
|
|
5
|
+
export declare function stableInject(obj: any): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stableInject = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Similar to our `stableJSONSerialize` function, except that it does not stringify the values: it injects them as-is.
|
|
6
|
+
* This is needed for our `MitosisState` values which are JS expressions stored as strings.
|
|
7
|
+
*/
|
|
8
|
+
function stableInject(obj) {
|
|
9
|
+
const output = [];
|
|
10
|
+
_serialize(output, obj);
|
|
11
|
+
return output.join('');
|
|
12
|
+
}
|
|
13
|
+
exports.stableInject = stableInject;
|
|
14
|
+
function _serialize(output, obj) {
|
|
15
|
+
if (obj == null) {
|
|
16
|
+
output.push('null');
|
|
17
|
+
}
|
|
18
|
+
else if (typeof obj === 'object') {
|
|
19
|
+
if (Array.isArray(obj)) {
|
|
20
|
+
output.push('[');
|
|
21
|
+
let sep = '';
|
|
22
|
+
for (let i = 0; i < obj.length; i++) {
|
|
23
|
+
output.push(sep);
|
|
24
|
+
_serialize(output, obj[i]);
|
|
25
|
+
sep = ',';
|
|
26
|
+
}
|
|
27
|
+
output.push(']');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const keys = Object.keys(obj).sort();
|
|
31
|
+
output.push('{');
|
|
32
|
+
let sep = '';
|
|
33
|
+
for (const key of keys) {
|
|
34
|
+
const value = obj[key];
|
|
35
|
+
if (value !== undefined) {
|
|
36
|
+
output.push(sep);
|
|
37
|
+
output.push(JSON.stringify(key));
|
|
38
|
+
output.push(':');
|
|
39
|
+
_serialize(output, value);
|
|
40
|
+
sep = ',';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
output.push('}');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
output.push(obj);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stableJSONserialize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Same as JSON.stringify, but sorts keys ensuring that the output is stable across runs.
|
|
6
|
+
* @param obj
|
|
7
|
+
* @returns JSON serialized string
|
|
8
|
+
*/
|
|
9
|
+
function stableJSONserialize(obj) {
|
|
10
|
+
const output = [];
|
|
11
|
+
_serialize(output, obj);
|
|
12
|
+
return output.join('');
|
|
13
|
+
}
|
|
14
|
+
exports.stableJSONserialize = stableJSONserialize;
|
|
15
|
+
function _serialize(output, obj) {
|
|
16
|
+
if (obj == null) {
|
|
17
|
+
output.push('null');
|
|
18
|
+
}
|
|
19
|
+
else if (typeof obj === 'object') {
|
|
20
|
+
if (Array.isArray(obj)) {
|
|
21
|
+
output.push('[');
|
|
22
|
+
let sep = '';
|
|
23
|
+
for (let i = 0; i < obj.length; i++) {
|
|
24
|
+
output.push(sep);
|
|
25
|
+
_serialize(output, obj[i]);
|
|
26
|
+
sep = ',';
|
|
27
|
+
}
|
|
28
|
+
output.push(']');
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const keys = Object.keys(obj).sort();
|
|
32
|
+
output.push('{');
|
|
33
|
+
let sep = '';
|
|
34
|
+
for (const key of keys) {
|
|
35
|
+
const value = obj[key];
|
|
36
|
+
if (value !== undefined) {
|
|
37
|
+
output.push(sep);
|
|
38
|
+
output.push(JSON.stringify(key));
|
|
39
|
+
output.push(':');
|
|
40
|
+
_serialize(output, value);
|
|
41
|
+
sep = ',';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
output.push('}');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
output.push(JSON.stringify(obj));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentMetadata } from '../../../types/metadata';
|
|
2
|
+
import { MitosisComponent } from '../../../types/mitosis-component';
|
|
3
|
+
import { File } from '../src-generator';
|
|
4
|
+
/**
|
|
5
|
+
* Stores getters and initialization map.
|
|
6
|
+
*/
|
|
7
|
+
export type StateInit = [
|
|
8
|
+
StateValues,
|
|
9
|
+
/**
|
|
10
|
+
* Set of state initializers.
|
|
11
|
+
*/
|
|
12
|
+
...string[]
|
|
13
|
+
];
|
|
14
|
+
export type PropertyName = string;
|
|
15
|
+
export type StateValue = string;
|
|
16
|
+
/**
|
|
17
|
+
* Map of getters that need to be rewritten to function invocations.
|
|
18
|
+
*/
|
|
19
|
+
export type StateValues = Record<PropertyName, StateValue>;
|
|
20
|
+
/**
|
|
21
|
+
* @param file
|
|
22
|
+
* @param stateInit
|
|
23
|
+
*/
|
|
24
|
+
export declare function emitUseStore({ file, stateInit, isDeep, }: {
|
|
25
|
+
file: File;
|
|
26
|
+
stateInit: StateInit;
|
|
27
|
+
isDeep?: boolean;
|
|
28
|
+
}): void;
|
|
29
|
+
export declare function emitStateMethodsAndRewriteBindings(file: File, component: MitosisComponent, metadata?: ComponentMetadata): StateInit;
|
|
30
|
+
export declare function getLexicalScopeVars(component: MitosisComponent): string[];
|
|
31
|
+
export type MethodMap = Record<string, 'method' | 'getter'>;
|
|
32
|
+
export declare function getStateMethodsAndGetters(state: MitosisComponent['state']): MethodMap;
|