create-basicjs 0.1.4 → 0.1.5

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 (559) hide show
  1. package/README.md +2 -2
  2. package/bin/create-basicjs.js +31 -4
  3. package/bin/verify-package.js +1 -1
  4. package/package.json +2 -2
  5. package/payload/starter/AGENTS.md +11 -6
  6. package/payload/starter/README.md +1 -1
  7. package/payload/starter/_basic/VERSION +1 -1
  8. package/payload/starter/_basic/assets/cards/almond-blossom.png +0 -0
  9. package/payload/starter/_basic/assets/cards/blackberry.png +0 -0
  10. package/payload/starter/_basic/assets/cards/borage.png +0 -0
  11. package/payload/starter/_basic/assets/cards/chamomile.png +0 -0
  12. package/payload/starter/_basic/assets/cards/dill.png +0 -0
  13. package/payload/starter/_basic/assets/cards/eucalyptus.png +0 -0
  14. package/payload/starter/_basic/assets/cards/fennel.png +0 -0
  15. package/payload/starter/_basic/assets/cards/fig.png +0 -0
  16. package/payload/starter/_basic/assets/cards/juniper.png +0 -0
  17. package/payload/starter/_basic/assets/cards/lavender.png +0 -0
  18. package/payload/starter/_basic/assets/cards/lemon.png +0 -0
  19. package/payload/starter/_basic/assets/cards/olives.png +0 -0
  20. package/payload/starter/_basic/assets/cards/oregano.png +0 -0
  21. package/payload/starter/_basic/assets/cards/pepper.png +0 -0
  22. package/payload/starter/_basic/assets/cards/physalis.png +0 -0
  23. package/payload/starter/_basic/assets/cards/pomegranate.png +0 -0
  24. package/payload/starter/_basic/assets/cards/poppy.png +0 -0
  25. package/payload/starter/_basic/assets/cards/rosehip.png +0 -0
  26. package/payload/starter/_basic/assets/cards/saffron.png +0 -0
  27. package/payload/starter/_basic/assets/categories/cappuccino.png +0 -0
  28. package/payload/starter/_basic/assets/categories/chocolate-milk.png +0 -0
  29. package/payload/starter/_basic/assets/categories/coffee.png +0 -0
  30. package/payload/starter/_basic/assets/categories/frappe.png +0 -0
  31. package/payload/starter/_basic/assets/categories/iced-caffee.png +0 -0
  32. package/payload/starter/_basic/assets/categories/milkshake.png +0 -0
  33. package/payload/starter/_basic/assets/categories/orange-juice.png +0 -0
  34. package/payload/starter/_basic/assets/categories/tea.png +0 -0
  35. package/payload/starter/_basic/assets/fruids/brokoli.png +0 -0
  36. package/payload/starter/_basic/assets/fruids/cilek.png +0 -0
  37. package/payload/starter/_basic/assets/fruids/domates.png +0 -0
  38. package/payload/starter/_basic/assets/fruids/elma.png +0 -0
  39. package/payload/starter/_basic/assets/fruids/havuc.png +0 -0
  40. package/payload/starter/_basic/assets/fruids/karpuz.png +0 -0
  41. package/payload/starter/_basic/assets/fruids/limon.png +0 -0
  42. package/payload/starter/_basic/assets/fruids/muz.png +0 -0
  43. package/payload/starter/_basic/assets/fruids/nar.png +0 -0
  44. package/payload/starter/_basic/assets/fruids/patlican.png +0 -0
  45. package/payload/starter/_basic/assets/fruids/yabanmersini.png +0 -0
  46. package/payload/starter/_basic/assets/fruids/yesilbiber.png +0 -0
  47. package/payload/starter/_basic/basic/LICENSE +1 -1
  48. package/payload/starter/_basic/basic/basic.css +3 -6
  49. package/payload/starter/_basic/basic/basic.js +154 -60
  50. package/payload/starter/_basic/basic/basic.min.js +19 -6
  51. package/payload/starter/_basic/basic/scroll-bar.js +4 -2
  52. package/payload/starter/_basic/basic/scroll-bar.min.js +1 -0
  53. package/payload/starter/_basic/comp/accordion.js +659 -0
  54. package/payload/starter/_basic/comp/action-button.js +22 -23
  55. package/payload/starter/_basic/comp/action-tab-bar.js +8 -8
  56. package/payload/starter/_basic/comp/app-bar.js +12 -11
  57. package/payload/starter/_basic/comp/{badge-v2.js → badge.js} +51 -5
  58. package/payload/starter/_basic/comp/bottom-bar.js +31 -23
  59. package/payload/starter/_basic/comp/breadcrumbs.js +4 -2
  60. package/payload/starter/_basic/comp/canvas.js +652 -0
  61. package/payload/starter/_basic/comp/chat-view.js +827 -0
  62. package/payload/starter/_basic/comp/check-box.js +137 -21
  63. package/payload/starter/_basic/comp/code-editor.js +953 -0
  64. package/payload/starter/_basic/comp/{select-color.js → color-picker.js} +62 -29
  65. package/payload/starter/_basic/comp/context-menu.js +342 -30
  66. package/payload/starter/_basic/comp/{currency-input-b.js → currency-field.js} +48 -29
  67. package/payload/starter/_basic/comp/data-table.js +114 -42
  68. package/payload/starter/_basic/comp/{select-date.js → date-picker.js} +104 -52
  69. package/payload/starter/_basic/comp/dialog.js +214 -76
  70. package/payload/starter/_basic/comp/email-field.js +65 -0
  71. package/payload/starter/_basic/comp/{select-file.js → file-picker.js} +245 -57
  72. package/payload/starter/_basic/comp/filters.js +374 -60
  73. package/payload/starter/_basic/comp/form.js +38 -26
  74. package/payload/starter/_basic/comp/full-screen-select.js +36 -33
  75. package/payload/starter/_basic/comp/gauge.js +12 -8
  76. package/payload/starter/_basic/comp/graph-box.js +3911 -0
  77. package/payload/starter/_basic/comp/grid-group.js +185 -0
  78. package/payload/starter/_basic/comp/hold-to-confirm-button.js +16 -7
  79. package/payload/starter/_basic/comp/image-view.js +598 -0
  80. package/payload/starter/_basic/comp/item-list.js +507 -163
  81. package/payload/starter/_basic/comp/json-editor.js +3221 -0
  82. package/payload/starter/_basic/comp/json-view.js +597 -0
  83. package/payload/starter/_basic/comp/label-editor.js +22 -19
  84. package/payload/starter/_basic/comp/left-menu.js +89 -22
  85. package/payload/starter/_basic/comp/line-progress-bar.js +196 -45
  86. package/payload/starter/_basic/comp/loading-screen.js +49 -18
  87. package/payload/starter/_basic/comp/log-view.js +530 -0
  88. package/payload/starter/_basic/comp/{login-page-v2.js → login-page.js} +205 -106
  89. package/payload/starter/_basic/comp/markdown-view.js +1044 -0
  90. package/payload/starter/_basic/comp/menu-bar.js +624 -0
  91. package/payload/starter/_basic/comp/mini-graph-box.js +20 -11
  92. package/payload/starter/_basic/comp/minimal-accent.js +208 -0
  93. package/payload/starter/_basic/comp/notice.js +15 -13
  94. package/payload/starter/_basic/comp/{number-input-b.js → number-field.js} +26 -19
  95. package/payload/starter/_basic/comp/numeric-keyboard.js +15 -13
  96. package/payload/starter/_basic/comp/page-control.js +21 -4
  97. package/payload/starter/_basic/comp/page-header.js +7 -6
  98. package/payload/starter/_basic/comp/password-field.js +192 -0
  99. package/payload/starter/_basic/comp/period-bar.js +8 -7
  100. package/payload/starter/_basic/comp/{phone-input-b.js → phone-field.js} +80 -45
  101. package/payload/starter/_basic/comp/progress-bar.js +401 -85
  102. package/payload/starter/_basic/comp/property-panel.js +1022 -123
  103. package/payload/starter/_basic/comp/radio-button.js +79 -19
  104. package/payload/starter/_basic/comp/range-slider.js +569 -0
  105. package/payload/starter/_basic/comp/rich-text-editor.js +33 -30
  106. package/payload/starter/_basic/comp/scroll-area.js +308 -0
  107. package/payload/starter/_basic/comp/scrolling-text.js +10 -9
  108. package/payload/starter/_basic/comp/search-input.js +725 -0
  109. package/payload/starter/_basic/comp/search-results.js +60 -24
  110. package/payload/starter/_basic/comp/select-box.js +229 -107
  111. package/payload/starter/_basic/comp/settings-row.js +20 -19
  112. package/payload/starter/_basic/comp/side-panel.js +53 -10
  113. package/payload/starter/_basic/comp/slider-field.js +264 -88
  114. package/payload/starter/_basic/comp/slider.js +541 -86
  115. package/payload/starter/_basic/comp/smart-button.js +433 -352
  116. package/payload/starter/_basic/comp/smart-table.js +740 -185
  117. package/payload/starter/_basic/comp/sortable-list.js +47 -38
  118. package/payload/starter/_basic/comp/spark-line-box.js +25 -16
  119. package/payload/starter/_basic/comp/splitter.js +411 -0
  120. package/payload/starter/_basic/comp/status-bar.js +408 -0
  121. package/payload/starter/_basic/comp/step-bar.js +345 -0
  122. package/payload/starter/_basic/comp/stepper.js +77 -49
  123. package/payload/starter/_basic/comp/tabs.js +67 -18
  124. package/payload/starter/_basic/comp/tag-input.js +50 -10
  125. package/payload/starter/_basic/comp/tap-effect.js +6 -4
  126. package/payload/starter/_basic/comp/text-area-field.js +233 -0
  127. package/payload/starter/_basic/comp/text-field.js +1006 -0
  128. package/payload/starter/_basic/comp/time-line.js +102 -28
  129. package/payload/starter/_basic/comp/{select-time.js → time-picker.js} +104 -51
  130. package/payload/starter/_basic/comp/tiny-select.js +79 -39
  131. package/payload/starter/_basic/comp/tiny-table.js +12 -8
  132. package/payload/starter/_basic/comp/toast.js +87 -34
  133. package/payload/starter/_basic/comp/toggle.js +147 -27
  134. package/payload/starter/_basic/comp/tool-bar.js +760 -0
  135. package/payload/starter/_basic/comp/tooltip.js +80 -17
  136. package/payload/starter/_basic/comp/tree-view.js +124 -41
  137. package/payload/starter/_basic/comp/ui-effects.js +17 -11
  138. package/payload/starter/_basic/comp/ui-standards.js +5 -4
  139. package/payload/starter/_basic/comp/url-field.js +190 -0
  140. package/payload/starter/_basic/comp/web-view.js +70 -16
  141. package/payload/starter/_basic/docs/basic-js-animated-rules.md +15 -9
  142. package/payload/starter/_basic/docs/basic-js-code-rules.md +42 -5
  143. package/payload/starter/_basic/docs/basic-js-components.md +12 -17
  144. package/payload/starter/_basic/docs/basic-js-core.md +5 -4
  145. package/payload/starter/_basic/docs/component-index.md +245 -104
  146. package/payload/starter/_basic/docs/component-template.js +28 -24
  147. package/payload/starter/_basic/docs/handbook/00-introduction.md +6 -2
  148. package/payload/starter/_basic/docs/handbook/00-what-is-new.md +21 -0
  149. package/payload/starter/_basic/docs/handbook/01-label.md +4 -4
  150. package/payload/starter/_basic/docs/handbook/02-box.md +7 -7
  151. package/payload/starter/_basic/docs/handbook/03-image.md +4 -4
  152. package/payload/starter/_basic/docs/handbook/04-common-properties.md +6 -5
  153. package/payload/starter/_basic/docs/handbook/05-autolayout.md +8 -7
  154. package/payload/starter/_basic/docs/handbook/06-button.md +3 -3
  155. package/payload/starter/_basic/docs/handbook/07-input.md +3 -3
  156. package/payload/starter/_basic/docs/handbook/08-page.md +3 -3
  157. package/payload/starter/_basic/docs/handbook/09-useful-examples.md +39 -58
  158. package/payload/starter/_basic/docs/handbook/10-motion.md +6 -6
  159. package/payload/starter/_basic/docs/handbook/11-other-functions.md +1 -0
  160. package/payload/starter/_basic/docs/handbook/13-sound.md +3 -3
  161. package/payload/starter/_basic/docs/handbook/14-using-components.md +180 -0
  162. package/payload/starter/_basic/docs/handbook/15-making-a-component.md +338 -0
  163. package/payload/starter/_basic/docs/what-is-new.md +106 -0
  164. package/payload/starter/_basic/examples/accordion.htm +174 -0
  165. package/payload/starter/_basic/examples/action-button.htm +74 -32
  166. package/payload/starter/_basic/examples/action-tab-bar.htm +5 -6
  167. package/payload/starter/_basic/examples/app-bar.htm +63 -41
  168. package/payload/starter/_basic/examples/badge.htm +96 -0
  169. package/payload/starter/_basic/examples/bottom-bar-2.htm +61 -48
  170. package/payload/starter/_basic/examples/bottom-bar.htm +74 -16
  171. package/payload/starter/_basic/examples/breadcrumbs.htm +160 -150
  172. package/payload/starter/_basic/examples/canvas.htm +190 -0
  173. package/payload/starter/_basic/examples/chat-view.htm +143 -0
  174. package/payload/starter/_basic/examples/check-box-2.htm +71 -82
  175. package/payload/starter/_basic/examples/check-box-3.htm +72 -83
  176. package/payload/starter/_basic/examples/check-box.htm +207 -0
  177. package/payload/starter/_basic/examples/code-editor-2.htm +259 -0
  178. package/payload/starter/_basic/examples/code-editor.htm +225 -0
  179. package/payload/starter/_basic/examples/color-picker.htm +206 -0
  180. package/payload/starter/_basic/examples/context-menu.htm +180 -139
  181. package/payload/starter/_basic/examples/currency-field.htm +105 -0
  182. package/payload/starter/_basic/examples/data-table-2.htm +2 -1
  183. package/payload/starter/_basic/examples/data-table-3.htm +1 -1
  184. package/payload/starter/_basic/examples/data-table-4.htm +15 -12
  185. package/payload/starter/_basic/examples/data-table-5.htm +11 -3
  186. package/payload/starter/_basic/examples/data-table.htm +90 -40
  187. package/payload/starter/_basic/examples/date-picker.htm +239 -0
  188. package/payload/starter/_basic/examples/dialog-centered.htm +394 -40
  189. package/payload/starter/_basic/examples/dialog.htm +267 -46
  190. package/payload/starter/_basic/examples/email-field.htm +102 -0
  191. package/payload/starter/_basic/examples/file-picker.htm +296 -0
  192. package/payload/starter/_basic/examples/filters.htm +33 -22
  193. package/payload/starter/_basic/examples/{form-1.htm → form.htm} +18 -19
  194. package/payload/starter/_basic/examples/full-screen-select.htm +81 -58
  195. package/payload/starter/_basic/examples/gauge.htm +95 -81
  196. package/payload/starter/_basic/examples/graph-box.htm +365 -0
  197. package/payload/starter/_basic/examples/grid-group.htm +179 -0
  198. package/payload/starter/_basic/examples/hold-to-confirm-button.htm +102 -113
  199. package/payload/starter/_basic/examples/image-view.htm +195 -0
  200. package/payload/starter/_basic/examples/item-list-2.htm +138 -94
  201. package/payload/starter/_basic/examples/item-list.htm +191 -86
  202. package/payload/starter/_basic/examples/json-editor.htm +206 -0
  203. package/payload/starter/_basic/examples/json-view.htm +153 -0
  204. package/payload/starter/_basic/examples/label-editor.htm +85 -89
  205. package/payload/starter/_basic/examples/left-menu-2.htm +93 -0
  206. package/payload/starter/_basic/examples/left-menu.htm +42 -37
  207. package/payload/starter/_basic/examples/line-progress-bar.htm +155 -114
  208. package/payload/starter/_basic/examples/loading-screen.htm +149 -125
  209. package/payload/starter/_basic/examples/log-view.htm +175 -0
  210. package/payload/starter/_basic/examples/{login-page-dark-v2.htm → login-page-dark.htm} +265 -267
  211. package/payload/starter/_basic/examples/{login-page-v2.htm → login-page.htm} +266 -267
  212. package/payload/starter/_basic/examples/markdown-view.htm +220 -0
  213. package/payload/starter/_basic/examples/menu-bar-2.htm +225 -0
  214. package/payload/starter/_basic/examples/menu-bar.htm +145 -0
  215. package/payload/starter/_basic/examples/mini-graph-box.htm +98 -109
  216. package/payload/starter/_basic/examples/minimal-accent.htm +196 -0
  217. package/payload/starter/_basic/examples/minimal-theme.htm +432 -0
  218. package/payload/starter/_basic/examples/notice.htm +13 -4
  219. package/payload/starter/_basic/examples/number-field.htm +103 -0
  220. package/payload/starter/_basic/examples/numeric-keyboard.htm +44 -42
  221. package/payload/starter/_basic/examples/page-control.htm +181 -130
  222. package/payload/starter/_basic/examples/page-header.htm +57 -30
  223. package/payload/starter/_basic/examples/password-field.htm +117 -0
  224. package/payload/starter/_basic/examples/period-bar.htm +43 -29
  225. package/payload/starter/_basic/examples/phone-field-select-country.htm +292 -0
  226. package/payload/starter/_basic/examples/phone-field.htm +104 -0
  227. package/payload/starter/_basic/examples/progress-bar-ozden.htm +229 -92
  228. package/payload/starter/_basic/examples/progress-bar.htm +222 -174
  229. package/payload/starter/_basic/examples/property-panel.htm +152 -52
  230. package/payload/starter/_basic/examples/radio-button-2.htm +101 -109
  231. package/payload/starter/_basic/examples/radio-button-3.htm +81 -71
  232. package/payload/starter/_basic/examples/radio-button.htm +289 -0
  233. package/payload/starter/_basic/examples/range-slider.htm +171 -0
  234. package/payload/starter/_basic/examples/rich-text-editor.htm +115 -110
  235. package/payload/starter/_basic/examples/scroll-area.htm +293 -0
  236. package/payload/starter/_basic/examples/scrolling-text.htm +27 -6
  237. package/payload/starter/_basic/examples/search-input-2-light.htm +112 -0
  238. package/payload/starter/_basic/examples/search-input-3-dark.htm +105 -0
  239. package/payload/starter/_basic/examples/{search-input-v2-place.htm → search-input-place.htm} +25 -26
  240. package/payload/starter/_basic/examples/search-input.htm +159 -0
  241. package/payload/starter/_basic/examples/search-results.htm +85 -88
  242. package/payload/starter/_basic/examples/select-box-ozden-dark-text.htm +70 -0
  243. package/payload/starter/_basic/examples/select-box-ozden-item.htm +6 -5
  244. package/payload/starter/_basic/examples/select-box-ozden-text.htm +5 -3
  245. package/payload/starter/_basic/examples/select-box.htm +190 -159
  246. package/payload/starter/_basic/examples/settings-row.htm +92 -43
  247. package/payload/starter/_basic/examples/side-panel-2.htm +63 -25
  248. package/payload/starter/_basic/examples/side-panel.htm +84 -70
  249. package/payload/starter/_basic/examples/slider-2-classic.htm +152 -0
  250. package/payload/starter/_basic/examples/slider-field-ozden.htm +286 -0
  251. package/payload/starter/_basic/examples/slider-field.htm +174 -134
  252. package/payload/starter/_basic/examples/slider.htm +257 -180
  253. package/payload/starter/_basic/examples/smart-button-3-ozden.htm +170 -257
  254. package/payload/starter/_basic/examples/smart-button-4-dark.htm +86 -47
  255. package/payload/starter/_basic/examples/smart-button-5-features.htm +130 -125
  256. package/payload/starter/_basic/examples/smart-button-alternatif.htm +266 -0
  257. package/payload/starter/_basic/examples/smart-button.htm +207 -174
  258. package/payload/starter/_basic/examples/smart-table-2.htm +43 -56
  259. package/payload/starter/_basic/examples/smart-table-3.htm +148 -113
  260. package/payload/starter/_basic/examples/smart-table-4.htm +37 -50
  261. package/payload/starter/_basic/examples/{smart-table-1.htm → smart-table-5.htm} +37 -48
  262. package/payload/starter/_basic/examples/smart-table.htm +183 -0
  263. package/payload/starter/_basic/examples/sortable-list.htm +191 -142
  264. package/payload/starter/_basic/examples/spark-line-box.htm +149 -161
  265. package/payload/starter/_basic/examples/splitter.htm +164 -0
  266. package/payload/starter/_basic/examples/status-bar.htm +166 -0
  267. package/payload/starter/_basic/examples/step-bar.htm +129 -0
  268. package/payload/starter/_basic/examples/stepper-2.htm +71 -59
  269. package/payload/starter/_basic/examples/stepper.htm +146 -135
  270. package/payload/starter/_basic/examples/tabs-2.htm +58 -67
  271. package/payload/starter/_basic/examples/tabs.htm +197 -180
  272. package/payload/starter/_basic/examples/tag-input.htm +150 -153
  273. package/payload/starter/_basic/examples/tap-effect.htm +23 -19
  274. package/payload/starter/_basic/examples/text-area-field.htm +104 -0
  275. package/payload/starter/_basic/examples/text-field-2.htm +113 -0
  276. package/payload/starter/_basic/examples/text-field-3-style.htm +105 -0
  277. package/payload/starter/_basic/examples/text-field-4-custom-unit.htm +96 -0
  278. package/payload/starter/_basic/examples/{input-b-ex5-warning-icon.htm → text-field-5-warning-icon.htm} +19 -19
  279. package/payload/starter/_basic/examples/text-field-6-modern-dark.htm +114 -0
  280. package/payload/starter/_basic/examples/text-field-7-modern.htm +106 -0
  281. package/payload/starter/_basic/examples/text-field-8-light-dark.htm +159 -0
  282. package/payload/starter/_basic/examples/text-field.htm +163 -0
  283. package/payload/starter/_basic/examples/time-line.htm +180 -116
  284. package/payload/starter/_basic/examples/time-picker.htm +240 -0
  285. package/payload/starter/_basic/examples/tiny-select.htm +118 -86
  286. package/payload/starter/_basic/examples/tiny-table.htm +40 -34
  287. package/payload/starter/_basic/examples/toast.htm +145 -147
  288. package/payload/starter/_basic/examples/toggle-2.htm +99 -68
  289. package/payload/starter/_basic/examples/toggle-3.htm +104 -101
  290. package/payload/starter/_basic/examples/toggle.htm +161 -93
  291. package/payload/starter/_basic/examples/tool-bar.htm +172 -0
  292. package/payload/starter/_basic/examples/tooltip-2.htm +110 -60
  293. package/payload/starter/_basic/examples/tooltip-3.htm +124 -65
  294. package/payload/starter/_basic/examples/tooltip-4.htm +218 -0
  295. package/payload/starter/_basic/examples/tooltip.htm +206 -124
  296. package/payload/starter/_basic/examples/tree-view.htm +210 -182
  297. package/payload/starter/_basic/examples/ui-effects.htm +207 -185
  298. package/payload/starter/_basic/examples/ui-standards.htm +200 -139
  299. package/payload/starter/_basic/examples/url-field.htm +120 -0
  300. package/payload/starter/_basic/examples/web-view.htm +109 -110
  301. package/payload/starter/_basic/min/accordion.min.js +2 -0
  302. package/payload/starter/_basic/min/action-button.min.js +1 -1
  303. package/payload/starter/_basic/min/app-bar.min.js +1 -1
  304. package/payload/starter/_basic/min/badge.min.js +2 -0
  305. package/payload/starter/_basic/min/bottom-bar.min.js +1 -1
  306. package/payload/starter/_basic/min/canvas.min.js +2 -0
  307. package/payload/starter/_basic/min/chat-view.min.js +2 -0
  308. package/payload/starter/_basic/min/check-box.min.js +1 -1
  309. package/payload/starter/_basic/min/code-editor.min.js +2 -0
  310. package/payload/starter/_basic/min/color-picker.min.js +2 -0
  311. package/payload/starter/_basic/min/context-menu.min.js +1 -1
  312. package/payload/starter/_basic/min/currency-field.min.js +2 -0
  313. package/payload/starter/_basic/min/data-table.min.js +1 -1
  314. package/payload/starter/_basic/min/date-picker.min.js +2 -0
  315. package/payload/starter/_basic/min/dialog.min.js +1 -1
  316. package/payload/starter/_basic/min/email-field.min.js +2 -0
  317. package/payload/starter/_basic/min/file-picker.min.js +2 -0
  318. package/payload/starter/_basic/min/filters.min.js +1 -1
  319. package/payload/starter/_basic/min/form.min.js +1 -1
  320. package/payload/starter/_basic/min/full-screen-select.min.js +1 -1
  321. package/payload/starter/_basic/min/gauge.min.js +1 -1
  322. package/payload/starter/_basic/min/graph-box.min.js +2 -0
  323. package/payload/starter/_basic/min/grid-group.min.js +2 -0
  324. package/payload/starter/_basic/min/hold-to-confirm-button.min.js +1 -1
  325. package/payload/starter/_basic/min/image-view.min.js +2 -0
  326. package/payload/starter/_basic/min/item-list.min.js +1 -1
  327. package/payload/starter/_basic/min/json-editor.min.js +2 -0
  328. package/payload/starter/_basic/min/json-view.min.js +2 -0
  329. package/payload/starter/_basic/min/label-editor.min.js +1 -1
  330. package/payload/starter/_basic/min/left-menu.min.js +1 -1
  331. package/payload/starter/_basic/min/line-progress-bar.min.js +1 -1
  332. package/payload/starter/_basic/min/loading-screen.min.js +1 -1
  333. package/payload/starter/_basic/min/log-view.min.js +2 -0
  334. package/payload/starter/_basic/min/login-page.min.js +2 -0
  335. package/payload/starter/_basic/min/markdown-view.min.js +2 -0
  336. package/payload/starter/_basic/min/menu-bar.min.js +2 -0
  337. package/payload/starter/_basic/min/mini-graph-box.min.js +1 -1
  338. package/payload/starter/_basic/min/minimal-accent.min.js +2 -0
  339. package/payload/starter/_basic/min/notice.min.js +1 -1
  340. package/payload/starter/_basic/min/number-field.min.js +2 -0
  341. package/payload/starter/_basic/min/numeric-keyboard.min.js +1 -1
  342. package/payload/starter/_basic/min/page-control.min.js +1 -1
  343. package/payload/starter/_basic/min/password-field.min.js +2 -0
  344. package/payload/starter/_basic/min/phone-field.min.js +2 -0
  345. package/payload/starter/_basic/min/progress-bar.min.js +1 -1
  346. package/payload/starter/_basic/min/property-panel.min.js +1 -1
  347. package/payload/starter/_basic/min/radio-button.min.js +1 -1
  348. package/payload/starter/_basic/min/range-slider.min.js +2 -0
  349. package/payload/starter/_basic/min/rich-text-editor.min.js +1 -1
  350. package/payload/starter/_basic/min/scroll-area.min.js +2 -0
  351. package/payload/starter/_basic/min/scrolling-text.min.js +1 -1
  352. package/payload/starter/_basic/min/search-input.min.js +2 -0
  353. package/payload/starter/_basic/min/search-results.min.js +1 -1
  354. package/payload/starter/_basic/min/select-box.min.js +1 -1
  355. package/payload/starter/_basic/min/settings-row.min.js +1 -1
  356. package/payload/starter/_basic/min/side-panel.min.js +1 -1
  357. package/payload/starter/_basic/min/slider-field.min.js +1 -1
  358. package/payload/starter/_basic/min/slider.min.js +1 -1
  359. package/payload/starter/_basic/min/smart-button.min.js +1 -1
  360. package/payload/starter/_basic/min/smart-table.min.js +1 -1
  361. package/payload/starter/_basic/min/sortable-list.min.js +1 -1
  362. package/payload/starter/_basic/min/spark-line-box.min.js +1 -1
  363. package/payload/starter/_basic/min/splitter.min.js +2 -0
  364. package/payload/starter/_basic/min/status-bar.min.js +2 -0
  365. package/payload/starter/_basic/min/step-bar.min.js +2 -0
  366. package/payload/starter/_basic/min/stepper.min.js +1 -1
  367. package/payload/starter/_basic/min/tabs.min.js +1 -1
  368. package/payload/starter/_basic/min/tag-input.min.js +1 -1
  369. package/payload/starter/_basic/min/text-area-field.min.js +2 -0
  370. package/payload/starter/_basic/min/text-field.min.js +2 -0
  371. package/payload/starter/_basic/min/time-line.min.js +1 -1
  372. package/payload/starter/_basic/min/time-picker.min.js +2 -0
  373. package/payload/starter/_basic/min/tiny-select.min.js +1 -1
  374. package/payload/starter/_basic/min/toast.min.js +1 -1
  375. package/payload/starter/_basic/min/toggle.min.js +1 -1
  376. package/payload/starter/_basic/min/tool-bar.min.js +2 -0
  377. package/payload/starter/_basic/min/tooltip.min.js +1 -1
  378. package/payload/starter/_basic/min/tree-view.min.js +1 -1
  379. package/payload/starter/_basic/min/ui-effects.min.js +1 -1
  380. package/payload/starter/_basic/min/url-field.min.js +2 -0
  381. package/payload/starter/_basic/min/web-view.min.js +1 -1
  382. package/payload/templates/booking/app/app.js +11 -8
  383. package/payload/templates/booking/app/settings.js +4 -4
  384. package/payload/templates/booking/index.htm +3 -3
  385. package/payload/templates/booking/pages/account.js +6 -6
  386. package/payload/templates/booking/pages/book.js +1 -1
  387. package/payload/templates/booking/pages/services.js +5 -4
  388. package/payload/templates/classic/app/app.js +15 -11
  389. package/payload/templates/classic/app/settings.js +22 -20
  390. package/payload/templates/classic/assets/_attribute.txt +2 -0
  391. package/payload/templates/classic/assets/cards/dill.png +0 -0
  392. package/payload/templates/classic/assets/cards/fennel.png +0 -0
  393. package/payload/templates/classic/assets/cards/juniper.png +0 -0
  394. package/payload/templates/classic/assets/cards/olives.png +0 -0
  395. package/payload/templates/classic/assets/cards/oregano.png +0 -0
  396. package/payload/templates/classic/assets/cards/pepper.png +0 -0
  397. package/payload/templates/classic/assets/cards/rosehip.png +0 -0
  398. package/payload/templates/classic/assets/categories/cappuccino.png +0 -0
  399. package/payload/templates/classic/assets/categories/chocolate-milk.png +0 -0
  400. package/payload/templates/classic/assets/categories/coffee.png +0 -0
  401. package/payload/templates/classic/assets/categories/frappe.png +0 -0
  402. package/payload/templates/classic/assets/categories/iced-caffee.png +0 -0
  403. package/payload/templates/classic/assets/categories/milkshake.png +0 -0
  404. package/payload/templates/classic/assets/categories/orange-juice.png +0 -0
  405. package/payload/templates/classic/assets/categories/tea.png +0 -0
  406. package/payload/templates/classic/index.htm +2 -2
  407. package/payload/templates/classic/pages/example.js +10 -10
  408. package/payload/templates/classic/pages/examples.js +44 -43
  409. package/payload/templates/classic/pages/home.js +16 -15
  410. package/payload/templates/classic/pages/info-pages.js +5 -5
  411. package/payload/templates/classic/pages/search.js +8 -7
  412. package/payload/templates/classic/pages/settings.js +13 -13
  413. package/payload/templates/classic/pages/tasks.js +1 -0
  414. package/payload/templates/classic/pages/template-pages.js +12 -11
  415. package/payload/templates/coffee-shop/app/app.js +12 -8
  416. package/payload/templates/coffee-shop/app/settings.js +4 -4
  417. package/payload/templates/coffee-shop/index.htm +3 -3
  418. package/payload/templates/coffee-shop/pages/drink.js +1 -1
  419. package/payload/templates/coffee-shop/pages/menu.js +5 -4
  420. package/payload/templates/forms/TEMPLATE.md +1 -1
  421. package/payload/templates/forms/appointment-form.htm +55 -53
  422. package/payload/templates/forms/contact-form-to-mail.htm +38 -37
  423. package/payload/templates/forms/contact-form-to-supabase.htm +47 -46
  424. package/payload/templates/forms/dark-contact-form.htm +43 -40
  425. package/payload/templates/forms/event-registration-form.htm +80 -77
  426. package/payload/templates/forms/feedback-form.htm +54 -54
  427. package/payload/templates/forms/order-form.htm +88 -84
  428. package/payload/templates/forms/recruitment-form.htm +60 -60
  429. package/payload/templates/forms/service/readme.md +9 -8
  430. package/payload/templates/forms/service/send-form-mail.php +38 -21
  431. package/payload/templates/forms/support-ticket-form.htm +67 -65
  432. package/payload/templates/panel/common/module-page.js +2 -2
  433. package/payload/templates/panel/common/theme.js +37 -10
  434. package/payload/templates/panel/common/top-bar.js +45 -40
  435. package/payload/templates/panel/index.htm +59 -60
  436. package/payload/templates/panel/module10/greenhouse.htm +98 -113
  437. package/payload/templates/panel/module11/arduino-projects.htm +47 -58
  438. package/payload/templates/panel/module6/energy-hub.htm +71 -103
  439. package/payload/templates/panel/module7/3d-printers.htm +58 -81
  440. package/payload/templates/panel/module8/cold-rooms.htm +58 -79
  441. package/payload/templates/panel/module9/elevator-fleet.htm +72 -93
  442. package/payload/templates/panel/pages/activity.js +134 -152
  443. package/payload/templates/panel/pages/contents.js +291 -308
  444. package/payload/templates/panel/pages/customers.js +250 -267
  445. package/payload/templates/panel/pages/edit-user.js +31 -30
  446. package/payload/templates/panel/pages/home.js +39 -70
  447. package/payload/templates/panel/pages/media.js +166 -183
  448. package/payload/templates/panel/pages/notifications.js +7 -7
  449. package/payload/templates/panel/pages/orders.js +200 -217
  450. package/payload/templates/panel/pages/products.js +259 -278
  451. package/payload/templates/panel/pages/reports.js +74 -123
  452. package/payload/templates/panel/pages/roles.js +57 -60
  453. package/payload/templates/panel/pages/settings.js +127 -143
  454. package/payload/templates/panel/pages/user-actions.js +106 -110
  455. package/payload/templates/panel/pages/user-list.js +221 -238
  456. package/payload/templates/panel/pages/users.js +14 -29
  457. package/payload/templates/shop/TEMPLATE.md +1 -1
  458. package/payload/templates/shop/app/app.js +11 -8
  459. package/payload/templates/shop/app/settings.js +4 -4
  460. package/payload/templates/shop/index.htm +3 -3
  461. package/payload/templates/shop/pages/account.js +7 -7
  462. package/payload/templates/shop/pages/cart.js +1 -1
  463. package/payload/templates/shop/pages/checkout.js +2 -2
  464. package/payload/templates/shop/pages/product.js +2 -2
  465. package/payload/templates/shop/pages/shop.js +6 -5
  466. package/payload/templates/starter/TEMPLATE.md +1 -1
  467. package/payload/templates/starter/app/app.js +12 -8
  468. package/payload/templates/starter/app/settings.js +14 -11
  469. package/payload/templates/starter/index.htm +3 -3
  470. package/payload/templates/starter/pages/about.js +1 -1
  471. package/payload/templates/starter/pages/home.js +2 -2
  472. package/payload/templates/starter/pages/product.js +1 -1
  473. package/payload/templates/starter/pages/products.js +5 -5
  474. package/payload/templates/starter/pages/settings.js +1 -1
  475. package/payload/templates/starter/pages/tasks.js +8 -8
  476. package/payload/templates/starter/pages/website.js +1 -1
  477. package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +0 -13
  478. package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +0 -9
  479. package/payload/starter/_basic/comp/chart-box.js +0 -868
  480. package/payload/starter/_basic/comp/email-input-b.js +0 -57
  481. package/payload/starter/_basic/comp/input-b.js +0 -759
  482. package/payload/starter/_basic/comp/password-input-b.js +0 -164
  483. package/payload/starter/_basic/comp/search-input-v2.js +0 -427
  484. package/payload/starter/_basic/comp/textarea-b.js +0 -184
  485. package/payload/starter/_basic/comp/url-input-b.js +0 -145
  486. package/payload/starter/_basic/examples/badgeV2.htm +0 -68
  487. package/payload/starter/_basic/examples/chart-box.htm +0 -287
  488. package/payload/starter/_basic/examples/check-box-1.htm +0 -220
  489. package/payload/starter/_basic/examples/currency-input-b.htm +0 -71
  490. package/payload/starter/_basic/examples/email-input-b.htm +0 -67
  491. package/payload/starter/_basic/examples/input-b-ex1.htm +0 -132
  492. package/payload/starter/_basic/examples/input-b-ex2.htm +0 -136
  493. package/payload/starter/_basic/examples/input-b-ex3-style.htm +0 -113
  494. package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +0 -112
  495. package/payload/starter/_basic/examples/input-b-ex6-dark.htm +0 -108
  496. package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +0 -153
  497. package/payload/starter/_basic/examples/number-input-b.htm +0 -68
  498. package/payload/starter/_basic/examples/password-input-b.htm +0 -70
  499. package/payload/starter/_basic/examples/phone-input-b-select-country.htm +0 -298
  500. package/payload/starter/_basic/examples/phone-input-b.htm +0 -72
  501. package/payload/starter/_basic/examples/radio-button-1.htm +0 -264
  502. package/payload/starter/_basic/examples/search-input-v2-ozden.htm +0 -128
  503. package/payload/starter/_basic/examples/search-input-v2.htm +0 -65
  504. package/payload/starter/_basic/examples/select-color.htm +0 -215
  505. package/payload/starter/_basic/examples/select-date.htm +0 -244
  506. package/payload/starter/_basic/examples/select-file.htm +0 -268
  507. package/payload/starter/_basic/examples/select-time.htm +0 -249
  508. package/payload/starter/_basic/examples/smart-button-2.htm +0 -220
  509. package/payload/starter/_basic/examples/textarea-b.htm +0 -76
  510. package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +0 -221
  511. package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +0 -221
  512. package/payload/starter/_basic/examples/url-input-b.htm +0 -85
  513. package/payload/starter/_basic/min/badge-v2.min.js +0 -2
  514. package/payload/starter/_basic/min/chart-box.min.js +0 -2
  515. package/payload/starter/_basic/min/currency-input-b.min.js +0 -2
  516. package/payload/starter/_basic/min/email-input-b.min.js +0 -2
  517. package/payload/starter/_basic/min/input-b.min.js +0 -2
  518. package/payload/starter/_basic/min/login-page-v2.min.js +0 -2
  519. package/payload/starter/_basic/min/number-input-b.min.js +0 -2
  520. package/payload/starter/_basic/min/password-input-b.min.js +0 -2
  521. package/payload/starter/_basic/min/phone-input-b.min.js +0 -2
  522. package/payload/starter/_basic/min/search-input-v2.min.js +0 -2
  523. package/payload/starter/_basic/min/select-color.min.js +0 -2
  524. package/payload/starter/_basic/min/select-date.min.js +0 -2
  525. package/payload/starter/_basic/min/select-file.min.js +0 -2
  526. package/payload/starter/_basic/min/select-time.min.js +0 -2
  527. package/payload/starter/_basic/min/textarea-b.min.js +0 -2
  528. package/payload/starter/_basic/min/url-input-b.min.js +0 -2
  529. package/payload/templates/panel/common/bridge.min.js +0 -0
  530. package/payload/templates/panel/common/full-view.min.js +0 -1
  531. package/payload/templates/panel/common/main-view.min.js +0 -1
  532. package/payload/templates/panel/common/module-page.min.js +0 -1
  533. package/payload/templates/panel/common/right-view.min.js +0 -1
  534. package/payload/templates/panel/common/start-page.min.js +0 -1
  535. package/payload/templates/panel/common/top-bar-v25-07-29-1.js +0 -330
  536. package/payload/templates/panel/common/top-bar-v25-07-29-2.js +0 -265
  537. package/payload/templates/panel/common/top-bar.min.js +0 -1
  538. package/payload/templates/panel/common/ui-standards.min.js +0 -1
  539. package/payload/templates/panel/managers/database.min.js +0 -1
  540. package/payload/templates/panel/managers/login.min.js +0 -1
  541. package/payload/templates/panel/pages/_page-template.min.js +0 -1
  542. package/payload/templates/panel/pages/contents.min.js +0 -1
  543. package/payload/templates/panel/pages/edit-user.min.js +0 -1
  544. package/payload/templates/panel/pages/edit-users-table.min.js +0 -1
  545. package/payload/templates/panel/pages/home.min.js +0 -1
  546. package/payload/templates/panel/pages/notifications.min.js +0 -1
  547. package/payload/templates/panel/pages/reports.min.js +0 -1
  548. package/payload/templates/panel/pages/settings.min.js +0 -1
  549. package/payload/templates/panel/pages/user-actions.min.js +0 -2
  550. package/payload/templates/panel/pages/users.min.js +0 -1
  551. /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn.png +0 -0
  552. /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn2.png +0 -0
  553. /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn.png +0 -0
  554. /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn2.png +0 -0
  555. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear-round.svg +0 -0
  556. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear.svg +0 -0
  557. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.png +0 -0
  558. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.svg +0 -0
  559. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/search.svg +0 -0
