@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.
Files changed (155) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +21 -0
  3. package/README.md +70 -2
  4. package/README.zh-CN.md +71 -0
  5. package/dist/AssetLease.d.ts +23 -0
  6. package/dist/AssetLease.js +69 -0
  7. package/dist/AssetManager.d.ts +56 -0
  8. package/dist/AssetManager.js +451 -0
  9. package/dist/AssetRef.d.ts +20 -0
  10. package/dist/AssetRef.js +32 -0
  11. package/dist/Bitmap.d.ts +40 -0
  12. package/dist/Bitmap.js +545 -0
  13. package/dist/ByteReader.d.ts +30 -0
  14. package/dist/ByteReader.js +177 -0
  15. package/dist/ByteWriter.d.ts +29 -0
  16. package/dist/ByteWriter.js +180 -0
  17. package/dist/CancellationController.d.ts +10 -0
  18. package/dist/CancellationController.js +66 -0
  19. package/dist/DisplayObject.d.ts +89 -0
  20. package/dist/DisplayObject.js +340 -0
  21. package/dist/DisplayObjectContainer.d.ts +28 -0
  22. package/dist/DisplayObjectContainer.js +226 -0
  23. package/dist/EgretError.d.ts +11 -0
  24. package/dist/EgretError.js +36 -0
  25. package/dist/Event.d.ts +45 -0
  26. package/dist/Event.js +84 -0
  27. package/dist/EventDispatcher.d.ts +24 -0
  28. package/dist/EventDispatcher.js +178 -0
  29. package/dist/Graphics.d.ts +106 -0
  30. package/dist/Graphics.js +504 -0
  31. package/dist/Mesh2D.d.ts +27 -0
  32. package/dist/Mesh2D.js +200 -0
  33. package/dist/NineSliceBitmap.d.ts +24 -0
  34. package/dist/NineSliceBitmap.js +164 -0
  35. package/dist/NineSliceGeometry2D.d.ts +18 -0
  36. package/dist/NineSliceGeometry2D.js +126 -0
  37. package/dist/Scope.d.ts +18 -0
  38. package/dist/Scope.js +133 -0
  39. package/dist/SequencePlayer.d.ts +12 -0
  40. package/dist/SequencePlayer.js +69 -0
  41. package/dist/Sprite.d.ts +8 -0
  42. package/dist/Sprite.js +12 -0
  43. package/dist/Stage.d.ts +14 -0
  44. package/dist/Stage.js +31 -0
  45. package/dist/Texture.d.ts +29 -0
  46. package/dist/Texture.js +177 -0
  47. package/dist/assetManagerOwnerState.d.ts +36 -0
  48. package/dist/assetManagerOwnerState.js +115 -0
  49. package/dist/assetState.d.ts +44 -0
  50. package/dist/assetState.js +2 -0
  51. package/dist/atlasFrameLayout.d.ts +21 -0
  52. package/dist/atlasFrameLayout.js +48 -0
  53. package/dist/bitmapDisplayState.d.ts +24 -0
  54. package/dist/bitmapDisplayState.js +22 -0
  55. package/dist/coordinateInverse.d.ts +4 -0
  56. package/dist/coordinateInverse.js +107 -0
  57. package/dist/diagnostics.d.ts +4 -0
  58. package/dist/diagnostics.js +13 -0
  59. package/dist/displayBounds.d.ts +9 -0
  60. package/dist/displayBounds.js +181 -0
  61. package/dist/displayCoordinates.d.ts +8 -0
  62. package/dist/displayCoordinates.js +81 -0
  63. package/dist/displayHitState.d.ts +18 -0
  64. package/dist/displayHitState.js +97 -0
  65. package/dist/displayHitTest.d.ts +8 -0
  66. package/dist/displayHitTest.js +219 -0
  67. package/dist/displayInputOperations.d.ts +12 -0
  68. package/dist/displayInputOperations.js +71 -0
  69. package/dist/displayTransform.d.ts +5 -0
  70. package/dist/displayTransform.js +38 -0
  71. package/dist/displayTreeState.d.ts +90 -0
  72. package/dist/displayTreeState.js +450 -0
  73. package/dist/displayVisualState.d.ts +74 -0
  74. package/dist/displayVisualState.js +140 -0
  75. package/dist/errorHelp.d.ts +14 -0
  76. package/dist/errorHelp.js +432 -0
  77. package/dist/errorHelpZh.d.ts +5 -0
  78. package/dist/errorHelpZh.js +340 -0
  79. package/dist/graphicsFill.d.ts +37 -0
  80. package/dist/graphicsFill.js +302 -0
  81. package/dist/graphicsShape.d.ts +144 -0
  82. package/dist/graphicsShape.js +755 -0
  83. package/dist/index.d.ts +50 -0
  84. package/dist/index.js +28 -0
  85. package/dist/input/PointerRouter.d.ts +4 -0
  86. package/dist/input/PointerRouter.js +453 -0
  87. package/dist/input/index.d.ts +3 -0
  88. package/dist/input/index.js +3 -0
  89. package/dist/input/types.d.ts +58 -0
  90. package/dist/input/types.js +3 -0
  91. package/dist/meshCaptureSnapshot.d.ts +5 -0
  92. package/dist/meshCaptureSnapshot.js +13 -0
  93. package/dist/meshDisplayState.d.ts +18 -0
  94. package/dist/meshDisplayState.js +21 -0
  95. package/dist/ownership.d.ts +75 -0
  96. package/dist/ownership.js +157 -0
  97. package/dist/paragraph/Paragraph.d.ts +13 -0
  98. package/dist/paragraph/Paragraph.js +193 -0
  99. package/dist/paragraph/ParagraphCache.d.ts +5 -0
  100. package/dist/paragraph/ParagraphCache.js +354 -0
  101. package/dist/paragraph/geometry.d.ts +4 -0
  102. package/dist/paragraph/geometry.js +180 -0
  103. package/dist/paragraph/index.d.ts +3 -0
  104. package/dist/paragraph/index.js +3 -0
  105. package/dist/paragraph/request.d.ts +6 -0
  106. package/dist/paragraph/request.js +191 -0
  107. package/dist/paragraph/types.d.ts +183 -0
  108. package/dist/paragraph/types.js +2 -0
  109. package/dist/preparedDisplaySubtree.d.ts +7 -0
  110. package/dist/preparedDisplaySubtree.js +205 -0
  111. package/dist/renderEffect.d.ts +47 -0
  112. package/dist/renderEffect.js +87 -0
  113. package/dist/sequenceClip.d.ts +42 -0
  114. package/dist/sequenceClip.js +196 -0
  115. package/dist/sharedFrameCapture.d.ts +24 -0
  116. package/dist/sharedFrameCapture.js +1069 -0
  117. package/dist/spriteSheet.d.ts +34 -0
  118. package/dist/spriteSheet.js +321 -0
  119. package/dist/srgbBytes.d.ts +3 -0
  120. package/dist/srgbBytes.js +64 -0
  121. package/dist/text/TextField.d.ts +13 -0
  122. package/dist/text/TextField.js +261 -0
  123. package/dist/text/TextRasterCache.d.ts +5 -0
  124. package/dist/text/TextRasterCache.js +1191 -0
  125. package/dist/text/budget.d.ts +51 -0
  126. package/dist/text/budget.js +116 -0
  127. package/dist/text/index.d.ts +4 -0
  128. package/dist/text/index.js +3 -0
  129. package/dist/text/plan.d.ts +16 -0
  130. package/dist/text/plan.js +238 -0
  131. package/dist/text/request.d.ts +44 -0
  132. package/dist/text/request.js +303 -0
  133. package/dist/text/types.d.ts +179 -0
  134. package/dist/text/types.js +2 -0
  135. package/dist/textDisplayState.d.ts +21 -0
  136. package/dist/textDisplayState.js +27 -0
  137. package/dist/ui/displayCommit.d.ts +43 -0
  138. package/dist/ui/displayCommit.js +376 -0
  139. package/dist/ui/editing.d.ts +3 -0
  140. package/dist/ui/editing.js +3 -0
  141. package/dist/ui/heightIndex.d.ts +35 -0
  142. package/dist/ui/heightIndex.js +295 -0
  143. package/dist/ui/index.d.ts +6 -0
  144. package/dist/ui/index.js +6 -0
  145. package/dist/ui/layout.d.ts +9 -0
  146. package/dist/ui/layout.js +349 -0
  147. package/dist/ui/managedState.d.ts +12 -0
  148. package/dist/ui/managedState.js +44 -0
  149. package/dist/ui/textEditState.d.ts +4 -0
  150. package/dist/ui/textEditState.js +206 -0
  151. package/dist/ui/textEditTypes.d.ts +48 -0
  152. package/dist/ui/textEditTypes.js +2 -0
  153. package/dist/ui/types.d.ts +99 -0
  154. package/dist/ui/types.js +2 -0
  155. package/package.json +44 -4
