create-basicjs 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (625) hide show
  1. package/README.md +12 -2
  2. package/bin/create-basicjs.js +58 -5
  3. package/bin/verify-package.js +1 -1
  4. package/package.json +2 -2
  5. package/payload/projects/tauri/.github/workflows/build.yml +86 -0
  6. package/payload/projects/tauri/.github/workflows/tests.yml +87 -0
  7. package/payload/projects/tauri/AGENTS.md +128 -0
  8. package/payload/projects/tauri/CLAUDE.md +1 -0
  9. package/payload/projects/tauri/LICENSE +201 -0
  10. package/payload/projects/tauri/NOTICE +8 -0
  11. package/payload/projects/tauri/README.md +269 -0
  12. package/payload/projects/tauri/checks/window-check.js +189 -0
  13. package/payload/projects/tauri/gitignore +8 -0
  14. package/payload/projects/tauri/handbook/01-getting-started.md +188 -0
  15. package/payload/projects/tauri/handbook/02-the-project.md +264 -0
  16. package/payload/projects/tauri/handbook/03-the-page.md +260 -0
  17. package/payload/projects/tauri/handbook/04-commands.md +265 -0
  18. package/payload/projects/tauri/handbook/05-events-and-state.md +275 -0
  19. package/payload/projects/tauri/handbook/06-plugins.md +282 -0
  20. package/payload/projects/tauri/handbook/07-the-window-and-the-app.md +431 -0
  21. package/payload/projects/tauri/handbook/08-security.md +374 -0
  22. package/payload/projects/tauri/handbook/09-tests-and-checks.md +266 -0
  23. package/payload/projects/tauri/handbook/10-building-and-releasing.md +238 -0
  24. package/payload/projects/tauri/handbook/11-troubleshooting.md +259 -0
  25. package/payload/projects/tauri/handbook/README.md +125 -0
  26. package/payload/projects/tauri/handbook/turkce/01-getting-started.md +193 -0
  27. package/payload/projects/tauri/handbook/turkce/02-the-project.md +272 -0
  28. package/payload/projects/tauri/handbook/turkce/03-the-page.md +272 -0
  29. package/payload/projects/tauri/handbook/turkce/04-commands.md +271 -0
  30. package/payload/projects/tauri/handbook/turkce/05-events-and-state.md +284 -0
  31. package/payload/projects/tauri/handbook/turkce/06-plugins.md +286 -0
  32. package/payload/projects/tauri/handbook/turkce/07-the-window-and-the-app.md +433 -0
  33. package/payload/projects/tauri/handbook/turkce/08-security.md +384 -0
  34. package/payload/projects/tauri/handbook/turkce/09-tests-and-checks.md +275 -0
  35. package/payload/projects/tauri/handbook/turkce/10-building-and-releasing.md +241 -0
  36. package/payload/projects/tauri/handbook/turkce/11-troubleshooting.md +264 -0
  37. package/payload/projects/tauri/handbook/turkce/README.md +128 -0
  38. package/payload/projects/tauri/images/app.png +0 -0
  39. package/payload/projects/tauri/src-tauri/Cargo.lock +4389 -0
  40. package/payload/projects/tauri/src-tauri/Cargo.toml +31 -0
  41. package/payload/projects/tauri/src-tauri/app-icon.svg +16 -0
  42. package/payload/projects/tauri/src-tauri/build.rs +15 -0
  43. package/payload/projects/tauri/src-tauri/capabilities/default.json +7 -0
  44. package/payload/projects/tauri/src-tauri/gitignore +5 -0
  45. package/payload/projects/tauri/src-tauri/icons/128x128.png +0 -0
  46. package/payload/projects/tauri/src-tauri/icons/128x128@2x.png +0 -0
  47. package/payload/projects/tauri/src-tauri/icons/32x32.png +0 -0
  48. package/payload/projects/tauri/src-tauri/icons/icon.icns +0 -0
  49. package/payload/projects/tauri/src-tauri/icons/icon.ico +0 -0
  50. package/payload/projects/tauri/src-tauri/src/check.rs +144 -0
  51. package/payload/projects/tauri/src-tauri/src/files.rs +255 -0
  52. package/payload/projects/tauri/src-tauri/src/main.rs +45 -0
  53. package/payload/projects/tauri/src-tauri/src/sizes.rs +214 -0
  54. package/payload/projects/tauri/src-tauri/tauri.conf.json +44 -0
  55. package/payload/projects/tauri/src-tauri/tests/project.rs +243 -0
  56. package/payload/projects/tauri/ui/app.js +459 -0
  57. package/payload/projects/tauri/ui/backend.js +196 -0
  58. package/payload/projects/tauri/ui/basic/LICENSE +14 -0
  59. package/payload/projects/tauri/ui/basic/basic.min.css +1 -0
  60. package/payload/projects/tauri/ui/basic/basic.min.js +78 -0
  61. package/payload/projects/tauri/ui/basic/font/open-sans/LICENSE.txt +206 -0
  62. package/payload/projects/tauri/ui/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
  63. package/payload/projects/tauri/ui/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
  64. package/payload/projects/tauri/ui/basic/scroll-bar.min.js +3 -0
  65. package/payload/projects/tauri/ui/comp/_sources.txt +9 -0
  66. package/payload/projects/tauri/ui/comp/components.min.js +21 -0
  67. package/payload/projects/tauri/ui/index.html +28 -0
  68. package/payload/projects/tauri/ui/sizes.js +104 -0
  69. package/payload/starter/AGENTS.md +11 -6
  70. package/payload/starter/README.md +1 -1
  71. package/payload/starter/_basic/VERSION +1 -1
  72. package/payload/starter/_basic/assets/cards/almond-blossom.png +0 -0
  73. package/payload/starter/_basic/assets/cards/blackberry.png +0 -0
  74. package/payload/starter/_basic/assets/cards/borage.png +0 -0
  75. package/payload/starter/_basic/assets/cards/chamomile.png +0 -0
  76. package/payload/starter/_basic/assets/cards/dill.png +0 -0
  77. package/payload/starter/_basic/assets/cards/eucalyptus.png +0 -0
  78. package/payload/starter/_basic/assets/cards/fennel.png +0 -0
  79. package/payload/starter/_basic/assets/cards/fig.png +0 -0
  80. package/payload/starter/_basic/assets/cards/juniper.png +0 -0
  81. package/payload/starter/_basic/assets/cards/lavender.png +0 -0
  82. package/payload/starter/_basic/assets/cards/lemon.png +0 -0
  83. package/payload/starter/_basic/assets/cards/olives.png +0 -0
  84. package/payload/starter/_basic/assets/cards/oregano.png +0 -0
  85. package/payload/starter/_basic/assets/cards/pepper.png +0 -0
  86. package/payload/starter/_basic/assets/cards/physalis.png +0 -0
  87. package/payload/starter/_basic/assets/cards/pomegranate.png +0 -0
  88. package/payload/starter/_basic/assets/cards/poppy.png +0 -0
  89. package/payload/starter/_basic/assets/cards/rosehip.png +0 -0
  90. package/payload/starter/_basic/assets/cards/saffron.png +0 -0
  91. package/payload/starter/_basic/assets/categories/cappuccino.png +0 -0
  92. package/payload/starter/_basic/assets/categories/chocolate-milk.png +0 -0
  93. package/payload/starter/_basic/assets/categories/coffee.png +0 -0
  94. package/payload/starter/_basic/assets/categories/frappe.png +0 -0
  95. package/payload/starter/_basic/assets/categories/iced-caffee.png +0 -0
  96. package/payload/starter/_basic/assets/categories/milkshake.png +0 -0
  97. package/payload/starter/_basic/assets/categories/orange-juice.png +0 -0
  98. package/payload/starter/_basic/assets/categories/tea.png +0 -0
  99. package/payload/starter/_basic/assets/fruids/brokoli.png +0 -0
  100. package/payload/starter/_basic/assets/fruids/cilek.png +0 -0
  101. package/payload/starter/_basic/assets/fruids/domates.png +0 -0
  102. package/payload/starter/_basic/assets/fruids/elma.png +0 -0
  103. package/payload/starter/_basic/assets/fruids/havuc.png +0 -0
  104. package/payload/starter/_basic/assets/fruids/karpuz.png +0 -0
  105. package/payload/starter/_basic/assets/fruids/limon.png +0 -0
  106. package/payload/starter/_basic/assets/fruids/muz.png +0 -0
  107. package/payload/starter/_basic/assets/fruids/nar.png +0 -0
  108. package/payload/starter/_basic/assets/fruids/patlican.png +0 -0
  109. package/payload/starter/_basic/assets/fruids/yabanmersini.png +0 -0
  110. package/payload/starter/_basic/assets/fruids/yesilbiber.png +0 -0
  111. package/payload/starter/_basic/basic/LICENSE +1 -1
  112. package/payload/starter/_basic/basic/basic.css +3 -6
  113. package/payload/starter/_basic/basic/basic.js +154 -60
  114. package/payload/starter/_basic/basic/basic.min.js +19 -6
  115. package/payload/starter/_basic/basic/scroll-bar.js +4 -2
  116. package/payload/starter/_basic/basic/scroll-bar.min.js +1 -0
  117. package/payload/starter/_basic/comp/accordion.js +659 -0
  118. package/payload/starter/_basic/comp/action-button.js +22 -23
  119. package/payload/starter/_basic/comp/action-tab-bar.js +8 -8
  120. package/payload/starter/_basic/comp/app-bar.js +12 -11
  121. package/payload/starter/_basic/comp/{badge-v2.js → badge.js} +51 -5
  122. package/payload/starter/_basic/comp/bottom-bar.js +62 -26
  123. package/payload/starter/_basic/comp/breadcrumbs.js +4 -2
  124. package/payload/starter/_basic/comp/canvas.js +652 -0
  125. package/payload/starter/_basic/comp/chat-view.js +827 -0
  126. package/payload/starter/_basic/comp/check-box.js +137 -21
  127. package/payload/starter/_basic/comp/code-editor.js +1171 -0
  128. package/payload/starter/_basic/comp/{select-color.js → color-picker.js} +62 -29
  129. package/payload/starter/_basic/comp/context-menu.js +348 -31
  130. package/payload/starter/_basic/comp/{currency-input-b.js → currency-field.js} +48 -29
  131. package/payload/starter/_basic/comp/data-table.js +114 -42
  132. package/payload/starter/_basic/comp/{select-date.js → date-picker.js} +104 -52
  133. package/payload/starter/_basic/comp/dialog.js +214 -76
  134. package/payload/starter/_basic/comp/email-field.js +65 -0
  135. package/payload/starter/_basic/comp/{select-file.js → file-picker.js} +245 -57
  136. package/payload/starter/_basic/comp/filters.js +374 -60
  137. package/payload/starter/_basic/comp/form.js +38 -26
  138. package/payload/starter/_basic/comp/full-screen-select.js +36 -33
  139. package/payload/starter/_basic/comp/gauge.js +12 -8
  140. package/payload/starter/_basic/comp/graph-box.js +3911 -0
  141. package/payload/starter/_basic/comp/grid-group.js +185 -0
  142. package/payload/starter/_basic/comp/hold-to-confirm-button.js +16 -7
  143. package/payload/starter/_basic/comp/image-view.js +598 -0
  144. package/payload/starter/_basic/comp/item-list.js +507 -163
  145. package/payload/starter/_basic/comp/json-editor.js +3221 -0
  146. package/payload/starter/_basic/comp/json-view.js +597 -0
  147. package/payload/starter/_basic/comp/label-editor.js +22 -19
  148. package/payload/starter/_basic/comp/left-menu.js +89 -22
  149. package/payload/starter/_basic/comp/line-progress-bar.js +196 -45
  150. package/payload/starter/_basic/comp/loading-screen.js +49 -18
  151. package/payload/starter/_basic/comp/log-view.js +530 -0
  152. package/payload/starter/_basic/comp/{login-page-v2.js → login-page.js} +205 -106
  153. package/payload/starter/_basic/comp/markdown-view.js +1046 -0
  154. package/payload/starter/_basic/comp/menu-bar.js +624 -0
  155. package/payload/starter/_basic/comp/mini-graph-box.js +20 -11
  156. package/payload/starter/_basic/comp/minimal-accent.js +208 -0
  157. package/payload/starter/_basic/comp/notice.js +15 -13
  158. package/payload/starter/_basic/comp/{number-input-b.js → number-field.js} +26 -19
  159. package/payload/starter/_basic/comp/numeric-keyboard.js +15 -13
  160. package/payload/starter/_basic/comp/page-control.js +21 -4
  161. package/payload/starter/_basic/comp/page-header.js +7 -6
  162. package/payload/starter/_basic/comp/password-field.js +192 -0
  163. package/payload/starter/_basic/comp/period-bar.js +8 -7
  164. package/payload/starter/_basic/comp/{phone-input-b.js → phone-field.js} +80 -45
  165. package/payload/starter/_basic/comp/progress-bar.js +401 -85
  166. package/payload/starter/_basic/comp/property-panel.js +1022 -123
  167. package/payload/starter/_basic/comp/radio-button.js +79 -19
  168. package/payload/starter/_basic/comp/range-slider.js +569 -0
  169. package/payload/starter/_basic/comp/rich-text-editor.js +33 -30
  170. package/payload/starter/_basic/comp/scroll-area.js +308 -0
  171. package/payload/starter/_basic/comp/scrolling-text.js +10 -9
  172. package/payload/starter/_basic/comp/search-input.js +725 -0
  173. package/payload/starter/_basic/comp/search-results.js +60 -24
  174. package/payload/starter/_basic/comp/select-box.js +229 -107
  175. package/payload/starter/_basic/comp/settings-row.js +20 -19
  176. package/payload/starter/_basic/comp/side-panel.js +53 -10
  177. package/payload/starter/_basic/comp/slider-field.js +264 -88
  178. package/payload/starter/_basic/comp/slider.js +556 -86
  179. package/payload/starter/_basic/comp/smart-button.js +438 -353
  180. package/payload/starter/_basic/comp/smart-table.js +748 -186
  181. package/payload/starter/_basic/comp/sortable-list.js +47 -38
  182. package/payload/starter/_basic/comp/spark-line-box.js +25 -16
  183. package/payload/starter/_basic/comp/splitter.js +411 -0
  184. package/payload/starter/_basic/comp/status-bar.js +408 -0
  185. package/payload/starter/_basic/comp/step-bar.js +345 -0
  186. package/payload/starter/_basic/comp/stepper.js +103 -49
  187. package/payload/starter/_basic/comp/tabs.js +67 -18
  188. package/payload/starter/_basic/comp/tag-input.js +50 -10
  189. package/payload/starter/_basic/comp/tap-effect.js +6 -4
  190. package/payload/starter/_basic/comp/text-area-field.js +233 -0
  191. package/payload/starter/_basic/comp/text-field.js +1006 -0
  192. package/payload/starter/_basic/comp/time-line.js +102 -28
  193. package/payload/starter/_basic/comp/{select-time.js → time-picker.js} +104 -51
  194. package/payload/starter/_basic/comp/tiny-select.js +79 -39
  195. package/payload/starter/_basic/comp/tiny-table.js +12 -8
  196. package/payload/starter/_basic/comp/toast.js +87 -34
  197. package/payload/starter/_basic/comp/toggle.js +149 -28
  198. package/payload/starter/_basic/comp/tool-bar.js +760 -0
  199. package/payload/starter/_basic/comp/tooltip.js +80 -17
  200. package/payload/starter/_basic/comp/tree-view.js +124 -41
  201. package/payload/starter/_basic/comp/ui-effects.js +17 -11
  202. package/payload/starter/_basic/comp/ui-standards.js +5 -4
  203. package/payload/starter/_basic/comp/url-field.js +190 -0
  204. package/payload/starter/_basic/comp/web-view.js +70 -16
  205. package/payload/starter/_basic/docs/basic-js-animated-rules.md +15 -9
  206. package/payload/starter/_basic/docs/basic-js-code-rules.md +42 -5
  207. package/payload/starter/_basic/docs/basic-js-components.md +12 -17
  208. package/payload/starter/_basic/docs/basic-js-core.md +5 -4
  209. package/payload/starter/_basic/docs/component-index.md +248 -107
  210. package/payload/starter/_basic/docs/component-template.js +28 -24
  211. package/payload/starter/_basic/docs/handbook/00-introduction.md +6 -2
  212. package/payload/starter/_basic/docs/handbook/00-what-is-new.md +21 -0
  213. package/payload/starter/_basic/docs/handbook/01-label.md +4 -4
  214. package/payload/starter/_basic/docs/handbook/02-box.md +7 -7
  215. package/payload/starter/_basic/docs/handbook/03-image.md +4 -4
  216. package/payload/starter/_basic/docs/handbook/04-common-properties.md +6 -5
  217. package/payload/starter/_basic/docs/handbook/05-autolayout.md +8 -7
  218. package/payload/starter/_basic/docs/handbook/06-button.md +3 -3
  219. package/payload/starter/_basic/docs/handbook/07-input.md +3 -3
  220. package/payload/starter/_basic/docs/handbook/08-page.md +3 -3
  221. package/payload/starter/_basic/docs/handbook/09-useful-examples.md +39 -58
  222. package/payload/starter/_basic/docs/handbook/10-motion.md +6 -6
  223. package/payload/starter/_basic/docs/handbook/11-other-functions.md +1 -0
  224. package/payload/starter/_basic/docs/handbook/13-sound.md +3 -3
  225. package/payload/starter/_basic/docs/handbook/14-using-components.md +180 -0
  226. package/payload/starter/_basic/docs/handbook/15-making-a-component.md +338 -0
  227. package/payload/starter/_basic/docs/what-is-new.md +106 -0
  228. package/payload/starter/_basic/examples/accordion.htm +174 -0
  229. package/payload/starter/_basic/examples/action-button.htm +74 -32
  230. package/payload/starter/_basic/examples/action-tab-bar.htm +5 -6
  231. package/payload/starter/_basic/examples/app-bar.htm +63 -41
  232. package/payload/starter/_basic/examples/badge.htm +96 -0
  233. package/payload/starter/_basic/examples/bottom-bar-2.htm +61 -48
  234. package/payload/starter/_basic/examples/bottom-bar.htm +74 -16
  235. package/payload/starter/_basic/examples/breadcrumbs.htm +160 -150
  236. package/payload/starter/_basic/examples/canvas.htm +190 -0
  237. package/payload/starter/_basic/examples/chat-view.htm +143 -0
  238. package/payload/starter/_basic/examples/check-box-2.htm +71 -82
  239. package/payload/starter/_basic/examples/check-box-3.htm +72 -83
  240. package/payload/starter/_basic/examples/check-box.htm +207 -0
  241. package/payload/starter/_basic/examples/code-editor-2.htm +259 -0
  242. package/payload/starter/_basic/examples/code-editor.htm +272 -0
  243. package/payload/starter/_basic/examples/color-picker.htm +206 -0
  244. package/payload/starter/_basic/examples/context-menu.htm +180 -139
  245. package/payload/starter/_basic/examples/currency-field.htm +105 -0
  246. package/payload/starter/_basic/examples/data-table-2.htm +2 -1
  247. package/payload/starter/_basic/examples/data-table-3.htm +1 -1
  248. package/payload/starter/_basic/examples/data-table-4.htm +15 -12
  249. package/payload/starter/_basic/examples/data-table-5.htm +11 -3
  250. package/payload/starter/_basic/examples/data-table.htm +90 -40
  251. package/payload/starter/_basic/examples/date-picker.htm +239 -0
  252. package/payload/starter/_basic/examples/dialog-centered.htm +394 -40
  253. package/payload/starter/_basic/examples/dialog.htm +267 -46
  254. package/payload/starter/_basic/examples/email-field.htm +102 -0
  255. package/payload/starter/_basic/examples/file-picker.htm +296 -0
  256. package/payload/starter/_basic/examples/filters.htm +33 -22
  257. package/payload/starter/_basic/examples/{form-1.htm → form.htm} +18 -19
  258. package/payload/starter/_basic/examples/full-screen-select.htm +81 -58
  259. package/payload/starter/_basic/examples/gallery-styled.htm +896 -0
  260. package/payload/starter/_basic/examples/gauge.htm +95 -81
  261. package/payload/starter/_basic/examples/graph-box.htm +365 -0
  262. package/payload/starter/_basic/examples/grid-group.htm +179 -0
  263. package/payload/starter/_basic/examples/hold-to-confirm-button.htm +102 -113
  264. package/payload/starter/_basic/examples/image-view.htm +195 -0
  265. package/payload/starter/_basic/examples/item-list-2.htm +138 -94
  266. package/payload/starter/_basic/examples/item-list.htm +191 -86
  267. package/payload/starter/_basic/examples/json-editor.htm +206 -0
  268. package/payload/starter/_basic/examples/json-view.htm +153 -0
  269. package/payload/starter/_basic/examples/label-editor.htm +85 -89
  270. package/payload/starter/_basic/examples/left-menu-2.htm +93 -0
  271. package/payload/starter/_basic/examples/left-menu.htm +42 -37
  272. package/payload/starter/_basic/examples/line-progress-bar.htm +155 -114
  273. package/payload/starter/_basic/examples/loading-screen.htm +149 -125
  274. package/payload/starter/_basic/examples/log-view.htm +175 -0
  275. package/payload/starter/_basic/examples/{login-page-dark-v2.htm → login-page-dark.htm} +265 -267
  276. package/payload/starter/_basic/examples/{login-page-v2.htm → login-page.htm} +266 -267
  277. package/payload/starter/_basic/examples/markdown-view.htm +220 -0
  278. package/payload/starter/_basic/examples/menu-bar-2.htm +225 -0
  279. package/payload/starter/_basic/examples/menu-bar.htm +145 -0
  280. package/payload/starter/_basic/examples/mini-graph-box.htm +98 -109
  281. package/payload/starter/_basic/examples/minimal-accent.htm +196 -0
  282. package/payload/starter/_basic/examples/minimal-theme.htm +432 -0
  283. package/payload/starter/_basic/examples/notice.htm +13 -4
  284. package/payload/starter/_basic/examples/number-field.htm +103 -0
  285. package/payload/starter/_basic/examples/numeric-keyboard.htm +44 -42
  286. package/payload/starter/_basic/examples/page-control.htm +181 -130
  287. package/payload/starter/_basic/examples/page-header.htm +57 -30
  288. package/payload/starter/_basic/examples/password-field.htm +117 -0
  289. package/payload/starter/_basic/examples/period-bar.htm +43 -29
  290. package/payload/starter/_basic/examples/phone-field-select-country.htm +292 -0
  291. package/payload/starter/_basic/examples/phone-field.htm +104 -0
  292. package/payload/starter/_basic/examples/progress-bar-ozden.htm +229 -92
  293. package/payload/starter/_basic/examples/progress-bar.htm +222 -174
  294. package/payload/starter/_basic/examples/property-panel.htm +152 -52
  295. package/payload/starter/_basic/examples/radio-button-2.htm +101 -109
  296. package/payload/starter/_basic/examples/radio-button-3.htm +81 -71
  297. package/payload/starter/_basic/examples/radio-button.htm +289 -0
  298. package/payload/starter/_basic/examples/range-slider.htm +171 -0
  299. package/payload/starter/_basic/examples/rich-text-editor.htm +115 -110
  300. package/payload/starter/_basic/examples/scroll-area.htm +293 -0
  301. package/payload/starter/_basic/examples/scrolling-text.htm +27 -6
  302. package/payload/starter/_basic/examples/search-input-2-light.htm +112 -0
  303. package/payload/starter/_basic/examples/search-input-3-dark.htm +105 -0
  304. package/payload/starter/_basic/examples/{search-input-v2-place.htm → search-input-place.htm} +25 -26
  305. package/payload/starter/_basic/examples/search-input.htm +159 -0
  306. package/payload/starter/_basic/examples/search-results.htm +85 -88
  307. package/payload/starter/_basic/examples/select-box-2-item-view.htm +304 -0
  308. package/payload/starter/_basic/examples/select-box-ozden-dark-text.htm +70 -0
  309. package/payload/starter/_basic/examples/select-box-ozden-item.htm +6 -5
  310. package/payload/starter/_basic/examples/select-box-ozden-text.htm +5 -3
  311. package/payload/starter/_basic/examples/select-box.htm +190 -159
  312. package/payload/starter/_basic/examples/settings-row.htm +92 -43
  313. package/payload/starter/_basic/examples/side-panel-2.htm +63 -25
  314. package/payload/starter/_basic/examples/side-panel.htm +84 -70
  315. package/payload/starter/_basic/examples/slider-2-split.htm +186 -0
  316. package/payload/starter/_basic/examples/slider-field-ozden.htm +286 -0
  317. package/payload/starter/_basic/examples/slider-field.htm +174 -134
  318. package/payload/starter/_basic/examples/slider.htm +257 -180
  319. package/payload/starter/_basic/examples/smart-button-3-ozden.htm +170 -257
  320. package/payload/starter/_basic/examples/smart-button-4-dark.htm +86 -47
  321. package/payload/starter/_basic/examples/smart-button-5-features.htm +130 -125
  322. package/payload/starter/_basic/examples/smart-button-alternatif.htm +266 -0
  323. package/payload/starter/_basic/examples/smart-button.htm +207 -174
  324. package/payload/starter/_basic/examples/smart-table-2.htm +43 -56
  325. package/payload/starter/_basic/examples/smart-table-3.htm +148 -113
  326. package/payload/starter/_basic/examples/smart-table-4.htm +37 -50
  327. package/payload/starter/_basic/examples/{smart-table-1.htm → smart-table-5.htm} +37 -48
  328. package/payload/starter/_basic/examples/smart-table.htm +183 -0
  329. package/payload/starter/_basic/examples/sortable-list.htm +191 -142
  330. package/payload/starter/_basic/examples/spark-line-box.htm +149 -161
  331. package/payload/starter/_basic/examples/splitter.htm +164 -0
  332. package/payload/starter/_basic/examples/status-bar.htm +166 -0
  333. package/payload/starter/_basic/examples/step-bar.htm +129 -0
  334. package/payload/starter/_basic/examples/stepper-2.htm +86 -58
  335. package/payload/starter/_basic/examples/stepper.htm +146 -135
  336. package/payload/starter/_basic/examples/tabs-2.htm +58 -67
  337. package/payload/starter/_basic/examples/tabs.htm +197 -180
  338. package/payload/starter/_basic/examples/tag-input.htm +150 -153
  339. package/payload/starter/_basic/examples/tap-effect.htm +23 -19
  340. package/payload/starter/_basic/examples/text-area-field.htm +104 -0
  341. package/payload/starter/_basic/examples/text-field-2.htm +113 -0
  342. package/payload/starter/_basic/examples/text-field-3-style.htm +105 -0
  343. package/payload/starter/_basic/examples/text-field-4-custom-unit.htm +96 -0
  344. package/payload/starter/_basic/examples/{input-b-ex5-warning-icon.htm → text-field-5-warning-icon.htm} +19 -19
  345. package/payload/starter/_basic/examples/text-field-6-modern-dark.htm +114 -0
  346. package/payload/starter/_basic/examples/text-field-7-modern.htm +106 -0
  347. package/payload/starter/_basic/examples/text-field-8-light-dark.htm +159 -0
  348. package/payload/starter/_basic/examples/text-field.htm +163 -0
  349. package/payload/starter/_basic/examples/time-line.htm +180 -116
  350. package/payload/starter/_basic/examples/time-picker.htm +240 -0
  351. package/payload/starter/_basic/examples/tiny-select.htm +118 -86
  352. package/payload/starter/_basic/examples/tiny-table.htm +40 -34
  353. package/payload/starter/_basic/examples/toast.htm +145 -147
  354. package/payload/starter/_basic/examples/toggle-2.htm +99 -68
  355. package/payload/starter/_basic/examples/toggle-3.htm +104 -101
  356. package/payload/starter/_basic/examples/toggle.htm +161 -93
  357. package/payload/starter/_basic/examples/tool-bar.htm +172 -0
  358. package/payload/starter/_basic/examples/tooltip-2.htm +110 -60
  359. package/payload/starter/_basic/examples/tooltip-3.htm +124 -65
  360. package/payload/starter/_basic/examples/tooltip-4.htm +218 -0
  361. package/payload/starter/_basic/examples/tooltip.htm +206 -124
  362. package/payload/starter/_basic/examples/tree-view.htm +210 -182
  363. package/payload/starter/_basic/examples/ui-effects.htm +207 -185
  364. package/payload/starter/_basic/examples/ui-standards.htm +200 -139
  365. package/payload/starter/_basic/examples/url-field.htm +120 -0
  366. package/payload/starter/_basic/examples/web-view.htm +109 -110
  367. package/payload/starter/_basic/min/accordion.min.js +2 -0
  368. package/payload/starter/_basic/min/action-button.min.js +1 -1
  369. package/payload/starter/_basic/min/app-bar.min.js +1 -1
  370. package/payload/starter/_basic/min/badge.min.js +2 -0
  371. package/payload/starter/_basic/min/bottom-bar.min.js +1 -1
  372. package/payload/starter/_basic/min/canvas.min.js +2 -0
  373. package/payload/starter/_basic/min/chat-view.min.js +2 -0
  374. package/payload/starter/_basic/min/check-box.min.js +1 -1
  375. package/payload/starter/_basic/min/code-editor.min.js +2 -0
  376. package/payload/starter/_basic/min/color-picker.min.js +2 -0
  377. package/payload/starter/_basic/min/context-menu.min.js +1 -1
  378. package/payload/starter/_basic/min/currency-field.min.js +2 -0
  379. package/payload/starter/_basic/min/data-table.min.js +1 -1
  380. package/payload/starter/_basic/min/date-picker.min.js +2 -0
  381. package/payload/starter/_basic/min/dialog.min.js +1 -1
  382. package/payload/starter/_basic/min/email-field.min.js +2 -0
  383. package/payload/starter/_basic/min/file-picker.min.js +2 -0
  384. package/payload/starter/_basic/min/filters.min.js +1 -1
  385. package/payload/starter/_basic/min/form.min.js +1 -1
  386. package/payload/starter/_basic/min/full-screen-select.min.js +1 -1
  387. package/payload/starter/_basic/min/gauge.min.js +1 -1
  388. package/payload/starter/_basic/min/graph-box.min.js +2 -0
  389. package/payload/starter/_basic/min/grid-group.min.js +2 -0
  390. package/payload/starter/_basic/min/hold-to-confirm-button.min.js +1 -1
  391. package/payload/starter/_basic/min/image-view.min.js +2 -0
  392. package/payload/starter/_basic/min/item-list.min.js +1 -1
  393. package/payload/starter/_basic/min/json-editor.min.js +2 -0
  394. package/payload/starter/_basic/min/json-view.min.js +2 -0
  395. package/payload/starter/_basic/min/label-editor.min.js +1 -1
  396. package/payload/starter/_basic/min/left-menu.min.js +1 -1
  397. package/payload/starter/_basic/min/line-progress-bar.min.js +1 -1
  398. package/payload/starter/_basic/min/loading-screen.min.js +1 -1
  399. package/payload/starter/_basic/min/log-view.min.js +2 -0
  400. package/payload/starter/_basic/min/login-page.min.js +2 -0
  401. package/payload/starter/_basic/min/markdown-view.min.js +2 -0
  402. package/payload/starter/_basic/min/menu-bar.min.js +2 -0
  403. package/payload/starter/_basic/min/mini-graph-box.min.js +1 -1
  404. package/payload/starter/_basic/min/minimal-accent.min.js +2 -0
  405. package/payload/starter/_basic/min/notice.min.js +1 -1
  406. package/payload/starter/_basic/min/number-field.min.js +2 -0
  407. package/payload/starter/_basic/min/numeric-keyboard.min.js +1 -1
  408. package/payload/starter/_basic/min/page-control.min.js +1 -1
  409. package/payload/starter/_basic/min/password-field.min.js +2 -0
  410. package/payload/starter/_basic/min/phone-field.min.js +2 -0
  411. package/payload/starter/_basic/min/progress-bar.min.js +1 -1
  412. package/payload/starter/_basic/min/property-panel.min.js +1 -1
  413. package/payload/starter/_basic/min/radio-button.min.js +1 -1
  414. package/payload/starter/_basic/min/range-slider.min.js +2 -0
  415. package/payload/starter/_basic/min/rich-text-editor.min.js +1 -1
  416. package/payload/starter/_basic/min/scroll-area.min.js +2 -0
  417. package/payload/starter/_basic/min/scrolling-text.min.js +1 -1
  418. package/payload/starter/_basic/min/search-input.min.js +2 -0
  419. package/payload/starter/_basic/min/search-results.min.js +1 -1
  420. package/payload/starter/_basic/min/select-box.min.js +1 -1
  421. package/payload/starter/_basic/min/settings-row.min.js +1 -1
  422. package/payload/starter/_basic/min/side-panel.min.js +1 -1
  423. package/payload/starter/_basic/min/slider-field.min.js +1 -1
  424. package/payload/starter/_basic/min/slider.min.js +1 -1
  425. package/payload/starter/_basic/min/smart-button.min.js +1 -1
  426. package/payload/starter/_basic/min/smart-table.min.js +1 -1
  427. package/payload/starter/_basic/min/sortable-list.min.js +1 -1
  428. package/payload/starter/_basic/min/spark-line-box.min.js +1 -1
  429. package/payload/starter/_basic/min/splitter.min.js +2 -0
  430. package/payload/starter/_basic/min/status-bar.min.js +2 -0
  431. package/payload/starter/_basic/min/step-bar.min.js +2 -0
  432. package/payload/starter/_basic/min/stepper.min.js +1 -1
  433. package/payload/starter/_basic/min/tabs.min.js +1 -1
  434. package/payload/starter/_basic/min/tag-input.min.js +1 -1
  435. package/payload/starter/_basic/min/text-area-field.min.js +2 -0
  436. package/payload/starter/_basic/min/text-field.min.js +2 -0
  437. package/payload/starter/_basic/min/time-line.min.js +1 -1
  438. package/payload/starter/_basic/min/time-picker.min.js +2 -0
  439. package/payload/starter/_basic/min/tiny-select.min.js +1 -1
  440. package/payload/starter/_basic/min/toast.min.js +1 -1
  441. package/payload/starter/_basic/min/toggle.min.js +1 -1
  442. package/payload/starter/_basic/min/tool-bar.min.js +2 -0
  443. package/payload/starter/_basic/min/tooltip.min.js +1 -1
  444. package/payload/starter/_basic/min/tree-view.min.js +1 -1
  445. package/payload/starter/_basic/min/ui-effects.min.js +1 -1
  446. package/payload/starter/_basic/min/url-field.min.js +2 -0
  447. package/payload/starter/_basic/min/web-view.min.js +1 -1
  448. package/payload/templates/booking/app/app.js +11 -8
  449. package/payload/templates/booking/app/settings.js +4 -4
  450. package/payload/templates/booking/index.htm +3 -3
  451. package/payload/templates/booking/pages/account.js +6 -6
  452. package/payload/templates/booking/pages/book.js +1 -1
  453. package/payload/templates/booking/pages/services.js +5 -4
  454. package/payload/templates/classic/app/app.js +15 -11
  455. package/payload/templates/classic/app/settings.js +22 -20
  456. package/payload/templates/classic/assets/_attribute.txt +2 -0
  457. package/payload/templates/classic/assets/cards/dill.png +0 -0
  458. package/payload/templates/classic/assets/cards/fennel.png +0 -0
  459. package/payload/templates/classic/assets/cards/juniper.png +0 -0
  460. package/payload/templates/classic/assets/cards/olives.png +0 -0
  461. package/payload/templates/classic/assets/cards/oregano.png +0 -0
  462. package/payload/templates/classic/assets/cards/pepper.png +0 -0
  463. package/payload/templates/classic/assets/cards/rosehip.png +0 -0
  464. package/payload/templates/classic/assets/categories/cappuccino.png +0 -0
  465. package/payload/templates/classic/assets/categories/chocolate-milk.png +0 -0
  466. package/payload/templates/classic/assets/categories/coffee.png +0 -0
  467. package/payload/templates/classic/assets/categories/frappe.png +0 -0
  468. package/payload/templates/classic/assets/categories/iced-caffee.png +0 -0
  469. package/payload/templates/classic/assets/categories/milkshake.png +0 -0
  470. package/payload/templates/classic/assets/categories/orange-juice.png +0 -0
  471. package/payload/templates/classic/assets/categories/tea.png +0 -0
  472. package/payload/templates/classic/index.htm +2 -2
  473. package/payload/templates/classic/pages/example.js +10 -10
  474. package/payload/templates/classic/pages/examples.js +44 -43
  475. package/payload/templates/classic/pages/home.js +16 -15
  476. package/payload/templates/classic/pages/info-pages.js +5 -5
  477. package/payload/templates/classic/pages/search.js +8 -7
  478. package/payload/templates/classic/pages/settings.js +13 -13
  479. package/payload/templates/classic/pages/tasks.js +1 -0
  480. package/payload/templates/classic/pages/template-pages.js +12 -11
  481. package/payload/templates/coffee-shop/app/app.js +12 -8
  482. package/payload/templates/coffee-shop/app/settings.js +4 -4
  483. package/payload/templates/coffee-shop/index.htm +3 -3
  484. package/payload/templates/coffee-shop/pages/drink.js +1 -1
  485. package/payload/templates/coffee-shop/pages/menu.js +5 -4
  486. package/payload/templates/forms/TEMPLATE.md +1 -1
  487. package/payload/templates/forms/appointment-form.htm +55 -53
  488. package/payload/templates/forms/contact-form-to-mail.htm +38 -37
  489. package/payload/templates/forms/contact-form-to-supabase.htm +47 -46
  490. package/payload/templates/forms/dark-contact-form.htm +43 -40
  491. package/payload/templates/forms/event-registration-form.htm +80 -77
  492. package/payload/templates/forms/feedback-form.htm +54 -54
  493. package/payload/templates/forms/order-form.htm +88 -84
  494. package/payload/templates/forms/recruitment-form.htm +60 -60
  495. package/payload/templates/forms/service/readme.md +9 -8
  496. package/payload/templates/forms/service/send-form-mail.php +38 -21
  497. package/payload/templates/forms/support-ticket-form.htm +67 -65
  498. package/payload/templates/panel/common/module-page.js +2 -2
  499. package/payload/templates/panel/common/theme.js +37 -10
  500. package/payload/templates/panel/common/top-bar.js +45 -40
  501. package/payload/templates/panel/index.htm +59 -60
  502. package/payload/templates/panel/module10/greenhouse.htm +98 -113
  503. package/payload/templates/panel/module11/arduino-projects.htm +47 -58
  504. package/payload/templates/panel/module6/energy-hub.htm +71 -103
  505. package/payload/templates/panel/module7/3d-printers.htm +58 -81
  506. package/payload/templates/panel/module8/cold-rooms.htm +58 -79
  507. package/payload/templates/panel/module9/elevator-fleet.htm +72 -93
  508. package/payload/templates/panel/pages/activity.js +134 -152
  509. package/payload/templates/panel/pages/contents.js +291 -308
  510. package/payload/templates/panel/pages/customers.js +250 -267
  511. package/payload/templates/panel/pages/edit-user.js +31 -30
  512. package/payload/templates/panel/pages/home.js +39 -70
  513. package/payload/templates/panel/pages/media.js +166 -183
  514. package/payload/templates/panel/pages/notifications.js +7 -7
  515. package/payload/templates/panel/pages/orders.js +200 -217
  516. package/payload/templates/panel/pages/products.js +259 -278
  517. package/payload/templates/panel/pages/reports.js +74 -123
  518. package/payload/templates/panel/pages/roles.js +57 -60
  519. package/payload/templates/panel/pages/settings.js +127 -143
  520. package/payload/templates/panel/pages/user-actions.js +106 -110
  521. package/payload/templates/panel/pages/user-list.js +221 -238
  522. package/payload/templates/panel/pages/users.js +14 -29
  523. package/payload/templates/shop/TEMPLATE.md +1 -1
  524. package/payload/templates/shop/app/app.js +11 -8
  525. package/payload/templates/shop/app/settings.js +4 -4
  526. package/payload/templates/shop/index.htm +3 -3
  527. package/payload/templates/shop/pages/account.js +7 -7
  528. package/payload/templates/shop/pages/cart.js +1 -1
  529. package/payload/templates/shop/pages/checkout.js +2 -2
  530. package/payload/templates/shop/pages/product.js +2 -2
  531. package/payload/templates/shop/pages/shop.js +6 -5
  532. package/payload/templates/starter/TEMPLATE.md +1 -1
  533. package/payload/templates/starter/app/app.js +12 -8
  534. package/payload/templates/starter/app/settings.js +14 -11
  535. package/payload/templates/starter/index.htm +3 -3
  536. package/payload/templates/starter/pages/about.js +1 -1
  537. package/payload/templates/starter/pages/home.js +2 -2
  538. package/payload/templates/starter/pages/product.js +1 -1
  539. package/payload/templates/starter/pages/products.js +5 -5
  540. package/payload/templates/starter/pages/settings.js +1 -1
  541. package/payload/templates/starter/pages/tasks.js +8 -8
  542. package/payload/templates/starter/pages/website.js +1 -1
  543. package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +0 -13
  544. package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +0 -9
  545. package/payload/starter/_basic/comp/chart-box.js +0 -868
  546. package/payload/starter/_basic/comp/email-input-b.js +0 -57
  547. package/payload/starter/_basic/comp/input-b.js +0 -759
  548. package/payload/starter/_basic/comp/password-input-b.js +0 -164
  549. package/payload/starter/_basic/comp/search-input-v2.js +0 -427
  550. package/payload/starter/_basic/comp/textarea-b.js +0 -184
  551. package/payload/starter/_basic/comp/url-input-b.js +0 -145
  552. package/payload/starter/_basic/examples/badgeV2.htm +0 -68
  553. package/payload/starter/_basic/examples/chart-box.htm +0 -287
  554. package/payload/starter/_basic/examples/check-box-1.htm +0 -220
  555. package/payload/starter/_basic/examples/currency-input-b.htm +0 -71
  556. package/payload/starter/_basic/examples/email-input-b.htm +0 -67
  557. package/payload/starter/_basic/examples/input-b-ex1.htm +0 -132
  558. package/payload/starter/_basic/examples/input-b-ex2.htm +0 -136
  559. package/payload/starter/_basic/examples/input-b-ex3-style.htm +0 -113
  560. package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +0 -112
  561. package/payload/starter/_basic/examples/input-b-ex6-dark.htm +0 -108
  562. package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +0 -153
  563. package/payload/starter/_basic/examples/number-input-b.htm +0 -68
  564. package/payload/starter/_basic/examples/password-input-b.htm +0 -70
  565. package/payload/starter/_basic/examples/phone-input-b-select-country.htm +0 -298
  566. package/payload/starter/_basic/examples/phone-input-b.htm +0 -72
  567. package/payload/starter/_basic/examples/radio-button-1.htm +0 -264
  568. package/payload/starter/_basic/examples/search-input-v2-ozden.htm +0 -128
  569. package/payload/starter/_basic/examples/search-input-v2.htm +0 -65
  570. package/payload/starter/_basic/examples/select-color.htm +0 -215
  571. package/payload/starter/_basic/examples/select-date.htm +0 -244
  572. package/payload/starter/_basic/examples/select-file.htm +0 -268
  573. package/payload/starter/_basic/examples/select-time.htm +0 -249
  574. package/payload/starter/_basic/examples/smart-button-2.htm +0 -220
  575. package/payload/starter/_basic/examples/textarea-b.htm +0 -76
  576. package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +0 -221
  577. package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +0 -221
  578. package/payload/starter/_basic/examples/url-input-b.htm +0 -85
  579. package/payload/starter/_basic/min/badge-v2.min.js +0 -2
  580. package/payload/starter/_basic/min/chart-box.min.js +0 -2
  581. package/payload/starter/_basic/min/currency-input-b.min.js +0 -2
  582. package/payload/starter/_basic/min/email-input-b.min.js +0 -2
  583. package/payload/starter/_basic/min/input-b.min.js +0 -2
  584. package/payload/starter/_basic/min/login-page-v2.min.js +0 -2
  585. package/payload/starter/_basic/min/number-input-b.min.js +0 -2
  586. package/payload/starter/_basic/min/password-input-b.min.js +0 -2
  587. package/payload/starter/_basic/min/phone-input-b.min.js +0 -2
  588. package/payload/starter/_basic/min/search-input-v2.min.js +0 -2
  589. package/payload/starter/_basic/min/select-color.min.js +0 -2
  590. package/payload/starter/_basic/min/select-date.min.js +0 -2
  591. package/payload/starter/_basic/min/select-file.min.js +0 -2
  592. package/payload/starter/_basic/min/select-time.min.js +0 -2
  593. package/payload/starter/_basic/min/textarea-b.min.js +0 -2
  594. package/payload/starter/_basic/min/url-input-b.min.js +0 -2
  595. package/payload/templates/panel/common/bridge.min.js +0 -0
  596. package/payload/templates/panel/common/full-view.min.js +0 -1
  597. package/payload/templates/panel/common/main-view.min.js +0 -1
  598. package/payload/templates/panel/common/module-page.min.js +0 -1
  599. package/payload/templates/panel/common/right-view.min.js +0 -1
  600. package/payload/templates/panel/common/start-page.min.js +0 -1
  601. package/payload/templates/panel/common/top-bar-v25-07-29-1.js +0 -330
  602. package/payload/templates/panel/common/top-bar-v25-07-29-2.js +0 -265
  603. package/payload/templates/panel/common/top-bar.min.js +0 -1
  604. package/payload/templates/panel/common/ui-standards.min.js +0 -1
  605. package/payload/templates/panel/managers/database.min.js +0 -1
  606. package/payload/templates/panel/managers/login.min.js +0 -1
  607. package/payload/templates/panel/pages/_page-template.min.js +0 -1
  608. package/payload/templates/panel/pages/contents.min.js +0 -1
  609. package/payload/templates/panel/pages/edit-user.min.js +0 -1
  610. package/payload/templates/panel/pages/edit-users-table.min.js +0 -1
  611. package/payload/templates/panel/pages/home.min.js +0 -1
  612. package/payload/templates/panel/pages/notifications.min.js +0 -1
  613. package/payload/templates/panel/pages/reports.min.js +0 -1
  614. package/payload/templates/panel/pages/settings.min.js +0 -1
  615. package/payload/templates/panel/pages/user-actions.min.js +0 -2
  616. package/payload/templates/panel/pages/users.min.js +0 -1
  617. /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn.png +0 -0
  618. /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn2.png +0 -0
  619. /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn.png +0 -0
  620. /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn2.png +0 -0
  621. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear-round.svg +0 -0
  622. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear.svg +0 -0
  623. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.png +0 -0
  624. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.svg +0 -0
  625. /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/search.svg +0 -0
