@capgo/camera-preview 8.8.1 → 8.9.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/dist/plugin.js CHANGED
@@ -188,8 +188,45 @@ var capacitorCapacitorCameraView = (function (exports, core) {
188
188
  async getOrientation() {
189
189
  return { orientation: this.getCurrentOrientation() };
190
190
  }
191
- getSafeAreaInsets() {
192
- throw new Error('Method not implemented.');
191
+ async getSafeAreaInsets() {
192
+ const orientationValue = this.getCurrentOrientation();
193
+ let orientation = 0;
194
+ if (orientationValue === 'portrait' || orientationValue === 'portrait-upside-down') {
195
+ orientation = 1;
196
+ }
197
+ else if (orientationValue === 'landscape-left' || orientationValue === 'landscape-right') {
198
+ orientation = 2;
199
+ }
200
+ const parseInset = (value) => {
201
+ const parsed = Number.parseFloat(value);
202
+ return Number.isFinite(parsed) ? parsed : 0;
203
+ };
204
+ const probe = document.createElement('div');
205
+ probe.style.position = 'fixed';
206
+ probe.style.visibility = 'hidden';
207
+ probe.style.pointerEvents = 'none';
208
+ probe.style.top = '0';
209
+ probe.style.left = '0';
210
+ probe.style.paddingTop = 'env(safe-area-inset-top)';
211
+ probe.style.paddingLeft = 'env(safe-area-inset-left)';
212
+ probe.style.paddingRight = 'env(safe-area-inset-right)';
213
+ document.body.appendChild(probe);
214
+ const styles = getComputedStyle(probe);
215
+ const topInset = parseInset(styles.paddingTop);
216
+ const leftInset = parseInset(styles.paddingLeft);
217
+ const rightInset = parseInset(styles.paddingRight);
218
+ probe.remove();
219
+ let top = 0;
220
+ if (orientation === 1) {
221
+ top = topInset;
222
+ }
223
+ else if (orientation === 2) {
224
+ top = leftInset > 0 ? leftInset : rightInset;
225
+ }
226
+ else {
227
+ top = Math.max(topInset, leftInset, rightInset);
228
+ }
229
+ return { orientation, top };
193
230
  }
194
231
  async getZoomButtonValues() {
195
232
  throw new Error('getZoomButtonValues not supported under the web platform');
@@ -1358,6 +1395,16 @@ var capacitorCapacitorCameraView = (function (exports, core) {
1358
1395
  async setExposureCompensation(_options) {
1359
1396
  throw new Error('setExposureCompensation not supported under the web platform');
1360
1397
  }
1398
+ // White balance stubs (unsupported on web)
1399
+ async getWhiteBalanceModes() {
1400
+ throw new Error('getWhiteBalanceModes not supported under the web platform');
1401
+ }
1402
+ async getWhiteBalanceMode() {
1403
+ throw new Error('getWhiteBalanceMode not supported under the web platform');
1404
+ }
1405
+ async setWhiteBalanceMode(_options) {
1406
+ throw new Error('setWhiteBalanceMode not supported under the web platform');
1407
+ }
1361
1408
  async getSupportedVideoFrameRates() {
1362
1409
  throw new Error('getSupportedVideoFrameRates not supported under the web platform');
1363
1410
  }