Skip to content

Commit

Permalink
Build a valid esmodule
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskerr committed Apr 16, 2024
1 parent 961d9df commit 87a6bb2
Show file tree
Hide file tree
Showing 54 changed files with 135 additions and 135 deletions.
8 changes: 4 additions & 4 deletions modules/react-arborist/src/commands/default-commands.ts
Original file line number Diff line number Diff line change
@@ -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<any>;

Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/commands/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TreeController } from "../controllers/tree-controller";
import { TreeController } from "../controllers/tree-controller.js";

export type CommandObject<T> = {
[name: string]: CommandBody<T>;
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/components/default-cursor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { CSSProperties } from "react";
import { CursorProps } from "../types/renderers";
import { CursorProps } from "../types/renderers.js";

const placeholderStyle = {
display: "flex",
Expand Down
28 changes: 14 additions & 14 deletions modules/react-arborist/src/components/tree-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(props: Partial<TreeViewProps<T>>) {
const filledProps = useDefaultProps(props);
Expand Down
4 changes: 2 additions & 2 deletions modules/react-arborist/src/controllers/node-controller.ts
Original file line number Diff line number Diff line change
@@ -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<T> {
static constructRows<T>(tree: TreeController<T>, objects: NodeObject<T>[]) {
Expand Down
10 changes: 5 additions & 5 deletions modules/react-arborist/src/controllers/tree-controller.ts
Original file line number Diff line number Diff line change
@@ -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<T> {
rows: NodeController<T>[];
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/cursor/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PartialController } from "../types/utils";
import { PartialController } from "../types/utils.js";

export type LineCursor = {
type: "line";
Expand Down
Original file line number Diff line number Diff line change
@@ -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<any>) {
return {
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/cursor/use-cursor-props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TreeController } from "../controllers/tree-controller";
import { TreeController } from "../controllers/tree-controller.js";

export function useCursorProps(tree: TreeController<any>) {
const cursor = tree.props.cursor.value;
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/cursor/use-cursor.ts
Original file line number Diff line number Diff line change
@@ -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<CursorState>(null);
Expand Down
8 changes: 4 additions & 4 deletions modules/react-arborist/src/dnd/compute-drop.ts
Original file line number Diff line number Diff line change
@@ -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<any> | null,
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/dnd/measure-hover.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { XY } from "./types";
import { XY } from "./types.js";

export function measureHover(
el: HTMLElement,
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/dnd/safe-to-drop.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TreeController } from "../controllers/tree-controller";
import { TreeController } from "../controllers/tree-controller.js";

export function safeToDrop(tree: TreeController<any>) {
const targetParentNode = tree.dropTargetParentNode;
Expand Down
4 changes: 2 additions & 2 deletions modules/react-arborist/src/dnd/types.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/dnd/use-dnd.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DndPartialController, DndState } from "./types";
import { DndPartialController, DndState } from "./types.js";
import { useState } from "react";

function getInitialState(): DndState {
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/dnd/use-node-drag.ts
Original file line number Diff line number Diff line change
@@ -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<T>(node: NodeController<T>) {
const { tree } = node;
Expand Down
6 changes: 3 additions & 3 deletions modules/react-arborist/src/dnd/use-node-drop.ts
Original file line number Diff line number Diff line change
@@ -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<T>(node: NodeController<T>, ref: any) {
const { tree } = node;
Expand Down
4 changes: 2 additions & 2 deletions modules/react-arborist/src/dnd/use-tree-drop.ts
Original file line number Diff line number Diff line change
@@ -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<T>(tree: TreeController<T>, ref: any) {
const { dropProps } = useDrop({
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/edit/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PartialController } from "../types/utils";
import { PartialController } from "../types/utils.js";

export type EditState = string | null;

Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/edit/use-edit.ts
Original file line number Diff line number Diff line change
@@ -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<EditState>(null);
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/filter/match.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NodeObject } from "../nodes/types";
import { NodeObject } from "../nodes/types.js";

export function matchesStringProperties<T>(node: NodeObject<T>, term: string) {
const haystack = Array.from(Object.values(node.sourceData as any))
Expand Down
6 changes: 3 additions & 3 deletions modules/react-arborist/src/filter/tree-filter.ts
Original file line number Diff line number Diff line change
@@ -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<string, boolean>;

Expand Down
6 changes: 3 additions & 3 deletions modules/react-arborist/src/filter/use-filter.ts
Original file line number Diff line number Diff line change
@@ -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<T> = {
term?: string;
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/focus/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PartialController } from "../types/utils";
import { PartialController } from "../types/utils.js";

export type FocusState = {
id: string | null;
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/focus/use-focus.ts
Original file line number Diff line number Diff line change
@@ -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<FocusState>({
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/focus/use-row-focus.ts
Original file line number Diff line number Diff line change
@@ -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<any>,
Expand Down
16 changes: 8 additions & 8 deletions modules/react-arborist/src/index.ts
Original file line number Diff line number Diff line change
@@ -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";
2 changes: 1 addition & 1 deletion modules/react-arborist/src/list/use-list-inner-style.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TreeController } from "../controllers/tree-controller";
import { TreeController } from "../controllers/tree-controller.js";

export function useListInnerStyle(tree: TreeController<any>, style: any) {
return {
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/nodes/accessor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Accessors } from "./types";
import { Accessors } from "./types.js";

export function createAccessor<T>(
accessors: Partial<Accessors<T>>,
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/nodes/comparator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GetSortField, SortOrder } from "./types";
import { GetSortField, SortOrder } from "./types.js";

export class Comparator<T> {
constructor(
Expand Down
6 changes: 3 additions & 3 deletions modules/react-arborist/src/nodes/create-node-model.ts
Original file line number Diff line number Diff line change
@@ -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<T>(
parent: NodeModel<T>,
Expand Down
4 changes: 2 additions & 2 deletions modules/react-arborist/src/nodes/node-model.ts
Original file line number Diff line number Diff line change
@@ -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<T> = {
id: string;
Expand Down
6 changes: 3 additions & 3 deletions modules/react-arborist/src/nodes/root-node-model.ts
Original file line number Diff line number Diff line change
@@ -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<T> extends NodeModel<T> {
constructor(sourceChildren: T[], access: Accessors<T>) {
Expand Down
6 changes: 3 additions & 3 deletions modules/react-arborist/src/nodes/sorter.ts
Original file line number Diff line number Diff line change
@@ -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<T> {
constructor(public access: Accessors<T>) {}
Expand Down
8 changes: 4 additions & 4 deletions modules/react-arborist/src/nodes/tree-model.ts
Original file line number Diff line number Diff line change
@@ -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<T> {
root: RootNodeModel<T>;
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/nodes/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PartialController } from "../types/utils";
import { PartialController } from "../types/utils.js";

export type NodeObject<T> = {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions modules/react-arborist/src/nodes/use-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(
initialData: T[],
Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/opens/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PartialController } from "../types/utils";
import { PartialController } from "../types/utils.js";

export type OpensState = Record<string, boolean>;

Expand Down
2 changes: 1 addition & 1 deletion modules/react-arborist/src/opens/use-opens.ts
Original file line number Diff line number Diff line change
@@ -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<OpensState>({});
Expand Down
22 changes: 11 additions & 11 deletions modules/react-arborist/src/props/use-default-props.ts
Original file line number Diff line number Diff line change
@@ -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<T>(
props: Partial<TreeViewProps<T>>,
Expand Down
4 changes: 2 additions & 2 deletions modules/react-arborist/src/row/attributes.ts
Original file line number Diff line number Diff line change
@@ -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<T>(
tree: TreeController<T>,
Expand Down
4 changes: 2 additions & 2 deletions modules/react-arborist/src/selection/types.ts
Original file line number Diff line number Diff line change
@@ -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<string, boolean>;
export type SelectionOnChangeEvent<T> =
Expand Down
Loading

0 comments on commit 87a6bb2

Please sign in to comment.