@@ -6,18 +6,28 @@ PropertyPanel - v26.09
6
6
 
7
7
  UI COMPONENT TEMPLATE
8
8
  - A property inspector at the right side of the screen, like the "Design" panel of design tools.
9
- Full height, 240 px wide (width), one dark style.
9
+ Full height, 240 px wide (width), in the dark look of the kit: its warm dark, fields with a thin line, the
10
+ accent #65A293, the titles of the sections in small capitals and a line under the chosen tab (style.tab.look:
11
+ "pill" puts a field behind it; style.sectionTitle.uppercase: 0 writes the titles as they are).
10
12
  - Built from a JSON (data): header tabs, a title with action icons, and sections of items.
11
13
  footer: one more section, fixed at the bottom (out of the scrolling part). Ex: a note field.
14
+ A section with mark: 1 has a line in the accent color at its left (style.panel.markWidth): a place the eye
15
+ finds again (Ex: Size and Position). WHY a line: a lighter background is too weak, an inverted one too strong.
12
16
  headerTitle: a name at the left of the header; the tabs and the headerItem come next to it.
13
17
  empty: { icon, title, text, hints: [{ keys, text }] } -> a page in the middle in place of the sections
14
18
  (Ex: nothing is selected).
15
19
  Each item has a type, a key, a value and its own settings. Every item type is a small object
