Skip to content

Commit

Permalink
chore: update from main
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Nov 1, 2024
1 parent d3ff8d3 commit d8e4a11
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .changeset/two-crabs-approve.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@builder.io/mitosis': patch
---

fix: remove mapping onChange to input event for agular, lit, stencil and html
[Angular, Lit, Stencil, HTML] fix: remove mapping onChange to input event
1 change: 0 additions & 1 deletion packages/core/src/generators/html/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { hasComponent } from '../../helpers/has-component';
import { hasProps } from '../../helpers/has-props';
import { hasStatefulDom } from '../../helpers/has-stateful-dom';
import isChildren from '../../helpers/is-children';
import { isComponent } from '../../helpers/is-component';
import { isHtmlAttribute } from '../../helpers/is-html-attribute';
import { isMitosisNode } from '../../helpers/is-mitosis-node';
import { mapRefs } from '../../helpers/map-refs';
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/generators/lit/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ const blockToLit = (json: MitosisNode, options: ToLitOptions = {}): string => {
// https://lit.dev/docs/templates/directives/#ref
str += ` ref="${code}" `;
} else if (key.startsWith('on')) {
let useKey = key === 'onChange' && json.name === 'input' ? 'onInput' : key;
const asyncKeyword = json.bindings[key]?.async ? 'async ' : '';
useKey = '@' + useKey.substring(2).toLowerCase();
const useKey = '@' + key.substring(2).toLowerCase();

str += ` ${useKey}=\${${asyncKeyword}(${cusArgs.join(',')}) => ${processBinding(
code as string,
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/generators/stencil/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ export const blockToStencil = (
// TODO: Add correct type here
str += ` ref={(el) => ${code.startsWith('this.') ? code : `this.${code}`} = el} `;
} else if (isEvent(key)) {
const useKey = key === 'onChange' && blockName === 'input' ? 'onInput' : key;
const asyncKeyword = json.bindings[key]?.async ? 'async ' : '';
str += ` ${useKey}={${asyncKeyword}(${cusArgs.join(',')}) => ${code}} `;
str += ` ${key}={${asyncKeyword}(${cusArgs.join(',')}) => ${code}} `;
} else {
str += ` ${key}={${code}} `;
}
Expand Down

0 comments on commit d8e4a11

Please sign in to comment.