@egret/runtime 0.0.0-stage → 7.0.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/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 +58 -0
- package/dist/AssetManager.js +451 -0
- package/dist/AssetRef.d.ts +21 -0
- package/dist/AssetRef.js +33 -0
- package/dist/Bitmap.d.ts +40 -0
- package/dist/Bitmap.js +545 -0
- package/dist/ByteReader.d.ts +32 -0
- package/dist/ByteReader.js +178 -0
- package/dist/ByteWriter.d.ts +30 -0
- package/dist/ByteWriter.js +181 -0
- package/dist/CancellationController.d.ts +10 -0
- package/dist/CancellationController.js +66 -0
- package/dist/DisplayObject.d.ts +97 -0
- package/dist/DisplayObject.js +366 -0
- package/dist/DisplayObjectContainer.d.ts +28 -0
- package/dist/DisplayObjectContainer.js +226 -0
- package/dist/EgretError.d.ts +12 -0
- package/dist/EgretError.js +36 -0
- package/dist/Event.d.ts +47 -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 +117 -0
- package/dist/Graphics.js +548 -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 +19 -0
- package/dist/NineSliceGeometry2D.js +126 -0
- package/dist/Scope.d.ts +19 -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 +30 -0
- package/dist/Texture.js +178 -0
- package/dist/assetManagerOwnerState.d.ts +36 -0
- package/dist/assetManagerOwnerState.js +115 -0
- package/dist/assetState.d.ts +45 -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 +76 -0
- package/dist/displayVisualState.js +141 -0
- package/dist/errorHelp.d.ts +15 -0
- package/dist/errorHelp.js +435 -0
- package/dist/errorHelpZh.d.ts +5 -0
- package/dist/errorHelpZh.js +342 -0
- package/dist/geometry.d.ts +173 -0
- package/dist/geometry.js +311 -0
- package/dist/graphicsFill.d.ts +37 -0
- package/dist/graphicsFill.js +302 -0
- package/dist/graphicsShape.d.ts +170 -0
- package/dist/graphicsShape.js +961 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +31 -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 +64 -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 +57 -0
- package/dist/renderEffect.js +109 -0
- package/dist/sequenceClip.d.ts +48 -0
- package/dist/sequenceClip.js +197 -0
- package/dist/sharedFrameCapture.d.ts +24 -0
- package/dist/sharedFrameCapture.js +1128 -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 +384 -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,44 @@
|
|
|
1
|
+
import { EgretError } from '../EgretError.js';
|
|
2
|
+
import { childrenOf, parentOf } from '../displayTreeState.js';
|
|
3
|
+
const records = new WeakMap();
|
|
4
|
+
const terminal = new WeakSet();
|
|
5
|
+
/** Only runtime UI construction installs a captured per-wrapper terminal path. */
|
|
6
|
+
export function registerManagedWrapper(node, authority, dispose) {
|
|
7
|
+
records.set(node, { authority, dispose });
|
|
8
|
+
}
|
|
9
|
+
export function isManagedWrapper(node) {
|
|
10
|
+
return records.has(node);
|
|
11
|
+
}
|
|
12
|
+
export function managedBy(node, authority) {
|
|
13
|
+
return records.get(node)?.authority === authority;
|
|
14
|
+
}
|
|
15
|
+
export function managedTerminal(node) {
|
|
16
|
+
return terminal.has(node);
|
|
17
|
+
}
|
|
18
|
+
export function assertManagedMutable(node) {
|
|
19
|
+
if (node !== undefined && records.has(node))
|
|
20
|
+
throw new EgretError('UI_MANAGED_GEOMETRY');
|
|
21
|
+
}
|
|
22
|
+
export function assertManagedEdgeMutable(parent, child) {
|
|
23
|
+
assertManagedMutable(parent);
|
|
24
|
+
assertManagedMutable(child);
|
|
25
|
+
assertManagedMutable(parentOf(child));
|
|
26
|
+
}
|
|
27
|
+
export function assertManagedChildrenMutable(parent) {
|
|
28
|
+
assertManagedMutable(parent);
|
|
29
|
+
const children = childrenOf(parent);
|
|
30
|
+
for (let index = 0; index < children.length; index++)
|
|
31
|
+
assertManagedMutable(children[index]);
|
|
32
|
+
}
|
|
33
|
+
/** Revoke this exact value before callbacks; never unlock another managed value. */
|
|
34
|
+
export function cleanupManagedWrapper(value) {
|
|
35
|
+
const record = records.get(value);
|
|
36
|
+
// A tombstone preserves idempotent managed cleanup without retaining its owner or closure.
|
|
37
|
+
if (record === undefined)
|
|
38
|
+
return terminal.has(value);
|
|
39
|
+
records.delete(value);
|
|
40
|
+
terminal.add(value);
|
|
41
|
+
record.dispose();
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=managedState.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TextEditState, TextEditStateOptions } from './textEditTypes.js';
|
|
2
|
+
/** One committed value, one provisional composition and one opaque activation. No history or host globals. */
|
|
3
|
+
export declare function createTextEditState(options: TextEditStateOptions): TextEditState;
|
|
4
|
+
//# sourceMappingURL=textEditState.d.ts.map
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { EgretError } from '../EgretError.js';
|
|
3
|
+
const fail = (code) => {
|
|
4
|
+
throw new EgretError('TEXT_EDIT_' + code);
|
|
5
|
+
};
|
|
6
|
+
const freeze = Object.freeze;
|
|
7
|
+
function integer(value, maximum) {
|
|
8
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0 || value > maximum)
|
|
9
|
+
return fail('SELECTION');
|
|
10
|
+
return value === 0 ? 0 : value;
|
|
11
|
+
}
|
|
12
|
+
function selection(input, value) {
|
|
13
|
+
if (input === null || typeof input !== 'object')
|
|
14
|
+
return fail('SELECTION');
|
|
15
|
+
const anchor = integer(input.anchor, value.length), focus = integer(input.focus, value.length), affinity = input.affinity ?? 'downstream';
|
|
16
|
+
if (affinity !== 'upstream' && affinity !== 'downstream')
|
|
17
|
+
return fail('SELECTION');
|
|
18
|
+
for (const offset of [anchor, focus]) {
|
|
19
|
+
const left = value.charCodeAt(offset - 1), right = value.charCodeAt(offset);
|
|
20
|
+
if (left >= 0xd800 && left <= 0xdbff && right >= 0xdc00 && right <= 0xdfff)
|
|
21
|
+
return fail('SELECTION');
|
|
22
|
+
}
|
|
23
|
+
return freeze({ anchor, focus, affinity });
|
|
24
|
+
}
|
|
25
|
+
function source(input, mode, maximum, provisional = false) {
|
|
26
|
+
if (typeof input !== 'string' || input.length > 8192)
|
|
27
|
+
return fail('VALUE');
|
|
28
|
+
const value = mode === 'multiline' ? input.replace(/\r\n?/gu, '\n') : input;
|
|
29
|
+
if (value.length > maximum ||
|
|
30
|
+
(mode === 'single-line' && /[\r\n]/u.test(value)) ||
|
|
31
|
+
/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/u.test(value))
|
|
32
|
+
return fail('VALUE');
|
|
33
|
+
// IME preedit may be incomplete. Only committed sources require well-formed UTF-16.
|
|
34
|
+
if (!provisional)
|
|
35
|
+
for (let index = 0; index < value.length; index++) {
|
|
36
|
+
const unit = value.charCodeAt(index);
|
|
37
|
+
if (unit >= 0xd800 && unit <= 0xdbff) {
|
|
38
|
+
const low = value.charCodeAt(++index);
|
|
39
|
+
if (!(low >= 0xdc00 && low <= 0xdfff))
|
|
40
|
+
return fail('VALUE');
|
|
41
|
+
}
|
|
42
|
+
else if (unit >= 0xdc00 && unit <= 0xdfff)
|
|
43
|
+
return fail('VALUE');
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function equal(a, b) {
|
|
48
|
+
return a.anchor === b.anchor && a.focus === b.focus && a.affinity === b.affinity;
|
|
49
|
+
}
|
|
50
|
+
/** One committed value, one provisional composition and one opaque activation. No history or host globals. */
|
|
51
|
+
export function createTextEditState(options) {
|
|
52
|
+
if (options === null || typeof options !== 'object')
|
|
53
|
+
return fail('OPTIONS');
|
|
54
|
+
const mode = options.mode, maxLength = options.maxLength ?? 8192;
|
|
55
|
+
if (!['single-line', 'multiline'].includes(mode) ||
|
|
56
|
+
!Number.isSafeInteger(maxLength) ||
|
|
57
|
+
maxLength < 1 ||
|
|
58
|
+
maxLength > 8192)
|
|
59
|
+
return fail('OPTIONS');
|
|
60
|
+
let value = source(options.value ?? '', mode, maxLength);
|
|
61
|
+
let selected = selection(options.selection ?? { anchor: value.length, focus: value.length }, value);
|
|
62
|
+
let revision = 0, closed = false, session, draft;
|
|
63
|
+
const live = () => {
|
|
64
|
+
if (closed)
|
|
65
|
+
fail('CLOSED');
|
|
66
|
+
};
|
|
67
|
+
const expect = (expected) => {
|
|
68
|
+
live();
|
|
69
|
+
if (expected !== undefined && expected !== revision)
|
|
70
|
+
fail('STALE');
|
|
71
|
+
return revision;
|
|
72
|
+
};
|
|
73
|
+
const matches = (token, expected) => !closed && session !== undefined && token === session && expected === revision;
|
|
74
|
+
function sample(input, provisional = false) {
|
|
75
|
+
if (input === null || typeof input !== 'object')
|
|
76
|
+
return fail('VALUE');
|
|
77
|
+
const nextValue = source(input.value, mode, provisional ? 8192 : maxLength, provisional);
|
|
78
|
+
return freeze({ value: nextValue, selection: selection(input.selection, nextValue) });
|
|
79
|
+
}
|
|
80
|
+
function publish(next) {
|
|
81
|
+
if (next.value === value && equal(next.selection, selected))
|
|
82
|
+
return 'unchanged';
|
|
83
|
+
if (!Number.isSafeInteger(revision + 1))
|
|
84
|
+
return fail('REVISION_EXHAUSTED');
|
|
85
|
+
value = next.value;
|
|
86
|
+
selected = next.selection;
|
|
87
|
+
revision++;
|
|
88
|
+
return 'changed';
|
|
89
|
+
}
|
|
90
|
+
const state = freeze({
|
|
91
|
+
mode,
|
|
92
|
+
maxLength,
|
|
93
|
+
snapshot() {
|
|
94
|
+
return freeze({
|
|
95
|
+
state: closed ? 'closed' : draft ? 'composing' : session ? 'editing' : 'idle',
|
|
96
|
+
revision,
|
|
97
|
+
value,
|
|
98
|
+
selection: selected,
|
|
99
|
+
session,
|
|
100
|
+
draft
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
setValue(input, inputSelection, expectedRevision, cancelComposition = false) {
|
|
104
|
+
const base = expect(expectedRevision), nextValue = source(input, mode, maxLength);
|
|
105
|
+
const nextSelection = inputSelection === undefined
|
|
106
|
+
? nextValue === value
|
|
107
|
+
? selected
|
|
108
|
+
: selection({ anchor: nextValue.length, focus: nextValue.length }, nextValue)
|
|
109
|
+
: selection(inputSelection, nextValue);
|
|
110
|
+
if (closed || revision !== base)
|
|
111
|
+
return fail('STALE');
|
|
112
|
+
if (draft !== undefined && !cancelComposition)
|
|
113
|
+
return fail('COMPOSING');
|
|
114
|
+
if (draft !== undefined) {
|
|
115
|
+
session = undefined;
|
|
116
|
+
draft = undefined;
|
|
117
|
+
}
|
|
118
|
+
return publish({ value: nextValue, selection: nextSelection });
|
|
119
|
+
},
|
|
120
|
+
setSelection(input, expectedRevision) {
|
|
121
|
+
const base = expect(expectedRevision), next = selection(input, value);
|
|
122
|
+
if (closed || revision !== base)
|
|
123
|
+
return fail('STALE');
|
|
124
|
+
if (draft !== undefined)
|
|
125
|
+
return fail('COMPOSING');
|
|
126
|
+
return publish({ value, selection: next });
|
|
127
|
+
},
|
|
128
|
+
begin() {
|
|
129
|
+
live();
|
|
130
|
+
if (session !== undefined)
|
|
131
|
+
return fail('ACTIVE');
|
|
132
|
+
session = freeze({});
|
|
133
|
+
return session;
|
|
134
|
+
},
|
|
135
|
+
observe(token, expected, input) {
|
|
136
|
+
if (!matches(token, expected))
|
|
137
|
+
return 'stale';
|
|
138
|
+
if (draft !== undefined)
|
|
139
|
+
return fail('COMPOSING');
|
|
140
|
+
const next = sample(input);
|
|
141
|
+
if (!matches(token, expected))
|
|
142
|
+
return 'stale';
|
|
143
|
+
return publish(next);
|
|
144
|
+
},
|
|
145
|
+
beginComposition(token, expected) {
|
|
146
|
+
if (!matches(token, expected))
|
|
147
|
+
return false;
|
|
148
|
+
if (draft !== undefined)
|
|
149
|
+
return false;
|
|
150
|
+
draft = freeze({ value, selection: selected });
|
|
151
|
+
return true;
|
|
152
|
+
},
|
|
153
|
+
updateComposition(token, expected, input) {
|
|
154
|
+
if (!matches(token, expected) || draft === undefined)
|
|
155
|
+
return false;
|
|
156
|
+
const next = sample(input, true);
|
|
157
|
+
if (!matches(token, expected) || draft === undefined)
|
|
158
|
+
return false;
|
|
159
|
+
draft = next;
|
|
160
|
+
return true;
|
|
161
|
+
},
|
|
162
|
+
endComposition(token, expected, input) {
|
|
163
|
+
if (!matches(token, expected) || draft === undefined)
|
|
164
|
+
return 'stale';
|
|
165
|
+
const next = sample(input);
|
|
166
|
+
if (!matches(token, expected) || draft === undefined)
|
|
167
|
+
return 'stale';
|
|
168
|
+
draft = undefined;
|
|
169
|
+
return publish(next);
|
|
170
|
+
},
|
|
171
|
+
end(token, expected, how, input) {
|
|
172
|
+
if (closed || session === undefined || token !== session)
|
|
173
|
+
return 'stale';
|
|
174
|
+
if (how !== 'commit' && how !== 'cancel')
|
|
175
|
+
return fail('OPTIONS');
|
|
176
|
+
if (expected !== revision) {
|
|
177
|
+
session = undefined;
|
|
178
|
+
draft = undefined;
|
|
179
|
+
return 'stale';
|
|
180
|
+
}
|
|
181
|
+
let result = 'unchanged';
|
|
182
|
+
if (how === 'commit') {
|
|
183
|
+
if (input === undefined)
|
|
184
|
+
return fail('VALUE');
|
|
185
|
+
const next = sample(input);
|
|
186
|
+
if (!matches(token, expected))
|
|
187
|
+
return 'stale';
|
|
188
|
+
result = publish(next);
|
|
189
|
+
}
|
|
190
|
+
session = undefined;
|
|
191
|
+
draft = undefined;
|
|
192
|
+
return result;
|
|
193
|
+
},
|
|
194
|
+
dispose() {
|
|
195
|
+
if (closed)
|
|
196
|
+
return;
|
|
197
|
+
closed = true;
|
|
198
|
+
session = undefined;
|
|
199
|
+
draft = undefined;
|
|
200
|
+
value = '';
|
|
201
|
+
selected = freeze({ anchor: 0, focus: 0, affinity: 'downstream' });
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return state;
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=textEditState.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Source offsets are UTF-16, never glyph indices or guessed advance widths. */
|
|
2
|
+
export interface TextEditSelection {
|
|
3
|
+
readonly anchor: number;
|
|
4
|
+
readonly focus: number;
|
|
5
|
+
readonly affinity?: 'upstream' | 'downstream';
|
|
6
|
+
}
|
|
7
|
+
export interface TextEditSample {
|
|
8
|
+
readonly value: string;
|
|
9
|
+
readonly selection: TextEditSelection;
|
|
10
|
+
}
|
|
11
|
+
declare const sessionBrand: unique symbol;
|
|
12
|
+
export interface TextEditSession {
|
|
13
|
+
readonly [sessionBrand]: true;
|
|
14
|
+
}
|
|
15
|
+
export interface TextEditSnapshot {
|
|
16
|
+
readonly state: 'idle' | 'editing' | 'composing' | 'closed';
|
|
17
|
+
readonly revision: number;
|
|
18
|
+
readonly value: string;
|
|
19
|
+
readonly selection: Required<TextEditSelection>;
|
|
20
|
+
readonly session: TextEditSession | undefined;
|
|
21
|
+
readonly draft: TextEditSample | undefined;
|
|
22
|
+
}
|
|
23
|
+
export type TextEditResult = 'changed' | 'unchanged' | 'stale';
|
|
24
|
+
export interface TextEditStateOptions {
|
|
25
|
+
readonly mode: 'single-line' | 'multiline';
|
|
26
|
+
readonly value?: string;
|
|
27
|
+
readonly selection?: TextEditSelection;
|
|
28
|
+
/** At most the existing paragraph profile's 8192 UTF-16 units. */
|
|
29
|
+
readonly maxLength?: number;
|
|
30
|
+
}
|
|
31
|
+
/** Pure bounded state. The host owns actual composition, selection and undo. */
|
|
32
|
+
export interface TextEditState {
|
|
33
|
+
readonly mode: TextEditStateOptions['mode'];
|
|
34
|
+
readonly maxLength: number;
|
|
35
|
+
snapshot(): TextEditSnapshot;
|
|
36
|
+
setValue(value: string, selection?: TextEditSelection, expectedRevision?: number, cancelComposition?: boolean): TextEditResult;
|
|
37
|
+
setSelection(selection: TextEditSelection, expectedRevision?: number): TextEditResult;
|
|
38
|
+
begin(): TextEditSession;
|
|
39
|
+
observe(session: TextEditSession, expectedRevision: number, sample: TextEditSample): TextEditResult;
|
|
40
|
+
beginComposition(session: TextEditSession, expectedRevision: number): boolean;
|
|
41
|
+
updateComposition(session: TextEditSession, expectedRevision: number, sample: TextEditSample): boolean;
|
|
42
|
+
endComposition(session: TextEditSession, expectedRevision: number, sample: TextEditSample): TextEditResult;
|
|
43
|
+
/** Cancel drops provisional composition, retaining ordinary committed edits. */
|
|
44
|
+
end(session: TextEditSession, expectedRevision: number, mode: 'commit' | 'cancel', sample?: TextEditSample): TextEditResult;
|
|
45
|
+
dispose(): void;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=textEditTypes.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** Numeric implementation contracts; Engine owns display and source admission. */
|
|
2
|
+
export type UiDirtyKind = 'measure' | 'arrange' | 'paint' | 'interaction' | 'semantic';
|
|
3
|
+
export interface UiSize {
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly height: number;
|
|
6
|
+
}
|
|
7
|
+
export interface UiMeasureInput {
|
|
8
|
+
readonly availableWidth: number;
|
|
9
|
+
readonly availableHeight: number;
|
|
10
|
+
readonly density: number;
|
|
11
|
+
}
|
|
12
|
+
export interface UiMeasurement extends UiSize {
|
|
13
|
+
readonly dependencyRevision: number;
|
|
14
|
+
}
|
|
15
|
+
export interface UiFill {
|
|
16
|
+
readonly color: number;
|
|
17
|
+
readonly alpha?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface UiLayoutNode {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly kind: 'leaf' | 'row' | 'column' | 'virtualList';
|
|
22
|
+
readonly explicitWidth?: number;
|
|
23
|
+
readonly explicitHeight?: number;
|
|
24
|
+
readonly minWidth?: number;
|
|
25
|
+
readonly minHeight?: number;
|
|
26
|
+
readonly maxWidth?: number;
|
|
27
|
+
readonly maxHeight?: number;
|
|
28
|
+
readonly padding?: number;
|
|
29
|
+
readonly gap?: number;
|
|
30
|
+
readonly crossAlign?: 'start' | 'center' | 'end' | 'stretch';
|
|
31
|
+
readonly children?: readonly UiLayoutNode[];
|
|
32
|
+
readonly measure?: (input: UiMeasureInput) => UiMeasurement;
|
|
33
|
+
readonly fill?: UiFill;
|
|
34
|
+
readonly source?: unknown;
|
|
35
|
+
readonly initialScrollOffset?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface UiLayoutTree {
|
|
38
|
+
readonly root: UiLayoutNode;
|
|
39
|
+
readonly nodes: ReadonlyMap<string, UiLayoutNode>;
|
|
40
|
+
}
|
|
41
|
+
export interface UiLayoutBox extends UiSize {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly parentId: string | undefined;
|
|
44
|
+
readonly order: number;
|
|
45
|
+
readonly x: number;
|
|
46
|
+
readonly y: number;
|
|
47
|
+
readonly innerX: number;
|
|
48
|
+
readonly innerY: number;
|
|
49
|
+
readonly innerWidth: number;
|
|
50
|
+
readonly innerHeight: number;
|
|
51
|
+
readonly clip: boolean;
|
|
52
|
+
readonly dependencyRevision: number;
|
|
53
|
+
}
|
|
54
|
+
export interface UiLayoutPlan {
|
|
55
|
+
readonly boxes: readonly UiLayoutBox[];
|
|
56
|
+
readonly measurementCalls: number;
|
|
57
|
+
readonly reusedMeasurements: number;
|
|
58
|
+
}
|
|
59
|
+
export interface UiHeightRecord {
|
|
60
|
+
readonly key: string;
|
|
61
|
+
readonly contentVersion: number;
|
|
62
|
+
readonly estimatedHeight: number;
|
|
63
|
+
}
|
|
64
|
+
export interface UiHeightUpdate {
|
|
65
|
+
readonly key: string;
|
|
66
|
+
readonly contentVersion: number;
|
|
67
|
+
readonly height: number;
|
|
68
|
+
}
|
|
69
|
+
export interface UiScrollAnchor {
|
|
70
|
+
readonly key: string;
|
|
71
|
+
readonly offset: number;
|
|
72
|
+
}
|
|
73
|
+
export interface UiRowRange {
|
|
74
|
+
readonly start: number;
|
|
75
|
+
readonly end: number;
|
|
76
|
+
readonly visibleStart: number;
|
|
77
|
+
readonly visibleEnd: number;
|
|
78
|
+
}
|
|
79
|
+
export interface UiHeightView {
|
|
80
|
+
readonly size: number;
|
|
81
|
+
readonly totalHeight: number;
|
|
82
|
+
readonly measuredCount: number;
|
|
83
|
+
keyAt(index: number): string;
|
|
84
|
+
versionAt(index: number): number;
|
|
85
|
+
heightAt(index: number): number;
|
|
86
|
+
indexOf(key: string): number;
|
|
87
|
+
prefix(end: number): number;
|
|
88
|
+
find(offset: number): number;
|
|
89
|
+
range(scroll: number, viewport: number, overscan?: number): UiRowRange;
|
|
90
|
+
anchor(scroll: number): UiScrollAnchor | undefined;
|
|
91
|
+
clampScroll(scroll: number, viewport: number): number;
|
|
92
|
+
preserveAnchor(anchor: UiScrollAnchor | undefined, old: UiHeightView, viewport: number): number;
|
|
93
|
+
}
|
|
94
|
+
export interface UiHeightJournal extends UiHeightView {
|
|
95
|
+
readonly cellWork: number;
|
|
96
|
+
readonly changedCount: number;
|
|
97
|
+
apply(): void;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/ui/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egret/runtime",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "7.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./text": {
|
|
11
|
+
"types": "./dist/text/index.d.ts",
|
|
12
|
+
"import": "./dist/text/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./input": {
|
|
15
|
+
"types": "./dist/input/index.d.ts",
|
|
16
|
+
"import": "./dist/input/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./ui": {
|
|
19
|
+
"types": "./dist/ui/index.d.ts",
|
|
20
|
+
"import": "./dist/ui/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./paragraph": {
|
|
23
|
+
"types": "./dist/paragraph/index.d.ts",
|
|
24
|
+
"import": "./dist/paragraph/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./ui/editing": {
|
|
27
|
+
"types": "./dist/ui/editing.d.ts",
|
|
28
|
+
"import": "./dist/ui/editing.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@egret/contracts": "7.0.2"
|
|
33
|
+
},
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md",
|
|
38
|
+
"README.zh-CN.md",
|
|
39
|
+
"LICENSE",
|
|
40
|
+
"NOTICE"
|
|
41
|
+
],
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/cnedwin/Egret_rebuild.git"
|
|
45
|
+
}
|
|
46
|
+
}
|