@fusion.dev/helix-headless 0.146.0 → 0.148.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 +9287 -1084
- package/dist/accordion/item/accordion-item.d.ts +43 -21
- package/dist/accordion/item/accordion-item.js +37 -11
- package/dist/accordion/root/accordion-root.d.ts +8 -2
- package/dist/accordion/root/accordion-root.js +6 -8
- package/dist/announcement/root/announcement-root.d.ts +66 -6
- package/dist/announcement/root/announcement-root.js +144 -13
- package/dist/area-chart/root/area-chart-root.d.ts +18 -1
- package/dist/area-chart/root/area-chart-root.js +14 -7
- package/dist/avatar/root/avatar-root.d.ts +31 -1
- package/dist/avatar/root/avatar-root.js +11 -1
- package/dist/badge/count.d.ts +14 -0
- package/dist/badge/count.js +20 -0
- package/dist/badge/root/badge-root.d.ts +57 -6
- package/dist/badge/root/badge-root.js +77 -8
- package/dist/bar-chart/root/bar-chart-root.js +11 -20
- package/dist/bar-chart/stack.d.ts +10 -0
- package/dist/bar-chart/stack.js +8 -0
- package/dist/blockquote/root/blockquote-root.d.ts +66 -8
- package/dist/blockquote/root/blockquote-root.js +85 -8
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.js +2 -2
- package/dist/button/root/button-root.d.ts +24 -38
- package/dist/button/root/button-root.js +6 -37
- package/dist/button/submitter.d.ts +27 -0
- package/dist/button/submitter.js +25 -0
- package/dist/button-group/arrows.d.ts +14 -0
- package/dist/button-group/arrows.js +10 -0
- package/dist/button-group/root/button-group-root.d.ts +141 -3
- package/dist/button-group/root/button-group-root.js +142 -2
- package/dist/canvas/edge-pan.d.ts +61 -0
- package/dist/canvas/edge-pan.js +63 -0
- package/dist/canvas/node/canvas-node.d.ts +12 -2
- package/dist/canvas/node/canvas-node.js +6 -2
- package/dist/canvas/root/canvas-document.d.ts +10 -0
- package/dist/canvas/root/canvas-document.js +1 -0
- package/dist/canvas/root/canvas-root.d.ts +107 -5
- package/dist/canvas/root/canvas-root.js +140 -36
- package/dist/canvas/snap.d.ts +42 -0
- package/dist/canvas/snap.js +32 -0
- package/dist/card/root/card-root.d.ts +12 -1
- package/dist/card/root/card-root.js +11 -4
- package/dist/carousel/root/carousel-root.d.ts +4 -3
- package/dist/carousel/root/carousel-root.js +2 -6
- package/dist/chat/root/chat-root.d.ts +28 -4
- package/dist/chat/root/chat-root.js +12 -7
- package/dist/checkbox/root/checkbox-root.js +5 -7
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +13 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +16 -7
- package/dist/checkbox-group/select-all.d.ts +9 -4
- package/dist/checkbox-group/select-all.js +1 -1
- package/dist/code-block/root/code-block-root.d.ts +41 -18
- package/dist/code-block/root/code-block-root.js +21 -6
- package/dist/color-input/root/color-input-root.d.ts +11 -0
- package/dist/color-input/root/color-input-root.js +12 -5
- package/dist/color-picker/channels.js +1 -2
- package/dist/color-picker/root/color-picker-root.d.ts +32 -24
- package/dist/color-picker/root/color-picker-root.js +99 -55
- package/dist/color-picker/wheel.d.ts +28 -0
- package/dist/color-picker/wheel.js +15 -0
- package/dist/combobox/root/combobox-root.d.ts +83 -11
- package/dist/combobox/root/combobox-root.js +81 -18
- package/dist/command/root/command-root.d.ts +7 -4
- package/dist/command/root/command-root.js +2 -19
- package/dist/copy-button/root/copy-button-root.d.ts +16 -1
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/keys.d.ts +0 -18
- package/dist/data-table/keys.js +1 -11
- package/dist/data-table/root/data-table-root.js +29 -50
- package/dist/date-input/root/date-input-root.d.ts +8 -1
- package/dist/date-input/root/date-input-root.js +8 -5
- package/dist/date-picker/root/date-picker-root.d.ts +14 -9
- package/dist/date-picker/root/date-picker-root.js +21 -16
- package/dist/description-list/item/description-list-item.d.ts +22 -4
- package/dist/description-list/item/description-list-item.js +14 -4
- package/dist/divider/root/divider-root.d.ts +45 -16
- package/dist/divider/root/divider-root.js +28 -4
- package/dist/donut-chart/root/donut-chart-root.js +13 -6
- package/dist/donut-chart/slice-label.d.ts +35 -0
- package/dist/donut-chart/slice-label.js +11 -0
- package/dist/drawer/root/drawer-root.d.ts +4 -2
- package/dist/drawer/root/drawer-root.js +15 -3
- package/dist/drilldown/item/drilldown-item.d.ts +21 -1
- package/dist/drilldown/item/drilldown-item.js +38 -4
- package/dist/drilldown/root/drilldown-root.js +3 -2
- package/dist/element-events.generated.js +5 -1
- package/dist/empty/root/empty-root.d.ts +46 -2
- package/dist/empty/root/empty-root.js +50 -5
- package/dist/file-input/root/file-input-root.d.ts +34 -6
- package/dist/file-input/root/file-input-root.js +55 -21
- package/dist/file-input/status.d.ts +24 -0
- package/dist/file-input/status.js +11 -0
- package/dist/filter-input/chip/filter-chip.d.ts +23 -0
- package/dist/filter-input/chip/filter-chip.js +10 -2
- package/dist/filter-input/root/filter-input-root.d.ts +8 -0
- package/dist/filter-input/root/filter-input-root.js +17 -27
- package/dist/format-date/fields.d.ts +20 -0
- package/dist/format-date/fields.js +14 -0
- package/dist/format-date/options.d.ts +5 -5
- package/dist/format-date/options.js +10 -39
- package/dist/format-date/root/format-date-root.d.ts +53 -4
- package/dist/format-date/root/format-date-root.js +38 -50
- package/dist/graph/root/graph-root.d.ts +23 -5
- package/dist/graph/root/graph-root.js +17 -20
- package/dist/heatmap/root/buckets.d.ts +21 -0
- package/dist/heatmap/root/buckets.js +34 -0
- package/dist/heatmap/root/heatmap-root.d.ts +76 -3
- package/dist/heatmap/root/heatmap-root.js +105 -20
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/index.js +1 -1
- package/dist/icon/registry.d.ts +26 -1
- package/dist/icon/registry.js +12 -1
- package/dist/icon/root/icon-root.d.ts +13 -0
- package/dist/icon/root/icon-root.js +23 -2
- package/dist/icon/root/index.d.ts +1 -1
- package/dist/icon/root/index.js +1 -1
- package/dist/image/root/image-root.d.ts +20 -0
- package/dist/image/root/image-root.js +6 -1
- package/dist/input/root/input-root.d.ts +23 -2
- package/dist/input/root/input-root.js +12 -8
- package/dist/kbd/root/kbd-root.d.ts +20 -3
- package/dist/kbd/root/kbd-root.js +23 -50
- package/dist/legend/hidden-series.d.ts +10 -2
- package/dist/legend/hidden-series.js +5 -2
- package/dist/legend/root/legend-root.d.ts +25 -7
- package/dist/legend/root/legend-root.js +25 -26
- package/dist/lightbox/root/lightbox-root.d.ts +50 -5
- package/dist/lightbox/root/lightbox-root.js +76 -8
- package/dist/lightbox/zoom.d.ts +2 -0
- package/dist/lightbox/zoom.js +5 -3
- package/dist/line-chart/root/line-chart-root.d.ts +16 -0
- package/dist/line-chart/root/line-chart-root.js +10 -2
- package/dist/list/root/list-root.d.ts +10 -2
- package/dist/list/root/list-root.js +31 -24
- package/dist/list/selection.d.ts +17 -0
- package/dist/list/selection.js +16 -0
- package/dist/listbox/root/listbox-root.d.ts +125 -26
- package/dist/listbox/root/listbox-root.js +156 -166
- package/dist/map/marker/map-marker.d.ts +2 -1
- package/dist/map/root/map-root.d.ts +40 -2
- package/dist/map/root/map-root.js +64 -23
- package/dist/megamenu/hand-over.d.ts +75 -0
- package/dist/megamenu/hand-over.js +67 -0
- package/dist/megamenu/root/megamenu-root.d.ts +38 -14
- package/dist/megamenu/root/megamenu-root.js +29 -50
- package/dist/menu/item/menu-item.js +4 -4
- package/dist/menu/root/menu-root.d.ts +5 -2
- package/dist/meter/root/meter-root.d.ts +42 -0
- package/dist/meter/root/meter-root.js +33 -7
- package/dist/navigation/root/navigation-root.js +5 -8
- package/dist/notifications/group/notification-group.d.ts +8 -1
- package/dist/notifications/group/notification-group.js +12 -6
- package/dist/notifications/notification/notification.d.ts +12 -1
- package/dist/notifications/notification/notification.js +3 -1
- package/dist/notifications/root/notifications-root.d.ts +48 -3
- package/dist/notifications/root/notifications-root.js +36 -6
- package/dist/number-input/grain.d.ts +28 -0
- package/dist/number-input/grain.js +14 -0
- package/dist/number-input/root/number-input-root.d.ts +17 -1
- package/dist/number-input/root/number-input-root.js +29 -18
- package/dist/object-inspector/root/object-inspector-root.d.ts +17 -6
- package/dist/object-inspector/root/object-inspector-root.js +31 -20
- package/dist/option/index.d.ts +1 -0
- package/dist/option/index.js +1 -0
- package/dist/option/separator/option-separator.d.ts +30 -0
- package/dist/option/separator/option-separator.js +21 -0
- package/dist/outline/root/outline-root.d.ts +12 -0
- package/dist/outline/root/outline-root.js +5 -19
- package/dist/pagination/size/pagination-size.d.ts +6 -0
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pin-input/code.d.ts +51 -1
- package/dist/pin-input/code.js +37 -0
- package/dist/pin-input/root/pin-input-root.d.ts +98 -121
- package/dist/pin-input/root/pin-input-root.js +151 -156
- package/dist/popover/hide-outside.js +2 -9
- package/dist/popover/root/popover-root.d.ts +7 -1
- package/dist/popover/root/popover-root.js +9 -1
- package/dist/progress/root/progress-root.d.ts +27 -0
- package/dist/progress/root/progress-root.js +25 -7
- package/dist/qr-code/export.d.ts +19 -0
- package/dist/qr-code/export.js +14 -0
- package/dist/qr-code/name.d.ts +11 -0
- package/dist/qr-code/name.js +7 -0
- package/dist/qr-code/root/qr-code-root.d.ts +31 -9
- package/dist/qr-code/root/qr-code-root.js +29 -17
- package/dist/radio/group/radio-group.d.ts +15 -0
- package/dist/radio/root/radio-root.js +2 -2
- package/dist/rating/root/rating-root.d.ts +22 -9
- package/dist/rating/root/rating-root.js +15 -39
- package/dist/scatter-chart/measures.d.ts +22 -0
- package/dist/scatter-chart/measures.js +11 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +26 -0
- package/dist/scatter-chart/root/scatter-chart-root.js +21 -7
- package/dist/scroll-area/scrollbar.d.ts +0 -8
- package/dist/scroll-area/scrollbar.js +1 -1
- package/dist/select/align.d.ts +47 -0
- package/dist/select/align.js +7 -0
- package/dist/select/root/select-root.d.ts +115 -11
- package/dist/select/root/select-root.js +104 -20
- package/dist/slider/root/slider-root.d.ts +18 -1
- package/dist/slider/root/slider-root.js +22 -0
- package/dist/sparkline/readings.d.ts +30 -12
- package/dist/sparkline/readings.js +32 -15
- package/dist/sparkline/root/sparkline-root.d.ts +46 -3
- package/dist/sparkline/root/sparkline-root.js +60 -21
- package/dist/speed-dial/group/speed-dial-group.d.ts +48 -0
- package/dist/speed-dial/group/speed-dial-group.js +43 -0
- package/dist/speed-dial/index.d.ts +1 -0
- package/dist/speed-dial/index.js +1 -0
- package/dist/speed-dial/item/speed-dial-item.d.ts +27 -2
- package/dist/speed-dial/item/speed-dial-item.js +43 -5
- package/dist/speed-dial/long-press.d.ts +50 -0
- package/dist/speed-dial/long-press.js +48 -0
- package/dist/speed-dial/root/speed-dial-root.d.ts +86 -1
- package/dist/speed-dial/root/speed-dial-root.js +123 -6
- package/dist/splitter/root/splitter-root.d.ts +9 -2
- package/dist/splitter/root/splitter-root.js +18 -3
- package/dist/steps/root/steps-root.d.ts +8 -1
- package/dist/steps/root/steps-root.js +6 -1
- package/dist/steps/step/step.d.ts +1 -0
- package/dist/steps/step/step.js +1 -1
- package/dist/table/cell/table-cell.d.ts +8 -1
- package/dist/table/cell/table-cell.js +6 -2
- package/dist/table/column/table-column.d.ts +6 -0
- package/dist/table/column/table-column.js +5 -1
- package/dist/table/grid-controller.d.ts +117 -0
- package/dist/table/grid-controller.js +293 -0
- package/dist/table/root/table-root.d.ts +47 -3
- package/dist/table/root/table-root.js +93 -29
- package/dist/table/row/table-row.d.ts +36 -0
- package/dist/table/row/table-row.js +52 -2
- package/dist/tabs/root/tabs-root.d.ts +5 -3
- package/dist/tag/group/tag-group.d.ts +16 -4
- package/dist/tag/group/tag-group.js +23 -20
- package/dist/textarea/root/textarea-root.d.ts +14 -2
- package/dist/textarea/root/textarea-root.js +6 -7
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +10 -7
- package/dist/time-picker/root/time-picker-root.d.ts +12 -14
- package/dist/time-picker/root/time-picker-root.js +18 -23
- package/dist/toast/item/toast-item.d.ts +9 -6
- package/dist/toast/item/toast-item.js +1 -1
- package/dist/toast/root/toast-root.d.ts +40 -4
- package/dist/toast/root/toast-root.js +68 -16
- package/dist/toast/words.d.ts +12 -0
- package/dist/toast/words.js +25 -0
- package/dist/toggle/group/toggle-group.d.ts +29 -5
- package/dist/toggle/group/toggle-group.js +26 -43
- package/dist/toggle/root/toggle-root.js +2 -4
- package/dist/toolbar/root/toolbar-root.d.ts +52 -5
- package/dist/toolbar/root/toolbar-root.js +88 -13
- package/dist/tooltip/root/tooltip-root.d.ts +7 -1
- package/dist/tooltip/root/tooltip-root.js +10 -2
- package/dist/tour/root/tour-root.d.ts +15 -0
- package/dist/tour/root/tour-root.js +20 -1
- package/dist/tour/stop/tour-stop.d.ts +3 -0
- package/dist/tour/stop/tour-stop.js +3 -3
- package/dist/tree/root/tree-root.js +2 -2
- package/dist/trend/figure.d.ts +16 -0
- package/dist/trend/figure.js +8 -0
- package/dist/trend/root/trend-root.d.ts +41 -2
- package/dist/trend/root/trend-root.js +29 -3
- package/dist/video/root/extra-controls.d.ts +12 -0
- package/dist/video/root/extra-controls.js +6 -2
- package/dist/video/root/video-root.d.ts +16 -1
- package/dist/video/root/video-root.js +15 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +11 -1
- package/dist/video-playlist/root/video-playlist-root.js +3 -0
- package/dist/virtual-list/fill.d.ts +11 -0
- package/dist/virtual-list/fill.js +9 -0
- package/dist/virtual-list/keys.d.ts +16 -7
- package/dist/virtual-list/keys.js +17 -6
- package/dist/virtual-list/plan.d.ts +17 -1
- package/dist/virtual-list/plan.js +13 -2
- package/dist/virtual-list/root/virtual-list-root.d.ts +25 -3
- package/dist/virtual-list/root/virtual-list-root.js +53 -41
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +4934 -954
- package/types/svelte.d.ts +2 -0
- package/types/vue.d.ts +946 -253
- package/dist/color-picker/swatches.d.ts +0 -12
- package/dist/color-picker/swatches.js +0 -26
- package/dist/rating/steps.d.ts +0 -7
- package/dist/rating/steps.js +0 -9
- package/dist/tooltip/focus-target.d.ts +0 -6
- package/dist/tooltip/focus-target.js +0 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HelixElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { ChildrenController, HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import { type HelixHeadlessChatMessage } from '../message/chat-message.js';
|
|
4
4
|
/** One turn handed over as data, which is what `turns` holds. */
|
|
@@ -67,7 +67,11 @@ declare const HelixHeadlessChat_base: (new (...args: any[]) => import("@fusion.d
|
|
|
67
67
|
* the forwarded `message-*` parts. A turn by `me` also gets each part with
|
|
68
68
|
* `-mine` added, and the turn's state adds `message-meta-failed`,
|
|
69
69
|
* `message-content-sending`, and `message-content-streaming`. To style each
|
|
70
|
-
* participant differently,
|
|
70
|
+
* participant differently, give `author-styles` the declarations for each
|
|
71
|
+
* author, such as `{"ada": "--chat-message-background-color: …"}`: the message
|
|
72
|
+
* drawn for each of their turns takes them as its `style`, so the message's
|
|
73
|
+
* custom properties change for that author alone. Turns passed as children are
|
|
74
|
+
* styled by their `author`, such as `helix-chat-message[author="ada"]`.
|
|
71
75
|
*
|
|
72
76
|
* @since 0.1.0
|
|
73
77
|
* @status stable
|
|
@@ -136,6 +140,16 @@ export declare class HelixHeadlessChat extends HelixHeadlessChat_base {
|
|
|
136
140
|
static shadowRootOptions: ShadowRootInit;
|
|
137
141
|
/** How tall a turn is assumed to be before it has been drawn, in pixels. */
|
|
138
142
|
static readonly ESTIMATE = 72;
|
|
143
|
+
/**
|
|
144
|
+
* Declarations for the turns from `turns` by each author, keyed by `author`,
|
|
145
|
+
* as JSON in the attribute: `{"ada": "--chat-message-background-color: …"}`.
|
|
146
|
+
*
|
|
147
|
+
* The message drawn for each turn by that author takes them as its `style`,
|
|
148
|
+
* so the custom properties a message reads, its fill, text color, radius and
|
|
149
|
+
* padding, change for that author alone. A turn by an author with no entry
|
|
150
|
+
* takes none, and looks as it did. JSON that does not parse is no entries.
|
|
151
|
+
*/
|
|
152
|
+
authorStyles: Record<string, string>;
|
|
139
153
|
/**
|
|
140
154
|
* Whether the transcript opens pinned to the bottom, when `pinned` is not
|
|
141
155
|
* set.
|
|
@@ -239,8 +253,18 @@ export declare class HelixHeadlessChat extends HelixHeadlessChat_base {
|
|
|
239
253
|
* a turn is told again only when they change.
|
|
240
254
|
*/
|
|
241
255
|
private words;
|
|
242
|
-
/**
|
|
243
|
-
|
|
256
|
+
/**
|
|
257
|
+
* Watches for turns arriving, since a manual slot hears nothing about them.
|
|
258
|
+
*
|
|
259
|
+
* **A turn that arrives after first paint reaches nothing on its own.**
|
|
260
|
+
* Slots are assigned by hand here, so appending a child assigns it to
|
|
261
|
+
* nothing, fires no `slotchange`, and schedules no render: the transcript
|
|
262
|
+
* went on showing "Nothing to show" over six children it already had, and
|
|
263
|
+
* the one thing a conversation does is grow. Measured with
|
|
264
|
+
* `assignedElements()` at zero against `children` at nine. Children only,
|
|
265
|
+
* never a turn's own text, which a streaming turn rewrites every frame.
|
|
266
|
+
*/
|
|
267
|
+
protected readonly childWatch: ChildrenController;
|
|
244
268
|
/** Watches the turns' own `state`, which is when one of them settles. */
|
|
245
269
|
private settling;
|
|
246
270
|
/** Watches the turns and the log for size, which scrolling does not report. */
|
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var HelixHeadlessChat_1;
|
|
8
|
-
import { customElement, fillTemplate, HelixBeforePinEvent, HelixElement, HelixHistoryEvent, HelixPinEvent, hostAria, MixinCollection, onUnlessFalse, requestChange, VirtualizeController, whenHydrated, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { ChildrenController, customElement, fillTemplate, HelixBeforePinEvent, HelixElement, HelixHistoryEvent, HelixPinEvent, hostAria, MixinCollection, onUnlessFalse, requestChange, VirtualizeController, whenHydrated, wordsConverter, } from '@fusion.dev/helix-core';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
11
11
|
import { keyed } from 'lit/directives/keyed.js';
|
|
@@ -24,7 +24,11 @@ const SECOND_NAMES = {
|
|
|
24
24
|
streaming: 'content: message-content-streaming',
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
|
-
const
|
|
27
|
+
const ownEntry = (table, key) => (key !== undefined && Object.hasOwn(table, key) ? table[key] : undefined);
|
|
28
|
+
const secondNames = (table, key) => {
|
|
29
|
+
const names = ownEntry(table, key);
|
|
30
|
+
return names === undefined ? '' : `, ${names}`;
|
|
31
|
+
};
|
|
28
32
|
const settled = (turn) => turn.state !== 'sending' && turn.state !== 'streaming';
|
|
29
33
|
const newsworthy = (turn) => turn.author !== 'me' || turn.state === 'failed';
|
|
30
34
|
const spoken = (message) => [...message.childNodes]
|
|
@@ -36,6 +40,7 @@ const spoken = (message) => [...message.childNodes]
|
|
|
36
40
|
let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixElement) {
|
|
37
41
|
constructor() {
|
|
38
42
|
super(...arguments);
|
|
43
|
+
this.authorStyles = {};
|
|
39
44
|
this.defaultPinned = true;
|
|
40
45
|
this.history = '';
|
|
41
46
|
this.historyText = 'Loading earlier messages';
|
|
@@ -51,7 +56,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
51
56
|
this.announcement = '';
|
|
52
57
|
this.said = 0;
|
|
53
58
|
this.words = TURN_WORDS;
|
|
54
|
-
this.
|
|
59
|
+
this.childWatch = new ChildrenController(this, () => this.handleSlotChange());
|
|
55
60
|
this.settling = undefined;
|
|
56
61
|
this.grower = undefined;
|
|
57
62
|
this.watched = [];
|
|
@@ -344,8 +349,6 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
344
349
|
}
|
|
345
350
|
connectedCallback() {
|
|
346
351
|
super.connectedCallback();
|
|
347
|
-
this.watcher = new MutationObserver(this.handleSlotChange);
|
|
348
|
-
this.watcher.observe(this, { childList: true });
|
|
349
352
|
this.settling = new MutationObserver(this.handleSettle);
|
|
350
353
|
this.settling.observe(this, { attributeFilter: ['state'], subtree: true });
|
|
351
354
|
this.opening = true;
|
|
@@ -358,8 +361,6 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
358
361
|
}
|
|
359
362
|
disconnectedCallback() {
|
|
360
363
|
super.disconnectedCallback();
|
|
361
|
-
this.watcher?.disconnect();
|
|
362
|
-
this.watcher = undefined;
|
|
363
364
|
this.settling?.disconnect();
|
|
364
365
|
this.settling = undefined;
|
|
365
366
|
this.grower?.disconnect();
|
|
@@ -434,6 +435,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
434
435
|
author=${turn.author ?? nothing}
|
|
435
436
|
author-label=${turn.authorLabel ?? nothing}
|
|
436
437
|
at=${turn.at ?? nothing}
|
|
438
|
+
style=${ownEntry(this.authorStyles, turn.author) ?? nothing}
|
|
437
439
|
.turnWords=${this.words}
|
|
438
440
|
state=${turn.state ?? nothing}
|
|
439
441
|
>${turn.text}</${message}>
|
|
@@ -482,6 +484,9 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
482
484
|
</div>`;
|
|
483
485
|
}
|
|
484
486
|
};
|
|
487
|
+
__decorate([
|
|
488
|
+
property({ attribute: 'author-styles', converter: wordsConverter })
|
|
489
|
+
], HelixHeadlessChat.prototype, "authorStyles", void 0);
|
|
485
490
|
__decorate([
|
|
486
491
|
property({ attribute: 'default-pinned', converter: onUnlessFalse })
|
|
487
492
|
], HelixHeadlessChat.prototype, "defaultPinned", void 0);
|
|
@@ -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, HostClickController, MixinControllerChecked, MixinField, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, customElement, HelixFormElement, HostClickController, MixinControllerChecked, MixinField, slotFilled, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessCheckbox = class HelixHeadlessCheckbox extends MixinControllerChecked(MixinField(HelixFormElement)) {
|
|
@@ -34,7 +34,7 @@ let HelixHeadlessCheckbox = class HelixHeadlessCheckbox extends MixinControllerC
|
|
|
34
34
|
};
|
|
35
35
|
this.handleMarkChange = (event) => {
|
|
36
36
|
const slot = event.target;
|
|
37
|
-
const filled = slot
|
|
37
|
+
const filled = slotFilled(slot);
|
|
38
38
|
if (slot.name === 'dash') {
|
|
39
39
|
this.toggleState('has-dash', filled);
|
|
40
40
|
}
|
|
@@ -74,11 +74,9 @@ let HelixHeadlessCheckbox = class HelixHeadlessCheckbox extends MixinControllerC
|
|
|
74
74
|
}
|
|
75
75
|
syncLabelPresence() {
|
|
76
76
|
const slot = this.renderRoot.querySelector('[part="label"] slot');
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const hidden = this.label === '' &&
|
|
80
|
-
Boolean(this.getAttribute('aria-label')) &&
|
|
81
|
-
!(slot?.assignedNodes() ?? []).some(meaningful);
|
|
77
|
+
const filled = slotFilled(slot);
|
|
78
|
+
const written = (slot?.assignedNodes() ?? []).some((node) => node.nodeType === Node.ELEMENT_NODE || node.textContent?.trim() !== '');
|
|
79
|
+
const hidden = this.label === '' && Boolean(this.getAttribute('aria-label')) && !written;
|
|
82
80
|
this.partNamed('label')?.toggleAttribute('data-hidden', hidden);
|
|
83
81
|
this.toggleState('has-label', filled && !hidden);
|
|
84
82
|
this.partNamed('label')?.toggleAttribute('hidden', !filled);
|
|
@@ -96,8 +96,21 @@ export declare class HelixHeadlessCheckboxGroup extends HelixHeadlessCheckboxGro
|
|
|
96
96
|
*/
|
|
97
97
|
get values(): string[];
|
|
98
98
|
set values(next: string[]);
|
|
99
|
+
/**
|
|
100
|
+
* Writes the set the boxes are given at the next update: by value, or, for
|
|
101
|
+
* a set a press decided, by box.
|
|
102
|
+
*/
|
|
103
|
+
private choose;
|
|
99
104
|
/** The values last written, which the boxes are given at the next update. */
|
|
100
105
|
private declared;
|
|
106
|
+
/**
|
|
107
|
+
* The boxes to check at the next update, where a press on a box or on the
|
|
108
|
+
* select-all box decided the set.
|
|
109
|
+
*
|
|
110
|
+
* **By box, since boxes can share a value.** Boxes written with no `value`
|
|
111
|
+
* all submit `on`, and pushed by value, a press on one checked every one.
|
|
112
|
+
*/
|
|
113
|
+
private checking;
|
|
101
114
|
/**
|
|
102
115
|
* Whether `declared` has yet to reach the boxes.
|
|
103
116
|
*
|
|
@@ -18,6 +18,7 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
18
18
|
this.selectAll = false;
|
|
19
19
|
this.selectAllLabel = 'Select all';
|
|
20
20
|
this.declared = [];
|
|
21
|
+
this.checking = undefined;
|
|
21
22
|
this.pending = false;
|
|
22
23
|
this.watched = new Set();
|
|
23
24
|
this.member = {
|
|
@@ -41,14 +42,13 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
const wanted = event.detail.checked;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
.map((box) => box.value);
|
|
45
|
+
const checking = this.boxes.filter((box) => (box === changed ? wanted : box.checked));
|
|
46
|
+
const next = checking.map((box) => box.value);
|
|
47
47
|
if (!this.dispatchEvent(new HelixBeforeChangeEvent({ value: next.join(',') }))) {
|
|
48
48
|
event.preventDefault();
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
this.
|
|
51
|
+
this.choose(next, checking);
|
|
52
52
|
this.announceInput();
|
|
53
53
|
this.announceChange();
|
|
54
54
|
};
|
|
@@ -60,11 +60,14 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
60
60
|
this.handleSelectAll = (event) => {
|
|
61
61
|
event.preventDefault();
|
|
62
62
|
event.stopPropagation();
|
|
63
|
-
const
|
|
63
|
+
const boxes = this.boxes;
|
|
64
|
+
const pressed = selectAllPress(this.setBoxes());
|
|
65
|
+
const checking = boxes.filter((_, at) => pressed[at]);
|
|
66
|
+
const next = checking.map((box) => box.value);
|
|
64
67
|
if (!this.dispatchEvent(new HelixBeforeChangeEvent({ value: next.join(',') }))) {
|
|
65
68
|
return;
|
|
66
69
|
}
|
|
67
|
-
this.
|
|
70
|
+
this.choose(next, checking);
|
|
68
71
|
this.announceInput();
|
|
69
72
|
this.announceChange();
|
|
70
73
|
};
|
|
@@ -85,8 +88,12 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
85
88
|
: boxes.filter((box) => box.checked).map((box) => box.value);
|
|
86
89
|
}
|
|
87
90
|
set values(next) {
|
|
91
|
+
this.choose(next);
|
|
92
|
+
}
|
|
93
|
+
choose(next, boxes) {
|
|
88
94
|
const previous = this.value;
|
|
89
95
|
this.declared = [...next];
|
|
96
|
+
this.checking = boxes ? new Set(boxes) : undefined;
|
|
90
97
|
this.pending = true;
|
|
91
98
|
this.requestUpdate('value', previous);
|
|
92
99
|
}
|
|
@@ -124,8 +131,10 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
124
131
|
}
|
|
125
132
|
this.pending = false;
|
|
126
133
|
const wanted = new Set(this.declared);
|
|
134
|
+
const checking = this.checking;
|
|
135
|
+
this.checking = undefined;
|
|
127
136
|
for (const box of boxes) {
|
|
128
|
-
box.checked = wanted.has(box.value);
|
|
137
|
+
box.checked = checking ? checking.has(box) : wanted.has(box.value);
|
|
129
138
|
}
|
|
130
139
|
}
|
|
131
140
|
connectedCallback() {
|
|
@@ -20,8 +20,13 @@ export declare const selectAllState: (boxes: readonly SetBox[]) => {
|
|
|
20
20
|
indeterminate: boolean;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
* enabled box checked, or every
|
|
25
|
-
*
|
|
23
|
+
* What a press on the select-all box does to each box, in the set's order:
|
|
24
|
+
* every enabled box checked, or every one cleared once all of them are, with a
|
|
25
|
+
* disabled box keeping its state. A set with no enabled box stays as it is.
|
|
26
|
+
*
|
|
27
|
+
* **By box and not by value**, so boxes that share a value, such as boxes
|
|
28
|
+
* written with none, which all submit `on`, are each moved on their own: by
|
|
29
|
+
* value, one checked box made every box with its value count as checked, and
|
|
30
|
+
* the press cleared the set where it should have filled it.
|
|
26
31
|
*/
|
|
27
|
-
export declare const selectAllPress: (boxes: readonly SetBox[]) =>
|
|
32
|
+
export declare const selectAllPress: (boxes: readonly SetBox[]) => boolean[];
|
|
@@ -8,5 +8,5 @@ export const selectAllState = (boxes) => {
|
|
|
8
8
|
export const selectAllPress = (boxes) => {
|
|
9
9
|
const enabled = boxes.filter((box) => !box.disabled);
|
|
10
10
|
const every = enabled.length > 0 && enabled.every((box) => box.checked);
|
|
11
|
-
return boxes.
|
|
11
|
+
return boxes.map((box) => (box.disabled ? box.checked : !every));
|
|
12
12
|
};
|
|
@@ -17,14 +17,17 @@ import '../../copy-button/index.js';
|
|
|
17
17
|
* Set `line-numbers` to number the lines in a gutter beside the code, hidden
|
|
18
18
|
* from the accessibility tree and left out of a copy. Set `highlight` to a
|
|
19
19
|
* function that turns the code into highlighted markup, such as one wrapping
|
|
20
|
-
* Shiki or Prism, and the block draws what it returns;
|
|
21
|
-
*
|
|
20
|
+
* Shiki or Prism, and the block draws what it returns; it is handed the
|
|
21
|
+
* block's `language`, so one function serves every block. The code stays in
|
|
22
|
+
* the slot, so the copy button and the page's own text are the code as
|
|
23
|
+
* written.
|
|
22
24
|
*
|
|
23
25
|
* Set `expandable` on a block whose height is capped, such as by
|
|
24
26
|
* `--code-block-max-block-size`, and a button under it shows every line and
|
|
25
27
|
* then fewer again, as a docs site's long example does. The button is drawn
|
|
26
|
-
* only while the cap hides something, says whether the block is expanded
|
|
27
|
-
* the block
|
|
28
|
+
* only while the cap hides something, says whether the block is expanded with
|
|
29
|
+
* `aria-expanded`, names the block it opens with `aria-controls`, and the block
|
|
30
|
+
* carries `:state(expanded)` while it is.
|
|
28
31
|
*
|
|
29
32
|
* Set `diff` to show a change. Put a unified diff, the output of `git diff` or
|
|
30
33
|
* `diff -u`, in the same slot, and the block draws the lines it added and
|
|
@@ -56,6 +59,7 @@ import '../../copy-button/index.js';
|
|
|
56
59
|
* @csspart copy-button - The inner button.
|
|
57
60
|
* @csspart copy-live - The copy button's live region, which speaks while the button is pending.
|
|
58
61
|
* @csspart copy-mark - The clipboard icon, and the check mark that replaces it after a copy.
|
|
62
|
+
* @csspart copy-spinner - The ring the copy button turns while it is pending.
|
|
59
63
|
* @csspart copy-text - The words on that button, trimmed to their capitals and baseline.
|
|
60
64
|
* @csspart copy-tooltip - The copy button's tooltip.
|
|
61
65
|
* @csspart copy-tooltip-arrow - The tooltip's arrow, which points at the copy button.
|
|
@@ -74,7 +78,7 @@ import '../../copy-button/index.js';
|
|
|
74
78
|
* @csspart gutter - The line numbers beside the code, shown when `line-numbers` is set.
|
|
75
79
|
* @csspart header - The bar that holds the name and the copy button, shown when there is a name.
|
|
76
80
|
* @csspart hunk - In a diff, a `@@` line saying where the lines under it are.
|
|
77
|
-
* @csspart label - The
|
|
81
|
+
* @csspart label - The block's name: its `label`, or its `language` where it has no label.
|
|
78
82
|
* @csspart marker - In a diff, the `+`, `-`, or space that starts a line.
|
|
79
83
|
* @csspart new - In a split diff, the new version's `<pre>`.
|
|
80
84
|
* @csspart number - In a diff, a line number.
|
|
@@ -126,24 +130,43 @@ export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
126
130
|
* Turns the code into highlighted markup, which the block draws in place of
|
|
127
131
|
* the plain text.
|
|
128
132
|
*
|
|
129
|
-
* Called with the code as written and
|
|
130
|
-
* Shiki's `codeToHtml` or Prism's `highlight`.
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
133
|
+
* Called with the code as written and the block's `language`, and returning
|
|
134
|
+
* HTML, such as the output of Shiki's `codeToHtml` or Prism's `highlight`.
|
|
135
|
+
* One function serves every block on a page, each block saying its own
|
|
136
|
+
* language:
|
|
137
|
+
*
|
|
138
|
+
* ```js
|
|
139
|
+
* for (const block of document.querySelectorAll('helix-code-block')) {
|
|
140
|
+
* block.highlight = (code, lang) => codeToHtml(code, { lang, theme: 'github-light' })
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* **The markup is drawn as given**, so it has to escape the code it was
|
|
145
|
+
* handed, which those highlighters do. A `<pre>` and `<code>` around the
|
|
146
|
+
* whole of it, which Shiki writes, are taken off, so the lines sit level
|
|
147
|
+
* with the gutter's numbers and the block keeps one tab stop. The code stays
|
|
148
|
+
* in the slot, so the copy button copies it as written and a reader without
|
|
149
|
+
* the script still has it. Not called on a server, which has no code to
|
|
150
|
+
* read, nor for a diff.
|
|
138
151
|
*/
|
|
139
|
-
highlight?: (code: string) => string;
|
|
152
|
+
highlight?: (code: string, language: string) => string;
|
|
140
153
|
/**
|
|
141
|
-
* The block's name, usually a file name
|
|
154
|
+
* The block's name, usually a file name, drawn in the header.
|
|
142
155
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
156
|
+
* Absent, the block is named by `language` where there is one. In a diff,
|
|
157
|
+
* each file is named from the patch, and this names a patch that carries no
|
|
158
|
+
* name of its own.
|
|
145
159
|
*/
|
|
146
160
|
label: string;
|
|
161
|
+
/**
|
|
162
|
+
* The language the code is written in, such as `ts` or `css`, handed to
|
|
163
|
+
* `highlight` as its second argument.
|
|
164
|
+
*
|
|
165
|
+
* A block with no `label` is named by it, in the header and on the copy
|
|
166
|
+
* button, as a docs site names a snippet by its language. Absent hands
|
|
167
|
+
* `highlight` an empty string and names nothing.
|
|
168
|
+
*/
|
|
169
|
+
language: string;
|
|
147
170
|
/**
|
|
148
171
|
* Whether the lines are numbered in a gutter beside the code.
|
|
149
172
|
*
|
|
@@ -23,6 +23,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
23
23
|
this.expandable = false;
|
|
24
24
|
this.expandLabel = 'Show all lines';
|
|
25
25
|
this.label = '';
|
|
26
|
+
this.language = '';
|
|
26
27
|
this.lineNumbers = false;
|
|
27
28
|
this.noCopy = false;
|
|
28
29
|
this.parsed = { files: [], text: '' };
|
|
@@ -88,7 +89,16 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
88
89
|
return this.renderDiff(files);
|
|
89
90
|
}
|
|
90
91
|
const text = this.text;
|
|
91
|
-
|
|
92
|
+
let highlighted;
|
|
93
|
+
try {
|
|
94
|
+
highlighted =
|
|
95
|
+
this.highlight && text !== ''
|
|
96
|
+
? highlightedLines(this.highlight(text, this.language))
|
|
97
|
+
: undefined;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
globalThis.reportError?.(error);
|
|
101
|
+
}
|
|
92
102
|
const code = highlighted === undefined
|
|
93
103
|
? html `<code part="code"><slot @slotchange=${() => this.requestUpdate()}></slot></code>`
|
|
94
104
|
: html `<code part="code">${unsafeHTML(highlighted)}</code><slot
|
|
@@ -99,10 +109,11 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
99
109
|
const gutter = this.lineNumbers
|
|
100
110
|
? html `<span part="gutter" aria-hidden="true">${lines === 0 ? nothing : gutterNumbers(lines)}</span>`
|
|
101
111
|
: nothing;
|
|
102
|
-
|
|
112
|
+
const name = this.label || this.language;
|
|
113
|
+
return html `${this.renderHeader(name)}
|
|
103
114
|
<div part="frame">
|
|
104
|
-
<pre part="block">${gutter}${code}</pre>
|
|
105
|
-
${
|
|
115
|
+
<pre id="block" part="block">${gutter}${code}</pre>
|
|
116
|
+
${name ? nothing : this.renderCopy()}
|
|
106
117
|
</div>${this.renderExpand()}`;
|
|
107
118
|
}
|
|
108
119
|
renderExpand() {
|
|
@@ -110,6 +121,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
110
121
|
return nothing;
|
|
111
122
|
}
|
|
112
123
|
return html `<button
|
|
124
|
+
aria-controls="block"
|
|
113
125
|
aria-expanded=${this.expanded ? 'true' : 'false'}
|
|
114
126
|
part="expand"
|
|
115
127
|
type="button"
|
|
@@ -129,10 +141,10 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
129
141
|
renderCopy(value, name) {
|
|
130
142
|
return this.noCopy ? nothing : this.renderCopyButton(value, name);
|
|
131
143
|
}
|
|
132
|
-
renderCopyButton(value = this.text, name = this.label) {
|
|
144
|
+
renderCopyButton(value = this.text, name = this.label || this.language) {
|
|
133
145
|
return html `<${this.tag('copy-button')}
|
|
134
146
|
part="copy"
|
|
135
|
-
exportparts="button: copy-button, text: copy-text, mark: copy-mark, live: copy-live, tooltip: copy-tooltip,
|
|
147
|
+
exportparts="button: copy-button, text: copy-text, mark: copy-mark, live: copy-live, spinner: copy-spinner, tooltip: copy-tooltip,
|
|
136
148
|
tooltip-arrow: copy-tooltip-arrow, tooltip-arrow-bottom: copy-tooltip-arrow-bottom,
|
|
137
149
|
tooltip-arrow-left: copy-tooltip-arrow-left, tooltip-arrow-right: copy-tooltip-arrow-right,
|
|
138
150
|
tooltip-arrow-top: copy-tooltip-arrow-top, tooltip-bottom: copy-tooltip-bottom,
|
|
@@ -214,6 +226,9 @@ __decorate([
|
|
|
214
226
|
__decorate([
|
|
215
227
|
property()
|
|
216
228
|
], HelixHeadlessCodeBlock.prototype, "label", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
property()
|
|
231
|
+
], HelixHeadlessCodeBlock.prototype, "language", void 0);
|
|
217
232
|
__decorate([
|
|
218
233
|
property({ attribute: 'line-numbers', reflect: true, type: Boolean })
|
|
219
234
|
], HelixHeadlessCodeBlock.prototype, "lineNumbers", void 0);
|
|
@@ -74,11 +74,14 @@ declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fu
|
|
|
74
74
|
* @csspart picker-channel-marker-label - The value a mark stands at, when `marker-labels` is set.
|
|
75
75
|
* @csspart picker-channel-markers - The row of marks along the track.
|
|
76
76
|
* @csspart picker-channel-output - The current value, shown beside the track.
|
|
77
|
+
* @csspart picker-channel-tooltip - A ramp's value in a bubble, where a ramp shows one.
|
|
78
|
+
* @csspart picker-channel-tooltips - The layer over a ramp's track that holds its bubble.
|
|
77
79
|
* @csspart picker-channels - The channel sliders beside the sample.
|
|
78
80
|
* @csspart picker-controls - The row under the square.
|
|
79
81
|
* @csspart picker-eyedropper - The control that samples a color from the screen.
|
|
80
82
|
* @csspart picker-eyedropper-button - The button inside `picker-eyedropper`.
|
|
81
83
|
* @csspart picker-eyedropper-live - The live region of the button inside `picker-eyedropper`, which says its pending label.
|
|
84
|
+
* @csspart picker-eyedropper-spinner - The ring the eyedropper button turns while it is pending.
|
|
82
85
|
* @csspart picker-eyedropper-text - The words on the button inside `picker-eyedropper`.
|
|
83
86
|
* @csspart picker-feedback - The field's message inside the open panel, under the picker, where the panel covers the one under the field.
|
|
84
87
|
* @csspart picker-field - One channel's number field with its label, in `channel-fields`.
|
|
@@ -89,6 +92,7 @@ declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fu
|
|
|
89
92
|
* @csspart picker-format - The control that changes the syntax the value is written in.
|
|
90
93
|
* @csspart picker-format-button - The button inside `picker-format`.
|
|
91
94
|
* @csspart picker-format-live - The live region of the button inside `picker-format`, which says its pending label.
|
|
95
|
+
* @csspart picker-format-spinner - The ring the syntax button turns while it is pending.
|
|
92
96
|
* @csspart picker-format-text - The words on the button inside `picker-format`.
|
|
93
97
|
* @csspart picker-grid - The saturation and brightness square.
|
|
94
98
|
* @csspart picker-grid-brightness - The range input for the square's vertical axis.
|
|
@@ -99,6 +103,8 @@ declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fu
|
|
|
99
103
|
* @csspart picker-swatch - One preset.
|
|
100
104
|
* @csspart picker-swatches - The row of presets.
|
|
101
105
|
* @csspart picker-value - The text field that holds the color. It accepts a typed or pasted color.
|
|
106
|
+
* @csspart picker-wheel - The hue ring round the square, with `wheel`.
|
|
107
|
+
* @csspart picker-wheel-hue - The range input behind the hue ring.
|
|
102
108
|
* @csspart preview - The chip showing the color, inside the trigger.
|
|
103
109
|
* @csspart surface - The floating panel.
|
|
104
110
|
* @csspart trigger - The control that opens the panel.
|
|
@@ -196,6 +202,11 @@ export declare class HelixHeadlessColorInput extends HelixHeadlessColorInput_bas
|
|
|
196
202
|
* where the color is the answer rather than a setting.
|
|
197
203
|
*/
|
|
198
204
|
variant?: 'swatch';
|
|
205
|
+
/**
|
|
206
|
+
* Draws the panel's hue as a wheel around the square, in place of the hue
|
|
207
|
+
* ramp. See Color Picker's `wheel`.
|
|
208
|
+
*/
|
|
209
|
+
wheel: boolean;
|
|
199
210
|
/**
|
|
200
211
|
* The last value that was a color.
|
|
201
212
|
*
|
|
@@ -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, colorName, customElement, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerField, parseColor, toCss, wordsConverter, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, colorName, customElement, HelixFormElement, localeOf, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerField, parseColor, toCss, wordsConverter, } 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';
|
|
@@ -25,6 +25,7 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
25
25
|
this.announcesInput = true;
|
|
26
26
|
this.swatches = '';
|
|
27
27
|
this.triggerLabel = 'Choose a color';
|
|
28
|
+
this.wheel = false;
|
|
28
29
|
this.settled = '';
|
|
29
30
|
this.handleInput = (event) => {
|
|
30
31
|
event.stopPropagation();
|
|
@@ -77,7 +78,7 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
77
78
|
if (!parsed) {
|
|
78
79
|
return this.value || this.triggerLabel;
|
|
79
80
|
}
|
|
80
|
-
return `${colorName(parsed, this.colorWords, this
|
|
81
|
+
return `${colorName(parsed, this.colorWords, localeOf(this))} ${this.value}`;
|
|
81
82
|
}
|
|
82
83
|
get painted() {
|
|
83
84
|
const parsed = parseColor(this.value);
|
|
@@ -115,17 +116,20 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
115
116
|
channel-hint: picker-channel-hint, channel-label: picker-channel-label,
|
|
116
117
|
channel-marker: picker-channel-marker, channel-marker-label: picker-channel-marker-label,
|
|
117
118
|
channel-markers: picker-channel-markers, channel-output: picker-channel-output,
|
|
119
|
+
channel-tooltip: picker-channel-tooltip, channel-tooltips: picker-channel-tooltips,
|
|
118
120
|
channels: picker-channels, controls: picker-controls, eyedropper: picker-eyedropper,
|
|
119
|
-
eyedropper-button: picker-eyedropper-button, eyedropper-live: picker-eyedropper-live, eyedropper-text: picker-eyedropper-text,
|
|
121
|
+
eyedropper-button: picker-eyedropper-button, eyedropper-live: picker-eyedropper-live, eyedropper-spinner: picker-eyedropper-spinner, eyedropper-text: picker-eyedropper-text,
|
|
120
122
|
feedback: picker-feedback, field: picker-field, field-input: picker-field-input, field-label: picker-field-label,
|
|
121
123
|
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,
|
|
124
|
+
format-button: picker-format-button, format-live: picker-format-live, format-spinner: picker-format-spinner, format-text: picker-format-text, grid: picker-grid,
|
|
123
125
|
grid-brightness: picker-grid-brightness, grid-handle: picker-grid-handle,
|
|
124
126
|
grid-saturation: picker-grid-saturation, icon: picker-icon, sample: picker-sample,
|
|
125
|
-
swatch: picker-swatch, swatches: picker-swatches, value: picker-value
|
|
127
|
+
swatch: picker-swatch, swatches: picker-swatches, value: picker-value,
|
|
128
|
+
wheel: picker-wheel, wheel-hue: picker-wheel-hue"
|
|
126
129
|
?invalid=${this.resolvedFeedback !== ''}
|
|
127
130
|
.feedback=${this.resolvedFeedback}
|
|
128
131
|
?alpha=${this.alpha}
|
|
132
|
+
?wheel=${this.wheel}
|
|
129
133
|
?channel-fields=${this.channelFields}
|
|
130
134
|
?no-format=${this.noFormat}
|
|
131
135
|
?no-value=${this.variant !== 'swatch'}
|
|
@@ -250,6 +254,9 @@ __decorate([
|
|
|
250
254
|
__decorate([
|
|
251
255
|
property({ reflect: true })
|
|
252
256
|
], HelixHeadlessColorInput.prototype, "variant", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
property({ reflect: true, type: Boolean })
|
|
259
|
+
], HelixHeadlessColorInput.prototype, "wheel", void 0);
|
|
253
260
|
HelixHeadlessColorInput = __decorate([
|
|
254
261
|
customElement('helix-headless-color-input')
|
|
255
262
|
], HelixHeadlessColorInput);
|