From 87a6bb23e4026bbd9607dba3926d45bd3e554023 Mon Sep 17 00:00:00 2001 From: James Kerr Date: Tue, 16 Apr 2024 10:19:15 -0700 Subject: [PATCH] Build a valid esmodule --- .../src/commands/default-commands.ts | 8 +++--- modules/react-arborist/src/commands/types.ts | 2 +- .../src/components/default-cursor.tsx | 2 +- .../src/components/tree-view.tsx | 28 +++++++++---------- .../src/controllers/node-controller.ts | 4 +-- .../src/controllers/tree-controller.ts | 10 +++---- modules/react-arborist/src/cursor/types.ts | 2 +- .../src/cursor/use-cursor-container-style.ts | 2 +- .../src/cursor/use-cursor-props.ts | 2 +- .../react-arborist/src/cursor/use-cursor.ts | 2 +- .../react-arborist/src/dnd/compute-drop.ts | 8 +++--- .../react-arborist/src/dnd/measure-hover.ts | 2 +- .../react-arborist/src/dnd/safe-to-drop.ts | 2 +- modules/react-arborist/src/dnd/types.ts | 4 +-- modules/react-arborist/src/dnd/use-dnd.ts | 2 +- .../react-arborist/src/dnd/use-node-drag.ts | 2 +- .../react-arborist/src/dnd/use-node-drop.ts | 6 ++-- .../react-arborist/src/dnd/use-tree-drop.ts | 4 +-- modules/react-arborist/src/edit/types.ts | 2 +- modules/react-arborist/src/edit/use-edit.ts | 2 +- modules/react-arborist/src/filter/match.ts | 2 +- .../react-arborist/src/filter/tree-filter.ts | 6 ++-- .../react-arborist/src/filter/use-filter.ts | 6 ++-- modules/react-arborist/src/focus/types.ts | 2 +- modules/react-arborist/src/focus/use-focus.ts | 2 +- .../react-arborist/src/focus/use-row-focus.ts | 2 +- modules/react-arborist/src/index.ts | 16 +++++------ .../src/list/use-list-inner-style.ts | 2 +- modules/react-arborist/src/nodes/accessor.ts | 2 +- .../react-arborist/src/nodes/comparator.ts | 2 +- .../src/nodes/create-node-model.ts | 6 ++-- .../react-arborist/src/nodes/node-model.ts | 4 +-- .../src/nodes/root-node-model.ts | 6 ++-- modules/react-arborist/src/nodes/sorter.ts | 6 ++-- .../react-arborist/src/nodes/tree-model.ts | 8 +++--- modules/react-arborist/src/nodes/types.ts | 2 +- modules/react-arborist/src/nodes/use-nodes.ts | 4 +-- modules/react-arborist/src/opens/types.ts | 2 +- modules/react-arborist/src/opens/use-opens.ts | 2 +- .../src/props/use-default-props.ts | 22 +++++++-------- modules/react-arborist/src/row/attributes.ts | 4 +-- modules/react-arborist/src/selection/types.ts | 4 +-- .../src/selection/use-multi-selection.ts | 6 ++-- .../src/shortcuts/default-shortcuts.ts | 2 +- .../src/shortcuts/press.test.ts | 2 +- .../src/shortcuts/shortcut-manager.ts | 6 ++-- .../react-arborist/src/shortcuts/shortcut.ts | 2 +- .../src/tree-view/attributes.ts | 2 +- modules/react-arborist/src/types/handlers.ts | 4 +-- modules/react-arborist/src/types/renderers.ts | 6 ++-- .../react-arborist/src/types/tree-props.ts | 8 +++--- .../src/types/tree-view-props.ts | 20 ++++++------- modules/react-arborist/src/utils.ts | 2 +- modules/react-arborist/src/visible/types.ts | 2 +- 54 files changed, 135 insertions(+), 135 deletions(-) diff --git a/modules/react-arborist/src/commands/default-commands.ts b/modules/react-arborist/src/commands/default-commands.ts index 82041e2..5fb0d87 100644 --- a/modules/react-arborist/src/commands/default-commands.ts +++ b/modules/react-arborist/src/commands/default-commands.ts @@ -1,7 +1,7 @@ -import { NodeController } from "../controllers/node-controller"; -import { TreeController } from "../controllers/tree-controller"; -import { NodeType } from "../nodes/types"; -import { focusNextElement, focusPrevElement } from "../utils"; +import { NodeController } from "../controllers/node-controller.js"; +import { TreeController } from "../controllers/tree-controller.js"; +import { NodeType } from "../nodes/types.js"; +import { focusNextElement, focusPrevElement } from "../utils.js"; export type Tree = TreeController; diff --git a/modules/react-arborist/src/commands/types.ts b/modules/react-arborist/src/commands/types.ts index d9104c4..bd2de20 100644 --- a/modules/react-arborist/src/commands/types.ts +++ b/modules/react-arborist/src/commands/types.ts @@ -1,4 +1,4 @@ -import { TreeController } from "../controllers/tree-controller"; +import { TreeController } from "../controllers/tree-controller.js"; export type CommandObject = { [name: string]: CommandBody; diff --git a/modules/react-arborist/src/components/default-cursor.tsx b/modules/react-arborist/src/components/default-cursor.tsx index 2a90719..5ac9567 100644 --- a/modules/react-arborist/src/components/default-cursor.tsx +++ b/modules/react-arborist/src/components/default-cursor.tsx @@ -1,5 +1,5 @@ import React, { CSSProperties } from "react"; -import { CursorProps } from "../types/renderers"; +import { CursorProps } from "../types/renderers.js"; const placeholderStyle = { display: "flex", diff --git a/modules/react-arborist/src/components/tree-view.tsx b/modules/react-arborist/src/components/tree-view.tsx index a99b3d7..7ab88ee 100644 --- a/modules/react-arborist/src/components/tree-view.tsx +++ b/modules/react-arborist/src/components/tree-view.tsx @@ -5,21 +5,21 @@ import React, { useContext, useRef, } from "react"; -import { TreeController } from "../controllers/tree-controller"; -import { TreeViewProps } from "../types/tree-view-props"; +import { TreeController } from "../controllers/tree-controller.js"; +import { TreeViewProps } from "../types/tree-view-props.js"; import { FixedSizeList } from "react-window"; -import { NodeController } from "../controllers/node-controller"; -import { createRowAttributes } from "../row/attributes"; -import { DefaultCursor } from "./default-cursor"; -import { useCursorProps } from "../cursor/use-cursor-props"; -import { useCursorContainerStyle } from "../cursor/use-cursor-container-style"; -import { useListInnerStyle } from "../list/use-list-inner-style"; -import { useNodeDrag } from "../dnd/use-node-drag"; -import { useNodeDrop } from "../dnd/use-node-drop"; -import { useDefaultProps } from "../props/use-default-props"; -import { useRowFocus } from "../focus/use-row-focus"; -import { createTreeViewAttributes } from "../tree-view/attributes"; -import { useTreeDrop } from "../dnd/use-tree-drop"; +import { NodeController } from "../controllers/node-controller.js"; +import { createRowAttributes } from "../row/attributes.js"; +import { DefaultCursor } from "./default-cursor.js"; +import { useCursorProps } from "../cursor/use-cursor-props.js"; +import { useCursorContainerStyle } from "../cursor/use-cursor-container-style.js"; +import { useListInnerStyle } from "../list/use-list-inner-style.js"; +import { useNodeDrag } from "../dnd/use-node-drag.js"; +import { useNodeDrop } from "../dnd/use-node-drop.js"; +import { useDefaultProps } from "../props/use-default-props.js"; +import { useRowFocus } from "../focus/use-row-focus.js"; +import { createTreeViewAttributes } from "../tree-view/attributes.js"; +import { useTreeDrop } from "../dnd/use-tree-drop.js"; export function TreeView(props: Partial>) { const filledProps = useDefaultProps(props); diff --git a/modules/react-arborist/src/controllers/node-controller.ts b/modules/react-arborist/src/controllers/node-controller.ts index a730e40..6ada001 100644 --- a/modules/react-arborist/src/controllers/node-controller.ts +++ b/modules/react-arborist/src/controllers/node-controller.ts @@ -1,5 +1,5 @@ -import { NodeObject } from "../nodes/types"; -import { TreeController } from "./tree-controller"; +import { NodeObject } from "../nodes/types.js"; +import { TreeController } from "./tree-controller.js"; export class NodeController { static constructRows(tree: TreeController, objects: NodeObject[]) { diff --git a/modules/react-arborist/src/controllers/tree-controller.ts b/modules/react-arborist/src/controllers/tree-controller.ts index deab36a..140b4f6 100644 --- a/modules/react-arborist/src/controllers/tree-controller.ts +++ b/modules/react-arborist/src/controllers/tree-controller.ts @@ -1,9 +1,9 @@ import { Align, FixedSizeList } from "react-window"; -import { CursorState } from "../cursor/types"; -import { safeToDrop } from "../dnd/safe-to-drop"; -import { ShortcutManager } from "../shortcuts/shortcut-manager"; -import { TreeViewProps } from "../types/tree-view-props"; -import { NodeController } from "./node-controller"; +import { CursorState } from "../cursor/types.js"; +import { safeToDrop } from "../dnd/safe-to-drop.js"; +import { ShortcutManager } from "../shortcuts/shortcut-manager.js"; +import { TreeViewProps } from "../types/tree-view-props.js"; +import { NodeController } from "./node-controller.js"; export class TreeController { rows: NodeController[]; diff --git a/modules/react-arborist/src/cursor/types.ts b/modules/react-arborist/src/cursor/types.ts index fee1a03..0181a6d 100644 --- a/modules/react-arborist/src/cursor/types.ts +++ b/modules/react-arborist/src/cursor/types.ts @@ -1,4 +1,4 @@ -import { PartialController } from "../types/utils"; +import { PartialController } from "../types/utils.js"; export type LineCursor = { type: "line"; diff --git a/modules/react-arborist/src/cursor/use-cursor-container-style.ts b/modules/react-arborist/src/cursor/use-cursor-container-style.ts index 42e1331..e4f771b 100644 --- a/modules/react-arborist/src/cursor/use-cursor-container-style.ts +++ b/modules/react-arborist/src/cursor/use-cursor-container-style.ts @@ -1,5 +1,5 @@ import { CSSProperties } from "react"; -import { TreeController } from "../controllers/tree-controller"; +import { TreeController } from "../controllers/tree-controller.js"; export function useCursorContainerStyle(tree: TreeController) { return { diff --git a/modules/react-arborist/src/cursor/use-cursor-props.ts b/modules/react-arborist/src/cursor/use-cursor-props.ts index 579002f..90177b9 100644 --- a/modules/react-arborist/src/cursor/use-cursor-props.ts +++ b/modules/react-arborist/src/cursor/use-cursor-props.ts @@ -1,4 +1,4 @@ -import { TreeController } from "../controllers/tree-controller"; +import { TreeController } from "../controllers/tree-controller.js"; export function useCursorProps(tree: TreeController) { const cursor = tree.props.cursor.value; diff --git a/modules/react-arborist/src/cursor/use-cursor.ts b/modules/react-arborist/src/cursor/use-cursor.ts index 9b882c3..051ee62 100644 --- a/modules/react-arborist/src/cursor/use-cursor.ts +++ b/modules/react-arborist/src/cursor/use-cursor.ts @@ -1,5 +1,5 @@ import { useState } from "react"; -import { CursorPartialController, CursorState } from "./types"; +import { CursorPartialController, CursorState } from "./types.js"; export function useCursor(): CursorPartialController { const [value, setValue] = useState(null); diff --git a/modules/react-arborist/src/dnd/compute-drop.ts b/modules/react-arborist/src/dnd/compute-drop.ts index 2a4007e..3589eef 100644 --- a/modules/react-arborist/src/dnd/compute-drop.ts +++ b/modules/react-arborist/src/dnd/compute-drop.ts @@ -1,7 +1,7 @@ -import { bound, isOpenWithEmptyChildren } from "../utils"; -import { NodeController } from "../controllers/node-controller"; -import { HoverData, measureHover } from "./measure-hover"; -import { XY } from "./types"; +import { bound, isOpenWithEmptyChildren } from "../utils.js"; +import { NodeController } from "../controllers/node-controller.js"; +import { HoverData, measureHover } from "./measure-hover.js"; +import { XY } from "./types.js"; function getNodesAroundCursor( node: NodeController | null, diff --git a/modules/react-arborist/src/dnd/measure-hover.ts b/modules/react-arborist/src/dnd/measure-hover.ts index f2e5a29..8b349cf 100644 --- a/modules/react-arborist/src/dnd/measure-hover.ts +++ b/modules/react-arborist/src/dnd/measure-hover.ts @@ -1,4 +1,4 @@ -import { XY } from "./types"; +import { XY } from "./types.js"; export function measureHover( el: HTMLElement, diff --git a/modules/react-arborist/src/dnd/safe-to-drop.ts b/modules/react-arborist/src/dnd/safe-to-drop.ts index 10b62be..5baf07f 100644 --- a/modules/react-arborist/src/dnd/safe-to-drop.ts +++ b/modules/react-arborist/src/dnd/safe-to-drop.ts @@ -1,4 +1,4 @@ -import { TreeController } from "../controllers/tree-controller"; +import { TreeController } from "../controllers/tree-controller.js"; export function safeToDrop(tree: TreeController) { const targetParentNode = tree.dropTargetParentNode; diff --git a/modules/react-arborist/src/dnd/types.ts b/modules/react-arborist/src/dnd/types.ts index 2495ca6..58b329c 100644 --- a/modules/react-arborist/src/dnd/types.ts +++ b/modules/react-arborist/src/dnd/types.ts @@ -1,5 +1,5 @@ -import { NodeController } from "../controllers/node-controller"; -import { PartialController } from "../types/utils"; +import { NodeController } from "../controllers/node-controller.js"; +import { PartialController } from "../types/utils.js"; export type DndState = { dragSourceId: string | null; diff --git a/modules/react-arborist/src/dnd/use-dnd.ts b/modules/react-arborist/src/dnd/use-dnd.ts index e6fc66b..cac6e2a 100644 --- a/modules/react-arborist/src/dnd/use-dnd.ts +++ b/modules/react-arborist/src/dnd/use-dnd.ts @@ -1,4 +1,4 @@ -import { DndPartialController, DndState } from "./types"; +import { DndPartialController, DndState } from "./types.js"; import { useState } from "react"; function getInitialState(): DndState { diff --git a/modules/react-arborist/src/dnd/use-node-drag.ts b/modules/react-arborist/src/dnd/use-node-drag.ts index 2925366..581cb20 100644 --- a/modules/react-arborist/src/dnd/use-node-drag.ts +++ b/modules/react-arborist/src/dnd/use-node-drag.ts @@ -1,5 +1,5 @@ import { useDrag } from "react-aria"; -import { NodeController } from "../controllers/node-controller"; +import { NodeController } from "../controllers/node-controller.js"; export function useNodeDrag(node: NodeController) { const { tree } = node; diff --git a/modules/react-arborist/src/dnd/use-node-drop.ts b/modules/react-arborist/src/dnd/use-node-drop.ts index 8b80ec3..190bb7f 100644 --- a/modules/react-arborist/src/dnd/use-node-drop.ts +++ b/modules/react-arborist/src/dnd/use-node-drop.ts @@ -1,8 +1,8 @@ import { useDrop } from "react-aria"; -import { NodeController } from "../controllers/node-controller"; -import { ComputedDrop, computeDrop } from "./compute-drop"; +import { NodeController } from "../controllers/node-controller.js"; +import { ComputedDrop, computeDrop } from "./compute-drop.js"; import { useRef } from "react"; -import { Timer } from "../utils"; +import { Timer } from "../utils.js"; export function useNodeDrop(node: NodeController, ref: any) { const { tree } = node; diff --git a/modules/react-arborist/src/dnd/use-tree-drop.ts b/modules/react-arborist/src/dnd/use-tree-drop.ts index 058f60a..4d9ab6d 100644 --- a/modules/react-arborist/src/dnd/use-tree-drop.ts +++ b/modules/react-arborist/src/dnd/use-tree-drop.ts @@ -1,6 +1,6 @@ import { useDrop } from "react-aria"; -import { computeDrop } from "./compute-drop"; -import { TreeController } from "../controllers/tree-controller"; +import { computeDrop } from "./compute-drop.js"; +import { TreeController } from "../controllers/tree-controller.js"; export function useTreeDrop(tree: TreeController, ref: any) { const { dropProps } = useDrop({ diff --git a/modules/react-arborist/src/edit/types.ts b/modules/react-arborist/src/edit/types.ts index 4634fee..879a73c 100644 --- a/modules/react-arborist/src/edit/types.ts +++ b/modules/react-arborist/src/edit/types.ts @@ -1,4 +1,4 @@ -import { PartialController } from "../types/utils"; +import { PartialController } from "../types/utils.js"; export type EditState = string | null; diff --git a/modules/react-arborist/src/edit/use-edit.ts b/modules/react-arborist/src/edit/use-edit.ts index c6426f6..0dbec8c 100644 --- a/modules/react-arborist/src/edit/use-edit.ts +++ b/modules/react-arborist/src/edit/use-edit.ts @@ -1,5 +1,5 @@ import { useState } from "react"; -import { EditPartialController, EditState } from "./types"; +import { EditPartialController, EditState } from "./types.js"; export function useEdit(): EditPartialController { const [value, setValue] = useState(null); diff --git a/modules/react-arborist/src/filter/match.ts b/modules/react-arborist/src/filter/match.ts index bebc496..48c404a 100644 --- a/modules/react-arborist/src/filter/match.ts +++ b/modules/react-arborist/src/filter/match.ts @@ -1,4 +1,4 @@ -import { NodeObject } from "../nodes/types"; +import { NodeObject } from "../nodes/types.js"; export function matchesStringProperties(node: NodeObject, term: string) { const haystack = Array.from(Object.values(node.sourceData as any)) diff --git a/modules/react-arborist/src/filter/tree-filter.ts b/modules/react-arborist/src/filter/tree-filter.ts index 055935f..5764fda 100644 --- a/modules/react-arborist/src/filter/tree-filter.ts +++ b/modules/react-arborist/src/filter/tree-filter.ts @@ -1,6 +1,6 @@ -import { NodeObject } from "../nodes/types"; -import { matchesStringProperties } from "./match"; -import { FilterOptions } from "./use-filter"; +import { NodeObject } from "../nodes/types.js"; +import { matchesStringProperties } from "./match.js"; +import { FilterOptions } from "./use-filter.js"; type BoolMap = Record; diff --git a/modules/react-arborist/src/filter/use-filter.ts b/modules/react-arborist/src/filter/use-filter.ts index 2443910..69f080c 100644 --- a/modules/react-arborist/src/filter/use-filter.ts +++ b/modules/react-arborist/src/filter/use-filter.ts @@ -1,7 +1,7 @@ import { useState } from "react"; -import { OpensOnChangeEvent, OpensState } from "../opens/types"; -import { TreeFilter } from "./tree-filter"; -import { NodeObject } from "../nodes/types"; +import { OpensOnChangeEvent, OpensState } from "../opens/types.js"; +import { TreeFilter } from "./tree-filter.js"; +import { NodeObject } from "../nodes/types.js"; export type FilterOptions = { term?: string; diff --git a/modules/react-arborist/src/focus/types.ts b/modules/react-arborist/src/focus/types.ts index 6af0c22..38d8ac5 100644 --- a/modules/react-arborist/src/focus/types.ts +++ b/modules/react-arborist/src/focus/types.ts @@ -1,4 +1,4 @@ -import { PartialController } from "../types/utils"; +import { PartialController } from "../types/utils.js"; export type FocusState = { id: string | null; diff --git a/modules/react-arborist/src/focus/use-focus.ts b/modules/react-arborist/src/focus/use-focus.ts index f269e84..583e5f8 100644 --- a/modules/react-arborist/src/focus/use-focus.ts +++ b/modules/react-arborist/src/focus/use-focus.ts @@ -1,5 +1,5 @@ import { useState } from "react"; -import { FocusPartialController, FocusState } from "./types"; +import { FocusPartialController, FocusState } from "./types.js"; export function useFocus(): FocusPartialController { const [value, setValue] = useState({ diff --git a/modules/react-arborist/src/focus/use-row-focus.ts b/modules/react-arborist/src/focus/use-row-focus.ts index 9d8b4db..fef34f1 100644 --- a/modules/react-arborist/src/focus/use-row-focus.ts +++ b/modules/react-arborist/src/focus/use-row-focus.ts @@ -1,5 +1,5 @@ import { MutableRefObject, useEffect } from "react"; -import { NodeController } from "../controllers/node-controller"; +import { NodeController } from "../controllers/node-controller.js"; export function useRowFocus( node: NodeController, diff --git a/modules/react-arborist/src/index.ts b/modules/react-arborist/src/index.ts index de00e9b..b609ba5 100644 --- a/modules/react-arborist/src/index.ts +++ b/modules/react-arborist/src/index.ts @@ -1,10 +1,10 @@ /* The Public Api */ -export type * from "./types/handlers"; -export type * from "./types/renderers"; +export type * from "./types/handlers.js"; +export type * from "./types/renderers.js"; -export * from "./components/tree-view"; -export * from "./nodes/tree-model"; -export * from "./nodes/use-nodes"; -export * from "./selection/use-multi-selection"; -export * from "./dnd/use-dnd"; -export * from "./filter/use-filter"; +export * from "./components/tree-view.js"; +export * from "./nodes/tree-model.js"; +export * from "./nodes/use-nodes.js"; +export * from "./selection/use-multi-selection.js"; +export * from "./dnd/use-dnd.js"; +export * from "./filter/use-filter.js"; diff --git a/modules/react-arborist/src/list/use-list-inner-style.ts b/modules/react-arborist/src/list/use-list-inner-style.ts index 9912e9b..a16864a 100644 --- a/modules/react-arborist/src/list/use-list-inner-style.ts +++ b/modules/react-arborist/src/list/use-list-inner-style.ts @@ -1,4 +1,4 @@ -import { TreeController } from "../controllers/tree-controller"; +import { TreeController } from "../controllers/tree-controller.js"; export function useListInnerStyle(tree: TreeController, style: any) { return { diff --git a/modules/react-arborist/src/nodes/accessor.ts b/modules/react-arborist/src/nodes/accessor.ts index 3445a49..84b7f87 100644 --- a/modules/react-arborist/src/nodes/accessor.ts +++ b/modules/react-arborist/src/nodes/accessor.ts @@ -1,4 +1,4 @@ -import { Accessors } from "./types"; +import { Accessors } from "./types.js"; export function createAccessor( accessors: Partial>, diff --git a/modules/react-arborist/src/nodes/comparator.ts b/modules/react-arborist/src/nodes/comparator.ts index 2d2922f..3dfd5a8 100644 --- a/modules/react-arborist/src/nodes/comparator.ts +++ b/modules/react-arborist/src/nodes/comparator.ts @@ -1,4 +1,4 @@ -import { GetSortField, SortOrder } from "./types"; +import { GetSortField, SortOrder } from "./types.js"; export class Comparator { constructor( diff --git a/modules/react-arborist/src/nodes/create-node-model.ts b/modules/react-arborist/src/nodes/create-node-model.ts index d70bded..c642fd0 100644 --- a/modules/react-arborist/src/nodes/create-node-model.ts +++ b/modules/react-arborist/src/nodes/create-node-model.ts @@ -1,6 +1,6 @@ -import { NodeModel } from "./node-model"; -import { Sorter } from "./sorter"; -import { Accessors } from "./types"; +import { NodeModel } from "./node-model.js"; +import { Sorter } from "./sorter.js"; +import { Accessors } from "./types.js"; export function createNodeModel( parent: NodeModel, diff --git a/modules/react-arborist/src/nodes/node-model.ts b/modules/react-arborist/src/nodes/node-model.ts index d02e4b1..e599392 100644 --- a/modules/react-arborist/src/nodes/node-model.ts +++ b/modules/react-arborist/src/nodes/node-model.ts @@ -1,5 +1,5 @@ -import { createChildren } from "./create-node-model"; -import { NodeObject, Accessors } from "./types"; +import { createChildren } from "./create-node-model.js"; +import { NodeObject, Accessors } from "./types.js"; type Attrs = { id: string; diff --git a/modules/react-arborist/src/nodes/root-node-model.ts b/modules/react-arborist/src/nodes/root-node-model.ts index 2f8fada..bc76baa 100644 --- a/modules/react-arborist/src/nodes/root-node-model.ts +++ b/modules/react-arborist/src/nodes/root-node-model.ts @@ -1,6 +1,6 @@ -import { createChildren } from "./create-node-model"; -import { NodeModel } from "./node-model"; -import { Accessors } from "./types"; +import { createChildren } from "./create-node-model.js"; +import { NodeModel } from "./node-model.js"; +import { Accessors } from "./types.js"; export class RootNodeModel extends NodeModel { constructor(sourceChildren: T[], access: Accessors) { diff --git a/modules/react-arborist/src/nodes/sorter.ts b/modules/react-arborist/src/nodes/sorter.ts index 2460373..0d41b58 100644 --- a/modules/react-arborist/src/nodes/sorter.ts +++ b/modules/react-arborist/src/nodes/sorter.ts @@ -1,6 +1,6 @@ -import { toArray } from "../utils"; -import { Comparator } from "./comparator"; -import { Accessors } from "./types"; +import { toArray } from "../utils.js"; +import { Comparator } from "./comparator.js"; +import { Accessors } from "./types.js"; export class Sorter { constructor(public access: Accessors) {} diff --git a/modules/react-arborist/src/nodes/tree-model.ts b/modules/react-arborist/src/nodes/tree-model.ts index b5ce276..2582faf 100644 --- a/modules/react-arborist/src/nodes/tree-model.ts +++ b/modules/react-arborist/src/nodes/tree-model.ts @@ -1,7 +1,7 @@ -import { createAccessor } from "./accessor"; -import { NodeModel } from "./node-model"; -import { RootNodeModel } from "./root-node-model"; -import { Accessors, NodeType } from "./types"; +import { createAccessor } from "./accessor.js"; +import { NodeModel } from "./node-model.js"; +import { RootNodeModel } from "./root-node-model.js"; +import { Accessors, NodeType } from "./types.js"; export class TreeModel { root: RootNodeModel; diff --git a/modules/react-arborist/src/nodes/types.ts b/modules/react-arborist/src/nodes/types.ts index bc126ab..a4538bf 100644 --- a/modules/react-arborist/src/nodes/types.ts +++ b/modules/react-arborist/src/nodes/types.ts @@ -1,4 +1,4 @@ -import { PartialController } from "../types/utils"; +import { PartialController } from "../types/utils.js"; export type NodeObject = { id: string; diff --git a/modules/react-arborist/src/nodes/use-nodes.ts b/modules/react-arborist/src/nodes/use-nodes.ts index 1c1e9e8..9f5b7c3 100644 --- a/modules/react-arborist/src/nodes/use-nodes.ts +++ b/modules/react-arborist/src/nodes/use-nodes.ts @@ -4,8 +4,8 @@ import { NodeObject, NodesOnChangeEvent, NodesPartialController, -} from "./types"; -import { TreeModel } from "./tree-model"; +} from "./types.js"; +import { TreeModel } from "./tree-model.js"; export function useNodes( initialData: T[], diff --git a/modules/react-arborist/src/opens/types.ts b/modules/react-arborist/src/opens/types.ts index 5a504cc..8fb5ff0 100644 --- a/modules/react-arborist/src/opens/types.ts +++ b/modules/react-arborist/src/opens/types.ts @@ -1,4 +1,4 @@ -import { PartialController } from "../types/utils"; +import { PartialController } from "../types/utils.js"; export type OpensState = Record; diff --git a/modules/react-arborist/src/opens/use-opens.ts b/modules/react-arborist/src/opens/use-opens.ts index 61b4488..3222331 100644 --- a/modules/react-arborist/src/opens/use-opens.ts +++ b/modules/react-arborist/src/opens/use-opens.ts @@ -1,5 +1,5 @@ import { useState } from "react"; -import { OpensPartialController, OpensState } from "./types"; +import { OpensPartialController, OpensState } from "./types.js"; export function useOpens(): OpensPartialController { const [value, setValue] = useState({}); diff --git a/modules/react-arborist/src/props/use-default-props.ts b/modules/react-arborist/src/props/use-default-props.ts index c866ec1..3cdf8da 100644 --- a/modules/react-arborist/src/props/use-default-props.ts +++ b/modules/react-arborist/src/props/use-default-props.ts @@ -1,14 +1,14 @@ -import * as defaultCommands from "../commands/default-commands"; -import { useCursor } from "../cursor/use-cursor"; -import { useDnd } from "../dnd/use-dnd"; -import { useEdit } from "../edit/use-edit"; -import { useFocus } from "../focus/use-focus"; -import { defaultNodeObjects } from "../nodes/default-node-objects"; -import { useNodes } from "../nodes/use-nodes"; -import { useOpens } from "../opens/use-opens"; -import { useMultiSelection } from "../selection/use-multi-selection"; -import { defaultShortcuts } from "../shortcuts/default-shortcuts"; -import { TreeViewProps } from "../types/tree-view-props"; +import * as defaultCommands from "../commands/default-commands.js"; +import { useCursor } from "../cursor/use-cursor.js"; +import { useDnd } from "../dnd/use-dnd.js"; +import { useEdit } from "../edit/use-edit.js"; +import { useFocus } from "../focus/use-focus.js"; +import { defaultNodeObjects } from "../nodes/default-node-objects.js"; +import { useNodes } from "../nodes/use-nodes.js"; +import { useOpens } from "../opens/use-opens.js"; +import { useMultiSelection } from "../selection/use-multi-selection.js"; +import { defaultShortcuts } from "../shortcuts/default-shortcuts.js"; +import { TreeViewProps } from "../types/tree-view-props.js"; export function useDefaultProps( props: Partial>, diff --git a/modules/react-arborist/src/row/attributes.ts b/modules/react-arborist/src/row/attributes.ts index 035deeb..df02d1e 100644 --- a/modules/react-arborist/src/row/attributes.ts +++ b/modules/react-arborist/src/row/attributes.ts @@ -1,6 +1,6 @@ import { CSSProperties } from "react"; -import { NodeController } from "../controllers/node-controller"; -import { TreeController } from "../controllers/tree-controller"; +import { NodeController } from "../controllers/node-controller.js"; +import { TreeController } from "../controllers/tree-controller.js"; export function createRowAttributes( tree: TreeController, diff --git a/modules/react-arborist/src/selection/types.ts b/modules/react-arborist/src/selection/types.ts index 7feda28..04a3168 100644 --- a/modules/react-arborist/src/selection/types.ts +++ b/modules/react-arborist/src/selection/types.ts @@ -1,5 +1,5 @@ -import { TreeController } from "../controllers/tree-controller"; -import { PartialController } from "../types/utils"; +import { TreeController } from "../controllers/tree-controller.js"; +import { PartialController } from "../types/utils.js"; export type SelectionState = Record; export type SelectionOnChangeEvent = diff --git a/modules/react-arborist/src/selection/use-multi-selection.ts b/modules/react-arborist/src/selection/use-multi-selection.ts index 088805b..488ac6e 100644 --- a/modules/react-arborist/src/selection/use-multi-selection.ts +++ b/modules/react-arborist/src/selection/use-multi-selection.ts @@ -3,7 +3,7 @@ import { SelectionOnChangeEvent, SelectionPartialController, SelectionState, -} from "./types"; +} from "./types.js"; export function useMultiSelection(): SelectionPartialController { const [anchor, setAnchor] = useState(null); @@ -19,11 +19,11 @@ export function useMultiSelection(): SelectionPartialController { break; case "deselect": - setValue((prev) => ({ ...prev, [e.id]: false })); + setValue((prev: any) => ({ ...prev, [e.id]: false })); break; case "select-multi": - setValue((prev) => ({ ...prev, [e.id]: true })); + setValue((prev: any) => ({ ...prev, [e.id]: true })); setAnchor(e.id); setMostRecent(e.id); break; diff --git a/modules/react-arborist/src/shortcuts/default-shortcuts.ts b/modules/react-arborist/src/shortcuts/default-shortcuts.ts index b8c44d1..9bedec5 100644 --- a/modules/react-arborist/src/shortcuts/default-shortcuts.ts +++ b/modules/react-arborist/src/shortcuts/default-shortcuts.ts @@ -1,4 +1,4 @@ -import { ShortcutAttrs } from "./types"; +import { ShortcutAttrs } from "./types.js"; export const defaultShortcuts: ShortcutAttrs[] = [ /* Keyboard Navigation */ diff --git a/modules/react-arborist/src/shortcuts/press.test.ts b/modules/react-arborist/src/shortcuts/press.test.ts index e90740c..fda0cbb 100644 --- a/modules/react-arborist/src/shortcuts/press.test.ts +++ b/modules/react-arborist/src/shortcuts/press.test.ts @@ -1,4 +1,4 @@ -import { Press } from "./press"; +import { Press } from "./press.js"; const cases = [ { diff --git a/modules/react-arborist/src/shortcuts/shortcut-manager.ts b/modules/react-arborist/src/shortcuts/shortcut-manager.ts index 2f51979..52a7baa 100644 --- a/modules/react-arborist/src/shortcuts/shortcut-manager.ts +++ b/modules/react-arborist/src/shortcuts/shortcut-manager.ts @@ -1,6 +1,6 @@ -import { Press } from "./press"; -import { Shortcut } from "./shortcut"; -import { ShortcutAttrs } from "./types"; +import { Press } from "./press.js"; +import { Shortcut } from "./shortcut.js"; +import { ShortcutAttrs } from "./types.js"; export class ShortcutManager { shortcuts: Shortcut[]; diff --git a/modules/react-arborist/src/shortcuts/shortcut.ts b/modules/react-arborist/src/shortcuts/shortcut.ts index becd69c..8cf84f9 100644 --- a/modules/react-arborist/src/shortcuts/shortcut.ts +++ b/modules/react-arborist/src/shortcuts/shortcut.ts @@ -1,4 +1,4 @@ -import { ShortcutAttrs } from "./types"; +import { ShortcutAttrs } from "./types.js"; import { evaluate } from "when-clause"; export class Shortcut { diff --git a/modules/react-arborist/src/tree-view/attributes.ts b/modules/react-arborist/src/tree-view/attributes.ts index 33d0d07..40a1526 100644 --- a/modules/react-arborist/src/tree-view/attributes.ts +++ b/modules/react-arborist/src/tree-view/attributes.ts @@ -1,5 +1,5 @@ import { HTMLAttributes } from "react"; -import { TreeController } from "../controllers/tree-controller"; +import { TreeController } from "../controllers/tree-controller.js"; export function createTreeViewAttributes(tree: TreeController) { return { diff --git a/modules/react-arborist/src/types/handlers.ts b/modules/react-arborist/src/types/handlers.ts index 852725e..6d934a7 100644 --- a/modules/react-arborist/src/types/handlers.ts +++ b/modules/react-arborist/src/types/handlers.ts @@ -1,5 +1,5 @@ -import { NodeController } from "../controllers/node-controller"; -import { IdObj } from "./utils"; +import { NodeController } from "../controllers/node-controller.js"; +import { IdObj } from "./utils.js"; export type CreateHandler = (args: { parentId: string | null; diff --git a/modules/react-arborist/src/types/renderers.ts b/modules/react-arborist/src/types/renderers.ts index 21accf2..854cd58 100644 --- a/modules/react-arborist/src/types/renderers.ts +++ b/modules/react-arborist/src/types/renderers.ts @@ -1,7 +1,7 @@ import { CSSProperties, HTMLAttributes, ReactElement } from "react"; -import { TreeController } from "../controllers/tree-controller"; -import { NodeController } from "../controllers/node-controller"; -import { XY } from "../dnd/types"; +import { TreeController } from "../controllers/tree-controller.js"; +import { NodeController } from "../controllers/node-controller.js"; +import { XY } from "../dnd/types.js"; export type NodeRendererProps = { style: CSSProperties; diff --git a/modules/react-arborist/src/types/tree-props.ts b/modules/react-arborist/src/types/tree-props.ts index 3e8453e..49b8df9 100644 --- a/modules/react-arborist/src/types/tree-props.ts +++ b/modules/react-arborist/src/types/tree-props.ts @@ -1,9 +1,9 @@ -import { BoolFunc } from "./utils"; -import * as handlers from "./handlers"; -import * as renderers from "./renderers"; +import { BoolFunc } from "./utils.js"; +import * as handlers from "./handlers.js"; +import * as renderers from "./renderers.js"; import { ElementType, MouseEventHandler } from "react"; import { ListOnScrollProps } from "react-window"; -import { NodeController } from "../controllers/node-controller"; +import { NodeController } from "../controllers/node-controller.js"; export interface TreeProps { /* Data Options */ diff --git a/modules/react-arborist/src/types/tree-view-props.ts b/modules/react-arborist/src/types/tree-view-props.ts index 9d0fcde..001166b 100644 --- a/modules/react-arborist/src/types/tree-view-props.ts +++ b/modules/react-arborist/src/types/tree-view-props.ts @@ -1,13 +1,13 @@ -import { NodesPartialController } from "../nodes/types"; -import { OpensPartialController } from "../opens/types"; -import { EditPartialController } from "../edit/types"; -import { SelectionPartialController } from "../selection/types"; -import { DisableDropCheck, DndPartialController } from "../dnd/types"; -import { CursorPartialController } from "../cursor/types"; -import { FocusPartialController } from "../focus/types"; -import { VisiblePartialController } from "../visible/types"; -import { ShortcutAttrs } from "../shortcuts/types"; -import { CommandObject } from "../commands/types"; +import { NodesPartialController } from "../nodes/types.js"; +import { OpensPartialController } from "../opens/types.js"; +import { EditPartialController } from "../edit/types.js"; +import { SelectionPartialController } from "../selection/types.js"; +import { DisableDropCheck, DndPartialController } from "../dnd/types.js"; +import { CursorPartialController } from "../cursor/types.js"; +import { FocusPartialController } from "../focus/types.js"; +import { VisiblePartialController } from "../visible/types.js"; +import { ShortcutAttrs } from "../shortcuts/types.js"; +import { CommandObject } from "../commands/types.js"; import { ListOnScrollProps } from "react-window"; export type TreeViewProps = { diff --git a/modules/react-arborist/src/utils.ts b/modules/react-arborist/src/utils.ts index 5837cc2..3789eab 100644 --- a/modules/react-arborist/src/utils.ts +++ b/modules/react-arborist/src/utils.ts @@ -1,4 +1,4 @@ -import { NodeController } from "./controllers/node-controller"; +import { NodeController } from "./controllers/node-controller.js"; export function bound(n: number, min: number, max: number) { return Math.max(Math.min(n, max), min); diff --git a/modules/react-arborist/src/visible/types.ts b/modules/react-arborist/src/visible/types.ts index 35dba22..ec4b895 100644 --- a/modules/react-arborist/src/visible/types.ts +++ b/modules/react-arborist/src/visible/types.ts @@ -1,4 +1,4 @@ -import { PartialController } from "../types/utils"; +import { PartialController } from "../types/utils.js"; export type VisibleState = Record;