@@ -2,65 +2,79 @@
2
2
 
3
3
  /*
4
4
 
5
- Smart Button - v26.10
5
+ Smart Button - v26.11
6
6
 
7
- THE DEFAULT BUTTON of new pages and projects (the user, 2026-10-30). It was ButtonWithIcon
8
- (comp/button-with-icon.js) until 2026-10-30: renamed and moved to comp-m4.
7
+ THE DEFAULT BUTTON of new pages and projects.
8
+
9
+ THE MODEL PAGE: _basic/examples/smart-button.htm: new pages and projects take their buttons from it.
10
+ The other samples: smart-button-alternatif.htm (pill and outlined with the colors of the page), smart-button-3-ozden.htm
11
+ (the templates), smart-button-4-dark.htm (the dark templates and tones), smart-button-5-features.htm.
9
12
 
10
13
  - A button with an icon and a text (or only one of them); the icon on the left or on top (iconPosition).
11
- - STYLE PACKAGES (SmartButton.styles; sample _basic/examples/smart-button-3-ozden.htm; the draft
12
- _designs/smart-button.htm): "ozdenType1" (THE DEFAULT: SmartButtonDefaults.style): #E3E3E3, a thin dark edge and
13
- a darker line at the bottom; "ozdenType2": no bottom line; "ozdenType3": a faint edge; "ozdenType4": a ghost (no
14
- surface, no edge, only its hover is gray); "classic": the look of before 2026-10-30 (a white button, a bold 16 px
15
- text). A page gives its own color in style.box / hover / active.
16
- DARK (2026-10-31, the draft _designs/smart-button-dark.htm): "ozdenType1Dark" ... "ozdenType4Dark": the same shapes
17
- for a dark page (#2E2E2C, a light edge, a white text and icon, the dark waiting clock, yellow dots).
18
- SITUATIONS (2026-10-31, the draft _designs/smart-button-colors.htm): ozdenType1 in the color of a situation:
19
- "primary" #5BBAC1, "danger" #E8796D (a white text), "warning" #F1C74A, "success" #7BC362, "info" #52A8D0. The Dialog
20
- uses them for its button types.
21
- PILL AND OUTLINED (2026-11-02, the user; sample _basic/examples/smart-button.htm): 52 px high with a 30 px icon.
22
- "pill": round, no edge, a bold text on a soft tint; "pillSolid": the full color with a white text; "outlined": a
23
- colored edge with a thicker line at the bottom. Without a tone they are gray.
24
- - TONE (2026-11-02, the user): the shape comes from styleName, the color from tone: styleName: "outlined", tone: "blue".
25
- Any shape works with any name of SmartButton.TONES: gray, blue, green, purple, orange, red, yellow, teal, sky, navy,
26
- pink, primary, danger, warning, success, info. A new color is one new row there. The order: style > tone > package.
27
- ozdenType4 stays a ghost: its text and its hover take the color. setTone(name, styleName): after create (the look of
28
- the package again, then the tone; style given with params goes).
14
+ - THE LOOK IN THREE STEPS. The order: style > tone > the template.
15
+ 1. styleName: the template (the shape), gray. "ozden" (THE DEFAULT: #E3E3E3, a thin dark edge and a darker
16
+ line at the bottom), "ozden2" (no bottom line), "ozden3" (a faint edge), "ozden4" (a ghost: no
17
+ surface, no edge, only its hover is gray), "pill" (round, no edge, a bold text), "outlined" (round, a thicker
18
+ edge with a line at its bottom). For a dark page (the draft _designs/smart-button-dark.htm):
19
+ "ozdenDark" ... "ozden4Dark" (#2E2E2C, a white text and icon, the dark waiting clock).
20
+ "minimal" / "minimalDark" (the minimal theme, _designs/minimal-theme.htm): 28 px high, a 13 px text, only a line
21
+ that gets darker under the mouse; the main action takes the tone "ink" / "inkDark"; a delete "minimalDanger" /
22
+ "minimalDangerDark" (the line and the text in the danger color).
23
+ A template is only a style (SmartButton.styles); the minimal ones also give the height.
24
+ 2. tone: a color of the kit (SmartButton.tones), three colors: the button, the button under the mouse, its text.
25
+ "white", "cyan" (the main action), "orange" (a delete, a reject), "yellow" (go on, but look first), "green"
26
+ (after a good result), "blue" (nothing changes). For a dark page: "cyanDark", "orangeDark", "yellowDark",
27
+ "greenDark", "blueDark" (deeper, a light text and a white icon). "": the gray of the template. setTone().
28
+ "ink" / "inkDark" (the main action of the minimal templates) color the edge too (a tone with edge / hoverEdge).
29
+ A tone looks the same on every template: its text (and its icon) come with it.
30
+ 3. style: your own look, only the keys you change. A color is two colors: the button and the button under the mouse.
31
+ style: { box: { color: "#9DC7B5" }, hover: { color: "#91BCA9" } }
32
+ Pressed, a button gets a little smaller and darker (animated: 1, style.press): a press has no color of its own.
33
+ - AN ICON BUTTON: labelText: "" -> the icon in the middle, no room at the sides; with no width it is a square
34
+ (44 x 44). The same template and tone as a text button. Give it an ariaLabel.
35
+ An "auto" height keeps the room of style.layout.padding (Ex: padding [10, 10] -> 44 x 44).
36
+ - HEIGHT: 44 by default (40 looked narrow); every template, pill and outlined too. An icon on
37
+ top of a text makes it "auto" (as high as its padding and content).
29
38
  - KEYBOARD AND ACCESSIBILITY: role "button", Tab reaches it, Enter / Space press it (Space when it goes up), a focus
30
39
  ring only for the keyboard; ariaLabel for a button with only an icon (else labelText is read).
31
40
  - setEnabled(0): no click, no hover, out of the Tab order (aria-disabled): a flat light gray button, a faint edge, no
32
41
  bottom line, the text and the icon faint gray (the same for every color; chosen on
33
42
  experimental/smart-button-bench.htm).
34
- - ASK (two clicks): ask: "Click again to delete." -> the first click turns the button red (style.ask.button) and
43
+ - ASK (two clicks): ask: "Click again to delete." -> the first click turns the button orange (style.ask.button) and
35
44
  shows the text in a bubble over it (comp/tooltip.js, Tooltip.show(): it stays inside the screen; without
36
- tooltip.js only the red button); the second click runs onClick. It forgets after style.ask.time. One button asks
45
+ tooltip.js only the orange button); the second click runs onClick. It forgets after style.ask.time. One button asks
37
46
  at a time. setAsk(text), cancelAsk(), isAsking. onBeforeClick(self) returns false: no ask and no onClick (Ex: a
38
47
  form with an error must not ask "Sure?" first). press(): a press like a click (the ask too), Ex: Enter in a field.
39
48
  - WAITING: setWaiting(1) while a job runs (a download, a save): the text and the icon fade and a small animation is
40
49
  in the middle; the button can not be clicked. waitingType: "clock" (the default: the clock of the waiting views
41
- with moving hands; waitingClock "ozden" or "ozdenDark") or "dots" (three dots one after the other).
50
+ with moving hands; style.waiting.clock "ozden", or "ozdenDark" in the dark templates) or "dots" (three dots one
51
+ after the other).
42
52
  setWaiting(0) ends it (after delay ms, if given). Nothing turns with prefers-reduced-motion.
43
53
  (comp/loading-screen.js draws its clock and its dots with SmartButton.createClockSvg / createDots)
44
- - MOTION: animated: 1 (default): pressed 0.94 and a little darker. ripple: 1 (default): a wave from the pressed
45
- point (from the middle for the keyboard); its color fits the button. setAnimated(0/1), setRipple(0/1).
54
+ - MOTION: animated: 1 (default): pressed 0.94 and a little darker. ripple: 0 (default; 1 gives a wave from the
55
+ pressed point, from the middle for the keyboard; its color fits the button). setAnimated(0/1), setRipple(0/1).
46
56
  - setStyle(style): changes the look after create with only the keys it gets.
47
57
 
48
58
  USAGE:
49
- SmartButton({ labelText: "Send", iconFile: "_basic/assets/icons/send.png", onClick: function (self) { } });
59
+ SmartButton({ labelText: "Cancel", onClick: function (self) { } }); // the default: ozden, gray
60
+ SmartButton({ tone: "cyan", labelText: "Send", iconFile: "_basic/assets/icons/send.png", onClick: send });
61
+ SmartButton({ styleName: "pill", tone: "blue", labelText: "Follow" });
62
+ SmartButton({ styleName: "ozdenDark", tone: "blueDark", labelText: "Send" }); // on a dark page
63
+ SmartButton({ styleName: "ozden2", tone: "white", labelText: "", iconFile: "trash.svg", ariaLabel: "Delete", ask: "Click again to delete.", onClick: deleteFile });
64
+ SmartButton({ labelText: "Archive", style: { box: { color: "#C3DBCE" }, hover: { color: "#B5D0C1" } } }); // your own color
50
65
  const btnDownload = SmartButton({ labelText: "Download", onClick: function (self) {
51
66
  self.setWaiting(1);
52
67
  download().then(function () { self.setWaiting(0); });
53
68
  } });
54
- SmartButton({ styleName: "ozdenType4", labelText: "Delete", ask: "Click again to delete.", onClick: deleteFile });
55
- SmartButton({ styleName: "pill", tone: "green", labelText: "Accepted", iconFile: "check.svg" });
56
- button.setTone("blue", "pillSolid"); // another color and shape after create
57
- btnSave.setStyle({ box: { color: "#9DC7B5" }, hover: { color: "#91BCA9" }, active: { color: "#91BCA9" } });
69
+ btnSave.setTone("green"); // another color after create ("": the gray of its template)
58
70
 
59
71
  Started Date: January 2026
60
- Developer: Bugra Ozden
61
- Email: bugra.ozden@gmail.com
62
72
  Webpage: https://bug7a.github.io/js-components/
63
73
 
74
+ Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
75
+ Licensed under the Apache License, Version 2.0
76
+ SPDX-License-Identifier: Apache-2.0
77
+
64
78
  */
