@angular/aria 22.0.0-next.4 → 22.0.0-next.5
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/fesm2022/_accordion-chunk.mjs +5 -5
- package/fesm2022/_accordion-chunk.mjs.map +1 -1
- package/fesm2022/_click-event-manager-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-chunk.mjs +5 -5
- package/fesm2022/_combobox-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-listbox-chunk.mjs +1 -1
- package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-tree-chunk.mjs +6 -6
- package/fesm2022/_combobox-tree-chunk.mjs.map +1 -1
- package/fesm2022/_element-chunk.mjs +6 -0
- package/fesm2022/_element-chunk.mjs.map +1 -0
- package/fesm2022/_list-chunk.mjs.map +1 -1
- package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
- package/fesm2022/_list-typeahead-chunk.mjs.map +1 -1
- package/fesm2022/_menu-chunk.mjs.map +1 -1
- package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -1
- package/fesm2022/_signal-like-chunk.mjs.map +1 -1
- package/fesm2022/_tabs-chunk.mjs +1 -1
- package/fesm2022/_tabs-chunk.mjs.map +1 -1
- package/fesm2022/_widget-chunk.mjs +12 -166
- package/fesm2022/_widget-chunk.mjs.map +1 -1
- package/fesm2022/accordion-testing.mjs +61 -0
- package/fesm2022/accordion-testing.mjs.map +1 -0
- package/fesm2022/accordion.mjs +208 -183
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/aria.mjs +1 -1
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +14 -85
- package/fesm2022/grid.mjs.map +1 -1
- package/fesm2022/listbox-testing.mjs +55 -0
- package/fesm2022/listbox-testing.mjs.map +1 -0
- package/fesm2022/listbox.mjs +1 -1
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu-testing.mjs +75 -0
- package/fesm2022/menu-testing.mjs.map +1 -0
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/private.mjs +2 -1
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/tabs-testing.mjs +57 -0
- package/fesm2022/tabs-testing.mjs.map +1 -0
- package/fesm2022/tabs.mjs +3 -5
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar-testing.mjs +56 -0
- package/fesm2022/toolbar-testing.mjs.map +1 -0
- package/fesm2022/toolbar.mjs +8 -6
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tree-testing.mjs +88 -0
- package/fesm2022/tree-testing.mjs.map +1 -0
- package/fesm2022/tree.mjs +4 -6
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +26 -2
- package/resources/code-examples.db +0 -0
- package/types/_accordion-chunk.d.ts +10 -9
- package/types/_click-event-manager-chunk.d.ts +1 -1
- package/types/_combobox-chunk.d.ts +23 -23
- package/types/_element-chunk.d.ts +10 -0
- package/types/_expansion-chunk.d.ts +1 -1
- package/types/_grid-chunk.d.ts +11 -49
- package/types/_keyboard-event-manager-chunk.d.ts +2 -2
- package/types/_list-chunk.d.ts +19 -18
- package/types/_list-navigation-chunk.d.ts +6 -16
- package/types/_listbox-chunk.d.ts +27 -27
- package/types/_menu-chunk.d.ts +51 -51
- package/types/_pointer-event-manager-chunk.d.ts +1 -1
- package/types/_signal-like-chunk.d.ts +14 -0
- package/types/_tabs-chunk.d.ts +2 -1
- package/types/_toolbar-chunk.d.ts +1 -1
- package/types/_tree-chunk.d.ts +18 -17
- package/types/accordion-testing.d.ts +63 -0
- package/types/accordion.d.ts +69 -55
- package/types/combobox.d.ts +6 -5
- package/types/grid.d.ts +8 -14
- package/types/listbox-testing.d.ts +39 -0
- package/types/listbox.d.ts +19 -18
- package/types/menu-testing.d.ts +50 -0
- package/types/menu.d.ts +4 -3
- package/types/private.d.ts +46 -44
- package/types/tabs-testing.d.ts +57 -0
- package/types/tabs.d.ts +3 -5
- package/types/toolbar-testing.d.ts +72 -0
- package/types/toolbar.d.ts +3 -2
- package/types/tree-testing.d.ts +75 -0
- package/types/tree.d.ts +5 -6
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { computed, signal, linkedSignal, KeyboardEventManager, Modifier } from './_signal-like-chunk.mjs';
|
|
2
2
|
import { PointerEventManager } from './_pointer-event-manager-chunk.mjs';
|
|
3
3
|
import { untracked } from '@angular/core/primitives/signals';
|
|
4
|
-
import { ListFocus, ListNavigation } from './_list-navigation-chunk.mjs';
|
|
5
4
|
|
|
6
5
|
class GridData {
|
|
7
6
|
inputs;
|
|
@@ -603,9 +602,6 @@ class GridPattern {
|
|
|
603
602
|
dragging = signal(false);
|
|
604
603
|
prevColKey = computed(() => this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft');
|
|
605
604
|
nextColKey = computed(() => this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight');
|
|
606
|
-
acceptsPointerMove = computed(() => {
|
|
607
|
-
return !this.disabled() && this.inputs.enableSelection() && this.inputs.enableRangeSelection() && this.dragging();
|
|
608
|
-
});
|
|
609
605
|
keydown = computed(() => {
|
|
610
606
|
const manager = new KeyboardEventManager();
|
|
611
607
|
if (this.pauseNavigation()) {
|
|
@@ -626,24 +622,8 @@ class GridPattern {
|
|
|
626
622
|
if (this.inputs.enableSelection() && this.inputs.selectionMode() === 'explicit') {
|
|
627
623
|
manager.on(/Enter| /, () => this.inputs.multi() ? this.gridBehavior.toggle() : this.gridBehavior.toggleOne());
|
|
628
624
|
}
|
|
629
|
-
if (this.inputs.enableSelection() && this.inputs.
|
|
630
|
-
manager.on(Modifier.
|
|
631
|
-
anchor: true
|
|
632
|
-
})).on(Modifier.Shift, 'ArrowDown', () => this.gridBehavior.down({
|
|
633
|
-
anchor: true
|
|
634
|
-
})).on(Modifier.Shift, this.prevColKey(), () => this.gridBehavior.left({
|
|
635
|
-
anchor: true
|
|
636
|
-
})).on(Modifier.Shift, this.nextColKey(), () => this.gridBehavior.right({
|
|
637
|
-
anchor: true
|
|
638
|
-
})).on(Modifier.Shift, 'Home', () => this.gridBehavior.firstInRow({
|
|
639
|
-
anchor: true
|
|
640
|
-
})).on(Modifier.Shift, 'End', () => this.gridBehavior.lastInRow({
|
|
641
|
-
anchor: true
|
|
642
|
-
})).on([Modifier.Ctrl | Modifier.Shift], 'Home', () => this.gridBehavior.first({
|
|
643
|
-
anchor: true
|
|
644
|
-
})).on([Modifier.Ctrl | Modifier.Shift], 'End', () => this.gridBehavior.last({
|
|
645
|
-
anchor: true
|
|
646
|
-
})).on([Modifier.Ctrl, Modifier.Meta], 'A', () => {
|
|
625
|
+
if (this.inputs.enableSelection() && this.inputs.multi()) {
|
|
626
|
+
manager.on([Modifier.Ctrl, Modifier.Meta], 'A', () => {
|
|
647
627
|
if (this.gridBehavior.allSelected()) {
|
|
648
628
|
this.gridBehavior.deselectAll();
|
|
649
629
|
} else {
|
|
@@ -671,9 +651,6 @@ class GridPattern {
|
|
|
671
651
|
toggleOne: this.inputs.selectionMode() === 'explicit' && !this.inputs.multi(),
|
|
672
652
|
toggle: this.inputs.selectionMode() === 'explicit' && this.inputs.multi()
|
|
673
653
|
});
|
|
674
|
-
if (this.inputs.multi() && this.inputs.enableRangeSelection()) {
|
|
675
|
-
this.dragging.set(true);
|
|
676
|
-
}
|
|
677
654
|
});
|
|
678
655
|
if (this.inputs.multi()) {
|
|
679
656
|
manager.on([Modifier.Ctrl, Modifier.Meta], e => {
|
|
@@ -682,33 +659,11 @@ class GridPattern {
|
|
|
682
659
|
this.gridBehavior.gotoCell(cell, {
|
|
683
660
|
toggle: true
|
|
684
661
|
});
|
|
685
|
-
if (this.inputs.enableRangeSelection()) {
|
|
686
|
-
this.dragging.set(true);
|
|
687
|
-
}
|
|
688
662
|
});
|
|
689
|
-
if (this.inputs.enableRangeSelection()) {
|
|
690
|
-
manager.on(Modifier.Shift, e => {
|
|
691
|
-
const cell = this.inputs.getCell(e.target);
|
|
692
|
-
if (!cell) return;
|
|
693
|
-
this.gridBehavior.gotoCell(cell, {
|
|
694
|
-
anchor: true
|
|
695
|
-
});
|
|
696
|
-
this.dragging.set(true);
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
663
|
}
|
|
700
664
|
}
|
|
701
665
|
return manager;
|
|
702
666
|
});
|
|
703
|
-
pointerup = computed(() => {
|
|
704
|
-
const manager = new PointerEventManager();
|
|
705
|
-
if (this.inputs.enableSelection() && this.inputs.enableRangeSelection()) {
|
|
706
|
-
manager.on([Modifier.Shift, Modifier.Ctrl, Modifier.Meta, Modifier.None], () => {
|
|
707
|
-
this.dragging.set(false);
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
|
-
return manager;
|
|
711
|
-
});
|
|
712
667
|
_maybeDeletion = signal(false);
|
|
713
668
|
_deletion = signal(false);
|
|
714
669
|
_stateStale = signal(false);
|
|
@@ -730,24 +685,9 @@ class GridPattern {
|
|
|
730
685
|
this.hasBeenInteracted.set(true);
|
|
731
686
|
this.pointerdown().handle(event);
|
|
732
687
|
}
|
|
733
|
-
onPointermove(event) {
|
|
734
|
-
if (this.acceptsPointerMove()) {
|
|
735
|
-
const cell = this.inputs.getCell(event.target);
|
|
736
|
-
if (cell !== undefined) {
|
|
737
|
-
this.gridBehavior.gotoCell(cell, {
|
|
738
|
-
anchor: true
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
onPointerup(event) {
|
|
744
|
-
if (this.disabled()) return;
|
|
745
|
-
this.pointerup().handle(event);
|
|
746
|
-
}
|
|
747
688
|
onFocusIn(event) {
|
|
748
689
|
this.isFocused.set(true);
|
|
749
690
|
this.hasBeenInteracted.set(true);
|
|
750
|
-
if (this.dragging()) return;
|
|
751
691
|
const cell = this.inputs.getCell(event.target);
|
|
752
692
|
if (!cell || !this.gridBehavior.focusBehavior.isFocusable(cell)) return;
|
|
753
693
|
cell.onFocusIn(event);
|
|
@@ -844,85 +784,20 @@ class GridCellPattern {
|
|
|
844
784
|
ariaColIndex = computed(() => this.inputs.colIndex() ?? this.inputs.grid().gridBehavior.colIndex(this));
|
|
845
785
|
_tabIndex = computed(() => this.inputs.grid().gridBehavior.cellTabIndex(this));
|
|
846
786
|
tabIndex = computed(() => {
|
|
847
|
-
if (this.
|
|
787
|
+
if (this.inputs.widget()) {
|
|
848
788
|
return -1;
|
|
849
789
|
}
|
|
850
790
|
return this._tabIndex();
|
|
851
791
|
});
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
navigationDisabled = computed(() => !this.multiWidgetMode() || !this.active() || this.inputs.disabled());
|
|
855
|
-
focusBehavior;
|
|
856
|
-
navigationBehavior;
|
|
857
|
-
activeWidget = linkedSignal(() => this.inputs.widgets().length > 0 ? this.inputs.widgets()[0] : undefined);
|
|
858
|
-
navigationActivated = signal(false);
|
|
859
|
-
widgetActivated = computed(() => this.inputs.widgets().some(w => w.isActivated()));
|
|
860
|
-
isActivated = computed(() => this.navigationActivated() || this.widgetActivated());
|
|
861
|
-
prevKey = computed(() => {
|
|
862
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
863
|
-
return 'ArrowUp';
|
|
864
|
-
}
|
|
865
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
|
|
866
|
-
});
|
|
867
|
-
nextKey = computed(() => {
|
|
868
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
869
|
-
return 'ArrowDown';
|
|
870
|
-
}
|
|
871
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
872
|
-
});
|
|
873
|
-
keydown = computed(() => {
|
|
874
|
-
const manager = new KeyboardEventManager();
|
|
875
|
-
if (!this.navigationActivated()) {
|
|
876
|
-
manager.on('Enter', () => this.startNavigation());
|
|
877
|
-
return manager;
|
|
878
|
-
}
|
|
879
|
-
manager.on('Escape', () => this.stopNavigation()).on(this.prevKey(), () => this._advance(() => this.navigationBehavior.prev({
|
|
880
|
-
focusElement: false
|
|
881
|
-
})), {
|
|
882
|
-
ignoreRepeat: false
|
|
883
|
-
}).on(this.nextKey(), () => this._advance(() => this.navigationBehavior.next({
|
|
884
|
-
focusElement: false
|
|
885
|
-
})), {
|
|
886
|
-
ignoreRepeat: false
|
|
887
|
-
}).on('Home', () => this._advance(() => this.navigationBehavior.next({
|
|
888
|
-
focusElement: false
|
|
889
|
-
}))).on('End', () => this._advance(() => this.navigationBehavior.next({
|
|
890
|
-
focusElement: false
|
|
891
|
-
})));
|
|
892
|
-
return manager;
|
|
893
|
-
});
|
|
792
|
+
widget = () => this.inputs.widget();
|
|
793
|
+
isActivated = computed(() => this.widget()?.isActivated() ?? false);
|
|
894
794
|
constructor(inputs) {
|
|
895
795
|
this.inputs = inputs;
|
|
896
796
|
this.selected = inputs.selected;
|
|
897
|
-
const listNavigationInputs = {
|
|
898
|
-
...inputs,
|
|
899
|
-
items: inputs.widgets,
|
|
900
|
-
activeItem: this.activeWidget,
|
|
901
|
-
disabled: this.navigationDisabled,
|
|
902
|
-
focusMode: () => 'roving',
|
|
903
|
-
softDisabled: () => true
|
|
904
|
-
};
|
|
905
|
-
this.focusBehavior = new ListFocus(listNavigationInputs);
|
|
906
|
-
this.navigationBehavior = new ListNavigation({
|
|
907
|
-
...listNavigationInputs,
|
|
908
|
-
focusManager: this.focusBehavior
|
|
909
|
-
});
|
|
910
797
|
}
|
|
911
798
|
onKeydown(event) {
|
|
912
|
-
if (this.disabled()
|
|
913
|
-
|
|
914
|
-
this.activeWidget().onKeydown(event);
|
|
915
|
-
return;
|
|
916
|
-
}
|
|
917
|
-
if (!this.navigationActivated()) {
|
|
918
|
-
this.keydown().handle(event);
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
const widgetActivated = this.widgetActivated();
|
|
922
|
-
this.activeWidget().onKeydown(event);
|
|
923
|
-
if (!widgetActivated) {
|
|
924
|
-
this.keydown().handle(event);
|
|
925
|
-
}
|
|
799
|
+
if (this.disabled()) return;
|
|
800
|
+
this.widget()?.onKeydown(event);
|
|
926
801
|
}
|
|
927
802
|
onFocusIn(event) {
|
|
928
803
|
this.isFocused.set(true);
|
|
@@ -930,14 +805,6 @@ class GridCellPattern {
|
|
|
930
805
|
const widget = this.inputs.getWidget(focusTarget);
|
|
931
806
|
if (!widget) return;
|
|
932
807
|
widget.onFocusIn(event);
|
|
933
|
-
if (widget !== this.activeWidget()) {
|
|
934
|
-
this.navigationBehavior.goto(widget, {
|
|
935
|
-
focusElement: false
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
if (this.multiWidgetMode()) {
|
|
939
|
-
this.navigationActivated.set(true);
|
|
940
|
-
}
|
|
941
808
|
}
|
|
942
809
|
onFocusOut(event) {
|
|
943
810
|
const blurTarget = event.target;
|
|
@@ -946,48 +813,27 @@ class GridCellPattern {
|
|
|
946
813
|
const focusTarget = event.relatedTarget;
|
|
947
814
|
if (this.element().contains(focusTarget)) return;
|
|
948
815
|
this.isFocused.set(false);
|
|
949
|
-
this.navigationActivated.set(false);
|
|
950
816
|
}
|
|
951
817
|
focus() {
|
|
952
|
-
|
|
953
|
-
|
|
818
|
+
const widget = this.widget();
|
|
819
|
+
if (widget) {
|
|
820
|
+
widget.focus();
|
|
954
821
|
} else {
|
|
955
822
|
this.element().focus();
|
|
956
823
|
}
|
|
957
824
|
}
|
|
958
825
|
widgetTabIndex() {
|
|
959
|
-
|
|
960
|
-
return this._tabIndex();
|
|
961
|
-
}
|
|
962
|
-
return this.navigationActivated() ? 0 : -1;
|
|
963
|
-
}
|
|
964
|
-
startNavigation() {
|
|
965
|
-
if (this.navigationActivated()) return;
|
|
966
|
-
this.navigationActivated.set(true);
|
|
967
|
-
this.navigationBehavior.first();
|
|
968
|
-
}
|
|
969
|
-
stopNavigation() {
|
|
970
|
-
if (!this.navigationActivated()) return;
|
|
971
|
-
this.navigationActivated.set(false);
|
|
972
|
-
this.element().focus();
|
|
973
|
-
}
|
|
974
|
-
_advance(op) {
|
|
975
|
-
const success = op();
|
|
976
|
-
if (success) {
|
|
977
|
-
this.activeWidget()?.focus();
|
|
978
|
-
}
|
|
826
|
+
return this._tabIndex();
|
|
979
827
|
}
|
|
980
828
|
}
|
|
981
829
|
|
|
982
830
|
class GridCellWidgetPattern {
|
|
983
831
|
inputs;
|
|
984
|
-
id = () => this.inputs.id();
|
|
985
832
|
element = () => this.inputs.element();
|
|
986
833
|
widgetHost = computed(() => this.inputs.focusTarget() ?? this.element());
|
|
987
|
-
index = computed(() => this.inputs.cell().inputs.widgets().indexOf(this));
|
|
988
834
|
disabled = computed(() => this.inputs.disabled() || this.inputs.cell().disabled());
|
|
989
835
|
tabIndex = computed(() => this.inputs.cell().widgetTabIndex());
|
|
990
|
-
active = computed(() => this.inputs.cell().active() && this.inputs.cell().
|
|
836
|
+
active = computed(() => this.inputs.cell().active() && this.inputs.cell().widget() === this);
|
|
991
837
|
isActivated = signal(false);
|
|
992
838
|
lastActivateEvent = signal(undefined);
|
|
993
839
|
lastDeactivateEvent = signal(undefined);
|