@hanzogui/tauri 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/TitleBar.cjs +97 -0
  2. package/dist/cjs/TitleBar.native.js +109 -0
  3. package/dist/cjs/TitleBar.native.js.map +1 -0
  4. package/dist/cjs/index.cjs +41 -0
  5. package/dist/cjs/index.native.js +44 -0
  6. package/dist/cjs/index.native.js.map +1 -0
  7. package/dist/cjs/isTauri.cjs +30 -0
  8. package/dist/cjs/isTauri.native.js +33 -0
  9. package/dist/cjs/isTauri.native.js.map +1 -0
  10. package/dist/cjs/shortcuts.cjs +70 -0
  11. package/dist/cjs/shortcuts.native.js +73 -0
  12. package/dist/cjs/shortcuts.native.js.map +1 -0
  13. package/dist/cjs/system.cjs +65 -0
  14. package/dist/cjs/system.native.js +68 -0
  15. package/dist/cjs/system.native.js.map +1 -0
  16. package/dist/cjs/window.cjs +81 -0
  17. package/dist/cjs/window.native.js +106 -0
  18. package/dist/cjs/window.native.js.map +1 -0
  19. package/dist/esm/TitleBar.mjs +72 -0
  20. package/dist/esm/TitleBar.mjs.map +1 -0
  21. package/dist/esm/TitleBar.native.js +81 -0
  22. package/dist/esm/TitleBar.native.js.map +1 -0
  23. package/dist/esm/index.js +7 -0
  24. package/dist/esm/index.js.map +1 -0
  25. package/dist/esm/index.mjs +7 -0
  26. package/dist/esm/index.mjs.map +1 -0
  27. package/dist/esm/index.native.js +7 -0
  28. package/dist/esm/index.native.js.map +1 -0
  29. package/dist/esm/isTauri.mjs +5 -0
  30. package/dist/esm/isTauri.mjs.map +1 -0
  31. package/dist/esm/isTauri.native.js +5 -0
  32. package/dist/esm/isTauri.native.js.map +1 -0
  33. package/dist/esm/shortcuts.mjs +32 -0
  34. package/dist/esm/shortcuts.mjs.map +1 -0
  35. package/dist/esm/shortcuts.native.js +32 -0
  36. package/dist/esm/shortcuts.native.js.map +1 -0
  37. package/dist/esm/system.mjs +27 -0
  38. package/dist/esm/system.mjs.map +1 -0
  39. package/dist/esm/system.native.js +27 -0
  40. package/dist/esm/system.native.js.map +1 -0
  41. package/dist/esm/window.mjs +44 -0
  42. package/dist/esm/window.mjs.map +1 -0
  43. package/dist/esm/window.native.js +66 -0
  44. package/dist/esm/window.native.js.map +1 -0
  45. package/package.json +53 -0
  46. package/src/TitleBar.tsx +71 -0
  47. package/src/index.ts +13 -0
  48. package/src/isTauri.ts +12 -0
  49. package/src/shortcuts.ts +37 -0
  50. package/src/system.ts +27 -0
  51. package/src/window.ts +51 -0
