pake-cli 3.13.1 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/dist/cli.js +8 -1
- package/package.json +1 -1
- package/src-tauri/Cargo.lock +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/icons/notion.icns +0 -0
- package/src-tauri/icons/youtubemusic.icns +0 -0
- package/src-tauri/pake.json +1 -0
- package/src-tauri/png/notion_256.ico +0 -0
- package/src-tauri/png/notion_32.ico +0 -0
- package/src-tauri/png/notion_512.png +0 -0
- package/src-tauri/png/youtubemusic_256.ico +0 -0
- package/src-tauri/png/youtubemusic_32.ico +0 -0
- package/src-tauri/png/youtubemusic_512.png +0 -0
- package/src-tauri/src/app/config.rs +2 -0
- package/src-tauri/src/app/window.rs +4 -0
- package/src-tauri/src/inject/event.js +71 -20
- package/src-tauri/src/inject/style.js +27 -2
- package/src-tauri/tauri.conf.json +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,22 @@
|
|
|
130
130
|
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Excalidraw.png width=600/></td>
|
|
131
131
|
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/XiaoHongShu.png width=600/></td>
|
|
132
132
|
</tr>
|
|
133
|
+
<tr>
|
|
134
|
+
<td>Notion
|
|
135
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Notion.dmg">Mac</a>
|
|
136
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Notion_x64.msi">Windows</a>
|
|
137
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Notion_x86_64.deb">Linux</a>
|
|
138
|
+
</td>
|
|
139
|
+
<td>Flomo
|
|
140
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Mac</a>
|
|
141
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo_x64.msi">Windows</a>
|
|
142
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo_x86_64.deb">Linux</a>
|
|
143
|
+
</td>
|
|
144
|
+
</tr>
|
|
145
|
+
<tr>
|
|
146
|
+
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Notion.png width=600/></td>
|
|
147
|
+
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Flomo.png width=600/></td>
|
|
148
|
+
</tr>
|
|
133
149
|
</table>
|
|
134
150
|
|
|
135
151
|
<details>
|
|
@@ -153,8 +169,9 @@
|
|
|
153
169
|
| <kbd>⌘</kbd> + <kbd>⇧</kbd> + <kbd>H</kbd> | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>H</kbd> | Go to Home Page |
|
|
154
170
|
| <kbd>⌘</kbd> + <kbd>⌥</kbd> + <kbd>I</kbd> | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>I</kbd> | Toggle Developer Tools (Debug Only) |
|
|
155
171
|
| <kbd>⌘</kbd> + <kbd>⇧</kbd> + <kbd>⌫</kbd> | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Del</kbd> | Clear Cache & Restart |
|
|
172
|
+
| <kbd>⌃</kbd> + <kbd>⌘</kbd> + <kbd>F</kbd> | <kbd>F11</kbd> | Toggle native window fullscreen |
|
|
156
173
|
|
|
157
|
-
In addition, double-click the title bar to switch to full-screen mode. For Mac users, you can also use the gesture to go to the previous or next page and drag the title bar to move the window. The new menu also offers options for navigation, zoom, and window controls.
|
|
174
|
+
In addition, double-click the title bar to switch to full-screen mode. On Windows and Linux, use `--hide-window-decorations` for a frameless window with a top drag region. For Mac users, you can also use the gesture to go to the previous or next page and drag the title bar to move the window. The new menu also offers options for navigation, zoom, and window controls.
|
|
158
175
|
|
|
159
176
|
</details>
|
|
160
177
|
|
package/dist/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ import * as psl from 'psl';
|
|
|
20
20
|
import { InvalidArgumentError, program as program$1, Option } from 'commander';
|
|
21
21
|
|
|
22
22
|
var name = "pake-cli";
|
|
23
|
-
var version = "3.
|
|
23
|
+
var version = "3.14.0";
|
|
24
24
|
var description = "🤱🏻 Turn any webpage into a desktop app with one command. 🤱🏻 一键打包网页生成轻量桌面应用。";
|
|
25
25
|
var engines = {
|
|
26
26
|
node: ">=18.0.0"
|
|
@@ -535,6 +535,7 @@ function resolveLinuxBundleTargets(targets) {
|
|
|
535
535
|
function buildWindowConfigOverrides(options, platform = asSupportedPlatform(process.platform)) {
|
|
536
536
|
const platformHideOnClose = options.hideOnClose ?? platform === 'darwin';
|
|
537
537
|
const platformHideTitleBar = platform === 'darwin' ? options.hideTitleBar : false;
|
|
538
|
+
const platformHideWindowDecorations = platform !== 'darwin' ? options.hideWindowDecorations : false;
|
|
538
539
|
return {
|
|
539
540
|
width: options.width,
|
|
540
541
|
height: options.height,
|
|
@@ -542,6 +543,7 @@ function buildWindowConfigOverrides(options, platform = asSupportedPlatform(proc
|
|
|
542
543
|
maximize: options.maximize,
|
|
543
544
|
resizable: options.resizable ?? true,
|
|
544
545
|
hide_title_bar: platformHideTitleBar,
|
|
546
|
+
hide_window_decorations: platformHideWindowDecorations,
|
|
545
547
|
activation_shortcut: options.activationShortcut,
|
|
546
548
|
always_on_top: options.alwaysOnTop,
|
|
547
549
|
dark_mode: options.darkMode,
|
|
@@ -827,6 +829,9 @@ async function mergeConfig(url, options, tauriConf) {
|
|
|
827
829
|
if (options.hideTitleBar && platform !== 'darwin') {
|
|
828
830
|
logger.warn('✼ --hide-title-bar is only supported on macOS and will be ignored on this platform.');
|
|
829
831
|
}
|
|
832
|
+
if (options.hideWindowDecorations && platform === 'darwin') {
|
|
833
|
+
logger.warn('✼ --hide-window-decorations is only supported on Windows and Linux and will be ignored on this platform.');
|
|
834
|
+
}
|
|
830
835
|
const tauriConfWindowOptions = buildWindowConfigOverrides(options, platform);
|
|
831
836
|
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
|
832
837
|
tauriConf.productName = name;
|
|
@@ -2728,6 +2733,7 @@ const DEFAULT_PAKE_OPTIONS = {
|
|
|
2728
2733
|
fullscreen: false,
|
|
2729
2734
|
maximize: false,
|
|
2730
2735
|
hideTitleBar: false,
|
|
2736
|
+
hideWindowDecorations: false,
|
|
2731
2737
|
alwaysOnTop: false,
|
|
2732
2738
|
appVersion: '1.0.0',
|
|
2733
2739
|
darkMode: false,
|
|
@@ -2829,6 +2835,7 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with
|
|
|
2829
2835
|
.option('--use-local-file', 'Use local file packaging', DEFAULT_PAKE_OPTIONS.useLocalFile)
|
|
2830
2836
|
.option('--fullscreen', 'Start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
|
|
2831
2837
|
.option('--hide-title-bar', 'For Mac, hide title bar', DEFAULT_PAKE_OPTIONS.hideTitleBar)
|
|
2838
|
+
.option('--hide-window-decorations', 'Hide native window decorations on Windows and Linux', DEFAULT_PAKE_OPTIONS.hideWindowDecorations)
|
|
2832
2839
|
.option('--multi-arch', 'For Mac, both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch)
|
|
2833
2840
|
.option('--inject <files>', 'Inject local CSS/JS files into the page', (val, previous) => {
|
|
2834
2841
|
if (!val)
|
package/package.json
CHANGED
package/src-tauri/Cargo.lock
CHANGED
package/src-tauri/Cargo.toml
CHANGED
|
Binary file
|
|
Binary file
|
package/src-tauri/pake.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -380,6 +380,10 @@ fn build_window(
|
|
|
380
380
|
{
|
|
381
381
|
window_builder = window_builder.data_directory(_data_dir).theme(theme);
|
|
382
382
|
|
|
383
|
+
if window_config.hide_window_decorations {
|
|
384
|
+
window_builder = window_builder.decorations(false);
|
|
385
|
+
}
|
|
386
|
+
|
|
383
387
|
if !config.proxy_url.is_empty() {
|
|
384
388
|
if let Ok(proxy_url) = Url::from_str(&config.proxy_url) {
|
|
385
389
|
parsed_proxy_url = Some(proxy_url.clone());
|
|
@@ -15,25 +15,32 @@ function setZoom(zoom) {
|
|
|
15
15
|
// CSS hacks. `transform: scale` and `html.style.zoom` break complex SPAs like
|
|
16
16
|
// ChatGPT: the page shifts right on Windows and parts of the UI stop repainting
|
|
17
17
|
// on macOS. Native zoom recalculates layout exactly like a browser does.
|
|
18
|
+
const zoomPercent = normalizeZoomPercent(zoom);
|
|
19
|
+
const normalizedZoom = `${zoomPercent}%`;
|
|
18
20
|
const invoke = window.__TAURI__?.core?.invoke;
|
|
19
21
|
if (invoke) {
|
|
20
|
-
invoke("set_zoom", { percent:
|
|
22
|
+
invoke("set_zoom", { percent: zoomPercent }).catch(() => {});
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
window.localStorage.setItem("htmlZoom",
|
|
25
|
+
window.localStorage.setItem("htmlZoom", normalizedZoom);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
function zoomCommon(zoomChange) {
|
|
27
29
|
const currentZoom = window.localStorage.getItem("htmlZoom") || "100%";
|
|
28
|
-
setZoom(zoomChange(currentZoom));
|
|
30
|
+
setZoom(zoomChange(normalizeZoomPercent(currentZoom)));
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
function zoomIn() {
|
|
32
|
-
zoomCommon((currentZoom) => `${Math.min(
|
|
34
|
+
zoomCommon((currentZoom) => `${Math.min(currentZoom + 10, 200)}%`);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
function zoomOut() {
|
|
36
|
-
zoomCommon((currentZoom) => `${Math.max(
|
|
38
|
+
zoomCommon((currentZoom) => `${Math.max(currentZoom - 10, 30)}%`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function normalizeZoomPercent(zoom) {
|
|
42
|
+
const parsed = parseFloat(zoom);
|
|
43
|
+
return Number.isFinite(parsed) ? parsed : 100;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
let pasteAsPlainTextPending = false;
|
|
@@ -53,8 +60,51 @@ function handleShortcut(event) {
|
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
|
|
63
|
+
function toggleNativeFullscreen(appWindow) {
|
|
64
|
+
appWindow
|
|
65
|
+
.isFullscreen()
|
|
66
|
+
.then((fullscreen) => appWindow.setFullscreen(!fullscreen))
|
|
67
|
+
.catch((error) => {
|
|
68
|
+
console.warn("[Pake] Failed to toggle native fullscreen:", error);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function handleWindowFullscreenShortcut(event) {
|
|
73
|
+
if (
|
|
74
|
+
!event.isTrusted ||
|
|
75
|
+
event.repeat ||
|
|
76
|
+
event.key !== "F11" ||
|
|
77
|
+
!isNonMacDesktop()
|
|
78
|
+
) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const appWindow = window.__TAURI__?.window?.getCurrentWindow?.();
|
|
83
|
+
if (!appWindow) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
event.stopImmediatePropagation();
|
|
89
|
+
toggleNativeFullscreen(appWindow);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function getDesktopPlatform() {
|
|
93
|
+
return (
|
|
94
|
+
navigator.userAgentData?.platform ||
|
|
95
|
+
navigator.platform ||
|
|
96
|
+
navigator.userAgent
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
56
100
|
function isNonMacDesktop() {
|
|
57
|
-
return /
|
|
101
|
+
return /win|linux/i.test(getDesktopPlatform());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function hasImmersiveHeader(config = window["pakeConfig"] || {}) {
|
|
105
|
+
return /mac/i.test(getDesktopPlatform())
|
|
106
|
+
? config.hide_title_bar === true
|
|
107
|
+
: config.hide_window_decorations === true;
|
|
58
108
|
}
|
|
59
109
|
|
|
60
110
|
function isEditableElement(element) {
|
|
@@ -502,7 +552,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
502
552
|
}
|
|
503
553
|
}
|
|
504
554
|
|
|
505
|
-
if (!document.getElementById("pake-top-dom")) {
|
|
555
|
+
if (!document.getElementById("pake-top-dom") && hasImmersiveHeader()) {
|
|
506
556
|
const topDom = document.createElement("div");
|
|
507
557
|
topDom.id = "pake-top-dom";
|
|
508
558
|
document.body.appendChild(topDom);
|
|
@@ -510,24 +560,25 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
510
560
|
|
|
511
561
|
const domEl = document.getElementById("pake-top-dom");
|
|
512
562
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
domEl.addEventListener("mousedown", (e) => {
|
|
518
|
-
e.preventDefault();
|
|
519
|
-
if (e.buttons === 1 && e.detail !== 2) {
|
|
563
|
+
if (domEl) {
|
|
564
|
+
domEl.addEventListener("touchstart", () => {
|
|
520
565
|
appWindow.startDragging();
|
|
521
|
-
}
|
|
522
|
-
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
domEl.addEventListener("mousedown", (e) => {
|
|
569
|
+
e.preventDefault();
|
|
570
|
+
if (e.buttons === 1 && e.detail !== 2) {
|
|
571
|
+
appWindow.startDragging();
|
|
572
|
+
}
|
|
573
|
+
});
|
|
523
574
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
appWindow.setFullscreen(!fullscreen);
|
|
575
|
+
domEl.addEventListener("dblclick", () => {
|
|
576
|
+
toggleNativeFullscreen(appWindow);
|
|
527
577
|
});
|
|
528
|
-
}
|
|
578
|
+
}
|
|
529
579
|
|
|
530
580
|
if (window["pakeConfig"]?.disabled_web_shortcuts !== true) {
|
|
581
|
+
document.addEventListener("keydown", handleWindowFullscreenShortcut, true);
|
|
531
582
|
document.addEventListener("keyup", (event) => {
|
|
532
583
|
if (/windows|linux/i.test(navigator.userAgent) && event.ctrlKey) {
|
|
533
584
|
handleShortcut(event);
|
|
@@ -403,6 +403,11 @@ window.addEventListener("DOMContentLoaded", (_event) => {
|
|
|
403
403
|
padding-top: 0px;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
#notion-app .notion-sidebar,#notion-app .notion-topbar{
|
|
407
|
+
padding-top: 20px;
|
|
408
|
+
box-sizing: content-box;
|
|
409
|
+
}
|
|
410
|
+
|
|
406
411
|
#header-area > div > .css-gtiexd > div:nth-child(1) > div, #header-area .logoIcon .user-info{
|
|
407
412
|
padding-top: 20px;
|
|
408
413
|
}
|
|
@@ -497,9 +502,29 @@ window.addEventListener("DOMContentLoaded", (_event) => {
|
|
|
497
502
|
}
|
|
498
503
|
`;
|
|
499
504
|
const isMac = /Mac/i.test(navigator.userAgent);
|
|
500
|
-
if (window["pakeConfig"]
|
|
505
|
+
if (hasImmersiveHeader(window["pakeConfig"])) {
|
|
501
506
|
const topPaddingStyleElement = document.createElement("style");
|
|
502
|
-
topPaddingStyleElement.textContent =
|
|
507
|
+
topPaddingStyleElement.textContent = isMac
|
|
508
|
+
? topPaddingCSS
|
|
509
|
+
: `
|
|
510
|
+
#pake-top-dom:active {
|
|
511
|
+
cursor: grabbing;
|
|
512
|
+
cursor: -webkit-grabbing;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
#pake-top-dom {
|
|
516
|
+
position: fixed;
|
|
517
|
+
background: transparent;
|
|
518
|
+
top: 0;
|
|
519
|
+
width: 100%;
|
|
520
|
+
height: 20px;
|
|
521
|
+
cursor: grab;
|
|
522
|
+
-webkit-app-region: drag;
|
|
523
|
+
user-select: none;
|
|
524
|
+
-webkit-user-select: none;
|
|
525
|
+
z-index: 99999;
|
|
526
|
+
}
|
|
527
|
+
`;
|
|
503
528
|
document.head.appendChild(topPaddingStyleElement);
|
|
504
529
|
}
|
|
505
530
|
});
|