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,3767 @@
1
+ /* Bismillah */
2
+
3
+ /*
4
+
5
+ basic.js (v26.11.01) A lightweight JavaScript library for building web-based applications with simple code. No need to write HTML or CSS — just use basic JavaScript.
6
+ - Project Site: https://bug7a.github.io/basic.js/
7
+
8
+ v26.11.01 is v26.09.18 plus the additions below. Every page and component written for the
9
+ previous versions works unchanged (same defaults, same DOM), except the global names moved under
10
+ basic.* in v26.10.25 (see below).
11
+
12
+ WHAT IS NEW IN v26.11.01 (see basic/basic-what-is-new.md):
13
+ - basic: uiScale, scaleStyle(style, factor), scaleSize(value, factor): the components drawn in screen px keep
14
+ their size on a page fitted with page.fit() (their "scale" param)
15
+
16
+ WHAT IS NEW IN v26.10.27 (see basic/basic-what-is-new.md):
17
+ - basic: applyStylePackage: a package with its own "style" key is a package of params (its other keys
18
+ fill the params: an icon file outside the style can be in a package too)
19
+
20
+ WHAT IS NEW IN v26.10.25 (see basic/basic-what-is-new.md):
21
+ - Global: Alpha(color, percent) - any color made transparent, like Black(0.5) / White(0.5)
22
+ - basic: resolveTheme(themes, name) - the colors of a theme ("auto": the system setting), filled from themes.light
23
+ - MOVED: num, str, isMobile, go, twoDigitFormat -> basic.num(), basic.str(), basic.isMobile(), basic.go(),
24
+ basic.twoDigitFormat(). They are not globals any more.
25
+ - REMOVED: the old globals createBox, createButton, createLabel, createImage, createIcon, createInput,
26
+ createTextBox. Use Box(), Button(), Label(), Icon(), Input() (the same, with props).
27
+ (They are still there as basic.createBox()...)
28
+
29
+ WHAT IS NEW IN v26.10.24 (see basic/basic-what-is-new.md):
30
+ - basic: applyStylePackage(params, Comp.styles, CompDefaults) - the style packages of a component in one line
31
+
32
+ WHAT IS NEW IN v26.10.23 (for simpler components; see basic/basic-what-is-new.md):
33
+ - Cleaned in remove(): listenTo(target, event, func), onPageResize(func), after(ms, func), every(ms, func), own(obj)
34
+ - Methods: onHoverChange(func), setFocusRing(color)
35
+ - Global: createIn() returns the result of its function
36
+ - basic: isOn(), addCss()
37
+ - Props: role, aria ({ label: "Close", selected: true }), tabIndex (accessibility)
38
+ - Fix: grow, shrink and css in the props of a group are not written over by its flex styles
39
+ - Fix: rotate changes only the rotate() part of the transform (a translate or scale stays)
40
+
41
+ WHAT IS NEW IN v26.09.18 (see basic/basic-what-is-new.md for examples):
42
+ - Fixes: "100" and "50%" work for left/top/right/bottom/width/height. Children created in a hidden
43
+ HGroup/VGroup are real flex items (visible: 0 at create time). Objects created before the
44
+ page is ready throw a clear error. Timers of a removed object can not run anymore.
45
+ A page variable named like a library helper (const createButton) can not break the library.
46
+ - Props: css, cursor, zIndex, boxShadow, fontFamily, bold, italic, lineHeight, ellipsis, selectable,
47
+ grow, shrink, plainText, isRemoved, children
48
+ - Methods: show(), hide(), toggle(), once(), setSize(), setPosition(), bringToFront(), contains(), animate()
49
+ - Input: value, placeholder, inputType, maxLength, readOnly, focus(), blur(), select(), onEnter()
50
+ - Label: clipContent (0: the text is not cut at the edges)
51
+ - Icon: alt, imageFit
52
+ - Groups: wrap, justify, hug (alternative name for fit) (HGroup / VGroup / AutoLayout)
53
+ - Global: createIn(container, func) - creates objects inside an existing box, then restores the container
54
+ - page: on(), off(), onKeyDown(), title
55
+ - basic: version, isReady, sleep(), nextFrame(), clamp(), lerp(), objectOf(), escapeHtml(), storage.loadOr()
56
+
57
+ The Art of Fun Coding — With basic.js
58
+
59
+
60
+ Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com>
61
+ - https://github.com/bug7a
62
+
63
+ Licensed under the Apache License, Version 2.0
64
+
65
+ */
66
+
67
+ (function() {
68
+ "use strict";
69
+ const basic = {};
70
+
71
+ basic.version = "26.11.01";
72
+ basic.library = "basic.js";
73
+ basic.isReady = 0; // 1 after the page object is created (before start() runs).
74
+
75
+ /*
76
+ if ( typeof module === "object" && typeof module.exports === "object" ) {
77
+ module.exports = basic;
78
+ } else {
79
+ window.basic = basic;
80
+ }
81
+ */
82
+
83
+ window.basic = basic;
84
+ basic.startTime = Date.now();
85
+
86
+ basic.ACTION_COLOR = "#689BD2";
87
+ basic.ACTION2_COLOR = "cadetblue";
88
+ basic.WARNING_COLOR = "tomato";
89
+ basic.ALERT_COLOR = "gold";
90
+ basic.CANCEL_COLOR = "lightgray";
91
+ basic.TEXT_COLOR = "rgba(0, 0, 0, 0.8)";
92
+ basic.BACKGROUND_COLOR = "whitesmoke";
93
+ basic.DARK_BACKGROUND_COLOR = "#141414";
94
+ basic.FONT_SIZE = 20;
95
+ basic.BUTTON_WIDTH = 130;
96
+ basic.BUTTON_HEIGHT = 50;
97
+ basic.BUTTON_COLOR = basic.ACTION_COLOR;
98
+ basic.BUTTON_TEXT_COLOR = "rgba(0, 0, 0, 0.65)";
99
+ basic.TEXTBOX_WIDTH = 270;
100
+ basic.TEXTBOX_HEIGHT = 50;
101
+
102
+ basic.gunler = ["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"];
103
+ basic.days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
104
+ basic.aylar = ["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"];
105
+ basic.months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
106
+
107
+ window.that = null;
108
+ window.previousThat = null;
109
+ window.prevThat = null;
110
+
111
+ let defaultContainerBox = null;
112
+ let previousDefaultContainerBox;
113
+ let loopTimer;
114
+ const resizeDetection = {};
115
+ let removeCascadeDepth = 0; // remove(): 0 -> Children of the object are removed too. (Only in the first remove() call)
116
+
117
+ const motionController = {};
118
+ // WHY: WITH_MOTION_TIME must stay longer than DONT_MOTION_TIME: withMotion() runs after the transition of setMotion() is on.
119
+ motionController.WITH_MOTION_TIME = 50;
120
+ motionController.DONT_MOTION_TIME = 40;
121
+
122
+ basic.start = function () {
123
+
124
+ // - windows için ayrı css dosyası olabilir.
125
+ /*
126
+ var link = document.createElement('link');
127
+ link.rel = 'stylesheet';
128
+ link.type = 'text/css';
129
+ link.href = './basic/basic.min.css';
130
+ document.getElementsByTagName('HEAD')[0].appendChild(link);
131
+ */
132
+
133
+ window.page = new MainBox();
134
+ page.containerBox = null;
135
+ setDefaultContainerBox(page);
136
+ basic.isReady = 1;
137
+
138
+ //page.bodyElement.style.margin = "0px";
139
+ //page.bodyElement.style.overflow = "hidden";
140
+ // console.log("basic.js: set body { margin: 0px, overflow: hidden }");
141
+ page.mainBox = createBox(0, 0, page.width, page.height);
142
+ //page.mainBox = createBox(0, 0, "100%", "100%");
143
+ page.mainBox.containerBox = null;
144
+ that.elem.style.position = "fixed";
145
+ that.color = "transparent";
146
+
147
+
148
+ page.onResize(function() {
149
+ if (typeof page.refreshSize === "function") {
150
+ page.refreshSize();
151
+ }
152
+ });
153
+
154
+
155
+ if (typeof start === "function") {
156
+ start();
157
+ basic.afterStart();
158
+ }
159
+
160
+ if (typeof loop === "function") {
161
+ if(!loopTimer) setLoopTimer(1000);
162
+ }
163
+
164
+ };
165
+
166
+ basic.afterStart = function () {
167
+
168
+ // Hız testi:
169
+ // var timeUsed = (Date.now() - basic.startTime)
170
+ // console.log(timeUsed);
171
+
172
+ // Hız testi için kullanılabilecek yöntem.
173
+ //console.time("işlem");
174
+ // ağır işlem
175
+ //console.timeEnd("işlem");
176
+ };
177
+
178
+ // you cant use console.log in *.min.js files but println
179
+ const println = function ($message, $type = "log") {
180
+ // type: "error", "warn", "info", "table", "dir", ""
181
+ const _console = console;
182
+ _console[$type]($message);
183
+ };
184
+ window.println = println;
185
+
186
+ window.random = function ($first, $second) {
187
+
188
+ let result = 0;
189
+
190
+ if ($second != undefined) {
191
+
192
+ if ($second < $first) {
193
+ println("basic.js: random(): The second parameter (number) must be greater than the first.", "error");
194
+
195
+ } else {
196
+ // WHY: Math.round ile ilk ve son sayı, diğerlerinin yarısı kadar çıkıyordu.
197
+ result = $first + Math.floor(Math.random() * (($second - $first) + 1));
198
+ }
199
+
200
+ } else {
201
+ println("basic.js: random(): Two parameters (numbers) must be sent.", "error");
202
+ }
203
+
204
+ return result;
205
+
206
+ };
207
+ //window.random = basic.random;
208
+
209
+ basic.num = function ($str, $type = "float") {
210
+
211
+ if ($type == "float") {
212
+ const i = parseFloat($str);
213
+ return Math.round(i * 100) / 100;
214
+
215
+ } else if ($type == "integer" || $type == "int") {
216
+ return parseInt($str);
217
+ }
218
+
219
+ };
220
+
221
+ basic.str = function ($num) {
222
+ return String($num);
223
+ };
224
+
225
+ basic.isMobile = function () {
226
+
227
+ let answer = 0;
228
+
229
+ let a = navigator.userAgent || navigator.vendor || window.opera;
230
+ if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) {
231
+ answer = 1;
232
+ }
233
+
234
+ return answer;
235
+
236
+ };
237
+
238
+ basic.go = function ($url, $windowType = "_self") {
239
+
240
+ // window.location.href = $url;
241
+ const openedWindow = window.open($url, $windowType);
242
+ // openedWindow.document.write("<p>Test Message</p>");
243
+
244
+ return openedWindow;
245
+
246
+ };
247
+
248
+ // Tek haneli sayıyı, başına "0" ekleyerek iki haneli yapar. 03:10:05
249
+ basic.twoDigitFormat = function($number) {
250
+
251
+ if ($number <= 9) {
252
+ $number = "0" + $number;
253
+ }
254
+
255
+ return $number;
256
+
257
+ };
258
+
259
+ // WHY: localStorage throws when it can not be used (a sandboxed iframe, blocked site data, a full quota).
260
+ // An error here stopped the code that called it (a theme change, saving a setting). save() returns 1 or 0.
261
+ basic.storage = {
262
+
263
+ save(key, value) {
264
+ try {
265
+ localStorage.setItem(key, JSON.stringify(value));
266
+ return 1;
267
+ } catch (e) {
268
+ console.warn("storage save error:", key, e.name);
269
+ return 0;
270
+ }
271
+ },
272
+
273
+ has(key) {
274
+ try {
275
+ return localStorage.getItem(key) !== null;
276
+ } catch (e) {
277
+ return false;
278
+ }
279
+ },
280
+
281
+ load(key) {
282
+ try {
283
+ const value = localStorage.getItem(key);
284
+ return value ? JSON.parse(value) : null;
285
+ } catch (e) {
286
+ console.warn("storage parse error:", key);
287
+ return null;
288
+ }
289
+ },
290
+
291
+ remove(key) {
292
+ try { localStorage.removeItem(key); } catch (e) {}
293
+ },
294
+
295
+ clear() {
296
+ try { localStorage.clear(); } catch (e) {}
297
+ }
298
+
299
+ };
300
+ // basic.storage olarak değiştirilebilir.
301
+ /*
302
+ window.storage = {
303
+
304
+ save(key, value) {
305
+ window.localStorage.setItem(key, JSON.stringify(value));
306
+ },
307
+ load(key) {
308
+ return JSON.parse(window.localStorage.getItem(key));
309
+ },
310
+ remove(key) {
311
+ window.localStorage.removeItem(key);
312
+ }
313
+
314
+ };
315
+ */
316
+ //window.storage = basic.storage;
317
+
318
+ // Zaman bilgisi
319
+ basic.time = {
320
+
321
+ get hour() {
322
+ let dt = new Date();
323
+ return dt.getHours();
324
+ },
325
+ get minute() {
326
+ let dt = new Date();
327
+ return dt.getMinutes();
328
+ },
329
+ get second() {
330
+ let dt = new Date();
331
+ return dt.getSeconds();
332
+ },
333
+ get millisecond() {
334
+ let dt = new Date();
335
+ return dt.getMilliseconds();
336
+ }
337
+
338
+ };
339
+ //window.clock = basic.clock;
340
+
341
+ // Tarih bilgisi
342
+ basic.date = {
343
+
344
+ get year() {
345
+ let dt = new Date();
346
+ return dt.getFullYear();
347
+ },
348
+ get monthNumber() {
349
+ let dt = new Date();
350
+ let month = dt.getMonth();
351
+ month++;
352
+ return month;
353
+ },
354
+ get ayAdi() {
355
+ return basic.aylar[this.monthNumber - 1];
356
+ },
357
+ get monthName() {
358
+ return basic.months[this.monthNumber - 1];
359
+ },
360
+ get dayOfWeek() {
361
+ let dt = new Date();
362
+ return dt.getDay(); // 0-6
363
+ },
364
+ get gunAdi() {
365
+ return basic.gunler[this.dayOfWeek];
366
+ },
367
+ get dayName() {
368
+ return basic.days[this.dayOfWeek];
369
+ },
370
+ get dayOfMonth() {
371
+ let dt = new Date();
372
+ return dt.getDate(); // 1-31
373
+ },
374
+ get now() {
375
+ return Date.now();
376
+ }
377
+
378
+ };
379
+ //window.date = basic.date;
380
+
381
+ // *** v26.09.18: small helpers under the basic namespace (no new globals).
382
+
383
+ // await basic.sleep(300);
384
+ basic.sleep = function ($ms = 0) {
385
+ return new Promise(function (resolve) { setTimeout(resolve, $ms); });
386
+ };
387
+
388
+ // await basic.nextFrame(); -> the browser painted once.
389
+ basic.nextFrame = function () {
390
+ return new Promise(function (resolve) { requestAnimationFrame(resolve); });
391
+ };
392
+
393
+ basic.clamp = function ($value, $min, $max) {
394
+ return Math.min(Math.max($value, $min), $max);
395
+ };
396
+
397
+ // 0 -> $a, 1 -> $b
398
+ basic.lerp = function ($a, $b, $t) {
399
+ return $a + ($b - $a) * $t;
400
+ };
401
+
402
+ // The basic.js object of a DOM element (or of its nearest parent that has one).
403
+ basic.objectOf = function ($elem) {
404
+ let elem = $elem;
405
+ while (elem) {
406
+ if (elem._basicObject) return elem._basicObject;
407
+ elem = elem.parentElement;
408
+ }
409
+ return null;
410
+ };
411
+
412
+ // For user data in .text / .html: basic.escapeHtml(userName)
413
+ basic.escapeHtml = function ($str) {
414
+ const map = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
415
+ return String(($str === null || $str === undefined) ? "" : $str).replace(/[&<>"']/g, function (c) { return map[c]; });
416
+ };
417
+
418
+ // v26.10.23: An "on" value of a param: 1, "1", true. (Components wrote (v == 1 || v === true) again and again.)
419
+ // basic.isOn(box.closable)
420
+ basic.isOn = function ($value) {
421
+ return $value === true || $value === 1 || $value === "1";
422
+ };
423
+
424
+ // v26.10.23: Adds a <style> to the page once (the same id again: nothing, unless $replace). Returns the element.
425
+ // For what inline styles can not do: :hover, :focus-visible, ::placeholder, ::-webkit-scrollbar, @keyframes.
426
+ // basic.addCss("tabs-css", ".tabs-strip::-webkit-scrollbar { display: none; }")
427
+ basic.addCss = function ($id, $cssText, $replace = 0) {
428
+ let style = document.getElementById($id);
429
+ if (style && !$replace) return style;
430
+ if (!style) {
431
+ style = document.createElement("style");
432
+ style.id = $id;
433
+ document.head.appendChild(style);
434
+ }
435
+ style.textContent = $cssText;
436
+ return style;
437
+ };
438
+
439
+ // The colors of a theme: $themes[name], the missing keys filled from $themes.light (a new theme needs only the keys
440
+ // that differ). "auto": the system setting (light or dark). Used by the components with a theme param (Modal, Toast).
441
+ // USAGE: const colors = basic.resolveTheme(Modal.THEMES, "auto");
442
+ basic.resolveTheme = function ($themes, $name = "light") {
443
+ let name = $name || "light";
444
+ if (name === "auto") {
445
+ const prefersDark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
446
+ name = (prefersDark) ? "dark" : "light";
447
+ }
448
+ const theme = $themes[name];
449
+ if (!theme) console.warn("Theme not found: " + name);
450
+ const colors = {};
451
+ mergeIntoIfMissing(colors, theme || {});
452
+ mergeIntoIfMissing(colors, $themes.light || {});
453
+ return colors;
454
+ };
455
+
456
+ // v26.10.24: The style of a component from its style packages. The first line of a component, before
457
+ // mergeIntoIfMissing(params, Defaults): params.style > $packages[params.styleName] > Defaults.style (by that merge).
458
+ // WHY: params.style becomes a new object, so a package given as it is (style: Tabs.styles.dark) is never changed:
459
+ // the merges after it would write into the package of every object of the page.
460
+ // v26.10.27: A package with its own "style" key is a package of params: its "style" goes into params.style as
461
+ // above, its other keys go into the params that were not given (Ex: an icon file outside the style).
462
+ // A package without a "style" key is the style itself, as before.
463
+ // basic.applyStylePackage(params, Tabs.styles, TabsDefaults)
464
+ // Tabs.styles.dark = { style: { tab: { textColor: "white" } }, closeIconFile: "tabs/close-white.svg" }
465
+ basic.applyStylePackage = function ($params, $packages, $defaults) {
466
+ const name = $params.styleName || $defaults.styleName;
467
+ const stylePackage = $packages[name];
468
+ if (!stylePackage) console.warn("Style package not found: " + name);
469
+
470
+ const isParamsPackage = !!stylePackage && Object.prototype.hasOwnProperty.call(stylePackage, "style");
471
+ const packageStyle = isParamsPackage ? stylePackage.style : stylePackage;
472
+
473
+ const ownStyle = {};
474
+ mergeIntoIfMissing(ownStyle, $params.style || {});
475
+ mergeIntoIfMissing(ownStyle, packageStyle || {});
476
+ $params.style = ownStyle;
477
+
478
+ if (isParamsPackage) {
479
+ // WHY: mergeIntoIfMissing copies the objects of the package, but it gives an array as it is:
480
+ // the arrays are copied here, so the package is never changed (editor.colorPalette.push()).
481
+ const packageParams = Object.assign({}, stylePackage);
482
+ delete packageParams.style;
483
+ for (const key in packageParams) {
484
+ if (Array.isArray(packageParams[key])) packageParams[key] = packageParams[key].slice();
485
+ }
486
+ mergeIntoIfMissing($params, packageParams);
487
+ }
488
+ return $params;
489
+ };
490
+
491
+ // v26.11.01: THE SCALE OF THE COMPONENTS ON A FITTED PAGE
492
+ // WHY: page.fit(600) on a 390 px phone zooms the page to 0.65, so a component made for screen px is 0.65 as big
493
+ // (its texts too small to read). A page sets basic.uiScale = 1 / page.zoom once; such a component takes it as
494
+ // the default of its "scale" param and multiplies its sizes with basic.scaleStyle(), so it keeps its size.
495
+ // USAGE: page.fit(600, 800); basic.uiScale = 1 / page.zoom;
496
+ basic.uiScale = 1;
497
+
498
+ // The keys of a style that are sizes: fontSize, width, height, size, gap, padding, margin, round, top, border...
499
+ // (lineHeight is not: it is often a ratio)
500
+ basic.SIZE_KEY_ENDINGS = ["size", "width", "height", "gap", "space", "spacing", "padding", "margin", "round", "radius",
501
+ "offset", "thickness", "top", "left", "right", "bottom", "border"];
502
+
503
+ basic.isSizeKey = function ($key) {
504
+ const key = String($key).toLowerCase();
505
+ if (key === "lineheight") return false;
506
+ return basic.SIZE_KEY_ENDINGS.some((ending) => key.endsWith(ending));
507
+ };
508
+
509
+ // A size multiplied: a number, or an array of numbers ([x, y] padding). Text values ("100%", "auto") stay.
510
+ // USAGE: basic.scaleSize(20, 1.5) -> 30, basic.scaleSize([12, 4], 1.5) -> [18, 6]
511
+ basic.scaleSize = function ($value, $factor) {
512
+ if (typeof $value === "number") return $value * $factor;
513
+ if (Array.isArray($value)) return $value.map((item) => (typeof item === "number") ? item * $factor : item);
514
+ return $value;
515
+ };
516
+
517
+ // The px of a CSS text multiplied (a shadow, a border). Other texts and values stay.
518
+ // USAGE: basic.scaleCssText("0 8px 24px rgba(0, 0, 0, 0.12)", 2) -> "0 16px 48px rgba(0, 0, 0, 0.12)"
519
+ basic.scaleCssText = function ($text, $factor) {
520
+ if ($factor === 1 || typeof $text !== "string") return $text;
521
+ return $text.replace(/(\d*\.?\d+)px/g, (found, number) => (Number(number) * $factor) + "px");
522
+ };
523
+
524
+ // A copy of a style package with its sizes multiplied (the package is not changed). factor 1: the same object.
525
+ // WHY not the texts: a size key can hold "100%" or "auto"; a page multiplies a shadow with basic.scaleCssText().
526
+ // USAGE: params.style = basic.scaleStyle(params.style, params.scale);
527
+ basic.scaleStyle = function ($style, $factor) {
528
+ if ($factor === 1 || !$style || typeof $style !== "object") return $style;
529
+ const scaled = {};
530
+ for (const key in $style) {
531
+ const value = $style[key];
532
+ const isGroup = (value !== null && typeof value === "object" && !Array.isArray(value));
533
+ if (isGroup) {
534
+ scaled[key] = basic.scaleStyle(value, $factor);
535
+ continue;
536
+ }
537
+ scaled[key] = basic.isSizeKey(key) ? basic.scaleSize(value, $factor) : value;
538
+ }
539
+ return scaled;
540
+ };
541
+
542
+ // basic.storage.loadOr("settings", { theme: "light" })
543
+ basic.storage.loadOr = function ($key, $fallback) {
544
+ const value = basic.storage.load($key);
545
+ return (value === null) ? $fallback : value;
546
+ };
547
+
548
+ // Position and size values: 100 -> "100px", "100" -> "100px", "50%" / "calc(100% - 10px)" / "auto" -> as is.
549
+ const toCssLength = function ($value) {
550
+ if (typeof $value == "string") {
551
+ const s = $value.trim();
552
+ if (s !== "" && !isNaN(Number(s))) return Number(s) + "px";
553
+ return s;
554
+ }
555
+ return parseFloat($value) + "px"; // WHY: Same as basic.js for numbers. (NaN is ignored by the browser.)
556
+ };
557
+
558
+ // Adds a new object's element to the current default container.
559
+ const attachToContainer = function ($obj, $element) {
560
+ if (!defaultContainerBox) {
561
+ throw new Error("basic.js: The library is not ready yet. Create objects in start() or window.onload.");
562
+ }
563
+ $obj._containerBox = defaultContainerBox;
564
+ defaultContainerBox.elem.appendChild($element);
565
+ };
566
+
567
+ // Is the container an HGroup / VGroup / AutoLayout?
568
+ // WHY: basic.js checked elem.style.display == "flex". A hidden group (visible: 0) has display "none",
569
+ // so the children created in it were absolutely positioned instead of flex items.
570
+ const isFlexContainer = function ($box) {
571
+ return !!($box && ($box._isFlex || ($box.elem && $box.elem.style.display == "flex")));
572
+ };
573
+
574
+ // Common methods and properties of basic objects.
575
+ // "translateY(4px) rotate(10deg)" + ("rotate", "45deg") -> "translateY(4px) rotate(45deg)"
576
+ // The part is changed in its place (the order of a transform matters); a new part is added at the end.
577
+ const setTransformPart = function ($transform, $name, $value) {
578
+ const part = $name + "(" + $value + ")";
579
+ const current = ($transform === "none") ? "" : ($transform || "");
580
+ const pattern = new RegExp("(^|\\s|\\))" + $name + "\\([^)]*\\)"); // WHY: Not "rotateX(": the name must start a part.
581
+ if (pattern.test(current)) {
582
+ return current.replace(pattern, function (found, space) { return space + part; });
583
+ }
584
+ return (current.trim()) ? current.trim() + " " + part : part;
585
+ };
586
+
587
+ // role / aria: true / false -> "true" / "false"; null, undefined or "" -> the attribute is removed.
588
+ const setOrRemoveAttribute = function ($elem, $name, $value) {
589
+ if ($value === null || $value === undefined || $value === "") {
590
+ $elem.removeAttribute($name);
591
+ return;
592
+ }
593
+ $elem.setAttribute($name, String($value));
594
+ };
595
+
596
+ class Basic_UIComponent {
597
+
598
+ /*
599
+ _type;
600
+ _containerBox;
601
+
602
+ _element;
603
+ _visible;
604
+ _displayType;
605
+ _opacity;
606
+ _rotate;
607
+
608
+ _backgroundColor;
609
+
610
+ _border;
611
+ _borderColor;
612
+ _round;
613
+
614
+ _fontSize;
615
+ _textColor;
616
+ _textAlign;
617
+
618
+ _motionString;
619
+ _clickable;
620
+ _eventFuncList;
621
+
622
+ NOTE: Browsers perform "render optimization." JavaScript collects many small changes you make to the DOM or style attributes while it's running, then applies these changes all at once. But be careful! If you force Reflow/Style (for example, by calling .offsetHeight), the browser will be forced to apply all the changes at once.
623
+
624
+ */
625
+
626
+ constructor($type) {
627
+
628
+ this._type = $type;
629
+
630
+ this._visible = 1;
631
+ this._displayType = "block";
632
+ this._opacity = 1;
633
+ this._rotate = 0;
634
+ this._padding = 0;
635
+
636
+ this._motionString = "none";
637
+ this._clickable = 0;
638
+ this._eventFuncList = []; // for _addEventListener() - Otomatik temizleme
639
+
640
+ }
641
+
642
+ // alternative for containerBox
643
+ get parentBox() {
644
+ return this._containerBox;
645
+ }
646
+
647
+ // alternative for containerBox
648
+ set parentBox($value) {
649
+ this._containerBox = $value;
650
+ }
651
+
652
+ get containerBox() {
653
+ return this._containerBox;
654
+ }
655
+
656
+ set containerBox($value) {
657
+ this._containerBox = $value;
658
+ }
659
+
660
+ // Hizalama ve boyutlandırma.
661
+
662
+ get left() {
663
+ if (this.position == "absolute") {
664
+ return parseFloat(this.elem.style.left);
665
+ } else {
666
+ return this.elem.offsetLeft;
667
+ }
668
+ }
669
+
670
+ set left($value) {
671
+ this.elem.style.right = "";
672
+ this.elem.style.left = toCssLength($value);
673
+ }
674
+
675
+ get top() {
676
+ if (this.position == "absolute") {
677
+ return parseFloat(this.elem.style.top);
678
+ } else {
679
+ return this.elem.offsetTop;
680
+ }
681
+ }
682
+
683
+ set top($value) {
684
+ this.elem.style.bottom = "";
685
+ this.elem.style.top = toCssLength($value);
686
+ }
687
+
688
+ get right() {
689
+ return parseFloat(this.elem.style.right);
690
+ }
691
+
692
+ set right($value) {
693
+ this.elem.style.left = "";
694
+ this.elem.style.right = toCssLength($value);
695
+ }
696
+
697
+ get bottom() {
698
+ return parseFloat(this.elem.style.bottom);
699
+ }
700
+
701
+ set bottom($value) {
702
+ this.elem.style.top = "";
703
+ this.elem.style.bottom = toCssLength($value);
704
+ }
705
+
706
+ get totalLeft() {
707
+ return calcSpace(this.elem, "Left");
708
+ }
709
+
710
+ get totalTop() {
711
+ return calcSpace(this.elem, "Top");
712
+ }
713
+
714
+ get width() {
715
+
716
+ if (typeof this._width != "string") {
717
+ return this._width || 0;
718
+ } else {
719
+ return this.elem.offsetWidth;
720
+ }
721
+
722
+ }
723
+
724
+ set width($value) {
725
+
726
+ // VALUES TYPE:
727
+ // 100
728
+ // "auto"
729
+ // "100%"
730
+ // "calc(100% - 10px)"
731
+
732
+ // "100" (numeric string) is stored as the number 100.
733
+ if (typeof $value == "string" && $value.trim() !== "" && !isNaN(Number($value))) $value = Number($value);
734
+ this._width = $value;
735
+ this.elem.style.width = toCssLength($value);
736
+
737
+ }
738
+
739
+ get height() {
740
+
741
+ if (typeof this._height != "string") {
742
+ return this._height || 0;
743
+ } else {
744
+ return this.elem.offsetHeight;
745
+ }
746
+
747
+ }
748
+
749
+ set height($value) {
750
+
751
+ if (typeof $value == "string" && $value.trim() !== "" && !isNaN(Number($value))) $value = Number($value);
752
+ this._height = $value;
753
+ this.elem.style.height = toCssLength($value);
754
+
755
+ }
756
+
757
+ get rotate() {
758
+ return this._rotate;
759
+ }
760
+
761
+ set rotate($value) {
762
+ this._rotate = parseInt($value);
763
+ // WHY: Only the rotate() part changes; a translate() or scale() in the transform stays (v26.10.23).
764
+ this.elem.style.transform = setTransformPart(this.elem.style.transform, "rotate", $value + "deg");
765
+ }
766
+
767
+ // -- Hizalama ve boyutlandırma SONU
768
+
769
+ // Genel özellikler
770
+
771
+ get visible() {
772
+ return this._visible;
773
+ }
774
+
775
+ set visible($value) {
776
+
777
+ this._visible = $value;
778
+
779
+ // display tipini daha sonra kullanmak üzere sakla.
780
+ if (this.elem.style.display && this.elem.style.display != "none") {
781
+ this._displayType = this.elem.style.display;
782
+ }
783
+
784
+ this.elem.style.display = ($value == 1) ? this._displayType : "none";
785
+
786
+ }
787
+
788
+ get clickable() {
789
+ return this._clickable;
790
+ }
791
+
792
+ set clickable($value) {
793
+ this._clickable = $value;
794
+ this._textElem.style.pointerEvents = ($value == 1) ? "auto" : "none";
795
+ }
796
+
797
+ get opacity() {
798
+ return this._opacity;
799
+ }
800
+
801
+ set opacity($value) {
802
+ this._opacity = $value;
803
+ this.elem.style.opacity = $value;
804
+ }
805
+
806
+ get color() {
807
+ return this._backgroundColor;
808
+ }
809
+
810
+ set color($value) {
811
+ this._backgroundColor = $value;
812
+ this._textElem.style.backgroundColor = $value;
813
+ }
814
+
815
+ get padding() {
816
+ return this._padding || 0;
817
+ }
818
+
819
+ set padding($value) {
820
+
821
+ this._padding = $value;
822
+ let paddingLeft, paddingRight, paddingTop, paddingBottom;
823
+
824
+ if (typeof $value === 'number') {
825
+ paddingLeft = paddingRight = paddingTop = paddingBottom = $value;
826
+ }
827
+
828
+ else if (Array.isArray($value)) {
829
+ const len = $value.length;
830
+
831
+ if (len === 1) {
832
+ paddingLeft = paddingRight = paddingTop = paddingBottom = $value[0];
833
+ }
834
+ else if (len === 2 || len === 3) {
835
+ paddingLeft = paddingRight = $value[0];
836
+ paddingTop = paddingBottom = $value[1];
837
+ }
838
+ else if (len === 4) {
839
+ paddingLeft = $value[0];
840
+ paddingTop = $value[1];
841
+ paddingRight = $value[2];
842
+ paddingBottom = $value[3];
843
+ }
844
+ else {
845
+ //throw new Error('padding değeri 1–4 elemanlı bir dizi ya da tek sayı olmalıdır.');
846
+ }
847
+ }
848
+ else {
849
+ //throw new Error('padding değeri ya sayı olmalı ya da 1–4 elemanlı bir dizi olmalıdır.');
850
+ }
851
+
852
+ this.elem.style.paddingLeft = paddingLeft + 'px';
853
+ this.elem.style.paddingTop = paddingTop + 'px';
854
+ this.elem.style.paddingRight = paddingRight + 'px';
855
+ this.elem.style.paddingBottom = paddingBottom+ 'px';
856
+ }
857
+
858
+ // -- Genel özellikler SONU
859
+
860
+ // Kenarlık
861
+
862
+ get border() {
863
+ return this._border;
864
+ }
865
+
866
+ set border($value) {
867
+ this._border = $value;
868
+ this._textElem.style.borderWidth = $value + "px";
869
+ }
870
+
871
+ get borderColor() {
872
+ return this._borderColor;
873
+ }
874
+
875
+ set borderColor($value) {
876
+ this._borderColor = $value;
877
+ this._textElem.style.borderColor = $value;
878
+ }
879
+
880
+ get round() {
881
+ return this._round;
882
+ }
883
+
884
+ set round($value) {
885
+ this._round = $value;
886
+ this._textElem.style.borderRadius = $value + "px";
887
+ }
888
+
889
+ // -- Kenarlık SONU
890
+
891
+ // Metin özellikleri
892
+
893
+ get fontSize() {
894
+ return this._fontSize;
895
+ }
896
+
897
+ set fontSize($value) {
898
+ this._fontSize = $value;
899
+ this._textElem.style.fontSize = $value + "px";
900
+ }
901
+
902
+ // fontSize Alternatif kullanım.
903
+ get textSize() {
904
+ return this.fontSize;
905
+ }
906
+
907
+ set textSize($value) {
908
+ this.fontSize = $value;
909
+ }
910
+
911
+ get textColor() {
912
+ return this._textColor;
913
+ }
914
+
915
+ set textColor($value) {
916
+ this._textColor = $value;
917
+ this._textElem.style.color = $value;
918
+ }
919
+
920
+ get textAlign() {
921
+ return this._textAlign;
922
+ }
923
+
924
+ set textAlign($value) {
925
+ this._textAlign = $value;
926
+ this._textElem.style.textAlign = $value;
927
+ }
928
+
929
+ // Metin özellikleri SONU
930
+
931
+ get position() {
932
+ return (this.elem.style.position) ? this.elem.style.position : "absolute";
933
+ }
934
+
935
+ set position($value) {
936
+ this.elem.style.position = $value;
937
+
938
+ if ($value == "relative") {
939
+ this.left = 0;
940
+ this.top = 0;
941
+ }
942
+ }
943
+
944
+ // Otomatik hizalama metodları
945
+
946
+ center($position) {
947
+ moveToCenter(this, $position);
948
+ }
949
+
950
+ centerBy($obj, $position) {
951
+ moveToCenterBy(this, $obj, $position);
952
+ }
953
+
954
+ aline($obj, $position, $space = 0, $secondPosition) {
955
+ moveToAline(this, $obj, $position, $space, $secondPosition);
956
+ }
957
+
958
+ // -- Otomatik hizalama metodları SONU
959
+
960
+ // *** v26.09.18 ADDITIONS (all objects) ***
961
+
962
+ // The element that carries the color, border, click and text styles and the events: TextBox overrides it with its <input>.
963
+ get _textElem() {
964
+ return this.elem;
965
+ }
966
+
967
+ // Raw CSS without touching .elem:
968
+ // obj.css = { whiteSpace: "nowrap" } obj.css.whiteSpace = "nowrap" obj.css = "white-space: nowrap"
969
+ get css() {
970
+ return this.elem.style;
971
+ }
972
+
973
+ set css($value) {
974
+ if (!$value) return;
975
+ if (typeof $value == "string") {
976
+ this.elem.style.cssText += "; " + $value;
977
+ return;
978
+ }
979
+ for (let key in $value) this.elem.style[key] = $value[key];
980
+ }
981
+
982
+ // "pointer", "default", "text", "move", "grab", "not-allowed"...
983
+ get cursor() {
984
+ return this._cursor || "";
985
+ }
986
+
987
+ set cursor($value) {
988
+ this._cursor = $value || "";
989
+ this.elem.style.cursor = this._cursor;
990
+ if (this._textElem !== this.elem) this._textElem.style.cursor = this._cursor;
991
+ }
992
+
993
+ get zIndex() {
994
+ const z = parseInt(this.elem.style.zIndex);
995
+ return isNaN(z) ? 0 : z;
996
+ }
997
+
998
+ set zIndex($value) {
999
+ this.elem.style.zIndex = ($value === "" || $value === null || $value === undefined) ? "" : String($value);
1000
+ }
1001
+
1002
+ // "0 2px 8px rgba(0, 0, 0, 0.2)" or "none"
1003
+ get boxShadow() {
1004
+ return this.elem.style.boxShadow;
1005
+ }
1006
+
1007
+ set boxShadow($value) {
1008
+ this.elem.style.boxShadow = $value || "";
1009
+ }
1010
+
1011
+ // "opensans" (default), "opensans-bold", or any font family name.
1012
+ get fontFamily() {
1013
+ return this._fontFamily || "";
1014
+ }
1015
+
1016
+ set fontFamily($value) {
1017
+ this._fontFamily = $value || "";
1018
+ this._applyFont();
1019
+ }
1020
+
1021
+ // bold: 1 -> opensans-bold (the bundled bold font). With another fontFamily -> font-weight: bold.
1022
+ get bold() {
1023
+ return this._bold ? 1 : 0;
1024
+ }
1025
+
1026
+ set bold($value) {
1027
+ this._bold = ($value) ? 1 : 0;
1028
+ this._applyFont();
1029
+ }
1030
+
1031
+ _applyFont() {
1032
+ const family = this._fontFamily || "";
1033
+ const el = this._textElem;
1034
+ if (family === "" || family.indexOf("opensans") === 0) {
1035
+ el.style.fontFamily = (this._bold) ? "opensans-bold" : family;
1036
+ el.style.fontWeight = "";
1037
+ } else {
1038
+ el.style.fontFamily = family;
1039
+ el.style.fontWeight = (this._bold) ? "bold" : "";
1040
+ }
1041
+ }
1042
+
1043
+ get italic() {
1044
+ return this._italic ? 1 : 0;
1045
+ }
1046
+
1047
+ set italic($value) {
1048
+ this._italic = ($value) ? 1 : 0;
1049
+ this._textElem.style.fontStyle = ($value) ? "italic" : "";
1050
+ }
1051
+
1052
+ // Number -> px (lineHeight: 24). String -> as is (lineHeight: "1.4" = 1.4 x font size).
1053
+ get lineHeight() {
1054
+ return this._lineHeight;
1055
+ }
1056
+
1057
+ set lineHeight($value) {
1058
+ this._lineHeight = $value;
1059
+ this._textElem.style.lineHeight = (typeof $value == "number") ? $value + "px" : ($value || "");
1060
+ }
1061
+
1062
+ // ellipsis: 1 -> one line, "..." at the end when the text does not fit the width.
1063
+ get ellipsis() {
1064
+ return this._ellipsis ? 1 : 0;
1065
+ }
1066
+
1067
+ set ellipsis($value) {
1068
+ this._ellipsis = ($value) ? 1 : 0;
1069
+ const el = this._textElem;
1070
+ el.style.whiteSpace = ($value) ? "nowrap" : "";
1071
+ el.style.textOverflow = ($value) ? "ellipsis" : "";
1072
+ // WHY: Off -> back to clipContent (Label, Box: 0 -> visible), or to basic.css.
1073
+ el.style.overflow = ($value) ? "hidden" : ((this._clipContent === 0) ? "visible" : "");
1074
+ }
1075
+
1076
+ // selectable: 1 -> the user can select and copy the text. (basic.css turns selection off for every object.)
1077
+ get selectable() {
1078
+ return this._selectable ? 1 : 0;
1079
+ }
1080
+
1081
+ set selectable($value) {
1082
+ this._selectable = ($value) ? 1 : 0;
1083
+ this.elem.style.userSelect = ($value) ? "text" : "";
1084
+ this.elem.style.webkitUserSelect = ($value) ? "text" : "";
1085
+ if ($value) this.clickable = 1; // WHY: pointer-events: none blocks the selection too.
1086
+ }
1087
+
1088
+ // Flex child (inside HGroup / VGroup): grow: 1 -> takes the free space. shrink: 1 -> can get smaller.
1089
+ get grow() {
1090
+ return this._grow || 0;
1091
+ }
1092
+
1093
+ set grow($value) {
1094
+ this._grow = $value;
1095
+ this.elem.style.flexGrow = String($value);
1096
+ }
1097
+
1098
+ get shrink() {
1099
+ return this._shrink || 0;
1100
+ }
1101
+
1102
+ set shrink($value) {
1103
+ this._shrink = $value;
1104
+ this.elem.style.flexShrink = String($value);
1105
+ }
1106
+
1107
+ // Text without HTML. Safe for user data (.text is innerHTML).
1108
+ get plainText() {
1109
+ return this._textElem.textContent;
1110
+ }
1111
+
1112
+ set plainText($value) {
1113
+ this._textElem.textContent = ($value === null || $value === undefined) ? "" : String($value);
1114
+ }
1115
+
1116
+ // *** v26.10.23 ADDITIONS: ACCESSIBILITY ***
1117
+ // On the element that takes the focus (the <input> of an Input).
1118
+
1119
+ // role: "button", "tab", "tree"... "" or null removes it.
1120
+ get role() {
1121
+ return this._textElem.getAttribute("role") || "";
1122
+ }
1123
+
1124
+ set role($value) {
1125
+ setOrRemoveAttribute(this._textElem, "role", $value);
1126
+ }
1127
+
1128
+ // aria: { label: "Close", selected: true, level: 2 } -> aria-label, aria-selected, aria-level.
1129
+ // Only the given keys change. true / false -> "true" / "false". null, undefined or "" removes the attribute.
1130
+ // The keys are the ARIA names without "aria-" (activedescendant, labelledby: one word, as in ARIA).
1131
+ get aria() {
1132
+ const out = {};
1133
+ for (const attribute of this._textElem.attributes) {
1134
+ if (attribute.name.indexOf("aria-") === 0) out[attribute.name.slice(5)] = attribute.value;
1135
+ }
1136
+ return out;
1137
+ }
1138
+
1139
+ set aria($value) {
1140
+ if (!$value) return;
1141
+ for (let key in $value) {
1142
+ setOrRemoveAttribute(this._textElem, "aria-" + key.toLowerCase(), $value[key]);
1143
+ }
1144
+ }
1145
+
1146
+ // tabIndex: 0 -> the Tab key reaches it, -1 -> only focus() of the code. null or "" -> the default of the element.
1147
+ get tabIndex() {
1148
+ return this._textElem.tabIndex;
1149
+ }
1150
+
1151
+ set tabIndex($value) {
1152
+ if ($value === null || $value === undefined || $value === "") {
1153
+ this._textElem.removeAttribute("tabindex");
1154
+ return;
1155
+ }
1156
+ this._textElem.tabIndex = Number($value);
1157
+ }
1158
+
1159
+ // 1 after remove().
1160
+ get isRemoved() {
1161
+ return this._isRemoved ? 1 : 0;
1162
+ }
1163
+
1164
+ // The basic.js objects directly inside this object (not the deeper ones).
1165
+ get children() {
1166
+ const list = [];
1167
+ const elems = this.elem.children;
1168
+ for (let i = 0; i < elems.length; i++) {
1169
+ if (elems[i]._basicObject) list.push(elems[i]._basicObject);
1170
+ }
1171
+ return list;
1172
+ }
1173
+
1174
+ show() {
1175
+ this.visible = 1;
1176
+ return this;
1177
+ }
1178
+
1179
+ hide() {
1180
+ this.visible = 0;
1181
+ return this;
1182
+ }
1183
+
1184
+ toggle() {
1185
+ this.visible = (this.visible == 1) ? 0 : 1;
1186
+ return this;
1187
+ }
1188
+
1189
+ setSize($width, $height) {
1190
+ if ($width !== undefined && $width !== null) this.width = $width;
1191
+ if ($height !== undefined && $height !== null) this.height = $height;
1192
+ return this;
1193
+ }
1194
+
1195
+ setPosition($left, $top) {
1196
+ if ($left !== undefined && $left !== null) this.left = $left;
1197
+ if ($top !== undefined && $top !== null) this.top = $top;
1198
+ return this;
1199
+ }
1200
+
1201
+ // Puts the object above its siblings (zIndex = highest sibling + 1). The DOM order does not change.
1202
+ bringToFront() {
1203
+ let max = 0;
1204
+ const parent = this.elem.parentElement;
1205
+ if (parent) {
1206
+ for (let i = 0; i < parent.children.length; i++) {
1207
+ const z = parseInt(parent.children[i].style.zIndex);
1208
+ if (!isNaN(z) && z > max) max = z;
1209
+ }
1210
+ }
1211
+ this.zIndex = max + 1;
1212
+ return this;
1213
+ }
1214
+
1215
+ // Is $obj inside this object (at any depth)?
1216
+ contains($obj) {
1217
+ return !!($obj && $obj !== this && $obj.elem && this.elem.contains($obj.elem));
1218
+ }
1219
+
1220
+ // Like on(), but the function runs only once. Returns the remover function.
1221
+ once($eventName, $func, $useCapture = false) {
1222
+ let removeEvent = null;
1223
+ removeEvent = this.on($eventName, function (self, event) {
1224
+ if (removeEvent) removeEvent();
1225
+ $func(self, event);
1226
+ }, $useCapture);
1227
+ return removeEvent;
1228
+ }
1229
+
1230
+ // Animates property changes and returns a Promise:
1231
+ // await box.animate({ left: 100, opacity: 0.5 }, 300); box.animate({ width: 200 }, 500, "ease-out").then(...)
1232
+ // The transition set by setMotion() is restored when the animation ends.
1233
+ animate($props = {}, $duration = 300, $easing = "ease") {
1234
+
1235
+ const _that = this;
1236
+
1237
+ return new Promise(function (resolve) {
1238
+
1239
+ if (_that._isRemoved) { resolve(_that); return; }
1240
+
1241
+ // The transition to restore is the one before the first animate() call (chained calls keep it).
1242
+ if (_that._animateTimeout) {
1243
+ clearTimeout(_that._animateTimeout);
1244
+ // WHY: The animation is cut by this one: its Promise is resolved now (await must not wait forever).
1245
+ if (_that._animateResolve) _that._animateResolve(_that);
1246
+ } else {
1247
+ _that._animateBaseTransition = _that.elem.style.transition;
1248
+ }
1249
+
1250
+ _that.elem.style.transition = "all " + $duration + "ms " + $easing;
1251
+ void _that.elem.offsetWidth; // WHY: Forces a reflow, so the transition starts from the current values.
1252
+
1253
+ for (let key in $props) _that[key] = $props[key];
1254
+
1255
+ _that._animateResolve = resolve;
1256
+ _that._animateTimeout = setTimeout(function () {
1257
+ _that._animateTimeout = null;
1258
+ _that._animateResolve = null;
1259
+ if (!_that._isRemoved) _that.elem.style.transition = _that._animateBaseTransition || "";
1260
+ resolve(_that);
1261
+ }, $duration + 20);
1262
+
1263
+ });
1264
+
1265
+ }
1266
+
1267
+ // *** v26.10.23 ADDITIONS (all objects): THE GLOBAL THINGS OF AN OBJECT ARE CLEANED BY ITS remove() ***
1268
+ // WHY: A component had to clean its window / document events, its timers, its page.onResize and the objects it
1269
+ // made on the page in its own remove() (42 components overrode remove() for it; a forgotten one leaked).
1270
+
1271
+ // An event of another element (window, document...): func(self, event). Returns the remover function.
1272
+ // obj.listenTo(window, "keydown", function (self, event) {})
1273
+ listenTo($target, $eventName, $func, $useCapture = false) {
1274
+ return this._addEventListener($eventName, $func, $target, $useCapture);
1275
+ }
1276
+
1277
+ // The resize of the window: func(self, event). Returns the remover function. (page.onResize is not cleaned.)
1278
+ onPageResize($func) {
1279
+ return this.listenTo(window, "resize", $func);
1280
+ }
1281
+
1282
+ // A timer of the object: func(self) once after ms. Returns the cancel function.
1283
+ after($ms, $func) {
1284
+ const _that = this;
1285
+ if (!this._timerList) this._timerList = new Set();
1286
+ const id = setTimeout(function () {
1287
+ _that._timerList.delete(id);
1288
+ if (!_that._isRemoved) $func(_that);
1289
+ }, $ms);
1290
+ this._timerList.add(id);
1291
+ return function () { clearTimeout(id); _that._timerList.delete(id); };
1292
+ }
1293
+
1294
+ // A timer of the object: func(self) every ms. Returns the stop function.
1295
+ every($ms, $func) {
1296
+ const _that = this;
1297
+ if (!this._intervalList) this._intervalList = new Set();
1298
+ const id = setInterval(function () { if (!_that._isRemoved) $func(_that); }, $ms);
1299
+ this._intervalList.add(id);
1300
+ return function () { clearInterval(id); _that._intervalList.delete(id); };
1301
+ }
1302
+
1303
+ // An object made somewhere else (Ex: a menu on the page) is removed with this one. Returns the object.
1304
+ // const menu = obj.own(createIn(page, function () { return Box(...); }))
1305
+ own($obj) {
1306
+ if (!$obj) return $obj;
1307
+ if (!this._ownedList) this._ownedList = [];
1308
+ this._ownedList.push($obj);
1309
+ return $obj;
1310
+ }
1311
+
1312
+ // The mouse comes on / leaves the object: func(self, isOver, event). Returns the remover function.
1313
+ // obj.onHoverChange(function (self, isOver) { self.color = isOver ? "#EEE" : "white"; })
1314
+ onHoverChange($func) {
1315
+ const removeEnter = this.on("mouseenter", function (self, event) { $func(self, 1, event); });
1316
+ const removeLeave = this.on("mouseleave", function (self, event) { $func(self, 0, event); });
1317
+ return function () { removeEnter(); removeLeave(); };
1318
+ }
1319
+
1320
+ // A focus ring for the keyboard only (:focus-visible: not after a mouse click). "" or 0: no ring.
1321
+ // WHY: Components drew it by hand with focus / blur / mousedown events.
1322
+ setFocusRing($color = "rgba(95, 158, 160, 0.8)") {
1323
+ basic.addCss("basic-focus-ring", ".basic-focus-ring:focus { outline: none; }" +
1324
+ ".basic-focus-ring:focus-visible { outline: 2px solid var(--basic-focus-ring); outline-offset: -2px; }");
1325
+ const el = this._textElem;
1326
+ el.classList.toggle("basic-focus-ring", !!$color);
1327
+ if ($color) el.style.setProperty("--basic-focus-ring", $color);
1328
+ return this;
1329
+ }
1330
+
1331
+ // *** v26.10.23 ADDITIONS END ***
1332
+
1333
+ // *** v26.09.18 ADDITIONS END ***
1334
+
1335
+ // Nesneyi sil.
1336
+ remove() {
1337
+
1338
+ // WHY: A child can be removed by its parent (below) and by its own code. Only the first call works.
1339
+ if (this._isRemoved) return;
1340
+ this._isRemoved = 1;
1341
+
1342
+ // 0. Remove the basic.js objects inside this object too.
1343
+ // WHY: Only this object was cleaned before. Its children kept their global registrations
1344
+ // (resizeDetection list and ResizeObserver, page.onResize of ScrollBar, SelectDate, SelectTime,
1345
+ // static lists like RadioButton groups...), so a removed page stayed in the memory with all
1346
+ // of its objects (about 400 DOM nodes and 250 event listeners for every page change).
1347
+ if (removeCascadeDepth == 0) {
1348
+
1349
+ removeCascadeDepth++;
1350
+
1351
+ try {
1352
+
1353
+ const childElements = this.elem.querySelectorAll("*");
1354
+
1355
+ // Parents first (document order).
1356
+ // WHY: destroy() of a component can clean its own children, then they are skipped here.
1357
+ for (let i = 0; i < childElements.length; i++) {
1358
+
1359
+ const child = childElements[i]._basicObject;
1360
+ if (!child || child === this || child._isRemoved) continue;
1361
+
1362
+ try {
1363
+ // Components clean their global events in destroy(). (Component template)
1364
+ if (typeof child.destroy === "function") child.destroy();
1365
+ if (!child._isRemoved) child.remove();
1366
+ } catch (error) {
1367
+ println("basic.js: A child object could not be removed: " + error.message, "warn");
1368
+ }
1369
+
1370
+ }
1371
+
1372
+ } finally {
1373
+ removeCascadeDepth--;
1374
+ }
1375
+
1376
+ }
1377
+
1378
+ // v26.09.18: Pending timers of this object must not run after it is removed.
1379
+ if (this._setMotionTimeout) clearTimeout(this._setMotionTimeout);
1380
+ if (this._withMotionTimeout) clearTimeout(this._withMotionTimeout);
1381
+ if (this._dontMotionTimeout) clearTimeout(this._dontMotionTimeout);
1382
+ if (this._animateTimeout) clearTimeout(this._animateTimeout);
1383
+ if (this._animateResolve) { this._animateResolve(this); this._animateResolve = null; } // WHY: await animate() ends.
1384
+
1385
+ // v26.10.23: the timers of after() / every() and the objects of own(). (listenTo / onPageResize are events: step 1)
1386
+ if (this._timerList) { this._timerList.forEach(function (id) { clearTimeout(id); }); this._timerList.clear(); }
1387
+ if (this._intervalList) { this._intervalList.forEach(function (id) { clearInterval(id); }); this._intervalList.clear(); }
1388
+ if (this._ownedList) {
1389
+ const owned = this._ownedList;
1390
+ this._ownedList = null;
1391
+ owned.forEach(function (obj) {
1392
+ try { if (obj && !obj._isRemoved && typeof obj.remove === "function") obj.remove(); }
1393
+ catch (error) { println("basic.js: An owned object could not be removed: " + error.message, "warn"); }
1394
+ });
1395
+ }
1396
+
1397
+ // 1. Eklenmiş tüm eventleri kaldır. _addEventListener() - Otomatik temizleme
1398
+ if (this._eventFuncList && this._eventFuncList.length) {
1399
+ for (let i = this._eventFuncList.length - 1; i >= 0; i--) {
1400
+ const ev = this._eventFuncList[i];
1401
+ ev.elem.removeEventListener(ev.eventName, ev.eventFunc, ev.capture);
1402
+ this._eventFuncList.pop();
1403
+ }
1404
+ }
1405
+
1406
+ // 2. Eğer resizeDetection kaydı varsa, onu da kaldır
1407
+ if (resizeDetection && typeof resizeDetection.remove_onResize === "function") {
1408
+ resizeDetection.remove_onResize(this.elem, null); // null ile tüm fonksiyonları sil
1409
+ }
1410
+
1411
+ // NOTE: Eğer page.onResize kullanılmış ise manuel kaldırılmalı.
1412
+
1413
+ // 3. DOM'dan sil
1414
+ this.elem.remove();
1415
+
1416
+ // 4. Tüm özellikleri sil:
1417
+ /*
1418
+ const _this = this;
1419
+ setTimeout(function() {
1420
+ for (let key in _this) {
1421
+ delete _this[key]; // Tüm özellikleri sil
1422
+ }
1423
+ }, 1000); // WHY: May be have a css animation
1424
+ */
1425
+
1426
+ }
1427
+
1428
+ // Toplu özellik değiştirmesi.
1429
+ props($defaultParams, $params, $props) {
1430
+ setProparties(this, $defaultParams, $params, $props);
1431
+ return this;
1432
+ }
1433
+
1434
+ // Olay ekleme: onClick, onResize da kullanılıyor.
1435
+ _addEventListener($eventName, $func, $element, $useCapture = false) {
1436
+
1437
+ /* // More options:
1438
+ $useCapture =
1439
+ {
1440
+ capture: false, // Event capture mı bubbling mi? (varsayılan: false)
1441
+ once: false, // Sadece 1 defa mı çalışsın? (true ise dinleyici otomatik kaldırılır)
1442
+ passive: false // `event.preventDefault()` çağrılmayacaksa true yapılabilir
1443
+ }
1444
+ */
1445
+
1446
+ let _that = this;
1447
+
1448
+ const eventFunc = function (event) {
1449
+ $func(_that, event); // İlk parametre nesnenin kendisi.
1450
+ }
1451
+ $element.addEventListener($eventName, eventFunc, $useCapture);
1452
+
1453
+ // Otomatik temizleme için kaydet.
1454
+ const eventDataItem = {};
1455
+ eventDataItem.eventName = $eventName;
1456
+ eventDataItem.originalFunc = $func;
1457
+ eventDataItem.eventFunc = eventFunc;
1458
+ eventDataItem.elem = $element;
1459
+ // WHY: removeEventListener() must get the same capture value, or a capture listener stays.
1460
+ eventDataItem.capture = (typeof $useCapture == "object" && $useCapture !== null) ? !!$useCapture.capture : !!$useCapture;
1461
+
1462
+ this._eventFuncList.push(eventDataItem); // Nesne .remove() edilirken, hepsi temizlenir.
1463
+
1464
+ // WHY: The remover removes its own listener (the same function can be added to several events).
1465
+ const removeEvent = function() {
1466
+ const index = _that._eventFuncList ? _that._eventFuncList.indexOf(eventDataItem) : -1;
1467
+ if (index < 0) return;
1468
+ _that._eventFuncList.splice(index, 1);
1469
+ eventDataItem.elem.removeEventListener(eventDataItem.eventName, eventDataItem.eventFunc, eventDataItem.capture);
1470
+ };
1471
+
1472
+ return removeEvent; // Eklenen olayı kolayca silmek için fonksiyon döndür.
1473
+
1474
+ };
1475
+
1476
+ // Olay silme: remove_onClick, remove_onResize da kullanılıyor.
1477
+ _removeEventListener($eventName, $func, $element) {
1478
+
1479
+ //Otomatik temizleme
1480
+ // WHY: The event name and the element must match too: the same function can be on click and keydown.
1481
+ for (let i = 0; i < this._eventFuncList.length; i++) {
1482
+ const item = this._eventFuncList[i];
1483
+ if (item.originalFunc == $func && item.eventName == $eventName && item.elem == $element) {
1484
+ this._eventFuncList.splice(i, 1);
1485
+ $element.removeEventListener($eventName, item.eventFunc, item.capture);
1486
+ break;
1487
+ }
1488
+ }
1489
+
1490
+ //$element.removeEventListener($eventName, $func);
1491
+
1492
+ };
1493
+
1494
+ // NEW: Olay ekleme: object.on("click", function);
1495
+ on($eventName, $func, $useCapture = false) {
1496
+
1497
+ const _elem = this._textElem; // WHY: textbox için olayları input elementine bağla.
1498
+ this.clickable = 1; // WHY: Clickable bazen 0 da unutulabilir, otomatik 1 ver. Gerekirse kullanıcı 0 yapar.
1499
+
1500
+ return this._addEventListener($eventName, $func, _elem, $useCapture);
1501
+
1502
+ /* #1
1503
+ _elem.addEventListener($eventName, $func, $useCapture);
1504
+
1505
+ // Olayı kolayca silebilmek için hazır bir fonksiyon oluştur.
1506
+ const removeEvent = function() {
1507
+ _elem.removeEventListener($eventName, $func);
1508
+ };
1509
+
1510
+ return eventInfo;
1511
+
1512
+ */
1513
+
1514
+ // TODO: $eventName resize ise, resizeDetection.onResize ile ekleme yapılabilir.
1515
+
1516
+ }
1517
+ // NOTE: Bir olay eklendiğinde, silme fonksiyonunu oluşturup, return ediyor.
1518
+
1519
+ // NEW: Olay ekleme: object.off("click", function);
1520
+ off($eventName, $func) {
1521
+
1522
+ // Eğer ihityaç olursa, manuel olarak da, tek tek eventler silinebilir.
1523
+ const _elem = this._textElem;
1524
+
1525
+ //_elem.removeEventListener($eventName, $func);
1526
+ this._removeEventListener($eventName, $func, _elem);
1527
+
1528
+ }
1529
+
1530
+ onResize($func) {
1531
+ resizeDetection.onResize(this, $func);
1532
+ }
1533
+
1534
+ remove_onResize($func) {
1535
+ resizeDetection.remove_onResize(this.elem, $func);
1536
+ }
1537
+
1538
+ // Hareket
1539
+ setMotion($motionString) {
1540
+
1541
+ // example motionString: "left 1s, top 1s, width 1s, height 1s, transform 1s, background-color 1s, border-radius 1s, opacity 1s"
1542
+ // example motionString: "all 0.3s"
1543
+ //this.setMotionNow($motionString);
1544
+ const _that = this;
1545
+
1546
+ if(this._setMotionTimeout) clearTimeout(this._setMotionTimeout);
1547
+ this._setMotionTimeout = setTimeout(function(){
1548
+ _that.setMotionNow($motionString);
1549
+ }, motionController.DONT_MOTION_TIME);
1550
+
1551
+ }
1552
+
1553
+ getMotion() {
1554
+ return this._motionString;
1555
+ }
1556
+
1557
+ setMotionNow($motionString) {
1558
+
1559
+ this._motionString = $motionString;
1560
+ this.elem.style.transition = $motionString;
1561
+
1562
+ }
1563
+
1564
+ // Özellik değişimi, hareket ile olsun.
1565
+ withMotion($func) {
1566
+
1567
+ const _that = this;
1568
+
1569
+ if(this._withMotionTimeout) clearTimeout(this._withMotionTimeout);
1570
+ this._withMotionTimeout = setTimeout(function() {
1571
+ _that.canMotionNow();
1572
+ $func(_that);
1573
+ }, motionController.WITH_MOTION_TIME);
1574
+
1575
+ }
1576
+
1577
+ // Harekete, belli bir süre ara ver.
1578
+ dontMotion() {
1579
+
1580
+ this.elem.style.transition = "none";
1581
+ const _that = this;
1582
+
1583
+ if(this._dontMotionTimeout) clearTimeout(this._dontMotionTimeout);
1584
+ this._dontMotionTimeout = setTimeout(function(){
1585
+ _that.elem.style.transition = _that._motionString;
1586
+ }, motionController.DONT_MOTION_TIME);
1587
+
1588
+ }
1589
+
1590
+ // Harekete arayı, süresi dolmadan iptal et.
1591
+ canMotionNow() {
1592
+ this.elem.style.transition = this._motionString;
1593
+ }
1594
+
1595
+ }
1596
+
1597
+ /* MAINBOX COMPONENT (page) */
1598
+ class MainBox {
1599
+
1600
+ /*
1601
+ _box;
1602
+ _element;
1603
+ _bodyElement;
1604
+ _backgroundColor;
1605
+ _zoom;
1606
+ */
1607
+
1608
+ constructor() {
1609
+
1610
+ this._bodyElement = document.getElementsByTagName("BODY")[0];
1611
+ this._element = this._bodyElement;
1612
+
1613
+ this._backgroundColor = "white";
1614
+ this._zoom = 1;
1615
+
1616
+ }
1617
+
1618
+ // short usage of element
1619
+ get elem() {
1620
+ return this._element;
1621
+ }
1622
+
1623
+ get element() {
1624
+ return this._element;
1625
+ }
1626
+
1627
+ /*
1628
+ get contElement() {
1629
+ return this._element;
1630
+ }
1631
+ */
1632
+ // NOTE: .elem, .elem, .elem all the same. You can delete contElement --> element
1633
+
1634
+ get bodyElement() {
1635
+ return this._bodyElement;
1636
+ }
1637
+
1638
+ get mainBox() {
1639
+ return this._box;
1640
+ }
1641
+
1642
+ set mainBox($value) {
1643
+ this._box = $value;
1644
+ this._element = this._box.elem;
1645
+ }
1646
+
1647
+ get width() {
1648
+ let _w;
1649
+ _w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
1650
+ return withPageZoom(_w);
1651
+ }
1652
+
1653
+ get height() {
1654
+ let _h;
1655
+ _h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
1656
+ return withPageZoom(_h);
1657
+ }
1658
+
1659
+ // .text alternatif kullanım:
1660
+ get html() {
1661
+ return this._box.elem.innerHTML;
1662
+ }
1663
+
1664
+ set html($value) {
1665
+ this._box.elem.innerHTML = $value;
1666
+ }
1667
+
1668
+ get zoom() {
1669
+ return this._zoom;
1670
+ }
1671
+
1672
+ set zoom($value) {
1673
+ this._zoom = $value;
1674
+ this.bodyElement.style.transformOrigin = "top left";
1675
+ this.bodyElement.style.transform = "scale(" + $value + ")";
1676
+
1677
+ page.refreshSize();
1678
+
1679
+ }
1680
+
1681
+ get color() {
1682
+ return this._backgroundColor;
1683
+ }
1684
+
1685
+ set color($value) {
1686
+ this._backgroundColor = $value;
1687
+ this.bodyElement.style.backgroundColor = $value;
1688
+ }
1689
+
1690
+ // fit
1691
+ fit($value = document.body.clientWidth, $maxValue) {
1692
+
1693
+ // WHY: onResize da hesaplama yaparken, zoom değerini hesaba katmasın diye.
1694
+ // mesela page.width zoom değeri hesaba katıldığında farklı oluyor.
1695
+ page.zoom = 1;
1696
+ let _w = page.width;
1697
+
1698
+ // ikinci değer yok ise,
1699
+ $maxValue = $maxValue || $value;
1700
+
1701
+ // ekran genişliği izin verilenden fazla ise,
1702
+ if (_w > $maxValue) {
1703
+ page.zoom = $maxValue / $value;
1704
+ } else {
1705
+ page.zoom = _w / $value;
1706
+ }
1707
+
1708
+ };
1709
+
1710
+ // fit
1711
+ autoFit($contentWidth, $contentHeight) {
1712
+
1713
+ // WHY: onResize da hesaplama yaparken, zoom değerini hesaba katmasın diye.
1714
+ // mesela page.width zoom değeri hesaba katıldığında farklı oluyor.
1715
+ page.zoom = 1;
1716
+
1717
+ const _currentCarpan = page.width / page.height;
1718
+ const _carpan = $contentWidth / $contentHeight;
1719
+
1720
+ let _width = 0;
1721
+
1722
+ // Yeterli genişlik yok ise; Genişliğe sığdır.
1723
+ if (_currentCarpan <= _carpan) {
1724
+ _width = page.width;
1725
+
1726
+ // Yüksekliğe sığdır.
1727
+ } else {
1728
+ _width = page.height * _carpan;
1729
+
1730
+ }
1731
+
1732
+ page.fit($contentWidth, _width);
1733
+
1734
+ };
1735
+
1736
+
1737
+ refreshSize() {
1738
+ page.mainBox.width = page.width;
1739
+ page.mainBox.height = page.height;
1740
+ }
1741
+
1742
+
1743
+ onClick($func) {
1744
+ this._box._addEventListener("click", $func, window);
1745
+ }
1746
+
1747
+ remove_onClick($func) {
1748
+ this._box._removeEventListener("click", $func, window);
1749
+ }
1750
+
1751
+ onResize($func) {
1752
+ this._box._addEventListener("resize", $func, window);
1753
+ }
1754
+
1755
+ remove_onResize($func) {
1756
+ this._box._removeEventListener("resize", $func, window);
1757
+ }
1758
+
1759
+ // *** v26.09.18 ADDITIONS (page) ***
1760
+
1761
+ // Window events: page.on("keydown", function (self, event) {}). Returns the remover function.
1762
+ on($eventName, $func, $useCapture = false) {
1763
+ return this._box._addEventListener($eventName, $func, window, $useCapture);
1764
+ }
1765
+
1766
+ off($eventName, $func) {
1767
+ this._box._removeEventListener($eventName, $func, window);
1768
+ }
1769
+
1770
+ onKeyDown($func) {
1771
+ return this.on("keydown", $func);
1772
+ }
1773
+
1774
+ remove_onKeyDown($func) {
1775
+ this.off("keydown", $func);
1776
+ }
1777
+
1778
+ // The browser tab title.
1779
+ get title() {
1780
+ return document.title;
1781
+ }
1782
+
1783
+ set title($value) {
1784
+ document.title = $value;
1785
+ }
1786
+
1787
+ // *** v26.09.18 ADDITIONS END ***
1788
+
1789
+ add($obj) {
1790
+ // Eklenen nesnenin, üst nesnesi değişiyor.
1791
+ if ($obj.containerBox != this) {
1792
+ $obj.containerBox = this;
1793
+ // this.box.clickable = 1;
1794
+ this.elem.appendChild($obj.elem);
1795
+ }
1796
+ }
1797
+
1798
+ }
1799
+
1800
+ /* BOX COMPONENT */
1801
+ class BBox extends Basic_UIComponent {
1802
+
1803
+ constructor($left = -1000, $top = -1000, $width = 100, $height = 100) {
1804
+
1805
+ super("box");
1806
+
1807
+ // Renk
1808
+ this._backgroundColor = "whitesmoke";
1809
+
1810
+ // Kenarlık
1811
+ this._border = 0;
1812
+ this._borderColor = "rgba(0, 0, 0, 0.6)";
1813
+ this._round = 0;
1814
+
1815
+ // Text
1816
+ this._fontSize = 16;
1817
+ this._textColor = "rgba(0, 0, 0, 0.8)";
1818
+ this._textAlign = "left";
1819
+
1820
+ this._clipContent = 1;
1821
+
1822
+ const divElement = document.createElement("DIV");
1823
+ divElement.classList.add("basic_box");
1824
+
1825
+ divElement.style.left = toCssLength($left);
1826
+ divElement.style.top = toCssLength($top);
1827
+
1828
+ this._element = divElement;
1829
+ attachToContainer(this, this._element);
1830
+
1831
+ this.width = $width;
1832
+ this.height = $height;
1833
+
1834
+ if (isFlexContainer(defaultContainerBox)) {
1835
+ this.position = "relative";
1836
+ }
1837
+
1838
+ makeBasicObject(this);
1839
+
1840
+ }
1841
+
1842
+ get elem() {
1843
+ return this._element;
1844
+ }
1845
+
1846
+ get element() {
1847
+ return this._element;
1848
+ }
1849
+
1850
+ /*
1851
+ get contElement() {
1852
+ return this._element;
1853
+ }
1854
+ */
1855
+
1856
+ get text() {
1857
+ return this.elem.innerHTML;
1858
+ }
1859
+
1860
+ set text($value) {
1861
+ this.elem.innerHTML = $value;
1862
+ }
1863
+
1864
+ // .text alternatif kullanım:
1865
+ get html() {
1866
+ return this.elem.innerHTML;
1867
+ }
1868
+
1869
+ set html($value) {
1870
+ this.elem.innerHTML = $value;
1871
+ }
1872
+
1873
+ get clipContent() {
1874
+ return this._clipContent;
1875
+ }
1876
+
1877
+ set clipContent($value) {
1878
+ this._clipContent = $value;
1879
+ if ($value) {
1880
+ this.elem.style.overflowX = "hidden";
1881
+ this.elem.style.overflowY = "hidden";
1882
+ } else {
1883
+ this.elem.style.overflowX = "visible";
1884
+ this.elem.style.overflowY = "visible";
1885
+ }
1886
+ }
1887
+
1888
+ get scrollX() {
1889
+ return (this.elem.style.overflowX == "auto") ? 1 : 0;
1890
+ }
1891
+
1892
+ get scrollY() {
1893
+ return (this.elem.style.overflowY == "auto") ? 1 : 0;
1894
+ }
1895
+
1896
+ set scrollX($value) {
1897
+ this.elem.style.overflowX = "hidden";
1898
+
1899
+ if ($value == 1) {
1900
+ this.clickable = 1;
1901
+ this.elem.style.overflowX = "auto";
1902
+ }
1903
+ }
1904
+
1905
+ set scrollY($value) {
1906
+ this.elem.style.overflowY = "hidden";
1907
+
1908
+ if ($value == 1) {
1909
+ this.clickable = 1;
1910
+ this.elem.style.overflowY = "auto";
1911
+ }
1912
+ }
1913
+
1914
+ onClick($func) {
1915
+ this.clickable = 1;
1916
+ this._addEventListener("click", $func, this.elem);
1917
+ }
1918
+
1919
+ remove_onClick($func) {
1920
+ this._removeEventListener("click", $func, this.elem);
1921
+ }
1922
+
1923
+ add($obj) {
1924
+ //if ($obj.containerBox != this) {
1925
+ // Eklenen nesnenin, üst nesnesini değiştir.
1926
+ $obj.containerBox = this;
1927
+ // İçine başka bir nesne eklendiğinde, artık basılabilir.
1928
+ //this.clickable = 1;
1929
+ this.elem.appendChild($obj.elem);
1930
+ //}
1931
+ }
1932
+
1933
+ // Ağaç şeklinde kod blokları oluştumak için bir teknik. (Deneysel Teknik)
1934
+ in($func) {
1935
+ createIn(this, $func);
1936
+ }
1937
+
1938
+ }
1939
+ //window.Box = Box;
1940
+
1941
+ // Alternatif kullanım
1942
+ const createBox = function ($left, $top, $width, $height) {
1943
+ return new BBox($left, $top, $width, $height);
1944
+ };
1945
+ basic.createBox = createBox;
1946
+
1947
+ // Alternatif kullanım
1948
+ /*
1949
+ window.cbox = function ($left, $top, $width, $height) {
1950
+ return new BBox($left, $top, $width, $height);
1951
+ }
1952
+ */
1953
+
1954
+ /* BUTTON COMPONENT */
1955
+ class BButton extends Basic_UIComponent {
1956
+
1957
+ constructor($left = -1000, $top = -1000, $width = basic.BUTTON_WIDTH, $height = basic.BUTTON_HEIGHT) {
1958
+
1959
+ super("button");
1960
+
1961
+ // renk
1962
+ this._backgroundColor = basic.BUTTON_COLOR;
1963
+
1964
+ // kenarlık
1965
+ this._border = 1;
1966
+ this._borderColor = "rgba(0, 0, 0, 0.40)";
1967
+ this._round = 4;
1968
+
1969
+ // text
1970
+ this._fontSize = 20;
1971
+ this._textColor = basic.BUTTON_TEXT_COLOR;
1972
+ this._textAlign = "center";
1973
+
1974
+ this._clickable = 1;
1975
+
1976
+ const buttonElement = document.createElement("BUTTON");
1977
+ buttonElement.innerHTML = "Button";
1978
+ buttonElement.classList.add("basic_button");
1979
+ buttonElement.setAttribute("type", "button");
1980
+
1981
+ buttonElement.style.left = toCssLength($left);
1982
+ buttonElement.style.top = toCssLength($top);
1983
+
1984
+ this._element = buttonElement;
1985
+ attachToContainer(this, this._element);
1986
+
1987
+ this.width = $width;
1988
+ this.height = $height;
1989
+
1990
+ if (isFlexContainer(defaultContainerBox)) {
1991
+ this.position = "relative";
1992
+ }
1993
+
1994
+ makeBasicObject(this);
1995
+
1996
+ }
1997
+
1998
+ get elem() {
1999
+ return this._element;
2000
+ }
2001
+
2002
+ get element() {
2003
+ return this._element;
2004
+ }
2005
+
2006
+ /*
2007
+ get contElement() {
2008
+ return this._element;
2009
+ }*/
2010
+
2011
+ get buttonElement() {
2012
+ return this._element;
2013
+ }
2014
+
2015
+ get text() {
2016
+ return this.buttonElement.innerHTML;
2017
+ }
2018
+
2019
+ set text($value) {
2020
+ this.buttonElement.innerHTML = $value;
2021
+ }
2022
+
2023
+ // Buttonun value özelliğini kullan.
2024
+ get value() {
2025
+ return this.buttonElement.value;
2026
+ }
2027
+
2028
+ set value($value) {
2029
+ this.buttonElement.value = $value;
2030
+ }
2031
+
2032
+ get enabled() {
2033
+ return (this.buttonElement.disabled) ? 0 : 1;
2034
+ }
2035
+
2036
+ set enabled($value) {
2037
+ this.buttonElement.disabled = ($value) ? 0 : 1;
2038
+ }
2039
+
2040
+ get minimal() {
2041
+ return (this.buttonElement.classList.contains("minimal")) ? 1 : 0;
2042
+ }
2043
+
2044
+ set minimal($value) {
2045
+ if ($value) {
2046
+ this.buttonElement.classList.add("minimal");
2047
+ } else {
2048
+ this.buttonElement.classList.remove("minimal");
2049
+ }
2050
+ // WHY (v26.10.27): basic.css gives a minimal one no border (0) and the others 1: border reads it (it read 1
2051
+ // with minimal). A border written on it (border: 2) is stronger than the CSS: it stays.
2052
+ if (this.buttonElement.style.borderWidth === "") this._border = ($value) ? 0 : 1;
2053
+ }
2054
+
2055
+ get spaceX() {
2056
+ return parseInt(this.elem.style.paddingLeft) || 0;
2057
+ }
2058
+
2059
+ set spaceX($value) {
2060
+ this.elem.style.paddingLeft = $value + "px";
2061
+ this.elem.style.paddingRight = $value + "px";
2062
+ }
2063
+
2064
+ onClick($func) {
2065
+ this.clickable = 1;
2066
+ this._addEventListener("click", $func, this.buttonElement);
2067
+ }
2068
+
2069
+ remove_onClick($func) {
2070
+ this._removeEventListener("click", $func, this.buttonElement);
2071
+ }
2072
+
2073
+ add($obj) {
2074
+ println("basic.js: add(): Insertion cannot be made inside the Button object.", "error");
2075
+ }
2076
+
2077
+ }
2078
+ //window.Button = Button;
2079
+
2080
+ // Alternatif kullanım1
2081
+ const createButton = function ($left, $top, $width, $height) {
2082
+ return new BButton($left, $top, $width, $height);
2083
+ };
2084
+ basic.createButton = createButton;
2085
+
2086
+ // Alternatif kullanım 2
2087
+ /*
2088
+ window.cbtn = function ($left, $top, $width, $height) {
2089
+ return new BButton($left, $top, $width, $height);
2090
+ }
2091
+ */
2092
+
2093
+ /* TEXTBOX COMPONENT */
2094
+ class BTextBox extends Basic_UIComponent {
2095
+
2096
+ /*
2097
+ _titleElement;
2098
+ _mainElement;
2099
+ */
2100
+
2101
+ constructor($left = -1000, $top = -1000, $width = basic.TEXTBOX_WIDTH, $height = basic.TEXTBOX_HEIGHT) {
2102
+
2103
+ super("textbox");
2104
+
2105
+ // renk
2106
+ this._backgroundColor = "white";
2107
+
2108
+ // kenarlık
2109
+ this._border = 1;
2110
+ this._borderColor = "#4A4A4A";
2111
+ this._round = 4;
2112
+
2113
+ // Text
2114
+ this._fontSize = 20;
2115
+ this._textColor = "#4A4A4A";
2116
+ this._textAlign = "left";
2117
+
2118
+ this._clickable = 1;
2119
+
2120
+ const mainElement = document.createElement("DIV");
2121
+ mainElement.classList.add("basic_textbox-main");
2122
+ this._mainElement = mainElement;
2123
+
2124
+ const titleElement = document.createElement("DIV");
2125
+ titleElement.classList.add("basic_textbox-title");
2126
+ titleElement.innerHTML = "";
2127
+ this._titleElement = titleElement;
2128
+
2129
+ const element = document.createElement("INPUT");
2130
+ element.value = "";
2131
+ element.classList.add("basic_textbox");
2132
+ element.setAttribute("type", "text");
2133
+ element.style.width = "100%";
2134
+ element.style.height = "100%";
2135
+ this._element = element;
2136
+
2137
+ mainElement.style.left = toCssLength($left);
2138
+ mainElement.style.top = toCssLength($top);
2139
+
2140
+ mainElement.appendChild(this._titleElement);
2141
+ mainElement.appendChild(this._element);
2142
+
2143
+ attachToContainer(this, this._mainElement);
2144
+
2145
+ this.width = $width;
2146
+ this.height = $height;
2147
+
2148
+ if (isFlexContainer(defaultContainerBox)) {
2149
+ this.position = "relative";
2150
+ }
2151
+
2152
+ makeBasicObject(this);
2153
+
2154
+ }
2155
+
2156
+ get elem() {
2157
+ return this._mainElement;
2158
+ }
2159
+
2160
+ get element() {
2161
+ return this._mainElement;
2162
+ }
2163
+ /*
2164
+ get contElement() {
2165
+ return this._mainElement;
2166
+ }*/
2167
+
2168
+ get inputElement() {
2169
+ return this._element;
2170
+ }
2171
+
2172
+ set inputElement(elem) {
2173
+ this._element = elem;
2174
+ }
2175
+
2176
+ get titleElement() {
2177
+ return this._titleElement;
2178
+ }
2179
+
2180
+ get text() {
2181
+ return this.inputElement.value;
2182
+ }
2183
+
2184
+ set text($value) {
2185
+ // WHY: null / undefined gelir ise hata vermek yerine alanı boşaltsın.
2186
+ this.inputElement.value = ($value === null || $value === undefined) ? "" : String($value);
2187
+ }
2188
+
2189
+ // ÖZEL: renk, kenarlık, clickable ve metin özellikleri <input>'a gider (base setters use _textElem).
2190
+ get _textElem() {
2191
+ return this.inputElement || this.elem;
2192
+ }
2193
+
2194
+ get title() {
2195
+ return this.titleElement.innerHTML;
2196
+ }
2197
+
2198
+ set title($value) {
2199
+ this.titleElement.innerHTML = $value;
2200
+ }
2201
+
2202
+ get enabled() {
2203
+ return (this.inputElement.disabled) ? 0 : 1;
2204
+ }
2205
+
2206
+ set enabled($value) {
2207
+ this.inputElement.disabled = ($value) ? 0 : 1;
2208
+ }
2209
+
2210
+ get minimal() {
2211
+ return (this.inputElement.classList.contains("minimal")) ? 1 : 0;
2212
+ }
2213
+
2214
+ set minimal($value) {
2215
+ if ($value) {
2216
+ this.inputElement.classList.add("minimal");
2217
+ } else {
2218
+ this.inputElement.classList.remove("minimal");
2219
+ }
2220
+ // WHY (v26.10.27): basic.css gives a minimal one no border (0) and the others 1: border reads it (it read 1
2221
+ // with minimal). A border written on it (border: 2) is stronger than the CSS: it stays.
2222
+ if (this.inputElement.style.borderWidth === "") this._border = ($value) ? 0 : 1;
2223
+ }
2224
+
2225
+ // *** v26.09.18 ADDITIONS (Input / TextBox) ***
2226
+
2227
+ // .value = .text (what most developers expect from an input)
2228
+ get value() {
2229
+ return this.text;
2230
+ }
2231
+
2232
+ set value($value) {
2233
+ this.text = $value;
2234
+ }
2235
+
2236
+ get plainText() {
2237
+ return this.text;
2238
+ }
2239
+
2240
+ set plainText($value) {
2241
+ this.text = $value;
2242
+ }
2243
+
2244
+ get placeholder() {
2245
+ return this.inputElement.placeholder;
2246
+ }
2247
+
2248
+ set placeholder($value) {
2249
+ this.inputElement.placeholder = ($value === null || $value === undefined) ? "" : String($value);
2250
+ }
2251
+
2252
+ // "text" (default), "password", "number", "email", "tel", "search", "url"
2253
+ get inputType() {
2254
+ return this.inputElement.type;
2255
+ }
2256
+
2257
+ set inputType($value) {
2258
+ this.inputElement.type = $value || "text";
2259
+ }
2260
+
2261
+ // 0 -> no limit
2262
+ get maxLength() {
2263
+ return (this.inputElement.maxLength > 0) ? this.inputElement.maxLength : 0;
2264
+ }
2265
+
2266
+ set maxLength($value) {
2267
+ if ($value > 0) {
2268
+ this.inputElement.maxLength = $value;
2269
+ } else {
2270
+ this.inputElement.removeAttribute("maxlength");
2271
+ }
2272
+ }
2273
+
2274
+ get readOnly() {
2275
+ return (this.inputElement.readOnly) ? 1 : 0;
2276
+ }
2277
+
2278
+ set readOnly($value) {
2279
+ this.inputElement.readOnly = ($value) ? true : false;
2280
+ }
2281
+
2282
+ focus() {
2283
+ this.inputElement.focus();
2284
+ return this;
2285
+ }
2286
+
2287
+ blur() {
2288
+ this.inputElement.blur();
2289
+ return this;
2290
+ }
2291
+
2292
+ // Selects the whole text.
2293
+ select() {
2294
+ this.inputElement.select();
2295
+ return this;
2296
+ }
2297
+
2298
+ // Enter key: input.onEnter(function (self, event) {}). Returns the remover function.
2299
+ onEnter($func) {
2300
+ const wrapper = function (self, event) {
2301
+ if (event.key === "Enter") $func(self, event);
2302
+ };
2303
+ wrapper._enterFunc = $func;
2304
+ return this._addEventListener("keydown", wrapper, this.inputElement);
2305
+ }
2306
+
2307
+ remove_onEnter($func) {
2308
+ for (let i = this._eventFuncList.length - 1; i >= 0; i--) {
2309
+ const item = this._eventFuncList[i];
2310
+ if (item.eventName == "keydown" && item.originalFunc._enterFunc === $func) {
2311
+ item.elem.removeEventListener("keydown", item.eventFunc, item.capture);
2312
+ this._eventFuncList.splice(i, 1);
2313
+ }
2314
+ }
2315
+ }
2316
+
2317
+ // *** v26.09.18 ADDITIONS END ***
2318
+
2319
+ onChange($func) {
2320
+ this._addEventListener("input", $func, this.inputElement);
2321
+ }
2322
+
2323
+ remove_onChange($func) {
2324
+ this._removeEventListener("input", $func, this.inputElement);
2325
+ }
2326
+
2327
+ add($obj) {
2328
+ println("basic.js: add(): Insertion cannot be made inside the TextBox object.", "error");
2329
+ }
2330
+
2331
+ }
2332
+ //window.TextBox = TextBox;
2333
+
2334
+ // Alternatif kullanım
2335
+ const createTextBox = function ($left, $top, $width, $height) {
2336
+ return new BTextBox($left, $top, $width, $height);
2337
+ };
2338
+ basic.createTextBox = createTextBox;
2339
+ basic.createInput = createTextBox;
2340
+
2341
+ // Alternatif kullanım
2342
+ /*
2343
+ window.ctxt = function ($left, $top, $width, $height) {
2344
+ return new BTextBox($left, $top, $width, $height);
2345
+ }
2346
+ */
2347
+
2348
+ /* LABEL COMPONENT */
2349
+ class BLabel extends Basic_UIComponent {
2350
+
2351
+ constructor($left = -1000, $top = -1000, $width = "auto", $height = "auto") {
2352
+
2353
+ super("label");
2354
+
2355
+ //this._value = "";
2356
+ this._backgroundColor = "transparent";
2357
+
2358
+ // Kenarlık
2359
+ this._border = 0;
2360
+ this._borderColor = "rgba(0, 0, 0, 0.6)";
2361
+ this._round = 0;
2362
+
2363
+ // Text
2364
+ this._fontSize = 20;
2365
+ this._textColor = "rgba(0, 0, 0, 0.8)";
2366
+ this._textAlign = "left";
2367
+
2368
+ const divElement = document.createElement("DIV");
2369
+
2370
+ //divElement.innerHTML = "";
2371
+ divElement.classList.add("basic_label");
2372
+
2373
+ divElement.style.left = toCssLength($left);
2374
+ divElement.style.top = toCssLength($top);
2375
+
2376
+ this._element = divElement;
2377
+ attachToContainer(this, this._element);
2378
+
2379
+ this.width = $width;
2380
+ this.height = $height;
2381
+
2382
+ if (isFlexContainer(defaultContainerBox)) {
2383
+ this.position = "relative";
2384
+ }
2385
+
2386
+ makeBasicObject(this);
2387
+
2388
+ }
2389
+
2390
+ //sample: <b>text</b><br />
2391
+
2392
+ get elem() {
2393
+ return this._element;
2394
+ }
2395
+
2396
+ get element() {
2397
+ return this._element;
2398
+ }
2399
+ /*
2400
+ get contElement() {
2401
+ return this._element;
2402
+ }*/
2403
+
2404
+ get text() {
2405
+ return this.elem.innerHTML;
2406
+ }
2407
+
2408
+ set text($value) {
2409
+ this.elem.innerHTML = $value;
2410
+ }
2411
+
2412
+ // clipContent: 1 (default) -> the text is cut at the edges of the label (basic.css: overflow hidden).
2413
+ // 0 -> not cut: the letters that go out of the line box (g, ş, ğ, Ö), text shadows, a text that does not fit.
2414
+ // WHY: ellipsis: 1 always cuts ("..." needs it).
2415
+ get clipContent() {
2416
+ return (this._clipContent === 0) ? 0 : 1;
2417
+ }
2418
+
2419
+ set clipContent($value) {
2420
+ this._clipContent = ($value) ? 1 : 0;
2421
+ if (this._ellipsis) return;
2422
+ this.elem.style.overflow = ($value) ? "" : "visible";
2423
+ }
2424
+
2425
+ get space() {
2426
+ return parseInt(this.elem.style.padding) || 0;
2427
+ }
2428
+
2429
+ set space($value) {
2430
+ this.elem.style.padding = $value + "px";
2431
+ }
2432
+
2433
+ get spaceX() {
2434
+ return parseInt(this.elem.style.paddingLeft) || 0;
2435
+ }
2436
+
2437
+ set spaceX($value) {
2438
+ this.elem.style.paddingLeft = $value + "px";
2439
+ this.elem.style.paddingRight = $value + "px";
2440
+ }
2441
+
2442
+ get spaceY() {
2443
+ return parseInt(this.elem.style.paddingTop) || 0;
2444
+ }
2445
+
2446
+ set spaceY($value) {
2447
+ this.elem.style.paddingTop = $value + "px";
2448
+ this.elem.style.paddingBottom = $value + "px";
2449
+ }
2450
+
2451
+ onClick($func) {
2452
+ this.clickable = 1;
2453
+ this._addEventListener("click", $func, this.elem);
2454
+ }
2455
+
2456
+ remove_onClick($func) {
2457
+ //this.clickable = 0;
2458
+ this._removeEventListener("click", $func, this.elem);
2459
+ }
2460
+
2461
+ add($obj) {
2462
+ println("basic.js: add(): Insertion cannot be made inside the Label object.", "error");
2463
+ }
2464
+
2465
+ }
2466
+ //window.Label = Label;
2467
+
2468
+ // Alternatif kullanım
2469
+ const createLabel = function ($left, $top, $width, $height) {
2470
+ return new BLabel($left, $top, $width, $height);
2471
+ };
2472
+ basic.createLabel = createLabel;
2473
+
2474
+ // Alternatif kullanım
2475
+ /*
2476
+ window.clbl = function ($left, $top, $width, $height) {
2477
+ return new BLabel($left, $top, $width, $height);
2478
+ }
2479
+ */
2480
+
2481
+ //window.ImageObj = window.Image;
2482
+
2483
+ /* IMAGE COMPONENT */
2484
+ class BImage extends Basic_UIComponent {
2485
+
2486
+ // Not: CheckBox resim nesnesi ile yapılabilir.
2487
+ /*
2488
+ _autoSize;
2489
+ */
2490
+
2491
+ constructor($left = -1000, $top = -1000, $width = 0, $height = 0) {
2492
+
2493
+ super("image");
2494
+
2495
+ this._autoSize = 1;
2496
+ this._space = 0;
2497
+
2498
+ // Renk
2499
+ this._backgroundColor = "transparent";
2500
+
2501
+ // kenarlık
2502
+ this._border = 0;
2503
+ this._borderColor = "rgba(0, 0, 0, 0.6)";
2504
+ this._round = 0;
2505
+
2506
+ const imageElement = document.createElement("IMG");
2507
+ imageElement.classList.add("basic_image");
2508
+
2509
+ imageElement.style.left = toCssLength($left);
2510
+ imageElement.style.top = toCssLength($top);
2511
+
2512
+ this._element = imageElement;
2513
+ attachToContainer(this, this._element);
2514
+
2515
+ super.width = $width;
2516
+ super.height = $height;
2517
+
2518
+ const _that = this;
2519
+
2520
+ if ($width || $height) {
2521
+ this.autoSize = 0;
2522
+ }
2523
+
2524
+ // Resim yüklendiğinde, Otomatik boyutlandır.
2525
+ //if (this.autoSize > 0) {
2526
+
2527
+ imageElement.addEventListener('load', function () {
2528
+
2529
+ // if auto size
2530
+ if (_that.autoSize > 0) {
2531
+
2532
+ const _autoSize = _that.autoSize;
2533
+
2534
+ _that.width = parseInt(_that.naturalWidth / _autoSize) + "px";
2535
+ _that.height = parseInt(_that.naturalHeight / _autoSize) + "px";
2536
+
2537
+ // WHY: .width ve .height, autoSize değerini 0 yapar.
2538
+ // Geri konmaz ise; aynı nesneye ikinci bir resim yüklendiğinde, eski ölçüde kalır.
2539
+ _that.autoSize = _autoSize;
2540
+
2541
+ }
2542
+
2543
+ });
2544
+
2545
+ //}
2546
+
2547
+ if (isFlexContainer(defaultContainerBox)) {
2548
+ this.position = "relative";
2549
+ }
2550
+
2551
+ makeBasicObject(this);
2552
+
2553
+ }
2554
+
2555
+ get elem() {
2556
+ return this._element;
2557
+ }
2558
+
2559
+ get element() {
2560
+ return this._element;
2561
+ }
2562
+ /*
2563
+ get contElement() {
2564
+ return this._element;
2565
+ }*/
2566
+
2567
+ get imageElement() {
2568
+ return this._element;
2569
+ }
2570
+
2571
+ // Özel boyutlandırma komutları
2572
+
2573
+ get width() {
2574
+ return super.width;
2575
+ }
2576
+
2577
+ set width($value) {
2578
+ this.autoSize = 0;
2579
+ super.width = $value;
2580
+ }
2581
+
2582
+ get height() {
2583
+ return super.height;
2584
+ }
2585
+
2586
+ set height($value) {
2587
+ this.autoSize = 0;
2588
+ super.height = $value;
2589
+ }
2590
+
2591
+ // *** v26.09.18 ADDITIONS (Icon / Image) ***
2592
+
2593
+ // Alternative text. (Without it, load() writes the file path, as basic.js does.)
2594
+ get alt() {
2595
+ return this._alt;
2596
+ }
2597
+
2598
+ set alt($value) {
2599
+ this._alt = $value;
2600
+ this.imageElement.setAttribute("alt", ($value === null || $value === undefined) ? "" : String($value));
2601
+ }
2602
+
2603
+ // How the image fills its width and height: "cover", "contain", "fill", "none", "scale-down"
2604
+ get imageFit() {
2605
+ return this._imageFit || "";
2606
+ }
2607
+
2608
+ set imageFit($value) {
2609
+ this._imageFit = $value || "";
2610
+ this.imageElement.style.objectFit = this._imageFit;
2611
+ }
2612
+
2613
+ // *** v26.09.18 ADDITIONS END ***
2614
+
2615
+ // Resim yüklendikten sonra, çalışır.
2616
+ get naturalWidth() {
2617
+ return this.imageElement.naturalWidth;
2618
+ }
2619
+
2620
+ get naturalHeight() {
2621
+ return this.imageElement.naturalHeight;
2622
+ }
2623
+
2624
+ // Resmi orjinal boyutuna ölçekler. 1: orjinal, 2: 2 kat küçült, 3: 3 kat küçült.
2625
+ get autoSize() {
2626
+ return this._autoSize;
2627
+ }
2628
+
2629
+ set autoSize($value) {
2630
+ this._autoSize = $value;
2631
+ }
2632
+
2633
+ get space() {
2634
+ return this._space;
2635
+ // return parseInt(this.elem.style.padding) || 0;
2636
+ }
2637
+
2638
+ set space($value) {
2639
+
2640
+ if ($value > 50) {
2641
+ $value = 50;
2642
+ }
2643
+
2644
+ if ($value < 0) {
2645
+ $value = 0;
2646
+ }
2647
+
2648
+ this._space = $value;
2649
+ //this.elem.style.padding = String($value + "%");
2650
+ const spaceX = parseInt((this.width / 100) * $value);
2651
+ const spaceY = parseInt((this.height / 100) * $value);
2652
+
2653
+ this.elem.style.paddingLeft = spaceX + "px";
2654
+ this.elem.style.paddingRight = spaceX + "px";
2655
+ this.elem.style.paddingTop = spaceY + "px";
2656
+ this.elem.style.paddingBottom = spaceY + "px";
2657
+
2658
+ }
2659
+
2660
+ onClick($func) {
2661
+ this.clickable = 1;
2662
+ this._addEventListener("click", $func, this.elem);
2663
+ }
2664
+
2665
+ remove_onClick($func) {
2666
+ //this.clickable = 0;
2667
+ this._removeEventListener("click", $func, this.elem);
2668
+ }
2669
+
2670
+ onLoad($func) {
2671
+ this._addEventListener("load", $func, this.imageElement);
2672
+ }
2673
+
2674
+ remove_onLoad($func) {
2675
+ this._removeEventListener("load", $func, this.imageElement);
2676
+ }
2677
+
2678
+ load($imagePath) {
2679
+ this.imageElement.setAttribute("src", $imagePath);
2680
+ if (this._alt === undefined) this.imageElement.setAttribute("alt", $imagePath);
2681
+ }
2682
+
2683
+ add($obj) {
2684
+ println("basic.js: add(): Insertion cannot be made inside the Image object.", "error");
2685
+ }
2686
+
2687
+ }
2688
+ //window.BImage = BImage;
2689
+
2690
+ // Alternatif kullanım
2691
+ const createImage = function ($left, $top, $width, $height) {
2692
+ return new BImage($left, $top, $width, $height);
2693
+ };
2694
+ basic.createImage = createImage;
2695
+ basic.createIcon = createImage;
2696
+
2697
+ // Alternatif kullanım
2698
+ /*
2699
+ window.cimg = function ($left, $top, $width, $height) {
2700
+ return new BImage($left, $top, $width, $height);
2701
+ }
2702
+ */
2703
+
2704
+ class BSound {
2705
+
2706
+ /*
2707
+ _element;
2708
+ */
2709
+
2710
+ constructor() {
2711
+
2712
+ const element = document.createElement("AUDIO");
2713
+ const source = document.createElement("SOURCE");
2714
+
2715
+ element.appendChild(source);
2716
+
2717
+ this._element = element;
2718
+ document.body.appendChild(this._element);
2719
+
2720
+ makeBasicObject(this);
2721
+
2722
+ }
2723
+
2724
+ get elem() {
2725
+ return this._element;
2726
+ }
2727
+
2728
+ get element() {
2729
+ return this._element;
2730
+ }
2731
+ /*
2732
+ get contElement() {
2733
+ return this._element;
2734
+ }*/
2735
+
2736
+ get soundElement() {
2737
+ return this._element;
2738
+ }
2739
+
2740
+ // Sesin toplam süresi (saniye). Dosya hazır değil ise 0 döner.
2741
+ get time() {
2742
+ return (isNaN(this.elem.duration)) ? 0 : this.elem.duration;
2743
+ }
2744
+
2745
+ // Sesin kalan süresi (saniye).
2746
+ get timeLeft() {
2747
+ return (isNaN(this.elem.duration)) ? 0 : (this.elem.duration - this.elem.currentTime);
2748
+ }
2749
+
2750
+ get currentTime() {
2751
+ return this.elem.currentTime;
2752
+ }
2753
+
2754
+ get paused() {
2755
+ return this.elem.paused;
2756
+ }
2757
+
2758
+ get playing() {
2759
+ return !this.elem.paused;
2760
+ }
2761
+
2762
+ get loop() {
2763
+ return (this.elem.getAttribute("loop") == "loop") ? 1 : 0;
2764
+ }
2765
+
2766
+ set loop($value) {
2767
+ if ($value == 1) {
2768
+ this.elem.setAttribute("loop", "loop");
2769
+ } else {
2770
+ // WHY: loop bir "boolean attribute" tur. Boş değer verilir ise bile açık sayılır, silinmeli.
2771
+ this.elem.removeAttribute("loop");
2772
+ }
2773
+ }
2774
+
2775
+ play() {
2776
+ if (this.paused) {
2777
+ this.elem.play();
2778
+ }
2779
+ }
2780
+
2781
+ pause($value) {
2782
+ if (!this.paused) {
2783
+ this.elem.pause();
2784
+ }
2785
+ }
2786
+
2787
+ stop() {
2788
+ if (!this.paused) {
2789
+ this.elem.pause();
2790
+ }
2791
+ this.elem.currentTime = 0; // WHY: A paused sound goes back to the start too.
2792
+ }
2793
+
2794
+ onLoad($func) {
2795
+ let _that = this;
2796
+ this.elem.addEventListener("canplaythrough", function () {
2797
+ $func(_that);
2798
+ });
2799
+ }
2800
+
2801
+ load($path) {
2802
+
2803
+ const types = { mp3: "audio/mpeg", wav: "audio/wav", ogg: "audio/ogg", oga: "audio/ogg", m4a: "audio/mp4", aac: "audio/aac", webm: "audio/webm" };
2804
+ const extension = String($path).split(/[?#]/)[0].split(".").pop().toLowerCase();
2805
+ const source = this.elem.children[0];
2806
+
2807
+ source.setAttribute("src", $path);
2808
+ // WHY: A wrong type (an .ogg file as "audio/wav") makes some browsers skip the file. Unknown: no type.
2809
+ if (types[extension]) source.setAttribute("type", types[extension]); else source.removeAttribute("type");
2810
+
2811
+ // WHY: A changed <source> is not read again by itself: the second load() kept playing the first file.
2812
+ this.elem.load();
2813
+
2814
+ }
2815
+
2816
+ remove() {
2817
+ this.elem.remove();
2818
+ }
2819
+
2820
+ };
2821
+ // WHY: Kütüphane bir IIFE içinde. Dışarı açılmaz ise new BSound() çalışmaz.
2822
+ window.BSound = BSound;
2823
+
2824
+
2825
+ /* ### FUNCTIONS ### */
2826
+
2827
+ // - bir elementin verilen yöne doğru ekran sınırına olan uzaklığını hesaplar.
2828
+ // elem: box.elem, lbl.elem
2829
+ // dir: "Left", "Top"
2830
+ const calcSpace = function(elem, dir) {
2831
+
2832
+ const _firstDiv = elem;
2833
+
2834
+ let _space = 0;
2835
+ let _currentDiv = _firstDiv;
2836
+
2837
+ while (_currentDiv.offsetParent) {
2838
+ _space += _currentDiv["offset" + dir];
2839
+ _currentDiv = _currentDiv.offsetParent;
2840
+ }
2841
+
2842
+ return _space;
2843
+
2844
+ };
2845
+
2846
+ // Merges the sources into a new object, the first source wins.
2847
+ const mergeLayers = function (...sources) {
2848
+ const out = {};
2849
+ for (const source of sources) {
2850
+ if (source) mergeIntoIfMissing(out, source);
2851
+ }
2852
+ return out;
2853
+ };
2854
+
2855
+ // Set styles with style object.
2856
+ const setProparties = function ($this, $defaultParams, $params, $props) {
2857
+
2858
+ // Tüm özellikleri bu değişkende topla.
2859
+ const _params = mergeLayers($props, $params, $defaultParams);
2860
+
2861
+ // Tüm özellikleri tek seferde nesneye uygula.
2862
+ for (let propName in _params) {
2863
+ $this[propName] = _params[propName];
2864
+ }
2865
+
2866
+ };
2867
+
2868
+
2869
+ // Centering one object to box.
2870
+ const moveToCenter = function ($this, $position) {
2871
+
2872
+ if ($position == "left" || !$position) {
2873
+ const _w = $this.containerBox.width - (($this.containerBox.border || 0) * 2);
2874
+ $this.left = parseInt((_w - $this.width) / 2);
2875
+
2876
+ }
2877
+
2878
+ if ($position == "top" || !$position) {
2879
+ const _h = $this.containerBox.height - (($this.containerBox.border || 0) * 2);
2880
+ $this.top = parseInt((_h - $this.height) / 2);
2881
+
2882
+ }
2883
+
2884
+ // Her zaman tam sayı olarak ortala, yoksa bulanıklık yapabilir.
2885
+ // NOT: Eğer, kenarlık kalınlıkları, aynı olmaz ise, hesaba katılmaz.
2886
+
2887
+ };
2888
+
2889
+ // Centering one object to an other object.
2890
+ const moveToCenterBy = function ($this, $obj, $position) {
2891
+
2892
+ if ($position == "left" || !$position) {
2893
+ const _w = $obj.width;
2894
+ $this.left = parseInt((_w - $this.width) / 2) + $obj.left;
2895
+
2896
+ if ($position) {
2897
+ $this.top = $obj.top;
2898
+ }
2899
+
2900
+ }
2901
+
2902
+ if ($position == "top" || !$position) {
2903
+ const _h = $obj.height;
2904
+ $this.top = parseInt((_h - $this.height) / 2) + $obj.top;
2905
+
2906
+ if ($position) {
2907
+ $this.left = $obj.left;
2908
+ }
2909
+
2910
+ }
2911
+
2912
+ };
2913
+
2914
+ // Alignment of one object with respect to another object.
2915
+ const moveToAline = function ($this, $obj, $position, $space, $secondPosition) {
2916
+
2917
+ if ($position == "left") {
2918
+ if (!isNaN($obj.left)) {
2919
+ $this.left = parseInt($obj.left - $this.width - $space);
2920
+
2921
+ } else if (!isNaN($obj.right)) {
2922
+ $this.right = parseInt($obj.right + $obj.width + $space);
2923
+
2924
+ }
2925
+
2926
+ if (!isNaN($obj.top)) {
2927
+ $this.top = parseInt($obj.top);
2928
+
2929
+ } else {
2930
+ $this.bottom = parseInt($obj.bottom);
2931
+
2932
+ }
2933
+
2934
+ } else if ($position == "top") {
2935
+ if (!isNaN($obj.top)) {
2936
+ $this.top = parseInt($obj.top - $this.height - $space);
2937
+
2938
+ } else if (!isNaN($obj.bottom)) {
2939
+ $this.bottom = parseInt($obj.bottom + $obj.height + $space);
2940
+
2941
+ }
2942
+
2943
+ if (!isNaN($obj.left)) {
2944
+ $this.left = parseInt($obj.left);
2945
+
2946
+ } else {
2947
+ $this.right = parseInt($obj.right);
2948
+
2949
+ }
2950
+
2951
+
2952
+ } else if ($position == "right") {
2953
+ if (!isNaN($obj.left)) {
2954
+ $this.left = parseInt($obj.left + $obj.width + $space);
2955
+
2956
+ } else if (!isNaN($obj.right)) {
2957
+ $this.right = parseInt($obj.right - $this.width - $space);
2958
+
2959
+ }
2960
+
2961
+ if (!isNaN($obj.top)) {
2962
+ $this.top = parseInt($obj.top);
2963
+
2964
+ } else {
2965
+ $this.bottom = parseInt($obj.bottom);
2966
+
2967
+ }
2968
+
2969
+ } else if ($position == "bottom") {
2970
+ if (!isNaN($obj.top)) {
2971
+ $this.top = parseInt($obj.top + $obj.height + $space);
2972
+
2973
+ } else if (!isNaN($obj.bottom)) {
2974
+ $this.bottom = parseInt($obj.bottom - $this.height - $space);
2975
+
2976
+ }
2977
+
2978
+ if (!isNaN($obj.left)) {
2979
+ $this.left = parseInt($obj.left);
2980
+
2981
+ } else {
2982
+ $this.right = parseInt($obj.right);
2983
+
2984
+ }
2985
+
2986
+
2987
+ } else {
2988
+
2989
+ if (!isNaN($obj.top)) {
2990
+ $this.top = parseInt($obj.top);
2991
+
2992
+ } else if (!isNaN($obj.bottom)) {
2993
+ $this.bottom = parseInt($obj.bottom);
2994
+
2995
+ }
2996
+
2997
+ if (!isNaN($obj.left)) {
2998
+ $this.left = parseInt($obj.left);
2999
+
3000
+ } else if (!isNaN($obj.right)) {
3001
+ $this.right = parseInt($obj.right);
3002
+
3003
+ }
3004
+
3005
+ }
3006
+
3007
+ if ($position == "left" || $position == "right") {
3008
+
3009
+ const _difference = $obj.height - $this.height;
3010
+
3011
+ switch ($secondPosition) {
3012
+ case "top":
3013
+ if (!isNaN($obj.top)) {
3014
+ //$this.top += parseInt($obj.top);
3015
+
3016
+ } else if (!isNaN($obj.bottom)) {
3017
+ $this.bottom += parseInt(_difference);
3018
+
3019
+ }
3020
+ break;
3021
+ case "bottom":
3022
+ if (!isNaN($obj.top)) {
3023
+ $this.top += parseInt(_difference);
3024
+
3025
+ } else if (!isNaN($obj.bottom)) {
3026
+ //$this.bottom = parseInt($obj.bottom);
3027
+
3028
+ }
3029
+ break;
3030
+ case "center":
3031
+ if (!isNaN($obj.top)) {
3032
+ $this.top += parseInt(_difference / 2);
3033
+
3034
+ } else if (!isNaN($obj.bottom)) {
3035
+ $this.bottom += parseInt(_difference / 2);
3036
+
3037
+ }
3038
+ break;
3039
+ }
3040
+
3041
+ } else if ($position == "top" || $position == "bottom") {
3042
+
3043
+ const _difference = $obj.width - $this.width;
3044
+
3045
+ switch ($secondPosition) {
3046
+ case "left":
3047
+ if (!isNaN($obj.left)) {
3048
+ //$this.left = parseInt($obj.left);
3049
+
3050
+ } else if (!isNaN($obj.right)) {
3051
+ $this.right = parseInt($obj.right + _difference);
3052
+
3053
+ }
3054
+ break;
3055
+ case "right":
3056
+ if (!isNaN($obj.left)) {
3057
+ $this.left += parseInt(_difference);
3058
+
3059
+ } else if (!isNaN($obj.right)) {
3060
+ //$this.right = parseInt($obj.right);
3061
+
3062
+ }
3063
+ break;
3064
+ case "center":
3065
+ if (!isNaN($obj.left)) {
3066
+ $this.left += parseInt(_difference / 2);
3067
+
3068
+ } else if (!isNaN($obj.right)) {
3069
+ $this.right += parseInt(_difference / 2);
3070
+
3071
+ }
3072
+ break;
3073
+ }
3074
+
3075
+ }
3076
+
3077
+ };
3078
+
3079
+ const withPageZoom = function ($value) {
3080
+ return parseFloat($value * (1 / page.zoom));
3081
+ };
3082
+ window.withPageZoom = withPageZoom;
3083
+
3084
+ const setLoopTimer = function ($time) {
3085
+
3086
+ if (typeof loop === "function") {
3087
+
3088
+ // Daha önceden oluşturulmuş ise temizle.
3089
+ if (loopTimer) {
3090
+ loopTimer = clearInterval(loopTimer);
3091
+ }
3092
+
3093
+ // Yenisini oluştur.
3094
+ if ($time == 0) {
3095
+ // Eğer tekrarlama zamanı 0 ise yenisini oluşturma.
3096
+ } else {
3097
+ loopTimer = setInterval(loop, $time);
3098
+ }
3099
+
3100
+ }
3101
+
3102
+ };
3103
+ window.setLoopTimer = setLoopTimer;
3104
+
3105
+ // Yeni eklenen nesneler, seçili box nesnesinin içinde oluşturulur.
3106
+ const setDefaultContainerBox = function ($box) {
3107
+
3108
+ previousDefaultContainerBox = defaultContainerBox || page;
3109
+ defaultContainerBox = $box;
3110
+
3111
+ };
3112
+ window.setDefaultContainerBox = setDefaultContainerBox;
3113
+
3114
+ window.restoreDefaultContainerBox = function() {
3115
+ defaultContainerBox = previousDefaultContainerBox || page;
3116
+ };
3117
+ //window.restoreDefaultContainerBox = basic.restoreDefaultContainerBox;
3118
+
3119
+ // Nesne hangi kutu nesnesinin içine eklendiği.
3120
+ const getDefaultContainerBox = function () {
3121
+ return defaultContainerBox;
3122
+ };
3123
+ window.getDefaultContainerBox = getDefaultContainerBox;
3124
+
3125
+ // Creates objects inside an existing container and then restores the default container.
3126
+ // For example, adding rows to a component's list box after the component is created:
3127
+ // createIn(box.list, function () { Label({ text: "Row" }); });
3128
+ // NOTE: setDefaultContainerBox() alone is not part of the start/end stack; this function puts it back for you,
3129
+ // also when $func throws.
3130
+ const createIn = function ($container, $func) {
3131
+
3132
+ const previous = getDefaultContainerBox();
3133
+ // WHY: $func has its own start stack, so a group started and ended in it goes back to $container.
3134
+ // With the stack of the caller (createIn called between a startBox and its endBox), endGroup() went back
3135
+ // to the caller's box and the next objects were created there (the 2nd row of a list went to the page).
3136
+ const previousStartedBoxList = startedBoxList;
3137
+ startedBoxList = [];
3138
+ setDefaultContainerBox($container);
3139
+
3140
+ try {
3141
+ // v26.10.23: the result of $func is returned. (const menu = createIn(page, function () { return Box(...); }))
3142
+ return $func($container);
3143
+ } finally {
3144
+ startedBoxList = previousStartedBoxList;
3145
+ setDefaultContainerBox(previous);
3146
+ }
3147
+
3148
+ };
3149
+ window.createIn = createIn;
3150
+
3151
+ // Add your custom object to basic.js ecosystem.
3152
+ const makeBasicObject = function($newObject) {
3153
+
3154
+ // Element -> object link.
3155
+ // WHY: remove() finds the basic.js objects inside a removed object with it, to clean them too.
3156
+ if ($newObject && $newObject.elem) $newObject.elem._basicObject = $newObject;
3157
+
3158
+ // Object can be called as that.
3159
+ previousThat = that;
3160
+ prevThat = previousThat;
3161
+ that = $newObject;
3162
+
3163
+ };
3164
+ window.makeBasicObject = makeBasicObject;
3165
+
3166
+ const mergeIntoIfMissing = function (target, source, depth = 1, maxDepth = 4) {
3167
+
3168
+ if (depth > maxDepth) return; // Maksimum derinlik sınırı
3169
+
3170
+ for (let key in source) {
3171
+ // WHY: JSON.parse('{"__proto__": {...}}') gives an own "__proto__" key; target["__proto__"] is
3172
+ // Object.prototype, so the merge would write into every object of the page.
3173
+ if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
3174
+ const sourceVal = source[key];
3175
+ const targetVal = target[key];
3176
+
3177
+ if (
3178
+ typeof sourceVal === 'object' &&
3179
+ sourceVal !== null &&
3180
+ !Array.isArray(sourceVal)
3181
+ ) {
3182
+ // Eğer class instance ise → doğrudan referansla ata
3183
+ const isPlainObject = Object.getPrototypeOf(sourceVal)?.constructor?.name === 'Object';
3184
+
3185
+ if (!isPlainObject) {
3186
+ if (!(key in target)) {
3187
+ target[key] = sourceVal; // referansla ekle
3188
+ }
3189
+ continue;
3190
+ }
3191
+
3192
+ // WHY: At the depth limit the object was replaced by an empty {} (the keys under it were lost).
3193
+ // Now it is added as it is (by reference) when the target does not have it.
3194
+ if (depth >= maxDepth) {
3195
+ if (!(key in target)) target[key] = sourceVal;
3196
+ continue;
3197
+ }
3198
+
3199
+ // Sıradan obje ise → katmanlı birleştir
3200
+ if (
3201
+ typeof targetVal !== 'object' ||
3202
+ targetVal === null ||
3203
+ Array.isArray(targetVal)
3204
+ ) {
3205
+ target[key] = {};
3206
+ }
3207
+
3208
+ mergeIntoIfMissing(target[key], sourceVal, depth + 1, maxDepth);
3209
+
3210
+ } else {
3211
+ if (!(key in target)) {
3212
+ target[key] = sourceVal;
3213
+ }
3214
+ }
3215
+ }
3216
+
3217
+ };
3218
+
3219
+ window.mergeIntoIfMissing = mergeIntoIfMissing;
3220
+
3221
+ // Sadece 1 kat derine inerek objeyi birleştirir.
3222
+ /*
3223
+ window.mergeInto = function (target, source) {
3224
+
3225
+ for (let key in source) {
3226
+ if (
3227
+ typeof source[key] === 'object' &&
3228
+ source[key] !== null &&
3229
+ !Array.isArray(source[key]) &&
3230
+ typeof target[key] === 'object' &&
3231
+ target[key] !== null &&
3232
+ !Array.isArray(target[key])
3233
+ ) {
3234
+ // Sadece bir seviye derine inerek birleştir
3235
+ target[key] = { ...target[key], ...source[key] };
3236
+ } else {
3237
+ target[key] = source[key];
3238
+ }
3239
+ }
3240
+
3241
+ };
3242
+ */
3243
+
3244
+ /*
3245
+ window.mergeObject = function ($target, $source) {
3246
+
3247
+ let result = {};
3248
+
3249
+ const mergeShallow = function(target, source) {
3250
+ for (let key in source) {
3251
+ if (
3252
+ typeof source[key] === 'object' &&
3253
+ source[key] !== null &&
3254
+ !Array.isArray(source[key]) &&
3255
+ typeof target[key] === 'object' &&
3256
+ target[key] !== null &&
3257
+ !Array.isArray(target[key])
3258
+ ) {
3259
+ // Sadece bir seviye derine inerek birleştir
3260
+ target[key] = { ...target[key], ...source[key] };
3261
+ } else {
3262
+ target[key] = source[key];
3263
+ }
3264
+ }
3265
+ }
3266
+
3267
+ mergeShallow(result, $target);
3268
+ mergeShallow(result, $source);
3269
+
3270
+ return result;
3271
+
3272
+ };
3273
+ */
3274
+
3275
+ // v26.09.18: one list per element (Map) instead of one flat list for all elements.
3276
+ // WHY: The ResizeObserver callback looked at every registration for every resized element.
3277
+ resizeDetection.map = new Map(); // elem -> [{ obj, func }]
3278
+
3279
+ resizeDetection.onResize = function($object, $func) {
3280
+
3281
+ const list = resizeDetection.map.get($object.elem) || [];
3282
+ list.push({ obj: $object, func: $func });
3283
+ resizeDetection.map.set($object.elem, list);
3284
+ resizeDetection.whenDetected.observe($object.elem);
3285
+
3286
+ };
3287
+
3288
+ resizeDetection.remove_onResize = function($element, $func) {
3289
+
3290
+ const list = resizeDetection.map.get($element);
3291
+ if (!list) return;
3292
+
3293
+ // null -> every function of the element.
3294
+ const rest = ($func) ? list.filter(function (item) { return item.func != $func; }) : [];
3295
+
3296
+ // Aynı nesnede başka dinleyici kalmış ise izlemeyi bırakma.
3297
+ if (rest.length) {
3298
+ resizeDetection.map.set($element, rest);
3299
+ } else {
3300
+ resizeDetection.map.delete($element);
3301
+ resizeDetection.whenDetected.unobserve($element);
3302
+ }
3303
+
3304
+ };
3305
+
3306
+ resizeDetection.whenDetected = new ResizeObserver(function(entries) {
3307
+
3308
+ for (let i = 0; i < entries.length; i++) {
3309
+ const list = resizeDetection.map.get(entries[i].target);
3310
+ if (!list) continue;
3311
+ const copy = list.slice(); // WHY: A function may remove itself while we loop.
3312
+ for (let j = 0; j < copy.length; j++) {
3313
+ copy[j].func(copy[j].obj);
3314
+ }
3315
+ }
3316
+
3317
+ });
3318
+
3319
+ let startedBoxList = [];
3320
+ let startedBoxAlertTimeout = null;
3321
+ const checkStartedBox = function() {
3322
+
3323
+ if (startedBoxAlertTimeout) {
3324
+ clearTimeout(startedBoxAlertTimeout);
3325
+ }
3326
+
3327
+ startedBoxAlertTimeout = setTimeout(function() {
3328
+
3329
+ const startedBoxCount = startedBoxList.length - 1;
3330
+
3331
+ if (startedBoxCount > 0) {
3332
+ println("basic.js: Some started boxes were not ended. Count: " + startedBoxCount, "warn");
3333
+ }
3334
+
3335
+ }, 100);
3336
+
3337
+ }
3338
+ // Starts a box: it becomes the default container until its end call.
3339
+ const pushStartedBox = function(box) {
3340
+
3341
+ if (startedBoxList.length == 0) {
3342
+ startedBoxList.push(getDefaultContainerBox());
3343
+ }
3344
+
3345
+ setDefaultContainerBox(box);
3346
+ startedBoxList.push(box);
3347
+
3348
+ checkStartedBox();
3349
+
3350
+ return box;
3351
+
3352
+ };
3353
+
3354
+ // AutoLayout helpers (shared by every group, created once).
3355
+
3356
+ const FLEX_DEFAULTS = {
3357
+ color: "transparent",
3358
+ };
3359
+
3360
+ const FLEX_STYLES = {
3361
+ flexDirection: "row", // row, column
3362
+ flexWrap: "nowrap", // wrap, nowrap
3363
+ alignContent: "center",
3364
+ justifyContent: "center", // flex-start, center, flex-end (row)
3365
+ alignItems: "center", // flex-start, center, flex-end (column)
3366
+ gap: "0px",
3367
+ flexBasis: "auto", // Öğenin doğal boyutuna göre yer kaplamasını sağlar.
3368
+ flexGrow: 0, // Öğenin büyümesini engeller.
3369
+ flexShrink: 0, // Öğenin küçülmesini engeller.
3370
+ };
3371
+
3372
+ // JUSTIFY: "left" / "start", "center", "right" / "end", "space-between", "space-around", "space-evenly"
3373
+ const getJustifyContent = function(justify) {
3374
+ switch (justify) {
3375
+ case "left":
3376
+ case "top":
3377
+ case "start":
3378
+ return "flex-start";
3379
+ case "right":
3380
+ case "bottom":
3381
+ case "end":
3382
+ return "flex-end";
3383
+ case "center":
3384
+ return "center";
3385
+ default:
3386
+ return justify; // space-between, space-around, space-evenly
3387
+ }
3388
+ };
3389
+
3390
+ const getFlexDirection = function(flow) {
3391
+ return (flow == "vertical") ? "column" : "row";
3392
+ };
3393
+
3394
+ // align -> [justifyContent, alignItems] for flexDirection "row". (alignContent is always "center")
3395
+ const FLEX_ALIGN = {
3396
+ "left top": ["flex-start", "flex-start"],
3397
+ "center top": ["center", "flex-start"],
3398
+ "right top": ["flex-end", "flex-start"],
3399
+ "left center": ["flex-start", "center"],
3400
+ "center center": ["center", "center"],
3401
+ "right center": ["flex-end", "center"],
3402
+ "left bottom": ["flex-start", "flex-end"],
3403
+ "center bottom": ["center", "flex-end"],
3404
+ "right bottom": ["flex-end", "flex-end"],
3405
+ };
3406
+ FLEX_ALIGN["center"] = FLEX_ALIGN["center center"];
3407
+ for (const key of Object.keys(FLEX_ALIGN)) {
3408
+ const words = key.split(" ");
3409
+ if (words.length == 2) FLEX_ALIGN[words[1] + " " + words[0]] = FLEX_ALIGN[key];
3410
+ }
3411
+
3412
+ // Writes the align styles into a style object (props or elem.style).
3413
+ // NOTE: The list is for flexDirection "row", if it is not row, justifyContent and alignItems change places.
3414
+ const applyFlexAlign = function($style, align, isRow) {
3415
+ const alignList = FLEX_ALIGN[align] || FLEX_ALIGN["center"];
3416
+ $style.alignContent = "center";
3417
+ $style.justifyContent = (isRow) ? alignList[0] : alignList[1];
3418
+ $style.alignItems = (isRow) ? alignList[1] : alignList[0];
3419
+ };
3420
+
3421
+ const checkGap = function(gap) {
3422
+ return (typeof gap == "number" && isFinite(gap)) ? gap + "px" : gap; // WHY: 2.5 -> "2.5px" too (not only integers).
3423
+ };
3424
+
3425
+ // .flow, .align, .gap, .wrap, .justify of every group.
3426
+ const FLEX_ACCESSORS = {
3427
+ flow: {
3428
+ get: function() {
3429
+ return this._flow;
3430
+ },
3431
+ set: function(flow) {
3432
+ this._flow = flow;
3433
+ this.elem.style.flexDirection = getFlexDirection(flow);
3434
+ this.align = this.align;
3435
+ }
3436
+ },
3437
+ align: {
3438
+ get: function() {
3439
+ return this._align;
3440
+ },
3441
+ set: function(align) {
3442
+ this._align = align;
3443
+ applyFlexAlign(this.elem.style, align, this.elem.style.flexDirection == "row");
3444
+ if (this._justify) this.elem.style.justifyContent = getJustifyContent(this._justify); // v26.09.18: justify wins
3445
+ }
3446
+ },
3447
+ gap: {
3448
+ get: function() {
3449
+ return this._gap;
3450
+ },
3451
+ set: function(gap) {
3452
+ this._gap = checkGap(gap);
3453
+ this.elem.style.gap = this._gap;
3454
+ }
3455
+ },
3456
+ // (v26.09.18)
3457
+ wrap: {
3458
+ get: function() {
3459
+ return this._wrap || 0;
3460
+ },
3461
+ set: function(wrap) {
3462
+ this._wrap = (wrap) ? 1 : 0;
3463
+ this.elem.style.flexWrap = (wrap) ? "wrap" : "nowrap";
3464
+ }
3465
+ },
3466
+ // (v26.09.18)
3467
+ justify: {
3468
+ get: function() {
3469
+ return this._justify || "";
3470
+ },
3471
+ set: function(justify) {
3472
+ this._justify = justify;
3473
+ this.elem.style.justifyContent = getJustifyContent(justify);
3474
+ }
3475
+ },
3476
+ };
3477
+
3478
+ const startFlexBox = function(p1 = {}, p2, p3, p4, p5) {
3479
+
3480
+ // - Hiç bir parametre girilmez ise boş obje girilmiş gibi işlem yapar.
3481
+ // - The first object parameter is the props, the missing positions before it are 0, 0, "100%", "100%".
3482
+
3483
+ const args = [p1, p2, p3, p4, p5];
3484
+ const propsIndex = args.findIndex(arg => typeof arg == "object");
3485
+ let props = {};
3486
+ let box = null;
3487
+
3488
+ if (propsIndex == -1) {
3489
+ box = createBox(p1, p2, p3, p4);
3490
+ } else {
3491
+ props = args[propsIndex];
3492
+ box = createBox(...[0, 0, "100%", "100%"].map((value, i) => (i < propsIndex) ? args[i] : value));
3493
+ }
3494
+
3495
+ // Eğer fit:1 ise, objeyi otomatik olarak sar (shrink-to-fit).
3496
+ // hug: fit ile aynıdır, alternatif kullanım. (Figma'daki "hug contents")
3497
+ if (props.fit || props.hug) {
3498
+ props.fit = 1;
3499
+ props.hug = 1; // WHY: İkisi de aynı anlamda; box.fit ve box.hug aynı değeri versin.
3500
+ props.width = "auto";
3501
+ props.height = "auto";
3502
+ };
3503
+
3504
+ // align; flow a ihtiyaç duyuyor. Eğer align verilmiş ama flow boş geçilmiş ise; default flow is "horizontal".
3505
+ if (props.align) {
3506
+ if (!props.flow) {
3507
+ props.flow = "horizontal";
3508
+ }
3509
+ }
3510
+
3511
+ // FLOW:
3512
+ if (props.flow) {
3513
+ box._flow = props.flow;
3514
+ props.flexDirection = getFlexDirection(props.flow);
3515
+ }
3516
+
3517
+ // ALIGN:
3518
+ if (props.align) {
3519
+ box._align = props.align;
3520
+ applyFlexAlign(props, props.align, props.flexDirection == "row");
3521
+ };
3522
+
3523
+ // WRAP (v26.09.18): wrap: 1 -> the items continue on the next line / column when there is no space.
3524
+ if (props.wrap !== undefined) {
3525
+ box._wrap = (props.wrap) ? 1 : 0;
3526
+ props.flexWrap = (props.wrap) ? "wrap" : "nowrap";
3527
+ }
3528
+
3529
+ // JUSTIFY (v26.09.18): the main axis placement, overrides the one from align.
3530
+ if (props.justify) {
3531
+ box._justify = props.justify;
3532
+ props.justifyContent = getJustifyContent(props.justify);
3533
+ }
3534
+
3535
+ if (typeof props.gap == "number") {
3536
+ props.gap = checkGap(props.gap);
3537
+ }
3538
+
3539
+ that.elem.style.display = "flex";
3540
+ box._isFlex = 1; // WHY: isFlexContainer() - the children stay flex items even when the group is hidden.
3541
+ box.props(FLEX_DEFAULTS, FLEX_STYLES, props);
3542
+
3543
+ for (let parameterName in FLEX_STYLES) {
3544
+ box.elem.style[parameterName] = box[parameterName];
3545
+ }
3546
+
3547
+ // WHY: The loop above writes the flex styles (alignItems, flexGrow, flexShrink...) again, over the props.
3548
+ // grow, shrink and css of the props are applied after it, so they are not lost.
3549
+ // Ex: VGroup({ align: "left top", css: { alignItems: "stretch" } }), HGroup({ grow: 1 })
3550
+ if (props.grow !== undefined) box.grow = props.grow;
3551
+ if (props.shrink !== undefined) box.shrink = props.shrink;
3552
+ if (props.css) box.css = props.css;
3553
+ box._propsCss = props.css; // WHY: VGroup() sets the flow after this, and the flow writes alignItems again.
3554
+
3555
+ // GAP:
3556
+ if (box.gap) {
3557
+ box._gap = box.gap;
3558
+ };
3559
+
3560
+ Object.defineProperties(box, FLEX_ACCESSORS);
3561
+
3562
+ return pushStartedBox(box);
3563
+
3564
+ };
3565
+ window.startFlexBox = startFlexBox;
3566
+ window.AutoLayout = startFlexBox;
3567
+
3568
+ window.HGroup = function(...args) {
3569
+ const group = startFlexBox(...args);
3570
+ //group.flow = "horizontal"; // WHY: It is default value "horizontal"
3571
+ return group;
3572
+ };
3573
+
3574
+ window.VGroup = function(...args) {
3575
+ const group = startFlexBox(...args);
3576
+ group.flow = "vertical";
3577
+ if (group._propsCss) group.css = group._propsCss;
3578
+ return group;
3579
+ };
3580
+
3581
+ const startBox = function(...args) {
3582
+ return pushStartedBox(Box(...args));
3583
+ };
3584
+ window.startBox = startBox;
3585
+
3586
+ const endBox = function() {
3587
+
3588
+ // Açılmış kutu yok ise (fazladan end çağrısı) hiçbir şey yapma.
3589
+ // WHY: Aksi halde defaultContainerBox boşalıyor ve sonradan hiçbir nesne oluşturulamıyordu.
3590
+ if (startedBoxList.length == 0) {
3591
+ println("basic.js: There is no started box to end. (Extra end call)", "warn");
3592
+ return;
3593
+ }
3594
+
3595
+ if (startedBoxList.length > 1) {
3596
+ startedBoxList.pop();
3597
+ }
3598
+
3599
+ setDefaultContainerBox(startedBoxList[startedBoxList.length - 1]);
3600
+
3601
+ if (startedBoxList.length == 1) {
3602
+ startedBoxList = [];
3603
+ }
3604
+
3605
+ };
3606
+
3607
+ window.endBox = endBox;
3608
+ window.endFlexBox = endBox;
3609
+ window.endAutoLayout = endBox;
3610
+ window.endGroup = endBox;
3611
+
3612
+ let savedThat = null;
3613
+ let savedExThat = null;
3614
+ const savedThatStack = []; // WHY: A component created inside another one must not overwrite the saved that of the outer one.
3615
+
3616
+ const saveCurrentThat = function() {
3617
+
3618
+ savedThat = that;
3619
+ savedExThat = previousThat;
3620
+ savedThatStack.push({ that: that, previousThat: previousThat });
3621
+
3622
+ };
3623
+ window.saveCurrentThat = saveCurrentThat;
3624
+
3625
+ const restoreThatFromSaved = function() {
3626
+
3627
+ const saved = savedThatStack.pop();
3628
+ if (saved) {
3629
+ savedThat = saved.that;
3630
+ savedExThat = saved.previousThat;
3631
+ }
3632
+ that = savedThat;
3633
+ previousThat = savedExThat;
3634
+ prevThat = previousThat;
3635
+
3636
+ };
3637
+ window.restoreThatFromSaved = restoreThatFromSaved;
3638
+
3639
+ // Objects: Label, Input, Icon, Box, Button
3640
+ // Shorts: lbl, inp, ico, box, btn
3641
+
3642
+ // Positional parameters, then an optional props object as the last parameter.
3643
+ const withProps = function($create) {
3644
+ return function(...args) {
3645
+
3646
+ let props = {};
3647
+ if (args.length && typeof args[args.length - 1] === "object") {
3648
+ props = args.pop();
3649
+ }
3650
+
3651
+ const obj = $create(...args);
3652
+ obj.props(props);
3653
+
3654
+ return obj;
3655
+
3656
+ };
3657
+ };
3658
+
3659
+ window.Label = withProps(createLabel);
3660
+ window.Input = withProps(createTextBox);
3661
+ window.Icon = withProps(createImage);
3662
+ const Box = withProps(createBox);
3663
+ window.Box = Box;
3664
+ window.Button = withProps(createButton);
3665
+
3666
+ window.startObject = function($defaults, $params) {
3667
+
3668
+ const _params = mergeLayers($params, $defaults);
3669
+
3670
+ // Defaults values
3671
+ if (!_params.color) {
3672
+ _params.color = "transparent";
3673
+ }
3674
+ /*
3675
+ mergeIntoIfMissing(_params, {
3676
+ color: "transparent",
3677
+ });
3678
+ */
3679
+
3680
+ saveCurrentThat();
3681
+ return startBox(_params);
3682
+
3683
+ };
3684
+
3685
+ window.endObject = function(box) {
3686
+
3687
+ endBox();
3688
+ restoreThatFromSaved();
3689
+ makeBasicObject(box);
3690
+ return box;
3691
+
3692
+ };
3693
+
3694
+ // Başka bir Basic Object ten miras alarak yeni bir Basic Object oluşturma.
3695
+ window.startExtendedObject = function(uiComponent, defaults, params) {
3696
+
3697
+ const _params = mergeLayers(params, defaults);
3698
+
3699
+ const _box = uiComponent(_params);
3700
+ saveCurrentThat();
3701
+
3702
+ return _box;
3703
+
3704
+ };
3705
+
3706
+ window.endExtendedObject = function(box) {
3707
+
3708
+ restoreThatFromSaved();
3709
+ makeBasicObject(box);
3710
+ return box;
3711
+
3712
+ };
3713
+
3714
+ window.Black = function(percent = 1) {
3715
+ if (percent == 0) return "transparent";
3716
+ if (percent == 1) return "black";
3717
+ return `rgba(0,0,0,${percent})`;
3718
+ };
3719
+
3720
+ window.White = function(percent = 1) {
3721
+ if (percent == 0) return "transparent";
3722
+ if (percent == 1) return "white";
3723
+ return `rgba(255,255,255,${percent})`;
3724
+ };
3725
+
3726
+ // Any color made transparent, like Black() / White(): Alpha("#456789", 0.5) -> "rgba(69,103,137,0.5)"
3727
+ // A hex color (#RGB, #RGBA, #RRGGBB, #RRGGBBAA) becomes rgba. Any other color (a name, rgb(), var(--token))
3728
+ // goes through color-mix. An alpha the color already has is multiplied: Alpha("#00000080", 0.5) is 25%.
3729
+ window.Alpha = function(color, percent = 1) {
3730
+
3731
+ if (percent == 0) return "transparent";
3732
+ if (percent == 1) return color;
3733
+
3734
+ const text = String(color).trim();
3735
+ const isHex = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(text);
3736
+ if (!isHex) {
3737
+ const mixPercent = Math.round(percent * 1000) / 10;
3738
+ return "color-mix(in srgb, " + color + " " + mixPercent + "%, transparent)";
3739
+ }
3740
+
3741
+ // WHY: #RGB is the short form of #RRGGBB: every digit is doubled.
3742
+ const hex = text.slice(1);
3743
+ const fullHex = (hex.length <= 4) ? hex.split("").map(function (digit) { return digit + digit; }).join("") : hex;
3744
+ const red = parseInt(fullHex.slice(0, 2), 16);
3745
+ const green = parseInt(fullHex.slice(2, 4), 16);
3746
+ const blue = parseInt(fullHex.slice(4, 6), 16);
3747
+ const ownAlpha = (fullHex.length === 8) ? parseInt(fullHex.slice(6, 8), 16) / 255 : 1;
3748
+ const alpha = Math.round(ownAlpha * percent * 1000) / 1000;
3749
+
3750
+ return `rgba(${red},${green},${blue},${alpha})`;
3751
+
3752
+ };
3753
+
3754
+ // Çok fazla arka arkaya çağırılan fonksiyonların daha verimli çalışmasını sağlar.
3755
+ window.waitAndRun = function (timer, callback, delay = 3) {
3756
+ if (timer) clearTimeout(timer);
3757
+ timer = setTimeout(callback, delay);
3758
+ return timer;
3759
+ };
3760
+
3761
+
3762
+ // When content is loaded,
3763
+ window.addEventListener("load", function () {
3764
+ basic.start();
3765
+ });
3766
+
3767
+ })();