Skip to content

Commit

Permalink
fix(onu-ui): fix components name & update resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyv committed Nov 3, 2022
1 parent 8c2ae98 commit 1951ba6
Show file tree
Hide file tree
Showing 19 changed files with 68 additions and 65 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@iconify-json/logos": "^1.1.16",
"@onu-ui/cli": "workspace:*",
"@onu-ui/components": "workspace:*",
"@onu-ui/docs":"workspace:*",
"@onu-ui/docs": "workspace:*",
"@onu-ui/preset": "workspace:*",
"@onu-ui/utils": "workspace:*",
"@types/fs-extra": "^9.0.13",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/alert/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang='ts' setup name="O-Alert">
<script lang='ts' setup name="OAlert">
import OIcon from '../../icon/src/index.vue'
import { alertEmits, alertProps } from './props'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/avatar/src/group.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang='ts' setup name="O-Avatar-Group">
<script lang='ts' setup name="OAvatarGroup">
import { avatarGroupProps } from './avatar'
defineProps(avatarGroupProps)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/avatar/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang='ts' setup name="O-Avatar">
<script lang='ts' setup name="OAvatar">
import { avatarProps } from './avatar'
const props = defineProps(avatarProps)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/badge/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" setup name="O-Badge">
<script lang="ts" setup name="OBadge">
import { isNumber } from '@onu-ui/utils'
import { badgeProps } from './badge'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/button/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup lang="ts" name="O-Button">
<script setup lang="ts" name="OButton">
import { buttonProps } from './props'
const props = defineProps(buttonProps)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/card/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" setup name="O-Card">
<script lang="ts" setup name="OCard">
import OButton from '../../button/src/index.vue'
import { cardProps } from './props'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/checkbox/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<script lang="ts" setup name="O-Checkbox">
<script lang="ts" setup name="OCheckbox">
import { hash } from '@onu-ui/utils'
import { checkBoxProps } from './checkbox'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/collapse/src/collapse.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup lang="ts" name="O-Collapse">
<script setup lang="ts" name="OCollapse">
// TODO test
import { provide, ref, watch } from 'vue'
import {
Expand Down
6 changes: 2 additions & 4 deletions packages/components/collapse/src/collapseItem.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup lang="ts" name="O-Collapse-Item">
<script setup lang="ts" name="OCollapseItem">
// TODO test
import { computed, inject } from 'vue'
Expand Down Expand Up @@ -52,9 +52,7 @@ defineExpose({
</script>

<template>
<div
o-collapse-item-base
>
<div o-collapse-item-base>
<div
class="o-collapse-item-title"
:class="[
Expand Down
2 changes: 1 addition & 1 deletion packages/components/icon/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang='ts' setup name="O-Icon">
<script lang='ts' setup name="OIcon">
defineProps<{
name: String
}>()
Expand Down
2 changes: 1 addition & 1 deletion packages/components/rate/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" setup name="O-Rate">
<script lang="ts" setup name="ORate">
import { computed } from 'vue'
import OIcon from '../../icon/src/index.vue'
import { rateProps } from './props'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/switch/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<script lang="ts" setup name="O-Switch">
<script lang="ts" setup name="OSwitch">
import { switchProps } from './props'
const props = defineProps(switchProps)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/tag/src/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang='ts' setup name="O-Tag">
<script lang='ts' setup name="OTag">
import OIcon from '../../icon/src/index.vue'
import { tagEmits, tagProps } from './props'
Expand Down
5 changes: 5 additions & 0 deletions packages/onu-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"require": "./dist/index.cjs",
"types": "./dist/onu-ui/src/index.d.ts"
},
"./components": {
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"types": "./dist/components/index.d.ts"
},
"./dist/style.css": "./dist/style.css"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/onu-ui/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function OnuResolver(): ComponentResolver {
type: 'component',
resolve: (name: string) => {
if (name.match(/^O[A-Z]/))
return { name, from: 'onu-ui' }
return { name: name.slice(1).toLowerCase(), from: 'onu-ui/components' }
},
}
}
2 changes: 1 addition & 1 deletion packages/onu-ui/src/style.css

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions playground/src/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const OAlert: typeof import('onu-ui')['OAlert']
const OAvatar: typeof import('onu-ui')['OAvatar']
const OAvatarGroup: typeof import('onu-ui')['OAvatarGroup']
const OBadge: typeof import('onu-ui')['OBadge']
const OButton: typeof import('onu-ui')['OButton']
const OCard: typeof import('onu-ui')['OCard']
const OCheckbox: typeof import('onu-ui')['OCheckbox']
const OCollapse: typeof import('onu-ui')['OCollapse']
const OCollapseItem: typeof import('onu-ui')['OCollapseItem']
const OIcon: typeof import('onu-ui')['OIcon']
const OMessage: typeof import('onu-ui')['OMessage']
const OPopup: typeof import('onu-ui')['OPopup']
const ORate: typeof import('onu-ui')['ORate']
const OSwitch: typeof import('onu-ui')['OSwitch']
const OTag: typeof import('onu-ui')['OTag']
const OTrigger: typeof import('onu-ui')['OTrigger']
const OAlert: typeof import('onu-ui/components')['alert']
const OAvatar: typeof import('onu-ui/components')['avatar']
const OAvatarGroup: typeof import('onu-ui/components')['avatargroup']
const OBadge: typeof import('onu-ui/components')['badge']
const OButton: typeof import('onu-ui/components')['button']
const OCard: typeof import('onu-ui/components')['card']
const OCheckbox: typeof import('onu-ui/components')['checkbox']
const OCollapse: typeof import('onu-ui/components')['collapse']
const OCollapseItem: typeof import('onu-ui/components')['collapseitem']
const OIcon: typeof import('onu-ui/components')['icon']
const OMessage: typeof import('onu-ui/components')['message']
const OPopup: typeof import('onu-ui/components')['popup']
const ORate: typeof import('onu-ui/components')['rate']
const OSwitch: typeof import('onu-ui/components')['switch']
const OTag: typeof import('onu-ui/components')['tag']
const OTrigger: typeof import('onu-ui/components')['trigger']
const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
const computed: typeof import('vue')['computed']
Expand Down Expand Up @@ -280,22 +280,22 @@ import { UnwrapRef } from 'vue'
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
readonly OAlert: UnwrapRef<typeof import('onu-ui')['OAlert']>
readonly OAvatar: UnwrapRef<typeof import('onu-ui')['OAvatar']>
readonly OAvatarGroup: UnwrapRef<typeof import('onu-ui')['OAvatarGroup']>
readonly OBadge: UnwrapRef<typeof import('onu-ui')['OBadge']>
readonly OButton: UnwrapRef<typeof import('onu-ui')['OButton']>
readonly OCard: UnwrapRef<typeof import('onu-ui')['OCard']>
readonly OCheckbox: UnwrapRef<typeof import('onu-ui')['OCheckbox']>
readonly OCollapse: UnwrapRef<typeof import('onu-ui')['OCollapse']>
readonly OCollapseItem: UnwrapRef<typeof import('onu-ui')['OCollapseItem']>
readonly OIcon: UnwrapRef<typeof import('onu-ui')['OIcon']>
readonly OMessage: UnwrapRef<typeof import('onu-ui')['OMessage']>
readonly OPopup: UnwrapRef<typeof import('onu-ui')['OPopup']>
readonly ORate: UnwrapRef<typeof import('onu-ui')['ORate']>
readonly OSwitch: UnwrapRef<typeof import('onu-ui')['OSwitch']>
readonly OTag: UnwrapRef<typeof import('onu-ui')['OTag']>
readonly OTrigger: UnwrapRef<typeof import('onu-ui')['OTrigger']>
readonly OAlert: UnwrapRef<typeof import('onu-ui/components')['alert']>
readonly OAvatar: UnwrapRef<typeof import('onu-ui/components')['avatar']>
readonly OAvatarGroup: UnwrapRef<typeof import('onu-ui/components')['avatargroup']>
readonly OBadge: UnwrapRef<typeof import('onu-ui/components')['badge']>
readonly OButton: UnwrapRef<typeof import('onu-ui/components')['button']>
readonly OCard: UnwrapRef<typeof import('onu-ui/components')['card']>
readonly OCheckbox: UnwrapRef<typeof import('onu-ui/components')['checkbox']>
readonly OCollapse: UnwrapRef<typeof import('onu-ui/components')['collapse']>
readonly OCollapseItem: UnwrapRef<typeof import('onu-ui/components')['collapseitem']>
readonly OIcon: UnwrapRef<typeof import('onu-ui/components')['icon']>
readonly OMessage: UnwrapRef<typeof import('onu-ui/components')['message']>
readonly OPopup: UnwrapRef<typeof import('onu-ui/components')['popup']>
readonly ORate: UnwrapRef<typeof import('onu-ui/components')['rate']>
readonly OSwitch: UnwrapRef<typeof import('onu-ui/components')['switch']>
readonly OTag: UnwrapRef<typeof import('onu-ui/components')['tag']>
readonly OTrigger: UnwrapRef<typeof import('onu-ui/components')['trigger']>
readonly asyncComputed: UnwrapRef<typeof import('@vueuse/core')['asyncComputed']>
readonly autoResetRef: UnwrapRef<typeof import('@vueuse/core')['autoResetRef']>
readonly computed: UnwrapRef<typeof import('vue')['computed']>
Expand Down
28 changes: 14 additions & 14 deletions playground/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
Bg: typeof import('./components/Bg.vue')['default']
OAlert: typeof import('onu-ui')['OAlert']
OAvatar: typeof import('onu-ui')['OAvatar']
OAvatarGroup: typeof import('onu-ui')['OAvatarGroup']
OBadge: typeof import('onu-ui')['OBadge']
OButton: typeof import('onu-ui')['OButton']
OCard: typeof import('onu-ui')['OCard']
OCheckbox: typeof import('onu-ui')['OCheckbox']
OCollapse: typeof import('onu-ui')['OCollapse']
OCollapseItem: typeof import('onu-ui')['OCollapseItem']
OIcon: typeof import('onu-ui')['OIcon']
OPopup: typeof import('onu-ui')['OPopup']
ORate: typeof import('onu-ui')['ORate']
OSwitch: typeof import('onu-ui')['OSwitch']
OTag: typeof import('onu-ui')['OTag']
OAlert: typeof import('onu-ui/components')['alert']
OAvatar: typeof import('onu-ui/components')['avatar']
OAvatarGroup: typeof import('onu-ui/components')['avatargroup']
OBadge: typeof import('onu-ui/components')['badge']
OButton: typeof import('onu-ui/components')['button']
OCard: typeof import('onu-ui/components')['card']
OCheckbox: typeof import('onu-ui/components')['checkbox']
OCollapse: typeof import('onu-ui/components')['collapse']
OCollapseItem: typeof import('onu-ui/components')['collapseitem']
OIcon: typeof import('onu-ui/components')['icon']
OPopup: typeof import('onu-ui/components')['popup']
ORate: typeof import('onu-ui/components')['rate']
OSwitch: typeof import('onu-ui/components')['switch']
OTag: typeof import('onu-ui/components')['tag']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
TheAlert: typeof import('./components/TheAlert.vue')['default']
Expand Down

0 comments on commit 1951ba6

Please sign in to comment.