|
1 | 1 | import { nodes } from "@design-sdk/core"; |
2 | 2 | import { Widget } from "@reflect-ui/core"; |
| 3 | +import type { Blurred, Opacity, Rotation } from "@reflect-ui/core"; |
| 4 | +import type { Stretched } from "./tokens"; |
3 | 5 | import { tokenizeText } from "./token-text"; |
4 | 6 | import { tokenizeLayout } from "./token-layout"; |
5 | 7 | import { tokenizeContainer } from "./token-container"; |
@@ -167,10 +169,11 @@ function handleNode( |
167 | 169 | } |
168 | 170 |
|
169 | 171 | // - button - |
170 | | - const _detect_if_button = detectIf.button(node); |
171 | | - if (_detect_if_button.result) { |
172 | | - return tokenizeButton.fromManifest(node, _detect_if_button.data); |
173 | | - } |
| 172 | + // TODO: this causes confliction with flags |
| 173 | + // const _detect_if_button = detectIf.button(node); |
| 174 | + // if (_detect_if_button.result) { |
| 175 | + // return tokenizeButton.fromManifest(node, _detect_if_button.data); |
| 176 | + // } |
174 | 177 | } |
175 | 178 | // ------------------------------------------------------------------------- |
176 | 179 | // --------------------------- Detected tokens ----------------------------- |
@@ -233,33 +236,37 @@ function handleNode( |
233 | 236 | return tokenizedTarget; |
234 | 237 | } |
235 | 238 |
|
236 | | -function post_wrap(node: nodes.ReflectSceneNode, tokenizedTarget: Widget) { |
237 | | - if (tokenizedTarget) { |
| 239 | +export function post_wrap( |
| 240 | + node: nodes.ReflectSceneNode, |
| 241 | + tokenizedTarget: Widget |
| 242 | +): Widget | Stretched | Opacity | Blurred | Rotation { |
| 243 | + let wrapped = tokenizedTarget; |
| 244 | + if (wrapped) { |
238 | 245 | if (hasStretching(node)) { |
239 | | - tokenizedTarget = wrap_with_stretched(node, tokenizedTarget); |
| 246 | + wrapped = wrap_with_stretched(node, wrapped); |
240 | 247 | } |
241 | 248 | } |
242 | 249 |
|
243 | 250 | if (hasDimmedOpacity(node)) { |
244 | | - tokenizedTarget = wrap_with_opacity(node, tokenizedTarget); |
| 251 | + wrapped = wrap_with_opacity(node, wrapped); |
245 | 252 | } |
246 | 253 |
|
247 | 254 | node.effects.map((d) => { |
248 | 255 | const blurEffect = hasBlurType(d); |
249 | 256 | if (blurEffect) { |
250 | 257 | if (hasLayerBlurType(blurEffect)) { |
251 | | - tokenizedTarget = wrap_with_layer_blur(node, tokenizedTarget); |
| 258 | + wrapped = wrap_with_layer_blur(node, wrapped); |
252 | 259 | } else if (hasBackgroundBlurType(blurEffect)) { |
253 | | - tokenizedTarget = wrap_with_background_blur(node, tokenizedTarget); |
| 260 | + wrapped = wrap_with_background_blur(node, wrapped); |
254 | 261 | } |
255 | 262 | } |
256 | 263 | }); |
257 | 264 |
|
258 | 265 | if (hasRotation(node)) { |
259 | | - tokenizedTarget = wrap_with_rotation(node, tokenizedTarget); |
| 266 | + wrapped = wrap_with_rotation(node, wrapped); |
260 | 267 | } |
261 | 268 |
|
262 | | - return tokenizedTarget; |
| 269 | + return wrapped; |
263 | 270 | } |
264 | 271 |
|
265 | 272 | function handle_by_types( |
|
0 commit comments