@atlaskit/adf-schema 50.0.0 → 50.0.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,11 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 50.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 866c567: Improve typing for overrideDocumentStepJSON
8
+
3
9
  ## 50.0.0
4
10
 
5
11
  ### Major Changes
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { Step, StepResult, StepMap } from '@atlaskit/editor-prosemirror/transform';
2
2
  import { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
3
+ import { ADFEntity } from './types';
3
4
  type Options = {
4
5
  nextDocument: PMNode;
5
6
  inverted?: boolean;
@@ -20,8 +21,6 @@ export declare class OverrideDocumentStep extends Step {
20
21
  export type OverrideDocumentStepJSON = {
21
22
  stepType: 'override-document';
22
23
  inverted: boolean;
23
- nextDocument: {
24
- [key: string]: any;
25
- };
24
+ nextDocument: ADFEntity;
26
25
  };
27
26
  export {};
@@ -0,0 +1,96 @@
1
+ /**
2
+ * These types are taken from adf-utils, but not imported to avoid circular dependencies.
3
+ * They can be seen here:
4
+ * https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/editor/adf-utils/src/types/index.ts
5
+ */
6
+ /**
7
+ * Represents a mark in the Atlassian Document Format (ADF).
8
+ * Marks are used to apply formatting or metadata to content, such as bold, italic, links, etc.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const boldMark: ADFEntityMark = {
13
+ * type: 'strong'
14
+ * };
15
+ *
16
+ * const linkMark: ADFEntityMark = {
17
+ * type: 'link',
18
+ * attrs: {
19
+ * href: 'https://example.com',
20
+ * title: 'Example Link'
21
+ * }
22
+ * };
23
+ * ```
24
+ */
25
+ export interface ADFEntityMark {
26
+ /** The type of mark (e.g., 'strong', 'em', 'link', 'code', etc.) */
27
+ type: string;
28
+ /**
29
+ * Optional attributes for the mark, containing mark-specific properties.
30
+ * For example, a link mark would have 'href' and optionally 'title' attributes.
31
+ */
32
+ attrs?: {
33
+ [name: string]: any;
34
+ };
35
+ }
36
+ /**
37
+ * Represents a node or entity in the Atlassian Document Format (ADF).
38
+ * This is the core building block of ADF documents, representing elements like
39
+ * paragraphs, headings, images, tables, and other content types.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const paragraph: ADFEntity = {
44
+ * type: 'paragraph',
45
+ * content: [
46
+ * {
47
+ * type: 'text',
48
+ * text: 'Hello world!',
49
+ * marks: [{ type: 'strong' }]
50
+ * }
51
+ * ]
52
+ * };
53
+ *
54
+ * const heading: ADFEntity = {
55
+ * type: 'heading',
56
+ * attrs: { level: 1 },
57
+ * content: [
58
+ * {
59
+ * type: 'text',
60
+ * text: 'Document Title'
61
+ * }
62
+ * ]
63
+ * };
64
+ * ```
65
+ */
66
+ export interface ADFEntity {
67
+ /** The type of ADF node (e.g., 'doc', 'paragraph', 'heading', 'text', 'image', etc.) */
68
+ type: string;
69
+ /**
70
+ * Optional attributes for the entity, containing node-specific properties.
71
+ * For example, a heading node would have a 'level' attribute, an image would have 'src', etc.
72
+ */
73
+ attrs?: {
74
+ [name: string]: any;
75
+ };
76
+ /**
77
+ * Optional array of child entities. Used for container nodes like paragraphs, headings, etc.
78
+ * Can contain undefined values to handle cases where content might be filtered or removed.
79
+ */
80
+ content?: Array<ADFEntity | undefined>;
81
+ /**
82
+ * Optional array of marks applied to this entity.
83
+ * Marks provide formatting and metadata like bold, italic, links, etc.
84
+ */
85
+ marks?: Array<ADFEntityMark>;
86
+ /**
87
+ * Optional text content for text nodes.
88
+ * Only present on nodes of type 'text'.
89
+ */
90
+ text?: string;
91
+ /**
92
+ * Index signature to allow additional properties that may be specific to certain node types
93
+ * or used for extensions and custom functionality.
94
+ */
95
+ [key: string]: any;
96
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "50.0.0",
3
+ "version": "50.0.1",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"