@atlaskit/editor-common 134.0.3 → 134.1.1

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,28 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 134.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ada3de6988596`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ada3de6988596) -
8
+ Clean up the shipped `confluence_live_doc_table_sort_bugfix` experiment: the renderer table sort
9
+ button now always sits above header content so its whole body is clickable in live docs.
10
+ - Updated dependencies
11
+
12
+ ## 134.1.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [`800e9d2b92528`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/800e9d2b92528) -
17
+ Add viewport-aware rendered events for MAUI embeds and Remix media behind
18
+ `platform_maui_retention_analytics`, deduplicated per result within each tracker.
19
+
20
+ Native embeds opt in through `uiConfig.deferRenderedEventUntilVisible` and can provide
21
+ `getRenderedResultId` for analytics attribution. Other embeds retain existing timing.
22
+
23
+ Media tracking preserves preview readiness across replacements and observes only eligible Remix
24
+ media. Analytics prefer the matching Remix source regardless of tracking eligibility.
25
+
3
26
  ## 134.0.3
4
27
 
5
28
  ### Patch Changes
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
27
27
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
28
28
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
29
29
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
30
- var packageVersion = "134.0.2";
30
+ var packageVersion = "134.1.0";
31
31
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
32
32
  // Remove URL as it has UGC
33
33
  // Ignored via go/ees007
@@ -30,13 +30,7 @@ var _templateObject, _templateObject2;
30
30
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
31
31
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
32
32
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
33
- var buttonStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tposition: absolute;\n\tdisplay: flex;\n\theight: 28px;\n\twidth: 28px;\n\tmargin: ", ";\n\tright: 0;\n\ttop: 0;\n\tborder: ", " solid ", ";\n\tborder-radius: ", ";\n\tbackground-color: ", ";\n\tjustify-content: center;\n\talign-items: center;\n\tcursor: pointer;\n\n\t&:hover {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:active {\n\t\tbackground-color: ", ";\n\t}\n\n\t&.", "__not-allowed {\n\t\tcursor: not-allowed;\n\t}\n"])), "var(--ds-space-075, 6px)", "var(--ds-border-width-selected, 2px)", "var(--ds-border, #0B120E24)", "var(--ds-radius-small, 4px)", "var(--ds-surface-overlay, #FFFFFF)", "var(--ds-surface-overlay-hovered, #F0F1F2)", "var(--ds-surface-overlay-pressed, #DDDEE1)", _consts.SORTABLE_COLUMN_ICON_CLASSNAME);
34
-
35
- // Keep the sort button above header content nodes that the editor's native-anchor DnD
36
- // styles give a z-index in live docs, which otherwise cover the button's clickable body.
37
- var sortButtonElevatedStyles = (0, _react.css)({
38
- zIndex: 1
39
- });
33
+ var buttonStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tposition: absolute;\n\tdisplay: flex;\n\theight: 28px;\n\twidth: 28px;\n\tmargin: ", ";\n\tright: 0;\n\ttop: 0;\n\tborder: ", " solid ", ";\n\tborder-radius: ", ";\n\tbackground-color: ", ";\n\tjustify-content: center;\n\talign-items: center;\n\tcursor: pointer;\n\t/* Stay above header content nodes that the editor's native-anchor DnD styles give a\n\t z-index in live docs, which otherwise cover the button's clickable body. */\n\tz-index: 1;\n\n\t&:hover {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:active {\n\t\tbackground-color: ", ";\n\t}\n\n\t&.", "__not-allowed {\n\t\tcursor: not-allowed;\n\t}\n"])), "var(--ds-space-075, 6px)", "var(--ds-border-width-selected, 2px)", "var(--ds-border, #0B120E24)", "var(--ds-radius-small, 4px)", "var(--ds-surface-overlay, #FFFFFF)", "var(--ds-surface-overlay-hovered, #F0F1F2)", "var(--ds-surface-overlay-pressed, #DDDEE1)", _consts.SORTABLE_COLUMN_ICON_CLASSNAME);
40
34
 
41
35
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
42
36
  var iconWrapperStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\twidth: 8px;\n\theight: 12px;\n\ttransition: transform 0.3s cubic-bezier(0.15, 1, 0.3, 1);\n\ttransform-origin: 50% 50%;\n\tdisplay: flex;\n\tjustify-content: center;\n\n\t&.", " {\n\t\ttransform: rotate(-180deg);\n\t}\n\n\t&.", "-inactive {\n\t\topacity: 0.7;\n\t}\n"])), _StatusClassNames.StatusClassNames.DESC, _consts.SORTABLE_COLUMN_ICON_CLASSNAME);
@@ -142,7 +136,7 @@ var SortingIcon = function SortingIcon(_ref) {
142
136
  position: "top",
143
137
  hasNewContentOnTriggerClick: true
144
138
  }, (0, _react.jsx)("div", {
145
- css: [buttonStyles, (0, _expValEquals.expValEquals)('confluence_live_doc_table_sort_bugfix', 'isEnabled', true) && sortButtonElevatedStyles]
139
+ css: buttonStyles
146
140
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
147
141
  ,
148
142
  className: buttonClassName,
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "134.0.2";
26
+ var packageVersion = "134.1.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createRenderedResultTracker = createRenderedResultTracker;
7
+ var _bindEventListener = require("bind-event-listener");
8
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
+ function createRenderedResultTracker(_ref) {
12
+ var onRendered = _ref.onRendered;
13
+ var resultId;
14
+ var _ready = false;
15
+ var intersects = false;
16
+ var element = null;
17
+ var observer;
18
+ var unbindVisibility;
19
+ var destroyed = false;
20
+ var emitted = new Set();
21
+ var updateIntersection = function updateIntersection(entries) {
22
+ var _iterator = _createForOfIteratorHelper(entries),
23
+ _step;
24
+ try {
25
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
26
+ var entry = _step.value;
27
+ if (entry.target === element) {
28
+ intersects = entry.isIntersecting && entry.intersectionRatio > 0;
29
+ }
30
+ }
31
+ } catch (err) {
32
+ _iterator.e(err);
33
+ } finally {
34
+ _iterator.f();
35
+ }
36
+ };
37
+ var emit = function emit() {
38
+ var _observer$takeRecords, _observer, _element;
39
+ if (destroyed || !_ready || resultId === undefined || emitted.has(resultId)) {
40
+ return;
41
+ }
42
+ updateIntersection((_observer$takeRecords = (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.takeRecords()) !== null && _observer$takeRecords !== void 0 ? _observer$takeRecords : []);
43
+ if (!intersects || ((_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.visibilityState) !== 'visible') {
44
+ return;
45
+ }
46
+ emitted.add(resultId);
47
+ onRendered(resultId);
48
+ };
49
+ var disconnect = function disconnect() {
50
+ var _observer2, _unbindVisibility;
51
+ (_observer2 = observer) === null || _observer2 === void 0 || _observer2.disconnect();
52
+ observer = undefined;
53
+ (_unbindVisibility = unbindVisibility) === null || _unbindVisibility === void 0 || _unbindVisibility();
54
+ unbindVisibility = undefined;
55
+ intersects = false;
56
+ };
57
+ return {
58
+ setResult: function setResult(nextResultId) {
59
+ if (resultId !== nextResultId) {
60
+ resultId = nextResultId;
61
+ _ready = false;
62
+ }
63
+ },
64
+ ready: function ready(renderedResultId) {
65
+ if (resultId === renderedResultId) {
66
+ _ready = true;
67
+ emit();
68
+ }
69
+ },
70
+ observe: function observe(nextElement) {
71
+ if (destroyed || element === nextElement) {
72
+ return;
73
+ }
74
+ disconnect();
75
+ element = nextElement;
76
+ if (element) {
77
+ observer = new IntersectionObserver(function (entries) {
78
+ updateIntersection(entries);
79
+ emit();
80
+ }, {
81
+ // The root property identifies what to observe in the viewport
82
+ // `null` will use the owning document (most likely the browser window)
83
+ root: null,
84
+ // Detect when overlap reaches 0.1% of the element's area
85
+ threshold: [0, 0.001]
86
+ });
87
+ observer.observe(element);
88
+ unbindVisibility = (0, _bindEventListener.bind)(element.ownerDocument, {
89
+ type: 'visibilitychange',
90
+ listener: emit
91
+ });
92
+ }
93
+ },
94
+ destroy: function destroy() {
95
+ destroyed = true;
96
+ disconnect();
97
+ element = null;
98
+ }
99
+ };
100
+ }
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
13
13
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
14
14
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
15
15
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
16
- const packageVersion = "134.0.2";
16
+ const packageVersion = "134.1.0";
17
17
  const sanitiseSentryEvents = (data, _hint) => {
18
18
  // Remove URL as it has UGC
19
19
  // Ignored via go/ees007
@@ -31,6 +31,9 @@ const buttonStyles = css`
31
31
  justify-content: center;
