@cloudbase/cals 0.5.3-beta.0.2 → 0.5.4-alpha.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.
Files changed (100) hide show
  1. package/lib/parser/cals/index.d.ts +7 -0
  2. package/lib/parser/cals/index.d.ts.map +1 -1
  3. package/lib/parser/cals/index.js +19 -1
  4. package/lib/parser/cals/utils/block/index.d.ts +0 -0
  5. package/lib/parser/cals/utils/block/index.d.ts.map +0 -0
  6. package/lib/parser/cals/utils/block/index.js +0 -0
  7. package/lib/parser/cals/utils/code/index.d.ts +0 -0
  8. package/lib/parser/cals/utils/code/index.d.ts.map +0 -0
  9. package/lib/parser/cals/utils/code/index.js +0 -0
  10. package/lib/parser/cals/utils/common.d.ts +0 -0
  11. package/lib/parser/cals/utils/common.d.ts.map +0 -0
  12. package/lib/parser/cals/utils/common.js +0 -0
  13. package/lib/parser/cals/utils/runtime.d.ts +0 -0
  14. package/lib/parser/cals/utils/runtime.d.ts.map +0 -0
  15. package/lib/parser/cals/utils/runtime.js +0 -0
  16. package/lib/parser/cals/utils/spinoff/index.d.ts +0 -0
  17. package/lib/parser/cals/utils/spinoff/index.d.ts.map +0 -0
  18. package/lib/parser/cals/utils/spinoff/index.js +0 -0
  19. package/lib/parser/cals/utils/style.d.ts +36 -6
  20. package/lib/parser/cals/utils/style.d.ts.map +1 -1
  21. package/lib/parser/cals/utils/style.js +138 -112
  22. package/lib/parser/cals/utils/template.d.ts +1 -0
  23. package/lib/parser/cals/utils/template.d.ts.map +1 -1
  24. package/lib/parser/cals/utils/template.js +3 -2
  25. package/lib/parser/cals/utils/version/common.d.ts +0 -0
  26. package/lib/parser/cals/utils/version/common.d.ts.map +0 -0
  27. package/lib/parser/cals/utils/version/common.js +0 -0
  28. package/lib/parser/cals/utils/version/config.d.ts +0 -0
  29. package/lib/parser/cals/utils/version/config.d.ts.map +0 -0
  30. package/lib/parser/cals/utils/version/config.js +0 -0
  31. package/lib/parser/cals/utils/version/index.d.ts +0 -0
  32. package/lib/parser/cals/utils/version/index.d.ts.map +0 -0
  33. package/lib/parser/cals/utils/version/index.js +0 -0
  34. package/lib/parser/cals/utils/version/parses.d.ts +0 -0
  35. package/lib/parser/cals/utils/version/parses.d.ts.map +0 -0
  36. package/lib/parser/cals/utils/version/parses.js +0 -0
  37. package/lib/parser/cals/utils/version/utils.d.ts +0 -0
  38. package/lib/parser/cals/utils/version/utils.d.ts.map +0 -0
  39. package/lib/parser/cals/utils/version/utils.js +0 -0
  40. package/lib/parser/expression/index.d.ts +0 -0
  41. package/lib/parser/expression/index.d.ts.map +0 -0
  42. package/lib/parser/expression/index.js +0 -0
  43. package/lib/parser/index.d.ts +2 -1
  44. package/lib/parser/index.d.ts.map +1 -1
  45. package/lib/parser/index.js +7 -1
  46. package/lib/parser/plugins/postcss-rpx2clac.d.ts +18 -0
  47. package/lib/parser/plugins/postcss-rpx2clac.d.ts.map +1 -0
  48. package/lib/parser/plugins/postcss-rpx2clac.js +68 -0
  49. package/lib/types/basic/app.d.ts +0 -0
  50. package/lib/types/basic/app.d.ts.map +0 -0
  51. package/lib/types/basic/app.js +0 -0
  52. package/lib/types/basic/common.d.ts +0 -0
  53. package/lib/types/basic/common.d.ts.map +0 -0
  54. package/lib/types/basic/common.js +0 -0
  55. package/lib/types/basic/component.d.ts +0 -0
  56. package/lib/types/basic/component.d.ts.map +0 -0
  57. package/lib/types/basic/component.js +0 -0
  58. package/lib/types/basic/datasource.d.ts +0 -0
  59. package/lib/types/basic/datasource.d.ts.map +0 -0
  60. package/lib/types/basic/datasource.js +0 -0
  61. package/lib/types/index.d.ts +0 -0
  62. package/lib/types/index.d.ts.map +0 -0
  63. package/lib/types/index.js +0 -0
  64. package/lib/types/lcds.d.ts +0 -0
  65. package/lib/types/lcds.d.ts.map +0 -0
  66. package/lib/types/lcds.js +0 -0
  67. package/lib/types/platform/app.d.ts +5 -0
  68. package/lib/types/platform/app.d.ts.map +1 -1
  69. package/lib/types/platform/app.js +0 -0
  70. package/lib/types/platform/common.d.ts +0 -0
  71. package/lib/types/platform/common.d.ts.map +0 -0
  72. package/lib/types/platform/common.js +0 -0
  73. package/lib/types/platform/component.d.ts +0 -0
  74. package/lib/types/platform/component.d.ts.map +0 -0
  75. package/lib/types/platform/component.js +0 -0
  76. package/lib/types/platform/datasource.d.ts +0 -0
  77. package/lib/types/platform/datasource.d.ts.map +0 -0
  78. package/lib/types/platform/datasource.js +0 -0
  79. package/lib/types/platform/widget/form.d.ts +0 -0
  80. package/lib/types/platform/widget/form.d.ts.map +0 -0
  81. package/lib/types/platform/widget/form.js +0 -0
  82. package/lib/types/platform/widget/meta.d.ts +0 -0
  83. package/lib/types/platform/widget/meta.d.ts.map +0 -0
  84. package/lib/types/platform/widget/meta.js +0 -0
  85. package/lib/utils/CSSProperty.d.ts +0 -0
  86. package/lib/utils/CSSProperty.d.ts.map +0 -0
  87. package/lib/utils/CSSProperty.js +0 -0
  88. package/lib/utils/build.d.ts +0 -0
  89. package/lib/utils/build.d.ts.map +0 -0
  90. package/lib/utils/build.js +0 -0
  91. package/lib/utils/constant.d.ts +0 -0
  92. package/lib/utils/constant.d.ts.map +0 -0
  93. package/lib/utils/constant.js +0 -0
  94. package/lib/utils/index.d.ts +0 -0
  95. package/lib/utils/index.d.ts.map +0 -0
  96. package/lib/utils/index.js +0 -0
  97. package/package.json +1 -1
  98. package/lib/types/editor/stylePanelVisible.d.ts +0 -60
  99. package/lib/types/editor/stylePanelVisible.d.ts.map +0 -1
  100. package/lib/types/editor/stylePanelVisible.js +0 -2
