@makeswift/runtime 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/Box.cjs.js +1 -3
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +2 -4
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +1 -3
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +2 -4
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +1 -3
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +2 -4
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +1 -3
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +2 -4
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +1 -3
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +2 -4
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.es.js +1 -1
  22. package/dist/Form.cjs.js +1 -3
  23. package/dist/Form.cjs.js.map +1 -1
  24. package/dist/Form.es.js +2 -4
  25. package/dist/Form.es.js.map +1 -1
  26. package/dist/Image.cjs.js +1 -3
  27. package/dist/Image.cjs.js.map +1 -1
  28. package/dist/Image.es.js +2 -4
  29. package/dist/Image.es.js.map +1 -1
  30. package/dist/LiveProvider.cjs.js +1 -3
  31. package/dist/LiveProvider.cjs.js.map +1 -1
  32. package/dist/LiveProvider.es.js +2 -4
  33. package/dist/LiveProvider.es.js.map +1 -1
  34. package/dist/Navigation.cjs.js +1 -3
  35. package/dist/Navigation.cjs.js.map +1 -1
  36. package/dist/Navigation.es.js +2 -4
  37. package/dist/Navigation.es.js.map +1 -1
  38. package/dist/PreviewProvider.cjs.js +3 -5
  39. package/dist/PreviewProvider.cjs.js.map +1 -1
  40. package/dist/PreviewProvider.es.js +3 -5
  41. package/dist/PreviewProvider.es.js.map +1 -1
  42. package/dist/ReadOnlyText.cjs.js +4 -7
  43. package/dist/ReadOnlyText.cjs.js.map +1 -1
  44. package/dist/ReadOnlyText.es.js +4 -7
  45. package/dist/ReadOnlyText.es.js.map +1 -1
  46. package/dist/ReadOnlyTextV2.cjs.js +11 -14
  47. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  48. package/dist/ReadOnlyTextV2.es.js +10 -13
  49. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  50. package/dist/Root.cjs.js +1 -3
  51. package/dist/Root.cjs.js.map +1 -1
  52. package/dist/Root.es.js +2 -4
  53. package/dist/Root.es.js.map +1 -1
  54. package/dist/SocialLinks.cjs.js +1 -3
  55. package/dist/SocialLinks.cjs.js.map +1 -1
  56. package/dist/SocialLinks.es.js +2 -4
  57. package/dist/SocialLinks.es.js.map +1 -1
  58. package/dist/Text.cjs.js +2 -4
  59. package/dist/Text.cjs.js.map +1 -1
  60. package/dist/Text.es.js +2 -4
  61. package/dist/Text.es.js.map +1 -1
  62. package/dist/Video.es.js +1 -1
  63. package/dist/components.cjs.js +1 -3
  64. package/dist/components.cjs.js.map +1 -1
  65. package/dist/components.es.js +1 -3
  66. package/dist/components.es.js.map +1 -1
  67. package/dist/control-serialization.es.js +1 -1
  68. package/dist/controls.cjs.js +18 -15
  69. package/dist/controls.cjs.js.map +1 -1
  70. package/dist/controls.es.js +2 -3
  71. package/dist/controls.es.js.map +1 -1
  72. package/dist/index.cjs.js +205 -57
  73. package/dist/index.cjs.js.map +1 -1
  74. package/dist/index.cjs10.js +261 -172
  75. package/dist/index.cjs10.js.map +1 -1
  76. package/dist/index.cjs5.js +99 -5
  77. package/dist/index.cjs5.js.map +1 -1
  78. package/dist/index.cjs6.js +23 -700
  79. package/dist/index.cjs6.js.map +1 -1
  80. package/dist/index.cjs7.js +13 -37
  81. package/dist/index.cjs7.js.map +1 -1
  82. package/dist/index.cjs8.js +39 -17
  83. package/dist/index.cjs8.js.map +1 -1
  84. package/dist/index.cjs9.js +269 -16
  85. package/dist/index.cjs9.js.map +1 -1
  86. package/dist/index.es.js +187 -41
  87. package/dist/index.es.js.map +1 -1
  88. package/dist/index.es10.js +262 -173
  89. package/dist/index.es10.js.map +1 -1
  90. package/dist/index.es2.js +1 -1
  91. package/dist/index.es4.js +1 -1
  92. package/dist/index.es5.js +91 -2
  93. package/dist/index.es5.js.map +1 -1
  94. package/dist/index.es6.js +23 -695
  95. package/dist/index.es6.js.map +1 -1
  96. package/dist/index.es7.js +14 -33
  97. package/dist/index.es7.js.map +1 -1
  98. package/dist/index.es8.js +37 -17
  99. package/dist/index.es8.js.map +1 -1
  100. package/dist/index.es9.js +264 -15
  101. package/dist/index.es9.js.map +1 -1
  102. package/dist/next.cjs.js +1 -3
  103. package/dist/next.cjs.js.map +1 -1
  104. package/dist/next.es.js +2 -4
  105. package/dist/next.es.js.map +1 -1
  106. package/dist/react-page.cjs.js +97 -9
  107. package/dist/react-page.cjs.js.map +1 -1
  108. package/dist/react-page.es.js +95 -9
  109. package/dist/react-page.es.js.map +1 -1
  110. package/dist/react.cjs.js +1 -3
  111. package/dist/react.cjs.js.map +1 -1
  112. package/dist/react.es.js +1 -3
  113. package/dist/react.es.js.map +1 -1
  114. package/dist/slate.cjs.js +260 -97
  115. package/dist/slate.cjs.js.map +1 -1
  116. package/dist/slate.es.js +249 -92
  117. package/dist/slate.es.js.map +1 -1
  118. package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
  119. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  120. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  121. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +0 -17
  122. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
  123. package/dist/types/src/controls/control.d.ts +3 -2
  124. package/dist/types/src/controls/control.d.ts.map +1 -1
  125. package/dist/types/src/controls/icon-radio-group.d.ts +5 -2
  126. package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -1
  127. package/dist/types/src/controls/index.d.ts +1 -0
  128. package/dist/types/src/controls/index.d.ts.map +1 -1
  129. package/dist/types/src/controls/list.d.ts +2 -0
  130. package/dist/types/src/controls/list.d.ts.map +1 -1
  131. package/dist/types/src/controls/shape.d.ts +2 -0
  132. package/dist/types/src/controls/shape.d.ts.map +1 -1
  133. package/dist/types/src/controls/style-v2.d.ts.map +1 -1
  134. package/dist/types/src/controls/typography.d.ts +31 -0
  135. package/dist/types/src/controls/typography.d.ts.map +1 -0
  136. package/dist/types/src/next/client.d.ts.map +1 -1
  137. package/dist/types/src/prop-controllers/descriptors.d.ts +6 -3
  138. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  139. package/dist/types/src/prop-controllers/introspection.d.ts +1 -1
  140. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  141. package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
  142. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  143. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  144. package/dist/types/src/runtimes/react/controls/typography.d.ts +21 -0
  145. package/dist/types/src/runtimes/react/controls/typography.d.ts.map +1 -0
  146. package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
  147. package/dist/types/src/slate/InlinePlugin/getValue.d.ts +5 -0
  148. package/dist/types/src/slate/InlinePlugin/getValue.d.ts.map +1 -0
  149. package/dist/types/src/slate/InlinePlugin/index.d.ts +16 -0
  150. package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -0
  151. package/dist/types/src/slate/InlinePlugin/onChange.d.ts +4 -0
  152. package/dist/types/src/slate/InlinePlugin/onChange.d.ts.map +1 -0
  153. package/dist/types/src/slate/InlinePlugin/types.d.ts +9 -0
  154. package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -0
  155. package/dist/types/src/slate/LinkPlugin/getValue.d.ts +5 -0
  156. package/dist/types/src/slate/LinkPlugin/getValue.d.ts.map +1 -0
  157. package/dist/types/src/slate/LinkPlugin/index.d.ts +15 -0
  158. package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -0
  159. package/dist/types/src/slate/LinkPlugin/onChange.d.ts +4 -0
  160. package/dist/types/src/slate/LinkPlugin/onChange.d.ts.map +1 -0
  161. package/dist/types/src/slate/LinkPlugin/types.d.ts +5 -0
  162. package/dist/types/src/slate/LinkPlugin/types.d.ts.map +1 -0
  163. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +2 -0
  164. package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
  165. package/dist/types/src/slate/TypographyPlugin/index.d.ts +9 -0
  166. package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
  167. package/dist/types/src/slate/index.d.ts +2 -0
  168. package/dist/types/src/slate/index.d.ts.map +1 -1
  169. package/dist/types.cjs2.js +753 -0
  170. package/dist/types.cjs2.js.map +1 -0
  171. package/dist/types.es2.js +736 -0
  172. package/dist/types.es2.js.map +1 -0
  173. package/dist/typography.cjs.js +56 -0
  174. package/dist/typography.cjs.js.map +1 -0
  175. package/dist/typography.es.js +41 -0
  176. package/dist/typography.es.js.map +1 -0
  177. package/package.json +1 -1
  178. package/dist/deepEqual.cjs.js +0 -40
  179. package/dist/deepEqual.cjs.js.map +0 -1
  180. package/dist/deepEqual.es.js +0 -39
  181. package/dist/deepEqual.es.js.map +0 -1
  182. package/dist/index.cjs11.js +0 -375
  183. package/dist/index.cjs11.js.map +0 -1
  184. package/dist/index.es11.js +0 -368
  185. package/dist/index.es11.js.map +0 -1
  186. package/dist/leaf.cjs.js +0 -182
  187. package/dist/leaf.cjs.js.map +0 -1
  188. package/dist/leaf.es.js +0 -179
  189. package/dist/leaf.es.js.map +0 -1
  190. package/dist/select.cjs.js +0 -21
  191. package/dist/select.cjs.js.map +0 -1
  192. package/dist/select.es.js +0 -16
  193. package/dist/select.es.js.map +0 -1
  194. package/dist/text-input.cjs.js +0 -26
  195. package/dist/text-input.cjs.js.map +0 -1
  196. package/dist/text-input.es.js +0 -18
  197. package/dist/text-input.es.js.map +0 -1
