@atlaskit/editor-common 88.6.2 → 88.8.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 +29 -0
- package/browser/package.json +15 -0
- package/dist/cjs/icons/index.js +7 -0
- package/dist/cjs/icons/shared/DynamicStrokeIconDecoration.js +46 -0
- package/dist/cjs/lazy-node-view/index.js +89 -11
- package/dist/cjs/lazy-node-view/node-view.js +27 -7
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/styles/index.js +6 -0
- package/dist/cjs/styles/shared/lists.js +2 -2
- package/dist/cjs/styles/shared/plugins.js +7 -1
- package/dist/cjs/styles/shared/table.js +2 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/analytics.js +7 -27
- package/dist/cjs/utils/browser.js +3 -4
- package/dist/cjs/utils/index.js +20 -5
- package/dist/cjs/utils/unsupportedContent/types.js +5 -0
- package/dist/es2019/icons/index.js +1 -0
- package/dist/es2019/icons/shared/DynamicStrokeIconDecoration.js +40 -0
- package/dist/es2019/lazy-node-view/index.js +81 -11
- package/dist/es2019/lazy-node-view/node-view.js +25 -6
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/styles/index.js +1 -1
- package/dist/es2019/styles/shared/lists.js +1 -1
- package/dist/es2019/styles/shared/plugins.js +6 -0
- package/dist/es2019/styles/shared/table.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/analytics.js +1 -2
- package/dist/es2019/utils/browser.js +1 -1
- package/dist/es2019/utils/index.js +47 -3
- package/dist/es2019/utils/unsupportedContent/types.js +1 -0
- package/dist/esm/icons/index.js +1 -0
- package/dist/esm/icons/shared/DynamicStrokeIconDecoration.js +39 -0
- package/dist/esm/lazy-node-view/index.js +85 -11
- package/dist/esm/lazy-node-view/node-view.js +27 -7
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/styles/index.js +1 -1
- package/dist/esm/styles/shared/lists.js +1 -1
- package/dist/esm/styles/shared/plugins.js +6 -0
- package/dist/esm/styles/shared/table.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/analytics.js +1 -2
- package/dist/esm/utils/browser.js +1 -1
- package/dist/esm/utils/index.js +47 -3
- package/dist/esm/utils/unsupportedContent/types.js +1 -0
- package/dist/types/icons/index.d.ts +1 -0
- package/dist/types/icons/shared/DynamicStrokeIconDecoration.d.ts +13 -0
- package/dist/types/lazy-node-view/index.d.ts +18 -1
- package/dist/types/lazy-node-view/node-view.d.ts +4 -5
- package/dist/types/styles/index.d.ts +1 -1
- package/dist/types/styles/shared/plugins.d.ts +1 -0
- package/dist/types/utils/analytics.d.ts +1 -20
- package/dist/types/utils/browser.d.ts +1 -1
- package/dist/types/utils/index.d.ts +48 -4
- package/dist/types/utils/track-unsupported-content.d.ts +1 -1
- package/dist/types/utils/unsupportedContent/types.d.ts +18 -0
- package/dist/types/utils/validate-using-spec.d.ts +1 -1
- package/dist/types-ts4.5/icons/index.d.ts +1 -0
- package/dist/types-ts4.5/icons/shared/DynamicStrokeIconDecoration.d.ts +13 -0
- package/dist/types-ts4.5/lazy-node-view/index.d.ts +18 -1
- package/dist/types-ts4.5/lazy-node-view/node-view.d.ts +4 -5
- package/dist/types-ts4.5/styles/index.d.ts +1 -1
- package/dist/types-ts4.5/styles/shared/plugins.d.ts +1 -0
- package/dist/types-ts4.5/utils/analytics.d.ts +1 -20
- package/dist/types-ts4.5/utils/browser.d.ts +1 -1
- package/dist/types-ts4.5/utils/index.d.ts +48 -4
- package/dist/types-ts4.5/utils/track-unsupported-content.d.ts +1 -1
- package/dist/types-ts4.5/utils/unsupportedContent/types.d.ts +18 -0
- package/dist/types-ts4.5/utils/validate-using-spec.d.ts +1 -1
- package/package.json +4 -2
- package/utils/analytics/package.json +15 -0
- package/dist/cjs/lazy-node-view/replace-node-views.js +0 -173
- package/dist/es2019/lazy-node-view/replace-node-views.js +0 -166
- package/dist/esm/lazy-node-view/replace-node-views.js +0 -166
- package/dist/types/lazy-node-view/replace-node-views.d.ts +0 -34
- package/dist/types-ts4.5/lazy-node-view/replace-node-views.d.ts +0 -34
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { ACTION_SUBJECT_ID } from '../analytics';
|
|
3
|
-
import type { UnsupportedContentPayload, UnsupportedContentTooltipPayload } from './
|
|
3
|
+
import type { UnsupportedContentPayload, UnsupportedContentTooltipPayload } from './unsupportedContent/types';
|
|
4
4
|
type DispatchAnalyticsEvent = (payload: UnsupportedContentPayload) => void;
|
|
5
5
|
type DispatchAnalyticsEventTooltip = (payload: UnsupportedContentTooltipPayload) => void;
|
|
6
6
|
export declare const findAndTrackUnsupportedContentNodes: (node: PMNode, schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, ancestorHierarchy?: string) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ACTION, type ACTION_SUBJECT, type ACTION_SUBJECT_ID, type EVENT_TYPE } from '../../analytics';
|
|
2
|
+
type AEP<Action, ActionSubject, ActionSubjectID, Attributes, EventType> = {
|
|
3
|
+
action: Action;
|
|
4
|
+
actionSubject: ActionSubject;
|
|
5
|
+
actionSubjectId?: ActionSubjectID;
|
|
6
|
+
attributes?: Attributes;
|
|
7
|
+
eventType: EventType;
|
|
8
|
+
};
|
|
9
|
+
type TrackAEP<Action, ActionSubject, ActionSubjectID, Attributes> = AEP<Action, ActionSubject, ActionSubjectID, Attributes, EVENT_TYPE.TRACK>;
|
|
10
|
+
type UnsupportedContentEncounteredAEP = TrackAEP<ACTION.UNSUPPORTED_CONTENT_ENCOUNTERED, ACTION_SUBJECT.DOCUMENT, ACTION_SUBJECT_ID, {
|
|
11
|
+
unsupportedNode: Record<string, any>;
|
|
12
|
+
errorCode?: String;
|
|
13
|
+
}>;
|
|
14
|
+
export type UnsupportedContentPayload = UnsupportedContentEncounteredAEP;
|
|
15
|
+
export type UnsupportedContentTooltipPayload = AEP<ACTION.UNSUPPORTED_TOOLTIP_VIEWED, ACTION_SUBJECT.TOOLTIP, ACTION_SUBJECT_ID.ON_UNSUPPORTED_BLOCK | ACTION_SUBJECT_ID.ON_UNSUPPORTED_INLINE, {
|
|
16
|
+
unsupportedNodeType: string | undefined;
|
|
17
|
+
}, EVENT_TYPE.UI>;
|
|
18
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
|
2
2
|
import type { ErrorCallbackOptions, Validate, ValidationError } from '@atlaskit/adf-utils/validatorTypes';
|
|
3
3
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
export declare const UNSUPPORTED_NODE_ATTRIBUTE = "unsupportedNodeAttribute";
|
|
5
|
-
import type { UnsupportedContentPayload } from './
|
|
5
|
+
import type { UnsupportedContentPayload } from './unsupportedContent/types';
|
|
6
6
|
export type DispatchAnalyticsEvent = (event: UnsupportedContentPayload) => void;
|
|
7
7
|
export declare const validationErrorHandler: (entity: ADFEntity, error: ValidationError, options: ErrorCallbackOptions, marks: string[], validate: Validate, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => ADFEntity | {
|
|
8
8
|
type: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "88.
|
|
3
|
+
"version": "88.8.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"./insert": "./src/insert/index.ts",
|
|
44
44
|
"./types": "./src/types/index.ts",
|
|
45
45
|
"./ui": "./src/ui/index.tsx",
|
|
46
|
+
"./utils/analytics": "./src/utils/analytics.ts",
|
|
46
47
|
"./utils": "./src/utils/index.ts",
|
|
47
48
|
"./card": "./src/card/index.ts",
|
|
48
49
|
"./collab": "./src/collab/index.ts",
|
|
@@ -86,6 +87,7 @@
|
|
|
86
87
|
"./floating-toolbar": "./src/floating-toolbar/index.ts",
|
|
87
88
|
"./copy-button": "./src/copy-button/index.ts",
|
|
88
89
|
"./legacy-rank-plugins": "./src/rank.ts",
|
|
90
|
+
"./browser": "./src/utils/browser.ts",
|
|
89
91
|
"./indentation": "./src/indentation/index.ts",
|
|
90
92
|
"./annotation": "./src/annotation/index.ts",
|
|
91
93
|
"./constants": "./src/link/constants.ts",
|
|
@@ -101,7 +103,7 @@
|
|
|
101
103
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
102
104
|
"@atlaskit/adf-utils": "^19.8.0",
|
|
103
105
|
"@atlaskit/analytics-listeners": "^8.11.0",
|
|
104
|
-
"@atlaskit/analytics-namespaced-context": "^6.
|
|
106
|
+
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
105
107
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
106
108
|
"@atlaskit/atlassian-context": "^0.0.1",
|
|
107
109
|
"@atlaskit/button": "^20.1.0",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/utils/analytics",
|
|
3
|
+
"main": "../../dist/cjs/utils/analytics.js",
|
|
4
|
+
"module": "../../dist/esm/utils/analytics.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/utils/analytics.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../../dist/types/utils/analytics.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <5.4": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../../dist/types-ts4.5/utils/analytics.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.queueReplaceNodeViews = exports.debouncedReplaceNodeviews = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
10
|
-
var _memoize = _interopRequireDefault(require("lodash/memoize"));
|
|
11
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
/**
|
|
14
|
-
* 🧱 Internal: Editor FE Platform
|
|
15
|
-
*/
|
|
16
|
-
var isFirefox = /gecko\/\d/i.test(navigator.userAgent);
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 🧱 Internal: Editor FE Platform
|
|
20
|
-
*
|
|
21
|
-
* Replaces the node views in a ProseMirror editor with lazy-loaded node views.
|
|
22
|
-
*
|
|
23
|
-
* This function is used to update the `nodeViews` property of the `EditorView` after lazy-loaded
|
|
24
|
-
* node views have been loaded.
|
|
25
|
-
*
|
|
26
|
-
* The function checks if there are any loaded node views in the cache associated with the given
|
|
27
|
-
* `EditorView`. If there are, it replaces the current `nodeViews` in the `EditorView` with the
|
|
28
|
-
* loaded node views. The replacement is scheduled using `requestIdleCallback` or
|
|
29
|
-
* `requestAnimationFrame` to avoid blocking the main thread, especially in Firefox where
|
|
30
|
-
* `requestIdleCallback` may not be supported.
|
|
31
|
-
*
|
|
32
|
-
* @param {WeakMap<EditorView, Record<string, NodeViewConstructor>>} cache - A WeakMap that stores
|
|
33
|
-
* the loaded node views for each `EditorView`. The key is the `EditorView`, and the value
|
|
34
|
-
* is a record of node type names to their corresponding `NodeViewConstructor`.
|
|
35
|
-
* @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
|
|
36
|
-
* needs to be updated.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* const cache = new WeakMap();
|
|
40
|
-
* const view = new EditorView(...);
|
|
41
|
-
*
|
|
42
|
-
* // Assume some node views have been loaded and stored in the cache
|
|
43
|
-
* cache.set(view, {
|
|
44
|
-
* 'table': TableViewConstructor,
|
|
45
|
-
* 'tableCell': TableCellViewConstructor,
|
|
46
|
-
* });
|
|
47
|
-
*
|
|
48
|
-
* replaceNodeViews(cache, view);
|
|
49
|
-
*/
|
|
50
|
-
var replaceNodeViews = function replaceNodeViews(cache, view) {
|
|
51
|
-
var loadedNodeviews = cache.get(view);
|
|
52
|
-
if (!loadedNodeviews || Object.keys(loadedNodeviews).length === 0) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
var nodeViewsToReplace = _objectSpread({}, loadedNodeviews);
|
|
56
|
-
|
|
57
|
-
// Make sure the cache is cleaned
|
|
58
|
-
// From here, we will access the loaded node views by lexical scope
|
|
59
|
-
cache.set(view, {});
|
|
60
|
-
var callback = function callback() {
|
|
61
|
-
var currentNodeViews = view.props.nodeViews;
|
|
62
|
-
var nextNodeViews = _objectSpread(_objectSpread({}, currentNodeViews), nodeViewsToReplace);
|
|
63
|
-
view.setProps({
|
|
64
|
-
nodeViews: nextNodeViews
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
// eslint-disable-next-line compat/compat
|
|
68
|
-
var idle = window.requestIdleCallback;
|
|
69
|
-
|
|
70
|
-
/*
|
|
71
|
-
* For reasons that goes beyond my knowledge
|
|
72
|
-
* some Firefox versions aren't calling the requestIdleCallback.
|
|
73
|
-
*
|
|
74
|
-
* So, we need this check to make sure we are using the requestAnimationFrame for Firefox
|
|
75
|
-
*/
|
|
76
|
-
if (isFirefox || typeof idle !== 'function') {
|
|
77
|
-
window.requestAnimationFrame(callback);
|
|
78
|
-
} else {
|
|
79
|
-
idle(callback, {
|
|
80
|
-
timeout: 2000
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 🧱 Internal: Editor FE Platform
|
|
87
|
-
*/
|
|
88
|
-
var loadedPerEditorView = new WeakMap();
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 🧱 Internal: Editor FE Platform
|
|
92
|
-
* Based on https://github.com/lodash/lodash/issues/2403#issuecomment-1706130395
|
|
93
|
-
*
|
|
94
|
-
* Creates a debounced function that delays invoking the provided function until after a specified
|
|
95
|
-
* wait time has elapsed since the last time the debounced function was invoked. Additionally, the
|
|
96
|
-
* debounced function is memoized so that the same function instance is used for each unique set
|
|
97
|
-
* of arguments based on the resolver.
|
|
98
|
-
*
|
|
99
|
-
* This is particularly useful in scenarios where you want to debounce function calls while ensuring
|
|
100
|
-
* that each unique input combination receives its own debounced function instance. It's a combination
|
|
101
|
-
* of lodash's `debounce` and `memoize`.
|
|
102
|
-
*
|
|
103
|
-
* @template T
|
|
104
|
-
* @param {T} func - The function to debounce.
|
|
105
|
-
* @param {number} [wait=0] - The number of milliseconds to delay.
|
|
106
|
-
* @param {Object} [options] - The options object to pass to `debounce`.
|
|
107
|
-
* @param {Function} [resolver] - The function to resolve the cache key for memoization.
|
|
108
|
-
* @returns {Function} A new debounced and memoized function.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* const debouncedFunction = memoizeDebounce(myFunction, 300, { leading: true }, myResolver);
|
|
112
|
-
* debouncedFunction(arg1, arg2);
|
|
113
|
-
*/
|
|
114
|
-
function memoizeDebounce(func) {
|
|
115
|
-
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
116
|
-
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
117
|
-
var resolver = arguments.length > 3 ? arguments[3] : undefined;
|
|
118
|
-
var mem = (0, _memoize.default)(function () {
|
|
119
|
-
return (0, _debounce.default)(func, wait, options);
|
|
120
|
-
}, resolver);
|
|
121
|
-
return function () {
|
|
122
|
-
return mem.apply(void 0, arguments).apply(void 0, arguments);
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* 🧱 Internal: Editor FE Platform
|
|
128
|
-
*
|
|
129
|
-
* Debounced and memoized version of `replaceNodeViews`.
|
|
130
|
-
*
|
|
131
|
-
* This function is designed to update the `nodeViews` property of an `EditorView` after a
|
|
132
|
-
* period of inactivity (debounce), ensuring that multiple rapid updates do not occur in quick
|
|
133
|
-
* succession. It uses lodash's `debounce` to handle the debouncing.
|
|
134
|
-
*
|
|
135
|
-
* Memoization is crucial here to ensure that each `EditorView` instance has its own opportunity
|
|
136
|
-
* to update the node views. Without memoization, if you have multiple `EditorView` instances on
|
|
137
|
-
* the same page, only one instance would potentially call `view.setProps`, which could lead to
|
|
138
|
-
* incorrect or missing updates in other `EditorView` instances. By memoizing the debounced function,
|
|
139
|
-
* we ensure that each `EditorView` maintains its own debounced update logic.
|
|
140
|
-
*
|
|
141
|
-
* @param {CacheLoadedReactNodeViews} cache - A WeakMap that stores the loaded node views for each
|
|
142
|
-
* `EditorView`. The key is the `EditorView`, and the value is a record of node type names
|
|
143
|
-
* to their corresponding `NodeViewConstructor`.
|
|
144
|
-
* @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
|
|
145
|
-
* needs to be updated.
|
|
146
|
-
*
|
|
147
|
-
* This function is typically not called directly. Instead, it is invoked through `queueReplaceNodeViews`,
|
|
148
|
-
* which handles adding node views to the cache and triggering this debounced update.
|
|
149
|
-
*/
|
|
150
|
-
var debouncedReplaceNodeviews = exports.debouncedReplaceNodeviews = memoizeDebounce(replaceNodeViews, 0,
|
|
151
|
-
/**
|
|
152
|
-
* Use the default debounce options:
|
|
153
|
-
* {leading: false, trailing: true}
|
|
154
|
-
*/
|
|
155
|
-
undefined, function (cache, view) {
|
|
156
|
-
/**
|
|
157
|
-
* EditorView is a singleton.
|
|
158
|
-
* There is only one instance per Editor.
|
|
159
|
-
*/
|
|
160
|
-
return view;
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* 🧱 Internal: Editor FE Platform
|
|
165
|
-
*/
|
|
166
|
-
var queueReplaceNodeViews = exports.queueReplaceNodeViews = function queueReplaceNodeViews(view, _ref) {
|
|
167
|
-
var nodeName = _ref.nodeName,
|
|
168
|
-
nodeViewFunc = _ref.nodeViewFunc;
|
|
169
|
-
var nodeViews = loadedPerEditorView.get(view) || {};
|
|
170
|
-
nodeViews[nodeName] = nodeViewFunc;
|
|
171
|
-
loadedPerEditorView.set(view, nodeViews);
|
|
172
|
-
debouncedReplaceNodeviews(loadedPerEditorView, view);
|
|
173
|
-
};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import debounce from 'lodash/debounce';
|
|
2
|
-
import memoize from 'lodash/memoize';
|
|
3
|
-
/**
|
|
4
|
-
* 🧱 Internal: Editor FE Platform
|
|
5
|
-
*/
|
|
6
|
-
const isFirefox = /gecko\/\d/i.test(navigator.userAgent);
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 🧱 Internal: Editor FE Platform
|
|
10
|
-
*
|
|
11
|
-
* Replaces the node views in a ProseMirror editor with lazy-loaded node views.
|
|
12
|
-
*
|
|
13
|
-
* This function is used to update the `nodeViews` property of the `EditorView` after lazy-loaded
|
|
14
|
-
* node views have been loaded.
|
|
15
|
-
*
|
|
16
|
-
* The function checks if there are any loaded node views in the cache associated with the given
|
|
17
|
-
* `EditorView`. If there are, it replaces the current `nodeViews` in the `EditorView` with the
|
|
18
|
-
* loaded node views. The replacement is scheduled using `requestIdleCallback` or
|
|
19
|
-
* `requestAnimationFrame` to avoid blocking the main thread, especially in Firefox where
|
|
20
|
-
* `requestIdleCallback` may not be supported.
|
|
21
|
-
*
|
|
22
|
-
* @param {WeakMap<EditorView, Record<string, NodeViewConstructor>>} cache - A WeakMap that stores
|
|
23
|
-
* the loaded node views for each `EditorView`. The key is the `EditorView`, and the value
|
|
24
|
-
* is a record of node type names to their corresponding `NodeViewConstructor`.
|
|
25
|
-
* @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
|
|
26
|
-
* needs to be updated.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* const cache = new WeakMap();
|
|
30
|
-
* const view = new EditorView(...);
|
|
31
|
-
*
|
|
32
|
-
* // Assume some node views have been loaded and stored in the cache
|
|
33
|
-
* cache.set(view, {
|
|
34
|
-
* 'table': TableViewConstructor,
|
|
35
|
-
* 'tableCell': TableCellViewConstructor,
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* replaceNodeViews(cache, view);
|
|
39
|
-
*/
|
|
40
|
-
const replaceNodeViews = (cache, view) => {
|
|
41
|
-
const loadedNodeviews = cache.get(view);
|
|
42
|
-
if (!loadedNodeviews || Object.keys(loadedNodeviews).length === 0) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const nodeViewsToReplace = {
|
|
46
|
-
...loadedNodeviews
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Make sure the cache is cleaned
|
|
50
|
-
// From here, we will access the loaded node views by lexical scope
|
|
51
|
-
cache.set(view, {});
|
|
52
|
-
const callback = () => {
|
|
53
|
-
const currentNodeViews = view.props.nodeViews;
|
|
54
|
-
const nextNodeViews = {
|
|
55
|
-
...currentNodeViews,
|
|
56
|
-
...nodeViewsToReplace
|
|
57
|
-
};
|
|
58
|
-
view.setProps({
|
|
59
|
-
nodeViews: nextNodeViews
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
// eslint-disable-next-line compat/compat
|
|
63
|
-
const idle = window.requestIdleCallback;
|
|
64
|
-
|
|
65
|
-
/*
|
|
66
|
-
* For reasons that goes beyond my knowledge
|
|
67
|
-
* some Firefox versions aren't calling the requestIdleCallback.
|
|
68
|
-
*
|
|
69
|
-
* So, we need this check to make sure we are using the requestAnimationFrame for Firefox
|
|
70
|
-
*/
|
|
71
|
-
if (isFirefox || typeof idle !== 'function') {
|
|
72
|
-
window.requestAnimationFrame(callback);
|
|
73
|
-
} else {
|
|
74
|
-
idle(callback, {
|
|
75
|
-
timeout: 2000
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* 🧱 Internal: Editor FE Platform
|
|
82
|
-
*/
|
|
83
|
-
const loadedPerEditorView = new WeakMap();
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 🧱 Internal: Editor FE Platform
|
|
87
|
-
* Based on https://github.com/lodash/lodash/issues/2403#issuecomment-1706130395
|
|
88
|
-
*
|
|
89
|
-
* Creates a debounced function that delays invoking the provided function until after a specified
|
|
90
|
-
* wait time has elapsed since the last time the debounced function was invoked. Additionally, the
|
|
91
|
-
* debounced function is memoized so that the same function instance is used for each unique set
|
|
92
|
-
* of arguments based on the resolver.
|
|
93
|
-
*
|
|
94
|
-
* This is particularly useful in scenarios where you want to debounce function calls while ensuring
|
|
95
|
-
* that each unique input combination receives its own debounced function instance. It's a combination
|
|
96
|
-
* of lodash's `debounce` and `memoize`.
|
|
97
|
-
*
|
|
98
|
-
* @template T
|
|
99
|
-
* @param {T} func - The function to debounce.
|
|
100
|
-
* @param {number} [wait=0] - The number of milliseconds to delay.
|
|
101
|
-
* @param {Object} [options] - The options object to pass to `debounce`.
|
|
102
|
-
* @param {Function} [resolver] - The function to resolve the cache key for memoization.
|
|
103
|
-
* @returns {Function} A new debounced and memoized function.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* const debouncedFunction = memoizeDebounce(myFunction, 300, { leading: true }, myResolver);
|
|
107
|
-
* debouncedFunction(arg1, arg2);
|
|
108
|
-
*/
|
|
109
|
-
function memoizeDebounce(func, wait = 0, options, resolver) {
|
|
110
|
-
const mem = memoize(function () {
|
|
111
|
-
return debounce(func, wait, options);
|
|
112
|
-
}, resolver);
|
|
113
|
-
return function (...args) {
|
|
114
|
-
return mem(...args)(...args);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* 🧱 Internal: Editor FE Platform
|
|
120
|
-
*
|
|
121
|
-
* Debounced and memoized version of `replaceNodeViews`.
|
|
122
|
-
*
|
|
123
|
-
* This function is designed to update the `nodeViews` property of an `EditorView` after a
|
|
124
|
-
* period of inactivity (debounce), ensuring that multiple rapid updates do not occur in quick
|
|
125
|
-
* succession. It uses lodash's `debounce` to handle the debouncing.
|
|
126
|
-
*
|
|
127
|
-
* Memoization is crucial here to ensure that each `EditorView` instance has its own opportunity
|
|
128
|
-
* to update the node views. Without memoization, if you have multiple `EditorView` instances on
|
|
129
|
-
* the same page, only one instance would potentially call `view.setProps`, which could lead to
|
|
130
|
-
* incorrect or missing updates in other `EditorView` instances. By memoizing the debounced function,
|
|
131
|
-
* we ensure that each `EditorView` maintains its own debounced update logic.
|
|
132
|
-
*
|
|
133
|
-
* @param {CacheLoadedReactNodeViews} cache - A WeakMap that stores the loaded node views for each
|
|
134
|
-
* `EditorView`. The key is the `EditorView`, and the value is a record of node type names
|
|
135
|
-
* to their corresponding `NodeViewConstructor`.
|
|
136
|
-
* @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
|
|
137
|
-
* needs to be updated.
|
|
138
|
-
*
|
|
139
|
-
* This function is typically not called directly. Instead, it is invoked through `queueReplaceNodeViews`,
|
|
140
|
-
* which handles adding node views to the cache and triggering this debounced update.
|
|
141
|
-
*/
|
|
142
|
-
export const debouncedReplaceNodeviews = memoizeDebounce(replaceNodeViews, 0,
|
|
143
|
-
/**
|
|
144
|
-
* Use the default debounce options:
|
|
145
|
-
* {leading: false, trailing: true}
|
|
146
|
-
*/
|
|
147
|
-
undefined, (cache, view) => {
|
|
148
|
-
/**
|
|
149
|
-
* EditorView is a singleton.
|
|
150
|
-
* There is only one instance per Editor.
|
|
151
|
-
*/
|
|
152
|
-
return view;
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* 🧱 Internal: Editor FE Platform
|
|
157
|
-
*/
|
|
158
|
-
export const queueReplaceNodeViews = (view, {
|
|
159
|
-
nodeName,
|
|
160
|
-
nodeViewFunc
|
|
161
|
-
}) => {
|
|
162
|
-
const nodeViews = loadedPerEditorView.get(view) || {};
|
|
163
|
-
nodeViews[nodeName] = nodeViewFunc;
|
|
164
|
-
loadedPerEditorView.set(view, nodeViews);
|
|
165
|
-
debouncedReplaceNodeviews(loadedPerEditorView, view);
|
|
166
|
-
};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import debounce from 'lodash/debounce';
|
|
5
|
-
import memoize from 'lodash/memoize';
|
|
6
|
-
/**
|
|
7
|
-
* 🧱 Internal: Editor FE Platform
|
|
8
|
-
*/
|
|
9
|
-
var isFirefox = /gecko\/\d/i.test(navigator.userAgent);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 🧱 Internal: Editor FE Platform
|
|
13
|
-
*
|
|
14
|
-
* Replaces the node views in a ProseMirror editor with lazy-loaded node views.
|
|
15
|
-
*
|
|
16
|
-
* This function is used to update the `nodeViews` property of the `EditorView` after lazy-loaded
|
|
17
|
-
* node views have been loaded.
|
|
18
|
-
*
|
|
19
|
-
* The function checks if there are any loaded node views in the cache associated with the given
|
|
20
|
-
* `EditorView`. If there are, it replaces the current `nodeViews` in the `EditorView` with the
|
|
21
|
-
* loaded node views. The replacement is scheduled using `requestIdleCallback` or
|
|
22
|
-
* `requestAnimationFrame` to avoid blocking the main thread, especially in Firefox where
|
|
23
|
-
* `requestIdleCallback` may not be supported.
|
|
24
|
-
*
|
|
25
|
-
* @param {WeakMap<EditorView, Record<string, NodeViewConstructor>>} cache - A WeakMap that stores
|
|
26
|
-
* the loaded node views for each `EditorView`. The key is the `EditorView`, and the value
|
|
27
|
-
* is a record of node type names to their corresponding `NodeViewConstructor`.
|
|
28
|
-
* @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
|
|
29
|
-
* needs to be updated.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* const cache = new WeakMap();
|
|
33
|
-
* const view = new EditorView(...);
|
|
34
|
-
*
|
|
35
|
-
* // Assume some node views have been loaded and stored in the cache
|
|
36
|
-
* cache.set(view, {
|
|
37
|
-
* 'table': TableViewConstructor,
|
|
38
|
-
* 'tableCell': TableCellViewConstructor,
|
|
39
|
-
* });
|
|
40
|
-
*
|
|
41
|
-
* replaceNodeViews(cache, view);
|
|
42
|
-
*/
|
|
43
|
-
var replaceNodeViews = function replaceNodeViews(cache, view) {
|
|
44
|
-
var loadedNodeviews = cache.get(view);
|
|
45
|
-
if (!loadedNodeviews || Object.keys(loadedNodeviews).length === 0) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
var nodeViewsToReplace = _objectSpread({}, loadedNodeviews);
|
|
49
|
-
|
|
50
|
-
// Make sure the cache is cleaned
|
|
51
|
-
// From here, we will access the loaded node views by lexical scope
|
|
52
|
-
cache.set(view, {});
|
|
53
|
-
var callback = function callback() {
|
|
54
|
-
var currentNodeViews = view.props.nodeViews;
|
|
55
|
-
var nextNodeViews = _objectSpread(_objectSpread({}, currentNodeViews), nodeViewsToReplace);
|
|
56
|
-
view.setProps({
|
|
57
|
-
nodeViews: nextNodeViews
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
// eslint-disable-next-line compat/compat
|
|
61
|
-
var idle = window.requestIdleCallback;
|
|
62
|
-
|
|
63
|
-
/*
|
|
64
|
-
* For reasons that goes beyond my knowledge
|
|
65
|
-
* some Firefox versions aren't calling the requestIdleCallback.
|
|
66
|
-
*
|
|
67
|
-
* So, we need this check to make sure we are using the requestAnimationFrame for Firefox
|
|
68
|
-
*/
|
|
69
|
-
if (isFirefox || typeof idle !== 'function') {
|
|
70
|
-
window.requestAnimationFrame(callback);
|
|
71
|
-
} else {
|
|
72
|
-
idle(callback, {
|
|
73
|
-
timeout: 2000
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* 🧱 Internal: Editor FE Platform
|
|
80
|
-
*/
|
|
81
|
-
var loadedPerEditorView = new WeakMap();
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* 🧱 Internal: Editor FE Platform
|
|
85
|
-
* Based on https://github.com/lodash/lodash/issues/2403#issuecomment-1706130395
|
|
86
|
-
*
|
|
87
|
-
* Creates a debounced function that delays invoking the provided function until after a specified
|
|
88
|
-
* wait time has elapsed since the last time the debounced function was invoked. Additionally, the
|
|
89
|
-
* debounced function is memoized so that the same function instance is used for each unique set
|
|
90
|
-
* of arguments based on the resolver.
|
|
91
|
-
*
|
|
92
|
-
* This is particularly useful in scenarios where you want to debounce function calls while ensuring
|
|
93
|
-
* that each unique input combination receives its own debounced function instance. It's a combination
|
|
94
|
-
* of lodash's `debounce` and `memoize`.
|
|
95
|
-
*
|
|
96
|
-
* @template T
|
|
97
|
-
* @param {T} func - The function to debounce.
|
|
98
|
-
* @param {number} [wait=0] - The number of milliseconds to delay.
|
|
99
|
-
* @param {Object} [options] - The options object to pass to `debounce`.
|
|
100
|
-
* @param {Function} [resolver] - The function to resolve the cache key for memoization.
|
|
101
|
-
* @returns {Function} A new debounced and memoized function.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* const debouncedFunction = memoizeDebounce(myFunction, 300, { leading: true }, myResolver);
|
|
105
|
-
* debouncedFunction(arg1, arg2);
|
|
106
|
-
*/
|
|
107
|
-
function memoizeDebounce(func) {
|
|
108
|
-
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
109
|
-
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
110
|
-
var resolver = arguments.length > 3 ? arguments[3] : undefined;
|
|
111
|
-
var mem = memoize(function () {
|
|
112
|
-
return debounce(func, wait, options);
|
|
113
|
-
}, resolver);
|
|
114
|
-
return function () {
|
|
115
|
-
return mem.apply(void 0, arguments).apply(void 0, arguments);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* 🧱 Internal: Editor FE Platform
|
|
121
|
-
*
|
|
122
|
-
* Debounced and memoized version of `replaceNodeViews`.
|
|
123
|
-
*
|
|
124
|
-
* This function is designed to update the `nodeViews` property of an `EditorView` after a
|
|
125
|
-
* period of inactivity (debounce), ensuring that multiple rapid updates do not occur in quick
|
|
126
|
-
* succession. It uses lodash's `debounce` to handle the debouncing.
|
|
127
|
-
*
|
|
128
|
-
* Memoization is crucial here to ensure that each `EditorView` instance has its own opportunity
|
|
129
|
-
* to update the node views. Without memoization, if you have multiple `EditorView` instances on
|
|
130
|
-
* the same page, only one instance would potentially call `view.setProps`, which could lead to
|
|
131
|
-
* incorrect or missing updates in other `EditorView` instances. By memoizing the debounced function,
|
|
132
|
-
* we ensure that each `EditorView` maintains its own debounced update logic.
|
|
133
|
-
*
|
|
134
|
-
* @param {CacheLoadedReactNodeViews} cache - A WeakMap that stores the loaded node views for each
|
|
135
|
-
* `EditorView`. The key is the `EditorView`, and the value is a record of node type names
|
|
136
|
-
* to their corresponding `NodeViewConstructor`.
|
|
137
|
-
* @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
|
|
138
|
-
* needs to be updated.
|
|
139
|
-
*
|
|
140
|
-
* This function is typically not called directly. Instead, it is invoked through `queueReplaceNodeViews`,
|
|
141
|
-
* which handles adding node views to the cache and triggering this debounced update.
|
|
142
|
-
*/
|
|
143
|
-
export var debouncedReplaceNodeviews = memoizeDebounce(replaceNodeViews, 0,
|
|
144
|
-
/**
|
|
145
|
-
* Use the default debounce options:
|
|
146
|
-
* {leading: false, trailing: true}
|
|
147
|
-
*/
|
|
148
|
-
undefined, function (cache, view) {
|
|
149
|
-
/**
|
|
150
|
-
* EditorView is a singleton.
|
|
151
|
-
* There is only one instance per Editor.
|
|
152
|
-
*/
|
|
153
|
-
return view;
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* 🧱 Internal: Editor FE Platform
|
|
158
|
-
*/
|
|
159
|
-
export var queueReplaceNodeViews = function queueReplaceNodeViews(view, _ref) {
|
|
160
|
-
var nodeName = _ref.nodeName,
|
|
161
|
-
nodeViewFunc = _ref.nodeViewFunc;
|
|
162
|
-
var nodeViews = loadedPerEditorView.get(view) || {};
|
|
163
|
-
nodeViews[nodeName] = nodeViewFunc;
|
|
164
|
-
loadedPerEditorView.set(view, nodeViews);
|
|
165
|
-
debouncedReplaceNodeviews(loadedPerEditorView, view);
|
|
166
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import type { CacheLoadedReactNodeViews, NodeViewConstructor } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* 🧱 Internal: Editor FE Platform
|
|
5
|
-
*
|
|
6
|
-
* Debounced and memoized version of `replaceNodeViews`.
|
|
7
|
-
*
|
|
8
|
-
* This function is designed to update the `nodeViews` property of an `EditorView` after a
|
|
9
|
-
* period of inactivity (debounce), ensuring that multiple rapid updates do not occur in quick
|
|
10
|
-
* succession. It uses lodash's `debounce` to handle the debouncing.
|
|
11
|
-
*
|
|
12
|
-
* Memoization is crucial here to ensure that each `EditorView` instance has its own opportunity
|
|
13
|
-
* to update the node views. Without memoization, if you have multiple `EditorView` instances on
|
|
14
|
-
* the same page, only one instance would potentially call `view.setProps`, which could lead to
|
|
15
|
-
* incorrect or missing updates in other `EditorView` instances. By memoizing the debounced function,
|
|
16
|
-
* we ensure that each `EditorView` maintains its own debounced update logic.
|
|
17
|
-
*
|
|
18
|
-
* @param {CacheLoadedReactNodeViews} cache - A WeakMap that stores the loaded node views for each
|
|
19
|
-
* `EditorView`. The key is the `EditorView`, and the value is a record of node type names
|
|
20
|
-
* to their corresponding `NodeViewConstructor`.
|
|
21
|
-
* @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
|
|
22
|
-
* needs to be updated.
|
|
23
|
-
*
|
|
24
|
-
* This function is typically not called directly. Instead, it is invoked through `queueReplaceNodeViews`,
|
|
25
|
-
* which handles adding node views to the cache and triggering this debounced update.
|
|
26
|
-
*/
|
|
27
|
-
export declare const debouncedReplaceNodeviews: (cache: CacheLoadedReactNodeViews, view: EditorView) => void | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* 🧱 Internal: Editor FE Platform
|
|
30
|
-
*/
|
|
31
|
-
export declare const queueReplaceNodeViews: (view: EditorView, { nodeName, nodeViewFunc }: {
|
|
32
|
-
nodeName: string;
|
|
33
|
-
nodeViewFunc: NodeViewConstructor;
|
|
34
|
-
}) => void;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import type { CacheLoadedReactNodeViews, NodeViewConstructor } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* 🧱 Internal: Editor FE Platform
|
|
5
|
-
*
|
|
6
|
-
* Debounced and memoized version of `replaceNodeViews`.
|
|
7
|
-
*
|
|
8
|
-
* This function is designed to update the `nodeViews` property of an `EditorView` after a
|
|
9
|
-
* period of inactivity (debounce), ensuring that multiple rapid updates do not occur in quick
|
|
10
|
-
* succession. It uses lodash's `debounce` to handle the debouncing.
|
|
11
|
-
*
|
|
12
|
-
* Memoization is crucial here to ensure that each `EditorView` instance has its own opportunity
|
|
13
|
-
* to update the node views. Without memoization, if you have multiple `EditorView` instances on
|
|
14
|
-
* the same page, only one instance would potentially call `view.setProps`, which could lead to
|
|
15
|
-
* incorrect or missing updates in other `EditorView` instances. By memoizing the debounced function,
|
|
16
|
-
* we ensure that each `EditorView` maintains its own debounced update logic.
|
|
17
|
-
*
|
|
18
|
-
* @param {CacheLoadedReactNodeViews} cache - A WeakMap that stores the loaded node views for each
|
|
19
|
-
* `EditorView`. The key is the `EditorView`, and the value is a record of node type names
|
|
20
|
-
* to their corresponding `NodeViewConstructor`.
|
|
21
|
-
* @param {EditorView} view - The ProseMirror `EditorView` instance whose `nodeViews` property
|
|
22
|
-
* needs to be updated.
|
|
23
|
-
*
|
|
24
|
-
* This function is typically not called directly. Instead, it is invoked through `queueReplaceNodeViews`,
|
|
25
|
-
* which handles adding node views to the cache and triggering this debounced update.
|
|
26
|
-
*/
|
|
27
|
-
export declare const debouncedReplaceNodeviews: (cache: CacheLoadedReactNodeViews, view: EditorView) => void | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* 🧱 Internal: Editor FE Platform
|
|
30
|
-
*/
|
|
31
|
-
export declare const queueReplaceNodeViews: (view: EditorView, { nodeName, nodeViewFunc }: {
|
|
32
|
-
nodeName: string;
|
|
33
|
-
nodeViewFunc: NodeViewConstructor;
|
|
34
|
-
}) => void;
|