@cloudbase/cals 0.5.4-alpha.0 → 0.5.4-beta.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.
package/lib/utils/dts/index.d.ts
CHANGED
|
@@ -41,14 +41,14 @@ export declare class WeDaDTS {
|
|
|
41
41
|
/**
|
|
42
42
|
* 全部更新
|
|
43
43
|
*/
|
|
44
|
-
static updateDTS(inputData?: IInputData, options?: Pick<IOptions,
|
|
44
|
+
static updateDTS(inputData?: IInputData, options?: Pick<IOptions, 'isCompMode'>): Promise<void>;
|
|
45
45
|
/**
|
|
46
46
|
* 部分更新 - 只更新一种类型
|
|
47
47
|
*/
|
|
48
48
|
static updateDTSPartial(inputData: IJsonSchemaObject | IDTSCodeItem[] | string[], itemType: IInputDataType, options?: {
|
|
49
49
|
setEmptyIfError: boolean;
|
|
50
50
|
}): Promise<void>;
|
|
51
|
-
static getDTS(options?: Omit<IOptions,
|
|
51
|
+
static getDTS(options?: Omit<IOptions, 'isCompMode'>): string;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* 生成 WeDa 应用的低码代码提示的 dts 类型声明内容
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKhD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IAEvB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,oBAAY,cAAc;IACxB,WAAW,gBAAgB;IA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,MAAM,CAAC,MAAM,CAAC,OAAO,GAAE,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAsD;CAUzG;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,GAAE,UAAe,EAC1B,OAAO,GAAE,QAAgF,GACxF,OAAO,CAAC,MAAM,CAAC,CAqCjB;AA8ED,eAAO,MAAM,UAAU,onBAmBtB,CAAC;AA4CF;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5D"}
|
package/lib/utils/dts/index.js
CHANGED
|
@@ -62,16 +62,16 @@ const DtsPlaceholder = {
|
|
|
62
62
|
[IInputDataType.compPropEvents]: "// Comp Prop Events 组件事件 - Don't touch me",
|
|
63
63
|
};
|
|
64
64
|
const DtsInnerSign = {
|
|
65
|
-
[IInputDataType.globalState]:
|
|
66
|
-
[IInputDataType.pageState]:
|
|
67
|
-
[IInputDataType.compState]:
|
|
68
|
-
[IInputDataType.pageParams]:
|
|
69
|
-
[IInputDataType.forState]:
|
|
70
|
-
[IInputDataType.globalCommonCodes]:
|
|
71
|
-
[IInputDataType.pageHandlerCodes]:
|
|
72
|
-
[IInputDataType.compHandlerCodes]:
|
|
73
|
-
[IInputDataType.compPropData]:
|
|
74
|
-
[IInputDataType.compPropEvents]:
|
|
65
|
+
[IInputDataType.globalState]: 'Global State Inner',
|
|
66
|
+
[IInputDataType.pageState]: 'Page State Inner',
|
|
67
|
+
[IInputDataType.compState]: 'Comp State Inner',
|
|
68
|
+
[IInputDataType.pageParams]: 'Page Param Inner',
|
|
69
|
+
[IInputDataType.forState]: 'Global For Inner',
|
|
70
|
+
[IInputDataType.globalCommonCodes]: 'Global Common Inner',
|
|
71
|
+
[IInputDataType.pageHandlerCodes]: 'Page Handler Inner',
|
|
72
|
+
[IInputDataType.compHandlerCodes]: 'Comp Handler Inner',
|
|
73
|
+
[IInputDataType.compPropData]: 'Comp Prop Data Inner',
|
|
74
|
+
[IInputDataType.compPropEvents]: 'Comp Prop Events Inner',
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
77
77
|
* 通过该类可以共享同个dts。
|
|
@@ -204,10 +204,12 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
204
204
|
},
|
|
205
205
|
[IInputDataType.compPropEvents]: function (inputData) {
|
|
206
206
|
const IData = `any`;
|
|
207
|
-
return inputData
|
|
207
|
+
return inputData
|
|
208
|
+
.map((eventName) => {
|
|
208
209
|
return `function ${eventName}(data?: ${IData}): void`;
|
|
209
|
-
})
|
|
210
|
-
|
|
210
|
+
})
|
|
211
|
+
.join('\n');
|
|
212
|
+
},
|
|
211
213
|
};
|
|
212
214
|
function _compile(jsonschema) {
|
|
213
215
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -260,15 +262,13 @@ function TypescriptWorker() {
|
|
|
260
262
|
typescriptWorker.onmessage = function (event) {
|
|
261
263
|
const { action } = event.data;
|
|
262
264
|
if (action === 'dts_back') {
|
|
263
|
-
const { data: { id, dts } } = event.data;
|
|
265
|
+
const { data: { id, dts }, } = event.data;
|
|
264
266
|
sendMessageCallbackFn[id] && sendMessageCallbackFn[id](dts);
|
|
265
267
|
}
|
|
266
268
|
};
|
|
267
269
|
}
|
|
268
270
|
function sendMessage(msgData, callbackFn) {
|
|
269
|
-
const id = Math.random()
|
|
270
|
-
.toString(36)
|
|
271
|
-
.substring(2, 5);
|
|
271
|
+
const id = Math.random().toString(36).substring(2, 5);
|
|
272
272
|
msgData.data.id = id;
|
|
273
273
|
sendMessageCallbackFn[id] = callbackFn;
|
|
274
274
|
typescriptWorker.postMessage(msgData);
|
|
@@ -277,22 +277,22 @@ function TypescriptWorker() {
|
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
|
-
* 使用:
|
|
281
|
-
* const typescriptWorker = getTypescriptWorker();
|
|
282
|
-
* typescriptWorker.sendMessage({ action: 'dts', data: { code } }, dts => {
|
|
283
|
-
*
|
|
284
|
-
* })
|
|
285
|
-
* // 以下暂未实现
|
|
286
|
-
* typescriptWorker.sendMessage({ action: 'ts', data: { code } }, ts => {
|
|
287
|
-
*
|
|
288
|
-
* })
|
|
289
|
-
*/
|
|
280
|
+
* 使用:
|
|
281
|
+
* const typescriptWorker = getTypescriptWorker();
|
|
282
|
+
* typescriptWorker.sendMessage({ action: 'dts', data: { code } }, dts => {
|
|
283
|
+
*
|
|
284
|
+
* })
|
|
285
|
+
* // 以下暂未实现
|
|
286
|
+
* typescriptWorker.sendMessage({ action: 'ts', data: { code } }, ts => {
|
|
287
|
+
*
|
|
288
|
+
* })
|
|
289
|
+
*/
|
|
290
290
|
const getTypescriptWorker = TypescriptWorker();
|
|
291
291
|
/**
|
|
292
292
|
* 通过 js/ts 代码生成 dts
|
|
293
293
|
*/
|
|
294
294
|
function transpileToDTS(code) {
|
|
295
|
-
return new Promise(resolve => {
|
|
295
|
+
return new Promise((resolve) => {
|
|
296
296
|
const typescriptWorker = getTypescriptWorker();
|
|
297
297
|
typescriptWorker.sendMessage({ action: 'dts', data: { code } }, (dts) => {
|
|
298
298
|
resolve(dts);
|
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;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -18,6 +18,6 @@ exports.isUnitlessNumber = void 0;
|
|
|
18
18
|
__exportStar(require("../parser"), exports);
|
|
19
19
|
__exportStar(require("../types/index"), exports);
|
|
20
20
|
__exportStar(require("./constant"), exports);
|
|
21
|
-
|
|
21
|
+
// export * from './dts/index';
|
|
22
22
|
var CSSProperty_1 = require("./CSSProperty");
|
|
23
23
|
Object.defineProperty(exports, "isUnitlessNumber", { enumerable: true, get: function () { return CSSProperty_1.isUnitlessNumber; } });
|