MCPcopy
hub / github.com/vugu/vugu

github.com/vugu/vugu @v0.4.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.4.0 ↗
2,436 symbols 6,052 edges 280 files 521 documented · 21%
README

Vugu

Travis CI GoDoc stability-experimental

Vugu is an experimental library for web UIs written in Go and targeting webassembly. Guide and docs at https://www.vugu.org. Godoc at https://godoc.org/github.com/vugu/vugu.

If you've ever wanted to write a UI not in JS but pure Go... and run it in your browser, right now... That (experimental;) future is here!

Introducing Vugu (pronounced /ˈvuː.ɡuː/), a VueJS-inspired library in Go targeting wasm.

No node. No JS. No npm. No node_modules folder competing with your music library for disk space.

Updates ♨

  • 2024-05-25 Move to a mage based build process Join the conversation: Gophers on Slack, channel #vugu

Highlights

  • Runs in-browser using WebAssembly
  • Single-file components
  • Vue-like markup syntax
  • Write idiomatic Go code
  • Rapid prototyping
  • ~3 minute setup
  • Standard Go build tools

Start

Get started: http://www.vugu.org/doc/start

Still a work in progress, but a lot of things are already functional. Some work really well.

You must have Go v1.22.3 as a minimum to use vugu. We require the for loop changes that were introduced in Go v1.22, and v1.22.3 was the lastest at the time writing.

Building vugu for Contributors

vugu now uses mage to manage the build of the vugu tools - vugugen, vugufmt and vgfrom. Mage is also used to manage the testing process.

Please see the updated build instruction in the Contributors Guide

Abbreviated Roadmap

  • [x] Move to a Mage based build
  • [x] Single-file components (looks similar to .vue); .vugu -> .go code generation.
  • [x] Includes CSS in components.
  • [x] Basic flow control with vg-if, vg-for and output with vg-content.
  • [x] Dynamic attributes with <tag :prop='expr'>.
  • [x] Nested components with dynamic properties
  • [x] Efficiently syncs to browser DOM.
  • [x] Static HTML output (great for tests).
  • [x] DOM Events, click, etc.
  • [x] Modification tracking to avoid unnecessary computation where possible.
  • [x] Basic dev and prod server tooling, easy to get started
  • [x] Rewrite everything so it is not so terrible internally
  • [x] URL Router (in-progress)
  • [x] Tinygo compilation support
  • [x] Server-side rendering (works, needs more documentation and examples)
  • [x] Go-only component events
  • [x] Slots
  • [ ] Component library(s) (wip!)
  • [ ] Performance optimizations
  • And much more...

Notes

It's built more like a library than a framework. While Vugu does do code generation for your .vugu component files, (and will even output a default main_wasm.go for a new project and build your program automatically upon page refresh), fundamentally you are still in control. Overall program flow, application wiring and initialization, the render loop that keeps the page in sync with your components - you have control over all of that. Frameworks call your code. Vugu is a library, your code calls it (even if Vugu generates a bit of that for you in the beginning to make things easier). One of the primary goals for Vugu, when it comes to developers first encountering it, was to make it very fast and easy to get started, but without imposing unnecessary limitations on how a project is structured. Go build tooling (and now the module system) is awesome. The idea is to leverage that to the furthest extent possible, rather than reprogramming the wheel.

So you won't find a vugu command line tool that runs a development server, instead you'll find in the docs an appropriate snippet of code you can paste in a file and go run yourself. For the code generation while there is an http.Handler that can do this upon page refresh, you also can (and should!) run vugugen via go generate. There are many small decisions in Vugu which follow this philosophy: wherever reasonably possible, just use the existing mechanism instead of inventing anew. And keep doing that until there's proof that something else is really needed. So far it's been working well. And it allows Vugu to focus on the specific things it brings to the table.

Examples

Examples of implementations can be found into examples repositories

VSCode plugin

As most of your code will be in .vugu files, you will need to install vscode-vugu Credits goes to @binhonglee.

Extension points exported contracts — how you extend this code

InitCtx (Interface)
UnlockRenderer is something that releases a lock and requests a re-render. type UnlockRenderer interface { UnlockRender [7 …
lifecycle.go
Builder (Interface)
FIXME: CSS and JS are now full element nodes not just blocks of text (style, link, or script tags), and we should have s [5 …
component.go
VGAttributeLister (Interface)
VGAttributeLister implements the required functionality, required by the `:=` attribute setter. Types may implement this [2 …
attribute-lister.go
Compiler (Interface)
Compiler is implemented by WasmCompiler and TinygoCompiler. [2 implementers]
devutil/handlers.go
DOMEvent (Interface)
DOMEvent is an event originated in the browser. It wraps the JS event that comes in. It is meant to be used in WebAssem [1 …
events-dom.go
StringValuer (Interface)
StringValuer is a string that can be gotten and set. [1 implementers]
vgform/values.go
Wrapper (Interface)
Wrapper placeholder for syscall/js [1 implementers]
js/impl-nonjs.go
Wrapper (Interface)
Wrapper alias to syscall/js [1 implementers]
js/impl-js.go

Core symbols most depended-on inside this repo

push
called by 142
vugufmt/tokenstack.go
Run
called by 115
gen/parser-go-pkg.go
New
called by 77
js/impl-js.go
ModCheckAll
called by 71
mod-check-tinygo.go
TrackNext
called by 68
mod-check-tinygo.go
Click
called by 64
wasm-test-suite/test-022-event-listener/root.go
addElement
called by 48
internal/htmlx/parse.go
Get
called by 47
js/impl-js.go

Shape

Function 1,382
Method 803
Struct 130
Class 58
Interface 33
TypeAlias 23
FuncType 7

Languages

TypeScript55%
Go45%

Modules by API surface

internal/htmlx/parse.go51 symbols
wasm-test-suite/test-024-event-buffer-size/wasm_exec.js49 symbols
wasm-test-suite/test-023-lifecycle-callbacks/wasm_exec.js49 symbols
wasm-test-suite/test-022-event-listener/wasm_exec.js49 symbols
wasm-test-suite/test-021-slots/wasm_exec.js49 symbols
wasm-test-suite/test-020-vgform/wasm_exec.js49 symbols
wasm-test-suite/test-019-js-create-populate/wasm_exec.js49 symbols
wasm-test-suite/test-018-comp-events/wasm_exec.js49 symbols
wasm-test-suite/test-017-nesting/wasm_exec.js49 symbols
wasm-test-suite/test-016-svg/wasm_exec.js49 symbols
wasm-test-suite/test-015-attribute-lister/wasm_exec.js49 symbols
wasm-test-suite/test-014-attrintf/wasm_exec.js49 symbols

Dependencies from manifests, versioned

github.com/chromedp/cdprotov0.0.0-2023112623210 · 1×
github.com/chromedp/sysutilv1.0.0 · 1×
github.com/gobwas/httpheadv0.1.0 · 1×
github.com/gobwas/poolv0.2.1 · 1×
github.com/josharian/internv1.0.0 · 1×
github.com/magefile/magev1.15.0 · 1×
github.com/pmezard/go-difflibv1.0.0 · 1×

For agents

$ claude mcp add vugu \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact