@atlaskit/editor-common 111.16.1 → 111.16.4

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/afm-cc/tsconfig.json +0 -1
  3. package/afm-jira/tsconfig.json +0 -1
  4. package/afm-products/tsconfig.json +0 -1
  5. package/dist/cjs/messages/syncBlock.js +10 -0
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/performance-ssr-measures/RenderMarker.js +16 -0
  8. package/dist/cjs/performance-ssr-measures/SSRRenderMeasure.js +90 -0
  9. package/dist/cjs/performance-ssr-measures/index.js +19 -0
  10. package/dist/cjs/performance-ssr-measures/profileSSROperation.js +65 -0
  11. package/dist/cjs/provider-helpers/combine-providers.js +10 -1
  12. package/dist/cjs/styles/shared/table.js +1 -1
  13. package/dist/cjs/ui/DropList/index.js +1 -1
  14. package/dist/cjs/utils/index.js +6 -0
  15. package/dist/cjs/utils/performance/navigation.js +11 -0
  16. package/dist/es2019/messages/syncBlock.js +10 -0
  17. package/dist/es2019/monitoring/error.js +1 -1
  18. package/dist/es2019/performance-ssr-measures/RenderMarker.js +11 -0
  19. package/dist/es2019/performance-ssr-measures/SSRRenderMeasure.js +85 -0
  20. package/dist/es2019/performance-ssr-measures/index.js +5 -0
  21. package/dist/es2019/performance-ssr-measures/profileSSROperation.js +59 -0
  22. package/dist/es2019/provider-helpers/combine-providers.js +6 -1
  23. package/dist/es2019/styles/shared/table.js +4 -1
  24. package/dist/es2019/ui/DropList/index.js +1 -1
  25. package/dist/es2019/utils/index.js +1 -1
  26. package/dist/es2019/utils/performance/navigation.js +10 -0
  27. package/dist/esm/messages/syncBlock.js +10 -0
  28. package/dist/esm/monitoring/error.js +1 -1
  29. package/dist/esm/performance-ssr-measures/RenderMarker.js +10 -0
  30. package/dist/esm/performance-ssr-measures/SSRRenderMeasure.js +83 -0
  31. package/dist/esm/performance-ssr-measures/index.js +5 -0
  32. package/dist/esm/performance-ssr-measures/profileSSROperation.js +59 -0
  33. package/dist/esm/provider-helpers/combine-providers.js +10 -1
  34. package/dist/esm/styles/shared/table.js +1 -1
  35. package/dist/esm/ui/DropList/index.js +1 -1
  36. package/dist/esm/utils/index.js +1 -1
  37. package/dist/esm/utils/performance/navigation.js +10 -0
  38. package/dist/types/analytics/types/block-menu-events.d.ts +1 -2
  39. package/dist/types/messages/syncBlock.d.ts +10 -0
  40. package/dist/types/performance-ssr-measures/RenderMarker.d.ts +5 -0
  41. package/dist/types/performance-ssr-measures/SSRRenderMeasure.d.ts +114 -0
  42. package/dist/types/performance-ssr-measures/index.d.ts +2 -0
  43. package/dist/types/performance-ssr-measures/profileSSROperation.d.ts +43 -0
  44. package/dist/types/utils/index.d.ts +1 -1
  45. package/dist/types/utils/performance/navigation.d.ts +1 -0
  46. package/dist/types-ts4.5/analytics/types/block-menu-events.d.ts +1 -2
  47. package/dist/types-ts4.5/messages/syncBlock.d.ts +10 -0
  48. package/dist/types-ts4.5/performance-ssr-measures/RenderMarker.d.ts +5 -0
  49. package/dist/types-ts4.5/performance-ssr-measures/SSRRenderMeasure.d.ts +114 -0
  50. package/dist/types-ts4.5/performance-ssr-measures/index.d.ts +2 -0
  51. package/dist/types-ts4.5/performance-ssr-measures/profileSSROperation.d.ts +43 -0
  52. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  53. package/dist/types-ts4.5/utils/performance/navigation.d.ts +1 -0
  54. package/package.json +7 -4
  55. package/performance/ssr-measures/package.json +17 -0
