pomium 1.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.
- package/README.md +96 -0
- package/assets/atlases.json +38 -0
- package/assets/desktop/char_01_desktop.json +783 -0
- package/assets/desktop/char_01_desktop.webp +0 -0
- package/assets/desktop/char_02_desktop.json +783 -0
- package/assets/desktop/char_02_desktop.webp +0 -0
- package/assets/desktop/char_03_desktop.json +783 -0
- package/assets/desktop/char_03_desktop.webp +0 -0
- package/assets/desktop/char_04_desktop.json +783 -0
- package/assets/desktop/char_04_desktop.webp +0 -0
- package/assets/desktop/char_05_desktop.json +783 -0
- package/assets/desktop/char_05_desktop.webp +0 -0
- package/assets/desktop/char_06_desktop.json +783 -0
- package/assets/desktop/char_06_desktop.webp +0 -0
- package/assets/desktop/char_07_desktop.json +783 -0
- package/assets/desktop/char_07_desktop.webp +0 -0
- package/assets/desktop/char_08_desktop.json +783 -0
- package/assets/desktop/char_08_desktop.webp +0 -0
- package/assets/desktop/char_09_desktop.json +783 -0
- package/assets/desktop/char_09_desktop.webp +0 -0
- package/assets/desktop/char_10_desktop.json +783 -0
- package/assets/desktop/char_10_desktop.webp +0 -0
- package/assets/desktop/shockwave_desktop.json +151 -0
- package/assets/desktop/shockwave_desktop.webp +0 -0
- package/assets/mobile/char_01_mobile.json +783 -0
- package/assets/mobile/char_01_mobile.webp +0 -0
- package/assets/mobile/char_02_mobile.json +783 -0
- package/assets/mobile/char_02_mobile.webp +0 -0
- package/assets/mobile/char_03_mobile.json +783 -0
- package/assets/mobile/char_03_mobile.webp +0 -0
- package/assets/mobile/char_04_mobile.json +783 -0
- package/assets/mobile/char_04_mobile.webp +0 -0
- package/assets/mobile/char_05_mobile.json +783 -0
- package/assets/mobile/char_05_mobile.webp +0 -0
- package/assets/mobile/char_06_mobile.json +783 -0
- package/assets/mobile/char_06_mobile.webp +0 -0
- package/assets/mobile/char_07_mobile.json +783 -0
- package/assets/mobile/char_07_mobile.webp +0 -0
- package/assets/mobile/char_08_mobile.json +783 -0
- package/assets/mobile/char_08_mobile.webp +0 -0
- package/assets/mobile/char_09_mobile.json +783 -0
- package/assets/mobile/char_09_mobile.webp +0 -0
- package/assets/mobile/char_10_mobile.json +783 -0
- package/assets/mobile/char_10_mobile.webp +0 -0
- package/assets/mobile/shockwave_mobile.json +151 -0
- package/assets/mobile/shockwave_mobile.webp +0 -0
- package/bin/pomium.js +20 -0
- package/package.json +32 -0
- package/src/main.js +114 -0
- package/src/pom/atlas-loader.js +21 -0
- package/src/pom/atlas.js +83 -0
- package/src/pom/config.js +41 -0
- package/src/pom/coords.js +10 -0
- package/src/pom/engine.js +103 -0
- package/src/pom/geometry.js +43 -0
- package/src/pom/index.js +173 -0
- package/src/pom/loop.js +68 -0
- package/src/pom/overlay.js +42 -0
- package/src/pom/package.json +1 -0
- package/src/pom/render.js +32 -0
- package/src/pom/sprites.js +66 -0
- package/src/renderer/index.html +25 -0
- package/src/renderer/renderer.js +197 -0
- package/src/renderer/styles.css +148 -0
- package/src/webview-preload.js +68 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
html,
|
|
6
|
+
body {
|
|
7
|
+
margin: 0;
|
|
8
|
+
height: 100%;
|
|
9
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
10
|
+
background: #1e1f24;
|
|
11
|
+
color: #e8e8ec;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#tab-strip {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
background: #17181c;
|
|
20
|
+
padding: 6px 6px 0 6px;
|
|
21
|
+
-webkit-app-region: drag;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#tabs {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex: 1;
|
|
27
|
+
overflow-x: auto;
|
|
28
|
+
-webkit-app-region: no-drag;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.tab {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 8px;
|
|
35
|
+
padding: 8px 12px;
|
|
36
|
+
margin-right: 4px;
|
|
37
|
+
border-radius: 8px 8px 0 0;
|
|
38
|
+
background: #26282f;
|
|
39
|
+
color: #b7b8c2;
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
max-width: 180px;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.tab.active {
|
|
48
|
+
background: #33353e;
|
|
49
|
+
color: #fff;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.tab-title {
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
text-overflow: ellipsis;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.tab-close {
|
|
59
|
+
opacity: 0.6;
|
|
60
|
+
padding: 0 2px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tab-close:hover {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
#new-tab-btn {
|
|
68
|
+
-webkit-app-region: no-drag;
|
|
69
|
+
border: none;
|
|
70
|
+
background: transparent;
|
|
71
|
+
color: #b7b8c2;
|
|
72
|
+
font-size: 18px;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
padding: 4px 10px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#new-tab-btn:hover {
|
|
78
|
+
color: #fff;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#toolbar {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: 6px;
|
|
85
|
+
background: #33353e;
|
|
86
|
+
padding: 8px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
#toolbar button {
|
|
90
|
+
border: none;
|
|
91
|
+
background: #26282f;
|
|
92
|
+
color: #e8e8ec;
|
|
93
|
+
border-radius: 6px;
|
|
94
|
+
width: 30px;
|
|
95
|
+
height: 30px;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#toolbar button:hover {
|
|
101
|
+
background: #3d3f49;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
#address-bar {
|
|
105
|
+
flex: 1;
|
|
106
|
+
height: 30px;
|
|
107
|
+
border-radius: 6px;
|
|
108
|
+
border: none;
|
|
109
|
+
padding: 0 12px;
|
|
110
|
+
background: #1e1f24;
|
|
111
|
+
color: #e8e8ec;
|
|
112
|
+
font-size: 13px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
#address-bar:focus {
|
|
116
|
+
outline: 2px solid #e0a95e;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
#content {
|
|
120
|
+
position: relative;
|
|
121
|
+
flex: 1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.webview-pane {
|
|
125
|
+
position: absolute;
|
|
126
|
+
inset: 0;
|
|
127
|
+
display: none;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.webview-pane.active {
|
|
131
|
+
display: block;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.browser-webview {
|
|
135
|
+
width: 100%;
|
|
136
|
+
height: 100%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Spans the whole window so poms fly over the tab strip and toolbar too.
|
|
140
|
+
pointer-events:none keeps every click reaching what it landed on. */
|
|
141
|
+
#pom-overlay {
|
|
142
|
+
position: fixed;
|
|
143
|
+
inset: 0;
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: 100%;
|
|
146
|
+
pointer-events: none;
|
|
147
|
+
z-index: 2147483647;
|
|
148
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Runs inside each <webview> page, isolated from the host chrome. A webview
|
|
2
|
+
// is a separate frame, so its clicks never reach the host document — they are
|
|
3
|
+
// forwarded here and translated into window coordinates by the renderer.
|
|
4
|
+
//
|
|
5
|
+
// Press, move and release are forwarded separately rather than as a single
|
|
6
|
+
// click, because holding and dragging streams poms continuously and a click
|
|
7
|
+
// event cannot express that.
|
|
8
|
+
const { ipcRenderer } = require('electron');
|
|
9
|
+
|
|
10
|
+
// Listeners are passive and never call preventDefault or stopPropagation, so
|
|
11
|
+
// the page keeps receiving every event exactly as it would without Pomium.
|
|
12
|
+
const OPTS = { capture: true, passive: true };
|
|
13
|
+
|
|
14
|
+
window.addEventListener('DOMContentLoaded', () => {
|
|
15
|
+
// The preload script is ours, but the DOM events it listens to are the
|
|
16
|
+
// page's — a page can dispatch synthetic pointer events on its own
|
|
17
|
+
// document to hold this flag forever. isTrusted rejects anything that
|
|
18
|
+
// did not come from a real input device.
|
|
19
|
+
let held = false;
|
|
20
|
+
|
|
21
|
+
document.addEventListener('pointerdown', (e) => {
|
|
22
|
+
if (!e.isTrusted) return;
|
|
23
|
+
if (e.button !== undefined && e.button !== 0) return;
|
|
24
|
+
held = true;
|
|
25
|
+
ipcRenderer.sendToHost('pom-down', { x: e.clientX, y: e.clientY });
|
|
26
|
+
}, OPTS);
|
|
27
|
+
|
|
28
|
+
document.addEventListener('pointermove', (e) => {
|
|
29
|
+
if (!e.isTrusted) return;
|
|
30
|
+
if (!held) return;
|
|
31
|
+
ipcRenderer.sendToHost('pom-move', { x: e.clientX, y: e.clientY });
|
|
32
|
+
}, OPTS);
|
|
33
|
+
|
|
34
|
+
document.addEventListener('pointerup', (e) => {
|
|
35
|
+
if (!e.isTrusted) return;
|
|
36
|
+
// Mirror the pointerdown filter: a chorded right-click release must not
|
|
37
|
+
// end a drag the user is still physically holding.
|
|
38
|
+
if (e.button !== undefined && e.button !== 0) return;
|
|
39
|
+
held = false;
|
|
40
|
+
ipcRenderer.sendToHost('pom-up');
|
|
41
|
+
}, OPTS);
|
|
42
|
+
|
|
43
|
+
document.addEventListener('pointercancel', (e) => {
|
|
44
|
+
if (!e.isTrusted) return;
|
|
45
|
+
held = false;
|
|
46
|
+
ipcRenderer.sendToHost('pom-up');
|
|
47
|
+
}, OPTS);
|
|
48
|
+
|
|
49
|
+
// A drag can end without pointerup: alt-tabbing away, or a native drag
|
|
50
|
+
// starting on an image or link. Without these the stream never stops.
|
|
51
|
+
// Left unconditional on isTrusted (unlike the pointer handlers above): a
|
|
52
|
+
// page firing these itself can only end a drag early, never extend one,
|
|
53
|
+
// so an isTrusted guard here would add nothing.
|
|
54
|
+
//
|
|
55
|
+
// The `held` guard is load-bearing, though. Pressing on the host chrome
|
|
56
|
+
// while this page had focus blurs it, and reporting a release for a drag
|
|
57
|
+
// this page never started would cancel the chrome's drag instead.
|
|
58
|
+
function release() {
|
|
59
|
+
if (!held) return;
|
|
60
|
+
held = false;
|
|
61
|
+
ipcRenderer.sendToHost('pom-up');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
window.addEventListener('blur', release, OPTS);
|
|
65
|
+
document.addEventListener('visibilitychange', () => {
|
|
66
|
+
if (document.hidden) release();
|
|
67
|
+
}, OPTS);
|
|
68
|
+
});
|