@fusion.dev/helix-headless 0.238.1 → 0.240.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.
Files changed (93) hide show
  1. package/api.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/column-manager/index.d.ts +1 -0
  4. package/dist/column-manager/index.js +1 -0
  5. package/dist/column-manager/root/column-manager-root.d.ts +137 -0
  6. package/dist/column-manager/root/column-manager-root.js +253 -0
  7. package/dist/data-table/binding.d.ts +85 -0
  8. package/dist/data-table/binding.js +58 -0
  9. package/dist/data-table/edit.d.ts +47 -0
  10. package/dist/data-table/edit.js +60 -0
  11. package/dist/data-table/events/before-cell-commit.d.ts +16 -0
  12. package/dist/data-table/events/before-cell-commit.js +11 -0
  13. package/dist/data-table/events/before-cell-edit.d.ts +13 -0
  14. package/dist/data-table/events/before-cell-edit.js +11 -0
  15. package/dist/data-table/events/before-export.d.ts +15 -0
  16. package/dist/data-table/events/before-export.js +11 -0
  17. package/dist/data-table/events/before-view-change.d.ts +16 -0
  18. package/dist/data-table/events/before-view-change.js +11 -0
  19. package/dist/data-table/events/cell-commit.d.ts +12 -0
  20. package/dist/data-table/events/cell-commit.js +11 -0
  21. package/dist/data-table/events/cell-edit.d.ts +11 -0
  22. package/dist/data-table/events/cell-edit.js +11 -0
  23. package/dist/data-table/events/details.d.ts +47 -0
  24. package/dist/data-table/events/export.d.ts +11 -0
  25. package/dist/data-table/events/export.js +11 -0
  26. package/dist/data-table/events/index.d.ts +18 -2
  27. package/dist/data-table/events/index.js +17 -1
  28. package/dist/data-table/events/view-change.d.ts +12 -0
  29. package/dist/data-table/events/view-change.js +11 -0
  30. package/dist/data-table/export.d.ts +43 -0
  31. package/dist/data-table/export.js +26 -0
  32. package/dist/data-table/index.d.ts +2 -0
  33. package/dist/data-table/index.js +2 -0
  34. package/dist/data-table/root/data-table-root.d.ts +406 -26
  35. package/dist/data-table/root/data-table-root.js +959 -30
  36. package/dist/data-table/view.d.ts +124 -0
  37. package/dist/data-table/view.js +249 -0
  38. package/dist/data-table/xlsx/index.d.ts +27 -0
  39. package/dist/data-table/xlsx/index.js +119 -0
  40. package/dist/date-input/root/date-input-root.d.ts +7 -0
  41. package/dist/date-input/root/date-input-root.js +9 -1
  42. package/dist/editor/root/editor-root.d.ts +106 -7
  43. package/dist/editor/root/editor-root.js +273 -50
  44. package/dist/element-events.generated.js +9 -0
  45. package/dist/filter-input/root/filter-input-root.d.ts +31 -0
  46. package/dist/filter-input/root/filter-input-root.js +94 -12
  47. package/dist/filter-input/table.d.ts +64 -0
  48. package/dist/filter-input/table.js +76 -0
  49. package/dist/index.d.ts +5 -0
  50. package/dist/index.js +5 -0
  51. package/dist/input/root/input-root.d.ts +7 -0
  52. package/dist/input/root/input-root.js +9 -1
  53. package/dist/navigation/root/navigation-root.d.ts +115 -1
  54. package/dist/navigation/root/navigation-root.js +220 -8
  55. package/dist/number-input/root/number-input-root.d.ts +7 -0
  56. package/dist/number-input/root/number-input-root.js +9 -1
  57. package/dist/quick-filters/events/before-view-save.d.ts +14 -0
  58. package/dist/quick-filters/events/before-view-save.js +11 -0
  59. package/dist/quick-filters/events/details.d.ts +10 -0
  60. package/dist/quick-filters/events/details.js +1 -0
  61. package/dist/quick-filters/events/index.d.ts +16 -0
  62. package/dist/quick-filters/events/index.js +9 -0
  63. package/dist/quick-filters/events/view-save.d.ts +11 -0
  64. package/dist/quick-filters/events/view-save.js +11 -0
  65. package/dist/quick-filters/filter/quick-filter.d.ts +48 -0
  66. package/dist/quick-filters/filter/quick-filter.js +33 -0
  67. package/dist/quick-filters/index.d.ts +3 -0
  68. package/dist/quick-filters/index.js +3 -0
  69. package/dist/quick-filters/root/quick-filters-root.d.ts +118 -0
  70. package/dist/quick-filters/root/quick-filters-root.js +183 -0
  71. package/dist/selection-bar/index.d.ts +1 -0
  72. package/dist/selection-bar/index.js +1 -0
  73. package/dist/selection-bar/root/selection-bar-root.d.ts +65 -0
  74. package/dist/selection-bar/root/selection-bar-root.js +44 -0
  75. package/dist/table/column/table-column.d.ts +82 -0
  76. package/dist/table/column/table-column.js +54 -0
  77. package/dist/table/column-type.d.ts +7 -0
  78. package/dist/table/column-type.js +1 -0
  79. package/dist/table-export/index.d.ts +1 -0
  80. package/dist/table-export/index.js +1 -0
  81. package/dist/table-export/root/table-export-root.d.ts +132 -0
  82. package/dist/table-export/root/table-export-root.js +233 -0
  83. package/dist/view-panel/index.d.ts +1 -0
  84. package/dist/view-panel/index.js +1 -0
  85. package/dist/view-panel/root/view-panel-root.d.ts +132 -0
  86. package/dist/view-panel/root/view-panel-root.js +209 -0
  87. package/examples.json +1 -1
  88. package/lint.json +1 -1
  89. package/package.json +5 -5
  90. package/types/jsx.d.ts +1353 -10
  91. package/types/svelte.d.ts +6 -0
  92. package/types/vue.d.ts +651 -6
  93. package/types/words.d.ts +325 -5
