create-basicjs 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/create-basicjs.js +2 -2
- package/bin/verify-package.js +16 -0
- package/package.json +4 -1
- package/payload/starter/AGENTS.md +82 -0
- package/payload/starter/CLAUDE.md +1 -0
- package/payload/starter/README.md +45 -0
- package/payload/starter/_basic/VERSION +1 -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-cup.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/data-table/palette.svg +2 -0
- package/payload/starter/_basic/assets/data-table/people.js +104 -0
- package/payload/starter/_basic/assets/data-table/trash.svg +2 -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/assets/icons/alert-black.png +0 -0
- package/payload/starter/_basic/assets/icons/alert.png +0 -0
- package/payload/starter/_basic/assets/icons/arrow-drop.svg +3 -0
- package/payload/starter/_basic/assets/icons/arrow-rise.svg +3 -0
- package/payload/starter/_basic/assets/icons/close.svg +1 -0
- package/payload/starter/_basic/assets/icons/lamp-on.png +0 -0
- package/payload/starter/_basic/assets/icons/lamp.png +0 -0
- package/payload/starter/_basic/assets/icons/lock.png +0 -0
- package/payload/starter/_basic/assets/icons/panel.png +0 -0
- package/payload/starter/_basic/assets/icons/plant.png +0 -0
- package/payload/starter/_basic/assets/icons/trash.png +0 -0
- package/payload/starter/_basic/assets/icons/trash.svg +2 -0
- package/payload/starter/_basic/assets/tab-bar/settings.png +0 -0
- package/payload/starter/_basic/assets/tab-bar/status.png +0 -0
- package/payload/starter/_basic/assets/tab-bar/transactions.png +0 -0
- package/payload/starter/_basic/assets/tutorial/blueberries.png +0 -0
- package/payload/starter/_basic/assets/tutorial/carrot.png +0 -0
- package/payload/starter/_basic/assets/tutorial/olives.png +0 -0
- package/payload/starter/_basic/assets/tutorial/strawberry.png +0 -0
- package/payload/starter/_basic/assets/ui-bottom-bar/setting.svg +11 -0
- package/payload/starter/_basic/basic/LICENSE +14 -0
- package/payload/starter/_basic/basic/basic.css +277 -0
- package/payload/starter/_basic/basic/basic.js +3767 -0
- package/payload/starter/_basic/basic/basic.min.css +1 -0
- package/payload/starter/_basic/basic/basic.min.js +65 -0
- package/payload/starter/_basic/basic/font/open-sans/LICENSE.txt +206 -0
- package/payload/starter/_basic/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
- package/payload/starter/_basic/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
- package/payload/starter/_basic/basic/scroll-bar.js +536 -0
- package/payload/starter/_basic/basic/scroll-bar.min.js +2 -0
- package/payload/starter/_basic/comp/action-button/add.png +0 -0
- package/payload/starter/_basic/comp/action-button.js +522 -0
- package/payload/starter/_basic/comp/action-tab-bar.js +383 -0
- package/payload/starter/_basic/comp/app-bar.js +236 -0
- package/payload/starter/_basic/comp/badge-v2.js +246 -0
- package/payload/starter/_basic/comp/bottom-bar.js +547 -0
- package/payload/starter/_basic/comp/breadcrumbs.js +522 -0
- package/payload/starter/_basic/comp/chart-box/chart-4.5.1.umd.min.js +13 -0
- package/payload/starter/_basic/comp/chart-box/chart-js-LICENSE.md +9 -0
- package/payload/starter/_basic/comp/chart-box.js +868 -0
- package/payload/starter/_basic/comp/check-box.js +374 -0
- package/payload/starter/_basic/comp/context-menu.js +634 -0
- package/payload/starter/_basic/comp/currency-input-b.js +190 -0
- package/payload/starter/_basic/comp/data-table/arrow.svg +2 -0
- package/payload/starter/_basic/comp/data-table.js +865 -0
- package/payload/starter/_basic/comp/dialog.js +854 -0
- package/payload/starter/_basic/comp/email-input-b.js +57 -0
- package/payload/starter/_basic/comp/filters.js +493 -0
- package/payload/starter/_basic/comp/form.js +590 -0
- package/payload/starter/_basic/comp/full-screen-select/arrow.svg +2 -0
- package/payload/starter/_basic/comp/full-screen-select/cancel.svg +2 -0
- package/payload/starter/_basic/comp/full-screen-select.js +611 -0
- package/payload/starter/_basic/comp/gauge.js +435 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button/trash-red.png +0 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button/trash.png +0 -0
- package/payload/starter/_basic/comp/hold-to-confirm-button.js +280 -0
- package/payload/starter/_basic/comp/input-b.js +759 -0
- package/payload/starter/_basic/comp/item-list.js +1396 -0
- package/payload/starter/_basic/comp/label-editor.js +1137 -0
- package/payload/starter/_basic/comp/left-menu/_Material Symbols & Icons - Google Fonts.webloc +8 -0
- package/payload/starter/_basic/comp/left-menu/data-table.png +0 -0
- package/payload/starter/_basic/comp/left-menu/home.png +0 -0
- package/payload/starter/_basic/comp/left-menu/reports.png +0 -0
- package/payload/starter/_basic/comp/left-menu/setting.png +0 -0
- package/payload/starter/_basic/comp/left-menu.js +476 -0
- package/payload/starter/_basic/comp/line-progress-bar.js +192 -0
- package/payload/starter/_basic/comp/loading-screen.js +382 -0
- package/payload/starter/_basic/comp/login-page-v2.js +586 -0
- package/payload/starter/_basic/comp/mini-graph-box.js +483 -0
- package/payload/starter/_basic/comp/notice.js +227 -0
- package/payload/starter/_basic/comp/number-input-b.js +121 -0
- package/payload/starter/_basic/comp/numeric-keyboard.js +296 -0
- package/payload/starter/_basic/comp/page-control.js +745 -0
- package/payload/starter/_basic/comp/page-header.js +190 -0
- package/payload/starter/_basic/comp/password-input-b/hide-btn.png +0 -0
- package/payload/starter/_basic/comp/password-input-b/hide-btn2.png +0 -0
- package/payload/starter/_basic/comp/password-input-b/show-btn.png +0 -0
- package/payload/starter/_basic/comp/password-input-b/show-btn2.png +0 -0
- package/payload/starter/_basic/comp/password-input-b.js +164 -0
- package/payload/starter/_basic/comp/period-bar.js +435 -0
- package/payload/starter/_basic/comp/phone-input-b.js +287 -0
- package/payload/starter/_basic/comp/progress-bar.js +676 -0
- package/payload/starter/_basic/comp/property-panel.js +2740 -0
- package/payload/starter/_basic/comp/radio-button.js +467 -0
- package/payload/starter/_basic/comp/rich-text-editor.js +1061 -0
- package/payload/starter/_basic/comp/scrolling-text.js +296 -0
- package/payload/starter/_basic/comp/search-input-v2/clear-round.svg +1 -0
- package/payload/starter/_basic/comp/search-input-v2/clear.svg +1 -0
- package/payload/starter/_basic/comp/search-input-v2/filter.png +0 -0
- package/payload/starter/_basic/comp/search-input-v2/filter.svg +1 -0
- package/payload/starter/_basic/comp/search-input-v2/search.svg +1 -0
- package/payload/starter/_basic/comp/search-input-v2.js +427 -0
- package/payload/starter/_basic/comp/search-results.js +560 -0
- package/payload/starter/_basic/comp/select-box.js +1740 -0
- package/payload/starter/_basic/comp/select-color.js +603 -0
- package/payload/starter/_basic/comp/select-date.js +1003 -0
- package/payload/starter/_basic/comp/select-file.js +732 -0
- package/payload/starter/_basic/comp/select-time.js +979 -0
- package/payload/starter/_basic/comp/settings-row.js +298 -0
- package/payload/starter/_basic/comp/side-panel.js +573 -0
- package/payload/starter/_basic/comp/slider-field.js +776 -0
- package/payload/starter/_basic/comp/slider.js +368 -0
- package/payload/starter/_basic/comp/smart-button/alert-black.png +0 -0
- package/payload/starter/_basic/comp/smart-button/clock.png +0 -0
- package/payload/starter/_basic/comp/smart-button.js +896 -0
- package/payload/starter/_basic/comp/smart-table/clock.png +0 -0
- package/payload/starter/_basic/comp/smart-table/down.png +0 -0
- package/payload/starter/_basic/comp/smart-table/scroll.png +0 -0
- package/payload/starter/_basic/comp/smart-table/sort.png +0 -0
- package/payload/starter/_basic/comp/smart-table/up.png +0 -0
- package/payload/starter/_basic/comp/smart-table.js +1321 -0
- package/payload/starter/_basic/comp/sortable-list.js +1172 -0
- package/payload/starter/_basic/comp/spark-line-box.js +729 -0
- package/payload/starter/_basic/comp/stepper.js +699 -0
- package/payload/starter/_basic/comp/tabs.js +1317 -0
- package/payload/starter/_basic/comp/tag-input.js +1067 -0
- package/payload/starter/_basic/comp/tap-effect.js +168 -0
- package/payload/starter/_basic/comp/textarea-b.js +184 -0
- package/payload/starter/_basic/comp/time-line.js +324 -0
- package/payload/starter/_basic/comp/tiny-select/arrow.svg +1 -0
- package/payload/starter/_basic/comp/tiny-select.js +282 -0
- package/payload/starter/_basic/comp/tiny-table.js +279 -0
- package/payload/starter/_basic/comp/toast.js +838 -0
- package/payload/starter/_basic/comp/toggle.js +636 -0
- package/payload/starter/_basic/comp/tooltip.js +471 -0
- package/payload/starter/_basic/comp/tree-view.js +1096 -0
- package/payload/starter/_basic/comp/ui-effects.js +1091 -0
- package/payload/starter/_basic/comp/ui-standards.js +402 -0
- package/payload/starter/_basic/comp/url-input-b.js +145 -0
- package/payload/starter/_basic/comp/web-view.js +534 -0
- package/payload/starter/_basic/docs/basic-js-animated-rules.md +90 -0
- package/payload/starter/_basic/docs/basic-js-code-rules.md +91 -0
- package/payload/starter/_basic/docs/basic-js-components.md +134 -0
- package/payload/starter/_basic/docs/basic-js-core.md +131 -0
- package/payload/starter/_basic/docs/component-index.md +522 -0
- package/payload/starter/_basic/docs/component-template.js +416 -0
- package/payload/starter/_basic/docs/handbook/00-introduction.md +125 -0
- package/payload/starter/_basic/docs/handbook/00-what-is-new.md +96 -0
- package/payload/starter/_basic/docs/handbook/01-label.md +104 -0
- package/payload/starter/_basic/docs/handbook/02-box.md +166 -0
- package/payload/starter/_basic/docs/handbook/03-image.md +81 -0
- package/payload/starter/_basic/docs/handbook/04-common-properties.md +159 -0
- package/payload/starter/_basic/docs/handbook/05-autolayout.md +332 -0
- package/payload/starter/_basic/docs/handbook/06-button.md +103 -0
- package/payload/starter/_basic/docs/handbook/07-input.md +78 -0
- package/payload/starter/_basic/docs/handbook/08-page.md +120 -0
- package/payload/starter/_basic/docs/handbook/09-useful-examples.md +309 -0
- package/payload/starter/_basic/docs/handbook/10-motion.md +132 -0
- package/payload/starter/_basic/docs/handbook/11-other-functions.md +92 -0
- package/payload/starter/_basic/docs/handbook/12-utilities.md +123 -0
- package/payload/starter/_basic/docs/handbook/13-sound.md +88 -0
- package/payload/starter/_basic/docs/what-is-new.md +402 -0
- package/payload/starter/_basic/examples/action-button.htm +81 -0
- package/payload/starter/_basic/examples/action-tab-bar.htm +97 -0
- package/payload/starter/_basic/examples/app-bar.htm +140 -0
- package/payload/starter/_basic/examples/badgeV2.htm +68 -0
- package/payload/starter/_basic/examples/bottom-bar/grid.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/grids.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/home.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/homes.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon1.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon1s.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon2.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon2s.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon3.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon3s.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon4.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/icon4s.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/search.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/searchs.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/settings.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/settingss.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/tasks.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar/taskss.png +0 -0
- package/payload/starter/_basic/examples/bottom-bar-2.htm +187 -0
- package/payload/starter/_basic/examples/bottom-bar.htm +46 -0
- package/payload/starter/_basic/examples/breadcrumbs.htm +284 -0
- package/payload/starter/_basic/examples/chart-box.htm +287 -0
- package/payload/starter/_basic/examples/check-box-1.htm +220 -0
- package/payload/starter/_basic/examples/check-box-2.htm +212 -0
- package/payload/starter/_basic/examples/check-box-3.htm +179 -0
- package/payload/starter/_basic/examples/context-menu.htm +269 -0
- package/payload/starter/_basic/examples/currency-input-b.htm +71 -0
- package/payload/starter/_basic/examples/data-table-2.htm +67 -0
- package/payload/starter/_basic/examples/data-table-3.htm +72 -0
- package/payload/starter/_basic/examples/data-table-4.htm +144 -0
- package/payload/starter/_basic/examples/data-table-5.htm +152 -0
- package/payload/starter/_basic/examples/data-table.htm +178 -0
- package/payload/starter/_basic/examples/dialog-centered.htm +130 -0
- package/payload/starter/_basic/examples/dialog.htm +209 -0
- package/payload/starter/_basic/examples/email-input-b.htm +67 -0
- package/payload/starter/_basic/examples/filters.htm +115 -0
- package/payload/starter/_basic/examples/form-1.htm +123 -0
- package/payload/starter/_basic/examples/full-screen-select.htm +114 -0
- package/payload/starter/_basic/examples/gauge.htm +133 -0
- package/payload/starter/_basic/examples/hold-to-confirm-button.htm +144 -0
- package/payload/starter/_basic/examples/input-b-ex1.htm +132 -0
- package/payload/starter/_basic/examples/input-b-ex2.htm +136 -0
- package/payload/starter/_basic/examples/input-b-ex3-style.htm +113 -0
- package/payload/starter/_basic/examples/input-b-ex4-custom-unit.htm +112 -0
- package/payload/starter/_basic/examples/input-b-ex5-warning-icon.htm +80 -0
- package/payload/starter/_basic/examples/input-b-ex6-dark.htm +108 -0
- package/payload/starter/_basic/examples/input-b-ex7-ozden.htm +153 -0
- package/payload/starter/_basic/examples/item-list-2.htm +253 -0
- package/payload/starter/_basic/examples/item-list.htm +176 -0
- package/payload/starter/_basic/examples/label-editor.htm +196 -0
- package/payload/starter/_basic/examples/left-menu.htm +81 -0
- package/payload/starter/_basic/examples/line-progress-bar.htm +145 -0
- package/payload/starter/_basic/examples/loading-screen.htm +217 -0
- package/payload/starter/_basic/examples/login-page-dark-v2.htm +269 -0
- package/payload/starter/_basic/examples/login-page-v2.htm +269 -0
- package/payload/starter/_basic/examples/mini-graph-box.htm +229 -0
- package/payload/starter/_basic/examples/notice.htm +79 -0
- package/payload/starter/_basic/examples/number-input-b.htm +68 -0
- package/payload/starter/_basic/examples/numeric-keyboard.htm +100 -0
- package/payload/starter/_basic/examples/page-control.htm +262 -0
- package/payload/starter/_basic/examples/page-header.htm +117 -0
- package/payload/starter/_basic/examples/password-input-b.htm +70 -0
- package/payload/starter/_basic/examples/period-bar.htm +94 -0
- package/payload/starter/_basic/examples/phone-input-b-select-country.htm +298 -0
- package/payload/starter/_basic/examples/phone-input-b.htm +72 -0
- package/payload/starter/_basic/examples/progress-bar-ozden.htm +168 -0
- package/payload/starter/_basic/examples/progress-bar.htm +296 -0
- package/payload/starter/_basic/examples/property-panel.htm +216 -0
- package/payload/starter/_basic/examples/radio-button-1.htm +264 -0
- package/payload/starter/_basic/examples/radio-button-2.htm +256 -0
- package/payload/starter/_basic/examples/radio-button-3.htm +168 -0
- package/payload/starter/_basic/examples/rich-text-editor.htm +228 -0
- package/payload/starter/_basic/examples/scrolling-text.htm +75 -0
- package/payload/starter/_basic/examples/search-input-v2-ozden.htm +128 -0
- package/payload/starter/_basic/examples/search-input-v2-place.htm +80 -0
- package/payload/starter/_basic/examples/search-input-v2.htm +65 -0
- package/payload/starter/_basic/examples/search-results.htm +193 -0
- package/payload/starter/_basic/examples/select-box-ozden-item.htm +114 -0
- package/payload/starter/_basic/examples/select-box-ozden-text.htm +64 -0
- package/payload/starter/_basic/examples/select-box.htm +254 -0
- package/payload/starter/_basic/examples/select-color.htm +215 -0
- package/payload/starter/_basic/examples/select-date.htm +244 -0
- package/payload/starter/_basic/examples/select-file.htm +268 -0
- package/payload/starter/_basic/examples/select-time.htm +249 -0
- package/payload/starter/_basic/examples/settings-row.htm +193 -0
- package/payload/starter/_basic/examples/side-panel-2.htm +270 -0
- package/payload/starter/_basic/examples/side-panel.htm +219 -0
- package/payload/starter/_basic/examples/slider-field.htm +223 -0
- package/payload/starter/_basic/examples/slider.htm +180 -0
- package/payload/starter/_basic/examples/smart-button-2.htm +220 -0
- package/payload/starter/_basic/examples/smart-button-3-ozden.htm +320 -0
- package/payload/starter/_basic/examples/smart-button-4-dark.htm +102 -0
- package/payload/starter/_basic/examples/smart-button-5-features.htm +205 -0
- package/payload/starter/_basic/examples/smart-button.htm +252 -0
- package/payload/starter/_basic/examples/smart-table-1.htm +142 -0
- package/payload/starter/_basic/examples/smart-table-2.htm +191 -0
- package/payload/starter/_basic/examples/smart-table-3.htm +359 -0
- package/payload/starter/_basic/examples/smart-table-4.htm +158 -0
- package/payload/starter/_basic/examples/sortable-list.htm +250 -0
- package/payload/starter/_basic/examples/spark-line-box.htm +285 -0
- package/payload/starter/_basic/examples/stepper-2.htm +172 -0
- package/payload/starter/_basic/examples/stepper.htm +255 -0
- package/payload/starter/_basic/examples/tabs-2/coffee.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i1-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i1.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i2-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i2.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i3-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i3.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i4-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i4.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i5-white.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/i5.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/lamp-on.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/lamp.png +0 -0
- package/payload/starter/_basic/examples/tabs-2/search.svg +2 -0
- package/payload/starter/_basic/examples/tabs-2.htm +188 -0
- package/payload/starter/_basic/examples/tabs.htm +300 -0
- package/payload/starter/_basic/examples/tag-input.htm +242 -0
- package/payload/starter/_basic/examples/tap-effect.htm +100 -0
- package/payload/starter/_basic/examples/textarea-b.htm +76 -0
- package/payload/starter/_basic/examples/time-line.htm +226 -0
- package/payload/starter/_basic/examples/tiny-select.htm +86 -0
- package/payload/starter/_basic/examples/tiny-table.htm +109 -0
- package/payload/starter/_basic/examples/toast.htm +262 -0
- package/payload/starter/_basic/examples/toggle-2.htm +163 -0
- package/payload/starter/_basic/examples/toggle-3.htm +218 -0
- package/payload/starter/_basic/examples/toggle.htm +93 -0
- package/payload/starter/_basic/examples/tooltip-2.htm +177 -0
- package/payload/starter/_basic/examples/tooltip-3.htm +212 -0
- package/payload/starter/_basic/examples/tooltip.htm +124 -0
- package/payload/starter/_basic/examples/tree-view.htm +285 -0
- package/payload/starter/_basic/examples/ui-effects.htm +463 -0
- package/payload/starter/_basic/examples/ui-standards.htm +261 -0
- package/payload/starter/_basic/examples/unfinished-login-page-dark-supabase.htm +221 -0
- package/payload/starter/_basic/examples/unfinished-login-page-supabase.htm +221 -0
- package/payload/starter/_basic/examples/url-input-b.htm +85 -0
- package/payload/starter/_basic/examples/web-view.htm +241 -0
- package/payload/starter/_basic/min/action-button.min.js +2 -0
- package/payload/starter/_basic/min/action-tab-bar.min.js +2 -0
- package/payload/starter/_basic/min/app-bar.min.js +2 -0
- package/payload/starter/_basic/min/badge-v2.min.js +2 -0
- package/payload/starter/_basic/min/bottom-bar.min.js +2 -0
- package/payload/starter/_basic/min/breadcrumbs.min.js +2 -0
- package/payload/starter/_basic/min/chart-box.min.js +2 -0
- package/payload/starter/_basic/min/check-box.min.js +2 -0
- package/payload/starter/_basic/min/context-menu.min.js +2 -0
- package/payload/starter/_basic/min/currency-input-b.min.js +2 -0
- package/payload/starter/_basic/min/data-table.min.js +2 -0
- package/payload/starter/_basic/min/dialog.min.js +2 -0
- package/payload/starter/_basic/min/email-input-b.min.js +2 -0
- package/payload/starter/_basic/min/filters.min.js +2 -0
- package/payload/starter/_basic/min/form.min.js +2 -0
- package/payload/starter/_basic/min/full-screen-select.min.js +2 -0
- package/payload/starter/_basic/min/gauge.min.js +2 -0
- package/payload/starter/_basic/min/hold-to-confirm-button.min.js +2 -0
- package/payload/starter/_basic/min/input-b.min.js +2 -0
- package/payload/starter/_basic/min/item-list.min.js +2 -0
- package/payload/starter/_basic/min/label-editor.min.js +2 -0
- package/payload/starter/_basic/min/left-menu.min.js +2 -0
- package/payload/starter/_basic/min/line-progress-bar.min.js +2 -0
- package/payload/starter/_basic/min/loading-screen.min.js +2 -0
- package/payload/starter/_basic/min/login-page-v2.min.js +2 -0
- package/payload/starter/_basic/min/mini-graph-box.min.js +2 -0
- package/payload/starter/_basic/min/notice.min.js +2 -0
- package/payload/starter/_basic/min/number-input-b.min.js +2 -0
- package/payload/starter/_basic/min/numeric-keyboard.min.js +2 -0
- package/payload/starter/_basic/min/page-control.min.js +2 -0
- package/payload/starter/_basic/min/page-header.min.js +2 -0
- package/payload/starter/_basic/min/password-input-b.min.js +2 -0
- package/payload/starter/_basic/min/period-bar.min.js +2 -0
- package/payload/starter/_basic/min/phone-input-b.min.js +2 -0
- package/payload/starter/_basic/min/progress-bar.min.js +2 -0
- package/payload/starter/_basic/min/property-panel.min.js +2 -0
- package/payload/starter/_basic/min/radio-button.min.js +2 -0
- package/payload/starter/_basic/min/rich-text-editor.min.js +2 -0
- package/payload/starter/_basic/min/scrolling-text.min.js +2 -0
- package/payload/starter/_basic/min/search-input-v2.min.js +2 -0
- package/payload/starter/_basic/min/search-results.min.js +2 -0
- package/payload/starter/_basic/min/select-box.min.js +2 -0
- package/payload/starter/_basic/min/select-color.min.js +2 -0
- package/payload/starter/_basic/min/select-date.min.js +2 -0
- package/payload/starter/_basic/min/select-file.min.js +2 -0
- package/payload/starter/_basic/min/select-time.min.js +2 -0
- package/payload/starter/_basic/min/settings-row.min.js +2 -0
- package/payload/starter/_basic/min/side-panel.min.js +2 -0
- package/payload/starter/_basic/min/slider-field.min.js +2 -0
- package/payload/starter/_basic/min/slider.min.js +2 -0
- package/payload/starter/_basic/min/smart-button.min.js +2 -0
- package/payload/starter/_basic/min/smart-table.min.js +2 -0
- package/payload/starter/_basic/min/sortable-list.min.js +2 -0
- package/payload/starter/_basic/min/spark-line-box.min.js +2 -0
- package/payload/starter/_basic/min/stepper.min.js +2 -0
- package/payload/starter/_basic/min/tabs.min.js +2 -0
- package/payload/starter/_basic/min/tag-input.min.js +2 -0
- package/payload/starter/_basic/min/tap-effect.min.js +2 -0
- package/payload/starter/_basic/min/textarea-b.min.js +2 -0
- package/payload/starter/_basic/min/time-line.min.js +2 -0
- package/payload/starter/_basic/min/tiny-select.min.js +2 -0
- package/payload/starter/_basic/min/tiny-table.min.js +2 -0
- package/payload/starter/_basic/min/toast.min.js +2 -0
- package/payload/starter/_basic/min/toggle.min.js +2 -0
- package/payload/starter/_basic/min/tooltip.min.js +2 -0
- package/payload/starter/_basic/min/tree-view.min.js +2 -0
- package/payload/starter/_basic/min/ui-effects.min.js +2 -0
- package/payload/starter/_basic/min/ui-standards.min.js +2 -0
- package/payload/starter/_basic/min/url-input-b.min.js +2 -0
- package/payload/starter/_basic/min/web-view.min.js +2 -0
- package/payload/starter/_basic/tools/build.js +175 -0
- package/payload/starter/_basic/tools/check.js +318 -0
- package/payload/starter/app/app.js +27 -0
- package/payload/starter/assets/.gitkeep +0 -0
- package/payload/starter/gitignore +3 -0
- package/payload/starter/index.htm +23 -0
- package/payload/templates/booking/TEMPLATE.md +77 -0
- package/payload/templates/booking/app/app.js +722 -0
- package/payload/templates/booking/app/settings.js +52 -0
- package/payload/templates/booking/app/store.js +265 -0
- package/payload/templates/booking/app/texts.js +148 -0
- package/payload/templates/booking/assets/app-icon.svg +1 -0
- package/payload/templates/booking/assets/tabs/account.svg +1 -0
- package/payload/templates/booking/assets/tabs/appointments.svg +1 -0
- package/payload/templates/booking/assets/tabs/home.svg +1 -0
- package/payload/templates/booking/assets/tabs/services.svg +1 -0
- package/payload/templates/booking/components/booking-ui.js +252 -0
- package/payload/templates/booking/index.htm +53 -0
- package/payload/templates/booking/pages/account.js +124 -0
- package/payload/templates/booking/pages/appointments.js +141 -0
- package/payload/templates/booking/pages/book.js +231 -0
- package/payload/templates/booking/pages/home.js +99 -0
- package/payload/templates/booking/pages/services.js +79 -0
- package/payload/templates/classic/TEMPLATE.md +104 -0
- package/payload/templates/classic/app/app.js +779 -0
- package/payload/templates/classic/app/settings.js +77 -0
- package/payload/templates/classic/assets/_attribute.txt +37 -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-cup.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/assets/example-tabs/coffee.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i1-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i1.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i2-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i2.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i3-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i3.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i4-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i4.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i5-white.png +0 -0
- package/payload/templates/classic/assets/example-tabs/i5.png +0 -0
- package/payload/templates/classic/assets/example-tabs/lamp-on.png +0 -0
- package/payload/templates/classic/assets/example-tabs/lamp.png +0 -0
- package/payload/templates/classic/assets/example-tabs/search.svg +2 -0
- package/payload/templates/classic/assets/files/ai.png +0 -0
- package/payload/templates/classic/assets/files/doc.png +0 -0
- package/payload/templates/classic/assets/files/folder.png +0 -0
- package/payload/templates/classic/assets/files/js.png +0 -0
- package/payload/templates/classic/assets/files/pdf.png +0 -0
- package/payload/templates/classic/assets/files/txt.png +0 -0
- package/payload/templates/classic/assets/files/xls.png +0 -0
- package/payload/templates/classic/assets/icons/arrow-drop.svg +3 -0
- package/payload/templates/classic/assets/icons/arrow-rise.svg +3 -0
- package/payload/templates/classic/assets/icons/download.svg +18 -0
- package/payload/templates/classic/assets/icons/lamp-on.png +0 -0
- package/payload/templates/classic/assets/icons/lamp.png +0 -0
- package/payload/templates/classic/assets/icons/lock-small.png +0 -0
- package/payload/templates/classic/assets/icons/lock.png +0 -0
- package/payload/templates/classic/assets/icons/logo.png +0 -0
- package/payload/templates/classic/assets/icons/trash-red.svg +2 -0
- package/payload/templates/classic/assets/icons/trash.svg +2 -0
- package/payload/templates/classic/assets/menu/t1.png +0 -0
- package/payload/templates/classic/assets/menu/t10.png +0 -0
- package/payload/templates/classic/assets/menu/t11.png +0 -0
- package/payload/templates/classic/assets/menu/t2.png +0 -0
- package/payload/templates/classic/assets/menu/t3.png +0 -0
- package/payload/templates/classic/assets/menu/t4.png +0 -0
- package/payload/templates/classic/assets/menu/t5.png +0 -0
- package/payload/templates/classic/assets/menu/t6.png +0 -0
- package/payload/templates/classic/assets/menu/t7.png +0 -0
- package/payload/templates/classic/assets/menu/t8.png +0 -0
- package/payload/templates/classic/assets/menu/t9.png +0 -0
- package/payload/templates/classic/assets/products/brokoli.png +0 -0
- package/payload/templates/classic/assets/products/cilek.png +0 -0
- package/payload/templates/classic/assets/products/domates.png +0 -0
- package/payload/templates/classic/assets/products/elma.png +0 -0
- package/payload/templates/classic/assets/products/havuc.png +0 -0
- package/payload/templates/classic/assets/products/karpuz.png +0 -0
- package/payload/templates/classic/assets/products/limon.png +0 -0
- package/payload/templates/classic/assets/products/muz.png +0 -0
- package/payload/templates/classic/assets/products/nar.png +0 -0
- package/payload/templates/classic/assets/products/patlican.png +0 -0
- package/payload/templates/classic/assets/products/yabanmersini.png +0 -0
- package/payload/templates/classic/assets/products/yesilbiber.png +0 -0
- package/payload/templates/classic/assets/tab-bar/settings.png +0 -0
- package/payload/templates/classic/assets/tab-bar/status.png +0 -0
- package/payload/templates/classic/assets/tab-bar/transactions.png +0 -0
- package/payload/templates/classic/assets/tabs/grid.png +0 -0
- package/payload/templates/classic/assets/tabs/grids.png +0 -0
- package/payload/templates/classic/assets/tabs/home.png +0 -0
- package/payload/templates/classic/assets/tabs/homes.png +0 -0
- package/payload/templates/classic/assets/tabs/search.png +0 -0
- package/payload/templates/classic/assets/tabs/searchs.png +0 -0
- package/payload/templates/classic/assets/tabs/settings.png +0 -0
- package/payload/templates/classic/assets/tabs/settingss.png +0 -0
- package/payload/templates/classic/assets/tabs/tasks.png +0 -0
- package/payload/templates/classic/assets/tabs/taskss.png +0 -0
- package/payload/templates/classic/html/privacy.htm +58 -0
- package/payload/templates/classic/index.htm +70 -0
- package/payload/templates/classic/pages/dialogs.js +205 -0
- package/payload/templates/classic/pages/example.js +296 -0
- package/payload/templates/classic/pages/examples.js +148 -0
- package/payload/templates/classic/pages/home.js +268 -0
- package/payload/templates/classic/pages/info-pages.js +95 -0
- package/payload/templates/classic/pages/lock.js +70 -0
- package/payload/templates/classic/pages/search.js +153 -0
- package/payload/templates/classic/pages/settings.js +184 -0
- package/payload/templates/classic/pages/tasks.js +221 -0
- package/payload/templates/classic/pages/template-pages.js +240 -0
- package/payload/templates/coffee-shop/TEMPLATE.md +63 -0
- package/payload/templates/coffee-shop/app/app.js +713 -0
- package/payload/templates/coffee-shop/app/settings.js +20 -0
- package/payload/templates/coffee-shop/app/store.js +52 -0
- package/payload/templates/coffee-shop/assets/cappuccino.png +0 -0
- package/payload/templates/coffee-shop/assets/chocolate-milk.png +0 -0
- package/payload/templates/coffee-shop/assets/coffee-art/cocoa.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/filter.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/frappe.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/iced.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/latte.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee-art/tea.svg +1 -0
- package/payload/templates/coffee-shop/assets/coffee.png +0 -0
- package/payload/templates/coffee-shop/assets/credits.txt +41 -0
- package/payload/templates/coffee-shop/assets/fonts/OFL.txt +93 -0
- package/payload/templates/coffee-shop/assets/fonts/gelasio-OFL.txt +93 -0
- package/payload/templates/coffee-shop/assets/fonts/gelasio.ttf +0 -0
- package/payload/templates/coffee-shop/assets/frappe.png +0 -0
- package/payload/templates/coffee-shop/assets/iced-caffee.png +0 -0
- package/payload/templates/coffee-shop/assets/tabs/cart.svg +1 -0
- package/payload/templates/coffee-shop/assets/tabs/home.svg +1 -0
- package/payload/templates/coffee-shop/assets/tabs/menu.svg +1 -0
- package/payload/templates/coffee-shop/assets/tabs/rewards.svg +1 -0
- package/payload/templates/coffee-shop/assets/tea.png +0 -0
- package/payload/templates/coffee-shop/components/coffee-ui.js +246 -0
- package/payload/templates/coffee-shop/index.htm +55 -0
- package/payload/templates/coffee-shop/pages/cart.js +82 -0
- package/payload/templates/coffee-shop/pages/drink.js +74 -0
- package/payload/templates/coffee-shop/pages/home.js +54 -0
- package/payload/templates/coffee-shop/pages/menu.js +53 -0
- package/payload/templates/coffee-shop/pages/rewards.js +38 -0
- package/payload/templates/forms/TEMPLATE.md +12 -0
- package/payload/templates/forms/app/app.js +30 -0
- package/payload/templates/forms/appointment-form.htm +969 -0
- package/payload/templates/forms/assets/error.png +0 -0
- package/payload/templates/forms/assets/logo.png +0 -0
- package/payload/templates/forms/assets/logo2.png +0 -0
- package/payload/templates/forms/assets/mail.png +0 -0
- package/payload/templates/forms/assets/success.png +0 -0
- package/payload/templates/forms/contact-form-iframe.htm +24 -0
- package/payload/templates/forms/contact-form-table.sql +11 -0
- package/payload/templates/forms/contact-form-to-mail.htm +358 -0
- package/payload/templates/forms/contact-form-to-supabase.htm +396 -0
- package/payload/templates/forms/dark-contact-form.htm +623 -0
- package/payload/templates/forms/event-registration-form.htm +1056 -0
- package/payload/templates/forms/feedback-form.htm +813 -0
- package/payload/templates/forms/order-form.htm +1187 -0
- package/payload/templates/forms/recruitment-form.htm +698 -0
- package/payload/templates/forms/service/PHPMailer/Exception.php +40 -0
- package/payload/templates/forms/service/PHPMailer/LICENSE +502 -0
- package/payload/templates/forms/service/PHPMailer/PHPMailer.php +5586 -0
- package/payload/templates/forms/service/PHPMailer/SMTP.php +1617 -0
- package/payload/templates/forms/service/readme.md +162 -0
- package/payload/templates/forms/service/send-form-mail.php +941 -0
- package/payload/templates/forms/support-ticket-form.htm +908 -0
- package/payload/templates/panel/TEMPLATE.md +16 -0
- package/payload/templates/panel/assets/_Material Symbols & Icons - Google Fonts.webloc +8 -0
- package/payload/templates/panel/assets/arrow_down.png +0 -0
- package/payload/templates/panel/assets/close.png +0 -0
- package/payload/templates/panel/assets/left-menu/bolt.png +0 -0
- package/payload/templates/panel/assets/left-menu/brick.png +0 -0
- package/payload/templates/panel/assets/left-menu/code.png +0 -0
- package/payload/templates/panel/assets/left-menu/dashboard.png +0 -0
- package/payload/templates/panel/assets/left-menu/data-table.png +0 -0
- package/payload/templates/panel/assets/left-menu/extension.png +0 -0
- package/payload/templates/panel/assets/left-menu/home.png +0 -0
- package/payload/templates/panel/assets/left-menu/reports.png +0 -0
- package/payload/templates/panel/assets/left-menu/setting.png +0 -0
- package/payload/templates/panel/assets/left-menu/url.png +0 -0
- package/payload/templates/panel/assets/light.png +0 -0
- package/payload/templates/panel/assets/maybe.png +0 -0
- package/payload/templates/panel/assets/panel-icon.png +0 -0
- package/payload/templates/panel/assets/top-bar/add.png +0 -0
- package/payload/templates/panel/assets/top-bar/add.svg +1 -0
- package/payload/templates/panel/assets/top-bar/apps.png +0 -0
- package/payload/templates/panel/assets/top-bar/apps.svg +1 -0
- package/payload/templates/panel/assets/top-bar/arrow-down.svg +1 -0
- package/payload/templates/panel/assets/top-bar/bell.svg +1 -0
- package/payload/templates/panel/assets/top-bar/bookmark.png +0 -0
- package/payload/templates/panel/assets/top-bar/bookmark.svg +1 -0
- package/payload/templates/panel/assets/top-bar/cancel.png +0 -0
- package/payload/templates/panel/assets/top-bar/close.svg +1 -0
- package/payload/templates/panel/assets/top-bar/comment.png +0 -0
- package/payload/templates/panel/assets/top-bar/filter.png +0 -0
- package/payload/templates/panel/assets/top-bar/keyboard.svg +1 -0
- package/payload/templates/panel/assets/top-bar/notification.png +0 -0
- package/payload/templates/panel/assets/top-bar/search.png +0 -0
- package/payload/templates/panel/assets/top-bar/search.svg +1 -0
- package/payload/templates/panel/assets/top-bar/user.png +0 -0
- package/payload/templates/panel/assets/top-bar/user.svg +1 -0
- package/payload/templates/panel/assets/warning.png +0 -0
- package/payload/templates/panel/common/bridge.js +1 -0
- package/payload/templates/panel/common/bridge.min.js +0 -0
- package/payload/templates/panel/common/components.js +12 -0
- package/payload/templates/panel/common/full-view.js +107 -0
- package/payload/templates/panel/common/full-view.min.js +1 -0
- package/payload/templates/panel/common/main-view.js +53 -0
- package/payload/templates/panel/common/main-view.min.js +1 -0
- package/payload/templates/panel/common/module-page.js +46 -0
- package/payload/templates/panel/common/module-page.min.js +1 -0
- package/payload/templates/panel/common/right-view.js +77 -0
- package/payload/templates/panel/common/right-view.min.js +1 -0
- package/payload/templates/panel/common/start-page.js +31 -0
- package/payload/templates/panel/common/start-page.min.js +1 -0
- package/payload/templates/panel/common/theme.js +491 -0
- package/payload/templates/panel/common/top-bar-v25-07-29-1.js +330 -0
- package/payload/templates/panel/common/top-bar-v25-07-29-2.js +265 -0
- package/payload/templates/panel/common/top-bar.js +855 -0
- package/payload/templates/panel/common/top-bar.min.js +1 -0
- package/payload/templates/panel/common/ui-standards.css +77 -0
- package/payload/templates/panel/common/ui-standards.js +133 -0
- package/payload/templates/panel/common/ui-standards.min.css +1 -0
- package/payload/templates/panel/common/ui-standards.min.js +1 -0
- package/payload/templates/panel/index.htm +642 -0
- package/payload/templates/panel/managers/database.js +1 -0
- package/payload/templates/panel/managers/database.min.js +1 -0
- package/payload/templates/panel/managers/login.js +2 -0
- package/payload/templates/panel/managers/login.min.js +1 -0
- package/payload/templates/panel/module1/empty-main.htm +26 -0
- package/payload/templates/panel/module10/greenhouse.htm +1361 -0
- package/payload/templates/panel/module11/arduino-projects.htm +1124 -0
- package/payload/templates/panel/module2/empty-full.htm +26 -0
- package/payload/templates/panel/module3/empty-right.htm +26 -0
- package/payload/templates/panel/module4/empty-main-topbar.htm +26 -0
- package/payload/templates/panel/module5/empty-right-topbar.htm +26 -0
- package/payload/templates/panel/module6/energy-hub.htm +1507 -0
- package/payload/templates/panel/module7/3d-printers.htm +1258 -0
- package/payload/templates/panel/module8/cold-rooms.htm +1250 -0
- package/payload/templates/panel/module9/elevator-fleet.htm +1488 -0
- package/payload/templates/panel/pages/_page-template.js +36 -0
- package/payload/templates/panel/pages/_page-template.min.js +1 -0
- package/payload/templates/panel/pages/activity.js +1072 -0
- package/payload/templates/panel/pages/contents.js +1555 -0
- package/payload/templates/panel/pages/contents.min.js +1 -0
- package/payload/templates/panel/pages/customers.js +1171 -0
- package/payload/templates/panel/pages/edit-user.js +381 -0
- package/payload/templates/panel/pages/edit-user.min.js +1 -0
- package/payload/templates/panel/pages/edit-users-table.min.js +1 -0
- package/payload/templates/panel/pages/home.js +637 -0
- package/payload/templates/panel/pages/home.min.js +1 -0
- package/payload/templates/panel/pages/media.js +1538 -0
- package/payload/templates/panel/pages/notifications.js +542 -0
- package/payload/templates/panel/pages/notifications.min.js +1 -0
- package/payload/templates/panel/pages/orders.js +1147 -0
- package/payload/templates/panel/pages/products.js +1281 -0
- package/payload/templates/panel/pages/reports.js +1138 -0
- package/payload/templates/panel/pages/reports.min.js +1 -0
- package/payload/templates/panel/pages/roles.js +1096 -0
- package/payload/templates/panel/pages/settings.js +1462 -0
- package/payload/templates/panel/pages/settings.min.js +1 -0
- package/payload/templates/panel/pages/user-actions.js +456 -0
- package/payload/templates/panel/pages/user-actions.min.js +2 -0
- package/payload/templates/panel/pages/user-list.js +1113 -0
- package/payload/templates/panel/pages/users.js +334 -0
- package/payload/templates/panel/pages/users.min.js +1 -0
- package/payload/templates/shop/TEMPLATE.md +69 -0
- package/payload/templates/shop/app/app.js +727 -0
- package/payload/templates/shop/app/art.js +89 -0
- package/payload/templates/shop/app/settings.js +45 -0
- package/payload/templates/shop/app/store.js +239 -0
- package/payload/templates/shop/app/texts.js +232 -0
- package/payload/templates/shop/assets/app-icon.svg +1 -0
- package/payload/templates/shop/assets/tabs/account.svg +1 -0
- package/payload/templates/shop/assets/tabs/cart.svg +1 -0
- package/payload/templates/shop/assets/tabs/home.svg +1 -0
- package/payload/templates/shop/assets/tabs/shop.svg +1 -0
- package/payload/templates/shop/components/shop-ui.js +343 -0
- package/payload/templates/shop/index.htm +57 -0
- package/payload/templates/shop/pages/account.js +190 -0
- package/payload/templates/shop/pages/cart.js +116 -0
- package/payload/templates/shop/pages/checkout.js +134 -0
- package/payload/templates/shop/pages/favorites.js +37 -0
- package/payload/templates/shop/pages/home.js +86 -0
- package/payload/templates/shop/pages/orders.js +132 -0
- package/payload/templates/shop/pages/product.js +168 -0
- package/payload/templates/shop/pages/shop.js +113 -0
- package/payload/templates/starter/TEMPLATE.md +107 -0
- package/payload/templates/starter/app/app.js +660 -0
- package/payload/templates/starter/app/settings.js +57 -0
- package/payload/templates/starter/assets/app-icon.svg +5 -0
- package/payload/templates/starter/assets/products/brokoli.png +0 -0
- package/payload/templates/starter/assets/products/cilek.png +0 -0
- package/payload/templates/starter/assets/products/domates.png +0 -0
- package/payload/templates/starter/assets/products/elma.png +0 -0
- package/payload/templates/starter/assets/products/havuc.png +0 -0
- package/payload/templates/starter/assets/products/karpuz.png +0 -0
- package/payload/templates/starter/assets/products/limon.png +0 -0
- package/payload/templates/starter/assets/products/muz.png +0 -0
- package/payload/templates/starter/assets/products/nar.png +0 -0
- package/payload/templates/starter/assets/products/patlican.png +0 -0
- package/payload/templates/starter/assets/products/yabanmersini.png +0 -0
- package/payload/templates/starter/assets/products/yesilbiber.png +0 -0
- package/payload/templates/starter/assets/tabs/grid.png +0 -0
- package/payload/templates/starter/assets/tabs/grids.png +0 -0
- package/payload/templates/starter/assets/tabs/home.png +0 -0
- package/payload/templates/starter/assets/tabs/homes.png +0 -0
- package/payload/templates/starter/assets/tabs/settings.png +0 -0
- package/payload/templates/starter/assets/tabs/settingss.png +0 -0
- package/payload/templates/starter/assets/tabs/tasks.png +0 -0
- package/payload/templates/starter/assets/tabs/taskss.png +0 -0
- package/payload/templates/starter/html/about.htm +54 -0
- package/payload/templates/starter/index.htm +57 -0
- package/payload/templates/starter/pages/about.js +23 -0
- package/payload/templates/starter/pages/home.js +81 -0
- package/payload/templates/starter/pages/product.js +45 -0
- package/payload/templates/starter/pages/products.js +61 -0
- package/payload/templates/starter/pages/settings.js +103 -0
- package/payload/templates/starter/pages/tasks.js +187 -0
- package/payload/templates/starter/pages/website.js +29 -0
|
@@ -0,0 +1,2740 @@
|
|
|
1
|
+
/* Bismillah */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
|
|
5
|
+
PropertyPanel - v26.09
|
|
6
|
+
|
|
7
|
+
UI COMPONENT TEMPLATE
|
|
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.
|
|
10
|
+
- Built from a JSON (data): header tabs, a title with action icons, and sections of items.
|
|
11
|
+
footer: one more section, fixed at the bottom (out of the scrolling part). Ex: a note field.
|
|
12
|
+
headerTitle: a name at the left of the header; the tabs and the headerItem come next to it.
|
|
13
|
+
empty: { icon, title, text, hints: [{ keys, text }] } -> a page in the middle in place of the sections
|
|
14
|
+
(Ex: nothing is selected).
|
|
15
|
+
Each item has a type, a key, a value and its own settings. Every item type is a small object
|
|
16
|
+
built by its own function (see *** ITEM TYPES):
|
|
17
|
+
number -> [X 396] prefix text or icon (drag the prefix to change the value; prefixWidth for a word), unit, min, max, step, autoText
|
|
18
|
+
parseText(text): a text that is not a plain number goes to it; it returns the value ("100%", "auto")
|
|
19
|
+
or undefined (the old value comes back). A text value is shown as it is.
|
|
20
|
+
textToNumber(value): the number of a text value, to drag or step it (Ex: "100%" -> its width in px).
|
|
21
|
+
text -> [ name ] a text field
|
|
22
|
+
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
|
+
select -> [ Left ⌄] a menu of options, optional icon, look: "plain" (no background)
|
|
24
|
+
combo -> [16 | ⌄] a number field and a menu of preset values
|
|
25
|
+
segmented -> [≡|≡|≡] icon or text buttons. With a value: one is selected. Without: action buttons.
|
|
26
|
+
iconButton -> [◎] an action, or a toggle (toggle: 1, value true/false)
|
|
27
|
+
constraints-> Horizontal and vertical selects and the constraints diagram. value: { horizontal, vertical }
|
|
28
|
+
alignGrid -> a 3x3 grid of the places of the content (the align of a group). value: "left top", "center"...
|
|
29
|
+
color -> [■ #3871E0 | 100%] a swatch, the color text and its opacity. A click on the swatch opens the
|
|
30
|
+
color picker (at the left of the panel): saturation / brightness, hue, opacity, the eyedropper (the browser's, or pickColor of the page)
|
|
31
|
+
(Chrome), the color text, and the color groups (palettes) under them.
|
|
32
|
+
palettes (a param of the panel): [{ key, name, colors, canAdd, emptyText }] or function (panel) -> that.
|
|
33
|
+
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 }.
|
|
35
|
+
presets (of the item, old): shown as the first palette, "Presets".
|
|
36
|
+
Also: the color before / now (a click on "before" goes back), HEX / RGB / HSL text, and the
|
|
37
|
+
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
|
|
39
|
+
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 }
|
|
42
|
+
The panel keeps the values: getValues(), getValue(key), getData() (the JSON with the current values).
|
|
43
|
+
- setValue(key, value, silent) changes an item from outside (Ex: another object was selected).
|
|
44
|
+
- It is always created on the page (whatever container is open) and opened at the right side.
|
|
45
|
+
open() / close() / toggle() slide it. (Not show / hide: those are basic.js methods.)
|
|
46
|
+
- The menus (select, combo) are created on the page and removed with the panel.
|
|
47
|
+
|
|
48
|
+
USAGE:
|
|
49
|
+
const panel = PropertyPanel({
|
|
50
|
+
data: {
|
|
51
|
+
tabs: [{ key: "design", text: "Design" }, { key: "prototype", text: "Prototype" }],
|
|
52
|
+
activeTab: "design",
|
|
53
|
+
title: "Text",
|
|
54
|
+
sections: [
|
|
55
|
+
{ key: "position", title: "Position", items: [
|
|
56
|
+
[{ key: "x", type: "number", label: "Position", prefix: "X", value: 396 },
|
|
57
|
+
{ key: "y", type: "number", prefix: "Y", value: 668 }],
|
|
58
|
+
{ key: "rotation", type: "number", label: "Rotation", icon: "angle", value: 0, unit: "°" },
|
|
59
|
+
] },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
onChange: function (change, self) { println(change.key + " = " + change.value); },
|
|
63
|
+
});
|
|
64
|
+
panel.setValue("x", 400, 1); // silent
|
|
65
|
+
panel.getValues(); // { x: 400, y: 668, rotation: 0 }
|
|
66
|
+
|
|
67
|
+
Started Date: September 2026
|
|
68
|
+
Developer: Bugra Ozden
|
|
69
|
+
Email: bugra.ozden@gmail.com
|
|
70
|
+
Webpage: https://bug7a.github.io/js-components/
|
|
71
|
+
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
"use strict";
|
|
75
|
+
|
|
76
|
+
// Default values:
|
|
77
|
+
const PropertyPanelDefaults = {
|
|
78
|
+
key: "0",
|
|
79
|
+
width: 240,
|
|
80
|
+
data: {}, // tabs, activeTab, headerTitle, headerItem, title, titleActions, sections, footer, empty (See the USAGE above)
|
|
81
|
+
opened: 1, // 1: Open at create time.
|
|
82
|
+
onChange: function (change, self) { }, // Every change: { kind, key, value, oldValue, item, sectionKey }
|
|
83
|
+
palettes: null, // The color groups of the color picker: [{ key, name, colors, canAdd, emptyText }] or function (panel) -> that
|
|
84
|
+
recentColorsKey: "", // The recent colors of the color picker are kept in basic.storage with this key. "": only until the page closes.
|
|
85
|
+
pickColor: null, // function (panel, done): the eyedropper where the browser has none (VS Code, Safari, Firefox): the page
|
|
86
|
+
// lets the user pick a color itself and calls done("#RRGGBB") (done("") : nothing was picked)
|
|
87
|
+
style: {
|
|
88
|
+
panel: {
|
|
89
|
+
color: "#2C2C2C",
|
|
90
|
+
dividerColor: "#444444",
|
|
91
|
+
headerHeight: 48,
|
|
92
|
+
paddingLeft: 16,
|
|
93
|
+
paddingRight: 8,
|
|
94
|
+
motion: "0.25s",
|
|
95
|
+
},
|
|
96
|
+
grid: {
|
|
97
|
+
columnWidth: 88, // span: 1 (span: 2 = two columns + gap)
|
|
98
|
+
iconColumnWidth: 24,
|
|
99
|
+
gap: 8,
|
|
100
|
+
rowGap: 8,
|
|
101
|
+
itemHeight: 24,
|
|
102
|
+
},
|
|
103
|
+
text: {
|
|
104
|
+
color: "#FFFFFF",
|
|
105
|
+
softColor: "#A5A5A5", // Captions, inactive tabs, prefixes
|
|
106
|
+
disabledColor: "#6E6E6E",
|
|
107
|
+
fontSize: 12,
|
|
108
|
+
captionSize: 11,
|
|
109
|
+
titleSize: 13,
|
|
110
|
+
sectionTitleSize: 12,
|
|
111
|
+
},
|
|
112
|
+
field: {
|
|
113
|
+
color: "#383838",
|
|
114
|
+
hoverBorderColor: "#4D4D4D",
|
|
115
|
+
focusBorderColor: "#0C8CE9",
|
|
116
|
+
round: 5,
|
|
117
|
+
},
|
|
118
|
+
segmented: {
|
|
119
|
+
selectedColor: "#2C2C2C",
|
|
120
|
+
selectedBorderColor: "#5C5C5C",
|
|
121
|
+
hoverColor: "#434343",
|
|
122
|
+
},
|
|
123
|
+
button: {
|
|
124
|
+
hoverColor: "#383838",
|
|
125
|
+
activeColor: "#34435A", // toggle on
|
|
126
|
+
activeIconColor: "#7CC4F8",
|
|
127
|
+
iconColor: "#E6E6E6",
|
|
128
|
+
},
|
|
129
|
+
accent: {
|
|
130
|
+
color: "#0C8CE9", // Constraints lines, menu hover
|
|
131
|
+
},
|
|
132
|
+
menu: {
|
|
133
|
+
color: "#1E1E1E",
|
|
134
|
+
borderColor: "#3A3A3A",
|
|
135
|
+
hoverColor: "#0C8CE9",
|
|
136
|
+
textColor: "#FFFFFF",
|
|
137
|
+
round: 8,
|
|
138
|
+
rowHeight: 26,
|
|
139
|
+
maxHeight: 320,
|
|
140
|
+
shadow: "0 8px 24px rgba(0, 0, 0, 0.45)",
|
|
141
|
+
},
|
|
142
|
+
constraints: {
|
|
143
|
+
frameColor: "#555555", // The inner frame of the constraints picture
|
|
144
|
+
},
|
|
145
|
+
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)
|
|
149
|
+
},
|
|
150
|
+
textarea: {
|
|
151
|
+
lineHeight: 17,
|
|
152
|
+
fontFamily: "opensans, sans-serif",
|
|
153
|
+
},
|
|
154
|
+
colorPicker: {
|
|
155
|
+
width: 240,
|
|
156
|
+
padding: 12,
|
|
157
|
+
areaHeight: 150, // Saturation / brightness area
|
|
158
|
+
handleSize: 12,
|
|
159
|
+
sliderHeight: 12,
|
|
160
|
+
swatchSize: 18,
|
|
161
|
+
swatchGap: 6,
|
|
162
|
+
swatchesMaxHeight: 126, // More colors scroll
|
|
163
|
+
},
|
|
164
|
+
empty: { // data.empty: the page in the middle (Ex: nothing is selected)
|
|
165
|
+
iconSize: 26,
|
|
166
|
+
iconColor: "#A5A5A5",
|
|
167
|
+
iconBoxColor: "#383838",
|
|
168
|
+
iconBoxRound: 16,
|
|
169
|
+
},
|
|
170
|
+
swatch: {
|
|
171
|
+
size: 14,
|
|
172
|
+
borderColor: "rgba(255, 255, 255, 0.25)",
|
|
173
|
+
emptyColor: "#555555", // The line of an empty (transparent) color
|
|
174
|
+
},
|
|
175
|
+
scrollBar: { // basic/scroll-bar.js (ScrollBar) parameters of the panel
|
|
176
|
+
bar_color: "#FFFFFF",
|
|
177
|
+
bar_mouseOverColor: "#FFFFFF",
|
|
178
|
+
bar_opacity: 0.25,
|
|
179
|
+
bar_mouseOverOpacity: 0.5,
|
|
180
|
+
neverHide: 0,
|
|
181
|
+
showDots: 0,
|
|
182
|
+
},
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const PropertyPanel = function (params = {}) {
|
|
187
|
+
|
|
188
|
+
// Merge params:
|
|
189
|
+
mergeIntoIfMissing(params, PropertyPanelDefaults);
|
|
190
|
+
|
|
191
|
+
// Edit params, if needed:
|
|
192
|
+
const _ps = params.style.panel;
|
|
193
|
+
params.left = "calc(100% - " + params.width + "px)";
|
|
194
|
+
params.top = 0;
|
|
195
|
+
params.height = "100%";
|
|
196
|
+
params.color = _ps.color;
|
|
197
|
+
const startData = params.data;
|
|
198
|
+
params.data = {}; // WHY: The working copy is made in setData().
|
|
199
|
+
|
|
200
|
+
// WHY: A side panel covers the page. Wherever it is called from, it is created on the page.
|
|
201
|
+
// NOTE: The container is put back by hand after endObject(), at the end of this function. (Like SidePanel)
|
|
202
|
+
const previousContainer = getDefaultContainerBox();
|
|
203
|
+
setDefaultContainerBox(page);
|
|
204
|
+
|
|
205
|
+
// BOX: Component container
|
|
206
|
+
let box = startObject(params);
|
|
207
|
+
|
|
208
|
+
// *** PRIVATE VARIABLES:
|
|
209
|
+
const _s = box.style;
|
|
210
|
+
const _t = _s.text;
|
|
211
|
+
const _g = _s.grid;
|
|
212
|
+
const panelWidth = Number(box.width) || PropertyPanelDefaults.width;
|
|
213
|
+
let controllers = {}; // key -> { item, sectionKey, field, cell, setValue(), setEnabled() }
|
|
214
|
+
let listeners = [];
|
|
215
|
+
let tabLabels = {};
|
|
216
|
+
let titleLabel = null;
|
|
217
|
+
let menu = null; // { obj, opener }
|
|
218
|
+
const MENU_MIN_WIDTH = 140;
|
|
219
|
+
const MENU_Z_INDEX = 2147482000; // WHY: Over everything of the page (the panel, modals).
|
|
220
|
+
const MENU_OFFSET = 4; // Space between the field and its menu.
|
|
221
|
+
const SCREEN_MARGIN = 8; // The menu stays this far from the window edges.
|
|
222
|
+
const SHIFT_STEP_FACTOR = 10; // Shift + arrow / scrub: 10 steps.
|
|
223
|
+
|
|
224
|
+
// *** PUBLIC VARIABLES:
|
|
225
|
+
// NOTE: Default values are also public variables. (box.data: the JSON with the current values)
|
|
226
|
+
|
|
227
|
+
// *** PRIVATE FUNCTIONS:
|
|
228
|
+
|
|
229
|
+
// SVG of an icon name (PropertyPanel.icons) or a raw "<svg" string.
|
|
230
|
+
const getIcon = function (name, size = 16) {
|
|
231
|
+
if (!name) return "";
|
|
232
|
+
if (String(name).trim().indexOf("<svg") === 0) return name;
|
|
233
|
+
const path = PropertyPanel.icons[name];
|
|
234
|
+
if (!path) return basic.escapeHtml(name); // Not an icon: shown as text (Ex: "X")
|
|
235
|
+
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
|
+
};
|
|
237
|
+
|
|
238
|
+
const getSpanWidth = function (span) {
|
|
239
|
+
if (span === "full") return panelWidth - _ps.paddingLeft - _ps.paddingRight;
|
|
240
|
+
if (span == 2) return _g.columnWidth * 2 + _g.gap;
|
|
241
|
+
return _g.columnWidth;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// Color of a text or an icon: its own color, or the disabled color.
|
|
245
|
+
const ink = function (enabled, color) {
|
|
246
|
+
return (enabled) ? color : _t.disabledColor;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// A one line label. html: an icon or a short text. props.plainText: a user text (never read as HTML).
|
|
250
|
+
// props.flex: takes the free space of its row and ends with "...". It never takes the pointer, its field does.
|
|
251
|
+
const textLabel = function (html, props = {}) {
|
|
252
|
+
const lbl = Label({
|
|
253
|
+
text: html,
|
|
254
|
+
fontSize: props.fontSize || _t.fontSize,
|
|
255
|
+
textColor: props.textColor || _t.color,
|
|
256
|
+
});
|
|
257
|
+
lbl.clickable = 0;
|
|
258
|
+
lbl.shrink = 0;
|
|
259
|
+
if (props.bold) lbl.bold = 1;
|
|
260
|
+
if (props.height !== undefined) lbl.height = props.height;
|
|
261
|
+
if (props.flex) {
|
|
262
|
+
lbl.grow = 1;
|
|
263
|
+
lbl.shrink = 1;
|
|
264
|
+
lbl.ellipsis = 1;
|
|
265
|
+
lbl.lineHeight = props.height || _g.itemHeight;
|
|
266
|
+
lbl.css = { flexBasis: "0px", minWidth: "0px" };
|
|
267
|
+
} else {
|
|
268
|
+
lbl.css = { display: "flex", alignItems: "center", whiteSpace: "nowrap" };
|
|
269
|
+
if (props.width !== undefined) {
|
|
270
|
+
lbl.width = props.width;
|
|
271
|
+
lbl.css.justifyContent = "center";
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (props.plainText !== undefined) lbl.plainText = props.plainText;
|
|
275
|
+
return lbl;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// Inner border that does not change the size.
|
|
279
|
+
const setBorder = function (obj, color) {
|
|
280
|
+
obj.boxShadow = (color) ? "inset 0 0 0 1px " + color : "none";
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// fn(1) on mouseenter, fn(0) on mouseleave.
|
|
284
|
+
const onHover = function (obj, fn) {
|
|
285
|
+
obj.on("mouseenter", function () { fn(1); });
|
|
286
|
+
obj.on("mouseleave", function () { fn(0); });
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
// Enter and Space (and extraKeys) run fn, like a click.
|
|
290
|
+
const onActivateKey = function (obj, fn, extraKeys = []) {
|
|
291
|
+
obj.on("keydown", function (self, event) {
|
|
292
|
+
const isActivateKey = (event.key === "Enter" || event.key === " " || extraKeys.indexOf(event.key) > -1);
|
|
293
|
+
if (!isActivateKey) return;
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
fn();
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// Border of a field: focus, hover (when enabled) or none.
|
|
300
|
+
const paintField = function (field, state) {
|
|
301
|
+
if (state.isFocus) setBorder(field, _s.field.focusBorderColor);
|
|
302
|
+
else if (state.isHover && state.enabled) setBorder(field, _s.field.hoverBorderColor);
|
|
303
|
+
else setBorder(field, "");
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const precisionOf = function (item) {
|
|
307
|
+
const hasPrecision = (item.precision !== undefined && item.precision !== "auto");
|
|
308
|
+
if (hasPrecision) return Math.max(0, Number(item.precision) || 0);
|
|
309
|
+
const text = String(item.step || 1);
|
|
310
|
+
return (text.indexOf(".") > -1) ? text.split(".")[1].length : 0;
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
const normalizeOptions = function (options) {
|
|
314
|
+
return (options || []).map(function (option) {
|
|
315
|
+
const isObject = (option !== null && typeof option === "object");
|
|
316
|
+
if (!isObject) return { value: option, text: String(option) };
|
|
317
|
+
return {
|
|
318
|
+
value: option.value,
|
|
319
|
+
text: (option.text !== undefined) ? option.text : String(option.value),
|
|
320
|
+
icon: option.icon,
|
|
321
|
+
hint: option.hint,
|
|
322
|
+
};
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const findOption = function (options, value) {
|
|
327
|
+
for (let i = 0; i < options.length; i++) {
|
|
328
|
+
if (options[i].value === value) return options[i];
|
|
329
|
+
}
|
|
330
|
+
return null;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
// *** CHANGES:
|
|
334
|
+
|
|
335
|
+
// Sends a change to the item, the onChange of the panel and the listeners.
|
|
336
|
+
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); });
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// Some item types fill the missing parts of a value. (Ex: constraints)
|
|
343
|
+
const normalizeValue = function (item, value) {
|
|
344
|
+
const builder = ITEM_TYPES[item.type];
|
|
345
|
+
return (builder && builder.normalize) ? builder.normalize(value) : value;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// Keeps a new value of an item and sends the change (not when silent). Returns 1 when the value changed.
|
|
349
|
+
const changeValue = function (ctrl, value, silent = 0) {
|
|
350
|
+
value = normalizeValue(ctrl.item, value);
|
|
351
|
+
const oldValue = ctrl.item.value;
|
|
352
|
+
if (PropertyPanel.isSameValue(oldValue, value)) return 0;
|
|
353
|
+
ctrl.item.value = value;
|
|
354
|
+
if (silent) return 1;
|
|
355
|
+
dispatch({
|
|
356
|
+
kind: "value",
|
|
357
|
+
key: ctrl.item.key,
|
|
358
|
+
value: PropertyPanel.copyValue(value),
|
|
359
|
+
oldValue: oldValue,
|
|
360
|
+
item: ctrl.item,
|
|
361
|
+
sectionKey: ctrl.sectionKey,
|
|
362
|
+
});
|
|
363
|
+
return 1;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// A button without a value was clicked.
|
|
367
|
+
const sendAction = function (ctrl, value) {
|
|
368
|
+
dispatch({ kind: "action", key: ctrl.item.key, value: value, oldValue: undefined, item: ctrl.item, sectionKey: ctrl.sectionKey });
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
// *** MENU (select, combo):
|
|
372
|
+
|
|
373
|
+
const closeMenu = function () {
|
|
374
|
+
if (!menu) return;
|
|
375
|
+
const closed = menu;
|
|
376
|
+
menu = null;
|
|
377
|
+
closed.obj.remove();
|
|
378
|
+
if (closed.onClose) closed.onClose();
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// Under the field; above it when there is no space below.
|
|
382
|
+
const placeMenu = function (obj, rect, width) {
|
|
383
|
+
const height = obj.elem.offsetHeight;
|
|
384
|
+
let top = rect.bottom + MENU_OFFSET;
|
|
385
|
+
if (top + height > window.innerHeight - SCREEN_MARGIN) top = Math.max(SCREEN_MARGIN, rect.top - height - MENU_OFFSET);
|
|
386
|
+
obj.left = Math.max(SCREEN_MARGIN, Math.min(rect.left, window.innerWidth - width - SCREEN_MARGIN));
|
|
387
|
+
obj.top = top;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// anchor: the menu is placed under it. opener: the object that opens it; a click on it again closes the menu.
|
|
391
|
+
const openMenu = function (anchor, opener, options, currentValue, onPick) {
|
|
392
|
+
const isOpenByThisOpener = (menu && menu.opener === opener);
|
|
393
|
+
closeMenu();
|
|
394
|
+
if (isOpenByThisOpener) return;
|
|
395
|
+
if (!options.length) return;
|
|
396
|
+
const rect = anchor.elem.getBoundingClientRect();
|
|
397
|
+
const width = Math.max(rect.width, MENU_MIN_WIDTH);
|
|
398
|
+
const ms = _s.menu;
|
|
399
|
+
|
|
400
|
+
createIn(page, function () {
|
|
401
|
+
|
|
402
|
+
// GROUP: Menu
|
|
403
|
+
const obj = VGroup({ left: 0, top: 0, width: width, height: "auto", align: "left top", gap: 0, color: ms.color, round: ms.round });
|
|
404
|
+
obj.boxShadow = "0 0 0 1px " + ms.borderColor + ", " + ms.shadow;
|
|
405
|
+
obj.zIndex = MENU_Z_INDEX;
|
|
406
|
+
obj.css = {
|
|
407
|
+
padding: "6px 0px",
|
|
408
|
+
boxSizing: "border-box",
|
|
409
|
+
maxHeight: ms.maxHeight + "px",
|
|
410
|
+
alignItems: "stretch",
|
|
411
|
+
};
|
|
412
|
+
obj.scrollY = 1; // (also clickable)
|
|
413
|
+
obj.role = "listbox";
|
|
414
|
+
|
|
415
|
+
options.forEach(function (option) {
|
|
416
|
+
|
|
417
|
+
const isSelected = PropertyPanel.isSameValue(option.value, currentValue);
|
|
418
|
+
|
|
419
|
+
// GROUP: Menu row
|
|
420
|
+
const row = HGroup({ width: "100%", height: ms.rowHeight, align: "left center", gap: 0, color: "transparent" });
|
|
421
|
+
row.shrink = 0;
|
|
422
|
+
row.cursor = "pointer";
|
|
423
|
+
row.role = "option";
|
|
424
|
+
row.aria = { selected: (isSelected) ? "true" : "false" };
|
|
425
|
+
row.clickable = 1;
|
|
426
|
+
|
|
427
|
+
textLabel((isSelected) ? getIcon("check", 14) : "", { width: 28, height: ms.rowHeight, textColor: ms.textColor });
|
|
428
|
+
if (option.icon) textLabel(getIcon(option.icon, 16), { width: 22, height: ms.rowHeight, textColor: ms.textColor });
|
|
429
|
+
textLabel("", { flex: 1, height: ms.rowHeight, textColor: ms.textColor, plainText: option.text });
|
|
430
|
+
|
|
431
|
+
endGroup();
|
|
432
|
+
|
|
433
|
+
onHover(row, function (isHover) { row.color = (isHover) ? ms.hoverColor : "transparent"; });
|
|
434
|
+
row.on("click", function () {
|
|
435
|
+
closeMenu();
|
|
436
|
+
onPick(option.value);
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
endGroup();
|
|
442
|
+
|
|
443
|
+
placeMenu(obj, rect, width);
|
|
444
|
+
|
|
445
|
+
menu = { obj: obj, opener: opener };
|
|
446
|
+
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
// WHY: A pointerdown on the opener is left to its click, which closes the menu (a toggle).
|
|
451
|
+
const onDocumentPointerDown = function (self, event) {
|
|
452
|
+
if (!menu) return;
|
|
453
|
+
if (menu.obj.elem.contains(event.target)) return;
|
|
454
|
+
if (menu.opener.elem.contains(event.target)) return;
|
|
455
|
+
closeMenu();
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
// WHY: stopImmediatePropagation: this Escape closes the menu only (a page listener after it would also
|
|
459
|
+
// clear its selection). The focus goes back to the opener when it was in the menu.
|
|
460
|
+
const onDocumentKeyDown = function (self, event) {
|
|
461
|
+
if (!menu || event.key !== "Escape") return;
|
|
462
|
+
event.stopImmediatePropagation();
|
|
463
|
+
const opener = menu.opener;
|
|
464
|
+
const hadFocus = menu.obj.elem.contains(document.activeElement);
|
|
465
|
+
closeMenu();
|
|
466
|
+
if (hadFocus && opener.elem.tabIndex >= 0) opener.elem.focus();
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
// *** SMALL OBJECTS USED BY THE ITEM TYPES:
|
|
470
|
+
|
|
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.
|
|
473
|
+
const PREFIX_WIDTH = 26;
|
|
474
|
+
const buildInputField = function (item, width, prefixValue) {
|
|
475
|
+
|
|
476
|
+
const state = { isHover: 0, isFocus: 0, enabled: item.enabled != 0 };
|
|
477
|
+
const paint = function () { paintField(field, state); };
|
|
478
|
+
|
|
479
|
+
// GROUP: Field
|
|
480
|
+
const field = HGroup({ width: width, height: _g.itemHeight, align: "left center", gap: 0, color: _s.field.color, round: _s.field.round });
|
|
481
|
+
field.shrink = 0;
|
|
482
|
+
field.css = { boxSizing: "border-box", transition: "box-shadow 0.12s" };
|
|
483
|
+
|
|
484
|
+
// LABEL: Prefix ("X" or an icon)
|
|
485
|
+
// item.prefixWidth: a wider prefix for a word (Ex: "Bottom"); 26: a letter or an icon
|
|
486
|
+
const prefix = (prefixValue) ? textLabel(getIcon(prefixValue, 16), { width: item.prefixWidth || PREFIX_WIDTH, height: _g.itemHeight, textColor: _t.softColor }) : null;
|
|
487
|
+
if (prefix) prefix.css.paddingLeft = "2px";
|
|
488
|
+
|
|
489
|
+
// INPUT: Value
|
|
490
|
+
const input = Input({ width: 10, height: _g.itemHeight, minimal: 1, fontSize: _t.fontSize, textColor: _t.color });
|
|
491
|
+
input.grow = 1;
|
|
492
|
+
input.shrink = 1;
|
|
493
|
+
input.css.minWidth = "0px";
|
|
494
|
+
const el = input.inputElement;
|
|
495
|
+
Object.assign(el.style, {
|
|
496
|
+
width: "100%",
|
|
497
|
+
height: "100%",
|
|
498
|
+
boxSizing: "border-box",
|
|
499
|
+
padding: (prefix) ? "0px 4px 0px 2px" : "0px 8px",
|
|
500
|
+
backgroundColor: "transparent",
|
|
501
|
+
border: "0px",
|
|
502
|
+
color: _t.color,
|
|
503
|
+
fontSize: _t.fontSize + "px",
|
|
504
|
+
});
|
|
505
|
+
el.setAttribute("spellcheck", "false");
|
|
506
|
+
el.setAttribute("aria-label", item.hint || item.label || item.prefix || item.key);
|
|
507
|
+
|
|
508
|
+
endGroup();
|
|
509
|
+
|
|
510
|
+
onHover(field, function (isHover) {
|
|
511
|
+
state.isHover = isHover;
|
|
512
|
+
paint();
|
|
513
|
+
});
|
|
514
|
+
el.addEventListener("focus", function () {
|
|
515
|
+
state.isFocus = 1;
|
|
516
|
+
paint();
|
|
517
|
+
});
|
|
518
|
+
el.addEventListener("blur", function () {
|
|
519
|
+
state.isFocus = 0;
|
|
520
|
+
paint();
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
const setEnabled = function (enabled) {
|
|
524
|
+
state.enabled = !!enabled;
|
|
525
|
+
el.disabled = !state.enabled;
|
|
526
|
+
el.style.color = ink(state.enabled, _t.color);
|
|
527
|
+
if (prefix) prefix.textColor = ink(state.enabled, _t.softColor);
|
|
528
|
+
paint();
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
setEnabled(state.enabled);
|
|
532
|
+
|
|
533
|
+
return { field: field, input: input, el: el, prefix: prefix, state: state, setEnabled: setEnabled };
|
|
534
|
+
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
// FIELD: number input. Used by "number" and "combo". A new value goes to changeValue(ctrl).
|
|
538
|
+
const buildNumberInput = function (ctrl, width) {
|
|
539
|
+
|
|
540
|
+
const item = ctrl.item;
|
|
541
|
+
const precision = precisionOf(item);
|
|
542
|
+
const step = Math.abs(Number(item.step)) || 1;
|
|
543
|
+
const min = (item.min !== undefined) ? Number(item.min) : -Infinity;
|
|
544
|
+
const max = (item.max !== undefined) ? Number(item.max) : Infinity;
|
|
545
|
+
let value = item.value;
|
|
546
|
+
let scrub = null;
|
|
547
|
+
|
|
548
|
+
const { field, input, el, prefix, state, setEnabled: setFieldEnabled } = buildInputField(item, width, item.icon || item.prefix);
|
|
549
|
+
|
|
550
|
+
const format = function (v) {
|
|
551
|
+
if (v === null || v === undefined || v === "") return item.autoText || "";
|
|
552
|
+
if (typeof v === "string") return v; // A text value of parseText ("100%", "auto")
|
|
553
|
+
return Number(v).toFixed(precision) + (item.unit || "");
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
// The number of a value: a number, or the number of a text value from textToNumber ("100%" -> 412 px).
|
|
557
|
+
// null: no number (a text value without textToNumber is not scrubbed or stepped).
|
|
558
|
+
const numberOf = function (v) {
|
|
559
|
+
if (typeof v === "number") return v;
|
|
560
|
+
if (typeof v !== "string" || !item.textToNumber) return null;
|
|
561
|
+
const n = Number(item.textToNumber(v));
|
|
562
|
+
return (isNaN(n)) ? null : n;
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
const clamp = function (v) {
|
|
566
|
+
const factor = Math.pow(10, precision);
|
|
567
|
+
return Math.round(basic.clamp(v, min, max) * factor) / factor;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
// Text -> value. undefined: not a number (the old value comes back).
|
|
571
|
+
// parseText (item): a text that is not a plain number goes to it, and its answer is the value ("100%").
|
|
572
|
+
const parse = function (text) {
|
|
573
|
+
text = String(text).trim();
|
|
574
|
+
if (item.autoText && (text === "" || text.toLowerCase() === String(item.autoText).toLowerCase())) return null;
|
|
575
|
+
const isPlainNumber = /^-?\d*[.,]?\d+(px)?$/i.test(text);
|
|
576
|
+
if (item.parseText && !isPlainNumber) return item.parseText(text);
|
|
577
|
+
const match = text.replace(",", ".").match(/-?\d*\.?\d+/);
|
|
578
|
+
if (!match) return undefined;
|
|
579
|
+
return clamp(parseFloat(match[0]));
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
const commit = function (next) {
|
|
583
|
+
if (next !== undefined) value = next;
|
|
584
|
+
input.text = format(value);
|
|
585
|
+
el.title = (typeof value === "string") ? value : "";
|
|
586
|
+
if (next !== undefined) changeValue(ctrl, value);
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
el.addEventListener("focus", function () { input.select(); });
|
|
590
|
+
el.addEventListener("blur", function () {
|
|
591
|
+
// WHY: the text shows the value rounded to the step (12.4 -> "12"); leaving it (or Escape) without a change
|
|
592
|
+
// saved the rounded value and sent onChange
|
|
593
|
+
if (input.text === format(value)) return;
|
|
594
|
+
commit(parse(input.text));
|
|
595
|
+
});
|
|
596
|
+
const stepFactorOf = function (event) {
|
|
597
|
+
return (event.shiftKey) ? SHIFT_STEP_FACTOR : 1;
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
const stepByArrow = function (event) {
|
|
601
|
+
const base = numberOf(parse(input.text));
|
|
602
|
+
const start = (base === null) ? numberOf(value) : base;
|
|
603
|
+
if (start === null && typeof value === "string") return; // WHY: A text value with no number: nothing to step.
|
|
604
|
+
const direction = (event.key === "ArrowUp") ? 1 : -1;
|
|
605
|
+
commit(clamp((start || 0) + direction * step * stepFactorOf(event)));
|
|
606
|
+
input.select();
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
el.addEventListener("keydown", function (event) {
|
|
610
|
+
if (event.key === "Enter") {
|
|
611
|
+
event.preventDefault();
|
|
612
|
+
el.blur();
|
|
613
|
+
} else if (event.key === "Escape") {
|
|
614
|
+
event.preventDefault();
|
|
615
|
+
input.text = format(value);
|
|
616
|
+
el.blur();
|
|
617
|
+
} else if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
618
|
+
event.preventDefault();
|
|
619
|
+
stepByArrow(event);
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
// Scrub: drag the prefix left / right. 1 px = 1 step (Shift: 10 steps)
|
|
624
|
+
if (prefix) {
|
|
625
|
+
prefix.clickable = 1;
|
|
626
|
+
prefix.css.touchAction = "none";
|
|
627
|
+
prefix.on("pointerdown", function (self, event) {
|
|
628
|
+
if (!state.enabled || event.button !== 0) return;
|
|
629
|
+
event.preventDefault();
|
|
630
|
+
if (document.activeElement === el) el.blur();
|
|
631
|
+
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 };
|
|
634
|
+
try {
|
|
635
|
+
prefix.elem.setPointerCapture(event.pointerId);
|
|
636
|
+
} catch (e) { } // WHY: It throws when the pointer is not active any more; the scrub still works without it.
|
|
637
|
+
});
|
|
638
|
+
prefix.on("pointermove", function (self, event) {
|
|
639
|
+
if (!scrub || event.pointerId !== scrub.id) return;
|
|
640
|
+
const movedPixels = Math.round(event.clientX - scrub.x);
|
|
641
|
+
const next = clamp(scrub.start + movedPixels * step * stepFactorOf(event));
|
|
642
|
+
if (next !== value) commit(next);
|
|
643
|
+
});
|
|
644
|
+
const endScrub = function () { scrub = null; };
|
|
645
|
+
prefix.on("pointerup", endScrub);
|
|
646
|
+
prefix.on("pointercancel", endScrub);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
const setValue = function (v) {
|
|
650
|
+
value = v;
|
|
651
|
+
input.text = format(v);
|
|
652
|
+
el.title = (typeof v === "string") ? v : ""; // WHY: A long text value ("calc(100% - 40px)") is cut in the field.
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
const setEnabled = function (enabled) {
|
|
656
|
+
setFieldEnabled(enabled);
|
|
657
|
+
if (prefix) prefix.cursor = (state.enabled) ? "ew-resize" : "default";
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
setValue(value);
|
|
661
|
+
setEnabled(state.enabled);
|
|
662
|
+
|
|
663
|
+
return { field: field, setValue: setValue, setEnabled: setEnabled };
|
|
664
|
+
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
// FIELD: select (a menu of options). Used by "select" and "constraints".
|
|
668
|
+
// look: "field" (default) or "plain" (no background, width hugs the text)
|
|
669
|
+
const buildSelect = function (config, width, onPick) {
|
|
670
|
+
|
|
671
|
+
const options = normalizeOptions(config.options);
|
|
672
|
+
const isPlain = (config.look === "plain");
|
|
673
|
+
const state = { isHover: 0, isFocus: 0, enabled: config.enabled != 0 };
|
|
674
|
+
let value = config.value;
|
|
675
|
+
|
|
676
|
+
// GROUP: Field
|
|
677
|
+
const field = HGroup({
|
|
678
|
+
width: (isPlain) ? "auto" : width,
|
|
679
|
+
height: _g.itemHeight,
|
|
680
|
+
align: "left center",
|
|
681
|
+
gap: 0,
|
|
682
|
+
color: (isPlain) ? "transparent" : _s.field.color,
|
|
683
|
+
round: _s.field.round,
|
|
684
|
+
});
|
|
685
|
+
field.shrink = 0;
|
|
686
|
+
field.cursor = "pointer";
|
|
687
|
+
field.css = { boxSizing: "border-box", outline: "none", paddingLeft: (config.icon) ? "0px" : "8px" };
|
|
688
|
+
field.tabIndex = 0;
|
|
689
|
+
field.role = "button";
|
|
690
|
+
field.aria = { haspopup: "listbox", label: config.hint || config.label || config.key || "Select" };
|
|
691
|
+
field.clickable = 1;
|
|
692
|
+
|
|
693
|
+
if (config.icon) textLabel(getIcon(config.icon, 16), { width: 28, height: _g.itemHeight, textColor: _t.softColor });
|
|
694
|
+
const lblText = textLabel("", { flex: !isPlain, height: _g.itemHeight });
|
|
695
|
+
const lblArrow = textLabel(getIcon("chevronDown", 12), { width: 22, height: _g.itemHeight, textColor: _t.softColor });
|
|
696
|
+
|
|
697
|
+
endGroup();
|
|
698
|
+
|
|
699
|
+
// Plain: a hover background, no border.
|
|
700
|
+
const paint = function () {
|
|
701
|
+
if (isPlain) field.color = (state.isHover && state.enabled) ? _s.button.hoverColor : "transparent";
|
|
702
|
+
else paintField(field, state);
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
const open = function () {
|
|
706
|
+
if (!state.enabled) return;
|
|
707
|
+
openMenu(field, field, options, value, function (picked) {
|
|
708
|
+
setValue(picked);
|
|
709
|
+
onPick(picked);
|
|
710
|
+
});
|
|
711
|
+
};
|
|
712
|
+
field.on("click", open);
|
|
713
|
+
onActivateKey(field, open, ["ArrowDown"]);
|
|
714
|
+
onHover(field, function (isHover) {
|
|
715
|
+
state.isHover = isHover;
|
|
716
|
+
paint();
|
|
717
|
+
});
|
|
718
|
+
field.on("focus", function () {
|
|
719
|
+
state.isFocus = !isPlain;
|
|
720
|
+
paint();
|
|
721
|
+
});
|
|
722
|
+
field.on("blur", function () {
|
|
723
|
+
state.isFocus = 0;
|
|
724
|
+
paint();
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
// The text of the option, or the value itself when it is not an option.
|
|
728
|
+
const textOfValue = function (v) {
|
|
729
|
+
const option = findOption(options, v);
|
|
730
|
+
if (option) return option.text;
|
|
731
|
+
if (v === undefined || v === null) return "";
|
|
732
|
+
return String(v);
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
const setValue = function (v) {
|
|
736
|
+
value = v;
|
|
737
|
+
lblText.plainText = textOfValue(v);
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
const setEnabled = function (enabled) {
|
|
741
|
+
state.enabled = !!enabled;
|
|
742
|
+
lblText.textColor = ink(state.enabled, _t.color);
|
|
743
|
+
lblArrow.textColor = ink(state.enabled, _t.softColor);
|
|
744
|
+
field.cursor = (state.enabled) ? "pointer" : "default";
|
|
745
|
+
field.tabIndex = (state.enabled) ? 0 : -1;
|
|
746
|
+
paint();
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
setValue(value);
|
|
750
|
+
setEnabled(state.enabled);
|
|
751
|
+
|
|
752
|
+
return { field: field, setValue: setValue, setEnabled: setEnabled };
|
|
753
|
+
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
// BUTTON: A small icon button. Used by "iconButton", the title actions and the section actions.
|
|
757
|
+
// toggle: 1 -> value true / false (active look). Otherwise an action.
|
|
758
|
+
const buildIconButton = function (ctrl) {
|
|
759
|
+
|
|
760
|
+
const item = ctrl.item;
|
|
761
|
+
const isToggle = basic.isOn(item.toggle);
|
|
762
|
+
const useAccent = (item.accent !== 0);
|
|
763
|
+
const state = { value: !!item.value, enabled: item.enabled != 0, isHover: 0 };
|
|
764
|
+
|
|
765
|
+
// LABEL: Button
|
|
766
|
+
const btn = textLabel("", { width: _g.iconColumnWidth, height: _g.itemHeight, textColor: _s.button.iconColor });
|
|
767
|
+
btn.round = _s.field.round;
|
|
768
|
+
btn.clickable = 1;
|
|
769
|
+
btn.cursor = "pointer";
|
|
770
|
+
btn.css = { outline: "none", transition: "background-color 0.12s" };
|
|
771
|
+
btn.tabIndex = 0;
|
|
772
|
+
btn.role = "button";
|
|
773
|
+
btn.aria = { label: item.hint || item.key };
|
|
774
|
+
if (item.hint) btn.elem.title = item.hint;
|
|
775
|
+
|
|
776
|
+
// WHY: The icon (innerHTML) is only written when the value changes, not on every hover.
|
|
777
|
+
const paintIcon = function () {
|
|
778
|
+
btn.text = getIcon((isToggle && state.value && item.iconActive) ? item.iconActive : item.icon, 16);
|
|
779
|
+
if (isToggle) btn.aria = { pressed: (state.value) ? "true" : "false" };
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
const paintColors = function () {
|
|
783
|
+
const isActive = isToggle && state.value && useAccent;
|
|
784
|
+
if (isActive) btn.color = _s.button.activeColor;
|
|
785
|
+
else if (state.isHover && state.enabled) btn.color = _s.button.hoverColor;
|
|
786
|
+
else btn.color = "transparent";
|
|
787
|
+
btn.textColor = ink(state.enabled, (isActive) ? _s.button.activeIconColor : _s.button.iconColor);
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
const press = function () {
|
|
791
|
+
if (!state.enabled) return;
|
|
792
|
+
if (!isToggle) {
|
|
793
|
+
sendAction(ctrl, item.value);
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
state.value = !state.value;
|
|
797
|
+
paintIcon();
|
|
798
|
+
paintColors();
|
|
799
|
+
changeValue(ctrl, state.value);
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
const setValue = function (v) {
|
|
803
|
+
state.value = !!v;
|
|
804
|
+
paintIcon();
|
|
805
|
+
paintColors();
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
const setEnabled = function (enabled) {
|
|
809
|
+
state.enabled = !!enabled;
|
|
810
|
+
btn.cursor = (state.enabled) ? "pointer" : "default";
|
|
811
|
+
paintColors();
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
onHover(btn, function (isHover) {
|
|
815
|
+
state.isHover = isHover;
|
|
816
|
+
paintColors();
|
|
817
|
+
});
|
|
818
|
+
btn.on("click", press);
|
|
819
|
+
onActivateKey(btn, press);
|
|
820
|
+
|
|
821
|
+
paintIcon();
|
|
822
|
+
paintColors();
|
|
823
|
+
|
|
824
|
+
return { field: btn, setValue: setValue, setEnabled: setEnabled };
|
|
825
|
+
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
// ALIGN GRID: 3 x 3 places of the content. The chosen one is a filled square, the others empty squares.
|
|
829
|
+
const ALIGN_COLUMNS = ["left", "center", "right"];
|
|
830
|
+
const ALIGN_ROWS = ["top", "center", "bottom"];
|
|
831
|
+
|
|
832
|
+
// "center" -> "center center", "top left" -> "left top" (basic.js takes both orders).
|
|
833
|
+
const normalizeAlign = function (value) {
|
|
834
|
+
const words = String(value || "").trim().split(/\s+/);
|
|
835
|
+
if (words.length === 1) words.push("center");
|
|
836
|
+
// WHY: "center" is in both lists: only top / bottom and left / right tell the order.
|
|
837
|
+
const isVerticalFirst = /^(top|bottom)$/.test(words[0]) || /^(left|right)$/.test(words[1]);
|
|
838
|
+
return (isVerticalFirst) ? words[1] + " " + words[0] : words[0] + " " + words[1];
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
const buildAlignGrid = function (ctrl) {
|
|
842
|
+
|
|
843
|
+
const item = ctrl.item;
|
|
844
|
+
const ga = _s.alignGrid;
|
|
845
|
+
const SIZE = _g.itemHeight * 2 + _g.rowGap; // As high as two rows
|
|
846
|
+
const CELL = Math.floor(SIZE / 3); // The click area of one place
|
|
847
|
+
const MARK = 8; // The square in it
|
|
848
|
+
let value = normalizeAlign(item.value);
|
|
849
|
+
let enabled = item.enabled != 0;
|
|
850
|
+
const cells = []; // { area, mark, align, isHover }
|
|
851
|
+
|
|
852
|
+
const paintCell = function (cell) {
|
|
853
|
+
const isSelected = (cell.align === value);
|
|
854
|
+
const lineColor = (cell.isHover && enabled) ? ga.hoverColor : ga.cellColor;
|
|
855
|
+
cell.mark.color = (isSelected) ? ink(enabled, ga.selectedColor) : "transparent";
|
|
856
|
+
setBorder(cell.mark, (isSelected) ? "" : lineColor);
|
|
857
|
+
cell.area.aria = { checked: (isSelected) ? "true" : "false" };
|
|
858
|
+
};
|
|
859
|
+
const paint = function () { cells.forEach(paintCell); };
|
|
860
|
+
|
|
861
|
+
// BOX: Grid
|
|
862
|
+
const grid = startBox({ width: SIZE, height: SIZE, color: _s.field.color, round: _s.field.round });
|
|
863
|
+
grid.shrink = 0;
|
|
864
|
+
grid.role = "radiogroup";
|
|
865
|
+
grid.aria = { label: item.hint || item.label || item.key };
|
|
866
|
+
const offset = Math.floor((SIZE - CELL * 3) / 2);
|
|
867
|
+
|
|
868
|
+
ALIGN_ROWS.forEach(function (vertical, row) {
|
|
869
|
+
ALIGN_COLUMNS.forEach(function (horizontal, column) {
|
|
870
|
+
const align = horizontal + " " + vertical;
|
|
871
|
+
|
|
872
|
+
// BOX: The click area of a place
|
|
873
|
+
const area = startBox({ left: offset + column * CELL, top: offset + row * CELL, width: CELL, height: CELL, color: "transparent" });
|
|
874
|
+
area.clickable = 1;
|
|
875
|
+
area.cursor = "pointer";
|
|
876
|
+
area.tabIndex = 0;
|
|
877
|
+
area.role = "radio";
|
|
878
|
+
area.aria = { label: align };
|
|
879
|
+
area.css = { outline: "none" };
|
|
880
|
+
area.elem.title = align;
|
|
881
|
+
|
|
882
|
+
// BOX: The square
|
|
883
|
+
const mark = Box({ width: MARK, height: MARK, color: "transparent", round: 2 });
|
|
884
|
+
mark.center();
|
|
885
|
+
mark.css = { transition: "background-color 0.12s" };
|
|
886
|
+
|
|
887
|
+
endBox();
|
|
888
|
+
|
|
889
|
+
const cell = { area: area, mark: mark, align: align, isHover: 0 };
|
|
890
|
+
cells.push(cell);
|
|
891
|
+
|
|
892
|
+
const press = function () {
|
|
893
|
+
if (!enabled) return;
|
|
894
|
+
value = align;
|
|
895
|
+
paint();
|
|
896
|
+
changeValue(ctrl, value);
|
|
897
|
+
};
|
|
898
|
+
onHover(area, function (isHover) {
|
|
899
|
+
cell.isHover = isHover;
|
|
900
|
+
paintCell(cell);
|
|
901
|
+
});
|
|
902
|
+
area.on("click", press);
|
|
903
|
+
onActivateKey(area, press);
|
|
904
|
+
});
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
endBox();
|
|
908
|
+
|
|
909
|
+
paint();
|
|
910
|
+
|
|
911
|
+
return {
|
|
912
|
+
field: grid,
|
|
913
|
+
setValue: function (v) { value = normalizeAlign(v); paint(); },
|
|
914
|
+
setEnabled: function (e) { enabled = !!e; paint(); },
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
// *** COLOR (the color item and its picker):
|
|
920
|
+
// A value is a CSS color text: "#3871E0", "rgba(56, 113, 224, 0.5)", "transparent", "var(--color-primary)".
|
|
921
|
+
// The field shows it as a base (the color without its opacity) and an opacity: [■ #3871E0 | 50%].
|
|
922
|
+
|
|
923
|
+
const HEX_TEXT = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
924
|
+
const WRITTEN_AS_NUMBERS = /^(#|rgb|hsl)/i;
|
|
925
|
+
const ALPHA_MIX = /^color-mix\(in srgb,\s*(.+)\s+([\d.]+)%,\s*transparent\)$/i; // What Alpha() makes of a token
|
|
926
|
+
const CHECKER = "repeating-conic-gradient(#BBBBBB 0% 25%, #FFFFFF 0% 50%) 0 0 / 6px 6px";
|
|
927
|
+
const ALPHA_INPUT_WIDTH = 46;
|
|
928
|
+
const PICKER_SPACE = 8; // Between the panel and the color picker
|
|
929
|
+
|
|
930
|
+
// A CSS color -> { r, g, b, a }, read by a canvas. null: this page can not read it (Ex: an unknown token).
|
|
931
|
+
const readColor = function (color) {
|
|
932
|
+
if (!readColor.context) readColor.context = document.createElement("canvas").getContext("2d");
|
|
933
|
+
const context = readColor.context;
|
|
934
|
+
// WHY: A wrong color leaves the old fillStyle: two different starts tell a wrong color apart.
|
|
935
|
+
context.fillStyle = "#000000";
|
|
936
|
+
context.fillStyle = String(color || "");
|
|
937
|
+
const read = context.fillStyle;
|
|
938
|
+
context.fillStyle = "#FFFFFF";
|
|
939
|
+
context.fillStyle = String(color || "");
|
|
940
|
+
if (read !== context.fillStyle) return null;
|
|
941
|
+
if (read.charAt(0) === "#") {
|
|
942
|
+
return { r: parseInt(read.slice(1, 3), 16), g: parseInt(read.slice(3, 5), 16), b: parseInt(read.slice(5, 7), 16), a: 1 };
|
|
943
|
+
}
|
|
944
|
+
const parts = read.match(/[\d.]+/g);
|
|
945
|
+
return { r: Number(parts[0]), g: Number(parts[1]), b: Number(parts[2]), a: (parts[3] !== undefined) ? Number(parts[3]) : 1 };
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
const toHex = function (rgb) {
|
|
949
|
+
const digits = [rgb.r, rgb.g, rgb.b].map(function (n) {
|
|
950
|
+
return ("0" + Math.round(n).toString(16)).slice(-2);
|
|
951
|
+
});
|
|
952
|
+
return "#" + digits.join("").toUpperCase();
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
const roundAlpha = function (alpha) {
|
|
956
|
+
return Math.round(basic.clamp(alpha, 0, 1) * 100) / 100;
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
// A value -> { base, alpha }. "rgba(0, 0, 0, 0.5)" -> "#000000", 0.5. Alpha("var(--x)", 0.5) -> "var(--x)", 0.5
|
|
960
|
+
const splitAlpha = function (value) {
|
|
961
|
+
const text = String((value === undefined || value === null) ? "" : value).trim();
|
|
962
|
+
if (!text) return { base: "", alpha: 1 };
|
|
963
|
+
const mix = text.match(ALPHA_MIX);
|
|
964
|
+
if (mix) return { base: mix[1].trim(), alpha: Number(mix[2]) / 100 };
|
|
965
|
+
const rgb = readColor(text);
|
|
966
|
+
if (rgb && WRITTEN_AS_NUMBERS.test(text)) return { base: toHex(rgb), alpha: rgb.a };
|
|
967
|
+
return { base: text, alpha: (rgb) ? rgb.a : 1 };
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
// The opposite of splitAlpha: a base and an opacity -> one value.
|
|
971
|
+
const joinAlpha = function (base, alpha) {
|
|
972
|
+
alpha = roundAlpha(alpha);
|
|
973
|
+
if (alpha >= 1) return base;
|
|
974
|
+
const rgb = readColor(base);
|
|
975
|
+
if (!rgb) return Alpha(base, alpha); // A token: color-mix() keeps it a token
|
|
976
|
+
return "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + alpha + ")";
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
// A typed text -> a value. Hex digits keep the opacity of the color ("3871e0" -> "#3871E0"); any other text is used as it is.
|
|
980
|
+
const colorOfText = function (typed, alpha) {
|
|
981
|
+
if (!HEX_TEXT.test(typed)) return typed;
|
|
982
|
+
return joinAlpha("#" + typed.replace("#", "").toUpperCase(), alpha);
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
const rgbToHsv = function (rgb) {
|
|
986
|
+
const r = rgb.r / 255;
|
|
987
|
+
const g = rgb.g / 255;
|
|
988
|
+
const b = rgb.b / 255;
|
|
989
|
+
const max = Math.max(r, g, b);
|
|
990
|
+
const range = max - Math.min(r, g, b);
|
|
991
|
+
let hue = 0;
|
|
992
|
+
if (range && max === r) hue = ((g - b) / range) % 6;
|
|
993
|
+
else if (range && max === g) hue = (b - r) / range + 2;
|
|
994
|
+
else if (range) hue = (r - g) / range + 4;
|
|
995
|
+
return { h: (hue * 60 + 360) % 360, s: (max) ? range / max : 0, v: max };
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
const hsvToRgb = function (hsv) {
|
|
999
|
+
const part = function (n) {
|
|
1000
|
+
const k = (n + hsv.h / 60) % 6;
|
|
1001
|
+
return Math.round((hsv.v - hsv.v * hsv.s * Math.max(0, Math.min(k, 4 - k, 1))) * 255);
|
|
1002
|
+
};
|
|
1003
|
+
return { r: part(5), g: part(3), b: part(1) };
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// *** COLOR PALETTES: the color groups of the picker (the palettes param, and the presets of an item).
|
|
1007
|
+
|
|
1008
|
+
let paletteCache = null; // WHY: palettes may be a function (the colors of a page): read once per setData / picker.
|
|
1009
|
+
let lastPaletteKey = "";
|
|
1010
|
+
let colorFormat = "hex"; // The text of the color picker: "hex", "rgb", "hsl"
|
|
1011
|
+
const COLOR_FORMATS = ["hex", "rgb", "hsl"];
|
|
1012
|
+
const RECENT_COLOR_COUNT = 9; // One row of the picker
|
|
1013
|
+
|
|
1014
|
+
const loadRecentColors = function () {
|
|
1015
|
+
if (!box.recentColorsKey) return [];
|
|
1016
|
+
const saved = basic.storage.load(box.recentColorsKey);
|
|
1017
|
+
return (Array.isArray(saved)) ? saved : [];
|
|
1018
|
+
};
|
|
1019
|
+
let recentColors = loadRecentColors();
|
|
1020
|
+
|
|
1021
|
+
const rememberColor = function (value) {
|
|
1022
|
+
if (!value) return;
|
|
1023
|
+
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);
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
const toPreset = function (preset) {
|
|
1028
|
+
if (preset && typeof preset === "object") return preset;
|
|
1029
|
+
return { value: preset, color: preset, hint: preset };
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
const readPalettes = function () {
|
|
1033
|
+
const source = (typeof box.palettes === "function") ? box.palettes(box) : box.palettes;
|
|
1034
|
+
paletteCache = (Array.isArray(source)) ? source : [];
|
|
1035
|
+
return paletteCache;
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
// The palettes of an item: its presets (old item setting) first, then the palettes of the panel.
|
|
1039
|
+
const palettesOf = function (item, isFresh) {
|
|
1040
|
+
const shared = (isFresh || !paletteCache) ? readPalettes() : paletteCache;
|
|
1041
|
+
const list = shared.map(function (palette) {
|
|
1042
|
+
return Object.assign({}, palette, { colors: (palette.colors || []).map(toPreset) });
|
|
1043
|
+
});
|
|
1044
|
+
const presets = (Array.isArray(item.presets)) ? item.presets.filter(function (p) { return p !== "|"; }) : [];
|
|
1045
|
+
if (presets.length) list.unshift({ key: "__presets", name: "Presets", colors: presets.map(toPreset) });
|
|
1046
|
+
return list;
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
// The color to paint for a base: a token (var(--color-primary)) is painted with the color of its preset.
|
|
1050
|
+
const paintColorOf = function (item, value) {
|
|
1051
|
+
const parts = splitAlpha(value);
|
|
1052
|
+
if (!parts.base) return "transparent";
|
|
1053
|
+
let color = parts.base;
|
|
1054
|
+
palettesOf(item).forEach(function (palette) {
|
|
1055
|
+
palette.colors.forEach(function (preset) {
|
|
1056
|
+
if (preset.value === parts.base && preset.color) color = preset.color;
|
|
1057
|
+
});
|
|
1058
|
+
});
|
|
1059
|
+
return joinAlpha(color, parts.alpha);
|
|
1060
|
+
};
|
|
1061
|
+
|
|
1062
|
+
// A square that shows a color over a checkerboard (a transparent color shows the checkerboard).
|
|
1063
|
+
const paintChecker = function (obj, color) {
|
|
1064
|
+
obj.css.background = "linear-gradient(" + color + ", " + color + "), " + CHECKER;
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
// *** COLOR INPUTS: the color text and its opacity (%). Used by the color field and by the picker.
|
|
1068
|
+
|
|
1069
|
+
// INPUT: Opacity (%), at the end of a field made by buildInputField.
|
|
1070
|
+
const addAlphaInput = function (field, state, hint) {
|
|
1071
|
+
return createIn(field, function () {
|
|
1072
|
+
// BOX: Line between the color and its opacity
|
|
1073
|
+
const line = Box({ width: 1, height: 14, color: _ps.dividerColor });
|
|
1074
|
+
line.shrink = 0;
|
|
1075
|
+
line.clickable = 0;
|
|
1076
|
+
const alphaInput = Input({ width: ALPHA_INPUT_WIDTH, height: _g.itemHeight, minimal: 1, fontSize: _t.fontSize, textColor: _t.color });
|
|
1077
|
+
alphaInput.shrink = 0;
|
|
1078
|
+
const alphaEl = alphaInput.inputElement;
|
|
1079
|
+
Object.assign(alphaEl.style, {
|
|
1080
|
+
width: "100%",
|
|
1081
|
+
height: "100%",
|
|
1082
|
+
boxSizing: "border-box",
|
|
1083
|
+
padding: "0px 8px 0px 6px",
|
|
1084
|
+
backgroundColor: "transparent",
|
|
1085
|
+
border: "0px",
|
|
1086
|
+
color: _t.color,
|
|
1087
|
+
fontSize: _t.fontSize + "px",
|
|
1088
|
+
});
|
|
1089
|
+
alphaEl.setAttribute("spellcheck", "false");
|
|
1090
|
+
alphaEl.setAttribute("aria-label", hint + " opacity (%)");
|
|
1091
|
+
alphaEl.addEventListener("focus", function () {
|
|
1092
|
+
state.isFocus = 1;
|
|
1093
|
+
paintField(field, state);
|
|
1094
|
+
alphaInput.select();
|
|
1095
|
+
});
|
|
1096
|
+
alphaEl.addEventListener("blur", function () {
|
|
1097
|
+
state.isFocus = 0;
|
|
1098
|
+
paintField(field, state);
|
|
1099
|
+
});
|
|
1100
|
+
return alphaInput;
|
|
1101
|
+
});
|
|
1102
|
+
};
|
|
1103
|
+
|
|
1104
|
+
const rgbToHsl = function (rgb) {
|
|
1105
|
+
const r = rgb.r / 255;
|
|
1106
|
+
const g = rgb.g / 255;
|
|
1107
|
+
const b = rgb.b / 255;
|
|
1108
|
+
const max = Math.max(r, g, b);
|
|
1109
|
+
const min = Math.min(r, g, b);
|
|
1110
|
+
const lightness = (max + min) / 2;
|
|
1111
|
+
const range = max - min;
|
|
1112
|
+
const saturation = (range) ? range / (1 - Math.abs(2 * lightness - 1)) : 0;
|
|
1113
|
+
return { h: Math.round(rgbToHsv(rgb).h), s: Math.round(saturation * 100), l: Math.round(lightness * 100) };
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
// The text of a base in a format: "#3871E0" -> "56, 113, 224" (rgb) or "220, 74%, 55%" (hsl). A token stays as it is.
|
|
1117
|
+
const formatBase = function (base, format) {
|
|
1118
|
+
if (format === "hex" || base.charAt(0) !== "#") return base;
|
|
1119
|
+
const rgb = readColor(base);
|
|
1120
|
+
if (format === "rgb") return rgb.r + ", " + rgb.g + ", " + rgb.b;
|
|
1121
|
+
const hsl = rgbToHsl(rgb);
|
|
1122
|
+
return hsl.h + ", " + hsl.s + "%, " + hsl.l + "%";
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
const NUMBERS_OF_THREE = /^\s*([\d.]+)%?\s*[, ]\s*([\d.]+)%?\s*[, ]\s*([\d.]+)%?\s*$/;
|
|
1126
|
+
|
|
1127
|
+
// "56, 113, 224" (rgb) or "220, 74, 55" (hsl) -> "#3871E0". null: it is not three numbers.
|
|
1128
|
+
const hexOfNumbers = function (typed, format) {
|
|
1129
|
+
const match = typed.match(NUMBERS_OF_THREE);
|
|
1130
|
+
if (!match || format === "hex") return null;
|
|
1131
|
+
const text = (format === "rgb") ? "rgb(" + match[1] + ", " + match[2] + ", " + match[3] + ")" : "hsl(" + match[1] + ", " + match[2] + "%, " + match[3] + "%)";
|
|
1132
|
+
const rgb = readColor(text);
|
|
1133
|
+
return (rgb) ? toHex(rgb) : null;
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1136
|
+
const showColorInputs = function (input, alphaInput, value, format = "hex") {
|
|
1137
|
+
const parts = splitAlpha(value);
|
|
1138
|
+
input.text = formatBase(parts.base, format);
|
|
1139
|
+
alphaInput.text = (parts.base) ? Math.round(parts.alpha * 100) + "%" : "";
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
// api: { getValue(), commit(value), refresh(), getFormat() (optional, "hex" when not given) }
|
|
1143
|
+
// (refresh: show the current value again)
|
|
1144
|
+
const connectColorInputs = function (input, alphaInput, api) {
|
|
1145
|
+
|
|
1146
|
+
const el = input.inputElement;
|
|
1147
|
+
const alphaEl = alphaInput.inputElement;
|
|
1148
|
+
const formatOf = function () {
|
|
1149
|
+
return (api.getFormat) ? api.getFormat() : "hex";
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
const commitText = function () {
|
|
1153
|
+
const parts = splitAlpha(api.getValue());
|
|
1154
|
+
const typed = String(input.text).trim();
|
|
1155
|
+
if (typed === formatBase(parts.base, formatOf())) return;
|
|
1156
|
+
const hex = hexOfNumbers(typed, formatOf());
|
|
1157
|
+
api.commit((hex) ? joinAlpha(hex, parts.alpha) : colorOfText(typed, parts.alpha));
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
const commitAlpha = function (percent) {
|
|
1161
|
+
const parts = splitAlpha(api.getValue());
|
|
1162
|
+
if (!parts.base || isNaN(percent)) {
|
|
1163
|
+
api.refresh();
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
api.commit(joinAlpha(parts.base, basic.clamp(percent, 0, 100) / 100));
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1169
|
+
const percentOfInput = function () {
|
|
1170
|
+
return parseFloat(String(alphaInput.text).replace(",", "."));
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
el.addEventListener("blur", commitText);
|
|
1174
|
+
el.addEventListener("keydown", function (event) {
|
|
1175
|
+
if (event.key === "Enter") {
|
|
1176
|
+
event.preventDefault();
|
|
1177
|
+
el.blur();
|
|
1178
|
+
} else if (event.key === "Escape") {
|
|
1179
|
+
event.preventDefault();
|
|
1180
|
+
api.refresh();
|
|
1181
|
+
el.blur();
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1185
|
+
alphaEl.addEventListener("blur", function () { commitAlpha(percentOfInput()); });
|
|
1186
|
+
alphaEl.addEventListener("keydown", function (event) {
|
|
1187
|
+
const isArrow = (event.key === "ArrowUp" || event.key === "ArrowDown");
|
|
1188
|
+
if (isArrow) {
|
|
1189
|
+
event.preventDefault();
|
|
1190
|
+
const direction = (event.key === "ArrowUp") ? 1 : -1;
|
|
1191
|
+
const step = (event.shiftKey) ? SHIFT_STEP_FACTOR : 1;
|
|
1192
|
+
commitAlpha(Math.round(Math.round(splitAlpha(api.getValue()).alpha * 100) + direction * step));
|
|
1193
|
+
alphaInput.select();
|
|
1194
|
+
} else if (event.key === "Enter") {
|
|
1195
|
+
event.preventDefault();
|
|
1196
|
+
alphaEl.blur();
|
|
1197
|
+
} else if (event.key === "Escape") {
|
|
1198
|
+
event.preventDefault();
|
|
1199
|
+
api.refresh();
|
|
1200
|
+
alphaEl.blur();
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
// *** COLOR PICKER: a popup at the left of the panel (it uses the menu slot: one popup at a time).
|
|
1207
|
+
// [ saturation / brightness area ]
|
|
1208
|
+
// [eyedropper] [hue ]
|
|
1209
|
+
// [opacity ]
|
|
1210
|
+
// [ #3871E0 | 100% ]
|
|
1211
|
+
// [ Used on this page ⌄ + ] the palette list, then its colors
|
|
1212
|
+
|
|
1213
|
+
const openColorPicker = function (ctrl, colorField) {
|
|
1214
|
+
|
|
1215
|
+
const isOpenByThisOpener = (menu && menu.opener === colorField.opener);
|
|
1216
|
+
closeMenu();
|
|
1217
|
+
if (isOpenByThisOpener) return;
|
|
1218
|
+
|
|
1219
|
+
const cp = _s.colorPicker;
|
|
1220
|
+
const ms = _s.menu;
|
|
1221
|
+
const item = ctrl.item;
|
|
1222
|
+
const hint = item.hint || item.label || item.key;
|
|
1223
|
+
const contentWidth = cp.width - cp.padding * 2;
|
|
1224
|
+
const hasScreenDropper = (typeof window.EyeDropper === "function");
|
|
1225
|
+
const hasEyeDropper = hasScreenDropper || (typeof box.pickColor === "function");
|
|
1226
|
+
const sliderWidth = contentWidth - ((hasEyeDropper) ? _g.itemHeight + _g.gap : 0);
|
|
1227
|
+
let palettes = palettesOf(item, 1);
|
|
1228
|
+
let isPaletteListOpen = 0;
|
|
1229
|
+
let paletteArea = null;
|
|
1230
|
+
let swatchViews = [];
|
|
1231
|
+
let hsv = { h: 0, s: 0, v: 0 };
|
|
1232
|
+
let alpha = 1;
|
|
1233
|
+
let obj = null;
|
|
1234
|
+
let area = null;
|
|
1235
|
+
let areaHandle = null;
|
|
1236
|
+
let hueSlider = null;
|
|
1237
|
+
let alphaSlider = null;
|
|
1238
|
+
let hexInput = null;
|
|
1239
|
+
let alphaInput = null;
|
|
1240
|
+
let formatButton = null;
|
|
1241
|
+
let previewNow = null;
|
|
1242
|
+
let recentViews = [];
|
|
1243
|
+
const valueAtOpen = colorField.getValue();
|
|
1244
|
+
|
|
1245
|
+
// STATE <-> VALUE
|
|
1246
|
+
|
|
1247
|
+
const rgbOfState = function () {
|
|
1248
|
+
return hsvToRgb(hsv);
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
const valueOfState = function () {
|
|
1252
|
+
return joinAlpha(toHex(rgbOfState()), alpha);
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
// WHY: The hue of a gray (or black) can not be read from its color: the old hue stays.
|
|
1256
|
+
const readState = function () {
|
|
1257
|
+
const parts = splitAlpha(colorField.getValue());
|
|
1258
|
+
const rgb = readColor(paintColorOf(item, parts.base)) || { r: 0, g: 0, b: 0 };
|
|
1259
|
+
const next = rgbToHsv(rgb);
|
|
1260
|
+
if (next.s === 0 || next.v === 0) next.h = hsv.h;
|
|
1261
|
+
hsv = next;
|
|
1262
|
+
alpha = (parts.base) ? parts.alpha : 1;
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
const commitState = function () {
|
|
1266
|
+
colorField.commit(valueOfState());
|
|
1267
|
+
paintPicker();
|
|
1268
|
+
};
|
|
1269
|
+
|
|
1270
|
+
const commitValue = function (value) {
|
|
1271
|
+
colorField.commit(value);
|
|
1272
|
+
readState();
|
|
1273
|
+
paintPicker();
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1276
|
+
// PAINT
|
|
1277
|
+
|
|
1278
|
+
const placeThumb = function (slider, ratio) {
|
|
1279
|
+
slider.thumb.css.left = Math.round(ratio * (slider.width - cp.sliderHeight)) + "px";
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
const paintPicker = function () {
|
|
1283
|
+
const rgb = rgbOfState();
|
|
1284
|
+
const solid = "rgb(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ")";
|
|
1285
|
+
area.color = "hsl(" + Math.round(hsv.h) + ", 100%, 50%)";
|
|
1286
|
+
areaHandle.css.left = Math.round(hsv.s * contentWidth - cp.handleSize / 2) + "px";
|
|
1287
|
+
areaHandle.css.top = Math.round((1 - hsv.v) * cp.areaHeight - cp.handleSize / 2) + "px";
|
|
1288
|
+
areaHandle.color = solid;
|
|
1289
|
+
placeThumb(hueSlider, hsv.h / 360);
|
|
1290
|
+
hueSlider.thumb.color = "hsl(" + Math.round(hsv.h) + ", 100%, 50%)";
|
|
1291
|
+
alphaSlider.css.background = "linear-gradient(to right, rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", 0), " + solid + "), " + CHECKER;
|
|
1292
|
+
placeThumb(alphaSlider, alpha);
|
|
1293
|
+
paintChecker(alphaSlider.thumb, "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + alpha + ")");
|
|
1294
|
+
hueSlider.aria = { valuenow: Math.round(hsv.h) };
|
|
1295
|
+
alphaSlider.aria = { valuenow: Math.round(alpha * 100) };
|
|
1296
|
+
area.aria = { valuetext: "Saturation " + Math.round(hsv.s * 100) + "%, brightness " + Math.round(hsv.v * 100) + "%" };
|
|
1297
|
+
showColorInputs(hexInput, alphaInput, colorField.getValue(), colorFormat);
|
|
1298
|
+
formatButton.text = colorFormat.toUpperCase();
|
|
1299
|
+
paintChecker(previewNow, paintColorOf(item, colorField.getValue()));
|
|
1300
|
+
paintSelectedSwatch();
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
const paintSelectedSwatch = function () {
|
|
1304
|
+
const value = colorField.getValue();
|
|
1305
|
+
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;
|
|
1308
|
+
});
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1311
|
+
// DRAG: pointer down on a target, then moves until it is up. fn(ratioX, ratioY)
|
|
1312
|
+
const dragOn = function (target, fn) {
|
|
1313
|
+
const moveTo = function (event) {
|
|
1314
|
+
const rect = target.elem.getBoundingClientRect();
|
|
1315
|
+
fn(basic.clamp((event.clientX - rect.left) / rect.width, 0, 1), basic.clamp((event.clientY - rect.top) / rect.height, 0, 1));
|
|
1316
|
+
};
|
|
1317
|
+
target.elem.addEventListener("pointerdown", function (event) {
|
|
1318
|
+
event.preventDefault();
|
|
1319
|
+
target.elem.focus();
|
|
1320
|
+
target.elem.setPointerCapture(event.pointerId);
|
|
1321
|
+
moveTo(event);
|
|
1322
|
+
const onMove = function (moveEvent) { moveTo(moveEvent); };
|
|
1323
|
+
const onUp = function () {
|
|
1324
|
+
target.elem.removeEventListener("pointermove", onMove);
|
|
1325
|
+
target.elem.removeEventListener("pointerup", onUp);
|
|
1326
|
+
target.elem.removeEventListener("pointercancel", onUp);
|
|
1327
|
+
};
|
|
1328
|
+
target.elem.addEventListener("pointermove", onMove);
|
|
1329
|
+
target.elem.addEventListener("pointerup", onUp);
|
|
1330
|
+
target.elem.addEventListener("pointercancel", onUp);
|
|
1331
|
+
});
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
// keys: { ArrowLeft: fn(step), ... } step is 1, or 10 with Shift.
|
|
1335
|
+
const onArrowKeys = function (target, keys) {
|
|
1336
|
+
target.on("keydown", function (self, event) {
|
|
1337
|
+
const fn = keys[event.key];
|
|
1338
|
+
if (!fn) return;
|
|
1339
|
+
event.preventDefault();
|
|
1340
|
+
fn((event.shiftKey) ? SHIFT_STEP_FACTOR : 1);
|
|
1341
|
+
commitState();
|
|
1342
|
+
});
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
// VIEW
|
|
1346
|
+
|
|
1347
|
+
// BOX: A slider (hue or opacity) with a round thumb. ariaMax: the range a screen reader reads.
|
|
1348
|
+
const buildSlider = function (label, ariaMax) {
|
|
1349
|
+
const slider = startBox({ width: sliderWidth, height: cp.sliderHeight, round: cp.sliderHeight / 2, color: "transparent" });
|
|
1350
|
+
slider.css = { position: "relative", left: "0px", top: "0px" };
|
|
1351
|
+
slider.clipContent = 0;
|
|
1352
|
+
slider.clickable = 1;
|
|
1353
|
+
slider.cursor = "pointer";
|
|
1354
|
+
slider.tabIndex = 0;
|
|
1355
|
+
slider.role = "slider";
|
|
1356
|
+
slider.aria = { label: hint + " " + label, valuemin: 0, valuemax: ariaMax };
|
|
1357
|
+
slider.setFocusRing(_s.accent.color);
|
|
1358
|
+
slider.thumb = Box({ left: 0, top: 0, width: cp.sliderHeight, height: cp.sliderHeight, round: cp.sliderHeight / 2, color: "transparent" });
|
|
1359
|
+
slider.thumb.boxShadow = "0 0 0 2px #FFFFFF, 0 0 0 3px rgba(0, 0, 0, 0.35)";
|
|
1360
|
+
slider.thumb.clickable = 0;
|
|
1361
|
+
endBox();
|
|
1362
|
+
slider.shrink = 0;
|
|
1363
|
+
return slider;
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
const buildPaletteHeader = function (palette) {
|
|
1367
|
+
// GROUP: The name of the palette (opens the list of palettes) and the add button
|
|
1368
|
+
HGroup({ width: contentWidth, height: _g.itemHeight, align: "left center", gap: 4, color: "transparent" });
|
|
1369
|
+
const btnList = HGroup({ width: 10, height: _g.itemHeight, align: "left center", gap: 2, padding: [6, 0], round: _s.field.round, color: "transparent" });
|
|
1370
|
+
btnList.grow = 1;
|
|
1371
|
+
btnList.css = { minWidth: "0px" };
|
|
1372
|
+
btnList.clickable = 1;
|
|
1373
|
+
btnList.cursor = "pointer";
|
|
1374
|
+
btnList.tabIndex = 0;
|
|
1375
|
+
btnList.role = "button";
|
|
1376
|
+
btnList.aria = { label: "Color group: " + ((palette) ? palette.name : "none"), expanded: (isPaletteListOpen) ? "true" : "false" };
|
|
1377
|
+
btnList.elem.title = "Choose a color group";
|
|
1378
|
+
textLabel("", { flex: 1, height: _g.itemHeight, bold: 1, plainText: (palette) ? palette.name : "No colors" });
|
|
1379
|
+
textLabel(getIcon((isPaletteListOpen) ? "chevronUp" : "chevronDown", 14), { width: 16, height: _g.itemHeight, textColor: _t.softColor });
|
|
1380
|
+
endGroup();
|
|
1381
|
+
onHover(btnList, function (isHover) { btnList.color = (isHover) ? _s.button.hoverColor : "transparent"; });
|
|
1382
|
+
const togglePaletteList = function () {
|
|
1383
|
+
isPaletteListOpen = (isPaletteListOpen) ? 0 : 1;
|
|
1384
|
+
drawPaletteArea();
|
|
1385
|
+
};
|
|
1386
|
+
btnList.on("click", togglePaletteList);
|
|
1387
|
+
onActivateKey(btnList, togglePaletteList);
|
|
1388
|
+
|
|
1389
|
+
if (palette && palette.canAdd && !isPaletteListOpen) {
|
|
1390
|
+
const btnAdd = textLabel(getIcon("plus", 14), { width: _g.itemHeight, height: _g.itemHeight, textColor: _s.button.iconColor });
|
|
1391
|
+
btnAdd.round = _s.field.round;
|
|
1392
|
+
btnAdd.clickable = 1;
|
|
1393
|
+
btnAdd.cursor = "pointer";
|
|
1394
|
+
btnAdd.tabIndex = 0;
|
|
1395
|
+
btnAdd.role = "button";
|
|
1396
|
+
btnAdd.aria = { label: "Add this color to " + palette.name };
|
|
1397
|
+
btnAdd.elem.title = "Add this color to " + palette.name;
|
|
1398
|
+
onHover(btnAdd, function (isHover) { btnAdd.color = (isHover) ? _s.button.hoverColor : "transparent"; });
|
|
1399
|
+
btnAdd.on("click", function () { addColorTo(palette); });
|
|
1400
|
+
onActivateKey(btnAdd, function () { addColorTo(palette); });
|
|
1401
|
+
}
|
|
1402
|
+
endGroup();
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
|
+
const buildPaletteList = function (current) {
|
|
1406
|
+
palettes.forEach(function (palette) {
|
|
1407
|
+
const isSelected = (palette === current);
|
|
1408
|
+
// GROUP: A palette in the list
|
|
1409
|
+
const row = HGroup({ width: contentWidth, height: ms.rowHeight, align: "left center", gap: 0, round: _s.field.round, color: "transparent" });
|
|
1410
|
+
row.shrink = 0;
|
|
1411
|
+
row.clickable = 1;
|
|
1412
|
+
row.cursor = "pointer";
|
|
1413
|
+
row.tabIndex = 0;
|
|
1414
|
+
row.role = "option";
|
|
1415
|
+
row.aria = { selected: (isSelected) ? "true" : "false" };
|
|
1416
|
+
textLabel((isSelected) ? getIcon("check", 14) : "", { width: 24, height: ms.rowHeight });
|
|
1417
|
+
textLabel("", { flex: 1, height: ms.rowHeight, plainText: palette.name });
|
|
1418
|
+
textLabel("", { height: ms.rowHeight, textColor: _t.softColor, plainText: String(palette.colors.length) });
|
|
1419
|
+
endGroup();
|
|
1420
|
+
row.css.paddingRight = "6px";
|
|
1421
|
+
const choose = function () {
|
|
1422
|
+
lastPaletteKey = palette.key;
|
|
1423
|
+
isPaletteListOpen = 0;
|
|
1424
|
+
drawPaletteArea();
|
|
1425
|
+
};
|
|
1426
|
+
onHover(row, function (isHover) { row.color = (isHover) ? _s.button.hoverColor : "transparent"; });
|
|
1427
|
+
row.on("click", choose);
|
|
1428
|
+
onActivateKey(row, choose);
|
|
1429
|
+
});
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
// BOX: A color of a palette. A click gives its value. Returns { obj, value } (for the selected ring).
|
|
1433
|
+
const buildSwatch = function (preset) {
|
|
1434
|
+
const square = Box({ width: cp.swatchSize, height: cp.swatchSize, round: 4, color: "transparent" });
|
|
1435
|
+
square.shrink = 0;
|
|
1436
|
+
paintChecker(square, preset.color || preset.value);
|
|
1437
|
+
square.clickable = 1;
|
|
1438
|
+
square.cursor = "pointer";
|
|
1439
|
+
square.role = "button";
|
|
1440
|
+
square.tabIndex = 0;
|
|
1441
|
+
square.aria = { label: preset.hint || preset.value };
|
|
1442
|
+
square.elem.title = preset.hint || preset.value;
|
|
1443
|
+
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); });
|
|
1446
|
+
onActivateKey(square, function () { commitValue(preset.value); });
|
|
1447
|
+
return { obj: square, value: preset.value };
|
|
1448
|
+
};
|
|
1449
|
+
|
|
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 });
|
|
1460
|
+
});
|
|
1461
|
+
endGroup();
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1464
|
+
const buildSwatches = function (palette) {
|
|
1465
|
+
swatchViews = [];
|
|
1466
|
+
if (!palette.colors.length) {
|
|
1467
|
+
const lblEmpty = textLabel("", { textColor: _t.softColor, plainText: palette.emptyText || "No colors yet." });
|
|
1468
|
+
lblEmpty.css = { whiteSpace: "normal", lineHeight: "16px", padding: "2px 6px" };
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
// GROUP: The colors of the palette (scrolls when there are many)
|
|
1472
|
+
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" };
|
|
1474
|
+
grid.scrollY = 1; // (also clickable)
|
|
1475
|
+
palette.colors.forEach(function (preset) {
|
|
1476
|
+
swatchViews.push(buildSwatch(preset));
|
|
1477
|
+
});
|
|
1478
|
+
endGroup();
|
|
1479
|
+
};
|
|
1480
|
+
|
|
1481
|
+
// The palette part is drawn again when an other palette is chosen or a color is added.
|
|
1482
|
+
const drawPaletteArea = function () {
|
|
1483
|
+
if (paletteArea) paletteArea.remove();
|
|
1484
|
+
const current = palettes.find(function (p) { return p.key === lastPaletteKey; }) || palettes[0];
|
|
1485
|
+
paletteArea = createIn(obj, function () {
|
|
1486
|
+
// GROUP: Palettes
|
|
1487
|
+
const group = VGroup({ width: contentWidth, height: "auto", align: "left top", gap: 6, color: "transparent" });
|
|
1488
|
+
group.shrink = 0;
|
|
1489
|
+
buildPaletteHeader(current);
|
|
1490
|
+
if (isPaletteListOpen) buildPaletteList(current);
|
|
1491
|
+
else if (current) buildSwatches(current);
|
|
1492
|
+
endGroup();
|
|
1493
|
+
return group;
|
|
1494
|
+
});
|
|
1495
|
+
paintSelectedSwatch();
|
|
1496
|
+
placePicker();
|
|
1497
|
+
};
|
|
1498
|
+
|
|
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
|
+
// GROUP: The color before the picker opened (a click goes back to it) and the color now.
|
|
1520
|
+
const PREVIEW_WIDTH = 32;
|
|
1521
|
+
const buildPreview = function () {
|
|
1522
|
+
const preview = HGroup({ width: PREVIEW_WIDTH, height: _g.itemHeight, align: "left top", gap: 0, round: _s.field.round, color: "transparent" });
|
|
1523
|
+
preview.shrink = 0;
|
|
1524
|
+
preview.boxShadow = "inset 0 0 0 1px " + _s.swatch.borderColor;
|
|
1525
|
+
const before = Box({ width: PREVIEW_WIDTH / 2, height: _g.itemHeight, color: "transparent" });
|
|
1526
|
+
paintChecker(before, paintColorOf(item, valueAtOpen));
|
|
1527
|
+
before.clickable = 1;
|
|
1528
|
+
before.cursor = "pointer";
|
|
1529
|
+
before.role = "button";
|
|
1530
|
+
before.tabIndex = 0;
|
|
1531
|
+
before.aria = { label: "Back to the color before: " + (valueAtOpen || "none") };
|
|
1532
|
+
before.elem.title = "Before: " + (valueAtOpen || "none") + " (click to go back)";
|
|
1533
|
+
before.on("click", function () { commitValue(valueAtOpen); });
|
|
1534
|
+
onActivateKey(before, function () { commitValue(valueAtOpen); });
|
|
1535
|
+
previewNow = Box({ width: PREVIEW_WIDTH / 2, height: _g.itemHeight, color: "transparent" });
|
|
1536
|
+
previewNow.clickable = 0;
|
|
1537
|
+
endGroup();
|
|
1538
|
+
};
|
|
1539
|
+
|
|
1540
|
+
// LABEL: The format of the color text (a click: HEX -> RGB -> HSL)
|
|
1541
|
+
const buildFormatButton = function () {
|
|
1542
|
+
const btn = textLabel("HEX", { width: 34, height: _g.itemHeight, fontSize: 10, textColor: _t.softColor });
|
|
1543
|
+
btn.clickable = 1;
|
|
1544
|
+
btn.cursor = "pointer";
|
|
1545
|
+
btn.tabIndex = 0;
|
|
1546
|
+
btn.role = "button";
|
|
1547
|
+
btn.aria = { label: "Color format (HEX, RGB, HSL)" };
|
|
1548
|
+
btn.elem.title = "Change the format: HEX, RGB, HSL";
|
|
1549
|
+
const nextFormat = function () {
|
|
1550
|
+
colorFormat = COLOR_FORMATS[(COLOR_FORMATS.indexOf(colorFormat) + 1) % COLOR_FORMATS.length];
|
|
1551
|
+
paintPicker();
|
|
1552
|
+
};
|
|
1553
|
+
onHover(btn, function (isHover) { btn.textColor = (isHover) ? _t.color : _t.softColor; });
|
|
1554
|
+
btn.on("click", nextFormat);
|
|
1555
|
+
onActivateKey(btn, nextFormat);
|
|
1556
|
+
return btn;
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
// At the left of the panel, at the height of the field. Under the field when there is no space at the left.
|
|
1560
|
+
const placePicker = function () {
|
|
1561
|
+
const fieldRect = colorField.anchor.elem.getBoundingClientRect();
|
|
1562
|
+
const panelRect = box.elem.getBoundingClientRect();
|
|
1563
|
+
const height = obj.elem.offsetHeight;
|
|
1564
|
+
let left = panelRect.left - cp.width - PICKER_SPACE;
|
|
1565
|
+
let top = fieldRect.top;
|
|
1566
|
+
if (left < SCREEN_MARGIN) {
|
|
1567
|
+
left = Math.min(fieldRect.left, window.innerWidth - cp.width - SCREEN_MARGIN);
|
|
1568
|
+
top = fieldRect.bottom + MENU_OFFSET;
|
|
1569
|
+
}
|
|
1570
|
+
obj.left = Math.max(SCREEN_MARGIN, left);
|
|
1571
|
+
obj.top = Math.max(SCREEN_MARGIN, Math.min(top, window.innerHeight - height - SCREEN_MARGIN));
|
|
1572
|
+
};
|
|
1573
|
+
|
|
1574
|
+
createIn(page, function () {
|
|
1575
|
+
|
|
1576
|
+
// GROUP: Color picker
|
|
1577
|
+
obj = VGroup({ left: 0, top: 0, width: cp.width, height: "auto", align: "left top", gap: 10, padding: cp.padding, color: ms.color, round: ms.round });
|
|
1578
|
+
obj.boxShadow = "0 0 0 1px " + ms.borderColor + ", " + ms.shadow;
|
|
1579
|
+
obj.zIndex = MENU_Z_INDEX;
|
|
1580
|
+
obj.css = { boxSizing: "border-box" };
|
|
1581
|
+
obj.clipContent = 0;
|
|
1582
|
+
obj.clickable = 1;
|
|
1583
|
+
obj.role = "dialog";
|
|
1584
|
+
obj.aria = { label: hint + " color" };
|
|
1585
|
+
|
|
1586
|
+
// GROUP: Title and close
|
|
1587
|
+
HGroup({ width: contentWidth, height: _g.itemHeight, align: "left center", gap: 4, color: "transparent" });
|
|
1588
|
+
textLabel("", { flex: 1, bold: 1, plainText: hint });
|
|
1589
|
+
const btnClose = textLabel(getIcon("close", 14), { width: _g.itemHeight, height: _g.itemHeight, textColor: _t.softColor });
|
|
1590
|
+
btnClose.round = _s.field.round;
|
|
1591
|
+
btnClose.clickable = 1;
|
|
1592
|
+
btnClose.cursor = "pointer";
|
|
1593
|
+
btnClose.tabIndex = 0;
|
|
1594
|
+
btnClose.role = "button";
|
|
1595
|
+
btnClose.aria = { label: "Close (Escape)" };
|
|
1596
|
+
btnClose.elem.title = "Close (Escape)";
|
|
1597
|
+
onHover(btnClose, function (isHover) { btnClose.color = (isHover) ? _s.button.hoverColor : "transparent"; });
|
|
1598
|
+
btnClose.on("click", closeMenu);
|
|
1599
|
+
onActivateKey(btnClose, closeMenu);
|
|
1600
|
+
endGroup();
|
|
1601
|
+
|
|
1602
|
+
// BOX: Saturation (left to right) and brightness (bottom to top) of the hue
|
|
1603
|
+
area = startBox({ width: contentWidth, height: cp.areaHeight, round: 4, color: "transparent" });
|
|
1604
|
+
area.css = { position: "relative", left: "0px", top: "0px", backgroundImage: "linear-gradient(to top, #000000, transparent), linear-gradient(to right, #FFFFFF, transparent)" };
|
|
1605
|
+
area.shrink = 0;
|
|
1606
|
+
area.clipContent = 0;
|
|
1607
|
+
area.clickable = 1;
|
|
1608
|
+
area.cursor = "crosshair";
|
|
1609
|
+
area.tabIndex = 0;
|
|
1610
|
+
area.role = "slider";
|
|
1611
|
+
area.aria = { label: hint + " saturation and brightness" };
|
|
1612
|
+
area.setFocusRing(_s.accent.color);
|
|
1613
|
+
areaHandle = Box({ left: 0, top: 0, width: cp.handleSize, height: cp.handleSize, round: cp.handleSize / 2, color: "transparent" });
|
|
1614
|
+
areaHandle.boxShadow = "0 0 0 2px #FFFFFF, 0 0 0 3px rgba(0, 0, 0, 0.35)";
|
|
1615
|
+
areaHandle.clickable = 0;
|
|
1616
|
+
endBox();
|
|
1617
|
+
|
|
1618
|
+
// GROUP: The eyedropper and the hue and opacity sliders
|
|
1619
|
+
// WHY: clipContent 0: the rings of the thumbs are bigger than the sliders.
|
|
1620
|
+
const sliderRow = HGroup({ width: contentWidth, height: "auto", align: "left center", gap: _g.gap, color: "transparent" });
|
|
1621
|
+
sliderRow.clipContent = 0;
|
|
1622
|
+
if (hasEyeDropper) {
|
|
1623
|
+
const btnDropper = textLabel(getIcon("eyedropper", 16), { width: _g.itemHeight, height: _g.itemHeight, textColor: _s.button.iconColor });
|
|
1624
|
+
btnDropper.round = _s.field.round;
|
|
1625
|
+
btnDropper.clickable = 1;
|
|
1626
|
+
btnDropper.cursor = "pointer";
|
|
1627
|
+
btnDropper.tabIndex = 0;
|
|
1628
|
+
btnDropper.role = "button";
|
|
1629
|
+
const dropperHint = (hasScreenDropper) ? "Pick a color from the screen" : "Pick a color from the page";
|
|
1630
|
+
btnDropper.aria = { label: dropperHint };
|
|
1631
|
+
btnDropper.elem.title = dropperHint;
|
|
1632
|
+
onHover(btnDropper, function (isHover) { btnDropper.color = (isHover) ? _s.button.hoverColor : "transparent"; });
|
|
1633
|
+
// WHY closed first: the page is clicked to pick; the value comes back through setValue (onChange)
|
|
1634
|
+
const pickFromPage = function () {
|
|
1635
|
+
const key = item.key;
|
|
1636
|
+
const keptAlpha = alpha;
|
|
1637
|
+
const ctrlAtPick = controllers[key];
|
|
1638
|
+
closeMenu();
|
|
1639
|
+
box.pickColor(box, function (color) {
|
|
1640
|
+
// 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));
|
|
1643
|
+
});
|
|
1644
|
+
};
|
|
1645
|
+
const pickFromScreen = function () {
|
|
1646
|
+
if (!hasScreenDropper) {
|
|
1647
|
+
pickFromPage();
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
new window.EyeDropper().open().then(function (result) {
|
|
1651
|
+
if (!obj || obj._isRemoved) return;
|
|
1652
|
+
commitValue(joinAlpha(result.sRGBHex.toUpperCase(), alpha));
|
|
1653
|
+
}).catch(function () { }); // Escape: nothing was picked
|
|
1654
|
+
};
|
|
1655
|
+
btnDropper.on("click", pickFromScreen);
|
|
1656
|
+
onActivateKey(btnDropper, pickFromScreen);
|
|
1657
|
+
}
|
|
1658
|
+
// GROUP: Sliders
|
|
1659
|
+
const sliders = VGroup({ width: sliderWidth, height: "auto", align: "left top", gap: 10, color: "transparent" });
|
|
1660
|
+
sliders.clipContent = 0;
|
|
1661
|
+
hueSlider = buildSlider("hue", 360);
|
|
1662
|
+
hueSlider.css.background = "linear-gradient(to right, #FF0000, #FFFF00, #00FF00, #00FFFF, #0000FF, #FF00FF, #FF0000)";
|
|
1663
|
+
alphaSlider = buildSlider("opacity", 100);
|
|
1664
|
+
endGroup();
|
|
1665
|
+
endGroup();
|
|
1666
|
+
|
|
1667
|
+
// GROUP: Before / now, the format, the color text and its opacity
|
|
1668
|
+
HGroup({ width: contentWidth, height: _g.itemHeight, align: "left center", gap: 6, color: "transparent" });
|
|
1669
|
+
buildPreview();
|
|
1670
|
+
const inputs = buildInputField({ key: "hex", hint: hint }, contentWidth - PREVIEW_WIDTH - 6);
|
|
1671
|
+
inputs.el.style.paddingLeft = "4px";
|
|
1672
|
+
hexInput = inputs.input;
|
|
1673
|
+
alphaInput = addAlphaInput(inputs.field, inputs.state, hint);
|
|
1674
|
+
formatButton = createIn(inputs.field, buildFormatButton);
|
|
1675
|
+
inputs.field.elem.insertBefore(formatButton.elem, inputs.field.elem.firstChild);
|
|
1676
|
+
endGroup();
|
|
1677
|
+
|
|
1678
|
+
buildRecentColors();
|
|
1679
|
+
|
|
1680
|
+
// BOX: Line
|
|
1681
|
+
const line = Box({ width: contentWidth, height: 1, color: ms.borderColor });
|
|
1682
|
+
line.shrink = 0;
|
|
1683
|
+
|
|
1684
|
+
endGroup();
|
|
1685
|
+
|
|
1686
|
+
});
|
|
1687
|
+
|
|
1688
|
+
menu = {
|
|
1689
|
+
obj: obj,
|
|
1690
|
+
opener: colorField.opener,
|
|
1691
|
+
ctrl: ctrl,
|
|
1692
|
+
sync: function () {
|
|
1693
|
+
readState();
|
|
1694
|
+
paintPicker();
|
|
1695
|
+
},
|
|
1696
|
+
onClose: function () {
|
|
1697
|
+
const value = colorField.getValue();
|
|
1698
|
+
if (value !== valueAtOpen) rememberColor(value);
|
|
1699
|
+
},
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
dragOn(area, function (x, y) {
|
|
1703
|
+
hsv.s = x;
|
|
1704
|
+
hsv.v = 1 - y;
|
|
1705
|
+
commitState();
|
|
1706
|
+
});
|
|
1707
|
+
dragOn(hueSlider, function (x) {
|
|
1708
|
+
hsv.h = Math.min(x * 360, 359.9);
|
|
1709
|
+
commitState();
|
|
1710
|
+
});
|
|
1711
|
+
dragOn(alphaSlider, function (x) {
|
|
1712
|
+
alpha = roundAlpha(x);
|
|
1713
|
+
commitState();
|
|
1714
|
+
});
|
|
1715
|
+
onArrowKeys(area, {
|
|
1716
|
+
ArrowLeft: function (step) { hsv.s = basic.clamp(hsv.s - step / 100, 0, 1); },
|
|
1717
|
+
ArrowRight: function (step) { hsv.s = basic.clamp(hsv.s + step / 100, 0, 1); },
|
|
1718
|
+
ArrowUp: function (step) { hsv.v = basic.clamp(hsv.v + step / 100, 0, 1); },
|
|
1719
|
+
ArrowDown: function (step) { hsv.v = basic.clamp(hsv.v - step / 100, 0, 1); },
|
|
1720
|
+
});
|
|
1721
|
+
onArrowKeys(hueSlider, {
|
|
1722
|
+
ArrowLeft: function (step) { hsv.h = basic.clamp(hsv.h - step, 0, 359.9); },
|
|
1723
|
+
ArrowRight: function (step) { hsv.h = basic.clamp(hsv.h + step, 0, 359.9); },
|
|
1724
|
+
});
|
|
1725
|
+
onArrowKeys(alphaSlider, {
|
|
1726
|
+
ArrowLeft: function (step) { alpha = roundAlpha(alpha - step / 100); },
|
|
1727
|
+
ArrowRight: function (step) { alpha = roundAlpha(alpha + step / 100); },
|
|
1728
|
+
});
|
|
1729
|
+
connectColorInputs(hexInput, alphaInput, {
|
|
1730
|
+
getValue: colorField.getValue,
|
|
1731
|
+
commit: commitValue,
|
|
1732
|
+
refresh: paintPicker,
|
|
1733
|
+
getFormat: function () { return colorFormat; },
|
|
1734
|
+
});
|
|
1735
|
+
|
|
1736
|
+
readState();
|
|
1737
|
+
paintPicker();
|
|
1738
|
+
drawPaletteArea();
|
|
1739
|
+
area.elem.focus({ preventScroll: true });
|
|
1740
|
+
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
// FIELD: color. [■ #3871E0 | 100%] A click on the swatch opens the color picker.
|
|
1744
|
+
const buildColorField = function (ctrl) {
|
|
1745
|
+
|
|
1746
|
+
const item = ctrl.item;
|
|
1747
|
+
const sw = _s.swatch;
|
|
1748
|
+
const hint = item.hint || item.label || item.key;
|
|
1749
|
+
const { field, input, el, state, setEnabled } = buildInputField(item, getSpanWidth(item.span));
|
|
1750
|
+
if (item.placeholder) input.placeholder = item.placeholder;
|
|
1751
|
+
el.style.paddingLeft = "4px";
|
|
1752
|
+
let value = "";
|
|
1753
|
+
|
|
1754
|
+
// BOX: Swatch (a checkerboard under the color: a transparent color shows it). A button: it opens the picker.
|
|
1755
|
+
const swatchArea = createIn(field, function () {
|
|
1756
|
+
const area = startBox({ width: sw.size + 12, height: _g.itemHeight, color: "transparent" });
|
|
1757
|
+
area.shrink = 0;
|
|
1758
|
+
area.clickable = 1;
|
|
1759
|
+
area.cursor = "pointer";
|
|
1760
|
+
area.role = "button";
|
|
1761
|
+
area.tabIndex = 0;
|
|
1762
|
+
area.aria = { label: "Open the color picker of " + hint, haspopup: "dialog" };
|
|
1763
|
+
area.elem.title = "Open the color picker";
|
|
1764
|
+
area.fill = Box({ width: sw.size, height: sw.size, round: 3, color: "transparent" });
|
|
1765
|
+
area.fill.center();
|
|
1766
|
+
area.fill.clickable = 0;
|
|
1767
|
+
endBox();
|
|
1768
|
+
return area;
|
|
1769
|
+
});
|
|
1770
|
+
field.elem.insertBefore(swatchArea.elem, field.elem.firstChild);
|
|
1771
|
+
const alphaInput = addAlphaInput(field, state, hint);
|
|
1772
|
+
|
|
1773
|
+
const paint = function () {
|
|
1774
|
+
const isEmpty = (splitAlpha(value).base === "");
|
|
1775
|
+
paintChecker(swatchArea.fill, paintColorOf(item, value));
|
|
1776
|
+
setBorder(swatchArea.fill, (isEmpty) ? sw.emptyColor : sw.borderColor);
|
|
1777
|
+
showColorInputs(input, alphaInput, value);
|
|
1778
|
+
};
|
|
1779
|
+
|
|
1780
|
+
const setValue = function (v) {
|
|
1781
|
+
value = (v === undefined || v === null) ? "" : String(v);
|
|
1782
|
+
paint();
|
|
1783
|
+
if (menu && menu.ctrl === ctrl) menu.sync();
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
const commit = function (next) {
|
|
1787
|
+
value = String(next);
|
|
1788
|
+
paint();
|
|
1789
|
+
changeValue(ctrl, value);
|
|
1790
|
+
};
|
|
1791
|
+
|
|
1792
|
+
const colorField = {
|
|
1793
|
+
anchor: field,
|
|
1794
|
+
opener: swatchArea,
|
|
1795
|
+
getValue: function () { return value; },
|
|
1796
|
+
commit: commit,
|
|
1797
|
+
};
|
|
1798
|
+
const openPicker = function () {
|
|
1799
|
+
if (!state.enabled) return;
|
|
1800
|
+
openColorPicker(ctrl, colorField);
|
|
1801
|
+
};
|
|
1802
|
+
swatchArea.on("click", openPicker);
|
|
1803
|
+
onActivateKey(swatchArea, openPicker);
|
|
1804
|
+
|
|
1805
|
+
connectColorInputs(input, alphaInput, {
|
|
1806
|
+
getValue: colorField.getValue,
|
|
1807
|
+
commit: commit,
|
|
1808
|
+
refresh: paint,
|
|
1809
|
+
});
|
|
1810
|
+
|
|
1811
|
+
setValue(item.value);
|
|
1812
|
+
return {
|
|
1813
|
+
field: field,
|
|
1814
|
+
setValue: setValue,
|
|
1815
|
+
setEnabled: function (enabled) {
|
|
1816
|
+
setEnabled(enabled);
|
|
1817
|
+
alphaInput.inputElement.disabled = !enabled;
|
|
1818
|
+
alphaInput.inputElement.style.color = ink(enabled, _t.color);
|
|
1819
|
+
swatchArea.opacity = (enabled) ? 1 : 0.5;
|
|
1820
|
+
},
|
|
1821
|
+
};
|
|
1822
|
+
|
|
1823
|
+
};
|
|
1824
|
+
|
|
1825
|
+
// *** ITEM TYPES:
|
|
1826
|
+
// Each one creates its object in the current container and returns { field, setValue(v), setEnabled(e) }.
|
|
1827
|
+
// ctrl.item is the working copy of the JSON item. changeValue(ctrl, v) keeps the value and sends the change.
|
|
1828
|
+
// An optional .normalize(value) fills the missing parts of a value (used before the value is kept).
|
|
1829
|
+
|
|
1830
|
+
const ITEM_TYPES = {
|
|
1831
|
+
|
|
1832
|
+
// [X 396] prefix / icon, unit, min, max, step, precision, autoText ("Auto" when the value is null)
|
|
1833
|
+
number: function (ctrl) {
|
|
1834
|
+
return buildNumberInput(ctrl, getSpanWidth(ctrl.item.span));
|
|
1835
|
+
},
|
|
1836
|
+
|
|
1837
|
+
// [ text ] placeholder
|
|
1838
|
+
// A text of more lines. caption: the first line of the placeholder, so it goes away while writing. rows: the lines (2).
|
|
1839
|
+
textarea: function (ctrl) {
|
|
1840
|
+
const item = ctrl.item;
|
|
1841
|
+
const ta = _s.textarea;
|
|
1842
|
+
const rows = item.rows || 2;
|
|
1843
|
+
const state = { isHover: 0, isFocus: 0, enabled: item.enabled != 0 };
|
|
1844
|
+
|
|
1845
|
+
// GROUP: Field (the caption, the text)
|
|
1846
|
+
const field = VGroup({ width: getSpanWidth(item.span || "full"), height: "auto", align: "left top", gap: 2, padding: [8, 6], color: _s.field.color, round: _s.field.round });
|
|
1847
|
+
field.shrink = 0;
|
|
1848
|
+
field.css = { boxSizing: "border-box", transition: "box-shadow 0.12s", alignItems: "stretch" };
|
|
1849
|
+
const paint = function () { paintField(field, state); };
|
|
1850
|
+
|
|
1851
|
+
endGroup();
|
|
1852
|
+
|
|
1853
|
+
// TEXTAREA: a raw element (a basic.js Input is one line)
|
|
1854
|
+
const area = document.createElement("textarea");
|
|
1855
|
+
area.rows = rows;
|
|
1856
|
+
area.spellcheck = false;
|
|
1857
|
+
const placeholderLines = [item.caption, item.placeholder].filter(Boolean);
|
|
1858
|
+
area.placeholder = placeholderLines.join("\n");
|
|
1859
|
+
area.setAttribute("aria-label", item.caption || item.hint || item.label || item.key);
|
|
1860
|
+
Object.assign(area.style, {
|
|
1861
|
+
width: "100%",
|
|
1862
|
+
boxSizing: "border-box",
|
|
1863
|
+
padding: "0px",
|
|
1864
|
+
border: "0px",
|
|
1865
|
+
outline: "none",
|
|
1866
|
+
resize: "none",
|
|
1867
|
+
background: "transparent",
|
|
1868
|
+
color: _t.color,
|
|
1869
|
+
font: _t.fontSize + "px " + ta.fontFamily,
|
|
1870
|
+
lineHeight: ta.lineHeight + "px",
|
|
1871
|
+
pointerEvents: "auto",
|
|
1872
|
+
userSelect: "text",
|
|
1873
|
+
});
|
|
1874
|
+
field.elem.appendChild(area);
|
|
1875
|
+
|
|
1876
|
+
const setValue = function (v) { area.value = (v === undefined || v === null) ? "" : String(v); };
|
|
1877
|
+
const save = function () { changeValue(ctrl, area.value); };
|
|
1878
|
+
onHover(field, function (isHover) {
|
|
1879
|
+
state.isHover = isHover;
|
|
1880
|
+
paint();
|
|
1881
|
+
});
|
|
1882
|
+
area.addEventListener("focus", function () {
|
|
1883
|
+
state.isFocus = 1;
|
|
1884
|
+
paint();
|
|
1885
|
+
});
|
|
1886
|
+
area.addEventListener("blur", function () {
|
|
1887
|
+
state.isFocus = 0;
|
|
1888
|
+
paint();
|
|
1889
|
+
save();
|
|
1890
|
+
});
|
|
1891
|
+
area.addEventListener("keydown", function (event) {
|
|
1892
|
+
event.stopPropagation(); // WHY: The keys of a text are not shortcuts of the page.
|
|
1893
|
+
const isSave = event.key === "Enter" && (event.metaKey || event.ctrlKey);
|
|
1894
|
+
if (isSave) {
|
|
1895
|
+
event.preventDefault();
|
|
1896
|
+
area.blur();
|
|
1897
|
+
} else if (event.key === "Escape") {
|
|
1898
|
+
event.preventDefault();
|
|
1899
|
+
setValue(ctrl.item.value);
|
|
1900
|
+
area.blur();
|
|
1901
|
+
}
|
|
1902
|
+
});
|
|
1903
|
+
|
|
1904
|
+
setValue(item.value);
|
|
1905
|
+
paint();
|
|
1906
|
+
return {
|
|
1907
|
+
field: field,
|
|
1908
|
+
setValue: setValue,
|
|
1909
|
+
setEnabled: function (enabled) {
|
|
1910
|
+
state.enabled = !!enabled;
|
|
1911
|
+
area.disabled = !state.enabled;
|
|
1912
|
+
paint();
|
|
1913
|
+
},
|
|
1914
|
+
};
|
|
1915
|
+
},
|
|
1916
|
+
|
|
1917
|
+
text: function (ctrl) {
|
|
1918
|
+
const item = ctrl.item;
|
|
1919
|
+
const { field, input, el, setEnabled } = buildInputField(item, getSpanWidth(item.span));
|
|
1920
|
+
if (item.placeholder) input.placeholder = item.placeholder;
|
|
1921
|
+
const setValue = function (v) { input.text = (v === undefined || v === null) ? "" : String(v); };
|
|
1922
|
+
el.addEventListener("blur", function () { changeValue(ctrl, String(input.text)); });
|
|
1923
|
+
el.addEventListener("keydown", function (event) {
|
|
1924
|
+
if (event.key === "Enter") {
|
|
1925
|
+
event.preventDefault();
|
|
1926
|
+
el.blur();
|
|
1927
|
+
} else if (event.key === "Escape") {
|
|
1928
|
+
event.preventDefault();
|
|
1929
|
+
setValue(ctrl.item.value);
|
|
1930
|
+
el.blur();
|
|
1931
|
+
}
|
|
1932
|
+
});
|
|
1933
|
+
setValue(item.value);
|
|
1934
|
+
return { field: field, setValue: setValue, setEnabled: setEnabled };
|
|
1935
|
+
},
|
|
1936
|
+
|
|
1937
|
+
// [ Left ⌄] options: ["A", "B"] or [{ value, text, icon }], icon, look: "plain"
|
|
1938
|
+
select: function (ctrl) {
|
|
1939
|
+
return buildSelect(ctrl.item, getSpanWidth(ctrl.item.span), function (v) { changeValue(ctrl, v); });
|
|
1940
|
+
},
|
|
1941
|
+
|
|
1942
|
+
// [16 | ⌄] a number field and preset values (options)
|
|
1943
|
+
combo: function (ctrl) {
|
|
1944
|
+
const item = ctrl.item;
|
|
1945
|
+
const width = getSpanWidth(item.span);
|
|
1946
|
+
const arrowWidth = 22;
|
|
1947
|
+
const r = _s.field.round + "px";
|
|
1948
|
+
let enabled = item.enabled != 0;
|
|
1949
|
+
|
|
1950
|
+
// GROUP: Number field + menu button
|
|
1951
|
+
const group = HGroup({ width: width, height: _g.itemHeight, align: "left center", gap: 1, color: "transparent" });
|
|
1952
|
+
group.shrink = 0;
|
|
1953
|
+
|
|
1954
|
+
const numberInput = buildNumberInput(ctrl, width - arrowWidth - 1);
|
|
1955
|
+
numberInput.field.css.borderRadius = r + " 0px 0px " + r;
|
|
1956
|
+
|
|
1957
|
+
// LABEL: Menu button
|
|
1958
|
+
const btnArrow = textLabel(getIcon("chevronDown", 12), { width: arrowWidth, height: _g.itemHeight, textColor: _t.softColor });
|
|
1959
|
+
btnArrow.color = _s.field.color;
|
|
1960
|
+
btnArrow.clickable = 1;
|
|
1961
|
+
btnArrow.cursor = "pointer";
|
|
1962
|
+
btnArrow.css.borderRadius = "0px " + r + " " + r + " 0px";
|
|
1963
|
+
|
|
1964
|
+
endGroup();
|
|
1965
|
+
|
|
1966
|
+
const options = normalizeOptions(item.options);
|
|
1967
|
+
onHover(btnArrow, function (isHover) {
|
|
1968
|
+
btnArrow.color = (isHover && enabled) ? _s.segmented.hoverColor : _s.field.color;
|
|
1969
|
+
});
|
|
1970
|
+
btnArrow.on("click", function () {
|
|
1971
|
+
if (!enabled) return;
|
|
1972
|
+
openMenu(group, btnArrow, options, ctrl.item.value, function (picked) {
|
|
1973
|
+
numberInput.setValue(picked);
|
|
1974
|
+
changeValue(ctrl, picked);
|
|
1975
|
+
});
|
|
1976
|
+
});
|
|
1977
|
+
|
|
1978
|
+
const setEnabled = function (e) {
|
|
1979
|
+
enabled = !!e;
|
|
1980
|
+
numberInput.setEnabled(e);
|
|
1981
|
+
btnArrow.textColor = ink(enabled, _t.softColor);
|
|
1982
|
+
};
|
|
1983
|
+
|
|
1984
|
+
return { field: group, setValue: numberInput.setValue, setEnabled: setEnabled };
|
|
1985
|
+
},
|
|
1986
|
+
|
|
1987
|
+
// [≡|≡|≡] options: [{ value, icon, text, hint }]. value !== undefined -> one is selected.
|
|
1988
|
+
segmented: function (ctrl) {
|
|
1989
|
+
const item = ctrl.item;
|
|
1990
|
+
const options = normalizeOptions(item.options);
|
|
1991
|
+
const isSelect = (item.mode) ? (item.mode === "select") : (item.value !== undefined);
|
|
1992
|
+
const r = _s.field.round + "px";
|
|
1993
|
+
let value = item.value;
|
|
1994
|
+
let enabled = item.enabled != 0;
|
|
1995
|
+
const parts = []; // { seg, option, isHover }
|
|
1996
|
+
|
|
1997
|
+
// One segment: background, border, icon color.
|
|
1998
|
+
const paintPart = function (part) {
|
|
1999
|
+
const isSelected = isSelect && PropertyPanel.isSameValue(part.option.value, value);
|
|
2000
|
+
const seg = part.seg;
|
|
2001
|
+
if (isSelected) seg.color = _s.segmented.selectedColor;
|
|
2002
|
+
else if (part.isHover && enabled) seg.color = _s.segmented.hoverColor;
|
|
2003
|
+
else seg.color = (isSelect) ? "transparent" : _s.field.color;
|
|
2004
|
+
setBorder(seg, (isSelected) ? _s.segmented.selectedBorderColor : "");
|
|
2005
|
+
seg.textColor = ink(enabled, (isSelect && !isSelected) ? _t.softColor : _s.button.iconColor);
|
|
2006
|
+
if (isSelect) seg.aria = { checked: (isSelected) ? "true" : "false" };
|
|
2007
|
+
};
|
|
2008
|
+
const paint = function () { parts.forEach(paintPart); };
|
|
2009
|
+
|
|
2010
|
+
// Select: every segment is round. Actions: only the outer corners of the row.
|
|
2011
|
+
const radiusOf = function (index) {
|
|
2012
|
+
if (isSelect) return r;
|
|
2013
|
+
if (index === 0) return r + " 0 0 " + r;
|
|
2014
|
+
if (index === options.length - 1) return "0 " + r + " " + r + " 0";
|
|
2015
|
+
return "0";
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2018
|
+
// GROUP: Segments
|
|
2019
|
+
const group = HGroup({
|
|
2020
|
+
width: getSpanWidth(item.span),
|
|
2021
|
+
height: _g.itemHeight,
|
|
2022
|
+
align: "left center",
|
|
2023
|
+
gap: (isSelect) ? 0 : 1,
|
|
2024
|
+
color: (isSelect) ? _s.field.color : "transparent",
|
|
2025
|
+
round: _s.field.round,
|
|
2026
|
+
});
|
|
2027
|
+
group.shrink = 0;
|
|
2028
|
+
group.role = (isSelect) ? "radiogroup" : "group";
|
|
2029
|
+
group.aria = { label: item.hint || item.label || item.key };
|
|
2030
|
+
|
|
2031
|
+
options.forEach(function (option, index) {
|
|
2032
|
+
// LABEL: Segment
|
|
2033
|
+
const segHtml = (option.icon) ? getIcon(option.icon, 16) : basic.escapeHtml(option.text);
|
|
2034
|
+
const seg = textLabel(segHtml, { width: 10, height: _g.itemHeight, textColor: _s.button.iconColor });
|
|
2035
|
+
seg.grow = 1;
|
|
2036
|
+
seg.shrink = 1;
|
|
2037
|
+
seg.cursor = "pointer";
|
|
2038
|
+
seg.clickable = 1;
|
|
2039
|
+
seg.css = {
|
|
2040
|
+
flexBasis: "0px",
|
|
2041
|
+
outline: "none",
|
|
2042
|
+
transition: "background-color 0.12s",
|
|
2043
|
+
borderRadius: radiusOf(index),
|
|
2044
|
+
};
|
|
2045
|
+
seg.tabIndex = 0;
|
|
2046
|
+
seg.role = (isSelect) ? "radio" : "button";
|
|
2047
|
+
seg.aria = { label: option.hint || option.text };
|
|
2048
|
+
if (option.hint) seg.elem.title = option.hint;
|
|
2049
|
+
|
|
2050
|
+
const part = { seg: seg, option: option, isHover: 0 };
|
|
2051
|
+
parts.push(part);
|
|
2052
|
+
|
|
2053
|
+
const press = function () {
|
|
2054
|
+
if (!enabled) return;
|
|
2055
|
+
if (!isSelect) {
|
|
2056
|
+
sendAction(ctrl, option.value);
|
|
2057
|
+
return;
|
|
2058
|
+
}
|
|
2059
|
+
value = option.value;
|
|
2060
|
+
paint();
|
|
2061
|
+
changeValue(ctrl, value);
|
|
2062
|
+
};
|
|
2063
|
+
onHover(seg, function (isHover) {
|
|
2064
|
+
part.isHover = isHover;
|
|
2065
|
+
paintPart(part);
|
|
2066
|
+
});
|
|
2067
|
+
seg.on("click", press);
|
|
2068
|
+
onActivateKey(seg, press);
|
|
2069
|
+
});
|
|
2070
|
+
|
|
2071
|
+
endGroup();
|
|
2072
|
+
|
|
2073
|
+
paint();
|
|
2074
|
+
|
|
2075
|
+
return {
|
|
2076
|
+
field: group,
|
|
2077
|
+
setValue: function (v) { value = v; paint(); },
|
|
2078
|
+
setEnabled: function (e) { enabled = !!e; paint(); },
|
|
2079
|
+
};
|
|
2080
|
+
},
|
|
2081
|
+
|
|
2082
|
+
// [◎] icon, iconActive, toggle: 1 (value true / false), accent: 0 (no blue look when on)
|
|
2083
|
+
iconButton: buildIconButton,
|
|
2084
|
+
|
|
2085
|
+
alignGrid: buildAlignGrid,
|
|
2086
|
+
|
|
2087
|
+
color: buildColorField,
|
|
2088
|
+
|
|
2089
|
+
// Horizontal / vertical selects at the left and the constraints diagram at the right.
|
|
2090
|
+
// value: { horizontal: "left" | "right" | "leftRight" | "center" | "scale", vertical: "top" | "bottom" | "topBottom" | "center" | "scale" }
|
|
2091
|
+
constraints: function (ctrl) {
|
|
2092
|
+
const item = ctrl.item;
|
|
2093
|
+
let value = item.value; // Normalized: always has horizontal and vertical.
|
|
2094
|
+
let enabled = item.enabled != 0;
|
|
2095
|
+
const H_OPTIONS = [
|
|
2096
|
+
{ value: "left", text: "Left" },
|
|
2097
|
+
{ value: "right", text: "Right" },
|
|
2098
|
+
{ value: "leftRight", text: "Left and right" },
|
|
2099
|
+
{ value: "center", text: "Center" },
|
|
2100
|
+
{ value: "scale", text: "Scale" },
|
|
2101
|
+
];
|
|
2102
|
+
const V_OPTIONS = [
|
|
2103
|
+
{ value: "top", text: "Top" },
|
|
2104
|
+
{ value: "bottom", text: "Bottom" },
|
|
2105
|
+
{ value: "topBottom", text: "Top and bottom" },
|
|
2106
|
+
{ value: "center", text: "Center" },
|
|
2107
|
+
{ value: "scale", text: "Scale" },
|
|
2108
|
+
];
|
|
2109
|
+
const W = _g.columnWidth;
|
|
2110
|
+
const H = _g.itemHeight * 2 + _g.rowGap;
|
|
2111
|
+
|
|
2112
|
+
const change = function (next) {
|
|
2113
|
+
value = Object.assign({}, value, next);
|
|
2114
|
+
paint();
|
|
2115
|
+
changeValue(ctrl, value);
|
|
2116
|
+
};
|
|
2117
|
+
|
|
2118
|
+
// GROUP: Selects + diagram
|
|
2119
|
+
const group = HGroup({ width: getSpanWidth(2), height: H, align: "left top", gap: _g.gap, color: "transparent" });
|
|
2120
|
+
group.shrink = 0;
|
|
2121
|
+
|
|
2122
|
+
// GROUP: Selects
|
|
2123
|
+
VGroup({ width: W, height: H, align: "left top", gap: _g.rowGap, color: "transparent" });
|
|
2124
|
+
that.shrink = 0;
|
|
2125
|
+
const selH = buildSelect(
|
|
2126
|
+
{ key: item.key + "-h", hint: "Horizontal constraint", icon: "constraintH", options: H_OPTIONS, value: value.horizontal },
|
|
2127
|
+
W, function (v) { change({ horizontal: v }); });
|
|
2128
|
+
const selV = buildSelect(
|
|
2129
|
+
{ key: item.key + "-v", hint: "Vertical constraint", icon: "constraintV", options: V_OPTIONS, value: value.vertical },
|
|
2130
|
+
W, function (v) { change({ vertical: v }); });
|
|
2131
|
+
endGroup();
|
|
2132
|
+
|
|
2133
|
+
// BOX: Diagram
|
|
2134
|
+
const diagram = startBox({ width: W, height: H, color: _s.field.color, round: _s.field.round });
|
|
2135
|
+
diagram.shrink = 0;
|
|
2136
|
+
|
|
2137
|
+
const cx = Math.round(W / 2);
|
|
2138
|
+
const cy = Math.round(H / 2);
|
|
2139
|
+
// Inner frame
|
|
2140
|
+
const iw = 34;
|
|
2141
|
+
const ih = 22;
|
|
2142
|
+
const ix = cx - iw / 2;
|
|
2143
|
+
const iy = cy - ih / 2;
|
|
2144
|
+
|
|
2145
|
+
// BOX: Inner frame
|
|
2146
|
+
const frame = Box({ left: ix, top: iy, width: iw, height: ih, color: "transparent", round: 3 });
|
|
2147
|
+
setBorder(frame, _s.constraints.frameColor);
|
|
2148
|
+
|
|
2149
|
+
const line = function (left, top, width, height) {
|
|
2150
|
+
const obj = Box({ left: left, top: top, width: width, height: height, color: _t.disabledColor, round: 1 });
|
|
2151
|
+
obj.clickable = 0;
|
|
2152
|
+
return obj;
|
|
2153
|
+
};
|
|
2154
|
+
const lines = {
|
|
2155
|
+
top: line(cx - 1, iy - 13, 2, 9),
|
|
2156
|
+
bottom: line(cx - 1, iy + ih + 4, 2, 9),
|
|
2157
|
+
left: line(ix - 17, cy - 1, 13, 2),
|
|
2158
|
+
right: line(ix + iw + 4, cy - 1, 13, 2),
|
|
2159
|
+
centerH: line(cx - 6, cy, 12, 1),
|
|
2160
|
+
centerV: line(cx, cy - 6, 1, 12),
|
|
2161
|
+
};
|
|
2162
|
+
|
|
2163
|
+
// Click areas (bigger than the lines). Shift + click: both sides.
|
|
2164
|
+
const hitArea = function (left, top, width, height, onClick) {
|
|
2165
|
+
const obj = Box({ left: left, top: top, width: width, height: height, color: "transparent" });
|
|
2166
|
+
obj.clickable = 1;
|
|
2167
|
+
obj.cursor = "pointer";
|
|
2168
|
+
obj.on("click", function (self, event) {
|
|
2169
|
+
if (enabled) onClick(event.shiftKey);
|
|
2170
|
+
});
|
|
2171
|
+
return obj;
|
|
2172
|
+
};
|
|
2173
|
+
hitArea(cx - 10, 0, 20, iy - 2, function (shift) { change({ vertical: (shift && value.vertical === "bottom") ? "topBottom" : "top" }); });
|
|
2174
|
+
hitArea(cx - 10, iy + ih + 2, 20, H - iy - ih - 2, function (shift) { change({ vertical: (shift && value.vertical === "top") ? "topBottom" : "bottom" }); });
|
|
2175
|
+
hitArea(0, cy - 8, ix - 2, 16, function (shift) { change({ horizontal: (shift && value.horizontal === "right") ? "leftRight" : "left" }); });
|
|
2176
|
+
hitArea(ix + iw + 2, cy - 8, W - ix - iw - 2, 16, function (shift) { change({ horizontal: (shift && value.horizontal === "left") ? "leftRight" : "right" }); });
|
|
2177
|
+
hitArea(ix + 2, iy + 2, iw - 4, ih - 4, function () { change({ horizontal: "center", vertical: "center" }); });
|
|
2178
|
+
|
|
2179
|
+
endBox();
|
|
2180
|
+
|
|
2181
|
+
endGroup();
|
|
2182
|
+
|
|
2183
|
+
const paint = function () {
|
|
2184
|
+
const h = value.horizontal;
|
|
2185
|
+
const v = value.vertical;
|
|
2186
|
+
// Side lines: accent when on, gray when off. Center lines: accent when on, soft when off.
|
|
2187
|
+
const side = function (obj, isOn) { obj.color = (isOn) ? ink(enabled, _s.accent.color) : _t.disabledColor; };
|
|
2188
|
+
side(lines.top, v === "top" || v === "topBottom");
|
|
2189
|
+
side(lines.bottom, v === "bottom" || v === "topBottom");
|
|
2190
|
+
side(lines.left, h === "left" || h === "leftRight");
|
|
2191
|
+
side(lines.right, h === "right" || h === "leftRight");
|
|
2192
|
+
lines.centerH.color = (h === "center" && enabled) ? _s.accent.color : _t.softColor;
|
|
2193
|
+
lines.centerV.color = (v === "center" && enabled) ? _s.accent.color : _t.softColor;
|
|
2194
|
+
selH.setValue(h);
|
|
2195
|
+
selV.setValue(v);
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2198
|
+
paint();
|
|
2199
|
+
|
|
2200
|
+
return {
|
|
2201
|
+
field: group,
|
|
2202
|
+
setValue: function (v) { value = v; paint(); },
|
|
2203
|
+
setEnabled: function (e) {
|
|
2204
|
+
enabled = !!e;
|
|
2205
|
+
selH.setEnabled(e);
|
|
2206
|
+
selV.setEnabled(e);
|
|
2207
|
+
paint();
|
|
2208
|
+
},
|
|
2209
|
+
};
|
|
2210
|
+
},
|
|
2211
|
+
|
|
2212
|
+
};
|
|
2213
|
+
|
|
2214
|
+
ITEM_TYPES.constraints.normalize = function (value) {
|
|
2215
|
+
return Object.assign({ horizontal: "left", vertical: "top" }, value || {});
|
|
2216
|
+
};
|
|
2217
|
+
|
|
2218
|
+
// *** VIEW BUILDERS:
|
|
2219
|
+
|
|
2220
|
+
// Builds an item with its type and registers it by its key. Returns its controller (or null).
|
|
2221
|
+
const registerItem = function (item, sectionKey) {
|
|
2222
|
+
const builder = ITEM_TYPES[item.type];
|
|
2223
|
+
if (!builder) {
|
|
2224
|
+
console.warn("PropertyPanel: Unknown item type: " + item.type);
|
|
2225
|
+
return null;
|
|
2226
|
+
}
|
|
2227
|
+
item.value = normalizeValue(item, item.value);
|
|
2228
|
+
const ctrl = { item: item, sectionKey: sectionKey };
|
|
2229
|
+
Object.assign(ctrl, builder(ctrl));
|
|
2230
|
+
if (item.key !== undefined) {
|
|
2231
|
+
if (controllers[item.key]) console.warn("PropertyPanel: Same key twice: " + item.key);
|
|
2232
|
+
controllers[item.key] = ctrl;
|
|
2233
|
+
}
|
|
2234
|
+
return ctrl;
|
|
2235
|
+
};
|
|
2236
|
+
|
|
2237
|
+
// item.visible: 0 hides the cell of the item (or the object itself when it has no cell).
|
|
2238
|
+
const applyVisible = function (ctrl) {
|
|
2239
|
+
if (!ctrl) return;
|
|
2240
|
+
const isHidden = (ctrl.item.visible === 0 || ctrl.item.visible === false);
|
|
2241
|
+
const obj = ctrl.cell || ctrl.field;
|
|
2242
|
+
obj.visible = (isHidden) ? 0 : 1;
|
|
2243
|
+
};
|
|
2244
|
+
|
|
2245
|
+
// One item of a row: the caption (if the row has one) and its object.
|
|
2246
|
+
const buildItem = function (item, sectionKey, hasCaption) {
|
|
2247
|
+
|
|
2248
|
+
// GROUP: Cell (as wide as its object)
|
|
2249
|
+
const cell = VGroup({ hug: 1, align: "left top", gap: 6, color: "transparent" });
|
|
2250
|
+
cell.shrink = 0;
|
|
2251
|
+
|
|
2252
|
+
if (hasCaption) {
|
|
2253
|
+
const caption = textLabel("", { fontSize: _t.captionSize, textColor: _t.softColor, height: 16, plainText: item.label || "" });
|
|
2254
|
+
// WHY: A long caption must not make the cell wider than its object: it takes the width of the cell.
|
|
2255
|
+
caption.css = { width: "0px", minWidth: "100%" };
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
const ctrl = registerItem(item, sectionKey);
|
|
2259
|
+
|
|
2260
|
+
endGroup();
|
|
2261
|
+
|
|
2262
|
+
if (ctrl) {
|
|
2263
|
+
ctrl.cell = cell;
|
|
2264
|
+
applyVisible(ctrl);
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
};
|
|
2268
|
+
|
|
2269
|
+
// Title + actions row (the panel title or a section title). Returns the title label.
|
|
2270
|
+
const buildTitleRow = function (text, actions, sectionKey, isMainTitle) {
|
|
2271
|
+
let lbl = null;
|
|
2272
|
+
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 || "" });
|
|
2274
|
+
(actions || []).forEach(function (action) {
|
|
2275
|
+
applyVisible(registerItem(Object.assign({ type: "iconButton", accent: 0 }, action), sectionKey));
|
|
2276
|
+
});
|
|
2277
|
+
endGroup();
|
|
2278
|
+
return lbl;
|
|
2279
|
+
};
|
|
2280
|
+
|
|
2281
|
+
const buildSection = function (section, isTitleBlock) {
|
|
2282
|
+
|
|
2283
|
+
// GROUP: Section
|
|
2284
|
+
const group = VGroup({ width: "100%", height: "auto", align: "left top", gap: _g.rowGap, color: "transparent" });
|
|
2285
|
+
group.shrink = 0;
|
|
2286
|
+
group.css = {
|
|
2287
|
+
padding: (isTitleBlock ? "8px " : "12px ") + _ps.paddingRight + "px " + (isTitleBlock ? "8px " : "16px ") + _ps.paddingLeft + "px",
|
|
2288
|
+
boxSizing: "border-box",
|
|
2289
|
+
borderBottom: "1px solid " + _ps.dividerColor,
|
|
2290
|
+
};
|
|
2291
|
+
|
|
2292
|
+
// WHY: A section without a title and actions (Ex: a footer with a note) gets no empty title row.
|
|
2293
|
+
const hasTitleRow = isTitleBlock || !!section.title || (section.actions && section.actions.length > 0);
|
|
2294
|
+
const lbl = (hasTitleRow) ? buildTitleRow(section.title, section.actions, section.key, isTitleBlock) : null;
|
|
2295
|
+
if (isTitleBlock) titleLabel = lbl;
|
|
2296
|
+
|
|
2297
|
+
(section.items || []).forEach(function (row) {
|
|
2298
|
+
const items = (Array.isArray(row)) ? row : [row];
|
|
2299
|
+
const hasCaption = items.some(function (item) { return !!item.label; });
|
|
2300
|
+
// GROUP: Row
|
|
2301
|
+
HGroup({ width: "100%", height: "auto", align: "left bottom", gap: _g.gap, color: "transparent" });
|
|
2302
|
+
items.forEach(function (item) { buildItem(item, section.key, hasCaption); });
|
|
2303
|
+
endGroup();
|
|
2304
|
+
});
|
|
2305
|
+
|
|
2306
|
+
endGroup();
|
|
2307
|
+
|
|
2308
|
+
if (section.visible === 0 || section.visible === false) group.visible = 0;
|
|
2309
|
+
return group;
|
|
2310
|
+
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
const paintTab = function (key) {
|
|
2314
|
+
const isActive = (key === box.data.activeTab);
|
|
2315
|
+
const lbl = tabLabels[key];
|
|
2316
|
+
lbl.color = (isActive) ? _s.field.color : "transparent";
|
|
2317
|
+
lbl.textColor = (isActive) ? _t.color : _t.softColor;
|
|
2318
|
+
lbl.bold = isActive;
|
|
2319
|
+
lbl.aria = { selected: (isActive) ? "true" : "false" };
|
|
2320
|
+
};
|
|
2321
|
+
|
|
2322
|
+
const paintTabs = function () {
|
|
2323
|
+
Object.keys(tabLabels).forEach(paintTab);
|
|
2324
|
+
};
|
|
2325
|
+
|
|
2326
|
+
// Tabs and the item at the right of the header (Ex: zoom).
|
|
2327
|
+
const buildHeader = function () {
|
|
2328
|
+
|
|
2329
|
+
const data = box.data;
|
|
2330
|
+
if (box.headerRow) box.headerRow.remove();
|
|
2331
|
+
tabLabels = {};
|
|
2332
|
+
|
|
2333
|
+
createIn(box.header, function () {
|
|
2334
|
+
|
|
2335
|
+
// GROUP: Tabs row (created again by setData)
|
|
2336
|
+
box.headerRow = HGroup({ width: "100%", height: "100%", align: "left center", gap: 2, color: "transparent" });
|
|
2337
|
+
|
|
2338
|
+
// LABEL: The name (headerTitle). It takes the free room and ends with "..." when it is long.
|
|
2339
|
+
if (data.headerTitle !== undefined) {
|
|
2340
|
+
box.lblHeaderTitle = textLabel("", { flex: 1, bold: 1, fontSize: _t.titleSize, plainText: data.headerTitle });
|
|
2341
|
+
box.lblHeaderTitle.css.paddingLeft = "6px";
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
(data.tabs || []).forEach(function (tab) {
|
|
2345
|
+
// LABEL: Tab
|
|
2346
|
+
const lbl = textLabel("", { height: 28, plainText: tab.text || tab.key });
|
|
2347
|
+
lbl.round = _s.field.round;
|
|
2348
|
+
lbl.clickable = 1;
|
|
2349
|
+
lbl.cursor = "pointer";
|
|
2350
|
+
lbl.css = { padding: "0px 10px", outline: "none" };
|
|
2351
|
+
lbl.tabIndex = 0;
|
|
2352
|
+
lbl.role = "tab";
|
|
2353
|
+
tabLabels[tab.key] = lbl;
|
|
2354
|
+
const select = function () { box.setActiveTab(tab.key); };
|
|
2355
|
+
lbl.on("click", select);
|
|
2356
|
+
onActivateKey(lbl, select);
|
|
2357
|
+
onHover(lbl, function (isHover) {
|
|
2358
|
+
if (isHover && data.activeTab !== tab.key) lbl.textColor = _t.color;
|
|
2359
|
+
else paintTab(tab.key);
|
|
2360
|
+
});
|
|
2361
|
+
});
|
|
2362
|
+
|
|
2363
|
+
// BOX: Space (the name takes the free room when there is one)
|
|
2364
|
+
if (data.headerTitle === undefined) {
|
|
2365
|
+
const space = Box({ width: 10, height: 1, color: "transparent" });
|
|
2366
|
+
space.grow = 1;
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
if (data.headerItem) {
|
|
2370
|
+
data.headerItem = Object.assign({ type: "select", look: "plain" }, data.headerItem);
|
|
2371
|
+
applyVisible(registerItem(data.headerItem, "header"));
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
endGroup();
|
|
2375
|
+
|
|
2376
|
+
});
|
|
2377
|
+
|
|
2378
|
+
paintTabs();
|
|
2379
|
+
|
|
2380
|
+
};
|
|
2381
|
+
|
|
2382
|
+
// Title block and sections (in the scrolling box).
|
|
2383
|
+
const buildContent = function () {
|
|
2384
|
+
|
|
2385
|
+
if (box.content) box.content.remove();
|
|
2386
|
+
titleLabel = null;
|
|
2387
|
+
const data = box.data;
|
|
2388
|
+
|
|
2389
|
+
if (data.empty) {
|
|
2390
|
+
box.content = createIn(box.scrollBox, function () { return buildEmptyPage(data.empty); });
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
createIn(box.scrollBox, function () {
|
|
2395
|
+
// GROUP: Content
|
|
2396
|
+
box.content = VGroup({ left: 0, top: 0, width: "100%", height: "auto", align: "left top", gap: 0, color: "transparent" });
|
|
2397
|
+
if (data.title !== undefined || (data.titleActions && data.titleActions.length)) {
|
|
2398
|
+
buildSection({ key: "title", title: data.title, actions: data.titleActions }, 1);
|
|
2399
|
+
}
|
|
2400
|
+
(data.sections || []).forEach(function (section) { buildSection(section, 0); });
|
|
2401
|
+
endGroup();
|
|
2402
|
+
});
|
|
2403
|
+
|
|
2404
|
+
};
|
|
2405
|
+
|
|
2406
|
+
// EMPTY PAGE: data.empty = { icon, title, text, hints: [{ keys, text }] }, in the middle of the panel.
|
|
2407
|
+
// (Ex: nothing is selected.) It takes the place of the sections.
|
|
2408
|
+
const EMPTY_TEXT_WIDTH = 184;
|
|
2409
|
+
const EMPTY_ICON_BOX = 56;
|
|
2410
|
+
const EMPTY_LIFT = 48; // WHY: A little above the middle looks centered (the optical middle).
|
|
2411
|
+
|
|
2412
|
+
const buildEmptyPage = function (empty) {
|
|
2413
|
+
const es = _s.empty;
|
|
2414
|
+
// GROUP: Empty page
|
|
2415
|
+
const emptyPage = VGroup({ left: 0, top: 0, width: "100%", height: "100%", align: "center center", gap: 0, color: "transparent" });
|
|
2416
|
+
emptyPage.css = { padding: "24px " + _ps.paddingRight + "px " + (24 + EMPTY_LIFT) + "px " + _ps.paddingLeft + "px", boxSizing: "border-box" };
|
|
2417
|
+
|
|
2418
|
+
if (empty.icon) {
|
|
2419
|
+
// LABEL: Icon in a soft square
|
|
2420
|
+
const icon = textLabel(getIcon(empty.icon, es.iconSize), { width: EMPTY_ICON_BOX, height: EMPTY_ICON_BOX, textColor: es.iconColor });
|
|
2421
|
+
icon.color = es.iconBoxColor;
|
|
2422
|
+
icon.round = es.iconBoxRound;
|
|
2423
|
+
icon.css.marginBottom = "16px";
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
if (empty.title) {
|
|
2427
|
+
const lblTitle = textLabel("", { bold: 1, fontSize: _t.titleSize + 1, plainText: empty.title });
|
|
2428
|
+
lblTitle.role = "heading";
|
|
2429
|
+
lblTitle.aria = { level: 2 };
|
|
2430
|
+
lblTitle.css.marginBottom = "6px";
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
if (empty.text) {
|
|
2434
|
+
const lblText = textLabel("", { textColor: _t.softColor, plainText: empty.text });
|
|
2435
|
+
lblText.width = EMPTY_TEXT_WIDTH;
|
|
2436
|
+
lblText.css = { display: "block", whiteSpace: "normal", textAlign: "center", lineHeight: "18px" };
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
if (empty.hints && empty.hints.length) {
|
|
2440
|
+
// GROUP: Hints (what it does at the left, its key at the right: like the shortcuts of a menu)
|
|
2441
|
+
const hints = VGroup({ width: getSpanWidth("full"), height: "auto", align: "left top", gap: 8, color: "transparent" });
|
|
2442
|
+
hints.css = { marginTop: "20px", paddingTop: "16px", borderTop: "1px solid " + _ps.dividerColor };
|
|
2443
|
+
empty.hints.forEach(function (hint) {
|
|
2444
|
+
// GROUP: A hint
|
|
2445
|
+
HGroup({ width: "100%", height: "auto", align: "left center", gap: 8, color: "transparent" });
|
|
2446
|
+
textLabel("", { flex: 1, height: 20, fontSize: _t.captionSize, textColor: _t.softColor, plainText: hint.text });
|
|
2447
|
+
const keys = textLabel("", { height: 20, fontSize: _t.captionSize, plainText: hint.keys });
|
|
2448
|
+
keys.color = _s.field.color;
|
|
2449
|
+
keys.round = 4;
|
|
2450
|
+
keys.css = { padding: "0px 6px", minWidth: "20px", justifyContent: "center", boxSizing: "border-box" };
|
|
2451
|
+
endGroup();
|
|
2452
|
+
});
|
|
2453
|
+
endGroup();
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
endGroup();
|
|
2457
|
+
return emptyPage;
|
|
2458
|
+
};
|
|
2459
|
+
|
|
2460
|
+
// FOOTER: data.footer, a section fixed at the bottom. The scrolling part ends above it.
|
|
2461
|
+
const FOOTER_SPACE = 10; // the space above and under the footer (the same: it fits its content)
|
|
2462
|
+
const buildFooter = function () {
|
|
2463
|
+
if (box.footerContent) box.footerContent.remove();
|
|
2464
|
+
box.footerContent = null;
|
|
2465
|
+
const footer = box.data.footer;
|
|
2466
|
+
box.footerBox.visible = (footer) ? 1 : 0;
|
|
2467
|
+
if (footer) {
|
|
2468
|
+
box.footerContent = createIn(box.footerBox, function () {
|
|
2469
|
+
const group = buildSection(Object.assign({ key: "footer" }, footer), 0);
|
|
2470
|
+
group.css.borderBottom = "none";
|
|
2471
|
+
group.css.padding = FOOTER_SPACE + "px " + _ps.paddingRight + "px " + FOOTER_SPACE + "px " + _ps.paddingLeft + "px";
|
|
2472
|
+
return group;
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
placeScrollBox();
|
|
2476
|
+
};
|
|
2477
|
+
|
|
2478
|
+
const placeScrollBox = function () {
|
|
2479
|
+
const footerHeight = (box.footerContent) ? box.footerBox.elem.offsetHeight : 0;
|
|
2480
|
+
box.scrollBox.height = "calc(100% - " + (_ps.headerHeight + footerHeight) + "px)";
|
|
2481
|
+
};
|
|
2482
|
+
|
|
2483
|
+
// *** PUBLIC FUNCTIONS:
|
|
2484
|
+
|
|
2485
|
+
// Builds the panel again from a JSON. (The JSON is copied: getData() returns the copy with the current values.)
|
|
2486
|
+
box.setData = function (data) {
|
|
2487
|
+
closeMenu();
|
|
2488
|
+
paletteCache = null;
|
|
2489
|
+
controllers = {};
|
|
2490
|
+
box.data = PropertyPanel.copyData(data || {});
|
|
2491
|
+
buildHeader();
|
|
2492
|
+
buildContent();
|
|
2493
|
+
buildFooter();
|
|
2494
|
+
};
|
|
2495
|
+
// USAGE: panel.setData({ title: "Rectangle", sections: [...] })
|
|
2496
|
+
|
|
2497
|
+
// The JSON with the current values.
|
|
2498
|
+
box.getData = function () {
|
|
2499
|
+
return PropertyPanel.copyData(box.data);
|
|
2500
|
+
};
|
|
2501
|
+
|
|
2502
|
+
// { key: value } of every item with a key and a value.
|
|
2503
|
+
box.getValues = function () {
|
|
2504
|
+
const values = {};
|
|
2505
|
+
Object.keys(controllers).forEach(function (key) {
|
|
2506
|
+
const value = controllers[key].item.value;
|
|
2507
|
+
if (value !== undefined) values[key] = PropertyPanel.copyValue(value);
|
|
2508
|
+
});
|
|
2509
|
+
return values;
|
|
2510
|
+
};
|
|
2511
|
+
|
|
2512
|
+
box.getValue = function (key) {
|
|
2513
|
+
const ctrl = controllers[key];
|
|
2514
|
+
return (ctrl) ? PropertyPanel.copyValue(ctrl.item.value) : undefined;
|
|
2515
|
+
};
|
|
2516
|
+
|
|
2517
|
+
// silent: 1 -> no change event. Returns 1 when the key was found.
|
|
2518
|
+
box.setValue = function (key, value, silent = 0) {
|
|
2519
|
+
const ctrl = controllers[key];
|
|
2520
|
+
if (!ctrl) {
|
|
2521
|
+
console.warn("PropertyPanel: No item with the key: " + key);
|
|
2522
|
+
return 0;
|
|
2523
|
+
}
|
|
2524
|
+
const next = normalizeValue(ctrl.item, PropertyPanel.copyValue(value));
|
|
2525
|
+
if (PropertyPanel.isSameValue(ctrl.item.value, next)) return 1; // WHY: No DOM write for the same value.
|
|
2526
|
+
ctrl.setValue(PropertyPanel.copyValue(next));
|
|
2527
|
+
changeValue(ctrl, next, silent);
|
|
2528
|
+
return 1;
|
|
2529
|
+
};
|
|
2530
|
+
// USAGE: panel.setValue("x", 120, 1)
|
|
2531
|
+
|
|
2532
|
+
// Many values at once: { x: 10, y: 20 }
|
|
2533
|
+
box.setValues = function (values, silent = 0) {
|
|
2534
|
+
Object.keys(values || {}).forEach(function (key) { box.setValue(key, values[key], silent); });
|
|
2535
|
+
};
|
|
2536
|
+
|
|
2537
|
+
box.setEnabled = function (key, enabled) {
|
|
2538
|
+
const ctrl = controllers[key];
|
|
2539
|
+
if (!ctrl) return 0;
|
|
2540
|
+
ctrl.item.enabled = basic.isOn(enabled) ? 1 : 0;
|
|
2541
|
+
ctrl.setEnabled(ctrl.item.enabled);
|
|
2542
|
+
return 1;
|
|
2543
|
+
};
|
|
2544
|
+
// USAGE: panel.setEnabled("w", 0)
|
|
2545
|
+
|
|
2546
|
+
box.setItemVisible = function (key, visible) {
|
|
2547
|
+
const ctrl = controllers[key];
|
|
2548
|
+
if (!ctrl) return 0;
|
|
2549
|
+
ctrl.item.visible = basic.isOn(visible) ? 1 : 0;
|
|
2550
|
+
applyVisible(ctrl);
|
|
2551
|
+
return 1;
|
|
2552
|
+
};
|
|
2553
|
+
|
|
2554
|
+
box.getItem = function (key) {
|
|
2555
|
+
const ctrl = controllers[key];
|
|
2556
|
+
return (ctrl) ? ctrl.item : null;
|
|
2557
|
+
};
|
|
2558
|
+
|
|
2559
|
+
box.setTitle = function (text) {
|
|
2560
|
+
box.data.title = text;
|
|
2561
|
+
if (titleLabel) titleLabel.plainText = text || "";
|
|
2562
|
+
else buildContent(); // The title block did not exist.
|
|
2563
|
+
};
|
|
2564
|
+
|
|
2565
|
+
// silent: 1 -> no change event.
|
|
2566
|
+
box.setActiveTab = function (key, silent = 0) {
|
|
2567
|
+
const oldValue = box.data.activeTab;
|
|
2568
|
+
box.data.activeTab = key;
|
|
2569
|
+
paintTabs();
|
|
2570
|
+
if (silent || oldValue === key) return;
|
|
2571
|
+
dispatch({ kind: "tab", key: key, value: key, oldValue: oldValue, item: null, sectionKey: "header" });
|
|
2572
|
+
};
|
|
2573
|
+
|
|
2574
|
+
// Listens to every change. Returns a function that removes the listener.
|
|
2575
|
+
box.listen = function (fn) {
|
|
2576
|
+
listeners.push(fn);
|
|
2577
|
+
return function () { listeners = listeners.filter(function (f) { return f !== fn; }); };
|
|
2578
|
+
};
|
|
2579
|
+
// USAGE: const stop = panel.listen(function (change) { println(change.key); }); stop();
|
|
2580
|
+
|
|
2581
|
+
box.open = function () {
|
|
2582
|
+
box.opened = 1;
|
|
2583
|
+
box.css.transform = "translateX(0px)";
|
|
2584
|
+
box.aria = { hidden: "false" };
|
|
2585
|
+
};
|
|
2586
|
+
|
|
2587
|
+
box.close = function () {
|
|
2588
|
+
closeMenu();
|
|
2589
|
+
box.opened = 0;
|
|
2590
|
+
box.css.transform = "translateX(100%)";
|
|
2591
|
+
box.aria = { hidden: "true" };
|
|
2592
|
+
};
|
|
2593
|
+
|
|
2594
|
+
box.toggle = function () {
|
|
2595
|
+
if (basic.isOn(box.opened)) {
|
|
2596
|
+
box.close();
|
|
2597
|
+
return;
|
|
2598
|
+
}
|
|
2599
|
+
box.open();
|
|
2600
|
+
};
|
|
2601
|
+
|
|
2602
|
+
// WHY: box.superRemove is overwritten by a component that extends this one, so the local copy is called below.
|
|
2603
|
+
const superRemove = box.remove;
|
|
2604
|
+
box.superRemove = superRemove;
|
|
2605
|
+
box.remove = function () {
|
|
2606
|
+
if (!box) return; // WHY: remove() can be called twice (also by the parent's remove()).
|
|
2607
|
+
closeMenu();
|
|
2608
|
+
superRemove.call(box); // NOTE: basic.js remove(). It cleans all the events and the objects inside.
|
|
2609
|
+
box = null;
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
// *** OBJECT VIEW:
|
|
2613
|
+
|
|
2614
|
+
box.boxShadow = "inset 1px 0 0 " + _ps.dividerColor;
|
|
2615
|
+
box.css.transition = "transform " + _ps.motion + " ease";
|
|
2616
|
+
box.role = "complementary";
|
|
2617
|
+
box.aria = { label: "Properties" };
|
|
2618
|
+
box.clickable = 1;
|
|
2619
|
+
|
|
2620
|
+
// GROUP: Header (tabs)
|
|
2621
|
+
box.header = HGroup({ left: 0, top: 0, width: "100%", height: _ps.headerHeight, align: "left center", gap: 2, color: "transparent" });
|
|
2622
|
+
box.header.css = { padding: "0px " + _ps.paddingRight + "px 0px 10px", boxSizing: "border-box", borderBottom: "1px solid " + _ps.dividerColor };
|
|
2623
|
+
box.header.role = "tablist";
|
|
2624
|
+
endGroup();
|
|
2625
|
+
|
|
2626
|
+
// BOX: Scrolling content
|
|
2627
|
+
box.scrollBox = Box({ left: 0, top: _ps.headerHeight, width: "100%", height: "calc(100% - " + _ps.headerHeight + "px)", color: "transparent", scrollY: 1 });
|
|
2628
|
+
|
|
2629
|
+
// GROUP: Footer (data.footer, at the bottom)
|
|
2630
|
+
box.footerBox = VGroup({ left: 0, width: "100%", height: "auto", align: "left top", gap: 0, color: _ps.color });
|
|
2631
|
+
box.footerBox.css = { top: "auto", bottom: "0px", borderTop: "1px solid " + _ps.dividerColor, boxSizing: "border-box" };
|
|
2632
|
+
endGroup();
|
|
2633
|
+
box.footerBox.visible = 0;
|
|
2634
|
+
|
|
2635
|
+
// *** OBJECT INIT CODE:
|
|
2636
|
+
|
|
2637
|
+
// (listenTo / onPageResize: removed with the box)
|
|
2638
|
+
box.listenTo(document, "pointerdown", onDocumentPointerDown, true);
|
|
2639
|
+
box.listenTo(document, "keydown", onDocumentKeyDown);
|
|
2640
|
+
box.onPageResize(closeMenu);
|
|
2641
|
+
box.scrollBox.elem.addEventListener("scroll", closeMenu);
|
|
2642
|
+
box.footerBox.onResize(placeScrollBox); // WHY: The footer grows with its items (and with the fonts when they load).
|
|
2643
|
+
|
|
2644
|
+
box.setData(startData);
|
|
2645
|
+
|
|
2646
|
+
if (typeof ScrollBar !== "undefined") {
|
|
2647
|
+
ScrollBar({ scrollableBox: box.scrollBox, ..._s.scrollBar });
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
if (basic.isOn(box.opened)) box.open();
|
|
2651
|
+
else box.close();
|
|
2652
|
+
|
|
2653
|
+
const panel = endObject(box);
|
|
2654
|
+
|
|
2655
|
+
// WHY: The container was moved to the page above. The caller goes on with its own container.
|
|
2656
|
+
setDefaultContainerBox(previousContainer);
|
|
2657
|
+
|
|
2658
|
+
return panel;
|
|
2659
|
+
|
|
2660
|
+
};
|
|
2661
|
+
|
|
2662
|
+
// *** STATIC FUNCTIONS:
|
|
2663
|
+
|
|
2664
|
+
// Values are numbers, texts, booleans or plain objects (constraints).
|
|
2665
|
+
PropertyPanel.copyValue = function (value) {
|
|
2666
|
+
if (value !== null && typeof value === "object") return JSON.parse(JSON.stringify(value));
|
|
2667
|
+
return value;
|
|
2668
|
+
};
|
|
2669
|
+
|
|
2670
|
+
PropertyPanel.isSameValue = function (a, b) {
|
|
2671
|
+
if (a === b) return true;
|
|
2672
|
+
if (a !== null && b !== null && typeof a === "object" && typeof b === "object") return JSON.stringify(a) === JSON.stringify(b);
|
|
2673
|
+
return false;
|
|
2674
|
+
};
|
|
2675
|
+
|
|
2676
|
+
// Copies the JSON. Functions (Ex: item.onChange) are kept as they are.
|
|
2677
|
+
PropertyPanel.copyData = function (data) {
|
|
2678
|
+
if (Array.isArray(data)) return data.map(PropertyPanel.copyData);
|
|
2679
|
+
if (data !== null && typeof data === "object") {
|
|
2680
|
+
const copy = {};
|
|
2681
|
+
Object.keys(data).forEach(function (key) { copy[key] = PropertyPanel.copyData(data[key]); });
|
|
2682
|
+
return copy;
|
|
2683
|
+
}
|
|
2684
|
+
return data;
|
|
2685
|
+
};
|
|
2686
|
+
|
|
2687
|
+
// *** ICONS: 16 x 16 SVG paths (stroke). Use the name as "icon", or give a raw "<svg ...>" string.
|
|
2688
|
+
// USAGE: PropertyPanel.icons.star = "M8 2l1.8 3.8 4.2.5-3.1 2.9.8 4.1L8 11.3 4.3 13.3l.8-4.1L2 6.3l4.2-.5z";
|
|
2689
|
+
PropertyPanel.icons = {
|
|
2690
|
+
alignLeft: "M2.5 2.5v11M5 5.5h8M5 10.5h5",
|
|
2691
|
+
alignCenterH: "M8 2v12M4 5.5h8M5.5 10.5h5",
|
|
2692
|
+
alignRight: "M13.5 2.5v11M3 5.5h8M6 10.5h5",
|
|
2693
|
+
alignTop: "M2.5 2.5h11M5.5 5v8M10.5 5v5",
|
|
2694
|
+
alignCenterV: "M2 8h12M5.5 4v8M10.5 5.5v5",
|
|
2695
|
+
alignBottom: "M2.5 13.5h11M5.5 3v8M10.5 6v5",
|
|
2696
|
+
frame: "M3 4.5h10v7H3zM6 8h4M8 6v4",
|
|
2697
|
+
component: "M5 2.5l1.5 1.5L5 5.5 3.5 4zM11 2.5l1.5 1.5L11 5.5 9.5 4zM5 10.5l1.5 1.5L5 13.5 3.5 12zM11 10.5l1.5 1.5-1.5 1.5L9.5 12z",
|
|
2698
|
+
link: "M7 9l2-2M6.5 5.5l1-1a2.5 2.5 0 013.5 3.5l-1 1M9.5 10.5l-1 1a2.5 2.5 0 01-3.5-3.5l1-1",
|
|
2699
|
+
target: "M8 2.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2.5 8h3M10.5 8h3M8 6.5a1.5 1.5 0 100 3 1.5 1.5 0 000-3z",
|
|
2700
|
+
more: "M3.5 7.2a.8.8 0 100 1.6.8.8 0 000-1.6zM8 7.2a.8.8 0 100 1.6.8.8 0 000-1.6zM12.5 7.2a.8.8 0 100 1.6.8.8 0 000-1.6z",
|
|
2701
|
+
constraintH: "M2.5 5v6M13.5 5v6M2.5 8h11",
|
|
2702
|
+
constraintV: "M5.5 2.5h5M5.5 13.5h5M8 2.5v11",
|
|
2703
|
+
angle: "M3 13h10M3 13V3M3 8.5A4.5 4.5 0 017.5 13",
|
|
2704
|
+
rotate: "M9.5 6.5l3 3-3 3-3-3zM3.5 9A5.5 5.5 0 0111 3.8M11 1.8v2.5H8.5",
|
|
2705
|
+
flipH: "M8 2v12M6 4.5L2.5 11.5H6zM10 4.5l3.5 7H10z",
|
|
2706
|
+
flipV: "M2 8h12M4.5 6l7-3.5V6zM4.5 10l7 3.5V10z",
|
|
2707
|
+
hugWidth: "M3 3v10M6 8h7M10.5 5.5L13 8l-2.5 2.5",
|
|
2708
|
+
fixedWidth: "M2.5 3v10M13.5 3v10M5.5 5.5h5M5.5 8h5M5.5 10.5h3",
|
|
2709
|
+
autoHeight: "M3.5 2.5h9a1 1 0 011 1v9a1 1 0 01-1 1h-9a1 1 0 01-1-1v-9a1 1 0 011-1zM5.5 5.5h5M5.5 8h5M5.5 10.5h3",
|
|
2710
|
+
clip: "M3.5 2.5h9a1 1 0 011 1v9a1 1 0 01-1 1h-9a1 1 0 01-1-1v-9a1 1 0 011-1zM9 13.5V9h4.5",
|
|
2711
|
+
eye: "M1.5 8s2.5-4.5 6.5-4.5S14.5 8 14.5 8s-2.5 4.5-6.5 4.5S1.5 8 1.5 8zM8 6a2 2 0 100 4 2 2 0 000-4z",
|
|
2712
|
+
eyeOff: "M1.5 8s2.5-4.5 6.5-4.5S14.5 8 14.5 8s-2.5 4.5-6.5 4.5S1.5 8 1.5 8zM8 6a2 2 0 100 4 2 2 0 000-4zM2.5 13.5l11-11",
|
|
2713
|
+
drop: "M8 2.5S4 7 4 9.5a4 4 0 008 0C12 7 8 2.5 8 2.5z",
|
|
2714
|
+
styles: "M5 3a2 2 0 100 4 2 2 0 000-4zM11 3a2 2 0 100 4 2 2 0 000-4zM5 9a2 2 0 100 4 2 2 0 000-4zM11 9a2 2 0 100 4 2 2 0 000-4z",
|
|
2715
|
+
opacity: "M3.5 2.5h9a1 1 0 011 1v9a1 1 0 01-1 1h-9a1 1 0 01-1-1v-9a1 1 0 011-1zM2.5 8h11M8 2.5v11",
|
|
2716
|
+
radius: "M2.5 6V4.5a2 2 0 012-2H6M10 2.5h1.5a2 2 0 012 2V6M13.5 10v1.5a2 2 0 01-2 2H10M6 13.5H4.5a2 2 0 01-2-2V10",
|
|
2717
|
+
textLeft: "M2.5 4h11M2.5 8h7M2.5 12h9",
|
|
2718
|
+
textCenter: "M2.5 4h11M4.5 8h7M3.5 12h9",
|
|
2719
|
+
textRight: "M2.5 4h11M6.5 8h7M4.5 12h9",
|
|
2720
|
+
textTop: "M3 2.5h10M8 13V6M5.5 8.5L8 6l2.5 2.5",
|
|
2721
|
+
textMiddle: "M3 8h10M8 2v3.5M6 3.5l2 2 2-2M8 14v-3.5M6 12.5l2-2 2 2",
|
|
2722
|
+
textBottom: "M3 13.5h10M8 3v7M5.5 7.5L8 10l2.5-2.5",
|
|
2723
|
+
lineHeight: "M3 2.5h10M3 13.5h10M5.5 11L8 5l2.5 6M6.4 9h3.2",
|
|
2724
|
+
letterSpacing: "M2.5 3v10M13.5 3v10M5.5 11L8 5l2.5 6M6.4 9h3.2",
|
|
2725
|
+
sliders: "M4 2.5v11M12 2.5v11M8 2.5v11M2.5 5.5h3M6.5 10.5h3M10.5 7h3",
|
|
2726
|
+
chevronDown: "M4.5 6.5L8 10l3.5-3.5",
|
|
2727
|
+
chevronUp: "M4.5 9.5L8 6l3.5 3.5",
|
|
2728
|
+
close: "M4 4l8 8M12 4l-8 8",
|
|
2729
|
+
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
|
+
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
|
+
check: "M3.5 8.5l3 3 6-7",
|
|
2732
|
+
plus: "M8 3v10M3 8h10",
|
|
2733
|
+
minus: "M3 8h10",
|
|
2734
|
+
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",
|
|
2735
|
+
italic: "M7 3h5M4 13h5M9.5 3l-3 10",
|
|
2736
|
+
flowHorizontal: "M2.5 8h11M10 4.5L13.5 8 10 11.5",
|
|
2737
|
+
flowVertical: "M8 2.5v11M4.5 10L8 13.5 11.5 10",
|
|
2738
|
+
wrap: "M2.5 4h11M2.5 8h9a2 2 0 0 1 0 4H8M9.5 10.5L8 12l1.5 1.5M2.5 12h3",
|
|
2739
|
+
ellipsis: "M2.5 8h.01M6 8h.01M9.5 8h.01M2.5 4.5h11M2.5 11.5h7",
|
|
2740
|
+
};
|