create-basicjs 0.1.0 → 0.1.2

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 (727) hide show
  1. package/README.md +1 -1
  2. package/bin/create-basicjs.js +2 -2
  3. package/bin/verify-package.js +16 -0
  4. package/package.json +4 -1
  5. package/payload/starter/AGENTS.md +84 -0
  6. package/payload/starter/CLAUDE.md +1 -0
  7. package/payload/starter/README.md +45 -0
  8. package/payload/starter/_basic/VERSION +1 -0
  9. package/payload/starter/_basic/assets/categories/cappuccino.png +0 -0
  10. package/payload/starter/_basic/assets/categories/chocolate-milk.png +0 -0
  11. package/payload/starter/_basic/assets/categories/coffee-cup.png +0 -0
  12. package/payload/starter/_basic/assets/categories/coffee.png +0 -0
  13. package/payload/starter/_basic/assets/categories/frappe.png +0 -0
  14. package/payload/starter/_basic/assets/categories/iced-caffee.png +0 -0
  15. package/payload/starter/_basic/assets/categories/milkshake.png +0 -0
  16. package/payload/starter/_basic/assets/categories/orange-juice.png +0 -0
  17. package/payload/starter/_basic/assets/categories/tea.png +0 -0
  18. package/payload/starter/_basic/assets/data-table/palette.svg +2 -0
  19. package/payload/starter/_basic/assets/data-table/people.js +104 -0
  20. package/payload/starter/_basic/assets/data-table/trash.svg +2 -0
  21. package/payload/starter/_basic/assets/fruids/brokoli.png +0 -0
  22. package/payload/starter/_basic/assets/fruids/cilek.png +0 -0
  23. package/payload/starter/_basic/assets/fruids/domates.png +0 -0
  24. package/payload/starter/_basic/assets/fruids/elma.png +0 -0
  25. package/payload/starter/_basic/assets/fruids/havuc.png +0 -0
  26. package/payload/starter/_basic/assets/fruids/karpuz.png +0 -0
  27. package/payload/starter/_basic/assets/fruids/limon.png +0 -0
  28. package/payload/starter/_basic/assets/fruids/muz.png +0 -0
  29. package/payload/starter/_basic/assets/fruids/nar.png +0 -0
  30. package/payload/starter/_basic/assets/fruids/patlican.png +0 -0
  31. package/payload/starter/_basic/assets/fruids/yabanmersini.png +0 -0
  32. package/payload/starter/_basic/assets/fruids/yesilbiber.png +0 -0
  33. package/payload/starter/_basic/assets/icons/alert-black.png +0 -0
  34. package/payload/starter/_basic/assets/icons/alert.png +0 -0
  35. package/payload/starter/_basic/assets/icons/arrow-drop.svg +3 -0
  36. package/payload/starter/_basic/assets/icons/arrow-rise.svg +3 -0
  37. package/payload/starter/_basic/assets/icons/close.svg +1 -0
  38. package/payload/starter/_basic/assets/icons/lamp-on.png +0 -0
  39. package/payload/starter/_basic/assets/icons/lamp.png +0 -0
  40. package/payload/starter/_basic/assets/icons/lock.png +0 -0
  41. package/payload/starter/_basic/assets/icons/panel.png +0 -0
  42. package/payload/starter/_basic/assets/icons/plant.png +0 -0
  43. package/payload/starter/_basic/assets/icons/trash.png +0 -0
  44. package/payload/starter/_basic/assets/icons/trash.svg +2 -0
  45. package/payload/starter/_basic/assets/tab-bar/settings.png +0 -0
  46. package/payload/starter/_basic/assets/tab-bar/status.png +0 -0
  47. package/payload/starter/_basic/assets/tab-bar/transactions.png +0 -0
  48. package/payload/starter/_basic/assets/tutorial/blueberries.png +0 -0
  49. package/payload/starter/_basic/assets/tutorial/carrot.png +0 -0
  50. package/payload/starter/_basic/assets/tutorial/olives.png +0 -0
  51. package/payload/starter/_basic/assets/tutorial/strawberry.png +0 -0
  52. package/payload/starter/_basic/assets/ui-bottom-bar/setting.svg +11 -0
  53. package/payload/starter/_basic/basic/LICENSE +14 -0
  54. package/payload/starter/_basic/basic/basic.css +277 -0
  55. package/payload/starter/_basic/basic/basic.js +3767 -0
  56. package/payload/starter/_basic/basic/basic.min.css +1 -0
  57. package/payload/starter/_basic/basic/basic.min.js +65 -0
  58. package/payload/starter/_basic/basic/font/open-sans/LICENSE.txt +206 -0
  59. package/payload/starter/_basic/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
  60. package/payload/starter/_basic/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
  61. package/payload/starter/_basic/basic/scroll-bar.js +536 -0
  62. package/payload/starter/_basic/basic/scroll-bar.min.js +2 -0
  63. package/payload/starter/_basic/comp/action-button/add.png +0 -0
  64. package/payload/starter/_basic/comp/action-button.js +522 -0
  65. package/payload/starter/_basic/comp/action-tab-bar.js +383 -0
  66. package/payload/starter/_basic/comp/app-bar.js +236 -0
  67. package/payload/starter/_basic/comp/badge-v2.js +246 -0
  68. package/payload/starter/_basic/comp/bottom-bar.js +547 -0
  69. package/payload/starter/_basic/comp/breadcrumbs.js +522 -0
  70. package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +13 -0
  71. package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +9 -0
  72. package/payload/starter/_basic/comp/chart-box.js +868 -0
  73. package/payload/starter/_basic/comp/check-box.js +374 -0
  74. package/payload/starter/_basic/comp/context-menu.js +634 -0
  75. package/payload/starter/_basic/comp/currency-input-b.js +190 -0
  76. package/payload/starter/_basic/comp/data-table/arrow.svg +2 -0
  77. package/payload/starter/_basic/comp/data-table.js +865 -0
  78. package/payload/starter/_basic/comp/dialog.js +854 -0
  79. package/payload/starter/_basic/comp/email-input-b.js +57 -0
  80. package/payload/starter/_basic/comp/filters.js +493 -0
  81. package/payload/starter/_basic/comp/form.js +590 -0
  82. package/payload/starter/_basic/comp/full-screen-select/arrow.svg +2 -0
  83. package/payload/starter/_basic/comp/full-screen-select/cancel.svg +2 -0
  84. package/payload/starter/_basic/comp/full-screen-select.js +611 -0
  85. package/payload/starter/_basic/comp/gauge.js +435 -0
  86. package/payload/starter/_basic/comp/hold-to-confirm-button/trash-red.png +0 -0
  87. package/payload/starter/_basic/comp/hold-to-confirm-button/trash.png +0 -0
  88. package/payload/starter/_basic/comp/hold-to-confirm-button.js +280 -0
  89. package/payload/starter/_basic/comp/input-b.js +759 -0
  90. package/payload/starter/_basic/comp/item-list.js +1396 -0
  91. package/payload/starter/_basic/comp/label-editor.js +1137 -0
  92. package/payload/starter/_basic/comp/left-menu/_Material Symbols & Icons - Google Fonts.webloc +8 -0
  93. package/payload/starter/_basic/comp/left-menu/data-table.png +0 -0
  94. package/payload/starter/_basic/comp/left-menu/home.png +0 -0
  95. package/payload/starter/_basic/comp/left-menu/reports.png +0 -0
  96. package/payload/starter/_basic/comp/left-menu/setting.png +0 -0
  97. package/payload/starter/_basic/comp/left-menu.js +476 -0
  98. package/payload/starter/_basic/comp/line-progress-bar.js +192 -0
  99. package/payload/starter/_basic/comp/loading-screen.js +382 -0
  100. package/payload/starter/_basic/comp/login-page-v2.js +586 -0
  101. package/payload/starter/_basic/comp/mini-graph-box.js +483 -0
  102. package/payload/starter/_basic/comp/notice.js +227 -0
  103. package/payload/starter/_basic/comp/number-input-b.js +121 -0
  104. package/payload/starter/_basic/comp/numeric-keyboard.js +296 -0
  105. package/payload/starter/_basic/comp/page-control.js +745 -0
  106. package/payload/starter/_basic/comp/page-header.js +190 -0
  107. package/payload/starter/_basic/comp/password-input-b/hide-btn.png +0 -0
  108. package/payload/starter/_basic/comp/password-input-b/hide-btn2.png +0 -0
  109. package/payload/starter/_basic/comp/password-input-b/show-btn.png +0 -0
  110. package/payload/starter/_basic/comp/password-input-b/show-btn2.png +0 -0
  111. package/payload/starter/_basic/comp/password-input-b.js +164 -0
  112. package/payload/starter/_basic/comp/period-bar.js +435 -0
  113. package/payload/starter/_basic/comp/phone-input-b.js +287 -0
  114. package/payload/starter/_basic/comp/progress-bar.js +676 -0
  115. package/payload/starter/_basic/comp/property-panel.js +2740 -0
  116. package/payload/starter/_basic/comp/radio-button.js +467 -0
  117. package/payload/starter/_basic/comp/rich-text-editor.js +1061 -0
  118. package/payload/starter/_basic/comp/scrolling-text.js +296 -0
  119. package/payload/starter/_basic/comp/search-input-v2/clear-round.svg +1 -0
  120. package/payload/starter/_basic/comp/search-input-v2/clear.svg +1 -0
  121. package/payload/starter/_basic/comp/search-input-v2/filter.png +0 -0
  122. package/payload/starter/_basic/comp/search-input-v2/filter.svg +1 -0
  123. package/payload/starter/_basic/comp/search-input-v2/search.svg +1 -0
  124. package/payload/starter/_basic/comp/search-input-v2.js +427 -0
  125. package/payload/starter/_basic/comp/search-results.js +560 -0
  126. package/payload/starter/_basic/comp/select-box.js +1740 -0
  127. package/payload/starter/_basic/comp/select-color.js +603 -0
  128. package/payload/starter/_basic/comp/select-date.js +1003 -0
  129. package/payload/starter/_basic/comp/select-file.js +732 -0
  130. package/payload/starter/_basic/comp/select-time.js +979 -0
  131. package/payload/starter/_basic/comp/settings-row.js +298 -0
  132. package/payload/starter/_basic/comp/side-panel.js +573 -0
  133. package/payload/starter/_basic/comp/slider-field.js +776 -0
  134. package/payload/starter/_basic/comp/slider.js +368 -0
  135. package/payload/starter/_basic/comp/smart-button/alert-black.png +0 -0
  136. package/payload/starter/_basic/comp/smart-button/clock.png +0 -0
  137. package/payload/starter/_basic/comp/smart-button.js +896 -0
  138. package/payload/starter/_basic/comp/smart-table/clock.png +0 -0
  139. package/payload/starter/_basic/comp/smart-table/down.png +0 -0
  140. package/payload/starter/_basic/comp/smart-table/scroll.png +0 -0
  141. package/payload/starter/_basic/comp/smart-table/sort.png +0 -0
  142. package/payload/starter/_basic/comp/smart-table/up.png +0 -0
  143. package/payload/starter/_basic/comp/smart-table.js +1321 -0
  144. package/payload/starter/_basic/comp/sortable-list.js +1172 -0
  145. package/payload/starter/_basic/comp/spark-line-box.js +729 -0
  146. package/payload/starter/_basic/comp/stepper.js +699 -0
  147. package/payload/starter/_basic/comp/tabs.js +1317 -0
  148. package/payload/starter/_basic/comp/tag-input.js +1067 -0
  149. package/payload/starter/_basic/comp/tap-effect.js +168 -0
  150. package/payload/starter/_basic/comp/textarea-b.js +184 -0
  151. package/payload/starter/_basic/comp/time-line.js +324 -0
  152. package/payload/starter/_basic/comp/tiny-select/arrow.svg +1 -0
  153. package/payload/starter/_basic/comp/tiny-select.js +282 -0
  154. package/payload/starter/_basic/comp/tiny-table.js +279 -0
  155. package/payload/starter/_basic/comp/toast.js +838 -0
  156. package/payload/starter/_basic/comp/toggle.js +636 -0
  157. package/payload/starter/_basic/comp/tooltip.js +471 -0
  158. package/payload/starter/_basic/comp/tree-view.js +1096 -0
  159. package/payload/starter/_basic/comp/ui-effects.js +1091 -0
  160. package/payload/starter/_basic/comp/ui-standards.js +402 -0
  161. package/payload/starter/_basic/comp/url-input-b.js +145 -0
  162. package/payload/starter/_basic/comp/web-view.js +534 -0
  163. package/payload/starter/_basic/docs/basic-js-animated-rules.md +90 -0
  164. package/payload/starter/_basic/docs/basic-js-code-rules.md +91 -0
  165. package/payload/starter/_basic/docs/basic-js-components.md +134 -0
  166. package/payload/starter/_basic/docs/basic-js-core.md +131 -0
  167. package/payload/starter/_basic/docs/component-index.md +522 -0
  168. package/payload/starter/_basic/docs/component-template.js +416 -0
  169. package/payload/starter/_basic/docs/handbook/00-introduction.md +125 -0
  170. package/payload/starter/_basic/docs/handbook/00-what-is-new.md +96 -0
  171. package/payload/starter/_basic/docs/handbook/01-label.md +104 -0
  172. package/payload/starter/_basic/docs/handbook/02-box.md +166 -0
  173. package/payload/starter/_basic/docs/handbook/03-image.md +81 -0
  174. package/payload/starter/_basic/docs/handbook/04-common-properties.md +159 -0
  175. package/payload/starter/_basic/docs/handbook/05-autolayout.md +332 -0
  176. package/payload/starter/_basic/docs/handbook/06-button.md +103 -0
  177. package/payload/starter/_basic/docs/handbook/07-input.md +78 -0
  178. package/payload/starter/_basic/docs/handbook/08-page.md +120 -0
  179. package/payload/starter/_basic/docs/handbook/09-useful-examples.md +309 -0
  180. package/payload/starter/_basic/docs/handbook/10-motion.md +132 -0
  181. package/payload/starter/_basic/docs/handbook/11-other-functions.md +92 -0
  182. package/payload/starter/_basic/docs/handbook/12-utilities.md +123 -0
  183. package/payload/starter/_basic/docs/handbook/13-sound.md +88 -0
  184. package/payload/starter/_basic/docs/what-is-new.md +402 -0
  185. package/payload/starter/_basic/examples/action-button.htm +81 -0
  186. package/payload/starter/_basic/examples/action-tab-bar.htm +97 -0
  187. package/payload/starter/_basic/examples/app-bar.htm +140 -0
  188. package/payload/starter/_basic/examples/badgeV2.htm +68 -0
  189. package/payload/starter/_basic/examples/bottom-bar/grid.png +0 -0
  190. package/payload/starter/_basic/examples/bottom-bar/grids.png +0 -0
  191. package/payload/starter/_basic/examples/bottom-bar/home.png +0 -0
  192. package/payload/starter/_basic/examples/bottom-bar/homes.png +0 -0
  193. package/payload/starter/_basic/examples/bottom-bar/icon1.png +0 -0
  194. package/payload/starter/_basic/examples/bottom-bar/icon1s.png +0 -0
  195. package/payload/starter/_basic/examples/bottom-bar/icon2.png +0 -0
  196. package/payload/starter/_basic/examples/bottom-bar/icon2s.png +0 -0
  197. package/payload/starter/_basic/examples/bottom-bar/icon3.png +0 -0
  198. package/payload/starter/_basic/examples/bottom-bar/icon3s.png +0 -0
  199. package/payload/starter/_basic/examples/bottom-bar/icon4.png +0 -0
  200. package/payload/starter/_basic/examples/bottom-bar/icon4s.png +0 -0
  201. package/payload/starter/_basic/examples/bottom-bar/search.png +0 -0
  202. package/payload/starter/_basic/examples/bottom-bar/searchs.png +0 -0
  203. package/payload/starter/_basic/examples/bottom-bar/settings.png +0 -0
  204. package/payload/starter/_basic/examples/bottom-bar/settingss.png +0 -0
  205. package/payload/starter/_basic/examples/bottom-bar/tasks.png +0 -0
  206. package/payload/starter/_basic/examples/bottom-bar/taskss.png +0 -0
  207. package/payload/starter/_basic/examples/bottom-bar-2.htm +187 -0
  208. package/payload/starter/_basic/examples/bottom-bar.htm +46 -0
  209. package/payload/starter/_basic/examples/breadcrumbs.htm +284 -0
  210. package/payload/starter/_basic/examples/chart-box.htm +287 -0
  211. package/payload/starter/_basic/examples/check-box-1.htm +220 -0
  212. package/payload/starter/_basic/examples/check-box-2.htm +212 -0
  213. package/payload/starter/_basic/examples/check-box-3.htm +179 -0
  214. package/payload/starter/_basic/examples/context-menu.htm +269 -0
  215. package/payload/starter/_basic/examples/currency-input-b.htm +71 -0
  216. package/payload/starter/_basic/examples/data-table-2.htm +67 -0
  217. package/payload/starter/_basic/examples/data-table-3.htm +72 -0
  218. package/payload/starter/_basic/examples/data-table-4.htm +144 -0
  219. package/payload/starter/_basic/examples/data-table-5.htm +152 -0
  220. package/payload/starter/_basic/examples/data-table.htm +178 -0
  221. package/payload/starter/_basic/examples/dialog-centered.htm +130 -0
  222. package/payload/starter/_basic/examples/dialog.htm +209 -0
  223. package/payload/starter/_basic/examples/email-input-b.htm +67 -0
  224. package/payload/starter/_basic/examples/filters.htm +115 -0
  225. package/payload/starter/_basic/examples/form-1.htm +123 -0
  226. package/payload/starter/_basic/examples/full-screen-select.htm +114 -0
  227. package/payload/starter/_basic/examples/gauge.htm +133 -0
  228. package/payload/starter/_basic/examples/hold-to-confirm-button.htm +144 -0
  229. package/payload/starter/_basic/examples/input-b-ex1.htm +132 -0
  230. package/payload/starter/_basic/examples/input-b-ex2.htm +136 -0
  231. package/payload/starter/_basic/examples/input-b-ex3-style.htm +113 -0
  232. package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +112 -0
  233. package/payload/starter/_basic/examples/input-b-ex5-warning-icon.htm +80 -0
  234. package/payload/starter/_basic/examples/input-b-ex6-dark.htm +108 -0
  235. package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +153 -0
  236. package/payload/starter/_basic/examples/item-list-2.htm +253 -0
  237. package/payload/starter/_basic/examples/item-list.htm +176 -0
  238. package/payload/starter/_basic/examples/label-editor.htm +196 -0
  239. package/payload/starter/_basic/examples/left-menu.htm +81 -0
  240. package/payload/starter/_basic/examples/line-progress-bar.htm +145 -0
  241. package/payload/starter/_basic/examples/loading-screen.htm +217 -0
  242. package/payload/starter/_basic/examples/login-page-dark-v2.htm +269 -0
  243. package/payload/starter/_basic/examples/login-page-v2.htm +269 -0
  244. package/payload/starter/_basic/examples/mini-graph-box.htm +229 -0
  245. package/payload/starter/_basic/examples/notice.htm +79 -0
  246. package/payload/starter/_basic/examples/number-input-b.htm +68 -0
  247. package/payload/starter/_basic/examples/numeric-keyboard.htm +100 -0
  248. package/payload/starter/_basic/examples/page-control.htm +262 -0
  249. package/payload/starter/_basic/examples/page-header.htm +117 -0
  250. package/payload/starter/_basic/examples/password-input-b.htm +70 -0
  251. package/payload/starter/_basic/examples/period-bar.htm +94 -0
  252. package/payload/starter/_basic/examples/phone-input-b-select-country.htm +298 -0
  253. package/payload/starter/_basic/examples/phone-input-b.htm +72 -0
  254. package/payload/starter/_basic/examples/progress-bar-ozden.htm +168 -0
  255. package/payload/starter/_basic/examples/progress-bar.htm +296 -0
  256. package/payload/starter/_basic/examples/property-panel.htm +216 -0
  257. package/payload/starter/_basic/examples/radio-button-1.htm +264 -0
  258. package/payload/starter/_basic/examples/radio-button-2.htm +256 -0
  259. package/payload/starter/_basic/examples/radio-button-3.htm +168 -0
  260. package/payload/starter/_basic/examples/rich-text-editor.htm +228 -0
  261. package/payload/starter/_basic/examples/scrolling-text.htm +75 -0
  262. package/payload/starter/_basic/examples/search-input-v2-ozden.htm +128 -0
  263. package/payload/starter/_basic/examples/search-input-v2-place.htm +80 -0
  264. package/payload/starter/_basic/examples/search-input-v2.htm +65 -0
  265. package/payload/starter/_basic/examples/search-results.htm +193 -0
  266. package/payload/starter/_basic/examples/select-box-ozden-item.htm +114 -0
  267. package/payload/starter/_basic/examples/select-box-ozden-text.htm +64 -0
  268. package/payload/starter/_basic/examples/select-box.htm +254 -0
  269. package/payload/starter/_basic/examples/select-color.htm +215 -0
  270. package/payload/starter/_basic/examples/select-date.htm +244 -0
  271. package/payload/starter/_basic/examples/select-file.htm +268 -0
  272. package/payload/starter/_basic/examples/select-time.htm +249 -0
  273. package/payload/starter/_basic/examples/settings-row.htm +193 -0
  274. package/payload/starter/_basic/examples/side-panel-2.htm +270 -0
  275. package/payload/starter/_basic/examples/side-panel.htm +219 -0
  276. package/payload/starter/_basic/examples/slider-field.htm +223 -0
  277. package/payload/starter/_basic/examples/slider.htm +180 -0
  278. package/payload/starter/_basic/examples/smart-button-2.htm +220 -0
  279. package/payload/starter/_basic/examples/smart-button-3-ozden.htm +320 -0
  280. package/payload/starter/_basic/examples/smart-button-4-dark.htm +102 -0
  281. package/payload/starter/_basic/examples/smart-button-5-features.htm +205 -0
  282. package/payload/starter/_basic/examples/smart-button.htm +252 -0
  283. package/payload/starter/_basic/examples/smart-table-1.htm +142 -0
  284. package/payload/starter/_basic/examples/smart-table-2.htm +191 -0
  285. package/payload/starter/_basic/examples/smart-table-3.htm +359 -0
  286. package/payload/starter/_basic/examples/smart-table-4.htm +158 -0
  287. package/payload/starter/_basic/examples/sortable-list.htm +250 -0
  288. package/payload/starter/_basic/examples/spark-line-box.htm +285 -0
  289. package/payload/starter/_basic/examples/stepper-2.htm +172 -0
  290. package/payload/starter/_basic/examples/stepper.htm +255 -0
  291. package/payload/starter/_basic/examples/tabs-2/coffee.png +0 -0
  292. package/payload/starter/_basic/examples/tabs-2/i1-white.png +0 -0
  293. package/payload/starter/_basic/examples/tabs-2/i1.png +0 -0
  294. package/payload/starter/_basic/examples/tabs-2/i2-white.png +0 -0
  295. package/payload/starter/_basic/examples/tabs-2/i2.png +0 -0
  296. package/payload/starter/_basic/examples/tabs-2/i3-white.png +0 -0
  297. package/payload/starter/_basic/examples/tabs-2/i3.png +0 -0
  298. package/payload/starter/_basic/examples/tabs-2/i4-white.png +0 -0
  299. package/payload/starter/_basic/examples/tabs-2/i4.png +0 -0
  300. package/payload/starter/_basic/examples/tabs-2/i5-white.png +0 -0
  301. package/payload/starter/_basic/examples/tabs-2/i5.png +0 -0
  302. package/payload/starter/_basic/examples/tabs-2/lamp-on.png +0 -0
  303. package/payload/starter/_basic/examples/tabs-2/lamp.png +0 -0
  304. package/payload/starter/_basic/examples/tabs-2/search.svg +2 -0
  305. package/payload/starter/_basic/examples/tabs-2.htm +188 -0
  306. package/payload/starter/_basic/examples/tabs.htm +300 -0
  307. package/payload/starter/_basic/examples/tag-input.htm +242 -0
  308. package/payload/starter/_basic/examples/tap-effect.htm +100 -0
  309. package/payload/starter/_basic/examples/textarea-b.htm +76 -0
  310. package/payload/starter/_basic/examples/time-line.htm +226 -0
  311. package/payload/starter/_basic/examples/tiny-select.htm +86 -0
  312. package/payload/starter/_basic/examples/tiny-table.htm +109 -0
  313. package/payload/starter/_basic/examples/toast.htm +262 -0
  314. package/payload/starter/_basic/examples/toggle-2.htm +163 -0
  315. package/payload/starter/_basic/examples/toggle-3.htm +218 -0
  316. package/payload/starter/_basic/examples/toggle.htm +93 -0
  317. package/payload/starter/_basic/examples/tooltip-2.htm +177 -0
  318. package/payload/starter/_basic/examples/tooltip-3.htm +212 -0
  319. package/payload/starter/_basic/examples/tooltip.htm +124 -0
  320. package/payload/starter/_basic/examples/tree-view.htm +285 -0
  321. package/payload/starter/_basic/examples/ui-effects.htm +463 -0
  322. package/payload/starter/_basic/examples/ui-standards.htm +261 -0
  323. package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +221 -0
  324. package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +221 -0
  325. package/payload/starter/_basic/examples/url-input-b.htm +85 -0
  326. package/payload/starter/_basic/examples/web-view.htm +241 -0
  327. package/payload/starter/_basic/min/action-button.min.js +2 -0
  328. package/payload/starter/_basic/min/action-tab-bar.min.js +2 -0
  329. package/payload/starter/_basic/min/app-bar.min.js +2 -0
  330. package/payload/starter/_basic/min/badge-v2.min.js +2 -0
  331. package/payload/starter/_basic/min/bottom-bar.min.js +2 -0
  332. package/payload/starter/_basic/min/breadcrumbs.min.js +2 -0
  333. package/payload/starter/_basic/min/chart-box.min.js +2 -0
  334. package/payload/starter/_basic/min/check-box.min.js +2 -0
  335. package/payload/starter/_basic/min/context-menu.min.js +2 -0
  336. package/payload/starter/_basic/min/currency-input-b.min.js +2 -0
  337. package/payload/starter/_basic/min/data-table.min.js +2 -0
  338. package/payload/starter/_basic/min/dialog.min.js +2 -0
  339. package/payload/starter/_basic/min/email-input-b.min.js +2 -0
  340. package/payload/starter/_basic/min/filters.min.js +2 -0
  341. package/payload/starter/_basic/min/form.min.js +2 -0
  342. package/payload/starter/_basic/min/full-screen-select.min.js +2 -0
  343. package/payload/starter/_basic/min/gauge.min.js +2 -0
  344. package/payload/starter/_basic/min/hold-to-confirm-button.min.js +2 -0
  345. package/payload/starter/_basic/min/input-b.min.js +2 -0
  346. package/payload/starter/_basic/min/item-list.min.js +2 -0
  347. package/payload/starter/_basic/min/label-editor.min.js +2 -0
  348. package/payload/starter/_basic/min/left-menu.min.js +2 -0
  349. package/payload/starter/_basic/min/line-progress-bar.min.js +2 -0
  350. package/payload/starter/_basic/min/loading-screen.min.js +2 -0
  351. package/payload/starter/_basic/min/login-page-v2.min.js +2 -0
  352. package/payload/starter/_basic/min/mini-graph-box.min.js +2 -0
  353. package/payload/starter/_basic/min/notice.min.js +2 -0
  354. package/payload/starter/_basic/min/number-input-b.min.js +2 -0
  355. package/payload/starter/_basic/min/numeric-keyboard.min.js +2 -0
  356. package/payload/starter/_basic/min/page-control.min.js +2 -0
  357. package/payload/starter/_basic/min/page-header.min.js +2 -0
  358. package/payload/starter/_basic/min/password-input-b.min.js +2 -0
  359. package/payload/starter/_basic/min/period-bar.min.js +2 -0
  360. package/payload/starter/_basic/min/phone-input-b.min.js +2 -0
  361. package/payload/starter/_basic/min/progress-bar.min.js +2 -0
  362. package/payload/starter/_basic/min/property-panel.min.js +2 -0
  363. package/payload/starter/_basic/min/radio-button.min.js +2 -0
  364. package/payload/starter/_basic/min/rich-text-editor.min.js +2 -0
  365. package/payload/starter/_basic/min/scrolling-text.min.js +2 -0
  366. package/payload/starter/_basic/min/search-input-v2.min.js +2 -0
  367. package/payload/starter/_basic/min/search-results.min.js +2 -0
  368. package/payload/starter/_basic/min/select-box.min.js +2 -0
  369. package/payload/starter/_basic/min/select-color.min.js +2 -0
  370. package/payload/starter/_basic/min/select-date.min.js +2 -0
  371. package/payload/starter/_basic/min/select-file.min.js +2 -0
  372. package/payload/starter/_basic/min/select-time.min.js +2 -0
  373. package/payload/starter/_basic/min/settings-row.min.js +2 -0
  374. package/payload/starter/_basic/min/side-panel.min.js +2 -0
  375. package/payload/starter/_basic/min/slider-field.min.js +2 -0
  376. package/payload/starter/_basic/min/slider.min.js +2 -0
  377. package/payload/starter/_basic/min/smart-button.min.js +2 -0
  378. package/payload/starter/_basic/min/smart-table.min.js +2 -0
  379. package/payload/starter/_basic/min/sortable-list.min.js +2 -0
  380. package/payload/starter/_basic/min/spark-line-box.min.js +2 -0
  381. package/payload/starter/_basic/min/stepper.min.js +2 -0
  382. package/payload/starter/_basic/min/tabs.min.js +2 -0
  383. package/payload/starter/_basic/min/tag-input.min.js +2 -0
  384. package/payload/starter/_basic/min/tap-effect.min.js +2 -0
  385. package/payload/starter/_basic/min/textarea-b.min.js +2 -0
  386. package/payload/starter/_basic/min/time-line.min.js +2 -0
  387. package/payload/starter/_basic/min/tiny-select.min.js +2 -0
  388. package/payload/starter/_basic/min/tiny-table.min.js +2 -0
  389. package/payload/starter/_basic/min/toast.min.js +2 -0
  390. package/payload/starter/_basic/min/toggle.min.js +2 -0
  391. package/payload/starter/_basic/min/tooltip.min.js +2 -0
  392. package/payload/starter/_basic/min/tree-view.min.js +2 -0
  393. package/payload/starter/_basic/min/ui-effects.min.js +2 -0
  394. package/payload/starter/_basic/min/ui-standards.min.js +2 -0
  395. package/payload/starter/_basic/min/url-input-b.min.js +2 -0
  396. package/payload/starter/_basic/min/web-view.min.js +2 -0
  397. package/payload/starter/_basic/tools/build.js +175 -0
  398. package/payload/starter/_basic/tools/check.js +336 -0
  399. package/payload/starter/app/app.js +27 -0
  400. package/payload/starter/assets/.gitkeep +0 -0
  401. package/payload/starter/gitignore +3 -0
  402. package/payload/starter/index.htm +23 -0
  403. package/payload/templates/booking/TEMPLATE.md +77 -0
  404. package/payload/templates/booking/app/app.js +722 -0
  405. package/payload/templates/booking/app/settings.js +52 -0
  406. package/payload/templates/booking/app/store.js +265 -0
  407. package/payload/templates/booking/app/texts.js +148 -0
  408. package/payload/templates/booking/assets/app-icon.svg +1 -0
  409. package/payload/templates/booking/assets/tabs/account.svg +1 -0
  410. package/payload/templates/booking/assets/tabs/appointments.svg +1 -0
  411. package/payload/templates/booking/assets/tabs/home.svg +1 -0
  412. package/payload/templates/booking/assets/tabs/services.svg +1 -0
  413. package/payload/templates/booking/components/booking-ui.js +252 -0
  414. package/payload/templates/booking/index.htm +53 -0
  415. package/payload/templates/booking/pages/account.js +124 -0
  416. package/payload/templates/booking/pages/appointments.js +141 -0
  417. package/payload/templates/booking/pages/book.js +231 -0
  418. package/payload/templates/booking/pages/home.js +99 -0
  419. package/payload/templates/booking/pages/services.js +79 -0
  420. package/payload/templates/classic/TEMPLATE.md +104 -0
  421. package/payload/templates/classic/app/app.js +779 -0
  422. package/payload/templates/classic/app/settings.js +77 -0
  423. package/payload/templates/classic/assets/_attribute.txt +37 -0
  424. package/payload/templates/classic/assets/cards/dill.png +0 -0
  425. package/payload/templates/classic/assets/cards/fennel.png +0 -0
  426. package/payload/templates/classic/assets/cards/juniper.png +0 -0
  427. package/payload/templates/classic/assets/cards/olives.png +0 -0
  428. package/payload/templates/classic/assets/cards/oregano.png +0 -0
  429. package/payload/templates/classic/assets/cards/pepper.png +0 -0
  430. package/payload/templates/classic/assets/cards/rosehip.png +0 -0
  431. package/payload/templates/classic/assets/categories/cappuccino.png +0 -0
  432. package/payload/templates/classic/assets/categories/chocolate-milk.png +0 -0
  433. package/payload/templates/classic/assets/categories/coffee-cup.png +0 -0
  434. package/payload/templates/classic/assets/categories/coffee.png +0 -0
  435. package/payload/templates/classic/assets/categories/frappe.png +0 -0
  436. package/payload/templates/classic/assets/categories/iced-caffee.png +0 -0
  437. package/payload/templates/classic/assets/categories/milkshake.png +0 -0
  438. package/payload/templates/classic/assets/categories/orange-juice.png +0 -0
  439. package/payload/templates/classic/assets/categories/tea.png +0 -0
  440. package/payload/templates/classic/assets/example-tabs/coffee.png +0 -0
  441. package/payload/templates/classic/assets/example-tabs/i1-white.png +0 -0
  442. package/payload/templates/classic/assets/example-tabs/i1.png +0 -0
  443. package/payload/templates/classic/assets/example-tabs/i2-white.png +0 -0
  444. package/payload/templates/classic/assets/example-tabs/i2.png +0 -0
  445. package/payload/templates/classic/assets/example-tabs/i3-white.png +0 -0
  446. package/payload/templates/classic/assets/example-tabs/i3.png +0 -0
  447. package/payload/templates/classic/assets/example-tabs/i4-white.png +0 -0
  448. package/payload/templates/classic/assets/example-tabs/i4.png +0 -0
  449. package/payload/templates/classic/assets/example-tabs/i5-white.png +0 -0
  450. package/payload/templates/classic/assets/example-tabs/i5.png +0 -0
  451. package/payload/templates/classic/assets/example-tabs/lamp-on.png +0 -0
  452. package/payload/templates/classic/assets/example-tabs/lamp.png +0 -0
  453. package/payload/templates/classic/assets/example-tabs/search.svg +2 -0
  454. package/payload/templates/classic/assets/files/ai.png +0 -0
  455. package/payload/templates/classic/assets/files/doc.png +0 -0
  456. package/payload/templates/classic/assets/files/folder.png +0 -0
  457. package/payload/templates/classic/assets/files/js.png +0 -0
  458. package/payload/templates/classic/assets/files/pdf.png +0 -0
  459. package/payload/templates/classic/assets/files/txt.png +0 -0
  460. package/payload/templates/classic/assets/files/xls.png +0 -0
  461. package/payload/templates/classic/assets/icons/arrow-drop.svg +3 -0
  462. package/payload/templates/classic/assets/icons/arrow-rise.svg +3 -0
  463. package/payload/templates/classic/assets/icons/download.svg +18 -0
  464. package/payload/templates/classic/assets/icons/lamp-on.png +0 -0
  465. package/payload/templates/classic/assets/icons/lamp.png +0 -0
  466. package/payload/templates/classic/assets/icons/lock-small.png +0 -0
  467. package/payload/templates/classic/assets/icons/lock.png +0 -0
  468. package/payload/templates/classic/assets/icons/logo.png +0 -0
  469. package/payload/templates/classic/assets/icons/trash-red.svg +2 -0
  470. package/payload/templates/classic/assets/icons/trash.svg +2 -0
  471. package/payload/templates/classic/assets/menu/t1.png +0 -0
  472. package/payload/templates/classic/assets/menu/t10.png +0 -0
  473. package/payload/templates/classic/assets/menu/t11.png +0 -0
  474. package/payload/templates/classic/assets/menu/t2.png +0 -0
  475. package/payload/templates/classic/assets/menu/t3.png +0 -0
  476. package/payload/templates/classic/assets/menu/t4.png +0 -0
  477. package/payload/templates/classic/assets/menu/t5.png +0 -0
  478. package/payload/templates/classic/assets/menu/t6.png +0 -0
  479. package/payload/templates/classic/assets/menu/t7.png +0 -0
  480. package/payload/templates/classic/assets/menu/t8.png +0 -0
  481. package/payload/templates/classic/assets/menu/t9.png +0 -0
  482. package/payload/templates/classic/assets/products/brokoli.png +0 -0
  483. package/payload/templates/classic/assets/products/cilek.png +0 -0
  484. package/payload/templates/classic/assets/products/domates.png +0 -0
  485. package/payload/templates/classic/assets/products/elma.png +0 -0
  486. package/payload/templates/classic/assets/products/havuc.png +0 -0
  487. package/payload/templates/classic/assets/products/karpuz.png +0 -0
  488. package/payload/templates/classic/assets/products/limon.png +0 -0
  489. package/payload/templates/classic/assets/products/muz.png +0 -0
  490. package/payload/templates/classic/assets/products/nar.png +0 -0
  491. package/payload/templates/classic/assets/products/patlican.png +0 -0
  492. package/payload/templates/classic/assets/products/yabanmersini.png +0 -0
  493. package/payload/templates/classic/assets/products/yesilbiber.png +0 -0
  494. package/payload/templates/classic/assets/tab-bar/settings.png +0 -0
  495. package/payload/templates/classic/assets/tab-bar/status.png +0 -0
  496. package/payload/templates/classic/assets/tab-bar/transactions.png +0 -0
  497. package/payload/templates/classic/assets/tabs/grid.png +0 -0
  498. package/payload/templates/classic/assets/tabs/grids.png +0 -0
  499. package/payload/templates/classic/assets/tabs/home.png +0 -0
  500. package/payload/templates/classic/assets/tabs/homes.png +0 -0
  501. package/payload/templates/classic/assets/tabs/search.png +0 -0
  502. package/payload/templates/classic/assets/tabs/searchs.png +0 -0
  503. package/payload/templates/classic/assets/tabs/settings.png +0 -0
  504. package/payload/templates/classic/assets/tabs/settingss.png +0 -0
  505. package/payload/templates/classic/assets/tabs/tasks.png +0 -0
  506. package/payload/templates/classic/assets/tabs/taskss.png +0 -0
  507. package/payload/templates/classic/html/privacy.htm +58 -0
  508. package/payload/templates/classic/index.htm +70 -0
  509. package/payload/templates/classic/pages/dialogs.js +205 -0
  510. package/payload/templates/classic/pages/example.js +296 -0
  511. package/payload/templates/classic/pages/examples.js +148 -0
  512. package/payload/templates/classic/pages/home.js +268 -0
  513. package/payload/templates/classic/pages/info-pages.js +95 -0
  514. package/payload/templates/classic/pages/lock.js +70 -0
  515. package/payload/templates/classic/pages/search.js +153 -0
  516. package/payload/templates/classic/pages/settings.js +184 -0
  517. package/payload/templates/classic/pages/tasks.js +221 -0
  518. package/payload/templates/classic/pages/template-pages.js +240 -0
  519. package/payload/templates/coffee-shop/TEMPLATE.md +63 -0
  520. package/payload/templates/coffee-shop/app/app.js +713 -0
  521. package/payload/templates/coffee-shop/app/settings.js +20 -0
  522. package/payload/templates/coffee-shop/app/store.js +52 -0
  523. package/payload/templates/coffee-shop/assets/cappuccino.png +0 -0
  524. package/payload/templates/coffee-shop/assets/chocolate-milk.png +0 -0
  525. package/payload/templates/coffee-shop/assets/coffee-art/cocoa.svg +1 -0
  526. package/payload/templates/coffee-shop/assets/coffee-art/filter.svg +1 -0
  527. package/payload/templates/coffee-shop/assets/coffee-art/frappe.svg +1 -0
  528. package/payload/templates/coffee-shop/assets/coffee-art/iced.svg +1 -0
  529. package/payload/templates/coffee-shop/assets/coffee-art/latte.svg +1 -0
  530. package/payload/templates/coffee-shop/assets/coffee-art/tea.svg +1 -0
  531. package/payload/templates/coffee-shop/assets/coffee.png +0 -0
  532. package/payload/templates/coffee-shop/assets/credits.txt +41 -0
  533. package/payload/templates/coffee-shop/assets/fonts/OFL.txt +93 -0
  534. package/payload/templates/coffee-shop/assets/fonts/gelasio-OFL.txt +93 -0
  535. package/payload/templates/coffee-shop/assets/fonts/gelasio.ttf +0 -0
  536. package/payload/templates/coffee-shop/assets/frappe.png +0 -0
  537. package/payload/templates/coffee-shop/assets/iced-caffee.png +0 -0
  538. package/payload/templates/coffee-shop/assets/tabs/cart.svg +1 -0
  539. package/payload/templates/coffee-shop/assets/tabs/home.svg +1 -0
  540. package/payload/templates/coffee-shop/assets/tabs/menu.svg +1 -0
  541. package/payload/templates/coffee-shop/assets/tabs/rewards.svg +1 -0
  542. package/payload/templates/coffee-shop/assets/tea.png +0 -0
  543. package/payload/templates/coffee-shop/components/coffee-ui.js +246 -0
  544. package/payload/templates/coffee-shop/index.htm +55 -0
  545. package/payload/templates/coffee-shop/pages/cart.js +82 -0
  546. package/payload/templates/coffee-shop/pages/drink.js +74 -0
  547. package/payload/templates/coffee-shop/pages/home.js +54 -0
  548. package/payload/templates/coffee-shop/pages/menu.js +53 -0
  549. package/payload/templates/coffee-shop/pages/rewards.js +38 -0
  550. package/payload/templates/forms/TEMPLATE.md +12 -0
  551. package/payload/templates/forms/app/app.js +30 -0
  552. package/payload/templates/forms/appointment-form.htm +969 -0
  553. package/payload/templates/forms/assets/error.png +0 -0
  554. package/payload/templates/forms/assets/logo.png +0 -0
  555. package/payload/templates/forms/assets/logo2.png +0 -0
  556. package/payload/templates/forms/assets/mail.png +0 -0
  557. package/payload/templates/forms/assets/success.png +0 -0
  558. package/payload/templates/forms/contact-form-iframe.htm +24 -0
  559. package/payload/templates/forms/contact-form-table.sql +11 -0
  560. package/payload/templates/forms/contact-form-to-mail.htm +358 -0
  561. package/payload/templates/forms/contact-form-to-supabase.htm +396 -0
  562. package/payload/templates/forms/dark-contact-form.htm +623 -0
  563. package/payload/templates/forms/event-registration-form.htm +1056 -0
  564. package/payload/templates/forms/feedback-form.htm +813 -0
  565. package/payload/templates/forms/order-form.htm +1187 -0
  566. package/payload/templates/forms/recruitment-form.htm +698 -0
  567. package/payload/templates/forms/service/PHPMailer/Exception.php +40 -0
  568. package/payload/templates/forms/service/PHPMailer/LICENSE +502 -0
  569. package/payload/templates/forms/service/PHPMailer/PHPMailer.php +5586 -0
  570. package/payload/templates/forms/service/PHPMailer/SMTP.php +1617 -0
  571. package/payload/templates/forms/service/readme.md +162 -0
  572. package/payload/templates/forms/service/send-form-mail.php +941 -0
  573. package/payload/templates/forms/support-ticket-form.htm +908 -0
  574. package/payload/templates/panel/TEMPLATE.md +16 -0
  575. package/payload/templates/panel/assets/_Material Symbols & Icons - Google Fonts.webloc +8 -0
  576. package/payload/templates/panel/assets/arrow_down.png +0 -0
  577. package/payload/templates/panel/assets/close.png +0 -0
  578. package/payload/templates/panel/assets/left-menu/bolt.png +0 -0
  579. package/payload/templates/panel/assets/left-menu/brick.png +0 -0
  580. package/payload/templates/panel/assets/left-menu/code.png +0 -0
  581. package/payload/templates/panel/assets/left-menu/dashboard.png +0 -0
  582. package/payload/templates/panel/assets/left-menu/data-table.png +0 -0
  583. package/payload/templates/panel/assets/left-menu/extension.png +0 -0
  584. package/payload/templates/panel/assets/left-menu/home.png +0 -0
  585. package/payload/templates/panel/assets/left-menu/reports.png +0 -0
  586. package/payload/templates/panel/assets/left-menu/setting.png +0 -0
  587. package/payload/templates/panel/assets/left-menu/url.png +0 -0
  588. package/payload/templates/panel/assets/light.png +0 -0
  589. package/payload/templates/panel/assets/maybe.png +0 -0
  590. package/payload/templates/panel/assets/panel-icon.png +0 -0
  591. package/payload/templates/panel/assets/top-bar/add.png +0 -0
  592. package/payload/templates/panel/assets/top-bar/add.svg +1 -0
  593. package/payload/templates/panel/assets/top-bar/apps.png +0 -0
  594. package/payload/templates/panel/assets/top-bar/apps.svg +1 -0
  595. package/payload/templates/panel/assets/top-bar/arrow-down.svg +1 -0
  596. package/payload/templates/panel/assets/top-bar/bell.svg +1 -0
  597. package/payload/templates/panel/assets/top-bar/bookmark.png +0 -0
  598. package/payload/templates/panel/assets/top-bar/bookmark.svg +1 -0
  599. package/payload/templates/panel/assets/top-bar/cancel.png +0 -0
  600. package/payload/templates/panel/assets/top-bar/close.svg +1 -0
  601. package/payload/templates/panel/assets/top-bar/comment.png +0 -0
  602. package/payload/templates/panel/assets/top-bar/filter.png +0 -0
  603. package/payload/templates/panel/assets/top-bar/keyboard.svg +1 -0
  604. package/payload/templates/panel/assets/top-bar/notification.png +0 -0
  605. package/payload/templates/panel/assets/top-bar/search.png +0 -0
  606. package/payload/templates/panel/assets/top-bar/search.svg +1 -0
  607. package/payload/templates/panel/assets/top-bar/user.png +0 -0
  608. package/payload/templates/panel/assets/top-bar/user.svg +1 -0
  609. package/payload/templates/panel/assets/warning.png +0 -0
  610. package/payload/templates/panel/common/bridge.js +1 -0
  611. package/payload/templates/panel/common/bridge.min.js +0 -0
  612. package/payload/templates/panel/common/components.js +12 -0
  613. package/payload/templates/panel/common/full-view.js +107 -0
  614. package/payload/templates/panel/common/full-view.min.js +1 -0
  615. package/payload/templates/panel/common/main-view.js +53 -0
  616. package/payload/templates/panel/common/main-view.min.js +1 -0
  617. package/payload/templates/panel/common/module-page.js +46 -0
  618. package/payload/templates/panel/common/module-page.min.js +1 -0
  619. package/payload/templates/panel/common/right-view.js +77 -0
  620. package/payload/templates/panel/common/right-view.min.js +1 -0
  621. package/payload/templates/panel/common/start-page.js +31 -0
  622. package/payload/templates/panel/common/start-page.min.js +1 -0
  623. package/payload/templates/panel/common/theme.js +491 -0
  624. package/payload/templates/panel/common/top-bar-v25-07-29-1.js +330 -0
  625. package/payload/templates/panel/common/top-bar-v25-07-29-2.js +265 -0
  626. package/payload/templates/panel/common/top-bar.js +855 -0
  627. package/payload/templates/panel/common/top-bar.min.js +1 -0
  628. package/payload/templates/panel/common/ui-standards.css +77 -0
  629. package/payload/templates/panel/common/ui-standards.js +133 -0
  630. package/payload/templates/panel/common/ui-standards.min.css +1 -0
  631. package/payload/templates/panel/common/ui-standards.min.js +1 -0
  632. package/payload/templates/panel/index.htm +642 -0
  633. package/payload/templates/panel/managers/database.js +1 -0
  634. package/payload/templates/panel/managers/database.min.js +1 -0
  635. package/payload/templates/panel/managers/login.js +2 -0
  636. package/payload/templates/panel/managers/login.min.js +1 -0
  637. package/payload/templates/panel/module1/empty-main.htm +27 -0
  638. package/payload/templates/panel/module10/greenhouse.htm +1362 -0
  639. package/payload/templates/panel/module11/arduino-projects.htm +1125 -0
  640. package/payload/templates/panel/module2/empty-full.htm +27 -0
  641. package/payload/templates/panel/module3/empty-right.htm +27 -0
  642. package/payload/templates/panel/module4/empty-main-topbar.htm +27 -0
  643. package/payload/templates/panel/module5/empty-right-topbar.htm +27 -0
  644. package/payload/templates/panel/module6/energy-hub.htm +1508 -0
  645. package/payload/templates/panel/module7/3d-printers.htm +1259 -0
  646. package/payload/templates/panel/module8/cold-rooms.htm +1251 -0
  647. package/payload/templates/panel/module9/elevator-fleet.htm +1489 -0
  648. package/payload/templates/panel/pages/_page-template.js +36 -0
  649. package/payload/templates/panel/pages/_page-template.min.js +1 -0
  650. package/payload/templates/panel/pages/activity.js +1072 -0
  651. package/payload/templates/panel/pages/contents.js +1555 -0
  652. package/payload/templates/panel/pages/contents.min.js +1 -0
  653. package/payload/templates/panel/pages/customers.js +1171 -0
  654. package/payload/templates/panel/pages/edit-user.js +381 -0
  655. package/payload/templates/panel/pages/edit-user.min.js +1 -0
  656. package/payload/templates/panel/pages/edit-users-table.min.js +1 -0
  657. package/payload/templates/panel/pages/home.js +637 -0
  658. package/payload/templates/panel/pages/home.min.js +1 -0
  659. package/payload/templates/panel/pages/media.js +1538 -0
  660. package/payload/templates/panel/pages/notifications.js +542 -0
  661. package/payload/templates/panel/pages/notifications.min.js +1 -0
  662. package/payload/templates/panel/pages/orders.js +1147 -0
  663. package/payload/templates/panel/pages/products.js +1281 -0
  664. package/payload/templates/panel/pages/reports.js +1138 -0
  665. package/payload/templates/panel/pages/reports.min.js +1 -0
  666. package/payload/templates/panel/pages/roles.js +1096 -0
  667. package/payload/templates/panel/pages/settings.js +1462 -0
  668. package/payload/templates/panel/pages/settings.min.js +1 -0
  669. package/payload/templates/panel/pages/user-actions.js +456 -0
  670. package/payload/templates/panel/pages/user-actions.min.js +2 -0
  671. package/payload/templates/panel/pages/user-list.js +1113 -0
  672. package/payload/templates/panel/pages/users.js +334 -0
  673. package/payload/templates/panel/pages/users.min.js +1 -0
  674. package/payload/templates/shop/TEMPLATE.md +69 -0
  675. package/payload/templates/shop/app/app.js +727 -0
  676. package/payload/templates/shop/app/art.js +89 -0
  677. package/payload/templates/shop/app/settings.js +45 -0
  678. package/payload/templates/shop/app/store.js +239 -0
  679. package/payload/templates/shop/app/texts.js +232 -0
  680. package/payload/templates/shop/assets/app-icon.svg +1 -0
  681. package/payload/templates/shop/assets/tabs/account.svg +1 -0
  682. package/payload/templates/shop/assets/tabs/cart.svg +1 -0
  683. package/payload/templates/shop/assets/tabs/home.svg +1 -0
  684. package/payload/templates/shop/assets/tabs/shop.svg +1 -0
  685. package/payload/templates/shop/components/shop-ui.js +343 -0
  686. package/payload/templates/shop/index.htm +57 -0
  687. package/payload/templates/shop/pages/account.js +190 -0
  688. package/payload/templates/shop/pages/cart.js +116 -0
  689. package/payload/templates/shop/pages/checkout.js +134 -0
  690. package/payload/templates/shop/pages/favorites.js +37 -0
  691. package/payload/templates/shop/pages/home.js +86 -0
  692. package/payload/templates/shop/pages/orders.js +132 -0
  693. package/payload/templates/shop/pages/product.js +168 -0
  694. package/payload/templates/shop/pages/shop.js +113 -0
  695. package/payload/templates/starter/TEMPLATE.md +107 -0
  696. package/payload/templates/starter/app/app.js +660 -0
  697. package/payload/templates/starter/app/settings.js +57 -0
  698. package/payload/templates/starter/assets/app-icon.svg +5 -0
  699. package/payload/templates/starter/assets/products/brokoli.png +0 -0
  700. package/payload/templates/starter/assets/products/cilek.png +0 -0
  701. package/payload/templates/starter/assets/products/domates.png +0 -0
  702. package/payload/templates/starter/assets/products/elma.png +0 -0
  703. package/payload/templates/starter/assets/products/havuc.png +0 -0
  704. package/payload/templates/starter/assets/products/karpuz.png +0 -0
  705. package/payload/templates/starter/assets/products/limon.png +0 -0
  706. package/payload/templates/starter/assets/products/muz.png +0 -0
  707. package/payload/templates/starter/assets/products/nar.png +0 -0
  708. package/payload/templates/starter/assets/products/patlican.png +0 -0
  709. package/payload/templates/starter/assets/products/yabanmersini.png +0 -0
  710. package/payload/templates/starter/assets/products/yesilbiber.png +0 -0
  711. package/payload/templates/starter/assets/tabs/grid.png +0 -0
  712. package/payload/templates/starter/assets/tabs/grids.png +0 -0
  713. package/payload/templates/starter/assets/tabs/home.png +0 -0
  714. package/payload/templates/starter/assets/tabs/homes.png +0 -0
  715. package/payload/templates/starter/assets/tabs/settings.png +0 -0
  716. package/payload/templates/starter/assets/tabs/settingss.png +0 -0
  717. package/payload/templates/starter/assets/tabs/tasks.png +0 -0
  718. package/payload/templates/starter/assets/tabs/taskss.png +0 -0
  719. package/payload/templates/starter/html/about.htm +54 -0
  720. package/payload/templates/starter/index.htm +57 -0
  721. package/payload/templates/starter/pages/about.js +23 -0
  722. package/payload/templates/starter/pages/home.js +81 -0
  723. package/payload/templates/starter/pages/product.js +45 -0
  724. package/payload/templates/starter/pages/products.js +61 -0
  725. package/payload/templates/starter/pages/settings.js +103 -0
  726. package/payload/templates/starter/pages/tasks.js +187 -0
  727. package/payload/templates/starter/pages/website.js +29 -0