@@ -7,6 +7,7 @@ import { HelixBeforeFacetEvent, HelixFacetEvent } from '../events/index.js';
7
7
  import { HelixHeadlessFilterField } from '../field/filter-field.js';
8
8
  import { readFilterText } from '../grammar.js';
9
9
  import { completeTerm, currentField, currentTerm, suggests, tokenEntry, } from '../suggest.js';
10
+ import { facetOf, filterableColumns, filtersAfter, isBoundTable, tableFields, tableSource, } from '../table.js';
10
11
  const picks = (element) => typeof element.apply === 'function' &&
11
12
  Array.isArray(element.fields);
12
13
  const asksToGo = (node) => typeof node?.dismiss === 'function';
@@ -24,6 +25,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
24
25
  this.clearLabel = 'Clear';
25
26
  this.filterDelay = 0;
26
27
  this.filterSuggestions = false;
28
+ this.for = '';
27
29
  this.loading = false;
28
30
  this.loadingText = 'Loading';
29
31
  this.noResultsText = '';
@@ -55,6 +57,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
55
57
  const control = event.target;
56
58
  this.requestValue(control.value);
57
59
  restoreValue(control, this.value);
60
+ this.searchTable();
58
61
  this.dismissed = false;
59
62
  this.settleOpen();
60
63
  this.askSoon();
@@ -67,17 +70,29 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
67
70
  this.announceChange();
68
71
  };
69
72
  this.handleFacet = (event) => {
73
+ const facet = event.detail;
74
+ const table = this.boundTable;
75
+ if (table && filterableColumns(table).some((column) => column.field === facet.field)) {
76
+ table.requestView({ filters: filtersAfter(table.view.filters, facet) });
77
+ this.drawTableChips();
78
+ return;
79
+ }
70
80
  if (this.chips) {
71
- this.drawChip(event.detail);
81
+ this.drawChip(facet);
72
82
  }
73
83
  };
84
+ this.listened = null;
85
+ this.handleTableView = () => {
86
+ this.drawTableChips();
87
+ };
88
+ this.tableSuggestions = undefined;
74
89
  this.handleDismiss = (event) => {
75
90
  const chip = event.composedPath()[0];
76
91
  if (!(chip instanceof HTMLElement) || chip.slot !== 'tags') {
77
92
  return;
78
93
  }
79
94
  const field = chip.getAttribute('name') ?? '';
80
- const declared = field === '' ? undefined : this.fields.find((one) => (one.name ?? '') === field);
95
+ const declared = field === '' ? undefined : this.vocabularies.find((one) => one.name === field);
81
96
  if (!declared) {
82
97
  return;
83
98
  }
@@ -88,7 +103,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
88
103
  menu.apply(field, []);
89
104
  return;
90
105
  }
91
- const { label, operators } = declared.vocabulary;
106
+ const { label, operators } = declared;
92
107
  const usual = operators.find((operator) => operator.default) ?? operators[0];