32
32
  align-items: center;
33
33
  cursor: pointer;
34
+ /* Stay above header content nodes that the editor's native-anchor DnD styles give a
35
+ z-index in live docs, which otherwise cover the button's clickable body. */
36
+ z-index: 1;
34
37
 
35
38
  &:hover {
36
39
  background-color: ${"var(--ds-surface-overlay-hovered, #F0F1F2)"};
@@ -45,12 +48,6 @@ const buttonStyles = css`
45
48
  }
46
49
  `;
47
50
 
48
- // Keep the sort button above header content nodes that the editor's native-anchor DnD
49
- // styles give a z-index in live docs, which otherwise cover the button's clickable body.
50
- const sortButtonElevatedStyles = css({
51
- zIndex: 1
52
- });
53
-
54
51
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
55
52
  const iconWrapperStyles = css`
56
53
  width: 8px;
@@ -175,7 +172,7 @@ const SortingIcon = ({
175
172
  position: "top",
176
173
  hasNewContentOnTriggerClick: true
177
174
  }, jsx("div", {
178
- css: [buttonStyles, expValEquals('confluence_live_doc_table_sort_bugfix', 'isEnabled', true) && sortButtonElevatedStyles]
175
+ css: buttonStyles
179
176
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
180
177
  ,
181
178
  className: buttonClassName,
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "134.0.2";
16
+ const packageVersion = "134.1.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -0,0 +1,83 @@
1
+ import { bind } from 'bind-event-listener';
2
+ export function createRenderedResultTracker({
3
+ onRendered
4
+ }) {
5
+ let resultId;
6
+ let ready = false;
7
+ let intersects = false;
8
+ let element = null;
9
+ let observer;
10
+ let unbindVisibility;
11
+ let destroyed = false;
12
+ const emitted = new Set();
13
+ const updateIntersection = entries => {
14
+ for (const entry of entries) {
15
+ if (entry.target === element) {
16
+ intersects = entry.isIntersecting && entry.intersectionRatio > 0;
17
+ }
18
+ }
19
+ };
20
+ const emit = () => {
21
+ var _observer$takeRecords, _observer, _element;
22
+ if (destroyed || !ready || resultId === undefined || emitted.has(resultId)) {
23
+ return;
24
+ }
25
+ updateIntersection((_observer$takeRecords = (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.takeRecords()) !== null && _observer$takeRecords !== void 0 ? _observer$takeRecords : []);
26
+ if (!intersects || ((_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.visibilityState) !== 'visible') {
27
+ return;
28
+ }
29
+ emitted.add(resultId);
30
+ onRendered(resultId);
31
+ };
32
+ const disconnect = () => {
33
+ var _observer2, _unbindVisibility;
34
+ (_observer2 = observer) === null || _observer2 === void 0 ? void 0 : _observer2.disconnect();
35
+ observer = undefined;
36
+ (_unbindVisibility = unbindVisibility) === null || _unbindVisibility === void 0 ? void 0 : _unbindVisibility();
37
+ unbindVisibility = undefined;
38
+ intersects = false;
39
+ };
40
+ return {
41
+ setResult: nextResultId => {
42
+ if (resultId !== nextResultId) {
43
+ resultId = nextResultId;
44
+ ready = false;
45
+ }
46
+ },
47
+ ready: renderedResultId => {
48
+ if (resultId === renderedResultId) {
49
+ ready = true;
50
+ emit();
51
+ }
52
+ },
53
+ observe: nextElement => {
54
+ if (destroyed || element === nextElement) {
55
+ return;
56
+ }
57
+ disconnect();
58
+ element = nextElement;
59
+ if (element) {
60
+ observer = new IntersectionObserver(entries => {
61
+ updateIntersection(entries);
62
+ emit();
63
+ }, {
64
+ // The root property identifies what to observe in the viewport
65
+ // `null` will use the owning document (most likely the browser window)
66
+ root: null,
67
+ // Detect when overlap reaches 0.1% of the element's area
68
+ threshold: [0, 0.001]
69
+ });
70
+ observer.observe(element);
71
+ unbindVisibility = bind(element.ownerDocument, {
72
+ type: 'visibilitychange',
73
+ listener: emit
74
+ });
75
+ }
76
+ },
77
+ destroy: () => {
78
+ destroyed = true;
79
+ disconnect();
80
+ element = null;
81
+ }
82
+ };
83
+ }
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
19
19
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "134.0.2";
22
+ var packageVersion = "134.1.0";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -19,13 +19,7 @@ import { sortingIconMessages } from './sortingIconMessages';
19
19
  import { StatusClassNames } from './StatusClassNames';
20
20
 
21
21
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
22
- var buttonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tposition: absolute;\n\tdisplay: flex;\n\theight: 28px;\n\twidth: 28px;\n\tmargin: ", ";\n\tright: 0;\n\ttop: 0;\n\tborder: ", " solid ", ";\n\tborder-radius: ", ";\n\tbackground-color: ", ";\n\tjustify-content: center;\n\talign-items: center;\n\tcursor: pointer;\n\n\t&:hover {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:active {\n\t\tbackground-color: ", ";\n\t}\n\n\t&.", "__not-allowed {\n\t\tcursor: not-allowed;\n\t}\n"])), "var(--ds-space-075, 6px)", "var(--ds-border-width-selected, 2px)", "var(--ds-border, #0B120E24)", "var(--ds-radius-small, 4px)", "var(--ds-surface-overlay, #FFFFFF)", "var(--ds-surface-overlay-hovered, #F0F1F2)", "var(--ds-surface-overlay-pressed, #DDDEE1)", SORTABLE_COLUMN_ICON_CLASSNAME);
23
-
24
- // Keep the sort button above header content nodes that the editor's native-anchor DnD
25
- // styles give a z-index in live docs, which otherwise cover the button's clickable body.
26
- var sortButtonElevatedStyles = css({
27
- zIndex: 1
28
- });
22
+ var buttonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tposition: absolute;\n\tdisplay: flex;\n\theight: 28px;\n\twidth: 28px;\n\tmargin: ", ";\n\tright: 0;\n\ttop: 0;\n\tborder: ", " solid ", ";\n\tborder-radius: ", ";\n\tbackground-color: ", ";\n\tjustify-content: center;\n\talign-items: center;\n\tcursor: pointer;\n\t/* Stay above header content nodes that the editor's native-anchor DnD styles give a\n\t z-index in live docs, which otherwise cover the button's clickable body. */\n\tz-index: 1;\n\n\t&:hover {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:active {\n\t\tbackground-color: ", ";\n\t}\n\n\t&.", "__not-allowed {\n\t\tcursor: not-allowed;\n\t}\n"])), "var(--ds-space-075, 6px)", "var(--ds-border-width-selected, 2px)", "var(--ds-border, #0B120E24)", "var(--ds-radius-small, 4px)", "var(--ds-surface-overlay, #FFFFFF)", "var(--ds-surface-overlay-hovered, #F0F1F2)", "var(--ds-surface-overlay-pressed, #DDDEE1)", SORTABLE_COLUMN_ICON_CLASSNAME);
29
23
 
30
24
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
31
25
  var iconWrapperStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n\twidth: 8px;\n\theight: 12px;\n\ttransition: transform 0.3s cubic-bezier(0.15, 1, 0.3, 1);\n\ttransform-origin: 50% 50%;\n\tdisplay: flex;\n\tjustify-content: center;\n\n\t&.", " {\n\t\ttransform: rotate(-180deg);\n\t}\n\n\t&.", "-inactive {\n\t\topacity: 0.7;\n\t}\n"])), StatusClassNames.DESC, SORTABLE_COLUMN_ICON_CLASSNAME);
@@ -131,7 +125,7 @@ var SortingIcon = function SortingIcon(_ref) {
131
125
  position: "top",
132
126
  hasNewContentOnTriggerClick: true
133
127
  }, jsx("div", {
134
- css: [buttonStyles, expValEquals('confluence_live_doc_table_sort_bugfix', 'isEnabled', true) && sortButtonElevatedStyles]
128
+ css: buttonStyles
135
129
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
136
130
  ,
137
131
  className: buttonClassName,
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "134.0.2";
23
+ var packageVersion = "134.1.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -0,0 +1,94 @@
1
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
3
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
+ import { bind } from 'bind-event-listener';
5
+ export function createRenderedResultTracker(_ref) {
6
+ var onRendered = _ref.onRendered;
7
+ var resultId;
8
+ var _ready = false;
9
+ var intersects = false;
10
+ var element = null;
11
+ var observer;
12
+ var unbindVisibility;
13
+ var destroyed = false;
14
+ var emitted = new Set();
15
+ var updateIntersection = function updateIntersection(entries) {
16
+ var _iterator = _createForOfIteratorHelper(entries),
17
+ _step;
18
+ try {
19
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
20
+ var entry = _step.value;
21
+ if (entry.target === element) {
22
+ intersects = entry.isIntersecting && entry.intersectionRatio > 0;
23
+ }
24
+ }
25
+ } catch (err) {
26
+ _iterator.e(err);
27
+ } finally {
28
+ _iterator.f();
29
+ }
30
+ };
31
+ var emit = function emit() {
32
+ var _observer$takeRecords, _observer, _element;
33
+ if (destroyed || !_ready || resultId === undefined || emitted.has(resultId)) {
34
+ return;
35
+ }
36
+ updateIntersection((_observer$takeRecords = (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.takeRecords()) !== null && _observer$takeRecords !== void 0 ? _observer$takeRecords : []);
37
+ if (!intersects || ((_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.visibilityState) !== 'visible') {
38
+ return;
39
+ }
40
+ emitted.add(resultId);
41
+ onRendered(resultId);
42
+ };
43
+ var disconnect = function disconnect() {
44
+ var _observer2, _unbindVisibility;
45
+ (_observer2 = observer) === null || _observer2 === void 0 || _observer2.disconnect();
46
+ observer = undefined;
47
+ (_unbindVisibility = unbindVisibility) === null || _unbindVisibility === void 0 || _unbindVisibility();
48
+ unbindVisibility = undefined;
49
+ intersects = false;
50
+ };
51
+ return {
52
+ setResult: function setResult(nextResultId) {
53
+ if (resultId !== nextResultId) {
54
+ resultId = nextResultId;
55
+ _ready = false;
56
+ }
57
+ },
58
+ ready: function ready(renderedResultId) {
59
+ if (resultId === renderedResultId) {
60
+ _ready = true;
61
+ emit();
62
+ }
63
+ },
64
+ observe: function observe(nextElement) {
65
+ if (destroyed || element === nextElement) {
66
+ return;
67
+ }
68
+ disconnect();
69
+ element = nextElement;
70
+ if (element) {
71
+ observer = new IntersectionObserver(function (entries) {
72
+ updateIntersection(entries);
73
+ emit();
74
+ }, {
75
+ // The root property identifies what to observe in the viewport
76
+ // `null` will use the owning document (most likely the browser window)
77
+ root: null,
78
+ // Detect when overlap reaches 0.1% of the element's area
79
+ threshold: [0, 0.001]
80
+ });
81
+ observer.observe(element);
82
+ unbindVisibility = bind(element.ownerDocument, {
83
+ type: 'visibilitychange',
84
+ listener: emit
85
+ });
86
+ }
87
+ },
88
+ destroy: function destroy() {
89
+ destroyed = true;
90
+ disconnect();
91
+ element = null;
92
+ }
93
+ };
94
+ }
@@ -0,0 +1,9 @@
1
+ export type RenderedResultTracker = {
2
+ destroy: () => void;
3
+ observe: (element: HTMLElement | null) => void;
4
+ ready: (resultId: string) => void;
5
+ setResult: (resultId: string) => void;
6
+ };
7
+ export declare function createRenderedResultTracker({ onRendered, }: {
8
+ onRendered: (resultId: string) => void;
9
+ }): RenderedResultTracker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "134.0.3",
3
+ "version": "134.1.1",
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/"
@@ -85,7 +85,7 @@
85
85
  "@atlaskit/task-decision": "^21.13.0",
86
86
  "@atlaskit/teams-app-config": "^3.1.0",
87
87
  "@atlaskit/textfield": "^10.2.0",
88
- "@atlaskit/tmp-editor-statsig": "^247.0.0",
88
+ "@atlaskit/tmp-editor-statsig": "^248.0.0",
89
89
  "@atlaskit/tokens": "^20.8.0",
90
90
  "@atlaskit/tooltip": "^24.4.0",
91
91
  "@atlaskit/width-detector": "^7.2.0",
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/rendered-result-tracker",
3
+ "main": "../dist/cjs/utils/rendered-result-tracker.js",
4
+ "module": "../dist/esm/utils/rendered-result-tracker.js",
5
+ "module:es2019": "../dist/es2019/utils/rendered-result-tracker.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../dist/types/utils/rendered-result-tracker.d.ts"
10
+ }