@atlaskit/renderer 109.10.6 → 109.11.0

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/actions/index.js +4 -1
  3. package/dist/cjs/react/nodes/embedCard.js +1 -1
  4. package/dist/cjs/ui/Renderer/index.js +1 -1
  5. package/dist/cjs/ui/annotations/context.js +16 -6
  6. package/dist/cjs/ui/annotations/contexts/AnnotationRangeContext.js +48 -8
  7. package/dist/cjs/ui/annotations/hooks/user-selection.js +18 -14
  8. package/dist/cjs/ui/annotations/selection/mounter.js +15 -4
  9. package/dist/cjs/ui/annotations/selection/range-validator.js +9 -5
  10. package/dist/cjs/ui/annotations/wrapper.js +15 -1
  11. package/dist/es2019/actions/index.js +4 -1
  12. package/dist/es2019/react/nodes/embedCard.js +1 -1
  13. package/dist/es2019/ui/Renderer/index.js +1 -1
  14. package/dist/es2019/ui/annotations/context.js +19 -7
  15. package/dist/es2019/ui/annotations/contexts/AnnotationRangeContext.js +42 -3
  16. package/dist/es2019/ui/annotations/hooks/user-selection.js +19 -15
  17. package/dist/es2019/ui/annotations/selection/mounter.js +15 -4
  18. package/dist/es2019/ui/annotations/selection/range-validator.js +7 -4
  19. package/dist/es2019/ui/annotations/wrapper.js +17 -1
  20. package/dist/esm/actions/index.js +4 -1
  21. package/dist/esm/react/nodes/embedCard.js +1 -1
  22. package/dist/esm/ui/Renderer/index.js +1 -1
  23. package/dist/esm/ui/annotations/context.js +16 -6
  24. package/dist/esm/ui/annotations/contexts/AnnotationRangeContext.js +48 -8
  25. package/dist/esm/ui/annotations/hooks/user-selection.js +19 -15
  26. package/dist/esm/ui/annotations/selection/mounter.js +15 -4
  27. package/dist/esm/ui/annotations/selection/range-validator.js +9 -5
  28. package/dist/esm/ui/annotations/wrapper.js +15 -1
  29. package/dist/types/actions/index.d.ts +7 -6
  30. package/dist/types/ui/annotations/context.d.ts +2 -0
  31. package/dist/types/ui/annotations/contexts/AnnotationRangeContext.d.ts +3 -0
  32. package/dist/types/ui/annotations/hooks/user-selection.d.ts +1 -1
  33. package/dist/types/ui/annotations/hover/mounter.d.ts +2 -2
  34. package/dist/types/ui/annotations/selection/mounter.d.ts +5 -4
  35. package/dist/types/ui/annotations/selection/range-validator.d.ts +2 -2
  36. package/dist/types-ts4.5/actions/index.d.ts +7 -6
  37. package/dist/types-ts4.5/ui/annotations/context.d.ts +2 -0
  38. package/dist/types-ts4.5/ui/annotations/contexts/AnnotationRangeContext.d.ts +3 -0
  39. package/dist/types-ts4.5/ui/annotations/hooks/user-selection.d.ts +1 -0
  40. package/dist/types-ts4.5/ui/annotations/hover/mounter.d.ts +2 -2
  41. package/dist/types-ts4.5/ui/annotations/selection/mounter.d.ts +5 -4
  42. package/dist/types-ts4.5/ui/annotations/selection/range-validator.d.ts +2 -2
  43. package/package.json +3 -3
  44. package/.eslintrc.js +0 -8
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import type { AnnotationByMatches, InlineCommentSelectionComponentProps } from '@atlaskit/editor-common/types';
2
+ import type { AnnotationByMatches, InlineCommentHoverComponentProps } from '@atlaskit/editor-common/types';
3
3
  import type { ApplyAnnotation } from '../../../actions/index';
4
4
  import type { Position } from '../types';
