@ecmaos/kernel 0.9.7 → 0.10.2
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 +5 -4
- package/dist/.vite/manifest.json +19 -12
- package/dist/{browser-D9_x3826.js → browser-D_rzdy4k.js} +2 -2
- package/dist/{browser-D9_x3826.js.map → browser-D_rzdy4k.js.map} +1 -1
- package/dist/icons/android/play_store_512.png +0 -0
- package/dist/icons/android/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- package/dist/icons/android/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/dist/icons/android/res/mipmap-hdpi/ic_launcher_background.png +0 -0
- package/dist/icons/android/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/dist/icons/android/res/mipmap-hdpi/ic_launcher_monochrome.png +0 -0
- package/dist/icons/android/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/dist/icons/android/res/mipmap-mdpi/ic_launcher_background.png +0 -0
- package/dist/icons/android/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/dist/icons/android/res/mipmap-mdpi/ic_launcher_monochrome.png +0 -0
- package/dist/icons/android/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/dist/icons/android/res/mipmap-xhdpi/ic_launcher_background.png +0 -0
- package/dist/icons/android/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/dist/icons/android/res/mipmap-xhdpi/ic_launcher_monochrome.png +0 -0
- package/dist/icons/android/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/dist/icons/android/res/mipmap-xxhdpi/ic_launcher_background.png +0 -0
- package/dist/icons/android/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/dist/icons/android/res/mipmap-xxhdpi/ic_launcher_monochrome.png +0 -0
- package/dist/icons/android/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/dist/icons/android/res/mipmap-xxxhdpi/ic_launcher_background.png +0 -0
- package/dist/icons/android/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/dist/icons/android/res/mipmap-xxxhdpi/ic_launcher_monochrome.png +0 -0
- package/dist/icons/ios/AppIcon-20@2x.png +0 -0
- package/dist/icons/ios/AppIcon-20@2x~ipad.png +0 -0
- package/dist/icons/ios/AppIcon-20@3x.png +0 -0
- package/dist/icons/ios/AppIcon-20~ipad.png +0 -0
- package/dist/icons/ios/AppIcon-29.png +0 -0
- package/dist/icons/ios/AppIcon-29@2x.png +0 -0
- package/dist/icons/ios/AppIcon-29@2x~ipad.png +0 -0
- package/dist/icons/ios/AppIcon-29@3x.png +0 -0
- package/dist/icons/ios/AppIcon-29~ipad.png +0 -0
- package/dist/icons/ios/AppIcon-40@2x.png +0 -0
- package/dist/icons/ios/AppIcon-40@2x~ipad.png +0 -0
- package/dist/icons/ios/AppIcon-40@3x.png +0 -0
- package/dist/icons/ios/AppIcon-40~ipad.png +0 -0
- package/dist/icons/ios/AppIcon-60@2x~car.png +0 -0
- package/dist/icons/ios/AppIcon-60@3x~car.png +0 -0
- package/dist/icons/ios/AppIcon-83.5@2x~ipad.png +0 -0
- package/dist/icons/ios/AppIcon@2x.png +0 -0
- package/dist/icons/ios/AppIcon@2x~ipad.png +0 -0
- package/dist/icons/ios/AppIcon@3x.png +0 -0
- package/dist/icons/ios/AppIcon~ios-marketing.png +0 -0
- package/dist/icons/ios/AppIcon~ipad.png +0 -0
- package/dist/icons/ios/Contents.json +134 -0
- package/dist/icons/web/README.txt +18 -0
- package/dist/icons/web/apple-touch-icon.png +0 -0
- package/dist/icons/web/favicon.ico +0 -0
- package/dist/icons/web/icon-192-maskable.png +0 -0
- package/dist/icons/web/icon-192.png +0 -0
- package/dist/icons/web/icon-512-maskable.png +0 -0
- package/dist/icons/web/icon-512.png +0 -0
- package/dist/{index-B-CeVLpc.js → index-Dt0A0I3o.js} +2 -2
- package/dist/{index-B-CeVLpc.js.map → index-Dt0A0I3o.js.map} +1 -1
- package/dist/index.html +10 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/assets/dmt/dmt-search.cmp +0 -0
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_auth.Auth.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_components.Component.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_components.Components.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_dom.Dom.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_events.Events.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_fdtable.FDTable.html +14 -14
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_filesystem.Filesystem.html +12 -12
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_i18n.I18n.html +6 -6
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_intervals.Intervals.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_kernel.Kernel.html +82 -63
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_lib_commands.TerminalCommand.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_log.Log.html +3 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_memory.Memory.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_processes.Process.html +33 -33
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_processes.ProcessManager.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_protocol.Protocol.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_service.Service.html +10 -10
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_shell.Shell.html +17 -16
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_sockets.Sockets.html +7 -7
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_storage.Storage.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_telemetry.Telemetry.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_terminal.Spinner.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_terminal.Terminal.html +53 -35
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_users.Users.html +13 -13
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_wasm.Wasm.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_windows.Windows.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/classes/kernel_src_tree_workers.Workers.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/enums/kernel_src_tree_terminal.CommandPath.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/enums/types_kernel.KernelEvents.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/enums/types_kernel.KernelState.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/enums/types_processes.ProcessEvents.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/enums/types_terminal.TerminalEvents.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.TerminalCommands.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.clear.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.df.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.download.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.exportCmd.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.load.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.passwd.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.ps.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.reboot.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.screensaver.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.snake.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.su.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands.upload.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands_install.default.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_commands_uninstall.default.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_crontab.parseCrontabFile.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_crontab.parseCrontabLine.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_fstab.parseFstabFile.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_fstab.parseFstabLine.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_screensavers_blank.default.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_screensavers_blank.exit.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_screensavers_matrix.default.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_lib_screensavers_matrix.exit.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_wasi_preview1.default.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/functions/kernel_src_tree_wasi_preview2.default.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/index.html +4 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/kernel_src_tree_lib_commands.CommandArgs.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/kernel_src_tree_lib_crontab.CrontabEntry.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/kernel_src_tree_wasm.WasiComponentResult.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/kernel_src_tree_wasm.WasiStreamOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_auth.Auth.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_components.Components.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_device.KernelDevice.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_device.KernelDeviceCLIOptions.html +6 -6
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_device.KernelDeviceData.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_dom.Dom.html +6 -6
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_dom.DomOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_events.Events.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_filesystem.FileHeader.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_filesystem.Filesystem.html +10 -10
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_filesystem.FilesystemDescriptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_filesystem.FstabEntry.html +5 -5
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_i18n.I18n.html +7 -7
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_i18n.I18nFilesystemAdapter.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_i18n.I18nNamespaces.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_i18n.I18nOptions.html +7 -7
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_i18n.I18nResourceLoadResult.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_intervals.ITimerHandle.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_intervals.Intervals.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_kernel.BootOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_kernel.Kernel.html +57 -47
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_kernel.KernelExecuteEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_kernel.KernelExecuteOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_kernel.KernelOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_kernel.KernelPanicEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_kernel.KernelShutdownEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_kernel.KernelUploadEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_keyboard.Keyboard.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_log.Log.html +10 -10
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_log.LogOptions.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_memory.Memory.html +16 -16
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_modules.KernelModule.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.FDTable.html +13 -13
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.FileHandle.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.Process.html +31 -31
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.ProcessEntryParams.html +16 -16
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.ProcessExitEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.ProcessManager.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.ProcessOptions.html +18 -18
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.ProcessPauseEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.ProcessResumeEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.ProcessStartEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_processes.ProcessStopEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_protocol.Protocol.html +3 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_protocol.ProtocolOptions.html +3 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_service.Service.html +9 -9
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_service.ServiceOptions.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_shell.Shell.html +13 -13
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_shell.ShellOptions.html +7 -7
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_sockets.Sockets.html +7 -7
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_sockets.SocketsOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_sockets.WebSocketConnection.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_sockets.WebTransportConnection.html +8 -8
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_storage.StorageOptions.html +3 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_storage.StorageProvider.html +7 -7
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_telemetry.Telemetry.html +3 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_telemetry.TelemetryOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.Terminal.html +45 -34
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalAttachEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalCommand.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalCreatedEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalExecuteEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalInputEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalInterruptEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalKeyEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalListenEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalMessageEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalMountEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalOptions.html +6 -6
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalPasteEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalResizeEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalUnlistenEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalWriteEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_terminal.TerminalWritelnEvent.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_users.AddUserOptions.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_users.Passkey.html +7 -7
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_users.User.html +9 -9
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_users.Users.html +14 -14
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_users.UsersOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_wasm.WasiComponentResult.html +3 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_wasm.WasiStreamOptions.html +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_wasm.Wasm.html +5 -5
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_wasm.WasmOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_windows.WindowOptions.html +2 -2
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_windows.Windows.html +7 -7
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/interfaces/types_workers.Workers.html +3 -3
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/media/package.json +4 -4
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/kernel_src_tree_fdtable.ZenFSFileHandle.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_auth.PasswordCredentialInit.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_components.ComponentListener.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_events.EventCallback.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_filesystem.FilesystemConfigMounts.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_filesystem.FilesystemOptions.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_filesystem.Fstab.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_filesystem.Path.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_i18n.I18nResourceBundle.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_intervals.CronMap.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_intervals.IntervalMap.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_memory.Address.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_memory.Collection.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_memory.Config.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_memory.Heap.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_memory.Stack.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_memory.StackFrame.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_modules.KernelModules.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_processes.ProcessStatus.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_processes.ProcessesMap.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_sockets.SocketConnection.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_sockets.WebSocketState.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_sockets.WebTransportState.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_users.GID.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_users.UID.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/types/types_windows.WindowId.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/variables/kernel_src_tree_device.DefaultDevices.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/variables/kernel_src_tree_dom.DefaultDomOptions.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/variables/kernel_src_tree_filesystem.DefaultFilesystemOptions.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/variables/kernel_src_tree_i18n.DefaultI18nOptions.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/variables/kernel_src_tree_log.DefaultLogOptions.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/variables/kernel_src_tree_service.DefaultServiceOptions.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/docs/variables/kernel_src_tree_terminal.DefaultTerminalOptions.html +1 -1
- package/dist/initfs/usr/share/docs/@ecmaos/kernel/index.md +5 -4
- package/dist/initfs.demo/root/bin/test.wasm +0 -0
- package/dist/initfs.demo/usr/share/docs/@ecmaos/kernel/index.md +42 -13
- package/dist/initfs.tar.gz +0 -0
- package/dist/{install-D5ABLXdg.js → install-CRrPdUs9.js} +2 -2
- package/dist/{install-D5ABLXdg.js.map → install-CRrPdUs9.js.map} +1 -1
- package/dist/{kernel-DXuSgAWA.js → kernel-Io5VyIzi.js} +2324 -856
- package/dist/{kernel-DXuSgAWA.js.map → kernel-Io5VyIzi.js.map} +1 -1
- package/dist/kernel.css +95 -4
- package/dist/kernel.d.ts +39 -0
- package/dist/kernel.js +1 -1
- package/dist/manifest.json +36 -0
- package/dist/swapi.js +1560 -1022
- package/dist/ui.js +35 -5
- package/dist/ui.js.map +1 -1
- package/dist/{uninstall-Cd5CIWlo.js → uninstall-Bb4xsCq5.js} +2 -2
- package/dist/{uninstall-Cd5CIWlo.js.map → uninstall-Bb4xsCq5.js.map} +1 -1
- package/dist/vimwasm-DWJK1Y7M.js +809 -0
- package/dist/vimwasm-DWJK1Y7M.js.map +1 -0
- package/package.json +9 -7
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
const AsyncFunction = Object.getPrototypeOf(async function() {
|
|
4
|
+
}).constructor;
|
|
5
|
+
function noop() {
|
|
6
|
+
}
|
|
7
|
+
__name(noop, "noop");
|
|
8
|
+
let debug = noop;
|
|
9
|
+
const STATUS_NOT_SET = 0;
|
|
10
|
+
const STATUS_NOTIFY_KEY = 1;
|
|
11
|
+
const STATUS_NOTIFY_RESIZE = 2;
|
|
12
|
+
const STATUS_NOTIFY_OPEN_FILE_BUF_COMPLETE = 3;
|
|
13
|
+
const STATUS_NOTIFY_CLIPBOARD_WRITE_COMPLETE = 4;
|
|
14
|
+
const STATUS_REQUEST_CMDLINE = 5;
|
|
15
|
+
const STATUS_REQUEST_SHARED_BUF = 6;
|
|
16
|
+
const STATUS_NOTIFY_ERROR_OUTPUT = 7;
|
|
17
|
+
const STATUS_NOTIFY_EVAL_FUNC_RET = 8;
|
|
18
|
+
function statusName(s) {
|
|
19
|
+
switch (s) {
|
|
20
|
+
case STATUS_NOT_SET:
|
|
21
|
+
return "NOT_SET";
|
|
22
|
+
case STATUS_NOTIFY_KEY:
|
|
23
|
+
return "NOTIFY_KEY";
|
|
24
|
+
case STATUS_NOTIFY_RESIZE:
|
|
25
|
+
return "NOTIFY_RESIZE";
|
|
26
|
+
case STATUS_NOTIFY_OPEN_FILE_BUF_COMPLETE:
|
|
27
|
+
return "NOTIFY_OPEN_FILE_BUF_COMPLETE";
|
|
28
|
+
case STATUS_NOTIFY_CLIPBOARD_WRITE_COMPLETE:
|
|
29
|
+
return "NOTIFY_CLIPBOARD_WRITE_COMPLETE";
|
|
30
|
+
case STATUS_REQUEST_CMDLINE:
|
|
31
|
+
return "REQUEST_CMDLINE";
|
|
32
|
+
case STATUS_REQUEST_SHARED_BUF:
|
|
33
|
+
return "REQUEST_SHARED_BUF";
|
|
34
|
+
case STATUS_NOTIFY_ERROR_OUTPUT:
|
|
35
|
+
return "NOTIFY_ERROR_OUTPUT";
|
|
36
|
+
case STATUS_NOTIFY_EVAL_FUNC_RET:
|
|
37
|
+
return "STATUS_NOTIFY_EVAL_FUNC_RET";
|
|
38
|
+
default:
|
|
39
|
+
return `Unknown command: ${s}`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
__name(statusName, "statusName");
|
|
43
|
+
function checkBrowserCompatibility() {
|
|
44
|
+
function notSupported(feat) {
|
|
45
|
+
return `${feat} is not supported by this browser. If you're using Firefox or Safari, please enable feature flag.`;
|
|
46
|
+
}
|
|
47
|
+
__name(notSupported, "notSupported");
|
|
48
|
+
if (typeof SharedArrayBuffer === "undefined") {
|
|
49
|
+
return notSupported("SharedArrayBuffer");
|
|
50
|
+
}
|
|
51
|
+
if (typeof Atomics === "undefined") {
|
|
52
|
+
return notSupported("Atomics API");
|
|
53
|
+
}
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
__name(checkBrowserCompatibility, "checkBrowserCompatibility");
|
|
57
|
+
const _VimWorker = class _VimWorker {
|
|
58
|
+
constructor(scriptPath, onMessage, onError) {
|
|
59
|
+
this.worker = new Worker(scriptPath);
|
|
60
|
+
this.worker.onmessage = this.recvMessage.bind(this);
|
|
61
|
+
this.worker.onerror = this.recvError.bind(this);
|
|
62
|
+
this.sharedBuffer = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 128));
|
|
63
|
+
this.onMessage = onMessage;
|
|
64
|
+
this.onError = onError;
|
|
65
|
+
this.onOneshotMessage = /* @__PURE__ */ new Map();
|
|
66
|
+
this.debug = false;
|
|
67
|
+
this.pendingEvents = [];
|
|
68
|
+
}
|
|
69
|
+
terminate() {
|
|
70
|
+
this.worker.terminate();
|
|
71
|
+
this.worker.onmessage = null;
|
|
72
|
+
debug("Terminated worker thread. Thank you for working hard!");
|
|
73
|
+
}
|
|
74
|
+
sendStartMessage(msg) {
|
|
75
|
+
this.worker.postMessage(msg);
|
|
76
|
+
debug("Sent start message", msg);
|
|
77
|
+
}
|
|
78
|
+
notifyOpenFileBufComplete(filename, bufId) {
|
|
79
|
+
this.enqueueEvent(STATUS_NOTIFY_OPEN_FILE_BUF_COMPLETE, bufId, filename);
|
|
80
|
+
}
|
|
81
|
+
notifyClipboardWriteComplete(cannotSend, bufId) {
|
|
82
|
+
this.enqueueEvent(STATUS_NOTIFY_CLIPBOARD_WRITE_COMPLETE, cannotSend, bufId);
|
|
83
|
+
}
|
|
84
|
+
notifyKeyEvent(key, keyCode, ctrl, shift, alt, meta) {
|
|
85
|
+
this.enqueueEvent(STATUS_NOTIFY_KEY, keyCode, ctrl, shift, alt, meta, key);
|
|
86
|
+
}
|
|
87
|
+
notifyResizeEvent(width, height) {
|
|
88
|
+
this.enqueueEvent(STATUS_NOTIFY_RESIZE, width, height);
|
|
89
|
+
}
|
|
90
|
+
async requestSharedBuffer(byteLength) {
|
|
91
|
+
this.enqueueEvent(STATUS_REQUEST_SHARED_BUF, byteLength);
|
|
92
|
+
const msg = await this.waitForOneshotMessage("shared-buf:response");
|
|
93
|
+
if (msg.buffer.byteLength !== byteLength) {
|
|
94
|
+
throw new Error(`Size of shared buffer from worker ${msg.buffer.byteLength} bytes mismatches to requested size ${byteLength} bytes`);
|
|
95
|
+
}
|
|
96
|
+
return [msg.bufId, msg.buffer];
|
|
97
|
+
}
|
|
98
|
+
notifyClipboardError() {
|
|
99
|
+
this.notifyClipboardWriteComplete(true, 0);
|
|
100
|
+
debug("Reading clipboard failed. Notify it to worker");
|
|
101
|
+
}
|
|
102
|
+
async responseClipboardText(text) {
|
|
103
|
+
const encoded = new TextEncoder().encode(text);
|
|
104
|
+
const [bufId, buffer] = await this.requestSharedBuffer(encoded.byteLength + 1);
|
|
105
|
+
new Uint8Array(buffer).set(encoded);
|
|
106
|
+
this.notifyClipboardWriteComplete(false, bufId);
|
|
107
|
+
debug("Wrote clipboard", encoded.byteLength, "bytes text and notified to worker");
|
|
108
|
+
}
|
|
109
|
+
async requestCmdline(cmdline) {
|
|
110
|
+
if (cmdline.length === 0) {
|
|
111
|
+
throw new Error("Specified command line is empty");
|
|
112
|
+
}
|
|
113
|
+
this.enqueueEvent(STATUS_REQUEST_CMDLINE, cmdline);
|
|
114
|
+
const msg = await this.waitForOneshotMessage("cmdline:response");
|
|
115
|
+
debug("Result of command", cmdline, ":", msg.success);
|
|
116
|
+
if (!msg.success) {
|
|
117
|
+
throw Error(`Command '${cmdline}' was invalid and not accepted by Vim`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async notifyErrorOutput(message) {
|
|
121
|
+
const encoded = new TextEncoder().encode(message);
|
|
122
|
+
const [bufId, buffer] = await this.requestSharedBuffer(encoded.byteLength);
|
|
123
|
+
new Uint8Array(buffer).set(encoded);
|
|
124
|
+
this.enqueueEvent(STATUS_NOTIFY_ERROR_OUTPUT, bufId);
|
|
125
|
+
debug("Sent error message output:", message);
|
|
126
|
+
}
|
|
127
|
+
async notifyEvalFuncRet(ret) {
|
|
128
|
+
const encoded = new TextEncoder().encode(ret);
|
|
129
|
+
const [bufId, buffer] = await this.requestSharedBuffer(encoded.byteLength);
|
|
130
|
+
new Uint8Array(buffer).set(encoded);
|
|
131
|
+
this.enqueueEvent(STATUS_NOTIFY_EVAL_FUNC_RET, false, bufId);
|
|
132
|
+
debug("Sent return value of evaluated JS function:", ret);
|
|
133
|
+
}
|
|
134
|
+
async notifyEvalFuncError(msg, err, dontReply) {
|
|
135
|
+
const errmsg = `${msg} for jsevalfunc(): ${err.message}: ${err.stack}`;
|
|
136
|
+
if (dontReply) {
|
|
137
|
+
debug("Will send error output from jsevalfunc() though the invocation was notify-only:", errmsg);
|
|
138
|
+
return this.notifyErrorOutput(errmsg);
|
|
139
|
+
}
|
|
140
|
+
const encoded = new TextEncoder().encode("E9999: " + errmsg);
|
|
141
|
+
const [bufId, buffer] = await this.requestSharedBuffer(encoded.byteLength);
|
|
142
|
+
new Uint8Array(buffer).set(encoded);
|
|
143
|
+
this.enqueueEvent(STATUS_NOTIFY_EVAL_FUNC_RET, true, bufId);
|
|
144
|
+
debug("Sent exception thrown by evaluated JS function:", msg, err);
|
|
145
|
+
}
|
|
146
|
+
onEventDone(doneStatus) {
|
|
147
|
+
const done = statusName(doneStatus);
|
|
148
|
+
const finished = this.pendingEvents.shift();
|
|
149
|
+
if (finished === void 0) {
|
|
150
|
+
throw new Error(`FATAL: Received ${done} event but event queue is empty`);
|
|
151
|
+
}
|
|
152
|
+
if (finished[0] !== doneStatus) {
|
|
153
|
+
throw new Error(`FATAL: Received ${done} event but queue says previous event was ${statusName(finished[0])} with args ${finished[1]}`);
|
|
154
|
+
}
|
|
155
|
+
if (this.pendingEvents.length === 0) {
|
|
156
|
+
debug("No pending event remains after event", done);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
debug("After", done, "event, still", this.pendingEvents.length, "events are pending");
|
|
160
|
+
const [status, values] = this.pendingEvents[0];
|
|
161
|
+
this.sendEvent(status, values);
|
|
162
|
+
}
|
|
163
|
+
enqueueEvent(status, ...values) {
|
|
164
|
+
this.pendingEvents.push([status, values]);
|
|
165
|
+
if (this.pendingEvents.length > 1) {
|
|
166
|
+
debug("Other event is being handled by worker. Pending:", statusName(status), values);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
this.sendEvent(status, values);
|
|
170
|
+
}
|
|
171
|
+
sendEvent(status, values) {
|
|
172
|
+
const event = statusName(status);
|
|
173
|
+
if (this.debug) {
|
|
174
|
+
const status2 = Atomics.load(this.sharedBuffer, 0);
|
|
175
|
+
if (status2 !== STATUS_NOT_SET) {
|
|
176
|
+
console.error("INVARIANT ERROR! Status byte must be zero cleared:", event);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
debug("Write event", event, "payload to buffer:", values);
|
|
180
|
+
let idx = 0;
|
|
181
|
+
this.sharedBuffer[idx++] = status;
|
|
182
|
+
for (const value of values) {
|
|
183
|
+
switch (typeof value) {
|
|
184
|
+
case "string":
|
|
185
|
+
idx = this.encodeStringToBuffer(value, idx);
|
|
186
|
+
break;
|
|
187
|
+
case "number":
|
|
188
|
+
this.sharedBuffer[idx++] = value;
|
|
189
|
+
break;
|
|
190
|
+
case "boolean":
|
|
191
|
+
this.sharedBuffer[idx++] = +value;
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
throw new Error(`FATAL: Invalid value for payload to worker: ${value}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
debug("Wrote", idx * 4, "bytes to buffer for event", event);
|
|
198
|
+
Atomics.notify(this.sharedBuffer, 0, 1);
|
|
199
|
+
debug("Notified event", event, "to worker");
|
|
200
|
+
}
|
|
201
|
+
async waitForOneshotMessage(kind) {
|
|
202
|
+
return new Promise((resolve) => {
|
|
203
|
+
this.onOneshotMessage.set(kind, resolve);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
encodeStringToBuffer(s, startIdx) {
|
|
207
|
+
let idx = startIdx;
|
|
208
|
+
const len = s.length;
|
|
209
|
+
this.sharedBuffer[idx++] = len;
|
|
210
|
+
for (let i = 0; i < len; ++i) {
|
|
211
|
+
this.sharedBuffer[idx++] = s.charCodeAt(i);
|
|
212
|
+
}
|
|
213
|
+
return idx;
|
|
214
|
+
}
|
|
215
|
+
recvMessage(e) {
|
|
216
|
+
const msg = e.data;
|
|
217
|
+
const handler = this.onOneshotMessage.get(msg.kind);
|
|
218
|
+
if (handler !== void 0) {
|
|
219
|
+
this.onOneshotMessage.delete(msg.kind);
|
|
220
|
+
handler(msg);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
this.onMessage(msg);
|
|
224
|
+
}
|
|
225
|
+
recvError(e) {
|
|
226
|
+
debug("Received an error from worker:", e);
|
|
227
|
+
const msg = `${e.message} (${e.filename}:${e.lineno}:${e.colno})`;
|
|
228
|
+
this.onError(new Error(msg));
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
__name(_VimWorker, "VimWorker");
|
|
232
|
+
let VimWorker = _VimWorker;
|
|
233
|
+
const _ResizeHandler = class _ResizeHandler {
|
|
234
|
+
constructor(domWidth, domHeight, canvas, worker) {
|
|
235
|
+
this.canvas = canvas;
|
|
236
|
+
this.worker = worker;
|
|
237
|
+
this.elemHeight = domHeight;
|
|
238
|
+
this.elemWidth = domWidth;
|
|
239
|
+
const dpr = window.devicePixelRatio || 1;
|
|
240
|
+
this.canvas.width = domWidth * dpr;
|
|
241
|
+
this.canvas.height = domHeight * dpr;
|
|
242
|
+
this.bounceTimerToken = null;
|
|
243
|
+
this.onResize = this.onResize.bind(this);
|
|
244
|
+
}
|
|
245
|
+
onVimInit() {
|
|
246
|
+
window.addEventListener("resize", this.onResize, { passive: true });
|
|
247
|
+
}
|
|
248
|
+
onVimExit() {
|
|
249
|
+
window.removeEventListener("resize", this.onResize);
|
|
250
|
+
}
|
|
251
|
+
doResize() {
|
|
252
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
253
|
+
debug("Resize Vim:", rect);
|
|
254
|
+
this.elemWidth = rect.width;
|
|
255
|
+
this.elemHeight = rect.height;
|
|
256
|
+
const res = window.devicePixelRatio || 1;
|
|
257
|
+
this.canvas.width = rect.width * res;
|
|
258
|
+
this.canvas.height = rect.height * res;
|
|
259
|
+
this.worker.notifyResizeEvent(rect.width, rect.height);
|
|
260
|
+
}
|
|
261
|
+
onResize() {
|
|
262
|
+
if (this.bounceTimerToken !== null) {
|
|
263
|
+
window.clearTimeout(this.bounceTimerToken);
|
|
264
|
+
}
|
|
265
|
+
this.bounceTimerToken = window.setTimeout(() => {
|
|
266
|
+
this.bounceTimerToken = null;
|
|
267
|
+
this.doResize();
|
|
268
|
+
}, 500);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
__name(_ResizeHandler, "ResizeHandler");
|
|
272
|
+
let ResizeHandler = _ResizeHandler;
|
|
273
|
+
const _InputHandler = class _InputHandler {
|
|
274
|
+
constructor(worker, input) {
|
|
275
|
+
this.worker = worker;
|
|
276
|
+
this.elem = input;
|
|
277
|
+
this.onKeydown = this.onKeydown.bind(this);
|
|
278
|
+
this.onBlur = this.onBlur.bind(this);
|
|
279
|
+
this.onFocus = this.onFocus.bind(this);
|
|
280
|
+
this.focus();
|
|
281
|
+
}
|
|
282
|
+
setFont(name, size) {
|
|
283
|
+
this.elem.style.fontFamily = name;
|
|
284
|
+
this.elem.style.fontSize = `${size}px`;
|
|
285
|
+
}
|
|
286
|
+
focus() {
|
|
287
|
+
this.elem.focus();
|
|
288
|
+
}
|
|
289
|
+
onVimInit() {
|
|
290
|
+
this.elem.addEventListener("keydown", this.onKeydown, { capture: true });
|
|
291
|
+
this.elem.addEventListener("blur", this.onBlur);
|
|
292
|
+
this.elem.addEventListener("focus", this.onFocus);
|
|
293
|
+
}
|
|
294
|
+
onVimExit() {
|
|
295
|
+
this.elem.removeEventListener("keydown", this.onKeydown);
|
|
296
|
+
this.elem.removeEventListener("blur", this.onBlur);
|
|
297
|
+
this.elem.removeEventListener("focus", this.onFocus);
|
|
298
|
+
}
|
|
299
|
+
onKeydown(event) {
|
|
300
|
+
event.preventDefault();
|
|
301
|
+
event.stopPropagation();
|
|
302
|
+
debug("onKeydown():", event, event.key, event.keyCode);
|
|
303
|
+
let key = event.key;
|
|
304
|
+
const ctrl = event.ctrlKey;
|
|
305
|
+
const shift = event.shiftKey;
|
|
306
|
+
const alt = event.altKey;
|
|
307
|
+
const meta = event.metaKey;
|
|
308
|
+
if (key.length > 1) {
|
|
309
|
+
if (key === "Unidentified" || ctrl && key === "Control" || shift && key === "Shift" || alt && key === "Alt" || meta && key === "Meta") {
|
|
310
|
+
debug("Ignore key input", key);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (key === "¥" || !shift && key === "|" && event.code === "IntlYen") {
|
|
315
|
+
key = "\\";
|
|
316
|
+
}
|
|
317
|
+
this.worker.notifyKeyEvent(key, event.keyCode, ctrl, shift, alt, meta);
|
|
318
|
+
}
|
|
319
|
+
onFocus() {
|
|
320
|
+
debug("onFocus()");
|
|
321
|
+
}
|
|
322
|
+
onBlur(event) {
|
|
323
|
+
debug("onBlur():", event);
|
|
324
|
+
event.preventDefault();
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
__name(_InputHandler, "InputHandler");
|
|
328
|
+
let InputHandler = _InputHandler;
|
|
329
|
+
const _ScreenCanvas = class _ScreenCanvas {
|
|
330
|
+
constructor(worker, canvas, input) {
|
|
331
|
+
this.worker = worker;
|
|
332
|
+
this.canvas = canvas;
|
|
333
|
+
const ctx = this.canvas.getContext("2d", { alpha: false });
|
|
334
|
+
if (ctx === null) {
|
|
335
|
+
throw new Error("Cannot get 2D context for <canvas>");
|
|
336
|
+
}
|
|
337
|
+
this.ctx = ctx;
|
|
338
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
339
|
+
const res = window.devicePixelRatio || 1;
|
|
340
|
+
this.canvas.width = rect.width * res;
|
|
341
|
+
this.canvas.height = rect.height * res;
|
|
342
|
+
this.canvas.addEventListener("click", this.onClick.bind(this), { capture: true, passive: true });
|
|
343
|
+
this.input = new InputHandler(this.worker, input);
|
|
344
|
+
this.resizer = new ResizeHandler(rect.width, rect.height, canvas, worker);
|
|
345
|
+
this.onAnimationFrame = this.onAnimationFrame.bind(this);
|
|
346
|
+
this.queue = [];
|
|
347
|
+
this.rafScheduled = false;
|
|
348
|
+
this.perf = false;
|
|
349
|
+
this.fgColor = "";
|
|
350
|
+
this.spColor = "";
|
|
351
|
+
this.fontName = "";
|
|
352
|
+
}
|
|
353
|
+
onVimInit() {
|
|
354
|
+
this.input.onVimInit();
|
|
355
|
+
this.resizer.onVimInit();
|
|
356
|
+
}
|
|
357
|
+
onVimExit() {
|
|
358
|
+
this.input.onVimExit();
|
|
359
|
+
this.resizer.onVimExit();
|
|
360
|
+
}
|
|
361
|
+
draw(msg) {
|
|
362
|
+
if (!this.rafScheduled) {
|
|
363
|
+
window.requestAnimationFrame(this.onAnimationFrame);
|
|
364
|
+
this.rafScheduled = true;
|
|
365
|
+
}
|
|
366
|
+
this.queue.push(msg);
|
|
367
|
+
}
|
|
368
|
+
focus() {
|
|
369
|
+
this.input.focus();
|
|
370
|
+
}
|
|
371
|
+
getDomSize() {
|
|
372
|
+
return { width: this.resizer.elemWidth, height: this.resizer.elemHeight };
|
|
373
|
+
}
|
|
374
|
+
setPerf(enabled) {
|
|
375
|
+
this.perf = enabled;
|
|
376
|
+
}
|
|
377
|
+
setColorFG(name) {
|
|
378
|
+
this.fgColor = name;
|
|
379
|
+
}
|
|
380
|
+
setColorBG(_name) {
|
|
381
|
+
}
|
|
382
|
+
setColorSP(name) {
|
|
383
|
+
this.spColor = name;
|
|
384
|
+
}
|
|
385
|
+
setFont(name, size) {
|
|
386
|
+
this.fontName = name;
|
|
387
|
+
this.input.setFont(name, size);
|
|
388
|
+
}
|
|
389
|
+
drawRect(x, y, w, h, color, filled) {
|
|
390
|
+
const dpr = window.devicePixelRatio || 1;
|
|
391
|
+
x = Math.floor(x * dpr);
|
|
392
|
+
y = Math.floor(y * dpr);
|
|
393
|
+
w = Math.floor(w * dpr);
|
|
394
|
+
h = Math.floor(h * dpr);
|
|
395
|
+
this.ctx.fillStyle = color;
|
|
396
|
+
if (filled) {
|
|
397
|
+
this.ctx.fillRect(x, y, w, h);
|
|
398
|
+
} else {
|
|
399
|
+
this.ctx.rect(x, y, w, h);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
drawText(text, ch, lh, cw, x, y, bold, underline, undercurl, strike) {
|
|
403
|
+
const dpr = window.devicePixelRatio || 1;
|
|
404
|
+
ch = ch * dpr;
|
|
405
|
+
lh = lh * dpr;
|
|
406
|
+
cw = cw * dpr;
|
|
407
|
+
x = x * dpr;
|
|
408
|
+
y = y * dpr;
|
|
409
|
+
let font = `${Math.floor(ch)}px ${this.fontName}`;
|
|
410
|
+
if (bold) {
|
|
411
|
+
font = "bold " + font;
|
|
412
|
+
}
|
|
413
|
+
this.ctx.font = font;
|
|
414
|
+
this.ctx.textBaseline = "bottom";
|
|
415
|
+
this.ctx.fillStyle = this.fgColor;
|
|
416
|
+
const descent = (lh - ch) / 2;
|
|
417
|
+
const yi = Math.floor(y + lh - descent);
|
|
418
|
+
for (let i = 0; i < text.length; ++i) {
|
|
419
|
+
const c = text[i];
|
|
420
|
+
if (c === " ") {
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
this.ctx.fillText(c, Math.floor(x + cw * i), yi);
|
|
424
|
+
}
|
|
425
|
+
if (underline) {
|
|
426
|
+
this.ctx.strokeStyle = this.fgColor;
|
|
427
|
+
this.ctx.lineWidth = 1 * dpr;
|
|
428
|
+
this.ctx.setLineDash([]);
|
|
429
|
+
this.ctx.beginPath();
|
|
430
|
+
const underlineY = Math.floor(y + lh - descent - 1 * dpr);
|
|
431
|
+
this.ctx.moveTo(Math.floor(x), underlineY);
|
|
432
|
+
this.ctx.lineTo(Math.floor(x + cw * text.length), underlineY);
|
|
433
|
+
this.ctx.stroke();
|
|
434
|
+
} else if (undercurl) {
|
|
435
|
+
this.ctx.strokeStyle = this.spColor;
|
|
436
|
+
this.ctx.lineWidth = 1 * dpr;
|
|
437
|
+
const curlWidth = Math.floor(cw / 3);
|
|
438
|
+
this.ctx.setLineDash([curlWidth, curlWidth]);
|
|
439
|
+
this.ctx.beginPath();
|
|
440
|
+
const undercurlY = Math.floor(y + lh - descent - 1 * dpr);
|
|
441
|
+
this.ctx.moveTo(Math.floor(x), undercurlY);
|
|
442
|
+
this.ctx.lineTo(Math.floor(x + cw * text.length), undercurlY);
|
|
443
|
+
this.ctx.stroke();
|
|
444
|
+
} else if (strike) {
|
|
445
|
+
this.ctx.strokeStyle = this.fgColor;
|
|
446
|
+
this.ctx.lineWidth = 1 * dpr;
|
|
447
|
+
this.ctx.beginPath();
|
|
448
|
+
const strikeY = Math.floor(y + lh / 2);
|
|
449
|
+
this.ctx.moveTo(Math.floor(x), strikeY);
|
|
450
|
+
this.ctx.lineTo(Math.floor(x + cw * text.length), strikeY);
|
|
451
|
+
this.ctx.stroke();
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
invertRect(x, y, w, h) {
|
|
455
|
+
const dpr = window.devicePixelRatio || 1;
|
|
456
|
+
x = Math.floor(x * dpr);
|
|
457
|
+
y = Math.floor(y * dpr);
|
|
458
|
+
w = Math.floor(w * dpr);
|
|
459
|
+
h = Math.floor(h * dpr);
|
|
460
|
+
const img = this.ctx.getImageData(x, y, w, h);
|
|
461
|
+
const data = img.data;
|
|
462
|
+
const len = data.length;
|
|
463
|
+
for (let i = 0; i < len; ++i) {
|
|
464
|
+
data[i] = 255 - data[i];
|
|
465
|
+
++i;
|
|
466
|
+
data[i] = 255 - data[i];
|
|
467
|
+
++i;
|
|
468
|
+
data[i] = 255 - data[i];
|
|
469
|
+
++i;
|
|
470
|
+
}
|
|
471
|
+
this.ctx.putImageData(img, x, y);
|
|
472
|
+
}
|
|
473
|
+
imageScroll(x, sy, dy, w, h) {
|
|
474
|
+
const dpr = window.devicePixelRatio || 1;
|
|
475
|
+
x = Math.floor(x * dpr);
|
|
476
|
+
sy = Math.floor(sy * dpr);
|
|
477
|
+
dy = Math.floor(dy * dpr);
|
|
478
|
+
w = Math.floor(w * dpr);
|
|
479
|
+
h = Math.floor(h * dpr);
|
|
480
|
+
this.ctx.drawImage(this.canvas, x, sy, w, h, x, dy, w, h);
|
|
481
|
+
}
|
|
482
|
+
onClick() {
|
|
483
|
+
this.input.focus();
|
|
484
|
+
}
|
|
485
|
+
onAnimationFrame() {
|
|
486
|
+
debug("Rendering", this.queue.length, "events on animation frame");
|
|
487
|
+
this.perfMark("raf");
|
|
488
|
+
for (const [method, args] of this.queue) {
|
|
489
|
+
this.perfMark("draw");
|
|
490
|
+
this[method].apply(this, args);
|
|
491
|
+
this.perfMeasure("draw", `draw:${method}`);
|
|
492
|
+
}
|
|
493
|
+
this.queue.length = 0;
|
|
494
|
+
this.rafScheduled = false;
|
|
495
|
+
this.perfMeasure("raf");
|
|
496
|
+
}
|
|
497
|
+
perfMark(m) {
|
|
498
|
+
if (this.perf) {
|
|
499
|
+
performance.mark(m);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
perfMeasure(m, n) {
|
|
503
|
+
if (this.perf) {
|
|
504
|
+
performance.measure(n !== null && n !== void 0 ? n : m, m);
|
|
505
|
+
performance.clearMarks(m);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
__name(_ScreenCanvas, "ScreenCanvas");
|
|
510
|
+
let ScreenCanvas = _ScreenCanvas;
|
|
511
|
+
const _VimWasm = class _VimWasm {
|
|
512
|
+
constructor(opts) {
|
|
513
|
+
const script = opts.workerScriptPath;
|
|
514
|
+
if (!script) {
|
|
515
|
+
throw new Error("'workerScriptPath' option is required");
|
|
516
|
+
}
|
|
517
|
+
this.handleError = this.handleError.bind(this);
|
|
518
|
+
this.worker = new VimWorker(script, this.onMessage.bind(this), this.handleError);
|
|
519
|
+
if ("canvas" in opts && "input" in opts) {
|
|
520
|
+
this.screen = new ScreenCanvas(this.worker, opts.canvas, opts.input);
|
|
521
|
+
} else if ("screen" in opts) {
|
|
522
|
+
this.screen = opts.screen;
|
|
523
|
+
} else {
|
|
524
|
+
throw new Error("Invalid options for VimWasm construction: " + JSON.stringify(opts));
|
|
525
|
+
}
|
|
526
|
+
this.perf = false;
|
|
527
|
+
this.debug = false;
|
|
528
|
+
this.perfMessages = {};
|
|
529
|
+
this.running = false;
|
|
530
|
+
this.end = false;
|
|
531
|
+
}
|
|
532
|
+
start(opts) {
|
|
533
|
+
var _a, _b, _c, _d, _e;
|
|
534
|
+
if (this.running || this.end) {
|
|
535
|
+
throw new Error("Cannot start Vim twice");
|
|
536
|
+
}
|
|
537
|
+
const o = opts !== null && opts !== void 0 ? opts : { clipboard: navigator.clipboard !== void 0 };
|
|
538
|
+
if (o.debug) {
|
|
539
|
+
debug = console.log.bind(console, "main:");
|
|
540
|
+
this.worker.debug = true;
|
|
541
|
+
}
|
|
542
|
+
this.perf = !!o.perf;
|
|
543
|
+
this.debug = !!o.debug;
|
|
544
|
+
this.screen.setPerf(this.perf);
|
|
545
|
+
this.running = true;
|
|
546
|
+
this.perfMark("init");
|
|
547
|
+
const { width, height } = this.screen.getDomSize();
|
|
548
|
+
const msg = { kind: "start", buffer: this.worker.sharedBuffer, canvasDomWidth: width, canvasDomHeight: height, debug: this.debug, perf: this.perf, clipboard: !!o.clipboard, files: (_a = o.files, _a !== null && _a !== void 0 ? _a : {}), dirs: (_b = o.dirs, _b !== null && _b !== void 0 ? _b : []), fetchFiles: (_c = o.fetchFiles, _c !== null && _c !== void 0 ? _c : {}), persistent: (_d = o.persistentDirs, _d !== null && _d !== void 0 ? _d : []), cmdArgs: (_e = o.cmdArgs, _e !== null && _e !== void 0 ? _e : []) };
|
|
549
|
+
this.worker.sendStartMessage(msg);
|
|
550
|
+
debug("Started with drawer", this.screen);
|
|
551
|
+
}
|
|
552
|
+
async dropFile(name, contents) {
|
|
553
|
+
if (!this.running) {
|
|
554
|
+
throw new Error("Cannot open file since Vim is not running");
|
|
555
|
+
}
|
|
556
|
+
debug("Handling to open file", name, contents);
|
|
557
|
+
const [bufId, buffer] = await this.worker.requestSharedBuffer(contents.byteLength);
|
|
558
|
+
new Uint8Array(buffer).set(new Uint8Array(contents));
|
|
559
|
+
this.worker.notifyOpenFileBufComplete(name, bufId);
|
|
560
|
+
debug("Wrote file", name, "to", contents.byteLength, "bytes buffer and notified it to worker");
|
|
561
|
+
}
|
|
562
|
+
async dropFiles(files) {
|
|
563
|
+
const reader = new FileReader();
|
|
564
|
+
for (const file of files) {
|
|
565
|
+
const [name, contents] = await this.readFile(reader, file);
|
|
566
|
+
await this.dropFile(name, contents);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
resize(pixelWidth, pixelHeight) {
|
|
570
|
+
this.worker.notifyResizeEvent(pixelWidth, pixelHeight);
|
|
571
|
+
}
|
|
572
|
+
sendKeydown(key, keyCode, modifiers) {
|
|
573
|
+
const { ctrl = false, shift = false, alt = false, meta = false } = modifiers !== null && modifiers !== void 0 ? modifiers : {};
|
|
574
|
+
if (key.length > 1) {
|
|
575
|
+
if (key === "Unidentified" || ctrl && key === "Control" || shift && key === "Shift" || alt && key === "Alt" || meta && key === "Meta") {
|
|
576
|
+
debug("Ignore key input", key);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
this.worker.notifyKeyEvent(key, keyCode, ctrl, shift, alt, meta);
|
|
581
|
+
}
|
|
582
|
+
cmdline(cmdline) {
|
|
583
|
+
return this.worker.requestCmdline(cmdline);
|
|
584
|
+
}
|
|
585
|
+
isRunning() {
|
|
586
|
+
return this.running;
|
|
587
|
+
}
|
|
588
|
+
focus() {
|
|
589
|
+
this.screen.focus();
|
|
590
|
+
}
|
|
591
|
+
showError(message) {
|
|
592
|
+
return this.worker.notifyErrorOutput(message);
|
|
593
|
+
}
|
|
594
|
+
async readFile(reader, file) {
|
|
595
|
+
return new Promise((resolve, reject) => {
|
|
596
|
+
reader.onload = ((f) => {
|
|
597
|
+
debug("Read file", file.name, "from D&D:", f);
|
|
598
|
+
resolve([file.name, reader.result]);
|
|
599
|
+
});
|
|
600
|
+
reader.onerror = (() => {
|
|
601
|
+
reader.abort();
|
|
602
|
+
reject(new Error(`Error on loading file ${file}`));
|
|
603
|
+
});
|
|
604
|
+
reader.readAsArrayBuffer(file);
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
async evalJS(path, contents) {
|
|
608
|
+
debug("Evaluating JavaScript file", path, "with size", contents.byteLength, "bytes");
|
|
609
|
+
const dec = new TextDecoder();
|
|
610
|
+
const src = '"use strict";' + dec.decode(contents);
|
|
611
|
+
try {
|
|
612
|
+
Function(src)();
|
|
613
|
+
} catch (err) {
|
|
614
|
+
debug("Failed to evaluate", path, "with error:", err);
|
|
615
|
+
await this.showError(`${err.message}
|
|
616
|
+
|
|
617
|
+
${err.stack}`);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
async evalFunc(body, args, notifyOnly) {
|
|
621
|
+
debug("Evaluating JavaScript function:", body, args);
|
|
622
|
+
let f;
|
|
623
|
+
try {
|
|
624
|
+
f = new AsyncFunction(body);
|
|
625
|
+
} catch (err) {
|
|
626
|
+
return this.worker.notifyEvalFuncError("Could not construct function", err, notifyOnly);
|
|
627
|
+
}
|
|
628
|
+
let ret;
|
|
629
|
+
try {
|
|
630
|
+
ret = await f(...args);
|
|
631
|
+
} catch (err) {
|
|
632
|
+
return this.worker.notifyEvalFuncError("Exception was thrown while evaluating function", err, notifyOnly);
|
|
633
|
+
}
|
|
634
|
+
if (notifyOnly) {
|
|
635
|
+
debug("Evaluated JavaScript result was discarded since the message was notify-only:", ret, body);
|
|
636
|
+
return Promise.resolve();
|
|
637
|
+
}
|
|
638
|
+
let retJson;
|
|
639
|
+
try {
|
|
640
|
+
retJson = JSON.stringify(ret);
|
|
641
|
+
} catch (err) {
|
|
642
|
+
return this.worker.notifyEvalFuncError("Could not serialize return value as JSON from function", err, false);
|
|
643
|
+
}
|
|
644
|
+
return this.worker.notifyEvalFuncRet(retJson);
|
|
645
|
+
}
|
|
646
|
+
onMessage(msg) {
|
|
647
|
+
if (this.perf && msg.timestamp !== void 0) {
|
|
648
|
+
const duration = Date.now() - msg.timestamp;
|
|
649
|
+
const name = msg.kind === "draw" ? `draw:${msg.event[0]}` : msg.kind;
|
|
650
|
+
const timestamps = this.perfMessages[name];
|
|
651
|
+
if (timestamps === void 0) {
|
|
652
|
+
this.perfMessages[name] = [duration];
|
|
653
|
+
} else {
|
|
654
|
+
this.perfMessages[name].push(duration);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
switch (msg.kind) {
|
|
658
|
+
case "draw":
|
|
659
|
+
this.screen.draw(msg.event);
|
|
660
|
+
debug("draw event", msg.event);
|
|
661
|
+
break;
|
|
662
|
+
case "done":
|
|
663
|
+
this.worker.onEventDone(msg.status);
|
|
664
|
+
break;
|
|
665
|
+
case "evalfunc": {
|
|
666
|
+
const args = msg.argsJson === void 0 ? [] : JSON.parse(msg.argsJson);
|
|
667
|
+
this.evalFunc(msg.body, args, msg.notifyOnly).catch(this.handleError);
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
case "title":
|
|
671
|
+
if (this.onTitleUpdate) {
|
|
672
|
+
debug("title was updated:", msg.title);
|
|
673
|
+
this.onTitleUpdate(msg.title);
|
|
674
|
+
}
|
|
675
|
+
break;
|
|
676
|
+
case "read-clipboard:request":
|
|
677
|
+
if (this.readClipboard) {
|
|
678
|
+
this.readClipboard().then((text) => this.worker.responseClipboardText(text)).catch((err) => {
|
|
679
|
+
debug("Cannot read clipboard:", err);
|
|
680
|
+
this.worker.notifyClipboardError();
|
|
681
|
+
});
|
|
682
|
+
} else {
|
|
683
|
+
debug("Cannot read clipboard because VimWasm.readClipboard is not set");
|
|
684
|
+
this.worker.notifyClipboardError();
|
|
685
|
+
}
|
|
686
|
+
break;
|
|
687
|
+
case "write-clipboard":
|
|
688
|
+
debug("Handle writing text", msg.text, "to clipboard with", this.onWriteClipboard);
|
|
689
|
+
if (this.onWriteClipboard) {
|
|
690
|
+
this.onWriteClipboard(msg.text);
|
|
691
|
+
}
|
|
692
|
+
break;
|
|
693
|
+
case "export":
|
|
694
|
+
if (this.onFileExport !== void 0) {
|
|
695
|
+
debug("Exporting file", msg.path, "with size in bytes", msg.contents.byteLength);
|
|
696
|
+
this.onFileExport(msg.path, msg.contents);
|
|
697
|
+
}
|
|
698
|
+
break;
|
|
699
|
+
case "eval":
|
|
700
|
+
this.evalJS(msg.path, msg.contents).catch(this.handleError);
|
|
701
|
+
break;
|
|
702
|
+
case "started":
|
|
703
|
+
this.screen.onVimInit();
|
|
704
|
+
if (this.onVimInit) {
|
|
705
|
+
this.onVimInit();
|
|
706
|
+
}
|
|
707
|
+
this.perfMeasure("init");
|
|
708
|
+
debug("Vim started");
|
|
709
|
+
break;
|
|
710
|
+
case "exit":
|
|
711
|
+
this.screen.onVimExit();
|
|
712
|
+
this.printPerfs();
|
|
713
|
+
this.worker.terminate();
|
|
714
|
+
if (this.onVimExit) {
|
|
715
|
+
this.onVimExit(msg.status);
|
|
716
|
+
}
|
|
717
|
+
debug("Vim exited with status", msg.status);
|
|
718
|
+
this.perf = false;
|
|
719
|
+
this.debug = false;
|
|
720
|
+
this.screen.setPerf(false);
|
|
721
|
+
this.running = false;
|
|
722
|
+
this.end = true;
|
|
723
|
+
break;
|
|
724
|
+
case "error":
|
|
725
|
+
debug("Vim threw an error:", msg.message);
|
|
726
|
+
this.handleError(new Error(msg.message));
|
|
727
|
+
this.worker.terminate();
|
|
728
|
+
break;
|
|
729
|
+
default:
|
|
730
|
+
throw new Error(`Unexpected message from worker: ${JSON.stringify(msg)}`);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
handleError(err) {
|
|
734
|
+
if (this.onError) {
|
|
735
|
+
this.onError(err);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
printPerfs() {
|
|
739
|
+
if (!this.perf) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
{
|
|
743
|
+
const measurements = /* @__PURE__ */ new Map();
|
|
744
|
+
for (const e of performance.getEntries()) {
|
|
745
|
+
const ms = measurements.get(e.name);
|
|
746
|
+
if (ms === void 0) {
|
|
747
|
+
measurements.set(e.name, [e]);
|
|
748
|
+
} else {
|
|
749
|
+
ms.push(e);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
const averages = {};
|
|
753
|
+
const amounts = {};
|
|
754
|
+
const timings = [];
|
|
755
|
+
for (const [name, ms] of measurements) {
|
|
756
|
+
if (ms.length === 1 && ms[0].entryType !== "measure") {
|
|
757
|
+
timings.push(ms[0]);
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
console.log(`%c${name}`, "color: green; font-size: large");
|
|
761
|
+
console.table(ms, ["duration", "startTime"]);
|
|
762
|
+
const total = ms.reduce((a, m) => a + m.duration, 0);
|
|
763
|
+
averages[name] = total / ms.length;
|
|
764
|
+
amounts[name] = total;
|
|
765
|
+
}
|
|
766
|
+
console.log("%cTimings (ms)", "color: green; font-size: large");
|
|
767
|
+
console.table(timings, ["name", "entryType", "startTime", "duration"]);
|
|
768
|
+
console.log("%cAmount: Perf Mark Durations (ms)", "color: green; font-size: large");
|
|
769
|
+
console.table(amounts);
|
|
770
|
+
console.log("%cAverage: Perf Mark Durations (ms)", "color: green; font-size: large");
|
|
771
|
+
console.table(averages);
|
|
772
|
+
performance.clearMarks();
|
|
773
|
+
performance.clearMeasures();
|
|
774
|
+
}
|
|
775
|
+
{
|
|
776
|
+
const averages = {};
|
|
777
|
+
for (const name of Object.keys(this.perfMessages)) {
|
|
778
|
+
const durations = this.perfMessages[name];
|
|
779
|
+
const total = durations.reduce((a, d) => a + d, 0);
|
|
780
|
+
averages[name] = total / durations.length;
|
|
781
|
+
}
|
|
782
|
+
console.log("%cAverage: Inter-thread Messages Duration (ms)", "color: green; font-size: large");
|
|
783
|
+
console.table(averages);
|
|
784
|
+
this.perfMessages = {};
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
perfMark(m) {
|
|
788
|
+
if (this.perf) {
|
|
789
|
+
performance.mark(m);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
perfMeasure(m) {
|
|
793
|
+
if (this.perf) {
|
|
794
|
+
performance.measure(m, m);
|
|
795
|
+
performance.clearMarks(m);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
__name(_VimWasm, "VimWasm");
|
|
800
|
+
let VimWasm = _VimWasm;
|
|
801
|
+
export {
|
|
802
|
+
InputHandler,
|
|
803
|
+
ResizeHandler,
|
|
804
|
+
ScreenCanvas,
|
|
805
|
+
VimWasm,
|
|
806
|
+
VimWorker,
|
|
807
|
+
checkBrowserCompatibility
|
|
808
|
+
};
|
|
809
|
+
//# sourceMappingURL=vimwasm-DWJK1Y7M.js.map
|