@@ -0,0 +1,87 @@
1
+ import { readBitmapState as bitmapCaptureState } from './bitmapDisplayState.js';
2
+ import { assertLive } from './displayTreeState.js';
3
+ import { engineOf } from './ownership.js';
4
+ import { assertVisualMutable, copyRect, visualOf, recordVisualChange, VISUAL_APPEARANCE } from './displayVisualState.js';
5
+ import { EgretError } from './EgretError.js';
6
+ const finite = (value) => typeof value === 'number' && Number.isFinite(value);
7
+ const between = (value, low, high) => finite(value) && value >= low && value <= high;
8
+ const colour = (value) => Number.isSafeInteger(value) && value >= 0 && value <= 0xffffff;
9
+ const flag = (value) => {
10
+ if (value !== undefined && typeof value !== 'boolean')
11
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
12
+ return value === true;
13
+ };
14
+ function readMatrix(input) {
15
+ if (!Array.isArray(input) || input.length !== 20)
16
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
17
+ const copy = Array.from({ length: 20 }, (_, i) => {
18
+ const value = input[i];
19
+ if (!finite(value) || Math.abs(value) > 65536)
20
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
21
+ return value;
22
+ });
23
+ return Object.freeze(copy);
24
+ }
25
+ function readGlow(input) {
26
+ if (input === null || typeof input !== 'object')
27
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
28
+ const { color, alpha = 1, blur = 6, strength = 2, offsetX = 0, offsetY = 0 } = input, inner = flag(input.inner), knockout = flag(input.knockout);
29
+ if (!colour(color) ||
30
+ !between(alpha, 0, 1) ||
31
+ !between(blur, 0, 16) ||
32
+ !between(strength, 0, 255) ||
33
+ !between(offsetX, -256, 256) ||
34
+ !between(offsetY, -256, 256))
35
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
36
+ return Object.freeze({ color, alpha, blur, strength, inner, knockout, offsetX, offsetY });
37
+ }
38
+ function readOutline(input) {
39
+ if (input === null || typeof input !== 'object')
40
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
41
+ const { color, width, alpha = 1 } = input;
42
+ if (!colour(color) || !between(width, 1, 8) || !between(alpha, 0, 1))
43
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
44
+ return Object.freeze({ color, width, alpha });
45
+ }
46
+ export function setRenderEffect(node, input) {
47
+ assertVisualMutable(node);
48
+ let value;
49
+ if (input !== undefined) {
50
+ if (input === null || typeof input !== 'object')
51
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
52
+ const radius = input.blurRadius ?? 0, mask = input.alphaMask, rect = input.maskRect;
53
+ if (!Number.isInteger(radius) || radius < 0 || radius > 8)
54
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
55
+ let bounds;
56
+ if (mask !== undefined) {
57
+ if (!bitmapCaptureState(mask))
58
+ throw new EgretError('DISPLAY_EFFECT_MASK_INVALID');
59
+ assertLive(mask);
60
+ if (engineOf(mask) !== engineOf(node))
61
+ throw new EgretError('ENGINE_MISMATCH');
62
+ if (rect === undefined)
63
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
64
+ bounds = copyRect(rect, 'DISPLAY_EFFECT_INVALID');
65
+ if (bounds.width <= 0 || bounds.height <= 0)
66
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
67
+ }
68
+ else if (rect !== undefined)
69
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
70
+ const matrix = input.colorMatrix === undefined ? undefined : readMatrix(input.colorMatrix);
71
+ const glow = input.glow === undefined ? undefined : readGlow(input.glow), outline = input.outline === undefined ? undefined : readOutline(input.outline);
72
+ if (glow !== undefined && outline !== undefined)
73
+ throw new EgretError('DISPLAY_EFFECT_INVALID');
74
+ value = Object.freeze({
75
+ blurRadius: radius,
76
+ ...(mask === undefined ? {} : { alphaMask: mask, maskRect: bounds }),
77
+ ...(matrix === undefined ? {} : { colorMatrix: matrix }),
78
+ ...(glow === undefined ? {} : { glow }),
79
+ ...(outline === undefined ? {} : { outline })
80
+ });
81
+ }
82
+ // Descriptor reads may execute application getters; publish only after life recheck.
83
+ assertVisualMutable(node);
84
+ visualOf(node).renderEffect = value;
85
+ recordVisualChange(node, VISUAL_APPEARANCE);
86
+ }
87
+ //# sourceMappingURL=renderEffect.js.map
@@ -0,0 +1,42 @@
1
+ import type { AtlasFrameLayout } from './atlasFrameLayout.js';
2
+ export interface SequenceFrameInput {
3
+ readonly layout?: AtlasFrameLayout;
4
+ readonly x: number;
5
+ readonly y: number;
6
+ readonly width: number;
7
+ readonly height: number;
8
+ readonly durationSeconds: number;
9
+ }
10
+ export interface SequenceClipInput {
11
+ readonly atlasWidth: number;
12
+ readonly atlasHeight: number;
13
+ readonly frames: readonly SequenceFrameInput[];
14
+ }
15
+ export type SequencePlaybackMode = 'once' | 'loop';
16
+ /** Public immutable sequence metadata; authentic values come from createSequenceClip. */
17
+ export interface SequenceClip {
18
+ readonly atlasWidth: number;
19
+ readonly atlasHeight: number;
20
+ readonly frameCount: number;
21
+ readonly durationSeconds: number;
22
+ }
23
+ export interface SequenceRegion {
24
+ readonly layout?: AtlasFrameLayout;
25
+ readonly x: number;
26
+ readonly y: number;
27
+ readonly width: number;
28
+ readonly height: number;
29
+ }
30
+ export interface SequenceSample {
31
+ readonly frameIndex: number;
32
+ readonly region: SequenceRegion;
33
+ readonly positionSeconds: number;
34
+ readonly atEnd: boolean;
35
+ readonly stopped: boolean;
36
+ }
37
+ export declare function createSequenceClip(input: unknown, profile?: 'trim-rotation-v1'): SequenceClip;
38
+ export declare function sampleSequenceClip(clip: SequenceClip, elapsedSeconds: number, options: {
39
+ readonly mode: 'once' | 'loop';
40
+ readonly stopAtSeconds?: number;
41
+ }): SequenceSample;
42
+ //# sourceMappingURL=sequenceClip.d.ts.map
@@ -0,0 +1,196 @@
1
+ import { captureAtlasFrameLayout, copyAtlasFrameLayout } from './atlasFrameLayout.js';
2
+ class SequenceClipError extends Error {
3
+ code;
4
+ constructor(code, cause) {
5
+ super(code, { cause });
6
+ this.code = code;
7
+ this.name = 'SequenceClipError';
8
+ }
9
+ }
10
+ const MAX_FRAMES = 1024;
11
+ // Identity comes only from this module. Copies and proxies never gain authority,
12
+ // and the private value retains no caller object, array, clock or image resource.
13
+ const clips = new WeakMap();
14
+ function admitObject(value) {
15
+ if (typeof value !== 'object' || value === null)
16
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
17
+ let array;
18
+ // Catch only the source admission operation. Preserve its actual cause;
19
+ // never recreate a revoked proxy's native exception with a second probe.
20
+ try {
21
+ array = Array.isArray(value);
22
+ }
23
+ catch (cause) {
24
+ throw new SequenceClipError('SEQ_READ_FAILED', cause);
25
+ }
26
+ if (array)
27
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
28
+ return value;
29
+ }
30
+ function admitFrames(value) {
31
+ let array;
32
+ try {
33
+ array = Array.isArray(value);
34
+ }
35
+ catch (cause) {
36
+ throw new SequenceClipError('SEQ_READ_FAILED', cause);
37
+ }
38
+ if (!array)
39
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
40
+ return value;
41
+ }
42
+ function captureOwn(source, key) {
43
+ let present, value = undefined;
44
+ try {
45
+ present = Object.hasOwn(source, key);
46
+ if (present)
47
+ value = source[key];
48
+ }
49
+ catch (cause) {
50
+ // Never classify caller throws by their name, class or code. This wrapper
51
+ // preserves the actual occurrence and exact cause, including throw undefined.
52
+ throw new SequenceClipError('SEQ_READ_FAILED', cause);
53
+ }
54
+ return { present, value };
55
+ }
56
+ function positiveSafeInteger(value) {
57
+ return typeof value === 'number' && Number.isSafeInteger(value) && value > 0;
58
+ }
59
+ function nonnegativeSafeInteger(value) {
60
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
61
+ }
62
+ function nonnegativeFinite(value) {
63
+ return typeof value === 'number' && Number.isFinite(value) && value >= 0;
64
+ }
65
+ function positiveZero(value) {
66
+ return value === 0 ? 0 : value;
67
+ }
68
+ export function createSequenceClip(input, profile) {
69
+ const source = admitObject(input);
70
+ if (profile !== undefined && profile !== 'trim-rotation-v1')
71
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
72
+ // Capture all required own fields in order before interpreting their values.
73
+ // Missing fields do not suppress a later source fault in this capture stage.
74
+ const widthField = captureOwn(source, 'atlasWidth');
75
+ const heightField = captureOwn(source, 'atlasHeight');
76
+ const framesField = captureOwn(source, 'frames');
77
+ const frames = admitFrames(framesField.value);
78
+ const lengthField = captureOwn(frames, 'length');
79
+ const length = lengthField.value;
80
+ if (!framesField.present || !lengthField.present || !positiveSafeInteger(length))
81
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
82
+ if (length > MAX_FRAMES)
83
+ throw new SequenceClipError('SEQ_BUDGET');
84
+ const atlasWidth = widthField.value, atlasHeight = heightField.value;
85
+ if (!widthField.present ||
86
+ !heightField.present ||
87
+ !positiveSafeInteger(atlasWidth) ||
88
+ !positiveSafeInteger(atlasHeight))
89
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
90
+ const regions = [], ends = [];
91
+ let durationSeconds = 0;
92
+ for (let index = 0; index < length; index++) {
93
+ const entry = captureOwn(frames, String(index));
94
+ if (!entry.present)
95
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
96
+ const frame = admitObject(entry.value);
97
+ const xField = captureOwn(frame, 'x');
98
+ const yField = captureOwn(frame, 'y');
99
+ const frameWidthField = captureOwn(frame, 'width');
100
+ const frameHeightField = captureOwn(frame, 'height');
101
+ const durationField = captureOwn(frame, 'durationSeconds');
102
+ const capturedLayout = profile === undefined
103
+ ? undefined
104
+ : captureAtlasFrameLayout(frame, captureOwn, callback => {
105
+ try {
106
+ return callback();
107
+ }
108
+ catch (cause) {
109
+ throw new SequenceClipError('SEQ_READ_FAILED', cause);
110
+ }
111
+ });
112
+ if (!xField.present ||
113
+ !yField.present ||
114
+ !frameWidthField.present ||
115
+ !frameHeightField.present ||
116
+ !durationField.present)
117
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
118
+ const x = xField.value, y = yField.value, width = frameWidthField.value, height = frameHeightField.value;
119
+ if (!nonnegativeSafeInteger(x) ||
120
+ !nonnegativeSafeInteger(y) ||
121
+ !positiveSafeInteger(width) ||
122
+ !positiveSafeInteger(height))
123
+ throw new SequenceClipError('SEQ_REGION_INVALID');
124
+ const right = x + width, bottom = y + height;
125
+ if (!Number.isSafeInteger(right) || !Number.isSafeInteger(bottom) || right > atlasWidth || bottom > atlasHeight)
126
+ throw new SequenceClipError('SEQ_REGION_INVALID');
127
+ const layout = capturedLayout === undefined
128
+ ? undefined
129
+ : copyAtlasFrameLayout(capturedLayout, width, height, kind => {
130
+ throw new SequenceClipError(kind === 'shape' ? 'SEQ_INPUT_INVALID' : 'SEQ_REGION_INVALID');
131
+ });
132
+ const duration = durationField.value;
133
+ if (typeof duration !== 'number' || !Number.isFinite(duration) || duration <= 0)
134
+ throw new SequenceClipError('SEQ_TIME_INVALID');
135
+ // Seconds stay binary64, including positive subnormals. Each input-order
136
+ // increment must survive rounding; no integer-tick or float32 conversion.
137
+ const end = durationSeconds + duration;
138
+ if (!Number.isFinite(end) || end <= durationSeconds)
139
+ throw new SequenceClipError('SEQ_TIME_INVALID');
140
+ regions.push({
141
+ x: positiveZero(x),
142
+ y: positiveZero(y),
143
+ width,
144
+ height,
145
+ ...(layout === undefined ? {} : { layout })
146
+ });
147
+ ends.push(end);
148
+ durationSeconds = end;
149
+ }
150
+ for (const region of regions)
151
+ Object.freeze(region);
152
+ const owned = Object.freeze({
153
+ regions: Object.freeze(regions),
154
+ ends: Object.freeze(ends),
155
+ durationSeconds
156
+ });
157
+ const clip = Object.freeze({ atlasWidth, atlasHeight, frameCount: length, durationSeconds });
158
+ // Publish identity only after all validation, owned allocation and freezing.
159
+ clips.set(clip, owned);
160
+ return clip;
161
+ }
162
+ export function sampleSequenceClip(clip, elapsedSeconds, options) {
163
+ const owned = typeof clip === 'object' && clip !== null ? clips.get(clip) : undefined;
164
+ if (!owned)
165
+ throw new SequenceClipError('SEQ_CLIP_INVALID');
166
+ if (!nonnegativeFinite(elapsedSeconds))
167
+ throw new SequenceClipError('SEQ_TIME_INVALID');
168
+ const source = admitObject(options);
169
+ const modeField = captureOwn(source, 'mode');
170
+ const stopField = captureOwn(source, 'stopAtSeconds');
171
+ const mode = modeField.value, stopAtSeconds = stopField.value;
172
+ if (!modeField.present || (mode !== 'once' && mode !== 'loop'))
173
+ throw new SequenceClipError('SEQ_INPUT_INVALID');
174
+ const stopped = stopField.present && stopAtSeconds !== undefined;
175
+ if (stopped && !nonnegativeFinite(stopAtSeconds))
176
+ throw new SequenceClipError('SEQ_TIME_INVALID');
177
+ const time = stopped ? stopAtSeconds : elapsedSeconds;
178
+ const atEnd = mode === 'once' && time >= owned.durationSeconds;
179
+ const positionSeconds = positiveZero(mode === 'loop' ? time % owned.durationSeconds : atEnd ? owned.durationSeconds : time);
180
+ let frameIndex = owned.ends.length - 1;
181
+ if (!atEnd) {
182
+ // Upper bound selects the first end strictly greater than the position.
183
+ // With 1..1024 ends this takes at most 11 comparisons, independent of cycles.
184
+ let low = 0, high = owned.ends.length;
185
+ while (low < high) {
186
+ const middle = low + Math.floor((high - low) / 2);
187
+ if (positionSeconds < owned.ends[middle])
188
+ high = middle;
189
+ else
190
+ low = middle + 1;
191
+ }
192
+ frameIndex = low;
193
+ }
194
+ return Object.freeze({ frameIndex, region: owned.regions[frameIndex], positionSeconds, atEnd, stopped });
195
+ }
196
+ //# sourceMappingURL=sequenceClip.js.map
@@ -0,0 +1,24 @@
1
+ import type { SharedGeometry2D, SharedMaterial2D, SharedPage2D, SharedRegion2D, SharedRenderCommand2D, TexturedGeometry2D } from '@egret/contracts';
2
+ import type { Stage } from './Stage.js';
3
+ import type { DisplayObject } from './DisplayObject.js';
4
+ import type { DisplayObjectContainer } from './DisplayObjectContainer.js';
5
+ import type { BitmapCaptureView } from './bitmapDisplayState.js';
6
+ export interface CapturedSharedContent2D {
7
+ readonly commands: readonly SharedRenderCommand2D[];
8
+ readonly pages: readonly SharedPage2D[];
9
+ readonly regions: readonly SharedRegion2D[];
10
+ readonly materials: readonly SharedMaterial2D[];
11
+ readonly geometries: readonly (TexturedGeometry2D | SharedGeometry2D)[];
12
+ }
13
+ /**
14
+ * Iterative capture. All mutable owners stay inside this invocation, except what each node keeps of its own
15
+ * derived records.
16
+ */
17
+ export declare function collectSharedFrameContent(stage: Stage): CapturedSharedContent2D;
18
+ /** The same capture with nothing kept read or written: every record is derived anew. Never forwarded by a package root. */
19
+ export declare function collectFreshSharedFrameContent(stage: Stage): CapturedSharedContent2D;
20
+ /** Runtime-private fixed Bitmap assembly; never forwarded by a package root. */
21
+ export declare function collectPreparedSharedFrameContent(stage: Stage, view: BitmapCaptureView): CapturedSharedContent2D;
22
+ /** Private single-edge overlay; ordinary capture always uses the unchanged live readers. */
23
+ export declare function collectSubtreeSharedFrameContent(stage: Stage, target: DisplayObjectContainer, candidate: DisplayObject): CapturedSharedContent2D;
24
+ //# sourceMappingURL=sharedFrameCapture.d.ts.map