5
5
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
6
6
  type Props = {
7
7
  range: Range;
8
- component: React.ComponentType<InlineCommentSelectionComponentProps>;
8
+ component: React.ComponentType<InlineCommentHoverComponentProps>;
9
9
  wrapperDOM: React.RefObject<HTMLDivElement>;
10
10
  documentPosition: Position | false;
11
11
  isAnnotationAllowed: boolean;
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { AnnotationByMatches, InlineCommentSelectionComponentProps } from '@atlaskit/editor-common/types';
3
- import { ApplyAnnotation } from '../../../actions/index';
4
- import { Position } from '../types';
5
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import type { ApplyAnnotation } from '../../../actions/index';
4
+ import type { Position } from '../types';
5
+ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
6
6
  type Props = {
7
- range: Range;
7
+ range: Range | null;
8
+ draftRange: Range | null;
8
9
  component: React.ComponentType<React.PropsWithChildren<InlineCommentSelectionComponentProps>>;
9
10
  wrapperDOM: React.RefObject<HTMLDivElement>;
10
11
  documentPosition: Position | false;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Position } from '../types';
2
+ import type { Position } from '../types';
3
3
  import type { InlineCommentSelectionComponentProps } from '@atlaskit/editor-common/types';
4
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
5
  type Props = {
6
6
  selectionComponent: React.ComponentType<React.PropsWithChildren<InlineCommentSelectionComponentProps>>;
7
7
  rendererRef: React.RefObject<HTMLDivElement>;
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
+ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
3
3
  import type { AnnotationActionResult, AnnotationByMatches } from '@atlaskit/editor-common/types';
4
4
  import { AnnotationTypes } from '@atlaskit/adf-schema';
5
- import { Node, Schema, Mark } from '@atlaskit/editor-prosemirror/model';
6
- import { Step, RemoveMarkStep } from '@atlaskit/editor-prosemirror/transform';
7
- import { AnalyticsEventPayload } from '../analytics/events';
5
+ import type { Node, Schema, Mark } from '@atlaskit/editor-prosemirror/model';
6
+ import type { Step } from '@atlaskit/editor-prosemirror/transform';
7
+ import { RemoveMarkStep } from '@atlaskit/editor-prosemirror/transform';
8
+ import type { AnalyticsEventPayload } from '../analytics/events';
8
9
  type ActionResult = {
9
10
  step: Step;
10
11
  doc: JSONDocNode;
@@ -50,9 +51,9 @@ export default class RendererActions implements RendererActionsOptions, Annotati
50
51
  doc: JSONDocNode;
51
52
  };
52
53
  annotate(range: Range, annotationId: string, annotationType: 'inlineComment'): AnnotationActionResult;
53
- isValidAnnotationRange(range: Range): boolean;
54
+ isValidAnnotationRange(range: Range | null): boolean;
54
55
  isValidAnnotationPosition(pos: Position): boolean;
55
- getPositionFromRange(range: Range): Position | false;
56
+ getPositionFromRange(range: Range | null): Position | false;
56
57
  getAnnotationMarks(): Mark[];
57
58
  getAnnotationsByPosition(range: Range): string[];
58
59
  applyAnnotation(pos: Position, annotation: Annotation): AnnotationActionResult;
@@ -8,6 +8,8 @@ export type AnnotationsDraftContextWrapperChildrenProps = {
8
8
  };
9
9
  export type RenderCallbackType = (props: React.PropsWithChildren<AnnotationsDraftContextWrapperChildrenProps>) => React.ReactNode;
10
10
  type Props = {
11
+ setDraftRange: () => void;
12
+ clearDraftRange: () => void;
11
13
  children: RenderCallbackType;
12
14
  };
13
15
  type State = {
@@ -2,13 +2,16 @@ import type { ReactNode } from 'react';
2
2
  import React from 'react';
3
3
  interface AnnotationRangeStateContext {
4
4
  range: Range | null;
5
+ draftRange: Range | null;
5
6
  type: 'selection' | 'hover' | null;
6
7
  }
7
8
  interface AnnotationRangeDispatchContext {
8
9
  clearRange: () => void;
9
10
  clearSelectionRange: () => void;
11
+ clearDraftRange: () => void;
10
12
  clearHoverRange: () => void;
11
13
  setRange: (range: Range) => void;
14
+ setDraftRange: (draftRange: Range | null) => void;
12
15
  setHoverTarget?: (target: HTMLElement) => void;
13
16
  }
14
17
  export declare const AnnotationRangeStateContext: React.Context<AnnotationRangeStateContext>;
@@ -3,6 +3,7 @@ type Props = {
3
3
  rendererRef: React.RefObject<HTMLDivElement>;
4
4
  };
5
5
  export declare const useUserSelectionRange: (props: Props) => [
6
+ Range | null,
6
7
  Range | null,
7
8
  () => void
8
9
  ];
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import type { AnnotationByMatches, InlineCommentSelectionComponentProps } from '@atlaskit/editor-common/types';
2
+ import type { AnnotationByMatches, InlineCommentHoverComponentProps } from '@atlaskit/editor-common/types';
3
3
  import type { ApplyAnnotation } from '../../../actions/index';
4
4
  import type { Position } from '../types';
5
5
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
6
6
  type Props = {
7
7
  range: Range;
8
- component: React.ComponentType<InlineCommentSelectionComponentProps>;
8
+ component: React.ComponentType<InlineCommentHoverComponentProps>;
9
9
  wrapperDOM: React.RefObject<HTMLDivElement>;
10
10
  documentPosition: Position | false;
11
11
  isAnnotationAllowed: boolean;
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { AnnotationByMatches, InlineCommentSelectionComponentProps } from '@atlaskit/editor-common/types';
3
- import { ApplyAnnotation } from '../../../actions/index';
4
- import { Position } from '../types';
5
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import type { ApplyAnnotation } from '../../../actions/index';
4
+ import type { Position } from '../types';
5
+ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
6
6
  type Props = {
7
- range: Range;
7
+ range: Range | null;
8
+ draftRange: Range | null;
8
9
  component: React.ComponentType<React.PropsWithChildren<InlineCommentSelectionComponentProps>>;
9
10
  wrapperDOM: React.RefObject<HTMLDivElement>;
10
11
  documentPosition: Position | false;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Position } from '../types';
2
+ import type { Position } from '../types';
3
3
  import type { InlineCommentSelectionComponentProps } from '@atlaskit/editor-common/types';
4
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
5
  type Props = {
6
6
  selectionComponent: React.ComponentType<React.PropsWithChildren<InlineCommentSelectionComponentProps>>;
7
7
  rendererRef: React.RefObject<HTMLDivElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.10.6",
3
+ "version": "109.11.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/analytics-next": "^9.2.0",
32
32
  "@atlaskit/button": "^17.7.0",
33
33
  "@atlaskit/code": "^15.1.0",
34
- "@atlaskit/editor-common": "^78.20.0",
34
+ "@atlaskit/editor-common": "^78.21.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.10.0",
36
36
  "@atlaskit/editor-palette": "1.5.3",
37
37
  "@atlaskit/editor-prosemirror": "3.0.0",
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/smart-card": "^26.50.0",
51
51
  "@atlaskit/status": "^1.4.0",
52
52
  "@atlaskit/task-decision": "^17.9.0",
53
- "@atlaskit/theme": "^12.6.0",
53
+ "@atlaskit/theme": "^12.7.0",
54
54
  "@atlaskit/tokens": "^1.42.0",
55
55
  "@atlaskit/tooltip": "^18.1.0",
56
56
  "@babel/runtime": "^7.0.0",
package/.eslintrc.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- rules: {
3
- '@atlaskit/design-system/ensure-design-token-usage/preview': [
4
- 'error',
5
- { domains: ['spacing'], shouldEnforceFallbacks: false },
6
- ],
7
- },
8
- };