| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | export const TYPES = { |
| 9 | CLIPPING_RECTANGLE: 'ClippingRectangle', |
| 10 | GROUP: 'Group', |
| 11 | SHAPE: 'Shape', |
| 12 | TEXT: 'Text', |
| 13 | }; |
| 14 | |
| 15 | export const EVENT_TYPES = { |
| 16 | onClick: 'click', |
| 17 | onMouseMove: 'mousemove', |
| 18 | onMouseOver: 'mouseover', |
| 19 | onMouseOut: 'mouseout', |
| 20 | onMouseUp: 'mouseup', |
| 21 | onMouseDown: 'mousedown', |
| 22 | }; |
| 23 | |
| 24 | export function childrenAsString(children) { |
| 25 | if (!children) { |
| 26 | return ''; |
| 27 | } else if (typeof children === 'string') { |
| 28 | return children; |
| 29 | } else if (children.length) { |
| 30 | return children.join(''); |
| 31 | } else { |
| 32 | return ''; |
| 33 | } |
| 34 | } |