@atlaskit/editor-json-transformer 8.33.2 → 9.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @atlaskit/editor-json-transformer
2
2
 
3
+ ## 9.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
8
+ Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
9
+
10
+ Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
11
+
12
+ Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
13
+
14
+ ```diff
15
+ - "typesVersions": {
16
+ - ">=4.5 <4.9": {
17
+ - "*": [
18
+ - "dist/types-ts4.5/*",
19
+ - "dist/types-ts4.5/index.d.ts"
20
+ - ]
21
+ - }
22
+ - },
23
+ ```
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+
3
29
  ## 8.33.2
4
30
 
5
31
  ### Patch Changes
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/markOverrideRules.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/markOverrideRules.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/markOverrideRules.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/markOverrideRules.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/markOverrideRules.d.ts"
15
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-json-transformer",
3
- "version": "8.33.2",
3
+ "version": "9.0.0",
4
4
  "description": "JSON transformer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,14 +12,6 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.5 <4.9": {
17
- "*": [
18
- "dist/types-ts4.5/*",
19
- "dist/types-ts4.5/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.ts",
25
17
  "atlassian": {
@@ -29,9 +21,9 @@
29
21
  }
30
22
  },
31
23
  "dependencies": {
32
- "@atlaskit/adf-schema": "^54.0.0",
33
- "@atlaskit/adf-utils": "^19.33.0",
34
- "@atlaskit/editor-prosemirror": "^7.3.0",
24
+ "@atlaskit/adf-schema": "^55.0.0",
25
+ "@atlaskit/adf-utils": "^20.0.0",
26
+ "@atlaskit/editor-prosemirror": "^8.0.0",
35
27
  "@babel/runtime": "^7.0.0",
36
28
  "lodash": "^4.17.21"
37
29
  },
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/sanitize.js",
5
5
  "module:es2019": "../dist/es2019/sanitize.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/sanitize.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/sanitize.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/sanitize.d.ts"
15
8
  }
@@ -4,12 +4,5 @@
4
4
  "module": "../../dist/esm/entry-points/sanitize-remove-marks.js",
5
5
  "module:es2019": "../../dist/es2019/entry-points/sanitize-remove-marks.js",
6
6
  "sideEffects": false,
7
- "types": "../../dist/types/entry-points/sanitize-remove-marks.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../../dist/types-ts4.5/entry-points/sanitize-remove-marks.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../../dist/types/entry-points/sanitize-remove-marks.d.ts"
15
8
  }
@@ -4,12 +4,5 @@
4
4
  "module": "../../dist/esm/entry-points/sanitize-sanitize-node.js",
5
5
  "module:es2019": "../../dist/es2019/entry-points/sanitize-sanitize-node.js",
6
6
  "sideEffects": false,
7
- "types": "../../dist/types/entry-points/sanitize-sanitize-node.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../../dist/types-ts4.5/entry-points/sanitize-sanitize-node.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../../dist/types/entry-points/sanitize-sanitize-node.d.ts"
15
8
  }
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/types.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/types.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/types.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/types.d.ts"
15
8
  }