@@ -0,0 +1,97 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var TitleBar_exports = {};
24
+ __export(TitleBar_exports, {
25
+ TitleBar: () => TitleBar
26
+ });
27
+ module.exports = __toCommonJS(TitleBar_exports);
28
+ var import_gui = require("@hanzo/gui");
29
+ var import_window = require("./window.cjs");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ const Control = (0, import_gui.styled)(import_gui.XStack, {
32
+ width: 46,
33
+ height: 32,
34
+ alignItems: "center",
35
+ justifyContent: "center",
36
+ cursor: "pointer",
37
+ hoverStyle: {
38
+ backgroundColor: "$color4"
39
+ },
40
+ pressStyle: {
41
+ backgroundColor: "$color5"
42
+ },
43
+ animation: "quick"
44
+ });
45
+ const Glyph = (0, import_gui.styled)(import_gui.Text, {
46
+ fontFamily: "$mono",
47
+ fontSize: 13,
48
+ lineHeight: 13,
49
+ color: "$color11"
50
+ });
51
+ function TitleBar({
52
+ title = ""
53
+ }) {
54
+ const {
55
+ minimize,
56
+ toggleMaximize,
57
+ close
58
+ } = (0, import_window.useWindowControls)();
59
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_gui.XStack, {
60
+ "data-tauri-drag-region": true,
61
+ height: 40,
62
+ alignItems: "center",
63
+ backgroundColor: "$background",
64
+ borderBottomWidth: 1,
65
+ borderBottomColor: "$borderColor",
66
+ userSelect: "none",
67
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui.Text, {
68
+ flex: 1,
69
+ paddingLeft: "$3",
70
+ fontFamily: "$body",
71
+ fontSize: 13,
72
+ color: "$color11",
73
+ "data-tauri-drag-region": true,
74
+ children: title
75
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_gui.XStack, {
76
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(Control, {
77
+ onPress: () => minimize(),
78
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Glyph, {
79
+ children: "\u2014"
80
+ })
81
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(Control, {
82
+ onPress: () => toggleMaximize(),
83
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Glyph, {
84
+ children: "\u25A2"
85
+ })
86
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(Control, {
87
+ onPress: () => close(),
88
+ hoverStyle: {
89
+ backgroundColor: "$red9"
90
+ },
91
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Glyph, {
92
+ children: "\u2715"
93
+ })
94
+ })]
95
+ })]
96
+ });
97
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var TitleBar_exports = {};
26
+ __export(TitleBar_exports, {
27
+ TitleBar: () => TitleBar
28
+ });
29
+ module.exports = __toCommonJS(TitleBar_exports);
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var import_gui = require("@hanzo/gui");
32
+ var import_window = require("./window.native.js");
33
+ var Control = (0, import_gui.styled)(import_gui.XStack, {
34
+ width: 46,
35
+ height: 32,
36
+ alignItems: "center",
37
+ justifyContent: "center",
38
+ cursor: "pointer",
39
+ hoverStyle: {
40
+ backgroundColor: "$color4"
41
+ },
42
+ pressStyle: {
43
+ backgroundColor: "$color5"
44
+ },
45
+ animation: "quick"
46
+ });
47
+ var Glyph = (0, import_gui.styled)(import_gui.Text, {
48
+ fontFamily: "$mono",
49
+ fontSize: 13,
50
+ lineHeight: 13,
51
+ color: "$color11"
52
+ });
53
+ function TitleBar(param) {
54
+ var {
55
+ title = ""
56
+ } = param;
57
+ var {
58
+ minimize,
59
+ toggleMaximize,
60
+ close
61
+ } = (0, import_window.useWindowControls)();
62
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_gui.XStack, {
63
+ // @ts-expect-error — Tauri drag region is a raw DOM attribute (web/webview)
64
+ "data-tauri-drag-region": true,
65
+ height: 40,
66
+ alignItems: "center",
67
+ backgroundColor: "$background",
68
+ borderBottomWidth: 1,
69
+ borderBottomColor: "$borderColor",
70
+ userSelect: "none",
71
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui.Text, {
72
+ flex: 1,
73
+ paddingLeft: "$3",
74
+ fontFamily: "$body",
75
+ fontSize: 13,
76
+ color: "$color11",
77
+ // @ts-expect-error — raw DOM attribute so clicks on the title still drag
78
+ "data-tauri-drag-region": true,
79
+ children: title
80
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_gui.XStack, {
81
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(Control, {
82
+ onPress: function () {
83
+ return minimize();
84
+ },
85
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Glyph, {
86
+ children: "\u2014"
87
+ })
88
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(Control, {
89
+ onPress: function () {
90
+ return toggleMaximize();
91
+ },
92
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Glyph, {
93
+ children: "\u25A2"
94
+ })
95
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(Control, {
96
+ onPress: function () {
97
+ return close();
98
+ },
99
+ hoverStyle: {
100
+ backgroundColor: "$red9"
101
+ },
102
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Glyph, {
103
+ children: "\u2715"
104
+ })
105
+ })]
106
+ })]
107
+ });
108
+ }
109
+ //# sourceMappingURL=TitleBar.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","TitleBar_exports","__export","TitleBar","module","exports","import_jsx_runtime","require","import_gui","import_window","Control","styled","XStack","width","height","alignItems","justifyContent","cursor","hoverStyle","backgroundColor","pressStyle","animation","Glyph","Text","fontFamily","fontSize","lineHeight","color","param","title","minimize","toggleMaximize","close","useWindowControls","jsxs","borderBottomWidth","borderBottomColor","userSelect","children","jsx","flex","paddingLeft","onPress"],"sources":["../../src/TitleBar.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,gBAAA;AAAAC,QAAA,CAAAD,gBAAA;EAAAE,QAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAqCT,YAAA,CAAAK,gBAAA;AACrC,IAAAK,kBAAkC,GAAAC,OAAA;AA4C5B,IAAAC,UAAA,GAAAD,OAAA;AApCN,IAAAE,aAAM,GAAUF,OAAA,sBAAO;AAAQ,IAC7BG,OAAO,OAAAF,UAAA,CAAAG,MAAA,EAAAH,UAAA,CAAAI,MAAA;EACPC,KAAA,IAAQ;EACRC,MAAA;EACAC,UAAA,UAAgB;EAChBC,cAAQ;EACRC,MAAA,WAAc;EACdC,UAAA,EAAY;IACZC,eAAW;EACZ;EAEDC,UAAM;IACJD,eAAY;EACZ;EACAE,SAAA;AAAY,EACZ;AACF,IAACC,KAAA,OAAAd,UAAA,CAAAG,MAAA,EAAAH,UAAA,CAAAe,IAAA;EAMMC,UAAS,SAAW;EACzBC,QAAQ;EAERC,UACE;EAAAC,KAAC;AAAA;AAAA,SAECxB,SAAAyB,KAAA;EAAsB,IACtB;IAAAC,KAAA,GAAQ;EAAA,IAAAD,KAAA;EAAA,IACR;IAAAE,QAAA;IAAWC,cAAA;IAAAC;EAAA,QAAAvB,aAAA,CAAAwB,iBAAA;EAAA,OACX,eAAgB,IAAA3B,kBAAA,CAAA4B,IAAA,EAAA1B,UAAA,CAAAI,MAAA;IAAA;IACG,wBACD;IAAAE,MAClB;IAAWC,UAEX;IAAAI,eAAA;IAAAgB,iBAAC;IAAAC,iBAAA;IAAAC,UACC,QAAM;IAAAC,QACN,GAAY,eACZ,EAAW,EAAAhC,kBAAA,CAAAiC,GAAA,EAAA/B,UAAA,CAAAe,IAAA;MAAAiB,IACX;MAAUC,WACJ;MAAAjB,UAEN;MAAsBC,QAErB;MAAAE,KAAA;MACH;MAEA;MACEW,QAAA,EAAAT;IAEA,IAGA,eACA,IAAAvB,kBAAA,CAAA4B,IAAA,EAAA1B,UAAC,CAAAI,MAAQ;MAET0B,QACF,sBAAAhC,kBAAA,CAAAiC,GAAA,EAAA7B,OAAA;QAAAgC,OAAA,WAAAA,CAAA;UACF,OAAAZ,QAAA;QAEJ","ignoreList":[]}
@@ -0,0 +1,41 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var index_exports = {};
24
+ __export(index_exports, {
25
+ TitleBar: () => import_TitleBar.TitleBar,
26
+ isTauri: () => import_isTauri.isTauri,
27
+ openExternal: () => import_system.openExternal,
28
+ readTextFile: () => import_system.readTextFile,
29
+ registerShortcut: () => import_shortcuts.registerShortcut,
30
+ unregisterShortcut: () => import_shortcuts.unregisterShortcut,
31
+ useGlobalShortcut: () => import_shortcuts.useGlobalShortcut,
32
+ useWindowControls: () => import_window.useWindowControls,
33
+ windowControls: () => import_window.windowControls,
34
+ writeTextFile: () => import_system.writeTextFile
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+ var import_isTauri = require("./isTauri.cjs");
38
+ var import_window = require("./window.cjs");
39
+ var import_shortcuts = require("./shortcuts.cjs");
40
+ var import_system = require("./system.cjs");
41
+ var import_TitleBar = require("./TitleBar.cjs");
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var index_exports = {};
26
+ __export(index_exports, {
27
+ TitleBar: () => import_TitleBar.TitleBar,
28
+ isTauri: () => import_isTauri.isTauri,
29
+ openExternal: () => import_system.openExternal,
30
+ readTextFile: () => import_system.readTextFile,
31
+ registerShortcut: () => import_shortcuts.registerShortcut,
32
+ unregisterShortcut: () => import_shortcuts.unregisterShortcut,
33
+ useGlobalShortcut: () => import_shortcuts.useGlobalShortcut,
34
+ useWindowControls: () => import_window.useWindowControls,
35
+ windowControls: () => import_window.windowControls,
36
+ writeTextFile: () => import_system.writeTextFile
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+ var import_isTauri = require("./isTauri.native.js");
40
+ var import_window = require("./window.native.js");
41
+ var import_shortcuts = require("./shortcuts.native.js");
42
+ var import_system = require("./system.native.js");
43
+ var import_TitleBar = require("./TitleBar.native.js");
44
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","TitleBar","import_TitleBar","isTauri","import_isTauri","openExternal","import_system","readTextFile","registerShortcut","import_shortcuts","unregisterShortcut","useGlobalShortcut","useWindowControls","import_window","windowControls","writeTextFile","module","exports","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,QAAA,EAAAA,CAAA,KAAAC,eAAA,CAAAD,QAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAC,cAAA,CAAAD,OAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAC,aAAA,CAAAD,YAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAD,aAAA,CAAAC,YAAA;EAAAC,gBAAA,EAAAA,CAAA,KAAAC,gBAAA,CAAAD,gBAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAD,gBAAA,CAAAC,kBAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAF,gBAAA,CAAAE,iBAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAC,aAAA,CAAAD,iBAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAD,aAAA,CAAAC,cAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAT,aAAA,CAAAS;AAAA;AAQAC,MAAA,CAAAC,OAAA,GAAAvB,YAAwB,CAAAK,aAAA;AACxB,IAAAK,cAAA,GAAkDc,OAAA;AAClD,IAAAL,aAAA,GAAAK,OAAwE;AACxE,IAAAT,gBAA0D,GAAAS,OAAA;AAC1D,IAAAZ,aAAA,GAAAY,OAA6C","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var isTauri_exports = {};
24
+ __export(isTauri_exports, {
25
+ isTauri: () => isTauri
26
+ });
27
+ module.exports = __toCommonJS(isTauri_exports);
28
+ function isTauri() {
29
+ return typeof window !== "undefined" && (!!window.__TAURI_INTERNALS__ || window.isTauri === true);
30
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var isTauri_exports = {};
26
+ __export(isTauri_exports, {
27
+ isTauri: () => isTauri
28
+ });
29
+ module.exports = __toCommonJS(isTauri_exports);
30
+ function isTauri() {
31
+ return typeof window !== "undefined" && (!!window.__TAURI_INTERNALS__ || window.isTauri === true);
32
+ }
33
+ //# sourceMappingURL=isTauri.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","isTauri_exports","__export","isTauri","module","exports","window","__TAURI_INTERNALS__"],"sources":["../../src/isTauri.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAA;AAAA;AAMOC,MAAA,CAAAC,OAAS,GAAAT,YAAmB,CAAAK,eAAA;AACjC,SACEE,OAAOA,CAAA;EAGX,cAAAG,MAAA,uBAAAA,MAAA,CAAAC,mBAAA,IAAAD,MAAA,CAAAH,OAAA","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var shortcuts_exports = {};
35
+ __export(shortcuts_exports, {
36
+ registerShortcut: () => registerShortcut,
37
+ unregisterShortcut: () => unregisterShortcut,
38
+ useGlobalShortcut: () => useGlobalShortcut
39
+ });
40
+ module.exports = __toCommonJS(shortcuts_exports);
41
+ var import_react = require("react");
42
+ var import_isTauri = require("./isTauri.cjs");
43
+ async function registerShortcut(accelerator, handler) {
44
+ if (!(0, import_isTauri.isTauri)()) return;
45
+ const {
46
+ register
47
+ } = await import("@tauri-apps/plugin-global-shortcut");
48
+ await register(accelerator, event => {
49
+ if (event.state === "Pressed") handler();
50
+ });
51
+ }
52
+ async function unregisterShortcut(accelerator) {
53
+ if (!(0, import_isTauri.isTauri)()) return;
54
+ const {
55
+ unregister
56
+ } = await import("@tauri-apps/plugin-global-shortcut");
57
+ await unregister(accelerator);
58
+ }
59
+ function useGlobalShortcut(accelerator, handler) {
60
+ (0, import_react.useEffect)(() => {
61
+ if (!(0, import_isTauri.isTauri)()) return;
62
+ let cancelled = false;
63
+ registerShortcut(accelerator, handler).catch(() => {});
64
+ return () => {
65
+ cancelled = true;
66
+ void cancelled;
67
+ unregisterShortcut(accelerator).catch(() => {});
68
+ };
69
+ }, [accelerator, handler]);
70
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
36
+ var shortcuts_exports = {};
37
+ __export(shortcuts_exports, {
38
+ registerShortcut: () => registerShortcut,
39
+ unregisterShortcut: () => unregisterShortcut,
40
+ useGlobalShortcut: () => useGlobalShortcut
41
+ });
42
+ module.exports = __toCommonJS(shortcuts_exports);
43
+ var import_react = require("react");
44
+ var import_isTauri = require("./isTauri.native.js");
45
+ async function registerShortcut(accelerator, handler) {
46
+ if (!(0, import_isTauri.isTauri)()) return;
47
+ var {
48
+ register
49
+ } = await import("@tauri-apps/plugin-global-shortcut");
50
+ await register(accelerator, function (event) {
51
+ if (event.state === "Pressed") handler();
52
+ });
53
+ }
54
+ async function unregisterShortcut(accelerator) {
55
+ if (!(0, import_isTauri.isTauri)()) return;
56
+ var {
57
+ unregister
58
+ } = await import("@tauri-apps/plugin-global-shortcut");
59
+ await unregister(accelerator);
60
+ }
61
+ function useGlobalShortcut(accelerator, handler) {
62
+ (0, import_react.useEffect)(function () {
63
+ if (!(0, import_isTauri.isTauri)()) return;
64
+ var cancelled = false;
65
+ registerShortcut(accelerator, handler).catch(function () {});
66
+ return function () {
67
+ cancelled = true;
68
+ void cancelled;
69
+ unregisterShortcut(accelerator).catch(function () {});
70
+ };
71
+ }, [accelerator, handler]);
72
+ }
73
+ //# sourceMappingURL=shortcuts.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","shortcuts_exports","__export","registerShortcut","unregisterShortcut","useGlobalShortcut","module","exports","import_react","require","import_isTauri","accelerator","handler","isTauri","register","event","state","unregister","useEffect","cancelled","catch"],"sources":["../../src/shortcuts.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iBAAA;AAAAC,QAAA,CAAAD,iBAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAA,gBAAA;EAAAC,kBAAA,EAAAA,CAAA,KAAAA,kBAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAX,YAA0B,CAAAK,iBAAA;AAC1B,IAAAO,YAAA,GAAAC,OAAwB;AAMxB,IAAAC,cAAsB,GAAAD,OAAA,sBACpB;AAGA,eAAKN,iBAAAQ,WAAW,EAAAC,OAAA;EAChB,MAAM,GAAEF,cAAa,CAAAG,OAAM,GAAO;EAClC;IAAMC;EAAS,gBAAc,qCAAU;EACrC,MAAIA,QAAM,CAAAH,WAAU,YAAWI,KAAQ;IACxC,IAAAA,KAAA,CAAAC,KAAA,gBAAAJ,OAAA;EACH;AAEA;AACE,eAAKR,mBAAAO,WAAW;EAChB,MAAM,GAAED,cAAe,CAAAG,OAAM,KAAO;EACpC;IAAMI;EAAW,gBAAW;EAC9B,MAAAA,UAAA,CAAAN,WAAA;AAGO;AACL,SAAAN,kBAAAM,WAAgB,EAAAC,OAAA;EACd,IAAAJ,YAAK,CAAAU,SAAA,cAAW;IAChB,IAAI,KAAAR,cAAY,CAAAG,OAAA;IAChB,IAAAM,SAAA,QAAiB;IAAmChB,gBAAC,CAAAQ,WAAA,EAAAC,OAAA,EAAAQ,KAAA,cACrD;IACE,mBAAY;MACZD,SAAK;MACL,KAAAA,SAAA;MAA6Cf,kBAAC,CAAAO,WAAA,EAAAS,KAAA,cAChD;IACF,CAAG;EACL,I","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var system_exports = {};
35
+ __export(system_exports, {
36
+ openExternal: () => openExternal,
37
+ readTextFile: () => readTextFile,
38
+ writeTextFile: () => writeTextFile
39
+ });
40
+ module.exports = __toCommonJS(system_exports);
41
+ var import_isTauri = require("./isTauri.cjs");
42
+ async function readTextFile(path) {
43
+ if (!(0, import_isTauri.isTauri)()) throw new Error("readTextFile is only available under Tauri");
44
+ const {
45
+ readTextFile: readTextFile2
46
+ } = await import("@tauri-apps/plugin-fs");
47
+ return readTextFile2(path);
48
+ }
49
+ async function writeTextFile(path, contents) {
50
+ if (!(0, import_isTauri.isTauri)()) throw new Error("writeTextFile is only available under Tauri");
51
+ const {
52
+ writeTextFile: writeTextFile2
53
+ } = await import("@tauri-apps/plugin-fs");
54
+ return writeTextFile2(path, contents);
55
+ }
56
+ async function openExternal(url) {
57
+ if (!(0, import_isTauri.isTauri)()) {
58
+ if (typeof window !== "undefined") window.open(url, "_blank", "noopener");
59
+ return;
60
+ }
61
+ const {
62
+ open
63
+ } = await import("@tauri-apps/plugin-shell");
64
+ await open(url);
65
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
36
+ var system_exports = {};
37
+ __export(system_exports, {
38
+ openExternal: () => openExternal,
39
+ readTextFile: () => readTextFile,
40
+ writeTextFile: () => writeTextFile
41
+ });
42
+ module.exports = __toCommonJS(system_exports);
43
+ var import_isTauri = require("./isTauri.native.js");
44
+ async function readTextFile(path) {
45
+ if (!(0, import_isTauri.isTauri)()) throw new Error("readTextFile is only available under Tauri");
46
+ var {
47
+ readTextFile: readTextFile2
48
+ } = await import("@tauri-apps/plugin-fs");
49
+ return readTextFile2(path);
50
+ }
51
+ async function writeTextFile(path, contents) {
52
+ if (!(0, import_isTauri.isTauri)()) throw new Error("writeTextFile is only available under Tauri");
53
+ var {
54
+ writeTextFile: writeTextFile2
55
+ } = await import("@tauri-apps/plugin-fs");
56
+ return writeTextFile2(path, contents);
57
+ }
58
+ async function openExternal(url) {
59
+ if (!(0, import_isTauri.isTauri)()) {
60
+ if (typeof window !== "undefined") window.open(url, "_blank", "noopener");
61
+ return;
62
+ }
63
+ var {
64
+ open
65
+ } = await import("@tauri-apps/plugin-shell");
66
+ await open(url);
67
+ }
68
+ //# sourceMappingURL=system.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","system_exports","__export","openExternal","readTextFile","writeTextFile","module","exports","import_isTauri","require","path","isTauri","Error","readTextFile2","contents","writeTextFile2","url","window","open"],"sources":["../../src/system.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,cAAA;AAAAC,QAAA,CAAAD,cAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAA,YAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA,YAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAX,YAAwB,CAAAK,cAAA;AAMxB,IAAAO,cAAsB,GAAAC,OAAa,sBAA+B;AAChE,eAAKL,aAAAM,IAAA;EACL,MAAM,GAAEF,cAAA,CAAAG,OAAA,KAAa,MAAI,IAAMC,KAAA,6CAA8B;EAC7D;IAAAR,YAAO,EAAAS;EAAiB;EAC1B,OAAAA,aAAA,CAAAH,IAAA;AAEA;AACE,eAAKL,cAAAK,IAAA,EAAQI,QAAG,EAAM;EACtB,MAAM,GAAEN,cAAA,CAAAG,OAAA,WAAkB,IAAAC,KAAM,8CAA8B;EAC9D;IAAAP,aAAO,EAAAU;EAA4B;EACrC,OAAAA,cAAA,CAAAL,IAAA,EAAAI,QAAA;AAGA;AACE,eAAKX,aAAAa,GAAA;EACH,MAAI,GAAAR,cAAO,CAAWG,OAAA,KAAa;IACnC,WAAAM,MAAA,kBAAAA,MAAA,CAAAC,IAAA,CAAAF,GAAA;IACF;EACA;EACA;IAAME;EAAK,IAAG;EAChB,MAAAA,IAAA,CAAAF,GAAA","ignoreList":[]}