@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,352 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TElementPlugin } from "../../element/element.plugin.js";
|
|
3
|
+
import { isFocusableElement } from "../../../utils/isFocusableElement.js";
|
|
4
|
+
import { tabStops } from "../../../utils/tabStops.js";
|
|
5
|
+
import { itemOf, scrollWindowOf } from "../../../utils/scrollWindow.js";
|
|
6
|
+
import { smoothScrollBehavior } from "../../../motion/motion.js";
|
|
7
|
+
import { resolveEdges } from "./edges.js";
|
|
8
|
+
import { resolveFocusShift } from "./focus.js";
|
|
9
|
+
import { viewportOf } from "./stop.js";
|
|
10
|
+
//#region src/custom/scroller/viewport/viewport.plugin.ts
|
|
11
|
+
/** Часть разметки — кнопка, которая листает в эту сторону. */
|
|
12
|
+
var BUTTON_PART = {
|
|
13
|
+
prev: "__prev",
|
|
14
|
+
next: "__next"
|
|
15
|
+
};
|
|
16
|
+
/** Сторона напротив. */
|
|
17
|
+
var OPPOSITE = {
|
|
18
|
+
prev: "next",
|
|
19
|
+
next: "prev"
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* TScrollerViewportPlugin — вьюпорт ленты: замер краёв, само листание,
|
|
23
|
+
* доводка элемента под фокусом в окно снапа и фокус кнопки, выключенной у
|
|
24
|
+
* края.
|
|
25
|
+
*
|
|
26
|
+
* Плагин, а не расширение или разметка: и то, и другое здесь — операции над
|
|
27
|
+
* DOM. Где сейчас лента, сколько у неё содержимого и есть ли внутри свои
|
|
28
|
+
* остановки Tab, знает только живой узел; результат уходит в ядро одним
|
|
29
|
+
* вызовом (`IScroller.notifyViewport`) — тем же приёмом, каким клавиатура
|
|
30
|
+
* тегов сообщает тег под фокусом (`notifyFocus`).
|
|
31
|
+
*
|
|
32
|
+
* Клики по кнопкам плагин ловит сам, слушателем на корне, и зовёт команды
|
|
33
|
+
* ядра (приём `TSelectPointerPlugin` → `owner.toggleOpen()`). В разметке
|
|
34
|
+
* обработчиков нет: связка «нажали ⇄ листаем» повторялась бы в каждом из
|
|
35
|
+
* шести адаптеров.
|
|
36
|
+
*
|
|
37
|
+
* Поводов пересчитать четыре — размер вьюпорта, размер его детей, смена
|
|
38
|
+
* состава и прокрутка, — и все они сводятся в **один проход раз в кадр**.
|
|
39
|
+
* Писать в DOM прямо из колбэка наблюдателя нельзя: петля
|
|
40
|
+
* `ResizeObserver loop completed with undelivered notifications` роняет
|
|
41
|
+
* браузерный прогон (сторож `playground/vue/browser/setup.ts`).
|
|
42
|
+
*
|
|
43
|
+
* **Фокус.** Элемент под фокусом браузер докручивает, только если тот целиком
|
|
44
|
+
* ушёл из окна снапа, а частично видимый оставляет на месте — у края, под
|
|
45
|
+
* подсказкой темы. Поэтому по `focusin` плагин доводит элемент в окно сам
|
|
46
|
+
* (счёт — `resolveFocusShift`). Окно — паддинг-бокс вьюпорта без
|
|
47
|
+
* `scroll-padding`: ширину подсказки знает только тема, и она же делает окно
|
|
48
|
+
* чистой частью ленты. Замер окна и доводка без снапа — общие с рядом тегов
|
|
49
|
+
* `scroll` (`scrollWindowOf`, `nearestShift`). Три решения:
|
|
50
|
+
* - только фокус с клавиатуры (`:focus-visible`). Фокус от нажатия мышью
|
|
51
|
+
* браузер сам не докручивает, и правильно: сдвинься лента между нажатием и
|
|
52
|
+
* отпусканием, под указателем оказался бы другой элемент, и `click` не
|
|
53
|
+
* дошёл бы;
|
|
54
|
+
* - сдвиг синхронный, прямо в обработчике, и мгновенный (`instant`). Фокус
|
|
55
|
+
* браузер докручивает и сам, тоже мгновенно: после `focus()` — сразу за
|
|
56
|
+
* `focusin`, и плавную анимацию он бы перебил, а после нашего сдвига ему уже
|
|
57
|
+
* нечего делать. При переходе Tab он докручивает ещё до `focusin`, и
|
|
58
|
+
* элемент, целиком ушедший из окна, плагин застаёт уже в окне;
|
|
59
|
+
* - в окно встаёт элемент ленты (прямой ребёнок вьюпорта), а не только
|
|
60
|
+
* элемент под фокусом: не шире окна — целиком, к своей точке снапа; шире —
|
|
61
|
+
* к ближайшей точке, где он накрывает окно, а элемент под фокусом в окне.
|
|
62
|
+
* Элемент — потому что снап выравнивает элементы, а не их части: докрутку
|
|
63
|
+
* до конца окна (фокусом браузера или чужим `scrollIntoView`) он вернул бы
|
|
64
|
+
* к соседней точке, и элемент остался бы у края, — а крестик тега без
|
|
65
|
+
* подписи не скажет, какой тег он закроет. Точка — потому что снап
|
|
66
|
+
* действует и на программную прокрутку; ближайшая — потому что с одним
|
|
67
|
+
* «начало к началу» крестик в конце длинного тега остался бы за краем.
|
|
68
|
+
*
|
|
69
|
+
* **Фокус у края.** Когда лента доезжает до края, кнопка этой стороны
|
|
70
|
+
* выключается нативным `disabled`, и если фокус был на ней, браузер
|
|
71
|
+
* сбрасывает его на страницу: пользователь клавиатуры и скринридера теряет
|
|
72
|
+
* место и кольцо фокуса. Поэтому плагин отдаёт такой фокус кнопке напротив.
|
|
73
|
+
* Край, от которого ушли, к этому моменту уже открыт: пользователь остаётся у
|
|
74
|
+
* ленты, и прокрутка не меняется. Отдаёт кадром позже: в одном замере один
|
|
75
|
+
* край закрывается, а другой открывается, и кнопку напротив включает только
|
|
76
|
+
* перерисовка адаптера. Фокус, который за этот кадр увели на другой элемент,
|
|
77
|
+
* плагин не трогает, а у выключенной ленты отдать его некому.
|
|
78
|
+
*
|
|
79
|
+
* Не режим `Button` «выключена, но фокусируема» (`aria-disabled` вместо
|
|
80
|
+
* нативного `disabled`): это новая поверхность общего компонента ради правила
|
|
81
|
+
* фокуса одной ленты. И не элемент ленты: остановка ряда тегов бывает за
|
|
82
|
+
* краем, и фокус на ней прокрутил бы ленту обратно.
|
|
83
|
+
*/
|
|
84
|
+
var TScrollerViewportPlugin = class extends TBasePlugin {
|
|
85
|
+
_owner = null;
|
|
86
|
+
_root = null;
|
|
87
|
+
_viewport = null;
|
|
88
|
+
_resize = null;
|
|
89
|
+
_mutation = null;
|
|
90
|
+
_frame = null;
|
|
91
|
+
/** Кадр, в котором фокус уйдёт от выключенной кнопки к кнопке напротив. */
|
|
92
|
+
_handoverFrame = null;
|
|
93
|
+
/**
|
|
94
|
+
* Узлы под наблюдением размера — вьюпорт и его прямые дети.
|
|
95
|
+
*
|
|
96
|
+
* Список, а не «отключить и наблюдать заново каждый проход»: свежая
|
|
97
|
+
* подписка `ResizeObserver` сразу шлёт уведомление, и переподписка на
|
|
98
|
+
* каждом проходе гоняла бы проход по кругу кадр за кадром. Здесь новый
|
|
99
|
+
* узел даёт одно лишнее уведомление, а следующий проход состава уже не
|
|
100
|
+
* меняет.
|
|
101
|
+
*/
|
|
102
|
+
_observed = /* @__PURE__ */ new Set();
|
|
103
|
+
install(ctx) {
|
|
104
|
+
super.install(ctx);
|
|
105
|
+
this._owner = ctx.getInstance() ?? null;
|
|
106
|
+
const element = ctx.get(TElementPlugin);
|
|
107
|
+
element?.events.on("ready", (node) => this._bind(node));
|
|
108
|
+
element?.events.on("removed", () => this._bind(null));
|
|
109
|
+
this._listenTo(this._owner?.events, "scroll:request", (direction) => this._scroll(direction));
|
|
110
|
+
this._listenTo(this._owner?.events, "change:canPrev", ({ newValue: open }) => {
|
|
111
|
+
if (!open) this._onEdgeClosed("prev");
|
|
112
|
+
});
|
|
113
|
+
this._listenTo(this._owner?.events, "change:canNext", ({ newValue: open }) => {
|
|
114
|
+
if (!open) this._onEdgeClosed("next");
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
destroy() {
|
|
118
|
+
this._unlisten();
|
|
119
|
+
this._disconnect();
|
|
120
|
+
this._cancel();
|
|
121
|
+
this._cancelHandover();
|
|
122
|
+
this._resize?.disconnect();
|
|
123
|
+
this._resize = null;
|
|
124
|
+
this._mutation = null;
|
|
125
|
+
this._root = null;
|
|
126
|
+
this._viewport = null;
|
|
127
|
+
this._owner = null;
|
|
128
|
+
super.destroy();
|
|
129
|
+
}
|
|
130
|
+
/** Корень сменился — вместе с ним переезжают вьюпорт, слушатели и наблюдатели. */
|
|
131
|
+
_bind(root) {
|
|
132
|
+
this._unlisten();
|
|
133
|
+
this._disconnect();
|
|
134
|
+
this._cancel();
|
|
135
|
+
this._cancelHandover();
|
|
136
|
+
this._root = root;
|
|
137
|
+
this._viewport = root && this._owner ? viewportOf(this._owner, root) : null;
|
|
138
|
+
this._listen();
|
|
139
|
+
if (this._viewport) this._schedule();
|
|
140
|
+
}
|
|
141
|
+
_listen() {
|
|
142
|
+
const root = this._root;
|
|
143
|
+
const viewport = this._viewport;
|
|
144
|
+
root?.addEventListener("click", this._onClick);
|
|
145
|
+
viewport?.addEventListener("scroll", this._onSchedule);
|
|
146
|
+
viewport?.addEventListener("focusin", this._onFocusIn);
|
|
147
|
+
if (this._viewport) {
|
|
148
|
+
this._mutation ??= new MutationObserver(this._onSchedule);
|
|
149
|
+
this._mutation.observe(this._viewport, {
|
|
150
|
+
childList: true,
|
|
151
|
+
subtree: true
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
_unlisten() {
|
|
156
|
+
const root = this._root;
|
|
157
|
+
const viewport = this._viewport;
|
|
158
|
+
root?.removeEventListener("click", this._onClick);
|
|
159
|
+
viewport?.removeEventListener("scroll", this._onSchedule);
|
|
160
|
+
viewport?.removeEventListener("focusin", this._onFocusIn);
|
|
161
|
+
this._mutation?.disconnect();
|
|
162
|
+
}
|
|
163
|
+
/** Снимает наблюдение размеров: узлы старого корня нас больше не касаются. */
|
|
164
|
+
_disconnect() {
|
|
165
|
+
for (const node of this._observed) this._resize?.unobserve(node);
|
|
166
|
+
this._observed.clear();
|
|
167
|
+
}
|
|
168
|
+
/** Проход — раз в кадр: подряд идущие поводы схлопываются в один замер. */
|
|
169
|
+
_onSchedule = () => this._schedule();
|
|
170
|
+
_schedule() {
|
|
171
|
+
if (this._frame !== null) return;
|
|
172
|
+
this._frame = requestAnimationFrame(() => {
|
|
173
|
+
this._frame = null;
|
|
174
|
+
this._observe();
|
|
175
|
+
this._measure();
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
_cancel() {
|
|
179
|
+
if (this._frame === null) return;
|
|
180
|
+
cancelAnimationFrame(this._frame);
|
|
181
|
+
this._frame = null;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Под наблюдением вьюпорт и его прямые дети: лента меняет края и когда ей
|
|
185
|
+
* самой сменили ширину, и когда вырос любой элемент внутри.
|
|
186
|
+
*
|
|
187
|
+
* `border-box`: у вьюпорта есть паддинг (запас под кольцо фокуса
|
|
188
|
+
* содержимого), и `content-box` пропустил бы его смену вместе со сменой
|
|
189
|
+
* размера.
|
|
190
|
+
*/
|
|
191
|
+
_observe() {
|
|
192
|
+
const observer = this._resize ??= new ResizeObserver(this._onSchedule);
|
|
193
|
+
const current = /* @__PURE__ */ new Set();
|
|
194
|
+
if (this._viewport) {
|
|
195
|
+
current.add(this._viewport);
|
|
196
|
+
for (const child of this._viewport.children) current.add(child);
|
|
197
|
+
}
|
|
198
|
+
for (const node of this._observed) {
|
|
199
|
+
if (current.has(node)) continue;
|
|
200
|
+
observer.unobserve(node);
|
|
201
|
+
this._observed.delete(node);
|
|
202
|
+
}
|
|
203
|
+
for (const node of current) {
|
|
204
|
+
if (this._observed.has(node)) continue;
|
|
205
|
+
observer.observe(node, { box: "border-box" });
|
|
206
|
+
this._observed.add(node);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** Три числа вьюпорта плюс остановки Tab внутри — весь замер ленты. */
|
|
210
|
+
_measure() {
|
|
211
|
+
const viewport = this._viewport;
|
|
212
|
+
if (!this._owner || !viewport) return;
|
|
213
|
+
this._owner.notifyViewport({
|
|
214
|
+
...resolveEdges({
|
|
215
|
+
scrollLeft: viewport.scrollLeft,
|
|
216
|
+
clientWidth: viewport.clientWidth,
|
|
217
|
+
scrollWidth: viewport.scrollWidth
|
|
218
|
+
}),
|
|
219
|
+
hasTabStops: tabStops(viewport).length > 0
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Шаг — видимая ширина вьюпорта, то есть страница; до границы элемента
|
|
224
|
+
* страницу доводит снап темы, и границы элементов считать не нужно —
|
|
225
|
+
* в этом и была ставка на слот вместо коллекции.
|
|
226
|
+
*
|
|
227
|
+
* Знак — по вычисленному направлению письма: в RTL начало строки справа,
|
|
228
|
+
* и «вперёд» уводит ленту влево.
|
|
229
|
+
*
|
|
230
|
+
* Листает плавно, если движение не убрано (`smoothScrollBehavior`): по
|
|
231
|
+
* умолчанию — пока система о движении не просила, а режим движения
|
|
232
|
+
* библиотеки может задать приложение. Плавность — в вызове, а не проп
|
|
233
|
+
* ядра: из трёх значений `TScrollBehavior` у ленты осмысленны два, и
|
|
234
|
+
* третье было бы мёртвым значением в перечислении. Правило темы с этим не
|
|
235
|
+
* спорит — `scroll-behavior` она не объявляет.
|
|
236
|
+
*/
|
|
237
|
+
_scroll(direction) {
|
|
238
|
+
const viewport = this._viewport;
|
|
239
|
+
if (!viewport) return;
|
|
240
|
+
const rtl = getComputedStyle(viewport).direction === "rtl";
|
|
241
|
+
const forward = direction === "next" ? 1 : -1;
|
|
242
|
+
viewport.scrollBy({
|
|
243
|
+
left: (rtl ? -forward : forward) * viewport.clientWidth,
|
|
244
|
+
behavior: smoothScrollBehavior(viewport)
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Нажатие по кнопке ленты. Кнопки стоят снаружи вьюпорта, поэтому чужая
|
|
249
|
+
* лента внутри содержимого своими кнопками нашу не двигает: её кнопки
|
|
250
|
+
* лежат в нашем вьюпорте.
|
|
251
|
+
*/
|
|
252
|
+
_onClick = (event) => {
|
|
253
|
+
const target = event.target;
|
|
254
|
+
if (!(target instanceof Element)) return;
|
|
255
|
+
if (this._owns(target.closest(this._selector("__prev")))) {
|
|
256
|
+
this._owner?.scrollPrev();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (this._owns(target.closest(this._selector("__next")))) this._owner?.scrollNext();
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Фокус с клавиатуры пришёл в ленту — довести элемент под ним в окно
|
|
263
|
+
* снапа (почему так — в описании плагина).
|
|
264
|
+
*
|
|
265
|
+
* Сам вьюпорт — остановка Tab ленты без своих остановок: он и есть окно, и
|
|
266
|
+
* доводить его некуда.
|
|
267
|
+
*/
|
|
268
|
+
_onFocusIn = (event) => {
|
|
269
|
+
const viewport = this._viewport;
|
|
270
|
+
const target = event.target;
|
|
271
|
+
if (!viewport || !(target instanceof Element) || target === viewport) return;
|
|
272
|
+
if (!target.matches(":focus-visible")) return;
|
|
273
|
+
const style = getComputedStyle(viewport);
|
|
274
|
+
const shift = resolveFocusShift({
|
|
275
|
+
snapport: scrollWindowOf(viewport, style),
|
|
276
|
+
focused: target.getBoundingClientRect(),
|
|
277
|
+
item: itemOf(target, viewport).getBoundingClientRect(),
|
|
278
|
+
rtl: style.direction === "rtl"
|
|
279
|
+
});
|
|
280
|
+
if (shift !== null) viewport.scrollBy({
|
|
281
|
+
left: shift,
|
|
282
|
+
behavior: "instant"
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Край закрылся. Если фокус на кнопке этого края, её выключит перерисовка,
|
|
287
|
+
* и браузер сбросит фокус на страницу, — кадром позже его заберёт кнопка
|
|
288
|
+
* напротив (почему так — в описании плагина).
|
|
289
|
+
*/
|
|
290
|
+
_onEdgeClosed(edge) {
|
|
291
|
+
const button = (this._root?.ownerDocument.activeElement ?? null)?.closest(this._selector(BUTTON_PART[edge])) ?? null;
|
|
292
|
+
if (button === null || !this._owns(button)) return;
|
|
293
|
+
this._cancelHandover();
|
|
294
|
+
this._handoverFrame = requestAnimationFrame(() => {
|
|
295
|
+
this._handoverFrame = null;
|
|
296
|
+
this._handOver(edge, button);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Отдать фокус кнопке напротив, если у него не осталось места.
|
|
301
|
+
*
|
|
302
|
+
* Без места он в двух случаях: браузер сбросил его на страницу или оставил
|
|
303
|
+
* на выключенной кнопке. Если же край за кадр открылся снова, кнопка жива,
|
|
304
|
+
* и фокус на ней остаётся.
|
|
305
|
+
*/
|
|
306
|
+
_handOver(edge, stranded) {
|
|
307
|
+
const owner = this._owner;
|
|
308
|
+
const root = this._root;
|
|
309
|
+
if (!owner || !root) return;
|
|
310
|
+
const doc = root.ownerDocument;
|
|
311
|
+
const active = doc.activeElement;
|
|
312
|
+
if (stranded.contains(active)) {
|
|
313
|
+
if (!isButtonDisabled(owner, edge)) return;
|
|
314
|
+
} else if (active !== null && active !== doc.body && active !== doc.documentElement) return;
|
|
315
|
+
const opposite = OPPOSITE[edge];
|
|
316
|
+
if (isButtonDisabled(owner, opposite)) return;
|
|
317
|
+
const button = this._button(opposite);
|
|
318
|
+
if (isFocusableElement(button)) button.focus();
|
|
319
|
+
}
|
|
320
|
+
_cancelHandover() {
|
|
321
|
+
if (this._handoverFrame === null) return;
|
|
322
|
+
cancelAnimationFrame(this._handoverFrame);
|
|
323
|
+
this._handoverFrame = null;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Кнопка этой ленты, а не первая по селектору: у вложенной ленты кнопки с
|
|
327
|
+
* тем же классом, и лежат они в нашем вьюпорте.
|
|
328
|
+
*/
|
|
329
|
+
_button(side) {
|
|
330
|
+
const selector = this._selector(BUTTON_PART[side]);
|
|
331
|
+
for (const node of this._root?.querySelectorAll(selector) ?? []) if (this._owns(node)) return node;
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
_owns(node) {
|
|
335
|
+
if (node === null) return false;
|
|
336
|
+
return this._root?.contains(node) === true && this._viewport?.contains(node) !== true;
|
|
337
|
+
}
|
|
338
|
+
/** Селектор части — из классов инстанса, а не строкой в плагине. */
|
|
339
|
+
_selector(part) {
|
|
340
|
+
return this._owner?.classes.resolve(part, { point: true }) ?? "";
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Выключена ли кнопка этой стороны — правилом ядра: выключена лента или
|
|
345
|
+
* упёрлись в край. Своего правила у плагина нет: второй экземпляр однажды
|
|
346
|
+
* разошёлся бы с тем, по которому кнопку выключает разметка.
|
|
347
|
+
*/
|
|
348
|
+
function isButtonDisabled(owner, side) {
|
|
349
|
+
return side === "prev" ? owner.prevDisabled : owner.nextDisabled;
|
|
350
|
+
}
|
|
351
|
+
//#endregion
|
|
352
|
+
export { TScrollerViewportPlugin };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { TBasePlugin } from '../../../base';
|
|
2
|
+
import type { IPluginContext } from '../../../base';
|
|
3
|
+
import type { TSelectBackspacePluginEvents } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* TSelectBackspacePlugin — удаление выбранных тегов по `Backspace` в пустом
|
|
6
|
+
* поле Select (`editable` + `multiple`).
|
|
7
|
+
*
|
|
8
|
+
* Отдельный плагин, не ветка в `TSelectKeyboardPlugin`: удаление тега не
|
|
9
|
+
* влияет ни на подсветку, ни на `aria-activedescendant`, которыми владеет
|
|
10
|
+
* клавиатурная стратегия, а смешивать их значило бы решать, чья стратегия
|
|
11
|
+
* первой увидит `Backspace`.
|
|
12
|
+
*
|
|
13
|
+
* Слушатель, как и у `TEditablePlugin`, вешается подпиской на условия, а не
|
|
14
|
+
* проверкой внутри обработчика: нужны сразу три — включённое свойство
|
|
15
|
+
* `owner.removeOnBackspace`, `editable: true` и `selection.mode === 'multiple'`.
|
|
16
|
+
* Ни одно из них само по себе не значит, что клавиатуре есть что удалять.
|
|
17
|
+
*
|
|
18
|
+
* Правило взвода: первое нажатие `Backspace` в пустом поле только взводит
|
|
19
|
+
* счётчик, второе и каждое следующее подряд удаляет по одному тегу. Любая
|
|
20
|
+
* другая клавиша, `Backspace` при непустом поле и снятие слушателя сбрасывают
|
|
21
|
+
* счётчик. Автоповтор (`KeyboardEvent.repeat`) не учитывается вовсе — ни
|
|
22
|
+
* взводит, ни сбрасывает.
|
|
23
|
+
*
|
|
24
|
+
* Что считается «последним» — последний тег, а не последний элемент
|
|
25
|
+
* `selection.selected`: пользователь видит теги, не порядок выбора в
|
|
26
|
+
* коллекции (на практике они совпадают, но знание об этом не должно жить в
|
|
27
|
+
* плагине). Тег ищется через расширение тегов (`tags`), снимается выбор — через
|
|
28
|
+
* `selection.deselect`, а не через driver: плагину сама коллекция опций
|
|
29
|
+
* недоступна на уровне хранилища, только через расширения.
|
|
30
|
+
*/
|
|
31
|
+
export declare class TSelectBackspacePlugin extends TBasePlugin<any, TSelectBackspacePluginEvents> {
|
|
32
|
+
private _owner;
|
|
33
|
+
private _input;
|
|
34
|
+
private _engine;
|
|
35
|
+
private _listening;
|
|
36
|
+
private _armed;
|
|
37
|
+
private readonly _onKeyDown;
|
|
38
|
+
install(ctx: IPluginContext): void;
|
|
39
|
+
destroy(): void;
|
|
40
|
+
private get _selectionExtension();
|
|
41
|
+
private get _tagsExtension();
|
|
42
|
+
/** Слушаем `keydown`, только пока все три условия выполнены разом. */
|
|
43
|
+
private _needed;
|
|
44
|
+
private _syncListener;
|
|
45
|
+
private _listen;
|
|
46
|
+
private _unlisten;
|
|
47
|
+
private _handleKeyDown;
|
|
48
|
+
/** Снимает выбор с опции, чей тег стоит последним в поле. */
|
|
49
|
+
private _removeLastTag;
|
|
50
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
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 { fieldOf } from "../../input/field.js";
|
|
5
|
+
import { batchOf, selectionOf, tagsOf } from "@soxa-ui/core";
|
|
6
|
+
//#region src/custom/select/backspace/backspace.plugin.ts
|
|
7
|
+
/**
|
|
8
|
+
* TSelectBackspacePlugin — удаление выбранных тегов по `Backspace` в пустом
|
|
9
|
+
* поле Select (`editable` + `multiple`).
|
|
10
|
+
*
|
|
11
|
+
* Отдельный плагин, не ветка в `TSelectKeyboardPlugin`: удаление тега не
|
|
12
|
+
* влияет ни на подсветку, ни на `aria-activedescendant`, которыми владеет
|
|
13
|
+
* клавиатурная стратегия, а смешивать их значило бы решать, чья стратегия
|
|
14
|
+
* первой увидит `Backspace`.
|
|
15
|
+
*
|
|
16
|
+
* Слушатель, как и у `TEditablePlugin`, вешается подпиской на условия, а не
|
|
17
|
+
* проверкой внутри обработчика: нужны сразу три — включённое свойство
|
|
18
|
+
* `owner.removeOnBackspace`, `editable: true` и `selection.mode === 'multiple'`.
|
|
19
|
+
* Ни одно из них само по себе не значит, что клавиатуре есть что удалять.
|
|
20
|
+
*
|
|
21
|
+
* Правило взвода: первое нажатие `Backspace` в пустом поле только взводит
|
|
22
|
+
* счётчик, второе и каждое следующее подряд удаляет по одному тегу. Любая
|
|
23
|
+
* другая клавиша, `Backspace` при непустом поле и снятие слушателя сбрасывают
|
|
24
|
+
* счётчик. Автоповтор (`KeyboardEvent.repeat`) не учитывается вовсе — ни
|
|
25
|
+
* взводит, ни сбрасывает.
|
|
26
|
+
*
|
|
27
|
+
* Что считается «последним» — последний тег, а не последний элемент
|
|
28
|
+
* `selection.selected`: пользователь видит теги, не порядок выбора в
|
|
29
|
+
* коллекции (на практике они совпадают, но знание об этом не должно жить в
|
|
30
|
+
* плагине). Тег ищется через расширение тегов (`tags`), снимается выбор — через
|
|
31
|
+
* `selection.deselect`, а не через driver: плагину сама коллекция опций
|
|
32
|
+
* недоступна на уровне хранилища, только через расширения.
|
|
33
|
+
*/
|
|
34
|
+
var TSelectBackspacePlugin = class extends TBasePlugin {
|
|
35
|
+
_owner = null;
|
|
36
|
+
_input = null;
|
|
37
|
+
_engine = null;
|
|
38
|
+
_listening = false;
|
|
39
|
+
_armed = false;
|
|
40
|
+
_onKeyDown = this._handleKeyDown.bind(this);
|
|
41
|
+
install(ctx) {
|
|
42
|
+
super.install(ctx);
|
|
43
|
+
this._owner = ctx.getInstance() ?? null;
|
|
44
|
+
const elementPlugin = ctx.get(TElementPlugin);
|
|
45
|
+
elementPlugin?.events.on("ready", (element) => {
|
|
46
|
+
const field = fieldOf(element);
|
|
47
|
+
this._input = field instanceof HTMLInputElement ? field : null;
|
|
48
|
+
this._syncListener();
|
|
49
|
+
});
|
|
50
|
+
elementPlugin?.events.on("removed", () => {
|
|
51
|
+
this._unlisten();
|
|
52
|
+
this._input = null;
|
|
53
|
+
});
|
|
54
|
+
const sync = () => this._syncListener();
|
|
55
|
+
ctx.get(TCollectionBundlesPlugin)?.events.on("engine:bound", (engine) => {
|
|
56
|
+
this._engine = engine;
|
|
57
|
+
this._listenTo(this._selectionExtension?.events, "change:mode", sync);
|
|
58
|
+
this._syncListener();
|
|
59
|
+
});
|
|
60
|
+
this._listenTo(this._owner?.events, "change:removeOnBackspace", sync);
|
|
61
|
+
this._listenTo(this._owner?.events, "change:editable", sync);
|
|
62
|
+
}
|
|
63
|
+
destroy() {
|
|
64
|
+
this._unlisten();
|
|
65
|
+
this._input = null;
|
|
66
|
+
this._owner = null;
|
|
67
|
+
this._engine = null;
|
|
68
|
+
super.destroy();
|
|
69
|
+
}
|
|
70
|
+
get _selectionExtension() {
|
|
71
|
+
return selectionOf(this._engine);
|
|
72
|
+
}
|
|
73
|
+
get _tagsExtension() {
|
|
74
|
+
return tagsOf(this._engine);
|
|
75
|
+
}
|
|
76
|
+
/** Слушаем `keydown`, только пока все три условия выполнены разом. */
|
|
77
|
+
_needed() {
|
|
78
|
+
const owner = this._owner;
|
|
79
|
+
return Boolean(owner?.removeOnBackspace) && Boolean(owner?.editable) && Boolean(this._selectionExtension?.multiple);
|
|
80
|
+
}
|
|
81
|
+
_syncListener() {
|
|
82
|
+
if (this._needed()) this._listen();
|
|
83
|
+
else this._unlisten();
|
|
84
|
+
}
|
|
85
|
+
_listen() {
|
|
86
|
+
if (this._listening || !this._input) return;
|
|
87
|
+
this._input.addEventListener("keydown", this._onKeyDown);
|
|
88
|
+
this._listening = true;
|
|
89
|
+
}
|
|
90
|
+
_unlisten() {
|
|
91
|
+
this._armed = false;
|
|
92
|
+
if (!this._listening) return;
|
|
93
|
+
this._input?.removeEventListener("keydown", this._onKeyDown);
|
|
94
|
+
this._listening = false;
|
|
95
|
+
}
|
|
96
|
+
_handleKeyDown(event) {
|
|
97
|
+
if (event.repeat) return;
|
|
98
|
+
if (event.key !== "Backspace") {
|
|
99
|
+
this._armed = false;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (this._input?.value ?? "") {
|
|
103
|
+
this._armed = false;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!this._armed) {
|
|
107
|
+
this._armed = true;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
this._removeLastTag();
|
|
111
|
+
}
|
|
112
|
+
/** Снимает выбор с опции, чей тег стоит последним в поле. */
|
|
113
|
+
_removeLastTag() {
|
|
114
|
+
const selection = this._selectionExtension;
|
|
115
|
+
const tags = this._tagsExtension;
|
|
116
|
+
if (!selection || !tags) return;
|
|
117
|
+
const tagItems = tags.engine?.extensions.batch.items;
|
|
118
|
+
const lastTag = tagItems?.[tagItems.length - 1];
|
|
119
|
+
if (!lastTag) return;
|
|
120
|
+
const item = batchOf(this._engine)?.items.find((candidate) => candidate.value === lastTag.value);
|
|
121
|
+
if (item) selection.deselect(item);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { TSelectBackspacePlugin };
|