1+ import { deref } from "@thi.ng/api/deref" ;
12import { isArrayLike } from "@thi.ng/checks/is-arraylike" ;
23import { isString } from "@thi.ng/checks/is-string" ;
34import { css } from "@thi.ng/color/css/css" ;
@@ -44,7 +45,7 @@ const DEFAULT_NUMERIC_IDS = [
4445const numericAttribs = ( attribs : any , ids : string [ ] ) => {
4546 let v : any ;
4647 for ( let id of DEFAULT_NUMERIC_IDS . concat ( ids ) ) {
47- typeof ( v = attribs [ id ] ) === "number" && ( attribs [ id ] = ff ( v ) ) ;
48+ typeof ( v = deref ( attribs [ id ] ) ) === "number" && ( attribs [ id ] = ff ( v ) ) ;
4849 }
4950 return attribs ;
5051} ;
@@ -107,7 +108,7 @@ export const fattribs = (attribs: any, ...numericIDs: string[]) => {
107108const ftransforms = ( attribs : any ) => {
108109 let v : any ;
109110 if (
110- ( v = attribs . transform ) ||
111+ ( v = deref ( attribs . transform ) ) ||
111112 attribs . translate ||
112113 attribs . scale != null ||
113114 attribs . rotate
@@ -132,15 +133,15 @@ const ftransforms = (attribs: any) => {
132133const buildTransform = ( attribs : any ) => {
133134 const tx : string [ ] = [ ] ;
134135 let v : any ;
135- if ( ( v = attribs . translate ) ) {
136+ if ( ( v = deref ( attribs . translate ) ) ) {
136137 tx . push ( isString ( v ) ? v : `translate(${ ff ( v [ 0 ] ) } ${ ff ( v [ 1 ] ) } )` ) ;
137138 delete attribs . translate ;
138139 }
139- if ( ( v = attribs . rotate ) ) {
140+ if ( ( v = deref ( attribs . rotate ) ) ) {
140141 tx . push ( isString ( v ) ? v : `rotate(${ ff ( ( v * 180 ) / Math . PI ) } )` ) ;
141142 delete attribs . rotate ;
142143 }
143- if ( ( v = attribs . scale ) != null ) {
144+ if ( ( v = deref ( attribs . scale ) ) != null ) {
144145 tx . push (
145146 isString ( v )
146147 ? v
@@ -165,12 +166,14 @@ const buildTransform = (attribs: any) => {
165166 *
166167 * @internal
167168 */
168- export const fcolor = ( col : any ) =>
169- isString ( col )
170- ? col [ 0 ] === "$"
171- ? `url(#${ col . substring ( 1 ) } )`
172- : col
169+ export const fcolor = ( col : any ) => {
170+ const $col = deref ( col ) ;
171+ return isString ( $col )
172+ ? $col [ 0 ] === "$"
173+ ? `url(#${ $col . substring ( 1 ) } )`
174+ : $col
173175 : css ( col ) ;
176+ } ;
174177
175178/** @internal */
176179export const withoutKeys = ( src : any , keys : Set < PropertyKey > ) => {
0 commit comments