16
20
  built by its own function (see *** ITEM TYPES):
17
21
  number -> [X 396] prefix text or icon (drag the prefix to change the value; prefixWidth for a word), unit, min, max, step, autoText
22
+ prefixClick: a click on the prefix (not a drag) gives this value, like a pick of the menu of a combo;
23
+ the prefix lights up under the mouse (Ex: "Left" -> the value "__side:right")
18
24
  parseText(text): a text that is not a plain number goes to it; it returns the value ("100%", "auto")
19
25
  or undefined (the old value comes back). A text value is shown as it is.
26
+ commaIsList: 1 -> a comma separates values ("12,0" goes to parseText as a list), it is not a decimal comma.
20
27
  textToNumber(value): the number of a text value, to drag or step it (Ex: "100%" -> its width in px).
28
+ button: { icon, hint } -> [P 14, 10 ▢] a small button at the end of the field (also of a text). Its
29
+ click sends { kind: "action", key, value: "button", field } (field: the field, Ex: to open an editor
30
+ of the value at its height). So do a click on the prefix (not a drag; without prefixClick) and Alt+Down.
21
31
  text -> [ name ] a text field
22
32
  textarea -> a text of more lines (rows: 2). caption: the first line of the placeholder (it goes while writing). Saved on blur or Cmd/Ctrl+Enter.
23
33
  select -> [ Left ⌄] a menu of options, optional icon, look: "plain" (no background)
@@ -31,15 +41,26 @@ UI COMPONENT TEMPLATE
31
41
  (Chrome), the color text, and the color groups (palettes) under them.
32
42
  palettes (a param of the panel): [{ key, name, colors, canAdd, emptyText }] or function (panel) -> that.
33
43
  colors: ["#FFFFFF", { value: "var(--color-primary)", color: "#3871E0", hint: "Primary" }, ...]
34
- canAdd: 1 -> a + button adds the current color: change { kind: "addColor", key: palette key, value }.
44
+ canAdd: 1 -> an editable group: a + button adds the current color: change { kind: "addColor", key: palette key, value };
45
+ its colors are put in order by dragging: { kind: "orderColors", key, value: [the values in the new order] }.
46
+ A right click on a color: "Copy to ›" an editable group (they open at its side; addColor), "Delete" from an editable group
47
+ ({ kind: "removeColor", key, value }) or from Recent. A color with fixed: 1 is not moved (it can be deleted).
35
48
  presets (of the item, old): shown as the first palette, "Presets".
36
49
  Also: the color before / now (a click on "before" goes back), HEX / RGB / HSL text, and the
37
50
  recent colors (recentColorsKey: kept in basic.storage).
38
- - Items of a row: put them in an array. span: 1 (one column), 2 (two columns). An iconButton takes the
51
+ The ticks before "Recent" and the group name: their colors are shown under every color field of
52
+ the panel (Recent | the selected group, two rows, "+N" shows the others); a click on one gives it to
53
+ the field, a right click opens the same menu (Copy to, Delete; a ContextMenu with a submenu when
54
+ comp/context-menu.js is loaded). Kept with recentColorsKey.
55
+ - Items of a row: put them in an array. span: 1 (one column), 2 (two columns), "full", or a width in px (a
56
+ number over 2: Ex: a switch of 100 and a field of 108 fill a row with the gap). An iconButton takes the
39
57
  small last column. label: the caption above the item.
40
- - Listen to every change from outside: onChange(change, panel) or panel.listen(fn) (returns a remover).
41
- change = { kind: "value" | "action" | "tab" | "addColor", key, value, oldValue, item, sectionKey }
58
+ - Listen to every change from outside: onChange(panel, change) or panel.listen(fn): fn(panel, change) (returns a remover).
59
+ change = { kind: "value" | "action" | "tab" | "addColor" | "removeColor" | "orderColors", key, value, oldValue, item, sectionKey }
42
60
  The panel keeps the values: getValues(), getValue(key), getData() (the JSON with the current values).
61
+ - openColorPickerFor(request): the same color picker (its groups, its recent colors) for a color that is not an item of
62
+ the panel. Ex: a parameter of a component, a cell of a table. The title of the picker moves it (a double click on it: back).
63
+ - buildColorStrip(request): the colors under a color field (the ticks of the picker) for such a color.
43
64
  - setValue(key, value, silent) changes an item from outside (Ex: another object was selected).
44
65
  - It is always created on the page (whatever container is open) and opened at the right side.
45
66
  open() / close() / toggle() slide it. (Not show / hide: those are basic.js methods.)
@@ -48,9 +69,9 @@ UI COMPONENT TEMPLATE
48
69
  USAGE:
