create-basicjs 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/create-basicjs.js +31 -4
- package/bin/verify-package.js +1 -1
- package/package.json +2 -2
- package/payload/starter/AGENTS.md +11 -6
- package/payload/starter/README.md +1 -1
- package/payload/starter/_basic/VERSION +1 -1
- package/payload/starter/_basic/assets/cards/almond-blossom.png +0 -0
- package/payload/starter/_basic/assets/cards/blackberry.png +0 -0
- package/payload/starter/_basic/assets/cards/borage.png +0 -0
- package/payload/starter/_basic/assets/cards/chamomile.png +0 -0
- package/payload/starter/_basic/assets/cards/dill.png +0 -0
- package/payload/starter/_basic/assets/cards/eucalyptus.png +0 -0
- package/payload/starter/_basic/assets/cards/fennel.png +0 -0
- package/payload/starter/_basic/assets/cards/fig.png +0 -0
- package/payload/starter/_basic/assets/cards/juniper.png +0 -0
- package/payload/starter/_basic/assets/cards/lavender.png +0 -0
- package/payload/starter/_basic/assets/cards/lemon.png +0 -0
- package/payload/starter/_basic/assets/cards/olives.png +0 -0
- package/payload/starter/_basic/assets/cards/oregano.png +0 -0
- package/payload/starter/_basic/assets/cards/pepper.png +0 -0
- package/payload/starter/_basic/assets/cards/physalis.png +0 -0
- package/payload/starter/_basic/assets/cards/pomegranate.png +0 -0
- package/payload/starter/_basic/assets/cards/poppy.png +0 -0
- package/payload/starter/_basic/assets/cards/rosehip.png +0 -0
- package/payload/starter/_basic/assets/cards/saffron.png +0 -0
- package/payload/starter/_basic/assets/categories/cappuccino.png +0 -0
- package/payload/starter/_basic/assets/categories/chocolate-milk.png +0 -0
- package/payload/starter/_basic/assets/categories/coffee.png +0 -0
- package/payload/starter/_basic/assets/categories/frappe.png +0 -0
- package/payload/starter/_basic/assets/categories/iced-caffee.png +0 -0
- package/payload/starter/_basic/assets/categories/milkshake.png +0 -0
- package/payload/starter/_basic/assets/categories/orange-juice.png +0 -0
- package/payload/starter/_basic/assets/categories/tea.png +0 -0
- package/payload/starter/_basic/assets/fruids/brokoli.png +0 -0
- package/payload/starter/_basic/assets/fruids/cilek.png +0 -0
- package/payload/starter/_basic/assets/fruids/domates.png +0 -0
- package/payload/starter/_basic/assets/fruids/elma.png +0 -0
- package/payload/starter/_basic/assets/fruids/havuc.png +0 -0
- package/payload/starter/_basic/assets/fruids/karpuz.png +0 -0
- package/payload/starter/_basic/assets/fruids/limon.png +0 -0
- package/payload/starter/_basic/assets/fruids/muz.png +0 -0
- package/payload/starter/_basic/assets/fruids/nar.png +0 -0
- package/payload/starter/_basic/assets/fruids/patlican.png +0 -0
- package/payload/starter/_basic/assets/fruids/yabanmersini.png +0 -0
- package/payload/starter/_basic/assets/fruids/yesilbiber.png +0 -0
- package/payload/starter/_basic/basic/LICENSE +1 -1
- package/payload/starter/_basic/basic/basic.css +3 -6
- package/payload/starter/_basic/basic/basic.js +154 -60
- package/payload/starter/_basic/basic/basic.min.js +19 -6
- package/payload/starter/_basic/basic/scroll-bar.js +4 -2
- package/payload/starter/_basic/basic/scroll-bar.min.js +1 -0
- package/payload/starter/_basic/comp/accordion.js +659 -0
- package/payload/starter/_basic/comp/action-button.js +22 -23
- package/payload/starter/_basic/comp/action-tab-bar.js +8 -8
- package/payload/starter/_basic/comp/app-bar.js +12 -11
- package/payload/starter/_basic/comp/{badge-v2.js → badge.js} +51 -5
- package/payload/starter/_basic/comp/bottom-bar.js +31 -23
- package/payload/starter/_basic/comp/breadcrumbs.js +4 -2
- package/payload/starter/_basic/comp/canvas.js +652 -0
- package/payload/starter/_basic/comp/chat-view.js +827 -0
- package/payload/starter/_basic/comp/check-box.js +137 -21
- package/payload/starter/_basic/comp/code-editor.js +953 -0
- package/payload/starter/_basic/comp/{select-color.js → color-picker.js} +62 -29
- package/payload/starter/_basic/comp/context-menu.js +342 -30
- package/payload/starter/_basic/comp/{currency-input-b.js → currency-field.js} +48 -29
- package/payload/starter/_basic/comp/data-table.js +114 -42
- package/payload/starter/_basic/comp/{select-date.js → date-picker.js} +104 -52
- package/payload/starter/_basic/comp/dialog.js +214 -76
- package/payload/starter/_basic/comp/email-field.js +65 -0
- package/payload/starter/_basic/comp/{select-file.js → file-picker.js} +245 -57
- package/payload/starter/_basic/comp/filters.js +374 -60
- package/payload/starter/_basic/comp/form.js +38 -26
- package/payload/starter/_basic/comp/full-screen-select.js +36 -33
- package/payload/starter/_basic/comp/gauge.js +12 -8
- package/payload/starter/_basic/comp/graph-box.js +3911 -0
- package/payload/starter/_basic/comp/grid-group.js +185 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button.js +16 -7
- package/payload/starter/_basic/comp/image-view.js +598 -0
- package/payload/starter/_basic/comp/item-list.js +507 -163
- package/payload/starter/_basic/comp/json-editor.js +3221 -0
- package/payload/starter/_basic/comp/json-view.js +597 -0
- package/payload/starter/_basic/comp/label-editor.js +22 -19
- package/payload/starter/_basic/comp/left-menu.js +89 -22
- package/payload/starter/_basic/comp/line-progress-bar.js +196 -45
- package/payload/starter/_basic/comp/loading-screen.js +49 -18
- package/payload/starter/_basic/comp/log-view.js +530 -0
- package/payload/starter/_basic/comp/{login-page-v2.js → login-page.js} +205 -106
- package/payload/starter/_basic/comp/markdown-view.js +1044 -0
- package/payload/starter/_basic/comp/menu-bar.js +624 -0
- package/payload/starter/_basic/comp/mini-graph-box.js +20 -11
- package/payload/starter/_basic/comp/minimal-accent.js +208 -0
- package/payload/starter/_basic/comp/notice.js +15 -13
- package/payload/starter/_basic/comp/{number-input-b.js → number-field.js} +26 -19
- package/payload/starter/_basic/comp/numeric-keyboard.js +15 -13
- package/payload/starter/_basic/comp/page-control.js +21 -4
- package/payload/starter/_basic/comp/page-header.js +7 -6
- package/payload/starter/_basic/comp/password-field.js +192 -0
- package/payload/starter/_basic/comp/period-bar.js +8 -7
- package/payload/starter/_basic/comp/{phone-input-b.js → phone-field.js} +80 -45
- package/payload/starter/_basic/comp/progress-bar.js +401 -85
- package/payload/starter/_basic/comp/property-panel.js +1022 -123
- package/payload/starter/_basic/comp/radio-button.js +79 -19
- package/payload/starter/_basic/comp/range-slider.js +569 -0
- package/payload/starter/_basic/comp/rich-text-editor.js +33 -30
- package/payload/starter/_basic/comp/scroll-area.js +308 -0
- package/payload/starter/_basic/comp/scrolling-text.js +10 -9
- package/payload/starter/_basic/comp/search-input.js +725 -0
- package/payload/starter/_basic/comp/search-results.js +60 -24
- package/payload/starter/_basic/comp/select-box.js +229 -107
- package/payload/starter/_basic/comp/settings-row.js +20 -19
- package/payload/starter/_basic/comp/side-panel.js +53 -10
- package/payload/starter/_basic/comp/slider-field.js +264 -88
- package/payload/starter/_basic/comp/slider.js +541 -86
- package/payload/starter/_basic/comp/smart-button.js +433 -352
- package/payload/starter/_basic/comp/smart-table.js +740 -185
- package/payload/starter/_basic/comp/sortable-list.js +47 -38
- package/payload/starter/_basic/comp/spark-line-box.js +25 -16
- package/payload/starter/_basic/comp/splitter.js +411 -0
- package/payload/starter/_basic/comp/status-bar.js +408 -0
- package/payload/starter/_basic/comp/step-bar.js +345 -0
- package/payload/starter/_basic/comp/stepper.js +77 -49
- package/payload/starter/_basic/comp/tabs.js +67 -18
- package/payload/starter/_basic/comp/tag-input.js +50 -10
- package/payload/starter/_basic/comp/tap-effect.js +6 -4
- package/payload/starter/_basic/comp/text-area-field.js +233 -0
- package/payload/starter/_basic/comp/text-field.js +1006 -0
- package/payload/starter/_basic/comp/time-line.js +102 -28
- package/payload/starter/_basic/comp/{select-time.js → time-picker.js} +104 -51
- package/payload/starter/_basic/comp/tiny-select.js +79 -39
- package/payload/starter/_basic/comp/tiny-table.js +12 -8
- package/payload/starter/_basic/comp/toast.js +87 -34
- package/payload/starter/_basic/comp/toggle.js +147 -27
- package/payload/starter/_basic/comp/tool-bar.js +760 -0
- package/payload/starter/_basic/comp/tooltip.js +80 -17
- package/payload/starter/_basic/comp/tree-view.js +124 -41
- package/payload/starter/_basic/comp/ui-effects.js +17 -11
- package/payload/starter/_basic/comp/ui-standards.js +5 -4
- package/payload/starter/_basic/comp/url-field.js +190 -0
- package/payload/starter/_basic/comp/web-view.js +70 -16
- package/payload/starter/_basic/docs/basic-js-animated-rules.md +15 -9
- package/payload/starter/_basic/docs/basic-js-code-rules.md +42 -5
- package/payload/starter/_basic/docs/basic-js-components.md +12 -17
- package/payload/starter/_basic/docs/basic-js-core.md +5 -4
- package/payload/starter/_basic/docs/component-index.md +245 -104
- package/payload/starter/_basic/docs/component-template.js +28 -24
- package/payload/starter/_basic/docs/handbook/00-introduction.md +6 -2
- package/payload/starter/_basic/docs/handbook/00-what-is-new.md +21 -0
- package/payload/starter/_basic/docs/handbook/01-label.md +4 -4
- package/payload/starter/_basic/docs/handbook/02-box.md +7 -7
- package/payload/starter/_basic/docs/handbook/03-image.md +4 -4
- package/payload/starter/_basic/docs/handbook/04-common-properties.md +6 -5
- package/payload/starter/_basic/docs/handbook/05-autolayout.md +8 -7
- package/payload/starter/_basic/docs/handbook/06-button.md +3 -3
- package/payload/starter/_basic/docs/handbook/07-input.md +3 -3
- package/payload/starter/_basic/docs/handbook/08-page.md +3 -3
- package/payload/starter/_basic/docs/handbook/09-useful-examples.md +39 -58
- package/payload/starter/_basic/docs/handbook/10-motion.md +6 -6
- package/payload/starter/_basic/docs/handbook/11-other-functions.md +1 -0
- package/payload/starter/_basic/docs/handbook/13-sound.md +3 -3
- package/payload/starter/_basic/docs/handbook/14-using-components.md +180 -0
- package/payload/starter/_basic/docs/handbook/15-making-a-component.md +338 -0
- package/payload/starter/_basic/docs/what-is-new.md +106 -0
- package/payload/starter/_basic/examples/accordion.htm +174 -0
- package/payload/starter/_basic/examples/action-button.htm +74 -32
- package/payload/starter/_basic/examples/action-tab-bar.htm +5 -6
- package/payload/starter/_basic/examples/app-bar.htm +63 -41
- package/payload/starter/_basic/examples/badge.htm +96 -0
- package/payload/starter/_basic/examples/bottom-bar-2.htm +61 -48
- package/payload/starter/_basic/examples/bottom-bar.htm +74 -16
- package/payload/starter/_basic/examples/breadcrumbs.htm +160 -150
- package/payload/starter/_basic/examples/canvas.htm +190 -0
- package/payload/starter/_basic/examples/chat-view.htm +143 -0
- package/payload/starter/_basic/examples/check-box-2.htm +71 -82
- package/payload/starter/_basic/examples/check-box-3.htm +72 -83
- package/payload/starter/_basic/examples/check-box.htm +207 -0
- package/payload/starter/_basic/examples/code-editor-2.htm +259 -0
- package/payload/starter/_basic/examples/code-editor.htm +225 -0
- package/payload/starter/_basic/examples/color-picker.htm +206 -0
- package/payload/starter/_basic/examples/context-menu.htm +180 -139
- package/payload/starter/_basic/examples/currency-field.htm +105 -0
- package/payload/starter/_basic/examples/data-table-2.htm +2 -1
- package/payload/starter/_basic/examples/data-table-3.htm +1 -1
- package/payload/starter/_basic/examples/data-table-4.htm +15 -12
- package/payload/starter/_basic/examples/data-table-5.htm +11 -3
- package/payload/starter/_basic/examples/data-table.htm +90 -40
- package/payload/starter/_basic/examples/date-picker.htm +239 -0
- package/payload/starter/_basic/examples/dialog-centered.htm +394 -40
- package/payload/starter/_basic/examples/dialog.htm +267 -46
- package/payload/starter/_basic/examples/email-field.htm +102 -0
- package/payload/starter/_basic/examples/file-picker.htm +296 -0
- package/payload/starter/_basic/examples/filters.htm +33 -22
- package/payload/starter/_basic/examples/{form-1.htm → form.htm} +18 -19
- package/payload/starter/_basic/examples/full-screen-select.htm +81 -58
- package/payload/starter/_basic/examples/gauge.htm +95 -81
- package/payload/starter/_basic/examples/graph-box.htm +365 -0
- package/payload/starter/_basic/examples/grid-group.htm +179 -0
- package/payload/starter/_basic/examples/hold-to-confirm-button.htm +102 -113
- package/payload/starter/_basic/examples/image-view.htm +195 -0
- package/payload/starter/_basic/examples/item-list-2.htm +138 -94
- package/payload/starter/_basic/examples/item-list.htm +191 -86
- package/payload/starter/_basic/examples/json-editor.htm +206 -0
- package/payload/starter/_basic/examples/json-view.htm +153 -0
- package/payload/starter/_basic/examples/label-editor.htm +85 -89
- package/payload/starter/_basic/examples/left-menu-2.htm +93 -0
- package/payload/starter/_basic/examples/left-menu.htm +42 -37
- package/payload/starter/_basic/examples/line-progress-bar.htm +155 -114
- package/payload/starter/_basic/examples/loading-screen.htm +149 -125
- package/payload/starter/_basic/examples/log-view.htm +175 -0
- package/payload/starter/_basic/examples/{login-page-dark-v2.htm → login-page-dark.htm} +265 -267
- package/payload/starter/_basic/examples/{login-page-v2.htm → login-page.htm} +266 -267
- package/payload/starter/_basic/examples/markdown-view.htm +220 -0
- package/payload/starter/_basic/examples/menu-bar-2.htm +225 -0
- package/payload/starter/_basic/examples/menu-bar.htm +145 -0
- package/payload/starter/_basic/examples/mini-graph-box.htm +98 -109
- package/payload/starter/_basic/examples/minimal-accent.htm +196 -0
- package/payload/starter/_basic/examples/minimal-theme.htm +432 -0
- package/payload/starter/_basic/examples/notice.htm +13 -4
- package/payload/starter/_basic/examples/number-field.htm +103 -0
- package/payload/starter/_basic/examples/numeric-keyboard.htm +44 -42
- package/payload/starter/_basic/examples/page-control.htm +181 -130
- package/payload/starter/_basic/examples/page-header.htm +57 -30
- package/payload/starter/_basic/examples/password-field.htm +117 -0
- package/payload/starter/_basic/examples/period-bar.htm +43 -29
- package/payload/starter/_basic/examples/phone-field-select-country.htm +292 -0
- package/payload/starter/_basic/examples/phone-field.htm +104 -0
- package/payload/starter/_basic/examples/progress-bar-ozden.htm +229 -92
- package/payload/starter/_basic/examples/progress-bar.htm +222 -174
- package/payload/starter/_basic/examples/property-panel.htm +152 -52
- package/payload/starter/_basic/examples/radio-button-2.htm +101 -109
- package/payload/starter/_basic/examples/radio-button-3.htm +81 -71
- package/payload/starter/_basic/examples/radio-button.htm +289 -0
- package/payload/starter/_basic/examples/range-slider.htm +171 -0
- package/payload/starter/_basic/examples/rich-text-editor.htm +115 -110
- package/payload/starter/_basic/examples/scroll-area.htm +293 -0
- package/payload/starter/_basic/examples/scrolling-text.htm +27 -6
- package/payload/starter/_basic/examples/search-input-2-light.htm +112 -0
- package/payload/starter/_basic/examples/search-input-3-dark.htm +105 -0
- package/payload/starter/_basic/examples/{search-input-v2-place.htm → search-input-place.htm} +25 -26
- package/payload/starter/_basic/examples/search-input.htm +159 -0
- package/payload/starter/_basic/examples/search-results.htm +85 -88
- package/payload/starter/_basic/examples/select-box-ozden-dark-text.htm +70 -0
- package/payload/starter/_basic/examples/select-box-ozden-item.htm +6 -5
- package/payload/starter/_basic/examples/select-box-ozden-text.htm +5 -3
- package/payload/starter/_basic/examples/select-box.htm +190 -159
- package/payload/starter/_basic/examples/settings-row.htm +92 -43
- package/payload/starter/_basic/examples/side-panel-2.htm +63 -25
- package/payload/starter/_basic/examples/side-panel.htm +84 -70
- package/payload/starter/_basic/examples/slider-2-classic.htm +152 -0
- package/payload/starter/_basic/examples/slider-field-ozden.htm +286 -0
- package/payload/starter/_basic/examples/slider-field.htm +174 -134
- package/payload/starter/_basic/examples/slider.htm +257 -180
- package/payload/starter/_basic/examples/smart-button-3-ozden.htm +170 -257
- package/payload/starter/_basic/examples/smart-button-4-dark.htm +86 -47
- package/payload/starter/_basic/examples/smart-button-5-features.htm +130 -125
- package/payload/starter/_basic/examples/smart-button-alternatif.htm +266 -0
- package/payload/starter/_basic/examples/smart-button.htm +207 -174
- package/payload/starter/_basic/examples/smart-table-2.htm +43 -56
- package/payload/starter/_basic/examples/smart-table-3.htm +148 -113
- package/payload/starter/_basic/examples/smart-table-4.htm +37 -50
- package/payload/starter/_basic/examples/{smart-table-1.htm → smart-table-5.htm} +37 -48
- package/payload/starter/_basic/examples/smart-table.htm +183 -0
- package/payload/starter/_basic/examples/sortable-list.htm +191 -142
- package/payload/starter/_basic/examples/spark-line-box.htm +149 -161
- package/payload/starter/_basic/examples/splitter.htm +164 -0
- package/payload/starter/_basic/examples/status-bar.htm +166 -0
- package/payload/starter/_basic/examples/step-bar.htm +129 -0
- package/payload/starter/_basic/examples/stepper-2.htm +71 -59
- package/payload/starter/_basic/examples/stepper.htm +146 -135
- package/payload/starter/_basic/examples/tabs-2.htm +58 -67
- package/payload/starter/_basic/examples/tabs.htm +197 -180
- package/payload/starter/_basic/examples/tag-input.htm +150 -153
- package/payload/starter/_basic/examples/tap-effect.htm +23 -19
- package/payload/starter/_basic/examples/text-area-field.htm +104 -0
- package/payload/starter/_basic/examples/text-field-2.htm +113 -0
- package/payload/starter/_basic/examples/text-field-3-style.htm +105 -0
- package/payload/starter/_basic/examples/text-field-4-custom-unit.htm +96 -0
- package/payload/starter/_basic/examples/{input-b-ex5-warning-icon.htm → text-field-5-warning-icon.htm} +19 -19
- package/payload/starter/_basic/examples/text-field-6-modern-dark.htm +114 -0
- package/payload/starter/_basic/examples/text-field-7-modern.htm +106 -0
- package/payload/starter/_basic/examples/text-field-8-light-dark.htm +159 -0
- package/payload/starter/_basic/examples/text-field.htm +163 -0
- package/payload/starter/_basic/examples/time-line.htm +180 -116
- package/payload/starter/_basic/examples/time-picker.htm +240 -0
- package/payload/starter/_basic/examples/tiny-select.htm +118 -86
- package/payload/starter/_basic/examples/tiny-table.htm +40 -34
- package/payload/starter/_basic/examples/toast.htm +145 -147
- package/payload/starter/_basic/examples/toggle-2.htm +99 -68
- package/payload/starter/_basic/examples/toggle-3.htm +104 -101
- package/payload/starter/_basic/examples/toggle.htm +161 -93
- package/payload/starter/_basic/examples/tool-bar.htm +172 -0
- package/payload/starter/_basic/examples/tooltip-2.htm +110 -60
- package/payload/starter/_basic/examples/tooltip-3.htm +124 -65
- package/payload/starter/_basic/examples/tooltip-4.htm +218 -0
- package/payload/starter/_basic/examples/tooltip.htm +206 -124
- package/payload/starter/_basic/examples/tree-view.htm +210 -182
- package/payload/starter/_basic/examples/ui-effects.htm +207 -185
- package/payload/starter/_basic/examples/ui-standards.htm +200 -139
- package/payload/starter/_basic/examples/url-field.htm +120 -0
- package/payload/starter/_basic/examples/web-view.htm +109 -110
- package/payload/starter/_basic/min/accordion.min.js +2 -0
- package/payload/starter/_basic/min/action-button.min.js +1 -1
- package/payload/starter/_basic/min/app-bar.min.js +1 -1
- package/payload/starter/_basic/min/badge.min.js +2 -0
- package/payload/starter/_basic/min/bottom-bar.min.js +1 -1
- package/payload/starter/_basic/min/canvas.min.js +2 -0
- package/payload/starter/_basic/min/chat-view.min.js +2 -0
- package/payload/starter/_basic/min/check-box.min.js +1 -1
- package/payload/starter/_basic/min/code-editor.min.js +2 -0
- package/payload/starter/_basic/min/color-picker.min.js +2 -0
- package/payload/starter/_basic/min/context-menu.min.js +1 -1
- package/payload/starter/_basic/min/currency-field.min.js +2 -0
- package/payload/starter/_basic/min/data-table.min.js +1 -1
- package/payload/starter/_basic/min/date-picker.min.js +2 -0
- package/payload/starter/_basic/min/dialog.min.js +1 -1
- package/payload/starter/_basic/min/email-field.min.js +2 -0
- package/payload/starter/_basic/min/file-picker.min.js +2 -0
- package/payload/starter/_basic/min/filters.min.js +1 -1
- package/payload/starter/_basic/min/form.min.js +1 -1
- package/payload/starter/_basic/min/full-screen-select.min.js +1 -1
- package/payload/starter/_basic/min/gauge.min.js +1 -1
- package/payload/starter/_basic/min/graph-box.min.js +2 -0
- package/payload/starter/_basic/min/grid-group.min.js +2 -0
- package/payload/starter/_basic/min/hold-to-confirm-button.min.js +1 -1
- package/payload/starter/_basic/min/image-view.min.js +2 -0
- package/payload/starter/_basic/min/item-list.min.js +1 -1
- package/payload/starter/_basic/min/json-editor.min.js +2 -0
- package/payload/starter/_basic/min/json-view.min.js +2 -0
- package/payload/starter/_basic/min/label-editor.min.js +1 -1
- package/payload/starter/_basic/min/left-menu.min.js +1 -1
- package/payload/starter/_basic/min/line-progress-bar.min.js +1 -1
- package/payload/starter/_basic/min/loading-screen.min.js +1 -1
- package/payload/starter/_basic/min/log-view.min.js +2 -0
- package/payload/starter/_basic/min/login-page.min.js +2 -0
- package/payload/starter/_basic/min/markdown-view.min.js +2 -0
- package/payload/starter/_basic/min/menu-bar.min.js +2 -0
- package/payload/starter/_basic/min/mini-graph-box.min.js +1 -1
- package/payload/starter/_basic/min/minimal-accent.min.js +2 -0
- package/payload/starter/_basic/min/notice.min.js +1 -1
- package/payload/starter/_basic/min/number-field.min.js +2 -0
- package/payload/starter/_basic/min/numeric-keyboard.min.js +1 -1
- package/payload/starter/_basic/min/page-control.min.js +1 -1
- package/payload/starter/_basic/min/password-field.min.js +2 -0
- package/payload/starter/_basic/min/phone-field.min.js +2 -0
- package/payload/starter/_basic/min/progress-bar.min.js +1 -1
- package/payload/starter/_basic/min/property-panel.min.js +1 -1
- package/payload/starter/_basic/min/radio-button.min.js +1 -1
- package/payload/starter/_basic/min/range-slider.min.js +2 -0
- package/payload/starter/_basic/min/rich-text-editor.min.js +1 -1
- package/payload/starter/_basic/min/scroll-area.min.js +2 -0
- package/payload/starter/_basic/min/scrolling-text.min.js +1 -1
- package/payload/starter/_basic/min/search-input.min.js +2 -0
- package/payload/starter/_basic/min/search-results.min.js +1 -1
- package/payload/starter/_basic/min/select-box.min.js +1 -1
- package/payload/starter/_basic/min/settings-row.min.js +1 -1
- package/payload/starter/_basic/min/side-panel.min.js +1 -1
- package/payload/starter/_basic/min/slider-field.min.js +1 -1
- package/payload/starter/_basic/min/slider.min.js +1 -1
- package/payload/starter/_basic/min/smart-button.min.js +1 -1
- package/payload/starter/_basic/min/smart-table.min.js +1 -1
- package/payload/starter/_basic/min/sortable-list.min.js +1 -1
- package/payload/starter/_basic/min/spark-line-box.min.js +1 -1
- package/payload/starter/_basic/min/splitter.min.js +2 -0
- package/payload/starter/_basic/min/status-bar.min.js +2 -0
- package/payload/starter/_basic/min/step-bar.min.js +2 -0
- package/payload/starter/_basic/min/stepper.min.js +1 -1
- package/payload/starter/_basic/min/tabs.min.js +1 -1
- package/payload/starter/_basic/min/tag-input.min.js +1 -1
- package/payload/starter/_basic/min/text-area-field.min.js +2 -0
- package/payload/starter/_basic/min/text-field.min.js +2 -0
- package/payload/starter/_basic/min/time-line.min.js +1 -1
- package/payload/starter/_basic/min/time-picker.min.js +2 -0
- package/payload/starter/_basic/min/tiny-select.min.js +1 -1
- package/payload/starter/_basic/min/toast.min.js +1 -1
- package/payload/starter/_basic/min/toggle.min.js +1 -1
- package/payload/starter/_basic/min/tool-bar.min.js +2 -0
- package/payload/starter/_basic/min/tooltip.min.js +1 -1
- package/payload/starter/_basic/min/tree-view.min.js +1 -1
- package/payload/starter/_basic/min/ui-effects.min.js +1 -1
- package/payload/starter/_basic/min/url-field.min.js +2 -0
- package/payload/starter/_basic/min/web-view.min.js +1 -1
- package/payload/templates/booking/app/app.js +11 -8
- package/payload/templates/booking/app/settings.js +4 -4
- package/payload/templates/booking/index.htm +3 -3
- package/payload/templates/booking/pages/account.js +6 -6
- package/payload/templates/booking/pages/book.js +1 -1
- package/payload/templates/booking/pages/services.js +5 -4
- package/payload/templates/classic/app/app.js +15 -11
- package/payload/templates/classic/app/settings.js +22 -20
- package/payload/templates/classic/assets/_attribute.txt +2 -0
- package/payload/templates/classic/assets/cards/dill.png +0 -0
- package/payload/templates/classic/assets/cards/fennel.png +0 -0
- package/payload/templates/classic/assets/cards/juniper.png +0 -0
- package/payload/templates/classic/assets/cards/olives.png +0 -0
- package/payload/templates/classic/assets/cards/oregano.png +0 -0
- package/payload/templates/classic/assets/cards/pepper.png +0 -0
- package/payload/templates/classic/assets/cards/rosehip.png +0 -0
- package/payload/templates/classic/assets/categories/cappuccino.png +0 -0
- package/payload/templates/classic/assets/categories/chocolate-milk.png +0 -0
- package/payload/templates/classic/assets/categories/coffee.png +0 -0
- package/payload/templates/classic/assets/categories/frappe.png +0 -0
- package/payload/templates/classic/assets/categories/iced-caffee.png +0 -0
- package/payload/templates/classic/assets/categories/milkshake.png +0 -0
- package/payload/templates/classic/assets/categories/orange-juice.png +0 -0
- package/payload/templates/classic/assets/categories/tea.png +0 -0
- package/payload/templates/classic/index.htm +2 -2
- package/payload/templates/classic/pages/example.js +10 -10
- package/payload/templates/classic/pages/examples.js +44 -43
- package/payload/templates/classic/pages/home.js +16 -15
- package/payload/templates/classic/pages/info-pages.js +5 -5
- package/payload/templates/classic/pages/search.js +8 -7
- package/payload/templates/classic/pages/settings.js +13 -13
- package/payload/templates/classic/pages/tasks.js +1 -0
- package/payload/templates/classic/pages/template-pages.js +12 -11
- package/payload/templates/coffee-shop/app/app.js +12 -8
- package/payload/templates/coffee-shop/app/settings.js +4 -4
- package/payload/templates/coffee-shop/index.htm +3 -3
- package/payload/templates/coffee-shop/pages/drink.js +1 -1
- package/payload/templates/coffee-shop/pages/menu.js +5 -4
- package/payload/templates/forms/TEMPLATE.md +1 -1
- package/payload/templates/forms/appointment-form.htm +55 -53
- package/payload/templates/forms/contact-form-to-mail.htm +38 -37
- package/payload/templates/forms/contact-form-to-supabase.htm +47 -46
- package/payload/templates/forms/dark-contact-form.htm +43 -40
- package/payload/templates/forms/event-registration-form.htm +80 -77
- package/payload/templates/forms/feedback-form.htm +54 -54
- package/payload/templates/forms/order-form.htm +88 -84
- package/payload/templates/forms/recruitment-form.htm +60 -60
- package/payload/templates/forms/service/readme.md +9 -8
- package/payload/templates/forms/service/send-form-mail.php +38 -21
- package/payload/templates/forms/support-ticket-form.htm +67 -65
- package/payload/templates/panel/common/module-page.js +2 -2
- package/payload/templates/panel/common/theme.js +37 -10
- package/payload/templates/panel/common/top-bar.js +45 -40
- package/payload/templates/panel/index.htm +59 -60
- package/payload/templates/panel/module10/greenhouse.htm +98 -113
- package/payload/templates/panel/module11/arduino-projects.htm +47 -58
- package/payload/templates/panel/module6/energy-hub.htm +71 -103
- package/payload/templates/panel/module7/3d-printers.htm +58 -81
- package/payload/templates/panel/module8/cold-rooms.htm +58 -79
- package/payload/templates/panel/module9/elevator-fleet.htm +72 -93
- package/payload/templates/panel/pages/activity.js +134 -152
- package/payload/templates/panel/pages/contents.js +291 -308
- package/payload/templates/panel/pages/customers.js +250 -267
- package/payload/templates/panel/pages/edit-user.js +31 -30
- package/payload/templates/panel/pages/home.js +39 -70
- package/payload/templates/panel/pages/media.js +166 -183
- package/payload/templates/panel/pages/notifications.js +7 -7
- package/payload/templates/panel/pages/orders.js +200 -217
- package/payload/templates/panel/pages/products.js +259 -278
- package/payload/templates/panel/pages/reports.js +74 -123
- package/payload/templates/panel/pages/roles.js +57 -60
- package/payload/templates/panel/pages/settings.js +127 -143
- package/payload/templates/panel/pages/user-actions.js +106 -110
- package/payload/templates/panel/pages/user-list.js +221 -238
- package/payload/templates/panel/pages/users.js +14 -29
- package/payload/templates/shop/TEMPLATE.md +1 -1
- package/payload/templates/shop/app/app.js +11 -8
- package/payload/templates/shop/app/settings.js +4 -4
- package/payload/templates/shop/index.htm +3 -3
- package/payload/templates/shop/pages/account.js +7 -7
- package/payload/templates/shop/pages/cart.js +1 -1
- package/payload/templates/shop/pages/checkout.js +2 -2
- package/payload/templates/shop/pages/product.js +2 -2
- package/payload/templates/shop/pages/shop.js +6 -5
- package/payload/templates/starter/TEMPLATE.md +1 -1
- package/payload/templates/starter/app/app.js +12 -8
- package/payload/templates/starter/app/settings.js +14 -11
- package/payload/templates/starter/index.htm +3 -3
- package/payload/templates/starter/pages/about.js +1 -1
- package/payload/templates/starter/pages/home.js +2 -2
- package/payload/templates/starter/pages/product.js +1 -1
- package/payload/templates/starter/pages/products.js +5 -5
- package/payload/templates/starter/pages/settings.js +1 -1
- package/payload/templates/starter/pages/tasks.js +8 -8
- package/payload/templates/starter/pages/website.js +1 -1
- package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +0 -13
- package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +0 -9
- package/payload/starter/_basic/comp/chart-box.js +0 -868
- package/payload/starter/_basic/comp/email-input-b.js +0 -57
- package/payload/starter/_basic/comp/input-b.js +0 -759
- package/payload/starter/_basic/comp/password-input-b.js +0 -164
- package/payload/starter/_basic/comp/search-input-v2.js +0 -427
- package/payload/starter/_basic/comp/textarea-b.js +0 -184
- package/payload/starter/_basic/comp/url-input-b.js +0 -145
- package/payload/starter/_basic/examples/badgeV2.htm +0 -68
- package/payload/starter/_basic/examples/chart-box.htm +0 -287
- package/payload/starter/_basic/examples/check-box-1.htm +0 -220
- package/payload/starter/_basic/examples/currency-input-b.htm +0 -71
- package/payload/starter/_basic/examples/email-input-b.htm +0 -67
- package/payload/starter/_basic/examples/input-b-ex1.htm +0 -132
- package/payload/starter/_basic/examples/input-b-ex2.htm +0 -136
- package/payload/starter/_basic/examples/input-b-ex3-style.htm +0 -113
- package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +0 -112
- package/payload/starter/_basic/examples/input-b-ex6-dark.htm +0 -108
- package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +0 -153
- package/payload/starter/_basic/examples/number-input-b.htm +0 -68
- package/payload/starter/_basic/examples/password-input-b.htm +0 -70
- package/payload/starter/_basic/examples/phone-input-b-select-country.htm +0 -298
- package/payload/starter/_basic/examples/phone-input-b.htm +0 -72
- package/payload/starter/_basic/examples/radio-button-1.htm +0 -264
- package/payload/starter/_basic/examples/search-input-v2-ozden.htm +0 -128
- package/payload/starter/_basic/examples/search-input-v2.htm +0 -65
- package/payload/starter/_basic/examples/select-color.htm +0 -215
- package/payload/starter/_basic/examples/select-date.htm +0 -244
- package/payload/starter/_basic/examples/select-file.htm +0 -268
- package/payload/starter/_basic/examples/select-time.htm +0 -249
- package/payload/starter/_basic/examples/smart-button-2.htm +0 -220
- package/payload/starter/_basic/examples/textarea-b.htm +0 -76
- package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +0 -221
- package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +0 -221
- package/payload/starter/_basic/examples/url-input-b.htm +0 -85
- package/payload/starter/_basic/min/badge-v2.min.js +0 -2
- package/payload/starter/_basic/min/chart-box.min.js +0 -2
- package/payload/starter/_basic/min/currency-input-b.min.js +0 -2
- package/payload/starter/_basic/min/email-input-b.min.js +0 -2
- package/payload/starter/_basic/min/input-b.min.js +0 -2
- package/payload/starter/_basic/min/login-page-v2.min.js +0 -2
- package/payload/starter/_basic/min/number-input-b.min.js +0 -2
- package/payload/starter/_basic/min/password-input-b.min.js +0 -2
- package/payload/starter/_basic/min/phone-input-b.min.js +0 -2
- package/payload/starter/_basic/min/search-input-v2.min.js +0 -2
- package/payload/starter/_basic/min/select-color.min.js +0 -2
- package/payload/starter/_basic/min/select-date.min.js +0 -2
- package/payload/starter/_basic/min/select-file.min.js +0 -2
- package/payload/starter/_basic/min/select-time.min.js +0 -2
- package/payload/starter/_basic/min/textarea-b.min.js +0 -2
- package/payload/starter/_basic/min/url-input-b.min.js +0 -2
- package/payload/templates/panel/common/bridge.min.js +0 -0
- package/payload/templates/panel/common/full-view.min.js +0 -1
- package/payload/templates/panel/common/main-view.min.js +0 -1
- package/payload/templates/panel/common/module-page.min.js +0 -1
- package/payload/templates/panel/common/right-view.min.js +0 -1
- package/payload/templates/panel/common/start-page.min.js +0 -1
- package/payload/templates/panel/common/top-bar-v25-07-29-1.js +0 -330
- package/payload/templates/panel/common/top-bar-v25-07-29-2.js +0 -265
- package/payload/templates/panel/common/top-bar.min.js +0 -1
- package/payload/templates/panel/common/ui-standards.min.js +0 -1
- package/payload/templates/panel/managers/database.min.js +0 -1
- package/payload/templates/panel/managers/login.min.js +0 -1
- package/payload/templates/panel/pages/_page-template.min.js +0 -1
- package/payload/templates/panel/pages/contents.min.js +0 -1
- package/payload/templates/panel/pages/edit-user.min.js +0 -1
- package/payload/templates/panel/pages/edit-users-table.min.js +0 -1
- package/payload/templates/panel/pages/home.min.js +0 -1
- package/payload/templates/panel/pages/notifications.min.js +0 -1
- package/payload/templates/panel/pages/reports.min.js +0 -1
- package/payload/templates/panel/pages/settings.min.js +0 -1
- package/payload/templates/panel/pages/user-actions.min.js +0 -2
- package/payload/templates/panel/pages/users.min.js +0 -1
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/hide-btn2.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn.png +0 -0
- /package/payload/starter/_basic/comp/{password-input-b → password-field}/show-btn2.png +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear-round.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/clear.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.png +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/filter.svg +0 -0
- /package/payload/starter/_basic/comp/{search-input-v2 → search-input}/search.svg +0 -0
|
@@ -2,39 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
|
|
5
|
-
SliderField - v26.
|
|
5
|
+
SliderField - v26.11
|
|
6
6
|
|
|
7
7
|
UI COMPONENT TEMPLATE
|
|
8
8
|
- A slider in the shape of a field: [ Width | · · · · · 3 ]
|
|
9
9
|
The label is at the left, the value at the right, the filled part ends with a small handle,
|
|
10
10
|
and the dots in the empty part show the steps. (Like the property sliders of design tools.)
|
|
11
11
|
- Drag anywhere on the field, or click a point to jump there. A click on the value opens the typing (editable: 1).
|
|
12
|
-
-
|
|
12
|
+
- minValue, maxValue, step and precision (decimals, "auto": from the step). Unit text after the value ("px", "%")
|
|
13
13
|
and a valueFormat() for your own text.
|
|
14
14
|
- Keyboard: ArrowRight / ArrowUp one step, ArrowLeft / ArrowDown one step back, PageUp / PageDown ten steps,
|
|
15
15
|
Home / End min / max, Enter (or a digit) starts the typing, Escape cancels it.
|
|
16
|
-
- Step dots: one dot for each step, up to maxTicks
|
|
17
|
-
Dots under the fill, the label or the value are hidden. showTicks: 0 hides them all.
|
|
16
|
+
- Step dots: one dot for each step, up to maxTicks and as many as there is room for (tick.minSpace; then fewer dots
|
|
17
|
+
that divide the range evenly). Dots under the fill, the label or the value are hidden. showTicks: 0 hides them all.
|
|
18
18
|
- Width can be a percent ("100%"): the view is updated with box.onResize (basic.js removes it with the box).
|
|
19
19
|
- onChange is called while dragging (every new value), onChangeEnd when the change is finished
|
|
20
20
|
(the drag is released, a key step, a typed value). Neither is called at create time or with silent: 1.
|
|
21
21
|
- Everything is drawn with code (no image files needed). Accessibility: role="slider", aria-valuenow...
|
|
22
|
-
- Style packages: "
|
|
23
|
-
|
|
22
|
+
- Style packages: "light" (default; the old name "classic" works too) and "dark" (the light and dark look of the kit:
|
|
23
|
+
a quiet gray field, a fill in a tint of the accent, the handle and the focus in the accent: _designs/slider-field.htm),
|
|
24
|
+
"modern", "ozden", "minimal", "minimalDark".
|
|
25
|
+
Select with styleName. (SliderField.styles)
|
|
26
|
+
"ozden" (a more usable look for general use), in the colors of SmartButton: a cyan fill with
|
|
27
|
+
an edge and a white knob, a focus ring. Its sample: _basic/examples/slider-field-ozden.htm.
|
|
28
|
+
- The handle never crosses a text (style.fill.aroundLabel and beforeValue, 1 by default): at min the fill holds the
|
|
29
|
+
label (and the handle stands 6 px after it), at max it ends before the value; the handle is always seen. 0: the
|
|
30
|
+
handle can go under them (it hides there).
|
|
31
|
+
- Not the same as comp/slider.js (Slider: a track with a round thumb). THE SLIDER OF NEW PAGES is Slider "round";
|
|
32
|
+
SliderField is the parallel design, for a page that asks for its shape.
|
|
24
33
|
|
|
25
34
|
USAGE:
|
|
26
|
-
const sfWidth = SliderField({ labelText: "Width", value: 3,
|
|
35
|
+
const sfWidth = SliderField({ labelText: "Width", value: 3, minValue: 0, maxValue: 10, onChange: (self) => println(self.value) });
|
|
27
36
|
sfWidth.setValue(5); // onChange and onChangeEnd are called
|
|
28
37
|
sfWidth.setValue(5, 1); // silent
|
|
29
|
-
SliderField({ labelText: "Opacity", value: 80,
|
|
30
|
-
SliderField({ labelText: "Scale", value: 1.5,
|
|
38
|
+
SliderField({ labelText: "Opacity", value: 80, minValue: 0, maxValue: 100, step: 5, unitText: "%" });
|
|
39
|
+
SliderField({ labelText: "Scale", value: 1.5, minValue: 0.5, maxValue: 3, step: 0.1 }); // precision "auto" -> 1 decimal
|
|
31
40
|
SliderField({ labelText: "Blur", width: "100%", valueFormat: (value) => (value === 0) ? "Off" : value + " px" });
|
|
41
|
+
SliderField({ styleName: "ozden", labelText: "Volume", value: 60, minValue: 0, maxValue: 100, unitText: "%" });
|
|
42
|
+
SliderField({ styleName: "ozden", labelText: "Speed", style: { fill: { color: "#7BC362", hoverColor: "#70B756", activeColor: "#67AD4D" } } }); // the green of SmartButton
|
|
32
43
|
|
|
33
44
|
Started Date: September 2026
|
|
34
|
-
Developer: Bugra Ozden
|
|
35
|
-
Email: bugra.ozden@gmail.com
|
|
36
45
|
Webpage: https://bug7a.github.io/js-components/
|
|
37
46
|
|
|
47
|
+
Copyright 2020-2026 Bugra Ozden <bugra.ozden@gmail.com> (https://bug7a.github.io/)
|
|
48
|
+
Licensed under the Apache License, Version 2.0
|
|
49
|
+
SPDX-License-Identifier: Apache-2.0
|
|
50
|
+
|
|
38
51
|
*/
|
|
39
52
|
|
|
40
53
|
"use strict";
|
|
@@ -46,8 +59,8 @@ const SliderFieldDefaults = {
|
|
|
46
59
|
height: 44,
|
|
47
60
|
labelText: "", // Text at the left. Ex: "Width"
|
|
48
61
|
value: 0,
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
minValue: 0,
|
|
63
|
+
maxValue: 10,
|
|
51
64
|
step: 1,
|
|
52
65
|
precision: "auto", // Decimals shown and used for rounding. "auto": the decimals of the step (0.25 -> 2)
|
|
53
66
|
unitText: "", // After the value. Ex: "px", " kg" (with the space)
|
|
@@ -59,16 +72,20 @@ const SliderFieldDefaults = {
|
|
|
59
72
|
valueFormat: function (value, self) { return self.formatNumber(value) + self.unitText; }, // Text of the value
|
|
60
73
|
onChange: function (self) { }, // self.value (also while dragging)
|
|
61
74
|
onChangeEnd: function (self) { }, // After a drag, a key step or a typed value
|
|
62
|
-
styleName: "
|
|
63
|
-
style: { //
|
|
75
|
+
styleName: "light", // "light" ("classic": its old name), "dark", "modern", "ozden", "minimal", "minimalDark" or a name added to SliderField.styles
|
|
76
|
+
style: { // The base of every package (a light gray field with a gray fill): a package changes only some keys
|
|
64
77
|
box: {
|
|
65
78
|
color: "#F2F2F4",
|
|
79
|
+
hoverColor: "", // Under the mouse. "": the same color
|
|
66
80
|
border: 1,
|
|
67
81
|
borderColor: "#E8E8EB",
|
|
68
82
|
round: 12,
|
|
83
|
+
boxShadow: "none",
|
|
69
84
|
},
|
|
70
85
|
boxFocus: { // Keyboard focus
|
|
71
86
|
borderColor: "#9A9AA0",
|
|
87
|
+
ringColor: "", // A ring inside the edge, over the fill. "": no ring
|
|
88
|
+
ringWidth: 2,
|
|
72
89
|
},
|
|
73
90
|
fill: {
|
|
74
91
|
color: "#E1E1E4",
|
|
@@ -76,6 +93,14 @@ const SliderFieldDefaults = {
|
|
|
76
93
|
activeColor: "#D5D5DA", // While dragging
|
|
77
94
|
minWidth: 26, // Fill width at min (the handle stays visible)
|
|
78
95
|
round: 11,
|
|
96
|
+
innerRound: "", // The right corners while the fill ends inside the field. "": the same as round, 0: straight
|
|
97
|
+
aroundLabel: 1, // 1: at min the fill holds the label (labelSpace after it): the handle never crosses the label. 0: it can go under it
|
|
98
|
+
labelSpace: 16,
|
|
99
|
+
beforeValue: 1, // 1: at max the fill ends before the value (valueSpace before it): the handle never crosses the value. 0: it can go under it
|
|
100
|
+
valueSpace: 16,
|
|
101
|
+
border: 0,
|
|
102
|
+
borderColor: "transparent",
|
|
103
|
+
boxShadow: "none", // Ex: a line at its bottom: "inset 0 -2px 0 rgba(0, 0, 0, 0.25)"
|
|
79
104
|
},
|
|
80
105
|
handle: {
|
|
81
106
|
width: 3,
|
|
@@ -85,6 +110,9 @@ const SliderFieldDefaults = {
|
|
|
85
110
|
hoverColor: "#86868C",
|
|
86
111
|
activeColor: "#5E5E64",
|
|
87
112
|
round: 2,
|
|
113
|
+
border: 0,
|
|
114
|
+
borderColor: "transparent",
|
|
115
|
+
boxShadow: "none",
|
|
88
116
|
},
|
|
89
117
|
tick: {
|
|
90
118
|
size: 3,
|
|
@@ -110,13 +138,14 @@ const SliderFieldDefaults = {
|
|
|
110
138
|
},
|
|
111
139
|
disabled: {
|
|
112
140
|
opacity: 0.5,
|
|
141
|
+
filter: "none", // Ex: "grayscale(1)": a colored fill turns gray
|
|
113
142
|
},
|
|
114
143
|
}
|
|
115
144
|
};
|
|
116
145
|
|
|
117
146
|
const SliderField = function (params = {}) {
|
|
118
147
|
|
|
119
|
-
// Merge style package: params.style > SliderField.styles[styleName] > SliderFieldDefaults.style (
|
|
148
|
+
// Merge style package: params.style > SliderField.styles[styleName] > SliderFieldDefaults.style (the base)
|
|
120
149
|
basic.applyStylePackage(params, SliderField.styles, SliderFieldDefaults);
|
|
121
150
|
|
|
122
151
|
// Merge params:
|
|
@@ -149,15 +178,17 @@ const SliderField = function (params = {}) {
|
|
|
149
178
|
const PAGE_STEPS = 10; // PageUp / PageDown
|
|
150
179
|
const LABEL_DOT_SPACE = 8; // px: no dots this close to the label
|
|
151
180
|
const VALUE_DOT_SPACE = 10; // px: no dots this close to the value text
|
|
152
|
-
const TEXT_OVERLAP = 4; // px: the handle may touch a text this much before it is hidden
|
|
181
|
+
const TEXT_OVERLAP = 4; // px: the handle may touch a text this much before it is hidden (aroundLabel / beforeValue 0)
|
|
182
|
+
const HANDLE_LABEL_SPACE = 6; // px between the label and the handle at min (aroundLabel)
|
|
153
183
|
const FILL_DOT_SPACE = 4; // px: no dots this close to the end of the fill
|
|
184
|
+
const HANDLE_DOT_SPACE = 8; // px: no dots this close to the right side of the handle
|
|
154
185
|
const VALUE_CLICK_SPACE = 6; // px: a click this close to the value text starts the typing
|
|
155
186
|
const INPUT_MIN_WIDTH = 64;
|
|
156
187
|
const INPUT_EXTRA_WIDTH = 28; // The input is wider than the value text
|
|
157
188
|
const INPUT_SPACE = 6; // px: between the input and the sides of the box
|
|
158
189
|
|
|
159
190
|
// *** PUBLIC VARIABLES:
|
|
160
|
-
// NOTE: Default values are also public variables. (box.value, box.
|
|
191
|
+
// NOTE: Default values are also public variables. (box.value, box.minValue, box.maxValue, box.step)
|
|
161
192
|
|
|
162
193
|
// *** PRIVATE FUNCTIONS:
|
|
163
194
|
|
|
@@ -175,15 +206,15 @@ const SliderField = function (params = {}) {
|
|
|
175
206
|
// Snaps to the steps (from min) and keeps the value in [min, max].
|
|
176
207
|
const clampValue = function (value) {
|
|
177
208
|
value = Number(value);
|
|
178
|
-
if (isNaN(value)) value = box.
|
|
179
|
-
value = Math.min(Math.max(value, box.
|
|
180
|
-
value = box.
|
|
181
|
-
return roundValue(Math.min(Math.max(value, box.
|
|
209
|
+
if (isNaN(value)) value = box.minValue;
|
|
210
|
+
value = Math.min(Math.max(value, box.minValue), box.maxValue);
|
|
211
|
+
value = box.minValue + Math.round((value - box.minValue) / box.step) * box.step;
|
|
212
|
+
return roundValue(Math.min(Math.max(value, box.minValue), box.maxValue));
|
|
182
213
|
};
|
|
183
214
|
|
|
184
215
|
const getRatio = function () {
|
|
185
|
-
const range = box.
|
|
186
|
-
return (range > 0) ? (box.value - box.
|
|
216
|
+
const range = box.maxValue - box.minValue;
|
|
217
|
+
return (range > 0) ? (box.value - box.minValue) / range : 0;
|
|
187
218
|
};
|
|
188
219
|
|
|
189
220
|
// Inner width (without the border)
|
|
@@ -192,40 +223,77 @@ const SliderField = function (params = {}) {
|
|
|
192
223
|
return (w > 0) ? w : (Number(box.width) || 0);
|
|
193
224
|
};
|
|
194
225
|
|
|
226
|
+
// The widest value text of min, max and the value: the end of the track does not move while the text changes.
|
|
227
|
+
const getWidestValueWidth = function () {
|
|
228
|
+
const texts = [box.valueFormat(box.minValue, box), box.valueFormat(box.maxValue, box), box.valueFormat(box.value, box)];
|
|
229
|
+
const widths = texts.map(function (text) { return SliderField.measureText(text, box.lblValue.elem); });
|
|
230
|
+
return Math.max.apply(null, widths);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// Where the end of the fill moves: { start, end } (the fill width at min and at max).
|
|
234
|
+
// fill.aroundLabel: at min the fill holds the label, so the label is always on the fill.
|
|
235
|
+
// fill.beforeValue: at max the fill ends before the value, so the value is never on the fill.
|
|
236
|
+
// WHY: the end of a colored fill that crossed a text cut its letters in two colors.
|
|
237
|
+
const getTrack = function () {
|
|
238
|
+
const width = getWidth();
|
|
239
|
+
let start = _s.fill.minWidth;
|
|
240
|
+
let end = width;
|
|
241
|
+
if (_s.fill.aroundLabel == 1 && box.labelText) {
|
|
242
|
+
// WHY the room of the handle: a thin handle inside the end of the fill stood on the label at min (hidden)
|
|
243
|
+
const handleRoom = _s.handle.inset + _s.handle.width + HANDLE_LABEL_SPACE;
|
|
244
|
+
start = Math.max(start, _s.label.padding + box.lblLabel.elem.offsetWidth + Math.max(_s.fill.labelSpace, handleRoom));
|
|
245
|
+
}
|
|
246
|
+
if (_s.fill.beforeValue == 1) {
|
|
247
|
+
end = width - _s.value.padding - getWidestValueWidth() - _s.fill.valueSpace;
|
|
248
|
+
}
|
|
249
|
+
return { start: start, end: Math.max(start, end) };
|
|
250
|
+
};
|
|
251
|
+
|
|
195
252
|
// Fill width for a ratio (0-1)
|
|
196
|
-
const getFillWidth = function (ratio) {
|
|
197
|
-
|
|
198
|
-
return minWidth + ratio * Math.max(0, getWidth() - minWidth);
|
|
253
|
+
const getFillWidth = function (ratio, track) {
|
|
254
|
+
return track.start + ratio * (track.end - track.start);
|
|
199
255
|
};
|
|
200
256
|
|
|
201
257
|
// Value for an x position inside the box (the handle follows the pointer).
|
|
202
258
|
const getValueAt = function (x) {
|
|
203
|
-
const
|
|
204
|
-
const space = Math.max(1,
|
|
205
|
-
const
|
|
206
|
-
|
|
259
|
+
const track = getTrack();
|
|
260
|
+
const space = Math.max(1, track.end - track.start);
|
|
261
|
+
const fillWidth = x + _s.handle.inset + _s.handle.width / 2; // the fill that puts the middle of the handle at x
|
|
262
|
+
const ratio = Math.min(1, Math.max(0, (fillWidth - track.start) / space));
|
|
263
|
+
return clampValue(box.minValue + ratio * (box.maxValue - box.minValue));
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// WHY: with fill.aroundLabel a click on the label is not a click on the track (it gave min).
|
|
267
|
+
const isOnLabelOfFill = function (x) {
|
|
268
|
+
return (_s.fill.aroundLabel == 1 && box.labelText && x < getTrack().start);
|
|
207
269
|
};
|
|
208
270
|
|
|
271
|
+
// The x of the pointer in the px of the box. WHY the scale: in a scaled parent (page.fit, a transform,
|
|
272
|
+
// the layer of a game UI) the rect is in screen px and the width in the own px of the box: a drag to 80 % gave
|
|
273
|
+
// 60 % (the game Fishing Company Tycoon fixed it in its copy).
|
|
209
274
|
const getPointerX = function (event) {
|
|
210
275
|
const rect = box.elem.getBoundingClientRect();
|
|
211
|
-
|
|
276
|
+
const scale = (box.elem.offsetWidth > 0) ? rect.width / box.elem.offsetWidth : 1;
|
|
277
|
+
return (event.clientX - rect.left) / (scale || 1) - box.elem.clientLeft;
|
|
212
278
|
};
|
|
213
279
|
|
|
214
|
-
// Number of dot spaces: every step, or a divisor of the steps up to maxTicks
|
|
215
|
-
|
|
280
|
+
// Number of dot spaces: every step, or a divisor of the steps, up to maxTicks and as many as the track has room for
|
|
281
|
+
// (tick.minSpace). WHY the room: dots that were too close were all hidden, a short track showed none.
|
|
282
|
+
const getTickCount = function (trackLength) {
|
|
216
283
|
if (box.showTicks != 1) return 0;
|
|
217
|
-
const steps = Math.round((box.
|
|
284
|
+
const steps = Math.round((box.maxValue - box.minValue) / box.step);
|
|
218
285
|
if (steps < 1) return 0;
|
|
219
|
-
|
|
220
|
-
|
|
286
|
+
const maxCount = Math.min(box.maxTicks, Math.floor(trackLength / _s.tick.minSpace));
|
|
287
|
+
if (steps <= maxCount) return steps;
|
|
288
|
+
for (let count = maxCount; count >= 2; count--) {
|
|
221
289
|
if (steps % count === 0) return count;
|
|
222
290
|
}
|
|
223
291
|
return 0;
|
|
224
292
|
};
|
|
225
293
|
|
|
226
294
|
// Creates the dots again when the count changes.
|
|
227
|
-
const buildTicks = function () {
|
|
228
|
-
const count = getTickCount();
|
|
295
|
+
const buildTicks = function (trackLength) {
|
|
296
|
+
const count = getTickCount(trackLength);
|
|
229
297
|
if (count === tickCount && ticks.length === ((count > 0) ? count + 1 : 0)) return;
|
|
230
298
|
ticks.forEach(function (tick) { tick.remove(); });
|
|
231
299
|
ticks = [];
|
|
@@ -244,40 +312,53 @@ const SliderField = function (params = {}) {
|
|
|
244
312
|
tick.css = {
|
|
245
313
|
top: "calc(50% - " + (_s.tick.size / 2) + "px)",
|
|
246
314
|
transition: "opacity " + FADE_TIME,
|
|
315
|
+
opacity: "0", // WHY: a new dot under the label faded out from 1 (the dots are made again when the field is resized)
|
|
247
316
|
};
|
|
248
317
|
ticks.push(tick);
|
|
249
318
|
}
|
|
250
319
|
});
|
|
251
320
|
};
|
|
252
321
|
|
|
322
|
+
// WHY: at the right end of the field the fill is as round as the field, or the round corner cuts its edge
|
|
323
|
+
const setFillCorners = function (fillWidth, width) {
|
|
324
|
+
const round = _s.fill.round;
|
|
325
|
+
const isInside = (fillWidth < width - 0.5);
|
|
326
|
+
const endRound = (isInside && _s.fill.innerRound !== "") ? _s.fill.innerRound : round;
|
|
327
|
+
box.fill.css.borderRadius = round + "px " + endRound + "px " + endRound + "px " + round + "px";
|
|
328
|
+
};
|
|
329
|
+
|
|
253
330
|
// Positions: fill, handle, value text, dots.
|
|
254
331
|
const refreshLayout = function () {
|
|
255
332
|
|
|
256
333
|
const width = getWidth();
|
|
257
|
-
const
|
|
334
|
+
const track = getTrack();
|
|
335
|
+
const fillWidth = getFillWidth(getRatio(), track);
|
|
258
336
|
const handleLeft = fillWidth - _s.handle.inset - _s.handle.width;
|
|
259
337
|
|
|
260
338
|
box.fill.width = fillWidth;
|
|
339
|
+
setFillCorners(fillWidth, width);
|
|
261
340
|
box.handle.left = handleLeft;
|
|
341
|
+
buildTicks(track.end - track.start);
|
|
262
342
|
|
|
263
343
|
// Areas that hide the dots
|
|
264
344
|
const labelRight = (box.labelText) ? _s.label.padding + box.lblLabel.elem.offsetWidth + LABEL_DOT_SPACE : 0;
|
|
265
345
|
const valueLeft = width - _s.value.padding - box.lblValue.elem.offsetWidth - VALUE_DOT_SPACE;
|
|
266
346
|
|
|
267
|
-
// WHY: At the ends the handle would be drawn on the label or the value text.
|
|
347
|
+
// WHY: At the ends the handle would be drawn on the label or the value text. Only without aroundLabel /
|
|
348
|
+
// beforeValue: with them the handle stays beside the texts and is always seen.
|
|
268
349
|
const handleRight = handleLeft + _s.handle.width;
|
|
269
|
-
const isOnLabel = (box.labelText && handleRight > _s.label.padding - TEXT_OVERLAP && handleLeft < labelRight - TEXT_OVERLAP);
|
|
270
|
-
const isOnValue = (handleRight > valueLeft + TEXT_OVERLAP);
|
|
350
|
+
const isOnLabel = (_s.fill.aroundLabel != 1 && box.labelText && handleRight > _s.label.padding - TEXT_OVERLAP && handleLeft < labelRight - TEXT_OVERLAP);
|
|
351
|
+
const isOnValue = (_s.fill.beforeValue != 1 && handleRight > valueLeft + TEXT_OVERLAP);
|
|
271
352
|
box.handle.css.opacity = (isOnLabel || isOnValue) ? "0" : "1";
|
|
272
353
|
|
|
273
354
|
if (tickCount > 0) {
|
|
274
|
-
|
|
275
|
-
const
|
|
355
|
+
// WHY the handle: a knob is wider than the end of the fill (ozden)
|
|
356
|
+
const dotsLeft = Math.max(fillWidth + FILL_DOT_SPACE, handleRight + HANDLE_DOT_SPACE);
|
|
276
357
|
for (let i = 0; i <= tickCount; i++) {
|
|
277
|
-
const x = getFillWidth(i / tickCount) - _s.handle.inset - _s.handle.width / 2;
|
|
358
|
+
const x = getFillWidth(i / tickCount, track) - _s.handle.inset - _s.handle.width / 2;
|
|
278
359
|
const tick = ticks[i];
|
|
279
360
|
tick.left = x - _s.tick.size / 2;
|
|
280
|
-
const isVisible =
|
|
361
|
+
const isVisible = x > dotsLeft && x > labelRight && x < valueLeft;
|
|
281
362
|
tick.css.opacity = (isVisible) ? "1" : "0";
|
|
282
363
|
}
|
|
283
364
|
}
|
|
@@ -292,9 +373,13 @@ const SliderField = function (params = {}) {
|
|
|
292
373
|
};
|
|
293
374
|
|
|
294
375
|
const paintState = function () {
|
|
376
|
+
const isHoverColor = (isHover && box.enabled == 1 && _s.box.hoverColor);
|
|
377
|
+
box.color = (isHoverColor) ? _s.box.hoverColor : _s.box.color;
|
|
295
378
|
box.fill.color = getStateColor(_s.fill);
|
|
296
379
|
box.handle.color = getStateColor(_s.handle);
|
|
297
|
-
|
|
380
|
+
const isFocusLook = ((isFocused && isKeyboardFocus) || isEditing);
|
|
381
|
+
box.borderColor = (isFocusLook) ? _s.boxFocus.borderColor : _s.box.borderColor;
|
|
382
|
+
box.focusRing.visible = (isFocusLook && _s.boxFocus.ringColor) ? 1 : 0;
|
|
298
383
|
};
|
|
299
384
|
|
|
300
385
|
const updateView = function () {
|
|
@@ -302,8 +387,8 @@ const SliderField = function (params = {}) {
|
|
|
302
387
|
box.lblValue.plainText = text;
|
|
303
388
|
box.aria = {
|
|
304
389
|
valuenow: String(box.value),
|
|
305
|
-
valuemin: String(box.
|
|
306
|
-
valuemax: String(box.
|
|
390
|
+
valuemin: String(box.minValue),
|
|
391
|
+
valuemax: String(box.maxValue),
|
|
307
392
|
valuetext: text,
|
|
308
393
|
};
|
|
309
394
|
refreshLayout();
|
|
@@ -349,7 +434,9 @@ const SliderField = function (params = {}) {
|
|
|
349
434
|
|
|
350
435
|
// apply: 1 -> The typed value is used. 0 -> Cancel.
|
|
351
436
|
const endEdit = function (apply) {
|
|
352
|
-
|
|
437
|
+
// WHY: Chrome fires blur when a focused field is removed: a half typed value went to onChange of a field that
|
|
438
|
+
// was removed (a panel built again while the user typed)
|
|
439
|
+
if (!isEditing || box.isRemoved) return;
|
|
353
440
|
isEditing = 0;
|
|
354
441
|
box.input.visible = 0;
|
|
355
442
|
box.lblValue.visible = 1;
|
|
@@ -379,8 +466,8 @@ const SliderField = function (params = {}) {
|
|
|
379
466
|
ArrowLeft: function () { stepValue(-1); },
|
|
380
467
|
PageUp: function () { stepValue(PAGE_STEPS); },
|
|
381
468
|
PageDown: function () { stepValue(-PAGE_STEPS); },
|
|
382
|
-
Home: function () { changeValue(box.
|
|
383
|
-
End: function () { changeValue(box.
|
|
469
|
+
Home: function () { changeValue(box.minValue, 1); },
|
|
470
|
+
End: function () { changeValue(box.maxValue, 1); },
|
|
384
471
|
};
|
|
385
472
|
|
|
386
473
|
const isTypingKey = function (key) {
|
|
@@ -425,7 +512,12 @@ const SliderField = function (params = {}) {
|
|
|
425
512
|
// *** POINTER (drag or click):
|
|
426
513
|
|
|
427
514
|
const onPointerDown = function (self, event) {
|
|
428
|
-
|
|
515
|
+
// WHY: a click on a disabled field took the focus (and drew the focus of the keyboard on it)
|
|
516
|
+
if (box.enabled != 1) {
|
|
517
|
+
event.preventDefault();
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
if (isEditing || event.button !== 0) return;
|
|
429
521
|
if (event.target === box.input.inputElement) return;
|
|
430
522
|
event.preventDefault(); // WHY: No text selection, the focus is given below.
|
|
431
523
|
isKeyboardFocus = 0;
|
|
@@ -462,12 +554,13 @@ const SliderField = function (params = {}) {
|
|
|
462
554
|
if (box.value !== startValueOfDrag) box.onChangeEnd(box);
|
|
463
555
|
return;
|
|
464
556
|
}
|
|
465
|
-
// A click: on the value text -> typing, anywhere else -> jump there.
|
|
557
|
+
// A click: on the value text -> typing, on the label of a fill around it -> only the focus, anywhere else -> jump there.
|
|
466
558
|
const valueLeft = getWidth() - _s.value.padding - box.lblValue.elem.offsetWidth - VALUE_CLICK_SPACE;
|
|
467
559
|
if (box.editable == 1 && x >= valueLeft) {
|
|
468
560
|
startEdit();
|
|
469
561
|
return;
|
|
470
562
|
}
|
|
563
|
+
if (isOnLabelOfFill(x)) return;
|
|
471
564
|
changeValue(getValueAt(x), 1);
|
|
472
565
|
};
|
|
473
566
|
|
|
@@ -511,24 +604,22 @@ const SliderField = function (params = {}) {
|
|
|
511
604
|
};
|
|
512
605
|
|
|
513
606
|
box.setRange = function (min, max) {
|
|
514
|
-
box.
|
|
515
|
-
box.
|
|
516
|
-
|
|
517
|
-
box.setValue(box.value, 1);
|
|
607
|
+
box.minValue = Number(min) || 0;
|
|
608
|
+
box.maxValue = Math.max(box.minValue, Number(max) || 0);
|
|
609
|
+
box.setValue(box.value, 1); // (the dots are made again in refreshLayout)
|
|
518
610
|
};
|
|
519
611
|
// USAGE: slider.setRange(0, 100)
|
|
520
612
|
|
|
521
|
-
box.
|
|
522
|
-
box.setRange(min, Math.max(Number(min) || 0, box.
|
|
613
|
+
box.setMinValue = function (min) {
|
|
614
|
+
box.setRange(min, Math.max(Number(min) || 0, box.maxValue));
|
|
523
615
|
};
|
|
524
616
|
|
|
525
|
-
box.
|
|
526
|
-
box.setRange(Math.min(box.
|
|
617
|
+
box.setMaxValue = function (max) {
|
|
618
|
+
box.setRange(Math.min(box.minValue, Number(max) || 0), max);
|
|
527
619
|
};
|
|
528
620
|
|
|
529
621
|
box.setStep = function (step) {
|
|
530
622
|
box.step = Math.abs(Number(step)) || 1;
|
|
531
|
-
buildTicks();
|
|
532
623
|
box.setValue(box.value, 1);
|
|
533
624
|
};
|
|
534
625
|
|
|
@@ -553,7 +644,6 @@ const SliderField = function (params = {}) {
|
|
|
553
644
|
|
|
554
645
|
box.setShowTicks = function (showTicks) {
|
|
555
646
|
box.showTicks = basic.isOn(showTicks) ? 1 : 0;
|
|
556
|
-
buildTicks();
|
|
557
647
|
refreshLayout();
|
|
558
648
|
};
|
|
559
649
|
|
|
@@ -566,6 +656,7 @@ const SliderField = function (params = {}) {
|
|
|
566
656
|
setSlideMotion(1);
|
|
567
657
|
}
|
|
568
658
|
box.css.opacity = (isEnabled) ? "1" : String(_s.disabled.opacity);
|
|
659
|
+
box.css.filter = (isEnabled) ? "none" : _s.disabled.filter;
|
|
569
660
|
box.cursor = (isEnabled) ? "pointer" : "default";
|
|
570
661
|
box.tabIndex = (isEnabled) ? 0 : -1;
|
|
571
662
|
box.aria = { disabled: (isEnabled) ? "false" : "true" };
|
|
@@ -595,10 +686,11 @@ const SliderField = function (params = {}) {
|
|
|
595
686
|
box.css = {
|
|
596
687
|
outline: "none",
|
|
597
688
|
boxSizing: "border-box",
|
|
598
|
-
transition: "border-color " + FADE_TIME,
|
|
689
|
+
transition: "border-color " + FADE_TIME + ", background-color " + FADE_TIME,
|
|
599
690
|
touchAction: "pan-y", // WHY: A horizontal drag moves the slider, a vertical one still scrolls the page.
|
|
600
691
|
userSelect: "none",
|
|
601
692
|
};
|
|
693
|
+
box.boxShadow = _bs.boxShadow;
|
|
602
694
|
box.clipContent = 1;
|
|
603
695
|
|
|
604
696
|
// BOX: Filled part
|
|
@@ -609,6 +701,9 @@ const SliderField = function (params = {}) {
|
|
|
609
701
|
height: "100%",
|
|
610
702
|
color: _s.fill.color,
|
|
611
703
|
round: _s.fill.round,
|
|
704
|
+
border: _s.fill.border,
|
|
705
|
+
borderColor: _s.fill.borderColor,
|
|
706
|
+
boxShadow: _s.fill.boxShadow,
|
|
612
707
|
});
|
|
613
708
|
|
|
614
709
|
// BOX: Layer of the step dots
|
|
@@ -622,6 +717,9 @@ const SliderField = function (params = {}) {
|
|
|
622
717
|
height: _s.handle.height,
|
|
623
718
|
color: _s.handle.color,
|
|
624
719
|
round: _s.handle.round,
|
|
720
|
+
border: _s.handle.border,
|
|
721
|
+
borderColor: _s.handle.borderColor,
|
|
722
|
+
boxShadow: _s.handle.boxShadow,
|
|
625
723
|
});
|
|
626
724
|
box.handle.css.top = "calc(50% - " + (_s.handle.height / 2) + "px)";
|
|
627
725
|
|
|
@@ -654,6 +752,19 @@ const SliderField = function (params = {}) {
|
|
|
654
752
|
styleTextLabel(box.lblLabel, _s.label);
|
|
655
753
|
styleTextLabel(box.lblValue, _s.value);
|
|
656
754
|
|
|
755
|
+
// BOX: Ring of the keyboard focus (boxFocus.ringColor). WHY a box: an outline of the field is drawn under the fill
|
|
756
|
+
box.focusRing = Box({
|
|
757
|
+
left: 0,
|
|
758
|
+
top: 0,
|
|
759
|
+
width: "100%",
|
|
760
|
+
height: "100%",
|
|
761
|
+
color: "transparent",
|
|
762
|
+
border: _s.boxFocus.ringWidth,
|
|
763
|
+
borderColor: _s.boxFocus.ringColor,
|
|
764
|
+
round: Math.max(0, _s.box.round - _s.box.border),
|
|
765
|
+
});
|
|
766
|
+
box.focusRing.visible = 0;
|
|
767
|
+
|
|
657
768
|
// INPUT: Typing the value (hidden until the edit starts)
|
|
658
769
|
box.input = Input({
|
|
659
770
|
left: 0,
|
|
@@ -679,7 +790,7 @@ const SliderField = function (params = {}) {
|
|
|
679
790
|
box.input.visible = 0;
|
|
680
791
|
|
|
681
792
|
// WHY: Only the box gets the pointer events, so event.target is always the box (or the input).
|
|
682
|
-
[box.fill, box.tickLayer, box.handle].forEach(function (obj) { obj.clickable = 0; });
|
|
793
|
+
[box.fill, box.tickLayer, box.handle, box.focusRing].forEach(function (obj) { obj.clickable = 0; });
|
|
683
794
|
|
|
684
795
|
// *** OBJECT INIT CODE:
|
|
685
796
|
|
|
@@ -714,15 +825,16 @@ const SliderField = function (params = {}) {
|
|
|
714
825
|
box.input.inputElement.addEventListener("keydown", onKeyDown);
|
|
715
826
|
|
|
716
827
|
box.onResize(function () { refreshLayout(); });
|
|
828
|
+
// WHY: the label and the value are measured; a font that is loaded later changes their widths.
|
|
829
|
+
if (document.fonts) document.fonts.ready.then(function () { if (!box.isRemoved) refreshLayout(); });
|
|
717
830
|
|
|
718
|
-
box.
|
|
719
|
-
box.
|
|
720
|
-
if (isNaN(box.
|
|
721
|
-
if (box.
|
|
831
|
+
box.minValue = Number(box.minValue) || 0;
|
|
832
|
+
box.maxValue = Number(box.maxValue);
|
|
833
|
+
if (isNaN(box.maxValue)) box.maxValue = box.minValue;
|
|
834
|
+
if (box.maxValue < box.minValue) box.maxValue = box.minValue;
|
|
722
835
|
box.step = Math.abs(Number(box.step)) || 1;
|
|
723
836
|
box.maxTicks = Math.max(2, Number(box.maxTicks) || SliderFieldDefaults.maxTicks);
|
|
724
837
|
box.value = clampValue(startValue);
|
|
725
|
-
buildTicks();
|
|
726
838
|
setSlideMotion(1);
|
|
727
839
|
box.setEnabled(box.enabled);
|
|
728
840
|
updateView();
|
|
@@ -736,16 +848,68 @@ const SliderField = function (params = {}) {
|
|
|
736
848
|
// WHY: Label.text uses innerHTML. Texts must not be read as HTML.
|
|
737
849
|
SliderField.escapeHtml = basic.escapeHtml; // (the name is kept: other code may use it)
|
|
738
850
|
|
|
851
|
+
// The width of a text in the font of an element, measured on a canvas (nothing changes in the page).
|
|
852
|
+
SliderField.measureText = function (text, elem) {
|
|
853
|
+
if (!SliderField.textCanvas) SliderField.textCanvas = document.createElement("canvas").getContext("2d");
|
|
854
|
+
const css = getComputedStyle(elem);
|
|
855
|
+
SliderField.textCanvas.font = css.fontStyle + " " + css.fontWeight + " " + css.fontSize + " " + css.fontFamily;
|
|
856
|
+
return SliderField.textCanvas.measureText(String(text)).width;
|
|
857
|
+
};
|
|
858
|
+
|
|
739
859
|
// *** STYLE PACKAGES:
|
|
740
860
|
// USAGE: SliderField({ styleName: "modern" })
|
|
741
861
|
// USAGE: SliderField({ styleName: "dark", style: { fill: { color: "#3D7A6B" } } }) // Change only some keys.
|
|
742
862
|
// USAGE: SliderField({ style: SliderField.styles.dark }) // The same as styleName: "dark". (The package is copied, never changed.)
|
|
743
|
-
// NOTE: A new package needs only the keys that differ from the
|
|
863
|
+
// NOTE: A new package needs only the keys that differ from SliderFieldDefaults.style (the base of every package).
|
|
744
864
|
// USAGE: SliderField.styles.myStyle = { fill: { color: "gold" } };
|
|
745
865
|
SliderField.styles = {
|
|
746
866
|
|
|
747
|
-
//
|
|
748
|
-
|
|
867
|
+
// The light look of the kit (_designs/slider-field.htm), the default: a quiet gray field with round 6 corners, a
|
|
868
|
+
// fill in a tint of the accent that ends with a handle in the accent, a bold value, dots for the steps; the keyboard
|
|
869
|
+
// focus is the accent edge with a soft ring inside.
|
|
870
|
+
light: {
|
|
871
|
+
box: { color: "#F2F3F0", hoverColor: "", border: 1, borderColor: Black(0.08), round: 6, boxShadow: "none" },
|
|
872
|
+
boxFocus: { borderColor: "#3D7A6B", ringColor: "rgba(61, 122, 107, 0.5)", ringWidth: 2 },
|
|
873
|
+
fill: { color: "#D8E8E2", hoverColor: "#CCE1DA", activeColor: "#BFD9D0", minWidth: 26, round: 6 }, // the accent on the field at 22 %, 30 %, 38 %
|
|
874
|
+
handle: { width: 4, height: 18, inset: 11, color: "#3D7A6B", hoverColor: "#356C5E", activeColor: "#2E5F53", round: 2 },
|
|
875
|
+
tick: { size: 3, color: Black(0.15), minSpace: 9 },
|
|
876
|
+
label: { fontSize: 15, textColor: Black(0.55), fontFamily: "", padding: 14 },
|
|
877
|
+
value: { fontSize: 15, textColor: Black(0.88), fontFamily: "opensans-bold", padding: 14 },
|
|
878
|
+
input: { color: "#FFFFFF", textColor: Black(0.88), round: 6 },
|
|
879
|
+
disabled: { opacity: 0.45, filter: "none" },
|
|
880
|
+
},
|
|
881
|
+
|
|
882
|
+
// The dark look of the kit: the same shapes on the dark surface.
|
|
883
|
+
dark: {
|
|
884
|
+
box: { color: "#232322", hoverColor: "", border: 1, borderColor: White(0.08), round: 6, boxShadow: "none" },
|
|
885
|
+
boxFocus: { borderColor: "#65A293", ringColor: "rgba(101, 162, 147, 0.55)", ringWidth: 2 },
|
|
886
|
+
fill: { color: "rgba(101, 162, 147, 0.22)", hoverColor: "rgba(101, 162, 147, 0.28)", activeColor: "rgba(101, 162, 147, 0.34)", minWidth: 26, round: 6 },
|
|
887
|
+
handle: { width: 4, height: 18, inset: 11, color: "#65A293", hoverColor: "#74B0A2", activeColor: "#8CC2B5", round: 2 },
|
|
888
|
+
tick: { size: 3, color: White(0.2), minSpace: 9 },
|
|
889
|
+
label: { fontSize: 15, textColor: White(0.55), fontFamily: "", padding: 14 },
|
|
890
|
+
value: { fontSize: 15, textColor: White(0.9), fontFamily: "opensans-bold", padding: 14 },
|
|
891
|
+
input: { color: White(0.08), textColor: White(0.9), round: 6 },
|
|
892
|
+
disabled: { opacity: 0.4, filter: "none" },
|
|
893
|
+
},
|
|
894
|
+
|
|
895
|
+
// For general use: the colors of SmartButton and of ProgressBar
|
|
896
|
+
// ozden. The fill is a cyan SmartButton ozden (an edge and a line at its bottom) that ends with a white knob,
|
|
897
|
+
// straight inside the field. The label is always on the fill (aroundLabel) and the value never (beforeValue): the
|
|
898
|
+
// end of the fill cuts no text. A ring for the keyboard focus, a gray fill when it is off.
|
|
899
|
+
// Another tone: style: { fill: { color, hoverColor, activeColor } }.
|
|
900
|
+
// handle.inset -6: the middle of the knob is at the end of the fill. WHY a dark focus ring: the focus color of the
|
|
901
|
+
// kit (cadetblue) did not show on the cyan fill; black 50 % has a contrast of 3 on the fill and on the field.
|
|
902
|
+
ozden: {
|
|
903
|
+
box: { color: "#F2F2F2", hoverColor: "#EDEDED", border: 1, borderColor: "rgba(0, 0, 0, 0.12)", round: 8, boxShadow: "none" },
|
|
904
|
+
boxFocus: { borderColor: "rgba(0, 0, 0, 0.5)", ringColor: "rgba(0, 0, 0, 0.5)", ringWidth: 2 },
|
|
905
|
+
fill: { color: "#5BBAC1", hoverColor: "#50AEB5", activeColor: "#4AA5AC", minWidth: 28, round: 7, innerRound: 0, aroundLabel: 1, labelSpace: 16, beforeValue: 1, valueSpace: 16, border: 1, borderColor: "rgba(0, 0, 0, 0.35)", boxShadow: "inset 0 -2px 0 rgba(0, 0, 0, 0.25)" },
|
|
906
|
+
handle: { width: 12, height: 30, inset: -6, color: "#FFFFFF", hoverColor: "#FFFFFF", activeColor: "#F2F2F2", round: 4, border: 1, borderColor: "rgba(0, 0, 0, 0.35)", boxShadow: "inset 0 -2px 0 rgba(0, 0, 0, 0.25)" },
|
|
907
|
+
tick: { size: 4, color: "rgba(0, 0, 0, 0.2)", minSpace: 10 },
|
|
908
|
+
label: { fontSize: 16, textColor: "rgba(0, 0, 0, 0.7)", fontFamily: "", padding: 14 },
|
|
909
|
+
value: { fontSize: 16, textColor: "rgba(0, 0, 0, 0.8)", fontFamily: "opensans-bold", padding: 14 },
|
|
910
|
+
input: { color: "#FFFFFF", textColor: "rgba(0, 0, 0, 0.8)", round: 6 },
|
|
911
|
+
disabled: { opacity: 0.55, filter: "grayscale(1)" },
|
|
912
|
+
},
|
|
749
913
|
|
|
750
914
|
// Cadetblue fill. Same colors as the modern CheckBox, RadioButton, ProgressBar, Tabs and Stepper.
|
|
751
915
|
modern: {
|
|
@@ -760,17 +924,29 @@ SliderField.styles = {
|
|
|
760
924
|
disabled: { opacity: 0.5 },
|
|
761
925
|
},
|
|
762
926
|
|
|
763
|
-
// Dark theme, same colors as SelectBox, TagInput, Tabs and Stepper "dark".
|
|
764
|
-
dark: {
|
|
765
|
-
box: { color: "#232322", border: 1, borderColor: "rgba(255, 255, 255, 0.08)", round: 12 },
|
|
766
|
-
boxFocus: { borderColor: "#65A293" },
|
|
767
|
-
fill: { color: "rgba(255, 255, 255, 0.09)", hoverColor: "rgba(255, 255, 255, 0.12)", activeColor: "rgba(255, 255, 255, 0.16)", minWidth: 26, round: 11 },
|
|
768
|
-
handle: { width: 3, height: 16, inset: 11, color: "rgba(255, 255, 255, 0.35)", hoverColor: "rgba(255, 255, 255, 0.55)", activeColor: "#65A293", round: 2 },
|
|
769
|
-
tick: { size: 3, color: "rgba(255, 255, 255, 0.22)", minSpace: 9 },
|
|
770
|
-
label: { fontSize: 15, textColor: "rgba(255, 255, 255, 0.50)", fontFamily: "", padding: 14 },
|
|
771
|
-
value: { fontSize: 15, textColor: "rgba(255, 255, 255, 0.90)", fontFamily: "", padding: 16 },
|
|
772
|
-
input: { color: "rgba(255, 255, 255, 0.08)", textColor: "rgba(255, 255, 255, 0.90)", round: 6 },
|
|
773
|
-
disabled: { opacity: 0.4 },
|
|
774
|
-
},
|
|
775
|
-
|
|
776
927
|
};
|
|
928
|
+
SliderField.styles.classic = SliderField.styles.light; // the old name of light
|
|
929
|
+
|
|
930
|
+
// The minimal theme (_designs/minimal-theme.htm): a 28 px field with no fill and an edge of 3:1 at least (it is a
|
|
931
|
+
// control), a faint gray fill for the value, a thin handle that darkens under the mouse and is ink while it is dragged,
|
|
932
|
+
// a 12 px label and a 13 px value. WHY aroundLabel and beforeValue: the thin handle never crosses a text. The keyboard focus: a blue edge of 2 px. minimalDark: the same on a dark window.
|
|
933
|
+
SliderField.createMinimalStyle = function (colors) {
|
|
934
|
+
return {
|
|
935
|
+
height: 28,
|
|
936
|
+
style: {
|
|
937
|
+
box: { color: "transparent", hoverColor: "", border: 1, borderColor: colors.edge, round: 4, boxShadow: "none" },
|
|
938
|
+
boxFocus: { borderColor: colors.focus, ringColor: colors.focus, ringWidth: 1 },
|
|
939
|
+
fill: { color: colors.fill, hoverColor: colors.fillHover, activeColor: colors.fillActive, minWidth: 20, round: 3, innerRound: 0, aroundLabel: 1, labelSpace: 16, beforeValue: 1, valueSpace: 6, border: 0, borderColor: "transparent", boxShadow: "none" },
|
|
940
|
+
handle: { width: 2, height: 12, inset: 6, color: colors.edge, hoverColor: colors.edgeHover, activeColor: colors.ink, round: 1, border: 0, borderColor: "transparent", boxShadow: "none" },
|
|
941
|
+
tick: { size: 2, color: colors.line, minSpace: 8 },
|
|
942
|
+
label: { fontSize: 12, textColor: colors.softText, fontFamily: "", padding: 10 },
|
|
943
|
+
value: { fontSize: 13, textColor: colors.text, fontFamily: "", padding: 10 },
|
|
944
|
+
input: { color: colors.ground, textColor: colors.text, round: 3 },
|
|
945
|
+
disabled: { opacity: 0.4, filter: "none" },
|
|
946
|
+
},
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
SliderField.MINIMAL_COLORS = { ground: "#FFFFFF", text: Black(0.85), softText: Black(0.55), line: Black(0.2), edge: Black(0.45), edgeHover: Black(0.65), ink: "#1F1F1F", fill: Black(0.06), fillHover: Black(0.08), fillActive: Black(0.11), focus: "#3D8BD9" };
|
|
950
|
+
SliderField.styles.minimal = SliderField.createMinimalStyle(SliderField.MINIMAL_COLORS);
|
|
951
|
+
SliderField.MINIMAL_DARK_COLORS = { ground: "#1A1A19", text: White(0.88), softText: White(0.55), line: White(0.18), edge: White(0.42), edgeHover: White(0.62), ink: "#EDEDEB", fill: White(0.08), fillHover: White(0.11), fillActive: White(0.14), focus: "#7FB6DE" };
|
|
952
|
+
SliderField.styles.minimalDark = SliderField.createMinimalStyle(SliderField.MINIMAL_DARK_COLORS);
|