@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,59 @@
|
|
|
1
|
+
import { TBasePlugin } from '../../../base';
|
|
2
|
+
import type { IPluginContext } from '../../../base';
|
|
3
|
+
import type { TSelectPointerPluginEvents } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* TSelectPointerPlugin — указатель на поле Select: нажатие и клик.
|
|
6
|
+
*
|
|
7
|
+
* **Нажатие оставляет фокус в поле.** DOM-фокус комбобокса всегда на
|
|
8
|
+
* `<input>` поля (APG Combobox): стрелки, Enter и Escape клавиатура берёт
|
|
9
|
+
* только с него (`TSelectKeyboardPlugin`). Части поля без своей остановки Tab
|
|
10
|
+
* — стрелка, коробка, ряд тегов, строки тегов, немое содержимое слотов — по
|
|
11
|
+
* умолчанию уводят фокус из поля: `mousedown` по немой части уносит его на
|
|
12
|
+
* `body`. Клавиши с него до поля не доходят: панель открывалась кликом по
|
|
13
|
+
* стрелке или по тегу, а стрелки после этого прокручивали страницу. Поэтому
|
|
14
|
+
* нажатие основной кнопкой по такой части гасится (`preventDefault`) в обоих
|
|
15
|
+
* режимах, и фокус встаёт в поле, если его там нет, — как у нативного
|
|
16
|
+
* `<select>` и у кнопок шага NumberInput
|
|
17
|
+
* (`TNumberInputStepperPlugin`). Фокус уже в поле — он там и остаётся, без
|
|
18
|
+
* `focusout`. Ставится он без прокрутки (`preventScroll`): поле, по которому
|
|
19
|
+
* нажали, и так на экране, а страница не должна прыгать.
|
|
20
|
+
*
|
|
21
|
+
* Нажатие по остановке Tab внутри корня — по `<input>`, кнопке очистки,
|
|
22
|
+
* крестику тега, кнопке потребителя в слоте — не трогается: что с ним делать,
|
|
23
|
+
* остановка знает сама. Вопрос — остановка ли под нажатием, а не принимает ли
|
|
24
|
+
* узел фокус вообще (`closestControl`): кроме поля, фокус в корне держат
|
|
25
|
+
* только отдельные остановки. Узел, который фокус лишь принимает
|
|
26
|
+
* (`tabindex="-1"`), — элемент составного виджета с roving tabindex, а таких в
|
|
27
|
+
* поле нет: здесь это `-1` в слоте. У строки тега в поле `tabindex` нет
|
|
28
|
+
* вовсе — теги в нём без выбора, и роль с остановкой строке пишет только
|
|
29
|
+
* набор тега (`TItemRow`). Остановка под нажатием — общее правило
|
|
30
|
+
* `closestTabStop` (`utils/tabStops.ts`), поле — `fieldOf`, как у
|
|
31
|
+
* клавиатуры. Правило одно для мыши, пера и пальца: в select-only поле
|
|
32
|
+
* только для чтения, и экранной клавиатуры у него нет, а в `editable` касание
|
|
33
|
+
* стрелки ставит фокус туда же, куда касание поля.
|
|
34
|
+
*
|
|
35
|
+
* **Клик тумблит панель** (`ISelect.toggleOpen()`): в select-only — клик по
|
|
36
|
+
* всему полю, в `editable` — только по стрелке (`.so-select__arrow`), а клик
|
|
37
|
+
* по тексту поля ставит курсор и ничего не открывает. Режим плагин знает по
|
|
38
|
+
* `change:editable`.
|
|
39
|
+
*
|
|
40
|
+
* Слушает сам корень (тот же элемент, что у `TDismissPlugin`/клавиатуры),
|
|
41
|
+
* поэтому клик по вложенному `<input>` и по кнопке очистки (она сама
|
|
42
|
+
* останавливает всплытие) доходят одинаково во всех шести адаптерах —
|
|
43
|
+
* разметке про режим знать не нужно.
|
|
44
|
+
*/
|
|
45
|
+
export declare class TSelectPointerPlugin extends TBasePlugin<any, TSelectPointerPluginEvents> {
|
|
46
|
+
private _owner;
|
|
47
|
+
/** Корень Select: на нём слушатели, в нём ищутся остановка под нажатием и поле. */
|
|
48
|
+
private _root;
|
|
49
|
+
private _editable;
|
|
50
|
+
install(ctx: IPluginContext): void;
|
|
51
|
+
destroy(): void;
|
|
52
|
+
/** Корень сменился — слушатели переезжают на новый. */
|
|
53
|
+
private _bind;
|
|
54
|
+
private _isArrow;
|
|
55
|
+
/** select-only: клик по полю тумблит панель. editable: только по стрелке. */
|
|
56
|
+
private readonly _onClick;
|
|
57
|
+
/** Нажатие мимо остановок Tab поля фокус из поля не уводит, а снаружи — ставит в него. */
|
|
58
|
+
private readonly _onMouseDown;
|
|
59
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TElementPlugin } from "../../element/element.plugin.js";
|
|
3
|
+
import { isFocusableElement } from "../../../utils/isFocusableElement.js";
|
|
4
|
+
import { closestTabStop } from "../../../utils/tabStops.js";
|
|
5
|
+
import { fieldOf } from "../../input/field.js";
|
|
6
|
+
//#region src/custom/select/pointer/pointer.plugin.ts
|
|
7
|
+
/** Класс стрелки — единственное место клика, которое открывает/закрывает панель в `editable`. */
|
|
8
|
+
var ARROW_SELECTOR = ".so-select__arrow";
|
|
9
|
+
/**
|
|
10
|
+
* TSelectPointerPlugin — указатель на поле Select: нажатие и клик.
|
|
11
|
+
*
|
|
12
|
+
* **Нажатие оставляет фокус в поле.** DOM-фокус комбобокса всегда на
|
|
13
|
+
* `<input>` поля (APG Combobox): стрелки, Enter и Escape клавиатура берёт
|
|
14
|
+
* только с него (`TSelectKeyboardPlugin`). Части поля без своей остановки Tab
|
|
15
|
+
* — стрелка, коробка, ряд тегов, строки тегов, немое содержимое слотов — по
|
|
16
|
+
* умолчанию уводят фокус из поля: `mousedown` по немой части уносит его на
|
|
17
|
+
* `body`. Клавиши с него до поля не доходят: панель открывалась кликом по
|
|
18
|
+
* стрелке или по тегу, а стрелки после этого прокручивали страницу. Поэтому
|
|
19
|
+
* нажатие основной кнопкой по такой части гасится (`preventDefault`) в обоих
|
|
20
|
+
* режимах, и фокус встаёт в поле, если его там нет, — как у нативного
|
|
21
|
+
* `<select>` и у кнопок шага NumberInput
|
|
22
|
+
* (`TNumberInputStepperPlugin`). Фокус уже в поле — он там и остаётся, без
|
|
23
|
+
* `focusout`. Ставится он без прокрутки (`preventScroll`): поле, по которому
|
|
24
|
+
* нажали, и так на экране, а страница не должна прыгать.
|
|
25
|
+
*
|
|
26
|
+
* Нажатие по остановке Tab внутри корня — по `<input>`, кнопке очистки,
|
|
27
|
+
* крестику тега, кнопке потребителя в слоте — не трогается: что с ним делать,
|
|
28
|
+
* остановка знает сама. Вопрос — остановка ли под нажатием, а не принимает ли
|
|
29
|
+
* узел фокус вообще (`closestControl`): кроме поля, фокус в корне держат
|
|
30
|
+
* только отдельные остановки. Узел, который фокус лишь принимает
|
|
31
|
+
* (`tabindex="-1"`), — элемент составного виджета с roving tabindex, а таких в
|
|
32
|
+
* поле нет: здесь это `-1` в слоте. У строки тега в поле `tabindex` нет
|
|
33
|
+
* вовсе — теги в нём без выбора, и роль с остановкой строке пишет только
|
|
34
|
+
* набор тега (`TItemRow`). Остановка под нажатием — общее правило
|
|
35
|
+
* `closestTabStop` (`utils/tabStops.ts`), поле — `fieldOf`, как у
|
|
36
|
+
* клавиатуры. Правило одно для мыши, пера и пальца: в select-only поле
|
|
37
|
+
* только для чтения, и экранной клавиатуры у него нет, а в `editable` касание
|
|
38
|
+
* стрелки ставит фокус туда же, куда касание поля.
|
|
39
|
+
*
|
|
40
|
+
* **Клик тумблит панель** (`ISelect.toggleOpen()`): в select-only — клик по
|
|
41
|
+
* всему полю, в `editable` — только по стрелке (`.so-select__arrow`), а клик
|
|
42
|
+
* по тексту поля ставит курсор и ничего не открывает. Режим плагин знает по
|
|
43
|
+
* `change:editable`.
|
|
44
|
+
*
|
|
45
|
+
* Слушает сам корень (тот же элемент, что у `TDismissPlugin`/клавиатуры),
|
|
46
|
+
* поэтому клик по вложенному `<input>` и по кнопке очистки (она сама
|
|
47
|
+
* останавливает всплытие) доходят одинаково во всех шести адаптерах —
|
|
48
|
+
* разметке про режим знать не нужно.
|
|
49
|
+
*/
|
|
50
|
+
var TSelectPointerPlugin = class extends TBasePlugin {
|
|
51
|
+
_owner = null;
|
|
52
|
+
/** Корень Select: на нём слушатели, в нём ищутся остановка под нажатием и поле. */
|
|
53
|
+
_root = null;
|
|
54
|
+
_editable = false;
|
|
55
|
+
install(ctx) {
|
|
56
|
+
super.install(ctx);
|
|
57
|
+
this._owner = ctx.getInstance() ?? null;
|
|
58
|
+
this._editable = Boolean(this._owner?.editable);
|
|
59
|
+
const elementPlugin = ctx.get(TElementPlugin);
|
|
60
|
+
elementPlugin?.events.on("ready", (element) => this._bind(element));
|
|
61
|
+
elementPlugin?.events.on("removed", () => this._bind(null));
|
|
62
|
+
this._listenTo(this._owner?.events, "change:editable", ({ newValue: value }) => {
|
|
63
|
+
this._editable = value;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
destroy() {
|
|
67
|
+
this._bind(null);
|
|
68
|
+
this._owner = null;
|
|
69
|
+
super.destroy();
|
|
70
|
+
}
|
|
71
|
+
/** Корень сменился — слушатели переезжают на новый. */
|
|
72
|
+
_bind(root) {
|
|
73
|
+
const previous = this._root;
|
|
74
|
+
previous?.removeEventListener("click", this._onClick);
|
|
75
|
+
previous?.removeEventListener("mousedown", this._onMouseDown);
|
|
76
|
+
this._root = root;
|
|
77
|
+
const target = root;
|
|
78
|
+
target?.addEventListener("click", this._onClick);
|
|
79
|
+
target?.addEventListener("mousedown", this._onMouseDown);
|
|
80
|
+
}
|
|
81
|
+
_isArrow(target) {
|
|
82
|
+
return target instanceof Element && !!target.closest(ARROW_SELECTOR);
|
|
83
|
+
}
|
|
84
|
+
/** select-only: клик по полю тумблит панель. editable: только по стрелке. */
|
|
85
|
+
_onClick = (event) => {
|
|
86
|
+
if (this._editable) {
|
|
87
|
+
if (this._isArrow(event.target)) this._owner?.toggleOpen();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this._owner?.toggleOpen();
|
|
91
|
+
};
|
|
92
|
+
/** Нажатие мимо остановок Tab поля фокус из поля не уводит, а снаружи — ставит в него. */
|
|
93
|
+
_onMouseDown = (event) => {
|
|
94
|
+
const root = this._root;
|
|
95
|
+
const target = event.target;
|
|
96
|
+
if (!root || event.button !== 0 || !(target instanceof Element)) return;
|
|
97
|
+
if (closestTabStop(target, root)) return;
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
const field = fieldOf(root);
|
|
100
|
+
if (isFocusableElement(field) && root.ownerDocument.activeElement !== field) field.focus({ preventScroll: true });
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { TSelectPointerPlugin };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TBasePlugin } from '../../base';
|
|
2
|
+
import type { IPluginContext } from '../../base';
|
|
3
|
+
import type { TSkeletonLayoutPluginEvents } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Плагин для управления стилями скелетона.
|
|
6
|
+
* Вычисляет ширину и высоту placeholder'а на основе size или кастомных width/height.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TSkeletonLayoutPlugin extends TBasePlugin<any, TSkeletonLayoutPluginEvents> {
|
|
9
|
+
private _styles;
|
|
10
|
+
install(ctx: IPluginContext): void;
|
|
11
|
+
private _bindDimension;
|
|
12
|
+
get styles(): Record<string, string | number>;
|
|
13
|
+
/**
|
|
14
|
+
* Заменяет объект стилей целиком, а не мутирует на месте: геттер отдаёт
|
|
15
|
+
* ссылку наружу, и без смены идентичности UI не увидит изменения.
|
|
16
|
+
*/
|
|
17
|
+
private _patch;
|
|
18
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../base/base.class.js";
|
|
2
|
+
import { toCssValue } from "../../utils/toCssValue.js";
|
|
3
|
+
//#region src/custom/skeleton/layout.plugin.ts
|
|
4
|
+
/**
|
|
5
|
+
* Плагин для управления стилями скелетона.
|
|
6
|
+
* Вычисляет ширину и высоту placeholder'а на основе size или кастомных width/height.
|
|
7
|
+
*/
|
|
8
|
+
var TSkeletonLayoutPlugin = class extends TBasePlugin {
|
|
9
|
+
_styles = {};
|
|
10
|
+
install(ctx) {
|
|
11
|
+
super.install(ctx);
|
|
12
|
+
const skeleton = ctx.getInstance();
|
|
13
|
+
if (!skeleton) return;
|
|
14
|
+
this._bindDimension(skeleton, "width");
|
|
15
|
+
this._bindDimension(skeleton, "height");
|
|
16
|
+
}
|
|
17
|
+
_bindDimension(skeleton, prop) {
|
|
18
|
+
this._styles = {
|
|
19
|
+
...this._styles,
|
|
20
|
+
[prop]: toCssValue(skeleton[prop])
|
|
21
|
+
};
|
|
22
|
+
const event = prop === "width" ? "change:width" : "change:height";
|
|
23
|
+
this._listenTo(skeleton.events, event, ({ newValue: value }) => {
|
|
24
|
+
this._patch(prop, toCssValue(value || "auto"));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
get styles() {
|
|
28
|
+
return this._styles;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Заменяет объект стилей целиком, а не мутирует на месте: геттер отдаёт
|
|
32
|
+
* ссылку наружу, и без смены идентичности UI не увидит изменения.
|
|
33
|
+
*/
|
|
34
|
+
_patch(key, value) {
|
|
35
|
+
const oldStyles = this.styles;
|
|
36
|
+
this._styles = {
|
|
37
|
+
...this._styles,
|
|
38
|
+
[key]: value
|
|
39
|
+
};
|
|
40
|
+
this.events.emit("change:styles", {
|
|
41
|
+
newValue: this._styles,
|
|
42
|
+
oldValue: oldStyles
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { TSkeletonLayoutPlugin };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ISlidable } from '@soxa-ui/core';
|
|
2
|
+
import type { TSlideDirection, TSlidePoint } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Направление роста значения у владельца.
|
|
5
|
+
*
|
|
6
|
+
* Горизонталь растёт от начала строки, поэтому в RTL — справа; `inverted`
|
|
7
|
+
* переворачивает сторону. Вертикаль растёт снизу вверх при любом направлении
|
|
8
|
+
* письма. Направление письма — вычисленное, а не `direction` компонента: у
|
|
9
|
+
* того бывает `inherit`, и тогда сторону задаёт предок.
|
|
10
|
+
*/
|
|
11
|
+
export declare function slideDirection(owner: Pick<ISlidable, 'orientation' | 'inverted'>, element: Element): TSlideDirection;
|
|
12
|
+
/**
|
|
13
|
+
* Длина хода в px — по коробке дорожки вдоль оси направления. По ней радиус
|
|
14
|
+
* щелчка из пикселей становится долей хода.
|
|
15
|
+
*/
|
|
16
|
+
export declare function lengthAlong(direction: TSlideDirection, box: DOMRectReadOnly): number;
|
|
17
|
+
/**
|
|
18
|
+
* Доля хода в точке указателя по коробке дорожки: 0 — у `min`, 1 — у `max`,
|
|
19
|
+
* за краями — за 0 и 1. Коробка дорожки — ход центров ручек, её края и есть 0
|
|
20
|
+
* и 1 (контракт с темой). Коробка нулевой длины — начало хода.
|
|
21
|
+
*
|
|
22
|
+
* Долю здесь не прижимают — прижимает владелец, и не долю указателя, а итог.
|
|
23
|
+
* Ручку он ведёт со смещением захвата, и прижатая доля не довела бы до края
|
|
24
|
+
* ручку, взятую не за середину. А по точке нажатия он решает, какую из ручек
|
|
25
|
+
* на одном значении вести: прижатая к краю, она спутала бы с движением наружу
|
|
26
|
+
* движение внутрь, начатое ещё за краем.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fractionAt(direction: TSlideDirection, box: DOMRectReadOnly, point: TSlidePoint): number;
|
|
29
|
+
/** Шаг от стрелки: `1` — к `max`, `-1` — к `min`; не стрелка — `null`. */
|
|
30
|
+
export declare function arrowStep(direction: TSlideDirection, key: string): 1 | -1 | null;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//#region src/custom/slide/direction.ts
|
|
2
|
+
/**
|
|
3
|
+
* Направление роста значения у владельца.
|
|
4
|
+
*
|
|
5
|
+
* Горизонталь растёт от начала строки, поэтому в RTL — справа; `inverted`
|
|
6
|
+
* переворачивает сторону. Вертикаль растёт снизу вверх при любом направлении
|
|
7
|
+
* письма. Направление письма — вычисленное, а не `direction` компонента: у
|
|
8
|
+
* того бывает `inherit`, и тогда сторону задаёт предок.
|
|
9
|
+
*/
|
|
10
|
+
function slideDirection(owner, element) {
|
|
11
|
+
if (owner.orientation === "vertical") return owner.inverted ? "from-top" : "from-bottom";
|
|
12
|
+
return getComputedStyle(element).direction === "rtl" === owner.inverted ? "from-left" : "from-right";
|
|
13
|
+
}
|
|
14
|
+
/** Путь от стороны `min` до точки — по оси направления. */
|
|
15
|
+
var OFFSET = {
|
|
16
|
+
"from-left": (box, point) => point.clientX - box.left,
|
|
17
|
+
"from-right": (box, point) => box.right - point.clientX,
|
|
18
|
+
"from-bottom": (box, point) => box.bottom - point.clientY,
|
|
19
|
+
"from-top": (box, point) => point.clientY - box.top
|
|
20
|
+
};
|
|
21
|
+
/** Сторона коробки, вдоль которой идёт ход. */
|
|
22
|
+
var LENGTH = {
|
|
23
|
+
"from-left": "width",
|
|
24
|
+
"from-right": "width",
|
|
25
|
+
"from-bottom": "height",
|
|
26
|
+
"from-top": "height"
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Длина хода в px — по коробке дорожки вдоль оси направления. По ней радиус
|
|
30
|
+
* щелчка из пикселей становится долей хода.
|
|
31
|
+
*/
|
|
32
|
+
function lengthAlong(direction, box) {
|
|
33
|
+
return box[LENGTH[direction]];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Доля хода в точке указателя по коробке дорожки: 0 — у `min`, 1 — у `max`,
|
|
37
|
+
* за краями — за 0 и 1. Коробка дорожки — ход центров ручек, её края и есть 0
|
|
38
|
+
* и 1 (контракт с темой). Коробка нулевой длины — начало хода.
|
|
39
|
+
*
|
|
40
|
+
* Долю здесь не прижимают — прижимает владелец, и не долю указателя, а итог.
|
|
41
|
+
* Ручку он ведёт со смещением захвата, и прижатая доля не довела бы до края
|
|
42
|
+
* ручку, взятую не за середину. А по точке нажатия он решает, какую из ручек
|
|
43
|
+
* на одном значении вести: прижатая к краю, она спутала бы с движением наружу
|
|
44
|
+
* движение внутрь, начатое ещё за краем.
|
|
45
|
+
*/
|
|
46
|
+
function fractionAt(direction, box, point) {
|
|
47
|
+
const length = lengthAlong(direction, box);
|
|
48
|
+
return length > 0 ? OFFSET[direction](box, point) / length : 0;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Стрелки к `min` для каждого направления роста (таблица `BACK_KEYS` у
|
|
52
|
+
* Radix); две остальные ведут к `max`. Стрелки своей оси двигают ручку туда,
|
|
53
|
+
* куда смотрят. Стрелки чужой оси — как в любом поле с числом: ↑ и →
|
|
54
|
+
* прибавляют; исключение — вертикаль сверху вниз, где ↓ прибавляет, потому что
|
|
55
|
+
* туда уходит и ручка.
|
|
56
|
+
*/
|
|
57
|
+
var BACK_KEYS = {
|
|
58
|
+
"from-left": ["ArrowLeft", "ArrowDown"],
|
|
59
|
+
"from-right": ["ArrowRight", "ArrowDown"],
|
|
60
|
+
"from-bottom": ["ArrowDown", "ArrowLeft"],
|
|
61
|
+
"from-top": ["ArrowUp", "ArrowLeft"]
|
|
62
|
+
};
|
|
63
|
+
var ARROWS = /* @__PURE__ */ new Set([
|
|
64
|
+
"ArrowLeft",
|
|
65
|
+
"ArrowRight",
|
|
66
|
+
"ArrowUp",
|
|
67
|
+
"ArrowDown"
|
|
68
|
+
]);
|
|
69
|
+
/** Шаг от стрелки: `1` — к `max`, `-1` — к `min`; не стрелка — `null`. */
|
|
70
|
+
function arrowStep(direction, key) {
|
|
71
|
+
if (!ARROWS.has(key)) return null;
|
|
72
|
+
return BACK_KEYS[direction].includes(key) ? -1 : 1;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { arrowStep, fractionAt, lengthAlong, slideDirection };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ISlidable } from '@soxa-ui/core';
|
|
2
|
+
import { TBasePlugin } from '../../../base';
|
|
3
|
+
import type { IPluginContext } from '../../../base';
|
|
4
|
+
import type { TSlideKeyboardPluginEvents } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* TSlideKeyboardPlugin — клавиатура и жест скринридера у полей ручек.
|
|
7
|
+
*
|
|
8
|
+
* Поле ручки — нативный `input[type=range]`, и браузер сдвинул бы его сам. Но
|
|
9
|
+
* шаг у него свой: он не знает ни крупного шага, ни неравного шага списком, ни
|
|
10
|
+
* `inverted`, а в RTL стрелки у браузеров расходятся. Поэтому клавиши плагин
|
|
11
|
+
* берёт себе (`preventDefault`) и переводит в команды владельца — одинаково во
|
|
12
|
+
* всех браузерах:
|
|
13
|
+
*
|
|
14
|
+
* - стрелки — шаг по направлению роста (`arrowStep`): стрелка своей оси ведёт
|
|
15
|
+
* ручку туда, куда смотрит, в RTL и при `inverted` тоже;
|
|
16
|
+
* - Shift со стрелкой, PageUp и PageDown — крупный шаг (`largeStep`);
|
|
17
|
+
* - Home и End — край хода ручки.
|
|
18
|
+
*
|
|
19
|
+
* Клавиши с Alt, Ctrl и Meta — чужие жесты, их плагин не трогает. Слушает он
|
|
20
|
+
* корень, но берёт только клавиши самих полей: у содержимого слотов своя
|
|
21
|
+
* клавиатура.
|
|
22
|
+
*
|
|
23
|
+
* Мобильный скринридер клавиш не шлёт: свайп двигает поле его собственным
|
|
24
|
+
* шагом и сообщает об этом событием `input`. Плагин переводит направление
|
|
25
|
+
* правки в шаг владельца и возвращает полю значение владельца — показывать
|
|
26
|
+
* поле должно то, что решило ядро.
|
|
27
|
+
*/
|
|
28
|
+
export declare class TSlideKeyboardPlugin extends TBasePlugin<ISlidable, TSlideKeyboardPluginEvents> {
|
|
29
|
+
private _owner;
|
|
30
|
+
private _root;
|
|
31
|
+
install(ctx: IPluginContext): void;
|
|
32
|
+
destroy(): void;
|
|
33
|
+
private _attach;
|
|
34
|
+
private _detach;
|
|
35
|
+
private readonly _onKeyDown;
|
|
36
|
+
/**
|
|
37
|
+
* Правка поля не клавишей — жестом скринридера. Владелец делает шаг в ту
|
|
38
|
+
* же сторону, а поле показывает его значение: и когда шаг сделан, и когда
|
|
39
|
+
* упёрся в соседа.
|
|
40
|
+
*/
|
|
41
|
+
private readonly _onInput;
|
|
42
|
+
/** Что клавиша делает с ручкой; не наша клавиша — `null`, её обработает браузер. */
|
|
43
|
+
private _actionOf;
|
|
44
|
+
/** Номер ручки, чьё поле — цель события; не поле ручки — `-1`. */
|
|
45
|
+
private _thumbOf;
|
|
46
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TElementPlugin } from "../../element/element.plugin.js";
|
|
3
|
+
import { arrowStep, slideDirection } from "../direction.js";
|
|
4
|
+
import { fieldOf, thumbsOf, trackOf } from "../parts.js";
|
|
5
|
+
//#region src/custom/slide/keyboard/keyboard.plugin.ts
|
|
6
|
+
/**
|
|
7
|
+
* TSlideKeyboardPlugin — клавиатура и жест скринридера у полей ручек.
|
|
8
|
+
*
|
|
9
|
+
* Поле ручки — нативный `input[type=range]`, и браузер сдвинул бы его сам. Но
|
|
10
|
+
* шаг у него свой: он не знает ни крупного шага, ни неравного шага списком, ни
|
|
11
|
+
* `inverted`, а в RTL стрелки у браузеров расходятся. Поэтому клавиши плагин
|
|
12
|
+
* берёт себе (`preventDefault`) и переводит в команды владельца — одинаково во
|
|
13
|
+
* всех браузерах:
|
|
14
|
+
*
|
|
15
|
+
* - стрелки — шаг по направлению роста (`arrowStep`): стрелка своей оси ведёт
|
|
16
|
+
* ручку туда, куда смотрит, в RTL и при `inverted` тоже;
|
|
17
|
+
* - Shift со стрелкой, PageUp и PageDown — крупный шаг (`largeStep`);
|
|
18
|
+
* - Home и End — край хода ручки.
|
|
19
|
+
*
|
|
20
|
+
* Клавиши с Alt, Ctrl и Meta — чужие жесты, их плагин не трогает. Слушает он
|
|
21
|
+
* корень, но берёт только клавиши самих полей: у содержимого слотов своя
|
|
22
|
+
* клавиатура.
|
|
23
|
+
*
|
|
24
|
+
* Мобильный скринридер клавиш не шлёт: свайп двигает поле его собственным
|
|
25
|
+
* шагом и сообщает об этом событием `input`. Плагин переводит направление
|
|
26
|
+
* правки в шаг владельца и возвращает полю значение владельца — показывать
|
|
27
|
+
* поле должно то, что решило ядро.
|
|
28
|
+
*/
|
|
29
|
+
var TSlideKeyboardPlugin = class extends TBasePlugin {
|
|
30
|
+
_owner = null;
|
|
31
|
+
_root = null;
|
|
32
|
+
install(ctx) {
|
|
33
|
+
super.install(ctx);
|
|
34
|
+
this._owner = ctx.getInstance();
|
|
35
|
+
const element = ctx.get(TElementPlugin);
|
|
36
|
+
element?.events.on("ready", (node) => this._attach(node));
|
|
37
|
+
element?.events.on("removed", () => this._detach());
|
|
38
|
+
}
|
|
39
|
+
destroy() {
|
|
40
|
+
this._detach();
|
|
41
|
+
this._owner = null;
|
|
42
|
+
super.destroy();
|
|
43
|
+
}
|
|
44
|
+
_attach(root) {
|
|
45
|
+
this._detach();
|
|
46
|
+
this._root = root;
|
|
47
|
+
const target = root;
|
|
48
|
+
target.addEventListener("keydown", this._onKeyDown);
|
|
49
|
+
target.addEventListener("input", this._onInput);
|
|
50
|
+
}
|
|
51
|
+
_detach() {
|
|
52
|
+
const target = this._root;
|
|
53
|
+
target?.removeEventListener("keydown", this._onKeyDown);
|
|
54
|
+
target?.removeEventListener("input", this._onInput);
|
|
55
|
+
this._root = null;
|
|
56
|
+
}
|
|
57
|
+
_onKeyDown = (event) => {
|
|
58
|
+
if (event.altKey || event.ctrlKey || event.metaKey) return;
|
|
59
|
+
const owner = this._owner;
|
|
60
|
+
const root = this._root;
|
|
61
|
+
if (!owner || !root) return;
|
|
62
|
+
const index = this._thumbOf(owner, root, event.target);
|
|
63
|
+
const action = index < 0 ? null : this._actionOf(owner, root, event);
|
|
64
|
+
if (!action) return;
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
action(index);
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Правка поля не клавишей — жестом скринридера. Владелец делает шаг в ту
|
|
70
|
+
* же сторону, а поле показывает его значение: и когда шаг сделан, и когда
|
|
71
|
+
* упёрся в соседа.
|
|
72
|
+
*/
|
|
73
|
+
_onInput = (event) => {
|
|
74
|
+
const owner = this._owner;
|
|
75
|
+
const root = this._root;
|
|
76
|
+
const field = event.target;
|
|
77
|
+
if (!owner || !root || !(field instanceof HTMLInputElement)) return;
|
|
78
|
+
const index = this._thumbOf(owner, root, field);
|
|
79
|
+
if (index < 0) return;
|
|
80
|
+
const direction = Math.sign(Number(field.value) - owner.values[index]);
|
|
81
|
+
if (direction) owner.shift(index, direction);
|
|
82
|
+
const value = String(owner.values[index]);
|
|
83
|
+
if (field.value !== value) field.value = value;
|
|
84
|
+
};
|
|
85
|
+
/** Что клавиша делает с ручкой; не наша клавиша — `null`, её обработает браузер. */
|
|
86
|
+
_actionOf(owner, root, event) {
|
|
87
|
+
switch (event.key) {
|
|
88
|
+
case "Home": return (index) => owner.moveToEdge(index, "start");
|
|
89
|
+
case "End": return (index) => owner.moveToEdge(index, "end");
|
|
90
|
+
case "PageUp": return (index) => owner.shift(index, owner.largeStep);
|
|
91
|
+
case "PageDown": return (index) => owner.shift(index, -owner.largeStep);
|
|
92
|
+
}
|
|
93
|
+
const step = arrowStep(slideDirection(owner, root), event.key);
|
|
94
|
+
if (step === null) return null;
|
|
95
|
+
const count = event.shiftKey ? step * owner.largeStep : step;
|
|
96
|
+
return (index) => owner.shift(index, count);
|
|
97
|
+
}
|
|
98
|
+
/** Номер ручки, чьё поле — цель события; не поле ручки — `-1`. */
|
|
99
|
+
_thumbOf(owner, root, target) {
|
|
100
|
+
const track = trackOf(owner, root);
|
|
101
|
+
if (!track) return -1;
|
|
102
|
+
return thumbsOf(owner, track).findIndex((thumb) => fieldOf(thumb) === target);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
export { TSlideKeyboardPlugin };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ISlidable } from '@soxa-ui/core';
|
|
2
|
+
/** Дорожка — ребёнок корня с классом `__track`. */
|
|
3
|
+
export declare function trackOf(owner: ISlidable, root: Element): Element | null;
|
|
4
|
+
/** Ручки — дети дорожки с классом `__thumb`, по порядку: i-я — ручка i. */
|
|
5
|
+
export declare function thumbsOf(owner: ISlidable, track: Element): Element[];
|
|
6
|
+
/** Поле ручки — её ребёнок `input`. */
|
|
7
|
+
export declare function fieldOf(thumb: Element | undefined): HTMLInputElement | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/custom/slide/parts.ts
|
|
2
|
+
/**
|
|
3
|
+
* Части перетаскивания в разметке владельца — по его классам, а не строкой в
|
|
4
|
+
* плагине (`classes.resolve`).
|
|
5
|
+
*
|
|
6
|
+
* Только прямые дети: в слоте ручки может лежать что угодно, вплоть до
|
|
7
|
+
* другого ползунка, и поиск вглубь нашёл бы его части.
|
|
8
|
+
*/
|
|
9
|
+
function childrenWith(parent, className) {
|
|
10
|
+
return Array.from(parent.children).filter((child) => child.classList.contains(className));
|
|
11
|
+
}
|
|
12
|
+
/** Дорожка — ребёнок корня с классом `__track`. */
|
|
13
|
+
function trackOf(owner, root) {
|
|
14
|
+
return childrenWith(root, owner.classes.resolve("__track"))[0] ?? null;
|
|
15
|
+
}
|
|
16
|
+
/** Ручки — дети дорожки с классом `__thumb`, по порядку: i-я — ручка i. */
|
|
17
|
+
function thumbsOf(owner, track) {
|
|
18
|
+
return childrenWith(track, owner.classes.resolve("__thumb"));
|
|
19
|
+
}
|
|
20
|
+
/** Поле ручки — её ребёнок `input`. */
|
|
21
|
+
function fieldOf(thumb) {
|
|
22
|
+
if (!thumb) return null;
|
|
23
|
+
return Array.from(thumb.children).find((child) => child instanceof HTMLInputElement) ?? null;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { fieldOf, thumbsOf, trackOf };
|