@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,576 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { CopyController, capturePointer, customElement, drawIcon, HelixFormElement, HelixSampleEndEvent, HelixSampleStartEvent, MixinControllerValue, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { eyedropper } from '@fusion.dev/helix-icons';
|
|
9
|
+
import { nothing } from 'lit';
|
|
10
|
+
import { property, state } from 'lit/decorators.js';
|
|
11
|
+
import { html } from 'lit/static-html.js';
|
|
12
|
+
/* Side-effect import, because this renders a slider in its own shadow root and
|
|
13
|
+
a custom element registers on import. The path is relative, so this registers
|
|
14
|
+
the base slider and the styled file's identical import registers the styled
|
|
15
|
+
one; `tier` picks which name the template asks for. */
|
|
16
|
+
import '../../button/index.js';
|
|
17
|
+
import '../../button-group/index.js';
|
|
18
|
+
import '../../slider/index.js';
|
|
19
|
+
import { formatColor, parseColor, splitColors, toCss, } from '../color.js';
|
|
20
|
+
/** The formats the toggle walks through, in the order it walks them. */
|
|
21
|
+
const FORMATS = ['hex', 'rgb', 'hsl'];
|
|
22
|
+
/**
|
|
23
|
+
* Where a picker starts when there is nothing to start from.
|
|
24
|
+
*
|
|
25
|
+
* Not black, which is what `<input type="color">` opens on. Black is
|
|
26
|
+
* `brightness: 0`, and from there the hue ramp moves nothing and the square is
|
|
27
|
+
* one flat color: the whole thing is dead until the reader happens to raise
|
|
28
|
+
* brightness first. Pure red is the nearest color where everything answers the
|
|
29
|
+
* first thing touched.
|
|
30
|
+
*/
|
|
31
|
+
const START = { alpha: 100, brightness: 100, hue: 0, saturation: 100 };
|
|
32
|
+
/**
|
|
33
|
+
* @summary Picks a color, from a square and two ramps.
|
|
34
|
+
*
|
|
35
|
+
* @description
|
|
36
|
+
* **The picker itself, with no field around it.** Color Input is this element in
|
|
37
|
+
* a panel behind a text field, the same way Date Input is `helix-date-picker` in a
|
|
38
|
+
* panel: a form wants a field, and a settings pane or a toolbar wants the picker
|
|
39
|
+
* sitting flat on the page with nothing to open. Neither should be the other one
|
|
40
|
+
* with parts hidden.
|
|
41
|
+
*
|
|
42
|
+
* **The square is two real range inputs.** Saturation and brightness are each an
|
|
43
|
+
* `<input type="range">`, laid over the square and made invisible, and the
|
|
44
|
+
* handle is drawn from their values. The pointer gets the square; the keyboard
|
|
45
|
+
* gets the arrow keys, Home, End and the page keys; a screen reader gets two
|
|
46
|
+
* sliders that announce a name and a number. All of it is the platform's, and
|
|
47
|
+
* nothing here implements a key handler. There is no `role="application"`, which
|
|
48
|
+
* is the usual way this control is built and amounts to asking a screen reader
|
|
49
|
+
* to stop helping.
|
|
50
|
+
*
|
|
51
|
+
* **The working model is HSB, and the value is derived from it.** The reverse
|
|
52
|
+
* loses colors: black is `brightness: 0`, whose hue and saturation are both
|
|
53
|
+
* undefined, so a reader who drags to the bottom of the square and back would
|
|
54
|
+
* get gray where they had red. Holding the model means a color survives a trip
|
|
55
|
+
* through one that has no hue. A value arriving from outside is read into the
|
|
56
|
+
* model once, which is the only moment the conversion runs in that direction.
|
|
57
|
+
*
|
|
58
|
+
* **Every syntax is read; the one `format` names is written.** `#f00`,
|
|
59
|
+
* `#ff0000`, `rgb(255 0 0)`, `rgba(255,0,0,.5)` and `hsl(0 100% 50%)` are all
|
|
60
|
+
* colors. Named colors are the exception, and deliberately: resolving
|
|
61
|
+
* `rebeccapurple` means shipping a table of a hundred and forty or asking the
|
|
62
|
+
* browser, and there is no browser during a server render.
|
|
63
|
+
*
|
|
64
|
+
* The properties below are written by this component and read by whoever draws
|
|
65
|
+
* it. A consumer sets none of them: they carry a number this element computed
|
|
66
|
+
* and CSS cannot, which is what lets a stylesheet on this tier draw the thing
|
|
67
|
+
* without measuring anything itself.
|
|
68
|
+
*
|
|
69
|
+
* @since 0.1.0
|
|
70
|
+
* @status experimental
|
|
71
|
+
* @category forms
|
|
72
|
+
* @aliases Color, ColorArea, Swatch picker
|
|
73
|
+
* @documentation https://helix.fusion.dev/components/color-picker
|
|
74
|
+
*
|
|
75
|
+
* @slot eyedropper-icon - The glyph on the screen-sampling control, usually a dropper.
|
|
76
|
+
*
|
|
77
|
+
* @event {Event} change - Announced once the value has moved.
|
|
78
|
+
* @event {HelixBeforeChangeEvent} helix-before-change - Fired before the color changes. Cancelable: refusing it takes the decision and nothing moves.
|
|
79
|
+
* @event {HelixCopyEvent} helix-copy - Fired when the color is put on the clipboard.
|
|
80
|
+
* @event {HelixSampleEndEvent} helix-sample-end - The eyedropper has closed, whether or not a color was taken.
|
|
81
|
+
* @event {HelixSampleStartEvent} helix-sample-start - The eyedropper is opening, so anything covering the page should get out of the way.
|
|
82
|
+
* @event {Event} input - Announced once the value has moved.
|
|
83
|
+
*
|
|
84
|
+
* @csspart actions - The group holding the eyedropper and the syntax toggle.
|
|
85
|
+
* @csspart channel - One ramp.
|
|
86
|
+
* @csspart channel-control - The range input.
|
|
87
|
+
* @csspart channel-feedback - What is wrong with it.
|
|
88
|
+
* @csspart channel-field - The row: the control and its readout.
|
|
89
|
+
* @csspart channel-hint - Help under the track, while nothing is wrong.
|
|
90
|
+
* @csspart channel-label - The question, over the track.
|
|
91
|
+
* @csspart channel-marker - One mark.
|
|
92
|
+
* @csspart channel-marker-label - The value a mark stands at, when `marker-labels` is set.
|
|
93
|
+
* @csspart channel-markers - The row of marks along the track.
|
|
94
|
+
* @csspart channel-output - The current value, shown beside it.
|
|
95
|
+
* @csspart channels - The ramps beside it.
|
|
96
|
+
* @csspart controls - The row under the square.
|
|
97
|
+
* @csspart eyedropper - The control that samples a color from the screen.
|
|
98
|
+
* @csspart eyedropper-button - The inner control.
|
|
99
|
+
* @csspart footer - The row holding the value and the tools.
|
|
100
|
+
* @csspart format - The control that changes the syntax the value is written in.
|
|
101
|
+
* @csspart format-button - The inner control.
|
|
102
|
+
* @csspart grid - The saturation and brightness square.
|
|
103
|
+
* @csspart grid-brightness - The range input for its vertical axis.
|
|
104
|
+
* @csspart grid-handle - The mark showing where in the square the color sits.
|
|
105
|
+
* @csspart grid-saturation - The range input for the square's horizontal axis.
|
|
106
|
+
* @csspart icon - A glyph this component draws.
|
|
107
|
+
* @csspart sample - The chip of the current color, which copies it when pressed.
|
|
108
|
+
* @csspart swatch - One preset.
|
|
109
|
+
* @csspart swatches - The row of presets.
|
|
110
|
+
* @csspart value - The color as text, which can be typed or pasted.
|
|
111
|
+
*
|
|
112
|
+
* @cssproperty --color-picker-brightness - The chosen brightness, 0 to 100, as a percentage.
|
|
113
|
+
* @cssproperty --color-picker-hue - The chosen hue, 0 to 360, unitless.
|
|
114
|
+
* @cssproperty --color-picker-saturation - The chosen saturation, 0 to 100, as a percentage.
|
|
115
|
+
* @cssproperty --color-picker-swatch - A color to paint: the current one on the sample, a preset's on each preset.
|
|
116
|
+
*/
|
|
117
|
+
let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinControllerValue(HelixFormElement) {
|
|
118
|
+
constructor() {
|
|
119
|
+
super(...arguments);
|
|
120
|
+
/**
|
|
121
|
+
* What the browser may autofill in the text field, as a platform token.
|
|
122
|
+
*
|
|
123
|
+
* **Defaults to `off`, which is not the platform's default and is the
|
|
124
|
+
* point.** The field filters a list rather than collecting a value, so a
|
|
125
|
+
* browser offering to fill it with a saved address is competing for the same
|
|
126
|
+
* keystrokes as the listbox. A consumer who wants autofill can still ask.
|
|
127
|
+
*/
|
|
128
|
+
this.autocomplete = 'off';
|
|
129
|
+
/**
|
|
130
|
+
* Whether the current selection fails validation.
|
|
131
|
+
*
|
|
132
|
+
* A flag rather than a message, which is the split Date Picker already drew and
|
|
133
|
+
* these two now follow. A flat picker has no room of its own for a sentence:
|
|
134
|
+
* the field that wraps one owns the label, the hint and the feedback, and a
|
|
135
|
+
* second message inside the panel would be the same error said twice. What is
|
|
136
|
+
* left for the picker is the one thing the field cannot draw from outside, the
|
|
137
|
+
* mark on the answer itself.
|
|
138
|
+
*/
|
|
139
|
+
this.invalid = false;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the color carries an alpha channel.
|
|
142
|
+
*
|
|
143
|
+
* Off by default, because it widens every value written, and a consumer who
|
|
144
|
+
* did not ask for transparency should not have to strip a byte off each one.
|
|
145
|
+
*/
|
|
146
|
+
this.alpha = false;
|
|
147
|
+
/**
|
|
148
|
+
* Whether to leave the value out, for a picker whose value is stated elsewhere.
|
|
149
|
+
*
|
|
150
|
+
* The row reads the color as text and lets it be typed or pasted, which is
|
|
151
|
+
* what makes this element complete standing on a page: a square and two ramps
|
|
152
|
+
* can build a color and cannot state one, and a reader who has a hex already
|
|
153
|
+
* should not have to find it by dragging.
|
|
154
|
+
*
|
|
155
|
+
* Color Input sets this, because its field is that input. Two editable fields
|
|
156
|
+
* for one value is the outcome worth avoiding: two places to type, and no
|
|
157
|
+
* answer to which one is authoritative or which has the caret. The other way
|
|
158
|
+
* round was considered, Color Input dropping its own field and letting this be
|
|
159
|
+
* the only one, and it is worse for a form: the value cannot be read or pasted
|
|
160
|
+
* without opening a panel.
|
|
161
|
+
*/
|
|
162
|
+
this.noValue = false;
|
|
163
|
+
/**
|
|
164
|
+
* Whether the reader may change the format.
|
|
165
|
+
*/
|
|
166
|
+
this.noFormat = false;
|
|
167
|
+
/**
|
|
168
|
+
* Whether the eyedropper is offered where the browser has one.
|
|
169
|
+
*/
|
|
170
|
+
this.noEyedropper = false;
|
|
171
|
+
/**
|
|
172
|
+
* Colors offered under the picker, as a comma-separated list.
|
|
173
|
+
*/
|
|
174
|
+
this.swatches = '';
|
|
175
|
+
/**
|
|
176
|
+
* Whether this browser can sample a color off the screen.
|
|
177
|
+
*
|
|
178
|
+
* Settled after the first render rather than at construction, because there is
|
|
179
|
+
* no `window` on the server, and a button that ships in the markup and does
|
|
180
|
+
* nothing in Firefox is worse than one that is never offered.
|
|
181
|
+
*/
|
|
182
|
+
this.sampling = false;
|
|
183
|
+
/**
|
|
184
|
+
* Whether the value on this element was produced here.
|
|
185
|
+
*
|
|
186
|
+
* The one bit that keeps the model from being overwritten by the value it just
|
|
187
|
+
* produced. Without it, dragging to the bottom of the square writes black,
|
|
188
|
+
* which reads back as hue 0 and saturation 0, and the next drag starts gray.
|
|
189
|
+
*/
|
|
190
|
+
this.owned = false;
|
|
191
|
+
/**
|
|
192
|
+
* The last value that was a color.
|
|
193
|
+
*
|
|
194
|
+
* Half-typed input reaches the row on every keystroke and most of it is not a
|
|
195
|
+
* color, so the square is given the last thing that was one. Typing `#00ff00`
|
|
196
|
+
* a character at a time goes `#`, `#0`, `#00`, `#00f`, `#00ff`, `#00ff0`,
|
|
197
|
+
* `#00ff00`: two of those are colors and the ones between are not, so without
|
|
198
|
+
* this the square walks red, blue, red, green. Color Input keeps the same
|
|
199
|
+
* guard for its own field, each local to the input it protects.
|
|
200
|
+
*/
|
|
201
|
+
this.settled = '';
|
|
202
|
+
/** Takes what was typed, and lets the square follow only a whole color. */
|
|
203
|
+
this.handleValueInput = (event) => {
|
|
204
|
+
// Stopped for the reason `Input.handleInput` gives: the inner control's own
|
|
205
|
+
// `input` is composed and would reach a consumer beside this element's.
|
|
206
|
+
event.stopPropagation();
|
|
207
|
+
const typed = event.target.value;
|
|
208
|
+
const parsed = parseColor(typed);
|
|
209
|
+
if (parsed) {
|
|
210
|
+
this.moved = parsed;
|
|
211
|
+
this.owned = true;
|
|
212
|
+
}
|
|
213
|
+
this.requestValue(typed);
|
|
214
|
+
};
|
|
215
|
+
/** Moves part of the model and announces the value that follows from it. */
|
|
216
|
+
this.move = (next) => {
|
|
217
|
+
this.moved = { ...this.color, ...next };
|
|
218
|
+
this.owned = true;
|
|
219
|
+
this.requestValue(formatColor(this.moved, this.format ?? 'hex', this.alpha));
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Copying the value, which is the one thing here worth taking away.
|
|
223
|
+
*
|
|
224
|
+
* A reader who has just built a color wants it in a stylesheet, and the
|
|
225
|
+
* alternative is selecting text out of a field that may not be on screen. The
|
|
226
|
+
* chip is the obvious target: it is the color, at the size of a control, and
|
|
227
|
+
* it had no job at all before this.
|
|
228
|
+
*
|
|
229
|
+
* The controller rather than the four lines it replaces, because a copy button
|
|
230
|
+
* is coming and the two share everything that is easy to get wrong: the write,
|
|
231
|
+
* the confirmation, the timer that ends it, the event, and a failure that is
|
|
232
|
+
* correctly silent.
|
|
233
|
+
*/
|
|
234
|
+
this.copier = new CopyController(this);
|
|
235
|
+
/** Takes a preset, in this picker's syntax rather than as the preset spelled it. */
|
|
236
|
+
this.handleSwatch = (preset) => {
|
|
237
|
+
const parsed = parseColor(preset);
|
|
238
|
+
if (parsed) {
|
|
239
|
+
this.move(parsed);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
/** Walks the format on, and rewrites the value in it. */
|
|
243
|
+
this.handleFormat = () => {
|
|
244
|
+
this.format = FORMATS[(FORMATS.indexOf(this.format ?? 'hex') + 1) % FORMATS.length] ?? 'hex';
|
|
245
|
+
if (this.value !== '') {
|
|
246
|
+
this.move({});
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Samples a color from anywhere on the screen.
|
|
251
|
+
*
|
|
252
|
+
* `helix-sample-start` and `helix-sample-end` bracket it, because whatever is
|
|
253
|
+
* holding this picker may need to get out of the way: `EyeDropper` takes the
|
|
254
|
+
* pointer over, and a floating panel left up during it is one the reader
|
|
255
|
+
* cannot dismiss and may well be trying to sample from underneath. This
|
|
256
|
+
* element cannot know it is in a panel, so it says what it is doing and lets
|
|
257
|
+
* whatever does know decide.
|
|
258
|
+
*/
|
|
259
|
+
this.handleEyeDropper = async () => {
|
|
260
|
+
const Dropper = globalThis.EyeDropper;
|
|
261
|
+
if (!Dropper) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
this.dispatchEvent(new HelixSampleStartEvent());
|
|
265
|
+
try {
|
|
266
|
+
const { sRGBHex } = await new Dropper().open();
|
|
267
|
+
const parsed = parseColor(sRGBHex);
|
|
268
|
+
if (parsed) {
|
|
269
|
+
// A sample carries no alpha, so whatever was set is kept.
|
|
270
|
+
this.move({ ...parsed, alpha: this.color.alpha });
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
/* Canceling is how this is normally left, and the platform reports it as
|
|
275
|
+
a rejection. There is nothing to recover from and nothing to say. */
|
|
276
|
+
}
|
|
277
|
+
this.dispatchEvent(new HelixSampleEndEvent());
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Dragging in the square.
|
|
281
|
+
*
|
|
282
|
+
* The two ranges are the state, so this reads a point and writes to them
|
|
283
|
+
* rather than keeping a position of its own. Pointer capture, so a drag that
|
|
284
|
+
* leaves the square keeps going: leaving and coming back is how a reader
|
|
285
|
+
* reaches a corner, and without it the handle stops wherever the pointer left.
|
|
286
|
+
*/
|
|
287
|
+
this.handleGridPointer = (event) => {
|
|
288
|
+
const grid = event.currentTarget;
|
|
289
|
+
if (event.type === 'pointerdown') {
|
|
290
|
+
capturePointer(grid, event.pointerId);
|
|
291
|
+
// So the keyboard carries on from where the pointer left off.
|
|
292
|
+
this.renderRoot?.querySelector('[part="grid-saturation"]')?.focus();
|
|
293
|
+
}
|
|
294
|
+
else if (!grid.hasPointerCapture(event.pointerId)) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
event.preventDefault();
|
|
298
|
+
const box = grid.getBoundingClientRect();
|
|
299
|
+
if (box.width === 0 || box.height === 0) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const across = Math.min(1, Math.max(0, (event.clientX - box.left) / box.width));
|
|
303
|
+
const down = Math.min(1, Math.max(0, (event.clientY - box.top) / box.height));
|
|
304
|
+
this.move({ brightness: Math.round((1 - down) * 100), saturation: Math.round(across * 100) });
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/** Where the picker stands: what was moved, or what the value says, or the start. */
|
|
308
|
+
get color() {
|
|
309
|
+
/* `settled` between the value and the start, so a half-typed value leaves
|
|
310
|
+
the square where the last whole one put it rather than throwing it back to
|
|
311
|
+
red. Only reached where the value itself is not a color. */
|
|
312
|
+
return this.moved ?? parseColor(this.value) ?? parseColor(this.settled) ?? START;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Whether the tools row holds anything at all.
|
|
316
|
+
*
|
|
317
|
+
* The group is withheld rather than rendered empty, because it is an element
|
|
318
|
+
* with a role and a name: an empty group labeled "Color tools" announces
|
|
319
|
+
* nothing, and the footer cannot tell it is empty either, so the row kept its
|
|
320
|
+
* padding with nothing in it.
|
|
321
|
+
*/
|
|
322
|
+
get tools() {
|
|
323
|
+
return (this.sampling && !this.noEyedropper) || !this.noFormat;
|
|
324
|
+
}
|
|
325
|
+
/** The presets, as written, with anything that is not a color dropped. */
|
|
326
|
+
get presets() {
|
|
327
|
+
return splitColors(this.swatches).filter((one) => parseColor(one) !== null);
|
|
328
|
+
}
|
|
329
|
+
firstUpdated(changed) {
|
|
330
|
+
super.firstUpdated(changed);
|
|
331
|
+
this.sampling = 'EyeDropper' in globalThis;
|
|
332
|
+
}
|
|
333
|
+
updated(changed) {
|
|
334
|
+
super.updated(changed);
|
|
335
|
+
if (changed.has('value')) {
|
|
336
|
+
if (parseColor(this.value)) {
|
|
337
|
+
this.settled = this.value;
|
|
338
|
+
}
|
|
339
|
+
/* Let go only where the value came from somewhere else, so the getter
|
|
340
|
+
reads that value instead. `owned` is cleared here rather than where it
|
|
341
|
+
is set, so it covers exactly the one update this element caused. */
|
|
342
|
+
if (this.owned) {
|
|
343
|
+
this.owned = false;
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
this.moved = undefined;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/** Puts the keyboard on the square, which is the control a reader wants. */
|
|
351
|
+
focus(options) {
|
|
352
|
+
this.renderRoot?.querySelector('[part="grid-saturation"]')?.focus(options);
|
|
353
|
+
}
|
|
354
|
+
/** One of the ramps under the square. */
|
|
355
|
+
/* `protected` rather than `private`: the method was already the seam and a
|
|
356
|
+
tier above simply could not reach it. */
|
|
357
|
+
renderChannel(channel, label, max, value) {
|
|
358
|
+
return html `<${this.tag('slider')}
|
|
359
|
+
part="channel"
|
|
360
|
+
exportparts="control: channel-control, feedback: channel-feedback, field: channel-field,
|
|
361
|
+
hint: channel-hint, label: channel-label, marker: channel-marker,
|
|
362
|
+
marker-label: channel-marker-label, markers: channel-markers, output: channel-output"
|
|
363
|
+
data-channel=${channel}
|
|
364
|
+
label=${label}
|
|
365
|
+
max=${max}
|
|
366
|
+
min="0"
|
|
367
|
+
.value=${String(value)}
|
|
368
|
+
?disabled=${this.isDisabled}
|
|
369
|
+
@input=${(event) => this.takeChannel(channel, event)}
|
|
370
|
+
@change=${(event) => this.takeChannel(channel, event)}
|
|
371
|
+
></${this.tag('slider')}>`;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* One axis of the area, taken the way `takeChannel` takes a rail.
|
|
375
|
+
*
|
|
376
|
+
* **Named rather than inline because of the first line.** These were two arrow
|
|
377
|
+
* functions that moved the color and stopped nothing, so the `<input
|
|
378
|
+
* type="range">` behind each axis sent its own composed `input` straight past
|
|
379
|
+
* this element to whoever was listening on it: a consumer dragging the area
|
|
380
|
+
* received the range's event and not this component's. `takeChannel` beside it
|
|
381
|
+
* has stopped its own since it was written, which is what made the omission
|
|
382
|
+
* hard to see. Found by sweeping every family that renders a native control.
|
|
383
|
+
*/
|
|
384
|
+
takeArea(axis, event) {
|
|
385
|
+
event.stopPropagation();
|
|
386
|
+
const { value } = event.target;
|
|
387
|
+
this.move({ [axis]: Number(value) });
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* A channel's new value, read off the slider that just applied it.
|
|
391
|
+
*
|
|
392
|
+
* **Both native events, because a slider sends both and at different
|
|
393
|
+
* moments.** It is one of the controls a reader edits continuously, so it
|
|
394
|
+
* announces `input` all the way through a drag and `change` when the drag
|
|
395
|
+
* ends. Listening only for the commit meant the picker heard nothing while a
|
|
396
|
+
* handle moved and the hue and alpha handles did not move at all.
|
|
397
|
+
*
|
|
398
|
+
* **Read off the target rather than out of a detail**, which is what changed
|
|
399
|
+
* on 26 Aug 2026. This bound `helix-input` and `helix-change` and took the
|
|
400
|
+
* proposed value out of the event. Those are requests: they announce what the
|
|
401
|
+
* slider is *about* to do, before anything has moved and while a listener may
|
|
402
|
+
* still refuse it. The native pair fires after the slider applied, so the
|
|
403
|
+
* value is on the element and cannot disagree with it. See 294.
|
|
404
|
+
*
|
|
405
|
+
* Idempotent, so taking both costs nothing: the same value applied twice is
|
|
406
|
+
* the same color.
|
|
407
|
+
*/
|
|
408
|
+
takeChannel(channel, event) {
|
|
409
|
+
event.stopPropagation();
|
|
410
|
+
const { value } = event.target;
|
|
411
|
+
this.move({ [channel]: Number(value) });
|
|
412
|
+
}
|
|
413
|
+
/* `ariaInvalid` on the host through `ElementInternals`, the same route
|
|
414
|
+
Date Picker takes and for the reason the whole library records: a `role` or a
|
|
415
|
+
state written onto the host as an attribute is one a React consumer's
|
|
416
|
+
server markup never had. */
|
|
417
|
+
willUpdate(changed) {
|
|
418
|
+
super.willUpdate(changed);
|
|
419
|
+
this.internals.ariaInvalid = this.invalid ? 'true' : null;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* The eyedropper and the swatch tools, which are a group of buttons, behind a seam the styled tier can move.
|
|
423
|
+
*
|
|
424
|
+
* A method rather than a fragment inline, so a tier above can render its own,
|
|
425
|
+
* wrap this one, pass it a property the base does not know about, or leave it
|
|
426
|
+
* out, without reimplementing the whole template to do any of them. The tag is
|
|
427
|
+
* interpolated rather than written, so `tier` resolves it: this renders the
|
|
428
|
+
* headless element, and a styled subclass that sets `tier` renders the styled one
|
|
429
|
+
* from the same template.
|
|
430
|
+
*/
|
|
431
|
+
renderTools() {
|
|
432
|
+
return html `<${this.tag('button-group')} part="actions" label="Color tools">
|
|
433
|
+
${this.sampling && !this.noEyedropper
|
|
434
|
+
? html `<${this.tag('button')}
|
|
435
|
+
part="eyedropper"
|
|
436
|
+
exportparts="button: eyedropper-button"
|
|
437
|
+
aria-label="Sample a color from the screen"
|
|
438
|
+
?disabled=${this.isDisabled}
|
|
439
|
+
@click=${this.handleEyeDropper}
|
|
440
|
+
>
|
|
441
|
+
<slot name="eyedropper-icon">${drawIcon(eyedropper)}</slot>
|
|
442
|
+
</${this.tag('button')}>`
|
|
443
|
+
: nothing}
|
|
444
|
+
${this.noFormat
|
|
445
|
+
? nothing
|
|
446
|
+
: html `<${this.tag('button')}
|
|
447
|
+
part="format"
|
|
448
|
+
exportparts="button: format-button"
|
|
449
|
+
aria-label=${`Syntax: ${this.format ?? 'hex'}. Change it.`}
|
|
450
|
+
?disabled=${this.isDisabled}
|
|
451
|
+
@click=${this.handleFormat}
|
|
452
|
+
>
|
|
453
|
+
${this.format ?? 'hex'}
|
|
454
|
+
</${this.tag('button')}>`}
|
|
455
|
+
</${this.tag('button-group')}>`;
|
|
456
|
+
}
|
|
457
|
+
render() {
|
|
458
|
+
const color = this.color;
|
|
459
|
+
const painted = toCss(color);
|
|
460
|
+
return html `<div
|
|
461
|
+
part="grid"
|
|
462
|
+
style="--color-picker-hue: ${color.hue}; --color-picker-saturation: ${color.saturation}%; --color-picker-brightness: ${color.brightness}%"
|
|
463
|
+
@pointerdown=${this.handleGridPointer}
|
|
464
|
+
@pointermove=${this.handleGridPointer}
|
|
465
|
+
>
|
|
466
|
+
<span part="grid-handle" aria-hidden="true"></span>
|
|
467
|
+
<input
|
|
468
|
+
part="grid-saturation"
|
|
469
|
+
type="range"
|
|
470
|
+
min="0"
|
|
471
|
+
max="100"
|
|
472
|
+
aria-label="Saturation"
|
|
473
|
+
.value=${String(color.saturation)}
|
|
474
|
+
?disabled=${this.isDisabled}
|
|
475
|
+
@input=${(event) => this.takeArea('saturation', event)}
|
|
476
|
+
/>
|
|
477
|
+
<input
|
|
478
|
+
part="grid-brightness"
|
|
479
|
+
type="range"
|
|
480
|
+
min="0"
|
|
481
|
+
max="100"
|
|
482
|
+
aria-label="Brightness"
|
|
483
|
+
.value=${String(color.brightness)}
|
|
484
|
+
?disabled=${this.isDisabled}
|
|
485
|
+
@input=${(event) => this.takeArea('brightness', event)}
|
|
486
|
+
/>
|
|
487
|
+
</div>
|
|
488
|
+
|
|
489
|
+
<div part="controls" style="--color-picker-hue: ${color.hue}; --color-picker-swatch: ${painted}">
|
|
490
|
+
<button
|
|
491
|
+
part="sample"
|
|
492
|
+
type="button"
|
|
493
|
+
aria-label=${this.copier.copied ? 'Copied' : `Copy ${this.value || 'the color'}`}
|
|
494
|
+
data-copied=${this.copier.copied ? '' : nothing}
|
|
495
|
+
?disabled=${this.isDisabled || this.value === ''}
|
|
496
|
+
@click=${() => this.copier.copy(this.value)}
|
|
497
|
+
></button>
|
|
498
|
+
<div part="channels">
|
|
499
|
+
${this.renderChannel('hue', 'Hue', 360, color.hue)}
|
|
500
|
+
${this.alpha ? this.renderChannel('alpha', 'Opacity', 100, color.alpha) : nothing}
|
|
501
|
+
</div>
|
|
502
|
+
</div>
|
|
503
|
+
|
|
504
|
+
<!-- The syntax and the presets share a row, because neither fills one.
|
|
505
|
+
Above them the ramps get the whole width, which is what they need:
|
|
506
|
+
with the two controls stacked in a column beside them the hue bar was
|
|
507
|
+
eighty pixels, and a hue is picked out of three hundred and sixty. -->
|
|
508
|
+
<div part="footer">
|
|
509
|
+
${this.noValue
|
|
510
|
+
? nothing
|
|
511
|
+
: html `<input
|
|
512
|
+
part="value"
|
|
513
|
+
type="text"
|
|
514
|
+
aria-label="Color"
|
|
515
|
+
autocomplete=${this.autocomplete || nothing}
|
|
516
|
+
spellcheck="false"
|
|
517
|
+
.value=${this.value}
|
|
518
|
+
?disabled=${this.isDisabled}
|
|
519
|
+
@input=${this.handleValueInput}
|
|
520
|
+
/>`}
|
|
521
|
+
${this.tools ? html `${this.renderTools()}` : nothing}
|
|
522
|
+
</div>
|
|
523
|
+
|
|
524
|
+
${this.presets.length === 0
|
|
525
|
+
? nothing
|
|
526
|
+
: html `<div part="swatches" role="group" aria-label="Presets">
|
|
527
|
+
${this.presets.map((preset) => {
|
|
528
|
+
const parsed = parseColor(preset);
|
|
529
|
+
return html `<button
|
|
530
|
+
part="swatch"
|
|
531
|
+
type="button"
|
|
532
|
+
aria-label=${preset}
|
|
533
|
+
aria-pressed=${parsed !== null && toCss(parsed) === painted ? 'true' : 'false'}
|
|
534
|
+
style="--color-picker-swatch: ${preset}"
|
|
535
|
+
?disabled=${this.isDisabled}
|
|
536
|
+
@click=${() => this.handleSwatch(preset)}
|
|
537
|
+
></button>`;
|
|
538
|
+
})}
|
|
539
|
+
</div>`}
|
|
540
|
+
</div>`;
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
__decorate([
|
|
544
|
+
property()
|
|
545
|
+
], HelixHeadlessColorPicker.prototype, "autocomplete", void 0);
|
|
546
|
+
__decorate([
|
|
547
|
+
property({ reflect: true, type: Boolean })
|
|
548
|
+
], HelixHeadlessColorPicker.prototype, "invalid", void 0);
|
|
549
|
+
__decorate([
|
|
550
|
+
property({ reflect: true, type: Boolean })
|
|
551
|
+
], HelixHeadlessColorPicker.prototype, "alpha", void 0);
|
|
552
|
+
__decorate([
|
|
553
|
+
property({ reflect: true })
|
|
554
|
+
], HelixHeadlessColorPicker.prototype, "format", void 0);
|
|
555
|
+
__decorate([
|
|
556
|
+
property({ attribute: 'no-value', type: Boolean })
|
|
557
|
+
], HelixHeadlessColorPicker.prototype, "noValue", void 0);
|
|
558
|
+
__decorate([
|
|
559
|
+
property({ attribute: 'no-format', type: Boolean })
|
|
560
|
+
], HelixHeadlessColorPicker.prototype, "noFormat", void 0);
|
|
561
|
+
__decorate([
|
|
562
|
+
property({ attribute: 'no-eyedropper', type: Boolean })
|
|
563
|
+
], HelixHeadlessColorPicker.prototype, "noEyedropper", void 0);
|
|
564
|
+
__decorate([
|
|
565
|
+
property()
|
|
566
|
+
], HelixHeadlessColorPicker.prototype, "swatches", void 0);
|
|
567
|
+
__decorate([
|
|
568
|
+
state()
|
|
569
|
+
], HelixHeadlessColorPicker.prototype, "moved", void 0);
|
|
570
|
+
__decorate([
|
|
571
|
+
state()
|
|
572
|
+
], HelixHeadlessColorPicker.prototype, "sampling", void 0);
|
|
573
|
+
HelixHeadlessColorPicker = __decorate([
|
|
574
|
+
customElement('helix-headless-color-picker')
|
|
575
|
+
], HelixHeadlessColorPicker);
|
|
576
|
+
export { HelixHeadlessColorPicker };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './root/combobox-root.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './root/combobox-root.js';
|