-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from dottostack/feat/react
fix: delete unused packages
- Loading branch information
Showing
25 changed files
with
320 additions
and
42 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
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
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,14 @@ | ||
import { DotXStore } from '../create-store' | ||
import { ResolveType } from '../utils/get' | ||
|
||
export interface BindedStore<Data, Path> { | ||
subscribe: (cb: (result: ResolveType<Data, Path>) => void) => () => void | ||
listen: (cb: (result: ResolveType<Data, Path>) => void) => () => void | ||
get: () => ResolveType<Data, Path> | ||
set: (payload: ResolveType<Data, Path>) => ResolveType<Data, Path> | ||
} | ||
|
||
export function bind<Data, Path extends string>( | ||
store: DotXStore<Data>, | ||
path: Path | ||
): BindedStore<Data, Path> |
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,7 @@ | ||
import { computed, take } from '../computed' | ||
|
||
export const bind = (store, path) => { | ||
let bindedStore = computed(() => take(store, path)) | ||
bindedStore.set = store.set.bind(store, path) | ||
return bindedStore | ||
} |
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,17 @@ | ||
import { createStore } from '../create-store' | ||
import { bind } from './index' | ||
|
||
describe('bind', () => { | ||
it('get', () => { | ||
let store = createStore({ some: 1 }) | ||
let some = bind(store, 'some') | ||
expect(some.get()).toBe(1) | ||
}) | ||
it('set', () => { | ||
let store = createStore({ some: 1 }) | ||
let some = bind(store, 'some') | ||
expect(some.set(2)).toBe(2) | ||
expect(some.get()).toBe(2) | ||
expect(store.get('some')).toBe(2) | ||
}) | ||
}) |
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
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { target } from './context' | ||
|
||
export const take = (store, query) => { | ||
if (!store.set) return store.get(true) | ||
if (store._run) return store.get(true) | ||
let container = target() | ||
return container.silent | ||
return !container || container.silent | ||
? store.get(query) | ||
: (container.add(store, query), store.get(query)) | ||
} |
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
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
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
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
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
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
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
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
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,10 @@ | ||
yarn-error.log | ||
yarn.lock | ||
|
||
coverage/ | ||
**/types.ts | ||
**/*.test.ts | ||
tsconfig.json | ||
test/ | ||
ideas | ||
wip |
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 @@ | ||
export { useSelector } from './useSelector' |
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 @@ | ||
export { useSelector } from './useSelector' |
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,133 @@ | ||
{ | ||
"name": "@dotto.x/react", | ||
"version": "0.2.3", | ||
"description": "A tiny state manager", | ||
"main": "index.js", | ||
"repository": "https://github.com/dottostack/dotto.x", | ||
"author": "Eddort <webisforce@gmail.com>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"private": true, | ||
"type": "module", | ||
"types": "./index.d.ts", | ||
"scripts": { | ||
"test": "echo 'todo'", | ||
"test:wip": "node --experimental-vm-modules ../../node_modules/.bin/jest --runInBand --coverage && eslint . && check-dts && yarn size && yaspeller *.md", | ||
"test:watch": "node --experimental-vm-modules ../../node_modules/.bin/jest --runInBand --watch", | ||
"size": "size-limit", | ||
"deploy": "npx clean-publish" | ||
}, | ||
"peerDependencies": { | ||
"dotto.x": "0.2.3", | ||
"react": ">=16.8.0", | ||
"react-dom": ">=16.8.0" | ||
}, | ||
"clean-publish": { | ||
"files": [ | ||
"logo.png", | ||
"ideas.md" | ||
], | ||
"packageManager": "npm", | ||
"access": "public" | ||
}, | ||
"prettier": { | ||
"arrowParens": "avoid", | ||
"jsxSingleQuote": false, | ||
"quoteProps": "consistent", | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none" | ||
}, | ||
"jest": { | ||
"modulePathIgnorePatterns": [ | ||
"wip" | ||
], | ||
"preset": "ts-jest/presets/default-esm", | ||
"globals": { | ||
"ts-jest": { | ||
"useESM": true | ||
} | ||
}, | ||
"testEnvironment": "jsdom", | ||
"coverageThreshold": { | ||
"global": { | ||
"statements": 100 | ||
} | ||
} | ||
}, | ||
"eslintConfig": { | ||
"extends": "@logux/eslint-config/esm", | ||
"rules": { | ||
"@typescript-eslint/unified-signatures": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"symbol-description": "off", | ||
"consistent-return": "off", | ||
"camelcase": "off", | ||
"import/extensions": "off" | ||
}, | ||
"globals": { | ||
"jsdom": false | ||
} | ||
}, | ||
"yaspeller": { | ||
"lang": "en", | ||
"ignoreCapitalization": true, | ||
"ignoreText": [ | ||
" \\(by [^)]+\\).", | ||
"\\d+\\.\\d+ “[^”]+”" | ||
], | ||
"excludeFiles": [ | ||
".git", | ||
"node_modules", | ||
"ideas.md" | ||
], | ||
"dictionary": [ | ||
"dotto", | ||
"Redux", | ||
"devtools", | ||
"splited", | ||
"JS", | ||
"Shakable", | ||
"gzipped", | ||
"WIP" | ||
] | ||
}, | ||
"size-limit": [ | ||
{ | ||
"name": "all", | ||
"path": "./index.js" | ||
} | ||
], | ||
"exports": { | ||
".": "./index.js" | ||
}, | ||
"engines": { | ||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0" | ||
}, | ||
"devDependencies": { | ||
"@logux/eslint-config": "^45.4.4", | ||
"@size-limit/preset-small-lib": "^5.0.1", | ||
"@types/jest": "^26.0.24", | ||
"@typescript-eslint/eslint-plugin": "^4.28.0", | ||
"@typescript-eslint/parser": "^4.28.0", | ||
"check-dts": "^0.5.3", | ||
"dotto.x": "^0.2.3", | ||
"eslint": "^7.29.0", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-es5": "^1.5.0", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prefer-let": "^1.1.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-security": "^1.4.0", | ||
"eslint-plugin-unicorn": "^33.0.1", | ||
"jest": "^27.0.6", | ||
"prettier": "^2.3.2", | ||
"size-limit": "^5.0.1", | ||
"ts-jest": "^27.0.3", | ||
"typescript": "^4.3.4", | ||
"yaspeller": "^7.0.0" | ||
} | ||
} |
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,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2018", | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"allowJs": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"jsx": "react" | ||
} | ||
} |
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 @@ | ||
import { DotXStore, ResolveType } from 'dotto.x' | ||
|
||
export function useSelector<Data, Selector extends string>( | ||
store: DotXStore<Data>, | ||
selector: Selector | ||
): ResolveType<Data, Selector> |
Oops, something went wrong.