@atlaskit/editor-common 112.19.3 → 112.20.2
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 +34 -0
- package/compiled-migration/package.json +17 -0
- package/dist/cjs/analytics/linking-utils.js +12 -3
- package/dist/cjs/analytics/types/enums.js +1 -0
- package/dist/cjs/compiled-migration/withCompiledMigration.js +98 -0
- package/dist/cjs/messages/native-embed-toolbar.js +5 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/analytics/linking-utils.js +8 -2
- package/dist/es2019/analytics/types/enums.js +1 -0
- package/dist/es2019/compiled-migration/withCompiledMigration.js +91 -0
- package/dist/es2019/messages/native-embed-toolbar.js +5 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/analytics/linking-utils.js +11 -3
- package/dist/esm/analytics/types/enums.js +1 -0
- package/dist/esm/compiled-migration/withCompiledMigration.js +91 -0
- package/dist/esm/messages/native-embed-toolbar.js +5 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/analytics/linking-utils.d.ts +6 -1
- package/dist/types/analytics/types/ai-autocomplete-events.d.ts +6 -2
- package/dist/types/analytics/types/enums.d.ts +2 -1
- package/dist/types/analytics/types/insert-events.d.ts +9 -1
- package/dist/types/compiled-migration/withCompiledMigration.d.ts +65 -0
- package/dist/types/messages/native-embed-toolbar.d.ts +5 -0
- package/dist/types-ts4.5/analytics/linking-utils.d.ts +6 -1
- package/dist/types-ts4.5/analytics/types/ai-autocomplete-events.d.ts +6 -2
- package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -1
- package/dist/types-ts4.5/analytics/types/insert-events.d.ts +9 -1
- package/dist/types-ts4.5/compiled-migration/withCompiledMigration.d.ts +65 -0
- package/dist/types-ts4.5/messages/native-embed-toolbar.d.ts +5 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 112.20.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 112.20.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`89e32bffb1383`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/89e32bffb1383) -
|
|
14
|
+
[ux] Add support to consume the editor AI plugin summarise functionality in other editor plugins.
|
|
15
|
+
- [`9534ff4c93c1d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9534ff4c93c1d) -
|
|
16
|
+
Send error event when API fails
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 112.20.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [`90b759086522c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/90b759086522c) -
|
|
24
|
+
Add withCompiledMigration HOC and enforce-compiled-migration-gate ESLint rule for feature-gated
|
|
25
|
+
Emotion to Compiled CSS-in-JS migration
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
|
|
31
|
+
## 112.19.4
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
|
|
3
37
|
## 112.19.3
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/compiled-migration",
|
|
3
|
+
"main": "../dist/cjs/compiled-migration/withCompiledMigration.js",
|
|
4
|
+
"module": "../dist/esm/compiled-migration/withCompiledMigration.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/compiled-migration/withCompiledMigration.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/compiled-migration/withCompiledMigration.d.ts",
|
|
10
|
+
"typesVersions": {
|
|
11
|
+
">=4.5 <5.9": {
|
|
12
|
+
"*": [
|
|
13
|
+
"../dist/types-ts4.5/compiled-migration/withCompiledMigration.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.unlinkPayload = exports.buildVisitedNonHyperLinkPayload = exports.buildVisitedLinkPayload = exports.buildOpenedSettingsPayload = exports.buildEditLinkPayload = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _enums = require("./types/enums");
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
8
12
|
var buildEditLinkPayload = exports.buildEditLinkPayload = function buildEditLinkPayload(type) {
|
|
9
13
|
return {
|
|
10
14
|
action: _enums.ACTION.CLICKED,
|
|
@@ -51,14 +55,19 @@ var buildVisitedHyperLinkPayload = function buildVisitedHyperLinkPayload() {
|
|
|
51
55
|
eventType: _enums.EVENT_TYPE.TRACK
|
|
52
56
|
};
|
|
53
57
|
};
|
|
54
|
-
var buildVisitedNonHyperLinkPayload = exports.buildVisitedNonHyperLinkPayload = function buildVisitedNonHyperLinkPayload(type, inputMethod) {
|
|
58
|
+
var buildVisitedNonHyperLinkPayload = exports.buildVisitedNonHyperLinkPayload = function buildVisitedNonHyperLinkPayload(type, inputMethod, resolvedAttributes) {
|
|
55
59
|
return {
|
|
56
60
|
action: _enums.ACTION.VISITED,
|
|
57
61
|
actionSubject: _enums.ACTION_SUBJECT.SMART_LINK,
|
|
58
62
|
actionSubjectId: type,
|
|
59
|
-
attributes: {
|
|
63
|
+
attributes: _objectSpread({
|
|
60
64
|
inputMethod: inputMethod
|
|
61
|
-
},
|
|
65
|
+
}, resolvedAttributes && {
|
|
66
|
+
displayCategory: resolvedAttributes.displayCategory,
|
|
67
|
+
extensionKey: resolvedAttributes.extensionKey,
|
|
68
|
+
status: resolvedAttributes.status,
|
|
69
|
+
statusDetails: resolvedAttributes.statusDetails
|
|
70
|
+
}),
|
|
62
71
|
eventType: _enums.EVENT_TYPE.TRACK
|
|
63
72
|
};
|
|
64
73
|
};
|
|
@@ -581,6 +581,7 @@ var ACTION_SUBJECT_ID = exports.ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTIO
|
|
|
581
581
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_LABEL"] = "syncedBlockLabel";
|
|
582
582
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_SSR_ERROR"] = "syncedBlockSSRError";
|
|
583
583
|
ACTION_SUBJECT_ID["TABLE_STICKY_HEADER"] = "tableStickyHeader";
|
|
584
|
+
ACTION_SUBJECT_ID["SNIPPET"] = "snippet";
|
|
584
585
|
return ACTION_SUBJECT_ID;
|
|
585
586
|
}({});
|
|
586
587
|
var FLOATING_CONTROLS_TITLE = exports.FLOATING_CONTROLS_TITLE = /*#__PURE__*/function (FLOATING_CONTROLS_TITLE) {
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.withCompiledMigration = withCompiledMigration;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
|
+
/**
|
|
12
|
+
* @jsxRuntime classic
|
|
13
|
+
* @jsx jsx
|
|
14
|
+
*
|
|
15
|
+
* IMPORTANT: This file MUST keep the emotion JSX pragma (@jsx jsx from @emotion/react).
|
|
16
|
+
* This is intentional — it allows the HOC to apply emotion styles via the css prop
|
|
17
|
+
* at the call site (where emotion's JSX runtime intercepts it), without requiring
|
|
18
|
+
* the wrapped component to use the emotion pragma itself.
|
|
19
|
+
*
|
|
20
|
+
* This file is part of the Emotion → Compiled CSS-in-JS migration infrastructure.
|
|
21
|
+
* It is temporary and should be removed once the migration is complete.
|
|
22
|
+
*
|
|
23
|
+
* @see https://hello.atlassian.net/wiki/spaces/~712020e6f24689f2da470b80ba6873df7b44a2/pages/6788274038/Emotion+-+Compiled+Feature+Gating+Strategy
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- intentional: this file must use emotion's JSX pragma to apply emotion styles via the css prop
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A HOC that enables per-component feature-gated migration from Emotion to Compiled CSS-in-JS.
|
|
30
|
+
*
|
|
31
|
+
* When the `platform_editor_static_css` experiment is ON:
|
|
32
|
+
* - Renders the component directly. Compiled's statically-extracted CSS classes are applied
|
|
33
|
+
* via the component's own `css` prop (using the Compiled pragma in the component file).
|
|
34
|
+
* - No Emotion code runs at all.
|
|
35
|
+
*
|
|
36
|
+
* When the experiment is OFF:
|
|
37
|
+
* - Renders the component with `css={emotionStyles}`. Because THIS file has the Emotion pragma,
|
|
38
|
+
* Emotion's JSX runtime intercepts the css prop here, converts it to a className string,
|
|
39
|
+
* and passes it to the component as `className`. No wrapper div, no ClassNames render prop.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* // button.tsx — the base component is style-agnostic, it just accepts className.
|
|
44
|
+
* export function Button({ className }: { className?: string }) {
|
|
45
|
+
* return <button className={className}>Click me</button>;
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* // app.tsx — the call site handles both compiled and emotion styles.
|
|
49
|
+
* import { css } from '@compiled/react';
|
|
50
|
+
* import { css as emotionCss } from '@emotion/react';
|
|
51
|
+
* import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
52
|
+
* import { withCompiledMigration } from '@atlaskit/editor-common/compiled-migration';
|
|
53
|
+
* import { Button } from './button';
|
|
54
|
+
*
|
|
55
|
+
* const compiledStyles = css({ border: '1px solid red' });
|
|
56
|
+
* const emotionStyles = emotionCss({ border: '1px solid red' });
|
|
57
|
+
*
|
|
58
|
+
* // Wrap the component — the HOC applies emotion styles when the experiment is off.
|
|
59
|
+
* const StyledButton = withCompiledMigration(Button, emotionStyles);
|
|
60
|
+
*
|
|
61
|
+
* // At the call site, apply compiled styles conditionally:
|
|
62
|
+
* export function App() {
|
|
63
|
+
* return (
|
|
64
|
+
* <StyledButton
|
|
65
|
+
* css={[expValEquals('platform_editor_static_css', 'isEnabled', true) && compiledStyles]}
|
|
66
|
+
* />
|
|
67
|
+
* );
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
function withCompiledMigration(WrappedComponent, emotionStyles) {
|
|
72
|
+
var _ref, _WrappedComponent$dis;
|
|
73
|
+
// The cast is required because emotion's `css` prop is injected by the JSX pragma
|
|
74
|
+
// and is not part of the component's declared props type. We widen to P & { css? }
|
|
75
|
+
// so TypeScript accepts the css prop in the emotion branch while preserving P.
|
|
76
|
+
var Comp = WrappedComponent;
|
|
77
|
+
function MigrationGatedComponent(props) {
|
|
78
|
+
var compiledEnabled = (0, _expValEquals.expValEquals)('platform_editor_static_css', 'isEnabled', true);
|
|
79
|
+
if (compiledEnabled) {
|
|
80
|
+
// Experiment ON — render directly. Compiled's statically-extracted CSS classes
|
|
81
|
+
// are applied inside the component via its own css prop. No Emotion code runs.
|
|
82
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- HOC must forward all props
|
|
83
|
+
return (0, _react.jsx)(Comp, props);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Experiment OFF — render with Emotion css prop. Because this file has
|
|
87
|
+
// the emotion JSX pragma, Emotion's JSX runtime intercepts the css prop
|
|
88
|
+
// here, converts it to a className, and passes it through to the component.
|
|
89
|
+
// No wrapper div needed.
|
|
90
|
+
// eslint-disable-next-line react/jsx-props-no-spreading, @atlaskit/ui-styling-standard/use-compiled -- HOC must forward all props; intentional emotion usage for migration
|
|
91
|
+
return (0, _react.jsx)(Comp, (0, _extends2.default)({}, props, {
|
|
92
|
+
css: emotionStyles
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
var name = (_ref = (_WrappedComponent$dis = WrappedComponent.displayName) !== null && _WrappedComponent$dis !== void 0 ? _WrappedComponent$dis : WrappedComponent.name) !== null && _ref !== void 0 ? _ref : 'Component';
|
|
96
|
+
MigrationGatedComponent.displayName = "withCompiledMigration(".concat(name, ")");
|
|
97
|
+
return MigrationGatedComponent;
|
|
98
|
+
}
|
|
@@ -16,6 +16,11 @@ var nativeEmbedToolbarMessages = exports.nativeEmbedToolbarMessages = (0, _react
|
|
|
16
16
|
defaultMessage: 'Refresh',
|
|
17
17
|
description: 'Label for the button to refresh the embedded link.'
|
|
18
18
|
},
|
|
19
|
+
summarise: {
|
|
20
|
+
id: 'fabric.editor.nativeEmbeds.summarise',
|
|
21
|
+
defaultMessage: 'Summarize',
|
|
22
|
+
description: 'Label for the button to summarize the content of the embedded link using AI.'
|
|
23
|
+
},
|
|
19
24
|
setEmbedType: {
|
|
20
25
|
id: 'fabric.editor.setEmbedType.non-final',
|
|
21
26
|
defaultMessage: 'Set embed type',
|
|
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
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 = "112.
|
|
22
|
+
var packageVersion = "112.20.2";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "112.
|
|
27
|
+
var packageVersion = "112.20.2";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -45,13 +45,19 @@ const buildVisitedHyperLinkPayload = () => {
|
|
|
45
45
|
eventType: EVENT_TYPE.TRACK
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
export const buildVisitedNonHyperLinkPayload = (type, inputMethod) => {
|
|
48
|
+
export const buildVisitedNonHyperLinkPayload = (type, inputMethod, resolvedAttributes) => {
|
|
49
49
|
return {
|
|
50
50
|
action: ACTION.VISITED,
|
|
51
51
|
actionSubject: ACTION_SUBJECT.SMART_LINK,
|
|
52
52
|
actionSubjectId: type,
|
|
53
53
|
attributes: {
|
|
54
|
-
inputMethod: inputMethod
|
|
54
|
+
inputMethod: inputMethod,
|
|
55
|
+
...(resolvedAttributes && {
|
|
56
|
+
displayCategory: resolvedAttributes.displayCategory,
|
|
57
|
+
extensionKey: resolvedAttributes.extensionKey,
|
|
58
|
+
status: resolvedAttributes.status,
|
|
59
|
+
statusDetails: resolvedAttributes.statusDetails
|
|
60
|
+
})
|
|
55
61
|
},
|
|
56
62
|
eventType: EVENT_TYPE.TRACK
|
|
57
63
|
};
|
|
@@ -575,6 +575,7 @@ export let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
575
575
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_LABEL"] = "syncedBlockLabel";
|
|
576
576
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_SSR_ERROR"] = "syncedBlockSSRError";
|
|
577
577
|
ACTION_SUBJECT_ID["TABLE_STICKY_HEADER"] = "tableStickyHeader";
|
|
578
|
+
ACTION_SUBJECT_ID["SNIPPET"] = "snippet";
|
|
578
579
|
return ACTION_SUBJECT_ID;
|
|
579
580
|
}({});
|
|
580
581
|
export let FLOATING_CONTROLS_TITLE = /*#__PURE__*/function (FLOATING_CONTROLS_TITLE) {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*
|
|
6
|
+
* IMPORTANT: This file MUST keep the emotion JSX pragma (@jsx jsx from @emotion/react).
|
|
7
|
+
* This is intentional — it allows the HOC to apply emotion styles via the css prop
|
|
8
|
+
* at the call site (where emotion's JSX runtime intercepts it), without requiring
|
|
9
|
+
* the wrapped component to use the emotion pragma itself.
|
|
10
|
+
*
|
|
11
|
+
* This file is part of the Emotion → Compiled CSS-in-JS migration infrastructure.
|
|
12
|
+
* It is temporary and should be removed once the migration is complete.
|
|
13
|
+
*
|
|
14
|
+
* @see https://hello.atlassian.net/wiki/spaces/~712020e6f24689f2da470b80ba6873df7b44a2/pages/6788274038/Emotion+-+Compiled+Feature+Gating+Strategy
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- intentional: this file must use emotion's JSX pragma to apply emotion styles via the css prop
|
|
18
|
+
import { jsx } from '@emotion/react';
|
|
19
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A HOC that enables per-component feature-gated migration from Emotion to Compiled CSS-in-JS.
|
|
23
|
+
*
|
|
24
|
+
* When the `platform_editor_static_css` experiment is ON:
|
|
25
|
+
* - Renders the component directly. Compiled's statically-extracted CSS classes are applied
|
|
26
|
+
* via the component's own `css` prop (using the Compiled pragma in the component file).
|
|
27
|
+
* - No Emotion code runs at all.
|
|
28
|
+
*
|
|
29
|
+
* When the experiment is OFF:
|
|
30
|
+
* - Renders the component with `css={emotionStyles}`. Because THIS file has the Emotion pragma,
|
|
31
|
+
* Emotion's JSX runtime intercepts the css prop here, converts it to a className string,
|
|
32
|
+
* and passes it to the component as `className`. No wrapper div, no ClassNames render prop.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // button.tsx — the base component is style-agnostic, it just accepts className.
|
|
37
|
+
* export function Button({ className }: { className?: string }) {
|
|
38
|
+
* return <button className={className}>Click me</button>;
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // app.tsx — the call site handles both compiled and emotion styles.
|
|
42
|
+
* import { css } from '@compiled/react';
|
|
43
|
+
* import { css as emotionCss } from '@emotion/react';
|
|
44
|
+
* import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
45
|
+
* import { withCompiledMigration } from '@atlaskit/editor-common/compiled-migration';
|
|
46
|
+
* import { Button } from './button';
|
|
47
|
+
*
|
|
48
|
+
* const compiledStyles = css({ border: '1px solid red' });
|
|
49
|
+
* const emotionStyles = emotionCss({ border: '1px solid red' });
|
|
50
|
+
*
|
|
51
|
+
* // Wrap the component — the HOC applies emotion styles when the experiment is off.
|
|
52
|
+
* const StyledButton = withCompiledMigration(Button, emotionStyles);
|
|
53
|
+
*
|
|
54
|
+
* // At the call site, apply compiled styles conditionally:
|
|
55
|
+
* export function App() {
|
|
56
|
+
* return (
|
|
57
|
+
* <StyledButton
|
|
58
|
+
* css={[expValEquals('platform_editor_static_css', 'isEnabled', true) && compiledStyles]}
|
|
59
|
+
* />
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export function withCompiledMigration(WrappedComponent, emotionStyles) {
|
|
65
|
+
var _ref, _WrappedComponent$dis;
|
|
66
|
+
// The cast is required because emotion's `css` prop is injected by the JSX pragma
|
|
67
|
+
// and is not part of the component's declared props type. We widen to P & { css? }
|
|
68
|
+
// so TypeScript accepts the css prop in the emotion branch while preserving P.
|
|
69
|
+
const Comp = WrappedComponent;
|
|
70
|
+
function MigrationGatedComponent(props) {
|
|
71
|
+
const compiledEnabled = expValEquals('platform_editor_static_css', 'isEnabled', true);
|
|
72
|
+
if (compiledEnabled) {
|
|
73
|
+
// Experiment ON — render directly. Compiled's statically-extracted CSS classes
|
|
74
|
+
// are applied inside the component via its own css prop. No Emotion code runs.
|
|
75
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- HOC must forward all props
|
|
76
|
+
return jsx(Comp, props);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Experiment OFF — render with Emotion css prop. Because this file has
|
|
80
|
+
// the emotion JSX pragma, Emotion's JSX runtime intercepts the css prop
|
|
81
|
+
// here, converts it to a className, and passes it through to the component.
|
|
82
|
+
// No wrapper div needed.
|
|
83
|
+
// eslint-disable-next-line react/jsx-props-no-spreading, @atlaskit/ui-styling-standard/use-compiled -- HOC must forward all props; intentional emotion usage for migration
|
|
84
|
+
return jsx(Comp, _extends({}, props, {
|
|
85
|
+
css: emotionStyles
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
const name = (_ref = (_WrappedComponent$dis = WrappedComponent.displayName) !== null && _WrappedComponent$dis !== void 0 ? _WrappedComponent$dis : WrappedComponent.name) !== null && _ref !== void 0 ? _ref : 'Component';
|
|
89
|
+
MigrationGatedComponent.displayName = `withCompiledMigration(${name})`;
|
|
90
|
+
return MigrationGatedComponent;
|
|
91
|
+
}
|
|
@@ -10,6 +10,11 @@ export const nativeEmbedToolbarMessages = defineMessages({
|
|
|
10
10
|
defaultMessage: 'Refresh',
|
|
11
11
|
description: 'Label for the button to refresh the embedded link.'
|
|
12
12
|
},
|
|
13
|
+
summarise: {
|
|
14
|
+
id: 'fabric.editor.nativeEmbeds.summarise',
|
|
15
|
+
defaultMessage: 'Summarize',
|
|
16
|
+
description: 'Label for the button to summarize the content of the embedded link using AI.'
|
|
17
|
+
},
|
|
13
18
|
setEmbedType: {
|
|
14
19
|
id: 'fabric.editor.setEmbedType.non-final',
|
|
15
20
|
defaultMessage: 'Set embed type',
|
|
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
|
|
|
4
4
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
5
5
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
6
6
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
7
|
-
const packageVersion = "112.
|
|
7
|
+
const packageVersion = "112.20.2";
|
|
8
8
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
9
9
|
// Remove URL as it has UGC
|
|
10
10
|
// Ignored via go/ees007
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "112.
|
|
17
|
+
const packageVersion = "112.20.2";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -1,3 +1,6 @@
|
|
|
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; }
|
|
1
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from './types/enums';
|
|
2
5
|
export var buildEditLinkPayload = function buildEditLinkPayload(type) {
|
|
3
6
|
return {
|
|
@@ -45,14 +48,19 @@ var buildVisitedHyperLinkPayload = function buildVisitedHyperLinkPayload() {
|
|
|
45
48
|
eventType: EVENT_TYPE.TRACK
|
|
46
49
|
};
|
|
47
50
|
};
|
|
48
|
-
export var buildVisitedNonHyperLinkPayload = function buildVisitedNonHyperLinkPayload(type, inputMethod) {
|
|
51
|
+
export var buildVisitedNonHyperLinkPayload = function buildVisitedNonHyperLinkPayload(type, inputMethod, resolvedAttributes) {
|
|
49
52
|
return {
|
|
50
53
|
action: ACTION.VISITED,
|
|
51
54
|
actionSubject: ACTION_SUBJECT.SMART_LINK,
|
|
52
55
|
actionSubjectId: type,
|
|
53
|
-
attributes: {
|
|
56
|
+
attributes: _objectSpread({
|
|
54
57
|
inputMethod: inputMethod
|
|
55
|
-
},
|
|
58
|
+
}, resolvedAttributes && {
|
|
59
|
+
displayCategory: resolvedAttributes.displayCategory,
|
|
60
|
+
extensionKey: resolvedAttributes.extensionKey,
|
|
61
|
+
status: resolvedAttributes.status,
|
|
62
|
+
statusDetails: resolvedAttributes.statusDetails
|
|
63
|
+
}),
|
|
56
64
|
eventType: EVENT_TYPE.TRACK
|
|
57
65
|
};
|
|
58
66
|
};
|
|
@@ -575,6 +575,7 @@ export var ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
575
575
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_LABEL"] = "syncedBlockLabel";
|
|
576
576
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_SSR_ERROR"] = "syncedBlockSSRError";
|
|
577
577
|
ACTION_SUBJECT_ID["TABLE_STICKY_HEADER"] = "tableStickyHeader";
|
|
578
|
+
ACTION_SUBJECT_ID["SNIPPET"] = "snippet";
|
|
578
579
|
return ACTION_SUBJECT_ID;
|
|
579
580
|
}({});
|
|
580
581
|
export var FLOATING_CONTROLS_TITLE = /*#__PURE__*/function (FLOATING_CONTROLS_TITLE) {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*
|
|
6
|
+
* IMPORTANT: This file MUST keep the emotion JSX pragma (@jsx jsx from @emotion/react).
|
|
7
|
+
* This is intentional — it allows the HOC to apply emotion styles via the css prop
|
|
8
|
+
* at the call site (where emotion's JSX runtime intercepts it), without requiring
|
|
9
|
+
* the wrapped component to use the emotion pragma itself.
|
|
10
|
+
*
|
|
11
|
+
* This file is part of the Emotion → Compiled CSS-in-JS migration infrastructure.
|
|
12
|
+
* It is temporary and should be removed once the migration is complete.
|
|
13
|
+
*
|
|
14
|
+
* @see https://hello.atlassian.net/wiki/spaces/~712020e6f24689f2da470b80ba6873df7b44a2/pages/6788274038/Emotion+-+Compiled+Feature+Gating+Strategy
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- intentional: this file must use emotion's JSX pragma to apply emotion styles via the css prop
|
|
18
|
+
import { jsx } from '@emotion/react';
|
|
19
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A HOC that enables per-component feature-gated migration from Emotion to Compiled CSS-in-JS.
|
|
23
|
+
*
|
|
24
|
+
* When the `platform_editor_static_css` experiment is ON:
|
|
25
|
+
* - Renders the component directly. Compiled's statically-extracted CSS classes are applied
|
|
26
|
+
* via the component's own `css` prop (using the Compiled pragma in the component file).
|
|
27
|
+
* - No Emotion code runs at all.
|
|
28
|
+
*
|
|
29
|
+
* When the experiment is OFF:
|
|
30
|
+
* - Renders the component with `css={emotionStyles}`. Because THIS file has the Emotion pragma,
|
|
31
|
+
* Emotion's JSX runtime intercepts the css prop here, converts it to a className string,
|
|
32
|
+
* and passes it to the component as `className`. No wrapper div, no ClassNames render prop.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* // button.tsx — the base component is style-agnostic, it just accepts className.
|
|
37
|
+
* export function Button({ className }: { className?: string }) {
|
|
38
|
+
* return <button className={className}>Click me</button>;
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // app.tsx — the call site handles both compiled and emotion styles.
|
|
42
|
+
* import { css } from '@compiled/react';
|
|
43
|
+
* import { css as emotionCss } from '@emotion/react';
|
|
44
|
+
* import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
45
|
+
* import { withCompiledMigration } from '@atlaskit/editor-common/compiled-migration';
|
|
46
|
+
* import { Button } from './button';
|
|
47
|
+
*
|
|
48
|
+
* const compiledStyles = css({ border: '1px solid red' });
|
|
49
|
+
* const emotionStyles = emotionCss({ border: '1px solid red' });
|
|
50
|
+
*
|
|
51
|
+
* // Wrap the component — the HOC applies emotion styles when the experiment is off.
|
|
52
|
+
* const StyledButton = withCompiledMigration(Button, emotionStyles);
|
|
53
|
+
*
|
|
54
|
+
* // At the call site, apply compiled styles conditionally:
|
|
55
|
+
* export function App() {
|
|
56
|
+
* return (
|
|
57
|
+
* <StyledButton
|
|
58
|
+
* css={[expValEquals('platform_editor_static_css', 'isEnabled', true) && compiledStyles]}
|
|
59
|
+
* />
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export function withCompiledMigration(WrappedComponent, emotionStyles) {
|
|
65
|
+
var _ref, _WrappedComponent$dis;
|
|
66
|
+
// The cast is required because emotion's `css` prop is injected by the JSX pragma
|
|
67
|
+
// and is not part of the component's declared props type. We widen to P & { css? }
|
|
68
|
+
// so TypeScript accepts the css prop in the emotion branch while preserving P.
|
|
69
|
+
var Comp = WrappedComponent;
|
|
70
|
+
function MigrationGatedComponent(props) {
|
|
71
|
+
var compiledEnabled = expValEquals('platform_editor_static_css', 'isEnabled', true);
|
|
72
|
+
if (compiledEnabled) {
|
|
73
|
+
// Experiment ON — render directly. Compiled's statically-extracted CSS classes
|
|
74
|
+
// are applied inside the component via its own css prop. No Emotion code runs.
|
|
75
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- HOC must forward all props
|
|
76
|
+
return jsx(Comp, props);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Experiment OFF — render with Emotion css prop. Because this file has
|
|
80
|
+
// the emotion JSX pragma, Emotion's JSX runtime intercepts the css prop
|
|
81
|
+
// here, converts it to a className, and passes it through to the component.
|
|
82
|
+
// No wrapper div needed.
|
|
83
|
+
// eslint-disable-next-line react/jsx-props-no-spreading, @atlaskit/ui-styling-standard/use-compiled -- HOC must forward all props; intentional emotion usage for migration
|
|
84
|
+
return jsx(Comp, _extends({}, props, {
|
|
85
|
+
css: emotionStyles
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
var name = (_ref = (_WrappedComponent$dis = WrappedComponent.displayName) !== null && _WrappedComponent$dis !== void 0 ? _WrappedComponent$dis : WrappedComponent.name) !== null && _ref !== void 0 ? _ref : 'Component';
|
|
89
|
+
MigrationGatedComponent.displayName = "withCompiledMigration(".concat(name, ")");
|
|
90
|
+
return MigrationGatedComponent;
|
|
91
|
+
}
|
|
@@ -10,6 +10,11 @@ export var nativeEmbedToolbarMessages = defineMessages({
|
|
|
10
10
|
defaultMessage: 'Refresh',
|
|
11
11
|
description: 'Label for the button to refresh the embedded link.'
|
|
12
12
|
},
|
|
13
|
+
summarise: {
|
|
14
|
+
id: 'fabric.editor.nativeEmbeds.summarise',
|
|
15
|
+
defaultMessage: 'Summarize',
|
|
16
|
+
description: 'Label for the button to summarize the content of the embedded link using AI.'
|
|
17
|
+
},
|
|
13
18
|
setEmbedType: {
|
|
14
19
|
id: 'fabric.editor.setEmbedType.non-final',
|
|
15
20
|
defaultMessage: 'Set embed type',
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "112.
|
|
13
|
+
var packageVersion = "112.20.2";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "112.
|
|
24
|
+
var packageVersion = "112.20.2";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -3,7 +3,12 @@ import type { AnalyticsEventPayload } from './types/events';
|
|
|
3
3
|
export declare const buildEditLinkPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
4
4
|
export type LinkType = ACTION_SUBJECT_ID.CARD_INLINE | ACTION_SUBJECT_ID.CARD_BLOCK | ACTION_SUBJECT_ID.EMBEDS | ACTION_SUBJECT_ID.HYPERLINK | ACTION_SUBJECT_ID.HOVER_LABEL;
|
|
5
5
|
export declare const buildVisitedLinkPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
6
|
-
export declare const buildVisitedNonHyperLinkPayload: (type: LinkType, inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.META_CLICK
|
|
6
|
+
export declare const buildVisitedNonHyperLinkPayload: (type: LinkType, inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.META_CLICK, resolvedAttributes?: {
|
|
7
|
+
displayCategory?: string | null;
|
|
8
|
+
extensionKey?: string | null;
|
|
9
|
+
status?: string | null;
|
|
10
|
+
statusDetails?: string | null;
|
|
11
|
+
}) => AnalyticsEventPayload;
|
|
7
12
|
export declare const buildOpenedSettingsPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
8
13
|
export declare const unlinkPayload: (type: LinkType) => {
|
|
9
14
|
action: ACTION;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ACTION, ACTION_SUBJECT } from './enums';
|
|
2
|
-
import type { TrackAEP } from './utils';
|
|
2
|
+
import type { OperationalAEP, TrackAEP } from './utils';
|
|
3
3
|
type AiAutocompleteInvokedAEP = TrackAEP<ACTION.INVOKED, ACTION_SUBJECT.AI_AUTOCOMPLETE, undefined, {
|
|
4
4
|
triggerType: TriggerType;
|
|
5
5
|
}, undefined>;
|
|
@@ -7,5 +7,9 @@ type AiAutocompleteViewedAEP = TrackAEP<ACTION.SUGGESTION_VIEWED, ACTION_SUBJECT
|
|
|
7
7
|
type AiAutocompleteAcceptedAEP = TrackAEP<ACTION.SUGGESTION_INSERTED, ACTION_SUBJECT.AI_AUTOCOMPLETE, undefined, undefined, undefined>;
|
|
8
8
|
type AiAutocompleteRejectedAEP = TrackAEP<ACTION.SUGGESTION_DISMISSED, ACTION_SUBJECT.AI_AUTOCOMPLETE, undefined, undefined, undefined>;
|
|
9
9
|
export type TriggerType = 'summary-heading' | 'summary-first-lines' | 'summary-panel' | 'conclusion-heading' | 'conclusion-last-lines' | 'next-steps-heading' | 'next-steps-last-lines' | 'cmd+shift+space';
|
|
10
|
-
|
|
10
|
+
type AiAutocompleteErroredAEP = OperationalAEP<ACTION.ERRORED, ACTION_SUBJECT.AI_AUTOCOMPLETE, undefined, {
|
|
11
|
+
errorMessage: string;
|
|
12
|
+
statusCode?: number;
|
|
13
|
+
}>;
|
|
14
|
+
export type AiAutocompleteEventPayload = AiAutocompleteInvokedAEP | AiAutocompleteViewedAEP | AiAutocompleteAcceptedAEP | AiAutocompleteRejectedAEP | AiAutocompleteErroredAEP;
|
|
11
15
|
export {};
|
|
@@ -565,7 +565,8 @@ export declare enum ACTION_SUBJECT_ID {
|
|
|
565
565
|
SYNCED_BLOCK_CLICK_SYNCED_LOCATION = "syncedBlockClickSyncedLocation",
|
|
566
566
|
SYNCED_BLOCK_LABEL = "syncedBlockLabel",
|
|
567
567
|
SYNCED_BLOCK_SSR_ERROR = "syncedBlockSSRError",
|
|
568
|
-
TABLE_STICKY_HEADER = "tableStickyHeader"
|
|
568
|
+
TABLE_STICKY_HEADER = "tableStickyHeader",
|
|
569
|
+
SNIPPET = "snippet"
|
|
569
570
|
}
|
|
570
571
|
export declare enum FLOATING_CONTROLS_TITLE {
|
|
571
572
|
CODE_BLOCK = "codeBlockFloatingControls",
|
|
@@ -150,5 +150,13 @@ type InsertReferenceSyncedBlockPayload = InsertAEP<ACTION_SUBJECT_ID.SYNCED_BLOC
|
|
|
150
150
|
export type InsertSourceSyncedBlockPayload = InsertAEP<ACTION_SUBJECT_ID.BODIED_SYNCED_BLOCK, {
|
|
151
151
|
resourceId: string;
|
|
152
152
|
}, undefined>;
|
|
153
|
-
|
|
153
|
+
type InsertSnippetAEP = InsertAEP<ACTION_SUBJECT_ID.SNIPPET, {
|
|
154
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT;
|
|
155
|
+
snippetId: string;
|
|
156
|
+
}, undefined>;
|
|
157
|
+
type FailedToInsertSnippetAEP = OperationalAEP<ACTION.FAILED_TO_INSERT, ACTION_SUBJECT.DOCUMENT, ACTION_SUBJECT_ID.SNIPPET, {
|
|
158
|
+
reason: 'emptyBody' | 'parseError';
|
|
159
|
+
snippetId: string;
|
|
160
|
+
}>;
|
|
161
|
+
export type InsertEventPayload = InsertDividerAEP | InsertLineBreakAEP | InsertPanelAEP | InsertCodeBlockAEP | InsertTableAEP | InsertExpandAEP | InsertActionDecisionAEP | InsertEmojiAEP | InsertStatusAEP | InsertMediaSingleAEP | InsertMediaGroupAEP | InsertMediaInlineAEP | InsertLinkAEP | InsertLinkPreviewAEP | InsertMediaLinkAEP | InsertSmartLinkAEP | InsertLayoutAEP | InsertExtensionAEP | InsertNodeViaExtensionAPIAEP | InsertDateAEP | InsertPlaceholderTextAEP | InsertNativeEmbedAEP | FailedToInsertMediaPayload | InsertReferenceSyncedBlockPayload | InsertSourceSyncedBlockPayload | InsertSnippetAEP | FailedToInsertSnippetAEP;
|
|
154
162
|
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: This file MUST keep the emotion JSX pragma (@jsx jsx from @emotion/react).
|
|
6
|
+
* This is intentional — it allows the HOC to apply emotion styles via the css prop
|
|
7
|
+
* at the call site (where emotion's JSX runtime intercepts it), without requiring
|
|
8
|
+
* the wrapped component to use the emotion pragma itself.
|
|
9
|
+
*
|
|
10
|
+
* This file is part of the Emotion → Compiled CSS-in-JS migration infrastructure.
|
|
11
|
+
* It is temporary and should be removed once the migration is complete.
|
|
12
|
+
*
|
|
13
|
+
* @see https://hello.atlassian.net/wiki/spaces/~712020e6f24689f2da470b80ba6873df7b44a2/pages/6788274038/Emotion+-+Compiled+Feature+Gating+Strategy
|
|
14
|
+
*/
|
|
15
|
+
import type { ComponentType } from 'react';
|
|
16
|
+
import { jsx, type SerializedStyles } from '@emotion/react';
|
|
17
|
+
/**
|
|
18
|
+
* A HOC that enables per-component feature-gated migration from Emotion to Compiled CSS-in-JS.
|
|
19
|
+
*
|
|
20
|
+
* When the `platform_editor_static_css` experiment is ON:
|
|
21
|
+
* - Renders the component directly. Compiled's statically-extracted CSS classes are applied
|
|
22
|
+
* via the component's own `css` prop (using the Compiled pragma in the component file).
|
|
23
|
+
* - No Emotion code runs at all.
|
|
24
|
+
*
|
|
25
|
+
* When the experiment is OFF:
|
|
26
|
+
* - Renders the component with `css={emotionStyles}`. Because THIS file has the Emotion pragma,
|
|
27
|
+
* Emotion's JSX runtime intercepts the css prop here, converts it to a className string,
|
|
28
|
+
* and passes it to the component as `className`. No wrapper div, no ClassNames render prop.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // button.tsx — the base component is style-agnostic, it just accepts className.
|
|
33
|
+
* export function Button({ className }: { className?: string }) {
|
|
34
|
+
* return <button className={className}>Click me</button>;
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* // app.tsx — the call site handles both compiled and emotion styles.
|
|
38
|
+
* import { css } from '@compiled/react';
|
|
39
|
+
* import { css as emotionCss } from '@emotion/react';
|
|
40
|
+
* import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
41
|
+
* import { withCompiledMigration } from '@atlaskit/editor-common/compiled-migration';
|
|
42
|
+
* import { Button } from './button';
|
|
43
|
+
*
|
|
44
|
+
* const compiledStyles = css({ border: '1px solid red' });
|
|
45
|
+
* const emotionStyles = emotionCss({ border: '1px solid red' });
|
|
46
|
+
*
|
|
47
|
+
* // Wrap the component — the HOC applies emotion styles when the experiment is off.
|
|
48
|
+
* const StyledButton = withCompiledMigration(Button, emotionStyles);
|
|
49
|
+
*
|
|
50
|
+
* // At the call site, apply compiled styles conditionally:
|
|
51
|
+
* export function App() {
|
|
52
|
+
* return (
|
|
53
|
+
* <StyledButton
|
|
54
|
+
* css={[expValEquals('platform_editor_static_css', 'isEnabled', true) && compiledStyles]}
|
|
55
|
+
* />
|
|
56
|
+
* );
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function withCompiledMigration<P extends {
|
|
61
|
+
className?: string;
|
|
62
|
+
}>(WrappedComponent: ComponentType<P>, emotionStyles: SerializedStyles): {
|
|
63
|
+
(props: P): jsx.JSX.Element;
|
|
64
|
+
displayName: string;
|
|
65
|
+
};
|
|
@@ -3,7 +3,12 @@ import type { AnalyticsEventPayload } from './types/events';
|
|
|
3
3
|
export declare const buildEditLinkPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
4
4
|
export type LinkType = ACTION_SUBJECT_ID.CARD_INLINE | ACTION_SUBJECT_ID.CARD_BLOCK | ACTION_SUBJECT_ID.EMBEDS | ACTION_SUBJECT_ID.HYPERLINK | ACTION_SUBJECT_ID.HOVER_LABEL;
|
|
5
5
|
export declare const buildVisitedLinkPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
6
|
-
export declare const buildVisitedNonHyperLinkPayload: (type: LinkType, inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.META_CLICK
|
|
6
|
+
export declare const buildVisitedNonHyperLinkPayload: (type: LinkType, inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.BUTTON | INPUT_METHOD.DOUBLE_CLICK | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.META_CLICK, resolvedAttributes?: {
|
|
7
|
+
displayCategory?: string | null;
|
|
8
|
+
extensionKey?: string | null;
|
|
9
|
+
status?: string | null;
|
|
10
|
+
statusDetails?: string | null;
|
|
11
|
+
}) => AnalyticsEventPayload;
|
|
7
12
|
export declare const buildOpenedSettingsPayload: (type: LinkType) => AnalyticsEventPayload;
|
|
8
13
|
export declare const unlinkPayload: (type: LinkType) => {
|
|
9
14
|
action: ACTION;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ACTION, ACTION_SUBJECT } from './enums';
|
|
2
|
-
import type { TrackAEP } from './utils';
|
|
2
|
+
import type { OperationalAEP, TrackAEP } from './utils';
|
|
3
3
|
type AiAutocompleteInvokedAEP = TrackAEP<ACTION.INVOKED, ACTION_SUBJECT.AI_AUTOCOMPLETE, undefined, {
|
|
4
4
|
triggerType: TriggerType;
|
|
5
5
|
}, undefined>;
|
|
@@ -7,5 +7,9 @@ type AiAutocompleteViewedAEP = TrackAEP<ACTION.SUGGESTION_VIEWED, ACTION_SUBJECT
|
|
|
7
7
|
type AiAutocompleteAcceptedAEP = TrackAEP<ACTION.SUGGESTION_INSERTED, ACTION_SUBJECT.AI_AUTOCOMPLETE, undefined, undefined, undefined>;
|
|
8
8
|
type AiAutocompleteRejectedAEP = TrackAEP<ACTION.SUGGESTION_DISMISSED, ACTION_SUBJECT.AI_AUTOCOMPLETE, undefined, undefined, undefined>;
|
|
9
9
|
export type TriggerType = 'summary-heading' | 'summary-first-lines' | 'summary-panel' | 'conclusion-heading' | 'conclusion-last-lines' | 'next-steps-heading' | 'next-steps-last-lines' | 'cmd+shift+space';
|
|
10
|
-
|
|
10
|
+
type AiAutocompleteErroredAEP = OperationalAEP<ACTION.ERRORED, ACTION_SUBJECT.AI_AUTOCOMPLETE, undefined, {
|
|
11
|
+
errorMessage: string;
|
|
12
|
+
statusCode?: number;
|
|
13
|
+
}>;
|
|
14
|
+
export type AiAutocompleteEventPayload = AiAutocompleteInvokedAEP | AiAutocompleteViewedAEP | AiAutocompleteAcceptedAEP | AiAutocompleteRejectedAEP | AiAutocompleteErroredAEP;
|
|
11
15
|
export {};
|
|
@@ -565,7 +565,8 @@ export declare enum ACTION_SUBJECT_ID {
|
|
|
565
565
|
SYNCED_BLOCK_CLICK_SYNCED_LOCATION = "syncedBlockClickSyncedLocation",
|
|
566
566
|
SYNCED_BLOCK_LABEL = "syncedBlockLabel",
|
|
567
567
|
SYNCED_BLOCK_SSR_ERROR = "syncedBlockSSRError",
|
|
568
|
-
TABLE_STICKY_HEADER = "tableStickyHeader"
|
|
568
|
+
TABLE_STICKY_HEADER = "tableStickyHeader",
|
|
569
|
+
SNIPPET = "snippet"
|
|
569
570
|
}
|
|
570
571
|
export declare enum FLOATING_CONTROLS_TITLE {
|
|
571
572
|
CODE_BLOCK = "codeBlockFloatingControls",
|
|
@@ -150,5 +150,13 @@ type InsertReferenceSyncedBlockPayload = InsertAEP<ACTION_SUBJECT_ID.SYNCED_BLOC
|
|
|
150
150
|
export type InsertSourceSyncedBlockPayload = InsertAEP<ACTION_SUBJECT_ID.BODIED_SYNCED_BLOCK, {
|
|
151
151
|
resourceId: string;
|
|
152
152
|
}, undefined>;
|
|
153
|
-
|
|
153
|
+
type InsertSnippetAEP = InsertAEP<ACTION_SUBJECT_ID.SNIPPET, {
|
|
154
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT;
|
|
155
|
+
snippetId: string;
|
|
156
|
+
}, undefined>;
|
|
157
|
+
type FailedToInsertSnippetAEP = OperationalAEP<ACTION.FAILED_TO_INSERT, ACTION_SUBJECT.DOCUMENT, ACTION_SUBJECT_ID.SNIPPET, {
|
|
158
|
+
reason: 'emptyBody' | 'parseError';
|
|
159
|
+
snippetId: string;
|
|
160
|
+
}>;
|
|
161
|
+
export type InsertEventPayload = InsertDividerAEP | InsertLineBreakAEP | InsertPanelAEP | InsertCodeBlockAEP | InsertTableAEP | InsertExpandAEP | InsertActionDecisionAEP | InsertEmojiAEP | InsertStatusAEP | InsertMediaSingleAEP | InsertMediaGroupAEP | InsertMediaInlineAEP | InsertLinkAEP | InsertLinkPreviewAEP | InsertMediaLinkAEP | InsertSmartLinkAEP | InsertLayoutAEP | InsertExtensionAEP | InsertNodeViaExtensionAPIAEP | InsertDateAEP | InsertPlaceholderTextAEP | InsertNativeEmbedAEP | FailedToInsertMediaPayload | InsertReferenceSyncedBlockPayload | InsertSourceSyncedBlockPayload | InsertSnippetAEP | FailedToInsertSnippetAEP;
|
|
154
162
|
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: This file MUST keep the emotion JSX pragma (@jsx jsx from @emotion/react).
|
|
6
|
+
* This is intentional — it allows the HOC to apply emotion styles via the css prop
|
|
7
|
+
* at the call site (where emotion's JSX runtime intercepts it), without requiring
|
|
8
|
+
* the wrapped component to use the emotion pragma itself.
|
|
9
|
+
*
|
|
10
|
+
* This file is part of the Emotion → Compiled CSS-in-JS migration infrastructure.
|
|
11
|
+
* It is temporary and should be removed once the migration is complete.
|
|
12
|
+
*
|
|
13
|
+
* @see https://hello.atlassian.net/wiki/spaces/~712020e6f24689f2da470b80ba6873df7b44a2/pages/6788274038/Emotion+-+Compiled+Feature+Gating+Strategy
|
|
14
|
+
*/
|
|
15
|
+
import type { ComponentType } from 'react';
|
|
16
|
+
import { jsx, type SerializedStyles } from '@emotion/react';
|
|
17
|
+
/**
|
|
18
|
+
* A HOC that enables per-component feature-gated migration from Emotion to Compiled CSS-in-JS.
|
|
19
|
+
*
|
|
20
|
+
* When the `platform_editor_static_css` experiment is ON:
|
|
21
|
+
* - Renders the component directly. Compiled's statically-extracted CSS classes are applied
|
|
22
|
+
* via the component's own `css` prop (using the Compiled pragma in the component file).
|
|
23
|
+
* - No Emotion code runs at all.
|
|
24
|
+
*
|
|
25
|
+
* When the experiment is OFF:
|
|
26
|
+
* - Renders the component with `css={emotionStyles}`. Because THIS file has the Emotion pragma,
|
|
27
|
+
* Emotion's JSX runtime intercepts the css prop here, converts it to a className string,
|
|
28
|
+
* and passes it to the component as `className`. No wrapper div, no ClassNames render prop.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // button.tsx — the base component is style-agnostic, it just accepts className.
|
|
33
|
+
* export function Button({ className }: { className?: string }) {
|
|
34
|
+
* return <button className={className}>Click me</button>;
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* // app.tsx — the call site handles both compiled and emotion styles.
|
|
38
|
+
* import { css } from '@compiled/react';
|
|
39
|
+
* import { css as emotionCss } from '@emotion/react';
|
|
40
|
+
* import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
41
|
+
* import { withCompiledMigration } from '@atlaskit/editor-common/compiled-migration';
|
|
42
|
+
* import { Button } from './button';
|
|
43
|
+
*
|
|
44
|
+
* const compiledStyles = css({ border: '1px solid red' });
|
|
45
|
+
* const emotionStyles = emotionCss({ border: '1px solid red' });
|
|
46
|
+
*
|
|
47
|
+
* // Wrap the component — the HOC applies emotion styles when the experiment is off.
|
|
48
|
+
* const StyledButton = withCompiledMigration(Button, emotionStyles);
|
|
49
|
+
*
|
|
50
|
+
* // At the call site, apply compiled styles conditionally:
|
|
51
|
+
* export function App() {
|
|
52
|
+
* return (
|
|
53
|
+
* <StyledButton
|
|
54
|
+
* css={[expValEquals('platform_editor_static_css', 'isEnabled', true) && compiledStyles]}
|
|
55
|
+
* />
|
|
56
|
+
* );
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function withCompiledMigration<P extends {
|
|
61
|
+
className?: string;
|
|
62
|
+
}>(WrappedComponent: ComponentType<P>, emotionStyles: SerializedStyles): {
|
|
63
|
+
(props: P): jsx.JSX.Element;
|
|
64
|
+
displayName: string;
|
|
65
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "112.
|
|
3
|
+
"version": "112.20.2",
|
|
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/"
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"@atlaskit/icon": "^34.0.0",
|
|
55
55
|
"@atlaskit/icon-object": "^7.5.0",
|
|
56
56
|
"@atlaskit/link": "^3.4.0",
|
|
57
|
-
"@atlaskit/link-datasource": "^
|
|
58
|
-
"@atlaskit/link-picker": "^
|
|
57
|
+
"@atlaskit/link-datasource": "^5.0.0",
|
|
58
|
+
"@atlaskit/link-picker": "^5.0.0",
|
|
59
59
|
"@atlaskit/media-card": "^79.16.0",
|
|
60
60
|
"@atlaskit/media-client": "^36.0.0",
|
|
61
61
|
"@atlaskit/media-client-react": "^5.0.0",
|
|
@@ -69,18 +69,18 @@
|
|
|
69
69
|
"@atlaskit/onboarding": "^14.5.0",
|
|
70
70
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
71
71
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
72
|
-
"@atlaskit/primitives": "^
|
|
72
|
+
"@atlaskit/primitives": "^19.0.0",
|
|
73
73
|
"@atlaskit/profilecard": "^24.49.0",
|
|
74
74
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
75
|
-
"@atlaskit/react-ufo": "^5.
|
|
75
|
+
"@atlaskit/react-ufo": "^5.13.0",
|
|
76
76
|
"@atlaskit/section-message": "^8.12.0",
|
|
77
|
-
"@atlaskit/smart-card": "^
|
|
77
|
+
"@atlaskit/smart-card": "^44.0.0",
|
|
78
78
|
"@atlaskit/smart-user-picker": "^9.2.0",
|
|
79
79
|
"@atlaskit/spinner": "^19.1.0",
|
|
80
80
|
"@atlaskit/task-decision": "^19.3.0",
|
|
81
81
|
"@atlaskit/textfield": "^8.3.0",
|
|
82
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
83
|
-
"@atlaskit/tokens": "^
|
|
82
|
+
"@atlaskit/tmp-editor-statsig": "^60.2.0",
|
|
83
|
+
"@atlaskit/tokens": "^13.0.0",
|
|
84
84
|
"@atlaskit/tooltip": "^21.1.0",
|
|
85
85
|
"@atlaskit/width-detector": "^5.0.0",
|
|
86
86
|
"@babel/runtime": "^7.0.0",
|