@tauri-controls-v2/react 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 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,186 @@
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
+ [![](https://img.shields.io/bundlephobia/min/tauri-controls)](https://bundlephobia.com/)
7
+ [![](https://img.shields.io/bundlephobia/minzip/tauri-controls)](https://bundlephobia.com/)
8
+ [![](https://img.shields.io/npm/dt/tauri-controls)](https://npmjs.com/package/tauri-controls)
9
+
10
+ [![](https://img.shields.io/badge/React-20232A?logo=react&logoColor=61DAFB)](https://www.npmjs.com/package/tauri-controls) [![](https://img.shields.io/badge/Svelte-4A4A55?logo=svelte&logoColor=FF3E00)](https://www.npmjs.com/package/@tauri-controls-v2/svelte) [![SolidJS](https://img.shields.io/badge/SolidJS-2c4f7c?logo=solid&logoColor=c8c9cb)](https://www.npmjs.com/package/@tauri-controls-v2/solid) [![Vue.js](https://img.shields.io/badge/Vue.js-%2335495e.svg?logo=vuedotjs&logoColor=%234FC08D)](https://www.npmjs.com/package/@tauri-controls-v2/vue)
11
+
12
+ **Tauri Controls** is a library that provides native-looking **window controls** for [Tauri 2](https://beta.tauri.app) applications. You can enhance the user experience of your Tauri 2 applications with window controls that mimic the identical native controls on the current system.
13
+
14
+ `tauri-controls` uses Tauri's [js/ts APIs](https://next--tauri.netlify.app/next/api/js) to handle window events and just provides native-looking (designed according to official system design prototypes) html elements, not native, _it does not rely on the system's native APIs_.
15
+
16
+ The following designs are taken as reference:
17
+
18
+ - [Windows UI 3](https://www.figma.com/community/file/1159947337437047524) @microsoft
19
+ - [Apple Design Resources - macOS](https://www.figma.com/community/file/1251588934545918753) @apple
20
+
21
+ ## How to use
22
+
23
+ ### Install Dependencies
24
+
25
+ ```bash
26
+ # React:
27
+ bun add tauri-controls
28
+
29
+ # Svelte:
30
+ bun add @tauri-controls-v2/svelte
31
+
32
+ # Solid.js:
33
+ bun add @tauri-controls-v2/solid
34
+
35
+ # Vue.js:
36
+ bun add @tauri-controls-v2/vue
37
+ ```
38
+
39
+ ```bash
40
+ # Install peer dependencies:
41
+ bun add @tauri-apps/plugin-os @tauri-apps/api
42
+ bun add -D clsx tailwind-merge
43
+ ```
44
+
45
+ > For **Svelte** projects, include the following line in the `content` section of your `tailwind.config.js`:
46
+ >
47
+ > ```js
48
+ > "./node_modules/@tauri-controls-v2/svelte/**/*.{js,svelte,ts}"
49
+ > ```
50
+
51
+ Then, make sure to include the following tauri plugins in your `src-tauri` directory:
52
+
53
+ ```bash
54
+ cargo add tauri-plugin-os
55
+ ```
56
+
57
+ Don't forget to register plugins in your main function.
58
+
59
+ ```rust
60
+ fn main() {
61
+ tauri::Builder::default()
62
+ .plugin(tauri_plugin_os::init())
63
+ .plugin(tauri_plugin_window::init())
64
+ .run(tauri::generate_context!())
65
+ .expect("error while running tauri application");
66
+ }
67
+ ```
68
+
69
+ > _If you get the message "Not allowed by scope" in the terminal after a production build, try [this](https://github.com/eatham532/tauri-controls-v2/issues/1#issuecomment-1653557673)._
70
+
71
+ ### Add to Your Code
72
+
73
+ And simply add the `WindowTitlebar` or `WindowControls` component to your code, depending on your needs:
74
+
75
+ #### WindowTitlebar
76
+
77
+ The `WindowTitlebar` component handles the window titlebar and dynamically adjusts the **window control buttons** and **titlebar content** order based on the current operating system.
78
+
79
+ ```tsx
80
+ import { WindowTitlebar } from "tauri-controls"
81
+
82
+ function MyTitlebar() {
83
+ return (
84
+ <WindowTitlebar>{/* Place your titlebar content here */}</WindowTitlebar>
85
+ )
86
+ }
87
+ ```
88
+
89
+ When no platform is specified, the current system will be detected and the matching element will be returned. This feature is a great solution for cross-platform releases.
90
+
91
+ ![](https://github.com/eatham532/tauri-controls-v2/assets/16024979/214677d4-dd70-4e6b-96c3-b9d1a1356f05)
92
+
93
+ #### WindowControls
94
+
95
+ Use the `WindowControls` component only for window controls.
96
+
97
+ ```tsx
98
+ import { WindowControls } from "tauri-controls"
99
+
100
+ function MyTitlebar() {
101
+ return <WindowControls />
102
+ }
103
+ ```
104
+
105
+ ![](https://github.com/eatham532/tauri-controls-v2/assets/16024979/7be3dde4-7953-4188-af12-abd4445c0bf9)
106
+
107
+ ### More examples:
108
+
109
+ - [in React](https://github.com/eatham532/tauri-controls-v2/blob/master/apps/tauri-controls/src/App.tsx)
110
+ - [in Svelte](https://github.com/eatham532/tauri-controls-v2/blob/master/apps/tauri-controls-svelte/src/routes/%2Bpage.svelte)
111
+ - [in Solid.js](https://github.com/eatham532/tauri-controls-v2/blob/master/apps/tauri-controls-solid/src/App.tsx)
112
+ - [in Vue.js](https://github.com/eatham532/tauri-controls-v2/blob/master/apps/tauri-controls-vue/src/App.vue)
113
+
114
+ ## Options
115
+
116
+ ### `WindowTitlebar`:
117
+
118
+ - `controlsOrder?: "right" | "left" | "platform" | "system"`: Specifies the order of window controls. **platform**: to get OS-based positioning specified in _windowControlsProps_.
119
+ **system**: to automatically detect the platform and position the controls accordingly (default).
120
+ - `windowControlsProps?: WindowControlsProps`: Additional props to pass to the `WindowControls` component.
121
+
122
+ ### `WindowControls`:
123
+
124
+ - `platform?: "windows" | "macos" | "gnome"`: Specifies which platform's window controls to display. If the _platform_ property is not specified, the library will automatically detect the operating system the app is running on and display the appropriate element.
125
+ - `justify?: boolean`: If set to `true`, `WindowControls` will justify/snap in the flexbox where it is located.
126
+ - `hide?: boolean`: If set to `true`, the window controls will be hidden.
127
+ - `hideMethod?: "display" | "visibility"`: Determines how the window controls will be hidden.
128
+
129
+ You can also provide additional props to elements, such as `data-tauri-drag-region`, for further enhancements.
130
+
131
+ ![Example](https://i.imgur.com/OAO22HC.png)
132
+ ![Example](https://i.imgur.com/hq389kn.png)
133
+
134
+ ## Figma
135
+
136
+ Check out the design implementation on Figma for a visual reference. [Desktop Native Window Controls - Figma](https://www.figma.com/file/ms2vbZx5lEGxHqHR8fAfQm/Desktop-Native-Window-Controls?type=design&node-id=4%3A6020&mode=design&t=PIbVTsr8zWmIFsNr-1).
137
+
138
+ These sources were utilized:
139
+
140
+ - [Windows UI 3](https://www.figma.com/community/file/1159947337437047524) @microsoft
141
+ - [Apple Design Resources - macOS](https://www.figma.com/community/file/1251588934545918753) @apple
142
+ - [macOS Monterey UI Kit for Figma](https://www.figma.com/community/file/1034539431656086181/macOS-Monterey-UI-Kit-for-Figma) @joey
143
+ - [Spotify Desktop App Clone](https://www.figma.com/community/file/1028665514709480268/Spotify-Desktop-App-Clone) @uidesignguide
144
+
145
+ ## Development and Contribution
146
+
147
+ ```bash
148
+ bun dev
149
+
150
+ bun tauri:dev
151
+ ```
152
+
153
+ Project Structure:
154
+
155
+ ```bash
156
+ .
157
+ ├── /apps
158
+ │ ├── /tauri-controls # Main application (React)
159
+ │ ├── /tauri-controls-solid # Solid.js implementation
160
+ │ └── /tauri-controls-svelte # Svelte implementation
161
+ ├── /packages # Shared packages
162
+ ├── package.json # Project configuration
163
+ ├── pnpm-workspace.yaml # Workspace configuration
164
+ └── turbo.json # TurboRepo configuration
165
+ ```
166
+
167
+ If you're interested in contributing, check out our [TODO list](https://github.com/eatham532/tauri-controls-v2/blob/master/TODOs.md) for tasks you can help with. Your contributions are appreciated!
168
+
169
+ ## Contributors
170
+
171
+ This project is made possible by the contributions of various individuals. Thank you to all the contributors who have helped make this project better.
172
+
173
+ - **[tauri-controls](https://www.npmjs.com/package/tauri-controls), [@tauri-controls-v2/svelte](https://www.npmjs.com/package/@tauri-controls-v2/svelte)**: [@eatham532](https://github.com/eatham532)
174
+ - **[@tauri-controls-v2/solid](https://www.npmjs.com/package/@tauri-controls-v2/solid)**: [@ronanru](https://github.com/ronanru)
175
+ - **[@tauri-controls-v2/vue](https://www.npmjs.com/package/@tauri-controls-v2/vue)**: [@allenli178](https://github.com/allenli178)
176
+
177
+ ## Further Reading
178
+
179
+ - [Feature request: Add setting for titlebar style with native window controls support - tauri-apps/tauri#2663](https://github.com/tauri-apps/tauri/issues/2663)
180
+ - [Window Controls Overlay for Installed Desktop Web Apps - WICG](https://github.com/WICG/window-controls-overlay/blob/main/explainer.md)
181
+ - [Window Controls Overlay - Electron](https://www.electronjs.org/docs/latest/tutorial/window-customization#window-controls-overlay-macos-windows)
182
+ - [Window Controls Overlay API - MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window_Controls_Overlay_API)
183
+
184
+ ## License
185
+
186
+ MIT
@@ -0,0 +1 @@
1
+ import"./tauri-controls.css";var e;const t="__TAURI_TO_IPC_KEY__";function i(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}async function n(e,t={},i){return window.__TAURI_INTERNALS__.invoke(e,t,i)}class a{get rid(){return function(e,t){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}(this,e)}constructor(t){e.set(this,void 0),function(e,t,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");t.set(e,i)}(this,e,t)}async close(){return n("plugin:resources|close",{rid:this.rid})}}e=new WeakMap;class l extends a{constructor(e){super(e)}static async new(e,t,i){return n("plugin:image|new",{rgba:s(e),width:t,height:i}).then((e=>new l(e)))}static async fromBytes(e){return n("plugin:image|from_bytes",{bytes:s(e)}).then((e=>new l(e)))}static async fromPath(e){return n("plugin:image|from_path",{path:e}).then((e=>new l(e)))}async rgba(){return n("plugin:image|rgba",{rid:this.rid}).then((e=>new Uint8Array(e)))}async size(){return n("plugin:image|size",{rid:this.rid})}}function s(e){return null==e?null:"string"==typeof e?e:e instanceof l?e.rid:e}var r,o,u,c,h,w,d;(d=r||(r={})).Nsis="nsis",d.Msi="msi",d.Deb="deb",d.Rpm="rpm",d.AppImage="appimage",d.App="app";class p{constructor(...e){this.type="Logical",1===e.length?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new b(this.width*e,this.height*e)}[t](){return{width:this.width,height:this.height}}toJSON(){return this[t]()}}class b{constructor(...e){this.type="Physical",1===e.length?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new p(this.width/e,this.height/e)}[t](){return{width:this.width,height:this.height}}toJSON(){return this[t]()}}class g{constructor(e){this.size=e}toLogical(e){return this.size instanceof p?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof b?this.size:this.size.toPhysical(e)}[t](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[t]()}}class y{constructor(...e){this.type="Logical",1===e.length?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new _(this.x*e,this.y*e)}[t](){return{x:this.x,y:this.y}}toJSON(){return this[t]()}}class _{constructor(...e){this.type="Physical",1===e.length?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new y(this.x/e,this.y/e)}[t](){return{x:this.x,y:this.y}}toJSON(){return this[t]()}}class v{constructor(e){this.position=e}toLogical(e){return this.position instanceof y?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof _?this.position:this.position.toPhysical(e)}[t](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[t]()}}async function m(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await n("plugin:event|unlisten",{event:e,eventId:t})}async function f(e,t,a){var l;const s="string"==typeof a?.target?{kind:"AnyLabel",label:a.target}:null!==(l=a?.target)&&void 0!==l?l:{kind:"Any"};return n("plugin:event|listen",{event:e,target:s,handler:i(t)}).then((t=>async()=>m(e,t)))}async function E(e,t,i){return f(e,(i=>{m(e,i.id),t(i)}),i)}async function D(e,t){await n("plugin:event|emit",{event:e,payload:t})}async function A(e,t,i){await n("plugin:event|emit_to",{target:"string"==typeof e?{kind:"AnyLabel",label:e}:e,event:t,payload:i})}(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(o||(o={})),function(e){e.Add="Add",e.Advanced="Advanced",e.Bluetooth="Bluetooth",e.Bookmarks="Bookmarks",e.Caution="Caution",e.ColorPanel="ColorPanel",e.ColumnView="ColumnView",e.Computer="Computer",e.EnterFullScreen="EnterFullScreen",e.Everyone="Everyone",e.ExitFullScreen="ExitFullScreen",e.FlowView="FlowView",e.Folder="Folder",e.FolderBurnable="FolderBurnable",e.FolderSmart="FolderSmart",e.FollowLinkFreestanding="FollowLinkFreestanding",e.FontPanel="FontPanel",e.GoLeft="GoLeft",e.GoRight="GoRight",e.Home="Home",e.IChatTheater="IChatTheater",e.IconView="IconView",e.Info="Info",e.InvalidDataFreestanding="InvalidDataFreestanding",e.LeftFacingTriangle="LeftFacingTriangle",e.ListView="ListView",e.LockLocked="LockLocked",e.LockUnlocked="LockUnlocked",e.MenuMixedState="MenuMixedState",e.MenuOnState="MenuOnState",e.MobileMe="MobileMe",e.MultipleDocuments="MultipleDocuments",e.Network="Network",e.Path="Path",e.PreferencesGeneral="PreferencesGeneral",e.QuickLook="QuickLook",e.RefreshFreestanding="RefreshFreestanding",e.Refresh="Refresh",e.Remove="Remove",e.RevealFreestanding="RevealFreestanding",e.RightFacingTriangle="RightFacingTriangle",e.Share="Share",e.Slideshow="Slideshow",e.SmartBadge="SmartBadge",e.StatusAvailable="StatusAvailable",e.StatusNone="StatusNone",e.StatusPartiallyAvailable="StatusPartiallyAvailable",e.StatusUnavailable="StatusUnavailable",e.StopProgressFreestanding="StopProgressFreestanding",e.StopProgress="StopProgress",e.TrashEmpty="TrashEmpty",e.TrashFull="TrashFull",e.User="User",e.UserAccounts="UserAccounts",e.UserGroup="UserGroup",e.UserGuest="UserGuest"}(u||(u={})),function(e){e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Document=6]="Document",e[e.Download=7]="Download",e[e.Picture=8]="Picture",e[e.Public=9]="Public",e[e.Video=10]="Video",e[e.Resource=11]="Resource",e[e.Temp=12]="Temp",e[e.AppConfig=13]="AppConfig",e[e.AppData=14]="AppData",e[e.AppLocalData=15]="AppLocalData",e[e.AppCache=16]="AppCache",e[e.AppLog=17]="AppLog",e[e.Desktop=18]="Desktop",e[e.Executable=19]="Executable",e[e.Font=20]="Font",e[e.Home=21]="Home",e[e.Runtime=22]="Runtime",e[e.Template=23]="Template"}(c||(c={})),function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"}(h||(h={}));class S{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function k(){return new R(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function z(){return n("plugin:window|get_all_windows").then((e=>e.map((e=>new R(e,{skip:!0})))))}!function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"}(w||(w={}));const L=["tauri://created","tauri://error"];class R{constructor(e,t={}){var i;this.label=e,this.listeners=Object.create(null),t?.skip||n("plugin:window|create",{options:{...t,parent:"string"==typeof t.parent?t.parent:null===(i=t.parent)||void 0===i?void 0:i.label,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static async getByLabel(e){var t;return null!==(t=(await z()).find((t=>t.label===e)))&&void 0!==t?t:null}static getCurrent(){return k()}static async getAll(){return z()}static async getFocusedWindow(){for(const e of await z())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)}:f(e,t,{target:{kind:"Window",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)}:E(e,t,{target:{kind:"Window",label:this.label}})}async emit(e,t){if(!L.includes(e))return D(e,t);for(const i of this.listeners[e]||[])i({event:e,id:-1,payload:t})}async emitTo(e,t,i){if(!L.includes(t))return A(e,t,i);for(const e of this.listeners[t]||[])e({event:t,id:-1,payload:i})}_handleTauriEvent(e,t){return!!L.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async scaleFactor(){return n("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return n("plugin:window|inner_position",{label:this.label}).then((e=>new _(e)))}async outerPosition(){return n("plugin:window|outer_position",{label:this.label}).then((e=>new _(e)))}async innerSize(){return n("plugin:window|inner_size",{label:this.label}).then((e=>new b(e)))}async outerSize(){return n("plugin:window|outer_size",{label:this.label}).then((e=>new b(e)))}async isFullscreen(){return n("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return n("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return n("plugin:window|is_maximized",{label:this.label})}async isFocused(){return n("plugin:window|is_focused",{label:this.label})}async isDecorated(){return n("plugin:window|is_decorated",{label:this.label})}async isResizable(){return n("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return n("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return n("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return n("plugin:window|is_closable",{label:this.label})}async isVisible(){return n("plugin:window|is_visible",{label:this.label})}async title(){return n("plugin:window|title",{label:this.label})}async theme(){return n("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return n("plugin:window|is_always_on_top",{label:this.label})}async center(){return n("plugin:window|center",{label:this.label})}async requestUserAttention(e){let t=null;return e&&(t=e===h.Critical?{type:"Critical"}:{type:"Informational"}),n("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return n("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return n("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return n("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return n("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return n("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return n("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return n("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return n("plugin:window|maximize",{label:this.label})}async unmaximize(){return n("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return n("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return n("plugin:window|minimize",{label:this.label})}async unminimize(){return n("plugin:window|unminimize",{label:this.label})}async show(){return n("plugin:window|show",{label:this.label})}async hide(){return n("plugin:window|hide",{label:this.label})}async close(){return n("plugin:window|close",{label:this.label})}async destroy(){return n("plugin:window|destroy",{label:this.label})}async setDecorations(e){return n("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return n("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return n("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return n("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return n("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return n("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return n("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return n("plugin:window|set_size",{label:this.label,value:e instanceof g?e:new g(e)})}async setMinSize(e){return n("plugin:window|set_min_size",{label:this.label,value:e instanceof g?e:e?new g(e):null})}async setMaxSize(e){return n("plugin:window|set_max_size",{label:this.label,value:e instanceof g?e:e?new g(e):null})}async setSizeConstraints(e){function t(e){return e?{Logical:e}:null}return n("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:t(e?.minWidth),minHeight:t(e?.minHeight),maxWidth:t(e?.maxWidth),maxHeight:t(e?.maxHeight)}})}async setPosition(e){return n("plugin:window|set_position",{label:this.label,value:e instanceof v?e:new v(e)})}async setFullscreen(e){return n("plugin:window|set_fullscreen",{label:this.label,value:e})}async setSimpleFullscreen(e){return n("plugin:window|set_simple_fullscreen",{label:this.label,value:e})}async setFocus(){return n("plugin:window|set_focus",{label:this.label})}async setFocusable(e){return n("plugin:window|set_focusable",{label:this.label,value:e})}async setIcon(e){return n("plugin:window|set_icon",{label:this.label,value:s(e)})}async setSkipTaskbar(e){return n("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return n("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return n("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return n("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return n("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return n("plugin:window|set_cursor_position",{label:this.label,value:e instanceof v?e:new v(e)})}async setIgnoreCursorEvents(e){return n("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return n("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return n("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return n("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return n("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return n("plugin:window|set_overlay_icon",{label:this.label,value:e?s(e):void 0})}async setProgressBar(e){return n("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return n("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return n("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return n("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(o.WINDOW_RESIZED,(t=>{t.payload=new b(t.payload),e(t)}))}async onMoved(e){return this.listen(o.WINDOW_MOVED,(t=>{t.payload=new _(t.payload),e(t)}))}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,(async t=>{const i=new S(t);await e(i),i.isPreventDefault()||await this.destroy()}))}async onDragDropEvent(e){const t=await this.listen(o.DRAG_ENTER,(t=>{e({...t,payload:{type:"enter",paths:t.payload.paths,position:new _(t.payload.position)}})})),i=await this.listen(o.DRAG_OVER,(t=>{e({...t,payload:{type:"over",position:new _(t.payload.position)}})})),n=await this.listen(o.DRAG_DROP,(t=>{e({...t,payload:{type:"drop",paths:t.payload.paths,position:new _(t.payload.position)}})})),a=await this.listen(o.DRAG_LEAVE,(t=>{e({...t,payload:{type:"leave"}})}));return()=>{t(),n(),i(),a()}}async onFocusChanged(e){const t=await this.listen(o.WINDOW_FOCUS,(t=>{e({...t,payload:!0})})),i=await this.listen(o.WINDOW_BLUR,(t=>{e({...t,payload:!1})}));return()=>{t(),i()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var T,O,C,P;function W(e){return null===e?null:{name:e.name,scaleFactor:e.scaleFactor,position:new _(e.position),size:new b(e.size),workArea:{position:new _(e.workArea.position),size:new b(e.workArea.size)}}}(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(T||(T={})),function(e){e.Default="default",e.FluentOverlay="fluentOverlay"}(O||(O={})),function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"}(C||(C={})),function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"}(P||(P={}));const F=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:S,get Effect(){return C},get EffectState(){return P},LogicalPosition:y,LogicalSize:p,PhysicalPosition:_,PhysicalSize:b,get ProgressBarStatus(){return w},get UserAttentionType(){return h},Window:R,availableMonitors:async function(){return n("plugin:window|available_monitors").then((e=>e.map(W)))},currentMonitor:async function(){return n("plugin:window|current_monitor").then(W)},cursorPosition:async function(){return n("plugin:window|cursor_position").then((e=>new _(e)))},getAllWindows:z,getCurrentWindow:k,monitorFromPoint:async function(e,t){return n("plugin:window|monitor_from_point",{x:e,y:t}).then(W)},primaryMonitor:async function(){return n("plugin:window|primary_monitor").then(W)}},Symbol.toStringTag,{value:"Module"}));function I(){return new B(k(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function x(){return n("plugin:webview|get_all_webviews").then((e=>e.map((e=>new B(new R(e.windowLabel,{skip:!0}),e.label,{skip:!0})))))}const N=["tauri://created","tauri://error"];class B{constructor(e,t,i){this.window=e,this.label=t,this.listeners=Object.create(null),i?.skip||n("plugin:webview|create_webview",{windowLabel:e.label,options:{...i,label:t}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static async getByLabel(e){var t;return null!==(t=(await x()).find((t=>t.label===e)))&&void 0!==t?t:null}static getCurrent(){return I()}static async getAll(){return x()}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)}:f(e,t,{target:{kind:"Webview",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)}:E(e,t,{target:{kind:"Webview",label:this.label}})}async emit(e,t){if(!N.includes(e))return D(e,t);for(const i of this.listeners[e]||[])i({event:e,id:-1,payload:t})}async emitTo(e,t,i){if(!N.includes(t))return A(e,t,i);for(const e of this.listeners[t]||[])e({event:t,id:-1,payload:i})}_handleTauriEvent(e,t){return!!N.includes(e)&&(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0)}async position(){return n("plugin:webview|webview_position",{label:this.label}).then((e=>new _(e)))}async size(){return n("plugin:webview|webview_size",{label:this.label}).then((e=>new b(e)))}async close(){return n("plugin:webview|webview_close",{label:this.label})}async setSize(e){return n("plugin:webview|set_webview_size",{label:this.label,value:e instanceof g?e:new g(e)})}async setPosition(e){return n("plugin:webview|set_webview_position",{label:this.label,value:e instanceof v?e:new v(e)})}async setFocus(){return n("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(e){return n("plugin:webview|set_webview_auto_resize",{label:this.label,value:e})}async hide(){return n("plugin:webview|webview_hide",{label:this.label})}async show(){return n("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return n("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return n("plugin:webview|reparent",{label:this.label,window:"string"==typeof e?e:e.label})}async clearAllBrowsingData(){return n("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return n("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const t=await this.listen(o.DRAG_ENTER,(t=>{e({...t,payload:{type:"enter",paths:t.payload.paths,position:new _(t.payload.position)}})})),i=await this.listen(o.DRAG_OVER,(t=>{e({...t,payload:{type:"over",position:new _(t.payload.position)}})})),n=await this.listen(o.DRAG_DROP,(t=>{e({...t,payload:{type:"drop",paths:t.payload.paths,position:new _(t.payload.position)}})})),a=await this.listen(o.DRAG_LEAVE,(t=>{e({...t,payload:{type:"leave"}})}));return()=>{t(),n(),i(),a()}}}async function M(){return n("plugin:window|get_all_windows").then((e=>e.map((e=>new U(e,{skip:!0})))))}class U{constructor(e,t={}){var i;this.label=e,this.listeners=Object.create(null),t?.skip||n("plugin:webview|create_webview_window",{options:{...t,parent:"string"==typeof t.parent?t.parent:null===(i=t.parent)||void 0===i?void 0:i.label,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static async getByLabel(e){var t;const i=null!==(t=(await M()).find((t=>t.label===e)))&&void 0!==t?t:null;return i?new U(i.label,{skip:!0}):null}static getCurrent(){return function(){const e=I();return new U(e.label,{skip:!0})}()}static async getAll(){return M()}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)}:f(e,t,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{const i=this.listeners[e];i.splice(i.indexOf(t),1)}:E(e,t,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return n("plugin:window|set_background_color",{color:e}).then((()=>n("plugin:webview|set_webview_background_color",{color:e})))}}var G,V;G=U,V=[R,B],(Array.isArray(V)?V:[V]).forEach((e=>{Object.getOwnPropertyNames(e.prototype).forEach((t=>{var i;"object"==typeof G.prototype&&G.prototype&&t in G.prototype||Object.defineProperty(G.prototype,t,null!==(i=Object.getOwnPropertyDescriptor(e.prototype,t))&&void 0!==i?i:Object.create(null))}))}));export{F as window};
@@ -0,0 +1,78 @@
1
+ import { HTMLProps } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
3
+
4
+ export declare function WindowControls({ platform, justify, hide, hideMethod, className, ...props }: WindowControlsProps): JSX.Element;
5
+
6
+ /**
7
+ * Interface for window controls.
8
+ * If the `platform` property is not specified, the library will automatically detect
9
+ * the operating system the app is running on and display the appropriate elements.
10
+ */
11
+ export declare interface WindowControlsProps extends HTMLProps<HTMLDivElement> {
12
+ /**
13
+ * Specifies which platform's window controls to display.
14
+ * It can be one of "windows", "macos", or "gnome".
15
+ * If the `platform` property is not specified, the library will automatically detect
16
+ * the operating system the app is running on and display the appropriate elements.
17
+ */
18
+ platform?: "windows" | "macos" | "gnome";
19
+ /**
20
+ * Indicates whether the window controls should be shown or hidden.
21
+ * @default false
22
+ */
23
+ hide?: boolean;
24
+ /**
25
+ * - "display": "display: none;" making them completely invisible and not taking up any space.
26
+ * - "visibility": "visibility: hidden;" making them invisible but still occupying the same space.
27
+ * @default "display"
28
+ */
29
+ hideMethod?: "display" | "visibility";
30
+ /**
31
+ * Justify/Snap WindowControls
32
+ *
33
+ * @default false, (if not defined in WindowTitlebar automatically assigned)
34
+ */
35
+ justify?: boolean;
36
+ /**
37
+ * Specifies the Linux desktop environment for which the window controls are intended.
38
+ * This property is applicable only when the platform is set to "linux".
39
+ * @default "gnome"
40
+ */
41
+ /**
42
+ * Indicates whether to prevent the right-click context menu.
43
+ * When set to true, it will prevent the default right-click behavior.
44
+ * (only in production, default false)
45
+ */
46
+ /** `data-tauri-drag-region` */
47
+ "data-tauri-drag-region"?: boolean;
48
+ }
49
+
50
+ export declare function WindowTitlebar({ children, controlsOrder, className, windowControlsProps, ...props }: WindowTitlebarProps): JSX.Element;
51
+
52
+ /**
53
+ * Interface for titlebar
54
+ */
55
+ export declare interface WindowTitlebarProps extends HTMLProps<HTMLDivElement> {
56
+ /**
57
+ * The `controlsOrder` property is an optional property used in the `WindowControls` interface.
58
+ * It allows you to specify the order in which the window controls should be rendered relative to the children.
59
+ * (default: system)
60
+ *
61
+ * When `controlsOrder` is not specified or set to `system`, the default behavior will be as follows:
62
+ * - For platforms other than macOS, the controls will be on the right side of the children.
63
+ * - For macOS, the controls will be on the left side of the children (similar to "left" option).
64
+ *
65
+ * Possible values for `controlsOrder`:
66
+ * - "right": The window controls will be rendered to the right of the children.
67
+ * - "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).
68
+ * - "platform": for OS-based positioning specified in `windowControlsProps`
69
+ * @default "system"
70
+ */
71
+ controlsOrder?: "right" | "left" | "platform" | "system";
72
+ /**
73
+ * `WindowControls` props
74
+ */
75
+ windowControlsProps?: WindowControlsProps;
76
+ }
77
+
78
+ export { }
package/dist/react.css ADDED
@@ -0,0 +1 @@
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-yellow-300:oklch(90.5% .182 98.111);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-600:oklch(58.8% .158 241.966);--color-violet-200:oklch(89.4% .057 293.283);--color-rose-300:oklch(81% .117 11.638);--color-rose-700:oklch(51.4% .222 16.935);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-semibold:600;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}@layer base{.tauri-controls *,.tauri-controls :after,.tauri-controls :before,.tauri-controls ::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}.tauri-controls ::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}.tauri-controls html,.tauri-controls :host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}.tauri-controls hr{height:0;color:inherit;border-top-width:1px}.tauri-controls abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.tauri-controls h1,.tauri-controls h2,.tauri-controls h3,.tauri-controls h4,.tauri-controls h5,.tauri-controls h6{font-size:inherit;font-weight:inherit}.tauri-controls a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}.tauri-controls b,.tauri-controls strong{font-weight:bolder}.tauri-controls code,.tauri-controls kbd,.tauri-controls samp,.tauri-controls pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}.tauri-controls small{font-size:80%}.tauri-controls sub,.tauri-controls sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}.tauri-controls sub{bottom:-.25em}.tauri-controls sup{top:-.5em}.tauri-controls table{text-indent:0;border-color:inherit;border-collapse:collapse}.tauri-controls :-moz-focusring{outline:auto}.tauri-controls progress{vertical-align:baseline}.tauri-controls summary{display:list-item}.tauri-controls ol,.tauri-controls ul,.tauri-controls menu{list-style:none}.tauri-controls img,.tauri-controls svg,.tauri-controls video,.tauri-controls canvas,.tauri-controls audio,.tauri-controls iframe,.tauri-controls embed,.tauri-controls object{vertical-align:middle;display:block}.tauri-controls img,.tauri-controls video{max-width:100%;height:auto}.tauri-controls button,.tauri-controls input,.tauri-controls select,.tauri-controls optgroup,.tauri-controls textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}.tauri-controls ::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}.tauri-controls :where(select:is([multiple],[size])) optgroup{font-weight:bolder}.tauri-controls :where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}.tauri-controls ::file-selector-button{margin-inline-end:4px}.tauri-controls ::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){.tauri-controls ::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){.tauri-controls ::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}.tauri-controls textarea{resize:vertical}.tauri-controls ::-webkit-search-decoration{-webkit-appearance:none}.tauri-controls ::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}.tauri-controls ::-webkit-datetime-edit{display:inline-flex}.tauri-controls ::-webkit-datetime-edit-fields-wrapper{padding:0}.tauri-controls ::-webkit-datetime-edit{padding-block:0}.tauri-controls ::-webkit-datetime-edit-year-field{padding-block:0}.tauri-controls ::-webkit-datetime-edit-month-field{padding-block:0}.tauri-controls ::-webkit-datetime-edit-day-field{padding-block:0}.tauri-controls ::-webkit-datetime-edit-hour-field{padding-block:0}.tauri-controls ::-webkit-datetime-edit-minute-field{padding-block:0}.tauri-controls ::-webkit-datetime-edit-second-field{padding-block:0}.tauri-controls ::-webkit-datetime-edit-millisecond-field{padding-block:0}.tauri-controls ::-webkit-datetime-edit-meridiem-field{padding-block:0}.tauri-controls ::-webkit-calendar-picker-indicator{line-height:1}.tauri-controls :-moz-ui-invalid{box-shadow:none}.tauri-controls button,.tauri-controls input:where([type=button],[type=reset],[type=submit]){appearance:button}.tauri-controls ::file-selector-button{appearance:button}.tauri-controls ::-webkit-inner-spin-button{height:auto}.tauri-controls ::-webkit-outer-spin-button{height:auto}.tauri-controls [hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.tauri-controls .invisible{visibility:hidden}.tauri-controls .fixed{position:fixed}.tauri-controls .relative{position:relative}.tauri-controls .start{inset-inline-start:var(--spacing)}.tauri-controls .top-1{top:calc(var(--spacing) * 1)}.tauri-controls .right-1{right:calc(var(--spacing) * 1)}.tauri-controls .isolate{isolation:isolate}.tauri-controls .m-0{margin:calc(var(--spacing) * 0)}.tauri-controls .mr-2{margin-right:calc(var(--spacing) * 2)}.tauri-controls .mr-\[10px\]{margin-right:10px}.tauri-controls .ml-0{margin-left:calc(var(--spacing) * 0)}.tauri-controls .ml-3{margin-left:calc(var(--spacing) * 3)}.tauri-controls .ml-auto{margin-left:auto}.tauri-controls .flex{display:flex}.tauri-controls .hidden{display:none}.tauri-controls .inline-flex{display:inline-flex}.tauri-controls .aspect-square{aspect-ratio:1}.tauri-controls .h-2{height:calc(var(--spacing) * 2)}.tauri-controls .h-3{height:calc(var(--spacing) * 3)}.tauri-controls .h-6{height:calc(var(--spacing) * 6)}.tauri-controls .h-8{height:calc(var(--spacing) * 8)}.tauri-controls .h-10{height:calc(var(--spacing) * 10)}.tauri-controls .h-\[9px\]{height:9px}.tauri-controls .h-auto{height:auto}.tauri-controls .h-full{height:100%}.tauri-controls .h-screen{height:100vh}.tauri-controls .max-h-8{max-height:calc(var(--spacing) * 8)}.tauri-controls .w-2{width:calc(var(--spacing) * 2)}.tauri-controls .w-3{width:calc(var(--spacing) * 3)}.tauri-controls .w-6{width:calc(var(--spacing) * 6)}.tauri-controls .w-\[9px\]{width:9px}.tauri-controls .w-\[46px\]{width:46px}.tauri-controls .w-\[960px\]{width:960px}.tauri-controls .w-\[1300px\]{width:1300px}.tauri-controls .w-fit{width:fit-content}.tauri-controls .w-full{width:100%}.tauri-controls .cursor-default{cursor:default}.tauri-controls .flex-col{flex-direction:column}.tauri-controls .flex-row{flex-direction:row}.tauri-controls .content-center{align-content:center}.tauri-controls .items-center{align-items:center}.tauri-controls .justify-center{justify-content:center}:where(.tauri-controls .space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.tauri-controls .space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.tauri-controls .space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)))}:where(.tauri-controls .space-x-\[13px\]>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(13px * var(--tw-space-x-reverse));margin-inline-end:calc(13px * calc(1 - var(--tw-space-x-reverse)))}.tauri-controls .self-center{align-self:center}.tauri-controls .overflow-auto{overflow:auto}.tauri-controls .overflow-hidden{overflow:hidden}.tauri-controls .rounded-full{border-radius:3.40282e38px}.tauri-controls .rounded-md{border-radius:var(--radius-md)}.tauri-controls .rounded-none{border-radius:0}.tauri-controls .rounded-sm{border-radius:var(--radius-sm)}.tauri-controls .rounded-xl{border-radius:var(--radius-xl)}.tauri-controls .rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.tauri-controls .border{border-style:var(--tw-border-style);border-width:1px}.tauri-controls .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.tauri-controls .border-dashed{--tw-border-style:dashed;border-style:dashed}.tauri-controls .border-none{--tw-border-style:none;border-style:none}.tauri-controls .border-black\/12{border-color:#0000001f}@supports (color:color-mix(in lab,red,red)){.tauri-controls .border-black\/12{border-color:color-mix(in oklab,var(--color-black) 12%,transparent)}}.tauri-controls .border-black\/\[\.07\]{border-color:#00000012}@supports (color:color-mix(in lab,red,red)){.tauri-controls .border-black\/\[\.07\]{border-color:color-mix(in oklab,var(--color-black) 7%,transparent)}}.tauri-controls .border-slate-400{border-color:var(--color-slate-400)}.tauri-controls .bg-\[\#28c93f\]{background-color:#28c93f}.tauri-controls .bg-\[\#dadada\]{background-color:#dadada}.tauri-controls .bg-\[\#ff544d\]{background-color:#ff544d}.tauri-controls .bg-\[\#ffbd2e\]{background-color:#ffbd2e}.tauri-controls .bg-rose-300{background-color:var(--color-rose-300)}.tauri-controls .bg-rose-700{background-color:var(--color-rose-700)}.tauri-controls .bg-sky-300{background-color:var(--color-sky-300)}.tauri-controls .bg-sky-500{background-color:var(--color-sky-500)}.tauri-controls .bg-slate-200{background-color:var(--color-slate-200)}.tauri-controls .bg-slate-300{background-color:var(--color-slate-300)}.tauri-controls .bg-transparent{background-color:#0000}.tauri-controls .bg-violet-200\/20{background-color:#ddd6ff33}@supports (color:color-mix(in lab,red,red)){.tauri-controls .bg-violet-200\/20{background-color:color-mix(in oklab,var(--color-violet-200) 20%,transparent)}}.tauri-controls .bg-white{background-color:var(--color-white)}.tauri-controls .bg-yellow-300{background-color:var(--color-yellow-300)}.tauri-controls .p-0{padding:calc(var(--spacing) * 0)}.tauri-controls .p-2{padding:calc(var(--spacing) * 2)}.tauri-controls .p-3{padding:calc(var(--spacing) * 3)}.tauri-controls .px-2{padding-inline:calc(var(--spacing) * 2)}.tauri-controls .px-3{padding-inline:calc(var(--spacing) * 3)}.tauri-controls .px-14{padding-inline:calc(var(--spacing) * 14)}.tauri-controls .py-1{padding-block:calc(var(--spacing) * 1)}.tauri-controls .py-6{padding-block:calc(var(--spacing) * 6)}.tauri-controls .pr-10{padding-right:calc(var(--spacing) * 10)}.tauri-controls .pb-1{padding-bottom:calc(var(--spacing) * 1)}.tauri-controls .text-center{text-align:center}.tauri-controls .font-mono{font-family:var(--font-mono)}.tauri-controls .text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.tauri-controls .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tauri-controls .whitespace-nowrap{white-space:nowrap}.tauri-controls .text-\[\#3d3d3d\]{color:#3d3d3d}.tauri-controls .text-black{color:var(--color-black)}.tauri-controls .text-black\/60{color:#0009}@supports (color:color-mix(in lab,red,red)){.tauri-controls .text-black\/60{color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.tauri-controls .text-black\/90{color:#000000e6}@supports (color:color-mix(in lab,red,red)){.tauri-controls .text-black\/90{color:color-mix(in oklab,var(--color-black) 90%,transparent)}}.tauri-controls .text-sky-600\/70{color:#0084ccb3}@supports (color:color-mix(in lab,red,red)){.tauri-controls .text-sky-600\/70{color:color-mix(in oklab,var(--color-sky-600) 70%,transparent)}}.tauri-controls .text-white\/36{color:#ffffff5c}@supports (color:color-mix(in lab,red,red)){.tauri-controls .text-white\/36{color:color-mix(in oklab,var(--color-white) 36%,transparent)}}.tauri-controls .shadow,.tauri-controls .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.tauri-controls .select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.tauri-controls .hover\:bg-\[\#28c93f\]:hover{background-color:#28c93f}.tauri-controls .hover\:bg-\[\#c42b1c\]:hover{background-color:#c42b1c}.tauri-controls .hover\:bg-\[\#d1d1d1\]:hover{background-color:#d1d1d1}.tauri-controls .hover\:bg-\[\#ff544d\]:hover{background-color:#ff544d}.tauri-controls .hover\:bg-\[\#ffbd2e\]:hover{background-color:#ffbd2e}.tauri-controls .hover\:bg-black\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.tauri-controls .hover\:bg-black\/5:hover{background-color:color-mix(in oklab,var(--color-black) 5%,transparent)}}.tauri-controls .hover\:text-white:hover{color:var(--color-white)}}.tauri-controls .active\:bg-\[\#1e9930\]:active{background-color:#1e9930}.tauri-controls .active\:bg-\[\#bf403a\]:active{background-color:#bf403a}.tauri-controls .active\:bg-\[\#bf9122\]:active{background-color:#bf9122}.tauri-controls .active\:bg-\[\#bfbfbf\]:active{background-color:#bfbfbf}.tauri-controls .active\:bg-\[\#c42b1c\]\/90:active{background-color:#c42b1ce6}.tauri-controls .active\:bg-black\/3:active{background-color:#00000008}@supports (color:color-mix(in lab,red,red)){.tauri-controls .active\:bg-black\/3:active{background-color:color-mix(in oklab,var(--color-black) 3%,transparent)}}.tauri-controls .active\:text-black:active{color:var(--color-black)}.tauri-controls .active\:text-black\/60:active{color:#0009}@supports (color:color-mix(in lab,red,red)){.tauri-controls .active\:text-black\/60:active{color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.tauri-controls .dark\:border-none:where(.dark,.dark *){--tw-border-style:none;border-style:none}.tauri-controls .dark\:border-slate-600:where(.dark,.dark *){border-color:var(--color-slate-600)}.tauri-controls .dark\:bg-\[\#373737\]:where(.dark,.dark *){background-color:#373737}.tauri-controls .dark\:bg-slate-800:where(.dark,.dark *){background-color:var(--color-slate-800)}.tauri-controls .dark\:bg-slate-900:where(.dark,.dark *){background-color:var(--color-slate-900)}.tauri-controls .dark\:bg-slate-950\/50:where(.dark,.dark *){background-color:#02061880}@supports (color:color-mix(in lab,red,red)){.tauri-controls .dark\:bg-slate-950\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-slate-950) 50%,transparent)}}.tauri-controls .dark\:text-black:where(.dark,.dark *){color:var(--color-black)}.tauri-controls .dark\:text-sky-300\/70:where(.dark,.dark *){color:#77d4ffb3}@supports (color:color-mix(in lab,red,red)){.tauri-controls .dark\:text-sky-300\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-sky-300) 70%,transparent)}}.tauri-controls .dark\:text-white:where(.dark,.dark *){color:var(--color-white)}@media(hover:hover){.tauri-controls .dark\:hover\:bg-\[\#424242\]:where(.dark,.dark *):hover{background-color:#424242}.tauri-controls .dark\:hover\:bg-white\/6:where(.dark,.dark *):hover{background-color:#ffffff0f}@supports (color:color-mix(in lab,red,red)){.tauri-controls .dark\:hover\:bg-white\/6:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-white) 6%,transparent)}}}.tauri-controls .dark\:active\:bg-\[\#565656\]:where(.dark,.dark *):active{background-color:#565656}.tauri-controls .dark\:active\:bg-white\/4:where(.dark,.dark *):active{background-color:#ffffff0a}@supports (color:color-mix(in lab,red,red)){.tauri-controls .dark\:active\:bg-white\/4:where(.dark,.dark *):active{background-color:color-mix(in oklab,var(--color-white) 4%,transparent)}}}.tauri-controls button,.tauri-controls input,.tauri-controls optgroup,.tauri-controls select,.tauri-controls textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;appearance:none;cursor:default;background-color:#0000;border:none;border-radius:0;outline:none;margin:0;padding:0}.tauri-controls *{box-sizing:border-box}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
@@ -0,0 +1 @@
1
+ import"./tauri-controls.css";import e,{createContext as r,useState as t,useEffect as n,useCallback as i,useContext as o}from"react";import{clsx as a}from"clsx";import{twMerge as s}from"tailwind-merge";var l,c,d,u={exports:{}},f={},m={};var p=(d||(d=1,"production"===process.env.NODE_ENV?u.exports=function(){if(l)return f;l=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function t(r,t,n){var i=null;if(void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),"key"in t)for(var o in n={},t)"key"!==o&&(n[o]=t[o]);else n=t;return t=n.ref,{$$typeof:e,type:r,key:i,ref:void 0!==t?t:null,props:n}}return f.Fragment=r,f.jsx=t,f.jsxs=t,f}():u.exports=(c||(c=1,"production"!==process.env.NODE_ENV&&function(){function r(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===N?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case C:return"Fragment";case w:return"Profiler";case b:return"StrictMode";case v:return"Suspense";case g:return"SuspenseList";case _:return"Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case p:return"Portal";case h:return e.displayName||"Context";case x:return(e._context.displayName||"Context")+".Consumer";case y:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case k:return null!==(t=e.displayName||null)?t:r(e.type)||"Memo";case j:t=e._payload,e=e._init;try{return r(e(t))}catch{}}return null}function t(e){return""+e}function n(e){try{t(e);var r=!1}catch{r=!0}if(r){var n=(r=console).error,i="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",i),t(e)}}function i(e){if(e===C)return"<>";if("object"==typeof e&&null!==e&&e.$$typeof===j)return"<...>";try{var t=r(e);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function o(){return Error("react-stack-top-frame")}function a(){var e=r(this.type);return O[e]||(O[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(e=this.props.ref)?e:null}function s(e,t,i,o,s,c){var u,m,p,C,b,w,x,h,y=t.children;if(void 0!==y)if(o)if(z(y)){for(o=0;o<y.length;o++)l(y[o]);Object.freeze&&Object.freeze(y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(y);if(S.call(t,"key")){y=r(e);var v=Object.keys(t).filter((function(e){return"key"!==e}));o=0<v.length?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}",P[y+o]||(v=0<v.length?"{"+v.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',o,y,v,y),P[y+o]=!0)}if(y=null,void 0!==i&&(n(i),y=""+i),function(e){if(S.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return void 0!==e.key}(t)&&(n(t.key),y=""+t.key),"key"in t)for(var g in i={},t)"key"!==g&&(i[g]=t[g]);else i=t;return y&&function(e,r){function t(){d||(d=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}(i,"function"==typeof e?e.displayName||e.name||"Unknown":e),m=e,p=y,C=i,b=null===(u=W.A)?null:u.getOwner(),w=s,x=c,h=C.ref,m={$$typeof:f,type:m,key:p,props:C,_owner:b},null!==(void 0!==h?h:null)?Object.defineProperty(m,"ref",{enumerable:!1,get:a}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function l(e){c(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===j&&("fulfilled"===e._payload.status?c(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function c(e){return"object"==typeof e&&null!==e&&e.$$typeof===f}var d,u=e,f=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),h=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),W=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=Object.prototype.hasOwnProperty,z=Array.isArray,M=console.createTask?console.createTask:function(){return null},O={},L=(u={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(u,o)(),R=M(i(o)),P={};m.Fragment=C,m.jsx=function(e,r,t){var n=1e4>W.recentlyCreatedOwnerStacks++;return s(e,r,t,!1,n?Error("react-stack-top-frame"):L,n?M(i(e)):R)},m.jsxs=function(e,r,t){var n=1e4>W.recentlyCreatedOwnerStacks++;return s(e,r,t,!0,n?Error("react-stack-top-frame"):L,n?M(i(e)):R)}}()),m)),u.exports);function C(...e){return s(a(e))}let b,w=null;function x(){return w||(b?Promise.resolve(b):Promise.resolve("windows"))}typeof window<"u"&&(w=async function(){return async function(e,r={},t){return window.__TAURI_INTERNALS__.invoke(e,r,t)}("plugin:os|os_type")}().then((e=>(b=e,e))));const h=r({appWindow:null,isWindowMaximized:!1,minimizeWindow:()=>Promise.resolve(),maximizeWindow:()=>Promise.resolve(),fullscreenWindow:()=>Promise.resolve(),closeWindow:()=>Promise.resolve()}),y=({children:e})=>{const[r,o]=t(null),[a,s]=t(!1);n((()=>{typeof window<"u"&&import("./index-CRQ_vzBK.js").then((e=>{o(e.window.getCurrentWindow())}))}),[]);const l=i((async()=>{if(r){const e=await r.isMaximized();s(e)}}),[r]);return n((()=>{let e;return x().then((t=>{"macos"!==t&&(l(),(async()=>{r&&(e=await r.onResized((()=>{l()})))})())})),()=>{e&&e()}}),[r,l]),p.jsx(h.Provider,{value:{appWindow:r,isWindowMaximized:a,minimizeWindow:async()=>{r&&await r.minimize()},maximizeWindow:async()=>{r&&await r.toggleMaximize()},fullscreenWindow:async()=>{r&&(await r.isFullscreen()?await r.setFullscreen(!1):await r.setFullscreen(!0))},closeWindow:async()=>{r&&await r.close()}},children:e})},v={minimizeWin:e=>p.jsx("svg",{width:"10",height:"1",viewBox:"0 0 10 1",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:p.jsx("path",{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",fill:"currentColor",fillOpacity:"0.8956"})}),maximizeWin:e=>p.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:p.jsx("path",{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",fill:"currentColor",fillOpacity:"0.8956"})}),maximizeRestoreWin:e=>p.jsx("svg",{width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:p.jsx("path",{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",fill:"currentColor",fillOpacity:"0.8956"})}),closeWin:e=>p.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:p.jsx("path",{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",fill:"currentColor",fillOpacity:"0.8956"})}),closeMac:e=>p.jsx("svg",{width:"6",height:"6",viewBox:"0 0 16 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:p.jsx("path",{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",fill:"currentColor"})}),minMac:e=>p.jsx("svg",{width:"8",height:"8",viewBox:"0 0 17 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:p.jsx("g",{clipPath:"url(#clip0_20_2051)",children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",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",fill:"currentColor"})})}),fullMac:e=>p.jsx("svg",{width:"6",height:"6",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:p.jsx("g",{clipPath:"url(#clip0_20_2057)",children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",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",fill:"currentColor"})})}),plusMac:e=>p.jsx("svg",{width:"8",height:"8",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:p.jsx("g",{clipPath:"url(#clip0_20_2053)",children:p.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",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",fill:"currentColor"})})})};function g({className:e,children:r,...t}){return p.jsx("button",{className:C("inline-flex cursor-default items-center justify-center",e),...t,children:r})}function k({className:e,...r}){const{isWindowMaximized:t,minimizeWindow:n,maximizeWindow:i,closeWindow:a}=o(h);return p.jsxs("div",{className:C("h-8",e),...r,children:[p.jsx(g,{onClick:n,className:"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",children:p.jsx(v.minimizeWin,{})}),p.jsx(g,{onClick:i,className:C("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"),children:t?p.jsx(v.maximizeRestoreWin,{}):p.jsx(v.maximizeWin,{})}),p.jsx(g,{onClick:a,className:"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",children:p.jsx(v.closeWin,{})})]})}function j({className:e,...r}){const{minimizeWindow:i,maximizeWindow:a,fullscreenWindow:s,closeWindow:l}=o(h),[c,d]=t(!1),[u,f]=t(!1),m=c?p.jsx(v.plusMac,{}):p.jsx(v.fullMac,{}),b=e=>{"Alt"===e.key&&d(!0)},w=e=>{"Alt"===e.key&&d(!1)};return n((()=>{window.addEventListener("keydown",b),window.addEventListener("keyup",w)}),[]),p.jsxs("div",{className:C("space-x-2 px-3 text-black active:text-black dark:text-black",e),onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},...r,children:[p.jsx(g,{onClick:l,className:"aspect-square h-3 w-3 cursor-default 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",children:u&&p.jsx(v.closeMac,{})}),p.jsx(g,{onClick:i,className:"aspect-square h-3 w-3 cursor-default 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",children:u&&p.jsx(v.minMac,{})}),p.jsx(g,{onClick:c?a:s,className:"aspect-square h-3 w-3 cursor-default 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",children:u&&m})]})}function _({className:e,...r}){const{isWindowMaximized:t,minimizeWindow:n,maximizeWindow:i,closeWindow:a}=o(h);return p.jsxs("div",{className:C("mr-[10px] h-auto items-center space-x-[13px]",e),...r,children:[p.jsx(g,{onClick:n,className:"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]",children:p.jsx(v.minimizeWin,{className:"h-[9px] w-[9px]"})}),p.jsx(g,{onClick:i,className:"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]",children:t?p.jsx(v.maximizeRestoreWin,{className:"h-[9px] w-[9px]"}):p.jsx(v.maximizeWin,{className:"h-2 w-2"})}),p.jsx(g,{onClick:a,className:"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]",children:p.jsx(v.closeWin,{className:"h-2 w-2"})})]})}function N({platform:e,justify:r=!1,hide:i=!1,hideMethod:o="display",className:a,...s}){const[l,c]=t(void 0);n((()=>{x().then((e=>{c(e)}))}),[]);const d=C("tauri-controls flex",a,i&&("display"===o?"hidden":"invisible"));if(!e)switch(l){case"macos":e="macos";break;case"linux":e="gnome";break;default:e="windows"}return p.jsx(y,{children:p.jsx((()=>{switch(e){case"windows":default:return p.jsx(k,{className:C(d,r&&"ml-auto"),...s});case"macos":return p.jsx(j,{className:C(d,r&&"ml-0"),...s});case"gnome":return p.jsx(_,{className:C(d,r&&"ml-auto"),...s})}}),{})})}function W({children:e,controlsOrder:r="system",className:i,windowControlsProps:o,...a}){const[s,l]=t(void 0);n((()=>{x().then((e=>{l(e)}))}),[]);const c="left"===r||"platform"===r&&"macos"===o?.platform||"system"===r&&"macos"===s,d=e=>{if(void 0!==o?.justify)return o;const{justify:r,className:t,...n}=o||{};return{justify:!1,className:C(t,e),...n}};return p.jsx("div",{className:C("tauri-controls bg-background flex flex-row overflow-hidden select-none",i),"data-tauri-drag-region":!0,...a,children:c?p.jsxs(p.Fragment,{children:[p.jsx(N,{...d("ml-0")}),e]}):p.jsxs(p.Fragment,{children:[e,p.jsx(N,{...d("ml-auto")})]})})}export{N as WindowControls,W as WindowTitlebar};
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@tauri-controls-v2/react",
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",
10
+ "build": "tsc && vite build",
11
+ "build:watch": "vite build --watch",
12
+ "preview": "vite preview",
13
+ "lint": "eslint src",
14
+ "format": "prettier --write . --config ./prettier.config.cjs",
15
+ "tauri": "tauri",
16
+ "tauri:dev": "tauri dev"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/eatham532/tauri-controls-v2.git"
24
+ },
25
+ "author": "eatham532",
26
+ "bugs": {
27
+ "url": "https://github.com/eatham532/tauri-controls-v2/issues"
28
+ },
29
+ "homepage": "https://github.com/eatham532/tauri-controls-v2#readme",
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "exports": {
34
+ ".": {
35
+ "import": "./dist/tauri-controls.js",
36
+ "types": "./dist/index.d.ts"
37
+ }
38
+ },
39
+ "module": "./dist/tauri-controls.js",
40
+ "types": "./dist/index.d.ts",
41
+ "dependencies": {},
42
+ "devDependencies": {
43
+ "@eslint/js": "^10.0.1",
44
+ "@ianvs/prettier-plugin-sort-imports": "^4.7.1",
45
+ "@rollup/plugin-terser": "^0.4.4",
46
+ "@tailwindcss/vite": "^4.2.0",
47
+ "@tauri-apps/api": "^2.1.0",
48
+ "@tauri-apps/cli": "^2.1.0",
49
+ "@tauri-apps/plugin-os": "^2.1.0",
50
+ "@types/node": "^22.13.5",
51
+ "@types/react": "^19.0.10",
52
+ "@types/react-dom": "^19.0.4",
53
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
54
+ "@typescript-eslint/parser": "^8.21.0",
55
+ "@vitejs/plugin-react-swc": "^4.2.3",
56
+ "eslint": "^9.17.0",
57
+ "eslint-config-prettier": "^9.1.2",
58
+ "eslint-plugin-import": "^2.32.0",
59
+ "eslint-plugin-react": "^7.37.5",
60
+ "eslint-plugin-react-hooks": "^7.0.1",
61
+ "postcss": "^8.5.6",
62
+ "prettier": "^3.5.2",
63
+ "prettier-plugin-tailwindcss": "^0.7.2",
64
+ "react": "^19.0.0",
65
+ "react-dom": "^19.0.0",
66
+ "rollup": "^4.34.8",
67
+ "tailwindcss": "^4.2.0",
68
+ "typescript": "^5.7.3",
69
+ "typescript-eslint": "^8.56.0",
70
+ "vite": "^7.3.1",
71
+ "vite-plugin-dts": "^4.5.4",
72
+ "vite-tsconfig-paths": "^6.1.1"
73
+ },
74
+ "peerDependencies": {
75
+ "clsx": "^2.1.1",
76
+ "react": "^18.2.0 || ^19.0.0",
77
+ "react-dom": "^18.2.0 || ^19.0.0",
78
+ "tailwind-merge": "^3.0.1"
79
+ }
80
+ }