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 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.13.1";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "3.13.1",
3
+ "version": "3.14.0",
4
4
  "description": "🤱🏻 Turn any webpage into a desktop app with one command. 🤱🏻 一键打包网页生成轻量桌面应用。",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -2564,7 +2564,7 @@ dependencies = [
2564
2564
 
2565
2565
  [[package]]
2566
2566
  name = "pake"
2567
- version = "3.13.1"
2567
+ version = "3.14.0"
2568
2568
  dependencies = [
2569
2569
  "objc2",
2570
2570
  "objc2-app-kit",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pake"
3
- version = "3.13.1"
3
+ version = "3.14.0"
4
4
  description = "🤱🏻 Turn any webpage into a desktop app with Rust."
5
5
  authors = ["Tw93"]
6
6
  license = "GPL-3.0-or-later"
Binary file
Binary file
@@ -4,6 +4,7 @@
4
4
  "url": "https://weekly.tw93.fun/en",
5
5
  "url_type": "web",
6
6
  "hide_title_bar": true,
7
+ "hide_window_decorations": false,
7
8
  "fullscreen": false,
8
9
  "width": 1200,
9
10
  "height": 780,
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -4,6 +4,8 @@ use serde::{Deserialize, Serialize};
4
4
  pub struct WindowConfig {
5
5
  pub url: String,
6
6
  pub hide_title_bar: bool,
7
+ #[serde(default)]
8
+ pub hide_window_decorations: bool,
7
9
  pub fullscreen: bool,
8
10
  pub maximize: bool,
9
11
  pub width: f64,
@@ -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: parseFloat(zoom) }).catch(() => {});
22
+ invoke("set_zoom", { percent: zoomPercent }).catch(() => {});
21
23
  }
22
24
 
23
- window.localStorage.setItem("htmlZoom", zoom);
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(parseInt(currentZoom) + 10, 200)}%`);
34
+ zoomCommon((currentZoom) => `${Math.min(currentZoom + 10, 200)}%`);
33
35
  }
34
36
 
35
37
  function zoomOut() {
36
- zoomCommon((currentZoom) => `${Math.max(parseInt(currentZoom) - 10, 30)}%`);
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 /windows|linux/i.test(navigator.userAgent);
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
- domEl.addEventListener("touchstart", () => {
514
- appWindow.startDragging();
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
- domEl.addEventListener("dblclick", () => {
525
- appWindow.isFullscreen().then((fullscreen) => {
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"]?.hide_title_bar && isMac) {
505
+ if (hasImmersiveHeader(window["pakeConfig"])) {
501
506
  const topPaddingStyleElement = document.createElement("style");
502
- topPaddingStyleElement.textContent = topPaddingCSS;
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
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "productName": "Weekly",
3
3
  "identifier": "com.pake.weekly",
4
- "version": "3.13.1",
4
+ "version": "3.14.0",
5
5
  "app": {
6
6
  "withGlobalTauri": true,
7
7
  "trayIcon": {