Skip to content

Commit

Permalink
fix: 更新类型引入
Browse files Browse the repository at this point in the history
  • Loading branch information
orziz authored and BeADre committed Jun 25, 2021
1 parent eb731f7 commit b1636f3
Show file tree
Hide file tree
Showing 130 changed files with 197 additions and 188 deletions.
2 changes: 1 addition & 1 deletion packages/varlet-cli/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default defineComponent({
</style>
`
const indexTemplate = `\
import { App } from 'vue'
import type { App } from 'vue'
import ${bigCamelize(name)} from './${bigCamelize(name)}.vue'
${bigCamelize(name)}.install = function(app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-cli/src/compiler/compileTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function compileTypes() {
})

const template = `\
import { App } from 'vue'
import type { App } from 'vue'
export const install: (app: App) => void
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/action-sheet/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import VarActionSheet from './ActionSheet.vue'
import { App, nextTick, reactive } from 'vue'
import { nextTick, reactive } from 'vue'
import type { App } from 'vue'
import { inBrowser } from '../utils/shared'
import { mountInstance } from '../utils/components'

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/action-sheet/props.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pickProps } from '../utils/components'
import { props as popupProps } from '../popup/props'
import { PropType } from 'vue'
import type { PropType } from 'vue'
import { ActionItem } from './index'

export const props = {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/app-bar/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import AppBar from './AppBar.vue'

AppBar.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/back-top/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import BackTop from './BackTop.vue'

BackTop.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/badge/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Badge from './Badge.vue'

Badge.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Button from './Button.vue'

Button.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/button/props.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { props as loadingProps } from '../loading/props'
import { pickProps } from '../utils/components'
import { PropType } from 'vue'
import type { PropType } from 'vue'

function typeValidator(type: string): boolean {
return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type)
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/card/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Card from './Card.vue'

Card.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/card/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

function fitValidator(fit: string) {
return ['fill', 'contain', 'cover', 'none', 'scale-down'].includes(fit)
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/cell/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Cell from './Cell.vue'

Cell.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/checkbox-group/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import CheckboxGroup from './CheckboxGroup.vue'

CheckboxGroup.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/checkbox-group/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

export type ValidateTriggers = 'onChange'

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/checkbox-group/provide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComputedRef } from 'vue'
import type { ComputedRef } from 'vue'
import { Validation } from '../form/provide'
import { useAtChildrenCounter, useChildren } from '../utils/components'
import { CheckboxProvider } from '../checkbox/provide'
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/checkbox/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Checkbox from './Checkbox.vue'

Checkbox.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/checkbox/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

export type ValidateTriggers = 'onChange'

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/chip/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Chip from './Chip.vue'

Chip.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/chip/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'
import { pickProps } from '../utils/components'
import { props as iconProps } from '../icon/props'

Expand Down
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/col/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { App } from 'vue'
import type { App } from 'vue'
import Col from './Col.vue'

Col.install = function(app: App) {
Col.install = function (app: App) {
app.component(Col.name, Col)
}

Expand Down
10 changes: 5 additions & 5 deletions packages/varlet-ui/src/col/props.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

export const props = {
span: {
type: [String, Number],
default: 24
default: 24,
},
offset: {
type: [String, Number],
default: 0
default: 0,
},
onClick: {
type: Function as PropType<(e: Event) => void>
}
type: Function as PropType<(e: Event) => void>,
},
}
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/col/provide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComputedRef } from 'vue'
import type { ComputedRef } from 'vue'
import { useAtParentIndex, useParent } from '../utils/components'
import { ROW_BIND_COL_KEY, ROW_COUNT_COL_KEY, RowProvider } from '../row/provide'

Expand All @@ -24,6 +24,6 @@ export function useRow() {
return {
index,
row: parentProvider,
bindRow: bindParent
bindRow: bindParent,
}
}
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/collapse-item/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import CollapseItem from './CollapseItem.vue'

CollapseItem.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/collapse-item/provide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComputedRef } from 'vue'
import type { ComputedRef } from 'vue'
import { useAtParentIndex, useParent } from '../utils/components'
import {
COLLAPSE_BIND_COLLAPSE_ITEM_KEY,
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/collapse/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Collapse from './Collapse.vue'

Collapse.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/collapse/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

export const props = {
modelValue: {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/collapse/provide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComputedRef } from 'vue'
import type { ComputedRef } from 'vue'
import { useAtChildrenCounter, useChildren } from '../utils/components'
import { CollapseItemProvider } from '../collapse-item/provide'

Expand Down
19 changes: 12 additions & 7 deletions packages/varlet-ui/src/context/zIndex.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import context from './index'
import { watch, ref, Ref } from 'vue'
import { watch, ref } from 'vue'
import type { Ref } from 'vue'

export function useZIndex(source: any, count: number) {
const zIndex: Ref<number> = ref(context.zIndex)

watch(source, (newValue) => {
if (newValue) {
context.zIndex += count
zIndex.value = context.zIndex
}
}, { immediate: true })
watch(
source,
(newValue) => {
if (newValue) {
context.zIndex += count
zIndex.value = context.zIndex
}
},
{ immediate: true }
)

return { zIndex }
}
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/countdown/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Countdown from './Countdown.vue'

Countdown.install = function (app: App) {
Expand Down
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/counter/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { App } from 'vue'
import type { App } from 'vue'
import Counter from './Counter.vue'

Counter.install = function(app: App) {
Counter.install = function (app: App) {
app.component(Counter.name, Counter)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/counter/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

export type ValidateTriggers = 'onIncrement' | 'onDecrement' | 'onInputChange' | 'onLazyChange'

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/date-picker/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import DatePicker from './DatePicker.vue'

DatePicker.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/date-picker/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

type AllowedDates = (val: string) => boolean

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/dialog/props.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pickProps } from '../utils/components'
import { props as popupProps } from '../popup/props'
import { PropType } from 'vue'
import type { PropType } from 'vue'
import { DialogActions } from './index'

function messageAlignValidator(messageAlign: string): boolean {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/divider/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Divider from './Divider.vue'

Divider.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/form-details/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import FormDetails from './FormDetails.vue'

FormDetails.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/form/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Form from './Form.vue'

Form.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/form/provide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComputedRef } from 'vue'
import type { ComputedRef } from 'vue'
import { useChildren, useParent } from '../utils/components'

export interface Validation {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/icon/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import Icon from './Icon.vue'

Icon.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/icon/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

export const props = {
name: {
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/image-preview/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import VarImagePreview from './ImagePreview.vue'
import { App, nextTick, reactive } from 'vue'
import { nextTick, reactive } from 'vue'
import type { App } from 'vue'
import { inBrowser, isArray, isString } from '../utils/shared'
import { mountInstance } from '../utils/components'

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/image-preview/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'
import { pickProps } from '../utils/components'
import { props as swipeProps } from '../swipe/props'
import { props as popupProps } from '../popup/props'
Expand Down
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/image/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { App } from 'vue'
import type { App } from 'vue'
import Image from './Image.vue'

Image.install = function(app: App) {
Image.install = function (app: App) {
app.component(Image.name, Image)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/image/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

function fitValidator(fit: string) {
return ['fill', 'contain', 'cover', 'none', 'scale-down'].includes(fit)
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/index-anchor/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import IndexAnchor from './IndexAnchor.vue'

IndexAnchor.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/index-anchor/provide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComputedRef, Ref } from 'vue'
import type { ComputedRef, Ref } from 'vue'
import { useAtParentIndex, useParent } from '../utils/components'
import {
INDEX_BAR_BIND_INDEX_ANCHOR_KEY,
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/index-bar/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App } from 'vue'
import type { App } from 'vue'
import IndexBar from './IndexBar.vue'

IndexBar.install = function (app: App) {
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/index-bar/provide.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComputedRef, Ref } from 'vue'
import type { ComputedRef, Ref } from 'vue'
import { useAtChildrenCounter, useChildren } from '../utils/components'
import { IndexAnchorProvider } from '../index-anchor/provide'

Expand Down
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/input/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { App } from 'vue'
import type { App } from 'vue'
import Input from './Input.vue'

Input.install = function(app: App) {
Input.install = function (app: App) {
app.component(Input.name, Input)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/input/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

export function typeValidator(type: string) {
return ['text', 'password'].includes(type)
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/lazy/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Directive, Plugin } from 'vue'
import type { App, Directive, Plugin } from 'vue'
import { DirectiveBinding } from '@vue/runtime-core'
import { getParentScroller, inViewport } from '../utils/elements'
import {
Expand Down
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/list/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { App } from 'vue'
import type { App } from 'vue'
import List from './List.vue'

List.install = function(app: App) {
List.install = function (app: App) {
app.component(List.name, List)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/list/props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue'
import type { PropType } from 'vue'

export const props = {
loading: {
Expand Down
Loading

0 comments on commit b1636f3

Please sign in to comment.