@glassly/engine 0.3.5 → 0.3.6-dev.846
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/build/engine.d.ts +11 -1
- package/build/engine.d.ts.map +1 -1
- package/build/engine.js +13 -1
- package/build/engine.js.map +1 -1
- package/build/facades/ai.d.ts +3 -3
- package/build/facades/ai.d.ts.map +1 -1
- package/build/facades/ai.js +3 -3
- package/build/facades/ai.js.map +1 -1
- package/build/facades/glasses.d.ts +5 -1
- package/build/facades/glasses.d.ts.map +1 -1
- package/build/facades/glasses.js +39 -30
- package/build/facades/glasses.js.map +1 -1
- package/build/facades/memory.d.ts +10 -2
- package/build/facades/memory.d.ts.map +1 -1
- package/build/facades/memory.js +10 -0
- package/build/facades/memory.js.map +1 -1
- package/build/facades/miniapps.d.ts +2 -0
- package/build/facades/miniapps.d.ts.map +1 -1
- package/build/facades/miniapps.js +2 -0
- package/build/facades/miniapps.js.map +1 -1
- package/build/facades/pairing.d.ts.map +1 -1
- package/build/facades/pairing.js +3 -2
- package/build/facades/pairing.js.map +1 -1
- package/build/facades/providerKeys.d.ts +6 -2
- package/build/facades/providerKeys.d.ts.map +1 -1
- package/build/facades/providerKeys.js +6 -2
- package/build/facades/providerKeys.js.map +1 -1
- package/build/generated/releaseMetadata.js +4 -4
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/services/AiTierResolution.d.ts +3 -2
- package/build/services/AiTierResolution.d.ts.map +1 -1
- package/build/services/AiTierResolution.js +7 -2
- package/build/services/AiTierResolution.js.map +1 -1
- package/build/services/AppRegistry.d.ts +4 -1
- package/build/services/AppRegistry.d.ts.map +1 -1
- package/build/services/AppRegistry.js +16 -2
- package/build/services/AppRegistry.js.map +1 -1
- package/build/services/BlobStore.js +3 -3
- package/build/services/BlobStore.js.map +1 -1
- package/build/services/BluetoothRestoreLaunch.d.ts +8 -0
- package/build/services/BluetoothRestoreLaunch.d.ts.map +1 -0
- package/build/services/BluetoothRestoreLaunch.js +34 -0
- package/build/services/BluetoothRestoreLaunch.js.map +1 -0
- package/build/services/CloudClientService.d.ts +4 -4
- package/build/services/ForegroundLocationPermission.d.ts +1 -1
- package/build/services/ForegroundLocationPermission.d.ts.map +1 -1
- package/build/services/ForegroundLocationPermission.js.map +1 -1
- package/build/services/GestureDotsService.d.ts.map +1 -1
- package/build/services/GestureDotsService.js +2 -1
- package/build/services/GestureDotsService.js.map +1 -1
- package/build/services/GlassesTouchInput.d.ts +6 -4
- package/build/services/GlassesTouchInput.d.ts.map +1 -1
- package/build/services/GlassesTouchInput.js +81 -41
- package/build/services/GlassesTouchInput.js.map +1 -1
- package/build/services/LocalDisplayManager.d.ts +12 -4
- package/build/services/LocalDisplayManager.d.ts.map +1 -1
- package/build/services/LocalDisplayManager.js +21 -7
- package/build/services/LocalDisplayManager.js.map +1 -1
- package/build/services/LocalLlmModelManager.d.ts +3 -1
- package/build/services/LocalLlmModelManager.d.ts.map +1 -1
- package/build/services/LocalLlmModelManager.js +13 -5
- package/build/services/LocalLlmModelManager.js.map +1 -1
- package/build/services/LocalLlmPrompt.d.ts +10 -9
- package/build/services/LocalLlmPrompt.d.ts.map +1 -1
- package/build/services/LocalLlmPrompt.js +43 -32
- package/build/services/LocalLlmPrompt.js.map +1 -1
- package/build/services/LocalLlmProvider.d.ts +1 -0
- package/build/services/LocalLlmProvider.d.ts.map +1 -1
- package/build/services/LocalLlmProvider.js +62 -22
- package/build/services/LocalLlmProvider.js.map +1 -1
- package/build/services/LocalMiniappRuntime.d.ts +28 -6
- package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
- package/build/services/LocalMiniappRuntime.js +190 -148
- package/build/services/LocalMiniappRuntime.js.map +1 -1
- package/build/services/MemoryStore.d.ts +13 -1
- package/build/services/MemoryStore.d.ts.map +1 -1
- package/build/services/MemoryStore.js +98 -1
- package/build/services/MemoryStore.js.map +1 -1
- package/build/services/MiniappExitGesture.d.ts +6 -3
- package/build/services/MiniappExitGesture.d.ts.map +1 -1
- package/build/services/MiniappExitGesture.js +4 -4
- package/build/services/MiniappExitGesture.js.map +1 -1
- package/build/services/MiniappWidgetMode.d.ts +6 -4
- package/build/services/MiniappWidgetMode.d.ts.map +1 -1
- package/build/services/MiniappWidgetMode.js +7 -6
- package/build/services/MiniappWidgetMode.js.map +1 -1
- package/build/services/ProviderKeyValidation.d.ts +2 -0
- package/build/services/ProviderKeyValidation.d.ts.map +1 -1
- package/build/services/ProviderKeyValidation.js +4 -0
- package/build/services/ProviderKeyValidation.js.map +1 -1
- package/build/services/SceneRenderer.d.ts.map +1 -1
- package/build/services/SceneRenderer.js +3 -1
- package/build/services/SceneRenderer.js.map +1 -1
- package/build/services/ScreenshotFixture.d.ts +56 -0
- package/build/services/ScreenshotFixture.d.ts.map +1 -0
- package/build/services/ScreenshotFixture.js +72 -0
- package/build/services/ScreenshotFixture.js.map +1 -0
- package/build/services/actionInvoke.d.ts +37 -0
- package/build/services/actionInvoke.d.ts.map +1 -0
- package/build/services/actionInvoke.js +89 -0
- package/build/services/actionInvoke.js.map +1 -0
- package/build/services/appleWatch/AppleWatchLink.d.ts +42 -0
- package/build/services/appleWatch/AppleWatchLink.d.ts.map +1 -0
- package/build/services/appleWatch/AppleWatchLink.js +259 -0
- package/build/services/appleWatch/AppleWatchLink.js.map +1 -0
- package/build/services/controllers.d.ts.map +1 -1
- package/build/services/controllers.js +16 -0
- package/build/services/controllers.js.map +1 -1
- package/build/services/manifestActions.d.ts +4 -2
- package/build/services/manifestActions.d.ts.map +1 -1
- package/build/services/manifestActions.js +9 -3
- package/build/services/manifestActions.js.map +1 -1
- package/build/services/memoryBackupFile.d.ts +9 -0
- package/build/services/memoryBackupFile.d.ts.map +1 -0
- package/build/services/memoryBackupFile.js +47 -0
- package/build/services/memoryBackupFile.js.map +1 -0
- package/build/services/settingsBridge.d.ts +4 -4
- package/build/services/settingsBridge.d.ts.map +1 -1
- package/build/services/settingsBridge.js +9 -4
- package/build/services/settingsBridge.js.map +1 -1
- package/build/services/widgetPlacements.d.ts +8 -7
- package/build/services/widgetPlacements.d.ts.map +1 -1
- package/build/services/widgetPlacements.js +7 -6
- package/build/services/widgetPlacements.js.map +1 -1
- package/build/stores/apps.d.ts +6 -0
- package/build/stores/apps.d.ts.map +1 -1
- package/build/stores/apps.js +29 -12
- package/build/stores/apps.js.map +1 -1
- package/build/stores/bluetoothSettingKeys.d.ts +2 -0
- package/build/stores/bluetoothSettingKeys.d.ts.map +1 -1
- package/build/stores/bluetoothSettingKeys.js +17 -0
- package/build/stores/bluetoothSettingKeys.js.map +1 -1
- package/build/stores/settings.d.ts.map +1 -1
- package/build/stores/settings.js +42 -2
- package/build/stores/settings.js.map +1 -1
- package/build/types/applet.d.ts +5 -1
- package/build/types/applet.d.ts.map +1 -1
- package/build/types/applet.js.map +1 -1
- package/build/types/capabilities/rayneo-io.d.ts.map +1 -1
- package/build/types/capabilities/rayneo-io.js +2 -0
- package/build/types/capabilities/rayneo-io.js.map +1 -1
- package/build/types/enums.d.ts +2 -1
- package/build/types/enums.d.ts.map +1 -1
- package/build/types/enums.js +1 -0
- package/build/types/enums.js.map +1 -1
- package/build/utils/cloudClient/RnUdpAdapter.d.ts.map +1 -1
- package/build/utils/cloudClient/RnUdpAdapter.js +13 -2
- package/build/utils/cloudClient/RnUdpAdapter.js.map +1 -1
- package/build/utils/display/scene/index.d.ts +1 -1
- package/build/utils/display/scene/index.d.ts.map +1 -1
- package/build/utils/display/scene/index.js.map +1 -1
- package/build/utils/display/scene/process.d.ts.map +1 -1
- package/build/utils/display/scene/process.js +20 -1
- package/build/utils/display/scene/process.js.map +1 -1
- package/build/utils/display/scene/types.d.ts +1 -1
- package/build/utils/display/scene/types.d.ts.map +1 -1
- package/build/utils/display/scene/types.js.map +1 -1
- package/build/utils/miniappGlobals.d.ts +6 -0
- package/build/utils/miniappGlobals.d.ts.map +1 -1
- package/build/utils/miniappGlobals.js +28 -4
- package/build/utils/miniappGlobals.js.map +1 -1
- package/package.json +9 -9
- package/src/engine.ts +13 -1
- package/src/facades/ai.ts +3 -3
- package/src/facades/glasses.ts +65 -42
- package/src/facades/memory.ts +11 -2
- package/src/facades/miniapps.ts +3 -0
- package/src/facades/pairing.ts +4 -2
- package/src/facades/providerKeys.ts +6 -1
- package/src/generated/releaseMetadata.ts +4 -4
- package/src/services/AiTierResolution.ts +9 -3
- package/src/services/AppRegistry.ts +18 -3
- package/src/services/BlobStore.ts +3 -3
- package/src/services/BluetoothRestoreLaunch.ts +37 -0
- package/src/services/ForegroundLocationPermission.ts +1 -1
- package/src/services/GestureDotsService.ts +2 -1
- package/src/services/GlassesTouchInput.ts +86 -38
- package/src/services/LocalDisplayManager.ts +22 -8
- package/src/services/LocalLlmModelManager.ts +16 -6
- package/src/services/LocalLlmPrompt.ts +56 -37
- package/src/services/LocalLlmProvider.ts +74 -24
- package/src/services/LocalMiniappRuntime.ts +228 -147
- package/src/services/MemoryStore.ts +111 -2
- package/src/services/MiniappExitGesture.ts +8 -5
- package/src/services/MiniappWidgetMode.ts +9 -7
- package/src/services/ProviderKeyValidation.ts +5 -0
- package/src/services/SceneRenderer.ts +3 -1
- package/src/services/ScreenshotFixture.ts +113 -0
- package/src/services/actionInvoke.ts +105 -0
- package/src/services/appleWatch/AppleWatchLink.ts +297 -0
- package/src/services/controllers.ts +17 -0
- package/src/services/manifestActions.ts +16 -4
- package/src/services/memoryBackupFile.ts +50 -0
- package/src/services/settingsBridge.ts +9 -4
- package/src/services/widgetPlacements.ts +23 -9
- package/src/stores/apps.ts +35 -11
- package/src/stores/bluetoothSettingKeys.ts +20 -0
- package/src/stores/settings.ts +44 -2
- package/src/types/applet.ts +5 -1
- package/src/types/capabilities/rayneo-io.ts +2 -0
- package/src/types/enums.ts +1 -0
- package/src/utils/cloudClient/RnUdpAdapter.ts +13 -1
- package/src/utils/display/scene/index.ts +1 -0
- package/src/utils/display/scene/process.ts +17 -1
- package/src/utils/display/scene/types.ts +1 -0
- package/src/utils/miniappGlobals.ts +30 -4
package/src/stores/settings.ts
CHANGED
|
@@ -3,8 +3,9 @@ import {AsyncResult, result as Res, Result} from "typesafe-ts"
|
|
|
3
3
|
import {create} from "zustand"
|
|
4
4
|
import {subscribeWithSelector} from "zustand/middleware"
|
|
5
5
|
|
|
6
|
+
import {isScreenshotMode} from "../services/ScreenshotFixture"
|
|
6
7
|
import {storage} from "../utils/storage"
|
|
7
|
-
import {getBluetoothSettingKeysForDevice} from "./bluetoothSettingKeys"
|
|
8
|
+
import {getBluetoothSettingKeysForDevice, nativeMenuApps} from "./bluetoothSettingKeys"
|
|
8
9
|
import {useGlassesStore} from "./glasses"
|
|
9
10
|
|
|
10
11
|
export {MENTRA_LIVE_SETTING_KEYS, getBluetoothSettingKeysForDevice} from "./bluetoothSettingKeys"
|
|
@@ -144,6 +145,8 @@ export const SETTINGS: Record<string, Setting> = {
|
|
|
144
145
|
home_mirror: {
|
|
145
146
|
key: "home_mirror",
|
|
146
147
|
defaultValue: () => true,
|
|
148
|
+
// The store-screenshot build always shows the mirror under its fixture G2.
|
|
149
|
+
override: () => (isScreenshotMode() ? true : undefined),
|
|
147
150
|
writable: true,
|
|
148
151
|
saveOnServer: true,
|
|
149
152
|
persist: true,
|
|
@@ -352,6 +355,13 @@ export const SETTINGS: Record<string, Setting> = {
|
|
|
352
355
|
saveOnServer: false,
|
|
353
356
|
persist: true,
|
|
354
357
|
},
|
|
358
|
+
deepseek_api_key: {
|
|
359
|
+
key: "deepseek_api_key",
|
|
360
|
+
defaultValue: () => "",
|
|
361
|
+
writable: true,
|
|
362
|
+
saveOnServer: false,
|
|
363
|
+
persist: true,
|
|
364
|
+
},
|
|
355
365
|
elevenlabs_api_key: {
|
|
356
366
|
key: "elevenlabs_api_key",
|
|
357
367
|
defaultValue: () => "",
|
|
@@ -831,6 +841,15 @@ export const SETTINGS: Record<string, Setting> = {
|
|
|
831
841
|
saveOnServer: false,
|
|
832
842
|
persist: true,
|
|
833
843
|
},
|
|
844
|
+
// Apple Watch: draw the glasses' current frame behind the watch trackpad. Frames
|
|
845
|
+
// cross WatchConnectivity while the watch app is up, so it stays off unless asked for.
|
|
846
|
+
apple_watch_mirror: {
|
|
847
|
+
key: "apple_watch_mirror",
|
|
848
|
+
defaultValue: () => false,
|
|
849
|
+
writable: true,
|
|
850
|
+
saveOnServer: false,
|
|
851
|
+
persist: true,
|
|
852
|
+
},
|
|
834
853
|
// Maximum rate at which display updates leave the phone for the glasses.
|
|
835
854
|
// The Bluetooth SDK paces every scene frame and legacy layout to this,
|
|
836
855
|
// coalescing faster updates last-wins; clears bypass it. No effect on G2
|
|
@@ -1577,6 +1596,29 @@ export const useSettingsStore = create<SettingsState>()(
|
|
|
1577
1596
|
// desired value was applied so a transient failure retries on boot.
|
|
1578
1597
|
if (migrationSucceeded) storage.save(CAMERA_FOV_MIGRATION_KEY, true)
|
|
1579
1598
|
}
|
|
1599
|
+
|
|
1600
|
+
// Settings joined the Glasses Menu (the dashboard's glasses Settings
|
|
1601
|
+
// page): add it once, last, to a menu the wearer already saved. An
|
|
1602
|
+
// unsaved menu gets it from the default; a full one (10) is left alone.
|
|
1603
|
+
const MENU_SETTINGS_MIGRATION_KEY = "migration:menu_apps_settings_v1"
|
|
1604
|
+
const menuSettingsMigrationDone = storage.load<boolean>(MENU_SETTINGS_MIGRATION_KEY)
|
|
1605
|
+
if (menuSettingsMigrationDone.is_error() || !menuSettingsMigrationDone.value) {
|
|
1606
|
+
const menu = get().getSetting(SETTINGS.menu_apps.key) as Array<{packageName?: string}> | null
|
|
1607
|
+
let menuMigrated = true
|
|
1608
|
+
if (
|
|
1609
|
+
Array.isArray(menu) &&
|
|
1610
|
+
menu.length < 10 &&
|
|
1611
|
+
!menu.some((item) => item?.packageName === "com.glassly.settings")
|
|
1612
|
+
) {
|
|
1613
|
+
const next = [...menu, {packageName: "com.glassly.settings", name: "Settings"}]
|
|
1614
|
+
const result = await get().setSetting(SETTINGS.menu_apps.key, next, true)
|
|
1615
|
+
if (result.is_error()) {
|
|
1616
|
+
console.log("SETTINGS: menu_apps Settings migration failed:", result.error)
|
|
1617
|
+
menuMigrated = false
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
if (menuMigrated) storage.save(MENU_SETTINGS_MIGRATION_KEY, true)
|
|
1621
|
+
}
|
|
1580
1622
|
})
|
|
1581
1623
|
loadAllSettingsInFlight = inFlight
|
|
1582
1624
|
void Promise.resolve(inFlight).then((result) => {
|
|
@@ -1598,7 +1640,7 @@ export const useSettingsStore = create<SettingsState>()(
|
|
|
1598
1640
|
if (key === SETTINGS.core_token.key && (typeof value !== "string" || value.trim().length === 0)) {
|
|
1599
1641
|
continue
|
|
1600
1642
|
}
|
|
1601
|
-
bluetoothSettings[key] = value
|
|
1643
|
+
bluetoothSettings[key] = key === SETTINGS.menu_apps.key ? nativeMenuApps(value) : value
|
|
1602
1644
|
}
|
|
1603
1645
|
return bluetoothSettings
|
|
1604
1646
|
},
|
package/src/types/applet.ts
CHANGED
|
@@ -89,7 +89,7 @@ export interface DeclaredAction {
|
|
|
89
89
|
visibility?: "public" | "system"
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
export type DeclaredWidgetSize = "XS" | "SM" | "MD" | "LG"
|
|
92
|
+
export type DeclaredWidgetSize = "XS" | "XSM" | "SM" | "MD" | "LG"
|
|
93
93
|
|
|
94
94
|
/** A dashboard widget a miniapp declares in `miniapp.json` and serves through `session.widgets`. */
|
|
95
95
|
export interface DeclaredWidget {
|
|
@@ -97,6 +97,10 @@ export interface DeclaredWidget {
|
|
|
97
97
|
name: string
|
|
98
98
|
sizes: DeclaredWidgetSize[]
|
|
99
99
|
defaultSize: DeclaredWidgetSize
|
|
100
|
+
/** Lists the `EX` size: a tap on the selected widget can expand it to the full screen. */
|
|
101
|
+
expandable: boolean
|
|
102
|
+
/** A tap expands it rather than activating the card: expandable, and the wearer left expansion on. */
|
|
103
|
+
expandOnTap: boolean
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
export interface ClientApp extends AppletInterface {
|
|
@@ -32,6 +32,8 @@ export const rayneoIO: Capabilities = {
|
|
|
32
32
|
fieldOfView: {horizontal: 30},
|
|
33
33
|
maxTextLines: 5,
|
|
34
34
|
adjustBrightness: true,
|
|
35
|
+
// Both drivers map these settings onto the launcher's three heights and two distances.
|
|
36
|
+
positionRange: {height: {min: 0, max: 8}, depth: {min: 1, max: 3}},
|
|
35
37
|
|
|
36
38
|
// Scene display API — the Glassly CFW page canvas.
|
|
37
39
|
width: 540,
|
package/src/types/enums.ts
CHANGED
|
@@ -14,6 +14,8 @@ type CloudUdpSocket = ReturnType<typeof dgram.createSocket> & {
|
|
|
14
14
|
on(event: "message", cb: (msg: Uint8Array) => void): void
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
const SEND_FAILURE_WARN_INTERVAL_MS = 60_000
|
|
18
|
+
|
|
17
19
|
export function createCloudUdpSocket(): UdpSocketLike {
|
|
18
20
|
const socket = dgram.createSocket({type: "udp4"}) as CloudUdpSocket
|
|
19
21
|
let onBytes: ((bytes: Uint8Array) => void) | null = null
|
|
@@ -27,10 +29,20 @@ export function createCloudUdpSocket(): UdpSocketLike {
|
|
|
27
29
|
// Bind to any available port so the socket is ready to send.
|
|
28
30
|
socket.bind(0)
|
|
29
31
|
|
|
32
|
+
// A dead UDP path fails every frame and every 1 s liveness probe for the whole
|
|
33
|
+
// session; one line per minute says the same thing without flooding the log.
|
|
34
|
+
let failures = 0
|
|
35
|
+
let lastWarnAt = 0
|
|
36
|
+
|
|
30
37
|
return {
|
|
31
38
|
send(bytes: Uint8Array, host: string, port: number): void {
|
|
32
39
|
socket.send(bytes, 0, bytes.length, port, host, (err?: Error) => {
|
|
33
|
-
if (err)
|
|
40
|
+
if (!err) return
|
|
41
|
+
failures += 1
|
|
42
|
+
const now = Date.now()
|
|
43
|
+
if (now - lastWarnAt < SEND_FAILURE_WARN_INTERVAL_MS) return
|
|
44
|
+
lastWarnAt = now
|
|
45
|
+
console.warn(`[cloud-client udp] send failed to ${host}:${port} (${failures} so far): ${err.message}`)
|
|
34
46
|
})
|
|
35
47
|
},
|
|
36
48
|
onMessage(cb: (bytes: Uint8Array) => void): void {
|
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
ScenePoint,
|
|
22
22
|
SceneTextStyle,
|
|
23
23
|
SceneTransition,
|
|
24
|
+
SceneTransitionEdge,
|
|
24
25
|
} from "./types"
|
|
25
26
|
import {MAX_SCENE_DEPTH, POINT_SHAPE_ARITY, POINT_SHAPE_TYPES, elementContentHash} from "./types"
|
|
26
27
|
|
|
@@ -66,11 +67,24 @@ function pointsBox(points: ScenePoint[]): SceneBox {
|
|
|
66
67
|
return {x, y, w: Math.max(...xs) - x + 1, h: Math.max(...ys) - y + 1}
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
function validEdge(e: unknown): SceneTransitionEdge | undefined {
|
|
71
|
+
if (!e || typeof e !== "object") return undefined
|
|
72
|
+
const dx = Math.round(Number((e as SceneTransitionEdge).dx ?? 0))
|
|
73
|
+
const dy = Math.round(Number((e as SceneTransitionEdge).dy ?? 0))
|
|
74
|
+
if (!isFinite(dx) || !isFinite(dy) || Math.abs(dx) > 1024 || Math.abs(dy) > 1024) return undefined
|
|
75
|
+
return {dx, dy}
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
function validTransition(t: unknown): SceneTransition | undefined {
|
|
70
79
|
if (!t || typeof t !== "object") return undefined
|
|
71
80
|
const {durationMs, easing} = t as SceneTransition
|
|
72
81
|
if (!isFinite(durationMs) || durationMs <= 0) return undefined
|
|
73
|
-
|
|
82
|
+
const out: SceneTransition = easing ? {durationMs, easing} : {durationMs}
|
|
83
|
+
const enter = validEdge((t as SceneTransition).enter)
|
|
84
|
+
const exit = validEdge((t as SceneTransition).exit)
|
|
85
|
+
if (enter) out.enter = enter
|
|
86
|
+
if (exit) out.exit = exit
|
|
87
|
+
return out
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
function boxShrunk(orig: SceneBox, clamped: SceneBox): boolean {
|
|
@@ -175,6 +189,8 @@ export function processScene(
|
|
|
175
189
|
|
|
176
190
|
for (const {el, index, box, points} of valid) {
|
|
177
191
|
const transition = validTransition((el as {transition?: unknown}).transition)
|
|
192
|
+
// Leaving elements only exist to tween away; a device that jumps never shows them.
|
|
193
|
+
if (transition?.exit && !caps.animation) continue
|
|
178
194
|
const transform: {rotation?: number; pivot?: ScenePoint} = {}
|
|
179
195
|
if (el.rotation !== undefined || el.pivot !== undefined) {
|
|
180
196
|
const angle = el.rotation ?? 0
|
|
@@ -73,6 +73,35 @@ export interface BuildMiniappGlobalsOptions {
|
|
|
73
73
|
colorScheme?: MiniappColorScheme
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
function safeAreaCssVars(insets: MiniappSafeArea): Record<string, string> {
|
|
77
|
+
return {
|
|
78
|
+
"--glassly-safe-top": `${insets.top}px`,
|
|
79
|
+
"--glassly-safe-bottom": `${insets.bottom}px`,
|
|
80
|
+
"--glassly-safe-left": `${insets.left}px`,
|
|
81
|
+
"--glassly-safe-right": `${insets.right}px`,
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* JS to inject into a running miniapp when the host's safe area changes (an
|
|
87
|
+
* iPhone Duo folding moves its status rail): updates window.Glassly and the
|
|
88
|
+
* CSS variables, then fires `glassly:safe-area-change`.
|
|
89
|
+
*/
|
|
90
|
+
export function buildSafeAreaUpdateScript(insets: MiniappSafeArea): string {
|
|
91
|
+
const sets = Object.entries(safeAreaCssVars(insets))
|
|
92
|
+
.map(([k, v]) => `document.documentElement.style.setProperty(${JSON.stringify(k)}, ${JSON.stringify(v)});`)
|
|
93
|
+
.join("\n ")
|
|
94
|
+
return `
|
|
95
|
+
window.Glassly = window.Glassly || {};
|
|
96
|
+
window.Glassly.safeAreaInsets = ${JSON.stringify(insets)};
|
|
97
|
+
try {
|
|
98
|
+
${sets}
|
|
99
|
+
} catch (e) { /* ignore */ }
|
|
100
|
+
window.dispatchEvent(new Event("glassly:safe-area-change"));
|
|
101
|
+
true;
|
|
102
|
+
`
|
|
103
|
+
}
|
|
104
|
+
|
|
76
105
|
/**
|
|
77
106
|
* Returns the JS string to inject into a miniapp WebView before its content
|
|
78
107
|
* loads. Sets window.Glassly with the standard fields miniapps read:
|
|
@@ -105,10 +134,7 @@ export function buildMiniappGlobalsScript(opts: BuildMiniappGlobalsOptions): str
|
|
|
105
134
|
const insets = opts.safeAreaInsets
|
|
106
135
|
const capsuleCenter = capsule.top + capsule.height / 2
|
|
107
136
|
const cssVars: Record<string, string> = {
|
|
108
|
-
|
|
109
|
-
"--glassly-safe-bottom": `${insets.bottom}px`,
|
|
110
|
-
"--glassly-safe-left": `${insets.left}px`,
|
|
111
|
-
"--glassly-safe-right": `${insets.right}px`,
|
|
137
|
+
...safeAreaCssVars(insets),
|
|
112
138
|
"--glassly-capsule-top": `${capsule.top}px`,
|
|
113
139
|
"--glassly-capsule-bottom": `${capsule.bottom}px`,
|
|
114
140
|
"--glassly-capsule-left": `${capsule.left}px`,
|