@takeshape/util 11.52.0 → 11.55.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/dist/common/__tests__/arrays.test.js +43 -0
- package/dist/common/__tests__/billing.test.d.ts +1 -0
- package/dist/common/__tests__/billing.test.js +27 -0
- package/dist/common/__tests__/clone.test.d.ts +1 -0
- package/dist/common/__tests__/clone.test.js +128 -0
- package/dist/common/__tests__/data/advanced-draftjs-data-from-app.d.ts +114 -0
- package/dist/common/__tests__/data/advanced-draftjs-data-from-app.js +316 -0
- package/dist/common/__tests__/data/advanced-draftjs-from-markdown-data.d.ts +160 -0
- package/dist/common/__tests__/data/advanced-draftjs-from-markdown-data.js +326 -0
- package/dist/common/__tests__/data/advanced-draftjs-from-mdx-data.d.ts +215 -0
- package/dist/common/__tests__/data/advanced-draftjs-from-mdx-data.js +407 -0
- package/dist/common/__tests__/data/advanced-markdown-2nd-pass.d.ts +1 -0
- package/dist/common/__tests__/data/advanced-markdown-2nd-pass.js +39 -0
- package/dist/common/__tests__/data/advanced-markdown-data.d.ts +1 -0
- package/dist/common/__tests__/data/advanced-markdown-data.js +39 -0
- package/dist/common/__tests__/data/advanced-mdx-2nd-pass.d.ts +1 -0
- package/dist/common/__tests__/data/advanced-mdx-2nd-pass.js +40 -0
- package/dist/common/__tests__/data/advanced-mdx-data.d.ts +1 -0
- package/dist/common/__tests__/data/advanced-mdx-data.js +40 -0
- package/dist/common/__tests__/delay.test.d.ts +1 -0
- package/dist/common/__tests__/delay.test.js +22 -0
- package/dist/common/__tests__/draftjs.test.d.ts +1 -0
- package/dist/common/__tests__/draftjs.test.js +373 -0
- package/dist/common/__tests__/empty.test.d.ts +1 -0
- package/dist/common/__tests__/empty.test.js +65 -0
- package/dist/common/__tests__/http.test.d.ts +1 -0
- package/dist/common/__tests__/http.test.js +13 -0
- package/dist/common/__tests__/merge.test.d.ts +1 -0
- package/dist/common/__tests__/merge.test.js +36 -0
- package/dist/common/__tests__/mime.test.d.ts +1 -0
- package/dist/common/__tests__/mime.test.js +17 -0
- package/dist/common/__tests__/names.test.d.ts +1 -0
- package/dist/common/__tests__/names.test.js +22 -0
- package/dist/common/__tests__/naming.test.d.ts +1 -0
- package/dist/common/__tests__/naming.test.js +98 -0
- package/dist/common/__tests__/path-to-string.test.d.ts +1 -0
- package/dist/common/__tests__/path-to-string.test.js +7 -0
- package/dist/common/__tests__/predicate.test.d.ts +1 -0
- package/dist/common/__tests__/predicate.test.js +18 -0
- package/dist/common/__tests__/sets.test.d.ts +1 -0
- package/dist/common/__tests__/sets.test.js +13 -0
- package/dist/common/__tests__/sort-object.test.d.ts +1 -0
- package/dist/common/__tests__/sort-object.test.js +12 -0
- package/dist/common/__tests__/strings.test.d.ts +1 -0
- package/dist/common/__tests__/strings.test.js +78 -0
- package/dist/common/__tests__/templates.test.d.ts +1 -0
- package/dist/common/__tests__/templates.test.js +220 -0
- package/dist/common/__tests__/timezone.test.d.ts +1 -0
- package/dist/common/__tests__/timezone.test.js +8 -0
- package/dist/common/__tests__/types.test.d.ts +1 -0
- package/dist/common/__tests__/types.test.js +46 -0
- package/dist/common/__tests__/unix-to-iso.test.d.ts +1 -0
- package/dist/common/__tests__/unix-to-iso.test.js +6 -0
- package/dist/common/__tests__/urls.test.d.ts +1 -0
- package/dist/common/__tests__/urls.test.js +19 -0
- package/dist/common/__tests__/value.test.d.ts +1 -0
- package/dist/common/__tests__/value.test.js +6 -0
- package/dist/common/__tests__/visit.test.d.ts +1 -0
- package/dist/common/__tests__/visit.test.js +112 -0
- package/dist/{esm/common → common}/async-noop.js +1 -1
- package/dist/{esm/common → common}/billing.js +1 -1
- package/dist/{esm/common → common}/clone.js +1 -1
- package/dist/{esm/common → common}/draftjs.js +2 -2
- package/dist/common/index.d.ts +35 -0
- package/dist/common/index.js +35 -0
- package/dist/{types/common → common}/naming.d.ts +6 -0
- package/dist/{esm/common → common}/naming.js +31 -0
- package/dist/{esm/common → common}/strings.js +1 -1
- package/dist/{types/common → common}/templates.d.ts +1 -1
- package/dist/{esm/common → common}/templates.js +2 -2
- package/dist/common/tracing.js +1 -0
- package/dist/node/__tests__/buffer.test.d.ts +1 -0
- package/dist/node/__tests__/buffer.test.js +41 -0
- package/dist/node/__tests__/encryption.test.d.ts +1 -0
- package/dist/node/__tests__/encryption.test.js +14 -0
- package/dist/node/__tests__/gzip.test.d.ts +1 -0
- package/dist/node/__tests__/gzip.test.js +59 -0
- package/dist/node/__tests__/search-params.test.d.ts +1 -0
- package/dist/node/__tests__/search-params.test.js +9 -0
- package/dist/{esm/node → node}/gzip.js +1 -1
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.js +4 -0
- package/package.json +19 -20
- package/dist/cjs/common/arrays.js +0 -41
- package/dist/cjs/common/assert.js +0 -8
- package/dist/cjs/common/async-noop.js +0 -5
- package/dist/cjs/common/billing.js +0 -35
- package/dist/cjs/common/clone.js +0 -76
- package/dist/cjs/common/delay.js +0 -27
- package/dist/cjs/common/draftjs-templates.js +0 -131
- package/dist/cjs/common/draftjs.js +0 -807
- package/dist/cjs/common/empty.js +0 -24
- package/dist/cjs/common/get-image-url.js +0 -7
- package/dist/cjs/common/highlight-code.js +0 -33
- package/dist/cjs/common/http.js +0 -19
- package/dist/cjs/common/index.js +0 -51
- package/dist/cjs/common/map.js +0 -6
- package/dist/cjs/common/memoize.js +0 -12
- package/dist/cjs/common/merge.js +0 -63
- package/dist/cjs/common/mime.js +0 -67
- package/dist/cjs/common/names.js +0 -12
- package/dist/cjs/common/naming.js +0 -65
- package/dist/cjs/common/path-to-string.js +0 -10
- package/dist/cjs/common/persisted-queries.js +0 -4
- package/dist/cjs/common/predicate.js +0 -14
- package/dist/cjs/common/set-in.js +0 -13
- package/dist/cjs/common/sets.js +0 -18
- package/dist/cjs/common/sleep.js +0 -8
- package/dist/cjs/common/sort-object.js +0 -16
- package/dist/cjs/common/strings.js +0 -74
- package/dist/cjs/common/templates.js +0 -108
- package/dist/cjs/common/timezone.js +0 -606
- package/dist/cjs/common/tracing.js +0 -2
- package/dist/cjs/common/types.js +0 -62
- package/dist/cjs/common/unix-to-iso.js +0 -14
- package/dist/cjs/common/urls.js +0 -8
- package/dist/cjs/common/validation.js +0 -5
- package/dist/cjs/common/value.js +0 -7
- package/dist/cjs/common/visit.js +0 -59
- package/dist/cjs/node/buffer.js +0 -26
- package/dist/cjs/node/encryption.js +0 -31
- package/dist/cjs/node/gzip.js +0 -20
- package/dist/cjs/node/index.js +0 -20
- package/dist/cjs/node/search-params.js +0 -22
- package/dist/cjs/package.json +0 -1
- package/dist/esm/common/index.js +0 -35
- package/dist/esm/node/index.js +0 -4
- package/dist/esm/package.json +0 -1
- package/dist/tsconfig.cjs.tsbuildinfo +0 -1
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.types.tsbuildinfo +0 -1
- package/dist/types/common/index.d.ts +0 -35
- package/dist/types/node/index.d.ts +0 -4
- /package/dist/{esm/common/tracing.js → common/__tests__/arrays.test.d.ts} +0 -0
- /package/dist/{types/common → common}/arrays.d.ts +0 -0
- /package/dist/{esm/common → common}/arrays.js +0 -0
- /package/dist/{types/common → common}/assert.d.ts +0 -0
- /package/dist/{esm/common → common}/assert.js +0 -0
- /package/dist/{types/common → common}/async-noop.d.ts +0 -0
- /package/dist/{types/common → common}/billing.d.ts +0 -0
- /package/dist/{types/common → common}/clone.d.ts +0 -0
- /package/dist/{types/common → common}/delay.d.ts +0 -0
- /package/dist/{esm/common → common}/delay.js +0 -0
- /package/dist/{types/common → common}/draftjs-templates.d.ts +0 -0
- /package/dist/{esm/common → common}/draftjs-templates.js +0 -0
- /package/dist/{types/common → common}/draftjs.d.ts +0 -0
- /package/dist/{types/common → common}/empty.d.ts +0 -0
- /package/dist/{esm/common → common}/empty.js +0 -0
- /package/dist/{types/common → common}/get-image-url.d.ts +0 -0
- /package/dist/{esm/common → common}/get-image-url.js +0 -0
- /package/dist/{types/common → common}/highlight-code.d.ts +0 -0
- /package/dist/{esm/common → common}/highlight-code.js +0 -0
- /package/dist/{types/common → common}/http.d.ts +0 -0
- /package/dist/{esm/common → common}/http.js +0 -0
- /package/dist/{types/common → common}/map.d.ts +0 -0
- /package/dist/{esm/common → common}/map.js +0 -0
- /package/dist/{types/common → common}/memoize.d.ts +0 -0
- /package/dist/{esm/common → common}/memoize.js +0 -0
- /package/dist/{types/common → common}/merge.d.ts +0 -0
- /package/dist/{esm/common → common}/merge.js +0 -0
- /package/dist/{types/common → common}/mime.d.ts +0 -0
- /package/dist/{esm/common → common}/mime.js +0 -0
- /package/dist/{types/common → common}/names.d.ts +0 -0
- /package/dist/{esm/common → common}/names.js +0 -0
- /package/dist/{types/common → common}/path-to-string.d.ts +0 -0
- /package/dist/{esm/common → common}/path-to-string.js +0 -0
- /package/dist/{types/common → common}/persisted-queries.d.ts +0 -0
- /package/dist/{esm/common → common}/persisted-queries.js +0 -0
- /package/dist/{types/common → common}/predicate.d.ts +0 -0
- /package/dist/{esm/common → common}/predicate.js +0 -0
- /package/dist/{types/common → common}/set-in.d.ts +0 -0
- /package/dist/{esm/common → common}/set-in.js +0 -0
- /package/dist/{types/common → common}/sets.d.ts +0 -0
- /package/dist/{esm/common → common}/sets.js +0 -0
- /package/dist/{types/common → common}/sleep.d.ts +0 -0
- /package/dist/{esm/common → common}/sleep.js +0 -0
- /package/dist/{types/common → common}/sort-object.d.ts +0 -0
- /package/dist/{esm/common → common}/sort-object.js +0 -0
- /package/dist/{types/common → common}/strings.d.ts +0 -0
- /package/dist/{types/common → common}/timezone.d.ts +0 -0
- /package/dist/{esm/common → common}/timezone.js +0 -0
- /package/dist/{types/common → common}/tracing.d.ts +0 -0
- /package/dist/{types/common → common}/types.d.ts +0 -0
- /package/dist/{esm/common → common}/types.js +0 -0
- /package/dist/{types/common → common}/unix-to-iso.d.ts +0 -0
- /package/dist/{esm/common → common}/unix-to-iso.js +0 -0
- /package/dist/{types/common → common}/urls.d.ts +0 -0
- /package/dist/{esm/common → common}/urls.js +0 -0
- /package/dist/{types/common → common}/validation.d.ts +0 -0
- /package/dist/{esm/common → common}/validation.js +0 -0
- /package/dist/{types/common → common}/value.d.ts +0 -0
- /package/dist/{esm/common → common}/value.js +0 -0
- /package/dist/{types/common → common}/visit.d.ts +0 -0
- /package/dist/{esm/common → common}/visit.js +0 -0
- /package/dist/{types/node → node}/buffer.d.ts +0 -0
- /package/dist/{esm/node → node}/buffer.js +0 -0
- /package/dist/{types/node → node}/encryption.d.ts +0 -0
- /package/dist/{esm/node → node}/encryption.js +0 -0
- /package/dist/{types/node → node}/gzip.d.ts +0 -0
- /package/dist/{types/node → node}/search-params.d.ts +0 -0
- /package/dist/{esm/node → node}/search-params.js +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import { arrayContainsAll, isDefined, setIsEqual, toArray } from "../arrays.js";
|
|
3
|
+
test('arrayContainsAll - true', () => {
|
|
4
|
+
const a = ['a', 'b', 'c'];
|
|
5
|
+
const b = ['b', 'c', 'a'];
|
|
6
|
+
expect(arrayContainsAll(a, b)).toEqual(true);
|
|
7
|
+
});
|
|
8
|
+
test('arrayContainsAll - true, different lengths', () => {
|
|
9
|
+
const a = ['a', 'b', 'c'];
|
|
10
|
+
const b = ['a', 'b', 'c', 'd', 'e'];
|
|
11
|
+
expect(arrayContainsAll(a, b)).toEqual(true);
|
|
12
|
+
});
|
|
13
|
+
test('arrayContainsAll - false', () => {
|
|
14
|
+
const a = ['a', 'b', 'c'];
|
|
15
|
+
const b = ['b', 'c', 'd'];
|
|
16
|
+
expect(arrayContainsAll(a, b)).toEqual(false);
|
|
17
|
+
});
|
|
18
|
+
test('setIsEqual - true', () => {
|
|
19
|
+
const a = ['a', 'b', 'c'];
|
|
20
|
+
const b = ['c', 'b', 'a'];
|
|
21
|
+
expect(setIsEqual(a, b)).toEqual(true);
|
|
22
|
+
});
|
|
23
|
+
test('setIsEqual - false, different values', () => {
|
|
24
|
+
const a = ['a', 'b', 'c'];
|
|
25
|
+
const b = ['d', 'b', 'a'];
|
|
26
|
+
expect(setIsEqual(a, b)).toEqual(false);
|
|
27
|
+
});
|
|
28
|
+
test('setIsEqual - false, different lengths', () => {
|
|
29
|
+
const a = ['a', 'b', 'c'];
|
|
30
|
+
const b = ['a', 'b', 'c', 'd', 'e'];
|
|
31
|
+
expect(setIsEqual(a, b)).toEqual(false);
|
|
32
|
+
});
|
|
33
|
+
test('isDefined', () => {
|
|
34
|
+
expect(isDefined({ foo: 'bar' })).toEqual(true);
|
|
35
|
+
expect(isDefined('')).toEqual(true);
|
|
36
|
+
expect(isDefined(undefined)).toEqual(false);
|
|
37
|
+
expect(isDefined(null)).toEqual(false);
|
|
38
|
+
});
|
|
39
|
+
test('toArray', () => {
|
|
40
|
+
expect(toArray({ foo: 'bar' })).toEqual([{ foo: 'bar' }]);
|
|
41
|
+
// @ts-expect-error
|
|
42
|
+
expect(toArray()).toEqual([]);
|
|
43
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { getStripeProductObject, isStripeProductObject } from "../billing.js";
|
|
3
|
+
const mockProductObject = {
|
|
4
|
+
object: 'product'
|
|
5
|
+
};
|
|
6
|
+
describe('isStripeProductObject', () => {
|
|
7
|
+
test('null', () => {
|
|
8
|
+
expect(isStripeProductObject(null)).toEqual(false);
|
|
9
|
+
});
|
|
10
|
+
test('string', () => {
|
|
11
|
+
expect(isStripeProductObject('string')).toEqual(false);
|
|
12
|
+
});
|
|
13
|
+
test('product', () => {
|
|
14
|
+
expect(isStripeProductObject(mockProductObject)).toEqual(true);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe('getStripeProductObject', () => {
|
|
18
|
+
test('null', () => {
|
|
19
|
+
expect(() => getStripeProductObject(null)).toThrowError('product is not a Stripe product object');
|
|
20
|
+
});
|
|
21
|
+
test('string', () => {
|
|
22
|
+
expect(() => getStripeProductObject('string')).toThrowError('product is not a Stripe product object');
|
|
23
|
+
});
|
|
24
|
+
test('product', () => {
|
|
25
|
+
expect(getStripeProductObject(mockProductObject)).toEqual(mockProductObject);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { REMOVE, deepClone, deepCloneWith } from "../clone.js";
|
|
3
|
+
import { value } from "../value.js";
|
|
4
|
+
describe('deepClone', () => {
|
|
5
|
+
it('clones deeply', () => {
|
|
6
|
+
const deepObject = {
|
|
7
|
+
foo: {
|
|
8
|
+
bar: 'baz'
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const clonedObject = deepClone(deepObject);
|
|
12
|
+
expect(clonedObject).toEqual(deepObject);
|
|
13
|
+
clonedObject.foo.bar = 'poo';
|
|
14
|
+
expect(clonedObject).not.toEqual(deepObject);
|
|
15
|
+
expect(deepObject).toEqual(deepObject);
|
|
16
|
+
});
|
|
17
|
+
it('does not clone prototype', () => {
|
|
18
|
+
const map = new Map([
|
|
19
|
+
['a', 1],
|
|
20
|
+
['b', 2],
|
|
21
|
+
['c', 3]
|
|
22
|
+
]);
|
|
23
|
+
expect(deepClone(map)).toEqual({});
|
|
24
|
+
});
|
|
25
|
+
it('removes undefined object properties', () => {
|
|
26
|
+
const obj = {
|
|
27
|
+
foo: undefined
|
|
28
|
+
};
|
|
29
|
+
const cloned = deepClone(obj);
|
|
30
|
+
expect('foo' in cloned).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
it('circular objects throw error', () => {
|
|
33
|
+
const a = {};
|
|
34
|
+
const b = { a };
|
|
35
|
+
a.b = b;
|
|
36
|
+
// No circular detection is a performance tradeoff
|
|
37
|
+
// Our previous implementation using JSON.parse(JSON.stringify(obj)) throws as well
|
|
38
|
+
expect(() => deepClone(a)).toThrowErrorMatchingInlineSnapshot('[RangeError: Maximum call stack size exceeded]');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe('deepCloneWith', () => {
|
|
42
|
+
it('clones deeply when customizer returns undefined', () => {
|
|
43
|
+
const deepObject = {
|
|
44
|
+
foo: {
|
|
45
|
+
bar: 'baz'
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const clonedObject = deepCloneWith(deepObject, value(undefined));
|
|
49
|
+
expect(clonedObject).toEqual(deepObject);
|
|
50
|
+
clonedObject.foo.bar = 'poo';
|
|
51
|
+
expect(clonedObject).not.toEqual(deepObject);
|
|
52
|
+
expect(deepObject).toEqual(deepObject);
|
|
53
|
+
});
|
|
54
|
+
it('does not clone prototype', () => {
|
|
55
|
+
const map = new Map([
|
|
56
|
+
['a', 1],
|
|
57
|
+
['b', 2],
|
|
58
|
+
['c', 3]
|
|
59
|
+
]);
|
|
60
|
+
expect(deepCloneWith(map, value(undefined))).toEqual({});
|
|
61
|
+
});
|
|
62
|
+
it('removes undefined object properties', () => {
|
|
63
|
+
const obj = {
|
|
64
|
+
foo: undefined
|
|
65
|
+
};
|
|
66
|
+
const cloned = deepCloneWith(obj, value(undefined));
|
|
67
|
+
expect('foo' in cloned).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
it('calls callback', () => {
|
|
70
|
+
const complex = [
|
|
71
|
+
{
|
|
72
|
+
objects: {
|
|
73
|
+
a: [
|
|
74
|
+
'foo',
|
|
75
|
+
{
|
|
76
|
+
bar: true
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
b: {
|
|
80
|
+
c: {
|
|
81
|
+
d: {
|
|
82
|
+
e: [{ value: 'lol' }]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
const callback = vi.fn((value, key, parent, clone) => {
|
|
90
|
+
if (value === 'foo') {
|
|
91
|
+
return REMOVE;
|
|
92
|
+
}
|
|
93
|
+
if (key === 'b') {
|
|
94
|
+
return {
|
|
95
|
+
...clone(value),
|
|
96
|
+
updated: true
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (value === 'lol') {
|
|
100
|
+
return 'haha';
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const result = deepCloneWith(complex, callback);
|
|
104
|
+
expect(result).toEqual([
|
|
105
|
+
{
|
|
106
|
+
objects: {
|
|
107
|
+
a: [
|
|
108
|
+
{
|
|
109
|
+
bar: true
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
b: {
|
|
113
|
+
c: {
|
|
114
|
+
d: {
|
|
115
|
+
e: [
|
|
116
|
+
{
|
|
117
|
+
value: 'haha'
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
updated: true
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export declare const data: {
|
|
2
|
+
blocks: ({
|
|
3
|
+
key: string;
|
|
4
|
+
text: string;
|
|
5
|
+
type: string;
|
|
6
|
+
depth: number;
|
|
7
|
+
inlineStyleRanges: never[];
|
|
8
|
+
entityRanges: never[];
|
|
9
|
+
data: {
|
|
10
|
+
lang: string;
|
|
11
|
+
};
|
|
12
|
+
} | {
|
|
13
|
+
key: string;
|
|
14
|
+
text: string;
|
|
15
|
+
type: string;
|
|
16
|
+
depth: number;
|
|
17
|
+
inlineStyleRanges: {
|
|
18
|
+
offset: number;
|
|
19
|
+
length: number;
|
|
20
|
+
style: string;
|
|
21
|
+
}[];
|
|
22
|
+
entityRanges: {
|
|
23
|
+
offset: number;
|
|
24
|
+
length: number;
|
|
25
|
+
key: number;
|
|
26
|
+
}[];
|
|
27
|
+
data: {
|
|
28
|
+
lang?: undefined;
|
|
29
|
+
};
|
|
30
|
+
})[];
|
|
31
|
+
entityMap: {
|
|
32
|
+
'0': {
|
|
33
|
+
type: string;
|
|
34
|
+
mutability: string;
|
|
35
|
+
data: {
|
|
36
|
+
id: string;
|
|
37
|
+
caption: {
|
|
38
|
+
blocks: {
|
|
39
|
+
key: string;
|
|
40
|
+
text: string;
|
|
41
|
+
type: string;
|
|
42
|
+
depth: number;
|
|
43
|
+
inlineStyleRanges: never[];
|
|
44
|
+
entityRanges: never[];
|
|
45
|
+
data: {};
|
|
46
|
+
}[];
|
|
47
|
+
entityMap: {};
|
|
48
|
+
};
|
|
49
|
+
credit: {
|
|
50
|
+
blocks: {
|
|
51
|
+
key: string;
|
|
52
|
+
text: string;
|
|
53
|
+
type: string;
|
|
54
|
+
depth: number;
|
|
55
|
+
inlineStyleRanges: never[];
|
|
56
|
+
entityRanges: never[];
|
|
57
|
+
data: {};
|
|
58
|
+
}[];
|
|
59
|
+
entityMap: {};
|
|
60
|
+
};
|
|
61
|
+
link: {
|
|
62
|
+
url: string;
|
|
63
|
+
external: boolean;
|
|
64
|
+
};
|
|
65
|
+
alignment: string;
|
|
66
|
+
size: string;
|
|
67
|
+
contentTypeId: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
'1': {
|
|
71
|
+
type: string;
|
|
72
|
+
mutability: string;
|
|
73
|
+
data: {
|
|
74
|
+
id: string;
|
|
75
|
+
caption: string;
|
|
76
|
+
credit: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
'2': {
|
|
80
|
+
type: string;
|
|
81
|
+
mutability: string;
|
|
82
|
+
data: {
|
|
83
|
+
id: string;
|
|
84
|
+
caption: string;
|
|
85
|
+
credit: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
'3': {
|
|
89
|
+
type: string;
|
|
90
|
+
mutability: string;
|
|
91
|
+
data: {
|
|
92
|
+
url: string;
|
|
93
|
+
author_name: string;
|
|
94
|
+
author_url: string;
|
|
95
|
+
html: string;
|
|
96
|
+
width: number;
|
|
97
|
+
height: null;
|
|
98
|
+
type: string;
|
|
99
|
+
cache_age: string;
|
|
100
|
+
provider_name: string;
|
|
101
|
+
provider_url: string;
|
|
102
|
+
version: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
'4': {
|
|
106
|
+
type: string;
|
|
107
|
+
mutability: string;
|
|
108
|
+
data: {
|
|
109
|
+
url: string;
|
|
110
|
+
target: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
export const data = {
|
|
2
|
+
blocks: [
|
|
3
|
+
{
|
|
4
|
+
key: '3fado',
|
|
5
|
+
text: 'Draftjs / Markdown Test Document',
|
|
6
|
+
type: 'header-one',
|
|
7
|
+
depth: 0,
|
|
8
|
+
inlineStyleRanges: [],
|
|
9
|
+
entityRanges: [],
|
|
10
|
+
data: {}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: 'cjtrq',
|
|
14
|
+
text: 'Fancy Stuff',
|
|
15
|
+
type: 'header-two',
|
|
16
|
+
depth: 0,
|
|
17
|
+
inlineStyleRanges: [],
|
|
18
|
+
entityRanges: [],
|
|
19
|
+
data: {}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: 'b02nl',
|
|
23
|
+
text: 'Image',
|
|
24
|
+
type: 'header-three',
|
|
25
|
+
depth: 0,
|
|
26
|
+
inlineStyleRanges: [],
|
|
27
|
+
entityRanges: [],
|
|
28
|
+
data: {}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: '9fsh4',
|
|
32
|
+
text: ' ',
|
|
33
|
+
type: 'atomic',
|
|
34
|
+
depth: 0,
|
|
35
|
+
inlineStyleRanges: [],
|
|
36
|
+
entityRanges: [
|
|
37
|
+
{
|
|
38
|
+
offset: 0,
|
|
39
|
+
length: 1,
|
|
40
|
+
key: 0
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
data: {}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: 'c3uvu',
|
|
47
|
+
text: 'Image without caption or credit',
|
|
48
|
+
type: 'header-three',
|
|
49
|
+
depth: 0,
|
|
50
|
+
inlineStyleRanges: [],
|
|
51
|
+
entityRanges: [],
|
|
52
|
+
data: {}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: '33gbo',
|
|
56
|
+
text: ' ',
|
|
57
|
+
type: 'atomic',
|
|
58
|
+
depth: 0,
|
|
59
|
+
inlineStyleRanges: [],
|
|
60
|
+
entityRanges: [
|
|
61
|
+
{
|
|
62
|
+
offset: 0,
|
|
63
|
+
length: 1,
|
|
64
|
+
key: 1
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
data: {}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: 'erfe7',
|
|
71
|
+
text: 'Image with caption and credit in asset, not in draftjs',
|
|
72
|
+
type: 'header-three',
|
|
73
|
+
depth: 0,
|
|
74
|
+
inlineStyleRanges: [],
|
|
75
|
+
entityRanges: [],
|
|
76
|
+
data: {}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: '1o0s4',
|
|
80
|
+
text: ' ',
|
|
81
|
+
type: 'atomic',
|
|
82
|
+
depth: 0,
|
|
83
|
+
inlineStyleRanges: [],
|
|
84
|
+
entityRanges: [
|
|
85
|
+
{
|
|
86
|
+
offset: 0,
|
|
87
|
+
length: 1,
|
|
88
|
+
key: 2
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
data: {}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: 'bs9r3',
|
|
95
|
+
text: '',
|
|
96
|
+
type: 'unstyled',
|
|
97
|
+
depth: 0,
|
|
98
|
+
inlineStyleRanges: [],
|
|
99
|
+
entityRanges: [],
|
|
100
|
+
data: {}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: 'dnqh2',
|
|
104
|
+
text: 'Media URL',
|
|
105
|
+
type: 'header-three',
|
|
106
|
+
depth: 0,
|
|
107
|
+
inlineStyleRanges: [],
|
|
108
|
+
entityRanges: [],
|
|
109
|
+
data: {}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: '8fa9m',
|
|
113
|
+
text: ' ',
|
|
114
|
+
type: 'atomic',
|
|
115
|
+
depth: 0,
|
|
116
|
+
inlineStyleRanges: [],
|
|
117
|
+
entityRanges: [
|
|
118
|
+
{
|
|
119
|
+
offset: 0,
|
|
120
|
+
length: 1,
|
|
121
|
+
key: 3
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
data: {}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
key: '7hpad',
|
|
128
|
+
text: 'Code Block',
|
|
129
|
+
type: 'header-three',
|
|
130
|
+
depth: 0,
|
|
131
|
+
inlineStyleRanges: [],
|
|
132
|
+
entityRanges: [],
|
|
133
|
+
data: {}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
key: 'cs8lc',
|
|
137
|
+
text: "if (true + true > 1) {\n console.log('true');\n}",
|
|
138
|
+
type: 'code-block',
|
|
139
|
+
depth: 0,
|
|
140
|
+
inlineStyleRanges: [],
|
|
141
|
+
entityRanges: [],
|
|
142
|
+
data: {
|
|
143
|
+
lang: 'javascript'
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
key: '60eo',
|
|
148
|
+
text: ' ',
|
|
149
|
+
type: 'section-break',
|
|
150
|
+
depth: 0,
|
|
151
|
+
inlineStyleRanges: [],
|
|
152
|
+
entityRanges: [],
|
|
153
|
+
data: {}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
key: '9ac0a',
|
|
157
|
+
text: 'Basic Markdown',
|
|
158
|
+
type: 'header-two',
|
|
159
|
+
depth: 0,
|
|
160
|
+
inlineStyleRanges: [],
|
|
161
|
+
entityRanges: [],
|
|
162
|
+
data: {}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
key: '2pij',
|
|
166
|
+
text: 'Normal Super Sub Pre link bold italic underline',
|
|
167
|
+
type: 'unstyled',
|
|
168
|
+
depth: 0,
|
|
169
|
+
inlineStyleRanges: [
|
|
170
|
+
{
|
|
171
|
+
offset: 7,
|
|
172
|
+
length: 5,
|
|
173
|
+
style: 'SUP'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
offset: 13,
|
|
177
|
+
length: 3,
|
|
178
|
+
style: 'SUB'
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
offset: 17,
|
|
182
|
+
length: 3,
|
|
183
|
+
style: 'CODE'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
offset: 26,
|
|
187
|
+
length: 4,
|
|
188
|
+
style: 'BOLD'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
offset: 31,
|
|
192
|
+
length: 6,
|
|
193
|
+
style: 'ITALIC'
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
offset: 38,
|
|
197
|
+
length: 9,
|
|
198
|
+
style: 'UNDERLINE'
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
entityRanges: [
|
|
202
|
+
{
|
|
203
|
+
offset: 21,
|
|
204
|
+
length: 4,
|
|
205
|
+
key: 4
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
data: {}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
key: 'b09mb',
|
|
212
|
+
text: 'Block Quote',
|
|
213
|
+
type: 'blockquote',
|
|
214
|
+
depth: 0,
|
|
215
|
+
inlineStyleRanges: [],
|
|
216
|
+
entityRanges: [],
|
|
217
|
+
data: {}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
key: 'ahpuf',
|
|
221
|
+
text: 'Pull Quote',
|
|
222
|
+
type: 'pullquote',
|
|
223
|
+
depth: 0,
|
|
224
|
+
inlineStyleRanges: [],
|
|
225
|
+
entityRanges: [],
|
|
226
|
+
data: {}
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
entityMap: {
|
|
230
|
+
'0': {
|
|
231
|
+
type: 'image',
|
|
232
|
+
mutability: 'IMMUTABLE',
|
|
233
|
+
data: {
|
|
234
|
+
id: '92d98a89-52c1-4761-a4f5-1cc3463f3c0f',
|
|
235
|
+
caption: {
|
|
236
|
+
blocks: [
|
|
237
|
+
{
|
|
238
|
+
key: '77jqj',
|
|
239
|
+
text: 'Image Caption',
|
|
240
|
+
type: 'unstyled',
|
|
241
|
+
depth: 0,
|
|
242
|
+
inlineStyleRanges: [],
|
|
243
|
+
entityRanges: [],
|
|
244
|
+
data: {}
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
entityMap: {}
|
|
248
|
+
},
|
|
249
|
+
credit: {
|
|
250
|
+
blocks: [
|
|
251
|
+
{
|
|
252
|
+
key: '77jqj',
|
|
253
|
+
text: 'Image Credit',
|
|
254
|
+
type: 'unstyled',
|
|
255
|
+
depth: 0,
|
|
256
|
+
inlineStyleRanges: [],
|
|
257
|
+
entityRanges: [],
|
|
258
|
+
data: {}
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
entityMap: {}
|
|
262
|
+
},
|
|
263
|
+
link: {
|
|
264
|
+
url: 'https://takeshape.io',
|
|
265
|
+
external: true
|
|
266
|
+
},
|
|
267
|
+
alignment: 'right',
|
|
268
|
+
size: 'medium',
|
|
269
|
+
contentTypeId: 'ASSET'
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
'1': {
|
|
273
|
+
type: 'image',
|
|
274
|
+
mutability: 'IMMUTABLE',
|
|
275
|
+
data: {
|
|
276
|
+
id: '885f34b5-8dea-483a-8909-c50b9932862c',
|
|
277
|
+
caption: '',
|
|
278
|
+
credit: ''
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
'2': {
|
|
282
|
+
type: 'image',
|
|
283
|
+
mutability: 'IMMUTABLE',
|
|
284
|
+
data: {
|
|
285
|
+
id: 'a251340c-e8c0-4df7-b38b-51dc7a9d6a44',
|
|
286
|
+
caption: '',
|
|
287
|
+
credit: ''
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
'3': {
|
|
291
|
+
type: 'oembed',
|
|
292
|
+
mutability: 'IMMUTABLE',
|
|
293
|
+
data: {
|
|
294
|
+
url: 'https://twitter.com/dog_feelings/status/1430266037182767105',
|
|
295
|
+
author_name: 'Thoughts of Dog®',
|
|
296
|
+
author_url: 'https://twitter.com/dog_feelings',
|
|
297
|
+
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">the FDA. has also fully approved. giving my forehead. a little smooch</p>— Thoughts of Dog® (@dog_feelings) <a href="https://twitter.com/dog_feelings/status/1430266037182767105?ref_src=twsrc%5Etfw">August 24, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>\n',
|
|
298
|
+
width: 550,
|
|
299
|
+
height: null,
|
|
300
|
+
type: 'rich',
|
|
301
|
+
cache_age: '3153600000',
|
|
302
|
+
provider_name: 'Twitter',
|
|
303
|
+
provider_url: 'https://twitter.com',
|
|
304
|
+
version: '1.0'
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
'4': {
|
|
308
|
+
type: 'LINK',
|
|
309
|
+
mutability: 'MUTABLE',
|
|
310
|
+
data: {
|
|
311
|
+
url: 'https://google.com',
|
|
312
|
+
target: '_blank'
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
};
|