@makeswift/runtime 0.7.13 → 0.7.14
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/ReadOnlyText.cjs.js +15 -26
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +15 -25
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/controls.cjs.js +1 -4
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +1 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +2 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs6.js +143 -132
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.es.js +2 -2
- package/dist/index.es6.js +144 -133
- package/dist/index.es6.js.map +1 -1
- package/dist/introspection.cjs.js +0 -1
- package/dist/introspection.cjs.js.map +1 -1
- package/dist/introspection.es.js +1 -1
- package/dist/{typography.cjs.js → leaf.cjs.js} +49 -12
- package/dist/leaf.cjs.js.map +1 -0
- package/dist/{typography.es.js → leaf.es.js} +49 -12
- package/dist/leaf.es.js.map +1 -0
- package/dist/next.es.js +1 -1
- package/dist/rich-text.cjs.js +29 -43
- package/dist/rich-text.cjs.js.map +1 -1
- package/dist/rich-text.es.js +30 -44
- package/dist/rich-text.es.js.map +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts +2 -5
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +21 -0
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/index.d.ts +0 -1
- package/dist/types/src/controls/rich-text/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/types.d.ts +47 -27
- package/dist/types/src/controls/rich-text/types.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts +5 -0
- package/dist/types/src/slate/BlockPlugin/clearBlockKeyForDevice.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts +9 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts +5 -0
- package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts.map +1 -0
- package/dist/types/src/slate/BlockPlugin/types.d.ts +4 -0
- package/dist/types/src/slate/BlockPlugin/types.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/constants.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/dedent.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/indent.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/ListPlugin.d.ts → slate/ListPlugin/index.d.ts} +6 -2
- package/dist/types/src/slate/ListPlugin/index.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/toggleList.d.ts +1 -1
- package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/utils/filterForSubtreeRoots.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +1 -0
- package/dist/types/src/slate/ListPlugin/utils/location.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/wrapList.d.ts +1 -1
- package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts +3 -0
- package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts +3 -0
- package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts +4 -0
- package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +15 -0
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts +3 -0
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts +3 -0
- package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts.map +1 -0
- package/dist/types/src/slate/index.d.ts +4 -0
- package/dist/types/src/slate/index.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate}/utils/editor.d.ts +1 -1
- package/dist/types/src/slate/utils/editor.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate}/utils/element.d.ts +3 -5
- package/dist/types/src/slate/utils/element.d.ts.map +1 -0
- package/package.json +8 -1
- package/dist/compare.cjs.js +0 -126
- package/dist/compare.cjs.js.map +0 -1
- package/dist/compare.es.js +0 -124
- package/dist/compare.es.js.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/constants.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/index.d.ts +0 -2
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/indent.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/index.d.ts +0 -6
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/dedent.test.d.ts +0 -3
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/dedent.test.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/indent.test.d.ts +0 -3
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/indent.test.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/normalization.test.d.ts +0 -3
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/normalization.test.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/slate-test-helper.d.ts +0 -48
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/slate-test-helper.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/toggleList.test.d.ts +0 -3
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/toggleList.test.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/types.d.ts +0 -21
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/types.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/unwrapList.test.d.ts +0 -3
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/unwrapList.test.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/filterForSubtreeRoots.test.d.ts +0 -2
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/filterForSubtreeRoots.test.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/getSelectedListItems.test.d.ts +0 -3
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/getSelectedListItems.test.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/wrapList.test.d.ts +0 -3
- package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/wrapList.test.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/typography.d.ts +0 -27
- package/dist/types/src/components/builtin/Text/components/Leaf/typography.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text/compare.d.ts +0 -5
- package/dist/types/src/controls/rich-text/compare.d.ts.map +0 -1
- package/dist/types/src/controls/rich-text/compare.test.d.ts +0 -2
- package/dist/types/src/controls/rich-text/compare.test.d.ts.map +0 -1
- package/dist/typography.cjs.js.map +0 -1
- package/dist/typography.es.js.map +0 -1
- /package/dist/types/src/{components/builtin/Text/EditableText → slate}/ListPlugin/constants.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/dedent.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/indent.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/unwrapList.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/utils/filterForSubtreeRoots.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/utils/getSelectedListItems.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text/EditableText/ListPlugin/lib → slate/ListPlugin}/utils/location.d.ts +0 -0
package/dist/compare.cjs.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var richText = require("./rich-text.cjs.js");
|
|
3
|
-
function compareLists(compareFunc, a, b) {
|
|
4
|
-
if (typeof a === "undefined" || typeof b === "undefined") {
|
|
5
|
-
return Object.is(a, b);
|
|
6
|
-
}
|
|
7
|
-
return a.length === b.length && a.reduce((acc, curra, index) => {
|
|
8
|
-
const currb = b.at(index);
|
|
9
|
-
if (acc == false || currb == null)
|
|
10
|
-
return false;
|
|
11
|
-
return compareFunc(curra, currb);
|
|
12
|
-
}, true);
|
|
13
|
-
}
|
|
14
|
-
function compareRichTextTypography(a, b) {
|
|
15
|
-
if (a.id !== b.id)
|
|
16
|
-
return false;
|
|
17
|
-
if (a.style.length !== b.style.length)
|
|
18
|
-
return false;
|
|
19
|
-
return a.style.reduce((acc, curra, index) => {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
21
|
-
if (acc == false)
|
|
22
|
-
return false;
|
|
23
|
-
const currb = b.style.at(index);
|
|
24
|
-
if (currb == null)
|
|
25
|
-
return false;
|
|
26
|
-
if (curra.deviceId !== (currb == null ? void 0 : currb.deviceId))
|
|
27
|
-
return false;
|
|
28
|
-
if (((_a = curra.value.color) == null ? void 0 : _a.alpha) !== ((_b = currb.value.color) == null ? void 0 : _b.alpha))
|
|
29
|
-
return false;
|
|
30
|
-
if (((_c = curra.value.color) == null ? void 0 : _c.swatchId) !== ((_d = currb.value.color) == null ? void 0 : _d.swatchId))
|
|
31
|
-
return false;
|
|
32
|
-
if (curra.value.fontFamily !== currb.value.fontFamily)
|
|
33
|
-
return false;
|
|
34
|
-
if (((_e = curra.value.fontSize) == null ? void 0 : _e.unit) !== ((_f = currb.value.fontSize) == null ? void 0 : _f.unit) || ((_g = curra.value.fontSize) == null ? void 0 : _g.value) !== ((_h = currb.value.fontSize) == null ? void 0 : _h.value))
|
|
35
|
-
return false;
|
|
36
|
-
if (curra.value.fontWeight !== currb.value.fontWeight)
|
|
37
|
-
return false;
|
|
38
|
-
if (curra.value.italic !== currb.value.italic)
|
|
39
|
-
return false;
|
|
40
|
-
if (curra.value.letterSpacing !== currb.value.letterSpacing)
|
|
41
|
-
return false;
|
|
42
|
-
if (curra.value.lineHeight !== currb.value.lineHeight)
|
|
43
|
-
return false;
|
|
44
|
-
if (curra.value.strikethrough !== currb.value.strikethrough)
|
|
45
|
-
return false;
|
|
46
|
-
if (curra.value.underline !== currb.value.underline)
|
|
47
|
-
return false;
|
|
48
|
-
if (curra.value.uppercase !== currb.value.uppercase)
|
|
49
|
-
return false;
|
|
50
|
-
return true;
|
|
51
|
-
}, true);
|
|
52
|
-
}
|
|
53
|
-
function compareBlockTextAlignment(a, b) {
|
|
54
|
-
if (typeof a === "undefined" || typeof b === "undefined") {
|
|
55
|
-
return Object.is(a, b);
|
|
56
|
-
}
|
|
57
|
-
return a.reduce((acc, curra, index) => {
|
|
58
|
-
if (acc == false)
|
|
59
|
-
return false;
|
|
60
|
-
const currb = b.at(index);
|
|
61
|
-
if (curra.deviceId !== (currb == null ? void 0 : currb.deviceId))
|
|
62
|
-
return false;
|
|
63
|
-
if (curra.value !== currb.value)
|
|
64
|
-
return false;
|
|
65
|
-
return true;
|
|
66
|
-
}, true);
|
|
67
|
-
}
|
|
68
|
-
function compareLinkControlData(a, b) {
|
|
69
|
-
var _a, _b, _c, _d;
|
|
70
|
-
if (a.type !== b.type)
|
|
71
|
-
return false;
|
|
72
|
-
if (a.type === "OPEN_PAGE" && b.type === "OPEN_PAGE") {
|
|
73
|
-
return a.payload.pageId === b.payload.pageId && a.payload.openInNewTab === b.payload.openInNewTab;
|
|
74
|
-
}
|
|
75
|
-
if (a.type === "OPEN_URL" && b.type === "OPEN_URL") {
|
|
76
|
-
return a.payload.openInNewTab === b.payload.openInNewTab && a.payload.url === b.payload.url;
|
|
77
|
-
}
|
|
78
|
-
if (a.type === "SEND_EMAIL" && b.type === "SEND_EMAIL") {
|
|
79
|
-
return a.payload.body === b.payload.body && a.payload.subject === b.payload.subject && a.payload.to === b.payload.to;
|
|
80
|
-
}
|
|
81
|
-
if (a.type === "CALL_PHONE" && b.type === "CALL_PHONE") {
|
|
82
|
-
return a.payload.phoneNumber === b.payload.phoneNumber;
|
|
83
|
-
}
|
|
84
|
-
if (a.type === "SCROLL_TO_ELEMENT" && b.type === "SCROLL_TO_ELEMENT") {
|
|
85
|
-
return a.payload.block === b.payload.block && ((_a = a.payload.elementIdConfig) == null ? void 0 : _a.elementKey) === ((_b = b.payload.elementIdConfig) == null ? void 0 : _b.elementKey) && ((_c = a.payload.elementIdConfig) == null ? void 0 : _c.propName) === ((_d = b.payload.elementIdConfig) == null ? void 0 : _d.propName);
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
function compareInlineAndText(a, b) {
|
|
90
|
-
if (a.type !== b.type)
|
|
91
|
-
return false;
|
|
92
|
-
if (a.type === richText.TextType.Text && b.type === richText.TextType.Text) {
|
|
93
|
-
return a.text === b.text;
|
|
94
|
-
}
|
|
95
|
-
if (a.type === richText.TextType.Typography && b.type === richText.TextType.Typography) {
|
|
96
|
-
return a.text === b.text && compareRichTextTypography(a.typography, b.typography);
|
|
97
|
-
}
|
|
98
|
-
if (a.type === richText.InlineType.Link && b.type === richText.InlineType.Link) {
|
|
99
|
-
return compareLinkControlData(a.link, b.link) && compareLists(compareInlineAndText, a.children, b.children);
|
|
100
|
-
}
|
|
101
|
-
if (a.type === richText.InlineType.Code && b.type === richText.InlineType.Code || a.type === richText.InlineType.SubScript && b.type === richText.InlineType.SubScript || a.type === richText.InlineType.SuperScript && b.type === richText.InlineType.SuperScript) {
|
|
102
|
-
return compareLists(compareInlineAndText, a.children, b.children);
|
|
103
|
-
}
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
function compareRichTextDescendant(a, b) {
|
|
107
|
-
if (a.type !== b.type) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
if (a.type === richText.TextType.Text && b.type === richText.TextType.Text || a.type === richText.TextType.Typography && b.type === richText.TextType.Typography || a.type === richText.InlineType.Link && b.type === richText.InlineType.Link || a.type === richText.InlineType.Code && b.type === richText.InlineType.Code || a.type === richText.InlineType.SubScript && b.type === richText.InlineType.SubScript || a.type === richText.InlineType.SuperScript && b.type === richText.InlineType.SuperScript) {
|
|
111
|
-
return compareInlineAndText(a, b);
|
|
112
|
-
}
|
|
113
|
-
if (a.type === richText.BlockType.BlockQuote && b.type === richText.BlockType.BlockQuote || a.type === richText.BlockType.Heading1 && b.type === richText.BlockType.Heading1 || a.type === richText.BlockType.Heading2 && b.type === richText.BlockType.Heading2 || a.type === richText.BlockType.Heading3 && b.type === richText.BlockType.Heading3 || a.type === richText.BlockType.Heading4 && b.type === richText.BlockType.Heading4 || a.type === richText.BlockType.Heading5 && b.type === richText.BlockType.Heading5 || a.type === richText.BlockType.Heading6 && b.type === richText.BlockType.Heading6 || a.type === richText.BlockType.Paragraph && b.type === richText.BlockType.Paragraph || a.type === richText.BlockType.OrderedList && b.type === richText.BlockType.OrderedList || a.type === richText.BlockType.UnorderedList && b.type === richText.BlockType.UnorderedList || a.type === richText.BlockType.ListItem && b.type === richText.BlockType.ListItem || a.type === richText.BlockType.ListItemChild && b.type === richText.BlockType.ListItemChild) {
|
|
114
|
-
return compareBlockTextAlignment(a.textAlign, b.textAlign) && compareLists(compareRichTextDescendant, a.children, b.children);
|
|
115
|
-
}
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
function compareRichTextDAO(a, b) {
|
|
119
|
-
return compareLists(compareRichTextDescendant, a, b);
|
|
120
|
-
}
|
|
121
|
-
function compareRichTextSelection(a, b) {
|
|
122
|
-
return (a == null ? void 0 : a.anchor.offset) === (b == null ? void 0 : b.anchor.offset) && (a == null ? void 0 : a.focus.offset) === (b == null ? void 0 : b.focus.offset) && compareLists(Object.is, a == null ? void 0 : a.focus.path, b == null ? void 0 : b.focus.path);
|
|
123
|
-
}
|
|
124
|
-
exports.compareRichTextDAO = compareRichTextDAO;
|
|
125
|
-
exports.compareRichTextSelection = compareRichTextSelection;
|
|
126
|
-
//# sourceMappingURL=compare.cjs.js.map
|
package/dist/compare.cjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.cjs.js","sources":["../src/controls/rich-text/compare.ts"],"sourcesContent":["import { Descendant, Selection } from 'slate'\nimport { Typography } from '../../api'\nimport { LinkControlData } from '../link'\nimport {\n Text,\n Inline,\n TextType,\n InlineType,\n BlockType,\n RichTextDAO,\n BlockTextAlignment,\n} from './types'\n\nfunction compareLists<T>(compareFunc: (a: T, b: T) => boolean, a?: T[], b?: T[]): boolean {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return (\n a.length === b.length &&\n a.reduce((acc, curra, index) => {\n const currb = b.at(index)\n if (acc == false || currb == null) return false\n\n return compareFunc(curra, currb)\n }, true as boolean)\n )\n}\n\nfunction compareRichTextTypography(a: Typography, b: Typography) {\n if (a.id !== b.id) return false\n if (a.style.length !== b.style.length) return false\n\n return a.style.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.style.at(index)\n\n if (currb == null) return false\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value.color?.alpha !== currb.value.color?.alpha) return false\n if (curra.value.color?.swatchId !== currb.value.color?.swatchId) return false\n if (curra.value.fontFamily !== currb.value.fontFamily) return false\n if (\n curra.value.fontSize?.unit !== currb.value.fontSize?.unit ||\n curra.value.fontSize?.value !== currb.value.fontSize?.value\n )\n return false\n if (curra.value.fontWeight !== currb.value.fontWeight) return false\n if (curra.value.italic !== currb.value.italic) return false\n if (curra.value.letterSpacing !== currb.value.letterSpacing) return false\n if (curra.value.lineHeight !== currb.value.lineHeight) return false\n if (curra.value.strikethrough !== currb.value.strikethrough) return false\n if (curra.value.underline !== currb.value.underline) return false\n if (curra.value.uppercase !== currb.value.uppercase) return false\n\n return true\n }, true)\n}\n\nfunction compareBlockTextAlignment(a?: BlockTextAlignment, b?: BlockTextAlignment) {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return a.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.at(index)\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value !== currb.value) return false\n return true\n }, true)\n}\n\nfunction compareLinkControlData(a: LinkControlData, b: LinkControlData) {\n if (a.type !== b.type) return false\n\n if (a.type === 'OPEN_PAGE' && b.type === 'OPEN_PAGE') {\n return (\n a.payload.pageId === b.payload.pageId && a.payload.openInNewTab === b.payload.openInNewTab\n )\n }\n\n if (a.type === 'OPEN_URL' && b.type === 'OPEN_URL') {\n return a.payload.openInNewTab === b.payload.openInNewTab && a.payload.url === b.payload.url\n }\n\n if (a.type === 'SEND_EMAIL' && b.type === 'SEND_EMAIL') {\n return (\n a.payload.body === b.payload.body &&\n a.payload.subject === b.payload.subject &&\n a.payload.to === b.payload.to\n )\n }\n\n if (a.type === 'CALL_PHONE' && b.type === 'CALL_PHONE') {\n return a.payload.phoneNumber === b.payload.phoneNumber\n }\n\n if (a.type === 'SCROLL_TO_ELEMENT' && b.type === 'SCROLL_TO_ELEMENT') {\n return (\n a.payload.block === b.payload.block &&\n a.payload.elementIdConfig?.elementKey === b.payload.elementIdConfig?.elementKey &&\n a.payload.elementIdConfig?.propName === b.payload.elementIdConfig?.propName\n )\n }\n\n return true\n}\n\nfunction compareInlineAndText(a: Text | Inline, b: Text | Inline): boolean {\n if (a.type !== b.type) return false\n if (a.type === TextType.Text && b.type === TextType.Text) {\n return a.text === b.text\n }\n\n if (a.type === TextType.Typography && b.type === TextType.Typography) {\n return a.text === b.text && compareRichTextTypography(a.typography, b.typography)\n }\n\n if (a.type === InlineType.Link && b.type === InlineType.Link) {\n return (\n compareLinkControlData(a.link, b.link) &&\n compareLists(compareInlineAndText, a.children, b.children)\n )\n }\n\n if (\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareLists(compareInlineAndText, a.children, b.children)\n }\n\n return true\n}\n\nfunction compareRichTextDescendant(a: Descendant, b: Descendant): boolean {\n if (a.type !== b.type) {\n return false\n }\n\n if (\n (a.type === TextType.Text && b.type === TextType.Text) ||\n (a.type === TextType.Typography && b.type === TextType.Typography) ||\n (a.type === InlineType.Link && b.type === InlineType.Link) ||\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareInlineAndText(a, b)\n }\n\n if (\n (a.type === BlockType.BlockQuote && b.type === BlockType.BlockQuote) ||\n (a.type === BlockType.Heading1 && b.type === BlockType.Heading1) ||\n (a.type === BlockType.Heading2 && b.type === BlockType.Heading2) ||\n (a.type === BlockType.Heading3 && b.type === BlockType.Heading3) ||\n (a.type === BlockType.Heading4 && b.type === BlockType.Heading4) ||\n (a.type === BlockType.Heading5 && b.type === BlockType.Heading5) ||\n (a.type === BlockType.Heading6 && b.type === BlockType.Heading6) ||\n (a.type === BlockType.Paragraph && b.type === BlockType.Paragraph) ||\n (a.type === BlockType.OrderedList && b.type === BlockType.OrderedList) ||\n (a.type === BlockType.UnorderedList && b.type === BlockType.UnorderedList) ||\n (a.type === BlockType.ListItem && b.type === BlockType.ListItem) ||\n (a.type === BlockType.ListItemChild && b.type === BlockType.ListItemChild)\n ) {\n return (\n compareBlockTextAlignment(a.textAlign, b.textAlign) &&\n compareLists(compareRichTextDescendant, a.children, b.children)\n )\n }\n\n return true\n}\n\nexport function compareRichTextDAO(a: RichTextDAO, b: RichTextDAO) {\n return compareLists(compareRichTextDescendant, a, b)\n}\n\nexport function compareRichTextSelection(a: Selection, b: Selection) {\n return (\n a?.anchor.offset === b?.anchor.offset &&\n a?.focus.offset === b?.focus.offset &&\n compareLists(Object.is, a?.focus.path, b?.focus.path)\n )\n}\n"],"names":["TextType","InlineType","BlockType"],"mappings":";;AAaA,sBAAyB,aAAsC,GAAS,GAAkB;AACxF,MAAI,OAAO,MAAM,eAAe,OAAO,MAAM,aAAa;AACjD,WAAA,OAAO,GAAG,GAAG,CAAC;AAAA,EACvB;AAEE,SAAA,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,CAAC,KAAK,OAAO,UAAU;AACxB,UAAA,QAAQ,EAAE,GAAG,KAAK;AACpB,QAAA,OAAO,SAAS,SAAS;AAAa,aAAA;AAEnC,WAAA,YAAY,OAAO,KAAK;AAAA,KAC9B,IAAe;AAEtB;AAEA,mCAAmC,GAAe,GAAe;AAC3D,MAAA,EAAE,OAAO,EAAE;AAAW,WAAA;AAC1B,MAAI,EAAE,MAAM,WAAW,EAAE,MAAM;AAAe,WAAA;AAE9C,SAAO,EAAE,MAAM,OAAO,CAAC,KAAK,OAAO,UAAU;;AAC3C,QAAI,OAAO;AAAc,aAAA;AACzB,UAAM,QAAQ,EAAE,MAAM,GAAG,KAAK;AAE9B,QAAI,SAAS;AAAa,aAAA;AACtB,QAAA,MAAM,aAAa,gCAAO;AAAiB,aAAA;AAC/C,QAAI,aAAM,MAAM,UAAZ,mBAAmB,WAAU,aAAM,MAAM,UAAZ,mBAAmB;AAAc,a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AE,SAASA,mBAAU,aAAa,EAAE,SAASA,SAAAA,UAAU,aACvD,EAAE,SAASA,SAAU,UAAA,eAAe,EAAE,SAASA,SAAU,UAAA,eACzD,EAAE,SAASA,SAAA,UAAU,iBAAiB,EAAE,SAASA,mBAAU,iBAC3D,EAAE,SAASA,SAAAA,UAAU,YAAY,EAAE,SAASA,SAAA,UAAU,YACtD,EAAE,SAASA,mBAAU,iBAAiB,EAAE,SAASA,SAAAA,UAAU,eAC5D;AAEE,WAAA,0BAA0B,EAAE,WAAW,EAAE,SAAS,KAClD,aAAa,2BAA2B,EAAE,UAAU,EAAE,QAAQ;AAAA,EAElE;AAEO,SAAA;AACT;AAEO,4BAA4B,GAAgB,GAAgB;AAC1D,SAAA,aAAa,2BAA2B,GAAG,CAAC;AACrD;AAEO,kCAAkC,GAAc,GAAc;AAEjE,SAAA,wBAAG,OAAO,YAAW,wBAAG,OAAO,WAC/B,wBAAG,MAAM,YAAW,wBAAG,MAAM,WAC7B,aAAa,OAAO,IAAI,uBAAG,MAAM,MAAM,uBAAG,MAAM,IAAI;AAExD;;;"}
|
package/dist/compare.es.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { au as TextType, aw as InlineType, av as BlockType } from "./rich-text.es.js";
|
|
2
|
-
function compareLists(compareFunc, a, b) {
|
|
3
|
-
if (typeof a === "undefined" || typeof b === "undefined") {
|
|
4
|
-
return Object.is(a, b);
|
|
5
|
-
}
|
|
6
|
-
return a.length === b.length && a.reduce((acc, curra, index) => {
|
|
7
|
-
const currb = b.at(index);
|
|
8
|
-
if (acc == false || currb == null)
|
|
9
|
-
return false;
|
|
10
|
-
return compareFunc(curra, currb);
|
|
11
|
-
}, true);
|
|
12
|
-
}
|
|
13
|
-
function compareRichTextTypography(a, b) {
|
|
14
|
-
if (a.id !== b.id)
|
|
15
|
-
return false;
|
|
16
|
-
if (a.style.length !== b.style.length)
|
|
17
|
-
return false;
|
|
18
|
-
return a.style.reduce((acc, curra, index) => {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
20
|
-
if (acc == false)
|
|
21
|
-
return false;
|
|
22
|
-
const currb = b.style.at(index);
|
|
23
|
-
if (currb == null)
|
|
24
|
-
return false;
|
|
25
|
-
if (curra.deviceId !== (currb == null ? void 0 : currb.deviceId))
|
|
26
|
-
return false;
|
|
27
|
-
if (((_a = curra.value.color) == null ? void 0 : _a.alpha) !== ((_b = currb.value.color) == null ? void 0 : _b.alpha))
|
|
28
|
-
return false;
|
|
29
|
-
if (((_c = curra.value.color) == null ? void 0 : _c.swatchId) !== ((_d = currb.value.color) == null ? void 0 : _d.swatchId))
|
|
30
|
-
return false;
|
|
31
|
-
if (curra.value.fontFamily !== currb.value.fontFamily)
|
|
32
|
-
return false;
|
|
33
|
-
if (((_e = curra.value.fontSize) == null ? void 0 : _e.unit) !== ((_f = currb.value.fontSize) == null ? void 0 : _f.unit) || ((_g = curra.value.fontSize) == null ? void 0 : _g.value) !== ((_h = currb.value.fontSize) == null ? void 0 : _h.value))
|
|
34
|
-
return false;
|
|
35
|
-
if (curra.value.fontWeight !== currb.value.fontWeight)
|
|
36
|
-
return false;
|
|
37
|
-
if (curra.value.italic !== currb.value.italic)
|
|
38
|
-
return false;
|
|
39
|
-
if (curra.value.letterSpacing !== currb.value.letterSpacing)
|
|
40
|
-
return false;
|
|
41
|
-
if (curra.value.lineHeight !== currb.value.lineHeight)
|
|
42
|
-
return false;
|
|
43
|
-
if (curra.value.strikethrough !== currb.value.strikethrough)
|
|
44
|
-
return false;
|
|
45
|
-
if (curra.value.underline !== currb.value.underline)
|
|
46
|
-
return false;
|
|
47
|
-
if (curra.value.uppercase !== currb.value.uppercase)
|
|
48
|
-
return false;
|
|
49
|
-
return true;
|
|
50
|
-
}, true);
|
|
51
|
-
}
|
|
52
|
-
function compareBlockTextAlignment(a, b) {
|
|
53
|
-
if (typeof a === "undefined" || typeof b === "undefined") {
|
|
54
|
-
return Object.is(a, b);
|
|
55
|
-
}
|
|
56
|
-
return a.reduce((acc, curra, index) => {
|
|
57
|
-
if (acc == false)
|
|
58
|
-
return false;
|
|
59
|
-
const currb = b.at(index);
|
|
60
|
-
if (curra.deviceId !== (currb == null ? void 0 : currb.deviceId))
|
|
61
|
-
return false;
|
|
62
|
-
if (curra.value !== currb.value)
|
|
63
|
-
return false;
|
|
64
|
-
return true;
|
|
65
|
-
}, true);
|
|
66
|
-
}
|
|
67
|
-
function compareLinkControlData(a, b) {
|
|
68
|
-
var _a, _b, _c, _d;
|
|
69
|
-
if (a.type !== b.type)
|
|
70
|
-
return false;
|
|
71
|
-
if (a.type === "OPEN_PAGE" && b.type === "OPEN_PAGE") {
|
|
72
|
-
return a.payload.pageId === b.payload.pageId && a.payload.openInNewTab === b.payload.openInNewTab;
|
|
73
|
-
}
|
|
74
|
-
if (a.type === "OPEN_URL" && b.type === "OPEN_URL") {
|
|
75
|
-
return a.payload.openInNewTab === b.payload.openInNewTab && a.payload.url === b.payload.url;
|
|
76
|
-
}
|
|
77
|
-
if (a.type === "SEND_EMAIL" && b.type === "SEND_EMAIL") {
|
|
78
|
-
return a.payload.body === b.payload.body && a.payload.subject === b.payload.subject && a.payload.to === b.payload.to;
|
|
79
|
-
}
|
|
80
|
-
if (a.type === "CALL_PHONE" && b.type === "CALL_PHONE") {
|
|
81
|
-
return a.payload.phoneNumber === b.payload.phoneNumber;
|
|
82
|
-
}
|
|
83
|
-
if (a.type === "SCROLL_TO_ELEMENT" && b.type === "SCROLL_TO_ELEMENT") {
|
|
84
|
-
return a.payload.block === b.payload.block && ((_a = a.payload.elementIdConfig) == null ? void 0 : _a.elementKey) === ((_b = b.payload.elementIdConfig) == null ? void 0 : _b.elementKey) && ((_c = a.payload.elementIdConfig) == null ? void 0 : _c.propName) === ((_d = b.payload.elementIdConfig) == null ? void 0 : _d.propName);
|
|
85
|
-
}
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
function compareInlineAndText(a, b) {
|
|
89
|
-
if (a.type !== b.type)
|
|
90
|
-
return false;
|
|
91
|
-
if (a.type === TextType.Text && b.type === TextType.Text) {
|
|
92
|
-
return a.text === b.text;
|
|
93
|
-
}
|
|
94
|
-
if (a.type === TextType.Typography && b.type === TextType.Typography) {
|
|
95
|
-
return a.text === b.text && compareRichTextTypography(a.typography, b.typography);
|
|
96
|
-
}
|
|
97
|
-
if (a.type === InlineType.Link && b.type === InlineType.Link) {
|
|
98
|
-
return compareLinkControlData(a.link, b.link) && compareLists(compareInlineAndText, a.children, b.children);
|
|
99
|
-
}
|
|
100
|
-
if (a.type === InlineType.Code && b.type === InlineType.Code || a.type === InlineType.SubScript && b.type === InlineType.SubScript || a.type === InlineType.SuperScript && b.type === InlineType.SuperScript) {
|
|
101
|
-
return compareLists(compareInlineAndText, a.children, b.children);
|
|
102
|
-
}
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
function compareRichTextDescendant(a, b) {
|
|
106
|
-
if (a.type !== b.type) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
if (a.type === TextType.Text && b.type === TextType.Text || a.type === TextType.Typography && b.type === TextType.Typography || a.type === InlineType.Link && b.type === InlineType.Link || a.type === InlineType.Code && b.type === InlineType.Code || a.type === InlineType.SubScript && b.type === InlineType.SubScript || a.type === InlineType.SuperScript && b.type === InlineType.SuperScript) {
|
|
110
|
-
return compareInlineAndText(a, b);
|
|
111
|
-
}
|
|
112
|
-
if (a.type === BlockType.BlockQuote && b.type === BlockType.BlockQuote || a.type === BlockType.Heading1 && b.type === BlockType.Heading1 || a.type === BlockType.Heading2 && b.type === BlockType.Heading2 || a.type === BlockType.Heading3 && b.type === BlockType.Heading3 || a.type === BlockType.Heading4 && b.type === BlockType.Heading4 || a.type === BlockType.Heading5 && b.type === BlockType.Heading5 || a.type === BlockType.Heading6 && b.type === BlockType.Heading6 || a.type === BlockType.Paragraph && b.type === BlockType.Paragraph || a.type === BlockType.OrderedList && b.type === BlockType.OrderedList || a.type === BlockType.UnorderedList && b.type === BlockType.UnorderedList || a.type === BlockType.ListItem && b.type === BlockType.ListItem || a.type === BlockType.ListItemChild && b.type === BlockType.ListItemChild) {
|
|
113
|
-
return compareBlockTextAlignment(a.textAlign, b.textAlign) && compareLists(compareRichTextDescendant, a.children, b.children);
|
|
114
|
-
}
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
function compareRichTextDAO(a, b) {
|
|
118
|
-
return compareLists(compareRichTextDescendant, a, b);
|
|
119
|
-
}
|
|
120
|
-
function compareRichTextSelection(a, b) {
|
|
121
|
-
return (a == null ? void 0 : a.anchor.offset) === (b == null ? void 0 : b.anchor.offset) && (a == null ? void 0 : a.focus.offset) === (b == null ? void 0 : b.focus.offset) && compareLists(Object.is, a == null ? void 0 : a.focus.path, b == null ? void 0 : b.focus.path);
|
|
122
|
-
}
|
|
123
|
-
export { compareRichTextSelection as a, compareRichTextDAO as c };
|
|
124
|
-
//# sourceMappingURL=compare.es.js.map
|
package/dist/compare.es.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.es.js","sources":["../src/controls/rich-text/compare.ts"],"sourcesContent":["import { Descendant, Selection } from 'slate'\nimport { Typography } from '../../api'\nimport { LinkControlData } from '../link'\nimport {\n Text,\n Inline,\n TextType,\n InlineType,\n BlockType,\n RichTextDAO,\n BlockTextAlignment,\n} from './types'\n\nfunction compareLists<T>(compareFunc: (a: T, b: T) => boolean, a?: T[], b?: T[]): boolean {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return (\n a.length === b.length &&\n a.reduce((acc, curra, index) => {\n const currb = b.at(index)\n if (acc == false || currb == null) return false\n\n return compareFunc(curra, currb)\n }, true as boolean)\n )\n}\n\nfunction compareRichTextTypography(a: Typography, b: Typography) {\n if (a.id !== b.id) return false\n if (a.style.length !== b.style.length) return false\n\n return a.style.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.style.at(index)\n\n if (currb == null) return false\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value.color?.alpha !== currb.value.color?.alpha) return false\n if (curra.value.color?.swatchId !== currb.value.color?.swatchId) return false\n if (curra.value.fontFamily !== currb.value.fontFamily) return false\n if (\n curra.value.fontSize?.unit !== currb.value.fontSize?.unit ||\n curra.value.fontSize?.value !== currb.value.fontSize?.value\n )\n return false\n if (curra.value.fontWeight !== currb.value.fontWeight) return false\n if (curra.value.italic !== currb.value.italic) return false\n if (curra.value.letterSpacing !== currb.value.letterSpacing) return false\n if (curra.value.lineHeight !== currb.value.lineHeight) return false\n if (curra.value.strikethrough !== currb.value.strikethrough) return false\n if (curra.value.underline !== currb.value.underline) return false\n if (curra.value.uppercase !== currb.value.uppercase) return false\n\n return true\n }, true)\n}\n\nfunction compareBlockTextAlignment(a?: BlockTextAlignment, b?: BlockTextAlignment) {\n if (typeof a === 'undefined' || typeof b === 'undefined') {\n return Object.is(a, b)\n }\n return a.reduce((acc, curra, index) => {\n if (acc == false) return false\n const currb = b.at(index)\n if (curra.deviceId !== currb?.deviceId) return false\n if (curra.value !== currb.value) return false\n return true\n }, true)\n}\n\nfunction compareLinkControlData(a: LinkControlData, b: LinkControlData) {\n if (a.type !== b.type) return false\n\n if (a.type === 'OPEN_PAGE' && b.type === 'OPEN_PAGE') {\n return (\n a.payload.pageId === b.payload.pageId && a.payload.openInNewTab === b.payload.openInNewTab\n )\n }\n\n if (a.type === 'OPEN_URL' && b.type === 'OPEN_URL') {\n return a.payload.openInNewTab === b.payload.openInNewTab && a.payload.url === b.payload.url\n }\n\n if (a.type === 'SEND_EMAIL' && b.type === 'SEND_EMAIL') {\n return (\n a.payload.body === b.payload.body &&\n a.payload.subject === b.payload.subject &&\n a.payload.to === b.payload.to\n )\n }\n\n if (a.type === 'CALL_PHONE' && b.type === 'CALL_PHONE') {\n return a.payload.phoneNumber === b.payload.phoneNumber\n }\n\n if (a.type === 'SCROLL_TO_ELEMENT' && b.type === 'SCROLL_TO_ELEMENT') {\n return (\n a.payload.block === b.payload.block &&\n a.payload.elementIdConfig?.elementKey === b.payload.elementIdConfig?.elementKey &&\n a.payload.elementIdConfig?.propName === b.payload.elementIdConfig?.propName\n )\n }\n\n return true\n}\n\nfunction compareInlineAndText(a: Text | Inline, b: Text | Inline): boolean {\n if (a.type !== b.type) return false\n if (a.type === TextType.Text && b.type === TextType.Text) {\n return a.text === b.text\n }\n\n if (a.type === TextType.Typography && b.type === TextType.Typography) {\n return a.text === b.text && compareRichTextTypography(a.typography, b.typography)\n }\n\n if (a.type === InlineType.Link && b.type === InlineType.Link) {\n return (\n compareLinkControlData(a.link, b.link) &&\n compareLists(compareInlineAndText, a.children, b.children)\n )\n }\n\n if (\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareLists(compareInlineAndText, a.children, b.children)\n }\n\n return true\n}\n\nfunction compareRichTextDescendant(a: Descendant, b: Descendant): boolean {\n if (a.type !== b.type) {\n return false\n }\n\n if (\n (a.type === TextType.Text && b.type === TextType.Text) ||\n (a.type === TextType.Typography && b.type === TextType.Typography) ||\n (a.type === InlineType.Link && b.type === InlineType.Link) ||\n (a.type === InlineType.Code && b.type === InlineType.Code) ||\n (a.type === InlineType.SubScript && b.type === InlineType.SubScript) ||\n (a.type === InlineType.SuperScript && b.type === InlineType.SuperScript)\n ) {\n return compareInlineAndText(a, b)\n }\n\n if (\n (a.type === BlockType.BlockQuote && b.type === BlockType.BlockQuote) ||\n (a.type === BlockType.Heading1 && b.type === BlockType.Heading1) ||\n (a.type === BlockType.Heading2 && b.type === BlockType.Heading2) ||\n (a.type === BlockType.Heading3 && b.type === BlockType.Heading3) ||\n (a.type === BlockType.Heading4 && b.type === BlockType.Heading4) ||\n (a.type === BlockType.Heading5 && b.type === BlockType.Heading5) ||\n (a.type === BlockType.Heading6 && b.type === BlockType.Heading6) ||\n (a.type === BlockType.Paragraph && b.type === BlockType.Paragraph) ||\n (a.type === BlockType.OrderedList && b.type === BlockType.OrderedList) ||\n (a.type === BlockType.UnorderedList && b.type === BlockType.UnorderedList) ||\n (a.type === BlockType.ListItem && b.type === BlockType.ListItem) ||\n (a.type === BlockType.ListItemChild && b.type === BlockType.ListItemChild)\n ) {\n return (\n compareBlockTextAlignment(a.textAlign, b.textAlign) &&\n compareLists(compareRichTextDescendant, a.children, b.children)\n )\n }\n\n return true\n}\n\nexport function compareRichTextDAO(a: RichTextDAO, b: RichTextDAO) {\n return compareLists(compareRichTextDescendant, a, b)\n}\n\nexport function compareRichTextSelection(a: Selection, b: Selection) {\n return (\n a?.anchor.offset === b?.anchor.offset &&\n a?.focus.offset === b?.focus.offset &&\n compareLists(Object.is, a?.focus.path, b?.focus.path)\n )\n}\n"],"names":[],"mappings":";AAaA,sBAAyB,aAAsC,GAAS,GAAkB;AACxF,MAAI,OAAO,MAAM,eAAe,OAAO,MAAM,aAAa;AACjD,WAAA,OAAO,GAAG,GAAG,CAAC;AAAA,EACvB;AAEE,SAAA,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,CAAC,KAAK,OAAO,UAAU;AACxB,UAAA,QAAQ,EAAE,GAAG,KAAK;AACpB,QAAA,OAAO,SAAS,SAAS;AAAa,aAAA;AAEnC,WAAA,YAAY,OAAO,KAAK;AAAA,KAC9B,IAAe;AAEtB;AAEA,mCAAmC,GAAe,GAAe;AAC3D,MAAA,EAAE,OAAO,EAAE;AAAW,WAAA;AAC1B,MAAI,EAAE,MAAM,WAAW,EAAE,MAAM;AAAe,WAAA;AAE9C,SAAO,EAAE,MAAM,OAAO,CAAC,KAAK,OAAO,UAAU;;AAC3C,QAAI,OAAO;AAAc,aAAA;AACzB,UAAM,QAAQ,EAAE,MAAM,GAAG,KAAK;AAE9B,QAAI,SAAS;AAAa,aAAA;AACtB,QAAA,MAAM,aAAa,gCAAO;AAAiB,aAAA;AAC/C,QAAI,aAAM,MAAM,UAAZ,mBAAmB,WAAU,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AAS,UAAU,iBAC3D,EAAE,SAAS,UAAU,YAAY,EAAE,SAAS,UAAU,YACtD,EAAE,SAAS,UAAU,iBAAiB,EAAE,SAAS,UAAU,eAC5D;AAEE,WAAA,0BAA0B,EAAE,WAAW,EAAE,SAAS,KAClD,aAAa,2BAA2B,EAAE,UAAU,EAAE,QAAQ;AAAA,EAElE;AAEO,SAAA;AACT;AAEO,4BAA4B,GAAgB,GAAgB;AAC1D,SAAA,aAAa,2BAA2B,GAAG,CAAC;AACrD;AAEO,kCAAkC,GAAc,GAAc;AAEjE,SAAA,wBAAG,OAAO,YAAW,wBAAG,OAAO,WAC/B,wBAAG,MAAM,YAAW,wBAAG,MAAM,WAC7B,aAAa,OAAO,IAAI,uBAAG,MAAM,MAAM,uBAAG,MAAM,IAAI;AAExD;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListPlugin.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAoC,MAAM,OAAO,CAAA;AAGhE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAKxE,eAAO,MAAM,IAAI;;;;;;CAMhB,CAAA;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAwEzD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,kEAmFtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,IAAI,CAAA;AACzC,eAAO,MAAM,uBAAuB,IAAI,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dedent.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoB,MAAM,OAAO,CAAA;AAoChD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,QAapC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indent.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/indent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,IAAI,EAAc,MAAM,OAAO,CAAA;AAMtD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,QA2BpD;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,QAapC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toggleList.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAMtD,aAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,SAAS,CAAC,aAAa,GAAG,OAAO,SAAS,CAAC,WAAW,CAAA;CACpE,CAAA;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,iBAAqD,QAiB/D"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapList.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,IAAI,EAAQ,MAAM,OAAO,CAAA;AAOtD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,QA4B5D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,QAaxC"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAG5E,eAAO,MAAM,WAAW;iCACO,MAAM,eAAe,UAAU,WAAW,CAAC,GAAG,IAAI;qCAO9C,MAAM,eAAe,UAAU,eAAe,CAAC,GAAG,IAAI;CAQxF,CAAA"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,OAAO,CAAA;AAC3C,OAAO,EAEL,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACrB,MAAM,+BAA+B,CAAA;AAEtC,eAAO,MAAM,YAAY;sCACW,IAAI;iBASzB,IAAI;uBAGE,IAAI;sBAGL,IAAI;iBAGT,IAAI;qBAMA,IAAI;0BAGC,IAAI;;;;;;;;;;;;sBAYT,SAAS,GAA6B,KAAK;sBAG1C,KAAK;2BAMA,KAAK;CAM7B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filterForSubtreeRoots.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAG5C,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAOnF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSelectedListItems.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAQ,MAAM,OAAO,CAAA;AAKpC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAezE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAerE"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,eAAO,MAAM,aAAa;2BACD,QAAQ;CAKhC,CAAA"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrapList.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAGtD,aAAK,eAAe,GAAG;IACrB,IAAI,EAAE,OAAO,SAAS,CAAC,aAAa,GAAG,OAAO,SAAS,CAAC,WAAW,CAAA;CACpE,CAAA;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,eAAmD,QAoC7D"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/dedent.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dedent.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/dedent.test.tsx"],"names":[],"mappings":"AAAA,eAAe"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/indent.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indent.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/indent.test.tsx"],"names":[],"mappings":"AAAA,eAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalization.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/normalization.test.tsx"],"names":[],"mappings":"AAAA,eAAe"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/slate-test-helper.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { BaseEditor, Editor as SlateEditor } from 'slate';
|
|
3
|
-
export declare const jsx: <S extends "cursor" | "selection" | "text" | "anchor" | "focus" | "editor" | "fragment" | "element">(tagName: S, attributes?: Object | undefined, ...children: any[]) => ReturnType<({
|
|
4
|
-
anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
|
|
5
|
-
cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
|
|
6
|
-
editor: (tagName: string, attributes: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}, children: any[]) => BaseEditor;
|
|
9
|
-
element: typeof import("slate-hyperscript/dist/creators").createElement;
|
|
10
|
-
focus: typeof import("slate-hyperscript/dist/creators").createFocus;
|
|
11
|
-
fragment: typeof import("slate-hyperscript/dist/creators").createFragment;
|
|
12
|
-
selection: typeof import("slate-hyperscript/dist/creators").createSelection;
|
|
13
|
-
text: typeof import("slate-hyperscript").createText;
|
|
14
|
-
} | {
|
|
15
|
-
anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
|
|
16
|
-
cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
|
|
17
|
-
editor: (tagName: string, attributes: {
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
}, children: any[]) => BaseEditor;
|
|
20
|
-
element: typeof import("slate-hyperscript/dist/creators").createElement;
|
|
21
|
-
focus: typeof import("slate-hyperscript/dist/creators").createFocus;
|
|
22
|
-
fragment: typeof import("slate-hyperscript/dist/creators").createFragment;
|
|
23
|
-
selection: typeof import("slate-hyperscript/dist/creators").createSelection;
|
|
24
|
-
text: typeof import("slate-hyperscript").createText;
|
|
25
|
-
})[S]>;
|
|
26
|
-
/**
|
|
27
|
-
* Note: If you tried to add the react plugin to the vitest config
|
|
28
|
-
* 1. You have to use {jsxRuntime: "classic"} since we are using pragmas in these tests
|
|
29
|
-
* 2. You will get a circular dependency error in slate because the plugin uses these
|
|
30
|
-
* two plugins to get better stack traces in react.
|
|
31
|
-
* - https://babeljs.io/docs/babel-plugin-transform-react-jsx-self/
|
|
32
|
-
* - https://babeljs.io/docs/babel-plugin-transform-react-jsx-source/
|
|
33
|
-
* Either find a way to disable them or clean the properties in `TestEditor` with
|
|
34
|
-
*
|
|
35
|
-
* ```
|
|
36
|
-
* function clean(child: any) {
|
|
37
|
-
* const { __self, __source, ...nextChild } = child
|
|
38
|
-
* if ('children' in nextChild) {
|
|
39
|
-
* nextChild.children = nextChild.children.map((child: any) => clean(child))
|
|
40
|
-
* }
|
|
41
|
-
* return nextChild
|
|
42
|
-
* }
|
|
43
|
-
* editor.children = editor.children.map(child => clean(child))
|
|
44
|
-
* ```
|
|
45
|
-
* More clues: https://github.com/preactjs/preact/issues/1058#issuecomment-379007804
|
|
46
|
-
*/
|
|
47
|
-
export declare const TestEditor: (input: JSX.Element) => SlateEditor;
|
|
48
|
-
//# sourceMappingURL=slate-test-helper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slate-test-helper.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/slate-test-helper.tsx"],"names":[],"mappings":"AAAA,eAAe;AAEf,OAAO,EAAE,UAAU,EAAgB,MAAM,IAAI,WAAW,EAAE,MAAM,OAAO,CAAA;AAsBvE,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;MAwBd,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,UAAU,UAAW,WAAW,KAAG,WAE/C,CAAA"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/toggleList.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toggleList.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/toggleList.test.tsx"],"names":[],"mappings":"AAAA,eAAe"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare const Editor = "editor";
|
|
2
|
-
export declare const Fragment = "fragment";
|
|
3
|
-
export declare const Anchor = "anchor";
|
|
4
|
-
export declare const Focus = "focus";
|
|
5
|
-
export declare const Cursor = "cursor";
|
|
6
|
-
export declare const Selection = "selection";
|
|
7
|
-
export declare const Text = "text";
|
|
8
|
-
export declare const Typography = "typography";
|
|
9
|
-
export declare const Paragraph = "paragraph";
|
|
10
|
-
export declare const Heading1 = "heading1";
|
|
11
|
-
export declare const Heading2 = "heading2";
|
|
12
|
-
export declare const Heading3 = "heading3";
|
|
13
|
-
export declare const Heading4 = "heading4";
|
|
14
|
-
export declare const Heading5 = "heading5";
|
|
15
|
-
export declare const Heading6 = "heading6";
|
|
16
|
-
export declare const BlockQuote = "blockquote";
|
|
17
|
-
export declare const Ordered = "ordered";
|
|
18
|
-
export declare const Unordered = "unordered";
|
|
19
|
-
export declare const ListItem = "listitem";
|
|
20
|
-
export declare const ListItemChild = "listitemchild";
|
|
21
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,eAAO,MAAM,KAAK,UAAU,CAAA;AAC5B,eAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B,eAAO,MAAM,UAAU,eAAe,CAAA;AAEtC,eAAO,MAAM,SAAS,cAAc,CAAA;AACpC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,UAAU,eAAe,CAAA;AACtC,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,SAAS,cAAc,CAAA;AACpC,eAAO,MAAM,QAAQ,aAAa,CAAA;AAClC,eAAO,MAAM,aAAa,kBAAkB,CAAA"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/unwrapList.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unwrapList.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/unwrapList.test.tsx"],"names":[],"mappings":"AAAA,eAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filterForSubtreeRoots.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/utils/filterForSubtreeRoots.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSelectedListItems.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/utils/getSelectedListItems.test.tsx"],"names":[],"mappings":"AAAA,eAAe"}
|
package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/wrapList.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrapList.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/components/builtin/Text/EditableText/ListPlugin/test/wrapList.test.tsx"],"names":[],"mappings":"AAAA,eAAe"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { RenderLeafProps } from 'slate-react';
|
|
3
|
-
import { Typography } from '../../../../../api';
|
|
4
|
-
import { TypographyText } from '../../../../../controls';
|
|
5
|
-
import { DeviceOverride } from '../../../../../prop-controllers';
|
|
6
|
-
import { ColorValue } from '../../../../utils/types';
|
|
7
|
-
export declare type TypographyValue = Typography['style'][number]['value'];
|
|
8
|
-
declare type EnhancedColor = {
|
|
9
|
-
color?: ColorValue;
|
|
10
|
-
};
|
|
11
|
-
declare type EnhancedTypographyValue = Omit<TypographyValue, keyof EnhancedColor> & EnhancedColor;
|
|
12
|
-
export declare type EnhancedTypography = Array<DeviceOverride<EnhancedTypographyValue>>;
|
|
13
|
-
export declare function isDeviceOverride(value: {
|
|
14
|
-
deviceId: string;
|
|
15
|
-
value: TypographyValue;
|
|
16
|
-
}): value is DeviceOverride<TypographyValue>;
|
|
17
|
-
/**
|
|
18
|
-
* `enhanced` here just means typography ids have been replaced with the related entity.
|
|
19
|
-
*/
|
|
20
|
-
export default function useEnhancedTypography(value: Typography): EnhancedTypography;
|
|
21
|
-
export declare function useTypographyClassName(value: EnhancedTypography): string;
|
|
22
|
-
export interface TypographyRenderLeafProps extends RenderLeafProps {
|
|
23
|
-
leaf: TypographyText;
|
|
24
|
-
}
|
|
25
|
-
export declare function TypographyLeaf({ leaf, children, attributes }: TypographyRenderLeafProps): JSX.Element;
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=typography.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../../../../../src/components/builtin/Text/components/Leaf/typography.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAU,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAmB,MAAM,iCAAiC,CAAA;AAQjF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,oBAAY,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAElE,aAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AAED,aAAK,uBAAuB,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAA;AAEzF,oBAAY,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC,CAAA;AAE/E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,eAAe,CAAA;CACvB,GAAG,KAAK,IAAI,cAAc,CAAC,eAAe,CAAC,CAE3C;AA8BD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,kBAAkB,CA0CnF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAkCxE;AAED,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,IAAI,EAAE,cAAc,CAAA;CACrB;AAED,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,yBAAyB,eAQvF"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Selection } from 'slate';
|
|
2
|
-
import { RichTextDAO } from './types';
|
|
3
|
-
export declare function compareRichTextDAO(a: RichTextDAO, b: RichTextDAO): boolean;
|
|
4
|
-
export declare function compareRichTextSelection(a: Selection, b: Selection): boolean;
|
|
5
|
-
//# sourceMappingURL=compare.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../../../src/controls/rich-text/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,OAAO,CAAA;AAG7C,OAAO,EAML,WAAW,EAEZ,MAAM,SAAS,CAAA;AAmKhB,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,WAEhE;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,WAMlE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compare.test.d.ts","sourceRoot":"","sources":["../../../../../src/controls/rich-text/compare.test.ts"],"names":[],"mappings":""}
|