@witchcraft/nuxt-electron 0.0.1 → 0.0.2
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 +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -2
- package/dist/runtime/components/ElectronWindowControls.d.vue.ts +2 -1
- package/dist/runtime/components/ElectronWindowControls.vue.d.ts +2 -1
- package/dist/runtime/components/WindowControls/CloseButton.d.vue.ts +3 -2
- package/dist/runtime/components/WindowControls/CloseButton.vue.d.ts +3 -2
- package/dist/runtime/components/WindowControls/MaximizeButton.d.vue.ts +3 -2
- package/dist/runtime/components/WindowControls/MaximizeButton.vue.d.ts +3 -2
- package/dist/runtime/components/WindowControls/MinimizeButton.d.vue.ts +3 -2
- package/dist/runtime/components/WindowControls/MinimizeButton.vue.d.ts +3 -2
- package/dist/runtime/components/WindowControls/PinButton.d.vue.ts +5 -4
- package/dist/runtime/components/WindowControls/PinButton.vue.d.ts +5 -4
- package/package.json +9 -9
- package/src/module.ts +7 -2
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
- `createBroadcasters/createBroadcastHandlers` for sending messages to all windows.
|
|
26
26
|
- `createWindowControlsApi` for calling close/minimize/maximize/pin from the renderer and an `ElectronWindowControls` component for rending a basic set.
|
|
27
27
|
- `promisifyApi`(preload) and `promisifyReply`(main) for easily creating and handling apis in the preload script.
|
|
28
|
-
- See also [@witchcraft/nuxt-logger](
|
|
28
|
+
- See also [@witchcraft/nuxt-logger](https://github.com/witchcraftjs/nuxt-logger) for electron logging utilities.
|
|
29
29
|
|
|
30
30
|
# Playground
|
|
31
31
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { crop } from '@alanscodelog/utils/crop';
|
|
2
2
|
import { run } from '@alanscodelog/utils/run';
|
|
3
|
-
import { defineNuxtModule, useLogger, createResolver, addComponentsDir,
|
|
3
|
+
import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addTemplate, extendRouteRules, addImportsDir } from '@nuxt/kit';
|
|
4
4
|
import { nuxtRemoveUneededPages, nuxtFileBasedRouting, nuxtRerouteOutputTo, createConstantCaseVariables } from '@witchcraft/nuxt-utils/utils';
|
|
5
5
|
import { defu } from 'defu';
|
|
6
6
|
import fs from 'node:fs/promises';
|
|
@@ -9,6 +9,11 @@ import { startup, build } from 'vite-plugin-electron';
|
|
|
9
9
|
import { notBundle } from 'vite-plugin-electron/plugin';
|
|
10
10
|
import { externalizeDeps } from 'vite-plugin-externalize-deps';
|
|
11
11
|
|
|
12
|
+
const dependencies = {
|
|
13
|
+
"@witchcraft/ui": "^0.3.1"};
|
|
14
|
+
const pkg = {
|
|
15
|
+
dependencies: dependencies};
|
|
16
|
+
|
|
12
17
|
startup.exit = async () => {
|
|
13
18
|
if ("electronApp" in process) {
|
|
14
19
|
try {
|
|
@@ -45,6 +50,11 @@ const module = defineNuxtModule({
|
|
|
45
50
|
additionalViteDefinesToCopy: [],
|
|
46
51
|
notBundleOptions: {}
|
|
47
52
|
},
|
|
53
|
+
moduleDependencies: {
|
|
54
|
+
"@witchcraft/ui/nuxt": {
|
|
55
|
+
version: pkg.dependencies["@witchcraft/ui"]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
48
58
|
async setup(options, nuxt) {
|
|
49
59
|
if (!options.enable) {
|
|
50
60
|
return;
|
|
@@ -56,7 +66,6 @@ const module = defineNuxtModule({
|
|
|
56
66
|
global: true,
|
|
57
67
|
path: resolve("runtime/components")
|
|
58
68
|
});
|
|
59
|
-
await installModule("@witchcraft/ui/nuxt", nuxt.options.witchcraftUi);
|
|
60
69
|
addTemplate({
|
|
61
70
|
filename: "witchcraft-electron.css",
|
|
62
71
|
write: true,
|
|
@@ -22,10 +22,11 @@ type __VLS_Props = {
|
|
|
22
22
|
buttonsOrder?: ("CloseButton" | "MinimizeButton" | "MaximizeButton" | "PinButton")[];
|
|
23
23
|
handler?: WindowControlsApi;
|
|
24
24
|
};
|
|
25
|
-
declare const
|
|
25
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
26
26
|
borderWidth: string;
|
|
27
27
|
buttonSize: string;
|
|
28
28
|
borderRadius: string;
|
|
29
29
|
buttonsOrder: ("CloseButton" | "MinimizeButton" | "MaximizeButton" | "PinButton")[];
|
|
30
30
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
|
+
declare const _default: typeof __VLS_export;
|
|
31
32
|
export default _default;
|
|
@@ -22,10 +22,11 @@ type __VLS_Props = {
|
|
|
22
22
|
buttonsOrder?: ("CloseButton" | "MinimizeButton" | "MaximizeButton" | "PinButton")[];
|
|
23
23
|
handler?: WindowControlsApi;
|
|
24
24
|
};
|
|
25
|
-
declare const
|
|
25
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
26
26
|
borderWidth: string;
|
|
27
27
|
buttonSize: string;
|
|
28
28
|
borderRadius: string;
|
|
29
29
|
buttonsOrder: ("CloseButton" | "MinimizeButton" | "MaximizeButton" | "PinButton")[];
|
|
30
30
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
|
+
declare const _default: typeof __VLS_export;
|
|
31
32
|
export default _default;
|
|
@@ -2,12 +2,13 @@ declare var __VLS_10: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_10) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
6
|
action: (action: "close") => any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
8
8
|
onAction?: ((action: "close") => any) | undefined;
|
|
9
9
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
|
-
declare const
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
11
12
|
export default _default;
|
|
12
13
|
type __VLS_WithSlots<T, S> = T & {
|
|
13
14
|
new (): {
|
|
@@ -2,12 +2,13 @@ declare var __VLS_10: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_10) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
6
|
action: (action: "close") => any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
8
8
|
onAction?: ((action: "close") => any) | undefined;
|
|
9
9
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
|
-
declare const
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
11
12
|
export default _default;
|
|
12
13
|
type __VLS_WithSlots<T, S> = T & {
|
|
13
14
|
new (): {
|
|
@@ -2,12 +2,13 @@ declare var __VLS_10: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_10) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
6
|
action: (action: "toggleMaximize") => any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
8
8
|
onAction?: ((action: "toggleMaximize") => any) | undefined;
|
|
9
9
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
|
-
declare const
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
11
12
|
export default _default;
|
|
12
13
|
type __VLS_WithSlots<T, S> = T & {
|
|
13
14
|
new (): {
|
|
@@ -2,12 +2,13 @@ declare var __VLS_10: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_10) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
6
|
action: (action: "toggleMaximize") => any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
8
8
|
onAction?: ((action: "toggleMaximize") => any) | undefined;
|
|
9
9
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
|
-
declare const
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
11
12
|
export default _default;
|
|
12
13
|
type __VLS_WithSlots<T, S> = T & {
|
|
13
14
|
new (): {
|
|
@@ -2,12 +2,13 @@ declare var __VLS_10: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_10) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
6
|
action: (action: "minimize") => any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
8
8
|
onAction?: ((action: "minimize") => any) | undefined;
|
|
9
9
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
|
-
declare const
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
11
12
|
export default _default;
|
|
12
13
|
type __VLS_WithSlots<T, S> = T & {
|
|
13
14
|
new (): {
|
|
@@ -2,12 +2,13 @@ declare var __VLS_10: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_10) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
6
|
action: (action: "minimize") => any;
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
8
8
|
onAction?: ((action: "minimize") => any) | undefined;
|
|
9
9
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
|
-
declare const
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
11
12
|
export default _default;
|
|
12
13
|
type __VLS_WithSlots<T, S> = T & {
|
|
13
14
|
new (): {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
2
|
/**
|
|
3
3
|
* If there is a `window.electron.on` api that allows listening to events and main sends an `always-on-top-changed`, it will update the state of the pin.
|
|
4
4
|
*/
|
|
@@ -10,15 +10,16 @@ declare var __VLS_10: {
|
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
11
11
|
default?: (props: typeof __VLS_10) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
14
|
"update:modelValue": (value: boolean) => any;
|
|
15
15
|
} & {
|
|
16
16
|
action: (action: "togglePin") => any;
|
|
17
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
18
18
|
onAction?: ((action: "togglePin") => any) | undefined;
|
|
19
19
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
20
20
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
-
declare const
|
|
21
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
22
23
|
export default _default;
|
|
23
24
|
type __VLS_WithSlots<T, S> = T & {
|
|
24
25
|
new (): {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
2
|
/**
|
|
3
3
|
* If there is a `window.electron.on` api that allows listening to events and main sends an `always-on-top-changed`, it will update the state of the pin.
|
|
4
4
|
*/
|
|
@@ -10,15 +10,16 @@ declare var __VLS_10: {
|
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
11
11
|
default?: (props: typeof __VLS_10) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
14
|
"update:modelValue": (value: boolean) => any;
|
|
15
15
|
} & {
|
|
16
16
|
action: (action: "togglePin") => any;
|
|
17
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
18
18
|
onAction?: ((action: "togglePin") => any) | undefined;
|
|
19
19
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
20
20
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
-
declare const
|
|
21
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
22
23
|
export default _default;
|
|
23
24
|
type __VLS_WithSlots<T, S> = T & {
|
|
24
25
|
new (): {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witchcraft/nuxt-electron",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Nuxt module for working with electron.",
|
|
5
5
|
"repository": "witchcraftjs/nuxt-electron",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
"test:watch": "vitest watch"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@alanscodelog/utils": "^6.0.
|
|
39
|
+
"@alanscodelog/utils": "^6.0.2",
|
|
40
40
|
"@nuxt/kit": "^4.0.3",
|
|
41
|
-
"@witchcraft/nuxt-utils": "^0.2
|
|
41
|
+
"@witchcraft/nuxt-utils": "^0.3.2",
|
|
42
|
+
"@witchcraft/ui": "^0.3.1",
|
|
42
43
|
"defu": "^6.1.4",
|
|
43
44
|
"es-toolkit": "^1.39.10",
|
|
44
45
|
"vite-plugin-electron": "^0.29.0",
|
|
45
46
|
"vite-plugin-externalize-deps": "^0.9.0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"@witchcraft/ui": "^0.
|
|
49
|
+
"@witchcraft/ui": "^0.3.1",
|
|
49
50
|
"unplugin-icons": "^22.1.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependenciesMeta": {
|
|
@@ -57,23 +58,22 @@
|
|
|
57
58
|
}
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@alanscodelog/eslint-config": "^6.3.
|
|
61
|
+
"@alanscodelog/eslint-config": "^6.3.1",
|
|
61
62
|
"@alanscodelog/semantic-release-config": "^5.0.4",
|
|
62
|
-
"@alanscodelog/tsconfigs": "^6.
|
|
63
|
+
"@alanscodelog/tsconfigs": "^6.2.0",
|
|
63
64
|
"@nuxt/eslint-config": "^1.9.0",
|
|
64
65
|
"@nuxt/module-builder": "^1.0.2",
|
|
65
66
|
"@nuxt/schema": "^4.0.3",
|
|
66
67
|
"@nuxt/test-utils": "^3.19.2",
|
|
67
68
|
"@types/node": "latest",
|
|
68
|
-
"@witchcraft/ui": "^0.2.1",
|
|
69
69
|
"changelogen": "^0.6.2",
|
|
70
|
-
"electron": "^
|
|
70
|
+
"electron": "^38.0.0",
|
|
71
71
|
"eslint": "^9.34.0",
|
|
72
72
|
"husky": "^9.1.7",
|
|
73
73
|
"json5": "^2.2.3",
|
|
74
74
|
"nuxt": "^4.0.3",
|
|
75
75
|
"typescript": "^5.8.3",
|
|
76
|
-
"unplugin-icons": "^22.
|
|
76
|
+
"unplugin-icons": "^22.3.0",
|
|
77
77
|
"vitest": "^3.2.4",
|
|
78
78
|
"vue-tsc": "^3.0.6"
|
|
79
79
|
},
|
package/src/module.ts
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
createResolver,
|
|
8
8
|
defineNuxtModule,
|
|
9
9
|
extendRouteRules,
|
|
10
|
-
installModule,
|
|
11
10
|
useLogger
|
|
12
11
|
} from "@nuxt/kit"
|
|
13
12
|
import { createConstantCaseVariables, nuxtFileBasedRouting, nuxtRemoveUneededPages, nuxtRerouteOutputTo } from "@witchcraft/nuxt-utils/utils"
|
|
@@ -21,6 +20,8 @@ import { build, type ElectronOptions, startup } from "vite-plugin-electron"
|
|
|
21
20
|
import { notBundle } from "vite-plugin-electron/plugin"
|
|
22
21
|
import { externalizeDeps } from "vite-plugin-externalize-deps"
|
|
23
22
|
|
|
23
|
+
import pkg from "../package.json" with { type: "json" }
|
|
24
|
+
|
|
24
25
|
// https://github.com/electron-vite/vite-plugin-electron/issues/251#issuecomment-2360153184
|
|
25
26
|
startup.exit = async () => {
|
|
26
27
|
if ("electronApp" in process) {
|
|
@@ -172,6 +173,11 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
172
173
|
additionalViteDefinesToCopy: [],
|
|
173
174
|
notBundleOptions: {}
|
|
174
175
|
},
|
|
176
|
+
moduleDependencies: {
|
|
177
|
+
"@witchcraft/ui/nuxt": {
|
|
178
|
+
version: pkg.dependencies["@witchcraft/ui"]
|
|
179
|
+
}
|
|
180
|
+
},
|
|
175
181
|
async setup(options, nuxt) {
|
|
176
182
|
if (!options.enable) { return }
|
|
177
183
|
const moduleName = "@witchcraft/nuxt-electron"
|
|
@@ -182,7 +188,6 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
182
188
|
global: true,
|
|
183
189
|
path: resolve("runtime/components")
|
|
184
190
|
})
|
|
185
|
-
await installModule("@witchcraft/ui/nuxt", (nuxt.options as any).witchcraftUi)
|
|
186
191
|
|
|
187
192
|
addTemplate({
|
|
188
193
|
filename: "witchcraft-electron.css",
|