@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,111 @@
|
|
|
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.getStateMethodsAndGetters = exports.getLexicalScopeVars = exports.emitStateMethodsAndRewriteBindings = exports.emitUseStore = void 0;
|
|
7
|
+
const legacy_1 = __importDefault(require("neotraverse/legacy"));
|
|
8
|
+
const babel_transform_1 = require("../../../helpers/babel-transform");
|
|
9
|
+
const convert_method_to_function_1 = require("./convert-method-to-function");
|
|
10
|
+
const stable_inject_1 = require("./stable-inject");
|
|
11
|
+
/**
|
|
12
|
+
* @param file
|
|
13
|
+
* @param stateInit
|
|
14
|
+
*/
|
|
15
|
+
function emitUseStore({ file, stateInit, isDeep, }) {
|
|
16
|
+
const state = stateInit[0];
|
|
17
|
+
const hasState = state && Object.keys(state).length > 0;
|
|
18
|
+
if (hasState) {
|
|
19
|
+
file.src.emit('const state=', file.import(file.qwikModule, 'useStore').localName);
|
|
20
|
+
if (file.options.isTypeScript) {
|
|
21
|
+
file.src.emit('<any>');
|
|
22
|
+
}
|
|
23
|
+
const fnArgs = [(0, stable_inject_1.stableInject)(state), isDeep ? '{deep: true}' : undefined].filter(Boolean);
|
|
24
|
+
file.src.emit(`(${fnArgs});`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// TODO hack for now so that `state` variable is defined, even though it is never read.
|
|
28
|
+
file.src.emit(`const state${file.options.isTypeScript ? ': any' : ''} = {};`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.emitUseStore = emitUseStore;
|
|
32
|
+
function emitStateMethods(file, componentState, lexicalArgs) {
|
|
33
|
+
const stateValues = {};
|
|
34
|
+
const stateInit = [stateValues];
|
|
35
|
+
const methodMap = getStateMethodsAndGetters(componentState);
|
|
36
|
+
for (const key in componentState) {
|
|
37
|
+
const stateValue = componentState[key];
|
|
38
|
+
switch (stateValue === null || stateValue === void 0 ? void 0 : stateValue.type) {
|
|
39
|
+
case 'method':
|
|
40
|
+
case 'function':
|
|
41
|
+
let code = stateValue.code;
|
|
42
|
+
const isAsync = code.startsWith('async');
|
|
43
|
+
if (!isAsync) {
|
|
44
|
+
let prefixIdx = 0;
|
|
45
|
+
if (stateValue.type === 'function') {
|
|
46
|
+
prefixIdx += 'function '.length;
|
|
47
|
+
}
|
|
48
|
+
code = code.substring(prefixIdx);
|
|
49
|
+
code = (0, convert_method_to_function_1.convertMethodToFunction)(code, methodMap, lexicalArgs).replace('(', `(${lexicalArgs.join(',')},`);
|
|
50
|
+
}
|
|
51
|
+
const functionName = code.split(/\(/)[0];
|
|
52
|
+
if (!file.options.isTypeScript) {
|
|
53
|
+
// Erase type information
|
|
54
|
+
code = (0, babel_transform_1.convertTypeScriptToJS)(code);
|
|
55
|
+
}
|
|
56
|
+
file.exportConst(isAsync ? key : functionName, isAsync ? code : 'function ' + code, true);
|
|
57
|
+
continue;
|
|
58
|
+
case 'property':
|
|
59
|
+
stateValues[key] = stateValue.code;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return stateInit;
|
|
64
|
+
}
|
|
65
|
+
function emitStateMethodsAndRewriteBindings(file, component, metadata) {
|
|
66
|
+
var _a;
|
|
67
|
+
const lexicalArgs = getLexicalScopeVars(component);
|
|
68
|
+
const state = emitStateMethods(file, component.state, lexicalArgs);
|
|
69
|
+
const methodMap = getStateMethodsAndGetters(component.state);
|
|
70
|
+
rewriteCodeExpr(component, methodMap, lexicalArgs, (_a = metadata === null || metadata === void 0 ? void 0 : metadata.qwik) === null || _a === void 0 ? void 0 : _a.replace);
|
|
71
|
+
return state;
|
|
72
|
+
}
|
|
73
|
+
exports.emitStateMethodsAndRewriteBindings = emitStateMethodsAndRewriteBindings;
|
|
74
|
+
const checkIsObjectWithCodeBlock = (obj) => {
|
|
75
|
+
return typeof obj == 'object' && (obj === null || obj === void 0 ? void 0 : obj.code) && typeof obj.code === 'string';
|
|
76
|
+
};
|
|
77
|
+
function getLexicalScopeVars(component) {
|
|
78
|
+
const newLocal = [
|
|
79
|
+
'props',
|
|
80
|
+
'state',
|
|
81
|
+
// all `useComputed` values
|
|
82
|
+
...Object.keys(component.state).filter((k) => component.state[k].type === 'getter'),
|
|
83
|
+
...Object.keys(component.refs),
|
|
84
|
+
...Object.keys(component.context.get),
|
|
85
|
+
];
|
|
86
|
+
return newLocal;
|
|
87
|
+
}
|
|
88
|
+
exports.getLexicalScopeVars = getLexicalScopeVars;
|
|
89
|
+
function rewriteCodeExpr(component, methodMap, lexicalArgs, replace = {}) {
|
|
90
|
+
(0, legacy_1.default)(component).forEach(function (item) {
|
|
91
|
+
if (!checkIsObjectWithCodeBlock(item)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
let code = (0, convert_method_to_function_1.convertMethodToFunction)(item.code, methodMap, lexicalArgs);
|
|
95
|
+
Object.keys(replace).forEach((key) => {
|
|
96
|
+
code = code.replace(key, replace[key]);
|
|
97
|
+
});
|
|
98
|
+
item.code = code;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function getStateMethodsAndGetters(state) {
|
|
102
|
+
const methodMap = {};
|
|
103
|
+
Object.keys(state).forEach((key) => {
|
|
104
|
+
const stateVal = state[key];
|
|
105
|
+
if ((stateVal === null || stateVal === void 0 ? void 0 : stateVal.type) === 'getter' || (stateVal === null || stateVal === void 0 ? void 0 : stateVal.type) === 'method') {
|
|
106
|
+
methodMap[key] = stateVal.type;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return methodMap;
|
|
110
|
+
}
|
|
111
|
+
exports.getStateMethodsAndGetters = getStateMethodsAndGetters;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MitosisNode } from '../../..';
|
|
2
|
+
import { SrcBuilder } from '../src-generator';
|
|
3
|
+
export type CssStyles = {
|
|
4
|
+
CLASS_NAME: string;
|
|
5
|
+
} & Record<string, string>;
|
|
6
|
+
export declare function collectStyles(children: MitosisNode[], styleMap: Map<string, CssStyles>): Map<string, CssStyles>;
|
|
7
|
+
export declare function renderStyles(styles: Map<string, CssStyles>): (this: SrcBuilder) => void;
|
|
@@ -0,0 +1,70 @@
|
|
|
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.renderStyles = exports.collectStyles = void 0;
|
|
7
|
+
const json5_1 = __importDefault(require("json5"));
|
|
8
|
+
const dash_case_1 = require("../../../helpers/dash-case");
|
|
9
|
+
function collectStyles(children, styleMap) {
|
|
10
|
+
var _a;
|
|
11
|
+
const nodes = [...children];
|
|
12
|
+
while (nodes.length) {
|
|
13
|
+
const child = nodes.shift();
|
|
14
|
+
nodes.push(...child.children);
|
|
15
|
+
const css = (_a = child.bindings.css) === null || _a === void 0 ? void 0 : _a.code;
|
|
16
|
+
if (css && typeof css == 'string') {
|
|
17
|
+
const value = { CLASS_NAME: 'c' + hashCode(css), ...json5_1.default.parse(css) };
|
|
18
|
+
styleMap.set(css, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return styleMap;
|
|
22
|
+
}
|
|
23
|
+
exports.collectStyles = collectStyles;
|
|
24
|
+
function hashCode(text) {
|
|
25
|
+
var hash = 0, i, chr;
|
|
26
|
+
if (text.length === 0)
|
|
27
|
+
return hash;
|
|
28
|
+
for (i = 0; i < text.length; i++) {
|
|
29
|
+
chr = text.charCodeAt(i);
|
|
30
|
+
hash = (hash << 5) - hash + chr;
|
|
31
|
+
hash |= 0; // Convert to 32bit integer
|
|
32
|
+
}
|
|
33
|
+
return Number(Math.abs(hash)).toString(36);
|
|
34
|
+
}
|
|
35
|
+
function renderStyles(styles) {
|
|
36
|
+
return function () {
|
|
37
|
+
this.emit('`');
|
|
38
|
+
const mediaStyles = [];
|
|
39
|
+
styles.forEach((styles) => {
|
|
40
|
+
this.emit('.', styles.CLASS_NAME, /*'.🏷️�', WS,*/ '{');
|
|
41
|
+
for (const key in styles) {
|
|
42
|
+
if (key !== 'CLASS_NAME' && Object.prototype.hasOwnProperty.call(styles, key)) {
|
|
43
|
+
const value = styles[key];
|
|
44
|
+
if (value && typeof value == 'object') {
|
|
45
|
+
mediaStyles.push(styles.CLASS_NAME, key, value);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.emit((0, dash_case_1.dashCase)(key), ':', value, ';');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
this.emit('}');
|
|
53
|
+
});
|
|
54
|
+
while (mediaStyles.length) {
|
|
55
|
+
const className = mediaStyles.shift();
|
|
56
|
+
const mediaKey = mediaStyles.shift();
|
|
57
|
+
const mediaObj = mediaStyles.shift();
|
|
58
|
+
this.emit(mediaKey, '{.', className, /*'.🏷️�',*/ '{');
|
|
59
|
+
for (const key in mediaObj) {
|
|
60
|
+
if (Object.prototype.hasOwnProperty.call(mediaObj, key)) {
|
|
61
|
+
const value = mediaObj[key];
|
|
62
|
+
this.emit((0, dash_case_1.dashCase)(key), ':', value, ';');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
this.emit('}}');
|
|
66
|
+
}
|
|
67
|
+
this.emit('`');
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
exports.renderStyles = renderStyles;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
exports.File = exports.componentToQwik = exports.createFileSet = exports.addComponent = exports.addCommonStyles = void 0;
|
|
18
|
+
var component_1 = require("./component");
|
|
19
|
+
Object.defineProperty(exports, "addCommonStyles", { enumerable: true, get: function () { return component_1.addCommonStyles; } });
|
|
20
|
+
Object.defineProperty(exports, "addComponent", { enumerable: true, get: function () { return component_1.addComponent; } });
|
|
21
|
+
Object.defineProperty(exports, "createFileSet", { enumerable: true, get: function () { return component_1.createFileSet; } });
|
|
22
|
+
var component_generator_1 = require("./component-generator");
|
|
23
|
+
Object.defineProperty(exports, "componentToQwik", { enumerable: true, get: function () { return component_generator_1.componentToQwik; } });
|
|
24
|
+
var src_generator_1 = require("./src-generator");
|
|
25
|
+
Object.defineProperty(exports, "File", { enumerable: true, get: function () { return src_generator_1.File; } });
|
|
26
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MitosisNode } from '../../types/mitosis-node';
|
|
2
|
+
import { CssStyles } from './helpers/styles';
|
|
3
|
+
import { File } from './src-generator';
|
|
4
|
+
/**
|
|
5
|
+
* Convert a Mitosis nodes to a JSX nodes.
|
|
6
|
+
*
|
|
7
|
+
* @param file File into which the output will be written to.
|
|
8
|
+
* @param directives Store for directives which we came across so that they can be imported.
|
|
9
|
+
* @param handlers A set of handlers which we came across so that they can be rendered
|
|
10
|
+
* @param children A list of children to convert to JSX
|
|
11
|
+
* @param styles Store for styles which we came across so that they can be rendered.
|
|
12
|
+
* @param key Key to be used for the node if needed
|
|
13
|
+
* @param parentSymbolBindings A set of bindings from parent to be written into the child.
|
|
14
|
+
* @param root True if this is the root JSX, and may need a Fragment wrapper.
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare function renderJSXNodes(file: File, directives: Map<string, string>, handlers: Map<string, string>, children: MitosisNode[], styles: Map<string, CssStyles>, key: string | null | undefined, parentSymbolBindings: Record<string, string>, root?: boolean): any;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderJSXNodes = void 0;
|
|
4
|
+
const is_mitosis_node_1 = require("../../helpers/is-mitosis-node");
|
|
5
|
+
const directives_1 = require("./directives");
|
|
6
|
+
const src_generator_1 = require("./src-generator");
|
|
7
|
+
/**
|
|
8
|
+
* Convert a Mitosis nodes to a JSX nodes.
|
|
9
|
+
*
|
|
10
|
+
* @param file File into which the output will be written to.
|
|
11
|
+
* @param directives Store for directives which we came across so that they can be imported.
|
|
12
|
+
* @param handlers A set of handlers which we came across so that they can be rendered
|
|
13
|
+
* @param children A list of children to convert to JSX
|
|
14
|
+
* @param styles Store for styles which we came across so that they can be rendered.
|
|
15
|
+
* @param key Key to be used for the node if needed
|
|
16
|
+
* @param parentSymbolBindings A set of bindings from parent to be written into the child.
|
|
17
|
+
* @param root True if this is the root JSX, and may need a Fragment wrapper.
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
function renderJSXNodes(file, directives, handlers, children, styles, key, parentSymbolBindings, root = true) {
|
|
21
|
+
return function () {
|
|
22
|
+
const srcBuilder = this;
|
|
23
|
+
if (children.length == 0)
|
|
24
|
+
return;
|
|
25
|
+
if (root)
|
|
26
|
+
this.emit('(');
|
|
27
|
+
const needsFragment = root &&
|
|
28
|
+
(children.length > 1 ||
|
|
29
|
+
(children.length && (isInlinedDirective(children[0]) || isTextNode(children[0]))));
|
|
30
|
+
file.import(file.qwikModule, 'h');
|
|
31
|
+
const fragmentSymbol = file.import(file.qwikModule, 'Fragment');
|
|
32
|
+
if (needsFragment) {
|
|
33
|
+
this.jsxBeginFragment(fragmentSymbol);
|
|
34
|
+
}
|
|
35
|
+
children.forEach((child) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
if (isEmptyTextNode(child))
|
|
38
|
+
return;
|
|
39
|
+
if (isTextNode(child)) {
|
|
40
|
+
const text = child.properties._text;
|
|
41
|
+
const textExpr = (_a = child.bindings._text) === null || _a === void 0 ? void 0 : _a.code;
|
|
42
|
+
if (typeof text == 'string') {
|
|
43
|
+
this.isJSX ? this.emit(text) : this.jsxTextBinding((0, src_generator_1.quote)(text));
|
|
44
|
+
}
|
|
45
|
+
else if (typeof textExpr == 'string') {
|
|
46
|
+
this.isJSX ? this.emit('{', textExpr, '}') : this.jsxTextBinding(textExpr);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (isSlotProjection(child)) {
|
|
50
|
+
this.file.import(this.file.qwikModule, 'Slot');
|
|
51
|
+
this.jsxBegin('Slot', {}, {});
|
|
52
|
+
this.jsxEnd('Slot');
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
let childName = child.name;
|
|
56
|
+
const directive = directives_1.DIRECTIVES[childName];
|
|
57
|
+
if (typeof directive == 'function') {
|
|
58
|
+
const blockFn = mitosisNodeToRenderBlock(child.children);
|
|
59
|
+
const meta = child.meta;
|
|
60
|
+
Object.keys(meta).forEach((key) => {
|
|
61
|
+
const value = meta[key];
|
|
62
|
+
if ((0, is_mitosis_node_1.isMitosisNode)(value)) {
|
|
63
|
+
blockFn[key] = mitosisNodeToRenderBlock([value]);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.emit(directive(child, blockFn));
|
|
67
|
+
!this.isJSX && this.emit(',');
|
|
68
|
+
includedHelperDirectives(directive.toString(), directives);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (childName === 'Slot') {
|
|
72
|
+
this.file.import(this.file.qwikModule, 'Slot');
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
if (typeof directive == 'string') {
|
|
76
|
+
directives.set(childName, directive);
|
|
77
|
+
includedHelperDirectives(directive, directives);
|
|
78
|
+
if (file.module !== 'med' && file.imports.hasImport(childName)) {
|
|
79
|
+
file.import('./med.js', childName);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (isSymbol(childName)) {
|
|
83
|
+
// TODO(misko): We are hard coding './med.js' which is not right.
|
|
84
|
+
!file.imports.hasImport(childName) && file.import('./med.js', childName);
|
|
85
|
+
let exportedChildName = file.exports.get(childName);
|
|
86
|
+
if (exportedChildName) {
|
|
87
|
+
childName = exportedChildName;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
let props = child.properties;
|
|
92
|
+
const css = (_b = child.bindings.css) === null || _b === void 0 ? void 0 : _b.code;
|
|
93
|
+
const specialBindings = {};
|
|
94
|
+
if (css) {
|
|
95
|
+
props = { ...props };
|
|
96
|
+
const styleProps = styles.get(css);
|
|
97
|
+
const imageMaxWidth = childName == 'Image' && styleProps.maxWidth;
|
|
98
|
+
if (imageMaxWidth && imageMaxWidth.endsWith('px')) {
|
|
99
|
+
// special case for Images. We want to make sure that we include the maxWidth in a srcset
|
|
100
|
+
specialBindings.srcsetSizes = Number.parseInt(imageMaxWidth);
|
|
101
|
+
}
|
|
102
|
+
if (styleProps === null || styleProps === void 0 ? void 0 : styleProps.CLASS_NAME) {
|
|
103
|
+
props.class = addClass(styleProps.CLASS_NAME, props.class);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
key = props['builder-id'] || key;
|
|
107
|
+
if (props.innerHTML) {
|
|
108
|
+
// Special case. innerHTML requires `key` in Qwik
|
|
109
|
+
props = {
|
|
110
|
+
key: key || 'default',
|
|
111
|
+
...props,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const symbolBindings = {};
|
|
115
|
+
const bindings = rewriteHandlers(file, handlers, child.bindings, symbolBindings);
|
|
116
|
+
this.jsxBegin(childName, props, {
|
|
117
|
+
...bindings,
|
|
118
|
+
...parentSymbolBindings,
|
|
119
|
+
...specialBindings,
|
|
120
|
+
});
|
|
121
|
+
renderJSXNodes(file, directives, handlers, child.children, styles, key, symbolBindings, false).call(this);
|
|
122
|
+
this.jsxEnd(childName);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
if (needsFragment) {
|
|
127
|
+
this.jsxEndFragment();
|
|
128
|
+
}
|
|
129
|
+
if (root)
|
|
130
|
+
this.emit(')');
|
|
131
|
+
function mitosisNodeToRenderBlock(children) {
|
|
132
|
+
return () => {
|
|
133
|
+
children = children.filter((c) => !isEmptyTextNode(c));
|
|
134
|
+
const childNeedsFragment = children.length > 1 || (children.length && isTextNode(children[0]));
|
|
135
|
+
childNeedsFragment && srcBuilder.jsxBeginFragment(fragmentSymbol);
|
|
136
|
+
renderJSXNodes(file, directives, handlers, children, styles, null, {}, false).call(srcBuilder);
|
|
137
|
+
childNeedsFragment && srcBuilder.jsxEndFragment();
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
exports.renderJSXNodes = renderJSXNodes;
|
|
143
|
+
function includedHelperDirectives(directive, directives) {
|
|
144
|
+
Array.from(directive.matchAll(/(__[\w]+__)/g)).forEach((match) => {
|
|
145
|
+
const name = match[0];
|
|
146
|
+
const code = directives_1.DIRECTIVES[name];
|
|
147
|
+
typeof code == 'string' && directives.set(name, code);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function isSymbol(name) {
|
|
151
|
+
return (name.charAt(0) === name.charAt(0).toUpperCase() &&
|
|
152
|
+
// we want to exclude any property access, as that can't be a symbol
|
|
153
|
+
!name.includes('.'));
|
|
154
|
+
}
|
|
155
|
+
function addClass(className, existingClass) {
|
|
156
|
+
return [className, ...(existingClass ? existingClass.split(' ') : [])].join(' ');
|
|
157
|
+
}
|
|
158
|
+
function isEmptyTextNode(child) {
|
|
159
|
+
var _a;
|
|
160
|
+
return ((_a = child.properties._text) === null || _a === void 0 ? void 0 : _a.trim()) == '';
|
|
161
|
+
}
|
|
162
|
+
function isTextNode(child) {
|
|
163
|
+
var _a;
|
|
164
|
+
if (child.properties._text !== undefined) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
const code = (_a = child.bindings._text) === null || _a === void 0 ? void 0 : _a.code;
|
|
168
|
+
if (code !== undefined && code !== 'props.children') {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
function isSlotProjection(child) {
|
|
174
|
+
var _a;
|
|
175
|
+
return ((_a = child.bindings._text) === null || _a === void 0 ? void 0 : _a.code) === 'props.children';
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Rewrites bindings:
|
|
179
|
+
* - Remove `css`
|
|
180
|
+
* - Rewrites event handles
|
|
181
|
+
* - Extracts symbol bindings.
|
|
182
|
+
*
|
|
183
|
+
* @param file
|
|
184
|
+
* @param handlers
|
|
185
|
+
* @param bindings
|
|
186
|
+
* @param symbolBindings Options record which will receive the symbol bindings
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
189
|
+
function rewriteHandlers(file, handlers, bindings, symbolBindings) {
|
|
190
|
+
const outBindings = {};
|
|
191
|
+
for (let key in bindings) {
|
|
192
|
+
if (Object.prototype.hasOwnProperty.call(bindings, key)) {
|
|
193
|
+
const bindingValue = bindings[key];
|
|
194
|
+
let bindingExpr = bindingValue.code;
|
|
195
|
+
const handlerBlock = handlers.get(bindingExpr);
|
|
196
|
+
if (key == 'css') {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
else if (handlerBlock) {
|
|
200
|
+
key = `${key}$`;
|
|
201
|
+
bindingExpr = (0, src_generator_1.invoke)(file.import(file.qwikModule, 'qrl'), [
|
|
202
|
+
(0, src_generator_1.quote)(file.qrlPrefix + 'high.js'),
|
|
203
|
+
(0, src_generator_1.quote)(handlerBlock),
|
|
204
|
+
file.options.isBuilder ? '[s,l]' : '[state]',
|
|
205
|
+
]);
|
|
206
|
+
}
|
|
207
|
+
else if (symbolBindings && key.startsWith('symbol.data.')) {
|
|
208
|
+
symbolBindings[(0, src_generator_1.lastProperty)(key)] = bindingExpr;
|
|
209
|
+
}
|
|
210
|
+
else if (key.startsWith('component.options.')) {
|
|
211
|
+
key = (0, src_generator_1.lastProperty)(key);
|
|
212
|
+
}
|
|
213
|
+
outBindings[key] = {
|
|
214
|
+
...bindingValue,
|
|
215
|
+
code: bindingExpr,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return outBindings;
|
|
220
|
+
}
|
|
221
|
+
function isInlinedDirective(node) {
|
|
222
|
+
return ((0, is_mitosis_node_1.isMitosisNode)(node) && node.name == 'Show') || node.name == 'For';
|
|
223
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export interface SrcBuilderOptions {
|
|
2
|
+
isPretty: boolean;
|
|
3
|
+
isTypeScript: boolean;
|
|
4
|
+
isModule: boolean;
|
|
5
|
+
isJSX: boolean;
|
|
6
|
+
isBuilder: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type EmitFn = (this: SrcBuilder) => void;
|
|
9
|
+
export declare class File {
|
|
10
|
+
filename: string;
|
|
11
|
+
imports: Imports;
|
|
12
|
+
options: SrcBuilderOptions;
|
|
13
|
+
src: SrcBuilder;
|
|
14
|
+
qwikModule: string;
|
|
15
|
+
qrlPrefix: string;
|
|
16
|
+
exports: Map<string, string>;
|
|
17
|
+
get module(): string;
|
|
18
|
+
get path(): string;
|
|
19
|
+
get contents(): string;
|
|
20
|
+
constructor(filename: string, options: SrcBuilderOptions, qwikModule: string, qrlPrefix: string);
|
|
21
|
+
import(module: string, symbol: string, as?: string): Symbol;
|
|
22
|
+
toQrlChunk(): string;
|
|
23
|
+
exportConst(name: string, value?: any, locallyVisible?: boolean): void;
|
|
24
|
+
exportDefault(symbolName: any): void;
|
|
25
|
+
toString(): string;
|
|
26
|
+
}
|
|
27
|
+
export declare class SrcBuilder {
|
|
28
|
+
file: File;
|
|
29
|
+
isTypeScript: boolean;
|
|
30
|
+
isModule: boolean;
|
|
31
|
+
isJSX: boolean;
|
|
32
|
+
buf: string[];
|
|
33
|
+
jsxDepth: number;
|
|
34
|
+
/**
|
|
35
|
+
* Used to signal that we are generating code for Builder.
|
|
36
|
+
*
|
|
37
|
+
* In builder the `<For/>` iteration places the value on the state.
|
|
38
|
+
*/
|
|
39
|
+
isBuilder: any;
|
|
40
|
+
constructor(file: File, options: SrcBuilderOptions);
|
|
41
|
+
import(module: string, symbols: Symbol[]): this;
|
|
42
|
+
emit(...values: any[]): this;
|
|
43
|
+
private push;
|
|
44
|
+
emitList(values: any[], sep?: string): this;
|
|
45
|
+
const(name: string, value?: any, export_?: boolean, locallyVisible?: boolean): this;
|
|
46
|
+
type(def: string): this;
|
|
47
|
+
typeParameters(typeParameters: string[] | undefined): void;
|
|
48
|
+
jsxExpression(expression: EmitFn): void;
|
|
49
|
+
jsxBegin(symbol: Symbol | string, props: Record<string, any>, bindings: Record<string, any>): void;
|
|
50
|
+
isSelfClosingTag(symbol: Symbol | string): boolean;
|
|
51
|
+
jsxEnd(symbol: Symbol | string): void;
|
|
52
|
+
jsxBeginFragment(symbol: Symbol): void;
|
|
53
|
+
jsxEndFragment(): void;
|
|
54
|
+
jsxTextBinding(exp: string): void;
|
|
55
|
+
toString(): string;
|
|
56
|
+
}
|
|
57
|
+
export declare class Symbol {
|
|
58
|
+
importName: string;
|
|
59
|
+
localName: string;
|
|
60
|
+
constructor(importName: string, localName: string);
|
|
61
|
+
}
|
|
62
|
+
export declare class Imports {
|
|
63
|
+
imports: Map<string, Map<string, Symbol>>;
|
|
64
|
+
get(moduleName: string, symbolName: string, asVar?: string): Symbol;
|
|
65
|
+
hasImport(localName: string): boolean;
|
|
66
|
+
}
|
|
67
|
+
export declare function quote(text: string): string;
|
|
68
|
+
export declare function invoke(symbol: Symbol | string, args: any[], typeParameters?: string[]): (this: SrcBuilder) => void;
|
|
69
|
+
export declare function arrowFnBlock(args: string[], statements: any[], argTypes?: string[]): (this: SrcBuilder) => void;
|
|
70
|
+
export declare function arrowFnValue(args: string[], expression: any): (this: SrcBuilder) => void;
|
|
71
|
+
export declare function iif(code: any): ((this: SrcBuilder) => void) | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Returns `true` if the code is a statement (rather than expression).
|
|
74
|
+
*
|
|
75
|
+
* Code is an expression if it is a list of identifiers all connected with a valid separator
|
|
76
|
+
* identifier: [a-z_$](a-z0-9_$)*
|
|
77
|
+
* separator: [()[]{}.-+/*,]
|
|
78
|
+
*
|
|
79
|
+
* it is not 100% but a good enough approximation
|
|
80
|
+
*/
|
|
81
|
+
export declare function isStatement(code: string): boolean;
|
|
82
|
+
export declare function lastProperty(expr: string): string;
|
|
83
|
+
export declare function iteratorProperty(expr: string): string;
|