@zeppos/zeus-cli 1.6.4 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/bin/main.js +12 -1
  2. package/modules/create.js +3 -0
  3. package/modules/version.js +5 -1
  4. package/package.json +2 -2
  5. package/private-modules/zeppos-app-utils/dist/modules/create/index.js +3 -2
  6. package/private-modules/zeppos-app-utils/dist/modules/fetchDevices.js +44 -35
  7. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/_package.json +17 -0
  8. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/app.js +27 -0
  9. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/app.json +52 -0
  10. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/consume.png +0 -0
  11. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/beer.png +0 -0
  12. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/cake.png +0 -0
  13. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/chocolate.png +0 -0
  14. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/coffee.png +0 -0
  15. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/cookies.png +0 -0
  16. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/ham.png +0 -0
  17. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/hamburger.png +0 -0
  18. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/ice cream.png +0 -0
  19. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/pizza.png +0 -0
  20. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/sausage.png +0 -0
  21. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/icon.png +0 -0
  22. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/multiply.png +0 -0
  23. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/selected.png +0 -0
  24. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/unselected.png +0 -0
  25. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/consume.png +0 -0
  26. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/beer.png +0 -0
  27. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/cake.png +0 -0
  28. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/chocolate.png +0 -0
  29. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/coffee.png +0 -0
  30. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/cookies.png +0 -0
  31. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/ham.png +0 -0
  32. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/hamburger.png +0 -0
  33. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/ice cream.png +0 -0
  34. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/pizza.png +0 -0
  35. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/sausage.png +0 -0
  36. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/icon.png +0 -0
  37. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/multiply.png +0 -0
  38. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/selected.png +0 -0
  39. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/unselected.png +0 -0
  40. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/global.d.ts +1 -0
  41. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/jsconfig.json +9 -0
  42. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.js +107 -0
  43. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.r.layout.js +48 -0
  44. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.s.layout.js +33 -0
  45. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.js +127 -0
  46. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.r.layout.js +110 -0
  47. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.s.layout.js +98 -0
  48. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/i18n/en-US.po +42 -0
  49. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/i18n/zh-CN.po +42 -0
  50. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/utils/constants.js +62 -0
  51. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/utils/storage.js +40 -0
  52. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/_package.json +14 -0
  53. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app-side/i18n/en-US.po +2 -0
  54. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app-side/index.js +13 -0
  55. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app.js +10 -0
  56. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app.json +60 -0
  57. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.b/icon.png +0 -0
  58. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.r/icon.png +0 -0
  59. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.s/icon.png +0 -0
  60. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/global.d.ts +1 -0
  61. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/jsconfig.json +9 -0
  62. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/i18n/en-US.po +2 -0
  63. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.b.layout.js +6 -0
  64. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.js +7 -0
  65. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.r.layout.js +6 -0
  66. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.s.layout.js +6 -0
  67. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/setting/i18n/en-US.po +2 -0
  68. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/setting/index.js +7 -0
  69. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/_package.json +17 -0
  70. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app-side/i18n/en-US.po +2 -0
  71. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app-side/index.js +56 -0
  72. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app.js +14 -0
  73. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app.json +51 -0
  74. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/assets/common.r/icon.png +0 -0
  75. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/assets/common.s/icon.png +0 -0
  76. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/global.d.ts +1 -0
  77. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/jsconfig.json +9 -0
  78. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/i18n/en-US.po +2 -0
  79. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.js +45 -0
  80. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.r.layout.js +32 -0
  81. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.s.layout.js +32 -0
  82. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/utils/config/constants.js +2 -0
  83. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/utils/config/device.js +2 -0
  84. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/_package.json +17 -0
  85. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/app.js +10 -0
  86. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/app.json +51 -0
  87. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.r/icon.png +0 -0
  88. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.r/image/logo.png +0 -0
  89. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.s/icon.png +0 -0
  90. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.s/image/logo.png +0 -0
  91. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/global.d.ts +1 -0
  92. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/jsconfig.json +9 -0
  93. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.js +17 -0
  94. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.r.layout.js +19 -0
  95. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.s.layout.js +19 -0
  96. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/i18n/en-US.po +2 -0
  97. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/i18n/zh-CN.po +2 -0
  98. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/utils/index.js +3 -0
  99. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/_package.json +17 -0
  100. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/app.js +16 -0
  101. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/app.json +71 -0
  102. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.b/icon.png +0 -0
  103. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.r/icon.png +0 -0
  104. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.r/images/icons/ic_moon.png +0 -0
  105. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.s/icon.png +0 -0
  106. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/global.d.ts +1 -0
  107. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/jsconfig.json +9 -0
  108. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_01/index.js +205 -0
  109. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_01/index.r.layout.js +106 -0
  110. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_02/index.js +88 -0
  111. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_02/index.r.layout.js +74 -0
  112. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_03/index.js +98 -0
  113. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_03/index.r.layout.js +80 -0
  114. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/i18n/en-US.po +2 -0
  115. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/index.js +53 -0
  116. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/index.r.layout.js +75 -0
  117. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/.prettierrc.js +6 -0
  118. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/_package.json +17 -0
  119. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app-side/index.js +47 -0
  120. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app.js +17 -0
  121. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app.json +55 -0
  122. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/add.png +0 -0
  123. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/delete.png +0 -0
  124. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/icon.png +0 -0
  125. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/add.png +0 -0
  126. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/delete.png +0 -0
  127. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/icon.png +0 -0
  128. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/global.d.ts +1 -0
  129. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/jsconfig.json +9 -0
  130. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.js +177 -0
  131. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.r.layout.js +112 -0
  132. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.s.layout.js +112 -0
  133. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/i18n/en-US.po +21 -0
  134. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/setting/i18n/en-US.po +5 -0
  135. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/setting/index.js +143 -0
  136. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/constants.js +3 -0
  137. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/fs.js +34 -0
  138. package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/index.js +38 -0
  139. package/private-modules/zeppos-app-utils/package.json +1 -1
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "fetch",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "app.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "devDependencies": {
12
+ "@zeppos/device-types": "^3.0.0"
13
+ },
14
+ "dependencies": {
15
+ "@zeppos/zml": "^0.0.38"
16
+ }
17
+ }
@@ -0,0 +1,2 @@
1
+ msgid "example"
2
+ msgstr "This is an example in app-side"
@@ -0,0 +1,56 @@
1
+ import { BaseSideService } from "@zeppos/zml/base-side";
2
+
3
+ async function fetchData(res) {
4
+ try {
5
+ // Requesting network data using the fetch API
6
+ // The sample program is for simulation only and does not request real network data, so it is commented here
7
+ // Example of a GET method request
8
+ // const { body: { data = {} } = {} } = await fetch({
9
+ // url: 'https://xxx.com/api/xxx',
10
+ // method: 'GET'
11
+ // })
12
+ // Example of a POST method request
13
+ // const { body: { data = {} } = {} } = await fetch({
14
+ // url: 'https://xxx.com/api/xxx',
15
+ // method: 'POST',
16
+ // headers: {
17
+ // 'Content-Type': 'application/json'
18
+ // },
19
+ // body: JSON.stringify({
20
+ // text: 'Hello Zepp OS'
21
+ // })
22
+ // })
23
+
24
+ // A network request is simulated here, Reference documentation: https://jsonplaceholder.typicode.com/
25
+ const response = await fetch({
26
+ url: 'https://jsonplaceholder.typicode.com/todos/1',
27
+ method: 'GET'
28
+ })
29
+ const resBody = typeof response.body === 'string' ? JSON.parse(response.body) : response.body
30
+
31
+ res(null, {
32
+ result: resBody,
33
+ });
34
+ } catch (error) {
35
+ res(null, {
36
+ result: "ERROR",
37
+ });
38
+ }
39
+ };
40
+
41
+ AppSideService(
42
+ BaseSideService({
43
+ onInit() {},
44
+
45
+ onRequest(req, res) {
46
+ console.log("=====>,", req.method);
47
+ if (req.method === "GET_DATA") {
48
+ fetchData(res);
49
+ }
50
+ },
51
+
52
+ onRun() {},
53
+
54
+ onDestroy() {},
55
+ })
56
+ );
@@ -0,0 +1,14 @@
1
+ import { BaseApp } from "@zeppos/zml/base-app";
2
+
3
+ App(
4
+ BaseApp({
5
+ globalData: {},
6
+ onCreate(options) {
7
+ console.log("app on create invoke");
8
+ },
9
+
10
+ onDestroy(options) {
11
+ console.log("app on destroy invoke");
12
+ },
13
+ })
14
+ );
@@ -0,0 +1,51 @@
1
+ {
2
+ "configVersion": "v3",
3
+ "app": {
4
+ "appId": 20001,
5
+ "appName": "Fetch API",
6
+ "appType": "app",
7
+ "version": {
8
+ "code": 1,
9
+ "name": "1.0.1"
10
+ },
11
+ "icon": "icon.png",
12
+ "vender": "zepp",
13
+ "description": "A sample application to demonstrate the fetch API"
14
+ },
15
+ "permissions": ["data:os.device.info", "device:os.local_storage"],
16
+ "runtime": {
17
+ "apiVersion": {
18
+ "compatible": "4.0",
19
+ "target": "4.0",
20
+ "minVersion": "4.0"
21
+ }
22
+ },
23
+ "targets": {
24
+ "common": {
25
+ "module": {
26
+ "page": {
27
+ "pages": ["page/index"]
28
+ },
29
+ "app-side": {
30
+ "path": "app-side/index"
31
+ }
32
+ },
33
+ "platforms": [
34
+ {
35
+ "st": "r",
36
+ "dw": 480
37
+ },
38
+ {
39
+ "st": "s",
40
+ "dw": 390
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ "i18n": {
46
+ "en-US": {
47
+ "appName": "Fetch API"
48
+ }
49
+ },
50
+ "defaultLanguage": "en-US"
51
+ }
@@ -0,0 +1 @@
1
+ /// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "target": "es6",
5
+ "checkJs": true
6
+ },
7
+ "exclude": ["node_modules", "**/node_modules/*"],
8
+ "files": ["node_modules/@zeppos/device-types/dist/index.d.ts"]
9
+ }
@@ -0,0 +1,2 @@
1
+ msgid "example"
2
+ msgstr "This is an example in device"
@@ -0,0 +1,45 @@
1
+ import * as hmUI from "@zos/ui";
2
+ import { log as Logger } from "@zos/utils";
3
+ import { BasePage } from "@zeppos/zml/base-page";
4
+ import {
5
+ FETCH_BUTTON,
6
+ FETCH_RESULT_TEXT,
7
+ } from "zosLoader:./index.[pf].layout.js";
8
+
9
+ const logger = Logger.getLogger("fetch_api");
10
+
11
+ let textWidget;
12
+ Page(
13
+ BasePage({
14
+ state: {},
15
+ build() {
16
+ hmUI.createWidget(hmUI.widget.BUTTON, {
17
+ ...FETCH_BUTTON,
18
+ click_func: (button_widget) => {
19
+ logger.log("click button");
20
+ this.fetchData();
21
+ },
22
+ });
23
+ },
24
+ fetchData() {
25
+ this.request({
26
+ method: "GET_DATA",
27
+ })
28
+ .then((data) => {
29
+ logger.log("receive data");
30
+ const { result = {} } = data;
31
+ const text = JSON.stringify(result);
32
+
33
+ if (!textWidget) {
34
+ textWidget = hmUI.createWidget(hmUI.widget.TEXT, {
35
+ ...FETCH_RESULT_TEXT,
36
+ text,
37
+ });
38
+ } else {
39
+ textWidget.setProperty(hmUI.prop.TEXT, text);
40
+ }
41
+ })
42
+ .catch((res) => {});
43
+ },
44
+ })
45
+ );
@@ -0,0 +1,32 @@
1
+ import * as hmUI from "@zos/ui";
2
+ import { px } from "@zos/utils";
3
+
4
+ import {
5
+ DEFAULT_COLOR,
6
+ DEFAULT_COLOR_TRANSPARENT,
7
+ } from "../utils/config/constants";
8
+ import { DEVICE_WIDTH } from "../utils/config/device";
9
+
10
+ export const FETCH_BUTTON = {
11
+ x: (DEVICE_WIDTH - px(360)) / 2,
12
+ y: px(300),
13
+ w: px(360),
14
+ h: px(80),
15
+ text_size: px(36),
16
+ radius: px(12),
17
+ normal_color: DEFAULT_COLOR,
18
+ press_color: DEFAULT_COLOR_TRANSPARENT,
19
+ text: "Fetch Data",
20
+ };
21
+
22
+ export const FETCH_RESULT_TEXT = {
23
+ x: px(56),
24
+ y: px(74),
25
+ w: DEVICE_WIDTH - 2 * px(56),
26
+ h: px(200),
27
+ color: 0xffffff,
28
+ text_size: px(36),
29
+ align_h: hmUI.align.CENTER_H,
30
+ align_v: hmUI.align.CENTER_V,
31
+ text_style: hmUI.text_style.WRAP,
32
+ };
@@ -0,0 +1,32 @@
1
+ import * as hmUI from "@zos/ui";
2
+ import { px } from "@zos/utils";
3
+
4
+ import {
5
+ DEFAULT_COLOR,
6
+ DEFAULT_COLOR_TRANSPARENT,
7
+ } from "../utils/config/constants";
8
+ import { DEVICE_WIDTH } from "../utils/config/device";
9
+
10
+ export const FETCH_BUTTON = {
11
+ x: (DEVICE_WIDTH - px(340)) / 2,
12
+ y: px(280),
13
+ w: px(340),
14
+ h: px(80),
15
+ text_size: px(36),
16
+ radius: px(12),
17
+ normal_color: DEFAULT_COLOR,
18
+ press_color: DEFAULT_COLOR_TRANSPARENT,
19
+ text: "Fetch Data",
20
+ };
21
+
22
+ export const FETCH_RESULT_TEXT = {
23
+ x: px(50),
24
+ y: px(100),
25
+ w: DEVICE_WIDTH - 2 * px(50),
26
+ h: px(160),
27
+ color: 0xffffff,
28
+ text_size: px(36),
29
+ align_h: hmUI.align.CENTER_H,
30
+ align_v: hmUI.align.CENTER_V,
31
+ text_style: hmUI.text_style.WRAP,
32
+ };
@@ -0,0 +1,2 @@
1
+ export const DEFAULT_COLOR = 0xfc6950;
2
+ export const DEFAULT_COLOR_TRANSPARENT = 0xfeb4a8;
@@ -0,0 +1,2 @@
1
+ import { getDeviceInfo } from "@zos/device";
2
+ export const { width: DEVICE_WIDTH, height: DEVICE_HEIGHT } = getDeviceInfo();
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "helloworld",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "app.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "devDependencies": {
12
+ "@zeppos/device-types": "^3.0.0"
13
+ },
14
+ "dependencies": {
15
+ "@zeppos/zml": "^0.0.38"
16
+ }
17
+ }
@@ -0,0 +1,10 @@
1
+ App({
2
+ globalData: {},
3
+ onCreate(options) {
4
+ console.log("app on create invoke");
5
+ },
6
+
7
+ onDestroy(options) {
8
+ console.log("app on destroy invoke");
9
+ },
10
+ });
@@ -0,0 +1,51 @@
1
+ {
2
+ "configVersion": "v3",
3
+ "app": {
4
+ "appId": 20001,
5
+ "appName": "Hello World",
6
+ "appType": "app",
7
+ "version": {
8
+ "code": 1,
9
+ "name": "1.0.1"
10
+ },
11
+ "icon": "icon.png",
12
+ "vender": "zepp",
13
+ "description": "hello world app"
14
+ },
15
+ "permissions": ["data:os.device.info", "device:os.local_storage"],
16
+ "runtime": {
17
+ "apiVersion": {
18
+ "compatible": "4.0",
19
+ "target": "4.0",
20
+ "minVersion": "4.0"
21
+ }
22
+ },
23
+ "debug": false,
24
+ "targets": {
25
+ "gt": {
26
+ "module": {
27
+ "page": {
28
+ "pages": ["page/gt/home/index.page"]
29
+ }
30
+ },
31
+ "platforms": [
32
+ {
33
+ "st": "r"
34
+ },
35
+ {
36
+ "st": "s"
37
+ }
38
+ ],
39
+ "designWidth": 480
40
+ }
41
+ },
42
+ "i18n": {
43
+ "en-US": {
44
+ "appName": "Hello World"
45
+ },
46
+ "zh-CN": {
47
+ "appName": "你好世界"
48
+ }
49
+ },
50
+ "defaultLanguage": "en-US"
51
+ }
@@ -0,0 +1 @@
1
+ /// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "target": "es6",
5
+ "checkJs": true
6
+ },
7
+ "exclude": ["node_modules", "**/node_modules/*"],
8
+ "files": ["node_modules/@zeppos/device-types/dist/index.d.ts"]
9
+ }
@@ -0,0 +1,17 @@
1
+ import * as hmUI from "@zos/ui";
2
+ import { log as Logger } from "@zos/utils";
3
+ import { TEXT_STYLE } from "zosLoader:./index.page.[pf].layout.js";
4
+
5
+ const logger = Logger.getLogger("helloworld");
6
+ Page({
7
+ onInit() {
8
+ logger.debug("page onInit invoked");
9
+ },
10
+ build() {
11
+ logger.debug("page build invoked");
12
+ hmUI.createWidget(hmUI.widget.TEXT, TEXT_STYLE);
13
+ },
14
+ onDestroy() {
15
+ logger.debug("page onDestroy invoked");
16
+ },
17
+ });
@@ -0,0 +1,19 @@
1
+ import * as hmUI from "@zos/ui";
2
+ import { getText } from "@zos/i18n";
3
+ import { getDeviceInfo } from "@zos/device";
4
+ import { px } from "@zos/utils";
5
+
6
+ export const { width: DEVICE_WIDTH, height: DEVICE_HEIGHT } = getDeviceInfo();
7
+
8
+ export const TEXT_STYLE = {
9
+ text: getText("appName"),
10
+ x: px(42),
11
+ y: px(200),
12
+ w: DEVICE_WIDTH - px(42) * 2,
13
+ h: px(100),
14
+ color: 0xffffff,
15
+ text_size: px(36),
16
+ align_h: hmUI.align.CENTER_H,
17
+ align_v: hmUI.align.CENTER_V,
18
+ text_style: hmUI.text_style.WRAP,
19
+ };
@@ -0,0 +1,19 @@
1
+ import * as hmUI from "@zos/ui";
2
+ import { getText } from "@zos/i18n";
3
+ import { getDeviceInfo } from "@zos/device";
4
+ import { px } from "@zos/utils";
5
+
6
+ export const { width: DEVICE_WIDTH, height: DEVICE_HEIGHT } = getDeviceInfo();
7
+
8
+ export const TEXT_STYLE = {
9
+ text: getText("appName"),
10
+ x: px(42),
11
+ y: px(200),
12
+ w: DEVICE_WIDTH - px(42) * 2,
13
+ h: px(100),
14
+ color: 0xffffff,
15
+ text_size: px(36),
16
+ align_h: hmUI.align.CENTER_H,
17
+ align_v: hmUI.align.CENTER_V,
18
+ text_style: hmUI.text_style.WRAP,
19
+ };
@@ -0,0 +1,2 @@
1
+ msgid "appName"
2
+ msgstr "Hello World Zepp OS4"
@@ -0,0 +1,2 @@
1
+ msgid "appName"
2
+ msgstr "你好 Zepp OS4"
@@ -0,0 +1,3 @@
1
+ export function assets(type) {
2
+ return (path) => type + "/" + path;
3
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "4.0feature",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "app.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "devDependencies": {
12
+ "@zeppos/device-types": "^3.0.0"
13
+ },
14
+ "dependencies": {
15
+ "@zeppos/zml": "^0.0.9"
16
+ }
17
+ }
@@ -0,0 +1,16 @@
1
+ import { log } from "@zos/utils";
2
+ import { EventBus } from "@zos/utils";
3
+
4
+ const logger = log.getLogger("app");
5
+
6
+ App({
7
+ globalData: {
8
+ devEvent: new EventBus(),
9
+ },
10
+ onCreate(options) {
11
+ logger.log("app onCreate");
12
+ },
13
+ onDestroy(options) {
14
+ logger.log("app onDestroy");
15
+ },
16
+ });
@@ -0,0 +1,71 @@
1
+ {
2
+ "configVersion": "v3",
3
+ "app": {
4
+ "appId": 1000006,
5
+ "appName": "4.0 Feature",
6
+ "appType": "app",
7
+ "version": {
8
+ "code": 4,
9
+ "name": "4.0"
10
+ },
11
+ "icon": "icon.png",
12
+ "vender": "Zepp Health",
13
+ "description": "A sample application about the new features of 4.0"
14
+ },
15
+ "permissions": [
16
+ "event:os.bp.high",
17
+ "event:os.bp.low",
18
+ "event:os.bp.expires",
19
+ "device:os.notification",
20
+ "event:os.health.sleep_status",
21
+ "event:os.health.heart_rate_abnl",
22
+ "event:os.weather.sun_rise",
23
+ "event:os.weather.sun_set",
24
+ "event:os.system.power_saving",
25
+ "event:os.system.theater_mode",
26
+ "event:os.system.no_disturb",
27
+ "event:customize.test",
28
+ "data:os.device.info",
29
+ "device:os.alarm",
30
+ "device:os.accelerometer",
31
+ "device:os.geolocation",
32
+ "device:os.gyroscope",
33
+ "device:os.compass",
34
+ "data:user.hd.sleep",
35
+ "data:user.hd.heart_rate",
36
+ "data:user.hd.spo2",
37
+ "data:user.hd.stress",
38
+ "device:os.bg_service",
39
+ "data:user.hd.workout",
40
+ "device:os.ble"
41
+ ],
42
+ "runtime": {
43
+ "apiVersion": {
44
+ "compatible": "4.0",
45
+ "target": "4.0",
46
+ "minVersion": "4.0"
47
+ }
48
+ },
49
+ "targets": {
50
+ "default": {
51
+ "module": {
52
+ "page": {
53
+ "pages": [
54
+ "page/index",
55
+ "page/TC/TC_01/index",
56
+ "page/TC/TC_02/index",
57
+ "page/TC/TC_03/index"
58
+ ]
59
+ }
60
+ },
61
+ "platforms": [
62
+ {
63
+ "st": "r"
64
+ }
65
+ ],
66
+ "designWidth": 480
67
+ }
68
+ },
69
+ "debug": false,
70
+ "defaultLanguage": "en-US"
71
+ }
@@ -0,0 +1 @@
1
+ /// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
@@ -0,0 +1,9 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "target": "es6",
5
+ "checkJs": true
6
+ },
7
+ "exclude": ["node_modules", "**/node_modules/*"],
8
+ "files": ["node_modules/@zeppos/device-types/dist/index.d.ts"]
9
+ }