@band-app/server 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/client/assets/{DockviewTerminalContainer-DX8OFKYR.js → DockviewTerminalContainer-BObwxoXE.js} +2 -2
- package/dist/client/assets/{TerminalPanel-9pW_g2Kd.js → TerminalPanel-B_30SH7w.js} +1 -1
- package/dist/client/assets/{_basePickBy-Dkr8WVHx.js → _basePickBy-DS1DdKpI.js} +1 -1
- package/dist/client/assets/{_baseUniq-B0BP4Sik.js → _baseUniq-CfquXO5o.js} +1 -1
- package/dist/client/assets/{arc-C88WtUPJ.js → arc-BzAFHN3h.js} +1 -1
- package/dist/client/assets/{architectureDiagram-VXUJARFQ-CyLIdwXX.js → architectureDiagram-VXUJARFQ-0gyHmaKw.js} +1 -1
- package/dist/client/assets/{blockDiagram-VD42YOAC-GShygeGY.js → blockDiagram-VD42YOAC-BcU0ZZZI.js} +1 -1
- package/dist/client/assets/{c4Diagram-YG6GDRKO-BcpX0Aqn.js → c4Diagram-YG6GDRKO-Ciwoec2M.js} +1 -1
- package/dist/client/assets/channel-BGuyGJa3.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-IchBHT92.js → chunk-4BX2VUAB-W_tkduvw.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-CiMhFR8e.js → chunk-55IACEB6-DJCn0BUX.js} +1 -1
- package/dist/client/assets/{chunk-B4BG7PRW-D-8aj6uR.js → chunk-B4BG7PRW-OLwhCa5k.js} +1 -1
- package/dist/client/assets/{chunk-DI55MBZ5-C13AzM7U.js → chunk-DI55MBZ5-MFZ5-oPD.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-B4gYDpvB.js → chunk-FMBD7UC4-BDlrNnpZ.js} +1 -1
- package/dist/client/assets/{chunk-QN33PNHL-DG8uaz-H.js → chunk-QN33PNHL-CjwPbo5G.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-CUeAC5bF.js → chunk-QZHKN3VN-3lGRploy.js} +1 -1
- package/dist/client/assets/{chunk-TZMSLE5B-Crx06Grw.js → chunk-TZMSLE5B-Dez84DVY.js} +1 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-Bcoh3oTO.js +1 -0
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-Bcoh3oTO.js +1 -0
- package/dist/client/assets/clone-DTSWxIr_.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-BjyHTZfo.js → cose-bilkent-S5V4N54A-olv_le13.js} +1 -1
- package/dist/client/assets/{dagre-6UL2VRFP-C9LatsFq.js → dagre-6UL2VRFP-DSasPOdo.js} +1 -1
- package/dist/client/assets/{diagram-PSM6KHXK-Bzxy2DxA.js → diagram-PSM6KHXK-ebd2t3Dh.js} +1 -1
- package/dist/client/assets/{diagram-QEK2KX5R--qsdr1em.js → diagram-QEK2KX5R-DETGbCmh.js} +1 -1
- package/dist/client/assets/{diagram-S2PKOQOG-SLCfnLEL.js → diagram-S2PKOQOG-Duif0gCe.js} +1 -1
- package/dist/client/assets/{erDiagram-Q2GNP2WA-Bqfdi51r.js → erDiagram-Q2GNP2WA-7NKTniGi.js} +1 -1
- package/dist/client/assets/{flowDiagram-NV44I4VS-BxNRRaL6.js → flowDiagram-NV44I4VS-B29HpwMu.js} +1 -1
- package/dist/client/assets/{ganttDiagram-JELNMOA3-B3nW9Tee.js → ganttDiagram-JELNMOA3-Do43fY0t.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-V2S2FVAM-CJ5dA5iM.js → gitGraphDiagram-V2S2FVAM-BernJnLk.js} +1 -1
- package/dist/client/assets/{graph-Ce0puKsP.js → graph-Cj575nQq.js} +1 -1
- package/dist/client/assets/{highlighted-body-B3W2YXNL-CENKUGzV.js → highlighted-body-B3W2YXNL-WhJuPudb.js} +1 -1
- package/dist/client/assets/{index-BJDmvnal.js → index-B8ZpCpou.js} +1 -1
- package/dist/client/assets/{index-DL2wTzK1.js → index-BMY-nliE.js} +1 -1
- package/dist/client/assets/{index-CosJojrk.js → index-BTx3LYAO.js} +1 -1
- package/dist/client/assets/{index-SWV7MFMV.js → index-BuCOraAN.js} +1 -1
- package/dist/client/assets/{index-BDCONrW_.js → index-CUcxKuUy.js} +1 -1
- package/dist/client/assets/{index-B3ozbkAt.js → index-CXlGPE4F.js} +1 -1
- package/dist/client/assets/{index-qwbh_ssl.js → index-D4KvM7Nf.js} +1 -1
- package/dist/client/assets/{index-BsMHcPzb.js → index-D9yhhi7d.js} +1 -1
- package/dist/client/assets/{index-C01QsgdU.js → index-DGMdHUd-.js} +1 -1
- package/dist/client/assets/{index-BSd1jAU9.js → index-DNJro5ce.js} +1 -1
- package/dist/client/assets/{index-GxKLyCuq.js → index-DOlTzcT9.js} +1 -1
- package/dist/client/assets/{index-Dd8shGvN.js → index-DeMltHzV.js} +1 -1
- package/dist/client/assets/{index-D3sAIK6P.js → index-Dgv8mF9A.js} +1 -1
- package/dist/client/assets/{index-DfwX9IUV.js → index-DlCjHJGt.js} +1 -1
- package/dist/client/assets/{index-Cdvev7u6.js → index-DziJ_w_s.js} +1 -1
- package/dist/client/assets/{index-DGV19pgb.js → index-dscSHXn-.js} +1 -1
- package/dist/client/assets/{index-jSH-9g1p.js → index-xZP1WFvU.js} +1 -1
- package/dist/client/assets/{index-C_z1eCvW.js → index-yYDoQlcT.js} +1 -1
- package/dist/client/assets/{infoDiagram-HS3SLOUP--q9GXvGW.js → infoDiagram-HS3SLOUP-CwWuIWke.js} +1 -1
- package/dist/client/assets/{journeyDiagram-XKPGCS4Q-C8V3w1dG.js → journeyDiagram-XKPGCS4Q-CwAt4sg1.js} +1 -1
- package/dist/client/assets/{kanban-definition-3W4ZIXB7-BJk0X7tz.js → kanban-definition-3W4ZIXB7-IyDhCRuM.js} +1 -1
- package/dist/client/assets/{layout-ChwcG4Xl.js → layout-Cu0JMbW5.js} +1 -1
- package/dist/client/assets/{linear-BDZmJSE8.js → linear-DZDqd87L.js} +1 -1
- package/dist/client/assets/{main-BJRBUBf7.js → main-Cv7pKZy_.js} +226 -226
- package/dist/client/assets/main-rWzqMN1o.css +1 -0
- package/dist/client/assets/{mindmap-definition-VGOIOE7T-ByMpVnYs.js → mindmap-definition-VGOIOE7T-Dth1CqLW.js} +1 -1
- package/dist/client/assets/{pieDiagram-ADFJNKIX-CD-lmXbd.js → pieDiagram-ADFJNKIX-CF2YDYMu.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-AYHSOK5B-BdOgBPk1.js → quadrantDiagram-AYHSOK5B-nxHcYBhT.js} +1 -1
- package/dist/client/assets/{requirementDiagram-UZGBJVZJ-f7DPR7JO.js → requirementDiagram-UZGBJVZJ-DYuaF4G9.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-TZEHDZUN-bi8QNTNx.js → sankeyDiagram-TZEHDZUN-DCeOMpHq.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-WL72ISMW-DvrFWc3k.js → sequenceDiagram-WL72ISMW-D3ZzpnOf.js} +1 -1
- package/dist/client/assets/{stateDiagram-FKZM4ZOC-pHRodxiR.js → stateDiagram-FKZM4ZOC-CephZuT8.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-B2E3_eDe.js +1 -0
- package/dist/client/assets/{timeline-definition-IT6M3QCI-GvuMpLMJ.js → timeline-definition-IT6M3QCI-CMR_brz2.js} +1 -1
- package/dist/client/assets/{treemap-GDKQZRPO-1Fkk9zI9.js → treemap-GDKQZRPO-Dr2RtG6j.js} +1 -1
- package/dist/client/assets/{useSessionListContext-CRcZVcHa.js → useSessionListContext-Deo93kBU.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId-Cy3AEGLV.js → workspace._workspaceId-B6AmUJBH.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId.changes-Rwu7P9DU.js → workspace._workspaceId.changes-DRRihouM.js} +1 -1
- package/dist/client/assets/workspace._workspaceId.code-ClodXGQ6.js +1 -0
- package/dist/client/assets/{workspace._workspaceId.code._-BJQkX_UC.js → workspace._workspaceId.code._-C2W-zGSx.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId.code.index-BRqZeE-M.js → workspace._workspaceId.code.index-D56jkXpA.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId.index-D_CsfVyR.js → workspace._workspaceId.index-DVYXZuSd.js} +1 -1
- package/dist/client/assets/{workspace._workspaceId.terminal-DfJiaUra.js → workspace._workspaceId.terminal--TZaT08S.js} +2 -2
- package/dist/client/assets/{xychartDiagram-PRI3JC2R-CQ-W21MD.js → xychartDiagram-PRI3JC2R-CQ1vfZE5.js} +1 -1
- package/dist/server/assets/{DockviewTerminalContainer-nurSvNMN.js → DockviewTerminalContainer-B7m50Lcc.js} +2 -2
- package/dist/server/assets/{TerminalPanel-Cf-9H8Lr.js → TerminalPanel-C2nFSkcn.js} +1 -1
- package/dist/server/assets/{_basePickBy-D3FmqT7A.js → _basePickBy-J3VjyO9D.js} +2 -2
- package/dist/server/assets/{_baseUniq-CZLL_KGQ.js → _baseUniq-DlbIVh20.js} +1 -1
- package/dist/server/assets/{_tanstack-start-manifest_v-DcXFd6TS.js → _tanstack-start-manifest_v-C9pSWi1i.js} +1 -1
- package/dist/server/assets/{arc-B-ehAOzx.js → arc-Ds6-Gtmo.js} +1 -1
- package/dist/server/assets/{architecture-7HQA4BMR-Bm2CNNZn.js → architecture-7HQA4BMR-DT3MUSS5.js} +6 -6
- package/dist/server/assets/{architectureDiagram-VXUJARFQ-CxaRzb-g.js → architectureDiagram-VXUJARFQ-ClVOs7P1.js} +6 -6
- package/dist/server/assets/{blockDiagram-VD42YOAC-CsN3W5TR.js → blockDiagram-VD42YOAC-CnVWNic_.js} +6 -6
- package/dist/server/assets/{c4Diagram-YG6GDRKO-C2v52EXK.js → c4Diagram-YG6GDRKO-D9aranD0.js} +2 -2
- package/dist/server/assets/{channel-C3XN_tlw.js → channel-DQjskrHf.js} +1 -1
- package/dist/server/assets/{chunk-4BX2VUAB-BRZhlA3M.js → chunk-4BX2VUAB-BctuYILS.js} +1 -1
- package/dist/server/assets/{chunk-55IACEB6-CvRWSP7_.js → chunk-55IACEB6-CxcgMpfR.js} +1 -1
- package/dist/server/assets/{chunk-B4BG7PRW-CtnW_06V.js → chunk-B4BG7PRW-CfsNsYIg.js} +4 -4
- package/dist/server/assets/{chunk-DI55MBZ5-BQw22O7H.js → chunk-DI55MBZ5-B6n-fRVB.js} +3 -3
- package/dist/server/assets/{chunk-FMBD7UC4-GsUqEYsC.js → chunk-FMBD7UC4-CvBepTeZ.js} +1 -1
- package/dist/server/assets/{chunk-QN33PNHL-Cbg19vtg.js → chunk-QN33PNHL-DS5M3nQE.js} +1 -1
- package/dist/server/assets/{chunk-QZHKN3VN-BWszKJyV.js → chunk-QZHKN3VN-DCLb0fZ1.js} +1 -1
- package/dist/server/assets/{chunk-TZMSLE5B-DQrHctmP.js → chunk-TZMSLE5B-B-Uhio6_.js} +1 -1
- package/dist/server/assets/{classDiagram-v2-WZHVMYZB-CbsNfDCL.js → classDiagram-2ON5EDUG-B7uMu4wG.js} +5 -5
- package/dist/server/assets/{classDiagram-2ON5EDUG-CbsNfDCL.js → classDiagram-v2-WZHVMYZB-B7uMu4wG.js} +5 -5
- package/dist/server/assets/{clone-x7_sin8C.js → clone-B7a1FujU.js} +1 -1
- package/dist/server/assets/{cose-bilkent-S5V4N54A-BOuoNr7N.js → cose-bilkent-S5V4N54A-_7cffNle.js} +1 -1
- package/dist/server/assets/{dagre-6UL2VRFP-BEGPY_P8.js → dagre-6UL2VRFP-Cefu204F.js} +6 -6
- package/dist/server/assets/{diagram-PSM6KHXK-DdLXbkDH.js → diagram-PSM6KHXK-BeMp8Xfu.js} +7 -7
- package/dist/server/assets/{diagram-QEK2KX5R-Ywb8tTSL.js → diagram-QEK2KX5R-UNhxZG5g.js} +6 -6
- package/dist/server/assets/{diagram-S2PKOQOG-Bk6j9I_3.js → diagram-S2PKOQOG-CHWLN67z.js} +6 -6
- package/dist/server/assets/{erDiagram-Q2GNP2WA-CS94DyiJ.js → erDiagram-Q2GNP2WA-9TUXBEEN.js} +4 -4
- package/dist/server/assets/{flowDiagram-NV44I4VS-DGePuZ_D.js → flowDiagram-NV44I4VS-DkHr76XI.js} +5 -5
- package/dist/server/assets/{ganttDiagram-JELNMOA3-nyPfcgRT.js → ganttDiagram-JELNMOA3-D62VSFN-.js} +2 -2
- package/dist/server/assets/{gitGraph-G5XIXVHT-CKTPOKTu.js → gitGraph-G5XIXVHT-wAj_iVxo.js} +6 -6
- package/dist/server/assets/{gitGraphDiagram-V2S2FVAM-BygjesE-.js → gitGraphDiagram-V2S2FVAM-Cq6NrkS2.js} +7 -7
- package/dist/server/assets/{graph-B6TDpsg4.js → graph-BQR4IW-M.js} +2 -2
- package/dist/server/assets/{highlighted-body-B3W2YXNL-CULjZ_nJ.js → highlighted-body-B3W2YXNL-f4qauOuN.js} +1 -1
- package/dist/server/assets/{index-D4VsXH_e.js → index-B07RUisL.js} +2 -2
- package/dist/server/assets/{index-BCMFgTLH.js → index-BgRkMr0S.js} +3 -3
- package/dist/server/assets/{index-CsE88Ld8.js → index-BnaMl2Ta.js} +2 -2
- package/dist/server/assets/{index-DMcpsIUc.js → index-C-_PyKI8.js} +5 -5
- package/dist/server/assets/{index-DCJj-J2w.js → index-C70O-HGl.js} +2 -2
- package/dist/server/assets/{index-0oeRMDH_.js → index-CFtz0N_G.js} +3 -3
- package/dist/server/assets/{index-BRsnuD-O.js → index-CGs_KUt6.js} +2 -2
- package/dist/server/assets/{index-DYGOZ3mj.js → index-CZPx4FSZ.js} +4 -4
- package/dist/server/assets/{index-5SwWQ6oe.js → index-CiQmjF-z.js} +2 -2
- package/dist/server/assets/{index-CnQ4qso3.js → index-ClnAaUnc.js} +1 -1
- package/dist/server/assets/{index-DuWXmjWc.js → index-DGpgWNbR.js} +1 -1
- package/dist/server/assets/{index-Can-bHgo.js → index-DXlyuzHk.js} +2 -2
- package/dist/server/assets/{index-BlnGJ9is.js → index-DZkn94Qw.js} +2 -2
- package/dist/server/assets/{index-eLPxFa7w.js → index-DbtmJMHb.js} +5 -5
- package/dist/server/assets/{index-Bx2Tna2y.js → index-DgI6m9w2.js} +2 -2
- package/dist/server/assets/{index-Bli_q03X.js → index-OT8s82kA.js} +2 -2
- package/dist/server/assets/{index-C1-EaJTv.js → index-Y-3cIxVF.js} +2 -2
- package/dist/server/assets/{index-DJDlsaKi.js → index-oSZ-5UB6.js} +2 -2
- package/dist/server/assets/{info-VBDWY6EO-B-rB5BtI.js → info-VBDWY6EO-DCfkIc0K.js} +6 -6
- package/dist/server/assets/{infoDiagram-HS3SLOUP-D83vTisF.js → infoDiagram-HS3SLOUP-z48Ilxyy.js} +5 -5
- package/dist/server/assets/{journeyDiagram-XKPGCS4Q-PbUYIdib.js → journeyDiagram-XKPGCS4Q-2_BMX1ei.js} +4 -4
- package/dist/server/assets/{kanban-definition-3W4ZIXB7-BQSc_qmP.js → kanban-definition-3W4ZIXB7-YMu0hChh.js} +2 -2
- package/dist/server/assets/{layout-DXYeijc_.js → layout-Cp5xjTuv.js} +4 -4
- package/dist/server/assets/{linear-Dwrm9Gnq.js → linear-CC3vfL_Z.js} +1 -1
- package/dist/server/assets/{mermaid-3ZIDBTTL-BnVYO1pJ.js → mermaid-3ZIDBTTL-nj6kJNsf.js} +1 -1
- package/dist/server/assets/{mermaid-parser.core-CUfP0S_P.js → mermaid-parser.core-CS8wPCwT.js} +11 -11
- package/dist/server/assets/{mindmap-definition-VGOIOE7T-BdjAKwAK.js → mindmap-definition-VGOIOE7T-BbNEUTwc.js} +3 -3
- package/dist/server/assets/{packet-DYOGHKS2-d7SiXxLo.js → packet-DYOGHKS2-C4ObDfPs.js} +6 -6
- package/dist/server/assets/{pie-VRWISCQL-euknErR4.js → pie-VRWISCQL-24cVROwS.js} +6 -6
- package/dist/server/assets/{pieDiagram-ADFJNKIX-Bl150d6W.js → pieDiagram-ADFJNKIX-BDcmTNeb.js} +7 -7
- package/dist/server/assets/{quadrantDiagram-AYHSOK5B-ClIy1n9L.js → quadrantDiagram-AYHSOK5B-DVfUAm25.js} +2 -2
- package/dist/server/assets/{radar-ZZBFDIW7-hsbqqEeW.js → radar-ZZBFDIW7-Xb4_ybap.js} +6 -6
- package/dist/server/assets/{requirementDiagram-UZGBJVZJ-B87j_suL.js → requirementDiagram-UZGBJVZJ-CQfWrrP_.js} +3 -3
- package/dist/server/assets/{router-DMoul9bL.js → router-BnXOl-F9.js} +597 -564
- package/dist/server/assets/{sankeyDiagram-TZEHDZUN-Bq18JLF9.js → sankeyDiagram-TZEHDZUN-BW9xc6Gi.js} +1 -1
- package/dist/server/assets/{sequenceDiagram-WL72ISMW-DziQuu14.js → sequenceDiagram-WL72ISMW-_VMzymo9.js} +3 -3
- package/dist/server/assets/{stateDiagram-FKZM4ZOC-7wEsr4R_.js → stateDiagram-FKZM4ZOC-P9tJlZ70.js} +8 -8
- package/dist/server/assets/{stateDiagram-v2-4FDKWEC3-D2VjwPAa.js → stateDiagram-v2-4FDKWEC3-Cb6P-c6h.js} +4 -4
- package/dist/server/assets/{timeline-definition-IT6M3QCI--uelCCOi.js → timeline-definition-IT6M3QCI-tuTHzmXv.js} +2 -2
- package/dist/server/assets/{treemap-GDKQZRPO-DVHxmTc8.js → treemap-GDKQZRPO-COB3TLcF.js} +6 -6
- package/dist/server/assets/{workspace._workspaceId-Bs8UzdnH.js → workspace._workspaceId-Ca5XltsV.js} +2 -2
- package/dist/server/assets/{workspace._workspaceId.changes-BWu2NrZR.js → workspace._workspaceId.changes-z2xCX4Ct.js} +1 -1
- package/dist/server/assets/{workspace._workspaceId.code._-DKgsvYy3.js → workspace._workspaceId.code._-DQTK_1av.js} +1 -1
- package/dist/server/assets/{workspace._workspaceId.code.index-D9xieBbz.js → workspace._workspaceId.code.index-DTziHng0.js} +1 -1
- package/dist/server/assets/{workspace._workspaceId.index-CM2nPNp3.js → workspace._workspaceId.index-C2U_2sVz.js} +1 -1
- package/dist/server/assets/{workspace._workspaceId.terminal-ByrTEXV_.js → workspace._workspaceId.terminal-i2FfY7JG.js} +2 -2
- package/dist/server/assets/{xychartDiagram-PRI3JC2R-C3ztrSUC.js → xychartDiagram-PRI3JC2R-B8xp3EP5.js} +2 -2
- package/dist/server/server.js +2 -2
- package/dist/start-server.mjs +155 -134
- package/package.json +5 -7
- package/dist/client/assets/channel-COxuXp7F.js +0 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-CtxJr2zo.js +0 -1
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-CtxJr2zo.js +0 -1
- package/dist/client/assets/clone-Cud65zOY.js +0 -1
- package/dist/client/assets/core-mPlcS5K-.js +0 -1
- package/dist/client/assets/event-DRyjiKX_.js +0 -1
- package/dist/client/assets/index-BkW3q3LQ.js +0 -1
- package/dist/client/assets/main-BnrSCdeV.css +0 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-BUgsJX1c.js +0 -1
- package/dist/client/assets/window-BFoF6nYm.js +0 -1
- package/dist/client/assets/workspace._workspaceId.code-zGA3uY7G.js +0 -1
- package/dist/server/assets/core-dG4_vufa.js +0 -45
- package/dist/server/assets/event-2oMkw_LQ.js +0 -63
- package/dist/server/assets/index-jMSXp5h7.js +0 -10
- package/dist/server/assets/window-Qr88gZCE.js +0 -2005
|
@@ -1,2005 +0,0 @@
|
|
|
1
|
-
import { SERIALIZE_TO_IPC_FN, Resource, invoke } from "./core-dG4_vufa.js";
|
|
2
|
-
import { listen, once, emit, emitTo, TauriEvent } from "./event-2oMkw_LQ.js";
|
|
3
|
-
class LogicalSize {
|
|
4
|
-
constructor(...args) {
|
|
5
|
-
this.type = "Logical";
|
|
6
|
-
if (args.length === 1) {
|
|
7
|
-
if ("Logical" in args[0]) {
|
|
8
|
-
this.width = args[0].Logical.width;
|
|
9
|
-
this.height = args[0].Logical.height;
|
|
10
|
-
} else {
|
|
11
|
-
this.width = args[0].width;
|
|
12
|
-
this.height = args[0].height;
|
|
13
|
-
}
|
|
14
|
-
} else {
|
|
15
|
-
this.width = args[0];
|
|
16
|
-
this.height = args[1];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Converts the logical size to a physical one.
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* import { LogicalSize } from '@tauri-apps/api/dpi';
|
|
24
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
25
|
-
*
|
|
26
|
-
* const appWindow = getCurrentWindow();
|
|
27
|
-
* const factor = await appWindow.scaleFactor();
|
|
28
|
-
* const size = new LogicalSize(400, 500);
|
|
29
|
-
* const physical = size.toPhysical(factor);
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @since 2.0.0
|
|
33
|
-
*/
|
|
34
|
-
toPhysical(scaleFactor) {
|
|
35
|
-
return new PhysicalSize(this.width * scaleFactor, this.height * scaleFactor);
|
|
36
|
-
}
|
|
37
|
-
[SERIALIZE_TO_IPC_FN]() {
|
|
38
|
-
return {
|
|
39
|
-
width: this.width,
|
|
40
|
-
height: this.height
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
toJSON() {
|
|
44
|
-
return this[SERIALIZE_TO_IPC_FN]();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
class PhysicalSize {
|
|
48
|
-
constructor(...args) {
|
|
49
|
-
this.type = "Physical";
|
|
50
|
-
if (args.length === 1) {
|
|
51
|
-
if ("Physical" in args[0]) {
|
|
52
|
-
this.width = args[0].Physical.width;
|
|
53
|
-
this.height = args[0].Physical.height;
|
|
54
|
-
} else {
|
|
55
|
-
this.width = args[0].width;
|
|
56
|
-
this.height = args[0].height;
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
this.width = args[0];
|
|
60
|
-
this.height = args[1];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Converts the physical size to a logical one.
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
68
|
-
* const appWindow = getCurrentWindow();
|
|
69
|
-
* const factor = await appWindow.scaleFactor();
|
|
70
|
-
* const size = await appWindow.innerSize(); // PhysicalSize
|
|
71
|
-
* const logical = size.toLogical(factor);
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
toLogical(scaleFactor) {
|
|
75
|
-
return new LogicalSize(this.width / scaleFactor, this.height / scaleFactor);
|
|
76
|
-
}
|
|
77
|
-
[SERIALIZE_TO_IPC_FN]() {
|
|
78
|
-
return {
|
|
79
|
-
width: this.width,
|
|
80
|
-
height: this.height
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
toJSON() {
|
|
84
|
-
return this[SERIALIZE_TO_IPC_FN]();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
class Size {
|
|
88
|
-
constructor(size) {
|
|
89
|
-
this.size = size;
|
|
90
|
-
}
|
|
91
|
-
toLogical(scaleFactor) {
|
|
92
|
-
return this.size instanceof LogicalSize ? this.size : this.size.toLogical(scaleFactor);
|
|
93
|
-
}
|
|
94
|
-
toPhysical(scaleFactor) {
|
|
95
|
-
return this.size instanceof PhysicalSize ? this.size : this.size.toPhysical(scaleFactor);
|
|
96
|
-
}
|
|
97
|
-
[SERIALIZE_TO_IPC_FN]() {
|
|
98
|
-
return {
|
|
99
|
-
[`${this.size.type}`]: {
|
|
100
|
-
width: this.size.width,
|
|
101
|
-
height: this.size.height
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
toJSON() {
|
|
106
|
-
return this[SERIALIZE_TO_IPC_FN]();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
class LogicalPosition {
|
|
110
|
-
constructor(...args) {
|
|
111
|
-
this.type = "Logical";
|
|
112
|
-
if (args.length === 1) {
|
|
113
|
-
if ("Logical" in args[0]) {
|
|
114
|
-
this.x = args[0].Logical.x;
|
|
115
|
-
this.y = args[0].Logical.y;
|
|
116
|
-
} else {
|
|
117
|
-
this.x = args[0].x;
|
|
118
|
-
this.y = args[0].y;
|
|
119
|
-
}
|
|
120
|
-
} else {
|
|
121
|
-
this.x = args[0];
|
|
122
|
-
this.y = args[1];
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Converts the logical position to a physical one.
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* import { LogicalPosition } from '@tauri-apps/api/dpi';
|
|
130
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
131
|
-
*
|
|
132
|
-
* const appWindow = getCurrentWindow();
|
|
133
|
-
* const factor = await appWindow.scaleFactor();
|
|
134
|
-
* const position = new LogicalPosition(400, 500);
|
|
135
|
-
* const physical = position.toPhysical(factor);
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* @since 2.0.0
|
|
139
|
-
*/
|
|
140
|
-
toPhysical(scaleFactor) {
|
|
141
|
-
return new PhysicalPosition(this.x * scaleFactor, this.y * scaleFactor);
|
|
142
|
-
}
|
|
143
|
-
[SERIALIZE_TO_IPC_FN]() {
|
|
144
|
-
return {
|
|
145
|
-
x: this.x,
|
|
146
|
-
y: this.y
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
toJSON() {
|
|
150
|
-
return this[SERIALIZE_TO_IPC_FN]();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
class PhysicalPosition {
|
|
154
|
-
constructor(...args) {
|
|
155
|
-
this.type = "Physical";
|
|
156
|
-
if (args.length === 1) {
|
|
157
|
-
if ("Physical" in args[0]) {
|
|
158
|
-
this.x = args[0].Physical.x;
|
|
159
|
-
this.y = args[0].Physical.y;
|
|
160
|
-
} else {
|
|
161
|
-
this.x = args[0].x;
|
|
162
|
-
this.y = args[0].y;
|
|
163
|
-
}
|
|
164
|
-
} else {
|
|
165
|
-
this.x = args[0];
|
|
166
|
-
this.y = args[1];
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Converts the physical position to a logical one.
|
|
171
|
-
* @example
|
|
172
|
-
* ```typescript
|
|
173
|
-
* import { PhysicalPosition } from '@tauri-apps/api/dpi';
|
|
174
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
175
|
-
*
|
|
176
|
-
* const appWindow = getCurrentWindow();
|
|
177
|
-
* const factor = await appWindow.scaleFactor();
|
|
178
|
-
* const position = new PhysicalPosition(400, 500);
|
|
179
|
-
* const physical = position.toLogical(factor);
|
|
180
|
-
* ```
|
|
181
|
-
*
|
|
182
|
-
* @since 2.0.0
|
|
183
|
-
*/
|
|
184
|
-
toLogical(scaleFactor) {
|
|
185
|
-
return new LogicalPosition(this.x / scaleFactor, this.y / scaleFactor);
|
|
186
|
-
}
|
|
187
|
-
[SERIALIZE_TO_IPC_FN]() {
|
|
188
|
-
return {
|
|
189
|
-
x: this.x,
|
|
190
|
-
y: this.y
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
toJSON() {
|
|
194
|
-
return this[SERIALIZE_TO_IPC_FN]();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
class Position {
|
|
198
|
-
constructor(position) {
|
|
199
|
-
this.position = position;
|
|
200
|
-
}
|
|
201
|
-
toLogical(scaleFactor) {
|
|
202
|
-
return this.position instanceof LogicalPosition ? this.position : this.position.toLogical(scaleFactor);
|
|
203
|
-
}
|
|
204
|
-
toPhysical(scaleFactor) {
|
|
205
|
-
return this.position instanceof PhysicalPosition ? this.position : this.position.toPhysical(scaleFactor);
|
|
206
|
-
}
|
|
207
|
-
[SERIALIZE_TO_IPC_FN]() {
|
|
208
|
-
return {
|
|
209
|
-
[`${this.position.type}`]: {
|
|
210
|
-
x: this.position.x,
|
|
211
|
-
y: this.position.y
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
toJSON() {
|
|
216
|
-
return this[SERIALIZE_TO_IPC_FN]();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
class Image extends Resource {
|
|
220
|
-
/**
|
|
221
|
-
* Creates an Image from a resource ID. For internal use only.
|
|
222
|
-
*
|
|
223
|
-
* @ignore
|
|
224
|
-
*/
|
|
225
|
-
constructor(rid) {
|
|
226
|
-
super(rid);
|
|
227
|
-
}
|
|
228
|
-
/** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
|
|
229
|
-
static async new(rgba, width, height) {
|
|
230
|
-
return invoke("plugin:image|new", {
|
|
231
|
-
rgba: transformImage(rgba),
|
|
232
|
-
width,
|
|
233
|
-
height
|
|
234
|
-
}).then((rid) => new Image(rid));
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Creates a new image using the provided bytes by inferring the file format.
|
|
238
|
-
* If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes].
|
|
239
|
-
*
|
|
240
|
-
* Only `ico` and `png` are supported (based on activated feature flag).
|
|
241
|
-
*
|
|
242
|
-
* Note that you need the `image-ico` or `image-png` Cargo features to use this API.
|
|
243
|
-
* To enable it, change your Cargo.toml file:
|
|
244
|
-
* ```toml
|
|
245
|
-
* [dependencies]
|
|
246
|
-
* tauri = { version = "...", features = ["...", "image-png"] }
|
|
247
|
-
* ```
|
|
248
|
-
*/
|
|
249
|
-
static async fromBytes(bytes) {
|
|
250
|
-
return invoke("plugin:image|from_bytes", {
|
|
251
|
-
bytes: transformImage(bytes)
|
|
252
|
-
}).then((rid) => new Image(rid));
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Creates a new image using the provided path.
|
|
256
|
-
*
|
|
257
|
-
* Only `ico` and `png` are supported (based on activated feature flag).
|
|
258
|
-
*
|
|
259
|
-
* Note that you need the `image-ico` or `image-png` Cargo features to use this API.
|
|
260
|
-
* To enable it, change your Cargo.toml file:
|
|
261
|
-
* ```toml
|
|
262
|
-
* [dependencies]
|
|
263
|
-
* tauri = { version = "...", features = ["...", "image-png"] }
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
static async fromPath(path) {
|
|
267
|
-
return invoke("plugin:image|from_path", { path }).then((rid) => new Image(rid));
|
|
268
|
-
}
|
|
269
|
-
/** Returns the RGBA data for this image, in row-major order from top to bottom. */
|
|
270
|
-
async rgba() {
|
|
271
|
-
return invoke("plugin:image|rgba", {
|
|
272
|
-
rid: this.rid
|
|
273
|
-
}).then((buffer) => new Uint8Array(buffer));
|
|
274
|
-
}
|
|
275
|
-
/** Returns the size of this image. */
|
|
276
|
-
async size() {
|
|
277
|
-
return invoke("plugin:image|size", { rid: this.rid });
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
function transformImage(image) {
|
|
281
|
-
const ret = image == null ? null : typeof image === "string" ? image : image instanceof Image ? image.rid : image;
|
|
282
|
-
return ret;
|
|
283
|
-
}
|
|
284
|
-
var UserAttentionType;
|
|
285
|
-
(function(UserAttentionType2) {
|
|
286
|
-
UserAttentionType2[UserAttentionType2["Critical"] = 1] = "Critical";
|
|
287
|
-
UserAttentionType2[UserAttentionType2["Informational"] = 2] = "Informational";
|
|
288
|
-
})(UserAttentionType || (UserAttentionType = {}));
|
|
289
|
-
class CloseRequestedEvent {
|
|
290
|
-
constructor(event) {
|
|
291
|
-
this._preventDefault = false;
|
|
292
|
-
this.event = event.event;
|
|
293
|
-
this.id = event.id;
|
|
294
|
-
}
|
|
295
|
-
preventDefault() {
|
|
296
|
-
this._preventDefault = true;
|
|
297
|
-
}
|
|
298
|
-
isPreventDefault() {
|
|
299
|
-
return this._preventDefault;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
var ProgressBarStatus;
|
|
303
|
-
(function(ProgressBarStatus2) {
|
|
304
|
-
ProgressBarStatus2["None"] = "none";
|
|
305
|
-
ProgressBarStatus2["Normal"] = "normal";
|
|
306
|
-
ProgressBarStatus2["Indeterminate"] = "indeterminate";
|
|
307
|
-
ProgressBarStatus2["Paused"] = "paused";
|
|
308
|
-
ProgressBarStatus2["Error"] = "error";
|
|
309
|
-
})(ProgressBarStatus || (ProgressBarStatus = {}));
|
|
310
|
-
function getCurrentWindow() {
|
|
311
|
-
return new Window(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
|
|
312
|
-
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
313
|
-
skip: true
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
async function getAllWindows() {
|
|
317
|
-
return invoke("plugin:window|get_all_windows").then((windows) => windows.map((w) => new Window(w, {
|
|
318
|
-
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
|
|
319
|
-
skip: true
|
|
320
|
-
})));
|
|
321
|
-
}
|
|
322
|
-
const localTauriEvents = ["tauri://created", "tauri://error"];
|
|
323
|
-
class Window {
|
|
324
|
-
/**
|
|
325
|
-
* Creates a new Window.
|
|
326
|
-
* @example
|
|
327
|
-
* ```typescript
|
|
328
|
-
* import { Window } from '@tauri-apps/api/window';
|
|
329
|
-
* const appWindow = new Window('my-label');
|
|
330
|
-
* appWindow.once('tauri://created', function () {
|
|
331
|
-
* // window successfully created
|
|
332
|
-
* });
|
|
333
|
-
* appWindow.once('tauri://error', function (e) {
|
|
334
|
-
* // an error happened creating the window
|
|
335
|
-
* });
|
|
336
|
-
* ```
|
|
337
|
-
*
|
|
338
|
-
* @param label The unique window label. Must be alphanumeric: `a-zA-Z-/:_`.
|
|
339
|
-
* @returns The {@link Window} instance to communicate with the window.
|
|
340
|
-
*/
|
|
341
|
-
constructor(label, options = {}) {
|
|
342
|
-
var _a;
|
|
343
|
-
this.label = label;
|
|
344
|
-
this.listeners = /* @__PURE__ */ Object.create(null);
|
|
345
|
-
if (!(options === null || options === void 0 ? void 0 : options.skip)) {
|
|
346
|
-
invoke("plugin:window|create", {
|
|
347
|
-
options: {
|
|
348
|
-
...options,
|
|
349
|
-
parent: typeof options.parent === "string" ? options.parent : (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label,
|
|
350
|
-
label
|
|
351
|
-
}
|
|
352
|
-
}).then(async () => this.emit("tauri://created")).catch(async (e) => this.emit("tauri://error", e));
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Gets the Window associated with the given label.
|
|
357
|
-
* @example
|
|
358
|
-
* ```typescript
|
|
359
|
-
* import { Window } from '@tauri-apps/api/window';
|
|
360
|
-
* const mainWindow = Window.getByLabel('main');
|
|
361
|
-
* ```
|
|
362
|
-
*
|
|
363
|
-
* @param label The window label.
|
|
364
|
-
* @returns The Window instance to communicate with the window or null if the window doesn't exist.
|
|
365
|
-
*/
|
|
366
|
-
static async getByLabel(label) {
|
|
367
|
-
var _a;
|
|
368
|
-
return (_a = (await getAllWindows()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Get an instance of `Window` for the current window.
|
|
372
|
-
*/
|
|
373
|
-
static getCurrent() {
|
|
374
|
-
return getCurrentWindow();
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Gets a list of instances of `Window` for all available windows.
|
|
378
|
-
*/
|
|
379
|
-
static async getAll() {
|
|
380
|
-
return getAllWindows();
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Gets the focused window.
|
|
384
|
-
* @example
|
|
385
|
-
* ```typescript
|
|
386
|
-
* import { Window } from '@tauri-apps/api/window';
|
|
387
|
-
* const focusedWindow = Window.getFocusedWindow();
|
|
388
|
-
* ```
|
|
389
|
-
*
|
|
390
|
-
* @returns The Window instance or `undefined` if there is not any focused window.
|
|
391
|
-
*/
|
|
392
|
-
static async getFocusedWindow() {
|
|
393
|
-
for (const w of await getAllWindows()) {
|
|
394
|
-
if (await w.isFocused()) {
|
|
395
|
-
return w;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
return null;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Listen to an emitted event on this window.
|
|
402
|
-
*
|
|
403
|
-
* @example
|
|
404
|
-
* ```typescript
|
|
405
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
406
|
-
* const unlisten = await getCurrentWindow().listen<string>('state-changed', (event) => {
|
|
407
|
-
* console.log(`Got error: ${payload}`);
|
|
408
|
-
* });
|
|
409
|
-
*
|
|
410
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
411
|
-
* unlisten();
|
|
412
|
-
* ```
|
|
413
|
-
*
|
|
414
|
-
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
|
415
|
-
* @param handler Event handler.
|
|
416
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
417
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
418
|
-
*/
|
|
419
|
-
async listen(event, handler) {
|
|
420
|
-
if (this._handleTauriEvent(event, handler)) {
|
|
421
|
-
return () => {
|
|
422
|
-
const listeners = this.listeners[event];
|
|
423
|
-
listeners.splice(listeners.indexOf(handler), 1);
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
return listen(event, handler, {
|
|
427
|
-
target: { kind: "Window", label: this.label }
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Listen to an emitted event on this window only once.
|
|
432
|
-
*
|
|
433
|
-
* @example
|
|
434
|
-
* ```typescript
|
|
435
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
436
|
-
* const unlisten = await getCurrentWindow().once<null>('initialized', (event) => {
|
|
437
|
-
* console.log(`Window initialized!`);
|
|
438
|
-
* });
|
|
439
|
-
*
|
|
440
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
441
|
-
* unlisten();
|
|
442
|
-
* ```
|
|
443
|
-
*
|
|
444
|
-
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
|
445
|
-
* @param handler Event handler.
|
|
446
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
447
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
448
|
-
*/
|
|
449
|
-
async once(event, handler) {
|
|
450
|
-
if (this._handleTauriEvent(event, handler)) {
|
|
451
|
-
return () => {
|
|
452
|
-
const listeners = this.listeners[event];
|
|
453
|
-
listeners.splice(listeners.indexOf(handler), 1);
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
return once(event, handler, {
|
|
457
|
-
target: { kind: "Window", label: this.label }
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Emits an event to all {@link EventTarget|targets}.
|
|
462
|
-
* @example
|
|
463
|
-
* ```typescript
|
|
464
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
465
|
-
* await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' });
|
|
466
|
-
* ```
|
|
467
|
-
*
|
|
468
|
-
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
|
469
|
-
* @param payload Event payload.
|
|
470
|
-
*/
|
|
471
|
-
async emit(event, payload) {
|
|
472
|
-
if (localTauriEvents.includes(event)) {
|
|
473
|
-
for (const handler of this.listeners[event] || []) {
|
|
474
|
-
handler({
|
|
475
|
-
event,
|
|
476
|
-
id: -1,
|
|
477
|
-
payload
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
return emit(event, payload);
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Emits an event to all {@link EventTarget|targets} matching the given target.
|
|
486
|
-
*
|
|
487
|
-
* @example
|
|
488
|
-
* ```typescript
|
|
489
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
490
|
-
* await getCurrentWindow().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' });
|
|
491
|
-
* ```
|
|
492
|
-
* @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object.
|
|
493
|
-
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
|
494
|
-
* @param payload Event payload.
|
|
495
|
-
*/
|
|
496
|
-
async emitTo(target, event, payload) {
|
|
497
|
-
if (localTauriEvents.includes(event)) {
|
|
498
|
-
for (const handler of this.listeners[event] || []) {
|
|
499
|
-
handler({
|
|
500
|
-
event,
|
|
501
|
-
id: -1,
|
|
502
|
-
payload
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
return emitTo(target, event, payload);
|
|
508
|
-
}
|
|
509
|
-
/** @ignore */
|
|
510
|
-
_handleTauriEvent(event, handler) {
|
|
511
|
-
if (localTauriEvents.includes(event)) {
|
|
512
|
-
if (!(event in this.listeners)) {
|
|
513
|
-
this.listeners[event] = [handler];
|
|
514
|
-
} else {
|
|
515
|
-
this.listeners[event].push(handler);
|
|
516
|
-
}
|
|
517
|
-
return true;
|
|
518
|
-
}
|
|
519
|
-
return false;
|
|
520
|
-
}
|
|
521
|
-
// Getters
|
|
522
|
-
/**
|
|
523
|
-
* The scale factor that can be used to map physical pixels to logical pixels.
|
|
524
|
-
* @example
|
|
525
|
-
* ```typescript
|
|
526
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
527
|
-
* const factor = await getCurrentWindow().scaleFactor();
|
|
528
|
-
* ```
|
|
529
|
-
*
|
|
530
|
-
* @returns The window's monitor scale factor.
|
|
531
|
-
*/
|
|
532
|
-
async scaleFactor() {
|
|
533
|
-
return invoke("plugin:window|scale_factor", {
|
|
534
|
-
label: this.label
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop.
|
|
539
|
-
* @example
|
|
540
|
-
* ```typescript
|
|
541
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
542
|
-
* const position = await getCurrentWindow().innerPosition();
|
|
543
|
-
* ```
|
|
544
|
-
*
|
|
545
|
-
* @returns The window's inner position.
|
|
546
|
-
*/
|
|
547
|
-
async innerPosition() {
|
|
548
|
-
return invoke("plugin:window|inner_position", {
|
|
549
|
-
label: this.label
|
|
550
|
-
}).then((p) => new PhysicalPosition(p));
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
|
|
554
|
-
* @example
|
|
555
|
-
* ```typescript
|
|
556
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
557
|
-
* const position = await getCurrentWindow().outerPosition();
|
|
558
|
-
* ```
|
|
559
|
-
*
|
|
560
|
-
* @returns The window's outer position.
|
|
561
|
-
*/
|
|
562
|
-
async outerPosition() {
|
|
563
|
-
return invoke("plugin:window|outer_position", {
|
|
564
|
-
label: this.label
|
|
565
|
-
}).then((p) => new PhysicalPosition(p));
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* The physical size of the window's client area.
|
|
569
|
-
* The client area is the content of the window, excluding the title bar and borders.
|
|
570
|
-
* @example
|
|
571
|
-
* ```typescript
|
|
572
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
573
|
-
* const size = await getCurrentWindow().innerSize();
|
|
574
|
-
* ```
|
|
575
|
-
*
|
|
576
|
-
* @returns The window's inner size.
|
|
577
|
-
*/
|
|
578
|
-
async innerSize() {
|
|
579
|
-
return invoke("plugin:window|inner_size", {
|
|
580
|
-
label: this.label
|
|
581
|
-
}).then((s) => new PhysicalSize(s));
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* The physical size of the entire window.
|
|
585
|
-
* These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead.
|
|
586
|
-
* @example
|
|
587
|
-
* ```typescript
|
|
588
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
589
|
-
* const size = await getCurrentWindow().outerSize();
|
|
590
|
-
* ```
|
|
591
|
-
*
|
|
592
|
-
* @returns The window's outer size.
|
|
593
|
-
*/
|
|
594
|
-
async outerSize() {
|
|
595
|
-
return invoke("plugin:window|outer_size", {
|
|
596
|
-
label: this.label
|
|
597
|
-
}).then((s) => new PhysicalSize(s));
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* Gets the window's current fullscreen state.
|
|
601
|
-
* @example
|
|
602
|
-
* ```typescript
|
|
603
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
604
|
-
* const fullscreen = await getCurrentWindow().isFullscreen();
|
|
605
|
-
* ```
|
|
606
|
-
*
|
|
607
|
-
* @returns Whether the window is in fullscreen mode or not.
|
|
608
|
-
*/
|
|
609
|
-
async isFullscreen() {
|
|
610
|
-
return invoke("plugin:window|is_fullscreen", {
|
|
611
|
-
label: this.label
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* Gets the window's current minimized state.
|
|
616
|
-
* @example
|
|
617
|
-
* ```typescript
|
|
618
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
619
|
-
* const minimized = await getCurrentWindow().isMinimized();
|
|
620
|
-
* ```
|
|
621
|
-
*/
|
|
622
|
-
async isMinimized() {
|
|
623
|
-
return invoke("plugin:window|is_minimized", {
|
|
624
|
-
label: this.label
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Gets the window's current maximized state.
|
|
629
|
-
* @example
|
|
630
|
-
* ```typescript
|
|
631
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
632
|
-
* const maximized = await getCurrentWindow().isMaximized();
|
|
633
|
-
* ```
|
|
634
|
-
*
|
|
635
|
-
* @returns Whether the window is maximized or not.
|
|
636
|
-
*/
|
|
637
|
-
async isMaximized() {
|
|
638
|
-
return invoke("plugin:window|is_maximized", {
|
|
639
|
-
label: this.label
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Gets the window's current focus state.
|
|
644
|
-
* @example
|
|
645
|
-
* ```typescript
|
|
646
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
647
|
-
* const focused = await getCurrentWindow().isFocused();
|
|
648
|
-
* ```
|
|
649
|
-
*
|
|
650
|
-
* @returns Whether the window is focused or not.
|
|
651
|
-
*/
|
|
652
|
-
async isFocused() {
|
|
653
|
-
return invoke("plugin:window|is_focused", {
|
|
654
|
-
label: this.label
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* Gets the window's current decorated state.
|
|
659
|
-
* @example
|
|
660
|
-
* ```typescript
|
|
661
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
662
|
-
* const decorated = await getCurrentWindow().isDecorated();
|
|
663
|
-
* ```
|
|
664
|
-
*
|
|
665
|
-
* @returns Whether the window is decorated or not.
|
|
666
|
-
*/
|
|
667
|
-
async isDecorated() {
|
|
668
|
-
return invoke("plugin:window|is_decorated", {
|
|
669
|
-
label: this.label
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* Gets the window's current resizable state.
|
|
674
|
-
* @example
|
|
675
|
-
* ```typescript
|
|
676
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
677
|
-
* const resizable = await getCurrentWindow().isResizable();
|
|
678
|
-
* ```
|
|
679
|
-
*
|
|
680
|
-
* @returns Whether the window is resizable or not.
|
|
681
|
-
*/
|
|
682
|
-
async isResizable() {
|
|
683
|
-
return invoke("plugin:window|is_resizable", {
|
|
684
|
-
label: this.label
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Gets the window's native maximize button state.
|
|
689
|
-
*
|
|
690
|
-
* #### Platform-specific
|
|
691
|
-
*
|
|
692
|
-
* - **Linux / iOS / Android:** Unsupported.
|
|
693
|
-
*
|
|
694
|
-
* @example
|
|
695
|
-
* ```typescript
|
|
696
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
697
|
-
* const maximizable = await getCurrentWindow().isMaximizable();
|
|
698
|
-
* ```
|
|
699
|
-
*
|
|
700
|
-
* @returns Whether the window's native maximize button is enabled or not.
|
|
701
|
-
*/
|
|
702
|
-
async isMaximizable() {
|
|
703
|
-
return invoke("plugin:window|is_maximizable", {
|
|
704
|
-
label: this.label
|
|
705
|
-
});
|
|
706
|
-
}
|
|
707
|
-
/**
|
|
708
|
-
* Gets the window's native minimize button state.
|
|
709
|
-
*
|
|
710
|
-
* #### Platform-specific
|
|
711
|
-
*
|
|
712
|
-
* - **Linux / iOS / Android:** Unsupported.
|
|
713
|
-
*
|
|
714
|
-
* @example
|
|
715
|
-
* ```typescript
|
|
716
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
717
|
-
* const minimizable = await getCurrentWindow().isMinimizable();
|
|
718
|
-
* ```
|
|
719
|
-
*
|
|
720
|
-
* @returns Whether the window's native minimize button is enabled or not.
|
|
721
|
-
*/
|
|
722
|
-
async isMinimizable() {
|
|
723
|
-
return invoke("plugin:window|is_minimizable", {
|
|
724
|
-
label: this.label
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
/**
|
|
728
|
-
* Gets the window's native close button state.
|
|
729
|
-
*
|
|
730
|
-
* #### Platform-specific
|
|
731
|
-
*
|
|
732
|
-
* - **iOS / Android:** Unsupported.
|
|
733
|
-
*
|
|
734
|
-
* @example
|
|
735
|
-
* ```typescript
|
|
736
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
737
|
-
* const closable = await getCurrentWindow().isClosable();
|
|
738
|
-
* ```
|
|
739
|
-
*
|
|
740
|
-
* @returns Whether the window's native close button is enabled or not.
|
|
741
|
-
*/
|
|
742
|
-
async isClosable() {
|
|
743
|
-
return invoke("plugin:window|is_closable", {
|
|
744
|
-
label: this.label
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
/**
|
|
748
|
-
* Gets the window's current visible state.
|
|
749
|
-
* @example
|
|
750
|
-
* ```typescript
|
|
751
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
752
|
-
* const visible = await getCurrentWindow().isVisible();
|
|
753
|
-
* ```
|
|
754
|
-
*
|
|
755
|
-
* @returns Whether the window is visible or not.
|
|
756
|
-
*/
|
|
757
|
-
async isVisible() {
|
|
758
|
-
return invoke("plugin:window|is_visible", {
|
|
759
|
-
label: this.label
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Gets the window's current title.
|
|
764
|
-
* @example
|
|
765
|
-
* ```typescript
|
|
766
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
767
|
-
* const title = await getCurrentWindow().title();
|
|
768
|
-
* ```
|
|
769
|
-
*/
|
|
770
|
-
async title() {
|
|
771
|
-
return invoke("plugin:window|title", {
|
|
772
|
-
label: this.label
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
/**
|
|
776
|
-
* Gets the window's current theme.
|
|
777
|
-
*
|
|
778
|
-
* #### Platform-specific
|
|
779
|
-
*
|
|
780
|
-
* - **macOS:** Theme was introduced on macOS 10.14. Returns `light` on macOS 10.13 and below.
|
|
781
|
-
*
|
|
782
|
-
* @example
|
|
783
|
-
* ```typescript
|
|
784
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
785
|
-
* const theme = await getCurrentWindow().theme();
|
|
786
|
-
* ```
|
|
787
|
-
*
|
|
788
|
-
* @returns The window theme.
|
|
789
|
-
*/
|
|
790
|
-
async theme() {
|
|
791
|
-
return invoke("plugin:window|theme", {
|
|
792
|
-
label: this.label
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
/**
|
|
796
|
-
* Whether the window is configured to be always on top of other windows or not.
|
|
797
|
-
* @example
|
|
798
|
-
* ```typescript
|
|
799
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
800
|
-
* const alwaysOnTop = await getCurrentWindow().isAlwaysOnTop();
|
|
801
|
-
* ```
|
|
802
|
-
*
|
|
803
|
-
* @returns Whether the window is visible or not.
|
|
804
|
-
*/
|
|
805
|
-
async isAlwaysOnTop() {
|
|
806
|
-
return invoke("plugin:window|is_always_on_top", {
|
|
807
|
-
label: this.label
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
// Setters
|
|
811
|
-
/**
|
|
812
|
-
* Centers the window.
|
|
813
|
-
* @example
|
|
814
|
-
* ```typescript
|
|
815
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
816
|
-
* await getCurrentWindow().center();
|
|
817
|
-
* ```
|
|
818
|
-
*
|
|
819
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
820
|
-
*/
|
|
821
|
-
async center() {
|
|
822
|
-
return invoke("plugin:window|center", {
|
|
823
|
-
label: this.label
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Requests user attention to the window, this has no effect if the application
|
|
828
|
-
* is already focused. How requesting for user attention manifests is platform dependent,
|
|
829
|
-
* see `UserAttentionType` for details.
|
|
830
|
-
*
|
|
831
|
-
* Providing `null` will unset the request for user attention. Unsetting the request for
|
|
832
|
-
* user attention might not be done automatically by the WM when the window receives input.
|
|
833
|
-
*
|
|
834
|
-
* #### Platform-specific
|
|
835
|
-
*
|
|
836
|
-
* - **macOS:** `null` has no effect.
|
|
837
|
-
* - **Linux:** Urgency levels have the same effect.
|
|
838
|
-
* @example
|
|
839
|
-
* ```typescript
|
|
840
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
841
|
-
* await getCurrentWindow().requestUserAttention();
|
|
842
|
-
* ```
|
|
843
|
-
*
|
|
844
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
845
|
-
*/
|
|
846
|
-
async requestUserAttention(requestType) {
|
|
847
|
-
let requestType_ = null;
|
|
848
|
-
if (requestType) {
|
|
849
|
-
if (requestType === UserAttentionType.Critical) {
|
|
850
|
-
requestType_ = { type: "Critical" };
|
|
851
|
-
} else {
|
|
852
|
-
requestType_ = { type: "Informational" };
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
return invoke("plugin:window|request_user_attention", {
|
|
856
|
-
label: this.label,
|
|
857
|
-
value: requestType_
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
/**
|
|
861
|
-
* Updates the window resizable flag.
|
|
862
|
-
* @example
|
|
863
|
-
* ```typescript
|
|
864
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
865
|
-
* await getCurrentWindow().setResizable(false);
|
|
866
|
-
* ```
|
|
867
|
-
*
|
|
868
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
869
|
-
*/
|
|
870
|
-
async setResizable(resizable) {
|
|
871
|
-
return invoke("plugin:window|set_resizable", {
|
|
872
|
-
label: this.label,
|
|
873
|
-
value: resizable
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Enable or disable the window.
|
|
878
|
-
* @example
|
|
879
|
-
* ```typescript
|
|
880
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
881
|
-
* await getCurrentWindow().setEnabled(false);
|
|
882
|
-
* ```
|
|
883
|
-
*
|
|
884
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
885
|
-
*
|
|
886
|
-
* @since 2.0.0
|
|
887
|
-
*/
|
|
888
|
-
async setEnabled(enabled) {
|
|
889
|
-
return invoke("plugin:window|set_enabled", {
|
|
890
|
-
label: this.label,
|
|
891
|
-
value: enabled
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
/**
|
|
895
|
-
* Whether the window is enabled or disabled.
|
|
896
|
-
* @example
|
|
897
|
-
* ```typescript
|
|
898
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
899
|
-
* await getCurrentWindow().setEnabled(false);
|
|
900
|
-
* ```
|
|
901
|
-
*
|
|
902
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
903
|
-
*
|
|
904
|
-
* @since 2.0.0
|
|
905
|
-
*/
|
|
906
|
-
async isEnabled() {
|
|
907
|
-
return invoke("plugin:window|is_enabled", {
|
|
908
|
-
label: this.label
|
|
909
|
-
});
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* Sets whether the window's native maximize button is enabled or not.
|
|
913
|
-
* If resizable is set to false, this setting is ignored.
|
|
914
|
-
*
|
|
915
|
-
* #### Platform-specific
|
|
916
|
-
*
|
|
917
|
-
* - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode.
|
|
918
|
-
* - **Linux / iOS / Android:** Unsupported.
|
|
919
|
-
*
|
|
920
|
-
* @example
|
|
921
|
-
* ```typescript
|
|
922
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
923
|
-
* await getCurrentWindow().setMaximizable(false);
|
|
924
|
-
* ```
|
|
925
|
-
*
|
|
926
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
927
|
-
*/
|
|
928
|
-
async setMaximizable(maximizable) {
|
|
929
|
-
return invoke("plugin:window|set_maximizable", {
|
|
930
|
-
label: this.label,
|
|
931
|
-
value: maximizable
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
/**
|
|
935
|
-
* Sets whether the window's native minimize button is enabled or not.
|
|
936
|
-
*
|
|
937
|
-
* #### Platform-specific
|
|
938
|
-
*
|
|
939
|
-
* - **Linux / iOS / Android:** Unsupported.
|
|
940
|
-
*
|
|
941
|
-
* @example
|
|
942
|
-
* ```typescript
|
|
943
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
944
|
-
* await getCurrentWindow().setMinimizable(false);
|
|
945
|
-
* ```
|
|
946
|
-
*
|
|
947
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
948
|
-
*/
|
|
949
|
-
async setMinimizable(minimizable) {
|
|
950
|
-
return invoke("plugin:window|set_minimizable", {
|
|
951
|
-
label: this.label,
|
|
952
|
-
value: minimizable
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* Sets whether the window's native close button is enabled or not.
|
|
957
|
-
*
|
|
958
|
-
* #### Platform-specific
|
|
959
|
-
*
|
|
960
|
-
* - **Linux:** GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible
|
|
961
|
-
* - **iOS / Android:** Unsupported.
|
|
962
|
-
*
|
|
963
|
-
* @example
|
|
964
|
-
* ```typescript
|
|
965
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
966
|
-
* await getCurrentWindow().setClosable(false);
|
|
967
|
-
* ```
|
|
968
|
-
*
|
|
969
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
970
|
-
*/
|
|
971
|
-
async setClosable(closable) {
|
|
972
|
-
return invoke("plugin:window|set_closable", {
|
|
973
|
-
label: this.label,
|
|
974
|
-
value: closable
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
/**
|
|
978
|
-
* Sets the window title.
|
|
979
|
-
* @example
|
|
980
|
-
* ```typescript
|
|
981
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
982
|
-
* await getCurrentWindow().setTitle('Tauri');
|
|
983
|
-
* ```
|
|
984
|
-
*
|
|
985
|
-
* @param title The new title
|
|
986
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
987
|
-
*/
|
|
988
|
-
async setTitle(title) {
|
|
989
|
-
return invoke("plugin:window|set_title", {
|
|
990
|
-
label: this.label,
|
|
991
|
-
value: title
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
/**
|
|
995
|
-
* Maximizes the window.
|
|
996
|
-
* @example
|
|
997
|
-
* ```typescript
|
|
998
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
999
|
-
* await getCurrentWindow().maximize();
|
|
1000
|
-
* ```
|
|
1001
|
-
*
|
|
1002
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1003
|
-
*/
|
|
1004
|
-
async maximize() {
|
|
1005
|
-
return invoke("plugin:window|maximize", {
|
|
1006
|
-
label: this.label
|
|
1007
|
-
});
|
|
1008
|
-
}
|
|
1009
|
-
/**
|
|
1010
|
-
* Unmaximizes the window.
|
|
1011
|
-
* @example
|
|
1012
|
-
* ```typescript
|
|
1013
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1014
|
-
* await getCurrentWindow().unmaximize();
|
|
1015
|
-
* ```
|
|
1016
|
-
*
|
|
1017
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1018
|
-
*/
|
|
1019
|
-
async unmaximize() {
|
|
1020
|
-
return invoke("plugin:window|unmaximize", {
|
|
1021
|
-
label: this.label
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
/**
|
|
1025
|
-
* Toggles the window maximized state.
|
|
1026
|
-
* @example
|
|
1027
|
-
* ```typescript
|
|
1028
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1029
|
-
* await getCurrentWindow().toggleMaximize();
|
|
1030
|
-
* ```
|
|
1031
|
-
*
|
|
1032
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1033
|
-
*/
|
|
1034
|
-
async toggleMaximize() {
|
|
1035
|
-
return invoke("plugin:window|toggle_maximize", {
|
|
1036
|
-
label: this.label
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* Minimizes the window.
|
|
1041
|
-
* @example
|
|
1042
|
-
* ```typescript
|
|
1043
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1044
|
-
* await getCurrentWindow().minimize();
|
|
1045
|
-
* ```
|
|
1046
|
-
*
|
|
1047
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1048
|
-
*/
|
|
1049
|
-
async minimize() {
|
|
1050
|
-
return invoke("plugin:window|minimize", {
|
|
1051
|
-
label: this.label
|
|
1052
|
-
});
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* Unminimizes the window.
|
|
1056
|
-
* @example
|
|
1057
|
-
* ```typescript
|
|
1058
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1059
|
-
* await getCurrentWindow().unminimize();
|
|
1060
|
-
* ```
|
|
1061
|
-
*
|
|
1062
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1063
|
-
*/
|
|
1064
|
-
async unminimize() {
|
|
1065
|
-
return invoke("plugin:window|unminimize", {
|
|
1066
|
-
label: this.label
|
|
1067
|
-
});
|
|
1068
|
-
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Sets the window visibility to true.
|
|
1071
|
-
* @example
|
|
1072
|
-
* ```typescript
|
|
1073
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1074
|
-
* await getCurrentWindow().show();
|
|
1075
|
-
* ```
|
|
1076
|
-
*
|
|
1077
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1078
|
-
*/
|
|
1079
|
-
async show() {
|
|
1080
|
-
return invoke("plugin:window|show", {
|
|
1081
|
-
label: this.label
|
|
1082
|
-
});
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* Sets the window visibility to false.
|
|
1086
|
-
* @example
|
|
1087
|
-
* ```typescript
|
|
1088
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1089
|
-
* await getCurrentWindow().hide();
|
|
1090
|
-
* ```
|
|
1091
|
-
*
|
|
1092
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1093
|
-
*/
|
|
1094
|
-
async hide() {
|
|
1095
|
-
return invoke("plugin:window|hide", {
|
|
1096
|
-
label: this.label
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
/**
|
|
1100
|
-
* Closes the window.
|
|
1101
|
-
*
|
|
1102
|
-
* Note this emits a closeRequested event so you can intercept it. To force window close, use {@link Window.destroy}.
|
|
1103
|
-
* @example
|
|
1104
|
-
* ```typescript
|
|
1105
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1106
|
-
* await getCurrentWindow().close();
|
|
1107
|
-
* ```
|
|
1108
|
-
*
|
|
1109
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1110
|
-
*/
|
|
1111
|
-
async close() {
|
|
1112
|
-
return invoke("plugin:window|close", {
|
|
1113
|
-
label: this.label
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
/**
|
|
1117
|
-
* Destroys the window. Behaves like {@link Window.close} but forces the window close instead of emitting a closeRequested event.
|
|
1118
|
-
* @example
|
|
1119
|
-
* ```typescript
|
|
1120
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1121
|
-
* await getCurrentWindow().destroy();
|
|
1122
|
-
* ```
|
|
1123
|
-
*
|
|
1124
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1125
|
-
*/
|
|
1126
|
-
async destroy() {
|
|
1127
|
-
return invoke("plugin:window|destroy", {
|
|
1128
|
-
label: this.label
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* Whether the window should have borders and bars.
|
|
1133
|
-
* @example
|
|
1134
|
-
* ```typescript
|
|
1135
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1136
|
-
* await getCurrentWindow().setDecorations(false);
|
|
1137
|
-
* ```
|
|
1138
|
-
*
|
|
1139
|
-
* @param decorations Whether the window should have borders and bars.
|
|
1140
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1141
|
-
*/
|
|
1142
|
-
async setDecorations(decorations) {
|
|
1143
|
-
return invoke("plugin:window|set_decorations", {
|
|
1144
|
-
label: this.label,
|
|
1145
|
-
value: decorations
|
|
1146
|
-
});
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* Whether or not the window should have shadow.
|
|
1150
|
-
*
|
|
1151
|
-
* #### Platform-specific
|
|
1152
|
-
*
|
|
1153
|
-
* - **Windows:**
|
|
1154
|
-
* - `false` has no effect on decorated window, shadows are always ON.
|
|
1155
|
-
* - `true` will make undecorated window have a 1px white border,
|
|
1156
|
-
* and on Windows 11, it will have a rounded corners.
|
|
1157
|
-
* - **Linux:** Unsupported.
|
|
1158
|
-
*
|
|
1159
|
-
* @example
|
|
1160
|
-
* ```typescript
|
|
1161
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1162
|
-
* await getCurrentWindow().setShadow(false);
|
|
1163
|
-
* ```
|
|
1164
|
-
*
|
|
1165
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1166
|
-
*/
|
|
1167
|
-
async setShadow(enable) {
|
|
1168
|
-
return invoke("plugin:window|set_shadow", {
|
|
1169
|
-
label: this.label,
|
|
1170
|
-
value: enable
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* Set window effects.
|
|
1175
|
-
*/
|
|
1176
|
-
async setEffects(effects) {
|
|
1177
|
-
return invoke("plugin:window|set_effects", {
|
|
1178
|
-
label: this.label,
|
|
1179
|
-
value: effects
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
/**
|
|
1183
|
-
* Clear any applied effects if possible.
|
|
1184
|
-
*/
|
|
1185
|
-
async clearEffects() {
|
|
1186
|
-
return invoke("plugin:window|set_effects", {
|
|
1187
|
-
label: this.label,
|
|
1188
|
-
value: null
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
/**
|
|
1192
|
-
* Whether the window should always be on top of other windows.
|
|
1193
|
-
* @example
|
|
1194
|
-
* ```typescript
|
|
1195
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1196
|
-
* await getCurrentWindow().setAlwaysOnTop(true);
|
|
1197
|
-
* ```
|
|
1198
|
-
*
|
|
1199
|
-
* @param alwaysOnTop Whether the window should always be on top of other windows or not.
|
|
1200
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1201
|
-
*/
|
|
1202
|
-
async setAlwaysOnTop(alwaysOnTop) {
|
|
1203
|
-
return invoke("plugin:window|set_always_on_top", {
|
|
1204
|
-
label: this.label,
|
|
1205
|
-
value: alwaysOnTop
|
|
1206
|
-
});
|
|
1207
|
-
}
|
|
1208
|
-
/**
|
|
1209
|
-
* Whether the window should always be below other windows.
|
|
1210
|
-
* @example
|
|
1211
|
-
* ```typescript
|
|
1212
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1213
|
-
* await getCurrentWindow().setAlwaysOnBottom(true);
|
|
1214
|
-
* ```
|
|
1215
|
-
*
|
|
1216
|
-
* @param alwaysOnBottom Whether the window should always be below other windows or not.
|
|
1217
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1218
|
-
*/
|
|
1219
|
-
async setAlwaysOnBottom(alwaysOnBottom) {
|
|
1220
|
-
return invoke("plugin:window|set_always_on_bottom", {
|
|
1221
|
-
label: this.label,
|
|
1222
|
-
value: alwaysOnBottom
|
|
1223
|
-
});
|
|
1224
|
-
}
|
|
1225
|
-
/**
|
|
1226
|
-
* Prevents the window contents from being captured by other apps.
|
|
1227
|
-
* @example
|
|
1228
|
-
* ```typescript
|
|
1229
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1230
|
-
* await getCurrentWindow().setContentProtected(true);
|
|
1231
|
-
* ```
|
|
1232
|
-
*
|
|
1233
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1234
|
-
*/
|
|
1235
|
-
async setContentProtected(protected_) {
|
|
1236
|
-
return invoke("plugin:window|set_content_protected", {
|
|
1237
|
-
label: this.label,
|
|
1238
|
-
value: protected_
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
/**
|
|
1242
|
-
* Resizes the window with a new inner size.
|
|
1243
|
-
* @example
|
|
1244
|
-
* ```typescript
|
|
1245
|
-
* import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';
|
|
1246
|
-
* await getCurrentWindow().setSize(new LogicalSize(600, 500));
|
|
1247
|
-
* ```
|
|
1248
|
-
*
|
|
1249
|
-
* @param size The logical or physical inner size.
|
|
1250
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1251
|
-
*/
|
|
1252
|
-
async setSize(size) {
|
|
1253
|
-
return invoke("plugin:window|set_size", {
|
|
1254
|
-
label: this.label,
|
|
1255
|
-
value: size instanceof Size ? size : new Size(size)
|
|
1256
|
-
});
|
|
1257
|
-
}
|
|
1258
|
-
/**
|
|
1259
|
-
* Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset.
|
|
1260
|
-
* @example
|
|
1261
|
-
* ```typescript
|
|
1262
|
-
* import { getCurrentWindow, PhysicalSize } from '@tauri-apps/api/window';
|
|
1263
|
-
* await getCurrentWindow().setMinSize(new PhysicalSize(600, 500));
|
|
1264
|
-
* ```
|
|
1265
|
-
*
|
|
1266
|
-
* @param size The logical or physical inner size, or `null` to unset the constraint.
|
|
1267
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1268
|
-
*/
|
|
1269
|
-
async setMinSize(size) {
|
|
1270
|
-
return invoke("plugin:window|set_min_size", {
|
|
1271
|
-
label: this.label,
|
|
1272
|
-
value: size instanceof Size ? size : size ? new Size(size) : null
|
|
1273
|
-
});
|
|
1274
|
-
}
|
|
1275
|
-
/**
|
|
1276
|
-
* Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset.
|
|
1277
|
-
* @example
|
|
1278
|
-
* ```typescript
|
|
1279
|
-
* import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';
|
|
1280
|
-
* await getCurrentWindow().setMaxSize(new LogicalSize(600, 500));
|
|
1281
|
-
* ```
|
|
1282
|
-
*
|
|
1283
|
-
* @param size The logical or physical inner size, or `null` to unset the constraint.
|
|
1284
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1285
|
-
*/
|
|
1286
|
-
async setMaxSize(size) {
|
|
1287
|
-
return invoke("plugin:window|set_max_size", {
|
|
1288
|
-
label: this.label,
|
|
1289
|
-
value: size instanceof Size ? size : size ? new Size(size) : null
|
|
1290
|
-
});
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* Sets the window inner size constraints.
|
|
1294
|
-
* @example
|
|
1295
|
-
* ```typescript
|
|
1296
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1297
|
-
* await getCurrentWindow().setSizeConstraints({ minWidth: 300 });
|
|
1298
|
-
* ```
|
|
1299
|
-
*
|
|
1300
|
-
* @param constraints The logical or physical inner size, or `null` to unset the constraint.
|
|
1301
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1302
|
-
*/
|
|
1303
|
-
async setSizeConstraints(constraints) {
|
|
1304
|
-
function logical(pixel) {
|
|
1305
|
-
return pixel ? { Logical: pixel } : null;
|
|
1306
|
-
}
|
|
1307
|
-
return invoke("plugin:window|set_size_constraints", {
|
|
1308
|
-
label: this.label,
|
|
1309
|
-
value: {
|
|
1310
|
-
minWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minWidth),
|
|
1311
|
-
minHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minHeight),
|
|
1312
|
-
maxWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxWidth),
|
|
1313
|
-
maxHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxHeight)
|
|
1314
|
-
}
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
/**
|
|
1318
|
-
* Sets the window outer position.
|
|
1319
|
-
* @example
|
|
1320
|
-
* ```typescript
|
|
1321
|
-
* import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';
|
|
1322
|
-
* await getCurrentWindow().setPosition(new LogicalPosition(600, 500));
|
|
1323
|
-
* ```
|
|
1324
|
-
*
|
|
1325
|
-
* @param position The new position, in logical or physical pixels.
|
|
1326
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1327
|
-
*/
|
|
1328
|
-
async setPosition(position) {
|
|
1329
|
-
return invoke("plugin:window|set_position", {
|
|
1330
|
-
label: this.label,
|
|
1331
|
-
value: position instanceof Position ? position : new Position(position)
|
|
1332
|
-
});
|
|
1333
|
-
}
|
|
1334
|
-
/**
|
|
1335
|
-
* Sets the window fullscreen state.
|
|
1336
|
-
* @example
|
|
1337
|
-
* ```typescript
|
|
1338
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1339
|
-
* await getCurrentWindow().setFullscreen(true);
|
|
1340
|
-
* ```
|
|
1341
|
-
*
|
|
1342
|
-
* @param fullscreen Whether the window should go to fullscreen or not.
|
|
1343
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1344
|
-
*/
|
|
1345
|
-
async setFullscreen(fullscreen) {
|
|
1346
|
-
return invoke("plugin:window|set_fullscreen", {
|
|
1347
|
-
label: this.label,
|
|
1348
|
-
value: fullscreen
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
/**
|
|
1352
|
-
* 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).
|
|
1353
|
-
* 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.
|
|
1354
|
-
*
|
|
1355
|
-
* On other platforms, this is the same as {@link Window.setFullscreen}.
|
|
1356
|
-
*
|
|
1357
|
-
* @param fullscreen Whether the window should go to simple fullscreen or not.
|
|
1358
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1359
|
-
*/
|
|
1360
|
-
async setSimpleFullscreen(fullscreen) {
|
|
1361
|
-
return invoke("plugin:window|set_simple_fullscreen", {
|
|
1362
|
-
label: this.label,
|
|
1363
|
-
value: fullscreen
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
|
-
/**
|
|
1367
|
-
* Bring the window to front and focus.
|
|
1368
|
-
* @example
|
|
1369
|
-
* ```typescript
|
|
1370
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1371
|
-
* await getCurrentWindow().setFocus();
|
|
1372
|
-
* ```
|
|
1373
|
-
*
|
|
1374
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1375
|
-
*/
|
|
1376
|
-
async setFocus() {
|
|
1377
|
-
return invoke("plugin:window|set_focus", {
|
|
1378
|
-
label: this.label
|
|
1379
|
-
});
|
|
1380
|
-
}
|
|
1381
|
-
/**
|
|
1382
|
-
* Sets whether the window can be focused.
|
|
1383
|
-
*
|
|
1384
|
-
* #### Platform-specific
|
|
1385
|
-
*
|
|
1386
|
-
* - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`.
|
|
1387
|
-
* 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.
|
|
1388
|
-
*
|
|
1389
|
-
* @example
|
|
1390
|
-
* ```typescript
|
|
1391
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1392
|
-
* await getCurrentWindow().setFocusable(true);
|
|
1393
|
-
* ```
|
|
1394
|
-
*
|
|
1395
|
-
* @param focusable Whether the window can be focused.
|
|
1396
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1397
|
-
*/
|
|
1398
|
-
async setFocusable(focusable) {
|
|
1399
|
-
return invoke("plugin:window|set_focusable", {
|
|
1400
|
-
label: this.label,
|
|
1401
|
-
value: focusable
|
|
1402
|
-
});
|
|
1403
|
-
}
|
|
1404
|
-
/**
|
|
1405
|
-
* Sets the window icon.
|
|
1406
|
-
* @example
|
|
1407
|
-
* ```typescript
|
|
1408
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1409
|
-
* await getCurrentWindow().setIcon('/tauri/awesome.png');
|
|
1410
|
-
* ```
|
|
1411
|
-
*
|
|
1412
|
-
* Note that you may need the `image-ico` or `image-png` Cargo features to use this API.
|
|
1413
|
-
* To enable it, change your Cargo.toml file:
|
|
1414
|
-
* ```toml
|
|
1415
|
-
* [dependencies]
|
|
1416
|
-
* tauri = { version = "...", features = ["...", "image-png"] }
|
|
1417
|
-
* ```
|
|
1418
|
-
*
|
|
1419
|
-
* @param icon Icon bytes or path to the icon file.
|
|
1420
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1421
|
-
*/
|
|
1422
|
-
async setIcon(icon) {
|
|
1423
|
-
return invoke("plugin:window|set_icon", {
|
|
1424
|
-
label: this.label,
|
|
1425
|
-
value: transformImage(icon)
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
/**
|
|
1429
|
-
* Whether the window icon should be hidden from the taskbar or not.
|
|
1430
|
-
*
|
|
1431
|
-
* #### Platform-specific
|
|
1432
|
-
*
|
|
1433
|
-
* - **macOS:** Unsupported.
|
|
1434
|
-
* @example
|
|
1435
|
-
* ```typescript
|
|
1436
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1437
|
-
* await getCurrentWindow().setSkipTaskbar(true);
|
|
1438
|
-
* ```
|
|
1439
|
-
*
|
|
1440
|
-
* @param skip true to hide window icon, false to show it.
|
|
1441
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1442
|
-
*/
|
|
1443
|
-
async setSkipTaskbar(skip) {
|
|
1444
|
-
return invoke("plugin:window|set_skip_taskbar", {
|
|
1445
|
-
label: this.label,
|
|
1446
|
-
value: skip
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
/**
|
|
1450
|
-
* Grabs the cursor, preventing it from leaving the window.
|
|
1451
|
-
*
|
|
1452
|
-
* There's no guarantee that the cursor will be hidden. You should
|
|
1453
|
-
* hide it by yourself if you want so.
|
|
1454
|
-
*
|
|
1455
|
-
* #### Platform-specific
|
|
1456
|
-
*
|
|
1457
|
-
* - **Linux:** Unsupported.
|
|
1458
|
-
* - **macOS:** This locks the cursor in a fixed location, which looks visually awkward.
|
|
1459
|
-
* @example
|
|
1460
|
-
* ```typescript
|
|
1461
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1462
|
-
* await getCurrentWindow().setCursorGrab(true);
|
|
1463
|
-
* ```
|
|
1464
|
-
*
|
|
1465
|
-
* @param grab `true` to grab the cursor icon, `false` to release it.
|
|
1466
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1467
|
-
*/
|
|
1468
|
-
async setCursorGrab(grab) {
|
|
1469
|
-
return invoke("plugin:window|set_cursor_grab", {
|
|
1470
|
-
label: this.label,
|
|
1471
|
-
value: grab
|
|
1472
|
-
});
|
|
1473
|
-
}
|
|
1474
|
-
/**
|
|
1475
|
-
* Modifies the cursor's visibility.
|
|
1476
|
-
*
|
|
1477
|
-
* #### Platform-specific
|
|
1478
|
-
*
|
|
1479
|
-
* - **Windows:** The cursor is only hidden within the confines of the window.
|
|
1480
|
-
* - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is
|
|
1481
|
-
* outside of the window.
|
|
1482
|
-
* @example
|
|
1483
|
-
* ```typescript
|
|
1484
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1485
|
-
* await getCurrentWindow().setCursorVisible(false);
|
|
1486
|
-
* ```
|
|
1487
|
-
*
|
|
1488
|
-
* @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor.
|
|
1489
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1490
|
-
*/
|
|
1491
|
-
async setCursorVisible(visible) {
|
|
1492
|
-
return invoke("plugin:window|set_cursor_visible", {
|
|
1493
|
-
label: this.label,
|
|
1494
|
-
value: visible
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Modifies the cursor icon of the window.
|
|
1499
|
-
* @example
|
|
1500
|
-
* ```typescript
|
|
1501
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1502
|
-
* await getCurrentWindow().setCursorIcon('help');
|
|
1503
|
-
* ```
|
|
1504
|
-
*
|
|
1505
|
-
* @param icon The new cursor icon.
|
|
1506
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1507
|
-
*/
|
|
1508
|
-
async setCursorIcon(icon) {
|
|
1509
|
-
return invoke("plugin:window|set_cursor_icon", {
|
|
1510
|
-
label: this.label,
|
|
1511
|
-
value: icon
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
/**
|
|
1515
|
-
* Sets the window background color.
|
|
1516
|
-
*
|
|
1517
|
-
* #### Platform-specific:
|
|
1518
|
-
*
|
|
1519
|
-
* - **Windows:** alpha channel is ignored.
|
|
1520
|
-
* - **iOS / Android:** Unsupported.
|
|
1521
|
-
*
|
|
1522
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1523
|
-
*
|
|
1524
|
-
* @since 2.1.0
|
|
1525
|
-
*/
|
|
1526
|
-
async setBackgroundColor(color) {
|
|
1527
|
-
return invoke("plugin:window|set_background_color", { color });
|
|
1528
|
-
}
|
|
1529
|
-
/**
|
|
1530
|
-
* Changes the position of the cursor in window coordinates.
|
|
1531
|
-
* @example
|
|
1532
|
-
* ```typescript
|
|
1533
|
-
* import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';
|
|
1534
|
-
* await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300));
|
|
1535
|
-
* ```
|
|
1536
|
-
*
|
|
1537
|
-
* @param position The new cursor position.
|
|
1538
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1539
|
-
*/
|
|
1540
|
-
async setCursorPosition(position) {
|
|
1541
|
-
return invoke("plugin:window|set_cursor_position", {
|
|
1542
|
-
label: this.label,
|
|
1543
|
-
value: position instanceof Position ? position : new Position(position)
|
|
1544
|
-
});
|
|
1545
|
-
}
|
|
1546
|
-
/**
|
|
1547
|
-
* Changes the cursor events behavior.
|
|
1548
|
-
*
|
|
1549
|
-
* @example
|
|
1550
|
-
* ```typescript
|
|
1551
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1552
|
-
* await getCurrentWindow().setIgnoreCursorEvents(true);
|
|
1553
|
-
* ```
|
|
1554
|
-
*
|
|
1555
|
-
* @param ignore `true` to ignore the cursor events; `false` to process them as usual.
|
|
1556
|
-
* @returns A promise indicating the success or failure of the operation.
|
|
1557
|
-
*/
|
|
1558
|
-
async setIgnoreCursorEvents(ignore) {
|
|
1559
|
-
return invoke("plugin:window|set_ignore_cursor_events", {
|
|
1560
|
-
label: this.label,
|
|
1561
|
-
value: ignore
|
|
1562
|
-
});
|
|
1563
|
-
}
|
|
1564
|
-
/**
|
|
1565
|
-
* Starts dragging the window.
|
|
1566
|
-
* @example
|
|
1567
|
-
* ```typescript
|
|
1568
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1569
|
-
* await getCurrentWindow().startDragging();
|
|
1570
|
-
* ```
|
|
1571
|
-
*
|
|
1572
|
-
* @return A promise indicating the success or failure of the operation.
|
|
1573
|
-
*/
|
|
1574
|
-
async startDragging() {
|
|
1575
|
-
return invoke("plugin:window|start_dragging", {
|
|
1576
|
-
label: this.label
|
|
1577
|
-
});
|
|
1578
|
-
}
|
|
1579
|
-
/**
|
|
1580
|
-
* Starts resize-dragging the window.
|
|
1581
|
-
* @example
|
|
1582
|
-
* ```typescript
|
|
1583
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1584
|
-
* await getCurrentWindow().startResizeDragging();
|
|
1585
|
-
* ```
|
|
1586
|
-
*
|
|
1587
|
-
* @return A promise indicating the success or failure of the operation.
|
|
1588
|
-
*/
|
|
1589
|
-
async startResizeDragging(direction) {
|
|
1590
|
-
return invoke("plugin:window|start_resize_dragging", {
|
|
1591
|
-
label: this.label,
|
|
1592
|
-
value: direction
|
|
1593
|
-
});
|
|
1594
|
-
}
|
|
1595
|
-
/**
|
|
1596
|
-
* Sets the badge count. It is app wide and not specific to this window.
|
|
1597
|
-
*
|
|
1598
|
-
* #### Platform-specific
|
|
1599
|
-
*
|
|
1600
|
-
* - **Windows**: Unsupported. Use @{linkcode Window.setOverlayIcon} instead.
|
|
1601
|
-
*
|
|
1602
|
-
* @example
|
|
1603
|
-
* ```typescript
|
|
1604
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1605
|
-
* await getCurrentWindow().setBadgeCount(5);
|
|
1606
|
-
* ```
|
|
1607
|
-
*
|
|
1608
|
-
* @param count The badge count. Use `undefined` to remove the badge.
|
|
1609
|
-
* @return A promise indicating the success or failure of the operation.
|
|
1610
|
-
*/
|
|
1611
|
-
async setBadgeCount(count) {
|
|
1612
|
-
return invoke("plugin:window|set_badge_count", {
|
|
1613
|
-
label: this.label,
|
|
1614
|
-
value: count
|
|
1615
|
-
});
|
|
1616
|
-
}
|
|
1617
|
-
/**
|
|
1618
|
-
* Sets the badge cont **macOS only**.
|
|
1619
|
-
*
|
|
1620
|
-
* @example
|
|
1621
|
-
* ```typescript
|
|
1622
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1623
|
-
* await getCurrentWindow().setBadgeLabel("Hello");
|
|
1624
|
-
* ```
|
|
1625
|
-
*
|
|
1626
|
-
* @param label The badge label. Use `undefined` to remove the badge.
|
|
1627
|
-
* @return A promise indicating the success or failure of the operation.
|
|
1628
|
-
*/
|
|
1629
|
-
async setBadgeLabel(label) {
|
|
1630
|
-
return invoke("plugin:window|set_badge_label", {
|
|
1631
|
-
label: this.label,
|
|
1632
|
-
value: label
|
|
1633
|
-
});
|
|
1634
|
-
}
|
|
1635
|
-
/**
|
|
1636
|
-
* Sets the overlay icon. **Windows only**
|
|
1637
|
-
* The overlay icon can be set for every window.
|
|
1638
|
-
*
|
|
1639
|
-
*
|
|
1640
|
-
* Note that you may need the `image-ico` or `image-png` Cargo features to use this API.
|
|
1641
|
-
* To enable it, change your Cargo.toml file:
|
|
1642
|
-
*
|
|
1643
|
-
* ```toml
|
|
1644
|
-
* [dependencies]
|
|
1645
|
-
* tauri = { version = "...", features = ["...", "image-png"] }
|
|
1646
|
-
* ```
|
|
1647
|
-
*
|
|
1648
|
-
* @example
|
|
1649
|
-
* ```typescript
|
|
1650
|
-
* import { getCurrentWindow } from '@tauri-apps/api/window';
|
|
1651
|
-
* await getCurrentWindow().setOverlayIcon("/tauri/awesome.png");
|
|
1652
|
-
* ```
|
|
1653
|
-
*
|
|
1654
|
-
* @param icon Icon bytes or path to the icon file. Use `undefined` to remove the overlay icon.
|
|
1655
|
-
* @return A promise indicating the success or failure of the operation.
|
|
1656
|
-
*/
|
|
1657
|
-
async setOverlayIcon(icon) {
|
|
1658
|
-
return invoke("plugin:window|set_overlay_icon", {
|
|
1659
|
-
label: this.label,
|
|
1660
|
-
value: icon ? transformImage(icon) : void 0
|
|
1661
|
-
});
|
|
1662
|
-
}
|
|
1663
|
-
/**
|
|
1664
|
-
* Sets the taskbar progress state.
|
|
1665
|
-
*
|
|
1666
|
-
* #### Platform-specific
|
|
1667
|
-
*
|
|
1668
|
-
* - **Linux / macOS**: Progress bar is app-wide and not specific to this window.
|
|
1669
|
-
* - **Linux**: Only supported desktop environments with `libunity` (e.g. GNOME).
|
|
1670
|
-
*
|
|
1671
|
-
* @example
|
|
1672
|
-
* ```typescript
|
|
1673
|
-
* import { getCurrentWindow, ProgressBarStatus } from '@tauri-apps/api/window';
|
|
1674
|
-
* await getCurrentWindow().setProgressBar({
|
|
1675
|
-
* status: ProgressBarStatus.Normal,
|
|
1676
|
-
* progress: 50,
|
|
1677
|
-
* });
|
|
1678
|
-
* ```
|
|
1679
|
-
*
|
|
1680
|
-
* @return A promise indicating the success or failure of the operation.
|
|
1681
|
-
*/
|
|
1682
|
-
async setProgressBar(state) {
|
|
1683
|
-
return invoke("plugin:window|set_progress_bar", {
|
|
1684
|
-
label: this.label,
|
|
1685
|
-
value: state
|
|
1686
|
-
});
|
|
1687
|
-
}
|
|
1688
|
-
/**
|
|
1689
|
-
* Sets whether the window should be visible on all workspaces or virtual desktops.
|
|
1690
|
-
*
|
|
1691
|
-
* #### Platform-specific
|
|
1692
|
-
*
|
|
1693
|
-
* - **Windows / iOS / Android:** Unsupported.
|
|
1694
|
-
*
|
|
1695
|
-
* @since 2.0.0
|
|
1696
|
-
*/
|
|
1697
|
-
async setVisibleOnAllWorkspaces(visible) {
|
|
1698
|
-
return invoke("plugin:window|set_visible_on_all_workspaces", {
|
|
1699
|
-
label: this.label,
|
|
1700
|
-
value: visible
|
|
1701
|
-
});
|
|
1702
|
-
}
|
|
1703
|
-
/**
|
|
1704
|
-
* Sets the title bar style. **macOS only**.
|
|
1705
|
-
*
|
|
1706
|
-
* @since 2.0.0
|
|
1707
|
-
*/
|
|
1708
|
-
async setTitleBarStyle(style) {
|
|
1709
|
-
return invoke("plugin:window|set_title_bar_style", {
|
|
1710
|
-
label: this.label,
|
|
1711
|
-
value: style
|
|
1712
|
-
});
|
|
1713
|
-
}
|
|
1714
|
-
/**
|
|
1715
|
-
* Set window theme, pass in `null` or `undefined` to follow system theme
|
|
1716
|
-
*
|
|
1717
|
-
* #### Platform-specific
|
|
1718
|
-
*
|
|
1719
|
-
* - **Linux / macOS**: Theme is app-wide and not specific to this window.
|
|
1720
|
-
* - **iOS / Android:** Unsupported.
|
|
1721
|
-
*
|
|
1722
|
-
* @since 2.0.0
|
|
1723
|
-
*/
|
|
1724
|
-
async setTheme(theme) {
|
|
1725
|
-
return invoke("plugin:window|set_theme", {
|
|
1726
|
-
label: this.label,
|
|
1727
|
-
value: theme
|
|
1728
|
-
});
|
|
1729
|
-
}
|
|
1730
|
-
// Listeners
|
|
1731
|
-
/**
|
|
1732
|
-
* Listen to window resize.
|
|
1733
|
-
*
|
|
1734
|
-
* @example
|
|
1735
|
-
* ```typescript
|
|
1736
|
-
* import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
1737
|
-
* const unlisten = await getCurrentWindow().onResized(({ payload: size }) => {
|
|
1738
|
-
* console.log('Window resized', size);
|
|
1739
|
-
* });
|
|
1740
|
-
*
|
|
1741
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
1742
|
-
* unlisten();
|
|
1743
|
-
* ```
|
|
1744
|
-
*
|
|
1745
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
1746
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1747
|
-
*/
|
|
1748
|
-
async onResized(handler) {
|
|
1749
|
-
return this.listen(TauriEvent.WINDOW_RESIZED, (e) => {
|
|
1750
|
-
e.payload = new PhysicalSize(e.payload);
|
|
1751
|
-
handler(e);
|
|
1752
|
-
});
|
|
1753
|
-
}
|
|
1754
|
-
/**
|
|
1755
|
-
* Listen to window move.
|
|
1756
|
-
*
|
|
1757
|
-
* @example
|
|
1758
|
-
* ```typescript
|
|
1759
|
-
* import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
1760
|
-
* const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => {
|
|
1761
|
-
* console.log('Window moved', position);
|
|
1762
|
-
* });
|
|
1763
|
-
*
|
|
1764
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
1765
|
-
* unlisten();
|
|
1766
|
-
* ```
|
|
1767
|
-
*
|
|
1768
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
1769
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1770
|
-
*/
|
|
1771
|
-
async onMoved(handler) {
|
|
1772
|
-
return this.listen(TauriEvent.WINDOW_MOVED, (e) => {
|
|
1773
|
-
e.payload = new PhysicalPosition(e.payload);
|
|
1774
|
-
handler(e);
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
/**
|
|
1778
|
-
* Listen to window close requested. Emitted when the user requests to closes the window.
|
|
1779
|
-
*
|
|
1780
|
-
* @example
|
|
1781
|
-
* ```typescript
|
|
1782
|
-
* import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
1783
|
-
* import { confirm } from '@tauri-apps/api/dialog';
|
|
1784
|
-
* const unlisten = await getCurrentWindow().onCloseRequested(async (event) => {
|
|
1785
|
-
* const confirmed = await confirm('Are you sure?');
|
|
1786
|
-
* if (!confirmed) {
|
|
1787
|
-
* // user did not confirm closing the window; let's prevent it
|
|
1788
|
-
* event.preventDefault();
|
|
1789
|
-
* }
|
|
1790
|
-
* });
|
|
1791
|
-
*
|
|
1792
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
1793
|
-
* unlisten();
|
|
1794
|
-
* ```
|
|
1795
|
-
*
|
|
1796
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
1797
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1798
|
-
*/
|
|
1799
|
-
async onCloseRequested(handler) {
|
|
1800
|
-
return this.listen(TauriEvent.WINDOW_CLOSE_REQUESTED, async (event) => {
|
|
1801
|
-
const evt = new CloseRequestedEvent(event);
|
|
1802
|
-
await handler(evt);
|
|
1803
|
-
if (!evt.isPreventDefault()) {
|
|
1804
|
-
await this.destroy();
|
|
1805
|
-
}
|
|
1806
|
-
});
|
|
1807
|
-
}
|
|
1808
|
-
/**
|
|
1809
|
-
* Listen to a file drop event.
|
|
1810
|
-
* The listener is triggered when the user hovers the selected files on the webview,
|
|
1811
|
-
* drops the files or cancels the operation.
|
|
1812
|
-
*
|
|
1813
|
-
* @example
|
|
1814
|
-
* ```typescript
|
|
1815
|
-
* import { getCurrentWindow } from "@tauri-apps/api/webview";
|
|
1816
|
-
* const unlisten = await getCurrentWindow().onDragDropEvent((event) => {
|
|
1817
|
-
* if (event.payload.type === 'over') {
|
|
1818
|
-
* console.log('User hovering', event.payload.position);
|
|
1819
|
-
* } else if (event.payload.type === 'drop') {
|
|
1820
|
-
* console.log('User dropped', event.payload.paths);
|
|
1821
|
-
* } else {
|
|
1822
|
-
* console.log('File drop cancelled');
|
|
1823
|
-
* }
|
|
1824
|
-
* });
|
|
1825
|
-
*
|
|
1826
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
1827
|
-
* unlisten();
|
|
1828
|
-
* ```
|
|
1829
|
-
*
|
|
1830
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
1831
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1832
|
-
*/
|
|
1833
|
-
async onDragDropEvent(handler) {
|
|
1834
|
-
const unlistenDrag = await this.listen(TauriEvent.DRAG_ENTER, (event) => {
|
|
1835
|
-
handler({
|
|
1836
|
-
...event,
|
|
1837
|
-
payload: {
|
|
1838
|
-
type: "enter",
|
|
1839
|
-
paths: event.payload.paths,
|
|
1840
|
-
position: new PhysicalPosition(event.payload.position)
|
|
1841
|
-
}
|
|
1842
|
-
});
|
|
1843
|
-
});
|
|
1844
|
-
const unlistenDragOver = await this.listen(TauriEvent.DRAG_OVER, (event) => {
|
|
1845
|
-
handler({
|
|
1846
|
-
...event,
|
|
1847
|
-
payload: {
|
|
1848
|
-
type: "over",
|
|
1849
|
-
position: new PhysicalPosition(event.payload.position)
|
|
1850
|
-
}
|
|
1851
|
-
});
|
|
1852
|
-
});
|
|
1853
|
-
const unlistenDrop = await this.listen(TauriEvent.DRAG_DROP, (event) => {
|
|
1854
|
-
handler({
|
|
1855
|
-
...event,
|
|
1856
|
-
payload: {
|
|
1857
|
-
type: "drop",
|
|
1858
|
-
paths: event.payload.paths,
|
|
1859
|
-
position: new PhysicalPosition(event.payload.position)
|
|
1860
|
-
}
|
|
1861
|
-
});
|
|
1862
|
-
});
|
|
1863
|
-
const unlistenCancel = await this.listen(TauriEvent.DRAG_LEAVE, (event) => {
|
|
1864
|
-
handler({ ...event, payload: { type: "leave" } });
|
|
1865
|
-
});
|
|
1866
|
-
return () => {
|
|
1867
|
-
unlistenDrag();
|
|
1868
|
-
unlistenDrop();
|
|
1869
|
-
unlistenDragOver();
|
|
1870
|
-
unlistenCancel();
|
|
1871
|
-
};
|
|
1872
|
-
}
|
|
1873
|
-
/**
|
|
1874
|
-
* Listen to window focus change.
|
|
1875
|
-
*
|
|
1876
|
-
* @example
|
|
1877
|
-
* ```typescript
|
|
1878
|
-
* import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
1879
|
-
* const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => {
|
|
1880
|
-
* console.log('Focus changed, window is focused? ' + focused);
|
|
1881
|
-
* });
|
|
1882
|
-
*
|
|
1883
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
1884
|
-
* unlisten();
|
|
1885
|
-
* ```
|
|
1886
|
-
*
|
|
1887
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
1888
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1889
|
-
*/
|
|
1890
|
-
async onFocusChanged(handler) {
|
|
1891
|
-
const unlistenFocus = await this.listen(TauriEvent.WINDOW_FOCUS, (event) => {
|
|
1892
|
-
handler({ ...event, payload: true });
|
|
1893
|
-
});
|
|
1894
|
-
const unlistenBlur = await this.listen(TauriEvent.WINDOW_BLUR, (event) => {
|
|
1895
|
-
handler({ ...event, payload: false });
|
|
1896
|
-
});
|
|
1897
|
-
return () => {
|
|
1898
|
-
unlistenFocus();
|
|
1899
|
-
unlistenBlur();
|
|
1900
|
-
};
|
|
1901
|
-
}
|
|
1902
|
-
/**
|
|
1903
|
-
* Listen to window scale change. Emitted when the window's scale factor has changed.
|
|
1904
|
-
* The following user actions can cause DPI changes:
|
|
1905
|
-
* - Changing the display's resolution.
|
|
1906
|
-
* - Changing the display's scale factor (e.g. in Control Panel on Windows).
|
|
1907
|
-
* - Moving the window to a display with a different scale factor.
|
|
1908
|
-
*
|
|
1909
|
-
* @example
|
|
1910
|
-
* ```typescript
|
|
1911
|
-
* import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
1912
|
-
* const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => {
|
|
1913
|
-
* console.log('Scale changed', payload.scaleFactor, payload.size);
|
|
1914
|
-
* });
|
|
1915
|
-
*
|
|
1916
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
1917
|
-
* unlisten();
|
|
1918
|
-
* ```
|
|
1919
|
-
*
|
|
1920
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
1921
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1922
|
-
*/
|
|
1923
|
-
async onScaleChanged(handler) {
|
|
1924
|
-
return this.listen(TauriEvent.WINDOW_SCALE_FACTOR_CHANGED, handler);
|
|
1925
|
-
}
|
|
1926
|
-
/**
|
|
1927
|
-
* Listen to the system theme change.
|
|
1928
|
-
*
|
|
1929
|
-
* @example
|
|
1930
|
-
* ```typescript
|
|
1931
|
-
* import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
1932
|
-
* const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => {
|
|
1933
|
-
* console.log('New theme: ' + theme);
|
|
1934
|
-
* });
|
|
1935
|
-
*
|
|
1936
|
-
* // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
|
|
1937
|
-
* unlisten();
|
|
1938
|
-
* ```
|
|
1939
|
-
*
|
|
1940
|
-
* @returns A promise resolving to a function to unlisten to the event.
|
|
1941
|
-
* Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
|
1942
|
-
*/
|
|
1943
|
-
async onThemeChanged(handler) {
|
|
1944
|
-
return this.listen(TauriEvent.WINDOW_THEME_CHANGED, handler);
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
var BackgroundThrottlingPolicy;
|
|
1948
|
-
(function(BackgroundThrottlingPolicy2) {
|
|
1949
|
-
BackgroundThrottlingPolicy2["Disabled"] = "disabled";
|
|
1950
|
-
BackgroundThrottlingPolicy2["Throttle"] = "throttle";
|
|
1951
|
-
BackgroundThrottlingPolicy2["Suspend"] = "suspend";
|
|
1952
|
-
})(BackgroundThrottlingPolicy || (BackgroundThrottlingPolicy = {}));
|
|
1953
|
-
var ScrollBarStyle;
|
|
1954
|
-
(function(ScrollBarStyle2) {
|
|
1955
|
-
ScrollBarStyle2["Default"] = "default";
|
|
1956
|
-
ScrollBarStyle2["FluentOverlay"] = "fluentOverlay";
|
|
1957
|
-
})(ScrollBarStyle || (ScrollBarStyle = {}));
|
|
1958
|
-
var Effect;
|
|
1959
|
-
(function(Effect2) {
|
|
1960
|
-
Effect2["AppearanceBased"] = "appearanceBased";
|
|
1961
|
-
Effect2["Light"] = "light";
|
|
1962
|
-
Effect2["Dark"] = "dark";
|
|
1963
|
-
Effect2["MediumLight"] = "mediumLight";
|
|
1964
|
-
Effect2["UltraDark"] = "ultraDark";
|
|
1965
|
-
Effect2["Titlebar"] = "titlebar";
|
|
1966
|
-
Effect2["Selection"] = "selection";
|
|
1967
|
-
Effect2["Menu"] = "menu";
|
|
1968
|
-
Effect2["Popover"] = "popover";
|
|
1969
|
-
Effect2["Sidebar"] = "sidebar";
|
|
1970
|
-
Effect2["HeaderView"] = "headerView";
|
|
1971
|
-
Effect2["Sheet"] = "sheet";
|
|
1972
|
-
Effect2["WindowBackground"] = "windowBackground";
|
|
1973
|
-
Effect2["HudWindow"] = "hudWindow";
|
|
1974
|
-
Effect2["FullScreenUI"] = "fullScreenUI";
|
|
1975
|
-
Effect2["Tooltip"] = "tooltip";
|
|
1976
|
-
Effect2["ContentBackground"] = "contentBackground";
|
|
1977
|
-
Effect2["UnderWindowBackground"] = "underWindowBackground";
|
|
1978
|
-
Effect2["UnderPageBackground"] = "underPageBackground";
|
|
1979
|
-
Effect2["Mica"] = "mica";
|
|
1980
|
-
Effect2["Blur"] = "blur";
|
|
1981
|
-
Effect2["Acrylic"] = "acrylic";
|
|
1982
|
-
Effect2["Tabbed"] = "tabbed";
|
|
1983
|
-
Effect2["TabbedDark"] = "tabbedDark";
|
|
1984
|
-
Effect2["TabbedLight"] = "tabbedLight";
|
|
1985
|
-
})(Effect || (Effect = {}));
|
|
1986
|
-
var EffectState;
|
|
1987
|
-
(function(EffectState2) {
|
|
1988
|
-
EffectState2["FollowsWindowActiveState"] = "followsWindowActiveState";
|
|
1989
|
-
EffectState2["Active"] = "active";
|
|
1990
|
-
EffectState2["Inactive"] = "inactive";
|
|
1991
|
-
})(EffectState || (EffectState = {}));
|
|
1992
|
-
export {
|
|
1993
|
-
CloseRequestedEvent,
|
|
1994
|
-
Effect,
|
|
1995
|
-
EffectState,
|
|
1996
|
-
LogicalPosition,
|
|
1997
|
-
LogicalSize,
|
|
1998
|
-
PhysicalPosition,
|
|
1999
|
-
PhysicalSize,
|
|
2000
|
-
ProgressBarStatus,
|
|
2001
|
-
UserAttentionType,
|
|
2002
|
-
Window,
|
|
2003
|
-
getAllWindows,
|
|
2004
|
-
getCurrentWindow
|
|
2005
|
-
};
|