Skip to content

Commit

Permalink
chore: round 2 refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
segunadebayo committed Nov 19, 2021
1 parent 3caa64b commit d9daa0d
Show file tree
Hide file tree
Showing 185 changed files with 430 additions and 1,098 deletions.
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
16 changes: 0 additions & 16 deletions babel.config.js

This file was deleted.

23 changes: 7 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"author": "Segun Adebayo <[email protected]>",
"license": "MIT",
"scripts": {
"build": "preconstruct build",
"bundle": "esr scripts/build.ts --watch",
"build": "parcel build",
"start:react": "cd examples/next-ts && yarn dev",
"start:vue": "cd examples/vue-ts && yarn dev",
"start:solid": "cd examples/solid-ts && yarn dev",
Expand All @@ -28,9 +29,7 @@
"lint:validate": "preconstruct validate",
"pkg": "manypkg run",
"postinstall": "patch-package",
"prepare": "npm-run-all -s prepare:**",
"prepare:husky": "husky install",
"prepare:preconstruct": "preconstruct dev",
"prepare:": "husky install",
"release": "changeset publish",
"start": "preconstruct watch",
"test": "jest --maxWorkers=50%",
Expand All @@ -50,7 +49,6 @@
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@manypkg/cli": "^0.17.0",
"@preconstruct/cli": "^2.1.0",
"@swc-node/jest": "^1.3.3",
"@testing-library/cypress": "^8.0.1",
"@testing-library/jest-dom": "^5.14.1",
Expand All @@ -67,6 +65,7 @@
"cypress-plugin-tab": "^1.0.5",
"cypress-real-events": "^1.5.1",
"esbuild": "^0.13.14",
"esbuild-runner": "^2.2.1",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-cypress": "^2.11.3",
Expand All @@ -76,6 +75,7 @@
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-testing-library": "^4.4.0",
"form-serialize": "^0.7.2",
"gzip-size": "6.0.0",
"husky": "^6.0.0",
"jest": "^26.6.3",
"jest-environment-jsdom": "^26.6.2",
Expand All @@ -86,28 +86,19 @@
"npm-run-all": "^4.1.5",
"patch-package": "^6.4.7",
"prettier": "^2.3.0",
"pretty-bytes": "^5.6.0",
"rimraf": "^3.0.2",
"shelljs": "^0.8.4",
"start-server-and-test": "^1.14.0",
"ts-node": "^9.1.1",
"typescript": "4.4.3"
},
"preconstruct": {
"packages": [
"packages/prop-types",
"packages/core",
"packages/machines/*",
"packages/utilities/*",
"packages/frameworks/*"
]
},
"workspaces": {
"packages": [
"packages/prop-types",
"packages/core",
"packages/machines/*",
"packages/frameworks/*",
"packages/utilities/*",
"packages/utilities",
"examples/*"
]
},
Expand Down
14 changes: 7 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
"author": "Segun Adebayo <[email protected]>",
"homepage": "https://github.com/chakra-ui/core#readme",
"license": "MIT",
"main": "dist/ui-machines-core.cjs.js",
"module": "dist/ui-machines-core.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "src/index.ts",
"repository": "https://github.com/chakra-ui/core/tree/main/packages/machine",
"sideEffects": false,
"files": [
"dist"
"dist",
"src"
],
"publishConfig": {
"access": "public"
Expand All @@ -25,9 +27,7 @@
"url": "https://github.com/chakra-ui/core/issues"
},
"dependencies": {
"klona": "^2.0.4",
"tiny-fn": "^0.0.2",
"tiny-guard": "^0.0.3",
"valtio": "^1.2.5"
"valtio": "^1.2.5",
"klona": "^2.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/core/src/action-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isObject, isString } from "tiny-guard"
import { isObject, isString } from "../../utils/guard"
import { Dict, StateMachine as S } from "./types"

export function choose<TContext, TState extends S.StateSchema, TEvent extends S.EventObject = S.AnyEventObject>(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/create-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cast } from "tiny-fn"
import { proxy } from "valtio"
import { cast } from "../../utils/functions"
import { ActionTypes, Dict, StateMachine as S } from "./types"

export function createProxy<TContext, TState extends S.StateSchema, TEvent extends S.EventObject>(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/delay-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isFunction, isNumber, isString } from "tiny-guard"
import { isFunction, isNumber, isString } from "../../utils/guard"
import { StateMachine as S } from "./types"

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/guard-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isFunction, isObject, isString } from "tiny-guard"
import { isFunction, isObject, isString } from "../../utils/guard"
import { Dict, StateMachine as S } from "./types"

