@@ -4,6 +4,7 @@ import { variableToColorName } from "../tailwind/conversionTables";
44import { HasGeometryTrait , Node , Paint } from "../api_types" ;
55import { calculateRectangleFromBoundingBox } from "../common/commonPosition" ;
66import { isLikelyIcon } from "./iconDetection" ;
7+ import { AltNode } from "../alt_api_types" ;
78
89// Performance tracking counters
910export let getNodeByIdAsyncTime = 0 ;
@@ -265,10 +266,10 @@ function adjustChildrenOrder(node: any) {
265266 * @returns Potentially modified jsonNode, array of nodes (for inlined groups), or null
266267 */
267268const processNodePair = async (
268- jsonNode : Node ,
269+ jsonNode : AltNode ,
269270 figmaNode : SceneNode ,
270271 settings : PluginSettings ,
271- parentNode ?: Node ,
272+ parentNode ?: AltNode ,
272273 parentCumulativeRotation : number = 0 ,
273274) : Promise < Node | Node [ ] | null > => {
274275 if ( ! jsonNode . id ) return null ;
@@ -303,7 +304,7 @@ const processNodePair = async (
303304 ) ;
304305 }
305306
306- if ( "rotation" in jsonNode ) {
307+ if ( "rotation" in jsonNode && jsonNode . rotation ) {
307308 jsonNode . rotation = - jsonNode . rotation * ( 180 / Math . PI ) ;
308309 }
309310
@@ -442,6 +443,7 @@ const processNodePair = async (
442443 jsonNode . styledTextSegments = styledTextSegments ;
443444 }
444445
446+ // Inline text style.
445447 Object . assign ( jsonNode , jsonNode . style ) ;
446448 if ( ! jsonNode . textAutoResize ) {
447449 jsonNode . textAutoResize = "NONE" ;
@@ -492,11 +494,16 @@ const processNodePair = async (
492494 ( jsonNode as any ) . canBeFlattened = false ;
493495 }
494496
495- if ( "individualStrokeWeights" in jsonNode ) {
496- jsonNode . strokeTopWeight = jsonNode . individualStrokeWeights . top ;
497- jsonNode . strokeBottomWeight = jsonNode . individualStrokeWeights . bottom ;
498- jsonNode . strokeLeftWeight = jsonNode . individualStrokeWeights . left ;
499- jsonNode . strokeRightWeight = jsonNode . individualStrokeWeights . right ;
497+ if (
498+ "individualStrokeWeights" in jsonNode &&
499+ jsonNode . individualStrokeWeights
500+ ) {
501+ ( jsonNode as any ) . strokeTopWeight = jsonNode . individualStrokeWeights . top ;
502+ ( jsonNode as any ) . strokeBottomWeight =
503+ jsonNode . individualStrokeWeights . bottom ;
504+ ( jsonNode as any ) . strokeLeftWeight = jsonNode . individualStrokeWeights . left ;
505+ ( jsonNode as any ) . strokeRightWeight =
506+ jsonNode . individualStrokeWeights . right ;
500507 }
501508
502509 await getColorVariables ( jsonNode , settings ) ;
@@ -554,7 +561,7 @@ const processNodePair = async (
554561 // Get only visible JSON children
555562 const visibleJsonChildren = jsonNode . children . filter (
556563 ( child ) => child . visible !== false ,
557- ) ;
564+ ) as AltNode [ ] ;
558565
559566 // Create a map of figma children by ID for easier matching
560567 const figmaChildrenById = new Map ( ) ;
0 commit comments