@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,205 @@
1
+ import * as Styles from 'zosLoader:./index.[pf].layout.js'
2
+ import { createWidget, widget, updateLayout, dumpLayout, align, prop, deleteWidget, text_style } from '@zos/ui';
3
+ import { push, exit, replace, } from '@zos/router';
4
+
5
+ var fill_rect_list = new Array(20);
6
+ let text = null
7
+ let global_number = 0;
8
+ let flex_dir = ["row", "row-reverse", "column", "column-reverse"];
9
+ let flex_wrap = ["nowrap", "wrap", "wrap-reverse"];
10
+ let justify_content = ["start", "end", "center", "space-between", "space-around", "space-evenly"];
11
+ let align_items = ["start", "end", "center"];
12
+ let align_content = ["start", "end", "center"];
13
+ let style_height = 50;
14
+ let flex_grow_number = 1;
15
+ let layout_show = null
16
+
17
+ Page({
18
+ build() {
19
+
20
+ let root_container = createWidget(widget.VIRTUAL_CONTAINER, { layout: Styles.BUTTON_ROOT_CONTAINER_STYLE });
21
+
22
+ createWidget(widget.FILL_RECT, { parent: root_container, ...Styles.BACKGROUND_FILL_STYLE });
23
+
24
+ let group_root = createWidget(widget.GROUP, {
25
+ parent: root_container,
26
+ layout: Styles.GROUP_BUTTON_ROOT_STYLE,
27
+ })
28
+
29
+ for (let i = 0; i < 4; i++) {
30
+ let btn = group_root.createWidget(widget.BUTTON, Styles.ORINGAL_BUTTON_STYLE);
31
+ btn.text = global_number.toString()
32
+ global_number += 1;
33
+ fill_rect_list.push(btn);
34
+ }
35
+
36
+ let button_container = createWidget(widget.VIRTUAL_CONTAINER, { layout: Styles.TEST_BUTTON_ROOT_CONTAINER_STYLE });
37
+
38
+ createWidget(widget.FILL_RECT, {
39
+ parent: button_container,
40
+ ...Styles.BACKGROUND_FILL_STYLE,
41
+ color: 0x00FFFF,
42
+ alpha: 255,
43
+ });
44
+
45
+ let button_sub_container = createWidget(widget.VIRTUAL_CONTAINER, {
46
+ parent: button_container,
47
+ layout: Styles.TEST_BUTTON_SUB_ROOT_CONTAINER_STYLE,
48
+ });
49
+
50
+ createWidget(widget.BUTTON, {
51
+ parent: button_sub_container,
52
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
53
+ text: "add widget",
54
+ click_func: () => {
55
+ let btn = group_root.createWidget(widget.BUTTON, Styles.BIGGER_BUTTON_STYLE);
56
+ global_number += 1;
57
+ btn.text = global_number.toString();
58
+ fill_rect_list.push(btn);
59
+ updateLayout();
60
+ },
61
+ });
62
+
63
+ createWidget(widget.BUTTON, {
64
+ parent: button_sub_container,
65
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
66
+ text: "delete widget",
67
+ click_func: () => {
68
+ let btn = fill_rect_list.pop();
69
+ global_number -= 1;
70
+ deleteWidget(btn);
71
+ updateLayout();
72
+ },
73
+ });
74
+
75
+ createWidget(widget.BUTTON, {
76
+ parent: button_sub_container,
77
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
78
+ text: "zoom view change",
79
+ click_func: () => {
80
+ style_height -= 3;
81
+ if (style_height < 30) {
82
+ style_height = 50;
83
+ }
84
+ root_container.updateLayoutStyle({ x: "0", y: "9vh", width: "100vw", height: String(style_height) + "vh" });
85
+ updateLayout(root_container);
86
+ },
87
+ });
88
+
89
+ createWidget(widget.BUTTON, {
90
+ parent: button_sub_container,
91
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
92
+ text: "change flex layout",
93
+ click_func: () => {
94
+ let random_flex_dir = flex_dir[Math.floor(Math.random() * flex_dir.length)]
95
+ let random_flex_wrap = flex_wrap[Math.floor(Math.random() * flex_wrap.length)]
96
+ let random_justify_content = justify_content[Math.floor(Math.random() * justify_content.length)]
97
+ let random_align_items = align_items[Math.floor(Math.random() * align_items.length)]
98
+ let random_align_content = align_content[Math.floor(Math.random() * align_content.length)]
99
+
100
+ let flex_layout = {
101
+ "display": "flex",
102
+ "flex-flow": random_flex_dir + " " + random_flex_wrap,
103
+ "column-gap": "20",
104
+ "row-gap": "10",
105
+ "justify-content": random_justify_content,
106
+ "align-items": random_align_items,
107
+ "width": "100%",
108
+ "height": "100%",
109
+ "align-content": random_align_content,
110
+ };
111
+ group_root.updateLayoutStyle(flex_layout);
112
+ updateLayout(group_root);
113
+ dumpLayout("layout.txt");
114
+ let text_show = "flex_layout: flex-flow:[" + random_flex_dir + " " + random_flex_wrap + "] " +
115
+ "justify-content:[" + random_justify_content + "] " +
116
+ "align-items:[" + random_align_items + "] " +
117
+ "align-content:[" + random_align_content + "] "
118
+ layout_show.setProperty(prop.TEXT, text_show);
119
+ },
120
+ });
121
+
122
+ createWidget(widget.BUTTON, {
123
+ parent: button_sub_container,
124
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
125
+ text: "new_track",
126
+ click_func: () => {
127
+ let btn = group_root.createWidget(widget.BUTTON, {
128
+ press_color: 0x1976d2,
129
+ normal_color: 0x0000FF,
130
+ text: String(global_number),
131
+ layout: {
132
+ ...Styles.BIGGER_BUTTON_POS_STYLE,
133
+ "tags": "newtrack"
134
+ },
135
+ });
136
+ global_number += 1;
137
+ fill_rect_list.push(btn);
138
+ updateLayout();
139
+ layout_show.setProperty(prop.TEXT, "tags:newtrack");
140
+ },
141
+ });
142
+
143
+ createWidget(widget.BUTTON, {
144
+ parent: button_sub_container,
145
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
146
+ text: "align button",
147
+ click_func: () => {
148
+ let btn = group_root.createWidget(widget.BUTTON, {
149
+ press_color: 0x1976d2,
150
+ normal_color: 0x0000FF,
151
+ text: String(global_number),
152
+ layout: {
153
+ ...Styles.BIGGER_BUTTON_POS_STYLE,
154
+ "tags": "ignore-layout",
155
+ "align": "right bottom",
156
+ },
157
+ });
158
+ global_number += 1;
159
+ fill_rect_list.push(btn);
160
+ updateLayout();
161
+ layout_show.setProperty(prop.TEXT, "tags:ignore-layout align:right bottom");
162
+ },
163
+ });
164
+
165
+ createWidget(widget.BUTTON, {
166
+ parent: button_sub_container,
167
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
168
+ text: "padding button",
169
+ click_func: () => {
170
+ let padding_layout = {
171
+ ...Styles.BUTTON_ROOT_CONTAINER_STYLE,
172
+ "padding": "20",
173
+ };
174
+ root_container.updateLayoutStyle(padding_layout);
175
+ updateLayout();
176
+ layout_show.setProperty(prop.TEXT, "setting padding[top,bottom,left,right] to 20");
177
+ },
178
+ });
179
+
180
+ createWidget(widget.BUTTON, {
181
+ parent: button_sub_container,
182
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
183
+ text: "flex_grow",
184
+ click_func: () => {
185
+ let btn = group_root.createWidget(widget.BUTTON, {
186
+ press_color: 0x1976d2,
187
+ normal_color: 0x0000FF,
188
+ text: String(global_number),
189
+ layout: {
190
+ ...Styles.BIGGER_BUTTON_POS_STYLE,
191
+ "flex-grow": String(flex_grow_number)
192
+ },
193
+ });
194
+ global_number += 1;
195
+ flex_grow_number += 1;
196
+ fill_rect_list.push(btn);
197
+ updateLayout();
198
+ layout_show.setProperty(prop.TEXT, "setting flex-grow value:" + String(flex_grow_number - 1));
199
+ },
200
+ });
201
+
202
+ layout_show = createWidget(widget.TEXT, Styles.TEXT_LAYOUT_INFO_STYLE);
203
+ // updateLayout(); no need call by user when screen load
204
+ }
205
+ })
@@ -0,0 +1,106 @@
1
+ import { align, text_style } from '@zos/ui';
2
+
3
+ export const TEXT_LAYOUT_INFO_STYLE = {
4
+ x: 0,
5
+ y: 60,
6
+ w: "100vw".toPixel(),
7
+ h: "120".toPixel(),
8
+ text: "flex layout information:",
9
+ color: 0x34e073,
10
+ align_h: align.CENTER_H,
11
+ align_v: align.TOP,
12
+ text_style: text_style.WRAP,
13
+ }
14
+
15
+ export const BUTTON_ROOT_CONTAINER_STYLE = {
16
+ "x": "10vw",
17
+ "y": "10vh",
18
+ "width": "80vw",
19
+ "height": "50vh"
20
+ }
21
+
22
+ export const BACKGROUND_FILL_STYLE = {
23
+ color: 0xFFFFFF,
24
+ alpha: 100,
25
+ layout: { "width": "100%", "height": "100%" },
26
+ }
27
+
28
+ export const GROUP_BUTTON_ROOT_STYLE = {
29
+ "display": "flex",
30
+ "flex-flow": "row wrap",
31
+ "column-gap": "20",
32
+ "row-gap": "10",
33
+ "justify-content": "start",
34
+ "align-items": "space-evenly",
35
+ "width": "100%",
36
+ "height": "100%",
37
+ "align-content": "center",
38
+ }
39
+
40
+ export const ORIGINAL_BUTTON_POS_STYLE = {
41
+ "width": "70",
42
+ "height": "40",
43
+ "radius": "2.5vw",
44
+ "font-size": "swdpi(25)",
45
+ }
46
+
47
+ export const ORINGAL_BUTTON_STYLE = {
48
+ press_color: 0x1976d2,
49
+ normal_color: 0x0000FF,
50
+ layout: ORIGINAL_BUTTON_POS_STYLE,
51
+ }
52
+
53
+ export const BIGGER_BUTTON_POS_STYLE = {
54
+ "width": "80",
55
+ "height": "60",
56
+ "radius": "2.6vw",
57
+ "font-size": "swdpi(25)",
58
+ }
59
+
60
+ export const BIGGER_BUTTON_STYLE = {
61
+ press_color: 0x1976d2,
62
+ normal_color: 0x0000FF,
63
+ layout: BIGGER_BUTTON_POS_STYLE,
64
+ }
65
+
66
+
67
+
68
+ export const TEST_BUTTON_ROOT_CONTAINER_STYLE = {
69
+ "x": "15vw",
70
+ "y": "60vh",
71
+ "width": "70vw",
72
+ "height": "35vh"
73
+ }
74
+
75
+ export const TEST_BUTTON_SUB_ROOT_CONTAINER_STYLE = {
76
+ "width": "100%",
77
+ "height": "100%",
78
+ "display": "flex",
79
+ "flex-flow": "row wrap",
80
+ "column-gap": "5",
81
+ "row-gap": "10",
82
+ "justify-content": "space-evenly",
83
+ "align-content": "start",
84
+ "align-items": "start",
85
+ "padding-top": "10",
86
+ }
87
+
88
+ export const TEST_BUTTON_ITEM_STYLE = {
89
+ layout: {
90
+ "width": "30%",
91
+ "height": "20%",
92
+ "radius": "2.6vw",
93
+ "font-size": "10",
94
+ },
95
+ press_src: "images/test/normalbtn_h.png",
96
+ normal_src: "images/test/normalbtn_n.png",
97
+ press_color: 0x1976d2,
98
+ normal_color: 0x0000FF,
99
+ }
100
+
101
+
102
+
103
+
104
+
105
+
106
+
@@ -0,0 +1,88 @@
1
+ import * as Styles from 'zosLoader:./index.[pf].layout.js'
2
+ import { createWidget, widget, updateLayout, dumpLayout, deleteWidget } from '@zos/ui';
3
+
4
+ var fill_rect_list = new Array(20);
5
+
6
+ Page({
7
+ build() {
8
+
9
+ let root_container = createWidget(widget.VIRTUAL_CONTAINER, { layout: Styles.FILL_RECT_ROOT_CONTAINER_STYLE });
10
+
11
+ createWidget(widget.FILL_RECT, { parent: root_container, ...Styles.BACKGROUND_FILL_STYLE });
12
+
13
+ let group_root = createWidget(widget.GROUP, {
14
+ parent: root_container,
15
+ layout: Styles.GROUP_FILL_RECT_ROOT_STYLE,
16
+ })
17
+
18
+ for (let i = 0; i < 5; i++) {
19
+ let fill_rect_widget = group_root.createWidget(widget.FILL_RECT, {
20
+ color: 0x0000FF,
21
+ layout: Styles.FILL_RECT_ITEM_STYLE,
22
+ });
23
+ fill_rect_list.push(fill_rect_widget);
24
+ }
25
+
26
+ var button_container = createWidget(widget.VIRTUAL_CONTAINER, {
27
+ layout: Styles.TEST_BUTTON_ROOT_CONTAINER_STYLE
28
+ });
29
+
30
+ createWidget(widget.FILL_RECT, {
31
+ parent: button_container,
32
+ ...Styles.BACKGROUND_FILL_STYLE,
33
+ color: 0x333333,
34
+ });
35
+
36
+ var button_sub_container = createWidget(widget.VIRTUAL_CONTAINER, {
37
+ parent: button_container,
38
+ layout: Styles.TEST_BUTTON_SUB_ROOT_CONTAINER_STYLE
39
+ });
40
+
41
+ createWidget(widget.BUTTON, {
42
+ parent: button_sub_container,
43
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
44
+ text: "add widget",
45
+ click_func: () => {
46
+ let fill_rect_widget = group_root.createWidget(widget.FILL_RECT, {
47
+ color: 0x0000FF,
48
+ layout: Styles.FILL_RECT_ITEM_STYLE,
49
+ });
50
+ fill_rect_list.push(fill_rect_widget);
51
+ updateLayout();
52
+ },
53
+ });
54
+
55
+ createWidget(widget.BUTTON, {
56
+ parent: button_sub_container,
57
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
58
+ text: "delete widget",
59
+ click_func: () => {
60
+ let fill_rect_widget = fill_rect_list.pop();
61
+ deleteWidget(fill_rect_widget);
62
+ updateLayout();
63
+ },
64
+ });
65
+
66
+ createWidget(widget.BUTTON, {
67
+ parent: button_sub_container,
68
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
69
+ text: "zoom in",
70
+ click_func: () => {
71
+ root_container.updateLayoutStyle({ "x": "0", "y": "0", "width": "100vw", "height": "50vh" });
72
+ updateLayout(root_container);
73
+ },
74
+ });
75
+
76
+ createWidget(widget.BUTTON, {
77
+ parent: button_sub_container,
78
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
79
+ text: "zoom out",
80
+ click_func: () => {
81
+ root_container.updateLayoutStyle({ "x": "20vw", "y": "10vh", "width": "60vw", "height": "25vh" });
82
+ updateLayout(root_container);
83
+ dumpLayout("layout.txt");
84
+ },
85
+ });
86
+ // updateLayout(); no need call by user when screen loadupdateLayout();
87
+ }
88
+ })
@@ -0,0 +1,74 @@
1
+ import { align, text_style } from '@zos/ui';
2
+
3
+
4
+
5
+ export const FILL_RECT_ROOT_CONTAINER_STYLE = {
6
+ "x": "10vw",
7
+ "y": "10vh",
8
+ "width": "80vw",
9
+ "height": "50vh"
10
+ }
11
+
12
+ export const BACKGROUND_FILL_STYLE = {
13
+ color: 0xFFFFFF,
14
+ layout: { "width": "100%", "height": "100%" },
15
+ }
16
+
17
+ export const GROUP_FILL_RECT_ROOT_STYLE = {
18
+ "display": "flex",
19
+ "flex-flow": "row wrap",
20
+ "column-gap": "20",
21
+ "row-gap": "10",
22
+ "justify-content": "start",
23
+ "align-items": "space-evenly",
24
+ "width": "100%",
25
+ "height": "100%",
26
+ "align-content": "center",
27
+ }
28
+
29
+ export const FILL_RECT_ITEM_STYLE = {
30
+ "width": "10%",
31
+ "height": "20%",
32
+ // "radius": "5.25vw",
33
+ "corner-radius": "10",
34
+ }
35
+
36
+ export const TEST_BUTTON_ROOT_CONTAINER_STYLE = {
37
+ "x": "15vw",
38
+ "y": "60vh",
39
+ "width": "70vw",
40
+ "height": "40vh"
41
+ }
42
+
43
+ export const TEST_BUTTON_SUB_ROOT_CONTAINER_STYLE = {
44
+ "width": "100%",
45
+ "height": "100%",
46
+ "display": "flex",
47
+ "flex-flow": "row wrap",
48
+ "column-gap": "5",
49
+ "row-gap": "10",
50
+ "justify-content": "space-evenly",
51
+ "align-content": "start",
52
+ "align-items": "start",
53
+ "padding-top": "10",
54
+ }
55
+
56
+ export const TEST_BUTTON_ITEM_STYLE = {
57
+ layout: {
58
+ "width": "35%",
59
+ "height": "20%",
60
+ "corner-radius": "3vw",
61
+ "font-size": "10",
62
+ },
63
+ press_src: "images/test/normalbtn_h.png",
64
+ normal_src: "images/test/normalbtn_n.png",
65
+ press_color: 0x1976d2,
66
+ normal_color: 0x0000FF,
67
+ }
68
+
69
+
70
+
71
+
72
+
73
+
74
+
@@ -0,0 +1,98 @@
1
+ import * as Styles from 'zosLoader:./index.[pf].layout.js'
2
+ import { createWidget, widget, updateLayout, dumpLayout, deleteWidget, align } from '@zos/ui';
3
+
4
+ var fill_rect_list = new Array(20);
5
+
6
+ Page({
7
+ build() {
8
+
9
+ let root_container = createWidget(widget.VIRTUAL_CONTAINER, { layout: Styles.FILL_RECT_ROOT_CONTAINER_STYLE });
10
+
11
+ createWidget(widget.FILL_RECT, { parent: root_container, ...Styles.BACKGROUND_FILL_STYLE });
12
+
13
+ let group_root = createWidget(widget.GROUP, {
14
+ parent: root_container,
15
+ layout: Styles.GROUP_FILL_RECT_ROOT_STYLE,
16
+ })
17
+
18
+ for (let i = 0; i < 5; i++) {
19
+ let fill_rect_widget = group_root.createWidget(widget.IMG, {
20
+ src: "images/icons/ic_moon.png",
21
+ layout: Styles.IMAGE_ITEM_STYLE,
22
+ });
23
+ fill_rect_list.push(fill_rect_widget);
24
+ }
25
+
26
+ for (let i = 0; i < 3; i++) {
27
+ let text_widget = group_root.createWidget(widget.TEXT, {
28
+ text: "hello zepp os",
29
+ color: 0x34e073,
30
+ align_v: align.CENTER_V,
31
+ layout: Styles.TEXT_ITEM_STYLE,
32
+ });
33
+ fill_rect_list.push(text_widget);
34
+ }
35
+
36
+ var button_container = createWidget(widget.VIRTUAL_CONTAINER, {
37
+ layout: Styles.TEST_BUTTON_ROOT_CONTAINER_STYLE
38
+ });
39
+
40
+ createWidget(widget.FILL_RECT, {
41
+ parent: button_container,
42
+ ...Styles.BACKGROUND_FILL_STYLE,
43
+ color: 0x333333,
44
+ });
45
+
46
+ var button_sub_container = createWidget(widget.VIRTUAL_CONTAINER, {
47
+ parent: button_container,
48
+ layout: Styles.TEST_BUTTON_SUB_ROOT_CONTAINER_STYLE
49
+ });
50
+
51
+ createWidget(widget.BUTTON, {
52
+ parent: button_sub_container,
53
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
54
+ text: "add widget",
55
+ click_func: () => {
56
+ let img_widget = group_root.createWidget(widget.IMG, {
57
+ src: "images/icons/ic_moon.png",
58
+ layout: Styles.IMAGE_ITEM_STYLE,
59
+ });
60
+ fill_rect_list.push(img_widget);
61
+ updateLayout();
62
+ },
63
+ });
64
+
65
+ createWidget(widget.BUTTON, {
66
+ parent: button_sub_container,
67
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
68
+ text: "delete widget",
69
+ click_func: () => {
70
+ let fill_rect_widget = fill_rect_list.pop();
71
+ deleteWidget(fill_rect_widget);
72
+ updateLayout();
73
+ },
74
+ });
75
+
76
+ createWidget(widget.BUTTON, {
77
+ parent: button_sub_container,
78
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
79
+ text: "zoom in",
80
+ click_func: () => {
81
+ root_container.updateLayoutStyle({ "x": "0", "y": "0", "width": "100vw", "height": "50vh" });
82
+ updateLayout(root_container);
83
+ },
84
+ });
85
+
86
+ createWidget(widget.BUTTON, {
87
+ parent: button_sub_container,
88
+ ...Styles.TEST_BUTTON_ITEM_STYLE,
89
+ text: "zoom out",
90
+ click_func: () => {
91
+ root_container.updateLayoutStyle({ "x": "20vw", "y": "10vh", "width": "60vw", "height": "25vh" });
92
+ updateLayout(root_container);
93
+ dumpLayout("layout.txt");
94
+ },
95
+ });
96
+ // updateLayout(); no need call by user when screen load updateLayout();
97
+ }
98
+ })
@@ -0,0 +1,80 @@
1
+ import { align, text_style } from '@zos/ui';
2
+
3
+
4
+
5
+ export const FILL_RECT_ROOT_CONTAINER_STYLE = {
6
+ "x": "10vw",
7
+ "y": "10vh",
8
+ "width": "80vw",
9
+ "height": "50vh"
10
+ }
11
+
12
+ export const BACKGROUND_FILL_STYLE = {
13
+ color: 0xFFFFFF,
14
+ layout: { "width": "100%", "height": "100%" },
15
+ }
16
+
17
+ export const GROUP_FILL_RECT_ROOT_STYLE = {
18
+ "display": "flex",
19
+ "flex-flow": "row wrap",
20
+ "column-gap": "20",
21
+ "row-gap": "10",
22
+ "justify-content": "start",
23
+ "align-items": "space-evenly",
24
+ "width": "100%",
25
+ "height": "100%",
26
+ "align-content": "center",
27
+ }
28
+
29
+ export const IMAGE_ITEM_STYLE = {
30
+ "width": "15%",
31
+ "height": "25%",
32
+ // "radius": "5.25vw",
33
+ // "corner-radius": "10",
34
+ }
35
+
36
+ export const TEXT_ITEM_STYLE = {
37
+ "width": "30%",
38
+ "height": "25%",
39
+ "font-size": "15",
40
+ }
41
+
42
+ export const TEST_BUTTON_ROOT_CONTAINER_STYLE = {
43
+ "x": "15vw",
44
+ "y": "60vh",
45
+ "width": "70vw",
46
+ "height": "40vh"
47
+ }
48
+
49
+ export const TEST_BUTTON_SUB_ROOT_CONTAINER_STYLE = {
50
+ "width": "100%",
51
+ "height": "100%",
52
+ "display": "flex",
53
+ "flex-flow": "row wrap",
54
+ "column-gap": "5",
55
+ "row-gap": "10",
56
+ "justify-content": "space-evenly",
57
+ "align-content": "start",
58
+ "align-items": "start",
59
+ "padding-top": "10",
60
+ }
61
+
62
+ export const TEST_BUTTON_ITEM_STYLE = {
63
+ layout: {
64
+ "width": "35%",
65
+ "height": "20%",
66
+ "corner-radius": "3vw",
67
+ "font-size": "10",
68
+ },
69
+ press_src: "images/test/normalbtn_h.png",
70
+ normal_src: "images/test/normalbtn_n.png",
71
+ press_color: 0x1976d2,
72
+ normal_color: 0x0000FF,
73
+ }
74
+
75
+
76
+
77
+
78
+
79
+
80
+
@@ -0,0 +1,2 @@
1
+ msgid "example"
2
+ msgstr "This is an example in device"