@tauri-controls-v2/svelte 0.4.1
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/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/WindowControls.svelte +42 -0
- package/dist/WindowControls.svelte.d.ts +25 -0
- package/dist/WindowControls.svelte.d.ts.map +1 -0
- package/dist/WindowTitlebar.svelte +37 -0
- package/dist/WindowTitlebar.svelte.d.ts +33 -0
- package/dist/WindowTitlebar.svelte.d.ts.map +1 -0
- package/dist/components/Button.svelte +14 -0
- package/dist/components/Button.svelte.d.ts +44 -0
- package/dist/components/Button.svelte.d.ts.map +1 -0
- package/dist/components/Icons.svelte +133 -0
- package/dist/components/Icons.svelte.d.ts +29 -0
- package/dist/components/Icons.svelte.d.ts.map +1 -0
- package/dist/controls/MacOs.svelte +101 -0
- package/dist/controls/MacOs.svelte.d.ts +27 -0
- package/dist/controls/MacOs.svelte.d.ts.map +1 -0
- package/dist/controls/Windows.svelte +46 -0
- package/dist/controls/Windows.svelte.d.ts +27 -0
- package/dist/controls/Windows.svelte.d.ts.map +1 -0
- package/dist/controls/linux/Gnome.svelte +46 -0
- package/dist/controls/linux/Gnome.svelte.d.ts +27 -0
- package/dist/controls/linux/Gnome.svelte.d.ts.map +1 -0
- package/dist/index.css +35 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/types.d.ts +69 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/os.d.ts +4 -0
- package/dist/utils/os.d.ts.map +1 -0
- package/dist/utils/os.js +10 -0
- package/dist/utils/utils.d.ts +3 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +5 -0
- package/dist/utils/window.d.ts +9 -0
- package/dist/utils/window.d.ts.map +1 -0
- package/dist/utils/window.js +33 -0
- package/package.json +100 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 eatham532
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<picture>
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/eatham532/tauri-controls-v2/assets/16024979/8ac8cae0-9cde-4b27-af8b-02d949ede7a2">
|
|
3
|
+
<img alt="Tauri Controls" src="https://github.com/eatham532/tauri-controls-v2/assets/16024979/12f46aa7-72de-4c44-aa4a-0580c73fc73a">
|
|
4
|
+
</picture>
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## @tauri-controls-v2/svelte
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add @tauri-controls-v2/svelte
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
https://github.com/eatham532/tauri-controls-v2
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">import { osType } from "./utils/os";
|
|
2
|
+
import { cn } from "./utils/utils";
|
|
3
|
+
import { initializeAppWindow } from "./utils/window";
|
|
4
|
+
import Gnome from "./controls/linux/Gnome.svelte";
|
|
5
|
+
import MacOs from "./controls/MacOs.svelte";
|
|
6
|
+
import Windows from "./controls/Windows.svelte";
|
|
7
|
+
import { onMount } from "svelte";
|
|
8
|
+
export let platform = "windows";
|
|
9
|
+
export let hide = false;
|
|
10
|
+
export let hideMethod = "display";
|
|
11
|
+
export let justify = false;
|
|
12
|
+
onMount(() => {
|
|
13
|
+
initializeAppWindow();
|
|
14
|
+
});
|
|
15
|
+
const customClass = cn(
|
|
16
|
+
"tauri-controls flex",
|
|
17
|
+
$$props.class,
|
|
18
|
+
hide && (hideMethod === "display" ? "hidden" : "invisible")
|
|
19
|
+
);
|
|
20
|
+
if (!platform) {
|
|
21
|
+
switch (osType) {
|
|
22
|
+
case "macos":
|
|
23
|
+
platform = "macos";
|
|
24
|
+
break;
|
|
25
|
+
case "linux":
|
|
26
|
+
platform = "gnome";
|
|
27
|
+
break;
|
|
28
|
+
default:
|
|
29
|
+
platform = "windows";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
{#if platform === "windows"}
|
|
35
|
+
<Windows {...$$props} class={cn(customClass, justify && "ml-auto")} />
|
|
36
|
+
{:else if platform === "macos"}
|
|
37
|
+
<MacOs {...$$props} class={cn(customClass, justify && "ml-0")} />
|
|
38
|
+
{:else if platform === "gnome"}
|
|
39
|
+
<Gnome {...$$props} class={cn(customClass, justify && "ml-auto")} />
|
|
40
|
+
{:else}
|
|
41
|
+
<Windows {...$$props} class={cn(customClass, justify && "ml-auto")} />
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const WindowControls: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
platform?: string | undefined;
|
|
17
|
+
hide?: boolean | undefined;
|
|
18
|
+
hideMethod?: string | undefined;
|
|
19
|
+
justify?: boolean | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
}, {}, {}, string>;
|
|
23
|
+
type WindowControls = InstanceType<typeof WindowControls>;
|
|
24
|
+
export default WindowControls;
|
|
25
|
+
//# sourceMappingURL=WindowControls.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowControls.svelte.d.ts","sourceRoot":"","sources":["../src/lib/WindowControls.svelte.ts"],"names":[],"mappings":"AA8DA,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAKD,QAAA,MAAM,cAAc;;;;;;;;kBAAsG,CAAC;AACzG,KAAK,cAAc,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts">import { osType } from "./utils/os";
|
|
2
|
+
import { cn } from "./utils/utils";
|
|
3
|
+
import WindowControls from "./WindowControls.svelte";
|
|
4
|
+
export let controlsOrder = "system";
|
|
5
|
+
export let windowControlsProps = {};
|
|
6
|
+
const left = controlsOrder === "left" || controlsOrder === "platform" && windowControlsProps?.platform === "macos" || controlsOrder === "system" && osType === "macos";
|
|
7
|
+
const props = (ml) => {
|
|
8
|
+
if (windowControlsProps?.justify !== void 0) return windowControlsProps;
|
|
9
|
+
const {
|
|
10
|
+
justify: windowControlsJustify,
|
|
11
|
+
class: windowControlsClass,
|
|
12
|
+
...restProps
|
|
13
|
+
} = windowControlsProps;
|
|
14
|
+
return {
|
|
15
|
+
justify: false,
|
|
16
|
+
class: cn(windowControlsClass, ml),
|
|
17
|
+
...restProps
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<div
|
|
23
|
+
{...$$props}
|
|
24
|
+
class={cn(
|
|
25
|
+
"tauri-controls bg-background flex select-none flex-row overflow-hidden",
|
|
26
|
+
$$props.class
|
|
27
|
+
)}
|
|
28
|
+
data-tauri-drag-region
|
|
29
|
+
>
|
|
30
|
+
{#if left}
|
|
31
|
+
<WindowControls {...props("ml-0")} />
|
|
32
|
+
<slot />
|
|
33
|
+
{:else}
|
|
34
|
+
<slot />
|
|
35
|
+
<WindowControls {...props("ml-auto")} />
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { WindowControlsProps } from "./types";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
+
default: any;
|
|
17
|
+
} ? Props extends Record<string, never> ? any : {
|
|
18
|
+
children?: any;
|
|
19
|
+
} : {});
|
|
20
|
+
declare const WindowTitlebar: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
controlsOrder?: string | undefined;
|
|
23
|
+
windowControlsProps?: WindowControlsProps | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
default: {};
|
|
26
|
+
}>, {
|
|
27
|
+
[evt: string]: CustomEvent<any>;
|
|
28
|
+
}, {
|
|
29
|
+
default: {};
|
|
30
|
+
}, {}, string>;
|
|
31
|
+
type WindowTitlebar = InstanceType<typeof WindowTitlebar>;
|
|
32
|
+
export default WindowTitlebar;
|
|
33
|
+
//# sourceMappingURL=WindowTitlebar.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowTitlebar.svelte.d.ts","sourceRoot":"","sources":["../src/lib/WindowTitlebar.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAiDlD,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AACD,KAAK,gCAAgC,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,GACvD,CAAC,KAAK,SAAS;IAAE,OAAO,EAAE,GAAG,CAAA;CAAE,GACzB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACnC,GAAG,GACH;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,GAClB,EAAE,CAAC,CAAC;AAId,QAAA,MAAM,cAAc;;;0BAfsI,mBAAmB;;;;;;;cAe7C,CAAC;AAC/G,KAAK,cAAc,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export default Button;
|
|
2
|
+
type Button = SvelteComponent<$$__sveltets_2_PropsWithChildren<{
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
}, {
|
|
5
|
+
default: {};
|
|
6
|
+
}>, {
|
|
7
|
+
click: PointerEvent;
|
|
8
|
+
} & {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
}, {
|
|
11
|
+
default: {};
|
|
12
|
+
}> & {
|
|
13
|
+
$$bindings?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
declare const Button: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
}, {
|
|
18
|
+
default: {};
|
|
19
|
+
}>, {
|
|
20
|
+
click: PointerEvent;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {
|
|
24
|
+
default: {};
|
|
25
|
+
}, {}, string>;
|
|
26
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
27
|
+
default: any;
|
|
28
|
+
} ? Props extends Record<string, never> ? any : {
|
|
29
|
+
children?: any;
|
|
30
|
+
} : {});
|
|
31
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
32
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
33
|
+
$$bindings?: Bindings;
|
|
34
|
+
} & Exports;
|
|
35
|
+
(internal: unknown, props: Props & {
|
|
36
|
+
$$events?: Events;
|
|
37
|
+
$$slots?: Slots;
|
|
38
|
+
}): Exports & {
|
|
39
|
+
$set?: any;
|
|
40
|
+
$on?: any;
|
|
41
|
+
};
|
|
42
|
+
z_$$bindings?: Bindings;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=Button.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Button.svelte.js"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCA;;;;;;;;;;eAAiI;sCAT3F,KAAK,EAAE,KAAK;;;;;6CALL,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export let icon = ""
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
{#if icon === "minimizeWin"}
|
|
6
|
+
<svg
|
|
7
|
+
width="10"
|
|
8
|
+
height="1"
|
|
9
|
+
viewBox="0 0 10 1"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
{...$$props}
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
d="M0.498047 1.00098C0.429688 1.00098 0.364583 0.987956 0.302734 0.961914C0.244141 0.935872 0.192057 0.900065 0.146484 0.854492C0.100911 0.808919 0.0651042 0.756836 0.0390625 0.698242C0.0130208 0.636393 0 0.571289 0 0.50293C0 0.43457 0.0130208 0.371094 0.0390625 0.3125C0.0651042 0.250651 0.100911 0.19694 0.146484 0.151367C0.192057 0.102539 0.244141 0.0651042 0.302734 0.0390625C0.364583 0.0130208 0.429688 0 0.498047 0H9.50195C9.57031 0 9.63379 0.0130208 9.69238 0.0390625C9.75423 0.0651042 9.80794 0.102539 9.85352 0.151367C9.89909 0.19694 9.9349 0.250651 9.96094 0.3125C9.98698 0.371094 10 0.43457 10 0.50293C10 0.571289 9.98698 0.636393 9.96094 0.698242C9.9349 0.756836 9.89909 0.808919 9.85352 0.854492C9.80794 0.900065 9.75423 0.935872 9.69238 0.961914C9.63379 0.987956 9.57031 1.00098 9.50195 1.00098H0.498047Z"
|
|
16
|
+
fill="currentColor"
|
|
17
|
+
fill-opacity="0.8956"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
{:else if icon === "maximizeWin"}
|
|
21
|
+
<svg
|
|
22
|
+
width="10"
|
|
23
|
+
height="10"
|
|
24
|
+
viewBox="0 0 10 10"
|
|
25
|
+
fill="none"
|
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
27
|
+
{...$$props}
|
|
28
|
+
>
|
|
29
|
+
<path
|
|
30
|
+
d="M1.47461 10.001C1.2793 10.001 1.09212 9.96191 0.913086 9.88379C0.734049 9.80241 0.576172 9.69499 0.439453 9.56152C0.30599 9.4248 0.198568 9.26693 0.117188 9.08789C0.0390625 8.90885 0 8.72168 0 8.52637V1.47559C0 1.28027 0.0390625 1.0931 0.117188 0.914062C0.198568 0.735026 0.30599 0.578776 0.439453 0.445312C0.576172 0.308594 0.734049 0.201172 0.913086 0.123047C1.09212 0.0416667 1.2793 0.000976562 1.47461 0.000976562H8.52539C8.7207 0.000976562 8.90788 0.0416667 9.08691 0.123047C9.26595 0.201172 9.4222 0.308594 9.55566 0.445312C9.69238 0.578776 9.7998 0.735026 9.87793 0.914062C9.95931 1.0931 10 1.28027 10 1.47559V8.52637C10 8.72168 9.95931 8.90885 9.87793 9.08789C9.7998 9.26693 9.69238 9.4248 9.55566 9.56152C9.4222 9.69499 9.26595 9.80241 9.08691 9.88379C8.90788 9.96191 8.7207 10.001 8.52539 10.001H1.47461ZM8.50098 9C8.56934 9 8.63281 8.98698 8.69141 8.96094C8.75326 8.9349 8.80697 8.89909 8.85254 8.85352C8.89811 8.80794 8.93392 8.75586 8.95996 8.69727C8.986 8.63542 8.99902 8.57031 8.99902 8.50195V1.5C8.99902 1.43164 8.986 1.36816 8.95996 1.30957C8.93392 1.24772 8.89811 1.19401 8.85254 1.14844C8.80697 1.10286 8.75326 1.06706 8.69141 1.04102C8.63281 1.01497 8.56934 1.00195 8.50098 1.00195H1.49902C1.43066 1.00195 1.36556 1.01497 1.30371 1.04102C1.24512 1.06706 1.19303 1.10286 1.14746 1.14844C1.10189 1.19401 1.06608 1.24772 1.04004 1.30957C1.014 1.36816 1.00098 1.43164 1.00098 1.5V8.50195C1.00098 8.57031 1.014 8.63542 1.04004 8.69727C1.06608 8.75586 1.10189 8.80794 1.14746 8.85352C1.19303 8.89909 1.24512 8.9349 1.30371 8.96094C1.36556 8.98698 1.43066 9 1.49902 9H8.50098Z"
|
|
31
|
+
fill="currentColor"
|
|
32
|
+
fill-opacity="0.8956"
|
|
33
|
+
/>
|
|
34
|
+
</svg>
|
|
35
|
+
{:else if icon === "maximizeRestoreWin"}
|
|
36
|
+
<svg
|
|
37
|
+
width="10"
|
|
38
|
+
height="11"
|
|
39
|
+
viewBox="0 0 10 11"
|
|
40
|
+
fill="none"
|
|
41
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
+
{...$$props}
|
|
43
|
+
>
|
|
44
|
+
<path
|
|
45
|
+
d="M8.99902 2.98096C8.99902 2.71077 8.94531 2.45687 8.83789 2.21924C8.73047 1.97835 8.58398 1.77002 8.39844 1.59424C8.21615 1.4152 8.00293 1.27523 7.75879 1.17432C7.5179 1.07015 7.264 1.01807 6.99707 1.01807H2.08496C2.13704 0.868327 2.21029 0.731608 2.30469 0.60791C2.39909 0.484212 2.50814 0.378418 2.63184 0.290527C2.75553 0.202637 2.89062 0.135905 3.03711 0.090332C3.18685 0.0415039 3.34147 0.0170898 3.50098 0.0170898H6.99707C7.41048 0.0170898 7.79948 0.0968424 8.16406 0.256348C8.52865 0.412598 8.84603 0.625814 9.11621 0.895996C9.38965 1.16618 9.60449 1.48356 9.76074 1.84814C9.92025 2.21273 10 2.60173 10 3.01514V6.51611C10 6.67562 9.97559 6.83024 9.92676 6.97998C9.88118 7.12646 9.81445 7.26156 9.72656 7.38525C9.63867 7.50895 9.53288 7.618 9.40918 7.7124C9.28548 7.8068 9.14876 7.88005 8.99902 7.93213V2.98096ZM1.47461 10.0171C1.2793 10.0171 1.09212 9.97803 0.913086 9.8999C0.734049 9.81852 0.576172 9.7111 0.439453 9.57764C0.30599 9.44092 0.198568 9.28304 0.117188 9.104C0.0390625 8.92497 0 8.73779 0 8.54248V3.49365C0 3.29508 0.0390625 3.10791 0.117188 2.93213C0.198568 2.75309 0.30599 2.59684 0.439453 2.46338C0.576172 2.32666 0.732422 2.21924 0.908203 2.14111C1.08724 2.05973 1.27604 2.01904 1.47461 2.01904H6.52344C6.72201 2.01904 6.91081 2.05973 7.08984 2.14111C7.26888 2.21924 7.42513 2.32503 7.55859 2.4585C7.69206 2.59196 7.79785 2.74821 7.87598 2.92725C7.95736 3.10628 7.99805 3.29508 7.99805 3.49365V8.54248C7.99805 8.74105 7.95736 8.92985 7.87598 9.10889C7.79785 9.28467 7.69043 9.44092 7.55371 9.57764C7.42025 9.7111 7.264 9.81852 7.08496 9.8999C6.90918 9.97803 6.72201 10.0171 6.52344 10.0171H1.47461ZM6.49902 9.01611C6.56738 9.01611 6.63086 9.00309 6.68945 8.97705C6.7513 8.95101 6.80501 8.9152 6.85059 8.86963C6.89941 8.82406 6.93685 8.77197 6.96289 8.71338C6.98893 8.65153 7.00195 8.58643 7.00195 8.51807V3.51807C7.00195 3.44971 6.98893 3.3846 6.96289 3.32275C6.93685 3.2609 6.90104 3.20719 6.85547 3.16162C6.8099 3.11605 6.75618 3.08024 6.69434 3.0542C6.63249 3.02816 6.56738 3.01514 6.49902 3.01514H1.49902C1.43066 3.01514 1.36556 3.02816 1.30371 3.0542C1.24512 3.08024 1.19303 3.11768 1.14746 3.1665C1.10189 3.21208 1.06608 3.26579 1.04004 3.32764C1.014 3.38623 1.00098 3.44971 1.00098 3.51807V8.51807C1.00098 8.58643 1.014 8.65153 1.04004 8.71338C1.06608 8.77197 1.10189 8.82406 1.14746 8.86963C1.19303 8.9152 1.24512 8.95101 1.30371 8.97705C1.36556 9.00309 1.43066 9.01611 1.49902 9.01611H6.49902Z"
|
|
46
|
+
fill="currentColor"
|
|
47
|
+
fill-opacity="0.8956"
|
|
48
|
+
/>
|
|
49
|
+
</svg>
|
|
50
|
+
{:else if icon === "closeWin"}
|
|
51
|
+
<svg
|
|
52
|
+
width="10"
|
|
53
|
+
height="10"
|
|
54
|
+
viewBox="0 0 10 10"
|
|
55
|
+
fill="none"
|
|
56
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
57
|
+
{...$$props}
|
|
58
|
+
>
|
|
59
|
+
<path
|
|
60
|
+
d="M5 5.70898L0.854492 9.85449C0.756836 9.95215 0.639648 10.001 0.50293 10.001C0.359701 10.001 0.239258 9.95378 0.141602 9.85938C0.0472005 9.76172 0 9.64128 0 9.49805C0 9.36133 0.0488281 9.24414 0.146484 9.14648L4.29199 5.00098L0.146484 0.855469C0.0488281 0.757812 0 0.638997 0 0.499023C0 0.430664 0.0130208 0.36556 0.0390625 0.303711C0.0651042 0.241862 0.100911 0.189779 0.146484 0.147461C0.192057 0.101888 0.245768 0.0660807 0.307617 0.0400391C0.369466 0.0139974 0.43457 0.000976562 0.50293 0.000976562C0.639648 0.000976562 0.756836 0.0498047 0.854492 0.147461L5 4.29297L9.14551 0.147461C9.24316 0.0498047 9.36198 0.000976562 9.50195 0.000976562C9.57031 0.000976562 9.63379 0.0139974 9.69238 0.0400391C9.75423 0.0660807 9.80794 0.101888 9.85352 0.147461C9.89909 0.193034 9.9349 0.246745 9.96094 0.308594C9.98698 0.367188 10 0.430664 10 0.499023C10 0.638997 9.95117 0.757812 9.85352 0.855469L5.70801 5.00098L9.85352 9.14648C9.95117 9.24414 10 9.36133 10 9.49805C10 9.56641 9.98698 9.63151 9.96094 9.69336C9.9349 9.75521 9.89909 9.80892 9.85352 9.85449C9.8112 9.90007 9.75911 9.93587 9.69727 9.96191C9.63542 9.98796 9.57031 10.001 9.50195 10.001C9.36198 10.001 9.24316 9.95215 9.14551 9.85449L5 5.70898Z"
|
|
61
|
+
fill="currentColor"
|
|
62
|
+
fill-opacity="0.8956"
|
|
63
|
+
/>
|
|
64
|
+
</svg>
|
|
65
|
+
{:else if icon === "closeMac"}
|
|
66
|
+
<svg
|
|
67
|
+
width="6"
|
|
68
|
+
height="6"
|
|
69
|
+
viewBox="0 0 16 18"
|
|
70
|
+
fill="none"
|
|
71
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
72
|
+
{...$$props}
|
|
73
|
+
>
|
|
74
|
+
<path
|
|
75
|
+
d="M15.7522 4.44381L11.1543 9.04165L15.7494 13.6368C16.0898 13.9771 16.078 14.5407 15.724 14.8947L13.8907 16.728C13.5358 17.0829 12.9731 17.0938 12.6328 16.7534L8.03766 12.1583L3.44437 16.7507C3.10402 17.091 2.54132 17.0801 2.18645 16.7253L0.273257 14.8121C-0.0807018 14.4572 -0.0925004 13.8945 0.247845 13.5542L4.84024 8.96087L0.32499 4.44653C-0.0153555 4.10619 -0.00355681 3.54258 0.350402 3.18862L2.18373 1.35529C2.53859 1.00042 3.1013 0.989533 3.44164 1.32988L7.95689 5.84422L12.5556 1.24638C12.8951 0.906035 13.4587 0.917833 13.8126 1.27179L15.7267 3.18589C16.0807 3.53985 16.0925 4.10346 15.7522 4.44381Z"
|
|
76
|
+
fill="currentColor"
|
|
77
|
+
/>
|
|
78
|
+
</svg>
|
|
79
|
+
{:else if icon === "minMac"}
|
|
80
|
+
<svg
|
|
81
|
+
width="8"
|
|
82
|
+
height="8"
|
|
83
|
+
viewBox="0 0 17 6"
|
|
84
|
+
fill="none"
|
|
85
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
86
|
+
{...$$props}
|
|
87
|
+
>
|
|
88
|
+
<g clip-path="url(#clip0_20_2051)">
|
|
89
|
+
<path
|
|
90
|
+
fill-rule="evenodd"
|
|
91
|
+
clip-rule="evenodd"
|
|
92
|
+
d="M1.47211 1.18042H15.4197C15.8052 1.18042 16.1179 1.50551 16.1179 1.90769V3.73242C16.1179 4.13387 15.8052 4.80006 15.4197 4.80006H1.47211C1.08665 4.80006 0.773926 4.47497 0.773926 4.07278V1.90769C0.773926 1.50551 1.08665 1.18042 1.47211 1.18042Z"
|
|
93
|
+
fill="currentColor"
|
|
94
|
+
/>
|
|
95
|
+
</g>
|
|
96
|
+
</svg>
|
|
97
|
+
{:else if icon === "fullMac"}
|
|
98
|
+
<svg
|
|
99
|
+
width="6"
|
|
100
|
+
height="6"
|
|
101
|
+
viewBox="0 0 15 15"
|
|
102
|
+
fill="none"
|
|
103
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
104
|
+
{...$$props}
|
|
105
|
+
>
|
|
106
|
+
<g clip-path="url(#clip0_20_2057)">
|
|
107
|
+
<path
|
|
108
|
+
fill-rule="evenodd"
|
|
109
|
+
clip-rule="evenodd"
|
|
110
|
+
d="M3.53068 0.433838L15.0933 12.0409C15.0933 12.0409 15.0658 5.35028 15.0658 4.01784C15.0658 1.32095 14.1813 0.433838 11.5378 0.433838C10.6462 0.433838 3.53068 0.433838 3.53068 0.433838ZM12.4409 15.5378L0.87735 3.93073C0.87735 3.93073 0.905794 10.6214 0.905794 11.9538C0.905794 14.6507 1.79024 15.5378 4.43291 15.5378C5.32535 15.5378 12.4409 15.5378 12.4409 15.5378Z"
|
|
111
|
+
fill="currentColor"
|
|
112
|
+
/>
|
|
113
|
+
</g>
|
|
114
|
+
</svg>
|
|
115
|
+
{:else if icon === "plusMac"}
|
|
116
|
+
<svg
|
|
117
|
+
width="8"
|
|
118
|
+
height="8"
|
|
119
|
+
viewBox="0 0 17 16"
|
|
120
|
+
fill="none"
|
|
121
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
122
|
+
{...$$props}
|
|
123
|
+
>
|
|
124
|
+
<g clip-path="url(#clip0_20_2053)">
|
|
125
|
+
<path
|
|
126
|
+
fill-rule="evenodd"
|
|
127
|
+
clip-rule="evenodd"
|
|
128
|
+
d="M15.5308 9.80147H10.3199V15.0095C10.3199 15.3949 9.9941 15.7076 9.59265 15.7076H7.51555C7.11337 15.7076 6.78828 15.3949 6.78828 15.0095V9.80147H1.58319C1.19774 9.80147 0.88501 9.47638 0.88501 9.07419V6.90619C0.88501 6.50401 1.19774 6.17892 1.58319 6.17892H6.78828V1.06183C6.78828 0.676375 7.11337 0.363647 7.51555 0.363647H9.59265C9.9941 0.363647 10.3199 0.676375 10.3199 1.06183V6.17892H15.5308C15.9163 6.17892 16.229 6.50401 16.229 6.90619V9.07419C16.229 9.47638 15.9163 9.80147 15.5308 9.80147Z"
|
|
129
|
+
fill="currentColor"
|
|
130
|
+
/>
|
|
131
|
+
</g>
|
|
132
|
+
</svg>
|
|
133
|
+
{/if}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default Icons;
|
|
2
|
+
type Icons = SvelteComponent<{
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
icon?: string | undefined;
|
|
5
|
+
}, {
|
|
6
|
+
[evt: string]: CustomEvent<any>;
|
|
7
|
+
}, {}> & {
|
|
8
|
+
$$bindings?: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
declare const Icons: $$__sveltets_2_IsomorphicComponent<{
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
icon?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
}, {}, {}, string>;
|
|
16
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
17
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
18
|
+
$$bindings?: Bindings;
|
|
19
|
+
} & Exports;
|
|
20
|
+
(internal: unknown, props: Props & {
|
|
21
|
+
$$events?: Events;
|
|
22
|
+
$$slots?: Slots;
|
|
23
|
+
}): Exports & {
|
|
24
|
+
$set?: any;
|
|
25
|
+
$on?: any;
|
|
26
|
+
};
|
|
27
|
+
z_$$bindings?: Bindings;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=Icons.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Icons.svelte.js"],"names":[],"mappings":";;;;;;;;;AA0DA;;;;;mBAAoI;6CATvF,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Button from "../components/Button.svelte"
|
|
3
|
+
import Icons from "../components/Icons.svelte"
|
|
4
|
+
import { cn } from "../utils/utils"
|
|
5
|
+
import {
|
|
6
|
+
closeWindow,
|
|
7
|
+
fullscreenWindow,
|
|
8
|
+
initializeAppWindow,
|
|
9
|
+
maximizeWindow,
|
|
10
|
+
minimizeWindow
|
|
11
|
+
} from "../utils/window"
|
|
12
|
+
import { BROWSER } from "esm-env"
|
|
13
|
+
import { onDestroy, onMount } from "svelte"
|
|
14
|
+
|
|
15
|
+
onMount(async () => {
|
|
16
|
+
await initializeAppWindow()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const isWindowMaximized = 0
|
|
20
|
+
let isHovering = false
|
|
21
|
+
|
|
22
|
+
const handleMouseEnter = () => {
|
|
23
|
+
isHovering = true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const handleMouseLeave = () => {
|
|
27
|
+
isHovering = false
|
|
28
|
+
}
|
|
29
|
+
let isAltKeyPressed = false
|
|
30
|
+
|
|
31
|
+
const key = "Alt"
|
|
32
|
+
|
|
33
|
+
const handleAltKeyDown = (e) => {
|
|
34
|
+
if (e.key === key) {
|
|
35
|
+
isAltKeyPressed = true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const handleAltKeyUp = (e) => {
|
|
40
|
+
if (e.key === key) {
|
|
41
|
+
isAltKeyPressed = false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Attach event listeners when the component mounts
|
|
46
|
+
if (BROWSER) {
|
|
47
|
+
onMount(() => {
|
|
48
|
+
window.addEventListener("keydown", handleAltKeyDown)
|
|
49
|
+
window.addEventListener("keyup", handleAltKeyUp)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Clean up event listeners when the component is unmounted
|
|
54
|
+
if (BROWSER) {
|
|
55
|
+
onDestroy(() => {
|
|
56
|
+
window.removeEventListener("keydown", handleAltKeyDown)
|
|
57
|
+
window.removeEventListener("keyup", handleAltKeyUp)
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<div
|
|
63
|
+
role="button"
|
|
64
|
+
tabindex="0"
|
|
65
|
+
{...$$props}
|
|
66
|
+
on:mouseenter={handleMouseEnter}
|
|
67
|
+
on:mouseleave={handleMouseLeave}
|
|
68
|
+
class={cn(
|
|
69
|
+
"cursor-default space-x-2 px-3 text-black active:text-black dark:text-black",
|
|
70
|
+
$$props.class
|
|
71
|
+
)}
|
|
72
|
+
>
|
|
73
|
+
<Button
|
|
74
|
+
on:click={closeWindow}
|
|
75
|
+
class="aspect-square h-3 w-3 content-center items-center justify-center self-center rounded-full border border-black/12 bg-[#ff544d] text-center text-black/60 hover:bg-[#ff544d] active:bg-[#bf403a] active:text-black/60 dark:border-none"
|
|
76
|
+
>
|
|
77
|
+
{#if isHovering}
|
|
78
|
+
<Icons icon="closeMac" />
|
|
79
|
+
{/if}
|
|
80
|
+
</Button>
|
|
81
|
+
<Button
|
|
82
|
+
on:click={minimizeWindow}
|
|
83
|
+
class="aspect-square h-3 w-3 content-center items-center justify-center self-center rounded-full border border-black/12 bg-[#ffbd2e] text-center text-black/60 hover:bg-[#ffbd2e] active:bg-[#bf9122] active:text-black/60 dark:border-none"
|
|
84
|
+
>
|
|
85
|
+
{#if isHovering}
|
|
86
|
+
<Icons icon="minMac" />
|
|
87
|
+
{/if}
|
|
88
|
+
</Button>
|
|
89
|
+
<Button
|
|
90
|
+
on:click={isAltKeyPressed ? maximizeWindow : fullscreenWindow}
|
|
91
|
+
class="aspect-square h-3 w-3 content-center items-center justify-center self-center rounded-full border border-black/12 bg-[#28c93f] text-center text-black/60 hover:bg-[#28c93f] active:bg-[#1e9930] active:text-black/60 dark:border-none"
|
|
92
|
+
>
|
|
93
|
+
{#if isHovering}
|
|
94
|
+
{#if isAltKeyPressed}
|
|
95
|
+
<Icons icon="plusMac" />
|
|
96
|
+
{:else}
|
|
97
|
+
<Icons icon="fullMac" />
|
|
98
|
+
{/if}
|
|
99
|
+
{/if}
|
|
100
|
+
</Button>
|
|
101
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default MacOs;
|
|
2
|
+
type MacOs = SvelteComponent<{
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const MacOs: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: Props & {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=MacOs.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MacOs.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/controls/MacOs.svelte.js"],"names":[],"mappings":";;;;;;;;AA2GA;;;;mBAA0H;6CAT7E,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Button from "../components/Button.svelte"
|
|
3
|
+
import Icons from "../components/Icons.svelte"
|
|
4
|
+
import { cn } from "../utils/utils"
|
|
5
|
+
import {
|
|
6
|
+
closeWindow,
|
|
7
|
+
initializeAppWindow,
|
|
8
|
+
isWindowMaximized,
|
|
9
|
+
maximizeWindow,
|
|
10
|
+
minimizeWindow
|
|
11
|
+
} from "../utils/window"
|
|
12
|
+
import { onMount } from "svelte"
|
|
13
|
+
|
|
14
|
+
onMount(async () => {
|
|
15
|
+
await initializeAppWindow()
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<div {...$$props} class={cn("h-8 select-none", $$props.class)}>
|
|
20
|
+
<Button
|
|
21
|
+
on:click={() => minimizeWindow()}
|
|
22
|
+
class="max-h-8 w-[46px] cursor-default rounded-none bg-transparent text-black/90 hover:bg-black/5 active:bg-black/3 dark:text-white dark:hover:bg-white/6 dark:active:bg-white/4"
|
|
23
|
+
>
|
|
24
|
+
<Icons icon="minimizeWin" />
|
|
25
|
+
</Button>
|
|
26
|
+
<Button
|
|
27
|
+
on:click={() => maximizeWindow()}
|
|
28
|
+
class={cn(
|
|
29
|
+
"max-h-8 w-[46px] cursor-default rounded-none bg-transparent",
|
|
30
|
+
"text-black/90 hover:bg-black/5 active:bg-black/3 dark:text-white dark:hover:bg-white/6 dark:active:bg-white/4"
|
|
31
|
+
// !isMaximizable && "text-white/36",
|
|
32
|
+
)}
|
|
33
|
+
>
|
|
34
|
+
{#if $isWindowMaximized}
|
|
35
|
+
<Icons icon="maximizeRestoreWin" />
|
|
36
|
+
{:else}
|
|
37
|
+
<Icons icon="maximizeWin" />
|
|
38
|
+
{/if}
|
|
39
|
+
</Button>
|
|
40
|
+
<Button
|
|
41
|
+
on:click={() => closeWindow()}
|
|
42
|
+
class="max-h-8 w-[46px] cursor-default rounded-none bg-transparent text-black/90 hover:bg-[#c42b1c] hover:text-white active:bg-[#c42b1c]/90 dark:text-white"
|
|
43
|
+
>
|
|
44
|
+
<Icons icon="closeWin" />
|
|
45
|
+
</Button>
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Windows;
|
|
2
|
+
type Windows = SvelteComponent<{
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Windows: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: Props & {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Windows.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Windows.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/controls/Windows.svelte.js"],"names":[],"mappings":";;;;;;;;AA0DA;;;;mBAA4H;6CAT/E,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Button from "../../components/Button.svelte"
|
|
3
|
+
import Icons from "../../components/Icons.svelte"
|
|
4
|
+
import { cn } from "../../utils/utils"
|
|
5
|
+
import {
|
|
6
|
+
closeWindow,
|
|
7
|
+
initializeAppWindow,
|
|
8
|
+
maximizeWindow,
|
|
9
|
+
minimizeWindow
|
|
10
|
+
} from "../../utils/window"
|
|
11
|
+
import { onMount } from "svelte"
|
|
12
|
+
|
|
13
|
+
onMount(async () => {
|
|
14
|
+
await initializeAppWindow()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const isWindowMaximized = 0
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
{...$$props}
|
|
22
|
+
class={cn("mr-[10px] h-auto items-center space-x-[13px]", $$props.class)}
|
|
23
|
+
>
|
|
24
|
+
<Button
|
|
25
|
+
on:click={() => minimizeWindow()}
|
|
26
|
+
class="m-0 aspect-square h-6 w-6 cursor-default rounded-full bg-[#dadada] p-0 text-[#3d3d3d] hover:bg-[#d1d1d1] active:bg-[#bfbfbf] dark:bg-[#373737] dark:text-white dark:hover:bg-[#424242] dark:active:bg-[#565656]"
|
|
27
|
+
>
|
|
28
|
+
<Icons icon="minimizeWin" class="h-[9px] w-[9px]" />
|
|
29
|
+
</Button>
|
|
30
|
+
<Button
|
|
31
|
+
on:click={() => maximizeWindow()}
|
|
32
|
+
class="m-0 aspect-square h-6 w-6 cursor-default rounded-full bg-[#dadada] p-0 text-[#3d3d3d] hover:bg-[#d1d1d1] active:bg-[#bfbfbf] dark:bg-[#373737] dark:text-white dark:hover:bg-[#424242] dark:active:bg-[#565656]"
|
|
33
|
+
>
|
|
34
|
+
{#if isWindowMaximized}
|
|
35
|
+
<Icons icon="maximizeRestoreWin" class="h-[9px] w-[9px]" />
|
|
36
|
+
{:else}
|
|
37
|
+
<Icons icon="maximizeWin" class="h-2 w-2" />
|
|
38
|
+
{/if}
|
|
39
|
+
</Button>
|
|
40
|
+
<Button
|
|
41
|
+
on:click={() => closeWindow()}
|
|
42
|
+
class="m-0 aspect-square h-6 w-6 cursor-default rounded-full bg-[#dadada] p-0 text-[#3d3d3d] hover:bg-[#d1d1d1] active:bg-[#bfbfbf] dark:bg-[#373737] dark:text-white dark:hover:bg-[#424242] dark:active:bg-[#565656]"
|
|
43
|
+
>
|
|
44
|
+
<Icons icon="closeWin" class="h-2 w-2" />
|
|
45
|
+
</Button>
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Gnome;
|
|
2
|
+
type Gnome = SvelteComponent<{
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Gnome: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: Props & {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Gnome.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Gnome.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/controls/linux/Gnome.svelte.js"],"names":[],"mappings":";;;;;;;;AAuDA;;;;mBAA0H;6CAT7E,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,OAAO,OAAO,QAAQ;IAC3L,cAAc,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,WAAW,OAAO,SAAS,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,eAAe,QAAQ,CAAC"}
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@import "tailwindcss/theme";
|
|
2
|
+
|
|
3
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
4
|
+
|
|
5
|
+
.tauri-controls {
|
|
6
|
+
@import "tailwindcss";
|
|
7
|
+
|
|
8
|
+
button,
|
|
9
|
+
input,
|
|
10
|
+
optgroup,
|
|
11
|
+
select,
|
|
12
|
+
textarea {
|
|
13
|
+
font-family: inherit;
|
|
14
|
+
font-feature-settings: inherit;
|
|
15
|
+
font-variation-settings: inherit;
|
|
16
|
+
font-size: 100%;
|
|
17
|
+
font-weight: inherit;
|
|
18
|
+
line-height: inherit;
|
|
19
|
+
letter-spacing: inherit;
|
|
20
|
+
color: inherit;
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
border-radius: 0;
|
|
25
|
+
appearance: none;
|
|
26
|
+
-webkit-appearance: none;
|
|
27
|
+
border: none;
|
|
28
|
+
outline: none;
|
|
29
|
+
cursor: default;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
* {
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
}
|
|
35
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import WindowControls from "./WindowControls.svelte";
|
|
3
|
+
import WindowTitlebar from "./WindowTitlebar.svelte";
|
|
4
|
+
export type { WindowControlsProps, WindowTitlebarProps } from "./types";
|
|
5
|
+
export { WindowControls, WindowTitlebar };
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,cAAc,MAAM,4BAA4B,CAAA;AACvD,OAAO,cAAc,MAAM,4BAA4B,CAAA;AAEvD,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAEvE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,CAAA"}
|
package/dist/index.js
ADDED
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for window controls.
|
|
4
|
+
* If the `platform` property is not specified, the library will automatically detect
|
|
5
|
+
* the operating system the app is running on and display the appropriate elements.
|
|
6
|
+
*/
|
|
7
|
+
export interface WindowControlsProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/**
|
|
9
|
+
* Specifies which platform's window controls to display.
|
|
10
|
+
* It can be one of "windows", "macos", or "gnome".
|
|
11
|
+
* If the `platform` property is not specified, the library will automatically detect
|
|
12
|
+
* the operating system the app is running on and display the appropriate elements.
|
|
13
|
+
*/
|
|
14
|
+
platform?: "windows" | "macos" | "gnome";
|
|
15
|
+
/**
|
|
16
|
+
* Indicates whether the window controls should be shown or hidden.
|
|
17
|
+
* (default: false)
|
|
18
|
+
*/
|
|
19
|
+
hide?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* - "display": "display: none;" making them completely invisible and not taking up any space.
|
|
22
|
+
* - "visibility": "visibility: hidden;" making them invisible but still occupying the same space.
|
|
23
|
+
* (default: "display")
|
|
24
|
+
*/
|
|
25
|
+
hideMethod?: "display" | "visibility";
|
|
26
|
+
/**
|
|
27
|
+
* Justify/Snap WindowControls
|
|
28
|
+
*
|
|
29
|
+
* @default false, (if not defined in WindowTitlebar automatically assigned)
|
|
30
|
+
*/
|
|
31
|
+
justify?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the Linux desktop environment for which the window controls are intended.
|
|
34
|
+
* This property is applicable only when the platform is set to "linux".
|
|
35
|
+
* (default: "gnome")
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Indicates whether to prevent the right-click context menu.
|
|
39
|
+
* When set to true, it will prevent the default right-click behavior.
|
|
40
|
+
* (only in production, default false)
|
|
41
|
+
*/
|
|
42
|
+
/** `data-tauri-drag-region` */
|
|
43
|
+
"data-tauri-drag-region"?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Interface for titlebar
|
|
47
|
+
*/
|
|
48
|
+
export interface WindowTitlebarProps extends HTMLAttributes<HTMLDivElement> {
|
|
49
|
+
/**
|
|
50
|
+
* The `controlsOrder` property is an optional property used in the `WindowControls` interface.
|
|
51
|
+
* It allows you to specify the order in which the window controls should be rendered relative to the children.
|
|
52
|
+
* (default: system)
|
|
53
|
+
*
|
|
54
|
+
* When `controlsOrder` is not specified or set to `system`, the default behavior will be as follows:
|
|
55
|
+
* - For platforms other than macOS, the controls will be on the right side of the children.
|
|
56
|
+
* - For macOS, the controls will be on the left side of the children (similar to "left" option).
|
|
57
|
+
*
|
|
58
|
+
* Possible values for `controlsOrder`:
|
|
59
|
+
* - "right": The window controls will be rendered to the right of the children.
|
|
60
|
+
* - "left": The window controls will be rendered to the left of the children. This order applies only when the platform is macOS (macOS window controls are usually located on the left side of the title bar).
|
|
61
|
+
* - "platform": for OS-based positioning specified in `windowControlsProps`
|
|
62
|
+
*/
|
|
63
|
+
controlsOrder?: "right" | "left" | "platform" | "system";
|
|
64
|
+
/**
|
|
65
|
+
* `WindowControls` props
|
|
66
|
+
*/
|
|
67
|
+
windowControlsProps?: WindowControlsProps;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACzE;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;IAExC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;IAErC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;OAIG;IAGH;;;;OAIG;IAGH,+BAA+B;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAA;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACzE;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAA;IAExD;;OAEG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;CAC1C"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"os.d.ts","sourceRoot":"","sources":["../../src/lib/utils/os.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEzD,eAAO,IAAI,MAAM,EAAE,MAAM,CAAA;AAMzB,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAGjD"}
|
package/dist/utils/os.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Writable } from "svelte/store";
|
|
2
|
+
export declare let appWindow: Writable<any>;
|
|
3
|
+
export declare let isWindowMaximized: Writable<boolean>;
|
|
4
|
+
export declare const initializeAppWindow: () => Promise<void>;
|
|
5
|
+
export declare const minimizeWindow: () => void;
|
|
6
|
+
export declare const maximizeWindow: () => Promise<void>;
|
|
7
|
+
export declare const closeWindow: () => void;
|
|
8
|
+
export declare const fullscreenWindow: () => Promise<void>;
|
|
9
|
+
//# sourceMappingURL=window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../src/lib/utils/window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE3D,eAAO,IAAI,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAuB,CAAA;AACzD,eAAO,IAAI,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAmB,CAAA;AAEjE,eAAO,MAAM,mBAAmB,qBAe/B,CAAA;AAED,eAAO,MAAM,cAAc,YAE1B,CAAA;AAED,eAAO,MAAM,cAAc,qBAE1B,CAAA;AAED,eAAO,MAAM,WAAW,YAEvB,CAAA;AAED,eAAO,MAAM,gBAAgB,qBAM5B,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { get, writable } from "svelte/store";
|
|
2
|
+
export let appWindow = writable(undefined);
|
|
3
|
+
export let isWindowMaximized = writable(false);
|
|
4
|
+
export const initializeAppWindow = async () => {
|
|
5
|
+
if (typeof window !== "undefined") {
|
|
6
|
+
import("@tauri-apps/api").then(async (mod) => {
|
|
7
|
+
const appWin = mod.window.getCurrentWindow();
|
|
8
|
+
appWindow.set(appWin);
|
|
9
|
+
const maximized = await appWin.isMaximized();
|
|
10
|
+
isWindowMaximized.set(maximized);
|
|
11
|
+
await appWin.onResized(async () => {
|
|
12
|
+
const maximized = await appWin.isMaximized();
|
|
13
|
+
isWindowMaximized.set(maximized);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const minimizeWindow = () => {
|
|
19
|
+
get(appWindow)?.minimize();
|
|
20
|
+
};
|
|
21
|
+
export const maximizeWindow = async () => {
|
|
22
|
+
await get(appWindow)?.toggleMaximize();
|
|
23
|
+
};
|
|
24
|
+
export const closeWindow = () => {
|
|
25
|
+
get(appWindow)?.close();
|
|
26
|
+
};
|
|
27
|
+
export const fullscreenWindow = async () => {
|
|
28
|
+
const currentWindow = get(appWindow);
|
|
29
|
+
if (currentWindow) {
|
|
30
|
+
const fullscreen = await currentWindow.isFullscreen();
|
|
31
|
+
await currentWindow.setFullscreen(!fullscreen);
|
|
32
|
+
}
|
|
33
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tauri-controls-v2/svelte",
|
|
3
|
+
"description": "🚥 Native-looking window controls for Tauri 2.",
|
|
4
|
+
"private": false,
|
|
5
|
+
"version": "0.4.1",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "vite dev",
|
|
10
|
+
"build": "vite build && npm run package",
|
|
11
|
+
"build:tailwind": "tailwind -c ./tailwind-build.config.js -i ./src/lib/index.css -o ./dist/index.css",
|
|
12
|
+
"build:watch": "vite build --watch",
|
|
13
|
+
"preview": "vite preview",
|
|
14
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
15
|
+
"prepublishOnly": "npm run package",
|
|
16
|
+
"test": "npm run test:integration && npm run test:unit",
|
|
17
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
18
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
19
|
+
"lint": "prettier --check . && eslint .",
|
|
20
|
+
"format": "prettier --write --plugin prettier-plugin-svelte .",
|
|
21
|
+
"test:integration": "playwright test",
|
|
22
|
+
"test:unit": "vitest",
|
|
23
|
+
"sw": "svelte-package -w",
|
|
24
|
+
"tauri": "tauri",
|
|
25
|
+
"tauri:dev": "tauri dev"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/eatham532/tauri-controls-v2.git"
|
|
33
|
+
},
|
|
34
|
+
"author": "eatham532",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/eatham532/tauri-controls-v2/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/eatham532/tauri-controls-v2#readme",
|
|
39
|
+
"svelte": "./dist/index.js",
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./dist/index.d.ts",
|
|
44
|
+
"svelte": "./dist/index.js",
|
|
45
|
+
"WindowControls.svelte": "./dist/WindowControls.svelte",
|
|
46
|
+
"WindowTitlebar.svelte": "./dist/WindowTitlebar.svelte"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist",
|
|
51
|
+
"!dist/**/*.test.*",
|
|
52
|
+
"!dist/**/*.spec.*"
|
|
53
|
+
],
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@eslint/js": "^10.0.1",
|
|
56
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
57
|
+
"@playwright/test": "^1.50.1",
|
|
58
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
59
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
60
|
+
"@sveltejs/adapter-auto": "^4.0.0",
|
|
61
|
+
"@sveltejs/kit": "^2.17.3",
|
|
62
|
+
"@sveltejs/package": "^2.5.7",
|
|
63
|
+
"@tailwindcss/vite": "^4.2.0",
|
|
64
|
+
"@tauri-apps/api": "^2.1.0",
|
|
65
|
+
"@tauri-apps/cli": "^2.1.0",
|
|
66
|
+
"@tauri-apps/plugin-os": "^2.1.0",
|
|
67
|
+
"@types/node": "^25.3.0",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.21.0",
|
|
69
|
+
"@typescript-eslint/parser": "^8.21.0",
|
|
70
|
+
"clsx": "^2.1.1",
|
|
71
|
+
"eslint": "^9.17.0",
|
|
72
|
+
"eslint-config-prettier": "^10.1.8",
|
|
73
|
+
"eslint-plugin-import": "^2.32.0",
|
|
74
|
+
"eslint-plugin-svelte": "^3.15.0",
|
|
75
|
+
"esm-env": "^1.2.2",
|
|
76
|
+
"postcss": "^8.5.6",
|
|
77
|
+
"prettier": "^3.5.2",
|
|
78
|
+
"prettier-plugin-svelte": "^3.5.0",
|
|
79
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
80
|
+
"publint": "^0.3.17",
|
|
81
|
+
"rollup-plugin-svelte": "^7.2.3",
|
|
82
|
+
"svelte": "^5.20.0",
|
|
83
|
+
"svelte-check": "^4.1.0",
|
|
84
|
+
"svelte-eslint-parser": "^1.4.1",
|
|
85
|
+
"tailwind-merge": "^3.0.1",
|
|
86
|
+
"tailwindcss": "^4.2.0",
|
|
87
|
+
"taze": "^19.9.2",
|
|
88
|
+
"tslib": "^2.8.1",
|
|
89
|
+
"typescript": "^5.7.3",
|
|
90
|
+
"typescript-eslint": "^8.56.0",
|
|
91
|
+
"vite": "^7.3.1",
|
|
92
|
+
"vite-plugin-dts": "^4.5.4",
|
|
93
|
+
"vitest": "^3.0.7"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"clsx": "^2.1.1",
|
|
97
|
+
"svelte": "^5.0.0",
|
|
98
|
+
"tailwind-merge": "^3.0.1"
|
|
99
|
+
}
|
|
100
|
+
}
|