<commit_before>/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@file:Suppress("FunctionName")

package com.facebook.litho

import com.facebook.yoga.YogaAlign
import com.facebook.yoga.YogaEdge
import com.facebook.yoga.YogaPositionType

/** Builder for setting the same [all] margin for each edge of the child component. */
@Deprecated(message = "Use Style.margin instead")
inline fun DslScope.Margin(all: Dp, content: DslScope.() -> Component): Component =
    content().apply { getOrCreateCommonProps.marginPx(YogaEdge.ALL, all.toPx().value) }

/** Builder for setting [horizontal] and [vertical] margins for the child component. */
@Deprecated(message = "Use Style.margin instead")
inline fun DslScope.Margin(
    horizontal: Dp = 0.dp,
    vertical: Dp = 0.dp,
    content: DslScope.() -> Component
): Component =
    content().apply {
      getOrCreateCommonProps.apply {
        marginPx(YogaEdge.HORIZONTAL, horizontal.toPx().value)
        marginPx(YogaEdge.VERTICAL, vertical.toPx().value)
      }
    }

/**
 * Builder for setting granular [left], [top], [right] and [bottom] paddings to the child component.
 */
@Deprecated(message = "Use Style.margin instead")
inline fun DslScope.Margin(
    left: Dp = 0.dp,
    top: Dp = 0.dp,
    right: Dp = 0.dp,
    bottom: Dp = 0.dp,
    content: DslScope.() -> Component
): Component =
    content().apply {
      getOrCreateCommonProps.apply {
        marginPx(YogaEdge.LEFT, left.toPx().value)
        marginPx(YogaEdge.TOP, top.toPx().value)
        marginPx(YogaEdge.RIGHT, right.toPx().value)
        marginPx(YogaEdge.BOTTOM, bottom.toPx().value)
      }
    }

/**
 * Builder for positioning a child component absolutely within its parent's edges, independent of
 * its siblings. [left], [top], [right], [bottom] specify the offset of the child's respective side
 * from the same side of the parent.
 */
@Deprecated(message = "Use Style.position instead")
inline fun DslScope.Position(
    left: Dp? = null,
    top: Dp? = null,
    right: Dp? = null,
    bottom: Dp? = null,
    content: DslScope.() -> Component
): Component =
    content().apply {
      getOrCreateCommonProps.apply {
        positionType(YogaPositionType.ABSOLUTE)<commit_msg>Remove deprecated way of setting margin in Kotlin components<commit_after>/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@file:Suppress("FunctionName")

package com.facebook.litho

import com.facebook.yoga.YogaAlign
import com.facebook.yoga.YogaEdge
import com.facebook.yoga.YogaPositionType

/**
 * Builder for positioning a child component absolutely within its parent's edges, independent of
 * its siblings. [left], [top], [right], [bottom] specify the offset of the child's respective side
 * from the same side of the parent.
 */
@Deprecated(message = "Use Style.position instead")
inline fun DslScope.Position(
    left: Dp? = null,
    top: Dp? = null,
    right: Dp? = null,
    bottom: Dp? = null,
    content: DslScope.() -> Component
): Component =
    content().apply {
      getOrCreateCommonProps.apply {
        positionType(YogaPositionType.ABSOLUTE)
{'fraction_non_alphanumeric': 0.10892263882297105, 'fraction_numerical': 0.0033222591362126247, 'mean_word_length': 3.652317880794702, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '533223', 'n_tokens_mistral': 1246, 'n_tokens_neox': 1224, 'n_words': 427}