@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,119 @@
|
|
|
1
|
+
import { TBasePlugin } from "../../../base/base.class.js";
|
|
2
|
+
import { toCssValue } from "../../../utils/toCssValue.js";
|
|
3
|
+
//#region src/custom/overlay/modal-layout/modal-layout.plugin.ts
|
|
4
|
+
/**
|
|
5
|
+
* Одни ли и те же стили: те же ключи с теми же значениями. Порядок ключей не
|
|
6
|
+
* важен — это набор свойств, а не список.
|
|
7
|
+
*/
|
|
8
|
+
function sameStyles(a, b) {
|
|
9
|
+
const keys = Object.keys(a);
|
|
10
|
+
return keys.length === Object.keys(b).length && keys.every((key) => b[key] === a[key]);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Раскладка модального слоя — общая часть окна и выезжающей панели: слой и
|
|
14
|
+
* размер в объекты стилей для разметки.
|
|
15
|
+
*
|
|
16
|
+
* Модальный слой ничего не меряет и координат не считает: место, край,
|
|
17
|
+
* разворот и анимацию раскладывает тема по модификаторам и `data-*`. Плагину
|
|
18
|
+
* остаются значения, которые в класс не уложить:
|
|
19
|
+
*
|
|
20
|
+
* - `styles` — панели: `z-index` слоя, размер и свои переменные наследника
|
|
21
|
+
* (`_panelVariables`: у окна — отступы от краёв экрана). Переменными, а не
|
|
22
|
+
* инлайном `width` и `height`: инлайн перебил бы тему, а у неё потолок
|
|
23
|
+
* размера по экрану и развёрнутое окно. Незаданный размер переменной не
|
|
24
|
+
* даёт вовсе — тогда действует умолчание темы (`var(--so-dialog-width, …)`);
|
|
25
|
+
* - `backdropStyles` — подложке: тот же `z-index`. Подложка стоит в DOM
|
|
26
|
+
* раньше панели, и панель рисуется поверх неё просто порядком.
|
|
27
|
+
*
|
|
28
|
+
* Имена переменных у каждого компонента свои — их читает CSS его блока
|
|
29
|
+
* (`--so-dialog-width`, `--so-drawer-width`), — поэтому база абстрактна: наследник
|
|
30
|
+
* называет их (`_variables`), а считает всё база. Второй копии расчёта у
|
|
31
|
+
* окна и панели нет.
|
|
32
|
+
*
|
|
33
|
+
* Считает при установке и на смену ширины, высоты и слоя; на смену своих
|
|
34
|
+
* значений наследник зовёт тот же пересчёт (`_updateStyles`). Объекты
|
|
35
|
+
* заменяются целиком, а не мутируются: геттер отдаёт ссылку наружу, и без
|
|
36
|
+
* смены идентичности адаптер не увидит изменения. `change:styles` — только
|
|
37
|
+
* когда стили сменились по содержимому: повод пересчёта не всегда их меняет.
|
|
38
|
+
*
|
|
39
|
+
* Дженерик по карте событий — для наследника со своими событиями
|
|
40
|
+
* (`offset:before` у окна); свои события база шлёт через `_sink`.
|
|
41
|
+
*/
|
|
42
|
+
var TModalLayoutPlugin = class extends TBasePlugin {
|
|
43
|
+
_styles = {};
|
|
44
|
+
_backdropStyles = {};
|
|
45
|
+
_owner = null;
|
|
46
|
+
install(ctx) {
|
|
47
|
+
super.install(ctx);
|
|
48
|
+
const owner = ctx.getInstance();
|
|
49
|
+
if (!owner) return;
|
|
50
|
+
this._owner = owner;
|
|
51
|
+
const updateStyles = () => this._updateStyles();
|
|
52
|
+
this._listenTo(owner.events, "change:width", updateStyles);
|
|
53
|
+
this._listenTo(owner.events, "change:height", updateStyles);
|
|
54
|
+
this._listenTo(owner.events, "change:zIndex", updateStyles);
|
|
55
|
+
this._listenTo(owner.events, "change:zIndex", () => this._updateBackdropStyles());
|
|
56
|
+
this._updateStyles();
|
|
57
|
+
this._updateBackdropStyles();
|
|
58
|
+
}
|
|
59
|
+
/** Стили панели: `z-index` слоя, переменные размера и свои переменные наследника. */
|
|
60
|
+
get styles() {
|
|
61
|
+
return this._styles;
|
|
62
|
+
}
|
|
63
|
+
/** Стили подложки: тот же `z-index`, что у панели. */
|
|
64
|
+
get backdropStyles() {
|
|
65
|
+
return this._backdropStyles;
|
|
66
|
+
}
|
|
67
|
+
destroy() {
|
|
68
|
+
this._owner = null;
|
|
69
|
+
super.destroy();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Эмит собственных событий раскладки — без приведения `this.events` к
|
|
73
|
+
* конкретной карте (см. `TEventSink` в `@soxa-ui/core`): карта — дженерик,
|
|
74
|
+
* а `change:styles` и `change:backdropStyles` объявлены здесь.
|
|
75
|
+
*/
|
|
76
|
+
get _sink() {
|
|
77
|
+
return this.events;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Свои переменные панели сверх размера: имя переменной → CSS-значение.
|
|
81
|
+
* Их читает каждый пересчёт стилей, начиная с установки, поэтому то, из
|
|
82
|
+
* чего они строятся, наследник обязан знать уже тогда. По умолчанию своих
|
|
83
|
+
* нет.
|
|
84
|
+
*/
|
|
85
|
+
_panelVariables() {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Пересчитать стили панели. Наследник зовёт его на смену значений, из
|
|
90
|
+
* которых строит `_panelVariables`.
|
|
91
|
+
*/
|
|
92
|
+
_updateStyles() {
|
|
93
|
+
const oldStyles = this.styles;
|
|
94
|
+
const owner = this._owner;
|
|
95
|
+
if (!owner) return;
|
|
96
|
+
const styles = { "z-index": owner.zIndex };
|
|
97
|
+
if (owner.width !== void 0) styles[this._variables.width] = toCssValue(owner.width);
|
|
98
|
+
if (owner.height !== void 0) styles[this._variables.height] = toCssValue(owner.height);
|
|
99
|
+
Object.assign(styles, this._panelVariables());
|
|
100
|
+
if (sameStyles(styles, this._styles)) return;
|
|
101
|
+
this._styles = styles;
|
|
102
|
+
this._sink.emit("change:styles", {
|
|
103
|
+
newValue: this._styles,
|
|
104
|
+
oldValue: oldStyles
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
_updateBackdropStyles() {
|
|
108
|
+
const oldBackdropStyles = this.backdropStyles;
|
|
109
|
+
const owner = this._owner;
|
|
110
|
+
if (!owner) return;
|
|
111
|
+
this._backdropStyles = { "z-index": owner.zIndex };
|
|
112
|
+
this._sink.emit("change:backdropStyles", {
|
|
113
|
+
newValue: this._backdropStyles,
|
|
114
|
+
oldValue: oldBackdropStyles
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
//#endregion
|
|
119
|
+
export { TModalLayoutPlugin };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TValuePayload } from '@soxa-ui/core';
|
|
2
|
+
import type { TPluginEvents } from '../../../base';
|
|
3
|
+
export type TModalLayoutPluginEvents = TPluginEvents & {
|
|
4
|
+
'change:styles': (payload: TValuePayload<Record<string, string | number>>) => void;
|
|
5
|
+
'change:backdropStyles': (payload: TValuePayload<Record<string, string | number>>) => void;
|
|
6
|
+
};
|
|
7
|
+
/** Имена переменных размера панели: их читает CSS блока компонента. */
|
|
8
|
+
export type TModalLayoutVariables = {
|
|
9
|
+
/** Переменная ширины — `--so-dialog-width` у окна */
|
|
10
|
+
readonly width: string;
|
|
11
|
+
/** Переменная высоты — `--so-dialog-height` у окна */
|
|
12
|
+
readonly height: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modal-names.plugin';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IModalLayer } from '@soxa-ui/core';
|
|
2
|
+
import { TNamesPlugin } from '../../../locale/names.plugin';
|
|
3
|
+
import type { TTranslations } from '../../../locale/types';
|
|
4
|
+
/**
|
|
5
|
+
* TModalNamesPlugin — имя кнопки закрытия модального слоя от локали: в
|
|
6
|
+
* `closeAria`.
|
|
7
|
+
*
|
|
8
|
+
* Ставится наследникам слоя — выезжающей панели и, через
|
|
9
|
+
* `TDialogNamesPlugin`, окну, — как плагины связок: у каждого свой.
|
|
10
|
+
* Дженерик по владельцу — для наследника, у которого кнопок больше.
|
|
11
|
+
*/
|
|
12
|
+
export declare class TModalNamesPlugin<TOwner extends IModalLayer<any, any> = IModalLayer> extends TNamesPlugin<TOwner> {
|
|
13
|
+
protected _name(owner: TOwner, translations: TTranslations): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TNamesPlugin } from "../../../locale/names.plugin.js";
|
|
2
|
+
//#region src/custom/overlay/modal-names/modal-names.plugin.ts
|
|
3
|
+
/**
|
|
4
|
+
* TModalNamesPlugin — имя кнопки закрытия модального слоя от локали: в
|
|
5
|
+
* `closeAria`.
|
|
6
|
+
*
|
|
7
|
+
* Ставится наследникам слоя — выезжающей панели и, через
|
|
8
|
+
* `TDialogNamesPlugin`, окну, — как плагины связок: у каждого свой.
|
|
9
|
+
* Дженерик по владельцу — для наследника, у которого кнопок больше.
|
|
10
|
+
*/
|
|
11
|
+
var TModalNamesPlugin = class extends TNamesPlugin {
|
|
12
|
+
_name(owner, translations) {
|
|
13
|
+
owner.closeAria.add("aria-label", translations.modal.close);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { TModalNamesPlugin };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IPluginContext } from '../../base';
|
|
2
|
+
import type { IOverlayOpenOptions, IOverlayOpenState } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Binds overlay behavior to its owner's openness and visibility. A hidden
|
|
5
|
+
* owner keeps its open state, but dismiss, focus and scroll behavior pause
|
|
6
|
+
* until it is shown again. Owners without a visible property remain supported.
|
|
7
|
+
*
|
|
8
|
+
* User dismissal goes through requestClose when available; programmatic writes
|
|
9
|
+
* still target the configured property. Each binding removes only its own
|
|
10
|
+
* subscriptions when the plugin is destroyed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function bindOverlayOpen(ctx: IPluginContext, options: IOverlayOpenOptions | undefined, onChange: (open: boolean) => void): IOverlayOpenState | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isCloseRequestable, isEventSource } from "@soxa-ui/core";
|
|
2
|
+
//#region src/custom/overlay/open-state.ts
|
|
3
|
+
/** Свойство открытости по умолчанию — см. `IOverlayOpenOptions.property`. */
|
|
4
|
+
var DEFAULT_PROPERTY = "open";
|
|
5
|
+
/**
|
|
6
|
+
* Binds overlay behavior to its owner's openness and visibility. A hidden
|
|
7
|
+
* owner keeps its open state, but dismiss, focus and scroll behavior pause
|
|
8
|
+
* until it is shown again. Owners without a visible property remain supported.
|
|
9
|
+
*
|
|
10
|
+
* User dismissal goes through requestClose when available; programmatic writes
|
|
11
|
+
* still target the configured property. Each binding removes only its own
|
|
12
|
+
* subscriptions when the plugin is destroyed.
|
|
13
|
+
*/
|
|
14
|
+
function bindOverlayOpen(ctx, options, onChange) {
|
|
15
|
+
const instance = ctx.getInstance();
|
|
16
|
+
const property = options?.property === void 0 ? DEFAULT_PROPERTY : options.property;
|
|
17
|
+
if (!instance || !property || !(property in instance)) return null;
|
|
18
|
+
const read = () => !!Reflect.get(instance, property) && Reflect.get(instance, "visible") !== false;
|
|
19
|
+
const write = (value) => {
|
|
20
|
+
Reflect.set(instance, property, value);
|
|
21
|
+
};
|
|
22
|
+
const events = Reflect.get(instance, "events");
|
|
23
|
+
const source = isEventSource(events) ? events : null;
|
|
24
|
+
const event = options?.event ?? `change:${property}`;
|
|
25
|
+
const handler = () => onChange(read());
|
|
26
|
+
source?.on(event, handler);
|
|
27
|
+
if (property !== "visible") source?.on("change:visible", handler);
|
|
28
|
+
return {
|
|
29
|
+
read,
|
|
30
|
+
write,
|
|
31
|
+
close(reason) {
|
|
32
|
+
if (isCloseRequestable(instance)) instance.requestClose(reason);
|
|
33
|
+
else write(false);
|
|
34
|
+
},
|
|
35
|
+
unbind() {
|
|
36
|
+
source?.off(event, handler);
|
|
37
|
+
if (property !== "visible") source?.off("change:visible", handler);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { bindOverlayOpen };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Замок прокрутки документа со счётчиком слоёв.
|
|
3
|
+
*
|
|
4
|
+
* Слоёв поверх страницы бывает несколько — диалог, из него выезжающая
|
|
5
|
+
* панель, — и каждый запирает прокрутку сам. Считать это флагом нельзя:
|
|
6
|
+
* закрытие верхнего слоя вернуло бы прокрутку, пока нижний ещё открыт.
|
|
7
|
+
* Поэтому замок один на документ, у него счётчик, и стиль документа
|
|
8
|
+
* возвращается ровно тогда, когда его отпустил последний.
|
|
9
|
+
*
|
|
10
|
+
* Возвращаются **инлайновые** значения, которые были до замка: страница
|
|
11
|
+
* могла задать `overflow` и своими правилами, и инлайном, а вернуть надо то,
|
|
12
|
+
* что мы перебили.
|
|
13
|
+
*/
|
|
14
|
+
/** Запереть прокрутку документа. Первый вызов запирает, остальные считаются. */
|
|
15
|
+
export declare function lockScroll(doc: Document): void;
|
|
16
|
+
/** Отпустить замок. Прокрутка вернётся, когда его отпустит последний слой. */
|
|
17
|
+
export declare function unlockScroll(doc: Document): void;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//#region src/custom/overlay/scroll-lock/lock.ts
|
|
2
|
+
var LOCKS = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
/** Запереть прокрутку документа. Первый вызов запирает, остальные считаются. */
|
|
4
|
+
function lockScroll(doc) {
|
|
5
|
+
const lock = LOCKS.get(doc);
|
|
6
|
+
if (lock) {
|
|
7
|
+
lock.count += 1;
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
LOCKS.set(doc, {
|
|
11
|
+
count: 1,
|
|
12
|
+
restore: applyLock(doc)
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** Отпустить замок. Прокрутка вернётся, когда его отпустит последний слой. */
|
|
16
|
+
function unlockScroll(doc) {
|
|
17
|
+
const lock = LOCKS.get(doc);
|
|
18
|
+
if (!lock) return;
|
|
19
|
+
lock.count -= 1;
|
|
20
|
+
if (lock.count > 0) return;
|
|
21
|
+
LOCKS.delete(doc);
|
|
22
|
+
for (const entry of lock.restore) restoreStyle(entry);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Запирает прокрутку и отдаёт то, что перебил.
|
|
26
|
+
*
|
|
27
|
+
* `overflow: hidden` ставится и на `html`, и на `body`: какой из них
|
|
28
|
+
* прокручивает страницу, решает сама страница. По спецификации `overflow`
|
|
29
|
+
* с `body` доходит до области просмотра, только пока у `html` он `visible`,
|
|
30
|
+
* — а `html { overflow-y: scroll }` ставят как раз затем, чтобы страница не
|
|
31
|
+
* дёргалась. Заперев только один из двух, замок молча не сработал бы.
|
|
32
|
+
*/
|
|
33
|
+
function applyLock(doc) {
|
|
34
|
+
const root = doc.documentElement;
|
|
35
|
+
const body = doc.body;
|
|
36
|
+
const gap = scrollbarGap(doc);
|
|
37
|
+
const restore = [takeStyle(root.style, "overflow"), takeStyle(body.style, "overflow")];
|
|
38
|
+
root.style.setProperty("overflow", "hidden");
|
|
39
|
+
body.style.setProperty("overflow", "hidden");
|
|
40
|
+
if (gap > 0) {
|
|
41
|
+
restore.push(takeStyle(body.style, "padding-inline-end"));
|
|
42
|
+
body.style.setProperty("padding-inline-end", `${paddingEnd(body) + gap}px`);
|
|
43
|
+
}
|
|
44
|
+
return restore;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Ширина полосы прокрутки — разница между окном и областью просмотра
|
|
48
|
+
* документа. Без неё страница дёргается на ширину полосы, едва прокрутку
|
|
49
|
+
* заперли.
|
|
50
|
+
*
|
|
51
|
+
* Компенсация — `padding-inline-end`, а не `padding-right`: полоса прокрутки
|
|
52
|
+
* области просмотра стоит на той стороне, куда смотрит направление корня, и
|
|
53
|
+
* в RTL это левый край — ровно то, что значит `inline-end`.
|
|
54
|
+
*
|
|
55
|
+
* Область просмотра нулевой ширины значит, что раскладки нет вовсе:
|
|
56
|
+
* компенсировать нечего.
|
|
57
|
+
*/
|
|
58
|
+
function scrollbarGap(doc) {
|
|
59
|
+
const view = doc.defaultView;
|
|
60
|
+
const width = doc.documentElement.clientWidth;
|
|
61
|
+
if (!view || width <= 0) return 0;
|
|
62
|
+
const gap = view.innerWidth - width;
|
|
63
|
+
return gap > 0 ? gap : 0;
|
|
64
|
+
}
|
|
65
|
+
/** Отступ, который уже есть у элемента, — к нему прибавляется компенсация. */
|
|
66
|
+
function paddingEnd(element) {
|
|
67
|
+
const view = element.ownerDocument.defaultView;
|
|
68
|
+
const parsed = Number.parseFloat(view?.getComputedStyle(element).paddingInlineEnd ?? "");
|
|
69
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
70
|
+
}
|
|
71
|
+
function takeStyle(style, property) {
|
|
72
|
+
return {
|
|
73
|
+
style,
|
|
74
|
+
property,
|
|
75
|
+
value: style.getPropertyValue(property)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function restoreStyle({ style, property, value }) {
|
|
79
|
+
if (value === "") style.removeProperty(property);
|
|
80
|
+
else style.setProperty(property, value);
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { lockScroll, unlockScroll };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { TBasePlugin } from '../../../base';
|
|
2
|
+
import type { IPluginContext } from '../../../base';
|
|
3
|
+
import type { IScrollLockPluginOptions, TScrollLockPluginEvents } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* TScrollLockPlugin — пока владелец открыт, страница под ним не
|
|
6
|
+
* прокручивается.
|
|
7
|
+
*
|
|
8
|
+
* Модальному окну и выезжающей панели прокрутка фона мешает: пользователь
|
|
9
|
+
* тянет колесо, а уезжает то, с чем он сейчас не работает. Запирается это
|
|
10
|
+
* стилем документа, поэтому живёт в плагине: ядру DOM недоступен, а
|
|
11
|
+
* повторять связку «открыто ⇄ заперто» в шаблоне каждого из шести адаптеров
|
|
12
|
+
* значило бы поменять в одном и забыть в пяти.
|
|
13
|
+
*
|
|
14
|
+
* Открытость плагин ведёт сам — по свойству владельца (`property`, по
|
|
15
|
+
* умолчанию `open`), тем же способом, что `TDismissPlugin`. Вручную замок
|
|
16
|
+
* ведут через `enabled` при `property: null`.
|
|
17
|
+
*
|
|
18
|
+
* Слоёв поверх страницы бывает несколько, и замок у документа один на всех
|
|
19
|
+
* (см. `lock.ts`): два открытых слоя держат его вместе, закрытие одного
|
|
20
|
+
* прокрутку не возвращает. Свой счёт плагин снимает и при размонтировании
|
|
21
|
+
* корня, и в `destroy()` — иначе страница осталась бы запертой навсегда.
|
|
22
|
+
*
|
|
23
|
+
* **Закрытие отпускает замок после перехода.** Закрытая панель ещё на экране
|
|
24
|
+
* — гаснет или уезжает переходом темы, — и полоса прокрутки, вернувшись
|
|
25
|
+
* сразу, сузила бы область просмотра: окно по центру переехало бы на
|
|
26
|
+
* полширины полосы, панель у края — на всю. Поэтому, выключившись, плагин
|
|
27
|
+
* держит замок, пока корень не доиграет переходы закрытия (`afterTransitions`),
|
|
28
|
+
* и только потом отдаёт свой счёт. Открыли снова, пока он ждёт, — ожидание
|
|
29
|
+
* отменяется, а счёт остаётся прежним: замок и так лежит. Снятый корень и
|
|
30
|
+
* `destroy()` отпускают замок сразу: ждать перехода не у кого.
|
|
31
|
+
*
|
|
32
|
+
* Ждёт плагин только корень, без подложки. У модального слоя корень и есть
|
|
33
|
+
* панель, а подложка по контракту темы идёт вместе с ней и с той же
|
|
34
|
+
* длительностью. Узла подложки у плагина нет, и искать её в DOM значило бы
|
|
35
|
+
* завести второй путь к разметке слоя.
|
|
36
|
+
*
|
|
37
|
+
* Документ берётся у корня (`TElementPlugin`), а не из `globalThis`:
|
|
38
|
+
* компонент живёт и в чужом документе — в `iframe`, в окне, открытом
|
|
39
|
+
* `window.open`. Пока корня нет, запирать нечего и негде.
|
|
40
|
+
*
|
|
41
|
+
* Чего плагин не делает: прокрутку внутри самой панели он не трогает — она
|
|
42
|
+
* идёт своим `overflow` в теме. Поведение iOS Safari, где `overflow: hidden`
|
|
43
|
+
* прокрутку не держит, сюда пока не входит.
|
|
44
|
+
*/
|
|
45
|
+
export declare class TScrollLockPlugin extends TBasePlugin<any, TScrollLockPluginEvents> {
|
|
46
|
+
/** Умолчания опций, объявленных пропами, — см. `TDismissPlugin.defaultValues`. */
|
|
47
|
+
static defaultValues: Required<Pick<IScrollLockPluginOptions, 'enabled'>>;
|
|
48
|
+
private _open;
|
|
49
|
+
private _element;
|
|
50
|
+
private _enabled;
|
|
51
|
+
/** Документ, у которого плагин держит замок; `null` — не держит. */
|
|
52
|
+
private _locked;
|
|
53
|
+
/** Отмена ожидания конца перехода закрытия; `null` — плагин не ждёт. */
|
|
54
|
+
private _stopWaiting;
|
|
55
|
+
install(ctx: IPluginContext, options?: IScrollLockPluginOptions): void;
|
|
56
|
+
/**
|
|
57
|
+
* Запирать ли прокрутку. Владелец взводит это открытием; своё значение
|
|
58
|
+
* плагин держит и без корня — замок ляжет, как только корень объявят.
|
|
59
|
+
*
|
|
60
|
+
* `true` запирает сразу, а `false` отпускает замок не сразу, а когда корень
|
|
61
|
+
* доиграет переходы закрытия. `change:enabled` приходит сразу в обе
|
|
62
|
+
* стороны: это нужное состояние, а не факт отпирания.
|
|
63
|
+
*/
|
|
64
|
+
get enabled(): boolean;
|
|
65
|
+
set enabled(value: boolean);
|
|
66
|
+
destroy(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Замок сейчас — ровно по состоянию: лежит, когда владелец открыт и корень
|
|
69
|
+
* объявлен. Ожидание перехода закрытия это отменяет: состояние решено
|
|
70
|
+
* заново.
|
|
71
|
+
*/
|
|
72
|
+
private _sync;
|
|
73
|
+
/**
|
|
74
|
+
* Выключили — замок остаётся, пока корень доигрывает переходы закрытия, и
|
|
75
|
+
* только потом отпускается. Замка нет — отпускать нечего.
|
|
76
|
+
*/
|
|
77
|
+
private _releaseAfterTransitions;
|
|
78
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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 { bindOverlayOpen } from "../open-state.js";
|
|
5
|
+
import { lockScroll, unlockScroll } from "./lock.js";
|
|
6
|
+
//#region src/custom/overlay/scroll-lock/scroll-lock.plugin.ts
|
|
7
|
+
/**
|
|
8
|
+
* TScrollLockPlugin — пока владелец открыт, страница под ним не
|
|
9
|
+
* прокручивается.
|
|
10
|
+
*
|
|
11
|
+
* Модальному окну и выезжающей панели прокрутка фона мешает: пользователь
|
|
12
|
+
* тянет колесо, а уезжает то, с чем он сейчас не работает. Запирается это
|
|
13
|
+
* стилем документа, поэтому живёт в плагине: ядру DOM недоступен, а
|
|
14
|
+
* повторять связку «открыто ⇄ заперто» в шаблоне каждого из шести адаптеров
|
|
15
|
+
* значило бы поменять в одном и забыть в пяти.
|
|
16
|
+
*
|
|
17
|
+
* Открытость плагин ведёт сам — по свойству владельца (`property`, по
|
|
18
|
+
* умолчанию `open`), тем же способом, что `TDismissPlugin`. Вручную замок
|
|
19
|
+
* ведут через `enabled` при `property: null`.
|
|
20
|
+
*
|
|
21
|
+
* Слоёв поверх страницы бывает несколько, и замок у документа один на всех
|
|
22
|
+
* (см. `lock.ts`): два открытых слоя держат его вместе, закрытие одного
|
|
23
|
+
* прокрутку не возвращает. Свой счёт плагин снимает и при размонтировании
|
|
24
|
+
* корня, и в `destroy()` — иначе страница осталась бы запертой навсегда.
|
|
25
|
+
*
|
|
26
|
+
* **Закрытие отпускает замок после перехода.** Закрытая панель ещё на экране
|
|
27
|
+
* — гаснет или уезжает переходом темы, — и полоса прокрутки, вернувшись
|
|
28
|
+
* сразу, сузила бы область просмотра: окно по центру переехало бы на
|
|
29
|
+
* полширины полосы, панель у края — на всю. Поэтому, выключившись, плагин
|
|
30
|
+
* держит замок, пока корень не доиграет переходы закрытия (`afterTransitions`),
|
|
31
|
+
* и только потом отдаёт свой счёт. Открыли снова, пока он ждёт, — ожидание
|
|
32
|
+
* отменяется, а счёт остаётся прежним: замок и так лежит. Снятый корень и
|
|
33
|
+
* `destroy()` отпускают замок сразу: ждать перехода не у кого.
|
|
34
|
+
*
|
|
35
|
+
* Ждёт плагин только корень, без подложки. У модального слоя корень и есть
|
|
36
|
+
* панель, а подложка по контракту темы идёт вместе с ней и с той же
|
|
37
|
+
* длительностью. Узла подложки у плагина нет, и искать её в DOM значило бы
|
|
38
|
+
* завести второй путь к разметке слоя.
|
|
39
|
+
*
|
|
40
|
+
* Документ берётся у корня (`TElementPlugin`), а не из `globalThis`:
|
|
41
|
+
* компонент живёт и в чужом документе — в `iframe`, в окне, открытом
|
|
42
|
+
* `window.open`. Пока корня нет, запирать нечего и негде.
|
|
43
|
+
*
|
|
44
|
+
* Чего плагин не делает: прокрутку внутри самой панели он не трогает — она
|
|
45
|
+
* идёт своим `overflow` в теме. Поведение iOS Safari, где `overflow: hidden`
|
|
46
|
+
* прокрутку не держит, сюда пока не входит.
|
|
47
|
+
*/
|
|
48
|
+
var TScrollLockPlugin = class TScrollLockPlugin extends TBasePlugin {
|
|
49
|
+
/** Умолчания опций, объявленных пропами, — см. `TDismissPlugin.defaultValues`. */
|
|
50
|
+
static defaultValues = { enabled: false };
|
|
51
|
+
_open = null;
|
|
52
|
+
_element = null;
|
|
53
|
+
_enabled = TScrollLockPlugin.defaultValues.enabled;
|
|
54
|
+
/** Документ, у которого плагин держит замок; `null` — не держит. */
|
|
55
|
+
_locked = null;
|
|
56
|
+
/** Отмена ожидания конца перехода закрытия; `null` — плагин не ждёт. */
|
|
57
|
+
_stopWaiting = null;
|
|
58
|
+
install(ctx, options) {
|
|
59
|
+
super.install(ctx, options);
|
|
60
|
+
const elementPlugin = ctx.get(TElementPlugin);
|
|
61
|
+
elementPlugin?.events.on("ready", (element) => {
|
|
62
|
+
this._element = element;
|
|
63
|
+
this._sync();
|
|
64
|
+
});
|
|
65
|
+
elementPlugin?.events.on("removed", () => {
|
|
66
|
+
this._element = null;
|
|
67
|
+
this._sync();
|
|
68
|
+
});
|
|
69
|
+
this._enabled = options?.enabled ?? this._enabled;
|
|
70
|
+
this._open = bindOverlayOpen(ctx, options, (open) => {
|
|
71
|
+
this.enabled = open;
|
|
72
|
+
});
|
|
73
|
+
if (this._open) this.enabled = this._open.read();
|
|
74
|
+
this._sync();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Запирать ли прокрутку. Владелец взводит это открытием; своё значение
|
|
78
|
+
* плагин держит и без корня — замок ляжет, как только корень объявят.
|
|
79
|
+
*
|
|
80
|
+
* `true` запирает сразу, а `false` отпускает замок не сразу, а когда корень
|
|
81
|
+
* доиграет переходы закрытия. `change:enabled` приходит сразу в обе
|
|
82
|
+
* стороны: это нужное состояние, а не факт отпирания.
|
|
83
|
+
*/
|
|
84
|
+
get enabled() {
|
|
85
|
+
return this._enabled;
|
|
86
|
+
}
|
|
87
|
+
set enabled(value) {
|
|
88
|
+
const oldEnabled = this.enabled;
|
|
89
|
+
if (this._enabled === value) return;
|
|
90
|
+
this._enabled = value;
|
|
91
|
+
if (value) this._sync();
|
|
92
|
+
else this._releaseAfterTransitions();
|
|
93
|
+
this.events.emit("change:enabled", {
|
|
94
|
+
newValue: value,
|
|
95
|
+
oldValue: oldEnabled
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
destroy() {
|
|
99
|
+
this._enabled = false;
|
|
100
|
+
this._sync();
|
|
101
|
+
this._element = null;
|
|
102
|
+
this._open?.unbind();
|
|
103
|
+
this._open = null;
|
|
104
|
+
super.destroy();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Замок сейчас — ровно по состоянию: лежит, когда владелец открыт и корень
|
|
108
|
+
* объявлен. Ожидание перехода закрытия это отменяет: состояние решено
|
|
109
|
+
* заново.
|
|
110
|
+
*/
|
|
111
|
+
_sync() {
|
|
112
|
+
this._stopWaiting?.();
|
|
113
|
+
this._stopWaiting = null;
|
|
114
|
+
const doc = this._enabled ? this._element?.ownerDocument ?? null : null;
|
|
115
|
+
if (doc === this._locked) return;
|
|
116
|
+
if (this._locked) unlockScroll(this._locked);
|
|
117
|
+
if (doc) lockScroll(doc);
|
|
118
|
+
this._locked = doc;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Выключили — замок остаётся, пока корень доигрывает переходы закрытия, и
|
|
122
|
+
* только потом отпускается. Замка нет — отпускать нечего.
|
|
123
|
+
*/
|
|
124
|
+
_releaseAfterTransitions() {
|
|
125
|
+
const element = this._element;
|
|
126
|
+
if (!this._locked || !element) return;
|
|
127
|
+
this._stopWaiting = afterTransitions(element, () => {
|
|
128
|
+
this._stopWaiting = null;
|
|
129
|
+
this._sync();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
export { TScrollLockPlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TValuePayload } from '@soxa-ui/core';
|
|
2
|
+
import type { TPluginEvents } from '../../../base';
|
|
3
|
+
import type { IOverlayOpenOptions } from '../types';
|
|
4
|
+
export interface IScrollLockPluginOptions extends IOverlayOpenOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Заперта ли прокрутка сразу после установки.
|
|
7
|
+
*
|
|
8
|
+
* Обычно этого не задают: плагин сам следит за открытостью владельца
|
|
9
|
+
* (`property`). Но, как и у `TDismissPlugin`, замок можно вести и вручную
|
|
10
|
+
* — `property: null` и запись в `enabled`.
|
|
11
|
+
*/
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type TScrollLockPluginEvents = TPluginEvents & {
|
|
15
|
+
/** change:enabled */
|
|
16
|
+
'change:enabled': (payload: TValuePayload<boolean>) => void;
|
|
17
|
+
};
|