1
1
import type * as CompilerDOM from '@vue/compiler-dom' ;
2
2
import type { SFCBlock , SFCParseResult } from '@vue/compiler-sfc' ;
3
- import { Computed , computed , Signal , System , Unstable } from 'alien-signals' ;
3
+ import { computed , ISignal , Signal , System , Unstable } from 'alien-signals' ;
4
4
import type * as ts from 'typescript' ;
5
5
import type { Sfc , SfcBlock , SFCStyleOverride , VueLanguagePluginReturn } from '../types' ;
6
6
import { parseCssClassNames } from '../utils/parseCssClassNames' ;
@@ -11,14 +11,14 @@ export function computedSfc(
11
11
plugins : VueLanguagePluginReturn [ ] ,
12
12
fileName : string ,
13
13
snapshot : Signal < ts . IScriptSnapshot > ,
14
- parsed : Computed < SFCParseResult | undefined >
14
+ parsed : ISignal < SFCParseResult | undefined >
15
15
) : Sfc {
16
16
17
17
const untrackedSnapshot = ( ) => {
18
- const depth = System . activeSubsDepth ;
19
- System . activeSubsDepth = 0 ;
18
+ const prevTrackId = System . activeTrackId = 0 ;
19
+ System . activeTrackId = 0 ;
20
20
const res = snapshot . get ( ) ;
21
- System . activeSubsDepth = depth ;
21
+ System . activeTrackId = prevTrackId ;
22
22
return res ;
23
23
} ;
24
24
const content = computed ( ( ) => {
@@ -180,10 +180,10 @@ export function computedSfc(
180
180
const change = untrackedSnapshot ( ) . getChangeRange ( cache . snapshot ) ;
181
181
if ( change ) {
182
182
183
- const depth = System . activeSubsDepth ;
184
- System . activeSubsDepth = 0 ;
183
+ const prevTrackId = System . activeTrackId ;
184
+ System . activeTrackId = 0 ;
185
185
const templateOffset = base . startTagEnd ;
186
- System . activeSubsDepth = depth ;
186
+ System . activeTrackId = prevTrackId ;
187
187
188
188
const newText = untrackedSnapshot ( ) . getText ( change . span . start , change . span . start + change . newLength ) ;
189
189
const newResult = cache . plugin . updateSFCTemplate ( cache . result , {
@@ -263,8 +263,8 @@ export function computedSfc(
263
263
function computedNullableSfcBlock < T extends SFCBlock , K extends SfcBlock > (
264
264
name : string ,
265
265
defaultLang : string ,
266
- block : Computed < T | undefined > ,
267
- resolve : ( block : Computed < T > , base : SfcBlock ) => K
266
+ block : ISignal < T | undefined > ,
267
+ resolve : ( block : ISignal < T > , base : SfcBlock ) => K
268
268
) {
269
269
const hasBlock = computed ( ( ) => ! ! block . get ( ) ) ;
270
270
return computed < K | undefined > ( ( ) => {
@@ -279,7 +279,7 @@ export function computedSfc(
279
279
function computedSfcBlock < T extends SFCBlock > (
280
280
name : string ,
281
281
defaultLang : string ,
282
- block : Computed < T >
282
+ block : ISignal < T >
283
283
) {
284
284
const lang = computed ( ( ) => block . get ( ) . lang ?? defaultLang ) ;
285
285
const attrs = computed ( ( ) => block . get ( ) . attrs ) ; // TODO: computed it
0 commit comments