package/dist/react.cjs.js CHANGED
@@ -14,12 +14,10 @@ require("@emotion/serialize");
14
14
  require("@emotion/utils");
15
15
  require("slate");
16
16
  require("react/jsx-runtime");
17
- require("./text-input.cjs.js");
17
+ require("./typography.cjs.js");
18
18
  require("./combobox.cjs.js");
19
- require("./select.cjs.js");
20
19
  require("use-sync-external-store/shim");
21
20
  require("./types.cjs.js");
22
- require("./deepEqual.cjs.js");
23
21
  require("./box-models.cjs.js");
24
22
  require("css-box-model");
25
23
  require("color");
@@ -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
@@ -12,12 +12,10 @@ import "@emotion/serialize";
12
12
  import "@emotion/utils";
13
13
  import "slate";
14
14
  import "react/jsx-runtime";
15
- import "./text-input.es.js";
15
+ import "./typography.es.js";
16
16
  import "./combobox.es.js";
17
- import "./select.es.js";
18
17
  import "use-sync-external-store/shim";
19
18
  import "./types.es.js";
20
- import "./deepEqual.es.js";
21
19
  import "./box-models.es.js";
22
20
  import "css-box-model";
23
21
  import "color";
@@ -1 +1 @@
1
- {"version":3,"file":"react.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"react.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/slate.cjs.js CHANGED
@@ -20,100 +20,84 @@ 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 types = require("./types.cjs2.js");
23
24
  var index$1 = require("./index.cjs6.js");
24
25
  var index$2 = require("./index.cjs7.js");
25
- var index$3 = require("./index.cjs8.js");
26
26
  var reactPage = require("./react-page.cjs.js");
27
- var select = require("./select.cjs.js");
27
+ var typography = require("./typography.cjs.js");
28
28
  var slate = require("slate");
29
- var deepEqual = require("./deepEqual.cjs.js");
29
+ require("react");
30
+ var css = require("@emotion/css");
31
+ require("@emotion/serialize");
32
+ require("@emotion/utils");
33
+ var next = require("./index.cjs.js");
34
+ var jsxRuntime = require("react/jsx-runtime");
35
+ var index$3 = require("./index.cjs3.js");
30
36
  require("./state/breakpoints.cjs.js");
31
37
  require("./actions.cjs.js");
32
38
  require("is-hotkey");
33
- require("@emotion/css");
34
- require("react/jsx-runtime");
35
39
  require("slate-react");
36
40
  require("redux");
37
41
  require("redux-thunk");
38
- require("react");
39
- require("@emotion/serialize");
40
- require("@emotion/utils");
41
- function setResponsiveValue(editor, key, value, options) {
42
- slate.Editor.withoutNormalizing(editor, () => {
43
- const at = index$1.getSelection(editor);
44
- if (!at)
42
+ require("use-sync-external-store/shim/with-selector");
43
+ require("next/dynamic");
44
+ require("./combobox.cjs.js");
45
+ require("use-sync-external-store/shim");
46
+ require("./types.cjs.js");
47
+ require("./box-models.cjs.js");
48
+ require("css-box-model");
49
+ require("color");
50
+ require("scroll-into-view-if-needed");
51
+ require("react-dom");
52
+ require("html-react-parser");
53
+ require("next/head");
54
+ require("zod");
55
+ require("@emotion/server/create-instance");
56
+ require("next/document");
57
+ require("cors");
58
+ require("path-to-regexp");
59
+ require("cookie");
60
+ require("http-proxy");
61
+ require("set-cookie-parser");
62
+ require("./constants.cjs.js");
63
+ require("uuid");
64
+ require("corporate-ipsum");
65
+ require("next/link");
66
+ const TEXT_ALIGN_KEY = "textAlign";
67
+ const withTextAlign = (editor) => {
68
+ const {
69
+ normalizeNode
70
+ } = editor;
71
+ editor.normalizeNode = (entry) => {
72
+ if (index.normalizeResponsiveValue(editor, TEXT_ALIGN_KEY, {
73
+ match: types.ElementUtils.isRootBlock
74
+ })(entry)) {
45
75
  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
76
  }
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;
77
+ normalizeNode(entry);
94
78
  };
95
- }
96
- const TEXT_ALIGN_KEY = "textAlign";
79
+ return editor;
80
+ };
97
81
  function TextAlignPlugin() {
98
82
  return reactPage.createRichTextV2Plugin({
99
83
  control: {
100
84
  definition: reactPage.unstable_StyleV2({
101
- type: select.unstable_IconRadioGroup({
85
+ type: typography.unstable_IconRadioGroup({
102
86
  label: "Alignment",
103
87
  options: [{
104
- icon: select.unstable_IconRadioGroupIcon.TextAlignLeft,
88
+ icon: typography.unstable_IconRadioGroupIcon.TextAlignLeft,
105
89
  label: "Left Align",
106
90
  value: "left"
107
91
  }, {
108
- icon: select.unstable_IconRadioGroupIcon.TextAlignCenter,
92
+ icon: typography.unstable_IconRadioGroupIcon.TextAlignCenter,
109
93
  label: "Center Align",
110
94
  value: "center"
111
95
  }, {
112
- icon: select.unstable_IconRadioGroupIcon.TextAlignRight,
96
+ icon: typography.unstable_IconRadioGroupIcon.TextAlignRight,
113
97
  label: "Right Align",
114
98
  value: "right"
115
99
  }, {
116
- icon: select.unstable_IconRadioGroupIcon.TextAlignJustify,
100
+ icon: typography.unstable_IconRadioGroupIcon.TextAlignJustify,
117
101
  label: "Justify",
118
102
  value: "justify"
119
103
  }],
@@ -125,31 +109,18 @@ function TextAlignPlugin() {
125
109
  };
126
110
  }
127
111
  }),
128
- onChange: (editor, value) => setResponsiveValue(editor, TEXT_ALIGN_KEY, value, {
129
- match: index$1.ElementUtils.isRootBlock,
112
+ onChange: (editor, value) => index.setResponsiveValue(editor, TEXT_ALIGN_KEY, value, {
113
+ match: types.ElementUtils.isRootBlock,
130
114
  split: false
131
115
  }),
132
- getValue: (editor) => getResponsiveValue(editor, TEXT_ALIGN_KEY, {
133
- match: index$1.ElementUtils.isRootBlock
116
+ getValue: (editor) => index.getResponsiveValue(editor, TEXT_ALIGN_KEY, {
117
+ match: types.ElementUtils.isRootBlock
134
118
  }),
135
119
  getElementValue: (element) => {
136
- return index$1.ElementUtils.isRootBlock(element) ? element.textAlign : void 0;
120
+ return types.ElementUtils.isRootBlock(element) ? element.textAlign : void 0;
137
121
  }
138
122
  },
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
- },
123
+ withPlugin: withTextAlign,
153
124
  renderElement: (renderElement, className) => (props) => {
154
125
  return renderElement(__spreadProps(__spreadValues({}, props), {
155
126
  element: __spreadProps(__spreadValues({}, props.element), {
@@ -174,12 +145,12 @@ function ColorPlugin() {
174
145
  }
175
146
  }),
176
147
  onChange: (editor, value) => {
177
- setResponsiveValue(editor, COLOR_KEY, value, {
148
+ index.setResponsiveValue(editor, COLOR_KEY, value, {
178
149
  match: slate.Text.isText,
179
150
  split: true
180
151
  });
181
152
  },
182
- getValue: (editor) => getResponsiveValue(editor, COLOR_KEY, {
153
+ getValue: (editor) => index.getResponsiveValue(editor, COLOR_KEY, {
183
154
  match: slate.Text.isText
184
155
  }),
185
156
  getLeafValue: (text) => {
@@ -191,7 +162,7 @@ function ColorPlugin() {
191
162
  normalizeNode
192
163
  } = editor;
193
164
  editor.normalizeNode = (entry) => {
194
- if (normalizeResponsiveValue(editor, COLOR_KEY, {
165
+ if (index.normalizeResponsiveValue(editor, COLOR_KEY, {
195
166
  match: slate.Text.isText
196
167
  })(entry)) {
197
168
  return;
@@ -203,27 +174,219 @@ function ColorPlugin() {
203
174
  renderLeaf: (renderLeaf, className) => (props) => {
204
175
  return renderLeaf(__spreadProps(__spreadValues({}, props), {
205
176
  leaf: __spreadProps(__spreadValues({}, props.leaf), {
206
- className
177
+ className: `${props.leaf.className} ${className}`
207
178
  })
208
179
  }));
209
180
  }
210
181
  });
211
182
  }
183
+ function getSupportedInlinesAndTextInSelection(editor) {
184
+ return Array.from(slate.Editor.nodes(editor, {
185
+ at: types.getSelection(editor),
186
+ match: (node) => types.ElementUtils.isInline(node) && types.isSupportedInlineType(node.type) || slate.Text.isText(node)
187
+ }));
188
+ }
189
+ const getValue$1 = (editor) => {
190
+ var _a;
191
+ const roots = types.filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
192
+ const areAllRootsSupportedInlineTypesOrText = roots.every((entry) => types.isSupportedInlineEntry(entry) || slate.Text.isText(entry[0]));
193
+ if (!areAllRootsSupportedInlineTypesOrText)
194
+ return void 0;
195
+ const matchingValues = roots.filter(types.isSupportedInlineEntry).map(([node]) => node);
196
+ return (_a = matchingValues.reduce((a, b) => next.deepEqual(a, b) ? b : void 0, matchingValues.at(0))) == null ? void 0 : _a.type;
197
+ };
198
+ const onChange$1 = (editor, value) => {
199
+ function unwrapAllSupportedTypes() {
200
+ types.supportedInlineOptions.forEach(({ value: optionValue }) => types.unwrapInline(editor, optionValue));
201
+ }
202
+ function unwrapAllInlines() {
203
+ slate.Transforms.unwrapNodes(editor, {
204
+ match: (node) => types.ElementUtils.isInline(node),
205
+ at: types.getSelection(editor)
206
+ });
207
+ }
208
+ if (value == null)
209
+ return unwrapAllSupportedTypes();
210
+ if (!types.isSupportedInlineType(value))
211
+ return;
212
+ const roots = types.filterForSubtreeRoots(getSupportedInlinesAndTextInSelection(editor));
213
+ const root = roots.at(0);
214
+ if (roots.length === 1 && root != null && types.isSupportedInlineEntry(root) && root[0].type === value) {
215
+ types.unwrapInline(editor, value);
216
+ } else {
217
+ unwrapAllInlines();
218
+ types.wrapInline(editor, { type: value, children: [] });
219
+ }
220
+ };
221
+ const withInline = (editor) => {
222
+ const {
223
+ isInline
224
+ } = editor;
225
+ editor.isInline = (entry) => {
226
+ return types.ElementUtils.isInline(entry) && isInline(entry);
227
+ };
228
+ return editor;
229
+ };
230
+ function InlinePlugin() {
231
+ return reactPage.createRichTextV2Plugin({
232
+ control: {
233
+ definition: typography.unstable_IconRadioGroup({
234
+ label: "Inline",
235
+ options: types.supportedInlineOptions
236
+ }),
237
+ onChange: onChange$1,
238
+ getValue: getValue$1,
239
+ getElementValue: (element) => {
240
+ return types.ElementUtils.isInline(element) ? element.type : void 0;
241
+ }
242
+ },
243
+ withPlugin: withInline,
244
+ renderElement: (renderElement) => (props) => {
245
+ return /* @__PURE__ */ jsxRuntime.jsx(InlinePluginComponent$1, __spreadProps(__spreadValues({}, props), {
246
+ renderElement
247
+ }));
248
+ }
249
+ });
250
+ }
251
+ function InlinePluginComponent$1({
252
+ element,
253
+ attributes,
254
+ children,
255
+ renderElement
256
+ }) {
257
+ switch (element.type) {
258
+ case reactPage.InlineType.Code:
259
+ return /* @__PURE__ */ jsxRuntime.jsx("code", __spreadProps(__spreadValues({}, attributes), {
260
+ children
261
+ }));
262
+ case reactPage.InlineType.SuperScript:
263
+ return /* @__PURE__ */ jsxRuntime.jsx("sup", __spreadProps(__spreadValues({}, attributes), {
264
+ children
265
+ }));
266
+ case reactPage.InlineType.SubScript:
267
+ return /* @__PURE__ */ jsxRuntime.jsx("sub", __spreadProps(__spreadValues({}, attributes), {
268
+ children
269
+ }));
270
+ default:
271
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
272
+ children: renderElement({
273
+ element,
274
+ attributes,
275
+ children
276
+ })
277
+ });
278
+ }
279
+ }
280
+ function isLinkElement(node) {
281
+ return types.ElementUtils.isInline(node) && node.type === reactPage.InlineType.Link;
282
+ }
283
+ function isLinkEntry(inline) {
284
+ return types.ElementUtils.isInline(inline[0]) && inline[0].type === reactPage.InlineType.Link;
285
+ }
286
+ function getLinksAndTextInSelection(editor) {
287
+ return Array.from(slate.Editor.nodes(editor, {
288
+ at: types.getSelection(editor),
289
+ match: (node) => types.ElementUtils.isInline(node) && isLinkElement(node) || slate.Text.isText(node)
290
+ }));
291
+ }
292
+ const getValue = (editor) => {
293
+ var _a;
294
+ const roots = types.filterForSubtreeRoots(getLinksAndTextInSelection(editor));
295
+ const areAllRootsLinks = roots.every(([root]) => isLinkElement(root) || slate.Text.isText(root));
296
+ if (!areAllRootsLinks)
297
+ return void 0;
298
+ const matchingValues = roots.map(([node]) => node).filter(isLinkElement);
299
+ return (_a = matchingValues.reduce((a, b) => next.deepEqual(a, b) ? b : void 0, matchingValues.at(0))) == null ? void 0 : _a.link;
300
+ };
301
+ const onChange = (editor, value) => {
302
+ if (value == null)
303
+ return types.unwrapInline(editor, reactPage.InlineType.Link);
304
+ const roots = types.filterForSubtreeRoots(getLinksAndTextInSelection(editor));
305
+ const root = roots.at(0);
306
+ if (roots.length === 1 && root != null && isLinkEntry(root)) {
307
+ slate.Transforms.setNodes(editor, {
308
+ link: value
309
+ }, { at: root[1] });
310
+ } else {
311
+ types.unwrapInline(editor, reactPage.InlineType.Link);
312
+ types.wrapInline(editor, { type: reactPage.InlineType.Link, link: value, children: [] });
313
+ }
314
+ };
315
+ const withLink = (editor) => {
316
+ const {
317
+ isInline
318
+ } = editor;
319
+ editor.isInline = (entry) => {
320
+ return types.ElementUtils.isInline(entry) && isInline(entry);
321
+ };
322
+ return editor;
323
+ };
324
+ function InlinePluginComponent({
325
+ element,
326
+ attributes,
327
+ children,
328
+ renderElement
329
+ }) {
330
+ const linkStyle = reactPage.useStyle({
331
+ textDecoration: "none"
332
+ });
333
+ switch (element.type) {
334
+ case reactPage.InlineType.Link:
335
+ return /* @__PURE__ */ jsxRuntime.jsx(index$3.Link, __spreadProps(__spreadValues({}, attributes), {
336
+ link: element.link,
337
+ className: css.cx(linkStyle, element.className),
338
+ children
339
+ }));
340
+ default:
341
+ return renderElement({
342
+ element,
343
+ attributes,
344
+ children
345
+ });
346
+ }
347
+ }
348
+ function LinkPlugin() {
349
+ return reactPage.createRichTextV2Plugin({
350
+ control: {
351
+ definition: reactPage.Link$1({
352
+ label: "On Click"
353
+ }),
354
+ onChange,
355
+ getValue,
356
+ getElementValue: (element) => {
357
+ return types.ElementUtils.isInline(element) && isLinkElement(element) ? element.link : void 0;
358
+ }
359
+ },
360
+ withPlugin: withLink,
361
+ renderElement: (renderElement) => (props) => {
362
+ return /* @__PURE__ */ jsxRuntime.jsx(InlinePluginComponent, __spreadProps(__spreadValues({}, props), {
363
+ renderElement
364
+ }));
365
+ }
366
+ });
367
+ }
368
+ exports.TYPOGRAPHY_KEY = index.TYPOGRAPHY_KEY;
212
369
  exports.TypographyActions = index.TypographyActions;
370
+ exports.TypographyPlugin = index.TypographyPlugin;
213
371
  exports.withTypography = index.withTypography;
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;
372
+ exports.BlockActions = types.BlockActions;
373
+ exports.BlockPlugin = types.BlockPlugin;
374
+ exports.ListActions = types.ListActions;
375
+ exports.onKeyDown = types.onKeyDown;
376
+ exports.withBlock = types.withBlock;
377
+ exports.InlineModePlugin = index$1.InlineModePlugin;
378
+ exports.withInlineMode = index$1.withInlineMode;
379
+ exports.withBuilder = index$2.withBuilder;
222
380
  exports.BlockTextAlignment = reactPage.BlockTextAlignment;
223
381
  exports.BlockType = reactPage.BlockType;
224
382
  exports.InlineType = reactPage.InlineType;
225
383
  exports.RootBlockType = reactPage.RootBlockType;
226
384
  exports.COLOR_KEY = COLOR_KEY;
227
385
  exports.ColorPlugin = ColorPlugin;
386
+ exports.InlinePlugin = InlinePlugin;
387
+ exports.LinkPlugin = LinkPlugin;
228
388
  exports.TextAlignPlugin = TextAlignPlugin;
389
+ exports.withInline = withInline;
390
+ exports.withLink = withLink;
391
+ exports.withTextAlign = withTextAlign;
229
392
  //# sourceMappingURL=slate.cjs.js.map
@@ -1 +1 @@
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,4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,MAVb;AAAA,MAePC,UAAUN,CAAAA,WAAUO,mBAAmBP,QAAQkB,WAAW;AAAA,QAAEhB,OAAOmB,MAAKC,KAAAA;AAAAA,MAAAA,CAAlC;AAAA,MACtCC,cAAc,CAACC,SAAe;AACrBH,eAAAA,MAAAA,KAAKC,OAAOE,IAAZ,IAAoBA,6BAAMJ,QAAQV;AAAAA,MAC1C;AAAA,IAnByB;AAAA,IAqB5BC,YAAY,CAACX,WAAmB;AACxB,YAAA;AAAA,QAAEY;AAAAA,UAAkBZ;AAC1BA,aAAOY,gBAAgBC,CAAS,UAAA;AAC1BC,YAAAA,yBAAyBd,QAAQkB,WAAW;AAAA,UAAEhB,OAAOmB,MAAKC,KAAAA;AAAAA,QAAAA,CAAlC,EAA4CT,KAApE,GAA4E;AAC9E;AAAA,QACD;AAEDD,sBAAcC,KAAD;AAAA,MAAA;AAGRb,aAAAA;AAAAA,IA/BmB;AAAA,IAiC5ByB,YAAY,CAACA,YAAYT,cAAcC,CAAS,UAAA;AAC9C,aAAOQ,WAAW,iCACbR,QADa;AAAA,QAEhBS,MAAM,iCACDT,MAAMS,OADL;AAAA,UAEJV;AAAAA,QAFI;AAAA,MAAA,EAFS;AAAA,IAOlB;AAAA,EAAA,CAzC0B;AA2C9B;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"slate.cjs.js","sources":["../src/slate/TextAlignPlugin/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, 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: `${props.leaf.className} ${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","Editor","getSelection","isSupportedInlineType","filterForSubtreeRoots","isSupportedInlineEntry","deepEqual","supportedInlineOptions","unwrapInline","Transforms","wrapInline","withInline","isInline","InlinePluginComponent","attributes","children","InlineType","Code","SuperScript","SubScript","_Fragment","withLink","linkStyle","useStyle","textDecoration","Link","LinkComponent","link","cx","isLinkElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAMA,iBAAiB;AAEVC,MAAAA,gBAAgB,CAACC,WAAmB;AACzC,QAAA;AAAA,IAAEC;AAAAA,MAAkBD;AAC1BA,SAAOC,gBAAgBC,CAAS,UAAA;AAE5BC,QAAAA,MAAAA,yBAAyBH,QAAQF,gBAAgB;AAAA,MAAEM,OAAOC,MAAaC,aAAAA;AAAAA,IAAAA,CAA/C,EAA8DJ,KAAtF,GACA;AACA;AAAA,IACD;AACDD,kBAAcC,KAAD;AAAA,EAAA;AAGRF,SAAAA;AACR;AAEiC,2BAAA;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