@fusion.dev/helix-headless 0.147.0 → 0.149.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 +11222 -2332
- package/dist/accordion/item/accordion-item.d.ts +5 -2
- package/dist/accordion/item/accordion-item.js +11 -7
- package/dist/accordion/root/accordion-root.js +4 -6
- package/dist/announcement/root/announcement-root.d.ts +61 -5
- package/dist/announcement/root/announcement-root.js +126 -20
- package/dist/area-chart/root/area-chart-root.d.ts +11 -0
- package/dist/area-chart/root/area-chart-root.js +21 -9
- package/dist/avatar/group/avatar-group.d.ts +10 -2
- package/dist/avatar/group/avatar-group.js +10 -5
- package/dist/badge/count.d.ts +19 -0
- package/dist/badge/count.js +20 -0
- package/dist/badge/root/badge-root.d.ts +6 -2
- package/dist/badge/root/badge-root.js +8 -22
- package/dist/bar-chart/root/bar-chart-root.d.ts +13 -1
- package/dist/bar-chart/root/bar-chart-root.js +17 -4
- package/dist/blockquote/root/blockquote-root.d.ts +66 -8
- package/dist/blockquote/root/blockquote-root.js +85 -8
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +2 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +8 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +5 -2
- package/dist/button/root/button-root.d.ts +10 -1
- package/dist/button/root/button-root.js +3 -2
- 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 +144 -3
- package/dist/button-group/root/button-group-root.js +142 -2
- package/dist/callout/root/callout-root.d.ts +16 -2
- package/dist/callout/root/callout-root.js +16 -4
- package/dist/canvas/describe.d.ts +10 -0
- package/dist/canvas/describe.js +9 -0
- package/dist/canvas/edge-pan.d.ts +61 -0
- package/dist/canvas/edge-pan.js +63 -0
- package/dist/canvas/neighbor.d.ts +17 -0
- package/dist/canvas/neighbor.js +1 -0
- package/dist/canvas/node/canvas-node.d.ts +12 -2
- package/dist/canvas/node/canvas-node.js +8 -3
- 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 +168 -9
- package/dist/canvas/root/canvas-root.js +239 -69
- package/dist/canvas/snap.d.ts +42 -0
- package/dist/canvas/snap.js +32 -0
- package/dist/carousel/root/carousel-root.d.ts +9 -3
- package/dist/carousel/root/carousel-root.js +17 -10
- package/dist/chat/composer/chat-composer.d.ts +5 -0
- package/dist/chat/composer/chat-composer.js +4 -1
- package/dist/chat/message/chat-message.d.ts +9 -5
- package/dist/chat/message/chat-message.js +8 -4
- package/dist/chat/naming.js +2 -2
- package/dist/chat/root/chat-root.d.ts +40 -4
- package/dist/chat/root/chat-root.js +38 -14
- package/dist/checkbox/root/checkbox-root.d.ts +11 -0
- package/dist/checkbox/root/checkbox-root.js +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +24 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +28 -12
- package/dist/checkbox-group/select-all.d.ts +11 -0
- package/dist/checkbox-group/select-all.js +5 -0
- package/dist/code-block/root/code-block-root.d.ts +20 -8
- package/dist/code-block/root/code-block-root.js +16 -5
- package/dist/color-input/root/color-input-root.d.ts +13 -0
- package/dist/color-input/root/color-input-root.js +18 -5
- package/dist/color-picker/root/color-picker-root.d.ts +19 -3
- package/dist/color-picker/root/color-picker-root.js +52 -24
- package/dist/color-picker/wheel.d.ts +11 -0
- package/dist/color-picker/wheel.js +9 -0
- package/dist/combobox/root/combobox-root.d.ts +106 -18
- package/dist/combobox/root/combobox-root.js +101 -26
- package/dist/command/root/command-root.d.ts +19 -9
- package/dist/command/root/command-root.js +9 -4
- package/dist/copy-button/root/copy-button-root.d.ts +5 -0
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/root/data-table-root.d.ts +171 -29
- package/dist/data-table/root/data-table-root.js +284 -161
- package/dist/date-input/root/date-input-root.d.ts +32 -9
- package/dist/date-input/root/date-input-root.js +66 -44
- package/dist/date-picker/root/date-picker-root.d.ts +38 -15
- package/dist/date-picker/root/date-picker-root.js +52 -33
- package/dist/description-list/item/description-list-item.d.ts +4 -0
- package/dist/description-list/item/description-list-item.js +7 -1
- package/dist/dialog/root/dialog-root.d.ts +12 -1
- package/dist/dialog/root/dialog-root.js +11 -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.d.ts +5 -0
- package/dist/donut-chart/root/donut-chart-root.js +8 -5
- package/dist/drawer/root/drawer-root.d.ts +12 -1
- package/dist/drawer/root/drawer-root.js +9 -2
- package/dist/drilldown/item/drilldown-item.js +3 -4
- package/dist/drilldown/root/drilldown-root.d.ts +5 -0
- package/dist/drilldown/root/drilldown-root.js +4 -1
- package/dist/element-events.generated.js +26 -3
- package/dist/empty/root/empty-root.d.ts +17 -3
- package/dist/empty/root/empty-root.js +29 -5
- package/dist/file-input/root/file-input-root.d.ts +18 -3
- package/dist/file-input/root/file-input-root.js +34 -18
- package/dist/file-input/status.js +2 -1
- package/dist/filter-input/chip/filter-chip.d.ts +13 -0
- package/dist/filter-input/chip/filter-chip.js +7 -3
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +3 -1
- package/dist/filter-input/root/filter-input-root.d.ts +20 -3
- package/dist/filter-input/root/filter-input-root.js +8 -4
- package/dist/format-date/fields.d.ts +20 -0
- package/dist/format-date/fields.js +14 -0
- package/dist/format-date/options.d.ts +2 -1
- package/dist/format-date/options.js +9 -38
- package/dist/format-date/root/format-date-root.d.ts +55 -5
- package/dist/format-date/root/format-date-root.js +29 -34
- package/dist/graph/root/graph-model.d.ts +11 -0
- package/dist/graph/root/graph-model.js +4 -0
- package/dist/graph/root/graph-root.d.ts +101 -14
- package/dist/graph/root/graph-root.js +140 -46
- package/dist/heatmap/root/heatmap-root.d.ts +37 -4
- package/dist/heatmap/root/heatmap-root.js +51 -16
- package/dist/icon-button/root/icon-button-root.d.ts +5 -0
- package/dist/icon-button/root/icon-button-root.js +1 -0
- package/dist/image/root/image-root.d.ts +11 -0
- package/dist/input/root/input-root.d.ts +5 -0
- package/dist/input/root/input-root.js +4 -1
- package/dist/kbd/root/kbd-root.js +1 -2
- package/dist/legend/root/legend-root.js +4 -17
- package/dist/lightbox/root/lightbox-root.d.ts +14 -4
- package/dist/lightbox/root/lightbox-root.js +25 -7
- package/dist/line-chart/root/line-chart-root.d.ts +5 -0
- package/dist/line-chart/root/line-chart-root.js +4 -2
- package/dist/list/item/list-item.d.ts +32 -0
- package/dist/list/item/list-item.js +34 -7
- package/dist/list/root/list-root.d.ts +87 -0
- package/dist/list/root/list-root.js +119 -23
- package/dist/listbox/reorder/index.d.ts +1 -0
- package/dist/listbox/reorder/index.js +4 -0
- package/dist/listbox/reorder/listbox-reorder.d.ts +83 -0
- package/dist/listbox/reorder/listbox-reorder.js +151 -0
- package/dist/listbox/root/listbox-root.d.ts +185 -33
- package/dist/listbox/root/listbox-root.js +166 -136
- package/dist/loader/root/loader-root.d.ts +5 -0
- package/dist/loader/root/loader-root.js +3 -1
- package/dist/map/area/map-area.d.ts +5 -0
- package/dist/map/area/map-area.js +3 -1
- package/dist/map/buildings/map-buildings.d.ts +5 -0
- package/dist/map/buildings/map-buildings.js +3 -1
- package/dist/map/contours/map-contours.d.ts +5 -0
- package/dist/map/contours/map-contours.js +3 -1
- package/dist/map/landcover/map-landcover.d.ts +5 -0
- package/dist/map/landcover/map-landcover.js +3 -1
- package/dist/map/marker/map-marker.d.ts +18 -2
- package/dist/map/marker/map-marker.js +13 -5
- package/dist/map/points/map-points.d.ts +5 -0
- package/dist/map/points/map-points.js +6 -4
- package/dist/map/position/map-position.d.ts +5 -0
- package/dist/map/position/map-position.js +3 -1
- package/dist/map/raster/map-raster.d.ts +5 -0
- package/dist/map/raster/map-raster.js +3 -1
- package/dist/map/root/map-root.d.ts +73 -16
- package/dist/map/root/map-root.js +122 -44
- package/dist/map/route/map-route.d.ts +5 -0
- package/dist/map/route/map-route.js +3 -1
- package/dist/map/terrain/map-terrain.d.ts +5 -0
- package/dist/map/terrain/map-terrain.js +3 -1
- package/dist/megamenu/root/megamenu-root.js +4 -11
- package/dist/menu/root/menu-root.d.ts +7 -2
- package/dist/menu/root/menu-root.js +3 -1
- package/dist/meter/root/meter-root.d.ts +16 -3
- package/dist/meter/root/meter-root.js +12 -5
- package/dist/navigation/root/navigation-root.d.ts +5 -0
- package/dist/navigation/root/navigation-root.js +7 -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 +17 -1
- package/dist/notifications/notification/notification.js +6 -2
- package/dist/notifications/root/notifications-root.d.ts +49 -5
- package/dist/notifications/root/notifications-root.js +36 -8
- package/dist/number-input/root/number-input-root.d.ts +21 -8
- package/dist/number-input/root/number-input-root.js +26 -11
- package/dist/object-inspector/root/object-inspector-root.d.ts +56 -13
- package/dist/object-inspector/root/object-inspector-root.js +41 -30
- package/dist/outline/root/outline-root.d.ts +5 -0
- package/dist/outline/root/outline-root.js +3 -1
- package/dist/pagination/root/pagination-root.d.ts +7 -1
- package/dist/pagination/root/pagination-root.js +16 -7
- package/dist/pagination/size/pagination-size.d.ts +8 -3
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pagination/summary/pagination-summary.d.ts +8 -6
- package/dist/pagination/summary/pagination-summary.js +4 -9
- package/dist/pin-input/code.d.ts +23 -0
- package/dist/pin-input/code.js +21 -0
- package/dist/pin-input/root/pin-input-root.d.ts +9 -3
- package/dist/pin-input/root/pin-input-root.js +13 -23
- package/dist/popover/root/popover-root.d.ts +12 -2
- package/dist/popover/root/popover-root.js +10 -4
- package/dist/progress/root/progress-root.d.ts +7 -2
- package/dist/progress/root/progress-root.js +5 -2
- package/dist/qr-code/name.d.ts +3 -2
- package/dist/qr-code/name.js +2 -2
- package/dist/qr-code/root/qr-code-root.d.ts +26 -5
- package/dist/qr-code/root/qr-code-root.js +27 -6
- package/dist/radio/group/radio-group.d.ts +11 -0
- package/dist/radio/group/radio-group.js +8 -2
- package/dist/rating/root/rating-root.d.ts +12 -1
- package/dist/rating/root/rating-root.js +10 -3
- 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 +22 -8
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -23
- package/dist/select/root/select-root.d.ts +67 -8
- package/dist/select/root/select-root.js +45 -11
- package/dist/skip-link/root/skip-link-root.d.ts +5 -0
- package/dist/skip-link/root/skip-link-root.js +3 -1
- package/dist/slider/root/slider-root.d.ts +7 -2
- package/dist/slider/root/slider-root.js +11 -5
- package/dist/sparkline/readings.d.ts +15 -5
- package/dist/sparkline/readings.js +3 -3
- package/dist/sparkline/root/sparkline-root.d.ts +9 -4
- package/dist/sparkline/root/sparkline-root.js +9 -3
- 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 +26 -1
- package/dist/speed-dial/item/speed-dial-item.js +41 -3
- 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 +85 -1
- package/dist/speed-dial/root/speed-dial-root.js +117 -5
- package/dist/splitter/root/splitter-root.d.ts +12 -3
- package/dist/splitter/root/splitter-root.js +22 -4
- package/dist/steps/root/steps-root.d.ts +9 -2
- package/dist/steps/root/steps-root.js +6 -3
- package/dist/steps/step/step.d.ts +12 -0
- package/dist/steps/step/step.js +11 -2
- package/dist/switch/root/switch-root.d.ts +11 -0
- package/dist/switch/root/switch-root.js +8 -2
- 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 +11 -4
- package/dist/table/column/table-column.js +15 -10
- package/dist/table/grid-controller.d.ts +122 -0
- package/dist/table/grid-controller.js +299 -0
- package/dist/table/root/table-root.d.ts +154 -8
- package/dist/table/root/table-root.js +197 -38
- package/dist/table/row/table-row.d.ts +55 -1
- package/dist/table/row/table-row.js +60 -7
- package/dist/tabs/root/tabs-root.d.ts +5 -0
- package/dist/tabs/root/tabs-root.js +3 -1
- package/dist/tag/group/tag-group.d.ts +5 -0
- package/dist/tag/group/tag-group.js +8 -15
- package/dist/tag/root/tag-root.d.ts +14 -1
- package/dist/tag/root/tag-root.js +11 -8
- package/dist/textarea/root/textarea-root.d.ts +5 -0
- package/dist/textarea/root/textarea-root.js +3 -1
- package/dist/time-input/root/time-input-root.d.ts +14 -7
- package/dist/time-input/root/time-input-root.js +43 -32
- package/dist/time-picker/root/time-picker-root.d.ts +16 -7
- package/dist/time-picker/root/time-picker-root.js +28 -12
- package/dist/toast/item/toast-item.d.ts +13 -3
- package/dist/toast/item/toast-item.js +2 -0
- package/dist/toast/root/toast-root.d.ts +22 -2
- package/dist/toast/root/toast-root.js +24 -17
- package/dist/toggle/group/toggle-group.js +3 -5
- package/dist/toolbar/root/toolbar-root.d.ts +36 -0
- package/dist/toolbar/root/toolbar-root.js +43 -9
- package/dist/tooltip/root/tooltip-root.d.ts +27 -17
- package/dist/tooltip/root/tooltip-root.js +1 -2
- package/dist/tour/root/tour-root.d.ts +8 -2
- package/dist/tour/root/tour-root.js +4 -2
- package/dist/tour/stop/tour-stop.d.ts +5 -0
- package/dist/tour/stop/tour-stop.js +6 -1
- package/dist/tree/grip.d.ts +5 -0
- package/dist/tree/grip.js +1 -0
- package/dist/tree/item/tree-item.d.ts +24 -0
- package/dist/tree/item/tree-item.js +27 -5
- package/dist/tree/root/tree-root.d.ts +66 -1
- package/dist/tree/root/tree-root.js +77 -5
- package/dist/trend/root/trend-root.d.ts +20 -4
- package/dist/trend/root/trend-root.js +20 -5
- package/dist/video/root/video-root.d.ts +23 -3
- package/dist/video/root/video-root.js +56 -15
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +5 -0
- package/dist/video-playlist/root/video-playlist-root.js +3 -1
- package/dist/virtual-list/root/virtual-list-root.d.ts +19 -3
- package/dist/virtual-list/root/virtual-list-root.js +10 -19
- package/lint.json +1 -1
- package/package.json +7 -6
- package/types/jsx.d.ts +6005 -2114
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +1594 -676
- package/types/words.d.ts +3280 -0
- package/dist/kbd/keys.d.ts +0 -29
- package/dist/kbd/keys.js +0 -52
- package/dist/toast/hotkey.d.ts +0 -22
- package/dist/toast/hotkey.js +0 -23
- package/dist/tooltip/focus-target.d.ts +0 -6
- package/dist/tooltip/focus-target.js +0 -9
|
@@ -5,13 +5,12 @@ 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,
|
|
8
|
+
import { ChildrenController, customElement, formatWords, HelixBeforePinEvent, HelixElement, HelixHistoryEvent, HelixPinEvent, hostAria, MixinCollection, onUnlessFalse, requestChange, VirtualizeController, whenHydrated, words, 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';
|
|
12
12
|
import { repeat } from 'lit/directives/repeat.js';
|
|
13
13
|
import { html } from 'lit/static-html.js';
|
|
14
|
-
import { FAILED_LABEL } from '../message/chat-message.js';
|
|
15
14
|
import { TURN_WORDS } from '../naming.js';
|
|
16
15
|
const REGIONS = ['header', 'actions', 'resume', 'status', 'composer'];
|
|
17
16
|
const SECOND_NAMES = {
|
|
@@ -37,11 +36,15 @@ const spoken = (message) => [...message.childNodes]
|
|
|
37
36
|
.join('')
|
|
38
37
|
.replace(/\s+/g, ' ')
|
|
39
38
|
.trim();
|
|
39
|
+
const drawnInFull = ({ element }) => element.firstElementChild?.hasUpdated !== false;
|
|
40
40
|
let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixElement) {
|
|
41
41
|
constructor() {
|
|
42
42
|
super(...arguments);
|
|
43
43
|
this.authorStyles = {};
|
|
44
44
|
this.defaultPinned = true;
|
|
45
|
+
this.failedLabel = 'Not sent';
|
|
46
|
+
this.failedTurnLabel = '{failed}: {text}';
|
|
47
|
+
this.fallbackLabel = 'Conversation';
|
|
45
48
|
this.history = '';
|
|
46
49
|
this.historyText = 'Loading earlier messages';
|
|
47
50
|
this.label = '';
|
|
@@ -56,7 +59,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
56
59
|
this.announcement = '';
|
|
57
60
|
this.said = 0;
|
|
58
61
|
this.words = TURN_WORDS;
|
|
59
|
-
this.
|
|
62
|
+
this.childWatch = new ChildrenController(this, () => this.handleSlotChange());
|
|
60
63
|
this.settling = undefined;
|
|
61
64
|
this.grower = undefined;
|
|
62
65
|
this.watched = [];
|
|
@@ -67,10 +70,11 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
67
70
|
this.newest = undefined;
|
|
68
71
|
this.pending = new Set();
|
|
69
72
|
this.virtualize = new VirtualizeController(this, {
|
|
73
|
+
anchor: () => !this.pinned && this.virtualize.scrolling(),
|
|
70
74
|
container: () => (this.fed ? this.log : null),
|
|
71
75
|
count: () => this.turns.length,
|
|
72
76
|
estimate: () => HelixHeadlessChat_1.ESTIMATE,
|
|
73
|
-
rows: () => (this.fed ? this.drawn() : []),
|
|
77
|
+
rows: () => (this.fed ? this.drawn().filter(drawnInFull) : []),
|
|
74
78
|
});
|
|
75
79
|
this.filled = undefined;
|
|
76
80
|
this.handleResize = () => {
|
|
@@ -78,6 +82,9 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
78
82
|
this.stick();
|
|
79
83
|
}
|
|
80
84
|
else {
|
|
85
|
+
if (this.fed) {
|
|
86
|
+
this.virtualize.settle();
|
|
87
|
+
}
|
|
81
88
|
this.restore();
|
|
82
89
|
}
|
|
83
90
|
this.remember();
|
|
@@ -108,6 +115,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
108
115
|
};
|
|
109
116
|
}
|
|
110
117
|
static { HelixHeadlessChat_1 = this; }
|
|
118
|
+
static { this.words = 'helix-chat'; }
|
|
111
119
|
static { this.shadowRootOptions = {
|
|
112
120
|
...HelixElement.shadowRootOptions,
|
|
113
121
|
slotAssignment: 'manual',
|
|
@@ -159,7 +167,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
159
167
|
if (this.fed) {
|
|
160
168
|
return this.turns.map((turn) => ({
|
|
161
169
|
author: turn.author,
|
|
162
|
-
failed:
|
|
170
|
+
failed: this.failedLabel,
|
|
163
171
|
id: this.identity(turn),
|
|
164
172
|
state: turn.state,
|
|
165
173
|
text: turn.text,
|
|
@@ -259,7 +267,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
259
267
|
restore() {
|
|
260
268
|
const log = this.log;
|
|
261
269
|
const anchor = this.anchor;
|
|
262
|
-
if (!log || !anchor) {
|
|
270
|
+
if (!log || !anchor || (this.fed && this.virtualize.scrolling())) {
|
|
263
271
|
return;
|
|
264
272
|
}
|
|
265
273
|
const found = this.rendered().find((turn) => turn.id === anchor.id);
|
|
@@ -328,7 +336,9 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
328
336
|
return at < 0 ? [] : turns.slice(at + 1);
|
|
329
337
|
}
|
|
330
338
|
phrase(turn) {
|
|
331
|
-
return turn.state === 'failed'
|
|
339
|
+
return turn.state === 'failed'
|
|
340
|
+
? formatWords(this, 'failedTurnLabel', { failed: turn.failed, text: turn.text })
|
|
341
|
+
: turn.text;
|
|
332
342
|
}
|
|
333
343
|
watchSizes() {
|
|
334
344
|
if (typeof ResizeObserver === 'undefined') {
|
|
@@ -349,8 +359,6 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
349
359
|
}
|
|
350
360
|
connectedCallback() {
|
|
351
361
|
super.connectedCallback();
|
|
352
|
-
this.watcher = new MutationObserver(this.handleSlotChange);
|
|
353
|
-
this.watcher.observe(this, { childList: true });
|
|
354
362
|
this.settling = new MutationObserver(this.handleSettle);
|
|
355
363
|
this.settling.observe(this, { attributeFilter: ['state'], subtree: true });
|
|
356
364
|
this.opening = true;
|
|
@@ -363,8 +371,6 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
363
371
|
}
|
|
364
372
|
disconnectedCallback() {
|
|
365
373
|
super.disconnectedCallback();
|
|
366
|
-
this.watcher?.disconnect();
|
|
367
|
-
this.watcher = undefined;
|
|
368
374
|
this.settling?.disconnect();
|
|
369
375
|
this.settling = undefined;
|
|
370
376
|
this.grower?.disconnect();
|
|
@@ -372,7 +378,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
372
378
|
}
|
|
373
379
|
willUpdate(changed) {
|
|
374
380
|
super.willUpdate(changed);
|
|
375
|
-
hostAria(this.internals, { label: this.label ||
|
|
381
|
+
hostAria(this.internals, { label: this.label || this.fallbackLabel, role: 'region' });
|
|
376
382
|
if (changed.has('meLabel') || changed.has('messageLabel') || changed.has('turnLabel')) {
|
|
377
383
|
this.words = { me: this.meLabel, sentence: this.messageLabel, turn: this.turnLabel };
|
|
378
384
|
}
|
|
@@ -441,6 +447,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
441
447
|
at=${turn.at ?? nothing}
|
|
442
448
|
style=${ownEntry(this.authorStyles, turn.author) ?? nothing}
|
|
443
449
|
.turnWords=${this.words}
|
|
450
|
+
.failedLabel=${this.failedLabel}
|
|
444
451
|
state=${turn.state ?? nothing}
|
|
445
452
|
>${turn.text}</${message}>
|
|
446
453
|
</div>`)}
|
|
@@ -461,7 +468,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
461
468
|
part="log"
|
|
462
469
|
role="log"
|
|
463
470
|
aria-live="off"
|
|
464
|
-
aria-label=${this.label ||
|
|
471
|
+
aria-label=${this.label || this.fallbackLabel}
|
|
465
472
|
aria-busy=${busy ? 'true' : nothing}
|
|
466
473
|
?data-windowed=${fed}
|
|
467
474
|
@scroll=${this.handleScroll}
|
|
@@ -480,7 +487,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
480
487
|
? nothing
|
|
481
488
|
: html `<span part="typing"
|
|
482
489
|
><span part="indicator" aria-hidden="true"></span
|
|
483
|
-
>${
|
|
490
|
+
>${formatWords(this, 'typingLabel', { author: this.typing })}</span
|
|
484
491
|
>`}
|
|
485
492
|
</div>
|
|
486
493
|
<div part="composer" ?hidden=${!this.has('composer')}>
|
|
@@ -494,19 +501,34 @@ __decorate([
|
|
|
494
501
|
__decorate([
|
|
495
502
|
property({ attribute: 'default-pinned', converter: onUnlessFalse })
|
|
496
503
|
], HelixHeadlessChat.prototype, "defaultPinned", void 0);
|
|
504
|
+
__decorate([
|
|
505
|
+
words,
|
|
506
|
+
property({ attribute: 'failed-label' })
|
|
507
|
+
], HelixHeadlessChat.prototype, "failedLabel", void 0);
|
|
508
|
+
__decorate([
|
|
509
|
+
words,
|
|
510
|
+
property({ attribute: 'failed-turn-label' })
|
|
511
|
+
], HelixHeadlessChat.prototype, "failedTurnLabel", void 0);
|
|
512
|
+
__decorate([
|
|
513
|
+
words,
|
|
514
|
+
property({ attribute: 'fallback-label' })
|
|
515
|
+
], HelixHeadlessChat.prototype, "fallbackLabel", void 0);
|
|
497
516
|
__decorate([
|
|
498
517
|
property()
|
|
499
518
|
], HelixHeadlessChat.prototype, "history", void 0);
|
|
500
519
|
__decorate([
|
|
520
|
+
words,
|
|
501
521
|
property({ attribute: 'history-text' })
|
|
502
522
|
], HelixHeadlessChat.prototype, "historyText", void 0);
|
|
503
523
|
__decorate([
|
|
504
524
|
property()
|
|
505
525
|
], HelixHeadlessChat.prototype, "label", void 0);
|
|
506
526
|
__decorate([
|
|
527
|
+
words,
|
|
507
528
|
property({ attribute: 'me-label' })
|
|
508
529
|
], HelixHeadlessChat.prototype, "meLabel", void 0);
|
|
509
530
|
__decorate([
|
|
531
|
+
words,
|
|
510
532
|
property({ attribute: 'message-label' })
|
|
511
533
|
], HelixHeadlessChat.prototype, "messageLabel", void 0);
|
|
512
534
|
__decorate([
|
|
@@ -516,6 +538,7 @@ __decorate([
|
|
|
516
538
|
property({ type: Number })
|
|
517
539
|
], HelixHeadlessChat.prototype, "threshold", void 0);
|
|
518
540
|
__decorate([
|
|
541
|
+
words,
|
|
519
542
|
property({ attribute: 'turn-label' })
|
|
520
543
|
], HelixHeadlessChat.prototype, "turnLabel", void 0);
|
|
521
544
|
__decorate([
|
|
@@ -525,6 +548,7 @@ __decorate([
|
|
|
525
548
|
property()
|
|
526
549
|
], HelixHeadlessChat.prototype, "typing", void 0);
|
|
527
550
|
__decorate([
|
|
551
|
+
words,
|
|
528
552
|
property({ attribute: 'typing-label' })
|
|
529
553
|
], HelixHeadlessChat.prototype, "typingLabel", void 0);
|
|
530
554
|
__decorate([
|
|
@@ -66,6 +66,11 @@ declare const HelixHeadlessCheckbox_base: (new (...args: any[]) => import("@fusi
|
|
|
66
66
|
* @cssstate invalid - The control has an error to show, from the browser's validation or from your `feedback`.
|
|
67
67
|
*/
|
|
68
68
|
export declare class HelixHeadlessCheckbox extends HelixHeadlessCheckbox_base {
|
|
69
|
+
/**
|
|
70
|
+
* The key this family's words are registered under, its styled tag:
|
|
71
|
+
* `registerWords('de', { 'helix-checkbox': { valueMissingMessage: '...' } })`.
|
|
72
|
+
*/
|
|
73
|
+
static words: string;
|
|
69
74
|
protected readonly aria: AriaForwardController;
|
|
70
75
|
/** A click on the element itself, `click()` or a page's `<label for>`, toggles it. */
|
|
71
76
|
protected readonly clicks: HostClickController;
|
|
@@ -83,6 +88,12 @@ export declare class HelixHeadlessCheckbox extends HelixHeadlessCheckbox_base {
|
|
|
83
88
|
* The value submitted when the box is checked.
|
|
84
89
|
*/
|
|
85
90
|
value: string;
|
|
91
|
+
/**
|
|
92
|
+
* The message reported when the field is required and the box is not ticked.
|
|
93
|
+
* Absent, or empty, is this sentence, or the words registered for the page's
|
|
94
|
+
* locale.
|
|
95
|
+
*/
|
|
96
|
+
valueMissingMessage: string;
|
|
86
97
|
/**
|
|
87
98
|
* Whether the mark draws the dash: from the moment the box is indeterminate
|
|
88
99
|
* until it is checked.
|
|
@@ -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, slotFilled, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, customElement, HelixFormElement, HostClickController, MixinControllerChecked, MixinField, slotFilled, words, } 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)) {
|
|
@@ -16,6 +16,7 @@ let HelixHeadlessCheckbox = class HelixHeadlessCheckbox extends MixinControllerC
|
|
|
16
16
|
this.clicks = new HostClickController(this, () => this.partNamed('control'));
|
|
17
17
|
this.indeterminate = false;
|
|
18
18
|
this.value = 'on';
|
|
19
|
+
this.valueMissingMessage = 'Tick this box to continue.';
|
|
19
20
|
this.dashed = false;
|
|
20
21
|
this.handleChange = (event) => {
|
|
21
22
|
const input = event.target;
|
|
@@ -43,13 +44,14 @@ let HelixHeadlessCheckbox = class HelixHeadlessCheckbox extends MixinControllerC
|
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
}
|
|
47
|
+
static { this.words = 'helix-checkbox'; }
|
|
46
48
|
static { this.shadowRootOptions = {
|
|
47
49
|
...HelixFormElement.shadowRootOptions,
|
|
48
50
|
delegatesFocus: true,
|
|
49
51
|
}; }
|
|
50
52
|
sync() {
|
|
51
53
|
this.internals.setFormValue(this.checked ? this.value : null);
|
|
52
|
-
this.reportRequired(!this.checked,
|
|
54
|
+
this.reportRequired(!this.checked, this.valueMissingMessage, 'control');
|
|
53
55
|
}
|
|
54
56
|
formResetCallback() {
|
|
55
57
|
super.formResetCallback();
|
|
@@ -120,6 +122,10 @@ __decorate([
|
|
|
120
122
|
__decorate([
|
|
121
123
|
property()
|
|
122
124
|
], HelixHeadlessCheckbox.prototype, "value", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
words,
|
|
127
|
+
property({ attribute: 'value-missing-message' })
|
|
128
|
+
], HelixHeadlessCheckbox.prototype, "valueMissingMessage", void 0);
|
|
123
129
|
HelixHeadlessCheckbox = __decorate([
|
|
124
130
|
customElement('helix-headless-checkbox')
|
|
125
131
|
], HelixHeadlessCheckbox);
|
|
@@ -71,6 +71,11 @@ declare const HelixHeadlessCheckboxGroup_base: (new (...args: any[]) => import("
|
|
|
71
71
|
* @cssstate invalid - The control has an error to show, from the browser's validation or from your `feedback`.
|
|
72
72
|
*/
|
|
73
73
|
export declare class HelixHeadlessCheckboxGroup extends HelixHeadlessCheckboxGroup_base {
|
|
74
|
+
/**
|
|
75
|
+
* The key this family's words are registered under, its styled tag:
|
|
76
|
+
* `registerWords('de', { 'helix-checkbox-group': { selectAllLabel: 'Alle auswählen' } })`.
|
|
77
|
+
*/
|
|
78
|
+
static words: string;
|
|
74
79
|
/**
|
|
75
80
|
* Whether a box above the set checks or unchecks every enabled box.
|
|
76
81
|
*/
|
|
@@ -88,6 +93,12 @@ export declare class HelixHeadlessCheckboxGroup extends HelixHeadlessCheckboxGro
|
|
|
88
93
|
*/
|
|
89
94
|
get value(): string;
|
|
90
95
|
set value(next: string);
|
|
96
|
+
/**
|
|
97
|
+
* The message reported when the field is required and no box is ticked.
|
|
98
|
+
* Absent, or empty, is this sentence, or the words registered for the page's
|
|
99
|
+
* locale.
|
|
100
|
+
*/
|
|
101
|
+
valueMissingMessage: string;
|
|
91
102
|
/**
|
|
92
103
|
* The checked values, as a list, in the order the boxes are written.
|
|
93
104
|
*
|
|
@@ -96,8 +107,21 @@ export declare class HelixHeadlessCheckboxGroup extends HelixHeadlessCheckboxGro
|
|
|
96
107
|
*/
|
|
97
108
|
get values(): string[];
|
|
98
109
|
set values(next: string[]);
|
|
110
|
+
/**
|
|
111
|
+
* Writes the set the boxes are given at the next update: by value, or, for
|
|
112
|
+
* a set a press decided, by box.
|
|
113
|
+
*/
|
|
114
|
+
private choose;
|
|
99
115
|
/** The values last written, which the boxes are given at the next update. */
|
|
100
116
|
private declared;
|
|
117
|
+
/**
|
|
118
|
+
* The boxes to check at the next update, where a press on a box or on the
|
|
119
|
+
* select-all box decided the set.
|
|
120
|
+
*
|
|
121
|
+
* **By box, since boxes can share a value.** Boxes written with no `value`
|
|
122
|
+
* all submit `on`, and pushed by value, a press on one checked every one.
|
|
123
|
+
*/
|
|
124
|
+
private checking;
|
|
101
125
|
/**
|
|
102
126
|
* Whether `declared` has yet to reach the boxes.
|
|
103
127
|
*
|
|
@@ -5,19 +5,21 @@ 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 HelixHeadlessCheckboxGroup_1;
|
|
8
|
-
import { commaList, customElement, DisabledCascadeController, HelixBeforeChangeEvent, HelixFormElement, hostAria, MixinField,
|
|
8
|
+
import { commaList, customElement, DisabledCascadeController, HelixBeforeChangeEvent, HelixFormElement, hostAria, MixinField, words, } from '@fusion.dev/helix-core';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
11
11
|
import { html } from 'lit/static-html.js';
|
|
12
12
|
import { HelixHeadlessCheckbox } from '../../checkbox/root/checkbox-root.js';
|
|
13
13
|
import '../../checkbox/index.js';
|
|
14
|
-
import { selectAllState } from '../select-all.js';
|
|
15
|
-
let HelixHeadlessCheckboxGroup =
|
|
14
|
+
import { selectAllPress, selectAllState } from '../select-all.js';
|
|
15
|
+
let HelixHeadlessCheckboxGroup = class HelixHeadlessCheckboxGroup extends MixinField(HelixFormElement) {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
18
|
this.selectAll = false;
|
|
19
19
|
this.selectAllLabel = 'Select all';
|
|
20
|
+
this.valueMissingMessage = 'Choose at least one to continue.';
|
|
20
21
|
this.declared = [];
|
|
22
|
+
this.checking = undefined;
|
|
21
23
|
this.pending = false;
|
|
22
24
|
this.watched = new Set();
|
|
23
25
|
this.member = {
|
|
@@ -41,14 +43,13 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
45
|
const wanted = event.detail.checked;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
.map((box) => box.value);
|
|
46
|
+
const checking = this.boxes.filter((box) => (box === changed ? wanted : box.checked));
|
|
47
|
+
const next = checking.map((box) => box.value);
|
|
47
48
|
if (!this.dispatchEvent(new HelixBeforeChangeEvent({ value: next.join(',') }))) {
|
|
48
49
|
event.preventDefault();
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
|
-
this.
|
|
52
|
+
this.choose(next, checking);
|
|
52
53
|
this.announceInput();
|
|
53
54
|
this.announceChange();
|
|
54
55
|
};
|
|
@@ -60,16 +61,20 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
60
61
|
this.handleSelectAll = (event) => {
|
|
61
62
|
event.preventDefault();
|
|
62
63
|
event.stopPropagation();
|
|
63
|
-
const boxes = this.
|
|
64
|
-
const
|
|
64
|
+
const boxes = this.boxes;
|
|
65
|
+
const pressed = selectAllPress(this.setBoxes());
|
|
66
|
+
const checking = boxes.filter((_, at) => pressed[at]);
|
|
67
|
+
const next = checking.map((box) => box.value);
|
|
65
68
|
if (!this.dispatchEvent(new HelixBeforeChangeEvent({ value: next.join(',') }))) {
|
|
66
69
|
return;
|
|
67
70
|
}
|
|
68
|
-
this.
|
|
71
|
+
this.choose(next, checking);
|
|
69
72
|
this.announceInput();
|
|
70
73
|
this.announceChange();
|
|
71
74
|
};
|
|
72
75
|
}
|
|
76
|
+
static { HelixHeadlessCheckboxGroup_1 = this; }
|
|
77
|
+
static { this.words = 'helix-checkbox-group'; }
|
|
73
78
|
get value() {
|
|
74
79
|
return this.values.join(',');
|
|
75
80
|
}
|
|
@@ -86,8 +91,12 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
86
91
|
: boxes.filter((box) => box.checked).map((box) => box.value);
|
|
87
92
|
}
|
|
88
93
|
set values(next) {
|
|
94
|
+
this.choose(next);
|
|
95
|
+
}
|
|
96
|
+
choose(next, boxes) {
|
|
89
97
|
const previous = this.value;
|
|
90
98
|
this.declared = [...next];
|
|
99
|
+
this.checking = boxes ? new Set(boxes) : undefined;
|
|
91
100
|
this.pending = true;
|
|
92
101
|
this.requestUpdate('value', previous);
|
|
93
102
|
}
|
|
@@ -125,8 +134,10 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
125
134
|
}
|
|
126
135
|
this.pending = false;
|
|
127
136
|
const wanted = new Set(this.declared);
|
|
137
|
+
const checking = this.checking;
|
|
138
|
+
this.checking = undefined;
|
|
128
139
|
for (const box of boxes) {
|
|
129
|
-
box.checked = wanted.has(box.value);
|
|
140
|
+
box.checked = checking ? checking.has(box) : wanted.has(box.value);
|
|
130
141
|
}
|
|
131
142
|
}
|
|
132
143
|
connectedCallback() {
|
|
@@ -167,7 +178,7 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
167
178
|
}
|
|
168
179
|
validate() {
|
|
169
180
|
this.judged = this.value;
|
|
170
|
-
this.reportRequired(this.judged === '',
|
|
181
|
+
this.reportRequired(this.judged === '', this.valueMissingMessage, 'items');
|
|
171
182
|
}
|
|
172
183
|
updated(changed) {
|
|
173
184
|
super.updated(changed);
|
|
@@ -215,11 +226,16 @@ __decorate([
|
|
|
215
226
|
property({ attribute: 'select-all', type: Boolean })
|
|
216
227
|
], HelixHeadlessCheckboxGroup.prototype, "selectAll", void 0);
|
|
217
228
|
__decorate([
|
|
229
|
+
words,
|
|
218
230
|
property({ attribute: 'select-all-label' })
|
|
219
231
|
], HelixHeadlessCheckboxGroup.prototype, "selectAllLabel", void 0);
|
|
220
232
|
__decorate([
|
|
221
233
|
property()
|
|
222
234
|
], HelixHeadlessCheckboxGroup.prototype, "value", null);
|
|
235
|
+
__decorate([
|
|
236
|
+
words,
|
|
237
|
+
property({ attribute: 'value-missing-message' })
|
|
238
|
+
], HelixHeadlessCheckboxGroup.prototype, "valueMissingMessage", void 0);
|
|
223
239
|
__decorate([
|
|
224
240
|
property({ attribute: false })
|
|
225
241
|
], HelixHeadlessCheckboxGroup.prototype, "values", null);
|
|
@@ -19,3 +19,14 @@ export declare const selectAllState: (boxes: readonly SetBox[]) => {
|
|
|
19
19
|
checked: boolean;
|
|
20
20
|
indeterminate: boolean;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
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.
|
|
31
|
+
*/
|
|
32
|
+
export declare const selectAllPress: (boxes: readonly SetBox[]) => boolean[];
|
|
@@ -5,3 +5,8 @@ export const selectAllState = (boxes) => {
|
|
|
5
5
|
const checked = counted.length > 0 && ticked === counted.length;
|
|
6
6
|
return { checked, indeterminate: ticked > 0 && !checked };
|
|
7
7
|
};
|
|
8
|
+
export const selectAllPress = (boxes) => {
|
|
9
|
+
const enabled = boxes.filter((box) => !box.disabled);
|
|
10
|
+
const every = enabled.length > 0 && enabled.every((box) => box.checked);
|
|
11
|
+
return boxes.map((box) => (box.disabled ? box.checked : !every));
|
|
12
|
+
};
|
|
@@ -78,7 +78,7 @@ import '../../copy-button/index.js';
|
|
|
78
78
|
* @csspart gutter - The line numbers beside the code, shown when `line-numbers` is set.
|
|
79
79
|
* @csspart header - The bar that holds the name and the copy button, shown when there is a name.
|
|
80
80
|
* @csspart hunk - In a diff, a `@@` line saying where the lines under it are.
|
|
81
|
-
* @csspart label - The
|
|
81
|
+
* @csspart label - The block's name: its `label`, or its `language` where it has no label.
|
|
82
82
|
* @csspart marker - In a diff, the `+`, `-`, or space that starts a line.
|
|
83
83
|
* @csspart new - In a split diff, the new version's `<pre>`.
|
|
84
84
|
* @csspart number - In a diff, a line number.
|
|
@@ -90,6 +90,11 @@ import '../../copy-button/index.js';
|
|
|
90
90
|
* @cssstate expanded - The expand button has shown every line of a capped block.
|
|
91
91
|
*/
|
|
92
92
|
export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
93
|
+
/**
|
|
94
|
+
* The key this family's words are registered under, its styled tag:
|
|
95
|
+
* `registerWords('de', { 'helix-code-block': { copyLabel: 'Code kopieren' } })`.
|
|
96
|
+
*/
|
|
97
|
+
static words: string;
|
|
93
98
|
/**
|
|
94
99
|
* The expand button's words while the block shows every line.
|
|
95
100
|
*/
|
|
@@ -102,10 +107,15 @@ export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
102
107
|
* The copy button's name and tooltip text before a copy.
|
|
103
108
|
*
|
|
104
109
|
* Where the block has a name, the button says it too, such as "Copy code,
|
|
105
|
-
* app.ts", so each copy button on a page with
|
|
106
|
-
* In a diff, that is each file's own name.
|
|
110
|
+
* app.ts", as `copy-name-label` puts it, so each copy button on a page with
|
|
111
|
+
* several blocks is told apart. In a diff, that is each file's own name.
|
|
107
112
|
*/
|
|
108
113
|
copyLabel: string;
|
|
114
|
+
/**
|
|
115
|
+
* The copy button's name and tooltip text before a copy, where the block
|
|
116
|
+
* has a name. `{copy}` is `copy-label` and `{name}` the block's name.
|
|
117
|
+
*/
|
|
118
|
+
copyNameLabel: string;
|
|
109
119
|
/**
|
|
110
120
|
* Whether the content is a unified diff, drawn as the lines it changed.
|
|
111
121
|
*
|
|
@@ -151,18 +161,20 @@ export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
151
161
|
*/
|
|
152
162
|
highlight?: (code: string, language: string) => string;
|
|
153
163
|
/**
|
|
154
|
-
* The block's name, usually a file name
|
|
164
|
+
* The block's name, usually a file name, drawn in the header.
|
|
155
165
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
166
|
+
* Absent, the block is named by `language` where there is one. In a diff,
|
|
167
|
+
* each file is named from the patch, and this names a patch that carries no
|
|
168
|
+
* name of its own.
|
|
158
169
|
*/
|
|
159
170
|
label: string;
|
|
160
171
|
/**
|
|
161
172
|
* The language the code is written in, such as `ts` or `css`, handed to
|
|
162
173
|
* `highlight` as its second argument.
|
|
163
174
|
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
175
|
+
* A block with no `label` is named by it, in the header and on the copy
|
|
176
|
+
* button, as a docs site names a snippet by its language. Absent hands
|
|
177
|
+
* `highlight` an empty string and names nothing.
|
|
166
178
|
*/
|
|
167
179
|
language: string;
|
|
168
180
|
/**
|
|
@@ -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 { customElement, HelixElement } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, formatWords, HelixElement, words } from '@fusion.dev/helix-core';
|
|
8
8
|
import { nothing } from 'lit';
|
|
9
9
|
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
@@ -19,6 +19,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
19
19
|
this.collapseLabel = 'Show fewer lines';
|
|
20
20
|
this.copiedLabel = 'Copied';
|
|
21
21
|
this.copyLabel = 'Copy code';
|
|
22
|
+
this.copyNameLabel = '{copy}, {name}';
|
|
22
23
|
this.diff = false;
|
|
23
24
|
this.expandable = false;
|
|
24
25
|
this.expandLabel = 'Show all lines';
|
|
@@ -38,6 +39,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
}
|
|
42
|
+
static { this.words = 'helix-code-block'; }
|
|
41
43
|
get files() {
|
|
42
44
|
if (!this.diff) {
|
|
43
45
|
return [];
|
|
@@ -109,10 +111,11 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
109
111
|
const gutter = this.lineNumbers
|
|
110
112
|
? html `<span part="gutter" aria-hidden="true">${lines === 0 ? nothing : gutterNumbers(lines)}</span>`
|
|
111
113
|
: nothing;
|
|
112
|
-
|
|
114
|
+
const name = this.label || this.language;
|
|
115
|
+
return html `${this.renderHeader(name)}
|
|
113
116
|
<div part="frame">
|
|
114
117
|
<pre id="block" part="block">${gutter}${code}</pre>
|
|
115
|
-
${
|
|
118
|
+
${name ? nothing : this.renderCopy()}
|
|
116
119
|
</div>${this.renderExpand()}`;
|
|
117
120
|
}
|
|
118
121
|
renderExpand() {
|
|
@@ -140,7 +143,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
140
143
|
renderCopy(value, name) {
|
|
141
144
|
return this.noCopy ? nothing : this.renderCopyButton(value, name);
|
|
142
145
|
}
|
|
143
|
-
renderCopyButton(value = this.text, name = this.label) {
|
|
146
|
+
renderCopyButton(value = this.text, name = this.label || this.language) {
|
|
144
147
|
return html `<${this.tag('copy-button')}
|
|
145
148
|
part="copy"
|
|
146
149
|
exportparts="button: copy-button, text: copy-text, mark: copy-mark, live: copy-live, spinner: copy-spinner, tooltip: copy-tooltip,
|
|
@@ -149,7 +152,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
149
152
|
tooltip-arrow-top: copy-tooltip-arrow-top, tooltip-bottom: copy-tooltip-bottom,
|
|
150
153
|
tooltip-left: copy-tooltip-left, tooltip-right: copy-tooltip-right, tooltip-top: copy-tooltip-top"
|
|
151
154
|
copied-label=${this.copiedLabel}
|
|
152
|
-
label=${name ?
|
|
155
|
+
label=${name ? formatWords(this, 'copyNameLabel', { copy: this.copyLabel, name }) : this.copyLabel}
|
|
153
156
|
.value=${value}
|
|
154
157
|
></${this.tag('copy-button')}>`;
|
|
155
158
|
}
|
|
@@ -202,14 +205,21 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
202
205
|
}
|
|
203
206
|
};
|
|
204
207
|
__decorate([
|
|
208
|
+
words,
|
|
205
209
|
property({ attribute: 'collapse-label' })
|
|
206
210
|
], HelixHeadlessCodeBlock.prototype, "collapseLabel", void 0);
|
|
207
211
|
__decorate([
|
|
212
|
+
words,
|
|
208
213
|
property({ attribute: 'copied-label' })
|
|
209
214
|
], HelixHeadlessCodeBlock.prototype, "copiedLabel", void 0);
|
|
210
215
|
__decorate([
|
|
216
|
+
words,
|
|
211
217
|
property({ attribute: 'copy-label' })
|
|
212
218
|
], HelixHeadlessCodeBlock.prototype, "copyLabel", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
words,
|
|
221
|
+
property({ attribute: 'copy-name-label' })
|
|
222
|
+
], HelixHeadlessCodeBlock.prototype, "copyNameLabel", void 0);
|
|
213
223
|
__decorate([
|
|
214
224
|
property({ reflect: true, type: Boolean })
|
|
215
225
|
], HelixHeadlessCodeBlock.prototype, "diff", void 0);
|
|
@@ -217,6 +227,7 @@ __decorate([
|
|
|
217
227
|
property({ type: Boolean })
|
|
218
228
|
], HelixHeadlessCodeBlock.prototype, "expandable", void 0);
|
|
219
229
|
__decorate([
|
|
230
|
+
words,
|
|
220
231
|
property({ attribute: 'expand-label' })
|
|
221
232
|
], HelixHeadlessCodeBlock.prototype, "expandLabel", void 0);
|
|
222
233
|
__decorate([
|
|
@@ -115,6 +115,11 @@ declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fu
|
|
|
115
115
|
* @cssstate open - While the picker is open.
|
|
116
116
|
*/
|
|
117
117
|
export declare class HelixHeadlessColorInput extends HelixHeadlessColorInput_base {
|
|
118
|
+
/**
|
|
119
|
+
* The key this family's words are registered under, its styled tag:
|
|
120
|
+
* `registerWords('de', { 'helix-color-input': { triggerLabel: 'Farbe auswählen' } })`.
|
|
121
|
+
*/
|
|
122
|
+
static words: string;
|
|
118
123
|
protected readonly aria: AriaForwardController;
|
|
119
124
|
/**
|
|
120
125
|
* Whether the color carries an alpha channel.
|
|
@@ -180,6 +185,12 @@ export declare class HelixHeadlessColorInput extends HelixHeadlessColorInput_bas
|
|
|
180
185
|
* Colors offered under the picker, as a comma-separated list.
|
|
181
186
|
*/
|
|
182
187
|
swatches: string;
|
|
188
|
+
/**
|
|
189
|
+
* What the swatch says in `variant="swatch"`, after the field's label, once
|
|
190
|
+
* there is a color. `{name}` is the color's name, such as "vibrant red", and
|
|
191
|
+
* `{value}` the value as written.
|
|
192
|
+
*/
|
|
193
|
+
swatchLabel: string;
|
|
183
194
|
/**
|
|
184
195
|
* Accessible name for the control that opens the panel.
|
|
185
196
|
*/
|
|
@@ -232,6 +243,8 @@ export declare class HelixHeadlessColorInput extends HelixHeadlessColorInput_bas
|
|
|
232
243
|
* field. It carries `id="control"` there for the same reason.
|
|
233
244
|
*/
|
|
234
245
|
protected get anchor(): HTMLElement | null;
|
|
246
|
+
/** The swatch's words in `swatch`, which its label points at, and never drawn. */
|
|
247
|
+
private renderSwatchValue;
|
|
235
248
|
/** What the picker should show, which is only ever a color. */
|
|
236
249
|
private get picked();
|
|
237
250
|
/**
|