@makeswift/runtime 0.9.2 → 0.9.3
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 +0 -2
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +0 -2
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +0 -2
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +0 -2
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +0 -2
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +0 -2
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +0 -2
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +0 -2
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +0 -2
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +0 -2
- package/dist/Divider.es.js.map +1 -1
- package/dist/Form.cjs.js +0 -2
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +0 -2
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +0 -2
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +0 -2
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +0 -2
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +1 -3
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +0 -2
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +0 -2
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +2 -4
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +1 -3
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +1 -3
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +2 -4
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +1 -3
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +2 -4
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +0 -2
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +0 -2
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +0 -2
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +0 -2
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +1 -3
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +1 -3
- package/dist/Text.es.js.map +1 -1
- package/dist/components.cjs.js +0 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +0 -2
- package/dist/components.es.js.map +1 -1
- package/dist/controls.cjs.js +5 -6
- 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 +49 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +248 -171
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs6.js +23 -700
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +13 -37
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +39 -17
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +268 -15
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.es.js +42 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +249 -172
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es6.js +23 -695
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +14 -33
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +37 -17
- package/dist/index.es8.js.map +1 -1
- package/dist/index.es9.js +263 -14
- package/dist/index.es9.js.map +1 -1
- package/dist/leaf.es.js +1 -1
- package/dist/next.cjs.js +0 -2
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +1 -3
- package/dist/next.es.js.map +1 -1
- package/dist/react-page.cjs.js +0 -1
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +1 -2
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +0 -2
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +0 -2
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +257 -41
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +249 -38
- package/dist/slate.es.js.map +1 -1
- package/dist/text-input.cjs.js +22 -0
- package/dist/text-input.cjs.js.map +1 -1
- package/dist/text-input.es.js +18 -1
- package/dist/text-input.es.js.map +1 -1
- package/dist/types/src/controls/icon-radio-group.d.ts +5 -2
- package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -1
- package/dist/types/src/controls/style-v2.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/getValue.d.ts +5 -0
- package/dist/types/src/slate/InlinePlugin/getValue.d.ts.map +1 -0
- package/dist/types/src/slate/InlinePlugin/index.d.ts +16 -0
- package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/InlinePlugin/onChange.d.ts +4 -0
- package/dist/types/src/slate/InlinePlugin/onChange.d.ts.map +1 -0
- package/dist/types/src/slate/InlinePlugin/types.d.ts +9 -0
- package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -0
- package/dist/types/src/slate/LinkPlugin/getValue.d.ts +5 -0
- package/dist/types/src/slate/LinkPlugin/getValue.d.ts.map +1 -0
- package/dist/types/src/slate/LinkPlugin/index.d.ts +15 -0
- package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/LinkPlugin/onChange.d.ts +4 -0
- package/dist/types/src/slate/LinkPlugin/onChange.d.ts.map +1 -0
- package/dist/types/src/slate/LinkPlugin/types.d.ts +5 -0
- package/dist/types/src/slate/LinkPlugin/types.d.ts.map +1 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +2 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/index.d.ts +2 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types.cjs2.js +753 -0
- package/dist/types.cjs2.js.map +1 -0
- package/dist/types.es2.js +736 -0
- package/dist/types.es2.js.map +1 -0
- package/package.json +1 -1
- package/dist/deepEqual.cjs.js +0 -40
- package/dist/deepEqual.cjs.js.map +0 -1
- package/dist/deepEqual.es.js +0 -39
- package/dist/deepEqual.es.js.map +0 -1
- package/dist/index.cjs11.js +0 -375
- package/dist/index.cjs11.js.map +0 -1
- package/dist/index.es11.js +0 -368
- package/dist/index.es11.js.map +0 -1
- package/dist/select.cjs.js +0 -21
- package/dist/select.cjs.js.map +0 -1
- package/dist/select.es.js +0 -16
- package/dist/select.es.js.map +0 -1
package/dist/slate.es.js
CHANGED
|
@@ -5,39 +5,64 @@ 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 = (
|
|
9
|
-
for (var prop in
|
|
10
|
-
if (__hasOwnProp.call(
|
|
11
|
-
__defNormalProp(
|
|
8
|
+
var __spreadValues = (a, b2) => {
|
|
9
|
+
for (var prop in b2 || (b2 = {}))
|
|
10
|
+
if (__hasOwnProp.call(b2, prop))
|
|
11
|
+
__defNormalProp(a, prop, b2[prop]);
|
|
12
12
|
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(
|
|
14
|
-
if (__propIsEnum.call(
|
|
15
|
-
__defNormalProp(
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b2)) {
|
|
14
|
+
if (__propIsEnum.call(b2, prop))
|
|
15
|
+
__defNormalProp(a, prop, b2[prop]);
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return a;
|
|
18
18
|
};
|
|
19
|
-
var __spreadProps = (
|
|
19
|
+
var __spreadProps = (a, b2) => __defProps(a, __getOwnPropDescs(b2));
|
|
20
20
|
export { T as TypographyActions, w as withTypography } from "./index.es5.js";
|
|
21
|
-
import { g as getSelection, E as ElementUtils } from "./
|
|
22
|
-
export { B as BlockActions,
|
|
23
|
-
export { I as InlineModePlugin, w as withInlineMode } from "./index.
|
|
24
|
-
export { w as withBuilder } from "./index.
|
|
25
|
-
import { b6 as createRichTextV2Plugin, aW as unstable_StyleV2, aw as Color } from "./react-page.es.js";
|
|
26
|
-
export { bd as BlockTextAlignment,
|
|
27
|
-
import {
|
|
21
|
+
import { g as getSelection, E as ElementUtils, f as filterForSubtreeRoots, i as isSupportedInlineType, a as isSupportedInlineEntry, u as unwrapInline, w as wrapInline, s as supportedInlineOptions } from "./types.es2.js";
|
|
22
|
+
export { B as BlockActions, c as BlockPlugin, L as ListActions, o as onKeyDown, b as withBlock } from "./types.es2.js";
|
|
23
|
+
export { I as InlineModePlugin, w as withInlineMode } from "./index.es6.js";
|
|
24
|
+
export { w as withBuilder } from "./index.es7.js";
|
|
25
|
+
import { b6 as createRichTextV2Plugin, aW as unstable_StyleV2, aw as Color, ba as InlineType, aC as Link, Z as useStyle } from "./react-page.es.js";
|
|
26
|
+
export { bd as BlockTextAlignment, bc as BlockType, ba as InlineType, bb as RootBlockType } from "./react-page.es.js";
|
|
27
|
+
import { c as unstable_IconRadioGroup, u as unstable_IconRadioGroupIcon } from "./text-input.es.js";
|
|
28
28
|
import { Transforms, Editor, Text } from "slate";
|
|
29
|
-
import {
|
|
29
|
+
import { K as deepEqual } from "./index.es.js";
|
|
30
|
+
import "react";
|
|
31
|
+
import { cx } from "@emotion/css";
|
|
32
|
+
import "@emotion/serialize";
|
|
33
|
+
import "@emotion/utils";
|
|
34
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
35
|
+
import { L as Link$1 } from "./index.es3.js";
|
|
30
36
|
import "./state/breakpoints.es.js";
|
|
31
37
|
import "./actions.es.js";
|
|
32
38
|
import "is-hotkey";
|
|
33
|
-
import "@emotion/css";
|
|
34
|
-
import "react/jsx-runtime";
|
|
35
39
|
import "slate-react";
|
|
36
40
|
import "redux";
|
|
37
41
|
import "redux-thunk";
|
|
38
|
-
import "
|
|
39
|
-
import "
|
|
40
|
-
import "
|
|
42
|
+
import "use-sync-external-store/shim/with-selector";
|
|
43
|
+
import "next/dynamic";
|
|
44
|
+
import "./combobox.es.js";
|
|
45
|
+
import "use-sync-external-store/shim";
|
|
46
|
+
import "./types.es.js";
|
|
47
|
+
import "./box-models.es.js";
|
|
48
|
+
import "css-box-model";
|
|
49
|
+
import "color";
|
|
50
|
+
import "scroll-into-view-if-needed";
|
|
51
|
+
import "react-dom";
|
|
52
|
+
import "html-react-parser";
|
|
53
|
+
import "next/head";
|
|
54
|
+
import "zod";
|
|
55
|
+
import "@emotion/server/create-instance";
|
|
56
|
+
import "next/document";
|
|
57
|
+
import "cors";
|
|
58
|
+
import "path-to-regexp";
|
|
59
|
+
import "cookie";
|
|
60
|
+
import "http-proxy";
|
|
61
|
+
import "set-cookie-parser";
|
|
62
|
+
import "./constants.es.js";
|
|
63
|
+
import "uuid";
|
|
64
|
+
import "corporate-ipsum";
|
|
65
|
+
import "next/link";
|
|
41
66
|
function setResponsiveValue(editor, key, value, options) {
|
|
42
67
|
Editor.withoutNormalizing(editor, () => {
|
|
43
68
|
const at = getSelection(editor);
|
|
@@ -72,7 +97,7 @@ function getResponsiveValue(editor, key, options) {
|
|
|
72
97
|
at: getSelection(editor),
|
|
73
98
|
match: options == null ? void 0 : options.match
|
|
74
99
|
})).filter(([node, path]) => options.match(node, path)).map(([node]) => node[key]);
|
|
75
|
-
const value = matchingValues.length === 0 ? void 0 : matchingValues.reduce((
|
|
100
|
+
const value = matchingValues.length === 0 ? void 0 : matchingValues.reduce((a, b2) => deepEqual(a, b2) ? b2 : void 0);
|
|
76
101
|
return value;
|
|
77
102
|
}
|
|
78
103
|
function normalizeResponsiveValue(editor, key, options) {
|
|
@@ -94,6 +119,20 @@ function normalizeResponsiveValue(editor, key, options) {
|
|
|
94
119
|
};
|
|
95
120
|
}
|
|
96
121
|
const TEXT_ALIGN_KEY = "textAlign";
|
|
122
|
+
const withTextAlign = (editor) => {
|
|
123
|
+
const {
|
|
124
|
+
normalizeNode
|
|
125
|
+
} = editor;
|
|
126
|
+
editor.normalizeNode = (entry) => {
|
|
127
|
+
if (normalizeResponsiveValue(editor, TEXT_ALIGN_KEY, {
|
|
128
|
+
match: ElementUtils.isRootBlock
|
|
129
|
+
})(entry)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
normalizeNode(entry);
|
|
133
|
+
};
|
|
134
|
+
return editor;
|
|
135
|
+
};
|
|
97
136
|
function TextAlignPlugin() {
|
|
98
137
|
return createRichTextV2Plugin({
|
|
99
138
|
control: {
|
|
@@ -136,20 +175,7 @@ function TextAlignPlugin() {
|
|
|
136
175
|
return ElementUtils.isRootBlock(element) ? element.textAlign : void 0;
|
|
137
176
|
}
|
|
138
177
|
},
|
|
139
|
-
withPlugin:
|
|
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
|
-
},
|
|
178
|
+
withPlugin: withTextAlign,
|
|
153
179
|
renderElement: (renderElement, className) => (props) => {
|
|
154
180
|
return renderElement(__spreadProps(__spreadValues({}, props), {
|
|
155
181
|
element: __spreadProps(__spreadValues({}, props.element), {
|
|
@@ -209,5 +235,190 @@ function ColorPlugin() {
|
|
|
209
235
|
}
|
|
210
236
|
});
|
|
211
237
|
}
|
|
212
|
-
|
|
238
|
+
function getSupportedInlinesAndTextInSelection(editor) {
|
|
239
|
+
return Array.from(Editor.nodes(editor, {
|
|
240
|
+
at: getSelection(editor),
|
|
241
|
+
match: (node) => ElementUtils.isInline(node) && isSupportedInlineType(node.type) || Text.isText(node)
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
const getValue$1 = (editor) => {
|
|
245
|
+
var _a;
|
|
246
|
+
const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
|
|
247
|
+
const areAllRootsSupportedInlineTypesOrText = roots.every((entry) => isSupportedInlineEntry(entry) || Text.isText(entry[0]));
|
|
248
|
+
if (!areAllRootsSupportedInlineTypesOrText)
|
|
249
|
+
return void 0;
|
|
250
|
+
const matchingValues = roots.filter(isSupportedInlineEntry).map(([node]) => node);
|
|
251
|
+
return (_a = matchingValues.reduce((a, b2) => deepEqual(a, b2) ? b2 : void 0, matchingValues.at(0))) == null ? void 0 : _a.type;
|
|
252
|
+
};
|
|
253
|
+
const onChange$1 = (editor, value) => {
|
|
254
|
+
function unwrapAllSupportedTypes() {
|
|
255
|
+
supportedInlineOptions.forEach(({ value: optionValue }) => unwrapInline(editor, optionValue));
|
|
256
|
+
}
|
|
257
|
+
function unwrapAllInlines() {
|
|
258
|
+
Transforms.unwrapNodes(editor, {
|
|
259
|
+
match: (node) => ElementUtils.isInline(node),
|
|
260
|
+
at: getSelection(editor)
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
if (value == null)
|
|
264
|
+
return unwrapAllSupportedTypes();
|
|
265
|
+
if (!isSupportedInlineType(value))
|
|
266
|
+
return;
|
|
267
|
+
const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
|
|
268
|
+
const root = roots.at(0);
|
|
269
|
+
if (roots.length === 1 && root != null && isSupportedInlineEntry(root) && root[0].type === value) {
|
|
270
|
+
unwrapInline(editor, value);
|
|
271
|
+
} else {
|
|
272
|
+
unwrapAllInlines();
|
|
273
|
+
wrapInline(editor, { type: value, children: [] });
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const withInline = (editor) => {
|
|
277
|
+
const {
|
|
278
|
+
isInline
|
|
279
|
+
} = editor;
|
|
280
|
+
editor.isInline = (entry) => {
|
|
281
|
+
return ElementUtils.isInline(entry) && isInline(entry);
|
|
282
|
+
};
|
|
283
|
+
return editor;
|
|
284
|
+
};
|
|
285
|
+
function InlinePlugin() {
|
|
286
|
+
return createRichTextV2Plugin({
|
|
287
|
+
control: {
|
|
288
|
+
definition: unstable_IconRadioGroup({
|
|
289
|
+
label: "Inline",
|
|
290
|
+
options: supportedInlineOptions
|
|
291
|
+
}),
|
|
292
|
+
onChange: onChange$1,
|
|
293
|
+
getValue: getValue$1,
|
|
294
|
+
getElementValue: (element) => {
|
|
295
|
+
return ElementUtils.isInline(element) ? element.type : void 0;
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
withPlugin: withInline,
|
|
299
|
+
renderElement: (renderElement) => (props) => {
|
|
300
|
+
return /* @__PURE__ */ jsx(InlinePluginComponent$1, __spreadProps(__spreadValues({}, props), {
|
|
301
|
+
renderElement
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function InlinePluginComponent$1({
|
|
307
|
+
element,
|
|
308
|
+
attributes,
|
|
309
|
+
children,
|
|
310
|
+
renderElement
|
|
311
|
+
}) {
|
|
312
|
+
switch (element.type) {
|
|
313
|
+
case InlineType.Code:
|
|
314
|
+
return /* @__PURE__ */ jsx("code", __spreadProps(__spreadValues({}, attributes), {
|
|
315
|
+
children
|
|
316
|
+
}));
|
|
317
|
+
case InlineType.SuperScript:
|
|
318
|
+
return /* @__PURE__ */ jsx("sup", __spreadProps(__spreadValues({}, attributes), {
|
|
319
|
+
children
|
|
320
|
+
}));
|
|
321
|
+
case InlineType.SubScript:
|
|
322
|
+
return /* @__PURE__ */ jsx("sub", __spreadProps(__spreadValues({}, attributes), {
|
|
323
|
+
children
|
|
324
|
+
}));
|
|
325
|
+
default:
|
|
326
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
327
|
+
children: renderElement({
|
|
328
|
+
element,
|
|
329
|
+
attributes,
|
|
330
|
+
children
|
|
331
|
+
})
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function isLinkElement(node) {
|
|
336
|
+
return ElementUtils.isInline(node) && node.type === InlineType.Link;
|
|
337
|
+
}
|
|
338
|
+
function isLinkEntry(inline) {
|
|
339
|
+
return ElementUtils.isInline(inline[0]) && inline[0].type === InlineType.Link;
|
|
340
|
+
}
|
|
341
|
+
function getLinksAndTextInSelection(editor) {
|
|
342
|
+
return Array.from(Editor.nodes(editor, {
|
|
343
|
+
at: getSelection(editor),
|
|
344
|
+
match: (node) => ElementUtils.isInline(node) && isLinkElement(node) || Text.isText(node)
|
|
345
|
+
}));
|
|
346
|
+
}
|
|
347
|
+
const getValue = (editor) => {
|
|
348
|
+
var _a;
|
|
349
|
+
const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor));
|
|
350
|
+
const areAllRootsLinks = roots.every(([root]) => isLinkElement(root) || Text.isText(root));
|
|
351
|
+
if (!areAllRootsLinks)
|
|
352
|
+
return void 0;
|
|
353
|
+
const matchingValues = roots.map(([node]) => node).filter(isLinkElement);
|
|
354
|
+
return (_a = matchingValues.reduce((a, b2) => deepEqual(a, b2) ? b2 : void 0, matchingValues.at(0))) == null ? void 0 : _a.link;
|
|
355
|
+
};
|
|
356
|
+
const onChange = (editor, value) => {
|
|
357
|
+
if (value == null)
|
|
358
|
+
return unwrapInline(editor, InlineType.Link);
|
|
359
|
+
const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor));
|
|
360
|
+
const root = roots.at(0);
|
|
361
|
+
if (roots.length === 1 && root != null && isLinkEntry(root)) {
|
|
362
|
+
Transforms.setNodes(editor, {
|
|
363
|
+
link: value
|
|
364
|
+
}, { at: root[1] });
|
|
365
|
+
} else {
|
|
366
|
+
unwrapInline(editor, InlineType.Link);
|
|
367
|
+
wrapInline(editor, { type: InlineType.Link, link: value, children: [] });
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
const withLink = (editor) => {
|
|
371
|
+
const {
|
|
372
|
+
isInline
|
|
373
|
+
} = editor;
|
|
374
|
+
editor.isInline = (entry) => {
|
|
375
|
+
return ElementUtils.isInline(entry) && isInline(entry);
|
|
376
|
+
};
|
|
377
|
+
return editor;
|
|
378
|
+
};
|
|
379
|
+
function InlinePluginComponent({
|
|
380
|
+
element,
|
|
381
|
+
attributes,
|
|
382
|
+
children,
|
|
383
|
+
renderElement
|
|
384
|
+
}) {
|
|
385
|
+
const linkStyle = useStyle({
|
|
386
|
+
textDecoration: "none"
|
|
387
|
+
});
|
|
388
|
+
switch (element.type) {
|
|
389
|
+
case InlineType.Link:
|
|
390
|
+
return /* @__PURE__ */ jsx(Link$1, __spreadProps(__spreadValues({}, attributes), {
|
|
391
|
+
link: element.link,
|
|
392
|
+
className: cx(linkStyle, element.className),
|
|
393
|
+
children
|
|
394
|
+
}));
|
|
395
|
+
default:
|
|
396
|
+
return renderElement({
|
|
397
|
+
element,
|
|
398
|
+
attributes,
|
|
399
|
+
children
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function LinkPlugin() {
|
|
404
|
+
return createRichTextV2Plugin({
|
|
405
|
+
control: {
|
|
406
|
+
definition: Link({
|
|
407
|
+
label: "On Click"
|
|
408
|
+
}),
|
|
409
|
+
onChange,
|
|
410
|
+
getValue,
|
|
411
|
+
getElementValue: (element) => {
|
|
412
|
+
return ElementUtils.isInline(element) && isLinkElement(element) ? element.link : void 0;
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
withPlugin: withLink,
|
|
416
|
+
renderElement: (renderElement) => (props) => {
|
|
417
|
+
return /* @__PURE__ */ jsx(InlinePluginComponent, __spreadProps(__spreadValues({}, props), {
|
|
418
|
+
renderElement
|
|
419
|
+
}));
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
export { COLOR_KEY, ColorPlugin, InlinePlugin, LinkPlugin, TextAlignPlugin, withInline, withLink, withTextAlign };
|
|
213
424
|
//# sourceMappingURL=slate.es.js.map
|
package/dist/slate.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slate.es.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":["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;AACO,SAAA,mBAAmB,QAAQ,MAAM;AAChC,UAAA,KAAK,aAAa,MAAM;AAC9B,QAAI,CAAC;AAAI;AACT,UAAM,QAAQ,OAAO,SAAS,QAAQ,EAAE;AAExC,QAAI,MAAM,SAAS;AACjB,iBAAW,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,KAC1B,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;AACpC,mBAAW,SACT,QACA;AAAA,WACG,MAAM;AAAA,QAAA,GAET,EAAE,IAAI,KAAA,CACR;AAAA,MACF;AAAA,IACF;AAEA,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lugin/index.tsx","../src/slate/ColorPlugin/index.tsx","../src/slate/InlinePlugin/getValue.ts","../src/slate/InlinePlugin/onChange.ts","../src/slate/InlinePlugin/index.tsx","../src/slate/LinkPlugin/types.ts","../src/slate/LinkPlugin/getValue.ts","../src/slate/LinkPlugin/onChange.ts","../src/slate/LinkPlugin/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 const withTextAlign = (editor: Editor) => {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n if (\n normalizeResponsiveValue(editor, TEXT_ALIGN_KEY, { match: ElementUtils.isRootBlock })(entry)\n ) {\n return\n }\n normalizeNode(entry)\n }\n\n return editor\n}\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: withTextAlign,\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","import { Editor, NodeEntry, Text } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { getSelection } from '../selectors'\nimport { filterForSubtreeRoots } from '../BlockPlugin/utils/filterForSubtreeRoots'\nimport deepEqual from '../../utils/deepEqual'\nimport { SupportedInline, isSupportedInlineType, isSupportedInlineEntry } from './types'\n\nexport function getSupportedInlinesAndTextInSelection(\n editor: Editor,\n): NodeEntry<SupportedInline | Text>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node =>\n (ElementUtils.isInline(node) && isSupportedInlineType(node.type)) || Text.isText(node),\n }),\n ) as NodeEntry<Text | SupportedInline>[]\n}\n\nexport const getValue = (editor: Editor) => {\n const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor))\n\n const areAllRootsSupportedInlineTypesOrText = roots.every(\n entry => isSupportedInlineEntry(entry) || Text.isText(entry[0]),\n )\n\n if (!areAllRootsSupportedInlineTypesOrText) return undefined\n\n const matchingValues = roots.filter(isSupportedInlineEntry).map(([node]) => node)\n\n return matchingValues.reduce((a, b) => (deepEqual(a, b) ? b : undefined), matchingValues.at(0))\n ?.type\n}\n","import { getSupportedInlinesAndTextInSelection } from './getValue'\nimport { Editor, Transforms } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { unwrapInline } from '../BlockPlugin/unwrapInline'\nimport { wrapInline } from '../BlockPlugin/wrapInline'\nimport { getSelection } from '../selectors'\nimport { filterForSubtreeRoots } from '../BlockPlugin/utils/filterForSubtreeRoots'\nimport {\n SupportedInlineType,\n isSupportedInlineEntry,\n isSupportedInlineType,\n supportedInlineOptions,\n} from './types'\n\nexport const onChange = (editor: Editor, value: SupportedInlineType) => {\n function unwrapAllSupportedTypes() {\n supportedInlineOptions.forEach(({ value: optionValue }) => unwrapInline(editor, optionValue))\n }\n\n function unwrapAllInlines() {\n Transforms.unwrapNodes(editor, {\n match: node => ElementUtils.isInline(node),\n at: getSelection(editor),\n })\n }\n\n if (value == null) return unwrapAllSupportedTypes()\n\n if (!isSupportedInlineType(value)) return\n\n const roots = filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor))\n const root = roots.at(0)\n\n if (\n roots.length === 1 &&\n root != null &&\n isSupportedInlineEntry(root) &&\n root[0].type === value\n ) {\n unwrapInline(editor, value)\n } else {\n unwrapAllInlines()\n wrapInline(editor, { type: value, children: [] })\n }\n}\n","import { Editor, Element } from 'slate'\nimport { RenderElement, createRichTextV2Plugin, unstable_IconRadioGroup } from '../../controls'\nimport { ElementUtils } from '../utils/element'\nimport { InlineType } from '../types'\nimport { RenderElementProps } from 'slate-react'\nimport { supportedInlineOptions } from './types'\nimport { onChange } from './onChange'\nimport { getValue } from './getValue'\n\nexport const withInline = (editor: Editor) => {\n const { isInline } = editor\n\n editor.isInline = entry => {\n return ElementUtils.isInline(entry) && isInline(entry)\n }\n\n return editor\n}\n\nexport function InlinePlugin() {\n return createRichTextV2Plugin({\n control: {\n definition: unstable_IconRadioGroup({\n label: 'Inline',\n options: supportedInlineOptions,\n }),\n onChange,\n getValue,\n getElementValue: (element: Element) => {\n return ElementUtils.isInline(element) ? element.type : undefined\n },\n },\n withPlugin: withInline,\n renderElement: renderElement => props => {\n return <InlinePluginComponent {...props} renderElement={renderElement} />\n },\n })\n}\n\nfunction InlinePluginComponent({\n element,\n attributes,\n children,\n renderElement,\n}: RenderElementProps & { renderElement: RenderElement }) {\n switch (element.type) {\n case InlineType.Code:\n return <code {...attributes}>{children}</code>\n case InlineType.SuperScript:\n return <sup {...attributes}>{children}</sup>\n case InlineType.SubScript:\n return <sub {...attributes}>{children}</sub>\n\n default:\n return (\n <>\n {renderElement({\n element,\n attributes,\n children,\n })}\n </>\n )\n }\n}\n","import { Node, NodeEntry } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { InlineType, LinkElement } from '../types'\n\nexport function isLinkElement(node: Node): node is LinkElement {\n return ElementUtils.isInline(node) && node.type === InlineType.Link\n}\n\nexport function isLinkEntry(inline: NodeEntry<Node>): inline is NodeEntry<LinkElement> {\n return ElementUtils.isInline(inline[0]) && inline[0].type === InlineType.Link\n}\n","import { Editor, NodeEntry, Text } from 'slate'\nimport { ElementUtils } from '../utils/element'\nimport { LinkElement } from '../types'\nimport deepEqual from '../../utils/deepEqual'\nimport { getSelection } from '../selectors'\nimport { filterForSubtreeRoots } from '../BlockPlugin/utils/filterForSubtreeRoots'\nimport { isLinkElement } from './types'\n\nexport function getLinksAndTextInSelection(editor: Editor): NodeEntry<LinkElement | Text>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => (ElementUtils.isInline(node) && isLinkElement(node)) || Text.isText(node),\n }),\n ) as NodeEntry<Text | LinkElement>[]\n}\n\nexport const getValue = (editor: Editor) => {\n const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor))\n\n const areAllRootsLinks = roots.every(([root]) => isLinkElement(root) || Text.isText(root))\n\n if (!areAllRootsLinks) return undefined\n\n const matchingValues = roots.map(([node]) => node).filter(isLinkElement)\n\n return matchingValues.reduce((a, b) => (deepEqual(a, b) ? b : undefined), matchingValues.at(0))\n ?.link\n}\n","import { Editor, Transforms } from 'slate'\nimport { LinkControlData } from '../../controls'\nimport { unwrapInline } from '../BlockPlugin/unwrapInline'\nimport { wrapInline } from '../BlockPlugin/wrapInline'\nimport { InlineType } from '../types'\nimport { filterForSubtreeRoots } from '../BlockPlugin/utils/filterForSubtreeRoots'\nimport { isLinkEntry } from './types'\nimport { getLinksAndTextInSelection } from './getValue'\n\nexport const onChange = (editor: Editor, value: LinkControlData) => {\n if (value == null) return unwrapInline(editor, InlineType.Link)\n\n const roots = filterForSubtreeRoots(getLinksAndTextInSelection(editor))\n const root = roots.at(0)\n\n // If the root of our selection is a link we just want to modify it\n if (roots.length === 1 && root != null && isLinkEntry(root)) {\n Transforms.setNodes(\n editor,\n {\n link: value,\n },\n { at: root[1] },\n )\n }\n // In all other cases we want to remove all existing links and wrap the current selection in a new link\n else {\n unwrapInline(editor, InlineType.Link)\n wrapInline(editor, { type: InlineType.Link, link: value, children: [] })\n }\n}\n","import { Editor, Element } from 'slate'\nimport { Link, RenderElement, createRichTextV2Plugin } from '../../controls'\nimport { ElementUtils } from '../utils/element'\nimport { InlineType } from '../types'\nimport { RenderElementProps } from 'slate-react'\nimport { useStyle } from '../../runtimes/react/use-style'\nimport { Link as LinkComponent } from '../../components/shared/Link'\nimport { cx } from '@emotion/css'\nimport { isLinkElement } from './types'\nimport { onChange } from './onChange'\nimport { getValue } from './getValue'\n\nexport const withLink = (editor: Editor) => {\n const { isInline } = editor\n\n editor.isInline = entry => {\n return ElementUtils.isInline(entry) && isInline(entry)\n }\n\n return editor\n}\n\nfunction InlinePluginComponent({\n element,\n attributes,\n children,\n renderElement,\n}: RenderElementProps & { renderElement: RenderElement }) {\n const linkStyle = useStyle({ textDecoration: 'none' })\n switch (element.type) {\n case InlineType.Link:\n return (\n <LinkComponent\n {...attributes}\n link={element.link}\n className={cx(linkStyle, element.className)}\n >\n {children}\n </LinkComponent>\n )\n\n default:\n return renderElement({\n element,\n attributes,\n children,\n })\n }\n}\n\nexport function LinkPlugin() {\n return createRichTextV2Plugin({\n control: {\n definition: Link({\n label: 'On Click',\n }),\n onChange,\n getValue,\n getElementValue: (element: Element) => {\n return ElementUtils.isInline(element) && isLinkElement(element) ? element.link : undefined\n },\n },\n withPlugin: withLink,\n renderElement: renderElement => props => {\n return <InlinePluginComponent {...props} renderElement={renderElement} />\n },\n })\n}\n"],"names":["TEXT_ALIGN_KEY","withTextAlign","editor","normalizeNode","entry","normalizeResponsiveValue","match","ElementUtils","isRootBlock","createRichTextV2Plugin","control","definition","unstable_StyleV2","type","unstable_IconRadioGroup","label","options","icon","unstable_IconRadioGroupIcon","TextAlignLeft","value","TextAlignCenter","TextAlignRight","TextAlignJustify","defaultValue","getStyle","textAlign","onChange","setResponsiveValue","split","getValue","getResponsiveValue","getElementValue","element","undefined","withPlugin","renderElement","className","props","COLOR_KEY","Color","color","Text","isText","getLeafValue","text","renderLeaf","leaf","withInline","isInline","supportedInlineOptions","InlinePluginComponent","attributes","children","InlineType","Code","SuperScript","SubScript","_Fragment","withLink","linkStyle","useStyle","textDecoration","Link","LinkCompon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,WAAWC,GAAGN,WAAW3B,QAAQI,SAApB;AAAA,QAEZgB;AAAAA,MAAAA,EANL;AAAA;AAWA,aAAOjB,cAAc;AAAA,QACnBH;AAAAA,QACAmB;AAAAA,QACAC;AAAAA,MAAAA,CAHkB;AAAA;AAMzB;AAE4B,sBAAA;AAC3B,SAAO5C,uBAAuB;AAAA,IAC5BC,SAAS;AAAA,MACPC,YAAYoD,KAAK;AAAA,QACfhD,OAAO;AAAA,MAAA,CADO;AAAA,MAGhBY;AAAAA,MACAG;AAAAA,MACAE,iBAAiB,CAACC,YAAqB;AAC9B1B,eAAAA,aAAa0C,SAAShB,OAAtB,KAAkCkC,cAAclC,OAAD,IAAYA,QAAQgC,OAAO/B;AAAAA,MAClF;AAAA,IATyB;AAAA,IAW5BC,YAAYwB;AAAAA,IACZvB,eAAeA,mBAAiBE,CAAS,UAAA;AAChC,iCAAC,uBAAD,iCAA2BA,QAA3B;AAAA,QAAkC;AAAA,MAAA,EAAzC;AAAA,IACD;AAAA,EAAA,CAd0B;AAgB9B;;"}
|
package/dist/text-input.cjs.js
CHANGED
|
@@ -3,10 +3,27 @@ const CheckboxControlType = "makeswift::controls::checkbox";
|
|
|
3
3
|
function Checkbox(config = {}) {
|
|
4
4
|
return { type: CheckboxControlType, config };
|
|
5
5
|
}
|
|
6
|
+
const unstable_IconRadioGroupIcon = {
|
|
7
|
+
TextAlignCenter: "TextAlignCenter",
|
|
8
|
+
TextAlignJustify: "TextAlignJustify",
|
|
9
|
+
TextAlignLeft: "TextAlignLeft",
|
|
10
|
+
TextAlignRight: "TextAlignRight",
|
|
11
|
+
Superscript: "Superscript16",
|
|
12
|
+
Subscript: "Subscript16",
|
|
13
|
+
Code: "Code16"
|
|
14
|
+
};
|
|
15
|
+
const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
|
|
16
|
+
function unstable_IconRadioGroup(config) {
|
|
17
|
+
return { type: IconRadioGroupControlType, config };
|
|
18
|
+
}
|
|
6
19
|
const NumberControlType = "makeswift::controls::number";
|
|
7
20
|
function Number(config = {}) {
|
|
8
21
|
return { type: NumberControlType, config };
|
|
9
22
|
}
|
|
23
|
+
const SelectControlType = "makeswift::controls::select";
|
|
24
|
+
function Select(config) {
|
|
25
|
+
return { type: SelectControlType, config };
|
|
26
|
+
}
|
|
10
27
|
const TextAreaControlType = "makeswift::controls::text-area";
|
|
11
28
|
function TextArea(config = {}) {
|
|
12
29
|
return { type: TextAreaControlType, config };
|
|
@@ -17,10 +34,15 @@ function TextInput(config = {}) {
|
|
|
17
34
|
}
|
|
18
35
|
exports.Checkbox = Checkbox;
|
|
19
36
|
exports.CheckboxControlType = CheckboxControlType;
|
|
37
|
+
exports.IconRadioGroupControlType = IconRadioGroupControlType;
|
|
20
38
|
exports.Number = Number;
|
|
21
39
|
exports.NumberControlType = NumberControlType;
|
|
40
|
+
exports.Select = Select;
|
|
41
|
+
exports.SelectControlType = SelectControlType;
|
|
22
42
|
exports.TextArea = TextArea;
|
|
23
43
|
exports.TextAreaControlType = TextAreaControlType;
|
|
24
44
|
exports.TextInput = TextInput;
|
|
25
45
|
exports.TextInputControlType = TextInputControlType;
|
|
46
|
+
exports.unstable_IconRadioGroup = unstable_IconRadioGroup;
|
|
47
|
+
exports.unstable_IconRadioGroupIcon = unstable_IconRadioGroupIcon;
|
|
26
48
|
//# sourceMappingURL=text-input.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.cjs.js","sources":["../src/controls/checkbox.ts","../src/controls/number.ts","../src/controls/text-area.ts","../src/controls/text-input.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, config }\n}\n","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n"],"names":[],"mappings":";AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;
|
|
1
|
+
{"version":3,"file":"text-input.cjs.js","sources":["../src/controls/checkbox.ts","../src/controls/icon-radio-group.ts","../src/controls/number.ts","../src/controls/select.ts","../src/controls/text-area.ts","../src/controls/text-input.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export const unstable_IconRadioGroupIcon = {\n TextAlignCenter: 'TextAlignCenter',\n TextAlignJustify: 'TextAlignJustify',\n TextAlignLeft: 'TextAlignLeft',\n TextAlignRight: 'TextAlignRight',\n Superscript: 'Superscript16',\n Subscript: 'Subscript16',\n Code: 'Code16',\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\nexport type 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 type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, 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","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n"],"names":[],"mappings":";AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;AClBO,MAAM,8BAA8B;AAAA,EACzC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AACR;AAKO,MAAM,4BAA4B;AA6BlC,iCACL,QACoC;AAC7B,SAAA,EAAE,MAAM,2BAA2B;AAC5C;AC5CO,MAAM,oBAAoB;AAkB/B,gBAAA,SAAY,IACgB;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACvBO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACxBO,MAAM,sBAAsB;AAcjC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;ACjBO,MAAM,uBAAuB;AAclC,mBAAA,SAAY,IACmB;AACxB,SAAA,EAAE,MAAM,sBAAsB;AACvC;;;;;;;;;;;;;;"}
|
package/dist/text-input.es.js
CHANGED
|
@@ -2,10 +2,27 @@ const CheckboxControlType = "makeswift::controls::checkbox";
|
|
|
2
2
|
function Checkbox(config = {}) {
|
|
3
3
|
return { type: CheckboxControlType, config };
|
|
4
4
|
}
|
|
5
|
+
const unstable_IconRadioGroupIcon = {
|
|
6
|
+
TextAlignCenter: "TextAlignCenter",
|
|
7
|
+
TextAlignJustify: "TextAlignJustify",
|
|
8
|
+
TextAlignLeft: "TextAlignLeft",
|
|
9
|
+
TextAlignRight: "TextAlignRight",
|
|
10
|
+
Superscript: "Superscript16",
|
|
11
|
+
Subscript: "Subscript16",
|
|
12
|
+
Code: "Code16"
|
|
13
|
+
};
|
|
14
|
+
const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
|
|
15
|
+
function unstable_IconRadioGroup(config) {
|
|
16
|
+
return { type: IconRadioGroupControlType, config };
|
|
17
|
+
}
|
|
5
18
|
const NumberControlType = "makeswift::controls::number";
|
|
6
19
|
function Number(config = {}) {
|
|
7
20
|
return { type: NumberControlType, config };
|
|
8
21
|
}
|
|
22
|
+
const SelectControlType = "makeswift::controls::select";
|
|
23
|
+
function Select(config) {
|
|
24
|
+
return { type: SelectControlType, config };
|
|
25
|
+
}
|
|
9
26
|
const TextAreaControlType = "makeswift::controls::text-area";
|
|
10
27
|
function TextArea(config = {}) {
|
|
11
28
|
return { type: TextAreaControlType, config };
|
|
@@ -14,5 +31,5 @@ const TextInputControlType = "makeswift::controls::text-input";
|
|
|
14
31
|
function TextInput(config = {}) {
|
|
15
32
|
return { type: TextInputControlType, config };
|
|
16
33
|
}
|
|
17
|
-
export { CheckboxControlType as C, NumberControlType as N, TextAreaControlType as T, TextInputControlType as a, Checkbox as b,
|
|
34
|
+
export { CheckboxControlType as C, IconRadioGroupControlType as I, NumberControlType as N, SelectControlType as S, TextAreaControlType as T, TextInputControlType as a, Checkbox as b, unstable_IconRadioGroup as c, Number as d, Select as e, TextArea as f, TextInput as g, unstable_IconRadioGroupIcon as u };
|
|
18
35
|
//# sourceMappingURL=text-input.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.es.js","sources":["../src/controls/checkbox.ts","../src/controls/number.ts","../src/controls/text-area.ts","../src/controls/text-input.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, config }\n}\n","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;
|
|
1
|
+
{"version":3,"file":"text-input.es.js","sources":["../src/controls/checkbox.ts","../src/controls/icon-radio-group.ts","../src/controls/number.ts","../src/controls/select.ts","../src/controls/text-area.ts","../src/controls/text-input.ts"],"sourcesContent":["export type CheckboxControlData = boolean\n\nexport const CheckboxControlType = 'makeswift::controls::checkbox'\n\ntype CheckboxControlConfig = {\n label?: string\n defaultValue?: boolean\n}\n\nexport type CheckboxControlDefinition<C extends CheckboxControlConfig = CheckboxControlConfig> = {\n type: typeof CheckboxControlType\n config: C\n}\n\nexport function Checkbox<C extends CheckboxControlConfig>(\n config: C = {} as C,\n): CheckboxControlDefinition<C> {\n return { type: CheckboxControlType, config }\n}\n","export const unstable_IconRadioGroupIcon = {\n TextAlignCenter: 'TextAlignCenter',\n TextAlignJustify: 'TextAlignJustify',\n TextAlignLeft: 'TextAlignLeft',\n TextAlignRight: 'TextAlignRight',\n Superscript: 'Superscript16',\n Subscript: 'Subscript16',\n Code: 'Code16',\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\nexport type 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 type NumberControlData = number\n\nexport const NumberControlType = 'makeswift::controls::number'\n\ntype NumberControlConfig = {\n label?: string\n labelOrientation?: 'vertical' | 'horizontal'\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n suffix?: string\n}\n\nexport type NumberControlDefinition<C extends NumberControlConfig = NumberControlConfig> = {\n type: typeof NumberControlType\n config: C\n}\n\nexport function Number<C extends NumberControlConfig>(\n config: C = {} as C,\n): NumberControlDefinition<C> {\n return { type: NumberControlType, 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","export type TextAreaControlData = string\n\nexport const TextAreaControlType = 'makeswift::controls::text-area'\n\ntype TextAreaControlConfig = {\n label?: string\n defaultValue?: string\n rows?: number\n}\n\nexport type TextAreaControlDefinition<C extends TextAreaControlConfig = TextAreaControlConfig> = {\n type: typeof TextAreaControlType\n config: C\n}\n\nexport function TextArea<C extends TextAreaControlConfig>(\n config: C = {} as C,\n): TextAreaControlDefinition<C> {\n return { type: TextAreaControlType, config }\n}\n","export type TextInputControlData = string\n\nexport const TextInputControlType = 'makeswift::controls::text-input'\n\ntype TextInputControlConfig = {\n label?: string\n defaultValue?: string\n}\n\nexport type TextInputControlDefinition<C extends TextInputControlConfig = TextInputControlConfig> =\n {\n type: typeof TextInputControlType\n config: C\n }\n\nexport function TextInput<C extends TextInputControlConfig>(\n config: C = {} as C,\n): TextInputControlDefinition<C> {\n return { type: TextInputControlType, config }\n}\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsB;AAajC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;AClBO,MAAM,8BAA8B;AAAA,EACzC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AACR;AAKO,MAAM,4BAA4B;AA6BlC,iCACL,QACoC;AAC7B,SAAA,EAAE,MAAM,2BAA2B;AAC5C;AC5CO,MAAM,oBAAoB;AAkB/B,gBAAA,SAAY,IACgB;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACvBO,MAAM,oBAAoB;AAsB1B,gBACL,QAC4B;AACrB,SAAA,EAAE,MAAM,mBAAmB;AACpC;ACxBO,MAAM,sBAAsB;AAcjC,kBAAA,SAAY,IACkB;AACvB,SAAA,EAAE,MAAM,qBAAqB;AACtC;ACjBO,MAAM,uBAAuB;AAclC,mBAAA,SAAY,IACmB;AACxB,SAAA,EAAE,MAAM,sBAAsB;AACvC;;"}
|
|
@@ -3,10 +3,13 @@ export declare const unstable_IconRadioGroupIcon: {
|
|
|
3
3
|
readonly TextAlignJustify: "TextAlignJustify";
|
|
4
4
|
readonly TextAlignLeft: "TextAlignLeft";
|
|
5
5
|
readonly TextAlignRight: "TextAlignRight";
|
|
6
|
+
readonly Superscript: "Superscript16";
|
|
7
|
+
readonly Subscript: "Subscript16";
|
|
8
|
+
readonly Code: "Code16";
|
|
6
9
|
};
|
|
7
|
-
export type IconRadioGroupIcon =
|
|
10
|
+
export type IconRadioGroupIcon = typeof unstable_IconRadioGroupIcon[keyof typeof unstable_IconRadioGroupIcon];
|
|
8
11
|
export declare const IconRadioGroupControlType = "makeswift::controls::icon-radio-group";
|
|
9
|
-
type IconRadioGroupOption<T extends string> = {
|
|
12
|
+
export type IconRadioGroupOption<T extends string> = {
|
|
10
13
|
value: T;
|
|
11
14
|
icon: IconRadioGroupIcon;
|
|
12
15
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-radio-group.d.ts","sourceRoot":"","sources":["../../../../src/controls/icon-radio-group.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"icon-radio-group.d.ts","sourceRoot":"","sources":["../../../../src/controls/ic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@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Editor, NodeEntry, Text } from 'slate';
|
|
2
|
+
import { SupportedInline } from './types';
|
|
3
|
+
export declare function getSupportedInlinesAndTextInSelection(editor: Editor): NodeEntry<SupportedInline | Text>[];
|
|
4
|
+
export declare const getValue: (editor: Editor) => "code" | "superscript" | "subscript" | undefined;
|
|
5
|
+
//# sourceMappingURL=getValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getValue.d.ts","sourceRoot":"","sources":["../../../../../src/slate/InlinePlugin/getValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAK/C,OAAO,EAAE,eAAe,EAAiD,MAAM,SAAS,CAAA;AAExF,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,MAAM,GACb,SAAS,CAAC,eAAe,GAAG,IAAI,CAAC,EAAE,CAQrC;AAED,eAAO,MAAM,QAAQ,WAAY,MAAM,qDAatC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Editor } from 'slate';
|
|
3
|
+
import { RenderElement } from '../../controls';
|
|
4
|
+
import { RenderElementProps } from 'slate-react';
|
|
5
|
+
export declare const withInline: (editor: Editor) => import("../types").MakeswiftEditor;
|
|
6
|
+
export declare function InlinePlugin(): {
|
|
7
|
+
control: import("../../controls").RichTextV2PluginControlDefinition<import("../../controls").IconRadioGroupControlDefinition<{
|
|
8
|
+
label: string;
|
|
9
|
+
options: import("../../controls").IconRadioGroupOption<import("./types").SupportedInlineType>[];
|
|
10
|
+
}>> | undefined;
|
|
11
|
+
withPlugin: ((editor: import("../types").MakeswiftEditor) => import("../types").MakeswiftEditor) | undefined;
|
|
12
|
+
onKeyDown: ((event: import("react").KeyboardEvent<globalThis.Element>, editor: import("../types").MakeswiftEditor) => void) | undefined;
|
|
13
|
+
renderElement: ((renderElement: RenderElement, value: any) => (props: RenderElementProps) => JSX.Element) | undefined;
|
|
14
|
+
renderLeaf: ((renderLeaf: import("../../controls").RenderLeaf, value: any) => (props: import("slate-react").RenderLeafProps) => JSX.Element) | undefined;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/slate/InlinePlugin/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,aAAa,EAAmD,MAAM,gBAAgB,CAAA;AAG/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAKhD,eAAO,MAAM,UAAU,WAAY,MAAM,uCAQxC,CAAA;AAED,wBAAgB,YAAY;;;;;;;;;EAkB3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onChange.d.ts","sourceRoot":"","sources":["../../../../../src/slate/InlinePlugin/onChange.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAc,MAAM,OAAO,CAAA;AAM1C,OAAO,EACL,mBAAmB,EAIpB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,QAAQ,WAAY,MAAM,SAAS,mBAAmB,SA8BlE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Node, NodeEntry } from 'slate';
|
|
2
|
+
import { Inline, InlineType, LinkElement } from '../types';
|
|
3
|
+
import { IconRadioGroupOption } from '../../controls';
|
|
4
|
+
export type SupportedInlineType = Exclude<InlineType, 'link'>;
|
|
5
|
+
export type SupportedInline = Exclude<Inline, LinkElement>;
|
|
6
|
+
export declare const supportedInlineOptions: IconRadioGroupOption<SupportedInlineType>[];
|
|
7
|
+
export declare function isSupportedInlineType(inline: InlineType): inline is SupportedInlineType;
|
|
8
|
+
export declare function isSupportedInlineEntry(entry: NodeEntry<Node>): entry is NodeEntry<SupportedInline>;
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|