Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: style dependencies missing in on-demand import entries #1755

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/_private/mask/style/index.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '../../../style/variable/index.less';
@import '../../../style/mixins/box.less';
@import '../../../style/motion/fade.less';

.@{mask-prefix} {
.box(fixed);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/badge/demo/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ a {
display: inline-block;
width: 24px;
height: 24px;
border: 1px solid var(--ix-border-color);
border: 1px solid var(--ix-color-border);
border-radius: var(--ix-border-radius-sm);
}
</style>
2 changes: 1 addition & 1 deletion packages/components/badge/demo/Count.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ a {
display: inline-block;
width: 24px;
height: 24px;
border: 1px solid var(--ix-border-color);
border: 1px solid var(--ix-color-border);
border-radius: var(--ix-border-radius-sm);
}
</style>
2 changes: 1 addition & 1 deletion packages/components/badge/demo/OverflowCount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ a {
display: inline-block;
width: 24px;
height: 24px;
border: 1px solid var(--ix-border-color);
border: 1px solid var(--ix-color-border);
border-radius: var(--ix-border-radius-sm);
}
</style>
2 changes: 1 addition & 1 deletion packages/components/badge/demo/Processing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ a {
display: inline-block;
width: 24px;
height: 24px;
border: 1px solid var(--ix-border-color);
border: 1px solid var(--ix-color-border);
border-radius: var(--ix-border-radius-sm);
}
</style>
2 changes: 1 addition & 1 deletion packages/components/badge/demo/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ a {
display: inline-block;
width: 24px;
height: 24px;
border: 1px solid var(--ix-border-color);
border: 1px solid var(--ix-color-border);
border-radius: var(--ix-border-radius-sm);
}
</style>
2 changes: 1 addition & 1 deletion packages/components/badge/demo/Title.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ a {
display: inline-block;
width: 24px;
height: 24px;
border: 1px solid var(--ix-border-color);
border: 1px solid var(--ix-color-border);
border-radius: var(--ix-border-radius-sm);
}
</style>
1 change: 1 addition & 0 deletions packages/components/date-picker/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ import '@idux/components/_private/overlay/style'
import '@idux/components/_private/trigger/style'
import '@idux/components/icon/style'
import '@idux/components/input/style'
import '@idux/components/time-picker/style'

import './index.less'
1 change: 1 addition & 0 deletions packages/components/drawer/style/index.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import '../../style/variable/index.less';
@import '../../style/mixins/box.less';
@import '../../style/mixins/reset.less';
@import '../../style//motion/move.less';

.@{drawer-prefix} {
.reset-component-new();
Expand Down
2 changes: 1 addition & 1 deletion packages/components/drawer/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// style dependencies

import '@idux/components/_private/mask/style'
import '@idux/components/button/style'
import '@idux/components/header/style'
import '@idux/components/icon/style'
Expand Down
11 changes: 11 additions & 0 deletions packages/components/image/src/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import { computed, defineComponent, normalizeClass, ref, watch } from 'vue'
import { callEmit } from '@idux/cdk/utils'
import { useGlobalConfig } from '@idux/components/config'
import { IxIcon } from '@idux/components/icon'
import { useThemeToken } from '@idux/components/theme'

import ImageViewer from './ImageViewer'
import { imageProps } from './types'
import { getThemeTokens } from '../theme'

export default defineComponent({
name: 'IxImage',
Expand All @@ -25,13 +27,18 @@ export default defineComponent({
setup(props, { attrs, slots }) {
const { class: className, style, ...rest } = attrs
const common = useGlobalConfig('common')
const { globalHashId, hashId, registerToken } = useThemeToken('image')
registerToken(getThemeTokens)

const mergedPrefixCls = computed(() => `${common.prefixCls}-image`)
const config = useGlobalConfig('image')
const preview = usePreview(props, config)
const { status, setFailed, setLoaded } = useStatus(props)
const [viewerVisible, setVisible] = useViewerVisible()
const { outerClasses, overLayerClasses, imageClasses } = useClasses(
mergedPrefixCls,
globalHashId,
hashId,
className as string,
status,
preview,
Expand Down Expand Up @@ -102,13 +109,17 @@ function useViewerVisible(): [Ref<boolean>, (visible: boolean) => void] {

function useClasses(
mergedPrefixCls: ComputedRef<string>,
globalHashId: ComputedRef<string>,
hashId: ComputedRef<string>,
className: string,
status: Ref<ImageStatus>,
preview: ComputedRef<boolean>,
) {
const outerClasses = computed(() =>
normalizeClass([
mergedPrefixCls.value,
globalHashId.value,
hashId.value,
className,
`${mergedPrefixCls.value}-${status.value}`,
{ [`${mergedPrefixCls.value}-preview`]: preview.value },
Expand Down
6 changes: 5 additions & 1 deletion packages/components/image/src/ImageViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import { isFirefox } from '@idux/cdk/platform'
import { CdkPortal } from '@idux/cdk/portal'
import { useControlledProp } from '@idux/cdk/utils'
import { useGlobalConfig } from '@idux/components/config'
import { useThemeToken } from '@idux/components/theme'
import { usePortalTarget, useZIndex } from '@idux/components/utils'

import { useImgStyleOpr, useImgSwitch, useOprList } from './composables/useOpr'
import OprIcon from './contents/OprIcon'
import { imageViewerProps } from './types'
import { getThemeTokens } from '../theme'

const mousewheelEventName = isFirefox ? 'DOMMouseScroll' : 'mousewheel'

Expand All @@ -27,6 +29,8 @@ export default defineComponent({
props: imageViewerProps,
setup(props) {
const common = useGlobalConfig('common')
const { globalHashId, hashId, registerToken } = useThemeToken('image')
registerToken(getThemeTokens)
const config = useGlobalConfig('imageViewer')
const mergedPrefixCls = computed(() => `${common.prefixCls}-image-viewer`)
const mergedPortalTarget = usePortalTarget(props, config, common, mergedPrefixCls)
Expand Down Expand Up @@ -79,7 +83,7 @@ export default defineComponent({
<CdkPortal target={mergedPortalTarget.value} load={visible.value}>
<Transition name={`${common.prefixCls}-zoom`} appear>
{visible.value && (
<div class={prefixCls} style={style.value}>
<div class={[prefixCls, globalHashId.value, hashId.value]} style={style.value}>
<div class={`${prefixCls}-opr`}>
{oprList.value
.filter(item => item.visible)
Expand Down
2 changes: 2 additions & 0 deletions packages/components/image/style/index.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@import '../../style/variable/index.less';
@import '../../style/mixins/reset.less';

@import './viewer.less';

.@{image-prefix} {
.reset-component();

Expand Down
1 change: 1 addition & 0 deletions packages/components/image/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// style dependencies
import '@idux/components/icon/style'

import './index.less'
12 changes: 11 additions & 1 deletion packages/components/notification/src/NotificationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ import { isArray, isUndefined, pickBy } from 'lodash-es'
import { CdkPortal } from '@idux/cdk/portal'
import { VKey, callEmit, convertArray, convertCssPixel, uniqueId } from '@idux/cdk/utils'
import { useGlobalConfig } from '@idux/components/config'
import { useThemeToken } from '@idux/components/theme'
import { usePortalTarget } from '@idux/components/utils'

import Notification from './Notification'
import { NOTIFICATION_PROVIDER_TOKEN } from './token'
import { notificationPlacement, notificationProviderProps, notificationType } from './types'
import { getThemeTokens, transforms } from '../theme'

const groupPositions = {
topStart: ['top', 'left'],
Expand All @@ -40,6 +42,9 @@ export default defineComponent({
props: notificationProviderProps,
setup(props, { slots, expose }) {
const commonCfg = useGlobalConfig('common')
const { globalHashId, hashId, registerToken } = useThemeToken('notification')
registerToken(getThemeTokens, transforms)

const config = useGlobalConfig('notification')
const mergedPrefixCls = computed(() => `${commonCfg.prefixCls}-notification`)
const mergedPortalTarget = usePortalTarget(props, config, commonCfg, mergedPrefixCls)
Expand Down Expand Up @@ -79,7 +84,12 @@ export default defineComponent({
tag="div"
appear
name={moveName}
class={[`${mergedPrefixCls.value}-wrapper`, `${mergedPrefixCls.value}-wrapper-${placement}`]}
class={[
`${mergedPrefixCls.value}-wrapper`,
`${mergedPrefixCls.value}-wrapper-${placement}`,
globalHashId.value,
hashId.value,
]}
style={position}
>
{child}
Expand Down
2 changes: 2 additions & 0 deletions packages/components/popover/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// style dependencies

import '@idux/components/_private/overlay/style'
import '@idux/components/header/style'
import '@idux/components/icon/style'

import './index.less'
4 changes: 3 additions & 1 deletion packages/components/radio/src/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { isNil } from 'lodash-es'
import { useAccessorAndControl } from '@idux/cdk/forms'
import { callEmit, useKey } from '@idux/cdk/utils'
import { ɵWave, type ɵWaveInstance } from '@idux/components/_private/wave'
import { getButtonThemeTokens } from '@idux/components/button'
import { useGlobalConfig } from '@idux/components/config'
import { FORM_TOKEN, useFormElement, useFormItemRegister } from '@idux/components/form'
import { useThemeToken } from '@idux/components/theme'
Expand All @@ -37,8 +38,9 @@ export default defineComponent({
const key = useKey()
const common = useGlobalConfig('common')
const { globalHashId, hashId, registerToken } = useThemeToken('radio')
const { hashId: buttonHashId } = useThemeToken('button')
const { hashId: buttonHashId, registerToken: registerButtonTokens } = useThemeToken('button')
registerToken(getThemeTokens)
registerButtonTokens(getButtonThemeTokens)

const mergedPrefixCls = computed(() => `${common.prefixCls}-radio`)
const config = useGlobalConfig('radio')
Expand Down
2 changes: 2 additions & 0 deletions packages/components/select/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// style dependencies

import '@idux/components/_private/selector/style'
import '@idux/components/_private/overflow/style'
import '@idux/components/_private/overlay/style'
import '@idux/components/checkbox/style'
import '@idux/components/empty/style'
import '@idux/components/icon/style'
Expand Down
1 change: 1 addition & 0 deletions packages/components/slider/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// style dependencies
import '@idux/components/tooltip/style'

import './index.less'
2 changes: 2 additions & 0 deletions packages/components/tabs/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// style dependencies

import '@idux/components/icon/style'
import '@idux/components/popover/style'
import '@idux/components/select/style'

import './index.less'
11 changes: 10 additions & 1 deletion packages/components/tour/src/Mask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,26 @@

import { computed, defineComponent, inject, normalizeClass } from 'vue'

import { useThemeToken } from '@idux/components/theme'

import { tourToken } from './token'

export default defineComponent({
setup() {
const { globalHashId, hashId } = useThemeToken('tour')
const { mergedPrefixCls, mergedProps, maskPath, maskAttrs, maskClass, maskStyle } = inject(tourToken)!

const classes = computed(() => {
const prefixCls = `${mergedPrefixCls.value}-mask`
const { animatable } = mergedProps.value

return normalizeClass([prefixCls, maskClass.value, animatable ? `${prefixCls}-animatable` : undefined])
return normalizeClass([
prefixCls,
globalHashId.value,
hashId.value,
maskClass.value,
animatable ? `${prefixCls}-animatable` : undefined,
])
})

return () => {
Expand Down
1 change: 1 addition & 0 deletions packages/components/tour/style/index.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '../../style/variable/index.less';
@import '../../style/mixins/reset.less';
@import '../../style/motion/fade.less';

.@{tour-prefix} {
&-mask {
Expand Down
2 changes: 2 additions & 0 deletions packages/components/tour/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// style dependencies

import '@idux/components/_private/overlay/style'
import '@idux/components/header/style'
import '@idux/components/button/style'

import './index.less'
1 change: 1 addition & 0 deletions packages/components/tree-select/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// style dependencies

import '@idux/components/_private/selector/style'
import '@idux/components/_private/overflow/style'
import '@idux/components/tree/style'
import '@idux/components/input/style'

Expand Down
2 changes: 2 additions & 0 deletions packages/pro/search/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// style dependencies
import '@idux/components/_private/overflow/style'
import '@idux/components/_private/overlay/style'
import '@idux/components/icon/style'
import '@idux/components/select/style'
import '@idux/components/tree/style'
Expand Down
1 change: 1 addition & 0 deletions packages/pro/textarea/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// style dependencies
import '@idux/components/tooltip/style'
import '@idux/components/icon/style'

import './index.less'
3 changes: 2 additions & 1 deletion packages/pro/transfer/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// style dependencies

import '@idux/components/table/style'
import '@idux/pro/table/style'
import '@idux/components/tree/style'
import '@idux/components/transfer/style'

import './index.less'
3 changes: 3 additions & 0 deletions packages/pro/tree/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
import '@idux/components/icon/style'
import '@idux/components/button/style'
import '@idux/components/divider/style'
import '@idux/components/header/style'
import '@idux/components/input/style'
import '@idux/components/tree/style'

import './index.less'