gantry-web 0.1.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 +47 -0
- package/package.json +43 -0
- package/src/DragStrip.tsx +36 -0
- package/src/ResizeFrame.tsx +40 -0
- package/src/TitleBar.tsx +137 -0
- package/src/app.tsx +155 -0
- package/src/bridge.ts +94 -0
- package/src/gostate.ts +29 -0
- package/src/hooks.ts +31 -0
- package/src/index.ts +20 -0
- package/src/paired.ts +57 -0
- package/src/router.tsx +154 -0
- package/src/service.ts +82 -0
- package/src/socket.ts +187 -0
- package/src/styles.css +309 -0
- package/src/tea/Runtime.tsx +195 -0
- package/src/tea/index.ts +5 -0
- package/src/vite/index.js +203 -0
- package/src/zoom.ts +21 -0
- package/types/index.d.ts +36 -0
package/src/zoom.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Desktop apps do not zoom. The webview inherits browser zoom gestures
|
|
2
|
+
// (Ctrl+wheel, Ctrl +/-/0), which feel broken in something pretending to
|
|
3
|
+
// be a native window - suppress them. createApp() installs this
|
|
4
|
+
// automatically; call it yourself only when wiring React manually.
|
|
5
|
+
|
|
6
|
+
export function installZoomGuard(): () => void {
|
|
7
|
+
const onWheel = (e: WheelEvent) => {
|
|
8
|
+
if (e.ctrlKey) e.preventDefault();
|
|
9
|
+
};
|
|
10
|
+
const onKey = (e: KeyboardEvent) => {
|
|
11
|
+
if (e.ctrlKey && (e.key === "+" || e.key === "-" || e.key === "=" || e.key === "0")) {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
window.addEventListener("wheel", onWheel, { passive: false });
|
|
16
|
+
window.addEventListener("keydown", onKey);
|
|
17
|
+
return () => {
|
|
18
|
+
window.removeEventListener("wheel", onWheel);
|
|
19
|
+
window.removeEventListener("keydown", onKey);
|
|
20
|
+
};
|
|
21
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Ambient types for the module the Gantry Vite plugin generates. This
|
|
2
|
+
// file keeps editors happy without the synthesized .gantry/ folder
|
|
3
|
+
// existing - include it via tsconfig "types": ["gantry-web/types"].
|
|
4
|
+
|
|
5
|
+
declare module "virtual:gantry-app" {
|
|
6
|
+
import type { FC, ReactNode } from "react";
|
|
7
|
+
|
|
8
|
+
export interface GantryPageModule {
|
|
9
|
+
default: FC;
|
|
10
|
+
/** export const chrome = false to hide the TitleBar on this page. */
|
|
11
|
+
chrome?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Which layouts/ wrap this page: a name ("compact"), several nested
|
|
14
|
+
* outermost-first (["main", "compact"]), false for none, true to
|
|
15
|
+
* force "main" even on a chromeless page. Default: "main" if it
|
|
16
|
+
* exists (chromeless pages default to none).
|
|
17
|
+
*/
|
|
18
|
+
layout?: boolean | string | string[];
|
|
19
|
+
/** export const route = "/custom" to override the derived route. */
|
|
20
|
+
route?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface GantryPage {
|
|
24
|
+
key: string;
|
|
25
|
+
route: string;
|
|
26
|
+
mod: GantryPageModule;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const pages: GantryPage[];
|
|
30
|
+
export const components: Record<string, { default: FC }>;
|
|
31
|
+
/** Layouts by short name: layouts/main/main.tsx -> "main". */
|
|
32
|
+
export const layouts: Record<string, { default: FC<{ children?: ReactNode }> }>;
|
|
33
|
+
/** The root app.tsx module (default export: CreateAppOptions), or null. */
|
|
34
|
+
export const appConfig: { default: import("gantry-web").CreateAppOptions } | null;
|
|
35
|
+
export const singlePage: boolean;
|
|
36
|
+
}
|