@fusion.dev/helix-headless 0.0.0-dev
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/LICENSE +21 -0
- package/custom-elements.json +75202 -0
- package/dist/accordion/index.d.ts +2 -0
- package/dist/accordion/index.js +2 -0
- package/dist/accordion/item/accordion-item.d.ts +141 -0
- package/dist/accordion/item/accordion-item.js +214 -0
- package/dist/accordion/root/accordion-root.d.ts +57 -0
- package/dist/accordion/root/accordion-root.js +96 -0
- package/dist/announcement/index.d.ts +1 -0
- package/dist/announcement/index.js +1 -0
- package/dist/announcement/root/announcement-root.d.ts +106 -0
- package/dist/announcement/root/announcement-root.js +144 -0
- package/dist/app-header/index.d.ts +1 -0
- package/dist/app-header/index.js +1 -0
- package/dist/app-header/root/app-header-root.d.ts +113 -0
- package/dist/app-header/root/app-header-root.js +147 -0
- package/dist/avatar/group/avatar-group.d.ts +116 -0
- package/dist/avatar/group/avatar-group.js +136 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +2 -0
- package/dist/avatar/root/avatar-root.d.ts +71 -0
- package/dist/avatar/root/avatar-root.js +147 -0
- package/dist/badge/index.d.ts +1 -0
- package/dist/badge/index.js +1 -0
- package/dist/badge/root/badge-root.d.ts +61 -0
- package/dist/badge/root/badge-root.js +121 -0
- package/dist/bar-chart/index.d.ts +1 -0
- package/dist/bar-chart/index.js +1 -0
- package/dist/bar-chart/root/bar-chart-root.d.ts +266 -0
- package/dist/bar-chart/root/bar-chart-root.js +515 -0
- package/dist/blockquote/index.d.ts +1 -0
- package/dist/blockquote/index.js +1 -0
- package/dist/blockquote/root/blockquote-root.d.ts +51 -0
- package/dist/blockquote/root/blockquote-root.js +84 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +104 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +137 -0
- package/dist/breadcrumbs/index.d.ts +2 -0
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +77 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +94 -0
- package/dist/button/index.d.ts +1 -0
- package/dist/button/index.js +1 -0
- package/dist/button/root/button-root.d.ts +251 -0
- package/dist/button/root/button-root.js +401 -0
- package/dist/button-group/index.d.ts +1 -0
- package/dist/button-group/index.js +1 -0
- package/dist/button-group/root/button-group-root.d.ts +62 -0
- package/dist/button-group/root/button-group-root.js +62 -0
- package/dist/callout/index.d.ts +1 -0
- package/dist/callout/index.js +1 -0
- package/dist/callout/root/callout-root.d.ts +72 -0
- package/dist/callout/root/callout-root.js +90 -0
- package/dist/card/index.d.ts +1 -0
- package/dist/card/index.js +1 -0
- package/dist/card/root/card-root.d.ts +54 -0
- package/dist/card/root/card-root.js +71 -0
- package/dist/carousel/index.d.ts +1 -0
- package/dist/carousel/index.js +1 -0
- package/dist/carousel/root/carousel-root.d.ts +399 -0
- package/dist/carousel/root/carousel-root.js +723 -0
- package/dist/chat/composer/chat-composer.d.ts +160 -0
- package/dist/chat/composer/chat-composer.js +273 -0
- package/dist/chat/index.d.ts +3 -0
- package/dist/chat/index.js +3 -0
- package/dist/chat/message/chat-message.d.ts +170 -0
- package/dist/chat/message/chat-message.js +271 -0
- package/dist/chat/root/chat-root.d.ts +216 -0
- package/dist/chat/root/chat-root.js +389 -0
- package/dist/checkbox/index.d.ts +1 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/checkbox/root/checkbox-root.d.ts +108 -0
- package/dist/checkbox/root/checkbox-root.js +207 -0
- package/dist/checkbox-group/index.d.ts +1 -0
- package/dist/checkbox-group/index.js +1 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +155 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +293 -0
- package/dist/code/index.d.ts +1 -0
- package/dist/code/index.js +1 -0
- package/dist/code/root/code-root.d.ts +36 -0
- package/dist/code/root/code-root.js +43 -0
- package/dist/code-block/index.d.ts +1 -0
- package/dist/code-block/index.js +1 -0
- package/dist/code-block/root/code-block-root.d.ts +112 -0
- package/dist/code-block/root/code-block-root.js +155 -0
- package/dist/color-input/index.d.ts +1 -0
- package/dist/color-input/index.js +1 -0
- package/dist/color-input/root/color-input-root.d.ts +227 -0
- package/dist/color-input/root/color-input-root.js +456 -0
- package/dist/color-picker/color.d.ts +74 -0
- package/dist/color-picker/color.js +238 -0
- package/dist/color-picker/index.d.ts +2 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/color-picker/root/color-picker-root.d.ts +303 -0
- package/dist/color-picker/root/color-picker-root.js +576 -0
- package/dist/combobox/index.d.ts +1 -0
- package/dist/combobox/index.js +1 -0
- package/dist/combobox/root/combobox-root.d.ts +396 -0
- package/dist/combobox/root/combobox-root.js +808 -0
- package/dist/command/index.d.ts +1 -0
- package/dist/command/index.js +1 -0
- package/dist/command/root/command-root.d.ts +166 -0
- package/dist/command/root/command-root.js +353 -0
- package/dist/copy-button/index.d.ts +1 -0
- package/dist/copy-button/index.js +1 -0
- package/dist/copy-button/root/copy-button-root.d.ts +154 -0
- package/dist/copy-button/root/copy-button-root.js +225 -0
- package/dist/data-table/index.d.ts +2 -0
- package/dist/data-table/index.js +2 -0
- package/dist/data-table/root/data-table-root.d.ts +392 -0
- package/dist/data-table/root/data-table-root.js +729 -0
- package/dist/data-table/root/order.d.ts +116 -0
- package/dist/data-table/root/order.js +175 -0
- package/dist/date-input/index.d.ts +1 -0
- package/dist/date-input/index.js +1 -0
- package/dist/date-input/root/date-input-root.d.ts +361 -0
- package/dist/date-input/root/date-input-root.js +791 -0
- package/dist/date-picker/index.d.ts +1 -0
- package/dist/date-picker/index.js +1 -0
- package/dist/date-picker/root/date-picker-root.d.ts +361 -0
- package/dist/date-picker/root/date-picker-root.js +837 -0
- package/dist/dialog/index.d.ts +1 -0
- package/dist/dialog/index.js +1 -0
- package/dist/dialog/root/dialog-root.d.ts +185 -0
- package/dist/dialog/root/dialog-root.js +319 -0
- package/dist/divider/index.d.ts +1 -0
- package/dist/divider/index.js +1 -0
- package/dist/divider/root/divider-root.d.ts +68 -0
- package/dist/divider/root/divider-root.js +116 -0
- package/dist/donut-chart/index.d.ts +1 -0
- package/dist/donut-chart/index.js +1 -0
- package/dist/donut-chart/root/donut-chart-root.d.ts +209 -0
- package/dist/donut-chart/root/donut-chart-root.js +395 -0
- package/dist/drawer/index.d.ts +1 -0
- package/dist/drawer/index.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +144 -0
- package/dist/drawer/root/drawer-root.js +222 -0
- package/dist/drilldown/index.d.ts +2 -0
- package/dist/drilldown/index.js +2 -0
- package/dist/drilldown/item/drilldown-item.d.ts +87 -0
- package/dist/drilldown/item/drilldown-item.js +152 -0
- package/dist/drilldown/root/drilldown-root.d.ts +115 -0
- package/dist/drilldown/root/drilldown-root.js +263 -0
- package/dist/element-events.generated.d.ts +1 -0
- package/dist/element-events.generated.js +125 -0
- package/dist/empty/index.d.ts +1 -0
- package/dist/empty/index.js +1 -0
- package/dist/empty/root/empty-root.d.ts +47 -0
- package/dist/empty/root/empty-root.js +68 -0
- package/dist/file-input/index.d.ts +1 -0
- package/dist/file-input/index.js +1 -0
- package/dist/file-input/root/file-input-root.d.ts +196 -0
- package/dist/file-input/root/file-input-root.js +488 -0
- package/dist/format-date/index.d.ts +1 -0
- package/dist/format-date/index.js +1 -0
- package/dist/format-date/root/format-date-root.d.ts +151 -0
- package/dist/format-date/root/format-date-root.js +266 -0
- package/dist/heatmap/index.d.ts +2 -0
- package/dist/heatmap/index.js +2 -0
- package/dist/heatmap/root/buckets.d.ts +62 -0
- package/dist/heatmap/root/buckets.js +85 -0
- package/dist/heatmap/root/heatmap-root.d.ts +330 -0
- package/dist/heatmap/root/heatmap-root.js +526 -0
- package/dist/icon/index.d.ts +1 -0
- package/dist/icon/index.js +1 -0
- package/dist/icon/root/icon-root.d.ts +53 -0
- package/dist/icon/root/icon-root.js +93 -0
- package/dist/icon-button/index.d.ts +1 -0
- package/dist/icon-button/index.js +1 -0
- package/dist/icon-button/root/icon-button-root.d.ts +40 -0
- package/dist/icon-button/root/icon-button-root.js +46 -0
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +1 -0
- package/dist/image/root/image-root.d.ts +213 -0
- package/dist/image/root/image-root.js +335 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.js +99 -0
- package/dist/input/index.d.ts +1 -0
- package/dist/input/index.js +1 -0
- package/dist/input/root/input-root.d.ts +281 -0
- package/dist/input/root/input-root.js +472 -0
- package/dist/kbd/index.d.ts +1 -0
- package/dist/kbd/index.js +1 -0
- package/dist/kbd/root/kbd-root.d.ts +98 -0
- package/dist/kbd/root/kbd-root.js +230 -0
- package/dist/legend/index.d.ts +1 -0
- package/dist/legend/index.js +1 -0
- package/dist/legend/root/legend-root.d.ts +83 -0
- package/dist/legend/root/legend-root.js +125 -0
- package/dist/line-chart/index.d.ts +1 -0
- package/dist/line-chart/index.js +1 -0
- package/dist/line-chart/root/line-chart-root.d.ts +238 -0
- package/dist/line-chart/root/line-chart-root.js +365 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +2 -0
- package/dist/list/item/list-item.d.ts +95 -0
- package/dist/list/item/list-item.js +148 -0
- package/dist/list/root/list-root.d.ts +72 -0
- package/dist/list/root/list-root.js +61 -0
- package/dist/listbox/index.d.ts +1 -0
- package/dist/listbox/index.js +1 -0
- package/dist/listbox/root/listbox-root.d.ts +357 -0
- package/dist/listbox/root/listbox-root.js +890 -0
- package/dist/loader/index.d.ts +1 -0
- package/dist/loader/index.js +1 -0
- package/dist/loader/root/loader-root.d.ts +52 -0
- package/dist/loader/root/loader-root.js +74 -0
- package/dist/megamenu/index.d.ts +1 -0
- package/dist/megamenu/index.js +1 -0
- package/dist/megamenu/root/megamenu-root.d.ts +254 -0
- package/dist/megamenu/root/megamenu-root.js +526 -0
- package/dist/menu/index.d.ts +2 -0
- package/dist/menu/index.js +2 -0
- package/dist/menu/item/menu-item.d.ts +231 -0
- package/dist/menu/item/menu-item.js +405 -0
- package/dist/menu/root/menu-root.d.ts +158 -0
- package/dist/menu/root/menu-root.js +422 -0
- package/dist/meter/index.d.ts +1 -0
- package/dist/meter/index.js +1 -0
- package/dist/meter/root/meter-root.d.ts +234 -0
- package/dist/meter/root/meter-root.js +316 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +1 -0
- package/dist/navigation/root/navigation-root.d.ts +55 -0
- package/dist/navigation/root/navigation-root.js +130 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/notification/notification.d.ts +181 -0
- package/dist/notifications/notification/notification.js +305 -0
- package/dist/notifications/root/notifications-root.d.ts +168 -0
- package/dist/notifications/root/notifications-root.js +291 -0
- package/dist/number-input/index.d.ts +1 -0
- package/dist/number-input/index.js +1 -0
- package/dist/number-input/root/number-input-root.d.ts +282 -0
- package/dist/number-input/root/number-input-root.js +592 -0
- package/dist/option/group/option-group.d.ts +38 -0
- package/dist/option/group/option-group.js +58 -0
- package/dist/option/index.d.ts +2 -0
- package/dist/option/index.js +2 -0
- package/dist/option/root/option-root.d.ts +194 -0
- package/dist/option/root/option-root.js +247 -0
- package/dist/outline/index.d.ts +1 -0
- package/dist/outline/index.js +1 -0
- package/dist/outline/root/outline-root.d.ts +237 -0
- package/dist/outline/root/outline-root.js +519 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/index.js +3 -0
- package/dist/pagination/root/pagination-root.d.ts +390 -0
- package/dist/pagination/root/pagination-root.js +695 -0
- package/dist/pagination/size/pagination-size.d.ts +127 -0
- package/dist/pagination/size/pagination-size.js +232 -0
- package/dist/pagination/summary/pagination-summary.d.ts +90 -0
- package/dist/pagination/summary/pagination-summary.js +145 -0
- package/dist/pin-input/index.d.ts +1 -0
- package/dist/pin-input/index.js +1 -0
- package/dist/pin-input/root/pin-input-root.d.ts +292 -0
- package/dist/pin-input/root/pin-input-root.js +553 -0
- package/dist/popover/index.d.ts +1 -0
- package/dist/popover/index.js +1 -0
- package/dist/popover/root/popover-root.d.ts +108 -0
- package/dist/popover/root/popover-root.js +231 -0
- package/dist/progress/index.d.ts +1 -0
- package/dist/progress/index.js +1 -0
- package/dist/progress/root/progress-root.d.ts +125 -0
- package/dist/progress/root/progress-root.js +212 -0
- package/dist/qr-code/index.d.ts +1 -0
- package/dist/qr-code/index.js +1 -0
- package/dist/qr-code/root/qr-code-root.d.ts +93 -0
- package/dist/qr-code/root/qr-code-root.js +233 -0
- package/dist/quote/index.d.ts +1 -0
- package/dist/quote/index.js +1 -0
- package/dist/quote/root/quote-root.d.ts +36 -0
- package/dist/quote/root/quote-root.js +50 -0
- package/dist/radio/group/radio-group.d.ts +84 -0
- package/dist/radio/group/radio-group.js +170 -0
- package/dist/radio/index.d.ts +2 -0
- package/dist/radio/index.js +2 -0
- package/dist/radio/root/radio-root.d.ts +102 -0
- package/dist/radio/root/radio-root.js +151 -0
- package/dist/rating/index.d.ts +1 -0
- package/dist/rating/index.js +1 -0
- package/dist/rating/root/rating-root.d.ts +242 -0
- package/dist/rating/root/rating-root.js +484 -0
- package/dist/scroll-area/index.d.ts +1 -0
- package/dist/scroll-area/index.js +1 -0
- package/dist/scroll-area/root/scroll-area-root.d.ts +96 -0
- package/dist/scroll-area/root/scroll-area-root.js +215 -0
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.js +1 -0
- package/dist/select/root/select-root.d.ts +170 -0
- package/dist/select/root/select-root.js +419 -0
- package/dist/skeleton/index.d.ts +1 -0
- package/dist/skeleton/index.js +1 -0
- package/dist/skeleton/root/skeleton-root.d.ts +31 -0
- package/dist/skeleton/root/skeleton-root.js +42 -0
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.js +1 -0
- package/dist/slider/root/slider-root.d.ts +235 -0
- package/dist/slider/root/slider-root.js +488 -0
- package/dist/sparkline/index.d.ts +1 -0
- package/dist/sparkline/index.js +1 -0
- package/dist/sparkline/root/sparkline-root.d.ts +147 -0
- package/dist/sparkline/root/sparkline-root.js +278 -0
- package/dist/speed-dial/index.d.ts +2 -0
- package/dist/speed-dial/index.js +2 -0
- package/dist/speed-dial/item/speed-dial-item.d.ts +71 -0
- package/dist/speed-dial/item/speed-dial-item.js +113 -0
- package/dist/speed-dial/root/speed-dial-root.d.ts +122 -0
- package/dist/speed-dial/root/speed-dial-root.js +251 -0
- package/dist/splitter/index.d.ts +1 -0
- package/dist/splitter/index.js +1 -0
- package/dist/splitter/root/splitter-root.d.ts +491 -0
- package/dist/splitter/root/splitter-root.js +1030 -0
- package/dist/stat/group/stat-group.d.ts +30 -0
- package/dist/stat/group/stat-group.js +47 -0
- package/dist/stat/index.d.ts +2 -0
- package/dist/stat/index.js +2 -0
- package/dist/stat/root/stat-root.d.ts +62 -0
- package/dist/stat/root/stat-root.js +51 -0
- package/dist/steps/index.d.ts +2 -0
- package/dist/steps/index.js +2 -0
- package/dist/steps/root/steps-root.d.ts +110 -0
- package/dist/steps/root/steps-root.js +130 -0
- package/dist/steps/step/step.d.ts +139 -0
- package/dist/steps/step/step.js +215 -0
- package/dist/switch/index.d.ts +1 -0
- package/dist/switch/index.js +1 -0
- package/dist/switch/root/switch-root.d.ts +74 -0
- package/dist/switch/root/switch-root.js +153 -0
- package/dist/table/cell/table-cell.d.ts +34 -0
- package/dist/table/cell/table-cell.js +52 -0
- package/dist/table/column/table-column.d.ts +165 -0
- package/dist/table/column/table-column.js +222 -0
- package/dist/table/index.d.ts +4 -0
- package/dist/table/index.js +4 -0
- package/dist/table/root/table-root.d.ts +98 -0
- package/dist/table/root/table-root.js +161 -0
- package/dist/table/row/table-row.d.ts +27 -0
- package/dist/table/row/table-row.js +42 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/index.js +3 -0
- package/dist/tabs/panel/tab-panel.d.ts +67 -0
- package/dist/tabs/panel/tab-panel.js +98 -0
- package/dist/tabs/root/tabs-root.d.ts +123 -0
- package/dist/tabs/root/tabs-root.js +217 -0
- package/dist/tabs/tab/tab.d.ts +64 -0
- package/dist/tabs/tab/tab.js +116 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +41 -0
- package/dist/tag/root/tag-root.js +67 -0
- package/dist/textarea/index.d.ts +1 -0
- package/dist/textarea/index.js +1 -0
- package/dist/textarea/root/textarea-root.d.ts +215 -0
- package/dist/textarea/root/textarea-root.js +380 -0
- package/dist/time-input/index.d.ts +1 -0
- package/dist/time-input/index.js +1 -0
- package/dist/time-input/root/time-input-root.d.ts +322 -0
- package/dist/time-input/root/time-input-root.js +661 -0
- package/dist/time-picker/index.d.ts +1 -0
- package/dist/time-picker/index.js +1 -0
- package/dist/time-picker/root/time-picker-root.d.ts +380 -0
- package/dist/time-picker/root/time-picker-root.js +669 -0
- package/dist/timeline/index.d.ts +2 -0
- package/dist/timeline/index.js +2 -0
- package/dist/timeline/item/timeline-item.d.ts +81 -0
- package/dist/timeline/item/timeline-item.js +128 -0
- package/dist/timeline/root/timeline-root.d.ts +52 -0
- package/dist/timeline/root/timeline-root.js +72 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +2 -0
- package/dist/toast/item/toast-item.d.ts +183 -0
- package/dist/toast/item/toast-item.js +345 -0
- package/dist/toast/root/toast-root.d.ts +72 -0
- package/dist/toast/root/toast-root.js +87 -0
- package/dist/toggle/group/toggle-group.d.ts +140 -0
- package/dist/toggle/group/toggle-group.js +278 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/index.js +2 -0
- package/dist/toggle/root/toggle-root.d.ts +99 -0
- package/dist/toggle/root/toggle-root.js +146 -0
- package/dist/toolbar/index.d.ts +1 -0
- package/dist/toolbar/index.js +1 -0
- package/dist/toolbar/root/toolbar-root.d.ts +105 -0
- package/dist/toolbar/root/toolbar-root.js +260 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/tooltip/root/tooltip-root.d.ts +388 -0
- package/dist/tooltip/root/tooltip-root.js +707 -0
- package/dist/tour/index.d.ts +2 -0
- package/dist/tour/index.js +2 -0
- package/dist/tour/root/tour-root.d.ts +161 -0
- package/dist/tour/root/tour-root.js +351 -0
- package/dist/tour/stop/tour-stop.d.ts +131 -0
- package/dist/tour/stop/tour-stop.js +249 -0
- package/dist/tree/index.d.ts +2 -0
- package/dist/tree/index.js +2 -0
- package/dist/tree/item/tree-item.d.ts +208 -0
- package/dist/tree/item/tree-item.js +381 -0
- package/dist/tree/root/tree-root.d.ts +88 -0
- package/dist/tree/root/tree-root.js +287 -0
- package/dist/trend/index.d.ts +1 -0
- package/dist/trend/index.js +1 -0
- package/dist/trend/root/trend-root.d.ts +67 -0
- package/dist/trend/root/trend-root.js +106 -0
- package/dist/video/index.d.ts +1 -0
- package/dist/video/index.js +1 -0
- package/dist/video/root/video-root.d.ts +711 -0
- package/dist/video/root/video-root.js +1821 -0
- package/dist/video-playlist/index.d.ts +3 -0
- package/dist/video-playlist/index.js +3 -0
- package/dist/video-playlist/item/video-playlist-item.d.ts +101 -0
- package/dist/video-playlist/item/video-playlist-item.js +162 -0
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +121 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +237 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +108 -0
- package/dist/video-playlist/root/video-playlist-root.js +218 -0
- package/dist/virtual-list/index.d.ts +1 -0
- package/dist/virtual-list/index.js +1 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +121 -0
- package/dist/virtual-list/root/virtual-list-root.js +221 -0
- package/jsx.d.ts +49767 -0
- package/package.json +77 -0
- package/svelte.d.ts +129 -0
- package/vue.d.ts +9242 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading and writing the color syntaxes a field is allowed to hold.
|
|
3
|
+
*
|
|
4
|
+
* **The working model is HSB**, hue and saturation and brightness, because that
|
|
5
|
+
* is what the panel is: a square of saturation against brightness with a hue
|
|
6
|
+
* ramp beside it. HSL would put the square's corners somewhere a reader does not
|
|
7
|
+
* expect, since full saturation in HSL is a mid-lightness band rather than a
|
|
8
|
+
* corner.
|
|
9
|
+
*
|
|
10
|
+
* **Every syntax here is read; three are written.** A field that refuses
|
|
11
|
+
* `rgb(255 0 0)` because it prefers hex is a field arguing with the person using
|
|
12
|
+
* it, so the space-separated forms, the comma forms, `rgba` and `hsla` are all
|
|
13
|
+
* taken. What is written back is whichever of hex, rgb or hsl the component is
|
|
14
|
+
* set to, so a value stays in the shape the consumer asked for however it was
|
|
15
|
+
* entered.
|
|
16
|
+
*
|
|
17
|
+
* **What is written is the comma form.** Both are valid and the space-separated
|
|
18
|
+
* one is newer, which was the reason it was chosen first; the commas are what a
|
|
19
|
+
* reader recognizes, what most code around them holds, and what pastes into
|
|
20
|
+
* anything without a second thought. A syntax a value is handed *out* in is not
|
|
21
|
+
* the place to be early. `rgba` and `hsla` come with them, since a comma form
|
|
22
|
+
* with a fourth argument is spelled that way.
|
|
23
|
+
*
|
|
24
|
+
* Its own module rather than sitting in the element, because it is arithmetic
|
|
25
|
+
* with no DOM in it: this is the half worth testing directly.
|
|
26
|
+
*/
|
|
27
|
+
/** Keeps a number inside a range, since every channel here has one. */
|
|
28
|
+
const clamp = (value, low, high) => Math.min(high, Math.max(low, value));
|
|
29
|
+
/** `50%` and `0.5` mean the same thing wherever an alpha is accepted. */
|
|
30
|
+
const toAlpha = (token) => {
|
|
31
|
+
if (token === undefined) {
|
|
32
|
+
return 100;
|
|
33
|
+
}
|
|
34
|
+
const number = Number.parseFloat(token);
|
|
35
|
+
if (Number.isNaN(number)) {
|
|
36
|
+
return 100;
|
|
37
|
+
}
|
|
38
|
+
return clamp(token.includes('%') ? number : number * 100, 0, 100);
|
|
39
|
+
};
|
|
40
|
+
/** A channel written either as `255` or as `100%`. */
|
|
41
|
+
const toByte = (token) => {
|
|
42
|
+
const number = Number.parseFloat(token);
|
|
43
|
+
return clamp(token.includes('%') ? (number / 100) * 255 : number, 0, 255);
|
|
44
|
+
};
|
|
45
|
+
const rgbToHsb = (red, green, blue, alpha) => {
|
|
46
|
+
const r = red / 255;
|
|
47
|
+
const g = green / 255;
|
|
48
|
+
const b = blue / 255;
|
|
49
|
+
const high = Math.max(r, g, b);
|
|
50
|
+
const low = Math.min(r, g, b);
|
|
51
|
+
const span = high - low;
|
|
52
|
+
let hue = 0;
|
|
53
|
+
if (span !== 0) {
|
|
54
|
+
if (high === r) {
|
|
55
|
+
hue = (g - b) / span + (g < b ? 6 : 0);
|
|
56
|
+
}
|
|
57
|
+
else if (high === g) {
|
|
58
|
+
hue = (b - r) / span + 2;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
hue = (r - g) / span + 4;
|
|
62
|
+
}
|
|
63
|
+
hue *= 60;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
alpha,
|
|
67
|
+
brightness: Math.round(high * 100),
|
|
68
|
+
hue: Math.round(hue),
|
|
69
|
+
saturation: Math.round(high === 0 ? 0 : (span / high) * 100),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/** HSB to bytes, which is the road every written syntax goes down. */
|
|
73
|
+
export const toRgb = (color) => {
|
|
74
|
+
const hue = (((color.hue % 360) + 360) % 360) / 60;
|
|
75
|
+
const saturation = color.saturation / 100;
|
|
76
|
+
const brightness = color.brightness / 100;
|
|
77
|
+
const chroma = brightness * saturation;
|
|
78
|
+
const middle = chroma * (1 - Math.abs((hue % 2) - 1));
|
|
79
|
+
const base = brightness - chroma;
|
|
80
|
+
const sextants = [
|
|
81
|
+
[chroma, middle, 0],
|
|
82
|
+
[middle, chroma, 0],
|
|
83
|
+
[0, chroma, middle],
|
|
84
|
+
[0, middle, chroma],
|
|
85
|
+
[middle, 0, chroma],
|
|
86
|
+
[chroma, 0, middle],
|
|
87
|
+
];
|
|
88
|
+
const [red, green, blue] = sextants[Math.floor(hue) % 6] ?? [0, 0, 0];
|
|
89
|
+
return {
|
|
90
|
+
blue: Math.round((blue + base) * 255),
|
|
91
|
+
green: Math.round((green + base) * 255),
|
|
92
|
+
red: Math.round((red + base) * 255),
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/** HSB to HSL, which is a different pair of numbers for the same color. */
|
|
96
|
+
const toHsl = (color) => {
|
|
97
|
+
const saturation = color.saturation / 100;
|
|
98
|
+
const brightness = color.brightness / 100;
|
|
99
|
+
const lightness = (brightness * (2 - saturation)) / 2;
|
|
100
|
+
return {
|
|
101
|
+
hue: ((color.hue % 360) + 360) % 360,
|
|
102
|
+
lightness: Math.round(lightness * 100),
|
|
103
|
+
saturation: Math.round((lightness === 0 || lightness === 1
|
|
104
|
+
? 0
|
|
105
|
+
: (brightness - lightness) / Math.min(lightness, 1 - lightness)) * 100),
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Splits a comma-separated list of colors, ignoring the commas inside them.
|
|
110
|
+
*
|
|
111
|
+
* A plain `split(',')` is what this was, and it cannot hold the legacy syntaxes:
|
|
112
|
+
* `#ef4444, rgb(249 115 22), rgba(34,197,94,.5)` came apart into six fragments,
|
|
113
|
+
* four of them not colors, and the row quietly rendered three swatches instead
|
|
114
|
+
* of four. The modern space-separated forms survived it, which is what made the
|
|
115
|
+
* list look like it worked.
|
|
116
|
+
*
|
|
117
|
+
* Depth rather than a regular expression, because the thing that matters is
|
|
118
|
+
* whether a comma is inside a function call and that is exactly what a counter
|
|
119
|
+
* answers. No color syntax nests, so a single counter is enough.
|
|
120
|
+
*/
|
|
121
|
+
export const splitColors = (value) => {
|
|
122
|
+
const found = [];
|
|
123
|
+
let depth = 0;
|
|
124
|
+
let current = '';
|
|
125
|
+
for (const character of value) {
|
|
126
|
+
if (character === '(') {
|
|
127
|
+
depth += 1;
|
|
128
|
+
}
|
|
129
|
+
else if (character === ')') {
|
|
130
|
+
depth = Math.max(0, depth - 1);
|
|
131
|
+
}
|
|
132
|
+
if (character === ',' && depth === 0) {
|
|
133
|
+
found.push(current.trim());
|
|
134
|
+
current = '';
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
current += character;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
found.push(current.trim());
|
|
141
|
+
return found.filter(Boolean);
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Any of the syntaxes to the working model, or `null` where it is not a color.
|
|
145
|
+
*
|
|
146
|
+
* Named colors are not here. Resolving `rebeccapurple` means either shipping
|
|
147
|
+
* the table of a hundred and forty or asking the browser, and the browser is not
|
|
148
|
+
* present on the server: a field that accepted a name client-side and rejected
|
|
149
|
+
* it during a server render would be worse than one that never took it.
|
|
150
|
+
*/
|
|
151
|
+
export const parseColor = (value) => {
|
|
152
|
+
const text = value.trim().toLowerCase();
|
|
153
|
+
if (text === '') {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
if (text.startsWith('#')) {
|
|
157
|
+
const digits = text.slice(1);
|
|
158
|
+
const short = digits.length === 3 || digits.length === 4;
|
|
159
|
+
const long = digits.length === 6 || digits.length === 8;
|
|
160
|
+
if ((!short && !long) || !/^[\da-f]+$/.test(digits)) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
const width = short ? 1 : 2;
|
|
164
|
+
const channel = (index) => {
|
|
165
|
+
const piece = digits.slice(index * width, index * width + width);
|
|
166
|
+
return Number.parseInt(short ? piece + piece : piece, 16);
|
|
167
|
+
};
|
|
168
|
+
const carriesAlpha = digits.length === 4 || digits.length === 8;
|
|
169
|
+
return rgbToHsb(channel(0), channel(1), channel(2), carriesAlpha ? Math.round((channel(3) / 255) * 100) : 100);
|
|
170
|
+
}
|
|
171
|
+
/* Commas and the slash both become spaces, which collapses every legal
|
|
172
|
+
spelling into one list: `rgba(255,0,0,0.5)` and `rgb(255 0 0 / 50%)` are the
|
|
173
|
+
same four tokens by the time they are read. */
|
|
174
|
+
const call = /^(rgba?|hsla?)\(([^)]*)\)$/.exec(text);
|
|
175
|
+
if (!call?.[1] || call[2] === undefined) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
/* Destructured with a fallback rather than indexed, because an index into an
|
|
179
|
+
array is `string | undefined` here and three of these are read twice. Four
|
|
180
|
+
names cost less than six assertions. */
|
|
181
|
+
const [first = '', second = '', third = '', fourth] = call[2]
|
|
182
|
+
.replace(/[,/]/g, ' ')
|
|
183
|
+
.split(/\s+/)
|
|
184
|
+
.filter(Boolean);
|
|
185
|
+
if (first === '' || second === '' || third === '') {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
const alpha = toAlpha(fourth);
|
|
189
|
+
if (call[1].startsWith('rgb')) {
|
|
190
|
+
return rgbToHsb(toByte(first), toByte(second), toByte(third), alpha);
|
|
191
|
+
}
|
|
192
|
+
const hue = Number.parseFloat(first);
|
|
193
|
+
const saturation = clamp(Number.parseFloat(second), 0, 100) / 100;
|
|
194
|
+
const lightness = clamp(Number.parseFloat(third), 0, 100) / 100;
|
|
195
|
+
if (Number.isNaN(hue) || Number.isNaN(saturation) || Number.isNaN(lightness)) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
// HSL to HSB, the inverse of `toHsl` above.
|
|
199
|
+
const brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
|
|
200
|
+
return {
|
|
201
|
+
alpha,
|
|
202
|
+
brightness: Math.round(brightness * 100),
|
|
203
|
+
hue: Math.round(((hue % 360) + 360) % 360),
|
|
204
|
+
saturation: Math.round((brightness === 0 ? 0 : 2 * (1 - lightness / brightness)) * 100),
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* The working model back out, in the syntax asked for.
|
|
209
|
+
*
|
|
210
|
+
* The alpha is written only where the component carries one. A consumer who did
|
|
211
|
+
* not ask for transparency should not have to strip `ff` off every hex or read
|
|
212
|
+
* past a fourth argument they never wanted.
|
|
213
|
+
*/
|
|
214
|
+
export const formatColor = (color, format, withAlpha) => {
|
|
215
|
+
const alpha = clamp(color.alpha, 0, 100) / 100;
|
|
216
|
+
/* Two decimal places at most, and no trailing zeros: an alpha is a fraction
|
|
217
|
+
here and `0.5` is what a stylesheet holds, not `0.50` and not
|
|
218
|
+
`0.5019607843137255`. */
|
|
219
|
+
const opacity = Number(alpha.toFixed(2));
|
|
220
|
+
if (format === 'hsl') {
|
|
221
|
+
const { hue, lightness, saturation } = toHsl(color);
|
|
222
|
+
const body = `${Math.round(hue)}, ${saturation}%, ${lightness}%`;
|
|
223
|
+
return withAlpha ? `hsla(${body}, ${opacity})` : `hsl(${body})`;
|
|
224
|
+
}
|
|
225
|
+
const { blue, green, red } = toRgb(color);
|
|
226
|
+
if (format === 'rgb') {
|
|
227
|
+
const body = `${red}, ${green}, ${blue}`;
|
|
228
|
+
return withAlpha ? `rgba(${body}, ${opacity})` : `rgb(${body})`;
|
|
229
|
+
}
|
|
230
|
+
const byte = (one) => one.toString(16).padStart(2, '0');
|
|
231
|
+
const hex = `#${byte(red)}${byte(green)}${byte(blue)}`;
|
|
232
|
+
return withAlpha ? hex + byte(Math.round(alpha * 255)) : hex;
|
|
233
|
+
};
|
|
234
|
+
/** The color as CSS, for the swatches and the tracks. Always with its alpha. */
|
|
235
|
+
export const toCss = (color) => {
|
|
236
|
+
const { blue, green, red } = toRgb(color);
|
|
237
|
+
return `rgb(${red} ${green} ${blue} / ${clamp(color.alpha, 0, 100)}%)`;
|
|
238
|
+
};
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { HelixFormElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import '../../button/index.js';
|
|
4
|
+
import '../../button-group/index.js';
|
|
5
|
+
import '../../slider/index.js';
|
|
6
|
+
import { type Color, type ColorFormat } from '../color.js';
|
|
7
|
+
declare const HelixHeadlessColorPicker_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & typeof HelixFormElement;
|
|
8
|
+
/**
|
|
9
|
+
* @summary Picks a color, from a square and two ramps.
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* **The picker itself, with no field around it.** Color Input is this element in
|
|
13
|
+
* a panel behind a text field, the same way Date Input is `helix-date-picker` in a
|
|
14
|
+
* panel: a form wants a field, and a settings pane or a toolbar wants the picker
|
|
15
|
+
* sitting flat on the page with nothing to open. Neither should be the other one
|
|
16
|
+
* with parts hidden.
|
|
17
|
+
*
|
|
18
|
+
* **The square is two real range inputs.** Saturation and brightness are each an
|
|
19
|
+
* `<input type="range">`, laid over the square and made invisible, and the
|
|
20
|
+
* handle is drawn from their values. The pointer gets the square; the keyboard
|
|
21
|
+
* gets the arrow keys, Home, End and the page keys; a screen reader gets two
|
|
22
|
+
* sliders that announce a name and a number. All of it is the platform's, and
|
|
23
|
+
* nothing here implements a key handler. There is no `role="application"`, which
|
|
24
|
+
* is the usual way this control is built and amounts to asking a screen reader
|
|
25
|
+
* to stop helping.
|
|
26
|
+
*
|
|
27
|
+
* **The working model is HSB, and the value is derived from it.** The reverse
|
|
28
|
+
* loses colors: black is `brightness: 0`, whose hue and saturation are both
|
|
29
|
+
* undefined, so a reader who drags to the bottom of the square and back would
|
|
30
|
+
* get gray where they had red. Holding the model means a color survives a trip
|
|
31
|
+
* through one that has no hue. A value arriving from outside is read into the
|
|
32
|
+
* model once, which is the only moment the conversion runs in that direction.
|
|
33
|
+
*
|
|
34
|
+
* **Every syntax is read; the one `format` names is written.** `#f00`,
|
|
35
|
+
* `#ff0000`, `rgb(255 0 0)`, `rgba(255,0,0,.5)` and `hsl(0 100% 50%)` are all
|
|
36
|
+
* colors. Named colors are the exception, and deliberately: resolving
|
|
37
|
+
* `rebeccapurple` means shipping a table of a hundred and forty or asking the
|
|
38
|
+
* browser, and there is no browser during a server render.
|
|
39
|
+
*
|
|
40
|
+
* The properties below are written by this component and read by whoever draws
|
|
41
|
+
* it. A consumer sets none of them: they carry a number this element computed
|
|
42
|
+
* and CSS cannot, which is what lets a stylesheet on this tier draw the thing
|
|
43
|
+
* without measuring anything itself.
|
|
44
|
+
*
|
|
45
|
+
* @since 0.1.0
|
|
46
|
+
* @status experimental
|
|
47
|
+
* @category forms
|
|
48
|
+
* @aliases Color, ColorArea, Swatch picker
|
|
49
|
+
* @documentation https://helix.fusion.dev/components/color-picker
|
|
50
|
+
*
|
|
51
|
+
* @slot eyedropper-icon - The glyph on the screen-sampling control, usually a dropper.
|
|
52
|
+
*
|
|
53
|
+
* @event {Event} change - Announced once the value has moved.
|
|
54
|
+
* @event {HelixBeforeChangeEvent} helix-before-change - Fired before the color changes. Cancelable: refusing it takes the decision and nothing moves.
|
|
55
|
+
* @event {HelixCopyEvent} helix-copy - Fired when the color is put on the clipboard.
|
|
56
|
+
* @event {HelixSampleEndEvent} helix-sample-end - The eyedropper has closed, whether or not a color was taken.
|
|
57
|
+
* @event {HelixSampleStartEvent} helix-sample-start - The eyedropper is opening, so anything covering the page should get out of the way.
|
|
58
|
+
* @event {Event} input - Announced once the value has moved.
|
|
59
|
+
*
|
|
60
|
+
* @csspart actions - The group holding the eyedropper and the syntax toggle.
|
|
61
|
+
* @csspart channel - One ramp.
|
|
62
|
+
* @csspart channel-control - The range input.
|
|
63
|
+
* @csspart channel-feedback - What is wrong with it.
|
|
64
|
+
* @csspart channel-field - The row: the control and its readout.
|
|
65
|
+
* @csspart channel-hint - Help under the track, while nothing is wrong.
|
|
66
|
+
* @csspart channel-label - The question, over the track.
|
|
67
|
+
* @csspart channel-marker - One mark.
|
|
68
|
+
* @csspart channel-marker-label - The value a mark stands at, when `marker-labels` is set.
|
|
69
|
+
* @csspart channel-markers - The row of marks along the track.
|
|
70
|
+
* @csspart channel-output - The current value, shown beside it.
|
|
71
|
+
* @csspart channels - The ramps beside it.
|
|
72
|
+
* @csspart controls - The row under the square.
|
|
73
|
+
* @csspart eyedropper - The control that samples a color from the screen.
|
|
74
|
+
* @csspart eyedropper-button - The inner control.
|
|
75
|
+
* @csspart footer - The row holding the value and the tools.
|
|
76
|
+
* @csspart format - The control that changes the syntax the value is written in.
|
|
77
|
+
* @csspart format-button - The inner control.
|
|
78
|
+
* @csspart grid - The saturation and brightness square.
|
|
79
|
+
* @csspart grid-brightness - The range input for its vertical axis.
|
|
80
|
+
* @csspart grid-handle - The mark showing where in the square the color sits.
|
|
81
|
+
* @csspart grid-saturation - The range input for the square's horizontal axis.
|
|
82
|
+
* @csspart icon - A glyph this component draws.
|
|
83
|
+
* @csspart sample - The chip of the current color, which copies it when pressed.
|
|
84
|
+
* @csspart swatch - One preset.
|
|
85
|
+
* @csspart swatches - The row of presets.
|
|
86
|
+
* @csspart value - The color as text, which can be typed or pasted.
|
|
87
|
+
*
|
|
88
|
+
* @cssproperty --color-picker-brightness - The chosen brightness, 0 to 100, as a percentage.
|
|
89
|
+
* @cssproperty --color-picker-hue - The chosen hue, 0 to 360, unitless.
|
|
90
|
+
* @cssproperty --color-picker-saturation - The chosen saturation, 0 to 100, as a percentage.
|
|
91
|
+
* @cssproperty --color-picker-swatch - A color to paint: the current one on the sample, a preset's on each preset.
|
|
92
|
+
*/
|
|
93
|
+
export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_base {
|
|
94
|
+
/**
|
|
95
|
+
* What the browser may autofill in the text field, as a platform token.
|
|
96
|
+
*
|
|
97
|
+
* **Defaults to `off`, which is not the platform's default and is the
|
|
98
|
+
* point.** The field filters a list rather than collecting a value, so a
|
|
99
|
+
* browser offering to fill it with a saved address is competing for the same
|
|
100
|
+
* keystrokes as the listbox. A consumer who wants autofill can still ask.
|
|
101
|
+
*/
|
|
102
|
+
autocomplete: string;
|
|
103
|
+
/**
|
|
104
|
+
* Whether the current selection fails validation.
|
|
105
|
+
*
|
|
106
|
+
* A flag rather than a message, which is the split Date Picker already drew and
|
|
107
|
+
* these two now follow. A flat picker has no room of its own for a sentence:
|
|
108
|
+
* the field that wraps one owns the label, the hint and the feedback, and a
|
|
109
|
+
* second message inside the panel would be the same error said twice. What is
|
|
110
|
+
* left for the picker is the one thing the field cannot draw from outside, the
|
|
111
|
+
* mark on the answer itself.
|
|
112
|
+
*/
|
|
113
|
+
invalid: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Whether the color carries an alpha channel.
|
|
116
|
+
*
|
|
117
|
+
* Off by default, because it widens every value written, and a consumer who
|
|
118
|
+
* did not ask for transparency should not have to strip a byte off each one.
|
|
119
|
+
*/
|
|
120
|
+
alpha: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* The syntax the value is written in: `hex`, `rgb` or `hsl`.
|
|
123
|
+
*
|
|
124
|
+
* Only what is written. Everything is read whatever this says, so a picker on
|
|
125
|
+
* `hex` still takes an `rgb()` handed to it and stores the hex for it.
|
|
126
|
+
*/
|
|
127
|
+
format?: ColorFormat;
|
|
128
|
+
/**
|
|
129
|
+
* Whether to leave the value out, for a picker whose value is stated elsewhere.
|
|
130
|
+
*
|
|
131
|
+
* The row reads the color as text and lets it be typed or pasted, which is
|
|
132
|
+
* what makes this element complete standing on a page: a square and two ramps
|
|
133
|
+
* can build a color and cannot state one, and a reader who has a hex already
|
|
134
|
+
* should not have to find it by dragging.
|
|
135
|
+
*
|
|
136
|
+
* Color Input sets this, because its field is that input. Two editable fields
|
|
137
|
+
* for one value is the outcome worth avoiding: two places to type, and no
|
|
138
|
+
* answer to which one is authoritative or which has the caret. The other way
|
|
139
|
+
* round was considered, Color Input dropping its own field and letting this be
|
|
140
|
+
* the only one, and it is worse for a form: the value cannot be read or pasted
|
|
141
|
+
* without opening a panel.
|
|
142
|
+
*/
|
|
143
|
+
noValue: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Whether the reader may change the format.
|
|
146
|
+
*/
|
|
147
|
+
noFormat: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Whether the eyedropper is offered where the browser has one.
|
|
150
|
+
*/
|
|
151
|
+
noEyedropper: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Colors offered under the picker, as a comma-separated list.
|
|
154
|
+
*/
|
|
155
|
+
swatches: string;
|
|
156
|
+
/**
|
|
157
|
+
* The color the reader has moved to, or nothing while they have moved none.
|
|
158
|
+
*
|
|
159
|
+
* Held rather than re-read, which is the whole point: see the class
|
|
160
|
+
* description. Cleared whenever a value arrives from anywhere else, so the
|
|
161
|
+
* next reading comes from that value instead.
|
|
162
|
+
*/
|
|
163
|
+
private moved;
|
|
164
|
+
/**
|
|
165
|
+
* Whether this browser can sample a color off the screen.
|
|
166
|
+
*
|
|
167
|
+
* Settled after the first render rather than at construction, because there is
|
|
168
|
+
* no `window` on the server, and a button that ships in the markup and does
|
|
169
|
+
* nothing in Firefox is worse than one that is never offered.
|
|
170
|
+
*/
|
|
171
|
+
private sampling;
|
|
172
|
+
/**
|
|
173
|
+
* Whether the value on this element was produced here.
|
|
174
|
+
*
|
|
175
|
+
* The one bit that keeps the model from being overwritten by the value it just
|
|
176
|
+
* produced. Without it, dragging to the bottom of the square writes black,
|
|
177
|
+
* which reads back as hue 0 and saturation 0, and the next drag starts gray.
|
|
178
|
+
*/
|
|
179
|
+
private owned;
|
|
180
|
+
/** Where the picker stands: what was moved, or what the value says, or the start. */
|
|
181
|
+
get color(): Color;
|
|
182
|
+
/**
|
|
183
|
+
* Whether the tools row holds anything at all.
|
|
184
|
+
*
|
|
185
|
+
* The group is withheld rather than rendered empty, because it is an element
|
|
186
|
+
* with a role and a name: an empty group labeled "Color tools" announces
|
|
187
|
+
* nothing, and the footer cannot tell it is empty either, so the row kept its
|
|
188
|
+
* padding with nothing in it.
|
|
189
|
+
*/
|
|
190
|
+
private get tools();
|
|
191
|
+
/** The presets, as written, with anything that is not a color dropped. */
|
|
192
|
+
private get presets();
|
|
193
|
+
/**
|
|
194
|
+
* The last value that was a color.
|
|
195
|
+
*
|
|
196
|
+
* Half-typed input reaches the row on every keystroke and most of it is not a
|
|
197
|
+
* color, so the square is given the last thing that was one. Typing `#00ff00`
|
|
198
|
+
* a character at a time goes `#`, `#0`, `#00`, `#00f`, `#00ff`, `#00ff0`,
|
|
199
|
+
* `#00ff00`: two of those are colors and the ones between are not, so without
|
|
200
|
+
* this the square walks red, blue, red, green. Color Input keeps the same
|
|
201
|
+
* guard for its own field, each local to the input it protects.
|
|
202
|
+
*/
|
|
203
|
+
private settled;
|
|
204
|
+
/** Takes what was typed, and lets the square follow only a whole color. */
|
|
205
|
+
private readonly handleValueInput;
|
|
206
|
+
/** Moves part of the model and announces the value that follows from it. */
|
|
207
|
+
private readonly move;
|
|
208
|
+
/**
|
|
209
|
+
* Copying the value, which is the one thing here worth taking away.
|
|
210
|
+
*
|
|
211
|
+
* A reader who has just built a color wants it in a stylesheet, and the
|
|
212
|
+
* alternative is selecting text out of a field that may not be on screen. The
|
|
213
|
+
* chip is the obvious target: it is the color, at the size of a control, and
|
|
214
|
+
* it had no job at all before this.
|
|
215
|
+
*
|
|
216
|
+
* The controller rather than the four lines it replaces, because a copy button
|
|
217
|
+
* is coming and the two share everything that is easy to get wrong: the write,
|
|
218
|
+
* the confirmation, the timer that ends it, the event, and a failure that is
|
|
219
|
+
* correctly silent.
|
|
220
|
+
*/
|
|
221
|
+
private readonly copier;
|
|
222
|
+
/** Takes a preset, in this picker's syntax rather than as the preset spelled it. */
|
|
223
|
+
private readonly handleSwatch;
|
|
224
|
+
/** Walks the format on, and rewrites the value in it. */
|
|
225
|
+
private readonly handleFormat;
|
|
226
|
+
/**
|
|
227
|
+
* Samples a color from anywhere on the screen.
|
|
228
|
+
*
|
|
229
|
+
* `helix-sample-start` and `helix-sample-end` bracket it, because whatever is
|
|
230
|
+
* holding this picker may need to get out of the way: `EyeDropper` takes the
|
|
231
|
+
* pointer over, and a floating panel left up during it is one the reader
|
|
232
|
+
* cannot dismiss and may well be trying to sample from underneath. This
|
|
233
|
+
* element cannot know it is in a panel, so it says what it is doing and lets
|
|
234
|
+
* whatever does know decide.
|
|
235
|
+
*/
|
|
236
|
+
private readonly handleEyeDropper;
|
|
237
|
+
/**
|
|
238
|
+
* Dragging in the square.
|
|
239
|
+
*
|
|
240
|
+
* The two ranges are the state, so this reads a point and writes to them
|
|
241
|
+
* rather than keeping a position of its own. Pointer capture, so a drag that
|
|
242
|
+
* leaves the square keeps going: leaving and coming back is how a reader
|
|
243
|
+
* reaches a corner, and without it the handle stops wherever the pointer left.
|
|
244
|
+
*/
|
|
245
|
+
private readonly handleGridPointer;
|
|
246
|
+
protected firstUpdated(changed: import('lit').PropertyValues): void;
|
|
247
|
+
protected updated(changed: import('lit').PropertyValues): void;
|
|
248
|
+
/** Puts the keyboard on the square, which is the control a reader wants. */
|
|
249
|
+
focus(options?: FocusOptions): void;
|
|
250
|
+
/** One of the ramps under the square. */
|
|
251
|
+
protected renderChannel(channel: 'alpha' | 'hue', label: string, max: number, value: number): TemplateResult;
|
|
252
|
+
/**
|
|
253
|
+
* One axis of the area, taken the way `takeChannel` takes a rail.
|
|
254
|
+
*
|
|
255
|
+
* **Named rather than inline because of the first line.** These were two arrow
|
|
256
|
+
* functions that moved the color and stopped nothing, so the `<input
|
|
257
|
+
* type="range">` behind each axis sent its own composed `input` straight past
|
|
258
|
+
* this element to whoever was listening on it: a consumer dragging the area
|
|
259
|
+
* received the range's event and not this component's. `takeChannel` beside it
|
|
260
|
+
* has stopped its own since it was written, which is what made the omission
|
|
261
|
+
* hard to see. Found by sweeping every family that renders a native control.
|
|
262
|
+
*/
|
|
263
|
+
private takeArea;
|
|
264
|
+
/**
|
|
265
|
+
* A channel's new value, read off the slider that just applied it.
|
|
266
|
+
*
|
|
267
|
+
* **Both native events, because a slider sends both and at different
|
|
268
|
+
* moments.** It is one of the controls a reader edits continuously, so it
|
|
269
|
+
* announces `input` all the way through a drag and `change` when the drag
|
|
270
|
+
* ends. Listening only for the commit meant the picker heard nothing while a
|
|
271
|
+
* handle moved and the hue and alpha handles did not move at all.
|
|
272
|
+
*
|
|
273
|
+
* **Read off the target rather than out of a detail**, which is what changed
|
|
274
|
+
* on 26 Aug 2026. This bound `helix-input` and `helix-change` and took the
|
|
275
|
+
* proposed value out of the event. Those are requests: they announce what the
|
|
276
|
+
* slider is *about* to do, before anything has moved and while a listener may
|
|
277
|
+
* still refuse it. The native pair fires after the slider applied, so the
|
|
278
|
+
* value is on the element and cannot disagree with it. See 294.
|
|
279
|
+
*
|
|
280
|
+
* Idempotent, so taking both costs nothing: the same value applied twice is
|
|
281
|
+
* the same color.
|
|
282
|
+
*/
|
|
283
|
+
private takeChannel;
|
|
284
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
285
|
+
/**
|
|
286
|
+
* The eyedropper and the swatch tools, which are a group of buttons, behind a seam the styled tier can move.
|
|
287
|
+
*
|
|
288
|
+
* A method rather than a fragment inline, so a tier above can render its own,
|
|
289
|
+
* wrap this one, pass it a property the base does not know about, or leave it
|
|
290
|
+
* out, without reimplementing the whole template to do any of them. The tag is
|
|
291
|
+
* interpolated rather than written, so `tier` resolves it: this renders the
|
|
292
|
+
* headless element, and a styled subclass that sets `tier` renders the styled one
|
|
293
|
+
* from the same template.
|
|
294
|
+
*/
|
|
295
|
+
protected renderTools(): TemplateResult;
|
|
296
|
+
protected render(): TemplateResult;
|
|
297
|
+
}
|
|
298
|
+
declare global {
|
|
299
|
+
interface HTMLElementTagNameMap {
|
|
300
|
+
'helix-headless-color-picker': HelixHeadlessColorPicker;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
export {};
|