@atlaskit/editor-common 118.9.0 → 118.10.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,24 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 118.10.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 118.10.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`3a4c286fdb8c1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3a4c286fdb8c1) -
14
+ Add registry-backed Quick Insert search matching under the existing
15
+ `platform_editor_slash_command` experiment. Make native, provider, and extension registered Quick
16
+ Insert items searchable.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 118.9.0
4
23
 
5
24
  ### Minor Changes
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
28
28
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
29
29
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
30
30
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
31
- var packageVersion = "118.8.0";
31
+ var packageVersion = "118.10.0";
32
32
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
33
33
  // Remove URL as it has UGC
34
34
  // Ignored via go/ees007
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createQuickInsertMatcher = void 0;
8
+ var _fuse = _interopRequireDefault(require("fuse.js"));
9
+ var options = {
10
+ includeScore: true,
11
+ keys: [{
12
+ name: 'title',
13
+ weight: 0.57
14
+ }, {
15
+ name: 'keywords',
16
+ weight: 0.08
17
+ }, {
18
+ name: 'description',
19
+ weight: 0.04
20
+ }, {
21
+ name: 'shortcut',
22
+ weight: 0.01
23
+ }],
24
+ threshold: 0.3
25
+ };
26
+ var normalizeScore = function normalizeScore(score) {
27
+ return Math.min(1, Math.max(0, score !== null && score !== void 0 ? score : 1));
28
+ };
29
+
30
+ /** Creates a cached matcher using consumer-formatted Quick Insert search data. */
31
+ var createQuickInsertMatcher = exports.createQuickInsertMatcher = function createQuickInsertMatcher(getSearchData) {
32
+ var cachedFormatMessage;
33
+ var fuse;
34
+ return function (_ref) {
35
+ var formatMessage = _ref.formatMessage,
36
+ query = _ref.query;
37
+ var normalizedQuery = query.trim();
38
+ if (!normalizedQuery) {
39
+ return {
40
+ score: 0
41
+ };
42
+ }
43
+ if (!fuse || cachedFormatMessage !== formatMessage) {
44
+ fuse = new _fuse.default([getSearchData({
45
+ formatMessage: formatMessage
46
+ })], options);
47
+ cachedFormatMessage = formatMessage;
48
+ }
49
+ var result = fuse.search(normalizedQuery)[0];
50
+ return result ? {
51
+ score: normalizeScore(result.score)
52
+ } : null;
53
+ };
54
+ };
@@ -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 = "118.8.0";
27
+ var packageVersion = "118.10.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
14
14
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
15
15
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
16
16
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
17
- const packageVersion = "118.8.0";
17
+ const packageVersion = "118.10.0";
18
18
  const sanitiseSentryEvents = (data, _hint) => {
19
19
  // Remove URL as it has UGC
20
20
  // Ignored via go/ees007
@@ -0,0 +1,46 @@
1
+ import Fuse from 'fuse.js';
2
+ const options = {
3
+ includeScore: true,
4
+ keys: [{
5
+ name: 'title',
6
+ weight: 0.57
7
+ }, {
8
+ name: 'keywords',
9
+ weight: 0.08
10
+ }, {
11
+ name: 'description',
12
+ weight: 0.04
13
+ }, {
14
+ name: 'shortcut',
15
+ weight: 0.01
16
+ }],
17
+ threshold: 0.3
18
+ };
19
+ const normalizeScore = score => Math.min(1, Math.max(0, score !== null && score !== void 0 ? score : 1));
20
+
21
+ /** Creates a cached matcher using consumer-formatted Quick Insert search data. */
22
+ export const createQuickInsertMatcher = getSearchData => {
23
+ let cachedFormatMessage;
24
+ let fuse;
25
+ return ({
26
+ formatMessage,
27
+ query
28
+ }) => {
29
+ const normalizedQuery = query.trim();
30
+ if (!normalizedQuery) {
31
+ return {
32
+ score: 0
33
+ };
34
+ }
35
+ if (!fuse || cachedFormatMessage !== formatMessage) {
36
+ fuse = new Fuse([getSearchData({
37
+ formatMessage
38
+ })], options);
39
+ cachedFormatMessage = formatMessage;
40
+ }
41
+ const result = fuse.search(normalizedQuery)[0];
42
+ return result ? {
43
+ score: normalizeScore(result.score)
44
+ } : null;
45
+ };
46
+ };
@@ -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 = "118.8.0";
17
+ const packageVersion = "118.10.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
20
20
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
21
21
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
22
22
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
23
- var packageVersion = "118.8.0";
23
+ var packageVersion = "118.10.0";
24
24
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
25
25
  // Remove URL as it has UGC
26
26
  // Ignored via go/ees007
@@ -0,0 +1,47 @@
1
+ import Fuse from 'fuse.js';
2
+ var options = {
3
+ includeScore: true,
4
+ keys: [{
5
+ name: 'title',
6
+ weight: 0.57
7
+ }, {
8
+ name: 'keywords',
9
+ weight: 0.08
10
+ }, {
11
+ name: 'description',
12
+ weight: 0.04
13
+ }, {
14
+ name: 'shortcut',
15
+ weight: 0.01
16
+ }],
17
+ threshold: 0.3
18
+ };
19
+ var normalizeScore = function normalizeScore(score) {
20
+ return Math.min(1, Math.max(0, score !== null && score !== void 0 ? score : 1));
21
+ };
22
+
23
+ /** Creates a cached matcher using consumer-formatted Quick Insert search data. */
24
+ export var createQuickInsertMatcher = function createQuickInsertMatcher(getSearchData) {
25
+ var cachedFormatMessage;
26
+ var fuse;
27
+ return function (_ref) {
28
+ var formatMessage = _ref.formatMessage,
29
+ query = _ref.query;
30
+ var normalizedQuery = query.trim();
31
+ if (!normalizedQuery) {
32
+ return {
33
+ score: 0
34
+ };
35
+ }
36
+ if (!fuse || cachedFormatMessage !== formatMessage) {
37
+ fuse = new Fuse([getSearchData({
38
+ formatMessage: formatMessage
39
+ })], options);
40
+ cachedFormatMessage = formatMessage;
41
+ }
42
+ var result = fuse.search(normalizedQuery)[0];
43
+ return result ? {
44
+ score: normalizeScore(result.score)
45
+ } : null;
46
+ };
47
+ };
@@ -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 = "118.8.0";
24
+ var packageVersion = "118.10.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -0,0 +1,13 @@
1
+ import type { RegisterMenuItemMatch } from '@atlaskit/editor-ui-control-model/types';
2
+ type QuickInsertSearchData = {
3
+ description?: string;
4
+ keywords?: string[];
5
+ shortcut?: string;
6
+ title: string;
7
+ };
8
+ type FormatMessage = Parameters<RegisterMenuItemMatch>[0]['formatMessage'];
9
+ /** Creates a cached matcher using consumer-formatted Quick Insert search data. */
10
+ export declare const createQuickInsertMatcher: (getSearchData: (context: {
11
+ formatMessage: FormatMessage;
12
+ }) => QuickInsertSearchData) => RegisterMenuItemMatch;
13
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "118.9.0",
3
+ "version": "118.10.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/"
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/editor-tables": "^3.0.0",
50
50
  "@atlaskit/editor-toolbar": "^2.4.0",
51
51
  "@atlaskit/editor-toolbar-model": "^1.2.0",
52
- "@atlaskit/editor-ui-control-model": "^2.5.0",
52
+ "@atlaskit/editor-ui-control-model": "^2.6.0",
53
53
  "@atlaskit/emoji": "^71.16.0",
54
54
  "@atlaskit/feature-gate-js-client": "^6.0.0",
55
55
  "@atlaskit/icon": "^37.3.0",
@@ -76,7 +76,7 @@
76
76
  "@atlaskit/profilecard": "^26.17.0",
77
77
  "@atlaskit/prosemirror-history": "^1.1.0",
78
78
  "@atlaskit/react-compiler-gating": "^0.2.0",
79
- "@atlaskit/react-ufo": "^7.3.0",
79
+ "@atlaskit/react-ufo": "^7.4.0",
80
80
  "@atlaskit/section-message": "^10.0.0",
81
81
  "@atlaskit/smart-card": "^45.17.0",
82
82
  "@atlaskit/smart-user-picker": "^11.5.0",
@@ -84,12 +84,12 @@
84
84
  "@atlaskit/task-decision": "^21.8.0",
85
85
  "@atlaskit/teams-app-config": "^2.2.0",
86
86
  "@atlaskit/textfield": "^10.0.0",
87
- "@atlaskit/tmp-editor-statsig": "^146.0.0",
88
- "@atlaskit/tokens": "^16.6.0",
87
+ "@atlaskit/tmp-editor-statsig": "^147.0.0",
88
+ "@atlaskit/tokens": "^16.7.0",
89
89
  "@atlaskit/tooltip": "^24.0.0",
90
90
  "@atlaskit/width-detector": "^7.0.0",
91
91
  "@babel/runtime": "^7.0.0",
92
- "@compiled/react": "^1.0.0",
92
+ "@compiled/react": "^1.0.2",
93
93
  "@emotion/react": "^11.7.1",
94
94
  "@popperjs/core": "^2.11.8",
95
95
  "@sentry/browser": "^6.18.2",
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/quick-insert/create-quick-insert-matcher",
3
+ "main": "../../dist/cjs/quick-insert/createQuickInsertMatcher.js",
4
+ "module": "../../dist/esm/quick-insert/createQuickInsertMatcher.js",
5
+ "module:es2019": "../../dist/es2019/quick-insert/createQuickInsertMatcher.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/quick-insert/createQuickInsertMatcher.d.ts"
10
+ }