@pushwoosh/dumb-components 4.12.0 → 4.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,6 +65,7 @@ export const DropdownMenu = ({
65
65
  rects
66
66
  }) {
67
67
  if (fullWidth) {
68
+ // eslint-disable-next-line react/dom-no-flush-sync -- floating-ui size() needs the width applied before it measures
68
69
  flushSync(() => setWidth(rects.reference.width));
69
70
  }
70
71
  }
@@ -25,6 +25,7 @@ export declare function findAllDc(value: SlateEditorContent): DynamicContentElem
25
25
  * @param value - The Slate editor content
26
26
  * @param elToFind - The element to find
27
27
  * @returns Array of indices representing the path to the element, empty if not found
28
+ * TODO: slate 0.146+ ships `Node.findPath(root, node)` (returns `undefined` when absent) — replace this walk with it.
28
29
  */
29
30
  export declare function findPath(value: SlateEditorContent, elToFind: Descendant): number[];
30
31
  export { parseDc, stringifyDc };
@@ -53,6 +53,7 @@ export function findAllDc(value) {
53
53
  * @param value - The Slate editor content
54
54
  * @param elToFind - The element to find
55
55
  * @returns Array of indices representing the path to the element, empty if not found
56
+ * TODO: slate 0.146+ ships `Node.findPath(root, node)` (returns `undefined` when absent) — replace this walk with it.
56
57
  */
57
58
  export function findPath(value, elToFind) {
58
59
  for (let i = 0; i < value.length; i++) {
@@ -11,9 +11,9 @@ export declare const EditableStyled: import("styled-components/dist/types").ISty
11
11
  renderText?: ((props: import("slate-react").RenderTextProps) => React.JSX.Element) | undefined;
12
12
  renderPlaceholder?: ((props: import("slate-react").RenderPlaceholderProps) => React.JSX.Element) | undefined;
13
13
  scrollSelectionIntoView?: ((editor: import("slate-react").ReactEditor, domRange: Range) => void) | undefined;
14
- as?: React.ElementType<any> | undefined;
14
+ as?: React.ElementType | undefined;
15
15
  disableDefaultStyles?: boolean | undefined;
16
- } & import("react").TextareaHTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>, "style"> & {
16
+ } & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>, "style"> & {
17
17
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
18
18
  }, {
19
19
  $isErrored?: boolean;
@@ -31,6 +31,6 @@ export declare const EditableStyled: import("styled-components/dist/types").ISty
31
31
  renderText?: ((props: import("slate-react").RenderTextProps) => React.JSX.Element) | undefined;
32
32
  renderPlaceholder?: ((props: import("slate-react").RenderPlaceholderProps) => React.JSX.Element) | undefined;
33
33
  scrollSelectionIntoView?: ((editor: import("slate-react").ReactEditor, domRange: Range) => void) | undefined;
34
- as?: React.ElementType<any> | undefined;
34
+ as?: React.ElementType | undefined;
35
35
  disableDefaultStyles?: boolean | undefined;
36
- } & import("react").TextareaHTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
36
+ } & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "4.12.0",
3
+ "version": "4.12.2",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -36,8 +36,8 @@
36
36
  "@codemirror/view": "^6.43.11",
37
37
  "@floating-ui/react-dom": "^2.1.2",
38
38
  "@lezer/highlight": "^1.2.1",
39
- "@pushwoosh/kit-constants": "^3.0.0",
40
- "@pushwoosh/kit-helpers": "^4.16.1",
39
+ "@pushwoosh/kit-constants": "^3.1.0",
40
+ "@pushwoosh/kit-helpers": "^4.16.2",
41
41
  "@pushwoosh/kit-icons": "^2.3.15",
42
42
  "@pushwoosh/kit-typography": "^2.0.0",
43
43
  "@tippyjs/react": "^4.2.6",
@@ -49,9 +49,10 @@
49
49
  "polished": "^4.3.1",
50
50
  "react-select": "^5.10.0",
51
51
  "react-transition-group": "^4.4.5",
52
- "slate": "^0.126.0",
53
- "slate-history": "^0.113.1",
54
- "slate-react": "^0.126.0",
52
+ "slate": "^0.147.4",
53
+ "slate-dom": "^0.147.3",
54
+ "slate-history": "^0.144.0",
55
+ "slate-react": "^0.147.5",
55
56
  "tippy.js": "^6.3.7"
56
57
  },
57
58
  "peerDependencies": {
@@ -255,13 +255,11 @@ function parseTokens(tokensArg) {
255
255
  Control: () => {
256
256
  const controlNodeName = token.value;
257
257
  const chidrens = [[], []];
258
- let args = '';
259
258
  currentTokenIndex++;
260
- if (tokens[currentTokenIndex] && tokens[currentTokenIndex].type === 'ControlArg') {
261
- args = tokens[currentTokenIndex].value;
262
- } else {
259
+ if (!tokens[currentTokenIndex] || tokens[currentTokenIndex].type !== 'ControlArg') {
263
260
  throw new Error(`Syntax error: expected argument for ${controlNodeName} at line ${token.lineNo}`);
264
261
  }
262
+ const args = tokens[currentTokenIndex].value;
265
263
  currentTokenIndex++;
266
264
  if (pairedControlTokens[controlNodeName]) {
267
265
  const controlChildren = parseUntil(tokens, 'ControlEnd');
@@ -1,4 +1,3 @@
1
- import { createElement as _createElement } from "react";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import styled from 'styled-components';
4
3
  import { Color } from '@pushwoosh/kit-constants';
@@ -104,7 +103,7 @@ const Txt = styled.span.withConfig({
104
103
  export function renderToReact(ast, context) {
105
104
  return renderNodesToArray(ast, context, (tagNode, children, key) => {
106
105
  const TagName = tagNode.name;
107
- const props = Object.fromEntries(Object.entries(tagNode.params).map(([key, value]) => [key, unpackScalarOrValue(value, context)]));
106
+ const props = Object.fromEntries(Object.entries(tagNode.params).filter(([name]) => name !== 'key').map(([name, value]) => [name, unpackScalarOrValue(value, context)]));
108
107
  if (TagName === 'text') {
109
108
  return [_jsx(Txt, {
110
109
  "$variant": props.variant,
@@ -115,14 +114,13 @@ export function renderToReact(ast, context) {
115
114
  }, key)];
116
115
  }
117
116
  if (voidTags.has(TagName)) {
118
- return [_createElement(TagName, {
119
- ...props,
120
- key: key
121
- })];
117
+ return [_jsx(TagName, {
118
+ ...props
119
+ }, key)];
122
120
  }
123
- return [_createElement(TagName, {
121
+ return [_jsx(TagName, {
124
122
  ...props,
125
- key: key
126
- }, children)];
123
+ children: children
124
+ }, key)];
127
125
  });
128
126
  }