@synnaxlabs/drift 0.42.1 → 0.43.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/README.md +48 -56
- package/dist/electron.cjs +1 -1
- package/dist/electron.js +9 -10
- package/dist/index.cjs +1 -1
- package/dist/index.js +219 -161
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/{selectors--wDYbFAe.js → selectors-CzAkOydY.js} +1 -1
- package/dist/selectors-DrXQNVVN.cjs +1 -0
- package/dist/src/external.d.ts +3 -3
- package/dist/src/external.d.ts.map +1 -1
- package/dist/src/{noop/index.d.ts → noop.d.ts} +13 -9
- package/dist/src/noop.d.ts.map +1 -0
- package/dist/src/runtime.d.ts.map +1 -1
- package/dist/src/sync.d.ts.map +1 -1
- package/dist/src/window.d.ts +6 -6
- package/dist/src/window.d.ts.map +1 -1
- package/dist/state-BGByXBtX.cjs +61 -0
- package/dist/state-C1PObbun.js +13735 -0
- package/dist/tauri.cjs +1 -1
- package/dist/tauri.js +33 -34
- package/package.json +15 -19
- package/dist/noop.cjs +0 -1
- package/dist/noop.js +0 -68
- package/dist/selectors-jksTA_U1.cjs +0 -1
- package/dist/src/noop/index.d.ts.map +0 -1
- package/dist/state-BOplmOQD.js +0 -406
- package/dist/state-Cl8us-b9.cjs +0 -1
- package/dist/window-BIbHrbtA.js +0 -8619
- package/dist/window-DLsE0-fP.cjs +0 -41
package/dist/tauri.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ee=Object.defineProperty;var ie=(t,e,i)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var D=(t,e,i)=>ie(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./window-DLsE0-fP.cjs"),y=require("./state-Cl8us-b9.cjs"),te=require("./debounce-BUAIXXZt.cjs");function ne(t,e,i,n){if(typeof e=="function"?t!==e||!0:!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 se(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 S;const c="__TAURI_TO_IPC_KEY__";function le(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 ae{get rid(){return ne(this,S,"f")}constructor(e){S.set(this,void 0),se(this,S,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}S=new WeakMap;var o;(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"})(o||(o={}));async function H(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}async function W(t,e,i){var n;const l=typeof(i==null?void 0:i.target)=="string"?{kind:"AnyLabel",label:i.target}:(n=i==null?void 0:i.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:le(e)}).then(r=>async()=>H(t,r))}async function L(t,e,i){return W(t,n=>{H(t,n.id),e(n)},i)}async function N(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function j(t,e,i){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:i})}class v{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)}[c](){return{width:this.width,height:this.height}}toJSON(){return this[c]()}}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 v(this.width/e,this.height/e)}[c](){return{width:this.width,height:this.height}}toJSON(){return this[c]()}}class h{constructor(e){this.size=e}toLogical(e){return this.size instanceof v?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof d?this.size:this.size.toPhysical(e)}[c](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[c]()}}class T{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)}[c](){return{x:this.x,y:this.y}}toJSON(){return this[c]()}}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 T(this.x/e,this.y/e)}[c](){return{x:this.x,y:this.y}}toJSON(){return this[c]()}}class p{constructor(e){this.position=e}toLogical(e){return this.position instanceof T?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof u?this.position:this.position.toPhysical(e)}[c](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[c]()}}class m extends ae{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 k;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(k||(k={}));class re{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var M;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(M||(M={}));function q(){return new I(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function R(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new I(e,{skip:!0})))}const x=["tauri://created","tauri://error"];class I{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=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 R()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return q()}static async getAll(){return R()}static async getFocusedWindow(){for(const e of await R())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)}:W(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)}:L(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 N(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 j(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 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===k.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 h?e:new h(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof h?e:e?new h(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof h?e:e?new h(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==null?void 0:e.minWidth),minHeight:i(e==null?void 0:e.minHeight),maxWidth:i(e==null?void 0:e.maxWidth),maxHeight:i(e==null?void 0:e.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof p?e:new p(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 p?e:new p(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(o.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(o.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,async i=>{const n=new re(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}async onFocusChanged(e){const i=await this.listen(o.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(o.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var F;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(F||(F={}));var B;(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"})(B||(B={}));var V;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(V||(V={}));function oe(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size)}}async function ue(){return s("plugin:window|available_monitors").then(t=>t.map(oe))}function J(){return new C(q(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function U(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new C(new I(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class C{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n!=null&&n.skip||s("plugin:webview|create_webview",{windowLabel:e.label,label:i,options:n}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await U()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return J()}static async getAll(){return U()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(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)}:L(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 N(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 j(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 h?e:new h(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof p?e:new p(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}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(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}}function Z(){const t=J();return new w(t.label,{skip:!0})}async function P(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new w(e,{skip:!0})))}class w{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=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 P()).find(l=>l.label===e))!==null&&i!==void 0?i:null;return n?new w(n.label,{skip:!0}):null}static getCurrent(){return Z()}static async getAll(){return P()}async listen(e,i){return this._handleTauriEvent(e,i)?()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)}:W(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)}:L(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}))}}ce(w,[I,C]);function ce(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 he=t=>JSON.stringify(t),we=t=>JSON.parse(t),O="drift://action",de="tauri://error",be="tauri://created",ye=t=>new Error(`Window not found: ${t}`),g=250,pe=b.O.seconds(1),f=t=>{if(t!=null)return{width:Math.max(t.width,g),height:Math.max(t.height,g)}},ge=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:f(i),size:f(e)}},_e=async()=>(await ue()).map(e=>{const i=E(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return b.$t.construct(i,n)}),G=async t=>(await _e()).some(i=>b.$t.contains(i,t));class ve{constructor(e){D(this,"win");D(this,"unsubscribe");D(this,"fullscreenPoll",null);this.win=e??Z(),this.unsubscribe={}}async configure(){await this.startFullscreenPoll()}async startFullscreenPoll(){if(b.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:y.runtimeSetWindowProps({label:this.win.label,fullscreen:i})},void 0,"WHITELIST").catch(console.error))}).catch(console.error)},pe.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===b.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e==null?void 0:e()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=he({...e,emitter:n});if(i==null)return await N(O,l);const r=await w.getByLabel(i);if(r==null)throw ye(i);await r.emit(O,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[O]=await W(O,n=>e(we(n.payload)));const i=me();for(const{key:n,handler:l,debounce:r}of i)this.unsubscribe[n]=await this.win.listen(n,te.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},r))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=y.x.copy(i);const{size:n,minSize:l,maxSize:r,position:a,...Q}=ge(i);(n==null?void 0:n.width)!=null&&(n.width=Math.max(n.width,g)),(n==null?void 0:n.height)!=null&&(n.height=Math.max(n.height,g)),(r==null?void 0:r.width)!=null&&(r.width=Math.max(r.width,g)),(r==null?void 0:r.height)!=null&&(r.height=Math.max(r.height,g)),a!=null&&(await G(a)||(a.x=0,a.y=0));try{const _=new w(e,{x:a==null?void 0:a.x,y:a==null?void 0:a.y,width:n==null?void 0:n.width,height:n==null?void 0:n.height,minWidth:l==null?void 0:l.width,minHeight:l==null?void 0:l.height,maxWidth:r==null?void 0:r.width,maxHeight:r==null?void 0:r.height,titleBarStyle:"overlay",dragDropEnabled:!1,...Q});return await new Promise((Y,K)=>{_.once(de,X=>K(new Error(JSON.stringify(X.payload)))),_.once(be,()=>Y())})}catch(_){console.error(_)}}async close(e){const i=await w.getByLabel(e);if(i!=null)try{await i.destroy()}catch(n){console.error(n,e)}else{const n=await P();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await P()).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 T(e.x,e.y);await G(e)||(i.x=0,i.y=0),await this.win.setPosition(i)}async setSize(e){e=f(e),await this.win.setSize(new v(e.width,e.height))}async setMinSize(e){e=f(e),await this.win.setMinSize(new v(e.width,e.height))}async setMaxSize(e){e=f(e),await this.win.setMaxSize(new v(e.width,e.height))}async setResizable(e){var i,n;return o.WINDOW_RESIZED in this.unsubscribe&&!e&&((n=(i=this.unsubscribe)[o.WINDOW_RESIZED])==null||n.call(i),delete this.unsubscribe[o.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:E(await this.win.innerPosition(),e),size:$(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const me=()=>[{key:o.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:E(await t.innerPosition(),e),size:$(await t.innerSize(),e)};return y.runtimeSetWindowProps(n)}},{key:o.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await(t==null?void 0:t.scaleFactor());if(e==null)return null;const i=E(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return y.runtimeSetWindowProps(l)}},{key:o.WINDOW_BLUR,debounce:0,handler:async t=>y.runtimeSetWindowProps({focus:!1,label:t.label})},{key:o.WINDOW_FOCUS,debounce:0,handler:async t=>y.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],E=(t,e)=>b.J.scale(t,1/e),$=(t,e)=>b._.scale(t,1/e);exports.TauriRuntime=ve;
|
|
1
|
+
"use strict";var X=Object.defineProperty;var ee=(t,e,i)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var W=(t,e,i)=>ee(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./state-BGByXBtX.cjs"),ie=require("./debounce-BUAIXXZt.cjs");function te(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 ne(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 O;const h="__TAURI_TO_IPC_KEY__";function se(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 le{get rid(){return te(this,O,"f")}constructor(e){O.set(this,void 0),ne(this,O,e)}async close(){return s("plugin:resources|close",{rid:this.rid})}}O=new WeakMap;var o;(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"})(o||(o={}));async function G(t,e){await s("plugin:event|unlisten",{event:t,eventId:e})}async function f(t,e,i){var n;const l=typeof(i==null?void 0:i.target)=="string"?{kind:"AnyLabel",label:i.target}:(n=i==null?void 0:i.target)!==null&&n!==void 0?n:{kind:"Any"};return s("plugin:event|listen",{event:t,target:l,handler:se(e)}).then(r=>async()=>G(t,r))}async function x(t,e,i){return f(t,n=>{G(t,n.id),e(n)},i)}async function L(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 v extends le{constructor(e){super(e)}static async new(e,i,n){return s("plugin:image|new",{rgba:S(e),width:i,height:n}).then(l=>new v(l))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:S(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 S(t){return t==null?null:typeof t=="string"?t:t instanceof v?t.rid:t}var k;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(k||(k={}));class ae{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var C;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(C||(C={}));function j(){return new E(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function I(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new E(e,{skip:!0})))}const R=["tauri://created","tauri://error"];class E{constructor(e,i={}){var n;this.label=e,this.listeners=Object.create(null),i!=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 I()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return j()}static async getAll(){return I()}static async getFocusedWindow(){for(const e of await I())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)}:x(e,i,{target:{kind:"Window",label:this.label}})}async emit(e,i){if(R.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,payload:i});return}return L(e,i)}async emitTo(e,i,n){if(R.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 R.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===k.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==null?void 0:e.minWidth),minHeight:i(e==null?void 0:e.minHeight),maxWidth:i(e==null?void 0:e.maxWidth),maxHeight:i(e==null?void 0: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:S(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?S(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(o.WINDOW_RESIZED,i=>{i.payload=new d(i.payload),e(i)})}async onMoved(e){return this.listen(o.WINDOW_MOVED,i=>{i.payload=new u(i.payload),e(i)})}async onCloseRequested(e){return this.listen(o.WINDOW_CLOSE_REQUESTED,async i=>{const n=new ae(i);await e(n),n.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const i=await this.listen(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}async onFocusChanged(e){const i=await this.listen(o.WINDOW_FOCUS,l=>{e({...l,payload:!0})}),n=await this.listen(o.WINDOW_BLUR,l=>{e({...l,payload:!1})});return()=>{i(),n()}}async onScaleChanged(e){return this.listen(o.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(o.WINDOW_THEME_CHANGED,e)}}var M;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(M||(M={}));var F;(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"})(F||(F={}));var B;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(B||(B={}));function re(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new u(t.position),size:new d(t.size)}}async function oe(){return s("plugin:window|available_monitors").then(t=>t.map(re))}function J(){return new T(j(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function V(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new T(new E(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}const A=["tauri://created","tauri://error"];class T{constructor(e,i,n){this.window=e,this.label=i,this.listeners=Object.create(null),n!=null&&n.skip||s("plugin:webview|create_webview",{windowLabel:e.label,label:i,options:n}).then(async()=>this.emit("tauri://created")).catch(async l=>this.emit("tauri://error",l))}static async getByLabel(e){var i;return(i=(await V()).find(n=>n.label===e))!==null&&i!==void 0?i:null}static getCurrent(){return J()}static async getAll(){return V()}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)}:x(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 L(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 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(o.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new u(a.payload.position)}})}),n=await this.listen(o.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new u(a.payload.position)}})}),l=await this.listen(o.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new u(a.payload.position)}})}),r=await this.listen(o.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{i(),l(),n(),r()}}}function q(){const t=J();return new b(t.label,{skip:!0})}async function P(){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!=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 P()).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 P()}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)}:x(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}))}}ue(b,[E,T]);function ue(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 ce=t=>JSON.stringify(t),he=t=>JSON.parse(t),D="drift://action",we="tauri://error",be="tauri://created",de=t=>new Error(`Window not found: ${t}`),p=250,ye=c.g.seconds(1),m=t=>{if(t!=null)return{width:Math.max(t.width,p),height:Math.max(t.height,p)}},pe=t=>{const{size:e,maxSize:i}=t;return{...t,maxSize:m(i),size:m(e)}},ge=async()=>(await oe()).map(e=>{const i=z(e.position,e.scaleFactor),n={width:e.size.width,height:e.size.height};return c.Pt.construct(i,n)}),U=async t=>(await ge()).some(i=>c.Pt.contains(i,t));class _e{constructor(e){W(this,"win");W(this,"unsubscribe");W(this,"fullscreenPoll",null);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)},ye.milliseconds)}label(){return this.win.label}isMain(){return this.win.label===c.MAIN_WINDOW}release(){Object.values(this.unsubscribe).forEach(e=>e==null?void 0:e()),this.fullscreenPoll!=null&&clearInterval(this.fullscreenPoll),this.unsubscribe={}}async emit(e,i,n=this.label()){const l=ce({...e,emitter:n});if(i==null)return await L(D,l);const r=await b.getByLabel(i);if(r==null)throw de(i);await r.emit(D,l)}async subscribe(e){this.release(),await this.startFullscreenPoll(),this.unsubscribe[D]=await f(D,n=>e(he(n.payload)));const i=ve();for(const{key:n,handler:l,debounce:r}of i)this.unsubscribe[n]=await this.win.listen(n,ie.o(()=>{l(this.win).then(a=>{a!=null&&this.emit({action:a},void 0,"WHITELIST").catch(console.error)}).catch(console.error)},r))}onCloseRequested(e){this.win.onCloseRequested(i=>{i.preventDefault(),e()})}async create(e,i){i=c.J.copy(i);const{size:n,minSize:l,maxSize:r,position:a,...$}=pe(i);(n==null?void 0:n.width)!=null&&(n.width=Math.max(n.width,p)),(n==null?void 0:n.height)!=null&&(n.height=Math.max(n.height,p)),(r==null?void 0:r.width)!=null&&(r.width=Math.max(r.width,p)),(r==null?void 0:r.height)!=null&&(r.height=Math.max(r.height,p)),a!=null&&(await U(a)||(a.x=0,a.y=0));try{const g=new b(e,{x:a==null?void 0:a.x,y:a==null?void 0:a.y,width:n==null?void 0:n.width,height:n==null?void 0:n.height,minWidth:l==null?void 0:l.width,minHeight:l==null?void 0:l.height,maxWidth:r==null?void 0:r.width,maxHeight:r==null?void 0:r.height,titleBarStyle:"overlay",dragDropEnabled:!1,...$});return await new Promise((K,Q)=>{g.once(we,Y=>Q(new Error(JSON.stringify(Y.payload)))),g.once(be,()=>K())})}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 P();console.error("Window not found",e,n.map(l=>l.label))}}async listLabels(){return(await P()).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 U(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){var i,n;return o.WINDOW_RESIZED in this.unsubscribe&&!e&&((n=(i=this.unsubscribe)[o.WINDOW_RESIZED])==null||n.call(i),delete this.unsubscribe[o.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:z(await this.win.innerPosition(),e),size:Z(await this.win.innerSize(),e),maximized:await this.win.isMaximized(),visible:i,fullscreen:await this.win.isFullscreen()}}}const ve=()=>[{key:o.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:z(await t.innerPosition(),e),size:Z(await t.innerSize(),e)};return c.runtimeSetWindowProps(n)}},{key:o.WINDOW_MOVED,debounce:200,handler:async t=>{const e=await(t==null?void 0:t.scaleFactor());if(e==null)return null;const i=z(await t.innerPosition(),e),n=await t.isVisible(),l={label:t.label,visible:n,position:i};return c.runtimeSetWindowProps(l)}},{key:o.WINDOW_BLUR,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!1,label:t.label})},{key:o.WINDOW_FOCUS,debounce:0,handler:async t=>c.runtimeSetWindowProps({focus:!0,visible:!0,minimized:!1,label:t.label})}],z=(t,e)=>c.K.scale(t,1/e),Z=(t,e)=>c.A.scale(t,1/e);exports.TauriRuntime=_e;
|
package/dist/tauri.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
var ee = Object.defineProperty;
|
|
2
2
|
var ie = (t, e, i) => e in t ? ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
3
|
var D = (t, e, i) => ie(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import {
|
|
5
|
-
import { r as g, F as re } from "./state-BOplmOQD.js";
|
|
4
|
+
import { H as te, J as ne, r as g, M as se, L as le, A as ae, K as re, P as U } from "./state-C1PObbun.js";
|
|
6
5
|
import { o as oe } from "./debounce-DOZKRZa9.js";
|
|
7
6
|
function ue(t, e, i, n) {
|
|
8
|
-
if (typeof e == "function" ? t !== e || !
|
|
7
|
+
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");
|
|
9
8
|
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
10
9
|
}
|
|
11
10
|
function ce(t, e, i, n, l) {
|
|
@@ -42,7 +41,7 @@ var o;
|
|
|
42
41
|
(function(t) {
|
|
43
42
|
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";
|
|
44
43
|
})(o || (o = {}));
|
|
45
|
-
async function
|
|
44
|
+
async function G(t, e) {
|
|
46
45
|
await s("plugin:event|unlisten", {
|
|
47
46
|
event: t,
|
|
48
47
|
eventId: e
|
|
@@ -55,11 +54,11 @@ async function m(t, e, i) {
|
|
|
55
54
|
event: t,
|
|
56
55
|
target: l,
|
|
57
56
|
handler: he(e)
|
|
58
|
-
}).then((r) => async () =>
|
|
57
|
+
}).then((r) => async () => G(t, r));
|
|
59
58
|
}
|
|
60
59
|
async function k(t, e, i) {
|
|
61
60
|
return m(t, (n) => {
|
|
62
|
-
|
|
61
|
+
G(t, n.id), e(n);
|
|
63
62
|
}, i);
|
|
64
63
|
}
|
|
65
64
|
async function L(t, e) {
|
|
@@ -307,10 +306,10 @@ class v extends we {
|
|
|
307
306
|
function z(t) {
|
|
308
307
|
return t == null ? null : typeof t == "string" ? t : t instanceof v ? t.rid : t;
|
|
309
308
|
}
|
|
310
|
-
var
|
|
309
|
+
var x;
|
|
311
310
|
(function(t) {
|
|
312
311
|
t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
|
|
313
|
-
})(
|
|
312
|
+
})(x || (x = {}));
|
|
314
313
|
class be {
|
|
315
314
|
constructor(e) {
|
|
316
315
|
this._preventDefault = !1, this.event = e.event, this.id = e.id;
|
|
@@ -327,19 +326,19 @@ var T;
|
|
|
327
326
|
t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
|
|
328
327
|
})(T || (T = {}));
|
|
329
328
|
function J() {
|
|
330
|
-
return new
|
|
329
|
+
return new P(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
331
330
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
332
331
|
skip: !0
|
|
333
332
|
});
|
|
334
333
|
}
|
|
335
|
-
async function
|
|
336
|
-
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new
|
|
334
|
+
async function S() {
|
|
335
|
+
return s("plugin:window|get_all_windows").then((t) => t.map((e) => new P(e, {
|
|
337
336
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
338
337
|
skip: !0
|
|
339
338
|
})));
|
|
340
339
|
}
|
|
341
|
-
const
|
|
342
|
-
class
|
|
340
|
+
const A = ["tauri://created", "tauri://error"];
|
|
341
|
+
class P {
|
|
343
342
|
/**
|
|
344
343
|
* Creates a new Window.
|
|
345
344
|
* @example
|
|
@@ -380,7 +379,7 @@ class S {
|
|
|
380
379
|
*/
|
|
381
380
|
static async getByLabel(e) {
|
|
382
381
|
var i;
|
|
383
|
-
return (i = (await
|
|
382
|
+
return (i = (await S()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
|
|
384
383
|
}
|
|
385
384
|
/**
|
|
386
385
|
* Get an instance of `Window` for the current window.
|
|
@@ -392,7 +391,7 @@ class S {
|
|
|
392
391
|
* Gets a list of instances of `Window` for all available windows.
|
|
393
392
|
*/
|
|
394
393
|
static async getAll() {
|
|
395
|
-
return
|
|
394
|
+
return S();
|
|
396
395
|
}
|
|
397
396
|
/**
|
|
398
397
|
* Gets the focused window.
|
|
@@ -405,7 +404,7 @@ class S {
|
|
|
405
404
|
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
406
405
|
*/
|
|
407
406
|
static async getFocusedWindow() {
|
|
408
|
-
for (const e of await
|
|
407
|
+
for (const e of await S())
|
|
409
408
|
if (await e.isFocused())
|
|
410
409
|
return e;
|
|
411
410
|
return null;
|
|
@@ -476,7 +475,7 @@ class S {
|
|
|
476
475
|
* @param payload Event payload.
|
|
477
476
|
*/
|
|
478
477
|
async emit(e, i) {
|
|
479
|
-
if (
|
|
478
|
+
if (A.includes(e)) {
|
|
480
479
|
for (const n of this.listeners[e] || [])
|
|
481
480
|
n({
|
|
482
481
|
event: e,
|
|
@@ -500,7 +499,7 @@ class S {
|
|
|
500
499
|
* @param payload Event payload.
|
|
501
500
|
*/
|
|
502
501
|
async emitTo(e, i, n) {
|
|
503
|
-
if (
|
|
502
|
+
if (A.includes(i)) {
|
|
504
503
|
for (const l of this.listeners[i] || [])
|
|
505
504
|
l({
|
|
506
505
|
event: i,
|
|
@@ -513,7 +512,7 @@ class S {
|
|
|
513
512
|
}
|
|
514
513
|
/** @ignore */
|
|
515
514
|
_handleTauriEvent(e, i) {
|
|
516
|
-
return
|
|
515
|
+
return A.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
|
|
517
516
|
}
|
|
518
517
|
// Getters
|
|
519
518
|
/**
|
|
@@ -842,7 +841,7 @@ class S {
|
|
|
842
841
|
*/
|
|
843
842
|
async requestUserAttention(e) {
|
|
844
843
|
let i = null;
|
|
845
|
-
return e && (e ===
|
|
844
|
+
return e && (e === x.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
|
|
846
845
|
label: this.label,
|
|
847
846
|
value: i
|
|
848
847
|
});
|
|
@@ -1913,7 +1912,7 @@ function Z() {
|
|
|
1913
1912
|
});
|
|
1914
1913
|
}
|
|
1915
1914
|
async function V() {
|
|
1916
|
-
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new C(new
|
|
1915
|
+
return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new C(new P(e.windowLabel, {
|
|
1917
1916
|
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
1918
1917
|
skip: !0
|
|
1919
1918
|
}), e.label, {
|
|
@@ -2481,7 +2480,7 @@ class w {
|
|
|
2481
2480
|
return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
|
|
2482
2481
|
}
|
|
2483
2482
|
}
|
|
2484
|
-
pe(w, [
|
|
2483
|
+
pe(w, [P, C]);
|
|
2485
2484
|
function pe(t, e) {
|
|
2486
2485
|
(Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
2487
2486
|
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
@@ -2506,9 +2505,9 @@ const ge = (t) => JSON.stringify(t), _e = (t) => JSON.parse(t), W = "drift://act
|
|
|
2506
2505
|
return { ...t, maxSize: f(i), size: f(e) };
|
|
2507
2506
|
}, Oe = async () => (await ye()).map((e) => {
|
|
2508
2507
|
const i = I(e.position, e.scaleFactor), n = { width: e.size.width, height: e.size.height };
|
|
2509
|
-
return
|
|
2510
|
-
}),
|
|
2511
|
-
class
|
|
2508
|
+
return U.construct(i, n);
|
|
2509
|
+
}), H = async (t) => (await Oe()).some((i) => U.contains(i, t));
|
|
2510
|
+
class Se {
|
|
2512
2511
|
/**
|
|
2513
2512
|
* @param window - The WebviewWindow to use as the underlying engine for this runtime.
|
|
2514
2513
|
* This should not be set in 99% of cases. Only use this if you know what you're doing.
|
|
@@ -2580,9 +2579,9 @@ class Pe {
|
|
|
2580
2579
|
});
|
|
2581
2580
|
}
|
|
2582
2581
|
async create(e, i) {
|
|
2583
|
-
i =
|
|
2584
|
-
const { size: n, minSize: l, maxSize: r, position: a, ...
|
|
2585
|
-
(n == null ? void 0 : n.width) != null && (n.width = Math.max(n.width, y)), (n == null ? void 0 : n.height) != null && (n.height = Math.max(n.height, y)), (r == null ? void 0 : r.width) != null && (r.width = Math.max(r.width, y)), (r == null ? void 0 : r.height) != null && (r.height = Math.max(r.height, y)), a != null && (await
|
|
2582
|
+
i = le.copy(i);
|
|
2583
|
+
const { size: n, minSize: l, maxSize: r, position: a, ...K } = We(i);
|
|
2584
|
+
(n == null ? void 0 : n.width) != null && (n.width = Math.max(n.width, y)), (n == null ? void 0 : n.height) != null && (n.height = Math.max(n.height, y)), (r == null ? void 0 : r.width) != null && (r.width = Math.max(r.width, y)), (r == null ? void 0 : r.height) != null && (r.height = Math.max(r.height, y)), a != null && (await H(a) || (a.x = 0, a.y = 0));
|
|
2586
2585
|
try {
|
|
2587
2586
|
const p = new w(e, {
|
|
2588
2587
|
x: a == null ? void 0 : a.x,
|
|
@@ -2595,10 +2594,10 @@ class Pe {
|
|
|
2595
2594
|
maxHeight: r == null ? void 0 : r.height,
|
|
2596
2595
|
titleBarStyle: "overlay",
|
|
2597
2596
|
dragDropEnabled: !1,
|
|
2598
|
-
...
|
|
2597
|
+
...K
|
|
2599
2598
|
});
|
|
2600
|
-
return await new Promise((
|
|
2601
|
-
p.once(ve, (X) =>
|
|
2599
|
+
return await new Promise((Q, Y) => {
|
|
2600
|
+
p.once(ve, (X) => Y(new Error(JSON.stringify(X.payload)))), p.once(fe, () => Q());
|
|
2602
2601
|
});
|
|
2603
2602
|
} catch (p) {
|
|
2604
2603
|
console.error(p);
|
|
@@ -2644,7 +2643,7 @@ class Pe {
|
|
|
2644
2643
|
}
|
|
2645
2644
|
async setPosition(e) {
|
|
2646
2645
|
const i = new N(e.x, e.y);
|
|
2647
|
-
await
|
|
2646
|
+
await H(e) || (i.x = 0, i.y = 0), await this.win.setPosition(i);
|
|
2648
2647
|
}
|
|
2649
2648
|
async setSize(e) {
|
|
2650
2649
|
e = f(e), await this.win.setSize(new _(e.width, e.height));
|
|
@@ -2727,7 +2726,7 @@ const ze = () => [
|
|
|
2727
2726
|
label: t.label
|
|
2728
2727
|
})
|
|
2729
2728
|
}
|
|
2730
|
-
], I = (t, e) =>
|
|
2729
|
+
], I = (t, e) => re.scale(t, 1 / e), $ = (t, e) => ae.scale(t, 1 / e);
|
|
2731
2730
|
export {
|
|
2732
|
-
|
|
2731
|
+
Se as TauriRuntime
|
|
2733
2732
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/drift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.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.8.2",
|
|
18
|
+
"@tauri-apps/api": "^2.5.0",
|
|
19
19
|
"async-mutex": "^0.5.0",
|
|
20
20
|
"proxy-memoize": "2.0.3",
|
|
21
21
|
"react": "^19.1.0",
|
|
22
22
|
"react-dom": "^19.1.0",
|
|
23
23
|
"react-redux": "^9.2.0",
|
|
24
|
-
"zod": "^
|
|
25
|
-
"@synnaxlabs/x": "0.
|
|
24
|
+
"zod": "^3.25.63",
|
|
25
|
+
"@synnaxlabs/x": "0.43.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/react": "^19.1.
|
|
29
|
-
"@vitejs/plugin-react": "^4.
|
|
30
|
-
"electron": "^
|
|
31
|
-
"eslint": "^9.
|
|
28
|
+
"@types/react": "^19.1.8",
|
|
29
|
+
"@vitejs/plugin-react": "^4.5.2",
|
|
30
|
+
"electron": "^36.4.0",
|
|
31
|
+
"eslint": "^9.28.0",
|
|
32
32
|
"react": "^19.1.0",
|
|
33
33
|
"react-dom": "^19.1.0",
|
|
34
34
|
"react-redux": "^9.2.0",
|
|
35
35
|
"typescript": "^5.8.3",
|
|
36
|
-
"vite": "^6.
|
|
37
|
-
"vitest": "^3.
|
|
38
|
-
"@synnaxlabs/
|
|
39
|
-
"eslint-config-synnaxlabs": "0.0
|
|
40
|
-
"@synnaxlabs/
|
|
36
|
+
"vite": "^6.3.5",
|
|
37
|
+
"vitest": "^3.2.3",
|
|
38
|
+
"@synnaxlabs/vite-plugin": "0.43.0",
|
|
39
|
+
"eslint-config-synnaxlabs": "0.43.0",
|
|
40
|
+
"@synnaxlabs/tsconfig": "0.0.2"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"dist"
|
|
@@ -65,15 +65,11 @@
|
|
|
65
65
|
"types": "./dist/src/electron/index.d.ts",
|
|
66
66
|
"import": "./dist/electron.js",
|
|
67
67
|
"require": "./dist/electron.cjs"
|
|
68
|
-
},
|
|
69
|
-
"./noop": {
|
|
70
|
-
"types": "./dist/src/noop/index.d.ts",
|
|
71
|
-
"import": "./dist/noop.js",
|
|
72
|
-
"require": "./dist/noop.cjs"
|
|
73
68
|
}
|
|
74
69
|
},
|
|
75
70
|
"scripts": {
|
|
76
71
|
"build": "tsc --noEmit && vite build",
|
|
72
|
+
"check-types": "tsc --noEmit",
|
|
77
73
|
"watch": "tsc --noEmit && vite build --watch",
|
|
78
74
|
"test": "vitest",
|
|
79
75
|
"lint": "eslint --cache",
|
package/dist/noop.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./window-DLsE0-fP.cjs");class s{async configure(){}isMain(){return!0}label(){return e.MAIN_WINDOW}async emit(){}async subscribe(){}onCloseRequested(){}async listLabels(){return[e.MAIN_WINDOW]}async create(){}async close(){}async focus(){}async setMinimized(){}async setMaximized(){}async setVisible(){}async setFullscreen(){}async center(){}async setPosition(){}async setSize(){}async setMinSize(){}async setMaxSize(){}async setResizable(){}async setSkipTaskbar(){}async setAlwaysOnTop(){}async setTitle(){}async setDecorations(){}async getProps(){return{visible:!0,focus:!0,maximized:!1,minimized:!1,fullscreen:!1,position:{x:0,y:0},size:{width:800,height:600}}}}exports.NoopRuntime=s;
|
package/dist/noop.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { M as s } from "./window-BIbHrbtA.js";
|
|
2
|
-
class a {
|
|
3
|
-
async configure() {
|
|
4
|
-
}
|
|
5
|
-
isMain() {
|
|
6
|
-
return !0;
|
|
7
|
-
}
|
|
8
|
-
label() {
|
|
9
|
-
return s;
|
|
10
|
-
}
|
|
11
|
-
async emit() {
|
|
12
|
-
}
|
|
13
|
-
async subscribe() {
|
|
14
|
-
}
|
|
15
|
-
onCloseRequested() {
|
|
16
|
-
}
|
|
17
|
-
async listLabels() {
|
|
18
|
-
return [s];
|
|
19
|
-
}
|
|
20
|
-
async create() {
|
|
21
|
-
}
|
|
22
|
-
async close() {
|
|
23
|
-
}
|
|
24
|
-
async focus() {
|
|
25
|
-
}
|
|
26
|
-
async setMinimized() {
|
|
27
|
-
}
|
|
28
|
-
async setMaximized() {
|
|
29
|
-
}
|
|
30
|
-
async setVisible() {
|
|
31
|
-
}
|
|
32
|
-
async setFullscreen() {
|
|
33
|
-
}
|
|
34
|
-
async center() {
|
|
35
|
-
}
|
|
36
|
-
async setPosition() {
|
|
37
|
-
}
|
|
38
|
-
async setSize() {
|
|
39
|
-
}
|
|
40
|
-
async setMinSize() {
|
|
41
|
-
}
|
|
42
|
-
async setMaxSize() {
|
|
43
|
-
}
|
|
44
|
-
async setResizable() {
|
|
45
|
-
}
|
|
46
|
-
async setSkipTaskbar() {
|
|
47
|
-
}
|
|
48
|
-
async setAlwaysOnTop() {
|
|
49
|
-
}
|
|
50
|
-
async setTitle() {
|
|
51
|
-
}
|
|
52
|
-
async setDecorations() {
|
|
53
|
-
}
|
|
54
|
-
async getProps() {
|
|
55
|
-
return {
|
|
56
|
-
visible: !0,
|
|
57
|
-
focus: !0,
|
|
58
|
-
maximized: !1,
|
|
59
|
-
minimized: !1,
|
|
60
|
-
fullscreen: !1,
|
|
61
|
-
position: { x: 0, y: 0 },
|
|
62
|
-
size: { width: 800, height: 600 }
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export {
|
|
67
|
-
a as NoopRuntime
|
|
68
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("./window-DLsE0-fP.cjs"),s=n=>n.drift,r=n=>Object.values(s(n).windows),c=(n,e)=>{const t=s(n);if(e==null)return t.windows[t.label];let l=t.windows[e];if(l!=null)return l;const o=t.keyLabels[e];return l=t.windows[o],l==null&&e!=null?null:l??t.windows[t.label]},w=(n,e)=>{const t=s(n);if(e==null)return t.labelKeys[t.label];const l=t.labelKeys[e];return l==null&&e==i.MAIN_WINDOW?i.MAIN_WINDOW:l},d=(n,e,t)=>{var l;return((l=c(n,e))==null?void 0:l[t])??null},u=(n,e)=>s(n).keyLabels[e];exports.selectSliceState=s;exports.selectWindow=c;exports.selectWindowAttribute=d;exports.selectWindowKey=w;exports.selectWindowLabel=u;exports.selectWindows=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/noop/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD,qBAAa,WAAW,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,MAAM,GAAG,aAAa,CAC7E,YAAW,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAElB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC,MAAM,IAAI,OAAO;IAIjB,KAAK,IAAI,MAAM;IAIT,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAErB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC,gBAAgB,IAAI,IAAI;IAElB,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAEvB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAE5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAExB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAEzB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;CAWpD"}
|