create-basicjs 0.0.1 → 0.1.1

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