@yufengtadian/freedom-cli 1.12.1 → 1.12.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -14
- package/bin/freedom.js +5 -1
- package/lib/build.js +49 -8
- package/lib/cli.js +107 -80
- package/lib/config.js +108 -31
- package/lib/shell.js +73 -20
- package/lib/theme.js +105 -0
- package/lib/tui.js +21 -3
- package/lib/update.js +109 -0
- package/lib/utils.js +14 -1
- package/package.json +1 -1
- package/shell/win-x64/freedom-shell.exe +0 -0
- package/templates/go/go.mod +6 -0
- package/templates/go/go.sum +2 -2
- package/templates/go/pkg/freedom/assets/freedom.js +6 -0
- package/templates/go/pkg/freedom/assets/index.html +1 -1
- package/templates/go/pkg/freedom/backend_proc.go +4 -4
- package/templates/go/pkg/freedom/configfile.go +12 -7
- package/templates/go/pkg/freedom/freedom.go +27 -11
- package/templates/go/pkg/freedom/window_other.go +64 -12
- package/templates/go/pkg/freedom/window_windows.go +244 -29
- package/templates/go/webview_go/.github/workflows/ci.yaml +62 -0
- package/templates/go/webview_go/CHANGELOG.md +15 -0
- package/templates/go/webview_go/LICENSE +22 -0
- package/templates/go/webview_go/README.md +50 -0
- package/templates/go/webview_go/examples/basic/main.go +12 -0
- package/templates/go/webview_go/examples/bind/main.go +38 -0
- package/templates/go/webview_go/glue.c +36 -0
- package/templates/go/webview_go/go.mod +3 -0
- package/templates/go/webview_go/go.sum +0 -0
- package/templates/go/webview_go/libs/mswebview2/LICENSE +27 -0
- package/templates/go/webview_go/libs/mswebview2/include/WebView2.h +23568 -0
- package/templates/go/webview_go/libs/mswebview2/include/vendor.go +2 -0
- package/templates/go/webview_go/libs/mswebview2/vendor.go +2 -0
- package/templates/go/webview_go/libs/mswebview2/version.txt +1 -0
- package/templates/go/webview_go/libs/webview/LICENSE +22 -0
- package/templates/go/webview_go/libs/webview/include/vendor.go +2 -0
- package/templates/go/webview_go/libs/webview/include/webview.h +3871 -0
- package/templates/go/webview_go/libs/webview/vendor.go +2 -0
- package/templates/go/webview_go/libs/webview/version.txt +1 -0
- package/templates/go/webview_go/webview.cc +1 -0
- package/templates/go/webview_go/webview.go +379 -0
- package/templates/go/webview_go/webview_test.go +50 -0
- package/templates/project/freedom.config.js +5 -5
- package/templates/project/index.html +45 -5
- package/templates/project/src/main.js +149 -8
- package/tutorial/tutorial.html +4 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Serge Zaitsev
|
|
4
|
+
Copyright (c) 2020 webview
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# webview_go
|
|
2
|
+
|
|
3
|
+
[](https://godoc.org/github.com/webview/webview_go)
|
|
4
|
+
[](https://goreportcard.com/report/github.com/webview/webview_go)
|
|
5
|
+
|
|
6
|
+
Go language binding for the [webview library][webview].
|
|
7
|
+
|
|
8
|
+
> [!NOTE]
|
|
9
|
+
> Versions <= 0.1.1 are available in the [old repository][webview].
|
|
10
|
+
|
|
11
|
+
### Getting Started
|
|
12
|
+
|
|
13
|
+
See [Go package documentation][go-docs] for the Go API documentation, or simply read the source code.
|
|
14
|
+
|
|
15
|
+
Start with creating a new directory structure for your project.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
mkdir my-project && cd my-project
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Create a new Go module.
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
go mod init example.com/app
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Save one of the example programs into your project directory.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
curl -sSLo main.go "https://raw.githubusercontent.com/webview/webview_go/master/examples/basic/main.go"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Install dependencies.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
go get github.com/webview/webview_go
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Build the example. On Windows, add `-ldflags="-H windowsgui"` to the command line.
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
go build
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Notes
|
|
46
|
+
|
|
47
|
+
Calling `Eval()` or `Dispatch()` before `Run()` does not work because the webview instance has only been configured and not yet started.
|
|
48
|
+
|
|
49
|
+
[go-docs]: https://pkg.go.dev/github.com/webview/webview_go
|
|
50
|
+
[webview]: https://github.com/webview/webview
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import webview "github.com/webview/webview_go"
|
|
4
|
+
|
|
5
|
+
const html = `<button id="increment">Tap me</button>
|
|
6
|
+
<div>You tapped <span id="count">0</span> time(s).</div>
|
|
7
|
+
<script>
|
|
8
|
+
const [incrementElement, countElement] =
|
|
9
|
+
document.querySelectorAll("#increment, #count");
|
|
10
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
11
|
+
incrementElement.addEventListener("click", () => {
|
|
12
|
+
window.increment().then(result => {
|
|
13
|
+
countElement.textContent = result.count;
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
</script>`
|
|
18
|
+
|
|
19
|
+
type IncrementResult struct {
|
|
20
|
+
Count uint `json:"count"`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func main() {
|
|
24
|
+
var count uint = 0
|
|
25
|
+
w := webview.New(false)
|
|
26
|
+
defer w.Destroy()
|
|
27
|
+
w.SetTitle("Bind Example")
|
|
28
|
+
w.SetSize(480, 320, webview.HintNone)
|
|
29
|
+
|
|
30
|
+
// A binding that increments a value and immediately returns the new value.
|
|
31
|
+
w.Bind("increment", func() IncrementResult {
|
|
32
|
+
count++
|
|
33
|
+
return IncrementResult{Count: count}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
w.SetHtml(html)
|
|
37
|
+
w.Run()
|
|
38
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#include "webview.h"
|
|
2
|
+
|
|
3
|
+
#include <stdlib.h>
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
|
|
6
|
+
struct binding_context {
|
|
7
|
+
webview_t w;
|
|
8
|
+
uintptr_t index;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
void _webviewDispatchGoCallback(void *);
|
|
12
|
+
void _webviewBindingGoCallback(webview_t, char *, char *, uintptr_t);
|
|
13
|
+
|
|
14
|
+
static void _webview_dispatch_cb(webview_t w, void *arg) {
|
|
15
|
+
_webviewDispatchGoCallback(arg);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static void _webview_binding_cb(const char *id, const char *req, void *arg) {
|
|
19
|
+
struct binding_context *ctx = (struct binding_context *) arg;
|
|
20
|
+
_webviewBindingGoCallback(ctx->w, (char *)id, (char *)req, ctx->index);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void CgoWebViewDispatch(webview_t w, uintptr_t arg) {
|
|
24
|
+
webview_dispatch(w, _webview_dispatch_cb, (void *)arg);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
void CgoWebViewBind(webview_t w, const char *name, uintptr_t index) {
|
|
28
|
+
struct binding_context *ctx = calloc(1, sizeof(struct binding_context));
|
|
29
|
+
ctx->w = w;
|
|
30
|
+
ctx->index = index;
|
|
31
|
+
webview_bind(w, name, _webview_binding_cb, (void *)ctx);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void CgoWebViewUnbind(webview_t w, const char *name) {
|
|
35
|
+
webview_unbind(w, name);
|
|
36
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (C) Microsoft Corporation. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above
|
|
10
|
+
copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
in the documentation and/or other materials provided with the
|
|
12
|
+
distribution.
|
|
13
|
+
* The name of Microsoft Corporation, or the names of its contributors
|
|
14
|
+
may not be used to endorse or promote products derived from this
|
|
15
|
+
software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|