@@ -1 +0,0 @@
1
- export { markOverrideRuleFor } from '../markOverrideRules';
@@ -1 +0,0 @@
1
- export { removeMarks } from '../sanitize/remove-marks';
@@ -1 +0,0 @@
1
- export { sanitizeNode } from '../sanitize/sanitize-node';
@@ -1 +0,0 @@
1
- export type { JSONDocNode, JSONNode } from '../types';
@@ -1,46 +0,0 @@
1
- import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { SanitizeNodeOptions } from './sanitize/sanitize-node';
3
- import type { JSONDocNode, JSONNode } from './types';
4
- export type { JSONDocNode, JSONNode } from './types';
5
- interface Transformer<T> {
6
- encode: (node: PMNode) => T;
7
- parse: (content: T) => PMNode;
8
- }
9
- export declare enum SchemaStage {
10
- FINAL = "final",
11
- STAGE_0 = "stage0"
12
- }
13
- /**
14
- * Transforms a Prosemirror node into a JSON representation. Compared with
15
- * native Prosemirror JSON, this representation ensures we have valid ADF attrs.
16
- *
17
- * @param node The Prosemirror node to transform.
18
- * @param mentionMap A map of mention IDs to their display names.
19
- * @returns The JSON representation of the node.
20
- */
21
- declare const toJSON: (node: PMNode, mentionMap?: Record<string, string | undefined>) => JSONNode;
22
- export { toJSON as nodeToJSON };
23
- export declare class JSONTransformer implements Transformer<JSONDocNode> {
24
- private schema;
25
- private mentionMap;
26
- /**
27
- * @param schema The current editor schema
28
- * @param mentionMap An optional mapping of user IDs to mention names. This is used by the encoder to substitute empty
29
- * mention node.attr.text values with mapped names.
30
- */
31
- constructor(schema?: Schema, mentionMap?: Record<string, string | undefined>);
32
- encode(node: PMNode, options?: SanitizeNodeOptions): JSONDocNode;
33
- private internalParse;
34
- parse(content: JSONDocNode, stage?: SchemaStage): PMNode;
35
- /**
36
- * This method is used to encode a single node
37
- */
38
- encodeNode(node: PMNode): JSONNode;
39
- }
40
- /**
41
- * Quick type guard to check if a value is a valid JSONDocNode
42
- * This is only a basic structural check, does not validate the entire object nor the schema.
43
- * @param value - The value to check
44
- * @returns true if the value is a valid JSONDocNode structure
45
- */
46
- export declare function isJSONDocNode(value: unknown): value is JSONDocNode;
@@ -1,13 +0,0 @@
1
- interface MarkJson {
2
- attrs: {
3
- [key: string]: any;
4
- };
5
- type: string;
6
- }
7
- type CanOverrideUnsupportedMark = (markJson?: MarkJson) => boolean;
8
- interface MarkOverrideRule {
9
- canOverrideUnsupportedMark: CanOverrideUnsupportedMark;
10
- }
11
- type MarkOverrideRules = (type: string) => MarkOverrideRule;
12
- export declare const markOverrideRuleFor: MarkOverrideRules;
13
- export {};
@@ -1,15 +0,0 @@
1
- import type { JSONNode } from '../index';
2
- export declare function removeMarks(node: JSONNode): {
3
- attrs?: object;
4
- content?: Array<JSONNode | undefined>;
5
- marks?: any[];
6
- text?: string;
7
- type: string;
8
- };
9
- export declare function removeNonAnnotationMarks(node: JSONNode): {
10
- attrs?: object;
11
- content?: Array<JSONNode | undefined>;
12
- marks?: any[];
13
- text?: string;
14
- type: string;
15
- };
@@ -1,9 +0,0 @@
1
- import type { JSONNode } from '../types';
2
- export interface SanitizeNodeOptions {
3
- /**
4
- * If true, nested tables will not be transformed to a extension.
5
- * This is useful when you want to keep the nested structure for further processing.
6
- */
7
- keepNestedTables?: boolean;
8
- }
9
- export declare function sanitizeNode(json: JSONNode, options?: SanitizeNodeOptions): JSONNode;
@@ -1,2 +0,0 @@
1
- export { sanitizeNode } from './sanitize/sanitize-node';
2
- export { removeMarks } from './sanitize/remove-marks';
@@ -1,12 +0,0 @@
1
- export type JSONNode = {
2
- attrs?: object;
3
- content?: Array<JSONNode | undefined>;
4
- marks?: any[];
5
- text?: string;
6
- type: string;
7
- };
8
- export type JSONDocNode = {
9
- content: JSONNode[];
10
- type: 'doc';
11
- version: number;
12
- };