@handlewithcare/react-prosemirror 2.8.0-tiptap.10 → 2.8.0-tiptap.12

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 (63) hide show
  1. package/dist/cjs/tiptap/TiptapEditorView.js +2 -1
  2. package/dist/cjs/tiptap/tiptapNodeView.js +26 -13
  3. package/dist/esm/tiptap/TiptapEditorView.js +2 -1
  4. package/dist/esm/tiptap/tiptapNodeView.js +27 -14
  5. package/dist/tsconfig.tsbuildinfo +1 -1
  6. package/dist/types/constants.d.ts +1 -1
  7. package/dist/types/props.d.ts +26 -26
  8. package/dist/types/tiptap/TiptapEditorView.d.ts +2 -1
  9. package/package.json +1 -1
  10. package/dist/esm/@jest/pattern/src/__tests__/TestPathPatterns.test.js +0 -241
  11. package/dist/esm/@swc/cli/lib/swc/__tests__/compile.test.js +0 -19
  12. package/dist/esm/@swc/cli/lib/swc/__tests__/options.test.js +0 -315
  13. package/dist/esm/@swc/cli/lib/swc/__tests__/sources.test.js +0 -161
  14. package/dist/esm/@uiw/react-codemirror/src/__tests__/index.test.js +0 -111
  15. package/dist/esm/cheerio/src/__tests__/deprecated.spec.js +0 -249
  16. package/dist/esm/cheerio/src/__tests__/xml.spec.js +0 -55
  17. package/dist/esm/components/__tests__/ProseMirror.composition.test.js +0 -395
  18. package/dist/esm/components/__tests__/ProseMirror.domchange.test.js +0 -266
  19. package/dist/esm/components/__tests__/ProseMirror.draw-decoration.test.js +0 -968
  20. package/dist/esm/components/__tests__/ProseMirror.draw.test.js +0 -335
  21. package/dist/esm/components/__tests__/ProseMirror.mobile.test.js +0 -54
  22. package/dist/esm/components/__tests__/ProseMirror.node-view.test.js +0 -553
  23. package/dist/esm/components/__tests__/ProseMirror.selection.test.js +0 -440
  24. package/dist/esm/components/__tests__/ProseMirror.test.js +0 -324
  25. package/dist/esm/contexts/__tests__/DeferredLayoutEffects.test.js +0 -98
  26. package/dist/esm/hooks/__tests__/useEditorEffect.test.js +0 -134
  27. package/dist/esm/jsx-ast-utils/__tests__/helper.js +0 -83
  28. package/dist/esm/jsx-ast-utils/__tests__/src/elementType-test.js +0 -76
  29. package/dist/esm/jsx-ast-utils/__tests__/src/eventHandlers-test.js +0 -98
  30. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-parser-test.js +0 -188
  31. package/dist/esm/jsx-ast-utils/__tests__/src/getProp-test.js +0 -119
  32. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-babelparser-test.js +0 -393
  33. package/dist/esm/jsx-ast-utils/__tests__/src/getPropLiteralValue-flowparser-test.js +0 -379
  34. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-babelparser-test.js +0 -925
  35. package/dist/esm/jsx-ast-utils/__tests__/src/getPropValue-flowparser-test.js +0 -700
  36. package/dist/esm/jsx-ast-utils/__tests__/src/hasProp-test.js +0 -350
  37. package/dist/esm/jsx-ast-utils/__tests__/src/index-test.js +0 -24
  38. package/dist/esm/jsx-ast-utils/__tests__/src/propName-test.js +0 -37
  39. package/dist/esm/plugins/__tests__/reactKeys.test.js +0 -77
  40. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.d.js +0 -1
  41. package/dist/esm/tsconfig-paths/lib/__tests__/config-loader.test.js +0 -97
  42. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.d.js +0 -1
  43. package/dist/esm/tsconfig-paths/lib/__tests__/data/match-path-data.js +0 -319
  44. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.d.js +0 -1
  45. package/dist/esm/tsconfig-paths/lib/__tests__/filesystem.test.js +0 -62
  46. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.d.js +0 -1
  47. package/dist/esm/tsconfig-paths/lib/__tests__/mapping-entry.test.js +0 -80
  48. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.d.js +0 -1
  49. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-async.test.js +0 -22
  50. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.d.js +0 -1
  51. package/dist/esm/tsconfig-paths/lib/__tests__/match-path-sync.test.js +0 -20
  52. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.d.js +0 -1
  53. package/dist/esm/tsconfig-paths/lib/__tests__/try-path.test.js +0 -219
  54. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.d.js +0 -1
  55. package/dist/esm/tsconfig-paths/lib/__tests__/tsconfig-loader.test.js +0 -323
  56. package/dist/esm/tsconfig-paths/src/__tests__/config-loader.test.js +0 -89
  57. package/dist/esm/tsconfig-paths/src/__tests__/data/match-path-data.js +0 -314
  58. package/dist/esm/tsconfig-paths/src/__tests__/filesystem.test.js +0 -58
  59. package/dist/esm/tsconfig-paths/src/__tests__/mapping-entry.test.js +0 -76
  60. package/dist/esm/tsconfig-paths/src/__tests__/match-path-async.test.js +0 -12
  61. package/dist/esm/tsconfig-paths/src/__tests__/match-path-sync.test.js +0 -10
  62. package/dist/esm/tsconfig-paths/src/__tests__/try-path.test.js +0 -214
  63. package/dist/esm/tsconfig-paths/src/__tests__/tsconfig-loader.test.js +0 -296