@@ -0,0 +1,114 @@
1
+ import React, { type ReactNode } from 'react';
2
+ /**
3
+ * Props for SSRRenderMeasure component
4
+ */
5
+ interface SSRRenderMeasureProps {
6
+ children?: ReactNode;
7
+ /**
8
+ * Callback invoked during Server-Side Rendering (SSR) to measure and track performance metrics.
9
+ * Provides timing information for the render duration of the measured component.
10
+ *
11
+ * @param measure.segmentName - Name identifier of the measured segment
12
+ * @param measure.startTimestamp - Absolute timestamp when rendering started (from `performance.now()`)
13
+ * @param measure.endTimestamp - Absolute timestamp when rendering completed (from `performance.now()`)
14
+ *
15
+ * **Note:** Both timestamps are absolute values from `performance.now()`, not relative times.
16
+ * Calculate duration as: `measure.endTimestamp - measure.startTimestamp`
17
+ *
18
+ * Optional - if not provided, the component renders without measurement.
19
+ */
20
+ onSSRMeasure?: (measure: {
21
+ endTimestamp: number;
22
+ segmentName: string;
23
+ startTimestamp: number;
24
+ }) => void;
25
+ /**
26
+ * The name identifier of the component being measured for tracing.
27
+ *
28
+ * @example 'ssr-app/render/fullPageEditor'
29
+ */
30
+ segmentName: string;
31
+ /**
32
+ * Reference to the start timestamp of the component render.
33
+ *
34
+ * **CRITICAL:** Must be created using `useRef(performance.now())` as the **first line**
35
+ * in the component being profiled to capture the most accurate start time.
36
+ *
37
+ * Using a ref (instead of state or regular variable) is essential to:
38
+ * - Avoid triggering re-renders
39
+ * - Preserve the initial timestamp across component lifecycle
40
+ * - Ensure measurement accuracy
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * function MyComponent() {
45
+ * const startTimestampRef = useRef(performance.now()); // MUST be first line
46
+ * // ...rest of component logic
47
+ *
48
+ * return (
49
+ * <SSRRenderMeasure
50
+ * segmentName="ssr-app/render/myComponent"
51
+ * startTimestampRef={startTimestampRef}
52
+ * onSSRMeasure={handleMeasure}
53
+ * >
54
+ * {content}
55
+ * </SSRRenderMeasure>
56
+ * );
57
+ * }
58
+ * ```
59
+ */
60
+ startTimestampRef: {
61
+ current: number;
62
+ };
63
+ }
64
+ declare function SSRRenderMeasureImpl({ onSSRMeasure, segmentName, startTimestampRef, children, }: SSRRenderMeasureProps): React.JSX.Element;
65
+ /**
66
+ * Component for measuring render performance during Server-Side Rendering (SSR).
67
+ *
68
+ * This component wraps content to measure its render duration in SSR mode.
69
+ * On client builds, it's optimized to a no-op component with zero performance overhead.
70
+ * On SSR builds, it captures timing data and reports it via the `onSSRMeasure` callback.
71
+ *
72
+ * **How it works:**
73
+ * - Measures from `startTimestampRef.current` (component start) to when `RenderMarker` is rendered
74
+ * - Uses `RenderMarker` to detect when the render completes successfully
75
+ * - Only reports the measurement once (protected by `wasMeasured` ref)
76
+ * - If child components throw errors during render, the measurement will not be reported
77
+ *
78
+ * **Usage pattern:**
79
+ * 1. Create `startTimestampRef` as the **first line** in your component using `useRef(performance.now())`
80
+ * 2. Wrap your content with `SSRRenderMeasure` at the end of your component
81
+ * 3. Provide the `onSSRMeasure` callback to receive timing data
82
+ *
83
+ * @example
84
+ * ```tsx
85
+ * function FullPageEditor({ onSSRMeasure }) {
86
+ * // CRITICAL: Must be the first line for accurate timing
87
+ * const startTimestampRef = useRef(performance.now());
88
+ *
89
+ * // ...component logic, hooks, etc.
90
+ *
91
+ * return (
92
+ * <SSRRenderMeasure
93
+ * segmentName="ssr-app/render/fullPageEditor"
94
+ * startTimestampRef={startTimestampRef}
95
+ * onSSRMeasure={onSSRMeasure}
96
+ * >
97
+ * <EditorContent />
98
+ * </SSRRenderMeasure>
99
+ * );
100
+ * }
101
+ * ```
102
+ *
103
+ * @example
104
+ * ```tsx
105
+ * // Handling the measurement callback
106
+ * const handleSSRMeasure = (measure) => {
107
+ * const duration = measure.endTimestamp - measure.startTimestamp;
108
+ * console.log(`${measure.segmentName} rendered in ${duration}ms`);
109
+ * // Send to analytics, logging, etc.
110
+ * };
111
+ * ```
112
+ */
113
+ export declare const SSRRenderMeasure: React.MemoExoticComponent<({ children }: SSRRenderMeasureProps) => React.ReactNode> | typeof SSRRenderMeasureImpl;
114
+ export {};
@@ -0,0 +1,2 @@
1
+ export { SSRRenderMeasure } from './SSRRenderMeasure';
2
+ export { profileSSROperation } from './profileSSROperation';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Profiles a synchronous operation during Server-Side Rendering (SSR).
3
+ *
4
+ * This function wraps an operation to measure its execution time in SSR mode.
5
+ * On client builds, the profiling is optimized away and the function executes normally.
6
+ * On SSR builds, it captures timing data using `performance.now()` and reports it via the callback.
7
+ *
8
+ * **Important notes:**
9
+ * - Profiling only occurs in SSR mode when `onSSRMeasure` is provided
10
+ * - Both `startTimestamp` and `endTimestamp` are absolute values from `performance.now()`, not relative times
11
+ * - Calculate duration as: `endTimestamp - startTimestamp`
12
+ * - The measurement is guaranteed to be reported even if the function throws an error (via `finally` block)
13
+ * - On client builds, this function has zero performance overhead
14
+ *
15
+ * @param segmentName - Identifier for the operation being measured (e.g., 'ssr-app/render/editor/createSchema')
16
+ * @param fn - The synchronous function to execute and profile
17
+ * @param onSSRMeasure - Optional callback to receive performance measurements
18
+ * @param onSSRMeasure.segmentName - Name of the measured segment
19
+ * @param onSSRMeasure.startTimestamp - Absolute timestamp when the operation started (from `performance.now()`)
20
+ * @param onSSRMeasure.endTimestamp - Absolute timestamp when the operation completed (from `performance.now()`)
21
+ *
22
+ * @returns The result of the executed function
23
+ *
24
+ * @example
25
+ * // Profile schema creation during SSR
26
+ * const schema = profileSSROperation(
27
+ * 'ssr-app/render/editor/createSchema',
28
+ * () => createSchema(config),
29
+ * (measure) => {
30
+ * const duration = measure.endTimestamp - measure.startTimestamp;
31
+ * console.log(`${measure.segmentName}: ${duration}ms`);
32
+ * }
33
+ * );
34
+ *
35
+ * @example
36
+ * // Without callback, executes normally
37
+ * const result = profileSSROperation('operation', () => expensiveCalculation());
38
+ */
39
+ export declare const profileSSROperation: <T>(segmentName: string, fn: () => T, onSSRMeasure?: (measure: {
40
+ endTimestamp: number;
41
+ segmentName: string;
42
+ startTimestamp: number;
43
+ }) => void) => T;
@@ -126,7 +126,7 @@ export { isPerformanceAPIAvailable, isPerformanceObserverAvailable, } from './pe
126
126
  *