93
108
  this.announceFacet({
94
109
  arity: usual?.arity ?? 'many',
@@ -212,7 +227,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
212
227
  };
213
228
  this.handleFocusIn = () => {
214
229
  this.settleOpen();
215
- if (this.source && this.asked !== this.value) {
230
+ if (this.suggestionSource && this.asked !== this.value) {
216
231
  this.ask();
217
232
  }
218
233
  };
@@ -355,6 +370,65 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
355
370
  this.dispatchEvent(new HelixFacetEvent(facet));
356
371
  return true;
357
372
  }
373
+ get vocabularies() {
374
+ const declared = this.fields.map((field) => field.vocabulary);
375
+ const table = this.boundTable;
376
+ if (!table) {
377
+ return declared;
378
+ }
379
+ const names = new Set(declared.map((field) => field.name));
380
+ return [...declared, ...tableFields(table).filter((field) => !names.has(field.name))];
381
+ }
382
+ get boundTable() {
383
+ if (this.for === '' || typeof document === 'undefined') {
384
+ return null;
385
+ }
386
+ const scope = this.getRootNode();
387
+ const found = scope.getElementById?.(this.for) ?? null;
388
+ return isBoundTable(found) ? found : null;
389
+ }
390
+ bindTable() {
391
+ const table = this.boundTable;
392
+ if (table === this.listened) {
393
+ return;
394
+ }
395
+ this.listened?.removeEventListener('helix-view-change', this.handleTableView);
396
+ this.listened = table;
397
+ table?.addEventListener('helix-view-change', this.handleTableView);
398
+ if (table) {
399
+ this.drawTableChips();
400
+ }
401
+ }
402
+ drawTableChips() {
403
+ const table = this.boundTable;
404
+ if (!table) {
405
+ return;
406
+ }
407
+ const fields = new Set(filterableColumns(table).map((column) => column.field));
408
+ const facets = table.view.filters
409
+ .map((filter) => facetOf(table, filter))
410
+ .filter((facet) => facet !== undefined);
411
+ for (const field of fields) {
412
+ const facet = facets.find((one) => one.field === field);
413
+ this.drawChip(facet ?? { arity: 'many', field, label: '', operator: '', operatorLabel: '', values: [] });
414
+ }
415
+ }
416
+ searchTable() {
417
+ const table = this.boundTable;
418
+ if (table && table.view.query !== this.value) {
419
+ table.requestView({ query: this.value });
420
+ }
421
+ }
422
+ get suggestionSource() {
423
+ if (this.source) {
424
+ return this.source;
425
+ }
426
+ if (this.for === '') {
427
+ return undefined;
428
+ }
429
+ this.tableSuggestions ??= tableSource(() => this.boundTable, suggests);
430
+ return this.tableSuggestions;
431
+ }
358
432
  drawChip(facet) {
359
433
  const tag = `${this.constructor.tier}filter-chip`;
360
434
  const held = [...this.children].find((child) => child.localName === tag && child.getAttribute('name') === facet.field);
@@ -375,11 +449,11 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
375
449
  }
376
450
  }
377
451
  readFilters() {
378
- const fields = this.fields;
452
+ const fields = this.vocabularies;
379
453
  if (fields.length === 0) {
380
454
  return 0;
381
455
  }
382
- const reading = readFilterText(this.value, fields.map((field) => field.vocabulary));
456
+ const reading = readFilterText(this.value, fields);
383
457
  if (reading.terms.length === 0) {
384
458
  return 0;
385
459
  }
@@ -397,6 +471,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
397
471
  return 0;
398
472
  }
399
473
  this.requestValue([...refused, reading.text].filter(Boolean).join(' '));
474
+ this.searchTable();
400
475
  const control = this.control;
401
476
  if (control) {
402
477
  restoreValue(control, this.value);
@@ -413,10 +488,10 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
413
488
  return this.loading || this.fetching;
414
489
  }
