@mentra/engine 0.1.0-beta.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 +79 -0
- package/build/devtools.d.ts +11 -0
- package/build/devtools.d.ts.map +1 -0
- package/build/devtools.js +13 -0
- package/build/devtools.js.map +1 -0
- package/build/engine.d.ts +261 -0
- package/build/engine.d.ts.map +1 -0
- package/build/engine.js +170 -0
- package/build/engine.js.map +1 -0
- package/build/facades/dev.d.ts +58 -0
- package/build/facades/dev.d.ts.map +1 -0
- package/build/facades/dev.js +189 -0
- package/build/facades/dev.js.map +1 -0
- package/build/facades/display.d.ts +21 -0
- package/build/facades/display.d.ts.map +1 -0
- package/build/facades/display.js +17 -0
- package/build/facades/display.js.map +1 -0
- package/build/facades/displayMirror.d.ts +15 -0
- package/build/facades/displayMirror.d.ts.map +1 -0
- package/build/facades/displayMirror.js +29 -0
- package/build/facades/displayMirror.js.map +1 -0
- package/build/facades/gallery.d.ts +62 -0
- package/build/facades/gallery.d.ts.map +1 -0
- package/build/facades/gallery.js +61 -0
- package/build/facades/gallery.js.map +1 -0
- package/build/facades/glasses.d.ts +141 -0
- package/build/facades/glasses.d.ts.map +1 -0
- package/build/facades/glasses.js +199 -0
- package/build/facades/glasses.js.map +1 -0
- package/build/facades/glassesSettings.d.ts +13 -0
- package/build/facades/glassesSettings.d.ts.map +1 -0
- package/build/facades/glassesSettings.js +54 -0
- package/build/facades/glassesSettings.js.map +1 -0
- package/build/facades/glassesWifi.d.ts +25 -0
- package/build/facades/glassesWifi.d.ts.map +1 -0
- package/build/facades/glassesWifi.js +57 -0
- package/build/facades/glassesWifi.js.map +1 -0
- package/build/facades/miniapps.d.ts +43 -0
- package/build/facades/miniapps.d.ts.map +1 -0
- package/build/facades/miniapps.js +49 -0
- package/build/facades/miniapps.js.map +1 -0
- package/build/facades/notifications.d.ts +13 -0
- package/build/facades/notifications.d.ts.map +1 -0
- package/build/facades/notifications.js +12 -0
- package/build/facades/notifications.js.map +1 -0
- package/build/facades/ota.d.ts +103 -0
- package/build/facades/ota.d.ts.map +1 -0
- package/build/facades/ota.js +156 -0
- package/build/facades/ota.js.map +1 -0
- package/build/facades/pairing.d.ts +114 -0
- package/build/facades/pairing.d.ts.map +1 -0
- package/build/facades/pairing.js +275 -0
- package/build/facades/pairing.js.map +1 -0
- package/build/facades/permissions.d.ts +33 -0
- package/build/facades/permissions.d.ts.map +1 -0
- package/build/facades/permissions.js +155 -0
- package/build/facades/permissions.js.map +1 -0
- package/build/facades/phoneNotifications.d.ts +21 -0
- package/build/facades/phoneNotifications.d.ts.map +1 -0
- package/build/facades/phoneNotifications.js +51 -0
- package/build/facades/phoneNotifications.js.map +1 -0
- package/build/facades/reports.d.ts +36 -0
- package/build/facades/reports.d.ts.map +1 -0
- package/build/facades/reports.js +134 -0
- package/build/facades/reports.js.map +1 -0
- package/build/facades/session.d.ts +21 -0
- package/build/facades/session.d.ts.map +1 -0
- package/build/facades/session.js +52 -0
- package/build/facades/session.js.map +1 -0
- package/build/facades/settings.d.ts +37 -0
- package/build/facades/settings.d.ts.map +1 -0
- package/build/facades/settings.js +55 -0
- package/build/facades/settings.js.map +1 -0
- package/build/facades/speech.d.ts +30 -0
- package/build/facades/speech.d.ts.map +1 -0
- package/build/facades/speech.js +37 -0
- package/build/facades/speech.js.map +1 -0
- package/build/index.d.ts +43 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +45 -0
- package/build/index.js.map +1 -0
- package/build/internal.d.ts +67 -0
- package/build/internal.d.ts.map +1 -0
- package/build/internal.js +90 -0
- package/build/internal.js.map +1 -0
- package/build/runtime/bootstrap.d.ts +83 -0
- package/build/runtime/bootstrap.d.ts.map +1 -0
- package/build/runtime/bootstrap.js +56 -0
- package/build/runtime/bootstrap.js.map +1 -0
- package/build/runtime/config.d.ts +146 -0
- package/build/runtime/config.d.ts.map +1 -0
- package/build/runtime/config.js +18 -0
- package/build/runtime/config.js.map +1 -0
- package/build/runtime/streamConfig.d.ts +4 -0
- package/build/runtime/streamConfig.d.ts.map +1 -0
- package/build/runtime/streamConfig.js +38 -0
- package/build/runtime/streamConfig.js.map +1 -0
- package/build/services/AppRegistry.d.ts +269 -0
- package/build/services/AppRegistry.d.ts.map +1 -0
- package/build/services/AppRegistry.js +1079 -0
- package/build/services/AppRegistry.js.map +1 -0
- package/build/services/AudioCloudUplink.d.ts +9 -0
- package/build/services/AudioCloudUplink.d.ts.map +1 -0
- package/build/services/AudioCloudUplink.js +48 -0
- package/build/services/AudioCloudUplink.js.map +1 -0
- package/build/services/AudioPlaybackService.d.ts +175 -0
- package/build/services/AudioPlaybackService.d.ts.map +1 -0
- package/build/services/AudioPlaybackService.js +705 -0
- package/build/services/AudioPlaybackService.js.map +1 -0
- package/build/services/AutomaticReportResult.d.ts +20 -0
- package/build/services/AutomaticReportResult.d.ts.map +1 -0
- package/build/services/AutomaticReportResult.js +29 -0
- package/build/services/AutomaticReportResult.js.map +1 -0
- package/build/services/BlobStore.d.ts +91 -0
- package/build/services/BlobStore.d.ts.map +1 -0
- package/build/services/BlobStore.js +668 -0
- package/build/services/BlobStore.js.map +1 -0
- package/build/services/CaptionsTesterReportService.d.ts +4 -0
- package/build/services/CaptionsTesterReportService.d.ts.map +1 -0
- package/build/services/CaptionsTesterReportService.js +80 -0
- package/build/services/CaptionsTesterReportService.js.map +1 -0
- package/build/services/CloudAudioSubscriptionSync.d.ts +24 -0
- package/build/services/CloudAudioSubscriptionSync.d.ts.map +1 -0
- package/build/services/CloudAudioSubscriptionSync.js +39 -0
- package/build/services/CloudAudioSubscriptionSync.js.map +1 -0
- package/build/services/CloudClientService.d.ts +143 -0
- package/build/services/CloudClientService.d.ts.map +1 -0
- package/build/services/CloudClientService.js +644 -0
- package/build/services/CloudClientService.js.map +1 -0
- package/build/services/CloudTranscriptE2EMetrics.d.ts +4 -0
- package/build/services/CloudTranscriptE2EMetrics.d.ts.map +1 -0
- package/build/services/CloudTranscriptE2EMetrics.js +24 -0
- package/build/services/CloudTranscriptE2EMetrics.js.map +1 -0
- package/build/services/ConnectionCoordinator.d.ts +51 -0
- package/build/services/ConnectionCoordinator.d.ts.map +1 -0
- package/build/services/ConnectionCoordinator.js +34 -0
- package/build/services/ConnectionCoordinator.js.map +1 -0
- package/build/services/DevServerBridge.d.ts +63 -0
- package/build/services/DevServerBridge.d.ts.map +1 -0
- package/build/services/DevServerBridge.js +294 -0
- package/build/services/DevServerBridge.js.map +1 -0
- package/build/services/DeviceEventRouter.d.ts +3 -0
- package/build/services/DeviceEventRouter.d.ts.map +1 -0
- package/build/services/DeviceEventRouter.js +190 -0
- package/build/services/DeviceEventRouter.js.map +1 -0
- package/build/services/DeviceStoreHydration.d.ts +38 -0
- package/build/services/DeviceStoreHydration.d.ts.map +1 -0
- package/build/services/DeviceStoreHydration.js +124 -0
- package/build/services/DeviceStoreHydration.js.map +1 -0
- package/build/services/DisplayProcessor.d.ts +223 -0
- package/build/services/DisplayProcessor.d.ts.map +1 -0
- package/build/services/DisplayProcessor.js +552 -0
- package/build/services/DisplayProcessor.js.map +1 -0
- package/build/services/GlassesReadiness.d.ts +41 -0
- package/build/services/GlassesReadiness.d.ts.map +1 -0
- package/build/services/GlassesReadiness.js +82 -0
- package/build/services/GlassesReadiness.js.map +1 -0
- package/build/services/GlassesSettingsSync.d.ts +33 -0
- package/build/services/GlassesSettingsSync.d.ts.map +1 -0
- package/build/services/GlassesSettingsSync.js +121 -0
- package/build/services/GlassesSettingsSync.js.map +1 -0
- package/build/services/GlassesStatusProjection.d.ts +3 -0
- package/build/services/GlassesStatusProjection.d.ts.map +1 -0
- package/build/services/GlassesStatusProjection.js +65 -0
- package/build/services/GlassesStatusProjection.js.map +1 -0
- package/build/services/HeadingService.d.ts +27 -0
- package/build/services/HeadingService.d.ts.map +1 -0
- package/build/services/HeadingService.js +96 -0
- package/build/services/HeadingService.js.map +1 -0
- package/build/services/LocalDisplayManager.d.ts +139 -0
- package/build/services/LocalDisplayManager.d.ts.map +1 -0
- package/build/services/LocalDisplayManager.js +579 -0
- package/build/services/LocalDisplayManager.js.map +1 -0
- package/build/services/LocalMiniappRuntime.d.ts +439 -0
- package/build/services/LocalMiniappRuntime.d.ts.map +1 -0
- package/build/services/LocalMiniappRuntime.js +3695 -0
- package/build/services/LocalMiniappRuntime.js.map +1 -0
- package/build/services/LocalSttFallbackCoordinator.d.ts +57 -0
- package/build/services/LocalSttFallbackCoordinator.d.ts.map +1 -0
- package/build/services/LocalSttFallbackCoordinator.js +137 -0
- package/build/services/LocalSttFallbackCoordinator.js.map +1 -0
- package/build/services/MentraJSCrashController.d.ts +97 -0
- package/build/services/MentraJSCrashController.d.ts.map +1 -0
- package/build/services/MentraJSCrashController.js +138 -0
- package/build/services/MentraJSCrashController.js.map +1 -0
- package/build/services/MentraJSCrashloopReportService.d.ts +9 -0
- package/build/services/MentraJSCrashloopReportService.d.ts.map +1 -0
- package/build/services/MentraJSCrashloopReportService.js +54 -0
- package/build/services/MentraJSCrashloopReportService.js.map +1 -0
- package/build/services/MentraJSLogPipeline.d.ts +87 -0
- package/build/services/MentraJSLogPipeline.d.ts.map +1 -0
- package/build/services/MentraJSLogPipeline.js +137 -0
- package/build/services/MentraJSLogPipeline.js.map +1 -0
- package/build/services/MentraJSRouter.d.ts +203 -0
- package/build/services/MentraJSRouter.d.ts.map +1 -0
- package/build/services/MentraJSRouter.js +480 -0
- package/build/services/MentraJSRouter.js.map +1 -0
- package/build/services/MentraUIRouter.d.ts +137 -0
- package/build/services/MentraUIRouter.d.ts.map +1 -0
- package/build/services/MentraUIRouter.js +210 -0
- package/build/services/MentraUIRouter.js.map +1 -0
- package/build/services/MicStateCoordinator.d.ts +37 -0
- package/build/services/MicStateCoordinator.d.ts.map +1 -0
- package/build/services/MicStateCoordinator.js +81 -0
- package/build/services/MicStateCoordinator.js.map +1 -0
- package/build/services/MiniappEngine.d.ts +31 -0
- package/build/services/MiniappEngine.d.ts.map +1 -0
- package/build/services/MiniappEngine.js +119 -0
- package/build/services/MiniappEngine.js.map +1 -0
- package/build/services/MiniappLauncher.d.ts +129 -0
- package/build/services/MiniappLauncher.d.ts.map +1 -0
- package/build/services/MiniappLauncher.js +291 -0
- package/build/services/MiniappLauncher.js.map +1 -0
- package/build/services/MiniappRunningRegistry.d.ts +24 -0
- package/build/services/MiniappRunningRegistry.d.ts.map +1 -0
- package/build/services/MiniappRunningRegistry.js +52 -0
- package/build/services/MiniappRunningRegistry.js.map +1 -0
- package/build/services/NativeHttpResponse.d.ts +3 -0
- package/build/services/NativeHttpResponse.d.ts.map +1 -0
- package/build/services/NativeHttpResponse.js +6 -0
- package/build/services/NativeHttpResponse.js.map +1 -0
- package/build/services/NavigationHandlers.d.ts +90 -0
- package/build/services/NavigationHandlers.d.ts.map +1 -0
- package/build/services/NavigationHandlers.js +379 -0
- package/build/services/NavigationHandlers.js.map +1 -0
- package/build/services/NavigationService.d.ts +254 -0
- package/build/services/NavigationService.d.ts.map +1 -0
- package/build/services/NavigationService.js +553 -0
- package/build/services/NavigationService.js.map +1 -0
- package/build/services/NotificationsEmitter.d.ts +28 -0
- package/build/services/NotificationsEmitter.d.ts.map +1 -0
- package/build/services/NotificationsEmitter.js +22 -0
- package/build/services/NotificationsEmitter.js.map +1 -0
- package/build/services/OfflineSpeechModelService.d.ts +33 -0
- package/build/services/OfflineSpeechModelService.d.ts.map +1 -0
- package/build/services/OfflineSpeechModelService.js +136 -0
- package/build/services/OfflineSpeechModelService.js.map +1 -0
- package/build/services/OtaInstallCoordinator.d.ts +195 -0
- package/build/services/OtaInstallCoordinator.d.ts.map +1 -0
- package/build/services/OtaInstallCoordinator.js +1047 -0
- package/build/services/OtaInstallCoordinator.js.map +1 -0
- package/build/services/OtaService.d.ts +3 -0
- package/build/services/OtaService.d.ts.map +1 -0
- package/build/services/OtaService.js +65 -0
- package/build/services/OtaService.js.map +1 -0
- package/build/services/OtaUpdateCheckService.d.ts +65 -0
- package/build/services/OtaUpdateCheckService.d.ts.map +1 -0
- package/build/services/OtaUpdateCheckService.js +260 -0
- package/build/services/OtaUpdateCheckService.js.map +1 -0
- package/build/services/PairingIdentity.d.ts +80 -0
- package/build/services/PairingIdentity.d.ts.map +1 -0
- package/build/services/PairingIdentity.js +145 -0
- package/build/services/PairingIdentity.js.map +1 -0
- package/build/services/PhoneCalendarHelpers.d.ts +32 -0
- package/build/services/PhoneCalendarHelpers.d.ts.map +1 -0
- package/build/services/PhoneCalendarHelpers.js +157 -0
- package/build/services/PhoneCalendarHelpers.js.map +1 -0
- package/build/services/PhoneCalendarService.d.ts +5 -0
- package/build/services/PhoneCalendarService.d.ts.map +1 -0
- package/build/services/PhoneCalendarService.js +24 -0
- package/build/services/PhoneCalendarService.js.map +1 -0
- package/build/services/PhoneCameraFovCoordinator.d.ts +28 -0
- package/build/services/PhoneCameraFovCoordinator.d.ts.map +1 -0
- package/build/services/PhoneCameraFovCoordinator.js +180 -0
- package/build/services/PhoneCameraFovCoordinator.js.map +1 -0
- package/build/services/PhoneLocationService.d.ts +36 -0
- package/build/services/PhoneLocationService.d.ts.map +1 -0
- package/build/services/PhoneLocationService.js +115 -0
- package/build/services/PhoneLocationService.js.map +1 -0
- package/build/services/PhoneNotificationsSync.d.ts +3 -0
- package/build/services/PhoneNotificationsSync.d.ts.map +1 -0
- package/build/services/PhoneNotificationsSync.js +35 -0
- package/build/services/PhoneNotificationsSync.js.map +1 -0
- package/build/services/PhonePhotoCoordinator.d.ts +103 -0
- package/build/services/PhonePhotoCoordinator.d.ts.map +1 -0
- package/build/services/PhonePhotoCoordinator.js +326 -0
- package/build/services/PhonePhotoCoordinator.js.map +1 -0
- package/build/services/PhoneStreamCoordinator.d.ts +168 -0
- package/build/services/PhoneStreamCoordinator.d.ts.map +1 -0
- package/build/services/PhoneStreamCoordinator.js +632 -0
- package/build/services/PhoneStreamCoordinator.js.map +1 -0
- package/build/services/PhoneVideoCoordinator.d.ts +50 -0
- package/build/services/PhoneVideoCoordinator.d.ts.map +1 -0
- package/build/services/PhoneVideoCoordinator.js +147 -0
- package/build/services/PhoneVideoCoordinator.js.map +1 -0
- package/build/services/STTModelManager.d.ts +65 -0
- package/build/services/STTModelManager.d.ts.map +1 -0
- package/build/services/STTModelManager.js +292 -0
- package/build/services/STTModelManager.js.map +1 -0
- package/build/services/SceneRenderer.d.ts +90 -0
- package/build/services/SceneRenderer.d.ts.map +1 -0
- package/build/services/SceneRenderer.js +248 -0
- package/build/services/SceneRenderer.js.map +1 -0
- package/build/services/SentenceTtsPipeline.d.ts +31 -0
- package/build/services/SentenceTtsPipeline.d.ts.map +1 -0
- package/build/services/SentenceTtsPipeline.js +67 -0
- package/build/services/SentenceTtsPipeline.js.map +1 -0
- package/build/services/StreamLifecycleController.d.ts +67 -0
- package/build/services/StreamLifecycleController.d.ts.map +1 -0
- package/build/services/StreamLifecycleController.js +152 -0
- package/build/services/StreamLifecycleController.js.map +1 -0
- package/build/services/TTSModelManager.d.ts +90 -0
- package/build/services/TTSModelManager.d.ts.map +1 -0
- package/build/services/TTSModelManager.js +366 -0
- package/build/services/TTSModelManager.js.map +1 -0
- package/build/services/TranscriptionRouting.d.ts +12 -0
- package/build/services/TranscriptionRouting.d.ts.map +1 -0
- package/build/services/TranscriptionRouting.js +24 -0
- package/build/services/TranscriptionRouting.js.map +1 -0
- package/build/services/WebviewBridge.d.ts +22 -0
- package/build/services/WebviewBridge.d.ts.map +1 -0
- package/build/services/WebviewBridge.js +47 -0
- package/build/services/WebviewBridge.js.map +1 -0
- package/build/services/asg/GalleryMediaIntegrityReportService.d.ts +17 -0
- package/build/services/asg/GalleryMediaIntegrityReportService.d.ts.map +1 -0
- package/build/services/asg/GalleryMediaIntegrityReportService.js +43 -0
- package/build/services/asg/GalleryMediaIntegrityReportService.js.map +1 -0
- package/build/services/asg/asgCameraApi.d.ts +205 -0
- package/build/services/asg/asgCameraApi.d.ts.map +1 -0
- package/build/services/asg/asgCameraApi.js +1410 -0
- package/build/services/asg/asgCameraApi.js.map +1 -0
- package/build/services/asg/cameraRollExportCoordinator.d.ts +60 -0
- package/build/services/asg/cameraRollExportCoordinator.d.ts.map +1 -0
- package/build/services/asg/cameraRollExportCoordinator.js +618 -0
- package/build/services/asg/cameraRollExportCoordinator.js.map +1 -0
- package/build/services/asg/cameraRollExportLedger.d.ts +44 -0
- package/build/services/asg/cameraRollExportLedger.d.ts.map +1 -0
- package/build/services/asg/cameraRollExportLedger.js +78 -0
- package/build/services/asg/cameraRollExportLedger.js.map +1 -0
- package/build/services/asg/galleryMediaValidation.d.ts +29 -0
- package/build/services/asg/galleryMediaValidation.d.ts.map +1 -0
- package/build/services/asg/galleryMediaValidation.js +149 -0
- package/build/services/asg/galleryMediaValidation.js.map +1 -0
- package/build/services/asg/galleryNotices.d.ts +33 -0
- package/build/services/asg/galleryNotices.d.ts.map +1 -0
- package/build/services/asg/galleryNotices.js +29 -0
- package/build/services/asg/galleryNotices.js.map +1 -0
- package/build/services/asg/galleryPathMigration.d.ts +3 -0
- package/build/services/asg/galleryPathMigration.d.ts.map +1 -0
- package/build/services/asg/galleryPathMigration.js +26 -0
- package/build/services/asg/galleryPathMigration.js.map +1 -0
- package/build/services/asg/gallerySettingsService.d.ts +20 -0
- package/build/services/asg/gallerySettingsService.d.ts.map +1 -0
- package/build/services/asg/gallerySettingsService.js +53 -0
- package/build/services/asg/gallerySettingsService.js.map +1 -0
- package/build/services/asg/gallerySyncNotifications.d.ts +56 -0
- package/build/services/asg/gallerySyncNotifications.d.ts.map +1 -0
- package/build/services/asg/gallerySyncNotifications.js +198 -0
- package/build/services/asg/gallerySyncNotifications.js.map +1 -0
- package/build/services/asg/gallerySyncService.d.ts +137 -0
- package/build/services/asg/gallerySyncService.d.ts.map +1 -0
- package/build/services/asg/gallerySyncService.js +1933 -0
- package/build/services/asg/gallerySyncService.js.map +1 -0
- package/build/services/asg/galleryTransferLedger.d.ts +58 -0
- package/build/services/asg/galleryTransferLedger.d.ts.map +1 -0
- package/build/services/asg/galleryTransferLedger.js +225 -0
- package/build/services/asg/galleryTransferLedger.js.map +1 -0
- package/build/services/asg/localNetworkTransport.d.ts +15 -0
- package/build/services/asg/localNetworkTransport.d.ts.map +1 -0
- package/build/services/asg/localNetworkTransport.js +144 -0
- package/build/services/asg/localNetworkTransport.js.map +1 -0
- package/build/services/asg/localStorageService.d.ts +146 -0
- package/build/services/asg/localStorageService.d.ts.map +1 -0
- package/build/services/asg/localStorageService.js +572 -0
- package/build/services/asg/localStorageService.js.map +1 -0
- package/build/services/asg/mediaProcessingQueue.d.ts +70 -0
- package/build/services/asg/mediaProcessingQueue.d.ts.map +1 -0
- package/build/services/asg/mediaProcessingQueue.js +451 -0
- package/build/services/asg/mediaProcessingQueue.js.map +1 -0
- package/build/services/asgOtaVersionUrl.d.ts +2 -0
- package/build/services/asgOtaVersionUrl.d.ts.map +1 -0
- package/build/services/asgOtaVersionUrl.js +36 -0
- package/build/services/asgOtaVersionUrl.js.map +1 -0
- package/build/services/blobPaths.d.ts +31 -0
- package/build/services/blobPaths.d.ts.map +1 -0
- package/build/services/blobPaths.js +86 -0
- package/build/services/blobPaths.js.map +1 -0
- package/build/services/cloudStreamApi.d.ts +59 -0
- package/build/services/cloudStreamApi.d.ts.map +1 -0
- package/build/services/cloudStreamApi.js +81 -0
- package/build/services/cloudStreamApi.js.map +1 -0
- package/build/services/gallerySyncClock.d.ts +17 -0
- package/build/services/gallerySyncClock.d.ts.map +1 -0
- package/build/services/gallerySyncClock.js +21 -0
- package/build/services/gallerySyncClock.js.map +1 -0
- package/build/services/glassesClockSync.d.ts +20 -0
- package/build/services/glassesClockSync.d.ts.map +1 -0
- package/build/services/glassesClockSync.js +97 -0
- package/build/services/glassesClockSync.js.map +1 -0
- package/build/services/manifestVersionGate.d.ts +28 -0
- package/build/services/manifestVersionGate.d.ts.map +1 -0
- package/build/services/manifestVersionGate.js +41 -0
- package/build/services/manifestVersionGate.js.map +1 -0
- package/build/services/mentraUiShim.d.ts +38 -0
- package/build/services/mentraUiShim.d.ts.map +1 -0
- package/build/services/mentraUiShim.js +360 -0
- package/build/services/mentraUiShim.js.map +1 -0
- package/build/services/navigation/roadNameResolver.d.ts +67 -0
- package/build/services/navigation/roadNameResolver.d.ts.map +1 -0
- package/build/services/navigation/roadNameResolver.js +96 -0
- package/build/services/navigation/roadNameResolver.js.map +1 -0
- package/build/services/navigation/routesApiCodec.d.ts +38 -0
- package/build/services/navigation/routesApiCodec.d.ts.map +1 -0
- package/build/services/navigation/routesApiCodec.js +68 -0
- package/build/services/navigation/routesApiCodec.js.map +1 -0
- package/build/services/otaDisplayState.d.ts +42 -0
- package/build/services/otaDisplayState.d.ts.map +1 -0
- package/build/services/otaDisplayState.js +92 -0
- package/build/services/otaDisplayState.js.map +1 -0
- package/build/services/otaInstallPolicy.d.ts +81 -0
- package/build/services/otaInstallPolicy.d.ts.map +1 -0
- package/build/services/otaInstallPolicy.js +96 -0
- package/build/services/otaInstallPolicy.js.map +1 -0
- package/build/services/otaLegacyMapping.d.ts +22 -0
- package/build/services/otaLegacyMapping.d.ts.map +1 -0
- package/build/services/otaLegacyMapping.js +56 -0
- package/build/services/otaLegacyMapping.js.map +1 -0
- package/build/services/slimStreamStatus.d.ts +7 -0
- package/build/services/slimStreamStatus.d.ts.map +1 -0
- package/build/services/slimStreamStatus.js +26 -0
- package/build/services/slimStreamStatus.js.map +1 -0
- package/build/stores/apps.d.ts +104 -0
- package/build/stores/apps.d.ts.map +1 -0
- package/build/stores/apps.js +492 -0
- package/build/stores/apps.js.map +1 -0
- package/build/stores/bluetoothSettingKeys.d.ts +4 -0
- package/build/stores/bluetoothSettingKeys.d.ts.map +1 -0
- package/build/stores/bluetoothSettingKeys.js +31 -0
- package/build/stores/bluetoothSettingKeys.js.map +1 -0
- package/build/stores/cloudClientStatus.d.ts +9 -0
- package/build/stores/cloudClientStatus.d.ts.map +1 -0
- package/build/stores/cloudClientStatus.js +24 -0
- package/build/stores/cloudClientStatus.js.map +1 -0
- package/build/stores/connection.d.ts +22 -0
- package/build/stores/connection.d.ts.map +1 -0
- package/build/stores/connection.js +43 -0
- package/build/stores/connection.js.map +1 -0
- package/build/stores/core.d.ts +15 -0
- package/build/stores/core.d.ts.map +1 -0
- package/build/stores/core.js +21 -0
- package/build/stores/core.js.map +1 -0
- package/build/stores/display.d.ts +24 -0
- package/build/stores/display.d.ts.map +1 -0
- package/build/stores/display.js +96 -0
- package/build/stores/display.js.map +1 -0
- package/build/stores/gallerySync.d.ts +101 -0
- package/build/stores/gallerySync.d.ts.map +1 -0
- package/build/stores/gallerySync.js +217 -0
- package/build/stores/gallerySync.js.map +1 -0
- package/build/stores/glasses.d.ts +62 -0
- package/build/stores/glasses.d.ts.map +1 -0
- package/build/stores/glasses.js +203 -0
- package/build/stores/glasses.js.map +1 -0
- package/build/stores/settings.d.ts +37 -0
- package/build/stores/settings.d.ts.map +1 -0
- package/build/stores/settings.js +922 -0
- package/build/stores/settings.js.map +1 -0
- package/build/types/applet.d.ts +96 -0
- package/build/types/applet.d.ts.map +1 -0
- package/build/types/applet.js +5 -0
- package/build/types/applet.js.map +1 -0
- package/build/types/asg.d.ts +53 -0
- package/build/types/asg.d.ts.map +1 -0
- package/build/types/asg.js +2 -0
- package/build/types/asg.js.map +1 -0
- package/build/types/capabilities/even-realities-g1.d.ts +12 -0
- package/build/types/capabilities/even-realities-g1.d.ts.map +1 -0
- package/build/types/capabilities/even-realities-g1.js +55 -0
- package/build/types/capabilities/even-realities-g1.js.map +1 -0
- package/build/types/capabilities/even-realities-g2.d.ts +12 -0
- package/build/types/capabilities/even-realities-g2.d.ts.map +1 -0
- package/build/types/capabilities/even-realities-g2.js +75 -0
- package/build/types/capabilities/even-realities-g2.js.map +1 -0
- package/build/types/capabilities/mentra-display.d.ts +12 -0
- package/build/types/capabilities/mentra-display.d.ts.map +1 -0
- package/build/types/capabilities/mentra-display.js +63 -0
- package/build/types/capabilities/mentra-display.js.map +1 -0
- package/build/types/capabilities/mentra-live.d.ts +12 -0
- package/build/types/capabilities/mentra-live.d.ts.map +1 -0
- package/build/types/capabilities/mentra-live.js +92 -0
- package/build/types/capabilities/mentra-live.js.map +1 -0
- package/build/types/capabilities/none.d.ts +13 -0
- package/build/types/capabilities/none.d.ts.map +1 -0
- package/build/types/capabilities/none.js +65 -0
- package/build/types/capabilities/none.js.map +1 -0
- package/build/types/capabilities/simulated-glasses.d.ts +13 -0
- package/build/types/capabilities/simulated-glasses.d.ts.map +1 -0
- package/build/types/capabilities/simulated-glasses.js +65 -0
- package/build/types/capabilities/simulated-glasses.js.map +1 -0
- package/build/types/capabilities/vuzix-z100.d.ts +12 -0
- package/build/types/capabilities/vuzix-z100.d.ts.map +1 -0
- package/build/types/capabilities/vuzix-z100.js +52 -0
- package/build/types/capabilities/vuzix-z100.js.map +1 -0
- package/build/types/enums.d.ts +40 -0
- package/build/types/enums.d.ts.map +1 -0
- package/build/types/enums.js +44 -0
- package/build/types/enums.js.map +1 -0
- package/build/types/hardware.d.ts +160 -0
- package/build/types/hardware.d.ts.map +1 -0
- package/build/types/hardware.js +36 -0
- package/build/types/hardware.js.map +1 -0
- package/build/types/index.d.ts +11 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +10 -0
- package/build/types/index.js.map +1 -0
- package/build/utils/GlobalEventEmitter.d.ts +10 -0
- package/build/utils/GlobalEventEmitter.d.ts.map +1 -0
- package/build/utils/GlobalEventEmitter.js +13 -0
- package/build/utils/GlobalEventEmitter.js.map +1 -0
- package/build/utils/cloudClient/RnUdpAdapter.d.ts +3 -0
- package/build/utils/cloudClient/RnUdpAdapter.d.ts.map +1 -0
- package/build/utils/cloudClient/RnUdpAdapter.js +41 -0
- package/build/utils/cloudClient/RnUdpAdapter.js.map +1 -0
- package/build/utils/cloudClient/cloudSecureStore.d.ts +3 -0
- package/build/utils/cloudClient/cloudSecureStore.d.ts.map +1 -0
- package/build/utils/cloudClient/cloudSecureStore.js +26 -0
- package/build/utils/cloudClient/cloudSecureStore.js.map +1 -0
- package/build/utils/debouncedPatch.d.ts +6 -0
- package/build/utils/debouncedPatch.d.ts.map +1 -0
- package/build/utils/debouncedPatch.js +25 -0
- package/build/utils/debouncedPatch.js.map +1 -0
- package/build/utils/devLogging.d.ts +26 -0
- package/build/utils/devLogging.d.ts.map +1 -0
- package/build/utils/devLogging.js +116 -0
- package/build/utils/devLogging.js.map +1 -0
- package/build/utils/devMiniappLaunch.d.ts +44 -0
- package/build/utils/devMiniappLaunch.d.ts.map +1 -0
- package/build/utils/devMiniappLaunch.js +52 -0
- package/build/utils/devMiniappLaunch.js.map +1 -0
- package/build/utils/diagnosticContext.d.ts +3 -0
- package/build/utils/diagnosticContext.d.ts.map +1 -0
- package/build/utils/diagnosticContext.js +119 -0
- package/build/utils/diagnosticContext.js.map +1 -0
- package/build/utils/display/composer/ColumnComposer.d.ts +131 -0
- package/build/utils/display/composer/ColumnComposer.d.ts.map +1 -0
- package/build/utils/display/composer/ColumnComposer.js +204 -0
- package/build/utils/display/composer/ColumnComposer.js.map +1 -0
- package/build/utils/display/composer/index.d.ts +9 -0
- package/build/utils/display/composer/index.d.ts.map +1 -0
- package/build/utils/display/composer/index.js +9 -0
- package/build/utils/display/composer/index.js.map +1 -0
- package/build/utils/display/helpers/DisplayHelpers.d.ts +165 -0
- package/build/utils/display/helpers/DisplayHelpers.d.ts.map +1 -0
- package/build/utils/display/helpers/DisplayHelpers.js +312 -0
- package/build/utils/display/helpers/DisplayHelpers.js.map +1 -0
- package/build/utils/display/helpers/ScrollView.d.ts +183 -0
- package/build/utils/display/helpers/ScrollView.d.ts.map +1 -0
- package/build/utils/display/helpers/ScrollView.js +257 -0
- package/build/utils/display/helpers/ScrollView.js.map +1 -0
- package/build/utils/display/helpers/index.d.ts +11 -0
- package/build/utils/display/helpers/index.d.ts.map +1 -0
- package/build/utils/display/helpers/index.js +10 -0
- package/build/utils/display/helpers/index.js.map +1 -0
- package/build/utils/display/index.d.ts +174 -0
- package/build/utils/display/index.d.ts.map +1 -0
- package/build/utils/display/index.js +185 -0
- package/build/utils/display/index.js.map +1 -0
- package/build/utils/display/measurer/TextMeasurer.d.ts +160 -0
- package/build/utils/display/measurer/TextMeasurer.d.ts.map +1 -0
- package/build/utils/display/measurer/TextMeasurer.js +273 -0
- package/build/utils/display/measurer/TextMeasurer.js.map +1 -0
- package/build/utils/display/measurer/index.d.ts +10 -0
- package/build/utils/display/measurer/index.d.ts.map +1 -0
- package/build/utils/display/measurer/index.js +11 -0
- package/build/utils/display/measurer/index.js.map +1 -0
- package/build/utils/display/measurer/script-detection.d.ts +53 -0
- package/build/utils/display/measurer/script-detection.d.ts.map +1 -0
- package/build/utils/display/measurer/script-detection.js +184 -0
- package/build/utils/display/measurer/script-detection.js.map +1 -0
- package/build/utils/display/profiles/g1.d.ts +33 -0
- package/build/utils/display/profiles/g1.d.ts.map +1 -0
- package/build/utils/display/profiles/g1.js +213 -0
- package/build/utils/display/profiles/g1.js.map +1 -0
- package/build/utils/display/profiles/g2.d.ts +13 -0
- package/build/utils/display/profiles/g2.d.ts.map +1 -0
- package/build/utils/display/profiles/g2.js +34 -0
- package/build/utils/display/profiles/g2.js.map +1 -0
- package/build/utils/display/profiles/index.d.ts +12 -0
- package/build/utils/display/profiles/index.d.ts.map +1 -0
- package/build/utils/display/profiles/index.js +15 -0
- package/build/utils/display/profiles/index.js.map +1 -0
- package/build/utils/display/profiles/nex.d.ts +10 -0
- package/build/utils/display/profiles/nex.d.ts.map +1 -0
- package/build/utils/display/profiles/nex.js +150 -0
- package/build/utils/display/profiles/nex.js.map +1 -0
- package/build/utils/display/profiles/types.d.ts +103 -0
- package/build/utils/display/profiles/types.d.ts.map +1 -0
- package/build/utils/display/profiles/types.js +2 -0
- package/build/utils/display/profiles/types.js.map +1 -0
- package/build/utils/display/profiles/z100.d.ts +33 -0
- package/build/utils/display/profiles/z100.d.ts.map +1 -0
- package/build/utils/display/profiles/z100.js +182 -0
- package/build/utils/display/profiles/z100.js.map +1 -0
- package/build/utils/display/scene/degrade.d.ts +25 -0
- package/build/utils/display/scene/degrade.d.ts.map +1 -0
- package/build/utils/display/scene/degrade.js +64 -0
- package/build/utils/display/scene/degrade.js.map +1 -0
- package/build/utils/display/scene/differ.d.ts +38 -0
- package/build/utils/display/scene/differ.d.ts.map +1 -0
- package/build/utils/display/scene/differ.js +107 -0
- package/build/utils/display/scene/differ.js.map +1 -0
- package/build/utils/display/scene/index.d.ts +10 -0
- package/build/utils/display/scene/index.d.ts.map +1 -0
- package/build/utils/display/scene/index.js +6 -0
- package/build/utils/display/scene/index.js.map +1 -0
- package/build/utils/display/scene/process.d.ts +35 -0
- package/build/utils/display/scene/process.d.ts.map +1 -0
- package/build/utils/display/scene/process.js +187 -0
- package/build/utils/display/scene/process.js.map +1 -0
- package/build/utils/display/scene/store.d.ts +48 -0
- package/build/utils/display/scene/store.d.ts.map +1 -0
- package/build/utils/display/scene/store.js +0 -0
- package/build/utils/display/scene/store.js.map +1 -0
- package/build/utils/display/scene/types.d.ts +120 -0
- package/build/utils/display/scene/types.d.ts.map +1 -0
- package/build/utils/display/scene/types.js +0 -0
- package/build/utils/display/scene/types.js.map +1 -0
- package/build/utils/display/wrapper/TextWrapper.d.ts +102 -0
- package/build/utils/display/wrapper/TextWrapper.d.ts.map +1 -0
- package/build/utils/display/wrapper/TextWrapper.js +471 -0
- package/build/utils/display/wrapper/TextWrapper.js.map +1 -0
- package/build/utils/display/wrapper/index.d.ts +12 -0
- package/build/utils/display/wrapper/index.d.ts.map +1 -0
- package/build/utils/display/wrapper/index.js +12 -0
- package/build/utils/display/wrapper/index.js.map +1 -0
- package/build/utils/display/wrapper/types.d.ts +75 -0
- package/build/utils/display/wrapper/types.d.ts.map +1 -0
- package/build/utils/display/wrapper/types.js +11 -0
- package/build/utils/display/wrapper/types.js.map +1 -0
- package/build/utils/e2eMetrics.d.ts +6 -0
- package/build/utils/e2eMetrics.d.ts.map +1 -0
- package/build/utils/e2eMetrics.js +27 -0
- package/build/utils/e2eMetrics.js.map +1 -0
- package/build/utils/hardware/hardware.d.ts +42 -0
- package/build/utils/hardware/hardware.d.ts.map +1 -0
- package/build/utils/hardware/hardware.js +127 -0
- package/build/utils/hardware/hardware.js.map +1 -0
- package/build/utils/hardware/index.d.ts +2 -0
- package/build/utils/hardware/index.d.ts.map +1 -0
- package/build/utils/hardware/index.js +2 -0
- package/build/utils/hardware/index.js.map +1 -0
- package/build/utils/miniappGlobals.d.ts +60 -0
- package/build/utils/miniappGlobals.d.ts.map +1 -0
- package/build/utils/miniappGlobals.js +224 -0
- package/build/utils/miniappGlobals.js.map +1 -0
- package/build/utils/permissions/MediaLibraryPermissions.d.ts +45 -0
- package/build/utils/permissions/MediaLibraryPermissions.d.ts.map +1 -0
- package/build/utils/permissions/MediaLibraryPermissions.js +145 -0
- package/build/utils/permissions/MediaLibraryPermissions.js.map +1 -0
- package/build/utils/permissions/galleryDisplayName.d.ts +8 -0
- package/build/utils/permissions/galleryDisplayName.d.ts.map +1 -0
- package/build/utils/permissions/galleryDisplayName.js +25 -0
- package/build/utils/permissions/galleryDisplayName.js.map +1 -0
- package/build/utils/storage/index.d.ts +3 -0
- package/build/utils/storage/index.d.ts.map +1 -0
- package/build/utils/storage/index.js +3 -0
- package/build/utils/storage/index.js.map +1 -0
- package/build/utils/storage/storage.d.ts +24 -0
- package/build/utils/storage/storage.d.ts.map +1 -0
- package/build/utils/storage/storage.js +85 -0
- package/build/utils/storage/storage.js.map +1 -0
- package/build/utils/storage/zip.d.ts +3 -0
- package/build/utils/storage/zip.d.ts.map +1 -0
- package/build/utils/storage/zip.js +14 -0
- package/build/utils/storage/zip.js.map +1 -0
- package/build/utils/timers/index.d.ts +3 -0
- package/build/utils/timers/index.d.ts.map +1 -0
- package/build/utils/timers/index.js +3 -0
- package/build/utils/timers/index.js.map +1 -0
- package/build/utils/timers/timers.d.ts +9 -0
- package/build/utils/timers/timers.d.ts.map +1 -0
- package/build/utils/timers/timers.js +105 -0
- package/build/utils/timers/timers.js.map +1 -0
- package/package.json +120 -0
- package/src/devtools.ts +13 -0
- package/src/engine.ts +173 -0
- package/src/facades/dev.ts +198 -0
- package/src/facades/display.ts +17 -0
- package/src/facades/displayMirror.ts +33 -0
- package/src/facades/gallery.ts +69 -0
- package/src/facades/glasses.ts +206 -0
- package/src/facades/glassesSettings.ts +56 -0
- package/src/facades/glassesWifi.ts +68 -0
- package/src/facades/miniapps.ts +55 -0
- package/src/facades/notifications.ts +15 -0
- package/src/facades/ota.ts +174 -0
- package/src/facades/pairing.ts +329 -0
- package/src/facades/permissions.ts +165 -0
- package/src/facades/phoneNotifications.ts +50 -0
- package/src/facades/reports.ts +185 -0
- package/src/facades/session.ts +55 -0
- package/src/facades/settings.ts +57 -0
- package/src/facades/speech.ts +38 -0
- package/src/index.ts +191 -0
- package/src/internal.ts +159 -0
- package/src/runtime/bootstrap.ts +118 -0
- package/src/runtime/config.ts +147 -0
- package/src/runtime/streamConfig.ts +34 -0
- package/src/services/AppRegistry.ts +1190 -0
- package/src/services/AudioCloudUplink.ts +50 -0
- package/src/services/AudioPlaybackService.ts +813 -0
- package/src/services/AutomaticReportResult.ts +48 -0
- package/src/services/BlobStore.ts +746 -0
- package/src/services/CaptionsTesterReportService.ts +107 -0
- package/src/services/CloudAudioSubscriptionSync.ts +41 -0
- package/src/services/CloudClientService.ts +689 -0
- package/src/services/CloudTranscriptE2EMetrics.ts +27 -0
- package/src/services/ConnectionCoordinator.ts +65 -0
- package/src/services/DevServerBridge.ts +332 -0
- package/src/services/DeviceEventRouter.ts +238 -0
- package/src/services/DeviceStoreHydration.ts +130 -0
- package/src/services/DisplayProcessor.ts +775 -0
- package/src/services/GlassesReadiness.ts +103 -0
- package/src/services/GlassesSettingsSync.ts +134 -0
- package/src/services/GlassesStatusProjection.ts +73 -0
- package/src/services/HeadingService.ts +98 -0
- package/src/services/LocalDisplayManager.ts +703 -0
- package/src/services/LocalMiniappRuntime.ts +4213 -0
- package/src/services/LocalSttFallbackCoordinator.ts +147 -0
- package/src/services/MentraJSCrashController.ts +189 -0
- package/src/services/MentraJSCrashloopReportService.ts +66 -0
- package/src/services/MentraJSLogPipeline.ts +166 -0
- package/src/services/MentraJSRouter.ts +557 -0
- package/src/services/MentraUIRouter.ts +244 -0
- package/src/services/MicStateCoordinator.ts +94 -0
- package/src/services/MiniappEngine.ts +143 -0
- package/src/services/MiniappLauncher.ts +340 -0
- package/src/services/MiniappRunningRegistry.ts +57 -0
- package/src/services/NativeHttpResponse.ts +6 -0
- package/src/services/NavigationHandlers.ts +423 -0
- package/src/services/NavigationService.ts +731 -0
- package/src/services/NotificationsEmitter.ts +48 -0
- package/src/services/OfflineSpeechModelService.ts +168 -0
- package/src/services/OtaInstallCoordinator.ts +1205 -0
- package/src/services/OtaService.ts +83 -0
- package/src/services/OtaUpdateCheckService.ts +386 -0
- package/src/services/PairingIdentity.ts +154 -0
- package/src/services/PhoneCalendarHelpers.ts +212 -0
- package/src/services/PhoneCalendarService.ts +42 -0
- package/src/services/PhoneCameraFovCoordinator.ts +195 -0
- package/src/services/PhoneLocationService.ts +122 -0
- package/src/services/PhoneNotificationsSync.ts +44 -0
- package/src/services/PhonePhotoCoordinator.ts +409 -0
- package/src/services/PhoneStreamCoordinator.ts +777 -0
- package/src/services/PhoneVideoCoordinator.ts +189 -0
- package/src/services/STTModelManager.ts +360 -0
- package/src/services/SceneRenderer.ts +292 -0
- package/src/services/SentenceTtsPipeline.ts +106 -0
- package/src/services/StreamLifecycleController.ts +213 -0
- package/src/services/TTSModelManager.ts +466 -0
- package/src/services/TranscriptionRouting.ts +37 -0
- package/src/services/WebviewBridge.ts +50 -0
- package/src/services/asg/GalleryMediaIntegrityReportService.ts +70 -0
- package/src/services/asg/asgCameraApi.ts +1695 -0
- package/src/services/asg/cameraRollExportCoordinator.ts +627 -0
- package/src/services/asg/cameraRollExportLedger.ts +122 -0
- package/src/services/asg/galleryMediaValidation.ts +183 -0
- package/src/services/asg/galleryNotices.ts +61 -0
- package/src/services/asg/galleryPathMigration.ts +22 -0
- package/src/services/asg/gallerySettingsService.ts +68 -0
- package/src/services/asg/gallerySyncNotifications.ts +236 -0
- package/src/services/asg/gallerySyncService.ts +2269 -0
- package/src/services/asg/galleryTransferLedger.ts +312 -0
- package/src/services/asg/localNetworkTransport.ts +173 -0
- package/src/services/asg/localStorageService.ts +652 -0
- package/src/services/asg/mediaProcessingQueue.ts +518 -0
- package/src/services/asgOtaVersionUrl.ts +41 -0
- package/src/services/blobPaths.ts +86 -0
- package/src/services/cloudStreamApi.ts +154 -0
- package/src/services/gallerySyncClock.ts +39 -0
- package/src/services/glassesClockSync.ts +115 -0
- package/src/services/manifestVersionGate.ts +43 -0
- package/src/services/mentraUiShim.ts +366 -0
- package/src/services/navigation/roadNameResolver.ts +112 -0
- package/src/services/navigation/routesApiCodec.ts +69 -0
- package/src/services/otaDisplayState.ts +115 -0
- package/src/services/otaInstallPolicy.ts +106 -0
- package/src/services/otaLegacyMapping.ts +71 -0
- package/src/services/slimStreamStatus.ts +28 -0
- package/src/stores/apps.ts +614 -0
- package/src/stores/bluetoothSettingKeys.ts +36 -0
- package/src/stores/cloudClientStatus.ts +37 -0
- package/src/stores/connection.ts +69 -0
- package/src/stores/core.ts +32 -0
- package/src/stores/display.ts +121 -0
- package/src/stores/gallerySync.ts +380 -0
- package/src/stores/glasses.ts +309 -0
- package/src/stores/settings.ts +1001 -0
- package/src/types/applet.ts +112 -0
- package/src/types/asg.ts +58 -0
- package/src/types/capabilities/even-realities-g1.ts +67 -0
- package/src/types/capabilities/even-realities-g2.ts +88 -0
- package/src/types/capabilities/mentra-display.ts +75 -0
- package/src/types/capabilities/mentra-live.ts +103 -0
- package/src/types/capabilities/none.ts +76 -0
- package/src/types/capabilities/simulated-glasses.ts +76 -0
- package/src/types/capabilities/vuzix-z100.ts +64 -0
- package/src/types/enums.ts +43 -0
- package/src/types/hardware.ts +203 -0
- package/src/types/index.ts +37 -0
- package/src/utils/GlobalEventEmitter.ts +14 -0
- package/src/utils/cloudClient/RnUdpAdapter.ts +47 -0
- package/src/utils/cloudClient/cloudSecureStore.ts +28 -0
- package/src/utils/debouncedPatch.ts +28 -0
- package/src/utils/devLogging.ts +140 -0
- package/src/utils/devMiniappLaunch.ts +68 -0
- package/src/utils/diagnosticContext.ts +155 -0
- package/src/utils/display/composer/ColumnComposer.ts +285 -0
- package/src/utils/display/composer/index.ts +15 -0
- package/src/utils/display/helpers/DisplayHelpers.ts +413 -0
- package/src/utils/display/helpers/ScrollView.ts +337 -0
- package/src/utils/display/helpers/index.ts +14 -0
- package/src/utils/display/index.ts +273 -0
- package/src/utils/display/measurer/TextMeasurer.ts +346 -0
- package/src/utils/display/measurer/index.ts +21 -0
- package/src/utils/display/measurer/script-detection.ts +218 -0
- package/src/utils/display/profiles/g1.ts +236 -0
- package/src/utils/display/profiles/g2.ts +39 -0
- package/src/utils/display/profiles/index.ts +28 -0
- package/src/utils/display/profiles/nex.ts +166 -0
- package/src/utils/display/profiles/types.ts +132 -0
- package/src/utils/display/profiles/z100.ts +198 -0
- package/src/utils/display/scene/degrade.ts +80 -0
- package/src/utils/display/scene/differ.ts +128 -0
- package/src/utils/display/scene/index.ts +21 -0
- package/src/utils/display/scene/process.ts +214 -0
- package/src/utils/display/scene/store.ts +0 -0
- package/src/utils/display/scene/types.ts +0 -0
- package/src/utils/display/wrapper/TextWrapper.ts +546 -0
- package/src/utils/display/wrapper/index.ts +15 -0
- package/src/utils/display/wrapper/types.ts +102 -0
- package/src/utils/e2eMetrics.ts +30 -0
- package/src/utils/hardware/hardware.ts +166 -0
- package/src/utils/hardware/index.ts +1 -0
- package/src/utils/miniappGlobals.ts +260 -0
- package/src/utils/permissions/MediaLibraryPermissions.ts +161 -0
- package/src/utils/permissions/galleryDisplayName.ts +28 -0
- package/src/utils/storage/index.ts +2 -0
- package/src/utils/storage/storage.ts +101 -0
- package/src/utils/storage/zip.ts +13 -0
- package/src/utils/timers/index.ts +2 -0
- package/src/utils/timers/timers.ts +139 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { isCJKCharacter, needsHyphenForBreak } from "../measurer/script-detection";
|
|
2
|
+
import { DEFAULT_WRAP_OPTIONS } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Wraps text to fit display constraints.
|
|
5
|
+
*
|
|
6
|
+
* Supports multiple break modes:
|
|
7
|
+
* - 'character': Break mid-word with hyphen for 100% line utilization
|
|
8
|
+
* - 'word': Break at word boundaries, hyphenate only if word > line width
|
|
9
|
+
* - 'strict-word': Break at word boundaries only, no hyphenation
|
|
10
|
+
*
|
|
11
|
+
* Key features:
|
|
12
|
+
* - Pixel-accurate wrapping (no abstract units)
|
|
13
|
+
* - Hyphen-aware breaking (accounts for hyphen width)
|
|
14
|
+
* - CJK support (breaks anywhere without hyphen)
|
|
15
|
+
* - Preserves explicit newlines
|
|
16
|
+
* - Respects byte limits for BLE transmission
|
|
17
|
+
*/
|
|
18
|
+
export class TextWrapper {
|
|
19
|
+
measurer;
|
|
20
|
+
defaultOptions;
|
|
21
|
+
constructor(measurer, defaultOptions) {
|
|
22
|
+
this.measurer = measurer;
|
|
23
|
+
const profile = measurer.getProfile();
|
|
24
|
+
this.defaultOptions = {
|
|
25
|
+
maxWidthPx: profile.displayWidthPx,
|
|
26
|
+
maxLines: profile.maxLines,
|
|
27
|
+
maxBytes: profile.maxPayloadBytes,
|
|
28
|
+
...DEFAULT_WRAP_OPTIONS,
|
|
29
|
+
...defaultOptions,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Wrap text to fit within constraints.
|
|
34
|
+
*
|
|
35
|
+
* @param text - Text to wrap (may contain \n for explicit breaks)
|
|
36
|
+
* @param options - Override default options
|
|
37
|
+
* @returns Wrap result with lines and metadata
|
|
38
|
+
*/
|
|
39
|
+
wrap(text, options) {
|
|
40
|
+
const opts = this.mergeOptions(options);
|
|
41
|
+
const { maxWidthPx, maxLines, maxBytes, breakMode, preserveNewlines } = opts;
|
|
42
|
+
if (!text || text.length === 0) {
|
|
43
|
+
return this.createEmptyResult(opts);
|
|
44
|
+
}
|
|
45
|
+
// Split by explicit newlines if preserving them
|
|
46
|
+
const paragraphs = preserveNewlines ? text.split("\n") : [text];
|
|
47
|
+
const allLines = [];
|
|
48
|
+
const allMetrics = [];
|
|
49
|
+
let totalBytes = 0;
|
|
50
|
+
let truncated = false;
|
|
51
|
+
for (let pIndex = 0; pIndex < paragraphs.length; pIndex++) {
|
|
52
|
+
const paragraph = paragraphs[pIndex];
|
|
53
|
+
const isFromNewline = pIndex > 0;
|
|
54
|
+
// Wrap this paragraph
|
|
55
|
+
const paragraphLines = this.wrapParagraph(paragraph, maxWidthPx, breakMode, opts);
|
|
56
|
+
for (let lIndex = 0; lIndex < paragraphLines.length; lIndex++) {
|
|
57
|
+
const line = paragraphLines[lIndex];
|
|
58
|
+
const lineBytes = this.measurer.getByteSize(line);
|
|
59
|
+
// Check if we've exceeded limits
|
|
60
|
+
if (allLines.length >= maxLines) {
|
|
61
|
+
truncated = true;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
if (totalBytes + lineBytes > maxBytes) {
|
|
65
|
+
truncated = true;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
const widthPx = this.measurer.measureText(line);
|
|
69
|
+
const metrics = {
|
|
70
|
+
text: line,
|
|
71
|
+
widthPx,
|
|
72
|
+
bytes: lineBytes,
|
|
73
|
+
utilizationPercent: Math.round((widthPx / maxWidthPx) * 100),
|
|
74
|
+
endsWithHyphen: line.endsWith(opts.hyphenChar) && lIndex < paragraphLines.length - 1,
|
|
75
|
+
fromExplicitNewline: isFromNewline && lIndex === 0,
|
|
76
|
+
};
|
|
77
|
+
allLines.push(line);
|
|
78
|
+
allMetrics.push(metrics);
|
|
79
|
+
totalBytes += lineBytes;
|
|
80
|
+
// Add newline byte between lines
|
|
81
|
+
if (allLines.length < maxLines) {
|
|
82
|
+
totalBytes += 1; // \n is 1 byte
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (truncated)
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
// Find max line width
|
|
89
|
+
const maxLineWidthPx = allMetrics.reduce((max, m) => Math.max(max, m.widthPx), 0);
|
|
90
|
+
return {
|
|
91
|
+
lines: allLines,
|
|
92
|
+
truncated,
|
|
93
|
+
maxLineWidthPx,
|
|
94
|
+
totalBytes,
|
|
95
|
+
lineMetrics: allMetrics,
|
|
96
|
+
originalText: text,
|
|
97
|
+
breakMode,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Simple wrap returning just lines (convenience method).
|
|
102
|
+
*
|
|
103
|
+
* @param text - Text to wrap
|
|
104
|
+
* @param options - Override default options
|
|
105
|
+
* @returns Array of wrapped lines
|
|
106
|
+
*/
|
|
107
|
+
wrapToLines(text, options) {
|
|
108
|
+
return this.wrap(text, options).lines;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Check if text needs wrapping.
|
|
112
|
+
*
|
|
113
|
+
* @param text - Text to check
|
|
114
|
+
* @param maxWidthPx - Optional width override
|
|
115
|
+
* @returns true if text exceeds single line
|
|
116
|
+
*/
|
|
117
|
+
needsWrap(text, maxWidthPx) {
|
|
118
|
+
const width = maxWidthPx ?? this.defaultOptions.maxWidthPx;
|
|
119
|
+
return this.measurer.measureText(text) > width || text.includes("\n");
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get current default options.
|
|
123
|
+
*/
|
|
124
|
+
getOptions() {
|
|
125
|
+
return { ...this.defaultOptions };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get the measurer instance.
|
|
129
|
+
*/
|
|
130
|
+
getMeasurer() {
|
|
131
|
+
return this.measurer;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Wrap a single paragraph (no newlines) according to break mode.
|
|
135
|
+
*/
|
|
136
|
+
wrapParagraph(paragraph, maxWidthPx, breakMode, opts) {
|
|
137
|
+
const trimmed = opts.trimLines ? paragraph.trim() : paragraph;
|
|
138
|
+
if (!trimmed) {
|
|
139
|
+
return [""];
|
|
140
|
+
}
|
|
141
|
+
// Check if it fits on one line
|
|
142
|
+
if (this.measurer.fitsInWidth(trimmed, maxWidthPx)) {
|
|
143
|
+
return [trimmed];
|
|
144
|
+
}
|
|
145
|
+
switch (breakMode) {
|
|
146
|
+
case "character":
|
|
147
|
+
return this.wrapCharacterMode(trimmed, maxWidthPx, opts);
|
|
148
|
+
case "character-no-hyphen":
|
|
149
|
+
return this.wrapCharacterNoHyphenMode(trimmed, maxWidthPx, opts);
|
|
150
|
+
case "word":
|
|
151
|
+
return this.wrapWordMode(trimmed, maxWidthPx, opts);
|
|
152
|
+
case "strict-word":
|
|
153
|
+
return this.wrapStrictWordMode(trimmed, maxWidthPx, opts);
|
|
154
|
+
default:
|
|
155
|
+
return this.wrapCharacterMode(trimmed, maxWidthPx, opts);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Character break mode: Break mid-word with hyphen for 100% line utilization.
|
|
160
|
+
*/
|
|
161
|
+
wrapCharacterMode(text, maxWidthPx, opts) {
|
|
162
|
+
return this.wrapCharacterModeInternal(text, maxWidthPx, opts, true);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Character break mode without hyphen: Break mid-word cleanly without adding hyphen.
|
|
166
|
+
*/
|
|
167
|
+
wrapCharacterNoHyphenMode(text, maxWidthPx, opts) {
|
|
168
|
+
return this.wrapCharacterModeInternal(text, maxWidthPx, opts, false);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Internal character break implementation with configurable hyphenation.
|
|
172
|
+
*/
|
|
173
|
+
wrapCharacterModeInternal(text, maxWidthPx, opts, useHyphen) {
|
|
174
|
+
const lines = [];
|
|
175
|
+
const hyphenWidth = this.measurer.measureChar(opts.hyphenChar);
|
|
176
|
+
let currentLine = "";
|
|
177
|
+
let currentWidth = 0;
|
|
178
|
+
const chars = Array.from(text);
|
|
179
|
+
for (let i = 0; i < chars.length; i++) {
|
|
180
|
+
const char = chars[i];
|
|
181
|
+
const charWidth = this.measurer.measureChar(char);
|
|
182
|
+
// Would this character fit?
|
|
183
|
+
if (currentWidth + charWidth <= maxWidthPx) {
|
|
184
|
+
currentLine += char;
|
|
185
|
+
currentWidth += charWidth;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// Character doesn't fit - need to break
|
|
189
|
+
// Determine if we need a hyphen
|
|
190
|
+
const prevChar = currentLine.length > 0 ? currentLine[currentLine.length - 1] : "";
|
|
191
|
+
const needsHyphen = useHyphen && currentLine.length >= opts.minCharsBeforeHyphen && needsHyphenForBreak(prevChar, char);
|
|
192
|
+
if (needsHyphen) {
|
|
193
|
+
// Back off characters until hyphen fits
|
|
194
|
+
const result = this.backoffForHyphen(currentLine, currentWidth, maxWidthPx, hyphenWidth, opts);
|
|
195
|
+
if (result.skipHyphen) {
|
|
196
|
+
// Found a natural word boundary while backing off - no hyphen needed
|
|
197
|
+
lines.push(result.line);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
lines.push(result.line + opts.hyphenChar);
|
|
201
|
+
}
|
|
202
|
+
// Start new line with backed-off chars + current char
|
|
203
|
+
currentLine = result.remainder + char;
|
|
204
|
+
currentWidth = this.measurer.measureText(currentLine);
|
|
205
|
+
}
|
|
206
|
+
else if (useHyphen === false && !isCJKCharacter(char) && char !== " ") {
|
|
207
|
+
// No-hyphen mode: just break cleanly without hyphen
|
|
208
|
+
const trimmedLine = opts.trimLines ? currentLine.trimEnd() : currentLine;
|
|
209
|
+
if (trimmedLine) {
|
|
210
|
+
lines.push(trimmedLine);
|
|
211
|
+
}
|
|
212
|
+
currentLine = char;
|
|
213
|
+
currentWidth = charWidth;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
// No hyphen needed (CJK, space, punctuation)
|
|
217
|
+
const trimmedLine = opts.trimLines ? currentLine.trimEnd() : currentLine;
|
|
218
|
+
if (trimmedLine) {
|
|
219
|
+
lines.push(trimmedLine);
|
|
220
|
+
}
|
|
221
|
+
currentLine = char === " " ? "" : char;
|
|
222
|
+
currentWidth = char === " " ? 0 : charWidth;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Add remaining text
|
|
227
|
+
if (currentLine) {
|
|
228
|
+
const trimmedLine = opts.trimLines ? currentLine.trim() : currentLine;
|
|
229
|
+
if (trimmedLine) {
|
|
230
|
+
lines.push(trimmedLine);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return lines.length > 0 ? lines : [""];
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Word break mode: Break at word boundaries, hyphenate only if word > line width.
|
|
237
|
+
*/
|
|
238
|
+
wrapWordMode(text, maxWidthPx, opts) {
|
|
239
|
+
const lines = [];
|
|
240
|
+
const words = this.splitIntoWords(text);
|
|
241
|
+
const spaceWidth = this.measurer.getSpaceWidth();
|
|
242
|
+
let currentLine = "";
|
|
243
|
+
let currentWidth = 0;
|
|
244
|
+
for (const word of words) {
|
|
245
|
+
const wordWidth = this.measurer.measureText(word);
|
|
246
|
+
const needsSpace = currentLine.length > 0;
|
|
247
|
+
const totalWidth = currentWidth + (needsSpace ? spaceWidth : 0) + wordWidth;
|
|
248
|
+
if (totalWidth <= maxWidthPx) {
|
|
249
|
+
// Word fits on current line
|
|
250
|
+
if (needsSpace) {
|
|
251
|
+
currentLine += " ";
|
|
252
|
+
currentWidth += spaceWidth;
|
|
253
|
+
}
|
|
254
|
+
currentLine += word;
|
|
255
|
+
currentWidth += wordWidth;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
// Word doesn't fit
|
|
259
|
+
if (currentLine.length > 0) {
|
|
260
|
+
// Push current line and start new one
|
|
261
|
+
lines.push(opts.trimLines ? currentLine.trim() : currentLine);
|
|
262
|
+
currentLine = "";
|
|
263
|
+
currentWidth = 0;
|
|
264
|
+
}
|
|
265
|
+
// Check if word itself exceeds line width
|
|
266
|
+
if (wordWidth > maxWidthPx) {
|
|
267
|
+
// Word is too long - hyphenate it
|
|
268
|
+
const hyphenatedLines = this.hyphenateLongWord(word, maxWidthPx, opts);
|
|
269
|
+
for (let i = 0; i < hyphenatedLines.length - 1; i++) {
|
|
270
|
+
lines.push(hyphenatedLines[i]);
|
|
271
|
+
}
|
|
272
|
+
// Last piece becomes start of current line
|
|
273
|
+
currentLine = hyphenatedLines[hyphenatedLines.length - 1];
|
|
274
|
+
currentWidth = this.measurer.measureText(currentLine);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
// Word fits on new line
|
|
278
|
+
currentLine = word;
|
|
279
|
+
currentWidth = wordWidth;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// Add remaining text
|
|
284
|
+
if (currentLine) {
|
|
285
|
+
const trimmedLine = opts.trimLines ? currentLine.trim() : currentLine;
|
|
286
|
+
if (trimmedLine) {
|
|
287
|
+
lines.push(trimmedLine);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return lines.length > 0 ? lines : [""];
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Strict word break mode: Break at word boundaries only, no hyphenation.
|
|
294
|
+
* Long words will overflow the line.
|
|
295
|
+
*/
|
|
296
|
+
wrapStrictWordMode(text, maxWidthPx, opts) {
|
|
297
|
+
const lines = [];
|
|
298
|
+
const words = this.splitIntoWords(text);
|
|
299
|
+
const spaceWidth = this.measurer.getSpaceWidth();
|
|
300
|
+
let currentLine = "";
|
|
301
|
+
let currentWidth = 0;
|
|
302
|
+
for (const word of words) {
|
|
303
|
+
const wordWidth = this.measurer.measureText(word);
|
|
304
|
+
const needsSpace = currentLine.length > 0;
|
|
305
|
+
const totalWidth = currentWidth + (needsSpace ? spaceWidth : 0) + wordWidth;
|
|
306
|
+
if (totalWidth <= maxWidthPx) {
|
|
307
|
+
// Word fits on current line
|
|
308
|
+
if (needsSpace) {
|
|
309
|
+
currentLine += " ";
|
|
310
|
+
currentWidth += spaceWidth;
|
|
311
|
+
}
|
|
312
|
+
currentLine += word;
|
|
313
|
+
currentWidth += wordWidth;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
// Word doesn't fit
|
|
317
|
+
if (currentLine.length > 0) {
|
|
318
|
+
// Push current line
|
|
319
|
+
lines.push(opts.trimLines ? currentLine.trim() : currentLine);
|
|
320
|
+
}
|
|
321
|
+
// Start new line with word (even if it overflows)
|
|
322
|
+
currentLine = word;
|
|
323
|
+
currentWidth = wordWidth;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
// Add remaining text
|
|
327
|
+
if (currentLine) {
|
|
328
|
+
const trimmedLine = opts.trimLines ? currentLine.trim() : currentLine;
|
|
329
|
+
if (trimmedLine) {
|
|
330
|
+
lines.push(trimmedLine);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return lines.length > 0 ? lines : [""];
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Split text into words, handling CJK characters specially.
|
|
337
|
+
* CJK characters are treated as individual "words" since they can break anywhere.
|
|
338
|
+
*/
|
|
339
|
+
splitIntoWords(text) {
|
|
340
|
+
const words = [];
|
|
341
|
+
let currentWord = "";
|
|
342
|
+
for (const char of text) {
|
|
343
|
+
if (char === " " || char === "\t") {
|
|
344
|
+
if (currentWord) {
|
|
345
|
+
words.push(currentWord);
|
|
346
|
+
currentWord = "";
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
else if (isCJKCharacter(char)) {
|
|
350
|
+
// CJK characters are individual words
|
|
351
|
+
if (currentWord) {
|
|
352
|
+
words.push(currentWord);
|
|
353
|
+
currentWord = "";
|
|
354
|
+
}
|
|
355
|
+
words.push(char);
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
currentWord += char;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (currentWord) {
|
|
362
|
+
words.push(currentWord);
|
|
363
|
+
}
|
|
364
|
+
return words;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Hyphenate a word that's too long to fit on a single line.
|
|
368
|
+
*/
|
|
369
|
+
hyphenateLongWord(word, maxWidthPx, opts) {
|
|
370
|
+
const lines = [];
|
|
371
|
+
const hyphenWidth = this.measurer.measureChar(opts.hyphenChar);
|
|
372
|
+
const chars = Array.from(word);
|
|
373
|
+
let currentLine = "";
|
|
374
|
+
let currentWidth = 0;
|
|
375
|
+
for (let i = 0; i < chars.length; i++) {
|
|
376
|
+
const char = chars[i];
|
|
377
|
+
const charWidth = this.measurer.measureChar(char);
|
|
378
|
+
const isLastChar = i === chars.length - 1;
|
|
379
|
+
// Check if we need to break (leaving room for hyphen if not last char)
|
|
380
|
+
const widthNeeded = isLastChar ? charWidth : charWidth + hyphenWidth;
|
|
381
|
+
if (currentWidth + widthNeeded <= maxWidthPx) {
|
|
382
|
+
currentLine += char;
|
|
383
|
+
currentWidth += charWidth;
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
// Need to break - back off if needed to fit hyphen
|
|
387
|
+
if (currentLine.length >= opts.minCharsBeforeHyphen) {
|
|
388
|
+
const result = this.backoffForHyphen(currentLine, currentWidth, maxWidthPx, hyphenWidth, opts);
|
|
389
|
+
if (result.skipHyphen) {
|
|
390
|
+
lines.push(result.line);
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
lines.push(result.line + opts.hyphenChar);
|
|
394
|
+
}
|
|
395
|
+
currentLine = result.remainder + char;
|
|
396
|
+
currentWidth = this.measurer.measureText(currentLine);
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
// Not enough chars for hyphen, just break
|
|
400
|
+
if (currentLine) {
|
|
401
|
+
lines.push(currentLine);
|
|
402
|
+
}
|
|
403
|
+
currentLine = char;
|
|
404
|
+
currentWidth = charWidth;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (currentLine) {
|
|
409
|
+
lines.push(currentLine);
|
|
410
|
+
}
|
|
411
|
+
return lines.length > 0 ? lines : [word];
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Back off characters from line end until hyphen fits.
|
|
415
|
+
* Returns null if we back off to a space (natural break point - no hyphen needed).
|
|
416
|
+
*/
|
|
417
|
+
backoffForHyphen(line, lineWidth, maxWidthPx, hyphenWidth, opts) {
|
|
418
|
+
let adjustedLine = line;
|
|
419
|
+
let adjustedWidth = lineWidth;
|
|
420
|
+
let remainder = "";
|
|
421
|
+
// Remove characters until hyphen fits
|
|
422
|
+
while (adjustedWidth + hyphenWidth > maxWidthPx && adjustedLine.length > opts.minCharsBeforeHyphen) {
|
|
423
|
+
const lastChar = adjustedLine[adjustedLine.length - 1];
|
|
424
|
+
const lastCharWidth = this.measurer.measureChar(lastChar);
|
|
425
|
+
adjustedLine = adjustedLine.slice(0, -1);
|
|
426
|
+
adjustedWidth -= lastCharWidth;
|
|
427
|
+
remainder = lastChar + remainder;
|
|
428
|
+
// If we've backed off to a space, we've found a natural word boundary
|
|
429
|
+
// No hyphen is needed - just trim the space and break there
|
|
430
|
+
if (adjustedLine.length > 0 && adjustedLine[adjustedLine.length - 1] === " ") {
|
|
431
|
+
// Trim trailing space from the line
|
|
432
|
+
adjustedLine = adjustedLine.trimEnd();
|
|
433
|
+
return { line: adjustedLine, remainder, skipHyphen: true };
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return { line: adjustedLine, remainder, skipHyphen: false };
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Merge user options with defaults.
|
|
440
|
+
*/
|
|
441
|
+
mergeOptions(options) {
|
|
442
|
+
return {
|
|
443
|
+
...this.defaultOptions,
|
|
444
|
+
...options,
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Create an empty result for empty input.
|
|
449
|
+
*/
|
|
450
|
+
createEmptyResult(opts) {
|
|
451
|
+
return {
|
|
452
|
+
lines: [""],
|
|
453
|
+
truncated: false,
|
|
454
|
+
maxLineWidthPx: 0,
|
|
455
|
+
totalBytes: 0,
|
|
456
|
+
lineMetrics: [
|
|
457
|
+
{
|
|
458
|
+
text: "",
|
|
459
|
+
widthPx: 0,
|
|
460
|
+
bytes: 0,
|
|
461
|
+
utilizationPercent: 0,
|
|
462
|
+
endsWithHyphen: false,
|
|
463
|
+
fromExplicitNewline: false,
|
|
464
|
+
},
|
|
465
|
+
],
|
|
466
|
+
originalText: "",
|
|
467
|
+
breakMode: opts.breakMode,
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
//# sourceMappingURL=TextWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextWrapper.js","sourceRoot":"","sources":["../../../../src/utils/display/wrapper/TextWrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,WAAW;IACL,QAAQ,CAAe;IACvB,cAAc,CAAwB;IAEvD,YAAY,QAAsB,EAAE,cAA4B;QAC9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG;YACpB,UAAU,EAAE,OAAO,CAAC,cAAc;YAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,eAAe;YACjC,GAAG,oBAAoB;YACvB,GAAG,cAAc;SAClB,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,IAAY,EAAE,OAAqB;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,GA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;IACK,iBAAiB,CAAC,IAA2B;QACnD,OAAO;YACL,KAAK,EAAE,CAAC,EAAE,CAAC;YACX,SAAS,EAAE,KAAK;YAChB,cAAc,EAAE,CAAC;YACjB,UAAU,EAAE,CAAC;YACb,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,EAAE;oBACR,OAAO,EAAE,CAAC;oBACV,KAAK,EAAE,CAAC;oBACR,kBAAkB,EAAE,CAAC;oBACrB,cAAc,EAAE,KAAK;oBACrB,mBAAmB,EAAE,KAAK;iBAC3B;aACF;YACD,YAAY,EAAE,EAAE;YAChB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { TextMeasurer } from \"../measurer/TextMeasurer\";\nimport { isCJKCharacter, needsHyphenForBreak } from \"../measurer/script-detection\";\nimport type { WrapOptions, WrapResult, LineMetrics, BreakMode } from \"./types\";\nimport { DEFAULT_WRAP_OPTIONS } from \"./types\";\n\n/**\n * Wraps text to fit display constraints.\n *\n * Supports multiple break modes:\n * - 'character': Break mid-word with hyphen for 100% line utilization\n * - 'word': Break at word boundaries, hyphenate only if word > line width\n * - 'strict-word': Break at word boundaries only, no hyphenation\n *\n * Key features:\n * - Pixel-accurate wrapping (no abstract units)\n * - Hyphen-aware breaking (accounts for hyphen width)\n * - CJK support (breaks anywhere without hyphen)\n * - Preserves explicit newlines\n * - Respects byte limits for BLE transmission\n */\nexport class TextWrapper {\n private readonly measurer: TextMeasurer;\n private readonly defaultOptions: Required<WrapOptions>;\n\n constructor(measurer: TextMeasurer, defaultOptions?: WrapOptions) {\n this.measurer = measurer;\n\n const profile = measurer.getProfile();\n this.defaultOptions = {\n maxWidthPx: profile.displayWidthPx,\n maxLines: profile.maxLines,\n maxBytes: profile.maxPayloadBytes,\n ...DEFAULT_WRAP_OPTIONS,\n ...defaultOptions,\n };\n }\n\n /**\n * Wrap text to fit within constraints.\n *\n * @param text - Text to wrap (may contain \\n for explicit breaks)\n * @param options - Override default options\n * @returns Wrap result with lines and metadata\n */\n wrap(text: string, options?: WrapOptions): WrapResult {\n const opts = this.mergeOptions(options);\n const { maxWidthPx, maxLines, maxBytes, breakMode, preserveNewlines } = opts;\n\n if (!text || text.length === 0) {\n return this.createEmptyResult(opts);\n }\n\n // Split by explicit newlines if preserving them\n const paragraphs = preserveNewlines ? text.split(\"\\n\") : [text];\n\n const allLines: string[] = [];\n const allMetrics: LineMetrics[] = [];\n let totalBytes = 0;\n let truncated = false;\n\n for (let pIndex = 0; pIndex < paragraphs.length; pIndex++) {\n const paragraph = paragraphs[pIndex];\n const isFromNewline = pIndex > 0;\n\n // Wrap this paragraph\n const paragraphLines = this.wrapParagraph(paragraph, maxWidthPx, breakMode, opts);\n\n for (let lIndex = 0; lIndex < paragraphLines.length; lIndex++) {\n const line = paragraphLines[lIndex];\n const lineBytes = this.measurer.getByteSize(line);\n\n // Check if we've exceeded limits\n if (allLines.length >= maxLines) {\n truncated = true;\n break;\n }\n\n if (totalBytes + lineBytes > maxBytes) {\n truncated = true;\n break;\n }\n\n const widthPx = this.measurer.measureText(line);\n const metrics: LineMetrics = {\n text: line,\n widthPx,\n bytes: lineBytes,\n utilizationPercent: Math.round((widthPx / maxWidthPx) * 100),\n endsWithHyphen: line.endsWith(opts.hyphenChar) && lIndex < paragraphLines.length - 1,\n fromExplicitNewline: isFromNewline && lIndex === 0,\n };\n\n allLines.push(line);\n allMetrics.push(metrics);\n totalBytes += lineBytes;\n\n // Add newline byte between lines\n if (allLines.length < maxLines) {\n totalBytes += 1; // \\n is 1 byte\n }\n }\n\n if (truncated) break;\n }\n\n // Find max line width\n const maxLineWidthPx = allMetrics.reduce((max, m) => Math.max(max, m.widthPx), 0);\n\n return {\n lines: allLines,\n truncated,\n maxLineWidthPx,\n totalBytes,\n lineMetrics: allMetrics,\n originalText: text,\n breakMode,\n };\n }\n\n /**\n * Simple wrap returning just lines (convenience method).\n *\n * @param text - Text to wrap\n * @param options - Override default options\n * @returns Array of wrapped lines\n */\n wrapToLines(text: string, options?: WrapOptions): string[] {\n return this.wrap(text, options).lines;\n }\n\n /**\n * Check if text needs wrapping.\n *\n * @param text - Text to check\n * @param maxWidthPx - Optional width override\n * @returns true if text exceeds single line\n */\n needsWrap(text: string, maxWidthPx?: number): boolean {\n const width = maxWidthPx ?? this.defaultOptions.maxWidthPx;\n return this.measurer.measureText(text) > width || text.includes(\"\\n\");\n }\n\n /**\n * Get current default options.\n */\n getOptions(): Required<WrapOptions> {\n return { ...this.defaultOptions };\n }\n\n /**\n * Get the measurer instance.\n */\n getMeasurer(): TextMeasurer {\n return this.measurer;\n }\n\n /**\n * Wrap a single paragraph (no newlines) according to break mode.\n */\n private wrapParagraph(\n paragraph: string,\n maxWidthPx: number,\n breakMode: BreakMode,\n opts: Required<WrapOptions>,\n ): string[] {\n const trimmed = opts.trimLines ? paragraph.trim() : paragraph;\n\n if (!trimmed) {\n return [\"\"];\n }\n\n // Check if it fits on one line\n if (this.measurer.fitsInWidth(trimmed, maxWidthPx)) {\n return [trimmed];\n }\n\n switch (breakMode) {\n case \"character\":\n return this.wrapCharacterMode(trimmed, maxWidthPx, opts);\n case \"character-no-hyphen\":\n return this.wrapCharacterNoHyphenMode(trimmed, maxWidthPx, opts);\n case \"word\":\n return this.wrapWordMode(trimmed, maxWidthPx, opts);\n case \"strict-word\":\n return this.wrapStrictWordMode(trimmed, maxWidthPx, opts);\n default:\n return this.wrapCharacterMode(trimmed, maxWidthPx, opts);\n }\n }\n\n /**\n * Character break mode: Break mid-word with hyphen for 100% line utilization.\n */\n private wrapCharacterMode(text: string, maxWidthPx: number, opts: Required<WrapOptions>): string[] {\n return this.wrapCharacterModeInternal(text, maxWidthPx, opts, true);\n }\n\n /**\n * Character break mode without hyphen: Break mid-word cleanly without adding hyphen.\n */\n private wrapCharacterNoHyphenMode(text: string, maxWidthPx: number, opts: Required<WrapOptions>): string[] {\n return this.wrapCharacterModeInternal(text, maxWidthPx, opts, false);\n }\n\n /**\n * Internal character break implementation with configurable hyphenation.\n */\n private wrapCharacterModeInternal(\n text: string,\n maxWidthPx: number,\n opts: Required<WrapOptions>,\n useHyphen: boolean,\n ): string[] {\n const lines: string[] = [];\n const hyphenWidth = this.measurer.measureChar(opts.hyphenChar);\n\n let currentLine = \"\";\n let currentWidth = 0;\n\n const chars = Array.from(text);\n\n for (let i = 0; i < chars.length; i++) {\n const char = chars[i];\n const charWidth = this.measurer.measureChar(char);\n\n // Would this character fit?\n if (currentWidth + charWidth <= maxWidthPx) {\n currentLine += char;\n currentWidth += charWidth;\n } else {\n // Character doesn't fit - need to break\n\n // Determine if we need a hyphen\n const prevChar = currentLine.length > 0 ? currentLine[currentLine.length - 1] : \"\";\n const needsHyphen =\n useHyphen && currentLine.length >= opts.minCharsBeforeHyphen && needsHyphenForBreak(prevChar, char);\n\n if (needsHyphen) {\n // Back off characters until hyphen fits\n const result = this.backoffForHyphen(currentLine, currentWidth, maxWidthPx, hyphenWidth, opts);\n\n if (result.skipHyphen) {\n // Found a natural word boundary while backing off - no hyphen needed\n lines.push(result.line);\n } else {\n lines.push(result.line + opts.hyphenChar);\n }\n\n // Start new line with backed-off chars + current char\n currentLine = result.remainder + char;\n currentWidth = this.measurer.measureText(currentLine);\n } else if (useHyphen === false && !isCJKCharacter(char) && char !== \" \") {\n // No-hyphen mode: just break cleanly without hyphen\n const trimmedLine = opts.trimLines ? currentLine.trimEnd() : currentLine;\n if (trimmedLine) {\n lines.push(trimmedLine);\n }\n currentLine = char;\n currentWidth = charWidth;\n } else {\n // No hyphen needed (CJK, space, punctuation)\n const trimmedLine = opts.trimLines ? currentLine.trimEnd() : currentLine;\n if (trimmedLine) {\n lines.push(trimmedLine);\n }\n currentLine = char === \" \" ? \"\" : char;\n currentWidth = char === \" \" ? 0 : charWidth;\n }\n }\n }\n\n // Add remaining text\n if (currentLine) {\n const trimmedLine = opts.trimLines ? currentLine.trim() : currentLine;\n if (trimmedLine) {\n lines.push(trimmedLine);\n }\n }\n\n return lines.length > 0 ? lines : [\"\"];\n }\n\n /**\n * Word break mode: Break at word boundaries, hyphenate only if word > line width.\n */\n private wrapWordMode(text: string, maxWidthPx: number, opts: Required<WrapOptions>): string[] {\n const lines: string[] = [];\n const words = this.splitIntoWords(text);\n const spaceWidth = this.measurer.getSpaceWidth();\n\n let currentLine = \"\";\n let currentWidth = 0;\n\n for (const word of words) {\n const wordWidth = this.measurer.measureText(word);\n const needsSpace = currentLine.length > 0;\n const totalWidth = currentWidth + (needsSpace ? spaceWidth : 0) + wordWidth;\n\n if (totalWidth <= maxWidthPx) {\n // Word fits on current line\n if (needsSpace) {\n currentLine += \" \";\n currentWidth += spaceWidth;\n }\n currentLine += word;\n currentWidth += wordWidth;\n } else {\n // Word doesn't fit\n if (currentLine.length > 0) {\n // Push current line and start new one\n lines.push(opts.trimLines ? currentLine.trim() : currentLine);\n currentLine = \"\";\n currentWidth = 0;\n }\n\n // Check if word itself exceeds line width\n if (wordWidth > maxWidthPx) {\n // Word is too long - hyphenate it\n const hyphenatedLines = this.hyphenateLongWord(word, maxWidthPx, opts);\n for (let i = 0; i < hyphenatedLines.length - 1; i++) {\n lines.push(hyphenatedLines[i]);\n }\n // Last piece becomes start of current line\n currentLine = hyphenatedLines[hyphenatedLines.length - 1];\n currentWidth = this.measurer.measureText(currentLine);\n } else {\n // Word fits on new line\n currentLine = word;\n currentWidth = wordWidth;\n }\n }\n }\n\n // Add remaining text\n if (currentLine) {\n const trimmedLine = opts.trimLines ? currentLine.trim() : currentLine;\n if (trimmedLine) {\n lines.push(trimmedLine);\n }\n }\n\n return lines.length > 0 ? lines : [\"\"];\n }\n\n /**\n * Strict word break mode: Break at word boundaries only, no hyphenation.\n * Long words will overflow the line.\n */\n private wrapStrictWordMode(text: string, maxWidthPx: number, opts: Required<WrapOptions>): string[] {\n const lines: string[] = [];\n const words = this.splitIntoWords(text);\n const spaceWidth = this.measurer.getSpaceWidth();\n\n let currentLine = \"\";\n let currentWidth = 0;\n\n for (const word of words) {\n const wordWidth = this.measurer.measureText(word);\n const needsSpace = currentLine.length > 0;\n const totalWidth = currentWidth + (needsSpace ? spaceWidth : 0) + wordWidth;\n\n if (totalWidth <= maxWidthPx) {\n // Word fits on current line\n if (needsSpace) {\n currentLine += \" \";\n currentWidth += spaceWidth;\n }\n currentLine += word;\n currentWidth += wordWidth;\n } else {\n // Word doesn't fit\n if (currentLine.length > 0) {\n // Push current line\n lines.push(opts.trimLines ? currentLine.trim() : currentLine);\n }\n // Start new line with word (even if it overflows)\n currentLine = word;\n currentWidth = wordWidth;\n }\n }\n\n // Add remaining text\n if (currentLine) {\n const trimmedLine = opts.trimLines ? currentLine.trim() : currentLine;\n if (trimmedLine) {\n lines.push(trimmedLine);\n }\n }\n\n return lines.length > 0 ? lines : [\"\"];\n }\n\n /**\n * Split text into words, handling CJK characters specially.\n * CJK characters are treated as individual \"words\" since they can break anywhere.\n */\n private splitIntoWords(text: string): string[] {\n const words: string[] = [];\n let currentWord = \"\";\n\n for (const char of text) {\n if (char === \" \" || char === \"\\t\") {\n if (currentWord) {\n words.push(currentWord);\n currentWord = \"\";\n }\n } else if (isCJKCharacter(char)) {\n // CJK characters are individual words\n if (currentWord) {\n words.push(currentWord);\n currentWord = \"\";\n }\n words.push(char);\n } else {\n currentWord += char;\n }\n }\n\n if (currentWord) {\n words.push(currentWord);\n }\n\n return words;\n }\n\n /**\n * Hyphenate a word that's too long to fit on a single line.\n */\n private hyphenateLongWord(word: string, maxWidthPx: number, opts: Required<WrapOptions>): string[] {\n const lines: string[] = [];\n const hyphenWidth = this.measurer.measureChar(opts.hyphenChar);\n const chars = Array.from(word);\n\n let currentLine = \"\";\n let currentWidth = 0;\n\n for (let i = 0; i < chars.length; i++) {\n const char = chars[i];\n const charWidth = this.measurer.measureChar(char);\n const isLastChar = i === chars.length - 1;\n\n // Check if we need to break (leaving room for hyphen if not last char)\n const widthNeeded = isLastChar ? charWidth : charWidth + hyphenWidth;\n\n if (currentWidth + widthNeeded <= maxWidthPx) {\n currentLine += char;\n currentWidth += charWidth;\n } else {\n // Need to break - back off if needed to fit hyphen\n if (currentLine.length >= opts.minCharsBeforeHyphen) {\n const result = this.backoffForHyphen(currentLine, currentWidth, maxWidthPx, hyphenWidth, opts);\n if (result.skipHyphen) {\n lines.push(result.line);\n } else {\n lines.push(result.line + opts.hyphenChar);\n }\n currentLine = result.remainder + char;\n currentWidth = this.measurer.measureText(currentLine);\n } else {\n // Not enough chars for hyphen, just break\n if (currentLine) {\n lines.push(currentLine);\n }\n currentLine = char;\n currentWidth = charWidth;\n }\n }\n }\n\n if (currentLine) {\n lines.push(currentLine);\n }\n\n return lines.length > 0 ? lines : [word];\n }\n\n /**\n * Back off characters from line end until hyphen fits.\n * Returns null if we back off to a space (natural break point - no hyphen needed).\n */\n private backoffForHyphen(\n line: string,\n lineWidth: number,\n maxWidthPx: number,\n hyphenWidth: number,\n opts: Required<WrapOptions>,\n ): { line: string; remainder: string; skipHyphen: boolean } {\n let adjustedLine = line;\n let adjustedWidth = lineWidth;\n let remainder = \"\";\n\n // Remove characters until hyphen fits\n while (adjustedWidth + hyphenWidth > maxWidthPx && adjustedLine.length > opts.minCharsBeforeHyphen) {\n const lastChar = adjustedLine[adjustedLine.length - 1];\n const lastCharWidth = this.measurer.measureChar(lastChar);\n\n adjustedLine = adjustedLine.slice(0, -1);\n adjustedWidth -= lastCharWidth;\n remainder = lastChar + remainder;\n\n // If we've backed off to a space, we've found a natural word boundary\n // No hyphen is needed - just trim the space and break there\n if (adjustedLine.length > 0 && adjustedLine[adjustedLine.length - 1] === \" \") {\n // Trim trailing space from the line\n adjustedLine = adjustedLine.trimEnd();\n return { line: adjustedLine, remainder, skipHyphen: true };\n }\n }\n\n return { line: adjustedLine, remainder, skipHyphen: false };\n }\n\n /**\n * Merge user options with defaults.\n */\n private mergeOptions(options?: WrapOptions): Required<WrapOptions> {\n return {\n ...this.defaultOptions,\n ...options,\n };\n }\n\n /**\n * Create an empty result for empty input.\n */\n private createEmptyResult(opts: Required<WrapOptions>): WrapResult {\n return {\n lines: [\"\"],\n truncated: false,\n maxLineWidthPx: 0,\n totalBytes: 0,\n lineMetrics: [\n {\n text: \"\",\n widthPx: 0,\n bytes: 0,\n utilizationPercent: 0,\n endsWithHyphen: false,\n fromExplicitNewline: false,\n },\n ],\n originalText: \"\",\n breakMode: opts.breakMode,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Wrapper Module
|
|
3
|
+
*
|
|
4
|
+
* Provides text wrapping with multiple break modes:
|
|
5
|
+
* - 'character': Break mid-word with hyphen for 100% line utilization
|
|
6
|
+
* - 'word': Break at word boundaries, hyphenate only if word > line width
|
|
7
|
+
* - 'strict-word': Break at word boundaries only, no hyphenation
|
|
8
|
+
*/
|
|
9
|
+
export { TextWrapper } from "./TextWrapper";
|
|
10
|
+
export type { WrapOptions, WrapResult, LineMetrics, BreakMode } from "./types";
|
|
11
|
+
export { DEFAULT_WRAP_OPTIONS } from "./types";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/display/wrapper/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Wrapper Module
|
|
3
|
+
*
|
|
4
|
+
* Provides text wrapping with multiple break modes:
|
|
5
|
+
* - 'character': Break mid-word with hyphen for 100% line utilization
|
|
6
|
+
* - 'word': Break at word boundaries, hyphenate only if word > line width
|
|
7
|
+
* - 'strict-word': Break at word boundaries only, no hyphenation
|
|
8
|
+
*/
|
|
9
|
+
// Main class
|
|
10
|
+
export { TextWrapper } from "./TextWrapper";
|
|
11
|
+
export { DEFAULT_WRAP_OPTIONS } from "./types";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/display/wrapper/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,aAAa;AACb,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA","sourcesContent":["/**\n * Text Wrapper Module\n *\n * Provides text wrapping with multiple break modes:\n * - 'character': Break mid-word with hyphen for 100% line utilization\n * - 'word': Break at word boundaries, hyphenate only if word > line width\n * - 'strict-word': Break at word boundaries only, no hyphenation\n */\n\n// Main class\nexport { TextWrapper } from \"./TextWrapper\"\n\n// Types\nexport type { WrapOptions, WrapResult, LineMetrics, BreakMode } from \"./types\"\nexport { DEFAULT_WRAP_OPTIONS } from \"./types\"\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for text wrapping.
|
|
3
|
+
*/
|
|
4
|
+
export interface WrapOptions {
|
|
5
|
+
/** Maximum width in pixels (defaults to profile's displayWidthPx) */
|
|
6
|
+
maxWidthPx?: number;
|
|
7
|
+
/** Maximum number of lines (defaults to profile's maxLines) */
|
|
8
|
+
maxLines?: number;
|
|
9
|
+
/** Maximum total bytes (defaults to profile's maxPayloadBytes) */
|
|
10
|
+
maxBytes?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Break mode:
|
|
13
|
+
* - 'character': Break mid-word with hyphen for 100% utilization
|
|
14
|
+
* - 'word': Break at word boundaries, hyphenate only if word > line
|
|
15
|
+
* - 'strict-word': Break at word boundaries only, truncate long words
|
|
16
|
+
*/
|
|
17
|
+
breakMode?: BreakMode;
|
|
18
|
+
/** Character to use for hyphenation (default: '-') */
|
|
19
|
+
hyphenChar?: string;
|
|
20
|
+
/** Minimum characters before allowing hyphen break (default: 3) */
|
|
21
|
+
minCharsBeforeHyphen?: number;
|
|
22
|
+
/** Whether to trim whitespace from line ends (default: true) */
|
|
23
|
+
trimLines?: boolean;
|
|
24
|
+
/** Whether to preserve explicit newlines in input (default: true) */
|
|
25
|
+
preserveNewlines?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Break mode for text wrapping.
|
|
29
|
+
* - 'character': Break mid-word with hyphen for 100% utilization
|
|
30
|
+
* - 'character-no-hyphen': Break mid-word without hyphen (clean break)
|
|
31
|
+
* - 'word': Break at word boundaries, hyphenate only if word > line
|
|
32
|
+
* - 'strict-word': Break at word boundaries only, truncate long words
|
|
33
|
+
*/
|
|
34
|
+
export type BreakMode = "character" | "character-no-hyphen" | "word" | "strict-word";
|
|
35
|
+
/**
|
|
36
|
+
* Result of wrapping operation.
|
|
37
|
+
*/
|
|
38
|
+
export interface WrapResult {
|
|
39
|
+
/** Wrapped lines */
|
|
40
|
+
lines: string[];
|
|
41
|
+
/** Whether content was truncated to fit constraints */
|
|
42
|
+
truncated: boolean;
|
|
43
|
+
/** Total pixel width of widest line */
|
|
44
|
+
maxLineWidthPx: number;
|
|
45
|
+
/** Total byte size of all lines */
|
|
46
|
+
totalBytes: number;
|
|
47
|
+
/** Per-line metadata */
|
|
48
|
+
lineMetrics: LineMetrics[];
|
|
49
|
+
/** Original input text */
|
|
50
|
+
originalText: string;
|
|
51
|
+
/** Break mode used */
|
|
52
|
+
breakMode: BreakMode;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Per-line metrics from wrapping.
|
|
56
|
+
*/
|
|
57
|
+
export interface LineMetrics {
|
|
58
|
+
/** The line text */
|
|
59
|
+
text: string;
|
|
60
|
+
/** Width in pixels */
|
|
61
|
+
widthPx: number;
|
|
62
|
+
/** Byte size of this line */
|
|
63
|
+
bytes: number;
|
|
64
|
+
/** Utilization percentage (widthPx / maxWidthPx * 100) */
|
|
65
|
+
utilizationPercent: number;
|
|
66
|
+
/** Whether this line ends with a hyphen from breaking */
|
|
67
|
+
endsWithHyphen: boolean;
|
|
68
|
+
/** Whether this line was created from an explicit newline */
|
|
69
|
+
fromExplicitNewline: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Default wrap options.
|
|
73
|
+
*/
|
|
74
|
+
export declare const DEFAULT_WRAP_OPTIONS: Required<Omit<WrapOptions, "maxWidthPx" | "maxLines" | "maxBytes">>;
|
|
75
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/display/wrapper/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,mEAAmE;IACnE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,gEAAgE;IAChE,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,qBAAqB,GAAG,MAAM,GAAG,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oBAAoB;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;IAEnB,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IAEvB,mCAAmC;IACnC,UA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