@atlaskit/editor-core 172.0.3 → 172.1.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/CHANGELOG.md +56 -0
- package/dist/cjs/create-editor/ReactEditorView.js +11 -2
- package/dist/cjs/create-editor/ReactEditorViewContext.js +15 -0
- package/dist/cjs/create-editor/create-plugins-list.js +2 -1
- package/dist/cjs/editor.js +7 -1
- package/dist/cjs/labs/next/mobile.js +5 -3
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/plugins/analytics/types/enums.js +1 -0
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +8 -0
- package/dist/cjs/plugins/card/pm-plugins/doc.js +2 -26
- package/dist/cjs/plugins/card/toolbar.js +118 -86
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +37 -1
- package/dist/cjs/plugins/code-block/toolbar.js +3 -1
- package/dist/cjs/plugins/code-block/ui/class-names.js +2 -0
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +42 -2
- package/dist/cjs/plugins/hyperlink/Toolbar.js +43 -8
- package/dist/cjs/plugins/media/commands/helpers.js +1 -8
- package/dist/cjs/plugins/media/index.js +1 -1
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +0 -10
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/cjs/plugins/media/picker-facade.js +1 -0
- package/dist/cjs/plugins/media/pm-plugins/main.js +3 -13
- package/dist/cjs/plugins/paste/handlers.js +9 -20
- package/dist/cjs/plugins/paste/md.js +8 -2
- package/dist/cjs/plugins/paste/newline-md-plugin.js +67 -0
- package/dist/cjs/plugins/paste/paragraph-md-plugin.js +72 -0
- package/dist/cjs/plugins/table/commands/hover.js +4 -4
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
- package/dist/cjs/plugins/table/utils/decoration.js +53 -3
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +3 -2
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +78 -53
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -1
- package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +7 -2
- package/dist/cjs/ui/Addon/ClickAreaMobile/index.js +8 -2
- package/dist/cjs/ui/Appearance/Comment/Comment.js +13 -13
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +8 -7
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/cjs/ui/Appearance/Mobile.js +4 -2
- package/dist/cjs/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/DropdownMenu/index.js +5 -5
- package/dist/cjs/ui/with-outer-listeners.js +105 -50
- package/dist/cjs/utils/deprecation-warnings.js +4 -0
- package/dist/cjs/utils/linking-utils.js +40 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +11 -2
- package/dist/es2019/create-editor/ReactEditorViewContext.js +3 -0
- package/dist/es2019/create-editor/create-plugins-list.js +2 -1
- package/dist/es2019/editor.js +7 -1
- package/dist/es2019/labs/next/mobile.js +5 -3
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/plugins/analytics/types/enums.js +1 -0
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +10 -0
- package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -24
- package/dist/es2019/plugins/card/toolbar.js +114 -86
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +40 -2
- package/dist/es2019/plugins/code-block/toolbar.js +2 -1
- package/dist/es2019/plugins/code-block/ui/class-names.js +2 -0
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +37 -0
- package/dist/es2019/plugins/hyperlink/Toolbar.js +40 -9
- package/dist/es2019/plugins/media/commands/helpers.js +0 -2
- package/dist/es2019/plugins/media/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +0 -7
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/es2019/plugins/media/picker-facade.js +1 -0
- package/dist/es2019/plugins/media/pm-plugins/main.js +3 -13
- package/dist/es2019/plugins/paste/handlers.js +7 -19
- package/dist/es2019/plugins/paste/md.js +6 -2
- package/dist/es2019/plugins/paste/newline-md-plugin.js +56 -0
- package/dist/es2019/plugins/paste/paragraph-md-plugin.js +61 -0
- package/dist/es2019/plugins/table/commands/hover.js +4 -4
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +39 -2
- package/dist/es2019/plugins/table/utils/decoration.js +60 -24
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +4 -3
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +78 -59
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +6 -2
- package/dist/es2019/ui/Addon/ClickAreaMobile/index.js +7 -2
- package/dist/es2019/ui/Appearance/Comment/Comment.js +12 -6
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +7 -2
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/es2019/ui/Appearance/Mobile.js +4 -2
- package/dist/es2019/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/DropdownMenu/index.js +10 -6
- package/dist/es2019/ui/with-outer-listeners.js +83 -33
- package/dist/es2019/utils/deprecation-warnings.js +4 -0
- package/dist/es2019/utils/linking-utils.js +37 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +11 -2
- package/dist/esm/create-editor/ReactEditorViewContext.js +3 -0
- package/dist/esm/create-editor/create-plugins-list.js +2 -1
- package/dist/esm/editor.js +7 -1
- package/dist/esm/labs/next/mobile.js +5 -3
- package/dist/esm/messages.js +5 -0
- package/dist/esm/plugins/analytics/types/enums.js +1 -0
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +9 -0
- package/dist/esm/plugins/card/pm-plugins/doc.js +1 -20
- package/dist/esm/plugins/card/toolbar.js +108 -83
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +9 -2
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +37 -2
- package/dist/esm/plugins/code-block/toolbar.js +2 -1
- package/dist/esm/plugins/code-block/ui/class-names.js +2 -0
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
- package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +41 -2
- package/dist/esm/plugins/hyperlink/Toolbar.js +43 -10
- package/dist/esm/plugins/media/commands/helpers.js +0 -4
- package/dist/esm/plugins/media/index.js +1 -1
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +0 -8
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
- package/dist/esm/plugins/media/picker-facade.js +1 -0
- package/dist/esm/plugins/media/pm-plugins/main.js +3 -15
- package/dist/esm/plugins/paste/handlers.js +11 -22
- package/dist/esm/plugins/paste/md.js +6 -2
- package/dist/esm/plugins/paste/newline-md-plugin.js +58 -0
- package/dist/esm/plugins/paste/paragraph-md-plugin.js +63 -0
- package/dist/esm/plugins/table/commands/hover.js +4 -4
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
- package/dist/esm/plugins/table/ui/common-styles.js +1 -1
- package/dist/esm/plugins/table/utils/decoration.js +50 -3
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +4 -3
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +77 -51
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
- package/dist/esm/ui/Addon/ClickAreaBlock/index.js +7 -2
- package/dist/esm/ui/Addon/ClickAreaMobile/index.js +8 -2
- package/dist/esm/ui/Appearance/Comment/Comment.js +12 -12
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +7 -6
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
- package/dist/esm/ui/Appearance/Mobile.js +4 -2
- package/dist/esm/ui/AppearanceComponents/Mobile.js +5 -4
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/DropdownMenu/index.js +5 -5
- package/dist/esm/ui/with-outer-listeners.js +105 -51
- package/dist/esm/utils/deprecation-warnings.js +4 -0
- package/dist/esm/utils/linking-utils.js +37 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorView.d.ts +2 -0
- package/dist/types/create-editor/ReactEditorViewContext.d.ts +8 -0
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
- package/dist/types/plugins/analytics/types/events.d.ts +2 -2
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +3 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -2
- package/dist/types/plugins/card/toolbar.d.ts +1 -0
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -1
- package/dist/types/plugins/code-block/ui/class-names.d.ts +2 -0
- package/dist/types/plugins/hyperlink/types.d.ts +1 -0
- package/dist/types/plugins/media/commands/helpers.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +0 -1
- package/dist/types/plugins/media/nodeviews/mediaNodeView/media.d.ts +0 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +0 -2
- package/dist/types/plugins/media/pm-plugins/types.d.ts +0 -2
- package/dist/types/plugins/paste/newline-md-plugin.d.ts +2 -0
- package/dist/types/plugins/paste/paragraph-md-plugin.d.ts +2 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types/types/editor-appearance-component.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +9 -0
- package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +1 -0
- package/dist/types/ui/Addon/ClickAreaMobile/index.d.ts +1 -0
- package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -0
- package/dist/types/ui/Appearance/Mobile.d.ts +1 -1
- package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -1
- package/dist/types/ui/Dropdown/index.d.ts +1 -1
- package/dist/types/ui/with-outer-listeners.d.ts +2 -1
- package/dist/types/utils/linking-utils.d.ts +1 -0
- package/package.json +31 -33
- package/dist/cjs/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -77
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -118
- package/dist/cjs/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -70
- package/dist/es2019/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -97
- package/dist/es2019/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -53
- package/dist/esm/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
- package/dist/esm/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -101
- package/dist/esm/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -48
- package/dist/types/plugins/type-ahead/ui/DynamicHeightListItem.d.ts +0 -21
- package/dist/types/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.d.ts +0 -25
- package/dist/types/plugins/type-ahead/ui/hooks/use-resize-observer.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "172.0
|
|
3
|
+
"version": "172.1.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/activity": "^1.0.1",
|
|
28
28
|
"@atlaskit/activity-provider": "^2.3.0",
|
|
29
|
-
"@atlaskit/adf-schema": "^
|
|
29
|
+
"@atlaskit/adf-schema": "^24.0.0",
|
|
30
30
|
"@atlaskit/adf-utils": "^17.1.0",
|
|
31
31
|
"@atlaskit/analytics-gas-types": "^5.0.0",
|
|
32
32
|
"@atlaskit/analytics-listeners": "^8.3.0",
|
|
@@ -36,48 +36,48 @@
|
|
|
36
36
|
"@atlaskit/avatar": "^21.0.0",
|
|
37
37
|
"@atlaskit/avatar-group": "^9.0.0",
|
|
38
38
|
"@atlaskit/button": "^16.3.0",
|
|
39
|
-
"@atlaskit/calendar": "^12.
|
|
39
|
+
"@atlaskit/calendar": "^12.4.0",
|
|
40
40
|
"@atlaskit/checkbox": "^12.3.0",
|
|
41
41
|
"@atlaskit/code": "^14.3.0",
|
|
42
42
|
"@atlaskit/date": "^0.9.0",
|
|
43
|
-
"@atlaskit/datetime-picker": "^12.
|
|
44
|
-
"@atlaskit/editor-common": "^69.
|
|
45
|
-
"@atlaskit/editor-json-transformer": "^8.
|
|
43
|
+
"@atlaskit/datetime-picker": "^12.2.0",
|
|
44
|
+
"@atlaskit/editor-common": "^69.2.0",
|
|
45
|
+
"@atlaskit/editor-json-transformer": "^8.8.0",
|
|
46
46
|
"@atlaskit/editor-markdown-transformer": "^4.1.0",
|
|
47
47
|
"@atlaskit/editor-shared-styles": "^2.1.0",
|
|
48
48
|
"@atlaskit/editor-tables": "^2.1.0",
|
|
49
|
-
"@atlaskit/emoji": "^65.
|
|
50
|
-
"@atlaskit/empty-state": "^7.
|
|
49
|
+
"@atlaskit/emoji": "^65.2.0",
|
|
50
|
+
"@atlaskit/empty-state": "^7.4.0",
|
|
51
51
|
"@atlaskit/form": "^8.5.0",
|
|
52
52
|
"@atlaskit/icon": "^21.10.0",
|
|
53
53
|
"@atlaskit/icon-object": "^6.2.0",
|
|
54
54
|
"@atlaskit/link-picker": "^1.8.0",
|
|
55
55
|
"@atlaskit/locale": "^2.3.0",
|
|
56
|
-
"@atlaskit/logo": "^13.
|
|
56
|
+
"@atlaskit/logo": "^13.9.0",
|
|
57
57
|
"@atlaskit/media-card": "^74.1.0",
|
|
58
58
|
"@atlaskit/media-client": "^17.1.0",
|
|
59
59
|
"@atlaskit/media-common": "^2.16.0",
|
|
60
60
|
"@atlaskit/media-filmstrip": "^45.0.0",
|
|
61
61
|
"@atlaskit/media-picker": "^63.0.0",
|
|
62
62
|
"@atlaskit/media-ui": "^22.1.0",
|
|
63
|
-
"@atlaskit/media-viewer": "^47.
|
|
63
|
+
"@atlaskit/media-viewer": "^47.1.0",
|
|
64
64
|
"@atlaskit/mention": "^21.0.0",
|
|
65
65
|
"@atlaskit/menu": "^1.3.0",
|
|
66
|
-
"@atlaskit/modal-dialog": "^12.
|
|
66
|
+
"@atlaskit/modal-dialog": "^12.3.0",
|
|
67
67
|
"@atlaskit/prosemirror-input-rules": "^2.1.0",
|
|
68
|
-
"@atlaskit/radio": "^5.
|
|
69
|
-
"@atlaskit/section-message": "^6.
|
|
70
|
-
"@atlaskit/select": "^15.
|
|
71
|
-
"@atlaskit/smart-card": "^
|
|
68
|
+
"@atlaskit/radio": "^5.4.0",
|
|
69
|
+
"@atlaskit/section-message": "^6.2.0",
|
|
70
|
+
"@atlaskit/select": "^15.7.0",
|
|
71
|
+
"@atlaskit/smart-card": "^22.1.0",
|
|
72
72
|
"@atlaskit/smart-user-picker": "^6.0.0",
|
|
73
73
|
"@atlaskit/spinner": "^15.1.0",
|
|
74
74
|
"@atlaskit/status": "^1.1.0",
|
|
75
|
-
"@atlaskit/tabs": "^13.
|
|
76
|
-
"@atlaskit/task-decision": "^17.
|
|
75
|
+
"@atlaskit/tabs": "^13.3.0",
|
|
76
|
+
"@atlaskit/task-decision": "^17.5.0",
|
|
77
77
|
"@atlaskit/textarea": "^4.3.0",
|
|
78
|
-
"@atlaskit/textfield": "^5.
|
|
79
|
-
"@atlaskit/theme": "^12.
|
|
80
|
-
"@atlaskit/toggle": "^12.
|
|
78
|
+
"@atlaskit/textfield": "^5.2.0",
|
|
79
|
+
"@atlaskit/theme": "^12.2.0",
|
|
80
|
+
"@atlaskit/toggle": "^12.5.0",
|
|
81
81
|
"@atlaskit/tokens": "^0.10.0",
|
|
82
82
|
"@atlaskit/tooltip": "^17.5.0",
|
|
83
83
|
"@atlaskit/util-service-support": "^6.1.0",
|
|
@@ -123,7 +123,6 @@
|
|
|
123
123
|
"react-loadable": "^5.1.0",
|
|
124
124
|
"react-transition-group": "^4.4.1",
|
|
125
125
|
"react-virtualized": "^9.8.0",
|
|
126
|
-
"react-window": "^1.8.6",
|
|
127
126
|
"rusha": "^0.8.13",
|
|
128
127
|
"uuid": "^3.1.0",
|
|
129
128
|
"w3c-keyname": "^2.1.0"
|
|
@@ -138,35 +137,35 @@
|
|
|
138
137
|
},
|
|
139
138
|
"devDependencies": {
|
|
140
139
|
"@atlaskit/atlassian-navigation": "^2.2.0",
|
|
141
|
-
"@atlaskit/breadcrumbs": "11.
|
|
140
|
+
"@atlaskit/breadcrumbs": "11.7.0",
|
|
142
141
|
"@atlaskit/code": "^14.3.0",
|
|
143
|
-
"@atlaskit/collab-provider": "7.
|
|
142
|
+
"@atlaskit/collab-provider": "7.6.0",
|
|
144
143
|
"@atlaskit/docs": "*",
|
|
145
|
-
"@atlaskit/drawer": "^7.
|
|
146
|
-
"@atlaskit/dropdown-menu": "^11.
|
|
144
|
+
"@atlaskit/drawer": "^7.2.0",
|
|
145
|
+
"@atlaskit/dropdown-menu": "^11.4.0",
|
|
147
146
|
"@atlaskit/droplist": "^11.0.0",
|
|
148
147
|
"@atlaskit/editor-bitbucket-transformer": "^7.2.0",
|
|
149
148
|
"@atlaskit/editor-extension-dropbox": "^0.3.0",
|
|
150
149
|
"@atlaskit/editor-test-helpers": "^17.1.0",
|
|
151
|
-
"@atlaskit/flag": "^14.
|
|
152
|
-
"@atlaskit/inline-dialog": "^13.
|
|
150
|
+
"@atlaskit/flag": "^14.7.0",
|
|
151
|
+
"@atlaskit/inline-dialog": "^13.4.0",
|
|
153
152
|
"@atlaskit/link-provider": "^1.0.0",
|
|
154
153
|
"@atlaskit/link-test-helpers": "^1.4.0",
|
|
155
|
-
"@atlaskit/lozenge": "^11.
|
|
154
|
+
"@atlaskit/lozenge": "^11.2.0",
|
|
156
155
|
"@atlaskit/media-core": "^33.0.0",
|
|
157
156
|
"@atlaskit/media-integration-test-helpers": "^2.6.0",
|
|
158
157
|
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
159
158
|
"@atlaskit/menu": "^1.3.0",
|
|
160
|
-
"@atlaskit/page-layout": "^1.
|
|
159
|
+
"@atlaskit/page-layout": "^1.3.0",
|
|
161
160
|
"@atlaskit/profilecard": "^16.12.0",
|
|
162
161
|
"@atlaskit/pubsub": "^6.0.0",
|
|
163
|
-
"@atlaskit/renderer": "^101.
|
|
164
|
-
"@atlaskit/section-message": "^6.
|
|
162
|
+
"@atlaskit/renderer": "^101.1.0",
|
|
163
|
+
"@atlaskit/section-message": "^6.2.0",
|
|
165
164
|
"@atlaskit/share": "*",
|
|
166
165
|
"@atlaskit/smart-user-picker": "^6.0.0",
|
|
167
166
|
"@atlaskit/synchrony-test-helpers": "^2.3.0",
|
|
168
167
|
"@atlaskit/textarea": "^4.3.0",
|
|
169
|
-
"@atlaskit/toggle": "^12.
|
|
168
|
+
"@atlaskit/toggle": "^12.5.0",
|
|
170
169
|
"@atlaskit/ufo": "^0.1.0",
|
|
171
170
|
"@atlaskit/util-data-test": "^17.5.0",
|
|
172
171
|
"@atlaskit/visual-regression": "*",
|
|
@@ -186,7 +185,6 @@
|
|
|
186
185
|
"@types/lz-string": "^1.3.34",
|
|
187
186
|
"@types/prettier": "^2.1.0",
|
|
188
187
|
"@types/raf-schd": "^4.0.1",
|
|
189
|
-
"@types/react-window": "^1.8.3",
|
|
190
188
|
"@types/rison": "^0.0.6",
|
|
191
189
|
"async-retry": "^1.2.3",
|
|
192
190
|
"diff": "^4.0.1",
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.UpdateListItemHeightContext = exports.SelectedIndexContext = exports.ListItemActionsContext = exports.DynamicHeightListItem = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _TypeAheadListItem = require("./TypeAheadListItem");
|
|
13
|
-
|
|
14
|
-
var _useResizeObserver = require("./hooks/use-resize-observer");
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
var noop = function noop() {};
|
|
21
|
-
|
|
22
|
-
var SelectedIndexContext = /*#__PURE__*/_react.default.createContext(0);
|
|
23
|
-
|
|
24
|
-
exports.SelectedIndexContext = SelectedIndexContext;
|
|
25
|
-
|
|
26
|
-
var ListItemActionsContext = /*#__PURE__*/_react.default.createContext({
|
|
27
|
-
onItemClick: noop,
|
|
28
|
-
onItemHover: noop
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
exports.ListItemActionsContext = ListItemActionsContext;
|
|
32
|
-
|
|
33
|
-
var UpdateListItemHeightContext = /*#__PURE__*/_react.default.createContext(noop);
|
|
34
|
-
|
|
35
|
-
exports.UpdateListItemHeightContext = UpdateListItemHeightContext;
|
|
36
|
-
|
|
37
|
-
var DynamicHeightListItem = function DynamicHeightListItem(_ref) {
|
|
38
|
-
var index = _ref.index,
|
|
39
|
-
data = _ref.data,
|
|
40
|
-
style = _ref.style;
|
|
41
|
-
var item = data[index];
|
|
42
|
-
var selectedIndex = (0, _react.useContext)(SelectedIndexContext);
|
|
43
|
-
|
|
44
|
-
var _useContext = (0, _react.useContext)(ListItemActionsContext),
|
|
45
|
-
onItemClick = _useContext.onItemClick,
|
|
46
|
-
onItemHover = _useContext.onItemHover;
|
|
47
|
-
|
|
48
|
-
var updateItemHeight = (0, _react.useContext)(UpdateListItemHeightContext);
|
|
49
|
-
var innerDivRef = (0, _react.useRef)(document.createElement('div'));
|
|
50
|
-
var onResize = (0, _react.useCallback)(function (entry) {
|
|
51
|
-
if (typeof updateItemHeight !== 'function') {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
updateItemHeight({
|
|
56
|
-
index: index,
|
|
57
|
-
height: entry.contentRect.height
|
|
58
|
-
});
|
|
59
|
-
}, [updateItemHeight, index]);
|
|
60
|
-
(0, _useResizeObserver.useResizeObserver)(innerDivRef, onResize);
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
62
|
-
style: style,
|
|
63
|
-
"data-index": index
|
|
64
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
-
ref: innerDivRef,
|
|
66
|
-
"data-testid": "list-item-height-observed-".concat(index)
|
|
67
|
-
}, /*#__PURE__*/_react.default.createElement(_TypeAheadListItem.TypeAheadListItem, {
|
|
68
|
-
key: item.title,
|
|
69
|
-
item: item,
|
|
70
|
-
itemIndex: index,
|
|
71
|
-
selectedIndex: selectedIndex,
|
|
72
|
-
onItemClick: onItemClick,
|
|
73
|
-
onItemHover: onItemHover
|
|
74
|
-
})));
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
exports.DynamicHeightListItem = DynamicHeightListItem;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.useDynamicListHeightCalculation = exports.calcVisibleListHeight = void 0;
|
|
9
|
-
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
|
-
var _react = require("react");
|
|
13
|
-
|
|
14
|
-
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
15
|
-
|
|
16
|
-
var calcVisibleListHeight = function calcVisibleListHeight(_ref) {
|
|
17
|
-
var startIndex = _ref.startIndex,
|
|
18
|
-
indexHeightMap = _ref.indexHeightMap,
|
|
19
|
-
limit = _ref.limit,
|
|
20
|
-
listMaxHeight = _ref.listMaxHeight,
|
|
21
|
-
listItemEstimatedHeight = _ref.listItemEstimatedHeight;
|
|
22
|
-
var hasSpace = true;
|
|
23
|
-
var totalHeight = 0;
|
|
24
|
-
var i = startIndex;
|
|
25
|
-
|
|
26
|
-
while (hasSpace && i < limit) {
|
|
27
|
-
var nextHeight = indexHeightMap[i] || listItemEstimatedHeight;
|
|
28
|
-
|
|
29
|
-
if (totalHeight < listMaxHeight) {
|
|
30
|
-
totalHeight += nextHeight;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
i++;
|
|
34
|
-
hasSpace = totalHeight <= listMaxHeight;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return totalHeight;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
exports.calcVisibleListHeight = calcVisibleListHeight;
|
|
41
|
-
|
|
42
|
-
var useDynamicListHeightCalculation = function useDynamicListHeightCalculation(_ref2) {
|
|
43
|
-
var redrawListAtIndex = _ref2.redrawListAtIndex,
|
|
44
|
-
getFirstVisibleIndex = _ref2.getFirstVisibleIndex,
|
|
45
|
-
listLength = _ref2.listLength,
|
|
46
|
-
listMaxHeight = _ref2.listMaxHeight,
|
|
47
|
-
listItemEstimatedHeight = _ref2.listItemEstimatedHeight;
|
|
48
|
-
|
|
49
|
-
var _useState = (0, _react.useState)(null),
|
|
50
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
51
|
-
renderedListHeight = _useState2[0],
|
|
52
|
-
setRenderedListHeight = _useState2[1];
|
|
53
|
-
|
|
54
|
-
var indexHeightMap = (0, _react.useRef)([]);
|
|
55
|
-
var resetScreenThrottled = (0, _react.useMemo)(function () {
|
|
56
|
-
return (0, _throttle.default)(function () {
|
|
57
|
-
requestAnimationFrame(function () {
|
|
58
|
-
var startIndex = getFirstVisibleIndex();
|
|
59
|
-
var lastItemRenderer = indexHeightMap.current[startIndex];
|
|
60
|
-
|
|
61
|
-
if (!lastItemRenderer) {
|
|
62
|
-
return;
|
|
63
|
-
} // This is an expensive method
|
|
64
|
-
// So, we are calling it only
|
|
65
|
-
// for the last top one visible
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
redrawListAtIndex(startIndex);
|
|
69
|
-
var nextListHeight = calcVisibleListHeight({
|
|
70
|
-
startIndex: startIndex,
|
|
71
|
-
limit: listLength,
|
|
72
|
-
indexHeightMap: indexHeightMap.current,
|
|
73
|
-
listMaxHeight: listMaxHeight,
|
|
74
|
-
listItemEstimatedHeight: listItemEstimatedHeight
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
if (nextListHeight) {
|
|
78
|
-
setRenderedListHeight(nextListHeight);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}, 16 // wait for one frame
|
|
82
|
-
);
|
|
83
|
-
}, [redrawListAtIndex, listLength, listMaxHeight, listItemEstimatedHeight, getFirstVisibleIndex]);
|
|
84
|
-
var setListItemHeight = (0, _react.useCallback)(function (_ref3) {
|
|
85
|
-
var index = _ref3.index,
|
|
86
|
-
height = _ref3.height;
|
|
87
|
-
|
|
88
|
-
if (typeof height !== 'number') {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
indexHeightMap.current[index] = height;
|
|
93
|
-
resetScreenThrottled();
|
|
94
|
-
}, [resetScreenThrottled]);
|
|
95
|
-
var getListItemHeight = (0, _react.useCallback)(function (index) {
|
|
96
|
-
var result = indexHeightMap.current[index];
|
|
97
|
-
|
|
98
|
-
if (result && typeof result === 'number') {
|
|
99
|
-
return result;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return listItemEstimatedHeight;
|
|
103
|
-
}, [listItemEstimatedHeight]);
|
|
104
|
-
(0, _react.useLayoutEffect)(function () {
|
|
105
|
-
indexHeightMap.current = [];
|
|
106
|
-
return function () {
|
|
107
|
-
indexHeightMap.current = [];
|
|
108
|
-
};
|
|
109
|
-
}, [listLength]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
getListItemHeight: getListItemHeight,
|
|
113
|
-
setListItemHeight: setListItemHeight,
|
|
114
|
-
renderedListHeight: renderedListHeight
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
exports.useDynamicListHeightCalculation = useDynamicListHeightCalculation;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.useResizeObserver = exports.ResizeObserverProvider = exports.ResizeObserverContext = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
|
-
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
|
-
var Context = /*#__PURE__*/(0, _react.createContext)(null);
|
|
19
|
-
var ResizeObserverContext = Context;
|
|
20
|
-
exports.ResizeObserverContext = ResizeObserverContext;
|
|
21
|
-
|
|
22
|
-
var ResizeObserverProvider = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
23
|
-
var children = _ref.children;
|
|
24
|
-
var instance = (0, _react.useMemo)(function () {
|
|
25
|
-
if (!_utils.browser.supportsResizeObserver) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return new window.ResizeObserver(function (entries) {
|
|
30
|
-
entries.forEach(function (entry) {
|
|
31
|
-
var onResize = entry.target.onResize;
|
|
32
|
-
|
|
33
|
-
if (onResize) {
|
|
34
|
-
onResize(entry);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}, []);
|
|
39
|
-
(0, _react.useEffect)(function () {
|
|
40
|
-
return function () {
|
|
41
|
-
if (instance) {
|
|
42
|
-
instance.disconnect();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}, [instance]);
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(Context.Provider, {
|
|
47
|
-
value: instance
|
|
48
|
-
}, children);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
exports.ResizeObserverProvider = ResizeObserverProvider;
|
|
52
|
-
|
|
53
|
-
var useResizeObserver = function useResizeObserver(targetRef, onResize) {
|
|
54
|
-
var resizeObserver = (0, _react.useContext)(Context);
|
|
55
|
-
(0, _react.useLayoutEffect)(function () {
|
|
56
|
-
if (!targetRef || !targetRef.current || resizeObserver === null) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var target = targetRef.current;
|
|
61
|
-
target.onResize = onResize;
|
|
62
|
-
resizeObserver.observe(target);
|
|
63
|
-
return function () {
|
|
64
|
-
resizeObserver.unobserve(target);
|
|
65
|
-
delete target.onResize;
|
|
66
|
-
};
|
|
67
|
-
}, [targetRef, resizeObserver, onResize]);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
exports.useResizeObserver = useResizeObserver;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useRef, useCallback } from 'react';
|
|
2
|
-
import { TypeAheadListItem } from './TypeAheadListItem';
|
|
3
|
-
import { useResizeObserver } from './hooks/use-resize-observer';
|
|
4
|
-
|
|
5
|
-
const noop = () => {};
|
|
6
|
-
|
|
7
|
-
export const SelectedIndexContext = /*#__PURE__*/React.createContext(0);
|
|
8
|
-
export const ListItemActionsContext = /*#__PURE__*/React.createContext({
|
|
9
|
-
onItemClick: noop,
|
|
10
|
-
onItemHover: noop
|
|
11
|
-
});
|
|
12
|
-
export const UpdateListItemHeightContext = /*#__PURE__*/React.createContext(noop);
|
|
13
|
-
export const DynamicHeightListItem = ({
|
|
14
|
-
index,
|
|
15
|
-
data,
|
|
16
|
-
style
|
|
17
|
-
}) => {
|
|
18
|
-
const item = data[index];
|
|
19
|
-
const selectedIndex = useContext(SelectedIndexContext);
|
|
20
|
-
const {
|
|
21
|
-
onItemClick,
|
|
22
|
-
onItemHover
|
|
23
|
-
} = useContext(ListItemActionsContext);
|
|
24
|
-
const updateItemHeight = useContext(UpdateListItemHeightContext);
|
|
25
|
-
const innerDivRef = useRef(document.createElement('div'));
|
|
26
|
-
const onResize = useCallback(entry => {
|
|
27
|
-
if (typeof updateItemHeight !== 'function') {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
updateItemHeight({
|
|
32
|
-
index,
|
|
33
|
-
height: entry.contentRect.height
|
|
34
|
-
});
|
|
35
|
-
}, [updateItemHeight, index]);
|
|
36
|
-
useResizeObserver(innerDivRef, onResize);
|
|
37
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
-
style: style,
|
|
39
|
-
"data-index": index
|
|
40
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
-
ref: innerDivRef,
|
|
42
|
-
"data-testid": `list-item-height-observed-${index}`
|
|
43
|
-
}, /*#__PURE__*/React.createElement(TypeAheadListItem, {
|
|
44
|
-
key: item.title,
|
|
45
|
-
item: item,
|
|
46
|
-
itemIndex: index,
|
|
47
|
-
selectedIndex: selectedIndex,
|
|
48
|
-
onItemClick: onItemClick,
|
|
49
|
-
onItemHover: onItemHover
|
|
50
|
-
})));
|
|
51
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { useMemo, useState, useRef, useCallback, useLayoutEffect } from 'react';
|
|
2
|
-
import throttle from 'lodash/throttle';
|
|
3
|
-
export const calcVisibleListHeight = ({
|
|
4
|
-
startIndex,
|
|
5
|
-
indexHeightMap,
|
|
6
|
-
limit,
|
|
7
|
-
listMaxHeight,
|
|
8
|
-
listItemEstimatedHeight
|
|
9
|
-
}) => {
|
|
10
|
-
let hasSpace = true;
|
|
11
|
-
let totalHeight = 0;
|
|
12
|
-
let i = startIndex;
|
|
13
|
-
|
|
14
|
-
while (hasSpace && i < limit) {
|
|
15
|
-
const nextHeight = indexHeightMap[i] || listItemEstimatedHeight;
|
|
16
|
-
|
|
17
|
-
if (totalHeight < listMaxHeight) {
|
|
18
|
-
totalHeight += nextHeight;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
i++;
|
|
22
|
-
hasSpace = totalHeight <= listMaxHeight;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return totalHeight;
|
|
26
|
-
};
|
|
27
|
-
export const useDynamicListHeightCalculation = ({
|
|
28
|
-
redrawListAtIndex,
|
|
29
|
-
getFirstVisibleIndex,
|
|
30
|
-
listLength,
|
|
31
|
-
listMaxHeight,
|
|
32
|
-
listItemEstimatedHeight
|
|
33
|
-
}) => {
|
|
34
|
-
const [renderedListHeight, setRenderedListHeight] = useState(null);
|
|
35
|
-
const indexHeightMap = useRef([]);
|
|
36
|
-
const resetScreenThrottled = useMemo(() => {
|
|
37
|
-
return throttle(() => {
|
|
38
|
-
requestAnimationFrame(() => {
|
|
39
|
-
const startIndex = getFirstVisibleIndex();
|
|
40
|
-
const lastItemRenderer = indexHeightMap.current[startIndex];
|
|
41
|
-
|
|
42
|
-
if (!lastItemRenderer) {
|
|
43
|
-
return;
|
|
44
|
-
} // This is an expensive method
|
|
45
|
-
// So, we are calling it only
|
|
46
|
-
// for the last top one visible
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
redrawListAtIndex(startIndex);
|
|
50
|
-
const nextListHeight = calcVisibleListHeight({
|
|
51
|
-
startIndex,
|
|
52
|
-
limit: listLength,
|
|
53
|
-
indexHeightMap: indexHeightMap.current,
|
|
54
|
-
listMaxHeight,
|
|
55
|
-
listItemEstimatedHeight
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
if (nextListHeight) {
|
|
59
|
-
setRenderedListHeight(nextListHeight);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}, 16 // wait for one frame
|
|
63
|
-
);
|
|
64
|
-
}, [redrawListAtIndex, listLength, listMaxHeight, listItemEstimatedHeight, getFirstVisibleIndex]);
|
|
65
|
-
const setListItemHeight = useCallback(({
|
|
66
|
-
index,
|
|
67
|
-
height
|
|
68
|
-
}) => {
|
|
69
|
-
if (typeof height !== 'number') {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
indexHeightMap.current[index] = height;
|
|
74
|
-
resetScreenThrottled();
|
|
75
|
-
}, [resetScreenThrottled]);
|
|
76
|
-
const getListItemHeight = useCallback(index => {
|
|
77
|
-
const result = indexHeightMap.current[index];
|
|
78
|
-
|
|
79
|
-
if (result && typeof result === 'number') {
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return listItemEstimatedHeight;
|
|
84
|
-
}, [listItemEstimatedHeight]);
|
|
85
|
-
useLayoutEffect(() => {
|
|
86
|
-
indexHeightMap.current = [];
|
|
87
|
-
return () => {
|
|
88
|
-
indexHeightMap.current = [];
|
|
89
|
-
};
|
|
90
|
-
}, [listLength]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
getListItemHeight,
|
|
94
|
-
setListItemHeight,
|
|
95
|
-
renderedListHeight
|
|
96
|
-
};
|
|
97
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useEffect, useContext, useLayoutEffect, createContext } from 'react';
|
|
2
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
3
|
-
const Context = /*#__PURE__*/createContext(null);
|
|
4
|
-
export const ResizeObserverContext = Context;
|
|
5
|
-
export const ResizeObserverProvider = /*#__PURE__*/React.memo(({
|
|
6
|
-
children
|
|
7
|
-
}) => {
|
|
8
|
-
const instance = useMemo(() => {
|
|
9
|
-
if (!browser.supportsResizeObserver) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return new window.ResizeObserver(entries => {
|
|
14
|
-
entries.forEach(entry => {
|
|
15
|
-
const {
|
|
16
|
-
onResize
|
|
17
|
-
} = entry.target;
|
|
18
|
-
|
|
19
|
-
if (onResize) {
|
|
20
|
-
onResize(entry);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
}, []);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
return () => {
|
|
27
|
-
if (instance) {
|
|
28
|
-
instance.disconnect();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}, [instance]);
|
|
32
|
-
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
33
|
-
value: instance
|
|
34
|
-
}, children);
|
|
35
|
-
});
|
|
36
|
-
export const useResizeObserver = (targetRef, onResize) => {
|
|
37
|
-
const resizeObserver = useContext(Context);
|
|
38
|
-
useLayoutEffect(() => {
|
|
39
|
-
if (!targetRef || !targetRef.current || resizeObserver === null) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const {
|
|
44
|
-
current: target
|
|
45
|
-
} = targetRef;
|
|
46
|
-
target.onResize = onResize;
|
|
47
|
-
resizeObserver.observe(target);
|
|
48
|
-
return () => {
|
|
49
|
-
resizeObserver.unobserve(target);
|
|
50
|
-
delete target.onResize;
|
|
51
|
-
};
|
|
52
|
-
}, [targetRef, resizeObserver, onResize]);
|
|
53
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useRef, useCallback } from 'react';
|
|
2
|
-
import { TypeAheadListItem } from './TypeAheadListItem';
|
|
3
|
-
import { useResizeObserver } from './hooks/use-resize-observer';
|
|
4
|
-
|
|
5
|
-
var noop = function noop() {};
|
|
6
|
-
|
|
7
|
-
export var SelectedIndexContext = /*#__PURE__*/React.createContext(0);
|
|
8
|
-
export var ListItemActionsContext = /*#__PURE__*/React.createContext({
|
|
9
|
-
onItemClick: noop,
|
|
10
|
-
onItemHover: noop
|
|
11
|
-
});
|
|
12
|
-
export var UpdateListItemHeightContext = /*#__PURE__*/React.createContext(noop);
|
|
13
|
-
export var DynamicHeightListItem = function DynamicHeightListItem(_ref) {
|
|
14
|
-
var index = _ref.index,
|
|
15
|
-
data = _ref.data,
|
|
16
|
-
style = _ref.style;
|
|
17
|
-
var item = data[index];
|
|
18
|
-
var selectedIndex = useContext(SelectedIndexContext);
|
|
19
|
-
|
|
20
|
-
var _useContext = useContext(ListItemActionsContext),
|
|
21
|
-
onItemClick = _useContext.onItemClick,
|
|
22
|
-
onItemHover = _useContext.onItemHover;
|
|
23
|
-
|
|
24
|
-
var updateItemHeight = useContext(UpdateListItemHeightContext);
|
|
25
|
-
var innerDivRef = useRef(document.createElement('div'));
|
|
26
|
-
var onResize = useCallback(function (entry) {
|
|
27
|
-
if (typeof updateItemHeight !== 'function') {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
updateItemHeight({
|
|
32
|
-
index: index,
|
|
33
|
-
height: entry.contentRect.height
|
|
34
|
-
});
|
|
35
|
-
}, [updateItemHeight, index]);
|
|
36
|
-
useResizeObserver(innerDivRef, onResize);
|
|
37
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
-
style: style,
|
|
39
|
-
"data-index": index
|
|
40
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
-
ref: innerDivRef,
|
|
42
|
-
"data-testid": "list-item-height-observed-".concat(index)
|
|
43
|
-
}, /*#__PURE__*/React.createElement(TypeAheadListItem, {
|
|
44
|
-
key: item.title,
|
|
45
|
-
item: item,
|
|
46
|
-
itemIndex: index,
|
|
47
|
-
selectedIndex: selectedIndex,
|
|
48
|
-
onItemClick: onItemClick,
|
|
49
|
-
onItemHover: onItemHover
|
|
50
|
-
})));
|
|
51
|
-
};
|