@makeswift/runtime 0.9.1 → 0.9.2
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/Box.cjs.js +2 -3
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +2 -3
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +2 -3
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +2 -3
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +2 -3
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +2 -3
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +1 -2
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +1 -2
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +2 -3
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +2 -3
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +0 -2
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +0 -2
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +1 -2
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +1 -2
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +1 -2
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +1 -2
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +2 -3
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +3 -4
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +1 -2
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +1 -2
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +1 -2
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +2 -3
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +2 -0
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +3 -1
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +2 -0
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +3 -1
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +1 -2
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +1 -2
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +2 -3
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +2 -3
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +2 -3
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +2 -3
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +0 -2
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +0 -2
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +0 -3
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +0 -3
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +1 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +1 -2
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +0 -3
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +1 -4
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +6 -5
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +2 -4
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +47 -14
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +171 -248
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs11.js +375 -0
- package/dist/index.cjs11.js.map +1 -0
- package/dist/index.cjs2.js +1 -3
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs6.js +700 -22
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +37 -13
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +17 -42
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +12 -229
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +47 -14
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +172 -249
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es11.js +368 -0
- package/dist/index.es11.js.map +1 -0
- package/dist/index.es2.js +2 -4
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es6.js +695 -22
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +33 -14
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +17 -40
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +11 -224
- package/dist/index.es9.js.map +1 -1
- package/dist/main.cjs.js +0 -3
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +0 -3
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +1 -2
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +1 -2
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +0 -3
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +0 -3
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +927 -1573
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +923 -1559
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +1 -2
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +1 -2
- package/dist/react.es.js.map +1 -1
- package/dist/select.cjs.js +21 -0
- package/dist/select.cjs.js.map +1 -0
- package/dist/select.es.js +16 -0
- package/dist/select.es.js.map +1 -0
- package/dist/slate.cjs.js +172 -55
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +172 -55
- package/dist/slate.es.js.map +1 -1
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/page/Page.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +3 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/icon-radio-group.d.ts +29 -0
- package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -0
- package/dist/types/src/controls/index.d.ts +1 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +7 -3
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +1 -2
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts +16 -7
- package/dist/types/src/controls/style-v2.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/document.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +4 -2
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +3 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/icon-radio-group.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/icon-radio-group.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +10 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +10 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts +10 -1
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +1 -0
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/ColorPlugin/index.d.ts +10 -0
- package/dist/types/src/slate/ColorPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +1 -0
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +1 -1
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/index.d.ts +1 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +21 -0
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/responsive.d.ts +16 -0
- package/dist/types/src/slate/utils/responsive.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/react.cjs.js
CHANGED
|
@@ -13,11 +13,10 @@ require("@emotion/css");
|
|
|
13
13
|
require("@emotion/serialize");
|
|
14
14
|
require("@emotion/utils");
|
|
15
15
|
require("slate");
|
|
16
|
-
require("is-hotkey");
|
|
17
|
-
require("slate-react");
|
|
18
16
|
require("react/jsx-runtime");
|
|
19
17
|
require("./text-input.cjs.js");
|
|
20
18
|
require("./combobox.cjs.js");
|
|
19
|
+
require("./select.cjs.js");
|
|
21
20
|
require("use-sync-external-store/shim");
|
|
22
21
|
require("./types.cjs.js");
|
|
23
22
|
require("./deepEqual.cjs.js");
|
package/dist/react.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/react.es.js
CHANGED
|
@@ -11,11 +11,10 @@ import "@emotion/css";
|
|
|
11
11
|
import "@emotion/serialize";
|
|
12
12
|
import "@emotion/utils";
|
|
13
13
|
import "slate";
|
|
14
|
-
import "is-hotkey";
|
|
15
|
-
import "slate-react";
|
|
16
14
|
import "react/jsx-runtime";
|
|
17
15
|
import "./text-input.es.js";
|
|
18
16
|
import "./combobox.es.js";
|
|
17
|
+
import "./select.es.js";
|
|
19
18
|
import "use-sync-external-store/shim";
|
|
20
19
|
import "./types.es.js";
|
|
21
20
|
import "./deepEqual.es.js";
|
package/dist/react.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const unstable_IconRadioGroupIcon = {
|
|
3
|
+
TextAlignCenter: "TextAlignCenter",
|
|
4
|
+
TextAlignJustify: "TextAlignJustify",
|
|
5
|
+
TextAlignLeft: "TextAlignLeft",
|
|
6
|
+
TextAlignRight: "TextAlignRight"
|
|
7
|
+
};
|
|
8
|
+
const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
|
|
9
|
+
function unstable_IconRadioGroup(config) {
|
|
10
|
+
return { type: IconRadioGroupControlType, config };
|
|
11
|
+
}
|
|
12
|
+
const SelectControlType = "makeswift::controls::select";
|
|
13
|
+
function Select(config) {
|
|
14
|
+
return { type: SelectControlType, config };
|
|
15
|
+
}
|
|
16
|
+
exports.IconRadioGroupControlType = IconRadioGroupControlType;
|
|
17
|
+
exports.Select = Select;
|
|
18
|
+
exports.SelectControlType = SelectControlType;
|
|
19
|
+
exports.unstable_IconRadioGroup = unstable_IconRadioGroup;
|
|
20
|
+
exports.unstable_IconRadioGroupIcon = unstable_IconRadioGroupIcon;
|
|
21
|
+
//# sourceMappingURL=select.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.cjs.js","sources":["../src/controls/icon-radio-group.ts","../src/controls/select.ts"],"sourcesContent":["export const unstable_IconRadioGroupIcon = {\n TextAlignCenter: 'TextAlignCenter',\n TextAlignJustify: 'TextAlignJustify',\n TextAlignLeft: 'TextAlignLeft',\n TextAlignRight: 'TextAlignRight',\n} as const\n\nexport type IconRadioGroupIcon =\n (typeof unstable_IconRadioGroupIcon)[keyof typeof unstable_IconRadioGroupIcon]\n\nexport const IconRadioGroupControlType = 'makeswift::controls::icon-radio-group'\n\ntype IconRadioGroupOption<T extends string> = {\n value: T\n icon: IconRadioGroupIcon\n label: string\n}\n\ntype IconRadioGroupControlConfig<T extends string = string> = {\n label?: string\n defaultValue?: T\n options: IconRadioGroupOption<T>[]\n}\n\nexport type IconRadioGroupControlDefinition<\n C extends IconRadioGroupControlConfig = IconRadioGroupControlConfig,\n> = {\n type: typeof IconRadioGroupControlType\n config: C\n}\n\nexport type IconRadioGroupControlDefinitionOption<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = T['config'] extends IconRadioGroupControlConfig<infer U> ? U : never\n\nexport type IconRadioGroupControlData<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = IconRadioGroupControlDefinitionOption<T>\n\nexport function unstable_IconRadioGroup<T extends string, C extends IconRadioGroupControlConfig<T>>(\n config: C & { options: IconRadioGroupOption<T>[] },\n): IconRadioGroupControlDefinition<C> {\n return { type: IconRadioGroupControlType, config }\n}\n","export const SelectControlType = 'makeswift::controls::select'\n\ntype SelectControlOption<T extends string> = { value: T; label: string }\n\ntype SelectControlConfig<T extends string = string> = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n options: SelectControlOption<T>[]\n defaultValue?: T\n}\n\nexport type SelectControlDefinition<C extends SelectControlConfig = SelectControlConfig> = {\n type: typeof SelectControlType\n config: C\n}\n\nexport type SelectControlDefinitionOption<T extends SelectControlDefinition> =\n T['config'] extends SelectControlConfig<infer U> ? U : never\n\nexport type SelectControlData<T extends SelectControlDefinition = SelectControlDefinition> =\n SelectControlDefinitionOption<T>\n\nexport function Select<T extends string, C extends SelectControlConfig<T>>(\n config: C & { options: SelectControlOption<T>[] },\n): SelectControlDefinition<C> {\n return { type: SelectControlType, config }\n}\n"],"names":[],"mappings":";AAAO,MAAM,8BAA8B;AAAA,EACzC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB;AAClB;AAKO,MAAM,4BAA4B;AA6BlC,iCACL,QACoC;AAC7B,SAAA,EAAE,MAAM,2BAA2B;AAC5C;AC3CO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const unstable_IconRadioGroupIcon = {
|
|
2
|
+
TextAlignCenter: "TextAlignCenter",
|
|
3
|
+
TextAlignJustify: "TextAlignJustify",
|
|
4
|
+
TextAlignLeft: "TextAlignLeft",
|
|
5
|
+
TextAlignRight: "TextAlignRight"
|
|
6
|
+
};
|
|
7
|
+
const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
|
|
8
|
+
function unstable_IconRadioGroup(config) {
|
|
9
|
+
return { type: IconRadioGroupControlType, config };
|
|
10
|
+
}
|
|
11
|
+
const SelectControlType = "makeswift::controls::select";
|
|
12
|
+
function Select(config) {
|
|
13
|
+
return { type: SelectControlType, config };
|
|
14
|
+
}
|
|
15
|
+
export { IconRadioGroupControlType as I, SelectControlType as S, unstable_IconRadioGroup as a, Select as b, unstable_IconRadioGroupIcon as u };
|
|
16
|
+
//# sourceMappingURL=select.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.es.js","sources":["../src/controls/icon-radio-group.ts","../src/controls/select.ts"],"sourcesContent":["export const unstable_IconRadioGroupIcon = {\n TextAlignCenter: 'TextAlignCenter',\n TextAlignJustify: 'TextAlignJustify',\n TextAlignLeft: 'TextAlignLeft',\n TextAlignRight: 'TextAlignRight',\n} as const\n\nexport type IconRadioGroupIcon =\n (typeof unstable_IconRadioGroupIcon)[keyof typeof unstable_IconRadioGroupIcon]\n\nexport const IconRadioGroupControlType = 'makeswift::controls::icon-radio-group'\n\ntype IconRadioGroupOption<T extends string> = {\n value: T\n icon: IconRadioGroupIcon\n label: string\n}\n\ntype IconRadioGroupControlConfig<T extends string = string> = {\n label?: string\n defaultValue?: T\n options: IconRadioGroupOption<T>[]\n}\n\nexport type IconRadioGroupControlDefinition<\n C extends IconRadioGroupControlConfig = IconRadioGroupControlConfig,\n> = {\n type: typeof IconRadioGroupControlType\n config: C\n}\n\nexport type IconRadioGroupControlDefinitionOption<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = T['config'] extends IconRadioGroupControlConfig<infer U> ? U : never\n\nexport type IconRadioGroupControlData<\n T extends IconRadioGroupControlDefinition = IconRadioGroupControlDefinition,\n> = IconRadioGroupControlDefinitionOption<T>\n\nexport function unstable_IconRadioGroup<T extends string, C extends IconRadioGroupControlConfig<T>>(\n config: C & { options: IconRadioGroupOption<T>[] },\n): IconRadioGroupControlDefinition<C> {\n return { type: IconRadioGroupControlType, config }\n}\n","export const SelectControlType = 'makeswift::controls::select'\n\ntype SelectControlOption<T extends string> = { value: T; label: string }\n\ntype SelectControlConfig<T extends string = string> = {\n label?: string\n labelOrientation?: 'horizontal' | 'vertical'\n options: SelectControlOption<T>[]\n defaultValue?: T\n}\n\nexport type SelectControlDefinition<C extends SelectControlConfig = SelectControlConfig> = {\n type: typeof SelectControlType\n config: C\n}\n\nexport type SelectControlDefinitionOption<T extends SelectControlDefinition> =\n T['config'] extends SelectControlConfig<infer U> ? U : never\n\nexport type SelectControlData<T extends SelectControlDefinition = SelectControlDefinition> =\n SelectControlDefinitionOption<T>\n\nexport function Select<T extends string, C extends SelectControlConfig<T>>(\n config: C & { options: SelectControlOption<T>[] },\n): SelectControlDefinition<C> {\n return { type: SelectControlType, config }\n}\n"],"names":[],"mappings":"AAAO,MAAM,8BAA8B;AAAA,EACzC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB;AAClB;AAKO,MAAM,4BAA4B;AA6BlC,iCACL,QACoC;AAC7B,SAAA,EAAE,MAAM,2BAA2B;AAC5C;AC3CO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;;"}
|
package/dist/slate.cjs.js
CHANGED
|
@@ -20,70 +20,136 @@ var __spreadValues = (a, b) => {
|
|
|
20
20
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
21
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
22
22
|
var index = require("./index.cjs5.js");
|
|
23
|
-
var reactPage = require("./react-page.cjs.js");
|
|
24
23
|
var index$1 = require("./index.cjs6.js");
|
|
25
24
|
var index$2 = require("./index.cjs7.js");
|
|
25
|
+
var index$3 = require("./index.cjs8.js");
|
|
26
|
+
var reactPage = require("./react-page.cjs.js");
|
|
27
|
+
var select = require("./select.cjs.js");
|
|
26
28
|
var slate = require("slate");
|
|
29
|
+
var deepEqual = require("./deepEqual.cjs.js");
|
|
27
30
|
require("./state/breakpoints.cjs.js");
|
|
31
|
+
require("./actions.cjs.js");
|
|
28
32
|
require("is-hotkey");
|
|
33
|
+
require("@emotion/css");
|
|
34
|
+
require("react/jsx-runtime");
|
|
29
35
|
require("slate-react");
|
|
30
|
-
var deepEqual = require("./deepEqual.cjs.js");
|
|
31
36
|
require("redux");
|
|
32
37
|
require("redux-thunk");
|
|
33
|
-
require("./actions.cjs.js");
|
|
34
38
|
require("react");
|
|
35
|
-
require("@emotion/css");
|
|
36
39
|
require("@emotion/serialize");
|
|
37
40
|
require("@emotion/utils");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
function setResponsiveValue(editor, key, value, options) {
|
|
42
|
+
slate.Editor.withoutNormalizing(editor, () => {
|
|
43
|
+
const at = index$1.getSelection(editor);
|
|
44
|
+
if (!at)
|
|
45
|
+
return;
|
|
46
|
+
const atRef = slate.Editor.rangeRef(editor, at);
|
|
47
|
+
if (atRef.current) {
|
|
48
|
+
slate.Transforms.setNodes(editor, {
|
|
49
|
+
slice: true
|
|
50
|
+
}, {
|
|
51
|
+
at: atRef.current,
|
|
52
|
+
match: options.match,
|
|
53
|
+
split: options.split
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (atRef.current) {
|
|
57
|
+
const nodesToUpdate = Array.from(slate.Editor.nodes(editor, {
|
|
58
|
+
at: atRef.current,
|
|
59
|
+
match: (node, path) => options.match(node, path) && node.slice === true
|
|
60
|
+
}));
|
|
61
|
+
for (const [, path] of nodesToUpdate) {
|
|
62
|
+
slate.Transforms.setNodes(editor, {
|
|
63
|
+
[key]: value
|
|
64
|
+
}, { at: path });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
atRef.unref();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function getResponsiveValue(editor, key, options) {
|
|
71
|
+
const matchingValues = Array.from(slate.Editor.nodes(editor, {
|
|
72
|
+
at: index$1.getSelection(editor),
|
|
73
|
+
match: options == null ? void 0 : options.match
|
|
74
|
+
})).filter(([node, path]) => options.match(node, path)).map(([node]) => node[key]);
|
|
75
|
+
const value = matchingValues.length === 0 ? void 0 : matchingValues.reduce((a, b) => deepEqual.deepEqual(a, b) ? b : void 0);
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
function normalizeResponsiveValue(editor, key, options) {
|
|
79
|
+
return (entry) => {
|
|
80
|
+
const [node, path] = entry;
|
|
81
|
+
if (!options.match(node, path)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
const responsiveValue = node == null ? void 0 : node[key];
|
|
85
|
+
if (Array.isArray(responsiveValue) && responsiveValue.length === 0) {
|
|
86
|
+
slate.Transforms.unsetNodes(editor, key, { at: path });
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if ((node == null ? void 0 : node.slice) != null) {
|
|
90
|
+
slate.Transforms.unsetNodes(editor, "slice", { at: path });
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const TEXT_ALIGN_KEY = "textAlign";
|
|
60
97
|
function TextAlignPlugin() {
|
|
61
98
|
return reactPage.createRichTextV2Plugin({
|
|
62
99
|
control: {
|
|
63
|
-
definition:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
100
|
+
definition: reactPage.unstable_StyleV2({
|
|
101
|
+
type: select.unstable_IconRadioGroup({
|
|
102
|
+
label: "Alignment",
|
|
103
|
+
options: [{
|
|
104
|
+
icon: select.unstable_IconRadioGroupIcon.TextAlignLeft,
|
|
105
|
+
label: "Left Align",
|
|
106
|
+
value: "left"
|
|
107
|
+
}, {
|
|
108
|
+
icon: select.unstable_IconRadioGroupIcon.TextAlignCenter,
|
|
109
|
+
label: "Center Align",
|
|
110
|
+
value: "center"
|
|
111
|
+
}, {
|
|
112
|
+
icon: select.unstable_IconRadioGroupIcon.TextAlignRight,
|
|
113
|
+
label: "Right Align",
|
|
114
|
+
value: "right"
|
|
115
|
+
}, {
|
|
116
|
+
icon: select.unstable_IconRadioGroupIcon.TextAlignJustify,
|
|
117
|
+
label: "Justify",
|
|
118
|
+
value: "justify"
|
|
119
|
+
}],
|
|
120
|
+
defaultValue: "left"
|
|
121
|
+
}),
|
|
122
|
+
getStyle(textAlign) {
|
|
123
|
+
return {
|
|
124
|
+
textAlign
|
|
125
|
+
};
|
|
74
126
|
}
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
127
|
+
}),
|
|
128
|
+
onChange: (editor, value) => setResponsiveValue(editor, TEXT_ALIGN_KEY, value, {
|
|
129
|
+
match: index$1.ElementUtils.isRootBlock,
|
|
130
|
+
split: false
|
|
131
|
+
}),
|
|
132
|
+
getValue: (editor) => getResponsiveValue(editor, TEXT_ALIGN_KEY, {
|
|
133
|
+
match: index$1.ElementUtils.isRootBlock
|
|
134
|
+
}),
|
|
83
135
|
getElementValue: (element) => {
|
|
84
|
-
return
|
|
136
|
+
return index$1.ElementUtils.isRootBlock(element) ? element.textAlign : void 0;
|
|
85
137
|
}
|
|
86
138
|
},
|
|
139
|
+
withPlugin: (editor) => {
|
|
140
|
+
const {
|
|
141
|
+
normalizeNode
|
|
142
|
+
} = editor;
|
|
143
|
+
editor.normalizeNode = (entry) => {
|
|
144
|
+
if (normalizeResponsiveValue(editor, TEXT_ALIGN_KEY, {
|
|
145
|
+
match: index$1.ElementUtils.isRootBlock
|
|
146
|
+
})(entry)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
normalizeNode(entry);
|
|
150
|
+
};
|
|
151
|
+
return editor;
|
|
152
|
+
},
|
|
87
153
|
renderElement: (renderElement, className) => (props) => {
|
|
88
154
|
return renderElement(__spreadProps(__spreadValues({}, props), {
|
|
89
155
|
element: __spreadProps(__spreadValues({}, props.element), {
|
|
@@ -93,20 +159,71 @@ function TextAlignPlugin() {
|
|
|
93
159
|
}
|
|
94
160
|
});
|
|
95
161
|
}
|
|
162
|
+
const COLOR_KEY = "color";
|
|
163
|
+
function ColorPlugin() {
|
|
164
|
+
return reactPage.createRichTextV2Plugin({
|
|
165
|
+
control: {
|
|
166
|
+
definition: reactPage.unstable_StyleV2({
|
|
167
|
+
type: reactPage.Color({
|
|
168
|
+
label: "Color"
|
|
169
|
+
}),
|
|
170
|
+
getStyle(color) {
|
|
171
|
+
return {
|
|
172
|
+
color
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}),
|
|
176
|
+
onChange: (editor, value) => {
|
|
177
|
+
setResponsiveValue(editor, COLOR_KEY, value, {
|
|
178
|
+
match: slate.Text.isText,
|
|
179
|
+
split: true
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
getValue: (editor) => getResponsiveValue(editor, COLOR_KEY, {
|
|
183
|
+
match: slate.Text.isText
|
|
184
|
+
}),
|
|
185
|
+
getLeafValue: (text) => {
|
|
186
|
+
return slate.Text.isText(text) ? text == null ? void 0 : text.color : void 0;
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
withPlugin: (editor) => {
|
|
190
|
+
const {
|
|
191
|
+
normalizeNode
|
|
192
|
+
} = editor;
|
|
193
|
+
editor.normalizeNode = (entry) => {
|
|
194
|
+
if (normalizeResponsiveValue(editor, COLOR_KEY, {
|
|
195
|
+
match: slate.Text.isText
|
|
196
|
+
})(entry)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
normalizeNode(entry);
|
|
200
|
+
};
|
|
201
|
+
return editor;
|
|
202
|
+
},
|
|
203
|
+
renderLeaf: (renderLeaf, className) => (props) => {
|
|
204
|
+
return renderLeaf(__spreadProps(__spreadValues({}, props), {
|
|
205
|
+
leaf: __spreadProps(__spreadValues({}, props.leaf), {
|
|
206
|
+
className
|
|
207
|
+
})
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
96
212
|
exports.TypographyActions = index.TypographyActions;
|
|
97
213
|
exports.withTypography = index.withTypography;
|
|
98
|
-
exports.BlockActions =
|
|
99
|
-
exports.BlockPlugin =
|
|
214
|
+
exports.BlockActions = index$1.BlockActions;
|
|
215
|
+
exports.BlockPlugin = index$1.BlockPlugin;
|
|
216
|
+
exports.ListActions = index$1.ListActions;
|
|
217
|
+
exports.onKeyDown = index$1.onKeyDown;
|
|
218
|
+
exports.withBlock = index$1.withBlock;
|
|
219
|
+
exports.InlineModePlugin = index$2.InlineModePlugin;
|
|
220
|
+
exports.withInlineMode = index$2.withInlineMode;
|
|
221
|
+
exports.withBuilder = index$3.withBuilder;
|
|
100
222
|
exports.BlockTextAlignment = reactPage.BlockTextAlignment;
|
|
101
223
|
exports.BlockType = reactPage.BlockType;
|
|
102
224
|
exports.InlineType = reactPage.InlineType;
|
|
103
|
-
exports.ListActions = reactPage.ListActions;
|
|
104
225
|
exports.RootBlockType = reactPage.RootBlockType;
|
|
105
|
-
exports.
|
|
106
|
-
exports.
|
|
107
|
-
exports.InlineModePlugin = index$1.InlineModePlugin;
|
|
108
|
-
exports.withInlineMode = index$1.withInlineMode;
|
|
109
|
-
exports.withBuilder = index$2.withBuilder;
|
|
226
|
+
exports.COLOR_KEY = COLOR_KEY;
|
|
227
|
+
exports.ColorPlugin = ColorPlugin;
|
|
110
228
|
exports.TextAlignPlugin = TextAlignPlugin;
|
|
111
|
-
exports.definitionWithObject = definitionWithObject;
|
|
112
229
|
//# sourceMappingURL=slate.cjs.js.map
|
package/dist/slate.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slate.cjs.js","sources":["../src/slate/TextAlignPlugin/index.tsx"],"sourcesContent":["import { Element, Transforms } from 'slate'\nimport {\n ControlDefinitionData,\n Select,\n createRichTextV2Plugin,\n unstable_StyleV2,\n} from '../../controls'\nimport { getBlocksInSelection } from '../selectors'\nimport deepEqual from '../../utils/deepEqual'\nimport { ElementUtils } from '../utils/element'\n\nconst textAlignDefinition = Select({\n options: [\n {\n label: 'Left',\n value: 'left',\n },\n {\n label: 'Center',\n value: 'center',\n },\n {\n label: 'Right',\n value: 'right',\n },\n ],\n defaultValue: 'left',\n})\n\nexport const definitionWithObject = unstable_StyleV2({\n type: textAlignDefinition,\n getStyle(textAlign: ControlDefinitionData<typeof textAlignDefinition>) {\n return { textAlign }\n },\n})\n\nexport function TextAlignPlugin() {\n return createRichTextV2Plugin({\n control: {\n definition: definitionWithObject,\n onChange: (editor, value) => {\n const rootElements = getBlocksInSelection(editor)\n\n for (const [node, path] of rootElements) {\n if (ElementUtils.isBlock(node)) {\n Transforms.setNodes(\n editor,\n {\n ['textAlign']: value,\n },\n { at: path },\n )\n }\n }\n },\n getValue: editor => {\n const blocks = getBlocksInSelection(editor).map(([block]) => {\n return block.textAlign\n })\n\n const value =\n blocks.length === 0\n ? undefined\n : blocks.reduce((a, b) => (deepEqual(a, b) ? b : undefined))\n\n return value\n },\n getElementValue: (element: Element) => {\n return ElementUtils.isRootBlock(element) ? element.textAlign : undefined\n },\n },\n renderElement: (renderElement, className) => props => {\n return renderElement({\n ...props,\n element: {\n ...props.element,\n className,\n },\n })\n },\n })\n}\n"],"names":["textAlignDefinition","Select","options","label","value","defaultValue","definitionWithObject","unstable_StyleV2","type","getStyle","textAlign","createRichTextV2Plugin","control","definition","onChange","editor","rootElements","getBlocksInSelection","node","path","ElementUtils","isBlock","Transforms","setNodes","at","getValue","blocks","map","block","length","undefined","reduce","a","b","deepEqual","getElementValue","element","isRootBlock","renderElement","className","props"],"mappings":";;;;;;;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CA,QAAQ1B,YAAYoB;AAAAA,MAChE;AAAA,IAhCyB;AAAA,IAkC5BQ,eAAe,CAACA,eAAeC,cAAcC,CAAS,UAAA;AACpD,aAAOF,cAAc,iCAChBE,QADgB;AAAA,QAEnBJ,SAAS,iCACJI,MAAMJ,UADF;AAAA,UAEPG;AAAAA,QAFO;AAAA,MAAA,EAFS;AAAA,IAOrB;AAAA,EAAA,CA1C0B;AA4C9B;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"slate.cjs.js","sources":["../src/slate/utils/responsive.ts","../src/slate/TextAlignPlugin/index.tsx","../src/slate/ColorPlugin/index.tsx"],"sourcesContent":["import { Editor, Transforms, NodeMatch, Descendant, NodeEntry } from 'slate'\nimport { getSelection } from '../selectors'\nimport deepEqual from '../../utils/deepEqual'\n\ntype SetResponsiveValueOptions<T extends Descendant> = {\n match: NodeMatch<T>\n split: boolean\n}\n\nexport function setResponsiveValue<T extends Descendant, K extends keyof T>(\n editor: Editor,\n key: K,\n value: T[K] | undefined,\n options: SetResponsiveValueOptions<T>,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = getSelection(editor)\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes<Descendant>(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: options.match,\n split: options.split,\n },\n )\n }\n\n if (atRef.current) {\n const nodesToUpdate = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: (node, path) => options.match(node, path) && node.slice === true,\n }),\n )\n\n for (const [, path] of nodesToUpdate) {\n Transforms.setNodes(\n editor,\n {\n [key]: value,\n },\n { at: path },\n )\n }\n }\n\n atRef.unref()\n })\n}\n\ntype GetResponsiveValueOptions<T extends Descendant> = {\n match: NodeMatch<T>\n}\n\nexport function getResponsiveValue<T extends Descendant, K extends keyof T>(\n editor: Editor,\n key: K,\n options: GetResponsiveValueOptions<T>,\n): T[K] | undefined {\n const matchingValues = Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: options?.match,\n }),\n )\n .filter(([node, path]) => options.match(node, path))\n .map(([node]) => node[key]) as (T[K] | undefined)[]\n\n const value =\n matchingValues.length === 0\n ? undefined\n : matchingValues.reduce((a, b) => (deepEqual(a, b) ? b : undefined))\n\n return value\n}\n\ntype NormalizeResponsiveValueOptions<T extends Descendant> = {\n match: NodeMatch<T>\n}\n\nexport function normalizeResponsiveValue<T extends Descendant, K extends keyof T & string>(\n editor: Editor,\n key: K,\n options: NormalizeResponsiveValueOptions<T>,\n) {\n return (entry: NodeEntry) => {\n const [node, path] = entry\n\n if (!options.match(node, path)) {\n return false\n }\n\n const responsiveValue = node?.[key]\n\n if (Array.isArray(responsiveValue) && responsiveValue.length === 0) {\n Transforms.unsetNodes(editor, key, { at: path })\n return true\n }\n\n if (node?.slice != null) {\n Transforms.unsetNodes(editor, 'slice', { at: path })\n return true\n }\n\n return false\n }\n}\n","import { Editor, Element } from 'slate'\nimport {\n createRichTextV2Plugin,\n unstable_IconRadioGroup,\n unstable_IconRadioGroupIcon,\n unstable_StyleV2,\n} from '../../controls'\nimport { ElementUtils } from '../utils/element'\nimport { TextAlignProperty } from 'csstype'\nimport {\n getResponsiveValue,\n normalizeResponsiveValue,\n setResponsiveValue,\n} from '../utils/responsive'\n\nconst TEXT_ALIGN_KEY = 'textAlign'\n\nexport function TextAlignPlugin() {\n return createRichTextV2Plugin({\n control: {\n definition: unstable_StyleV2({\n type: unstable_IconRadioGroup({\n label: 'Alignment',\n options: [\n {\n icon: unstable_IconRadioGroupIcon.TextAlignLeft,\n label: 'Left Align',\n value: 'left',\n },\n {\n icon: unstable_IconRadioGroupIcon.TextAlignCenter,\n label: 'Center Align',\n value: 'center',\n },\n {\n icon: unstable_IconRadioGroupIcon.TextAlignRight,\n label: 'Right Align',\n value: 'right',\n },\n {\n icon: unstable_IconRadioGroupIcon.TextAlignJustify,\n label: 'Justify',\n value: 'justify',\n },\n ],\n defaultValue: 'left',\n }),\n getStyle(textAlign: TextAlignProperty) {\n return { textAlign }\n },\n }),\n onChange: (editor, value) =>\n setResponsiveValue(editor, TEXT_ALIGN_KEY, value, {\n match: ElementUtils.isRootBlock,\n split: false,\n }),\n getValue: editor =>\n getResponsiveValue(editor, TEXT_ALIGN_KEY, { match: ElementUtils.isRootBlock }),\n getElementValue: (element: Element) => {\n return ElementUtils.isRootBlock(element) ? element.textAlign : undefined\n },\n },\n withPlugin: (editor: Editor) => {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n if (\n normalizeResponsiveValue(editor, TEXT_ALIGN_KEY, { match: ElementUtils.isRootBlock })(\n entry,\n )\n ) {\n return\n }\n normalizeNode(entry)\n }\n\n return editor\n },\n renderElement: (renderElement, className) => props => {\n return renderElement({\n ...props,\n element: {\n ...props.element,\n className,\n },\n })\n },\n })\n}\n","import { Editor, Text } from 'slate'\nimport {\n Color,\n createRichTextV2Plugin,\n unstable_StyleV2,\n ColorControlDefinition,\n} from '../../controls'\nimport { ControlDefinitionValue } from '../../runtimes/react/controls/control'\nimport {\n getResponsiveValue,\n normalizeResponsiveValue,\n setResponsiveValue,\n} from '../utils/responsive'\n\nexport const COLOR_KEY = 'color'\n\nexport function ColorPlugin() {\n return createRichTextV2Plugin({\n control: {\n definition: unstable_StyleV2({\n type: Color({\n label: 'Color',\n }),\n getStyle(color: ControlDefinitionValue<ColorControlDefinition>) {\n return { color }\n },\n }),\n onChange: (editor, value) => {\n setResponsiveValue(editor, COLOR_KEY, value, {\n match: Text.isText,\n split: true,\n })\n },\n getValue: editor => getResponsiveValue(editor, COLOR_KEY, { match: Text.isText }),\n getLeafValue: (text: Text) => {\n return Text.isText(text) ? text?.color : undefined\n },\n },\n withPlugin: (editor: Editor) => {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n if (normalizeResponsiveValue(editor, COLOR_KEY, { match: Text.isText })(entry)) {\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n },\n renderLeaf: (renderLeaf, className) => props => {\n return renderLeaf({\n ...props,\n leaf: {\n ...props.leaf,\n className,\n },\n })\n },\n })\n}\n"],"names":["Editor","getSelection","Transforms","deepEqual","TEXT_ALIGN_KEY","createRichTextV2Plugin","control","definition","unstable_StyleV2","type","unstable_IconRadioGroup","label","options","icon","unstable_IconRadioGroupIcon","TextAlignLeft","value","TextAlignCenter","TextAlignRight","TextAlignJustify","defaultValue","getStyle","textAlign","onChange","editor","setResponsiveValue","match","ElementUtils","isRootBlock","split","getValue","getResponsiveValue","getElementValue","element","undefined","withPlugin","normalizeNode","entry","normalizeResponsiveValue","renderElement","className","props","COLOR_KEY","Color","color","Text","isText","getLeafValue","text","renderLeaf","leaf"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUE,4BAAA,QACA,KACA,OACA,SACA;AACOA,eAAA,mBAAmB,QAAQ,MAAM;AAChC,UAAA,KAAKC,qBAAa,MAAM;AAC9B,QAAI,CAAC;AAAI;AACT,UAAM,QAAQD,MAAA,OAAO,SAAS,QAAQ,EAAE;AAExC,QAAI,MAAM,SAAS;AACjBE,YAAA,WAAW,SACT,QACA;AAAA,QACE,OAAO;AAAA,MAAA,GAET;AAAA,QACE,IAAI,MAAM;AAAA,QACV,OAAO,QAAQ;AAAA,QACf,OAAO,QAAQ;AAAA,MAAA,CAEnB;AAAA,IACF;AAEA,QAAI,MAAM,SAAS;AACjB,YAAM,gBAAgB,MAAM,KAC1BF,MAAAA,OAAO,MAAM,QAAQ;AAAA,QACnB,IAAI,MAAM;AAAA,QACV,OAAO,CAAC,MAAM,SAAS,QAAQ,MAAM,MAAM,IAAI,KAAK,KAAK,UAAU;AAAA,MACpE,CAAA,CACH;AAEW,iBAAA,CAAA,EAAG,SAAS,eAAe;AACpCE,cAAA,WAAW,SACT,QACA;AAAA,WACG,MAAM;AAAA,QAAA,GAET,EAAE,IAAI,KAAA,CACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,MAAM;AAAA,EAAA,CACb;AACH;AAOE,4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AAA,EAAA,CAzC0B;AA2C9B;;;;;;;;;;;;;;;;;;"}
|
package/dist/slate.es.js
CHANGED
|
@@ -5,84 +5,151 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (
|
|
8
|
+
var __spreadValues = (a2, b) => {
|
|
9
9
|
for (var prop in b || (b = {}))
|
|
10
10
|
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(
|
|
11
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
12
12
|
if (__getOwnPropSymbols)
|
|
13
13
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
14
|
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(
|
|
15
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return a2;
|
|
18
18
|
};
|
|
19
|
-
var __spreadProps = (
|
|
19
|
+
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
20
20
|
export { T as TypographyActions, w as withTypography } from "./index.es5.js";
|
|
21
|
-
import {
|
|
22
|
-
export {
|
|
23
|
-
export { I as InlineModePlugin, w as withInlineMode } from "./index.
|
|
24
|
-
export { w as withBuilder } from "./index.
|
|
25
|
-
import {
|
|
21
|
+
import { g as getSelection, E as ElementUtils } from "./index.es6.js";
|
|
22
|
+
export { B as BlockActions, a as BlockPlugin, L as ListActions, o as onKeyDown, w as withBlock } from "./index.es6.js";
|
|
23
|
+
export { I as InlineModePlugin, w as withInlineMode } from "./index.es7.js";
|
|
24
|
+
export { w as withBuilder } from "./index.es8.js";
|
|
25
|
+
import { b6 as createRichTextV2Plugin, aW as unstable_StyleV2, aw as Color } from "./react-page.es.js";
|
|
26
|
+
export { bd as BlockTextAlignment, bb as BlockType, bc as InlineType, ba as RootBlockType } from "./react-page.es.js";
|
|
27
|
+
import { a as unstable_IconRadioGroup, u as unstable_IconRadioGroupIcon } from "./select.es.js";
|
|
28
|
+
import { Transforms, Editor, Text } from "slate";
|
|
29
|
+
import { d as deepEqual } from "./deepEqual.es.js";
|
|
26
30
|
import "./state/breakpoints.es.js";
|
|
31
|
+
import "./actions.es.js";
|
|
27
32
|
import "is-hotkey";
|
|
33
|
+
import "@emotion/css";
|
|
34
|
+
import "react/jsx-runtime";
|
|
28
35
|
import "slate-react";
|
|
29
|
-
import { d as deepEqual } from "./deepEqual.es.js";
|
|
30
36
|
import "redux";
|
|
31
37
|
import "redux-thunk";
|
|
32
|
-
import "./actions.es.js";
|
|
33
38
|
import "react";
|
|
34
|
-
import "@emotion/css";
|
|
35
39
|
import "@emotion/serialize";
|
|
36
40
|
import "@emotion/utils";
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
function setResponsiveValue(editor, key, value, options) {
|
|
42
|
+
Editor.withoutNormalizing(editor, () => {
|
|
43
|
+
const at = getSelection(editor);
|
|
44
|
+
if (!at)
|
|
45
|
+
return;
|
|
46
|
+
const atRef = Editor.rangeRef(editor, at);
|
|
47
|
+
if (atRef.current) {
|
|
48
|
+
Transforms.setNodes(editor, {
|
|
49
|
+
slice: true
|
|
50
|
+
}, {
|
|
51
|
+
at: atRef.current,
|
|
52
|
+
match: options.match,
|
|
53
|
+
split: options.split
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (atRef.current) {
|
|
57
|
+
const nodesToUpdate = Array.from(Editor.nodes(editor, {
|
|
58
|
+
at: atRef.current,
|
|
59
|
+
match: (node, path) => options.match(node, path) && node.slice === true
|
|
60
|
+
}));
|
|
61
|
+
for (const [, path] of nodesToUpdate) {
|
|
62
|
+
Transforms.setNodes(editor, {
|
|
63
|
+
[key]: value
|
|
64
|
+
}, { at: path });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
atRef.unref();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function getResponsiveValue(editor, key, options) {
|
|
71
|
+
const matchingValues = Array.from(Editor.nodes(editor, {
|
|
72
|
+
at: getSelection(editor),
|
|
73
|
+
match: options == null ? void 0 : options.match
|
|
74
|
+
})).filter(([node, path]) => options.match(node, path)).map(([node]) => node[key]);
|
|
75
|
+
const value = matchingValues.length === 0 ? void 0 : matchingValues.reduce((a2, b) => deepEqual(a2, b) ? b : void 0);
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
function normalizeResponsiveValue(editor, key, options) {
|
|
79
|
+
return (entry) => {
|
|
80
|
+
const [node, path] = entry;
|
|
81
|
+
if (!options.match(node, path)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
const responsiveValue = node == null ? void 0 : node[key];
|
|
85
|
+
if (Array.isArray(responsiveValue) && responsiveValue.length === 0) {
|
|
86
|
+
Transforms.unsetNodes(editor, key, { at: path });
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if ((node == null ? void 0 : node.slice) != null) {
|
|
90
|
+
Transforms.unsetNodes(editor, "slice", { at: path });
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const TEXT_ALIGN_KEY = "textAlign";
|
|
59
97
|
function TextAlignPlugin() {
|
|
60
98
|
return createRichTextV2Plugin({
|
|
61
99
|
control: {
|
|
62
|
-
definition:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
100
|
+
definition: unstable_StyleV2({
|
|
101
|
+
type: unstable_IconRadioGroup({
|
|
102
|
+
label: "Alignment",
|
|
103
|
+
options: [{
|
|
104
|
+
icon: unstable_IconRadioGroupIcon.TextAlignLeft,
|
|
105
|
+
label: "Left Align",
|
|
106
|
+
value: "left"
|
|
107
|
+
}, {
|
|
108
|
+
icon: unstable_IconRadioGroupIcon.TextAlignCenter,
|
|
109
|
+
label: "Center Align",
|
|
110
|
+
value: "center"
|
|
111
|
+
}, {
|
|
112
|
+
icon: unstable_IconRadioGroupIcon.TextAlignRight,
|
|
113
|
+
label: "Right Align",
|
|
114
|
+
value: "right"
|
|
115
|
+
}, {
|
|
116
|
+
icon: unstable_IconRadioGroupIcon.TextAlignJustify,
|
|
117
|
+
label: "Justify",
|
|
118
|
+
value: "justify"
|
|
119
|
+
}],
|
|
120
|
+
defaultValue: "left"
|
|
121
|
+
}),
|
|
122
|
+
getStyle(textAlign) {
|
|
123
|
+
return {
|
|
124
|
+
textAlign
|
|
125
|
+
};
|
|
73
126
|
}
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
127
|
+
}),
|
|
128
|
+
onChange: (editor, value) => setResponsiveValue(editor, TEXT_ALIGN_KEY, value, {
|
|
129
|
+
match: ElementUtils.isRootBlock,
|
|
130
|
+
split: false
|
|
131
|
+
}),
|
|
132
|
+
getValue: (editor) => getResponsiveValue(editor, TEXT_ALIGN_KEY, {
|
|
133
|
+
match: ElementUtils.isRootBlock
|
|
134
|
+
}),
|
|
82
135
|
getElementValue: (element) => {
|
|
83
136
|
return ElementUtils.isRootBlock(element) ? element.textAlign : void 0;
|
|
84
137
|
}
|
|
85
138
|
},
|
|
139
|
+
withPlugin: (editor) => {
|
|
140
|
+
const {
|
|
141
|
+
normalizeNode
|
|
142
|
+
} = editor;
|
|
143
|
+
editor.normalizeNode = (entry) => {
|
|
144
|
+
if (normalizeResponsiveValue(editor, TEXT_ALIGN_KEY, {
|
|
145
|
+
match: ElementUtils.isRootBlock
|
|
146
|
+
})(entry)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
normalizeNode(entry);
|
|
150
|
+
};
|
|
151
|
+
return editor;
|
|
152
|
+
},
|
|
86
153
|
renderElement: (renderElement, className) => (props) => {
|
|
87
154
|
return renderElement(__spreadProps(__spreadValues({}, props), {
|
|
88
155
|
element: __spreadProps(__spreadValues({}, props.element), {
|
|
@@ -92,5 +159,55 @@ function TextAlignPlugin() {
|
|
|
92
159
|
}
|
|
93
160
|
});
|
|
94
161
|
}
|
|
95
|
-
|
|
162
|
+
const COLOR_KEY = "color";
|
|
163
|
+
function ColorPlugin() {
|
|
164
|
+
return createRichTextV2Plugin({
|
|
165
|
+
control: {
|
|
166
|
+
definition: unstable_StyleV2({
|
|
167
|
+
type: Color({
|
|
168
|
+
label: "Color"
|
|
169
|
+
}),
|
|
170
|
+
getStyle(color) {
|
|
171
|
+
return {
|
|
172
|
+
color
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}),
|
|
176
|
+
onChange: (editor, value) => {
|
|
177
|
+
setResponsiveValue(editor, COLOR_KEY, value, {
|
|
178
|
+
match: Text.isText,
|
|
179
|
+
split: true
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
getValue: (editor) => getResponsiveValue(editor, COLOR_KEY, {
|
|
183
|
+
match: Text.isText
|
|
184
|
+
}),
|
|
185
|
+
getLeafValue: (text) => {
|
|
186
|
+
return Text.isText(text) ? text == null ? void 0 : text.color : void 0;
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
withPlugin: (editor) => {
|
|
190
|
+
const {
|
|
191
|
+
normalizeNode
|
|
192
|
+
} = editor;
|
|
193
|
+
editor.normalizeNode = (entry) => {
|
|
194
|
+
if (normalizeResponsiveValue(editor, COLOR_KEY, {
|
|
195
|
+
match: Text.isText
|
|
196
|
+
})(entry)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
normalizeNode(entry);
|
|
200
|
+
};
|
|
201
|
+
return editor;
|
|
202
|
+
},
|
|
203
|
+
renderLeaf: (renderLeaf, className) => (props) => {
|
|
204
|
+
return renderLeaf(__spreadProps(__spreadValues({}, props), {
|
|
205
|
+
leaf: __spreadProps(__spreadValues({}, props.leaf), {
|
|
206
|
+
className
|
|
207
|
+
})
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
export { COLOR_KEY, ColorPlugin, TextAlignPlugin };
|
|
96
213
|
//# sourceMappingURL=slate.es.js.map
|