@egret/runtime 0.0.0-stage → 7.0.1-rc.3
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/LICENSE +201 -0
- package/NOTICE +21 -0
- package/README.md +70 -2
- package/README.zh-CN.md +71 -0
- package/dist/AssetLease.d.ts +23 -0
- package/dist/AssetLease.js +69 -0
- package/dist/AssetManager.d.ts +56 -0
- package/dist/AssetManager.js +451 -0
- package/dist/AssetRef.d.ts +20 -0
- package/dist/AssetRef.js +32 -0
- package/dist/Bitmap.d.ts +40 -0
- package/dist/Bitmap.js +545 -0
- package/dist/ByteReader.d.ts +30 -0
- package/dist/ByteReader.js +177 -0
- package/dist/ByteWriter.d.ts +29 -0
- package/dist/ByteWriter.js +180 -0
- package/dist/CancellationController.d.ts +10 -0
- package/dist/CancellationController.js +66 -0
- package/dist/DisplayObject.d.ts +89 -0
- package/dist/DisplayObject.js +340 -0
- package/dist/DisplayObjectContainer.d.ts +28 -0
- package/dist/DisplayObjectContainer.js +226 -0
- package/dist/EgretError.d.ts +11 -0
- package/dist/EgretError.js +36 -0
- package/dist/Event.d.ts +45 -0
- package/dist/Event.js +84 -0
- package/dist/EventDispatcher.d.ts +24 -0
- package/dist/EventDispatcher.js +178 -0
- package/dist/Graphics.d.ts +106 -0
- package/dist/Graphics.js +504 -0
- package/dist/Mesh2D.d.ts +27 -0
- package/dist/Mesh2D.js +200 -0
- package/dist/NineSliceBitmap.d.ts +24 -0
- package/dist/NineSliceBitmap.js +164 -0
- package/dist/NineSliceGeometry2D.d.ts +18 -0
- package/dist/NineSliceGeometry2D.js +126 -0
- package/dist/Scope.d.ts +18 -0
- package/dist/Scope.js +133 -0
- package/dist/SequencePlayer.d.ts +12 -0
- package/dist/SequencePlayer.js +69 -0
- package/dist/Sprite.d.ts +8 -0
- package/dist/Sprite.js +12 -0
- package/dist/Stage.d.ts +14 -0
- package/dist/Stage.js +31 -0
- package/dist/Texture.d.ts +29 -0
- package/dist/Texture.js +177 -0
- package/dist/assetManagerOwnerState.d.ts +36 -0
- package/dist/assetManagerOwnerState.js +115 -0
- package/dist/assetState.d.ts +44 -0
- package/dist/assetState.js +2 -0
- package/dist/atlasFrameLayout.d.ts +21 -0
- package/dist/atlasFrameLayout.js +48 -0
- package/dist/bitmapDisplayState.d.ts +24 -0
- package/dist/bitmapDisplayState.js +22 -0
- package/dist/coordinateInverse.d.ts +4 -0
- package/dist/coordinateInverse.js +107 -0
- package/dist/diagnostics.d.ts +4 -0
- package/dist/diagnostics.js +13 -0
- package/dist/displayBounds.d.ts +9 -0
- package/dist/displayBounds.js +181 -0
- package/dist/displayCoordinates.d.ts +8 -0
- package/dist/displayCoordinates.js +81 -0
- package/dist/displayHitState.d.ts +18 -0
- package/dist/displayHitState.js +97 -0
- package/dist/displayHitTest.d.ts +8 -0
- package/dist/displayHitTest.js +219 -0
- package/dist/displayInputOperations.d.ts +12 -0
- package/dist/displayInputOperations.js +71 -0
- package/dist/displayTransform.d.ts +5 -0
- package/dist/displayTransform.js +38 -0
- package/dist/displayTreeState.d.ts +90 -0
- package/dist/displayTreeState.js +450 -0
- package/dist/displayVisualState.d.ts +74 -0
- package/dist/displayVisualState.js +140 -0
- package/dist/errorHelp.d.ts +14 -0
- package/dist/errorHelp.js +432 -0
- package/dist/errorHelpZh.d.ts +5 -0
- package/dist/errorHelpZh.js +340 -0
- package/dist/graphicsFill.d.ts +37 -0
- package/dist/graphicsFill.js +302 -0
- package/dist/graphicsShape.d.ts +144 -0
- package/dist/graphicsShape.js +755 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +28 -0
- package/dist/input/PointerRouter.d.ts +4 -0
- package/dist/input/PointerRouter.js +453 -0
- package/dist/input/index.d.ts +3 -0
- package/dist/input/index.js +3 -0
- package/dist/input/types.d.ts +58 -0
- package/dist/input/types.js +3 -0
- package/dist/meshCaptureSnapshot.d.ts +5 -0
- package/dist/meshCaptureSnapshot.js +13 -0
- package/dist/meshDisplayState.d.ts +18 -0
- package/dist/meshDisplayState.js +21 -0
- package/dist/ownership.d.ts +75 -0
- package/dist/ownership.js +157 -0
- package/dist/paragraph/Paragraph.d.ts +13 -0
- package/dist/paragraph/Paragraph.js +193 -0
- package/dist/paragraph/ParagraphCache.d.ts +5 -0
- package/dist/paragraph/ParagraphCache.js +354 -0
- package/dist/paragraph/geometry.d.ts +4 -0
- package/dist/paragraph/geometry.js +180 -0
- package/dist/paragraph/index.d.ts +3 -0
- package/dist/paragraph/index.js +3 -0
- package/dist/paragraph/request.d.ts +6 -0
- package/dist/paragraph/request.js +191 -0
- package/dist/paragraph/types.d.ts +183 -0
- package/dist/paragraph/types.js +2 -0
- package/dist/preparedDisplaySubtree.d.ts +7 -0
- package/dist/preparedDisplaySubtree.js +205 -0
- package/dist/renderEffect.d.ts +47 -0
- package/dist/renderEffect.js +87 -0
- package/dist/sequenceClip.d.ts +42 -0
- package/dist/sequenceClip.js +196 -0
- package/dist/sharedFrameCapture.d.ts +24 -0
- package/dist/sharedFrameCapture.js +1069 -0
- package/dist/spriteSheet.d.ts +34 -0
- package/dist/spriteSheet.js +321 -0
- package/dist/srgbBytes.d.ts +3 -0
- package/dist/srgbBytes.js +64 -0
- package/dist/text/TextField.d.ts +13 -0
- package/dist/text/TextField.js +261 -0
- package/dist/text/TextRasterCache.d.ts +5 -0
- package/dist/text/TextRasterCache.js +1191 -0
- package/dist/text/budget.d.ts +51 -0
- package/dist/text/budget.js +116 -0
- package/dist/text/index.d.ts +4 -0
- package/dist/text/index.js +3 -0
- package/dist/text/plan.d.ts +16 -0
- package/dist/text/plan.js +238 -0
- package/dist/text/request.d.ts +44 -0
- package/dist/text/request.js +303 -0
- package/dist/text/types.d.ts +179 -0
- package/dist/text/types.js +2 -0
- package/dist/textDisplayState.d.ts +21 -0
- package/dist/textDisplayState.js +27 -0
- package/dist/ui/displayCommit.d.ts +43 -0
- package/dist/ui/displayCommit.js +376 -0
- package/dist/ui/editing.d.ts +3 -0
- package/dist/ui/editing.js +3 -0
- package/dist/ui/heightIndex.d.ts +35 -0
- package/dist/ui/heightIndex.js +295 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.js +6 -0
- package/dist/ui/layout.d.ts +9 -0
- package/dist/ui/layout.js +349 -0
- package/dist/ui/managedState.d.ts +12 -0
- package/dist/ui/managedState.js +44 -0
- package/dist/ui/textEditState.d.ts +4 -0
- package/dist/ui/textEditState.js +206 -0
- package/dist/ui/textEditTypes.d.ts +48 -0
- package/dist/ui/textEditTypes.js +2 -0
- package/dist/ui/types.d.ts +99 -0
- package/dist/ui/types.js +2 -0
- package/package.json +44 -4
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// A sentence for an error code. A code is an area and what went wrong there, both spelled in capitals: the area is
|
|
3
|
+
// read from the longest name the code begins with, and what went wrong from the longest ending it has. The codes a
|
|
4
|
+
// game meets most have a sentence of their own, which also says what to do.
|
|
5
|
+
/** The areas, longest names first where one begins with another. */
|
|
6
|
+
const AREAS = [
|
|
7
|
+
['ANIMATION', 'the animation coordinator'],
|
|
8
|
+
['ASSET_BUNDLE', 'an asset bundle'],
|
|
9
|
+
['ASSET_GROUP', 'an asset group'],
|
|
10
|
+
['ASSET_LEASE', 'an asset lease'],
|
|
11
|
+
['ASSET_MANAGER', 'the asset manager'],
|
|
12
|
+
['ASSET_PROVIDER', 'an asset provider'],
|
|
13
|
+
['ASSET', 'the asset manager'],
|
|
14
|
+
['AUDIO_CUES', 'the sound cues'],
|
|
15
|
+
['AUDIO_WAV', 'the WAV encoder'],
|
|
16
|
+
['AUDIO', 'the audio mixer'],
|
|
17
|
+
['BITMAP_BINDING', 'a bitmap binding'],
|
|
18
|
+
['BITMAP_BUTTON', 'a bitmap button'],
|
|
19
|
+
['BITMAP_FONT', 'a bitmap font'],
|
|
20
|
+
['BITMAP_RESOURCE', 'a bitmap resource slot'],
|
|
21
|
+
['BITMAP_TEXT', 'bitmap text'],
|
|
22
|
+
['BITMAP', 'a bitmap'],
|
|
23
|
+
['BOUNDS', 'a bounds query'],
|
|
24
|
+
['BROWSER_GAME', 'the browser game'],
|
|
25
|
+
['BROWSER_IMAGE', 'the browser image reader'],
|
|
26
|
+
['BROWSER_STATS', 'the stats panel'],
|
|
27
|
+
['BROWSER_STORAGE', 'the browser storage'],
|
|
28
|
+
['BROWSER_TEXT_EDITOR', 'the browser text editor'],
|
|
29
|
+
['BROWSER_TEXT_INPUT', 'the browser text input'],
|
|
30
|
+
['CAMERA', 'the camera'],
|
|
31
|
+
['CLOCK', 'the game clock'],
|
|
32
|
+
['CONTENT_GROUP', 'a content group'],
|
|
33
|
+
['CONTENT_LOADER', 'a content loader'],
|
|
34
|
+
['CONTENT', 'content loading'],
|
|
35
|
+
['COORDINATE', 'a coordinate query'],
|
|
36
|
+
['DISPLAY_EFFECT', 'a render effect'],
|
|
37
|
+
['DISPLAY_SUBTREE', 'a prepared display subtree'],
|
|
38
|
+
['DISPLAY_TREE', 'the display tree'],
|
|
39
|
+
['DISPLAY', 'a display object'],
|
|
40
|
+
['ENGINE', 'the Engine'],
|
|
41
|
+
['EVENT', 'an event'],
|
|
42
|
+
['FONT_CONTENT', 'font content'],
|
|
43
|
+
['FRAME_LOOP', 'the frame loop'],
|
|
44
|
+
['FRAME', 'a frame'],
|
|
45
|
+
['GAMEPAD', 'gamepad input'],
|
|
46
|
+
['GRAPHICS', 'graphics'],
|
|
47
|
+
['HEADLESS_RUN', 'a headless run'],
|
|
48
|
+
['HIT_TEST', 'a hit test'],
|
|
49
|
+
['HOVER_INPUT', 'hover input'],
|
|
50
|
+
['INPUT_ACTIONS', 'the input actions'],
|
|
51
|
+
['KEYBOARD_FOCUS_SCOPE', 'a keyboard focus scope'],
|
|
52
|
+
['KEYBOARD_INPUT', 'keyboard input'],
|
|
53
|
+
['KEYBOARD', 'the keyboard'],
|
|
54
|
+
['LAYOUT', 'a layout'],
|
|
55
|
+
['MANIFEST_BINDING', 'a manifest binding'],
|
|
56
|
+
['MANIFEST_GROUP', 'a manifest group'],
|
|
57
|
+
['MOTION', 'a motion'],
|
|
58
|
+
['MESH_BINDING', 'a mesh binding'],
|
|
59
|
+
['MESH', 'a mesh'],
|
|
60
|
+
['MOUSE_INPUT', 'mouse input'],
|
|
61
|
+
['NINE_SLICE_BITMAP', 'a nine-slice bitmap'],
|
|
62
|
+
['PARAGRAPH_CACHE', 'the paragraph cache'],
|
|
63
|
+
['PARAGRAPH_FONT_SET', 'a paragraph font set'],
|
|
64
|
+
['PARAGRAPH_FONT', 'a paragraph font'],
|
|
65
|
+
['PARAGRAPH_PROVIDER', 'the paragraph provider'],
|
|
66
|
+
['PARAGRAPH', 'a paragraph'],
|
|
67
|
+
['PARTICLE', 'a particle emitter'],
|
|
68
|
+
['PHYSICS', 'the physics world'],
|
|
69
|
+
['PLAY', 'play'],
|
|
70
|
+
['POINTER_INPUT', 'pointer input'],
|
|
71
|
+
['QUALITY_VARIANT', 'the quality variants'],
|
|
72
|
+
['RANDOM', 'the random number generator'],
|
|
73
|
+
['SAVE_STORE', 'the save store'],
|
|
74
|
+
['SCOPE', 'a scope'],
|
|
75
|
+
['SEQUENCE_RESET', 'a sequence reset slot'],
|
|
76
|
+
['SEQ_PLAYBACK', 'a sequence playback'],
|
|
77
|
+
['SEQ_PLAYER', 'a sequence player'],
|
|
78
|
+
['SEQ', 'a sequence'],
|
|
79
|
+
['SHARED_MATERIAL', 'a shared material'],
|
|
80
|
+
['SPINE_DISPLAY', 'a Spine display'],
|
|
81
|
+
['SPINE_INSTANCE', 'a Spine instance'],
|
|
82
|
+
['SPINE_RESET', 'a Spine reset slot'],
|
|
83
|
+
['SPINE', 'Spine'],
|
|
84
|
+
['SPRITE_SHEET', 'a sprite sheet'],
|
|
85
|
+
['STAGE', 'the stage'],
|
|
86
|
+
['TEXTURE_VIEW', 'a texture view'],
|
|
87
|
+
['TEXTURE', 'a texture'],
|
|
88
|
+
['TEXT_CACHE', 'the text cache'],
|
|
89
|
+
['TEXT_FIELD', 'a text field'],
|
|
90
|
+
['TEXT_PLAN', 'a text plan'],
|
|
91
|
+
['TEXT', 'text'],
|
|
92
|
+
['TILEMAP', 'a tile map'],
|
|
93
|
+
['TWEEN', 'a tween'],
|
|
94
|
+
['UI_CONTROL', 'a UI control'],
|
|
95
|
+
['UI_KEYBOARD', 'UI keyboard navigation'],
|
|
96
|
+
['UI_LAYER', 'a UI layer'],
|
|
97
|
+
['UI_SEMANTICS', 'UI semantics'],
|
|
98
|
+
['UI_TEXT_EDITOR', 'the UI text editor'],
|
|
99
|
+
['UI_THEME', 'a UI theme'],
|
|
100
|
+
['UI', 'the UI'],
|
|
101
|
+
['VIDEO', 'a video'],
|
|
102
|
+
['WEBGL2_LAYER', 'a WebGL2 layer'],
|
|
103
|
+
['WEBGL2_READBACK', 'a WebGL2 readback'],
|
|
104
|
+
['WEBGL2_UPLOAD', 'a staged WebGL2 upload'],
|
|
105
|
+
['WEBGL2', 'the WebGL2 Host'],
|
|
106
|
+
['WEBGPU_READBACK', 'a WebGPU readback'],
|
|
107
|
+
['WEBGPU_RECOVERY', 'WebGPU device recovery'],
|
|
108
|
+
['WEBGPU_UPLOAD', 'a staged WebGPU upload'],
|
|
109
|
+
['WEBGPU', 'the WebGPU Host'],
|
|
110
|
+
['WEB_PNG', 'the browser image provider'],
|
|
111
|
+
['WEB_RESOURCE', 'the browser resource source'],
|
|
112
|
+
['WEB_TEXT', 'the browser text provider'],
|
|
113
|
+
['WORLD3D_OVERLAY', 'the World3D overlay']
|
|
114
|
+
];
|
|
115
|
+
/** What went wrong, by ending, longest first. `{a}` is the area, `{o}` what stands between the area and the ending. */
|
|
116
|
+
const ENDINGS = [
|
|
117
|
+
['OPTIONS_INVALID', 'The options given to {a} are not valid: one is missing, of the wrong type or out of range.'],
|
|
118
|
+
['SCOPE_INVALID', 'The scope given to {a} is not an open scope of this Engine.'],
|
|
119
|
+
['CLEANUP_FAILED', 'Cleaning up {a} failed. Each cause is in cleanupErrors.'],
|
|
120
|
+
['SETUP_FAILED', 'Setting up {a} failed. The cause is in cause.'],
|
|
121
|
+
['CALLBACK_FAILED', 'A callback the application gave to {a} threw. What it threw is in cause.'],
|
|
122
|
+
['LISTENER_FAILED', 'A listener the application gave to {a} threw. What it threw is in cause.'],
|
|
123
|
+
['FACTORY_REQUIRED', '{A} is made by its factory function, not with new.'],
|
|
124
|
+
['ALREADY_STARTED', '{A} was already started.'],
|
|
125
|
+
['ALREADY_CREATED', '{A} was already created.'],
|
|
126
|
+
['NOT_STARTED', '{A} has not been started.'],
|
|
127
|
+
['NOT_READY', '{A} is not ready yet.', 'The {o} of {a} is not ready yet.'],
|
|
128
|
+
['BUDGET_EXCEEDED', 'A limit of {a} was passed.'],
|
|
129
|
+
['CAP_EXCEEDED', 'A limit of {a} was passed.'],
|
|
130
|
+
['IN_USE', '{A} is already in use.', 'The {o} given to {a} is already in use.'],
|
|
131
|
+
['OPTIONS', 'The options given to {a} are not valid.'],
|
|
132
|
+
['INVALID', 'What was given to {a} is not valid.', 'The {o} given to {a} is not valid.'],
|
|
133
|
+
['FAILED', '{A} failed. The cause is in cause.', 'The {o} of {a} failed. The cause is in cause.'],
|
|
134
|
+
['CLOSED', '{A} was closed and takes nothing more.', 'The {o} of {a} was closed and takes nothing more.'],
|
|
135
|
+
['DISPOSED', '{A} was disposed and takes nothing more.', 'The {o} of {a} was disposed and takes nothing more.'],
|
|
136
|
+
['RELEASED', '{A} was released and can no longer be used.', 'The {o} of {a} was released and can no longer be used.'],
|
|
137
|
+
['TERMINAL', '{A} has ended and cannot be used again.', 'The {o} of {a} has ended and cannot be used again.'],
|
|
138
|
+
[
|
|
139
|
+
'RETIRED',
|
|
140
|
+
'{A} has been retired and cannot be used again.',
|
|
141
|
+
'The {o} of {a} has been retired and cannot be used again.'
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
'REENTRANT',
|
|
145
|
+
'{A} was called again from inside one of its own callbacks.',
|
|
146
|
+
'The {o} of {a} was called again from inside one of its own callbacks.'
|
|
147
|
+
],
|
|
148
|
+
['LIMIT', 'A limit of {a} was passed.', 'The {o} limit of {a} was passed.'],
|
|
149
|
+
['BUDGET', 'A limit of {a} was passed.', 'The {o} limit of {a} was passed.'],
|
|
150
|
+
['CAPACITY', '{A} holds as much as it takes.', 'The {o} capacity of {a} is full.'],
|
|
151
|
+
['EXHAUSTED', 'A counter of {a} ran out. Make a new one.', 'The {o} counter of {a} ran out. Make a new one.'],
|
|
152
|
+
['UNSUPPORTED', 'This is not supported by {a}.', 'The {o} is not supported by {a}.'],
|
|
153
|
+
['UNAVAILABLE', '{A} is not available here.', 'The {o} of {a} is not available here.'],
|
|
154
|
+
['BUSY', '{A} is still busy with an earlier request.', 'The {o} of {a} is still busy with an earlier request.'],
|
|
155
|
+
['ACTIVE', '{A} is still active.', 'The {o} of {a} is still active.'],
|
|
156
|
+
['PENDING', '{A} still has work pending.', 'The {o} of {a} is still pending.'],
|
|
157
|
+
[
|
|
158
|
+
'STALE',
|
|
159
|
+
'What was given to {a} has been replaced by a newer one.',
|
|
160
|
+
'The {o} given to {a} has been replaced by a newer one.'
|
|
161
|
+
],
|
|
162
|
+
['SUPERSEDED', 'A newer request to {a} replaced this one.'],
|
|
163
|
+
['CHANGED', '{A} changed while a request was on its way.', 'The {o} of {a} changed while a request was on its way.'],
|
|
164
|
+
['CANCELLED', '{A} was cancelled.', 'The {o} of {a} was cancelled.'],
|
|
165
|
+
['ABORTED', '{A} was aborted.', 'The {o} of {a} was aborted.'],
|
|
166
|
+
['REQUIRED', 'Something {a} needs was not given.', 'A {o} is required by {a}.'],
|
|
167
|
+
['UNKNOWN', 'What was named is not known to {a}.', 'No such {o} is known to {a}.'],
|
|
168
|
+
['MISSING', 'Something {a} needs is missing.', 'A {o} that {a} needs is missing.'],
|
|
169
|
+
['DUPLICATE', 'The same thing was given twice to {a}.', 'The same {o} was given twice to {a}.'],
|
|
170
|
+
['MISMATCH', 'Two things given to {a} do not belong together.', 'The {o} given to {a} does not match.'],
|
|
171
|
+
['RANGE', 'A number is out of range for {a}.', 'The {o} is out of range for {a}.'],
|
|
172
|
+
['TIMEOUT', '{A} took too long.', 'The {o} of {a} took too long.'],
|
|
173
|
+
['EXPIRED', '{A} took too long and was given up.', 'The {o} of {a} took too long and was given up.'],
|
|
174
|
+
['LOST', '{A} was lost.', 'The {o} of {a} was lost.'],
|
|
175
|
+
[
|
|
176
|
+
'BACKWARDS',
|
|
177
|
+
'A time given to {a} is earlier than the one before it.',
|
|
178
|
+
'The {o} given to {a} is earlier than the one before it.'
|
|
179
|
+
],
|
|
180
|
+
['BACKPRESSURE', '{A} holds as many unfinished frames as it takes. Draw the next frame later.'],
|
|
181
|
+
['REFUSED', '{A} was refused.', 'The {o} of {a} was refused.'],
|
|
182
|
+
['NOT_FOUND', 'What was named was not found by {a}.', 'The {o} named was not found by {a}.'],
|
|
183
|
+
['NOT_REGISTERED', 'What was named is not registered with {a}.', 'The {o} named is not registered.'],
|
|
184
|
+
['TOO_LONG', 'What was given to {a} is too long.', 'The {o} given to {a} is too long.'],
|
|
185
|
+
['TOO_SMALL', 'What was given to {a} is too small.', 'The {o} given to {a} is too small.'],
|
|
186
|
+
['DISABLED', '{A} is turned off. Turn it on with the option of its factory.'],
|
|
187
|
+
['STOPPED', '{A} was stopped and takes nothing more.'],
|
|
188
|
+
['USED', '{A} was already used once and cannot be used again.'],
|
|
189
|
+
['UNPREPARED', '{A} has not been prepared yet.'],
|
|
190
|
+
['UNRESOLVED', 'Something {a} needs could not be found.', 'A {o} that {a} needs could not be found.']
|
|
191
|
+
];
|
|
192
|
+
/** Codes with a sentence of their own. */
|
|
193
|
+
const WRITTEN = {
|
|
194
|
+
BROWSER_TEXT_EDITOR_COMPOSING: 'The browser text editor is composing text with an input method. Wait for that to end.',
|
|
195
|
+
BROWSER_TEXT_EDITOR_ELEMENT_DETACHED: 'The element of the browser text editor is no longer in the page.',
|
|
196
|
+
BROWSER_TEXT_EDITOR_FOCUS: 'The browser text editor could not take or keep the focus.',
|
|
197
|
+
BROWSER_TEXT_EDITOR_FONT_GENERATION: 'The fonts given to the browser text editor are not of the generation it expects.',
|
|
198
|
+
BROWSER_TEXT_EDITOR_INACTIVE: 'The browser text editor is not active.',
|
|
199
|
+
BROWSER_TEXT_EDITOR_SURFACE: 'The surface given to the browser text editor is not a canvas it can use.',
|
|
200
|
+
BROWSER_TEXT_EDITOR_TARGET: 'The target given to the browser text editor is not valid.',
|
|
201
|
+
BROWSER_TEXT_INPUT_IDLE: 'The browser text input has no request in hand.',
|
|
202
|
+
BROWSER_TEXT_INPUT_REQUEST: 'The request given to the browser text input is not valid.',
|
|
203
|
+
BROWSER_TEXT_INPUT_SURFACE: 'The surface given to the browser text input is not a canvas it can use.',
|
|
204
|
+
DISPLAY_SUBTREE_OVERLAP: 'Two prepared display subtrees share a node.',
|
|
205
|
+
DISPLAY_SUBTREE_TARGET_DETACHED: 'The target of a prepared display subtree is no longer on the stage.',
|
|
206
|
+
PARAGRAPH_FONT_SET_IDENTITY_COLLISION: 'Two fonts of a paragraph font set have the same identity.',
|
|
207
|
+
PARAGRAPH_FONT_SET_PROVIDER: 'The provider given to a paragraph font set is not valid.',
|
|
208
|
+
SEQUENCE_RESET_NOT_PREPARED: 'The sequence reset slot has not been prepared.',
|
|
209
|
+
SEQUENCE_RESET_PRESERVE_TIMELINE: 'The timeline cannot be kept through this reset of a sequence.',
|
|
210
|
+
SEQUENCE_RESET_TARGET_CLAIMED: 'The target of a sequence reset slot is already held by another.',
|
|
211
|
+
SPINE_INSTANCE_FAULTED: 'The Spine instance failed earlier and can no longer be used.',
|
|
212
|
+
SPINE_INSTANCE_NONFINITE_POSE: 'A pose of the Spine instance has a number that is not finite.',
|
|
213
|
+
SPINE_INSTANCE_RESET_NOT_PRISTINE: 'The Spine instance cannot be reset this way: it is no longer as it was when it was made.',
|
|
214
|
+
SPINE_INSTANCE_SEEK_BACKWARD_EVENTS: 'A seek backwards would pass events of the Spine instance, which are not played backwards.',
|
|
215
|
+
SPINE_INSTANCE_SEEK_HISTORY: 'The Spine instance cannot seek that far back: its history does not reach there.',
|
|
216
|
+
SPINE_RESET_NOT_PREPARED: 'The Spine reset slot has not been prepared.',
|
|
217
|
+
SPINE_RESET_PRESERVE_ANIMATION: 'The animation cannot be kept through this reset of a Spine display.',
|
|
218
|
+
SPINE_RESET_PRESERVE_SKIN: 'The skin cannot be kept through this reset of a Spine display.',
|
|
219
|
+
SPINE_RESET_PRESERVE_STATE: 'The state cannot be kept through this reset of a Spine display.',
|
|
220
|
+
SPINE_RESET_TARGET_CLAIMED: 'The target of a Spine reset slot is already held by another.',
|
|
221
|
+
TEXT_EDIT_COMPOSING: 'The text is being composed with an input method, and this edit cannot be made until that ends.',
|
|
222
|
+
TEXT_EDIT_SELECTION: 'The selection given to a text edit is not valid.',
|
|
223
|
+
TEXT_EDIT_VALUE: 'The value given to a text edit is not valid.',
|
|
224
|
+
UI_EDITOR_FONTS_DECODE: 'A font of the UI text editor could not be decoded.',
|
|
225
|
+
UI_EDITOR_FONTS_FAMILY: 'A font family given to the UI text editor is not valid.',
|
|
226
|
+
UI_EDITOR_FONTS_PROFILE: 'A font given to the UI text editor is not of a profile it reads.',
|
|
227
|
+
UI_TEXT_EDITOR_COMPOSING: 'The UI text editor is composing text with an input method. Wait for that to end.',
|
|
228
|
+
UI_TEXT_EDITOR_STYLE: 'The style given to the UI text editor is not valid.',
|
|
229
|
+
WEB_RESOURCE_DEADLINE_EXCEEDED: 'A request of the browser resource source took longer than its deadline.',
|
|
230
|
+
WEB_RESOURCE_HTTP_STATUS: 'The server answered a request of the browser resource source with a status that is not success.',
|
|
231
|
+
FONT_CONTENT_ASSET: 'The asset given to font content is not valid.',
|
|
232
|
+
FONT_CONTENT_BYTES: 'The bytes given to font content are not valid.',
|
|
233
|
+
FONT_CONTENT_FLAVOR: 'The flavor given to font content is not valid.',
|
|
234
|
+
FONT_CONTENT_GROUP: 'The group given to font content is not valid.',
|
|
235
|
+
FONT_CONTENT_INPUT: 'The input given to font content is not valid.',
|
|
236
|
+
FONT_CONTENT_LOADER: 'The loader given to font content is not valid.',
|
|
237
|
+
FONT_CONTENT_PROFILE: 'The profile given to font content is not valid.',
|
|
238
|
+
FONT_CONTENT_PROVIDER: 'The provider given to font content is not valid.',
|
|
239
|
+
FONT_CONTENT_REF: 'The ref given to font content is not valid.',
|
|
240
|
+
FONT_CONTENT_ROOTS: 'The roots given to font content are not valid.',
|
|
241
|
+
FONT_CONTENT_SCOPE: 'The scope given to font content is not valid.',
|
|
242
|
+
ANIMATION_COMMANDS_REPLACED: 'The commands given to an animation for this tick were replaced by later ones before they ran.',
|
|
243
|
+
ANIMATION_RATE_ZERO: 'A rate of 0 was given to an animation. A rate is above or below zero: pause the animation to hold it still.',
|
|
244
|
+
ANIMATION_TERMINAL_COMMAND: 'A command was given for an animation that has ended.',
|
|
245
|
+
ASSET_NO_DEMAND: 'The load of an asset was stopped because everything that had asked for it gave it up.',
|
|
246
|
+
GAMEPAD_SAMPLE: 'The sample given to gamepad input is not a gamepad sample.',
|
|
247
|
+
HOVER_INPUT_REASON: 'The reason given to hover input for a leave is not one it knows.',
|
|
248
|
+
HOVER_INPUT_SAMPLE: 'The sample given to hover input is not an object with a pointer id, a pointer type, global coordinates and a timestamp.',
|
|
249
|
+
HOVER_INPUT_VIEWPORT: 'The viewport revision given to hover input is not a whole number above the last one.',
|
|
250
|
+
POINTER_INPUT_REASON: 'The reason given to pointer input for a cancel is not one it knows.',
|
|
251
|
+
POINTER_INPUT_SAMPLE: 'The sample given to pointer input is not a pointer sample.',
|
|
252
|
+
POINTER_INPUT_VIEWPORT: 'The viewport revision given to pointer input is not a whole number above the last one.',
|
|
253
|
+
KEYBOARD_TARGET_INELIGIBLE: 'The keyboard target cannot take focus now, for instance because it is disabled or not on the stage.',
|
|
254
|
+
SEQUENCE_RESET_PRESERVE_STATE: 'A sequence is reset keeping its place only while it is running or paused, with no command waiting.',
|
|
255
|
+
SPINE_LOADER_RECEIVER: 'A method of the Spine loader was called apart from the loader. Call it on the loader: loader.load(...).',
|
|
256
|
+
UI_CONTROL_DIRECTION: 'The direction given to a UI control is not two finite numbers.',
|
|
257
|
+
UI_CONTROL_RADIUS: 'The radius given to a UI control is not a finite number above zero.',
|
|
258
|
+
UI_LAYER_BASE: 'The base layer of a UI is always open. It is not opened or closed by name.',
|
|
259
|
+
UI_LAYER_MANAGER_OWNED: 'This Engine already has a UI layer manager. An Engine has one.',
|
|
260
|
+
UI_LAYER_ROOT_OWNED: 'This UI root already belongs to a layer.',
|
|
261
|
+
UI_LAYOUT_UNSTABLE: 'The layout of the UI did not settle in eight rounds: a size keeps changing something it depends on.',
|
|
262
|
+
UI_ROW_NOT_REALIZED: 'The row is not on screen now, so there is nothing of it to act on. Scroll it into view first.',
|
|
263
|
+
UI_ROW_RETAINED: 'A row that is in use was removed from its list or changed under it.',
|
|
264
|
+
UI_SEMANTICS_DESCRIPTION: 'A field of a UI semantics entry is not valid. The entry and the field are in cause.',
|
|
265
|
+
UI_SEMANTICS_FOCUS: 'More than one entry of UI semantics is focused, or the focused one is inert. The entry is in cause.',
|
|
266
|
+
UI_SEMANTICS_PARENT: 'An entry of UI semantics is not inside the kind of entry its role needs.',
|
|
267
|
+
UI_SEMANTICS_RELATION: 'An entry of UI semantics names another entry that is not in the tree. The entry is in cause.',
|
|
268
|
+
UI_SEMANTICS_REVISION: 'The revision given to UI semantics is older than the one it has.',
|
|
269
|
+
UI_SOURCE_REVISION: 'The rows of a list changed while the UI was reading them under one revision.',
|
|
270
|
+
UI_STALE_PREPARATION: 'The prepared UI no longer matches the UI it was prepared for. Prepare it again.',
|
|
271
|
+
UI_TREE_SHAPE: 'A new description of the UI has other nodes, or a node of another kind, than the tree it updates.',
|
|
272
|
+
WEBGL2_CLOSE_UNSAFE: 'The WebGL2 Host could not release everything it made while closing. The cause is in cause.',
|
|
273
|
+
WEBGL2_VALIDATION: 'WebGL2 refused an operation of the Host as not valid. The cause is in cause.',
|
|
274
|
+
WEBGPU_CLOSE_UNSAFE: 'The WebGPU Host could not release everything it made while closing. The cause is in cause.',
|
|
275
|
+
WEBGPU_INTERNAL: 'WebGPU reported an internal error. The cause is in cause.',
|
|
276
|
+
WEBGPU_VALIDATION: 'WebGPU refused an operation of the Host as not valid. The cause is in cause.',
|
|
277
|
+
WEB_PNG_CLOSE_INCOMPLETE: 'The browser image provider closed, but not everything it held could be released. The reasons are in cleanupErrors.',
|
|
278
|
+
WEB_RESOURCE_CLOSE_INCOMPLETE: 'The browser resource source closed, but not everything it held could be released. The reasons are in cleanupErrors.',
|
|
279
|
+
TWEEN_OPTIONS_INVALID: 'The options of a tween are not valid: from and to are finite numbers, durationSeconds is above zero, and onUpdate is a function that returns nothing.',
|
|
280
|
+
OBJECT_DISPOSED: 'The object was disposed and can no longer be changed or added. Make a new one, or stop using it after its scope is disposed.',
|
|
281
|
+
ENGINE_CLOSED: 'The Engine was closed. Nothing made with it can be used any more.',
|
|
282
|
+
ENGINE_MISMATCH: 'The object belongs to another Engine. A display tree, a scope and their resources all belong to one Engine.',
|
|
283
|
+
SCOPE_CLOSED: 'The scope was disposed, and everything it owned with it. Create a new scope.',
|
|
284
|
+
FRAME_RENDER_FAILED: 'The Host refused or failed to draw the frame. The reason is in cause: a code ending in _BACKPRESSURE means the Host was still busy with earlier frames, which the frame loop of @egret/engine/web/loop avoids.',
|
|
285
|
+
FRAME_BUDGET_EXCEEDED: 'The stage holds more than one frame takes: 65,536 nodes or commands, 256 materials, 4,096 different geometries or 65,536 mesh triangles. A circle of radius 40 is 32 triangles.',
|
|
286
|
+
FRAME_IMAGE_BUDGET: 'The frame uses more images than it takes: 64 pages, 4,096 regions or 64 MiB of distinct pixels. Pack images into fewer atlases.',
|
|
287
|
+
FRAME_TRANSFORM_INVALID: 'A display object is placed where its corners are not finite numbers. Check its x, y, scale and rotation, and those of its parents.',
|
|
288
|
+
FRAME_STAGE_INVALID: 'A frame is captured from the stage of an Engine, and this is not one.',
|
|
289
|
+
FRAME_REENTRANT: 'A frame was asked for while another was being captured. Draw from the frame loop, not from inside a callback of the capture.',
|
|
290
|
+
INVALID_FRAME_OPTIONS: 'The frame options are not valid: width and height are whole numbers above zero, clearColor is 0 to 0xffffff and clearAlpha is 0 to 1.',
|
|
291
|
+
INVALID_RENDERER: 'The Host given to the Engine does not draw this kind of frame.',
|
|
292
|
+
RENDERER_REQUIRED: 'The Engine was asked to draw and was created without a Host that draws. Give createEngine a Host from createSharedWebGL2Host or createSharedWebGPUHost.',
|
|
293
|
+
OWNERSHIP_CONFLICT: 'The object already belongs to another scope. An object is given to one scope with scope.use, once.',
|
|
294
|
+
DISPLAY_VALUE_INVALID: 'A value given to a display object is not valid: positions, scales, rotation and alpha are finite numbers (an alpha is held to 0 and 1) and visible is a boolean.',
|
|
295
|
+
DISPLAY_SIZE_UNAVAILABLE: 'The object draws nothing, so it has no width or height to scale to a size. Draw it first, or set scaleX and scaleY.',
|
|
296
|
+
DISPLAY_CYCLE: 'A container cannot be added to itself or to one of its own descendants.',
|
|
297
|
+
DISPLAY_TREE_INVARIANT: 'The display tree changed while it was being walked, or a node was reached twice. Do not change the tree from inside a capture or a query.',
|
|
298
|
+
STAGE_ROOT_ONLY: 'The stage is the root of the tree: it cannot be added to a container or disposed by itself.',
|
|
299
|
+
NOT_A_CHILD: 'The display object is not a child of this container.',
|
|
300
|
+
INVALID_INDEX: 'The child index is not a whole number within the container.',
|
|
301
|
+
INVALID_DISPLAY_OBJECT: 'What was given is not a display object made by this SDK.',
|
|
302
|
+
INVALID_DISPLAY_CONTAINER: 'What was given is not a display container made by this SDK.',
|
|
303
|
+
GRAPHICS_VALUE_INVALID: 'A value given to graphics is not valid: coordinates are finite numbers, sizes are not negative, a colour is 0 to 0xffffff and an alpha is a finite number (held to 0 and 1).',
|
|
304
|
+
GRAPHICS_FILL_REQUIRED: 'A shape needs a fill or a line. Call beginFill or lineStyle before drawing it.',
|
|
305
|
+
GRAPHICS_BUDGET: 'The drawing is more than one sprite holds: a path of 8,192 points, a line of 16,384 dashes, a fill with holes or crossings of 16,384 triangles, 16 meshes, or an image repeated beyond 8,192 of its pixels. What the sprite had drawn before stays. Draw the rest into another sprite.',
|
|
306
|
+
CLOCK_DELTA_LIMIT: 'The time given to engine.advanceTime is further from the last one than the clock takes in one step. Give it smaller steps, as the frame loop of @egret/engine/web/loop does after a tab was hidden.',
|
|
307
|
+
CLOCK_SOURCE_BACKWARDS: 'The time given to engine.advanceTime is earlier than the last one. It takes seconds that never go back.',
|
|
308
|
+
CLOCK_SOURCE_INVALID: 'The time given to engine.advanceTime is not a finite number of seconds, zero or more.',
|
|
309
|
+
CLOCK_REENTRANT: 'engine.advanceTime was called from inside a tick or while a frame was being captured.',
|
|
310
|
+
FRAME_LOOP_CLOSED: 'The frame loop was disposed. Create a new one.',
|
|
311
|
+
ASSET_LOAD_FAILED: 'A provider failed to load the asset. What it threw is in cause.',
|
|
312
|
+
ASSET_PROVIDER_MISSING: 'No provider is registered for this type of asset. Register one with engine.assets.register before acquiring it.',
|
|
313
|
+
ASSET_PROVIDER_REGISTERED: 'A provider is already registered for this type of asset.',
|
|
314
|
+
ASSET_ACQUIRE_CANCELLED: 'The request for the asset was cancelled, by its signal or because its scope was disposed.',
|
|
315
|
+
ASSET_LEASE_RELEASED: 'The lease was released and its asset may be gone. Acquire the asset again.',
|
|
316
|
+
BITMAP_TEXTURE_REQUIRED: 'A Bitmap is made with a lease of a texture from engine.assets.acquire.',
|
|
317
|
+
TEXTURE_DISPOSED: 'The texture was disposed and can no longer be shown.',
|
|
318
|
+
SHARED_MATERIAL_UNSUPPORTED: 'The material cannot be used on this object: a mesh made for a region samples by region, not by page.',
|
|
319
|
+
MESH_GEOMETRY_INVALID: 'What was given is not a geometry made by createSharedGeometry2D or createTexturedGeometry2D.',
|
|
320
|
+
UI_MANAGED_GEOMETRY: 'The position and size of this object are managed by the UI. Change its layout, not its x, y or scale.',
|
|
321
|
+
OPTIONS_INVALID: 'The options given are not valid: one is missing, of the wrong type or out of range.',
|
|
322
|
+
NOT_READY: 'This is not ready yet. Wait for what it was made from to finish loading.',
|
|
323
|
+
INVALID_EVENT: 'What was dispatched is not an Event made with an event type of this SDK.',
|
|
324
|
+
INVALID_EVENT_DISPATCHER: 'What was given is not an event dispatcher made by this SDK.',
|
|
325
|
+
INVALID_PRIORITY: 'A listener priority is a whole number.',
|
|
326
|
+
INVALID_TIMEOUT: 'A timeout is a whole number of milliseconds, zero or more.',
|
|
327
|
+
UI_DUPLICATE_ID: 'Two parts of the UI were given the same id.',
|
|
328
|
+
UI_DUPLICATE_KEY: 'Two rows of a list were given the same key.',
|
|
329
|
+
UI_UNKNOWN_KEY: 'No row of the list has this key.',
|
|
330
|
+
UI_UNKNOWN_LIST: 'No list of the UI has this id.',
|
|
331
|
+
UI_LIST_NOT_FOUND: 'No list of the UI has this id.',
|
|
332
|
+
UI_CONTROL_UNKNOWN_ITEM: 'The control has no item of this id.',
|
|
333
|
+
UI_LAYOUT_CYCLE: 'The layout of the UI depends on itself: a size is given in terms of a size it decides.',
|
|
334
|
+
LAYOUT_OVERFLOW: 'The children do not fit the space the layout was given.',
|
|
335
|
+
PARAGRAPH_FONT_NOT_REGISTERED: 'The paragraph names a font family that was not registered with its font set.',
|
|
336
|
+
PARAGRAPH_GLYPH_UNRESOLVED: 'No registered font has a glyph for a character of the paragraph. Add a font that covers it.',
|
|
337
|
+
PARAGRAPH_ELLIPSIS_DOES_NOT_FIT: 'The paragraph is too narrow to hold even its ellipsis.',
|
|
338
|
+
COORDINATE_TRANSFORM_SINGULAR: 'A display object on the way has a scale of zero, so a stage point has no local point.',
|
|
339
|
+
TEXTURE_VIEW_REGION_IMMUTABLE: 'The region of a texture view is fixed when it is made. Make another view.',
|
|
340
|
+
WEBGPU_UNCAPTURED_ERROR: 'The WebGPU device reported an error outside any operation of the Host. What it reported is in cause.',
|
|
341
|
+
WEBGL2_CONTEXT_RESTORING: 'The WebGL2 context is being restored. Frames are taken again once it is back.',
|
|
342
|
+
ASYNC_EVENT_HANDLER: 'An event listener returned a promise. Listeners run to their end before dispatch returns; start asynchronous work without returning it.',
|
|
343
|
+
HOST_IN_USE: 'The Host already draws for another Engine. Each Engine needs a Host of its own.',
|
|
344
|
+
SURFACE_IN_USE: 'The canvas is already used by another Host or input.',
|
|
345
|
+
VIDEO_PLAY_REFUSED: 'The browser refused to play the video, usually because it has sound and the page has not been pressed yet. Play it muted, or from a press.',
|
|
346
|
+
AUDIO_HOST_UNAVAILABLE: 'The page has no Web Audio, or it may not start before the page is pressed.',
|
|
347
|
+
WEBGL2_CONTEXT_UNAVAILABLE: 'The browser gave no WebGL2 context for the canvas. The canvas may already have another kind of context, or WebGL2 is turned off.',
|
|
348
|
+
WEBGL2_CONTEXT_LOST: 'The browser took the WebGL2 context away. The Host restores it when the browser gives it back; frames are refused until then.',
|
|
349
|
+
WEBGL2_OUT_OF_MEMORY: 'The graphics device ran out of memory. Use fewer or smaller textures.',
|
|
350
|
+
WEBGL2_FRAME_BUDGET: 'The frame is larger than the Host was made to take. Its limits are options of createSharedWebGL2Host.',
|
|
351
|
+
WEBGL2_NOT_STARTED: 'The Host has not started. An Engine starts its Host; wait for createEngine to resolve before drawing.',
|
|
352
|
+
WEBGPU_ADAPTER_UNAVAILABLE: 'The browser offers no WebGPU adapter. Use the WebGL2 Host instead.',
|
|
353
|
+
WEBGPU_UNAVAILABLE: 'The browser has no WebGPU. Use the WebGL2 Host instead.',
|
|
354
|
+
WEBGPU_DEVICE_LOST: 'The browser took the WebGPU device away. The Host recovers where recovery is enabled; frames are refused until then.',
|
|
355
|
+
WEBGPU_OUT_OF_MEMORY: 'The graphics device ran out of memory. Use fewer or smaller textures.',
|
|
356
|
+
WEBGPU_FRAME_BUDGET: 'The frame is larger than the Host was made to take. Its limits are options of createSharedWebGPUHost.',
|
|
357
|
+
WEBGPU_NOT_STARTED: 'The Host has not started. An Engine starts its Host; wait for createEngine to resolve before drawing.'
|
|
358
|
+
};
|
|
359
|
+
import { ZH_AREAS, ZH_ENDINGS, ZH_WRITTEN } from './errorHelpZh.js';
|
|
360
|
+
const TABLES = {
|
|
361
|
+
en: {
|
|
362
|
+
areas: AREAS,
|
|
363
|
+
endings: ENDINGS,
|
|
364
|
+
written: WRITTEN,
|
|
365
|
+
other: (area, rest) => 'A problem with ' + area + ': ' + rest + '.',
|
|
366
|
+
cache: new Map()
|
|
367
|
+
},
|
|
368
|
+
zh: {
|
|
369
|
+
areas: ZH_AREAS,
|
|
370
|
+
endings: ZH_ENDINGS,
|
|
371
|
+
written: ZH_WRITTEN,
|
|
372
|
+
other: (area, rest) => area + '出现问题:`' + rest + '`。',
|
|
373
|
+
cache: new Map()
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
let language = 'en';
|
|
377
|
+
/**
|
|
378
|
+
* The language of the sentence in the message of every error made from now on: English unless set. The code of an
|
|
379
|
+
* error is the same in every language.
|
|
380
|
+
*/
|
|
381
|
+
export function setErrorLanguage(value) {
|
|
382
|
+
if (value !== 'en' && value !== 'zh')
|
|
383
|
+
throw new TypeError('The language of errors is "en" or "zh".');
|
|
384
|
+
language = value;
|
|
385
|
+
}
|
|
386
|
+
export function getErrorLanguage() {
|
|
387
|
+
return language;
|
|
388
|
+
}
|
|
389
|
+
const words = (tokens) => tokens.join(' ').toLowerCase();
|
|
390
|
+
/**
|
|
391
|
+
* A sentence for an error code: what went wrong and, for the codes a game meets most, what to do. It is in the
|
|
392
|
+
* language given, or the one set by `setErrorLanguage`. A code this SDK does not know gives an empty string.
|
|
393
|
+
*/
|
|
394
|
+
export function describeErrorCode(code, inLanguage = language) {
|
|
395
|
+
const tables = TABLES[inLanguage];
|
|
396
|
+
if (typeof code !== 'string' || tables === undefined)
|
|
397
|
+
return '';
|
|
398
|
+
const cache = tables.cache, known = cache.get(code);
|
|
399
|
+
if (known !== undefined)
|
|
400
|
+
return known;
|
|
401
|
+
let text = tables.written[code] ?? '';
|
|
402
|
+
if (text === '' && /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/.test(code)) {
|
|
403
|
+
const area = tables.areas.find(([prefix]) => code === prefix || code.startsWith(prefix + '_'));
|
|
404
|
+
// A code without a known area has a sentence only when it is written above.
|
|
405
|
+
if (area === undefined) {
|
|
406
|
+
if (cache.size < 2048)
|
|
407
|
+
cache.set(code, '');
|
|
408
|
+
return '';
|
|
409
|
+
}
|
|
410
|
+
const name = area[1], rest = code
|
|
411
|
+
.slice(area[0].length + 1)
|
|
412
|
+
.split('_')
|
|
413
|
+
.filter(part => part !== '');
|
|
414
|
+
const ending = tables.endings.find(([suffix]) => {
|
|
415
|
+
const parts = suffix.split('_');
|
|
416
|
+
return rest.length >= parts.length && rest.slice(-parts.length).join('_') === suffix;
|
|
417
|
+
});
|
|
418
|
+
if (ending !== undefined) {
|
|
419
|
+
const object = words(rest.slice(0, rest.length - ending[0].split('_').length));
|
|
420
|
+
text = (object !== '' && ending[2] !== undefined ? ending[2] : ending[1])
|
|
421
|
+
.replaceAll('{A}', name.charAt(0).toUpperCase() + name.slice(1))
|
|
422
|
+
.replaceAll('{a}', name)
|
|
423
|
+
.replaceAll('{o}', object);
|
|
424
|
+
}
|
|
425
|
+
else if (rest.length !== 0)
|
|
426
|
+
text = tables.other(name, words(rest));
|
|
427
|
+
}
|
|
428
|
+
if (cache.size < 2048)
|
|
429
|
+
cache.set(code, text);
|
|
430
|
+
return text;
|
|
431
|
+
}
|
|
432
|
+
//# sourceMappingURL=errorHelp.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The areas in Chinese, in the order of the English ones. */
|
|
2
|
+
export declare const ZH_AREAS: readonly (readonly [string, string])[];
|
|
3
|
+
export declare const ZH_ENDINGS: readonly (readonly [string, string, string?])[];
|
|
4
|
+
export declare const ZH_WRITTEN: Readonly<Record<string, string>>;
|
|
5
|
+
//# sourceMappingURL=errorHelpZh.d.ts.map
|