@atlaskit/renderer 130.2.4 → 130.2.6

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,22 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 130.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`01bfb2823034b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/01bfb2823034b) -
8
+ Expands automatic accessibility (a11y) Playwright test coverage for Platform
9
+ - Updated dependencies
10
+
11
+ ## 130.2.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`c896b4d6c83a3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c896b4d6c83a3) -
16
+ Fix table column widths being scaled to viewport on first client render in synced blocks by keying
17
+ off renderWidthProp alone instead of contextWidth
18
+ - Updated dependencies
19
+
3
20
  ## 130.2.4
4
21
 
5
22
  ### Patch Changes
@@ -139,9 +139,13 @@ var renderSyncBlockColgroup = function renderSyncBlockColgroup(_ref3) {
139
139
  return null;
140
140
  }
141
141
 
142
- // SSR / first render before WidthContext measures. Output % of original ADF proportions so
143
- // columns are stable — the CSS container query (100cqw) handles actual scaling width.
144
- if (contextWidth <= 0 && renderWidthProp <= 0) {
142
+ // SSR / first client render before WidthObserver measures. Output % of original ADF
143
+ // proportions so columns are stable — the CSS container query (100cqw) handles actual
144
+ // scaling width. We key off renderWidthProp alone because WidthProvider initialises with
145
+ // document.body.offsetWidth (non-zero on the client), so contextWidth > 0 even before
146
+ // WidthObserver has measured the real container, which would skip this branch and produce
147
+ // column widths scaled to the full viewport.
148
+ if (renderWidthProp <= 0) {
145
149
  var fullTableWidth = isNumberColumnEnabled ? rawTotalWidth + _editorSharedStyles.akEditorTableNumberColumnWidth : rawTotalWidth;
146
150
  return columnWidths.map(function (colWidth) {
147
151
  return {
@@ -154,7 +158,29 @@ var renderSyncBlockColgroup = function renderSyncBlockColgroup(_ref3) {
154
158
  // getParentNodeWidth() border offset. Fall back to renderWidthProp for the non-CSS path.
155
159
  var effectiveRenderWidth = contextWidth > 0 ? contextWidth - 2 : renderWidthProp;
156
160
  var availableWidth = getDataColumnWidth(effectiveRenderWidth, isNumberColumnEnabled);
157
- return scaleColumnsToWidth(columnWidths, availableWidth);
161
+
162
+ // Only scale down if the table is actually wider than the available space.
163
+ // If the table fits, return original widths with the same tableCellBorderWidth (2px) adjustment
164
+ // that renderScaleDownColgroup applies via fixColumnWidth's no-scale path.
165
+ if (availableWidth >= rawTotalWidth) {
166
+ return columnWidths.map(function (colWidth) {
167
+ return {
168
+ width: "".concat(Math.max(colWidth - _styles.tableCellBorderWidth, _styles.tableCellMinWidth), "px")
169
+ };
170
+ });
171
+ }
172
+
173
+ // Cap scaling at MAX_SCALING_PERCENT (30%), matching renderScaleDownColgroup's calcScalePercent.
174
+ //
175
+ // Both `availableWidth` and `rawTotalWidth` are already in data-column space (number column
176
+ // excluded via getDataColumnWidth), so `diffPercent = 1 - availableWidth / rawTotalWidth` is
177
+ // equivalent to calcScalePercent's `numColumnScalePercent` path when isNumberColumnEnabled,
178
+ // and to the `noNumColumnScalePercent` path otherwise. We express the cap as a target width
179
+ // (clampedAvailableWidth) rather than a scale-down percentage, but the result is the same:
180
+ // columns are scaled by at most MAX_SCALING_PERCENT (30%).
181
+ var diffPercent = 1 - availableWidth / rawTotalWidth;
182
+ var clampedAvailableWidth = diffPercent <= MAX_SCALING_PERCENT ? availableWidth : Math.floor(rawTotalWidth * (1 - MAX_SCALING_PERCENT));
183
+ return scaleColumnsToWidth(columnWidths, clampedAvailableWidth);
158
184
  };
159
185
  var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
160
186
  var _props$tableNode;
@@ -71,7 +71,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
71
71
  var TABLE_INFO_TIMEOUT = 10000;
72
72
  var RENDER_EVENT_SAMPLE_RATE = 0.2;
73
73
  var packageName = "@atlaskit/renderer";
74
- var packageVersion = "130.2.3";
74
+ var packageVersion = "0.0.0-development";
75
75
  var setAsQueryContainerStyles = (0, _react2.css)({
76
76
  containerName: 'ak-renderer-wrapper',
77
77
  containerType: 'inline-size'
@@ -113,9 +113,13 @@ const renderSyncBlockColgroup = ({
113
113
  return null;
114
114
  }
115
115
 
116
- // SSR / first render before WidthContext measures. Output % of original ADF proportions so
117
- // columns are stable — the CSS container query (100cqw) handles actual scaling width.
118
- if (contextWidth <= 0 && renderWidthProp <= 0) {
116
+ // SSR / first client render before WidthObserver measures. Output % of original ADF
117
+ // proportions so columns are stable — the CSS container query (100cqw) handles actual
118
+ // scaling width. We key off renderWidthProp alone because WidthProvider initialises with
119
+ // document.body.offsetWidth (non-zero on the client), so contextWidth > 0 even before
120
+ // WidthObserver has measured the real container, which would skip this branch and produce
121
+ // column widths scaled to the full viewport.
122
+ if (renderWidthProp <= 0) {
119
123
  const fullTableWidth = isNumberColumnEnabled ? rawTotalWidth + akEditorTableNumberColumnWidth : rawTotalWidth;
120
124
  return columnWidths.map(colWidth => ({
121
125
  width: `${colWidth / fullTableWidth * 100}%`
@@ -126,7 +130,27 @@ const renderSyncBlockColgroup = ({
126
130
  // getParentNodeWidth() border offset. Fall back to renderWidthProp for the non-CSS path.
127
131
  const effectiveRenderWidth = contextWidth > 0 ? contextWidth - 2 : renderWidthProp;
128
132
  const availableWidth = getDataColumnWidth(effectiveRenderWidth, isNumberColumnEnabled);
129
- return scaleColumnsToWidth(columnWidths, availableWidth);
133
+
134
+ // Only scale down if the table is actually wider than the available space.
135
+ // If the table fits, return original widths with the same tableCellBorderWidth (2px) adjustment
136
+ // that renderScaleDownColgroup applies via fixColumnWidth's no-scale path.
137
+ if (availableWidth >= rawTotalWidth) {
138
+ return columnWidths.map(colWidth => ({
139
+ width: `${Math.max(colWidth - tableCellBorderWidth, tableCellMinWidth)}px`
140
+ }));
141
+ }
142
+
143
+ // Cap scaling at MAX_SCALING_PERCENT (30%), matching renderScaleDownColgroup's calcScalePercent.
144
+ //
145
+ // Both `availableWidth` and `rawTotalWidth` are already in data-column space (number column
146
+ // excluded via getDataColumnWidth), so `diffPercent = 1 - availableWidth / rawTotalWidth` is
147
+ // equivalent to calcScalePercent's `numColumnScalePercent` path when isNumberColumnEnabled,
148
+ // and to the `noNumColumnScalePercent` path otherwise. We express the cap as a target width
149
+ // (clampedAvailableWidth) rather than a scale-down percentage, but the result is the same:
150
+ // columns are scaled by at most MAX_SCALING_PERCENT (30%).
151
+ const diffPercent = 1 - availableWidth / rawTotalWidth;
152
+ const clampedAvailableWidth = diffPercent <= MAX_SCALING_PERCENT ? availableWidth : Math.floor(rawTotalWidth * (1 - MAX_SCALING_PERCENT));
153
+ return scaleColumnsToWidth(columnWidths, clampedAvailableWidth);
130
154
  };
131
155
  const renderScaleDownColgroup = props => {
132
156
  var _props$tableNode;
@@ -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.2;
59
59
  const packageName = "@atlaskit/renderer";
60
- const packageVersion = "130.2.3";
60
+ const packageVersion = "0.0.0-development";
61
61
  const setAsQueryContainerStyles = css({
62
62
  containerName: 'ak-renderer-wrapper',
63
63
  containerType: 'inline-size'
@@ -131,9 +131,13 @@ var renderSyncBlockColgroup = function renderSyncBlockColgroup(_ref3) {
131
131
  return null;
132
132
  }
133
133
 
134
- // SSR / first render before WidthContext measures. Output % of original ADF proportions so
135
- // columns are stable — the CSS container query (100cqw) handles actual scaling width.
136
- if (contextWidth <= 0 && renderWidthProp <= 0) {
134
+ // SSR / first client render before WidthObserver measures. Output % of original ADF
135
+ // proportions so columns are stable — the CSS container query (100cqw) handles actual
136
+ // scaling width. We key off renderWidthProp alone because WidthProvider initialises with
137
+ // document.body.offsetWidth (non-zero on the client), so contextWidth > 0 even before
138
+ // WidthObserver has measured the real container, which would skip this branch and produce
139
+ // column widths scaled to the full viewport.
140
+ if (renderWidthProp <= 0) {
137
141
  var fullTableWidth = isNumberColumnEnabled ? rawTotalWidth + akEditorTableNumberColumnWidth : rawTotalWidth;
138
142
  return columnWidths.map(function (colWidth) {
139
143
  return {
@@ -146,7 +150,29 @@ var renderSyncBlockColgroup = function renderSyncBlockColgroup(_ref3) {
146
150
  // getParentNodeWidth() border offset. Fall back to renderWidthProp for the non-CSS path.
147
151
  var effectiveRenderWidth = contextWidth > 0 ? contextWidth - 2 : renderWidthProp;
148
152
  var availableWidth = getDataColumnWidth(effectiveRenderWidth, isNumberColumnEnabled);
149
- return scaleColumnsToWidth(columnWidths, availableWidth);
153
+
154
+ // Only scale down if the table is actually wider than the available space.
155
+ // If the table fits, return original widths with the same tableCellBorderWidth (2px) adjustment
156
+ // that renderScaleDownColgroup applies via fixColumnWidth's no-scale path.
157
+ if (availableWidth >= rawTotalWidth) {
158
+ return columnWidths.map(function (colWidth) {
159
+ return {
160
+ width: "".concat(Math.max(colWidth - tableCellBorderWidth, tableCellMinWidth), "px")
161
+ };
162
+ });
163
+ }
164
+
165
+ // Cap scaling at MAX_SCALING_PERCENT (30%), matching renderScaleDownColgroup's calcScalePercent.
166
+ //
167
+ // Both `availableWidth` and `rawTotalWidth` are already in data-column space (number column
168
+ // excluded via getDataColumnWidth), so `diffPercent = 1 - availableWidth / rawTotalWidth` is
169
+ // equivalent to calcScalePercent's `numColumnScalePercent` path when isNumberColumnEnabled,
170
+ // and to the `noNumColumnScalePercent` path otherwise. We express the cap as a target width
171
+ // (clampedAvailableWidth) rather than a scale-down percentage, but the result is the same:
172
+ // columns are scaled by at most MAX_SCALING_PERCENT (30%).
173
+ var diffPercent = 1 - availableWidth / rawTotalWidth;
174
+ var clampedAvailableWidth = diffPercent <= MAX_SCALING_PERCENT ? availableWidth : Math.floor(rawTotalWidth * (1 - MAX_SCALING_PERCENT));
175
+ return scaleColumnsToWidth(columnWidths, clampedAvailableWidth);
150
176
  };
151
177
  var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
152
178
  var _props$tableNode;
@@ -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.2;
64
64
  var packageName = "@atlaskit/renderer";
65
- var packageVersion = "130.2.3";
65
+ var packageVersion = "0.0.0-development";
66
66
  var setAsQueryContainerStyles = css({
67
67
  containerName: 'ak-renderer-wrapper',
68
68
  containerType: 'inline-size'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "130.2.4",
3
+ "version": "130.2.6",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/feature-gate-js-client": "^5.5.0",
49
49
  "@atlaskit/icon": "^34.2.0",
50
50
  "@atlaskit/link": "^3.4.0",
51
- "@atlaskit/link-datasource": "^5.1.0",
51
+ "@atlaskit/link-datasource": "^5.2.0",
52
52
  "@atlaskit/link-extractors": "^2.4.0",
53
53
  "@atlaskit/linking-common": "^9.11.0",
54
54
  "@atlaskit/media-card": "^80.1.0",
@@ -79,7 +79,7 @@
79
79
  "uuid": "^3.1.0"
80
80
  },
81
81
  "peerDependencies": {
82
- "@atlaskit/editor-common": "^114.5.0",
82
+ "@atlaskit/editor-common": "^114.6.0",
83
83
  "@atlaskit/link-provider": "^4.3.0",
84
84
  "@atlaskit/media-core": "^37.0.0",
85
85
  "react": "^18.2.0",
@@ -92,7 +92,7 @@
92
92
  "@atlaskit/analytics-gas-types": "^5.1.0",
93
93
  "@atlaskit/checkbox": "^17.3.0",
94
94
  "@atlaskit/link-provider": "^4.3.0",
95
- "@atlaskit/link-test-helpers": "^10.1.0",
95
+ "@atlaskit/link-test-helpers": "^10.2.0",
96
96
  "@atlaskit/media-core": "^37.0.0",
97
97
  "@atlaskit/media-integration-test-helpers": "workspace:^",
98
98
  "@atlaskit/media-test-helpers": "^41.0.0",
@@ -103,6 +103,7 @@
103
103
  "@atlaskit/side-nav-items": "^1.13.0",
104
104
  "@atlaskit/util-data-test": "^18.5.0",
105
105
  "@atlassian/a11y-jest-testing": "^0.11.0",
106
+ "@atlassian/a11y-playwright-testing": "^0.9.0",
106
107
  "@atlassian/feature-flags-test-utils": "^1.0.0",
107
108
  "@atlassian/react-compiler-gating": "workspace:^",
108
109
  "@atlassian/testing-library": "^0.5.0",