@fusion.dev/helix-headless 0.240.4 → 0.241.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/api.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/chat/root/chat-root.d.ts +23 -0
- package/dist/chat/root/chat-root.js +10 -1
- package/dist/column-manager/root/column-manager-root.d.ts +12 -1
- package/dist/column-manager/root/column-manager-root.js +18 -10
- package/dist/markdown/root/markdown-root.d.ts +1 -0
- package/dist/markdown/root/markdown-root.js +6 -1
- package/dist/markdown/tree.d.ts +4 -2
- package/dist/markdown/tree.js +7 -4
- package/dist/splitter/root/splitter-root.d.ts +44 -6
- package/dist/splitter/root/splitter-root.js +54 -10
- package/dist/table-export/root/table-export-root.d.ts +28 -11
- package/dist/table-export/root/table-export-root.js +49 -29
- package/dist/tree/item/tree-item.d.ts +30 -4
- package/dist/tree/item/tree-item.js +15 -6
- package/dist/view-panel/root/view-panel-root.d.ts +11 -3
- package/dist/view-panel/root/view-panel-root.js +18 -13
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +6 -6
- package/types/jsx.d.ts +99 -25
- package/types/vue.d.ts +33 -6
|
@@ -45,6 +45,14 @@ declare const HelixHeadlessChat_base: (new (...args: any[]) => import("@fusion.d
|
|
|
45
45
|
* set or older turns load, the log carries `aria-busy`, as the APG asks of a
|
|
46
46
|
* feed.
|
|
47
47
|
*
|
|
48
|
+
* **A conversation opening with nothing in it yet draws turns in outline.**
|
|
49
|
+
* While `loading` is set and there are no turns, the log holds two placeholder
|
|
50
|
+
* turns, one from `me` and a reply, drawn in a skeleton's fill where a
|
|
51
|
+
* message's bubble would be, so the transcript has the shape a conversation
|
|
52
|
+
* takes rather than a line of text that the first turns push away. They are
|
|
53
|
+
* hidden from screen readers, which hear `loading-text`. A server, which
|
|
54
|
+
* cannot know whether children will arrive, draws the line alone.
|
|
55
|
+
*
|
|
48
56
|
* The log is `aria-live="off"`. A separate status region announces each new
|
|
49
57
|
* turn once, when it has finished arriving. It skips the user's own turns
|
|
50
58
|
* unless they failed to send, turns loaded as history, and the turns already
|
|
@@ -172,6 +180,9 @@ declare const HelixHeadlessChat_base: (new (...args: any[]) => import("@fusion.d
|
|
|
172
180
|
* @csspart message-state - The state text of a turn from `turns`, when there is one to show.
|
|
173
181
|
* @csspart message-time - The time of a turn from `turns`.
|
|
174
182
|
* @csspart message-work - The box around a turn's `work`, for a turn from `turns`, which has none.
|
|
183
|
+
* @csspart placeholder - The turns drawn in outline while `loading` is set and there are none. Hidden from screen readers.
|
|
184
|
+
* @csspart placeholder-line - One line of text in a placeholder turn.
|
|
185
|
+
* @csspart placeholder-turn - One placeholder turn. The one from `me` carries `data-author="me"`.
|
|
175
186
|
* @csspart resume - The control shown while the user is scrolled away from the bottom.
|
|
176
187
|
* @csspart resume-button - The button the `resume` region shows when nothing is slotted into it.
|
|
177
188
|
* @csspart resume-mark - The arrow on the default `resume-button`.
|
|
@@ -687,6 +698,18 @@ export declare class HelixHeadlessChat extends HelixHeadlessChat_base {
|
|
|
687
698
|
* and is followed. Leaving is moving up from there.
|
|
688
699
|
*/
|
|
689
700
|
private readonly handleScroll;
|
|
701
|
+
/**
|
|
702
|
+
* Two turns in outline, while the conversation loads with none: one from `me`
|
|
703
|
+
* and a reply of three lines, as a conversation opens.
|
|
704
|
+
*
|
|
705
|
+
* Boxes of this element's own rather than messages and skeletons, which
|
|
706
|
+
* would each publish their parts through this one for a picture nobody
|
|
707
|
+
* reads. The styled tier draws them as a message's bubble and a skeleton's
|
|
708
|
+
* fill; here they are empty and draw nothing. Hidden from screen readers,
|
|
709
|
+
* which hear the loading words instead. A method, so a tier above can draw a
|
|
710
|
+
* different outline.
|
|
711
|
+
*/
|
|
712
|
+
protected renderPlaceholder(): TemplateResult;
|
|
690
713
|
/** The turns fed as data, a window of them, between the room the rest would take. */
|
|
691
714
|
private renderTurns;
|
|
692
715
|
/**
|
|
@@ -702,6 +702,14 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
702
702
|
}
|
|
703
703
|
return undefined;
|
|
704
704
|
}
|
|
705
|
+
renderPlaceholder() {
|
|
706
|
+
return html `<div part="placeholder" aria-hidden="true">
|
|
707
|
+
<div part="placeholder-turn" data-author="me"><span part="placeholder-line"></span></div>
|
|
708
|
+
<div part="placeholder-turn">
|
|
709
|
+
<span part="placeholder-line"></span><span part="placeholder-line"></span><span part="placeholder-line"></span>
|
|
710
|
+
</div>
|
|
711
|
+
</div>`;
|
|
712
|
+
}
|
|
705
713
|
renderTurns() {
|
|
706
714
|
const { after, before, first, last } = this.virtualize.window;
|
|
707
715
|
const message = this.tag('chat-message');
|
|
@@ -741,6 +749,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
741
749
|
const fed = this.fed;
|
|
742
750
|
const titled = this.has('header') || this.has('actions');
|
|
743
751
|
const busy = this.loading || this.history === 'loading';
|
|
752
|
+
const turned = fed || this.messages.length > 0 || !this.childrenKnown;
|
|
744
753
|
return html `<div part="header" ?hidden=${!titled}>
|
|
745
754
|
<slot name="header"></slot>
|
|
746
755
|
<span part="actions" ?hidden=${!this.has('actions')}>
|
|
@@ -760,7 +769,7 @@ let HelixHeadlessChat = class HelixHeadlessChat extends MixinCollection(HelixEle
|
|
|
760
769
|
${this.history === 'loading' ? html `<p part="history">${this.historyText}</p>` : nothing}
|
|
761
770
|
${fed ? this.renderTurns() : nothing}
|
|
762
771
|
<slot name="messages" @slotchange=${this.handleSlotChange}></slot>
|
|
763
|
-
${this.renderStatus(
|
|
772
|
+
${this.renderStatus(turned)}${this.loading && !turned ? this.renderPlaceholder() : nothing}
|
|
764
773
|
</div>
|
|
765
774
|
<span part="live" role="status">${keyed(this.said, this.announcement)}</span>
|
|
766
775
|
<div part="resume" ?hidden=${!away} @click=${this.handleResume}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type TemplateResult } from 'lit';
|
|
3
3
|
import { TableBinding, type ToolColumn, type ToolTable } from '../../data-table/binding.js';
|
|
4
|
+
import '../../checkbox/index.js';
|
|
4
5
|
/**
|
|
5
6
|
* @summary A list of a Data Table's columns, to show, hide, reorder, and pin them.
|
|
6
7
|
*
|
|
@@ -46,7 +47,17 @@ import { TableBinding, type ToolColumn, type ToolTable } from '../../data-table/
|
|
|
46
47
|
* @aliases Column picker, Column chooser
|
|
47
48
|
* @documentation https://fusion.dev/helix/components/column-manager
|
|
48
49
|
*
|
|
49
|
-
* @csspart checkbox - The
|
|
50
|
+
* @csspart checkbox - The `Checkbox` that shows or hides a column.
|
|
51
|
+
* @csspart checkbox-box - The box drawn for a row's checkbox.
|
|
52
|
+
* @csspart checkbox-control - The native input inside a row's checkbox.
|
|
53
|
+
* @csspart checkbox-feedback - Forwarded from the checkbox. Not shown, since a column's box is never wrong.
|
|
54
|
+
* @csspart checkbox-field - The row inside a checkbox that holds its box and the column's name.
|
|
55
|
+
* @csspart checkbox-hint - Forwarded from the checkbox. Not shown, since a column's box has no help.
|
|
56
|
+
* @csspart checkbox-label - The label beside a row's box, which holds `name`.
|
|
57
|
+
* @csspart checkbox-mark - The check mark on a row's box.
|
|
58
|
+
* @csspart checkbox-mark-checked - Added to `checkbox-mark` while the column shows.
|
|
59
|
+
* @csspart checkbox-mark-dash - Forwarded from the checkbox. Not shown, since a column is shown or hidden.
|
|
60
|
+
* @csspart checkbox-mark-indeterminate - Forwarded from the checkbox. Not shown, since a column is shown or hidden.
|
|
50
61
|
* @csspart grip - The button that moves a column.
|
|
51
62
|
* @csspart grip-mark - The icon on the grip.
|
|
52
63
|
* @csspart header - The row above the list that holds the title and the reset button.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { customElement, formatWords, HelixElement, words } from '@fusion.dev/helix-core';
|
|
2
|
+
import { customElement, formatWords, HelixElement, words, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { dotsSixVertical, pushPin, pushPinSlash } from '@fusion.dev/helix-icons';
|
|
4
|
-
import {
|
|
4
|
+
import { nothing } from 'lit';
|
|
5
5
|
import { property, state } from 'lit/decorators.js';
|
|
6
6
|
import { repeat } from 'lit/directives/repeat.js';
|
|
7
7
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
8
|
+
import { html } from 'lit/static-html.js';
|
|
8
9
|
import { columnName, TableBinding, } from '../../data-table/binding.js';
|
|
10
|
+
import '../../checkbox/index.js';
|
|
9
11
|
const nextPin = (now) => now === undefined ? 'start' : now === 'start' ? 'end' : undefined;
|
|
10
12
|
let HelixHeadlessColumnManager = class HelixHeadlessColumnManager extends HelixElement {
|
|
11
13
|
constructor() {
|
|
@@ -152,6 +154,7 @@ let HelixHeadlessColumnManager = class HelixHeadlessColumnManager extends HelixE
|
|
|
152
154
|
const note = pin ? this.pinnedLabel : dropped ? this.droppedLabel : '';
|
|
153
155
|
const pinName = pin === 'start' ? 'pinEndLabel' : pin === 'end' ? 'unpinLabel' : 'pinStartLabel';
|
|
154
156
|
const icon = pin === 'end' ? pushPinSlash : pushPin;
|
|
157
|
+
const checkbox = this.tag('checkbox');
|
|
155
158
|
return html `<li
|
|
156
159
|
part="item${this.dragging === field ? ' item-dragging' : ''}${shown ? '' : ' item-hidden'}"
|
|
157
160
|
data-field=${field}
|
|
@@ -164,14 +167,19 @@ let HelixHeadlessColumnManager = class HelixHeadlessColumnManager extends HelixE
|
|
|
164
167
|
>
|
|
165
168
|
<button part="grip" type="button" aria-label=${formatWords(this, 'moveLabel', { name })}
|
|
166
169
|
><svg aria-hidden="true" fill="currentColor" part="grip-mark" viewBox=${dotsSixVertical.viewBox}>${unsafeSVG(dotsSixVertical.content)}</svg></button
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
><${checkbox}
|
|
171
|
+
part="checkbox"
|
|
172
|
+
exportparts="box: checkbox-box, control: checkbox-control, feedback: checkbox-feedback,
|
|
173
|
+
field: checkbox-field, hint: checkbox-hint, label: checkbox-label, mark: checkbox-mark,
|
|
174
|
+
mark-checked: checkbox-mark-checked, mark-dash: checkbox-mark-dash,
|
|
175
|
+
mark-indeterminate: checkbox-mark-indeterminate"
|
|
176
|
+
.checked=${shown}
|
|
177
|
+
?disabled=${shown && onlyShown}
|
|
178
|
+
@helix-before-check=${(event) => {
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
this.toggleColumn(field, event.detail.checked);
|
|
181
|
+
}}
|
|
182
|
+
><span part="name">${name}</span></${checkbox}
|
|
175
183
|
>${note ? html `<span part="note">${note}</span>` : nothing}<button
|
|
176
184
|
part="pin${pin ? ' pin-pinned' : ''}"
|
|
177
185
|
type="button"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type CSSResultGroup, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../callout/index.js';
|
|
4
|
+
import '../../checkbox/index.js';
|
|
4
5
|
import '../../code-block/index.js';
|
|
5
6
|
/**
|
|
6
7
|
* @summary Markdown drawn as a document, which streams in place as a reply arrives.
|
|
@@ -3,6 +3,7 @@ import { customElement, HelixElement, internalsOf, words } from '@fusion.dev/hel
|
|
|
3
3
|
import { css, html } from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
5
|
import '../../callout/index.js';
|
|
6
|
+
import '../../checkbox/index.js';
|
|
6
7
|
import '../../code-block/index.js';
|
|
7
8
|
import { MarkdownWriter } from '../writer.js';
|
|
8
9
|
let HelixHeadlessMarkdown = class HelixHeadlessMarkdown extends HelixElement {
|
|
@@ -45,7 +46,11 @@ let HelixHeadlessMarkdown = class HelixHeadlessMarkdown extends HelixElement {
|
|
|
45
46
|
tip: this.tipHeading,
|
|
46
47
|
warning: this.warningHeading,
|
|
47
48
|
},
|
|
48
|
-
tags: {
|
|
49
|
+
tags: {
|
|
50
|
+
callout: `${tier}callout`,
|
|
51
|
+
checkbox: `${tier}checkbox`,
|
|
52
|
+
codeBlock: `${tier}code-block`,
|
|
53
|
+
},
|
|
49
54
|
};
|
|
50
55
|
if (!this.writer) {
|
|
51
56
|
this.writer = new MarkdownWriter(this, options);
|
package/dist/markdown/tree.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ export interface MarkdownOptions {
|
|
|
12
12
|
/** Each alert's heading by its kind. English by default. */
|
|
13
13
|
headings?: Partial<Record<MarkdownAlertKind, string>> | undefined;
|
|
14
14
|
/**
|
|
15
|
-
* The tags for a fence and
|
|
16
|
-
* `helix-code-block` and `helix-
|
|
15
|
+
* The tags for a fence, an alert and a task's box, which name the tier they
|
|
16
|
+
* are drawn in. `helix-code-block`, `helix-callout` and `helix-checkbox` by
|
|
17
|
+
* default.
|
|
17
18
|
*/
|
|
18
19
|
tags?: Partial<MarkdownTags> | undefined;
|
|
19
20
|
}
|
|
@@ -25,6 +26,7 @@ export interface MarkdownFilled {
|
|
|
25
26
|
/** The elements a document draws from another family. */
|
|
26
27
|
export interface MarkdownTags {
|
|
27
28
|
callout: string;
|
|
29
|
+
checkbox: string;
|
|
28
30
|
codeBlock: string;
|
|
29
31
|
}
|
|
30
32
|
/**
|
package/dist/markdown/tree.js
CHANGED
|
@@ -76,9 +76,7 @@ const itemNode = (item, open, options) => {
|
|
|
76
76
|
if (item.checked === undefined) {
|
|
77
77
|
return element('li', [...lead, ...tail]);
|
|
78
78
|
}
|
|
79
|
-
const box = element(
|
|
80
|
-
? { checked: '', disabled: '', type: 'checkbox' }
|
|
81
|
-
: { disabled: '', type: 'checkbox' });
|
|
79
|
+
const box = element(options.tags.checkbox, [], item.checked ? { checked: '', readonly: '' } : { readonly: '' });
|
|
82
80
|
return element('li', [box, ' ', ...lead, ...tail], { 'data-task': '' });
|
|
83
81
|
};
|
|
84
82
|
export const blockNode = (block, open, options) => {
|
|
@@ -118,7 +116,12 @@ export const blockNode = (block, open, options) => {
|
|
|
118
116
|
};
|
|
119
117
|
export const withDefaults = (options = {}) => ({
|
|
120
118
|
headings: { ...HEADINGS, ...options.headings },
|
|
121
|
-
tags: {
|
|
119
|
+
tags: {
|
|
120
|
+
callout: 'helix-callout',
|
|
121
|
+
checkbox: 'helix-checkbox',
|
|
122
|
+
codeBlock: 'helix-code-block',
|
|
123
|
+
...options.tags,
|
|
124
|
+
},
|
|
122
125
|
});
|
|
123
126
|
export const markdownNodes = (text, options = {}) => {
|
|
124
127
|
const filled = withDefaults(options);
|
|
@@ -34,6 +34,11 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
34
34
|
* `min` is the least the start pane keeps and `end-min` the least the end pane
|
|
35
35
|
* keeps, each a percentage or a CSS length such as `16rem`.
|
|
36
36
|
*
|
|
37
|
+
* `position` and `default-position` take a length as well as a percentage,
|
|
38
|
+
* such as `280px`, which is the start pane's size. The stylesheet places it
|
|
39
|
+
* with nothing measured, so the divider is where it belongs from the first
|
|
40
|
+
* paint, and the start pane keeps that size as the splitter's own size changes.
|
|
41
|
+
*
|
|
37
42
|
* Set `primary` to the pane that keeps its size when the splitter's own size
|
|
38
43
|
* changes, such as a sidebar beside a window being resized. The other pane
|
|
39
44
|
* takes all of the change, as Web Awesome's split panel does. Without it,
|
|
@@ -78,7 +83,7 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
78
83
|
* @csspart start - The box that holds the first pane.
|
|
79
84
|
*
|
|
80
85
|
* @cssproperty --splitter-corner-at - Where a nested splitter crosses this one, as a percentage.
|
|
81
|
-
* @cssproperty --splitter-position - Where the divider sits
|
|
86
|
+
* @cssproperty --splitter-position - Where the divider sits: a percentage of the box, or, for a position written as a length, that length held between `min` and `max`.
|
|
82
87
|
*
|
|
83
88
|
* @cssstate collapsed - While a pane is shut. `data-collapsed` on the host says which.
|
|
84
89
|
* @cssstate dragging - While the pointer or a corner holds the divider.
|
|
@@ -151,9 +156,10 @@ export declare class HelixHeadlessSplitter extends HelixElement {
|
|
|
151
156
|
*/
|
|
152
157
|
defaultCollapsed?: 'end' | 'start';
|
|
153
158
|
/**
|
|
154
|
-
* Where the divider starts, when `position` is not set
|
|
159
|
+
* Where the divider starts, when `position` is not set: a percentage, or a
|
|
160
|
+
* length such as `280px`, as `position` takes.
|
|
155
161
|
*/
|
|
156
|
-
defaultPosition: number;
|
|
162
|
+
defaultPosition: number | string;
|
|
157
163
|
/**
|
|
158
164
|
* The least the end pane keeps, in the units `min` takes: a percentage, or
|
|
159
165
|
* a CSS length such as `16rem` resolved against the splitter's box. The
|
|
@@ -244,9 +250,22 @@ export declare class HelixHeadlessSplitter extends HelixElement {
|
|
|
244
250
|
* Reading gives where it is; writing declares it the consumer's, and
|
|
245
251
|
* `default-position` seeds one this element owns. The same accessor pair
|
|
246
252
|
* `Pagination.page` and the calendar's `month` carry.
|
|
253
|
+
*
|
|
254
|
+
* **Written as a length, such as `280px` or `16rem`, it is the start pane's
|
|
255
|
+
* size**, which the stylesheet lays out as written, between `min` and `max`.
|
|
256
|
+
* Nothing is measured to place it, so it is where it belongs on the first
|
|
257
|
+
* paint and in the server's markup, and it keeps its size as the splitter's
|
|
258
|
+
* own size changes. A percentage is drawn only once the splitter knows its
|
|
259
|
+
* box, so a sidebar of a fixed width written as one is drawn at some other
|
|
260
|
+
* width first and corrected, which a browser counts as a layout shift.
|
|
261
|
+
*
|
|
262
|
+
* Reading always gives a percentage, measured against the box, and 50 where
|
|
263
|
+
* there is no box yet. A drag, a key or a double click settles on a
|
|
264
|
+
* percentage, and `helix-resized` carries one: a consumer keeping a length
|
|
265
|
+
* converts it and writes the length back.
|
|
247
266
|
*/
|
|
248
267
|
get position(): number;
|
|
249
|
-
set position(next: number);
|
|
268
|
+
set position(next: number | string);
|
|
250
269
|
/**
|
|
251
270
|
* The pane that keeps its size when the splitter's own size changes. The
|
|
252
271
|
* other pane takes all of the change. Unset, both keep their share.
|
|
@@ -272,8 +291,16 @@ export declare class HelixHeadlessSplitter extends HelixElement {
|
|
|
272
291
|
/** The length along the axis last seen, in pixels. */
|
|
273
292
|
private length;
|
|
274
293
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
294
|
+
* Whether the position or a bound is written as a length, which reads as a
|
|
295
|
+
* different percentage at every length of the splitter.
|
|
296
|
+
*/
|
|
297
|
+
private get inLengths();
|
|
298
|
+
/**
|
|
299
|
+
* Starts or stops watching the length, according to `primary` and to
|
|
300
|
+
* whether anything is written as a length. It holds the primary pane's
|
|
301
|
+
* size in pixels as the length changes, and, where something is written as
|
|
302
|
+
* a length, draws the divider again, so the percentage it announces is the
|
|
303
|
+
* one it is drawn at.
|
|
277
304
|
*/
|
|
278
305
|
private watchLength;
|
|
279
306
|
/**
|
|
@@ -305,6 +332,17 @@ export declare class HelixHeadlessSplitter extends HelixElement {
|
|
|
305
332
|
step: number;
|
|
306
333
|
/** The position, whoever set it, and `undefined` until somebody has. */
|
|
307
334
|
private positionState;
|
|
335
|
+
/** The position as it was written, by whoever wrote it last. */
|
|
336
|
+
private get declared();
|
|
337
|
+
/**
|
|
338
|
+
* The position as the stylesheet takes it, in `--splitter-position`.
|
|
339
|
+
*
|
|
340
|
+
* A length stays a length, held between `min` and `max` by CSS rather than by
|
|
341
|
+
* a measurement, so the browser places the divider with nothing to correct.
|
|
342
|
+
* Everything else is the percentage `showing` gives: a drag in progress, a
|
|
343
|
+
* shut pane, and a position written as a percentage.
|
|
344
|
+
*/
|
|
345
|
+
private get drawn();
|
|
308
346
|
/** The collapse, whoever set it, and `undefined` until somebody has. */
|
|
309
347
|
private collapsedState;
|
|
310
348
|
/**
|
|
@@ -6,6 +6,21 @@ import { property, state } from 'lit/decorators.js';
|
|
|
6
6
|
import { HelixBeforeCollapseEvent, HelixCollapseEvent } from '../events/index.js';
|
|
7
7
|
import { snapTo } from '../snap.js';
|
|
8
8
|
const STACK_BELOW = 512;
|
|
9
|
+
const LENGTH = /^(-?[\d.]+)(em|px|rem)$/;
|
|
10
|
+
const isLength = (value) => typeof value === 'string' && LENGTH.test(value.trim());
|
|
11
|
+
const asCss = (value, fallback) => {
|
|
12
|
+
if (isLength(value)) {
|
|
13
|
+
return String(value).trim();
|
|
14
|
+
}
|
|
15
|
+
const percent = typeof value === 'number' ? value : value.trim() === '' ? Number.NaN : Number(value);
|
|
16
|
+
return Number.isFinite(percent) ? `${percent}%` : fallback;
|
|
17
|
+
};
|
|
18
|
+
const positionConverter = (attribute, fallback) => {
|
|
19
|
+
const numbers = numberConverter(attribute, fallback);
|
|
20
|
+
return {
|
|
21
|
+
fromAttribute: (value) => value !== null && isLength(value) ? value.trim() : numbers.fromAttribute?.(value),
|
|
22
|
+
};
|
|
23
|
+
};
|
|
9
24
|
const channel = new WeakMap();
|
|
10
25
|
const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
11
26
|
let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
@@ -36,7 +51,7 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
36
51
|
if (Number.isFinite(bare)) {
|
|
37
52
|
return bare;
|
|
38
53
|
}
|
|
39
|
-
const length =
|
|
54
|
+
const length = LENGTH.exec(text);
|
|
40
55
|
if (!length || typeof window === 'undefined') {
|
|
41
56
|
return fallback;
|
|
42
57
|
}
|
|
@@ -59,11 +74,15 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
59
74
|
if (shut) {
|
|
60
75
|
return shut === 'start' ? this.sliver : 100 - this.sliver;
|
|
61
76
|
}
|
|
62
|
-
return this.clamp(this.
|
|
77
|
+
return this.clamp(this.toPercent(this.declared, 50));
|
|
63
78
|
}
|
|
64
79
|
set position(next) {
|
|
65
80
|
const previous = this.position;
|
|
81
|
+
const written = this.declared;
|
|
66
82
|
this.positionState = next;
|
|
83
|
+
if (next !== written) {
|
|
84
|
+
this.requestUpdate();
|
|
85
|
+
}
|
|
67
86
|
this.reached = undefined;
|
|
68
87
|
this.requestUpdate('position', previous);
|
|
69
88
|
}
|
|
@@ -74,8 +93,11 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
74
93
|
const box = this.chain?.by.getBoundingClientRect();
|
|
75
94
|
return box ? (this.vertical ? box.height : box.width) : 0;
|
|
76
95
|
}
|
|
96
|
+
get inLengths() {
|
|
97
|
+
return [this.declared, this.min, this.max, this.endMin].some(isLength);
|
|
98
|
+
}
|
|
77
99
|
watchLength() {
|
|
78
|
-
if (!this.held || typeof ResizeObserver === 'undefined') {
|
|
100
|
+
if ((!this.held && !this.inLengths) || typeof ResizeObserver === 'undefined') {
|
|
79
101
|
this.lengths?.disconnect();
|
|
80
102
|
this.lengths = undefined;
|
|
81
103
|
this.length = 0;
|
|
@@ -89,7 +111,11 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
89
111
|
const length = (this.vertical
|
|
90
112
|
? (box?.blockSize ?? entry?.contentRect.height)
|
|
91
113
|
: (box?.inlineSize ?? entry?.contentRect.width)) ?? 0;
|
|
114
|
+
const before = this.length;
|
|
92
115
|
this.holdPrimary(length);
|
|
116
|
+
if (this.inLengths && length !== before) {
|
|
117
|
+
this.requestUpdate();
|
|
118
|
+
}
|
|
93
119
|
});
|
|
94
120
|
this.lengths.observe(this);
|
|
95
121
|
}
|
|
@@ -111,6 +137,9 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
111
137
|
if (this.collapsed || this.dragging) {
|
|
112
138
|
return;
|
|
113
139
|
}
|
|
140
|
+
if (held === 'start' && isLength(this.declared)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
114
143
|
const position = this.position;
|
|
115
144
|
const kept = ((held === 'start' ? position : 100 - position) / 100) * before;
|
|
116
145
|
const share = (kept / length) * 100;
|
|
@@ -118,6 +147,18 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
118
147
|
this.positionState = this.clamp(held === 'start' ? share : 100 - share);
|
|
119
148
|
this.requestUpdate('position', previous);
|
|
120
149
|
}
|
|
150
|
+
get declared() {
|
|
151
|
+
return this.positionState ?? this.defaultPosition;
|
|
152
|
+
}
|
|
153
|
+
get drawn() {
|
|
154
|
+
const declared = this.declared;
|
|
155
|
+
if (this.reached !== undefined || this.collapsed || !isLength(declared)) {
|
|
156
|
+
return `${this.showing}%`;
|
|
157
|
+
}
|
|
158
|
+
const least = `max(0%, ${asCss(this.min, '0%')})`;
|
|
159
|
+
const most = `min(100%, ${asCss(this.max, '100%')}, calc(100% - ${asCss(this.endMin, '0%')}))`;
|
|
160
|
+
return `clamp(${least}, ${String(declared).trim()}, ${most})`;
|
|
161
|
+
}
|
|
121
162
|
get showing() {
|
|
122
163
|
return this.reached === undefined ? this.position : this.clamp(this.reached);
|
|
123
164
|
}
|
|
@@ -262,7 +303,7 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
262
303
|
if (opened !== undefined) {
|
|
263
304
|
this.positionState = opened;
|
|
264
305
|
}
|
|
265
|
-
else if (this.shutAt(this.clamp(this.
|
|
306
|
+
else if (this.shutAt(this.clamp(this.toPercent(this.declared, 50)))) {
|
|
266
307
|
this.positionState = this.defaultPosition;
|
|
267
308
|
}
|
|
268
309
|
this.collapsedState = value === '' ? 'none' : value;
|
|
@@ -275,8 +316,11 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
275
316
|
});
|
|
276
317
|
}
|
|
277
318
|
reset() {
|
|
278
|
-
const home = this.clamp(this.defaultPosition);
|
|
319
|
+
const home = this.clamp(this.toPercent(this.defaultPosition, 50));
|
|
279
320
|
this.settle(home);
|
|
321
|
+
if (this.positionState === home && isLength(this.defaultPosition)) {
|
|
322
|
+
this.positionState = this.defaultPosition;
|
|
323
|
+
}
|
|
280
324
|
}
|
|
281
325
|
constructor() {
|
|
282
326
|
super();
|
|
@@ -576,7 +620,7 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
576
620
|
if (changed.has('orientation')) {
|
|
577
621
|
this.watchWidth();
|
|
578
622
|
}
|
|
579
|
-
if (changed.has(
|
|
623
|
+
if (['primary', 'position', 'defaultPosition', 'min', 'max', 'endMin'].some((key) => changed.has(key))) {
|
|
580
624
|
this.watchLength();
|
|
581
625
|
}
|
|
582
626
|
if (this.collapsed) {
|
|
@@ -610,7 +654,7 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
610
654
|
id="start"
|
|
611
655
|
?data-dragging=${this.dragging}
|
|
612
656
|
?inert=${shut === 'start'}
|
|
613
|
-
style="--splitter-position: ${
|
|
657
|
+
style="--splitter-position: ${this.drawn}"
|
|
614
658
|
>
|
|
615
659
|
<slot name="start"></slot>
|
|
616
660
|
</div>
|
|
@@ -654,7 +698,7 @@ let HelixHeadlessSplitter = class HelixHeadlessSplitter extends HelixElement {
|
|
|
654
698
|
aria-valuenow=${Math.round(crossing.at)}
|
|
655
699
|
aria-valuetext=${this.cornerWords(position, crossing.at)}
|
|
656
700
|
data-cross=${index}
|
|
657
|
-
style="--splitter-corner-at: ${crossing.at}%; --splitter-position: ${
|
|
701
|
+
style="--splitter-corner-at: ${crossing.at}%; --splitter-position: ${this.drawn}"
|
|
658
702
|
@dblclick=${this.handleCornerDoubleClick}
|
|
659
703
|
@keydown=${this.handleCornerKeydown}
|
|
660
704
|
@pointercancel=${this.handleCornerUp}
|
|
@@ -689,7 +733,7 @@ __decorate([
|
|
|
689
733
|
property({ attribute: 'default-collapsed' })
|
|
690
734
|
], HelixHeadlessSplitter.prototype, "defaultCollapsed", void 0);
|
|
691
735
|
__decorate([
|
|
692
|
-
property({ attribute: 'default-position', converter:
|
|
736
|
+
property({ attribute: 'default-position', converter: positionConverter('default-position', 50) })
|
|
693
737
|
], HelixHeadlessSplitter.prototype, "defaultPosition", void 0);
|
|
694
738
|
__decorate([
|
|
695
739
|
property({ attribute: 'end-min' })
|
|
@@ -711,7 +755,7 @@ __decorate([
|
|
|
711
755
|
property({ reflect: true })
|
|
712
756
|
], HelixHeadlessSplitter.prototype, "orientation", void 0);
|
|
713
757
|
__decorate([
|
|
714
|
-
property({ converter:
|
|
758
|
+
property({ converter: positionConverter('position', undefined) })
|
|
715
759
|
], HelixHeadlessSplitter.prototype, "position", null);
|
|
716
760
|
__decorate([
|
|
717
761
|
property()
|
|
@@ -3,6 +3,7 @@ import { type TemplateResult } from 'lit';
|
|
|
3
3
|
import { TableBinding, type ToolTable } from '../../data-table/binding.js';
|
|
4
4
|
import type { ExportColumns, ExportFormat, ExportRows, ExportValues } from '../../data-table/export.js';
|
|
5
5
|
import '../../button/index.js';
|
|
6
|
+
import '../../radio/index.js';
|
|
6
7
|
/** The choices as they stand. */
|
|
7
8
|
interface ExportChoices {
|
|
8
9
|
columns: ExportColumns;
|
|
@@ -40,10 +41,16 @@ interface ExportChoices {
|
|
|
40
41
|
* @documentation https://fusion.dev/helix/components/table-export
|
|
41
42
|
*
|
|
42
43
|
* @csspart actions - The row that holds Copy and Export.
|
|
43
|
-
* @csspart choice - One choice
|
|
44
|
+
* @csspart choice - One choice, a `Radio`.
|
|
45
|
+
* @csspart choice-box - The circle of a choice's `Radio`.
|
|
44
46
|
* @csspart choice-checked - Added to `choice` while it is chosen.
|
|
45
|
-
* @csspart choice-
|
|
46
|
-
* @csspart
|
|
47
|
+
* @csspart choice-item - The button of a choice's `Radio`, which covers it.
|
|
48
|
+
* @csspart choice-label - The words of a choice's `Radio`.
|
|
49
|
+
* @csspart columns - The `Radio Group` that chooses the columns.
|
|
50
|
+
* @csspart columns-feedback - Forwarded from the radio group. Not shown, since a choice of columns is never wrong.
|
|
51
|
+
* @csspart columns-hint - Forwarded from the radio group. Not shown, since the columns have no help.
|
|
52
|
+
* @csspart columns-items - The column choices inside `columns`.
|
|
53
|
+
* @csspart columns-label - The name of `columns`.
|
|
47
54
|
* @csspart copy - The button that copies the rows.
|
|
48
55
|
* @csspart copy-button - Forwarded from the button: the button inside `copy`.
|
|
49
56
|
* @csspart copy-live - Forwarded from the button. Not shown in the panel, whose buttons do not load.
|
|
@@ -54,12 +61,22 @@ interface ExportChoices {
|
|
|
54
61
|
* @csspart export-live - Forwarded from the button. Not shown in the panel, whose buttons do not load.
|
|
55
62
|
* @csspart export-spinner - Forwarded from the button. Not shown in the panel, whose buttons do not load.
|
|
56
63
|
* @csspart export-text - Forwarded from the button: the words inside `export`.
|
|
57
|
-
* @csspart format - The
|
|
58
|
-
* @csspart
|
|
64
|
+
* @csspart format - The `Radio Group` that chooses the format.
|
|
65
|
+
* @csspart format-feedback - Forwarded from the radio group. Not shown, since a choice of format is never wrong.
|
|
66
|
+
* @csspart format-hint - Forwarded from the radio group. Not shown, since the format has no help.
|
|
67
|
+
* @csspart format-items - The format choices inside `format`.
|
|
68
|
+
* @csspart format-label - The name of `format`.
|
|
59
69
|
* @csspart live - The region that says the rows were copied. Visually hidden in the styled tier.
|
|
60
|
-
* @csspart
|
|
61
|
-
* @csspart rows -
|
|
62
|
-
* @csspart
|
|
70
|
+
* @csspart rows - The `Radio Group` that chooses the rows.
|
|
71
|
+
* @csspart rows-feedback - Forwarded from the radio group. Not shown, since a choice of rows is never wrong.
|
|
72
|
+
* @csspart rows-hint - Forwarded from the radio group. Not shown, since the rows have no help.
|
|
73
|
+
* @csspart rows-items - The row choices inside `rows`.
|
|
74
|
+
* @csspart rows-label - The name of `rows`.
|
|
75
|
+
* @csspart values - The `Radio Group` that chooses the values.
|
|
76
|
+
* @csspart values-feedback - Forwarded from the radio group. Not shown, since a choice of values is never wrong.
|
|
77
|
+
* @csspart values-hint - Forwarded from the radio group. Not shown, since the values have no help.
|
|
78
|
+
* @csspart values-items - The value choices inside `values`.
|
|
79
|
+
* @csspart values-label - The name of `values`.
|
|
63
80
|
*/
|
|
64
81
|
export declare class HelixHeadlessTableExport extends HelixElement {
|
|
65
82
|
/**
|
|
@@ -115,11 +132,11 @@ export declare class HelixHeadlessTableExport extends HelixElement {
|
|
|
115
132
|
export(): boolean;
|
|
116
133
|
/** Copies the rows as TSV, as Copy does. */
|
|
117
134
|
copy(): Promise<boolean>;
|
|
118
|
-
/** The choices of one group, each a
|
|
119
|
-
protected renderChoices<T extends string>(
|
|
135
|
+
/** The choices of one group, each a `Radio`. */
|
|
136
|
+
protected renderChoices<T extends string>(current: T, choices: readonly {
|
|
120
137
|
label: string;
|
|
121
138
|
value: T;
|
|
122
|
-
}[]
|
|
139
|
+
}[]): TemplateResult[];
|
|
123
140
|
/** Copy and Export, as this tier's buttons. */
|
|
124
141
|
protected renderActions(count: number, found: boolean): TemplateResult;
|
|
125
142
|
protected render(): TemplateResult;
|