@angular/aria 22.0.0-next.3 → 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 +45 -0
- package/fesm2022/_click-event-manager-chunk.mjs.map +1 -0
- package/fesm2022/_combobox-chunk.mjs +8 -8
- package/fesm2022/_combobox-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-listbox-chunk.mjs +17 -7
- package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-tree-chunk.mjs +16 -6
- package/fesm2022/_combobox-tree-chunk.mjs.map +1 -1
- package/fesm2022/_deferred-content-chunk.mjs +6 -6
- 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 +33 -12
- 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 +15 -5
- package/fesm2022/_tabs-chunk.mjs.map +1 -1
- package/fesm2022/_toolbar-widget-group-chunk.mjs +13 -1
- package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
- package/fesm2022/_widget-chunk.mjs +17 -169
- 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 +217 -192
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/aria.mjs +1 -1
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/combobox.mjs +15 -15
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +26 -97
- 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 +13 -20
- 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 +18 -22
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/private.mjs +2 -0
- 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 +22 -32
- 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 +20 -26
- 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 +16 -26
- 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 +27 -0
- 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 +13 -51
- 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 +37 -30
- package/types/_menu-chunk.d.ts +60 -56
- 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 +13 -6
- package/types/_toolbar-chunk.d.ts +6 -1
- package/types/_tree-chunk.d.ts +24 -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 +21 -22
- package/types/menu-testing.d.ts +50 -0
- package/types/menu.d.ts +4 -3
- package/types/private.d.ts +48 -45
- package/types/tabs-testing.d.ts +57 -0
- package/types/tabs.d.ts +4 -9
- package/types/toolbar-testing.d.ts +72 -0
- package/types/toolbar.d.ts +3 -5
- package/types/tree-testing.d.ts +75 -0
- package/types/tree.d.ts +5 -9
|
@@ -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;
|
|
@@ -599,13 +598,10 @@ class GridPattern {
|
|
|
599
598
|
anchorCell = computed(() => this.multiSelectable() ? this.gridBehavior.selectionAnchorCell() : undefined);
|
|
600
599
|
pauseNavigation = computed(() => this.gridBehavior.data.cells().flat().reduce((res, c) => res || c.isActivated(), false));
|
|
601
600
|
isFocused = signal(false);
|
|
602
|
-
|
|
601
|
+
hasBeenInteracted = signal(false);
|
|
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);
|
|
@@ -721,31 +676,18 @@ class GridPattern {
|
|
|
721
676
|
}
|
|
722
677
|
onKeydown(event) {
|
|
723
678
|
if (this.disabled()) return;
|
|
679
|
+
this.hasBeenInteracted.set(true);
|
|
724
680
|
this.activeCell()?.onKeydown(event);
|
|
725
681
|
this.keydown().handle(event);
|
|
726
682
|
}
|
|
727
683
|
onPointerdown(event) {
|
|
728
684
|
if (this.disabled()) return;
|
|
685
|
+
this.hasBeenInteracted.set(true);
|
|
729
686
|
this.pointerdown().handle(event);
|
|
730
687
|
}
|
|
731
|
-
onPointermove(event) {
|
|
732
|
-
if (this.acceptsPointerMove()) {
|
|
733
|
-
const cell = this.inputs.getCell(event.target);
|
|
734
|
-
if (cell !== undefined) {
|
|
735
|
-
this.gridBehavior.gotoCell(cell, {
|
|
736
|
-
anchor: true
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
onPointerup(event) {
|
|
742
|
-
if (this.disabled()) return;
|
|
743
|
-
this.pointerup().handle(event);
|
|
744
|
-
}
|
|
745
688
|
onFocusIn(event) {
|
|
746
689
|
this.isFocused.set(true);
|
|
747
|
-
this.
|
|
748
|
-
if (this.dragging()) return;
|
|
690
|
+
this.hasBeenInteracted.set(true);
|
|
749
691
|
const cell = this.inputs.getCell(event.target);
|
|
750
692
|
if (!cell || !this.gridBehavior.focusBehavior.isFocusable(cell)) return;
|
|
751
693
|
cell.onFocusIn(event);
|
|
@@ -765,7 +707,7 @@ class GridPattern {
|
|
|
765
707
|
this.isFocused.set(false);
|
|
766
708
|
}
|
|
767
709
|
setDefaultStateEffect() {
|
|
768
|
-
if (this.
|
|
710
|
+
if (this.hasBeenInteracted()) return;
|
|
769
711
|
this.gridBehavior.setDefaultState();
|
|
770
712
|
}
|
|
771
713
|
resetStateEffect() {
|
|
@@ -842,85 +784,20 @@ class GridCellPattern {
|
|
|
842
784
|
ariaColIndex = computed(() => this.inputs.colIndex() ?? this.inputs.grid().gridBehavior.colIndex(this));
|
|
843
785
|
_tabIndex = computed(() => this.inputs.grid().gridBehavior.cellTabIndex(this));
|
|
844
786
|
tabIndex = computed(() => {
|
|
845
|
-
if (this.
|
|
787
|
+
if (this.inputs.widget()) {
|
|
846
788
|
return -1;
|
|
847
789
|
}
|
|
848
790
|
return this._tabIndex();
|
|
849
791
|
});
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
navigationDisabled = computed(() => !this.multiWidgetMode() || !this.active() || this.inputs.disabled());
|
|
853
|
-
focusBehavior;
|
|
854
|
-
navigationBehavior;
|
|
855
|
-
activeWidget = linkedSignal(() => this.inputs.widgets().length > 0 ? this.inputs.widgets()[0] : undefined);
|
|
856
|
-
navigationActivated = signal(false);
|
|
857
|
-
widgetActivated = computed(() => this.inputs.widgets().some(w => w.isActivated()));
|
|
858
|
-
isActivated = computed(() => this.navigationActivated() || this.widgetActivated());
|
|
859
|
-
prevKey = computed(() => {
|
|
860
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
861
|
-
return 'ArrowUp';
|
|
862
|
-
}
|
|
863
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
|
|
864
|
-
});
|
|
865
|
-
nextKey = computed(() => {
|
|
866
|
-
if (this.inputs.orientation() === 'vertical') {
|
|
867
|
-
return 'ArrowDown';
|
|
868
|
-
}
|
|
869
|
-
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
870
|
-
});
|
|
871
|
-
keydown = computed(() => {
|
|
872
|
-
const manager = new KeyboardEventManager();
|
|
873
|
-
if (!this.navigationActivated()) {
|
|
874
|
-
manager.on('Enter', () => this.startNavigation());
|
|
875
|
-
return manager;
|
|
876
|
-
}
|
|
877
|
-
manager.on('Escape', () => this.stopNavigation()).on(this.prevKey(), () => this._advance(() => this.navigationBehavior.prev({
|
|
878
|
-
focusElement: false
|
|
879
|
-
})), {
|
|
880
|
-
ignoreRepeat: false
|
|
881
|
-
}).on(this.nextKey(), () => this._advance(() => this.navigationBehavior.next({
|
|
882
|
-
focusElement: false
|
|
883
|
-
})), {
|
|
884
|
-
ignoreRepeat: false
|
|
885
|
-
}).on('Home', () => this._advance(() => this.navigationBehavior.next({
|
|
886
|
-
focusElement: false
|
|
887
|
-
}))).on('End', () => this._advance(() => this.navigationBehavior.next({
|
|
888
|
-
focusElement: false
|
|
889
|
-
})));
|
|
890
|
-
return manager;
|
|
891
|
-
});
|
|
792
|
+
widget = () => this.inputs.widget();
|
|
793
|
+
isActivated = computed(() => this.widget()?.isActivated() ?? false);
|
|
892
794
|
constructor(inputs) {
|
|
893
795
|
this.inputs = inputs;
|
|
894
796
|
this.selected = inputs.selected;
|
|
895
|
-
const listNavigationInputs = {
|
|
896
|
-
...inputs,
|
|
897
|
-
items: inputs.widgets,
|
|
898
|
-
activeItem: this.activeWidget,
|
|
899
|
-
disabled: this.navigationDisabled,
|
|
900
|
-
focusMode: () => 'roving',
|
|
901
|
-
softDisabled: () => true
|
|
902
|
-
};
|
|
903
|
-
this.focusBehavior = new ListFocus(listNavigationInputs);
|
|
904
|
-
this.navigationBehavior = new ListNavigation({
|
|
905
|
-
...listNavigationInputs,
|
|
906
|
-
focusManager: this.focusBehavior
|
|
907
|
-
});
|
|
908
797
|
}
|
|
909
798
|
onKeydown(event) {
|
|
910
|
-
if (this.disabled()
|
|
911
|
-
|
|
912
|
-
this.activeWidget().onKeydown(event);
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
if (!this.navigationActivated()) {
|
|
916
|
-
this.keydown().handle(event);
|
|
917
|
-
return;
|
|
918
|
-
}
|
|
919
|
-
const widgetActivated = this.widgetActivated();
|
|
920
|
-
this.activeWidget().onKeydown(event);
|
|
921
|
-
if (!widgetActivated) {
|
|
922
|
-
this.keydown().handle(event);
|
|
923
|
-
}
|
|
799
|
+
if (this.disabled()) return;
|
|
800
|
+
this.widget()?.onKeydown(event);
|
|
924
801
|
}
|
|
925
802
|
onFocusIn(event) {
|
|
926
803
|
this.isFocused.set(true);
|
|
@@ -928,14 +805,6 @@ class GridCellPattern {
|
|
|
928
805
|
const widget = this.inputs.getWidget(focusTarget);
|
|
929
806
|
if (!widget) return;
|
|
930
807
|
widget.onFocusIn(event);
|
|
931
|
-
if (widget !== this.activeWidget()) {
|
|
932
|
-
this.navigationBehavior.goto(widget, {
|
|
933
|
-
focusElement: false
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
if (this.multiWidgetMode()) {
|
|
937
|
-
this.navigationActivated.set(true);
|
|
938
|
-
}
|
|
939
808
|
}
|
|
940
809
|
onFocusOut(event) {
|
|
941
810
|
const blurTarget = event.target;
|
|
@@ -944,48 +813,27 @@ class GridCellPattern {
|
|
|
944
813
|
const focusTarget = event.relatedTarget;
|
|
945
814
|
if (this.element().contains(focusTarget)) return;
|
|
946
815
|
this.isFocused.set(false);
|
|
947
|
-
this.navigationActivated.set(false);
|
|
948
816
|
}
|
|
949
817
|
focus() {
|
|
950
|
-
|
|
951
|
-
|
|
818
|
+
const widget = this.widget();
|
|
819
|
+
if (widget) {
|
|
820
|
+
widget.focus();
|
|
952
821
|
} else {
|
|
953
822
|
this.element().focus();
|
|
954
823
|
}
|
|
955
824
|
}
|
|
956
825
|
widgetTabIndex() {
|
|
957
|
-
|
|
958
|
-
return this._tabIndex();
|
|
959
|
-
}
|
|
960
|
-
return this.navigationActivated() ? 0 : -1;
|
|
961
|
-
}
|
|
962
|
-
startNavigation() {
|
|
963
|
-
if (this.navigationActivated()) return;
|
|
964
|
-
this.navigationActivated.set(true);
|
|
965
|
-
this.navigationBehavior.first();
|
|
966
|
-
}
|
|
967
|
-
stopNavigation() {
|
|
968
|
-
if (!this.navigationActivated()) return;
|
|
969
|
-
this.navigationActivated.set(false);
|
|
970
|
-
this.element().focus();
|
|
971
|
-
}
|
|
972
|
-
_advance(op) {
|
|
973
|
-
const success = op();
|
|
974
|
-
if (success) {
|
|
975
|
-
this.activeWidget()?.focus();
|
|
976
|
-
}
|
|
826
|
+
return this._tabIndex();
|
|
977
827
|
}
|
|
978
828
|
}
|
|
979
829
|
|
|
980
830
|
class GridCellWidgetPattern {
|
|
981
831
|
inputs;
|
|
982
|
-
id = () => this.inputs.id();
|
|
983
832
|
element = () => this.inputs.element();
|
|
984
833
|
widgetHost = computed(() => this.inputs.focusTarget() ?? this.element());
|
|
985
|
-
index = computed(() => this.inputs.cell().inputs.widgets().indexOf(this));
|
|
986
834
|
disabled = computed(() => this.inputs.disabled() || this.inputs.cell().disabled());
|
|
987
835
|
tabIndex = computed(() => this.inputs.cell().widgetTabIndex());
|
|
988
|
-
active = computed(() => this.inputs.cell().active() && this.inputs.cell().
|
|
836
|
+
active = computed(() => this.inputs.cell().active() && this.inputs.cell().widget() === this);
|
|
989
837
|
isActivated = signal(false);
|
|
990
838
|
lastActivateEvent = signal(undefined);
|
|
991
839
|
lastDeactivateEvent = signal(undefined);
|