415
490
  resetSource() {
416
- if (this.source === this.used) {
491
+ if (this.suggestionSource === this.used) {
417
492
  return;
418
493
  }
419
- this.used = this.source;
494
+ this.used = this.suggestionSource;
420
495
  this.request?.abort();
421
496
  this.request = undefined;
422
497
  this.fetching = false;
@@ -424,12 +499,13 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
424
499
  if (this.sourced.length > 0) {
425
500
  this.drawSourced([]);
426
501
  }
427
- if (this.source && (this.matches(':focus-within') || this.contains(document.activeElement))) {
502
+ if (this.suggestionSource &&
503
+ (this.matches(':focus-within') || this.contains(document.activeElement))) {
428
504
  this.ask();
429
505
  }
430
506
  }
431
507
  askSoon() {
432
- if (!this.source) {
508
+ if (!this.suggestionSource) {
433
509
  return;
434
510
  }
435
511
  this.asking.cancel();
@@ -442,7 +518,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
442
518
  }
443
519
  ask() {
444
520
  this.asking.cancel();
445
- const source = this.source;
521
+ const source = this.suggestionSource;
446
522
  if (!source) {
447
523
  return;
448
524
  }
@@ -557,6 +633,8 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
557
633
  this.removeEventListener('helix-dismiss', this.handleDismiss, { capture: true });
558
634
  this.removeEventListener(HelixFacetEvent.eventName, this.handleFacet);
559
635
  this.removeEventListener('helix-before-select', this.handleSourcedSelect);
636
+ this.listened?.removeEventListener('helix-view-change', this.handleTableView);
637
+ this.listened = null;
560
638
  this.request?.abort();
561
639
  this.request = undefined;
562
640
  this.fetching = false;
@@ -591,9 +669,10 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
591
669
  }
592
670
  updated(changed) {
593
671
  super.updated(changed);
594
- if (changed.has('source')) {
672
+ if (changed.has('source') || changed.has('for')) {
595
673
  queueMicrotask(() => this.resetSource());
596
674
  }
675
+ this.bindTable();
597
676
  this.releaseCaret?.();
598
677
  this.releaseCaret = undefined;
599
678
  internalsOf(this).setFormValue(this.formValue(), this.value);
@@ -716,6 +795,9 @@ __decorate([
716
795
  __decorate([
717
796
  property({ attribute: 'filter-suggestions', type: Boolean })
718
797
  ], HelixHeadlessFilterInput.prototype, "filterSuggestions", void 0);
798
+ __decorate([
799
+ property()
800
+ ], HelixHeadlessFilterInput.prototype, "for", void 0);
719
801
  __decorate([
720
802
  property({ reflect: true, type: Boolean })
721
803
  ], HelixHeadlessFilterInput.prototype, "loading", void 0);
@@ -0,0 +1,64 @@
1
+ /**
2
+ * What a Filter Input bound to a Data Table by `for` reads from the table and
3
+ * writes to it.
4
+ *
5
+ * **By shape, and nothing here imports the table.** The Data Table family is
6
+ * the larger of the two by far, and a field that never binds to one should not
7
+ * carry it. So this names what the field needs of a table, and the table's
8
+ * columns are read the same way.
9
+ */
10
+ import type { FacetDetail } from './events/index.js';
11
+ import type { FilterGrammarField } from './grammar.js';
12
+ import type { FilterSource } from './suggest.js';
13
+ /** One filter in a table's view. */
14
+ export interface BoundFilter {
15
+ field: string;
16
+ operator: string;
17
+ values: string[];
18
+ }
19
+ /** One column of a bound table, as the field reads it. */
20
+ export interface BoundColumn {
21
+ field: string;
22
+ filterable: boolean;
23
+ textContent: string | null;
24
+ type?: string | undefined;
25
+ }
26
+ /** What the field needs of a table it is bound to. */
27
+ export interface BoundTable extends HTMLElement {
28
+ facetsOf(field: string): readonly {
29
+ count: number;
30
+ value: string;
31
+ }[];
32
+ operatorsOf(field: string): readonly {
33
+ arity: string;
34
+ label: string;
35
+ name: string;
36
+ }[];
37
+ requestView(next: {
38
+ filters?: BoundFilter[];
39
+ query?: string;
40
+ }): boolean;
41
+ readonly tableColumns: readonly BoundColumn[];
42
+ readonly view: {
43
+ filters: readonly BoundFilter[];
44
+ query: string;
45
+ };
46
+ }
47
+ /** Whether an element is a table the field can bind to. */
48
+ export declare const isBoundTable: (element: Element | null) => element is BoundTable;
49
+ /** The columns a reader can filter by: the ones marked `filterable`, with a field. */
50
+ export declare const filterableColumns: (table: BoundTable) => BoundColumn[];
51
+ /** The table's filterable columns as the grammar reads a declared field. */
52
+ export declare const tableFields: (table: BoundTable) => FilterGrammarField[];
53
+ /**
54
+ * The filters after one field's change: the field's filter replaced, or taken
55
+ * out where it has no values left and its comparison needs some.
56
+ */
57
+ export declare const filtersAfter: (filters: readonly BoundFilter[], facet: FacetDetail) => BoundFilter[];
58
+ /** The chip a filter in the view draws, as the facet that would have made it. */
59
+ export declare const facetOf: (table: BoundTable, filter: BoundFilter) => FacetDetail | undefined;
60
+ /**
61
+ * Suggestions from the table: its filterable columns while a key is typed,
62
+ * and a column's values, with how many rows hold each, after `field:`.
63
+ */
64
+ export declare const tableSource: (table: () => BoundTable | null, matches: (words: string, term: string) => boolean) => FilterSource;
@@ -0,0 +1,76 @@
1
+ export const isBoundTable = (element) => element !== null &&
2
+ typeof element.requestView === 'function' &&
3
+ typeof element.facetsOf === 'function';
4
+ export const filterableColumns = (table) => table.tableColumns.filter((column) => column.filterable && column.field !== '');
5
+ const labelOf = (column) => column.textContent?.trim() || column.field;
6
+ const grammarOperators = (table, field) => table.operatorsOf(field).map((one, place) => ({
7
+ arity: one.arity === 'none' ? 'none' : one.arity === 'one' ? 'one' : 'many',
8
+ default: place === 0,
9
+ label: one.label,
10
+ name: one.name,
11
+ }));
12
+ const valuesOf = (table, column) => {
13
+ if (column.type === 'boolean') {
14
+ return [
15
+ { label: 'true', value: 'true' },
16
+ { label: 'false', value: 'false' },
17
+ ];
18
+ }
19
+ return column.type === 'enum'
20
+ ? table.facetsOf(column.field).map(({ value }) => ({ label: value, value }))
21
+ : [];
22
+ };
23
+ export const tableFields = (table) => filterableColumns(table).map((column) => ({
24
+ label: labelOf(column),
25
+ name: column.field,
26
+ operators: grammarOperators(table, column.field),
27
+ values: valuesOf(table, column),
28
+ }));
29
+ export const filtersAfter = (filters, facet) => {
30
+ const others = filters.filter((one) => one.field !== facet.field);
31
+ if (facet.values.length === 0 && facet.arity !== 'none') {
32
+ return others;
33
+ }
34
+ const next = { field: facet.field, operator: facet.operator, values: [...facet.values] };
35
+ const at = filters.findIndex((one) => one.field === facet.field);
36
+ if (at < 0) {
37
+ return [...others, next];
38
+ }
39
+ return filters.map((one) => (one.field === facet.field ? next : one));
40
+ };
41
+ export const facetOf = (table, filter) => {
42
+ const column = filterableColumns(table).find((one) => one.field === filter.field);
43
+ if (!column) {
44
+ return undefined;
45
+ }
46
+ const operators = grammarOperators(table, filter.field);
47
+ const operator = operators.find((one) => one.name === filter.operator) ?? operators[0];
48
+ return {
49
+ arity: operator?.arity ?? 'many',
50
+ field: filter.field,
51
+ label: labelOf(column),
52
+ operator: operator?.name ?? filter.operator,
53
+ operatorLabel: operator && !operator.default ? operator.label : '',
54
+ values: filter.values,
55
+ };
56
+ };
57
+ export const tableSource = (table, matches) => ({ field, term }) => {
58
+ const bound = table();
59
+ if (!bound) {
60
+ return [];
61
+ }
62
+ const columns = filterableColumns(bound);
63
+ if (field === '') {
64
+ return columns
65
+ .filter((column) => matches(`${labelOf(column)} ${column.field}`, term))
66
+ .map((column) => ({ label: labelOf(column), value: `${column.field}:` }));
67
+ }
68
+ const column = columns.find((one) => one.field === field || labelOf(one) === field);
69
+ if (!column) {
70
+ return [];
71
+ }
72
+ const counted = column.type === 'enum' ? bound.facetsOf(column.field) : [];
73
+ return counted
74
+ .filter(({ value }) => matches(value, term))
75
+ .map(({ count, value }) => ({ label: `${value} (${count})`, value }));
76
+ };
package/dist/index.d.ts CHANGED
@@ -33,6 +33,7 @@ export * from './code-editor/index.js';
33
33
  export * from './code-input/index.js';
34
34
  export * from './color-input/index.js';
35
35
  export * from './color-picker/index.js';
36
+ export * from './column-manager/index.js';
36
37
  export * from './combobox/index.js';
37
38
  export * from './command/index.js';
38
39
  export * from './copy-button/index.js';
@@ -85,12 +86,14 @@ export * from './pin-input/index.js';
85
86
  export * from './popover/index.js';
86
87
  export * from './progress/index.js';
87
88
  export * from './qr-code/index.js';
89
+ export * from './quick-filters/index.js';
88
90
  export * from './quote/index.js';
89
91
  export * from './radio/index.js';
90
92
  export * from './rating/index.js';
91
93
  export * from './scatter-chart/index.js';
92
94
  export * from './scroll-area/index.js';
93
95
  export * from './select/index.js';
96
+ export * from './selection-bar/index.js';
94
97
  export * from './shortcut-overlay/index.js';
95
98
  export * from './skeleton/index.js';
96
99
  export * from './skip-link/index.js';
@@ -108,6 +111,7 @@ export * from './stat/index.js';
108
111
  export * from './steps/index.js';
109
112
  export * from './switch/index.js';
110
113
  export * from './table/index.js';
114
+ export * from './table-export/index.js';
111
115
  export * from './tabs/index.js';
112
116
  export * from './tag/index.js';
113
117
  export * from './terminal/index.js';
@@ -124,4 +128,5 @@ export * from './tree/index.js';
124
128
  export * from './trend/index.js';
125
129
  export * from './video/index.js';
126
130
  export * from './video-playlist/index.js';
131
+ export * from './view-panel/index.js';
127
132
  export * from './virtual-list/index.js';
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ export * from './code-editor/index.js';
24
24
  export * from './code-input/index.js';
25
25
  export * from './color-input/index.js';
26
26
  export * from './color-picker/index.js';
27
+ export * from './column-manager/index.js';
27
28
  export * from './combobox/index.js';
28
29
  export * from './command/index.js';
29
30
  export * from './copy-button/index.js';
@@ -76,12 +77,14 @@ export * from './pin-input/index.js';
76
77
  export * from './popover/index.js';
77
78
  export * from './progress/index.js';
78
79
  export * from './qr-code/index.js';
80
+ export * from './quick-filters/index.js';
79
81
  export * from './quote/index.js';
80
82
  export * from './radio/index.js';
81
83
  export * from './rating/index.js';
82
84
  export * from './scatter-chart/index.js';
83
85
  export * from './scroll-area/index.js';
84
86
  export * from './select/index.js';
87
+ export * from './selection-bar/index.js';
85
88
  export * from './shortcut-overlay/index.js';
86
89
  export * from './skeleton/index.js';
87
90
  export * from './skip-link/index.js';
@@ -99,6 +102,7 @@ export * from './stat/index.js';
99
102
  export * from './steps/index.js';
100
103
  export * from './switch/index.js';
101
104
  export * from './table/index.js';
105
+ export * from './table-export/index.js';
102
106
  export * from './tabs/index.js';
103
107
  export * from './tag/index.js';
104
108
  export * from './terminal/index.js';
@@ -115,4 +119,5 @@ export * from './tree/index.js';
115
119
  export * from './trend/index.js';
116
120
  export * from './video/index.js';
117
121
  export * from './video-playlist/index.js';
122
+ export * from './view-panel/index.js';
118
123
  export * from './virtual-list/index.js';
@@ -341,6 +341,13 @@ export declare class HelixHeadlessInput extends HelixHeadlessInput_base {
341
341
  */
342
342
  protected renderRevealIcon(): TemplateResult;
343
343
  protected voiceField(): HTMLInputElement | HTMLTextAreaElement | null;
344
+ /**
345
+ * A press on the field's own box, beside the text, puts focus in the text,
346
+ * as a press on a native field's padding does. Without it a field drawn
347
+ * narrower than its box, as a field sized to its value is, took no focus
348
+ * from most of its box.
349
+ */
350
+ private readonly handleFieldPress;
344
351
  protected render(): TemplateResult;
345
352
  }
346
353
  declare global {
@@ -55,6 +55,14 @@ let HelixHeadlessInput = class HelixHeadlessInput extends MixinVoice(MixinContro
55
55
  this.revealLabel = 'Show password';
56
56
  this.step = '';
57
57
  this.type = 'text';
58
+ this.handleFieldPress = (event) => {
59
+ const control = this.partNamed('control');
60
+ if (event.composedPath()[0] !== event.currentTarget || !control || this.disabled) {
61
+ return;
62
+ }
63
+ event.preventDefault();
64
+ control.focus();
65
+ };
58
66
  }
59
67
  static { this.markRules = [SPOKEN_RULE]; }
60
68
  static { this.words = 'helix-input'; }
@@ -180,7 +188,7 @@ let HelixHeadlessInput = class HelixHeadlessInput extends MixinVoice(MixinContro
180
188
  }
181
189
  render() {
182
190
  return html `${this.renderLabel()}
183
- <div part="field">
191
+ <div part="field" @mousedown=${this.handleFieldPress}>
184
192
  <slot name="start"></slot>
185
193
  <input
186
194
  part="control"
@@ -1,5 +1,6 @@
1
1
  import { AriaForwardController, HelixElement, KeyboardNavigationController } from '@fusion.dev/helix-core';
2
- import { type PropertyValues, type TemplateResult } from 'lit';
2
+ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
3
+ import '../../menu/index.js';
3
4
  /**
4
5
  * @summary A set of destinations, with a marker on the current one.
5
6
  *
@@ -29,6 +30,22 @@ import { type PropertyValues, type TemplateResult } from 'lit';
29
30
  * Set `orientation="vertical"` to stack the destinations in a column, for a
30
31
  * sidebar.
31
32
  *
33
+ * **A row too narrow for its destinations folds them into a menu.** The
34
+ * destinations fold from the end, one at a time, into a menu behind a button
35
+ * after the last one on the row, named by `more-label`, until the row fits.
36
+ * The current destination stays on the row, so the marker has somewhere to
37
+ * be: where it would fold, the one before it folds instead. Where the button
38
+ * and the current destination do not both fit, every destination folds and
39
+ * the button names the current one. Where even that does not fit, the button
40
+ * is a glyph alone, named for the current one. Each row in the menu is a link
41
+ * to the same address, and the current one is checked.
42
+ *
43
+ * A destination that folds is `hidden`: the link, or the list item that holds
44
+ * it. A destination that is no link, such as a `Megamenu`, stays on the row.
45
+ * A server serves every destination on the row, and the browser folds what
46
+ * does not fit once it has measured it. Set `overflow="scroll"` to scroll a
47
+ * long row inside itself instead. A column never folds.
48
+ *
32
49
  * Set `arrows` and the arrow keys move focus between the destinations, as
33
50
  * Radix's navigation menu does: left and right along a row, up and down a
34
51
  * column, Home and End to the ends. A `Megamenu` among them is reached at its
@@ -53,10 +70,38 @@ import { type PropertyValues, type TemplateResult } from 'lit';
53
70
  *
54
71
  * @slot - The destinations, as your own links.
55
72
  * @slot indicator - A marker of your own, drawn inside the `indicator` part, where the current destination's place and size reach it.
73
+ * @slot menu-icon - Replaces the glyph on the overflow button where it is too narrow for words.
74
+ * @slot more-icon - Replaces the caret on the button that opens the overflow menu.
56
75
  *
57
76
  * @csspart indicator - The marker that moves to the current destination. It carries the destination's place and size as `--indicator-x`, `--indicator-y`, `--indicator-inline-size` and `--indicator-block-size`, and `data-placed` once it has been placed.
77
+ * @csspart more - The button that opens the overflow menu, drawn after the last destination on the row while any has folded.
78
+ * @csspart more-current - The current destination's name on the button, while every destination has folded.
79
+ * @csspart more-glyph - The glyph on the button where it is too narrow for words, where none is slotted.
80
+ * @csspart more-label - The button's name, `more-label`, while the current destination is still on the row.
81
+ * @csspart more-mark - The caret on the button, where none is slotted.
58
82
  * @csspart nav - The navigation landmark.
83
+ * @csspart overflow - The menu of the destinations that do not fit on the row.
84
+ * @csspart overflow-back - The control that returns from a submenu.
85
+ * @csspart overflow-back-mark - The glyph on the back control of a submenu.
86
+ * @csspart overflow-empty - The text shown when the menu has no items.
87
+ * @csspart overflow-header - The bar above a submenu, holding the way back and its name.
88
+ * @csspart overflow-live - The overflow menu's live region, which repeats the empty and loading text for screen readers.
89
+ * @csspart overflow-loading - The text shown while the items are loading.
90
+ * @csspart overflow-option - One destination in the overflow menu, a link to its address. Checked where it is the current one.
91
+ * @csspart overflow-option-end - A destination's trailing column.
92
+ * @csspart overflow-option-item - A destination's row, an `<a>`.
93
+ * @csspart overflow-option-mark - The check beside the current destination.
94
+ * @csspart overflow-option-shortcut - A destination's key.
95
+ * @csspart overflow-option-shortcut-kbd - The key inside it.
96
+ * @csspart overflow-option-shortcut-key - One key of a destination's chord.
97
+ * @csspart overflow-option-shortcut-separator - The `+` between two keys of a destination's chord.
98
+ * @csspart overflow-option-start - A destination's leading column.
99
+ * @csspart overflow-option-surface - A destination's submenu panel, which a destination does not open.
100
+ * @csspart overflow-search-field - The overflow menu's filter field, drawn with `filterable`.
101
+ * @csspart overflow-surface - The floating panel the overflow menu is drawn on.
102
+ * @csspart overflow-title - The name of the submenu that is showing.
59
103
  *
104
+ * @cssstate folded - While any destination has folded into the overflow menu.
60
105
  * @cssstate open - While a megamenu or another disclosure among the destinations is open.
61
106
  */
62
107
  export declare class HelixHeadlessNavigation extends HelixElement {
@@ -73,6 +118,12 @@ export declare class HelixHeadlessNavigation extends HelixElement {
73
118
  * a link has focus keeps doing so.
74
119
  */
75
120
  arrows: boolean;
121
+ /**
122
+ * The name of the button that opens the overflow menu, where every
123
+ * destination has folded. `{name}` is the current destination's, which the
124
+ * button shows.
125
+ */
126
+ currentLabel: string;
76
127
  /** The name the element gives itself where `label` is empty. */
77
128
  fallbackLabel: string;
78
129
  /**
@@ -110,20 +161,67 @@ export declare class HelixHeadlessNavigation extends HelixElement {
110
161
  * consumer's server markup does not already have.
111
162
  */
112
163
  marker?: 'segmented' | 'underlined';
164
+ /**
165
+ * The words on the button that opens the overflow menu, and the menu's name.
166
+ */
167
+ moreLabel: string;
113
168
  /**
114
169
  * Stacks the destinations in a column, for a sidebar, where unset is a row
115
170
  * for a header or a footer. The marker follows the current destination down
116
171
  * the column as it does along the row.
117
172
  */
118
173
  orientation?: 'vertical';
174
+ /**
175
+ * What a row too narrow for its destinations does. Unset, the destinations
176
+ * that do not fit fold into the overflow menu. `scroll` keeps them all on
177
+ * the row and scrolls it inside itself, for a strip read by swiping.
178
+ *
179
+ * Reflected and left unset by default, so the host carries nothing a
180
+ * consumer's server markup does not already have.
181
+ */
182
+ overflow?: 'scroll';
119
183
  private current;
120
184
  /** The disclosures among the destinations that are open. */
121
185
  private readonly opened;
186
+ /** The destinations this element hid by folding them, so unfolding shows only those. */
187
+ private readonly hid;
188
+ /**
189
+ * Folds the destinations that do not fit on the row into the overflow
190
+ * menu: step `n` folds the first `n` of `foldOrder`.
191
+ */
192
+ private readonly fold;
122
193
  /**
123
194
  * Hears a disclosure among the destinations open or close. In capture,
124
195
  * because `toggle` does not bubble.
125
196
  */
126
197
  private readonly handleToggle;
198
+ /** Whether the row folds what does not fit: a row, without `overflow="scroll"`. */
199
+ private get folds();
200
+ /** The destinations that can fold: each a link, and none the page hid itself. */
201
+ private get foldable();
202
+ /** The current destination among those that can fold, where it is one. */
203
+ private get currentFoldable();
204
+ /**
205
+ * The order destinations fold in: from the end, the current one last, so a
206
+ * step that folds it folds every destination.
207
+ */
208
+ private get foldOrder();
209
+ /** The destinations step `step` folds. */
210
+ private foldedAt;
211
+ /**
212
+ * How the overflow button reads at step `step`. Once every destination has
213
+ * folded it is `named` for the current one, and past that, where even that
214
+ * does not fit, it is `compact`: a glyph alone, named for screen readers.
215
+ */
216
+ private buttonAt;
217
+ /** The overflow button while it shows, for the arrow keys. */
218
+ private get shownMore();
219
+ /**
220
+ * Writes a step onto the row as the render draws it: the folded
221
+ * destinations `hidden`, the menu shown while any has folded, and the
222
+ * button naming the current destination once every one has.
223
+ */
224
+ private applyFold;
127
225
  /** The landmark's name as a screen reader lists it. */
128
226
  private get landmarkName();
129
227
  /**
@@ -142,6 +240,22 @@ export declare class HelixHeadlessNavigation extends HelixElement {
142
240
  connectedCallback(): void;
143
241
  disconnectedCallback(): void;
144
242
  protected firstUpdated(changed: PropertyValues): void;
243
+ protected willUpdate(changed: PropertyValues): void;
244
+ /** The destinations changed: watched again, and what fits measured again. */
245
+ private readonly handleSlotChange;
246
+ /**
247
+ * The overflow menu, after the last destination: a row for each destination
248
+ * that folded, a link to the same address. Kept in the tree while nothing
249
+ * has folded, hidden, so a measure can show it at once.
250
+ *
251
+ * **The button is drawn as a destination**, words and a caret, since it
252
+ * stands in the row of links and the words say what it holds. Once every
253
+ * destination has folded, it names the current one, so the row still says
254
+ * where the reader is.
255
+ */
256
+ protected renderOverflow(): TemplateResult | typeof nothing;
257
+ /** Keeps the check on the current destination: choosing a row follows its link and changes no check. */
258
+ private readonly keepCheck;
145
259
  protected render(): TemplateResult;
146
260
  }
147
261
  declare global {