-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dependencies update, exposed new APIs (#77)
* New build system, updating ogma and react * Exposed two more layer APIs, fixed the tests, moved to vite for the build * Removed typehead, fixed types * Scripts and version * gh-pages directory update * web -> demo * Trying to fix the coverage reports * Fixed the react 18 mode * Fixed the typings
- Loading branch information
Showing
53 changed files
with
4,918 additions
and
1,671 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 4.3.3 | ||
current_version = 4.6.0 | ||
commit = False | ||
tag = False | ||
serialize = | ||
|
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 +1 @@ | ||
4.3.3 | ||
4.6.0 |
File renamed without changes.
File renamed without changes.
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,14 +1,13 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>React Ogma; component</title> | ||
<link href="index-bundle.css" rel="stylesheet" /> | ||
<title>React Ogma component</title> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css" | ||
/> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script src="index-bundle.js" type="module"></script> | ||
<script src="index.tsx" type="module"></script> | ||
</body> |
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,15 +1,17 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import { createRoot } from "react-dom/client"; | ||
import "./src/index.css"; | ||
import App from "./src/App"; | ||
import { GeistProvider, CssBaseline } from "@geist-ui/core"; | ||
|
||
ReactDOM.render( | ||
const container = document.getElementById("root")!; | ||
const root = createRoot(container); | ||
|
||
root.render( | ||
<React.StrictMode> | ||
<GeistProvider> | ||
<CssBaseline /> | ||
<App /> | ||
</GeistProvider> | ||
</React.StrictMode>, | ||
document.getElementById("root") | ||
</React.StrictMode> | ||
); |
File renamed without changes
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
File renamed without changes.
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
11 changes: 7 additions & 4 deletions
11
web/src/components/Layout.tsx → demo/src/components/Layout.tsx
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
File renamed without changes.
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 @@ | ||
.position-control__container { | ||
position: absolute; | ||
top: 15px; | ||
left: 20em; | ||
color: #888; | ||
padding: 0.5em; | ||
font-size: x-small; | ||
} |
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,36 @@ | ||
import { Point, Layer as OgmaLayer } from "@linkurious/ogma"; | ||
import { useEffect, useState, useCallback, useRef } from "react"; | ||
import { useOgma, Layer } from "../../../src"; | ||
import "./MousePosition.css"; | ||
|
||
export const MousePosition = () => { | ||
const ogma = useOgma(); | ||
const [position, setPosition] = useState<Point>({ x: 0, y: 0 }); | ||
const layerRef = useRef<OgmaLayer>(null); | ||
|
||
const requestSetPosition = useCallback( | ||
(pos: Point) => { | ||
requestAnimationFrame(() => setPosition(pos)); | ||
}, | ||
[setPosition] | ||
); | ||
|
||
useEffect(() => { | ||
const listener = () => { | ||
const { x, y } = ogma.getPointerInformation(); | ||
requestSetPosition({ x, y }); | ||
}; | ||
ogma.events.on("mousemove", listener); | ||
return () => { | ||
ogma.events.off(listener); | ||
}; | ||
}, [ogma]); | ||
|
||
return ( | ||
<Layer className="position-control" ref={layerRef}> | ||
<div className="position-control__container"> | ||
{position.x}, {position.y} | ||
</div> | ||
</Layer> | ||
); | ||
}; |
File renamed without changes.
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,30 @@ | ||
export const ShuffleIcon = ({ width = 12, height = 12 }) => { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width={width} | ||
height={height} | ||
fill="currentColor" | ||
strokeWidth="0" | ||
style={{ overflow: "visible", color: "currentcolor" }} | ||
viewBox="0 0 512 512" | ||
> | ||
<path | ||
fill="none" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="32" | ||
d="m400 304 48 48-48 48M400 112l48 48-48 48M64 352h85.19a80 80 0 0 0 66.56-35.62L256 256" | ||
/> | ||
<path | ||
fill="none" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="32" | ||
d="M64 160h85.19a80 80 0 0 1 66.56 35.62l80.5 120.76A80 80 0 0 0 362.81 352H416m0-192h-53.19a80 80 0 0 0-66.56 35.62L288 208" | ||
/> | ||
</svg> | ||
); | ||
}; |
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 @@ | ||
.grouping-controls button { | ||
position: fixed; | ||
top: 60px; | ||
right: 20px; | ||
background-color: transparent; | ||
border: 1px solid #ddd; | ||
border-radius: 6px; | ||
min-width: 18px; | ||
color: #aaa; | ||
cursor: pointer; | ||
} | ||
|
||
.grouping-controls button:hover { | ||
border-color: #444; | ||
color: #444; | ||
} |
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,30 @@ | ||
import { FC, useCallback } from "react"; | ||
import { Layer, NodeGroupingProps } from "../../../src"; | ||
import "./UpdateGroupingButton.css"; | ||
import { ShuffleIcon } from "./ShuffleIcon"; | ||
|
||
type ND = { categories: string[] }; | ||
type ED = {}; | ||
|
||
export const UpdateGroupingButton: FC<{ | ||
options: NodeGroupingProps<ND, ED>; | ||
update: (options: NodeGroupingProps<ND, ED>) => void; | ||
}> = ({ options, update }) => { | ||
const onClick = useCallback(() => { | ||
update({ | ||
...options, | ||
groupIdFunction: (node) => { | ||
const categories = node.getData("categories"); | ||
return categories[0] === "INVESTOR" ? "INVESTOR" : "OTHER"; | ||
}, | ||
}); | ||
}, [options]); | ||
|
||
return ( | ||
<Layer className="grouping-controls"> | ||
<button onClick={onClick}> | ||
<ShuffleIcon /> | ||
</button> | ||
</Layer> | ||
); | ||
}; |
File renamed without changes.
Oops, something went wrong.