65
79
 
66
80
  "use strict";
@@ -68,38 +82,38 @@ Webpage: https://bug7a.github.io/js-components/
68
82
  // Default values:
69
83
  const SmartButtonDefaults = {
70
84
  key: "0",
71
- styleName: "ozdenType1", // SmartButton.styles: "ozdenType1" (the default), "ozdenType2", "ozdenType3", "ozdenType4", "classic", "pill", "pillSolid", "outlined"...
72
- tone: "", // the color: a name of SmartButton.TONES (Ex: "blue", "primary"). "": the colors of the package. setTone()
73
- width: "auto",
74
- height: "auto",
75
- labelText: "Button",
85
+ styleName: "ozden", // the template (SmartButton.styles): "ozden" (the default) ... "ozden4", "pill", "outlined", "ozdenDark" ... "ozden4Dark", "minimal", "minimalDark", "minimalDanger", "minimalDangerDark"
86
+ tone: "", // a color of the kit (SmartButton.tones): "white", "cyan", "orange", "yellow", "green", "blue", "cyanDark"..., "ink" / "inkDark" (minimal). "": the gray of the template. setTone()
87
+ width: "auto", // an icon button (labelText: "") is a square
88
+ height: 44, // "auto": as high as its padding and content (an icon on top of a text is "auto")
89
+ labelText: "Button", // "": an icon button
90
+ allowHtml: 0, // 1: labelText is HTML (only for your own texts)
76
91
  iconFile: "", // "": no icon (Ex: "_basic/comp/smart-button/alert-black.png")
77
92
  iconPosition: "left", // "left", "top"
78
93
  enabled: 1, // 0: gray, can not be pressed (set later with setEnabled)
79
- ariaLabel: "", // "": labelText is read. A button with only an icon needs it (Ex: "Delete")
94
+ ariaLabel: "", // "": labelText is read. An icon button needs it (Ex: "Delete")
80
95
  waiting: 0, // 1: it waits (set later with setWaiting)
81
96
  waitingType: "clock", // "clock" (the default wait) or "dots"
82
- waitingClock: "ozden", // the look of the clock: "ozden" (a white face, dark lines) or "ozdenDark" (SmartButton.clocks)
83
- animated: 1, // 1: the press effect (smaller and darker while pressed). setAnimated()
84
- ripple: 1, // 1: a wave from the pressed point (it works with animated: 0 too). setRipple()
85
- ask: "", // "Click again to delete.": two clicks (the first one asks with a red button and this text in a bubble). setAsk()
97
+ animated: 1, // 1: pressed it gets smaller and darker (style.press). setAnimated()
98
+ ripple: 0, // 1: a wave from the pressed point (it works with animated: 0 too). setRipple()
99
+ ask: "", // "Click again to delete.": two clicks (the first one asks with an orange button and this text in a bubble). setAsk()
86
100
  onBeforeClick: null, // function (self): false stops the press, with no ask either
87
101
  onClick: function (self) { }, // Not called while waiting
88
102
  onWaitingEnd: function (self) { }, // The wait ended (setWaiting(0))
89
- style: { // ozdenType1 (the default package)
103
+ style: { // ozden (the default template)
90
104
  layout: {
91
105
  gap: 8,
92
106
  padding: [16, 0],
93
107
  align: "center center",
94
108
  // px less space on the side of the icon (an icon left of a text): the empty edge in an icon file and its
95
- // thin lines made that side look wider (measured 1 - 3 px; the user, 2026-10-30). 0: the same on both sides
109
+ // thin lines made that side look wider (measured 1 - 3 px). 0: the same on both sides
96
110
  iconSideTrim: 2,
97
111
  },
98
112
  icon: {
99
113
  width: 24,
100
114
  height: 24,
101
115
  opacity: 0.8,
102
- filter: "none", // a CSS filter: the dark packages turn the icon white ("brightness(0) invert(1)")
116
+ filter: "none", // a CSS filter: the dark templates turn the icon white ("brightness(0) invert(1)")
103
117
  },
104
118
  label: {
105
119
  fontSize: 20,
@@ -114,22 +128,23 @@ const SmartButtonDefaults = {
114
128
  boxShadow: "inset 0 -2px 0 rgba(0, 0, 0, 0.25)",
115
129
  },
116
130
  hover: {
117
- color: "#D9D9D9",
118
- },
119
- active: {
120
- color: "#D9D9D9",
131
+ color: "#D9D9D9", // under the mouse (pressed: this color, darker)
132
+ borderColor: "", // the edge under the mouse. "": the edge of box (the minimal templates darken it)
121
133
  },
122
- // ask: the red look of the button while it asks, and the bubble over it (Tooltip.BUBBLE_LOOK keys)
134
+ // ask: the look of the button while it asks, and the bubble over it (Tooltip.BUBBLE_LOOK keys).
135
+ // #DE815B (the orange of danger); its own value, not the orange tone,
136
+ // so the two can be changed apart.
123
137
  ask: {
124
138
  button: {
125
- color: "#E8796D", // also under the mouse and pressed
126
- border: 1,
127
- borderColor: "#E8796D",
139
+ color: "#DE815B", // also under the mouse and pressed
140
+ // WHY no border width: the edge of the template stays, so a pill (0) or an outlined (2) button keeps
141
+ // its size while it asks (border: 1 made an "auto" pill 2 px wider)
142
+ borderColor: "#DE815B",
128
143
  boxShadow: "none",
129
144
  textColor: "white",
130
145
  iconFilter: "brightness(0) invert(1)", // the icon turns white, whatever color its file has
131
146
  },
132
- bubble: { color: "#E8796D", textColor: "white", fontSize: 13, bold: 1, round: 8, padding: [12, 7], border: 0, borderColor: "", shadow: "0 6px 16px rgba(0, 0, 0, 0.18)", arrow: 12, gap: 6, edge: 8, grow: 1 },
147
+ bubble: { color: "#DE815B", textColor: "white", fontSize: 13, bold: 1, round: 8, padding: [12, 7], border: 0, borderColor: "", shadow: "0 6px 16px rgba(0, 0, 0, 0.18)", arrow: 12, gap: 6, edge: 8, grow: 1 },
133
148
  time: 5000, // ms: it forgets the question
134
149
  },
135
150
  focus: {
@@ -141,9 +156,10 @@ const SmartButtonDefaults = {
141
156
  textColor: "rgba(0, 0, 0, 0.3)",
142
157
  iconOpacity: 0.25, // (and no color)
143
158
  },
159
+ // The press (animated: 1). WHY no color for it: two colors are enough, the press
160
+ // only darkens the color of the moment
144
161
  press: {
145
162
  scale: 0.94, // while pressed
146
- removeShadow: 0, // 1: while pressed the box shadow (Ex: the inset bottom line) goes away, as if pushed in
147
163
  brightness: 0.92, // while pressed
148
164
  time: 0.15, // s
149
165
  },
@@ -154,6 +170,7 @@ const SmartButtonDefaults = {
154
170
  time: 0.6, // s
155
171
  },
156
172
  waiting: {
173
+ clock: "ozden", // the look of the clock: "ozden" (a white face, dark lines), "ozdenDark", or the ring of "minimal" / "minimalDark" (SmartButton.clocks)
157
174
  contentOpacity: 0.18, // the text and the icon while waiting
158
175
  clockSize: 30, // at most; a small button gets a smaller clock
159
176
  space: 14, // the room around the clock in a small button
@@ -164,74 +181,76 @@ const SmartButtonDefaults = {
164
181
 
165
182
  const SmartButton = function (params = {}) {
166
183
 
167
- // Merge params:
168
- SmartButton.applyTone(params);
169
- basic.applyStylePackage(params, SmartButton.styles, SmartButtonDefaults);
184
+ // Merge params: style > tone > the template (styleName) > the defaults
185
+ SmartButton.applyLook(params);
186
+ const hasText = (params.labelText !== "");
187
+ // WHY: 44 is the height of a row; an icon above its text needs more (about 60)
188
+ if (params.iconPosition === "top" && hasText && params.height === undefined) params.height = "auto";
170
189
  mergeIntoIfMissing(params, SmartButtonDefaults);
190
+ // AN ICON BUTTON (no text): a square when no width is given.
191
+ // WHY only with a number height: an "auto" one is as big as its padding and its icon (Ex: 10 + 24 + 10)
192
+ const isIconButton = !hasText && (typeof params.height === "number");
193
+ if (isIconButton && params.width === "auto") params.width = params.height;
171
194
 
172
195
  // BOX: Component container
173
196
  const box = startObject(params);
174
197
 
175
198
  // *** PRIVATE VARIABLES:
176
199
  const WAITING_MOTION = "opacity 0.2s"; // the content fades while waiting
177
- const STILL_MOTION = "background-color 0.2s"; // the colors of hover / pressed (animated: 0 too)
200
+ const ASK_ANSWER_DELAY = 400; // ms: a click this soon after the question is the second click of a double click
201
+ const STILL_MOTION = "background-color 0.2s"; // the color under the mouse (animated: 0 too)
178
202
  let cancelWaitingEnd = null;
179
203
  let cancelAskTimer = null;
180
204
  let askBubble = null;
205
+ let askStartTime = 0; // when the question was shown (isAnswerTooSoon)
181
206
  let isHover = 0;
182
207
  let isPressed = 0;
183
208
  let isSpaceDown = 0; // Space went down on this button (it presses when it goes up, like a real button)
184
- let wasAnimated = 0; // the press look was written (setAnimated(0) writes the still look back)
209
+ let isMotionStarted = 0; // the transitions are on after the first view (startMotion)
185
210
 
186
211
  // *** PRIVATE FUNCTIONS:
187
212
 
213
+ const setText = function (label, text) {
214
+ const value = (text === undefined || text === null) ? "" : String(text);
215
+ if (box.allowHtml == 1) label.text = value;
216
+ else label.plainText = value;
217
+ };
218
+
188
219
  const canPress = function () {
189
220
  return box.enabled == 1 && box.waiting != 1;
190
221
  };
191
222
 
192
223
  const isReducedMotion = function () {
193
- return window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
224
+ return SmartButton.isReducedMotion();
194
225
  };
195
226
 
196
227
  const isMotionOn = function () {
197
228
  return box.animated == 1 && !isReducedMotion();
198
229
  };
199
230
 
200
- // THE LOOK OF THE STATE: disabled > asking > pressed > under the mouse > normal
201
- const getBoxColor = function () {
231
+ // THE LOOK OF THE STATE: the normal look, and over it the keys of the state: disabled > asking > under the mouse.
232
+ // (style.disabled and style.ask.button have the key names of the look; pressed: getPressCss darkens it)
233
+ // WHY one order: an ask never meets a disabled or waiting button (setEnabled(0) and setWaiting(1) end it)
234
+ const getLook = function () {
202
235
  const _s = box.style;
203
- if (box.enabled != 1) return _s.disabled.color;
204
- if (box.isAsking == 1) return _s.ask.button.color;
236
+ const look = {
237
+ color: _s.box.color,
238
+ border: _s.box.border,
239
+ borderColor: _s.box.borderColor,
240
+ boxShadow: _s.box.boxShadow,
241
+ textColor: _s.label.textColor,
242
+ iconOpacity: _s.icon.opacity,
243
+ iconFilter: _s.icon.filter,
244
+ };
245
+ // WHY no shadow when disabled: a flat button is not one that can be pressed in
246
+ if (box.enabled != 1) return Object.assign(look, _s.disabled, { boxShadow: "none" });
247
+ if (box.isAsking == 1) return Object.assign(look, _s.ask.button);
205
248
  // WHY not while waiting: the button stays in its own color under the animation
206
- if (box.waiting == 1) return _s.box.color;
207
- if (isPressed) return _s.active.color;
208
- if (isHover) return _s.hover.color;
209
- return _s.box.color;
210
- };
211
-
212
- const getBorderColor = function () {
213
- if (box.enabled != 1) return box.style.disabled.borderColor;
214
- if (box.isAsking == 1) return box.style.ask.button.borderColor;
215
- return box.style.box.borderColor;
216
- };
217
-
218
- // WHY none when disabled: a flat button is not one that can be pressed in
219
- const getBoxShadow = function () {
220
- if (box.enabled != 1) return "none";
221
- if (box.isAsking == 1) return box.style.ask.button.boxShadow;
222
- if (isPressed && canPress() && box.style.press.removeShadow == 1) return "none";
223
- return box.style.box.boxShadow || "";
224
- };
225
-
226
- const getTextColor = function () {
227
- if (box.enabled != 1) return box.style.disabled.textColor;
228
- if (box.isAsking == 1) return box.style.ask.button.textColor;
229
- return box.style.label.textColor;
230
- };
231
-
232
- const getIconOpacity = function () {
233
- if (box.enabled != 1) return box.style.disabled.iconOpacity;
234
- return (box.style.icon.opacity === undefined) ? 1 : box.style.icon.opacity;
249
+ if (isHover && box.waiting != 1) {
250
+ look.color = _s.hover.color;
251
+ if (_s.hover.borderColor) look.borderColor = _s.hover.borderColor;
252
+ }
253
+ return look;
235
254
  };
236
255
 
237
256
  // The press: smaller and darker while pressed (only with animated: 1)
@@ -243,22 +262,19 @@ const SmartButton = function (params = {}) {
243
262
  };
244
263
  };
245
264
 
246
- const getIconFilter = function () {
247
- if (box.isAsking == 1 && box.enabled == 1) return box.style.ask.button.iconFilter;
248
- return box.style.icon.filter || "none";
249
- };
250
-
251
265
  // Everything that changes with the state: the box, the content, the press, the keyboard and the screen reader
252
266
  const render = function () {
253
267
  const isEnabled = (box.enabled == 1);
254
- box.color = getBoxColor();
255
- box.border = (box.isAsking == 1) ? box.style.ask.button.border : box.style.box.border;
256
- box.borderColor = getBorderColor();
257
- box.css = Object.assign({ boxShadow: getBoxShadow() }, getPressCss());
258
- if (box.label) box.label.textColor = getTextColor();
268
+ const look = getLook();
269
+ box.color = look.color;
270
+ box.border = look.border;
271
+ box.borderColor = look.borderColor;
272
+ box.boxShadow = look.boxShadow;
273
+ box.css = getPressCss();
274
+ if (box.label) box.label.textColor = look.textColor;
259
275
  if (box.icon) {
260
- box.icon.opacity = getIconOpacity();
261
- box.icon.css = { filter: getIconFilter() };
276
+ box.icon.opacity = look.iconOpacity;
277
+ box.icon.css = { filter: look.iconFilter };
262
278
  }
263
279
  box.layout.css = { filter: isEnabled ? "none" : "grayscale(1)" };
264
280
  box.layout.opacity = (box.waiting == 1) ? box.style.waiting.contentOpacity : 1;
@@ -267,8 +283,42 @@ const SmartButton = function (params = {}) {
267
283
  box.aria = { disabled: !isEnabled, label: box.ariaLabel || box.labelText || "" };
268
284
  };
269
285
 
286
+ // The room inside: an icon button has none (its icon in the middle); an icon left of a text has a little less
287
+ // on its side (style.layout.iconSideTrim)
288
+ const paintPadding = function () {
289
+ if (isIconButton) {
290
+ box.layout.padding = 0;
291
+ return;
292
+ }
293
+ const _l = box.style.layout;
294
+ const isIconLeft = box.icon && box.label && box.iconPosition !== "top";
295
+ const padding = Array.isArray(_l.padding) ? _l.padding[0] : _l.padding;
296
+ const trim = isIconLeft ? _l.iconSideTrim : 0;
297
+ box.layout.css = { paddingLeft: Math.max(0, padding - trim) + "px" };
298
+ };
299
+
300
+ // The style on the objects (box, layout, icon, label, focus ring); render() gives the colors of the state.
301
+ const applyStyle = function () {
302
+ const _s = box.style;
303
+ box.props(_s.box);
304
+ box.layout.props(_s.layout);
305
+ paintPadding();
306
+ if (box.icon) box.icon.props(_s.icon);
307
+ if (box.label) box.label.props(_s.label);
308
+ box.setFocusRing(_s.focus.ringColor);
309
+ render();
310
+ };
311
+
312
+ // WHY: the second click of a double click answered the ask before it was read (SmartButton({ ask }) and a
313
+ // Dialog.confirm with danger and ask ran at once)
314
+ const isAnswerTooSoon = function (event) {
315
+ if (event && event.detail > 1) return true;
316
+ return (Date.now() - askStartTime < ASK_ANSWER_DELAY);
317
+ };
318
+
270
319
  const press = function (event) {
271
320
  if (!canPress()) return;
321
+ if (box.isAsking == 1 && isAnswerTooSoon(event)) return;
272
322
  if (typeof box.onBeforeClick === "function" && box.onBeforeClick(box) === false) return;
273
323
  if (box.ask && box.isAsking != 1) {
274
324
  startAsk();
@@ -278,14 +328,14 @@ const SmartButton = function (params = {}) {
278
328
  if (box.onClick) box.onClick(box, event);
279
329
  };
280
330
 
281
- // *** ASK (two clicks): the red look (render) and the bubble (Tooltip.show)
331
+ // *** ASK (two clicks): the orange look (render) and the bubble (Tooltip.show)
282
332
 
283
333
  const startAsk = function () {
284
334
  // WHY one at a time: the bubble of another button would stay over this one
285
- const other = SmartButton.askingButton;
286
- if (other && other !== box) other.cancelAsk();
335
+ if (SmartButton.askingButton) SmartButton.askingButton.cancelAsk();
287
336
  SmartButton.askingButton = box;
288
337
  box.isAsking = 1;
338
+ askStartTime = Date.now();
289
339
  render();
290
340
  if (typeof Tooltip !== "undefined") askBubble = Tooltip.show(box, box.ask, box.style.ask.bubble);
291
341
  cancelAskTimer = box.after(box.style.ask.time, box.cancelAsk);
@@ -322,7 +372,8 @@ const SmartButton = function (params = {}) {
322
372
  dot.style.cssText = "position: absolute; border-radius: 50%; pointer-events: none; background: " + getRippleColor() + ";" +
323
373
  " left: " + (point.x - radius) + "px; top: " + (point.y - radius) + "px; width: " + (radius * 2) + "px; height: " + (radius * 2) + "px;";
324
374
  layer.appendChild(dot);
325
- elem.insertBefore(layer, box.waitingCover.elem); // WHY: under the waiting cover (onClick often starts it)
375
+ // WHY under the waiting cover: onClick often starts it (no cover yet: the layer goes last, the cover comes over it)
376
+ elem.insertBefore(layer, box.waitingCover ? box.waitingCover.elem : null);
326
377
  const wave = dot.animate([
327
378
  { transform: "scale(0)", opacity: 1 },
328
379
  { transform: "scale(1)", opacity: 0.7, offset: 0.6 },
@@ -331,53 +382,98 @@ const SmartButton = function (params = {}) {
331
382
  wave.onfinish = function () { layer.remove(); };
332
383
  };
333
384
 
334
- // *** WAITING
385
+ // *** THE MOTION
335
386
 
336
- // The press transitions, or the still look back (only when it was animated before)
387
+ // The transitions: the press (animated: 1, not with reduced motion) and the color under the mouse (always)
388
+ // WHY not setMotion(): it starts after a timer, and the press must answer the first click
337
389
  const applyAnimated = function () {
338
- if (!isMotionOn()) {
339
- if (!wasAnimated) return;
340
- wasAnimated = 0;
341
- render();
342
- box.setMotionNow(STILL_MOTION);
343
- return;
344
- }
345
- wasAnimated = 1;
390
+ if (!isMotionStarted) return; // (startMotion turns them on)
346
391
  const time = box.style.press.time + "s";
347
- // WHY not setMotion(): it starts after a timer, and the press must answer the first click
348
- box.setMotionNow("transform " + time + ", filter " + time + ", box-shadow " + time + ", " + STILL_MOTION);
349
- render();
392
+ const pressMotion = isMotionOn() ? "transform " + time + ", filter " + time + ", box-shadow " + time + ", " : "";
393
+ box.setMotionNow(pressMotion + STILL_MOTION);
394
+ };
395
+
396
+ // The transitions start after the first view: a state set while the button is made (Ex: setEnabled(0) right
397
+ // after a Dialog is made) is drawn at once, not as a move from its first look (the Save
398
+ // button of a dialog turned from blue to gray when the dialog opened)
399
+ // WHY the frame and the read: the look of now must be the start of a transition, not the look before it
400
+ const startMotion = function () {
401
+ requestAnimationFrame(function () {
402
+ if (box._isRemoved) return;
403
+ void box.elem.offsetWidth; // (the browser takes the look of now)
404
+ isMotionStarted = 1;
405
+ box.layout.setMotionNow(WAITING_MOTION);
406
+ applyAnimated();
407
+ });
350
408
  };
351
409
 
410
+ // *** WAITING
411
+
352
412
  // The clock fits the button: at most its size, smaller in a small button (the dots keep their size)
353
413
  const fitWaitingIcon = function () {
354
414
  const icon = box.waitingCover.icon;
355
415
  if (box.waitingType == "clock") {
356
416
  const _w = box.style.waiting;
357
- const size = Math.max(0, Math.min(_w.clockSize, Math.min(box.width, box.height) - _w.space));
417
+ const room = Math.min(box.width, box.height) - _w.space;
418
+ const size = basic.clamp(room, 0, _w.clockSize);
358
419
  icon.setSize(size, size);
359
420
  }
360
421
  icon.center();
361
422
  };
362
423
 
424
+ // BOX: Waiting cover, made at the first wait: most buttons never wait (it is 2/3 of the objects of a button).
425
+ // Clear: the content fades under it; it holds the animation and takes the mouse.
426
+ const createWaitingCover = function () {
427
+ saveCurrentThat(); // WHY: a wait must not change `that` (Ex: that.setWaiting(1) right after create)
428
+ box.waitingCover = createIn(box, function () {
429
+ const cover = startBox(0, 0, "100%", "100%", {
430
+ color: "transparent",
431
+ clickable: 1, // WHY: it takes the mouse, so its "progress" cursor shows (the hover color: render())
432
+ cursor: "progress",
433
+ });
434
+ if (box.waitingType == "dots") {
435
+ cover.icon = SmartButton.createDots(box.style.waiting.dots);
436
+ } else {
437
+ const clockStyle = SmartButton.clocks[box.style.waiting.clock] || SmartButton.clocks.ozden;
438
+ cover.icon = Box(0, 0, 0, 0, { color: "transparent", html: SmartButton.createClockSvg(clockStyle) });
439
+ }
440
+ endBox();
441
+ return cover;
442
+ });
443
+ restoreThatFromSaved();
444
+ box.onResize(function () {
445
+ if (box.waiting == 1) fitWaitingIcon();
446
+ });
447
+ };
448
+
449
+ const startWaiting = function () {
450
+ box.cancelAsk();
451
+ box.waiting = 1;
452
+ box.aria = { busy: true };
453
+ if (!box.waitingCover) createWaitingCover();
454
+ box.waitingCover.visible = 1;
455
+ fitWaitingIcon();
456
+ render();
457
+ };
458
+
363
459
  const endWaiting = function () {
364
460
  box.waiting = 0;
365
461
  box.aria = { busy: false };
366
462
  box.waitingCover.visible = 0;
367
463
  render();
368
- box.onWaitingEnd(box);
464
+ if (typeof box.onWaitingEnd === "function") box.onWaitingEnd(box);
369
465
  };
370
466
 
371
467
  // *** PUBLIC FUNCTIONS:
372
468
 
373
469
  box.isAsking = 0; // 1: the first click of ask was made, the button is red
374
470
 
375
- box.setText = function (text) {
471
+ box.setLabelText = function (text) {
376
472
  box.labelText = text;
377
- if (box.label) box.label.text = text;
473
+ if (box.label) setText(box.label, text);
378
474
  render(); // (the label read by a screen reader)
379
475
  };
380
- // USAGE: button.setText("Save")
476
+ // USAGE: button.setLabelText("Save")
381
477
 
382
478
  box.setIcon = function (file) {
383
479
  box.iconFile = file;
@@ -388,6 +484,7 @@ const SmartButton = function (params = {}) {
388
484
  box.setAnimated = function (value) {
389
485
  box.animated = basic.isOn(value) ? 1 : 0;
390
486
  applyAnimated();
487
+ render(); // WHY: a button pressed now loses its press look with animated: 0
391
488
  };
392
489
  // USAGE: get: button.animated, set: button.setAnimated(0)
393
490
 
@@ -400,11 +497,8 @@ const SmartButton = function (params = {}) {
400
497
  box.enabled = basic.isOn(value) ? 1 : 0;
401
498
  if (box.enabled != 1) {
402
499
  box.cancelAsk();
403
- isHover = 0;
404
500
  isPressed = 0;
405
501
  isSpaceDown = 0;
406
- } else {
407
- isHover = box.elem.matches(":hover") ? 1 : 0; // WHY: the mouse may have stayed on it while it was off
408
502
  }
409
503
  render();
410
504
  };
@@ -439,61 +533,40 @@ const SmartButton = function (params = {}) {
439
533
  const superRemove = box.remove;
440
534
  box.superRemove = superRemove;
441
535
  box.remove = function () {
536
+ if (box.isRemoved) return;
442
537
  box.cancelAsk();
443
538
  superRemove.call(box);
444
539
  };
445
540
 
446
- // Only the given keys change; the other keys of the style stay.
541
+ // Only the given keys change; the other keys of the style stay, inside a part too (ask.button, waiting.dots).
447
542
  // WHY a new object for each part: the old one can be shared with other buttons (the same style object of a page)
543
+ // WHY not Object.assign: it replaces ask.button whole, so { ask: { button: { color } } } would lose
544
+ // the white text and the white icon of the ask
448
545
  box.setStyle = function (style) {
449
546
  Object.keys(style || {}).forEach(function (part) {
450
- box.style[part] = Object.assign({}, box.style[part], style[part]);
547
+ const merged = {};
548
+ mergeIntoIfMissing(merged, style[part]); // the new keys first
549
+ mergeIntoIfMissing(merged, box.style[part]); // then the old ones under them
550
+ box.style[part] = merged;
451
551
  });
452
552
  applyStyle();
553
+ applyAnimated(); // WHY: style.press.time is in the transitions
453
554
  };
454
555
  // USAGE: button.setStyle({ box: { color: "tomato", borderColor: "red" }, hover: { color: "tomato" } })
455
556
 
456
- box.setTone = function (toneName, styleName) {
457
- box.styleName = styleName || box.styleName;
458
- box.setStyle(SmartButton.getPackageStyle(box.styleName));
459
- box.tone = toneName;
460
- if (toneName) box.setStyle(SmartButton.getToneStyle(toneName, box.styleName));
461
- };
462
- // USAGE: button.setTone("blue"), button.setTone("blue", "pillSolid"), button.setTone("", "pill") (only the package)
463
-
464
- // The style on the objects (box, layout, icon, label, focus ring); render() gives the colors of the state.
465
- // The side of the icon a little narrower (style.layout.iconSideTrim), only for an icon left of a text
466
- const paintIconSide = function () {
467
- const _l = box.style.layout;
468
- const isIconLeft = box.icon && box.label && box.iconPosition !== "top";
469
- const padding = Array.isArray(_l.padding) ? _l.padding[0] : _l.padding;
470
- const trim = isIconLeft ? (Number(_l.iconSideTrim) || 0) : 0;
471
- box.layout.css = { paddingLeft: Math.max(0, padding - trim) + "px" };
472
- };
473
-
474
- const applyStyle = function () {
475
- const _s = box.style;
476
- box.props(_s.box);
477
- box.layout.props(_s.layout);
478
- paintIconSide();
479
- if (box.icon) box.icon.props(_s.icon);
480
- if (box.label) box.label.props(_s.label);
481
- box.setFocusRing(_s.focus.ringColor);
482
- render();
557
+ // The two colors of a tone (a color of the page given with style goes)
558
+ box.setTone = function (toneName) {
559
+ box.tone = toneName || "";
560
+ box.setStyle(SmartButton.getToneStyle(box.tone, box.styleName));
483
561
  };
562
+ // USAGE: button.setTone("green"), button.setTone("") (the gray of its template)
484
563
 
485
564
  // delay: ms before the wait ends (only for 0)
486
565
  box.setWaiting = function (value, delay = 0) {
487
- const isWaiting = basic.isOn(value) ? 1 : 0;
488
566
  if (cancelWaitingEnd) cancelWaitingEnd();
489
567
  cancelWaitingEnd = null;
490
- if (isWaiting) {
491
- box.cancelAsk();
492
- box.waiting = 1;
493
- box.aria = { busy: true };
494
- box.waitingCover.visible = 1;
495
- fitWaitingIcon();
496
- render();
568
+ if (basic.isOn(value)) {
569
+ startWaiting();
497
570
  return;
498
571
  }
499
572
  if (box.waiting != 1) return;
@@ -501,22 +574,15 @@ const SmartButton = function (params = {}) {
501
574
  endWaiting();
502
575
  return;
503
576
  }
504
- cancelWaitingEnd = box.after(delay, function () {
505
- cancelWaitingEnd = null;
506
- endWaiting();
507
- });
577
+ cancelWaitingEnd = box.after(delay, endWaiting);
508
578
  };
509
579
  // USAGE: get: button.waiting, set: button.setWaiting(1) / button.setWaiting(0, 1000)
510
580
 
511
581
  // *** OBJECT VIEW:
512
582
 
513
- // BOX: Container look
514
- box.props(box.style.box);
583
+ // BOX: Container (its look: applyStyle(), when its objects are made)
515
584
  box.clickable = 1;
516
585
  box.role = "button";
517
- box.setFocusRing(box.style.focus.ringColor);
518
- // (the transitions: applyAnimated(); WHY not setMotion() here: its timer came after them and wrote over them)
519
- box.setMotionNow(STILL_MOTION);
520
586
 
521
587
  // GROUP: Layout (icon, label). iconPosition "top" puts the icon above the label.
522
588
  // WHY "100%" for a fixed size: the group fills the inside of the border; with the size of the box itself it was
@@ -538,32 +604,19 @@ const SmartButton = function (params = {}) {
538
604
  // LABEL: only when there is a text
539
605
  if (box.labelText) {
540
606
  box.label = Label(0, 0, box.style.label);
541
- box.label.text = box.labelText;
607
+ setText(box.label, box.labelText);
542
608
  box.label.css.whiteSpace = "nowrap";
543
609
  }
544
610
 
545
611
  endAutoLayout();
546
- box.layout.setMotionNow(WAITING_MOTION);
547
- paintIconSide();
548
-
549
- // BOX: Waiting cover (clear: the content fades under it; it holds the animation and takes the mouse)
550
- box.waitingCover = startBox(0, 0, "100%", "100%", {
551
- color: "transparent",
552
- clickable: 1, // WHY: the button under it gets no hover look while waiting
553
- cursor: "progress",
554
- });
555
- if (box.waitingType == "dots") {
556
- box.waitingCover.icon = SmartButton.createDots(box.style.waiting.dots);
557
- } else {
558
- const clock = Box(0, 0, 0, 0, { color: "transparent" });
559
- clock.elem.innerHTML = SmartButton.createClockSvg(SmartButton.clocks[box.waitingClock] || SmartButton.clocks.ozden);
560
- box.waitingCover.icon = clock;
561
- }
562
- endBox();
563
- box.waitingCover.visible = 0;
612
+ // (the waiting cover: createWaitingCover(), at the first wait)
564
613
 
565
614
  // *** OBJECT INIT CODE:
566
615
 
616
+ // WHY the look before the transitions: nothing fades in at the first view
617
+ applyStyle();
618
+ startMotion();
619
+
567
620
  box.on("click", function (self, event) {
568
621
  press(event);
569
622
  });
@@ -591,10 +644,6 @@ const SmartButton = function (params = {}) {
591
644
  isSpaceDown = 0;
592
645
  });
593
646
 
594
- box.onResize(function () {
595
- if (box.waiting == 1) fitWaitingIcon();
596
- });
597
-
598
647
  // THE MOUSE: hover, pressed, back to normal (render)
599
648
  box.onHoverChange(function (self, isOver) {
600
649
  isHover = isOver;
@@ -612,13 +661,7 @@ const SmartButton = function (params = {}) {
612
661
  render();
613
662
  });
614
663
 
615
- applyAnimated();
616
- render();
617
-
618
- if (box.waiting == 1) {
619
- box.waiting = 0;
620
- box.setWaiting(1);
621
- }
664
+ if (box.waiting == 1) box.setWaiting(1);
622
665
 
623
666
  return endObject(box);
624
667
 
@@ -628,6 +671,13 @@ const SmartButton = function (params = {}) {
628
671
 
629
672
  SmartButton.askingButton = null; // the button that asks now (ask: one at a time)
630
673
 
674
+ // WHY one query for the page: render() asks it at every hover and press
675
+ SmartButton.isReducedMotion = function () {
676
+ if (!window.matchMedia) return false;
677
+ if (!SmartButton.reducedMotionQuery) SmartButton.reducedMotionQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
678
+ return SmartButton.reducedMotionQuery.matches;
679
+ };
680
+
631
681
  // 1: a dark color (the ripple is light on it). A color of the browser: "rgb(r, g, b)" or "rgba(r, g, b, a)".
632
682
  // A transparent color is not dark (the page under it shows).
633
683
  SmartButton.DARK_LIMIT = 0.45; // the brightness (0 - 1) under it a color is dark
@@ -658,181 +708,188 @@ SmartButton.injectCss = function () {
658
708
  "@media (prefers-reduced-motion: reduce) { .smart-button-hand, .smart-button-dot { animation: none !important; } }");
659
709
  };
660
710
 
661
- // *** THE STYLE PACKAGES (the user, 2026-10-30): the buttons of _basic/examples/smart-button-3-ozden.htm.
662
- // A package needs only the keys that differ from the default (ozdenType1).
711
+ // *** THE TEMPLATES (the shapes), all gray. A template is a style with only the keys that differ from the default
712
+ // (ozden); its color comes from a tone or from style. Every template has the default height (44).
713
+ SmartButton.WHITE_ICON = "brightness(0) invert(1)"; // a CSS filter: any icon file turns white
714
+ SmartButton.ROUND = 100; // pill, outlined: always round, at any height
715
+ SmartButton.EDGE_WIDTH = 2; // outlined: the edge and the line at its bottom
716
+
663
717
  SmartButton.styles = {
664
- ozdenType1: SmartButtonDefaults.style, // an edge and a bottom line
665
- ozdenType2: { box: { boxShadow: "none" } }, // only the edge
666
- ozdenType3: { box: { borderColor: Black(0.1), boxShadow: "none" } }, // a faint edge
667
- ozdenType4: { box: { color: White(0), border: 0, borderColor: "transparent", boxShadow: "none" } }, // a ghost
668
- classic: { // the look of before 2026-10-30
669
- layout: { gap: 8, padding: [12, 6] },
670
- icon: { opacity: 1 },
671
- label: { fontSize: 16, textColor: Black(0.8), fontFamily: "opensans-bold" },
672
- box: { color: White(1), border: 1, borderColor: Black(0.2), round: 6, boxShadow: "none" },
673
- hover: { color: "#f5f5f5" },
674
- active: { color: "#e0e0e0" },
718
+ // (the buttons of _basic/examples/smart-button-3-ozden.htm)
719
+ ozden: SmartButtonDefaults.style, // an edge and a bottom line
720
+ ozden2: { box: { boxShadow: "none" } }, // only the edge
721
+ ozden3: { box: { borderColor: Black(0.1), boxShadow: "none" } }, // a faint edge
722
+ ozden4: { box: { color: White(0), border: 0, borderColor: "transparent", boxShadow: "none" } }, // a ghost
723
+ // ROUND (the buttons of _basic/examples/smart-button-alternatif.htm). WHY a smaller text
724
+ // and icon: they were 52 px high with a 30 px icon; now as high as the other buttons
725
+ pill: { // no edge, a bold text
726
+ layout: { gap: 10, padding: [18, 0] },
727
+ icon: { width: 26, height: 26, opacity: 1 },
728
+ label: { fontSize: 18, fontFamily: "opensans-bold" },
729
+ box: { border: 0, borderColor: "transparent", round: SmartButton.ROUND, boxShadow: "none" },
730
+ },
731
+ outlined: { // a thicker edge with a line at its bottom
732
+ layout: { gap: 8, padding: [14, 0] },
733
+ icon: { width: 26, height: 26, opacity: 1 },
734
+ label: { fontSize: 18 },
735
+ box: { border: SmartButton.EDGE_WIDTH, round: SmartButton.ROUND, boxShadow: "inset 0 -" + SmartButton.EDGE_WIDTH + "px 0 " + Black(0.35) },
675
736
  },
676
737
  };
677
738
 
678
- // THE DARK PACKAGES (2026-10-31, the draft _designs/smart-button-dark.htm): the shapes of ozdenType1-4 with the
739
+ // THE DARK TEMPLATES (the draft _designs/smart-button-dark.htm): the shapes of ozden ... ozden4 with the
679
740
  // colors of a dark page (the cards of Ozden Panel / Ozden Manager, #1A1A19). The icon turns white, the waiting clock
680
- // is the dark one, the dots yellow; the ask stays red. Packages of params (a "style" key): waitingClock is a param.
681
- SmartButton.createDarkPackage = function (box, hoverColor) {
741
+ // is the dark one, the dots yellow; the ask stays orange.
742
+ // THE EDGE AND THE BOTTOM LINE: the edge of ozden in white and its 2 px line in white, a
743
+ // little fainter. A light tone on a dark template keeps them too.
744
+ // WHY 0.2 / 0.12 (0.35 / 0.2 were too bright on a dark page; a white edge on a dark page is
745
+ // much stronger than the same black on a light one): still twice the faint edge of ozden3Dark (0.1).
746
+ SmartButton.DARK_EDGE = White(0.2);
747
+ SmartButton.DARK_BOTTOM_LINE = "inset 0 -2px 0 " + White(0.12);
748
+ // boxKeys: only the keys of the box that differ from ozdenDark (as the light templates from ozden)
749
+ SmartButton.createDarkTemplate = function (boxKeys, hoverColor = "#383835") {
682
750
  return {
751
+ box: Object.assign({ color: "#2E2E2C", borderColor: SmartButton.DARK_EDGE, boxShadow: SmartButton.DARK_BOTTOM_LINE }, boxKeys),
752
+ hover: { color: hoverColor },
753
+ label: { textColor: White(0.85) },
754
+ icon: { opacity: 0.85, filter: SmartButton.WHITE_ICON },
755
+ focus: { ringColor: "rgba(101, 162, 147, 0.75)" },
756
+ disabled: { color: "#232322", borderColor: White(0.06), textColor: White(0.28), iconOpacity: 0.25 },
757
+ press: { brightness: 0.88 },
758
+ waiting: { clock: "ozdenDark", dots: { color: "#F1C74A" } },
759
+ };
760
+ };
761
+ SmartButton.styles.ozdenDark = SmartButton.createDarkTemplate({}); // an edge and a bottom line
762
+ SmartButton.styles.ozden2Dark = SmartButton.createDarkTemplate({ boxShadow: "none" }); // only the edge
763
+ SmartButton.styles.ozden3Dark = SmartButton.createDarkTemplate({ borderColor: White(0.1), boxShadow: "none" }); // a faint edge: the 0.1 of ozden3 in white
764
+ SmartButton.styles.ozden4Dark = SmartButton.createDarkTemplate({ color: White(0), border: 0, borderColor: "transparent", boxShadow: "none" }, White(0.08)); // a ghost
765
+
766
+ // THE MINIMAL TEMPLATES (the draft _designs/minimal-theme.htm): small (28 px, a 13 px text, a 14 px icon) and made of
767
+ // lines: no fill, the edge gets darker under the mouse, a blue focus ring, a ring that waits. The main action takes the
768
+ // tone "ink" (inkDark on a dark page): the only filled button of the theme.
769
+ SmartButton.MINIMAL_DANGER = "#C24A36"; // the ask of the minimal templates (on light and dark windows: a white text)
770
+ SmartButton.createMinimalTemplate = function (colors) {
771
+ const danger = SmartButton.MINIMAL_DANGER;
772
+ return {
773
+ height: 28,
683
774
  style: {
684
- box: box,
685
- hover: { color: hoverColor },
686
- active: { color: hoverColor },
687
- label: { textColor: White(0.85) },
688
- icon: { opacity: 0.85, filter: "brightness(0) invert(1)" },
689
- focus: { ringColor: "rgba(101, 162, 147, 0.75)" },
690
- disabled: { color: "#232322", borderColor: White(0.06), textColor: White(0.28), iconOpacity: 0.25 },
691
- press: { brightness: 0.88 },
692
- waiting: { dots: { color: "#F1C74A" } },
775
+ layout: { gap: 6, padding: [10, 0], iconSideTrim: 0 },
776
+ icon: { width: 14, height: 14, opacity: 1, filter: colors.iconFilter },
777
+ label: { fontSize: 13, textColor: colors.text },
778
+ box: { color: "transparent", border: 1, borderColor: colors.line, round: 4, boxShadow: "none" },
779
+ hover: { color: "transparent", borderColor: colors.lineHover },
780
+ focus: { ringColor: colors.focus },
781
+ disabled: { color: "transparent", borderColor: colors.disabledLine, textColor: colors.disabledText, iconOpacity: 0.4 },
782
+ press: { scale: 0.97, brightness: 1 },
783
+ waiting: { clock: colors.clock, contentOpacity: 0.12, clockSize: 16, space: 6 },
784
+ ask: {
785
+ button: { color: danger, borderColor: danger, boxShadow: "none", textColor: "white", iconFilter: SmartButton.WHITE_ICON },
786
+ bubble: { color: danger, textColor: "white", fontSize: 12, bold: 0, round: 4, padding: [8, 4], border: 0, borderColor: "", shadow: "none", arrow: 8, gap: 4, edge: 6 },
787
+ },
693
788
  },
694
- waitingClock: "ozdenDark",
695
789
  };
696
790
  };
697
- SmartButton.styles.ozdenType1Dark = SmartButton.createDarkPackage({ color: "#2E2E2C", borderColor: White(0.16), boxShadow: "inset 0 -2px 0 rgba(0, 0, 0, 0.45)" }, "#383835"); // an edge and a bottom line
698
- SmartButton.styles.ozdenType2Dark = SmartButton.createDarkPackage({ color: "#2E2E2C", borderColor: White(0.16), boxShadow: "none" }, "#383835"); // only the edge
699
- SmartButton.styles.ozdenType3Dark = SmartButton.createDarkPackage({ color: "#2E2E2C", borderColor: White(0.06), boxShadow: "none" }, "#383835"); // a faint edge
700
- SmartButton.styles.ozdenType4Dark = SmartButton.createDarkPackage({ color: White(0), border: 0, borderColor: "transparent", boxShadow: "none" }, White(0.08)); // a ghost
701
-
702
- // *** THE TONES AND THE SHAPES (2026-11-02, the user): the color of a button is apart from its shape.
703
- // color: the strong color; solidHover: its hover; onColor: the text on it (default white); tint / hover: the soft
704
- // surface; deep: the text of outlined; pillText: the text of pill (default color); light: the light part of a
705
- // two-tone icon. A new color is one new row.
706
- SmartButton.ON_COLOR_TEXT = Black(0.75); // the dark text on a light full color
707
- SmartButton.TONES = {
708
- gray: { color: "#6E6F74", deep: "#3A3A3A", tint: "#F0F0F0", hover: "#E6E6E6", solidHover: "#5F6065", light: "#C4C5C9", pillText: "#3A3A3A" },
709
- blue: { color: "#2F6FED", deep: "#2563D8", tint: "#E4EDFD", hover: "#D8E5FC", solidHover: "#2563D8", light: "#93B7F7" },
710
- green: { color: "#3F9A6C", deep: "#2F8259", tint: "#E6F5EE", hover: "#D9EFE4", solidHover: "#358A5E", light: "#9FD6BC" },
711
- purple: { color: "#8B5CF0", deep: "#7C4FE0", tint: "#EFE9FD", hover: "#E6DDFC", solidHover: "#7C4FE0", light: "#C9B4F7" },
712
- orange: { color: "#F28C33", deep: "#B8651E", tint: "#FDF1E3", hover: "#FCE8D2", solidHover: "#E57E25", light: "#F7C393" },
713
- red: { color: "#E5564A", deep: "#C8443A", tint: "#FDECEA", hover: "#FBDFDC", solidHover: "#D84A3E", light: "#F4B1AB" },
714
- yellow: { color: "#D9A400", deep: "#8F6B00", tint: "#FFF7DB", hover: "#FFF0C2", solidHover: "#C99700", light: "#F5DC8A", pillText: "#B88A00" },
715
- teal: { color: "#0E9A9A", deep: "#0B7F7F", tint: "#E4F5F5", hover: "#D6EEEE", solidHover: "#0B8C8C", light: "#92D6D6" },
716
- sky: { color: "#4FB5D4", deep: "#2A7C93", tint: "#E3F7FB", hover: "#D5F2F8", solidHover: "#3FA6C6", light: "#A5DEEC", pillText: "#2E8BC0" },
717
- navy: { color: "#2A3A8C", deep: "#1C2A78", tint: "#DFE3EF", hover: "#D3D8E9", solidHover: "#1C2A78", light: "#8F9AC6" },
718
- pink: { color: "#E8457C", deep: "#C93668", tint: "#FDE8EF", hover: "#FBDBE6", solidHover: "#DC3A70", light: "#F5AFC7" },
719
- // The situations (2026-10-31, chosen by the user on the draft _designs/smart-button-colors.htm)
720
- primary: { color: "#5BBAC1", solidHover: "#50AEB5", onColor: SmartButton.ON_COLOR_TEXT, deep: "#2F8088", tint: "#E6F5F6", hover: "#D9EFF1", light: "#ADDDE0", pillText: "#2F8088" }, // the main action: Save, Send
721
- danger: { color: "#E8796D", solidHover: "#E0695C", deep: "#C4574C", tint: "#FDECEA", hover: "#FBDFDC", light: "#F4BDB6", pillText: "#C4574C" }, // a delete, a reject
722
- warning: { color: "#F1C74A", solidHover: "#E6BB3C", onColor: SmartButton.ON_COLOR_TEXT, deep: "#8F6B00", tint: "#FFF7DB", hover: "#FFF0C2", light: "#F7E2A0", pillText: "#B88A00" }, // go on, but look first
723
- success: { color: "#7BC362", solidHover: "#70B756", onColor: SmartButton.ON_COLOR_TEXT, deep: "#4A8A35", tint: "#EDF7E8", hover: "#E1F1DA", light: "#BDE0AF", pillText: "#4F9A38" }, // after a good result: Done
724
- info: { color: "#52A8D0", solidHover: "#479CC4", onColor: SmartButton.ON_COLOR_TEXT, deep: "#2F7DA3", tint: "#E6F3F9", hover: "#D9ECF5", light: "#A6D2E7", pillText: "#2F7DA3" }, // Details, Help
791
+ SmartButton.styles.minimal = SmartButton.createMinimalTemplate({
792
+ text: Black(0.85), line: Black(0.2), lineHover: Black(0.45), focus: "#3D8BD9",
793
+ disabledLine: Black(0.08), disabledText: Black(0.34), iconFilter: "none", clock: "minimal",
794
+ });
795
+ SmartButton.styles.minimalDark = SmartButton.createMinimalTemplate({
796
+ text: White(0.88), line: White(0.18), lineHover: White(0.42), focus: "#7FB6DE",
797
+ disabledLine: White(0.07), disabledText: White(0.35), iconFilter: SmartButton.WHITE_ICON, clock: "minimalDark",
798
+ });
799
+ // A delete in the minimal theme: the line and the text in the danger color (the line half of it, all of it under the
800
+ // mouse). The icon keeps the color of its file: give it an icon drawn in the danger color.
801
+ SmartButton.styles.minimalDanger = SmartButton.createMinimalTemplate({
802
+ text: "#C24A36", line: "rgba(194, 74, 54, 0.5)", lineHover: "#C24A36", focus: "#3D8BD9",
803
+ disabledLine: Black(0.08), disabledText: Black(0.34), iconFilter: "none", clock: "minimal",
804
+ });
805
+ SmartButton.styles.minimalDangerDark = SmartButton.createMinimalTemplate({
806
+ text: "#FF9F93", line: "rgba(255, 159, 147, 0.5)", lineHover: "#FF9F93", focus: "#7FB6DE",
807
+ disabledLine: White(0.07), disabledText: White(0.35), iconFilter: "none", clock: "minimalDark",
808
+ });
809
+
810
+ // *** THE TONES: the colors of the kit, with simple color names; a tone for a dark page ends
811
+ // with "Dark". A tone is three colors: the button, the button under the mouse and its text (DARK_TEXT, or LIGHT_TEXT:
812
+ // it turns the icon white too). The light ones are white and the colors of the situations (chosen on the draft
813
+ // _designs/smart-button-colors.htm). Any other color: style (Ex: _basic/examples/smart-button-alternatif.htm).
814
+ SmartButton.DARK_TEXT = Black(0.75);
815
+ SmartButton.LIGHT_TEXT = White(0.9);
816
+ SmartButton.tones = {
817
+ white: { color: "white", hover: "whitesmoke", text: SmartButton.DARK_TEXT },
818
+ cyan: { color: "#5BBAC1", hover: "#50AEB5", text: SmartButton.DARK_TEXT }, // the main action: Save, Send
819
+ orange: { color: "#DE815B", hover: "#D4724B", text: SmartButton.DARK_TEXT }, // a delete, a reject
820
+ yellow: { color: "#F1C74A", hover: "#E6BB3C", text: SmartButton.DARK_TEXT }, // go on, but look first
821
+ green: { color: "#7BC362", hover: "#70B756", text: SmartButton.DARK_TEXT }, // after a good result: Done
822
+ blue: { color: "#52A8D0", hover: "#479CC4", text: SmartButton.DARK_TEXT }, // nothing changes: Details, Help
823
+ // For a dark page: the same colors, 45 % over the dark card #1A1A19 (53 % under the mouse); chosen by the user on
824
+ // the draft _designs/smart-button2-dark-tones.htm.
825
+ // WHY 45 %: the light text reads on every one of them (contrast 4.8 - 6.7; 4.5 is enough)
826
+ cyanDark: { color: "#376265", hover: "#3C6F72", text: SmartButton.LIGHT_TEXT },
827
+ orangeDark: { color: "#724837", hover: "#82513C", text: SmartButton.LIGHT_TEXT },
828
+ yellowDark: { color: "#7B682F", hover: "#8C7633", text: SmartButton.LIGHT_TEXT },
829
+ greenDark: { color: "#46663A", hover: "#4D7440", text: SmartButton.LIGHT_TEXT },
830
+ blueDark: { color: "#335A6B", hover: "#38657A", text: SmartButton.LIGHT_TEXT },
831
+ // The main action of the minimal templates (the ink of the theme). edge / hoverEdge: the edge in the color of the
832
+ // button (a line of the template around a filled button looked like a frame)
833
+ ink: { color: "#1F1F1F", hover: "#3A3A3A", text: SmartButton.LIGHT_TEXT, edge: "#1F1F1F", hoverEdge: "#3A3A3A" },
834
+ inkDark: { color: "#EDEDEB", hover: "#FFFFFF", text: "#1A1A19", edge: "#EDEDEB", hoverEdge: "#FFFFFF" },
725
835
  };
726
836
 
727
- // The colors of a tone on each shape; "filled" is the look of every other shape.
728
- SmartButton.toneLooks = {
729
- filled: function (tone) {
730
- const textColor = tone.onColor || "white";
731
- const isWhiteText = (textColor == "white");
732
- return {
733
- box: { color: tone.color },
734
- hover: { color: tone.solidHover },
735
- active: { color: tone.solidHover },
736
- label: { textColor: textColor },
737
- icon: { opacity: isWhiteText ? 1 : 0.8, filter: isWhiteText ? "brightness(0) invert(1)" : "none" },
738
- };
739
- },
740
- ozdenType4: function (tone) {
741
- return {
742
- hover: { color: tone.tint },
743
- active: { color: tone.tint },
744
- label: { textColor: tone.deep },
745
- };
746
- },
747
- pill: function (tone) {
748
- return {
749
- box: { color: tone.tint },
750
- hover: { color: tone.hover },
751
- active: { color: tone.hover },
752
- label: { textColor: tone.pillText || tone.color },
753
- };
754
- },
755
- pillSolid: function (tone) {
756
- return {
757
- box: { color: tone.color },
758
- hover: { color: tone.solidHover },
759
- active: { color: tone.solidHover },
760
- label: { textColor: tone.onColor || "white" },
761
- };
762
- },
763
- outlined: function (tone) {
764
- return {
765
- box: { color: tone.tint, borderColor: tone.color, boxShadow: "inset 0 -" + SmartButton.EDGE_WIDTH + "px 0 " + tone.color },
766
- hover: { color: tone.hover },
767
- active: { color: tone.hover },
768
- label: { textColor: tone.deep },
769
- };
770
- },
837
+ // THE LOOK, the one place of its order: style > tone > the template (styleName) > the defaults. It fills params.style
838
+ // and returns params (getTemplateColors reads a template with it too).
839
+ SmartButton.applyLook = function (params) {
840
+ SmartButton.applyTone(params);
841
+ basic.applyStylePackage(params, SmartButton.styles, SmartButtonDefaults);
842
+ mergeIntoIfMissing(params.style, SmartButtonDefaults.style);
843
+ return params;
771
844
  };
772
845
 
846
+ // A tone as a style. No tone: the colors of the template (setTone("") makes a button gray again).
773
847
  SmartButton.getToneStyle = function (toneName, styleName) {
774
- const tone = SmartButton.TONES[toneName];
848
+ if (!toneName) return SmartButton.getTemplateColors(styleName);
849
+ const tone = SmartButton.tones[toneName];
775
850
  if (!tone) {
776
851
  console.warn("SmartButton: tone not found: " + toneName);
777
852
  return {};
778
853
  }
779
- const createLook = SmartButton.toneLooks[styleName] || SmartButton.toneLooks.filled;
780
- return createLook(tone);
854
+ // WHY the icon: an icon file is drawn dark; with a light text it turns white
855
+ const isLightText = (tone.text === SmartButton.LIGHT_TEXT);
856
+ const toneStyle = {
857
+ box: { color: tone.color },
858
+ hover: { color: tone.hover },
859
+ label: { textColor: tone.text },
860
+ icon: { filter: isLightText ? SmartButton.WHITE_ICON : "none" },
861
+ };
862
+ if (tone.edge) {
863
+ toneStyle.box.borderColor = tone.edge;
864
+ toneStyle.hover.borderColor = tone.hoverEdge || tone.edge;
865
+ }
866
+ return toneStyle;
781
867
  };
782
868
 
783
- // The whole look of a package: its keys, then the defaults (a package has only the keys that differ).
784
- SmartButton.getPackageStyle = function (styleName) {
785
- const stylePackage = SmartButton.styles[styleName] || {};
786
- const packageStyle = {};
787
- mergeIntoIfMissing(packageStyle, stylePackage.style || stylePackage);
788
- mergeIntoIfMissing(packageStyle, SmartButtonDefaults.style);
789
- return packageStyle;
869
+ // The colors of a template: the button, the button under the mouse, its text and its icon
870
+ SmartButton.getTemplateColors = function (styleName) {
871
+ const template = SmartButton.applyLook({ styleName: styleName }).style;
872
+ return {
873
+ box: { color: template.box.color },
874
+ hover: { color: template.hover.color },
875
+ label: { textColor: template.label.textColor },
876
+ icon: { filter: template.icon.filter },
877
+ };
790
878
  };
791
879
 
792
- // The tone goes under params.style, so a key the page gives still wins. WHY a new object: params.style can be a package.
880
+ // The tone goes under the style of the page, so a color the page gives still wins.
881
+ // WHY a new object: params.style can be a template given as it is (style: SmartButton.styles.ozden2)
793
882
  SmartButton.applyTone = function (params) {
794
883
  if (!params.tone) return;
795
- const styleName = params.styleName || SmartButtonDefaults.styleName;
796
884
  const ownStyle = {};
797
885
  mergeIntoIfMissing(ownStyle, params.style || {});
798
- mergeIntoIfMissing(ownStyle, SmartButton.getToneStyle(params.tone, styleName));
886
+ mergeIntoIfMissing(ownStyle, SmartButton.getToneStyle(params.tone));
799
887
  params.style = ownStyle;
800
888
  };
801
889
 
802
- // THE SITUATION PACKAGES: ozdenType1 (an edge and a bottom line) in the color of a situation.
803
- ["primary", "danger", "warning", "success", "info"].forEach(function (toneName) {
804
- SmartButton.styles[toneName] = SmartButton.toneLooks.filled(SmartButton.TONES[toneName]);
805
- });
806
-
807
- // THE PILL AND OUTLINED SHAPES (the user: the buttons of _basic/examples/smart-button.htm): gray without a tone.
808
- SmartButton.PILL_ROUND = 100; // always round, at any height
809
- SmartButton.EDGE_WIDTH = 2; // outlined: the edge and the bottom line on it
810
-
811
- SmartButton.PILL_SHAPE = {
812
- layout: { gap: 12, padding: [22, 11] },
813
- icon: { width: 30, height: 30, opacity: 1 },
814
- label: { fontFamily: "opensans-bold" },
815
- box: { border: 0, borderColor: "transparent", round: SmartButton.PILL_ROUND, boxShadow: "none" },
816
- };
817
- SmartButton.OUTLINED_SHAPE = {
818
- layout: { gap: 8, padding: [16, 9] },
819
- icon: { width: 30, height: 30, opacity: 1 },
820
- label: { fontFamily: "opensans" },
821
- box: { border: SmartButton.EDGE_WIDTH, round: SmartButton.PILL_ROUND },
822
- };
823
- SmartButton.createShapePackage = function (shape, look) {
824
- const shapePackage = {};
825
- mergeIntoIfMissing(shapePackage, look);
826
- mergeIntoIfMissing(shapePackage, shape);
827
- return shapePackage;
828
- };
829
- SmartButton.styles.pill = SmartButton.createShapePackage(SmartButton.PILL_SHAPE, SmartButton.toneLooks.pill(SmartButton.TONES.gray));
830
- SmartButton.styles.pillSolid = SmartButton.createShapePackage(SmartButton.PILL_SHAPE, SmartButton.toneLooks.pillSolid(SmartButton.TONES.gray));
831
- SmartButton.styles.outlined = SmartButton.createShapePackage(SmartButton.OUTLINED_SHAPE, SmartButton.toneLooks.outlined(SmartButton.TONES.gray));
832
-
833
890
  // *** THE WAITING DRAWINGS: the clock and the dots (comp/loading-screen.js uses them too)
834
891
 
835
- // The clocks of the waiting views with moving hands (the user, 2026-10-29). The sizes are px on a 30 px clock.
892
+ // The clocks of the waiting views with moving hands. The sizes are px on a 30 px clock.
836
893
  SmartButton.clocks = {
837
894
  ozden: { // a white face, dark lines
838
895
  faceColor: "#FFFFFF",
@@ -849,7 +906,7 @@ SmartButton.clocks = {
849
906
  hourTurn: 19.2, // seconds for one turn of the hour hand (12 x minuteTurn: a real clock)
850
907
  },
851
908
  };
852
- // a dark face, light lines; WHY yellow (the user, 2026-10-29): indianred was weak on the dark face (contrast 3.6,
909
+ // a dark face, light lines; WHY yellow: indianred was weak on the dark face (contrast 3.6,
853
910
  // #F1C74A 8.9); the hour hand is dimmer, so the yellow minute hand leads (as the red one on the light clock)
854
911
  SmartButton.clocks.ozdenDark = Object.assign({}, SmartButton.clocks.ozden, {
855
912
  faceColor: "#2A2A2A",
@@ -859,10 +916,22 @@ SmartButton.clocks.ozdenDark = Object.assign({}, SmartButton.clocks.ozden, {
859
916
  centerColor: "#F1C74A",
860
917
  });
861
918
 
919
+ // The waiting ring of the minimal templates: a faint circle and a quarter arc turning on it, in the color of the text
920
+ // (isRing: SmartButton.createRingSvg draws it in place of a clock).
921
+ SmartButton.clocks.minimal = {
922
+ isRing: 1,
923
+ lineColor: Black(0.85),
924
+ edgeWidth: 3, // on the 30 px drawing (1.6 px at 16 px)
925
+ trackOpacity: 0.2, // the circle under the arc
926
+ turnTime: 0.8, // seconds for one turn of the arc
927
+ };
928
+ SmartButton.clocks.minimalDark = Object.assign({}, SmartButton.clocks.minimal, { lineColor: White(0.88) });
929
+
862
930
  // The clock as an SVG text (as wide as its box): a face with an edge, the minute hand up, the hour hand to the right.
863
931
  SmartButton.CLOCK_SIZE = 30; // the px of the drawing
864
932
  SmartButton.createClockSvg = function (clockStyle) {
865
933
  SmartButton.injectCss();
934
+ if (clockStyle.isRing) return SmartButton.createRingSvg(clockStyle);
866
935
  const c = clockStyle;
867
936
  const size = SmartButton.CLOCK_SIZE;
868
937
  const middle = size / 2;
@@ -879,6 +948,18 @@ SmartButton.createClockSvg = function (clockStyle) {
879
948
  "</svg>";
880
949
  };
881
950
 
951
+ // A ring that waits: a faint circle and a quarter arc turning on it (the turn of the hands of the clock)
952
+ SmartButton.createRingSvg = function (ring) {
953
+ const size = SmartButton.CLOCK_SIZE;
954
+ const middle = size / 2;
955
+ const radius = middle - ring.edgeWidth / 2;
956
+ const arc = "M" + middle + " " + (middle - radius) + " A" + radius + " " + radius + " 0 0 1 " + (middle + radius) + " " + middle;
957
+ return '<svg viewBox="0 0 ' + size + ' ' + size + '" width="100%" height="100%" aria-hidden="true" style="display: block">' +
958
+ '<circle cx="' + middle + '" cy="' + middle + '" r="' + radius + '" fill="none" stroke="' + ring.lineColor + '" stroke-opacity="' + ring.trackOpacity + '" stroke-width="' + ring.edgeWidth + '"/>' +
959
+ '<path class="smart-button-hand" d="' + arc + '" fill="none" stroke="' + ring.lineColor + '" stroke-width="' + ring.edgeWidth + '" stroke-linecap="round" style="animation-duration: ' + ring.turnTime + 's"/>' +
960
+ "</svg>";
961
+ };
962
+
882
963
  // GROUP: Three dots that grow one after the other. dots: { size, gap, color }
883
964
  SmartButton.DOT_COUNT = 3;
884
965
  SmartButton.DOT_TIME = 1.2; // seconds for one bounce of a dot