@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,820 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { TElementPlugin } from "../../element/element.plugin.js";
|
|
3
|
+
import { afterTransitions } from "../../../utils/afterTransitions.js";
|
|
4
|
+
import { isPinnedToViewport, positionOriginOf } from "../../../utils/positionOrigin.js";
|
|
5
|
+
//#region src/custom/frame/anchor/anchor.plugin.ts
|
|
6
|
+
/**
|
|
7
|
+
* Атрибут фактической стороны панели после flip: плагин пишет его в `dataset`
|
|
8
|
+
* Frame. Читают его тема и плагин жеста (`TSwipePlugin`): панель у триггера
|
|
9
|
+
* уходит жестом от него, а под ним она или над ним, знает только её узел.
|
|
10
|
+
*
|
|
11
|
+
* Имя с префиксом `data-`: по нему читают узел, а `dataset` принимает имя с
|
|
12
|
+
* префиксом как есть.
|
|
13
|
+
*/
|
|
14
|
+
var ANCHOR_PLACEMENT_ATTRIBUTE = "data-placement";
|
|
15
|
+
/** Сторона напротив — на той же оси: flip переносит панель, но не поворачивает. */
|
|
16
|
+
var OPPOSITE = {
|
|
17
|
+
top: "bottom",
|
|
18
|
+
bottom: "top",
|
|
19
|
+
start: "end",
|
|
20
|
+
end: "start"
|
|
21
|
+
};
|
|
22
|
+
var opposite = (side) => OPPOSITE[side];
|
|
23
|
+
/** Сторона на оси строки — панель сбоку от якоря. */
|
|
24
|
+
var isInlineSide = (side) => side === "start" || side === "end";
|
|
25
|
+
/**
|
|
26
|
+
* Стоит ли сторона строки слева от якоря: в LTR — начало, в RTL — конец.
|
|
27
|
+
* Физическая сторона нужна только расчёту — наружу (`data-placement`) уходит
|
|
28
|
+
* логическая.
|
|
29
|
+
*/
|
|
30
|
+
var isLeftSide = (side, rtl) => side === "start" !== rtl;
|
|
31
|
+
/**
|
|
32
|
+
* Shift: отрезок длиной `size` с началом `start` сдвигается внутрь
|
|
33
|
+
* `[0, limit]`, чтобы не вылезал ни с одной стороны. Длиннее границы —
|
|
34
|
+
* прижимается к нулю: видно хотя бы начало.
|
|
35
|
+
*/
|
|
36
|
+
var shiftInto = (start, size, limit) => Math.min(Math.max(start, 0), Math.max(0, limit - size));
|
|
37
|
+
/** Одна ли это точка: координаты те же, или точки нет у обеих. */
|
|
38
|
+
var samePoint = (a, b) => a === b || a !== null && b !== null && a.x === b.x && a.y === b.y;
|
|
39
|
+
/**
|
|
40
|
+
* TAnchorPlugin — привязка Frame к чужому элементу.
|
|
41
|
+
*
|
|
42
|
+
* Общий слой для всего, что открывается у чего-то: выпадающий список Select,
|
|
43
|
+
* меню у кнопки, поповер, подсказка. Сам ничего не рисует — вычисляет
|
|
44
|
+
* координаты и пишет их во Frame (`x`, `y`, при `matchWidth` ещё `width`).
|
|
45
|
+
* Дальше их раскладывает `TFrameLayoutPlugin`, как любые другие координаты.
|
|
46
|
+
*
|
|
47
|
+
* Разделение не формальное: раскладка отвечает за собственные пропсы Frame,
|
|
48
|
+
* привязка — за слежение за посторонним элементом. Смешивать их значит
|
|
49
|
+
* заводить в одном плагине два повода меняться.
|
|
50
|
+
*
|
|
51
|
+
* **Место считается, пока панель на экране** — показана или ещё гаснет.
|
|
52
|
+
* Закрытые панели у полей — списки Select, подсказки, меню, календари
|
|
53
|
+
* DatePicker — стоят на странице десятками, и каждая на каждом кадре
|
|
54
|
+
* прокрутки меряла бы свой якорь и писала бы во Frame новые координаты.
|
|
55
|
+
* Поэтому якорь плагин запоминает сразу, а слежение за ним (`_subscribe`)
|
|
56
|
+
* заводит показ Frame, у Frame, созданного видимым, — назначение якоря.
|
|
57
|
+
* Снимает его конец закрытия: когда корень доиграл переходы закрытия
|
|
58
|
+
* (`afterTransitions`), — гаснущая и уходящая жестом панель идёт за полем до
|
|
59
|
+
* конца. Новый показ ожидание отменяет. Снятие места — якоря, когда точки нет,
|
|
60
|
+
* и точки, когда нет якоря, — и `destroy()` снимают слежение сразу, снятый
|
|
61
|
+
* корень — тоже: панели на экране нет, и ждать её перехода незачем, — а новый
|
|
62
|
+
* корень показанной панели слежение возвращает.
|
|
63
|
+
* Вне слежения место не считает ничто — ни прокрутка, ни наблюдатель панели,
|
|
64
|
+
* ни сеттеры, — на любой стороне, сбоку тоже: показ считает его заново.
|
|
65
|
+
* Открытость плагин ведёт сам, по `show` и `hide` своего Frame, а не
|
|
66
|
+
* адаптер: якорь только у открытой панели развёл бы это правило по шести
|
|
67
|
+
* адаптерам.
|
|
68
|
+
*
|
|
69
|
+
* `placement` — сторона и выравнивание по якорю: `-start` — по началу, `-end` —
|
|
70
|
+
* по концу, без суффикса — по центру. Стороны блока, `top` и `bottom`, ставят
|
|
71
|
+
* панель над якорем или под ним, и выравнивание идёт вдоль строки. Стороны
|
|
72
|
+
* строки, `start` и `end`, ставят её у начала или конца строки якоря, и
|
|
73
|
+
* выравнивание идёт вдоль якоря по вертикали: `-start` — верхние края вровень,
|
|
74
|
+
* `-end` — нижние. Поверх этого выбора плагин сам решает две вещи:
|
|
75
|
+
* **flip** — если панель не влезает с выбранной стороны (сверху и снизу — по
|
|
76
|
+
* высоте, сбоку — по ширине), а с противоположной места больше, показывает её
|
|
77
|
+
* там; **shift** — сдвигает панель вдоль якоря, чтобы она не вылезала за край:
|
|
78
|
+
* у верха и низа — `x`, у боковой — `y`. Границей обоим служит видимая область
|
|
79
|
+
* окна, без классической полосы прокрутки (см. `_viewport`). Оба работают
|
|
80
|
+
* внутри тех же вариантов `placement`: flip переключает только сторону, на той
|
|
81
|
+
* же оси, — выравнивание, центр в том числе, остаётся, — а shift не меняет
|
|
82
|
+
* `placement` и только ограничивает координату. Flip выключается свойством
|
|
83
|
+
* `flip` (по умолчанию включён): панель остаётся на стороне потребителя, даже
|
|
84
|
+
* если там не влезает. Shift от него не зависит.
|
|
85
|
+
*
|
|
86
|
+
* Боковая панель сверх того прижимается к краям окна и по `x`: не влезла ни с
|
|
87
|
+
* одной стороны (узкий экран, широкое содержимое вроде календаря) — накрывает
|
|
88
|
+
* якорь, но видна целиком. У верха и низа этот случай закрывает потолок высоты
|
|
89
|
+
* панели в теме, а потолка ширины у произвольного содержимого нет.
|
|
90
|
+
*
|
|
91
|
+
* У flip есть память. Правило выше только выбирает сторону (`_chooseSide`), а
|
|
92
|
+
* открытая панель свою держит (`_holdSide`): пока на ней влезает — стоит, не
|
|
93
|
+
* влезла — переходит на противоположную, только если влезает там, не влезает
|
|
94
|
+
* нигде — стоит. Правило без памяти скакало: одна и та же граница «снизу
|
|
95
|
+
* влезает» и уводила панель наверх, и возвращала её вниз. На телефоне палец
|
|
96
|
+
* двигает страницу по пикселю туда и обратно, адресная строка браузера
|
|
97
|
+
* прячется и выезжает, и поле всё время стоит на этой границе, а на коротком
|
|
98
|
+
* экране, где панель не влезает нигде, сторона менялась на каждом переходе
|
|
99
|
+
* поля через середину экрана. Так же поступает CSS Anchor Positioning — держит
|
|
100
|
+
* последний удачный вариант. Сбоку правило и память те же, только место
|
|
101
|
+
* меряется по ширине: границу «сбоку влезает» якорь переходит при прокрутке
|
|
102
|
+
* вбок и смене ширины окна. Сторону забывают показ Frame, смена `placement` и
|
|
103
|
+
* `flip`, смена и снятие якоря и `contained`, и следующий расчёт выбирает её
|
|
104
|
+
* заново. Закрытие её не забывает: гаснущая панель держит сторону, как
|
|
105
|
+
* открытая.
|
|
106
|
+
*
|
|
107
|
+
* `RTL` (`getComputedStyle(anchor).direction`) разворачивает ось строки. У
|
|
108
|
+
* верха и низа — выравнивание: в RTL `-start` выравнивает панель по правому
|
|
109
|
+
* краю якоря, `-end` — по левому. У боковой — сторону: в RTL `start` справа
|
|
110
|
+
* от якоря, `end` — слева. Центр и выравнивание боковой панели по вертикали
|
|
111
|
+
* от направления не зависят.
|
|
112
|
+
*
|
|
113
|
+
* Фактическая сторона после flip уходит теме через `data-placement` на самом
|
|
114
|
+
* Frame (`frame.dataset`) — она не всегда совпадает с тем, что задал
|
|
115
|
+
* потребитель в `placement`. Выравнивание в ней — потребителя, а сторона
|
|
116
|
+
* логическая и в RTL: `end-start`, перенесённый flip-ом, — `start-start`.
|
|
117
|
+
*
|
|
118
|
+
* `position` панели у якоря выбирает плагин (`_choosePosition`), как пишет
|
|
119
|
+
* её `x` и `y`: `absolute`, а у якоря, который стоит в окне, — `fixed`.
|
|
120
|
+
* Панель `fixed` прокрутку страницы не замечает, и сдвинуть её за полем
|
|
121
|
+
* может только пересчёт по `scroll`. На телефоне страницу прокручивает
|
|
122
|
+
* композитор, а `scroll` приходит в JS кадром позже: поле уже уехало, панель
|
|
123
|
+
* кадр стоит и догоняет — дрожит на каждом кадре прокрутки. Ни кадр
|
|
124
|
+
* (`requestAnimationFrame`), ни память стороны этого не снимают. Панель
|
|
125
|
+
* `absolute` лежит в документе, и окно браузер прокручивает вместе с ней и
|
|
126
|
+
* полем, без JS, — так у PrimeVue. Якорь в окне (`fixed` или `sticky` к
|
|
127
|
+
* окну, `isPinnedToViewport`) прокрутка окна не двигает, и панель `absolute`
|
|
128
|
+
* отставала бы от него наоборот — у него `fixed`. Выбирают заново показ Frame
|
|
129
|
+
* и смена якоря у показанной панели.
|
|
130
|
+
*
|
|
131
|
+
* Внутренняя прокрутка — граница, а не недоделка. Поле в своём прокручиваемом
|
|
132
|
+
* блоке, а панель в `body`: её отставание на кадр снимет только CSS Anchor
|
|
133
|
+
* Positioning, где место считает браузер, — или `target` панели в самом
|
|
134
|
+
* блоке, и тогда она едет вместе с ним.
|
|
135
|
+
*
|
|
136
|
+
* **Точка** (`point`) — место вместо якоря: контекстное меню встаёт у места
|
|
137
|
+
* вызова, а не у области, в которой его вызвали. Точка главнее якоря, пока
|
|
138
|
+
* задана, — иначе выбирать, к чему привязать панель, пришлось бы шаблону, —
|
|
139
|
+
* а снятая возвращает панель к якорю. Это прямоугольник нулевого размера в
|
|
140
|
+
* координатах окна, и расчёт у него тот же: стороны, flip, shift, RTL
|
|
141
|
+
* (направление — якоря, без него — самой панели) и `data-placement`, и
|
|
142
|
+
* считается он так же, пока панель на экране: у закрытой точка только
|
|
143
|
+
* запоминается. Своего у точки три вещи: панель `fixed` — точка стоит в окне,
|
|
144
|
+
* как якорь в `fixed`-шапке; пересчёт только на смену размера окна —
|
|
145
|
+
* прокрутка и размер чужого элемента точку не двигают, и наблюдателя якоря у
|
|
146
|
+
* неё нет; `matchWidth` не действует — ширины у точки нет. Новая точка, как
|
|
147
|
+
* новый якорь, выбирает сторону заново.
|
|
148
|
+
*
|
|
149
|
+
* Считается всё в координатах окна (`getBoundingClientRect()`), а во Frame
|
|
150
|
+
* уходит от угла блока, от которого браузер отсчитывает `left`/`top` панели
|
|
151
|
+
* (`positionOriginOf`): у `absolute` в `body` это начало документа, в
|
|
152
|
+
* позиционированном предке — его угол с прокруткой, у `fixed` — окно или
|
|
153
|
+
* предок с трансформацией. Панель внутри контейнера (`contained`) якорь не
|
|
154
|
+
* двигает: её место в контейнере решает тема, и стороны у неё нет —
|
|
155
|
+
* `data-placement` снимается.
|
|
156
|
+
*
|
|
157
|
+
* По той же причине оба наблюдателя (`ResizeObserver`) смотрят border-box:
|
|
158
|
+
* наблюдать надо ровно то, что меряем. Умолчание `content-box` пропустило бы
|
|
159
|
+
* смену одной рамки или паддинга — толщина рамки по состоянию, паддинг по
|
|
160
|
+
* размеру, — и координаты держались бы устаревшими до ближайшего
|
|
161
|
+
* scroll/resize окна.
|
|
162
|
+
*/
|
|
163
|
+
var TAnchorPlugin = class TAnchorPlugin extends TBasePlugin {
|
|
164
|
+
/**
|
|
165
|
+
* Умолчания пропов плагина. Из них стартуют поля плагина, и их же
|
|
166
|
+
* `definePlugin` кладёт в декларации пропов: значение живёт в одном месте.
|
|
167
|
+
* `flip: true` в приватном поле адаптер не увидел бы и отдал бы Frame без
|
|
168
|
+
* `anchor_flip` своё `false`.
|
|
169
|
+
*
|
|
170
|
+
* `anchor: null` — «панель ни к чему не привязана». Якорь не опция, его
|
|
171
|
+
* задаёт только разметка, но умолчание объявлено и ему: снятый из разметки
|
|
172
|
+
* проп связка возвращает к умолчанию декларации, и без него панель
|
|
173
|
+
* оставалась бы привязанной к прежнему элементу. Так же `point: null` —
|
|
174
|
+
* «точки нет, панель у якоря».
|
|
175
|
+
*/
|
|
176
|
+
static defaultValues = {
|
|
177
|
+
anchor: null,
|
|
178
|
+
point: null,
|
|
179
|
+
placement: "bottom-start",
|
|
180
|
+
matchWidth: false,
|
|
181
|
+
flip: true,
|
|
182
|
+
offset: 0
|
|
183
|
+
};
|
|
184
|
+
_frame = null;
|
|
185
|
+
_element = null;
|
|
186
|
+
/** Якорю нужны только `getBoundingClientRect()` и `parentElement` — хватает `Element`. */
|
|
187
|
+
_anchor = TAnchorPlugin.defaultValues.anchor;
|
|
188
|
+
/** Точка в координатах окна — главнее якоря, пока задана. */
|
|
189
|
+
_point = TAnchorPlugin.defaultValues.point;
|
|
190
|
+
_placement = TAnchorPlugin.defaultValues.placement;
|
|
191
|
+
_matchWidth = TAnchorPlugin.defaultValues.matchWidth;
|
|
192
|
+
_flip = TAnchorPlugin.defaultValues.flip;
|
|
193
|
+
_offset = TAnchorPlugin.defaultValues.offset;
|
|
194
|
+
_cleanups = [];
|
|
195
|
+
_panelObserver = null;
|
|
196
|
+
/**
|
|
197
|
+
* Кадр, в котором вернётся наблюдение панели, снятое на уведомление якоря
|
|
198
|
+
* (см. `_onAnchorResize`); `null` — возвращать нечего.
|
|
199
|
+
*/
|
|
200
|
+
_panelResumeFrame = null;
|
|
201
|
+
/** Сторона, реально отданная во Frame — по ней решаем, менялся ли `data-placement`. */
|
|
202
|
+
_actualPlacement = null;
|
|
203
|
+
/**
|
|
204
|
+
* Сторона, которую держит панель (см. `_holdSide`); `null` — держать
|
|
205
|
+
* нечего, и сторону выбирает `_chooseSide`. Она всегда на оси выбора
|
|
206
|
+
* потребителя: смена `placement` память забывает.
|
|
207
|
+
*
|
|
208
|
+
* Запоминает её только расчёт с разложенной панелью — высотой больше нуля.
|
|
209
|
+
* На `show` закрытая панель ещё не разложена (`display: none`), а нулевой
|
|
210
|
+
* размер влезает с любой стороны: запомненная по нему сторона держалась бы
|
|
211
|
+
* на первом настоящем измерении вместо выбора. Поэтому `_actualPlacement`
|
|
212
|
+
* памятью не служит — его пишет любой расчёт. Признак раскладки — высота и
|
|
213
|
+
* у боковой панели, которой место меряют по ширине: ширину при
|
|
214
|
+
* `matchWidth` даёт якорь и до раскладки, а высоту знает только узел.
|
|
215
|
+
*/
|
|
216
|
+
_heldSide = null;
|
|
217
|
+
/**
|
|
218
|
+
* Слежение идёт: панель показана или ещё гаснет (см. описание класса). Вне
|
|
219
|
+
* слежения у плагина нет подписок на якорь, и место он не считает.
|
|
220
|
+
*/
|
|
221
|
+
_following = false;
|
|
222
|
+
/** Отмена ожидания конца перехода закрытия; `null` — плагин не ждёт. */
|
|
223
|
+
_stopWaiting = null;
|
|
224
|
+
install(ctx, options) {
|
|
225
|
+
super.install(ctx, options);
|
|
226
|
+
this._placement = options?.placement ?? this._placement;
|
|
227
|
+
this._matchWidth = options?.matchWidth ?? this._matchWidth;
|
|
228
|
+
this._flip = options?.flip ?? this._flip;
|
|
229
|
+
this._offset = options?.offset ?? this._offset;
|
|
230
|
+
this._frame = ctx.getInstance() ?? null;
|
|
231
|
+
this._following = this._frame?.visible ?? false;
|
|
232
|
+
const elementPlugin = ctx.get(TElementPlugin);
|
|
233
|
+
elementPlugin?.events.on("ready", (element) => {
|
|
234
|
+
this._cancelPanelResume();
|
|
235
|
+
this._element = element;
|
|
236
|
+
this._panelObserver?.disconnect();
|
|
237
|
+
this._panelObserver = new ResizeObserver(() => this._update());
|
|
238
|
+
this._panelObserver.observe(element, { box: "border-box" });
|
|
239
|
+
if (!this._following && this._frame?.visible) this._follow();
|
|
240
|
+
this._update();
|
|
241
|
+
});
|
|
242
|
+
elementPlugin?.events.on("removed", () => {
|
|
243
|
+
this._cancelPanelResume();
|
|
244
|
+
this._panelObserver?.disconnect();
|
|
245
|
+
this._panelObserver = null;
|
|
246
|
+
this._element = null;
|
|
247
|
+
this._unfollow();
|
|
248
|
+
});
|
|
249
|
+
this._listenTo(this._frame?.events, "show", () => {
|
|
250
|
+
this._heldSide = null;
|
|
251
|
+
this._choosePosition();
|
|
252
|
+
this._follow();
|
|
253
|
+
this._update();
|
|
254
|
+
});
|
|
255
|
+
this._listenTo(this._frame?.events, "hide", () => this._unfollowAfterTransitions());
|
|
256
|
+
this._listenTo(this._frame?.events, "change:contained", () => this._update());
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Назначает якорь. У закрытой панели якорь только запоминается: место
|
|
260
|
+
* посчитает показ.
|
|
261
|
+
*/
|
|
262
|
+
setAnchor(element) {
|
|
263
|
+
const oldAnchor = this.anchor;
|
|
264
|
+
if (this._anchor === element) return;
|
|
265
|
+
this._anchor = element;
|
|
266
|
+
this._onPlaceChange();
|
|
267
|
+
this.events.emit("change:anchor", {
|
|
268
|
+
newValue: element,
|
|
269
|
+
oldValue: oldAnchor
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
removeAnchor() {
|
|
273
|
+
const oldAnchor = this.anchor;
|
|
274
|
+
if (!this._anchor) return;
|
|
275
|
+
this._anchor = null;
|
|
276
|
+
this._onPlaceChange();
|
|
277
|
+
this.events.emit("change:anchor", {
|
|
278
|
+
newValue: null,
|
|
279
|
+
oldValue: oldAnchor
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
get anchor() {
|
|
283
|
+
return this._anchor;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Точка в координатах окна, у которой встаёт панель, — главнее якоря,
|
|
287
|
+
* пока задана (см. описание класса). Значение: сверяется по координатам, и
|
|
288
|
+
* та же точка ничего не пересчитывает. У закрытой панели только
|
|
289
|
+
* запоминается, как якорь.
|
|
290
|
+
*/
|
|
291
|
+
get point() {
|
|
292
|
+
return this._point;
|
|
293
|
+
}
|
|
294
|
+
set point(value) {
|
|
295
|
+
const oldPoint = this.point;
|
|
296
|
+
if (samePoint(this._point, value)) return;
|
|
297
|
+
this._point = value === null ? null : {
|
|
298
|
+
x: value.x,
|
|
299
|
+
y: value.y
|
|
300
|
+
};
|
|
301
|
+
this._onPlaceChange();
|
|
302
|
+
this.events.emit("change:point", {
|
|
303
|
+
newValue: this._point,
|
|
304
|
+
oldValue: oldPoint
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
get placement() {
|
|
308
|
+
return this._placement;
|
|
309
|
+
}
|
|
310
|
+
set placement(value) {
|
|
311
|
+
const oldPlacement = this.placement;
|
|
312
|
+
if (this._placement === value) return;
|
|
313
|
+
this._placement = value;
|
|
314
|
+
this._heldSide = null;
|
|
315
|
+
this._update();
|
|
316
|
+
this.events.emit("change:placement", {
|
|
317
|
+
newValue: value,
|
|
318
|
+
oldValue: oldPlacement
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
get matchWidth() {
|
|
322
|
+
return this._matchWidth;
|
|
323
|
+
}
|
|
324
|
+
set matchWidth(value) {
|
|
325
|
+
const oldMatchWidth = this.matchWidth;
|
|
326
|
+
if (this._matchWidth === value) return;
|
|
327
|
+
this._matchWidth = value;
|
|
328
|
+
this._update();
|
|
329
|
+
this.events.emit("change:matchWidth", {
|
|
330
|
+
newValue: value,
|
|
331
|
+
oldValue: oldMatchWidth
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
get flip() {
|
|
335
|
+
return this._flip;
|
|
336
|
+
}
|
|
337
|
+
set flip(value) {
|
|
338
|
+
const oldFlip = this.flip;
|
|
339
|
+
if (this._flip === value) return;
|
|
340
|
+
this._flip = value;
|
|
341
|
+
this._heldSide = null;
|
|
342
|
+
this._update();
|
|
343
|
+
this.events.emit("change:flip", {
|
|
344
|
+
newValue: value,
|
|
345
|
+
oldValue: oldFlip
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
get offset() {
|
|
349
|
+
return this._offset;
|
|
350
|
+
}
|
|
351
|
+
set offset(value) {
|
|
352
|
+
const oldOffset = this.offset;
|
|
353
|
+
if (this._offset === value) return;
|
|
354
|
+
this._offset = value;
|
|
355
|
+
this._update();
|
|
356
|
+
this.events.emit("change:offset", {
|
|
357
|
+
newValue: value,
|
|
358
|
+
oldValue: oldOffset
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
destroy() {
|
|
362
|
+
this._unfollow();
|
|
363
|
+
this._cancelPanelResume();
|
|
364
|
+
this._panelObserver?.disconnect();
|
|
365
|
+
this._panelObserver = null;
|
|
366
|
+
this._frame = null;
|
|
367
|
+
this._element = null;
|
|
368
|
+
this._anchor = null;
|
|
369
|
+
this._point = null;
|
|
370
|
+
super.destroy();
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Место панели сменилось — якорь или точка. Сторону следующий расчёт
|
|
374
|
+
* выбирает заново: прошлую выбрали у другого места. Места не осталось —
|
|
375
|
+
* панель ни к чему не привязана: подписок нет, и стороны, которую видит
|
|
376
|
+
* тема, тоже. У закрытой панели место только запоминается — посчитает его
|
|
377
|
+
* показ, — у показанной `position`, подписки и координаты — по новому
|
|
378
|
+
* месту.
|
|
379
|
+
*/
|
|
380
|
+
_onPlaceChange() {
|
|
381
|
+
this._heldSide = null;
|
|
382
|
+
if (!this._anchor && !this._point) {
|
|
383
|
+
this._unsubscribe();
|
|
384
|
+
this._actualPlacement = null;
|
|
385
|
+
this._frame?.dataset.add(ANCHOR_PLACEMENT_ATTRIBUTE, null);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
if (!this._following) return;
|
|
389
|
+
this._choosePosition();
|
|
390
|
+
this._subscribe();
|
|
391
|
+
this._update();
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Прямоугольник места панели в координатах окна: у точки — нулевого
|
|
395
|
+
* размера, иначе якоря. Нет ни того, ни другого — `null`.
|
|
396
|
+
*/
|
|
397
|
+
_placeRect() {
|
|
398
|
+
const point = this._point;
|
|
399
|
+
if (point) return {
|
|
400
|
+
left: point.x,
|
|
401
|
+
right: point.x,
|
|
402
|
+
top: point.y,
|
|
403
|
+
bottom: point.y,
|
|
404
|
+
width: 0
|
|
405
|
+
};
|
|
406
|
+
return this._anchor?.getBoundingClientRect() ?? null;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Письмо справа налево — у якоря, а у точки без якоря — у самой панели:
|
|
410
|
+
* начало у точки там же, откуда идёт строка вокруг неё.
|
|
411
|
+
*/
|
|
412
|
+
get _rtl() {
|
|
413
|
+
const source = this._anchor ?? this._element;
|
|
414
|
+
return source !== null && getComputedStyle(source).direction === "rtl";
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Тянуть ширину панели есть по чему, только пока место — якорь: ширины у
|
|
418
|
+
* точки нет, и `matchWidth` с ней панель не сжимает.
|
|
419
|
+
*/
|
|
420
|
+
get _matchesWidth() {
|
|
421
|
+
return this._matchWidth && this._point === null;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Считает координаты и кладёт их во Frame.
|
|
425
|
+
*
|
|
426
|
+
* Вне слежения не считает ничего, на какой бы стороне ни стояла панель:
|
|
427
|
+
* закрытой панели место не нужно, его посчитает показ (см. описание
|
|
428
|
+
* класса).
|
|
429
|
+
*
|
|
430
|
+
* Расчёт выбирает сторона после flip. Над якорем и под ним `x` идёт от
|
|
431
|
+
* выравнивания по строке (`_resolveX`), а `y` — от стороны. Сбоку наоборот:
|
|
432
|
+
* `x` — от стороны (`_inlineX`), `y` — от выравнивания по вертикали
|
|
433
|
+
* (`_inlineY`). Место — якорь или точка (`_placeRect`).
|
|
434
|
+
*
|
|
435
|
+
* При `matchWidth` ширину панели для `x` и shift даёт якорь (см.
|
|
436
|
+
* `_panelSize`), а не записанный во Frame `width`: до DOM он доедет только
|
|
437
|
+
* после рендера адаптера.
|
|
438
|
+
*/
|
|
439
|
+
_update() {
|
|
440
|
+
if (!this._following) return;
|
|
441
|
+
const frame = this._frame;
|
|
442
|
+
if (frame?.contained) {
|
|
443
|
+
this._heldSide = null;
|
|
444
|
+
this._applyPlacement(null);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const rect = this._placeRect();
|
|
448
|
+
if (!frame || !rect) return;
|
|
449
|
+
const panel = this._panelSize(rect);
|
|
450
|
+
if (this._matchesWidth) frame.width = rect.width;
|
|
451
|
+
const rtl = this._rtl;
|
|
452
|
+
const alignment = this._alignment;
|
|
453
|
+
const side = this._resolveSide(rect, panel, rtl);
|
|
454
|
+
const origin = positionOriginOf(this._element, frame.strategy);
|
|
455
|
+
if (isInlineSide(side)) {
|
|
456
|
+
frame.x = this._inlineX(side, rect, panel.width, rtl) - origin.x;
|
|
457
|
+
frame.y = this._inlineY(rect, panel.height, alignment) - origin.y;
|
|
458
|
+
} else {
|
|
459
|
+
frame.x = this._resolveX(rect, panel.width, alignment, rtl) - origin.x;
|
|
460
|
+
frame.y = (side === "top" ? rect.top - panel.height - this._offset : rect.bottom + this._offset) - origin.y;
|
|
461
|
+
}
|
|
462
|
+
this._applyPlacement(alignment === "center" ? side : `${side}-${alignment}`);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* `position` панели: `fixed` у точки и у якоря, который стоит в окне, иначе
|
|
466
|
+
* `absolute` (см. описание класса). Точка — в координатах окна и стоит в
|
|
467
|
+
* нём, как якорь в `fixed`-шапке.
|
|
468
|
+
*
|
|
469
|
+
* Выбранное держится до следующего показа или смены места. Стили предков
|
|
470
|
+
* якоря на каждом `scroll` не перечитываем: шапка, которая стала `fixed`
|
|
471
|
+
* при открытой панели, — редкость, а обход предков со стилями на каждом
|
|
472
|
+
* кадре прокрутки обошёлся бы всем.
|
|
473
|
+
*/
|
|
474
|
+
_choosePosition() {
|
|
475
|
+
const frame = this._frame;
|
|
476
|
+
if (!frame) return;
|
|
477
|
+
if (this._point) {
|
|
478
|
+
frame.strategy = "fixed";
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
const anchor = this._anchor;
|
|
482
|
+
if (anchor) frame.strategy = isPinnedToViewport(anchor) ? "fixed" : "absolute";
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Выравнивание из выбора потребителя — конец значения: суффикс `-start` или
|
|
486
|
+
* `-end`, а значение без суффикса (`top`, `bottom`, `start`, `end`) — центр.
|
|
487
|
+
* Суффикс — с дефисом: значение `start` — сторона с центром, а не
|
|
488
|
+
* выравнивание по началу.
|
|
489
|
+
*/
|
|
490
|
+
get _alignment() {
|
|
491
|
+
if (this._placement.endsWith("-start")) return "start";
|
|
492
|
+
if (this._placement.endsWith("-end")) return "end";
|
|
493
|
+
return "center";
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Размер видимой области — граница и для flip, и для shift.
|
|
497
|
+
*
|
|
498
|
+
* Берём `window.visualViewport`: он знает область без классической полосы
|
|
499
|
+
* прокрутки, а `innerWidth`/`innerHeight` считают полосу своей, и панель у
|
|
500
|
+
* самого края окна уезжала под неё полоской примерно в 15px. Тот же выбор
|
|
501
|
+
* границы у Floating UI для стратегии `fixed`, на которой только и работает
|
|
502
|
+
* привязка.
|
|
503
|
+
*
|
|
504
|
+
* Объекта нет (jsdom, старые браузеры) — остаётся окно.
|
|
505
|
+
* `document.documentElement.clientWidth` не берём: в jsdom он нулевой, и
|
|
506
|
+
* юнит-тесты панелей пришлось бы подпирать.
|
|
507
|
+
*
|
|
508
|
+
* Смещение видимой области при pinch-zoom (`offsetLeft`/`offsetTop`) не
|
|
509
|
+
* учитываем — координаты панели отсчитываются от окна. Это осознанная
|
|
510
|
+
* граница, а не недоделка: сдвинутую лупой область пришлось бы учитывать и
|
|
511
|
+
* в `y`, и в подписке на её собственные scroll/resize.
|
|
512
|
+
*/
|
|
513
|
+
get _viewport() {
|
|
514
|
+
return window.visualViewport ?? {
|
|
515
|
+
width: window.innerWidth,
|
|
516
|
+
height: window.innerHeight
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Сторона с учётом flip — на оси выбора потребителя.
|
|
521
|
+
*
|
|
522
|
+
* Выбор потребителя в `_placement` не перетирается — flip живёт только
|
|
523
|
+
* здесь, в вычислении фактической стороны. С выключенным `flip` сторона
|
|
524
|
+
* потребителя отдаётся сразу, и память не участвует. Иначе панель держит
|
|
525
|
+
* запомненную сторону (`_holdSide`), а пока держать нечего, сторону
|
|
526
|
+
* выбирает правило (`_chooseSide`). Запоминает её только расчёт с
|
|
527
|
+
* разложенной панелью (см. `_heldSide`).
|
|
528
|
+
*
|
|
529
|
+
* Правило у обеих осей одно, разная только мера: над якорем и под ним
|
|
530
|
+
* панели нужна её высота, сбоку — ширина, и там и там с отступом от якоря.
|
|
531
|
+
*/
|
|
532
|
+
_resolveSide(rect, panel, rtl) {
|
|
533
|
+
const wants = this._wantedSide;
|
|
534
|
+
if (!this._flip) return wants;
|
|
535
|
+
const needed = (isInlineSide(wants) ? panel.width : panel.height) + this._offset;
|
|
536
|
+
const side = this._heldSide === null ? this._chooseSide(wants, rect, needed, rtl) : this._holdSide(this._heldSide, rect, needed, rtl);
|
|
537
|
+
if (panel.height > 0) this._heldSide = side;
|
|
538
|
+
return side;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Сторона из выбора потребителя. Её называет начало значения, а не
|
|
542
|
+
* префикс с дефисом: у центра суффикса нет, и `top` по префиксу `top-`
|
|
543
|
+
* уехал бы вниз.
|
|
544
|
+
*/
|
|
545
|
+
get _wantedSide() {
|
|
546
|
+
if (this._placement.startsWith("top")) return "top";
|
|
547
|
+
if (this._placement.startsWith("start")) return "start";
|
|
548
|
+
if (this._placement.startsWith("end")) return "end";
|
|
549
|
+
return "bottom";
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Выбор стороны — у панели, которая стороны ещё не держит.
|
|
553
|
+
*
|
|
554
|
+
* Сторона потребителя, а если на ней панель не влезает в видимую область,
|
|
555
|
+
* а на противоположной места больше, — противоположная. Не влезает
|
|
556
|
+
* нигде — остаёмся на стороне потребителя.
|
|
557
|
+
*/
|
|
558
|
+
_chooseSide(wants, rect, needed, rtl) {
|
|
559
|
+
const spaceWanted = this._spaceAt(wants, rect, rtl);
|
|
560
|
+
const spaceOpposite = this._spaceAt(opposite(wants), rect, rtl);
|
|
561
|
+
if (spaceWanted >= needed || spaceOpposite <= spaceWanted) return wants;
|
|
562
|
+
return opposite(wants);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Удержание стороны: панель стоит на ней, пока там влезает. Не влезла —
|
|
566
|
+
* переходит на противоположную, только если влезает там; не влезает
|
|
567
|
+
* нигде — остаётся.
|
|
568
|
+
*
|
|
569
|
+
* Правило выбора для этого не годится: граница у него одна — «на стороне
|
|
570
|
+
* потребителя влезает», а когда не влезает нигде, — середина экрана, — и
|
|
571
|
+
* поле, которое стоит на ней, переводило бы панель туда и обратно на
|
|
572
|
+
* каждом пикселе прокрутки. У удержания границы две — «здесь перестала
|
|
573
|
+
* влезать» и «там влезает», — и между ними панель стоит, где стоит. Запас
|
|
574
|
+
* между границами — не подобранное число пикселей, а вся полоса, где
|
|
575
|
+
* панель влезает с обеих сторон или ни с одной.
|
|
576
|
+
*/
|
|
577
|
+
_holdSide(side, rect, needed, rtl) {
|
|
578
|
+
if (this._spaceAt(side, rect, rtl) >= needed) return side;
|
|
579
|
+
return this._spaceAt(opposite(side), rect, rtl) >= needed ? opposite(side) : side;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Место в видимой области с этой стороны якоря: над ним (`top`) и под ним
|
|
583
|
+
* (`bottom`) — по высоте, у начала и конца строки (`start`, `end`) — по
|
|
584
|
+
* ширине, слева или справа по направлению письма.
|
|
585
|
+
*/
|
|
586
|
+
_spaceAt(side, rect, rtl) {
|
|
587
|
+
if (side === "top") return rect.top;
|
|
588
|
+
if (side === "bottom") return this._viewport.height - rect.bottom;
|
|
589
|
+
return isLeftSide(side, rtl) ? rect.left : this._viewport.width - rect.right;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Левый край панели над якорем или под ним — с учётом выравнивания, RTL и
|
|
593
|
+
* shift.
|
|
594
|
+
*
|
|
595
|
+
* После выравнивания (`_alignX`) `x` сдвигается внутрь видимой области по
|
|
596
|
+
* горизонтали, чтобы панель не вылезала ни слева, ни справа — если панель
|
|
597
|
+
* шире области, прижимается к левому краю. Центр сдвигается так же, как
|
|
598
|
+
* начало и конец: у края окна панель перестаёт стоять по центру якоря, но
|
|
599
|
+
* остаётся видна целиком.
|
|
600
|
+
*/
|
|
601
|
+
_resolveX(rect, panelWidth, alignment, rtl) {
|
|
602
|
+
return shiftInto(this._alignX(rect, panelWidth, alignment, rtl), panelWidth, this._viewport.width);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Левый край панели по выравниванию, до shift.
|
|
606
|
+
*
|
|
607
|
+
* Центр — середина якоря минус половина панели, от направления он не
|
|
608
|
+
* зависит. Начало и конец логические: в LTR `start` — левый край якоря,
|
|
609
|
+
* `end` — правый, в RTL наоборот.
|
|
610
|
+
*/
|
|
611
|
+
_alignX(rect, panelWidth, alignment, rtl) {
|
|
612
|
+
if (alignment === "center") return (rect.left + rect.right - panelWidth) / 2;
|
|
613
|
+
return (rtl ? alignment === "start" : alignment === "end") ? rect.right - panelWidth : rect.left;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Левый край боковой панели: слева от якоря или справа по стороне и
|
|
617
|
+
* направлению письма, с зазором `offset`, — и прижатый к видимой области.
|
|
618
|
+
*
|
|
619
|
+
* Прижим по `x` у боковой панели — сверх shift: не влезла ни с одной
|
|
620
|
+
* стороны, и flip её не спас, — накрывает якорь, но видна целиком (см.
|
|
621
|
+
* описание класса). Шире области — прижимается к левому краю, как панель
|
|
622
|
+
* над якорем и под ним.
|
|
623
|
+
*/
|
|
624
|
+
_inlineX(side, rect, panelWidth, rtl) {
|
|
625
|
+
return shiftInto(isLeftSide(side, rtl) ? rect.left - panelWidth - this._offset : rect.right + this._offset, panelWidth, this._viewport.width);
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Верхний край боковой панели по выравниванию — и shift: `y` сдвигается
|
|
629
|
+
* внутрь видимой области по вертикали, чтобы панель не вылезала ни сверху,
|
|
630
|
+
* ни снизу; выше области — прижимается к верхнему краю.
|
|
631
|
+
*/
|
|
632
|
+
_inlineY(rect, panelHeight, alignment) {
|
|
633
|
+
return shiftInto(this._alignY(rect, panelHeight, alignment), panelHeight, this._viewport.height);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Верхний край боковой панели по выравниванию, до shift: `start` — верхние
|
|
637
|
+
* края панели и якоря вровень, `end` — нижние, центр — середина к
|
|
638
|
+
* середине. Ось вертикальная, и от направления письма выравнивание не
|
|
639
|
+
* зависит.
|
|
640
|
+
*/
|
|
641
|
+
_alignY(rect, panelHeight, alignment) {
|
|
642
|
+
if (alignment === "start") return rect.top;
|
|
643
|
+
if (alignment === "end") return rect.bottom - panelHeight;
|
|
644
|
+
return (rect.top + rect.bottom - panelHeight) / 2;
|
|
645
|
+
}
|
|
646
|
+
/** Пишет фактическую сторону во Frame, только если она изменилась. */
|
|
647
|
+
_applyPlacement(placement) {
|
|
648
|
+
if (this._actualPlacement === placement) return;
|
|
649
|
+
this._actualPlacement = placement;
|
|
650
|
+
this._frame?.dataset.add(ANCHOR_PLACEMENT_ATTRIBUTE, placement);
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Размер панели. Нужен для выравнивания по правому краю и по центру, для
|
|
654
|
+
* показа сверху и слева, для flip и для shift — везде координата
|
|
655
|
+
* отсчитывается от размера панели, а не только от якоря.
|
|
656
|
+
*
|
|
657
|
+
* Берём `getBoundingClientRect()`, а не `offsetWidth`/`offsetHeight`:
|
|
658
|
+
* оба нулевые, пока `v-show` держит панель на `display: none`, но
|
|
659
|
+
* `getBoundingClientRect()` пересчитывается уже на первом кадре после
|
|
660
|
+
* того, как её сняли — раньше на это полагаться было нельзя, теперь за
|
|
661
|
+
* этим кадром следит `ResizeObserver`.
|
|
662
|
+
*
|
|
663
|
+
* При `matchWidth` ширина берётся из якоря, а не из DOM: во Frame она уже
|
|
664
|
+
* записана, но узел получит её только после рендера адаптера, а панели ещё
|
|
665
|
+
* может не быть вовсе. Поэтому список под полем не зависит от того,
|
|
666
|
+
* отрисовалась ли панель, и с `*-end` не мигает по устаревшей ширине.
|
|
667
|
+
* Высоту якорь не знает — она всегда из DOM.
|
|
668
|
+
*/
|
|
669
|
+
_panelSize(anchorRect) {
|
|
670
|
+
const panel = this._element?.getBoundingClientRect();
|
|
671
|
+
return {
|
|
672
|
+
width: this._matchesWidth ? anchorRect.width : panel?.width ?? 0,
|
|
673
|
+
height: panel?.height ?? 0
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Заводит слежение: показ Frame, у Frame, созданного видимым, —
|
|
678
|
+
* назначение якоря (см. описание класса). Ожидание конца закрытия
|
|
679
|
+
* отменяется: панель снова открыта.
|
|
680
|
+
*/
|
|
681
|
+
_follow() {
|
|
682
|
+
this._stopWaitingTransitions();
|
|
683
|
+
this._following = true;
|
|
684
|
+
this._subscribe();
|
|
685
|
+
}
|
|
686
|
+
/** Снимает слежение сразу — вместе с ожиданием конца закрытия, если оно шло. */
|
|
687
|
+
_unfollow() {
|
|
688
|
+
this._stopWaitingTransitions();
|
|
689
|
+
this._following = false;
|
|
690
|
+
this._unsubscribe();
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Закрытие снимает слежение, когда корень доиграет переходы закрытия:
|
|
694
|
+
* гаснущая и уходящая жестом панель ещё на экране и идёт за полем до
|
|
695
|
+
* конца. Снятое прямо на `hide`, слежение оставило бы её стоять, пока поле
|
|
696
|
+
* уезжает. Корня нет — ждать нечего, и слежение снимается сразу.
|
|
697
|
+
*/
|
|
698
|
+
_unfollowAfterTransitions() {
|
|
699
|
+
if (!this._following) return;
|
|
700
|
+
const element = this._element;
|
|
701
|
+
if (!element) {
|
|
702
|
+
this._unfollow();
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
this._stopWaitingTransitions();
|
|
706
|
+
this._stopWaiting = afterTransitions(element, () => {
|
|
707
|
+
this._stopWaiting = null;
|
|
708
|
+
this._unfollow();
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
/** Отменяет ожидание конца закрытия. */
|
|
712
|
+
_stopWaitingTransitions() {
|
|
713
|
+
this._stopWaiting?.();
|
|
714
|
+
this._stopWaiting = null;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Следит за тем, что двигает место панели.
|
|
718
|
+
*
|
|
719
|
+
* У якоря — скролл его предков, ресайз окна и изменение размера самого
|
|
720
|
+
* якоря (без скролла — например, у него пропал соседний тег). Scroll и
|
|
721
|
+
* resize пересчитывают координаты сразу, уведомление наблюдателя якоря —
|
|
722
|
+
* через `_onAnchorResize`. Каждый слушатель снимается по своей ссылке на
|
|
723
|
+
* элемент: одна переменная цикла, захваченная всеми замыканиями, к моменту
|
|
724
|
+
* очистки была бы уже `null`, и слушатели остались бы висеть.
|
|
725
|
+
*
|
|
726
|
+
* У точки — только ресайз окна: точка в координатах окна, прокрутка и
|
|
727
|
+
* размер чужого элемента её не двигают, а у края окна по-другому решаются
|
|
728
|
+
* flip и shift. Якорь, оставшийся под точкой, не наблюдается: точка
|
|
729
|
+
* главнее.
|
|
730
|
+
*
|
|
731
|
+
* Подписки живут только при слежении (`_follow`, смена места у показанной
|
|
732
|
+
* панели): у закрытой панели их нет вовсе. Прежние снимаются первыми, и
|
|
733
|
+
* повторный показ второго набора не заводит.
|
|
734
|
+
*/
|
|
735
|
+
_subscribe() {
|
|
736
|
+
this._unsubscribe();
|
|
737
|
+
const update = () => this._update();
|
|
738
|
+
if (this._point) {
|
|
739
|
+
this._listenWindow("resize", update);
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
const anchor = this._anchor;
|
|
743
|
+
if (!anchor) return;
|
|
744
|
+
for (let el = anchor.parentElement; el; el = el.parentElement) {
|
|
745
|
+
const target = el;
|
|
746
|
+
target.addEventListener("scroll", update, { passive: true });
|
|
747
|
+
this._cleanups.push(() => target.removeEventListener("scroll", update));
|
|
748
|
+
}
|
|
749
|
+
this._listenWindow("resize", update);
|
|
750
|
+
this._listenWindow("scroll", update);
|
|
751
|
+
const anchorObserver = new ResizeObserver(() => this._onAnchorResize());
|
|
752
|
+
anchorObserver.observe(anchor, { box: "border-box" });
|
|
753
|
+
this._cleanups.push(() => anchorObserver.disconnect());
|
|
754
|
+
}
|
|
755
|
+
/** Слушатель окна — с отпиской в общем списке подписок. */
|
|
756
|
+
_listenWindow(type, listener) {
|
|
757
|
+
window.addEventListener(type, listener, { passive: true });
|
|
758
|
+
this._cleanups.push(() => window.removeEventListener(type, listener));
|
|
759
|
+
}
|
|
760
|
+
_unsubscribe() {
|
|
761
|
+
for (const cleanup of this._cleanups) cleanup();
|
|
762
|
+
this._cleanups = [];
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Пересчёт по уведомлению наблюдателя якоря — с паузой в наблюдении панели.
|
|
766
|
+
*
|
|
767
|
+
* Колбэк `ResizeObserver` выполняется внутри шага наблюдения кадра, и
|
|
768
|
+
* записанные здесь `x`, `y` и `width` адаптер успевает отрисовать тут же, в
|
|
769
|
+
* микрозадаче после колбэка. При `matchWidth` от этого в том же шаге
|
|
770
|
+
* меняется размер панели. Панель телепортирована и в DOM лежит мельче
|
|
771
|
+
* якоря, а после уведомления якоря браузер в этом шаге доставляет только
|
|
772
|
+
* уведомления узлов глубже него. Уведомление панели пропускается: на
|
|
773
|
+
* `window` уходит `error` («ResizeObserver loop completed with undelivered
|
|
774
|
+
* notifications»), который получают трекеры ошибок у потребителя, а позиция
|
|
775
|
+
* по новому размеру панели запаздывает на кадр.
|
|
776
|
+
*
|
|
777
|
+
* Поэтому наблюдение панели снимается до пересчёта и возвращается следующим
|
|
778
|
+
* кадром — приём `autoUpdate` из Floating UI. Вернувшееся наблюдение само
|
|
779
|
+
* присылает текущий размер: если от новой ширины выросла высота (перенос
|
|
780
|
+
* текста у панели сверху), `y` поправится по нему. Возвращать микрозадачей
|
|
781
|
+
* нельзя: она попадёт в тот же шаг, и уведомление снова пропустится.
|
|
782
|
+
*
|
|
783
|
+
* Пауза только у якоря. Колбэк панели ничего не приостанавливает:
|
|
784
|
+
* `observe()` сразу присылает уведомление, и пауза на нём зациклилась бы.
|
|
785
|
+
* Scroll и resize окна, сеттеры и `show` выполняются вне шага наблюдения, им
|
|
786
|
+
* пауза не нужна.
|
|
787
|
+
*/
|
|
788
|
+
_onAnchorResize() {
|
|
789
|
+
this._pausePanel();
|
|
790
|
+
this._update();
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Снимает наблюдение панели до следующего кадра.
|
|
794
|
+
*
|
|
795
|
+
* Возврат один: повторное уведомление до кадра второго не заводит, иначе
|
|
796
|
+
* отмена застала бы только последний. Отменяют возврат `removed`, новый
|
|
797
|
+
* `ready` и `destroy` — то, что убирает или меняет саму панель. Снятие якоря
|
|
798
|
+
* и конец закрытия (`removeAnchor`, `_unsubscribe`) его не отменяют: панель
|
|
799
|
+
* осталась, и без возврата за её размером никто бы не следил.
|
|
800
|
+
*/
|
|
801
|
+
_pausePanel() {
|
|
802
|
+
const observer = this._panelObserver;
|
|
803
|
+
const element = this._element;
|
|
804
|
+
if (!observer || !element) return;
|
|
805
|
+
observer.unobserve(element);
|
|
806
|
+
if (this._panelResumeFrame !== null) return;
|
|
807
|
+
this._panelResumeFrame = requestAnimationFrame(() => {
|
|
808
|
+
this._panelResumeFrame = null;
|
|
809
|
+
observer.observe(element, { box: "border-box" });
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
/** Отменяет отложенный возврат наблюдения панели. */
|
|
813
|
+
_cancelPanelResume() {
|
|
814
|
+
if (this._panelResumeFrame === null) return;
|
|
815
|
+
cancelAnimationFrame(this._panelResumeFrame);
|
|
816
|
+
this._panelResumeFrame = null;
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
//#endregion
|
|
820
|
+
export { ANCHOR_PLACEMENT_ATTRIBUTE, TAnchorPlugin };
|