From 9fa00247d18b8d29428e8227e81b200abd216b3b Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Tue, 23 Nov 2021 20:48:52 +0800 Subject: [PATCH 01/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- LICENSE | 17 ++- ace-loader/.npmignore | 15 +++ ace-loader/plugin/codegen/index.js | 109 +++++++++++++----- .../plugin/templater/component_validator.js | 3 +- ace-loader/sample/DataAbility/data.js | 15 +++ ace-loader/sample/ServiceAbility/service.js | 15 +++ ace-loader/sample/lite/app.js | 15 +++ ace-loader/sample/lite/pages/detail/detail.js | 15 +++ ace-loader/sample/lite/pages/index/index.js | 15 +++ ace-loader/sample/rich/app.js | 15 +++ ace-loader/sample/rich/pages/detail/detail.js | 15 +++ ace-loader/sample/rich/pages/index/index.js | 15 +++ .../src/lite/lite-return-exports-plugin.js | 16 +++ ace-loader/src/lite/lite-transform-style.js | 2 +- ace-loader/src/loader-gen.js | 30 ++++- .../testError/common/component/comp/comp.js | 15 +++ .../testcase/pages/importLess/importLess.less | 15 +++ .../test/card/testcase/pages/withJS/withJS.js | 15 +++ ace-loader/test/lite/expected/attribute.js | 15 +++ ace-loader/test/lite/expected/bubble.js | 15 +++ ace-loader/test/lite/expected/class.js | 15 +++ ace-loader/test/lite/expected/event.js | 15 +++ ace-loader/test/lite/expected/expression.js | 15 +++ .../test/lite/expected/exteriorStyle.js | 15 +++ ace-loader/test/lite/expected/forDirective.js | 15 +++ ace-loader/test/lite/expected/ifDirective.js | 15 +++ ace-loader/test/lite/expected/importJS.js | 15 +++ ace-loader/test/lite/expected/inlineStyle.js | 15 +++ ace-loader/test/lite/expected/music.js | 15 +++ ace-loader/test/lite/expected/sick.js | 15 +++ ace-loader/test/lite/testcase/app.js | 15 +++ .../lite/testcase/pages/importJS/importJS.js | 15 +++ .../test/lite/testcase/pages/music/music.js | 15 +++ .../test/lite/testcase/pages/sick/sick.js | 15 +++ ace-loader/test/rich/expected/class.js | 15 +++ ace-loader/test/rich/expected/commonAttr.js | 15 +++ ace-loader/test/rich/expected/event.js | 15 +++ ace-loader/test/rich/expected/expression.js | 15 +++ .../test/rich/expected/exteriorStyle.js | 15 +++ ace-loader/test/rich/expected/forDirective.js | 15 +++ ace-loader/test/rich/expected/ifDirective.js | 15 +++ ace-loader/test/rich/expected/importCSS.js | 15 +++ ace-loader/test/rich/expected/importJS.js | 15 +++ ace-loader/test/rich/expected/inlineStyle.js | 17 ++- ace-loader/test/rich/expected/mediaQuery.js | 15 +++ ace-loader/test/rich/expected/privateAttr.js | 15 +++ ace-loader/test/rich/expected/uncommonAttr.js | 15 +++ ace-loader/test/rich/testcase/app.js | 15 +++ .../test/rich/testcase/pages/class/class.js | 14 +++ .../testcase/pages/commonAttr/commonAttr.js | 15 +++ .../test/rich/testcase/pages/event/event.js | 15 +++ .../testcase/pages/expression/expression.js | 15 +++ .../pages/exteriorStyle/exteriorStyle.js | 15 +++ .../pages/forDirective/forDirective.js | 15 +++ .../testcase/pages/importCSS/importCSS.js | 15 +++ .../rich/testcase/pages/importJS/importJS.js | 15 +++ .../testcase/pages/inlineStyle/inlineStyle.js | 15 +++ .../testcase/pages/mediaQuery/mediaQuery.js | 15 +++ .../testcase/pages/privateAttr/privateAttr.js | 15 +++ .../pages/uncommonAttr/uncommonAttr.js | 15 +++ ace-loader/webpack.lite.config.js | 3 +- ace-loader/webpack.rich.config.js | 11 +- 62 files changed, 960 insertions(+), 42 deletions(-) diff --git a/LICENSE b/LICENSE index 4947287..9d2381c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ Apache License Version 2.0, January 2004 @@ -174,4 +188,5 @@ incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - END OF TERMS AND CONDITIONS \ No newline at end of file + END OF TERMS AND CONDITIONS + diff --git a/ace-loader/.npmignore b/ace-loader/.npmignore index 246c4aa..bb2d427 100644 --- a/ace-loader/.npmignore +++ b/ace-loader/.npmignore @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + node_modules src test diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 3e25489..23c57da 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ @@ -53,6 +68,7 @@ exports.Cache = void 0; // This Cache is used to store output code temporarily class Cache { /** + * * @description: constructor for Cache * @param INDENT the IDENT string you want to use, such as 4 spaces */ @@ -63,6 +79,7 @@ class Cache { this.INDENT = INDENT; } /** + * * @description: when flag is true, there should be some indents * @return void */ @@ -70,6 +87,7 @@ class Cache { this.flag = true; } /** + * * @description: when flag is false, there should be no indents * @return void */ @@ -77,6 +95,7 @@ class Cache { this.flag = false; } /** + * * @description: increase indent * @return void */ @@ -84,6 +103,7 @@ class Cache { this.indent++; } /** + * * @description: decrease indent * @return void */ @@ -91,6 +111,7 @@ class Cache { this.indent--; } /** + * * @description: check whether indent is LT 0 * @return boolean value representing whether indent is LT 0 */ @@ -98,6 +119,7 @@ class Cache { return this.indent < 0; } /** + * * @description: get indent * @return indents */ @@ -114,6 +136,7 @@ class Cache { } } /** + * * @description: concat indents and HML/CSS code * @param strings means HML/CSS code * @return HML/CSS code after indents are set @@ -124,6 +147,7 @@ class Cache { return String(this.value); } /** + * * @description: concat indents and HML/CSS code * @return HML/CSS code */ @@ -148,6 +172,7 @@ exports.Style = exports.Tag = void 0; const ASTNode_1 = __webpack_require__(117); class Tag extends ASTNode_1.ASTNode { /** + * * @description: constructor for Tag * @param tagName is name of component * @param attributes is attributes of component @@ -163,6 +188,7 @@ class Tag extends ASTNode_1.ASTNode { exports.Tag = Tag; class Style extends ASTNode_1.ASTNode { /** + * * @description: constructor for Style * @param kind distinguishes id and class * @param name is name of id or class @@ -184,9 +210,7 @@ exports.Style = Style; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* -* @Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved. -*/ + Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ASTNodeGenerator = void 0; const AST_1 = __webpack_require__(243); @@ -306,9 +330,7 @@ ASTNodeGenerator.instance = undefined; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* -* @Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved. -*/ + Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CSSBridge = exports.HMLBridge = void 0; const AST_1 = __webpack_require__(243); @@ -318,6 +340,7 @@ class HMLBridge { this.errors = 0; } /** + * * @description: generate error message * @param msg is error message to show up in console */ @@ -326,6 +349,7 @@ class HMLBridge { this.errors += 1; } /** + * * @description: get error number * @return error number */ @@ -333,6 +357,7 @@ class HMLBridge { return this.errors; } /** + * * @description: visitor guidance method for contents, * sort out incoming type and guide to matching code generator * @param visualModel is a object with Model or Container or CharUI primitive types to be generated @@ -368,6 +393,7 @@ class CSSBridge { this.styles = []; } /** + * * @description: generate error message * @param msg is error message to show up in console */ @@ -376,6 +402,7 @@ class CSSBridge { this.errors += 1; } /** + * * @description: get error number * @return error number */ @@ -383,6 +410,7 @@ class CSSBridge { return this.errors; } /** + * * @description: code generator for ID Style, which is CSS type in AST in IR * @param visualModel is a object with CSS type to be generated * @return a code tree representing Harmony FA CSS code @@ -402,6 +430,7 @@ class CSSBridge { } } /** + * * @description: visitor guidance method for contents, * sort out incoming type and guide to matching code generator * @param obj is a object with Model or Container or CharUI primitive types to be generated @@ -429,6 +458,7 @@ exports.genFACSS = exports.genFAHML = void 0; const ASTNodeVisitor_1 = __webpack_require__(573); const Cache_1 = __webpack_require__(862); /** +* * @description: generate HML * @param t is Tag in AST * @return HML code @@ -440,6 +470,7 @@ function genFAHML(t) { } exports.genFAHML = genFAHML; /** +* * @description: generate CSS * @param t is Style in AST * @return CSS code @@ -459,19 +490,18 @@ exports.genFACSS = genFACSS; /***/ 571: /***/ ((__unused_webpack_module, exports) => { - -/* -* @Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. -*/ Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isEvent = exports.isData = exports.isUnknown = exports.isContent = exports.isAttribute = exports.isStyle = exports.styleSet = void 0; +exports.isEvent = exports.isData = exports.isUnknown = exports.isContent = + exports.isAttribute = exports.isStyle = exports.styleSet = void 0; // Unlike the property list in ComponentList, this one is only used to tell a property is a style or an attribute const SizeStyle = ["width", "height", "min-width", "min-height", "max-width", "max-height"]; const FlexStyle = ["flex", "flex-grow", "flex-shrink", "flex-basis"]; -const BackgroundImageStyle = ["background", "background-image", "background-size", "background-position", "background-repeat"]; +const BackgroundImageStyle = ["background", "background-image", "background-size", + "background-position", "background-repeat"]; const BackgroundStyle = ["background-color", ...BackgroundImageStyle]; const PositionStyle = ["position", "display", "top", "right", "bottom", "left"]; -const PaddingStyle = ["padding", "padding-start", "padding-end", "padding-top", "padding-right", "padding-bottom", "padding-left"]; +const PaddingStyle = ["padding", "padding-start", "padding-end", "padding-top", + "padding-right", "padding-bottom", "padding-left"]; const MarginStyle = ["margin", "margin-start", "margin-end", "margin-top", "margin-right", "margin-bottom", "margin-left"]; const BorderStyle = ["border-width", "border-style", "border-color", "border-radius", "border-top-width", "border-top-style", "border-top-color", "border-top-left-radius", "border-right-width", @@ -496,11 +526,12 @@ const buttonStyle = ["text-color", "allow-scale", "icon-width", "icon-height", " const switchStyle = ["texton-color", "textoff-color", "text-padding", "allow-scale", ...FontStyle]; const inputStyle = ["font-size", "font-family", "font-weight", "color", "placeholder-color", "allow-scale"]; const refreshStyle = ["progress-color"]; -const chartStyle = ["stroke-width", "radius", "start-angle", "total-angle", "center-x", "center-y", "colors", "weights"]; -const swiperStyle = ["indicator-color", "indicator-selected-color", "indicator-size", "indicator-top", "indicator-right", - "indicator-bottom", "indicator-left"]; -const pickerStyle = ["column-height", "text-color", "allow-scale", "letter-spacing", "text-decoration", "line-height", "opacity", - ...FontStyle]; +const chartStyle = ["stroke-width", "radius", "start-angle", "total-angle", "center-x", + "center-y", "colors", "weights"]; +const swiperStyle = ["indicator-color", "indicator-selected-color", "indicator-size", "indicator-top", + "indicator-right", "indicator-bottom", "indicator-left"]; +const pickerStyle = ["column-height", "text-color", "allow-scale", "letter-spacing", "text-decoration", + "line-height", "opacity", ...FontStyle]; const sliderStyle = ["color", "selected-color", "block-color"]; const listStyle = ["flex-direction", "columns", "item-extent", "fade-color"]; const listItemStyle = ["column-span"]; @@ -534,8 +565,10 @@ const inputAttribute = ["type", "checked", "name", "value", "placeholder", "maxl const refreshAttribute = ["offset", "refreshing", "type", "lasttime", "friction"]; const optionAttribute = ["value"]; const chartAttribute = ["percent", "datasets", "options"]; -const swiperAttribute = ["index", "autoplay", "interval", "indicator", "digital", "indicatordisabled", "loop", "duration", "vertical"]; -const pickerAttribute = ["range", "selected", "start", "end", "lunar", "lunarSwitch", "columns", "hours", "containSecond"]; +const swiperAttribute = ["index", "autoplay", "interval", "indicator", "digital", "indicatordisabled", + "loop", "duration", "vertical"]; +const pickerAttribute = ["range", "selected", "start", "end", "lunar", "lunarSwitch", "columns", + "hours", "containSecond"]; const sliderAttribute = ["min", "max", "step", "showtips", "showsteps", "mode"]; const menuAttribute = ["target", "title"]; const clockAttribute = ["clockconfig", "showdigit", "hourswest"]; @@ -756,6 +789,7 @@ exports.formManager = { } }, /** + * * update all the data * @param data */ @@ -779,6 +813,7 @@ exports.formManager = { this.getFormModel().actions.set(actionName, new FormModel_1.FormAction(actionType, paramMap, abilityName)); }, /** + * * update all the actions * @param map: the new actions to be updated */ @@ -806,7 +841,8 @@ exports.formManager = { */ addActionParams(actionName, params) { var _a, _b; - const action = (_a = this.getFormModel().actions.get(actionName)) !== null && _a !== void 0 ? _a : new FormModel_1.FormAction(actionName); + const action = (_a = this.getFormModel().actions.get(actionName)) !== null && _a !== + void 0 ? _a : new FormModel_1.FormAction(actionName); const actionParams = (_b = action.params) !== null && _b !== void 0 ? _b : new Map(); Object.keys(params).forEach(key => { actionParams.set(key, params[key]); @@ -822,15 +858,18 @@ exports.formManager = { removeActionParam(actionName, paramKey) { var _a; const action = this.getFormModel().actions.get(actionName); - (_a = action === null || action === void 0 ? void 0 : action.params) === null || _a === void 0 ? void 0 : _a.delete(paramKey); + (_a = action === null || action === void 0 ? void 0 : action.params) === null || _a + === void 0 ? void 0 : _a.delete(paramKey); }, /** + * * get the whole node */ getFormModel() { return Instance_1.getInstance().formData; }, /** + * * codegen formModel to json */ codegenToJson: function () { @@ -846,6 +885,7 @@ exports.formManager = { return JSON.stringify(retObj, null, 4); }, /** + * * clear all datas and actions in model */ clear() { @@ -864,6 +904,7 @@ exports.formManager = { return Array.from(sourceMap.entries()).reduce((main, [key, value]) => (Object.assign(Object.assign({}, main), { [key]: value })), {}); }, /** + * * convert an object to map */ objectToMap(sourceObj) { @@ -934,6 +975,7 @@ exports.isBindingEvent = isBindingEvent; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.addPhysicalModel = exports.getPhysicalModel = exports.setInstance = exports.getInstance = void 0; /** +* * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ const PhysicalModel_1 = __webpack_require__(234); @@ -946,6 +988,7 @@ const instance = { formData: new FormModel_1.FormModel(), }; /** +* * instance is unique during the entire web page lifecycle */ function getInstance() { @@ -953,6 +996,7 @@ function getInstance() { } exports.getInstance = getInstance; /** +* * replace instance * @param ins */ @@ -965,18 +1009,20 @@ function setInstance(ins) { } exports.setInstance = setInstance; /** +* * get a physical model by its serviceId and characteristicName * @param path */ function getPhysicalModel(path) { const service = getInstance().harmonyConnectDevice.services.find(e => e.serviceId === path.serviceId); if (service === undefined) { - return undefined; + return undefined; } return service.characteristics.find(e => e.name === path.characteristicName); } exports.getPhysicalModel = getPhysicalModel; /** +* * add a service, would overide if serviceId and characteristicName is same * @param service */ @@ -1000,17 +1046,20 @@ exports.addPhysicalModel = addPhysicalModel; /***/ }), /***/ 977: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unused_webpack_module, exports, + __webpack_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.deserialize = exports.serialize = void 0; /** +* * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ const VisualModel_1 = __webpack_require__(933); const Instance_1 = __webpack_require__(891); /** +* * @description: convert JsonModel to Json * @return model in json format */ @@ -1028,6 +1077,7 @@ function deserialize(json) { } exports.deserialize = deserialize; /** +* * json replacer, turn any class into string * @param key * @param value @@ -1063,6 +1113,7 @@ function replacer(key, value) { } } /** +* * json reviver, true magic, replace plain json to classes * @param key * @param value @@ -1091,9 +1142,7 @@ function reviver(key, value) { /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* -* @Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. -*/ + Object.defineProperty(exports, "__esModule", ({ value: true })); exports.VisualModel = void 0; const CombinedModel_1 = __webpack_require__(964); @@ -1119,7 +1168,8 @@ class VisualModel { this.combinedInfo = { id: "", type: "", - selfType: obj.combinedSelfType === undefined ? CombinedModel_1.CombinedSelfType.None : obj.combinedSelfType, + selfType: obj.combinedSelfType === undefined ? + CombinedModel_1.CombinedSelfType.None : obj.combinedSelfType, data: obj.data, event: obj.event, }; @@ -1167,6 +1217,7 @@ var __webpack_exports__ = {}; var exports = __webpack_exports__; /** +* * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ Object.defineProperty(exports, "__esModule", ({ value: true })); @@ -1178,6 +1229,7 @@ const HmlCssCodeGenerator_1 = __webpack_require__(55); const FormManager_1 = __webpack_require__(207); const visualVersion = 12; /** +* * @description: codegen hml and css according to code in visual file * @param source is code in visual file * @return object of hmlCSS, errorType and errorMessage @@ -1232,6 +1284,7 @@ function genHmlAndCss(source) { return retObj; } /** +* * @description: output hml and css source code of the model */ function emitFA(rootModel) { diff --git a/ace-loader/plugin/templater/component_validator.js b/ace-loader/plugin/templater/component_validator.js index 92928c0..3612ed0 100644 --- a/ace-loader/plugin/templater/component_validator.js +++ b/ace-loader/plugin/templater/component_validator.js @@ -1073,7 +1073,8 @@ function validateEvent(eventName, val, out, pos, relativePath) { let paramList = content[2] if (paramList) { paramList = transContent.parseExpression(paramList, true) - val = eval('(function (evt) {' + bind('{{' + functionName + '(' + paramList + ',evt)}}', false, true, out, pos) + '})') + val = eval('(function (evt) {' + bind('{{' + functionName + '(' + paramList + ',evt)}}', + false, true, out, pos) + '})') } } } diff --git a/ace-loader/sample/DataAbility/data.js b/ace-loader/sample/DataAbility/data.js index 439e396..eea1151 100644 --- a/ace-loader/sample/DataAbility/data.js +++ b/ace-loader/sample/DataAbility/data.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { onInitialize(abilityInfo) { console.info('DataAbility onInitialize'); diff --git a/ace-loader/sample/ServiceAbility/service.js b/ace-loader/sample/ServiceAbility/service.js index 60cb1c3..073ca2d 100644 --- a/ace-loader/sample/ServiceAbility/service.js +++ b/ace-loader/sample/ServiceAbility/service.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { onStart(want) { console.info('ServiceAbility onStart'); diff --git a/ace-loader/sample/lite/app.js b/ace-loader/sample/lite/app.js index bb1f752..d055418 100644 --- a/ace-loader/sample/lite/app.js +++ b/ace-loader/sample/lite/app.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { onCreate() { console.info("AceApplication onCreate"); diff --git a/ace-loader/sample/lite/pages/detail/detail.js b/ace-loader/sample/lite/pages/detail/detail.js index d352de5..2b6cd2b 100644 --- a/ace-loader/sample/lite/pages/detail/detail.js +++ b/ace-loader/sample/lite/pages/detail/detail.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + var router = require('@system.router') export default { data: {}, diff --git a/ace-loader/sample/lite/pages/index/index.js b/ace-loader/sample/lite/pages/index/index.js index e59972a..19975f8 100644 --- a/ace-loader/sample/lite/pages/index/index.js +++ b/ace-loader/sample/lite/pages/index/index.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { data: { title: 'World' diff --git a/ace-loader/sample/rich/app.js b/ace-loader/sample/rich/app.js index d624d9c..243d25f 100644 --- a/ace-loader/sample/rich/app.js +++ b/ace-loader/sample/rich/app.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { onCreate() { console.info('AceApplication onCreate'); diff --git a/ace-loader/sample/rich/pages/detail/detail.js b/ace-loader/sample/rich/pages/detail/detail.js index 42d99d6..ee3e752 100644 --- a/ace-loader/sample/rich/pages/detail/detail.js +++ b/ace-loader/sample/rich/pages/detail/detail.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import router from '@system.router' export default { diff --git a/ace-loader/sample/rich/pages/index/index.js b/ace-loader/sample/rich/pages/index/index.js index d236f6f..07ce9f2 100644 --- a/ace-loader/sample/rich/pages/index/index.js +++ b/ace-loader/sample/rich/pages/index/index.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import router from '@system.router'; export default { diff --git a/ace-loader/src/lite/lite-return-exports-plugin.js b/ace-loader/src/lite/lite-return-exports-plugin.js index 5707822..b711b66 100644 --- a/ace-loader/src/lite/lite-return-exports-plugin.js +++ b/ace-loader/src/lite/lite-return-exports-plugin.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + const pluginName = 'LiteReturnExportsPlugin'; /** @@ -5,6 +20,7 @@ const pluginName = 'LiteReturnExportsPlugin'; */ class LiteReturnExportsPlugin { /** + * * return exports from runtime * @param {Object} compiler API specification, all configuration information of Webpack environment. */ diff --git a/ace-loader/src/lite/lite-transform-style.js b/ace-loader/src/lite/lite-transform-style.js index 25572a3..2618ee9 100644 --- a/ace-loader/src/lite/lite-transform-style.js +++ b/ace-loader/src/lite/lite-transform-style.js @@ -53,7 +53,6 @@ function transformStyle(value) { } else if (key === MEDIA_QUERY) { styleSheet['@media'] = mediaQueryFormat(style[key]); } else { - // todo: Label style } } if (style != null && keys.length !== 0) { @@ -68,6 +67,7 @@ function transformStyle(value) { return res; } /** + * * keyFrame style special compilation. * @param {Obejct} obj Preliminary compilation results of keyFrame style. * @return {Obejct} keyFrame style obejct. diff --git a/ace-loader/src/loader-gen.js b/ace-loader/src/loader-gen.js index 1c6e7fe..768b262 100644 --- a/ace-loader/src/loader-gen.js +++ b/ace-loader/src/loader-gen.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ @@ -177,9 +192,12 @@ function codegenHmlAndCss() { if (process.env.DEVICE_LEVEL === 'card') { output = '//card_start\n' - output += `var card_template =` + getRequireString(this, jsonLoaders('template', undefined, true, 'template'), this.resourcePath) - output += `var card_style =` + getRequireString(this, jsonLoaders('style', undefined, true, 'style'), this.resourcePath) - output += `var card_json =` + getRequireString(this, jsonLoaders('json', undefined, true, 'json'), this.resourcePath) + output += `var card_template =` + getRequireString(this, + jsonLoaders('template', undefined, true, 'template'), this.resourcePath) + output += `var card_style =` + getRequireString(this, + jsonLoaders('style', undefined, true, 'style'), this.resourcePath) + output += `var card_json =` + getRequireString(this, + jsonLoaders('json', undefined, true, 'json'), this.resourcePath) output += '\n//card_end' } else { output = 'var $app_script$ = ' + getRequireString(this, getLoaderString('script', { @@ -207,7 +225,8 @@ function codegenHmlAndCss() { }), this.resourcePath) output += ` - $app_define$('@app-component/${getNameByPath(this.resourcePath)}', [], function($app_require$, $app_exports$, $app_module$) { + $app_define$('@app-component/${getNameByPath(this.resourcePath)}', [], + function($app_require$, $app_exports$, $app_module$) { ` + ` $app_script$($app_module$, $app_exports$, $app_require$) if ($app_exports$.__esModule && $app_exports$.default) { @@ -221,7 +240,8 @@ function codegenHmlAndCss() { }) ` if (isEntry) { - output += `$app_bootstrap$('@app-component/${getNameByPath(this.resourcePath)}'` + ',undefined' + ',undefined' + `)` + output += `$app_bootstrap$('@app-component/ + ${getNameByPath(this.resourcePath)}'` + ',undefined' + ',undefined' + `)` } } return output diff --git a/ace-loader/test/card/testError/common/component/comp/comp.js b/ace-loader/test/card/testError/common/component/comp/comp.js index 204bd7b..03cdc6f 100644 --- a/ace-loader/test/card/testError/common/component/comp/comp.js +++ b/ace-loader/test/card/testError/common/component/comp/comp.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { props:{ title: { diff --git a/ace-loader/test/card/testcase/pages/importLess/importLess.less b/ace-loader/test/card/testcase/pages/importLess/importLess.less index 16d8348..582b303 100644 --- a/ace-loader/test/card/testcase/pages/importLess/importLess.less +++ b/ace-loader/test/card/testcase/pages/importLess/importLess.less @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + @colorBackground: #000000; .container { background-color: @colorBackground; diff --git a/ace-loader/test/card/testcase/pages/withJS/withJS.js b/ace-loader/test/card/testcase/pages/withJS/withJS.js index 547816b..b569893 100644 --- a/ace-loader/test/card/testcase/pages/withJS/withJS.js +++ b/ace-loader/test/card/testcase/pages/withJS/withJS.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { data: { name: this.map['amy'], diff --git a/ace-loader/test/lite/expected/attribute.js b/ace-loader/test/lite/expected/attribute.js index 503f1c7..f92e5f1 100644 --- a/ace-loader/test/lite/expected/attribute.js +++ b/ace-loader/test/lite/expected/attribute.js @@ -1 +1,16 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + {"render": "function (vm) { var _vm = vm || this; return _c('div', [_c('slider', {'attrs' : {'max' : 100}} ),_c('image'),_c('div', {'attrs' : {'key' : \"day\",'value' : \"hello\"}} ),_c('text', {'attrs' : {'value' : \"hello\"}} ),_c('text', {'attrs' : {'value' : function () {return _vm.num}}} )] ) }"} \ No newline at end of file diff --git a/ace-loader/test/lite/expected/bubble.js b/ace-loader/test/lite/expected/bubble.js index 9a7642f..05e9d62 100644 --- a/ace-loader/test/lite/expected/bubble.js +++ b/ace-loader/test/lite/expected/bubble.js @@ -1 +1,16 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + {"render": "function (vm) { var _vm = vm || this; return _c('div', {'staticClass' : [\"container\"]} , [_c('div', {'onBubbleEvents' : {'click' : _vm.test1}} ),_c('div', {'onBubbleEvents' : {'click' : _vm.test2}} ),_c('div', {'onBubbleEvents' : {'click' : _vm.test3}} ),_c('div', {'catchBubbleEvents' : {'click' : _vm.test4}} ),_c('div', {'onBubbleEvents' : {'click' : _vm.test5}} ),_c('div', {'onBubbleEvents' : {'click' : _vm.test6}} ),_c('div', {'onBubbleEvents' : {'click' : _vm.test7}} ),_c('div', {'catchBubbleEvents' : {'click' : _vm.test8}} ),_c('div', {'onCaptureEvents' : {'click' : _vm.test9}} ),_c('div', {'onCaptureEvents' : {'click' : _vm.test10}} ),_c('div', {'onCaptureEvents' : {'click' : _vm.test11}} ),_c('div', {'catchCaptureEvents' : {'click' : _vm.test12}} ),_c('div', {'onBubbleEvents' : {'swipe' : _vm.swipe1},'catchCaptureEvents' : {'longpress' : _vm.longpress1}} ),_c('div', {'onBubbleEvents' : {'swipe' : _vm.swipe2},'onCaptureEvents' : {'longpress' : _vm.longpress2}} ),_c('div', {'onBubbleEvents' : {'swipe' : _vm.swipe3},'onCaptureEvents' : {'longpress' : _vm.longpress3}} ),_c('div', {'catchBubbleEvents' : {'swipe' : _vm.swipe4},'onCaptureEvents' : {'longpress' : _vm.longpress4}} ),_c('div', {'onBubbleEvents' : {'swipe' : _vm.swipe5},'catchBubbleEvents' : {'longpress' : _vm.longpress5}} ),_c('div', {'onBubbleEvents' : {'swipe' : _vm.swipe6,'longpress' : _vm.longpress6}} ),_c('div', {'onBubbleEvents' : {'swipe' : _vm.swipe7,'longpress' : _vm.longpress7}} ),_c('div', {'catchBubbleEvents' : {'swipe' : _vm.swipe8},'onBubbleEvents' : {'longpress' : _vm.longpress8}} ),_c('div', {'onCaptureEvents' : {'swipe' : _vm.swipe9},'catchBubbleEvents' : {'longpress' : _vm.longpress9}} ),_c('div', {'onCaptureEvents' : {'swipe' : _vm.swipe10},'onBubbleEvents' : {'longpress' : _vm.longpress10}} ),_c('div', {'onCaptureEvents' : {'swipe' : _vm.swipe11},'onBubbleEvents' : {'longpress' : _vm.longpress11}} ),_c('div', {'catchCaptureEvents' : {'swipe' : _vm.swipe12},'onBubbleEvents' : {'longpress' : _vm.longpress12}} )] ) }"} \ No newline at end of file diff --git a/ace-loader/test/lite/expected/class.js b/ace-loader/test/lite/expected/class.js index 7651b0d..51f4f65 100644 --- a/ace-loader/test/lite/expected/class.js +++ b/ace-loader/test/lite/expected/class.js @@ -1 +1,16 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + {"render": "function (vm) { var _vm = vm || this; return _c('div', [_c('div', {'staticClass' : [\"container\"]} ),_c('div', {'staticClass' : [\"container\",\"table\"]} )] ) }"} \ No newline at end of file diff --git a/ace-loader/test/lite/expected/event.js b/ace-loader/test/lite/expected/event.js index 1a678da..c1e42ce 100644 --- a/ace-loader/test/lite/expected/event.js +++ b/ace-loader/test/lite/expected/event.js @@ -1 +1,16 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + {"render": "function (vm) { var _vm = vm || this; return _c('div', [_c('div', {'onBubbleEvents' : {'click' : _vm.test}} ),_c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test(_vm.value,evt)}}} ),_c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test(_vm.value,_vm.time,evt)}}} ),_c('input', {'onBubbleEvents' : {'click' : function (evt) {_vm.handleInput('(',evt)}}} ),_c('input', {'onBubbleEvents' : {'click' : function (evt) {_vm.handleInput('(',evt)}}} ),_c('input', {'onBubbleEvents' : {'click' : function (evt) {_vm.handleInput(')',evt)}}} ),_c('input', {'onBubbleEvents' : {'click' : function (evt) {_vm.handleInput(')',evt)}}} ),_c('input', {'onBubbleEvents' : {'click' : function (evt) {_vm.handleInput('kk',_vm.value,'dd',evt)}}} ),_c('input', {'onBubbleEvents' : {'click' : function (evt) {_vm.handleInput(_vm.value,_vm.time,'(',evt)}}} ),_c('input', {'onBubbleEvents' : {'click' : function (evt) {_vm.handleInput('(',_vm.value,_vm.time,evt)}}} )] ) }"} \ No newline at end of file diff --git a/ace-loader/test/lite/expected/expression.js b/ace-loader/test/lite/expected/expression.js index 070d203..0214e19 100644 --- a/ace-loader/test/lite/expected/expression.js +++ b/ace-loader/test/lite/expected/expression.js @@ -1 +1,16 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + {"render": "function (vm) { var _vm = vm || this; return _c('div', [_c('text', {'attrs' : {'value' : function () {return _vm.ti||_vm.subTitle}}} ),_c('text', {'attrs' : {'value' : function () {return _vm.ti&&_vm.subTitle}}} ),_c('div', {'attrs' : {'value' : function () {return _vm.isArrived==='arrived'&&_vm.isTravel===false}}} ),_c('div', {'attrs' : {'value' : function () {return _vm.isArrived==='arrived'||_vm.isTravel===false}}} ),_c('div', {'attrs' : {'value' : function () {return !_vm.flag}}} ),_c('div', {'attrs' : {'value' : function () {return !!_vm.flag}}} )] ) }"} \ No newline at end of file diff --git a/ace-loader/test/lite/expected/exteriorStyle.js b/ace-loader/test/lite/expected/exteriorStyle.js index 2c00e83..f619522 100644 --- a/ace-loader/test/lite/expected/exteriorStyle.js +++ b/ace-loader/test/lite/expected/exteriorStyle.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "render": "function (vm) { var _vm = vm || this; return _c('div') }", "styleSheet": { diff --git a/ace-loader/test/lite/expected/forDirective.js b/ace-loader/test/lite/expected/forDirective.js index 656100b..1f14fe5 100644 --- a/ace-loader/test/lite/expected/forDirective.js +++ b/ace-loader/test/lite/expected/forDirective.js @@ -1 +1,16 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + {"render": "function (vm) { var _vm = vm || this; return _c('div', [_l((function () {return _vm.list}),function($item,$idx){return _c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test($item,evt)}}} , [_c('text', {'attrs' : {'value' : function () {return ($idx) + decodeURI('.') + ($item.name)}}} )] )}),_c('div', [_l((function () {return _vm.list}),function(personItem,$idx){return _c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test($idx,evt)}}} , [_c('text', {'attrs' : {'value' : function () {return ($idx) + decodeURI('-') + (personItem.name) + decodeURI('--') + (personItem.age)}}} )] )}),_c('image', {'attrs' : {'src' : function () {return _vm.personItem}}} )] ),_c('div', [_l((function () {return _vm.list}),function(personItem,personIndex){return _c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test(personItem,evt)}}} , [_c('text', {'attrs' : {'value' : function () {return (personIndex) + decodeURI('.') + (personItem.name)}}} )] )}),_c('swiper', {'attrs' : {'index' : function () {return _vm.personIndex},'loop' : function () {return _vm.personItem}}} )] ),_l((function () {return _vm.list}),function(personItem,personIndex){return _c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test(personItem,evt)}}} , [_l((function () {return _vm.menu}),function(item,index){return _c('div', [_c('text', {'attrs' : {'value' : function () {return (personItem.id) + decodeURI('--') + (item.name)}}} )] )})] )}),_l((function () {return _vm.list}),function(personItem,personIndex){return _c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test(personItem,evt)}}} , [_l((function () {return personItem}),function(item,index){return _c('div', [_c('text', {'attrs' : {'value' : function () {return (index) + decodeURI('--') + (item.name)}}} )] )})] )}),_l((function () {return _vm.list}),function(personItem,personIndex){return _c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test(personItem,evt)}}} , [_c('div', {'attrs' : {'value' : function () {return (personIndex) + decodeURI('.') + (personItem.name)}},'onBubbleEvents' : {'click' : personItem.click}} )] )}),_l((function () {return value.list}),function(index,value){return _c('div', {'onBubbleEvents' : {'click' : function (evt) {_vm.test(value,evt)}}} , [_c('div', {'attrs' : {'value' : function () {return value.info}},'onBubbleEvents' : {'click' : value.click}} )] )})] ) }"} \ No newline at end of file diff --git a/ace-loader/test/lite/expected/ifDirective.js b/ace-loader/test/lite/expected/ifDirective.js index 4f82ca8..898bc01 100644 --- a/ace-loader/test/lite/expected/ifDirective.js +++ b/ace-loader/test/lite/expected/ifDirective.js @@ -1 +1,16 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + {"render": "function (vm) { var _vm = vm || this; return _c('div', [_i((function () {return _vm.conditionVar===1}),function(){return _c('text', {'attrs' : {'value' : function () {return _vm.componentData.if}}} )}),_c('div', {'staticClass' : [\"item-content\"]} , [_i((function () {return _vm.conditionVar===1}),function(){return _c('text', {'attrs' : {'value' : function () {return _vm.componentData.if}}} )}),_i((function () {return _vm.conditionVar===2&&!(_vm.conditionVar===1)}),function(){return _c('text', {'attrs' : {'value' : function () {return _vm.componentData.elif}}} )}),_i((function () {return !(_vm.conditionVar===2)&&!(_vm.conditionVar===1)}),function(){return _c('text', {'attrs' : {'value' : function () {return _vm.componentData.else}}} )})] ),_i((function () {return _vm.showTest}),function(){return _c('div', [_l((function () {return _vm.list}),function($item,$idx){return _c('div', [_c('text', {'attrs' : {'value' : function () {return ($idx) + decodeURI('.') + ($item.name)}}} )] )})] )}),_l((function () {return _vm.list}),function($item,$idx){return _c('div', [_i((function () {return _vm.showTest}),function(){return _c('div', [_c('text', {'attrs' : {'value' : function () {return ($idx) + decodeURI('.') + ($item.name)}}} )] )})] )}),_l((function () {return _vm.list}),function(personItem,personIndex){return _c('div', [_i((function () {return personIndex==1}),function(){return _c('div', [_c('text', {'attrs' : {'value' : function () {return personItem.name}}} )] )})] )})] ) }"} \ No newline at end of file diff --git a/ace-loader/test/lite/expected/importJS.js b/ace-loader/test/lite/expected/importJS.js index 7e94e67..7ab95ca 100644 --- a/ace-loader/test/lite/expected/importJS.js +++ b/ace-loader/test/lite/expected/importJS.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "goHome": "function goHome() {\n _system[\"default\"].replace({\n uri: \"pages/index/index\"\n });\n }", "render": "function (vm) { var _vm = vm || this; return _c('div', [_c('image')] ) }" diff --git a/ace-loader/test/lite/expected/inlineStyle.js b/ace-loader/test/lite/expected/inlineStyle.js index 128e8f0..e3ce4a7 100644 --- a/ace-loader/test/lite/expected/inlineStyle.js +++ b/ace-loader/test/lite/expected/inlineStyle.js @@ -1 +1,16 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + {"render": "function (vm) { var _vm = vm || this; return _c('div', [_c('div', {'staticStyle' : {'width' : 10}, } ),_c('div', {'dynamicStyle' :{'height' : function () {return _vm.num}}} ),_c('text', {'staticStyle' : {'color' : 13047173}, } ),_c('div', {'staticStyle' : {'color' : 14745599}, } ),_c('div', {'staticStyle' : {'animationDelay' : \"900ms\"}, } ),_c('div', {'staticStyle' : {'animationDuration' : \"200ms\"}, } ),_c('div', {'staticStyle' : {'animationIterationCount' : \"infinite\"}, } ),_c('div', {'staticStyle' : {'animationIterationCount' : 1000}, } ),_c('div', {'staticStyle' : {'backgroundImage' : \"url(/common/img/xmad.jpg)\"}, } ),_c('div', {'staticStyle' : {'backgroundImage' : \"url(/common/img/map.jpg)\"}, } )] ) }"} \ No newline at end of file diff --git a/ace-loader/test/lite/expected/music.js b/ace-loader/test/lite/expected/music.js index d938d28..be3253c 100644 --- a/ace-loader/test/lite/expected/music.js +++ b/ace-loader/test/lite/expected/music.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "data": { "musics": [ diff --git a/ace-loader/test/lite/expected/sick.js b/ace-loader/test/lite/expected/sick.js index b831011..f7c7d18 100644 --- a/ace-loader/test/lite/expected/sick.js +++ b/ace-loader/test/lite/expected/sick.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "change": "function change() {\n _system[\"default\"].replace({\n uri: 'pages/music/music'\n });\n }", "data": { diff --git a/ace-loader/test/lite/testcase/app.js b/ace-loader/test/lite/testcase/app.js index bb1f752..d055418 100644 --- a/ace-loader/test/lite/testcase/app.js +++ b/ace-loader/test/lite/testcase/app.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { onCreate() { console.info("AceApplication onCreate"); diff --git a/ace-loader/test/lite/testcase/pages/importJS/importJS.js b/ace-loader/test/lite/testcase/pages/importJS/importJS.js index 7aae162..19789b1 100644 --- a/ace-loader/test/lite/testcase/pages/importJS/importJS.js +++ b/ace-loader/test/lite/testcase/pages/importJS/importJS.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /* Test import syntax */ import router from "@system.router"; diff --git a/ace-loader/test/lite/testcase/pages/music/music.js b/ace-loader/test/lite/testcase/pages/music/music.js index 41778f4..8ca422e 100644 --- a/ace-loader/test/lite/testcase/pages/music/music.js +++ b/ace-loader/test/lite/testcase/pages/music/music.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { data: { musics: [ diff --git a/ace-loader/test/lite/testcase/pages/sick/sick.js b/ace-loader/test/lite/testcase/pages/sick/sick.js index b8366ed..c1d7dbb 100644 --- a/ace-loader/test/lite/testcase/pages/sick/sick.js +++ b/ace-loader/test/lite/testcase/pages/sick/sick.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import router from '@system.router'; export default { data: { diff --git a/ace-loader/test/rich/expected/class.js b/ace-loader/test/rich/expected/class.js index 98a4c0d..c027ecb 100644 --- a/ace-loader/test/rich/expected/class.js +++ b/ace-loader/test/rich/expected/class.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/class": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/commonAttr.js b/ace-loader/test/rich/expected/commonAttr.js index 9a59e78..0120c1a 100644 --- a/ace-loader/test/rich/expected/commonAttr.js +++ b/ace-loader/test/rich/expected/commonAttr.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/commonAttr": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/event.js b/ace-loader/test/rich/expected/event.js index a3c8317..d5efa8f 100644 --- a/ace-loader/test/rich/expected/event.js +++ b/ace-loader/test/rich/expected/event.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/event": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/expression.js b/ace-loader/test/rich/expected/expression.js index 5c6f746..347f1f0 100644 --- a/ace-loader/test/rich/expected/expression.js +++ b/ace-loader/test/rich/expected/expression.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/expression": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/exteriorStyle.js b/ace-loader/test/rich/expected/exteriorStyle.js index 3c085d5..a284e8a 100644 --- a/ace-loader/test/rich/expected/exteriorStyle.js +++ b/ace-loader/test/rich/expected/exteriorStyle.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/exteriorStyle": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/forDirective.js b/ace-loader/test/rich/expected/forDirective.js index 6ad1461..c7cd3cb 100644 --- a/ace-loader/test/rich/expected/forDirective.js +++ b/ace-loader/test/rich/expected/forDirective.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/forDirective": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/ifDirective.js b/ace-loader/test/rich/expected/ifDirective.js index 7938f03..13fa126 100644 --- a/ace-loader/test/rich/expected/ifDirective.js +++ b/ace-loader/test/rich/expected/ifDirective.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/ifDirective": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/importCSS.js b/ace-loader/test/rich/expected/importCSS.js index 1af384c..6cf66f7 100644 --- a/ace-loader/test/rich/expected/importCSS.js +++ b/ace-loader/test/rich/expected/importCSS.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/importCSS": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/importJS.js b/ace-loader/test/rich/expected/importJS.js index 0a916f7..a81a716 100644 --- a/ace-loader/test/rich/expected/importJS.js +++ b/ace-loader/test/rich/expected/importJS.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/importJS": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/inlineStyle.js b/ace-loader/test/rich/expected/inlineStyle.js index 16bd91a..c30c27b 100644 --- a/ace-loader/test/rich/expected/inlineStyle.js +++ b/ace-loader/test/rich/expected/inlineStyle.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/inlineStyle": { "_descriptor": {}, @@ -253,7 +268,7 @@ "value": "style_test23" }, "style": { - "backgroundImage": "https://huawei.com/logo.jpg" + "backgroundImage": "https://img2.baidu.com/it/u=2000577849,825990840&fm=26&fmt=auto" } } ] diff --git a/ace-loader/test/rich/expected/mediaQuery.js b/ace-loader/test/rich/expected/mediaQuery.js index c026b3a..69c0828 100644 --- a/ace-loader/test/rich/expected/mediaQuery.js +++ b/ace-loader/test/rich/expected/mediaQuery.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/mediaQuery": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/privateAttr.js b/ace-loader/test/rich/expected/privateAttr.js index e423258..3628353 100644 --- a/ace-loader/test/rich/expected/privateAttr.js +++ b/ace-loader/test/rich/expected/privateAttr.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/privateAttr": { "_descriptor": {}, diff --git a/ace-loader/test/rich/expected/uncommonAttr.js b/ace-loader/test/rich/expected/uncommonAttr.js index a2201f2..f42cd05 100644 --- a/ace-loader/test/rich/expected/uncommonAttr.js +++ b/ace-loader/test/rich/expected/uncommonAttr.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + { "@app-component/uncommonAttr": { "_descriptor": {}, diff --git a/ace-loader/test/rich/testcase/app.js b/ace-loader/test/rich/testcase/app.js index bb1f752..d055418 100644 --- a/ace-loader/test/rich/testcase/app.js +++ b/ace-loader/test/rich/testcase/app.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + export default { onCreate() { console.info("AceApplication onCreate"); diff --git a/ace-loader/test/rich/testcase/pages/class/class.js b/ace-loader/test/rich/testcase/pages/class/class.js index e69de29..06a7a5d 100644 --- a/ace-loader/test/rich/testcase/pages/class/class.js +++ b/ace-loader/test/rich/testcase/pages/class/class.js @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/ace-loader/test/rich/testcase/pages/commonAttr/commonAttr.js b/ace-loader/test/rich/testcase/pages/commonAttr/commonAttr.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/commonAttr/commonAttr.js +++ b/ace-loader/test/rich/testcase/pages/commonAttr/commonAttr.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/event/event.js b/ace-loader/test/rich/testcase/pages/event/event.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/event/event.js +++ b/ace-loader/test/rich/testcase/pages/event/event.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/expression/expression.js b/ace-loader/test/rich/testcase/pages/expression/expression.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/expression/expression.js +++ b/ace-loader/test/rich/testcase/pages/expression/expression.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/exteriorStyle/exteriorStyle.js b/ace-loader/test/rich/testcase/pages/exteriorStyle/exteriorStyle.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/exteriorStyle/exteriorStyle.js +++ b/ace-loader/test/rich/testcase/pages/exteriorStyle/exteriorStyle.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/forDirective/forDirective.js b/ace-loader/test/rich/testcase/pages/forDirective/forDirective.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/forDirective/forDirective.js +++ b/ace-loader/test/rich/testcase/pages/forDirective/forDirective.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/importCSS/importCSS.js b/ace-loader/test/rich/testcase/pages/importCSS/importCSS.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/importCSS/importCSS.js +++ b/ace-loader/test/rich/testcase/pages/importCSS/importCSS.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/importJS/importJS.js b/ace-loader/test/rich/testcase/pages/importJS/importJS.js index 8397662..1be68ee 100644 --- a/ace-loader/test/rich/testcase/pages/importJS/importJS.js +++ b/ace-loader/test/rich/testcase/pages/importJS/importJS.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /* Test import syntax */ import router from "@system.router"; diff --git a/ace-loader/test/rich/testcase/pages/inlineStyle/inlineStyle.js b/ace-loader/test/rich/testcase/pages/inlineStyle/inlineStyle.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/inlineStyle/inlineStyle.js +++ b/ace-loader/test/rich/testcase/pages/inlineStyle/inlineStyle.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/mediaQuery/mediaQuery.js b/ace-loader/test/rich/testcase/pages/mediaQuery/mediaQuery.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/mediaQuery/mediaQuery.js +++ b/ace-loader/test/rich/testcase/pages/mediaQuery/mediaQuery.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/privateAttr/privateAttr.js b/ace-loader/test/rich/testcase/pages/privateAttr/privateAttr.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/privateAttr/privateAttr.js +++ b/ace-loader/test/rich/testcase/pages/privateAttr/privateAttr.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/test/rich/testcase/pages/uncommonAttr/uncommonAttr.js b/ace-loader/test/rich/testcase/pages/uncommonAttr/uncommonAttr.js index e69de29..75dc730 100644 --- a/ace-loader/test/rich/testcase/pages/uncommonAttr/uncommonAttr.js +++ b/ace-loader/test/rich/testcase/pages/uncommonAttr/uncommonAttr.js @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/ace-loader/webpack.lite.config.js b/ace-loader/webpack.lite.config.js index f296976..b43c6ae 100644 --- a/ace-loader/webpack.lite.config.js +++ b/ace-loader/webpack.lite.config.js @@ -136,7 +136,8 @@ module.exports = (env) => { setConfigs(env) deleteFolderRecursive(process.env.buildPath); webpackConfig.cache.cacheDirectory = path.resolve(process.env.cachePath, '.lite_cache'); - webpackConfig.entry = loadEntryObj(process.env.projectPath, process.env.DEVICE_LEVEL, process.env.abilityType, process.env.aceManifestPath) + webpackConfig.entry = loadEntryObj(process.env.projectPath, process.env.DEVICE_LEVEL, + process.env.abilityType, process.env.aceManifestPath) webpackConfig.output.path = path.resolve(__dirname, process.env.buildPath) webpackConfig.plugins = [ new ResourcePlugin(process.env.projectPath, process.env.buildPath, process.env.aceManifestPath), diff --git a/ace-loader/webpack.rich.config.js b/ace-loader/webpack.rich.config.js index b7d47e3..3790aaf 100644 --- a/ace-loader/webpack.rich.config.js +++ b/ace-loader/webpack.rich.config.js @@ -158,7 +158,8 @@ function setConfigs(env) { process.env.logLevel = env.logLevel || '1' process.env.isPreview = env.isPreview || false process.env.projectPath = env.aceModuleRoot || process.env.aceModuleRoot || process.cwd(); - process.env.buildPath = env.aceModuleBuild || process.env.aceModuleBuild || path.resolve(process.env.projectPath, 'build'); + process.env.buildPath = env.aceModuleBuild || process.env.aceModuleBuild || + path.resolve(process.env.projectPath, 'build'); process.env.cachePath = env.cachePath || process.env.cachePath || path.resolve(__dirname, 'node_modules/.cache'); process.env.aceManifestPath = process.env.aceManifestPath || path.resolve(process.env.projectPath, 'manifest.json'); process.env.abilityType = process.env.abilityType || 'page' @@ -189,7 +190,8 @@ module.exports = (env) => { loader: path.resolve(__dirname, './index.js') }] }) - config.entry = loadEntryObj(process.env.projectPath, process.env.DEVICE_LEVEL, process.env.abilityType, process.env.aceManifestPath) + config.entry = loadEntryObj(process.env.projectPath, process.env.DEVICE_LEVEL, + process.env.abilityType, process.env.aceManifestPath) config.output.path = path.resolve(__dirname, process.env.buildPath) config.plugins = [ new ResourcePlugin(process.env.projectPath, process.env.buildPath, process.env.aceManifestPath), @@ -223,7 +225,8 @@ module.exports = (env) => { if (env.isPreview !== "true") { config.plugins.push(new ModuleCollectionPlugin()) if (env.compilerType && env.compilerType === 'ark') { - config.plugins.push(new GenAbcPlugin(process.env.buildPath, path.join(__dirname, 'bin'), env.buildMode === 'debug')) + config.plugins.push(new GenAbcPlugin(process.env.buildPath, path.join(__dirname, 'bin'), + env.buildMode === 'debug')) } else { if (env.deviceType) { let deviceArr = env.deviceType.split(/,/) @@ -244,7 +247,7 @@ module.exports = (env) => { minimizer: [ new TerserPlugin({ terserOptions: { - keep_fnames: true + keepFnames: true }, minify: (file, sourceMap) => { const uglifyEsOptions = { -- Gitee From 89e837cf5eb0e665d50e2d27761d9cfa53d991a4 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Tue, 23 Nov 2021 21:08:29 +0800 Subject: [PATCH 02/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9d2381c..de2026e 100644 --- a/LICENSE +++ b/LICENSE @@ -188,5 +188,5 @@ incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS 1 -- Gitee From 7e99b6d12fe04151e01dbc941f5bf5dabc90e5ec Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Wed, 24 Nov 2021 09:40:04 +0800 Subject: [PATCH 03/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- LICENSE | 2 +- ace-loader/plugin/codegen/index.js | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/LICENSE b/LICENSE index de2026e..9d2381c 100644 --- a/LICENSE +++ b/LICENSE @@ -188,5 +188,5 @@ incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - END OF TERMS AND CONDITIONS 1 + END OF TERMS AND CONDITIONS diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 23c57da..7baac57 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -37,7 +37,7 @@ exports.errorMap = new Map([ /***/ }), /***/ 117: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unusedWebpackModule, exports) => { /** @@ -56,7 +56,7 @@ exports.ASTNode = ASTNode; /***/ }), /***/ 862: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unusedWebpackModule, exports) => { /** @@ -67,6 +67,7 @@ exports.Cache = void 0; // There is no way pass value by reference with JS and TS, but object // This Cache is used to store output code temporarily class Cache { + /** * * @description: constructor for Cache @@ -78,6 +79,7 @@ class Cache { this.flag = true; this.INDENT = INDENT; } + /** * * @description: when flag is true, there should be some indents @@ -86,6 +88,7 @@ class Cache { indentOn() { this.flag = true; } + /** * * @description: when flag is false, there should be no indents @@ -102,11 +105,13 @@ class Cache { incIndent() { this.indent++; } + /** * * @description: decrease indent * @return void */ + decIndent() { this.indent--; } @@ -118,6 +123,7 @@ class Cache { checkIndent() { return this.indent < 0; } + /** * * @description: get indent @@ -135,6 +141,7 @@ class Cache { return ""; } } + /** * * @description: concat indents and HML/CSS code @@ -169,8 +176,9 @@ exports.Cache = Cache; */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Style = exports.Tag = void 0; -const ASTNode_1 = __webpack_require__(117); -class Tag extends ASTNode_1.ASTNode { +const ASTNode_1 = __webpackRequire__(117); +class Tag extends ASTNode_1.ASTNode_1 { + /** * * @description: constructor for Tag @@ -207,10 +215,7 @@ exports.Style = Style; /***/ }), /***/ 573: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - - - +/***/ ((__unused_webpackModule, exports, __webpackRequire__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ASTNodeGenerator = void 0; const AST_1 = __webpack_require__(243); @@ -825,6 +830,7 @@ exports.formManager = { this.getFormModel().actions.set(key, action); }); }, + /** * * remove an action @@ -833,6 +839,7 @@ exports.formManager = { removeAction(actionName) { this.getFormModel().actions.delete(actionName); }, + /** * * add params in an action @@ -849,6 +856,7 @@ exports.formManager = { }); action.params = actionParams; }, + /** * * remove params in an action @@ -861,6 +869,7 @@ exports.formManager = { (_a = action === null || action === void 0 ? void 0 : action.params) === null || _a === void 0 ? void 0 : _a.delete(paramKey); }, + /** * * get the whole node -- Gitee From 4614d50e82aaea014b37249d9c3fbdead4e20f9d Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Wed, 24 Nov 2021 10:32:51 +0800 Subject: [PATCH 04/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 127 +++++++++++++++++------------ 1 file changed, 76 insertions(+), 51 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 7baac57..8a78097 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -397,15 +397,17 @@ class CSSBridge { this.errors = 0; this.styles = []; } + /** * * @description: generate error message * @param msg is error message to show up in console */ error(msg) { - console.error("Code generating error: " + msg); + // console.error("Code generating error: " + msg); this.errors += 1; } + /** * * @description: get error number @@ -414,6 +416,7 @@ class CSSBridge { getErrorCount() { return this.errors; } + /** * * @description: code generator for ID Style, which is CSS type in AST in IR @@ -422,8 +425,8 @@ class CSSBridge { */ genIDStyle(visualModel) { const styles = new Map(); - for (const prop of PropertySet_1.styleSet) { - if (visualModel.property.has(prop) && PropertySet_1.isStyle(prop)) { + for (const prop of PropertySet_1.StyleSet) { + if (visualModel.property.has(prop) && PropertySet_1.IsStyle(prop)) { styles.set(prop, visualModel.property.get(prop)); } } @@ -434,6 +437,7 @@ class CSSBridge { visualChild.accept(this); } } + /** * * @description: visitor guidance method for contents, @@ -452,7 +456,7 @@ exports.CSSBridge = CSSBridge; /***/ }), /***/ 55: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unused_webpackModule, exports, __webpackRequire__) => { /* @@ -460,8 +464,8 @@ exports.CSSBridge = CSSBridge; */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.genFACSS = exports.genFAHML = void 0; -const ASTNodeVisitor_1 = __webpack_require__(573); -const Cache_1 = __webpack_require__(862); +const ASTNodeVisitor_1 = __webpackRequire__(573); +const Cache_1 = __webpackRequire__(862); /** * * @description: generate HML @@ -768,6 +772,7 @@ exports.formManager = void 0; const Instance_1 = __webpack_require__(891); const FormModel_1 = __webpack_require__(945); exports.formManager = { + /** * * remove a key-value in data node @@ -776,6 +781,7 @@ exports.formManager = { removeData(key) { this.getFormModel().data.delete(key); }, + /** * * add a key-value @@ -793,6 +799,7 @@ exports.formManager = { }); } }, + /** * * update all the data @@ -802,6 +809,7 @@ exports.formManager = { this.getFormModel().data.clear(); this.addData(data); }, + /** * * add an action in action node @@ -815,8 +823,9 @@ exports.formManager = { Object.keys(params).forEach(key => { paramMap.set(key, params[key]); }); - this.getFormModel().actions.set(actionName, new FormModel_1.FormAction(actionType, paramMap, abilityName)); + this.getFormModel().actions.set(ActionName, new FormModel_1.FormAction(ActionType, ParamMap, AbilityName)); }, + /** * * update all the actions @@ -826,7 +835,7 @@ exports.formManager = { this.getFormModel().actions.clear(); map.forEach((value, key) => { const params = this.objectToMap(value.params); - const action = new FormModel_1.FormAction(value.actionType, params, value.abilityName); + const action = new FormModel_1.FormAction(value.ActionType, params, value.AbilityName); this.getFormModel().actions.set(key, action); }); }, @@ -875,24 +884,26 @@ exports.formManager = { * get the whole node */ getFormModel() { - return Instance_1.getInstance().formData; + return Instance_1.GetInstance().formData; }, + /** * * codegen formModel to json */ codegenToJson: function () { - const model = Instance_1.getInstance().formData; - const data = this.mapToObject(model.data); - const actions = this.mapToObject(model.actions); + const model = Instance_1.GetInstance().formData; + const data = this.MapToObject(model.data); + const actions = this.MapToObject(model.actions); const retObj = { actions: {}, data: {} }; retObj.data = data; retObj.actions = actions; model.actions.forEach((value, key) => { - retObj.actions[key].params = this.mapToObject(value.params); + retObj.actions[key].params = this.MapToObject(value.params); }); return JSON.stringify(retObj, null, 4); }, + /** * * clear all datas and actions in model @@ -901,6 +912,7 @@ exports.formManager = { Instance_1.getInstance().formData.data.clear(); Instance_1.getInstance().formData.actions.clear(); }, + /** * * convert a map to an object @@ -912,6 +924,7 @@ exports.formManager = { } return Array.from(sourceMap.entries()).reduce((main, [key, value]) => (Object.assign(Object.assign({}, main), { [key]: value })), {}); }, + /** * * convert an object to map @@ -929,7 +942,7 @@ exports.formManager = { /***/ }), /***/ 945: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unused_webpackModule, exports) => { /* @@ -983,19 +996,21 @@ exports.isBindingEvent = isBindingEvent; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.addPhysicalModel = exports.getPhysicalModel = exports.setInstance = exports.getInstance = void 0; + /** * * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const PhysicalModel_1 = __webpack_require__(234); -const VisualModel_1 = __webpack_require__(933); -const FormModel_1 = __webpack_require__(945); +const PhysicalModel_1 = __WebpackRequire__(234); +const VisualModel_1 =__WebpackRequire__(933); +const FormModel_1 = __WebpackRequire__(945); const instance = { document: { VisualVersion: "12", type: "FA" }, - visualModel: new VisualModel_1.VisualModel({ type: "div", id: "wrapper" }), - harmonyConnectDevice: new PhysicalModel_1.Device(), - formData: new FormModel_1.FormModel(), + VisualModel: new VisualModel_1.VisualModel({ type: "div", id: "wrapper" }), + HarmonyConnectDevice: new PhysicalModel_1.Device(), + FormData: new FormModel_1.FormModel(), }; + /** * * instance is unique during the entire web page lifecycle @@ -1004,6 +1019,7 @@ function getInstance() { return instance; } exports.getInstance = getInstance; + /** * * replace instance @@ -1017,6 +1033,7 @@ function setInstance(ins) { } } exports.setInstance = setInstance; + /** * * get a physical model by its serviceId and characteristicName @@ -1030,6 +1047,7 @@ function getPhysicalModel(path) { return service.characteristics.find(e => e.name === path.characteristicName); } exports.getPhysicalModel = getPhysicalModel; + /** * * add a service, would overide if serviceId and characteristicName is same @@ -1055,36 +1073,40 @@ exports.addPhysicalModel = addPhysicalModel; /***/ }), /***/ 977: -/***/ ((__unused_webpack_module, exports, - __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, + __WebpackRequire__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.deserialize = exports.serialize = void 0; + /** * * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const VisualModel_1 = __webpack_require__(933); -const Instance_1 = __webpack_require__(891); +const VisualModel_1 =__WebpackRequire__(933); +const Instance_1 = __WebpackRequire__(891); + /** * * @description: convert JsonModel to Json * @return model in json format */ function serialize() { - return JSON.stringify(Instance_1.getInstance(), replacer); + return JSON.stringify(Instance_1.GetInstance(), replacer); } exports.serialize = serialize; + /** * @description: convert Json to JsonModel * @return model in json format */ function deserialize(json) { const ins = JSON.parse(json, reviver); - Instance_1.setInstance(ins); + Instance_1.SetInstance(ins); } exports.deserialize = deserialize; + /** * * json replacer, turn any class into string @@ -1105,7 +1127,7 @@ function replacer(key, value) { }; } else if (value instanceof VisualModel_1.VisualModel) { - const visualObj = new VisualModel_1.VisualModel({ type: "none"}); + const VisualObj = new VisualModel_1.VisualModel({ type: "none"}); const res = {}; for (const visualKey in visualObj) { if (Object.prototype.hasOwnProperty.call(value, visualKey)) { @@ -1121,6 +1143,7 @@ function replacer(key, value) { return value; } } + /** * * json reviver, true magic, replace plain json to classes @@ -1148,7 +1171,7 @@ function reviver(key, value) { /***/ }), /***/ 933: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, __WebpackRequire__) => { @@ -1199,14 +1222,14 @@ exports.VisualModel = VisualModel; /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function -/******/ function __webpack_require__(moduleId) { +/******/ function __WebpackRequire__(ModuleId) { /******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ var CachedModule = __Webpack_ModuleCache__[ModuleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ var Module = __WebpackModuleCache__[ModuleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} @@ -1220,23 +1243,24 @@ exports.VisualModel = VisualModel; /******/ } /******/ /************************************************************************/ -var __webpack_exports__ = {}; +var __WebpackExports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { -var exports = __webpack_exports__; +var exports = __WebpackExports__; /** * * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ Object.defineProperty(exports, "__esModule", ({ value: true })); -const errorMap_1 = __webpack_require__(784); -const Instance_1 = __webpack_require__(891); -const Serialization_1 = __webpack_require__(977); -const BridgeVisitor_1 = __webpack_require__(844); -const HmlCssCodeGenerator_1 = __webpack_require__(55); -const FormManager_1 = __webpack_require__(207); -const visualVersion = 12; +const ErrorMap_1 = __WebpackRequire__(784); +const Instance_1 = __WebpackRequire__(891); +const Serialization_1 = __WebpackRequire__(977); +const BridgeVisitor_1 = __WebpackRequire__(844); +const HmlCssCodeGenerator_1 =__WebpackRequire__(55); +const FormManager_1 = __WebpackRequire__(207); +const VisualVersion = 12; + /** * * @description: codegen hml and css according to code in visual file @@ -1255,8 +1279,8 @@ function genHmlAndCss(source) { }; try { // parse source code in visual file - Serialization_1.deserialize(source); - const destVisualVersion = Instance_1.getInstance().document.VisualVersion; + Serialization_1.Deserialize(source); + const DestVisualVersion = Instance_1.GetInstance().document.VisualVersion; const regex = /^([1-9]+[0-9]*)$/; if (destVisualVersion === undefined) { retObj.errorType = "versionError"; @@ -1274,8 +1298,8 @@ function genHmlAndCss(source) { retObj.errorType = "codegenError"; } retObj.hmlCss = hmlCss; - if (Instance_1.getInstance().document.type === "FORM") { - retObj.hmlCss.json = FormManager_1.formManager.codegenToJson(); + if (Instance_1.GetInstance().document.type === "FORM") { + retObj.hmlCss.json = FormManager_1.FormManager.CodegenToJson(); } } catch (e) { @@ -1292,6 +1316,7 @@ function genHmlAndCss(source) { } return retObj; } + /** * * @description: output hml and css source code of the model @@ -1303,9 +1328,9 @@ function emitFA(rootModel) { json: "", }; // generate hml - const hmlVisitor = new BridgeVisitor_1.HMLBridge(); + const HmlVisitor = new BridgeVisitor_1.HMLBridge(); const ast = rootModel.accept(hmlVisitor); - const hmlRes = HmlCssCodeGenerator_1.genFAHML(ast); + const hmlRes = HmlCssCodeGenerator_1.GenFAHML(ast); if (hmlVisitor.getErrorCount() > 0) { hmlCss.hml = "error"; } @@ -1313,9 +1338,9 @@ function emitFA(rootModel) { hmlCss.hml = hmlRes; } // generate css - const cssVisitor = new BridgeVisitor_1.CSSBridge(); + const CssVisitor = new BridgeVisitor_1.CSSBridge(); const styles = rootModel.accept(cssVisitor); - const cssRes = HmlCssCodeGenerator_1.genFACSS(styles); + const cssRes = HmlCssCodeGenerator_1.GenFACSS(styles); if (cssVisitor.getErrorCount() > 0) { hmlCss.css = "error"; } @@ -1328,8 +1353,8 @@ exports.genHmlAndCss = genHmlAndCss; })(); -var __webpack_export_target__ = exports; -for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; -if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); +var __WebpackExportTarget__ = exports; +for(var i in __WebpackExports__) __WebpackExportTarget__[i] = __WebpackExports__[i]; +if(__WebpackExports__.__esModule) Object.defineProperty(__WebpackExportTarget__, "__esModule", { value: true }); /******/ })() ; -- Gitee From e96ae8ce91495faba0c60f48e930ff356985377e Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Wed, 24 Nov 2021 11:15:35 +0800 Subject: [PATCH 05/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 85 ++++++++++++++++++------------ 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 8a78097..cf78021 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -97,6 +97,7 @@ class Cache { indentOff() { this.flag = false; } + /** * * @description: increase indent @@ -115,6 +116,7 @@ class Cache { decIndent() { this.indent--; } + /** * * @description: check whether indent is LT 0 @@ -153,6 +155,7 @@ class Cache { this.value = this.value.concat(...strings); return String(this.value); } + /** * * @description: concat indents and HML/CSS code @@ -168,7 +171,7 @@ exports.Cache = Cache; /***/ }), /***/ 243: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unused_WebpackModule, exports, __WebpackRequire__) => { /* @@ -176,8 +179,8 @@ exports.Cache = Cache; */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Style = exports.Tag = void 0; -const ASTNode_1 = __webpackRequire__(117); -class Tag extends ASTNode_1.ASTNode_1 { +const ASTNode_1 = __WebpackRequire__(117); +class Tag extends AstNode_1.AstNode_1 { /** * @@ -194,7 +197,8 @@ class Tag extends ASTNode_1.ASTNode_1 { } } exports.Tag = Tag; -class Style extends ASTNode_1.ASTNode { +class Style extends AstNode_1.AstNode { + /** * * @description: constructor for Style @@ -215,12 +219,13 @@ exports.Style = Style; /***/ }), /***/ 573: -/***/ ((__unused_webpackModule, exports, __webpackRequire__) => { +/***/ ((__unused_WebpackModule, exports, __WebpackRequire__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ASTNodeGenerator = void 0; -const AST_1 = __webpack_require__(243); -const Token_1 = __webpack_require__(334); +const AST_1 = __WebpackRequire__(243); +const Token_1 = __WebpackRequire__(334); class ASTNodeGenerator { + /** * @description: constructor for BridgeVisitor * @param reference is cache for Harmony FA code @@ -228,6 +233,7 @@ class ASTNodeGenerator { constructor(reference) { this.cache = reference; } + /** * @description: visitor mode dispatcher * @param t Node in AST @@ -240,6 +246,7 @@ class ASTNodeGenerator { this.genStyle(t); } } + /** * @description: code generator * @param ref is cache for code @@ -254,6 +261,7 @@ class ASTNodeGenerator { } return ASTNodeGenerator.instance; } + /** * @description: cache for code * @param ref is cache for code @@ -262,20 +270,21 @@ class ASTNodeGenerator { setCache(ref) { this.cache = ref; } + /** * @description: parse Tag in AST and generate code for Tag in cache * @param t Tag in AST * @return void */ genTag(t) { - this.cache.concat(Token_1.TokenClass.TAG_START, t.tagName); + this.cache.concat(Token_1.TokenClass.Tag_Start, t.tagName); this.cache.indentOff(); t.attributes.forEach((value, key) => { let valueBK = ""; for (const char of value) { valueBK += (char === "\"" ? """ : (char === "\n" ? " " : char)); } - this.cache.concat(Token_1.TokenClass.SPACE, key, Token_1.TokenClass.ASSIGN, Token_1.TokenClass.LQUOTE, valueBK, Token_1.TokenClass.RQUOTE); + this.cache.concat(Token_1.TokenClass.Space, key, Token_1.TokenClass.Assign, Token_1.TokenClass.Lquote, ValueBK, Token_1.TokenClass.Rquote); }); if (t.content === null) { this.cache.concat(Token_1.TokenClass.EMPTY_TAG_END); @@ -305,6 +314,7 @@ class ASTNodeGenerator { this.cache.concat(Token_1.TokenClass.END_TAG_START, t.tagName, Token_1.TokenClass.TAG_END); } } + /** * @description: parse Style in AST and generate code for Style in cache * @param s Style in AST @@ -319,7 +329,7 @@ class ASTNodeGenerator { this.cache.indentOn(); this.cache.incIndent(); s.content.forEach((value, key) => { - this.cache.concat(key, Token_1.TokenClass.COLON, Token_1.TokenClass.SPACE, value, Token_1.TokenClass.SEMICOLON, Token_1.TokenClass.NEW_LINE); + this.cache.concat(key, Token_1.TokenClass.Colon, Token_1.TokenClass.Space, value, Token_1.TokenClass.Semicolon, Token_1.TokenClass.NEW_Line); }); this.cache.decIndent(); this.cache.concat(Token_1.TokenClass.RBRA, Token_1.TokenClass.NEW_LINE, Token_1.TokenClass.NEW_LINE); @@ -344,6 +354,7 @@ class HMLBridge { constructor() { this.errors = 0; } + /** * * @description: generate error message @@ -353,6 +364,7 @@ class HMLBridge { console.error("Code generating error: " + msg); this.errors += 1; } + /** * * @description: get error number @@ -361,6 +373,7 @@ class HMLBridge { getErrorCount() { return this.errors; } + /** * * @description: visitor guidance method for contents, @@ -372,13 +385,13 @@ class HMLBridge { const attributes = new Map([["id", visualModel.id]]); let content = ""; for (let [key, val] of visualModel.property) { - if (PropertySet_1.isAttribute(key)) { + if (PropertySet_1.IsAttribute(key)) { if (typeof val !== "string") { val = JSON.stringify(val); } attributes.set(key, val); } - else if (PropertySet_1.isContent(key)) { + else if (PropertySet_1.IsContent(key)) { content = val; } } @@ -426,7 +439,7 @@ class CSSBridge { genIDStyle(visualModel) { const styles = new Map(); for (const prop of PropertySet_1.StyleSet) { - if (visualModel.property.has(prop) && PropertySet_1.IsStyle(prop)) { + if (VisualModel.Property.has(prop) && PropertySet_1.IsStyle(prop)) { styles.set(prop, visualModel.property.get(prop)); } } @@ -456,7 +469,7 @@ exports.CSSBridge = CSSBridge; /***/ }), /***/ 55: -/***/ ((__unused_webpackModule, exports, __webpackRequire__) => { +/***/ ((__unused_WebpackModule, exports, __WebpackRequire__) => { /* @@ -464,8 +477,9 @@ exports.CSSBridge = CSSBridge; */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.genFACSS = exports.genFAHML = void 0; -const ASTNodeVisitor_1 = __webpackRequire__(573); -const Cache_1 = __webpackRequire__(862); +const ASTNodeVisitor_1 = __WebpackRequire__(573); +const Cache_1 = __WebpackRequire__(862); + /** * * @description: generate HML @@ -478,6 +492,7 @@ function genFAHML(t) { return generator.cache.toString(); } exports.genFAHML = genFAHML; + /** * * @description: generate CSS @@ -497,7 +512,7 @@ exports.genFACSS = genFACSS; /***/ }), /***/ 571: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unused_WebpackModule, exports) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isEvent = exports.isData = exports.isUnknown = exports.isContent = @@ -891,15 +906,15 @@ exports.formManager = { * * codegen formModel to json */ - codegenToJson: function () { + CodegenToJson: function () { const model = Instance_1.GetInstance().formData; - const data = this.MapToObject(model.data); - const actions = this.MapToObject(model.actions); + const Data = this.MapToObject(model.data); + const Actions = this.MapToObject(model.actions); const retObj = { actions: {}, data: {} }; retObj.data = data; retObj.actions = actions; model.actions.forEach((value, key) => { - retObj.actions[key].params = this.MapToObject(value.params); + RetObj.actions[key].params = this.MapToObject(value.params); }); return JSON.stringify(retObj, null, 4); }, @@ -909,8 +924,8 @@ exports.formManager = { * clear all datas and actions in model */ clear() { - Instance_1.getInstance().formData.data.clear(); - Instance_1.getInstance().formData.actions.clear(); + Instance_1.GetInstance().FormData.data.clear(); + Instance_1.GetInstance().FormData.actions.clear(); }, /** @@ -970,7 +985,7 @@ exports.FormAction = FormAction; /***/ }), /***/ 964: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unused_WebpackModule, exports) => { Object.defineProperty(exports, "__esModule", ({ value: true })); @@ -1092,7 +1107,7 @@ const Instance_1 = __WebpackRequire__(891); * @description: convert JsonModel to Json * @return model in json format */ -function serialize() { +function Serialize() { return JSON.stringify(Instance_1.GetInstance(), replacer); } exports.serialize = serialize; @@ -1254,11 +1269,11 @@ var exports = __WebpackExports__; */ Object.defineProperty(exports, "__esModule", ({ value: true })); const ErrorMap_1 = __WebpackRequire__(784); -const Instance_1 = __WebpackRequire__(891); -const Serialization_1 = __WebpackRequire__(977); -const BridgeVisitor_1 = __WebpackRequire__(844); -const HmlCssCodeGenerator_1 =__WebpackRequire__(55); -const FormManager_1 = __WebpackRequire__(207); +const Instance1 = __WebpackRequire__(891); +const Serialization1 = __WebpackRequire__(977); +const BridgeVisitor1 = __WebpackRequire__(844); +const HmlCssCodeGenerator1 =__WebpackRequire__(55); +const FormManager1 = __WebpackRequire__(207); const VisualVersion = 12; /** @@ -1328,9 +1343,9 @@ function emitFA(rootModel) { json: "", }; // generate hml - const HmlVisitor = new BridgeVisitor_1.HMLBridge(); - const ast = rootModel.accept(hmlVisitor); - const hmlRes = HmlCssCodeGenerator_1.GenFAHML(ast); + const HmlVisitor = new BridgeVisitor_1.HmlBridge(); + const Ast = rootModel.accept(hmlVisitor); + const HmlRes = HmlCssCodeGenerator_1.GenFahml(ast); if (hmlVisitor.getErrorCount() > 0) { hmlCss.hml = "error"; } @@ -1339,8 +1354,8 @@ function emitFA(rootModel) { } // generate css const CssVisitor = new BridgeVisitor_1.CSSBridge(); - const styles = rootModel.accept(cssVisitor); - const cssRes = HmlCssCodeGenerator_1.GenFACSS(styles); + const Styles = RootModel.accept(cssVisitor); + const CssRes = HmlCssCodeGenerator_1.GenFACSS(styles); if (cssVisitor.getErrorCount() > 0) { hmlCss.css = "error"; } -- Gitee From fb9af2595c6367fd0462861961d3650c7ff53408 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Wed, 24 Nov 2021 11:46:21 +0800 Subject: [PATCH 06/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index cf78021..3676540 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -342,14 +342,14 @@ ASTNodeGenerator.instance = undefined; /***/ }), /***/ 844: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unused_WebpackModule, exports, __WebpackRequire__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CSSBridge = exports.HMLBridge = void 0; const AST_1 = __webpack_require__(243); -const PropertySet_1 = __webpack_require__(571); +const PropertySet_1 = __WebpackRequire__(571); class HMLBridge { constructor() { this.errors = 0; @@ -784,8 +784,8 @@ exports.formManager = void 0; /* * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const Instance_1 = __webpack_require__(891); -const FormModel_1 = __webpack_require__(945); +const Instance_1 = __WebpackRequire__(891); +const FormModel_1 = __WebpackRequire__(945); exports.formManager = { /** @@ -907,14 +907,14 @@ exports.formManager = { * codegen formModel to json */ CodegenToJson: function () { - const model = Instance_1.GetInstance().formData; + const Model = Instance_1.GetInstance().FormData; const Data = this.MapToObject(model.data); const Actions = this.MapToObject(model.actions); const retObj = { actions: {}, data: {} }; retObj.data = data; retObj.actions = actions; model.actions.forEach((value, key) => { - RetObj.actions[key].params = this.MapToObject(value.params); + retObj.actions[key].params = this.MapToObject(value.params); }); return JSON.stringify(retObj, null, 4); }, @@ -1192,7 +1192,7 @@ function reviver(key, value) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.VisualModel = void 0; -const CombinedModel_1 = __webpack_require__(964); +const CombinedModel_1 = __WebpackRequire__(964); // sometimes the type of VisualModel would be add a suffix to distinguish origin component of GrapesJs // e.g. button-visual const typeSuffix = "-visual"; @@ -1216,7 +1216,7 @@ class VisualModel { id: "", type: "", selfType: obj.combinedSelfType === undefined ? - CombinedModel_1.CombinedSelfType.None : obj.combinedSelfType, + CombinedModel_1.CombinedSelfType.None : obj.CombinedSelfType, data: obj.data, event: obj.event, }; @@ -1234,7 +1234,7 @@ exports.VisualModel = VisualModel; /******/ }); /************************************************************************/ /******/ // The module cache -/******/ var __webpack_module_cache__ = {}; +/******/ var __WebpackModuleCache__ = {}; /******/ /******/ // The require function /******/ function __WebpackRequire__(ModuleId) { @@ -1294,8 +1294,8 @@ function genHmlAndCss(source) { }; try { // parse source code in visual file - Serialization_1.Deserialize(source); - const DestVisualVersion = Instance_1.GetInstance().document.VisualVersion; + Serialization_1.Deserialize(Source); + const DestVisualVersion = Instance_1.GetInstance().Document.VisualVersion; const regex = /^([1-9]+[0-9]*)$/; if (destVisualVersion === undefined) { retObj.errorType = "versionError"; @@ -1307,13 +1307,13 @@ function genHmlAndCss(source) { } } try { - const model = Instance_1.getInstance().visualModel; + const model = Instance_1.GetInstance().VisualModel; const hmlCss = emitFA(model); if (hmlCss.hml === "error" || hmlCss.css === "error") { retObj.errorType = "codegenError"; } retObj.hmlCss = hmlCss; - if (Instance_1.GetInstance().document.type === "FORM") { + if (Instance_1.getInstance().document.type === "FORM") { retObj.hmlCss.json = FormManager_1.FormManager.CodegenToJson(); } } -- Gitee From 2818147860ada867bc6760ebdae19e7954b27def Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Wed, 24 Nov 2021 12:20:16 +0800 Subject: [PATCH 07/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 46 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 3676540..cfb5847 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -171,7 +171,7 @@ exports.Cache = Cache; /***/ }), /***/ 243: -/***/ ((__unused_WebpackModule, exports, __WebpackRequire__) => { +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* @@ -179,8 +179,8 @@ exports.Cache = Cache; */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Style = exports.Tag = void 0; -const ASTNode_1 = __WebpackRequire__(117); -class Tag extends AstNode_1.AstNode_1 { +const ASTNode_1 = __webpack_require__(117); +class Tag extends ASTNode_1.ASTNode { /** * @@ -197,7 +197,7 @@ class Tag extends AstNode_1.AstNode_1 { } } exports.Tag = Tag; -class Style extends AstNode_1.AstNode { +class Style extends ASTNode_1.ASTNode { /** * @@ -219,11 +219,11 @@ exports.Style = Style; /***/ }), /***/ 573: -/***/ ((__unused_WebpackModule, exports, __WebpackRequire__) => { +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ASTNodeGenerator = void 0; const AST_1 = __WebpackRequire__(243); -const Token_1 = __WebpackRequire__(334); +const Token_1 = __webpack_require__(334); class ASTNodeGenerator { /** @@ -277,14 +277,14 @@ class ASTNodeGenerator { * @return void */ genTag(t) { - this.cache.concat(Token_1.TokenClass.Tag_Start, t.tagName); + this.cache.concat(Token_1.TokenClass.TAG_START, t.tagName); this.cache.indentOff(); t.attributes.forEach((value, key) => { let valueBK = ""; for (const char of value) { valueBK += (char === "\"" ? """ : (char === "\n" ? " " : char)); } - this.cache.concat(Token_1.TokenClass.Space, key, Token_1.TokenClass.Assign, Token_1.TokenClass.Lquote, ValueBK, Token_1.TokenClass.Rquote); + this.cache.concat(Token_1.TokenClass.SPACE, key, Token_1.TokenClass.ASSIGN, Token_1.TokenClass.LQUOTE, valueBK, Token_1.TokenClass.RQUOTE); }); if (t.content === null) { this.cache.concat(Token_1.TokenClass.EMPTY_TAG_END); @@ -342,14 +342,14 @@ ASTNodeGenerator.instance = undefined; /***/ }), /***/ 844: -/***/ ((__unused_WebpackModule, exports, __WebpackRequire__) => { +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CSSBridge = exports.HMLBridge = void 0; const AST_1 = __webpack_require__(243); -const PropertySet_1 = __WebpackRequire__(571); +const PropertySet_1 = __webpack_require__(571); class HMLBridge { constructor() { this.errors = 0; @@ -385,13 +385,13 @@ class HMLBridge { const attributes = new Map([["id", visualModel.id]]); let content = ""; for (let [key, val] of visualModel.property) { - if (PropertySet_1.IsAttribute(key)) { + if (PropertySet_1.isAttribute(key)) { if (typeof val !== "string") { val = JSON.stringify(val); } attributes.set(key, val); } - else if (PropertySet_1.IsContent(key)) { + else if (PropertySet_1.isContent(key)) { content = val; } } @@ -438,8 +438,8 @@ class CSSBridge { */ genIDStyle(visualModel) { const styles = new Map(); - for (const prop of PropertySet_1.StyleSet) { - if (VisualModel.Property.has(prop) && PropertySet_1.IsStyle(prop)) { + for (const prop of PropertySet_1.styleSet) { + if (visualModel.Property.has(prop) && PropertySet_1.isStyle(prop)) { styles.set(prop, visualModel.property.get(prop)); } } @@ -469,7 +469,7 @@ exports.CSSBridge = CSSBridge; /***/ }), /***/ 55: -/***/ ((__unused_WebpackModule, exports, __WebpackRequire__) => { +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* @@ -477,8 +477,8 @@ exports.CSSBridge = CSSBridge; */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.genFACSS = exports.genFAHML = void 0; -const ASTNodeVisitor_1 = __WebpackRequire__(573); -const Cache_1 = __WebpackRequire__(862); +const ASTNodeVisitor_1 = __webpack_require__(573); +const Cache_1 = ___webpack_require__(862); /** * @@ -1099,15 +1099,15 @@ exports.deserialize = exports.serialize = void 0; * * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const VisualModel_1 =__WebpackRequire__(933); -const Instance_1 = __WebpackRequire__(891); +const VisualModel_1 =__webpack_require__(933); +const Instance_1 = __webpack_require__(891); /** * * @description: convert JsonModel to Json * @return model in json format */ -function Serialize() { +function serialize() { return JSON.stringify(Instance_1.GetInstance(), replacer); } exports.serialize = serialize; @@ -1116,11 +1116,11 @@ exports.serialize = serialize; * @description: convert Json to JsonModel * @return model in json format */ -function deserialize(json) { +function Deserialize(json) { const ins = JSON.parse(json, reviver); - Instance_1.SetInstance(ins); + Instance_1.setInstance(ins); } -exports.deserialize = deserialize; +exports.Deserialize = Deserialize; /** * -- Gitee From 7610d740029c205426eecd4dfa4e8498f9974ef9 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Wed, 24 Nov 2021 14:57:20 +0800 Subject: [PATCH 08/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 67 +++++++++++++++--------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index cfb5847..998cfa0 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -329,7 +329,7 @@ class ASTNodeGenerator { this.cache.indentOn(); this.cache.incIndent(); s.content.forEach((value, key) => { - this.cache.concat(key, Token_1.TokenClass.Colon, Token_1.TokenClass.Space, value, Token_1.TokenClass.Semicolon, Token_1.TokenClass.NEW_Line); + this.cache.concat(key, Token_1.TokenClass.COLON, Token_1.TokenClass.SPACE, value, Token_1.TokenClass.SEMICOLON, Token_1.TokenClass.NEW_LINE); }); this.cache.decIndent(); this.cache.concat(Token_1.TokenClass.RBRA, Token_1.TokenClass.NEW_LINE, Token_1.TokenClass.NEW_LINE); @@ -478,7 +478,7 @@ exports.CSSBridge = CSSBridge; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.genFACSS = exports.genFAHML = void 0; const ASTNodeVisitor_1 = __webpack_require__(573); -const Cache_1 = ___webpack_require__(862); +const Cache_1 = __webpack_require__(862); /** * @@ -512,7 +512,7 @@ exports.genFACSS = genFACSS; /***/ }), /***/ 571: -/***/ ((__unused_WebpackModule, exports) => { +/***/ ((__unused_webpack_module, exports) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isEvent = exports.isData = exports.isUnknown = exports.isContent = @@ -784,8 +784,8 @@ exports.formManager = void 0; /* * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const Instance_1 = __WebpackRequire__(891); -const FormModel_1 = __WebpackRequire__(945); +const Instance_1 = __webpack_require__(891); +const FormModel_1 = __webpack_require__(945); exports.formManager = { /** @@ -838,7 +838,7 @@ exports.formManager = { Object.keys(params).forEach(key => { paramMap.set(key, params[key]); }); - this.getFormModel().actions.set(ActionName, new FormModel_1.FormAction(ActionType, ParamMap, AbilityName)); + this.getFormModel().actions.set(actionName, new FormModel_1.FormAction(actionType, paramMap, abilityName)); }, /** @@ -899,7 +899,7 @@ exports.formManager = { * get the whole node */ getFormModel() { - return Instance_1.GetInstance().formData; + return Instance_1.getInstance().formData; }, /** @@ -907,14 +907,14 @@ exports.formManager = { * codegen formModel to json */ CodegenToJson: function () { - const Model = Instance_1.GetInstance().FormData; - const Data = this.MapToObject(model.data); - const Actions = this.MapToObject(model.actions); + const model = Instance_1.getInstance().formData; + const data = this.mapToObject(model.data); + const actions = this.mapToObject(model.actions); const retObj = { actions: {}, data: {} }; retObj.data = data; retObj.actions = actions; model.actions.forEach((value, key) => { - retObj.actions[key].params = this.MapToObject(value.params); + retObj.actions[key].params = this.mapToObject(value.params); }); return JSON.stringify(retObj, null, 4); }, @@ -924,8 +924,8 @@ exports.formManager = { * clear all datas and actions in model */ clear() { - Instance_1.GetInstance().FormData.data.clear(); - Instance_1.GetInstance().FormData.actions.clear(); + Instance_1.getInstance().formData.data.clear(); + Instance_1.getInstance().formData.actions.clear();; }, /** @@ -957,7 +957,7 @@ exports.formManager = { /***/ }), /***/ 945: -/***/ ((__unused_webpackModule, exports) => { +/***/ ((__unused_webpack_module, exports) => { /* @@ -1016,14 +1016,14 @@ exports.addPhysicalModel = exports.getPhysicalModel = exports.setInstance = expo * * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const PhysicalModel_1 = __WebpackRequire__(234); -const VisualModel_1 =__WebpackRequire__(933); -const FormModel_1 = __WebpackRequire__(945); +const PhysicalModel_1 = __webpack_require__(234); +const VisualModel_1 = __webpack_require__(933); +const FormModel_1 = __webpack_require__(945); const instance = { document: { VisualVersion: "12", type: "FA" }, VisualModel: new VisualModel_1.VisualModel({ type: "div", id: "wrapper" }), HarmonyConnectDevice: new PhysicalModel_1.Device(), - FormData: new FormModel_1.FormModel(), + formData: new FormModel_1.FormModel(), }; /** @@ -1088,8 +1088,7 @@ exports.addPhysicalModel = addPhysicalModel; /***/ }), /***/ 977: -/***/ ((__unusedWebpackModule, exports, - __WebpackRequire__) => { +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); @@ -1108,7 +1107,7 @@ const Instance_1 = __webpack_require__(891); * @return model in json format */ function serialize() { - return JSON.stringify(Instance_1.GetInstance(), replacer); + return JSON.stringify(Instance_1.getInstance(), replacer); } exports.serialize = serialize; @@ -1192,7 +1191,7 @@ function reviver(key, value) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.VisualModel = void 0; -const CombinedModel_1 = __WebpackRequire__(964); +const CombinedModel_1 = __webpack_require__(964); // sometimes the type of VisualModel would be add a suffix to distinguish origin component of GrapesJs // e.g. button-visual const typeSuffix = "-visual"; @@ -1215,8 +1214,8 @@ class VisualModel { this.combinedInfo = { id: "", type: "", - selfType: obj.combinedSelfType === undefined ? - CombinedModel_1.CombinedSelfType.None : obj.CombinedSelfType, + selfType: obj.combinedSelfType === + undefined ? CombinedModel_1.CombinedSelfType.None : obj.combinedSelfType, data: obj.data, event: obj.event, }; @@ -1294,8 +1293,8 @@ function genHmlAndCss(source) { }; try { // parse source code in visual file - Serialization_1.Deserialize(Source); - const DestVisualVersion = Instance_1.GetInstance().Document.VisualVersion; + Serialization_1.deserialize(source); + const destVisualVersion = Instance_1.getInstance().document.VisualVersion; const regex = /^([1-9]+[0-9]*)$/; if (destVisualVersion === undefined) { retObj.errorType = "versionError"; @@ -1307,14 +1306,14 @@ function genHmlAndCss(source) { } } try { - const model = Instance_1.GetInstance().VisualModel; + const model = Instance_1.getInstance().visualModel; const hmlCss = emitFA(model); if (hmlCss.hml === "error" || hmlCss.css === "error") { retObj.errorType = "codegenError"; } retObj.hmlCss = hmlCss; if (Instance_1.getInstance().document.type === "FORM") { - retObj.hmlCss.json = FormManager_1.FormManager.CodegenToJson(); + retObj.hmlCss.json = FormManager_1.formManager.codegenToJson(); } } catch (e) { @@ -1343,9 +1342,9 @@ function emitFA(rootModel) { json: "", }; // generate hml - const HmlVisitor = new BridgeVisitor_1.HmlBridge(); - const Ast = rootModel.accept(hmlVisitor); - const HmlRes = HmlCssCodeGenerator_1.GenFahml(ast); + const hmlVisitor = new BridgeVisitor_1.HMLBridge(); + const ast = rootModel.accept(hmlVisitor); + const hmlRes = HmlCssCodeGenerator_1.genFAHML(ast); if (hmlVisitor.getErrorCount() > 0) { hmlCss.hml = "error"; } @@ -1353,9 +1352,9 @@ function emitFA(rootModel) { hmlCss.hml = hmlRes; } // generate css - const CssVisitor = new BridgeVisitor_1.CSSBridge(); - const Styles = RootModel.accept(cssVisitor); - const CssRes = HmlCssCodeGenerator_1.GenFACSS(styles); + const cssVisitor = new BridgeVisitor_1.CSSBridge(); + const styles = rootModel.accept(cssVisitor); + const cssRes = HmlCssCodeGenerator_1.genFACSS(styles); if (cssVisitor.getErrorCount() > 0) { hmlCss.css = "error"; } -- Gitee From 1acd72ff0bb7a8656174dffe69a1de8705d0f801 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Wed, 24 Nov 2021 16:00:31 +0800 Subject: [PATCH 09/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 122 ++++++++++++++--------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 998cfa0..d4078ba 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -171,7 +171,7 @@ exports.Cache = Cache; /***/ }), /***/ 243: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, __webpackRequire__) => { /* @@ -179,8 +179,8 @@ exports.Cache = Cache; */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Style = exports.Tag = void 0; -const ASTNode_1 = __webpack_require__(117); -class Tag extends ASTNode_1.ASTNode { +const ASTNode1 = __webpack_require__(117); +class Tag extends ASTNode1.ASTNode { /** * @@ -197,7 +197,7 @@ class Tag extends ASTNode_1.ASTNode { } } exports.Tag = Tag; -class Style extends ASTNode_1.ASTNode { +class Style extends ASTNode1.ASTNode { /** * @@ -219,11 +219,11 @@ exports.Style = Style; /***/ }), /***/ 573: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, __webpackRequire__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ASTNodeGenerator = void 0; -const AST_1 = __WebpackRequire__(243); -const Token_1 = __webpack_require__(334); +const AST1 = __WebpackRequire__(243); +const Token1 = __webpack_require__(334); class ASTNodeGenerator { /** @@ -277,20 +277,20 @@ class ASTNodeGenerator { * @return void */ genTag(t) { - this.cache.concat(Token_1.TokenClass.TAG_START, t.tagName); + this.cache.concat(Token1.TokenClass.TAG_START, t.tagName); this.cache.indentOff(); t.attributes.forEach((value, key) => { let valueBK = ""; for (const char of value) { valueBK += (char === "\"" ? """ : (char === "\n" ? " " : char)); } - this.cache.concat(Token_1.TokenClass.SPACE, key, Token_1.TokenClass.ASSIGN, Token_1.TokenClass.LQUOTE, valueBK, Token_1.TokenClass.RQUOTE); + this.cache.concat(Token1.TokenClass.SPACE, key, Token1.TokenClass.ASSIGN, Token1.TokenClass.LQUOTE, valueBK, Token1.TokenClass.RQUOTE); }); if (t.content === null) { - this.cache.concat(Token_1.TokenClass.EMPTY_TAG_END); + this.cache.concat(Token1.TokenClass.EMPTY_TAG_END); } else { - this.cache.concat(Token_1.TokenClass.TAG_END); + this.cache.concat(Token1.TokenClass.TAG_END); if (typeof t.content === "string") { let contentBK = ""; for (const char of t.content) { @@ -299,19 +299,19 @@ class ASTNodeGenerator { this.cache.concat(contentBK); } else if (t.content.length !== 0) { - this.cache.concat(Token_1.TokenClass.NEW_LINE); + this.cache.concat(Token1.TokenClass.NEW_LINE); this.cache.indentOn(); this.cache.incIndent(); t.content.forEach((tag) => { tag.accept(this); this.cache.indentOff(); - this.cache.concat(Token_1.TokenClass.NEW_LINE); + this.cache.concat(Token1.TokenClass.NEW_LINE); this.cache.indentOn(); }); this.cache.decIndent(); this.cache.indentOn(); } - this.cache.concat(Token_1.TokenClass.END_TAG_START, t.tagName, Token_1.TokenClass.TAG_END); + this.cache.concat(Token1.TokenClass.END_TAG_START, t.tagName, Token1.TokenClass.TAG_END); } } @@ -322,17 +322,17 @@ class ASTNodeGenerator { */ genStyle(s) { if (s.kind === "IDStyle") { - this.cache.concat(Token_1.TokenClass.ID_STYLE_START); + this.cache.concat(Token1.TokenClass.ID_STYLE_START); this.cache.indentOff(); } - this.cache.concat(s.name, Token_1.TokenClass.SPACE, Token_1.TokenClass.LBRA, Token_1.TokenClass.NEW_LINE); + this.cache.concat(s.name, Token1.TokenClass.SPACE, Token1.TokenClass.LBRA, Token1.TokenClass.NEW_LINE); this.cache.indentOn(); this.cache.incIndent(); s.content.forEach((value, key) => { - this.cache.concat(key, Token_1.TokenClass.COLON, Token_1.TokenClass.SPACE, value, Token_1.TokenClass.SEMICOLON, Token_1.TokenClass.NEW_LINE); + this.cache.concat(key, Token1.TokenClass.COLON, Token1.TokenClass.SPACE, value, Token1.TokenClass.SEMICOLON, Token1.TokenClass.NEW_LINE); }); this.cache.decIndent(); - this.cache.concat(Token_1.TokenClass.RBRA, Token_1.TokenClass.NEW_LINE, Token_1.TokenClass.NEW_LINE); + this.cache.concat(Token1.TokenClass.RBRA, Token1.TokenClass.NEW_LINE, Token1.TokenClass.NEW_LINE); } } exports.ASTNodeGenerator = ASTNodeGenerator; @@ -349,7 +349,7 @@ ASTNodeGenerator.instance = undefined; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.CSSBridge = exports.HMLBridge = void 0; const AST_1 = __webpack_require__(243); -const PropertySet_1 = __webpack_require__(571); +const PropertySet1 = __webpack_require__(571); class HMLBridge { constructor() { this.errors = 0; @@ -385,13 +385,13 @@ class HMLBridge { const attributes = new Map([["id", visualModel.id]]); let content = ""; for (let [key, val] of visualModel.property) { - if (PropertySet_1.isAttribute(key)) { + if (PropertySet1.isAttribute(key)) { if (typeof val !== "string") { val = JSON.stringify(val); } attributes.set(key, val); } - else if (PropertySet_1.isContent(key)) { + else if (PropertySet1.isContent(key)) { content = val; } } @@ -438,8 +438,8 @@ class CSSBridge { */ genIDStyle(visualModel) { const styles = new Map(); - for (const prop of PropertySet_1.styleSet) { - if (visualModel.Property.has(prop) && PropertySet_1.isStyle(prop)) { + for (const prop of PropertySet1.styleSet) { + if (visualModel.Property.has(prop) && PropertySet1.isStyle(prop)) { styles.set(prop, visualModel.property.get(prop)); } } @@ -469,7 +469,7 @@ exports.CSSBridge = CSSBridge; /***/ }), /***/ 55: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, __webpackRequire__) => { /* @@ -477,8 +477,8 @@ exports.CSSBridge = CSSBridge; */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.genFACSS = exports.genFAHML = void 0; -const ASTNodeVisitor_1 = __webpack_require__(573); -const Cache_1 = __webpack_require__(862); +const ASTNodeVisitor1 = __webpack_require__(573); +const Cache1 = __webpack_require__(862); /** * @@ -487,7 +487,7 @@ const Cache_1 = __webpack_require__(862); * @return HML code */ function genFAHML(t) { - const generator = ASTNodeVisitor_1.ASTNodeGenerator.getMethodGen(new Cache_1.Cache(" ")); + const generator = ASTNodeVisitor1.ASTNodeGenerator.getMethodGen(new Cache1.Cache(" ")); t.accept(generator); return generator.cache.toString(); } @@ -500,7 +500,7 @@ exports.genFAHML = genFAHML; * @return CSS code */ function genFACSS(t) { - const generator = ASTNodeVisitor_1.ASTNodeGenerator.getMethodGen(new Cache_1.Cache(" ")); + const generator = ASTNodeVisitor1.ASTNodeGenerator.getMethodGen(new Cache1.Cache(" ")); t.forEach((value) => { value.accept(generator); }); @@ -512,7 +512,7 @@ exports.genFACSS = genFACSS; /***/ }), /***/ 571: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unusedWebpackModule, exports) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isEvent = exports.isData = exports.isUnknown = exports.isContent = @@ -673,7 +673,7 @@ exports.isEvent = isEvent; /***/ }), /***/ 334: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unusedWebpackModule, exports) => { /** @@ -717,7 +717,7 @@ var TokenClass; /***/ }), /***/ 234: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unusedWebpackModule, exports) => { /** @@ -784,8 +784,8 @@ exports.formManager = void 0; /* * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const Instance_1 = __webpack_require__(891); -const FormModel_1 = __webpack_require__(945); +const Instance1 = __webpack_require__(891); +const FormModel1 = __webpack_require__(945); exports.formManager = { /** @@ -838,7 +838,7 @@ exports.formManager = { Object.keys(params).forEach(key => { paramMap.set(key, params[key]); }); - this.getFormModel().actions.set(actionName, new FormModel_1.FormAction(actionType, paramMap, abilityName)); + this.getFormModel().actions.set(actionName, new FormModel1.FormAction(actionType, paramMap, abilityName)); }, /** @@ -873,7 +873,7 @@ exports.formManager = { addActionParams(actionName, params) { var _a, _b; const action = (_a = this.getFormModel().actions.get(actionName)) !== null && _a !== - void 0 ? _a : new FormModel_1.FormAction(actionName); + void 0 ? _a : new FormModel1.FormAction(actionName); const actionParams = (_b = action.params) !== null && _b !== void 0 ? _b : new Map(); Object.keys(params).forEach(key => { actionParams.set(key, params[key]); @@ -899,7 +899,7 @@ exports.formManager = { * get the whole node */ getFormModel() { - return Instance_1.getInstance().formData; + return Instance1.getInstance().formData; }, /** @@ -924,8 +924,8 @@ exports.formManager = { * clear all datas and actions in model */ clear() { - Instance_1.getInstance().formData.data.clear(); - Instance_1.getInstance().formData.actions.clear();; + Instance1.getInstance().formData.data.clear(); + Instance1.getInstance().formData.actions.clear();; }, /** @@ -1016,14 +1016,14 @@ exports.addPhysicalModel = exports.getPhysicalModel = exports.setInstance = expo * * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const PhysicalModel_1 = __webpack_require__(234); -const VisualModel_1 = __webpack_require__(933); -const FormModel_1 = __webpack_require__(945); +const PhysicalModel1 = __webpack_require__(234); +const VisualModel1 = __webpack_require__(933); +const FormModel1 = __webpack_require__(945); const instance = { document: { VisualVersion: "12", type: "FA" }, - VisualModel: new VisualModel_1.VisualModel({ type: "div", id: "wrapper" }), + VisualModel: new VisualModel1.VisualModel({ type: "div", id: "wrapper" }), HarmonyConnectDevice: new PhysicalModel_1.Device(), - formData: new FormModel_1.FormModel(), + formData: new FormModel1.FormModel(), }; /** @@ -1088,7 +1088,7 @@ exports.addPhysicalModel = addPhysicalModel; /***/ }), /***/ 977: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, __webpackRequire__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); @@ -1098,8 +1098,8 @@ exports.deserialize = exports.serialize = void 0; * * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ -const VisualModel_1 =__webpack_require__(933); -const Instance_1 = __webpack_require__(891); +const VisualModel1 =__webpack_require__(933); +const Instance1 = __webpack_require__(891); /** * @@ -1107,7 +1107,7 @@ const Instance_1 = __webpack_require__(891); * @return model in json format */ function serialize() { - return JSON.stringify(Instance_1.getInstance(), replacer); + return JSON.stringify(Instance1.getInstance(), replacer); } exports.serialize = serialize; @@ -1117,7 +1117,7 @@ exports.serialize = serialize; */ function Deserialize(json) { const ins = JSON.parse(json, reviver); - Instance_1.setInstance(ins); + Instance1.setInstance(ins); } exports.Deserialize = Deserialize; @@ -1191,7 +1191,7 @@ function reviver(key, value) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.VisualModel = void 0; -const CombinedModel_1 = __webpack_require__(964); +const CombinedModel1 = __webpack_require__(964); // sometimes the type of VisualModel would be add a suffix to distinguish origin component of GrapesJs // e.g. button-visual const typeSuffix = "-visual"; @@ -1215,7 +1215,7 @@ class VisualModel { id: "", type: "", selfType: obj.combinedSelfType === - undefined ? CombinedModel_1.CombinedSelfType.None : obj.combinedSelfType, + undefined ? CombinedModel1.CombinedSelfType.None : obj.combinedSelfType, data: obj.data, event: obj.event, }; @@ -1250,7 +1250,7 @@ exports.VisualModel = VisualModel; /******/ }; /******/ /******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ webpackModules[moduleId](module, module.exports, webpackRequire); /******/ /******/ // Return the exports of the module /******/ return module.exports; @@ -1293,8 +1293,8 @@ function genHmlAndCss(source) { }; try { // parse source code in visual file - Serialization_1.deserialize(source); - const destVisualVersion = Instance_1.getInstance().document.VisualVersion; + Serialization1.deserialize(source); + const destVisualVersion = Instance1.getInstance().document.VisualVersion; const regex = /^([1-9]+[0-9]*)$/; if (destVisualVersion === undefined) { retObj.errorType = "versionError"; @@ -1306,14 +1306,14 @@ function genHmlAndCss(source) { } } try { - const model = Instance_1.getInstance().visualModel; + const model = Instance1.getInstance().visualModel; const hmlCss = emitFA(model); if (hmlCss.hml === "error" || hmlCss.css === "error") { retObj.errorType = "codegenError"; } retObj.hmlCss = hmlCss; - if (Instance_1.getInstance().document.type === "FORM") { - retObj.hmlCss.json = FormManager_1.formManager.codegenToJson(); + if (Instance1.getInstance().document.type === "FORM") { + retObj.hmlCss.json = FormManager1.formManager.codegenToJson(); } } catch (e) { @@ -1324,7 +1324,7 @@ function genHmlAndCss(source) { retObj.errorType = "fileError"; } if (retObj.errorType !== "") { - retObj.errorMessage = errorMap_1.errorMap.get(retObj.errorType); + retObj.errorMessage = errorMap1.errorMap.get(retObj.errorType); retObj.hmlCss.hml = ""; retObj.hmlCss.css = ""; } @@ -1342,9 +1342,9 @@ function emitFA(rootModel) { json: "", }; // generate hml - const hmlVisitor = new BridgeVisitor_1.HMLBridge(); + const hmlVisitor = new BridgeVisitor1.HMLBridge(); const ast = rootModel.accept(hmlVisitor); - const hmlRes = HmlCssCodeGenerator_1.genFAHML(ast); + const hmlRes = HmlCssCodeGenerator1.genFAHML(ast); if (hmlVisitor.getErrorCount() > 0) { hmlCss.hml = "error"; } @@ -1352,9 +1352,9 @@ function emitFA(rootModel) { hmlCss.hml = hmlRes; } // generate css - const cssVisitor = new BridgeVisitor_1.CSSBridge(); + const cssVisitor = new BridgeVisitor1.CSSBridge(); const styles = rootModel.accept(cssVisitor); - const cssRes = HmlCssCodeGenerator_1.genFACSS(styles); + const cssRes = HmlCssCodeGenerator1.genFACSS(styles); if (cssVisitor.getErrorCount() > 0) { hmlCss.css = "error"; } -- Gitee From 89269107d2c879cdc12760aa3b9a40a94ddb3cbb Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Wed, 24 Nov 2021 16:14:24 +0800 Subject: [PATCH 10/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index d4078ba..1cd3202 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -957,7 +957,7 @@ exports.formManager = { /***/ }), /***/ 945: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unusedWebpackModule, exports) => { /* @@ -1006,7 +1006,7 @@ exports.isBindingEvent = isBindingEvent; /***/ }), /***/ 891: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, __webpackRequire__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); -- Gitee From ae2cb1c3179e1febc6479f8b71ca9c5223e3bb91 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Thu, 25 Nov 2021 08:49:15 +0800 Subject: [PATCH 11/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 1cd3202..71de406 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -284,7 +284,8 @@ class ASTNodeGenerator { for (const char of value) { valueBK += (char === "\"" ? """ : (char === "\n" ? " " : char)); } - this.cache.concat(Token1.TokenClass.SPACE, key, Token1.TokenClass.ASSIGN, Token1.TokenClass.LQUOTE, valueBK, Token1.TokenClass.RQUOTE); + this.cache.concat(Token1.TokenClass.SPACE, key, Token1.TokenClass.ASSIGN, + Token1.TokenClass.LQUOTE, valueBK, Token1.TokenClass.RQUOTE); }); if (t.content === null) { this.cache.concat(Token1.TokenClass.EMPTY_TAG_END); @@ -329,7 +330,8 @@ class ASTNodeGenerator { this.cache.indentOn(); this.cache.incIndent(); s.content.forEach((value, key) => { - this.cache.concat(key, Token1.TokenClass.COLON, Token1.TokenClass.SPACE, value, Token1.TokenClass.SEMICOLON, Token1.TokenClass.NEW_LINE); + this.cache.concat(key, Token1.TokenClass.COLON, Token1.TokenClass.SPACE, value, + Token1.TokenClass.SEMICOLON, Token1.TokenClass.NEW_LINE); }); this.cache.decIndent(); this.cache.concat(Token1.TokenClass.RBRA, Token1.TokenClass.NEW_LINE, Token1.TokenClass.NEW_LINE); @@ -417,7 +419,6 @@ class CSSBridge { * @param msg is error message to show up in console */ error(msg) { - // console.error("Code generating error: " + msg); this.errors += 1; } @@ -937,7 +938,8 @@ exports.formManager = { if (sourceMap === undefined) { return {}; } - return Array.from(sourceMap.entries()).reduce((main, [key, value]) => (Object.assign(Object.assign({}, main), { [key]: value })), {}); + return Array.from(sourceMap.entries()).reduce((main, [key, value]) => + (Object.assign(Object.assign({}, main), { [key]: value })), {}); }, /** -- Gitee From 09fc1a653bfa54536b361a42d648a332dcb3fa31 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Thu, 25 Nov 2021 09:01:01 +0800 Subject: [PATCH 12/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 71de406..8690d1e 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -344,7 +344,7 @@ ASTNodeGenerator.instance = undefined; /***/ }), /***/ 844: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, __webpackRequire__) => { @@ -527,7 +527,8 @@ const BackgroundStyle = ["background-color", ...BackgroundImageStyle]; const PositionStyle = ["position", "display", "top", "right", "bottom", "left"]; const PaddingStyle = ["padding", "padding-start", "padding-end", "padding-top", "padding-right", "padding-bottom", "padding-left"]; -const MarginStyle = ["margin", "margin-start", "margin-end", "margin-top", "margin-right", "margin-bottom", "margin-left"]; +const MarginStyle = ["margin", "margin-start", "margin-end", "margin-top", "margin-right", + "margin-bottom", "margin-left"]; const BorderStyle = ["border-width", "border-style", "border-color", "border-radius", "border-top-width", "border-top-style", "border-top-color", "border-top-left-radius", "border-right-width", "border-right-style", "border-right-color", "border-top-right-radius", "border-bottom-width", "border-bottom-style", @@ -777,7 +778,7 @@ exports.Enum = Enum; /***/ }), /***/ 207: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/***/ ((__unusedWebpackModule, exports, __webpackRequire__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); @@ -851,7 +852,7 @@ exports.formManager = { this.getFormModel().actions.clear(); map.forEach((value, key) => { const params = this.objectToMap(value.params); - const action = new FormModel_1.FormAction(value.ActionType, params, value.AbilityName); + const action = new FormModel1.FormAction(value.ActionType, params, value.AbilityName); this.getFormModel().actions.set(key, action); }); }, @@ -987,7 +988,7 @@ exports.FormAction = FormAction; /***/ }), /***/ 964: -/***/ ((__unused_WebpackModule, exports) => { +/***/ ((__unusedWebpackModule, exports) => { Object.defineProperty(exports, "__esModule", ({ value: true })); @@ -1240,7 +1241,7 @@ exports.VisualModel = VisualModel; /******/ // The require function /******/ function __WebpackRequire__(ModuleId) { /******/ // Check if module is in cache -/******/ var CachedModule = __Webpack_ModuleCache__[ModuleId]; +/******/ var CachedModule = __WebpackModuleCache__[ModuleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } @@ -1269,7 +1270,7 @@ var exports = __WebpackExports__; * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ Object.defineProperty(exports, "__esModule", ({ value: true })); -const ErrorMap_1 = __WebpackRequire__(784); +const ErrorMap1 = __WebpackRequire__(784); const Instance1 = __WebpackRequire__(891); const Serialization1 = __WebpackRequire__(977); const BridgeVisitor1 = __WebpackRequire__(844); -- Gitee From bff7c083f2b1fc8457a899b910b2d6c0cba3d517 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Thu, 25 Nov 2021 09:11:56 +0800 Subject: [PATCH 13/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 8690d1e..43de31d 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -1241,7 +1241,7 @@ exports.VisualModel = VisualModel; /******/ // The require function /******/ function __WebpackRequire__(ModuleId) { /******/ // Check if module is in cache -/******/ var CachedModule = __WebpackModuleCache__[ModuleId]; +/******/ var CachedModule = __WebpackModuleCache[ModuleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } -- Gitee From 3ce2b374b54b753fb12dfcd6d22ff456f045f312 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Thu, 25 Nov 2021 09:33:12 +0800 Subject: [PATCH 14/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 43de31d..6a8d47c 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -783,6 +783,7 @@ exports.Enum = Enum; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.formManager = void 0; + /* * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ @@ -909,7 +910,7 @@ exports.formManager = { * codegen formModel to json */ CodegenToJson: function () { - const model = Instance_1.getInstance().formData; + const model = Instance1.getInstance().formData; const data = this.mapToObject(model.data); const actions = this.mapToObject(model.actions); const retObj = { actions: {}, data: {} }; @@ -1176,7 +1177,7 @@ function reviver(key, value) { return new Set(value.value); } else if (value.dataType === "VisualModel") { - const res = new VisualModel_1.VisualModel({ type: "" }); + const res = new VisualModel1.VisualModel({ type: "" }); Object.assign(res, value.value); value = res; } -- Gitee From 9615ca68acaded2371d2eb56b78414f862582a09 Mon Sep 17 00:00:00 2001 From: songbeibei <3409533354@qq.com> Date: Thu, 25 Nov 2021 09:40:19 +0800 Subject: [PATCH 15/15] 3409533354@qq.com Signed-off-by: songbeibei <3409533354@qq.com> --- ace-loader/plugin/codegen/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ace-loader/plugin/codegen/index.js b/ace-loader/plugin/codegen/index.js index 6a8d47c..fc95cbd 100644 --- a/ace-loader/plugin/codegen/index.js +++ b/ace-loader/plugin/codegen/index.js @@ -1026,7 +1026,7 @@ const FormModel1 = __webpack_require__(945); const instance = { document: { VisualVersion: "12", type: "FA" }, VisualModel: new VisualModel1.VisualModel({ type: "div", id: "wrapper" }), - HarmonyConnectDevice: new PhysicalModel_1.Device(), + HarmonyConnectDevice: new PhysicalModel1.Device(), formData: new FormModel1.FormModel(), }; -- Gitee