127
127
  * Private API - should not be used. Use `@atlaskit/editor-common/performance/navigation` if required.
128
128
  */
129
- export { getResponseEndTime } from './performance/navigation';
129
+ export { getRequestToResponseTime, getResponseEndTime } from './performance/navigation';
130
130
  export { getExtensionRenderer } from './extension-handler';
131
131
  export { hasMergedCell, getColumnWidths, calcTableColumnWidths, convertProsemirrorTableNodeToArrayOfRows, isPositionNearTableRow, } from './table';
132
132
  export { createCompareNodes } from './compareNodes';
@@ -1 +1,2 @@
1
1
  export declare function getResponseEndTime(): number | undefined;
2
+ export declare function getRequestToResponseTime(): number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "111.16.1",
3
+ "version": "111.16.4",
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/"
@@ -70,18 +70,18 @@
70
70
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
71
71
  "@atlaskit/popper": "^7.1.0",
72
72
  "@atlaskit/primitives": "^18.0.0",
73
- "@atlaskit/profilecard": "^24.36.0",
73
+ "@atlaskit/profilecard": "^24.37.0",
74
74
  "@atlaskit/prosemirror-history": "^0.2.0",
75
75
  "@atlaskit/react-ufo": "^5.2.0",
76
76
  "@atlaskit/section-message": "^8.12.0",
77
- "@atlaskit/smart-card": "^43.24.0",
77
+ "@atlaskit/smart-card": "^43.25.0",
78
78
  "@atlaskit/smart-user-picker": "^9.0.0",
79
79
  "@atlaskit/spinner": "^19.0.0",
80
80
  "@atlaskit/status": "^3.1.0",
81
81
  "@atlaskit/task-decision": "^19.2.0",
82
82
  "@atlaskit/textfield": "^8.2.0",
83
83
  "@atlaskit/theme": "^21.0.0",
84
- "@atlaskit/tmp-editor-statsig": "^25.7.0",
84
+ "@atlaskit/tmp-editor-statsig": "^27.1.0",
85
85
  "@atlaskit/tokens": "^11.0.0",
86
86
  "@atlaskit/tooltip": "^20.14.0",
87
87
  "@atlaskit/width-detector": "^5.0.0",
@@ -222,6 +222,9 @@
222
222
  "platform_editor_fix_unsubscribe_of_provider": {
223
223
  "type": "boolean"
224
224
  },
225
+ "platform_editor_fix_getautoconverter_null_error": {
226
+ "type": "boolean"
227
+ },
225
228
  "platform_editor_legacy_content_macro_visual_update": {
226
229
  "type": "boolean"
227
230
  },
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/performance/ssr-measures",
3
+ "main": "../../dist/cjs/performance-ssr-measures/index.js",
4
+ "module": "../../dist/esm/performance-ssr-measures/index.js",
5
+ "module:es2019": "../../dist/es2019/performance-ssr-measures/index.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/performance-ssr-measures/index.d.ts",
10
+ "typesVersions": {
11
+ ">=4.5 <5.9": {
12
+ "*": [
13
+ "../../dist/types-ts4.5/performance-ssr-measures/index.d.ts"
14
+ ]
15
+ }
16
+ }
17
+ }