@@ -357,5 +357,12 @@ export declare function deserializeComponentLibraryMeta(meta: {
357
357
  };
358
358
  export declare function processRuntimeCodeResources(ctx: {
359
359
  id: string;
360
+ version?: string;
360
361
  }, resources: any[], scope: string): any[];
362
+ /**
363
+ * 解析 cals version 来生成 feature map
364
+ */
365
+ export declare function parseVersion(version?: string): {
366
+ defaultDynamicCssUnit: boolean;
367
+ };
361
368
  //# sourceMappingURL=index.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;;;EAiCvB;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,SAAS,OAAyB,EAClC,KAAK,EAAE,MAAM,SAkCd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,SAAK,GAAG;IAC1C,qBAAqB,EAAE,OAAO,CAAC;CAChC,CAcA"}
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimePage = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
14
+ exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimePage = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
15
15
  const lodash_1 = require("lodash");
16
16
  const common_1 = require("../../types/platform/common");
17
17
  const expression_1 = require("../expression");
@@ -1075,3 +1075,21 @@ function processRuntimeCodeResources(ctx, resources /* : IWeappCode[]*/ = [], sc
1075
1075
  return resources.filter((m) => m.name !== common_1.ECodeName.PLACEHOLDER);
1076
1076
  }
1077
1077
  exports.processRuntimeCodeResources = processRuntimeCodeResources;
1078
+ /**
1079
+ * 解析 cals version 来生成 feature map
1080
+ */
1081
+ function parseVersion(version = '') {
1082
+ const list = version.split('.');
1083
+ const FEATURE_MAP = {
1084
+ /**
1085
+ * 默认单位为 px,
1086
+ * 然后进行动态转换 为 rem及rpx
1087
+ */
1088
+ defaultDynamicCssUnit: true,
1089
+ };
1090
+ if (list[0] === '4' || version === 'latest') {
1091
+ FEATURE_MAP.defaultDynamicCssUnit = false;
1092
+ }
1093
+ return FEATURE_MAP;
1094
+ }
1095
+ exports.parseVersion = parseVersion;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,13 +1,43 @@
1
1
  import { Properties } from 'csstype';
2
2
  export declare function removeInvalidStyleFormValue(styleForm?: any): any;
3
+ /**
4
+ * Convert WeApps common style to css styles(React.CSSProperties)
5
+ * toRem/toRpx/toRpx 三者互斥 @deprecated
6
+ * 应使用 defaultUnit 来声明
7
+ */
3
8
  export declare function processCommonStyle2CSSProperties(commonStyle?: any, options?: {
4
- toRem: boolean;
9
+ /**
10
+ * 默认 px/无单位 转 rem
11
+ * @deprecated
12
+ */
13
+ toRem?: boolean;
14
+ /**
15
+ * 默认 px/无单位 转为rpx
16
+ * @deprecated
17
+ */
18
+ toRpx?: boolean;
19
+ /**
20
+ * px/无单位情况下 处理为何单位
21
+ * rem | rpx | px
22
+ * 优先级高于以上
23
+ */
24
+ defaultUnit?: 'rem' | 'px' | 'rpx';
25
+ /**
26
+ * 是否使用 calc(xx px / `${rpxCalcRoot}`) 来模拟rpx
27
+ * 小程序不需要转
28
+ */
29
+ rpxCalcRoot?: string;
5
30
  ignoreSelf?: boolean;
6
31
  addPXUnit?: boolean;
7
- toRpx?: boolean;
8
- valueComputeFunction?: (value: any) => number | string;
9
- }): Properties<string | number>;
10
- export declare function processCSSProperties2Rem(style?: Properties<string | number>, options?: {
11
- looseError: boolean;
12
32
  }): Properties<string | number>;
33
+ interface ITranslateStyleOptions {
34
+ looseError?: boolean;
35
+ rpxCalcRoot?: string;
36
+ }
37
+ /**
38
+ * @deprecated
39
+ */
40
+ export declare function processCSSProperties2Rem(style?: Properties<string | number>, options?: ITranslateStyleOptions): Properties<string | number>;
41
+ export declare function processCSSPropertiesUnit(style: Properties<string | number>, type: 'px' | 'rem' | 'rpx', options?: ITranslateStyleOptions): {};
42
+ export {};
13
43
  //# sourceMappingURL=style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AAMnC,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,GAA2B,GAAG,GAAG,CAUvF;AA2KD,wBAAgB,gCAAgC,CAC9C,WAAW,GAAE,GAAQ,EACrB,OAAO,GAAE;IACP,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oBAAoB,CAAC,EAAE,CAAC,KAAK,KAAA,KAAK,MAAM,GAAG,MAAM,CAAC;CACgB,GACnE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAyT7B;AASD,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO;;CAAsB,GAC5B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAMrC,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,GAA2B,GAAG,GAAG,CAUvF;AAwKD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,GAAE,GAAQ,EACrB,OAAO,GAAE;IACP;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACwE,GAC7F,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CA6T7B;AAED,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,EAC1B,OAAO,CAAC,EAAE,sBAAsB,MAajC"}
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.removeInvalidStyleFormValue = void 0;
14
+ exports.processCSSPropertiesUnit = exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.removeInvalidStyleFormValue = void 0;
15
15
  const common_1 = require("./common");
16
16
  const lodash_1 = require("lodash");
17
17
  const utils_1 = require("../../../utils");
@@ -48,45 +48,46 @@ function setStyleValue(object, key, value) {
48
48
  object[(0, common_1.camelcase)(key)] = value;
49
49
  }
50
50
  }
