diff --git a/packages/components/plugins/power-apps/index.js b/packages/components/plugins/power-apps/index.js index 5322dbbf9fb..2d5aebab21a 100644 --- a/packages/components/plugins/power-apps/index.js +++ b/packages/components/plugins/power-apps/index.js @@ -1,5 +1,5 @@ -const ChildProcess = require('child_process'); -const Buff = require('buffer'); +const ChildProcess = require('node:child_process'); +const Buff = require('node:buffer'); module.exports = () => ({ json: { diff --git a/packages/components/scripts/post-build/copy-files.js b/packages/components/scripts/post-build/copy-files.js index 398a61098f2..41c70995e1d 100644 --- a/packages/components/scripts/post-build/copy-files.js +++ b/packages/components/scripts/post-build/copy-files.js @@ -2,14 +2,14 @@ const Fse = require('fs-extra'); const Frameworks = require('./framworks'); module.exports = () => { - [ + for (const file of [ 'package.json', 'angular.json', 'tsconfig.json', 'ng-package.json', 'vite.config.ts' - ].forEach((file) => { - Frameworks.forEach((framework) => { + ]) { + for (const framework of Frameworks) { const resolvedFramework = framework === 'vue' ? `vue/vue3` : framework; if ( @@ -20,6 +20,6 @@ module.exports = () => { `../../output/${resolvedFramework}/${file}` ); } - }); - }); + } + } }; diff --git a/packages/components/scripts/post-build/react.js b/packages/components/scripts/post-build/react.js index f9898a2ea69..c15cf6f9a88 100644 --- a/packages/components/scripts/post-build/react.js +++ b/packages/components/scripts/post-build/react.js @@ -6,7 +6,7 @@ module.exports = () => { try { const cleanName = component.name .split('-') - .map((part) => `${part[0].toUpperCase()}${part.substring(1)}`) + .map((part) => `${part[0].toUpperCase()}${part.slice(1)}`) .join(''); const stateName = `DB${cleanName}State`; @@ -32,14 +32,14 @@ module.exports = () => { ]; } - replacements.forEach((replacement) => { + for (const replacement of replacements) { const option = { files: tsxFile, from: replacement.from, to: replacement.to }; Replace.replaceInFileSync(option); - }); + } } catch (error) { console.error('Error occurred:', error); } diff --git a/packages/components/scripts/post-build/vue.js b/packages/components/scripts/post-build/vue.js index b6859e827c6..ea4b6bb2f21 100644 --- a/packages/components/scripts/post-build/vue.js +++ b/packages/components/scripts/post-build/vue.js @@ -63,14 +63,14 @@ module.exports = () => { ]; } - replacements.forEach((replacement) => { + for (const replacement of replacements) { const option = { files: vueFile, from: replacement.from, to: replacement.to }; Replace.replaceInFileSync(option); - }); + } } catch (error) { console.error('Error occurred:', error); } diff --git a/packages/components/src/components/button/button.lite.tsx b/packages/components/src/components/button/button.lite.tsx index 41bf03d8720..39ad39d45c1 100644 --- a/packages/components/src/components/button/button.lite.tsx +++ b/packages/components/src/components/button/button.lite.tsx @@ -1,6 +1,6 @@ import { onMount, Show, useMetadata, useStore } from '@builder.io/mitosis'; -import type { DBButtonProps, DBButtonState } from './model'; import { DBIcon } from '../icon'; +import type { DBButtonProps, DBButtonState } from './model'; useMetadata({ isAttachedToShadowDom: true, diff --git a/packages/components/src/components/button/model.ts b/packages/components/src/components/button/model.ts index 8cfd5108dd6..0aea9e36206 100644 --- a/packages/components/src/components/button/model.ts +++ b/packages/components/src/components/button/model.ts @@ -1,8 +1,8 @@ import { - ClickEventProps, - ClickEventState, - GlobalProps, - GlobalState + type ClickEventProps, + type ClickEventState, + type GlobalProps, + type GlobalState } from '../../shared/model'; export type DBButtonDefaultProps = { diff --git a/packages/components/src/components/card/model.ts b/packages/components/src/components/card/model.ts index 248b9edf8b4..376e7a5e7f2 100644 --- a/packages/components/src/components/card/model.ts +++ b/packages/components/src/components/card/model.ts @@ -1,9 +1,9 @@ import { - ClickEventProps, - ClickEventState, - GlobalProps, - GlobalState, - ImageProps + type ClickEventProps, + type ClickEventState, + type GlobalProps, + type GlobalState, + type ImageProps } from '../../shared/model'; export type DBCardDefaultProps = { diff --git a/packages/components/src/components/divider/divider.lite.tsx b/packages/components/src/components/divider/divider.lite.tsx index bd76b692a83..1214b86171c 100644 --- a/packages/components/src/components/divider/divider.lite.tsx +++ b/packages/components/src/components/divider/divider.lite.tsx @@ -1,5 +1,5 @@ import { onMount, Show, useMetadata, useStore } from '@builder.io/mitosis'; -import { DBDividerState, DBDividerProps } from './model'; +import { type DBDividerState, type DBDividerProps } from './model'; useMetadata({ isAttachedToShadowDom: true, diff --git a/packages/components/src/components/divider/model.ts b/packages/components/src/components/divider/model.ts index 0de6f2f2adb..be9c7947a2b 100644 --- a/packages/components/src/components/divider/model.ts +++ b/packages/components/src/components/divider/model.ts @@ -1,9 +1,9 @@ -import { GlobalProps, GlobalState } from '../../shared/model'; +import { type GlobalProps, type GlobalState } from '../../shared/model'; -export interface DBDividerDefaultProps { +export type DBDividerDefaultProps = { margin?: 'none' | '_'; variant?: 'horizontal' | 'vertical'; -} +}; export type DBDividerProps = DBDividerDefaultProps & GlobalProps; diff --git a/packages/components/src/components/icon/model.ts b/packages/components/src/components/icon/model.ts index f3e5904f051..9ce110e26c3 100644 --- a/packages/components/src/components/icon/model.ts +++ b/packages/components/src/components/icon/model.ts @@ -1,4 +1,4 @@ -import { GlobalProps, GlobalState } from '../../shared/model'; +import { type GlobalProps, type GlobalState } from '../../shared/model'; export type DBIconDefaultProps = { icon?: string; diff --git a/packages/components/src/components/input/input.lite.tsx b/packages/components/src/components/input/input.lite.tsx index 930d337b29e..8fb1d239f91 100644 --- a/packages/components/src/components/input/input.lite.tsx +++ b/packages/components/src/components/input/input.lite.tsx @@ -5,9 +5,9 @@ import { useRef, useStore } from '@builder.io/mitosis'; -import { DBInputState, DBInputProps, iconVariants } from './model'; import { DBIcon } from '../icon'; import { DEFAULT_ID, uuid } from '../../utils'; +import { type DBInputState, type DBInputProps, iconVariants } from './model'; useMetadata({ isAttachedToShadowDom: false, @@ -29,6 +29,7 @@ export default function DBInput(props: DBInputProps) { if (props.onChange) { props.onChange(event); } + if (props.change) { props.change(event); } @@ -47,6 +48,7 @@ export default function DBInput(props: DBInputProps) { if (props.onBlur) { props.onBlur(event); } + if (props.blur) { props.blur(event); } @@ -55,6 +57,7 @@ export default function DBInput(props: DBInputProps) { if (props.onFocus) { props.onFocus(event); } + if (props.focus) { props.focus(event); } @@ -62,11 +65,7 @@ export default function DBInput(props: DBInputProps) { }); onMount(() => { - if (props.id) { - state.mId = props.id; - } else { - state.mId = 'input-' + uuid(); - } + state.mId = props.id ? props.id : 'input-' + uuid(); if (props.value) { state._value = props.value; diff --git a/packages/components/src/components/input/model.ts b/packages/components/src/components/input/model.ts index e4ee819cf38..1af180f2864 100644 --- a/packages/components/src/components/input/model.ts +++ b/packages/components/src/components/input/model.ts @@ -1,14 +1,12 @@ import { - FocusEventProps, - FocusEventState, - GlobalTextProps, - ValidEventProps -} from '../../shared/model'; -import { - ChangeEventState, - ChangeEventProps, - GlobalProps, - GlobalState + type FocusEventProps, + type FocusEventState, + type GlobalTextProps, + type ValidEventProps, + type ChangeEventState, + type ChangeEventProps, + type GlobalProps, + type GlobalState } from '../../shared/model'; export type DBInputDefaultProps = { diff --git a/packages/components/src/components/tab-bar/model.ts b/packages/components/src/components/tab-bar/model.ts index 29280d0e539..ca936e576a5 100644 --- a/packages/components/src/components/tab-bar/model.ts +++ b/packages/components/src/components/tab-bar/model.ts @@ -1,5 +1,5 @@ import type { DBTabProps } from '../tab/model'; -import { GlobalProps, GlobalState } from '../../shared/model'; +import { type GlobalProps, type GlobalState } from '../../shared/model'; export type DBTabBarDefaultProps = { /** diff --git a/packages/components/src/components/tab-bar/tab-bar.lite.tsx b/packages/components/src/components/tab-bar/tab-bar.lite.tsx index 27a9ae6753b..c517cc9a098 100644 --- a/packages/components/src/components/tab-bar/tab-bar.lite.tsx +++ b/packages/components/src/components/tab-bar/tab-bar.lite.tsx @@ -1,7 +1,7 @@ import { For, onMount, Show, useMetadata, useStore } from '@builder.io/mitosis'; -import type { DBTabBarState, DBTabBarProps } from './model'; import { DBTab } from '../tab'; import type { DBTabProps } from '../tab/model'; +import type { DBTabBarState, DBTabBarProps } from './model'; useMetadata({ isAttachedToShadowDom: true, diff --git a/packages/components/src/components/tab/model.ts b/packages/components/src/components/tab/model.ts index 1e6477e2df5..909d63f6215 100644 --- a/packages/components/src/components/tab/model.ts +++ b/packages/components/src/components/tab/model.ts @@ -1,4 +1,4 @@ -import { GlobalProps, GlobalState } from '../../shared/model'; +import { type GlobalProps, type GlobalState } from '../../shared/model'; export type DBTabDefaultProps = { /**