# Generated by detroit
# See https://github.com/bourbonut/detroit/tree/main/api_maker

from functools import partial
from operator import is_not

class brushY:
    def __init__(self, content="brushY"):
        self.content = content

    def __repr__(self):
        return self.content

    def __str__(self):
        return self.content

    def __call__(self, *args):
        arguments = ", ".join(map(repr, args))
        return f"{self}({arguments})"

    def move(self, group=None, selection=None, event=None):
        """
        Examples · Source · Sets the active selection of the brush on the specified group,
        which must be a selection or a transition of SVG G elements. The selection must be
        defined as an array of numbers, or null to clear the brush selection. For a
        two-dimensional brush, it must be defined as [[x0, y0], [x1, y1]], where x0 is the
        minimum x-value, y0 is the minimum y-value, x1 is the maximum x-value, and y1 is the
        maximum y-value. For an x-brush, it must be defined as [x0, x1]; for a y-brush, it must
        be defined as [y0, y1]. The selection may also be specified as a function which returns
        such an array; if a function, it is invoked for each selected element, being passed the
        current datum d and index i, with the this context as the current DOM element. The
        returned array defines the brush selection for that element.

        See more informations `here <https://d3js.org/d3-brush#brush_move>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (group, selection, event))))
        return brushY(content=f"{self.content}.move({arguments})")


    def clear(self, group=None, event=None):
        """
        Examples · Source · An alias for brush.move with the null selection.

        See more informations `here <https://d3js.org/d3-brush#brush_clear>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (group, event))))
        return brushY(content=f"{self.content}.clear({arguments})")


    def extent(self, extent=None):
        """
        Examples · Source · If extent is specified, sets the brushable extent to the specified
        array of points [[x0, y0], [x1, y1]], where [x0, y0] is the top-left corner and [x1,
        y1] is the bottom-right corner, and returns this brush. The extent may also be
        specified as a function which returns such an array; if a function, it is invoked for
        each selected element, being passed the current datum d and index i, with the this
        context as the current DOM element. If extent is not specified, returns the current
        extent accessor, which defaults to:
        .. code:: javascript

            function defaultExtent() {
              var svg = this.ownerSVGElement || this;
              if (svg.hasAttribute("viewBox")) {
                svg = svg.viewBox.baseVal;
                return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];
              }
              return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];
            }

        This default implementation requires that the owner SVG element have a defined viewBox,
        or width and height attributes. Alternatively, consider using
        element.getBoundingClientRect. (In Firefox, element.clientWidth and
        element.clientHeight is zero for SVG elements!)
        The brush extent determines the size of the invisible overlay and also constrains the
        brush selection; the brush selection cannot go outside the brush extent.

        See more informations `here <https://d3js.org/d3-brush#brush_extent>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (extent,))))
        return brushY(content=f"{self.content}.extent({arguments})")


    def filter(self, filter=None):
        """
        Examples · Source · If filter is specified, sets the filter to the specified function
        and returns the brush. If filter is not specified, returns the current filter, which
        defaults to:
        .. code:: javascript

            function filter(event) {
              return !event.ctrlKey && !event.button;
            }

        If the filter returns falsey, the initiating event is ignored and no brush gesture is
        started. Thus, the filter determines which input events are ignored. The default filter
        ignores mousedown events on secondary buttons, since those buttons are typically
        intended for other purposes, such as the context menu.

        See more informations `here <https://d3js.org/d3-brush#brush_filter>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (filter,))))
        return brushY(content=f"{self.content}.filter({arguments})")


    def touchable(self, touchable=None):
        """
        Source · If touchable is specified, sets the touch support detector to the specified
        function and returns the brush. If touchable is not specified, returns the current
        touch support detector, which defaults to:
        .. code:: javascript

            function touchable() {
              return navigator.maxTouchPoints || ("ontouchstart" in this);
            }

        Touch event listeners are only registered if the detector returns truthy for the
        corresponding element when the brush is applied. The default detector works well for
        most browsers that are capable of touch input, but not all; Chrome’s mobile device
        emulator, for example, fails detection.

        See more informations `here <https://d3js.org/d3-brush#brush_touchable>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (touchable,))))
        return brushY(content=f"{self.content}.touchable({arguments})")


    def keyModifiers(self, modifiers=None):
        """
        Source · If modifiers is specified, sets whether the brush listens to key events during
        brushing and returns the brush. If modifiers is not specified, returns the current
        behavior, which defaults to true.

        See more informations `here <https://d3js.org/d3-brush#brush_keyModifiers>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (modifiers,))))
        return brushY(content=f"{self.content}.keyModifiers({arguments})")


    def handleSize(self, size=None):
        """
        Source · If size is specified, sets the size of the brush handles to the specified
        number and returns the brush. If size is not specified, returns the current handle
        size, which defaults to six. This method must be called before applying the brush to a
        selection; changing the handle size does not affect brushes that were previously
        rendered.

        See more informations `here <https://d3js.org/d3-brush#brush_handleSize>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (size,))))
        return brushY(content=f"{self.content}.handleSize({arguments})")


    def on(self, typenames=None, listener=None):
        """
        Source · If listener is specified, sets the event listener for the specified typenames
        and returns the brush. If an event listener was already registered for the same type
        and name, the existing listener is removed before the new listener is added. If
        listener is null, removes the current event listeners for the specified typenames, if
        any. If listener is not specified, returns the first currently-assigned listener
        matching the specified typenames, if any. When a specified event is dispatched, each
        listener will be invoked with the same context and arguments as selection.on listeners:
        the current event event and datum d, with the this context as the current DOM element.
        The typenames is a string containing one or more typename separated by whitespace. Each
        typename is a type, optionally followed by a period (.) and a name, such as brush.foo
        and brush.bar; the name allows multiple listeners to be registered for the same type.
        The type must be one of the following:
        See dispatch.on and brush events for more.

        See more informations `here <https://d3js.org/d3-brush#brush_on>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (typenames, listener))))
        return brushY(content=f"{self.content}.on({arguments})")

