From 0eb284ac6b5f97ce63cca558919f4f1b61b15e86 Mon Sep 17 00:00:00 2001 From: softmarshmallow Date: Wed, 23 Feb 2022 01:01:32 +0900 Subject: [PATCH] wip --- externals/design-sdk | 2 +- packages/designto-token/detection/do-have-stretching.ts | 3 ++- .../tokens-to-web-widget/compose-wrapped-with-stretched.ts | 4 +++- packages/designto-web/tokens-to-web-widget/index.ts | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/externals/design-sdk b/externals/design-sdk index 600d159d3..8aafecb42 160000 --- a/externals/design-sdk +++ b/externals/design-sdk @@ -1 +1 @@ -Subproject commit 600d159d3782d97fd660f3fb4807ec1633f66c4e +Subproject commit 8aafecb42c2cb77ec22d2b8192b81ee0d14cb03d diff --git a/packages/designto-token/detection/do-have-stretching.ts b/packages/designto-token/detection/do-have-stretching.ts index 18c5a7078..94269930f 100644 --- a/packages/designto-token/detection/do-have-stretching.ts +++ b/packages/designto-token/detection/do-have-stretching.ts @@ -1,5 +1,6 @@ import type { ReflectSceneNode } from "@design-sdk/figma-node"; -export function hasStretching(node: ReflectSceneNode) { +export function hasStretching(node: ReflectSceneNode): boolean { + // FIXME: this should reflect layoutGrow as well. return node.layoutAlign && node.layoutAlign === "STRETCH"; } diff --git a/packages/designto-web/tokens-to-web-widget/compose-wrapped-with-stretched.ts b/packages/designto-web/tokens-to-web-widget/compose-wrapped-with-stretched.ts index f2b58aeb2..aed29dd7f 100644 --- a/packages/designto-web/tokens-to-web-widget/compose-wrapped-with-stretched.ts +++ b/packages/designto-web/tokens-to-web-widget/compose-wrapped-with-stretched.ts @@ -2,7 +2,7 @@ import * as core from "@reflect-ui/core"; import { Composer } from "."; import { Stretched } from "@designto/token/tokens"; -export function compose_wrapped_with_clip_stretched( +export function compose_wrapped_with_stretched( widget: Stretched, child_composer: Composer ) { @@ -19,6 +19,8 @@ export function compose_wrapped_with_clip_stretched( const child = child_composer(widget.child); child.extendStyle({ "align-self": "stretch", + // TODO: + // flex: 1, [remove_size]: undefined, }); return child; diff --git a/packages/designto-web/tokens-to-web-widget/index.ts b/packages/designto-web/tokens-to-web-widget/index.ts index 45a4b6abe..720e8c8c2 100644 --- a/packages/designto-web/tokens-to-web-widget/index.ts +++ b/packages/designto-web/tokens-to-web-widget/index.ts @@ -11,7 +11,7 @@ import { compose_wrapped_with_rotation } from "./compose-wrapped-with-rotation"; import { compose_wrapped_with_blurred } from "./compose-wrapped-with-blurred"; import { compose_wrapped_with_opacity } from "./compose-wrapped-with-opacity"; import { compose_wrapped_with_positioned } from "./compose-wrapped-with-positioned"; -import { compose_wrapped_with_clip_stretched } from "./compose-wrapped-with-stretched"; +import { compose_wrapped_with_stretched } from "./compose-wrapped-with-stretched"; import { compose_wrapped_with_sized_box } from "./compose-wrapped-with-sized-box"; import { compose_wrapped_with_overflow_box } from "./compose-wrapped-with-overflow-box"; import { compose_instanciation } from "./compose-instanciation"; @@ -235,7 +235,7 @@ function compose( // special tokens // ------------------------------------- else if (widget instanceof special.Stretched) { - thisWebWidget = compose_wrapped_with_clip_stretched(widget, handleChild); + thisWebWidget = compose_wrapped_with_stretched(widget, handleChild); } // ------------------------------------- // -------------------------------------