@synnaxlabs/drift 0.45.1 → 0.46.0
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/dist/electron.cjs +1 -1
- package/dist/electron.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +9 -9
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/{selectors-CvgeW9LM.js → selectors-D8hS_RlY.js} +1 -1
- package/dist/{selectors-oCvMthlz.cjs → selectors-aSH0_uiN.cjs} +1 -1
- package/dist/src/configureStore.d.ts.map +1 -1
- package/dist/src/tauri/index.d.ts.map +1 -1
- package/dist/{state-fkp7Fjfe.js → state-BY1hJV7i.js} +4397 -3420
- package/dist/state-Zba9U3R-.cjs +28 -0
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +53 -15
- package/package.json +17 -17
- package/dist/state-DSydrpNM.cjs +0 -34
package/dist/tauri.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./state-DSydrpNM.cjs"),Y=require("./debounce-BUAIXXZt.cjs");function X(t,e,i,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function ee(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var D;const h="__TAURI_TO_IPC_KEY__";function ie(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class te{get rid(){return X(this,D,"f")}constructor(e){D.set(this,void 0),ee(this,D,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}D=new WeakMap;var r;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(r||(r={}));async function U(t,e){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t,e),await s("plugin:event|unlisten",{event:t,eventId:e})}async function f(t,e,i){var n;const l=typeof i?.target=="string"?{kind:"AnyLabel",label:i.target}:(n=i?.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:ie(e)}).then(o=>async()=>U(t,o))}async function R(t,e,i){return f(t,n=>{U(t,n.id),e(n)},i)}async function k(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function H(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class _{constructor(...e){this.type="Logical",e.length===1?"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 d(this.width*e,this.height*e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class d{constructor(...e){this.type="Physical",e.length===1?"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 _(this.width/e,this.height/e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class w{constructor(e){this.size=e}toLogical(e){return this.size instanceof _?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[h](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[h]()}}class N{constructor(...e){this.type="Logical",e.length===1?"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 u(this.x*e,this.y*e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class u{constructor(...e){this.type="Physical",e.length===1?"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 N(this.x/e,this.y/e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class y{constructor(e){this.position=e}toLogical(e){return this.position instanceof N?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[h](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[h]()}}class m extends te{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:z(e),width:i,height:n}).then(l=>new m(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:z(e)}).then(i=>new m(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new m(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function z(t){return t==null?null:typeof t=="string"?t:t instanceof m?t.rid:t}var I;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(I||(I={}));class ne{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var T;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(T||(T={}));function G(){return new E(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function x(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new E(e,{skip:!0})))}const P=["tauri://created","tauri://error"];class E{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i?.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await x()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return G()}static async getAll(){return x()}static async getFocusedWindow(){for(const e of await x())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(P.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return k(e,i)}async emitTo(e,i,n){if(P.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return P.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new d(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new d(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===I.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e?.minWidth),minHeight:i(e?.minHeight),maxWidth:i(e?.maxWidth),maxHeight:i(e?.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:z(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?z(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(r.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(r.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(r.WINDOW_CLOSE_REQUESTED,async i=>{const n=new ne(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(r.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(r.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),o=await this.listen(r.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),o()}}async onFocusChanged(e){const i=await this.listen(r.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(r.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(r.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(r.WINDOW_THEME_CHANGED,e)}}var C;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(C||(C={}));var M;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(M||(M={}));var F;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(F||(F={}));function se(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size),workArea:{position:new u(t.workArea.position),size:new d(t.workArea.size)}}}async function le(){return s("plugin:window|available_monitors").then(t=>t.map(se))}function j(){return new L(G(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function B(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new L(new E(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class L{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n?.skip||s("plugin:webview|create_webview",{windowLabel:e.label,options:{...n,label:i}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await B()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return j()}static async getAll(){return B()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return k(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return H(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new d(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(e){return s("plugin:webview|set_webview_auto_resize",{label:this.label,value:e})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(r.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(r.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),o=await this.listen(r.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),o()}}}function q(){const t=j();return new b(t.label,{skip:!0})}async function S(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new b(e,{skip:!0})))}class b{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i?.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await S()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new b(n.label,{skip:!0}):null}static getCurrent(){return q()}static async getAll(){return S()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ae(b,[E,L]);function ae(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const re=t=>JSON.stringify(t),oe=t=>JSON.parse(t),W="drift://action",ue="tauri://error",ce="tauri://created",he=t=>new Error(`Window not found: ${t}`),p=250,we=c.i.seconds(1),v=t=>{if(t!=null)return{width:Math.max(t.width,p),height:Math.max(t.height,p)}},de=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:v(i),size:v(e)}},be=async()=>(await le()).map(e=>{const i=O(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return c.Ho.construct(i,n)}),V=async t=>(await be()).some(i=>c.Ho.contains(i,t));class ye{win;unsubscribe;fullscreenPoll=null;constructor(e){this.win=e??q(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(c.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:c.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},we.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===c.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e?.()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=re({...e,emitter:n});if(i==null)return await k(W,l);const o=await b.getByLabel(i);if(o==null)throw he(i);await o.emit(W,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[W]=await f(W,n=>e(oe(n.payload)));const i=pe();for(const{key:n,handler:l,debounce:o}of i)this.unsubscribe[n]=await this.win.listen(n,Y.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},o))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=c.T.copy(i);const{size:n,minSize:l,maxSize:o,position:a,...Z}=de(i);n?.width!=null&&(n.width=Math.max(n.width,p)),n?.height!=null&&(n.height=Math.max(n.height,p)),o?.width!=null&&(o.width=Math.max(o.width,p)),o?.height!=null&&(o.height=Math.max(o.height,p)),a!=null&&(await V(a)||(a.x=0,a.y=0));try{const g=new b(e,{x:a?.x,y:a?.y,width:n?.width,height:n?.height,minWidth:l?.width,minHeight:l?.height,maxWidth:o?.width,maxHeight:o?.height,titleBarStyle:"overlay",dragDropEnabled:!1,...Z});return await new Promise(($,K)=>{g.once(ue,Q=>K(new Error(JSON.stringify(Q.payload)))),g.once(ce,()=>$())})}catch(g){console.error(g)}}async close(e){const i=await b.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await S();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await S()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new N(e.x,e.y);await V(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=v(e),await this.win.setSize(new _(e.width,e.height))}async setMinSize(e){e=v(e),await this.win.setMinSize(new _(e.width,e.height))}async setMaxSize(e){e=v(e),await this.win.setMaxSize(new _(e.width,e.height))}async setResizable(e){return r.WINDOW_RESIZED in this.unsubscribe&&!e&&(this.unsubscribe[r.WINDOW_RESIZED]?.(),delete this.unsubscribe[r.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:O(await this.win.innerPosition(),e),size:J(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const pe=()=>[{key:r.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:O(await t.innerPosition(),e),size:J(await t.innerSize(),e)};return c.runtimeSetWindowProps(n)}},{key:r.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await t?.scaleFactor();if(e==null)return null;const i=O(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return c.runtimeSetWindowProps(l)}},{key:r.WINDOW_BLUR,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!1,label:t.label})},{key:r.WINDOW_FOCUS,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],O=(t,e)=>c.K.scale(t,1/e),J=(t,e)=>c._.scale(t,1/e);exports.TauriRuntime=ye;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./state-Zba9U3R-.cjs"),K=require("./debounce-BUAIXXZt.cjs");function X(t,e,i,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?n:i==="a"?n.call(t):n?n.value:e.get(t)}function ee(t,e,i,n,l){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var D;const h="__TAURI_TO_IPC_KEY__";function ie(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},i){return window.__TAURI_INTERNALS__.invoke(t,e,i)}class te{get rid(){return X(this,D,"f")}constructor(e){D.set(this,void 0),ee(this,D,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}D=new WeakMap;var r;(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(r||(r={}));async function U(t,e){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t,e),await s("plugin:event|unlisten",{event:t,eventId:e})}async function f(t,e,i){var n;const l=typeof i?.target=="string"?{kind:"AnyLabel",label:i.target}:(n=i?.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:ie(e)}).then(o=>async()=>U(t,o))}async function R(t,e,i){return f(t,n=>{U(t,n.id),e(n)},i)}async function k(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function G(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class _{constructor(...e){this.type="Logical",e.length===1?"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)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class b{constructor(...e){this.type="Physical",e.length===1?"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 _(this.width/e,this.height/e)}[h](){return{width:this.width,height:this.height}}toJSON(){return this[h]()}}class w{constructor(e){this.size=e}toLogical(e){return this.size instanceof _?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof b?this.size:this.size.toPhysical(e)}[h](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[h]()}}class N{constructor(...e){this.type="Logical",e.length===1?"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 u(this.x*e,this.y*e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class u{constructor(...e){this.type="Physical",e.length===1?"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 N(this.x/e,this.y/e)}[h](){return{x:this.x,y:this.y}}toJSON(){return this[h]()}}class y{constructor(e){this.position=e}toLogical(e){return this.position instanceof N?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[h](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[h]()}}class v extends te{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:z(e),width:i,height:n}).then(l=>new v(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:z(e)}).then(i=>new v(i))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(i=>new v(i))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}function z(t){return t==null?null:typeof t=="string"?t:t instanceof v?t.rid:t}var I;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(I||(I={}));class ne{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var T;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(T||(T={}));function H(){return new P(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function E(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new P(e,{skip:!0})))}const x=["tauri://created","tauri://error"];class P{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i?.skip||s("plugin:window|create",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await E()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return H()}static async getAll(){return E()}static async getFocusedWindow(){for(const e of await E())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Window",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(x.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return k(e,i)}async emitTo(e,i,n){if(x.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return G(e,i,n)}_handleTauriEvent(e,i){return x.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new u(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new u(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new b(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new b(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let i=null;return e&&(e===I.Critical?i={type:"Critical"}:i={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:i})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof w?e:e?new w(e):null})}async setSizeConstraints(e){function i(n){return n?{Logical:n}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:i(e?.minWidth),minHeight:i(e?.minHeight),maxWidth:i(e?.maxWidth),maxHeight:i(e?.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setSimpleFullscreen(e){return s("plugin:window|set_simple_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setFocusable(e){return s("plugin:window|set_focusable",{label:this.label,value:e})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:z(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?z(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(r.WINDOW_RESIZED,i=>{i.payload=new b(i.payload),e(i)})}async onMoved(e){return this.listen(r.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(r.WINDOW_CLOSE_REQUESTED,async i=>{const n=new ne(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(r.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(r.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),o=await this.listen(r.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),o()}}async onFocusChanged(e){const i=await this.listen(r.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(r.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(r.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(r.WINDOW_THEME_CHANGED,e)}}var C;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(C||(C={}));var M;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(M||(M={}));var F;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(F||(F={}));function se(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new b(t.size),workArea:{position:new u(t.workArea.position),size:new b(t.workArea.size)}}}async function le(){return s("plugin:window|available_monitors").then(t=>t.map(se))}function j(){return new L(H(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function B(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new L(new P(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class L{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n?.skip||s("plugin:webview|create_webview",{windowLabel:e.label,options:{...n,label:i}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await B()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return j()}static async getAll(){return B()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"Webview",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"Webview",label:this.label}})}async emit(e,i){if(A.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return k(e,i)}async emitTo(e,i,n){if(A.includes(i)){for(const l of this.listeners[i]||[])l({event:i,id:-1,payload:n});return}return G(e,i,n)}_handleTauriEvent(e,i){return A.includes(e)?(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new u(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new b(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof w?e:new w(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof y?e:new y(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(e){return s("plugin:webview|set_webview_auto_resize",{label:this.label,value:e})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){const i=await this.listen(r.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(r.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(r.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),o=await this.listen(r.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),o()}}}function q(){const t=j();return new d(t.label,{skip:!0})}async function S(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new d(e,{skip:!0})))}class d{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i?.skip||s("plugin:webview|create_webview_window",{options:{...i,parent:typeof i.parent=="string"?i.parent:(n=i.parent)===null||n===void 0?void 0:n.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;const n=(i=(await S()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new d(n.label,{skip:!0}):null}static getCurrent(){return q()}static async getAll(){return S()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:f(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:R(e,i,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}}ae(d,[P,L]);function ae(t,e){(Array.isArray(e)?e:[e]).forEach(i=>{Object.getOwnPropertyNames(i.prototype).forEach(n=>{var l;typeof t.prototype=="object"&&t.prototype&&n in t.prototype||Object.defineProperty(t.prototype,n,(l=Object.getOwnPropertyDescriptor(i.prototype,n))!==null&&l!==void 0?l:Object.create(null))})})}const re=t=>JSON.stringify(t),oe=t=>JSON.parse(t),W="drift://action",ue="tauri://error",ce="tauri://created",he=t=>new Error(`Window not found: ${t}`),p=250,we=c.a.seconds(1),m=t=>{if(t!=null)return{width:Math.max(t.width,p),height:Math.max(t.height,p)}},be=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:m(i),size:m(e)}},de=async()=>(await le()).map(e=>{const i=O(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return c.jt.construct(i,n)}),V=async t=>(await de()).some(i=>c.jt.contains(i,t));class ye{win;unsubscribe;fullscreenPoll=null;constructor(e){this.win=e??q(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(c.S.getOS()!=="macOS")return;let e=(await this.getProps()).fullscreen;this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.fullscreenPoll=setInterval(()=>{this.win.isFullscreen().then(i=>{i!==e&&(e=i,this.emit({action:c.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},we.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===c.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e?.()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=re({...e,emitter:n});if(i==null)return await k(W,l);const o=await d.getByLabel(i);if(o==null)throw he(i);await o.emit(W,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[W]=await f(W,n=>e(oe(n.payload)));const i=pe();for(const{key:n,handler:l,debounce:o}of i)this.unsubscribe[n]=await this.win.listen(n,K.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},o))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=c.T.copy(i);const{size:n,minSize:l,maxSize:o,position:a,...Z}=be(i);n?.width!=null&&(n.width=Math.max(n.width,p)),n?.height!=null&&(n.height=Math.max(n.height,p)),o?.width!=null&&(o.width=Math.max(o.width,p)),o?.height!=null&&(o.height=Math.max(o.height,p)),a!=null&&(await V(a)||(a.x=0,a.y=0));try{const g=new d(e,{x:a?.x,y:a?.y,width:n?.width,height:n?.height,minWidth:l?.width,minHeight:l?.height,maxWidth:o?.width,maxHeight:o?.height,titleBarStyle:"overlay",dragDropEnabled:!1,...Z});return await new Promise(($,Q)=>{g.once(ue,Y=>Q(new Error(JSON.stringify(Y.payload)))),g.once(ce,()=>$())})}catch(g){console.error(g)}}async close(e){const i=await d.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await S();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await S()).map(i=>i.label)}async focus(){return await this.win.setFocus()}async setMinimized(e){return e?await this.win.minimize():await this.win.unminimize()}async setMaximized(e){return e?await this.win.maximize():await this.win.unmaximize()}async setVisible(e){return e?await this.win.show():await this.win.hide()}async setFullscreen(e){await this.win.setFullscreen(e)}async center(){return await this.win.center()}async setPosition(e){const i=new N(e.x,e.y);await V(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=m(e),await this.win.setSize(new _(e.width,e.height))}async setMinSize(e){e=m(e),await this.win.setMinSize(new _(e.width,e.height))}async setMaxSize(e){e=m(e),await this.win.setMaxSize(new _(e.width,e.height))}async setResizable(e){return r.WINDOW_RESIZED in this.unsubscribe&&!e&&(this.unsubscribe[r.WINDOW_RESIZED]?.(),delete this.unsubscribe[r.WINDOW_RESIZED]),await this.win.setResizable(e)}async setSkipTaskbar(e){return await this.win.setSkipTaskbar(e)}async setAlwaysOnTop(e){return await this.win.setAlwaysOnTop(e)}async setTitle(e){return await this.win.setTitle(e)}async setDecorations(e){return await this.win.setDecorations(e)}async getProps(){const e=await this.win.scaleFactor(),i=await this.win.isVisible();return{position:O(await this.win.innerPosition(),e),size:J(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const pe=()=>[{key:r.WINDOW_RESIZED,debounce:200,handler:async t=>{const e=await t.scaleFactor(),i=await t.isVisible(),n={label:t.label,maximized:await t.isMaximized(),visible:i,minimized:!i,position:O(await t.innerPosition(),e),size:J(await t.innerSize(),e)};return c.runtimeSetWindowProps(n)}},{key:r.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await t?.scaleFactor();if(e==null)return null;const i=O(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return c.runtimeSetWindowProps(l)}},{key:r.WINDOW_BLUR,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!1,label:t.label})},{key:r.WINDOW_FOCUS,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],O=(t,e)=>c.Q.scale(t,1/e),J=(t,e)=>c._.scale(t,1/e);exports.TauriRuntime=ye;
|
package/dist/tauri.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as X, H as ee, r as g, M as ie, T as te, _ as ne,
|
|
1
|
+
import { G as X, H as ee, r as g, M as ie, T as te, _ as ne, Q as se, J as U } from "./state-BY1hJV7i.js";
|
|
2
2
|
import { o as le } from "./debounce-DOZKRZa9.js";
|
|
3
3
|
function ae(t, e, i, n) {
|
|
4
4
|
if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -53,12 +53,12 @@ async function f(t, e, i) {
|
|
|
53
53
|
handler: oe(e)
|
|
54
54
|
}).then((o) => async () => G(t, o));
|
|
55
55
|
}
|
|
56
|
-
async function
|
|
56
|
+
async function R(t, e, i) {
|
|
57
57
|
return f(t, (n) => {
|
|
58
58
|
G(t, n.id), e(n);
|
|
59
59
|
}, i);
|
|
60
60
|
}
|
|
61
|
-
async function
|
|
61
|
+
async function k(t, e) {
|
|
62
62
|
await s("plugin:event|emit", {
|
|
63
63
|
event: t,
|
|
64
64
|
payload: e
|
|
@@ -303,10 +303,10 @@ class v extends ue {
|
|
|
303
303
|
function z(t) {
|
|
304
304
|
return t == null ? null : typeof t == "string" ? t : t instanceof v ? t.rid : t;
|
|
305
305
|
}
|
|
306
|
-
var
|
|
306
|
+
var P;
|
|
307
307
|
(function(t) {
|
|
308
308
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
309
|
-
})(
|
|
309
|
+
})(P || (P = {}));
|
|
310
310
|
class ce {
|
|
311
311
|
constructor(e) {
|
|
312
312
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
@@ -456,7 +456,7 @@ class x {
|
|
|
456
456
|
return this._handleTauriEvent(e, i) ? () => {
|
|
457
457
|
const n = this.listeners[e];
|
|
458
458
|
n.splice(n.indexOf(i), 1);
|
|
459
|
-
} :
|
|
459
|
+
} : R(e, i, {
|
|
460
460
|
target: { kind: "Window", label: this.label }
|
|
461
461
|
});
|
|
462
462
|
}
|
|
@@ -481,7 +481,7 @@ class x {
|
|
|
481
481
|
});
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
|
-
return
|
|
484
|
+
return k(e, i);
|
|
485
485
|
}
|
|
486
486
|
/**
|
|
487
487
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -838,7 +838,7 @@ class x {
|
|
|
838
838
|
*/
|
|
839
839
|
async requestUserAttention(e) {
|
|
840
840
|
let i = null;
|
|
841
|
-
return e && (e ===
|
|
841
|
+
return e && (e === P.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
|
|
842
842
|
label: this.label,
|
|
843
843
|
value: i
|
|
844
844
|
});
|
|
@@ -1334,6 +1334,21 @@ class x {
|
|
|
1334
1334
|
value: e
|
|
1335
1335
|
});
|
|
1336
1336
|
}
|
|
1337
|
+
/**
|
|
1338
|
+
* On macOS, Toggles a fullscreen mode that doesn’t require a new macOS space. Returns a boolean indicating whether the transition was successful (this won’t work if the window was already in the native fullscreen).
|
|
1339
|
+
* This is how fullscreen used to work on macOS in versions before Lion. And allows the user to have a fullscreen window without using another space or taking control over the entire monitor.
|
|
1340
|
+
*
|
|
1341
|
+
* On other platforms, this is the same as {@link Window.setFullscreen}.
|
|
1342
|
+
*
|
|
1343
|
+
* @param fullscreen Whether the window should go to simple fullscreen or not.
|
|
1344
|
+
* @returns A promise indicating the success or failure of the operation.
|
|
1345
|
+
*/
|
|
1346
|
+
async setSimpleFullscreen(e) {
|
|
1347
|
+
return s("plugin:window|set_simple_fullscreen", {
|
|
1348
|
+
label: this.label,
|
|
1349
|
+
value: e
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1337
1352
|
/**
|
|
1338
1353
|
* Bring the window to front and focus.
|
|
1339
1354
|
* @example
|
|
@@ -1349,6 +1364,29 @@ class x {
|
|
|
1349
1364
|
label: this.label
|
|
1350
1365
|
});
|
|
1351
1366
|
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Sets whether the window can be focused.
|
|
1369
|
+
*
|
|
1370
|
+
* #### Platform-specific
|
|
1371
|
+
*
|
|
1372
|
+
* - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`.
|
|
1373
|
+
* In this case, you might consider calling {@link Window.setFocus} but it will move the window to the back i.e. at the bottom in terms of z-order.
|
|
1374
|
+
*
|
|
1375
|
+
* @example
|
|
1376
|
+
* ```typescript
|
|
1377
|
+
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1378
|
+
* await getCurrentWindow().setFocusable(true);
|
|
1379
|
+
* ```
|
|
1380
|
+
*
|
|
1381
|
+
* @param focusable Whether the window can be focused.
|
|
1382
|
+
* @returns A promise indicating the success or failure of the operation.
|
|
1383
|
+
*/
|
|
1384
|
+
async setFocusable(e) {
|
|
1385
|
+
return s("plugin:window|set_focusable", {
|
|
1386
|
+
label: this.label,
|
|
1387
|
+
value: e
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1352
1390
|
/**
|
|
1353
1391
|
* Sets the window icon.
|
|
1354
1392
|
* @example
|
|
@@ -2041,7 +2079,7 @@ class L {
|
|
|
2041
2079
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2042
2080
|
const n = this.listeners[e];
|
|
2043
2081
|
n.splice(n.indexOf(i), 1);
|
|
2044
|
-
} :
|
|
2082
|
+
} : R(e, i, {
|
|
2045
2083
|
target: { kind: "Webview", label: this.label }
|
|
2046
2084
|
});
|
|
2047
2085
|
}
|
|
@@ -2067,7 +2105,7 @@ class L {
|
|
|
2067
2105
|
});
|
|
2068
2106
|
return;
|
|
2069
2107
|
}
|
|
2070
|
-
return
|
|
2108
|
+
return k(e, i);
|
|
2071
2109
|
}
|
|
2072
2110
|
/**
|
|
2073
2111
|
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
@@ -2485,7 +2523,7 @@ class b {
|
|
|
2485
2523
|
return this._handleTauriEvent(e, i) ? () => {
|
|
2486
2524
|
const n = this.listeners[e];
|
|
2487
2525
|
n.splice(n.indexOf(i), 1);
|
|
2488
|
-
} :
|
|
2526
|
+
} : R(e, i, {
|
|
2489
2527
|
target: { kind: "WebviewWindow", label: this.label }
|
|
2490
2528
|
});
|
|
2491
2529
|
}
|
|
@@ -2553,7 +2591,7 @@ class Oe {
|
|
|
2553
2591
|
async startFullscreenPoll() {
|
|
2554
2592
|
if (ee.getOS() !== "macOS") return;
|
|
2555
2593
|
let e = (await this.getProps()).fullscreen;
|
|
2556
|
-
this.fullscreenPoll = setInterval(() => {
|
|
2594
|
+
this.fullscreenPoll != null && clearInterval(this.fullscreenPoll), this.fullscreenPoll = setInterval(() => {
|
|
2557
2595
|
this.win.isFullscreen().then((i) => {
|
|
2558
2596
|
i !== e && (e = i, this.emit(
|
|
2559
2597
|
{
|
|
@@ -2579,7 +2617,7 @@ class Oe {
|
|
|
2579
2617
|
}
|
|
2580
2618
|
async emit(e, i, n = this.label()) {
|
|
2581
2619
|
const l = de({ ...e, emitter: n });
|
|
2582
|
-
if (i == null) return await
|
|
2620
|
+
if (i == null) return await k(D, l);
|
|
2583
2621
|
const o = await b.getByLabel(i);
|
|
2584
2622
|
if (o == null) throw _e(i);
|
|
2585
2623
|
await o.emit(D, l);
|
|
@@ -2625,8 +2663,8 @@ class Oe {
|
|
|
2625
2663
|
dragDropEnabled: !1,
|
|
2626
2664
|
...$
|
|
2627
2665
|
});
|
|
2628
|
-
return await new Promise((
|
|
2629
|
-
p.once(pe, (
|
|
2666
|
+
return await new Promise((Q, Y) => {
|
|
2667
|
+
p.once(pe, (K) => Y(new Error(JSON.stringify(K.payload)))), p.once(ge, () => Q());
|
|
2630
2668
|
});
|
|
2631
2669
|
} catch (p) {
|
|
2632
2670
|
console.error(p);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/drift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "State synchronization and Redux state synchronization for Tauri Apps",
|
|
5
5
|
"repository": "https://github.com/synnaxlabs/synnax/tree/main/drift",
|
|
6
6
|
"type": "module",
|
|
@@ -14,30 +14,30 @@
|
|
|
14
14
|
"application level state"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@reduxjs/toolkit": "^2.
|
|
18
|
-
"@tauri-apps/api": "^2.
|
|
17
|
+
"@reduxjs/toolkit": "^2.9.0",
|
|
18
|
+
"@tauri-apps/api": "^2.8.0",
|
|
19
19
|
"async-mutex": "^0.5.0",
|
|
20
20
|
"proxy-memoize": "2.0.3",
|
|
21
|
-
"react": "^19.1.
|
|
22
|
-
"react-dom": "^19.1.
|
|
21
|
+
"react": "^19.1.1",
|
|
22
|
+
"react-dom": "^19.1.1",
|
|
23
23
|
"react-redux": "^9.2.0",
|
|
24
|
-
"zod": "^4.
|
|
25
|
-
"@synnaxlabs/x": "^0.
|
|
24
|
+
"zod": "^4.1.8",
|
|
25
|
+
"@synnaxlabs/x": "^0.46.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/react": "^19.1.
|
|
29
|
-
"@vitejs/plugin-react": "^
|
|
30
|
-
"electron": "^
|
|
31
|
-
"eslint": "^9.
|
|
32
|
-
"react": "^19.1.
|
|
33
|
-
"react-dom": "^19.1.
|
|
28
|
+
"@types/react": "^19.1.13",
|
|
29
|
+
"@vitejs/plugin-react": "^5.0.2",
|
|
30
|
+
"electron": "^38.1.0",
|
|
31
|
+
"eslint": "^9.35.0",
|
|
32
|
+
"react": "^19.1.1",
|
|
33
|
+
"react-dom": "^19.1.1",
|
|
34
34
|
"react-redux": "^9.2.0",
|
|
35
|
-
"typescript": "^5.
|
|
36
|
-
"vite": "^7.
|
|
35
|
+
"typescript": "^5.9.2",
|
|
36
|
+
"vite": "^7.1.5",
|
|
37
37
|
"vitest": "^3.2.4",
|
|
38
38
|
"@synnaxlabs/tsconfig": "^0.43.0",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"eslint-config-synnaxlabs": "^0.43.0",
|
|
40
|
+
"@synnaxlabs/vite-plugin": "^0.43.0"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"dist"
|