Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/psygo/hookban
A hookable goban
https://github.com/psygo/hookban
baduk go goban web-components weiqi
Last synced: 16 days ago
JSON representation
A hookable goban
- Host: GitHub
- URL: https://github.com/psygo/hookban
- Owner: psygo
- Created: 2024-05-25T12:32:02.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-28T11:54:50.000Z (7 months ago)
- Last Synced: 2024-11-26T22:13:25.105Z (26 days ago)
- Topics: baduk, go, goban, web-components, weiqi
- Language: TypeScript
- Homepage:
- Size: 223 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hookban
A hookable goban.
A composable goban with no dependencies, made entirely with Vanilla JS and Web Components, which makes integration into any web platform easier.
The 2 key features of this implementation would be:
- Communication through events
- Hooks for when things change.## How It Works
> Check out the [`example_1.html`](./src/examples/example_1.html) for more info.
### A Goban in Layers
We can achieve more fine grained control, and simpler components by deconstructing goban features into layers:
```html
```
By decomposing things in this way, anyone can easily create other custom layers as well. Ideally, each layer should be simple enough, that a developer could simply copy paste the original code and alter it in a couple of hours, I believe.
Then, it's just a matter of setting properties on each HTML component:
```html
Color
``````js
const backgroundColorInput = document.querySelector(
"#background-color"
)backgroundColorInput.addEventListener("input", (e) => {
const hookbanBackground = document.querySelector(
"hookban-background"
)
hookbanBackground.setAttribute("color", e.target.value)
})
```Or, alternatively, we could also use them as JS objects, and later append them to the DOM.
### But what about SGF and Go rules?
I think that, for the sake of simplicity and separation of concerns, this shouldn't be coupled with the UI. I recommend keeping controls outside the Goban UI, and then use them to communicate things in and out of the UI. I do have plans of packaging all of it in a macro component at some point.