@fusion.dev/helix-headless 0.143.0 → 0.145.0
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/custom-elements.json +16990 -1383
- package/dist/accordion/item/accordion-item.d.ts +48 -12
- package/dist/accordion/item/accordion-item.js +26 -5
- package/dist/accordion/root/accordion-root.d.ts +6 -0
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +21 -1
- package/dist/announcement/root/announcement-root.js +36 -1
- package/dist/app-header/root/app-header-root.d.ts +7 -0
- package/dist/app-header/root/app-header-root.js +5 -1
- package/dist/app-header/sectioning.d.ts +7 -0
- package/dist/app-header/sectioning.js +26 -0
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +24 -7
- package/dist/avatar/root/avatar-root.d.ts +14 -0
- package/dist/avatar/root/avatar-root.js +23 -9
- package/dist/badge/root/badge-root.d.ts +11 -7
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
- package/dist/bar-chart/root/bar-chart-root.js +17 -10
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +32 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +25 -2
- package/dist/button/root/button-root.d.ts +47 -1
- package/dist/button/root/button-root.js +38 -4
- package/dist/callout/root/callout-root.d.ts +18 -1
- package/dist/callout/root/callout-root.js +15 -4
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +121 -40
- package/dist/card/root/card-root.d.ts +30 -1
- package/dist/card/root/card-root.js +38 -5
- package/dist/carousel/root/carousel-root.d.ts +90 -0
- package/dist/carousel/root/carousel-root.js +134 -12
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +25 -9
- package/dist/chat/naming.d.ts +22 -0
- package/dist/chat/naming.js +12 -0
- package/dist/chat/relative-clock.d.ts +39 -0
- package/dist/chat/relative-clock.js +31 -0
- package/dist/chat/root/chat-root.d.ts +36 -0
- package/dist/chat/root/chat-root.js +24 -1
- package/dist/checkbox/root/checkbox-root.js +2 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
- package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
- package/dist/code-block/lines.d.ts +13 -0
- package/dist/code-block/lines.js +2 -0
- package/dist/code-block/root/code-block-root.d.ts +38 -1
- package/dist/code-block/root/code-block-root.js +28 -7
- package/dist/color-input/root/color-input-root.d.ts +34 -1
- package/dist/color-input/root/color-input-root.js +23 -4
- package/dist/color-picker/channels.d.ts +26 -0
- package/dist/color-picker/channels.js +84 -0
- package/dist/color-picker/root/color-picker-root.d.ts +81 -5
- package/dist/color-picker/root/color-picker-root.js +103 -10
- package/dist/combobox/root/combobox-root.d.ts +38 -3
- package/dist/combobox/root/combobox-root.js +64 -2
- package/dist/command/root/command-root.d.ts +30 -4
- package/dist/command/root/command-root.js +33 -3
- package/dist/copy-button/from.d.ts +22 -0
- package/dist/copy-button/from.js +28 -0
- package/dist/copy-button/root/copy-button-root.d.ts +47 -1
- package/dist/copy-button/root/copy-button-root.js +44 -8
- package/dist/data-table/root/data-table-root.d.ts +150 -2
- package/dist/data-table/root/data-table-root.js +303 -29
- package/dist/data-table/tree.d.ts +40 -0
- package/dist/data-table/tree.js +55 -0
- package/dist/date-input/root/date-input-root.d.ts +73 -4
- package/dist/date-input/root/date-input-root.js +93 -43
- package/dist/date-picker/root/date-picker-root.d.ts +145 -1
- package/dist/date-picker/root/date-picker-root.js +239 -48
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +64 -1
- package/dist/dialog/root/dialog-root.js +49 -23
- package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
- package/dist/donut-chart/root/donut-chart-root.js +21 -6
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +95 -19
- package/dist/drawer/swipe-start.d.ts +9 -0
- package/dist/drawer/swipe-start.js +12 -0
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +11 -0
- package/dist/drilldown/root/drilldown-root.js +8 -3
- package/dist/element-events.generated.js +61 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +47 -0
- package/dist/file-input/root/file-input-root.js +60 -22
- package/dist/file-input/screen.d.ts +35 -0
- package/dist/file-input/screen.js +49 -0
- package/dist/filter-input/menu/filter-menu.d.ts +3 -0
- package/dist/filter-input/menu/filter-menu.js +8 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -4
- package/dist/filter-input/root/filter-input-root.js +67 -3
- package/dist/filter-input/suggest.d.ts +17 -0
- package/dist/filter-input/suggest.js +23 -0
- package/dist/format-date/options.d.ts +33 -0
- package/dist/format-date/options.js +42 -0
- package/dist/format-date/root/format-date-root.d.ts +51 -0
- package/dist/format-date/root/format-date-root.js +58 -38
- package/dist/heatmap/root/heatmap-root.d.ts +23 -6
- package/dist/heatmap/root/heatmap-root.js +24 -13
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/icon/registry.d.ts +37 -0
- package/dist/icon/registry.js +83 -0
- package/dist/icon/root/icon-root.d.ts +30 -4
- package/dist/icon/root/icon-root.js +41 -6
- package/dist/icon/root/index.d.ts +2 -0
- package/dist/icon/root/index.js +2 -0
- package/dist/icon/set.d.ts +1 -0
- package/dist/icon/set.js +3 -0
- package/dist/image/root/image-root.d.ts +14 -0
- package/dist/image/root/image-root.js +23 -2
- package/dist/input/root/input-root.d.ts +11 -0
- package/dist/input/root/input-root.js +16 -1
- package/dist/kbd/root/kbd-root.d.ts +20 -13
- package/dist/kbd/root/kbd-root.js +35 -37
- package/dist/kbd/shortcut.d.ts +18 -0
- package/dist/kbd/shortcut.js +35 -0
- package/dist/legend/hidden-series.d.ts +8 -0
- package/dist/legend/hidden-series.js +13 -0
- package/dist/legend/root/legend-root.d.ts +56 -0
- package/dist/legend/root/legend-root.js +54 -5
- package/dist/lightbox/item/lightbox-item.d.ts +15 -0
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +61 -1
- package/dist/lightbox/root/lightbox-root.js +94 -4
- package/dist/line-chart/root/line-chart-root.d.ts +11 -3
- package/dist/line-chart/root/line-chart-root.js +19 -5
- package/dist/list/item/list-item.d.ts +68 -1
- package/dist/list/item/list-item.js +66 -4
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +106 -9
- package/dist/list/root/list-root.js +189 -4
- package/dist/list/selection.d.ts +19 -0
- package/dist/list/selection.js +21 -0
- package/dist/listbox/root/listbox-root.d.ts +74 -3
- package/dist/listbox/root/listbox-root.js +86 -9
- package/dist/loader/busy.d.ts +17 -0
- package/dist/loader/busy.js +24 -0
- package/dist/loader/root/loader-root.d.ts +37 -0
- package/dist/loader/root/loader-root.js +52 -3
- package/dist/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +21 -0
- package/dist/megamenu/root/megamenu-root.js +16 -2
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +38 -11
- package/dist/menu/item/menu-item.js +33 -1
- package/dist/menu/root/menu-root.d.ts +25 -1
- package/dist/menu/root/menu-root.js +63 -6
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +7 -0
- package/dist/meter/root/meter-root.js +6 -3
- package/dist/navigation/root/navigation-root.d.ts +16 -1
- package/dist/navigation/root/navigation-root.js +27 -1
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/notification/notification.d.ts +17 -0
- package/dist/notifications/notification/notification.js +21 -2
- package/dist/notifications/root/notifications-root.d.ts +60 -0
- package/dist/notifications/root/notifications-root.js +76 -1
- package/dist/number-input/root/number-input-root.d.ts +47 -0
- package/dist/number-input/root/number-input-root.js +58 -22
- package/dist/object-inspector/root/object-inspector-root.d.ts +98 -16
- package/dist/object-inspector/root/object-inspector-root.js +180 -80
- package/dist/object-inspector/rows.d.ts +57 -0
- package/dist/object-inspector/rows.js +86 -0
- package/dist/option/root/option-root.d.ts +54 -5
- package/dist/option/root/option-root.js +34 -5
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +68 -3
- package/dist/outline/root/outline-root.js +73 -8
- package/dist/pagination/size/pagination-size.d.ts +11 -2
- package/dist/pagination/size/pagination-size.js +19 -4
- package/dist/pin-input/format.d.ts +7 -0
- package/dist/pin-input/format.js +16 -0
- package/dist/pin-input/root/pin-input-root.d.ts +21 -0
- package/dist/pin-input/root/pin-input-root.js +29 -2
- package/dist/popover/root/popover-root.d.ts +62 -4
- package/dist/popover/root/popover-root.js +53 -5
- package/dist/progress/root/progress-root.d.ts +7 -0
- package/dist/progress/root/progress-root.js +9 -3
- package/dist/qr-code/export.d.ts +31 -0
- package/dist/qr-code/export.js +10 -0
- package/dist/qr-code/root/qr-code-root.d.ts +26 -0
- package/dist/qr-code/root/qr-code-root.js +49 -2
- package/dist/radio/group/radio-group.d.ts +17 -0
- package/dist/radio/group/radio-group.js +14 -1
- package/dist/rating/root/rating-root.d.ts +25 -0
- package/dist/rating/root/rating-root.js +46 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
- package/dist/scroll-area/root/scroll-area-root.d.ts +113 -0
- package/dist/scroll-area/root/scroll-area-root.js +218 -3
- package/dist/scroll-area/scrollbar.d.ts +65 -0
- package/dist/scroll-area/scrollbar.js +24 -0
- package/dist/select/root/select-root.d.ts +24 -0
- package/dist/select/root/select-root.js +21 -7
- package/dist/skeleton/root/skeleton-root.d.ts +25 -0
- package/dist/skeleton/root/skeleton-root.js +17 -2
- package/dist/slider/root/slider-root.d.ts +39 -0
- package/dist/slider/root/slider-root.js +45 -9
- package/dist/splitter/root/splitter-root.d.ts +13 -0
- package/dist/splitter/root/splitter-root.js +20 -2
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +2 -0
- package/dist/stat/root/stat-root.js +1 -1
- package/dist/steps/reach.d.ts +15 -0
- package/dist/steps/reach.js +12 -0
- package/dist/steps/root/steps-root.d.ts +30 -0
- package/dist/steps/root/steps-root.js +53 -0
- package/dist/steps/step/step.d.ts +39 -2
- package/dist/steps/step/step.js +29 -7
- package/dist/switch/root/switch-root.d.ts +12 -2
- package/dist/switch/root/switch-root.js +6 -1
- package/dist/table/column/table-column.d.ts +11 -0
- package/dist/table/column/table-column.js +6 -1
- package/dist/table/root/table-root.d.ts +101 -0
- package/dist/table/root/table-root.js +166 -5
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +9 -5
- package/dist/tabs/panel/tab-panel.js +3 -4
- package/dist/tabs/root/tabs-root.d.ts +25 -1
- package/dist/tabs/root/tabs-root.js +21 -3
- package/dist/tabs/tab/tab.d.ts +36 -4
- package/dist/tabs/tab/tab.js +46 -3
- package/dist/tag/group/tag-group.d.ts +107 -0
- package/dist/tag/group/tag-group.js +157 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +60 -0
- package/dist/tag/root/tag-root.js +74 -18
- package/dist/tag/selection.d.ts +10 -0
- package/dist/tag/selection.js +12 -0
- package/dist/textarea/grow.d.ts +22 -0
- package/dist/textarea/grow.js +20 -0
- package/dist/textarea/root/textarea-root.d.ts +9 -0
- package/dist/textarea/root/textarea-root.js +9 -1
- package/dist/time-input/root/time-input-root.d.ts +44 -5
- package/dist/time-input/root/time-input-root.js +69 -39
- package/dist/time-picker/root/time-picker-root.d.ts +54 -8
- package/dist/time-picker/root/time-picker-root.js +121 -91
- package/dist/timeline/group/timeline-group.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +26 -18
- package/dist/toast/item/toast-item.js +55 -48
- package/dist/toast/root/toast-root.d.ts +42 -8
- package/dist/toast/root/toast-root.js +64 -4
- package/dist/toggle/group/toggle-group.d.ts +57 -15
- package/dist/toggle/group/toggle-group.js +69 -9
- package/dist/toggle/root/toggle-root.d.ts +12 -1
- package/dist/toggle/root/toggle-root.js +11 -3
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/focus-target.d.ts +6 -0
- package/dist/tooltip/focus-target.js +9 -0
- package/dist/tooltip/root/tooltip-root.d.ts +42 -17
- package/dist/tooltip/root/tooltip-root.js +50 -9
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +35 -0
- package/dist/tour/root/tour-root.js +56 -5
- package/dist/tour/stop/tour-stop.d.ts +53 -8
- package/dist/tour/stop/tour-stop.js +45 -15
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +54 -1
- package/dist/tree/item/tree-item.js +89 -20
- package/dist/tree/root/tree-root.d.ts +37 -0
- package/dist/tree/root/tree-root.js +51 -6
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +26 -0
- package/dist/trend/root/trend-root.d.ts +13 -0
- package/dist/trend/root/trend-root.js +14 -9
- package/dist/video/media-events.d.ts +49 -0
- package/dist/video/media-events.js +39 -0
- package/dist/video/root/video-root.d.ts +99 -13
- package/dist/video/root/video-root.js +84 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +3 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +70 -2
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +30 -0
- package/dist/virtual-list/fill.js +39 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +155 -23
- package/dist/virtual-list/root/virtual-list-root.js +175 -34
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +8871 -1286
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +1918 -269
|
@@ -7,8 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { customElement, HelixElement } from '@fusion.dev/helix-core';
|
|
8
8
|
import { nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
10
11
|
import { html } from 'lit/static-html.js';
|
|
11
12
|
import '../../copy-button/index.js';
|
|
13
|
+
import { gutterNumbers, lineCount } from '../lines.js';
|
|
12
14
|
import { pairLines, parsePatch } from '../patch.js';
|
|
13
15
|
let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
14
16
|
constructor() {
|
|
@@ -17,6 +19,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
17
19
|
this.copyLabel = 'Copy code';
|
|
18
20
|
this.diff = false;
|
|
19
21
|
this.label = '';
|
|
22
|
+
this.lineNumbers = false;
|
|
20
23
|
this.noCopy = false;
|
|
21
24
|
this.parsed = { files: [], text: '' };
|
|
22
25
|
}
|
|
@@ -60,30 +63,42 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
60
63
|
if (files.length > 0) {
|
|
61
64
|
return this.renderDiff(files);
|
|
62
65
|
}
|
|
66
|
+
const text = this.text;
|
|
67
|
+
const highlighted = this.highlight && text !== '' ? this.highlight(text) : undefined;
|
|
68
|
+
const code = highlighted === undefined
|
|
69
|
+
? html `<code part="code"><slot @slotchange=${() => this.requestUpdate()}></slot></code>`
|
|
70
|
+
: html `<code part="code">${unsafeHTML(highlighted)}</code><slot
|
|
71
|
+
hidden
|
|
72
|
+
@slotchange=${() => this.requestUpdate()}
|
|
73
|
+
></slot>`;
|
|
74
|
+
const lines = lineCount(text);
|
|
75
|
+
const gutter = this.lineNumbers
|
|
76
|
+
? html `<span part="gutter" aria-hidden="true">${lines === 0 ? nothing : gutterNumbers(lines)}</span>`
|
|
77
|
+
: nothing;
|
|
63
78
|
return html `${this.renderHeader(this.label)}
|
|
64
79
|
<div part="frame">
|
|
65
|
-
<pre part="block"
|
|
80
|
+
<pre part="block">${gutter}${code}</pre>
|
|
66
81
|
${this.label ? nothing : this.renderCopy()}
|
|
67
82
|
</div>`;
|
|
68
83
|
}
|
|
69
84
|
renderHeader(name, value) {
|
|
70
85
|
return name
|
|
71
|
-
? html `<div part="header"><span part="label">${name}</span>${this.renderCopy(value)}</div>`
|
|
86
|
+
? html `<div part="header"><span part="label">${name}</span>${this.renderCopy(value, name)}</div>`
|
|
72
87
|
: nothing;
|
|
73
88
|
}
|
|
74
|
-
renderCopy(value) {
|
|
75
|
-
return this.noCopy ? nothing : this.renderCopyButton(value);
|
|
89
|
+
renderCopy(value, name) {
|
|
90
|
+
return this.noCopy ? nothing : this.renderCopyButton(value, name);
|
|
76
91
|
}
|
|
77
|
-
renderCopyButton(value = this.text) {
|
|
92
|
+
renderCopyButton(value = this.text, name = this.label) {
|
|
78
93
|
return html `<${this.tag('copy-button')}
|
|
79
94
|
part="copy"
|
|
80
|
-
exportparts="button: copy-button, text: copy-text, mark: copy-mark, tooltip: copy-tooltip,
|
|
95
|
+
exportparts="button: copy-button, text: copy-text, mark: copy-mark, live: copy-live, tooltip: copy-tooltip,
|
|
81
96
|
tooltip-arrow: copy-tooltip-arrow, tooltip-arrow-bottom: copy-tooltip-arrow-bottom,
|
|
82
97
|
tooltip-arrow-left: copy-tooltip-arrow-left, tooltip-arrow-right: copy-tooltip-arrow-right,
|
|
83
98
|
tooltip-arrow-top: copy-tooltip-arrow-top, tooltip-bottom: copy-tooltip-bottom,
|
|
84
99
|
tooltip-left: copy-tooltip-left, tooltip-right: copy-tooltip-right, tooltip-top: copy-tooltip-top"
|
|
85
100
|
copied-label=${this.copiedLabel}
|
|
86
|
-
label=${this.copyLabel}
|
|
101
|
+
label=${name ? `${this.copyLabel}, ${name}` : this.copyLabel}
|
|
87
102
|
.value=${value}
|
|
88
103
|
></${this.tag('copy-button')}>`;
|
|
89
104
|
}
|
|
@@ -144,9 +159,15 @@ __decorate([
|
|
|
144
159
|
__decorate([
|
|
145
160
|
property({ reflect: true, type: Boolean })
|
|
146
161
|
], HelixHeadlessCodeBlock.prototype, "diff", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
property({ attribute: false })
|
|
164
|
+
], HelixHeadlessCodeBlock.prototype, "highlight", void 0);
|
|
147
165
|
__decorate([
|
|
148
166
|
property()
|
|
149
167
|
], HelixHeadlessCodeBlock.prototype, "label", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
property({ attribute: 'line-numbers', reflect: true, type: Boolean })
|
|
170
|
+
], HelixHeadlessCodeBlock.prototype, "lineNumbers", void 0);
|
|
150
171
|
__decorate([
|
|
151
172
|
property({ attribute: 'no-copy', reflect: true, type: Boolean })
|
|
152
173
|
], HelixHeadlessCodeBlock.prototype, "noCopy", void 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AriaForwardController, type ColorFormat, HelixFormElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { AriaForwardController, type ColorFormat, type ColorWords, HelixFormElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../color-picker/index.js';
|
|
4
4
|
declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
|
|
@@ -28,6 +28,10 @@ declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fu
|
|
|
28
28
|
* waits until you are done. Dragging in the panel sends `input` as the color
|
|
29
29
|
* moves and `change` when it settles.
|
|
30
30
|
*
|
|
31
|
+
* The trigger and ArrowDown open the panel with focus in the square. Tab moves
|
|
32
|
+
* between the panel's controls without leaving it, and Escape closes it and
|
|
33
|
+
* returns focus to the field.
|
|
34
|
+
*
|
|
31
35
|
* The component sets `--color-input-swatch`, so do not set it yourself. It
|
|
32
36
|
* holds the resolved color, so the styled tier can paint the swatch without
|
|
33
37
|
* parsing the value.
|
|
@@ -72,10 +76,16 @@ declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fu
|
|
|
72
76
|
* @csspart picker-controls - The row under the square.
|
|
73
77
|
* @csspart picker-eyedropper - The control that samples a color from the screen.
|
|
74
78
|
* @csspart picker-eyedropper-button - The button inside `picker-eyedropper`.
|
|
79
|
+
* @csspart picker-eyedropper-live - The live region of the button inside `picker-eyedropper`, which says its pending label.
|
|
75
80
|
* @csspart picker-eyedropper-text - The words on the button inside `picker-eyedropper`.
|
|
81
|
+
* @csspart picker-field - One channel's number field with its label, in `channel-fields`.
|
|
82
|
+
* @csspart picker-field-input - The number input in a channel's field.
|
|
83
|
+
* @csspart picker-field-label - The name above a channel's number input.
|
|
84
|
+
* @csspart picker-fields - The row of channel number fields, in `channel-fields`.
|
|
76
85
|
* @csspart picker-footer - The row holding the value and the tools.
|
|
77
86
|
* @csspart picker-format - The control that changes the syntax the value is written in.
|
|
78
87
|
* @csspart picker-format-button - The button inside `picker-format`.
|
|
88
|
+
* @csspart picker-format-live - The live region of the button inside `picker-format`, which says its pending label.
|
|
79
89
|
* @csspart picker-format-text - The words on the button inside `picker-format`.
|
|
80
90
|
* @csspart picker-grid - The saturation and brightness square.
|
|
81
91
|
* @csspart picker-grid-brightness - The range input for the square's vertical axis.
|
|
@@ -110,6 +120,20 @@ export declare class HelixHeadlessColorInput extends HelixHeadlessColorInput_bas
|
|
|
110
120
|
* consumer who wants autofill can still ask.
|
|
111
121
|
*/
|
|
112
122
|
autocomplete: string;
|
|
123
|
+
/**
|
|
124
|
+
* Whether the panel shows a number field for each channel of the color.
|
|
125
|
+
* Passed to the panel; see Color Picker's `channel-fields`.
|
|
126
|
+
*/
|
|
127
|
+
channelFields: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* The words a color's name is spoken in, as JSON keyed by their English,
|
|
130
|
+
* such as `{"red": "rot", "vibrant": "kräftiges"}`.
|
|
131
|
+
*
|
|
132
|
+
* Passed to the panel, whose square, hue ramp and presets say the color's
|
|
133
|
+
* name, and read by the swatch in `swatch`, which says it before the value.
|
|
134
|
+
* Color Picker lists the keys.
|
|
135
|
+
*/
|
|
136
|
+
colorWords: Partial<ColorWords>;
|
|
113
137
|
/**
|
|
114
138
|
* The syntax the value is written in: `hex`, `rgb`, or `hsl`.
|
|
115
139
|
*
|
|
@@ -196,6 +220,15 @@ export declare class HelixHeadlessColorInput extends HelixHeadlessColorInput_bas
|
|
|
196
220
|
protected get anchor(): HTMLElement | null;
|
|
197
221
|
/** What the picker should show, which is only ever a color. */
|
|
198
222
|
private get picked();
|
|
223
|
+
/**
|
|
224
|
+
* What the swatch says in `swatch`: the color's name and then the value, or
|
|
225
|
+
* the trigger's words where there is no color yet.
|
|
226
|
+
*
|
|
227
|
+
* The name first, because it is what a sighted reader takes from the block of
|
|
228
|
+
* color, and the value after it, because it is what the field holds and what
|
|
229
|
+
* a reader may need to copy.
|
|
230
|
+
*/
|
|
231
|
+
private get swatchWords();
|
|
199
232
|
/** What the trigger's swatch paints, which is only ever a color. */
|
|
200
233
|
private get painted();
|
|
201
234
|
/** Relayed under this element's name, so a consumer hears one control. */
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, customElement, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerField, parseColor, toCss, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, colorName, customElement, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerField, parseColor, toCss, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { html } from 'lit/static-html.js';
|
|
@@ -17,6 +17,8 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
17
17
|
});
|
|
18
18
|
this.alpha = false;
|
|
19
19
|
this.autocomplete = 'off';
|
|
20
|
+
this.channelFields = false;
|
|
21
|
+
this.colorWords = {};
|
|
20
22
|
this.noFormat = false;
|
|
21
23
|
this.placeholder = '#000000';
|
|
22
24
|
this.readOnly = false;
|
|
@@ -70,6 +72,13 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
70
72
|
get picked() {
|
|
71
73
|
return parseColor(this.value) ? this.value : this.settled;
|
|
72
74
|
}
|
|
75
|
+
get swatchWords() {
|
|
76
|
+
const parsed = parseColor(this.value);
|
|
77
|
+
if (!parsed) {
|
|
78
|
+
return this.value || this.triggerLabel;
|
|
79
|
+
}
|
|
80
|
+
return `${colorName(parsed, this.colorWords, this.lang)} ${this.value}`;
|
|
81
|
+
}
|
|
73
82
|
get painted() {
|
|
74
83
|
const parsed = parseColor(this.value);
|
|
75
84
|
return parsed ? toCss(parsed) : 'transparent';
|
|
@@ -107,15 +116,19 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
107
116
|
channel-marker: picker-channel-marker, channel-marker-label: picker-channel-marker-label,
|
|
108
117
|
channel-markers: picker-channel-markers, channel-output: picker-channel-output,
|
|
109
118
|
channels: picker-channels, controls: picker-controls, eyedropper: picker-eyedropper,
|
|
110
|
-
eyedropper-button: picker-eyedropper-button, eyedropper-
|
|
111
|
-
|
|
119
|
+
eyedropper-button: picker-eyedropper-button, eyedropper-live: picker-eyedropper-live, eyedropper-text: picker-eyedropper-text,
|
|
120
|
+
field: picker-field, field-input: picker-field-input, field-label: picker-field-label,
|
|
121
|
+
fields: picker-fields, footer: picker-footer, format: picker-format,
|
|
122
|
+
format-button: picker-format-button, format-live: picker-format-live, format-text: picker-format-text, grid: picker-grid,
|
|
112
123
|
grid-brightness: picker-grid-brightness, grid-handle: picker-grid-handle,
|
|
113
124
|
grid-saturation: picker-grid-saturation, icon: picker-icon, sample: picker-sample,
|
|
114
125
|
swatch: picker-swatch, swatches: picker-swatches, value: picker-value"
|
|
115
126
|
?invalid=${this.resolvedFeedback !== ''}
|
|
116
127
|
?alpha=${this.alpha}
|
|
128
|
+
?channel-fields=${this.channelFields}
|
|
117
129
|
?no-format=${this.noFormat}
|
|
118
130
|
?no-value=${this.variant !== 'swatch'}
|
|
131
|
+
.colorWords=${this.colorWords}
|
|
119
132
|
.format=${this.format ?? 'hex'}
|
|
120
133
|
.value=${this.picked}
|
|
121
134
|
swatches=${this.swatches || nothing}
|
|
@@ -182,7 +195,7 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
182
195
|
></span>
|
|
183
196
|
<slot name="trigger"></slot>
|
|
184
197
|
${this.variant === 'swatch'
|
|
185
|
-
? html `<span id="swatch-value" hidden>${this.
|
|
198
|
+
? html `<span id="swatch-value" hidden>${this.swatchWords}</span>`
|
|
186
199
|
: nothing}
|
|
187
200
|
</button>
|
|
188
201
|
</div>
|
|
@@ -207,6 +220,12 @@ __decorate([
|
|
|
207
220
|
__decorate([
|
|
208
221
|
property()
|
|
209
222
|
], HelixHeadlessColorInput.prototype, "autocomplete", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ attribute: 'channel-fields', type: Boolean })
|
|
225
|
+
], HelixHeadlessColorInput.prototype, "channelFields", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
property({ attribute: 'color-words', type: Object })
|
|
228
|
+
], HelixHeadlessColorInput.prototype, "colorWords", void 0);
|
|
210
229
|
__decorate([
|
|
211
230
|
property({ reflect: true })
|
|
212
231
|
], HelixHeadlessColorInput.prototype, "format", void 0);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Color, type ColorFormat } from '@fusion.dev/helix-core';
|
|
2
|
+
/** One number a color is written with, in the syntax the picker writes. */
|
|
3
|
+
export type ChannelName = 'alpha' | 'blue' | 'green' | 'hue' | 'lightness' | 'red' | 'saturation';
|
|
4
|
+
/** A channel as a field shows it: its number and the range it may take. */
|
|
5
|
+
export interface ChannelField {
|
|
6
|
+
channel: ChannelName;
|
|
7
|
+
max: number;
|
|
8
|
+
min: number;
|
|
9
|
+
value: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The numbers a color is written with in `format`, for a field each, as React
|
|
13
|
+
* Aria's ColorField takes a `channel`: red, green and blue for hex and rgb,
|
|
14
|
+
* hue, saturation and lightness for hsl, and the opacity where the picker
|
|
15
|
+
* carries one.
|
|
16
|
+
*
|
|
17
|
+
* Hex is written as bytes, so its fields are the bytes: a field of two hex
|
|
18
|
+
* digits would ask a reader to count in base sixteen.
|
|
19
|
+
*/
|
|
20
|
+
export declare const channelFields: (value: string, color: Color, format: ColorFormat, alpha: boolean) => ChannelField[];
|
|
21
|
+
/**
|
|
22
|
+
* The value with one channel set, kept inside the channel's range and written
|
|
23
|
+
* in `format` the way the picker writes every value: the comma form, and the
|
|
24
|
+
* opacity only with `alpha`. `null` where the number is no number.
|
|
25
|
+
*/
|
|
26
|
+
export declare const writeChannel: (fields: readonly ChannelField[], format: ColorFormat, alpha: boolean, channel: ChannelName, value: number) => string | null;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { toHsl, toRgb } from '@fusion.dev/helix-core';
|
|
2
|
+
const clamp = (value, low, high) => Math.min(high, Math.max(low, value));
|
|
3
|
+
const percent = (token) => {
|
|
4
|
+
if (token === undefined) {
|
|
5
|
+
return 100;
|
|
6
|
+
}
|
|
7
|
+
const number = Number.parseFloat(token);
|
|
8
|
+
return Number.isNaN(number) ? 100 : clamp(token.includes('%') ? number : number * 100, 0, 100);
|
|
9
|
+
};
|
|
10
|
+
const readWritten = (value, format) => {
|
|
11
|
+
const text = value.trim().toLowerCase();
|
|
12
|
+
if (format !== 'hsl' && /^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/.test(text)) {
|
|
13
|
+
const digits = text.slice(1);
|
|
14
|
+
const width = digits.length <= 4 ? 1 : 2;
|
|
15
|
+
const byte = (index) => {
|
|
16
|
+
const piece = digits.slice(index * width, index * width + width);
|
|
17
|
+
return Number.parseInt(width === 1 ? piece + piece : piece, 16);
|
|
18
|
+
};
|
|
19
|
+
const count = digits.length / width;
|
|
20
|
+
return [byte(0), byte(1), byte(2), count === 4 ? Math.round((byte(3) / 255) * 100) : 100];
|
|
21
|
+
}
|
|
22
|
+
const call = /^(rgba?|hsla?)\(([^)]*)\)$/.exec(text);
|
|
23
|
+
if (!call?.[1] || call[2] === undefined) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
if (call[1].startsWith('hsl') !== (format === 'hsl')) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const [first, second, third, fourth] = call[2].replace(/[,/]/g, ' ').split(/\s+/).filter(Boolean);
|
|
30
|
+
const numbers = [first, second, third].map((one) => Number.parseFloat(one ?? ''));
|
|
31
|
+
if (numbers.some(Number.isNaN)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return [...numbers, percent(fourth)].map((one) => Math.round(one));
|
|
35
|
+
};
|
|
36
|
+
export const channelFields = (value, color, format, alpha) => {
|
|
37
|
+
const written = readWritten(value, format);
|
|
38
|
+
const fromModel = () => {
|
|
39
|
+
if (format === 'hsl') {
|
|
40
|
+
const { hue, lightness, saturation } = toHsl(color);
|
|
41
|
+
return [Math.round(hue), saturation, lightness, Math.round(color.alpha)];
|
|
42
|
+
}
|
|
43
|
+
const { blue, green, red } = toRgb(color);
|
|
44
|
+
return [red, green, blue, Math.round(color.alpha)];
|
|
45
|
+
};
|
|
46
|
+
const [one = 0, two = 0, three = 0, four = 100] = written ?? fromModel();
|
|
47
|
+
const fields = format === 'hsl'
|
|
48
|
+
? [
|
|
49
|
+
{ channel: 'hue', max: 360, min: 0, value: one },
|
|
50
|
+
{ channel: 'saturation', max: 100, min: 0, value: two },
|
|
51
|
+
{ channel: 'lightness', max: 100, min: 0, value: three },
|
|
52
|
+
]
|
|
53
|
+
: [
|
|
54
|
+
{ channel: 'red', max: 255, min: 0, value: one },
|
|
55
|
+
{ channel: 'green', max: 255, min: 0, value: two },
|
|
56
|
+
{ channel: 'blue', max: 255, min: 0, value: three },
|
|
57
|
+
];
|
|
58
|
+
return alpha ? [...fields, { channel: 'alpha', max: 100, min: 0, value: four }] : fields;
|
|
59
|
+
};
|
|
60
|
+
export const writeChannel = (fields, format, alpha, channel, value) => {
|
|
61
|
+
if (Number.isNaN(value)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const numbers = new Map(fields.map((field) => [field.channel, field.value]));
|
|
65
|
+
const field = fields.find((one) => one.channel === channel);
|
|
66
|
+
if (field === undefined) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
numbers.set(channel, clamp(Math.round(value), field.min, field.max));
|
|
70
|
+
const get = (name, fallback = 0) => numbers.get(name) ?? fallback;
|
|
71
|
+
const opacity = get('alpha', 100);
|
|
72
|
+
const fraction = Number((opacity / 100).toFixed(2));
|
|
73
|
+
if (format === 'hsl') {
|
|
74
|
+
const body = `${get('hue')}, ${get('saturation')}%, ${get('lightness')}%`;
|
|
75
|
+
return alpha ? `hsla(${body}, ${fraction})` : `hsl(${body})`;
|
|
76
|
+
}
|
|
77
|
+
if (format === 'rgb') {
|
|
78
|
+
const body = `${get('red')}, ${get('green')}, ${get('blue')}`;
|
|
79
|
+
return alpha ? `rgba(${body}, ${fraction})` : `rgb(${body})`;
|
|
80
|
+
}
|
|
81
|
+
const byte = (one) => one.toString(16).padStart(2, '0');
|
|
82
|
+
const hex = `#${byte(get('red'))}${byte(get('green'))}${byte(get('blue'))}`;
|
|
83
|
+
return alpha ? hex + byte(Math.round((opacity / 100) * 255)) : hex;
|
|
84
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Color, type ColorFormat, HelixFormElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { type Color, type ColorFormat, type ColorWords, HelixFormElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../button/index.js';
|
|
4
4
|
import '../../button-group/index.js';
|
|
@@ -27,6 +27,11 @@ declare const HelixHeadlessColorPicker_base: (new (...args: any[]) => import("@f
|
|
|
27
27
|
* when a drag, a key, a typed value or a preset settles it, as
|
|
28
28
|
* `<input type="color">` does.
|
|
29
29
|
*
|
|
30
|
+
* A screen reader hears the color's name, such as "vibrant red", after the two
|
|
31
|
+
* numbers on the square and after the number on the hue ramp, and each preset
|
|
32
|
+
* is named by its color. Set `color-words` to speak the names in another
|
|
33
|
+
* language.
|
|
34
|
+
*
|
|
30
35
|
* @since 0.1.0
|
|
31
36
|
* @status stable
|
|
32
37
|
* @category forms
|
|
@@ -57,11 +62,17 @@ declare const HelixHeadlessColorPicker_base: (new (...args: any[]) => import("@f
|
|
|
57
62
|
* @csspart controls - The row under the square.
|
|
58
63
|
* @csspart eyedropper - The control that samples a color from the screen.
|
|
59
64
|
* @csspart eyedropper-button - The button inside `eyedropper`.
|
|
60
|
-
* @csspart eyedropper-
|
|
65
|
+
* @csspart eyedropper-live - The live region of the button inside `eyedropper`, which says its pending label.
|
|
66
|
+
* @csspart eyedropper-text - The words on the button inside `eyedropper`, trimmed to their capitals and baseline.
|
|
67
|
+
* @csspart field - One channel's number field with its label, in `channel-fields`.
|
|
68
|
+
* @csspart field-input - The number input in a channel's field.
|
|
69
|
+
* @csspart field-label - The name above a channel's number input.
|
|
70
|
+
* @csspart fields - The row of channel number fields, in `channel-fields`.
|
|
61
71
|
* @csspart footer - The row holding the value and the tools.
|
|
62
72
|
* @csspart format - The control that changes the syntax the value is written in.
|
|
63
73
|
* @csspart format-button - The button inside `format`.
|
|
64
|
-
* @csspart format-
|
|
74
|
+
* @csspart format-live - The live region of the button inside `format`, which says its pending label.
|
|
75
|
+
* @csspart format-text - The words on the button inside `format`, trimmed to their capitals and baseline.
|
|
65
76
|
* @csspart grid - The saturation and brightness square. Draw the mark that shows
|
|
66
77
|
* where the color sits with `::part(grid)::after` in your stylesheet. The
|
|
67
78
|
* square carries the two channels as `--color-picker-saturation` and
|
|
@@ -99,6 +110,10 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
99
110
|
* The message shown when the value is text that is not a color.
|
|
100
111
|
*/
|
|
101
112
|
badInputMessage?: string;
|
|
113
|
+
/**
|
|
114
|
+
* What the blue channel's field is called, in `channel-fields`.
|
|
115
|
+
*/
|
|
116
|
+
blueLabel: string;
|
|
102
117
|
/**
|
|
103
118
|
* What the square's vertical ramp is called.
|
|
104
119
|
*
|
|
@@ -106,6 +121,32 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
106
121
|
* language hears its own rather than English between its own labels.
|
|
107
122
|
*/
|
|
108
123
|
brightnessLabel: string;
|
|
124
|
+
/**
|
|
125
|
+
* Whether the picker shows a number field for each channel of the color, as
|
|
126
|
+
* React Aria's ColorField does with `channel`: red, green and blue for hex
|
|
127
|
+
* and rgb, hue, saturation and lightness for hsl, and the opacity with
|
|
128
|
+
* `alpha`.
|
|
129
|
+
*
|
|
130
|
+
* For a reader who has the numbers from a brand guide, and for a keyboard,
|
|
131
|
+
* where typing 128 is quicker than holding an arrow key. The fields follow
|
|
132
|
+
* the syntax the format toggle sets.
|
|
133
|
+
*/
|
|
134
|
+
channelFields: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* The words a color's name is spoken in, as JSON keyed by their English,
|
|
137
|
+
* such as `{"red": "rot", "vibrant": "kräftiges"}`.
|
|
138
|
+
*
|
|
139
|
+
* **A color is named the way React Aria names one**, as "vibrant red" or
|
|
140
|
+
* "dark grayish blue", and the keys are the ones `@react-stately/color`
|
|
141
|
+
* translates, so a table a page already has for it can be handed over whole.
|
|
142
|
+
* `colorName` and `transparentColorName` are the two sentences that put the
|
|
143
|
+
* words together. A word left out is spoken in English.
|
|
144
|
+
*
|
|
145
|
+
* The name follows the numbers on the square, follows the number on the hue
|
|
146
|
+
* ramp, and names each preset, so a reader who cannot see the color hears
|
|
147
|
+
* which one it is.
|
|
148
|
+
*/
|
|
149
|
+
colorWords: Partial<ColorWords>;
|
|
109
150
|
/**
|
|
110
151
|
* The text the sample shows for a moment after it copies the value.
|
|
111
152
|
*/
|
|
@@ -130,6 +171,10 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
130
171
|
* What the syntax toggle is called, with `{format}` filled in.
|
|
131
172
|
*/
|
|
132
173
|
formatLabel: string;
|
|
174
|
+
/**
|
|
175
|
+
* What the green channel's field is called, in `channel-fields`.
|
|
176
|
+
*/
|
|
177
|
+
greenLabel: string;
|
|
133
178
|
/**
|
|
134
179
|
* What the hue channel is called.
|
|
135
180
|
*/
|
|
@@ -144,6 +189,11 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
144
189
|
* thing the field cannot draw from outside, the mark on the answer itself.
|
|
145
190
|
*/
|
|
146
191
|
invalid: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* What the lightness channel's field is called, in `channel-fields` with
|
|
194
|
+
* hsl.
|
|
195
|
+
*/
|
|
196
|
+
lightnessLabel: string;
|
|
147
197
|
/**
|
|
148
198
|
* Hides the eyedropper. Without it, the eyedropper appears in browsers that
|
|
149
199
|
* support one.
|
|
@@ -204,6 +254,10 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
204
254
|
* letting it open would take a color from the reader and drop it.
|
|
205
255
|
*/
|
|
206
256
|
readOnly: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* What the red channel's field is called, in `channel-fields`.
|
|
259
|
+
*/
|
|
260
|
+
redLabel: string;
|
|
207
261
|
/**
|
|
208
262
|
* Requires a color before the form can submit.
|
|
209
263
|
*
|
|
@@ -407,13 +461,35 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
407
461
|
protected updated(changed: import('lit').PropertyValues): void;
|
|
408
462
|
/** Moves focus to the square. */
|
|
409
463
|
focus(options?: FocusOptions): void;
|
|
464
|
+
/** What each channel's field is called, from the words a page gives. */
|
|
465
|
+
private channelWord;
|
|
466
|
+
/**
|
|
467
|
+
* Takes a number typed into a channel's field. A field emptied or holding
|
|
468
|
+
* something that is not a number moves nothing, so a reader can clear it to
|
|
469
|
+
* type afresh.
|
|
470
|
+
*/
|
|
471
|
+
private readonly handleField;
|
|
472
|
+
/**
|
|
473
|
+
* Takes a value written out whole, as `move` takes a part of the model: the
|
|
474
|
+
* square follows it, keeping its hue where the value is a gray with none to
|
|
475
|
+
* give, and a refusal puts the square back.
|
|
476
|
+
*/
|
|
477
|
+
private takeWritten;
|
|
478
|
+
/**
|
|
479
|
+
* A number field for each channel, behind a seam the styled tier can move.
|
|
480
|
+
*
|
|
481
|
+
* `live` on the value, so a number put back inside its range, 300 for a byte,
|
|
482
|
+
* is redrawn though the value it settles on is the one drawn before.
|
|
483
|
+
*/
|
|
484
|
+
protected renderFields(color: Color): TemplateResult;
|
|
410
485
|
/**
|
|
411
486
|
* One of the ramps under the square.
|
|
412
487
|
*
|
|
413
488
|
* `protected` rather than `private`, the method being the seam a tier above
|
|
414
|
-
* renders its own ramp through.
|
|
489
|
+
* renders its own ramp through. `spoken` is what a screen reader says for the
|
|
490
|
+
* ramp's value, with `{value}` filled in, and empty says the number alone.
|
|
415
491
|
*/
|
|
416
|
-
protected renderChannel(channel: 'alpha' | 'hue', label: string, max: number, value: number): TemplateResult;
|
|
492
|
+
protected renderChannel(channel: 'alpha' | 'hue', label: string, max: number, value: number, spoken?: string): TemplateResult;
|
|
417
493
|
/**
|
|
418
494
|
* A slider's own request, kept inside.
|
|
419
495
|
*
|