diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 549f8a2..b671bf7 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -37,7 +37,7 @@ jobs: - name: Install Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23.4' - name: Install Core run: go install cogentcore.org/core/cmd/core@main diff --git a/content/blog/-v0.4.md b/content/blog/-v0.4.md deleted file mode 100644 index 0c41d77..0000000 --- a/content/blog/-v0.4.md +++ /dev/null @@ -1,29 +0,0 @@ -# WIP v0.4 Release Notes - -*Link to video version* - -## GopherJS - -## HTML preview / SEO - -## WebGPU - -Implications: - -* xyz, video on web -* Broader device support (no more Vulkan feature issues) -* macOS setup, iOS app bundle simpler (no more Vulkan) -* New C compiler on Windows; users who installed TDM-GCC previously or get warnings should run core setup again -* Need to reinstall the core tool for many of these changes; should probably mention toward the top and recommend doing for each new release - -## Hardware acceleration - -## Scrolling - -## App bar - -## Breaking changes - -## Other changes - -## Future directions diff --git a/content/blog/2024-07-24-initial-release.md b/content/blog/2024-07-24-initial-release.md deleted file mode 100644 index b1c1b35..0000000 --- a/content/blog/2024-07-24-initial-release.md +++ /dev/null @@ -1,209 +0,0 @@ -+++ -author = ["Kai O'Reilly", "Randy O'Reilly"] -+++ - -*For a video introduction to Cogent Core, see https://youtu.be/nZzdy3Kyypk* - -Today we are announcing the initial public release of the Cogent Core GUI framework. Cogent Core allows you to build powerful, fast, elegant apps that run on all platforms with a single Go codebase, allowing you to Code Once, Run Everywhere (Core). This blog is an interactive Cogent Core app running on the web using [wasm](https://en.wikipedia.org/wiki/WebAssembly). The same code can run on macOS, Windows, Linux, iOS, Android, and the web through a command line tool that manages all the details for running and building apps for each platform. - -![The same Cogent Core app running on many devices using the same code](../media/initial-release/devices.jpg) - -*The same Cogent Core app running on many devices using the same code* - -Cogent Core is written in [Go](https://go.dev) and inherits many features from this language and its associated ecosystem. Go code is simple and easy to read and write, and it emphasizes a minimalist approach without the extra syntax and boilerplate that clutters other languages. - -Here's a simple hello world app in Cogent Core: - -```Go -package main - -import "cogentcore.org/core/core" - -func main() { - b := core.NewBody() - core.NewButton(b).SetText("Hello, World!") - b.RunMainWindow() -} -``` - -See that "Hello, World!" button? That is a live rendering of the code shown in the text editor above. You can change the message in the code, press `Ctrl+Enter` or just click off, and you'll see it update! - -Cogent Core supports all the usual types of GUI widgets, along with some fairly advanced ones not found in other frameworks. Interactive, editable examples of all major widgets are available on the main [docs](https://www.cogentcore.org/core) page (which is also a Cogent Core app running via wasm). - -Here's a small sample of widgets, and a few things you can do with them: - -```Go -core.NewButton(b).SetText("Send").SetIcon(icons.Send).OnClick(func(e events.Event) { - core.MessageSnackbar(b, "Message sent") -}) -core.NewText(b).SetText("Name:").SetTooltip("Enter your name in the text field") -core.NewTextField(b).SetPlaceholder("Jane Doe") -value := 0.5 -spinner := core.Bind(&value, core.NewSpinner(b)) -slider := core.Bind(&value, core.NewSlider(b)) -spinner.OnChange(func(e events.Event) { - slider.Update() -}) -slider.OnChange(func(e events.Event) { - spinner.Update() -}) -core.NewColorButton(b).SetColor(colors.Orange) -type language struct { - Name string - Rating int -} -sl := []language{{"Go", 10}, {"Python", 5}} -core.NewTable(b).SetSlice(&sl).OnChange(func(e events.Event) { - core.MessageSnackbar(b, fmt.Sprintf("Languages: %v", sl)) -}) -``` - -Again, you can modify any of the code above and immediately see the effects! - -You can even make interactive plots of data: - -```Go -type Data struct { - Time float32 - Users float32 - Profit float32 -} -plotcore.NewPlotEditor(b).SetSlice([]Data{ - {0, 500, 1520}, - {1, 800, 860}, - {2, 1600, 930}, - {3, 1400, 682}, -}) -``` - -## Key features - -The key feature of Cogent Core is that it allows you to efficiently write full-scale GUI apps in Go, with greater power and elegance than other frameworks. Specifically: - -* It provides a full set of GUI widgets, with built-in support for most elements of the [Material 3](https://m3.material.io) standard, with tooltips, drag-and-drop, sprites, popup completion, a full text editor with code highlighting, and other advanced features, allowing powerful apps to be assembled by customizing these existing elements. - -* Extensive styling properties allow everything to be customized, including a powerful automatic layout system that solves all the hard layout problems for you, and complete event-driven control over app behavior. Styling is easy to control and well documented, and anyone can quickly customize widgets to fit their needs. - -* Responsive widget elements automatically adapt to different screen sizes and orientations, enabling one coherent codebase to run across different platforms. - -* The code to implement standard widgets is transparent and elegant, making it easy to write your own custom widget elements if needed. - -* A dynamic color system based on Material Design 3 enables effortless switching between light and dark mode and gives developers and users the ability to easily customize the colors of an app while maintaining key contrast and legibility standards: - - - -* Automatic views of any Go data structure, including slices, structs, and maps, allow for instant data binding and advanced app inspection, making complex widgets like editable tables, trees, and forms take just one line of code. - -* [SVG](https://cogentcore.org/core/widgets/media/svg), [HTML](https://cogentcore.org/core/widgets/other/html), [Markdown](https://cogentcore.org/core/widgets/other/html), [Canvas](https://cogentcore.org/core/widgets/media/canvases), [Video](https://www.cogentcore.org/core/widgets/media/videos), and [3D](https://www.cogentcore.org/core/widgets/other/xyz) support make it possible to create engaging multimedia experiences from 3D models to games, and documentation and blogs like you're reading now. - -![Screenshot of Cogent Core 3D Demo](../media/initial-release/xyz-demo.jpg) - -*Screenshot of Cogent Core 3D Demo* - -* [Plans](https://cogentcore.org/core/basics/plans) provide an efficient mechanism for dynamically updating content in a way that captures the best of imperative and declarative GUI paradigms. - -* A focus on keyboard navigation and user customization enables streamlined access to important functionality with any keybindings, with a dynamic search bar giving convenient access to all app actions on every platform. - -* [Vulkan](https://en.wikipedia.org/wiki/Vulkan), a modern, cross-platform, high-performance graphics framework, allows apps to run on all platforms at extremely fast speeds. All Cogent Core apps compile to machine code, allowing them to run without any overhead. - -* Cogent Core is completely free and open source under the permissive [BSD-3 License](https://github.com/cogentcore/core/blob/main/LICENSE), allowing you to use it for any purpose, commercially or personally. We believe that software works best when everyone can use it. - -## Our story - -We are committed to supporting Cogent Core and growing a full software ecosystem around it, building on where Cogent Core came from and where we want it to go. - -The initial version of this software was named [GoKi](https://github.com/goki/gi). It was written in 2018 by Professor Randy O'Reilly to enable him to develop advanced [neural network models](https://emersim.org) of the brain using Go, instead of C++. He had grown frustrated with the long build times and tiresome boilerplate involved in coding in C++. At that time, Python was becoming increasingly popular, but it is really just a wrapper around C++, resulting in a complex and unpleasant combination of two languages. Go, by contrast, compiles nearly instantly, and runs nearly as fast as C++, providing a clean one-language solution. The small difference in compute time (less than 5-10%) was more than made up for by the massive increase in coding efficiency and overall happiness from using Go. - -The only thing missing from the Go ecosystem at the time was a full-featured native GUI framework, so Randy built on his experience with [Qt](https://en.wikipedia.org/wiki/Qt_(software)) to write one in Go. GoKi provided a powerful 2D and 3D interface that enabled experts, as well as undergraduate and graduate students in classes taught by professors around the world, to better understand and develop new ideas about how the brain works. However, as a first effort in Go, GoKi retained too much of the C++ style. - -![Screenshot of a neural network model built with Cogent Core](../media/initial-release/emer-choose.jpg) - -*Screenshot of a neural network model built with Cogent Core* - -Meanwhile, Randy's son Kai was busy experimenting with different frameworks and languages for various coding projects. He eventually came to the same conclusion that Go is truly the best language around. After exploring existing GUI frameworks in Go, Kai decided that a major overhaul of GoKi might produce a better framework than any of the other options. - -So the father and son team (more son than father, to be clear) spent the next year rewriting this codebase many times over, peeling away layers of complexity and finding the most robust and elegant solutions to the many problems such a framework must solve. The [principles](https://cogentcore.org/core/architecture/principles) capture some of our hard-won lessons. We hope that the experience of using this framework demonstrates the resulting simplicity and power of the approach. - -Throughout this process, Randy maintained what is now [Cogent Code](https://cogentcore.org/cogent/code) as his primary everyday code editor, and students and colleagues explored and extended the neural network models based on this framework. Therefore, the core of the framework is well-tested and ready to use, even as we continue to build out more features and welcome input from the broader community for how to make it even better. - -![Screenshot of Cogent Code](../media/initial-release/cogent-code.jpg) - -*Screenshot of Cogent Code* - -We each have a long-term commitment to the future of the Cogent Core framework. Randy and other scientists and instructors rely on it for research and teaching. Kai plans to build his career around the framework. He is programming apps in it and is available for consulting projects to develop Cogent Core solutions. - -We think Go is such a special language that it deserves to be used for everything and anything, far beyond its traditional role as a server-side and cli-based workhorse. We hope that the excitement of building toward a world-class GUI framework in our beloved Go language will grow a vibrant community of users and developers. - -## Future directions - -One important future direction, highlighted by the interactive editing ability shown above, is to use the [yaegi](https://github.com/traefik/yaegi) Go interpreter as a replacement for languages like Python so that you can transparently have a dynamic, interpreted experience as well as the lightning-fast compilation of Go. We think this can provide an ideal combination of rapid prototyping and hot-reloading (as in the Flutter framework), within a strongly typed and robust language that scales to large-scale applications (unlike Python and JavaScript). - -In addition, we will continue working on a shell language variant of Go, called `cosh` or [Cogent Shell](https://github.com/cogentcore/core/tree/main/shell), which allows direct intermixing of shell-like execution of command-line tools with standard Go code using yaegi. Everything can be transpiled into standard Go and built the usual way as a fully compiled executable as well. Next, we plan to extend this general approach to the numerical computing and data science domain, in the [Cogent Numbers](https://github.com/cogentcore/cogent/tree/main/numbers) framework, to provide a viable competitor in this Python-dominated space. - -We will also be completing the [Cogent Canvas](https://cogentcore.org/cogent/canvas) app for editing SVG vector graphics, the [Cogent Mail](https://github.com/cogentcore/cogent/tree/main/mail) client, a [terminal emulator](https://github.com/cogentcore/cogent/tree/main/terminal), and a [3D modeling app](https://github.com/cogentcore/cogent/tree/main/craft). We also plan to make a video editor and continue working on a [web browser](https://github.com/cogentcore/cogent/tree/main/web). - -![Screenshot of Cogent Canvas](../media/initial-release/cogent-canvas.jpg) - -*Screenshot of Cogent Canvas* - -We will also prioritize implementing internationalization and accessibility for the next major release of Cogent Core. - -## Comparisons with other frameworks - -In the remainder of this blog, we provide some commentary about how we think Cogent Core compares with other widely used GUI frameworks. - -### Web frameworks - -Most of the world's GUI software is written using one of the many web frameworks, which provide various benefits but come with challenges: - -* The awkward separation of JS, HTML, and CSS makes it hard to create dynamic interfaces without some combination of them, resulting in inconsistent languages like [JSX](https://en.wikipedia.org/wiki/JSX_(JavaScript)) and [SCSS](https://en.wikipedia.org/wiki/Sass_(style_sheet_language)). Cogent Core allows you to write everything in one coherent language. - -* HTML and CSS don’t provide modern-looking widgets out of the box, forcing you to either [wrestle with CSS](https://blog.logrocket.com/creating-custom-css-range-slider-javascript-upgrades/) or depend on one of many inconsistent CSS frameworks. Cogent Core comes with modern and easily customizable widgets without a single line of CSS. - -* Web frameworks are plagued by browser inconsistencies, making things as simple as favicons the subject of [blog posts](https://dev.to/masakudamatsu/favicon-nightmare-how-to-maintain-sanity-3al7) featuring language like “nightmare” and “how to maintain sanity.” Cogent Core apps automatically work consistently across all devices. - -The benefits of Cogent Core relative to the web are highlighted by our [tic-tac-toe tutorial](https://www.cogentcore.org/core/tutorials/tic-tac-toe), which has fewer than half the lines of code of the [React one](https://react.dev/learn/tutorial-tic-tac-toe), while also containing no ternaries and no JSX. - -### Flutter - -Although [Flutter](https://flutter.dev) can be good for creating simple mobile apps, it has several limitations: - -* It is not suitable for building advanced desktop apps, such as those that [need multiple windows](https://github.com/flutter/flutter/issues/30701). Cogent Core has complete desktop support, as evidenced by the powerful multi-window [code editor](https://cogentcore.org/cogent/code) and [neural network models](https://emersim.org) built with it. - -* Flutter’s declarative paradigm creates excessive indentation and makes it hard to integrate logic into GUIs without falling back on ternaries and other such constructs. For example, here is an indentation closing block from the [Flutter sample app](https://github.com/flutter/samples/blob/main/material_3_demo/lib/home.dart): - -```dart - ), - ), - ), - ), - ), - ), - ), - ), - ), - ), - ); - } -} -``` - -Cogent Core uses [plans](https://cogentcore.org/core/basics/plans) to allow for elegant integration of imperative and declarative logic. - -* Flutter contains a lot of repetitive boilerplate, such as `Widget build(BuildContext context)`, and is peppered with distracting keywords like `final`, `required`, and `@override`. Cogent Core works to avoid boilerplate and contains few keywords due to Go’s emphasis on simplicity. - -### Platform-specific frameworks - -Many apps are written using languages specific to certain platforms, such as Swift and Java. However, doing this requires significant duplication of effort as you have to write and maintain your app multiple times if you want it to be cross-platform. Cogent Core allows you to write an app in one language and have it work well on all platforms. - -### Other Go frameworks - -* [Fyne](https://fyne.io) is "fine" overall, but it does not provide the customization and advanced widgets necessary for building powerful apps. Cogent Core enables complete customization and provides a vast array of useful widgets. - -* [Gio](https://gioui.org) has a lot of powerful features, but the low-level nature of the immediate mode design makes it difficult to develop apps since even simple things like making a button with text and an icon can take [30 lines of code](https://git.sr.ht/~eliasnaur/gio-example/tree/main/kitchen/kitchen.go#L225). In Cogent Core, it only takes one line of code to make a button with text and an icon. - -* [Wails](https://wails.io), [go-app](https://go-app.dev), and other such packages suffer many of the same issues as standard web frameworks, as you are still effectively writing JS, HTML, and CSS. Cogent Core allows you to completely bypass web languages and write everything in Go. - -## Conclusion - -Cogent Core brings the power and elegance of the Go programming language to the GUI domain, opening up a whole new world of powerful and exciting applications. As you can see from our interactive [documentation](https://www.cogentcore.org/core) and [videos](https://youtube.com/@CogentCore), once you master a core set of basic concepts, there is no limit to what you can create, with remarkable ease and elegance. diff --git a/content/blog/index.md b/content/blog/index.md deleted file mode 100644 index d7ff7d4..0000000 --- a/content/blog/index.md +++ /dev/null @@ -1 +0,0 @@ -The Cogent Blog, which covers the development of Cogent Core and the Cogent apps. diff --git a/content/community.md b/content/community.md index c4e666f..6c4bf1c 100644 --- a/content/community.md +++ b/content/community.md @@ -1,3 +1,7 @@ ++++ +Categories = ["Resources"] ++++ + For questions and support, you can use the [#cogentcore](https://gophers.slack.com/archives/C07ENRTB2F7) channel on the [Gophers Slack](https://invite.slack.golangbridge.org). For bug reports, feature requests, and questions, you can create issues and discussions in our GitHub [repositories](https://github.com/cogentcore). diff --git a/content/faq.md b/content/faq.md index 4f98498..7903c88 100644 --- a/content/faq.md +++ b/content/faq.md @@ -1,3 +1,9 @@ ++++ +Name = "FAQ" +Title = "FAQ" +Categories = ["Resources"] ++++ + ## Why the name Cogent Core? We use the word Cogent because our focus is on implementing an elegant and idiomatic framework that is clear, consistent, and logical. We use the word Core because a GUI framework is a core part of app development, and it also stands for Code Once, Run Everywhere. diff --git a/content/home.md b/content/home.md new file mode 100644 index 0000000..0288091 --- /dev/null +++ b/content/home.md @@ -0,0 +1,6 @@ ++++ +URL = "" +Title = "" ++++ + + diff --git a/content/index.md b/content/index.md deleted file mode 100644 index 4ffebd0..0000000 --- a/content/index.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/content/media/initial-release/cogent-canvas.jpg b/content/media/initial-release/cogent-canvas.jpg deleted file mode 100644 index e76b86e..0000000 Binary files a/content/media/initial-release/cogent-canvas.jpg and /dev/null differ diff --git a/content/media/initial-release/cogent-code.jpg b/content/media/initial-release/cogent-code.jpg deleted file mode 100644 index b0fa71c..0000000 Binary files a/content/media/initial-release/cogent-code.jpg and /dev/null differ diff --git a/content/media/initial-release/devices.jpg b/content/media/initial-release/devices.jpg deleted file mode 100644 index 2dc38a2..0000000 Binary files a/content/media/initial-release/devices.jpg and /dev/null differ diff --git a/content/media/initial-release/emer-choose.jpg b/content/media/initial-release/emer-choose.jpg deleted file mode 100644 index 2beef52..0000000 Binary files a/content/media/initial-release/emer-choose.jpg and /dev/null differ diff --git a/content/media/initial-release/xyz-demo.jpg b/content/media/initial-release/xyz-demo.jpg deleted file mode 100644 index d6a9436..0000000 Binary files a/content/media/initial-release/xyz-demo.jpg and /dev/null differ diff --git a/go.mod b/go.mod index de4c349..25cc85d 100644 --- a/go.mod +++ b/go.mod @@ -1,24 +1,25 @@ module github.com/cogentcore/cogentcore.github.io -go 1.22 +go 1.23.4 -require cogentcore.org/core v0.3.3-0.20240902172924-b432919e181b +require cogentcore.org/core v0.3.12-0.20250716185014-9cff12b618f7 require ( - github.com/Bios-Marcel/wastebasket v0.0.4-0.20240213135800-f26f1ae0a7c4 // indirect + github.com/Bios-Marcel/wastebasket/v2 v2.0.3 // indirect github.com/Masterminds/vcs v1.13.3 // indirect + github.com/adrg/strutil v0.3.1 // indirect github.com/alecthomas/chroma/v2 v2.13.0 // indirect github.com/anthonynsimon/bild v0.13.0 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/chewxy/math32 v1.10.1 // indirect - github.com/cogentcore/webgpu v0.0.0-20241212004832-ad7475f3b4dd // indirect - github.com/cogentcore/yaegi v0.0.0-20240724064145-e32a03faad56 // indirect + github.com/cogentcore/webgpu v0.23.0 // indirect github.com/dlclark/regexp2 v1.11.0 // indirect github.com/ericchiang/css v1.3.0 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a // indirect - github.com/goki/freetype v1.0.5 // indirect - github.com/gomarkdown/markdown v0.0.0-20240930133441-72d49d9543d8 // indirect + github.com/go-text/typesetting v0.3.1-0.20250402122313-7a0f05577ff5 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b // indirect github.com/gorilla/css v1.0.1 // indirect github.com/h2non/filetype v1.1.3 // indirect github.com/hack-pad/go-indexeddb v0.3.2 // indirect @@ -27,13 +28,13 @@ require ( github.com/jinzhu/copier v0.4.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/pelletier/go-toml/v2 v2.1.2-0.20240227203013-2b69615b5d55 // indirect + github.com/tdewolff/parse/v2 v2.7.19 // indirect golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect - golang.org/x/image v0.18.0 // indirect - golang.org/x/mod v0.19.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect - golang.org/x/tools v0.23.0 // indirect - gonum.org/v1/gonum v0.15.0 // indirect + golang.org/x/image v0.25.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/net v0.38.0 // indirect + golang.org/x/sync v0.12.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/text v0.23.0 // indirect + golang.org/x/tools v0.29.0 // indirect ) diff --git a/go.sum b/go.sum index 4cda727..787ea80 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,12 @@ -cogentcore.org/core v0.3.3-0.20240902172924-b432919e181b h1:G7CC9jK/8FWCOYrc83VR5raE82xCkTlG3/h63txQ5Pw= -cogentcore.org/core v0.3.3-0.20240902172924-b432919e181b/go.mod h1:dg3uRsPcd8S1ZYvRD2TztCtjopRkrB5V/lbl54xsQd4= -github.com/Bios-Marcel/wastebasket v0.0.4-0.20240213135800-f26f1ae0a7c4 h1:6lx9xzJAhdjq0LvVfbITeC3IH9Fzvo1aBahyPu2FuG8= -github.com/Bios-Marcel/wastebasket v0.0.4-0.20240213135800-f26f1ae0a7c4/go.mod h1:FChzXi1izqzdPb6BiNZmcZLGyTYiT61iGx9Rxx9GNeI= +cogentcore.org/core v0.3.12-0.20250716185014-9cff12b618f7 h1:O9tAgrtqbXVcUTBkftXFx0c5vBKSzYdegNyTHxVHpLw= +cogentcore.org/core v0.3.12-0.20250716185014-9cff12b618f7/go.mod h1:Bwg3msVxqnfwvmQjpyJbyHMeox3UAcBcBitkGEdSYSE= +github.com/Bios-Marcel/wastebasket/v2 v2.0.3 h1:TkoDPcSqluhLGE+EssHu7UGmLgUEkWg7kNyHyyJ3Q9g= +github.com/Bios-Marcel/wastebasket/v2 v2.0.3/go.mod h1:769oPCv6eH7ugl90DYIsWwjZh4hgNmMS3Zuhe1bH6KU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/vcs v1.13.3 h1:IIA2aBdXvfbIM+yl/eTnL4hb1XwdpvuQLglAix1gweE= github.com/Masterminds/vcs v1.13.3/go.mod h1:TiE7xuEjl1N4j016moRd6vezp6e6Lz23gypeXfzXeW8= +github.com/adrg/strutil v0.3.1 h1:OLvSS7CSJO8lBii4YmBt8jiK9QOtB9CzCzwl4Ic/Fz4= +github.com/adrg/strutil v0.3.1/go.mod h1:8h90y18QLrs11IBffcGX3NW/GFBXCMcNg4M7H6MspPA= github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/chroma/v2 v2.13.0 h1:VP72+99Fb2zEcYM0MeaWJmV+xQvz5v5cxRHd+ooU1lI= @@ -18,10 +20,8 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/chewxy/math32 v1.10.1 h1:LFpeY0SLJXeaiej/eIp2L40VYfscTvKh/FSEZ68uMkU= github.com/chewxy/math32 v1.10.1/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs= -github.com/cogentcore/webgpu v0.0.0-20241212004832-ad7475f3b4dd h1:wmOdOGOfQDY/hmiQTWzoM59SskQSjrMz91jWv0gt6Yg= -github.com/cogentcore/webgpu v0.0.0-20241212004832-ad7475f3b4dd/go.mod h1:ciqaxChrmRRMU1SnI5OE12Cn3QWvOKO+e5nSy+N9S1o= -github.com/cogentcore/yaegi v0.0.0-20240724064145-e32a03faad56 h1:Fz1uHiFCHnijFcMXzn36KLamcx5q4pxoR5rKCrcXIcQ= -github.com/cogentcore/yaegi v0.0.0-20240724064145-e32a03faad56/go.mod h1:+MGpZ0srBmeJ7aaOLTdVss8WLolt0/y/plVHLpxgd3A= +github.com/cogentcore/webgpu v0.23.0 h1:hrjnnuDZAPSRsqBjQAsJOyg2COGztIkBbxL87r0Q9KE= +github.com/cogentcore/webgpu v0.23.0/go.mod h1:ciqaxChrmRRMU1SnI5OE12Cn3QWvOKO+e5nSy+N9S1o= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -35,14 +35,20 @@ github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cn github.com/ericchiang/css v1.3.0 h1:e0vS+vpujMjtT3/SYu7qTHn1LVzXWcLCCDjlfq3YlLY= github.com/ericchiang/css v1.3.0/go.mod h1:sVSdL+MFR9Q4cKJMQzpIkHIDOLiK+7Wmjjhq7D+MubA= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-fonts/latin-modern v0.3.3 h1:g2xNgI8yzdNzIVm+qvbMryB6yGPe0pSMss8QT3QwlJ0= +github.com/go-fonts/latin-modern v0.3.3/go.mod h1:tHaiWDGze4EPB0Go4cLT5M3QzRY3peya09Z/8KSCrpY= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a h1:vxnBhFDDT+xzxf1jTJKMKZw3H0swfWk9RpWbBbDK5+0= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/goki/freetype v1.0.5 h1:yi2lQeUhXnBgSMqYd0vVmPw6RnnfIeTP3N4uvaJXd7A= -github.com/goki/freetype v1.0.5/go.mod h1:wKmKxddbzKmeci9K96Wknn5kjTWLyfC8tKOqAFbEX8E= -github.com/gomarkdown/markdown v0.0.0-20240930133441-72d49d9543d8 h1:4txT5G2kqVAKMjzidIabL/8KqjIK71yj30YOeuxLn10= -github.com/gomarkdown/markdown v0.0.0-20240930133441-72d49d9543d8/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= +github.com/go-text/typesetting v0.3.1-0.20250402122313-7a0f05577ff5 h1:ChaHVT66Mk9SwP0bdWEKwikYd709GSFjGxWKPeZsE14= +github.com/go-text/typesetting v0.3.1-0.20250402122313-7a0f05577ff5/go.mod h1:qjZLkhRgOEYMhU9eHBr3AR4sfnGJvOXNLt8yRAySFuY= +github.com/go-text/typesetting-utils v0.0.0-20241103174707-87a29e9e6066 h1:qCuYC+94v2xrb1PoS4NIDe7DGYtLnU2wWiQe9a1B1c0= +github.com/go-text/typesetting-utils v0.0.0-20241103174707-87a29e9e6066/go.mod h1:DDxDdQEnB70R8owOx3LVpEFvpMK9eeH1o2r0yZhFI9o= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b h1:EY/KpStFl60qA17CptGXhwfZ+k1sFNJIUNR8DdbcuUk= +github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -86,41 +92,49 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tdewolff/parse/v2 v2.7.19 h1:7Ljh26yj+gdLFEq/7q9LT4SYyKtwQX4ocNrj45UCePg= +github.com/tdewolff/parse/v2 v2.7.19/go.mod h1:3FbJWZp3XT9OWVN3Hmfp0p/a08v4h8J9W1aghka0soA= +github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52 h1:gAQliwn+zJrkjAHVcBEYW/RFvd2St4yYimisvozAYlA= +github.com/tdewolff/test v1.0.11-0.20231101010635-f1265d231d52/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= -golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= -golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ= +golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= +golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= -golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= +golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= +golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= -gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +modernc.org/knuth v0.5.4 h1:F8mDs7ME3oN9eyx01n6/xVmJ4F5U/qEhSYPnPXaZrps= +modernc.org/knuth v0.5.4/go.mod h1:e5SBb35HQBj2aFwbBO3ClPcViLY3Wi0LzaOd7c/3qMk= +modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= +modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +star-tex.org/x/tex v0.6.0 h1:ZD/4082kR5+2gFzFNgRvZBMCGuXrQWp3hNo5W5LmCeI= +star-tex.org/x/tex v0.6.0/go.mod h1:wJWeUmM2d4qH/mCtMOcioNl2sluKx85mLi+Yv9Nq4Ms= diff --git a/main.go b/main.go index c892648..c1dd471 100644 --- a/main.go +++ b/main.go @@ -6,67 +6,55 @@ package main import ( "embed" - "image/color" "cogentcore.org/core/base/errors" + "cogentcore.org/core/content" "cogentcore.org/core/core" - "cogentcore.org/core/events" "cogentcore.org/core/htmlcore" "cogentcore.org/core/icons" - "cogentcore.org/core/pages" "cogentcore.org/core/styles" "cogentcore.org/core/styles/units" "cogentcore.org/core/tree" - _ "cogentcore.org/core/yaegicore" ) //go:embed name.png var resources embed.FS //go:embed content -var content embed.FS +var econtent embed.FS func main() { b := core.NewBody("Cogent Core") - pg := pages.NewPage(b).SetContent(content) + ct := content.NewContent(b).SetContent(econtent) + ctx := ct.Context b.AddTopBar(func(bar *core.Frame) { tb := core.NewToolbar(bar) - tb.Maker(pg.MakeToolbar) + tb.Maker(ct.MakeToolbar) tb.Maker(func(p *tree.Plan) { tree.Add(p, func(w *core.Button) { + ctx.LinkButton(w, "https://cogentcore.org/blog") w.SetText("Blog").SetIcon(icons.RssFeed) - w.OnClick(func(e events.Event) { - pg.Context.OpenURL("/blog") - }) }) tree.Add(p, func(w *core.Button) { + ctx.LinkButton(w, "https://youtube.com/@CogentCore") w.SetText("Videos").SetIcon(icons.VideoLibrary) - w.OnClick(func(e events.Event) { - pg.Context.OpenURL("https://youtube.com/@CogentCore") - }) }) tree.Add(p, func(w *core.Button) { + ctx.LinkButton(w, "https://github.com/cogentcore") w.SetText("GitHub").SetIcon(icons.GitHub) - w.OnClick(func(e events.Event) { - pg.Context.OpenURL("https://github.com/cogentcore") - }) }) tree.Add(p, func(w *core.Button) { + ctx.LinkButton(w, "/community") w.SetText("Community").SetIcon(icons.Forum) - w.OnClick(func(e events.Event) { - pg.Context.OpenURL("/community") - }) }) tree.Add(p, func(w *core.Button) { + ctx.LinkButton(w, "https://github.com/sponsors/cogentcore") w.SetText("Sponsor").SetIcon(icons.Favorite) - w.OnClick(func(e events.Event) { - pg.Context.OpenURL("https://github.com/sponsors/cogentcore") - }) }) }) }) - htmlcore.ElementHandlers["home-page"] = func(ctx *htmlcore.Context) bool { + ctx.ElementHandlers["home-page"] = func(ctx *htmlcore.Context) bool { frame := core.NewFrame(ctx.BlockParent) frame.Styler(func(s *styles.Style) { s.Direction = styles.Column @@ -81,29 +69,18 @@ func main() { return min(uc.Dp(612), uc.Vw(80)) }) }) + core.NewText(frame).SetType(core.TextHeadlineMedium).SetText(core.AppAbout) - core.NewButton(frame).SetText("Learn about the Cogent Core framework").OnClick(func(e events.Event) { - core.TheApp.OpenURL("https://cogentcore.org/core") - }) - return true - } - htmlcore.ElementHandlers["color-scheme-control"] = func(ctx *htmlcore.Context) bool { - type theme struct { - Theme core.Themes `default:"Auto"` - Color color.RGBA `default:"#4285f4"` - } - th := &theme{core.AppearanceSettings.Theme, core.AppearanceSettings.Color} - fm := core.NewForm(ctx.BlockParent).SetStruct(th) - fm.OnChange(func(e events.Event) { - core.AppearanceSettings.Theme = th.Theme - core.AppearanceSettings.Color = th.Color - core.UpdateSettings(ctx.BlockParent, core.AppearanceSettings) - }) + + buttons := core.NewFrame(frame) + cc := core.NewButton(buttons).SetText("Core") + ctx.LinkButton(cc, "https://cogentcore.org/core") + cl := core.NewButton(buttons).SetText("Lab").SetType(core.ButtonTonal) + ctx.LinkButton(cl, "https://cogentcore.org/lab") + ca := core.NewButton(buttons).SetText("Apps").SetType(core.ButtonTonal) + ctx.LinkButton(ca, "https://cogentcore.org/cogent") return true } - b.OnShow(func(e events.Event) { - b.Update() // TODO: needed for image sizing on initial load (core/#1037) - }) b.RunMainWindow() }