@@ -0,0 +1,1362 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta name="basic-check" content="skip">
5
+
6
+ <title>Greenhouse</title>
7
+
8
+ <meta charset="UTF-8">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- , user-scalable=no -->
10
+
11
+ <!-- LIBRARY FILES -->
12
+ <link rel="preload" href="../_basic/basic/font/open-sans/OpenSans-Regular.ttf" as="font" crossorigin="anonymous">
13
+ <link rel="stylesheet" type="text/css" href="../_basic/basic/basic.min.css">
14
+ <script src="../_basic/basic/basic.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="../_basic/basic/scroll-bar.js" type="text/javascript" charset="utf-8"></script>
16
+ <script src="../common/theme.js" type="text/javascript" charset="utf-8"></script>
17
+
18
+ <!-- COMPONENTS -->
19
+ <script src="../_basic/comp/tiny-select.js" type="text/javascript" charset="utf-8"></script>
20
+ <script src="../_basic/comp/tiny-table.js" type="text/javascript" charset="utf-8"></script>
21
+ <script src="../_basic/comp/toggle.js" type="text/javascript" charset="utf-8"></script>
22
+ <script src="../_basic/comp/slider.js" type="text/javascript" charset="utf-8"></script>
23
+ <script src="../_basic/comp/smart-button.js" type="text/javascript" charset="utf-8"></script>
24
+ <script src="../_basic/comp/dialog.js" type="text/javascript" charset="utf-8"></script>
25
+ <script src="../_basic/comp/check-box.js" type="text/javascript" charset="utf-8"></script>
26
+ <script src="../_basic/comp/radio-button.js" type="text/javascript" charset="utf-8"></script>
27
+ <script src="../_basic/comp/hold-to-confirm-button.js" type="text/javascript" charset="utf-8"></script>
28
+ <script src="../_basic/comp/progress-bar.js" type="text/javascript" charset="utf-8"></script>
29
+ <script src="../_basic/comp/spark-line-box.js" type="text/javascript" charset="utf-8"></script>
30
+ <script src="../_basic/comp/chart-box.js" type="text/javascript" charset="utf-8"></script>
31
+ <script src="../_basic/comp/context-menu.js" type="text/javascript" charset="utf-8"></script>
32
+ <script src="../_basic/comp/select-time.js" type="text/javascript" charset="utf-8"></script>
33
+ <script src="../_basic/comp/select-date.js" type="text/javascript" charset="utf-8"></script>
34
+
35
+ <!--
36
+
37
+ /* Bismillah */
38
+
39
+ Module #10: Greenhouse (Template) - v26.09
40
+
41
+ - Climate control and monitoring of a greenhouse with 4 zones (bays): a top-down map (temperature color,
42
+ roof vents, grow lights, irrigation, fans, shade screen, alarms), per-zone sensors (temperature, humidity,
43
+ soil moisture, CO2, light, pH, EC), setpoints (day / night temperature, humidity, soil), Auto / Manual
44
+ mode with actuator switches, light schedule, irrigation, nutrient dosing, crop and harvest progress.
45
+ - Runs inside the admin panel (iframe), but it can work alone too.
46
+ - Simulation: 1 second = 1 minute of the day, so the day / night cycle and the controller can be seen.
47
+ Replace the "GREENHOUSE SERVICE" functions with your controller API (Modbus, MQTT, a cloud API...).
48
+
49
+ -->
50
+
51
+ <script>
52
+
53
+ // *** CONSTANTS:
54
+ const LIB_PATH = "../_basic/";
55
+ const ASSETS = "../assets/";
56
+
57
+ const PAGE_COLOR = T.page;
58
+ const CARD_COLOR = T.surface;
59
+ const CARD_BORDER_COLOR = Ink(0.1);
60
+ const FIELD_COLOR = T.surface2;
61
+ const PRIMARY_COLOR = T.primary;
62
+ const ACCENT_COLOR = T.accent;
63
+ const WARNING_COLOR = T.warning;
64
+ const ERROR_COLOR = T.danger;
65
+
66
+ const TEMP_COLOR = Theme.readable("#E8894A");
67
+ const HUMIDITY_COLOR = T.info;
68
+ const SOIL_COLOR = "#9085E9";
69
+ const LIGHT_COLOR = Theme.readable("#E8B04A");
70
+
71
+ const DAY_MINUTES = 24 * 60;
72
+ const START_MINUTE = 7 * 60 + 40; // Simulation starts at 07:40 (sunrise, the controller starts working)
73
+ const CHART_STEP = 15; // Minutes between the chart points
74
+ const KPI_COUNT = 60; // Minutes on the summary graphs
75
+ const OUTSIDE_CO2 = 420;
76
+
77
+ const IRRIGATION_LPM = 6; // Liters per minute for one zone
78
+ const POWER = { heater: 3.0, lights: 1.2, fan: 0.3, co2: 0.1, pump: 0.4 }; // kW
79
+
80
+ const MODES = [
81
+ { value: "auto", text: "Auto", desc: "The controller keeps the setpoints" },
82
+ { value: "manual", text: "Manual", desc: "You switch the actuators yourself" },
83
+ ];
84
+
85
+ const ACTUATORS = [
86
+ { key: "heater", title: "Heater", desc: "Hot water pipes" },
87
+ { key: "fan", title: "Circulation fan", desc: "Air movement, dries the leaves" },
88
+ { key: "lights", title: "Grow lights", desc: "LED, 400 µmol" },
89
+ { key: "irrigation", title: "Irrigation", desc: "Drip lines" },
90
+ { key: "shade", title: "Shade screen", desc: "Blocks 50% of the sun" },
91
+ { key: "co2", title: "CO₂ injector", desc: "Only when the vents are closed" },
92
+ ];
93
+
94
+ // Alarm rules: [key, text, level, test(zone, setpoint)]
95
+ const ALARM_RULES = [
96
+ { key: "hot", text: "High temperature", test: function (z, sp) { return z.temp > sp + 6; } },
97
+ { key: "cold", text: "Low temperature", test: function (z, sp) { return z.temp < sp - 6; } },
98
+ { key: "humid", text: "Humidity too high (disease risk)", test: function (z) { return z.humidity > z.setpoints.humidityMax + 10; } },
99
+ { key: "dry", text: "Soil is dry", test: function (z) { return z.soil < 10; } },
100
+ { key: "sensor", text: "Temperature sensor fault", test: function (z) { return z.sensorFault == 1; } },
101
+ ];
102
+
103
+ // *** TEST DATA: (GREENHOUSE SERVICE)
104
+ const ZONES = [
105
+ {
106
+ id: "z1", name: "Bay 1 · Tomatoes", crop: "Tomato", color: T.danger, rows: 5,
107
+ planted: "2026-07-20", harvestDays: 75,
108
+ temp: 18.2, humidity: 72, soil: 58, co2: 480, light: 0, ph: 6.1, ec: 2.4,
109
+ setpoints: { dayTemp: 24, nightTemp: 18, humidityMax: 80, soilMin: 40, co2Target: 900 },
110
+ actuators: { heater: 1, fan: 0, lights: 0, irrigation: 0, shade: 0, co2: 0 }, vent: 0,
111
+ mode: "auto", lightFrom: "06:00", lightTo: "20:00", irrigationMinutes: 8,
112
+ },
113
+ {
114
+ id: "z2", name: "Bay 2 · Lettuce", crop: "Lettuce", color: T.accent, rows: 7,
115
+ planted: "2026-08-28", harvestDays: 45,
116
+ temp: 17.5, humidity: 78, soil: 66, co2: 500, light: 0, ph: 6.4, ec: 1.6,
117
+ setpoints: { dayTemp: 20, nightTemp: 15, humidityMax: 85, soilMin: 50, co2Target: 800 },
118
+ actuators: { heater: 1, fan: 1, lights: 0, irrigation: 0, shade: 0, co2: 0 }, vent: 0,
119
+ mode: "auto", lightFrom: "05:30", lightTo: "21:30", irrigationMinutes: 5,
120
+ },
121
+ {
122
+ id: "z3", name: "Bay 3 · Peppers", crop: "Pepper", color: Theme.readable("#E8B04A"), rows: 5,
123
+ planted: "2026-07-05", harvestDays: 90,
124
+ temp: 19.0, humidity: 68, soil: 34, co2: 460, light: 0, ph: 5.9, ec: 2.1,
125
+ setpoints: { dayTemp: 25, nightTemp: 19, humidityMax: 75, soilMin: 40, co2Target: 900 },
126
+ actuators: { heater: 1, fan: 0, lights: 0, irrigation: 0, shade: 0, co2: 0 }, vent: 0,
127
+ mode: "auto", lightFrom: "06:00", lightTo: "20:00", irrigationMinutes: 8,
128
+ },
129
+ {
130
+ id: "z4", name: "Bay 4 · Seedlings", crop: "Seedlings", color: "#9085E9", rows: 9,
131
+ planted: "2026-09-10", harvestDays: 21,
132
+ temp: 20.5, humidity: 82, soil: 70, co2: 520, light: 0, ph: 6.2, ec: 1.2,
133
+ setpoints: { dayTemp: 23, nightTemp: 20, humidityMax: 88, soilMin: 55, co2Target: 700 },
134
+ actuators: { heater: 1, fan: 0, lights: 1, irrigation: 0, shade: 0, co2: 0 }, vent: 0,
135
+ mode: "auto", lightFrom: "04:00", lightTo: "22:00", irrigationMinutes: 4,
136
+ },
137
+ ];
138
+
139
+ const house = {
140
+ name: "North Greenhouse",
141
+ outsideTemp: 12, sun: 0, rainForecast: 0,
142
+ today: { water: 0, energy: 0 },
143
+ history: { temp: [], water: [], energy: [], alarms: [] }, // Summary graphs (per minute)
144
+ };
145
+
146
+ // *** VARIABLES:
147
+ let zone = null; // Selected zone
148
+ let simMinute = 0;
149
+ let isReady = 0;
150
+ let isRendering = 0; // WHY: Component setters call onChange. Changes made by code must not be logged.
151
+
152
+ let lblHouse, zoneSelect, lblStatus, lblClock, lblWeather, moreMenu;
153
+ let alertBox, lblAlert;
154
+ let mapBox, map = {};
155
+ let zoneInfo = {};
156
+ let kpiBoxList = [];
157
+ let chartClimate, chartRuntime;
158
+ let lblModeInfo, setpointSliders = {}, setpointLabels = {};
159
+ let actuatorToggles = {}, actuatorStates = {}, lblVent, sliderVent;
160
+ let selectLightFrom, selectLightTo, lblIrrigation, sliderIrrigation, chkRain, lblNutrients, btnDoseAcid, btnDoseNutrient;
161
+ let grpAlarmsHost, grpCropHost, grpEventHost;
162
+ let selectPlanted, harvestProgress;
163
+
164
+ // First running function.
165
+ const start = function () {
166
+
167
+ page.color = PAGE_COLOR;
168
+
169
+ ZONES.forEach(initZone);
170
+
171
+ // The day until the start time (fast, without events)
172
+ for (let m = 0; m < START_MINUTE; m++) {
173
+ simMinute = m;
174
+ simulateMinute(1);
175
+ }
176
+ simMinute = START_MINUTE;
177
+ ZONES.forEach(function (z) { addEvent(z, "Info", "Connected to the zone controller"); });
178
+
179
+ // BOX: Full screen scrollable container
180
+ // WHY: page does not scroll. Scrollable content must be inside a Box with scrollY: 1.
181
+ startBox(0, 0, "100%", "100%", {
182
+ color: "transparent",
183
+ scrollY: 1,
184
+ });
185
+
186
+ VGroup({
187
+ width: "100%",
188
+ height: "auto", // Grows with content, so the Box can scroll.
189
+ align: "left top",
190
+ gap: 16,
191
+ padding: 24,
192
+ });
193
+
194
+ initHeader();
195
+ initAlert();
196
+ initHeroRow();
197
+ initKpiRow();
198
+ initChartRow();
199
+ initControlRow();
200
+ initBottomRow();
201
+
202
+ endGroup();
203
+
204
+ endBox();
205
+
206
+ // WHY: Bar count was calculated with the default width (before flex).
207
+ kpiBoxList.forEach(function (kpiBox) { kpiBox.refresh(); });
208
+
209
+ isReady = 1;
210
+ selectZone(0);
211
+
212
+ };
213
+
214
+ // Runs every second: one minute of the day.
215
+ const loop = function () {
216
+
217
+ if (!isReady) return;
218
+
219
+ simMinute++;
220
+ if (simMinute >= DAY_MINUTES) {
221
+ simMinute = 0;
222
+ house.today = { water: 0, energy: 0 };
223
+ ZONES.forEach(function (z) {
224
+ z.daysSincePlanted++;
225
+ z.runtime = { heater: 0, fan: 0, lights: 0, irrigation: 0, co2: 0 };
226
+ z.chart = { labels: [], temp: [], humidity: [], soil: [] };
227
+ });
228
+ addEvent(zone, "Info", "A new day. Today's totals are reset.");
229
+ }
230
+
231
+ simulateMinute(0);
232
+ renderLive();
233
+
234
+ };
235
+
236
+ // *** GREENHOUSE SERVICE (SIMULATION):
237
+
238
+ const initZone = function (z) {
239
+ z.events = [];
240
+ z.alarms = {}; // key -> 1 (active)
241
+ z.sensorFault = 0;
242
+ z.irrigationLeft = 0; // Minutes left of the current irrigation
243
+ z.runtime = { heater: 0, fan: 0, lights: 0, irrigation: 0, co2: 0 }; // Minutes today
244
+ z.chart = { labels: [], temp: [], humidity: [], soil: [] };
245
+ z.daysSincePlanted = Math.max(0, Math.round((new Date() - new Date(z.planted)) / 86400000));
246
+ };
247
+
248
+ const isDay = function (minute) {
249
+ const hour = minute / 60;
250
+ return hour >= 6.5 && hour < 20;
251
+ };
252
+
253
+ const minuteOf = function (text) { // "06:30" -> 390
254
+ const parts = String(text).split(":");
255
+ return Number(parts[0]) * 60 + Number(parts[1] || 0);
256
+ };
257
+
258
+ const isInWindow = function (minute, from, to) {
259
+ const a = minuteOf(from), b = minuteOf(to);
260
+ return (a <= b) ? (minute >= a && minute < b) : (minute >= a || minute < b);
261
+ };
262
+
263
+ const updateOutside = function () {
264
+ const hour = simMinute / 60;
265
+ house.sun = Math.max(0, Math.sin(Math.PI * (hour - 6.3) / 13.6));
266
+ // Outside temperature: 9 °C at night, 24 °C in the afternoon
267
+ house.outsideTemp = 9 + 15 * Math.max(0, Math.sin(Math.PI * (hour - 7) / 15)) + (Math.random() - 0.5) * 0.2;
268
+ if (house.heatwave) house.outsideTemp += 9;
269
+ };
270
+
271
+ // The controller: decides the actuators of a zone in Auto mode.
272
+ const control = function (z) {
273
+
274
+ const sp = getSetpoint(z);
275
+ const a = z.actuators;
276
+
277
+ a.heater = (z.temp < sp - 1) ? 1 : (z.temp > sp) ? 0 : a.heater;
278
+ if (z.temp > sp + 1) z.vent = Math.min(100, z.vent + 10);
279
+ else if (z.temp < sp - 0.5) z.vent = Math.max(0, z.vent - 10);
280
+ a.fan = (z.humidity > z.setpoints.humidityMax) ? 1 : (z.humidity < z.setpoints.humidityMax - 8) ? 0 : a.fan;
281
+ a.shade = (house.sun > 0.8 && z.temp > sp + 0.5) ? 1 : (house.sun < 0.6) ? 0 : a.shade;
282
+
283
+ const naturalLight = house.sun * 1800 * ((a.shade) ? 0.5 : 0.85);
284
+ a.lights = (isInWindow(simMinute, z.lightFrom, z.lightTo) && naturalLight < 600) ? 1 : 0;
285
+
286
+ if (z.irrigationLeft <= 0 && z.soil < z.setpoints.soilMin && !(z.skipRain && house.rainForecast)) {
287
+ z.irrigationLeft = z.irrigationMinutes;
288
+ if (isReady) addEvent(z, "Info", "Irrigation started (" + z.irrigationMinutes + " min)");
289
+ }
290
+
291
+ a.co2 = (naturalLight + ((a.lights) ? 400 : 0) > 300 && z.co2 < z.setpoints.co2Target && z.vent < 20) ? 1 : 0;
292
+
293
+ };
294
+
295
+ const getSetpoint = function (z) {
296
+ return (isDay(simMinute)) ? z.setpoints.dayTemp : z.setpoints.nightTemp;
297
+ };
298
+
299
+ // One minute of a zone.
300
+ const simulateZone = function (z, silent) {
301
+
302
+ if (z.mode === "auto") control(z);
303
+
304
+ const a = z.actuators;
305
+ const naturalLight = house.sun * 1800 * ((a.shade) ? 0.5 : 0.85);
306
+ z.light = Math.round(naturalLight + ((a.lights) ? 400 : 0));
307
+
308
+ // Irrigation valve (in both modes the timer runs; Manual can also switch it directly)
309
+ if (z.irrigationLeft > 0) { a.irrigation = 1; z.irrigationLeft--; if (z.irrigationLeft <= 0 && z.mode === "auto") a.irrigation = 0; }
310
+
311
+ // Temperature
312
+ let drift = (house.outsideTemp - z.temp) * (0.012 + z.vent / 100 * 0.05);
313
+ drift += house.sun * 0.11 * ((a.shade) ? 0.5 : 1);
314
+ drift += (a.heater) ? 0.16 : 0;
315
+ drift -= (a.fan) ? 0.02 : 0;
316
+ drift += (a.lights) ? 0.02 : 0;
317
+ if (!z.sensorFault) z.temp = round1(z.temp + drift + (Math.random() - 0.5) * 0.06);
318
+
319
+ // Humidity
320
+ let hDrift = 0.12 + ((a.irrigation) ? 0.5 : 0) - z.vent / 100 * 0.45 - ((a.fan) ? 0.35 : 0) - ((a.heater) ? 0.15 : 0);
321
+ z.humidity = Math.min(100, Math.max(30, z.humidity + hDrift + (Math.random() - 0.5) * 0.3));
322
+
323
+ // Soil moisture
324
+ z.soil = Math.min(100, Math.max(0, z.soil - 0.07 - house.sun * 0.05 + ((a.irrigation) ? 1.4 : 0)));
325
+
326
+ // CO2
327
+ const photosynthesis = (z.light > 300) ? 4 : 0;
328
+ z.co2 = Math.min(1500, Math.max(300, z.co2 - photosynthesis + ((a.co2) ? 25 : 0) + (OUTSIDE_CO2 - z.co2) * (0.004 + z.vent / 100 * 0.06) + 1.5));
329
+
330
+ // Nutrients drift slowly
331
+ z.ph = Math.min(8, Math.max(4.5, z.ph + 0.0015));
332
+ if (a.irrigation) z.ec = Math.max(0.3, z.ec - 0.004);
333
+
334
+ // Totals
335
+ house.today.water += (a.irrigation) ? IRRIGATION_LPM : 0;
336
+ house.today.energy += ((a.heater) ? POWER.heater : 0) / 60 + ((a.lights) ? POWER.lights : 0) / 60 + ((a.fan) ? POWER.fan : 0) / 60 + ((a.co2) ? POWER.co2 : 0) / 60 + ((a.irrigation) ? POWER.pump : 0) / 60;
337
+ ["heater", "fan", "lights", "irrigation", "co2"].forEach(function (key) { if (a[key]) z.runtime[key]++; });
338
+
339
+ // Alarms
340
+ const sp = getSetpoint(z);
341
+ ALARM_RULES.forEach(function (rule) {
342
+ const active = rule.test(z, sp) ? 1 : 0;
343
+ if (active && !z.alarms[rule.key]) {
344
+ z.alarms[rule.key] = 1;
345
+ if (!silent) addEvent(z, "Error", "Alarm: " + rule.text);
346
+ } else if (!active && z.alarms[rule.key]) {
347
+ delete z.alarms[rule.key];
348
+ if (!silent) addEvent(z, "Success", "Cleared: " + rule.text);
349
+ }
350
+ });
351
+
352
+ // Chart points
353
+ if (simMinute % CHART_STEP === 0) {
354
+ const c = z.chart;
355
+ c.labels.push(formatMinute(simMinute));
356
+ c.temp.push(round1(z.temp));
357
+ c.humidity.push(Math.round(z.humidity));
358
+ c.soil.push(Math.round(z.soil));
359
+ }
360
+
361
+ };
362
+
363
+ const simulateMinute = function (silent) {
364
+
365
+ updateOutside();
366
+ ZONES.forEach(function (z) { simulateZone(z, silent); });
367
+
368
+ const h = house.history;
369
+ h.temp.push(round1(ZONES.reduce(function (s, z) { return s + z.temp; }, 0) / ZONES.length));
370
+ h.water.push(ZONES.filter(function (z) { return z.actuators.irrigation; }).length * IRRIGATION_LPM);
371
+ h.energy.push(round2(ZONES.reduce(function (s, z) { const a = z.actuators; return s + ((a.heater) ? POWER.heater : 0) + ((a.lights) ? POWER.lights : 0) + ((a.fan) ? POWER.fan : 0); }, 0)));
372
+ h.alarms.push(ZONES.reduce(function (s, z) { return s + Object.keys(z.alarms).length; }, 0));
373
+ for (const key in h) { if (h[key].length > KPI_COUNT) h[key].shift(); }
374
+
375
+ };
376
+
377
+ const setActuator = function (z, key, value, source) {
378
+ if (z.actuators[key] == value) return;
379
+ z.actuators[key] = value;
380
+ if (key === "irrigation") z.irrigationLeft = (value) ? 9999 : 0; // Manual: stays on until it is switched off
381
+ const actuator = ACTUATORS.find(function (item) { return item.key === key; });
382
+ addEvent(z, "Info", actuator.title + " turned " + ((value) ? "on" : "off") + " (" + source + ")");
383
+ };
384
+
385
+ const setMode = function (z, mode) {
386
+ z.mode = mode;
387
+ if (mode === "manual" && z.irrigationLeft > 0 && z.irrigationLeft < 9999) z.irrigationLeft = 0;
388
+ addEvent(z, "Info", "Mode set to " + ((mode === "auto") ? "Auto" : "Manual"));
389
+ };
390
+
391
+ const dose = function (z, what) {
392
+ if (what === "acid") { z.ph = round1(Math.max(4.5, z.ph - 0.4)); addEvent(z, "Info", "pH down dosed: 200 ml acid. pH is now " + z.ph.toFixed(1)); }
393
+ if (what === "nutrient") { z.ec = round1(Math.min(4, z.ec + 0.5)); addEvent(z, "Info", "Nutrient dosed: EC is now " + z.ec.toFixed(1) + " mS/cm"); }
394
+ renderNutrients();
395
+ };
396
+
397
+ const addEvent = function (z, level, message) {
398
+ z.events.unshift({ time: formatMinute(simMinute), level: level, message: message });
399
+ if (z.events.length > 50) z.events.pop();
400
+ if (z === zone && isReady) renderEvents();
401
+ };
402
+
403
+ // *** HELPERS:
404
+
405
+ const round1 = function (value) { return Math.round(value * 10) / 10; };
406
+ const round2 = function (value) { return Math.round(value * 100) / 100; };
407
+
408
+ const formatMinute = function (minute) {
409
+ const pad = function (n) { return String(n).padStart(2, "0"); };
410
+ return pad(Math.floor(minute / 60) % 24) + ":" + pad(minute % 60);
411
+ };
412
+
413
+ const escapeHtml = function (text) {
414
+ return String(text).replace(/[&<>"']/g, function (c) { return { "&": "&amp;", "<": "&lt;", ">": "&gt;", "\"": "&quot;", "'": "&#39;" }[c]; });
415
+ };
416
+
417
+ // WHY: Some components have no enabled setting. "inert" blocks the mouse and keyboard for all the children.
418
+ const setInteractive = function (obj, enabled) {
419
+ obj.elem.inert = !enabled;
420
+ obj.opacity = (enabled) ? 1 : 0.4;
421
+ };
422
+
423
+ // Temperature -> color (12 °C blue, 22 °C green, 32 °C red)
424
+ const tempColor = function (temp) {
425
+ const mix = function (a, b, t) {
426
+ const pa = parseInt(a.slice(1), 16), pb = parseInt(b.slice(1), 16);
427
+ const ch = function (shift) { return Math.round(((pa >> shift) & 255) * (1 - t) + ((pb >> shift) & 255) * t); };
428
+ return "rgb(" + ch(16) + "," + ch(8) + "," + ch(0) + ")";
429
+ };
430
+ if (temp <= 22) return mix(T.info, T.accent, Math.max(0, Math.min(1, (temp - 12) / 10)));
431
+ return mix(T.accent, T.danger, Math.max(0, Math.min(1, (temp - 22) / 10)));
432
+ };
433
+
434
+ // Creates the content of a container again. (One group is started and ended in it.)
435
+ // WHY: setDefaultContainerBox() is not in the start/end list of basic.js. One wrapper group is safe.
436
+ const renderInto = function (container, buildContent) {
437
+ if (container.wrapper) container.wrapper.remove();
438
+ const previous = getDefaultContainerBox();
439
+ setDefaultContainerBox(container);
440
+ container.wrapper = VGroup({ width: "100%", height: "auto", align: "left top", gap: 0 });
441
+ buildContent();
442
+ endGroup();
443
+ setDefaultContainerBox(previous);
444
+ };
445
+
446
+ // *** VIEW HELPERS:
447
+
448
+ const startRow = function () {
449
+ HGroup({ width: "100%", height: "auto", align: "left top", gap: 16 });
450
+ that.elem.style.flexWrap = "wrap";
451
+ that.elem.style.alignItems = "stretch"; // WHY: Cards in the same row have the same height.
452
+ };
453
+
454
+ const setFlex = function (obj, flex) {
455
+ obj.elem.style.flex = flex;
456
+ obj.elem.style.minWidth = "0";
457
+ };
458
+
459
+ const startCard = function (title, subtitle, flex) {
460
+ const cardBox = VGroup({ height: "auto", align: "left top", gap: 14, padding: 16, color: CARD_COLOR, border: 1, borderColor: CARD_BORDER_COLOR, round: 12 });
461
+ setFlex(cardBox, flex);
462
+ startSpaceBetween();
463
+ VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
464
+ Label({ text: title, fontSize: 15, textColor: Ink(0.95) });
465
+ that.elem.style.fontFamily = "opensans-bold";
466
+ if (subtitle) Label({ text: subtitle, fontSize: 12, textColor: Ink(0.45) });
467
+ endGroup();
468
+ cardBox.lblRight = Label({ text: "", fontSize: 12, textColor: Ink(0.5) });
469
+ that.elem.style.whiteSpace = "nowrap";
470
+ endGroup();
471
+ return cardBox;
472
+ };
473
+
474
+ const endCard = function () { endGroup(); };
475
+
476
+ const startSpaceBetween = function (gap = 12) {
477
+ HGroup({ width: "100%", height: "auto", align: "left center", gap: gap });
478
+ that.elem.style.justifyContent = "space-between";
479
+ };
480
+
481
+ const createSmallTitle = function (text) {
482
+ Label({ text: text.toUpperCase(), fontSize: 11, textColor: Ink(0.45) });
483
+ that.elem.style.letterSpacing = "1px";
484
+ return that;
485
+ };
486
+
487
+ const setPill = function (label, text, color) {
488
+ label.text = text;
489
+ label.textColor = color;
490
+ label.color = ChartBox.alpha(color, 0.12);
491
+ label.borderColor = ChartBox.alpha(color, 0.4);
492
+ };
493
+
494
+ const createInfoLine = function (title, first) {
495
+ startSpaceBetween();
496
+ that.elem.style.padding = "8px 0px";
497
+ if (!first) that.elem.style.borderTop = "1px solid " + Ink(0.06);
498
+ Label({ text: title, fontSize: 14, textColor: Ink(0.5) });
499
+ const value = Label({ text: "", fontSize: 14, textColor: Ink(0.9) });
500
+ that.elem.style.whiteSpace = "nowrap";
501
+ endGroup();
502
+ return value;
503
+ };
504
+
505
+ const createButton = function (text, iconFile, onClick, params = {}) {
506
+ const btn = SmartButton({
507
+ styleName: "classic",
508
+ width: params.width || "auto",
509
+ labelText: text,
510
+ iconFile: (iconFile) ? ASSETS + iconFile : "",
511
+ onClick: onClick,
512
+ style: {
513
+ layout: { gap: 10, padding: [14, 8], align: "center center" },
514
+ icon: { width: 18, height: 18 },
515
+ label: { fontSize: 14, textColor: Ink(0.9) },
516
+ box: { color: params.color || FIELD_COLOR, border: 1, borderColor: CARD_BORDER_COLOR, round: 8 },
517
+ hover: { color: params.hoverColor || T.surface3 },
518
+ active: { color: params.activeColor || T.surface4 },
519
+ },
520
+ });
521
+ if (btn.icon) btn.icon.elem.style.filter = T.iconFilter; // WHY: Panel icons are black.
522
+ return btn;
523
+ };
524
+
525
+ const createSlider = function (color, onDragMove, onDragEnd) {
526
+ return Slider({
527
+ width: 250,
528
+ trackHeight: 8,
529
+ minThumbHeight: 26,
530
+ trackColor: color,
531
+ trackBackgroundColor: Ink(0.1),
532
+ thumbColor: Ink(0.9),
533
+ showValueOnSet: 0,
534
+ showValueOnDrag: 0, // WHY: Slider shows 0-100. The real value is shown in a label.
535
+ onDragMove: onDragMove,
536
+ onDragEnd: onDragEnd,
537
+ });
538
+ };
539
+
540
+ const createToggle = function (onChange) {
541
+ return Toggle({
542
+ width: 52,
543
+ height: 30,
544
+ spacing: 3,
545
+ backgroundStyle: { color: T.surface3, selectedColor: PRIMARY_COLOR, border: 1, borderColor: CARD_BORDER_COLOR },
546
+ buttonStyle: { color: Ink(0.35), selectedColor: Ink(0.95) },
547
+ onChange: function (self) { if (!isRendering) onChange(self); },
548
+ });
549
+ };
550
+
551
+ const DARK_RADIO_STYLE = {
552
+ mark: { width: 20, height: 20, color: "transparent", borderColor: Ink(0.35) },
553
+ checkedMark: { color: "transparent", borderColor: ACCENT_COLOR },
554
+ hoverMark: { borderColor: Ink(0.7) },
555
+ dot: { color: ACCENT_COLOR },
556
+ label: { fontSize: 14, textColor: Ink(0.9) },
557
+ };
558
+
559
+ const DARK_CHECK_STYLE = {
560
+ layout: { padding: [0, 2] },
561
+ mark: { width: 18, height: 18, color: "transparent", borderColor: Ink(0.35) },
562
+ checkedMark: { color: PRIMARY_COLOR, borderColor: PRIMARY_COLOR },
563
+ hoverMark: { borderColor: Ink(0.7) },
564
+ tick: { color: Ink(1) },
565
+ label: { fontSize: 13, textColor: Ink(0.75) },
566
+ };
567
+
568
+ const PICKER_STYLE = {
569
+ field: { color: FIELD_COLOR, border: 1, borderColor: CARD_BORDER_COLOR, round: 8 },
570
+ fieldHover: { borderColor: Ink(0.3) },
571
+ fieldFocus: { borderColor: ACCENT_COLOR },
572
+ fieldText: { fontSize: 14, textColor: Ink(0.9) },
573
+ placeholder: { textColor: Ink(0.4) },
574
+ icon: { color: Ink(0.55) },
575
+ panel: { color: FIELD_COLOR, borderColor: Ink(0.12), shadow: "0 8px 24px rgba(0, 0, 0, 0.5)" },
576
+ footerButton: { textColor: ACCENT_COLOR },
577
+ };
578
+ const TIME_STYLE = Object.assign({}, PICKER_STYLE, {
579
+ columnTitle: { textColor: Ink(0.45), activeTextColor: Ink(0.9) },
580
+ cell: { textColor: Ink(0.85), hoverColor: Ink(0.08) },
581
+ selectedCell: { color: PRIMARY_COLOR, textColor: Ink(1) },
582
+ disabledCell: { textColor: Ink(0.2) },
583
+ });
584
+ const DATE_STYLE = Object.assign({}, PICKER_STYLE, {
585
+ title: { textColor: Ink(0.9) },
586
+ arrow: { color: Ink(0.6), hoverColor: Ink(0.08) },
587
+ weekDay: { textColor: Ink(0.45) },
588
+ day: { textColor: Ink(0.85), hoverColor: Ink(0.08) },
589
+ today: { borderColor: Ink(0.35) },
590
+ selectedDay: { color: PRIMARY_COLOR, textColor: Ink(1) },
591
+ disabledDay: { textColor: Ink(0.2) },
592
+ });
593
+
594
+ // *** VIEW:
595
+
596
+ const initHeader = function () {
597
+
598
+ startSpaceBetween(16);
599
+ that.elem.style.flexWrap = "wrap";
600
+
601
+ HGroup({ width: "auto", height: "auto", align: "left center", gap: 20 });
602
+ that.elem.style.flexWrap = "wrap";
603
+
604
+ VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
605
+ Label({ text: "Greenhouse", fontSize: 26, textColor: Ink(0.95) });
606
+ that.elem.style.fontFamily = "opensans-bold";
607
+ lblHouse = Label({ text: "", fontSize: 14, textColor: Ink(0.5) });
608
+ endGroup();
609
+
610
+ zoneSelect = TinySelect({
611
+ title: "Zone",
612
+ list: ZONES.map(function (z) { return { id: z.id, label: z.name }; }),
613
+ height: 40, fontSize: 15, color: CARD_COLOR, border: 1, borderColor: CARD_BORDER_COLOR, round: 8,
614
+ labelTextColor: Ink(0.95),
615
+ arrowIcon: LIB_PATH + "comp/tiny-select/arrow.svg", arrowSize: 20, invertIconColor: T.invertIcon,
616
+ listFontSize: 15, listTextColor: Ink(0.85), listOverTextColor: ACCENT_COLOR, listBackgroundColor: FIELD_COLOR, listBorderColor: Ink(0.15),
617
+ onSelect: function (index) { if (isReady) selectZone(index); },
618
+ });
619
+ zoneSelect.lblTitle.textColor = Ink(0.5);
620
+
621
+ lblStatus = Label({ text: "", fontSize: 13, round: 100, border: 1, padding: [12, 4] });
622
+ lblStatus.elem.style.whiteSpace = "nowrap";
623
+
624
+ endGroup();
625
+
626
+ HGroup({ width: "auto", height: "auto", align: "right center", gap: 16 });
627
+
628
+ VGroup({ width: "auto", height: "auto", align: "right center", gap: 0 });
629
+ lblClock = Label({ text: "", fontSize: 22, textColor: Ink(0.95) });
630
+ that.elem.style.fontVariantNumeric = "tabular-nums";
631
+ lblWeather = Label({ text: "", fontSize: 12, textColor: Ink(0.5) });
632
+ that.elem.style.whiteSpace = "nowrap";
633
+ endGroup();
634
+
635
+ const btnMore = createButton("More", "top-bar/apps.png", function () { });
636
+ moreMenu = ContextMenu({
637
+ items: [
638
+ { text: "Test: Heatwave outside", key: "heatwave" },
639
+ { text: "Test: Rain forecast", key: "rain" },
640
+ { text: "Test: Sensor fault in this zone", key: "fault" },
641
+ "-",
642
+ { text: "Download today's report (CSV)", key: "csv" },
643
+ ],
644
+ onClick: function (self, item) { onMoreMenuClick(item.key); },
645
+ style: {
646
+ menu: { color: FIELD_COLOR, borderColor: Ink(0.12), shadow: "0px 8px 24px rgba(0, 0, 0, 0.5)" },
647
+ item: { textColor: Ink(0.85) },
648
+ itemHover: { textColor: Ink(1), color: Ink(0.08) },
649
+ disabled: { textColor: Ink(0.3) },
650
+ separator: { color: Ink(0.1) },
651
+ },
652
+ });
653
+ moreMenu.attachTo(btnMore, "click");
654
+
655
+ endGroup();
656
+
657
+ endGroup();
658
+
659
+ };
660
+
661
+ const initAlert = function () {
662
+ alertBox = HGroup({
663
+ width: "100%", height: "auto", align: "left center", gap: 12, padding: [16, 12],
664
+ color: "rgba(230, 103, 103, 0.10)", border: 1, borderColor: "rgba(230, 103, 103, 0.45)", round: 12, visible: 0,
665
+ });
666
+ that.elem.style.flexWrap = "wrap";
667
+ lblAlert = Label({ text: "", fontSize: 14, textColor: Ink(0.9) });
668
+ lblAlert.elem.style.flex = "1 1 300px";
669
+ endGroup();
670
+ };
671
+
672
+ const initHeroRow = function () {
673
+
674
+ startRow();
675
+
676
+ startCard("Greenhouse Map", "Click a bay to select it", "2 1 520px");
677
+
678
+ mapBox = Box({ width: "100%", height: "auto", color: "transparent", clickable: 1 });
679
+ mapBox.position = "relative";
680
+ mapBox.elem.innerHTML = createMapSvg();
681
+ map.svg = mapBox.elem.querySelector("svg");
682
+ ZONES.forEach(function (z, index) {
683
+ const g = map.svg.querySelector("#zone-" + z.id);
684
+ g.style.cursor = "pointer";
685
+ g.addEventListener("click", function () { zoneSelect.setSelectedIndex(index); });
686
+ });
687
+
688
+ HGroup({ width: "100%", height: "auto", align: "left center", gap: 14 });
689
+ that.elem.style.flexWrap = "wrap";
690
+ Label({ text: "<span style='color:" + LIGHT_COLOR + "'>■</span> Lights on", fontSize: 12, textColor: Ink(0.55) });
691
+ Label({ text: "<span style='color:" + HUMIDITY_COLOR + "'>●</span> Irrigating", fontSize: 12, textColor: Ink(0.55) });
692
+ Label({ text: "<span style='color:" + Ink(0.6) + "'>◐</span> Fan", fontSize: 12, textColor: Ink(0.55) });
693
+ Label({ text: "<span style='color:" + Ink(0.6) + "'>▨</span> Shade screen", fontSize: 12, textColor: Ink(0.55) });
694
+ Label({ text: "Fill color: temperature (blue → green → red)", fontSize: 12, textColor: Ink(0.4) });
695
+ endGroup();
696
+
697
+ endCard();
698
+
699
+ startCard("Zone Sensors", "", "1 1 300px");
700
+
701
+ VGroup({ width: "100%", height: "auto", align: "left top", gap: 0 });
702
+ zoneInfo.temp = createInfoLine("Temperature", 1);
703
+ zoneInfo.humidity = createInfoLine("Humidity");
704
+ zoneInfo.soil = createInfoLine("Soil moisture");
705
+ zoneInfo.co2 = createInfoLine("CO₂");
706
+ zoneInfo.light = createInfoLine("Light (PAR)");
707
+ zoneInfo.vent = createInfoLine("Roof vents");
708
+ zoneInfo.setpoint = createInfoLine("Setpoint now");
709
+ endGroup();
710
+
711
+ endCard();
712
+
713
+ endGroup();
714
+
715
+ };
716
+
717
+ const initKpiRow = function () {
718
+
719
+ const KPI_LIST = [
720
+ { title: "Average temperature", iconFile: "light.png", lineColor: TEMP_COLOR, maxValue: 0 },
721
+ { title: "Water today", iconFile: "maybe.png", lineColor: HUMIDITY_COLOR, maxValue: 0 },
722
+ { title: "Energy today", iconFile: "left-menu/bolt.png", lineColor: LIGHT_COLOR, maxValue: 0 },
723
+ { title: "Active alarms", iconFile: "warning.png", lineColor: ERROR_COLOR, maxValue: 0 },
724
+ ];
725
+
726
+ startRow();
727
+ KPI_LIST.forEach(function (kpi) {
728
+ const kpiBox = SparkLineBox({
729
+ height: 100, title: kpi.title, valueText: "", iconFile: ASSETS + kpi.iconFile, lineColor: kpi.lineColor, maxValue: kpi.maxValue,
730
+ style: {
731
+ box: { color: CARD_COLOR, border: 1, borderColor: CARD_BORDER_COLOR, round: 12 },
732
+ text: { padding: 14 },
733
+ title: { fontSize: 13, textColor: Ink(0.5) },
734
+ valueText: { fontSize: 24, textColor: Ink(0.95) },
735
+ trend: { flatColor: Ink(0.45) }, // WHY: The default flat color is made for light cards.
736
+ icon: { width: 20, height: 20 },
737
+ graph: { height: 34, padding: 14 },
738
+ },
739
+ });
740
+ setFlex(kpiBox, "1 1 220px");
741
+ kpiBox.icon.elem.style.filter = T.iconFilter;
742
+ kpiBox.icon.opacity = 0.5;
743
+ kpiBoxList.push(kpiBox);
744
+ });
745
+ endGroup();
746
+
747
+ };
748
+
749
+ const initChartRow = function () {
750
+
751
+ startRow();
752
+
753
+ chartClimate = ChartBox({
754
+ height: 320, type: "line", theme: T.chartTheme,
755
+ title: "Zone Climate Today", subtitle: "Every 15 minutes",
756
+ beginAtZero: 0, animated: 0, legend: "top",
757
+ labels: [],
758
+ datasets: [
759
+ { label: "Temperature (°C)", data: [], borderColor: TEMP_COLOR, tension: 0.35, yAxisID: "y" },
760
+ { label: "Humidity (%)", data: [], borderColor: HUMIDITY_COLOR, tension: 0.35, yAxisID: "y1" },
761
+ { label: "Soil (%)", data: [], borderColor: SOIL_COLOR, tension: 0.35, borderDash: [5, 4], yAxisID: "y1" },
762
+ ],
763
+ options: {
764
+ elements: { point: { radius: 0 } },
765
+ interaction: { mode: "index", intersect: false },
766
+ scales: {
767
+ x: { ticks: { maxTicksLimit: 8 } },
768
+ y: { position: "left", suggestedMin: 10, suggestedMax: 35, title: { display: true, text: "°C" } },
769
+ y1: { position: "right", min: 0, max: 100, grid: { drawOnChartArea: false }, title: { display: true, text: "%" } },
770
+ },
771
+ },
772
+ style: {
773
+ box: { color: CARD_COLOR, borderColor: CARD_BORDER_COLOR, round: 12, padding: 16 },
774
+ chart: { colors: [TEMP_COLOR, HUMIDITY_COLOR, SOIL_COLOR] },
775
+ },
776
+ });
777
+ setFlex(chartClimate, "2 1 520px");
778
+ chartClimate.elem.style.height = "auto";
779
+ chartClimate.elem.style.minHeight = "320px";
780
+
781
+ chartRuntime = ChartBox({
782
+ height: 320, type: "bar", theme: T.chartTheme, horizontal: 1,
783
+ title: "Actuator Runtime Today", subtitle: "Minutes, selected zone",
784
+ labels: ["Heater", "Fan", "Lights", "Irrigation", "CO₂"],
785
+ values: [0, 0, 0, 0, 0],
786
+ formatValue: function (value) { return value + " min"; },
787
+ style: {
788
+ box: { color: CARD_COLOR, borderColor: CARD_BORDER_COLOR, round: 12, padding: 16 },
789
+ chart: { colors: [ACCENT_COLOR] },
790
+ },
791
+ });
792
+ setFlex(chartRuntime, "1 1 280px");
793
+
794
+ endGroup();
795
+
796
+ };
797
+
798
+ const initControlRow = function () {
799
+
800
+ startRow();
801
+
802
+ // SETPOINTS & MODE
803
+ startCard("Climate Setpoints", "Auto mode keeps these", "1 1 300px");
804
+
805
+ VGroup({ width: "100%", height: "auto", align: "left top", gap: 10 });
806
+ MODES.forEach(function (mode) {
807
+ RadioButton({
808
+ group: "zoneMode", value: mode.value,
809
+ labelText: mode.text + " <span style='color:" + Ink(0.4) + "; font-size: 12px'>" + mode.desc + "</span>",
810
+ style: DARK_RADIO_STYLE,
811
+ onChange: function (self) { if (isRendering) return; setMode(zone, self.value); renderAll(); },
812
+ });
813
+ });
814
+ endGroup();
815
+
816
+ lblModeInfo = Label({ text: "", fontSize: 12, textColor: Ink(0.45), width: "100%" });
817
+
818
+ [
819
+ { key: "dayTemp", title: "Day temperature", color: TEMP_COLOR, min: 15, max: 32, unit: " °C" },
820
+ { key: "nightTemp", title: "Night temperature", color: "#B8683A", min: 10, max: 25, unit: " °C" },
821
+ { key: "humidityMax", title: "Humidity limit", color: HUMIDITY_COLOR, min: 50, max: 95, unit: "%" },
822
+ { key: "soilMin", title: "Irrigate below soil", color: SOIL_COLOR, min: 20, max: 70, unit: "%" },
823
+ ].forEach(function (item, index) {
824
+ VGroup({ width: "100%", height: "auto", align: "left top", gap: 8 });
825
+ if (index === 0) { that.elem.style.borderTop = "1px solid " + Ink(0.06); that.elem.style.paddingTop = "14px"; }
826
+ startSpaceBetween();
827
+ createSmallTitle(item.title);
828
+ setpointLabels[item.key] = Label({ text: "", fontSize: 15, textColor: Ink(0.95) });
829
+ that.elem.style.fontFamily = "opensans-bold";
830
+ endGroup();
831
+ setpointSliders[item.key] = createSlider(item.color,
832
+ function (value) { setpointLabels[item.key].text = sliderToRange(value, item.min, item.max) + item.unit; },
833
+ function () {
834
+ const v = sliderToRange(setpointSliders[item.key].getValue(), item.min, item.max);
835
+ if (v === zone.setpoints[item.key]) return;
836
+ zone.setpoints[item.key] = v;
837
+ setpointLabels[item.key].text = v + item.unit;
838
+ addEvent(zone, "Info", item.title + " set to " + v + item.unit);
839
+ renderLive();
840
+ }
841
+ );
842
+ setpointSliders[item.key].range = item;
843
+ endGroup();
844
+ });
845
+
846
+ endCard();
847
+
848
+ // ACTUATORS
849
+ startCard("Actuators", "Switch them in Manual mode", "1 1 300px");
850
+
851
+ VGroup({ width: "100%", height: "auto", align: "left top", gap: 0 });
852
+ ACTUATORS.forEach(function (item, index) {
853
+ startSpaceBetween();
854
+ that.elem.style.padding = "9px 0px";
855
+ if (index > 0) that.elem.style.borderTop = "1px solid " + Ink(0.06);
856
+ HGroup({ width: "auto", height: "auto", align: "left center", gap: 10 });
857
+ actuatorStates[item.key] = Box({ width: 10, height: 10, round: 100, color: Ink(0.2) });
858
+ actuatorStates[item.key].setMotion("background-color 0.3s");
859
+ VGroup({ width: "auto", height: "auto", align: "left top", gap: 0 });
860
+ Label({ text: item.title, fontSize: 14, textColor: Ink(0.9) });
861
+ Label({ text: item.desc, fontSize: 12, textColor: Ink(0.45) });
862
+ endGroup();
863
+ endGroup();
864
+ actuatorToggles[item.key] = createToggle(function (self) {
865
+ setActuator(zone, item.key, self.value, "manual");
866
+ renderLive();
867
+ });
868
+ endGroup();
869
+ });
870
+ endGroup();
871
+
872
+ VGroup({ width: "100%", height: "auto", align: "left top", gap: 8 });
873
+ that.elem.style.borderTop = "1px solid " + Ink(0.06);
874
+ that.elem.style.paddingTop = "14px";
875
+ startSpaceBetween();
876
+ createSmallTitle("Roof vents");
877
+ lblVent = Label({ text: "", fontSize: 15, textColor: Ink(0.95) });
878
+ that.elem.style.fontFamily = "opensans-bold";
879
+ endGroup();
880
+ sliderVent = createSlider(ACCENT_COLOR,
881
+ function (value) { lblVent.text = Math.round(value / 10) * 10 + "% open"; },
882
+ function () {
883
+ const v = Math.round(sliderVent.getValue() / 10) * 10;
884
+ if (v === zone.vent) return;
885
+ zone.vent = v;
886
+ addEvent(zone, "Info", "Roof vents set to " + v + "% (manual)");
887
+ renderLive();
888
+ }
889
+ );
890
+ endGroup();
891
+
892
+ endCard();
893
+
894
+ // LIGHT, WATER & NUTRIENTS
895
+ startCard("Light, Water & Nutrients", "", "1 1 300px");
896
+
897
+ createSmallTitle("Grow light schedule");
898
+ HGroup({ width: "100%", height: "auto", align: "left center", gap: 10 });
899
+ that.elem.style.flexWrap = "wrap";
900
+ selectLightFrom = SelectTime({
901
+ width: 116, height: 38, minuteStep: 30, showClearButton: 0, style: TIME_STYLE,
902
+ onChange: function (self) { if (isRendering || !self.value) return; zone.lightFrom = self.value; addEvent(zone, "Info", "Lights schedule from " + self.value); },
903
+ });
904
+ Label({ text: "to", fontSize: 13, textColor: Ink(0.5) });
905
+ selectLightTo = SelectTime({
906
+ width: 116, height: 38, minuteStep: 30, showClearButton: 0, style: TIME_STYLE,
907
+ onChange: function (self) { if (isRendering || !self.value) return; zone.lightTo = self.value; addEvent(zone, "Info", "Lights schedule to " + self.value); },
908
+ });
909
+ endGroup();
910
+ Label({ text: "Lights turn on in this window when the natural light is below 600 µmol.", fontSize: 12, textColor: Ink(0.45), width: "100%" });
911
+
912
+ VGroup({ width: "100%", height: "auto", align: "left top", gap: 8 });
913
+ that.elem.style.borderTop = "1px solid " + Ink(0.06);
914
+ that.elem.style.paddingTop = "14px";
915
+ startSpaceBetween();
916
+ createSmallTitle("Irrigation run time");
917
+ lblIrrigation = Label({ text: "", fontSize: 15, textColor: Ink(0.95) });
918
+ that.elem.style.fontFamily = "opensans-bold";
919
+ endGroup();
920
+ sliderIrrigation = createSlider(HUMIDITY_COLOR,
921
+ function (value) { lblIrrigation.text = sliderToRange(value, 2, 20) + " min"; },
922
+ function () {
923
+ const v = sliderToRange(sliderIrrigation.getValue(), 2, 20);
924
+ if (v === zone.irrigationMinutes) return;
925
+ zone.irrigationMinutes = v;
926
+ addEvent(zone, "Info", "Irrigation run time set to " + v + " min");
927
+ }
928
+ );
929
+ chkRain = CheckBox({
930
+ labelText: "Skip irrigation when rain is forecast",
931
+ style: DARK_CHECK_STYLE,
932
+ onChange: function (self) { if (isRendering) return; zone.skipRain = self.checked; addEvent(zone, "Info", "Skip on rain " + ((self.checked) ? "on" : "off")); },
933
+ });
934
+ endGroup();
935
+
936
+ VGroup({ width: "100%", height: "auto", align: "left top", gap: 10 });
937
+ that.elem.style.borderTop = "1px solid " + Ink(0.06);
938
+ that.elem.style.paddingTop = "14px";
939
+ createSmallTitle("Nutrient solution");
940
+ lblNutrients = Label({ text: "", fontSize: 14, textColor: Ink(0.9), width: "100%" });
941
+ HGroup({ width: "100%", height: "auto", align: "left center", gap: 8 });
942
+ that.elem.style.flexWrap = "wrap";
943
+ btnDoseAcid = createButton("Dose pH Down", "", function () { dose(zone, "acid"); });
944
+ btnDoseNutrient = createButton("Dose Nutrients", "", function () { dose(zone, "nutrient"); });
945
+ endGroup();
946
+ endGroup();
947
+
948
+ endCard();
949
+
950
+ endGroup();
951
+
952
+ };
953
+
954
+ const initBottomRow = function () {
955
+
956
+ startRow();
957
+
958
+ startCard("Alarms", "Active in this zone", "1 1 300px");
959
+ grpAlarmsHost = VGroup({ width: "100%", height: "auto", align: "left top", gap: 0 });
960
+ endGroup();
961
+ endCard();
962
+
963
+ startCard("Crop & Harvest", "", "1 1 300px");
964
+ grpCropHost = VGroup({ width: "100%", height: "auto", align: "left top", gap: 0 });
965
+ endGroup();
966
+ endCard();
967
+
968
+ startCard("Events", "", "1 1 300px");
969
+ grpEventHost = VGroup({ width: "100%", height: "auto", align: "left top", gap: 0 });
970
+ endGroup();
971
+ endCard();
972
+
973
+ endGroup();
974
+
975
+ };
976
+
977
+ // *** SVG:
978
+
979
+ // Top-down map: 4 bays in 2 rows. Each bay: fill (temperature), roof vent lines, plant rows, lights, water, fan, shade.
980
+ const BAY = { w: 290, h: 150, gapX: 20, gapY: 20, x0: 20, y0: 20 };
981
+
982
+ const createMapSvg = function () {
983
+
984
+ let bays = "";
985
+
986
+ ZONES.forEach(function (z, index) {
987
+
988
+ const x = BAY.x0 + (index % 2) * (BAY.w + BAY.gapX);
989
+ const y = BAY.y0 + Math.floor(index / 2) * (BAY.h + BAY.gapY);
990
+ const id = z.id;
991
+
992
+ // Plant rows
993
+ let plants = "";
994
+ for (let r = 0; r < z.rows; r++) {
995
+ const py = y + 42 + r * ((BAY.h - 60) / (z.rows - 1));
996
+ for (let p = 0; p < 12; p++) {
997
+ const px = x + 24 + p * ((BAY.w - 48) / 11);
998
+ plants += "<circle cx='" + px.toFixed(1) + "' cy='" + py.toFixed(1) + "' r='" + ((z.crop === "Seedlings") ? 2 : 3.5) + "' fill='" + z.color + "' opacity='0.8'/>";
999
+ }
1000
+ }
1001
+
1002
+ bays += "<g id='zone-" + id + "'>" +
1003
+ "<rect id='fill-" + id + "' x='" + x + "' y='" + y + "' width='" + BAY.w + "' height='" + BAY.h + "' rx='10' fill='" + tempColor(z.temp) + "' style='transition: fill 1s'/>" + // WHY: The first paint must not wait for the fill transition.
1004
+ "<rect id='shade-" + id + "' x='" + x + "' y='" + y + "' width='" + BAY.w + "' height='" + BAY.h + "' rx='10' fill='url(#hatch)' style='opacity:0; transition: opacity 0.5s'/>" +
1005
+ "<rect id='light-" + id + "' x='" + x + "' y='" + y + "' width='" + BAY.w + "' height='" + BAY.h + "' rx='10' fill='" + LIGHT_COLOR + "' style='opacity:0; transition: opacity 0.5s'/>" +
1006
+ plants +
1007
+ // Roof vents: two flaps on the top edge, they lift with the vent %
1008
+ "<g id='vent-" + id + "' style='transform-origin:" + (x + 60) + "px " + (y + 4) + "px'>" +
1009
+ "<line x1='" + (x + 60) + "' y1='" + (y + 4) + "' x2='" + (x + 130) + "' y2='" + (y + 4) + "' stroke='" + Ink(0.7) + "' stroke-width='3' stroke-linecap='round' style='transition: transform 0.6s; transform-origin:" + (x + 60) + "px " + (y + 4) + "px' id='ventL-" + id + "'/>" +
1010
+ "<line x1='" + (x + BAY.w - 60) + "' y1='" + (y + 4) + "' x2='" + (x + BAY.w - 130) + "' y2='" + (y + 4) + "' stroke='" + Ink(0.7) + "' stroke-width='3' stroke-linecap='round' style='transition: transform 0.6s; transform-origin:" + (x + BAY.w - 60) + "px " + (y + 4) + "px' id='ventR-" + id + "'/>" +
1011
+ "</g>" +
1012
+ // Water drops
1013
+ "<g id='water-" + id + "' style='opacity:0; transition: opacity 0.4s'>" +
1014
+ [0, 1, 2].map(function (i) { return "<path d='M" + (x + BAY.w - 40 + i * 12) + " " + (y + BAY.h - 34) + " q-5 8 0 12 q5 -4 0 -12z' fill='" + HUMIDITY_COLOR + "' class='drop' style='animation-delay:" + (i * 0.3) + "s'/>"; }).join("") +
1015
+ "</g>" +
1016
+ // Fan
1017
+ "<g id='fan-" + id + "' style='transform-origin:" + (x + 26) + "px " + (y + BAY.h - 26) + "px'>" +
1018
+ "<circle cx='" + (x + 26) + "' cy='" + (y + BAY.h - 26) + "' r='11' fill='" + Black(0.4) + "' stroke='" + Ink(0.4) + "'/>" +
1019
+ "<path d='M" + (x + 26) + " " + (y + BAY.h - 26) + " l0 -9 a9 9 0 0 1 8 5 z M" + (x + 26) + " " + (y + BAY.h - 26) + " l8 4 a9 9 0 0 1 -8 5 z M" + (x + 26) + " " + (y + BAY.h - 26) + " l-8 4 a9 9 0 0 1 0 -9 z' fill='" + Ink(0.75) + "'/>" +
1020
+ "</g>" +
1021
+ // Labels
1022
+ "<text x='" + (x + 14) + "' y='" + (y + 26) + "' class='t-name'>" + escapeHtml(z.name) + "</text>" +
1023
+ "<text id='temp-" + id + "' x='" + (x + BAY.w - 14) + "' y='" + (y + 27) + "' text-anchor='end' class='t-value'></text>" +
1024
+ "<text id='sub-" + id + "' x='" + (x + 46) + "' y='" + (y + BAY.h - 21) + "' class='t-sub'></text>" +
1025
+ "<rect id='frame-" + id + "' x='" + x + "' y='" + y + "' width='" + BAY.w + "' height='" + BAY.h + "' rx='10' fill='none' stroke='" + Ink(0.12) + "' stroke-width='2' style='transition: stroke 0.3s'/>" +
1026
+ "</g>";
1027
+
1028
+ });
1029
+
1030
+ const W = BAY.x0 * 2 + BAY.w * 2 + BAY.gapX, H = BAY.y0 * 2 + BAY.h * 2 + BAY.gapY;
1031
+
1032
+ return "<svg viewBox='0 0 " + W + " " + H + "' style='display:block; width:100%; height:auto; font-family:inherit'>" +
1033
+ "<style>" +
1034
+ ".t-name { fill:" + Ink(0.95) + "; font-size:14px; font-weight:bold; }" +
1035
+ ".t-value { fill:" + Ink(0.95) + "; font-size:15px; font-weight:bold; }" +
1036
+ ".t-sub { fill:" + Ink(0.75) + "; font-size:11px; }" +
1037
+ ".fan-on { animation: spin 0.8s linear infinite; }" +
1038
+ "@keyframes spin { to { transform: rotate(360deg); } }" +
1039
+ ".drop { animation: drip 1.2s ease-in infinite; }" +
1040
+ "@keyframes drip { 0% { transform: translateY(-6px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(8px); opacity: 0; } }" +
1041
+ "</style>" +
1042
+ "<defs><pattern id='hatch' width='8' height='8' patternUnits='userSpaceOnUse' patternTransform='rotate(45)'>" +
1043
+ "<line x1='0' y1='0' x2='0' y2='8' stroke='" + Black(0.5) + "' stroke-width='4'/></pattern></defs>" +
1044
+ bays +
1045
+ "</svg>";
1046
+
1047
+ };
1048
+
1049
+ // *** VALUE CONVERTERS:
1050
+
1051
+ const sliderToRange = function (value, min, max) {
1052
+ return Math.round(min + value / 100 * (max - min));
1053
+ };
1054
+
1055
+ const rangeToSlider = function (v, min, max) {
1056
+ return (v - min) / (max - min) * 100;
1057
+ };
1058
+
1059
+ // *** ACTIONS:
1060
+
1061
+ const onMoreMenuClick = function (key) {
1062
+ switch (key) {
1063
+ case "heatwave":
1064
+ house.heatwave = (house.heatwave) ? 0 : 1;
1065
+ addEvent(zone, "Warning", (house.heatwave) ? "Test: heatwave outside (+9 °C)" : "Test: heatwave ended");
1066
+ renderLive();
1067
+ break;
1068
+ case "rain":
1069
+ house.rainForecast = (house.rainForecast) ? 0 : 1;
1070
+ addEvent(zone, "Info", (house.rainForecast) ? "Test: rain is forecast for today" : "Test: rain forecast cleared");
1071
+ renderLive();
1072
+ break;
1073
+ case "fault":
1074
+ zone.sensorFault = (zone.sensorFault) ? 0 : 1;
1075
+ addEvent(zone, (zone.sensorFault) ? "Error" : "Success", (zone.sensorFault) ? "Test: temperature sensor stopped updating" : "Test: sensor is back");
1076
+ renderLive();
1077
+ break;
1078
+ case "csv":
1079
+ downloadReport();
1080
+ break;
1081
+ }
1082
+ };
1083
+
1084
+ const downloadReport = function () {
1085
+ const lines = ["zone,crop,temp_c,humidity,soil,co2_ppm,ph,ec,mode,heater_min,lights_min,irrigation_min,alarms"];
1086
+ ZONES.forEach(function (z) {
1087
+ lines.push([z.name, z.crop, z.temp.toFixed(1), Math.round(z.humidity), Math.round(z.soil), Math.round(z.co2), z.ph.toFixed(1), z.ec.toFixed(1), z.mode, z.runtime.heater, z.runtime.lights, z.runtime.irrigation, Object.keys(z.alarms).length].join(","));
1088
+ });
1089
+ const link = document.createElement("a");
1090
+ link.href = URL.createObjectURL(new Blob([lines.join("\n")], { type: "text/csv" }));
1091
+ link.download = "greenhouse-report.csv";
1092
+ link.click();
1093
+ URL.revokeObjectURL(link.href);
1094
+ };
1095
+
1096
+ // *** RENDER:
1097
+
1098
+ const selectZone = function (index) {
1099
+
1100
+ zone = ZONES[index];
1101
+
1102
+ chartClimate.whenReady(function () {
1103
+ chartClimate.data.labels = zone.chart.labels.slice();
1104
+ chartClimate.data.datasets[0].data = zone.chart.temp.slice();
1105
+ chartClimate.data.datasets[1].data = zone.chart.humidity.slice();
1106
+ chartClimate.data.datasets[2].data = zone.chart.soil.slice();
1107
+ chartClimate.update("none");
1108
+ });
1109
+
1110
+ renderAll();
1111
+
1112
+ };
1113
+
1114
+ const renderAll = function () {
1115
+ renderHeader();
1116
+ renderAlert();
1117
+ renderMap();
1118
+ renderSensors();
1119
+ renderKpis();
1120
+ renderControls();
1121
+ renderActuators();
1122
+ renderSchedule();
1123
+ renderNutrients();
1124
+ renderAlarms();
1125
+ renderCrop();
1126
+ renderEvents();
1127
+ };
1128
+
1129
+ // Every minute (tick)
1130
+ const renderLive = function () {
1131
+ renderHeader();
1132
+ renderAlert();
1133
+ renderMap();
1134
+ renderSensors();
1135
+ renderKpis();
1136
+ renderActuators();
1137
+ renderAlarms();
1138
+ if (simMinute % CHART_STEP === 0) renderCharts();
1139
+ };
1140
+
1141
+ const getStatus = function (z) {
1142
+ const count = Object.keys(z.alarms).length;
1143
+ if (count) return { text: count + " alarm" + ((count > 1) ? "s" : ""), color: ERROR_COLOR };
1144
+ if (z.mode === "manual") return { text: "Manual", color: WARNING_COLOR };
1145
+ return { text: "Auto · OK", color: ACCENT_COLOR };
1146
+ };
1147
+
1148
+ const renderHeader = function () {
1149
+ lblHouse.text = house.name + " · " + ZONES.length + " zones · " + escapeHtml(zone.crop);
1150
+ const status = getStatus(zone);
1151
+ setPill(lblStatus, "● " + status.text, status.color);
1152
+ lblClock.text = formatMinute(simMinute);
1153
+ const sky = (!isDay(simMinute)) ? "☾ Night" : (house.sun > 0.75) ? "☀ Sunny" : "⛅ Morning / evening sun";
1154
+ lblWeather.text = sky + " · Outside " + house.outsideTemp.toFixed(0) + " °C" + ((house.heatwave) ? " (heatwave)" : "") + ((house.rainForecast) ? " · Rain forecast" : "") + " · 1 s = 1 min";
1155
+ };
1156
+
1157
+ const renderAlert = function () {
1158
+ const list = [];
1159
+ ZONES.forEach(function (z) {
1160
+ Object.keys(z.alarms).forEach(function (key) {
1161
+ list.push("<b>" + escapeHtml(z.name) + "</b>: " + ALARM_RULES.find(function (r) { return r.key === key; }).text);
1162
+ });
1163
+ });
1164
+ alertBox.visible = (list.length) ? 1 : 0;
1165
+ lblAlert.text = list.join(" · ");
1166
+ };
1167
+
1168
+ const renderMap = function () {
1169
+ ZONES.forEach(function (z) {
1170
+ const id = z.id, s = map.svg, a = z.actuators;
1171
+ s.querySelector("#fill-" + id).setAttribute("fill", tempColor(z.temp));
1172
+ s.querySelector("#shade-" + id).style.opacity = (a.shade) ? 0.6 : 0;
1173
+ s.querySelector("#light-" + id).style.opacity = (a.lights) ? 0.22 : 0;
1174
+ s.querySelector("#water-" + id).style.opacity = (a.irrigation) ? 1 : 0;
1175
+ const angle = -z.vent / 100 * 40;
1176
+ s.querySelector("#ventL-" + id).style.transform = "rotate(" + angle + "deg)";
1177
+ s.querySelector("#ventR-" + id).style.transform = "rotate(" + (-angle) + "deg)";
1178
+ const fan = s.querySelector("#fan-" + id);
1179
+ if (a.fan) fan.classList.add("fan-on"); else fan.classList.remove("fan-on");
1180
+ s.querySelector("#temp-" + id).textContent = ((z.sensorFault) ? "?" : z.temp.toFixed(1)) + " °C";
1181
+ s.querySelector("#sub-" + id).textContent = Math.round(z.humidity) + "% RH · soil " + Math.round(z.soil) + "% · vents " + z.vent + "%";
1182
+ const alarmCount = Object.keys(z.alarms).length;
1183
+ s.querySelector("#frame-" + id).setAttribute("stroke", (alarmCount) ? ERROR_COLOR : (z === zone) ? Ink(0.9) : Ink(0.12));
1184
+ s.querySelector("#frame-" + id).setAttribute("stroke-width", (z === zone) ? 3 : 2);
1185
+ });
1186
+ };
1187
+
1188
+ const renderSensors = function () {
1189
+ const z = zone;
1190
+ zoneInfo.temp.text = ((z.sensorFault) ? "<span style='color:" + ERROR_COLOR + "'>sensor fault</span>" : z.temp.toFixed(1) + " °C");
1191
+ zoneInfo.humidity.text = Math.round(z.humidity) + "%";
1192
+ zoneInfo.soil.text = Math.round(z.soil) + "%" + ((z.actuators.irrigation) ? " <span style='color:" + HUMIDITY_COLOR + "'>· watering</span>" : "");
1193
+ zoneInfo.co2.text = Math.round(z.co2) + " ppm";
1194
+ zoneInfo.light.text = z.light + " µmol";
1195
+ zoneInfo.vent.text = z.vent + "% open";
1196
+ zoneInfo.setpoint.text = getSetpoint(z) + " °C (" + ((isDay(simMinute)) ? "day" : "night") + ")";
1197
+ };
1198
+
1199
+ const renderKpis = function () {
1200
+ const h = house.history;
1201
+ const avg = ZONES.reduce(function (s, z) { return s + z.temp; }, 0) / ZONES.length;
1202
+ const alarms = ZONES.reduce(function (s, z) { return s + Object.keys(z.alarms).length; }, 0);
1203
+ kpiBoxList[0].setValueText(avg.toFixed(1) + " °C");
1204
+ kpiBoxList[1].setValueText(Math.round(house.today.water).toLocaleString("en-US") + " L");
1205
+ kpiBoxList[2].setValueText(house.today.energy.toFixed(1) + " kWh");
1206
+ kpiBoxList[3].setValueText(String(alarms));
1207
+ kpiBoxList[0].setValues(h.temp);
1208
+ kpiBoxList[1].setValues(h.water);
1209
+ kpiBoxList[2].setValues(h.energy);
1210
+ kpiBoxList[3].setValues(h.alarms);
1211
+ };
1212
+
1213
+ const renderCharts = function () {
1214
+ chartClimate.whenReady(function () {
1215
+ chartClimate.data.labels = zone.chart.labels.slice();
1216
+ chartClimate.data.datasets[0].data = zone.chart.temp.slice();
1217
+ chartClimate.data.datasets[1].data = zone.chart.humidity.slice();
1218
+ chartClimate.data.datasets[2].data = zone.chart.soil.slice();
1219
+ chartClimate.update("none");
1220
+ });
1221
+ chartRuntime.whenReady(function () {
1222
+ const r = zone.runtime;
1223
+ chartRuntime.data.datasets[0].data = [r.heater, r.fan, r.lights, r.irrigation, r.co2];
1224
+ chartRuntime.update("none");
1225
+ });
1226
+ };
1227
+
1228
+ const renderControls = function () {
1229
+ isRendering = 1;
1230
+ RadioButton.setValue("zoneMode", zone.mode, 1);
1231
+ lblModeInfo.text = (zone.mode === "auto")
1232
+ ? "Heater, vents, fan, shade, lights, irrigation and CO₂ follow the setpoints and the schedule."
1233
+ : "The controller is off for this zone. Alarms still work.";
1234
+ Object.keys(setpointSliders).forEach(function (key) {
1235
+ const item = setpointSliders[key].range;
1236
+ setpointLabels[key].text = zone.setpoints[key] + item.unit;
1237
+ if (sliderToRange(setpointSliders[key].getValue(), item.min, item.max) !== zone.setpoints[key]) setpointSliders[key].setValue(rangeToSlider(zone.setpoints[key], item.min, item.max));
1238
+ });
1239
+ isRendering = 0;
1240
+ renderCharts();
1241
+ };
1242
+
1243
+ const renderActuators = function () {
1244
+ const z = zone, manual = (z.mode === "manual");
1245
+ isRendering = 1;
1246
+ ACTUATORS.forEach(function (item) {
1247
+ const on = z.actuators[item.key];
1248
+ if (actuatorToggles[item.key].value !== on) actuatorToggles[item.key].setValue(on);
1249
+ setInteractive(actuatorToggles[item.key], manual);
1250
+ actuatorStates[item.key].color = (on) ? ((item.key === "lights") ? LIGHT_COLOR : (item.key === "irrigation") ? HUMIDITY_COLOR : ACCENT_COLOR) : Ink(0.2);
1251
+ });
1252
+ lblVent.text = z.vent + "% open";
1253
+ if (Math.round(sliderVent.getValue() / 10) * 10 !== z.vent) sliderVent.setValue(z.vent);
1254
+ setInteractive(sliderVent, manual);
1255
+ isRendering = 0;
1256
+ };
1257
+
1258
+ const renderSchedule = function () {
1259
+ isRendering = 1;
1260
+ selectLightFrom.setTime(zone.lightFrom, 1);
1261
+ selectLightTo.setTime(zone.lightTo, 1);
1262
+ lblIrrigation.text = zone.irrigationMinutes + " min";
1263
+ if (sliderToRange(sliderIrrigation.getValue(), 2, 20) !== zone.irrigationMinutes) sliderIrrigation.setValue(rangeToSlider(zone.irrigationMinutes, 2, 20));
1264
+ chkRain.setChecked((zone.skipRain) ? 1 : 0, 1);
1265
+ isRendering = 0;
1266
+ };
1267
+
1268
+ const renderNutrients = function () {
1269
+ const z = zone;
1270
+ const phState = (z.ph > 6.5) ? "<span style='color:" + WARNING_COLOR + "'>high, dose pH down</span>" : (z.ph < 5.5) ? "<span style='color:" + WARNING_COLOR + "'>low</span>" : "<span style='color:" + ACCENT_COLOR + "'>ok</span>";
1271
+ const ecState = (z.ec < 1.2) ? "<span style='color:" + WARNING_COLOR + "'>low, dose nutrients</span>" : "<span style='color:" + ACCENT_COLOR + "'>ok</span>";
1272
+ lblNutrients.text = "pH <b>" + z.ph.toFixed(1) + "</b> (" + phState + ") · EC <b>" + z.ec.toFixed(1) + " mS/cm</b> (" + ecState + ")";
1273
+ };
1274
+
1275
+ const renderAlarms = function () {
1276
+ const keys = Object.keys(zone.alarms);
1277
+ renderInto(grpAlarmsHost, function () {
1278
+ if (!keys.length) {
1279
+ Label({ text: "No active alarms. Rules: ±6 °C from the setpoint, humidity limit +10%, soil below 10%, sensor fault.", fontSize: 13, textColor: Ink(0.45), width: "100%" });
1280
+ return;
1281
+ }
1282
+ keys.forEach(function (key, index) {
1283
+ const rule = ALARM_RULES.find(function (r) { return r.key === key; });
1284
+ HGroup({ width: "100%", height: "auto", align: "left center", gap: 10 });
1285
+ that.elem.style.padding = "8px 0px";
1286
+ if (index > 0) that.elem.style.borderTop = "1px solid " + Ink(0.06);
1287
+ Box({ width: 10, height: 10, round: 100, color: ERROR_COLOR });
1288
+ Label({ text: rule.text, fontSize: 14, textColor: Ink(0.9) });
1289
+ endGroup();
1290
+ });
1291
+ });
1292
+ };
1293
+
1294
+ const renderCrop = function () {
1295
+ const z = zone;
1296
+ renderInto(grpCropHost, function () {
1297
+
1298
+ createInfoLine("Crop", 1).text = escapeHtml(z.crop) + " · " + z.rows + " rows";
1299
+ createInfoLine("Days since planting").text = z.daysSincePlanted + " / " + z.harvestDays;
1300
+ const daysLeft = Math.max(0, z.harvestDays - z.daysSincePlanted);
1301
+ createInfoLine("Expected harvest").text = (daysLeft) ? "in " + daysLeft + " day" + ((daysLeft > 1) ? "s" : "") : "<span style='color:" + ACCENT_COLOR + "'>ready</span>";
1302
+
1303
+ VGroup({ width: "100%", height: "auto", align: "left top", gap: 6 });
1304
+ that.elem.style.padding = "10px 0px";
1305
+ harvestProgress = ProgressBar({
1306
+ width: "100%", value: Math.min(100, z.daysSincePlanted / z.harvestDays * 100), styleName: "modern",
1307
+ valueFormat: function (self) { return Math.round(self.value) + "%"; },
1308
+ style: { track: { height: 10, color: Ink(0.08) }, bar: { color: z.color }, valueText: { fontSize: 13, textColor: Ink(0.6) } },
1309
+ });
1310
+ harvestProgress.setTitleText("Growth");
1311
+ endGroup();
1312
+
1313
+ HGroup({ width: "100%", height: "auto", align: "left center", gap: 10 });
1314
+ that.elem.style.padding = "8px 0px";
1315
+ that.elem.style.borderTop = "1px solid " + Ink(0.06);
1316
+ that.elem.style.justifyContent = "space-between";
1317
+ Label({ text: "Planted", fontSize: 14, textColor: Ink(0.5) });
1318
+ selectPlanted = SelectDate({
1319
+ width: 150, height: 36, format: "DD MMM YYYY", date: z.planted, maxDate: new Date(),
1320
+ showClearButton: 0, style: DATE_STYLE,
1321
+ onChange: function (self) {
1322
+ if (!self.value) return;
1323
+ zone.planted = self.value;
1324
+ zone.daysSincePlanted = Math.max(0, Math.round((new Date() - new Date(self.value)) / 86400000));
1325
+ addEvent(zone, "Info", "Planting date set to " + self.dateText);
1326
+ renderCrop();
1327
+ },
1328
+ });
1329
+ endGroup();
1330
+
1331
+ });
1332
+ };
1333
+
1334
+ const renderEvents = function () {
1335
+ if (grpEventHost.table) { grpEventHost.table.remove(); grpEventHost.table = null; }
1336
+ const LEVEL_COLORS = { "Info": Ink(0.6), "Success": ACCENT_COLOR, "Warning": WARNING_COLOR, "Error": ERROR_COLOR };
1337
+ const previous = getDefaultContainerBox();
1338
+ setDefaultContainerBox(grpEventHost);
1339
+ grpEventHost.table = TinyTable({
1340
+ columns: Theme.tableColumns(["TIME", "LEVEL", "MESSAGE"], ["16%", "18%", "65%"]),
1341
+ rows: zone.events.slice(0, 10).map(function (e) { return [e.time, e.level, e.message]; }),
1342
+ allowHtml: 1, // (the texts are made by the panel, user texts are escaped)
1343
+ style: Theme.tableStyle({ headerColor: FIELD_COLOR, bodyColor: CARD_COLOR, borderColor: CARD_BORDER_COLOR, fontSize: 13 }),
1344
+ onCellCreate: function (cell) {
1345
+ if (cell.columnIndex === 0) cell.label.textColor = Ink(0.5);
1346
+ if (cell.columnIndex === 1) cell.label.textColor = LEVEL_COLORS[cell.value] || Ink(0.8);
1347
+ },
1348
+ });
1349
+ Theme.fillTableWidth(grpEventHost.table);
1350
+ grpEventHost.table.elem.style.minWidth = "420px";
1351
+ setDefaultContainerBox(previous);
1352
+ };
1353
+
1354
+ </script>
1355
+
1356
+ </head>
1357
+ <body>
1358
+
1359
+ <!-- HTML content -->
1360
+
1361
+ </body>
1362
+ </html>