@jetbrains/ring-ui-built 6.0.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.txt +202 -0
- package/README.md +103 -0
- package/components/_helpers/_rollupPluginBabelHelpers.js +648 -0
- package/components/_helpers/anchor.js +31 -0
- package/components/_helpers/badge.js +3 -0
- package/components/_helpers/button__classes.js +34 -0
- package/components/_helpers/caption.js +31 -0
- package/components/_helpers/card.js +132 -0
- package/components/_helpers/date-picker.js +3 -0
- package/components/_helpers/dialog__body-scroll-preventer.js +54 -0
- package/components/_helpers/grid.js +3 -0
- package/components/_helpers/header.js +3 -0
- package/components/_helpers/heading.js +3 -0
- package/components/_helpers/icon__svg.js +75 -0
- package/components/_helpers/input.js +235 -0
- package/components/_helpers/island.js +3 -0
- package/components/_helpers/link.js +3 -0
- package/components/_helpers/list.js +3 -0
- package/components/_helpers/query-assist__suggestions.js +102 -0
- package/components/_helpers/select__filter.js +94 -0
- package/components/_helpers/services-link.js +48 -0
- package/components/_helpers/sidebar.js +123 -0
- package/components/_helpers/tab-link.js +34 -0
- package/components/_helpers/table.js +3 -0
- package/components/_helpers/theme.js +95 -0
- package/components/_helpers/title.js +103 -0
- package/components/alert/alert.d.ts +113 -0
- package/components/alert/alert.js +294 -0
- package/components/alert/container.d.ts +15 -0
- package/components/alert/container.js +52 -0
- package/components/alert-service/alert-service.d.ts +36 -0
- package/components/alert-service/alert-service.js +220 -0
- package/components/analytics/analytics.d.ts +18 -0
- package/components/analytics/analytics.js +31 -0
- package/components/analytics/analytics__custom-plugin.d.ts +28 -0
- package/components/analytics/analytics__custom-plugin.js +89 -0
- package/components/auth/auth.d.ts +3 -0
- package/components/auth/auth.js +133 -0
- package/components/auth/auth__core.d.ts +236 -0
- package/components/auth/auth__core.js +1653 -0
- package/components/auth/background-flow.d.ts +31 -0
- package/components/auth/background-flow.js +147 -0
- package/components/auth/down-notification.d.ts +15 -0
- package/components/auth/down-notification.js +157 -0
- package/components/auth/iframe-flow.d.ts +20 -0
- package/components/auth/iframe-flow.js +196 -0
- package/components/auth/request-builder.d.ts +48 -0
- package/components/auth/request-builder.js +104 -0
- package/components/auth/response-parser.d.ts +70 -0
- package/components/auth/response-parser.js +138 -0
- package/components/auth/storage.d.ts +112 -0
- package/components/auth/storage.js +429 -0
- package/components/auth/token-validator.d.ts +93 -0
- package/components/auth/token-validator.js +269 -0
- package/components/auth/window-flow.d.ts +26 -0
- package/components/auth/window-flow.js +154 -0
- package/components/auth-dialog/auth-dialog.d.ts +60 -0
- package/components/auth-dialog/auth-dialog.js +221 -0
- package/components/auth-dialog-service/auth-dialog-service.d.ts +6 -0
- package/components/auth-dialog-service/auth-dialog-service.js +92 -0
- package/components/avatar/avatar-example-datauri.d.ts +1 -0
- package/components/avatar/avatar-example-datauri.js +4 -0
- package/components/avatar/avatar.d.ts +52 -0
- package/components/avatar/avatar.js +183 -0
- package/components/avatar/fallback-avatar.d.ts +17 -0
- package/components/avatar/fallback-avatar.js +151 -0
- package/components/badge/badge.d.ts +24 -0
- package/components/badge/badge.js +59 -0
- package/components/button/button.d.ts +67 -0
- package/components/button/button.js +131 -0
- package/components/button/button__classes.d.ts +2 -0
- package/components/button/button__classes.js +2 -0
- package/components/button-group/button-group.d.ts +18 -0
- package/components/button-group/button-group.js +48 -0
- package/components/button-group/caption.d.ts +8 -0
- package/components/button-group/caption.js +5 -0
- package/components/button-set/button-set.d.ts +16 -0
- package/components/button-set/button-set.js +47 -0
- package/components/button-toolbar/button-toolbar.d.ts +16 -0
- package/components/button-toolbar/button-toolbar.js +46 -0
- package/components/caret/caret.d.ts +66 -0
- package/components/caret/caret.js +259 -0
- package/components/checkbox/checkbox.d.ts +45 -0
- package/components/checkbox/checkbox.js +130 -0
- package/components/clipboard/clipboard-fallback.d.ts +2 -0
- package/components/clipboard/clipboard-fallback.js +42 -0
- package/components/clipboard/clipboard.d.ts +5 -0
- package/components/clipboard/clipboard.js +185 -0
- package/components/code/code.d.ts +44 -0
- package/components/code/code.js +191 -0
- package/components/confirm/confirm.d.ts +48 -0
- package/components/confirm/confirm.js +153 -0
- package/components/confirm-service/confirm-service.d.ts +21 -0
- package/components/confirm-service/confirm-service.js +141 -0
- package/components/content-layout/content-layout.d.ts +26 -0
- package/components/content-layout/content-layout.js +79 -0
- package/components/content-layout/sidebar.d.ts +31 -0
- package/components/content-layout/sidebar.js +7 -0
- package/components/contenteditable/contenteditable.d.ts +47 -0
- package/components/contenteditable/contenteditable.js +84 -0
- package/components/control-label/control-label.d.ts +11 -0
- package/components/control-label/control-label.js +36 -0
- package/components/data-list/data-list.d.ts +85 -0
- package/components/data-list/data-list.js +251 -0
- package/components/data-list/data-list.mock.d.ts +16 -0
- package/components/data-list/data-list.mock.js +192 -0
- package/components/data-list/item.d.ts +50 -0
- package/components/data-list/item.js +235 -0
- package/components/data-list/selection.d.ts +16 -0
- package/components/data-list/selection.js +148 -0
- package/components/data-list/title.d.ts +26 -0
- package/components/data-list/title.js +28 -0
- package/components/date-picker/consts.d.ts +98 -0
- package/components/date-picker/consts.js +46 -0
- package/components/date-picker/date-input.d.ts +47 -0
- package/components/date-picker/date-input.js +177 -0
- package/components/date-picker/date-picker.d.ts +77 -0
- package/components/date-picker/date-picker.js +404 -0
- package/components/date-picker/date-popup.d.ts +55 -0
- package/components/date-picker/date-popup.js +488 -0
- package/components/date-picker/day.d.ts +30 -0
- package/components/date-picker/day.js +133 -0
- package/components/date-picker/formats.d.ts +2 -0
- package/components/date-picker/formats.js +3 -0
- package/components/date-picker/month-names.d.ts +13 -0
- package/components/date-picker/month-names.js +110 -0
- package/components/date-picker/month-slider.d.ts +29 -0
- package/components/date-picker/month-slider.js +93 -0
- package/components/date-picker/month.d.ts +14 -0
- package/components/date-picker/month.js +58 -0
- package/components/date-picker/months.d.ts +11 -0
- package/components/date-picker/months.js +133 -0
- package/components/date-picker/weekdays.d.ts +13 -0
- package/components/date-picker/weekdays.js +39 -0
- package/components/date-picker/years.d.ts +25 -0
- package/components/date-picker/years.js +134 -0
- package/components/dialog/dialog.d.ts +64 -0
- package/components/dialog/dialog.js +240 -0
- package/components/dialog/dialog__body-scroll-preventer.d.ts +9 -0
- package/components/dialog/dialog__body-scroll-preventer.js +6 -0
- package/components/dropdown/anchor.d.ts +11 -0
- package/components/dropdown/anchor.js +24 -0
- package/components/dropdown/dropdown.d.ts +87 -0
- package/components/dropdown/dropdown.js +247 -0
- package/components/dropdown-menu/dropdown-menu.d.ts +36 -0
- package/components/dropdown-menu/dropdown-menu.js +199 -0
- package/components/editable-heading/editable-heading.d.ts +32 -0
- package/components/editable-heading/editable-heading.js +276 -0
- package/components/error-bubble/error-bubble.d.ts +18 -0
- package/components/error-bubble/error-bubble.js +88 -0
- package/components/error-message/error-message.d.ts +27 -0
- package/components/error-message/error-message.js +78 -0
- package/components/footer/footer.d.ts +28 -0
- package/components/footer/footer.js +118 -0
- package/components/global/compose.d.ts +7 -0
- package/components/global/compose.js +17 -0
- package/components/global/composeRefs.d.ts +3 -0
- package/components/global/composeRefs.js +19 -0
- package/components/global/controls-height.d.ts +9 -0
- package/components/global/controls-height.js +19 -0
- package/components/global/create-stateful-context.d.ts +27 -0
- package/components/global/create-stateful-context.js +49 -0
- package/components/global/data-tests.d.ts +3 -0
- package/components/global/data-tests.js +30 -0
- package/components/global/dom.d.ts +37 -0
- package/components/global/dom.js +151 -0
- package/components/global/focus-sensor-hoc.d.ts +19 -0
- package/components/global/focus-sensor-hoc.js +165 -0
- package/components/global/fuzzy-highlight.d.ts +11 -0
- package/components/global/fuzzy-highlight.js +90 -0
- package/components/global/get-event-key.d.ts +2 -0
- package/components/global/get-event-key.js +101 -0
- package/components/global/get-uid.d.ts +1 -0
- package/components/global/get-uid.js +22 -0
- package/components/global/inject-styles.d.ts +3 -0
- package/components/global/inject-styles.js +22 -0
- package/components/global/linear-function.d.ts +6 -0
- package/components/global/linear-function.js +15 -0
- package/components/global/listeners.d.ts +8 -0
- package/components/global/listeners.js +58 -0
- package/components/global/memoize.d.ts +1 -0
- package/components/global/memoize.js +23 -0
- package/components/global/normalize-indent.d.ts +1 -0
- package/components/global/normalize-indent.js +60 -0
- package/components/global/promise-with-timeout.d.ts +5 -0
- package/components/global/promise-with-timeout.js +19 -0
- package/components/global/prop-types.d.ts +4 -0
- package/components/global/prop-types.js +9 -0
- package/components/global/react-dom-renderer.d.ts +16 -0
- package/components/global/react-dom-renderer.js +54 -0
- package/components/global/react-render-adapter.d.ts +1 -0
- package/components/global/react-render-adapter.js +6 -0
- package/components/global/rerender-hoc.d.ts +10 -0
- package/components/global/rerender-hoc.js +46 -0
- package/components/global/schedule-raf.d.ts +1 -0
- package/components/global/schedule-raf.js +28 -0
- package/components/global/sniffer.d.ts +3 -0
- package/components/global/sniffer.js +6 -0
- package/components/global/theme.d.ts +21 -0
- package/components/global/theme.js +42 -0
- package/components/global/trivial-template-tag.d.ts +1 -0
- package/components/global/trivial-template-tag.js +21 -0
- package/components/global/typescript-utils.d.ts +2 -0
- package/components/global/typescript-utils.js +8 -0
- package/components/global/url.d.ts +57 -0
- package/components/global/url.js +142 -0
- package/components/global/use-event-callback.d.ts +1 -0
- package/components/global/use-event-callback.js +17 -0
- package/components/global/variables.d.ts +89 -0
- package/components/global/variables.js +1 -0
- package/components/grid/col.d.ts +31 -0
- package/components/grid/col.js +80 -0
- package/components/grid/grid.d.ts +14 -0
- package/components/grid/grid.js +46 -0
- package/components/grid/row.d.ts +40 -0
- package/components/grid/row.js +75 -0
- package/components/group/group.d.ts +12 -0
- package/components/group/group.js +39 -0
- package/components/header/header.d.ts +34 -0
- package/components/header/header.js +189 -0
- package/components/header/logo.d.ts +14 -0
- package/components/header/logo.js +51 -0
- package/components/header/profile.d.ts +75 -0
- package/components/header/profile.js +258 -0
- package/components/header/services-link.d.ts +25 -0
- package/components/header/services-link.js +13 -0
- package/components/header/services.d.ts +33 -0
- package/components/header/services.js +174 -0
- package/components/header/smart-profile.d.ts +36 -0
- package/components/header/smart-profile.js +303 -0
- package/components/header/smart-services.d.ts +26 -0
- package/components/header/smart-services.js +192 -0
- package/components/header/tray-icon.d.ts +32 -0
- package/components/header/tray-icon.js +57 -0
- package/components/header/tray.d.ts +9 -0
- package/components/header/tray.js +41 -0
- package/components/heading/heading.d.ts +25 -0
- package/components/heading/heading.js +69 -0
- package/components/http/http.d.ts +61 -0
- package/components/http/http.js +386 -0
- package/components/http/http.mock.d.ts +20 -0
- package/components/http/http.mock.js +113 -0
- package/components/hub-source/hub-source.d.ts +44 -0
- package/components/hub-source/hub-source.js +217 -0
- package/components/hub-source/hub-source__user.d.ts +4 -0
- package/components/hub-source/hub-source__user.js +60 -0
- package/components/hub-source/hub-source__users-groups.d.ts +24 -0
- package/components/hub-source/hub-source__users-groups.js +86 -0
- package/components/i18n/i18n-context.d.ts +13 -0
- package/components/i18n/i18n-context.js +27 -0
- package/components/i18n/i18n.d.ts +59 -0
- package/components/i18n/i18n.js +139 -0
- package/components/icon/icon.d.ts +43 -0
- package/components/icon/icon.js +109 -0
- package/components/icon/icon__constants.d.ts +30 -0
- package/components/icon/icon__constants.js +34 -0
- package/components/icon/icon__svg.d.ts +15 -0
- package/components/icon/icon__svg.js +14 -0
- package/components/icon/index.d.ts +2 -0
- package/components/icon/index.js +17 -0
- package/components/input/input.d.ts +77 -0
- package/components/input/input.js +35 -0
- package/components/island/adaptive-island-hoc.d.ts +61 -0
- package/components/island/adaptive-island-hoc.js +53 -0
- package/components/island/content.d.ts +43 -0
- package/components/island/content.js +151 -0
- package/components/island/header.d.ts +8 -0
- package/components/island/header.js +100 -0
- package/components/island/island.d.ts +78 -0
- package/components/island/island.js +60 -0
- package/components/island-legacy/content-legacy.d.ts +10 -0
- package/components/island-legacy/content-legacy.js +34 -0
- package/components/island-legacy/header-legacy.d.ts +10 -0
- package/components/island-legacy/header-legacy.js +36 -0
- package/components/island-legacy/island-legacy.d.ts +12 -0
- package/components/island-legacy/island-legacy.js +36 -0
- package/components/link/clickableLink.d.ts +20 -0
- package/components/link/clickableLink.js +69 -0
- package/components/link/link.d.ts +138 -0
- package/components/link/link.js +86 -0
- package/components/list/consts.d.ts +77 -0
- package/components/list/consts.js +27 -0
- package/components/list/list.d.ts +205 -0
- package/components/list/list.js +802 -0
- package/components/list/list__custom.d.ts +6 -0
- package/components/list/list__custom.js +92 -0
- package/components/list/list__hint.d.ts +15 -0
- package/components/list/list__hint.js +33 -0
- package/components/list/list__item.d.ts +8 -0
- package/components/list/list__item.js +237 -0
- package/components/list/list__link.d.ts +9 -0
- package/components/list/list__link.js +76 -0
- package/components/list/list__separator.d.ts +5 -0
- package/components/list/list__separator.js +39 -0
- package/components/list/list__title.d.ts +5 -0
- package/components/list/list__title.js +48 -0
- package/components/list/list__users-groups-source.d.ts +27 -0
- package/components/list/list__users-groups-source.js +195 -0
- package/components/loader/loader.d.ts +28 -0
- package/components/loader/loader.js +93 -0
- package/components/loader/loader__core.d.ts +75 -0
- package/components/loader/loader__core.js +327 -0
- package/components/loader-inline/loader-inline.d.ts +18 -0
- package/components/loader-inline/loader-inline.js +50 -0
- package/components/loader-screen/loader-screen.d.ts +17 -0
- package/components/loader-screen/loader-screen.js +64 -0
- package/components/login-dialog/login-dialog.d.ts +47 -0
- package/components/login-dialog/login-dialog.js +216 -0
- package/components/login-dialog/service.d.ts +2 -0
- package/components/login-dialog/service.js +98 -0
- package/components/markdown/markdown.d.ts +12 -0
- package/components/markdown/markdown.js +43 -0
- package/components/message/message.d.ts +55 -0
- package/components/message/message.js +267 -0
- package/components/old-browsers-message/old-browsers-message.d.ts +2 -0
- package/components/old-browsers-message/old-browsers-message.js +92 -0
- package/components/old-browsers-message/old-browsers-message__stop.d.ts +1 -0
- package/components/old-browsers-message/old-browsers-message__stop.js +11 -0
- package/components/old-browsers-message/white-list.d.ts +2 -0
- package/components/old-browsers-message/white-list.js +37 -0
- package/components/pager/pager.d.ts +78 -0
- package/components/pager/pager.js +390 -0
- package/components/panel/panel.d.ts +12 -0
- package/components/panel/panel.js +39 -0
- package/components/permissions/permissions.d.ts +111 -0
- package/components/permissions/permissions.js +221 -0
- package/components/permissions/permissions__cache.d.ts +93 -0
- package/components/permissions/permissions__cache.js +257 -0
- package/components/popup/popup.consts.d.ts +37 -0
- package/components/popup/popup.consts.js +44 -0
- package/components/popup/popup.d.ts +147 -0
- package/components/popup/popup.js +424 -0
- package/components/popup/popup.target.d.ts +7 -0
- package/components/popup/popup.target.js +24 -0
- package/components/popup/position.d.ts +30 -0
- package/components/popup/position.js +271 -0
- package/components/popup-menu/popup-menu.d.ts +80 -0
- package/components/popup-menu/popup-menu.js +141 -0
- package/components/progress-bar/progress-bar.d.ts +64 -0
- package/components/progress-bar/progress-bar.js +120 -0
- package/components/query-assist/query-assist.d.ts +306 -0
- package/components/query-assist/query-assist.js +1098 -0
- package/components/query-assist/query-assist__suggestions.d.ts +29 -0
- package/components/query-assist/query-assist__suggestions.js +75 -0
- package/components/radio/radio.d.ts +18 -0
- package/components/radio/radio.js +48 -0
- package/components/radio/radio__item.d.ts +28 -0
- package/components/radio/radio__item.js +88 -0
- package/components/select/select.d.ts +276 -0
- package/components/select/select.js +1310 -0
- package/components/select/select__filter.d.ts +19 -0
- package/components/select/select__filter.js +85 -0
- package/components/select/select__popup.d.ts +166 -0
- package/components/select/select__popup.js +631 -0
- package/components/shortcuts/core.d.ts +74 -0
- package/components/shortcuts/core.js +249 -0
- package/components/shortcuts/shortcut-title.d.ts +1 -0
- package/components/shortcuts/shortcut-title.js +56 -0
- package/components/shortcuts/shortcuts-hoc.d.ts +65 -0
- package/components/shortcuts/shortcuts-hoc.js +61 -0
- package/components/shortcuts/shortcuts.d.ts +28 -0
- package/components/shortcuts/shortcuts.js +92 -0
- package/components/storage/storage.d.ts +18 -0
- package/components/storage/storage.js +92 -0
- package/components/storage/storage__fallback.d.ts +79 -0
- package/components/storage/storage__fallback.js +254 -0
- package/components/storage/storage__local.d.ts +38 -0
- package/components/storage/storage__local.js +217 -0
- package/components/style.css +1 -0
- package/components/tab-trap/tab-trap.d.ts +43 -0
- package/components/tab-trap/tab-trap.js +180 -0
- package/components/table/cell.d.ts +13 -0
- package/components/table/cell.js +37 -0
- package/components/table/disable-hover-hoc.d.ts +64 -0
- package/components/table/disable-hover-hoc.js +62 -0
- package/components/table/header-cell.d.ts +43 -0
- package/components/table/header-cell.js +109 -0
- package/components/table/header.d.ts +56 -0
- package/components/table/header.js +151 -0
- package/components/table/multitable.d.ts +25 -0
- package/components/table/multitable.js +140 -0
- package/components/table/row-with-focus-sensor.d.ts +18 -0
- package/components/table/row-with-focus-sensor.js +117 -0
- package/components/table/row.d.ts +59 -0
- package/components/table/row.js +299 -0
- package/components/table/selection-adapter.d.ts +5 -0
- package/components/table/selection-adapter.js +14 -0
- package/components/table/selection-shortcuts-hoc.d.ts +17 -0
- package/components/table/selection-shortcuts-hoc.js +205 -0
- package/components/table/selection.d.ts +47 -0
- package/components/table/selection.js +257 -0
- package/components/table/smart-table.d.ts +64 -0
- package/components/table/smart-table.js +149 -0
- package/components/table/table.d.ts +159 -0
- package/components/table/table.js +463 -0
- package/components/tabs/collapsible-more.d.ts +29 -0
- package/components/tabs/collapsible-more.js +222 -0
- package/components/tabs/collapsible-tab.d.ts +16 -0
- package/components/tabs/collapsible-tab.js +88 -0
- package/components/tabs/collapsible-tabs.d.ts +43 -0
- package/components/tabs/collapsible-tabs.js +354 -0
- package/components/tabs/custom-item.d.ts +9 -0
- package/components/tabs/custom-item.js +11 -0
- package/components/tabs/dumb-tabs.d.ts +35 -0
- package/components/tabs/dumb-tabs.js +189 -0
- package/components/tabs/smart-tabs.d.ts +20 -0
- package/components/tabs/smart-tabs.js +141 -0
- package/components/tabs/tab-link.d.ts +18 -0
- package/components/tabs/tab-link.js +13 -0
- package/components/tabs/tab.d.ts +27 -0
- package/components/tabs/tab.js +41 -0
- package/components/tabs/tabs.d.ts +7 -0
- package/components/tabs/tabs.js +99 -0
- package/components/tag/tag.d.ts +64 -0
- package/components/tag/tag.js +213 -0
- package/components/tags-input/tags-input.d.ts +138 -0
- package/components/tags-input/tags-input.js +534 -0
- package/components/tags-list/tags-list.d.ts +46 -0
- package/components/tags-list/tags-list.js +102 -0
- package/components/text/text.d.ts +23 -0
- package/components/text/text.js +57 -0
- package/components/toggle/toggle.d.ts +39 -0
- package/components/toggle/toggle.js +86 -0
- package/components/tooltip/tooltip.d.ts +65 -0
- package/components/tooltip/tooltip.js +229 -0
- package/components/user-agreement/service.d.ts +69 -0
- package/components/user-agreement/service.js +487 -0
- package/components/user-agreement/toolbox.eula.d.ts +2 -0
- package/components/user-agreement/toolbox.eula.js +3 -0
- package/components/user-agreement/user-agreement.d.ts +60 -0
- package/components/user-agreement/user-agreement.js +172 -0
- package/components/user-card/card.d.ts +70 -0
- package/components/user-card/card.js +80 -0
- package/components/user-card/smart-user-card-tooltip.d.ts +20 -0
- package/components/user-card/smart-user-card-tooltip.js +172 -0
- package/components/user-card/tooltip.d.ts +36 -0
- package/components/user-card/tooltip.js +144 -0
- package/components/user-card/user-card.d.ts +11 -0
- package/components/user-card/user-card.js +85 -0
- package/package.json +118 -0
- package/typings.d.ts +43 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
/// <reference types="combokeys" />
|
2
|
+
export interface ShortcutsScopeOptions {
|
3
|
+
modal?: boolean | null | undefined;
|
4
|
+
}
|
5
|
+
export interface ShortcutsScope {
|
6
|
+
scopeId: string;
|
7
|
+
options: ShortcutsScopeOptions;
|
8
|
+
}
|
9
|
+
type ShortcutsHandler = (e: KeyboardEvent, key: string, scopeId: string) => boolean | null | void;
|
10
|
+
export interface ShortcutsOptions {
|
11
|
+
scope?: string | null | undefined;
|
12
|
+
type?: string | undefined;
|
13
|
+
}
|
14
|
+
export interface ShortcutsParams extends ShortcutsOptions {
|
15
|
+
key: string | string[];
|
16
|
+
handler: ShortcutsHandler;
|
17
|
+
}
|
18
|
+
export type ShortcutsMap = Record<string, ShortcutsHandler>;
|
19
|
+
declare class Shortcuts {
|
20
|
+
ALLOW_SHORTCUTS_SELECTOR: string;
|
21
|
+
ROOT_SCOPE: {
|
22
|
+
scopeId: string;
|
23
|
+
options: {};
|
24
|
+
};
|
25
|
+
_scopes: Record<string, Record<string, ShortcutsHandler> | null>;
|
26
|
+
private _scopeChain;
|
27
|
+
combokeys: Combokeys.Combokeys;
|
28
|
+
trigger: (combo: string) => void;
|
29
|
+
constructor();
|
30
|
+
private _dispatcher;
|
31
|
+
/**
|
32
|
+
* Binds a handler to a shortcut
|
33
|
+
*
|
34
|
+
* @param params.key {string | Array.<string>) Keys to bind
|
35
|
+
* @param params.handler {Function} Events handle
|
36
|
+
* @param params.scope {string} Scope (optional)
|
37
|
+
* @param params.type {string} Event type, will be passed to Combokeys (optional)
|
38
|
+
*/
|
39
|
+
bind(params: ShortcutsParams): void;
|
40
|
+
/**
|
41
|
+
* Binds a map of shortcuts to handlers with common options
|
42
|
+
*
|
43
|
+
* @map {Object) Keys to handlers map
|
44
|
+
* @options.scope {string} Scope (optional)
|
45
|
+
* @options.type {string} Event type, will be passed to Combokeys (optional)
|
46
|
+
*/
|
47
|
+
bindMap(map: ShortcutsMap, options?: ShortcutsOptions): void;
|
48
|
+
unbindScope(scope: string): void;
|
49
|
+
getScope(): ShortcutsScope[];
|
50
|
+
hasScope(scopeId: string): boolean;
|
51
|
+
/**
|
52
|
+
* Adds a scope to the chain
|
53
|
+
* @param scopeId id of scope to add
|
54
|
+
* @param options options for pushing scope
|
55
|
+
* @param options.modal whether keys should fall through this scope or not.
|
56
|
+
* Useful for modals or overlays
|
57
|
+
*/
|
58
|
+
pushScope(scopeId: string, options?: ShortcutsScopeOptions): void;
|
59
|
+
popScope(scopeId: string): ShortcutsScope[] | undefined;
|
60
|
+
spliceScope(scopeId: string): void;
|
61
|
+
setScope(scope?: ShortcutsScope | string | (ShortcutsScope | string)[] | null | undefined): void;
|
62
|
+
wrapScope(scopeId: string, options?: ShortcutsScopeOptions): {
|
63
|
+
scopeId: string;
|
64
|
+
options: ShortcutsScopeOptions;
|
65
|
+
};
|
66
|
+
hasKey(key: string, scope: string): boolean;
|
67
|
+
private _defaultFilter;
|
68
|
+
private _getKeyboardEventType;
|
69
|
+
setFilter(fn?: (e: Event, element: Element, key?: string) => boolean): void;
|
70
|
+
indexOfScope(scopeId: string): number;
|
71
|
+
reset(): void;
|
72
|
+
}
|
73
|
+
declare const _default: Shortcuts;
|
74
|
+
export default _default;
|
@@ -0,0 +1,249 @@
|
|
1
|
+
import { d as _createClass, c as _classCallCheck, _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.includes.js';
|
3
|
+
import 'core-js/modules/es.string.includes.js';
|
4
|
+
import 'core-js/modules/es.object.assign.js';
|
5
|
+
import 'core-js/modules/es.array.slice.js';
|
6
|
+
import 'core-js/modules/es.array.splice.js';
|
7
|
+
import 'core-js/modules/es.array.map.js';
|
8
|
+
import 'core-js/modules/es.array.concat.js';
|
9
|
+
import 'core-js/modules/es.regexp.exec.js';
|
10
|
+
import 'core-js/modules/es.string.match.js';
|
11
|
+
import 'core-js/modules/es.array.find-index.js';
|
12
|
+
import Combokeys from 'combokeys';
|
13
|
+
import sniffr from '../global/sniffer.js';
|
14
|
+
import 'sniffr';
|
15
|
+
|
16
|
+
var Shortcuts = /*#__PURE__*/function () {
|
17
|
+
function Shortcuts() {
|
18
|
+
var _this = this;
|
19
|
+
_classCallCheck(this, Shortcuts);
|
20
|
+
_defineProperty(this, "ALLOW_SHORTCUTS_SELECTOR", '.ring-js-shortcuts');
|
21
|
+
_defineProperty(this, "ROOT_SCOPE", {
|
22
|
+
scopeId: 'ROOT',
|
23
|
+
options: {}
|
24
|
+
});
|
25
|
+
_defineProperty(this, "_scopes", {});
|
26
|
+
_defineProperty(this, "_scopeChain", []);
|
27
|
+
_defineProperty(this, "combokeys", new Combokeys(document.documentElement));
|
28
|
+
_defineProperty(this, "trigger", function (combo) {
|
29
|
+
return _this.combokeys.trigger(combo);
|
30
|
+
});
|
31
|
+
_defineProperty(this, "_dispatcher", function (e, key) {
|
32
|
+
var currentScope;
|
33
|
+
for (var i = _this._scopeChain.length - 1; i >= 0; i--) {
|
34
|
+
var scopeInChain = _this._scopeChain[i];
|
35
|
+
currentScope = _this._scopes[scopeInChain.scopeId];
|
36
|
+
if (currentScope && key != null && currentScope[key]) {
|
37
|
+
var ret = currentScope[key](e, key, scopeInChain.scopeId);
|
38
|
+
// Fall down in chain when returning true
|
39
|
+
if (ret !== true) {
|
40
|
+
return ret;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
if (scopeInChain.options.modal) {
|
44
|
+
return true;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return undefined;
|
48
|
+
});
|
49
|
+
_defineProperty(this, "_defaultFilter", function (e, element, key) {
|
50
|
+
// if the element or its parents have the class "ring-js-shortcuts" then no need to stop
|
51
|
+
if (element === document || !(element instanceof HTMLElement) || key == null || element.matches(_this.ALLOW_SHORTCUTS_SELECTOR) || (element.dataset.enabledShortcuts != null ? element.dataset.enabledShortcuts.split(',').includes(key) : element.closest(_this.ALLOW_SHORTCUTS_SELECTOR) != null)) {
|
52
|
+
return false;
|
53
|
+
}
|
54
|
+
// stop for input, select, and textarea
|
55
|
+
return element.matches('input:not([type=checkbox]),select,textarea') || element.contentEditable === 'true';
|
56
|
+
});
|
57
|
+
this.setFilter();
|
58
|
+
this.setScope();
|
59
|
+
}
|
60
|
+
_createClass(Shortcuts, [{
|
61
|
+
key: "bind",
|
62
|
+
value:
|
63
|
+
/**
|
64
|
+
* Binds a handler to a shortcut
|
65
|
+
*
|
66
|
+
* @param params.key {string | Array.<string>) Keys to bind
|
67
|
+
* @param params.handler {Function} Events handle
|
68
|
+
* @param params.scope {string} Scope (optional)
|
69
|
+
* @param params.type {string} Event type, will be passed to Combokeys (optional)
|
70
|
+
*/
|
71
|
+
function bind(params) {
|
72
|
+
if (!(params instanceof Object) || typeof params.handler !== 'function') {
|
73
|
+
throw new Error('Shortcut handler should exist');
|
74
|
+
}
|
75
|
+
if (!params.scope) {
|
76
|
+
params.scope = this.ROOT_SCOPE.scopeId;
|
77
|
+
}
|
78
|
+
if (Array.isArray(params.key)) {
|
79
|
+
for (var i = 0; i < params.key.length; i++) {
|
80
|
+
this.bind(Object.assign({}, params, {
|
81
|
+
key: params.key[i]
|
82
|
+
}));
|
83
|
+
}
|
84
|
+
return;
|
85
|
+
}
|
86
|
+
if (typeof params.key !== 'string') {
|
87
|
+
throw new Error('Shortcut key should exist');
|
88
|
+
}
|
89
|
+
var scope = this._scopes[params.scope];
|
90
|
+
if (!scope) {
|
91
|
+
scope = this._scopes[params.scope] = {};
|
92
|
+
}
|
93
|
+
scope[params.key] = params.handler;
|
94
|
+
this.combokeys.bind(params.key, this._dispatcher, this._getKeyboardEventType(params));
|
95
|
+
}
|
96
|
+
/**
|
97
|
+
* Binds a map of shortcuts to handlers with common options
|
98
|
+
*
|
99
|
+
* @map {Object) Keys to handlers map
|
100
|
+
* @options.scope {string} Scope (optional)
|
101
|
+
* @options.type {string} Event type, will be passed to Combokeys (optional)
|
102
|
+
*/
|
103
|
+
}, {
|
104
|
+
key: "bindMap",
|
105
|
+
value: function bindMap(map, options) {
|
106
|
+
if (!(map instanceof Object)) {
|
107
|
+
throw new Error('Shortcuts map shouldn\'t be empty');
|
108
|
+
}
|
109
|
+
for (var key in map) {
|
110
|
+
if (map.hasOwnProperty(key)) {
|
111
|
+
this.bind(Object.assign({}, options || {}, {
|
112
|
+
key,
|
113
|
+
handler: map[key]
|
114
|
+
}));
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}, {
|
119
|
+
key: "unbindScope",
|
120
|
+
value: function unbindScope(scope) {
|
121
|
+
this._scopes[scope] = null;
|
122
|
+
}
|
123
|
+
}, {
|
124
|
+
key: "getScope",
|
125
|
+
value: function getScope() {
|
126
|
+
return this._scopeChain.slice(1);
|
127
|
+
}
|
128
|
+
}, {
|
129
|
+
key: "hasScope",
|
130
|
+
value: function hasScope(scopeId) {
|
131
|
+
return this.indexOfScope(scopeId) !== -1;
|
132
|
+
}
|
133
|
+
/**
|
134
|
+
* Adds a scope to the chain
|
135
|
+
* @param scopeId id of scope to add
|
136
|
+
* @param options options for pushing scope
|
137
|
+
* @param options.modal whether keys should fall through this scope or not.
|
138
|
+
* Useful for modals or overlays
|
139
|
+
*/
|
140
|
+
}, {
|
141
|
+
key: "pushScope",
|
142
|
+
value: function pushScope(scopeId) {
|
143
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
144
|
+
if (scopeId) {
|
145
|
+
var position = this.indexOfScope(scopeId);
|
146
|
+
if (position !== -1) {
|
147
|
+
this._scopeChain.splice(position, 1);
|
148
|
+
}
|
149
|
+
this._scopeChain.push(this.wrapScope(scopeId, options));
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}, {
|
153
|
+
key: "popScope",
|
154
|
+
value: function popScope(scopeId) {
|
155
|
+
if (scopeId) {
|
156
|
+
var position = this.indexOfScope(scopeId);
|
157
|
+
if (position !== -1) {
|
158
|
+
return this._scopeChain.splice(position, this._scopeChain.length - 1);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
return undefined;
|
162
|
+
}
|
163
|
+
}, {
|
164
|
+
key: "spliceScope",
|
165
|
+
value: function spliceScope(scopeId) {
|
166
|
+
if (scopeId) {
|
167
|
+
var position = this.indexOfScope(scopeId);
|
168
|
+
if (position !== -1) {
|
169
|
+
this._scopeChain.splice(position, 1);
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}, {
|
174
|
+
key: "setScope",
|
175
|
+
value: function setScope(scope) {
|
176
|
+
var _this2 = this;
|
177
|
+
if (scope) {
|
178
|
+
var scopeChain;
|
179
|
+
if (typeof scope === 'string' || !Array.isArray(scope) && typeof scope === 'object' && scope !== null) {
|
180
|
+
scopeChain = [scope];
|
181
|
+
} else {
|
182
|
+
scopeChain = scope;
|
183
|
+
}
|
184
|
+
if (!Array.isArray(scopeChain)) {
|
185
|
+
return;
|
186
|
+
}
|
187
|
+
var scopes = scopeChain.map(function (scopeItem) {
|
188
|
+
var isScopeId = typeof scopeItem === 'string';
|
189
|
+
return isScopeId ? _this2.wrapScope(scopeItem) : scopeItem;
|
190
|
+
});
|
191
|
+
this._scopeChain = [this.ROOT_SCOPE].concat(scopes);
|
192
|
+
} else {
|
193
|
+
this._scopeChain = [this.ROOT_SCOPE];
|
194
|
+
}
|
195
|
+
}
|
196
|
+
}, {
|
197
|
+
key: "wrapScope",
|
198
|
+
value: function wrapScope(scopeId) {
|
199
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
200
|
+
return {
|
201
|
+
scopeId,
|
202
|
+
options
|
203
|
+
};
|
204
|
+
}
|
205
|
+
}, {
|
206
|
+
key: "hasKey",
|
207
|
+
value: function hasKey(key, scope) {
|
208
|
+
var _this$_scopes$scope;
|
209
|
+
return !!((_this$_scopes$scope = this._scopes[scope]) !== null && _this$_scopes$scope !== void 0 && _this$_scopes$scope[key]);
|
210
|
+
}
|
211
|
+
}, {
|
212
|
+
key: "_getKeyboardEventType",
|
213
|
+
value: function _getKeyboardEventType(params) {
|
214
|
+
if (!params.type && sniffr.os.name === 'windows') {
|
215
|
+
var isSystemShortcut = typeof params.key === 'string' && params.key.match(/ctrl/i) && params.key.match(/shift/i) && params.key.match(/[0-9]/);
|
216
|
+
/**
|
217
|
+
* Windows system shortcuts (ctrl+shift+[0-9] are caught by the OS on 'keydown', so let's use 'keyup'
|
218
|
+
*/
|
219
|
+
if (isSystemShortcut) {
|
220
|
+
return 'keyup';
|
221
|
+
}
|
222
|
+
}
|
223
|
+
return params.type;
|
224
|
+
}
|
225
|
+
}, {
|
226
|
+
key: "setFilter",
|
227
|
+
value: function setFilter(fn) {
|
228
|
+
this.combokeys.stopCallback = typeof fn === 'function' ? fn : this._defaultFilter;
|
229
|
+
}
|
230
|
+
}, {
|
231
|
+
key: "indexOfScope",
|
232
|
+
value: function indexOfScope(scopeId) {
|
233
|
+
return this._scopeChain.findIndex(function (scope) {
|
234
|
+
return scope.scopeId === scopeId;
|
235
|
+
});
|
236
|
+
}
|
237
|
+
}, {
|
238
|
+
key: "reset",
|
239
|
+
value: function reset() {
|
240
|
+
this._scopes = {};
|
241
|
+
this.setScope();
|
242
|
+
this.combokeys.reset();
|
243
|
+
}
|
244
|
+
}]);
|
245
|
+
return Shortcuts;
|
246
|
+
}();
|
247
|
+
var shortcuts = new Shortcuts();
|
248
|
+
|
249
|
+
export { shortcuts as default };
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function getShortcutTitle(shortcut: string): string;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import 'core-js/modules/es.array.map.js';
|
2
|
+
import 'core-js/modules/es.regexp.exec.js';
|
3
|
+
import 'core-js/modules/es.string.split.js';
|
4
|
+
import sniffr from '../global/sniffer.js';
|
5
|
+
import 'sniffr';
|
6
|
+
|
7
|
+
var macSymbolsMap = {
|
8
|
+
enter: '⏎',
|
9
|
+
shift: '⇧',
|
10
|
+
meta: '⌘',
|
11
|
+
mod: '⌘',
|
12
|
+
alt: '⌥',
|
13
|
+
ctrl: '⌃',
|
14
|
+
backspace: '⌫',
|
15
|
+
esc: 'Esc',
|
16
|
+
tab: 'Tab',
|
17
|
+
del: 'Del',
|
18
|
+
home: 'Home',
|
19
|
+
end: 'End',
|
20
|
+
space: 'Space',
|
21
|
+
ins: 'Insert',
|
22
|
+
left: '←',
|
23
|
+
up: '↑',
|
24
|
+
right: '→',
|
25
|
+
down: '↓'
|
26
|
+
};
|
27
|
+
var winSymbolsMap = {
|
28
|
+
enter: 'Enter',
|
29
|
+
shift: 'Shift',
|
30
|
+
meta: 'Ctrl',
|
31
|
+
mod: 'Ctrl',
|
32
|
+
alt: 'Alt',
|
33
|
+
ctrl: 'Ctrl',
|
34
|
+
backspace: 'Backspace',
|
35
|
+
esc: 'Esc',
|
36
|
+
tab: 'Tab',
|
37
|
+
del: 'Delete',
|
38
|
+
home: 'Home',
|
39
|
+
end: 'End',
|
40
|
+
space: 'Space',
|
41
|
+
ins: 'Insert',
|
42
|
+
left: '←',
|
43
|
+
up: '↑',
|
44
|
+
right: '→',
|
45
|
+
down: '↓'
|
46
|
+
};
|
47
|
+
function getShortcutTitle(shortcut) {
|
48
|
+
var MAC_OS = sniffr.os.name === 'macos';
|
49
|
+
var KEY_SEPARATOR = MAC_OS ? '' : '+';
|
50
|
+
var symbolsMap = MAC_OS ? macSymbolsMap : winSymbolsMap;
|
51
|
+
return shortcut.split(/\+/g).map(function (symbol) {
|
52
|
+
return symbolsMap[symbol] || symbol.toUpperCase();
|
53
|
+
}).join(KEY_SEPARATOR);
|
54
|
+
}
|
55
|
+
|
56
|
+
export { getShortcutTitle };
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React, { ComponentType } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { ShortcutsMap, ShortcutsScopeOptions } from './core';
|
4
|
+
export interface ShortcutsHOCOptions extends ShortcutsScopeOptions {
|
5
|
+
disabled?: boolean | null | undefined;
|
6
|
+
}
|
7
|
+
export interface ShortcutsHOCProps {
|
8
|
+
rgShortcutsOptions: ShortcutsHOCOptions;
|
9
|
+
rgShortcutsMap: ShortcutsMap;
|
10
|
+
}
|
11
|
+
export default function shortcutsHOC<P extends {}>(ComposedComponent: ComponentType<P> | string): {
|
12
|
+
new (props: (P & ShortcutsHOCProps) | Readonly<P & ShortcutsHOCProps>): {
|
13
|
+
_shortcutsScopeUid: string;
|
14
|
+
render(): React.JSX.Element;
|
15
|
+
context: unknown;
|
16
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & ShortcutsHOCProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
17
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
18
|
+
readonly props: Readonly<P & ShortcutsHOCProps>;
|
19
|
+
state: Readonly<{}>;
|
20
|
+
refs: {
|
21
|
+
[key: string]: React.ReactInstance;
|
22
|
+
};
|
23
|
+
componentDidMount?(): void;
|
24
|
+
shouldComponentUpdate?(nextProps: Readonly<P & ShortcutsHOCProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
25
|
+
componentWillUnmount?(): void;
|
26
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
27
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<P & ShortcutsHOCProps>, prevState: Readonly<{}>): any;
|
28
|
+
componentDidUpdate?(prevProps: Readonly<P & ShortcutsHOCProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
29
|
+
componentWillMount?(): void;
|
30
|
+
UNSAFE_componentWillMount?(): void;
|
31
|
+
componentWillReceiveProps?(nextProps: Readonly<P & ShortcutsHOCProps>, nextContext: any): void;
|
32
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P & ShortcutsHOCProps>, nextContext: any): void;
|
33
|
+
componentWillUpdate?(nextProps: Readonly<P & ShortcutsHOCProps>, nextState: Readonly<{}>, nextContext: any): void;
|
34
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<P & ShortcutsHOCProps>, nextState: Readonly<{}>, nextContext: any): void;
|
35
|
+
};
|
36
|
+
new (props: P & ShortcutsHOCProps, context: any): {
|
37
|
+
_shortcutsScopeUid: string;
|
38
|
+
render(): React.JSX.Element;
|
39
|
+
context: unknown;
|
40
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & ShortcutsHOCProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
41
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
42
|
+
readonly props: Readonly<P & ShortcutsHOCProps>;
|
43
|
+
state: Readonly<{}>;
|
44
|
+
refs: {
|
45
|
+
[key: string]: React.ReactInstance;
|
46
|
+
};
|
47
|
+
componentDidMount?(): void;
|
48
|
+
shouldComponentUpdate?(nextProps: Readonly<P & ShortcutsHOCProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
49
|
+
componentWillUnmount?(): void;
|
50
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
51
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<P & ShortcutsHOCProps>, prevState: Readonly<{}>): any;
|
52
|
+
componentDidUpdate?(prevProps: Readonly<P & ShortcutsHOCProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
53
|
+
componentWillMount?(): void;
|
54
|
+
UNSAFE_componentWillMount?(): void;
|
55
|
+
componentWillReceiveProps?(nextProps: Readonly<P & ShortcutsHOCProps>, nextContext: any): void;
|
56
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P & ShortcutsHOCProps>, nextContext: any): void;
|
57
|
+
componentWillUpdate?(nextProps: Readonly<P & ShortcutsHOCProps>, nextState: Readonly<{}>, nextContext: any): void;
|
58
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<P & ShortcutsHOCProps>, nextState: Readonly<{}>, nextContext: any): void;
|
59
|
+
};
|
60
|
+
propTypes: {
|
61
|
+
rgShortcutsOptions: PropTypes.Requireable<object>;
|
62
|
+
rgShortcutsMap: PropTypes.Requireable<object>;
|
63
|
+
};
|
64
|
+
contextType?: React.Context<any> | undefined;
|
65
|
+
};
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { a as _inherits, b as _createSuper, d as _createClass, _ as _defineProperty, c as _classCallCheck, k as _assertThisInitialized, e as _objectWithoutProperties } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
3
|
+
import React from 'react';
|
4
|
+
import PropTypes from 'prop-types';
|
5
|
+
import getUID from '../global/get-uid.js';
|
6
|
+
import Shortcuts from './shortcuts.js';
|
7
|
+
import 'core-js/modules/es.object.to-string.js';
|
8
|
+
import 'core-js/modules/es.regexp.to-string.js';
|
9
|
+
import 'core-js/modules/es.array.map.js';
|
10
|
+
import './core.js';
|
11
|
+
import 'core-js/modules/es.array.includes.js';
|
12
|
+
import 'core-js/modules/es.string.includes.js';
|
13
|
+
import 'core-js/modules/es.object.assign.js';
|
14
|
+
import 'core-js/modules/es.array.slice.js';
|
15
|
+
import 'core-js/modules/es.array.splice.js';
|
16
|
+
import 'core-js/modules/es.regexp.exec.js';
|
17
|
+
import 'core-js/modules/es.string.match.js';
|
18
|
+
import 'core-js/modules/es.array.find-index.js';
|
19
|
+
import 'combokeys';
|
20
|
+
import '../global/sniffer.js';
|
21
|
+
import 'sniffr';
|
22
|
+
|
23
|
+
var _excluded = ["rgShortcutsOptions", "rgShortcutsMap"];
|
24
|
+
function shortcutsHOC(ComposedComponent) {
|
25
|
+
var _class;
|
26
|
+
return _class = /*#__PURE__*/function (_React$Component) {
|
27
|
+
_inherits(WithShortcuts, _React$Component);
|
28
|
+
var _super = _createSuper(WithShortcuts);
|
29
|
+
function WithShortcuts() {
|
30
|
+
var _this;
|
31
|
+
_classCallCheck(this, WithShortcuts);
|
32
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
33
|
+
args[_key] = arguments[_key];
|
34
|
+
}
|
35
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
36
|
+
_defineProperty(_assertThisInitialized(_this), "_shortcutsScopeUid", getUID('rg-shortcuts-'));
|
37
|
+
return _this;
|
38
|
+
}
|
39
|
+
_createClass(WithShortcuts, [{
|
40
|
+
key: "render",
|
41
|
+
value: function render() {
|
42
|
+
var _this$props = this.props,
|
43
|
+
rgShortcutsOptions = _this$props.rgShortcutsOptions,
|
44
|
+
rgShortcutsMap = _this$props.rgShortcutsMap,
|
45
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
46
|
+
return /*#__PURE__*/React.createElement(Shortcuts, {
|
47
|
+
scope: this._shortcutsScopeUid,
|
48
|
+
map: rgShortcutsMap,
|
49
|
+
options: rgShortcutsOptions,
|
50
|
+
disabled: rgShortcutsOptions.disabled
|
51
|
+
}, /*#__PURE__*/React.createElement(ComposedComponent, props));
|
52
|
+
}
|
53
|
+
}]);
|
54
|
+
return WithShortcuts;
|
55
|
+
}(React.Component), _defineProperty(_class, "propTypes", {
|
56
|
+
rgShortcutsOptions: PropTypes.object,
|
57
|
+
rgShortcutsMap: PropTypes.object
|
58
|
+
}), _class;
|
59
|
+
}
|
60
|
+
|
61
|
+
export { shortcutsHOC as default };
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { PureComponent } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { ShortcutsMap, ShortcutsScopeOptions } from './core';
|
4
|
+
export interface ShortcutsProps {
|
5
|
+
map: ShortcutsMap;
|
6
|
+
scope: string;
|
7
|
+
options: ShortcutsScopeOptions;
|
8
|
+
children?: React.ReactNode;
|
9
|
+
disabled?: boolean | null | undefined;
|
10
|
+
}
|
11
|
+
export default class Shortcuts extends PureComponent<ShortcutsProps> {
|
12
|
+
static propTypes: {
|
13
|
+
map: PropTypes.Validator<object>;
|
14
|
+
scope: PropTypes.Validator<string>;
|
15
|
+
options: PropTypes.Requireable<object>;
|
16
|
+
disabled: PropTypes.Requireable<boolean>;
|
17
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
18
|
+
};
|
19
|
+
static defaultProps: {
|
20
|
+
options: {};
|
21
|
+
};
|
22
|
+
componentDidMount(): void;
|
23
|
+
componentDidUpdate(prevProps: ShortcutsProps): void;
|
24
|
+
componentWillUnmount(): void;
|
25
|
+
turnShorcutsOn(): void;
|
26
|
+
turnShorcutsOff(): void;
|
27
|
+
render(): string | number | true | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null;
|
28
|
+
}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import { _ as _defineProperty, a as _inherits, b as _createSuper, c as _classCallCheck, d as _createClass } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.map.js';
|
3
|
+
import { PureComponent } from 'react';
|
4
|
+
import PropTypes from 'prop-types';
|
5
|
+
import shortcuts from './core.js';
|
6
|
+
import 'core-js/modules/es.array.includes.js';
|
7
|
+
import 'core-js/modules/es.string.includes.js';
|
8
|
+
import 'core-js/modules/es.object.assign.js';
|
9
|
+
import 'core-js/modules/es.array.slice.js';
|
10
|
+
import 'core-js/modules/es.array.splice.js';
|
11
|
+
import 'core-js/modules/es.array.concat.js';
|
12
|
+
import 'core-js/modules/es.regexp.exec.js';
|
13
|
+
import 'core-js/modules/es.string.match.js';
|
14
|
+
import 'core-js/modules/es.array.find-index.js';
|
15
|
+
import 'combokeys';
|
16
|
+
import '../global/sniffer.js';
|
17
|
+
import 'sniffr';
|
18
|
+
|
19
|
+
var Shortcuts = /*#__PURE__*/function (_PureComponent) {
|
20
|
+
_inherits(Shortcuts, _PureComponent);
|
21
|
+
var _super = _createSuper(Shortcuts);
|
22
|
+
function Shortcuts() {
|
23
|
+
_classCallCheck(this, Shortcuts);
|
24
|
+
return _super.apply(this, arguments);
|
25
|
+
}
|
26
|
+
_createClass(Shortcuts, [{
|
27
|
+
key: "componentDidMount",
|
28
|
+
value: function componentDidMount() {
|
29
|
+
if (!this.props.disabled) {
|
30
|
+
this.turnShorcutsOn();
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}, {
|
34
|
+
key: "componentDidUpdate",
|
35
|
+
value: function componentDidUpdate(prevProps) {
|
36
|
+
var _this$props = this.props,
|
37
|
+
disabled = _this$props.disabled,
|
38
|
+
map = _this$props.map;
|
39
|
+
if (!prevProps.disabled && disabled) {
|
40
|
+
this.turnShorcutsOff();
|
41
|
+
}
|
42
|
+
if (prevProps.disabled && !disabled) {
|
43
|
+
this.turnShorcutsOn();
|
44
|
+
}
|
45
|
+
if (prevProps.map !== map) {
|
46
|
+
shortcuts.bindMap(map, this.props);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}, {
|
50
|
+
key: "componentWillUnmount",
|
51
|
+
value: function componentWillUnmount() {
|
52
|
+
if (!this.props.disabled) {
|
53
|
+
this.turnShorcutsOff();
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}, {
|
57
|
+
key: "turnShorcutsOn",
|
58
|
+
value: function turnShorcutsOn() {
|
59
|
+
var _this$props2 = this.props,
|
60
|
+
map = _this$props2.map,
|
61
|
+
scope = _this$props2.scope,
|
62
|
+
options = _this$props2.options;
|
63
|
+
shortcuts.bindMap(map, this.props);
|
64
|
+
shortcuts.pushScope(scope, options);
|
65
|
+
}
|
66
|
+
}, {
|
67
|
+
key: "turnShorcutsOff",
|
68
|
+
value: function turnShorcutsOff() {
|
69
|
+
var scope = this.props.scope;
|
70
|
+
shortcuts.unbindScope(scope);
|
71
|
+
shortcuts.spliceScope(scope);
|
72
|
+
}
|
73
|
+
}, {
|
74
|
+
key: "render",
|
75
|
+
value: function render() {
|
76
|
+
return this.props.children || null;
|
77
|
+
}
|
78
|
+
}]);
|
79
|
+
return Shortcuts;
|
80
|
+
}(PureComponent);
|
81
|
+
_defineProperty(Shortcuts, "propTypes", {
|
82
|
+
map: PropTypes.object.isRequired,
|
83
|
+
scope: PropTypes.string.isRequired,
|
84
|
+
options: PropTypes.object,
|
85
|
+
disabled: PropTypes.bool,
|
86
|
+
children: PropTypes.node
|
87
|
+
});
|
88
|
+
_defineProperty(Shortcuts, "defaultProps", {
|
89
|
+
options: {}
|
90
|
+
});
|
91
|
+
|
92
|
+
export { Shortcuts as default };
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export interface StorageConfig {
|
2
|
+
type?: 'local' | 'session' | null | undefined;
|
3
|
+
cookieName?: string | null | undefined;
|
4
|
+
checkDelay?: number | null | undefined;
|
5
|
+
}
|
6
|
+
export interface StorageInterface {
|
7
|
+
get<T>(name: string): Promise<T | null>;
|
8
|
+
set<T>(name: string, value: T | null): Promise<T | null>;
|
9
|
+
remove(name: string): Promise<void>;
|
10
|
+
each<R>(callback: (item: string, value: unknown) => R | Promise<R>): Promise<R[]>;
|
11
|
+
on<T>(name: string, callback: (value: T | null) => void): () => void;
|
12
|
+
}
|
13
|
+
export interface StorageClass {
|
14
|
+
new (config?: StorageConfig | undefined): StorageInterface;
|
15
|
+
QUOTA?: number;
|
16
|
+
}
|
17
|
+
declare const ActualStorage: StorageClass;
|
18
|
+
export default ActualStorage;
|