@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,456 @@
|
|
|
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 { AriaForwardController, customElement, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, PopoverController, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { nothing } from 'lit';
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { html } from 'lit/static-html.js';
|
|
11
|
+
/* Side-effect import, because this renders a picker in its own shadow root and
|
|
12
|
+
a custom element registers on import. The path is relative, so this registers
|
|
13
|
+
the base picker and the styled file's identical import registers the styled
|
|
14
|
+
one; `tier` picks which name the template asks for. */
|
|
15
|
+
import '../../color-picker/index.js';
|
|
16
|
+
import { parseColor, toCss } from '../../color-picker/color.js';
|
|
17
|
+
/**
|
|
18
|
+
* @summary A color, typed in any syntax or picked from a panel.
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* **The picker is `helix-color-picker`, not a second one written here.** It owns the
|
|
22
|
+
* square, the ramps, the eyedropper and the syntax toggle, and it is worth
|
|
23
|
+
* having on its own: a settings pane wants a picker flat on the page with
|
|
24
|
+
* nothing to open. This element is the field, the overlay, and the form.
|
|
25
|
+
* Exactly the arrangement Date Input has with `helix-date-picker`.
|
|
26
|
+
*
|
|
27
|
+
* **Typed as well as picked, and the typing is the reason this is not
|
|
28
|
+
* `<input type="color">`.** The native control gives a free picker and takes
|
|
29
|
+
* nearly all styling with it, which is a fair trade until a product needs the
|
|
30
|
+
* panel to match everything around it. What is kept from the native one is the
|
|
31
|
+
* part worth keeping: a real text field, so a reader who has the hex pastes it
|
|
32
|
+
* and never opens anything.
|
|
33
|
+
*
|
|
34
|
+
* **Every syntax is read; the one `format` names is written.** `#f00`,
|
|
35
|
+
* `#ff0000`, `rgb(255 0 0)`, `rgba(255,0,0,.5)`, `rgb(255 0 0 / 50%)` and
|
|
36
|
+
* `hsl(0 100% 50%)` are all colors, and a field that refuses one because it
|
|
37
|
+
* prefers another is arguing with the person using it. What the field *shows* is
|
|
38
|
+
* the value itself, for the reason Date Input gives about its dates: half-typed
|
|
39
|
+
* input does not survive a round trip through a formatter.
|
|
40
|
+
*
|
|
41
|
+
* The properties below are written by this component and read by whoever draws
|
|
42
|
+
* it. A consumer sets none of them: they carry a number this element computed
|
|
43
|
+
* and CSS cannot, which is what lets a stylesheet on this tier draw the thing
|
|
44
|
+
* without measuring anything itself.
|
|
45
|
+
*
|
|
46
|
+
* @since 0.1.0
|
|
47
|
+
* @status experimental
|
|
48
|
+
* @category forms
|
|
49
|
+
* @aliases ColorField, ColourInput, InputColor
|
|
50
|
+
* @documentation https://helix.fusion.dev/components/color-input
|
|
51
|
+
*
|
|
52
|
+
* @slot end - Content at the trailing end, before the trigger.
|
|
53
|
+
* @slot feedback - What is wrong with it.
|
|
54
|
+
* @slot hint - Help under the field.
|
|
55
|
+
* @slot start - Content at the leading end of the field, inside its border.
|
|
56
|
+
* @slot trigger - The mark on the field saying a panel opens.
|
|
57
|
+
*
|
|
58
|
+
* @event {Event} change - Announced once the value has moved.
|
|
59
|
+
* @event {HelixBeforeChangeEvent} helix-before-change - Fired before the color changes. Cancelable: refusing it takes the decision and nothing moves.
|
|
60
|
+
* @event {HelixBeforeCloseEvent} helix-before-close - Fired before it closes. Cancelable: refusing it takes the decision and nothing moves.
|
|
61
|
+
* @event {HelixBeforeOpenEvent} helix-before-open - Fired before the panel opens. Cancelable: refusing it takes the decision and nothing moves.
|
|
62
|
+
* @event {Event} input - Announced once the value has moved.
|
|
63
|
+
* @event {Event} toggle - Says the state moved, carrying `newState` and `oldState`.
|
|
64
|
+
*
|
|
65
|
+
* @csspart control - The text input carrying the value. Absent in `swatch`.
|
|
66
|
+
* @csspart feedback - What is wrong with it.
|
|
67
|
+
* @csspart field - The box holding the text and the trigger.
|
|
68
|
+
* @csspart hint - Help under the field, while nothing is wrong.
|
|
69
|
+
* @csspart label - The question, over the field.
|
|
70
|
+
* @csspart picker - The color picker inside it.
|
|
71
|
+
* @csspart picker-actions - The group holding the eyedropper and the syntax toggle.
|
|
72
|
+
* @csspart picker-channel - One ramp.
|
|
73
|
+
* @csspart picker-channel-control - The range input.
|
|
74
|
+
* @csspart picker-channel-feedback - What is wrong with it.
|
|
75
|
+
* @csspart picker-channel-field - The row: the control and its readout.
|
|
76
|
+
* @csspart picker-channel-hint - Help under the track, while nothing is wrong.
|
|
77
|
+
* @csspart picker-channel-label - The question, over the track.
|
|
78
|
+
* @csspart picker-channel-marker - One mark.
|
|
79
|
+
* @csspart picker-channel-marker-label - The value a mark stands at, when `marker-labels` is set.
|
|
80
|
+
* @csspart picker-channel-markers - The row of marks along the track.
|
|
81
|
+
* @csspart picker-channel-output - The current value, shown beside it.
|
|
82
|
+
* @csspart picker-channels - The ramps beside it.
|
|
83
|
+
* @csspart picker-controls - The row under the square.
|
|
84
|
+
* @csspart picker-eyedropper - The control that samples a color from the screen.
|
|
85
|
+
* @csspart picker-eyedropper-button - The inner control.
|
|
86
|
+
* @csspart picker-footer - The row holding the value and the tools.
|
|
87
|
+
* @csspart picker-format - The control that changes the syntax the value is written in.
|
|
88
|
+
* @csspart picker-format-button - The inner control.
|
|
89
|
+
* @csspart picker-grid - The saturation and brightness square.
|
|
90
|
+
* @csspart picker-grid-brightness - The range input for its vertical axis.
|
|
91
|
+
* @csspart picker-grid-handle - The mark showing where in the square the color sits.
|
|
92
|
+
* @csspart picker-grid-saturation - The range input for the square's horizontal axis.
|
|
93
|
+
* @csspart picker-icon - A glyph this component draws.
|
|
94
|
+
* @csspart picker-sample - The chip of the current color, which copies it when pressed.
|
|
95
|
+
* @csspart picker-swatch - One preset.
|
|
96
|
+
* @csspart picker-swatches - The row of presets.
|
|
97
|
+
* @csspart picker-value - The color as text, which can be typed or pasted.
|
|
98
|
+
* @csspart preview - The chip showing the color, inside the trigger.
|
|
99
|
+
* @csspart surface - The floating panel.
|
|
100
|
+
* @csspart trigger - The control that opens the panel.
|
|
101
|
+
*
|
|
102
|
+
* @cssproperty --color-input-swatch - The chosen color, to paint over the transparency check.
|
|
103
|
+
*/
|
|
104
|
+
let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinControllerOpen(MixinControllerValue(MixinField(HelixFormElement))) {
|
|
105
|
+
constructor() {
|
|
106
|
+
super(...arguments);
|
|
107
|
+
/* A consumer's `aria-describedby` names ids in their own tree and the control
|
|
108
|
+
is in this shadow root, so the reference has to be carried down as an
|
|
109
|
+
element rather than copied as an id. See `AriaForwardController`: measured
|
|
110
|
+
in Chrome's own tree, the host held the description and the control the
|
|
111
|
+
reader is actually on was exposed without it. */
|
|
112
|
+
this.aria = new AriaForwardController(this, {
|
|
113
|
+
target: () => this.renderRoot?.querySelector('[part="control"]') ?? null,
|
|
114
|
+
});
|
|
115
|
+
/**
|
|
116
|
+
* What the browser may autofill in the text field, as a platform token.
|
|
117
|
+
*
|
|
118
|
+
* **Defaults to `off`, which is not the platform's default and is the
|
|
119
|
+
* point.** The field filters a list rather than collecting a value, so a
|
|
120
|
+
* browser offering to fill it with a saved address is competing for the same
|
|
121
|
+
* keystrokes as the listbox. A consumer who wants autofill can still ask.
|
|
122
|
+
*/
|
|
123
|
+
this.autocomplete = 'off';
|
|
124
|
+
/**
|
|
125
|
+
* Whether the color carries an alpha channel.
|
|
126
|
+
*/
|
|
127
|
+
this.alpha = false;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the reader may change the format from the panel.
|
|
130
|
+
*/
|
|
131
|
+
this.noFormat = false;
|
|
132
|
+
/**
|
|
133
|
+
* What the field says before a color is in it.
|
|
134
|
+
*/
|
|
135
|
+
this.placeholder = '#000000';
|
|
136
|
+
/**
|
|
137
|
+
* Colors offered under the picker, as a comma-separated list.
|
|
138
|
+
*/
|
|
139
|
+
this.swatches = '';
|
|
140
|
+
/**
|
|
141
|
+
* Accessible name for the control that opens the panel.
|
|
142
|
+
*/
|
|
143
|
+
this.triggerLabel = 'Choose a color';
|
|
144
|
+
/** The overlay, placed against the field for the reason Date Input gives. */
|
|
145
|
+
this.panel = new PopoverController(this, {
|
|
146
|
+
anchor: () => this.renderRoot?.querySelector('[part="field"]'),
|
|
147
|
+
/* The surface *and* the trigger.
|
|
148
|
+
*
|
|
149
|
+
* A control is not always one element: the button that opens this panel is
|
|
150
|
+
* part of it, and a press on it is not a press outside. Scoped to the
|
|
151
|
+
* surface alone, `pointerdown` on the trigger closed the panel and the
|
|
152
|
+
* trigger's own `toggleOpen` reopened it on the `click` that followed, so
|
|
153
|
+
* the panel could never be closed by the button that opened it. Measured
|
|
154
|
+
* across all five popover-bearing components: Menu, Popover and Tooltip
|
|
155
|
+
* already named their invoker; this one and its three siblings did not, and
|
|
156
|
+
* all four stayed open on a second press where Menu closed.
|
|
157
|
+
*
|
|
158
|
+
* `DismissController` documents this exact failure and takes a list for it.
|
|
159
|
+
* The list was the fix; using it was the part that did not happen here. */
|
|
160
|
+
boundary: () => [
|
|
161
|
+
this.renderRoot?.querySelector('[part="surface"]'),
|
|
162
|
+
this.renderRoot?.querySelector('[part="trigger"]'),
|
|
163
|
+
],
|
|
164
|
+
offset: () => 8,
|
|
165
|
+
onDismiss: () => this.requestOpen(false),
|
|
166
|
+
placement: 'bottom-start',
|
|
167
|
+
surface: () => this.renderRoot?.querySelector('[part="surface"]'),
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* The last value that was a color.
|
|
171
|
+
*
|
|
172
|
+
* Half-typed input reaches here on every keystroke and most of it is not a
|
|
173
|
+
* color, so the picker is given the last thing that was one rather than a
|
|
174
|
+
* fallback. Typing `#00ff00` one character at a time goes `#`, `#0`, `#00`,
|
|
175
|
+
* `#00f`, `#00ff`, `#00ff0`, `#00ff00`: measured, the square went red, red,
|
|
176
|
+
* red, blue, blue, **red**, green, because two of those are colors and the
|
|
177
|
+
* ones between are not. Holding the last good one takes the flicker out and
|
|
178
|
+
* leaves the square on blue until green arrives.
|
|
179
|
+
*
|
|
180
|
+
* Not state, because it is only ever read on a render the value already
|
|
181
|
+
* caused. The same reasoning Date Input records for its calendar, which will
|
|
182
|
+
* not follow a date until the field says something complete.
|
|
183
|
+
*/
|
|
184
|
+
this.settled = '';
|
|
185
|
+
/** Relayed under this element's name, so a consumer hears one control. */
|
|
186
|
+
this.handleInput = (event) => {
|
|
187
|
+
event.stopPropagation();
|
|
188
|
+
this.requestValue(event.target.value);
|
|
189
|
+
this.restore();
|
|
190
|
+
};
|
|
191
|
+
this.handlePickerChange = (event) => {
|
|
192
|
+
event.stopPropagation();
|
|
193
|
+
this.requestValue(event.detail.value);
|
|
194
|
+
this.restore();
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* The picker is about to take the pointer over, so the panel gets out of the
|
|
198
|
+
* way and comes back after.
|
|
199
|
+
*
|
|
200
|
+
* `helix-color-picker` says what it is doing rather than reaching for a panel it
|
|
201
|
+
* cannot know it is in. A floating panel left up during an eyedropper is one
|
|
202
|
+
* the reader cannot dismiss and may well be trying to sample from underneath.
|
|
203
|
+
*/
|
|
204
|
+
this.handleSampleStart = () => {
|
|
205
|
+
this.requestOpen(false);
|
|
206
|
+
};
|
|
207
|
+
this.handleSampleEnd = () => {
|
|
208
|
+
this.requestOpen(true);
|
|
209
|
+
};
|
|
210
|
+
/** Escape shuts the panel without moving the color. */
|
|
211
|
+
this.handleKeydown = (event) => {
|
|
212
|
+
if (event.key === 'Escape' && this.open) {
|
|
213
|
+
event.stopPropagation();
|
|
214
|
+
this.requestOpen(false);
|
|
215
|
+
this.control?.focus();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* What the label points at and validity hangs off.
|
|
221
|
+
*
|
|
222
|
+
* The input where there is one, the trigger where there is not. `setValidity`
|
|
223
|
+
* needs an element to anchor the message to and a label needs something
|
|
224
|
+
* focusable to name, and in `swatch` the trigger is the only control in the
|
|
225
|
+
* field. It carries `id="control"` there for the same reason.
|
|
226
|
+
*/
|
|
227
|
+
get anchor() {
|
|
228
|
+
if (typeof this.renderRoot?.querySelector !== 'function') {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return this.control ?? this.renderRoot.querySelector('[part="trigger"]');
|
|
232
|
+
}
|
|
233
|
+
get control() {
|
|
234
|
+
if (typeof this.renderRoot?.querySelector !== 'function') {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
return this.renderRoot.querySelector('[part="control"]');
|
|
238
|
+
}
|
|
239
|
+
/** What the picker should show, which is only ever a color. */
|
|
240
|
+
get picked() {
|
|
241
|
+
return parseColor(this.value) ? this.value : this.settled;
|
|
242
|
+
}
|
|
243
|
+
/** What the trigger's swatch paints, which is only ever a color. */
|
|
244
|
+
get painted() {
|
|
245
|
+
const parsed = parseColor(this.value);
|
|
246
|
+
return parsed ? toCss(parsed) : 'transparent';
|
|
247
|
+
}
|
|
248
|
+
/*
|
|
249
|
+
* Puts the field back where the answer differs from what was typed.
|
|
250
|
+
*
|
|
251
|
+
* `requestValue` announces and decides; this is the other half, which Input
|
|
252
|
+
* and Date Input both need for the same reason: the native control has already
|
|
253
|
+
* changed, so wherever the answer does not follow it, it has to be restored.
|
|
254
|
+
*/
|
|
255
|
+
restore() {
|
|
256
|
+
const control = this.control;
|
|
257
|
+
if (control && control.value !== this.value) {
|
|
258
|
+
control.value = this.value;
|
|
259
|
+
}
|
|
260
|
+
this.sync();
|
|
261
|
+
}
|
|
262
|
+
/** Reports the value and the validity the host stands behind. */
|
|
263
|
+
sync() {
|
|
264
|
+
this.internals.setFormValue(this.value);
|
|
265
|
+
const anchor = this.anchor;
|
|
266
|
+
if (!anchor) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const control = this.control;
|
|
270
|
+
/* Checked here rather than left to the input, which is `text` and has no
|
|
271
|
+
idea what a color is. `type="color"` is what was given up to own the
|
|
272
|
+
panel, and it would not have helped: it has no invalid state, because it
|
|
273
|
+
cannot hold one. */
|
|
274
|
+
if (this.value !== '' && parseColor(this.value) === null) {
|
|
275
|
+
this.internals.setValidity({ badInput: true }, 'Enter a color, like #ff0000, rgb(255 0 0) or hsl(0 100% 50%).', anchor);
|
|
276
|
+
}
|
|
277
|
+
else if (control) {
|
|
278
|
+
this.internals.setValidity(control.validity, control.validationMessage, control);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
/* A swatch has no native validity of its own, so `required` is the only
|
|
282
|
+
thing left to check and this element has to check it: an empty value on
|
|
283
|
+
a required field is the one state a block of color can be wrong in. */
|
|
284
|
+
this.internals.setValidity(this.required && this.value === '' ? { valueMissing: true } : {}, this.required && this.value === '' ? 'Choose a color.' : '', anchor);
|
|
285
|
+
}
|
|
286
|
+
this.refreshFeedback();
|
|
287
|
+
}
|
|
288
|
+
firstUpdated(changed) {
|
|
289
|
+
super.firstUpdated(changed);
|
|
290
|
+
// Whatever the markup arrived with, so a form knows before anything is typed.
|
|
291
|
+
this.sync();
|
|
292
|
+
}
|
|
293
|
+
updated(changed) {
|
|
294
|
+
super.updated(changed);
|
|
295
|
+
/* Every update, not only the ones that name `value`.
|
|
296
|
+
`value` is an accessor over `valueState ?? defaultValue`, so a consumer
|
|
297
|
+
moving `default-value` on an untouched control moves what the form
|
|
298
|
+
submits without ever putting `value` in the changed map, and the reported
|
|
299
|
+
entry went stale. Native `<input>` updates in exactly that case, which is
|
|
300
|
+
the behavior the mixin's own notes take as the reference. Fifteen of the
|
|
301
|
+
twenty controls here already reported unconditionally; this is one of the
|
|
302
|
+
five that did not. */
|
|
303
|
+
this.sync();
|
|
304
|
+
if (changed.has('value') && parseColor(this.value)) {
|
|
305
|
+
this.settled = this.value;
|
|
306
|
+
}
|
|
307
|
+
/* Driven from here rather than from the toggle, because `open` is a property
|
|
308
|
+
a consumer may set directly and the panel has to follow either way. The
|
|
309
|
+
controller is idempotent, so arriving twice for one open costs nothing.
|
|
310
|
+
Without this the surface stays `display: none`, a `popover` element being
|
|
311
|
+
hidden until something shows it, and the square inside measures zero,
|
|
312
|
+
which is the one measurement a drag cannot work without. */
|
|
313
|
+
if (this.open) {
|
|
314
|
+
this.panel.show();
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
this.panel.hide();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/** Puts the caret in the field, the way a label pointing at one would. */
|
|
321
|
+
focus(options) {
|
|
322
|
+
this.anchor?.focus(options);
|
|
323
|
+
}
|
|
324
|
+
/*
|
|
325
|
+
* The picker is told `no-value` because the field above it is that input.
|
|
326
|
+
*
|
|
327
|
+
* Standing on a page, helix-color-picker states its own color as text: a square and
|
|
328
|
+
* two ramps can build one and cannot state one, and a reader who already has a
|
|
329
|
+
* hex should not have to find it by dragging. Here that row would be a second
|
|
330
|
+
* editable field for the same value, which is two places to type with no
|
|
331
|
+
* answer to which one is authoritative or which has the caret.
|
|
332
|
+
*
|
|
333
|
+
* The other way round was considered, this element dropping its own field and
|
|
334
|
+
* letting the panel's be the only one. It is worse for a form: the value could
|
|
335
|
+
* not be read at a glance or pasted without opening a panel.
|
|
336
|
+
*/
|
|
337
|
+
/**
|
|
338
|
+
* The picker the field opens, behind a seam the styled tier can move.
|
|
339
|
+
*
|
|
340
|
+
* A method rather than a fragment inline, so a tier above can render its own,
|
|
341
|
+
* wrap this one, pass it a property the base does not know about, or leave it
|
|
342
|
+
* out, without reimplementing the whole template to do any of them. The tag is
|
|
343
|
+
* interpolated rather than written, so `tier` resolves it: this renders the
|
|
344
|
+
* headless element, and a styled subclass that sets `tier` renders the styled one
|
|
345
|
+
* from the same template.
|
|
346
|
+
*/
|
|
347
|
+
renderPicker() {
|
|
348
|
+
return html `<${this.tag('color-picker')}
|
|
349
|
+
part="picker"
|
|
350
|
+
exportparts="actions: picker-actions, channel: picker-channel, channel-control: picker-channel-control,
|
|
351
|
+
channel-feedback: picker-channel-feedback, channel-field: picker-channel-field,
|
|
352
|
+
channel-hint: picker-channel-hint, channel-label: picker-channel-label,
|
|
353
|
+
channel-marker: picker-channel-marker, channel-marker-label: picker-channel-marker-label,
|
|
354
|
+
channel-markers: picker-channel-markers, channel-output: picker-channel-output,
|
|
355
|
+
channels: picker-channels, controls: picker-controls, eyedropper: picker-eyedropper,
|
|
356
|
+
eyedropper-button: picker-eyedropper-button, footer: picker-footer, format: picker-format,
|
|
357
|
+
format-button: picker-format-button, grid: picker-grid,
|
|
358
|
+
grid-brightness: picker-grid-brightness, grid-handle: picker-grid-handle,
|
|
359
|
+
grid-saturation: picker-grid-saturation, icon: picker-icon, sample: picker-sample,
|
|
360
|
+
swatch: picker-swatch, swatches: picker-swatches, value: picker-value"
|
|
361
|
+
?invalid=${this.resolvedFeedback !== ''}
|
|
362
|
+
?alpha=${this.alpha}
|
|
363
|
+
?no-format=${this.noFormat}
|
|
364
|
+
?no-value=${this.variant !== 'swatch'}
|
|
365
|
+
.format=${this.format ?? 'hex'}
|
|
366
|
+
.value=${this.picked}
|
|
367
|
+
swatches=${this.swatches || nothing}
|
|
368
|
+
?disabled=${this.isDisabled}
|
|
369
|
+
@helix-before-change=${this.handlePickerChange}
|
|
370
|
+
@change=${this.stopInner}
|
|
371
|
+
@input=${this.stopInner}
|
|
372
|
+
@helix-sample-start=${this.handleSampleStart}
|
|
373
|
+
@helix-sample-end=${this.handleSampleEnd}
|
|
374
|
+
></${this.tag('color-picker')}>`;
|
|
375
|
+
}
|
|
376
|
+
render() {
|
|
377
|
+
return html `${this.renderLabel()}
|
|
378
|
+
<div part="field" @keydown=${this.handleKeydown}>
|
|
379
|
+
<!-- The same pair Input carries, in the same places: leading content
|
|
380
|
+
before the text, trailing content after it and before the trigger.
|
|
381
|
+
A label wanting to sit inside the field rather than over it goes
|
|
382
|
+
here, which is what the toggle group's own label-placement does and
|
|
383
|
+
what this had no way to express. Backticks stay out of this
|
|
384
|
+
comment: it is inside a tagged template, so one would end the
|
|
385
|
+
literal and the error lands on a line further down. -->
|
|
386
|
+
<slot name="start"></slot>
|
|
387
|
+
${this.variant === 'swatch'
|
|
388
|
+
? nothing
|
|
389
|
+
: html `<input
|
|
390
|
+
part="control"
|
|
391
|
+
id="control"
|
|
392
|
+
type="text"
|
|
393
|
+
.value=${this.value}
|
|
394
|
+
name=${this.name || nothing}
|
|
395
|
+
placeholder=${this.placeholder || nothing}
|
|
396
|
+
autocomplete=${this.autocomplete || nothing}
|
|
397
|
+
spellcheck="false"
|
|
398
|
+
aria-describedby=${this.describedBy ?? nothing}
|
|
399
|
+
?disabled=${this.isDisabled}
|
|
400
|
+
?required=${this.required}
|
|
401
|
+
@input=${this.handleInput}
|
|
402
|
+
/>`}
|
|
403
|
+
<slot name="end"></slot>
|
|
404
|
+
<button
|
|
405
|
+
part="trigger"
|
|
406
|
+
id=${this.variant === 'swatch' ? 'control' : nothing}
|
|
407
|
+
type="button"
|
|
408
|
+
aria-controls="surface"
|
|
409
|
+
aria-expanded=${this.open ? 'true' : 'false'}
|
|
410
|
+
aria-haspopup="dialog"
|
|
411
|
+
aria-label=${this.triggerLabel}
|
|
412
|
+
?disabled=${this.isDisabled}
|
|
413
|
+
@click=${() => this.toggleOpen()}
|
|
414
|
+
>
|
|
415
|
+
<span
|
|
416
|
+
part="preview"
|
|
417
|
+
style="--color-input-swatch: ${this.value === '' ? 'transparent' : this.painted}"
|
|
418
|
+
></span>
|
|
419
|
+
<slot name="trigger"></slot>
|
|
420
|
+
</button>
|
|
421
|
+
</div>
|
|
422
|
+
|
|
423
|
+
<div part="surface" id="surface" popover="manual" ?hidden=${!this.open}>
|
|
424
|
+
${this.renderPicker()}
|
|
425
|
+
</div>
|
|
426
|
+
${this.renderHint()}${this.renderFeedback()}`;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
__decorate([
|
|
430
|
+
property()
|
|
431
|
+
], HelixHeadlessColorInput.prototype, "autocomplete", void 0);
|
|
432
|
+
__decorate([
|
|
433
|
+
property({ reflect: true })
|
|
434
|
+
], HelixHeadlessColorInput.prototype, "variant", void 0);
|
|
435
|
+
__decorate([
|
|
436
|
+
property({ reflect: true, type: Boolean })
|
|
437
|
+
], HelixHeadlessColorInput.prototype, "alpha", void 0);
|
|
438
|
+
__decorate([
|
|
439
|
+
property({ reflect: true })
|
|
440
|
+
], HelixHeadlessColorInput.prototype, "format", void 0);
|
|
441
|
+
__decorate([
|
|
442
|
+
property({ attribute: 'no-format', type: Boolean })
|
|
443
|
+
], HelixHeadlessColorInput.prototype, "noFormat", void 0);
|
|
444
|
+
__decorate([
|
|
445
|
+
property()
|
|
446
|
+
], HelixHeadlessColorInput.prototype, "placeholder", void 0);
|
|
447
|
+
__decorate([
|
|
448
|
+
property()
|
|
449
|
+
], HelixHeadlessColorInput.prototype, "swatches", void 0);
|
|
450
|
+
__decorate([
|
|
451
|
+
property({ attribute: 'trigger-label' })
|
|
452
|
+
], HelixHeadlessColorInput.prototype, "triggerLabel", void 0);
|
|
453
|
+
HelixHeadlessColorInput = __decorate([
|
|
454
|
+
customElement('helix-headless-color-input')
|
|
455
|
+
], HelixHeadlessColorInput);
|
|
456
|
+
export { HelixHeadlessColorInput };
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
/** A color as the panel holds it. Alpha and the two percentages are 0 to 100. */
|
|
28
|
+
export interface Color {
|
|
29
|
+
alpha: number;
|
|
30
|
+
brightness: number;
|
|
31
|
+
hue: number;
|
|
32
|
+
saturation: number;
|
|
33
|
+
}
|
|
34
|
+
/** The syntaxes a value can be written in. */
|
|
35
|
+
export type ColorFormat = 'hex' | 'hsl' | 'rgb';
|
|
36
|
+
/** HSB to bytes, which is the road every written syntax goes down. */
|
|
37
|
+
export declare const toRgb: (color: Color) => {
|
|
38
|
+
blue: number;
|
|
39
|
+
green: number;
|
|
40
|
+
red: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Splits a comma-separated list of colors, ignoring the commas inside them.
|
|
44
|
+
*
|
|
45
|
+
* A plain `split(',')` is what this was, and it cannot hold the legacy syntaxes:
|
|
46
|
+
* `#ef4444, rgb(249 115 22), rgba(34,197,94,.5)` came apart into six fragments,
|
|
47
|
+
* four of them not colors, and the row quietly rendered three swatches instead
|
|
48
|
+
* of four. The modern space-separated forms survived it, which is what made the
|
|
49
|
+
* list look like it worked.
|
|
50
|
+
*
|
|
51
|
+
* Depth rather than a regular expression, because the thing that matters is
|
|
52
|
+
* whether a comma is inside a function call and that is exactly what a counter
|
|
53
|
+
* answers. No color syntax nests, so a single counter is enough.
|
|
54
|
+
*/
|
|
55
|
+
export declare const splitColors: (value: string) => string[];
|
|
56
|
+
/**
|
|
57
|
+
* Any of the syntaxes to the working model, or `null` where it is not a color.
|
|
58
|
+
*
|
|
59
|
+
* Named colors are not here. Resolving `rebeccapurple` means either shipping
|
|
60
|
+
* the table of a hundred and forty or asking the browser, and the browser is not
|
|
61
|
+
* present on the server: a field that accepted a name client-side and rejected
|
|
62
|
+
* it during a server render would be worse than one that never took it.
|
|
63
|
+
*/
|
|
64
|
+
export declare const parseColor: (value: string) => Color | null;
|
|
65
|
+
/**
|
|
66
|
+
* The working model back out, in the syntax asked for.
|
|
67
|
+
*
|
|
68
|
+
* The alpha is written only where the component carries one. A consumer who did
|
|
69
|
+
* not ask for transparency should not have to strip `ff` off every hex or read
|
|
70
|
+
* past a fourth argument they never wanted.
|
|
71
|
+
*/
|
|
72
|
+
export declare const formatColor: (color: Color, format: ColorFormat, withAlpha: boolean) => string;
|
|
73
|
+
/** The color as CSS, for the swatches and the tracks. Always with its alpha. */
|
|
74
|
+
export declare const toCss: (color: Color) => string;
|