@oasiz/sdk 1.5.3 → 1.5.5
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 +2 -2
- package/dist/index.cjs +302 -77
- package/dist/index.d.cts +139 -1
- package/dist/index.d.ts +139 -1
- package/dist/index.js +298 -77
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -196,11 +196,11 @@ private onGameOver(): void {
|
|
|
196
196
|
|
|
197
197
|
### Layout
|
|
198
198
|
|
|
199
|
-
Use the runtime safe-area value instead of hardcoded top offsets. The SDK returns the top inset as **a percentage of the viewport height (0–100)**. If the host exposes CSS pixels via `window.getSafeAreaTop()` or `window.__OASIZ_SAFE_AREA_TOP__`, the SDK converts using `window.innerHeight
|
|
199
|
+
Use the runtime safe-area value instead of hardcoded top offsets. The SDK returns the top inset as **a percentage of the active viewport height (0–100)**. If the host exposes CSS pixels via `window.getSafeAreaTop()` or `window.__OASIZ_SAFE_AREA_TOP__`, the SDK converts using `window.visualViewport.height` when available, then `window.innerHeight`, then document height. The host may instead set **`window.getSafeAreaTopPercent()`** or **`window.__OASIZ_SAFE_AREA_TOP_PERCENT__`** (0–100) and that value is used directly. When no host bridge is available, the SDK falls back to CSS `env(safe-area-inset-top)` / `constant(safe-area-inset-top)`.
|
|
200
200
|
|
|
201
201
|
#### `oasiz.getSafeAreaTop(): number`
|
|
202
202
|
|
|
203
|
-
Returns the top inset as a percentage of viewport height (0–100). To get pixels in JavaScript,
|
|
203
|
+
Returns the top inset as a percentage of viewport height (0–100). To get pixels in JavaScript, multiply by `window.visualViewport?.height || window.innerHeight`. In CSS, the same value matches **`vh`** units (for example `12.5vh` for 12.5% of the viewport height). Unsupported hosts return `0`.
|
|
204
204
|
|
|
205
205
|
```ts
|
|
206
206
|
const safeTopPct = oasiz.getSafeAreaTop();
|