@atlaskit/renderer 148.0.2 → 148.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 148.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b50791096b149`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b50791096b149) -
8
+ Reduce built-in paragraph serializer props allocation behind
9
+ platform_renderer_paragraph_props_fast_path.
10
+ - Updated dependencies
11
+
12
+ ## 148.0.3
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 148.0.2
4
19
 
5
20
  ### Patch Changes
@@ -66,6 +66,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
66
66
  (0, _defineProperty2.default)(this, "allowCustomPanels", false);
67
67
  (0, _defineProperty2.default)(this, "surroundTextNodesWithTextWrapper", false);
68
68
  (0, _defineProperty2.default)(this, "textFastPath", false);
69
+ (0, _defineProperty2.default)(this, "paragraphPropsFastPath", false);
69
70
  (0, _defineProperty2.default)(this, "allowAnnotations", false);
70
71
  (0, _defineProperty2.default)(this, "standaloneBackgroundColorMarks", []);
71
72
  (0, _defineProperty2.default)(this, "inlinePositions", new Set());
@@ -210,6 +211,7 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
210
211
  this.allowAnnotations = Boolean(init.allowAnnotations);
211
212
  this.surroundTextNodesWithTextWrapper = Boolean(init.surroundTextNodesWithTextWrapper);
212
213
  this.textFastPath = (0, _expVal.expVal)('platform_renderer_text_paragraph_fast_path', 'isEnabled', false);
214
+ this.paragraphPropsFastPath = (0, _expVal.expVal)('platform_renderer_paragraph_props_fast_path', 'isEnabled', false);
213
215
  this.media = init.media;
214
216
  this.mentionNodeDataProvider = init.mentionNodeDataProvider;
215
217
  this.emojiProviderLookupOrder = init.emojiProviderLookupOrder;
@@ -243,6 +245,12 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
243
245
  value: function getNodeProps(node, parentInfo) {
244
246
  var path = parentInfo ? parentInfo.path : undefined;
245
247
  switch (node.type.name) {
248
+ case 'paragraph':
249
+ // Explicit paragraph overrides retain the full generic props contract.
250
+ if (this.paragraphPropsFastPath && (!this.nodeComponents || !Object.prototype.hasOwnProperty.call(this.nodeComponents, 'paragraph'))) {
251
+ return this.getParagraphProps(node, path);
252
+ }
253
+ return this.getProps(node, path);
246
254
  case 'date':
247
255
  return this.getDateProps(node, parentInfo, path);
248
256
  case 'hardBreak':
@@ -661,6 +669,25 @@ var ReactSerializer = exports.default = /*#__PURE__*/function () {
661
669
  allowCustomPanels: this.allowCustomPanels
662
670
  });
663
671
  }
672
+ }, {
673
+ key: "getParagraphProps",
674
+ value: function getParagraphProps(node) {
675
+ var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
676
+ var startPos = this.startPos + path.length;
677
+
678
+ // Keep traversal metadata for serializer subclasses without allocating unused content getters.
679
+ return _objectSpread({
680
+ asInline: this.inlinePositions.has(startPos) ? 'on' : undefined,
681
+ plainTextFastPath: this.textFastPath,
682
+ nodeType: node.type.name,
683
+ marks: node.marks,
684
+ dataAttributes: {
685
+ 'data-renderer-start-pos': startPos
686
+ },
687
+ startPos: startPos,
688
+ path: path
689
+ }, node.attrs);
690
+ }
664
691
  }, {
665
692
  key: "getProps",
666
693
  value: function getProps(node) {
@@ -72,7 +72,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
72
72
  var TABLE_INFO_TIMEOUT = 10000;
73
73
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
74
74
  var packageName = "@atlaskit/renderer";
75
- var packageVersion = "148.0.1";
75
+ var packageVersion = "148.0.3";
76
76
  var setAsQueryContainerStyles = (0, _react2.css)({
77
77
  containerName: 'ak-renderer-wrapper',
78
78
  containerType: 'inline-size'
@@ -50,6 +50,7 @@ export default class ReactSerializer {
50
50
  _defineProperty(this, "allowCustomPanels", false);
51
51
  _defineProperty(this, "surroundTextNodesWithTextWrapper", false);
52
52
  _defineProperty(this, "textFastPath", false);
53
+ _defineProperty(this, "paragraphPropsFastPath", false);
53
54
  _defineProperty(this, "allowAnnotations", false);
54
55
  _defineProperty(this, "standaloneBackgroundColorMarks", []);
55
56
  _defineProperty(this, "inlinePositions", new Set());
@@ -197,6 +198,7 @@ export default class ReactSerializer {
197
198
  this.allowAnnotations = Boolean(init.allowAnnotations);
198
199
  this.surroundTextNodesWithTextWrapper = Boolean(init.surroundTextNodesWithTextWrapper);
199
200
  this.textFastPath = expVal('platform_renderer_text_paragraph_fast_path', 'isEnabled', false);
201
+ this.paragraphPropsFastPath = expVal('platform_renderer_paragraph_props_fast_path', 'isEnabled', false);
200
202
  this.media = init.media;
201
203
  this.mentionNodeDataProvider = init.mentionNodeDataProvider;
202
204
  this.emojiProviderLookupOrder = init.emojiProviderLookupOrder;
@@ -226,6 +228,12 @@ export default class ReactSerializer {
226
228
  getNodeProps(node, parentInfo) {
227
229
  const path = parentInfo ? parentInfo.path : undefined;
228
230
  switch (node.type.name) {
231
+ case 'paragraph':
232
+ // Explicit paragraph overrides retain the full generic props contract.
233
+ if (this.paragraphPropsFastPath && (!this.nodeComponents || !Object.prototype.hasOwnProperty.call(this.nodeComponents, 'paragraph'))) {
234
+ return this.getParagraphProps(node, path);
235
+ }
236
+ return this.getProps(node, path);
229
237
  case 'date':
230
238
  return this.getDateProps(node, parentInfo, path);
231
239
  case 'hardBreak':
@@ -590,6 +598,23 @@ export default class ReactSerializer {
590
598
  allowCustomPanels: this.allowCustomPanels
591
599
  };
592
600
  }
601
+ getParagraphProps(node, path = []) {
602
+ const startPos = this.startPos + path.length;
603
+
604
+ // Keep traversal metadata for serializer subclasses without allocating unused content getters.
605
+ return {
606
+ asInline: this.inlinePositions.has(startPos) ? 'on' : undefined,
607
+ plainTextFastPath: this.textFastPath,
608
+ nodeType: node.type.name,
609
+ marks: node.marks,
610
+ dataAttributes: {
611
+ 'data-renderer-start-pos': startPos
612
+ },
613
+ startPos,
614
+ path,
615
+ ...node.attrs
616
+ };
617
+ }
593
618
  getProps(node, path = []) {
594
619
  const startPos = this.startPos + path.length;
595
620
  return {
@@ -57,7 +57,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
57
57
  const TABLE_INFO_TIMEOUT = 10000;
58
58
  const RENDER_EVENT_SAMPLE_RATE = 0.1;
59
59
  const packageName = "@atlaskit/renderer";
60
- const packageVersion = "148.0.1";
60
+ const packageVersion = "148.0.3";
61
61
  const setAsQueryContainerStyles = css({
62
62
  containerName: 'ak-renderer-wrapper',
63
63
  containerType: 'inline-size'
@@ -59,6 +59,7 @@ var ReactSerializer = /*#__PURE__*/function () {
59
59
  _defineProperty(this, "allowCustomPanels", false);
60
60
  _defineProperty(this, "surroundTextNodesWithTextWrapper", false);
61
61
  _defineProperty(this, "textFastPath", false);
62
+ _defineProperty(this, "paragraphPropsFastPath", false);
62
63
  _defineProperty(this, "allowAnnotations", false);
63
64
  _defineProperty(this, "standaloneBackgroundColorMarks", []);
64
65
  _defineProperty(this, "inlinePositions", new Set());
@@ -203,6 +204,7 @@ var ReactSerializer = /*#__PURE__*/function () {
203
204
  this.allowAnnotations = Boolean(init.allowAnnotations);
204
205
  this.surroundTextNodesWithTextWrapper = Boolean(init.surroundTextNodesWithTextWrapper);
205
206
  this.textFastPath = expVal('platform_renderer_text_paragraph_fast_path', 'isEnabled', false);
207
+ this.paragraphPropsFastPath = expVal('platform_renderer_paragraph_props_fast_path', 'isEnabled', false);
206
208
  this.media = init.media;
207
209
  this.mentionNodeDataProvider = init.mentionNodeDataProvider;
208
210
  this.emojiProviderLookupOrder = init.emojiProviderLookupOrder;
@@ -236,6 +238,12 @@ var ReactSerializer = /*#__PURE__*/function () {
236
238
  value: function getNodeProps(node, parentInfo) {
237
239
  var path = parentInfo ? parentInfo.path : undefined;
238
240
  switch (node.type.name) {
241
+ case 'paragraph':
242
+ // Explicit paragraph overrides retain the full generic props contract.
243
+ if (this.paragraphPropsFastPath && (!this.nodeComponents || !Object.prototype.hasOwnProperty.call(this.nodeComponents, 'paragraph'))) {
244
+ return this.getParagraphProps(node, path);
245
+ }
246
+ return this.getProps(node, path);
239
247
  case 'date':
240
248
  return this.getDateProps(node, parentInfo, path);
241
249
  case 'hardBreak':
@@ -654,6 +662,25 @@ var ReactSerializer = /*#__PURE__*/function () {
654
662
  allowCustomPanels: this.allowCustomPanels
655
663
  });
656
664
  }
665
+ }, {
666
+ key: "getParagraphProps",
667
+ value: function getParagraphProps(node) {
668
+ var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
669
+ var startPos = this.startPos + path.length;
670
+
671
+ // Keep traversal metadata for serializer subclasses without allocating unused content getters.
672
+ return _objectSpread({
673
+ asInline: this.inlinePositions.has(startPos) ? 'on' : undefined,
674
+ plainTextFastPath: this.textFastPath,
675
+ nodeType: node.type.name,
676
+ marks: node.marks,
677
+ dataAttributes: {
678
+ 'data-renderer-start-pos': startPos
679
+ },
680
+ startPos: startPos,
681
+ path: path
682
+ }, node.attrs);
683
+ }
657
684
  }, {
658
685
  key: "getProps",
659
686
  value: function getProps(node) {
@@ -62,7 +62,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
62
62
  var TABLE_INFO_TIMEOUT = 10000;
63
63
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
64
64
  var packageName = "@atlaskit/renderer";
65
- var packageVersion = "148.0.1";
65
+ var packageVersion = "148.0.3";
66
66
  var setAsQueryContainerStyles = css({
67
67
  containerName: 'ak-renderer-wrapper',
68
68
  containerType: 'inline-size'
@@ -105,6 +105,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
105
105
  private startPos;
106
106
  private surroundTextNodesWithTextWrapper;
107
107
  private textFastPath;
108
+ private paragraphPropsFastPath;
108
109
  private media?;
109
110
  private mentionNodeDataProvider?;
110
111
  private emojiProviderLookupOrder?;
@@ -156,6 +157,7 @@ export default class ReactSerializer implements Serializer<JSX.Element> {
156
157
  private getCodeBlockProps;
157
158
  private getPanelProps;
158
159
  private getUnsupportedContentProps;
160
+ private getParagraphProps;
159
161
  private getProps;
160
162
  private headingAnchorSupported;
161
163
  private getHeadingProps;
@@ -58,6 +58,11 @@ export interface NodeMeta {
58
58
  serializer: Serializer<JSX.Element>;
59
59
  text?: PMNode['text'];
60
60
  }
61
+ /** Internal metadata for built-in paragraphs; custom node components still receive NodeMeta. */
62
+ export type ParagraphMeta = Pick<NodeMeta, 'asInline' | 'plainTextFastPath' | 'dataAttributes' | 'nodeType' | 'marks'> & {
63
+ path: PMNode[];
64
+ startPos: number;
65
+ };
61
66
  export interface MarkMeta {
62
67
  [key: string]: any;
63
68
  dataAttributes: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "148.0.2",
3
+ "version": "148.0.4",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/afm-i18n-platform-editor-renderer": "2.270.0",
39
39
  "@atlaskit/analytics-listeners": "^11.4.0",
40
40
  "@atlaskit/analytics-namespaced-context": "^8.2.0",
41
- "@atlaskit/analytics-next": "^12.5.0",
41
+ "@atlaskit/analytics-next": "^12.6.0",
42
42
  "@atlaskit/browser-apis": "^1.2.0",
43
43
  "@atlaskit/button": "^25.4.0",
44
44
  "@atlaskit/code": "^20.0.0",
@@ -73,7 +73,7 @@
73
73
  "@atlaskit/status": "^5.13.0",
74
74
  "@atlaskit/task-decision": "^21.12.0",
75
75
  "@atlaskit/theme": "^28.2.0",
76
- "@atlaskit/tmp-editor-statsig": "^225.0.0",
76
+ "@atlaskit/tmp-editor-statsig": "^226.0.0",
77
77
  "@atlaskit/tokens": "^20.3.0",
78
78
  "@atlaskit/tooltip": "^24.4.0",
79
79
  "@atlaskit/visually-hidden": "^4.4.0",