Skip to content

Commit

Permalink
V10 (#951)
Browse files Browse the repository at this point in the history
* Condition Rework (#887)

* rework condition to take functions instead of ui elements

* update ci go version

* improve condition test coverage

* test only pkg

* only test app pkg

* Update build.yml

* Update build.yml

* Update build.yml

* Broader use of formatted string arg and generated documentation overhaul (#888)

* replace remaining strings argument by format

* use format with Style

* Improve generated documentation.

* improve generated doc C

* Improve generated doc D - E

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* update event handlers doc

* Update html.go

* Update html.go

* Update html.go

* modify fixed method doc

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* Update html.go

* update generated doc

* update generated wording

* Routes refactoring (#889)

* make routes call only take factory functions

* add NewComponentFunc

* rename NewComponentFunc to NewZeroComponentFunc

* rename NewZeroComponentFunc to NewZeroComponentFactory

* Improve filter UI elems (#891)

* update former FilterUIElems and its doc

* improve FilterUIElems unit tests

* cleanup test

* remove isServerSide from engine and dispatcher (#892)

* remove node kind (#893)

* remove internal node context (#894)

* Node manager (#903)

* node manager declaration

* mount text

* remove node manager dismountText

* node manager can update

* node manager update text

* updade node manager doc

* mount html element

* node manager resolve url

* Update node_test.go

* node manager mount html attributes

* node manager mount html event handler

* test mount event handler

* node manager make context

* Update html.go

* node manager dismount html element

* html element setters to return the element

* node manager updateHTMLAttributes

* node manager update html event handlers

* node manage update html children

* Update node_test.go

* unexport Depth()

* node manager mount component partial implementation

* node manager component mount

* improve node manager mount test coverage

* Update node_test.go

* Update node.go

* node manager dismount component

* node manager update component

* can update value tests

* node manager mount raw html

* node manager dismount raw html

* node manager update raw html

* node manager notify component update on html events

* node manager NotifyComponentEvent

* refactor node manager to use context

* use function to get page in node context

* enginex navigate and load

* enginex url tests

* update manager

* enginex start implementation

* fix enginex context

* implement more node context methods

* browser app updatble

* Update browser.go

* comple browser init

* Update enginex.go

* refactor actions

* enginex start testing

* update context documentation

* add notifications to node context

* state manage implementation part1

* state manager broadcast

* state manager observer and get unit tests

* state manager test  set partial tests

* state manager remaining tests

* fix doc site

* cleanup

* node manage encode text

* node manage encode raw

* node manager encode component

* node manager encode html

* update node manager doc

* Update node.go

* node manage encode test

* enginex to load component intro body first child only

* change loading

* enginex root

* refactor node manager encode

* engine x encode

* fix set state

* context to be a single structure

* update context

* state manager delete

* Update context.go

* fix on anchor click

* fix fragment navigation

* fix js loading

* fix node manager foreach updatable component

* fix action post

* Update node.go

* update default rate

* Update app.go

* Update app.go

* revert oninit and prerender deprecation

* Update context.go

* remove emit back

* cleanup

* add back benchmarks

* add generated unit test

* add unit test to gen html

* fix context defer and add unit tests

* refactor testing

* refactor testing

* refactor HTMLString

* cleanup

* cleanup persisted states (#904)

* fix broadcast state

* fix engine request page

* js args adjustment (#907)

* Update js_wasm.go

* cleanup

* Url resolver (#911)

* resource resolver for local and remote dir

* fix macro run

* refactor http to use resource resolver

* cleanup

* cleanup

* Update go.sum

* Update http.go

* add domain to http handler

* Update http.go

* resolve of url

* resolve twitter image

* trim prefixed version path

* updat http

* wasm content length set

* WasmContentLength as a string

* Update http.go

* Update http.go

* resolve manifest urls

* set keywords only when they are set

* html to no display empty title property

* Http resource (#913)

* http resource

* use parse http resource

* Update http.go

* Update http.go

* Fix prevent update (#916)

* http resource

* use parse http resource

* Update http.go

* Update http.go

* replace update struct by counter

* Update update.go

* Create js_wasm_test.go

* add context.Update

* Update http.go

* trigger on update whenever a component is updated (#917)

* Trigger on update whenever a component is updated (#918)

* trigger on update whenever a component is updated

* update doc

* Revert "Trigger on update whenever a component is updated (#918)"

This reverts commit 424c7c1.

* Revert "trigger on update whenever a component is updated (#917)"

This reverts commit 200b16d.

* call clean args into Invoke

* fixe cleanArgs with []any

* refactor js wrapping (#920)

* change installing worker state to trigger app update notification (#922)

* update ResizeContent doc

* Fix prevent update 2 (#928)

* add update take a counter

* handle done update withing the updated

* update deps

* revert update done removal

* Update engine_test.go

* Update context_test.go

* Update if documentation  (#930)

* Update declarative-syntax.md

* Update home.md

* Update install.md

* Update lifecycle.md

* Update notifications.md

* move global variables in a single location (#931)

* Refactor storage api (#932)

* remove Key() from BrowserStorage

* browser storage foreach

* use browser storage ForEach in CleanupExpiredPersistedStates

* add Contains to browser storage

* update handler godoc

* Replace v9 path by v10 (#933)

* replace path in pkg

* replace path in docs/src

* Update getting-started.md

* Update go.mod

* Update makefile

* update doc

* update github doc

* Update README.md

* remove auto update interval (#936)

* cleanup app.js

* Maskable icon (#938)

* save

* Replace icon apple touch my makable

* add maskable image to mainfest

* update script

* event handler options integration (#942)

* move ctx.TryUpdateApp to global app.TryUpdate

* Specify whether an observer listen to broadcast (#943)

* add loading attribute to img

* set a fixed size to the wasm loader icon

* Update condition.go (#947)

* fix condition 2

* Update when wasm not loaded (#949)

* handle update when update occur before wasm is loaded

* fix goappOnUpdate condition

---------

Co-authored-by: Maxence Charriere <maxence@Maxences-Macbook-Pro-IV.local>
  • Loading branch information
maxence-charriere and Maxence Charriere committed May 20, 2024
1 parent 4af7476 commit 71be947
Show file tree
Hide file tree
Showing 155 changed files with 49,234 additions and 75,550 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
go-version: "1.21"
- name: Checkout Code
uses: actions/checkout@v3
- name: Vet
run: go vet ./...
run: |
go vet ./pkg/app
go vet ./pkg/errors
go vet ./pkg/logs
go vet ./pkg/cache
go vet ./pkg/cli
server:
name: Unit Tests
Expand All @@ -23,11 +28,15 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18"
go-version: "1.21"
- name: Checkout Code
uses: actions/checkout@v3
- name: Run Unit Tests
run: go test -race ./...
run: |
go test -race ./pkg/app
go test -race ./pkg/errors
go test -race ./pkg/logs
go test -race ./pkg/cache
client:
name: WebAssembly Unit Tests
Expand All @@ -36,7 +45,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18"
go-version: "1.21"
- name: Checkout Code
uses: actions/checkout@v3
- name: Install WASM Browser Test
Expand All @@ -46,3 +55,5 @@ jobs:
- name: Run Unit Tests
run: |
GOARCH=wasm GOOS=js go test ./pkg/app
GOARCH=wasm GOOS=js go test ./pkg/errors
GOARCH=wasm GOOS=js go test ./pkg/logs
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<a href="https://github.com/maxence-charriere/go-app/actions"><img src="https://github.com/maxence-charriere/go-app/actions/workflows/build.yml/badge.svg?branch=master" alt="GitHub actions"></a>
<a href="https://goreportcard.com/report/github.com/maxence-charriere/go-app"><img src="https://goreportcard.com/badge/github.com/maxence-charriere/go-app" alt="Go Report Card"></a>
<a href="https://GitHub.com/maxence-charriere/go-app/releases/"><img src="https://img.shields.io/github/release/maxence-charriere/go-app.svg" alt="GitHub release"></a>
<a href="https://pkg.go.dev/github.com/maxence-charriere/go-app/v9/pkg/app"><img src="https://img.shields.io/badge/dev-reference-007d9c?logo=go&logoColor=white&style=flat" alt="pkg.go.dev docs"></a>
<a href="https://pkg.go.dev/github.com/maxence-charriere/go-app/v10/pkg/app"><img src="https://img.shields.io/badge/dev-reference-007d9c?logo=go&logoColor=white&style=flat" alt="pkg.go.dev docs"></a>
<a href="https://twitter.com/jonhymaxoo"><img alt="Twitter URL" src="https://img.shields.io/badge/twitter-@jonhymaxoo-35A9F8?logo=twitter&style=flat"></a>
<a href="https://opencollective.com/go-app" alt="Financial Contributors on Open Collective"><img src="https://opencollective.com/go-app/all/badge.svg?label=open+collective&color=4FB9F6" /></a>
</p>
Expand All @@ -34,7 +34,7 @@ An app created with go-app can out of the box **runs in its own window**, **supp

```sh
go mod init
go get -u github.com/maxence-charriere/go-app/v9/pkg/app
go get -u github.com/maxence-charriere/go-app/v10/pkg/app
```

## Declarative syntax
Expand Down
1,066 changes: 608 additions & 458 deletions docs/actions.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/app-worker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const cacheName = "app-" + "08848207254ed19206a7e0901b6c869dca9004c8";
const resourcesToCache = ["/","/app.css","/app.js","/manifest.webmanifest","/wasm_exec.js","/web/app.wasm","/web/css/docs.css","/web/css/prism.css","/web/documents/home-next.md","/web/documents/home.md","/web/documents/updates.md","/web/documents/what-is-go-app.md","/web/icon.png","/web/js/prism.js","https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500\u0026display=swap","https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1013306768105236"];
const cacheName = "app-" + "8a5b8e9e77360856e3666adbdd05a1a9e4e08803";
const resourcesToCache = ["/","/app.css","/app.js","/manifest.webmanifest","/wasm_exec.js","/web/app.wasm","/web/css/docs.css","/web/css/prism.css","/web/documents/home-next.md","/web/documents/home.md","/web/documents/updates.md","/web/documents/what-is-go-app.md","/web/icon.png","/web/js/prism.js","https://fonts.googleapis.com/css2?family=montserrat:wght@400;500\u0026display=swap","https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1013306768105236"];

self.addEventListener("install", (event) => {
console.log("installing app worker 08848207254ed19206a7e0901b6c869dca9004c8");
console.log("installing app worker 8a5b8e9e77360856e3666adbdd05a1a9e4e08803");

event.waitUntil(
caches
Expand All @@ -28,7 +28,7 @@ self.addEventListener("activate", (event) => {
);
})
);
console.log("app worker 08848207254ed19206a7e0901b6c869dca9004c8 is activated");
console.log("app worker 8a5b8e9e77360856e3666adbdd05a1a9e4e08803 is activated");
});

self.addEventListener("fetch", (event) => {
Expand Down
19 changes: 11 additions & 8 deletions docs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ var goappNav = function () {};
var goappOnUpdate = function () {};
var goappOnAppInstallChange = function () {};

const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"","GOAPP_STATIC_RESOURCES_URL":"","GOAPP_VERSION":"08848207254ed19206a7e0901b6c869dca9004c8"};
const goappEnv = {"GOAPP_INTERNAL_URLS":"null","GOAPP_ROOT_PREFIX":"/","GOAPP_STATIC_RESOURCES_URL":"/web","GOAPP_VERSION":"8a5b8e9e77360856e3666adbdd05a1a9e4e08803"};
const goappLoadingLabel = "go-app documentation {progress}%";
const goappWasmContentLength = "";
const goappWasmContentLengthHeader = "";

let goappServiceWorkerRegistration;
Expand Down Expand Up @@ -55,7 +56,7 @@ function goappSetupNotifyUpdate(registration) {
if (!navigator.serviceWorker.controller) {
return;
}
if (newSW.state != "installed") {
if (newSW.state != "activated") {
return;
}
goappOnUpdate();
Expand Down Expand Up @@ -240,12 +241,14 @@ function goappCanLoadWebAssembly() {
async function fetchWithProgress(url, progess) {
const response = await fetch(url);

let contentLength;
try {
contentLength = response.headers.get(goappWasmContentLengthHeader);
} catch {}
if (!goappWasmContentLengthHeader || !contentLength) {
contentLength = response.headers.get("Content-Length");
let contentLength = goappWasmContentLength;
if (contentLength <= 0) {
try {
contentLength = response.headers.get(goappWasmContentLengthHeader);
} catch {}
if (!goappWasmContentLengthHeader || !contentLength) {
contentLength = response.headers.get("Content-Length");
}
}

const total = parseInt(contentLength, 10);
Expand Down
Loading

0 comments on commit 71be947

Please sign in to comment.