fullscreen-engine 0.0.0-stage → 1.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 +232 -2
- package/bin/fullscreen-engine.js +162 -0
- package/dist/adapters/electron.cjs +249 -0
- package/dist/adapters/electron.cjs.map +1 -0
- package/dist/adapters/electron.esm.js +247 -0
- package/dist/adapters/electron.esm.js.map +1 -0
- package/dist/adapters/puppeteer.cjs +125 -0
- package/dist/adapters/puppeteer.cjs.map +1 -0
- package/dist/adapters/puppeteer.esm.js +123 -0
- package/dist/adapters/puppeteer.esm.js.map +1 -0
- package/dist/adapters/ssr.cjs +31 -0
- package/dist/adapters/ssr.cjs.map +1 -0
- package/dist/adapters/ssr.esm.js +29 -0
- package/dist/adapters/ssr.esm.js.map +1 -0
- package/dist/config.cjs +1789 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.esm.js +1783 -0
- package/dist/config.esm.js.map +1 -0
- package/dist/fullscreen.esm.js +1673 -0
- package/dist/fullscreen.esm.js.map +1 -0
- package/dist/fullscreen.esm.min.js +3 -0
- package/dist/fullscreen.esm.min.js.map +1 -0
- package/dist/fullscreen.iife.js +1689 -0
- package/dist/fullscreen.iife.js.map +1 -0
- package/dist/fullscreen.umd.cjs +1690 -0
- package/dist/fullscreen.umd.cjs.map +1 -0
- package/dist/fullscreen.umd.min.cjs +3 -0
- package/dist/fullscreen.umd.min.cjs.map +1 -0
- package/package.json +82 -4
- package/src/adapters/electron.js +180 -0
- package/src/adapters/puppeteer.js +119 -0
- package/src/adapters/ssr.js +25 -0
- package/src/config-loader.js +114 -0
- package/src/config.js +180 -0
- package/src/core.js +524 -0
- package/src/events.js +63 -0
- package/src/fallback.js +136 -0
- package/src/index.js +23 -0
- package/src/triggers.js +282 -0
- package/src/utils.js +67 -0
- package/src/vendor.js +118 -0
- package/types/config.d.ts +40 -0
- package/types/electron.d.ts +45 -0
- package/types/index.d.ts +161 -0
- package/types/puppeteer.d.ts +23 -0
- package/types/ssr.d.ts +22 -0
package/README.md
CHANGED
|
@@ -1,3 +1,233 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `fullscreen-engine`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Zero-dependency, headless fullscreen control engine for Browsers, Electron, Node.js (Puppeteer/CDP), and SSR.**
|
|
4
|
+
|
|
5
|
+
[](package.json)
|
|
6
|
+
[](package.json)
|
|
7
|
+
[](package.json)
|
|
8
|
+
[](rollup.config.js)
|
|
9
|
+
|
|
10
|
+
`fullscreen-engine` is a pure, deterministic control layer (**no UI, no pages, no demos**) that unifies W3C & vendor-prefixed DOM Fullscreen APIs, Electron `contextBridge` IPC, Chrome DevTools Protocol (Puppeteer), CSS viewport-fill fallback, hover/scroll auto-triggers, Kiosk auto-relock/exit-blocking, and a single-file global config (`fullscreen.config.js`) behind one lightweight TypeScript-typed API.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Key Capabilities & Platform Matrix
|
|
15
|
+
|
|
16
|
+
| Environment | Transport / Mechanism | Auto-Triggers (`hover`/`scroll`) | `autoRelock` & `preventExit` | Entry Point |
|
|
17
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
18
|
+
| **Modern Browsers** | Native `requestFullscreen` (`webkit`/`moz`/`ms`) | Yes (via CSS fallback) | CSS fallback `Escape` + `exit()` block | `fullscreen-engine` |
|
|
19
|
+
| **iOS / Restricted Iframes** | Fixed-viewport CSS fallback (`lockBody` ref-counted) | Yes | Yes (`unlock()` escape hatch) | `fullscreen-engine` |
|
|
20
|
+
| **Electron Renderer** | `window.fsNative` IPC bridge (`set`/`get`/`onChange`) | Yes (gesture-free IPC) | Yes (`delay`/`maxRetries` guard) | `fullscreen-engine` or `fullscreen-engine/adapters/electron` |
|
|
21
|
+
| **Node.js + Puppeteer** | CDP `Browser.setWindowBounds` / `getWindowBounds` | N/A | `preventExit`, `unlock()`, `relock()` | `fullscreen-engine/adapters/puppeteer` |
|
|
22
|
+
| **SSR / Node.js** | Import-safe no-op controller (`request`/`toggle` reject) | Safe no-op | N/A | `fullscreen-engine/adapters/ssr` |
|
|
23
|
+
| **Global Config & CLI** | `fullscreen.config.{js,mjs,cjs,json}` + `npx fullscreen-engine init` | Preset-driven (`default`, `kiosk`, `presentation`, `strict`) | Configured once in `fullscreen.config.js` | `fullscreen-engine` & `fullscreen-engine/config` |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install fullscreen-engine
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Supports **ESM (`import`)**, **CommonJS (`require`)**, **UMD**, **IIFE**, and **TypeScript** (`types/*.d.ts`) on Node.js `>=18` and all modern browsers.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Global Config (`fullscreen.config.js`) — Configure Once, Use Anywhere
|
|
38
|
+
|
|
39
|
+
Generate a starter config in any project root without touching engine internals:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx fullscreen-engine init --preset kiosk
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
// fullscreen.config.js
|
|
47
|
+
import { defineConfig } from 'fullscreen-engine';
|
|
48
|
+
|
|
49
|
+
export default defineConfig({
|
|
50
|
+
mode: 'kiosk', // 'default' | 'kiosk' | 'presentation' | 'strict'
|
|
51
|
+
core: {
|
|
52
|
+
fallback: 'css',
|
|
53
|
+
lockBody: true
|
|
54
|
+
},
|
|
55
|
+
adapters: {
|
|
56
|
+
electron: { autoRelock: true, preventExit: true },
|
|
57
|
+
puppeteer: { restoreState: 'normal', preventExit: true },
|
|
58
|
+
ssr: { enabled: true }
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Initialize from the config in **Browser / React / Next.js**:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import { initFullscreen } from 'fullscreen-engine';
|
|
67
|
+
import config from './fullscreen.config.js';
|
|
68
|
+
|
|
69
|
+
const fs = initFullscreen(config, { target: document.getElementById('app') });
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or auto-discover `fullscreen.config.{js,mjs,cjs,json}` in **Node.js / Electron / Puppeteer**:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
import { loadAndInit } from 'fullscreen-engine/config';
|
|
76
|
+
|
|
77
|
+
const fs = await loadAndInit({ page }); // or { bridge } / process.cwd()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Quickstart: Browser & CSS Fallback
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
import { createFullscreen } from 'fullscreen-engine';
|
|
86
|
+
|
|
87
|
+
const fs = createFullscreen({
|
|
88
|
+
target: document.getElementById('player'), // defaults to document.documentElement
|
|
89
|
+
fallback: 'css', // 'css' | 'none'
|
|
90
|
+
lockBody: true,
|
|
91
|
+
onError: (err) => console.warn(err.message)
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Native fullscreen requires a user gesture (click / tap / keydown)
|
|
95
|
+
document.getElementById('enter-btn').addEventListener('click', () => fs.request());
|
|
96
|
+
|
|
97
|
+
fs.on('change', (state) => {
|
|
98
|
+
console.log(state.active, state.source, state.element);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
await fs.exit();
|
|
102
|
+
fs.destroy();
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Hover & Scroll Auto-Triggers
|
|
108
|
+
|
|
109
|
+
Auto-triggers use Electron IPC or CSS viewport fallback so `mouseenter` and `scroll` events never trigger browser user-gesture `SecurityError`s:
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
import { createFullscreen } from 'fullscreen-engine';
|
|
113
|
+
|
|
114
|
+
const fs = createFullscreen({
|
|
115
|
+
target: document.getElementById('showcase'),
|
|
116
|
+
trigger: ['hover', 'scroll'], // 'manual' | 'hover' | 'scroll' | ['hover', 'scroll']
|
|
117
|
+
hoverDelay: 200,
|
|
118
|
+
scrollThreshold: 120,
|
|
119
|
+
autoExit: true,
|
|
120
|
+
suppressOnManualExit: true // set false to re-trigger on next hover/scroll after manual exit
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Kiosk Mode: `autoRelock`, `preventExit` & `unlock()`
|
|
127
|
+
|
|
128
|
+
Lock fullscreen against accidental `Escape` exits or programmatic `exit()` calls until `unlock()` is invoked:
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
import { createFullscreen } from 'fullscreen-engine';
|
|
132
|
+
|
|
133
|
+
const fs = createFullscreen({
|
|
134
|
+
fallback: 'css',
|
|
135
|
+
autoRelock: { enabled: true, delay: 50, maxRetries: 3 },
|
|
136
|
+
preventExit: true,
|
|
137
|
+
onError: (err) => console.warn(err.message)
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
await fs.request();
|
|
141
|
+
|
|
142
|
+
// Later, when an operator exits kiosk mode:
|
|
143
|
+
fs.unlock();
|
|
144
|
+
await fs.exit();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Electron Bridge (`fullscreen-engine/adapters/electron`)
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
// preload.js (Electron main/preload)
|
|
153
|
+
const { contextBridge, ipcRenderer } = require('electron');
|
|
154
|
+
|
|
155
|
+
contextBridge.exposeInMainWorld('fsNative', {
|
|
156
|
+
set: (on) => ipcRenderer.invoke('fs:set', on),
|
|
157
|
+
get: () => ipcRenderer.invoke('fs:get'),
|
|
158
|
+
onChange: (cb) => {
|
|
159
|
+
const handler = (_evt, on) => cb(on);
|
|
160
|
+
ipcRenderer.on('fs:change', handler);
|
|
161
|
+
return () => ipcRenderer.removeListener('fs:change', handler);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
// renderer.js
|
|
168
|
+
import { createElectronFullscreen } from 'fullscreen-engine/adapters/electron';
|
|
169
|
+
|
|
170
|
+
const fs = createElectronFullscreen(window.fsNative, {
|
|
171
|
+
autoRelock: true,
|
|
172
|
+
preventExit: true
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
await fs.request();
|
|
176
|
+
// fs.relock() re-locks preventExit and enters fullscreen
|
|
177
|
+
// fs.unlock() releases preventExit and clears pending relock timers
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Node.js + Puppeteer / CDP (`fullscreen-engine/adapters/puppeteer`)
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
import puppeteer from 'puppeteer';
|
|
186
|
+
import { createPuppeteerFullscreen } from 'fullscreen-engine/adapters/puppeteer';
|
|
187
|
+
|
|
188
|
+
const browser = await puppeteer.launch({ headless: false });
|
|
189
|
+
const page = await browser.newPage();
|
|
190
|
+
|
|
191
|
+
const fs = createPuppeteerFullscreen(page, {
|
|
192
|
+
restoreState: 'normal', // 'normal' | 'maximized' | 'minimized'
|
|
193
|
+
preventExit: false
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
await fs.request();
|
|
197
|
+
await fs.exit();
|
|
198
|
+
await fs.destroy();
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## SSR Safety (`fullscreen-engine/adapters/ssr`)
|
|
204
|
+
|
|
205
|
+
Importing `fullscreen-engine` in Node.js or SSR frameworks (Next.js, Nuxt, Remix) is safe out of the box. For explicit no-op stubs in template environments:
|
|
206
|
+
|
|
207
|
+
```js
|
|
208
|
+
import { createFullscreen } from 'fullscreen-engine/adapters/ssr';
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## API Overview
|
|
214
|
+
|
|
215
|
+
- **Main (`fullscreen-engine`):** `createFullscreen`, `defineConfig`, `resolveConfig`, `initFullscreen`, `PRESETS`, `detectEnvironment`, `Emitter`, `isBrowser`, `isNode`, `isElectron`
|
|
216
|
+
- **Config Loader (`fullscreen-engine/config`):** `CONFIG_FILES`, `findConfigFile`, `loadConfig`, `loadAndInit`, `PRESETS`, `defineConfig`, `resolveConfig`, `initFullscreen`
|
|
217
|
+
- **Controller Methods:** `request()`, `exit()`, `toggle()`, `unlock()`, `isActive()`, `isSupported()`, `isFallback()`, `getState()`, `on()`, `once()`, `off()`, `destroy()` (plus `relock()` on Electron & Puppeteer adapters)
|
|
218
|
+
- **CLI:** `npx fullscreen-engine init [--preset default|kiosk|presentation|strict] [--esm|--cjs|--json] [--force]`
|
|
219
|
+
- **Full Developer Documentation:** See [`docs/`](docs/index.md) (`docs/api/functions.md`, `docs/reference/configuration.md`, `docs/guides/advanced-usage.md`).
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Development
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
npm run lint
|
|
227
|
+
npm run build
|
|
228
|
+
npm test
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
MIT
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* fullscreen-engine CLI
|
|
4
|
+
*
|
|
5
|
+
* Scaffolds a project-root fullscreen.config.{js,cjs,json} file so apps can
|
|
6
|
+
* configure all fullscreen, kiosk, auto-relock, and adapter features in one place.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { resolve } from 'node:path';
|
|
11
|
+
import { PRESETS } from '../src/config.js';
|
|
12
|
+
|
|
13
|
+
function printHelp() {
|
|
14
|
+
console.log(`fullscreen-engine CLI
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
fullscreen-engine init [options]
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
--preset, --mode <name> Preset mode: default | kiosk | presentation | strict (default: "default")
|
|
21
|
+
--esm Generate ESM fullscreen.config.js
|
|
22
|
+
--cjs Generate CommonJS fullscreen.config.cjs
|
|
23
|
+
--json Generate JSON fullscreen.config.json
|
|
24
|
+
--force Overwrite an existing config file
|
|
25
|
+
-h, --help Show this help message`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function isEsmProject(cwd) {
|
|
29
|
+
const pkgPath = resolve(cwd, 'package.json');
|
|
30
|
+
if (!existsSync(pkgPath)) return false;
|
|
31
|
+
try {
|
|
32
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
33
|
+
return pkg.type === 'module';
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function buildTemplate(format, mode) {
|
|
40
|
+
if (format === 'json') {
|
|
41
|
+
return (
|
|
42
|
+
JSON.stringify(
|
|
43
|
+
{
|
|
44
|
+
mode,
|
|
45
|
+
core: {
|
|
46
|
+
fallback: 'css',
|
|
47
|
+
lockBody: true
|
|
48
|
+
},
|
|
49
|
+
adapters: {
|
|
50
|
+
electron: {},
|
|
51
|
+
puppeteer: { restoreState: 'normal' },
|
|
52
|
+
ssr: { enabled: true }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
null,
|
|
56
|
+
2
|
|
57
|
+
) + '\n'
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const body = `{
|
|
62
|
+
// Preset mode: 'default' | 'kiosk' | 'presentation' | 'strict'
|
|
63
|
+
mode: '${mode}',
|
|
64
|
+
|
|
65
|
+
// Core browser / renderer options
|
|
66
|
+
core: {
|
|
67
|
+
fallback: 'css',
|
|
68
|
+
lockBody: true
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
// Adapter-specific overrides
|
|
72
|
+
adapters: {
|
|
73
|
+
electron: {},
|
|
74
|
+
puppeteer: {
|
|
75
|
+
restoreState: 'normal'
|
|
76
|
+
},
|
|
77
|
+
ssr: {
|
|
78
|
+
enabled: true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}`;
|
|
82
|
+
|
|
83
|
+
if (format === 'cjs') {
|
|
84
|
+
return `/** @type {import('fullscreen-engine').FullscreenGlobalConfig} */\nmodule.exports = ${body};\n`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return `import { defineConfig } from 'fullscreen-engine';\n\nexport default defineConfig(${body});\n`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function main(argv) {
|
|
91
|
+
const args = argv.slice(2);
|
|
92
|
+
if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
|
|
93
|
+
printHelp();
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const command = args[0];
|
|
98
|
+
if (command !== 'init') {
|
|
99
|
+
console.error(`[fullscreen-engine] Unknown command: "${command}"`);
|
|
100
|
+
printHelp();
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let mode = 'default';
|
|
105
|
+
let format = null;
|
|
106
|
+
let force = false;
|
|
107
|
+
|
|
108
|
+
for (let i = 1; i < args.length; i += 1) {
|
|
109
|
+
const arg = args[i];
|
|
110
|
+
if (arg === '--force') {
|
|
111
|
+
force = true;
|
|
112
|
+
} else if (arg === '--esm') {
|
|
113
|
+
format = 'esm';
|
|
114
|
+
} else if (arg === '--cjs') {
|
|
115
|
+
format = 'cjs';
|
|
116
|
+
} else if (arg === '--json') {
|
|
117
|
+
format = 'json';
|
|
118
|
+
} else if (arg === '--preset' || arg === '--mode') {
|
|
119
|
+
const next = args[i + 1];
|
|
120
|
+
if (!next || next.startsWith('-')) {
|
|
121
|
+
console.error(`[fullscreen-engine] Missing value for ${arg}`);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
mode = next;
|
|
125
|
+
i += 1;
|
|
126
|
+
} else if (arg.startsWith('--preset=') || arg.startsWith('--mode=')) {
|
|
127
|
+
mode = arg.split('=')[1];
|
|
128
|
+
} else {
|
|
129
|
+
console.error(`[fullscreen-engine] Unknown option: "${arg}"`);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (!(mode in PRESETS)) {
|
|
135
|
+
console.error(
|
|
136
|
+
`[fullscreen-engine] Invalid preset "${mode}". Expected one of: ${Object.keys(PRESETS).join(', ')}`
|
|
137
|
+
);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const cwd = process.cwd();
|
|
142
|
+
const resolvedFormat = format || (isEsmProject(cwd) ? 'esm' : 'cjs');
|
|
143
|
+
const filename =
|
|
144
|
+
resolvedFormat === 'json'
|
|
145
|
+
? 'fullscreen.config.json'
|
|
146
|
+
: resolvedFormat === 'cjs'
|
|
147
|
+
? 'fullscreen.config.cjs'
|
|
148
|
+
: 'fullscreen.config.js';
|
|
149
|
+
|
|
150
|
+
const targetPath = resolve(cwd, filename);
|
|
151
|
+
if (existsSync(targetPath) && !force) {
|
|
152
|
+
console.error(
|
|
153
|
+
`[fullscreen-engine] ${filename} already exists. Use --force to overwrite.`
|
|
154
|
+
);
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
writeFileSync(targetPath, buildTemplate(resolvedFormat, mode), 'utf8');
|
|
159
|
+
console.log(`[fullscreen-engine] Created ${filename} (mode: ${mode})`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
main(process.argv);
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/*! fullscreen-engine v1.1.0 | MIT */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tiny event emitter. No dependencies.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
class Emitter {
|
|
9
|
+
#listeners = new Map();
|
|
10
|
+
|
|
11
|
+
on(event, cb) {
|
|
12
|
+
if (typeof cb !== 'function') throw new TypeError('listener must be a function');
|
|
13
|
+
if (!this.#listeners.has(event)) this.#listeners.set(event, new Set());
|
|
14
|
+
this.#listeners.get(event).add(cb);
|
|
15
|
+
return () => this.off(event, cb);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
once(event, cb) {
|
|
19
|
+
if (typeof cb !== 'function') throw new TypeError('listener must be a function');
|
|
20
|
+
const wrapper = (...args) => {
|
|
21
|
+
this.off(event, wrapper);
|
|
22
|
+
cb(...args);
|
|
23
|
+
};
|
|
24
|
+
wrapper._original = cb;
|
|
25
|
+
return this.on(event, wrapper);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
off(event, cb) {
|
|
29
|
+
const set = this.#listeners.get(event);
|
|
30
|
+
if (!set) return;
|
|
31
|
+
if (set.has(cb)) {
|
|
32
|
+
set.delete(cb);
|
|
33
|
+
} else {
|
|
34
|
+
for (const fn of set) {
|
|
35
|
+
if (fn._original === cb) {
|
|
36
|
+
set.delete(fn);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (set.size === 0) this.#listeners.delete(event);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
emit(event, ...args) {
|
|
45
|
+
const set = this.#listeners.get(event);
|
|
46
|
+
if (!set) return;
|
|
47
|
+
// copy so listeners can safely remove themselves
|
|
48
|
+
for (const cb of Array.from(set)) {
|
|
49
|
+
try {
|
|
50
|
+
cb(...args);
|
|
51
|
+
} catch (err) {
|
|
52
|
+
// don't break other listeners
|
|
53
|
+
// eslint-disable-next-line no-console
|
|
54
|
+
console.error(`[fullscreen-engine] listener error on "${event}":`, err);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
clear() {
|
|
60
|
+
this.#listeners.clear();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
listenerCount(event) {
|
|
64
|
+
return this.#listeners.get(event)?.size ?? 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Electron renderer-side adapter.
|
|
70
|
+
*
|
|
71
|
+
* Provide this on the renderer via contextBridge (window.fsNative).
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
function normalizeAutoRelock(val) {
|
|
76
|
+
if (val === undefined || val === null || val === false) {
|
|
77
|
+
return { enabled: false, delay: 50, maxRetries: 3 };
|
|
78
|
+
}
|
|
79
|
+
if (val === true) {
|
|
80
|
+
return { enabled: true, delay: 50, maxRetries: 3 };
|
|
81
|
+
}
|
|
82
|
+
if (typeof val === 'object') {
|
|
83
|
+
const delayNum = Number(val.delay);
|
|
84
|
+
const retriesNum = Number(val.maxRetries);
|
|
85
|
+
return {
|
|
86
|
+
enabled: val.enabled ?? true,
|
|
87
|
+
delay: Number.isFinite(delayNum) ? Math.max(0, delayNum) : 50,
|
|
88
|
+
maxRetries: Number.isFinite(retriesNum) ? Math.max(1, Math.trunc(retriesNum)) : 3
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
throw new TypeError('[fullscreen-engine/electron] invalid autoRelock option: expected boolean or object');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function createElectronFullscreen(bridge, opts = {}) {
|
|
95
|
+
if (!bridge || typeof bridge.set !== 'function') {
|
|
96
|
+
throw new Error('[fullscreen-engine/electron] bridge with .set() required');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const relockConfig = normalizeAutoRelock(opts.autoRelock);
|
|
100
|
+
const onError = typeof opts.onError === 'function' ? opts.onError : null;
|
|
101
|
+
const emitter = new Emitter();
|
|
102
|
+
let active = false;
|
|
103
|
+
let destroyed = false;
|
|
104
|
+
let unsubscribe = null;
|
|
105
|
+
let exitLocked = !!opts.preventExit;
|
|
106
|
+
let manualUnlocking = false;
|
|
107
|
+
let relockTimer = null;
|
|
108
|
+
let relockRetries = 0;
|
|
109
|
+
|
|
110
|
+
function emitError(err) {
|
|
111
|
+
emitter.emit('error', err);
|
|
112
|
+
if (onError) onError(err);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function clearRelockTimer() {
|
|
116
|
+
if (relockTimer !== null) {
|
|
117
|
+
clearTimeout(relockTimer);
|
|
118
|
+
relockTimer = null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function getState() {
|
|
123
|
+
return {
|
|
124
|
+
active,
|
|
125
|
+
source: active ? 'electron' : 'none',
|
|
126
|
+
element: null,
|
|
127
|
+
supported: true
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function scheduleRelock() {
|
|
132
|
+
if (destroyed || !relockConfig.enabled || manualUnlocking) return;
|
|
133
|
+
if (relockRetries >= relockConfig.maxRetries) {
|
|
134
|
+
emitError(new Error('[fullscreen-engine/electron] autoRelock failed after maxRetries'));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
clearRelockTimer();
|
|
138
|
+
relockTimer = setTimeout(() => {
|
|
139
|
+
relockTimer = null;
|
|
140
|
+
if (destroyed || !relockConfig.enabled || manualUnlocking || active) return;
|
|
141
|
+
relockRetries += 1;
|
|
142
|
+
request()
|
|
143
|
+
.catch((err) => {
|
|
144
|
+
emitError(err);
|
|
145
|
+
if (!destroyed && relockConfig.enabled && !manualUnlocking && !active) {
|
|
146
|
+
scheduleRelock();
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}, relockConfig.delay);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function updateActive(next) {
|
|
153
|
+
const boolNext = !!next;
|
|
154
|
+
if (boolNext) {
|
|
155
|
+
relockRetries = 0;
|
|
156
|
+
clearRelockTimer();
|
|
157
|
+
}
|
|
158
|
+
if (boolNext === active) return;
|
|
159
|
+
const wasActive = active;
|
|
160
|
+
active = boolNext;
|
|
161
|
+
const state = getState();
|
|
162
|
+
emitter.emit('change', state);
|
|
163
|
+
if (active) emitter.emit('enter', state);
|
|
164
|
+
else {
|
|
165
|
+
emitter.emit('exit', state);
|
|
166
|
+
if (wasActive && relockConfig.enabled && !manualUnlocking) {
|
|
167
|
+
scheduleRelock();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (typeof bridge.onChange === 'function') {
|
|
173
|
+
unsubscribe = bridge.onChange((on) => {
|
|
174
|
+
if (!destroyed) updateActive(on);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (typeof bridge.get === 'function') {
|
|
179
|
+
Promise.resolve(bridge.get())
|
|
180
|
+
.then((on) => {
|
|
181
|
+
if (!destroyed) updateActive(on);
|
|
182
|
+
})
|
|
183
|
+
.catch(() => {});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function request() {
|
|
187
|
+
if (destroyed) throw new Error('[fullscreen-engine/electron] destroyed');
|
|
188
|
+
manualUnlocking = false;
|
|
189
|
+
const res = await bridge.set(true);
|
|
190
|
+
if (res === false) {
|
|
191
|
+
throw new Error('[fullscreen-engine/electron] bridge.set(true) returned false');
|
|
192
|
+
}
|
|
193
|
+
updateActive(true);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
async function exit() {
|
|
197
|
+
if (destroyed) throw new Error('[fullscreen-engine/electron] destroyed');
|
|
198
|
+
if (exitLocked) {
|
|
199
|
+
const err = new Error('[fullscreen-engine/electron] Exit blocked: preventExit is active');
|
|
200
|
+
emitError(err);
|
|
201
|
+
throw err;
|
|
202
|
+
}
|
|
203
|
+
const res = await bridge.set(false);
|
|
204
|
+
if (res === true) {
|
|
205
|
+
throw new Error('[fullscreen-engine/electron] bridge.set(false) failed to exit');
|
|
206
|
+
}
|
|
207
|
+
updateActive(false);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function unlock() {
|
|
211
|
+
exitLocked = false;
|
|
212
|
+
manualUnlocking = true;
|
|
213
|
+
clearRelockTimer();
|
|
214
|
+
relockRetries = 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async function relock() {
|
|
218
|
+
manualUnlocking = false;
|
|
219
|
+
return request();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
request,
|
|
224
|
+
exit,
|
|
225
|
+
async toggle() {
|
|
226
|
+
return active ? exit() : request();
|
|
227
|
+
},
|
|
228
|
+
unlock,
|
|
229
|
+
relock,
|
|
230
|
+
isActive() { return active; },
|
|
231
|
+
isSupported() { return true; },
|
|
232
|
+
getState,
|
|
233
|
+
on(event, cb) { return emitter.on(event, cb); },
|
|
234
|
+
once(event, cb) { return emitter.once(event, cb); },
|
|
235
|
+
off(event, cb) { return emitter.off(event, cb); },
|
|
236
|
+
destroy() {
|
|
237
|
+
if (destroyed) return;
|
|
238
|
+
destroyed = true;
|
|
239
|
+
clearRelockTimer();
|
|
240
|
+
if (typeof unsubscribe === 'function') unsubscribe();
|
|
241
|
+
unsubscribe = null;
|
|
242
|
+
active = false;
|
|
243
|
+
emitter.clear();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
exports.createElectronFullscreen = createElectronFullscreen;
|
|
249
|
+
//# sourceMappingURL=electron.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"electron.cjs","sources":["../../src/events.js","../../src/adapters/electron.js"],"sourcesContent":["/**\n * Tiny event emitter. No dependencies.\n */\n\nexport class Emitter {\n #listeners = new Map();\n\n on(event, cb) {\n if (typeof cb !== 'function') throw new TypeError('listener must be a function');\n if (!this.#listeners.has(event)) this.#listeners.set(event, new Set());\n this.#listeners.get(event).add(cb);\n return () => this.off(event, cb);\n }\n\n once(event, cb) {\n if (typeof cb !== 'function') throw new TypeError('listener must be a function');\n const wrapper = (...args) => {\n this.off(event, wrapper);\n cb(...args);\n };\n wrapper._original = cb;\n return this.on(event, wrapper);\n }\n\n off(event, cb) {\n const set = this.#listeners.get(event);\n if (!set) return;\n if (set.has(cb)) {\n set.delete(cb);\n } else {\n for (const fn of set) {\n if (fn._original === cb) {\n set.delete(fn);\n break;\n }\n }\n }\n if (set.size === 0) this.#listeners.delete(event);\n }\n\n emit(event, ...args) {\n const set = this.#listeners.get(event);\n if (!set) return;\n // copy so listeners can safely remove themselves\n for (const cb of Array.from(set)) {\n try {\n cb(...args);\n } catch (err) {\n // don't break other listeners\n // eslint-disable-next-line no-console\n console.error(`[fullscreen-engine] listener error on \"${event}\":`, err);\n }\n }\n }\n\n clear() {\n this.#listeners.clear();\n }\n\n listenerCount(event) {\n return this.#listeners.get(event)?.size ?? 0;\n }\n}\n","/**\n * Electron renderer-side adapter.\n *\n * Provide this on the renderer via contextBridge (window.fsNative).\n */\n\nimport { Emitter } from '../events.js';\n\nfunction normalizeAutoRelock(val) {\n if (val === undefined || val === null || val === false) {\n return { enabled: false, delay: 50, maxRetries: 3 };\n }\n if (val === true) {\n return { enabled: true, delay: 50, maxRetries: 3 };\n }\n if (typeof val === 'object') {\n const delayNum = Number(val.delay);\n const retriesNum = Number(val.maxRetries);\n return {\n enabled: val.enabled ?? true,\n delay: Number.isFinite(delayNum) ? Math.max(0, delayNum) : 50,\n maxRetries: Number.isFinite(retriesNum) ? Math.max(1, Math.trunc(retriesNum)) : 3\n };\n }\n throw new TypeError('[fullscreen-engine/electron] invalid autoRelock option: expected boolean or object');\n}\n\nexport function createElectronFullscreen(bridge, opts = {}) {\n if (!bridge || typeof bridge.set !== 'function') {\n throw new Error('[fullscreen-engine/electron] bridge with .set() required');\n }\n\n const relockConfig = normalizeAutoRelock(opts.autoRelock);\n const onError = typeof opts.onError === 'function' ? opts.onError : null;\n const emitter = new Emitter();\n let active = false;\n let destroyed = false;\n let unsubscribe = null;\n let exitLocked = !!opts.preventExit;\n let manualUnlocking = false;\n let relockTimer = null;\n let relockRetries = 0;\n\n function emitError(err) {\n emitter.emit('error', err);\n if (onError) onError(err);\n }\n\n function clearRelockTimer() {\n if (relockTimer !== null) {\n clearTimeout(relockTimer);\n relockTimer = null;\n }\n }\n\n function getState() {\n return {\n active,\n source: active ? 'electron' : 'none',\n element: null,\n supported: true\n };\n }\n\n function scheduleRelock() {\n if (destroyed || !relockConfig.enabled || manualUnlocking) return;\n if (relockRetries >= relockConfig.maxRetries) {\n emitError(new Error('[fullscreen-engine/electron] autoRelock failed after maxRetries'));\n return;\n }\n clearRelockTimer();\n relockTimer = setTimeout(() => {\n relockTimer = null;\n if (destroyed || !relockConfig.enabled || manualUnlocking || active) return;\n relockRetries += 1;\n request()\n .catch((err) => {\n emitError(err);\n if (!destroyed && relockConfig.enabled && !manualUnlocking && !active) {\n scheduleRelock();\n }\n });\n }, relockConfig.delay);\n }\n\n function updateActive(next) {\n const boolNext = !!next;\n if (boolNext) {\n relockRetries = 0;\n clearRelockTimer();\n }\n if (boolNext === active) return;\n const wasActive = active;\n active = boolNext;\n const state = getState();\n emitter.emit('change', state);\n if (active) emitter.emit('enter', state);\n else {\n emitter.emit('exit', state);\n if (wasActive && relockConfig.enabled && !manualUnlocking) {\n scheduleRelock();\n }\n }\n }\n\n if (typeof bridge.onChange === 'function') {\n unsubscribe = bridge.onChange((on) => {\n if (!destroyed) updateActive(on);\n });\n }\n\n if (typeof bridge.get === 'function') {\n Promise.resolve(bridge.get())\n .then((on) => {\n if (!destroyed) updateActive(on);\n })\n .catch(() => {});\n }\n\n async function request() {\n if (destroyed) throw new Error('[fullscreen-engine/electron] destroyed');\n manualUnlocking = false;\n const res = await bridge.set(true);\n if (res === false) {\n throw new Error('[fullscreen-engine/electron] bridge.set(true) returned false');\n }\n updateActive(true);\n }\n\n async function exit() {\n if (destroyed) throw new Error('[fullscreen-engine/electron] destroyed');\n if (exitLocked) {\n const err = new Error('[fullscreen-engine/electron] Exit blocked: preventExit is active');\n emitError(err);\n throw err;\n }\n const res = await bridge.set(false);\n if (res === true) {\n throw new Error('[fullscreen-engine/electron] bridge.set(false) failed to exit');\n }\n updateActive(false);\n }\n\n function unlock() {\n exitLocked = false;\n manualUnlocking = true;\n clearRelockTimer();\n relockRetries = 0;\n }\n\n async function relock() {\n manualUnlocking = false;\n return request();\n }\n\n return {\n request,\n exit,\n async toggle() {\n return active ? exit() : request();\n },\n unlock,\n relock,\n isActive() { return active; },\n isSupported() { return true; },\n getState,\n on(event, cb) { return emitter.on(event, cb); },\n once(event, cb) { return emitter.once(event, cb); },\n off(event, cb) { return emitter.off(event, cb); },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n clearRelockTimer();\n if (typeof unsubscribe === 'function') unsubscribe();\n unsubscribe = null;\n active = false;\n emitter.clear();\n }\n };\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;;AAEO,MAAM,OAAO,CAAC;AACrB,EAAE,UAAU,GAAG,IAAI,GAAG,EAAE;;AAExB,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE;AAChB,IAAI,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC;AACpF,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC;AAC1E,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AACtC,IAAI,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC;AACpC,EAAE;;AAEF,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE;AAClB,IAAI,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC;AACpF,IAAI,MAAM,OAAO,GAAG,CAAC,GAAG,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