@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuri Soldatov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,126 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @soxa-ui/plugins
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Runtime behavior installed into a plugin bundle: DOM, focus, keyboard, overlay.**
|
|
4
|
+
|
|
5
|
+
Part of [Soxa UI](https://github.com/youra-h/soxa-ui) — UI components with the logic written once: a
|
|
6
|
+
framework-agnostic core and thin adapters that render it in Vue, React, Angular, Svelte, Solid and
|
|
7
|
+
Web Components.
|
|
8
|
+
|
|
9
|
+
Models in `@soxa-ui/core` have no access to the DOM. Everything that needs a live node — listening
|
|
10
|
+
for events, moving focus, measuring and positioning an overlay, normalizing keyboard activation —
|
|
11
|
+
is a plugin here, written once for all six adapters.
|
|
12
|
+
|
|
13
|
+
## Component availability and DOM readiness
|
|
14
|
+
|
|
15
|
+
`TReadyPlugin` reports that a component is loaded and available: its instance exists and its
|
|
16
|
+
root DOM element has been announced. It maintains `instance.ready` and the model's `ready`
|
|
17
|
+
event. The instance itself is created before the DOM root becomes available.
|
|
18
|
+
|
|
19
|
+
| Signal | Meaning |
|
|
20
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| `element:ready(element)` | The bound root is announced in the next animation frame. DOM plugins can attach listeners, measure, or observe it. |
|
|
22
|
+
| `element:removed()` | An announced root was removed or replaced. DOM plugins detach their behavior. |
|
|
23
|
+
| `ready(true / false)` | Component availability changed. `TReadyPlugin` translates element readiness and removal into this boolean model state. |
|
|
24
|
+
|
|
25
|
+
The `element:` prefix is the public plugin namespace. Inside a plugin, subscribe to
|
|
26
|
+
`bundle.get(TElementPlugin)?.events.on('ready', handler)` and `'removed'` on the same bus.
|
|
27
|
+
The model's `ready` event carries a boolean rather than a DOM node:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { TButton } from '@soxa-ui/core'
|
|
31
|
+
|
|
32
|
+
const button = new TButton({ text: 'Save' })
|
|
33
|
+
|
|
34
|
+
// Subscribe before mounting this controller with an adapter.
|
|
35
|
+
button.events.on('ready', (available) => {
|
|
36
|
+
console.log(available ? 'Component available' : 'Component unavailable')
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`ready` starts as `false`. Removing an announced root sets it to `false`; announcing a root
|
|
41
|
+
again sets it to `true`. Replacing an announced root follows the same cycle: `false`
|
|
42
|
+
synchronously, then `true` in the next animation frame. A binding removed before its first
|
|
43
|
+
announcement emits neither element event. Server rendering does not announce a DOM root.
|
|
44
|
+
|
|
45
|
+
Availability does not imply visibility or completion of every plugin's DOM handler,
|
|
46
|
+
asynchronous initialization, layout observation, or animation. A `ready(true)` handler can run
|
|
47
|
+
before other plugins' handlers of the same element announcement. The events do not replay:
|
|
48
|
+
when subscribing after mounting, read `instance.ready` for current availability. DOM plugins
|
|
49
|
+
can also read `TElementPlugin.element`, which is assigned immediately, before its announcement.
|
|
50
|
+
|
|
51
|
+
`TLayer` continues to use `instance.ready` to expose `zIndex` and `data-layer` while the
|
|
52
|
+
component is available; on the server or without an announced root, its exposed `zIndex` is `0`.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install @soxa-ui/plugins
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
An adapter assembles the bundle for you, so you rarely install this package on its own — it comes
|
|
61
|
+
with `@soxa-ui/setup`.
|
|
62
|
+
|
|
63
|
+
## Usage
|
|
64
|
+
|
|
65
|
+
Reach a plugin of a mounted component from its instance — the bundle announces itself on the same
|
|
66
|
+
event bus the template uses:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { TButton } from '@soxa-ui/core'
|
|
70
|
+
import { TActionPlugin, TPluginBundle } from '@soxa-ui/plugins'
|
|
71
|
+
|
|
72
|
+
const button = new TButton({ text: 'Save' })
|
|
73
|
+
|
|
74
|
+
button.events.on('bundle:create', (bundle: unknown) => {
|
|
75
|
+
if (bundle instanceof TPluginBundle) {
|
|
76
|
+
// press is a normalized activation: a click, or Enter/Space on any tag
|
|
77
|
+
bundle.get(TActionPlugin)?.events.on('press', () => console.log('pressed'))
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Add a plugin of your own to every component of a type — see
|
|
83
|
+
[Plugins and extensions from outside](https://github.com/youra-h/soxa-ui/blob/main/AGENTS.md):
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { usePlugins } from '@soxa-ui/setup'
|
|
87
|
+
import { TButton } from '@soxa-ui/core'
|
|
88
|
+
|
|
89
|
+
usePlugins(TButton, [TRipplePlugin])
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Set the motion mode of the whole library at the entry point of the application. By default motion
|
|
93
|
+
follows the system's reduced-motion setting:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { useMotion } from '@soxa-ui/plugins'
|
|
97
|
+
|
|
98
|
+
useMotion('full') // motion even when the system asks to reduce it; 'reduce' — never
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The language and the strings of the library are one value — a locale — that comes from the
|
|
102
|
+
nearest `LocaleProvider` of the framework adapter. A component has neither of its own: the
|
|
103
|
+
language and name plugins write them on mount and on every change, so the first render — the
|
|
104
|
+
server one too — is already in the subtree's language. This package ships the locales and the tools
|
|
105
|
+
to make your own:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { enUS, esES, ruRU, extendLocale, formatName } from '@soxa-ui/plugins'
|
|
109
|
+
import type { TLocale } from '@soxa-ui/plugins'
|
|
110
|
+
|
|
111
|
+
const esMX = extendLocale(esES, { tag: 'es-MX' }) // another region of a ready language
|
|
112
|
+
const mn: TLocale = extendLocale(enUS, { tag: 'mn-MN', translations: { modal: { close: 'Хаах' } } })
|
|
113
|
+
|
|
114
|
+
formatName(ruRU.translations.tabs.close, 'Почта') // 'Закрыть Почта'
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Documentation
|
|
118
|
+
|
|
119
|
+
- [Soxa UI README](https://github.com/youra-h/soxa-ui#readme) — what the library is and how it is
|
|
120
|
+
put together.
|
|
121
|
+
- [Architecture overview](https://github.com/youra-h/soxa-ui/blob/main/docs/architecture.md) —
|
|
122
|
+
layers, descriptors, plugins, collections, adapters.
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
[MIT](https://github.com/youra-h/soxa-ui/blob/main/LICENSE)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { IListenable, IPlugin, IPluginContext, TPluginEvents } from './types';
|
|
2
|
+
import { TEvented } from '@soxa-ui/core';
|
|
3
|
+
import type { TEventSink } from '@soxa-ui/core';
|
|
4
|
+
export declare abstract class TBasePlugin<TInstance = any, TEvents extends TPluginEvents = TPluginEvents> implements IPlugin<TInstance, TEvents> {
|
|
5
|
+
readonly events: TEvented<TEvents>;
|
|
6
|
+
/**
|
|
7
|
+
* Отписки от чужих шин, на которые плагин подписался через
|
|
8
|
+
* {@link _listenTo}. Их снимает `destroy()` — тот же приём, что `_relays`
|
|
9
|
+
* у `TEvented.relay`.
|
|
10
|
+
*/
|
|
11
|
+
private _unsubscribes;
|
|
12
|
+
install(ctx: IPluginContext, options?: unknown): void;
|
|
13
|
+
/** Run the internal creation announcement after the bundle becomes available. */
|
|
14
|
+
created(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Снимает подписки {@link _listenTo} и сообщает об уничтожении. Список
|
|
17
|
+
* очищается, поэтому повторный вызов отписываться уже не будет.
|
|
18
|
+
*/
|
|
19
|
+
destroy(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Эмит собственных событий базы — без приведения `this.events` к
|
|
22
|
+
* конкретной карте (см. `TEventSink` в `@soxa-ui/core`). Эмит звучит за
|
|
23
|
+
* счёт констрейнта: карта наследника включает `TPluginEvents`.
|
|
24
|
+
*/
|
|
25
|
+
protected get _sink(): TEventSink<TPluginEvents>;
|
|
26
|
+
/**
|
|
27
|
+
* Подписаться на шину, которая живёт дольше плагина: подписку снимет
|
|
28
|
+
* `destroy()`.
|
|
29
|
+
*
|
|
30
|
+
* Такая шина — у владельца (`ctx.getInstance()`): свой `ctrl` приложения
|
|
31
|
+
* переживает перемонтирование, и каждое монтирование ставит ему новый набор.
|
|
32
|
+
* Такие же — у расширений движка коллекции, когда движок пришёл снаружи
|
|
33
|
+
* (`engine`), и у любого инстанса ядра, которого плагин не создавал.
|
|
34
|
+
* Подписка прямым `on` копила бы на них обработчики уничтоженных плагинов.
|
|
35
|
+
*
|
|
36
|
+
* На шину плагина — своего набора (`ctx.get(...)`) или набора элемента —
|
|
37
|
+
* подписываются прямым `on`: она умирает вместе с набором.
|
|
38
|
+
*
|
|
39
|
+
* Метод, а не пара `on`/`off` в каждом плагине: той паре нужно поле под
|
|
40
|
+
* каждый обработчик, а забытый `off` не виден — обработчик уничтоженного
|
|
41
|
+
* плагина ничего не делает, и шина копит его молча.
|
|
42
|
+
*
|
|
43
|
+
* Шины нет (у набора нет владельца, у движка нет расширения) —
|
|
44
|
+
* подписываться не на что. Имя события и обработчик сверяются по карте
|
|
45
|
+
* шины, как у `TEvented.on`.
|
|
46
|
+
*
|
|
47
|
+
* `TEvented` в типе шины — ради вывода карты, а не второй вид шины: из
|
|
48
|
+
* `TEvented<X>` в `IListenable` TypeScript карту не выводит (методы у
|
|
49
|
+
* `IListenable` обобщённые), а из `TEvented<X>` в `TEvented` — выводит.
|
|
50
|
+
* `IListenable` нужен шине владельца, которого плагин знает по контракту
|
|
51
|
+
* (`TListHeightPlugin`).
|
|
52
|
+
*/
|
|
53
|
+
protected _listenTo<TSource extends Record<string, (...args: any) => any>, K extends keyof TSource>(source: TEvented<TSource> | IListenable<TSource> | null | undefined, event: K, handler: TSource[K]): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TEvented } from "@soxa-ui/core";
|
|
2
|
+
//#region src/base/base.class.ts
|
|
3
|
+
var TBasePlugin = class {
|
|
4
|
+
events = new TEvented();
|
|
5
|
+
/**
|
|
6
|
+
* Отписки от чужих шин, на которые плагин подписался через
|
|
7
|
+
* {@link _listenTo}. Их снимает `destroy()` — тот же приём, что `_relays`
|
|
8
|
+
* у `TEvented.relay`.
|
|
9
|
+
*/
|
|
10
|
+
_unsubscribes = [];
|
|
11
|
+
install(ctx, options) {
|
|
12
|
+
this._sink.emit("install", ctx, options);
|
|
13
|
+
}
|
|
14
|
+
/** Run the internal creation announcement after the bundle becomes available. */
|
|
15
|
+
created() {
|
|
16
|
+
this._sink.emit("create", this);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Снимает подписки {@link _listenTo} и сообщает об уничтожении. Список
|
|
20
|
+
* очищается, поэтому повторный вызов отписываться уже не будет.
|
|
21
|
+
*/
|
|
22
|
+
destroy() {
|
|
23
|
+
for (const unsubscribe of this._unsubscribes) unsubscribe();
|
|
24
|
+
this._unsubscribes = [];
|
|
25
|
+
this._sink.emit("destroy");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Эмит собственных событий базы — без приведения `this.events` к
|
|
29
|
+
* конкретной карте (см. `TEventSink` в `@soxa-ui/core`). Эмит звучит за
|
|
30
|
+
* счёт констрейнта: карта наследника включает `TPluginEvents`.
|
|
31
|
+
*/
|
|
32
|
+
get _sink() {
|
|
33
|
+
return this.events;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Подписаться на шину, которая живёт дольше плагина: подписку снимет
|
|
37
|
+
* `destroy()`.
|
|
38
|
+
*
|
|
39
|
+
* Такая шина — у владельца (`ctx.getInstance()`): свой `ctrl` приложения
|
|
40
|
+
* переживает перемонтирование, и каждое монтирование ставит ему новый набор.
|
|
41
|
+
* Такие же — у расширений движка коллекции, когда движок пришёл снаружи
|
|
42
|
+
* (`engine`), и у любого инстанса ядра, которого плагин не создавал.
|
|
43
|
+
* Подписка прямым `on` копила бы на них обработчики уничтоженных плагинов.
|
|
44
|
+
*
|
|
45
|
+
* На шину плагина — своего набора (`ctx.get(...)`) или набора элемента —
|
|
46
|
+
* подписываются прямым `on`: она умирает вместе с набором.
|
|
47
|
+
*
|
|
48
|
+
* Метод, а не пара `on`/`off` в каждом плагине: той паре нужно поле под
|
|
49
|
+
* каждый обработчик, а забытый `off` не виден — обработчик уничтоженного
|
|
50
|
+
* плагина ничего не делает, и шина копит его молча.
|
|
51
|
+
*
|
|
52
|
+
* Шины нет (у набора нет владельца, у движка нет расширения) —
|
|
53
|
+
* подписываться не на что. Имя события и обработчик сверяются по карте
|
|
54
|
+
* шины, как у `TEvented.on`.
|
|
55
|
+
*
|
|
56
|
+
* `TEvented` в типе шины — ради вывода карты, а не второй вид шины: из
|
|
57
|
+
* `TEvented<X>` в `IListenable` TypeScript карту не выводит (методы у
|
|
58
|
+
* `IListenable` обобщённые), а из `TEvented<X>` в `TEvented` — выводит.
|
|
59
|
+
* `IListenable` нужен шине владельца, которого плагин знает по контракту
|
|
60
|
+
* (`TListHeightPlugin`).
|
|
61
|
+
*/
|
|
62
|
+
_listenTo(source, event, handler) {
|
|
63
|
+
if (!source) return;
|
|
64
|
+
source.on(event, handler);
|
|
65
|
+
this._unsubscribes.push(() => source.off(event, handler));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { TBasePlugin };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TEvented } from '@soxa-ui/core';
|
|
2
|
+
import type { ILocaleSource } from '../locale/types';
|
|
3
|
+
import type { IPlugin, IPluginBundle, IPluginConstructor, TPluginBundleEvents } from './types';
|
|
4
|
+
export declare class TPluginBundle implements IPluginBundle {
|
|
5
|
+
private readonly _instance;
|
|
6
|
+
readonly events: TEvented<TPluginBundleEvents>;
|
|
7
|
+
private _plugins;
|
|
8
|
+
/** Набор объявлен наружу (`created()`): плагин, поставленный позже, объявляется сразу. */
|
|
9
|
+
private _created;
|
|
10
|
+
/** Набор уничтожен (`destroy()`): объявлять его наружу больше нельзя. */
|
|
11
|
+
private _destroyed;
|
|
12
|
+
/** Id монтирования, которому принадлежит набор (`createId`). */
|
|
13
|
+
private readonly _mountId;
|
|
14
|
+
readonly locale: ILocaleSource;
|
|
15
|
+
constructor(_instance: object, mountId?: string, locale?: ILocaleSource);
|
|
16
|
+
get destroyed(): boolean;
|
|
17
|
+
/** Компонент, которому принадлежит набор. */
|
|
18
|
+
getInstance<T>(): T | null;
|
|
19
|
+
createId(part: string): string;
|
|
20
|
+
use<P extends IPlugin<any, any>>(PluginCtor: IPluginConstructor<any, any, P>, options?: object): this;
|
|
21
|
+
get<P extends IPlugin<any, any>>(ctor: IPluginConstructor<any, any, P>): P | undefined;
|
|
22
|
+
remove<P extends IPlugin<any, any>>(PluginCtor: IPluginConstructor<any, any, P>): void;
|
|
23
|
+
created(): void;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { enUS } from "../locale/locales/en.js";
|
|
2
|
+
import { TLocaleSource } from "../locale/source.class.js";
|
|
3
|
+
import { TEvented } from "@soxa-ui/core";
|
|
4
|
+
//#region src/base/bundle.class.ts
|
|
5
|
+
/** Наборов без id монтирования от адаптера: номер такого монтирования в процессе. */
|
|
6
|
+
var unnamedMounts = 0;
|
|
7
|
+
var TPluginBundle = class {
|
|
8
|
+
_instance;
|
|
9
|
+
events = new TEvented();
|
|
10
|
+
_plugins = /* @__PURE__ */ new Map();
|
|
11
|
+
/** Набор объявлен наружу (`created()`): плагин, поставленный позже, объявляется сразу. */
|
|
12
|
+
_created = false;
|
|
13
|
+
/** Набор уничтожен (`destroy()`): объявлять его наружу больше нельзя. */
|
|
14
|
+
_destroyed = false;
|
|
15
|
+
/** Id монтирования, которому принадлежит набор (`createId`). */
|
|
16
|
+
_mountId;
|
|
17
|
+
locale;
|
|
18
|
+
constructor(_instance, mountId, locale) {
|
|
19
|
+
this._instance = _instance;
|
|
20
|
+
this._mountId = mountId || `so-${++unnamedMounts}`;
|
|
21
|
+
this.locale = locale ?? new TLocaleSource(enUS);
|
|
22
|
+
}
|
|
23
|
+
get destroyed() {
|
|
24
|
+
return this._destroyed;
|
|
25
|
+
}
|
|
26
|
+
/** Компонент, которому принадлежит набор. */
|
|
27
|
+
getInstance() {
|
|
28
|
+
return this._instance ?? null;
|
|
29
|
+
}
|
|
30
|
+
createId(part) {
|
|
31
|
+
return `${this._mountId}-${part}`;
|
|
32
|
+
}
|
|
33
|
+
use(PluginCtor, options) {
|
|
34
|
+
const plugin = new PluginCtor();
|
|
35
|
+
this._plugins.set(PluginCtor, plugin);
|
|
36
|
+
plugin.install({
|
|
37
|
+
get: this.get.bind(this),
|
|
38
|
+
getInstance: this.getInstance.bind(this),
|
|
39
|
+
createId: this.createId.bind(this),
|
|
40
|
+
locale: this.locale
|
|
41
|
+
}, options);
|
|
42
|
+
if (this._created) plugin.created();
|
|
43
|
+
this.events.emit("use", PluginCtor, plugin);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
get(ctor) {
|
|
47
|
+
return this._plugins.get(ctor);
|
|
48
|
+
}
|
|
49
|
+
remove(PluginCtor) {
|
|
50
|
+
const plugin = this._plugins.get(PluginCtor);
|
|
51
|
+
if (!plugin) return;
|
|
52
|
+
this.events.emit("remove", PluginCtor, plugin);
|
|
53
|
+
plugin.destroy();
|
|
54
|
+
this._plugins.delete(PluginCtor);
|
|
55
|
+
}
|
|
56
|
+
created() {
|
|
57
|
+
if (this._created || this._destroyed) return;
|
|
58
|
+
this._created = true;
|
|
59
|
+
for (const plugin of [...this._plugins.values()]) plugin.created();
|
|
60
|
+
}
|
|
61
|
+
destroy() {
|
|
62
|
+
this._destroyed = true;
|
|
63
|
+
for (const plugin of [...this._plugins.values()].reverse()) plugin.destroy();
|
|
64
|
+
this._plugins.clear();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { TPluginBundle };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { TEvented } from '@soxa-ui/core';
|
|
2
|
+
import type { ILocaleSource } from '../locale/types';
|
|
3
|
+
/**
|
|
4
|
+
* Контекст, передаваемый плагину при установке.
|
|
5
|
+
*/
|
|
6
|
+
export interface IPluginContext {
|
|
7
|
+
get<P extends IPlugin<any, any>>(ctor: IPluginConstructor<any, any, P>): P | undefined;
|
|
8
|
+
getInstance<T>(): T | null;
|
|
9
|
+
/**
|
|
10
|
+
* `id` части компонента в документе — тот же метод набора
|
|
11
|
+
* (`IPluginBundle.createId`).
|
|
12
|
+
*/
|
|
13
|
+
createId(part: string): string;
|
|
14
|
+
/** Локаль поддерева — та же, что у набора (`IPluginBundle.locale`). */
|
|
15
|
+
readonly locale: ILocaleSource;
|
|
16
|
+
}
|
|
17
|
+
export type TPluginEvents = {
|
|
18
|
+
install: (ctx: IPluginContext, options?: unknown) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Плагин уничтожается. Без аргументов, как и сам `destroy()`: контекста
|
|
21
|
+
* при уничтожении у плагина нет.
|
|
22
|
+
*/
|
|
23
|
+
destroy: () => void;
|
|
24
|
+
/** Internal announcement after bundle:create, once adapters can subscribe. */
|
|
25
|
+
create: (plugin: IPlugin<any, any>) => void;
|
|
26
|
+
};
|
|
27
|
+
/** Base lifecycle events stay internal to the plugin bundle. */
|
|
28
|
+
export type TPluginInternalEvents = TPluginEvents;
|
|
29
|
+
/**
|
|
30
|
+
* Плагин — независимая единица логики, устанавливаемая на компонент.
|
|
31
|
+
*/
|
|
32
|
+
export interface IPlugin<TInstance = any, TEvents extends Record<string, (...args: any) => any> = TPluginEvents> {
|
|
33
|
+
readonly events: TEvented<TEvents>;
|
|
34
|
+
install(ctx: IPluginContext, options?: unknown): void;
|
|
35
|
+
/** Объявить плагин доступным снаружи. Вызывается adapter-слоем. */
|
|
36
|
+
created(): void;
|
|
37
|
+
destroy(): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Чужая шина глазами плагина: подписка и отписка по одной карте событий.
|
|
41
|
+
*
|
|
42
|
+
* Так плагин описывает шину владельца, которого знает по контракту, а не по
|
|
43
|
+
* классу: `TListHeightPlugin` стоит и на ListBox, и на Select, общего предка у
|
|
44
|
+
* них нет, а `TEvented` инвариантен по карте событий — `TEvented` одного из них
|
|
45
|
+
* в `TEvented` общей карты не присваивается. Любой `TEvented`, чья карта
|
|
46
|
+
* содержит эти события, под этот вид подходит.
|
|
47
|
+
*/
|
|
48
|
+
export interface IListenable<TEvents extends Record<string, (...args: any) => any>> {
|
|
49
|
+
on<K extends keyof TEvents>(event: K, handler: TEvents[K]): void;
|
|
50
|
+
off<K extends keyof TEvents>(event: K, handler: TEvents[K]): void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Конструктор плагина (со статическим namespace).
|
|
54
|
+
*/
|
|
55
|
+
export interface IPluginConstructor<TInstance = any, TEvents extends Record<string, (...args: any) => any> = TPluginEvents, P extends IPlugin<TInstance, TEvents> = IPlugin<TInstance, TEvents>> {
|
|
56
|
+
new (): P;
|
|
57
|
+
/**
|
|
58
|
+
* Умолчания опций, которые плагин объявляет пропами, — тот же приём, что
|
|
59
|
+
* `static defaultValues` у классов ядра.
|
|
60
|
+
*
|
|
61
|
+
* С них плагин стартует, если опция не задана, и из них же setup собирает
|
|
62
|
+
* умолчание в описание пропа (`TPropSpec.default`), откуда его
|
|
63
|
+
* берёт адаптер. Умолчание в приватном поле метаданные не видят: адаптер
|
|
64
|
+
* подставил бы отсутствующему пропу своё значение и записал его в плагин.
|
|
65
|
+
*/
|
|
66
|
+
readonly defaultValues?: Readonly<Record<string, unknown>>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Контейнер плагинов.
|
|
70
|
+
*/
|
|
71
|
+
/**
|
|
72
|
+
* События набора: плагин встал и плагин снят — в любой момент жизни
|
|
73
|
+
* компонента, не только при сборке. По ним setup подхватывает контракт
|
|
74
|
+
* плагина, поставленного снаружи (`pluginProps`, `plugin:event`).
|
|
75
|
+
*/
|
|
76
|
+
export type TPluginBundleEvents = {
|
|
77
|
+
/** Плагин установлен: после `install`. */
|
|
78
|
+
use: (ctor: IPluginConstructor<any, any, any>, plugin: IPlugin<any, any>) => void;
|
|
79
|
+
/** Плагин снимается: до его `destroy`. */
|
|
80
|
+
remove: (ctor: IPluginConstructor<any, any, any>, plugin: IPlugin<any, any>) => void;
|
|
81
|
+
};
|
|
82
|
+
export interface IPluginBundle {
|
|
83
|
+
/** Шина набора: `use`, `remove` (`TPluginBundleEvents`). */
|
|
84
|
+
readonly events: TEvented<TPluginBundleEvents>;
|
|
85
|
+
/**
|
|
86
|
+
* Компонент, которому принадлежит набор.
|
|
87
|
+
*
|
|
88
|
+
* Тот же метод, что плагин внутри бандла видит как `ctx.getInstance()` —
|
|
89
|
+
* контекст отдаёт именно его, связанным. Одно имя и одна сигнатура снаружи
|
|
90
|
+
* и изнутри.
|
|
91
|
+
*
|
|
92
|
+
* Наружу нужен потому, что владельческий плагин получает от
|
|
93
|
+
* `TCollectionBundlesPlugin` бандлы элементов, а дотянуться должен до самих
|
|
94
|
+
* элементов — например, чтобы проставить им `data-*`.
|
|
95
|
+
*/
|
|
96
|
+
getInstance<T>(): T | null;
|
|
97
|
+
/**
|
|
98
|
+
* `id` части компонента в документе: `<mountId>-<part>`.
|
|
99
|
+
*
|
|
100
|
+
* `mountId` — id монтирования, которому принадлежит набор. Его даёт адаптер
|
|
101
|
+
* от `useId` фреймворка: тот выводит его из места компонента в дереве, и на
|
|
102
|
+
* сервере и в браузере он один. Поэтому `id`, ссылки на них и пометки
|
|
103
|
+
* панелей сходятся при гидратации. Монтирование, а не экземпляр: свой id
|
|
104
|
+
* монтирования есть и у внешнего `ctrl`, и у элемента коллекции из данных —
|
|
105
|
+
* их конструктор адаптер не зовёт.
|
|
106
|
+
*
|
|
107
|
+
* Адаптер без `useId` id монтирования не даёт, и набор берёт его из своего
|
|
108
|
+
* счётчика процесса — серверный рендер с таким адаптером по `id` не сойдётся.
|
|
109
|
+
*/
|
|
110
|
+
createId(part: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* Локаль поддерева, в котором смонтирован компонент: тег для Intl и строки
|
|
113
|
+
* библиотеки, с событием смены.
|
|
114
|
+
*
|
|
115
|
+
* Её даёт адаптер — от провайдера локали фреймворка, ближайшего выше по
|
|
116
|
+
* дереву, как id монтирования — от `useId`: язык знает место компонента в
|
|
117
|
+
* дереве, а не экземпляр. Поэтому сервер рисует параллельные запросы каждый
|
|
118
|
+
* на своём языке, а вложенный провайдер даёт поддереву свой. Без провайдера
|
|
119
|
+
* у набора своя английская локаль (`enUS`).
|
|
120
|
+
*
|
|
121
|
+
* Читают её плагины языка и имён (`TLocalePlugin`, `TNamesPlugin`): пишут
|
|
122
|
+
* при установке и подписываются на смену.
|
|
123
|
+
*/
|
|
124
|
+
readonly locale: ILocaleSource;
|
|
125
|
+
use<P extends IPlugin<any, any>>(PluginCtor: IPluginConstructor<any, any, P>, options?: object): this;
|
|
126
|
+
get<P extends IPlugin<any, any>>(ctor: IPluginConstructor<any, any, P>): P | undefined;
|
|
127
|
+
remove<P extends IPlugin<any, any>>(PluginCtor: IPluginConstructor<any, any, P>): void;
|
|
128
|
+
/**
|
|
129
|
+
* Объявить набор наружу: `created()` у каждого плагина, в порядке установки.
|
|
130
|
+
* Плагин, поставленный после этого, объявляется сразу в `use()`. Повторный
|
|
131
|
+
* вызов и вызов на уничтоженном наборе ничего не делают. Вызывает setup
|
|
132
|
+
* (`assembleBundle`).
|
|
133
|
+
*/
|
|
134
|
+
created(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Уничтожить набор: `destroy()` у каждого плагина, в обратном порядке
|
|
137
|
+
* установки, — и выставить `destroyed`. Вызывает владелец набора —
|
|
138
|
+
* адаптерный контекст, который его создал.
|
|
139
|
+
*/
|
|
140
|
+
destroy(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Набор уничтожен (`destroy()`) и наружу больше не объявляется: плагин,
|
|
143
|
+
* который подписчик поставил бы в него, уничтожать уже некому. По нему
|
|
144
|
+
* setup не шлёт `bundle:create`, если набор уничтожили раньше, чем объявили.
|
|
145
|
+
*/
|
|
146
|
+
readonly destroyed: boolean;
|
|
147
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IPluginContext } from '../../base';
|
|
2
|
+
/**
|
|
3
|
+
* Заголовок секции в её узле. `null` — узла нет или заголовка в нём нет.
|
|
4
|
+
*
|
|
5
|
+
* Узел фокуса `Accordion.Item` (`focusTarget` плагина действия): запись
|
|
6
|
+
* `focused = true` ставит фокус на заголовок, а не на обёртку секции.
|
|
7
|
+
*/
|
|
8
|
+
export declare function headerIn(node: Element | null): Element | null;
|
|
9
|
+
/**
|
|
10
|
+
* Заголовок первой секции, на которую можно перейти, — узел фокуса Accordion
|
|
11
|
+
* (`focusTarget` плагина действия). Остановок у аккордеона столько же, сколько
|
|
12
|
+
* заголовков, и запись `focused = true` ставит фокус на первую из них — туда
|
|
13
|
+
* же, куда ведёт Tab. Секции — по коллекции, в порядке показа; заголовок —
|
|
14
|
+
* тем же правилом, что у самой секции (`headerIn`).
|
|
15
|
+
*
|
|
16
|
+
* `null` — секций, на которые можно перейти, нет, или узла секции нет в
|
|
17
|
+
* документе.
|
|
18
|
+
*/
|
|
19
|
+
export declare function firstHeaderOf(_root: Element, ctx: IPluginContext): Element | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TCollectionElements } from "../collection/collection-elements.plugin.js";
|
|
2
|
+
import { isReachable } from "../collection/reachable.js";
|
|
3
|
+
import { batchOf } from "@soxa-ui/core";
|
|
4
|
+
//#region src/custom/accordion/header.ts
|
|
5
|
+
/**
|
|
6
|
+
* Заголовок секции внутри её узла. Корень секции — обёртка для темы вокруг
|
|
7
|
+
* заголовка и панели, а заголовком является вложенная кнопка: на ней набор
|
|
8
|
+
* `aria` секции, и раскрытость панели по APG Accordion объявляет её
|
|
9
|
+
* `aria-expanded`. Заголовок — первый такой узел: панель и всё, что в ней
|
|
10
|
+
* лежит, идут за ним.
|
|
11
|
+
*/
|
|
12
|
+
var HEADER_SELECTOR = "[aria-expanded]";
|
|
13
|
+
/**
|
|
14
|
+
* Заголовок секции в её узле. `null` — узла нет или заголовка в нём нет.
|
|
15
|
+
*
|
|
16
|
+
* Узел фокуса `Accordion.Item` (`focusTarget` плагина действия): запись
|
|
17
|
+
* `focused = true` ставит фокус на заголовок, а не на обёртку секции.
|
|
18
|
+
*/
|
|
19
|
+
function headerIn(node) {
|
|
20
|
+
return node?.querySelector(HEADER_SELECTOR) ?? null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Заголовок первой секции, на которую можно перейти, — узел фокуса Accordion
|
|
24
|
+
* (`focusTarget` плагина действия). Остановок у аккордеона столько же, сколько
|
|
25
|
+
* заголовков, и запись `focused = true` ставит фокус на первую из них — туда
|
|
26
|
+
* же, куда ведёт Tab. Секции — по коллекции, в порядке показа; заголовок —
|
|
27
|
+
* тем же правилом, что у самой секции (`headerIn`).
|
|
28
|
+
*
|
|
29
|
+
* `null` — секций, на которые можно перейти, нет, или узла секции нет в
|
|
30
|
+
* документе.
|
|
31
|
+
*/
|
|
32
|
+
function firstHeaderOf(_root, ctx) {
|
|
33
|
+
const elements = ctx.get(TCollectionElements) ?? null;
|
|
34
|
+
const section = batchOf(elements?.engine)?.shown.find(isReachable);
|
|
35
|
+
return section ? headerIn(elements?.getElementByItem(section) ?? null) : null;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { firstHeaderOf, headerIn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './item-ids.plugin';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TBasePlugin } from '../../../base';
|
|
2
|
+
import type { IPluginContext } from '../../../base';
|
|
3
|
+
/**
|
|
4
|
+
* TAccordionItemIdsPlugin — связка «заголовок ↔ панель» секции Accordion в
|
|
5
|
+
* документе.
|
|
6
|
+
*
|
|
7
|
+
* Обе стороны — в наборах секции. В `aria` (он стоит на заголовке) — `id`
|
|
8
|
+
* заголовка и `aria-controls` на панель. В `contentAria` (он стоит на панели) —
|
|
9
|
+
* `id` панели и `aria-labelledby` на заголовок. Формула одна, здесь.
|
|
10
|
+
*
|
|
11
|
+
* `id` заголовка, заданный приложением (`TIdPlugin` секции), главнее: он и
|
|
12
|
+
* встаёт на заголовок, и на него ссылается панель. Сменили — плагин
|
|
13
|
+
* переписывает обе стороны ссылки на заголовок, сняли — снова `id` от
|
|
14
|
+
* монтирования. У панели `id` приложения нет, её `id` — формула.
|
|
15
|
+
*
|
|
16
|
+
* Без него — `id` от монтирования секции (`createId`), а не от экземпляра: он
|
|
17
|
+
* нужен только документу, и на сервере и в браузере обязан совпасть. Секция
|
|
18
|
+
* из данных рисуется с готовым экземпляром (`ctrl`), и его конструктор адаптер
|
|
19
|
+
* не зовёт, а монтирование у неё своё. Пишется при установке, синхронно, —
|
|
20
|
+
* связка есть уже в первой (и серверной) отрисовке.
|
|
21
|
+
*/
|
|
22
|
+
export declare class TAccordionItemIdsPlugin extends TBasePlugin {
|
|
23
|
+
install(ctx: IPluginContext): void;
|
|
24
|
+
}
|