forked from chakra-ui/zag
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32cd421
commit e7caf41
Showing
28 changed files
with
8,697 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dist | ||
node_modules | ||
coverage | ||
.next | ||
build | ||
examples/vue-ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 10, | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"project": "tsconfig.json" | ||
}, | ||
"extends": [ | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
"prettier" | ||
], | ||
"plugins": ["jest", "@typescript-eslint/eslint-plugin", "testing-library"], | ||
"env": { | ||
"es6": true, | ||
"browser": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"no-param-reassign": "off", | ||
"no-console": "off", | ||
"jsx-a11y/no-autofocus": "off", | ||
"import/prefer-default-export": "off", | ||
"no-underscore-dangle": "off", | ||
"no-shadow": "off", | ||
"no-plusplus": "off", | ||
"spaced-comment": "off", | ||
"guard-for-in": "off", | ||
"operator-assignment": "off", | ||
"prefer-destructuring": "off", | ||
"consistent-return": "off", | ||
"no-restricted-syntax": "off", | ||
"no-continue": "off", | ||
"eqeqeq": "off", | ||
"@typescript-eslint/dot-notation": "off", | ||
"no-bitwise": "off", | ||
"no-redeclare": "off", | ||
"@typescript-eslint/naming-convention": "off", | ||
"import/no-extraneous-dependencies": "off", | ||
"@typescript-eslint/lines-between-class-members": "off", | ||
"no-alert": "off", | ||
"@typescript-eslint/no-shadow": "off", | ||
"import/no-named-as-default": "off", | ||
"prefer-object-spread": "off", | ||
"arrow-body-style": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"varsIgnorePattern": "^_", | ||
"argsIgnorePattern": "^_", | ||
"ignoreRestSiblings": true | ||
} | ||
], | ||
"default-case": "off" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"parserOptions": { | ||
"project": "tsconfig.eslint.json" | ||
} | ||
}, | ||
{ | ||
"files": ["*.test.*", "*.test.*"], | ||
"extends": ["plugin:jest/recommended", "plugin:jest/style"], | ||
"rules": { | ||
"jsx-a11y/label-has-associated-control": "off", | ||
"global-require": "off", | ||
"no-new": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"**/*.{ts,tsx,js,jsx}": [ | ||
"prettier --write" | ||
], | ||
"**/*.{md,yml,json,babelrc,eslintrc,prettierrc}": [ | ||
"prettier --write" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist | ||
node_modules | ||
coverage | ||
.next | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": false, | ||
"jsxSingleQuote": false, | ||
"printWidth": 80, | ||
"proseWrap": "always", | ||
"semi": false, | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const BABEL_ENV = process.env.BABEL_ENV | ||
const isCommonJS = BABEL_ENV !== undefined && BABEL_ENV === "cjs" | ||
const isESM = BABEL_ENV !== undefined && BABEL_ENV === "esm" | ||
|
||
module.exports = function babelConfig(api) { | ||
api.cache(true) | ||
|
||
const presets = [ | ||
[ | ||
"@babel/env", | ||
{ | ||
loose: true, | ||
modules: isCommonJS ? "commonjs" : false, | ||
targets: { | ||
node: "current", | ||
esmodules: isESM ? true : undefined, | ||
}, | ||
}, | ||
], | ||
"@babel/preset-typescript", | ||
] | ||
|
||
const plugins = [ | ||
["@babel/plugin-proposal-private-methods", { loose: false }], | ||
"@babel/plugin-proposal-class-properties", | ||
] | ||
|
||
return { | ||
presets, | ||
plugins, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "jsdom", | ||
moduleFileExtensions: ["ts", "tsx", "js", "jsx"], | ||
transform: { | ||
"^.+\\.(ts|tsx)?$": "ts-jest/dist", | ||
}, | ||
transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"], | ||
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], | ||
globals: { | ||
"ts-jest": { | ||
tsconfig: "tsconfig.json", | ||
}, | ||
}, | ||
watchPlugins: [ | ||
"jest-watch-typeahead/filename", | ||
"jest-watch-typeahead/testname", | ||
], | ||
collectCoverageFrom: ["**/src/**/*.(ts|tsx)"], | ||
modulePathIgnorePatterns: ["dist"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"name": "ui-machines", | ||
"private": true, | ||
"description": "Chakra UI Core mono repo root package", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/chakra-ui/core.git" | ||
}, | ||
"author": "Segun Adebayo <[email protected]>", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "preconstruct build", | ||
"clean": "yarn workspaces run clean", | ||
"fix:pkgs": "manypkg fix", | ||
"fix:preconstruct": "preconstruct fix", | ||
"gen:pkg": "ts-node scripts/generate-package.ts", | ||
"gen:machine": "ts-node scripts/generate-machine.ts", | ||
"lint": "npm-run-all lint:**", | ||
"lint:code": "eslint . --ext .js,.jsx,.ts,.tsx -c .eslintrc", | ||
"lint:pkgs": "manypkg check", | ||
"lint:types": "tsc --noEmit --incremental", | ||
"lint:validate": "preconstruct validate", | ||
"pkg": "manypkg run", | ||
"prebuild": "yarn clean", | ||
"prepare": "npm-run-all -s prepare:**", | ||
"prepare:husky": "husky install", | ||
"prepare:preconstruct": "preconstruct dev", | ||
"release": "changeset publish", | ||
"start": "preconstruct watch", | ||
"test": "jest --maxWorkers=50%", | ||
"test:ci": "jest --runInBand" | ||
}, | ||
"dependencies": { | ||
"@babel/cli": "^7.13.16", | ||
"@babel/core": "^7.14.2", | ||
"@babel/eslint-parser": "^7.14.2", | ||
"@babel/plugin-proposal-class-properties": "^7.13.0", | ||
"@babel/plugin-transform-runtime": "^7.14.3", | ||
"@babel/preset-env": "^7.14.2", | ||
"@babel/preset-typescript": "^7.13.0", | ||
"@babel/runtime": "^7.14.0", | ||
"@changesets/changelog-github": "^0.4.0", | ||
"@changesets/cli": "^2.16.0", | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@manypkg/cli": "^0.17.0", | ||
"@preconstruct/cli": "^2.1.0", | ||
"@testing-library/jest-dom": "^5.12.0", | ||
"@types/form-serialize": "^0.7.1", | ||
"@types/jest": "^26.0.23", | ||
"@types/lodash": "^4.14.169", | ||
"@types/shelljs": "^0.8.8", | ||
"@typescript-eslint/eslint-plugin": "^4.23.0", | ||
"@typescript-eslint/parser": "^4.23.0", | ||
"commitlint": "^12.1.4", | ||
"eslint": "^7.26.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.23.2", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-testing-library": "^4.4.0", | ||
"form-serialize": "^0.7.2", | ||
"husky": "^6.0.0", | ||
"jest": "^26.6.3", | ||
"jest-environment-jsdom": "^26.6.2", | ||
"jest-watch-typeahead": "^0.6.3", | ||
"lint-staged": "^11.0.0", | ||
"lodash": "^4.17.21", | ||
"node-plop": "^0.26.2", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.3.0", | ||
"rimraf": "^3.0.2", | ||
"shelljs": "^0.8.4", | ||
"ts-jest": "^26.5.6", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.4" | ||
}, | ||
"preconstruct": { | ||
"packages": [ | ||
"packages/*" | ||
] | ||
}, | ||
"workspaces": [ | ||
"core/*", | ||
"machines/*", | ||
"examples/*" | ||
] | ||
} |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# @chakra-ui/{{packageName}} | ||
|
||
A Quick description of the package | ||
|
||
> This is an internal utility, not intended for public usage. | ||
|
||
## Installation | ||
|
||
```sh | ||
yarn add @chakra-ui/{{packageName}} | ||
# or | ||
npm i @chakra-ui/{{packageName}} | ||
``` | ||
|
||
## Contribution | ||
|
||
Yes please! See the | ||
[contributing guidelines](https://github.com/chakra-ui/core/blob/main/CONTRIBUTING.md) | ||
for details. | ||
|
||
## Licence | ||
|
||
This project is licensed under the terms of the | ||
[MIT license](https://github.com/chakra-ui/core/blob/main/LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "@ui-machines/{{packageName}}", | ||
"version": "1.0.0", | ||
"description": "{{description}}", | ||
"keywords": ["ui-machines", "state-machine", "statecharts", "xstate", "{{machine}}"], | ||
"author": "Segun Adebayo <sage@adebayosegun.com>", | ||
"homepage": "https://github.com/ui-machines/core#readme", | ||
"license": "MIT", | ||
"main": "dist/ui-machines-{{packageName}}.cjs.js", | ||
"module": "dist/ui-machines-{{packageName}}.esm.js", | ||
"repository": "https://github.com/ui-machines/core/tree/main/packages/{{packageName}}", | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"require": "./dist/ui-machines-{{packageName}}.cjs.js", | ||
"default": "./dist/ui-machines-{{packageName}}.esm.js" | ||
} | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ui-machines/core/issues" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf dist" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./{{machine}}.connect" | ||
export * from "./{{machine}}.machine" |
22 changes: 22 additions & 0 deletions
22
plop-templates/machine-template/src/{{machine}}.connect.ts.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { | ||
defaultPropNormalizer, | ||
PropNormalizer, | ||
StateMachine as S, | ||
} from "@chakra-ui/machine" | ||
import { DOMHTMLProps } from "../type-utils" | ||
import { getElementIds, getElements } from "./{{machine}}.dom" | ||
import { {{capitalize machine}}MachineContext, {{capitalize machine}}MachineState } from "./{{machine}}.machine" | ||
|
||
export function connect{{capitalize machine}}Machine( | ||
state: S.State<{{capitalize machine}}MachineContext, {{capitalize machine}}MachineState>, | ||
send: (event: S.Event<S.AnyEventObject>) => void, | ||
normalize: PropNormalizer = defaultPropNormalizer, | ||
) { | ||
const { context: ctx } = state | ||
const ids = getElementIds(ctx.uid) | ||
|
||
return { | ||
elProps: normalize<DOMHTMLProps>({ | ||
}), | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
plop-templates/machine-template/src/{{machine}}.dom.ts.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { {{capitalize machine}}MachineContext } from "./{{machine}}.machine" | ||
|
||
export function getElementIds(uid: string) { | ||
return { | ||
|
||
} | ||
} | ||
|
||
export function getElements(ctx: {{capitalize machine}}MachineContext) { | ||
const doc = ctx.doc ?? document | ||
const ids = getElementIds(ctx.uid) | ||
|
||
return { | ||
|
||
} | ||
} |
Oops, something went wrong.