@@ -1,76 +0,0 @@
1
- /* eslint-env mocha */ import assert from 'assert';
2
- import { getOpeningElement, setParserName, describeIfNotBabylon } from '../helper';
3
- import elementType from '../../src/elementType';
4
- describe('elementType tests', ()=>{
5
- beforeEach(()=>{
6
- setParserName('babel');
7
- });
8
- it('should export a function', ()=>{
9
- const expected = 'function';
10
- const actual = typeof elementType;
11
- assert.equal(actual, expected);
12
- });
13
- it('should throw an error if the argument is missing', ()=>{
14
- assert.throws(()=>{
15
- elementType();
16
- }, Error);
17
- });
18
- it('should throw an error if the argument not a JSX node', ()=>{
19
- assert.throws(()=>{
20
- elementType({
21
- a: 'foo'
22
- });
23
- }, Error);
24
- });
25
- it('should return the correct type of the DOM element given its node object', ()=>{
26
- const code = '<div />';
27
- const node = getOpeningElement(code);
28
- const expected = 'div';
29
- const actual = elementType(node);
30
- assert.equal(actual, expected);
31
- });
32
- it('should return the correct type of the custom element given its node object', ()=>{
33
- const code = '<Slider />';
34
- const node = getOpeningElement(code);
35
- const expected = 'Slider';
36
- const actual = elementType(node);
37
- assert.equal(actual, expected);
38
- });
39
- it('should return the correct type of the custom object element given its node object', ()=>{
40
- const code = '<UX.Slider />';
41
- const node = getOpeningElement(code);
42
- const expected = 'UX.Slider';
43
- const actual = elementType(node);
44
- assert.equal(actual, expected);
45
- });
46
- it('should return the correct type of the namespaced element given its node object', ()=>{
47
- const code = '<UX:Slider />';
48
- const node = getOpeningElement(code);
49
- const expected = 'UX:Slider';
50
- const actual = elementType(node);
51
- assert.equal(actual, expected);
52
- });
53
- it('should return the correct type of the multiple custom object element given its node object', ()=>{
54
- const code = '<UX.Slider.Blue.Light />';
55
- const node = getOpeningElement(code);
56
- const expected = 'UX.Slider.Blue.Light';
57
- const actual = elementType(node);
58
- assert.equal(actual, expected);
59
- });
60
- it('should return this.Component when given its node object', ()=>{
61
- const code = '<this.Component />';
62
- const node = getOpeningElement(code);
63
- const expected = 'this.Component';
64
- const actual = elementType(node);
65
- assert.equal(actual, expected);
66
- });
67
- describeIfNotBabylon('fragments', ()=>{
68
- it('should work with fragments', ()=>{
69
- const code = '<>foo</>';
70
- const node = getOpeningElement(code);
71
- const expected = '<>';
72
- const actual = elementType(node);
73
- assert.equal(actual, expected);
74
- });
75
- });
76
- });
@@ -1,98 +0,0 @@
1
- /* eslint-env mocha */ import assert from 'assert';
2
- import includes from 'array-includes';
3
- import eventHandlers, { eventHandlersByType } from '../../src/eventHandlers';
4
- describe('eventHandlers', ()=>{
5
- it('should contain a list of common JSX event handlers', ()=>{
6
- assert([
7
- 'onCopy',
8
- 'onCut',
9
- 'onPaste',
10
- 'onCompositionEnd',
11
- 'onCompositionStart',
12
- 'onCompositionUpdate',
13
- 'onKeyDown',
14
- 'onKeyPress',
15
- 'onKeyUp',
16
- 'onFocus',
17
- 'onBlur',
18
- 'onChange',
19
- 'onInput',
20
- 'onSubmit',
21
- 'onClick',
22
- 'onContextMenu',
23
- 'onDblClick',
24
- 'onDoubleClick',
25
- 'onDrag',
26
- 'onDragEnd',
27
- 'onDragEnter',
28
- 'onDragExit',
29
- 'onDragLeave',
30
- 'onDragOver',
31
- 'onDragStart',
32
- 'onDrop',
33
- 'onMouseDown',
34
- 'onMouseEnter',
35
- 'onMouseLeave',
36
- 'onMouseMove',
37
- 'onMouseOut',
38
- 'onMouseOver',
39
- 'onMouseUp',
40
- 'onSelect',
41
- 'onTouchCancel',
42
- 'onTouchEnd',
43
- 'onTouchMove',
44
- 'onTouchStart',
45
- 'onScroll',
46
- 'onWheel',
47
- 'onAbort',
48
- 'onCanPlay',
49
- 'onCanPlayThrough',
50
- 'onDurationChange',
51
- 'onEmptied',
52
- 'onEncrypted',
53
- 'onEnded',
54
- 'onError',
55
- 'onLoadedData',
56
- 'onLoadedMetadata',
57
- 'onLoadStart',
58
- 'onPause',
59
- 'onPlay',
60
- 'onPlaying',
61
- 'onProgress',
62
- 'onRateChange',
63
- 'onSeeked',
64
- 'onSeeking',
65
- 'onStalled',
66
- 'onSuspend',
67
- 'onTimeUpdate',
68
- 'onVolumeChange',
69
- 'onWaiting',
70
- 'onLoad',
71
- 'onError',
72
- 'onAnimationStart',
73
- 'onAnimationEnd',
74
- 'onAnimationIteration',
75
- 'onTransitionEnd'
76
- ].every((handlerName)=>includes(eventHandlers, handlerName)));
77
- });
78
- });
79
- describe('eventHandlersByType', ()=>{
80
- it('should be keyed by type', ()=>{
81
- assert([
82
- 'clipboard',
83
- 'composition',
84
- 'keyboard',
85
- 'focus',
86
- 'form',
87
- 'mouse',
88
- 'selection',
89
- 'touch',
90
- 'ui',
91
- 'wheel',
92
- 'media',
93
- 'image',
94
- 'animation',
95
- 'transition'
96
- ].every((type)=>!!eventHandlersByType[type]));
97
- });
98
- });
@@ -1,188 +0,0 @@
1
- /* eslint-env mocha */ import assert from 'assert';
2
- import entries from 'object.entries';
3
- import fromEntries from 'object.fromentries';
4
- import { getOpeningElement, setParserName, fallbackToBabylon } from '../helper';
5
- import getProp from '../../src/getProp';
6
- const literal = {
7
- source: '<div {...{ id: "foo" }} />',
8
- target: '<div id="foo" />',
9
- offset: {
10
- keyOffset: -6,
11
- valueOffset: -7
12
- }
13
- };
14
- const expression1 = {
15
- source: '<div {...{ id }} />',
16
- target: '<div id={id} />',
17
- offset: {
18
- keyOffset: -6,
19
- valueOffset: -2
20
- }
21
- };
22
- const expression2 = {
23
- source: '<div {...{ id: `foo${bar}baz` }} />',
24
- target: '<div id={`foo${bar}baz`} />',
25
- offset: {
26
- keyOffset: -6,
27
- valueOffset: -6
28
- }
29
- };
30
- describe('getProp', ()=>{
31
- it('should create the correct AST for literal with flow parser', ()=>{
32
- actualTest('flow', literal);
33
- });
34
- it('should create the correct AST for literal with babel parser', ()=>{
35
- actualTest('babel', literal);
36
- });
37
- it('should create the correct AST for expression with flow parser (1)', ()=>{
38
- actualTest('flow', expression1);
39
- });
40
- it('should create the correct AST for expression with babel parser (1)', ()=>{
41
- actualTest('babel', expression1);
42
- });
43
- it('should create the correct AST for expression with flow parser (2)', ()=>{
44
- actualTest('flow', expression2);
45
- });
46
- it('should create the correct AST for expression with babel parser (2)', ()=>{
47
- actualTest('babel', expression2);
48
- });
49
- });
50
- function actualTest(parserName, test) {
51
- setParserName(parserName);
52
- const { source, target, offset } = test;
53
- const sourceProps = stripConstructors(getOpeningElement(source).attributes);
54
- const targetProps = stripConstructors(getOpeningElement(target).attributes);
55
- const prop = 'id';
56
- const sourceResult = getProp(sourceProps, prop);
57
- const targetResult = getProp(targetProps, prop);
58
- if (fallbackToBabylon && parserName === 'babel' && test === literal) {
59
- // Babylon (node < 6) adds an `extra: null` prop to a literal if it is parsed from a
60
- // JSXAttribute, other literals don't get this.
61
- sourceResult.value.extra = null;
62
- }
63
- assert.deepStrictEqual(adjustLocations(sourceResult, offset), adjustRange(targetResult));
64
- }
65
- function adjustRange(param) {
66
- let { name, value: { expression, ...value }, ...node } = param;
67
- return {
68
- ...adjustNodeRange(node),
69
- name: adjustNodeRange(name),
70
- value: {
71
- ...adjustNodeRange(value),
72
- ...expression ? {
73
- expression: adjustNodeRangeRecursively(expression)
74
- } : {}
75
- }
76
- };
77
- }
78
- function adjustNodeRange(node) {
79
- if (!node.loc) {
80
- return node;
81
- }
82
- const [start, end] = node.range || [
83
- node.start,
84
- node.end
85
- ];
86
- return {
87
- ...node,
88
- end: undefined,
89
- range: [
90
- start,
91
- end
92
- ],
93
- start: undefined
94
- };
95
- }
96
- function adjustNodeRangeRecursively(node) {
97
- if (Array.isArray(node)) {
98
- return node.map(adjustNodeRangeRecursively);
99
- }
100
- if (node && typeof node === 'object') {
101
- return adjustNodeRange(mapValues(node, adjustNodeRangeRecursively));
102
- }
103
- return node;
104
- }
105
- function stripConstructors(value) {
106
- return JSON.parse(JSON.stringify(value));
107
- }
108
- function adjustLocations(node, param) {
109
- let { keyOffset, valueOffset } = param;
110
- const hasExpression = !!node.value.expression;
111
- return {
112
- ...adjustNodeLocations(node, {
113
- startOffset: keyOffset,
114
- endOffset: valueOffset + (hasExpression ? 1 : 0)
115
- }),
116
- name: adjustNodeLocations(node.name, {
117
- startOffset: keyOffset,
118
- endOffset: keyOffset
119
- }),
120
- value: {
121
- ...adjustNodeLocations(node.value, {
122
- startOffset: valueOffset - (hasExpression ? 1 : 0),
123
- endOffset: valueOffset + (hasExpression ? 1 : 0)
124
- }),
125
- ...hasExpression ? {
126
- expression: adjustLocationsRecursively(node.value.expression, {
127
- startOffset: valueOffset,
128
- endOffset: valueOffset
129
- })
130
- } : {}
131
- }
132
- };
133
- }
134
- function adjustNodeLocations(node, param) {
135
- let { startOffset, endOffset } = param;
136
- if (!node.loc) {
137
- return node;
138
- }
139
- const [start, end] = node.range || [];
140
- return {
141
- ...node,
142
- end: undefined,
143
- loc: {
144
- ...node.loc,
145
- start: {
146
- ...node.loc.start,
147
- column: node.loc.start.column + startOffset
148
- },
149
- end: {
150
- ...node.loc.end,
151
- column: node.loc.end.column + endOffset
152
- }
153
- },
154
- range: [
155
- start + startOffset,
156
- end + endOffset
157
- ],
158
- start: undefined
159
- };
160
- }
161
- function adjustLocationsRecursively(node, param) {
162
- let { startOffset, endOffset } = param;
163
- if (Array.isArray(node)) {
164
- return node.map((x)=>adjustLocationsRecursively(x, {
165
- startOffset,
166
- endOffset
167
- }));
168
- }
169
- if (node && typeof node === 'object') {
170
- return adjustNodeLocations(mapValues(node, (x)=>adjustLocationsRecursively(x, {
171
- startOffset,
172
- endOffset
173
- })), {
174
- startOffset,
175
- endOffset
176
- });
177
- }
178
- return node;
179
- }
180
- function mapValues(o, f) {
181
- return fromEntries(entries(o).map((param)=>{
182
- let [k, v] = param;
183
- return [
184
- k,
185
- f(v)
186
- ];
187
- }));
188
- }
@@ -1,119 +0,0 @@
1
- /* eslint-env mocha */ import assert from 'assert';
2
- import { getOpeningElement, setParserName } from '../helper';
3
- import getProp from '../../src/getProp';
4
- describe('getProp', ()=>{
5
- beforeEach(()=>{
6
- setParserName('babel');
7
- });
8
- it('should export a function', ()=>{
9
- const expected = 'function';
10
- const actual = typeof getProp;
11
- assert.equal(actual, expected);
12
- });
13
- it('should return undefined if no arguments are provided', ()=>{
14
- const expected = undefined;
15
- const actual = getProp();
16
- assert.equal(actual, expected);
17
- });
18
- it('should return undefined if the attribute is absent', ()=>{
19
- const code = '<div />';
20
- const node = getOpeningElement(code);
21
- const { attributes: props } = node;
22
- const prop = 'id';
23
- const expected = undefined;
24
- const actual = getProp(props, prop);
25
- assert.equal(actual, expected);
26
- });
27
- it('should return the correct attribute if the attribute exists', ()=>{
28
- const code = '<div id="foo" />';
29
- const node = getOpeningElement(code);
30
- const { attributes: props } = node;
31
- const prop = 'id';
32
- const expected = 'id';
33
- const actual = getProp(props, prop).name.name;
34
- assert.equal(actual, expected);
35
- });
36
- it('should return the correct attribute if the attribute exists in spread', ()=>{
37
- const code = '<div {...{ id: "foo" }} />';
38
- const node = getOpeningElement(code);
39
- const { attributes: props } = node;
40
- const prop = 'ID';
41
- const expected = 'id';
42
- const actual = getProp(props, prop).name.name;
43
- assert.equal(actual, expected);
44
- });
45
- it('should return the correct attribute if the attribute exists in spread as an expression', ()=>{
46
- const code = '<div {...{ id }} />';
47
- const node = getOpeningElement(code);
48
- const { attributes: props } = node;
49
- const prop = 'id';
50
- const expected = 'id';
51
- const actual = getProp(props, prop);
52
- const actualName = actual.name.name;
53
- const actualValue = actual.value.expression.name;
54
- assert.equal(actualName, expected);
55
- assert.equal(actualValue, expected);
56
- });
57
- it('should return the correct attribute if the attribute exists in spread (case sensitive)', ()=>{
58
- const code = '<div {...{ id: "foo" }} />';
59
- const node = getOpeningElement(code);
60
- const { attributes: props } = node;
61
- const prop = 'id';
62
- const options = {
63
- ignoreCase: false
64
- };
65
- const expected = 'id';
66
- const actual = getProp(props, prop, options).name.name;
67
- assert.equal(actual, expected);
68
- });
69
- it('should return undefined if the attribute does not exist in spread (case sensitive)', ()=>{
70
- const code = '<div {...{ id: "foo" }} />';
71
- const node = getOpeningElement(code);
72
- const { attributes: props } = node;
73
- const prop = 'ID';
74
- const options = {
75
- ignoreCase: false
76
- };
77
- const expected = undefined;
78
- const actual = getProp(props, prop, options);
79
- assert.equal(actual, expected);
80
- });
81
- it('should return undefined for key in spread', ()=>{
82
- // https://github.com/reactjs/rfcs/pull/107
83
- const code = '<div {...{ key }} />';
84
- const node = getOpeningElement(code);
85
- const { attributes: props } = node;
86
- const prop = 'key';
87
- const expected = undefined;
88
- const actual = getProp(props, prop);
89
- assert.equal(actual, expected);
90
- });
91
- it('should return undefined if the attribute may exist in spread', ()=>{
92
- const code = '<div {...props} />';
93
- const node = getOpeningElement(code);
94
- const { attributes: props } = node;
95
- const prop = 'id';
96
- const expected = undefined;
97
- const actual = getProp(props, prop);
98
- assert.equal(actual, expected);
99
- });
100
- it('should not crash if the spread contains a spread', ()=>{
101
- const code = '<div {...{ ...props }} />';
102
- const node = getOpeningElement(code);
103
- const { attributes: props } = node;
104
- const prop = 'id';
105
- getProp(props, prop);
106
- });
107
- it('should return undefined if the attribute is considered absent in case-sensitive mode', ()=>{
108
- const code = '<div ID="foo" />';
109
- const node = getOpeningElement(code);
110
- const { attributes: props } = node;
111
- const prop = 'id';
112
- const options = {
113
- ignoreCase: false
114
- };
115
- const expected = undefined;
116
- const actual = getProp(props, prop, options);
117
- assert.equal(actual, expected);
118
- });
119
- });