fullscreen-engine 0.0.0-stage → 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 +186 -2
- 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/fullscreen.esm.js +1171 -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 +1183 -0
- package/dist/fullscreen.iife.js.map +1 -0
- package/dist/fullscreen.umd.cjs +1184 -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 +70 -4
- package/src/adapters/electron.js +180 -0
- package/src/adapters/puppeteer.js +119 -0
- package/src/adapters/ssr.js +25 -0
- package/src/core.js +524 -0
- package/src/events.js +63 -0
- package/src/fallback.js +136 -0
- package/src/index.js +22 -0
- package/src/triggers.js +282 -0
- package/src/utils.js +67 -0
- package/src/vendor.js +118 -0
- package/types/electron.d.ts +45 -0
- package/types/index.d.ts +106 -0
- package/types/puppeteer.d.ts +23 -0
- package/types/ssr.d.ts +22 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/*! fullscreen-engine v1.0.0 | MIT */
|
|
2
|
+
/**
|
|
3
|
+
* Tiny event emitter. No dependencies.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
class Emitter {
|
|
7
|
+
#listeners = new Map();
|
|
8
|
+
|
|
9
|
+
on(event, cb) {
|
|
10
|
+
if (typeof cb !== 'function') throw new TypeError('listener must be a function');
|
|
11
|
+
if (!this.#listeners.has(event)) this.#listeners.set(event, new Set());
|
|
12
|
+
this.#listeners.get(event).add(cb);
|
|
13
|
+
return () => this.off(event, cb);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
once(event, cb) {
|
|
17
|
+
if (typeof cb !== 'function') throw new TypeError('listener must be a function');
|
|
18
|
+
const wrapper = (...args) => {
|
|
19
|
+
this.off(event, wrapper);
|
|
20
|
+
cb(...args);
|
|
21
|
+
};
|
|
22
|
+
wrapper._original = cb;
|
|
23
|
+
return this.on(event, wrapper);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
off(event, cb) {
|
|
27
|
+
const set = this.#listeners.get(event);
|
|
28
|
+
if (!set) return;
|
|
29
|
+
if (set.has(cb)) {
|
|
30
|
+
set.delete(cb);
|
|
31
|
+
} else {
|
|
32
|
+
for (const fn of set) {
|
|
33
|
+
if (fn._original === cb) {
|
|
34
|
+
set.delete(fn);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (set.size === 0) this.#listeners.delete(event);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
emit(event, ...args) {
|
|
43
|
+
const set = this.#listeners.get(event);
|
|
44
|
+
if (!set) return;
|
|
45
|
+
// copy so listeners can safely remove themselves
|
|
46
|
+
for (const cb of Array.from(set)) {
|
|
47
|
+
try {
|
|
48
|
+
cb(...args);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
// don't break other listeners
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
|
+
console.error(`[fullscreen-engine] listener error on "${event}":`, err);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
clear() {
|
|
58
|
+
this.#listeners.clear();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
listenerCount(event) {
|
|
62
|
+
return this.#listeners.get(event)?.size ?? 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Electron renderer-side adapter.
|
|
68
|
+
*
|
|
69
|
+
* Provide this on the renderer via contextBridge (window.fsNative).
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
function normalizeAutoRelock(val) {
|
|
74
|
+
if (val === undefined || val === null || val === false) {
|
|
75
|
+
return { enabled: false, delay: 50, maxRetries: 3 };
|
|
76
|
+
}
|
|
77
|
+
if (val === true) {
|
|
78
|
+
return { enabled: true, delay: 50, maxRetries: 3 };
|
|
79
|
+
}
|
|
80
|
+
if (typeof val === 'object') {
|
|
81
|
+
const delayNum = Number(val.delay);
|
|
82
|
+
const retriesNum = Number(val.maxRetries);
|
|
83
|
+
return {
|
|
84
|
+
enabled: val.enabled ?? true,
|
|
85
|
+
delay: Number.isFinite(delayNum) ? Math.max(0, delayNum) : 50,
|
|
86
|
+
maxRetries: Number.isFinite(retriesNum) ? Math.max(1, Math.trunc(retriesNum)) : 3
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
throw new TypeError('[fullscreen-engine/electron] invalid autoRelock option: expected boolean or object');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function createElectronFullscreen(bridge, opts = {}) {
|
|
93
|
+
if (!bridge || typeof bridge.set !== 'function') {
|
|
94
|
+
throw new Error('[fullscreen-engine/electron] bridge with .set() required');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const relockConfig = normalizeAutoRelock(opts.autoRelock);
|
|
98
|
+
const onError = typeof opts.onError === 'function' ? opts.onError : null;
|
|
99
|
+
const emitter = new Emitter();
|
|
100
|
+
let active = false;
|
|
101
|
+
let destroyed = false;
|
|
102
|
+
let unsubscribe = null;
|
|
103
|
+
let exitLocked = !!opts.preventExit;
|
|
104
|
+
let manualUnlocking = false;
|
|
105
|
+
let relockTimer = null;
|
|
106
|
+
let relockRetries = 0;
|
|
107
|
+
|
|
108
|
+
function emitError(err) {
|
|
109
|
+
emitter.emit('error', err);
|
|
110
|
+
if (onError) onError(err);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function clearRelockTimer() {
|
|
114
|
+
if (relockTimer !== null) {
|
|
115
|
+
clearTimeout(relockTimer);
|
|
116
|
+
relockTimer = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function getState() {
|
|
121
|
+
return {
|
|
122
|
+
active,
|
|
123
|
+
source: active ? 'electron' : 'none',
|
|
124
|
+
element: null,
|
|
125
|
+
supported: true
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function scheduleRelock() {
|
|
130
|
+
if (destroyed || !relockConfig.enabled || manualUnlocking) return;
|
|
131
|
+
if (relockRetries >= relockConfig.maxRetries) {
|
|
132
|
+
emitError(new Error('[fullscreen-engine/electron] autoRelock failed after maxRetries'));
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
clearRelockTimer();
|
|
136
|
+
relockTimer = setTimeout(() => {
|
|
137
|
+
relockTimer = null;
|
|
138
|
+
if (destroyed || !relockConfig.enabled || manualUnlocking || active) return;
|
|
139
|
+
relockRetries += 1;
|
|
140
|
+
request()
|
|
141
|
+
.catch((err) => {
|
|
142
|
+
emitError(err);
|
|
143
|
+
if (!destroyed && relockConfig.enabled && !manualUnlocking && !active) {
|
|
144
|
+
scheduleRelock();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}, relockConfig.delay);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function updateActive(next) {
|
|
151
|
+
const boolNext = !!next;
|
|
152
|
+
if (boolNext) {
|
|
153
|
+
relockRetries = 0;
|
|
154
|
+
clearRelockTimer();
|
|
155
|
+
}
|
|
156
|
+
if (boolNext === active) return;
|
|
157
|
+
const wasActive = active;
|
|
158
|
+
active = boolNext;
|
|
159
|
+
const state = getState();
|
|
160
|
+
emitter.emit('change', state);
|
|
161
|
+
if (active) emitter.emit('enter', state);
|
|
162
|
+
else {
|
|
163
|
+
emitter.emit('exit', state);
|
|
164
|
+
if (wasActive && relockConfig.enabled && !manualUnlocking) {
|
|
165
|
+
scheduleRelock();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (typeof bridge.onChange === 'function') {
|
|
171
|
+
unsubscribe = bridge.onChange((on) => {
|
|
172
|
+
if (!destroyed) updateActive(on);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (typeof bridge.get === 'function') {
|
|
177
|
+
Promise.resolve(bridge.get())
|
|
178
|
+
.then((on) => {
|
|
179
|
+
if (!destroyed) updateActive(on);
|
|
180
|
+
})
|
|
181
|
+
.catch(() => {});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async function request() {
|
|
185
|
+
if (destroyed) throw new Error('[fullscreen-engine/electron] destroyed');
|
|
186
|
+
manualUnlocking = false;
|
|
187
|
+
const res = await bridge.set(true);
|
|
188
|
+
if (res === false) {
|
|
189
|
+
throw new Error('[fullscreen-engine/electron] bridge.set(true) returned false');
|
|
190
|
+
}
|
|
191
|
+
updateActive(true);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function exit() {
|
|
195
|
+
if (destroyed) throw new Error('[fullscreen-engine/electron] destroyed');
|
|
196
|
+
if (exitLocked) {
|
|
197
|
+
const err = new Error('[fullscreen-engine/electron] Exit blocked: preventExit is active');
|
|
198
|
+
emitError(err);
|
|
199
|
+
throw err;
|
|
200
|
+
}
|
|
201
|
+
const res = await bridge.set(false);
|
|
202
|
+
if (res === true) {
|
|
203
|
+
throw new Error('[fullscreen-engine/electron] bridge.set(false) failed to exit');
|
|
204
|
+
}
|
|
205
|
+
updateActive(false);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function unlock() {
|
|
209
|
+
exitLocked = false;
|
|
210
|
+
manualUnlocking = true;
|
|
211
|
+
clearRelockTimer();
|
|
212
|
+
relockRetries = 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async function relock() {
|
|
216
|
+
manualUnlocking = false;
|
|
217
|
+
return request();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
request,
|
|
222
|
+
exit,
|
|
223
|
+
async toggle() {
|
|
224
|
+
return active ? exit() : request();
|
|
225
|
+
},
|
|
226
|
+
unlock,
|
|
227
|
+
relock,
|
|
228
|
+
isActive() { return active; },
|
|
229
|
+
isSupported() { return true; },
|
|
230
|
+
getState,
|
|
231
|
+
on(event, cb) { return emitter.on(event, cb); },
|
|
232
|
+
once(event, cb) { return emitter.once(event, cb); },
|
|
233
|
+
off(event, cb) { return emitter.off(event, cb); },
|
|
234
|
+
destroy() {
|
|
235
|
+
if (destroyed) return;
|
|
236
|
+
destroyed = true;
|
|
237
|
+
clearRelockTimer();
|
|
238
|
+
if (typeof unsubscribe === 'function') unsubscribe();
|
|
239
|
+
unsubscribe = null;
|
|
240
|
+
active = false;
|
|
241
|
+
emitter.clear();
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export { createElectronFullscreen };
|
|
247
|
+
//# sourceMappingURL=electron.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"electron.esm.js","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,IAAI,KAAK;AACjC,MAAM,IAAI,C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EAAE,CAAC,CAAC,CAAC,CAAC;AACnD,IAAI,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACvD,IAAI,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACrD,IAAI,OAAO,GAAG;AACd,MAAM,IAAI,SAAS,EAAE;AACrB,MAAM,SAAS,GAAG,IAAI;AACtB,MAAM,gBAAgB,EAAE;AACxB,MAAM,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,WAAW,EAAE;AAC1D,MAAM,WAAW,GAAG,IAAI;AACxB,MAAM,MAAM,GAAG,KAAK;AACpB,MAAM,OAAO,CAAC,KAAK,EAAE;AACrB,IAAI;AACJ,GAAG;AACH;;"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*! fullscreen-engine v1.0.0 | MIT */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* True backend fullscreen control from Node.js.
|
|
6
|
+
*
|
|
7
|
+
* Uses Chrome DevTools Protocol (CDP) via Puppeteer to control the
|
|
8
|
+
* browser window's fullscreen state. This works from a Node.js process.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
function createPuppeteerFullscreen(page, opts = {}) {
|
|
12
|
+
if (!page || typeof page.createCDPSession !== 'function') {
|
|
13
|
+
throw new Error('[fullscreen-engine/puppeteer] page with .createCDPSession() required');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let client = null;
|
|
17
|
+
let windowId = null;
|
|
18
|
+
let initPromise = null;
|
|
19
|
+
let active = false;
|
|
20
|
+
let destroyed = false;
|
|
21
|
+
let exitLocked = !!opts.preventExit;
|
|
22
|
+
|
|
23
|
+
async function ensure() {
|
|
24
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
25
|
+
if (client && windowId !== null) return;
|
|
26
|
+
if (!initPromise) {
|
|
27
|
+
initPromise = (async () => {
|
|
28
|
+
let session = null;
|
|
29
|
+
try {
|
|
30
|
+
session = await page.createCDPSession();
|
|
31
|
+
const res = await session.send('Browser.getWindowForTarget');
|
|
32
|
+
if (destroyed) {
|
|
33
|
+
try { await session.detach(); } catch {}
|
|
34
|
+
throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
35
|
+
}
|
|
36
|
+
client = session;
|
|
37
|
+
windowId = res.windowId;
|
|
38
|
+
} catch (err) {
|
|
39
|
+
if (session) {
|
|
40
|
+
try { await session.detach(); } catch {}
|
|
41
|
+
}
|
|
42
|
+
client = null;
|
|
43
|
+
windowId = null;
|
|
44
|
+
throw err;
|
|
45
|
+
} finally {
|
|
46
|
+
initPromise = null;
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
49
|
+
}
|
|
50
|
+
return initPromise;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function setState(state) {
|
|
54
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
55
|
+
await ensure();
|
|
56
|
+
await client.send('Browser.setWindowBounds', {
|
|
57
|
+
windowId,
|
|
58
|
+
bounds: { windowState: state } // 'fullscreen' | 'normal' | 'minimized' | 'maximized'
|
|
59
|
+
});
|
|
60
|
+
active = state === 'fullscreen';
|
|
61
|
+
return active;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
async request() {
|
|
66
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
67
|
+
if (active) return true;
|
|
68
|
+
return setState('fullscreen');
|
|
69
|
+
},
|
|
70
|
+
async exit() {
|
|
71
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
72
|
+
if (exitLocked) {
|
|
73
|
+
throw new Error('[fullscreen-engine/puppeteer] Exit blocked: preventExit is active');
|
|
74
|
+
}
|
|
75
|
+
if (!active) {
|
|
76
|
+
const current = await this.getWindowState();
|
|
77
|
+
if (current !== 'fullscreen') return false;
|
|
78
|
+
}
|
|
79
|
+
return setState(opts.restoreState || 'normal');
|
|
80
|
+
},
|
|
81
|
+
async toggle() {
|
|
82
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
83
|
+
const current = await this.getWindowState();
|
|
84
|
+
return current === 'fullscreen' ? this.exit() : this.request();
|
|
85
|
+
},
|
|
86
|
+
unlock() {
|
|
87
|
+
exitLocked = false;
|
|
88
|
+
},
|
|
89
|
+
async relock() {
|
|
90
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
91
|
+
const current = await this.getWindowState();
|
|
92
|
+
if (current === 'fullscreen') return true;
|
|
93
|
+
return setState('fullscreen');
|
|
94
|
+
},
|
|
95
|
+
isActive() {
|
|
96
|
+
return active;
|
|
97
|
+
},
|
|
98
|
+
isSupported() {
|
|
99
|
+
return true;
|
|
100
|
+
},
|
|
101
|
+
async getWindowState() {
|
|
102
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
103
|
+
await ensure();
|
|
104
|
+
const res = await client.send('Browser.getWindowBounds', { windowId });
|
|
105
|
+
const state = res.bounds.windowState;
|
|
106
|
+
active = state === 'fullscreen';
|
|
107
|
+
return state;
|
|
108
|
+
},
|
|
109
|
+
async destroy() {
|
|
110
|
+
if (destroyed) return;
|
|
111
|
+
destroyed = true;
|
|
112
|
+
if (initPromise) {
|
|
113
|
+
try { await initPromise; } catch {}
|
|
114
|
+
}
|
|
115
|
+
try { if (client) await client.detach(); } catch {}
|
|
116
|
+
client = null;
|
|
117
|
+
windowId = null;
|
|
118
|
+
initPromise = null;
|
|
119
|
+
active = false;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
exports.createPuppeteerFullscreen = createPuppeteerFullscreen;
|
|
125
|
+
//# sourceMappingURL=puppeteer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puppeteer.cjs","sources":["../../src/adapters/puppeteer.js"],"sourcesContent":["/**\n * True backend fullscreen control from Node.js.\n *\n * Uses Chrome DevTools Protocol (CDP) via Puppeteer to control the\n * browser window's fullscreen state. This works from a Node.js process.\n */\n\nexport function createPuppeteerFullscreen(page, opts = {}) {\n if (!page || typeof page.createCDPSession !== 'function') {\n throw new Error('[fullscreen-engine/puppeteer] page with .createCDPSession() required');\n }\n\n let client = null;\n let windowId = null;\n let initPromise = null;\n let active = false;\n let destroyed = false;\n let exitLocked = !!opts.preventExit;\n\n async function ensure() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n if (client && windowId !== null) return;\n if (!initPromise) {\n initPromise = (async () => {\n let session = null;\n try {\n session = await page.createCDPSession();\n const res = await session.send('Browser.getWindowForTarget');\n if (destroyed) {\n try { await session.detach(); } catch {}\n throw new Error('[fullscreen-engine/puppeteer] destroyed');\n }\n client = session;\n windowId = res.windowId;\n } catch (err) {\n if (session) {\n try { await session.detach(); } catch {}\n }\n client = null;\n windowId = null;\n throw err;\n } finally {\n initPromise = null;\n }\n })();\n }\n return initPromise;\n }\n\n async function setState(state) {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n await ensure();\n await client.send('Browser.setWindowBounds', {\n windowId,\n bounds: { windowState: state } // 'fullscreen' | 'normal' | 'minimized' | 'maximized'\n });\n active = state === 'fullscreen';\n return active;\n }\n\n return {\n async request() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n if (active) return true;\n return setState('fullscreen');\n },\n async exit() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n if (exitLocked) {\n throw new Error('[fullscreen-engine/puppeteer] Exit blocked: preventExit is active');\n }\n if (!active) {\n const current = await this.getWindowState();\n if (current !== 'fullscreen') return false;\n }\n return setState(opts.restoreState || 'normal');\n },\n async toggle() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n const current = await this.getWindowState();\n return current === 'fullscreen' ? this.exit() : this.request();\n },\n unlock() {\n exitLocked = false;\n },\n async relock() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n const current = await this.getWindowState();\n if (current === 'fullscreen') return true;\n return setState('fullscreen');\n },\n isActive() {\n return active;\n },\n isSupported() {\n return true;\n },\n async getWindowState() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n await ensure();\n const res = await client.send('Browser.getWindowBounds', { windowId });\n const state = res.bounds.windowState;\n active = state === 'fullscreen';\n return state;\n },\n async destroy() {\n if (destroyed) return;\n destroyed = true;\n if (initPromise) {\n try { await initPromise; } catch {}\n }\n try { if (client) await client.detach(); } catch {}\n client = null;\n windowId = null;\n initPromise = null;\n active = false;\n }\n };\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE;AAC3D,EAAE,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,gBAAgB,KAAK,UAAU,EAAE;AAC5D,IAAI,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC;AAC3F,EAAE;;AAEF,EAAE,IAAI,MAAM,GAAG,IAAI;AACnB,EAAE,IAAI,QAAQ,GAAG,IAAI;AACrB,EAAE,IAAI,WAAW,GAAG,IAAI;AACxB,EAAE,IAAI,MAAM,GAAG,KAAK;AACpB,EAAE,IAAI,SAAS,GAAG,KAAK;AACvB,EAAE,IAAI,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW;;AAErC,EAAE,eAAe,MAAM,GAAG;AAC1B,IAAI,IAAI,SAAS,EAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC;AAC7E,IAAI,IAAI,MAAM,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrC,IAAI,IAAI,CAAC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er to control the
|
|
6
|
+
* browser window's fullscreen state. This works from a Node.js process.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
function createPuppeteerFullscreen(page, opts = {}) {
|
|
10
|
+
if (!page || typeof page.createCDPSession !== 'function') {
|
|
11
|
+
throw new Error('[fullscreen-engine/puppeteer] page with .createCDPSession() required');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let client = null;
|
|
15
|
+
let windowId = null;
|
|
16
|
+
let initPromise = null;
|
|
17
|
+
let active = false;
|
|
18
|
+
let destroyed = false;
|
|
19
|
+
let exitLocked = !!opts.preventExit;
|
|
20
|
+
|
|
21
|
+
async function ensure() {
|
|
22
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
23
|
+
if (client && windowId !== null) return;
|
|
24
|
+
if (!initPromise) {
|
|
25
|
+
initPromise = (async () => {
|
|
26
|
+
let session = null;
|
|
27
|
+
try {
|
|
28
|
+
session = await page.createCDPSession();
|
|
29
|
+
const res = await session.send('Browser.getWindowForTarget');
|
|
30
|
+
if (destroyed) {
|
|
31
|
+
try { await session.detach(); } catch {}
|
|
32
|
+
throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
33
|
+
}
|
|
34
|
+
client = session;
|
|
35
|
+
windowId = res.windowId;
|
|
36
|
+
} catch (err) {
|
|
37
|
+
if (session) {
|
|
38
|
+
try { await session.detach(); } catch {}
|
|
39
|
+
}
|
|
40
|
+
client = null;
|
|
41
|
+
windowId = null;
|
|
42
|
+
throw err;
|
|
43
|
+
} finally {
|
|
44
|
+
initPromise = null;
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
}
|
|
48
|
+
return initPromise;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function setState(state) {
|
|
52
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
53
|
+
await ensure();
|
|
54
|
+
await client.send('Browser.setWindowBounds', {
|
|
55
|
+
windowId,
|
|
56
|
+
bounds: { windowState: state } // 'fullscreen' | 'normal' | 'minimized' | 'maximized'
|
|
57
|
+
});
|
|
58
|
+
active = state === 'fullscreen';
|
|
59
|
+
return active;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
async request() {
|
|
64
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
65
|
+
if (active) return true;
|
|
66
|
+
return setState('fullscreen');
|
|
67
|
+
},
|
|
68
|
+
async exit() {
|
|
69
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
70
|
+
if (exitLocked) {
|
|
71
|
+
throw new Error('[fullscreen-engine/puppeteer] Exit blocked: preventExit is active');
|
|
72
|
+
}
|
|
73
|
+
if (!active) {
|
|
74
|
+
const current = await this.getWindowState();
|
|
75
|
+
if (current !== 'fullscreen') return false;
|
|
76
|
+
}
|
|
77
|
+
return setState(opts.restoreState || 'normal');
|
|
78
|
+
},
|
|
79
|
+
async toggle() {
|
|
80
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
81
|
+
const current = await this.getWindowState();
|
|
82
|
+
return current === 'fullscreen' ? this.exit() : this.request();
|
|
83
|
+
},
|
|
84
|
+
unlock() {
|
|
85
|
+
exitLocked = false;
|
|
86
|
+
},
|
|
87
|
+
async relock() {
|
|
88
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
89
|
+
const current = await this.getWindowState();
|
|
90
|
+
if (current === 'fullscreen') return true;
|
|
91
|
+
return setState('fullscreen');
|
|
92
|
+
},
|
|
93
|
+
isActive() {
|
|
94
|
+
return active;
|
|
95
|
+
},
|
|
96
|
+
isSupported() {
|
|
97
|
+
return true;
|
|
98
|
+
},
|
|
99
|
+
async getWindowState() {
|
|
100
|
+
if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');
|
|
101
|
+
await ensure();
|
|
102
|
+
const res = await client.send('Browser.getWindowBounds', { windowId });
|
|
103
|
+
const state = res.bounds.windowState;
|
|
104
|
+
active = state === 'fullscreen';
|
|
105
|
+
return state;
|
|
106
|
+
},
|
|
107
|
+
async destroy() {
|
|
108
|
+
if (destroyed) return;
|
|
109
|
+
destroyed = true;
|
|
110
|
+
if (initPromise) {
|
|
111
|
+
try { await initPromise; } catch {}
|
|
112
|
+
}
|
|
113
|
+
try { if (client) await client.detach(); } catch {}
|
|
114
|
+
client = null;
|
|
115
|
+
windowId = null;
|
|
116
|
+
initPromise = null;
|
|
117
|
+
active = false;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { createPuppeteerFullscreen };
|
|
123
|
+
//# sourceMappingURL=puppeteer.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puppeteer.esm.js","sources":["../../src/adapters/puppeteer.js"],"sourcesContent":["/**\n * True backend fullscreen control from Node.js.\n *\n * Uses Chrome DevTools Protocol (CDP) via Puppeteer to control the\n * browser window's fullscreen state. This works from a Node.js process.\n */\n\nexport function createPuppeteerFullscreen(page, opts = {}) {\n if (!page || typeof page.createCDPSession !== 'function') {\n throw new Error('[fullscreen-engine/puppeteer] page with .createCDPSession() required');\n }\n\n let client = null;\n let windowId = null;\n let initPromise = null;\n let active = false;\n let destroyed = false;\n let exitLocked = !!opts.preventExit;\n\n async function ensure() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n if (client && windowId !== null) return;\n if (!initPromise) {\n initPromise = (async () => {\n let session = null;\n try {\n session = await page.createCDPSession();\n const res = await session.send('Browser.getWindowForTarget');\n if (destroyed) {\n try { await session.detach(); } catch {}\n throw new Error('[fullscreen-engine/puppeteer] destroyed');\n }\n client = session;\n windowId = res.windowId;\n } catch (err) {\n if (session) {\n try { await session.detach(); } catch {}\n }\n client = null;\n windowId = null;\n throw err;\n } finally {\n initPromise = null;\n }\n })();\n }\n return initPromise;\n }\n\n async function setState(state) {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n await ensure();\n await client.send('Browser.setWindowBounds', {\n windowId,\n bounds: { windowState: state } // 'fullscreen' | 'normal' | 'minimized' | 'maximized'\n });\n active = state === 'fullscreen';\n return active;\n }\n\n return {\n async request() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n if (active) return true;\n return setState('fullscreen');\n },\n async exit() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n if (exitLocked) {\n throw new Error('[fullscreen-engine/puppeteer] Exit blocked: preventExit is active');\n }\n if (!active) {\n const current = await this.getWindowState();\n if (current !== 'fullscreen') return false;\n }\n return setState(opts.restoreState || 'normal');\n },\n async toggle() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n const current = await this.getWindowState();\n return current === 'fullscreen' ? this.exit() : this.request();\n },\n unlock() {\n exitLocked = false;\n },\n async relock() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n const current = await this.getWindowState();\n if (current === 'fullscreen') return true;\n return setState('fullscreen');\n },\n isActive() {\n return active;\n },\n isSupported() {\n return true;\n },\n async getWindowState() {\n if (destroyed) throw new Error('[fullscreen-engine/puppeteer] destroyed');\n await ensure();\n const res = await client.send('Browser.getWindowBounds', { windowId });\n const state = res.bounds.windowState;\n active = state === 'fullscreen';\n return state;\n },\n async destroy() {\n if (destroyed) return;\n destroyed = true;\n if (initPromise) {\n try { await initPromise; } catch {}\n }\n try { if (client) await client.detach(); } catch {}\n client = null;\n windowId = null;\n initPromise = null;\n active = false;\n }\n };\n}\n"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE;AAC3D,EAAE,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,gBAAgB,KAAK,UAAU,EAAE;AAC5D,IAAI,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC;AAC3F,EAA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IAAI,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AACxD,MAAM,MAAM,GAAG,IAAI;AACnB,MAAM,QAAQ,GAAG,IAAI;AACrB,MAAM,WAAW,GAAG,IAAI;AACxB,MAAM,MAAM,GAAG,KAAK;AACpB,IAAI;AACJ,GAAG;AACH;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*! fullscreen-engine v1.0.0 | MIT */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SSR / Node.js safe stub.
|
|
6
|
+
*
|
|
7
|
+
* Importing the main entry already works in Node (all guards are in place).
|
|
8
|
+
* But if you explicitly need a no-op controller (e.g. for template
|
|
9
|
+
* environments that can't tree-shake), use this:
|
|
10
|
+
*
|
|
11
|
+
* import { createFullscreen } from 'fullscreen-engine/adapters/ssr';
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function createFullscreen() {
|
|
15
|
+
return {
|
|
16
|
+
async request() { throw new Error('[fullscreen-engine/ssr] fullscreen unavailable in SSR'); },
|
|
17
|
+
async exit() {},
|
|
18
|
+
async toggle() { return this.request(); },
|
|
19
|
+
isActive() { return false; },
|
|
20
|
+
isSupported() { return false; },
|
|
21
|
+
isFallback() { return false; },
|
|
22
|
+
getState() { return { active: false, source: 'none', element: null, supported: false }; },
|
|
23
|
+
on() { return () => {}; },
|
|
24
|
+
once() { return () => {}; },
|
|
25
|
+
off() {},
|
|
26
|
+
destroy() {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.createFullscreen = createFullscreen;
|
|
31
|
+
//# sourceMappingURL=ssr.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr.cjs","sources":["../../src/adapters/ssr.js"],"sourcesContent":["/**\n * SSR / Node.js safe stub.\n *\n * Importing the main entry already works in Node (all guards are in place).\n * But if you explicitly need a no-op controller (e.g. for template\n * environments that can't tree-shake), use this:\n *\n * import { createFullscreen } from 'fullscreen-engine/adapters/ssr';\n */\n\nexport function createFullscreen() {\n return {\n async request() { throw new Error('[fullscreen-engine/ssr] fullscreen unavailable in SSR'); },\n async exit() {},\n async toggle() { return this.request(); },\n isActive() { return false; },\n isSupported() { return false; },\n isFallback() { return false; },\n getState() { return { active: false, source: 'none', element: null, supported: false }; },\n on() { return () => {}; },\n once() { return () => {}; },\n off() {},\n destroy() {}\n };\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,gBAAgB,GAAG;AACnC,EAAE,OAAO;AACT,IAAI,MAAM,OAAO,GAAG,EAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC,CAAC,CAAC;AACjG,IAAI,MAAM,IAAI,GAAG,CAAC,CAAC;AACnB,IAAI,MAAM,MAAM,GAAG,EAAE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAC7C,IAAI,QAAQ,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC;AAChC,IAAI,WAAW,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC;AACnC,IAAI,UAAU,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC;AAClC,IAAI,QAAQ,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAC7F,IAAI,EAAE,GAAG,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B,IAAI,IAAI,GAAG,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,IAAI,GAAG,GAAG,CAAC,CAAC;AACZ,IAAI,OAAO,GAAG,CAAC;AACf,GAAG;AACH;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*! fullscreen-engine v1.0.0 | MIT */
|
|
2
|
+
/**
|
|
3
|
+
* SSR / Node.js safe stub.
|
|
4
|
+
*
|
|
5
|
+
* Importing the main entry already works in Node (all guards are in place).
|
|
6
|
+
* But if you explicitly need a no-op controller (e.g. for template
|
|
7
|
+
* environments that can't tree-shake), use this:
|
|
8
|
+
*
|
|
9
|
+
* import { createFullscreen } from 'fullscreen-engine/adapters/ssr';
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
function createFullscreen() {
|
|
13
|
+
return {
|
|
14
|
+
async request() { throw new Error('[fullscreen-engine/ssr] fullscreen unavailable in SSR'); },
|
|
15
|
+
async exit() {},
|
|
16
|
+
async toggle() { return this.request(); },
|
|
17
|
+
isActive() { return false; },
|
|
18
|
+
isSupported() { return false; },
|
|
19
|
+
isFallback() { return false; },
|
|
20
|
+
getState() { return { active: false, source: 'none', element: null, supported: false }; },
|
|
21
|
+
on() { return () => {}; },
|
|
22
|
+
once() { return () => {}; },
|
|
23
|
+
off() {},
|
|
24
|
+
destroy() {}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { createFullscreen };
|
|
29
|
+
//# sourceMappingURL=ssr.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr.esm.js","sources":["../../src/adapters/ssr.js"],"sourcesContent":["/**\n * SSR / Node.js safe stub.\n *\n * Importing the main entry already works in Node (all guards are in place).\n * But if you explicitly need a no-op controller (e.g. for template\n * environments that can't tree-shake), use this:\n *\n * import { createFullscreen } from 'fullscreen-engine/adapters/ssr';\n */\n\nexport function createFullscreen() {\n return {\n async request() { throw new Error('[fullscreen-engine/ssr] fullscreen unavailable in SSR'); },\n async exit() {},\n async toggle() { return this.request(); },\n isActive() { return false; },\n isSupported() { return false; },\n isFallback() { return false; },\n getState() { return { active: false, source: 'none', element: null, supported: false }; },\n on() { return () => {}; },\n once() { return () => {}; },\n off() {},\n destroy() {}\n };\n}\n"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,gBAAgB,GAAG;AACnC,EAAE,OAAO;AACT,IAAI,MAAM,OAAO,GAAG,EAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC,CAAC,CAAC;AACjG,IAAI,MAAM,IAAI,GAAG,CAAC,CAAC;AACnB,IAAI,MAAM,MAAM,GAAG,EAAE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAC7C,IAAI,QAAQ,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC;AAChC,IAAI,WAAW,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC;AACnC,IAAI,UAAU,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC;AAClC,IAAI,QAAQ,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAC7F,IAAI,EAAE,GAAG,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B,IAAI,IAAI,GAAG,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,IAAI,GAAG,GAAG,CAAC,CAAC;AACZ,IAAI,OAAO,GAAG,CAAC;AACf,GAAG;AACH;;"}
|