@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,174 @@
|
|
|
1
|
+
import { TBasePlugin } from '../../base';
|
|
2
|
+
import type { IPluginContext } from '../../base';
|
|
3
|
+
import type { IDismissPluginOptions, TDismissPluginEvents } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* TDismissPlugin — «нажали мимо».
|
|
6
|
+
*
|
|
7
|
+
* Общий для всего, что открывается поверх страницы: Select, Menu, Popover,
|
|
8
|
+
* Tooltip, модальное окно. Сообщает событием `dismiss`, а владельца, чью
|
|
9
|
+
* открытость ведёт (`property`), закрывает уже после этого — подписчики
|
|
10
|
+
* застают его открытым и знают причину закрытия. Без привязки
|
|
11
|
+
* (`property: null`) только сообщает.
|
|
12
|
+
*
|
|
13
|
+
* Почему `pointerdown`, а не `click`. Клик приходит после отпускания кнопки,
|
|
14
|
+
* и до него успевает произойти смена фокуса — панель закрывается уже после
|
|
15
|
+
* того, как фокус ушёл, и порядок событий для скринридера ломается.
|
|
16
|
+
*
|
|
17
|
+
* Касание пальцем решается на `pointerup`. На тач-устройстве с того же
|
|
18
|
+
* `pointerdown` начинается прокрутка страницы, и панель закрывалась бы, едва
|
|
19
|
+
* пользователь начал листать. Поэтому касание мимо только запоминает свой
|
|
20
|
+
* `pointerId`, а `dismiss` шлёт `pointerup` того же касания. Порог сдвига не
|
|
21
|
+
* нужен: забрав касание под прокрутку, браузер шлёт `pointercancel`, и
|
|
22
|
+
* `pointerup` не приходит. `click` не годится и здесь — `pointerType` в нём
|
|
23
|
+
* есть не у всех браузеров. Порядку фокуса это не вредит: на касании фокус
|
|
24
|
+
* переходит только перед `click`, уже после `pointerup`. Мышь остаётся на
|
|
25
|
+
* `pointerdown`.
|
|
26
|
+
*
|
|
27
|
+
* Перо решается первым из двух событий: `pointerup` того же `pointerId` или
|
|
28
|
+
* совместимым `mousedown`. По `pointerType` стилус на сенсорном экране (Apple
|
|
29
|
+
* Pencil, S Pen, перо Windows-планшета) не отличить от пера графического
|
|
30
|
+
* планшета, а ведут они себя по-разному. Решать перо на `pointerdown`, как
|
|
31
|
+
* мышь, нельзя: стилус листает страницу, как палец. Ждать `pointerup`, как у
|
|
32
|
+
* касания, тоже нельзя: перо планшета ведёт себя как мышь — `mousedown`, а с
|
|
33
|
+
* ним и смена фокуса, идёт сразу за `pointerdown`, и панель закрылась бы уже
|
|
34
|
+
* после ухода фокуса. Поэтому устройство не угадываем, а решаем по порядку
|
|
35
|
+
* событий, который задаёт браузер. На планшете первым приходит `mousedown`, и
|
|
36
|
+
* панель закрывается до смены фокуса. Стилусу на экране совместимые события
|
|
37
|
+
* мыши приходят только после отпускания: решает `pointerup`, а прокрутка
|
|
38
|
+
* (`pointercancel`) снимает ожидание и ничего не закрывает. Исключение одно:
|
|
39
|
+
* страница отменила `pointerdown`. Совместимых событий тогда нет, и перо
|
|
40
|
+
* решает `pointerup` и на планшете.
|
|
41
|
+
*
|
|
42
|
+
* Как считается «мимо». Панель обычно телепортирована в `body`, то есть
|
|
43
|
+
* лежит вне поддерева владельца — простой `contains()` по корню посчитал бы
|
|
44
|
+
* нажатие внутри панели нажатием снаружи. Поэтому панель помечается
|
|
45
|
+
* `data-owner="<id>"` — `id` части `owner` монтирования владельца
|
|
46
|
+
* (`createId`), — и плагин проверяет обе границы. Это чистый DOM: работает
|
|
47
|
+
* одинаково во всех шести адаптерах и не требует проводки между компонентами.
|
|
48
|
+
*
|
|
49
|
+
* Третья граница — слои. Список Select в поповере, поповер в поповере — это
|
|
50
|
+
* тоже панели в `body`, соседи панели владельца, а не её потомки. Нажатие в
|
|
51
|
+
* них — нажатие внутри: слой открыт поверх панели владельца, из неё. Порядок
|
|
52
|
+
* слоёв ведёт `TLayer` — Frame и модальное окно (`data-layer`, номер растёт с
|
|
53
|
+
* каждым показом), и нажатие в панель, чей слой выше слоя своей, мимо не
|
|
54
|
+
* считается. Слой ниже или узел без слоя — мимо: так закрывается вложенный
|
|
55
|
+
* слой нажатием во внешний.
|
|
56
|
+
*
|
|
57
|
+
* С `focusOutside` то же правило решает и уход фокуса: `focusin` мимо
|
|
58
|
+
* владельца, его панели и слоёв выше даёт `dismiss`.
|
|
59
|
+
*/
|
|
60
|
+
export declare class TDismissPlugin extends TBasePlugin<any, TDismissPluginEvents> {
|
|
61
|
+
/** Умолчания опций, объявленных пропами, — см. `TAnchorPlugin.defaultValues`. */
|
|
62
|
+
static defaultValues: Required<Pick<IDismissPluginOptions, 'enabled'>>;
|
|
63
|
+
private _element;
|
|
64
|
+
/**
|
|
65
|
+
* Пометка панели владельца — значение `data-owner`. От монтирования, а не
|
|
66
|
+
* от `uid`: пометка уходит в разметку, и на сервере и в браузере обязана
|
|
67
|
+
* совпасть.
|
|
68
|
+
*/
|
|
69
|
+
private _ownerMark;
|
|
70
|
+
/**
|
|
71
|
+
* Открытость владельца (`property`): по ней плагин включается, ею же
|
|
72
|
+
* `dismiss` закрывает владельца. `null` — привязки нет, плагин только
|
|
73
|
+
* сообщает.
|
|
74
|
+
*/
|
|
75
|
+
private _open;
|
|
76
|
+
private _enabled;
|
|
77
|
+
private _focusOutside;
|
|
78
|
+
private _listening;
|
|
79
|
+
/** Нажатие мимо, которое ждёт решения, — касание или перо (см. `_onPointerDown`). */
|
|
80
|
+
private _pending;
|
|
81
|
+
install(ctx: IPluginContext, options?: IDismissPluginOptions): void;
|
|
82
|
+
/**
|
|
83
|
+
* Сообщает о нажатии или фокусе мимо, потом закрывает владельца.
|
|
84
|
+
*
|
|
85
|
+
* Закрывает здесь, после подписчиков `dismiss`, а не первым подписчиком:
|
|
86
|
+
* иначе остальные узнавали бы о нажатии мимо уже закрытыми и не отличали
|
|
87
|
+
* бы его от закрытия по другой причине.
|
|
88
|
+
*
|
|
89
|
+
* Закрывает с причиной `outside`: владелец, который принимает запрос
|
|
90
|
+
* закрытия (модальное окно), решает сам — закрыться, отклонить нажатие
|
|
91
|
+
* мимо или отдать решение подписчику. `dismiss` при этом уже пришёл:
|
|
92
|
+
* нажатие мимо было, закроется окно или нет.
|
|
93
|
+
*/
|
|
94
|
+
private _dismiss;
|
|
95
|
+
/**
|
|
96
|
+
* Следит ли плагин за нажатиями (с `focusOutside` — и за фокусом).
|
|
97
|
+
* Владелец включает его на открытии.
|
|
98
|
+
*/
|
|
99
|
+
get enabled(): boolean;
|
|
100
|
+
set enabled(value: boolean);
|
|
101
|
+
/**
|
|
102
|
+
* Атрибут для панели владельца. Разметка раскладывает его спредом на
|
|
103
|
+
* телепортированный узел, иначе нажатие внутри панели будет считаться
|
|
104
|
+
* нажатием мимо.
|
|
105
|
+
*/
|
|
106
|
+
get ownerAttribute(): Record<string, string>;
|
|
107
|
+
/**
|
|
108
|
+
* Панель владельца — узел с его `ownerAttribute` в документе корня. `null`,
|
|
109
|
+
* пока корень не объявлен или панели в документе нет.
|
|
110
|
+
*
|
|
111
|
+
* Панель телепортирована, и ссылки на неё у плагинов нет: разметка отдаёт
|
|
112
|
+
* им только корень. Поэтому её находят по той же пометке, по которой
|
|
113
|
+
* плагин отличает нажатие в неё. Нужна и соседям по набору: плагин фокуса
|
|
114
|
+
* Popover уводит фокус в панель и слушает на ней клавиши.
|
|
115
|
+
*/
|
|
116
|
+
findPanel(): Element | null;
|
|
117
|
+
/**
|
|
118
|
+
* Пришлось ли нажатие или фокус внутрь владельца, его панели или слоя выше
|
|
119
|
+
* неё — панели, открытой поверх своей (см. шапку). Правило слоёв общее с
|
|
120
|
+
* `THideOutsidePlugin`, поэтому живёт в утилитах (`isAboveLayer`).
|
|
121
|
+
*
|
|
122
|
+
* Нужно и соседям по набору: возврат поля Select на уходе фокуса решает
|
|
123
|
+
* по тем же границам.
|
|
124
|
+
*/
|
|
125
|
+
isInside(target: EventTarget | null): boolean;
|
|
126
|
+
destroy(): void;
|
|
127
|
+
/** Селектор панели владельца — по её пометке. */
|
|
128
|
+
private get _panelSelector();
|
|
129
|
+
/**
|
|
130
|
+
* Мышь решает на нажатии, касание и перо ждут (см. шапку).
|
|
131
|
+
*
|
|
132
|
+
* Ожидание одно — для последнего опущенного нажатия, поэтому любое нажатие
|
|
133
|
+
* (мышью, пальцем или пером, внутрь или мимо) сначала снимает прежнее.
|
|
134
|
+
* Иначе панель, с которой уже работают, закрыло бы отпускание пальца,
|
|
135
|
+
* лёгшего мимо раньше, или `mousedown` мыши, нажатой внутрь, пока перо
|
|
136
|
+
* лежит мимо: он засчитался бы за перо.
|
|
137
|
+
*/
|
|
138
|
+
private readonly _onPointerDown;
|
|
139
|
+
/** Касание ничего не закрывает — только запоминается, если пришлось мимо. */
|
|
140
|
+
private _startTouch;
|
|
141
|
+
/**
|
|
142
|
+
* Перо тоже только запоминается, если пришлось мимо. Решит его то, что
|
|
143
|
+
* придёт первым: `pointerup` (стилус на экране) или совместимый `mousedown`
|
|
144
|
+
* (перо графического планшета).
|
|
145
|
+
*/
|
|
146
|
+
private _startPen;
|
|
147
|
+
/**
|
|
148
|
+
* Касание или перо мимо отпустили, не начав прокрутку, — это и есть нажатие
|
|
149
|
+
* мимо. Перо, которое уже решил его `mousedown`, ожидания не оставляет, и
|
|
150
|
+
* отпускание его не повторяет.
|
|
151
|
+
*/
|
|
152
|
+
private readonly _onPointerUp;
|
|
153
|
+
/** Браузер забрал касание или перо под прокрутку или жест — закрывать нечего. */
|
|
154
|
+
private readonly _onPointerCancel;
|
|
155
|
+
/**
|
|
156
|
+
* Совместимый `mousedown` решает перо, если пришёл раньше его `pointerup`:
|
|
157
|
+
* так ведёт себя перо планшета, и панель закрывается до смены фокуса.
|
|
158
|
+
*
|
|
159
|
+
* Касание он не решает: прослойки, которые шлют `mousedown` на
|
|
160
|
+
* `touchstart`, вернули бы закрытие в начале прокрутки. Мышь к нему уже
|
|
161
|
+
* решена своим `pointerdown` и ожидания не оставляет. Переносить её сюда
|
|
162
|
+
* нельзя: страница, отменившая `pointerdown` (так делают drag-библиотеки),
|
|
163
|
+
* совместимого `mousedown` не получает.
|
|
164
|
+
*/
|
|
165
|
+
private readonly _onMouseDown;
|
|
166
|
+
/**
|
|
167
|
+
* Фокус ушёл мимо — с `focusOutside`. Слушатель на документе, в фазе
|
|
168
|
+
* перехвата, как у нажатий: `focusin` всплывает, и остановить его до
|
|
169
|
+
* документа содержимое не может.
|
|
170
|
+
*/
|
|
171
|
+
private readonly _onFocusIn;
|
|
172
|
+
/** Слушатели на документе живут, только пока они нужны. */
|
|
173
|
+
private _sync;
|
|
174
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../base/base.class.js";
|
|
2
|
+
import { TElementPlugin } from "../element/element.plugin.js";
|
|
3
|
+
import { isAboveLayer } from "../../utils/isAboveLayer.js";
|
|
4
|
+
import { bindOverlayOpen } from "../overlay/open-state.js";
|
|
5
|
+
//#region src/custom/dismiss/dismiss.plugin.ts
|
|
6
|
+
/** Атрибут, которым панель помечается владельцем (`ownerAttribute`). */
|
|
7
|
+
var OWNER_ATTRIBUTE = "data-owner";
|
|
8
|
+
/**
|
|
9
|
+
* TDismissPlugin — «нажали мимо».
|
|
10
|
+
*
|
|
11
|
+
* Общий для всего, что открывается поверх страницы: Select, Menu, Popover,
|
|
12
|
+
* Tooltip, модальное окно. Сообщает событием `dismiss`, а владельца, чью
|
|
13
|
+
* открытость ведёт (`property`), закрывает уже после этого — подписчики
|
|
14
|
+
* застают его открытым и знают причину закрытия. Без привязки
|
|
15
|
+
* (`property: null`) только сообщает.
|
|
16
|
+
*
|
|
17
|
+
* Почему `pointerdown`, а не `click`. Клик приходит после отпускания кнопки,
|
|
18
|
+
* и до него успевает произойти смена фокуса — панель закрывается уже после
|
|
19
|
+
* того, как фокус ушёл, и порядок событий для скринридера ломается.
|
|
20
|
+
*
|
|
21
|
+
* Касание пальцем решается на `pointerup`. На тач-устройстве с того же
|
|
22
|
+
* `pointerdown` начинается прокрутка страницы, и панель закрывалась бы, едва
|
|
23
|
+
* пользователь начал листать. Поэтому касание мимо только запоминает свой
|
|
24
|
+
* `pointerId`, а `dismiss` шлёт `pointerup` того же касания. Порог сдвига не
|
|
25
|
+
* нужен: забрав касание под прокрутку, браузер шлёт `pointercancel`, и
|
|
26
|
+
* `pointerup` не приходит. `click` не годится и здесь — `pointerType` в нём
|
|
27
|
+
* есть не у всех браузеров. Порядку фокуса это не вредит: на касании фокус
|
|
28
|
+
* переходит только перед `click`, уже после `pointerup`. Мышь остаётся на
|
|
29
|
+
* `pointerdown`.
|
|
30
|
+
*
|
|
31
|
+
* Перо решается первым из двух событий: `pointerup` того же `pointerId` или
|
|
32
|
+
* совместимым `mousedown`. По `pointerType` стилус на сенсорном экране (Apple
|
|
33
|
+
* Pencil, S Pen, перо Windows-планшета) не отличить от пера графического
|
|
34
|
+
* планшета, а ведут они себя по-разному. Решать перо на `pointerdown`, как
|
|
35
|
+
* мышь, нельзя: стилус листает страницу, как палец. Ждать `pointerup`, как у
|
|
36
|
+
* касания, тоже нельзя: перо планшета ведёт себя как мышь — `mousedown`, а с
|
|
37
|
+
* ним и смена фокуса, идёт сразу за `pointerdown`, и панель закрылась бы уже
|
|
38
|
+
* после ухода фокуса. Поэтому устройство не угадываем, а решаем по порядку
|
|
39
|
+
* событий, который задаёт браузер. На планшете первым приходит `mousedown`, и
|
|
40
|
+
* панель закрывается до смены фокуса. Стилусу на экране совместимые события
|
|
41
|
+
* мыши приходят только после отпускания: решает `pointerup`, а прокрутка
|
|
42
|
+
* (`pointercancel`) снимает ожидание и ничего не закрывает. Исключение одно:
|
|
43
|
+
* страница отменила `pointerdown`. Совместимых событий тогда нет, и перо
|
|
44
|
+
* решает `pointerup` и на планшете.
|
|
45
|
+
*
|
|
46
|
+
* Как считается «мимо». Панель обычно телепортирована в `body`, то есть
|
|
47
|
+
* лежит вне поддерева владельца — простой `contains()` по корню посчитал бы
|
|
48
|
+
* нажатие внутри панели нажатием снаружи. Поэтому панель помечается
|
|
49
|
+
* `data-owner="<id>"` — `id` части `owner` монтирования владельца
|
|
50
|
+
* (`createId`), — и плагин проверяет обе границы. Это чистый DOM: работает
|
|
51
|
+
* одинаково во всех шести адаптерах и не требует проводки между компонентами.
|
|
52
|
+
*
|
|
53
|
+
* Третья граница — слои. Список Select в поповере, поповер в поповере — это
|
|
54
|
+
* тоже панели в `body`, соседи панели владельца, а не её потомки. Нажатие в
|
|
55
|
+
* них — нажатие внутри: слой открыт поверх панели владельца, из неё. Порядок
|
|
56
|
+
* слоёв ведёт `TLayer` — Frame и модальное окно (`data-layer`, номер растёт с
|
|
57
|
+
* каждым показом), и нажатие в панель, чей слой выше слоя своей, мимо не
|
|
58
|
+
* считается. Слой ниже или узел без слоя — мимо: так закрывается вложенный
|
|
59
|
+
* слой нажатием во внешний.
|
|
60
|
+
*
|
|
61
|
+
* С `focusOutside` то же правило решает и уход фокуса: `focusin` мимо
|
|
62
|
+
* владельца, его панели и слоёв выше даёт `dismiss`.
|
|
63
|
+
*/
|
|
64
|
+
var TDismissPlugin = class TDismissPlugin extends TBasePlugin {
|
|
65
|
+
/** Умолчания опций, объявленных пропами, — см. `TAnchorPlugin.defaultValues`. */
|
|
66
|
+
static defaultValues = { enabled: false };
|
|
67
|
+
_element = null;
|
|
68
|
+
/**
|
|
69
|
+
* Пометка панели владельца — значение `data-owner`. От монтирования, а не
|
|
70
|
+
* от `uid`: пометка уходит в разметку, и на сервере и в браузере обязана
|
|
71
|
+
* совпасть.
|
|
72
|
+
*/
|
|
73
|
+
_ownerMark = "";
|
|
74
|
+
/**
|
|
75
|
+
* Открытость владельца (`property`): по ней плагин включается, ею же
|
|
76
|
+
* `dismiss` закрывает владельца. `null` — привязки нет, плагин только
|
|
77
|
+
* сообщает.
|
|
78
|
+
*/
|
|
79
|
+
_open = null;
|
|
80
|
+
_enabled = TDismissPlugin.defaultValues.enabled;
|
|
81
|
+
_focusOutside = false;
|
|
82
|
+
_listening = false;
|
|
83
|
+
/** Нажатие мимо, которое ждёт решения, — касание или перо (см. `_onPointerDown`). */
|
|
84
|
+
_pending = null;
|
|
85
|
+
install(ctx, options) {
|
|
86
|
+
super.install(ctx, options);
|
|
87
|
+
this._ownerMark = ctx.createId("owner");
|
|
88
|
+
ctx.get(TElementPlugin)?.events.on("ready", (element) => {
|
|
89
|
+
this._element = element;
|
|
90
|
+
this._sync();
|
|
91
|
+
});
|
|
92
|
+
ctx.get(TElementPlugin)?.events.on("removed", () => {
|
|
93
|
+
this._element = null;
|
|
94
|
+
this._sync();
|
|
95
|
+
});
|
|
96
|
+
this._enabled = options?.enabled ?? this._enabled;
|
|
97
|
+
this._focusOutside = options?.focusOutside ?? this._focusOutside;
|
|
98
|
+
this._open = bindOverlayOpen(ctx, options, (open) => {
|
|
99
|
+
this.enabled = open;
|
|
100
|
+
});
|
|
101
|
+
if (this._open) this.enabled = this._open.read();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Сообщает о нажатии или фокусе мимо, потом закрывает владельца.
|
|
105
|
+
*
|
|
106
|
+
* Закрывает здесь, после подписчиков `dismiss`, а не первым подписчиком:
|
|
107
|
+
* иначе остальные узнавали бы о нажатии мимо уже закрытыми и не отличали
|
|
108
|
+
* бы его от закрытия по другой причине.
|
|
109
|
+
*
|
|
110
|
+
* Закрывает с причиной `outside`: владелец, который принимает запрос
|
|
111
|
+
* закрытия (модальное окно), решает сам — закрыться, отклонить нажатие
|
|
112
|
+
* мимо или отдать решение подписчику. `dismiss` при этом уже пришёл:
|
|
113
|
+
* нажатие мимо было, закроется окно или нет.
|
|
114
|
+
*/
|
|
115
|
+
_dismiss(event) {
|
|
116
|
+
this.events.emit("dismiss", event);
|
|
117
|
+
this._open?.close("outside");
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Следит ли плагин за нажатиями (с `focusOutside` — и за фокусом).
|
|
121
|
+
* Владелец включает его на открытии.
|
|
122
|
+
*/
|
|
123
|
+
get enabled() {
|
|
124
|
+
return this._enabled;
|
|
125
|
+
}
|
|
126
|
+
set enabled(value) {
|
|
127
|
+
const oldEnabled = this.enabled;
|
|
128
|
+
if (this._enabled === value) return;
|
|
129
|
+
this._enabled = value;
|
|
130
|
+
this._sync();
|
|
131
|
+
this.events.emit("change:enabled", {
|
|
132
|
+
newValue: value,
|
|
133
|
+
oldValue: oldEnabled
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Атрибут для панели владельца. Разметка раскладывает его спредом на
|
|
138
|
+
* телепортированный узел, иначе нажатие внутри панели будет считаться
|
|
139
|
+
* нажатием мимо.
|
|
140
|
+
*/
|
|
141
|
+
get ownerAttribute() {
|
|
142
|
+
return { [OWNER_ATTRIBUTE]: this._ownerMark };
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Панель владельца — узел с его `ownerAttribute` в документе корня. `null`,
|
|
146
|
+
* пока корень не объявлен или панели в документе нет.
|
|
147
|
+
*
|
|
148
|
+
* Панель телепортирована, и ссылки на неё у плагинов нет: разметка отдаёт
|
|
149
|
+
* им только корень. Поэтому её находят по той же пометке, по которой
|
|
150
|
+
* плагин отличает нажатие в неё. Нужна и соседям по набору: плагин фокуса
|
|
151
|
+
* Popover уводит фокус в панель и слушает на ней клавиши.
|
|
152
|
+
*/
|
|
153
|
+
findPanel() {
|
|
154
|
+
return this._element?.ownerDocument.querySelector(this._panelSelector) ?? null;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Пришлось ли нажатие или фокус внутрь владельца, его панели или слоя выше
|
|
158
|
+
* неё — панели, открытой поверх своей (см. шапку). Правило слоёв общее с
|
|
159
|
+
* `THideOutsidePlugin`, поэтому живёт в утилитах (`isAboveLayer`).
|
|
160
|
+
*
|
|
161
|
+
* Нужно и соседям по набору: возврат поля Select на уходе фокуса решает
|
|
162
|
+
* по тем же границам.
|
|
163
|
+
*/
|
|
164
|
+
isInside(target) {
|
|
165
|
+
if (!(target instanceof Element)) return false;
|
|
166
|
+
if (this._element?.contains(target)) return true;
|
|
167
|
+
if (target.closest(this._panelSelector)) return true;
|
|
168
|
+
return isAboveLayer(target, this.findPanel());
|
|
169
|
+
}
|
|
170
|
+
destroy() {
|
|
171
|
+
this._enabled = false;
|
|
172
|
+
this._sync();
|
|
173
|
+
this._open?.unbind();
|
|
174
|
+
this._open = null;
|
|
175
|
+
this._element = null;
|
|
176
|
+
super.destroy();
|
|
177
|
+
}
|
|
178
|
+
/** Селектор панели владельца — по её пометке. */
|
|
179
|
+
get _panelSelector() {
|
|
180
|
+
return `[${OWNER_ATTRIBUTE}="${this._ownerMark}"]`;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Мышь решает на нажатии, касание и перо ждут (см. шапку).
|
|
184
|
+
*
|
|
185
|
+
* Ожидание одно — для последнего опущенного нажатия, поэтому любое нажатие
|
|
186
|
+
* (мышью, пальцем или пером, внутрь или мимо) сначала снимает прежнее.
|
|
187
|
+
* Иначе панель, с которой уже работают, закрыло бы отпускание пальца,
|
|
188
|
+
* лёгшего мимо раньше, или `mousedown` мыши, нажатой внутрь, пока перо
|
|
189
|
+
* лежит мимо: он засчитался бы за перо.
|
|
190
|
+
*/
|
|
191
|
+
_onPointerDown = (event) => {
|
|
192
|
+
this._pending = null;
|
|
193
|
+
if (event.pointerType === "touch") {
|
|
194
|
+
this._startTouch(event);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (event.pointerType === "pen") {
|
|
198
|
+
this._startPen(event);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (this.isInside(event.target)) return;
|
|
202
|
+
this._dismiss(event);
|
|
203
|
+
};
|
|
204
|
+
/** Касание ничего не закрывает — только запоминается, если пришлось мимо. */
|
|
205
|
+
_startTouch(event) {
|
|
206
|
+
if (this.isInside(event.target)) return;
|
|
207
|
+
this._pending = {
|
|
208
|
+
pointerId: event.pointerId,
|
|
209
|
+
pointerType: "touch"
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Перо тоже только запоминается, если пришлось мимо. Решит его то, что
|
|
214
|
+
* придёт первым: `pointerup` (стилус на экране) или совместимый `mousedown`
|
|
215
|
+
* (перо графического планшета).
|
|
216
|
+
*/
|
|
217
|
+
_startPen(event) {
|
|
218
|
+
if (this.isInside(event.target)) return;
|
|
219
|
+
this._pending = {
|
|
220
|
+
pointerId: event.pointerId,
|
|
221
|
+
pointerType: "pen"
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Касание или перо мимо отпустили, не начав прокрутку, — это и есть нажатие
|
|
226
|
+
* мимо. Перо, которое уже решил его `mousedown`, ожидания не оставляет, и
|
|
227
|
+
* отпускание его не повторяет.
|
|
228
|
+
*/
|
|
229
|
+
_onPointerUp = (event) => {
|
|
230
|
+
if (event.pointerId !== this._pending?.pointerId) return;
|
|
231
|
+
this._pending = null;
|
|
232
|
+
this._dismiss(event);
|
|
233
|
+
};
|
|
234
|
+
/** Браузер забрал касание или перо под прокрутку или жест — закрывать нечего. */
|
|
235
|
+
_onPointerCancel = (event) => {
|
|
236
|
+
if (event.pointerId !== this._pending?.pointerId) return;
|
|
237
|
+
this._pending = null;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Совместимый `mousedown` решает перо, если пришёл раньше его `pointerup`:
|
|
241
|
+
* так ведёт себя перо планшета, и панель закрывается до смены фокуса.
|
|
242
|
+
*
|
|
243
|
+
* Касание он не решает: прослойки, которые шлют `mousedown` на
|
|
244
|
+
* `touchstart`, вернули бы закрытие в начале прокрутки. Мышь к нему уже
|
|
245
|
+
* решена своим `pointerdown` и ожидания не оставляет. Переносить её сюда
|
|
246
|
+
* нельзя: страница, отменившая `pointerdown` (так делают drag-библиотеки),
|
|
247
|
+
* совместимого `mousedown` не получает.
|
|
248
|
+
*/
|
|
249
|
+
_onMouseDown = (event) => {
|
|
250
|
+
if (this._pending?.pointerType !== "pen") return;
|
|
251
|
+
this._pending = null;
|
|
252
|
+
this._dismiss(event);
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Фокус ушёл мимо — с `focusOutside`. Слушатель на документе, в фазе
|
|
256
|
+
* перехвата, как у нажатий: `focusin` всплывает, и остановить его до
|
|
257
|
+
* документа содержимое не может.
|
|
258
|
+
*/
|
|
259
|
+
_onFocusIn = (event) => {
|
|
260
|
+
if (this.isInside(event.target)) return;
|
|
261
|
+
this._dismiss(event);
|
|
262
|
+
};
|
|
263
|
+
/** Слушатели на документе живут, только пока они нужны. */
|
|
264
|
+
_sync() {
|
|
265
|
+
const shouldListen = this._enabled && !!this._element;
|
|
266
|
+
if (shouldListen === this._listening) return;
|
|
267
|
+
const doc = this._element?.ownerDocument ?? globalThis.document;
|
|
268
|
+
if (!doc) return;
|
|
269
|
+
if (shouldListen) {
|
|
270
|
+
doc.addEventListener("pointerdown", this._onPointerDown, true);
|
|
271
|
+
doc.addEventListener("pointerup", this._onPointerUp, true);
|
|
272
|
+
doc.addEventListener("pointercancel", this._onPointerCancel, true);
|
|
273
|
+
doc.addEventListener("mousedown", this._onMouseDown, true);
|
|
274
|
+
if (this._focusOutside) doc.addEventListener("focusin", this._onFocusIn, true);
|
|
275
|
+
} else {
|
|
276
|
+
doc.removeEventListener("pointerdown", this._onPointerDown, true);
|
|
277
|
+
doc.removeEventListener("pointerup", this._onPointerUp, true);
|
|
278
|
+
doc.removeEventListener("pointercancel", this._onPointerCancel, true);
|
|
279
|
+
doc.removeEventListener("mousedown", this._onMouseDown, true);
|
|
280
|
+
doc.removeEventListener("focusin", this._onFocusIn, true);
|
|
281
|
+
this._pending = null;
|
|
282
|
+
}
|
|
283
|
+
this._listening = shouldListen;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
//#endregion
|
|
287
|
+
export { TDismissPlugin };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { TValuePayload } from '@soxa-ui/core';
|
|
2
|
+
import type { TPluginEvents } from '../../base';
|
|
3
|
+
import type { IOverlayOpenOptions } from '../overlay/types';
|
|
4
|
+
export interface IDismissPluginOptions extends IOverlayOpenOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Слушать ли документ сразу после установки.
|
|
7
|
+
*
|
|
8
|
+
* Обычно этого не задают: плагин сам следит за открытостью владельца
|
|
9
|
+
* (`property`) — пока она `false`, глобального слушателя нет, а нажатие
|
|
10
|
+
* мимо ставит её в `false`. Вручную слежение ведут через `enabled` при
|
|
11
|
+
* `property: null`.
|
|
12
|
+
*/
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Закрывать ли и уходом фокуса: `focusin` вне владельца, его панели и
|
|
16
|
+
* слоёв выше неё даёт `dismiss`, как нажатие мимо. По умолчанию выключено.
|
|
17
|
+
*
|
|
18
|
+
* Нужно тому, в чью панель уходит фокус (Popover): фокус, ушедший из
|
|
19
|
+
* панели на страницу — Tab, программный `focus()`, — иначе оставлял бы её
|
|
20
|
+
* открытой над тем, с чем пользователь уже работает. Select не включает:
|
|
21
|
+
* фокус у него не покидает поле, а уход с поля он обрабатывает сам.
|
|
22
|
+
*/
|
|
23
|
+
focusOutside?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Нажатие мимо, которое ждёт решения. Касание решает `pointerup` того же
|
|
27
|
+
* `pointerId`, перо — он же или совместимый `mousedown`, смотря что придёт
|
|
28
|
+
* первым.
|
|
29
|
+
*/
|
|
30
|
+
export type TDismissPendingPress = {
|
|
31
|
+
pointerId: number;
|
|
32
|
+
pointerType: 'touch' | 'pen';
|
|
33
|
+
};
|
|
34
|
+
export type TDismissPluginEvents = TPluginEvents & {
|
|
35
|
+
/**
|
|
36
|
+
* Нажатие пришлось мимо владельца и его панелей. Приходит событие, которое
|
|
37
|
+
* это решило: у мыши — `pointerdown`; у касания — `pointerup`, прокрутка
|
|
38
|
+
* пальцем не закрывает; у пера — то, что пришло первым: `pointerup`
|
|
39
|
+
* (стилус на экране) или совместимый `mousedown` (перо графического
|
|
40
|
+
* планшета). Отсюда `MouseEvent`: `PointerEvent` — его подтип. С
|
|
41
|
+
* `focusOutside` — ещё и `focusin` фокуса, ушедшего мимо: `FocusEvent`.
|
|
42
|
+
*
|
|
43
|
+
* Приходит до закрытия владельца: подписчик застаёт его открытым и знает
|
|
44
|
+
* причину закрытия (плагин фокуса Popover по ней не возвращает фокус).
|
|
45
|
+
*/
|
|
46
|
+
dismiss: (event: MouseEvent | FocusEvent) => void;
|
|
47
|
+
/** change:enabled */
|
|
48
|
+
'change:enabled': (payload: TValuePayload<boolean>) => void;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Пропсы плагина такими, какими их объявляет contribution — без неймспейса.
|
|
52
|
+
*
|
|
53
|
+
* Неймспейс (`dismiss_enabled`) навешивает `DescriptorAllProps` в `@soxa-ui/setup`
|
|
54
|
+
* по `namespace` из `definePlugin`; здесь только собственные имена пропсов.
|
|
55
|
+
* Защищённого `ownerAttribute` здесь нет: это выход, в разметку его не пишут.
|
|
56
|
+
*/
|
|
57
|
+
export interface IDismissPluginProps {
|
|
58
|
+
enabled?: boolean;
|
|
59
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { IDragAndDrop, TCollectionEngine } from '@soxa-ui/core';
|
|
2
|
+
import { TBasePlugin } from '../../base';
|
|
3
|
+
import type { IPluginContext } from '../../base';
|
|
4
|
+
import type { TDragPluginEvents } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* TDragPlugin — жест перестановки элементов коллекции: нативное
|
|
7
|
+
* перетаскивание DOM в команду обёртки `DragAndDrop`.
|
|
8
|
+
*
|
|
9
|
+
* Слушает `dragstart`, `dragover`, `drop` и `dragend` на корневом DOM-элементе
|
|
10
|
+
* компонента. Переставляет не плагин: на каждый `dragover` над другим
|
|
11
|
+
* элементом он зовёт команду обёртки (`IDragAndDrop.move`), а та шлёт свои
|
|
12
|
+
* события и переставляет элемент в движке. Место взятого плагин не помнит —
|
|
13
|
+
* оно в составе коллекции: отменённую перестановку и место, подменённое хуком
|
|
14
|
+
* движка, он не пересчитывает сам. Перестановка живая — элемент встаёт на
|
|
15
|
+
* место под указателем по ходу жеста.
|
|
16
|
+
*
|
|
17
|
+
* - **Взять** можно то, что разрешает обёртка (`IDragAndDrop.canMove`):
|
|
18
|
+
* `dragstart` выключенного элемента отменён, и жеста нет вовсе.
|
|
19
|
+
* - **Место спрашивается, когда указатель пришёл на другой элемент**, а не на
|
|
20
|
+
* каждый `dragover`: он идёт непрерывно, пока указатель стоит, и отменённое
|
|
21
|
+
* место иначе переспрашивалось бы без конца.
|
|
22
|
+
* - **Принимает плагин только свой жест**: `dragover` и `drop` чужого
|
|
23
|
+
* перетаскивания — файла, текста — идут как без него, и курсора
|
|
24
|
+
* «переместить» над списком у них нет. Свой `drop` — без действия браузера
|
|
25
|
+
* по умолчанию: перестановка уже сделана.
|
|
26
|
+
* - **Пальцем элемент берёт долгое нажатие** (`LONG_PRESS`), событиями
|
|
27
|
+
* указателя: нативного перетаскивания у касания на телефонах нет или оно
|
|
28
|
+
* спорит с прокруткой. Палец, ушедший за порог (`TOUCH_SLOP`) раньше, —
|
|
29
|
+
* прокрутка. Взятый несут — `touchmove` отменён, и страница стоит; узел
|
|
30
|
+
* под пальцем — точкой документа. Пока палец держит элемент, меню и
|
|
31
|
+
* выделение долгого нажатия и нативный `dragstart` отменены. Шаги жеста —
|
|
32
|
+
* взять, прийти на элемент, кончить — у мыши и пальца общие.
|
|
33
|
+
*
|
|
34
|
+
* Зависит от плагинов, которые должны присутствовать в том же бандле:
|
|
35
|
+
* - {@link TElementPlugin} — корневой DOM-элемент компонента;
|
|
36
|
+
* - {@link TCollectionElements} — доступ к DOM-элементам элементов коллекции;
|
|
37
|
+
* - {@link TCollectionBundlesPlugin} — реестр bundles (для отслеживания новых элементов).
|
|
38
|
+
*
|
|
39
|
+
* Коллекцию и обёртку передаёт {@link activate} (вызывает adapter-слой).
|
|
40
|
+
*
|
|
41
|
+
* @fires drag:start — свой жест начался, передаёт `{ index, uid }` взятого элемента.
|
|
42
|
+
* @fires drag:end — свой жест кончился.
|
|
43
|
+
*/
|
|
44
|
+
export declare class TDragPlugin extends TBasePlugin<any, TDragPluginEvents> {
|
|
45
|
+
/** CSS-класс визуального состояния перетаскиваемого элемента. */
|
|
46
|
+
private static readonly DRAGGING_CLASS;
|
|
47
|
+
/**
|
|
48
|
+
* Долгое нажатие пальцем, после которого элемент взят, мс. Около таймаута
|
|
49
|
+
* долгого нажатия у Android: раньше палец, который начал прокрутку, не
|
|
50
|
+
* успевает уйти за порог, позже — нажатие кажется зависшим.
|
|
51
|
+
*/
|
|
52
|
+
private static readonly LONG_PRESS;
|
|
53
|
+
/** Сдвиг пальца до долгого нажатия, за которым касание — прокрутка, px. */
|
|
54
|
+
private static readonly TOUCH_SLOP;
|
|
55
|
+
/** Коллекция, элементы которой переставляют; `null` — перетаскивание не включено. */
|
|
56
|
+
private _engine;
|
|
57
|
+
/** Обёртка, командой которой коллекция переставляется. */
|
|
58
|
+
private _dragAndDrop;
|
|
59
|
+
/** Корневой DOM-элемент, на котором висят обработчики drag-событий. */
|
|
60
|
+
private _element;
|
|
61
|
+
/** Ссылка на плагин, предоставляющий корневой DOM-элемент. */
|
|
62
|
+
private _elementPlugin;
|
|
63
|
+
/** Ссылка на плагин доступа к DOM-элементам элементов коллекции. */
|
|
64
|
+
private _collectionElements;
|
|
65
|
+
/** Ссылка на реестр bundles (для отслеживания новых элементов коллекции). */
|
|
66
|
+
private _bundles;
|
|
67
|
+
/** Функция очистки: снимает слушателей событий и атрибуты draggable. */
|
|
68
|
+
private _cleanup;
|
|
69
|
+
install(ctx: IPluginContext): void;
|
|
70
|
+
/**
|
|
71
|
+
* Включает перетаскивание элементов коллекции командой обёртки.
|
|
72
|
+
* Если DOM-элемент уже готов, немедленно навешивает обработчики; включённое
|
|
73
|
+
* раньше — с другой коллекцией или обёрткой — снимается.
|
|
74
|
+
*/
|
|
75
|
+
activate(engine: TCollectionEngine<any, any>, dragAndDrop: IDragAndDrop): void;
|
|
76
|
+
/**
|
|
77
|
+
* Деактивирует перетаскивание: снимает обработчики и сбрасывает состояние.
|
|
78
|
+
*/
|
|
79
|
+
deactivate(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Навешивает нативные drag-обработчики на корневой DOM-элемент и помечает
|
|
82
|
+
* каждый DOM-узел элемента коллекции атрибутом `draggable="true"`.
|
|
83
|
+
*/
|
|
84
|
+
private _setup;
|
|
85
|
+
private _teardown;
|
|
86
|
+
destroy(): void;
|
|
87
|
+
}
|