Skip to content

Commit

Permalink
refactor(mobile): remove @opentiny/mobile-utils package, and add alia… (
Browse files Browse the repository at this point in the history
#2767)

* refactor(mobile): remove @opentiny/mobile-utils package, and add alias to utils

* refactor(mobile): fix pnpm dev
shenjunjian authored Jan 9, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6eb80f1 commit 3502466
Showing 118 changed files with 204 additions and 207 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ module.exports = {
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-invalid-this': 'off',
'vue/no-deprecated-dollar-scopedslots-api': 'off',
'@typescript-eslint/lines-between-class-members': 'off'
'@typescript-eslint/lines-between-class-members': 'off',
'@typescript-eslint/no-this-alias': 'off'
}
}
1 change: 1 addition & 0 deletions examples/sites/vite.config.ts
Original file line number Diff line number Diff line change
@@ -135,6 +135,7 @@ export default defineConfig((config) => {
resolve: {
extensions: ['.js', '.ts', '.tsx', '.vue'],
alias: {
'@mobile-root': pathFromWorkspaceRoot('packages/mobile'),
'@': path.resolve('src'),
'@demos': path.resolve(`${demosPath}`),
'@menu': menuPath,
1 change: 1 addition & 0 deletions examples/vue3/vite.config.ts
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ export default defineConfig((config) => {
resolve: {
extensions: ['.js', '.ts', '.tsx', '.vue'],
alias: {
'@mobile-root': pathFromWorkspaceRoot('packages/mobile'),
'vue': path.resolve('node_modules/vue/dist/vue.esm-bundler.js'),
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
'@': pathFromWorkspaceRoot('examples/docs/newsrc'),
2 changes: 1 addition & 1 deletion packages/mobile/components/action-sheet/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { $prefix, setup, defineComponent } from '../../../vue-common'
import { $prefix, setup, defineComponent } from '@mobile-root/vue-common'
import '@opentiny/vue-theme-mobile/action-sheet/index.less'
import BScroll from '@better-scroll/core'
import { actionSheetProps } from './action-sheet'
2 changes: 1 addition & 1 deletion packages/mobile/components/alert/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { setup, defineComponent } from '../../../vue-common'
import { setup, defineComponent } from '@mobile-root/vue-common'
import { iconClose, iconSuccess, iconError, iconHelp, iconWarningTriangle } from '@opentiny/vue-icon'
import type { IAlertApi } from './alert'
import { alertProps } from './alert'
2 changes: 1 addition & 1 deletion packages/mobile/components/avatar/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
*
-->
<script lang="tsx">
import { $prefix, setup, h, defineComponent } from '../../../vue-common'
import { $prefix, setup, h, defineComponent } from '@mobile-root/vue-common'
import { renderless, api } from './renderless/vue'
import '@opentiny/vue-theme-mobile/avatar/index.less'

2 changes: 1 addition & 1 deletion packages/mobile/components/badge/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { setup, defineComponent } from '../../../vue-common'
import { setup, defineComponent } from '@mobile-root/vue-common'
import { badgeProps } from './badge'
import '@opentiny/vue-theme-mobile/badge/index.less'

2 changes: 1 addition & 1 deletion packages/mobile/components/badge/src/renderless/vue.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
*/

import { computedContent, computedValueRef, computedTransform } from './index'
import { xss } from '@opentiny/mobile-utils/xss'
import { xss } from '@mobile-root/utils/xss'
import type { IBadgeState, IBadgeProps, IBadgeApi, IBadgeRenderlessParams } from '../badge'

export const api = ['state']
2 changes: 1 addition & 1 deletion packages/mobile/components/button/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { setup, defineComponent } from '../../../vue-common'
import { setup, defineComponent } from '@mobile-root/vue-common'
import { buttonProps } from './button'
import '@opentiny/vue-theme-mobile/button/index.less'

2 changes: 1 addition & 1 deletion packages/mobile/components/button/src/renderless/index.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
*
*/
import type { IButtonRenderlessParams, IButtonState } from '../button'
import { xss } from '@opentiny/mobile-utils'
import { xss } from '@mobile-root/utils'

export const handleClick =
({ emit, props, state }: Pick<IButtonRenderlessParams, 'emit' | 'props' | 'state'>) =>
2 changes: 1 addition & 1 deletion packages/mobile/components/checkbox-group/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@

<script lang="tsx">
import { renderless, api } from './renderless/vue'
import { $prefix, setup, defineComponent } from '../../../vue-common'
import { $prefix, setup, defineComponent } from '@mobile-root/vue-common'
import Checkbox from '../../checkbox'
import { CheckboxGroupProps } from './checkbox-group'
import '@opentiny/vue-theme-mobile/checkbox-group/index.less'
4 changes: 2 additions & 2 deletions packages/mobile/components/checkbox/src/checkbox.ts
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
import { $prefix } from '../../../vue-common'
import type { PropType } from '../../../vue-common'
import { $prefix } from '@mobile-root/vue-common'
import type { PropType } from '@mobile-root/vue-common'
import type { ExtractPropTypes, ComputedRef } from 'vue'
import type { ISharedRenderlessFunctionParams, ISharedRenderlessParamUtils } from '../../../types/shared.type'

2 changes: 1 addition & 1 deletion packages/mobile/components/checkbox/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { $prefix, setup, defineComponent } from '../../../vue-common'
import { $prefix, setup, defineComponent } from '@mobile-root/vue-common'
import { checkboxProps } from './checkbox'
import '@opentiny/vue-theme-mobile/checkbox/index.less'

Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
*/

import type { ICheckboxRenderlessParams, ICheckboxState, ICheckboxChangeEvent, ICheckboxProps } from '../checkbox'
import { isNull } from '@opentiny/mobile-utils/type'
import { isNull } from '@mobile-root/utils/type'

export const addToStore =
({ state, props }: Pick<ICheckboxRenderlessParams, 'state' | 'props'>) =>
2 changes: 1 addition & 1 deletion packages/mobile/components/container/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { setup, defineComponent } from '../../../vue-common'
import { setup, defineComponent } from '@mobile-root/vue-common'
import { containerProps } from './container'
import '@opentiny/vue-theme-mobile/container/index.less'

4 changes: 2 additions & 2 deletions packages/mobile/components/container/src/renderless/index.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
*
*/

import { isNumber } from '@opentiny/mobile-utils/type'
import { isNumber } from '@mobile-root/utils/type'

export const computedShowHeader =
({ constants, props }) =>
@@ -128,7 +128,7 @@ export const computedLeftStyle =
export const computedShowRight =
({ constants, props }) =>
() => {
return props.pattern === constants.DEFAULT ? false : true
return props.pattern !== constants.DEFAULT
}

export const computedRightStyle =
3 changes: 2 additions & 1 deletion packages/mobile/components/date-picker/src/date-picker.ts
Original file line number Diff line number Diff line change
@@ -9,10 +9,11 @@
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
import type { PropType } from '../../../vue-common'
import type { PropType } from '@mobile-root/vue-common'
import { iconClose } from '@opentiny/vue-icon'
import type { ComputedRef, ExtractPropTypes } from 'vue'
import type { ISharedRenderlessFunctionParams, ISharedRenderlessParamUtils } from '../../../types/shared.type'

export type { ISharedRenderlessParamHooks } from '../../../types/shared.type'

const currentYear = new Date().getFullYear()
2 changes: 1 addition & 1 deletion packages/mobile/components/date-picker/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@
</template>

<script lang="ts">
import { props, setup, defineComponent } from '../../../vue-common'
import { props, setup, defineComponent } from '@mobile-root/vue-common'
import { renderless, api } from './renderless/vue'
import MiniPicker from '../../mini-picker'
import Input from '../../input'
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ import {
onChange,
updateColumnValue
} from './index'
import { DATE } from '@opentiny/mobile-utils'
import { DATE } from '@mobile-root/utils'
import type {
IDatePickerApi,
IDatePickerProps,
2 changes: 1 addition & 1 deletion packages/mobile/components/dialog-box/src/dialog-box.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
*
*/

import { $prefix } from '../../../vue-common'
import { $prefix } from '@mobile-root/vue-common'
import type { ExtractPropTypes } from 'vue'
import type {
handleCancel,
2 changes: 1 addition & 1 deletion packages/mobile/components/dialog-box/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { setup, defineComponent } from '../../../vue-common'
import { setup, defineComponent } from '@mobile-root/vue-common'
import { dialogBoxProps } from './dialog-box'
import '@opentiny/vue-theme-mobile/dialog-box/index.less'

6 changes: 3 additions & 3 deletions packages/mobile/components/dialog-box/src/renderless/index.ts
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@
*
*/

import { on, off, addClass, removeClass } from '@opentiny/mobile-utils/deps/dom'
import { emitEvent } from '@opentiny/mobile-utils/event'
import { getDomNode } from '@opentiny/mobile-utils/deps/dom'
import { on, off, addClass, removeClass } from '@mobile-root/utils/deps/dom'
import { emitEvent } from '@mobile-root/utils/event'
import { getDomNode } from '@mobile-root/utils/deps/dom'
import type { IDialogBoxRenderlessParams, IDialogBoxStyle } from '../dialog-box'

export const computedAnimationName =
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ import {
hideScrollbar,
computedBodyStyle
} from './index'
import usePopup from '@opentiny/mobile-utils/deps/vue-popup'
import usePopup from '@mobile-root/utils/deps/vue-popup'
import type {
IDialogBoxApi,
IDialogBoxProps,
4 changes: 2 additions & 2 deletions packages/mobile/components/dropdown-item/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -99,11 +99,11 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { setup, defineComponent, directive } from '../../../vue-common'
import { setup, defineComponent, directive } from '@mobile-root/vue-common'
import { iconYes } from '@opentiny/vue-icon'
import Popup from '../../popup'
import Button from '../../button'
import Clickoutside from '@opentiny/mobile-utils/deps/clickoutside'
import Clickoutside from '@mobile-root/utils/deps/clickoutside'
import '@opentiny/vue-theme-mobile/dropdown-item/index.less'
import { dropdownItemProps } from './dropdown-item'

Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ import type {
IDropdownItemTag,
IDropdownItemOptionStyle
} from '../dropdown-item'
import { on, off } from '@opentiny/mobile-utils/deps/dom'
import { on, off } from '@mobile-root/utils/deps/dom'

export const getTitle = (props: IDropdownItemRenderlessParams['props']) => (): string => {
if (props.title) {
8 changes: 4 additions & 4 deletions packages/mobile/components/dropdown-menu/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -51,8 +51,8 @@
item.type === 'filter'
? 'IconUnfilter'
: item.type === 'selection' && item.state.showPopup
? 'IconUp'
: 'IconDown'
? 'IconUp'
: 'IconDown'
"
:class="[item.type === 'filter' ? 'filter-icon' : '']"
/>
@@ -68,10 +68,10 @@

<script lang="ts">
import { renderless, api } from './renderless/vue'
import { setup, defineComponent, directive } from '../../../vue-common'
import { setup, defineComponent, directive } from '@mobile-root/vue-common'
import { iconUp, iconDown, iconUnfilter, iconSort, iconDeltaDown, iconDeltaUp } from '@opentiny/vue-icon'
import { dropdownMenuProps } from './dropdown-menu'
import Clickoutside from '@opentiny/mobile-utils/deps/clickoutside'
import Clickoutside from '@mobile-root/utils/deps/clickoutside'
import '@opentiny/vue-theme-mobile/dropdown-menu/index.less'

export default defineComponent({
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
*/

import type { IDropdownMenuRenderlessParams, IDropdownMenuPopperParams, IDropdownItemVm } from '../dropdown-menu'
import userPopper from '@opentiny/mobile-utils/deps/vue-popper'
import userPopper from '@mobile-root/utils/deps/vue-popper'

export const toggleItem =
(state: IDropdownMenuRenderlessParams['state']) =>
2 changes: 1 addition & 1 deletion packages/mobile/components/exception/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@

<script>
import { renderless, api } from './renderless/vue'
import { setup, $prefix, defineComponent } from '../../../vue-common'
import { setup, $prefix, defineComponent } from '@mobile-root/vue-common'
import Button from '../../button'
import { exceptionProps } from './exception'
import '@opentiny/vue-theme-mobile/exception/index.less'
2 changes: 1 addition & 1 deletion packages/mobile/components/file-upload/src/file-upload.ts
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ import type {
} from './renderless'
import type { downloadFile as ordinaryDownload } from '../../upload-list/src/upload-list'
import type { IUploadFormData } from '../../upload/src/upload'
import { $props } from '../../../vue-common'
import { $props } from '@mobile-root/vue-common'

export type { ISharedRenderlessParamHooks } from '../../../types/shared.type'

2 changes: 1 addition & 1 deletion packages/mobile/components/file-upload/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
-->
<script lang="tsx">
import { renderless, api } from './renderless/vue'
import { setup, h, defineComponent } from '../../../vue-common'
import { setup, h, defineComponent } from '@mobile-root/vue-common'
import UploadList from '../../upload-list'
import Upload from '../../upload'
import { iconUpload } from '@opentiny/vue-icon'
10 changes: 5 additions & 5 deletions packages/mobile/components/file-upload/src/renderless/index.ts
Original file line number Diff line number Diff line change
@@ -29,11 +29,11 @@ import type {
IFileUploadLargeDocumentDownload
} from '../file-upload'

import { extend } from '@opentiny/mobile-utils/object'
import { xss, log } from '@opentiny/mobile-utils/xss'
import uploadAjax from '@opentiny/mobile-utils/deps/upload-ajax'
import { isObject } from '@opentiny/mobile-utils/type'
import { isEmptyObject } from '@opentiny/mobile-utils/type'
import { extend } from '@mobile-root/utils/object'
import { xss, log } from '@mobile-root/utils/xss'
import uploadAjax from '@mobile-root/utils/deps/upload-ajax'
import { isObject } from '@mobile-root/utils/type'
import { isEmptyObject } from '@mobile-root/utils/type'

let initTokenPromise = null

4 changes: 2 additions & 2 deletions packages/mobile/components/file-upload/src/renderless/vue.ts
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import type {
IFileUploadStreamsaver
} from '../file-upload'
import { downloadFile as ordinaryDownload } from '../../../upload-list/src/renderless'
import { formatFileSize } from '@opentiny/mobile-utils/string'
import { formatFileSize } from '@mobile-root/utils/string'

import {
initService,
@@ -96,7 +96,7 @@ import {
closeRecordPanel,
getTipMessage
} from './index'
import { isEmptyObject } from '@opentiny/mobile-utils/type'
import { isEmptyObject } from '@mobile-root/utils/type'

export const api = [
'state',
2 changes: 1 addition & 1 deletion packages/mobile/components/form-item/src/label-wrap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setup, h, $props, defineComponent } from '../../../vue-common'
import { setup, h, $props, defineComponent } from '@mobile-root/vue-common'

export default defineComponent({
props: {
2 changes: 1 addition & 1 deletion packages/mobile/components/form-item/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
*
-->
<script lang="tsx">
import { $prefix, setup, parseVnode, h, defineComponent, isVue2 } from '../../../vue-common'
import { $prefix, setup, parseVnode, h, defineComponent, isVue2 } from '@mobile-root/vue-common'
import { renderless, api } from './renderless/vue'
import LabelWrap from './label-wrap'
import Tooltip from '../../tooltip'
12 changes: 6 additions & 6 deletions packages/mobile/components/form-item/src/renderless/index.ts
Original file line number Diff line number Diff line change
@@ -10,12 +10,12 @@
*
*/

import { POSITION, VALIDATE_STATE } from '@opentiny/mobile-utils'
import { omitText } from '@opentiny/mobile-utils/string'
import { merge } from '@opentiny/mobile-utils/object'
import Validator from '@opentiny/mobile-utils/validate'
import { isNull } from '@opentiny/mobile-utils/type'
import debounce from '@opentiny/mobile-utils/deps/debounce'
import { POSITION, VALIDATE_STATE } from '@mobile-root/utils'
import { omitText } from '@mobile-root/utils/string'
import { merge } from '@mobile-root/utils/object'
import Validator from '@mobile-root/utils/validate'
import { isNull } from '@mobile-root/utils/type'
import debounce from '@mobile-root/utils/deps/debounce'
import type {
IFormItemRenderlessParams,
IFormItemDisplayedValueParam,
2 changes: 1 addition & 1 deletion packages/mobile/components/form/src/mobile.vue
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@

<script lang="tsx">
import { renderless, api } from './renderless/vue'
import { $prefix, setup, defineComponent } from '../../../vue-common'
import { $prefix, setup, defineComponent } from '@mobile-root/vue-common'
import type { IFormApi } from '@opentiny/vue-renderless/types/form.type'
import { formProps } from './form'
import '@opentiny/vue-theme-mobile/form/index.less'
2 changes: 1 addition & 1 deletion packages/mobile/components/form/src/renderless/index.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
*
*/

import { merge } from '@opentiny/mobile-utils/object'
import { merge } from '@mobile-root/utils/object'

import type { IFormRenderlessParams } from '../form'

Loading

0 comments on commit 3502466

Please sign in to comment.