update type defs

This commit is contained in:
Evan Simkowitz 2024-08-14 19:43:25 -07:00
parent 15cd0b2477
commit 3c9b3423a9
No known key found for this signature in database
4 changed files with 30 additions and 21 deletions

View File

@ -18,10 +18,16 @@ import React, {
import { DropTargetMonitor, XYCoord, useDrag, useDragLayer, useDrop } from "react-dnd";
import { debounce, throttle } from "throttle-debounce";
import { useDevicePixelRatio } from "use-device-pixel-ratio";
import { LayoutModel, ResizeHandleProps } from "./layoutModel";
import { LayoutModel } from "./layoutModel";
import { useLayoutNode, useTileLayout } from "./layoutModelHooks";
import "./tilelayout.less";
import { LayoutNode, LayoutTreeActionType, LayoutTreeComputeMoveNodeAction, TileLayoutContents } from "./types";
import {
LayoutNode,
LayoutTreeActionType,
LayoutTreeComputeMoveNodeAction,
ResizeHandleProps,
TileLayoutContents,
} from "./types";
import { determineDropDirection } from "./utils";
export interface TileLayoutProps {

View File

@ -17,6 +17,7 @@ import {
import {
ContentRenderer,
LayoutNode,
LayoutNodeAdditionalProps,
LayoutTreeAction,
LayoutTreeActionType,
LayoutTreeComputeMoveNodeAction,
@ -30,27 +31,12 @@ import {
LayoutTreeState,
LayoutTreeSwapNodeAction,
PreviewRenderer,
ResizeHandleProps,
TileLayoutContents,
WritableLayoutTreeStateAtom,
} from "./types";
import { Dimensions, FlexDirection, setTransform } from "./utils";
export interface ResizeHandleProps {
id: string;
parentNodeId: string;
parentIndex: number;
centerPx: number;
transform: CSSProperties;
flexDirection: FlexDirection;
}
export interface LayoutNodeAdditionalProps {
transform?: CSSProperties;
rect?: Dimensions;
pixelToSizeRatio?: number;
resizeHandles?: ResizeHandleProps[];
}
interface ResizeContext {
handleId: string;
pixelToSizeRatio: number;

View File

@ -3,8 +3,8 @@ import useResizeObserver from "@react-hook/resize-observer";
import { atom, Atom, useAtomValue } from "jotai";
import { useEffect, useState } from "react";
import { withLayoutTreeStateAtomFromTab } from "./layoutAtom";
import { LayoutModel, LayoutNodeAdditionalProps } from "./layoutModel";
import { LayoutNode, TileLayoutContents } from "./types";
import { LayoutModel } from "./layoutModel";
import { LayoutNode, LayoutNodeAdditionalProps, TileLayoutContents } from "./types";
const layoutModelMap: Map<string, LayoutModel> = new Map();

View File

@ -2,7 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
import { WritableAtom } from "jotai";
import { DropDirection, FlexDirection } from "./utils.js";
import { CSSProperties } from "react";
import { Dimensions, DropDirection, FlexDirection } from "./utils.js";
/**
* Represents an operation to insert a node into a tree.
@ -258,3 +259,19 @@ export interface TileLayoutContents {
*/
tabId?: string;
}
export interface ResizeHandleProps {
id: string;
parentNodeId: string;
parentIndex: number;
centerPx: number;
transform: CSSProperties;
flexDirection: FlexDirection;
}
export interface LayoutNodeAdditionalProps {
transform?: CSSProperties;
rect?: Dimensions;
pixelToSizeRatio?: number;
resizeHandles?: ResizeHandleProps[];
}