51
- function _handleStyleNumValue(styleVal, addPXUnit, valueComputeFunction) {
52
- let transformedValue = styleVal;
53
- if (typeof valueComputeFunction === 'function') {
54
- transformedValue = valueComputeFunction(transformedValue);
55
- }
56
- if (transformedValue !== undefined) {
57
- transformedValue = String(transformedValue);
58
- }
59
- if (typeof transformedValue === 'string' && addPXUnit && transformedValue.search(/^\d*\.?\d+$/) >= 0) {
60
- return `${transformedValue}px`;
51
+ function _handleStyleNumValue(styleVal, addPXUnit) {
52
+ if (addPXUnit) {
53
+ /**
54
+ * 2022.12.13
55
+ * 改分支未启用
56
+ */
57
+ const value = `${styleVal}`;
58
+ if (/^\d*.?\d+$/.test(value)) {
59
+ return `${value}px`;
60
+ }
61
61
  }
62
- return transformedValue;
62
+ return styleVal;
63
63
  }
64
- function setDistanceStyle(style, distance, attr, addPXUnit, valueComputeFunction) {
64
+ function setDistanceStyle(style, distance, attr, addPXUnit) {
65
65
  const attributeKey = (0, common_1.camelcase)(`${attr}`);
66
66
  if (Object.keys(distance).length === 4) {
67
67
  if ((0, lodash_1.uniq)((0, lodash_1.map)(distance, (val) => val)).length === 1) {
68
68
  // 4个值全相等的情况
69
- setStyleValue(style, attributeKey, _handleStyleNumValue(distance.top, addPXUnit, valueComputeFunction));
69
+ setStyleValue(style, attributeKey, _handleStyleNumValue(distance.top, addPXUnit));
70
70
  }
71
71
  else if (distance.top === distance.bottom && distance.left === distance.right) {
72
72
  // 俩俩相等的情况
73
- setStyleValue(style, attributeKey, `${_handleStyleNumValue(distance.top, addPXUnit, valueComputeFunction)} ${_handleStyleNumValue(distance.right, addPXUnit, valueComputeFunction)}`);
73
+ setStyleValue(style, attributeKey, `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)}`);
74
74
  }
75
75
  else if (distance.left === distance.right) {
76
- setStyleValue(style, attributeKey, `${_handleStyleNumValue(distance.top, addPXUnit, valueComputeFunction)} ${_handleStyleNumValue(distance.right, addPXUnit, valueComputeFunction)} ${_handleStyleNumValue(distance.bottom, addPXUnit, valueComputeFunction)}`);
76
+ setStyleValue(style, attributeKey, `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)}`);
77
77
  }
78
78
  else {
79
- setStyleValue(style, attributeKey, `${_handleStyleNumValue(distance.top, addPXUnit, valueComputeFunction)} ${_handleStyleNumValue(distance.right, addPXUnit, valueComputeFunction)} ${_handleStyleNumValue(distance.bottom, addPXUnit, valueComputeFunction)} ${_handleStyleNumValue(distance.left, addPXUnit, valueComputeFunction)}`);
79
+ setStyleValue(style, attributeKey, `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)} ${_handleStyleNumValue(distance.left, addPXUnit)}`);
80
80
  }
81
81
  }
82
82
  else {
83
83
  DISTANCE_KEY_LIST.forEach((key) => {
84
84
  if (distance[key] !== undefined)
85
- setStyleValue(style, (0, common_1.camelcase)(`${attr}_${key}`), _handleStyleNumValue(distance[key], addPXUnit, valueComputeFunction));
85
+ setStyleValue(style, (0, common_1.camelcase)(`${attr}_${key}`), _handleStyleNumValue(distance[key], addPXUnit));
86
86
  });
87
87
  }
88
88
  }
89
- function translateStyleByHandler(style = {}, handler, options = { looseError: false }) {
89
+ function translateStyleByHandler(style = {}, handler, options) {
90
+ const { looseError = false, rpxCalcRoot } = options || {};
90
91
  return Object.keys(style).reduce((result, key) => {
91
92
  const value = style[key];
92
93
  if (utils_1.isUnitlessNumber[key]) {
@@ -94,10 +95,10 @@ function translateStyleByHandler(style = {}, handler, options = { looseError: fa
94
95
  }
95
96
  else if (value !== undefined && value !== null) {
96
97
  try {
97
- setStyleValue(result, key, handler(value));
98
+ setStyleValue(result, key, handler(value, rpxCalcRoot));
98
99
  }
99
100
  catch (e) {
100
- if (options.looseError) {
101
+ if (looseError) {
101
102
  console.warn('translate style error, key:value', key, value);
102
103
  }
103
104
  else {
@@ -108,62 +109,84 @@ function translateStyleByHandler(style = {}, handler, options = { looseError: fa
108
109
  return result;
109
110
  }, {});
110
111
  }
111
- function calPxToREM(px) {
112
- if (Number.isNaN(px / 28))
113
- return px.toString();
114
- if (+px === 0) {
115
- return '0';
116
- }
117
- return `${(px / 28).toFixed(4)}rem`;
118
- }
119
- function toREM(cssLen) {
120
- if (typeof cssLen === 'string') {
121
- const cssLenArr = cssLen.split(' ');
112
+ function toREM(cssLen, rpxCalcRoot = undefined) {
113
+ if (typeof cssLen === 'string' || typeof cssLen === 'number') {
114
+ const cssLenArr = `${cssLen}`.split(' ');
122
115
  return cssLenArr
123
116
  .map((attr) => {
124
- const matchResult = attr.match(/^(-?\d+)(px)?$/);
117
+ const matchResult = attr.match(/^(-?\d+)(r?px)?$/);
125
118
  if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
126
- return calPxToREM(+matchResult[1]);
119
+ const px = +matchResult[1];
120
+ if (Number.isNaN(px / 1))
121
+ return px.toString();
122
+ if (+px === 0) {
123
+ return '0';
124
+ }
125
+ if ((matchResult === null || matchResult === void 0 ? void 0 : matchResult[2]) === 'rpx') {
126
+ return rpxCalcRoot ? `calc(${px}px / ${rpxCalcRoot})` : attr;
127
+ }
128
+ return `${(px / 28).toFixed(4)}rem`;
127
129
  }
128
130
  return attr;
129
131
  })
130
132
  .join(' ');
131
133
  }
132
- else if (typeof cssLen === 'number') {
133
- return calPxToREM(cssLen);
134
- }
135
134
  else {
136
135
  throw new Error('cssLen type error ' + cssLen);
137
136
  }
138
137
  }
139
- function toRPX(cssLen) {
140
- if (typeof cssLen === 'string') {
141
- const cssLenArr = cssLen.split(' ');
142
- return cssLenArr
143
- .map((attr) => {
144
- const matchResult = attr.match(/^(-?\d+)(px)?$/);
145
- if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
146
- return `${+matchResult[1]}rpx`;
138
+ function toRPX(cssLen, rpxCalcRoot = undefined) {
139
+ const cssLenArr = `${cssLen}`.split(' ');
140
+ return cssLenArr
141
+ .map((attr) => {
142
+ const matchResult = attr.match(/^(-?\d+)(px)?$/);
143
+ if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
144
+ const px = +matchResult[1];
145
+ if (Number.isNaN(px / 1))
146
+ return px.toString();
147
+ if (+px === 0) {
148
+ return '0';
147
149
  }
148
- return attr;
149
- })
150
- .join(' ');
151
- }
152
- return `${cssLen}rpx`;
150
+ return rpxCalcRoot ? `calc(${px}px / ${rpxCalcRoot})` : `${px}rpx`;
151
+ }
152
+ return attr;
153
+ })
154
+ .join(' ');
153
155
  }
154
- // Convert WeApps common style to css styles(React.CSSProperties)
155
- function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: true, ignoreSelf: false, addPXUnit: false, toRpx: false }) {
156
+ function toPX(cssLen, rpxCalcRoot = undefined) {
157
+ const cssLenArr = `${cssLen}`.split(' ');
158
+ return cssLenArr
159
+ .map((attr) => {
160
+ const matchResult = attr.match(/^(-?\d+)(rpx)?$/);
161
+ if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
162
+ const px = +matchResult[1];
163
+ if (Number.isNaN(px / 1))
164
+ return px.toString();
165
+ if (+px === 0) {
166
+ return '0';
167
+ }
168
+ if ((matchResult === null || matchResult === void 0 ? void 0 : matchResult[2]) === 'rpx') {
169
+ return rpxCalcRoot ? `calc(${px}px / ${rpxCalcRoot})` : attr;
170
+ }
171
+ return `${+matchResult[1]}px`;
172
+ }
173
+ return attr;
174
+ })
175
+ .join(' ');
176
+ }
177
+ /**
178
+ * Convert WeApps common style to css styles(React.CSSProperties)
179
+ * toRem/toRpx/toRpx 三者互斥 @deprecated
180
+ * 应使用 defaultUnit 来声明
181
+ */
182
+ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: true, ignoreSelf: false, addPXUnit: false, toRpx: false, rpxCalcRoot: undefined }) {
156
183
  const { size,
157
184
  // transform,
158
185
  text, border, background, margin, padding, zIndex, position, display, flexConfig, custom, self, boxShadow, } = commonStyle;
159
- const { valueComputeFunction, addPXUnit } = options;
160
186
  const style = {};
161
- const innerHandleStyleNumValue = (itemStyleValue) => {
162
- return _handleStyleNumValue(itemStyleValue, !!addPXUnit, valueComputeFunction);
163
- };
164
187
  if (size) {
165
- setStyleValue(style, 'width', innerHandleStyleNumValue(size.width));
166
- setStyleValue(style, 'height', innerHandleStyleNumValue(size.height));
188
+ setStyleValue(style, 'width', _handleStyleNumValue(size.width, !!options.addPXUnit));
189
+ setStyleValue(style, 'height', _handleStyleNumValue(size.height, !!options.addPXUnit));
167
190
  }
168
191
  // if (transform) {
169
192
  // const { rotate, opacity, scale, radius } = transform
@@ -202,7 +225,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
202
225
  }
203
226
  if (text) {
204
227
  setStyleValue(style, 'color', text.color);
205
- setStyleValue(style, 'fontSize', innerHandleStyleNumValue(text.fontSize));
228
+ setStyleValue(style, 'fontSize', _handleStyleNumValue(text.fontSize, !!options.addPXUnit));
206
229
  setStyleValue(style, 'lineHeight', text.lineHeight);
207
230
  setStyleValue(style, 'textAlign', text.textAlign);
208
231
  setStyleValue(style, 'fontWeight', text.weight);
@@ -215,10 +238,10 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
215
238
  // width
216
239
  if (typeof width === 'string') {
217
240
  if (type && type !== 'none') {
218
- setStyleValue(style, 'border', `${innerHandleStyleNumValue(width)} ${type} ${color || ''}`);
241
+ setStyleValue(style, 'border', `${_handleStyleNumValue(width, !!options.addPXUnit)} ${type} ${color || ''}`);
219
242
  }
220
243
  else {
221
- setStyleValue(style, 'borderWidth', innerHandleStyleNumValue(width));
244
+ setStyleValue(style, 'borderWidth', _handleStyleNumValue(width, !!options.addPXUnit));
222
245
  if (color)
223
246
  setStyleValue(style, 'borderColor', color);
224
247
  }
@@ -227,7 +250,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
227
250
  // https://developer.mozilla.org/zh-CN/docs/Web/CSS/border
228
251
  // 虽然border-width,、border-style和 border-color 简写属性接受最多 4 个参数来为不同的边设置宽度、风格和颜色,但 boder 属性只接受三个参数,分别是宽度、风格和颜色,所以这样会使得四条边的边框相同。
229
252
  const { top = '0', right = '0', bottom = '0', left = '0' } = width;
230
- setStyleValue(style, 'borderWidth', `${innerHandleStyleNumValue(top) || '0'} ${innerHandleStyleNumValue(right) || '0'} ${innerHandleStyleNumValue(bottom) || '0'} ${innerHandleStyleNumValue(left) || '0'}`);
253
+ setStyleValue(style, 'borderWidth', `${_handleStyleNumValue(top, !!options.addPXUnit) || '0'} ${_handleStyleNumValue(right, !!options.addPXUnit) || '0'} ${_handleStyleNumValue(bottom, !!options.addPXUnit) || '0'} ${_handleStyleNumValue(left, !!options.addPXUnit) || '0'}`);
231
254
  if (type) {
232
255
  setStyleValue(style, 'borderStyle', type);
233
256
  }
@@ -237,7 +260,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
237
260
  }
238
261
  // border radius
239
262
  if (radius !== undefined) {
240
- setStyleValue(style, 'borderRadius', innerHandleStyleNumValue(radius));
263
+ setStyleValue(style, 'borderRadius', _handleStyleNumValue(radius, !!options.addPXUnit));
241
264
  }
242
265
  if (radiusInfo && !(0, common_1.isEmptyObj)(radiusInfo)) {
243
266
  let { topLeft, topRight, bottomRight, bottomLeft } = radiusInfo;
@@ -259,24 +282,24 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
259
282
  }
260
283
  if ((0, lodash_1.uniq)((0, lodash_1.map)(radiusInfo, (val) => val)).length === 1) {
261
284
  // 4个值全相等的情况
262
- setStyleValue(style, 'borderRadius', innerHandleStyleNumValue(topLeft));
285
+ setStyleValue(style, 'borderRadius', _handleStyleNumValue(topLeft, !!options.addPXUnit));
263
286
  }
264
287
  else if (topLeft === bottomRight && topRight === bottomLeft) {
265
288
  // 俩俩相等的情况
266
- setStyleValue(style, 'borderRadius', `${innerHandleStyleNumValue(topLeft)} ${innerHandleStyleNumValue(topRight)}`);
289
+ setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(topRight, !!options.addPXUnit)}`);
267
290
  }
268
291
  else if (topRight === bottomLeft) {
269
- setStyleValue(style, 'borderRadius', `${innerHandleStyleNumValue(topLeft)} ${innerHandleStyleNumValue(topRight)} ${innerHandleStyleNumValue(bottomRight)}`);
292
+ setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(topRight, !!options.addPXUnit)} ${_handleStyleNumValue(bottomRight, !!options.addPXUnit)}`);
270
293
  }
271
294
  else {
272
- setStyleValue(style, 'borderRadius', `${innerHandleStyleNumValue(topLeft)} ${innerHandleStyleNumValue(topRight)} ${innerHandleStyleNumValue(bottomRight)} ${innerHandleStyleNumValue(bottomLeft)}`);
295
+ setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(topRight, !!options.addPXUnit)} ${_handleStyleNumValue(bottomRight, !!options.addPXUnit)} ${_handleStyleNumValue(bottomLeft, !!options.addPXUnit)}`);
273
296
  }
274
297
  }
275
298
  else {
276
- setStyleValue(style, 'borderTopLeftRadius', innerHandleStyleNumValue(topLeft));
277
- setStyleValue(style, 'borderTopRightRadius', innerHandleStyleNumValue(topRight));
278
- setStyleValue(style, 'borderBottomRightRadius', innerHandleStyleNumValue(bottomRight));
279
- setStyleValue(style, 'borderBottomLeftRadius', innerHandleStyleNumValue(bottomLeft));
299
+ setStyleValue(style, 'borderTopLeftRadius', _handleStyleNumValue(topLeft, !!options.addPXUnit));
300
+ setStyleValue(style, 'borderTopRightRadius', _handleStyleNumValue(topRight, !!options.addPXUnit));
301
+ setStyleValue(style, 'borderBottomRightRadius', _handleStyleNumValue(bottomRight, !!options.addPXUnit));
302
+ setStyleValue(style, 'borderBottomLeftRadius', _handleStyleNumValue(bottomLeft, !!options.addPXUnit));
280
303
  }
281
304
  }
282
305
  if (type === 'none') {
@@ -301,11 +324,11 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
301
324
  if (repeat)
302
325
  style.background += ` ${repeat}`;
303
326
  if (size) {
304
- setStyleValue(style, 'backgroundSize', innerHandleStyleNumValue(size));
327
+ setStyleValue(style, 'backgroundSize', _handleStyleNumValue(size, !!options.addPXUnit));
305
328
  }
306
329
  setStyleValue(style, 'backgroundPosition', position);
307
330
  if (positionObj && !(0, common_1.isEmptyObj)(positionObj)) {
308
- style.background += ` ${innerHandleStyleNumValue(positionObj.left)} ${innerHandleStyleNumValue(positionObj.top)}`;
331
+ style.background += ` ${_handleStyleNumValue(positionObj.left, !!options.addPXUnit)} ${_handleStyleNumValue(positionObj.top, !!options.addPXUnit)}`;
309
332
  }
310
333
  }
311
334
  // FIXME: 这里兼容原有应用的数据,后面应去掉
@@ -314,7 +337,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
314
337
  if (image != null) {
315
338
  style.backgroundImage = `url(${image})`;
316
339
  setStyleValue(style, 'backgroundRepeat', repeat);
317
- setStyleValue(style, 'backgroundSize', innerHandleStyleNumValue(size));
340
+ setStyleValue(style, 'backgroundSize', _handleStyleNumValue(size, !!options.addPXUnit));
318
341
  setStyleValue(style, 'backgroundPosition', position);
319
342
  }
320
343
  }
@@ -322,16 +345,16 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
322
345
  if (position) {
323
346
  setStyleValue(style, 'position', position.position);
324
347
  if (position.left !== undefined) {
325
- setStyleValue(style, 'left', innerHandleStyleNumValue(position.left));
348
+ setStyleValue(style, 'left', _handleStyleNumValue(position.left, !!options.addPXUnit));
326
349
  }
327
350
  if (position.right !== undefined) {
328
- setStyleValue(style, 'right', innerHandleStyleNumValue(position.right));
351
+ setStyleValue(style, 'right', _handleStyleNumValue(position.right, !!options.addPXUnit));
329
352
  }
330
353
  if (position.top !== undefined) {
331
- setStyleValue(style, 'top', innerHandleStyleNumValue(position.top));
354
+ setStyleValue(style, 'top', _handleStyleNumValue(position.top, !!options.addPXUnit));
332
355
  }
333
356
  if (position.bottom !== undefined) {
334
- setStyleValue(style, 'bottom', innerHandleStyleNumValue(position.bottom));
357
+ setStyleValue(style, 'bottom', _handleStyleNumValue(position.bottom, !!options.addPXUnit));
335
358
  }
336
359
  }
337
360
  if (boxShadow) {
@@ -341,7 +364,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
341
364
  }
342
365
  let boxShadowStyleString = '';
343
366
  if (Array.isArray(processedBoxShadow)) {
344
- processedBoxShadow.forEach((boxShadowItem) => {
367
+ processedBoxShadow.forEach((boxShadowItem, index) => {
345
368
  let currentBoxShadowStyleString = '';
346
369
  const { keyWord, offsetX, offsetY, blurRadius, spreadRadius, color, global, inset } = boxShadowItem;
347
370
  // Keyword values
@@ -357,31 +380,17 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
357
380
  currentBoxShadowStyleString = 'inset ';
358
381
  }
359
382
  // offsetX
360
- if (!!offsetX) {
361
- currentBoxShadowStyleString += innerHandleStyleNumValue(offsetX);
362
- }
363
- else {
364
- currentBoxShadowStyleString += '0';
365
- }
383
+ currentBoxShadowStyleString += _handleStyleNumValue(!!offsetX ? offsetX : 0, !!options.addPXUnit);
366
384
  // offsetY
367
- if (!!offsetY) {
368
- currentBoxShadowStyleString += ' ' + innerHandleStyleNumValue(offsetY);
369
- }
370
- else {
371
- currentBoxShadowStyleString += ' 0';
372
- }
385
+ currentBoxShadowStyleString += ' ' + _handleStyleNumValue(!!offsetY ? offsetY : 0, !!options.addPXUnit);
373
386
  // blur-radius 当 spread-radius 存在时,即使不存在 blur-radius,blur-radius 也要为 0
374
387
  if (!!blurRadius || !!spreadRadius) {
375
- if (!!blurRadius) {
376
- currentBoxShadowStyleString += ' ' + innerHandleStyleNumValue(blurRadius);
377
- }
378
- else {
379
- currentBoxShadowStyleString += ' 0';
380
- }
388
+ currentBoxShadowStyleString +=
389
+ ' ' + _handleStyleNumValue(!!blurRadius ? blurRadius : 0, !!options.addPXUnit);
381
390
  }
382
391
  // spread-radius
383
392
  if (!!spreadRadius) {
384
- currentBoxShadowStyleString += ' ' + innerHandleStyleNumValue(spreadRadius);
393
+ currentBoxShadowStyleString += ' ' + _handleStyleNumValue(spreadRadius, !!options.addPXUnit);
385
394
  }
386
395
  // color
387
396
  if (!!color) {
@@ -389,13 +398,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
389
398
  }
390
399
  }
391
400
  if (!!currentBoxShadowStyleString) {
392
- let splitLabel;
393
- if (!!boxShadowStyleString) {
394
- splitLabel = ' , ';
395
- }
396
- else {
397
- splitLabel = '';
398
- }
401
+ const splitLabel = !!boxShadowStyleString ? ' , ' : '';
399
402
  boxShadowStyleString += splitLabel + currentBoxShadowStyleString;
400
403
  }
401
404
  });
@@ -419,16 +422,39 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
419
422
  style[key] = value[value.length - 1];
420
423
  }
421
424
  }
422
- if (options.toRpx) {
423
- return translateStyleToRpx(style);
425
+ let { defaultUnit } = options;
426
+ const translateStyleOptions = { rpxCalcRoot: options.rpxCalcRoot };
427
+ if (!defaultUnit) {
428
+ if (options.toRpx) {
429
+ defaultUnit = 'rpx';
430
+ }
431
+ if (options.toRem) {
432
+ defaultUnit = 'rem';
433
+ }
434
+ }
435
+ if (defaultUnit) {
436
+ return processCSSPropertiesUnit(style, defaultUnit, translateStyleOptions);
424
437
  }
425
- return options.toRem ? processCSSProperties2Rem(style) : style;
438
+ return style;
426
439
  }
427
440
  exports.processCommonStyle2CSSProperties = processCommonStyle2CSSProperties;
428
- function translateStyleToRpx(style = {}, options = { looseError: false }) {
429
- return translateStyleByHandler(style, toRPX, options);
430
- }
431
- function processCSSProperties2Rem(style = {}, options = { looseError: false }) {
441
+ /**
442
+ * @deprecated
443
+ */
444
+ function processCSSProperties2Rem(style = {}, options) {
432
445
  return translateStyleByHandler(style, toREM, options);
433
446
  }
434
447
  exports.processCSSProperties2Rem = processCSSProperties2Rem;
448
+ function processCSSPropertiesUnit(style = {}, type, options) {
449
+ const handerMap = {
450
+ px: toPX,
451
+ rem: toREM,
452
+ rpx: toRPX,
453
+ };
454
+ const handler = handerMap[type] ||
455
+ function (cssLen, _) {
456
+ return cssLen;
457
+ };
458
+ return translateStyleByHandler(style, handler, options);
459
+ }
460
+ exports.processCSSPropertiesUnit = processCSSPropertiesUnit;
@@ -1,5 +1,6 @@
1
1
  import { ECodeType } from '../../../types';
2
2
  export declare function generateDefaultCode(ctx: {
3
3
  id: string;
4
+ version?: string;
4
5
  }, type: ECodeType, scope: 'component' | 'page' | 'app'): string;
5
6
  //# sourceMappingURL=template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAqM3C,wBAAgB,mBAAmB,CAAC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,UA2B5G"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAqM3C,wBAAgB,mBAAmB,CACjC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,UA6BpC"}
@@ -159,7 +159,7 @@ export function sayHi() {
159
159
  // 使用theme中的变量
160
160
  // color: <% if (type === 'app' || type === 'page') { %>@example-primary-color<% } %><% if (type === 'component') { %>blue<% } %>;
161
161
 
162
- // 默认 px 会转换成 rem,含大写字母 PX 和 Px 则不会转换
162
+ // <%= version[0] === '4' ? '默认 rpx 会转换成 动态cals实现,px/PX/Px 均代表传统一样上的px':'默认 px 会转换成 rem,含大写字母 PX 和 Px 则不会转换' %>
163
163
  // margin-top: 20px;
164
164
  // 使用theme中的混合(mixins)
165
165
  // <%= type === 'component' ? '':'.mixins();' %>
@@ -198,10 +198,11 @@ export default function(props) {
198
198
  }`,
199
199
  };
200
200
  function generateDefaultCode(ctx, type, scope) {
201
- const { id } = ctx;
201
+ const { id, version = '' } = ctx;
202
202
  const data = {
203
203
  type: scope,
204
204
  id,
205
+ version,
205
206
  };
206
207
  switch (type) {
207
208
  case types_1.ECodeType.LIFECYCLE: {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -4,5 +4,6 @@ export { processComponentModule } from './cals/utils/spinoff';
4
4
  export { calsToCode, codeToCals, ICodeItem, checkForConflicts, autoResolveConflicts } from './cals/utils/code';
5
5
  export { parseComponentCals } from './cals/utils/block';
6
6
  export { ActionType, IDataBind, PropBindType } from './expression/index';
7
- export { processCommonStyle2CSSProperties, processCSSProperties2Rem } from './cals/utils/style';
7
+ export { processCommonStyle2CSSProperties, processCSSProperties2Rem, processCSSPropertiesUnit, } from './cals/utils/style';
8
+ export { default as PostcssRpx2Calc } from './plugins/postcss-rpx2clac';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EACL,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
@@ -13,8 +13,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
16
19
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.PropBindType = exports.ActionType = exports.parseComponentCals = exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = exports.processComponentModule = exports.upgrageToVersion2 = void 0;
20
+ exports.PostcssRpx2Calc = exports.processCSSPropertiesUnit = exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.PropBindType = exports.ActionType = exports.parseComponentCals = exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = exports.processComponentModule = exports.upgrageToVersion2 = void 0;
18
21
  __exportStar(require("./cals/index"), exports);
19
22
  var version_1 = require("./cals/utils/version");
20
23
  Object.defineProperty(exports, "upgrageToVersion2", { enumerable: true, get: function () { return version_1.upgrageToVersion2; } });
@@ -33,3 +36,6 @@ Object.defineProperty(exports, "PropBindType", { enumerable: true, get: function
33
36
  var style_1 = require("./cals/utils/style");
34
37
  Object.defineProperty(exports, "processCommonStyle2CSSProperties", { enumerable: true, get: function () { return style_1.processCommonStyle2CSSProperties; } });
35
38
  Object.defineProperty(exports, "processCSSProperties2Rem", { enumerable: true, get: function () { return style_1.processCSSProperties2Rem; } });
39
+ Object.defineProperty(exports, "processCSSPropertiesUnit", { enumerable: true, get: function () { return style_1.processCSSPropertiesUnit; } });
40
+ var postcss_rpx2clac_1 = require("./plugins/postcss-rpx2clac");
41
+ Object.defineProperty(exports, "PostcssRpx2Calc", { enumerable: true, get: function () { return __importDefault(postcss_rpx2clac_1).default; } });
@@ -0,0 +1,18 @@
1
+ declare function Plugin(opt?: {
2
+ root?: string;
3
+ zoom?: number;
4
+ precision?: number;
5
+ outUnit?: string;
6
+ exclude?: string;
7
+ }): {
8
+ postcssPlugin: string;
9
+ Once(root: any, { result }: {
10
+ result: any;
11
+ }): void;
12
+ };
13
+ declare namespace Plugin {
14
+ var postcss: boolean;
15
+ var CALC_RPX_ROOT_VAL_NAME: string;
16
+ }
17
+ export default Plugin;
18
+ //# sourceMappingURL=postcss-rpx2clac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postcss-rpx2clac.d.ts","sourceRoot":"","sources":["../../../src/parser/plugins/postcss-rpx2clac.ts"],"names":[],"mappings":"AA+BA,iBAAS,MAAM,CAAC,GAAG,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;EAqC7G;kBArCQ,MAAM;;;;AA0Cf,eAAe,MAAM,CAAC"}
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const DEFAULT_CONFIG = {
4
+ root: '2',
5
+ /**
6
+ * 缩放比例
7
+ */
8
+ zoom: 1,
9
+ /**
10
+ * 配置精度
11
+ */
12
+ precision: 5,
13
+ /**
14
+ * 输出单位
15
+ */
16
+ outUnit: 'px',
17
+ /**
18
+ * 配置忽略文件,正则匹配
19
+ */
20
+ exclude: '',
21
+ };
22
+ /**
23
+ * https://github.com/cuth/postcss-pxtorem/blob/122649015322214f8e9d1ac852eb11c0791b634b/index.js#L56
24
+ */
25
+ function toFixed(number, precision) {
26
+ const multiplier = Math.pow(10, precision + 1), wholeNumber = Math.floor(number * multiplier);
27
+ return (Math.round(wholeNumber / 10) * 10) / multiplier;
28
+ }
29
+ function Plugin(opt) {
30
+ opt = Object.assign(Object.assign({}, DEFAULT_CONFIG), (opt || {}));
31
+ const { root: rootValue, zoom, precision, outUnit, exclude } = opt;
32
+ return {
33
+ postcssPlugin: 'postcss-rpx2calc',
34
+ Once(root, { result }) {
35
+ if (exclude && root.source.input.file.match(exclude) !== null) {
36
+ result.root = root;
37
+ return;
38
+ }
39
+ root.walkRules(function (rule) {
40
+ rule.walkDecls(function (decl) {
41
+ if (decl.value.includes('rpx')) {
42
+ /**
43
+ * copy form
44
+ * https://github.com/cuth/postcss-pxtorem/blob/122649015322214f8e9d1ac852eb11c0791b634b/lib/pixel-unit-regex.js#L9
45
+ * 不处理 var()rpx 的情况
46
+ */
47
+ const r2 = /"[^"]+"|'[^']+'|url\([^)]+\)|var\([^)]+\)|(\d*\.?\d+)rpx/g;
48
+ decl.value = decl.value.replace(r2, (str, num1) => {
49
+ if (num1 == undefined)
50
+ return str;
51
+ if (num1 == '0')
52
+ return '0';
53
+ const v = +num1 / zoom;
54
+ if (isNaN(v)) {
55
+ return str;
56
+ }
57
+ const value = Number.isInteger(v) ? v.toString() : toFixed(v, precision);
58
+ return `calc(${value}${outUnit}/${rootValue})`;
59
+ });
60
+ }
61
+ });
62
+ });
63
+ },
64
+ };
65
+ }
66
+ Plugin.postcss = true;
67
+ Plugin.CALC_RPX_ROOT_VAL_NAME = '--wd-rpx-radio';
68
+ exports.default = Plugin;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/lib/types/lcds.js CHANGED
File without changes
@@ -14,6 +14,11 @@ export declare enum EExternalResourceType {
14
14
  * 云开发低码平台应用
15
15
  */
16
16
  export interface IPlatformApp extends Omit<Basic.IApp, 'attributes' | 'events' | 'listeners' | 'items' | 'resources'> {
17
+ /**
18
+ * semer version
19
+ * x.x.x | latest
20
+ */
21
+ schemaVersion?: string;
17
22
  /**
18
23
  * 必填, 应用的组件集合
19
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/types/platform/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAuC,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,oBAAY,qBAAqB;IAC/B,KAAK,UAAU;I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AAC;IAEzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED,MAAM,WAAW,qBAAsB,SAAQ,OAAO;IACpD;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cals",
3
- "version": "0.5.3-beta.0.2",
3
+ "version": "0.5.4-alpha.0",
4
4
  "description": "Common application specifications",
5
5
  "main": "lib/utils/index.js",
6
6
  "source": "src/utils/index.ts",
@@ -1,60 +0,0 @@
1
- /**
2
- * 单项
3
- */
4
- export declare type IFieldConfig = {
5
- visible: boolean;
6
- description?: string;
7
- };
8
- /**
9
- * 文字面板
10
- */
11
- export declare type ITextVisible = Partial<{
12
- fontSize: IFieldConfig;
13
- color: IFieldConfig;
14
- weight: IFieldConfig;
15
- lineHeight: IFieldConfig;
16
- textAlign: IFieldConfig;
17
- }> | IFieldConfig;
18
- /**
19
- * 布局面板
20
- */
21
- export declare type ILayoutVisible = Partial<{
22
- width: IFieldConfig;
23
- height: IFieldConfig;
24
- margin: IFieldConfig;
25
- padding: IFieldConfig;
26
- flex: IFieldConfig | Partial<{
27
- justifyContent: IFieldConfig;
28
- alignItems: IFieldConfig;
29
- flexDirection: IFieldConfig;
30
- }>;
31
- displayNone: IFieldConfig;
32
- }> | IFieldConfig;
33
- /**
34
- * 布局可见配置
35
- */
36
- export declare type IFillVisible = Partial<{
37
- border: IFieldConfig;
38
- background: IFieldConfig;
39
- boxShadow: IFieldConfig;
40
- radius: IFieldConfig;
41
- opacity: IFieldConfig;
42
- }> | IFieldConfig;
43
- /**
44
- * 高级面板
45
- */
46
- export declare type IHighGradeVisible = Partial<{
47
- position: IFieldConfig;
48
- styleBind: IFieldConfig;
49
- className: IFieldConfig;
50
- }> | IFieldConfig;
51
- /**
52
- * 编辑器样式面板配置
53
- */
54
- export declare type IStylePanelVisible = Partial<{
55
- text: ITextVisible;
56
- layout: ILayoutVisible;
57
- fill: IFillVisible;
58
- highGrade: IHighGradeVisible;
59
- }>;
60
- //# sourceMappingURL=stylePanelVisible.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stylePanelVisible.d.ts","sourceRoot":"","sources":["../../../src/types/editor/stylePanelVisible.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,oBAAY,YAAY,GAAG,OAAO,CAAC;IAEjC,QAAQ,EAAE,YAAY,CAAC;IAEvB,KAAK,EAAE,YAAY,CAAC;IAEpB,MAAM,EAAE,YAAY,CAAC;IAErB,UAAU,EAAE,YAAY,CAAC;IAEzB,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC,GAAG,YAAY,CAAC;AAElB;;GAEG;AACH,oBAAY,cAAc,GAAG,OAAO,CAAC;IAEnC,KAAK,EAAE,YAAY,CAAC;IAEpB,MAAM,EAAE,YAAY,CAAC;IAErB,MAAM,EAAE,YAAY,CAAC;IAErB,OAAO,EAAE,YAAY,CAAC;IAEtB,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC;QAC3B,cAAc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