@cloudbase/cals 0.4.1 → 0.4.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/README.md +1 -1
- package/lib/parser/cals/index.d.ts +3 -0
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +1 -1
- package/lib/parser/cals/utils/style.d.ts +10 -0
- package/lib/parser/cals/utils/style.d.ts.map +1 -1
- package/lib/parser/cals/utils/style.js +284 -1
- package/lib/parser/index.d.ts +2 -1
- package/lib/parser/index.d.ts.map +1 -1
- package/lib/parser/index.js +4 -1
- package/lib/utils/CSSProperty.d.ts +60 -0
- package/lib/utils/CSSProperty.d.ts.map +1 -0
- package/lib/utils/CSSProperty.js +84 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +3 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ CALS 规范主要分为三部分 :
|
|
|
18
18
|
|
|
19
19
|
## 应用
|
|
20
20
|
|
|
21
|
-
CALS 扩展自[通用组件语言规范](https://cls.pages.woa.com/)
|
|
21
|
+
CALS 扩展自[通用组件语言规范](https://cls.pages.woa.com/),目前主要应用于微搭低代码平台,目前定义了 basic 和 platform 两套规范(platform 继承自 basic):
|
|
22
22
|
|
|
23
23
|
| 类型 | 层级 | 定义 |
|
|
24
24
|
| -------------- | ---- | ------------------------------------------ |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EACL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAkC,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe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,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;CAC3C,EACD,SAAS,EAAE,GAAG,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9B,eAAe,GAAG,iBAAiB,CAoHrC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG,CAwBzE;AAaD,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACzC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAA;KAAE,CAAC;IAC/C,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;KAAE,CAAC;CAC1C;;;;;;;mBAIY,MAAM;mBACN,MAAM;sBACH,MAAM;;;6BACwB,OAAO;;;wBACnC,MAAM;;;;;;EAiCvB;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,SAAS,OAAyB,EAAE,KAAK,EAAE,MAAM,SAiCjH"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -1034,7 +1034,7 @@ function deserializeComponentLibraryMeta(meta) {
|
|
|
1034
1034
|
processedComponents[componentName] = Object.assign(Object.assign({ title: title || component.name || componentName, desc: description || '', category: category || '', thumbnail: icon }, extra), restComponentMeta);
|
|
1035
1035
|
}
|
|
1036
1036
|
return Object.assign(Object.assign({}, restLibraryMeta), { styles,
|
|
1037
|
-
dependencies, components: processedComponents });
|
|
1037
|
+
dependencies, components: processedComponents, actions });
|
|
1038
1038
|
}
|
|
1039
1039
|
exports.deserializeComponentLibraryMeta = deserializeComponentLibraryMeta;
|
|
1040
1040
|
function processRuntimeCodeResources(ctx, resources /* : IWeappCode[]*/ = [], scope) {
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import { Properties } from 'csstype';
|
|
1
2
|
export declare function removeInvalidStyleFormValue(styleForm?: any): any;
|
|
3
|
+
export declare function processCommonStyle2CSSProperties(commonStyle?: any, options?: {
|
|
4
|
+
toRem: boolean;
|
|
5
|
+
ignoreSelf?: boolean;
|
|
6
|
+
addPXUnit?: boolean;
|
|
7
|
+
toRpx?: boolean;
|
|
8
|
+
}): Properties<string | number>;
|
|
9
|
+
export declare function processCSSProperties2Rem(style?: Properties<string | number>, options?: {
|
|
10
|
+
looseError: boolean;
|
|
11
|
+
}): Properties<string | number>;
|
|
2
12
|
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/style.ts"],"names":[],"mappings":"
|
|
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;AAKrC,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,GAA2B,GAAG,GAAG,CAUvF;AAuID,wBAAgB,gCAAgC,CAC9C,WAAW,GAAE,GAA2B,EACxC,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;CACoD,GACrE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAmN7B;AASD,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO;;CAAwB,GAC9B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B"}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeInvalidStyleFormValue = void 0;
|
|
14
|
+
exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.removeInvalidStyleFormValue = void 0;
|
|
4
15
|
const common_1 = require("./common");
|
|
16
|
+
const lodash_1 = require("lodash");
|
|
17
|
+
const CSSProperty_1 = require("../../../utils/CSSProperty");
|
|
18
|
+
const DISTANCE_KEY_LIST = ['top', 'right', 'bottom', 'left'];
|
|
5
19
|
function removeInvalidStyleFormValue(styleForm = {}) {
|
|
6
20
|
return Object.keys(styleForm).reduce((result, key) => {
|
|
7
21
|
const propStyleFormData = styleForm[key];
|
|
@@ -28,3 +42,272 @@ function setStyleValue(object, key, value) {
|
|
|
28
42
|
}
|
|
29
43
|
object[(0, common_1.camelcase)(key)] = value;
|
|
30
44
|
}
|
|
45
|
+
function _handleStyleNumValue(styleVal, addPXUnit) {
|
|
46
|
+
if (addPXUnit) {
|
|
47
|
+
const value = `${styleVal}`;
|
|
48
|
+
if (value.search(/^\d+$/) >= 0) {
|
|
49
|
+
return `${value}px`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return styleVal;
|
|
53
|
+
}
|
|
54
|
+
function setDistanceStyle(style, distance, attr, addPXUnit) {
|
|
55
|
+
if (Object.keys(distance).length === 4) {
|
|
56
|
+
if ((0, lodash_1.uniq)((0, lodash_1.map)(distance, (val) => val)).length === 1) {
|
|
57
|
+
// 4个值全相等的情况
|
|
58
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}`), _handleStyleNumValue(distance.top, addPXUnit));
|
|
59
|
+
}
|
|
60
|
+
else if (distance.top === distance.bottom && distance.left === distance.right) {
|
|
61
|
+
// 俩俩相等的情况
|
|
62
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)}`);
|
|
63
|
+
}
|
|
64
|
+
else if (distance.left === distance.right) {
|
|
65
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)}`);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}`), `${_handleStyleNumValue(distance.top, addPXUnit)} ${_handleStyleNumValue(distance.right, addPXUnit)} ${_handleStyleNumValue(distance.bottom, addPXUnit)} ${_handleStyleNumValue(distance.left, addPXUnit)}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
DISTANCE_KEY_LIST.forEach((key) => {
|
|
73
|
+
if (distance[key] !== undefined)
|
|
74
|
+
setStyleValue(style, (0, common_1.camelcase)(`${attr}_${key}`), _handleStyleNumValue(distance[key], addPXUnit));
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function translateStyleByHandler(style = {}, handler, options = { looseError: false }) {
|
|
79
|
+
return Object.keys(style).reduce((result, key) => {
|
|
80
|
+
const value = style[key];
|
|
81
|
+
if (CSSProperty_1.isUnitlessNumber[key]) {
|
|
82
|
+
setStyleValue(result, key, value);
|
|
83
|
+
}
|
|
84
|
+
else if (value !== undefined && value !== null) {
|
|
85
|
+
try {
|
|
86
|
+
setStyleValue(result, key, handler(value));
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
if (options.looseError) {
|
|
90
|
+
console.warn('translate style error, key:value', key, value);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
throw e;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}, {});
|
|
99
|
+
}
|
|
100
|
+
function calPxToREM(px) {
|
|
101
|
+
if (Number.isNaN(px / 28))
|
|
102
|
+
return px.toString();
|
|
103
|
+
if (+px === 0) {
|
|
104
|
+
return '0';
|
|
105
|
+
}
|
|
106
|
+
return `${(px / 28).toFixed(4)}rem`;
|
|
107
|
+
}
|
|
108
|
+
function toREM(cssLen) {
|
|
109
|
+
if (typeof cssLen === 'string') {
|
|
110
|
+
const cssLenArr = cssLen.split(' ');
|
|
111
|
+
return cssLenArr
|
|
112
|
+
.map((attr) => {
|
|
113
|
+
const matchResult = attr.match(/^(-?\d+)(px)?$/);
|
|
114
|
+
if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
|
|
115
|
+
return calPxToREM(+matchResult[1]);
|
|
116
|
+
}
|
|
117
|
+
return attr;
|
|
118
|
+
})
|
|
119
|
+
.join(' ');
|
|
120
|
+
}
|
|
121
|
+
else if (typeof cssLen === 'number') {
|
|
122
|
+
return calPxToREM(cssLen);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
throw new Error('cssLen type error');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function toRPX(cssLen) {
|
|
129
|
+
if (typeof cssLen === 'string') {
|
|
130
|
+
const cssLenArr = cssLen.split(' ');
|
|
131
|
+
return cssLenArr
|
|
132
|
+
.map((attr) => {
|
|
133
|
+
const matchResult = attr.match(/^(-?\d+)(px)?$/);
|
|
134
|
+
if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
|
|
135
|
+
return `${+matchResult[1]}rpx`;
|
|
136
|
+
}
|
|
137
|
+
return attr;
|
|
138
|
+
})
|
|
139
|
+
.join(' ');
|
|
140
|
+
}
|
|
141
|
+
return `${cssLen}rpx`;
|
|
142
|
+
}
|
|
143
|
+
// Convert WeApps common style to css styles(React.CSSProperties)
|
|
144
|
+
function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: true, ignoreSelf: false, addPXUnit: false, toRpx: false }) {
|
|
145
|
+
const { size,
|
|
146
|
+
// transform,
|
|
147
|
+
text, border, background, margin, padding, zIndex, position, display, flexConfig, custom, self, } = commonStyle;
|
|
148
|
+
const style = {};
|
|
149
|
+
if (size) {
|
|
150
|
+
setStyleValue(style, 'width', _handleStyleNumValue(size.width, !!options.addPXUnit));
|
|
151
|
+
setStyleValue(style, 'height', _handleStyleNumValue(size.height, !!options.addPXUnit));
|
|
152
|
+
}
|
|
153
|
+
// if (transform) {
|
|
154
|
+
// const { rotate, opacity, scale, radius } = transform
|
|
155
|
+
// if ((rotate && rotate !== 0) || (scale && scale !== 1)) {
|
|
156
|
+
// style.transform = `${rotate ? `rotate(${rotate}deg) ` : ''}${scale ? `scale(${scale})` : ''}`
|
|
157
|
+
// }
|
|
158
|
+
// setStyleValue(style, 'opacity', opacity)
|
|
159
|
+
// setStyleValue(style, 'borderRadius', radius)
|
|
160
|
+
// }
|
|
161
|
+
if (margin) {
|
|
162
|
+
setDistanceStyle(style, margin, 'margin', !!options.addPXUnit);
|
|
163
|
+
}
|
|
164
|
+
if (padding) {
|
|
165
|
+
setDistanceStyle(style, padding, 'padding', !!options.addPXUnit);
|
|
166
|
+
}
|
|
167
|
+
if (display) {
|
|
168
|
+
setStyleValue(style, 'display', display);
|
|
169
|
+
}
|
|
170
|
+
if (display === 'flex' && flexConfig) {
|
|
171
|
+
if (flexConfig.justifyContent)
|
|
172
|
+
setStyleValue(style, 'justifyContent', flexConfig.justifyContent);
|
|
173
|
+
if (flexConfig.alignItems)
|
|
174
|
+
setStyleValue(style, 'alignItems', flexConfig.alignItems);
|
|
175
|
+
if (flexConfig.flexWrap && flexConfig.flexDirection) {
|
|
176
|
+
setStyleValue(style, 'flexFlow', `${flexConfig.flexDirection} ${flexConfig.flexWrap}`);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
if (flexConfig.flexWrap)
|
|
180
|
+
setStyleValue(style, 'flexWrap', flexConfig.flexWrap);
|
|
181
|
+
if (flexConfig.flexDirection)
|
|
182
|
+
setStyleValue(style, 'flexDirection', flexConfig.flexDirection);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (typeof zIndex === 'number' || `${zIndex}`.search(/^\d+$/) === 0) {
|
|
186
|
+
style.zIndex = zIndex;
|
|
187
|
+
}
|
|
188
|
+
if (text) {
|
|
189
|
+
setStyleValue(style, 'color', text.color);
|
|
190
|
+
setStyleValue(style, 'fontSize', _handleStyleNumValue(text.fontSize, !!options.addPXUnit));
|
|
191
|
+
setStyleValue(style, 'lineHeight', text.lineHeight);
|
|
192
|
+
setStyleValue(style, 'textAlign', text.textAlign);
|
|
193
|
+
setStyleValue(style, 'fontWeight', text.weight);
|
|
194
|
+
if (text.opacity !== undefined) {
|
|
195
|
+
setStyleValue(style, 'opacity', text.opacity / 100);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (border) {
|
|
199
|
+
const { type, color, width, radius, radiusInfo } = border;
|
|
200
|
+
if (width !== undefined) {
|
|
201
|
+
if (type && type !== 'none') {
|
|
202
|
+
setStyleValue(style, 'border', `${_handleStyleNumValue(width, !!options.addPXUnit)} ${type} ${color || ''}`);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
setStyleValue(style, 'borderWidth', _handleStyleNumValue(width, !!options.addPXUnit));
|
|
206
|
+
if (color)
|
|
207
|
+
setStyleValue(style, 'borderColor', color);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (radius !== undefined) {
|
|
211
|
+
setStyleValue(style, 'borderRadius', _handleStyleNumValue(radius, !!options.addPXUnit));
|
|
212
|
+
}
|
|
213
|
+
if (radiusInfo && !(0, common_1.isEmptyObj)(radiusInfo)) {
|
|
214
|
+
if (Object.keys(radiusInfo).length === 4) {
|
|
215
|
+
if ((0, lodash_1.uniq)((0, lodash_1.map)(radiusInfo, (val) => val)).length === 1) {
|
|
216
|
+
// 4个值全相等的情况
|
|
217
|
+
setStyleValue(style, 'borderRadius', _handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit));
|
|
218
|
+
}
|
|
219
|
+
else if (radiusInfo.topLeft === radiusInfo.bottomRight && radiusInfo.topRight === radiusInfo.bottomLeft) {
|
|
220
|
+
// 俩俩相等的情况
|
|
221
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)}`);
|
|
222
|
+
}
|
|
223
|
+
else if (radiusInfo.topRight === radiusInfo.bottomLeft) {
|
|
224
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit)}`);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
setStyleValue(style, 'borderRadius', `${_handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit)} ${_handleStyleNumValue(radiusInfo.bottomLeft, !!options.addPXUnit)}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
setStyleValue(style, 'borderTopLeftRadius', _handleStyleNumValue(radiusInfo.topLeft, !!options.addPXUnit));
|
|
232
|
+
setStyleValue(style, 'borderTopRightRadius', _handleStyleNumValue(radiusInfo.topRight, !!options.addPXUnit));
|
|
233
|
+
setStyleValue(style, 'borderBottomRightRadius', _handleStyleNumValue(radiusInfo.bottomRight, !!options.addPXUnit));
|
|
234
|
+
setStyleValue(style, 'borderBottomLeftRadius', _handleStyleNumValue(radiusInfo.bottomLeft, !!options.addPXUnit));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (type === 'none') {
|
|
238
|
+
setStyleValue(style, 'border', `none`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (background) {
|
|
242
|
+
const { bgType, color, image, size, repeat, position, positionObj } = background;
|
|
243
|
+
if (bgType === 'color') {
|
|
244
|
+
setStyleValue(style, 'background', color);
|
|
245
|
+
}
|
|
246
|
+
else if (bgType === 'image') {
|
|
247
|
+
// 如 radial-gradient(crimson, skyblue);
|
|
248
|
+
if (image != null) {
|
|
249
|
+
if (image.search(/[()]/) >= 0) {
|
|
250
|
+
style.background = image;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
style.background = `url(${image})`;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (repeat)
|
|
257
|
+
style.background += ` ${repeat}`;
|
|
258
|
+
if (size) {
|
|
259
|
+
setStyleValue(style, 'backgroundSize', _handleStyleNumValue(size, !!options.addPXUnit));
|
|
260
|
+
}
|
|
261
|
+
setStyleValue(style, 'backgroundPosition', position);
|
|
262
|
+
if (positionObj && !(0, common_1.isEmptyObj)(positionObj)) {
|
|
263
|
+
style.background += ` ${_handleStyleNumValue(positionObj.left, !!options.addPXUnit)} ${_handleStyleNumValue(positionObj.top, !!options.addPXUnit)}`;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// FIXME: 这里兼容原有应用的数据,后面应去掉
|
|
267
|
+
if (bgType === undefined) {
|
|
268
|
+
setStyleValue(style, 'backgroundColor', color);
|
|
269
|
+
if (image != null) {
|
|
270
|
+
style.backgroundImage = `url(${image})`;
|
|
271
|
+
setStyleValue(style, 'backgroundRepeat', repeat);
|
|
272
|
+
setStyleValue(style, 'backgroundSize', _handleStyleNumValue(size, !!options.addPXUnit));
|
|
273
|
+
setStyleValue(style, 'backgroundPosition', position);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (position) {
|
|
278
|
+
setStyleValue(style, 'position', position.position);
|
|
279
|
+
if (position.left !== undefined) {
|
|
280
|
+
setStyleValue(style, 'left', _handleStyleNumValue(position.left, !!options.addPXUnit));
|
|
281
|
+
}
|
|
282
|
+
if (position.right !== undefined) {
|
|
283
|
+
setStyleValue(style, 'right', _handleStyleNumValue(position.right, !!options.addPXUnit));
|
|
284
|
+
}
|
|
285
|
+
if (position.top !== undefined) {
|
|
286
|
+
setStyleValue(style, 'top', _handleStyleNumValue(position.top, !!options.addPXUnit));
|
|
287
|
+
}
|
|
288
|
+
if (position.bottom !== undefined) {
|
|
289
|
+
setStyleValue(style, 'bottom', _handleStyleNumValue(position.bottom, !!options.addPXUnit));
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (custom && custom.length > 0) {
|
|
293
|
+
custom.map((item) => {
|
|
294
|
+
setStyleValue(style, item.key, item.value);
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
if (self && !options.ignoreSelf) {
|
|
298
|
+
const _a = self, { cssFloat } = _a, restSelf = __rest(_a, ["cssFloat"]);
|
|
299
|
+
Object.assign(style, restSelf, { float: cssFloat });
|
|
300
|
+
}
|
|
301
|
+
if (options.toRpx) {
|
|
302
|
+
return translateStyleToRpx(style);
|
|
303
|
+
}
|
|
304
|
+
return options.toRem ? processCSSProperties2Rem(style) : style;
|
|
305
|
+
}
|
|
306
|
+
exports.processCommonStyle2CSSProperties = processCommonStyle2CSSProperties;
|
|
307
|
+
function translateStyleToRpx(style = {}, options = { looseError: false }) {
|
|
308
|
+
return translateStyleByHandler(style, toRPX, options);
|
|
309
|
+
}
|
|
310
|
+
function processCSSProperties2Rem(style = {}, options = { looseError: false }) {
|
|
311
|
+
return translateStyleByHandler(style, toREM, options);
|
|
312
|
+
}
|
|
313
|
+
exports.processCSSProperties2Rem = processCSSProperties2Rem;
|
package/lib/parser/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * from './cals/index';
|
|
2
2
|
export { upgrageToVersion2 } from './cals/utils/version';
|
|
3
3
|
export { processComponentModule } from './cals/utils/spinoff';
|
|
4
|
-
export { calsToCode, codeToCals, ICodeItem, checkForConflicts, autoResolveConflicts
|
|
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
8
|
//# 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,
|
|
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"}
|
package/lib/parser/index.js
CHANGED
|
@@ -14,7 +14,7 @@ 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
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PropBindType = exports.ActionType = exports.parseComponentCals = exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = exports.processComponentModule = exports.upgrageToVersion2 = void 0;
|
|
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;
|
|
18
18
|
__exportStar(require("./cals/index"), exports);
|
|
19
19
|
var version_1 = require("./cals/utils/version");
|
|
20
20
|
Object.defineProperty(exports, "upgrageToVersion2", { enumerable: true, get: function () { return version_1.upgrageToVersion2; } });
|
|
@@ -30,3 +30,6 @@ Object.defineProperty(exports, "parseComponentCals", { enumerable: true, get: fu
|
|
|
30
30
|
var index_1 = require("./expression/index");
|
|
31
31
|
Object.defineProperty(exports, "ActionType", { enumerable: true, get: function () { return index_1.ActionType; } });
|
|
32
32
|
Object.defineProperty(exports, "PropBindType", { enumerable: true, get: function () { return index_1.PropBindType; } });
|
|
33
|
+
var style_1 = require("./cals/utils/style");
|
|
34
|
+
Object.defineProperty(exports, "processCommonStyle2CSSProperties", { enumerable: true, get: function () { return style_1.processCommonStyle2CSSProperties; } });
|
|
35
|
+
Object.defineProperty(exports, "processCSSProperties2Rem", { enumerable: true, get: function () { return style_1.processCSSProperties2Rem; } });
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 来源:packages/react-dom/src/shared/CSSProperty.js
|
|
9
|
+
* react-dom 内部实现用于判断是否补齐 number 类型数据的 px 单位
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* CSS properties which accept numbers but are not in units of "px".
|
|
13
|
+
*/
|
|
14
|
+
export declare const isUnitlessNumber: {
|
|
15
|
+
animationIterationCount: boolean;
|
|
16
|
+
aspectRatio: boolean;
|
|
17
|
+
borderImage: boolean;
|
|
18
|
+
borderImageOutset: boolean;
|
|
19
|
+
borderImageSlice: boolean;
|
|
20
|
+
borderImageWidth: boolean;
|
|
21
|
+
boxFlex: boolean;
|
|
22
|
+
boxFlexGroup: boolean;
|
|
23
|
+
boxOrdinalGroup: boolean;
|
|
24
|
+
columnCount: boolean;
|
|
25
|
+
columns: boolean;
|
|
26
|
+
flex: boolean;
|
|
27
|
+
flexGrow: boolean;
|
|
28
|
+
flexPositive: boolean;
|
|
29
|
+
flexShrink: boolean;
|
|
30
|
+
flexNegative: boolean;
|
|
31
|
+
flexOrder: boolean;
|
|
32
|
+
gridArea: boolean;
|
|
33
|
+
gridRow: boolean;
|
|
34
|
+
gridRowEnd: boolean;
|
|
35
|
+
gridRowSpan: boolean;
|
|
36
|
+
gridRowStart: boolean;
|
|
37
|
+
gridColumn: boolean;
|
|
38
|
+
gridColumnEnd: boolean;
|
|
39
|
+
gridColumnSpan: boolean;
|
|
40
|
+
gridColumnStart: boolean;
|
|
41
|
+
fontWeight: boolean;
|
|
42
|
+
lineClamp: boolean;
|
|
43
|
+
lineHeight: boolean;
|
|
44
|
+
opacity: boolean;
|
|
45
|
+
order: boolean;
|
|
46
|
+
orphans: boolean;
|
|
47
|
+
tabSize: boolean;
|
|
48
|
+
widows: boolean;
|
|
49
|
+
zIndex: boolean;
|
|
50
|
+
zoom: boolean;
|
|
51
|
+
fillOpacity: boolean;
|
|
52
|
+
floodOpacity: boolean;
|
|
53
|
+
stopOpacity: boolean;
|
|
54
|
+
strokeDasharray: boolean;
|
|
55
|
+
strokeDashoffset: boolean;
|
|
56
|
+
strokeMiterlimit: boolean;
|
|
57
|
+
strokeOpacity: boolean;
|
|
58
|
+
strokeWidth: boolean;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=CSSProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CSSProperty.d.ts","sourceRoot":"","sources":["../../src/utils/CSSProperty.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AAEH;;GAEG;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C5B,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.isUnitlessNumber = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* 来源:packages/react-dom/src/shared/CSSProperty.js
|
|
12
|
+
* react-dom 内部实现用于判断是否补齐 number 类型数据的 px 单位
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* CSS properties which accept numbers but are not in units of "px".
|
|
16
|
+
*/
|
|
17
|
+
exports.isUnitlessNumber = {
|
|
18
|
+
animationIterationCount: true,
|
|
19
|
+
aspectRatio: true,
|
|
20
|
+
borderImage: true,
|
|
21
|
+
borderImageOutset: true,
|
|
22
|
+
borderImageSlice: true,
|
|
23
|
+
borderImageWidth: true,
|
|
24
|
+
boxFlex: true,
|
|
25
|
+
boxFlexGroup: true,
|
|
26
|
+
boxOrdinalGroup: true,
|
|
27
|
+
columnCount: true,
|
|
28
|
+
columns: true,
|
|
29
|
+
flex: true,
|
|
30
|
+
flexGrow: true,
|
|
31
|
+
flexPositive: true,
|
|
32
|
+
flexShrink: true,
|
|
33
|
+
flexNegative: true,
|
|
34
|
+
flexOrder: true,
|
|
35
|
+
gridArea: true,
|
|
36
|
+
gridRow: true,
|
|
37
|
+
gridRowEnd: true,
|
|
38
|
+
gridRowSpan: true,
|
|
39
|
+
gridRowStart: true,
|
|
40
|
+
gridColumn: true,
|
|
41
|
+
gridColumnEnd: true,
|
|
42
|
+
gridColumnSpan: true,
|
|
43
|
+
gridColumnStart: true,
|
|
44
|
+
fontWeight: true,
|
|
45
|
+
lineClamp: true,
|
|
46
|
+
lineHeight: true,
|
|
47
|
+
opacity: true,
|
|
48
|
+
order: true,
|
|
49
|
+
orphans: true,
|
|
50
|
+
tabSize: true,
|
|
51
|
+
widows: true,
|
|
52
|
+
zIndex: true,
|
|
53
|
+
zoom: true,
|
|
54
|
+
// SVG-related properties
|
|
55
|
+
fillOpacity: true,
|
|
56
|
+
floodOpacity: true,
|
|
57
|
+
stopOpacity: true,
|
|
58
|
+
strokeDasharray: true,
|
|
59
|
+
strokeDashoffset: true,
|
|
60
|
+
strokeMiterlimit: true,
|
|
61
|
+
strokeOpacity: true,
|
|
62
|
+
strokeWidth: true,
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* @param {string} prefix vendor-specific prefix, eg: Webkit
|
|
66
|
+
* @param {string} key style name, eg: transitionDuration
|
|
67
|
+
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
|
|
68
|
+
* WebkitTransitionDuration
|
|
69
|
+
*/
|
|
70
|
+
function prefixKey(prefix, key) {
|
|
71
|
+
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Support style names that may come passed in prefixed by adding permutations
|
|
75
|
+
* of vendor prefixes.
|
|
76
|
+
*/
|
|
77
|
+
const prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
|
78
|
+
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
|
|
79
|
+
// infinite loop, because it iterates over the newly added props too.
|
|
80
|
+
Object.keys(exports.isUnitlessNumber).forEach(function (prop) {
|
|
81
|
+
prefixes.forEach(function (prefix) {
|
|
82
|
+
exports.isUnitlessNumber[prefixKey(prefix, prop)] = exports.isUnitlessNumber[prop];
|
|
83
|
+
});
|
|
84
|
+
});
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -14,6 +14,9 @@ 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
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.isUnitlessNumber = void 0;
|
|
17
18
|
__exportStar(require("../parser"), exports);
|
|
18
19
|
__exportStar(require("../types/index"), exports);
|
|
19
20
|
__exportStar(require("./constant"), exports);
|
|
21
|
+
var CSSProperty_1 = require("./CSSProperty");
|
|
22
|
+
Object.defineProperty(exports, "isUnitlessNumber", { enumerable: true, get: function () { return CSSProperty_1.isUnitlessNumber; } });
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cals",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Common application specifications",
|
|
5
5
|
"main": "lib/utils/index.js",
|
|
6
|
+
"source": "src/utils/index.ts",
|
|
6
7
|
"typedocMain": "src/types/index.ts",
|
|
7
8
|
"files": [
|
|
8
9
|
"lib"
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
"@types/jest": "^27.4.0",
|
|
31
32
|
"@types/lodash": "^4.14.168",
|
|
32
33
|
"@types/node": "^14.14.6",
|
|
34
|
+
"@types/react": "^18.0.17",
|
|
33
35
|
"ajv": "^8.8.2",
|
|
34
36
|
"csstype": "^3.0.11",
|
|
35
37
|
"jest": "^27.1.0",
|