@soxa-ui/plugins 0.0.0-stage → 0.3.0-beta.1
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/LICENSE +21 -0
- package/README.md +125 -2
- package/dist/base/base.class.d.ts +54 -0
- package/dist/base/base.class.js +69 -0
- package/dist/base/bundle.class.d.ts +25 -0
- package/dist/base/bundle.class.js +68 -0
- package/dist/base/index.d.ts +3 -0
- package/dist/base/types.d.ts +147 -0
- package/dist/custom/accordion/header.d.ts +19 -0
- package/dist/custom/accordion/header.js +38 -0
- package/dist/custom/accordion/index.d.ts +2 -0
- package/dist/custom/accordion/item-ids/index.d.ts +1 -0
- package/dist/custom/accordion/item-ids/item-ids.plugin.d.ts +24 -0
- package/dist/custom/accordion/item-ids/item-ids.plugin.js +44 -0
- package/dist/custom/action/action.plugin.d.ts +178 -0
- package/dist/custom/action/action.plugin.js +339 -0
- package/dist/custom/action/index.d.ts +2 -0
- package/dist/custom/action/types.d.ts +65 -0
- package/dist/custom/calendar/ids/ids.plugin.d.ts +25 -0
- package/dist/custom/calendar/ids/ids.plugin.js +44 -0
- package/dist/custom/calendar/ids/index.d.ts +1 -0
- package/dist/custom/calendar/index.d.ts +5 -0
- package/dist/custom/calendar/keyboard/index.d.ts +2 -0
- package/dist/custom/calendar/keyboard/keyboard.plugin.d.ts +114 -0
- package/dist/custom/calendar/keyboard/keyboard.plugin.js +249 -0
- package/dist/custom/calendar/keyboard/types.d.ts +16 -0
- package/dist/custom/calendar/names/index.d.ts +1 -0
- package/dist/custom/calendar/names/names.plugin.d.ts +24 -0
- package/dist/custom/calendar/names/names.plugin.js +45 -0
- package/dist/custom/calendar/parts.d.ts +58 -0
- package/dist/custom/calendar/parts.js +119 -0
- package/dist/custom/calendar/pointer/index.d.ts +2 -0
- package/dist/custom/calendar/pointer/pointer.plugin.d.ts +58 -0
- package/dist/custom/calendar/pointer/pointer.plugin.js +144 -0
- package/dist/custom/calendar/pointer/types.d.ts +6 -0
- package/dist/custom/calendar/stop.d.ts +20 -0
- package/dist/custom/calendar/stop.js +32 -0
- package/dist/custom/calendar/types.d.ts +16 -0
- package/dist/custom/clearable/index.d.ts +1 -0
- package/dist/custom/clearable/names/index.d.ts +1 -0
- package/dist/custom/clearable/names/names.plugin.d.ts +24 -0
- package/dist/custom/clearable/names/names.plugin.js +29 -0
- package/dist/custom/collection/bundles.plugin.d.ts +55 -0
- package/dist/custom/collection/bundles.plugin.js +100 -0
- package/dist/custom/collection/collection-bundles-access.plugin.d.ts +29 -0
- package/dist/custom/collection/collection-bundles-access.plugin.js +44 -0
- package/dist/custom/collection/collection-elements.plugin.d.ts +55 -0
- package/dist/custom/collection/collection-elements.plugin.js +100 -0
- package/dist/custom/collection/index.d.ts +4 -0
- package/dist/custom/collection/leaving-focus.d.ts +119 -0
- package/dist/custom/collection/leaving-focus.js +164 -0
- package/dist/custom/collection/reachable.d.ts +14 -0
- package/dist/custom/collection/reachable.js +18 -0
- package/dist/custom/collection/types.d.ts +14 -0
- package/dist/custom/component-view/aria.plugin.d.ts +102 -0
- package/dist/custom/component-view/aria.plugin.js +190 -0
- package/dist/custom/component-view/index.d.ts +2 -0
- package/dist/custom/component-view/types.d.ts +62 -0
- package/dist/custom/date-input/clipboard/clipboard.plugin.d.ts +41 -0
- package/dist/custom/date-input/clipboard/clipboard.plugin.js +98 -0
- package/dist/custom/date-input/clipboard/index.d.ts +2 -0
- package/dist/custom/date-input/clipboard/types.d.ts +6 -0
- package/dist/custom/date-input/ids/ids.plugin.d.ts +21 -0
- package/dist/custom/date-input/ids/ids.plugin.js +28 -0
- package/dist/custom/date-input/ids/index.d.ts +1 -0
- package/dist/custom/date-input/index.d.ts +6 -0
- package/dist/custom/date-input/keyboard/index.d.ts +2 -0
- package/dist/custom/date-input/keyboard/keyboard.plugin.d.ts +54 -0
- package/dist/custom/date-input/keyboard/keyboard.plugin.js +154 -0
- package/dist/custom/date-input/keyboard/types.d.ts +9 -0
- package/dist/custom/date-input/parts.d.ts +49 -0
- package/dist/custom/date-input/parts.js +127 -0
- package/dist/custom/date-input/pointer/index.d.ts +2 -0
- package/dist/custom/date-input/pointer/pointer.plugin.d.ts +51 -0
- package/dist/custom/date-input/pointer/pointer.plugin.js +141 -0
- package/dist/custom/date-input/pointer/types.d.ts +6 -0
- package/dist/custom/date-input/touch/index.d.ts +2 -0
- package/dist/custom/date-input/touch/touch.plugin.d.ts +100 -0
- package/dist/custom/date-input/touch/touch.plugin.js +276 -0
- package/dist/custom/date-input/touch/types.d.ts +6 -0
- package/dist/custom/date-input/types.d.ts +6 -0
- package/dist/custom/date-picker/field.d.ts +20 -0
- package/dist/custom/date-picker/field.js +27 -0
- package/dist/custom/date-picker/focus/focus.plugin.d.ts +56 -0
- package/dist/custom/date-picker/focus/focus.plugin.js +81 -0
- package/dist/custom/date-picker/focus/index.d.ts +2 -0
- package/dist/custom/date-picker/focus/types.d.ts +3 -0
- package/dist/custom/date-picker/ids/ids.plugin.d.ts +19 -0
- package/dist/custom/date-picker/ids/ids.plugin.js +28 -0
- package/dist/custom/date-picker/ids/index.d.ts +1 -0
- package/dist/custom/date-picker/index.d.ts +5 -0
- package/dist/custom/date-picker/names/index.d.ts +2 -0
- package/dist/custom/date-picker/names/names.plugin.d.ts +33 -0
- package/dist/custom/date-picker/names/names.plugin.js +80 -0
- package/dist/custom/date-picker/names/types.d.ts +12 -0
- package/dist/custom/date-picker/trigger/index.d.ts +2 -0
- package/dist/custom/date-picker/trigger/trigger.plugin.d.ts +37 -0
- package/dist/custom/date-picker/trigger/trigger.plugin.js +69 -0
- package/dist/custom/date-picker/trigger/types.d.ts +3 -0
- package/dist/custom/dialog/ids/ids.plugin.d.ts +15 -0
- package/dist/custom/dialog/ids/ids.plugin.js +28 -0
- package/dist/custom/dialog/ids/index.d.ts +1 -0
- package/dist/custom/dialog/index.d.ts +3 -0
- package/dist/custom/dialog/layout/index.d.ts +3 -0
- package/dist/custom/dialog/layout/layout.plugin.d.ts +42 -0
- package/dist/custom/dialog/layout/layout.plugin.js +78 -0
- package/dist/custom/dialog/layout/offset-event.d.ts +35 -0
- package/dist/custom/dialog/layout/offset-event.js +44 -0
- package/dist/custom/dialog/layout/types.d.ts +12 -0
- package/dist/custom/dialog/names/index.d.ts +1 -0
- package/dist/custom/dialog/names/names.plugin.d.ts +13 -0
- package/dist/custom/dialog/names/names.plugin.js +17 -0
- package/dist/custom/dismiss/dismiss.plugin.d.ts +174 -0
- package/dist/custom/dismiss/dismiss.plugin.js +287 -0
- package/dist/custom/dismiss/index.d.ts +2 -0
- package/dist/custom/dismiss/types.d.ts +59 -0
- package/dist/custom/drag-and-drop/drag.plugin.d.ts +87 -0
- package/dist/custom/drag-and-drop/drag.plugin.js +310 -0
- package/dist/custom/drag-and-drop/index.d.ts +2 -0
- package/dist/custom/drag-and-drop/types.d.ts +13 -0
- package/dist/custom/drawer/index.d.ts +1 -0
- package/dist/custom/drawer/layout/index.d.ts +2 -0
- package/dist/custom/drawer/layout/layout.plugin.d.ts +17 -0
- package/dist/custom/drawer/layout/layout.plugin.js +22 -0
- package/dist/custom/drawer/layout/types.d.ts +3 -0
- package/dist/custom/element/element.plugin.d.ts +35 -0
- package/dist/custom/element/element.plugin.js +58 -0
- package/dist/custom/element/index.d.ts +2 -0
- package/dist/custom/element/types.d.ts +18 -0
- package/dist/custom/field/ids/ids.plugin.d.ts +64 -0
- package/dist/custom/field/ids/ids.plugin.js +126 -0
- package/dist/custom/field/ids/index.d.ts +2 -0
- package/dist/custom/field/ids/types.d.ts +28 -0
- package/dist/custom/field/index.d.ts +1 -0
- package/dist/custom/frame/anchor/anchor.plugin.d.ts +483 -0
- package/dist/custom/frame/anchor/anchor.plugin.js +820 -0
- package/dist/custom/frame/anchor/index.d.ts +2 -0
- package/dist/custom/frame/anchor/types.d.ts +83 -0
- package/dist/custom/frame/index.d.ts +2 -0
- package/dist/custom/frame/layout/index.d.ts +2 -0
- package/dist/custom/frame/layout/layout.plugin.d.ts +24 -0
- package/dist/custom/frame/layout/layout.plugin.js +65 -0
- package/dist/custom/frame/layout/types.d.ts +5 -0
- package/dist/custom/icon/index.d.ts +2 -0
- package/dist/custom/icon/layout.plugin.d.ts +21 -0
- package/dist/custom/icon/layout.plugin.js +51 -0
- package/dist/custom/icon/types.d.ts +5 -0
- package/dist/custom/id/id.plugin.d.ts +32 -0
- package/dist/custom/id/id.plugin.js +42 -0
- package/dist/custom/id/index.d.ts +2 -0
- package/dist/custom/id/types.d.ts +6 -0
- package/dist/custom/index.d.ts +42 -0
- package/dist/custom/input/field.d.ts +16 -0
- package/dist/custom/input/field.js +27 -0
- package/dist/custom/input/index.d.ts +3 -0
- package/dist/custom/input/input.plugin.d.ts +12 -0
- package/dist/custom/input/input.plugin.js +46 -0
- package/dist/custom/input/types.d.ts +2 -0
- package/dist/custom/input-bool/index.d.ts +2 -0
- package/dist/custom/input-bool/input-bool.plugin.d.ts +30 -0
- package/dist/custom/input-bool/input-bool.plugin.js +77 -0
- package/dist/custom/input-bool/types.d.ts +5 -0
- package/dist/custom/input-control/index.d.ts +2 -0
- package/dist/custom/input-control/input-control.plugin.d.ts +12 -0
- package/dist/custom/input-control/input-control.plugin.js +40 -0
- package/dist/custom/input-control/types.d.ts +2 -0
- package/dist/custom/item-group/ids/ids.plugin.d.ts +19 -0
- package/dist/custom/item-group/ids/ids.plugin.js +32 -0
- package/dist/custom/item-group/ids/index.d.ts +1 -0
- package/dist/custom/item-group/index.d.ts +1 -0
- package/dist/custom/label/index.d.ts +1 -0
- package/dist/custom/label/nested-warn/index.d.ts +1 -0
- package/dist/custom/label/nested-warn/nested-warn.plugin.d.ts +21 -0
- package/dist/custom/label/nested-warn/nested-warn.plugin.js +41 -0
- package/dist/custom/list/height/height.plugin.d.ts +129 -0
- package/dist/custom/list/height/height.plugin.js +272 -0
- package/dist/custom/list/height/index.d.ts +2 -0
- package/dist/custom/list/height/types.d.ts +10 -0
- package/dist/custom/list/index.d.ts +7 -0
- package/dist/custom/list/item/index.d.ts +2 -0
- package/dist/custom/list/item/item.plugin.d.ts +25 -0
- package/dist/custom/list/item/item.plugin.js +46 -0
- package/dist/custom/list/item/types.d.ts +5 -0
- package/dist/custom/list/keyboard/index.d.ts +2 -0
- package/dist/custom/list/keyboard/keyboard.plugin.d.ts +133 -0
- package/dist/custom/list/keyboard/keyboard.plugin.js +199 -0
- package/dist/custom/list/keyboard/types.d.ts +3 -0
- package/dist/custom/list/navigation/index.d.ts +2 -0
- package/dist/custom/list/navigation/navigation.plugin.d.ts +262 -0
- package/dist/custom/list/navigation/navigation.plugin.js +402 -0
- package/dist/custom/list/navigation/types.d.ts +25 -0
- package/dist/custom/list/newly-selected.d.ts +17 -0
- package/dist/custom/list/newly-selected.js +22 -0
- package/dist/custom/list/option-ids/index.d.ts +1 -0
- package/dist/custom/list/option-ids/option-ids.plugin.d.ts +29 -0
- package/dist/custom/list/option-ids/option-ids.plugin.js +43 -0
- package/dist/custom/list/row.d.ts +50 -0
- package/dist/custom/list/row.js +99 -0
- package/dist/custom/list/scroll/index.d.ts +2 -0
- package/dist/custom/list/scroll/scroll.plugin.d.ts +132 -0
- package/dist/custom/list/scroll/scroll.plugin.js +286 -0
- package/dist/custom/list/scroll/types.d.ts +21 -0
- package/dist/custom/list/typeahead.d.ts +53 -0
- package/dist/custom/list/typeahead.js +58 -0
- package/dist/custom/menu/focus/focus.plugin.d.ts +61 -0
- package/dist/custom/menu/focus/focus.plugin.js +105 -0
- package/dist/custom/menu/focus/index.d.ts +2 -0
- package/dist/custom/menu/focus/types.d.ts +2 -0
- package/dist/custom/menu/hover/hover.plugin.d.ts +99 -0
- package/dist/custom/menu/hover/hover.plugin.js +235 -0
- package/dist/custom/menu/hover/index.d.ts +2 -0
- package/dist/custom/menu/hover/types.d.ts +2 -0
- package/dist/custom/menu/ids/ids.plugin.d.ts +29 -0
- package/dist/custom/menu/ids/ids.plugin.js +46 -0
- package/dist/custom/menu/ids/index.d.ts +1 -0
- package/dist/custom/menu/index.d.ts +11 -0
- package/dist/custom/menu/keyboard/index.d.ts +2 -0
- package/dist/custom/menu/keyboard/keyboard.plugin.d.ts +41 -0
- package/dist/custom/menu/keyboard/keyboard.plugin.js +68 -0
- package/dist/custom/menu/keyboard/types.d.ts +2 -0
- package/dist/custom/menu/navigation/index.d.ts +2 -0
- package/dist/custom/menu/navigation/navigation.plugin.d.ts +116 -0
- package/dist/custom/menu/navigation/navigation.plugin.js +222 -0
- package/dist/custom/menu/navigation/types.d.ts +2 -0
- package/dist/custom/menu/nested-layer.d.ts +13 -0
- package/dist/custom/menu/nested-layer.js +20 -0
- package/dist/custom/menu/pointer/index.d.ts +2 -0
- package/dist/custom/menu/pointer/pointer.plugin.d.ts +45 -0
- package/dist/custom/menu/pointer/pointer.plugin.js +95 -0
- package/dist/custom/menu/pointer/strategies/context.strategy.d.ts +70 -0
- package/dist/custom/menu/pointer/strategies/context.strategy.js +170 -0
- package/dist/custom/menu/pointer/strategies/index.d.ts +3 -0
- package/dist/custom/menu/pointer/strategies/press.strategy.d.ts +23 -0
- package/dist/custom/menu/pointer/strategies/press.strategy.js +33 -0
- package/dist/custom/menu/pointer/strategies/types.d.ts +49 -0
- package/dist/custom/menu/pointer/types.d.ts +2 -0
- package/dist/custom/menu/popover-item-focus/focus.plugin.d.ts +54 -0
- package/dist/custom/menu/popover-item-focus/focus.plugin.js +70 -0
- package/dist/custom/menu/popover-item-focus/index.d.ts +2 -0
- package/dist/custom/menu/popover-item-focus/types.d.ts +10 -0
- package/dist/custom/menu/popover-item-keyboard/index.d.ts +2 -0
- package/dist/custom/menu/popover-item-keyboard/keyboard.plugin.d.ts +43 -0
- package/dist/custom/menu/popover-item-keyboard/keyboard.plugin.js +79 -0
- package/dist/custom/menu/popover-item-keyboard/types.d.ts +2 -0
- package/dist/custom/menu/popup-ids/ids.plugin.d.ts +27 -0
- package/dist/custom/menu/popup-ids/ids.plugin.js +47 -0
- package/dist/custom/menu/popup-ids/index.d.ts +1 -0
- package/dist/custom/menu/submenu-focus/focus.plugin.d.ts +53 -0
- package/dist/custom/menu/submenu-focus/focus.plugin.js +84 -0
- package/dist/custom/menu/submenu-focus/index.d.ts +2 -0
- package/dist/custom/menu/submenu-focus/types.d.ts +10 -0
- package/dist/custom/menu/submenu-keyboard/index.d.ts +2 -0
- package/dist/custom/menu/submenu-keyboard/keyboard.plugin.d.ts +43 -0
- package/dist/custom/menu/submenu-keyboard/keyboard.plugin.js +74 -0
- package/dist/custom/menu/submenu-keyboard/types.d.ts +2 -0
- package/dist/custom/number-input/index.d.ts +5 -0
- package/dist/custom/number-input/keyboard/index.d.ts +2 -0
- package/dist/custom/number-input/keyboard/keyboard.plugin.d.ts +36 -0
- package/dist/custom/number-input/keyboard/keyboard.plugin.js +80 -0
- package/dist/custom/number-input/keyboard/types.d.ts +3 -0
- package/dist/custom/number-input/names/index.d.ts +1 -0
- package/dist/custom/number-input/names/names.plugin.d.ts +17 -0
- package/dist/custom/number-input/names/names.plugin.js +24 -0
- package/dist/custom/number-input/parts.d.ts +21 -0
- package/dist/custom/number-input/parts.js +39 -0
- package/dist/custom/number-input/stepper/index.d.ts +2 -0
- package/dist/custom/number-input/stepper/stepper.plugin.d.ts +59 -0
- package/dist/custom/number-input/stepper/stepper.plugin.js +166 -0
- package/dist/custom/number-input/stepper/types.d.ts +19 -0
- package/dist/custom/number-input/touch/index.d.ts +2 -0
- package/dist/custom/number-input/touch/touch.plugin.d.ts +25 -0
- package/dist/custom/number-input/touch/touch.plugin.js +53 -0
- package/dist/custom/number-input/touch/types.d.ts +3 -0
- package/dist/custom/number-input/types.d.ts +8 -0
- package/dist/custom/number-input/typing/index.d.ts +2 -0
- package/dist/custom/number-input/typing/types.d.ts +6 -0
- package/dist/custom/number-input/typing/typing.plugin.d.ts +47 -0
- package/dist/custom/number-input/typing/typing.plugin.js +149 -0
- package/dist/custom/overlay/focus/focus.plugin.d.ts +150 -0
- package/dist/custom/overlay/focus/focus.plugin.js +242 -0
- package/dist/custom/overlay/focus/index.d.ts +1 -0
- package/dist/custom/overlay/hide-outside/hide-outside.plugin.d.ts +84 -0
- package/dist/custom/overlay/hide-outside/hide-outside.plugin.js +187 -0
- package/dist/custom/overlay/hide-outside/index.d.ts +2 -0
- package/dist/custom/overlay/hide-outside/marks.d.ts +19 -0
- package/dist/custom/overlay/hide-outside/marks.js +43 -0
- package/dist/custom/overlay/hide-outside/types.d.ts +17 -0
- package/dist/custom/overlay/index.d.ts +9 -0
- package/dist/custom/overlay/modal-focus/index.d.ts +1 -0
- package/dist/custom/overlay/modal-focus/modal-focus.plugin.d.ts +72 -0
- package/dist/custom/overlay/modal-focus/modal-focus.plugin.js +109 -0
- package/dist/custom/overlay/modal-ids/index.d.ts +1 -0
- package/dist/custom/overlay/modal-ids/modal-ids.plugin.d.ts +21 -0
- package/dist/custom/overlay/modal-ids/modal-ids.plugin.js +30 -0
- package/dist/custom/overlay/modal-layout/index.d.ts +2 -0
- package/dist/custom/overlay/modal-layout/modal-layout.plugin.d.ts +66 -0
- package/dist/custom/overlay/modal-layout/modal-layout.plugin.js +119 -0
- package/dist/custom/overlay/modal-layout/types.d.ts +13 -0
- package/dist/custom/overlay/modal-names/index.d.ts +1 -0
- package/dist/custom/overlay/modal-names/modal-names.plugin.d.ts +14 -0
- package/dist/custom/overlay/modal-names/modal-names.plugin.js +17 -0
- package/dist/custom/overlay/open-state.d.ts +12 -0
- package/dist/custom/overlay/open-state.js +42 -0
- package/dist/custom/overlay/scroll-lock/index.d.ts +2 -0
- package/dist/custom/overlay/scroll-lock/lock.d.ts +17 -0
- package/dist/custom/overlay/scroll-lock/lock.js +83 -0
- package/dist/custom/overlay/scroll-lock/scroll-lock.plugin.d.ts +78 -0
- package/dist/custom/overlay/scroll-lock/scroll-lock.plugin.js +134 -0
- package/dist/custom/overlay/scroll-lock/types.d.ts +17 -0
- package/dist/custom/overlay/swipe/index.d.ts +2 -0
- package/dist/custom/overlay/swipe/swipe.plugin.d.ts +150 -0
- package/dist/custom/overlay/swipe/swipe.plugin.js +432 -0
- package/dist/custom/overlay/swipe/types.d.ts +62 -0
- package/dist/custom/overlay/types.d.ts +40 -0
- package/dist/custom/pagination/current.d.ts +24 -0
- package/dist/custom/pagination/current.js +34 -0
- package/dist/custom/pagination/focus/focus.plugin.d.ts +57 -0
- package/dist/custom/pagination/focus/focus.plugin.js +106 -0
- package/dist/custom/pagination/focus/index.d.ts +2 -0
- package/dist/custom/pagination/focus/types.d.ts +8 -0
- package/dist/custom/pagination/index.d.ts +3 -0
- package/dist/custom/pagination/names/index.d.ts +1 -0
- package/dist/custom/pagination/names/names.plugin.d.ts +15 -0
- package/dist/custom/pagination/names/names.plugin.js +19 -0
- package/dist/custom/popover/focus/focus.plugin.d.ts +69 -0
- package/dist/custom/popover/focus/focus.plugin.js +107 -0
- package/dist/custom/popover/focus/index.d.ts +2 -0
- package/dist/custom/popover/focus/types.d.ts +2 -0
- package/dist/custom/popover/ids/ids.plugin.d.ts +18 -0
- package/dist/custom/popover/ids/ids.plugin.js +27 -0
- package/dist/custom/popover/ids/index.d.ts +1 -0
- package/dist/custom/popover/index.d.ts +4 -0
- package/dist/custom/popover/names/index.d.ts +1 -0
- package/dist/custom/popover/names/names.plugin.d.ts +7 -0
- package/dist/custom/popover/names/names.plugin.js +10 -0
- package/dist/custom/popover/pointer/index.d.ts +2 -0
- package/dist/custom/popover/pointer/pointer.plugin.d.ts +35 -0
- package/dist/custom/popover/pointer/pointer.plugin.js +65 -0
- package/dist/custom/popover/pointer/types.d.ts +2 -0
- package/dist/custom/radio-group/checked/checked.plugin.d.ts +45 -0
- package/dist/custom/radio-group/checked/checked.plugin.js +81 -0
- package/dist/custom/radio-group/checked/index.d.ts +1 -0
- package/dist/custom/radio-group/index.d.ts +3 -0
- package/dist/custom/radio-group/name/index.d.ts +1 -0
- package/dist/custom/radio-group/name/name.plugin.d.ts +21 -0
- package/dist/custom/radio-group/name/name.plugin.js +39 -0
- package/dist/custom/radio-group/stop.d.ts +17 -0
- package/dist/custom/radio-group/stop.js +30 -0
- package/dist/custom/rating/hover/hover.plugin.d.ts +36 -0
- package/dist/custom/rating/hover/hover.plugin.js +71 -0
- package/dist/custom/rating/hover/index.d.ts +2 -0
- package/dist/custom/rating/hover/types.d.ts +7 -0
- package/dist/custom/rating/index.d.ts +3 -0
- package/dist/custom/rating/names/index.d.ts +1 -0
- package/dist/custom/rating/names/names.plugin.d.ts +25 -0
- package/dist/custom/rating/names/names.plugin.js +45 -0
- package/dist/custom/rating/validity/index.d.ts +2 -0
- package/dist/custom/rating/validity/types.d.ts +7 -0
- package/dist/custom/rating/validity/validity.plugin.d.ts +48 -0
- package/dist/custom/rating/validity/validity.plugin.js +91 -0
- package/dist/custom/ready/index.d.ts +1 -0
- package/dist/custom/ready/ready.plugin.d.ts +14 -0
- package/dist/custom/ready/ready.plugin.js +28 -0
- package/dist/custom/scroller/index.d.ts +2 -0
- package/dist/custom/scroller/names/index.d.ts +1 -0
- package/dist/custom/scroller/names/names.plugin.d.ts +11 -0
- package/dist/custom/scroller/names/names.plugin.js +15 -0
- package/dist/custom/scroller/viewport/edges.d.ts +34 -0
- package/dist/custom/scroller/viewport/edges.js +29 -0
- package/dist/custom/scroller/viewport/focus.d.ts +39 -0
- package/dist/custom/scroller/viewport/focus.js +61 -0
- package/dist/custom/scroller/viewport/index.d.ts +6 -0
- package/dist/custom/scroller/viewport/stop.d.ts +24 -0
- package/dist/custom/scroller/viewport/stop.js +34 -0
- package/dist/custom/scroller/viewport/types.d.ts +31 -0
- package/dist/custom/scroller/viewport/viewport.plugin.d.ts +163 -0
- package/dist/custom/scroller/viewport/viewport.plugin.js +352 -0
- package/dist/custom/select/backspace/backspace.plugin.d.ts +50 -0
- package/dist/custom/select/backspace/backspace.plugin.js +125 -0
- package/dist/custom/select/backspace/index.d.ts +2 -0
- package/dist/custom/select/backspace/types.d.ts +2 -0
- package/dist/custom/select/editable/editable.plugin.d.ts +193 -0
- package/dist/custom/select/editable/editable.plugin.js +347 -0
- package/dist/custom/select/editable/index.d.ts +2 -0
- package/dist/custom/select/editable/types.d.ts +6 -0
- package/dist/custom/select/ids/ids.plugin.d.ts +22 -0
- package/dist/custom/select/ids/ids.plugin.js +31 -0
- package/dist/custom/select/ids/index.d.ts +1 -0
- package/dist/custom/select/index.d.ts +5 -0
- package/dist/custom/select/keyboard/index.d.ts +2 -0
- package/dist/custom/select/keyboard/keyboard.plugin.d.ts +125 -0
- package/dist/custom/select/keyboard/keyboard.plugin.js +205 -0
- package/dist/custom/select/keyboard/strategies/base.strategy.d.ts +37 -0
- package/dist/custom/select/keyboard/strategies/base.strategy.js +81 -0
- package/dist/custom/select/keyboard/strategies/editable.strategy.d.ts +16 -0
- package/dist/custom/select/keyboard/strategies/editable.strategy.js +20 -0
- package/dist/custom/select/keyboard/strategies/index.d.ts +4 -0
- package/dist/custom/select/keyboard/strategies/select-only.strategy.d.ts +13 -0
- package/dist/custom/select/keyboard/strategies/select-only.strategy.js +59 -0
- package/dist/custom/select/keyboard/strategies/types.d.ts +29 -0
- package/dist/custom/select/keyboard/types.d.ts +18 -0
- package/dist/custom/select/pointer/index.d.ts +2 -0
- package/dist/custom/select/pointer/pointer.plugin.d.ts +59 -0
- package/dist/custom/select/pointer/pointer.plugin.js +104 -0
- package/dist/custom/select/pointer/types.d.ts +2 -0
- package/dist/custom/skeleton/index.d.ts +2 -0
- package/dist/custom/skeleton/layout.plugin.d.ts +18 -0
- package/dist/custom/skeleton/layout.plugin.js +47 -0
- package/dist/custom/skeleton/types.d.ts +5 -0
- package/dist/custom/slide/direction.d.ts +30 -0
- package/dist/custom/slide/direction.js +75 -0
- package/dist/custom/slide/index.d.ts +4 -0
- package/dist/custom/slide/keyboard/index.d.ts +2 -0
- package/dist/custom/slide/keyboard/keyboard.plugin.d.ts +46 -0
- package/dist/custom/slide/keyboard/keyboard.plugin.js +106 -0
- package/dist/custom/slide/keyboard/types.d.ts +6 -0
- package/dist/custom/slide/parts.d.ts +7 -0
- package/dist/custom/slide/parts.js +26 -0
- package/dist/custom/slide/pointer/index.d.ts +2 -0
- package/dist/custom/slide/pointer/pointer.plugin.d.ts +100 -0
- package/dist/custom/slide/pointer/pointer.plugin.js +268 -0
- package/dist/custom/slide/pointer/strategies/base.strategy.d.ts +16 -0
- package/dist/custom/slide/pointer/strategies/base.strategy.js +23 -0
- package/dist/custom/slide/pointer/strategies/hold.strategy.d.ts +28 -0
- package/dist/custom/slide/pointer/strategies/hold.strategy.js +48 -0
- package/dist/custom/slide/pointer/strategies/index.d.ts +7 -0
- package/dist/custom/slide/pointer/strategies/magnet.strategy.d.ts +11 -0
- package/dist/custom/slide/pointer/strategies/magnet.strategy.js +17 -0
- package/dist/custom/slide/pointer/strategies/none.strategy.d.ts +7 -0
- package/dist/custom/slide/pointer/strategies/none.strategy.js +9 -0
- package/dist/custom/slide/pointer/strategies/plateau.strategy.d.ts +24 -0
- package/dist/custom/slide/pointer/strategies/plateau.strategy.js +81 -0
- package/dist/custom/slide/pointer/strategies/points.d.ts +16 -0
- package/dist/custom/slide/pointer/strategies/points.js +32 -0
- package/dist/custom/slide/pointer/strategies/settle.strategy.d.ts +11 -0
- package/dist/custom/slide/pointer/strategies/settle.strategy.js +17 -0
- package/dist/custom/slide/pointer/strategies/types.d.ts +57 -0
- package/dist/custom/slide/pointer/types.d.ts +46 -0
- package/dist/custom/slide/types.d.ts +14 -0
- package/dist/custom/table/column-ids/column-ids.plugin.d.ts +26 -0
- package/dist/custom/table/column-ids/column-ids.plugin.js +36 -0
- package/dist/custom/table/column-ids/index.d.ts +1 -0
- package/dist/custom/table/column-names/column-names.plugin.d.ts +18 -0
- package/dist/custom/table/column-names/column-names.plugin.js +24 -0
- package/dist/custom/table/column-names/index.d.ts +1 -0
- package/dist/custom/table/column-reorder/column-reorder.plugin.d.ts +169 -0
- package/dist/custom/table/column-reorder/column-reorder.plugin.js +465 -0
- package/dist/custom/table/column-reorder/index.d.ts +2 -0
- package/dist/custom/table/column-reorder/types.d.ts +81 -0
- package/dist/custom/table/column-resize/column-resize.plugin.d.ts +96 -0
- package/dist/custom/table/column-resize/column-resize.plugin.js +271 -0
- package/dist/custom/table/column-resize/index.d.ts +2 -0
- package/dist/custom/table/column-resize/types.d.ts +38 -0
- package/dist/custom/table/grid/grid.plugin.d.ts +119 -0
- package/dist/custom/table/grid/grid.plugin.js +356 -0
- package/dist/custom/table/grid/index.d.ts +2 -0
- package/dist/custom/table/grid/types.d.ts +22 -0
- package/dist/custom/table/index.d.ts +8 -0
- package/dist/custom/table/layout/index.d.ts +2 -0
- package/dist/custom/table/layout/layout.plugin.d.ts +52 -0
- package/dist/custom/table/layout/layout.plugin.js +122 -0
- package/dist/custom/table/layout/types.d.ts +7 -0
- package/dist/custom/table/names/index.d.ts +2 -0
- package/dist/custom/table/names/names.plugin.d.ts +18 -0
- package/dist/custom/table/names/names.plugin.js +31 -0
- package/dist/custom/table/names/types.d.ts +6 -0
- package/dist/custom/table/row-ids/index.d.ts +1 -0
- package/dist/custom/table/row-ids/row-ids.plugin.d.ts +21 -0
- package/dist/custom/table/row-ids/row-ids.plugin.js +28 -0
- package/dist/custom/tabs/active-tab/active-tab.plugin.d.ts +42 -0
- package/dist/custom/tabs/active-tab/active-tab.plugin.js +103 -0
- package/dist/custom/tabs/active-tab/index.d.ts +2 -0
- package/dist/custom/tabs/active-tab/types.d.ts +17 -0
- package/dist/custom/tabs/content-warn/content-warn.plugin.d.ts +21 -0
- package/dist/custom/tabs/content-warn/content-warn.plugin.js +41 -0
- package/dist/custom/tabs/content-warn/index.d.ts +1 -0
- package/dist/custom/tabs/index.d.ts +7 -0
- package/dist/custom/tabs/item-ids/index.d.ts +1 -0
- package/dist/custom/tabs/item-ids/item-ids.plugin.d.ts +60 -0
- package/dist/custom/tabs/item-ids/item-ids.plugin.js +94 -0
- package/dist/custom/tabs/item-names/index.d.ts +1 -0
- package/dist/custom/tabs/item-names/item-names.plugin.d.ts +17 -0
- package/dist/custom/tabs/item-names/item-names.plugin.js +23 -0
- package/dist/custom/tabs/keyboard/index.d.ts +2 -0
- package/dist/custom/tabs/keyboard/keyboard.plugin.d.ts +105 -0
- package/dist/custom/tabs/keyboard/keyboard.plugin.js +206 -0
- package/dist/custom/tabs/keyboard/types.d.ts +6 -0
- package/dist/custom/tabs/layout/index.d.ts +2 -0
- package/dist/custom/tabs/layout/layout.plugin.d.ts +37 -0
- package/dist/custom/tabs/layout/layout.plugin.js +81 -0
- package/dist/custom/tabs/layout/types.d.ts +4 -0
- package/dist/custom/tabs/parts.d.ts +15 -0
- package/dist/custom/tabs/parts.js +21 -0
- package/dist/custom/tabs/tab.d.ts +29 -0
- package/dist/custom/tabs/tab.js +44 -0
- package/dist/custom/tags/index.d.ts +4 -0
- package/dist/custom/tags/item-names/index.d.ts +1 -0
- package/dist/custom/tags/item-names/item-names.plugin.d.ts +12 -0
- package/dist/custom/tags/item-names/item-names.plugin.js +18 -0
- package/dist/custom/tags/keyboard/index.d.ts +2 -0
- package/dist/custom/tags/keyboard/keyboard.plugin.d.ts +133 -0
- package/dist/custom/tags/keyboard/keyboard.plugin.js +253 -0
- package/dist/custom/tags/keyboard/types.d.ts +6 -0
- package/dist/custom/tags/scroll/index.d.ts +2 -0
- package/dist/custom/tags/scroll/scroll.plugin.d.ts +68 -0
- package/dist/custom/tags/scroll/scroll.plugin.js +120 -0
- package/dist/custom/tags/scroll/types.d.ts +6 -0
- package/dist/custom/tags/tag.d.ts +41 -0
- package/dist/custom/tags/tag.js +66 -0
- package/dist/custom/textarea/autoresize/autoresize.plugin.d.ts +70 -0
- package/dist/custom/textarea/autoresize/autoresize.plugin.js +176 -0
- package/dist/custom/textarea/autoresize/index.d.ts +2 -0
- package/dist/custom/textarea/autoresize/types.d.ts +6 -0
- package/dist/custom/textarea/ids/ids.plugin.d.ts +26 -0
- package/dist/custom/textarea/ids/ids.plugin.js +44 -0
- package/dist/custom/textarea/ids/index.d.ts +1 -0
- package/dist/custom/textarea/index.d.ts +3 -0
- package/dist/custom/textarea/names/index.d.ts +2 -0
- package/dist/custom/textarea/names/names.plugin.d.ts +33 -0
- package/dist/custom/textarea/names/names.plugin.js +65 -0
- package/dist/custom/textarea/names/types.d.ts +8 -0
- package/dist/custom/toasts/cascade/cascade.plugin.d.ts +81 -0
- package/dist/custom/toasts/cascade/cascade.plugin.js +214 -0
- package/dist/custom/toasts/cascade/index.d.ts +2 -0
- package/dist/custom/toasts/cascade/types.d.ts +15 -0
- package/dist/custom/toasts/index.d.ts +7 -0
- package/dist/custom/toasts/item-names/index.d.ts +1 -0
- package/dist/custom/toasts/item-names/item-names.plugin.d.ts +12 -0
- package/dist/custom/toasts/item-names/item-names.plugin.js +18 -0
- package/dist/custom/toasts/keyboard/index.d.ts +2 -0
- package/dist/custom/toasts/keyboard/keyboard.plugin.d.ts +57 -0
- package/dist/custom/toasts/keyboard/keyboard.plugin.js +136 -0
- package/dist/custom/toasts/keyboard/types.d.ts +6 -0
- package/dist/custom/toasts/layout/index.d.ts +2 -0
- package/dist/custom/toasts/layout/layout.plugin.d.ts +23 -0
- package/dist/custom/toasts/layout/layout.plugin.js +39 -0
- package/dist/custom/toasts/layout/types.d.ts +5 -0
- package/dist/custom/toasts/names/index.d.ts +1 -0
- package/dist/custom/toasts/names/names.plugin.d.ts +10 -0
- package/dist/custom/toasts/names/names.plugin.js +13 -0
- package/dist/custom/toasts/removal/index.d.ts +2 -0
- package/dist/custom/toasts/removal/removal.plugin.d.ts +35 -0
- package/dist/custom/toasts/removal/removal.plugin.js +69 -0
- package/dist/custom/toasts/removal/types.d.ts +6 -0
- package/dist/custom/toasts/timer/index.d.ts +2 -0
- package/dist/custom/toasts/timer/timer.plugin.d.ts +71 -0
- package/dist/custom/toasts/timer/timer.plugin.js +213 -0
- package/dist/custom/toasts/timer/types.d.ts +15 -0
- package/dist/custom/tooltip/ids/ids.plugin.d.ts +22 -0
- package/dist/custom/tooltip/ids/ids.plugin.js +42 -0
- package/dist/custom/tooltip/ids/index.d.ts +1 -0
- package/dist/custom/tooltip/index.d.ts +2 -0
- package/dist/custom/tooltip/trigger/document-state.d.ts +42 -0
- package/dist/custom/tooltip/trigger/document-state.js +50 -0
- package/dist/custom/tooltip/trigger/index.d.ts +2 -0
- package/dist/custom/tooltip/trigger/trigger.plugin.d.ts +133 -0
- package/dist/custom/tooltip/trigger/trigger.plugin.js +271 -0
- package/dist/custom/tooltip/trigger/types.d.ts +20 -0
- package/dist/custom/virtual/index.d.ts +2 -0
- package/dist/custom/virtual/types.d.ts +6 -0
- package/dist/custom/virtual/virtual.plugin.d.ts +126 -0
- package/dist/custom/virtual/virtual.plugin.js +311 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +149 -0
- package/dist/locale/index.d.ts +6 -0
- package/dist/locale/locale.d.ts +38 -0
- package/dist/locale/locale.js +93 -0
- package/dist/locale/locale.plugin.d.ts +26 -0
- package/dist/locale/locale.plugin.js +35 -0
- package/dist/locale/locales/ar.d.ts +5 -0
- package/dist/locale/locales/ar.js +59 -0
- package/dist/locale/locales/en.d.ts +7 -0
- package/dist/locale/locales/en.js +61 -0
- package/dist/locale/locales/es.d.ts +2 -0
- package/dist/locale/locales/es.js +56 -0
- package/dist/locale/locales/fr.d.ts +2 -0
- package/dist/locale/locales/fr.js +56 -0
- package/dist/locale/locales/index.d.ts +6 -0
- package/dist/locale/locales/ru.d.ts +2 -0
- package/dist/locale/locales/ru.js +56 -0
- package/dist/locale/locales/zh.d.ts +2 -0
- package/dist/locale/locales/zh.js +56 -0
- package/dist/locale/names.plugin.d.ts +32 -0
- package/dist/locale/names.plugin.js +39 -0
- package/dist/locale/source.class.d.ts +22 -0
- package/dist/locale/source.class.js +32 -0
- package/dist/locale/types.d.ts +197 -0
- package/dist/motion/index.d.ts +2 -0
- package/dist/motion/motion.d.ts +28 -0
- package/dist/motion/motion.js +67 -0
- package/dist/motion/types.d.ts +14 -0
- package/dist/utils/afterTransitions.d.ts +49 -0
- package/dist/utils/afterTransitions.js +79 -0
- package/dist/utils/focusFirst.d.ts +13 -0
- package/dist/utils/focusFirst.js +24 -0
- package/dist/utils/graceArea.d.ts +21 -0
- package/dist/utils/graceArea.js +66 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/isAboveLayer.d.ts +14 -0
- package/dist/utils/isAboveLayer.js +24 -0
- package/dist/utils/isAppleTouch.d.ts +10 -0
- package/dist/utils/isAppleTouch.js +17 -0
- package/dist/utils/isFocusableElement.d.ts +8 -0
- package/dist/utils/isFocusableElement.js +13 -0
- package/dist/utils/isMeasurableElement.d.ts +11 -0
- package/dist/utils/isMeasurableElement.js +16 -0
- package/dist/utils/isPrintableKey.d.ts +7 -0
- package/dist/utils/isPrintableKey.js +12 -0
- package/dist/utils/layerOf.d.ts +12 -0
- package/dist/utils/layerOf.js +21 -0
- package/dist/utils/nearestShift.d.ts +19 -0
- package/dist/utils/nearestShift.js +58 -0
- package/dist/utils/positionOrigin.d.ts +34 -0
- package/dist/utils/positionOrigin.js +71 -0
- package/dist/utils/scrollParent.d.ts +12 -0
- package/dist/utils/scrollParent.js +23 -0
- package/dist/utils/scrollWindow.d.ts +27 -0
- package/dist/utils/scrollWindow.js +50 -0
- package/dist/utils/tabStops.d.ts +44 -0
- package/dist/utils/tabStops.js +102 -0
- package/dist/utils/tabStopsAfter.d.ts +10 -0
- package/dist/utils/tabStopsAfter.js +16 -0
- package/dist/utils/tabStopsBefore.d.ts +11 -0
- package/dist/utils/tabStopsBefore.js +17 -0
- package/dist/utils/toCssValue.d.ts +8 -0
- package/dist/utils/toCssValue.js +17 -0
- package/dist/utils/trapTab.d.ts +16 -0
- package/dist/utils/trapTab.js +36 -0
- package/dist/utils/types.d.ts +64 -0
- package/package.json +43 -4
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TCollectionBundlesPlugin } from "../../collection/bundles.plugin.js";
|
|
3
|
+
import { TElementPlugin } from "../../element/element.plugin.js";
|
|
4
|
+
import { TListItemPlugin } from "../item/item.plugin.js";
|
|
5
|
+
import { batchOf, drawOf } from "@soxa-ui/core";
|
|
6
|
+
//#region src/custom/list/navigation/navigation.plugin.ts
|
|
7
|
+
/**
|
|
8
|
+
* Можно ли подсветить элемент: он доступен и виден. Подсветить то, что нельзя
|
|
9
|
+
* выбрать, значит завести пользователя в тупик. `disabled` — итог, в нём учтён
|
|
10
|
+
* и выключенный владелец.
|
|
11
|
+
*/
|
|
12
|
+
var isNavigable = (item) => !item.disabled && item.rendered && item.visible;
|
|
13
|
+
/** Причина закрепления элемента в окне коллекции — на нём подсветка. */
|
|
14
|
+
var HIGHLIGHT = "highlight";
|
|
15
|
+
/**
|
|
16
|
+
* TListNavigationPlugin — общая механика навигации по коллекции с клавиатуры.
|
|
17
|
+
*
|
|
18
|
+
* Здесь всё, что не зависит от роли элемента и модели фокуса: подписка на
|
|
19
|
+
* `keydown`, привязка к движку коллекции, учёт подсвеченного элемента,
|
|
20
|
+
* циклический сдвиг и пропуск недоступных элементов. Что делают конкретные
|
|
21
|
+
* клавиши и что означает активация — дело наследника.
|
|
22
|
+
*
|
|
23
|
+
* Граница проведена именно так не из аккуратности. `ListBox` — самостоятельный
|
|
24
|
+
* фокусируемый виджет: фокус держит узел списка. `Select` — combobox, у
|
|
25
|
+
* которого фокус не уходит с поля. Элемент под стрелками оба объявляют через
|
|
26
|
+
* `aria-activedescendant` узла с фокусом, но узел, роли (`option` против
|
|
27
|
+
* `option` в другом контейнере), набор клавиш и смысл активации у них разные,
|
|
28
|
+
* и попытка выразить это режимами одного плагина заставила бы его тесты
|
|
29
|
+
* охранять два поведения сразу.
|
|
30
|
+
*
|
|
31
|
+
* Подсветка — не выбор. Она визуальна, живёт только во время навигации и в
|
|
32
|
+
* значение не попадает; хранится в `TListItemPlugin` каждого элемента.
|
|
33
|
+
*
|
|
34
|
+
* **Позиция и видимая подсветка — разные вещи.** Позиция встаёт на элемент и
|
|
35
|
+
* без отметки: за выбором и на строку, с которой пришла клавиша
|
|
36
|
+
* (`trackHighlight`). О том, что видно на экране, навигация сообщает одним
|
|
37
|
+
* приватным методом сразу двоим: событием `change:highlight` — тем, кто
|
|
38
|
+
* слушает снаружи (прокрутка списка `TListScrollPlugin`, разметка Select), —
|
|
39
|
+
* и хуком `onHighlightChanged` — наследнику. Элемент — когда отметка встала,
|
|
40
|
+
* в том числе на месте, где позиция уже стояла без неё; `null` — когда
|
|
41
|
+
* видимая отметка ушла: подсветку сняли или позиция ушла без отметки. Позиция
|
|
42
|
+
* без отметки переезжает молча: экран не меняется, и прокручивать к ней
|
|
43
|
+
* нечего. У Select и меню позиция всегда с отметкой — для них событие одно с
|
|
44
|
+
* переездом позиции.
|
|
45
|
+
*
|
|
46
|
+
* **Ссылка на подсвеченный элемент** (`aria-activedescendant`) повторяет
|
|
47
|
+
* экран: она есть, пока у элемента видна отметка и он в документе. `id` для
|
|
48
|
+
* ссылки отдаёт `highlightedId()`, а куда её писать, решает наследник по хуку:
|
|
49
|
+
* туда, где фокус. `id` подсвеченного бывает и новым при той же подсветке —
|
|
50
|
+
* `id` элемента от приложения (`TIdPlugin`) задали, сменили или сняли, — и об
|
|
51
|
+
* этом наследник узнаёт своим хуком (`onHighlightedAriaChanged`): база следит
|
|
52
|
+
* за набором `aria` элемента на позиции, пока она на нём.
|
|
53
|
+
*
|
|
54
|
+
* **В окне** (обёртка `Virtual`) в документе только видимые элементы, и у
|
|
55
|
+
* ненарисованного нет ни узла, ни `TListItemPlugin`. Поэтому элемент позиции
|
|
56
|
+
* навигация закрепляет в рисовании коллекции (`draw.pin`): окно рисует его на
|
|
57
|
+
* месте, даже когда стрелка увела подсветку за видимую полосу, и до кадра, в
|
|
58
|
+
* котором его прокручивают к глазу. Отметку заново
|
|
59
|
+
* смонтированному элементу навигация возвращает при регистрации его набора:
|
|
60
|
+
* прежний набор ушёл вместе с узлом. Тогда же наследник узнаёт, что
|
|
61
|
+
* подсвеченный элемент вошёл в документ (`onHighlightedMounted`): то, что есть
|
|
62
|
+
* только у смонтированного элемента, — `id` и узел — появилось у него только
|
|
63
|
+
* сейчас.
|
|
64
|
+
*
|
|
65
|
+
* Элемент списка — `TItem`. Навигации хватает `IControl`, а наследник
|
|
66
|
+
* называет элемент своего списка: этим типом подсвеченный ждёт расширение,
|
|
67
|
+
* через которое идёт выбор (`list.chooseItem` у ListBox, `select.chooseItem`
|
|
68
|
+
* у Select). `any` в констрейнте — карта событий элемента инвариантна, и
|
|
69
|
+
* точный `IControl` не принял бы элемент со своими событиями.
|
|
70
|
+
*/
|
|
71
|
+
var TListNavigationPlugin = class extends TBasePlugin {
|
|
72
|
+
/** Узел нужен только под слушатель клавиш — отсюда и тип. */
|
|
73
|
+
_element = null;
|
|
74
|
+
_bundles = null;
|
|
75
|
+
_engine = null;
|
|
76
|
+
_highlightedUid = null;
|
|
77
|
+
/** Подсветка видна: у подсвеченного элемента стоит отметка, а не одна позиция. */
|
|
78
|
+
_marked = false;
|
|
79
|
+
/**
|
|
80
|
+
* Шина элемента на позиции — за его набором `aria` база следит, пока
|
|
81
|
+
* позиция на нём: в наборе `id`, на который ведёт ссылка наследника.
|
|
82
|
+
* Подписка своя, а не `_listenTo`: элемент сменяется с позицией, и прежнего
|
|
83
|
+
* база отпускает сразу, а не при уничтожении.
|
|
84
|
+
*/
|
|
85
|
+
_watched = null;
|
|
86
|
+
install(ctx, options) {
|
|
87
|
+
super.install(ctx, options);
|
|
88
|
+
this._bundles = ctx.get(TCollectionBundlesPlugin) ?? null;
|
|
89
|
+
this._bundles?.events.on("bundle:registered", ({ uid, bundle }) => {
|
|
90
|
+
if (!this._marked || uid !== this._highlightedUid) return;
|
|
91
|
+
const plugin = bundle.get(TListItemPlugin);
|
|
92
|
+
if (plugin) plugin.highlighted = true;
|
|
93
|
+
this.onHighlightedMounted(uid);
|
|
94
|
+
});
|
|
95
|
+
ctx.get(TElementPlugin)?.events.on("ready", (element) => {
|
|
96
|
+
this._element = element;
|
|
97
|
+
element.addEventListener("keydown", this._onKeyDown);
|
|
98
|
+
});
|
|
99
|
+
ctx.get(TElementPlugin)?.events.on("removed", () => {
|
|
100
|
+
this._element?.removeEventListener("keydown", this._onKeyDown);
|
|
101
|
+
this._element = null;
|
|
102
|
+
});
|
|
103
|
+
this._bundles?.events.on("engine:bound", (engine) => {
|
|
104
|
+
this._engine = engine;
|
|
105
|
+
this.onEngineBound(engine);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Эмит собственных событий навигации — без приведения `this.events` к
|
|
110
|
+
* конкретной карте (см. `TEventSink` в `@soxa-ui/core`).
|
|
111
|
+
*
|
|
112
|
+
* Перекрывает сток базы, потому что у `TBasePlugin._sink` карта
|
|
113
|
+
* `TPluginEvents`, а `change:highlight` объявлен здесь: через базовый сток
|
|
114
|
+
* это имя не пройдёт. Свой сток заводит каждый уровень иерархии, который
|
|
115
|
+
* добавил событие; `TListKeyboardPlugin` и `TSelectKeyboardPlugin` к механике
|
|
116
|
+
* навигации ничего не добавляют и пользуются этим.
|
|
117
|
+
*
|
|
118
|
+
* Дженерик карту не заменяет. На `TEventSink<TEvents>` эмит упирается в
|
|
119
|
+
* `Parameters<TEvents['change:highlight']>` — тип, который на
|
|
120
|
+
* непроинстанцированном дженерике не разрешается. Вынести карту отдельным
|
|
121
|
+
* параметром базы тоже не выход: ошибка переезжает в базу, где этот параметр
|
|
122
|
+
* снова дженерик. Сток обязан назвать карту точно — тем он и отличается от
|
|
123
|
+
* `this.events`.
|
|
124
|
+
*
|
|
125
|
+
* Расширять карту базы безопасно: наследник не может сузить обработчик
|
|
126
|
+
* (`TEvents extends TListNavigationPluginEvents` сверяется контравариантно по
|
|
127
|
+
* аргументам), поэтому эмит базы через расширенный сток звучит.
|
|
128
|
+
*/
|
|
129
|
+
get _sink() {
|
|
130
|
+
return this.events;
|
|
131
|
+
}
|
|
132
|
+
destroy() {
|
|
133
|
+
this._element?.removeEventListener("keydown", this._onKeyDown);
|
|
134
|
+
this.clearHighlight();
|
|
135
|
+
this._watch(void 0);
|
|
136
|
+
this._element = null;
|
|
137
|
+
this._bundles = null;
|
|
138
|
+
this._engine = null;
|
|
139
|
+
super.destroy();
|
|
140
|
+
}
|
|
141
|
+
/** Элемент, на котором сейчас подсветка. */
|
|
142
|
+
get highlightedUid() {
|
|
143
|
+
return this._highlightedUid;
|
|
144
|
+
}
|
|
145
|
+
/** Коллекция появилась — можно синхронизировать начальное состояние. */
|
|
146
|
+
onEngineBound(_engine) {}
|
|
147
|
+
/**
|
|
148
|
+
* Видимая подсветка сменилась — тем же сообщением, что `change:highlight`.
|
|
149
|
+
* Здесь наследник ведёт ссылку `aria-activedescendant` или фокус; прокрутку
|
|
150
|
+
* к подсвеченному ведёт `TListScrollPlugin` по событию.
|
|
151
|
+
*
|
|
152
|
+
* `uid` — элемент, который получил отметку. Переход с элемента на элемент —
|
|
153
|
+
* один вызов, с новым: прежняя отметка снимается молча, а `null` между ними
|
|
154
|
+
* у меню увёл бы фокус на панель. `null` — отметки больше нет: подсветку
|
|
155
|
+
* сняли (`clearHighlight`) или позиция ушла без отметки (`trackHighlight`).
|
|
156
|
+
* Без отметки позиция переезжает молча: экран при этом не меняется.
|
|
157
|
+
*/
|
|
158
|
+
onHighlightChanged(_uid) {}
|
|
159
|
+
/**
|
|
160
|
+
* Подсвеченный элемент вошёл в документ — его набор зарегистрирован, а
|
|
161
|
+
* отметка ему возвращена. Так бывает в окне: подсветка ушла к элементу,
|
|
162
|
+
* которого окно не рисовало, и окно дорисовало его уже после
|
|
163
|
+
* `onHighlightChanged`. Здесь наследник берёт то, что есть только у
|
|
164
|
+
* смонтированного элемента: `id` для ссылки на него. Прокрутка к нему ждёт
|
|
165
|
+
* его набор сама (`TListScrollPlugin`).
|
|
166
|
+
*/
|
|
167
|
+
onHighlightedMounted(_uid) {}
|
|
168
|
+
/**
|
|
169
|
+
* Набор `aria` подсвеченного элемента сменился, пока отметка видна, — и
|
|
170
|
+
* вместе с ним мог смениться `id`, на который ведёт ссылка: `id` элемента в
|
|
171
|
+
* `TIdPlugin` задали, сменили или сняли. Здесь наследник, который ссылается
|
|
172
|
+
* на подсвеченный (`aria-activedescendant`), переписывает ссылку.
|
|
173
|
+
*
|
|
174
|
+
* Отдельный хук, а не повтор `onHighlightChanged`: подсветка не сменилась,
|
|
175
|
+
* и наследник не должен снова переносить фокус, а список — прокручивать к
|
|
176
|
+
* элементу. База следит за набором, а не за `change:id` `TIdPlugin`
|
|
177
|
+
* элемента: `id` в набор пишет плагин связок своим подписчиком того же
|
|
178
|
+
* события, и подписчик, пришедший раньше него, прочёл бы прежний.
|
|
179
|
+
*/
|
|
180
|
+
onHighlightedAriaChanged(_uid) {}
|
|
181
|
+
/**
|
|
182
|
+
* Показанные элементы — `batch.shown`, а не `batch.items`: ходить
|
|
183
|
+
* стрелками по тому, что отбор скрыл, нельзя. Среди них и недоступные: по
|
|
184
|
+
* ним наследник узнаёт, с чьей строки пришла клавиша, а `move` — откуда
|
|
185
|
+
* шагать.
|
|
186
|
+
*
|
|
187
|
+
* Тип — элемент списка наследника (`TItem`), а база опирается только на
|
|
188
|
+
* `IControl`: навигации нужны `uid`, `disabled`, `rendered` и `visible`.
|
|
189
|
+
* Элементы ListBox и опции Select общего предка ниже `IControl` не имеют, и
|
|
190
|
+
* раньше здесь стоял `IListItem` от несуществующего теперь компонента
|
|
191
|
+
* `TList`. Массив — только для чтения: это сама выборка коллекции, у
|
|
192
|
+
* коллекции с памятью выборки — запомненная.
|
|
193
|
+
*/
|
|
194
|
+
shown() {
|
|
195
|
+
return batchOf(this._engine)?.shown ?? [];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Элементы, по которым идёт навигация: показанные и доступные. Недоступные
|
|
199
|
+
* пропускаются у ListBox и у Select одинаково — правило не зависит ни от
|
|
200
|
+
* роли элемента, ни от модели фокуса.
|
|
201
|
+
*/
|
|
202
|
+
items() {
|
|
203
|
+
return this.shown().filter(isNavigable);
|
|
204
|
+
}
|
|
205
|
+
indexOf(uid) {
|
|
206
|
+
if (uid == null) return -1;
|
|
207
|
+
return this.items().findIndex((item) => item.uid === uid);
|
|
208
|
+
}
|
|
209
|
+
itemAt(index) {
|
|
210
|
+
return this.items()[index] ?? null;
|
|
211
|
+
}
|
|
212
|
+
itemByUid(uid) {
|
|
213
|
+
return this.items().find((item) => item.uid === uid) ?? null;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* `id` подсвеченного элемента для ссылки `aria-activedescendant`, пока она
|
|
217
|
+
* повторяет экран: у элемента видна отметка и он в документе — его набор
|
|
218
|
+
* зарегистрирован. Иначе — `null`: позиция без отметки ссылкой не
|
|
219
|
+
* становится, а у элемента вне окна (`Virtual`) своего `id` нет, и
|
|
220
|
+
* оставшийся от прошлого монтирования указывал бы в пустоту.
|
|
221
|
+
*
|
|
222
|
+
* `id` — из набора `aria` элемента, а не с DOM-узла: узел, который знает
|
|
223
|
+
* реестр, — корень элемента, а `id` вместе со всей ARIA стоит на его строке.
|
|
224
|
+
* В набор его пишет `TOptionIdsPlugin` элемента, и ссылка берёт ровно то,
|
|
225
|
+
* что окажется в разметке. Куда её писать, решает наследник — туда, где
|
|
226
|
+
* фокус.
|
|
227
|
+
*/
|
|
228
|
+
highlightedId() {
|
|
229
|
+
const uid = this._highlightedUid;
|
|
230
|
+
if (uid === null || !this._marked) return null;
|
|
231
|
+
if (this._bundles?.getByUid(uid) === void 0) return null;
|
|
232
|
+
return this.itemByUid(uid)?.aria.get("id") ?? null;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Сдвигает подсветку к ближайшему доступному элементу в направлении шага.
|
|
236
|
+
* Навигация зациклена: с последнего элемента `↓` уводит на первый — так
|
|
237
|
+
* принято в списках и так делают Ark и Radix.
|
|
238
|
+
*
|
|
239
|
+
* Шаг отсчитывается от места подсветки среди показанных, а не среди
|
|
240
|
+
* доступных: подсвеченный элемент могли выключить, а ListBox ставит позицию
|
|
241
|
+
* и на выбранный элемент, который бывает выключен. Среди доступных такого
|
|
242
|
+
* нет, и стрелка увела бы на край списка. Так же ищут соседа
|
|
243
|
+
* `TTabsKeyboardPlugin` и `TTagsKeyboardPlugin`. Подсветки нет или её
|
|
244
|
+
* элемент не показан — шаг начинается с края.
|
|
245
|
+
*/
|
|
246
|
+
move(step) {
|
|
247
|
+
const shown = this.shown();
|
|
248
|
+
const from = shown.findIndex((item) => item.uid === this._highlightedUid);
|
|
249
|
+
if (from === -1) {
|
|
250
|
+
this.highlightEdge(step > 0 ? "first" : "last");
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const count = shown.length;
|
|
254
|
+
for (let offset = 1; offset <= count; offset++) {
|
|
255
|
+
const candidate = shown[((from + step * offset) % count + count) % count];
|
|
256
|
+
if (isNavigable(candidate)) {
|
|
257
|
+
this.highlight(candidate.uid);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
highlightEdge(edge) {
|
|
263
|
+
const items = this.items();
|
|
264
|
+
if (items.length === 0) return;
|
|
265
|
+
this.highlight(items[edge === "first" ? 0 : items.length - 1].uid);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Подсветить элемент: позиция плюс визуальная отметка — и сообщение о
|
|
269
|
+
* ней: `change:highlight` с элементом и соседями и хук наследника
|
|
270
|
+
* (`_announce`).
|
|
271
|
+
*
|
|
272
|
+
* Позиция может уже стоять на элементе без отметки — её ставит
|
|
273
|
+
* `trackHighlight` за выбором и со строки, с которой пришла клавиша. Тогда
|
|
274
|
+
* отметка встаёт на месте, и сообщение уходит так же: на экране подсветка
|
|
275
|
+
* появилась, хоть позиция и не сменилась. Так стрелка отмечает
|
|
276
|
+
* единственный доступный элемент — шаг по кругу приводит к нему же, — и
|
|
277
|
+
* список докручивает к нему. Подсвечивать нечего, только когда у элемента
|
|
278
|
+
* и позиция, и отметка: повтор молчит.
|
|
279
|
+
*/
|
|
280
|
+
highlight(uid) {
|
|
281
|
+
if (this._highlightedUid === uid && this._marked) return;
|
|
282
|
+
const oldValue = this._highlightPayload(this._marked ? this._highlightedUid : null);
|
|
283
|
+
if (this._highlightedUid !== uid) this._moveTo(uid);
|
|
284
|
+
const plugin = this.itemPlugin(uid);
|
|
285
|
+
if (plugin) plugin.highlighted = true;
|
|
286
|
+
this._marked = true;
|
|
287
|
+
this._announce(uid, oldValue);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Запомнить позицию, не отмечая элемент визуально.
|
|
291
|
+
*
|
|
292
|
+
* Нужно при синхронизации с выбором: список открылся на выбранном
|
|
293
|
+
* элементе, но подсветка навигации ещё не должна быть видна. Отметка, которая
|
|
294
|
+
* была видна, снимается, и об этом уходит сообщение с `null`
|
|
295
|
+
* (`change:highlight` и `onHighlightChanged(null)`): позиция осталась, а
|
|
296
|
+
* подсветки на экране нет. Без отметки позиция переезжает молча — ни
|
|
297
|
+
* события, ни хука: на экране ничего не сменилось.
|
|
298
|
+
*/
|
|
299
|
+
trackHighlight(uid) {
|
|
300
|
+
if (this._highlightedUid === uid) return;
|
|
301
|
+
const oldValue = this._highlightPayload(this._marked ? this._highlightedUid : null);
|
|
302
|
+
const marked = this._marked;
|
|
303
|
+
this._moveTo(uid);
|
|
304
|
+
if (marked) this._announce(null, oldValue);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Снять подсветку: позиции больше нет. Сообщение с `null` — только если
|
|
308
|
+
* отметка была видна: позиция без отметки уходит молча, как и переезжает.
|
|
309
|
+
*/
|
|
310
|
+
clearHighlight() {
|
|
311
|
+
if (this._highlightedUid == null) return;
|
|
312
|
+
const oldValue = this._highlightPayload(this._marked ? this._highlightedUid : null);
|
|
313
|
+
const marked = this._marked;
|
|
314
|
+
this.unmarkCurrent();
|
|
315
|
+
this._highlightedUid = null;
|
|
316
|
+
this._followPosition();
|
|
317
|
+
if (marked) this._announce(null, oldValue);
|
|
318
|
+
}
|
|
319
|
+
itemPlugin(uid) {
|
|
320
|
+
return this._bundles?.getByUid(uid)?.get(TListItemPlugin);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Позиция — на элемент: прежняя отметка снята, элемент закреплён в окне, и
|
|
324
|
+
* база следит за его набором. Событий здесь нет: ставить ли отметку и
|
|
325
|
+
* сообщать ли о ней, решает тот, кто позицию перенёс, — `highlight` или
|
|
326
|
+
* `trackHighlight`.
|
|
327
|
+
*/
|
|
328
|
+
_moveTo(uid) {
|
|
329
|
+
this.unmarkCurrent();
|
|
330
|
+
this._highlightedUid = uid;
|
|
331
|
+
this._followPosition();
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* За позицией — её элемент среди показанных: он закреплён в окне, и база
|
|
335
|
+
* следит за его набором `aria`. Позиции нет — закрепление снято, следить
|
|
336
|
+
* не за чем.
|
|
337
|
+
*/
|
|
338
|
+
_followPosition() {
|
|
339
|
+
const uid = this._highlightedUid;
|
|
340
|
+
const item = uid === null ? void 0 : this.shown().find((candidate) => candidate.uid === uid);
|
|
341
|
+
this._pin(item);
|
|
342
|
+
this._watch(item);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Видимая подсветка сменилась — одним сообщением обоим слушателям:
|
|
346
|
+
* `change:highlight` тем, кто слушает снаружи, и `onHighlightChanged`
|
|
347
|
+
* наследнику. Элемент — с соседями среди доступных; `null` — отметки
|
|
348
|
+
* больше нет, и соседей тоже.
|
|
349
|
+
*/
|
|
350
|
+
_highlightPayload(uid) {
|
|
351
|
+
const items = this.items();
|
|
352
|
+
const index = uid === null ? -1 : items.findIndex((item) => item.uid === uid);
|
|
353
|
+
const item = items[index] ?? null;
|
|
354
|
+
return {
|
|
355
|
+
item,
|
|
356
|
+
prevItem: item && (items[index - 1] ?? null),
|
|
357
|
+
nextItem: item && (items[index + 1] ?? null)
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
_announce(uid, oldValue) {
|
|
361
|
+
this._sink.emit("change:highlight", {
|
|
362
|
+
newValue: this._highlightPayload(uid),
|
|
363
|
+
oldValue
|
|
364
|
+
});
|
|
365
|
+
this.onHighlightChanged(uid);
|
|
366
|
+
}
|
|
367
|
+
/** Снимает визуальную отметку с текущего элемента. */
|
|
368
|
+
unmarkCurrent() {
|
|
369
|
+
this._marked = false;
|
|
370
|
+
if (this._highlightedUid == null) return;
|
|
371
|
+
const plugin = this.itemPlugin(this._highlightedUid);
|
|
372
|
+
if (plugin) plugin.highlighted = false;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Закрепить элемент позиции в окне коллекции, если оно есть: окно рисует
|
|
376
|
+
* его на месте, и подсветка, уведённая стрелкой за видимую полосу, не
|
|
377
|
+
* теряет узел. Позиции нет — закрепление снять.
|
|
378
|
+
*/
|
|
379
|
+
_pin(item) {
|
|
380
|
+
drawOf(this._engine)?.pin(HIGHLIGHT, item);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Следить за набором `aria` элемента на позиции, а прежнего — отпустить.
|
|
384
|
+
* Элемента нет — не следить ни за чьим.
|
|
385
|
+
*/
|
|
386
|
+
_watch(item) {
|
|
387
|
+
const bus = item?.events ?? null;
|
|
388
|
+
if (bus === this._watched) return;
|
|
389
|
+
this._watched?.off("change:aria", this._onHighlightedAria);
|
|
390
|
+
this._watched = bus;
|
|
391
|
+
bus?.on("change:aria", this._onHighlightedAria);
|
|
392
|
+
}
|
|
393
|
+
/** Набор элемента на позиции сменился: ссылке он важен, только пока отметка видна. */
|
|
394
|
+
_onHighlightedAria = () => {
|
|
395
|
+
if (this._marked && this._highlightedUid !== null) this.onHighlightedAriaChanged(this._highlightedUid);
|
|
396
|
+
};
|
|
397
|
+
_onKeyDown = (event) => {
|
|
398
|
+
this.onKeyDown(event);
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
//#endregion
|
|
402
|
+
export { TListNavigationPlugin };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TValuePayload } from '@soxa-ui/core';
|
|
2
|
+
import type { IControl } from '@soxa-ui/core';
|
|
3
|
+
import type { TPluginEvents } from '../../../base';
|
|
4
|
+
/**
|
|
5
|
+
* Видимая подсветка списка — аргумент `change:highlight`.
|
|
6
|
+
*
|
|
7
|
+
* `item` — элемент, на котором встала отметка, в том числе на месте, где
|
|
8
|
+
* позиция уже стояла без неё; `null` — видимой отметки больше нет: подсветку
|
|
9
|
+
* сняли или позиция ушла без отметки. Позиция без отметки события не шлёт.
|
|
10
|
+
*
|
|
11
|
+
* Соседи — доступные элементы до и после подсвеченного, тем порядком, каким по
|
|
12
|
+
* ним ходят стрелки; у края и без подсветки — `null`. Навигации и прокрутке
|
|
13
|
+
* они не нужны: это данные подписчику снаружи, который знает о подсветке
|
|
14
|
+
* только из события (`keyboard:change:highlight` у Select).
|
|
15
|
+
*/
|
|
16
|
+
export type THighlightPayload = {
|
|
17
|
+
item: IControl | null;
|
|
18
|
+
prevItem: IControl | null;
|
|
19
|
+
nextItem: IControl | null;
|
|
20
|
+
};
|
|
21
|
+
export type TListNavigationPluginEvents = TPluginEvents & {
|
|
22
|
+
'change:highlight': (payload: TValuePayload<THighlightPayload>) => void;
|
|
23
|
+
};
|
|
24
|
+
/** Край списка для `highlightEdge`. */
|
|
25
|
+
export type TListEdge = 'first' | 'last';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Элемент, за которым список следует после смены выбора, — тот, что стал
|
|
3
|
+
* выбранным: первый из выбранных (`selected`, по порядку выбора), чья отметка
|
|
4
|
+
* сменилась (`changed` — второй аргумент `change:selection`). `undefined` —
|
|
5
|
+
* выбранным не стал никто: выбор сняли или только переставили, и следовать не
|
|
6
|
+
* за чем.
|
|
7
|
+
*
|
|
8
|
+
* Не первый выбранный: в `multiple` выбранных несколько, и выбор клавишей или
|
|
9
|
+
* кликом уводил бы подсветку и прокрутку к первому из них, а не к элементу,
|
|
10
|
+
* который выбрали сейчас. В `single` выбранный один — он и стал выбранным.
|
|
11
|
+
* Значение снаружи — по тому же правилу: список встаёт на новый выбранный.
|
|
12
|
+
*
|
|
13
|
+
* Одно на клавиатуру ListBox (`TListKeyboardPlugin`) и прокрутку списка
|
|
14
|
+
* (`TListScrollPlugin`): элемент оба ищут одним правилом, и подсветка не
|
|
15
|
+
* встанет на одном элементе, пока прокрутка уезжает к другому.
|
|
16
|
+
*/
|
|
17
|
+
export declare function newlySelected<TItem>(selected: readonly TItem[], changed: ReadonlySet<TItem>): TItem | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/custom/list/newly-selected.ts
|
|
2
|
+
/**
|
|
3
|
+
* Элемент, за которым список следует после смены выбора, — тот, что стал
|
|
4
|
+
* выбранным: первый из выбранных (`selected`, по порядку выбора), чья отметка
|
|
5
|
+
* сменилась (`changed` — второй аргумент `change:selection`). `undefined` —
|
|
6
|
+
* выбранным не стал никто: выбор сняли или только переставили, и следовать не
|
|
7
|
+
* за чем.
|
|
8
|
+
*
|
|
9
|
+
* Не первый выбранный: в `multiple` выбранных несколько, и выбор клавишей или
|
|
10
|
+
* кликом уводил бы подсветку и прокрутку к первому из них, а не к элементу,
|
|
11
|
+
* который выбрали сейчас. В `single` выбранный один — он и стал выбранным.
|
|
12
|
+
* Значение снаружи — по тому же правилу: список встаёт на новый выбранный.
|
|
13
|
+
*
|
|
14
|
+
* Одно на клавиатуру ListBox (`TListKeyboardPlugin`) и прокрутку списка
|
|
15
|
+
* (`TListScrollPlugin`): элемент оба ищут одним правилом, и подсветка не
|
|
16
|
+
* встанет на одном элементе, пока прокрутка уезжает к другому.
|
|
17
|
+
*/
|
|
18
|
+
function newlySelected(selected, changed) {
|
|
19
|
+
return selected.find((item) => changed.has(item));
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { newlySelected };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './option-ids.plugin';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TBasePlugin } from '../../../base';
|
|
2
|
+
import type { IPluginContext } from '../../../base';
|
|
3
|
+
/**
|
|
4
|
+
* TOptionIdsPlugin — `id` элемента списка в документе: опции Select и элемента
|
|
5
|
+
* ListBox. На него ссылается `aria-activedescendant` узла с фокусом, пока
|
|
6
|
+
* элемент подсвечен: у Select — поля комбобокса, у ListBox — узла списка.
|
|
7
|
+
*
|
|
8
|
+
* Плагин один на оба списка: `id` от роли элемента и модели фокуса не зависит,
|
|
9
|
+
* а копия под каждый компонент стала бы вторым путём к тому же знанию. Чей
|
|
10
|
+
* узел ссылается на элемент, решает клавиатура списка — наследник
|
|
11
|
+
* `TListNavigationPlugin`.
|
|
12
|
+
*
|
|
13
|
+
* Пишется в `aria` элемента — набор его строки, — и клавиатура списка берёт
|
|
14
|
+
* его оттуда же (`highlightedId` навигации): ссылка получает ровно то, что
|
|
15
|
+
* стоит в разметке.
|
|
16
|
+
*
|
|
17
|
+
* `id`, заданный приложением (`TIdPlugin` элемента), главнее: он и встаёт на
|
|
18
|
+
* строку, и на него ведёт ссылка. Сменили — плагин переписывает набор, и
|
|
19
|
+
* клавиатура списка ведёт ссылку за ним (она следит за набором подсвеченного
|
|
20
|
+
* элемента). Сняли — снова `id` от монтирования.
|
|
21
|
+
*
|
|
22
|
+
* Без него — `id` от монтирования элемента (`createId`), а не от экземпляра.
|
|
23
|
+
* Элемент из данных рисуется с готовым экземпляром (`ctrl`), и его конструктор
|
|
24
|
+
* адаптер не зовёт, а монтирование у него своё. Пишется при установке,
|
|
25
|
+
* синхронно, — `id` есть уже в первой (и серверной) отрисовке.
|
|
26
|
+
*/
|
|
27
|
+
export declare class TOptionIdsPlugin extends TBasePlugin {
|
|
28
|
+
install(ctx: IPluginContext): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TIdPlugin } from "../../id/id.plugin.js";
|
|
3
|
+
//#region src/custom/list/option-ids/option-ids.plugin.ts
|
|
4
|
+
/**
|
|
5
|
+
* TOptionIdsPlugin — `id` элемента списка в документе: опции Select и элемента
|
|
6
|
+
* ListBox. На него ссылается `aria-activedescendant` узла с фокусом, пока
|
|
7
|
+
* элемент подсвечен: у Select — поля комбобокса, у ListBox — узла списка.
|
|
8
|
+
*
|
|
9
|
+
* Плагин один на оба списка: `id` от роли элемента и модели фокуса не зависит,
|
|
10
|
+
* а копия под каждый компонент стала бы вторым путём к тому же знанию. Чей
|
|
11
|
+
* узел ссылается на элемент, решает клавиатура списка — наследник
|
|
12
|
+
* `TListNavigationPlugin`.
|
|
13
|
+
*
|
|
14
|
+
* Пишется в `aria` элемента — набор его строки, — и клавиатура списка берёт
|
|
15
|
+
* его оттуда же (`highlightedId` навигации): ссылка получает ровно то, что
|
|
16
|
+
* стоит в разметке.
|
|
17
|
+
*
|
|
18
|
+
* `id`, заданный приложением (`TIdPlugin` элемента), главнее: он и встаёт на
|
|
19
|
+
* строку, и на него ведёт ссылка. Сменили — плагин переписывает набор, и
|
|
20
|
+
* клавиатура списка ведёт ссылку за ним (она следит за набором подсвеченного
|
|
21
|
+
* элемента). Сняли — снова `id` от монтирования.
|
|
22
|
+
*
|
|
23
|
+
* Без него — `id` от монтирования элемента (`createId`), а не от экземпляра.
|
|
24
|
+
* Элемент из данных рисуется с готовым экземпляром (`ctrl`), и его конструктор
|
|
25
|
+
* адаптер не зовёт, а монтирование у него своё. Пишется при установке,
|
|
26
|
+
* синхронно, — `id` есть уже в первой (и серверной) отрисовке.
|
|
27
|
+
*/
|
|
28
|
+
var TOptionIdsPlugin = class extends TBasePlugin {
|
|
29
|
+
install(ctx) {
|
|
30
|
+
super.install(ctx);
|
|
31
|
+
const item = ctx.getInstance();
|
|
32
|
+
if (!item) return;
|
|
33
|
+
const idPlugin = ctx.get(TIdPlugin);
|
|
34
|
+
const mountId = ctx.createId("option");
|
|
35
|
+
const write = () => {
|
|
36
|
+
item.aria.add("id", idPlugin?.id ?? mountId);
|
|
37
|
+
};
|
|
38
|
+
write();
|
|
39
|
+
idPlugin?.events.on("change:id", write);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { TOptionIdsPlugin };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TCollectionElements } from '../collection';
|
|
2
|
+
/**
|
|
3
|
+
* Строка элемента коллекции — узел, который держит фокус внутри узла
|
|
4
|
+
* элемента. `null` — элемента нет в документе.
|
|
5
|
+
*
|
|
6
|
+
* Одна на клавиатуру ListBox (с чьей строки пришла клавиша) и меню (куда
|
|
7
|
+
* ставить фокус подсвеченному пункту): строку оба ищут одним правилом.
|
|
8
|
+
*/
|
|
9
|
+
export declare function rowOf(elements: TCollectionElements | null, uid: string | number): Element | null;
|
|
10
|
+
/**
|
|
11
|
+
* Строка внутри узла элемента — тем же правилом, что `rowOf`, когда узел уже
|
|
12
|
+
* на руках: свой корень у пункта с подменю — узел пункта в меню над ним.
|
|
13
|
+
*
|
|
14
|
+
* Она же узел фокуса элемента — ListBox.Item и пунктов меню (`focusTarget`
|
|
15
|
+
* плагина действия в дескрипторе): запись `focused = true` ставит фокус на
|
|
16
|
+
* строку, а не на обёртку элемента. Опции Select её не дают: у комбобокса
|
|
17
|
+
* фокус остаётся на поле. Tags.Item — тоже: у строки тега без выбора
|
|
18
|
+
* `tabindex` нет, и узел фокуса тега — его остановка (`tagStopIn`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function rowIn(node: Element | null): Element | null;
|
|
21
|
+
/**
|
|
22
|
+
* Узел списка ListBox — ребёнок его корня с ролью `listbox`. `null` — корня
|
|
23
|
+
* нет или узла списка в нём нет.
|
|
24
|
+
*
|
|
25
|
+
* Он же узел фокуса ListBox: запись `focused = true` ставит фокус на него, а
|
|
26
|
+
* не на поле или кнопку шапки (`focusTarget` плагина действия в дескрипторе).
|
|
27
|
+
*/
|
|
28
|
+
export declare function listOf(root: Element | null): Element | null;
|
|
29
|
+
/**
|
|
30
|
+
* Узел списка, в котором стоит элемент, — ближайший предок с ролью
|
|
31
|
+
* `listbox`: узел списка ListBox и список панели Select. `null` — элемент не в
|
|
32
|
+
* списке.
|
|
33
|
+
*
|
|
34
|
+
* Не родитель элемента: у элемента группы (`ListBox.Group`, `Select.Group`)
|
|
35
|
+
* родитель — группа, а предел строк держит список вокруг групп.
|
|
36
|
+
*/
|
|
37
|
+
export declare function closestList(element: Element): Element | null;
|
|
38
|
+
/**
|
|
39
|
+
* Прокрутка списка, в котором стоит элемент, — ближайший предок его узла,
|
|
40
|
+
* который прокручивается по вертикали, не выше узла с ролью списка (`listbox`,
|
|
41
|
+
* `menu`). `null` — своей прокрутки у списка нет: элементы помещаются, список
|
|
42
|
+
* скрыт или прокручивает его только страница.
|
|
43
|
+
*
|
|
44
|
+
* У ListBox и Select это сам узел с ролью `listbox` — ему предел строк ставит
|
|
45
|
+
* `TListHeightPlugin`. У меню прокручивается список пунктов внутри панели с
|
|
46
|
+
* ролью `menu` (`.so-menu__list`), и `closestList` его не находит. Не
|
|
47
|
+
* родитель элемента: у элемента группы родитель — группа, а прокручивается
|
|
48
|
+
* список вокруг групп.
|
|
49
|
+
*/
|
|
50
|
+
export declare function scrollContainerOf(element: Element): HTMLElement | null;
|