@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,17 @@
|
|
|
1
|
+
//#region src/utils/isAppleTouch.ts
|
|
2
|
+
/**
|
|
3
|
+
* Сенсорное устройство Apple — iPhone, iPod или iPad. iPadOS называет себя
|
|
4
|
+
* `MacIntel`, как Mac, и отличает его сенсорный экран: у Mac точек касания нет.
|
|
5
|
+
*
|
|
6
|
+
* Общее у полей, которым VoiceOver на iOS не даёт счётчик (`spinbutton`): там
|
|
7
|
+
* он его не фокусирует, и поле даты и поле числа отдают роль `textbox`.
|
|
8
|
+
* Устройство узнают у документа узла, а не у `globalThis`: поле живёт и в
|
|
9
|
+
* iframe.
|
|
10
|
+
*/
|
|
11
|
+
function isAppleTouch(navigator) {
|
|
12
|
+
if (!navigator) return false;
|
|
13
|
+
const { platform, maxTouchPoints } = navigator;
|
|
14
|
+
return /^(iPhone|iPod|iPad)/.test(platform) || /^Mac/.test(platform) && maxTouchPoints > 1;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { isAppleTouch };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Узел, которому можно дать и снять фокус: `focus()` и `blur()` есть у
|
|
3
|
+
* `HTMLElement` и у `SVGElement`.
|
|
4
|
+
*
|
|
5
|
+
* `SVGElement` здесь не для полноты: корнем компонента бывает `svg`, и
|
|
6
|
+
* сужение до одного `HTMLElement` молча отняло бы у него фокус.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isFocusableElement(el: unknown): el is HTMLElement | SVGElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/utils/isFocusableElement.ts
|
|
2
|
+
/**
|
|
3
|
+
* Узел, которому можно дать и снять фокус: `focus()` и `blur()` есть у
|
|
4
|
+
* `HTMLElement` и у `SVGElement`.
|
|
5
|
+
*
|
|
6
|
+
* `SVGElement` здесь не для полноты: корнем компонента бывает `svg`, и
|
|
7
|
+
* сужение до одного `HTMLElement` молча отняло бы у него фокус.
|
|
8
|
+
*/
|
|
9
|
+
function isFocusableElement(el) {
|
|
10
|
+
return el instanceof HTMLElement || el instanceof SVGElement;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { isFocusableElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Узел с layout-боксом: `offsetWidth`/`offsetHeight`/`offsetTop`/`offsetLeft`
|
|
3
|
+
* и инлайновый `style`.
|
|
4
|
+
*
|
|
5
|
+
* Узел плагину приходит как `Element` (см. `TElementPlugin`) — корнем
|
|
6
|
+
* компонента может оказаться `svg`. Там, где меряется бокс или пишется
|
|
7
|
+
* инлайновый стиль, узел сужается этим гардом, а не приведением: у
|
|
8
|
+
* `SVGElement` нет `offset*`, и приведение отдало бы `undefined` в
|
|
9
|
+
* арифметику.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isMeasurableElement(el: unknown): el is HTMLElement;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/utils/isMeasurableElement.ts
|
|
2
|
+
/**
|
|
3
|
+
* Узел с layout-боксом: `offsetWidth`/`offsetHeight`/`offsetTop`/`offsetLeft`
|
|
4
|
+
* и инлайновый `style`.
|
|
5
|
+
*
|
|
6
|
+
* Узел плагину приходит как `Element` (см. `TElementPlugin`) — корнем
|
|
7
|
+
* компонента может оказаться `svg`. Там, где меряется бокс или пишется
|
|
8
|
+
* инлайновый стиль, узел сужается этим гардом, а не приведением: у
|
|
9
|
+
* `SVGElement` нет `offset*`, и приведение отдало бы `undefined` в
|
|
10
|
+
* арифметику.
|
|
11
|
+
*/
|
|
12
|
+
function isMeasurableElement(el) {
|
|
13
|
+
return el instanceof HTMLElement;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isMeasurableElement };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Печатный символ, а не сочетание с модификатором.
|
|
3
|
+
*
|
|
4
|
+
* В общих утилитах, а не у клавиатуры Select: набор по первым буквам ведут и
|
|
5
|
+
* комбобокс, и меню (`packages/plugins/src/custom/list/typeahead.ts`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function isPrintableKey(e: KeyboardEvent): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/utils/isPrintableKey.ts
|
|
2
|
+
/**
|
|
3
|
+
* Печатный символ, а не сочетание с модификатором.
|
|
4
|
+
*
|
|
5
|
+
* В общих утилитах, а не у клавиатуры Select: набор по первым буквам ведут и
|
|
6
|
+
* комбобокс, и меню (`packages/plugins/src/custom/list/typeahead.ts`).
|
|
7
|
+
*/
|
|
8
|
+
function isPrintableKey(e) {
|
|
9
|
+
return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isPrintableKey };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Номер слоя узла (`data-layer`); `null` — узла нет или слоя у него нет.
|
|
3
|
+
*
|
|
4
|
+
* Номер пишет показанный слой (`TLayer` — Frame и модальное окно,
|
|
5
|
+
* `FRAME_LAYER_ATTRIBUTE`): больше номер — выше слой, открытый позже.
|
|
6
|
+
*
|
|
7
|
+
* Живёт в общих утилитах, а не у `TDismissPlugin`: по слоям решают двое —
|
|
8
|
+
* «нажали мимо» и то, что прячет фон модального слоя от скринридера
|
|
9
|
+
* (`THideOutsidePlugin`). Своё чтение атрибута у второго разошлось бы с
|
|
10
|
+
* первым.
|
|
11
|
+
*/
|
|
12
|
+
export declare function layerOf(element: Element | null): number | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FRAME_LAYER_ATTRIBUTE } from "@soxa-ui/core";
|
|
2
|
+
//#region src/utils/layerOf.ts
|
|
3
|
+
/**
|
|
4
|
+
* Номер слоя узла (`data-layer`); `null` — узла нет или слоя у него нет.
|
|
5
|
+
*
|
|
6
|
+
* Номер пишет показанный слой (`TLayer` — Frame и модальное окно,
|
|
7
|
+
* `FRAME_LAYER_ATTRIBUTE`): больше номер — выше слой, открытый позже.
|
|
8
|
+
*
|
|
9
|
+
* Живёт в общих утилитах, а не у `TDismissPlugin`: по слоям решают двое —
|
|
10
|
+
* «нажали мимо» и то, что прячет фон модального слоя от скринридера
|
|
11
|
+
* (`THideOutsidePlugin`). Своё чтение атрибута у второго разошлось бы с
|
|
12
|
+
* первым.
|
|
13
|
+
*/
|
|
14
|
+
function layerOf(element) {
|
|
15
|
+
const value = element?.getAttribute(FRAME_LAYER_ATTRIBUTE);
|
|
16
|
+
if (value === null || value === void 0) return null;
|
|
17
|
+
const layer = Number(value);
|
|
18
|
+
return Number.isFinite(layer) ? layer : null;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { layerOf };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TNearestShiftOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* На сколько сдвинуть область, чтобы элемент под фокусом встал в окно, — или
|
|
4
|
+
* `null`, если он уже там.
|
|
5
|
+
*
|
|
6
|
+
* С элементом области (`item`) в окно встаёт и он. Не шире окна — целиком: у
|
|
7
|
+
* тега в ряду кольцо фокуса рисует пилюля, а крестик без подписи не скажет,
|
|
8
|
+
* какой тег он закроет. Шире окна — накрывает его, а элемент под фокусом
|
|
9
|
+
* лежит в окне: так крестик в конце длинного тега виден, хотя начало тега за
|
|
10
|
+
* краем.
|
|
11
|
+
*
|
|
12
|
+
* Из всех таких сдвигов берётся ближайший: область уезжает не дальше, чем
|
|
13
|
+
* нужно, и то, что было в окне, по возможности в нём и остаётся.
|
|
14
|
+
*
|
|
15
|
+
* Элемент под фокусом шире окна в него не встанет ни при каком сдвиге и
|
|
16
|
+
* доводится до ближайшего положения, где накрывает окно: больше окна от него
|
|
17
|
+
* всё равно не увидеть.
|
|
18
|
+
*/
|
|
19
|
+
export declare function nearestShift({ scrollWindow, focused, item, }: TNearestShiftOptions): number | null;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/utils/nearestShift.ts
|
|
2
|
+
/**
|
|
3
|
+
* Доводка элемента под фокусом в окно области прокрутки — чистая функция,
|
|
4
|
+
* без DOM: область и её элементы сюда приходят отрезками по строке. Отсюда и
|
|
5
|
+
* проверяемость: субпиксели, элемент шире окна и оба края проверяются
|
|
6
|
+
* числами, а не настоящей раскладкой.
|
|
7
|
+
*
|
|
8
|
+
* Живёт в общих утилитах, а не у ленты: доводят двое — вьюпорт ленты
|
|
9
|
+
* (`TScrollerViewportPlugin`) и ряд тегов `scroll` (`TTagsScrollPlugin`).
|
|
10
|
+
* Своя арифметика у второго разошлась бы с первой: допуск, элемент шире окна
|
|
11
|
+
* и «накрывает окно» пришлось бы писать дважды. У ленты сверх этого есть
|
|
12
|
+
* снап, и он остаётся у неё (`resolveFocusShift`).
|
|
13
|
+
*
|
|
14
|
+
* Направление письма здесь не нужно: ближайший сдвиг одинаков в обе стороны,
|
|
15
|
+
* а сдвиг — физический, как у `scrollBy`.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Допуск на субпиксельное округление: край, вышедший из окна на полпикселя, —
|
|
19
|
+
* ещё в окне. Область встаёт на целый пиксель, а края элементов дробные.
|
|
20
|
+
*/
|
|
21
|
+
var TOLERANCE = .5;
|
|
22
|
+
/**
|
|
23
|
+
* Сдвиги области, при которых отрезок лежит в окне, а если он шире окна —
|
|
24
|
+
* накрывает его: больше окна от него не увидеть. Сдвиг — как у `scrollBy`: на
|
|
25
|
+
* сколько содержимое области уезжает влево.
|
|
26
|
+
*/
|
|
27
|
+
function fitting(span, scrollWindow) {
|
|
28
|
+
const left = span.left - scrollWindow.left;
|
|
29
|
+
const right = span.right - scrollWindow.right;
|
|
30
|
+
return [Math.min(left, right), Math.max(left, right)];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* На сколько сдвинуть область, чтобы элемент под фокусом встал в окно, — или
|
|
34
|
+
* `null`, если он уже там.
|
|
35
|
+
*
|
|
36
|
+
* С элементом области (`item`) в окно встаёт и он. Не шире окна — целиком: у
|
|
37
|
+
* тега в ряду кольцо фокуса рисует пилюля, а крестик без подписи не скажет,
|
|
38
|
+
* какой тег он закроет. Шире окна — накрывает его, а элемент под фокусом
|
|
39
|
+
* лежит в окне: так крестик в конце длинного тега виден, хотя начало тега за
|
|
40
|
+
* краем.
|
|
41
|
+
*
|
|
42
|
+
* Из всех таких сдвигов берётся ближайший: область уезжает не дальше, чем
|
|
43
|
+
* нужно, и то, что было в окне, по возможности в нём и остаётся.
|
|
44
|
+
*
|
|
45
|
+
* Элемент под фокусом шире окна в него не встанет ни при каком сдвиге и
|
|
46
|
+
* доводится до ближайшего положения, где накрывает окно: больше окна от него
|
|
47
|
+
* всё равно не увидеть.
|
|
48
|
+
*/
|
|
49
|
+
function nearestShift({ scrollWindow, focused, item = focused }) {
|
|
50
|
+
const [focusFrom, focusTo] = fitting(focused, scrollWindow);
|
|
51
|
+
const [itemFrom, itemTo] = fitting(item, scrollWindow);
|
|
52
|
+
const from = Math.max(focusFrom, itemFrom);
|
|
53
|
+
const to = Math.min(focusTo, itemTo);
|
|
54
|
+
if (from - TOLERANCE <= 0 && to + TOLERANCE >= 0) return null;
|
|
55
|
+
return Math.min(Math.max(0, from), to);
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { nearestShift };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Позиционирование, от которого зависит блок отсчёта: `fixed` или `absolute`. */
|
|
2
|
+
export type TPositionStrategy = 'fixed' | 'absolute';
|
|
3
|
+
/** Точка в координатах окна. */
|
|
4
|
+
export type TPoint = {
|
|
5
|
+
readonly x: number;
|
|
6
|
+
readonly y: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Угол блока, от которого браузер отсчитывает `left`/`top` узла с этим
|
|
10
|
+
* позиционированием, — в координатах окна.
|
|
11
|
+
*
|
|
12
|
+
* Блок — ближайший предок, который держит такие потомки: для `fixed` — только
|
|
13
|
+
* трансформацией, фильтром и сдерживанием (`holdsFixed`), для `absolute` — ещё
|
|
14
|
+
* и любым `position`, кроме `static`. Отсчёт идёт от края его паддинга — за
|
|
15
|
+
* рамкой (`clientLeft`/`clientTop`) — и едет с его прокруткой. У корня
|
|
16
|
+
* документа прокрутку не вычитаем: она — прокрутка окна, и в его
|
|
17
|
+
* прямоугольнике уже учтена.
|
|
18
|
+
*
|
|
19
|
+
* Такого предка нет — для `fixed` это окно (`0, 0`), для `absolute` — начало
|
|
20
|
+
* документа, то есть точка окна `-scrollX, -scrollY`.
|
|
21
|
+
*
|
|
22
|
+
* Узла ещё нет — блок не найти, и отсчёт тот же, что без предка.
|
|
23
|
+
*/
|
|
24
|
+
export declare function positionOriginOf(node: Element | null, strategy: TPositionStrategy): TPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Узел стоит в окне, а не в документе: он сам или его предок —
|
|
27
|
+
* `position: fixed`, или `sticky`, который липнет к окну, — у него нет
|
|
28
|
+
* прокручиваемого предка (`scrollParentOf`). Прокрутка окна такой узел не
|
|
29
|
+
* двигает.
|
|
30
|
+
*
|
|
31
|
+
* `sticky` во внутренней прокрутке с окном не стоит: окно везёт его вместе с
|
|
32
|
+
* контейнером.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isPinnedToViewport(node: Element): boolean;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { scrollParentOf } from "./scrollParent.js";
|
|
2
|
+
//#region src/utils/positionOrigin.ts
|
|
3
|
+
/**
|
|
4
|
+
* Значение свойства, которое делает узел блоком отсчёта и для `fixed`, и для
|
|
5
|
+
* `absolute` потомков: трансформация, фильтр, сдерживание. Пустая строка —
|
|
6
|
+
* свойство браузер не знает (jsdom, старый движок), и блока оно не даёт.
|
|
7
|
+
*/
|
|
8
|
+
var sets = (value) => !!value && value !== "none";
|
|
9
|
+
/**
|
|
10
|
+
* Узел — блок отсчёта для потомка с `position: fixed`, а значит и с
|
|
11
|
+
* `absolute`: так его делают трансформация и отдельные `translate`, `rotate`,
|
|
12
|
+
* `scale`, перспектива, фильтры, сдерживание раскладки и отрисовки, контейнер
|
|
13
|
+
* размера и `will-change` любого из них. Тот же список у Floating UI.
|
|
14
|
+
*/
|
|
15
|
+
function holdsFixed(style) {
|
|
16
|
+
return sets(style.transform) || sets(style.translate) || sets(style.rotate) || sets(style.scale) || sets(style.perspective) || sets(style.filter) || sets(style.backdropFilter) || /paint|layout|strict|content/.test(style.contain ?? "") || /transform|translate|rotate|scale|perspective|filter/.test(style.willChange ?? "") || !!style.containerType && style.containerType !== "normal";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Угол блока, от которого браузер отсчитывает `left`/`top` узла с этим
|
|
20
|
+
* позиционированием, — в координатах окна.
|
|
21
|
+
*
|
|
22
|
+
* Блок — ближайший предок, который держит такие потомки: для `fixed` — только
|
|
23
|
+
* трансформацией, фильтром и сдерживанием (`holdsFixed`), для `absolute` — ещё
|
|
24
|
+
* и любым `position`, кроме `static`. Отсчёт идёт от края его паддинга — за
|
|
25
|
+
* рамкой (`clientLeft`/`clientTop`) — и едет с его прокруткой. У корня
|
|
26
|
+
* документа прокрутку не вычитаем: она — прокрутка окна, и в его
|
|
27
|
+
* прямоугольнике уже учтена.
|
|
28
|
+
*
|
|
29
|
+
* Такого предка нет — для `fixed` это окно (`0, 0`), для `absolute` — начало
|
|
30
|
+
* документа, то есть точка окна `-scrollX, -scrollY`.
|
|
31
|
+
*
|
|
32
|
+
* Узла ещё нет — блок не найти, и отсчёт тот же, что без предка.
|
|
33
|
+
*/
|
|
34
|
+
function positionOriginOf(node, strategy) {
|
|
35
|
+
for (let current = node?.parentElement ?? null; current; current = current.parentElement) {
|
|
36
|
+
const style = getComputedStyle(current);
|
|
37
|
+
if (!holdsFixed(style) && (strategy === "fixed" || style.position === "static")) continue;
|
|
38
|
+
const rect = current.getBoundingClientRect();
|
|
39
|
+
const root = current === current.ownerDocument.documentElement;
|
|
40
|
+
return {
|
|
41
|
+
x: rect.left + current.clientLeft - (root ? 0 : current.scrollLeft),
|
|
42
|
+
y: rect.top + current.clientTop - (root ? 0 : current.scrollTop)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return strategy === "fixed" ? {
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0
|
|
48
|
+
} : {
|
|
49
|
+
x: -window.scrollX,
|
|
50
|
+
y: -window.scrollY
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Узел стоит в окне, а не в документе: он сам или его предок —
|
|
55
|
+
* `position: fixed`, или `sticky`, который липнет к окну, — у него нет
|
|
56
|
+
* прокручиваемого предка (`scrollParentOf`). Прокрутка окна такой узел не
|
|
57
|
+
* двигает.
|
|
58
|
+
*
|
|
59
|
+
* `sticky` во внутренней прокрутке с окном не стоит: окно везёт его вместе с
|
|
60
|
+
* контейнером.
|
|
61
|
+
*/
|
|
62
|
+
function isPinnedToViewport(node) {
|
|
63
|
+
for (let current = node; current; current = current.parentElement) {
|
|
64
|
+
const position = getComputedStyle(current).position;
|
|
65
|
+
if (position === "fixed") return true;
|
|
66
|
+
if (position === "sticky" && !scrollParentOf(current, "y")) return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { isPinnedToViewport, positionOriginOf };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Ось прокрутки: `x` — вдоль строки, `y` — вдоль страницы. */
|
|
2
|
+
export type TScrollAxis = 'x' | 'y';
|
|
3
|
+
/**
|
|
4
|
+
* Прокручивается ли узел вдоль оси: стиль разрешает прокрутку (`auto`,
|
|
5
|
+
* `scroll`), и содержимое в окно узла не помещается.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isScrollable(element: Element, axis: TScrollAxis): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Ближайший предок узла, который прокручивается вдоль оси. Такого нет —
|
|
10
|
+
* `null`: узел прокручивает страница.
|
|
11
|
+
*/
|
|
12
|
+
export declare function scrollParentOf(node: Element, axis: TScrollAxis): HTMLElement | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isMeasurableElement } from "./isMeasurableElement.js";
|
|
2
|
+
//#region src/utils/scrollParent.ts
|
|
3
|
+
/**
|
|
4
|
+
* Прокручивается ли узел вдоль оси: стиль разрешает прокрутку (`auto`,
|
|
5
|
+
* `scroll`), и содержимое в окно узла не помещается.
|
|
6
|
+
*/
|
|
7
|
+
function isScrollable(element, axis) {
|
|
8
|
+
if (!isMeasurableElement(element)) return false;
|
|
9
|
+
const style = getComputedStyle(element);
|
|
10
|
+
const overflow = axis === "y" ? style.overflowY : style.overflowX;
|
|
11
|
+
const overflows = axis === "y" ? element.scrollHeight > element.clientHeight : element.scrollWidth > element.clientWidth;
|
|
12
|
+
return (overflow === "auto" || overflow === "scroll") && overflows;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Ближайший предок узла, который прокручивается вдоль оси. Такого нет —
|
|
16
|
+
* `null`: узел прокручивает страница.
|
|
17
|
+
*/
|
|
18
|
+
function scrollParentOf(node, axis) {
|
|
19
|
+
for (let current = node.parentElement; current; current = current.parentElement) if (isScrollable(current, axis)) return current;
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { isScrollable, scrollParentOf };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TInlineSpan } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Замер области прокрутки для доводки элемента под фокусом (`nearestShift`):
|
|
4
|
+
* окно области и элемент области, в котором лежит узел.
|
|
5
|
+
*
|
|
6
|
+
* Живёт в общих утилитах, а не у ленты: мерят двое — вьюпорт ленты
|
|
7
|
+
* (`TScrollerViewportPlugin`) и ряд тегов `scroll` (`TTagsScrollPlugin`).
|
|
8
|
+
* Свой замер у второго разошёлся бы с первым — например, в том, чем считать
|
|
9
|
+
* процент у `scroll-padding` и что делать с `auto`.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Окно области по строке: паддинг-бокс (`clientLeft`, `clientWidth` — без
|
|
13
|
+
* рамки и полосы прокрутки) без вычисленного `scroll-padding` с каждой
|
|
14
|
+
* стороны. Стороны физические: логический `scroll-padding-inline` браузер
|
|
15
|
+
* отдаёт уже разложенным по ним.
|
|
16
|
+
*
|
|
17
|
+
* Отступ окна задаёт тема, и только она знает, сколько места держать у края:
|
|
18
|
+
* ширину подсказки ленты, запас под кольцо фокуса. До того же окна докручивает
|
|
19
|
+
* и сам браузер (`scrollIntoView`, фокус), поэтому доводка с ним не спорит.
|
|
20
|
+
*/
|
|
21
|
+
export declare function scrollWindowOf(area: Element, style: CSSStyleDeclaration): TInlineSpan;
|
|
22
|
+
/**
|
|
23
|
+
* Элемент области, в котором лежит узел, — его предок, который прямой ребёнок
|
|
24
|
+
* области. Содержимое лежит в области без обёрток: у ленты это элементы, на
|
|
25
|
+
* которых тема ставит точки снапа, у ряда тегов — пилюли.
|
|
26
|
+
*/
|
|
27
|
+
export declare function itemOf(node: Element, area: Element): Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/utils/scrollWindow.ts
|
|
2
|
+
/**
|
|
3
|
+
* Замер области прокрутки для доводки элемента под фокусом (`nearestShift`):
|
|
4
|
+
* окно области и элемент области, в котором лежит узел.
|
|
5
|
+
*
|
|
6
|
+
* Живёт в общих утилитах, а не у ленты: мерят двое — вьюпорт ленты
|
|
7
|
+
* (`TScrollerViewportPlugin`) и ряд тегов `scroll` (`TTagsScrollPlugin`).
|
|
8
|
+
* Свой замер у второго разошёлся бы с первым — например, в том, чем считать
|
|
9
|
+
* процент у `scroll-padding` и что делать с `auto`.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Окно области по строке: паддинг-бокс (`clientLeft`, `clientWidth` — без
|
|
13
|
+
* рамки и полосы прокрутки) без вычисленного `scroll-padding` с каждой
|
|
14
|
+
* стороны. Стороны физические: логический `scroll-padding-inline` браузер
|
|
15
|
+
* отдаёт уже разложенным по ним.
|
|
16
|
+
*
|
|
17
|
+
* Отступ окна задаёт тема, и только она знает, сколько места держать у края:
|
|
18
|
+
* ширину подсказки ленты, запас под кольцо фокуса. До того же окна докручивает
|
|
19
|
+
* и сам браузер (`scrollIntoView`, фокус), поэтому доводка с ним не спорит.
|
|
20
|
+
*/
|
|
21
|
+
function scrollWindowOf(area, style) {
|
|
22
|
+
const left = area.getBoundingClientRect().left + area.clientLeft;
|
|
23
|
+
const width = area.clientWidth;
|
|
24
|
+
return {
|
|
25
|
+
left: left + insetOf(style.scrollPaddingLeft, width),
|
|
26
|
+
right: left + width - insetOf(style.scrollPaddingRight, width)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Отступ окна с одной стороны, в px. Процент считается от ширины области
|
|
31
|
+
* прокрутки. `auto` спецификация оставляет браузеру и советует ноль — ноль и
|
|
32
|
+
* считается.
|
|
33
|
+
*/
|
|
34
|
+
function insetOf(value, width) {
|
|
35
|
+
const length = parseFloat(value);
|
|
36
|
+
if (!Number.isFinite(length)) return 0;
|
|
37
|
+
return value.endsWith("%") ? length * width / 100 : length;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Элемент области, в котором лежит узел, — его предок, который прямой ребёнок
|
|
41
|
+
* области. Содержимое лежит в области без обёрток: у ленты это элементы, на
|
|
42
|
+
* которых тема ставит точки снапа, у ряда тегов — пилюли.
|
|
43
|
+
*/
|
|
44
|
+
function itemOf(node, area) {
|
|
45
|
+
let item = node;
|
|
46
|
+
while (item.parentElement !== null && item.parentElement !== area) item = item.parentElement;
|
|
47
|
+
return item;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { itemOf, scrollWindowOf };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Остановки Tab — элементы, на которые браузер ставит фокус клавишей Tab, в
|
|
3
|
+
* порядке документа.
|
|
4
|
+
*
|
|
5
|
+
* Браузер этот порядок наружу не отдаёт, поэтому он восстанавливается по
|
|
6
|
+
* разметке: что фокусируется само, что получило `tabindex`, что выключено.
|
|
7
|
+
* Раскладку поиск не проверяет — в jsdom её нет, а в браузере скрытый
|
|
8
|
+
* элемент сам не примет фокус: кандидатов перебирают по очереди, пока один
|
|
9
|
+
* не примет (`focusFirst`). Положительный `tabindex` порядок не меняет: он
|
|
10
|
+
* ломает порядок обхода и в APG не рекомендован.
|
|
11
|
+
*
|
|
12
|
+
* Живёт в общих утилитах, а не у модели фокуса Popover: спрашивают об этом
|
|
13
|
+
* поповер (куда уводить фокус), лента (становиться ли ей самой остановкой
|
|
14
|
+
* Tab), поле Select (не остановка ли под указателем, `closestTabStop`), а не
|
|
15
|
+
* контрол ли под указателем (`closestControl`), — жест выезжающей панели и
|
|
16
|
+
* сетка таблицы. Свой список селекторов у любого из них был бы вторым путём к
|
|
17
|
+
* тому же знанию.
|
|
18
|
+
*/
|
|
19
|
+
/** Остановки Tab внутри узла или документа, в порядке документа. */
|
|
20
|
+
export declare function tabStops(scope: ParentNode): Element[];
|
|
21
|
+
/**
|
|
22
|
+
* Контрол, в котором лежит узел, — ближайший кандидат в остановки Tab между
|
|
23
|
+
* узлом и `scope` (сам `scope` не в счёт): поле, кнопка, ссылка, всё с
|
|
24
|
+
* `tabindex`. `null` — узел лежит в разметке без контрола.
|
|
25
|
+
*
|
|
26
|
+
* Кандидат, а не остановка: выключенное поле, радио не первое в группе и
|
|
27
|
+
* строка с `tabindex="-1"` в roving tabindex остановками не бывают, но с ними
|
|
28
|
+
* работают указателем. Об этом спрашивают жест выезжающей панели — тянуть её
|
|
29
|
+
* можно за любое место, кроме контролов, — и сетка таблицы — нажатие по
|
|
30
|
+
* контролу ячейки строку не выбирает. Список тот же, что у остановок: свой
|
|
31
|
+
* набор селекторов разошёлся бы с ним.
|
|
32
|
+
*/
|
|
33
|
+
export declare function closestControl(node: Element, scope: Element): Element | null;
|
|
34
|
+
/**
|
|
35
|
+
* Остановка Tab, в которой лежит узел, — ближайший к нему кандидат между узлом
|
|
36
|
+
* и `scope` (сам `scope` не в счёт), который и есть остановка. Кандидаты по
|
|
37
|
+
* дороге, которые остановками не бывают — `tabindex="-1"`, выключенное поле, —
|
|
38
|
+
* пропускаются. `null` — остановки нет ни на узле, ни над ним до `scope`.
|
|
39
|
+
*
|
|
40
|
+
* Об этом спрашивает поле Select (`TSelectPointerPlugin`): нажатие мимо его
|
|
41
|
+
* остановок гасится, и фокус остаётся в поле. Кандидаты и правило остановки —
|
|
42
|
+
* те же, что у `tabStops`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function closestTabStop(node: Element, scope: Element): Element | null;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//#region src/utils/tabStops.ts
|
|
2
|
+
/**
|
|
3
|
+
* Остановки Tab — элементы, на которые браузер ставит фокус клавишей Tab, в
|
|
4
|
+
* порядке документа.
|
|
5
|
+
*
|
|
6
|
+
* Браузер этот порядок наружу не отдаёт, поэтому он восстанавливается по
|
|
7
|
+
* разметке: что фокусируется само, что получило `tabindex`, что выключено.
|
|
8
|
+
* Раскладку поиск не проверяет — в jsdom её нет, а в браузере скрытый
|
|
9
|
+
* элемент сам не примет фокус: кандидатов перебирают по очереди, пока один
|
|
10
|
+
* не примет (`focusFirst`). Положительный `tabindex` порядок не меняет: он
|
|
11
|
+
* ломает порядок обхода и в APG не рекомендован.
|
|
12
|
+
*
|
|
13
|
+
* Живёт в общих утилитах, а не у модели фокуса Popover: спрашивают об этом
|
|
14
|
+
* поповер (куда уводить фокус), лента (становиться ли ей самой остановкой
|
|
15
|
+
* Tab), поле Select (не остановка ли под указателем, `closestTabStop`), а не
|
|
16
|
+
* контрол ли под указателем (`closestControl`), — жест выезжающей панели и
|
|
17
|
+
* сетка таблицы. Свой список селекторов у любого из них был бы вторым путём к
|
|
18
|
+
* тому же знанию.
|
|
19
|
+
*/
|
|
20
|
+
/** Элементы, которые встают в порядок Tab сами, без `tabindex`. */
|
|
21
|
+
var NATIVE_STOPS = [
|
|
22
|
+
"a[href]",
|
|
23
|
+
"area[href]",
|
|
24
|
+
"button",
|
|
25
|
+
"input:not([type=\"hidden\"])",
|
|
26
|
+
"select",
|
|
27
|
+
"textarea",
|
|
28
|
+
"iframe",
|
|
29
|
+
"audio[controls]",
|
|
30
|
+
"video[controls]",
|
|
31
|
+
"summary",
|
|
32
|
+
"[contenteditable]:not([contenteditable=\"false\"])"
|
|
33
|
+
].join(",");
|
|
34
|
+
var CANDIDATES = `${NATIVE_STOPS},[tabindex]`;
|
|
35
|
+
/** Остановки Tab внутри узла или документа, в порядке документа. */
|
|
36
|
+
function tabStops(scope) {
|
|
37
|
+
return [...scope.querySelectorAll(CANDIDATES)].filter(isTabStop);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Контрол, в котором лежит узел, — ближайший кандидат в остановки Tab между
|
|
41
|
+
* узлом и `scope` (сам `scope` не в счёт): поле, кнопка, ссылка, всё с
|
|
42
|
+
* `tabindex`. `null` — узел лежит в разметке без контрола.
|
|
43
|
+
*
|
|
44
|
+
* Кандидат, а не остановка: выключенное поле, радио не первое в группе и
|
|
45
|
+
* строка с `tabindex="-1"` в roving tabindex остановками не бывают, но с ними
|
|
46
|
+
* работают указателем. Об этом спрашивают жест выезжающей панели — тянуть её
|
|
47
|
+
* можно за любое место, кроме контролов, — и сетка таблицы — нажатие по
|
|
48
|
+
* контролу ячейки строку не выбирает. Список тот же, что у остановок: свой
|
|
49
|
+
* набор селекторов разошёлся бы с ним.
|
|
50
|
+
*/
|
|
51
|
+
function closestControl(node, scope) {
|
|
52
|
+
const control = node.closest(CANDIDATES);
|
|
53
|
+
return control && control !== scope && scope.contains(control) ? control : null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Остановка Tab, в которой лежит узел, — ближайший к нему кандидат между узлом
|
|
57
|
+
* и `scope` (сам `scope` не в счёт), который и есть остановка. Кандидаты по
|
|
58
|
+
* дороге, которые остановками не бывают — `tabindex="-1"`, выключенное поле, —
|
|
59
|
+
* пропускаются. `null` — остановки нет ни на узле, ни над ним до `scope`.
|
|
60
|
+
*
|
|
61
|
+
* Об этом спрашивает поле Select (`TSelectPointerPlugin`): нажатие мимо его
|
|
62
|
+
* остановок гасится, и фокус остаётся в поле. Кандидаты и правило остановки —
|
|
63
|
+
* те же, что у `tabStops`.
|
|
64
|
+
*/
|
|
65
|
+
function closestTabStop(node, scope) {
|
|
66
|
+
let candidate = node.closest(CANDIDATES);
|
|
67
|
+
while (candidate && candidate !== scope && scope.contains(candidate)) {
|
|
68
|
+
if (isTabStop(candidate)) return candidate;
|
|
69
|
+
candidate = candidate.parentElement?.closest(CANDIDATES) ?? null;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function isTabStop(element) {
|
|
74
|
+
const tabindex = explicitTabIndex(element);
|
|
75
|
+
if (tabindex === null ? !element.matches(NATIVE_STOPS) : tabindex < 0) return false;
|
|
76
|
+
if (element.matches(":disabled") || element.closest("[inert]")) return false;
|
|
77
|
+
return isRadioStop(element);
|
|
78
|
+
}
|
|
79
|
+
/** Значение атрибута `tabindex`; `null` — атрибута нет или он не число. */
|
|
80
|
+
function explicitTabIndex(element) {
|
|
81
|
+
const value = element.getAttribute("tabindex");
|
|
82
|
+
if (value === null) return null;
|
|
83
|
+
const parsed = Number.parseInt(value, 10);
|
|
84
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Группа радио с общим `name` — одна остановка: выбранное радио, а если
|
|
88
|
+
* выбранного нет — первое. По остальным ходят стрелки. Без этого последним в
|
|
89
|
+
* панели считалось бы последнее радио группы, и Tab с выбранного первого
|
|
90
|
+
* уводил бы фокус мимо правила «из панели — к тому, что за триггером».
|
|
91
|
+
*/
|
|
92
|
+
function isRadioStop(element) {
|
|
93
|
+
if (!(element instanceof HTMLInputElement) || element.type !== "radio" || !element.name) return true;
|
|
94
|
+
const group = radioGroup(element);
|
|
95
|
+
const checked = group.find((radio) => radio.checked);
|
|
96
|
+
return checked ? checked === element : group[0] === element;
|
|
97
|
+
}
|
|
98
|
+
function radioGroup(radio) {
|
|
99
|
+
return [...(radio.form ?? radio.ownerDocument).querySelectorAll("input[type=\"radio\"]")].filter((candidate) => candidate instanceof HTMLInputElement && candidate.name === radio.name && candidate.form === radio.form);
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
export { closestControl, closestTabStop, tabStops };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Остановки после узла в порядке документа — без его потомков и без
|
|
3
|
+
* `exclude`: Tab из телепортированной панели ведёт к тому, что стоит в
|
|
4
|
+
* документе за триггером, а сама панель лежит в конце `body`.
|
|
5
|
+
*
|
|
6
|
+
* Спрашивает об этом немодальный оверлей: у модального Tab замкнут в панели,
|
|
7
|
+
* и что стоит за ней, его не касается. Список остановок берётся у `tabStops`
|
|
8
|
+
* — второй набор селекторов разошёлся бы с первым.
|
|
9
|
+
*/
|
|
10
|
+
export declare function tabStopsAfter(node: Element, exclude: Element | null): Element[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tabStops } from "./tabStops.js";
|
|
2
|
+
//#region src/utils/tabStopsAfter.ts
|
|
3
|
+
/**
|
|
4
|
+
* Остановки после узла в порядке документа — без его потомков и без
|
|
5
|
+
* `exclude`: Tab из телепортированной панели ведёт к тому, что стоит в
|
|
6
|
+
* документе за триггером, а сама панель лежит в конце `body`.
|
|
7
|
+
*
|
|
8
|
+
* Спрашивает об этом немодальный оверлей: у модального Tab замкнут в панели,
|
|
9
|
+
* и что стоит за ней, его не касается. Список остановок берётся у `tabStops`
|
|
10
|
+
* — второй набор селекторов разошёлся бы с первым.
|
|
11
|
+
*/
|
|
12
|
+
function tabStopsAfter(node, exclude) {
|
|
13
|
+
return tabStops(node.ownerDocument).filter((stop) => !node.contains(stop) && !exclude?.contains(stop) && (node.compareDocumentPosition(stop) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { tabStopsAfter };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Остановки перед узлом в порядке документа — без его потомков: Shift+Tab из
|
|
3
|
+
* виджета, который водит Tab сам, ведёт к тому, что стоит в документе перед
|
|
4
|
+
* ним. Предок узла с остановкой — тоже перед ним: в порядке Tab он раньше
|
|
5
|
+
* своих потомков.
|
|
6
|
+
*
|
|
7
|
+
* Пара к `tabStopsAfter`, и список остановок тот же — у `tabStops`: второй
|
|
8
|
+
* набор селекторов разошёлся бы с первым. Спрашивает сетка таблицы: её Tab —
|
|
9
|
+
* одна остановка, и уходит он из неё сам.
|
|
10
|
+
*/
|
|
11
|
+
export declare function tabStopsBefore(node: Element): Element[];
|