@mudlet/mudlet-web 0.5.0 → 1.0.1
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 +1 -1
- package/dist-lib/analytics.d.ts +27 -0
- package/dist-lib/assets/fonts/Vera.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraBI.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraBd.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraIt.woff2 +0 -0
- package/dist-lib/assets/mapParser.worker-DrVZ3wg_.js +9 -0
- package/dist-lib/backupImport-wt8r7JXI.js +233 -0
- package/dist-lib/branding.d.ts +111 -13
- package/dist-lib/db/sqliteClient.d.ts +195 -7
- package/dist-lib/hooks/useAutoReconnect.d.ts +61 -0
- package/dist-lib/hooks/useDocumentFullscreen.d.ts +23 -0
- package/dist-lib/hooks/useKeyboardShortcuts.d.ts +37 -0
- package/dist-lib/hooks/useRecordLastPlayed.d.ts +10 -0
- package/dist-lib/import/applyMudletProfile.d.ts +35 -9
- package/dist-lib/import/backupImport.d.ts +118 -0
- package/dist-lib/import/collectProfileExport.d.ts +33 -2
- package/dist-lib/import/defaultPackages.d.ts +57 -14
- package/dist-lib/import/defaults/CF-loader/CF-loader.mpackage +0 -0
- package/dist-lib/import/defaults/MedBootstrap/MedBootstrap.mpackage +0 -0
- package/dist-lib/import/defaults/deleteOldProfiles/deleteOldProfiles.mpackage +0 -0
- package/dist-lib/import/defaults/echo/echo.mpackage +0 -0
- package/dist-lib/import/defaults/enable-accessibility/enable-accessibility.mpackage +0 -0
- package/dist-lib/import/defaults/generic_mapper/generic_mapper.mpackage +0 -0
- package/dist-lib/import/defaults/gui-drop/gui-drop.mpackage +0 -0
- package/dist-lib/import/defaults/icesus-loader/icesus-loader.mpackage +0 -0
- package/dist-lib/import/defaults/mg-loader/mg-loader.mpackage +0 -0
- package/dist-lib/import/defaults/mudlet-base-ui/mudlet-base-ui.mpackage +0 -0
- package/dist-lib/import/defaults/mudlet-mapper.xml +1215 -389
- package/dist-lib/import/mudletControlChars.d.ts +14 -0
- package/dist-lib/import/mudletHost.d.ts +73 -10
- package/dist-lib/import/mudletLink.d.ts +53 -2
- package/dist-lib/import/mudletProfileExport.d.ts +38 -5
- package/dist-lib/import/mudletProfileImport.d.ts +110 -12
- package/dist-lib/import/mudletVariables.d.ts +4 -3
- package/dist-lib/import/mudletWriteback.d.ts +15 -1
- package/dist-lib/import/mudletXmlImport.d.ts +46 -0
- package/dist-lib/import/packageFonts.d.ts +33 -0
- package/dist-lib/import/packageInstaller.d.ts +111 -7
- package/dist-lib/import/qtProfileData.d.ts +10 -0
- package/dist-lib/import/remotePackageInstall.d.ts +23 -7
- package/dist-lib/import/zipEntries.d.ts +45 -0
- package/dist-lib/index.d.ts +7 -3
- package/dist-lib/index.js +50508 -29836
- package/dist-lib/logging/SessionLogger.d.ts +75 -15
- package/dist-lib/map/MapSelectionOverlay.d.ts +2 -2
- package/dist-lib/map/MapStore.d.ts +387 -60
- package/dist-lib/map/MudletHighlightOverlay.d.ts +2 -2
- package/dist-lib/map/{MudixMapReader.d.ts → MudletMapReader.d.ts} +2 -2
- package/dist-lib/map/areaGraph.d.ts +120 -0
- package/dist-lib/map/environmentKit.d.ts +36 -0
- package/dist-lib/map/labelPixmap.d.ts +90 -0
- package/dist-lib/map/mapImageExport.d.ts +36 -2
- package/dist-lib/map/mapStyle.d.ts +11 -0
- package/dist-lib/map/mapVersion.d.ts +66 -0
- package/dist-lib/map/pathfinding.d.ts +2 -2
- package/dist-lib/mud/CharLoginController.d.ts +230 -0
- package/dist-lib/mud/ItemIdSequence.d.ts +1 -1
- package/dist-lib/mud/MudSession.d.ts +279 -22
- package/dist-lib/mud/PatternEngine.d.ts +153 -14
- package/dist-lib/mud/aliases/AliasEngine.d.ts +55 -9
- package/dist-lib/mud/autoLogin.d.ts +59 -0
- package/dist-lib/mud/commandSplit.d.ts +9 -0
- package/dist-lib/mud/connection/LineAssembler.d.ts +38 -11
- package/dist-lib/mud/connection/MudClient.d.ts +291 -53
- package/dist-lib/mud/connection/SubnegotiationRepair.d.ts +24 -0
- package/dist-lib/mud/connection/TelnetNegotiator.d.ts +208 -68
- package/dist-lib/mud/connection/telnetDebug.d.ts +8 -8
- package/dist-lib/mud/events.d.ts +102 -23
- package/dist-lib/mud/games/bundledGames.d.ts +12 -7
- package/dist-lib/mud/games/gameLinks.d.ts +40 -0
- package/dist-lib/mud/games/icons/3Kingdoms.png +0 -0
- package/dist-lib/mud/games/icons/3Scapes.png +0 -0
- package/dist-lib/mud/games/icons/achaea.png +0 -0
- package/dist-lib/mud/games/icons/aetolia.png +0 -0
- package/dist-lib/mud/games/icons/banner_astaria.png +0 -0
- package/dist-lib/mud/games/icons/banner_darkmists.png +0 -0
- package/dist-lib/mud/games/icons/banner_dreamland.png +0 -0
- package/dist-lib/mud/games/icons/banner_petria.jpg +0 -0
- package/dist-lib/mud/games/icons/banner_ropmud.png +0 -0
- package/dist-lib/mud/games/icons/blackmud.png +0 -0
- package/dist-lib/mud/games/icons/carrionfields.png +0 -0
- package/dist-lib/mud/games/icons/dragonfire_icon.png +0 -0
- package/dist-lib/mud/games/icons/fed2-logo.png +0 -0
- package/dist-lib/mud/games/icons/icesus_480x120.png +0 -0
- package/dist-lib/mud/games/icons/imperian.png +0 -0
- package/dist-lib/mud/games/icons/infinity_480x120.png +0 -0
- package/dist-lib/mud/games/icons/lusternia.png +0 -0
- package/dist-lib/mud/games/icons/morgengrauen_480x120.png +0 -0
- package/dist-lib/mud/games/icons/mudlet-tutorial.png +0 -0
- package/dist-lib/mud/games/icons/phoenixmud_480x120.png +0 -0
- package/dist-lib/mud/games/icons/starmourn.png +0 -0
- package/dist-lib/mud/games/icons/voidmud_icon.png +0 -0
- package/dist-lib/mud/games/icons/wotmudicon.png +0 -0
- package/dist-lib/mud/games/websiteLinks.d.ts +21 -0
- package/dist-lib/mud/keybindings/KeyEngine.d.ts +110 -4
- package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +2 -2
- package/dist-lib/mud/keybindings/keyEventTarget.d.ts +61 -0
- package/dist-lib/mud/keybindings/qtKeys.d.ts +91 -12
- package/dist-lib/mud/protocol/atcp.d.ts +19 -0
- package/dist-lib/mud/protocol/byteString.d.ts +24 -0
- package/dist-lib/mud/protocol/charLoginFlow.d.ts +243 -16
- package/dist-lib/mud/protocol/charset.d.ts +111 -46
- package/dist-lib/mud/protocol/codePages.d.ts +10 -0
- package/dist-lib/mud/protocol/constants.d.ts +17 -10
- package/dist-lib/mud/protocol/echo.d.ts +23 -27
- package/dist-lib/mud/protocol/gmcp.d.ts +36 -6
- package/dist-lib/mud/protocol/index.d.ts +3 -2
- package/dist-lib/mud/protocol/luaLiteral.d.ts +12 -0
- package/dist-lib/mud/protocol/mccp.d.ts +83 -1
- package/dist-lib/mud/protocol/mnes.d.ts +41 -58
- package/dist-lib/mud/protocol/msdp.d.ts +11 -4
- package/dist-lib/mud/protocol/msp.d.ts +3 -2
- package/dist-lib/mud/protocol/mssp.d.ts +9 -4
- package/dist-lib/mud/protocol/multiByte.d.ts +51 -0
- package/dist-lib/mud/protocol/multiByteEncode.d.ts +42 -0
- package/dist-lib/mud/protocol/mxp.d.ts +193 -14
- package/dist-lib/mud/protocol/oauthClientFlow.d.ts +128 -0
- package/dist-lib/mud/protocol/qtCodePages.generated.d.ts +1 -0
- package/dist-lib/mud/protocol/tlsCodes.d.ts +40 -3
- package/dist-lib/mud/replay/ReplayPlayer.d.ts +16 -1
- package/dist-lib/mud/replay/replayFormat.d.ts +29 -2
- package/dist-lib/mud/text/Console.d.ts +255 -49
- package/dist-lib/mud/text/FormatState.d.ts +137 -14
- package/dist-lib/mud/text/ansiEscapes.d.ts +32 -16
- package/dist-lib/mud/text/colorParsers.d.ts +14 -2
- package/dist-lib/mud/text/colorSpaceId.d.ts +2 -0
- package/dist-lib/mud/text/colors.d.ts +17 -10
- package/dist-lib/mud/text/controlCharacterMode.d.ts +1 -1
- package/dist-lib/mud/text/hyperlinkVisibility.d.ts +1 -1
- package/dist-lib/mud/text/lineBreak.d.ts +5 -0
- package/dist-lib/mud/text/serverWrap.d.ts +2 -2
- package/dist-lib/mud/text/textAnalyzer.d.ts +79 -0
- package/dist-lib/mud/text/unicodeRuns.d.ts +11 -0
- package/dist-lib/mud/text/unicodeTables.generated.d.ts +3 -0
- package/dist-lib/mud/text/wcwidth.d.ts +27 -22
- package/dist-lib/mud/timers/TimerEngine.d.ts +163 -11
- package/dist-lib/mud/timers/workerClock.d.ts +67 -0
- package/dist-lib/mud/triggers/TriggerEngine.d.ts +449 -47
- package/dist-lib/mud/triggers/legacyColorPatterns.d.ts +58 -0
- package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +83 -1
- package/dist-lib/oauth-callback.html +94 -0
- package/dist-lib/pcre2Wasm.d.ts +54 -0
- package/dist-lib/pcre2Wasm.js +241 -0
- package/dist-lib/scripting/EngineHost.d.ts +45 -21
- package/dist-lib/scripting/IScriptingRuntime.d.ts +103 -27
- package/dist-lib/scripting/MxpFrameManager.d.ts +10 -1
- package/dist-lib/scripting/ScriptingAPI.d.ts +1030 -213
- package/dist-lib/scripting/ScriptingEngine.d.ts +727 -106
- package/dist-lib/scripting/StopwatchManager.d.ts +97 -36
- package/dist-lib/scripting/http/HttpService.d.ts +9 -1
- package/dist-lib/scripting/http/userUrl.d.ts +41 -0
- package/dist-lib/scripting/lua/LuaRuntime.d.ts +352 -77
- package/dist-lib/scripting/lua/argContracts.d.ts +71 -0
- package/dist-lib/scripting/lua/bindings/automation.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/commands.d.ts +13 -0
- package/dist-lib/scripting/lua/bindings/context.d.ts +20 -2
- package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/map.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/media.d.ts +2 -2
- package/dist-lib/scripting/lua/bindings/output.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/session.d.ts +2 -2
- package/dist-lib/scripting/lua/bindings/textEdit.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/userWindows.d.ts +1 -1
- package/dist-lib/scripting/lua/byteArmor.d.ts +36 -0
- package/dist-lib/scripting/lua/imageSize.d.ts +7 -0
- package/dist-lib/scripting/lua/rex.d.ts +4 -2
- package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +6 -1
- package/dist-lib/scripting/lua/utf8CaseMap.d.ts +1 -0
- package/dist-lib/scripting/lua/utf8Patterns.d.ts +21 -1
- package/dist-lib/scripting/lua/wellFormedStrings.d.ts +40 -0
- package/dist-lib/scripting/lua/yajl.d.ts +43 -5
- package/dist-lib/scripting/profilesPresence.d.ts +20 -2
- package/dist-lib/scripting/vfs/ProfileVFS.d.ts +164 -10
- package/dist-lib/scripting/vfs/fsErrors.d.ts +28 -0
- package/dist-lib/scripting/vfs/idbCommit.d.ts +20 -0
- package/dist-lib/storage/appStore.d.ts +24 -9
- package/dist-lib/storage/hooks.d.ts +5 -1
- package/dist-lib/storage/index.d.ts +2 -2
- package/dist-lib/storage/mapStorage.d.ts +2 -0
- package/dist-lib/storage/persistentStorage.d.ts +3 -1
- package/dist-lib/storage/profileStorage.d.ts +15 -0
- package/dist-lib/storage/profileVfsData.d.ts +3 -3
- package/dist-lib/storage/schema.d.ts +512 -40
- package/dist-lib/storage/storageMigration.d.ts +82 -0
- package/dist-lib/storage-g5V1b-c1.js +2039 -0
- package/dist-lib/styles.css +1 -1
- package/dist-lib/ui/AboutModal.d.ts +1 -1
- package/dist-lib/ui/BrandLoginFields.d.ts +1 -1
- package/dist-lib/ui/BrowserSignInModal.d.ts +23 -0
- package/dist-lib/ui/CmdLineMenuRegistry.d.ts +14 -5
- package/dist-lib/ui/CommandBar.d.ts +8 -8
- package/dist-lib/ui/ConnectionFormModal.d.ts +20 -1
- package/dist-lib/ui/ConnectionScreen.d.ts +9 -1
- package/dist-lib/ui/GameLinkPrompt.d.ts +28 -0
- package/dist-lib/ui/HelpModal.d.ts +5 -1
- package/dist-lib/ui/MapSymbolUsageModal.d.ts +32 -0
- package/dist-lib/ui/MouseEventRegistry.d.ts +31 -4
- package/dist-lib/ui/NotepadModal.d.ts +22 -0
- package/dist-lib/ui/ResizableModal.d.ts +16 -1
- package/dist-lib/ui/SettingsModal.d.ts +10 -1
- package/dist-lib/ui/TlsAlertBanner.d.ts +3 -1
- package/dist-lib/ui/Toolbar.d.ts +22 -1
- package/dist-lib/ui/VaultManageButton.d.ts +10 -5
- package/dist-lib/ui/VaultModal.d.ts +3 -0
- package/dist-lib/ui/buttons/ButtonsBar.d.ts +3 -1
- package/dist-lib/ui/buttons/inactiveButtons.d.ts +25 -0
- package/dist-lib/ui/cmdline/CommandLineManager.d.ts +19 -0
- package/dist-lib/ui/cmdline/plainText.d.ts +16 -0
- package/dist-lib/ui/cmdline/subCommandLine.d.ts +78 -0
- package/dist-lib/ui/cmdline/useCmdLineSelection.d.ts +26 -0
- package/dist-lib/ui/cmdline/useSubCommandLineKeys.d.ts +33 -0
- package/dist-lib/ui/codemirror/lineParagraphMarks.d.ts +19 -0
- package/dist-lib/ui/codemirror/luaHover.d.ts +7 -0
- package/dist-lib/ui/codemirror/options.d.ts +33 -0
- package/dist-lib/ui/codemirror/theme.d.ts +29 -5
- package/dist-lib/ui/commands/addonCommands.d.ts +134 -0
- package/dist-lib/ui/commands/appShortcuts.d.ts +86 -0
- package/dist-lib/ui/commands/hostCommands.d.ts +88 -0
- package/dist-lib/ui/commands/keyMatch.d.ts +20 -0
- package/dist-lib/ui/commands/keySequence.d.ts +57 -0
- package/dist-lib/ui/components/ContextMenu.d.ts +21 -1
- package/dist-lib/ui/components/FontPicker.d.ts +5 -1
- package/dist-lib/ui/components/useModalFocus.d.ts +13 -1
- package/dist-lib/ui/helpTopics.d.ts +15 -0
- package/dist-lib/ui/labels/LabelManager.d.ts +172 -9
- package/dist-lib/ui/labels/LabelOverlay.d.ts +19 -0
- package/dist-lib/ui/labels/backgroundImageSize.d.ts +19 -0
- package/dist-lib/ui/labels/labelModel.d.ts +64 -0
- package/dist-lib/ui/labels/qColor.d.ts +13 -0
- package/dist-lib/ui/labels/qtCss.d.ts +12 -4
- package/dist-lib/ui/landmarks.d.ts +9 -0
- package/dist-lib/ui/launcher/ActionMenu.d.ts +19 -0
- package/dist-lib/ui/launcher/GameDetails.d.ts +21 -0
- package/dist-lib/ui/launcher/GameSection.d.ts +18 -0
- package/dist-lib/ui/launcher/LauncherSearch.d.ts +23 -0
- package/dist-lib/ui/launcher/ProfileArt.d.ts +20 -0
- package/dist-lib/ui/launcher/ProfileSection.d.ts +43 -0
- package/dist-lib/ui/launcher/launcherModel.d.ts +72 -0
- package/dist-lib/ui/layout/overlayLayerOrder.d.ts +2 -2
- package/dist-lib/ui/menu/MenuBar.d.ts +31 -0
- package/dist-lib/ui/menu/SplitButton.d.ts +39 -0
- package/dist-lib/ui/menu/anchoredPopup.d.ts +74 -0
- package/dist-lib/ui/menu/appMenus.d.ts +65 -0
- package/dist-lib/ui/menu/menuModel.d.ts +88 -0
- package/dist-lib/ui/menu/toolbarModel.d.ts +56 -0
- package/dist-lib/ui/notepad.d.ts +76 -0
- package/dist-lib/ui/openSignInPage.d.ts +14 -0
- package/dist-lib/ui/output/OutputContextMenu.d.ts +14 -1
- package/dist-lib/ui/output/OutputRenderer.d.ts +5 -0
- package/dist-lib/ui/output/OutputSearchBar.d.ts +5 -1
- package/dist-lib/ui/output/StickyOutputPanel.d.ts +17 -3
- package/dist-lib/ui/output/TextAnalyzerModal.d.ts +25 -0
- package/dist-lib/ui/output/caretMode.d.ts +3 -2
- package/dist-lib/ui/output/clearSplit.d.ts +11 -0
- package/dist-lib/ui/output/outputCopy.d.ts +41 -2
- package/dist-lib/ui/output/outputRows.d.ts +43 -0
- package/dist-lib/ui/output/selectionGesture.d.ts +35 -0
- package/dist-lib/ui/output/wordSelection.d.ts +33 -0
- package/dist-lib/ui/search/matcher.d.ts +14 -4
- package/dist-lib/ui/settings/SettingsShell.d.ts +91 -0
- package/dist-lib/ui/settings/ShortcutEditor.d.ts +13 -0
- package/dist-lib/ui/sound/SoundManager.d.ts +210 -44
- package/dist-lib/ui/sound/closedCaption.d.ts +4 -1
- package/dist-lib/ui/sound/mediaDirection.d.ts +35 -0
- package/dist-lib/ui/tabCompletion.d.ts +53 -0
- package/dist-lib/ui/textedit/TextEditManager.d.ts +11 -2
- package/dist-lib/ui/useOpenProfiles.d.ts +1 -1
- package/dist-lib/ui/video/VideoManager.d.ts +7 -0
- package/dist-lib/ui/windows/WindowManager.d.ts +452 -37
- package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +14 -0
- package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +6 -1
- package/dist-lib/ui/windows/panels/TextPanel.d.ts +4 -1
- package/dist-lib/ui/windows/panels/VariablesView.d.ts +37 -7
- package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +4 -2
- package/dist-lib/ui/windows/panels/aliasLoop.d.ts +24 -0
- package/dist-lib/ui/windows/panels/editorClipboard.d.ts +45 -0
- package/dist-lib/ui/windows/panels/editorUndo.d.ts +79 -0
- package/dist-lib/ui/windows/panels/mapAreaChange.d.ts +10 -0
- package/dist-lib/utils/appShellCache.d.ts +25 -0
- package/dist-lib/utils/fontFamilyName.d.ts +13 -0
- package/dist-lib/utils/fontLoader.d.ts +31 -0
- package/dist-lib/utils/formatBytes.d.ts +4 -0
- package/dist-lib/utils/mustBeOneOf.d.ts +9 -0
- package/dist-lib/utils/profileLock.d.ts +1 -1
- package/dist-lib/utils/systemTheme.d.ts +24 -0
- package/dist-lib/utils/timeZone.d.ts +10 -0
- package/dist-lib/vault/CredentialVault.d.ts +51 -5
- package/dist-lib/vault/deviceUnlock.d.ts +47 -0
- package/dist-lib/vault/vaultAccess.d.ts +24 -2
- package/dist-lib/vault/vaultHelpTopic.d.ts +9 -0
- package/dist-lib/vault/vaultRecord.d.ts +33 -1
- package/dist-lib/vfs-sw.js +220 -11
- package/dist-lib/vite.d.ts +1 -1
- package/dist-lib/vite.js +66 -43
- package/package.json +23 -15
- package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +0 -9
- package/dist-lib/mud/connection/PingTracker.d.ts +0 -41
- package/dist-lib/ui/BundledGameGrid.d.ts +0 -21
- package/dist-lib/ui/ConnectionGrid.d.ts +0 -21
- package/dist-lib/ui/bufferWords.d.ts +0 -38
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { ItemIdSequence } from '../ItemIdSequence';
|
|
2
2
|
import type { TimerNode } from '../../storage/schema';
|
|
3
|
+
import { type Clock } from './workerClock';
|
|
3
4
|
export type { TimerNode };
|
|
4
5
|
type TempFn = () => void;
|
|
5
6
|
type ExecuteFn = (timer: TimerNode) => void;
|
|
7
|
+
/** A permanent timer list indexed the ways the engine walks it. */
|
|
8
|
+
interface PermTree {
|
|
9
|
+
timers: TimerNode[];
|
|
10
|
+
byId: Map<string, TimerNode>;
|
|
11
|
+
children: Map<string, TimerNode[]>;
|
|
12
|
+
/** Ids switched on along with every ancestor (canBeUnlocked). */
|
|
13
|
+
enabledIds: Set<string>;
|
|
14
|
+
/** A timer nested under another *timer* rather than a folder (TTimer.h). */
|
|
15
|
+
isOffset: (t: TimerNode) => boolean;
|
|
16
|
+
}
|
|
6
17
|
export declare class TimerEngine {
|
|
18
|
+
private readonly clock;
|
|
7
19
|
private readonly temp;
|
|
8
20
|
/** Permanent timers keyed by stored TimerNode id (uuid). Two timers can
|
|
9
21
|
* share a name; we keep id as the canonical handle and build a separate
|
|
@@ -18,11 +30,30 @@ export declare class TimerEngine {
|
|
|
18
30
|
private readonly knownPermNames;
|
|
19
31
|
/** Shared with every other engine in the profile — see ItemIdSequence. */
|
|
20
32
|
private idSeq;
|
|
33
|
+
/** Temp timer bodies on the stack (a body can pump others via waitForEvent).
|
|
34
|
+
* Killed timers are reaped when the outermost one returns — TimerUnit's
|
|
35
|
+
* mProcessingDepth / doCleanup. */
|
|
36
|
+
private firingDepth;
|
|
21
37
|
setIdSequence(seq: ItemIdSequence): void;
|
|
38
|
+
/** Every timeout is armed on `clock`, which keeps time in a worker so a
|
|
39
|
+
* hidden tab doesn't throttle the timers (see workerClock). */
|
|
40
|
+
constructor(clock?: Clock);
|
|
22
41
|
/** Number of live session-scoped temp timers (Mudlet `getProfileStats` temp
|
|
23
42
|
* count). Killed-but-unreaped timers are not live and don't count. */
|
|
24
43
|
get tempCount(): number;
|
|
25
44
|
addTemp(seconds: number, fn: TempFn, repeat?: boolean): number;
|
|
45
|
+
/**
|
|
46
|
+
* After a repeating timer's body returns: if the body ran so long that the
|
|
47
|
+
* tick armed before it is already due, push that tick a full interval past
|
|
48
|
+
* now. Desktop's next tick comes at least one interval after a slow body
|
|
49
|
+
* returns (mudlet-web#293: a 0.2s timer whose body takes 0.5s fires at 0.2
|
|
50
|
+
* then 0.9, not 0.7), so a late tick must not fire the moment the body
|
|
51
|
+
* ends. Only the timer's *own* slow body does this — a tick held up by
|
|
52
|
+
* some other timer's body is re-armed from when it actually fired, which
|
|
53
|
+
* already is "now". The entry is looked up afresh: a body that killed,
|
|
54
|
+
* disabled or re-armed its own timer left nothing overdue to move.
|
|
55
|
+
*/
|
|
56
|
+
private rearmIfOverdue;
|
|
26
57
|
/**
|
|
27
58
|
* Fire every timer that has come due, without waiting for the event loop to
|
|
28
59
|
* deliver its setTimeout.
|
|
@@ -35,31 +66,55 @@ export declare class TimerEngine {
|
|
|
35
66
|
*
|
|
36
67
|
* Repeating timers are pumped too — Mudlet's own specs wait on a repeat
|
|
37
68
|
* tick, so skipping them made every such wait time out. That works because
|
|
38
|
-
* a repeat is a self-rescheduling setTimeout (see addTemp): the pending
|
|
69
|
+
* a repeat is a self-rescheduling setTimeout (see addTemp, startPerm): the pending
|
|
39
70
|
* tick is cancelled and re-armed rather than left to land a second time.
|
|
40
71
|
*
|
|
41
72
|
* Returns the number of timers fired.
|
|
42
73
|
*/
|
|
43
74
|
pumpDue(now?: number): number;
|
|
44
75
|
/**
|
|
45
|
-
* Whether a temporary timer with this id is still present.
|
|
76
|
+
* Whether a temporary timer with this id is still present — killed or not.
|
|
77
|
+
* Temp timers aren't in the store: this map is the temporary half of the
|
|
78
|
+
* one timer tree (exists() asks {@link hasLiveTemp}, which skips a killed
|
|
79
|
+
* one).
|
|
46
80
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* so this map is the only thing that knows.
|
|
50
|
-
*
|
|
51
|
-
* There is no enable/disable for a temporary timer, so this used to answer
|
|
52
|
-
* `isActive` too. A killed one splits the two apart: it is still present
|
|
53
|
-
* here until the reap, but no longer running — see {@link tempIsActive}.
|
|
81
|
+
* Present is not running: a killed timer stays here until the reap, and a
|
|
82
|
+
* disabled one until it is killed — see {@link tempIsActive}.
|
|
54
83
|
*/
|
|
55
84
|
hasTemp(id: number): boolean;
|
|
56
85
|
/** Whether a temporary timer is present *and* still running — `isActive(id,
|
|
57
86
|
* "timer")`. False for one killed since the last reap. */
|
|
58
87
|
tempIsActive(id: number): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Mudlet `enableTimer(id)` / `disableTimer(id)` on a temporary timer. Mudlet
|
|
90
|
+
* names a temp timer by the id tempTimer returned, so its name-based toggles
|
|
91
|
+
* reach temp timers too. Disabling stops the pending tick; enabling re-arms
|
|
92
|
+
* it for a full interval, as Mudlet restarts the QTimer. Returns false for
|
|
93
|
+
* an unknown or killed timer.
|
|
94
|
+
*/
|
|
95
|
+
setTempEnabled(id: number, enabled: boolean): boolean;
|
|
59
96
|
killTimer(id: number): boolean;
|
|
60
97
|
/** Free every timer killed since the last call. Runs once per processed line
|
|
61
|
-
* batch
|
|
98
|
+
* batch and after each outermost temp timer body, mirroring the deferred
|
|
99
|
+
* cleanup Mudlet's TimerUnit does (Host::incomingStreamProcessor and
|
|
100
|
+
* TimerUnit::timerFired). */
|
|
62
101
|
reapKilled(): void;
|
|
102
|
+
/** Temp parent refs some permanent timer hangs off, as of the last loadPerm. */
|
|
103
|
+
private tempParentRefs;
|
|
104
|
+
private orphanedParents;
|
|
105
|
+
private onOrphans;
|
|
106
|
+
/** Tree keys of freed temp timers that had permanent children, since the
|
|
107
|
+
* last call. Their owner removes those subtrees from the store. */
|
|
108
|
+
takeOrphanedParents(): string[];
|
|
109
|
+
/** Told when {@link takeOrphanedParents} has something to hand over. */
|
|
110
|
+
setOrphanListener(fn: (() => void) | null): void;
|
|
111
|
+
/** Live temp timer ids, ascending, whose name — the id itself — passes `test`. */
|
|
112
|
+
liveTempIds(test: (name: string) => boolean): number[];
|
|
113
|
+
/** Whether a temp timer is present and not killed — what exists() counts. */
|
|
114
|
+
hasLiveTemp(id: number): boolean;
|
|
115
|
+
/** The executeFn the last loadPerm was given, for a timer started from
|
|
116
|
+
* outside it (an offset timer under a temporary parent, see switchOne). */
|
|
117
|
+
private executeFn;
|
|
63
118
|
/**
|
|
64
119
|
* Cached previous load. `nodes` is the TimerNode keyed by id, `desc` is the
|
|
65
120
|
* shape that determines whether the running setTimeout/setInterval is still
|
|
@@ -70,7 +125,104 @@ export declare class TimerEngine {
|
|
|
70
125
|
*/
|
|
71
126
|
private readonly prevDesc;
|
|
72
127
|
private descOf;
|
|
73
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Offset timers keyed by the id of the timer they hang off. In Mudlet a
|
|
130
|
+
* timer nested under another *timer* (not a folder) is an offset timer
|
|
131
|
+
* purely by where it sits (TTimer.h:75-84): it never runs on its own clock
|
|
132
|
+
* and is skipped by the normal start walk (TTimer.cpp:314, :329). Each time
|
|
133
|
+
* its parent fires it is started once, due its own interval later
|
|
134
|
+
* (TTimer.cpp:255-265). Rebuilt on every {@link loadPerm}; only holds
|
|
135
|
+
* children that are effectively enabled.
|
|
136
|
+
*/
|
|
137
|
+
private readonly offsetChildren;
|
|
138
|
+
/**
|
|
139
|
+
* Permanent timers whose *runtime* active flag is up — TTimer's `mActive`
|
|
140
|
+
* (Tree.h), kept apart from the user's switch (`enabled`, Mudlet's
|
|
141
|
+
* `mUserActiveState`). The two disagree in exactly the cases `isActive`
|
|
142
|
+
* can see: a timer imported enabled under a disabled folder is left
|
|
143
|
+
* inactive, while an explicit `enableTimer()` on it raises the flag even
|
|
144
|
+
* though a disabled ancestor keeps it from running. Only non-offset timers
|
|
145
|
+
* are tracked; Mudlet reports an offset timer by its switch alone.
|
|
146
|
+
* See {@link applyPermSwitch} for the transitions and {@link loadPerm} for
|
|
147
|
+
* how the flag is seeded.
|
|
148
|
+
*/
|
|
149
|
+
private readonly activePerm;
|
|
150
|
+
/** Each permanent timer's switch and parent as of the last
|
|
151
|
+
* {@link loadPerm}, so the next one can tell a switch flipped behind the
|
|
152
|
+
* engine's back (the editor) from one that never moved. */
|
|
153
|
+
private readonly seenPerm;
|
|
154
|
+
/**
|
|
155
|
+
* Permanent timers whose code will not compile. Mudlet's `activate()`
|
|
156
|
+
* refuses them (`Tree::canBeActivated` wants `state()`), so such a timer
|
|
157
|
+
* neither runs nor reports active, whatever its switch says, and never
|
|
158
|
+
* fires to arm its offset children. Unlike a trigger's, the gate is the
|
|
159
|
+
* timer's own: a folder's other timers run on their own clocks, and
|
|
160
|
+
* `canBeUnlocked` asks only the ancestors' switches.
|
|
161
|
+
*/
|
|
162
|
+
private broken;
|
|
163
|
+
loadPerm(timers: TimerNode[], executeFn: ExecuteFn, broken?: ReadonlySet<string>): void;
|
|
164
|
+
/**
|
|
165
|
+
* Raise the runtime active flags of a profile's permanent timers as its
|
|
166
|
+
* load leaves them, without arming anything yet. Desktop builds and
|
|
167
|
+
* activates the timers from the profile XML before any script compiles,
|
|
168
|
+
* so a script body that runs at load already sees them active, and an
|
|
169
|
+
* enableTimer/disableTimer it calls is a transition from that state rather
|
|
170
|
+
* than from "never seen" — which left every other timer reporting inactive
|
|
171
|
+
* for good. {@link loadPerm} arms them afterwards.
|
|
172
|
+
*/
|
|
173
|
+
seedPerm(timers: TimerNode[]): void;
|
|
174
|
+
/**
|
|
175
|
+
* Bring the runtime active flags in line with a new node list.
|
|
176
|
+
*
|
|
177
|
+
* - A timer seen for the first time is set as Mudlet's loader leaves it:
|
|
178
|
+
* XMLimport::readTimer only activates a root that is switched on, and
|
|
179
|
+
* TTimer::enableTimer(int) carries that down through folders to each
|
|
180
|
+
* child whose whole ancestry is switched on (canBeUnlocked). So it is
|
|
181
|
+
* active exactly when effectively enabled. A flag an explicit
|
|
182
|
+
* {@link applyPermSwitch} raised before this first sight is kept, as
|
|
183
|
+
* long as the timer is still switched on.
|
|
184
|
+
* - A timer that moved to another parent is re-seeded the same way,
|
|
185
|
+
* strictly: TimerUnit::reParentTimer disables it and re-enables it by id,
|
|
186
|
+
* which only activates it if it can be unlocked where it now sits.
|
|
187
|
+
* - A timer whose switch flipped without going through enable/disableTimer
|
|
188
|
+
* (the editor's checkbox) gets the same transition those would apply.
|
|
189
|
+
*/
|
|
190
|
+
private reconcileActive;
|
|
191
|
+
/**
|
|
192
|
+
* Mudlet `enableTimer(name)` / `disableTimer(name)` on permanent timers, as
|
|
193
|
+
* far as the runtime active flag goes (TimerUnit::enableTimer/disableTimer).
|
|
194
|
+
* `timers` is the node list *after* the switches were written. Applied even
|
|
195
|
+
* when a switch did not move: enabling an already switched-on timer under a
|
|
196
|
+
* disabled folder still raises its flag, and disabling an already
|
|
197
|
+
* switched-off folder still lowers the flags beneath it.
|
|
198
|
+
*/
|
|
199
|
+
applyPermSwitch(ids: readonly string[], on: boolean, timers: TimerNode[]): void;
|
|
200
|
+
private switchOne;
|
|
201
|
+
/**
|
|
202
|
+
* What Mudlet's `isActive(name, "timer" [, checkAncestors])` reports for a
|
|
203
|
+
* permanent timer: an offset timer by its switch (shouldBeActive), any
|
|
204
|
+
* other by its runtime flag (TTimer::isActive). With `checkAncestors`, every
|
|
205
|
+
* ancestor has to report active by the same rule (shouldAncestorsBeActive).
|
|
206
|
+
*/
|
|
207
|
+
permReportsActive(node: TimerNode, timers: TimerNode[], checkAncestors?: boolean): boolean;
|
|
208
|
+
/** Mudlet `isAncestorsActive(id, "timer")`: every ancestor reports active,
|
|
209
|
+
* by the rule {@link permReportsActive} uses. */
|
|
210
|
+
permAncestorsActive(node: TimerNode, timers: TimerNode[], tree?: PermTree): boolean;
|
|
211
|
+
/** How many non-folder permanent timers report active — the timer half of
|
|
212
|
+
* getProfileStats' active count, by the rule {@link permReportsActive} uses. */
|
|
213
|
+
countPermActive(timers: TimerNode[]): number;
|
|
214
|
+
private reportsActive;
|
|
215
|
+
/** Start a permanent offset timer once, as enabling it does — see
|
|
216
|
+
* switchOne. Not while it or an ancestor is switched off, or a temporary
|
|
217
|
+
* parent is killed (canBeUnlocked asks the parents too), and not one
|
|
218
|
+
* without a script: TTimer::enableTimer keeps a command-only offset timer
|
|
219
|
+
* to its parent's firing, which would otherwise give it a schedule of its
|
|
220
|
+
* own. */
|
|
221
|
+
private startOffsetOnce;
|
|
222
|
+
/** (Re)start every enabled offset timer hanging off `parentId`, each due
|
|
223
|
+
* its own interval from now. A child still pending from the previous
|
|
224
|
+
* parent tick is restarted, as QTimer::start does on a running timer. */
|
|
225
|
+
private armOffsetChildren;
|
|
74
226
|
private startPerm;
|
|
75
227
|
private killPermHandle;
|
|
76
228
|
/**
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A setTimeout/clearTimeout pair whose clock runs in a dedicated Worker.
|
|
3
|
+
*
|
|
4
|
+
* Chrome throttles main-thread timer chains in a hidden tab — to one wake-up a
|
|
5
|
+
* second at once, and after five minutes hidden to one a *minute* (intensive
|
|
6
|
+
* throttling). Every Lua timer is such a chain (a repeat re-arms itself from
|
|
7
|
+
* its own callback, see TimerEngine.addTemp), so a background tab ran a 1s
|
|
8
|
+
* repeat once a minute while desktop Mudlet keeps exact time (mudlet-web#441).
|
|
9
|
+
* Dedicated-worker timers are exempt from both, so the worker keeps the time
|
|
10
|
+
* and posts each due id back; the callback itself still runs on the main
|
|
11
|
+
* thread, where Lua lives. Message delivery to a hidden page isn't throttled.
|
|
12
|
+
*
|
|
13
|
+
* Ordering is the same as plain setTimeout: the worker receives sets in the
|
|
14
|
+
* order they were made, and its timers fire — and post — in due order.
|
|
15
|
+
*
|
|
16
|
+
* The worker is an inline Blob, not a `new URL('./x.worker.ts', import.meta.url)`
|
|
17
|
+
* chunk: a dozen lines need no bundling, and a Blob works the same in the app
|
|
18
|
+
* build, the library build and a consumer's bundler. Where there is no Worker
|
|
19
|
+
* (tests, happy-dom, node) or one can't be started (a CSP without `worker-src
|
|
20
|
+
* blob:`), the clock falls back to the global setTimeout — looked up at each
|
|
21
|
+
* call, so vitest's fake timers still drive it.
|
|
22
|
+
*/
|
|
23
|
+
export type ClockHandle = number;
|
|
24
|
+
export interface Clock {
|
|
25
|
+
setTimeout(fn: () => void, ms: number): ClockHandle;
|
|
26
|
+
clearTimeout(handle: ClockHandle | null | undefined): void;
|
|
27
|
+
}
|
|
28
|
+
/** The minimal Worker surface the clock uses — what tests fake. */
|
|
29
|
+
export interface ClockWorker {
|
|
30
|
+
postMessage(msg: ClockWorkerRequest): void;
|
|
31
|
+
addEventListener(type: 'message', fn: (e: {
|
|
32
|
+
data: unknown;
|
|
33
|
+
}) => void): void;
|
|
34
|
+
addEventListener(type: 'error', fn: () => void): void;
|
|
35
|
+
terminate(): void;
|
|
36
|
+
}
|
|
37
|
+
export type ClockWorkerRequest = {
|
|
38
|
+
op: 'set';
|
|
39
|
+
id: number;
|
|
40
|
+
ms: number;
|
|
41
|
+
} | {
|
|
42
|
+
op: 'clear';
|
|
43
|
+
id: number;
|
|
44
|
+
};
|
|
45
|
+
/** Start the inline clock worker, or null where workers aren't available. */
|
|
46
|
+
export declare function createBlobClockWorker(): ClockWorker | null;
|
|
47
|
+
export declare class WorkerClock implements Clock {
|
|
48
|
+
private readonly createWorker;
|
|
49
|
+
/** undefined until first use; null once it is known there is none. */
|
|
50
|
+
private worker;
|
|
51
|
+
private nextId;
|
|
52
|
+
private readonly pending;
|
|
53
|
+
constructor(createWorker?: () => ClockWorker | null);
|
|
54
|
+
setTimeout(fn: () => void, ms: number): ClockHandle;
|
|
55
|
+
clearTimeout(handle: ClockHandle | null | undefined): void;
|
|
56
|
+
/** Whether the clock is running on a worker (false before first use). */
|
|
57
|
+
get usingWorker(): boolean;
|
|
58
|
+
private ensureWorker;
|
|
59
|
+
private onTick;
|
|
60
|
+
/** The worker failed to start (a CSP blocking blob: workers reports it this
|
|
61
|
+
* way): move every timeout it held onto the main thread, keeping its due
|
|
62
|
+
* time, and use the main thread from now on. */
|
|
63
|
+
private fallBack;
|
|
64
|
+
private armNative;
|
|
65
|
+
}
|
|
66
|
+
/** The clock every Lua timer and the line assembler's idle flushes share. */
|
|
67
|
+
export declare const workerClock: Clock;
|