Skip to content

Commit

Permalink
Docs for v4
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulLeCam committed Jan 16, 2022
1 parent ec73a96 commit 77b8aa5
Show file tree
Hide file tree
Showing 19 changed files with 1,427 additions and 825 deletions.
File renamed without changes.
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
"types:react-leaflet": "yarn workspace react-leaflet run build:types",
"build:types": "yarn run types:core && yarn run types:react-leaflet",
"build:website": "yarn workspace website run build",
"build": "yarn turbo run build:js && yarn run build:types && yarn run build:website"
"build": "yarn turbo run build:clean && yarn run build:types && yarn turbo run build:js && yarn run build:website"
},
"devDependencies": {
"@skypack/package-check": "^0.2.2",
"@swc/cli": "^0.1.55",
"@swc/core": "^1.2.126",
"@swc/jest": "^0.2.15",
"@swc/core": "^1.2.129",
"@swc/jest": "^0.2.17",
"@testing-library/react": "^13.0.0-alpha",
"@testing-library/react-hooks": "^8.0.0-alpha",
"@types/jest": "^27.4.0",
"@types/leaflet": "^1.7.8",
"@types/warning": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"cross-env": "^7.0.3",
"del-cli": "^4.0.1",
"eslint": "^8.6.0",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-node": "^11.1.0",
Expand All @@ -43,7 +43,8 @@
"react": "^18.0.0-rc",
"react-dom": "^18.0.0-rc",
"react-test-renderer": "^18.0.0-rc",
"turbo": "^1.0.24",
"ts-jest-resolver": "^2.0.0",
"turbo": "^1.0.28",
"typescript": "^4.5.4"
},
"jest": {
Expand All @@ -53,12 +54,8 @@
},
"turbo": {
"pipeline": {
"clean": {},
"build:js": {
"dependsOn": [
"^clean"
]
}
"build:clean": {},
"build:js": {}
}
}
}
14 changes: 7 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"sideEffects": false,
"scripts": {
"build:clean": "del lib",
"build:js": "swc src -d ./lib --config-file ../../swc.json",
"build:js": "swc src -d ./lib --config-file ../../.swcrc",
"build:types": "tsc --emitDeclarationOnly",
"build": "yarn run build:clean && yarn run build:js && yarn run build:types",
"build": "yarn run build:clean && yarn run build:types && yarn run build:js",
"test:types": "tsc --noEmit",
"test:unit": "cross-env NODE_ENV=test jest",
"test": "yarn run test:types && yarn run test:unit",
Expand All @@ -45,19 +45,19 @@
"react": "^18.0.0-rc",
"react-dom": "^18.0.0-rc"
},
"devDependencies": {
"@react-leaflet/jest-resolver": "^1.0.0"
},
"jest": {
"extensionsToTreatAsEsm": [
".ts",
".tsx"
],
"resolver": "@react-leaflet/jest-resolver",
"resolver": "ts-jest-resolver",
"testEnvironment": "jsdom",
"transform": {
"^.+\\.(t|j)sx?$": [
"@swc/jest"
"@swc/jest",
{
"root": "../.."
}
]
}
}
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export type PropsWithChildren = {
export function createContainerComponent<E, P extends PropsWithChildren>(
useElement: ElementHook<E, P>,
) {
function ContainerComponent(props: P, ref: Ref<E>) {
function ContainerComponent(props: P, forwardedRef: Ref<E>) {
const { instance, context } = useElement(props).current
useImperativeHandle(ref, () => instance)
useImperativeHandle(forwardedRef, () => instance)

return props.children == null ? null : (
<LeafletProvider value={context}>{props.children}</LeafletProvider>
Expand All @@ -38,11 +38,11 @@ export function createDivOverlayComponent<
E extends DivOverlay,
P extends PropsWithChildren,
>(useElement: ReturnType<DivOverlayHook<E, P>>) {
function OverlayComponent(props: P, ref: Ref<E>) {
function OverlayComponent(props: P, forwardedRef: Ref<E>) {
const [isOpen, setOpen] = useState(false)
const { instance } = useElement(props, setOpen).current

useImperativeHandle(ref, () => instance)
useImperativeHandle(forwardedRef, () => instance)
useEffect(
function updateOverlay() {
if (isOpen) {
Expand All @@ -61,9 +61,9 @@ export function createDivOverlayComponent<
}

export function createLeafComponent<E, P>(useElement: ElementHook<E, P>) {
function LeafComponent(props: P, ref: Ref<E>) {
function LeafComponent(props: P, forwardedRef: Ref<E>) {
const { instance } = useElement(props).current
useImperativeHandle(ref, () => instance)
useImperativeHandle(forwardedRef, () => instance)

return null
}
Expand Down
33 changes: 0 additions & 33 deletions packages/jest-resolver/LICENSE.md

This file was deleted.

12 changes: 0 additions & 12 deletions packages/jest-resolver/index.js

This file was deleted.

16 changes: 0 additions & 16 deletions packages/jest-resolver/package.json

This file was deleted.

12 changes: 7 additions & 5 deletions packages/react-leaflet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"sideEffects": false,
"scripts": {
"build:clean": "del lib",
"build:js": "swc src -d ./lib --config-file ../../swc.json",
"build:js": "swc src -d ./lib --config-file ../../.swcrc",
"build:types": "tsc --emitDeclarationOnly",
"build": "yarn run build:clean && yarn run build:js && yarn run build:types",
"build": "yarn run build:clean && yarn run build:types && yarn run build:js",
"test:types": "tsc --noEmit",
"test:unit": "cross-env NODE_ENV=test jest",
"test": "yarn run test:types && yarn run test:unit",
Expand All @@ -50,19 +50,21 @@
"react-dom": "^18.0.0-rc"
},
"devDependencies": {
"@react-leaflet/jest-resolver": "^1.0.0",
"@types/leaflet": "^1.7.8"
},
"jest": {
"extensionsToTreatAsEsm": [
".ts",
".tsx"
],
"resolver": "@react-leaflet/jest-resolver",
"resolver": "ts-jest-resolver",
"testEnvironment": "jsdom",
"transform": {
"^.+\\.(t|j)sx?$": [
"@swc/jest"
"@swc/jest",
{
"root": "../.."
}
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-leaflet/src/SVGOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export const useSVGOverlay = createLayerHook(useSVGOverlayElement)

function SVGOverlayComponent(
{ children, ...options }: SVGOverlayProps,
ref: Ref<LeafletSVGOverlay>,
forwardedRef: Ref<LeafletSVGOverlay>,
) {
const { instance, container } = useSVGOverlay(options).current
useImperativeHandle(ref, () => instance)
useImperativeHandle(forwardedRef, () => instance)

return container == null || children == null
? null
Expand Down
Loading

0 comments on commit 77b8aa5

Please sign in to comment.