function or<TContext, TEvent extends S.EventObject>(
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/machine.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { klona } from "klona"
import { cast, invariant, noop, runIfFn, warn } from "tiny-fn"
import { isArray, isObject, isString } from "tiny-guard"
import { cast, invariant, noop, runIfFn, warn } from "../../utils/functions"
import { isArray, isObject, isString } from "../../utils/guard"
import { derive, subscribeKey, underive } from "valtio/utils"
import { ref, snapshot, subscribe } from "valtio/vanilla"
import { determineActionsFn } from "./action-utils"
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/transition-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cast } from "tiny-fn"
import { isArray, isObject, isString } from "tiny-guard"
import { cast } from "../../utils/functions"
import { isArray, isObject, isString } from "../../utils/guard"
import { determineGuardFn } from "./guard-utils"
import type { StateMachine as S } from "./types"
import { toArray } from "./utils"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isArray, isString } from "tiny-guard"
import { isArray, isString } from "../../utils/guard"
import type { StateMachine as S } from "./types"

export function toEvent<T extends S.EventObject>(event: S.Event<T>): T {
Expand Down
11 changes: 7 additions & 4 deletions packages/frameworks/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
"author": "Segun Adebayo <[email protected]>",
"homepage": "https://github.com/chakra-ui/ui-machines#readme",
"license": "MIT",
"main": "dist/ui-machines-react.cjs.js",
"module": "dist/ui-machines-react.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"repository": "https://github.com/chakra-ui/ui-machines/tree/main/packages/frameworks/react",
"sideEffects": false,
"files": [
"dist"
"dist",
"src"
],
"publishConfig": {
"access": "public"
Expand All @@ -34,5 +35,7 @@
},
"peerDependencies": {
"react": ">=16.8.6"
}
},
"types": "dist/index.d.ts",
"source": "src/index.ts"
}
2 changes: 1 addition & 1 deletion packages/frameworks/react/src/use-actor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Machine, StateMachine as S } from "@ui-machines/core"
import { Machine, StateMachine as S } from "@ui-machines/core"
import { useEffect, useLayoutEffect, useRef, useState } from "react"
import { useConstant } from "./use-constant"

Expand Down
12 changes: 7 additions & 5 deletions packages/frameworks/solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
"author": "Segun Adebayo <[email protected]>",
"homepage": "https://github.com/chakra-ui/ui-machines#readme",
"license": "MIT",
"main": "dist/ui-machines-solid.cjs.js",
"module": "dist/ui-machines-solid.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"repository": "https://github.com/chakra-ui/ui-machines/tree/main/packages/frameworks/solid",
"sideEffects": false,
"files": [
"dist"
"dist",
"src"
],
"publishConfig": {
"access": "public"
Expand All @@ -26,7 +27,6 @@
},
"dependencies": {
"@ui-machines/core": "0.0.0",
"@ui-machines/types": "0.0.0",
"hyphenate-style-name": "^1.0.4",
"tiny-guard": "^0.0.3",
"valtio": "^1.2.5"
Expand All @@ -36,5 +36,7 @@
},
"peerDependencies": {
"solid-js": ">=1.1.3"
}
},
"types": "dist/index.d.ts",
"source": "src/index.ts"
}
2 changes: 1 addition & 1 deletion packages/frameworks/solid/src/normalize-props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createNormalizer } from "@ui-machines/types"
import { createNormalizer } from "@ui-machines/utils"
import { isObject, isString } from "tiny-guard"
import { cssify } from "./cssify"

