@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,95 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TElementPlugin } from "../../element/element.plugin.js";
|
|
3
|
+
import { TMenuKeyboardPlugin } from "../keyboard/keyboard.plugin.js";
|
|
4
|
+
import { TMenuPressStrategy } from "./strategies/press.strategy.js";
|
|
5
|
+
import { TMenuContextStrategy } from "./strategies/context.strategy.js";
|
|
6
|
+
//#region src/custom/menu/pointer/pointer.plugin.ts
|
|
7
|
+
/** Стратегия открытия на каждый способ: способ выбирает класс, а не ветку в обработчике. */
|
|
8
|
+
var OPEN_STRATEGIES = {
|
|
9
|
+
press: TMenuPressStrategy,
|
|
10
|
+
contextmenu: TMenuContextStrategy
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* TMenuPointerPlugin — открытие меню указателем.
|
|
14
|
+
*
|
|
15
|
+
* Открытие — стратегия по способу владельца (`openOn`, `strategies/`): у
|
|
16
|
+
* кнопки (`TMenuPressStrategy`) клик по корню переключает меню, у
|
|
17
|
+
* контекстного меню (`TMenuContextStrategy`) `contextmenu` и долгое касание
|
|
18
|
+
* над областью вызывают его у точки вызова (`point` владельца). Стратегию
|
|
19
|
+
* выбирает подписка на `change:openOn`, а не проверка в обработчике, и
|
|
20
|
+
* слушатели корня у каждого способа свои. Вызванное клавишей контекстное
|
|
21
|
+
* меню открывается на первом пункте — через клавиатуру меню, как кнопка с
|
|
22
|
+
* клавиатуры.
|
|
23
|
+
*
|
|
24
|
+
* Указатель в открытой панели — подсветка пунктов и подменю — у
|
|
25
|
+
* `TMenuHoverPlugin`: он общий у меню и подменю, а способ открытия есть
|
|
26
|
+
* только у меню.
|
|
27
|
+
*/
|
|
28
|
+
var TMenuPointerPlugin = class extends TBasePlugin {
|
|
29
|
+
_owner = null;
|
|
30
|
+
_keyboard = null;
|
|
31
|
+
/** Корень — под стратегию открытия. */
|
|
32
|
+
_root = null;
|
|
33
|
+
/** Способ открытия на корне — по `openOn` владельца. */
|
|
34
|
+
_strategy = null;
|
|
35
|
+
install(ctx) {
|
|
36
|
+
super.install(ctx);
|
|
37
|
+
this._owner = ctx.getInstance() ?? null;
|
|
38
|
+
this._keyboard = ctx.get(TMenuKeyboardPlugin) ?? null;
|
|
39
|
+
const elementPlugin = ctx.get(TElementPlugin);
|
|
40
|
+
elementPlugin?.events.on("ready", (element) => {
|
|
41
|
+
this._root = element;
|
|
42
|
+
this._syncStrategy();
|
|
43
|
+
});
|
|
44
|
+
elementPlugin?.events.on("removed", () => {
|
|
45
|
+
this._root = null;
|
|
46
|
+
this._syncStrategy();
|
|
47
|
+
});
|
|
48
|
+
this._listenTo(this._owner?.events, "change:openOn", () => this._syncStrategy());
|
|
49
|
+
}
|
|
50
|
+
destroy() {
|
|
51
|
+
this._strategy?.destroy();
|
|
52
|
+
this._strategy = null;
|
|
53
|
+
this._root = null;
|
|
54
|
+
this._owner = null;
|
|
55
|
+
this._keyboard = null;
|
|
56
|
+
super.destroy();
|
|
57
|
+
}
|
|
58
|
+
/** Открыто ли меню — для стратегий открытия. */
|
|
59
|
+
get isOpen() {
|
|
60
|
+
return this._owner?.open ?? false;
|
|
61
|
+
}
|
|
62
|
+
/** Переключить меню — нажатие кнопки. */
|
|
63
|
+
toggle() {
|
|
64
|
+
const owner = this._owner;
|
|
65
|
+
if (owner) owner.open = !owner.open;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Вызвать меню у точки окна, открытое — переставить к ней: точку отдаёт
|
|
69
|
+
* якорю панели разметка. Вызвали клавишей — меню открывается на первом
|
|
70
|
+
* пункте, как кнопка с клавиатуры, указателем — фокус на панели.
|
|
71
|
+
*/
|
|
72
|
+
invoke(point, byKeyboard) {
|
|
73
|
+
const owner = this._owner;
|
|
74
|
+
if (!owner) return;
|
|
75
|
+
owner.point = point;
|
|
76
|
+
if (byKeyboard && this._keyboard) this._keyboard.openAt("first");
|
|
77
|
+
else owner.open = true;
|
|
78
|
+
}
|
|
79
|
+
/** Закрыть меню. */
|
|
80
|
+
close() {
|
|
81
|
+
const owner = this._owner;
|
|
82
|
+
if (owner) owner.open = false;
|
|
83
|
+
}
|
|
84
|
+
/** Стратегия открытия — по способу владельца, на объявленном корне. */
|
|
85
|
+
_syncStrategy() {
|
|
86
|
+
this._strategy?.destroy();
|
|
87
|
+
this._strategy = null;
|
|
88
|
+
const root = this._root;
|
|
89
|
+
const owner = this._owner;
|
|
90
|
+
if (!root || !owner) return;
|
|
91
|
+
this._strategy = new OPEN_STRATEGIES[owner.openOn](root, this);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { TMenuPointerPlugin };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { IMenuOpenHost, IMenuOpenStrategy } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* TMenuContextStrategy — контекстное меню области (`openOn: 'contextmenu'`):
|
|
4
|
+
* панель встаёт у точки вызова.
|
|
5
|
+
*
|
|
6
|
+
* **Вызов — `contextmenu` на корне.** Его шлёт браузер на правую кнопку мыши,
|
|
7
|
+
* на долгое касание (Android) и с клавиатуры — на клавишу контекстного меню и
|
|
8
|
+
* Shift+F10 элементу под фокусом, с точкой у него. `preventDefault` убирает
|
|
9
|
+
* системное меню, и `contextmenu`, уже погашенное (вложенное контекстное
|
|
10
|
+
* меню вызвали раньше), не трогается: вызов один. Вызов у открытого меню
|
|
11
|
+
* переставляет панель к новой точке, а не закрывает и открывает её заново.
|
|
12
|
+
*
|
|
13
|
+
* **Чем вызвали**, плагин узнаёт по нажатию в области: перед `contextmenu`
|
|
14
|
+
* указателя было `pointerdown`, клавиатуры — `keydown`. Вызов клавишей
|
|
15
|
+
* открывает меню на первом пункте, как кнопку с клавиатуры, указателем —
|
|
16
|
+
* фокус на панели. Своего признака в событии нет: у вызова с клавиатуры
|
|
17
|
+
* Chromium отдаёт `pointerType` мыши. Нажатия в области не было вовсе
|
|
18
|
+
* (меню вызвала ассистивная технология) — вызов клавишей.
|
|
19
|
+
*
|
|
20
|
+
* **Долгое касание** — свой таймер только там, где браузер `contextmenu` на
|
|
21
|
+
* него не шлёт: на сенсорных устройствах Apple (`isAppleTouch`). Палец или
|
|
22
|
+
* перо, ушедшие дальше порога, — прокрутка, и вызова нет; второй палец —
|
|
23
|
+
* масштаб, тоже. Браузер, приславший `contextmenu` раньше таймера, таймер
|
|
24
|
+
* снимает: вызов один. Системное меню долгого касания там — выноска над
|
|
25
|
+
* ссылкой и картинкой, и `preventDefault` её не убирает: её снимает
|
|
26
|
+
* `-webkit-touch-callout: none` на корне, пока стратегия стоит, а потом
|
|
27
|
+
* возвращается прежнее инлайновое значение. Ставит его стратегия, а не тема:
|
|
28
|
+
* без него не работает поведение, а не вид, — как `touch-action` у
|
|
29
|
+
* `TSwipePlugin`.
|
|
30
|
+
*
|
|
31
|
+
* **Нажатие в области мимо вызова закрывает меню**: область — не кнопка, и
|
|
32
|
+
* нажатие на неё — то же, что нажатие мимо. Мышь — на `pointerdown`, как у
|
|
33
|
+
* `TDismissPlugin`, кроме второй кнопки: за ней придёт `contextmenu`, и
|
|
34
|
+
* панель переедет. Палец и перо — на `pointerup` того же нажатия: с нажатия
|
|
35
|
+
* начинается и прокрутка, и долгое касание, которое меню переставит.
|
|
36
|
+
* `TDismissPlugin` эти нажатия мимо не считает: корень — внутри владельца,
|
|
37
|
+
* — поэтому решает их стратегия, знающая, где вызов.
|
|
38
|
+
*/
|
|
39
|
+
export declare class TMenuContextStrategy implements IMenuOpenStrategy {
|
|
40
|
+
/** Узел нужен под слушатели и под документ, чьё устройство спрашиваем. */
|
|
41
|
+
private readonly _root;
|
|
42
|
+
private readonly _host;
|
|
43
|
+
/** Долгое касание — своё: браузер `contextmenu` на него не шлёт. */
|
|
44
|
+
private readonly _longPress;
|
|
45
|
+
/** Последнее нажатие в области — клавиша, а не указатель. */
|
|
46
|
+
private _byKeyboard;
|
|
47
|
+
/** Нажатие пальцем или пером, которое ещё решается. */
|
|
48
|
+
private _press;
|
|
49
|
+
/** Инлайновая выноска корня до стратегии; `null` — стратегия её не трогала. */
|
|
50
|
+
private _callout;
|
|
51
|
+
constructor(root: Element, host: IMenuOpenHost);
|
|
52
|
+
destroy(): void;
|
|
53
|
+
/** Вернуть корню инлайновую выноску, что была до стратегии: пустая — снять свойство. */
|
|
54
|
+
private _restoreCallout;
|
|
55
|
+
private readonly _onContextMenu;
|
|
56
|
+
private readonly _onKeyDown;
|
|
57
|
+
private readonly _onPointerDown;
|
|
58
|
+
/** Палец ушёл дальше порога — это прокрутка: ни вызова, ни закрытия. */
|
|
59
|
+
private readonly _onPointerMove;
|
|
60
|
+
/** Отпустили, не вызвав меню, — нажатие в области у открытого меню закрывает его. */
|
|
61
|
+
private readonly _onPointerUp;
|
|
62
|
+
/** Браузер забрал касание под прокрутку или жест — решать нечего. */
|
|
63
|
+
private readonly _onPointerCancel;
|
|
64
|
+
/** Палец продержали — вызов у точки нажатия. */
|
|
65
|
+
private readonly _onLongPress;
|
|
66
|
+
/** Нажатие стало вызовом: таймер снят, отпускание меню не закроет. */
|
|
67
|
+
private _settlePress;
|
|
68
|
+
/** Нажатия больше нет: таймер снят. */
|
|
69
|
+
private _dropPress;
|
|
70
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { isMeasurableElement } from "../../../../utils/isMeasurableElement.js";
|
|
2
|
+
import { isAppleTouch } from "../../../../utils/isAppleTouch.js";
|
|
3
|
+
//#region src/custom/menu/pointer/strategies/context.strategy.ts
|
|
4
|
+
/** Сколько держать палец, чтобы вызвать контекстное меню, мс, — как у системы. */
|
|
5
|
+
var LONG_PRESS_DELAY = 500;
|
|
6
|
+
/** Насколько палец уходит, пока его держат, px: дальше — уже прокрутка, а не вызов. */
|
|
7
|
+
var LONG_PRESS_SLOP = 10;
|
|
8
|
+
/** Вторая кнопка мыши и кнопка пера: её нажатие вызывает контекстное меню. */
|
|
9
|
+
var SECONDARY_BUTTON = 2;
|
|
10
|
+
/** Системная выноска iOS на долгое касание — ссылки, картинки: её место занимает меню. */
|
|
11
|
+
var CALLOUT = "-webkit-touch-callout";
|
|
12
|
+
/**
|
|
13
|
+
* TMenuContextStrategy — контекстное меню области (`openOn: 'contextmenu'`):
|
|
14
|
+
* панель встаёт у точки вызова.
|
|
15
|
+
*
|
|
16
|
+
* **Вызов — `contextmenu` на корне.** Его шлёт браузер на правую кнопку мыши,
|
|
17
|
+
* на долгое касание (Android) и с клавиатуры — на клавишу контекстного меню и
|
|
18
|
+
* Shift+F10 элементу под фокусом, с точкой у него. `preventDefault` убирает
|
|
19
|
+
* системное меню, и `contextmenu`, уже погашенное (вложенное контекстное
|
|
20
|
+
* меню вызвали раньше), не трогается: вызов один. Вызов у открытого меню
|
|
21
|
+
* переставляет панель к новой точке, а не закрывает и открывает её заново.
|
|
22
|
+
*
|
|
23
|
+
* **Чем вызвали**, плагин узнаёт по нажатию в области: перед `contextmenu`
|
|
24
|
+
* указателя было `pointerdown`, клавиатуры — `keydown`. Вызов клавишей
|
|
25
|
+
* открывает меню на первом пункте, как кнопку с клавиатуры, указателем —
|
|
26
|
+
* фокус на панели. Своего признака в событии нет: у вызова с клавиатуры
|
|
27
|
+
* Chromium отдаёт `pointerType` мыши. Нажатия в области не было вовсе
|
|
28
|
+
* (меню вызвала ассистивная технология) — вызов клавишей.
|
|
29
|
+
*
|
|
30
|
+
* **Долгое касание** — свой таймер только там, где браузер `contextmenu` на
|
|
31
|
+
* него не шлёт: на сенсорных устройствах Apple (`isAppleTouch`). Палец или
|
|
32
|
+
* перо, ушедшие дальше порога, — прокрутка, и вызова нет; второй палец —
|
|
33
|
+
* масштаб, тоже. Браузер, приславший `contextmenu` раньше таймера, таймер
|
|
34
|
+
* снимает: вызов один. Системное меню долгого касания там — выноска над
|
|
35
|
+
* ссылкой и картинкой, и `preventDefault` её не убирает: её снимает
|
|
36
|
+
* `-webkit-touch-callout: none` на корне, пока стратегия стоит, а потом
|
|
37
|
+
* возвращается прежнее инлайновое значение. Ставит его стратегия, а не тема:
|
|
38
|
+
* без него не работает поведение, а не вид, — как `touch-action` у
|
|
39
|
+
* `TSwipePlugin`.
|
|
40
|
+
*
|
|
41
|
+
* **Нажатие в области мимо вызова закрывает меню**: область — не кнопка, и
|
|
42
|
+
* нажатие на неё — то же, что нажатие мимо. Мышь — на `pointerdown`, как у
|
|
43
|
+
* `TDismissPlugin`, кроме второй кнопки: за ней придёт `contextmenu`, и
|
|
44
|
+
* панель переедет. Палец и перо — на `pointerup` того же нажатия: с нажатия
|
|
45
|
+
* начинается и прокрутка, и долгое касание, которое меню переставит.
|
|
46
|
+
* `TDismissPlugin` эти нажатия мимо не считает: корень — внутри владельца,
|
|
47
|
+
* — поэтому решает их стратегия, знающая, где вызов.
|
|
48
|
+
*/
|
|
49
|
+
var TMenuContextStrategy = class {
|
|
50
|
+
/** Узел нужен под слушатели и под документ, чьё устройство спрашиваем. */
|
|
51
|
+
_root;
|
|
52
|
+
_host;
|
|
53
|
+
/** Долгое касание — своё: браузер `contextmenu` на него не шлёт. */
|
|
54
|
+
_longPress;
|
|
55
|
+
/** Последнее нажатие в области — клавиша, а не указатель. */
|
|
56
|
+
_byKeyboard = true;
|
|
57
|
+
/** Нажатие пальцем или пером, которое ещё решается. */
|
|
58
|
+
_press = null;
|
|
59
|
+
/** Инлайновая выноска корня до стратегии; `null` — стратегия её не трогала. */
|
|
60
|
+
_callout = null;
|
|
61
|
+
constructor(root, host) {
|
|
62
|
+
this._root = root;
|
|
63
|
+
this._host = host;
|
|
64
|
+
this._longPress = isAppleTouch(root.ownerDocument.defaultView?.navigator);
|
|
65
|
+
if (this._longPress && isMeasurableElement(root)) {
|
|
66
|
+
this._callout = root.style.getPropertyValue(CALLOUT);
|
|
67
|
+
root.style.setProperty(CALLOUT, "none");
|
|
68
|
+
}
|
|
69
|
+
const target = root;
|
|
70
|
+
target.addEventListener("contextmenu", this._onContextMenu);
|
|
71
|
+
target.addEventListener("keydown", this._onKeyDown, true);
|
|
72
|
+
target.addEventListener("pointerdown", this._onPointerDown, true);
|
|
73
|
+
target.addEventListener("pointermove", this._onPointerMove);
|
|
74
|
+
target.addEventListener("pointerup", this._onPointerUp);
|
|
75
|
+
target.addEventListener("pointercancel", this._onPointerCancel);
|
|
76
|
+
}
|
|
77
|
+
destroy() {
|
|
78
|
+
this._dropPress();
|
|
79
|
+
this._restoreCallout();
|
|
80
|
+
const target = this._root;
|
|
81
|
+
target.removeEventListener("contextmenu", this._onContextMenu);
|
|
82
|
+
target.removeEventListener("keydown", this._onKeyDown, true);
|
|
83
|
+
target.removeEventListener("pointerdown", this._onPointerDown, true);
|
|
84
|
+
target.removeEventListener("pointermove", this._onPointerMove);
|
|
85
|
+
target.removeEventListener("pointerup", this._onPointerUp);
|
|
86
|
+
target.removeEventListener("pointercancel", this._onPointerCancel);
|
|
87
|
+
}
|
|
88
|
+
/** Вернуть корню инлайновую выноску, что была до стратегии: пустая — снять свойство. */
|
|
89
|
+
_restoreCallout() {
|
|
90
|
+
const root = this._root;
|
|
91
|
+
const callout = this._callout;
|
|
92
|
+
if (callout === null || !isMeasurableElement(root)) return;
|
|
93
|
+
this._callout = null;
|
|
94
|
+
if (callout === "") root.style.removeProperty(CALLOUT);
|
|
95
|
+
else root.style.setProperty(CALLOUT, callout);
|
|
96
|
+
}
|
|
97
|
+
_onContextMenu = (event) => {
|
|
98
|
+
if (event.defaultPrevented) return;
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
this._settlePress();
|
|
101
|
+
this._host.invoke({
|
|
102
|
+
x: event.clientX,
|
|
103
|
+
y: event.clientY
|
|
104
|
+
}, this._byKeyboard);
|
|
105
|
+
};
|
|
106
|
+
_onKeyDown = () => {
|
|
107
|
+
this._byKeyboard = true;
|
|
108
|
+
};
|
|
109
|
+
_onPointerDown = (event) => {
|
|
110
|
+
this._byKeyboard = false;
|
|
111
|
+
this._dropPress();
|
|
112
|
+
if (event.pointerType === "mouse") {
|
|
113
|
+
if (event.button !== SECONDARY_BUTTON && this._host.isOpen) this._host.close();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (!event.isPrimary) return;
|
|
117
|
+
const closes = this._host.isOpen && event.button !== SECONDARY_BUTTON;
|
|
118
|
+
if (!closes && !this._longPress) return;
|
|
119
|
+
this._press = {
|
|
120
|
+
pointerId: event.pointerId,
|
|
121
|
+
x: event.clientX,
|
|
122
|
+
y: event.clientY,
|
|
123
|
+
closes,
|
|
124
|
+
timer: this._longPress ? setTimeout(this._onLongPress, LONG_PRESS_DELAY) : null
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
/** Палец ушёл дальше порога — это прокрутка: ни вызова, ни закрытия. */
|
|
128
|
+
_onPointerMove = (event) => {
|
|
129
|
+
const press = this._press;
|
|
130
|
+
if (!press || event.pointerId !== press.pointerId) return;
|
|
131
|
+
if (Math.hypot(event.clientX - press.x, event.clientY - press.y) > LONG_PRESS_SLOP) this._dropPress();
|
|
132
|
+
};
|
|
133
|
+
/** Отпустили, не вызвав меню, — нажатие в области у открытого меню закрывает его. */
|
|
134
|
+
_onPointerUp = (event) => {
|
|
135
|
+
const press = this._press;
|
|
136
|
+
if (!press || event.pointerId !== press.pointerId) return;
|
|
137
|
+
this._dropPress();
|
|
138
|
+
if (press.closes && this._host.isOpen) this._host.close();
|
|
139
|
+
};
|
|
140
|
+
/** Браузер забрал касание под прокрутку или жест — решать нечего. */
|
|
141
|
+
_onPointerCancel = (event) => {
|
|
142
|
+
if (event.pointerId === this._press?.pointerId) this._dropPress();
|
|
143
|
+
};
|
|
144
|
+
/** Палец продержали — вызов у точки нажатия. */
|
|
145
|
+
_onLongPress = () => {
|
|
146
|
+
const press = this._press;
|
|
147
|
+
if (!press) return;
|
|
148
|
+
this._settlePress();
|
|
149
|
+
this._host.invoke({
|
|
150
|
+
x: press.x,
|
|
151
|
+
y: press.y
|
|
152
|
+
}, false);
|
|
153
|
+
};
|
|
154
|
+
/** Нажатие стало вызовом: таймер снят, отпускание меню не закроет. */
|
|
155
|
+
_settlePress() {
|
|
156
|
+
const press = this._press;
|
|
157
|
+
if (!press) return;
|
|
158
|
+
if (press.timer !== null) clearTimeout(press.timer);
|
|
159
|
+
press.timer = null;
|
|
160
|
+
press.closes = false;
|
|
161
|
+
}
|
|
162
|
+
/** Нажатия больше нет: таймер снят. */
|
|
163
|
+
_dropPress() {
|
|
164
|
+
const press = this._press;
|
|
165
|
+
if (press && press.timer !== null) clearTimeout(press.timer);
|
|
166
|
+
this._press = null;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
//#endregion
|
|
170
|
+
export { TMenuContextStrategy };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IMenuOpenHost, IMenuOpenStrategy } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* TMenuPressStrategy — меню у кнопки (`openOn: 'press'`): клик по корню
|
|
4
|
+
* переключает меню.
|
|
5
|
+
*
|
|
6
|
+
* В корне лежит только триггер (слот `trigger`), поэтому клик по корню — клик
|
|
7
|
+
* по триггеру, чем бы потребитель его ни нарисовал. Клик из Enter и пробела
|
|
8
|
+
* на `<button>` браузер делает сам, но до него не доходит: эти клавиши берёт
|
|
9
|
+
* клавиатура меню — открыть на первом пункте. По открытому триггеру клик
|
|
10
|
+
* закрывает меню без мигания: корень — внутри владельца, и `pointerdown`
|
|
11
|
+
* перед кликом `TDismissPlugin` мимо не считает.
|
|
12
|
+
*
|
|
13
|
+
* `contextmenu` над кнопкой не трогается: контекстного меню у неё нет, и
|
|
14
|
+
* браузер показывает своё.
|
|
15
|
+
*/
|
|
16
|
+
export declare class TMenuPressStrategy implements IMenuOpenStrategy {
|
|
17
|
+
/** Узел нужен только под слушатель — отсюда и тип. */
|
|
18
|
+
private readonly _root;
|
|
19
|
+
private readonly _host;
|
|
20
|
+
constructor(root: Element, host: IMenuOpenHost);
|
|
21
|
+
destroy(): void;
|
|
22
|
+
private readonly _onClick;
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/custom/menu/pointer/strategies/press.strategy.ts
|
|
2
|
+
/**
|
|
3
|
+
* TMenuPressStrategy — меню у кнопки (`openOn: 'press'`): клик по корню
|
|
4
|
+
* переключает меню.
|
|
5
|
+
*
|
|
6
|
+
* В корне лежит только триггер (слот `trigger`), поэтому клик по корню — клик
|
|
7
|
+
* по триггеру, чем бы потребитель его ни нарисовал. Клик из Enter и пробела
|
|
8
|
+
* на `<button>` браузер делает сам, но до него не доходит: эти клавиши берёт
|
|
9
|
+
* клавиатура меню — открыть на первом пункте. По открытому триггеру клик
|
|
10
|
+
* закрывает меню без мигания: корень — внутри владельца, и `pointerdown`
|
|
11
|
+
* перед кликом `TDismissPlugin` мимо не считает.
|
|
12
|
+
*
|
|
13
|
+
* `contextmenu` над кнопкой не трогается: контекстного меню у неё нет, и
|
|
14
|
+
* браузер показывает своё.
|
|
15
|
+
*/
|
|
16
|
+
var TMenuPressStrategy = class {
|
|
17
|
+
/** Узел нужен только под слушатель — отсюда и тип. */
|
|
18
|
+
_root;
|
|
19
|
+
_host;
|
|
20
|
+
constructor(root, host) {
|
|
21
|
+
this._root = root;
|
|
22
|
+
this._host = host;
|
|
23
|
+
this._root.addEventListener("click", this._onClick);
|
|
24
|
+
}
|
|
25
|
+
destroy() {
|
|
26
|
+
this._root.removeEventListener("click", this._onClick);
|
|
27
|
+
}
|
|
28
|
+
_onClick = () => {
|
|
29
|
+
this._host.toggle();
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { TMenuPressStrategy };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TMenuPoint } from '@soxa-ui/core';
|
|
2
|
+
/**
|
|
3
|
+
* Срез плагина открытия, который видят стратегии: что они делают с меню.
|
|
4
|
+
*
|
|
5
|
+
* Стратегия знает свои события на корне, а не меню и не соседние плагины:
|
|
6
|
+
* открывает, переставляет и закрывает она через плагин, и подсветку при
|
|
7
|
+
* открытии клавишей решает он.
|
|
8
|
+
*/
|
|
9
|
+
export interface IMenuOpenHost {
|
|
10
|
+
/** Открыто ли меню. */
|
|
11
|
+
readonly isOpen: boolean;
|
|
12
|
+
/** Переключить меню — нажатие кнопки. */
|
|
13
|
+
toggle(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Вызвать меню у точки окна, открытое — переставить к ней. Вызвали
|
|
16
|
+
* клавишей (`byKeyboard`) — подсвечен первый пункт, и фокус на нём, как у
|
|
17
|
+
* кнопки с клавиатуры; указателем — фокус на панели.
|
|
18
|
+
*/
|
|
19
|
+
invoke(point: TMenuPoint, byKeyboard: boolean): void;
|
|
20
|
+
/** Закрыть меню. */
|
|
21
|
+
close(): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Способ открытия меню на его корне — по стратегии на режим `openOn`. Живёт,
|
|
25
|
+
* пока не сменились режим или корень: слушатели ставит конструктор, снимает
|
|
26
|
+
* `destroy()`.
|
|
27
|
+
*/
|
|
28
|
+
export interface IMenuOpenStrategy {
|
|
29
|
+
/** Снять слушатели корня и отменить отложенное. */
|
|
30
|
+
destroy(): void;
|
|
31
|
+
}
|
|
32
|
+
/** Конструктор стратегии: плагин заводит её на корень по режиму владельца. */
|
|
33
|
+
export type TMenuOpenStrategyCtor = new (root: Element, host: IMenuOpenHost) => IMenuOpenStrategy;
|
|
34
|
+
/**
|
|
35
|
+
* Нажатие пальцем или пером в области контекстного меню, которое ещё не
|
|
36
|
+
* решено: долгое — вызов, короткое у открытого меню — закрытие, ушедшее
|
|
37
|
+
* дальше порога — прокрутка, и ни то ни другое.
|
|
38
|
+
*/
|
|
39
|
+
export type TMenuContextPress = {
|
|
40
|
+
/** `pointerId` нажатия: чужие указатели его не решают */
|
|
41
|
+
pointerId: number;
|
|
42
|
+
/** Точка нажатия в координатах окна — у неё встанет меню */
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
/** Короткое нажатие закроет меню: оно было открыто, и вызовом нажатие не стало */
|
|
46
|
+
closes: boolean;
|
|
47
|
+
/** Таймер долгого касания; `null` — не ждём: своего вызова нет или он был */
|
|
48
|
+
timer: ReturnType<typeof setTimeout> | null;
|
|
49
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { TPopoverFocusPlugin } from '../../popover/focus';
|
|
2
|
+
import type { TMenuPopoverItemFocusPluginEvents } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* TMenuPopoverItemFocusPlugin — модель фокуса пункта меню с панелью
|
|
5
|
+
* (`Menu.PopoverItem`): панель — немодальный диалог у строки пункта.
|
|
6
|
+
*
|
|
7
|
+
* Немодальная, как у Popover, и от него наследует всё общее: запомнить,
|
|
8
|
+
* откуда открыли, кадром позже увести фокус на первую остановку панели (её
|
|
9
|
+
* нет — на саму панель), вернуть его при закрытии, закрыться по Escape и не
|
|
10
|
+
* возвращать фокус после нажатия и фокуса мимо. Tab ходит по тем же
|
|
11
|
+
* правилам — будто панель стоит в документе сразу за триггером. Своё у пункта
|
|
12
|
+
* — четыре вещи:
|
|
13
|
+
*
|
|
14
|
+
* - **триггер — строка пункта.** Её открывают нажатием, клавишами и
|
|
15
|
+
* указателем, и фокус она держит сама (`tabindex="-1"` пишет коллекция), но
|
|
16
|
+
* остановки Tab у неё нет — у меню их нет вовсе. Поэтому остановки триггера
|
|
17
|
+
* здесь — сама строка: Tab с неё у открытой панели ведёт в панель,
|
|
18
|
+
* Shift+Tab с первой остановки панели — на неё, панель открыта, а Escape в
|
|
19
|
+
* панели возвращает фокус на неё;
|
|
20
|
+
* - **кто открыл.** Нажатие строки и клавиши ведут фокус в панель, а панель,
|
|
21
|
+
* открытая наведением, фокус не берёт: он остаётся на строке
|
|
22
|
+
* (`keepFocusOnRow`), и в панель его ведут нажатие в ней, Tab и стрелка к
|
|
23
|
+
* концу строки (`focusPanel`). Кто открыл, знает указатель меню
|
|
24
|
+
* (`TMenuHoverPlugin`), а не модель фокуса: она отдаёт две операции над
|
|
25
|
+
* текущим открытием и между открытиями ничего не помнит;
|
|
26
|
+
* - **Tab с последней остановки панели** закрывает все меню (APG) и ведёт к
|
|
27
|
+
* остановке за корнем меню. Корня меню пункт не знает, поэтому сообщает о
|
|
28
|
+
* Tab меню над собой (`tab`), а то — дальше, до корня (`TMenuFocusPlugin`),
|
|
29
|
+
* который закрывается и ведёт фокус, как Tab из своей панели. Фокус пункт
|
|
30
|
+
* после этого не возвращает: он уходит за меню;
|
|
31
|
+
* - **возвращать ли фокус.** Только пока фокус в пункте или нигде
|
|
32
|
+
* (`holdsFocus`): панель, закрытая вместе с меню, не тянет его на строку
|
|
33
|
+
* спрятанной панели — меню уже вернуло его на триггер.
|
|
34
|
+
*/
|
|
35
|
+
export declare class TMenuPopoverItemFocusPlugin extends TPopoverFocusPlugin<TMenuPopoverItemFocusPluginEvents> {
|
|
36
|
+
/**
|
|
37
|
+
* Фокус остаётся на строке — в этом открытии: кадр, которым он ушёл бы в
|
|
38
|
+
* панель, снят. Зовёт указатель меню, открывший панель наведением. Панель
|
|
39
|
+
* закрыта — ничего: следующее открытие поведёт фокус в панель, как обычно.
|
|
40
|
+
*/
|
|
41
|
+
keepFocusOnRow(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Фокус — в открытую панель сейчас: на первую остановку, без неё — на саму
|
|
44
|
+
* панель. Зовёт стрелка к концу строки на строке открытого пункта
|
|
45
|
+
* (`TMenuPopoverItemKeyboardPlugin`). Панель закрыта — ничего.
|
|
46
|
+
*/
|
|
47
|
+
focusPanel(): void;
|
|
48
|
+
/** Триггер — строка пункта: остановки Tab у неё нет, и среди остановок корня её не найти. */
|
|
49
|
+
protected _triggerStops(root: Element): Element[];
|
|
50
|
+
/** Tab из панели наружу — меню над пунктом: куда вести фокус, решает корень. */
|
|
51
|
+
protected _tabOutOfPanel(event: KeyboardEvent): void;
|
|
52
|
+
/** Возвращать фокус, только пока он в пункте или нигде. */
|
|
53
|
+
protected _returnsFocus(root: Element): boolean;
|
|
54
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { rowIn } from "../../list/row.js";
|
|
2
|
+
import { TPopoverFocusPlugin } from "../../popover/focus/focus.plugin.js";
|
|
3
|
+
import { holdsFocus } from "../nested-layer.js";
|
|
4
|
+
//#region src/custom/menu/popover-item-focus/focus.plugin.ts
|
|
5
|
+
/**
|
|
6
|
+
* TMenuPopoverItemFocusPlugin — модель фокуса пункта меню с панелью
|
|
7
|
+
* (`Menu.PopoverItem`): панель — немодальный диалог у строки пункта.
|
|
8
|
+
*
|
|
9
|
+
* Немодальная, как у Popover, и от него наследует всё общее: запомнить,
|
|
10
|
+
* откуда открыли, кадром позже увести фокус на первую остановку панели (её
|
|
11
|
+
* нет — на саму панель), вернуть его при закрытии, закрыться по Escape и не
|
|
12
|
+
* возвращать фокус после нажатия и фокуса мимо. Tab ходит по тем же
|
|
13
|
+
* правилам — будто панель стоит в документе сразу за триггером. Своё у пункта
|
|
14
|
+
* — четыре вещи:
|
|
15
|
+
*
|
|
16
|
+
* - **триггер — строка пункта.** Её открывают нажатием, клавишами и
|
|
17
|
+
* указателем, и фокус она держит сама (`tabindex="-1"` пишет коллекция), но
|
|
18
|
+
* остановки Tab у неё нет — у меню их нет вовсе. Поэтому остановки триггера
|
|
19
|
+
* здесь — сама строка: Tab с неё у открытой панели ведёт в панель,
|
|
20
|
+
* Shift+Tab с первой остановки панели — на неё, панель открыта, а Escape в
|
|
21
|
+
* панели возвращает фокус на неё;
|
|
22
|
+
* - **кто открыл.** Нажатие строки и клавиши ведут фокус в панель, а панель,
|
|
23
|
+
* открытая наведением, фокус не берёт: он остаётся на строке
|
|
24
|
+
* (`keepFocusOnRow`), и в панель его ведут нажатие в ней, Tab и стрелка к
|
|
25
|
+
* концу строки (`focusPanel`). Кто открыл, знает указатель меню
|
|
26
|
+
* (`TMenuHoverPlugin`), а не модель фокуса: она отдаёт две операции над
|
|
27
|
+
* текущим открытием и между открытиями ничего не помнит;
|
|
28
|
+
* - **Tab с последней остановки панели** закрывает все меню (APG) и ведёт к
|
|
29
|
+
* остановке за корнем меню. Корня меню пункт не знает, поэтому сообщает о
|
|
30
|
+
* Tab меню над собой (`tab`), а то — дальше, до корня (`TMenuFocusPlugin`),
|
|
31
|
+
* который закрывается и ведёт фокус, как Tab из своей панели. Фокус пункт
|
|
32
|
+
* после этого не возвращает: он уходит за меню;
|
|
33
|
+
* - **возвращать ли фокус.** Только пока фокус в пункте или нигде
|
|
34
|
+
* (`holdsFocus`): панель, закрытая вместе с меню, не тянет его на строку
|
|
35
|
+
* спрятанной панели — меню уже вернуло его на триггер.
|
|
36
|
+
*/
|
|
37
|
+
var TMenuPopoverItemFocusPlugin = class extends TPopoverFocusPlugin {
|
|
38
|
+
/**
|
|
39
|
+
* Фокус остаётся на строке — в этом открытии: кадр, которым он ушёл бы в
|
|
40
|
+
* панель, снят. Зовёт указатель меню, открывший панель наведением. Панель
|
|
41
|
+
* закрыта — ничего: следующее открытие поведёт фокус в панель, как обычно.
|
|
42
|
+
*/
|
|
43
|
+
keepFocusOnRow() {
|
|
44
|
+
this._cancelFocusFrame();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Фокус — в открытую панель сейчас: на первую остановку, без неё — на саму
|
|
48
|
+
* панель. Зовёт стрелка к концу строки на строке открытого пункта
|
|
49
|
+
* (`TMenuPopoverItemKeyboardPlugin`). Панель закрыта — ничего.
|
|
50
|
+
*/
|
|
51
|
+
focusPanel() {
|
|
52
|
+
this._focusPanel();
|
|
53
|
+
}
|
|
54
|
+
/** Триггер — строка пункта: остановки Tab у неё нет, и среди остановок корня её не найти. */
|
|
55
|
+
_triggerStops(root) {
|
|
56
|
+
const row = rowIn(root);
|
|
57
|
+
return row ? [row] : [];
|
|
58
|
+
}
|
|
59
|
+
/** Tab из панели наружу — меню над пунктом: куда вести фокус, решает корень. */
|
|
60
|
+
_tabOutOfPanel(event) {
|
|
61
|
+
this._restore = false;
|
|
62
|
+
this.events.emit("tab", event);
|
|
63
|
+
}
|
|
64
|
+
/** Возвращать фокус, только пока он в пункте или нигде. */
|
|
65
|
+
_returnsFocus(root) {
|
|
66
|
+
return holdsFocus(root, this._dismiss);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { TMenuPopoverItemFocusPlugin };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TPopoverFocusPluginEvents } from '../../popover/focus';
|
|
2
|
+
export type TMenuPopoverItemFocusPluginEvents = TPopoverFocusPluginEvents & {
|
|
3
|
+
/**
|
|
4
|
+
* Tab с последней остановки панели пункта: меню закрывается целиком, и
|
|
5
|
+
* фокус уходит к остановке за его корнем, как Tab из панели меню (APG
|
|
6
|
+
* Menu). Куда — знает только корень, поэтому пункт сообщает о Tab меню над
|
|
7
|
+
* собой, а корень гасит клавишу, если повёл фокус сам
|
|
8
|
+
*/
|
|
9
|
+
tab: (event: KeyboardEvent) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TBasePlugin } from '../../../base';
|
|
2
|
+
import type { IPluginContext } from '../../../base';
|
|
3
|
+
import type { TMenuPopoverItemKeyboardPluginEvents } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* TMenuPopoverItemKeyboardPlugin — клавиатура строки пункта меню с панелью
|
|
6
|
+
* (`Menu.PopoverItem`, APG Menu: пункт со всплывающим окном).
|
|
7
|
+
*
|
|
8
|
+
* Стрелка к концу строки (в RTL ←) открывает панель, как у подменю, и
|
|
9
|
+
* гасится: меню над пунктом погашенную клавишу не трогает
|
|
10
|
+
* (`TMenuNavigationPlugin`). Фокус в панель уводит модель фокуса пункта — и
|
|
11
|
+
* после клавиши, и после клика. Панель уже открыта — её открыл указатель, и
|
|
12
|
+
* фокус остался на строке, — та же стрелка ведёт фокус в неё: модель фокуса
|
|
13
|
+
* пункта, взятая при установке (`focusPanel`). Так в открытую наведением
|
|
14
|
+
* панель с клавиатуры ведёт не только Tab, но и стрелка, как в подменю.
|
|
15
|
+
* Enter и пробел своих правил не требуют: строка — `Button` на `div`, и клик
|
|
16
|
+
* из них делает её `TActionPlugin`, а клик строки открывает панель —
|
|
17
|
+
* открытую не закрывает и фокус не двигает.
|
|
18
|
+
*
|
|
19
|
+
* Строка лежит в корне пункта, поэтому клавиши слушает корень, — и только со
|
|
20
|
+
* строки: клавиши содержимого слотов строки им и принадлежат. Сторона строки
|
|
21
|
+
* — по направлению письма меню, в котором стоит пункт.
|
|
22
|
+
*
|
|
23
|
+
* Выключенный пункт панель не открывает. Подсвеченным он не бывает, и фокуса
|
|
24
|
+
* на его строке с клавиатуры нет, — проверка на случай фокуса, который
|
|
25
|
+
* поставили кликом.
|
|
26
|
+
*/
|
|
27
|
+
export declare class TMenuPopoverItemKeyboardPlugin extends TBasePlugin<any, TMenuPopoverItemKeyboardPluginEvents> {
|
|
28
|
+
private _item;
|
|
29
|
+
/** Модель фокуса пункта: ведёт фокус в уже открытую панель. */
|
|
30
|
+
private _focus;
|
|
31
|
+
/** Корень пункта — узел пункта в меню; строка лежит в нём. */
|
|
32
|
+
private _root;
|
|
33
|
+
/** Тот же корень — под слушатель клавиш. */
|
|
34
|
+
private _target;
|
|
35
|
+
install(ctx: IPluginContext, options?: unknown): void;
|
|
36
|
+
destroy(): void;
|
|
37
|
+
private _listen;
|
|
38
|
+
private _unlisten;
|
|
39
|
+
/** Стрелка к концу строки на строке пункта — открыть панель, а открытую — фокус в неё. */
|
|
40
|
+
private readonly _onKeyDown;
|
|
41
|
+
/** Стрелка к концу строки — по направлению строки пункта. */
|
|
42
|
+
private _toEnd;
|
|
43
|
+
}
|