@gobolt/genesis 0.2.20 → 0.3.0
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/README.md +10 -11
- package/dist/_virtual/index5.cjs +4 -4
- package/dist/_virtual/index5.js +4 -4
- package/dist/_virtual/index6.cjs +4 -4
- package/dist/_virtual/index6.js +4 -4
- package/dist/_virtual/index7.cjs +5 -2
- package/dist/_virtual/index7.js +5 -2
- package/dist/_virtual/index8.cjs +3 -0
- package/dist/_virtual/index8.js +4 -0
- package/dist/_virtual/utilities.cjs +3 -0
- package/dist/_virtual/utilities.js +4 -0
- package/dist/components/Avatar/styles.d.ts +2 -2
- package/dist/components/Badge/Badge.cjs +3 -3
- package/dist/components/Badge/Badge.js +3 -3
- package/dist/components/Badge/__stories__/Badge.stories.d.ts +1 -0
- package/dist/components/Badge/styles.cjs +9 -10
- package/dist/components/Badge/styles.d.ts +5 -6
- package/dist/components/Badge/styles.js +9 -10
- package/dist/components/Breadcrumb/styles.cjs +3 -1
- package/dist/components/Breadcrumb/styles.d.ts +4 -4
- package/dist/components/Breadcrumb/styles.js +3 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/icon-button-styles.d.ts +2 -2
- package/dist/components/Button/styles.d.ts +4 -4
- package/dist/components/Card/styles.d.ts +2 -2
- package/dist/components/Chat/Chat.cjs +247 -0
- package/dist/components/Chat/Chat.d.ts +18 -0
- package/dist/components/Chat/Chat.js +248 -0
- package/dist/components/Chat/Message.cjs +96 -0
- package/dist/components/Chat/Message.d.ts +8 -0
- package/dist/components/Chat/Message.js +97 -0
- package/dist/components/Chat/__stories__/Chat.stories.d.ts +19 -0
- package/dist/components/Chat/index.d.ts +2 -0
- package/dist/components/Checkbox/styles.d.ts +2 -2
- package/dist/components/Dashboard/__stories__/charts/LineChart.d.ts +2 -2
- package/dist/components/Dashboard/styles.d.ts +2 -2
- package/dist/components/DatePicker/DatePicker.cjs +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts +3 -3
- package/dist/components/DatePicker/DatePicker.js +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.cjs +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +2 -2
- package/dist/components/ErrorBoundary/ErrorBoundary.cjs +2 -2
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
- package/dist/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/dist/components/ErrorBoundary/styles.d.ts +2 -2
- package/dist/components/ErrorBoundaryFallback/ErrorBoundaryFallback.cjs +12 -4
- package/dist/components/ErrorBoundaryFallback/ErrorBoundaryFallback.d.ts +1 -1
- package/dist/components/ErrorBoundaryFallback/ErrorBoundaryFallback.js +12 -4
- package/dist/components/Filters/__stories__/Filters.stories.d.ts +0 -2
- package/dist/components/Filters/__stories__/mock.d.ts +5 -0
- package/dist/components/Filters/styles.d.ts +4 -4
- package/dist/components/Form/Form.cjs +2 -2
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Glyph/custom/UnitNumber.cjs +51 -0
- package/dist/components/Glyph/custom/UnitNumber.d.ts +5 -0
- package/dist/components/Glyph/custom/UnitNumber.js +52 -0
- package/dist/components/Glyph/custom/__stories__/UnitNumber.stories.d.ts +7 -0
- package/dist/components/Glyph/index.d.ts +2 -0
- package/dist/components/Glyph/styles.d.ts +2 -2
- package/dist/components/Input/Input.cjs +19 -2
- package/dist/components/Input/Input.d.ts +7 -3
- package/dist/components/Input/Input.js +19 -2
- package/dist/components/Input/styles.cjs +43 -12
- package/dist/components/Input/styles.d.ts +5 -4
- package/dist/components/Input/styles.js +43 -12
- package/dist/components/Layout/Content/ResponsiveContent.d.ts +2 -2
- package/dist/components/Layout/Content/styles.d.ts +2 -2
- package/dist/components/Message/Message.cjs +21 -11
- package/dist/components/Message/Message.js +21 -11
- package/dist/components/Notification/Notification.cjs +11 -6
- package/dist/components/Notification/Notification.js +11 -6
- package/dist/components/Notification/NotificationBadge/NotificationBadge.cjs +19 -10
- package/dist/components/Notification/NotificationBadge/NotificationBadge.js +19 -10
- package/dist/components/Notification/NotificationBadge/icons/ASN.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/ASN.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/ASN.js +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Appointment.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Appointment.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/Appointment.js +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Inventory.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Inventory.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/Inventory.js +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Parcel.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Parcel.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/Parcel.js +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Product.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Product.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/Product.js +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Route.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Route.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/Route.js +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Shipment.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/Shipment.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/Shipment.js +2 -2
- package/dist/components/Notification/NotificationBadge/icons/ShoppingCart.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/ShoppingCart.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/ShoppingCart.js +2 -2
- package/dist/components/Notification/NotificationBadge/icons/System.cjs +2 -2
- package/dist/components/Notification/NotificationBadge/icons/System.d.ts +1 -1
- package/dist/components/Notification/NotificationBadge/icons/System.js +2 -2
- package/dist/components/Notification/NotificationRightChevron.cjs +2 -2
- package/dist/components/Notification/NotificationRightChevron.d.ts +1 -1
- package/dist/components/Notification/NotificationRightChevron.js +2 -2
- package/dist/components/Notification/styles.d.ts +2 -2
- package/dist/components/Popover/styles.d.ts +2 -2
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +1 -1
- package/dist/components/Progress/styles.d.ts +2 -2
- package/dist/components/Radio/Radio.cjs +3 -3
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Radio/Radio.js +3 -3
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/states/RadioChecked.cjs +2 -2
- package/dist/components/Radio/states/RadioChecked.d.ts +1 -1
- package/dist/components/Radio/states/RadioChecked.js +2 -2
- package/dist/components/Radio/states/RadioCheckedDisabled.cjs +2 -2
- package/dist/components/Radio/states/RadioCheckedDisabled.d.ts +1 -1
- package/dist/components/Radio/states/RadioCheckedDisabled.js +2 -2
- package/dist/components/Radio/states/RadioCheckedFocussed.cjs +2 -2
- package/dist/components/Radio/states/RadioCheckedFocussed.d.ts +1 -1
- package/dist/components/Radio/states/RadioCheckedFocussed.js +2 -2
- package/dist/components/Radio/states/RadioCheckedHover.cjs +2 -2
- package/dist/components/Radio/states/RadioCheckedHover.d.ts +1 -1
- package/dist/components/Radio/states/RadioCheckedHover.js +2 -2
- package/dist/components/Radio/states/RadioUnchecked.cjs +2 -2
- package/dist/components/Radio/states/RadioUnchecked.d.ts +1 -1
- package/dist/components/Radio/states/RadioUnchecked.js +2 -2
- package/dist/components/Radio/states/RadioUncheckedDisabled.cjs +2 -2
- package/dist/components/Radio/states/RadioUncheckedDisabled.d.ts +1 -1
- package/dist/components/Radio/states/RadioUncheckedDisabled.js +2 -2
- package/dist/components/Radio/states/RadioUncheckedFocussed.cjs +2 -2
- package/dist/components/Radio/states/RadioUncheckedFocussed.d.ts +1 -1
- package/dist/components/Radio/states/RadioUncheckedFocussed.js +2 -2
- package/dist/components/Radio/states/RadioUncheckedHover.cjs +2 -2
- package/dist/components/Radio/states/RadioUncheckedHover.d.ts +1 -1
- package/dist/components/Radio/states/RadioUncheckedHover.js +2 -2
- package/dist/components/Row/Row.cjs +2 -2
- package/dist/components/Row/Row.d.ts +1 -1
- package/dist/components/Row/Row.js +2 -2
- package/dist/components/Row/RowActions/RowActions.d.ts +2 -2
- package/dist/components/Row/RowLabelValue/RowLabelValue.cjs +1 -1
- package/dist/components/Row/RowLabelValue/RowLabelValue.d.ts +2 -2
- package/dist/components/Row/RowLabelValue/RowLabelValue.js +1 -1
- package/dist/components/Row/RowLabelValue/styles.d.ts +2 -2
- package/dist/components/Row/styles.d.ts +2 -2
- package/dist/components/SegmentedControls/styles.d.ts +2 -2
- package/dist/components/Select/Select.cjs +187 -51
- package/dist/components/Select/Select.d.ts +10 -3
- package/dist/components/Select/Select.js +189 -53
- package/dist/components/Select/SelectTrigger.cjs +131 -0
- package/dist/components/Select/SelectTrigger.d.ts +23 -0
- package/dist/components/Select/SelectTrigger.js +132 -0
- package/dist/components/Select/__stories__/Select.stories.d.ts +4 -3
- package/dist/components/Select/index.d.ts +0 -2
- package/dist/components/Switch/styles.d.ts +2 -2
- package/dist/components/Table/Table.cjs +21 -2
- package/dist/components/Table/Table.d.ts +7 -3
- package/dist/components/Table/Table.js +21 -2
- package/dist/components/Table/TableControls/CustomPagination.cjs +321 -0
- package/dist/components/Table/TableControls/CustomPagination.d.ts +13 -0
- package/dist/components/Table/TableControls/CustomPagination.js +321 -0
- package/dist/components/Table/TableControls/PaginationNumber.cjs +44 -0
- package/dist/components/Table/TableControls/PaginationNumber.d.ts +7 -0
- package/dist/components/Table/TableControls/PaginationNumber.js +45 -0
- package/dist/components/Table/TableControls/PrimaryTableControlsRow.cjs +74 -39
- package/dist/components/Table/TableControls/PrimaryTableControlsRow.d.ts +3 -1
- package/dist/components/Table/TableControls/PrimaryTableControlsRow.js +74 -39
- package/dist/components/Table/TableControls/SecondaryTableControlsRow.cjs +8 -6
- package/dist/components/Table/TableControls/SecondaryTableControlsRow.js +8 -6
- package/dist/components/Table/TableControls/TableControls.cjs +3 -1
- package/dist/components/Table/TableControls/TableControls.js +3 -1
- package/dist/components/Table/TableControls/__stories__/CustomPaginationStandalone.stories.d.ts +9 -0
- package/dist/components/Table/TableControls/__stories__/PaginationNumber.stories.d.ts +7 -0
- package/dist/components/Table/TableControls/styles.d.ts +2 -2
- package/dist/components/Table/TablePagination.cjs +51 -0
- package/dist/components/Table/TablePagination.d.ts +13 -0
- package/dist/components/Table/TablePagination.js +52 -0
- package/dist/components/Table/TableWithControls/TableWithControls.cjs +2 -2
- package/dist/components/Table/TableWithControls/TableWithControls.js +2 -2
- package/dist/components/Table/TableWithControls/useTableWithControls.cjs +19 -19
- package/dist/components/Table/TableWithControls/useTableWithControls.js +20 -20
- package/dist/components/Table/__mocks__/table-mocks.cjs +241 -9
- package/dist/components/Table/__mocks__/table-mocks.d.ts +1 -1
- package/dist/components/Table/__mocks__/table-mocks.js +241 -9
- package/dist/components/Table/__stories__/GenesisTable.stories.d.ts +3 -1
- package/dist/components/Table/__stories__/Table.stories.d.ts +4 -4
- package/dist/components/Table/index.d.ts +2 -1
- package/dist/components/Table/styles.cjs +54 -25
- package/dist/components/Table/styles.d.ts +25 -4
- package/dist/components/Table/styles.js +54 -25
- package/dist/components/Tabs/styles.d.ts +2 -2
- package/dist/components/Tile/styles.d.ts +2 -2
- package/dist/components/Toast/Toast.cjs +20 -10
- package/dist/components/Toast/Toast.js +20 -10
- package/dist/components/Tooltip/Tooltip.cjs +4 -4
- package/dist/components/Tooltip/Tooltip.js +4 -4
- package/dist/components/Tooltip/styles.cjs +18 -2
- package/dist/components/Tooltip/styles.d.ts +2 -2
- package/dist/components/Tooltip/styles.js +18 -2
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.js +1 -1
- package/dist/components/Typography/styles.cjs +4 -2
- package/dist/components/Typography/styles.d.ts +4 -4
- package/dist/components/Typography/styles.js +4 -2
- package/dist/components/index.d.ts +4 -2
- package/dist/components/shared/DropdownChevron.cjs +3 -3
- package/dist/components/shared/DropdownChevron.d.ts +1 -1
- package/dist/components/shared/DropdownChevron.js +3 -3
- package/dist/genesis/GenesisThemeDemo.d.ts +2 -2
- package/dist/genesis/styles.d.ts +3 -3
- package/dist/index.cjs +6 -4
- package/dist/index.js +52 -50
- package/dist/node_modules/@socket.io/component-emitter/lib/esm/index.cjs +72 -0
- package/dist/node_modules/@socket.io/component-emitter/lib/esm/index.js +73 -0
- package/dist/node_modules/@ungap/structured-clone/esm/deserialize.cjs +67 -0
- package/dist/node_modules/@ungap/structured-clone/esm/deserialize.js +68 -0
- package/dist/node_modules/@ungap/structured-clone/esm/index.cjs +11 -0
- package/dist/node_modules/@ungap/structured-clone/esm/index.js +11 -0
- package/dist/node_modules/@ungap/structured-clone/esm/serialize.cjs +134 -0
- package/dist/node_modules/@ungap/structured-clone/esm/serialize.js +135 -0
- package/dist/node_modules/@ungap/structured-clone/esm/types.cjs +21 -0
- package/dist/node_modules/@ungap/structured-clone/esm/types.js +22 -0
- package/dist/node_modules/antd/es/typography/hooks/useCopyClick.cjs +1 -1
- package/dist/node_modules/antd/es/typography/hooks/useCopyClick.js +1 -1
- package/dist/node_modules/bail/index.cjs +7 -0
- package/dist/node_modules/bail/index.js +8 -0
- package/dist/node_modules/comma-separated-tokens/index.cjs +9 -0
- package/dist/node_modules/comma-separated-tokens/index.js +10 -0
- package/dist/node_modules/decode-named-character-reference/index.dom.cjs +16 -0
- package/dist/node_modules/decode-named-character-reference/index.dom.js +17 -0
- package/dist/node_modules/devlop/lib/default.cjs +7 -0
- package/dist/node_modules/devlop/lib/default.js +8 -0
- package/dist/node_modules/engine.io-client/build/esm/contrib/has-cors.cjs +8 -0
- package/dist/node_modules/engine.io-client/build/esm/contrib/has-cors.js +9 -0
- package/dist/node_modules/engine.io-client/build/esm/contrib/parseqs.cjs +23 -0
- package/dist/node_modules/engine.io-client/build/esm/contrib/parseqs.js +24 -0
- package/dist/node_modules/engine.io-client/build/esm/contrib/parseuri.cjs +60 -0
- package/dist/node_modules/engine.io-client/build/esm/contrib/parseuri.js +61 -0
- package/dist/node_modules/engine.io-client/build/esm/globals.cjs +25 -0
- package/dist/node_modules/engine.io-client/build/esm/globals.js +26 -0
- package/dist/node_modules/engine.io-client/build/esm/socket.cjs +575 -0
- package/dist/node_modules/engine.io-client/build/esm/socket.js +576 -0
- package/dist/node_modules/engine.io-client/build/esm/transport.cjs +137 -0
- package/dist/node_modules/engine.io-client/build/esm/transport.js +138 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/index.cjs +10 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/index.js +11 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/polling-xhr.cjs +248 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +249 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/polling.cjs +134 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/polling.js +135 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/websocket.cjs +101 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/websocket.js +102 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/webtransport.cjs +66 -0
- package/dist/node_modules/engine.io-client/build/esm/transports/webtransport.js +67 -0
- package/dist/node_modules/engine.io-client/build/esm/util.cjs +52 -0
- package/dist/node_modules/engine.io-client/build/esm/util.js +53 -0
- package/dist/node_modules/engine.io-parser/build/esm/commons.cjs +17 -0
- package/dist/node_modules/engine.io-parser/build/esm/commons.js +18 -0
- package/dist/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.cjs +27 -0
- package/dist/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js +28 -0
- package/dist/node_modules/engine.io-parser/build/esm/decodePacket.browser.cjs +55 -0
- package/dist/node_modules/engine.io-parser/build/esm/decodePacket.browser.js +56 -0
- package/dist/node_modules/engine.io-parser/build/esm/encodePacket.browser.cjs +56 -0
- package/dist/node_modules/engine.io-parser/build/esm/encodePacket.browser.js +57 -0
- package/dist/node_modules/engine.io-parser/build/esm/index.cjs +151 -0
- package/dist/node_modules/engine.io-parser/build/esm/index.js +152 -0
- package/dist/node_modules/estree-util-is-identifier-name/lib/index.cjs +10 -0
- package/dist/node_modules/estree-util-is-identifier-name/lib/index.js +11 -0
- package/dist/node_modules/extend/index.cjs +93 -0
- package/dist/node_modules/extend/index.js +94 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +389 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +390 -0
- package/dist/node_modules/hast-util-whitespace/lib/index.cjs +9 -0
- package/dist/node_modules/hast-util-whitespace/lib/index.js +10 -0
- package/dist/node_modules/html-url-attributes/lib/index.cjs +25 -0
- package/dist/node_modules/html-url-attributes/lib/index.js +26 -0
- package/dist/node_modules/inline-style-parser/index.cjs +140 -0
- package/dist/node_modules/inline-style-parser/index.js +141 -0
- package/dist/node_modules/is-plain-obj/index.cjs +9 -0
- package/dist/node_modules/is-plain-obj/index.js +10 -0
- package/dist/node_modules/mdast-util-from-markdown/lib/index.cjs +718 -0
- package/dist/node_modules/mdast-util-from-markdown/lib/index.js +719 -0
- package/dist/node_modules/mdast-util-to-hast/lib/footer.cjs +114 -0
- package/dist/node_modules/mdast-util-to-hast/lib/footer.js +115 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/blockquote.cjs +12 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/blockquote.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/break.cjs +7 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/break.js +8 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/code.cjs +23 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/code.js +24 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/delete.cjs +12 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/delete.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/emphasis.cjs +12 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/emphasis.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.cjs +40 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js +41 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/heading.cjs +12 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/heading.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/html.cjs +10 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/html.js +11 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/image-reference.cjs +18 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/image-reference.js +19 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/image.cjs +15 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/image.js +16 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/index.cjs +58 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/index.js +59 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/inline-code.cjs +14 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/inline-code.js +15 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/link-reference.cjs +23 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/link-reference.js +24 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/link.cjs +17 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/link.js +18 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/list-item.cjs +63 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/list-item.js +64 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/list.cjs +25 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/list.js +26 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/paragraph.cjs +12 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/paragraph.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/root.cjs +7 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/root.js +8 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/strong.cjs +12 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/strong.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table-cell.cjs +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table-cell.js +14 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table-row.cjs +34 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table-row.js +35 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table.cjs +38 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/table.js +39 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/text.cjs +8 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/text.js +9 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.cjs +12 -0
- package/dist/node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js +13 -0
- package/dist/node_modules/mdast-util-to-hast/lib/index.cjs +14 -0
- package/dist/node_modules/mdast-util-to-hast/lib/index.js +15 -0
- package/dist/node_modules/mdast-util-to-hast/lib/revert.cjs +28 -0
- package/dist/node_modules/mdast-util-to-hast/lib/revert.js +29 -0
- package/dist/node_modules/mdast-util-to-hast/lib/state.cjs +147 -0
- package/dist/node_modules/mdast-util-to-hast/lib/state.js +148 -0
- package/dist/node_modules/mdast-util-to-string/lib/index.cjs +37 -0
- package/dist/node_modules/mdast-util-to-string/lib/index.js +38 -0
- package/dist/node_modules/micromark/lib/constructs.cjs +92 -0
- package/dist/node_modules/micromark/lib/constructs.js +93 -0
- package/dist/node_modules/micromark/lib/create-tokenizer.cjs +319 -0
- package/dist/node_modules/micromark/lib/create-tokenizer.js +320 -0
- package/dist/node_modules/micromark/lib/initialize/content.cjs +52 -0
- package/dist/node_modules/micromark/lib/initialize/content.js +53 -0
- package/dist/node_modules/micromark/lib/initialize/document.cjs +185 -0
- package/dist/node_modules/micromark/lib/initialize/document.js +186 -0
- package/dist/node_modules/micromark/lib/initialize/flow.cjs +41 -0
- package/dist/node_modules/micromark/lib/initialize/flow.js +42 -0
- package/dist/node_modules/micromark/lib/initialize/text.cjs +141 -0
- package/dist/node_modules/micromark/lib/initialize/text.js +142 -0
- package/dist/node_modules/micromark/lib/parse.cjs +33 -0
- package/dist/node_modules/micromark/lib/parse.js +34 -0
- package/dist/node_modules/micromark/lib/postprocess.cjs +8 -0
- package/dist/node_modules/micromark/lib/postprocess.js +9 -0
- package/dist/node_modules/micromark/lib/preprocess.cjs +79 -0
- package/dist/node_modules/micromark/lib/preprocess.js +80 -0
- package/dist/node_modules/micromark-core-commonmark/lib/attention.cjs +134 -0
- package/dist/node_modules/micromark-core-commonmark/lib/attention.js +135 -0
- package/dist/node_modules/micromark-core-commonmark/lib/autolink.cjs +102 -0
- package/dist/node_modules/micromark-core-commonmark/lib/autolink.js +103 -0
- package/dist/node_modules/micromark-core-commonmark/lib/blank-line.cjs +17 -0
- package/dist/node_modules/micromark-core-commonmark/lib/blank-line.js +18 -0
- package/dist/node_modules/micromark-core-commonmark/lib/block-quote.cjs +60 -0
- package/dist/node_modules/micromark-core-commonmark/lib/block-quote.js +61 -0
- package/dist/node_modules/micromark-core-commonmark/lib/character-escape.cjs +27 -0
- package/dist/node_modules/micromark-core-commonmark/lib/character-escape.js +28 -0
- package/dist/node_modules/micromark-core-commonmark/lib/character-reference.cjs +67 -0
- package/dist/node_modules/micromark-core-commonmark/lib/character-reference.js +68 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.cjs +185 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-fenced.js +186 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-indented.cjs +66 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-indented.js +67 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-text.cjs +115 -0
- package/dist/node_modules/micromark-core-commonmark/lib/code-text.js +116 -0
- package/dist/node_modules/micromark-core-commonmark/lib/content.cjs +74 -0
- package/dist/node_modules/micromark-core-commonmark/lib/content.js +75 -0
- package/dist/node_modules/micromark-core-commonmark/lib/definition.cjs +93 -0
- package/dist/node_modules/micromark-core-commonmark/lib/definition.js +94 -0
- package/dist/node_modules/micromark-core-commonmark/lib/hard-break-escape.cjs +22 -0
- package/dist/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +23 -0
- package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.cjs +94 -0
- package/dist/node_modules/micromark-core-commonmark/lib/heading-atx.js +95 -0
- package/dist/node_modules/micromark-core-commonmark/lib/html-flow.cjs +382 -0
- package/dist/node_modules/micromark-core-commonmark/lib/html-flow.js +383 -0
- package/dist/node_modules/micromark-core-commonmark/lib/html-text.cjs +308 -0
- package/dist/node_modules/micromark-core-commonmark/lib/html-text.js +309 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-end.cjs +234 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-end.js +235 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.cjs +32 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-image.js +33 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.cjs +23 -0
- package/dist/node_modules/micromark-core-commonmark/lib/label-start-link.js +24 -0
- package/dist/node_modules/micromark-core-commonmark/lib/line-ending.cjs +16 -0
- package/dist/node_modules/micromark-core-commonmark/lib/line-ending.js +17 -0
- package/dist/node_modules/micromark-core-commonmark/lib/list.cjs +134 -0
- package/dist/node_modules/micromark-core-commonmark/lib/list.js +135 -0
- package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.cjs +94 -0
- package/dist/node_modules/micromark-core-commonmark/lib/setext-underline.js +95 -0
- package/dist/node_modules/micromark-core-commonmark/lib/thematic-break.cjs +41 -0
- package/dist/node_modules/micromark-core-commonmark/lib/thematic-break.js +42 -0
- package/dist/node_modules/micromark-factory-destination/index.cjs +93 -0
- package/dist/node_modules/micromark-factory-destination/index.js +94 -0
- package/dist/node_modules/micromark-factory-label/index.cjs +62 -0
- package/dist/node_modules/micromark-factory-label/index.js +63 -0
- package/dist/node_modules/micromark-factory-space/index.cjs +23 -0
- package/dist/node_modules/micromark-factory-space/index.js +24 -0
- package/dist/node_modules/micromark-factory-title/index.cjs +64 -0
- package/dist/node_modules/micromark-factory-title/index.js +65 -0
- package/dist/node_modules/micromark-factory-whitespace/index.cjs +21 -0
- package/dist/node_modules/micromark-factory-whitespace/index.js +22 -0
- package/dist/node_modules/micromark-util-character/index.cjs +43 -0
- package/dist/node_modules/micromark-util-character/index.js +44 -0
- package/dist/node_modules/micromark-util-chunked/index.cjs +35 -0
- package/dist/node_modules/micromark-util-chunked/index.js +36 -0
- package/dist/node_modules/micromark-util-classify-character/index.cjs +11 -0
- package/dist/node_modules/micromark-util-classify-character/index.js +12 -0
- package/dist/node_modules/micromark-util-combine-extensions/index.cjs +40 -0
- package/dist/node_modules/micromark-util-combine-extensions/index.js +41 -0
- package/dist/node_modules/micromark-util-decode-numeric-character-reference/index.cjs +18 -0
- package/dist/node_modules/micromark-util-decode-numeric-character-reference/index.js +19 -0
- package/dist/node_modules/micromark-util-decode-string/index.cjs +20 -0
- package/dist/node_modules/micromark-util-decode-string/index.js +21 -0
- package/dist/node_modules/micromark-util-html-tag-name/index.cjs +68 -0
- package/dist/node_modules/micromark-util-html-tag-name/index.js +69 -0
- package/dist/node_modules/micromark-util-normalize-identifier/index.cjs +5 -0
- package/dist/node_modules/micromark-util-normalize-identifier/index.js +6 -0
- package/dist/node_modules/micromark-util-resolve-all/index.cjs +14 -0
- package/dist/node_modules/micromark-util-resolve-all/index.js +15 -0
- package/dist/node_modules/micromark-util-sanitize-uri/index.cjs +40 -0
- package/dist/node_modules/micromark-util-sanitize-uri/index.js +41 -0
- package/dist/node_modules/micromark-util-subtokenize/index.cjs +156 -0
- package/dist/node_modules/micromark-util-subtokenize/index.js +157 -0
- package/dist/node_modules/micromark-util-subtokenize/lib/splice-buffer.cjs +193 -0
- package/dist/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +194 -0
- package/dist/node_modules/property-information/index.cjs +12 -0
- package/dist/node_modules/property-information/index.js +13 -0
- package/dist/node_modules/property-information/lib/aria.cjs +60 -0
- package/dist/node_modules/property-information/lib/aria.js +61 -0
- package/dist/node_modules/property-information/lib/find.cjs +39 -0
- package/dist/node_modules/property-information/lib/find.js +40 -0
- package/dist/node_modules/property-information/lib/hast-to-react.cjs +21 -0
- package/dist/node_modules/property-information/lib/hast-to-react.js +22 -0
- package/dist/node_modules/property-information/lib/html.cjs +367 -0
- package/dist/node_modules/property-information/lib/html.js +368 -0
- package/dist/node_modules/property-information/lib/normalize.cjs +5 -0
- package/dist/node_modules/property-information/lib/normalize.js +6 -0
- package/dist/node_modules/property-information/lib/svg.cjs +565 -0
- package/dist/node_modules/property-information/lib/svg.js +566 -0
- package/dist/node_modules/property-information/lib/util/case-insensitive-transform.cjs +6 -0
- package/dist/node_modules/property-information/lib/util/case-insensitive-transform.js +7 -0
- package/dist/node_modules/property-information/lib/util/case-sensitive-transform.cjs +5 -0
- package/dist/node_modules/property-information/lib/util/case-sensitive-transform.js +6 -0
- package/dist/node_modules/property-information/lib/util/create.cjs +24 -0
- package/dist/node_modules/property-information/lib/util/create.js +25 -0
- package/dist/node_modules/property-information/lib/util/defined-info.cjs +40 -0
- package/dist/node_modules/property-information/lib/util/defined-info.js +41 -0
- package/dist/node_modules/property-information/lib/util/info.cjs +28 -0
- package/dist/node_modules/property-information/lib/util/info.js +29 -0
- package/dist/node_modules/property-information/lib/util/merge.cjs +12 -0
- package/dist/node_modules/property-information/lib/util/merge.js +13 -0
- package/dist/node_modules/property-information/lib/util/schema.cjs +24 -0
- package/dist/node_modules/property-information/lib/util/schema.js +25 -0
- package/dist/node_modules/property-information/lib/util/types.cjs +19 -0
- package/dist/node_modules/property-information/lib/util/types.js +20 -0
- package/dist/node_modules/property-information/lib/xlink.cjs +18 -0
- package/dist/node_modules/property-information/lib/xlink.js +19 -0
- package/dist/node_modules/property-information/lib/xml.cjs +10 -0
- package/dist/node_modules/property-information/lib/xml.js +11 -0
- package/dist/node_modules/property-information/lib/xmlns.cjs +10 -0
- package/dist/node_modules/property-information/lib/xmlns.js +11 -0
- package/dist/node_modules/react-icons/hi/index.cjs +32 -0
- package/dist/node_modules/react-icons/hi/index.js +33 -1
- package/dist/node_modules/react-icons/pi/index.cjs +4 -0
- package/dist/node_modules/react-icons/pi/index.js +5 -1
- package/dist/node_modules/react-markdown/lib/index.cjs +148 -0
- package/dist/node_modules/react-markdown/lib/index.js +149 -0
- package/dist/node_modules/remark-parse/lib/index.cjs +18 -0
- package/dist/node_modules/remark-parse/lib/index.js +19 -0
- package/dist/node_modules/remark-rehype/lib/index.cjs +20 -0
- package/dist/node_modules/remark-rehype/lib/index.js +21 -0
- package/dist/node_modules/socket.io-client/build/esm/contrib/backo2.cjs +31 -0
- package/dist/node_modules/socket.io-client/build/esm/contrib/backo2.js +32 -0
- package/dist/node_modules/socket.io-client/build/esm/index.cjs +58 -0
- package/dist/node_modules/socket.io-client/build/esm/index.js +58 -0
- package/dist/node_modules/socket.io-client/build/esm/manager.cjs +363 -0
- package/dist/node_modules/socket.io-client/build/esm/manager.js +364 -0
- package/dist/node_modules/socket.io-client/build/esm/on.cjs +8 -0
- package/dist/node_modules/socket.io-client/build/esm/on.js +9 -0
- package/dist/node_modules/socket.io-client/build/esm/socket.cjs +777 -0
- package/dist/node_modules/socket.io-client/build/esm/socket.js +778 -0
- package/dist/node_modules/socket.io-client/build/esm/url.cjs +48 -0
- package/dist/node_modules/socket.io-client/build/esm/url.js +49 -0
- package/dist/node_modules/socket.io-parser/build/esm/binary.cjs +64 -0
- package/dist/node_modules/socket.io-parser/build/esm/binary.js +65 -0
- package/dist/node_modules/socket.io-parser/build/esm/index.cjs +261 -0
- package/dist/node_modules/socket.io-parser/build/esm/index.js +263 -0
- package/dist/node_modules/socket.io-parser/build/esm/is-binary.cjs +38 -0
- package/dist/node_modules/socket.io-parser/build/esm/is-binary.js +39 -0
- package/dist/node_modules/space-separated-tokens/index.cjs +5 -0
- package/dist/node_modules/space-separated-tokens/index.js +6 -0
- package/dist/node_modules/style-to-js/cjs/index.cjs +30 -0
- package/dist/node_modules/style-to-js/cjs/index.js +31 -0
- package/dist/node_modules/style-to-js/cjs/utilities.cjs +41 -0
- package/dist/node_modules/style-to-js/cjs/utilities.js +42 -0
- package/dist/node_modules/style-to-object/cjs/index.cjs +37 -0
- package/dist/node_modules/style-to-object/cjs/index.js +38 -0
- package/dist/node_modules/trim-lines/index.cjs +40 -0
- package/dist/node_modules/trim-lines/index.js +41 -0
- package/dist/node_modules/trough/lib/index.cjs +85 -0
- package/dist/node_modules/trough/lib/index.js +86 -0
- package/dist/node_modules/unified/lib/callable-instance.cjs +29 -0
- package/dist/node_modules/unified/lib/callable-instance.js +30 -0
- package/dist/node_modules/unified/lib/index.cjs +635 -0
- package/dist/node_modules/unified/lib/index.js +636 -0
- package/dist/node_modules/unist-util-is/lib/index.cjs +92 -0
- package/dist/node_modules/unist-util-is/lib/index.js +93 -0
- package/dist/node_modules/unist-util-position/lib/index.cjs +26 -0
- package/dist/node_modules/unist-util-position/lib/index.js +27 -0
- package/dist/node_modules/unist-util-stringify-position/lib/index.cjs +26 -0
- package/dist/node_modules/unist-util-stringify-position/lib/index.js +27 -0
- package/dist/node_modules/unist-util-visit/lib/index.cjs +26 -0
- package/dist/node_modules/unist-util-visit/lib/index.js +28 -0
- package/dist/node_modules/unist-util-visit-parents/lib/color.cjs +5 -0
- package/dist/node_modules/unist-util-visit-parents/lib/color.js +6 -0
- package/dist/node_modules/unist-util-visit-parents/lib/index.cjs +82 -0
- package/dist/node_modules/unist-util-visit-parents/lib/index.js +83 -0
- package/dist/node_modules/vfile/lib/index.cjs +461 -0
- package/dist/node_modules/vfile/lib/index.js +462 -0
- package/dist/node_modules/vfile/lib/minpath.browser.cjs +213 -0
- package/dist/node_modules/vfile/lib/minpath.browser.js +214 -0
- package/dist/node_modules/vfile/lib/minproc.browser.cjs +6 -0
- package/dist/node_modules/vfile/lib/minproc.browser.js +7 -0
- package/dist/node_modules/vfile/lib/minurl.browser.cjs +45 -0
- package/dist/node_modules/vfile/lib/minurl.browser.js +46 -0
- package/dist/node_modules/vfile/lib/minurl.shared.cjs +8 -0
- package/dist/node_modules/vfile/lib/minurl.shared.js +9 -0
- package/dist/node_modules/vfile-message/lib/index.cjs +137 -0
- package/dist/node_modules/vfile-message/lib/index.js +138 -0
- package/dist/providers/BreakpointProvider.cjs +4 -2
- package/dist/providers/BreakpointProvider.d.ts +2 -2
- package/dist/providers/BreakpointProvider.js +4 -2
- package/dist/providers/GenesisProvider.cjs +1 -1
- package/dist/providers/GenesisProvider.d.ts +2 -2
- package/dist/providers/GenesisProvider.js +1 -1
- package/dist/providers/ToastProvider.cjs +3 -3
- package/dist/providers/ToastProvider.js +3 -3
- package/dist/providers/useGenesis.cjs +1 -1
- package/dist/providers/useGenesis.js +1 -1
- package/dist/styles/global-styles.cjs +1 -1
- package/dist/styles/global-styles.js +1 -1
- package/dist/styles/theme/genesis-theme.cjs +19 -8
- package/dist/styles/theme/genesis-theme.js +20 -9
- package/dist/styles/theme/genesis-theme.types.d.ts +7 -1
- package/dist/utils/icon-util.cjs +57 -48
- package/dist/utils/icon-util.js +58 -49
- package/dist/utils/styled.d.ts +1 -6
- package/dist/utils/user-util.cjs +2 -2
- package/dist/utils/user-util.js +2 -2
- package/package.json +11 -2
- package/dist/components/Select/MultiSelectCount.cjs +0 -48
- package/dist/components/Select/MultiSelectCount.d.ts +0 -13
- package/dist/components/Select/MultiSelectCount.js +0 -49
- package/dist/components/Select/__stories__/MultiSelectCount.stories.d.ts +0 -8
- package/dist/components/Select/styles.cjs +0 -238
- package/dist/components/Select/styles.d.ts +0 -41
- package/dist/components/Select/styles.js +0 -239
- package/dist/node_modules/@ant-design/icons/es/icons/ClockCircleFilled.cjs +0 -35
- package/dist/node_modules/@ant-design/icons/es/icons/ClockCircleFilled.js +0 -17
- package/dist/node_modules/@ant-design/icons/es/icons/MinusCircleFilled.cjs +0 -35
- package/dist/node_modules/@ant-design/icons/es/icons/MinusCircleFilled.js +0 -17
- package/dist/node_modules/@ant-design/icons-svg/es/asn/ClockCircleFilled.cjs +0 -3
- package/dist/node_modules/@ant-design/icons-svg/es/asn/ClockCircleFilled.js +0 -4
- package/dist/node_modules/@ant-design/icons-svg/es/asn/MinusCircleFilled.cjs +0 -3
- package/dist/node_modules/@ant-design/icons-svg/es/asn/MinusCircleFilled.js +0 -4
- package/dist/node_modules/debounce/index.cjs +0 -83
- package/dist/node_modules/debounce/index.js +0 -84
- package/dist/utils/styled.cjs +0 -10
- package/dist/utils/styled.js +0 -11
- /package/dist/components/{Select/__tests__/Select.test.d.ts → Table/TableControls/__tests__/CustomPagination.test.d.ts} +0 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
import { PacketType } from "../../../socket.io-parser/build/esm/index.js";
|
|
2
|
+
import { on } from "./on.js";
|
|
3
|
+
import { Emitter } from "../../../@socket.io/component-emitter/lib/esm/index.js";
|
|
4
|
+
const RESERVED_EVENTS = Object.freeze({
|
|
5
|
+
connect: 1,
|
|
6
|
+
connect_error: 1,
|
|
7
|
+
disconnect: 1,
|
|
8
|
+
disconnecting: 1,
|
|
9
|
+
// EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener
|
|
10
|
+
newListener: 1,
|
|
11
|
+
removeListener: 1
|
|
12
|
+
});
|
|
13
|
+
class Socket extends Emitter {
|
|
14
|
+
/**
|
|
15
|
+
* `Socket` constructor.
|
|
16
|
+
*/
|
|
17
|
+
constructor(io, nsp, opts) {
|
|
18
|
+
super();
|
|
19
|
+
this.connected = false;
|
|
20
|
+
this.recovered = false;
|
|
21
|
+
this.receiveBuffer = [];
|
|
22
|
+
this.sendBuffer = [];
|
|
23
|
+
this._queue = [];
|
|
24
|
+
this._queueSeq = 0;
|
|
25
|
+
this.ids = 0;
|
|
26
|
+
this.acks = {};
|
|
27
|
+
this.flags = {};
|
|
28
|
+
this.io = io;
|
|
29
|
+
this.nsp = nsp;
|
|
30
|
+
if (opts && opts.auth) {
|
|
31
|
+
this.auth = opts.auth;
|
|
32
|
+
}
|
|
33
|
+
this._opts = Object.assign({}, opts);
|
|
34
|
+
if (this.io._autoConnect)
|
|
35
|
+
this.open();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Whether the socket is currently disconnected
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const socket = io();
|
|
42
|
+
*
|
|
43
|
+
* socket.on("connect", () => {
|
|
44
|
+
* console.log(socket.disconnected); // false
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* socket.on("disconnect", () => {
|
|
48
|
+
* console.log(socket.disconnected); // true
|
|
49
|
+
* });
|
|
50
|
+
*/
|
|
51
|
+
get disconnected() {
|
|
52
|
+
return !this.connected;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Subscribe to open, close and packet events
|
|
56
|
+
*
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
subEvents() {
|
|
60
|
+
if (this.subs)
|
|
61
|
+
return;
|
|
62
|
+
const io = this.io;
|
|
63
|
+
this.subs = [
|
|
64
|
+
on(io, "open", this.onopen.bind(this)),
|
|
65
|
+
on(io, "packet", this.onpacket.bind(this)),
|
|
66
|
+
on(io, "error", this.onerror.bind(this)),
|
|
67
|
+
on(io, "close", this.onclose.bind(this))
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Whether the Socket will try to reconnect when its Manager connects or reconnects.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* const socket = io();
|
|
75
|
+
*
|
|
76
|
+
* console.log(socket.active); // true
|
|
77
|
+
*
|
|
78
|
+
* socket.on("disconnect", (reason) => {
|
|
79
|
+
* if (reason === "io server disconnect") {
|
|
80
|
+
* // the disconnection was initiated by the server, you need to manually reconnect
|
|
81
|
+
* console.log(socket.active); // false
|
|
82
|
+
* }
|
|
83
|
+
* // else the socket will automatically try to reconnect
|
|
84
|
+
* console.log(socket.active); // true
|
|
85
|
+
* });
|
|
86
|
+
*/
|
|
87
|
+
get active() {
|
|
88
|
+
return !!this.subs;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* "Opens" the socket.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* const socket = io({
|
|
95
|
+
* autoConnect: false
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* socket.connect();
|
|
99
|
+
*/
|
|
100
|
+
connect() {
|
|
101
|
+
if (this.connected)
|
|
102
|
+
return this;
|
|
103
|
+
this.subEvents();
|
|
104
|
+
if (!this.io["_reconnecting"])
|
|
105
|
+
this.io.open();
|
|
106
|
+
if ("open" === this.io._readyState)
|
|
107
|
+
this.onopen();
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Alias for {@link connect()}.
|
|
112
|
+
*/
|
|
113
|
+
open() {
|
|
114
|
+
return this.connect();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Sends a `message` event.
|
|
118
|
+
*
|
|
119
|
+
* This method mimics the WebSocket.send() method.
|
|
120
|
+
*
|
|
121
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* socket.send("hello");
|
|
125
|
+
*
|
|
126
|
+
* // this is equivalent to
|
|
127
|
+
* socket.emit("message", "hello");
|
|
128
|
+
*
|
|
129
|
+
* @return self
|
|
130
|
+
*/
|
|
131
|
+
send(...args) {
|
|
132
|
+
args.unshift("message");
|
|
133
|
+
this.emit.apply(this, args);
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Override `emit`.
|
|
138
|
+
* If the event is in `events`, it's emitted normally.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* socket.emit("hello", "world");
|
|
142
|
+
*
|
|
143
|
+
* // all serializable datastructures are supported (no need to call JSON.stringify)
|
|
144
|
+
* socket.emit("hello", 1, "2", { 3: ["4"], 5: Uint8Array.from([6]) });
|
|
145
|
+
*
|
|
146
|
+
* // with an acknowledgement from the server
|
|
147
|
+
* socket.emit("hello", "world", (val) => {
|
|
148
|
+
* // ...
|
|
149
|
+
* });
|
|
150
|
+
*
|
|
151
|
+
* @return self
|
|
152
|
+
*/
|
|
153
|
+
emit(ev, ...args) {
|
|
154
|
+
var _a, _b, _c;
|
|
155
|
+
if (RESERVED_EVENTS.hasOwnProperty(ev)) {
|
|
156
|
+
throw new Error('"' + ev.toString() + '" is a reserved event name');
|
|
157
|
+
}
|
|
158
|
+
args.unshift(ev);
|
|
159
|
+
if (this._opts.retries && !this.flags.fromQueue && !this.flags.volatile) {
|
|
160
|
+
this._addToQueue(args);
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
const packet = {
|
|
164
|
+
type: PacketType.EVENT,
|
|
165
|
+
data: args
|
|
166
|
+
};
|
|
167
|
+
packet.options = {};
|
|
168
|
+
packet.options.compress = this.flags.compress !== false;
|
|
169
|
+
if ("function" === typeof args[args.length - 1]) {
|
|
170
|
+
const id = this.ids++;
|
|
171
|
+
const ack = args.pop();
|
|
172
|
+
this._registerAckCallback(id, ack);
|
|
173
|
+
packet.id = id;
|
|
174
|
+
}
|
|
175
|
+
const isTransportWritable = (_b = (_a = this.io.engine) === null || _a === void 0 ? void 0 : _a.transport) === null || _b === void 0 ? void 0 : _b.writable;
|
|
176
|
+
const isConnected = this.connected && !((_c = this.io.engine) === null || _c === void 0 ? void 0 : _c._hasPingExpired());
|
|
177
|
+
const discardPacket = this.flags.volatile && !isTransportWritable;
|
|
178
|
+
if (discardPacket) ;
|
|
179
|
+
else if (isConnected) {
|
|
180
|
+
this.notifyOutgoingListeners(packet);
|
|
181
|
+
this.packet(packet);
|
|
182
|
+
} else {
|
|
183
|
+
this.sendBuffer.push(packet);
|
|
184
|
+
}
|
|
185
|
+
this.flags = {};
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* @private
|
|
190
|
+
*/
|
|
191
|
+
_registerAckCallback(id, ack) {
|
|
192
|
+
var _a;
|
|
193
|
+
const timeout = (_a = this.flags.timeout) !== null && _a !== void 0 ? _a : this._opts.ackTimeout;
|
|
194
|
+
if (timeout === void 0) {
|
|
195
|
+
this.acks[id] = ack;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const timer = this.io.setTimeoutFn(() => {
|
|
199
|
+
delete this.acks[id];
|
|
200
|
+
for (let i = 0; i < this.sendBuffer.length; i++) {
|
|
201
|
+
if (this.sendBuffer[i].id === id) {
|
|
202
|
+
this.sendBuffer.splice(i, 1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
ack.call(this, new Error("operation has timed out"));
|
|
206
|
+
}, timeout);
|
|
207
|
+
const fn = (...args) => {
|
|
208
|
+
this.io.clearTimeoutFn(timer);
|
|
209
|
+
ack.apply(this, args);
|
|
210
|
+
};
|
|
211
|
+
fn.withError = true;
|
|
212
|
+
this.acks[id] = fn;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Emits an event and waits for an acknowledgement
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* // without timeout
|
|
219
|
+
* const response = await socket.emitWithAck("hello", "world");
|
|
220
|
+
*
|
|
221
|
+
* // with a specific timeout
|
|
222
|
+
* try {
|
|
223
|
+
* const response = await socket.timeout(1000).emitWithAck("hello", "world");
|
|
224
|
+
* } catch (err) {
|
|
225
|
+
* // the server did not acknowledge the event in the given delay
|
|
226
|
+
* }
|
|
227
|
+
*
|
|
228
|
+
* @return a Promise that will be fulfilled when the server acknowledges the event
|
|
229
|
+
*/
|
|
230
|
+
emitWithAck(ev, ...args) {
|
|
231
|
+
return new Promise((resolve, reject) => {
|
|
232
|
+
const fn = (arg1, arg2) => {
|
|
233
|
+
return arg1 ? reject(arg1) : resolve(arg2);
|
|
234
|
+
};
|
|
235
|
+
fn.withError = true;
|
|
236
|
+
args.push(fn);
|
|
237
|
+
this.emit(ev, ...args);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Add the packet to the queue.
|
|
242
|
+
* @param args
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
_addToQueue(args) {
|
|
246
|
+
let ack;
|
|
247
|
+
if (typeof args[args.length - 1] === "function") {
|
|
248
|
+
ack = args.pop();
|
|
249
|
+
}
|
|
250
|
+
const packet = {
|
|
251
|
+
id: this._queueSeq++,
|
|
252
|
+
tryCount: 0,
|
|
253
|
+
pending: false,
|
|
254
|
+
args,
|
|
255
|
+
flags: Object.assign({ fromQueue: true }, this.flags)
|
|
256
|
+
};
|
|
257
|
+
args.push((err, ...responseArgs) => {
|
|
258
|
+
if (packet !== this._queue[0]) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const hasError = err !== null;
|
|
262
|
+
if (hasError) {
|
|
263
|
+
if (packet.tryCount > this._opts.retries) {
|
|
264
|
+
this._queue.shift();
|
|
265
|
+
if (ack) {
|
|
266
|
+
ack(err);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
this._queue.shift();
|
|
271
|
+
if (ack) {
|
|
272
|
+
ack(null, ...responseArgs);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
packet.pending = false;
|
|
276
|
+
return this._drainQueue();
|
|
277
|
+
});
|
|
278
|
+
this._queue.push(packet);
|
|
279
|
+
this._drainQueue();
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Send the first packet of the queue, and wait for an acknowledgement from the server.
|
|
283
|
+
* @param force - whether to resend a packet that has not been acknowledged yet
|
|
284
|
+
*
|
|
285
|
+
* @private
|
|
286
|
+
*/
|
|
287
|
+
_drainQueue(force = false) {
|
|
288
|
+
if (!this.connected || this._queue.length === 0) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const packet = this._queue[0];
|
|
292
|
+
if (packet.pending && !force) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
packet.pending = true;
|
|
296
|
+
packet.tryCount++;
|
|
297
|
+
this.flags = packet.flags;
|
|
298
|
+
this.emit.apply(this, packet.args);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Sends a packet.
|
|
302
|
+
*
|
|
303
|
+
* @param packet
|
|
304
|
+
* @private
|
|
305
|
+
*/
|
|
306
|
+
packet(packet) {
|
|
307
|
+
packet.nsp = this.nsp;
|
|
308
|
+
this.io._packet(packet);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Called upon engine `open`.
|
|
312
|
+
*
|
|
313
|
+
* @private
|
|
314
|
+
*/
|
|
315
|
+
onopen() {
|
|
316
|
+
if (typeof this.auth == "function") {
|
|
317
|
+
this.auth((data) => {
|
|
318
|
+
this._sendConnectPacket(data);
|
|
319
|
+
});
|
|
320
|
+
} else {
|
|
321
|
+
this._sendConnectPacket(this.auth);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Sends a CONNECT packet to initiate the Socket.IO session.
|
|
326
|
+
*
|
|
327
|
+
* @param data
|
|
328
|
+
* @private
|
|
329
|
+
*/
|
|
330
|
+
_sendConnectPacket(data) {
|
|
331
|
+
this.packet({
|
|
332
|
+
type: PacketType.CONNECT,
|
|
333
|
+
data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, data) : data
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Called upon engine or manager `error`.
|
|
338
|
+
*
|
|
339
|
+
* @param err
|
|
340
|
+
* @private
|
|
341
|
+
*/
|
|
342
|
+
onerror(err) {
|
|
343
|
+
if (!this.connected) {
|
|
344
|
+
this.emitReserved("connect_error", err);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Called upon engine `close`.
|
|
349
|
+
*
|
|
350
|
+
* @param reason
|
|
351
|
+
* @param description
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
onclose(reason, description) {
|
|
355
|
+
this.connected = false;
|
|
356
|
+
delete this.id;
|
|
357
|
+
this.emitReserved("disconnect", reason, description);
|
|
358
|
+
this._clearAcks();
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Clears the acknowledgement handlers upon disconnection, since the client will never receive an acknowledgement from
|
|
362
|
+
* the server.
|
|
363
|
+
*
|
|
364
|
+
* @private
|
|
365
|
+
*/
|
|
366
|
+
_clearAcks() {
|
|
367
|
+
Object.keys(this.acks).forEach((id) => {
|
|
368
|
+
const isBuffered = this.sendBuffer.some((packet) => String(packet.id) === id);
|
|
369
|
+
if (!isBuffered) {
|
|
370
|
+
const ack = this.acks[id];
|
|
371
|
+
delete this.acks[id];
|
|
372
|
+
if (ack.withError) {
|
|
373
|
+
ack.call(this, new Error("socket has been disconnected"));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Called with socket packet.
|
|
380
|
+
*
|
|
381
|
+
* @param packet
|
|
382
|
+
* @private
|
|
383
|
+
*/
|
|
384
|
+
onpacket(packet) {
|
|
385
|
+
const sameNamespace = packet.nsp === this.nsp;
|
|
386
|
+
if (!sameNamespace)
|
|
387
|
+
return;
|
|
388
|
+
switch (packet.type) {
|
|
389
|
+
case PacketType.CONNECT:
|
|
390
|
+
if (packet.data && packet.data.sid) {
|
|
391
|
+
this.onconnect(packet.data.sid, packet.data.pid);
|
|
392
|
+
} else {
|
|
393
|
+
this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
|
|
394
|
+
}
|
|
395
|
+
break;
|
|
396
|
+
case PacketType.EVENT:
|
|
397
|
+
case PacketType.BINARY_EVENT:
|
|
398
|
+
this.onevent(packet);
|
|
399
|
+
break;
|
|
400
|
+
case PacketType.ACK:
|
|
401
|
+
case PacketType.BINARY_ACK:
|
|
402
|
+
this.onack(packet);
|
|
403
|
+
break;
|
|
404
|
+
case PacketType.DISCONNECT:
|
|
405
|
+
this.ondisconnect();
|
|
406
|
+
break;
|
|
407
|
+
case PacketType.CONNECT_ERROR:
|
|
408
|
+
this.destroy();
|
|
409
|
+
const err = new Error(packet.data.message);
|
|
410
|
+
err.data = packet.data.data;
|
|
411
|
+
this.emitReserved("connect_error", err);
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Called upon a server event.
|
|
417
|
+
*
|
|
418
|
+
* @param packet
|
|
419
|
+
* @private
|
|
420
|
+
*/
|
|
421
|
+
onevent(packet) {
|
|
422
|
+
const args = packet.data || [];
|
|
423
|
+
if (null != packet.id) {
|
|
424
|
+
args.push(this.ack(packet.id));
|
|
425
|
+
}
|
|
426
|
+
if (this.connected) {
|
|
427
|
+
this.emitEvent(args);
|
|
428
|
+
} else {
|
|
429
|
+
this.receiveBuffer.push(Object.freeze(args));
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
emitEvent(args) {
|
|
433
|
+
if (this._anyListeners && this._anyListeners.length) {
|
|
434
|
+
const listeners = this._anyListeners.slice();
|
|
435
|
+
for (const listener of listeners) {
|
|
436
|
+
listener.apply(this, args);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
super.emit.apply(this, args);
|
|
440
|
+
if (this._pid && args.length && typeof args[args.length - 1] === "string") {
|
|
441
|
+
this._lastOffset = args[args.length - 1];
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Produces an ack callback to emit with an event.
|
|
446
|
+
*
|
|
447
|
+
* @private
|
|
448
|
+
*/
|
|
449
|
+
ack(id) {
|
|
450
|
+
const self = this;
|
|
451
|
+
let sent = false;
|
|
452
|
+
return function(...args) {
|
|
453
|
+
if (sent)
|
|
454
|
+
return;
|
|
455
|
+
sent = true;
|
|
456
|
+
self.packet({
|
|
457
|
+
type: PacketType.ACK,
|
|
458
|
+
id,
|
|
459
|
+
data: args
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Called upon a server acknowledgement.
|
|
465
|
+
*
|
|
466
|
+
* @param packet
|
|
467
|
+
* @private
|
|
468
|
+
*/
|
|
469
|
+
onack(packet) {
|
|
470
|
+
const ack = this.acks[packet.id];
|
|
471
|
+
if (typeof ack !== "function") {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
delete this.acks[packet.id];
|
|
475
|
+
if (ack.withError) {
|
|
476
|
+
packet.data.unshift(null);
|
|
477
|
+
}
|
|
478
|
+
ack.apply(this, packet.data);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Called upon server connect.
|
|
482
|
+
*
|
|
483
|
+
* @private
|
|
484
|
+
*/
|
|
485
|
+
onconnect(id, pid) {
|
|
486
|
+
this.id = id;
|
|
487
|
+
this.recovered = pid && this._pid === pid;
|
|
488
|
+
this._pid = pid;
|
|
489
|
+
this.connected = true;
|
|
490
|
+
this.emitBuffered();
|
|
491
|
+
this.emitReserved("connect");
|
|
492
|
+
this._drainQueue(true);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Emit buffered events (received and emitted).
|
|
496
|
+
*
|
|
497
|
+
* @private
|
|
498
|
+
*/
|
|
499
|
+
emitBuffered() {
|
|
500
|
+
this.receiveBuffer.forEach((args) => this.emitEvent(args));
|
|
501
|
+
this.receiveBuffer = [];
|
|
502
|
+
this.sendBuffer.forEach((packet) => {
|
|
503
|
+
this.notifyOutgoingListeners(packet);
|
|
504
|
+
this.packet(packet);
|
|
505
|
+
});
|
|
506
|
+
this.sendBuffer = [];
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Called upon server disconnect.
|
|
510
|
+
*
|
|
511
|
+
* @private
|
|
512
|
+
*/
|
|
513
|
+
ondisconnect() {
|
|
514
|
+
this.destroy();
|
|
515
|
+
this.onclose("io server disconnect");
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Called upon forced client/server side disconnections,
|
|
519
|
+
* this method ensures the manager stops tracking us and
|
|
520
|
+
* that reconnections don't get triggered for this.
|
|
521
|
+
*
|
|
522
|
+
* @private
|
|
523
|
+
*/
|
|
524
|
+
destroy() {
|
|
525
|
+
if (this.subs) {
|
|
526
|
+
this.subs.forEach((subDestroy) => subDestroy());
|
|
527
|
+
this.subs = void 0;
|
|
528
|
+
}
|
|
529
|
+
this.io["_destroy"](this);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Disconnects the socket manually. In that case, the socket will not try to reconnect.
|
|
533
|
+
*
|
|
534
|
+
* If this is the last active Socket instance of the {@link Manager}, the low-level connection will be closed.
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* const socket = io();
|
|
538
|
+
*
|
|
539
|
+
* socket.on("disconnect", (reason) => {
|
|
540
|
+
* // console.log(reason); prints "io client disconnect"
|
|
541
|
+
* });
|
|
542
|
+
*
|
|
543
|
+
* socket.disconnect();
|
|
544
|
+
*
|
|
545
|
+
* @return self
|
|
546
|
+
*/
|
|
547
|
+
disconnect() {
|
|
548
|
+
if (this.connected) {
|
|
549
|
+
this.packet({ type: PacketType.DISCONNECT });
|
|
550
|
+
}
|
|
551
|
+
this.destroy();
|
|
552
|
+
if (this.connected) {
|
|
553
|
+
this.onclose("io client disconnect");
|
|
554
|
+
}
|
|
555
|
+
return this;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Alias for {@link disconnect()}.
|
|
559
|
+
*
|
|
560
|
+
* @return self
|
|
561
|
+
*/
|
|
562
|
+
close() {
|
|
563
|
+
return this.disconnect();
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Sets the compress flag.
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* socket.compress(false).emit("hello");
|
|
570
|
+
*
|
|
571
|
+
* @param compress - if `true`, compresses the sending data
|
|
572
|
+
* @return self
|
|
573
|
+
*/
|
|
574
|
+
compress(compress) {
|
|
575
|
+
this.flags.compress = compress;
|
|
576
|
+
return this;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not
|
|
580
|
+
* ready to send messages.
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* socket.volatile.emit("hello"); // the server may or may not receive it
|
|
584
|
+
*
|
|
585
|
+
* @returns self
|
|
586
|
+
*/
|
|
587
|
+
get volatile() {
|
|
588
|
+
this.flags.volatile = true;
|
|
589
|
+
return this;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Sets a modifier for a subsequent event emission that the callback will be called with an error when the
|
|
593
|
+
* given number of milliseconds have elapsed without an acknowledgement from the server:
|
|
594
|
+
*
|
|
595
|
+
* @example
|
|
596
|
+
* socket.timeout(5000).emit("my-event", (err) => {
|
|
597
|
+
* if (err) {
|
|
598
|
+
* // the server did not acknowledge the event in the given delay
|
|
599
|
+
* }
|
|
600
|
+
* });
|
|
601
|
+
*
|
|
602
|
+
* @returns self
|
|
603
|
+
*/
|
|
604
|
+
timeout(timeout) {
|
|
605
|
+
this.flags.timeout = timeout;
|
|
606
|
+
return this;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
|
|
610
|
+
* callback.
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* socket.onAny((event, ...args) => {
|
|
614
|
+
* console.log(`got ${event}`);
|
|
615
|
+
* });
|
|
616
|
+
*
|
|
617
|
+
* @param listener
|
|
618
|
+
*/
|
|
619
|
+
onAny(listener) {
|
|
620
|
+
this._anyListeners = this._anyListeners || [];
|
|
621
|
+
this._anyListeners.push(listener);
|
|
622
|
+
return this;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
|
|
626
|
+
* callback. The listener is added to the beginning of the listeners array.
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* socket.prependAny((event, ...args) => {
|
|
630
|
+
* console.log(`got event ${event}`);
|
|
631
|
+
* });
|
|
632
|
+
*
|
|
633
|
+
* @param listener
|
|
634
|
+
*/
|
|
635
|
+
prependAny(listener) {
|
|
636
|
+
this._anyListeners = this._anyListeners || [];
|
|
637
|
+
this._anyListeners.unshift(listener);
|
|
638
|
+
return this;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Removes the listener that will be fired when any event is emitted.
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* const catchAllListener = (event, ...args) => {
|
|
645
|
+
* console.log(`got event ${event}`);
|
|
646
|
+
* }
|
|
647
|
+
*
|
|
648
|
+
* socket.onAny(catchAllListener);
|
|
649
|
+
*
|
|
650
|
+
* // remove a specific listener
|
|
651
|
+
* socket.offAny(catchAllListener);
|
|
652
|
+
*
|
|
653
|
+
* // or remove all listeners
|
|
654
|
+
* socket.offAny();
|
|
655
|
+
*
|
|
656
|
+
* @param listener
|
|
657
|
+
*/
|
|
658
|
+
offAny(listener) {
|
|
659
|
+
if (!this._anyListeners) {
|
|
660
|
+
return this;
|
|
661
|
+
}
|
|
662
|
+
if (listener) {
|
|
663
|
+
const listeners = this._anyListeners;
|
|
664
|
+
for (let i = 0; i < listeners.length; i++) {
|
|
665
|
+
if (listener === listeners[i]) {
|
|
666
|
+
listeners.splice(i, 1);
|
|
667
|
+
return this;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
} else {
|
|
671
|
+
this._anyListeners = [];
|
|
672
|
+
}
|
|
673
|
+
return this;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
|
|
677
|
+
* e.g. to remove listeners.
|
|
678
|
+
*/
|
|
679
|
+
listenersAny() {
|
|
680
|
+
return this._anyListeners || [];
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
|
|
684
|
+
* callback.
|
|
685
|
+
*
|
|
686
|
+
* Note: acknowledgements sent to the server are not included.
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* socket.onAnyOutgoing((event, ...args) => {
|
|
690
|
+
* console.log(`sent event ${event}`);
|
|
691
|
+
* });
|
|
692
|
+
*
|
|
693
|
+
* @param listener
|
|
694
|
+
*/
|
|
695
|
+
onAnyOutgoing(listener) {
|
|
696
|
+
this._anyOutgoingListeners = this._anyOutgoingListeners || [];
|
|
697
|
+
this._anyOutgoingListeners.push(listener);
|
|
698
|
+
return this;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
|
|
702
|
+
* callback. The listener is added to the beginning of the listeners array.
|
|
703
|
+
*
|
|
704
|
+
* Note: acknowledgements sent to the server are not included.
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* socket.prependAnyOutgoing((event, ...args) => {
|
|
708
|
+
* console.log(`sent event ${event}`);
|
|
709
|
+
* });
|
|
710
|
+
*
|
|
711
|
+
* @param listener
|
|
712
|
+
*/
|
|
713
|
+
prependAnyOutgoing(listener) {
|
|
714
|
+
this._anyOutgoingListeners = this._anyOutgoingListeners || [];
|
|
715
|
+
this._anyOutgoingListeners.unshift(listener);
|
|
716
|
+
return this;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Removes the listener that will be fired when any event is emitted.
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* const catchAllListener = (event, ...args) => {
|
|
723
|
+
* console.log(`sent event ${event}`);
|
|
724
|
+
* }
|
|
725
|
+
*
|
|
726
|
+
* socket.onAnyOutgoing(catchAllListener);
|
|
727
|
+
*
|
|
728
|
+
* // remove a specific listener
|
|
729
|
+
* socket.offAnyOutgoing(catchAllListener);
|
|
730
|
+
*
|
|
731
|
+
* // or remove all listeners
|
|
732
|
+
* socket.offAnyOutgoing();
|
|
733
|
+
*
|
|
734
|
+
* @param [listener] - the catch-all listener (optional)
|
|
735
|
+
*/
|
|
736
|
+
offAnyOutgoing(listener) {
|
|
737
|
+
if (!this._anyOutgoingListeners) {
|
|
738
|
+
return this;
|
|
739
|
+
}
|
|
740
|
+
if (listener) {
|
|
741
|
+
const listeners = this._anyOutgoingListeners;
|
|
742
|
+
for (let i = 0; i < listeners.length; i++) {
|
|
743
|
+
if (listener === listeners[i]) {
|
|
744
|
+
listeners.splice(i, 1);
|
|
745
|
+
return this;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
} else {
|
|
749
|
+
this._anyOutgoingListeners = [];
|
|
750
|
+
}
|
|
751
|
+
return this;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
|
|
755
|
+
* e.g. to remove listeners.
|
|
756
|
+
*/
|
|
757
|
+
listenersAnyOutgoing() {
|
|
758
|
+
return this._anyOutgoingListeners || [];
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Notify the listeners for each packet sent
|
|
762
|
+
*
|
|
763
|
+
* @param packet
|
|
764
|
+
*
|
|
765
|
+
* @private
|
|
766
|
+
*/
|
|
767
|
+
notifyOutgoingListeners(packet) {
|
|
768
|
+
if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) {
|
|
769
|
+
const listeners = this._anyOutgoingListeners.slice();
|
|
770
|
+
for (const listener of listeners) {
|
|
771
|
+
listener.apply(this, packet.data);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
export {
|
|
777
|
+
Socket
|
|
778
|
+
};
|