Skip to content

Commit

Permalink
chore: add env to utils entrypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Jul 10, 2021
1 parent cca7715 commit 9a32a1c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/utilities/env/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": "dist/ui-machines-utils-env.cjs.js",
"module": "dist/ui-machines-utils-env.esm.js"
}
2 changes: 2 additions & 0 deletions packages/utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"index.ts",
"array.ts",
"assertion.ts",
"env.ts",
"dom-collection.ts",
"dom-event.ts",
"dom-helper.ts",
Expand All @@ -41,6 +42,7 @@
"array",
"assertion",
"dom-collection",
"env",
"dom-event",
"dom-helper",
"function",
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/src/dom-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
supportsMouseEvents,
supportsPointerEvents,
supportsTouchEvents,
} from "./environment"
} from "./env"
import { cast, runIfFn } from "./function"
import { AnyPointerEvent, Point, PointType } from "./point"

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/utilities/src/function.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isFunction } from "./assertion"
import { __DEV__ } from "./environment"
import { __DEV__ } from "./env"

// schedule task to next tick using double `requestAnimationFrame`
export function nextTick(fn: VoidFunction) {
Expand Down
4 changes: 3 additions & 1 deletion packages/utilities/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ export * from "./assertion"
export * from "./dom-collection"
export * from "./dom-event"
export * from "./dom-helper"
export * from "./environment"
export * from "./env"
export * from "./focus"
export * from "./function"
export * from "./number"
export * from "./point"
export * from "./range"
export * from "./rect"
export * from "./types"
31 changes: 31 additions & 0 deletions packages/utilities/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export type Dict<T = any> = Record<string, T>

export type Booleanish = boolean | "true" | "false"

export type AnyFunction = (...args: any) => void

export type AnyEventHandler = (event: any) => void

export type MaybeFunction<T, Args extends any[] = []> =
| T
| ((...args: Args) => T)

export type EventKeys =
| "ArrowDown"
| "ArrowUp"
| "ArrowLeft"
| "ArrowRight"
| "Enter"
| "Space"
| "Tab"
| "Backspace"
| "Control"
| "Meta"
| "Home"
| "End"
| "PageDown"
| "PageUp"
| "Delete"
| "Escape"
| " "
| "Shift"

0 comments on commit 9a32a1c

Please sign in to comment.