Expand Down
11 changes: 7 additions & 4 deletions packages/frameworks/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
"author": "Segun Adebayo <[email protected]>",
"homepage": "https://github.com/chakra-ui/ui-machines#readme",
"license": "MIT",
"main": "dist/ui-machines-svelte.cjs.js",
"module": "dist/ui-machines-svelte.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"repository": "https://github.com/chakra-ui/ui-machines/tree/main/packages/core/svelte",
"sideEffects": false,
"files": [
"dist"
"dist",
"src"
],
"publishConfig": {
"access": "public"
Expand All @@ -32,5 +33,7 @@
},
"peerDependencies": {
"svelte": "^3.38.2"
}
},
"types": "dist/index.d.ts",
"source": "src/index.ts"
}
12 changes: 7 additions & 5 deletions packages/frameworks/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
"author": "Segun Adebayo <[email protected]>",
"homepage": "https://github.com/chakra-ui/ui-machines#readme",
"license": "MIT",
"main": "dist/ui-machines-vue.cjs.js",
"module": "dist/ui-machines-vue.esm.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"repository": "https://github.com/chakra-ui/ui-machines/tree/main/packages/frameworks/vue",
"sideEffects": false,
"files": [
"dist"
"dist",
"src"
],
"publishConfig": {
"access": "public"
Expand All @@ -26,13 +27,14 @@
},
"dependencies": {
"@ui-machines/core": "0.0.0",
"@ui-machines/types": "0.0.0",
"valtio": "^1.2.5"
},
"devDependencies": {
"vue": "^3.0.5"
},
"peerDependencies": {
"vue": ">=3.0.5"
}
},
"types": "dist/index.d.ts",
"source": "src/index.ts"
}
2 changes: 1 addition & 1 deletion packages/frameworks/vue/src/normalize-props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createNormalizer } from "@ui-machines/types"
import { createNormalizer } from "@ui-machines/utils"

type Dict = Record<string, string>

Expand Down
17 changes: 8 additions & 9 deletions packages/machines/accordion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
"author": "Segun Adebayo <[email protected]>",
"homepage": "https://github.com/chakra-ui/ui-machines#readme",
"license": "MIT",
"main": "dist/ui-machines-accordion.cjs.js",
"types": "dist/ui-machines-accordion.cjs.d.ts",
"module": "dist/ui-machines-accordion.esm.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
"repository": "https://github.com/chakra-ui/ui-machines/tree/main/packages/accordion",
"sideEffects": false,
"files": [
"dist"
"dist",
"src"
],
"publishConfig": {
"access": "public"
Expand All @@ -29,9 +30,7 @@
"url": "https://github.com/chakra-ui/ui-machines/issues"
},
"dependencies": {
"@ui-machines/array-utils": "^0.0.0",
"@ui-machines/core": "^0.0.0",
"@ui-machines/dom-utils": "^0.0.0",
"@ui-machines/types": "^0.0.0"
}
"@ui-machines/core": "^0.0.0"
},
"source": "src/index.ts"
}
2 changes: 1 addition & 1 deletion packages/machines/accordion/src/accordion.connect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dataAttr, getEventKey, EventKeyMap } from "@ui-machines/dom-utils"
import { normalizeProp, PropTypes, ReactPropTypes } from "@ui-machines/types"
import { normalizeProp, PropTypes, ReactPropTypes } from "@ui-machines/utils"
import { dom } from "./accordion.dom"
import type { AccordionItemProps, AccordionSend, AccordionState } from "./accordion.types"

Expand Down
2 changes: 1 addition & 1 deletion packages/machines/accordion/src/accordion.dom.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { queryElements, nextById, prevById } from "@ui-machines/dom-utils/nodelist"
import { first, last } from "@ui-machines/array-utils"
import { first, last } from "../../../utils/array/dist"
import type { AccordionMachineContext as Ctx } from "./accordion.types"

export const dom = {
Expand Down
2 changes: 1 addition & 1 deletion packages/machines/accordion/src/accordion.machine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { add, remove, toArray } from "@ui-machines/array-utils"
import { add, remove, toArray } from "../../../utils/array/dist"
import { createMachine, guards, ref } from "@ui-machines/core"
import { dom } from "./accordion.dom"
import { AccordionMachineContext, AccordionMachineState } from "./accordion.types"
Expand Down
2 changes: 1 addition & 1 deletion packages/machines/accordion/src/accordion.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { StateMachine as S } from "@ui-machines/core"
import type { Context } from "@ui-machines/types"
import type { Context } from "@ui-machines/utils"

export type AccordionMachineContext = Context<{
/**
Expand Down
Loading

0 comments on commit d9daa0d

Please sign in to comment.