@dongmingzhixiu/vuexir-compiler 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen/swiftui.js +3 -0
- package/dist/transform/css.js +5 -0
- package/package.json +1 -1
package/dist/codegen/swiftui.js
CHANGED
|
@@ -703,6 +703,9 @@ function emitNodeInner(node, ctx) {
|
|
|
703
703
|
const size = sizeModifiers(props, axis, ctx);
|
|
704
704
|
let padMods = paddingModifiers(props);
|
|
705
705
|
let boxMods = boxModifiers(props);
|
|
706
|
+
if (node.type === 'image' && props.objectFit === 'cover' && !props.clip) {
|
|
707
|
+
boxMods.unshift('.clipped()');
|
|
708
|
+
}
|
|
706
709
|
// R44:胶囊标签(大圆角+同色背景描边+对称 padding)→ 单次 .tagCapsule(...)
|
|
707
710
|
const capsule = currentFrameShort && isCapsule(props, padMods) ? capsuleExpr(props) : undefined;
|
|
708
711
|
if (capsule !== undefined) {
|
package/dist/transform/css.js
CHANGED
|
@@ -70,6 +70,9 @@ export function resolveCssRules(rules, element, ancestors, inline, warnings) {
|
|
|
70
70
|
const props = {};
|
|
71
71
|
for (const rule of matched)
|
|
72
72
|
mergeIrProps(props, rule.props);
|
|
73
|
+
// object-fit 只影响图片内容,容器复用同一个类时不产生 IR 属性。
|
|
74
|
+
if (element.tag !== 'img')
|
|
75
|
+
delete props.objectFit;
|
|
73
76
|
return props;
|
|
74
77
|
}
|
|
75
78
|
const px = (v) => {
|
|
@@ -118,6 +121,8 @@ function mapDeclInner(prop, value, warnings) {
|
|
|
118
121
|
if (prop.startsWith('--'))
|
|
119
122
|
return []; // 变量声明由 token 解析器处理,不是未支持的视觉属性。
|
|
120
123
|
switch (prop) {
|
|
124
|
+
case 'object-fit':
|
|
125
|
+
return v === 'contain' || v === 'cover' ? [['objectFit', v]] : null;
|
|
121
126
|
case 'aspect-ratio': {
|
|
122
127
|
const parts = v.split('/').map((part) => Number(part.trim()));
|
|
123
128
|
const ratio = parts.length === 1 ? parts[0] : parts.length === 2 ? parts[0] / parts[1] : NaN;
|