Skip to content

Commit

Permalink
feat: remove style from divide to follow border behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
MellowCo committed Apr 28, 2023
1 parent 3a0eeb4 commit c80b664
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
6 changes: 2 additions & 4 deletions src/rules/divide.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CSSEntries, Rule, RuleContext } from '@unocss/core'
import { colorResolver, directionMap, handler as h } from '../utils'
import type { Theme } from '../theme'
import { borderStyles, handlerBorderStyle } from '../rules/border'
import { borderStyles } from '../rules/border'

export const divides: Rule[] = [
// divides
Expand Down Expand Up @@ -30,13 +30,11 @@ function handlerDivide([, d, s]: string[], { theme }: RuleContext<Theme>): CSSEn
: `calc(${v} * calc(1 - var(--un-divide-${d}-reverse)))`
return [key, value]
})
const borderStyle = handlerBorderStyle(['', d, 'solid'])

if (results && borderStyle) {
if (results) {
return [
[`--un-divide-${d}-reverse`, 0],
...results,
...borderStyle,
]
}
}
Expand Down
12 changes: 6 additions & 6 deletions test/__snapshots__/preset-mini.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ page,::before,::after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-
.bg-repeat-revert{background-repeat:revert;}
.bg-origin-border{background-origin:border-box;}
.bg-origin-initial{background-origin:initial;}
.divide-x-4>view+view,.divide-x-4>button+button,.divide-x-4>text+text,.divide-x-4>image+image,.divide-x-4>uni-view+uni-view,.divide-x-4>uni-button+uni-button,.divide-x-4>uni-text+uni-text,.divide-x-4>uni-image+uni-image,.divide-x-4>taro-view-core+taro-view-core,.divide-x-4>taro-image-core+taro-image-core,.divide-x-4>taro-text-core+taro-text-core,.divide-x-4>taro-button-core+taro-button-core{--licl-divide-x-reverse:0;border-left-width:calc(4rpx * calc(1 - var(--licl-divide-x-reverse)));border-right-width:calc(4rpx * var(--licl-divide-x-reverse));border-left-style:solid;border-right-style:solid;}
.divide-x-none>view+view,.divide-x-none>button+button,.divide-x-none>text+text,.divide-x-none>image+image,.divide-x-none>uni-view+uni-view,.divide-x-none>uni-button+uni-button,.divide-x-none>uni-text+uni-text,.divide-x-none>uni-image+uni-image,.divide-x-none>taro-view-core+taro-view-core,.divide-x-none>taro-image-core+taro-image-core,.divide-x-none>taro-text-core+taro-text-core,.divide-x-none>taro-button-core+taro-button-core{--licl-divide-x-reverse:0;border-left-width:calc(0 * calc(1 - var(--licl-divide-x-reverse)));border-right-width:calc(0 * var(--licl-divide-x-reverse));border-left-style:solid;border-right-style:solid;}
.divide-y-4>view+view,.divide-y-4>button+button,.divide-y-4>text+text,.divide-y-4>image+image,.divide-y-4>uni-view+uni-view,.divide-y-4>uni-button+uni-button,.divide-y-4>uni-text+uni-text,.divide-y-4>uni-image+uni-image,.divide-y-4>taro-view-core+taro-view-core,.divide-y-4>taro-image-core+taro-image-core,.divide-y-4>taro-text-core+taro-text-core,.divide-y-4>taro-button-core+taro-button-core{--licl-divide-y-reverse:0;border-top-width:calc(4rpx * calc(1 - var(--licl-divide-y-reverse)));border-bottom-width:calc(4rpx * var(--licl-divide-y-reverse));border-top-style:solid;border-bottom-style:solid;}
.divide-x-4>view+view,.divide-x-4>button+button,.divide-x-4>text+text,.divide-x-4>image+image,.divide-x-4>uni-view+uni-view,.divide-x-4>uni-button+uni-button,.divide-x-4>uni-text+uni-text,.divide-x-4>uni-image+uni-image,.divide-x-4>taro-view-core+taro-view-core,.divide-x-4>taro-image-core+taro-image-core,.divide-x-4>taro-text-core+taro-text-core,.divide-x-4>taro-button-core+taro-button-core{--licl-divide-x-reverse:0;border-left-width:calc(4rpx * calc(1 - var(--licl-divide-x-reverse)));border-right-width:calc(4rpx * var(--licl-divide-x-reverse));}
.divide-x-none>view+view,.divide-x-none>button+button,.divide-x-none>text+text,.divide-x-none>image+image,.divide-x-none>uni-view+uni-view,.divide-x-none>uni-button+uni-button,.divide-x-none>uni-text+uni-text,.divide-x-none>uni-image+uni-image,.divide-x-none>taro-view-core+taro-view-core,.divide-x-none>taro-image-core+taro-image-core,.divide-x-none>taro-text-core+taro-text-core,.divide-x-none>taro-button-core+taro-button-core{--licl-divide-x-reverse:0;border-left-width:calc(0 * calc(1 - var(--licl-divide-x-reverse)));border-right-width:calc(0 * var(--licl-divide-x-reverse));}
.divide-y-4>view+view,.divide-y-4>button+button,.divide-y-4>text+text,.divide-y-4>image+image,.divide-y-4>uni-view+uni-view,.divide-y-4>uni-button+uni-button,.divide-y-4>uni-text+uni-text,.divide-y-4>uni-image+uni-image,.divide-y-4>taro-view-core+taro-view-core,.divide-y-4>taro-image-core+taro-image-core,.divide-y-4>taro-text-core+taro-text-core,.divide-y-4>taro-button-core+taro-button-core{--licl-divide-y-reverse:0;border-top-width:calc(4rpx * calc(1 - var(--licl-divide-y-reverse)));border-bottom-width:calc(4rpx * var(--licl-divide-y-reverse));}
.divide-x-reverse>view+view,.divide-x-reverse>button+button,.divide-x-reverse>text+text,.divide-x-reverse>image+image,.divide-x-reverse>uni-view+uni-view,.divide-x-reverse>uni-button+uni-button,.divide-x-reverse>uni-text+uni-text,.divide-x-reverse>uni-image+uni-image,.divide-x-reverse>taro-view-core+taro-view-core,.divide-x-reverse>taro-image-core+taro-image-core,.divide-x-reverse>taro-text-core+taro-text-core,.divide-x-reverse>taro-button-core+taro-button-core{--licl-divide-x-reverse:1;}
.divide-block-4>view+view,.divide-block-4>button+button,.divide-block-4>text+text,.divide-block-4>image+image,.divide-block-4>uni-view+uni-view,.divide-block-4>uni-button+uni-button,.divide-block-4>uni-text+uni-text,.divide-block-4>uni-image+uni-image,.divide-block-4>taro-view-core+taro-view-core,.divide-block-4>taro-image-core+taro-image-core,.divide-block-4>taro-text-core+taro-text-core,.divide-block-4>taro-button-core+taro-button-core{--licl-divide-block-reverse:0;border-block-start-width:calc(4rpx * calc(1 - var(--licl-divide-block-reverse)));border-block-end-width:calc(4rpx * calc(1 - var(--licl-divide-block-reverse)));border-block-start-style:solid;border-block-end-style:solid;}
.divide-inline-4>view+view,.divide-inline-4>button+button,.divide-inline-4>text+text,.divide-inline-4>image+image,.divide-inline-4>uni-view+uni-view,.divide-inline-4>uni-button+uni-button,.divide-inline-4>uni-text+uni-text,.divide-inline-4>uni-image+uni-image,.divide-inline-4>taro-view-core+taro-view-core,.divide-inline-4>taro-image-core+taro-image-core,.divide-inline-4>taro-text-core+taro-text-core,.divide-inline-4>taro-button-core+taro-button-core{--licl-divide-inline-reverse:0;border-inline-start-width:calc(4rpx * calc(1 - var(--licl-divide-inline-reverse)));border-inline-end-width:calc(4rpx * calc(1 - var(--licl-divide-inline-reverse)));border-inline-start-style:solid;border-inline-end-style:solid;}
.divide-inline-none>view+view,.divide-inline-none>button+button,.divide-inline-none>text+text,.divide-inline-none>image+image,.divide-inline-none>uni-view+uni-view,.divide-inline-none>uni-button+uni-button,.divide-inline-none>uni-text+uni-text,.divide-inline-none>uni-image+uni-image,.divide-inline-none>taro-view-core+taro-view-core,.divide-inline-none>taro-image-core+taro-image-core,.divide-inline-none>taro-text-core+taro-text-core,.divide-inline-none>taro-button-core+taro-button-core{--licl-divide-inline-reverse:0;border-inline-start-width:calc(0 * calc(1 - var(--licl-divide-inline-reverse)));border-inline-end-width:calc(0 * calc(1 - var(--licl-divide-inline-reverse)));border-inline-start-style:solid;border-inline-end-style:solid;}
.divide-block-4>view+view,.divide-block-4>button+button,.divide-block-4>text+text,.divide-block-4>image+image,.divide-block-4>uni-view+uni-view,.divide-block-4>uni-button+uni-button,.divide-block-4>uni-text+uni-text,.divide-block-4>uni-image+uni-image,.divide-block-4>taro-view-core+taro-view-core,.divide-block-4>taro-image-core+taro-image-core,.divide-block-4>taro-text-core+taro-text-core,.divide-block-4>taro-button-core+taro-button-core{--licl-divide-block-reverse:0;border-block-start-width:calc(4rpx * calc(1 - var(--licl-divide-block-reverse)));border-block-end-width:calc(4rpx * calc(1 - var(--licl-divide-block-reverse)));}
.divide-inline-4>view+view,.divide-inline-4>button+button,.divide-inline-4>text+text,.divide-inline-4>image+image,.divide-inline-4>uni-view+uni-view,.divide-inline-4>uni-button+uni-button,.divide-inline-4>uni-text+uni-text,.divide-inline-4>uni-image+uni-image,.divide-inline-4>taro-view-core+taro-view-core,.divide-inline-4>taro-image-core+taro-image-core,.divide-inline-4>taro-text-core+taro-text-core,.divide-inline-4>taro-button-core+taro-button-core{--licl-divide-inline-reverse:0;border-inline-start-width:calc(4rpx * calc(1 - var(--licl-divide-inline-reverse)));border-inline-end-width:calc(4rpx * calc(1 - var(--licl-divide-inline-reverse)));}
.divide-inline-none>view+view,.divide-inline-none>button+button,.divide-inline-none>text+text,.divide-inline-none>image+image,.divide-inline-none>uni-view+uni-view,.divide-inline-none>uni-button+uni-button,.divide-inline-none>uni-text+uni-text,.divide-inline-none>uni-image+uni-image,.divide-inline-none>taro-view-core+taro-view-core,.divide-inline-none>taro-image-core+taro-image-core,.divide-inline-none>taro-text-core+taro-text-core,.divide-inline-none>taro-button-core+taro-button-core{--licl-divide-inline-reverse:0;border-inline-start-width:calc(0 * calc(1 - var(--licl-divide-inline-reverse)));border-inline-end-width:calc(0 * calc(1 - var(--licl-divide-inline-reverse)));}
.divide-inline-reverse>view+view,.divide-inline-reverse>button+button,.divide-inline-reverse>text+text,.divide-inline-reverse>image+image,.divide-inline-reverse>uni-view+uni-view,.divide-inline-reverse>uni-button+uni-button,.divide-inline-reverse>uni-text+uni-text,.divide-inline-reverse>uni-image+uni-image,.divide-inline-reverse>taro-view-core+taro-view-core,.divide-inline-reverse>taro-image-core+taro-image-core,.divide-inline-reverse>taro-text-core+taro-text-core,.divide-inline-reverse>taro-button-core+taro-button-core{--licl-divide-inline-reverse:1;}
.divide-current>view+view,.divide-current>button+button,.divide-current>text+text,.divide-current>image+image,.divide-current>uni-view+uni-view,.divide-current>uni-button+uni-button,.divide-current>uni-text+uni-text,.divide-current>uni-image+uni-image,.divide-current>taro-view-core+taro-view-core,.divide-current>taro-image-core+taro-image-core,.divide-current>taro-text-core+taro-text-core,.divide-current>taro-button-core+taro-button-core{border-color:currentColor;}
.divide-green-500>view+view,.divide-green-500>button+button,.divide-green-500>text+text,.divide-green-500>image+image,.divide-green-500>uni-view+uni-view,.divide-green-500>uni-button+uni-button,.divide-green-500>uni-text+uni-text,.divide-green-500>uni-image+uni-image,.divide-green-500>taro-view-core+taro-view-core,.divide-green-500>taro-image-core+taro-image-core,.divide-green-500>taro-text-core+taro-text-core,.divide-green-500>taro-button-core+taro-button-core{--licl-divide-opacity:1;border-color:rgba(34,197,94,var(--licl-divide-opacity));}
Expand Down
Loading

0 comments on commit c80b664

Please sign in to comment.