chore(react/svelte): rename node.dimensions to node.size

This commit is contained in:
moklick
2023-10-09 17:04:11 +02:00
parent d78b2aad6f
commit afa6365e12
8 changed files with 31 additions and 28 deletions
+5 -2
View File
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { internalsSymbol } from '../constants';
import type { XYPosition, Position, CoordinateExtent, HandleElement, Dimensions } from '.';
import type { XYPosition, Position, CoordinateExtent, HandleElement } from '.';
// this is stuff that all nodes share independent of the framework
export type NodeBase<T = any, U extends string | undefined = string | undefined> = {
@@ -29,7 +29,10 @@ export type NodeBase<T = any, U extends string | undefined = string | undefined>
focusable?: boolean;
origin?: NodeOrigin;
handles?: HandleElement[];
dimensions?: Dimensions;
size?: {
width?: number;
height?: number;
};
// only used internally
[internalsSymbol]?: {
+2 -2
View File
@@ -85,8 +85,8 @@ function toHandleBounds(handles?: HandleElement[]) {
function getHandleDataByNode(node?: NodeBase): [Rect, NodeHandleBounds | null, boolean] {
const handleBounds = node?.[internalsSymbol]?.handleBounds || toHandleBounds(node?.handles) || null;
const nodeWidth = node?.width || node?.dimensions?.width;
const nodeHeight = node?.height || node?.dimensions?.height;
const nodeWidth = node?.width || node?.size?.width;
const nodeHeight = node?.height || node?.size?.height;
const isValid =
handleBounds &&