(range: CodeRange, code: string, duration: number)
| 220 | } |
| 221 | |
| 222 | private *replaceTween(range: CodeRange, code: string, duration: number) { |
| 223 | let current = this.get(); |
| 224 | const [fragments, index] = extractRange(range, current.fragments); |
| 225 | const progress = createSignal(0); |
| 226 | const scope = { |
| 227 | progress, |
| 228 | fragments: [replace(fragments[index] as string, code)], |
| 229 | }; |
| 230 | fragments[index] = scope; |
| 231 | this.set({ |
| 232 | progress: current.progress, |
| 233 | fragments, |
| 234 | }); |
| 235 | |
| 236 | yield* progress(1, duration); |
| 237 | |
| 238 | current = this.get(); |
| 239 | this.set({ |
| 240 | progress: current.progress, |
| 241 | fragments: current.fragments.map(fragment => |
| 242 | fragment === scope ? code : fragment, |
| 243 | ), |
| 244 | }); |
| 245 | progress.context.dispose(); |
| 246 | } |
| 247 | |
| 248 | private *editTween(value: CodeTag[], duration: number) { |
| 249 | this.progress(0); |
no test coverage detected