@dongmingzhixiu/vuexir-compiler 0.4.10 → 0.5.0

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.
@@ -703,6 +703,28 @@ function emitNodeInner(node, ctx) {
703
703
  .join('\n');
704
704
  }
705
705
  case 'group': {
706
+ // R136:CSS grid(grid-template-columns: repeat(N,1fr))→ LazyVGrid
707
+ if (props.gridColumns !== undefined && (node.children?.length ?? 0) > 0) {
708
+ const cols = props.gridColumns;
709
+ const inner = (node.children ?? [])
710
+ .map((c, i) => emitNode(c, {
711
+ parentAxis: 'column',
712
+ level: L + 2,
713
+ definiteHeight: false,
714
+ warnings: ctx.warnings,
715
+ runtime: ctx.runtime,
716
+ path: `${ctx.path}[${i}]`,
717
+ inheritGap: undefined,
718
+ loop: ctx.loop,
719
+ dataProps: ctx.dataProps,
720
+ }))
721
+ .join('\n');
722
+ return [
723
+ pad(`LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: ${props.gap ?? 0}), count: ${cols}), spacing: ${props.gap ?? 0}) {`),
724
+ inner,
725
+ pad('}'),
726
+ ].join('\n');
727
+ }
706
728
  const dir = props.flexDirection ?? 'column';
707
729
  const isRow = dir === 'row';
708
730
  const children = node.children ?? [];
@@ -140,6 +140,8 @@ export interface IrProps {
140
140
  absTop?: number;
141
141
  absLeft?: number;
142
142
  absRight?: number;
143
+ /** R136:CSS grid 的列数(grid-template-columns: repeat(N, 1fr)) */
144
+ gridColumns?: number;
143
145
  absBottom?: number;
144
146
  /** M5 变换:scale / rotate(deg) / translate(x,y) → scaleEffect / rotationEffect / offset */
145
147
  transform?: {
package/dist/ir/schema.js CHANGED
@@ -115,7 +115,7 @@ const PROPS_VALIDATORS = {
115
115
  /** 各节点允许的 props 键(P0 最小集,防 Taro 化:未知 prop 即报错) */
116
116
  const NODE_ALLOWED_PROPS = {
117
117
  root: ['width', 'height', 'background'],
118
- group: ['width', 'height', 'padding', 'gap', 'flex', 'flexDirection', 'justifyContent', 'alignItems', 'background', 'radius', 'borderWidth', 'borderColor', 'marginTopAuto', 'marginTop', 'marginLeftAuto', 'marginBottom', 'marginRight', 'marginLeft', 'borderSides', 'clip', 'onClick', 'onSet', 'position', 'absTop', 'absLeft', 'absRight', 'absBottom', 'transform', 'show', 'opacity'],
118
+ group: ['width', 'height', 'padding', 'gap', 'flex', 'flexDirection', 'justifyContent', 'alignItems', 'background', 'radius', 'borderWidth', 'borderColor', 'marginTopAuto', 'marginTop', 'marginLeftAuto', 'marginBottom', 'marginRight', 'marginLeft', 'borderSides', 'clip', 'onClick', 'onSet', 'position', 'absTop', 'absLeft', 'absRight', 'absBottom', 'transform', 'show', 'opacity', 'gridColumns'],
119
119
  text: ['width', 'text', 'ref', 'bind', 'bindExpr', 'dynField', 'bindParts', 'fontSize', 'fontWeight', 'textAlign', 'lineHeight', 'color', 'padding', 'colorActive', 'marginLeftAuto', 'marginTop', 'colorDynamic', 'fontSizeDynamic', 'position', 'absTop', 'absLeft', 'absRight', 'absBottom', 'transform', 'show', 'flex', 'opacity', 'onClick', 'onSet', 'fieldOf'],
120
120
  image: ['width', 'height', 'src', 'objectFit', 'radius', 'borderSides', 'borderWidth', 'borderColor', 'clip', 'flex', 'marginTop', 'marginBottom', 'marginRight', 'marginLeft', 'position', 'absTop', 'absLeft', 'absRight', 'absBottom', 'transform', 'show', 'opacity'],
121
121
  button: ['width', 'height', 'label', 'bind', 'background', 'radius', 'borderWidth', 'borderColor', 'fontSize', 'fontWeight', 'color', 'flex', 'padding', 'marginTopAuto', 'marginTop', 'marginBottom', 'marginRight', 'marginLeft', 'borderSides', 'clip', 'onClick', 'onSet', 'colorDynamic', 'fontSizeDynamic', 'position', 'absTop', 'absLeft', 'absRight', 'absBottom', 'transform', 'show', 'pressBg', 'opacity'],
@@ -49,6 +49,14 @@ function mapDecl(prop, value, warnings) {
49
49
  function mapDeclInner(prop, value, warnings) {
50
50
  const v = value.trim();
51
51
  switch (prop) {
52
+ case 'grid-template-columns': {
53
+ // R136:CSS grid 的最小支持——`repeat(N, 1fr)` / `1fr 1fr 1fr` → 列数
54
+ const rep = String(v).match(/repeat\(\s*(\d+)\s*,/);
55
+ if (rep)
56
+ return [['gridColumns', Number(rep[1])]];
57
+ const cols = String(v).trim().split(/\s+/).filter((x) => x.endsWith('fr')).length;
58
+ return cols > 1 ? [['gridColumns', cols]] : null;
59
+ }
52
60
  case 'display':
53
61
  // display:flex → 容器语义;display:block/none 不映射(flex 为默认容器)
54
62
  // R135:CSS 的 display:flex 默认 main axis 是 row(此前默认 column →
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dongmingzhixiu/vuexir-compiler",
3
- "version": "0.4.10",
3
+ "version": "0.5.0",
4
4
  "description": "Vue SFC → IR → 原生源码(SwiftUI / Compose)编译器核心:纯函数、零 IO",
5
5
  "type": "module",
6
6
  "license": "MIT",