49
70
  const panel = PropertyPanel({
50
71
  data: {
51
- tabs: [{ key: "design", text: "Design" }, { key: "prototype", text: "Prototype" }],
52
- activeTab: "design",
53
- title: "Text",
72
+ tabs: [{ key: "properties", text: "Properties" }, { key: "events", text: "Events" }],
73
+ activeTab: "properties",
74
+ title: "Label",
54
75
  sections: [
55
76
  { key: "position", title: "Position", items: [
56
77
  [{ key: "x", type: "number", label: "Position", prefix: "X", value: 396 },
@@ -59,16 +80,18 @@ const panel = PropertyPanel({
59
80
  ] },
60
81
  ],
61
82
  },
62
- onChange: function (change, self) { println(change.key + " = " + change.value); },
83
+ onChange: function (self, change) { println(change.key + " = " + change.value); },
63
84
  });
64
85
  panel.setValue("x", 400, 1); // silent
65
86
  panel.getValues(); // { x: 400, y: 668, rotation: 0 }
66
87
 
67
88
  Started Date: September 2026
68
- Developer: Bugra Ozden
69
- Email: bugra.ozden@gmail.com
70
89
  Webpage: https://bug7a.github.io/js-components/
71
90
 
91
+ Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
92
+ Licensed under the Apache License, Version 2.0
93
+ SPDX-License-Identifier: Apache-2.0
94
+
72
95
  */
73
96
 
74
97
  "use strict";
@@ -79,15 +102,17 @@ const PropertyPanelDefaults = {
79
102
  width: 240,
80
103
  data: {}, // tabs, activeTab, headerTitle, headerItem, title, titleActions, sections, footer, empty (See the USAGE above)
81
104
  opened: 1, // 1: Open at create time.
82
- onChange: function (change, self) { }, // Every change: { kind, key, value, oldValue, item, sectionKey }
105
+ onChange: function (self, change) { }, // Every change: { kind, key, value, oldValue, item, sectionKey }
83
106
  palettes: null, // The color groups of the color picker: [{ key, name, colors, canAdd, emptyText }] or function (panel) -> that
84
107
  recentColorsKey: "", // The recent colors of the color picker are kept in basic.storage with this key. "": only until the page closes.
85
108
  pickColor: null, // function (panel, done): the eyedropper where the browser has none (VS Code, Safari, Firefox): the page
86
109
  // lets the user pick a color itself and calls done("#RRGGBB") (done("") : nothing was picked)
87
110
  style: {
88
111
  panel: {
89
- color: "#2C2C2C",
90
- dividerColor: "#444444",
112
+ color: "#1F1F1E", // The warm dark of the kit (its dark packages)
113
+ dividerColor: "#30302E",
114
+ markWidth: 3, // A section with mark: 1: a line in the accent color at its left
115
+ markOpacity: 0.65, // WHY: mixed with the panel, it stays calm
91
116
  headerHeight: 48,
92
117
  paddingLeft: 16,
93
118
  paddingRight: 8,
@@ -101,51 +126,60 @@ const PropertyPanelDefaults = {
101
126
  itemHeight: 24,
102
127
  },
103
128
  text: {
104
- color: "#FFFFFF",
105
- softColor: "#A5A5A5", // Captions, inactive tabs, prefixes
106
- disabledColor: "#6E6E6E",
129
+ color: "#EDEDEB",
130
+ softColor: "#9A9A97", // Captions, inactive tabs, prefixes
131
+ disabledColor: "#62625F",
107
132
  fontSize: 12,
108
133
  captionSize: 11,
109
134
  titleSize: 13,
110
- sectionTitleSize: 12,
135
+ sectionTitleSize: 11,
136
+ },
137
+ sectionTitle: { // The title of a section (not the title of the panel)
138
+ textColor: "#C9C9C6",
139
+ uppercase: 1, // 0: as it is written
140
+ letterSpacing: 0.6, // px
141
+ },
142
+ tab: {
143
+ look: "underline", // "underline": a line in the accent under the chosen tab; "pill": a field behind it
111
144
  },
112
145
  field: {
113
- color: "#383838",
114
- hoverBorderColor: "#4D4D4D",
115
- focusBorderColor: "#0C8CE9",
116
- round: 5,
146
+ color: "#292928",
147
+ borderColor: "#373735", // The line of a field at rest ("": none)
148
+ hoverBorderColor: "#575755",
149
+ focusBorderColor: "#65A293",
150
+ round: 7,
117
151
  },
118
152
  segmented: {
119
- selectedColor: "#2C2C2C",
120
- selectedBorderColor: "#5C5C5C",
121
- hoverColor: "#434343",
153
+ selectedColor: "#2E3D39", // A tint of the accent
154
+ selectedBorderColor: "#4F7D71",
155
+ hoverColor: "#333331",
122
156
  },
123
157
  button: {
124
- hoverColor: "#383838",
125
- activeColor: "#34435A", // toggle on
126
- activeIconColor: "#7CC4F8",
127
- iconColor: "#E6E6E6",
158
+ hoverColor: "#2E2E2D",
159
+ activeColor: "#2E3D39", // toggle on: a tint of the accent
160
+ activeIconColor: "#8CC7B8",
161
+ iconColor: "#D6D6D3",
128
162
  },
129
163
  accent: {
130
- color: "#0C8CE9", // Constraints lines, menu hover
164
+ color: "#65A293", // The accent of the kit: constraints lines, the chosen place, the focus
131
165
  },
132
166
  menu: {
133
- color: "#1E1E1E",
134
- borderColor: "#3A3A3A",
135
- hoverColor: "#0C8CE9",
136
- textColor: "#FFFFFF",
137
- round: 8,
167
+ color: "#232322",
168
+ borderColor: "#383836",
169
+ hoverColor: "#333331", // The row under the mouse is lighter (the text keeps its color)
170
+ textColor: "#EDEDEB",
171
+ round: 10,
138
172
  rowHeight: 26,
139
173
  maxHeight: 320,
140
- shadow: "0 8px 24px rgba(0, 0, 0, 0.45)",
174
+ shadow: "0 8px 24px rgba(0, 0, 0, 0.5)",
141
175
  },
142
176
  constraints: {
143
- frameColor: "#555555", // The inner frame of the constraints picture
177
+ frameColor: "#4A4A48", // The inner frame of the constraints picture
144
178
  },
145
179
  alignGrid: {
146
- cellColor: "#6E6E6E", // The empty square of a place
147
- hoverColor: "#A5A5A5",
148
- selectedColor: "#0C8CE9", // The filled square of the chosen place (the accent)
180
+ cellColor: "#62625F", // The empty square of a place
181
+ hoverColor: "#9A9A97",
182
+ selectedColor: "#65A293", // The filled square of the chosen place (the accent)
149
183
  },
150
184
  textarea: {
151
185
  lineHeight: 17,
@@ -158,19 +192,22 @@ const PropertyPanelDefaults = {
158
192
  handleSize: 12,
159
193
  sliderHeight: 12,
160
194
  swatchSize: 18,
161
- swatchGap: 6,
195
+ swatchGap: 5, // WHY 5: with the room of the rings (swatchRoom) 9 colors still fit one row
196
+ swatchRoom: 4, // px around the colors: the selected ring (3) and the hover growth are not cut by the scroll
162
197
  swatchesMaxHeight: 126, // More colors scroll
198
+ quickSwatchSize: 14, // The colors under a color field (the ticks of the picker)
199
+ quickSwatchGap: 5,
163
200
  },
164
201
  empty: { // data.empty: the page in the middle (Ex: nothing is selected)
165
202
  iconSize: 26,
166
- iconColor: "#A5A5A5",
167
- iconBoxColor: "#383838",
203
+ iconColor: "#9A9A97",
204
+ iconBoxColor: "#292928",
168
205
  iconBoxRound: 16,
169
206
  },
170
207
  swatch: {
171
208
  size: 14,
172
209
  borderColor: "rgba(255, 255, 255, 0.25)",
173
- emptyColor: "#555555", // The line of an empty (transparent) color
210
+ emptyColor: "#575755", // The line of an empty (transparent) color
174
211
  },
175
212
  scrollBar: { // basic/scroll-bar.js (ScrollBar) parameters of the panel
176
213
  bar_color: "#FFFFFF",
@@ -220,6 +257,7 @@ const PropertyPanel = function (params = {}) {
220
257
  const MENU_OFFSET = 4; // Space between the field and its menu.
221
258
  const SCREEN_MARGIN = 8; // The menu stays this far from the window edges.
222
259
  const SHIFT_STEP_FACTOR = 10; // Shift + arrow / scrub: 10 steps.
260
+ const PREFIX_CLICK_DISTANCE = 3; // px: a press on a prefix that moves less is a click (prefixClick), not a scrub.
223
261
 
224
262
  // *** PUBLIC VARIABLES:
225
263
  // NOTE: Default values are also public variables. (box.data: the JSON with the current values)
@@ -235,8 +273,11 @@ const PropertyPanel = function (params = {}) {
235
273
  return '<svg xmlns="http://www.w3.org/2000/svg" width="' + size + '" height="' + size + '" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" style="display:block"><path d="' + path + '"/></svg>';
236
274
  };
237
275
 
276
+ // span: 1, 2, "full", or a width in px (a number over 2: Ex: 100 + 108 + the gap = a full row)
277
+ const SPAN_PX_FROM = 3;
238
278
  const getSpanWidth = function (span) {
239
279
  if (span === "full") return panelWidth - _ps.paddingLeft - _ps.paddingRight;
280
+ if (typeof span === "number" && span >= SPAN_PX_FROM) return span;
240
281
  if (span == 2) return _g.columnWidth * 2 + _g.gap;
241
282
  return _g.columnWidth;
242
283
  };
@@ -296,11 +337,11 @@ const PropertyPanel = function (params = {}) {
296
337
  });
297
338
  };
298
339
 
299
- // Border of a field: focus, hover (when enabled) or none.
340
+ // Border of a field: focus, hover (when enabled) or its line at rest.
300
341
  const paintField = function (field, state) {
301
342
  if (state.isFocus) setBorder(field, _s.field.focusBorderColor);
302
343
  else if (state.isHover && state.enabled) setBorder(field, _s.field.hoverBorderColor);
303
- else setBorder(field, "");
344
+ else setBorder(field, _s.field.borderColor || "");
304
345
  };
305
346
 
306
347
  const precisionOf = function (item) {
@@ -334,9 +375,9 @@ const PropertyPanel = function (params = {}) {
334
375
 
335
376
  // Sends a change to the item, the onChange of the panel and the listeners.
336
377
  const dispatch = function (change) {
337
- if (change.item && typeof change.item.onChange === "function") change.item.onChange(change, box);
338
- box.onChange(change, box);
339
- listeners.slice().forEach(function (fn) { fn(change, box); });
378
+ if (change.item && typeof change.item.onChange === "function") change.item.onChange(box, change);
379
+ box.onChange(box, change);
380
+ listeners.slice().forEach(function (fn) { fn(box, change); });
340
381
  };
341
382
 
342
383
  // Some item types fill the missing parts of a value. (Ex: constraints)
@@ -368,6 +409,11 @@ const PropertyPanel = function (params = {}) {
368
409
  dispatch({ kind: "action", key: ctrl.item.key, value: value, oldValue: undefined, item: ctrl.item, sectionKey: ctrl.sectionKey });
369
410
  };
370
411
 
412
+ // The button at the end of a field (item.button). field: where the page opens what the button opens.
413
+ const sendFieldButton = function (ctrl) {
414
+ dispatch({ kind: "action", key: ctrl.item.key, value: "button", oldValue: undefined, item: ctrl.item, sectionKey: ctrl.sectionKey, field: ctrl.field });
415
+ };
416
+
371
417
  // *** MENU (select, combo):
372
418
 
373
419
  const closeMenu = function () {
@@ -468,9 +514,11 @@ const PropertyPanel = function (params = {}) {
468
514
 
469
515
  // *** SMALL OBJECTS USED BY THE ITEM TYPES:
470
516
 
471
- // FIELD: A text input in a field, with an optional prefix (a text or an icon). Used by "number" and "text".
472
- // Returns { field, input, el, prefix, setEnabled() }. The caller adds its own commit code.
517
+ // FIELD: A text input in a field, with an optional prefix (a text or an icon) and a button at its end (item.button).
518
+ // Used by "number" and "text". Returns { field, input, el, prefix, button, setEnabled() }. The caller adds its own
519
+ // commit code and the click of the button.
473
520
  const PREFIX_WIDTH = 26;
521
+ const FIELD_BUTTON_WIDTH = 22;
474
522
  const buildInputField = function (item, width, prefixValue) {
475
523
 
476
524
  const state = { isHover: 0, isFocus: 0, enabled: item.enabled != 0 };
@@ -505,12 +553,30 @@ const PropertyPanel = function (params = {}) {
505
553
  el.setAttribute("spellcheck", "false");
506
554
  el.setAttribute("aria-label", item.hint || item.label || item.prefix || item.key);
507
555
 
556
+ // LABEL: The button at the end (item.button: { icon, hint })
557
+ let button = null;
558
+ if (item.button) {
559
+ button = textLabel(getIcon(item.button.icon, 14), { width: FIELD_BUTTON_WIDTH, height: _g.itemHeight, textColor: _t.softColor });
560
+ button.clickable = 1;
561
+ button.css.borderRadius = "0px " + _s.field.round + "px " + _s.field.round + "px 0px";
562
+ button.role = "button";
563
+ button.aria = { label: item.button.hint || "" };
564
+ button.elem.title = item.button.hint || "";
565
+ }
566
+
508
567
  endGroup();
509
568
 
510
569
  onHover(field, function (isHover) {
511
570
  state.isHover = isHover;
512
571
  paint();
513
572
  });
573
+ if (button) {
574
+ onHover(button, function (isHover) {
575
+ const isLit = (isHover && state.enabled);
576
+ button.color = (isLit) ? _s.segmented.hoverColor : "transparent";
577
+ button.textColor = (isLit) ? _t.color : ink(state.enabled, _t.softColor);
578
+ });
579
+ }
514
580
  el.addEventListener("focus", function () {
515
581
  state.isFocus = 1;
516
582
  paint();
@@ -525,12 +591,16 @@ const PropertyPanel = function (params = {}) {
525
591
  el.disabled = !state.enabled;
526
592
  el.style.color = ink(state.enabled, _t.color);
527
593
  if (prefix) prefix.textColor = ink(state.enabled, _t.softColor);
594
+ if (button) {
595
+ button.textColor = ink(state.enabled, _t.softColor);
596
+ button.cursor = (state.enabled) ? "pointer" : "default";
597
+ }
528
598
  paint();
529
599
  };
530
600
 
531
601
  setEnabled(state.enabled);
532
602
 
533
- return { field: field, input: input, el: el, prefix: prefix, state: state, setEnabled: setEnabled };
603
+ return { field: field, input: input, el: el, prefix: prefix, button: button, state: state, setEnabled: setEnabled };
534
604
 
535
605
  };
536
606
 
@@ -545,7 +615,7 @@ const PropertyPanel = function (params = {}) {
545
615
  let value = item.value;
546
616
  let scrub = null;
547
617
 
548
- const { field, input, el, prefix, state, setEnabled: setFieldEnabled } = buildInputField(item, width, item.icon || item.prefix);
618
+ const { field, input, el, prefix, button, state, setEnabled: setFieldEnabled } = buildInputField(item, width, item.icon || item.prefix);
549
619
 
550
620
  const format = function (v) {
551
621
  if (v === null || v === undefined || v === "") return item.autoText || "";
@@ -572,7 +642,9 @@ const PropertyPanel = function (params = {}) {
572
642
  const parse = function (text) {
573
643
  text = String(text).trim();
574
644
  if (item.autoText && (text === "" || text.toLowerCase() === String(item.autoText).toLowerCase())) return null;
575
- const isPlainNumber = /^-?\d*[.,]?\d+(px)?$/i.test(text);
645
+ // WHY commaIsList: in a field of a list ("14, 10") 12,0 is two values, not the decimal 12.0
646
+ const plainNumber = (item.commaIsList) ? /^-?\d*\.?\d+(px)?$/i : /^-?\d*[.,]?\d+(px)?$/i;
647
+ const isPlainNumber = plainNumber.test(text);
576
648
  if (item.parseText && !isPlainNumber) return item.parseText(text);
577
649
  const match = text.replace(",", ".").match(/-?\d*\.?\d+/);
578
650
  if (!match) return undefined;
@@ -614,13 +686,24 @@ const PropertyPanel = function (params = {}) {
614
686
  event.preventDefault();
615
687
  input.text = format(value);
616
688
  el.blur();
689
+ } else if (button && event.altKey && event.key === "ArrowDown") {
690
+ event.preventDefault();
691
+ el.blur(); // WHY: the text written so far is kept first, the editor opens with it.
692
+ sendFieldButton(ctrl);
617
693
  } else if (event.key === "ArrowUp" || event.key === "ArrowDown") {
618
694
  event.preventDefault();
619
695
  stepByArrow(event);
620
696
  }
621
697
  });
698
+ if (button) {
699
+ button.on("click", function () {
700
+ if (state.enabled) sendFieldButton(ctrl);
701
+ });
702
+ }
622
703
 
623
704
  // Scrub: drag the prefix left / right. 1 px = 1 step (Shift: 10 steps)
705
+ // prefixClick: a press without a drag gives that value.
706
+ const hasPrefixClick = (item.prefixClick !== undefined);
624
707
  if (prefix) {
625
708
  prefix.clickable = 1;
626
709
  prefix.css.touchAction = "none";
@@ -629,8 +712,9 @@ const PropertyPanel = function (params = {}) {
629
712
  event.preventDefault();
630
713
  if (document.activeElement === el) el.blur();
631
714
  const start = numberOf(value);
632
- if (start === null && typeof value === "string") return; // WHY: A text value with no number: no scrub.
633
- scrub = { id: event.pointerId, x: event.clientX, start: start || 0 };
715
+ // WHY: A text value with no number: no scrub (a click still works)
716
+ const canScrub = !(start === null && typeof value === "string");
717
+ scrub = { id: event.pointerId, x: event.clientX, start: start || 0, canScrub: canScrub, isMoved: 0 };
634
718
  try {
635
719
  prefix.elem.setPointerCapture(event.pointerId);
636
720
  } catch (e) { } // WHY: It throws when the pointer is not active any more; the scrub still works without it.
@@ -638,12 +722,29 @@ const PropertyPanel = function (params = {}) {
638
722
  prefix.on("pointermove", function (self, event) {
639
723
  if (!scrub || event.pointerId !== scrub.id) return;
640
724
  const movedPixels = Math.round(event.clientX - scrub.x);
725
+ if (Math.abs(movedPixels) >= PREFIX_CLICK_DISTANCE) scrub.isMoved = 1;
726
+ if (!scrub.canScrub || !scrub.isMoved) return;
641
727
  const next = clamp(scrub.start + movedPixels * step * stepFactorOf(event));
642
728
  if (next !== value) commit(next);
643
729
  });
644
730
  const endScrub = function () { scrub = null; };
645
- prefix.on("pointerup", endScrub);
731
+ prefix.on("pointerup", function (self, event) {
732
+ const isClick = (scrub && !scrub.isMoved && event.pointerId === scrub.id);
733
+ endScrub();
734
+ if (!isClick || !state.enabled) return;
735
+ if (!hasPrefixClick) {
736
+ if (button) sendFieldButton(ctrl); // WHY: the prefix is the name of the value: a click opens it, a drag changes it.
737
+ return;
738
+ }
739
+ setValue(item.prefixClick);
740
+ changeValue(ctrl, item.prefixClick);
741
+ });
646
742
  prefix.on("pointercancel", endScrub);
743
+ if (hasPrefixClick) {
744
+ prefix.aria = { label: item.prefixHint || "" };
745
+ prefix.elem.title = item.prefixHint || "";
746
+ onHover(prefix, function (isHover) { prefix.textColor = (isHover && state.enabled) ? _t.color : _t.softColor; });
747
+ }
647
748
  }
648
749
 
649
750
  const setValue = function (v) {
@@ -654,7 +755,9 @@ const PropertyPanel = function (params = {}) {
654
755
 
655
756
  const setEnabled = function (enabled) {
656
757
  setFieldEnabled(enabled);
657
- if (prefix) prefix.cursor = (state.enabled) ? "ew-resize" : "default";
758
+ if (!prefix) return;
759
+ const activeCursor = (hasPrefixClick) ? "pointer" : "ew-resize";
760
+ prefix.cursor = (state.enabled) ? activeCursor : "default";
658
761
  };
659
762
 
660
763
  setValue(value);
@@ -926,6 +1029,7 @@ const PropertyPanel = function (params = {}) {
926
1029
  const CHECKER = "repeating-conic-gradient(#BBBBBB 0% 25%, #FFFFFF 0% 50%) 0 0 / 6px 6px";
927
1030
  const ALPHA_INPUT_WIDTH = 46;
928
1031
  const PICKER_SPACE = 8; // Between the panel and the color picker
1032
+ let movedPickerPlace = null; // { left, top }: the picker was moved by its title: it opens there until a double click on its title
929
1033
 
930
1034
  // A CSS color -> { r, g, b, a }, read by a canvas. null: this page can not read it (Ex: an unknown token).
931
1035
  const readColor = function (color) {
@@ -1018,10 +1122,41 @@ const PropertyPanel = function (params = {}) {
1018
1122
  };
1019
1123
  let recentColors = loadRecentColors();
1020
1124
 
1125
+ const saveRecentColors = function () {
1126
+ if (box.recentColorsKey) basic.storage.save(box.recentColorsKey, recentColors);
1127
+ };
1128
+
1021
1129
  const rememberColor = function (value) {
1022
1130
  if (!value) return;
1023
1131
  recentColors = [value].concat(recentColors.filter(function (v) { return v !== value; })).slice(0, RECENT_COLOR_COUNT);
1024
- if (box.recentColorsKey) basic.storage.save(box.recentColorsKey, recentColors);
1132
+ saveRecentColors();
1133
+ };
1134
+
1135
+ const forgetColor = function (value) {
1136
+ recentColors = recentColors.filter(function (v) { return v !== value; });
1137
+ saveRecentColors();
1138
+ };
1139
+
1140
+ // The ticks of the picker: the recent colors and the colors of the selected group under every color field.
1141
+ // (kept with the recent colors, and the selected group with them)
1142
+ const QUICK_COLORS_KEY_END = "-quick";
1143
+ const loadQuickColors = function () {
1144
+ const saved = (box.recentColorsKey) ? basic.storage.load(box.recentColorsKey + QUICK_COLORS_KEY_END) : null;
1145
+ return Object.assign({ recent: 0, group: 0, paletteKey: "" }, saved || {});
1146
+ };
1147
+ const quickColors = loadQuickColors();
1148
+ lastPaletteKey = quickColors.paletteKey;
1149
+
1150
+ const saveQuickColors = function () {
1151
+ quickColors.paletteKey = lastPaletteKey;
1152
+ if (box.recentColorsKey) basic.storage.save(box.recentColorsKey + QUICK_COLORS_KEY_END, quickColors);
1153
+ };
1154
+
1155
+ let quickStrips = []; // The colors under the color fields: { obj, draw(), paint(value) }
1156
+
1157
+ const refreshQuickStrips = function () {
1158
+ quickStrips = quickStrips.filter(function (strip) { return !strip.obj._isRemoved; });
1159
+ quickStrips.forEach(function (strip) { strip.draw(); });
1025
1160
  };
1026
1161
 
1027
1162
  const toPreset = function (preset) {
@@ -1064,6 +1199,447 @@ const PropertyPanel = function (params = {}) {
1064
1199
  obj.css.background = "linear-gradient(" + color + ", " + color + "), " + CHECKER;
1065
1200
  };
1066
1201
 
1202
+ const SWATCH_HOVER_SCALE = 1.1; // WHY not more: the ring and the growth must stay in the room around the colors
1203
+
1204
+ // The ring of the selected color (a gap in the color of what is behind it, then the accent), or a thin edge.
1205
+ const paintSwatchRing = function (square, isSelected, backColor) {
1206
+ square.boxShadow = (isSelected) ? "0 0 0 2px " + backColor + ", 0 0 0 3px " + _s.accent.color : "inset 0 0 0 1px " + _s.swatch.borderColor;
1207
+ };
1208
+
1209
+ // The palette of the picker for an item: the selected one, or the first.
1210
+ const currentPaletteOf = function (item) {
1211
+ const list = palettesOf(item);
1212
+ return list.find(function (palette) { return palette.key === lastPaletteKey; }) || list[0] || null;
1213
+ };
1214
+
1215
+ // BOX: A small check box. onToggle(isOn) after a click. Returns it with setOn(isOn).
1216
+ const TICK_SIZE = 14;
1217
+ const buildTick = function (isOn, label, onToggle) {
1218
+ const tick = textLabel("", { width: TICK_SIZE, height: TICK_SIZE, textColor: "#FFFFFF" });
1219
+ tick.round = 3;
1220
+ tick.clickable = 1;
1221
+ tick.cursor = "pointer";
1222
+ tick.tabIndex = 0;
1223
+ tick.role = "checkbox";
1224
+ tick.elem.title = label;
1225
+ tick.setOn = function (on) {
1226
+ isOn = on;
1227
+ tick.text = (on) ? getIcon("check", 12) : "";
1228
+ tick.color = (on) ? _s.accent.color : "transparent";
1229
+ setBorder(tick, (on) ? "" : _t.softColor);
1230
+ tick.aria = { label: label, checked: (on) ? "true" : "false" };
1231
+ };
1232
+ const toggle = function () {
1233
+ tick.setOn((isOn) ? 0 : 1);
1234
+ onToggle(isOn);
1235
+ };
1236
+ tick.on("click", toggle);
1237
+ onActivateKey(tick, toggle);
1238
+ tick.setOn(isOn);
1239
+ return tick;
1240
+ };
1241
+
1242
+ // *** CHANGES OF THE COLOR GROUPS (the menu of a color in the picker and under the fields, a drag)
1243
+
1244
+ const RECENT_PALETTE = { key: "__recent", name: "Recent", isRecent: 1 };
1245
+
1246
+ const valueOfColor = function (color) {
1247
+ return (color && typeof color === "object") ? color.value : color;
1248
+ };
1249
+
1250
+ const hasColor = function (colors, value) {
1251
+ return colors.some(function (color) { return PropertyPanel.isSameValue(valueOfColor(color), value); });
1252
+ };
1253
+
1254
+ // A color is deleted from Recent or from an editable group (canAdd). (fixed: it only stays in its place)
1255
+ const canDeleteFrom = function (palette) {
1256
+ return (palette.isRecent || palette.canAdd) ? 1 : 0;
1257
+ };
1258
+
1259
+ // The editable groups a color of a palette can be copied to (not its own, not one that has it already).
1260
+ const copyTargetsOf = function (item, palette, value) {
1261
+ return palettesOf(item).filter(function (p) { return p.canAdd && p.key !== palette.key && !hasColor(p.colors, value); });
1262
+ };
1263
+
1264
+ // The change goes to the listener (it keeps the colors of its groups). A static palette (not a function)
1265
+ // is changed here: changeColors(colors) -> the new colors (WHY it must give the same result twice: the
1266
+ // listener may have changed the same array). origin: the ctrl of the color field.
1267
+ const changePaletteColors = function (origin, palette, change, changeColors) {
1268
+ dispatch(Object.assign({ key: palette.key, oldValue: undefined, item: origin.item, sectionKey: origin.sectionKey }, change));
1269
+ readPalettes();
1270
+ if (typeof box.palettes !== "function") {
1271
+ const shared = paletteCache.find(function (p) { return p.key === palette.key; });
1272
+ if (shared) shared.colors = changeColors((shared.colors || []).slice());
1273
+ }
1274
+ refreshQuickStrips();
1275
+ };
1276
+
1277
+ const addPaletteColor = function (origin, palette, value) {
1278
+ if (!value || hasColor(palette.colors, value)) return;
1279
+ changePaletteColors(origin, palette, { kind: "addColor", value: value }, function (colors) {
1280
+ return (hasColor(colors, value)) ? colors : colors.concat([value]);
1281
+ });
1282
+ };
1283
+
1284
+ const deletePaletteColor = function (origin, palette, value) {
1285
+ if (palette.isRecent) {
1286
+ forgetColor(value);
1287
+ refreshQuickStrips();
1288
+ return;
1289
+ }
1290
+ changePaletteColors(origin, palette, { kind: "removeColor", value: value }, function (colors) {
1291
+ return colors.filter(function (color) { return !PropertyPanel.isSameValue(valueOfColor(color), value); });
1292
+ });
1293
+ };
1294
+
1295
+ // values: every color of the palette in the new order (after a drag)
1296
+ const orderPaletteColors = function (origin, palette, values) {
1297
+ changePaletteColors(origin, palette, { kind: "orderColors", value: values }, function (colors) {
1298
+ const ordered = values.map(function (value) {
1299
+ return colors.find(function (color) { return PropertyPanel.isSameValue(valueOfColor(color), value); });
1300
+ });
1301
+ return ordered.filter(function (color) { return color !== undefined; });
1302
+ });
1303
+ };
1304
+
1305
+ // GROUP: The colors under a color field: the recent colors | the colors of the selected group (the ticks of
1306
+ // the picker), two rows at most: "+N" shows the others. A click gives the color to the field: onPick(value);
1307
+ // a right click opens its menu (Copy to, Delete). Hidden when no tick is on.
1308
+ // *** THE MENU OF A COLOR (a right click, in the picker and under a field):
1309
+ // [⧉ Copy to ›] its editable groups open at its side (on hover, a click, Enter or →)
1310
+ // [🗑 Delete ]
1311
+
1312
+ const COLOR_MENU_WIDTH = 150;
1313
+ const SUBMENU_OVERLAP = 4; // The list of groups covers the edge of the menu a little
1314
+
1315
+ // GROUP: A row of the menu of a color: an icon (or none), the text, an icon at the end (or none)
1316
+ const buildColorMenuRow = function (icon, text, label, endIcon) {
1317
+ const ms = _s.menu;
1318
+ const row = HGroup({ width: "100%", height: ms.rowHeight, align: "left center", gap: 0, padding: [8, 0], color: "transparent" });
1319
+ row.shrink = 0;
1320
+ row.clickable = 1;
1321
+ row.cursor = "pointer";
1322
+ row.tabIndex = 0;
1323
+ row.role = "menuitem";
1324
+ row.aria = { label: label };
1325
+ if (icon) textLabel(getIcon(icon, 14), { width: 24, height: ms.rowHeight, textColor: ms.textColor });
1326
+ const lblText = textLabel("", { flex: 1, height: ms.rowHeight, textColor: ms.textColor, plainText: text });
1327
+ if (!icon) lblText.css.paddingLeft = "4px";
1328
+ if (endIcon) textLabel(getIcon(endIcon, 14), { width: 18, height: ms.rowHeight, textColor: _t.softColor });
1329
+ endGroup();
1330
+ // keepHover: the row stays painted (Copy to, while its list is open)
1331
+ onHover(row, function (isHover) { row.color = (isHover || row.keepHover) ? ms.hoverColor : "transparent"; });
1332
+ return row;
1333
+ };
1334
+
1335
+ // GROUP: The menu of a color, in the current container (place it after: left, top).
1336
+ // menu: { value, targets (the editable groups), canDelete, groupName, onCopy(target), onDelete(), close() }
1337
+ const buildColorMenu = function (menu) {
1338
+ const ms = _s.menu;
1339
+ const menuBox = VGroup({ width: COLOR_MENU_WIDTH, height: "auto", align: "left top", gap: 0, color: ms.color, round: ms.round });
1340
+ menuBox.css = { position: "absolute", padding: "4px 0px", boxSizing: "border-box", alignItems: "stretch" };
1341
+ menuBox.boxShadow = "0 0 0 1px " + ms.borderColor + ", " + ms.shadow;
1342
+ menuBox.clickable = 1;
1343
+ menuBox.clipContent = 0; // (the list of groups is at its side)
1344
+ menuBox.role = "menu";
1345
+ menuBox.aria = { label: menu.value };
1346
+ let subMenu = null;
1347
+ let rowCopy = null;
1348
+
1349
+ const closeSubMenu = function () {
1350
+ if (!subMenu) return;
1351
+ subMenu.remove();
1352
+ subMenu = null;
1353
+ rowCopy.keepHover = 0;
1354
+ rowCopy.color = "transparent";
1355
+ };
1356
+
1357
+ // At the right of the menu (at its left when there is no room), its first row at "Copy to"; it goes up
1358
+ // when it would leave the bottom of the window.
1359
+ const placeSubMenu = function () {
1360
+ const menuRect = menuBox.elem.getBoundingClientRect();
1361
+ const width = subMenu.elem.offsetWidth;
1362
+ const height = subMenu.elem.offsetHeight;
1363
+ const fitsRight = (menuRect.right + width - SUBMENU_OVERLAP <= window.innerWidth - SCREEN_MARGIN);
1364
+ subMenu.left = (fitsRight) ? menuRect.width - SUBMENU_OVERLAP : SUBMENU_OVERLAP - width;
1365
+ const top = rowCopy.elem.offsetTop - 4; // WHY 4: the padding of the list, so its first row is at the row
1366
+ const overflow = menuRect.top + top + height - (window.innerHeight - SCREEN_MARGIN);
1367
+ subMenu.top = top - Math.max(0, overflow);
1368
+ };
1369
+
1370
+ const openSubMenu = function (focusFirst) {
1371
+ if (!subMenu) {
1372
+ subMenu = createIn(menuBox, function () {
1373
+ // GROUP: The editable groups
1374
+ const list = VGroup({ width: COLOR_MENU_WIDTH, height: "auto", align: "left top", gap: 0, color: ms.color, round: ms.round });
1375
+ list.css = { position: "absolute", padding: "4px 0px", boxSizing: "border-box", alignItems: "stretch" };
1376
+ list.boxShadow = "0 0 0 1px " + ms.borderColor + ", " + ms.shadow;
1377
+ list.clickable = 1;
1378
+ list.role = "menu";
1379
+ list.aria = { label: "Copy to" };
1380
+ menu.targets.forEach(function (target) {
1381
+ const row = buildColorMenuRow("", target.name, "Copy " + menu.value + " to " + target.name, "");
1382
+ const copy = function () {
1383
+ menu.close();
1384
+ menu.onCopy(target);
1385
+ };
1386
+ row.on("click", copy);
1387
+ onActivateKey(row, copy);
1388
+ });
1389
+ endGroup();
1390
+ // ← or Escape: back to "Copy to" (WHY stopPropagation: not the whole menu)
1391
+ list.on("keydown", function (self, event) {
1392
+ if (event.key !== "ArrowLeft" && event.key !== "Escape") return;
1393
+ event.preventDefault();
1394
+ event.stopPropagation();
1395
+ closeSubMenu();
1396
+ rowCopy.elem.focus();
1397
+ });
1398
+ return list;
1399
+ });
1400
+ rowCopy.keepHover = 1;
1401
+ rowCopy.color = ms.hoverColor;
1402
+ rowCopy.aria = { expanded: "true" };
1403
+ placeSubMenu();
1404
+ }
1405
+ if (focusFirst) subMenu.elem.querySelector("[role=menuitem]").focus({ preventScroll: true });
1406
+ };
1407
+
1408
+ if (menu.targets.length) {
1409
+ rowCopy = buildColorMenuRow("copy", "Copy to", "Copy " + menu.value + " to a color group", "chevronRight");
1410
+ rowCopy.aria = { haspopup: "menu", expanded: "false" };
1411
+ rowCopy.on("mouseenter", function () { openSubMenu(0); });
1412
+ rowCopy.on("click", function () { openSubMenu(1); });
1413
+ onActivateKey(rowCopy, function () { openSubMenu(1); }, ["ArrowRight"]);
1414
+ }
1415
+ if (menu.targets.length && menu.canDelete) {
1416
+ // BOX: Line
1417
+ const line = Box({ width: "100%", height: 1, color: ms.borderColor });
1418
+ line.shrink = 0;
1419
+ line.css.margin = "4px 0px";
1420
+ }
1421
+ if (menu.canDelete) {
1422
+ const rowDelete = buildColorMenuRow("trash", "Delete", "Delete " + menu.value + " from " + menu.groupName, "");
1423
+ const remove = function () {
1424
+ menu.close();
1425
+ menu.onDelete();
1426
+ };
1427
+ rowDelete.on("mouseenter", closeSubMenu);
1428
+ rowDelete.on("click", remove);
1429
+ onActivateKey(rowDelete, remove);
1430
+ }
1431
+ endGroup();
1432
+ return menuBox;
1433
+ };
1434
+
1435
+ // MENU: The menu of a color under a field as a ContextMenu (comp/context-menu.js), in the colors of the panel.
1436
+ // One for the panel, made the first time (box.own: removed with the panel). Its items change at every open.
1437
+ let quickContextMenu = null;
1438
+ let onQuickMenuClick = null;
1439
+
1440
+ // ctrlOfStrip: the ctrl of the color field of the strip
1441
+ const openQuickContextMenu = function (ctrlOfStrip, square, palette, value, event) {
1442
+ const targets = copyTargetsOf(ctrlOfStrip.item, palette, value);
1443
+ const canDelete = canDeleteFrom(palette);
1444
+ if (!targets.length && !canDelete) return;
1445
+ closeMenu(); // (the picker)
1446
+ if (!quickContextMenu) {
1447
+ const ms = _s.menu;
1448
+ quickContextMenu = box.own(ContextMenu({
1449
+ styleName: "dark",
1450
+ minWidth: COLOR_MENU_WIDTH,
1451
+ style: {
1452
+ menu: { color: ms.color, borderColor: ms.borderColor, shadow: ms.shadow, round: ms.round, zIndex: MENU_Z_INDEX },
1453
+ item: { height: ms.rowHeight, fontSize: _t.fontSize, textColor: ms.textColor },
1454
+ itemHover: { color: ms.hoverColor, textColor: ms.textColor },
1455
+ },
1456
+ onClick: function (self, item) { if (onQuickMenuClick) onQuickMenuClick(item); },
1457
+ }));
1458
+ }
1459
+ const items = [];
1460
+ if (targets.length) {
1461
+ items.push({ text: "Copy to", icon: getIcon("copy", 16), items: targets.map(function (target) { return { text: target.name, key: "copy", data: target }; }) });
1462
+ }
1463
+ if (targets.length && canDelete) items.push("-");
1464
+ if (canDelete) items.push({ text: "Delete", key: "delete", icon: getIcon("trash", 16) });
1465
+ onQuickMenuClick = function (item) {
1466
+ if (item.key === "copy") addPaletteColor(ctrlOfStrip, item.data, value);
1467
+ if (item.key === "delete") deletePaletteColor(ctrlOfStrip, palette, value);
1468
+ };
1469
+ quickContextMenu.setItems(items);
1470
+ const rect = square.elem.getBoundingClientRect();
1471
+ const x = (event) ? event.clientX : rect.left;
1472
+ const y = (event) ? event.clientY : rect.bottom;
1473
+ quickContextMenu.openAt(x, y, square);
1474
+ if (!event) quickContextMenu.activateFirst(); // (the keyboard: the first item is active)
1475
+ };
1476
+
1477
+ const QUICK_ROWS = 2; // The colors under a field: more rows are behind "+N"
1478
+ const MORE_BUTTON_SLOTS = 2; // "+N" takes the place of two colors
1479
+ const buildQuickStrip = function (ctrl, width, onPick) {
1480
+ const item = ctrl.item;
1481
+ const cp = _s.colorPicker;
1482
+ const size = cp.quickSwatchSize;
1483
+ const gap = cp.quickSwatchGap;
1484
+ const room = cp.swatchRoom;
1485
+ const strip = HGroup({ width: width, height: "auto", align: "left center", gap: gap, wrap: 1, color: "transparent" });
1486
+ strip.css = { padding: room + "px", boxSizing: "border-box" };
1487
+ strip.shrink = 0;
1488
+ endGroup();
1489
+
1490
+ const slotsInRow = Math.max(1, Math.floor((width - room * 2 + gap) / (size + gap)));
1491
+ const view = { obj: strip, value: "", squares: [], parts: [], enabled: 1, isOpen: 0 };
1492
+
1493
+ // The menu of a color (a right click, or the menu key): Copy to an editable group, Delete from its group.
1494
+ // (on the page, in the menu slot of the panel: a click outside or Escape closes it)
1495
+ // With comp/context-menu.js loaded it is a ContextMenu (its submenu), else the menu of the panel.
1496
+ const openQuickMenu = function (square, palette, value, event) {
1497
+ if (!view.enabled) return;
1498
+ if (typeof ContextMenu === "function") {
1499
+ openQuickContextMenu(ctrl, square, palette, value, event);
1500
+ return;
1501
+ }
1502
+ const isOpenByThisColor = (menu && menu.opener === square);
1503
+ closeMenu();
1504
+ if (isOpenByThisColor) return;
1505
+ const targets = copyTargetsOf(item, palette, value);
1506
+ const canDelete = canDeleteFrom(palette);
1507
+ if (!targets.length && !canDelete) return;
1508
+ createIn(page, function () {
1509
+ const menuBox = buildColorMenu({
1510
+ value: value,
1511
+ targets: targets,
1512
+ canDelete: canDelete,
1513
+ groupName: palette.name,
1514
+ onCopy: function (target) { addPaletteColor(ctrl, target, value); },
1515
+ onDelete: function () { deletePaletteColor(ctrl, palette, value); },
1516
+ close: closeMenu,
1517
+ });
1518
+ menuBox.zIndex = MENU_Z_INDEX;
1519
+ placeMenu(menuBox, square.elem.getBoundingClientRect(), COLOR_MENU_WIDTH);
1520
+ menu = { obj: menuBox, opener: square };
1521
+ });
1522
+ menu.obj.elem.querySelector("[role=menuitem]").focus({ preventScroll: true });
1523
+ };
1524
+
1525
+ // BOX: A color under the field
1526
+ const buildQuickSwatch = function (preset, palette) {
1527
+ const square = Box({ width: size, height: size, round: 3, color: "transparent" });
1528
+ square.shrink = 0;
1529
+ paintChecker(square, preset.color || preset.value);
1530
+ square.clickable = 1;
1531
+ square.cursor = "pointer";
1532
+ square.role = "button";
1533
+ square.tabIndex = 0;
1534
+ square.aria = { label: preset.hint || preset.value };
1535
+ square.elem.title = preset.hint || preset.value;
1536
+ square.css.transition = "transform 0.1s";
1537
+ onHover(square, function (isHover) { square.css.transform = (isHover && view.enabled) ? "scale(" + SWATCH_HOVER_SCALE + ")" : ""; });
1538
+ const pick = function () {
1539
+ if (view.enabled) onPick(preset.value);
1540
+ };
1541
+ square.on("click", pick);
1542
+ onActivateKey(square, pick);
1543
+ square.elem.addEventListener("contextmenu", function (event) {
1544
+ event.preventDefault();
1545
+ openQuickMenu(square, palette, preset.value, event);
1546
+ });
1547
+ square.on("keydown", function (self, event) {
1548
+ const isMenuKey = (event.key === "ContextMenu" || (event.key === "F10" && event.shiftKey));
1549
+ if (!isMenuKey) return;
1550
+ event.preventDefault();
1551
+ openQuickMenu(square, palette, preset.value, null);
1552
+ });
1553
+ square.presetValue = preset.value;
1554
+ view.squares.push(square);
1555
+ return square;
1556
+ };
1557
+
1558
+ // LABEL: "+N" (the hidden colors) or "Less"
1559
+ const buildMoreButton = function (text, label) {
1560
+ const btn = textLabel("", { width: size * MORE_BUTTON_SLOTS + gap, height: size, fontSize: _t.captionSize, textColor: _t.softColor, plainText: text });
1561
+ btn.round = 3;
1562
+ btn.clickable = 1;
1563
+ btn.cursor = "pointer";
1564
+ btn.role = "button";
1565
+ btn.tabIndex = 0;
1566
+ btn.aria = { label: label };
1567
+ btn.elem.title = label;
1568
+ onHover(btn, function (isHover) { btn.textColor = (isHover) ? _t.color : _t.softColor; });
1569
+ const toggle = function () {
1570
+ view.isOpen = (view.isOpen) ? 0 : 1;
1571
+ view.draw();
1572
+ };
1573
+ btn.on("click", toggle);
1574
+ onActivateKey(btn, toggle);
1575
+ return btn;
1576
+ };
1577
+
1578
+ view.draw = function () {
1579
+ view.parts.forEach(function (part) { part.remove(); });
1580
+ view.parts = [];
1581
+ view.squares = [];
1582
+ const recent = (quickColors.recent) ? recentColors : [];
1583
+ const palette = (quickColors.group) ? currentPaletteOf(item) : null;
1584
+ const groupColors = (palette) ? palette.colors : [];
1585
+ const hasLine = (recent.length && groupColors.length) ? 1 : 0;
1586
+ strip.visible = (!view.isHidden && (recent.length || groupColors.length)) ? 1 : 0;
1587
+
1588
+ // WHY the line counts as a color: it is simpler, and only a few px are lost
1589
+ const slotCount = recent.length + hasLine + groupColors.length;
1590
+ const maxSlots = slotsInRow * QUICK_ROWS;
1591
+ const isLong = (slotCount > maxSlots);
1592
+ const isCut = (isLong && !view.isOpen);
1593
+ const freeSlots = (isCut) ? maxSlots - MORE_BUTTON_SLOTS : slotCount;
1594
+ const shownRecent = recent.slice(0, freeSlots);
1595
+ const showLine = (hasLine && freeSlots > shownRecent.length);
1596
+ const shownGroup = groupColors.slice(0, Math.max(0, freeSlots - shownRecent.length - ((showLine) ? 1 : 0)));
1597
+ const hiddenCount = recent.length + groupColors.length - shownRecent.length - shownGroup.length;
1598
+
1599
+ createIn(strip, function () {
1600
+ shownRecent.forEach(function (value) {
1601
+ view.parts.push(buildQuickSwatch({ value: value, color: paintColorOf(item, value), hint: value + " (Recent)" }, RECENT_PALETTE));
1602
+ });
1603
+ // BOX: The line between the recent colors and the colors of the group
1604
+ if (showLine) {
1605
+ const line = Box({ width: 1, height: size, color: _ps.dividerColor });
1606
+ line.shrink = 0;
1607
+ line.clickable = 0;
1608
+ view.parts.push(line);
1609
+ }
1610
+ shownGroup.forEach(function (preset) {
1611
+ const hint = (preset.hint || preset.value) + " (" + palette.name + ")";
1612
+ view.parts.push(buildQuickSwatch({ value: preset.value, color: preset.color, hint: hint }, palette));
1613
+ });
1614
+ if (isCut) view.parts.push(buildMoreButton("+" + hiddenCount, "Show " + hiddenCount + " more colors"));
1615
+ else if (isLong) view.parts.push(buildMoreButton("Less", "Show two rows of colors"));
1616
+ });
1617
+ view.paint(view.value);
1618
+ };
1619
+
1620
+ view.paint = function (value) {
1621
+ view.value = value;
1622
+ view.squares.forEach(function (square) {
1623
+ paintSwatchRing(square, PropertyPanel.isSameValue(square.presetValue, value), _ps.color);
1624
+ });
1625
+ };
1626
+
1627
+ view.setEnabled = function (enabled) {
1628
+ view.enabled = enabled;
1629
+ strip.opacity = (enabled) ? 1 : 0.5;
1630
+ };
1631
+
1632
+ // isHidden: 1 -> not shown, whatever the ticks say (Ex: only under the field in use)
1633
+ view.setHidden = function (isHidden) {
1634
+ view.isHidden = (isHidden) ? 1 : 0;
1635
+ view.draw();
1636
+ };
1637
+
1638
+ quickStrips.push(view);
1639
+ view.draw();
1640
+ return view;
1641
+ };
1642
+
1067
1643
  // *** COLOR INPUTS: the color text and its opacity (%). Used by the color field and by the picker.
1068
1644
 
1069
1645
  // INPUT: Opacity (%), at the end of a field made by buildInputField.
@@ -1117,6 +1693,9 @@ const PropertyPanel = function (params = {}) {
1117
1693
  const formatBase = function (base, format) {
1118
1694
  if (format === "hex" || base.charAt(0) !== "#") return base;
1119
1695
  const rgb = readColor(base);
1696
+ // WHY: a "#" that is not a color (a typo: "#12345", "#") threw here in the rgb and hsl formats: the picker stayed
1697
+ // half drawn and the next color could not be typed. It is shown as it is.
1698
+ if (!rgb) return base;
1120
1699
  if (format === "rgb") return rgb.r + ", " + rgb.g + ", " + rgb.b;
1121
1700
  const hsl = rgbToHsl(rgb);
1122
1701
  return hsl.h + ", " + hsl.s + "%, " + hsl.l + "%";
@@ -1182,7 +1761,15 @@ const PropertyPanel = function (params = {}) {
1182
1761
  }
1183
1762
  });
1184
1763
 
1185
- alphaEl.addEventListener("blur", function () { commitAlpha(percentOfInput()); });
1764
+ // WHY the shown text: the % field wrote the value at every blur, also with no change (and after Escape):
1765
+ // "transparent" became "rgba(0, 0, 0, 0)", "rgb(55, 56, 54)" "#373836", and basic.js Designer got a change
1766
+ // the user did not make. The number field has the same check.
1767
+ alphaEl.addEventListener("blur", function () {
1768
+ const parts = splitAlpha(api.getValue());
1769
+ const shownText = (parts.base) ? Math.round(parts.alpha * 100) + "%" : "";
1770
+ if (String(alphaInput.text).trim() === shownText) return;
1771
+ commitAlpha(percentOfInput());
1772
+ });
1186
1773
  alphaEl.addEventListener("keydown", function (event) {
1187
1774
  const isArrow = (event.key === "ArrowUp" || event.key === "ArrowDown");
1188
1775
  if (isArrow) {
@@ -1222,7 +1809,8 @@ const PropertyPanel = function (params = {}) {
1222
1809
  const hint = item.hint || item.label || item.key;
1223
1810
  const contentWidth = cp.width - cp.padding * 2;
1224
1811
  const hasScreenDropper = (typeof window.EyeDropper === "function");
1225
- const hasEyeDropper = hasScreenDropper || (typeof box.pickColor === "function");
1812
+ const hasPageDropper = (typeof box.pickColor === "function" && !colorField.noPagePick);
1813
+ const hasEyeDropper = hasScreenDropper || hasPageDropper;
1226
1814
  const sliderWidth = contentWidth - ((hasEyeDropper) ? _g.itemHeight + _g.gap : 0);
1227
1815
  let palettes = palettesOf(item, 1);
1228
1816
  let isPaletteListOpen = 0;
@@ -1240,6 +1828,8 @@ const PropertyPanel = function (params = {}) {
1240
1828
  let formatButton = null;
1241
1829
  let previewNow = null;
1242
1830
  let recentViews = [];
1831
+ let recentArea = null;
1832
+ const TICK_MARGIN = cp.swatchRoom; // WHY: the ticks start where the colors start
1243
1833
  const valueAtOpen = colorField.getValue();
1244
1834
 
1245
1835
  // STATE <-> VALUE
@@ -1303,8 +1893,7 @@ const PropertyPanel = function (params = {}) {
1303
1893
  const paintSelectedSwatch = function () {
1304
1894
  const value = colorField.getValue();
1305
1895
  swatchViews.concat(recentViews).forEach(function (view) {
1306
- const isSelected = PropertyPanel.isSameValue(view.value, value);
1307
- view.obj.boxShadow = (isSelected) ? "0 0 0 2px " + ms.color + ", 0 0 0 3px " + _s.accent.color : "inset 0 0 0 1px " + _s.swatch.borderColor;
1896
+ paintSwatchRing(view.obj, PropertyPanel.isSameValue(view.value, value), ms.color);
1308
1897
  });
1309
1898
  };
1310
1899
 
@@ -1364,8 +1953,14 @@ const PropertyPanel = function (params = {}) {
1364
1953
  };
1365
1954
 
1366
1955
  const buildPaletteHeader = function (palette) {
1367
- // GROUP: The name of the palette (opens the list of palettes) and the add button
1956
+ // GROUP: The tick (the colors under the fields), the name of the palette (opens the list of palettes) and the add button
1368
1957
  HGroup({ width: contentWidth, height: _g.itemHeight, align: "left center", gap: 4, color: "transparent" });
1958
+ const tick = buildTick(quickColors.group, "Show the colors of the selected group under the color fields", function (isOn) {
1959
+ quickColors.group = isOn;
1960
+ saveQuickColors();
1961
+ refreshQuickStrips();
1962
+ });
1963
+ tick.css.marginLeft = TICK_MARGIN + "px";
1369
1964
  const btnList = HGroup({ width: 10, height: _g.itemHeight, align: "left center", gap: 2, padding: [6, 0], round: _s.field.round, color: "transparent" });
1370
1965
  btnList.grow = 1;
1371
1966
  btnList.css = { minWidth: "0px" };
@@ -1396,8 +1991,8 @@ const PropertyPanel = function (params = {}) {
1396
1991
  btnAdd.aria = { label: "Add this color to " + palette.name };
1397
1992
  btnAdd.elem.title = "Add this color to " + palette.name;
1398
1993
  onHover(btnAdd, function (isHover) { btnAdd.color = (isHover) ? _s.button.hoverColor : "transparent"; });
1399
- btnAdd.on("click", function () { addColorTo(palette); });
1400
- onActivateKey(btnAdd, function () { addColorTo(palette); });
1994
+ btnAdd.on("click", function () { addColorTo(palette, colorField.getValue()); });
1995
+ onActivateKey(btnAdd, function () { addColorTo(palette, colorField.getValue()); });
1401
1996
  }
1402
1997
  endGroup();
1403
1998
  };
@@ -1421,7 +2016,9 @@ const PropertyPanel = function (params = {}) {
1421
2016
  const choose = function () {
1422
2017
  lastPaletteKey = palette.key;
1423
2018
  isPaletteListOpen = 0;
2019
+ saveQuickColors();
1424
2020
  drawPaletteArea();
2021
+ if (quickColors.group) refreshQuickStrips(); // WHY: the tick goes with the selected group
1425
2022
  };
1426
2023
  onHover(row, function (isHover) { row.color = (isHover) ? _s.button.hoverColor : "transparent"; });
1427
2024
  row.on("click", choose);
@@ -1429,8 +2026,10 @@ const PropertyPanel = function (params = {}) {
1429
2026
  });
1430
2027
  };
1431
2028
 
1432
- // BOX: A color of a palette. A click gives its value. Returns { obj, value } (for the selected ring).
1433
- const buildSwatch = function (preset) {
2029
+ // BOX: A color of a palette. A click gives its value; a right click opens its menu (Copy to, Delete);
2030
+ // in an editable group (canAdd) it is dragged to another place. Returns { obj, value, fixed } (for the selected ring).
2031
+ // palette: its group (RECENT_PALETTE for the recent colors). grid: the group of the colors (to drag in it).
2032
+ const buildSwatch = function (preset, palette, grid) {
1434
2033
  const square = Box({ width: cp.swatchSize, height: cp.swatchSize, round: 4, color: "transparent" });
1435
2034
  square.shrink = 0;
1436
2035
  paintChecker(square, preset.color || preset.value);
@@ -1441,24 +2040,189 @@ const PropertyPanel = function (params = {}) {
1441
2040
  square.aria = { label: preset.hint || preset.value };
1442
2041
  square.elem.title = preset.hint || preset.value;
1443
2042
  square.css.transition = "transform 0.1s";
1444
- onHover(square, function (isHover) { square.css.transform = (isHover) ? "scale(1.12)" : ""; });
1445
- square.on("click", function () { commitValue(preset.value); });
2043
+ onHover(square, function (isHover) { square.css.transform = (isHover) ? "scale(" + SWATCH_HOVER_SCALE + ")" : ""; });
2044
+ const view = { obj: square, value: preset.value, fixed: preset.fixed };
2045
+ square.on("click", function () {
2046
+ if (square.wasDragged) return; // WHY: the end of a drag is not a click
2047
+ commitValue(preset.value);
2048
+ });
1446
2049
  onActivateKey(square, function () { commitValue(preset.value); });
1447
- return { obj: square, value: preset.value };
2050
+ square.elem.addEventListener("contextmenu", function (event) {
2051
+ event.preventDefault();
2052
+ openColorMenu(view, palette, event);
2053
+ });
2054
+ square.on("keydown", function (self, event) {
2055
+ const isMenuKey = (event.key === "ContextMenu" || (event.key === "F10" && event.shiftKey));
2056
+ if (!isMenuKey) return;
2057
+ event.preventDefault();
2058
+ openColorMenu(view, palette, null);
2059
+ });
2060
+ const canMove = (grid && palette.canAdd && !preset.fixed);
2061
+ if (canMove) dragToOrder(view, palette, grid);
2062
+ return view;
1448
2063
  };
1449
2064
 
1450
- // GROUP: The recent colors (only when there are some)
1451
- const buildRecentColors = function () {
1452
- if (!recentColors.length) return;
1453
- const caption = textLabel("", { fontSize: _t.captionSize, textColor: _t.softColor, plainText: "Recent" });
1454
- caption.css.paddingLeft = "6px";
1455
- const row = HGroup({ width: contentWidth, height: "auto", align: "left center", gap: cp.swatchGap, color: "transparent" });
1456
- row.css = { padding: "3px", boxSizing: "border-box" };
1457
- row.clipContent = 0;
1458
- recentViews = recentColors.map(function (value) {
1459
- return buildSwatch({ value: value, color: paintColorOf(item, value), hint: value });
2065
+ // *** THE MENU OF A COLOR (a right click): in the picker, so a click in it does not close the picker.
2066
+
2067
+ const COLOR_MENU_MARGIN = 4; // It stays this far from the edges of the picker
2068
+ let colorMenu = null;
2069
+
2070
+ const closeColorMenu = function () {
2071
+ if (!colorMenu) return;
2072
+ colorMenu.remove();
2073
+ colorMenu = null;
2074
+ };
2075
+
2076
+ // event: the right click (the menu at the mouse), or null (at the color: the keyboard)
2077
+ const openColorMenu = function (view, palette, event) {
2078
+ closeColorMenu();
2079
+ const targets = copyTargetsOf(item, palette, view.value);
2080
+ const canDelete = canDeleteFrom(palette);
2081
+ if (!targets.length && !canDelete) return;
2082
+
2083
+ colorMenu = createIn(obj, function () {
2084
+ const menuBox = buildColorMenu({
2085
+ value: view.value,
2086
+ targets: targets,
2087
+ canDelete: canDelete,
2088
+ groupName: palette.name,
2089
+ onCopy: function (target) { addColorTo(target, view.value); },
2090
+ onDelete: function () { deleteColor(view, palette); },
2091
+ close: closeColorMenu,
1460
2092
  });
1461
- endGroup();
2093
+ menuBox.zIndex = 1;
2094
+ return menuBox;
2095
+ });
2096
+
2097
+ // Escape closes only this menu (not the picker) and the focus goes back to the color.
2098
+ colorMenu.on("keydown", function (self, event) {
2099
+ if (event.key !== "Escape") return;
2100
+ event.stopPropagation();
2101
+ closeColorMenu();
2102
+ view.obj.elem.focus();
2103
+ });
2104
+
2105
+ const pickerRect = obj.elem.getBoundingClientRect();
2106
+ const squareRect = view.obj.elem.getBoundingClientRect();
2107
+ const x = (event) ? event.clientX : squareRect.left;
2108
+ const y = (event) ? event.clientY : squareRect.bottom;
2109
+ const maxLeft = pickerRect.width - COLOR_MENU_WIDTH - COLOR_MENU_MARGIN;
2110
+ const maxTop = pickerRect.height - colorMenu.elem.offsetHeight - COLOR_MENU_MARGIN;
2111
+ colorMenu.left = Math.round(basic.clamp(x - pickerRect.left, COLOR_MENU_MARGIN, maxLeft));
2112
+ colorMenu.top = Math.round(Math.max(COLOR_MENU_MARGIN, Math.min(y - pickerRect.top, maxTop)));
2113
+ const firstRow = colorMenu.elem.querySelector("[role=menuitem]");
2114
+ if (firstRow) firstRow.focus({ preventScroll: true });
2115
+ };
2116
+
2117
+ // *** CHANGES OF THE GROUPS (the picker draws its groups again after each one)
2118
+
2119
+ const afterGroupChange = function () {
2120
+ palettes = palettesOf(item);
2121
+ drawRecentArea();
2122
+ drawPaletteArea();
2123
+ };
2124
+
2125
+ const addColorTo = function (palette, value) {
2126
+ addPaletteColor(ctrl, palette, value);
2127
+ afterGroupChange();
2128
+ };
2129
+
2130
+ const deleteColor = function (view, palette) {
2131
+ deletePaletteColor(ctrl, palette, view.value);
2132
+ afterGroupChange();
2133
+ };
2134
+
2135
+ // The values of the colors in the order of the grid (after a drag).
2136
+ const sendOrder = function (palette, grid) {
2137
+ const values = [];
2138
+ Array.prototype.forEach.call(grid.elem.children, function (elem) {
2139
+ const view = swatchViews.find(function (v) { return v.obj.elem === elem; });
2140
+ if (view) values.push(view.value);
2141
+ });
2142
+ const isSameOrder = values.every(function (value, index) { return PropertyPanel.isSameValue(value, palette.colors[index].value); });
2143
+ if (isSameOrder) return;
2144
+ orderPaletteColors(ctrl, palette, values);
2145
+ afterGroupChange();
2146
+ };
2147
+
2148
+ // DRAG: a color of an editable group goes before or after the color under the mouse (not a fixed one).
2149
+ // It starts after a small move, so a click is still a click.
2150
+ const DRAG_START_DISTANCE = 4;
2151
+ const dragToOrder = function (view, palette, grid) {
2152
+ const square = view.obj;
2153
+ const moveTo = function (x, y) {
2154
+ const target = swatchViews.find(function (v) {
2155
+ if (v === view || v.fixed) return false;
2156
+ const rect = v.obj.elem.getBoundingClientRect();
2157
+ return (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom);
2158
+ });
2159
+ if (!target) return;
2160
+ const rect = target.obj.elem.getBoundingClientRect();
2161
+ const isBefore = (x < rect.left + rect.width / 2);
2162
+ grid.elem.insertBefore(square.elem, (isBefore) ? target.obj.elem : target.obj.elem.nextSibling);
2163
+ };
2164
+ // WHY window, not setPointerCapture: moving the square in the grid (insertBefore) loses the capture,
2165
+ // and its pointerup never came (found with a real drag)
2166
+ square.elem.addEventListener("pointerdown", function (event) {
2167
+ if (event.button !== 0) return;
2168
+ const startX = event.clientX;
2169
+ const startY = event.clientY;
2170
+ let isDragging = 0;
2171
+ const onMove = function (moveEvent) {
2172
+ const distance = Math.abs(moveEvent.clientX - startX) + Math.abs(moveEvent.clientY - startY);
2173
+ if (!isDragging && distance < DRAG_START_DISTANCE) return;
2174
+ if (!isDragging) {
2175
+ isDragging = 1;
2176
+ square.opacity = 0.5;
2177
+ square.cursor = "grabbing";
2178
+ closeColorMenu();
2179
+ }
2180
+ moveTo(moveEvent.clientX, moveEvent.clientY);
2181
+ };
2182
+ const onUp = function () {
2183
+ window.removeEventListener("pointermove", onMove);
2184
+ window.removeEventListener("pointerup", onUp);
2185
+ window.removeEventListener("pointercancel", onUp);
2186
+ if (!isDragging || square._isRemoved) return; // (the picker was closed while dragging)
2187
+ square.opacity = 1;
2188
+ square.cursor = "pointer";
2189
+ square.wasDragged = 1;
2190
+ square.after(0, function () { square.wasDragged = 0; }); // WHY: after the click of this pointerup
2191
+ sendOrder(palette, grid);
2192
+ };
2193
+ window.addEventListener("pointermove", onMove);
2194
+ window.addEventListener("pointerup", onUp);
2195
+ window.addEventListener("pointercancel", onUp);
2196
+ });
2197
+ };
2198
+
2199
+ // GROUP: The recent colors with their tick (hidden when there are none). Drawn again after a delete.
2200
+ const drawRecentArea = function () {
2201
+ (recentArea.parts || []).forEach(function (part) { part.remove(); });
2202
+ recentViews = [];
2203
+ recentArea.visible = (recentColors.length) ? 1 : 0;
2204
+ if (!recentColors.length) return;
2205
+ recentArea.parts = createIn(recentArea, function () {
2206
+ // GROUP: The tick and the caption
2207
+ const head = HGroup({ width: contentWidth, height: TICK_SIZE + 2, align: "left center", gap: 6, color: "transparent" });
2208
+ const tick = buildTick(quickColors.recent, "Show the recent colors under the color fields", function (isOn) {
2209
+ quickColors.recent = isOn;
2210
+ saveQuickColors();
2211
+ refreshQuickStrips();
2212
+ });
2213
+ tick.css.marginLeft = TICK_MARGIN + "px";
2214
+ textLabel("", { fontSize: _t.captionSize, textColor: _t.softColor, plainText: "Recent" });
2215
+ endGroup();
2216
+ const row = HGroup({ width: contentWidth, height: "auto", align: "left center", gap: cp.swatchGap, color: "transparent" });
2217
+ row.css = { padding: cp.swatchRoom + "px", boxSizing: "border-box" };
2218
+ row.clipContent = 0;
2219
+ recentViews = recentColors.map(function (value) {
2220
+ return buildSwatch({ value: value, color: paintColorOf(item, value), hint: value }, RECENT_PALETTE, null);
2221
+ });
2222
+ endGroup();
2223
+ return [head, row];
2224
+ });
2225
+ paintSelectedSwatch();
1462
2226
  };
1463
2227
 
1464
2228
  const buildSwatches = function (palette) {
@@ -1466,56 +2230,44 @@ const PropertyPanel = function (params = {}) {
1466
2230
  if (!palette.colors.length) {
1467
2231
  const lblEmpty = textLabel("", { textColor: _t.softColor, plainText: palette.emptyText || "No colors yet." });
1468
2232
  lblEmpty.css = { whiteSpace: "normal", lineHeight: "16px", padding: "2px 6px" };
1469
- return;
2233
+ return null;
1470
2234
  }
1471
2235
  // GROUP: The colors of the palette (scrolls when there are many)
2236
+ // WHY the padding: the scroll cuts what goes out of the grid (the selected ring, the hover growth).
1472
2237
  const grid = HGroup({ width: contentWidth, height: "auto", align: "left top", gap: cp.swatchGap, wrap: 1, color: "transparent" });
1473
- grid.css = { maxHeight: cp.swatchesMaxHeight + "px", padding: "3px", boxSizing: "border-box" };
2238
+ grid.css = { maxHeight: cp.swatchesMaxHeight + "px", padding: cp.swatchRoom + "px", boxSizing: "border-box" };
1474
2239
  grid.scrollY = 1; // (also clickable)
1475
2240
  palette.colors.forEach(function (preset) {
1476
- swatchViews.push(buildSwatch(preset));
2241
+ swatchViews.push(buildSwatch(preset, palette, grid));
1477
2242
  });
1478
2243
  endGroup();
2244
+ return grid;
1479
2245
  };
1480
2246
 
1481
- // The palette part is drawn again when an other palette is chosen or a color is added.
2247
+ // The palette part is drawn again when an other palette is chosen or its colors change.
2248
+ // The scroll of the colors stays when it is the same palette (Ex: after a drag or a delete).
1482
2249
  const drawPaletteArea = function () {
1483
- if (paletteArea) paletteArea.remove();
2250
+ closeColorMenu();
1484
2251
  const current = palettes.find(function (p) { return p.key === lastPaletteKey; }) || palettes[0];
2252
+ const isSamePalette = (paletteArea && current && paletteArea.paletteKey === current.key && paletteArea.grid);
2253
+ const keptScroll = (isSamePalette) ? paletteArea.grid.elem.scrollTop : 0;
2254
+ if (paletteArea) paletteArea.remove();
1485
2255
  paletteArea = createIn(obj, function () {
1486
2256
  // GROUP: Palettes
1487
2257
  const group = VGroup({ width: contentWidth, height: "auto", align: "left top", gap: 6, color: "transparent" });
1488
2258
  group.shrink = 0;
1489
2259
  buildPaletteHeader(current);
1490
2260
  if (isPaletteListOpen) buildPaletteList(current);
1491
- else if (current) buildSwatches(current);
2261
+ else if (current) group.grid = buildSwatches(current);
1492
2262
  endGroup();
1493
2263
  return group;
1494
2264
  });
2265
+ paletteArea.paletteKey = (current) ? current.key : "";
2266
+ if (paletteArea.grid) paletteArea.grid.elem.scrollTop = keptScroll;
1495
2267
  paintSelectedSwatch();
1496
2268
  placePicker();
1497
2269
  };
1498
2270
 
1499
- const addColorTo = function (palette) {
1500
- const value = colorField.getValue();
1501
- if (!value) return;
1502
- const isThere = palette.colors.some(function (preset) { return PropertyPanel.isSameValue(preset.value, value); });
1503
- if (!isThere) {
1504
- dispatch({ kind: "addColor", key: palette.key, value: value, oldValue: undefined, item: item, sectionKey: ctrl.sectionKey });
1505
- }
1506
- palettes = palettesOf(item, 1);
1507
- const fresh = palettes.find(function (p) { return p.key === palette.key; });
1508
- // WHY: A static palette (not a function) is not changed by the listener: the panel adds it.
1509
- if (fresh && !fresh.colors.some(function (preset) { return PropertyPanel.isSameValue(preset.value, value); })) {
1510
- const shared = (paletteCache || []).find(function (p) { return p.key === palette.key; });
1511
- if (shared) {
1512
- shared.colors = (shared.colors || []).concat([value]);
1513
- palettes = palettesOf(item);
1514
- }
1515
- }
1516
- drawPaletteArea();
1517
- };
1518
-
1519
2271
  // GROUP: The color before the picker opened (a click goes back to it) and the color now.
1520
2272
  const PREVIEW_WIDTH = 32;
1521
2273
  const buildPreview = function () {
@@ -1556,21 +2308,64 @@ const PropertyPanel = function (params = {}) {
1556
2308
  return btn;
1557
2309
  };
1558
2310
 
1559
- // At the left of the panel, at the height of the field. Under the field when there is no space at the left.
2311
+ // WHY read once: a color outside of the panel may have a field that is drawn again while the picker is open.
2312
+ const fieldRect = colorField.rect || colorField.anchor.elem.getBoundingClientRect();
2313
+ const besideRect = colorField.besideRect || box.elem.getBoundingClientRect();
2314
+ let movedPlace = (colorField.besideRect) ? null : movedPickerPlace;
2315
+
2316
+ // At the left of the panel (or of besideRect), at the height of the field. Under the field when there is no
2317
+ // space at the left. A picker moved by its title stays where it was left.
1560
2318
  const placePicker = function () {
1561
- const fieldRect = colorField.anchor.elem.getBoundingClientRect();
1562
- const panelRect = box.elem.getBoundingClientRect();
1563
2319
  const height = obj.elem.offsetHeight;
1564
- let left = panelRect.left - cp.width - PICKER_SPACE;
2320
+ let left = besideRect.left - cp.width - PICKER_SPACE;
1565
2321
  let top = fieldRect.top;
1566
2322
  if (left < SCREEN_MARGIN) {
1567
2323
  left = Math.min(fieldRect.left, window.innerWidth - cp.width - SCREEN_MARGIN);
1568
2324
  top = fieldRect.bottom + MENU_OFFSET;
1569
2325
  }
2326
+ if (movedPlace) {
2327
+ left = Math.min(movedPlace.left, window.innerWidth - cp.width - SCREEN_MARGIN);
2328
+ top = movedPlace.top;
2329
+ }
1570
2330
  obj.left = Math.max(SCREEN_MARGIN, left);
1571
2331
  obj.top = Math.max(SCREEN_MARGIN, Math.min(top, window.innerHeight - height - SCREEN_MARGIN));
1572
2332
  };
1573
2333
 
2334
+ const keepMovedPlace = function (place) {
2335
+ movedPlace = place;
2336
+ if (!colorField.besideRect) movedPickerPlace = place;
2337
+ };
2338
+
2339
+ // DRAG: the title moves the picker, so it does not cover the object that is being colored.
2340
+ const moveByTitle = function (title) {
2341
+ title.clickable = 1;
2342
+ title.cursor = "move";
2343
+ title.elem.title = "Drag to move · Double click: back to its place";
2344
+ title.elem.addEventListener("pointerdown", function (event) {
2345
+ if (event.button !== 0 || event.target !== title.elem) return;
2346
+ event.preventDefault();
2347
+ const startX = event.clientX - obj.elem.getBoundingClientRect().left;
2348
+ const startY = event.clientY - obj.elem.getBoundingClientRect().top;
2349
+ const onMove = function (moveEvent) {
2350
+ keepMovedPlace({ left: moveEvent.clientX - startX, top: moveEvent.clientY - startY });
2351
+ placePicker();
2352
+ };
2353
+ const onUp = function () {
2354
+ window.removeEventListener("pointermove", onMove);
2355
+ window.removeEventListener("pointerup", onUp);
2356
+ window.removeEventListener("pointercancel", onUp);
2357
+ };
2358
+ window.addEventListener("pointermove", onMove);
2359
+ window.addEventListener("pointerup", onUp);
2360
+ window.addEventListener("pointercancel", onUp);
2361
+ });
2362
+ title.elem.addEventListener("dblclick", function (event) {
2363
+ if (event.target !== title.elem) return;
2364
+ keepMovedPlace(null);
2365
+ placePicker();
2366
+ });
2367
+ };
2368
+
1574
2369
  createIn(page, function () {
1575
2370
 
1576
2371
  // GROUP: Color picker
@@ -1584,7 +2379,7 @@ const PropertyPanel = function (params = {}) {
1584
2379
  obj.aria = { label: hint + " color" };
1585
2380
 
1586
2381
  // GROUP: Title and close
1587
- HGroup({ width: contentWidth, height: _g.itemHeight, align: "left center", gap: 4, color: "transparent" });
2382
+ const pickerTitle = HGroup({ width: contentWidth, height: _g.itemHeight, align: "left center", gap: 4, color: "transparent" });
1588
2383
  textLabel("", { flex: 1, bold: 1, plainText: hint });
1589
2384
  const btnClose = textLabel(getIcon("close", 14), { width: _g.itemHeight, height: _g.itemHeight, textColor: _t.softColor });
1590
2385
  btnClose.round = _s.field.round;
@@ -1598,6 +2393,7 @@ const PropertyPanel = function (params = {}) {
1598
2393
  btnClose.on("click", closeMenu);
1599
2394
  onActivateKey(btnClose, closeMenu);
1600
2395
  endGroup();
2396
+ moveByTitle(pickerTitle);
1601
2397
 
1602
2398
  // BOX: Saturation (left to right) and brightness (bottom to top) of the hue
1603
2399
  area = startBox({ width: contentWidth, height: cp.areaHeight, round: 4, color: "transparent" });
@@ -1637,9 +2433,15 @@ const PropertyPanel = function (params = {}) {
1637
2433
  const ctrlAtPick = controllers[key];
1638
2434
  closeMenu();
1639
2435
  box.pickColor(box, function (color) {
2436
+ if (!box || !color) return;
2437
+ const pickedValue = joinAlpha(String(color).toUpperCase(), keptAlpha);
2438
+ if (colorField.isOutside) {
2439
+ colorField.commit(pickedValue);
2440
+ return;
2441
+ }
1640
2442
  // WHY the same ctrl: setData() while picking (another selection) makes new items with the same keys
1641
- if (!box || !color || controllers[key] !== ctrlAtPick) return;
1642
- box.setValue(key, joinAlpha(String(color).toUpperCase(), keptAlpha));
2443
+ if (controllers[key] !== ctrlAtPick) return;
2444
+ box.setValue(key, pickedValue);
1643
2445
  });
1644
2446
  };
1645
2447
  const pickFromScreen = function () {
@@ -1675,7 +2477,11 @@ const PropertyPanel = function (params = {}) {
1675
2477
  inputs.field.elem.insertBefore(formatButton.elem, inputs.field.elem.firstChild);
1676
2478
  endGroup();
1677
2479
 
1678
- buildRecentColors();
2480
+ // GROUP: The recent colors (drawn by drawRecentArea)
2481
+ recentArea = VGroup({ width: contentWidth, height: "auto", align: "left top", gap: 6, color: "transparent" });
2482
+ recentArea.shrink = 0;
2483
+ recentArea.clipContent = 0;
2484
+ endGroup();
1679
2485
 
1680
2486
  // BOX: Line
1681
2487
  const line = Box({ width: contentWidth, height: 1, color: ms.borderColor });
@@ -1689,16 +2495,27 @@ const PropertyPanel = function (params = {}) {
1689
2495
  obj: obj,
1690
2496
  opener: colorField.opener,
1691
2497
  ctrl: ctrl,
2498
+ colorField: colorField,
1692
2499
  sync: function () {
1693
2500
  readState();
1694
2501
  paintPicker();
1695
2502
  },
1696
2503
  onClose: function () {
2504
+ colorMenu = null; // (removed with the picker)
1697
2505
  const value = colorField.getValue();
1698
- if (value !== valueAtOpen) rememberColor(value);
2506
+ if (value !== valueAtOpen) {
2507
+ rememberColor(value);
2508
+ if (quickColors.recent) refreshQuickStrips();
2509
+ }
2510
+ if (colorField.onClose) colorField.onClose();
1699
2511
  },
1700
2512
  };
1701
2513
 
2514
+ // WHY capture: a click anywhere else in the picker (a color too) closes the menu of a color first.
2515
+ obj.elem.addEventListener("pointerdown", function (event) {
2516
+ if (colorMenu && !colorMenu.elem.contains(event.target)) closeColorMenu();
2517
+ }, true);
2518
+
1702
2519
  dragOn(area, function (x, y) {
1703
2520
  hsv.s = x;
1704
2521
  hsv.v = 1 - y;
@@ -1734,6 +2551,7 @@ const PropertyPanel = function (params = {}) {
1734
2551
  });
1735
2552
 
1736
2553
  readState();
2554
+ drawRecentArea();
1737
2555
  paintPicker();
1738
2556
  drawPaletteArea();
1739
2557
  area.elem.focus({ preventScroll: true });
@@ -1775,6 +2593,7 @@ const PropertyPanel = function (params = {}) {
1775
2593
  paintChecker(swatchArea.fill, paintColorOf(item, value));
1776
2594
  setBorder(swatchArea.fill, (isEmpty) ? sw.emptyColor : sw.borderColor);
1777
2595
  showColorInputs(input, alphaInput, value);
2596
+ strip.paint(value);
1778
2597
  };
1779
2598
 
1780
2599
  const setValue = function (v) {
@@ -1789,6 +2608,11 @@ const PropertyPanel = function (params = {}) {
1789
2608
  changeValue(ctrl, value);
1790
2609
  };
1791
2610
 
2611
+ // GROUP: The quick colors under the field (the ticks of the picker)
2612
+ const strip = buildQuickStrip(ctrl, getSpanWidth(item.span), function (pickedValue) {
2613
+ if (state.enabled) commit(pickedValue);
2614
+ });
2615
+
1792
2616
  const colorField = {
1793
2617
  anchor: field,
1794
2618
  opener: swatchArea,
@@ -1817,6 +2641,7 @@ const PropertyPanel = function (params = {}) {
1817
2641
  alphaInput.inputElement.disabled = !enabled;
1818
2642
  alphaInput.inputElement.style.color = ink(enabled, _t.color);
1819
2643
  swatchArea.opacity = (enabled) ? 1 : 0.5;
2644
+ strip.setEnabled(enabled);
1820
2645
  },
1821
2646
  };
1822
2647
 
@@ -1916,7 +2741,7 @@ const PropertyPanel = function (params = {}) {
1916
2741
 
1917
2742
  text: function (ctrl) {
1918
2743
  const item = ctrl.item;
1919
- const { field, input, el, setEnabled } = buildInputField(item, getSpanWidth(item.span));
2744
+ const { field, input, el, button, state, setEnabled } = buildInputField(item, getSpanWidth(item.span));
1920
2745
  if (item.placeholder) input.placeholder = item.placeholder;
1921
2746
  const setValue = function (v) { input.text = (v === undefined || v === null) ? "" : String(v); };
1922
2747
  el.addEventListener("blur", function () { changeValue(ctrl, String(input.text)); });
@@ -1928,8 +2753,17 @@ const PropertyPanel = function (params = {}) {
1928
2753
  event.preventDefault();
1929
2754
  setValue(ctrl.item.value);
1930
2755
  el.blur();
2756
+ } else if (button && event.altKey && event.key === "ArrowDown") {
2757
+ event.preventDefault();
2758
+ el.blur(); // WHY: the text written so far is kept first, the editor opens with it.
2759
+ sendFieldButton(ctrl);
1931
2760
  }
1932
2761
  });
2762
+ if (button) {
2763
+ button.on("click", function () {
2764
+ if (state.enabled) sendFieldButton(ctrl);
2765
+ });
2766
+ }
1933
2767
  setValue(item.value);
1934
2768
  return { field: field, setValue: setValue, setEnabled: setEnabled };
1935
2769
  },
@@ -2025,6 +2859,7 @@ const PropertyPanel = function (params = {}) {
2025
2859
  round: _s.field.round,
2026
2860
  });
2027
2861
  group.shrink = 0;
2862
+ if (isSelect) setBorder(group, _s.field.borderColor || "");
2028
2863
  group.role = (isSelect) ? "radiogroup" : "group";
2029
2864
  group.aria = { label: item.hint || item.label || item.key };
2030
2865
 
@@ -2270,7 +3105,16 @@ const PropertyPanel = function (params = {}) {
2270
3105
  const buildTitleRow = function (text, actions, sectionKey, isMainTitle) {
2271
3106
  let lbl = null;
2272
3107
  HGroup({ width: "100%", height: (isMainTitle) ? 32 : 24, align: "left center", gap: 2, color: "transparent" });
2273
- lbl = textLabel("", { fontSize: (isMainTitle) ? _t.titleSize : _t.sectionTitleSize, bold: 1, flex: 1, height: 24, plainText: text || "" });
3108
+ const st = _s.sectionTitle;
3109
+ lbl = textLabel("", {
3110
+ fontSize: (isMainTitle) ? _t.titleSize : _t.sectionTitleSize,
3111
+ textColor: (isMainTitle) ? _t.color : (st.textColor || _t.color),
3112
+ bold: 1,
3113
+ flex: 1,
3114
+ height: 24,
3115
+ plainText: text || "",
3116
+ });
3117
+ if (!isMainTitle && st.uppercase) lbl.css = { textTransform: "uppercase", letterSpacing: st.letterSpacing + "px" };
2274
3118
  (actions || []).forEach(function (action) {
2275
3119
  applyVisible(registerItem(Object.assign({ type: "iconButton", accent: 0 }, action), sectionKey));
2276
3120
  });
@@ -2288,6 +3132,7 @@ const PropertyPanel = function (params = {}) {
2288
3132
  boxSizing: "border-box",
2289
3133
  borderBottom: "1px solid " + _ps.dividerColor,
2290
3134
  };
3135
+ if (section.mark) group.boxShadow = "inset " + _ps.markWidth + "px 0 0 " + Alpha(_s.accent.color, _ps.markOpacity);
2291
3136
 
2292
3137
  // WHY: A section without a title and actions (Ex: a footer with a note) gets no empty title row.
2293
3138
  const hasTitleRow = isTitleBlock || !!section.title || (section.actions && section.actions.length > 0);
@@ -2312,8 +3157,10 @@ const PropertyPanel = function (params = {}) {
2312
3157
 
2313
3158
  const paintTab = function (key) {
2314
3159
  const isActive = (key === box.data.activeTab);
3160
+ const isPill = (_s.tab.look === "pill");
2315
3161
  const lbl = tabLabels[key];
2316
- lbl.color = (isActive) ? _s.field.color : "transparent";
3162
+ lbl.color = (isActive && isPill) ? _s.field.color : "transparent";
3163
+ lbl.boxShadow = (isActive && !isPill) ? "inset 0 -2px 0 " + _s.accent.color : "none";
2317
3164
  lbl.textColor = (isActive) ? _t.color : _t.softColor;
2318
3165
  lbl.bold = isActive;
2319
3166
  lbl.aria = { selected: (isActive) ? "true" : "false" };
@@ -2343,8 +3190,10 @@ const PropertyPanel = function (params = {}) {
2343
3190
 
2344
3191
  (data.tabs || []).forEach(function (tab) {
2345
3192
  // LABEL: Tab
2346
- const lbl = textLabel("", { height: 28, plainText: tab.text || tab.key });
2347
- lbl.round = _s.field.round;
3193
+ // WHY as high as the header (underline): its line lies on the line under the header
3194
+ const isPill = (_s.tab.look === "pill");
3195
+ const lbl = textLabel("", { height: (isPill) ? 28 : "100%", plainText: tab.text || tab.key });
3196
+ if (isPill) lbl.round = _s.field.round;
2348
3197
  lbl.clickable = 1;
2349
3198
  lbl.cursor = "pointer";
2350
3199
  lbl.css = { padding: "0px 10px", outline: "none" };
@@ -2487,6 +3336,8 @@ const PropertyPanel = function (params = {}) {
2487
3336
  closeMenu();
2488
3337
  paletteCache = null;
2489
3338
  controllers = {};
3339
+ // WHY: the strips of the items go with them; the ones of buildColorStrip() live outside of the panel.
3340
+ quickStrips = quickStrips.filter(function (strip) { return strip.isOutside; });
2490
3341
  box.data = PropertyPanel.copyData(data || {});
2491
3342
  buildHeader();
2492
3343
  buildContent();
@@ -2529,6 +3380,51 @@ const PropertyPanel = function (params = {}) {
2529
3380
  };
2530
3381
  // USAGE: panel.setValue("x", 120, 1)
2531
3382
 
3383
+ // The color picker for a color that is not an item of the panel. request:
3384
+ // { key, hint (its title), value, commit(value), onClose(), opener (an object: a click on it does not close the
3385
+ // picker, and opening it again from there closes it), rect (the field: the picker is at its height),
3386
+ // besideRect (the picker is at the left of this rect, not of the panel), noPagePick: 1 (the page can not be clicked now) }
3387
+ box.openColorPickerFor = function (request) {
3388
+ let value = String(request.value ?? "");
3389
+ const colorField = {
3390
+ isOutside: 1,
3391
+ opener: request.opener || { elem: document.createElement("div") },
3392
+ rect: request.rect,
3393
+ besideRect: request.besideRect,
3394
+ noPagePick: request.noPagePick,
3395
+ onClose: request.onClose,
3396
+ getValue: function () { return value; },
3397
+ commit: function (next) {
3398
+ value = String(next);
3399
+ request.commit(value);
3400
+ },
3401
+ };
3402
+ openColorPicker({ item: { key: request.key, hint: request.hint }, sectionKey: "" }, colorField);
3403
+ };
3404
+ // USAGE: panel.openColorPickerFor({ key: "tone", hint: "Tone", value: "#FF0000", rect: rect, opener: swatch, commit: write })
3405
+
3406
+ // The colors under a color field, for a color that is not an item of the panel. It follows the ticks of the picker and is
3407
+ // made in the current container. request: { key, hint, width, onPick(value) }. Returns { obj, paint(value), setHidden(isHidden) }.
3408
+ box.buildColorStrip = function (request) {
3409
+ const strip = buildQuickStrip({ item: { key: request.key, hint: request.hint }, sectionKey: "" }, request.width, request.onPick);
3410
+ strip.isOutside = 1;
3411
+ return strip;
3412
+ };
3413
+ // USAGE: const strip = panel.buildColorStrip({ key: "tone", hint: "Tone", width: 120, onPick: write }); strip.paint("#FF0000");
3414
+
3415
+ box.isColorPickerOpen = function () {
3416
+ return !!(menu && menu.colorField);
3417
+ };
3418
+
3419
+ box.closeColorPicker = function () {
3420
+ if (box.isColorPickerOpen()) closeMenu();
3421
+ };
3422
+
3423
+ // Is this element in a popup of the panel? (A popup of the page over it stays open for a click in the color picker.)
3424
+ box.isPopupElement = function (element) {
3425
+ return !!(menu && menu.obj.elem.contains(element));
3426
+ };
3427
+
2532
3428
  // Many values at once: { x: 10, y: 20 }
2533
3429
  box.setValues = function (values, silent = 0) {
2534
3430
  Object.keys(values || {}).forEach(function (key) { box.setValue(key, values[key], silent); });
@@ -2576,7 +3472,7 @@ const PropertyPanel = function (params = {}) {
2576
3472
  listeners.push(fn);
2577
3473
  return function () { listeners = listeners.filter(function (f) { return f !== fn; }); };
2578
3474
  };
2579
- // USAGE: const stop = panel.listen(function (change) { println(change.key); }); stop();
3475
+ // USAGE: const stop = panel.listen(function (panel, change) { println(change.key); }); stop();
2580
3476
 
2581
3477
  box.open = function () {
2582
3478
  box.opened = 1;
@@ -2729,6 +3625,9 @@ PropertyPanel.icons = {
2729
3625
  pointer: "M4 2.5l8.5 5.2-3.7 1 2.1 3.9-1.7.9-2.1-3.9L4.3 12.2zM12 1.5v2M14.5 4h-2M13.8 2.2l-1.3 1.3",
2730
3626
  eyedropper: "M10.2 2.8a1.7 1.7 0 012.4 2.4l-1.4 1.4.7.7-1.1 1.1-3.3-3.3 1.1-1.1.7.7zM7.4 5.9L3 10.3V13h2.7l4.4-4.4",
2731
3627
  check: "M3.5 8.5l3 3 6-7",
3628
+ copy: "M6 6h7v7H6zM10 6V3H3v7h3",
3629
+ trash: "M2.5 4.5h11M6.5 4.5V3h3v1.5M4 4.5l.7 8.5h6.6l.7-8.5M6.8 7v3.5M9.2 7v3.5",
3630
+ chevronRight: "M6.5 4.5L10 8l-3.5 3.5",
2732
3631
  plus: "M8 3v10M3 8h10",
2733
3632
  minus: "M3 8h10",
2734
3633
  bold: "M5 3h3.8a2.4 2.4 0 0 1 0 4.8H5zM5 7.8h4.4a2.6 2.6 0 0 1 0 5.2H5z",