├── README.md
├── app.tmpl.go
├── frontend
├── .eslintignore
├── .eslintrc.cjs
├── .prettierignore
├── .prettierrc
├── README.md
├── build
│ └── index.html
├── package.tmpl.json
├── src
│ ├── app.d.ts
│ ├── app.html
│ ├── hooks.ts
│ ├── lib
│ │ └── wailsjs
│ │ │ ├── go
│ │ │ └── main
│ │ │ │ ├── App.d.ts
│ │ │ │ └── App.js
│ │ │ └── runtime
│ │ │ ├── package.json
│ │ │ ├── runtime.d.ts
│ │ │ └── runtime.js
│ └── routes
│ │ ├── about.svelte
│ │ └── index.svelte
├── static
│ └── favicon.png
├── svelte.config.js
├── tsconfig.json
└── vite.config.js
├── go.tmpl.mod
├── main.tmpl.go
├── template.json
└── wails.tmpl.json
/README.md:
--------------------------------------------------------------------------------
1 | # README
2 |
3 | ## About
4 |
5 | This is the Wails SvelteKit template.
6 | This template uses [adapter-static(SPA)](https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode) to make generated files embeddable.
7 |
8 | ## Getting Started
9 |
10 | ### Installing pnpm
11 |
12 | https://pnpm.io/installation
13 |
14 | ### Installing Wails
15 |
16 | ```sh
17 | go install github.com/wailsapp/wails/v2/cmd/wails@latest
18 | ```
19 |
20 | ### Creating a Project
21 |
22 | ```sh
23 | wails init -n YOUR_PROJECT_NAME -t https://github.com/h8gi/wails-sveltekit-template
24 | ```
25 |
26 | `wailsjs` modules is located in `/frontend/src/lib` so that you can call them like `$lib/wailsjs/go/main/App` in svelte files.
27 |
28 |
29 | ## Live Development
30 |
31 | To run in live development mode, run `wails dev` in the project directory. In another terminal, go into the `frontend`
32 | directory and run `npm run dev`. The frontend dev server will run on http://localhost:34115. Connect to this in your
33 | browser and connect to your application.
34 |
35 | ## Building
36 |
37 | To build a redistributable, production mode package, use `wails build`.
38 |
--------------------------------------------------------------------------------
/app.tmpl.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | )
7 |
8 | // App struct
9 | type App struct {
10 | ctx context.Context
11 | }
12 |
13 | // NewApp creates a new App application struct
14 | func NewApp() *App {
15 | return &App{}
16 | }
17 |
18 | // startup is called at application startup
19 | func (a *App) startup(ctx context.Context) {
20 | // Perform your setup here
21 | a.ctx = ctx
22 | }
23 |
24 | // domReady is called after front-end resources have been loaded
25 | func (a App) domReady(ctx context.Context) {
26 | // Add your action here
27 | }
28 |
29 | // beforeClose is called when the application is about to quit,
30 | // either by clicking the window close button or calling runtime.Quit.
31 | // Returning true will cause the application to continue, false will continue shutdown as normal.
32 | func (a *App) beforeClose(ctx context.Context) (prevent bool) {
33 | return false
34 | }
35 |
36 | // shutdown is called at application termination
37 | func (a *App) shutdown(ctx context.Context) {
38 | // Perform your teardown here
39 | }
40 |
41 | // Greet returns a greeting for the given name
42 | func (a *App) Greet(name string) string {
43 | return fmt.Sprintf("Hello %s, It's show time!", name)
44 | }
45 |
--------------------------------------------------------------------------------
/frontend/.eslintignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /build
4 | /.svelte-kit
5 | /package
6 | .env
7 | .env.*
8 | !.env.example
9 |
10 | # Ignore files for PNPM, NPM and YARN
11 | pnpm-lock.yaml
12 | package-lock.json
13 | yarn.lock
14 |
15 | /src/lib/wailsjs
--------------------------------------------------------------------------------
/frontend/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: '@typescript-eslint/parser',
4 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
5 | plugins: ['svelte3', '@typescript-eslint'],
6 | ignorePatterns: ['*.cjs'],
7 | overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
8 | settings: {
9 | 'svelte3/typescript': () => require('typescript')
10 | },
11 | parserOptions: {
12 | sourceType: 'module',
13 | ecmaVersion: 2020
14 | },
15 | env: {
16 | browser: true,
17 | es2017: true,
18 | node: true
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/frontend/.prettierignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /build
4 | /.svelte-kit
5 | /package
6 | .env
7 | .env.*
8 | !.env.example
9 |
10 | # Ignore files for PNPM, NPM and YARN
11 | pnpm-lock.yaml
12 | package-lock.json
13 | yarn.lock
14 |
15 | /src/lib/wailsjs
--------------------------------------------------------------------------------
/frontend/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "useTabs": false,
3 | "singleQuote": true,
4 | "trailingComma": "none",
5 | "printWidth": 100,
6 | "semi": true
7 | }
8 |
--------------------------------------------------------------------------------
/frontend/README.md:
--------------------------------------------------------------------------------
1 | # create-svelte
2 |
3 | Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
4 |
5 | ## Creating a project
6 |
7 | If you're seeing this, you've probably already done this step. Congrats!
8 |
9 | ```bash
10 | # create a new project in the current directory
11 | npm create svelte@latest
12 |
13 | # create a new project in my-app
14 | npm create svelte@latest my-app
15 | ```
16 |
17 | ## Developing
18 |
19 | Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
20 |
21 | ```bash
22 | npm run dev
23 |
24 | # or start the server and open the app in a new browser tab
25 | npm run dev -- --open
26 | ```
27 |
28 | ## Building
29 |
30 | To create a production version of your app:
31 |
32 | ```bash
33 | npm run build
34 | ```
35 |
36 | You can preview the production build with `npm run preview`.
37 |
38 | > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
39 |
--------------------------------------------------------------------------------
/frontend/build/index.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/h8gi/wails-sveltekit-template/c0cc881e7aff9509fe2d066f8ccf52c32d50692f/frontend/build/index.html
--------------------------------------------------------------------------------
/frontend/package.tmpl.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "{{.ProjectName}}",
3 | "version": "0.0.0",
4 | "type": "module",
5 | "author": "{{.AuthorName}}",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "package": "svelte-kit package",
10 | "preview": "vite preview",
11 | "prepare": "svelte-kit sync",
12 | "check": "svelte-check --tsconfig ./tsconfig.json",
13 | "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
14 | "lint": "prettier --check --plugin-search-dir=. . && eslint .",
15 | "format": "prettier --write --plugin-search-dir=. ."
16 | },
17 | "devDependencies": {
18 | "@sveltejs/adapter-static": "1.0.0-next.38",
19 | "@sveltejs/kit": "next",
20 | "@typescript-eslint/eslint-plugin": "^5.27.0",
21 | "@typescript-eslint/parser": "^5.27.0",
22 | "eslint": "^8.16.0",
23 | "eslint-config-prettier": "^8.3.0",
24 | "eslint-plugin-svelte3": "^4.0.0",
25 | "prettier": "^2.6.2",
26 | "prettier-plugin-svelte": "^2.7.0",
27 | "svelte": "^3.44.0",
28 | "svelte-check": "^2.7.1",
29 | "svelte-preprocess": "^4.10.6",
30 | "tslib": "^2.3.1",
31 | "typescript": "^4.7.4",
32 | "vite": "^3.0.0"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/frontend/src/app.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | // See https://kit.svelte.dev/docs/types#app
4 | // for information about these interfaces
5 | // and what to do when importing types
6 | declare namespace App {
7 | // interface Locals {}
8 | // interface Platform {}
9 | // interface Session {}
10 | // interface Stuff {}
11 | }
12 |
--------------------------------------------------------------------------------
/frontend/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/frontend/src/hooks.ts:
--------------------------------------------------------------------------------
1 | /** @type {import('@sveltejs/kit').Handle} */
2 | export async function handle({ event, resolve }) {
3 | // SPA mode (https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode)
4 | const response = await resolve(event, { ssr: false });
5 | return response;
6 | }
7 |
--------------------------------------------------------------------------------
/frontend/src/lib/wailsjs/go/main/App.d.ts:
--------------------------------------------------------------------------------
1 | // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2 | // This file is automatically generated. DO NOT EDIT
3 |
4 | export function Greet(arg1:string):Promise;
5 |
--------------------------------------------------------------------------------
/frontend/src/lib/wailsjs/go/main/App.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 | // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
3 | // This file is automatically generated. DO NOT EDIT
4 |
5 | export function Greet(arg1) {
6 | return window['go']['main']['App']['Greet'](arg1);
7 | }
8 |
--------------------------------------------------------------------------------
/frontend/src/lib/wailsjs/runtime/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@wailsapp/runtime",
3 | "version": "2.0.0",
4 | "description": "Wails Javascript runtime library",
5 | "main": "runtime.js",
6 | "types": "runtime.d.ts",
7 | "scripts": {
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/wailsapp/wails.git"
12 | },
13 | "keywords": [
14 | "Wails",
15 | "Javascript",
16 | "Go"
17 | ],
18 | "author": "Lea Anthony ",
19 | "license": "MIT",
20 | "bugs": {
21 | "url": "https://github.com/wailsapp/wails/issues"
22 | },
23 | "homepage": "https://github.com/wailsapp/wails#readme"
24 | }
25 |
--------------------------------------------------------------------------------
/frontend/src/lib/wailsjs/runtime/runtime.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | _ __ _ __
3 | | | / /___ _(_) /____
4 | | | /| / / __ `/ / / ___/
5 | | |/ |/ / /_/ / / (__ )
6 | |__/|__/\__,_/_/_/____/
7 | The electron alternative for Go
8 | (c) Lea Anthony 2019-present
9 | */
10 |
11 | export interface Position {
12 | x: number;
13 | y: number;
14 | }
15 |
16 | export interface Size {
17 | w: number;
18 | h: number;
19 | }
20 |
21 | export interface Screen {
22 | isCurrent: boolean;
23 | isPrimary: boolean;
24 | width : number
25 | height : number
26 | }
27 |
28 | // Environment information such as platform, buildtype, ...
29 | export interface EnvironmentInfo {
30 | buildType: string;
31 | platform: string;
32 | arch: string;
33 | }
34 |
35 | // [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
36 | // emits the given event. Optional data may be passed with the event.
37 | // This will trigger any event listeners.
38 | export function EventsEmit(eventName: string, ...data: any): void;
39 |
40 | // [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
41 | export function EventsOn(eventName: string, callback: (...data: any) => void): void;
42 |
43 | // [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
44 | // sets up a listener for the given event name, but will only trigger a given number times.
45 | export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): void;
46 |
47 | // [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
48 | // sets up a listener for the given event name, but will only trigger once.
49 | export function EventsOnce(eventName: string, callback: (...data: any) => void): void;
50 |
51 | // [EventsOff](https://wails.io/docs/reference/runtime/events#eventsff)
52 | // unregisters the listener for the given event name.
53 | export function EventsOff(eventName: string): void;
54 |
55 | // [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
56 | // logs the given message as a raw message
57 | export function LogPrint(message: string): void;
58 |
59 | // [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
60 | // logs the given message at the `trace` log level.
61 | export function LogTrace(message: string): void;
62 |
63 | // [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
64 | // logs the given message at the `debug` log level.
65 | export function LogDebug(message: string): void;
66 |
67 | // [LogError](https://wails.io/docs/reference/runtime/log#logerror)
68 | // logs the given message at the `error` log level.
69 | export function LogError(message: string): void;
70 |
71 | // [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
72 | // logs the given message at the `fatal` log level.
73 | // The application will quit after calling this method.
74 | export function LogFatal(message: string): void;
75 |
76 | // [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
77 | // logs the given message at the `info` log level.
78 | export function LogInfo(message: string): void;
79 |
80 | // [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
81 | // logs the given message at the `warning` log level.
82 | export function LogWarning(message: string): void;
83 |
84 | // [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
85 | // Forces a reload by the main application as well as connected browsers.
86 | export function WindowReload(): void;
87 |
88 | // [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
89 | // Reloads the application frontend.
90 | export function WindowReloadApp(): void;
91 |
92 | // [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
93 | // *Windows only*
94 | // Sets window theme to system default (dark/light).
95 | export function WindowSetSystemDefaultTheme(): void;
96 |
97 | // [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
98 | // *Windows only*
99 | // Sets window to light theme.
100 | export function WindowSetLightTheme(): void;
101 |
102 | // [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
103 | // *Windows only*
104 | // Sets window to dark theme.
105 | export function WindowSetDarkTheme(): void;
106 |
107 | // [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
108 | // Centers the window on the monitor the window is currently on.
109 | export function WindowCenter(): void;
110 |
111 | // [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
112 | // Sets the text in the window title bar.
113 | export function WindowSetTitle(title: string): void;
114 |
115 | // [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
116 | // Makes the window full screen.
117 | export function WindowFullscreen(): void;
118 |
119 | // [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
120 | // Restores the previous window dimensions and position prior to full screen.
121 | export function WindowUnfullscreen(): void;
122 |
123 | // [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
124 | // Sets the width and height of the window.
125 | export function WindowSetSize(width: number, height: number): Promise;
126 |
127 | // [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
128 | // Gets the width and height of the window.
129 | export function WindowGetSize(): Promise;
130 |
131 | // [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
132 | // Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
133 | // Setting a size of 0,0 will disable this constraint.
134 | export function WindowSetMaxSize(width: number, height: number): void;
135 |
136 | // [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
137 | // Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
138 | // Setting a size of 0,0 will disable this constraint.
139 | export function WindowSetMinSize(width: number, height: number): void;
140 |
141 | // [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
142 | // Sets the window position relative to the monitor the window is currently on.
143 | export function WindowSetPosition(x: number, y: number): void;
144 |
145 | // [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
146 | // Gets the window position relative to the monitor the window is currently on.
147 | export function WindowGetPosition(): Promise;
148 |
149 | // [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
150 | // Hides the window.
151 | export function WindowHide(): void;
152 |
153 | // [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
154 | // Shows the window, if it is currently hidden.
155 | export function WindowShow(): void;
156 |
157 | // [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
158 | // Maximises the window to fill the screen.
159 | export function WindowMaximise(): void;
160 |
161 | // [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
162 | // Toggles between Maximised and UnMaximised.
163 | export function WindowToggleMaximise(): void;
164 |
165 | // [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
166 | // Restores the window to the dimensions and position prior to maximising.
167 | export function WindowUnmaximise(): void;
168 |
169 | // [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
170 | // Minimises the window.
171 | export function WindowMinimise(): void;
172 |
173 | // [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
174 | // Restores the window to the dimensions and position prior to minimising.
175 | export function WindowUnminimise(): void;
176 |
177 | // [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
178 | // Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
179 | export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
180 |
181 | // [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
182 | // Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
183 | export function ScreenGetAll(): Promise;
184 |
185 | // [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
186 | // Opens the given URL in the system browser.
187 | export function BrowserOpenURL(url: string): void;
188 |
189 | // [Environment](https://wails.io/docs/reference/runtime/intro#environment)
190 | // Returns information about the environment
191 | export function Environment(): Promise;
192 |
193 | // [Quit](https://wails.io/docs/reference/runtime/intro#quit)
194 | // Quits the application.
195 | export function Quit(): void;
196 |
197 | // [Hide](https://wails.io/docs/reference/runtime/intro#hide)
198 | // Hides the application.
199 | export function Hide(): void;
200 |
201 | // [Show](https://wails.io/docs/reference/runtime/intro#show)
202 | // Shows the application.
203 | export function Show(): void;
204 |
--------------------------------------------------------------------------------
/frontend/src/lib/wailsjs/runtime/runtime.js:
--------------------------------------------------------------------------------
1 | /*
2 | _ __ _ __
3 | | | / /___ _(_) /____
4 | | | /| / / __ `/ / / ___/
5 | | |/ |/ / /_/ / / (__ )
6 | |__/|__/\__,_/_/_/____/
7 | The electron alternative for Go
8 | (c) Lea Anthony 2019-present
9 | */
10 |
11 | export function LogPrint(message) {
12 | window.runtime.LogPrint(message);
13 | }
14 |
15 | export function LogTrace(message) {
16 | window.runtime.LogTrace(message);
17 | }
18 |
19 | export function LogDebug(message) {
20 | window.runtime.LogDebug(message);
21 | }
22 |
23 | export function LogInfo(message) {
24 | window.runtime.LogInfo(message);
25 | }
26 |
27 | export function LogWarning(message) {
28 | window.runtime.LogWarning(message);
29 | }
30 |
31 | export function LogError(message) {
32 | window.runtime.LogError(message);
33 | }
34 |
35 | export function LogFatal(message) {
36 | window.runtime.LogFatal(message);
37 | }
38 |
39 | export function EventsOnMultiple(eventName, callback, maxCallbacks) {
40 | window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks);
41 | }
42 |
43 | export function EventsOn(eventName, callback) {
44 | EventsOnMultiple(eventName, callback, -1);
45 | }
46 |
47 | export function EventsOff(eventName) {
48 | return window.runtime.EventsOff(eventName);
49 | }
50 |
51 | export function EventsOnce(eventName, callback) {
52 | EventsOnMultiple(eventName, callback, 1);
53 | }
54 |
55 | export function EventsEmit(eventName) {
56 | let args = [eventName].slice.call(arguments);
57 | return window.runtime.EventsEmit.apply(null, args);
58 | }
59 |
60 | export function WindowReload() {
61 | window.runtime.WindowReload();
62 | }
63 |
64 | export function WindowReloadApp() {
65 | window.runtime.WindowReloadApp();
66 | }
67 |
68 | export function WindowSetSystemDefaultTheme() {
69 | window.runtime.WindowSetSystemDefaultTheme();
70 | }
71 |
72 | export function WindowSetLightTheme() {
73 | window.runtime.WindowSetLightTheme();
74 | }
75 |
76 | export function WindowSetDarkTheme() {
77 | window.runtime.WindowSetDarkTheme();
78 | }
79 |
80 | export function WindowCenter() {
81 | window.runtime.WindowCenter();
82 | }
83 |
84 | export function WindowSetTitle(title) {
85 | window.runtime.WindowSetTitle(title);
86 | }
87 |
88 | export function WindowFullscreen() {
89 | window.runtime.WindowFullscreen();
90 | }
91 |
92 | export function WindowUnfullscreen() {
93 | window.runtime.WindowUnfullscreen();
94 | }
95 |
96 | export function WindowGetSize() {
97 | return window.runtime.WindowGetSize();
98 | }
99 |
100 | export function WindowSetSize(width, height) {
101 | window.runtime.WindowSetSize(width, height);
102 | }
103 |
104 | export function WindowSetMaxSize(width, height) {
105 | window.runtime.WindowSetMaxSize(width, height);
106 | }
107 |
108 | export function WindowSetMinSize(width, height) {
109 | window.runtime.WindowSetMinSize(width, height);
110 | }
111 |
112 | export function WindowSetPosition(x, y) {
113 | window.runtime.WindowSetPosition(x, y);
114 | }
115 |
116 | export function WindowGetPosition() {
117 | return window.runtime.WindowGetPosition();
118 | }
119 |
120 | export function WindowHide() {
121 | window.runtime.WindowHide();
122 | }
123 |
124 | export function WindowShow() {
125 | window.runtime.WindowShow();
126 | }
127 |
128 | export function WindowMaximise() {
129 | window.runtime.WindowMaximise();
130 | }
131 |
132 | export function WindowToggleMaximise() {
133 | window.runtime.WindowToggleMaximise();
134 | }
135 |
136 | export function WindowUnmaximise() {
137 | window.runtime.WindowUnmaximise();
138 | }
139 |
140 | export function WindowMinimise() {
141 | window.runtime.WindowMinimise();
142 | }
143 |
144 | export function WindowUnminimise() {
145 | window.runtime.WindowUnminimise();
146 | }
147 |
148 | export function WindowSetBackgroundColour(R, G, B, A) {
149 | window.runtime.WindowSetBackgroundColour(R, G, B, A);
150 | }
151 |
152 | export function ScreenGetAll() {
153 | return window.runtime.ScreenGetAll();
154 | }
155 |
156 | export function BrowserOpenURL(url) {
157 | window.runtime.BrowserOpenURL(url);
158 | }
159 |
160 | export function Environment() {
161 | return window.runtime.Environment();
162 | }
163 |
164 | export function Quit() {
165 | window.runtime.Quit();
166 | }
167 |
168 | export function Hide() {
169 | window.runtime.Hide();
170 | }
171 |
172 | export function Show() {
173 | window.runtime.Show();
174 | }
175 |
--------------------------------------------------------------------------------
/frontend/src/routes/about.svelte:
--------------------------------------------------------------------------------
1 |
2 | About
3 | Home
4 |
5 |
--------------------------------------------------------------------------------
/frontend/src/routes/index.svelte:
--------------------------------------------------------------------------------
1 |
14 |
15 | Welcome to SvelteKit
16 |
17 | Please enter your name below 👇
18 |
19 |
20 |
21 | {#if g}
22 | {#await g}
23 | loading
24 | {:then value }
25 | { value }
26 | {/await}
27 | {/if}
28 |
29 |
30 |
33 |
--------------------------------------------------------------------------------
/frontend/static/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/h8gi/wails-sveltekit-template/c0cc881e7aff9509fe2d066f8ccf52c32d50692f/frontend/static/favicon.png
--------------------------------------------------------------------------------
/frontend/svelte.config.js:
--------------------------------------------------------------------------------
1 | import adapter from '@sveltejs/adapter-static';
2 | import preprocess from 'svelte-preprocess';
3 |
4 | /** @type {import('@sveltejs/kit').Config} */
5 | const config = {
6 | // Consult https://github.com/sveltejs/svelte-preprocess
7 | // for more information about preprocessors
8 | preprocess: preprocess(),
9 |
10 | kit: {
11 | adapter: adapter({
12 | fallback: 'index.html',
13 | })
14 | }
15 | };
16 |
17 | export default config;
18 |
--------------------------------------------------------------------------------
/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./.svelte-kit/tsconfig.json",
3 | "compilerOptions": {
4 | "allowJs": true,
5 | "checkJs": true,
6 | "esModuleInterop": true,
7 | "forceConsistentCasingInFileNames": true,
8 | "resolveJsonModule": true,
9 | "skipLibCheck": true,
10 | "sourceMap": true,
11 | "strict": true
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/frontend/vite.config.js:
--------------------------------------------------------------------------------
1 | import { sveltekit } from '@sveltejs/kit/vite';
2 | import path from 'path'
3 |
4 | /** @type {import('vite').UserConfig} */
5 | const config = {
6 | plugins: [sveltekit()],
7 | };
8 |
9 | export default config;
10 |
--------------------------------------------------------------------------------
/go.tmpl.mod:
--------------------------------------------------------------------------------
1 | module changeme
2 |
3 | go 1.17
4 |
5 | require github.com/wailsapp/wails/v2 {{.WailsVersion}}
6 |
7 | require (
8 | github.com/bep/debounce v1.2.1 // indirect
9 | github.com/go-ole/go-ole v1.2.6 // indirect
10 | github.com/google/uuid v1.1.2 // indirect
11 | github.com/imdario/mergo v0.3.12 // indirect
12 | github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
13 | github.com/labstack/echo/v4 v4.7.2 // indirect
14 | github.com/labstack/gommon v0.3.1 // indirect
15 | github.com/leaanthony/go-ansi-parser v1.0.1 // indirect
16 | github.com/leaanthony/gosod v1.0.3 // indirect
17 | github.com/leaanthony/slicer v1.5.0 // indirect
18 | github.com/mattn/go-colorable v0.1.11 // indirect
19 | github.com/mattn/go-isatty v0.0.14 // indirect
20 | github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect
21 | github.com/pkg/errors v0.9.1 // indirect
22 | github.com/tkrajina/go-reflector v0.5.5 // indirect
23 | github.com/valyala/bytebufferpool v1.0.0 // indirect
24 | github.com/valyala/fasttemplate v1.2.1 // indirect
25 | github.com/wailsapp/mimetype v1.4.1 // indirect
26 | golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
27 | golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
28 | golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
29 | golang.org/x/text v0.3.7 // indirect
30 | )
31 |
32 | // replace github.com/wailsapp/wails/v2 {{.WailsVersion}} => {{.WailsDirectory}}
33 |
--------------------------------------------------------------------------------
/main.tmpl.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "embed"
5 | "log"
6 |
7 | "github.com/wailsapp/wails/v2"
8 | "github.com/wailsapp/wails/v2/pkg/logger"
9 | "github.com/wailsapp/wails/v2/pkg/options"
10 | "github.com/wailsapp/wails/v2/pkg/options/mac"
11 | "github.com/wailsapp/wails/v2/pkg/options/windows"
12 | )
13 |
14 | //go:embed frontend/build/*
15 | var assets embed.FS
16 |
17 | func main() {
18 | // Create an instance of the app structure
19 | app := NewApp()
20 |
21 | // Create application with options
22 | // Create application with options
23 | err := wails.Run(&options.App{
24 | Title: "{{.ProjectName}}",
25 | Width: 1024,
26 | Height: 768,
27 | MinWidth: 1024,
28 | MinHeight: 768,
29 | MaxWidth: 1280,
30 | MaxHeight: 800,
31 | DisableResize: false,
32 | Fullscreen: false,
33 | Frameless: false,
34 | StartHidden: false,
35 | HideWindowOnClose: false,
36 | BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
37 | Assets: assets,
38 | Menu: nil,
39 | Logger: nil,
40 | LogLevel: logger.DEBUG,
41 | OnStartup: app.startup,
42 | OnDomReady: app.domReady,
43 | OnBeforeClose: app.beforeClose,
44 | OnShutdown: app.shutdown,
45 | WindowStartState: options.Normal,
46 | Bind: []interface{}{
47 | app,
48 | },
49 | // Windows platform specific options
50 | Windows: &windows.Options{
51 | WebviewIsTransparent: false,
52 | WindowIsTranslucent: false,
53 | DisableWindowIcon: false,
54 | // DisableFramelessWindowDecorations: false,
55 | WebviewUserDataPath: "",
56 | },
57 | // Mac platform specific options
58 | Mac: &mac.Options{
59 | TitleBar: &mac.TitleBar{
60 | TitlebarAppearsTransparent: false,
61 | HideTitle: false,
62 | HideTitleBar: false,
63 | FullSizeContent: false,
64 | UseToolbar: false,
65 | HideToolbarSeparator: true,
66 | },
67 | Appearance: mac.NSAppearanceNameAqua,
68 | WebviewIsTransparent: true,
69 | WindowIsTranslucent: true,
70 | About: &mac.AboutInfo{
71 | Title: "{{.ProjectName}}",
72 | Message: "",
73 | },
74 | },
75 | })
76 |
77 | if err != nil {
78 | log.Fatal(err)
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Wails SvelteKit template",
3 | "shortname": "wails-sveltekit-template",
4 | "author": "h8gi",
5 | "description": "SvelteKit template with TS",
6 | "helpurl": "https://github.com/h8gi/wails-sveltekit"
7 | }
8 |
--------------------------------------------------------------------------------
/wails.tmpl.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "{{.ProjectName}}",
3 | "outputfilename": "{{.BinaryName}}",
4 | "frontend:install": "pnpm install",
5 | "frontend:build": "pnpm run build",
6 | "frontend:dev:watcher": "pnpm run dev",
7 | "frontend:dev:serverUrl": "auto",
8 | "wailsjsdir": "./frontend/src/lib",
9 | "author": {
10 | "name": "{{.AuthorName}}",
11 | "email": "{{.AuthorEmail}}"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------