11import assert from '../style-spec/util/assert' ;
2- import { clone , easeCubicInOut , sphericalDirectionToCartesian , sphericalPositionToCartesian } from '../util/util' ;
2+ import { easeCubicInOut , sphericalDirectionToCartesian , sphericalPositionToCartesian } from '../util/util' ;
33import * as interpolate from '../style-spec/util/interpolate' ;
44import { number as interpolateValue } from '../style-spec/util/interpolate' ;
55import { normalizePropertyExpression } from '../style-spec/expression/index' ;
@@ -209,7 +209,7 @@ export class Transitionable<Props extends {[Key in keyof Props]: Props[Key]}> {
209209 }
210210
211211 getValue < S extends keyof Props , T > ( name : S ) : PropertyValueSpecification < T > | undefined {
212- return clone ( this . _values [ name ] . value . value as PropertyValueSpecification < T > | undefined ) ;
212+ return structuredClone ( this . _values [ name ] . value . value as PropertyValueSpecification < T > | undefined ) ;
213213 }
214214
215215 setValue < S extends keyof Props , T > ( name : S , value ?: PropertyValueSpecification < T > ) {
@@ -218,7 +218,7 @@ export class Transitionable<Props extends {[Key in keyof Props]: Props[Key]}> {
218218 }
219219 // Note that we do not _remove_ an own property in the case where a value is being reset
220220 // to the default: the transition might still be non-default.
221- this . _values [ name ] . value = new PropertyValue ( this . _values [ name ] . property , value === null ? undefined : clone ( value ) , this . _scope , this . _options , this . _iconImageUseTheme ) ;
221+ this . _values [ name ] . value = new PropertyValue ( this . _values [ name ] . property , value === null ? undefined : structuredClone ( value ) , this . _scope , this . _options , this . _iconImageUseTheme ) ;
222222 if ( this . _values [ name ] . value . expression . configDependencies ) {
223223 this . configDependencies = new Set ( [ ...this . configDependencies , ...this . _values [ name ] . value . expression . configDependencies ] ) ;
224224 this . _isIndoorDependent = this . _isIndoorDependent || this . _values [ name ] . value . isIndoorDependent ( ) ;
@@ -245,14 +245,14 @@ export class Transitionable<Props extends {[Key in keyof Props]: Props[Key]}> {
245245 }
246246
247247 getTransition < S extends keyof Props > ( name : S ) : TransitionSpecification | undefined {
248- return clone ( this . _values [ name ] . transition ) ;
248+ return structuredClone ( this . _values [ name ] . transition ) ;
249249 }
250250
251251 setTransition < S extends keyof Props > ( name : S , value ?: TransitionSpecification ) {
252252 if ( ! Object . hasOwn ( this . _values , name ) ) {
253253 this . _values [ name ] = new TransitionablePropertyValue ( this . _values [ name ] . property ) as TransitionablePropertyValues < Props > [ S ] ;
254254 }
255- this . _values [ name ] . transition = clone ( value ) || undefined ;
255+ this . _values [ name ] . transition = structuredClone ( value ) || undefined ;
256256 }
257257
258258 serialize ( ) : PropertyValueSpecifications < Props > {
@@ -474,11 +474,11 @@ export class Layout<Props extends {
474474 }
475475
476476 getValue < S extends keyof Props , T > ( name : S ) : PropertyValueSpecification < T > | void {
477- return clone ( this . _values [ name ] . value as PropertyValueSpecification < T > | void ) ;
477+ return structuredClone ( this . _values [ name ] . value as PropertyValueSpecification < T > | void ) ;
478478 }
479479
480480 setValue < S extends keyof Props > ( name : S , value : unknown ) {
481- this . _values [ name ] = new PropertyValue ( this . _values [ name ] . property , value === null ? undefined : clone ( value ) , this . _scope , this . _options , this . _iconImageUseTheme ) as PropertyValues < Props > [ S ] ;
481+ this . _values [ name ] = new PropertyValue ( this . _values [ name ] . property , value === null ? undefined : structuredClone ( value ) , this . _scope , this . _options , this . _iconImageUseTheme ) as PropertyValues < Props > [ S ] ;
482482 if ( this . _values [ name ] . expression . configDependencies ) {
483483 this . configDependencies = new Set ( [ ...this . configDependencies , ...this . _values [ name ] . expression . configDependencies ] ) ;
484484 this . _isIndoorDependent = this . _isIndoorDependent || this . _values [ name ] . isIndoorDependent ( ) ;
0 commit comments